From 42a2f7da9d2a8ff91d2c08615474d602267e20ad Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Mon, 13 Feb 2017 08:41:41 +0545 Subject: Fix ldap_get_groups return value when down In some places ldap_get_groups has: ``` return memberof; ``` It should have the "$" in front, so it will return the $memberof array (that is empty when this happens). This causes issues for callers that expect to have a return value that is either false, an empty array, or an array of the groups. (cherry picked from commit 0241b34f1a33c3ae83fdf817c8c374b10775335a) --- src/etc/inc/auth.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/etc') diff --git a/src/etc/inc/auth.inc b/src/etc/inc/auth.inc index 3688659..4835a00 100644 --- a/src/etc/inc/auth.inc +++ b/src/etc/inc/auth.inc @@ -1156,7 +1156,7 @@ function ldap_get_groups($username, $authcfg) { if ($error == true) { log_error(sprintf(gettext("ERROR! ldap_get_groups() Could not connect to server %s."), $ldapname)); - return memberof; + return $memberof; } ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); @@ -1185,7 +1185,7 @@ function ldap_get_groups($username, $authcfg) { } else if (!($res = @ldap_bind($ldap, $ldapbindun, $ldapbindpw))) { log_error(sprintf(gettext("ERROR! ldap_get_groups() could not bind to server %s."), $ldapname)); @ldap_close($ldap); - return memberof; + return $memberof; } /* get groups from DN found */ -- cgit v1.1