mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 09:42:09 -04:00
Merge pull request #8075 from nextcloud/stable11-8069
[stable11] do not catch and ignore ServerNotAvailable in the wrong spot
This commit is contained in:
commit
fd3efbb7d1
2 changed files with 7 additions and 2 deletions
|
|
@ -155,12 +155,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()) {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
namespace OCA\User_LDAP;
|
||||
|
||||
use OC\ServerNotAvailableException;
|
||||
use OC\User\Backend;
|
||||
use OC\User\NoUserException;
|
||||
use OCA\User_LDAP\Exceptions\NotOnLDAP;
|
||||
|
|
@ -268,16 +269,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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue