fixed two problems with the DsRGetDCNameEx2 call, as used by
authorAndrew Tridgell <tridge@samba.org>
Tue, 10 Feb 2009 06:28:05 +0000 (17:28 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 10 Feb 2009 06:28:05 +0000 (17:28 +1100)
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

index a9150d1a9ad022923cbf9d400f36592c05e5f95a..d5484d0da02f5e7be17a90bc0fbf302a0f280415 100644 (file)
@@ -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 |