From 0fe7c80ec849154198d78c37648f21f931f47835 Mon Sep 17 00:00:00 2001 From: Matthieu Patou Date: Sat, 1 Aug 2009 14:39:09 +0400 Subject: [PATCH] Make GetDomainInfo returns the full dns name of the workstation as required instead of just its domain --- source4/rpc_server/netlogon/dcerpc_netlogon.c | 16 ++++++++++++---- 1 files changed, 12 insertions(+), 4 deletions(-) diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index dc2d078..cb9f46f 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -1122,10 +1122,12 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal const char * const attrs[] = { "objectSid", "objectGUID", "flatName", "securityIdentifier", "trustPartner", NULL }; + const char * const attrs2[] = {"dNSHostName",NULL}; struct ldb_context *sam_ctx; - struct ldb_message **res1, **res2; + struct ldb_message **res1, **res2, **res3; + const char* dnshostname; struct netr_DomainInfo1 *info1; - int ret1, ret2, i; + int ret1, ret2, ret3, i; NTSTATUS status; const char *local_domain; @@ -1164,6 +1166,11 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal return NT_STATUS_INTERNAL_DB_CORRUPTION; } + ret3 = gendb_search(sam_ctx, mem_ctx, NULL, &res3, attrs2, "(&(objectClass=computer)(name=%s))",r->in.computer_name); + if (ret3 == -1) { + return NT_STATUS_INTERNAL_DB_CORRUPTION; + } + info1 = talloc(mem_ctx, struct netr_DomainInfo1); NT_STATUS_HAVE_NO_MEMORY(info1); @@ -1187,8 +1194,9 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal status = fill_domain_trust_info(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, sam_ctx, res1[0], &info1->trusts[i], true, true); NT_STATUS_NOT_OK_RETURN(status); - - info1->dns_hostname.string = lp_realm(dce_call->conn->dce_ctx->lp_ctx); + + dnshostname = ldb_msg_find_attr_as_string(res3[0], "dNSHostName", NULL); + info1->dns_hostname.string = talloc_strdup(mem_ctx,dnshostname); info1->workstation_flags = NETR_WS_FLAG_HANDLES_INBOUND_TRUSTS | NETR_WS_FLAG_HANDLES_SPN_UPDATE; info1->supported_enc_types = 0; /* w2008 gives this 0 */ -- 1.5.6.3