summaryrefslogtreecommitdiff
path: root/source3/libsmb/trusts_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/libsmb/trusts_util.c')
-rw-r--r--source3/libsmb/trusts_util.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/source3/libsmb/trusts_util.c b/source3/libsmb/trusts_util.c
index 1ca7d56a83..11f691bee6 100644
--- a/source3/libsmb/trusts_util.c
+++ b/source3/libsmb/trusts_util.c
@@ -152,6 +152,8 @@ bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
struct cli_state *cli = NULL;
struct rpc_pipe_client *lsa_pipe;
bool retry;
+ struct lsa_DomainList dom_list;
+ int i;
*domain_names = NULL;
*num_domains = 0;
@@ -188,11 +190,33 @@ bool enumerate_domain_trusts( TALLOC_CTX *mem_ctx, const char *domain,
/* Lookup list of trusted domains */
- result = rpccli_lsa_enum_trust_dom(lsa_pipe, mem_ctx, &pol, &enum_ctx,
- num_domains, domain_names, sids);
+ result = rpccli_lsa_EnumTrustDom(lsa_pipe, mem_ctx,
+ &pol,
+ &enum_ctx,
+ &dom_list,
+ (uint32_t)-1);
if ( !NT_STATUS_IS_OK(result) )
goto done;
+ *num_domains = dom_list.count;
+
+ *domain_names = TALLOC_ZERO_ARRAY(mem_ctx, char *, *num_domains);
+ if (!*domain_names) {
+ result = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
+
+ *sids = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID, *num_domains);
+ if (!*sids) {
+ result = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
+
+ for (i=0; i< *num_domains; i++) {
+ (*domain_names)[i] = CONST_DISCARD(char *, dom_list.domains[i].name.string);
+ (*sids)[i] = *dom_list.domains[i].sid;
+ }
+
done:
/* cleanup */
if (cli) {