summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-10-28 01:43:06 +0100
committerGünther Deschner <gd@samba.org>2008-10-29 08:56:52 +0100
commitf0697b0ad55fb1915541bf15adc8a4954462f005 (patch)
tree8484d27d9b92479a004475e3875704e0013f78e9
parentf82a11783286abf30c8a36cc46a5098b3284d65d (diff)
downloadsamba-f0697b0ad55fb1915541bf15adc8a4954462f005.tar.gz
samba-f0697b0ad55fb1915541bf15adc8a4954462f005.tar.bz2
samba-f0697b0ad55fb1915541bf15adc8a4954462f005.zip
s4-netlogon: merge netr_DsRGetDCName{Ex,Ex2} from s3 idl.
Guenther
-rw-r--r--source4/librpc/idl/netlogon.idl7
-rw-r--r--source4/rpc_server/netlogon/dcerpc_netlogon.c48
-rw-r--r--source4/torture/rpc/netlogon.c19
-rw-r--r--source4/winbind/wb_dom_info_trusted.c8
4 files changed, 45 insertions, 37 deletions
diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl
index e28da480ca..d3a2945671 100644
--- a/source4/librpc/idl/netlogon.idl
+++ b/source4/librpc/idl/netlogon.idl
@@ -1075,7 +1075,7 @@ interface netlogon
[in,unique] GUID *domain_guid,
[in,unique] GUID *site_guid,
[in] netr_DsRGetDCName_flags flags,
- [out,unique] netr_DsRGetDCNameInfo *info
+ [out,ref] netr_DsRGetDCNameInfo **info
);
/*****************/
@@ -1123,9 +1123,10 @@ interface netlogon
[in,unique] GUID *domain_guid,
[in,unique] [string,charset(UTF16)] uint16 *site_name,
[in] netr_DsRGetDCName_flags flags,
- [out,unique] netr_DsRGetDCNameInfo *info
+ [out,ref] netr_DsRGetDCNameInfo **info
);
+
/****************/
/* Function 0x1c */
WERROR netr_DsRGetSiteName(
@@ -1301,7 +1302,7 @@ interface netlogon
[in,unique] GUID *domain_guid,
[in,unique] [string,charset(UTF16)] uint16 *site_name,
[in] netr_DsRGetDCName_flags flags,
- [out,unique] netr_DsRGetDCNameInfo *info
+ [out,ref] netr_DsRGetDCNameInfo **info
);
/****************/
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index d9717fdc57..5bf60d1578 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -1125,8 +1125,9 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA
struct ldb_message **res;
struct ldb_dn *domain_dn;
int ret;
+ struct netr_DsRGetDCNameInfo *info;
- ZERO_STRUCT(r->out);
+ ZERO_STRUCTP(r->out.info);
sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
if (sam_ctx == NULL) {
@@ -1144,23 +1145,23 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA
return WERR_NO_SUCH_DOMAIN;
}
- r->out.info = talloc(mem_ctx, struct netr_DsRGetDCNameInfo);
- W_ERROR_HAVE_NO_MEMORY(r->out.info);
+ info = talloc(mem_ctx, struct netr_DsRGetDCNameInfo);
+ W_ERROR_HAVE_NO_MEMORY(info);
/* TODO: - return real IP address
* - check all r->in.* parameters (server_unc is ignored by w2k3!)
*/
- r->out.info->dc_unc = talloc_asprintf(mem_ctx, "\\\\%s.%s",
+ info->dc_unc = talloc_asprintf(mem_ctx, "\\\\%s.%s",
lp_netbios_name(dce_call->conn->dce_ctx->lp_ctx),
lp_realm(dce_call->conn->dce_ctx->lp_ctx));
- W_ERROR_HAVE_NO_MEMORY(r->out.info->dc_unc);
- r->out.info->dc_address = talloc_strdup(mem_ctx, "\\\\0.0.0.0");
- W_ERROR_HAVE_NO_MEMORY(r->out.info->dc_address);
- r->out.info->dc_address_type = DS_ADDRESS_TYPE_INET;
- r->out.info->domain_guid = samdb_result_guid(res[0], "objectGUID");
- r->out.info->domain_name = samdb_result_string(res[0], "dnsDomain", NULL);
- r->out.info->forest_name = samdb_result_string(res[0], "dnsDomain", NULL);
- r->out.info->dc_flags = DS_DNS_FOREST |
+ W_ERROR_HAVE_NO_MEMORY(info->dc_unc);
+ info->dc_address = talloc_strdup(mem_ctx, "\\\\0.0.0.0");
+ W_ERROR_HAVE_NO_MEMORY(info->dc_address);
+ info->dc_address_type = DS_ADDRESS_TYPE_INET;
+ info->domain_guid = samdb_result_guid(res[0], "objectGUID");
+ info->domain_name = samdb_result_string(res[0], "dnsDomain", NULL);
+ info->forest_name = samdb_result_string(res[0], "dnsDomain", NULL);
+ info->dc_flags = DS_DNS_FOREST |
DS_DNS_DOMAIN |
DS_DNS_CONTROLLER |
DS_SERVER_WRITABLE |
@@ -1171,10 +1172,12 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA
DS_SERVER_LDAP |
DS_SERVER_GC |
DS_SERVER_PDC;
- r->out.info->dc_site_name = talloc_strdup(mem_ctx, "Default-First-Site-Name");
- W_ERROR_HAVE_NO_MEMORY(r->out.info->dc_site_name);
- r->out.info->client_site_name = talloc_strdup(mem_ctx, "Default-First-Site-Name");
- W_ERROR_HAVE_NO_MEMORY(r->out.info->client_site_name);
+ info->dc_site_name = talloc_strdup(mem_ctx, "Default-First-Site-Name");
+ W_ERROR_HAVE_NO_MEMORY(info->dc_site_name);
+ info->client_site_name = talloc_strdup(mem_ctx, "Default-First-Site-Name");
+ W_ERROR_HAVE_NO_MEMORY(info->client_site_name);
+
+ *r->out.info = info;
return WERR_OK;
}
@@ -1197,12 +1200,10 @@ static WERROR dcesrv_netr_DsRGetDCNameEx(struct dcesrv_call_state *dce_call, TAL
r2.in.domain_name = r->in.domain_name;
r2.in.site_name = r->in.site_name;
r2.in.flags = r->in.flags;
- r2.out.info = NULL;
+ r2.out.info = r->out.info;
werr = dcesrv_netr_DsRGetDCNameEx2(dce_call, mem_ctx, &r2);
-
- r->out.info = r2.out.info;
-
+
return werr;
}
@@ -1225,15 +1226,12 @@ static WERROR dcesrv_netr_DsRGetDCName(struct dcesrv_call_state *dce_call, TALLO
r2.in.site_name = NULL; /* should fill in from site GUID */
r2.in.flags = r->in.flags;
- r2.out.info = NULL;
+ r2.out.info = r->out.info;
werr = dcesrv_netr_DsRGetDCNameEx2(dce_call, mem_ctx, &r2);
-
- r->out.info = r2.out.info;
-
+
return werr;
}
-
/*
netr_NETRLOGONGETTIMESERVICEPARENTDOMAIN
*/
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index 5f8e2fc21b..f23af7e72a 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -1267,19 +1267,21 @@ static bool test_netr_DsRGetDCName(struct torture_context *tctx,
{
NTSTATUS status;
struct netr_DsRGetDCName r;
+ struct netr_DsRGetDCNameInfo *info = NULL;
r.in.server_unc = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm(tctx->lp_ctx));
r.in.domain_guid = NULL;
r.in.site_guid = NULL;
r.in.flags = DS_RETURN_DNS_NAME;
+ r.out.info = &info;
status = dcerpc_netr_DsRGetDCName(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "DsRGetDCName");
torture_assert_werr_ok(tctx, r.out.result, "DsRGetDCName");
return test_netr_DsRGetSiteName(p, tctx,
- r.out.info->dc_unc,
- r.out.info->dc_site_name);
+ info->dc_unc,
+ info->dc_site_name);
}
/*
@@ -1290,19 +1292,21 @@ static bool test_netr_DsRGetDCNameEx(struct torture_context *tctx,
{
NTSTATUS status;
struct netr_DsRGetDCNameEx r;
+ struct netr_DsRGetDCNameInfo *info = NULL;
r.in.server_unc = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
r.in.domain_name = talloc_asprintf(tctx, "%s", lp_realm(tctx->lp_ctx));
r.in.domain_guid = NULL;
r.in.site_name = NULL;
r.in.flags = DS_RETURN_DNS_NAME;
+ r.out.info = &info;
status = dcerpc_netr_DsRGetDCNameEx(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "netr_DsRGetDCNameEx");
torture_assert_werr_ok(tctx, r.out.result, "netr_DsRGetDCNameEx");
- return test_netr_DsRGetSiteName(p, tctx, r.out.info->dc_unc,
- r.out.info->dc_site_name);
+ return test_netr_DsRGetSiteName(p, tctx, info->dc_unc,
+ info->dc_site_name);
}
/*
@@ -1313,6 +1317,7 @@ static bool test_netr_DsRGetDCNameEx2(struct torture_context *tctx,
{
NTSTATUS status;
struct netr_DsRGetDCNameEx2 r;
+ struct netr_DsRGetDCNameInfo *info = NULL;
r.in.server_unc = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
r.in.client_account = NULL;
@@ -1321,6 +1326,7 @@ static bool test_netr_DsRGetDCNameEx2(struct torture_context *tctx,
r.in.domain_guid = NULL;
r.in.site_name = NULL;
r.in.flags = DS_RETURN_DNS_NAME;
+ r.out.info = &info;
torture_comment(tctx, "Testing netr_DsRGetDCNameEx2 without client account\n");
@@ -1332,12 +1338,13 @@ static bool test_netr_DsRGetDCNameEx2(struct torture_context *tctx,
r.in.client_account = TEST_MACHINE_NAME"$";
r.in.mask = ACB_SVRTRUST;
r.in.flags = DS_RETURN_FLAT_NAME;
+ r.out.info = &info;
status = dcerpc_netr_DsRGetDCNameEx2(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "netr_DsRGetDCNameEx2");
torture_assert_werr_ok(tctx, r.out.result, "netr_DsRGetDCNameEx2");
- return test_netr_DsRGetSiteName(p, tctx, r.out.info->dc_unc,
- r.out.info->dc_site_name);
+ return test_netr_DsRGetSiteName(p, tctx, info->dc_unc,
+ info->dc_site_name);
}
static bool test_netr_DsrGetDcSiteCoverageW(struct torture_context *tctx,
diff --git a/source4/winbind/wb_dom_info_trusted.c b/source4/winbind/wb_dom_info_trusted.c
index c3be5adb1f..5223b166aa 100644
--- a/source4/winbind/wb_dom_info_trusted.c
+++ b/source4/winbind/wb_dom_info_trusted.c
@@ -104,6 +104,8 @@ static void trusted_dom_info_recv_domain(struct composite_context *ctx)
state->d.in.domain_guid = NULL;
state->d.in.site_guid = NULL;
state->d.in.flags = DS_RETURN_DNS_NAME;
+ state->d.out.info = talloc(state, struct netr_DsRGetDCNameInfo *);
+ if (composite_nomem(state->d.out.info, state->ctx)) return;
req = dcerpc_netr_DsRGetDCName_send(state->my_domain->netlogon_pipe,
state, &state->d);
@@ -140,17 +142,17 @@ static void trusted_dom_info_recv_dsr(struct rpc_request *req)
state->info->num_dcs = 1;
state->info->dcs = talloc(state->info, struct nbt_dc_name);
state->info->dcs[0].name = talloc_steal(state->info,
- state->d.out.info->dc_unc);
+ (*state->d.out.info)->dc_unc);
if (*state->info->dcs[0].name == '\\') state->info->dcs[0].name++;
if (*state->info->dcs[0].name == '\\') state->info->dcs[0].name++;
state->info->dcs[0].address = talloc_steal(state->info,
- state->d.out.info->dc_address);
+ (*state->d.out.info)->dc_address);
if (*state->info->dcs[0].address == '\\') state->info->dcs[0].address++;
if (*state->info->dcs[0].address == '\\') state->info->dcs[0].address++;
state->info->dns_name = talloc_steal(state->info,
- state->d.out.info->domain_name);
+ (*state->d.out.info)->domain_name);
composite_done(state->ctx);
return;