samba36: reorganize patches, fix windows 7 compatibility

git-svn-id: svn://svn.openwrt.org/openwrt/packages@30505 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd 2012-02-13 16:51:18 +00:00
parent d032773db1
commit 9e7c53db49
12 changed files with 140 additions and 266 deletions

View File

@ -1,9 +1,9 @@
--- a/source3/librpc/rpc/rpc_common.c
+++ b/source3/librpc/rpc/rpc_common.c
@@ -127,9 +127,11 @@ static bool initialize_interfaces(void)
@@ -119,9 +119,11 @@ static bool initialize_interfaces(void)
if (!smb_register_ndr_interface(&ndr_table_netdfs)) {
return false;
}
#endif
+#ifdef DEVELOPER
if (!smb_register_ndr_interface(&ndr_table_rpcecho)) {
return false;
@ -14,10 +14,10 @@
}
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -632,7 +632,9 @@ static struct cmd_set *rpcclient_command
#ifdef DFS_SUPPORT
@@ -628,7 +628,9 @@ static struct cmd_set *rpcclient_command
netlogon_commands,
srvsvc_commands,
dfs_commands,
#endif
+#ifdef DEVELOPER
echo_commands,
+#endif

View File

@ -1,71 +0,0 @@
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -132,7 +132,9 @@ static void exit_server_common(enum serv
#endif
if (am_parent) {
+#ifdef WKSSVC_SUPPORT
rpc_wkssvc_shutdown();
+#endif
#ifdef ACTIVE_DIRECTORY
rpc_dssetup_shutdown();
#endif
--- a/source3/rpc_server/rpc_ep_setup.c
+++ b/source3/rpc_server/rpc_ep_setup.c
@@ -982,6 +982,7 @@ static bool dssetup_init_cb(void *ptr)
}
#endif
+#ifdef WKSSVC_SUPPORT
static bool wkssvc_init_cb(void *ptr)
{
struct dcesrv_ep_context *ep_ctx =
@@ -1029,6 +1030,7 @@ static bool wkssvc_init_cb(void *ptr)
return true;
}
+#endif
bool dcesrv_ep_setup(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
@@ -1202,12 +1204,14 @@ bool dcesrv_ep_setup(struct tevent_conte
}
#endif
+#ifdef WKSSVC_SUPPORT
wkssvc_cb.init = wkssvc_init_cb;
wkssvc_cb.shutdown = NULL;
wkssvc_cb.private_data = ep_ctx;
if (!NT_STATUS_IS_OK(rpc_wkssvc_init(&wkssvc_cb))) {
return false;
}
+#endif
return true;
}
--- a/source3/librpc/rpc/rpc_common.c
+++ b/source3/librpc/rpc/rpc_common.c
@@ -109,9 +109,11 @@ static bool initialize_interfaces(void)
if (!smb_register_ndr_interface(&ndr_table_srvsvc)) {
return false;
}
+#ifdef WKSSVC_SUPPORT
if (!smb_register_ndr_interface(&ndr_table_wkssvc)) {
return false;
}
+#endif
#ifdef WINREG_SUPPORT
if (!smb_register_ndr_interface(&ndr_table_winreg)) {
return false;
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -638,7 +638,9 @@ static struct cmd_set *rpcclient_command
epmapper_commands,
shutdown_commands,
test_commands,
+#ifdef WKSSVC_SUPPORT
wkssvc_commands,
+#endif
#ifdef EXTRA_SERVICES
ntsvcs_commands,
drsuapi_commands,

View File

@ -1,180 +0,0 @@
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -154,7 +154,9 @@ static void exit_server_common(enum serv
rpc_spoolss_shutdown();
#endif
+#ifdef SRVSVC_SUPPORT
rpc_srvsvc_shutdown();
+#endif
#ifdef WINREG_SUPPORT
rpc_winreg_shutdown();
#endif
--- a/source3/librpc/rpc/rpc_common.c
+++ b/source3/librpc/rpc/rpc_common.c
@@ -108,9 +108,11 @@ static bool initialize_interfaces(void)
return false;
}
#endif
+#ifdef SRVSVC_SUPPORT
if (!smb_register_ndr_interface(&ndr_table_srvsvc)) {
return false;
}
+#endif
#ifdef WKSSVC_SUPPORT
if (!smb_register_ndr_interface(&ndr_table_wkssvc)) {
return false;
--- a/source3/rpc_server/rpc_ep_setup.c
+++ b/source3/rpc_server/rpc_ep_setup.c
@@ -459,6 +459,7 @@ static bool winreg_init_cb(void *ptr)
}
#endif
+#ifdef SRVSVC_SUPPORT
static bool srvsvc_init_cb(void *ptr)
{
struct dcesrv_ep_context *ep_ctx =
@@ -507,6 +508,7 @@ static bool srvsvc_init_cb(void *ptr)
return true;
}
+#endif
static bool lsarpc_init_cb(void *ptr)
{
@@ -1098,13 +1100,14 @@ bool dcesrv_ep_setup(struct tevent_conte
}
#endif
+#ifdef SRVSVC_SUPPORT
srvsvc_cb.init = srvsvc_init_cb;
srvsvc_cb.shutdown = NULL;
srvsvc_cb.private_data = ep_ctx;
if (!NT_STATUS_IS_OK(rpc_srvsvc_init(&srvsvc_cb))) {
return false;
}
-
+#endif
lsarpc_cb.init = lsarpc_init_cb;
lsarpc_cb.shutdown = NULL;
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -630,7 +630,9 @@ static struct cmd_set *rpcclient_command
#ifdef NETLOGON_SUPPORT
netlogon_commands,
#endif
+#ifdef SRVSVC_SUPPORT
srvsvc_commands,
+#endif
#ifdef DFS_SUPPORT
dfs_commands,
#endif
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -2197,6 +2197,10 @@ static bool api_RNetShareAdd(struct smbd
struct srvsvc_NetShareInfo2 info2;
struct dcerpc_binding_handle *b;
+#ifndef SRVSVC_SUPPORT
+ return False;
+#endif
+
if (!str1 || !str2 || !p) {
return False;
}
@@ -3818,10 +3822,7 @@ static bool api_RNetServerGetInfo(struct
NTSTATUS status;
WERROR werr;
TALLOC_CTX *mem_ctx = talloc_tos();
- struct rpc_pipe_client *cli = NULL;
- union srvsvc_NetSrvInfo info;
int errcode;
- struct dcerpc_binding_handle *b;
if (!str1 || !str2 || !p) {
return False;
@@ -3884,66 +3885,16 @@ static bool api_RNetServerGetInfo(struct
p = *rdata;
p2 = p + struct_len;
- status = rpc_pipe_open_interface(mem_ctx, &ndr_table_srvsvc.syntax_id,
- conn->session_info,
- &conn->sconn->client_id,
- conn->sconn->msg_ctx,
- &cli);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(0,("api_RNetServerGetInfo: could not connect to srvsvc: %s\n",
- nt_errstr(status)));
- errcode = W_ERROR_V(ntstatus_to_werror(status));
- goto out;
- }
-
- b = cli->binding_handle;
-
- status = dcerpc_srvsvc_NetSrvGetInfo(b, mem_ctx,
- NULL,
- 101,
- &info,
- &werr);
- if (!NT_STATUS_IS_OK(status)) {
- errcode = W_ERROR_V(ntstatus_to_werror(status));
- goto out;
- }
- if (!W_ERROR_IS_OK(werr)) {
- errcode = W_ERROR_V(werr);
- goto out;
- }
-
- if (info.info101 == NULL) {
- errcode = W_ERROR_V(WERR_INVALID_PARAM);
- goto out;
- }
-
if (uLevel != 20) {
- srvstr_push(NULL, 0, p, info.info101->server_name, 16,
+ srvstr_push(NULL, 0, p, global_myname(), 16,
STR_ASCII|STR_UPPER|STR_TERMINATE);
- }
+ }
p += 16;
if (uLevel > 0) {
- SCVAL(p,0,info.info101->version_major);
- SCVAL(p,1,info.info101->version_minor);
- SIVAL(p,2,info.info101->server_type);
-
- if (mdrcnt == struct_len) {
- SIVAL(p,6,0);
- } else {
- SIVAL(p,6,PTR_DIFF(p2,*rdata));
- if (mdrcnt - struct_len <= 0) {
- return false;
- }
- push_ascii(p2,
- info.info101->comment,
- MIN(mdrcnt - struct_len,
- MAX_SERVER_STRING_LENGTH),
- STR_TERMINATE);
- p2 = skip_string(*rdata,*rdata_len,p2);
- if (!p2) {
- return False;
- }
- }
+ SCVAL(p,0,lp_major_announce_version());
+ SCVAL(p,1,lp_minor_announce_version());
+ SIVAL(p,2,lp_default_server_announce());
+ SIVAL(p,6,0);
}
if (uLevel > 1) {
@@ -5630,6 +5581,10 @@ static bool api_RNetSessionEnum(struct s
uint32_t totalentries, resume_handle = 0;
uint32_t count = 0;
+#ifndef SRVSVC_SUPPORT
+ return False;
+#endif
+
if (!str1 || !str2 || !p) {
return False;
}

View File

@ -12,7 +12,7 @@
if (!smb_register_ndr_interface(&ndr_table_samr)) {
return false;
}
@@ -139,9 +141,11 @@ static bool initialize_interfaces(void)
@@ -141,9 +143,11 @@ static bool initialize_interfaces(void)
if (!smb_register_ndr_interface(&ndr_table_epmapper)) {
return false;
}

View File

@ -1,6 +1,6 @@
--- a/source3/librpc/rpc/rpc_common.c
+++ b/source3/librpc/rpc/rpc_common.c
@@ -129,6 +129,7 @@ static bool initialize_interfaces(void)
@@ -131,6 +131,7 @@ static bool initialize_interfaces(void)
if (!smb_register_ndr_interface(&ndr_table_initshutdown)) {
return false;
}
@ -8,7 +8,7 @@
if (!smb_register_ndr_interface(&ndr_table_svcctl)) {
return false;
}
@@ -138,6 +139,7 @@ static bool initialize_interfaces(void)
@@ -140,6 +141,7 @@ static bool initialize_interfaces(void)
if (!smb_register_ndr_interface(&ndr_table_ntsvcs)) {
return false;
}
@ -84,7 +84,7 @@
#endif
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -635,9 +635,11 @@ static struct cmd_set *rpcclient_command
@@ -637,9 +637,11 @@ static struct cmd_set *rpcclient_command
shutdown_commands,
test_commands,
wkssvc_commands,

View File

@ -134,7 +134,7 @@
return NULL;
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -640,7 +640,9 @@ static struct cmd_set *rpcclient_command
@@ -642,7 +642,9 @@ static struct cmd_set *rpcclient_command
drsuapi_commands,
eventlog_commands,
#endif

View File

@ -42,9 +42,9 @@
return false;
}
+#endif
#ifdef DEVELOPER
if (!smb_register_ndr_interface(&ndr_table_rpcecho)) {
return false;
}
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -139,7 +139,9 @@ static void exit_server_common(enum serv
@ -66,6 +66,6 @@
+#ifdef DFS_SUPPORT
dfs_commands,
+#endif
#ifdef DEVELOPER
echo_commands,
epmapper_commands,
shutdown_commands,
#endif

View File

@ -16,7 +16,7 @@
static bool spoolss_init_cb(void *ptr)
{
@@ -1118,12 +1120,15 @@ bool dcesrv_ep_setup(struct tevent_conte
@@ -1116,12 +1118,15 @@ bool dcesrv_ep_setup(struct tevent_conte
return false;
}
@ -48,7 +48,7 @@
}
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -159,7 +159,9 @@ static void exit_server_common(enum serv
@@ -157,7 +157,9 @@ static void exit_server_common(enum serv
rpc_winreg_shutdown();
#endif
@ -97,3 +97,27 @@
srvsvc_commands,
#ifdef DFS_SUPPORT
dfs_commands,
--- a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
+++ b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
@@ -820,6 +820,10 @@ WERROR _wkssvc_NetrJoinDomain2(struct pi
WERROR werr;
struct security_token *token = p->session_info->security_token;
+#ifndef NETLOGON_SUPPORT
+ return WERR_NOT_SUPPORTED;
+#endif
+
if (!r->in.domain_name) {
return WERR_INVALID_PARAM;
}
@@ -897,6 +901,10 @@ WERROR _wkssvc_NetrUnjoinDomain2(struct
WERROR werr;
struct security_token *token = p->session_info->security_token;
+#ifndef NETLOGON_SUPPORT
+ return WERR_NOT_SUPPORTED;
+#endif
+
if (!r->in.account || !r->in.encrypted_password) {
return WERR_INVALID_PARAM;
}

View File

@ -0,0 +1,71 @@
--- a/source3/librpc/rpc/rpc_common.c
+++ b/source3/librpc/rpc/rpc_common.c
@@ -100,9 +100,11 @@ static bool initialize_interfaces(void)
return false;
}
#endif
+#ifdef SAMR_SUPPORT
if (!smb_register_ndr_interface(&ndr_table_samr)) {
return false;
}
+#endif
#ifdef NETLOGON_SUPPORT
if (!smb_register_ndr_interface(&ndr_table_netlogon)) {
return false;
--- a/source3/rpc_server/rpc_ep_setup.c
+++ b/source3/rpc_server/rpc_ep_setup.c
@@ -557,6 +557,7 @@ static bool lsarpc_init_cb(void *ptr)
return true;
}
+#ifdef SAMR_SUPPORT
static bool samr_init_cb(void *ptr)
{
struct dcesrv_ep_context *ep_ctx =
@@ -605,6 +606,7 @@ static bool samr_init_cb(void *ptr)
return true;
}
+#endif
#ifdef NETLOGON_SUPPORT
static bool netlogon_init_cb(void *ptr)
@@ -1111,12 +1113,14 @@ bool dcesrv_ep_setup(struct tevent_conte
return false;
}
+#ifdef SAMR_SUPPORT
samr_cb.init = samr_init_cb;
samr_cb.shutdown = NULL;
samr_cb.private_data = ep_ctx;
if (!NT_STATUS_IS_OK(rpc_samr_init(&samr_cb))) {
return false;
}
+#endif
#ifdef NETLOGON_SUPPORT
netlogon_cb.init = netlogon_init_cb;
--- a/source3/smbd/server_exit.c
+++ b/source3/smbd/server_exit.c
@@ -160,7 +160,9 @@ static void exit_server_common(enum serv
#ifdef NETLOGON_SUPPORT
rpc_netlogon_shutdown();
#endif
+#ifdef SAMR_SUPPORT
rpc_samr_shutdown();
+#endif
rpc_lsarpc_shutdown();
}
--- a/source3/rpcclient/rpcclient.c
+++ b/source3/rpcclient/rpcclient.c
@@ -623,7 +623,9 @@ static struct cmd_set *rpcclient_command
rpcclient_commands,
lsarpc_commands,
ds_commands,
+#ifdef SAMR_SUPPORT
samr_commands,
+#endif
#ifdef PRINTER_SUPPORT
spoolss_commands,
#endif

View File

@ -0,0 +1,30 @@
--- a/source3/lib/smbconf/smbconf_init.c
+++ b/source3/lib/smbconf/smbconf_init.c
@@ -68,9 +68,12 @@ sbcErr smbconf_init(TALLOC_CTX *mem_ctx,
}
}
+#ifdef REGISTRY_BACKEND
if (strequal(backend, "registry") || strequal(backend, "reg")) {
err = smbconf_init_reg(mem_ctx, conf_ctx, path);
- } else if (strequal(backend, "file") || strequal(backend, "txt")) {
+ } else
+#endif
+ if (strequal(backend, "file") || strequal(backend, "txt")) {
err = smbconf_init_txt(mem_ctx, conf_ctx, path);
} else if (sep == NULL) {
/*
--- a/source3/lib/netapi/serverinfo.c
+++ b/source3/lib/netapi/serverinfo.c
@@ -557,7 +557,10 @@ static WERROR NetServerSetInfo_l_1005(st
return WERR_INVALID_PARAM;
}
- if (!lp_config_backend_is_registry()) {
+#ifdef REGISTRY_BACKEND
+ if (!lp_config_backend_is_registry())
+#endif
+ {
libnetapi_set_error_string(ctx,
"Configuration manipulation requested but not "
"supported by backend");