summaryrefslogtreecommitdiff
path: root/source3/passdb/pdb_ldap.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/passdb/pdb_ldap.c')
-rw-r--r--source3/passdb/pdb_ldap.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 1eac57b826..1e67d86091 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -55,6 +55,7 @@ struct ldap_enum_info {
LDAP *ldap_struct;
LDAPMessage *result;
LDAPMessage *entry;
+ int index;
};
static struct ldap_enum_info global_ldap_ent;
@@ -706,6 +707,7 @@ BOOL pdb_setsampwent(BOOL update)
global_ldap_ent.entry = ldap_first_entry(global_ldap_ent.ldap_struct,
global_ldap_ent.result);
+ global_ldap_ent.index = -1;
return True;
}
@@ -732,8 +734,11 @@ BOOL pdb_getsampwent(SAM_ACCOUNT * user)
if (!global_ldap_ent.entry)
return False;
- global_ldap_ent.entry = ldap_next_entry(global_ldap_ent.ldap_struct,
- global_ldap_ent.entry);
+ global_ldap_ent.index++;
+ if (global_ldap_ent.index > 0)
+ {
+ global_ldap_ent.entry = ldap_next_entry(global_ldap_ent.ldap_struct, global_ldap_ent.entry);
+ }
if (global_ldap_ent.entry != NULL)
{