diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2018-05-10 09:32:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-10 09:32:07 +0200 |
commit | 58e4ddd63807227d7477fed70f0297a124f64cdf (patch) | |
tree | 474b03d8f7ee64859f26acfb5e74ac9dd9ae1228 /apps | |
parent | 48034bdc4a21aced21373f4871a28498b7ff0bff (diff) | |
parent | ced15ab7567fd3dc72734993609d663e399748b6 (diff) | |
download | nextcloud-server-58e4ddd63807227d7477fed70f0297a124f64cdf.tar.gz nextcloud-server-58e4ddd63807227d7477fed70f0297a124f64cdf.zip |
Merge pull request #9360 from GitHubUser4234/ldap_password_renew_invarg_fix
Fix "Invalid argument supplied for foreach()"
Diffstat (limited to 'apps')
-rw-r--r-- | apps/user_ldap/lib/User/User.php | 4 | ||||
-rw-r--r-- | apps/user_ldap/tests/User/UserTest.php | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/apps/user_ldap/lib/User/User.php b/apps/user_ldap/lib/User/User.php index eb4101ddc25..27578921450 100644 --- a/apps/user_ldap/lib/User/User.php +++ b/apps/user_ldap/lib/User/User.php @@ -617,7 +617,7 @@ class User { $uid = $params['uid']; if(isset($uid) && $uid === $this->getUsername()) { //retrieve relevant user attributes - $result = $this->access->search('objectclass=*', $this->dn, ['pwdpolicysubentry', 'pwdgraceusetime', 'pwdreset', 'pwdchangedtime']); + $result = $this->access->search('objectclass=*', array($this->dn), ['pwdpolicysubentry', 'pwdgraceusetime', 'pwdreset', 'pwdchangedtime']); if(array_key_exists('pwdpolicysubentry', $result[0])) { $pwdPolicySubentry = $result[0]['pwdpolicysubentry']; @@ -634,7 +634,7 @@ class User { $cacheKey = 'ppolicyAttributes' . $ppolicyDN; $result = $this->connection->getFromCache($cacheKey); if(is_null($result)) { - $result = $this->access->search('objectclass=*', $ppolicyDN, ['pwdgraceauthnlimit', 'pwdmaxage', 'pwdexpirewarning']); + $result = $this->access->search('objectclass=*', array($ppolicyDN), ['pwdgraceauthnlimit', 'pwdmaxage', 'pwdexpirewarning']); $this->connection->writeToCache($cacheKey, $result); } diff --git a/apps/user_ldap/tests/User/UserTest.php b/apps/user_ldap/tests/User/UserTest.php index 27bd7762e39..c61a9bd3d47 100644 --- a/apps/user_ldap/tests/User/UserTest.php +++ b/apps/user_ldap/tests/User/UserTest.php @@ -1132,7 +1132,7 @@ class UserTest extends \Test\TestCase { $this->access->expects($this->any()) ->method('search') ->will($this->returnCallback(function($filter, $base) { - if($base === 'uid=alice') { + if($base === array('uid=alice')) { return array( array( 'pwdchangedtime' => array((new \DateTime())->sub(new \DateInterval('P28D'))->format('Ymdhis').'Z'), @@ -1140,7 +1140,7 @@ class UserTest extends \Test\TestCase { ), ); } - if($base === 'cn=default,ou=policies,dc=foo,dc=bar') { + if($base === array('cn=default,ou=policies,dc=foo,dc=bar')) { return array( array( 'pwdmaxage' => array('2592000'), @@ -1202,7 +1202,7 @@ class UserTest extends \Test\TestCase { $this->access->expects($this->any()) ->method('search') ->will($this->returnCallback(function($filter, $base) { - if($base === 'uid=alice') { + if($base === array('uid=alice')) { return array( array( 'pwdpolicysubentry' => array('cn=custom,ou=policies,dc=foo,dc=bar'), @@ -1211,7 +1211,7 @@ class UserTest extends \Test\TestCase { ) ); } - if($base === 'cn=custom,ou=policies,dc=foo,dc=bar') { + if($base === array('cn=custom,ou=policies,dc=foo,dc=bar')) { return array( array( 'pwdmaxage' => array('2592000'), |