r8226: w2k3 adds a '.' after the forest and domain dns names for the primary domain
authorStefan Metzmacher <metze@samba.org>
Fri, 8 Jul 2005 05:19:28 +0000 (05:19 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:19:22 +0000 (13:19 -0500)
and NULL for the trusted domains forest dns name

metze
(This used to be commit 225fc1b8658f01217b55e2d1c6d5814ee5022559)

source4/rpc_server/netlogon/dcerpc_netlogon.c

index 1317ea31a95db04ef81ecb371e04159c6e3e7f94..ca7b938ea67ebb05474f8422bcfda2ee3c8529e8 100644 (file)
@@ -853,6 +853,24 @@ static WERROR netr_DSRGETSITENAME(struct dcesrv_call_state *dce_call, TALLOC_CTX
 }
 
 
+/*
+  fill in a netr_DomainTrustInfo from a ldb search result
+*/
+static NTSTATUS fill_domain_primary_info(TALLOC_CTX *mem_ctx, struct ldb_message *res,
+                                        struct netr_DomainTrustInfo *info)
+{
+       ZERO_STRUCTP(info);
+
+       info->domainname.string = samdb_result_string(res, "name", NULL);
+       info->fulldomainname.string = talloc_asprintf(info, "%s.", samdb_result_string(res, "dnsDomain", NULL));
+       /* TODO: we need proper forest support */
+       info->forest.string = info->fulldomainname.string;
+       info->guid = samdb_result_guid(res, "objectGUID");
+       info->sid = samdb_result_dom_sid(mem_ctx, res, "objectSid");
+
+       return NT_STATUS_OK;
+}
+
 /*
   fill in a netr_DomainTrustInfo from a ldb search result
 */
@@ -864,18 +882,17 @@ static NTSTATUS fill_domain_trust_info(TALLOC_CTX *mem_ctx, struct ldb_message *
        if (is_local) {
                info->domainname.string = samdb_result_string(res, "name", NULL);
                info->fulldomainname.string = samdb_result_string(res, "dnsDomain", NULL);
+               info->forest.string = NULL;
                info->guid = samdb_result_guid(res, "objectGUID");
                info->sid = samdb_result_dom_sid(mem_ctx, res, "objectSid");
        } else {
                info->domainname.string = samdb_result_string(res, "flatName", NULL);
                info->fulldomainname.string = samdb_result_string(res, "name", NULL);
+               info->forest.string = NULL;
                info->guid = samdb_result_guid(res, "objectGUID");
                info->sid = samdb_result_dom_sid(mem_ctx, res, "securityIdentifier");
        }
 
-       /* TODO: we need proper forest support */
-       info->forest.string = info->fulldomainname.string;
-
        return NT_STATUS_OK;
 }
 
@@ -936,23 +953,23 @@ static NTSTATUS netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_call, TALL
                return NT_STATUS_NO_MEMORY;
        }
 
-       status = fill_domain_trust_info(mem_ctx, res1[0], &info1->domaininfo, True);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
-       status = fill_domain_trust_info(mem_ctx, res1[0], &info1->trusts[0], True);
+       status = fill_domain_primary_info(mem_ctx, res1[0], &info1->domaininfo);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
 
        for (i=0;i<ret2;i++) {
-               status = fill_domain_trust_info(mem_ctx, res2[i], &info1->trusts[i+1], False);
+               status = fill_domain_trust_info(mem_ctx, res2[i], &info1->trusts[i], False);
                if (!NT_STATUS_IS_OK(status)) {
                        return status;
                }
        }
 
+       status = fill_domain_trust_info(mem_ctx, res1[0], &info1->trusts[i], True);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
        r->out.info.info1 = info1;
 
        return NT_STATUS_OK;