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;
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;
}
{
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");
* 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;
}
}