diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-01-31 14:46:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-31 14:46:55 +0100 |
commit | bb7a2b23296848bf6070f75d5727c23b1530b174 (patch) | |
tree | b696ea941850fc75e8cd8b5a76a27ece4f1b19d3 /apps/user_ldap | |
parent | 10110e85eb50b7339e09e0f8de5651d523392931 (diff) | |
parent | d61dd36fdd72b06b402b047b5ac1feac6fe83475 (diff) | |
download | nextcloud-server-bb7a2b23296848bf6070f75d5727c23b1530b174.tar.gz nextcloud-server-bb7a2b23296848bf6070f75d5727c23b1530b174.zip |
Merge pull request #8073 from nextcloud/stable13-8069
[stable13] do not catch and ignore ServerNotAvailable in the wrong spot
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/lib/Access.php | 3 | ||||
-rw-r--r-- | apps/user_ldap/lib/User_LDAP.php | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/apps/user_ldap/lib/Access.php b/apps/user_ldap/lib/Access.php index b84f5a38b31..c255af028a9 100644 --- a/apps/user_ldap/lib/Access.php +++ b/apps/user_ldap/lib/Access.php @@ -168,12 +168,14 @@ class Access extends LDAPUtility implements IUserTools { /** * reads a given attribute for an LDAP record identified by a DN + * * @param string $dn the record in question * @param string $attr the attribute that shall be retrieved * if empty, just check the record's existence * @param string $filter * @return array|false an array of values on success or an empty * array if $attr is empty, false otherwise + * @throws ServerNotAvailableException */ public function readAttribute($dn, $attr, $filter = 'objectClass=*') { if(!$this->checkConnection()) { @@ -255,6 +257,7 @@ class Access extends LDAPUtility implements IUserTools { * @return array|bool false if there was any error, true if an exists check * was performed and the requested DN found, array with the * returned data on a successful usual operation + * @throws ServerNotAvailableException */ public function executeRead($cr, $dn, $attribute, $filter, $maxResults) { $this->initPagedSearch($filter, array($dn), array($attribute), $maxResults, 0); diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php index 506ea36c529..cc3bf85716f 100644 --- a/apps/user_ldap/lib/User_LDAP.php +++ b/apps/user_ldap/lib/User_LDAP.php @@ -38,6 +38,7 @@ namespace OCA\User_LDAP; +use OC\ServerNotAvailableException; use OC\User\Backend; use OC\User\NoUserException; use OCA\User_LDAP\Exceptions\NotOnLDAP; @@ -317,16 +318,18 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn try { $uuid = $this->access->getUserMapper()->getUUIDByDN($dn); - if(!$uuid) { + if (!$uuid) { return false; } $newDn = $this->access->getUserDnByUuid($uuid); //check if renamed user is still valid by reapplying the ldap filter - if(!is_array($this->access->readAttribute($newDn, '', $this->access->connection->ldapUserFilter))) { + if (!is_array($this->access->readAttribute($newDn, '', $this->access->connection->ldapUserFilter))) { return false; } $this->access->getUserMapper()->setDNbyUUID($newDn, $uuid); return true; + } catch (ServerNotAvailableException $e) { + throw $e; } catch (\Exception $e) { return false; } |