LdapUserGroupBackend: Fix exception when searching for single chars

refs #10370
This commit is contained in:
Johannes Meyer 2015-11-09 16:00:24 +01:00
parent 4341eef4b1
commit ffcc2ed56b

View File

@ -9,6 +9,7 @@ use Icinga\Application\Logger;
use Icinga\Data\ConfigObject; use Icinga\Data\ConfigObject;
use Icinga\Exception\ConfigurationError; use Icinga\Exception\ConfigurationError;
use Icinga\Exception\ProgrammingError; use Icinga\Exception\ProgrammingError;
use Icinga\Protocol\Ldap\LdapException;
use Icinga\Repository\LdapRepository; use Icinga\Repository\LdapRepository;
use Icinga\Repository\RepositoryQuery; use Icinga\Repository\RepositoryQuery;
use Icinga\User; use Icinga\User;
@ -467,6 +468,7 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
*/ */
protected function persistUserName($name) protected function persistUserName($name)
{ {
try {
$userDn = $this->ds $userDn = $this->ds
->select() ->select()
->from($this->userClass, array()) ->from($this->userClass, array())
@ -486,6 +488,9 @@ class LdapUserGroupBackend extends LdapRepository implements UserGroupBackendInt
if ($groupDn) { if ($groupDn) {
return $groupDn; return $groupDn;
} }
} catch (LdapException $_) {
// pass
}
Logger::debug('Unable to persist uid or gid "%s" in repository "%s". No DN found.', $name, $this->getName()); Logger::debug('Unable to persist uid or gid "%s" in repository "%s". No DN found.', $name, $this->getName());
return $name; return $name;