diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-03-04 19:29:18 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:55:53 -0500 |
commit | 9d0a31e9638d118b04f96260b61fdd4370beab97 (patch) | |
tree | 72874aacb3f70c00cc9df649cfa590956203e330 | |
parent | c884a13414ffaa716a258b28ec33dd971def508f (diff) | |
download | samba-9d0a31e9638d118b04f96260b61fdd4370beab97.tar.gz samba-9d0a31e9638d118b04f96260b61fdd4370beab97.tar.bz2 samba-9d0a31e9638d118b04f96260b61fdd4370beab97.zip |
r5654: Fix bug 1604 -- make winbind work with more than 10 trusted domains.
TODO: This needs to be merged to trunk separately, it has changed a little,
but it's friday evening here.
Volker
(This used to be commit 49c3e04632e9fcdf552259412e8ec54d18269516)
-rw-r--r-- | source3/nsswitch/winbindd_rpc.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c index 42f451c505..99d12563c6 100644 --- a/source3/nsswitch/winbindd_rpc.c +++ b/source3/nsswitch/winbindd_rpc.c @@ -970,16 +970,47 @@ static NTSTATUS trusted_domains(struct winbindd_domain *domain, DEBUG(3,("rpc: trusted_domains\n")); *num_domains = 0; + *names = NULL; *alt_names = NULL; + *dom_sids = NULL; retry = 0; do { if (!NT_STATUS_IS_OK(result = cm_get_lsa_handle(find_our_domain(), &hnd))) goto done; - result = cli_lsa_enum_trust_dom(hnd->cli, mem_ctx, - &hnd->pol, &enum_ctx, - num_domains, names, dom_sids); + result = STATUS_MORE_ENTRIES; + + while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)) { + uint32 start_idx, num; + char **tmp_names; + DOM_SID *tmp_sids; + int i; + + result = cli_lsa_enum_trust_dom(hnd->cli, mem_ctx, + &hnd->pol, &enum_ctx, + &num, &tmp_names, + &tmp_sids); + + if (!NT_STATUS_IS_OK(result) && + !NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)) + break; + + start_idx = *num_domains; + *num_domains += num; + *names = TALLOC_REALLOC_ARRAY(mem_ctx, *names, + char *, *num_domains); + *dom_sids = TALLOC_REALLOC_ARRAY(mem_ctx, *dom_sids, + DOM_SID, + *num_domains); + if ((*names == NULL) || (*dom_sids == NULL)) + return NT_STATUS_NO_MEMORY; + + for (i=0; i<num; i++) { + (*names)[start_idx+i] = tmp_names[i]; + (*dom_sids)[start_idx+i] = tmp_sids[i]; + } + } } while (!NT_STATUS_IS_OK(result) && (retry++ < 1) && hnd && hnd->cli && hnd->cli->fd == -1); done: |