From 72c2da9d327288552084efad831ef8c3518de835 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Feb 2009 17:28:05 +1100 Subject: fixed two problems with the DsRGetDCNameEx2 call, as used by Win7-beta. The first problem is that we removed the dnsDomain attribute a while back, so we were returning NULL for two fields. We now return the realm. The second problem is that Win7-beta sends the domain in the form the user typed it, so it may be in either the short or long form. We check for the short form and convert if needed. --- source4/rpc_server/netlogon/dcerpc_netlogon.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'source4/rpc_server') diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c index a9150d1a9a..d5484d0da0 100644 --- a/source4/rpc_server/netlogon/dcerpc_netlogon.c +++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c @@ -1166,7 +1166,7 @@ static WERROR dcesrv_netr_DsRAddressToSitenamesW(struct dcesrv_call_state *dce_c static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, struct netr_DsRGetDCNameEx2 *r) { - const char * const attrs[] = { "dnsDomain", "objectGUID", NULL }; + const char * const attrs[] = { "objectGUID", NULL }; void *sam_ctx; struct ldb_message **res; struct ldb_dn *domain_dn; @@ -1180,6 +1180,12 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA return WERR_DS_SERVICE_UNAVAILABLE; } + /* Win7-beta will send the domain name in the form the user typed, so we have to cope + with both the short and long form here */ + if (strcasecmp(r->in.domain_name, lp_workgroup(dce_call->conn->dce_ctx->lp_ctx)) == 0) { + r->in.domain_name = lp_realm(dce_call->conn->dce_ctx->lp_ctx); + } + domain_dn = samdb_dns_domain_to_dn(sam_ctx, mem_ctx, r->in.domain_name); if (domain_dn == NULL) { @@ -1205,8 +1211,8 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA 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->domain_name = lp_realm(dce_call->conn->dce_ctx->lp_ctx); + info->forest_name = lp_realm(dce_call->conn->dce_ctx->lp_ctx); info->dc_flags = DS_DNS_FOREST | DS_DNS_DOMAIN | DS_DNS_CONTROLLER | -- cgit