summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2010-11-04 20:35:54 +0000
committerArthur de Jong <arthur@arthurdejong.org>2010-11-04 20:35:54 +0000
commit04e2a2ccbe2c7201928ac5f89d7dc493d25ad691 (patch)
tree49b7934071f796b2538e89c3807a47f8e8f89714
parent98a146cb2e92ee0a46ba56037303481e10182d6e (diff)
fix race condition that could cause a memory leak
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1296 ef36b2f9-881f-0410-afb5-c4e39611909c
-rw-r--r--nslcd/passwd.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/nslcd/passwd.c b/nslcd/passwd.c
index da26d88..8ef2a5c 100644
--- a/nslcd/passwd.c
+++ b/nslcd/passwd.c
@@ -219,6 +219,9 @@ char *dn2uid(MYLDAP_SESSION *session,const char *dn,char *buf,size_t buflen)
uid=lookup_dn2uid(session,dn,NULL);
/* store the result in the cache */
pthread_mutex_lock(&dn2uid_cache_mutex);
+ /* try to get the entry from the cache here again because it could have
+ changed in the meantime */
+ cacheentry=dict_get(dn2uid_cache,dn);
if (cacheentry==NULL)
{
/* allocate a new entry in the cache */