Merge pull request #8069 from nextcloud/no-catch-serverdown

do not catch and ignore ServerNotAvailable in the wrong spot
This commit is contained in:
Morris Jobke 2018-01-26 14:01:07 +01:00 committed by GitHub
commit ca493ab5b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 2 deletions

View File

@ -168,12 +168,14 @@ class Access extends LDAPUtility implements IUserTools {
/** /**
* reads a given attribute for an LDAP record identified by a DN * reads a given attribute for an LDAP record identified by a DN
*
* @param string $dn the record in question * @param string $dn the record in question
* @param string $attr the attribute that shall be retrieved * @param string $attr the attribute that shall be retrieved
* if empty, just check the record's existence * if empty, just check the record's existence
* @param string $filter * @param string $filter
* @return array|false an array of values on success or an empty * @return array|false an array of values on success or an empty
* array if $attr is empty, false otherwise * array if $attr is empty, false otherwise
* @throws ServerNotAvailableException
*/ */
public function readAttribute($dn, $attr, $filter = 'objectClass=*') { public function readAttribute($dn, $attr, $filter = 'objectClass=*') {
if(!$this->checkConnection()) { 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 * @return array|bool false if there was any error, true if an exists check
* was performed and the requested DN found, array with the * was performed and the requested DN found, array with the
* returned data on a successful usual operation * returned data on a successful usual operation
* @throws ServerNotAvailableException
*/ */
public function executeRead($cr, $dn, $attribute, $filter, $maxResults) { public function executeRead($cr, $dn, $attribute, $filter, $maxResults) {
$this->initPagedSearch($filter, array($dn), array($attribute), $maxResults, 0); $this->initPagedSearch($filter, array($dn), array($attribute), $maxResults, 0);

View File

@ -38,6 +38,7 @@
namespace OCA\User_LDAP; namespace OCA\User_LDAP;
use OC\ServerNotAvailableException;
use OC\User\Backend; use OC\User\Backend;
use OC\User\NoUserException; use OC\User\NoUserException;
use OCA\User_LDAP\Exceptions\NotOnLDAP; use OCA\User_LDAP\Exceptions\NotOnLDAP;
@ -327,6 +328,8 @@ class User_LDAP extends BackendUtility implements \OCP\IUserBackend, \OCP\UserIn
} }
$this->access->getUserMapper()->setDNbyUUID($newDn, $uuid); $this->access->getUserMapper()->setDNbyUUID($newDn, $uuid);
return true; return true;
} catch (ServerNotAvailableException $e) {
throw $e;
} catch (\Exception $e) { } catch (\Exception $e) {
return false; return false;
} }