summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-04-15 13:41:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:38 -0500
commitd3d6126d94d55a69c45b2f7a63a7fa9b561baf48 (patch)
treece4e45d5571fb0e1a090b59ffa74a56b8a883334 /source3/nsswitch
parent496c6f088492e3f74bba11da21ffc8855b2eb7f9 (diff)
downloadsamba-d3d6126d94d55a69c45b2f7a63a7fa9b561baf48.tar.gz
samba-d3d6126d94d55a69c45b2f7a63a7fa9b561baf48.tar.bz2
samba-d3d6126d94d55a69c45b2f7a63a7fa9b561baf48.zip
r6351: This is quite a large and intrusive patch, but there are not many pieces that
can be taken out of it, so I decided to commit this in one lump. It changes the passdb enumerating functions to use ldap paged results where possible. In particular the samr calls querydispinfo, enumdomusers and friends have undergone significant internal changes. I have tested this extensively with rpcclient and a bit with usrmgr.exe. More tests and the merge to trunk will follow later. The code is based on a first implementation by Günther Deschner, but has evolved quite a bit since then. Volker (This used to be commit f0bb44ac58e190e19eb4e92928979b0446e611c9)
Diffstat (limited to 'source3/nsswitch')
-rw-r--r--source3/nsswitch/winbindd_passdb.c34
1 files changed, 22 insertions, 12 deletions
diff --git a/source3/nsswitch/winbindd_passdb.c b/source3/nsswitch/winbindd_passdb.c
index bd15777bd3..23a56e4ea6 100644
--- a/source3/nsswitch/winbindd_passdb.c
+++ b/source3/nsswitch/winbindd_passdb.c
@@ -207,23 +207,33 @@ static NTSTATUS enum_local_groups(struct winbindd_domain *domain,
uint32 *num_entries,
struct acct_info **info)
{
- struct acct_info *talloced_info;
+ struct pdb_search *search;
+ struct samr_displayentry *aliases;
+ int i;
+ NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
- /* Hmm. One billion aliases should be enough for a start */
+ search = pdb_search_aliases(&domain->sid);
+ if (search == NULL) goto done;
- if (!pdb_enum_aliases(&domain->sid, 0, 1000000000,
- num_entries, info)) {
- /* Nothing to report, just exit. */
- return NT_STATUS_OK;
- }
+ *num_entries = pdb_search_entries(search, 0, 0xffffffff, &aliases);
+ if (*num_entries == 0) goto done;
- talloced_info = (struct acct_info *)TALLOC_MEMDUP(mem_ctx, *info,
- *num_entries * sizeof(struct acct_info));
+ *info = TALLOC_ARRAY(mem_ctx, struct acct_info, *num_entries);
+ if (*info == NULL) {
+ result = NT_STATUS_NO_MEMORY;
+ goto done;
+ }
- SAFE_FREE(*info);
- *info = talloced_info;
+ for (i=0; i<*num_entries; i++) {
+ fstrcpy((*info)[i].acct_name, aliases[i].account_name);
+ fstrcpy((*info)[i].acct_desc, aliases[i].description);
+ (*info)[i].rid = aliases[i].rid;
+ }
- return NT_STATUS_OK;
+ result = NT_STATUS_OK;
+ done:
+ pdb_search_destroy(search);
+ return result;
}
/* convert a single name to a sid in a domain */