1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s4-netlogon: merge netr_DsRGetDCName{Ex,Ex2} from s3 idl.

Guenther
This commit is contained in:
Günther Deschner 2008-10-28 01:43:06 +01:00
parent f82a117832
commit f0697b0ad5
4 changed files with 45 additions and 37 deletions

View File

@ -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
);
/****************/

View File

@ -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
*/

View File

@ -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,

View File

@ -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;