summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-07-06 06:18:54 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-07-06 06:18:54 +0000
commitcd2c5e1f63ba4c9baad333071e9e21897a415c2a (patch)
treeca95e6e75ef4ed7d65be2dad1ded1eff714f60f4
parentb475d0b88924a0af4a8519a2e7bc183945de0f9c (diff)
downloadsamba-cd2c5e1f63ba4c9baad333071e9e21897a415c2a.tar.gz
samba-cd2c5e1f63ba4c9baad333071e9e21897a415c2a.tar.bz2
samba-cd2c5e1f63ba4c9baad333071e9e21897a415c2a.zip
Fix ldapsam_getsampwsid to correctly only say 'no such user' when indeed there
is no such user... Thanks to jerry for spotting this. Also clean up the function a bit, to avoid this happening again... Andrew Bartlett (This used to be commit d9a6859e2bd963f28cf3c3a62e483e868822597f)
-rw-r--r--source3/passdb/pdb_ldap.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/source3/passdb/pdb_ldap.c b/source3/passdb/pdb_ldap.c
index 0d16a1a985..698365f42c 100644
--- a/source3/passdb/pdb_ldap.c
+++ b/source3/passdb/pdb_ldap.c
@@ -1562,7 +1562,6 @@ Get SAM_ACCOUNT entry from LDAP by SID
*********************************************************************/
static NTSTATUS ldapsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT * user, const DOM_SID *sid)
{
- NTSTATUS ret = NT_STATUS_UNSUCCESSFUL;
struct ldapsam_privates *ldap_state = (struct ldapsam_privates *)my_methods->private_data;
LDAPMessage *result;
LDAPMessage *entry;
@@ -1595,21 +1594,22 @@ static NTSTATUS ldapsam_getsampwsid(struct pdb_methods *my_methods, SAM_ACCOUNT
}
entry = ldap_first_entry(ldap_state->smbldap_state->ldap_struct, result);
- if (entry)
+ if (!entry)
{
- if (!init_sam_from_ldap(ldap_state, user, entry)) {
- DEBUG(1,("ldapsam_getsampwrid: init_sam_from_ldap failed!\n"));
- ldap_msgfree(result);
- return NT_STATUS_NO_SUCH_USER;
- }
- pdb_set_backend_private_data(user, result,
- private_data_free_fn,
- my_methods, PDB_CHANGED);
- ret = NT_STATUS_OK;
- } else {
ldap_msgfree(result);
+ return NT_STATUS_NO_SUCH_USER;
+ }
+
+ if (!init_sam_from_ldap(ldap_state, user, entry)) {
+ DEBUG(1,("ldapsam_getsampwrid: init_sam_from_ldap failed!\n"));
+ ldap_msgfree(result);
+ return NT_STATUS_NO_SUCH_USER;
}
- return NT_STATUS_NO_SUCH_USER;
+
+ pdb_set_backend_private_data(user, result,
+ private_data_free_fn,
+ my_methods, PDB_CHANGED);
+ return NT_STATUS_OK;
}
/********************************************************************