diff options
Diffstat (limited to 'apps/user_ldap/lib/LDAP.php')
-rw-r--r-- | apps/user_ldap/lib/LDAP.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/apps/user_ldap/lib/LDAP.php b/apps/user_ldap/lib/LDAP.php index 74d83e4ab4f..0d491396ee4 100644 --- a/apps/user_ldap/lib/LDAP.php +++ b/apps/user_ldap/lib/LDAP.php @@ -9,6 +9,7 @@ * @author Lukas Reschke <lukas@statuscode.ch> * @author Morris Jobke <hey@morrisjobke.de> * @author Robin McCorkell <robin@mccorkell.me.uk> + * @author Roger Szabo <roger.szabo@web.de> * * @license AGPL-3.0 * @@ -29,6 +30,7 @@ namespace OCA\User_LDAP; use OC\ServerNotAvailableException; +use OCA\User_LDAP\Exceptions\ConstraintViolationException; class LDAP implements ILDAPWrapper { protected $curFunc = ''; @@ -194,6 +196,16 @@ class LDAP implements ILDAPWrapper { /** * @param LDAP $link + * @param string $userDN + * @param string $password + * @return bool + */ + public function modReplace($link, $userDN, $password) { + return $this->invokeLDAPMethod('mod_replace', $link, $userDN, array('userPassword' => $password)); + } + + /** + * @param LDAP $link * @param string $option * @param int $value * @return bool|mixed @@ -288,6 +300,9 @@ class LDAP implements ILDAPWrapper { throw new \Exception('LDAP authentication method rejected', $errorCode); } else if ($errorCode === 1) { throw new \Exception('LDAP Operations error', $errorCode); + } else if ($errorCode === 19) { + ldap_get_option($this->curArgs[0], LDAP_OPT_ERROR_STRING, $extended_error); + throw new ConstraintViolationException(!empty($extended_error)?$extended_error:$errorMsg, $errorCode); } else { \OCP\Util::writeLog('user_ldap', 'LDAP error '.$errorMsg.' (' . |