s4-netlogon: merge netr_DsrEnumerateDomainTrusts from s3 idl.
authorGünther Deschner <gd@samba.org>
Mon, 27 Oct 2008 15:07:33 +0000 (16:07 +0100)
committerGünther Deschner <gd@samba.org>
Tue, 28 Oct 2008 22:40:52 +0000 (23:40 +0100)
Guenther

source4/librpc/idl/netlogon.idl
source4/rpc_server/netlogon/dcerpc_netlogon.c
source4/torture/rpc/netlogon.c

index 400565ba22abccb7962be8681a2a4b9a2289683c..2ddf78de316babdb7ab15f73be15e6cd47056b1e 100644 (file)
@@ -1396,8 +1396,7 @@ interface netlogon
        WERROR netr_DsrEnumerateDomainTrusts(
                [in,unique]          [string,charset(UTF16)] uint16           *server_name,
                [in]                 netr_TrustFlags  trust_flags,
-               [out]                uint32           count,
-               [out,unique,size_is(count)] netr_DomainTrust *trusts
+               [out,ref]            netr_DomainTrustList *trusts
                );
 
 
index 9d4c897892fc97da4d821670ce395212b0ce4e0b..d9717fdc57f33248ee6f25dabfd8d789306a2994 100644 (file)
@@ -1280,7 +1280,7 @@ static WERROR dcesrv_netr_DsrGetDcSiteCoverageW(struct dcesrv_call_state *dce_ca
 static WERROR dcesrv_netr_DsrEnumerateDomainTrusts(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
                                              struct netr_DsrEnumerateDomainTrusts *r)
 {
-       struct netr_DomainTrust *trusts;
+       struct netr_DomainTrustList *trusts;
        void *sam_ctx;
        int ret;
        struct ldb_message **dom_res, **ref_res;
@@ -1315,25 +1315,29 @@ static WERROR dcesrv_netr_DsrEnumerateDomainTrusts(struct dcesrv_call_state *dce
                return WERR_GENERAL_FAILURE;
        }
 
-       trusts = talloc_array(mem_ctx, struct netr_DomainTrust, ret);
+       trusts = talloc(mem_ctx, struct netr_DomainTrustList);
        W_ERROR_HAVE_NO_MEMORY(trusts);
-       
-       r->out.count = 1;
+
+       trusts->array = talloc_array(trusts, struct netr_DomainTrust, ret);
+       W_ERROR_HAVE_NO_MEMORY(trusts->array);
+
+       trusts->count = 1; /* ?? */
+
        r->out.trusts = trusts;
 
        /* TODO: add filtering by trust_flags, and correct trust_type
           and attributes */
-       trusts[0].netbios_name = samdb_result_string(ref_res[0], "nETBIOSName", NULL);
-       trusts[0].dns_name     = samdb_result_string(ref_res[0], "dnsRoot", NULL);
-       trusts[0].trust_flags = 
+       trusts->array[0].netbios_name = samdb_result_string(ref_res[0], "nETBIOSName", NULL);
+       trusts->array[0].dns_name     = samdb_result_string(ref_res[0], "dnsRoot", NULL);
+       trusts->array[0].trust_flags =
                NETR_TRUST_FLAG_TREEROOT | 
                NETR_TRUST_FLAG_IN_FOREST | 
                NETR_TRUST_FLAG_PRIMARY;
-       trusts[0].parent_index = 0;
-       trusts[0].trust_type = 2;
-       trusts[0].trust_attributes = 0;
-       trusts[0].sid  = samdb_result_dom_sid(mem_ctx, dom_res[0], "objectSid");
-       trusts[0].guid = samdb_result_guid(dom_res[0], "objectGUID");
+       trusts->array[0].parent_index = 0;
+       trusts->array[0].trust_type = 2;
+       trusts->array[0].trust_attributes = 0;
+       trusts->array[0].sid  = samdb_result_dom_sid(mem_ctx, dom_res[0], "objectSid");
+       trusts->array[0].guid = samdb_result_guid(dom_res[0], "objectGUID");
 
        return WERR_OK;
 }
index d35e62eb745dd16ef7e491f3a7fbfcd817bd4b4c..7f0f60cd329b583a26f380c1c887c3940ccfd36f 100644 (file)
@@ -1153,10 +1153,12 @@ static bool test_DsrEnumerateDomainTrusts(struct torture_context *tctx,
 {
        NTSTATUS status;
        struct netr_DsrEnumerateDomainTrusts r;
+       struct netr_DomainTrustList trusts;
        int i;
 
        r.in.server_name = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p));
        r.in.trust_flags = 0x3f;
+       r.out.trusts = &trusts;
 
        status = dcerpc_netr_DsrEnumerateDomainTrusts(p, tctx, &r);
        torture_assert_ntstatus_ok(tctx, status, "DsrEnumerateDomaintrusts");
@@ -1166,19 +1168,19 @@ static bool test_DsrEnumerateDomainTrusts(struct torture_context *tctx,
         * will show non-forest trusts and all UPN suffixes of the own forest
         * as LSA_FOREST_TRUST_TOP_LEVEL_NAME types */
 
-       if (r.out.count) {
+       if (r.out.trusts->count) {
                if (!test_netr_DsRGetForestTrustInformation(tctx, p, NULL)) {
                        return false;
                }
        }
 
-       for (i=0; i<r.out.count; i++) {
+       for (i=0; i<r.out.trusts->count; i++) {
 
                /* get info for transitive forest trusts */
 
-               if (r.out.trusts[i].trust_attributes & NETR_TRUST_ATTRIBUTE_FOREST_TRANSITIVE) {
+               if (r.out.trusts->array[i].trust_attributes & NETR_TRUST_ATTRIBUTE_FOREST_TRANSITIVE) {
                        if (!test_netr_DsRGetForestTrustInformation(tctx, p, 
-                                                                   r.out.trusts[i].dns_name)) {
+                                                                   r.out.trusts->array[i].dns_name)) {
                                return false;
                        }
                }