2 commits - lib/Auth
Aleksander Machniak
machniak at kolabsys.com
Thu Sep 12 12:34:43 CEST 2013
lib/Auth/LDAP.php | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
New commits:
commit c0fd4b1fcfecd6583b5d31dca7d46df8bd3882f3
Author: Aleksander Machniak <alec at alec.pl>
Date: Thu Sep 12 12:34:23 2013 +0200
Remove redundant list_replicas() calls
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index 0c0ff91..2773495 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -210,6 +210,7 @@ class LDAP extends Net_LDAP3 {
);
$replica_hosts = $this->list_replicas();
+
if (!empty($replica_hosts)) {
foreach ($replica_hosts as $replica_host) {
Log::trace("Iterating over replication partners (now: $replica_host)");
@@ -270,7 +271,6 @@ class LDAP extends Net_LDAP3 {
'nsslapd-dncachememsize' => '10485760'
);
- $replica_hosts = $this->list_replicas();
if (!empty($replica_hosts)) {
foreach ($replica_hosts as $replica_host) {
$ldap = new Net_LDAP3($this->config);
@@ -376,7 +376,6 @@ class LDAP extends Net_LDAP3 {
),
);
- $replica_hosts = $this->list_replicas();
if (!empty($replica_hosts)) {
foreach ($replica_hosts as $replica_host) {
$ldap = new Net_LDAP3($this->config);
commit 878894d3cd2f3f2002d2a973704ba3c4c9925385
Author: Aleksander Machniak <alec at alec.pl>
Date: Thu Sep 12 10:22:47 2013 +0200
Cache effective rights in internal cache if memcache is not enabled
diff --git a/lib/Auth/LDAP.php b/lib/Auth/LDAP.php
index bb0ca93..0c0ff91 100644
--- a/lib/Auth/LDAP.php
+++ b/lib/Auth/LDAP.php
@@ -542,9 +542,14 @@ class LDAP extends Net_LDAP3 {
$ckey = $_SESSION['user']->user_bind_dn . '#'
. md5($this->domain . '::' . $subject . '::' . $_SESSION['user']->user_bind_pw);
+ // use memcache
if ($cache && ($result = $cache->get($ckey))) {
return $result;
}
+ // use internal cache
+ else if (isset($this->icache[$ckey])) {
+ return $this->icache[$ckey];
+ }
// Ensure we are bound with the user's credentials
$this->bind($_SESSION['user']->user_bind_dn, $_SESSION['user']->user_bind_pw);
@@ -575,6 +580,9 @@ class LDAP extends Net_LDAP3 {
$cache->set($ckey, $result, MEMCACHE_COMPRESSED, 3600);
}
}
+ else {
+ $this->icache[$ckey] = $result;
+ }
return $result;
}
More information about the commits
mailing list