mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
s4:netlogon: Implement netr_GetDcName() similar to netr_DsGetDCName()
metze
This commit is contained in:
parent
2b8f3e253d
commit
885a1be8b9
@ -803,7 +803,40 @@ static NTSTATUS dcesrv_netr_AccountSync(struct dcesrv_call_state *dce_call, TALL
|
||||
static WERROR dcesrv_netr_GetDcName(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
|
||||
struct netr_GetDcName *r)
|
||||
{
|
||||
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
|
||||
const char * const attrs[] = { NULL };
|
||||
void *sam_ctx;
|
||||
struct ldb_message **res;
|
||||
struct ldb_dn *domain_dn;
|
||||
int ret;
|
||||
const char *dcname;
|
||||
|
||||
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_DS_SERVICE_UNAVAILABLE;
|
||||
}
|
||||
|
||||
domain_dn = samdb_domain_to_dn(sam_ctx, mem_ctx,
|
||||
r->in.domainname);
|
||||
if (domain_dn == NULL) {
|
||||
return WERR_DS_SERVICE_UNAVAILABLE;
|
||||
}
|
||||
|
||||
ret = gendb_search_dn(sam_ctx, mem_ctx, domain_dn, &res, attrs);
|
||||
if (ret != 1) {
|
||||
return WERR_NO_SUCH_DOMAIN;
|
||||
}
|
||||
|
||||
/* TODO: - return real IP address
|
||||
* - check all r->in.* parameters (server_unc is ignored by w2k3!)
|
||||
*/
|
||||
dcname = talloc_asprintf(mem_ctx, "\\\\%s",
|
||||
lp_netbios_name(dce_call->conn->dce_ctx->lp_ctx));
|
||||
W_ERROR_HAVE_NO_MEMORY(dcname);
|
||||
|
||||
*r->out.dcname = dcname;
|
||||
return WERR_OK;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user