@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Allow custom LDAP port

Summary: Allow custom LDAP port to be defined in config file

Test Plan: Test login works by specifying a custom port

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3153

authored by

Danny Su and committed by
epriestley
92fd606d ed888178

+15 -8
+3
conf/default.conf.php
··· 627 627 // The LDAP server hostname 628 628 'ldap.hostname' => '', 629 629 630 + // The LDAP server port 631 + 'ldap.port' => 389, 632 + 630 633 // The LDAP base domain name 631 634 'ldap.base_dn' => '', 632 635
+12 -8
src/applications/auth/ldap/PhabricatorLDAPProvider.php
··· 42 42 return PhabricatorEnv::getEnvConfig('ldap.hostname'); 43 43 } 44 44 45 + public function getPort() { 46 + return PhabricatorEnv::getEnvConfig('ldap.port'); 47 + } 48 + 45 49 public function getBaseDN() { 46 50 return PhabricatorEnv::getEnvConfig('ldap.base_dn'); 47 51 } ··· 57 61 public function getLDAPVersion() { 58 62 return PhabricatorEnv::getEnvConfig('ldap.version'); 59 63 } 60 - 64 + 61 65 public function getLDAPReferrals() { 62 66 return PhabricatorEnv::getEnvConfig('ldap.referrals'); 63 67 } ··· 78 82 if (is_array($name_attributes)) { 79 83 foreach ($name_attributes AS $attribute) { 80 84 if (isset($data[$attribute][0])) { 81 - $real_name .= $data[$attribute][0] . ' '; 85 + $real_name .= $data[$attribute][0].' '; 82 86 } 83 87 } 84 88 ··· 100 104 101 105 public function getConnection() { 102 106 if (!isset($this->connection)) { 103 - $this->connection = ldap_connect($this->getHostname()); 107 + $this->connection = ldap_connect($this->getHostname(), $this->getPort()); 104 108 105 109 if (!$this->connection) { 106 - throw new Exception('Could not connect to LDAP host at ' . 107 - $this->getHostname()); 110 + throw new Exception('Could not connect to LDAP host at '. 111 + $this->getHostname().':'.$this->getPort()); 108 112 } 109 113 110 114 ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, 111 115 $this->getLDAPVersion()); 112 - ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 116 + ldap_set_option($this->connection, LDAP_OPT_REFERRALS, 113 117 $this->getLDAPReferrals()); 114 118 } 115 119 ··· 150 154 PhabricatorEnv::getEnvConfig('ldap.activedirectory_domain'); 151 155 152 156 if ($activeDirectoryDomain) { 153 - $dn = $username . '@' . $activeDirectoryDomain; 157 + $dn = $username.'@'.$activeDirectoryDomain; 154 158 } else { 155 159 $dn = ldap_sprintf( 156 160 '%Q=%s,%Q', ··· 198 202 } 199 203 200 204 if ($entries['count'] > 1) { 201 - throw new Exception('Found more then one user with this ' . 205 + throw new Exception('Found more then one user with this '. 202 206 $attribute); 203 207 } 204 208