summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-05-08 18:32:22 +0200
committerGünther Deschner <gd@samba.org>2008-05-09 14:59:20 +0200
commit67c644aa591c051cfe1e3f3536186ecf0b4449f2 (patch)
treec32fad2091649b7d47c3210bfb08a7b2e2bc791a
parentc58ab8f3b251f9fbf79fc8a528717e0756c02a76 (diff)
downloadsamba-67c644aa591c051cfe1e3f3536186ecf0b4449f2.tar.gz
samba-67c644aa591c051cfe1e3f3536186ecf0b4449f2.tar.bz2
samba-67c644aa591c051cfe1e3f3536186ecf0b4449f2.zip
dsgetdcname: use existing messaging_context if possible.
Guenther (This used to be commit 7889516a384c155a9045aad4409c041fddd0d98d)
-rw-r--r--source3/lib/netapi/getdc.c1
-rw-r--r--source3/lib/netapi/joindomain.c6
-rw-r--r--source3/libnet/libnet_join.c2
-rw-r--r--source3/librpc/gen_ndr/libnet_join.h2
-rw-r--r--source3/librpc/idl/libnet_join.idl2
-rw-r--r--source3/libsmb/dsgetdcname.c22
-rw-r--r--source3/rpc_server/srv_wkssvc_nt.c2
-rw-r--r--source3/utils/net_lookup.c2
-rw-r--r--source3/winbindd/winbindd_locator.c3
9 files changed, 31 insertions, 11 deletions
diff --git a/source3/lib/netapi/getdc.c b/source3/lib/netapi/getdc.c
index 38aaf0ef85..c1d021b1d4 100644
--- a/source3/lib/netapi/getdc.c
+++ b/source3/lib/netapi/getdc.c
@@ -118,6 +118,7 @@ WERROR DsGetDcName_l(struct libnetapi_ctx *ctx,
NTSTATUS status;
status = dsgetdcname(ctx,
+ NULL,
r->in.domain_name,
r->in.domain_guid,
r->in.site_name,
diff --git a/source3/lib/netapi/joindomain.c b/source3/lib/netapi/joindomain.c
index b7c9fa5acc..66f7cfb13f 100644
--- a/source3/lib/netapi/joindomain.c
+++ b/source3/lib/netapi/joindomain.c
@@ -51,7 +51,7 @@ WERROR NetJoinDomain_l(struct libnetapi_ctx *mem_ctx,
uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED |
DS_WRITABLE_REQUIRED |
DS_RETURN_DNS_NAME;
- status = dsgetdcname(mem_ctx, r->in.domain,
+ status = dsgetdcname(mem_ctx, NULL, r->in.domain,
NULL, NULL, flags, &info);
if (!NT_STATUS_IS_OK(status)) {
libnetapi_set_error_string(mem_ctx,
@@ -180,7 +180,7 @@ WERROR NetUnjoinDomain_l(struct libnetapi_ctx *mem_ctx,
uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED |
DS_WRITABLE_REQUIRED |
DS_RETURN_DNS_NAME;
- status = dsgetdcname(mem_ctx, domain,
+ status = dsgetdcname(mem_ctx, NULL, domain,
NULL, NULL, flags, &info);
if (!NT_STATUS_IS_OK(status)) {
libnetapi_set_error_string(mem_ctx,
@@ -360,7 +360,7 @@ WERROR NetGetJoinableOUs_l(struct libnetapi_ctx *ctx,
uint32_t flags = DS_DIRECTORY_SERVICE_REQUIRED |
DS_RETURN_DNS_NAME;
- status = dsgetdcname(ctx, r->in.domain,
+ status = dsgetdcname(ctx, NULL, r->in.domain,
NULL, NULL, flags, &info);
if (!NT_STATUS_IS_OK(status)) {
libnetapi_set_error_string(ctx, "%s",
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 8e503382f4..36700b26c0 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -1622,6 +1622,7 @@ static WERROR libnet_DomainJoin(TALLOC_CTX *mem_ctx,
struct netr_DsRGetDCNameInfo *info;
const char *dc;
status = dsgetdcname(mem_ctx,
+ r->in.msg_ctx,
r->in.domain_name,
NULL,
NULL,
@@ -1778,6 +1779,7 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx,
struct netr_DsRGetDCNameInfo *info;
const char *dc;
status = dsgetdcname(mem_ctx,
+ r->in.msg_ctx,
r->in.domain_name,
NULL,
NULL,
diff --git a/source3/librpc/gen_ndr/libnet_join.h b/source3/librpc/gen_ndr/libnet_join.h
index 0415f030b4..e5ec438bb5 100644
--- a/source3/librpc/gen_ndr/libnet_join.h
+++ b/source3/librpc/gen_ndr/libnet_join.h
@@ -28,6 +28,7 @@ struct libnet_JoinCtx {
struct ads_struct *ads;/* [ref] */
uint8_t debug;
enum netr_SchannelType secure_channel_type;
+ struct messaging_context *msg_ctx;/* [noprint,ref] */
} in;
struct {
@@ -59,6 +60,7 @@ struct libnet_UnjoinCtx {
struct dom_sid *domain_sid;/* [ref] */
struct ads_struct *ads;/* [ref] */
uint8_t debug;
+ struct messaging_context *msg_ctx;/* [noprint,ref] */
} in;
struct {
diff --git a/source3/librpc/idl/libnet_join.idl b/source3/librpc/idl/libnet_join.idl
index 3975d83a80..7f6e346455 100644
--- a/source3/librpc/idl/libnet_join.idl
+++ b/source3/librpc/idl/libnet_join.idl
@@ -31,6 +31,7 @@ interface libnetjoin
[in] ads_struct *ads,
[in] boolean8 debug,
[in] netr_SchannelType secure_channel_type,
+ [in,noprint] messaging_context *msg_ctx,
[out] string account_name,
[out] string netbios_domain_name,
[out] string dns_domain_name,
@@ -54,6 +55,7 @@ interface libnetjoin
[in] dom_sid *domain_sid,
[in] ads_struct *ads,
[in] boolean8 debug,
+ [in,noprint] messaging_context *msg_ctx,
[out] string netbios_domain_name,
[out] string dns_domain_name,
[out] boolean8 modified_config,
diff --git a/source3/libsmb/dsgetdcname.c b/source3/libsmb/dsgetdcname.c
index 8021f8f054..d414d24783 100644
--- a/source3/libsmb/dsgetdcname.c
+++ b/source3/libsmb/dsgetdcname.c
@@ -330,6 +330,7 @@ static NTSTATUS store_cldap_reply(TALLOC_CTX *mem_ctx,
****************************************************************/
static NTSTATUS dsgetdcname_cache_refresh(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
const char *domain_name,
struct GUID *domain_guid,
uint32_t flags,
@@ -339,6 +340,7 @@ static NTSTATUS dsgetdcname_cache_refresh(TALLOC_CTX *mem_ctx,
struct netr_DsRGetDCNameInfo *dc_info;
return dsgetdcname(mem_ctx,
+ msg_ctx,
domain_name,
domain_guid,
site_name,
@@ -494,6 +496,7 @@ static NTSTATUS dsgetdcname_cache_fetch(TALLOC_CTX *mem_ctx,
****************************************************************/
static NTSTATUS dsgetdcname_cached(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
const char *domain_name,
struct GUID *domain_guid,
uint32_t flags,
@@ -516,7 +519,8 @@ static NTSTATUS dsgetdcname_cached(TALLOC_CTX *mem_ctx,
}
if (expired) {
- status = dsgetdcname_cache_refresh(mem_ctx, domain_name,
+ status = dsgetdcname_cache_refresh(mem_ctx, msg_ctx,
+ domain_name,
domain_guid, flags,
site_name, *info);
if (!NT_STATUS_IS_OK(status)) {
@@ -1119,6 +1123,7 @@ static struct messaging_context *msg_context(TALLOC_CTX *mem_ctx)
****************************************************************/
static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
const char *domain_name,
uint32_t flags,
struct ip_service_name *dclist,
@@ -1132,12 +1137,15 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
int i;
const char *dc_name = NULL;
fstring tmp_dc_name;
- struct messaging_context *msg_ctx = msg_context(mem_ctx);
union nbt_cldap_netlogon *r = NULL;
uint32_t nt_version = NETLOGON_VERSION_1 |
NETLOGON_VERSION_5 |
NETLOGON_VERSION_5EX_WITH_IP;
+ if (!msg_ctx) {
+ msg_ctx = msg_context(mem_ctx);
+ }
+
if (flags & DS_PDC_REQUIRED) {
name_type = NBT_NAME_PDC;
}
@@ -1221,6 +1229,7 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
****************************************************************/
static NTSTATUS dsgetdcname_rediscover(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
const char *domain_name,
struct GUID *domain_guid,
uint32_t flags,
@@ -1239,7 +1248,7 @@ static NTSTATUS dsgetdcname_rediscover(TALLOC_CTX *mem_ctx,
&dclist, &num_dcs);
NT_STATUS_NOT_OK_RETURN(status);
- return process_dc_netbios(mem_ctx, domain_name, flags,
+ return process_dc_netbios(mem_ctx, msg_ctx, domain_name, flags,
dclist, num_dcs, info);
}
@@ -1269,7 +1278,7 @@ static NTSTATUS dsgetdcname_rediscover(TALLOC_CTX *mem_ctx,
&num_dcs);
NT_STATUS_NOT_OK_RETURN(status);
- return process_dc_netbios(mem_ctx, domain_name, flags, dclist,
+ return process_dc_netbios(mem_ctx, msg_ctx, domain_name, flags, dclist,
num_dcs, info);
}
@@ -1280,6 +1289,7 @@ static NTSTATUS dsgetdcname_rediscover(TALLOC_CTX *mem_ctx,
********************************************************************/
NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
+ struct messaging_context *msg_ctx,
const char *domain_name,
struct GUID *domain_guid,
const char *site_name,
@@ -1306,7 +1316,7 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
goto rediscover;
}
- status = dsgetdcname_cached(mem_ctx, domain_name, domain_guid,
+ status = dsgetdcname_cached(mem_ctx, msg_ctx, domain_name, domain_guid,
flags, site_name, &myinfo);
if (NT_STATUS_IS_OK(status)) {
*info = myinfo;
@@ -1318,7 +1328,7 @@ NTSTATUS dsgetdcname(TALLOC_CTX *mem_ctx,
}
rediscover:
- status = dsgetdcname_rediscover(mem_ctx, domain_name,
+ status = dsgetdcname_rediscover(mem_ctx, msg_ctx, domain_name,
domain_guid, flags, site_name,
&myinfo);
diff --git a/source3/rpc_server/srv_wkssvc_nt.c b/source3/rpc_server/srv_wkssvc_nt.c
index 3c006fd655..3c64abfcdf 100644
--- a/source3/rpc_server/srv_wkssvc_nt.c
+++ b/source3/rpc_server/srv_wkssvc_nt.c
@@ -341,6 +341,7 @@ WERROR _wkssvc_NetrJoinDomain2(pipes_struct *p,
j->in.admin_password = cleartext_pwd;
j->in.debug = true;
j->in.modify_config = lp_config_backend_is_registry();
+ j->in.msg_ctx = smbd_messaging_context();
become_root();
werr = libnet_Join(p->mem_ctx, j);
@@ -407,6 +408,7 @@ WERROR _wkssvc_NetrUnjoinDomain2(pipes_struct *p,
u->in.admin_password = cleartext_pwd;
u->in.debug = true;
u->in.modify_config = lp_config_backend_is_registry();
+ u->in.msg_ctx = smbd_messaging_context();
become_root();
werr = libnet_Unjoin(p->mem_ctx, u);
diff --git a/source3/utils/net_lookup.c b/source3/utils/net_lookup.c
index e5d83bc891..ba4e32ae84 100644
--- a/source3/utils/net_lookup.c
+++ b/source3/utils/net_lookup.c
@@ -402,7 +402,7 @@ static int net_lookup_dsgetdcname(int argc, const char **argv)
site_name = sitename_fetch(domain_name);
}
- status = dsgetdcname(mem_ctx, domain_name, NULL, site_name,
+ status = dsgetdcname(mem_ctx, NULL, domain_name, NULL, site_name,
flags, &info);
if (!NT_STATUS_IS_OK(status)) {
d_printf("failed with: %s\n", nt_errstr(status));
diff --git a/source3/winbindd/winbindd_locator.c b/source3/winbindd/winbindd_locator.c
index f154f36c85..709fbcc5d1 100644
--- a/source3/winbindd/winbindd_locator.c
+++ b/source3/winbindd/winbindd_locator.c
@@ -67,7 +67,8 @@ static enum winbindd_result dual_dsgetdcname(struct winbindd_domain *domain,
DEBUG(3, ("[%5lu]: dsgetdcname for %s\n", (unsigned long)state->pid,
state->request.domain_name));
- result = dsgetdcname(state->mem_ctx, state->request.domain_name,
+ result = dsgetdcname(state->mem_ctx, winbind_messaging_context(),
+ state->request.domain_name,
NULL, NULL, state->request.flags, &info);
if (!NT_STATUS_IS_OK(result)) {