[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
);
/*****************/
[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(
[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
);
/****************/
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) {
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 |
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;
}
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;
}
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
*/
{
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);
}
/*
{
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);
}
/*
{
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;
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");
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,
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);
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;