s4-netlogon: merge netr_DsrEnumerateDomainTrusts from s3 idl.
[ira/wip.git] / source4 / rpc_server / netlogon / dcerpc_netlogon.c
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;
 }