added ldap_free_result

This commit is contained in:
Roland Gruber 2007-02-17 13:02:45 +00:00
parent 6c55c94eb1
commit 5fd4f7b73c
1 changed files with 24 additions and 19 deletions

View File

@ -4,6 +4,7 @@ $Id$
This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam) This code is part of LDAP Account Manager (http://www.sourceforge.net/projects/lam)
Copyright (C) 2003 - 2006 Tilo Lutz Copyright (C) 2003 - 2006 Tilo Lutz
Copyright (C) 2007 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -25,6 +26,7 @@ $Id$
* Provides a cache for LDAP attributes. * Provides a cache for LDAP attributes.
* *
* @author Tilo Lutz * @author Tilo Lutz
* @author Roland Gruber
* @package lib * @package lib
*/ */
@ -182,6 +184,7 @@ class cache {
$search = $this->attributes[$scope]; $search = $this->attributes[$scope];
$search[] = 'objectClass'; $search[] = 'objectClass';
$result = @ldap_search($_SESSION['ldap']->server(), $suffix, 'objectClass=*', $search, 0); $result = @ldap_search($_SESSION['ldap']->server(), $suffix, 'objectClass=*', $search, 0);
if ($result) {
// Write search result in array // Write search result in array
$entry = @ldap_first_entry($_SESSION['ldap']->server(), $result); $entry = @ldap_first_entry($_SESSION['ldap']->server(), $result);
while ($entry) { while ($entry) {
@ -203,6 +206,8 @@ class cache {
if (count($addcache)!=0) $this->ldapcache[$scope][$dn] = $attr; if (count($addcache)!=0) $this->ldapcache[$scope][$dn] = $attr;
$entry = ldap_next_entry($_SESSION['ldap']->server(), $entry); $entry = ldap_next_entry($_SESSION['ldap']->server(), $entry);
} }
ldap_free_result($result);
}
} }
$this->time = time(); $this->time = time();
} }