1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-02-21 03:08:40 +01:00

Survive mild misconfiguration of Realname Attributes in LDAP

Summary: Currently, we'll fatal on array typehint issues if this is misconfigured. Instead, we should just reject the configuration. See some discussion in IRC.

Test Plan: Used LDAP to log in.

Reviewers: btrahan, totorico

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D6489
This commit is contained in:
epriestley 2013-07-18 12:40:57 -07:00
parent 85798368be
commit ab5ee5d193

View file

@ -24,6 +24,12 @@ final class PhabricatorAuthProviderLDAP
public function getAdapter() {
if (!$this->adapter) {
$conf = $this->getProviderConfig();
$realname_attributes = $conf->getProperty(self::KEY_REALNAME_ATTRIBUTES);
if (!is_array($realname_attributes)) {
$realname_attributes = array();
}
$adapter = id(new PhutilAuthAdapterLDAP())
->setHostname(
$conf->getProperty(self::KEY_HOSTNAME))
@ -35,8 +41,7 @@ final class PhabricatorAuthProviderLDAP
$conf->getProperty(self::KEY_SEARCH_ATTRIBUTE))
->setUsernameAttribute(
$conf->getProperty(self::KEY_USERNAME_ATTRIBUTE))
->setRealNameAttributes(
$conf->getProperty(self::KEY_REALNAME_ATTRIBUTES, array()))
->setRealNameAttributes($realname_attributes)
->setLDAPVersion(
$conf->getProperty(self::KEY_VERSION))
->setLDAPReferrals(