summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-rw-r--r--source4/librpc/idl/netlogon.idl3
-rw-r--r--source4/rpc_server/netlogon/dcerpc_netlogon.c28
-rw-r--r--source4/torture/rpc/netlogon.c10
3 files changed, 23 insertions, 18 deletions
diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl
index 400565ba22..2ddf78de31 100644
--- a/source4/librpc/idl/netlogon.idl
+++ b/source4/librpc/idl/netlogon.idl
@@ -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
);
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index 9d4c897892..d9717fdc57 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -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;
}
diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c
index d35e62eb74..7f0f60cd32 100644
--- a/source4/torture/rpc/netlogon.c
+++ b/source4/torture/rpc/netlogon.c
@@ -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;
}
}