Refactored ldap parameters

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2021-02-14 16:49:02 +01:00
parent 2c05ccc517
commit e136bbbcb6
4 changed files with 11 additions and 6 deletions

View File

@ -1,3 +1,9 @@
1.3.11:
-------
- Obsoleted the LDAP port parameter. Specify the ldap host in the form
of protocol://hostname:port, eg. ldaps://ldap.yourdomain.com:636
1.3.10:
-------

View File

@ -82,7 +82,6 @@ $config['WKHTMLTOPDF_COMMAND'] = "wkhtmltopdf";
$config['ENABLE_LDAP_AUTH'] = 0;
$config['LDAP_HOST'] = 'ldap.yourdomain.com';
$config['LDAP_PORT'] = 389;
$config['LDAP_HELPER_DN'] = 'cn=....';
$config['LDAP_HELPER_PASSWORD'] = 'xxxxxxx';
$config['LDAP_MAIL_ATTR'] = 'mail';

View File

@ -212,7 +212,7 @@ class ModelUserAuth extends Model {
if($ldap_host == '' || $ldap_helper_password == '') { return 0; }
$ldap = new LDAP($ldap_host, $ldap_port, $ldap_helper_dn, $ldap_helper_password);
$ldap = new LDAP($ldap_host, $ldap_helper_dn, $ldap_helper_password);
if($ldap->is_bind_ok()) {
@ -221,7 +221,7 @@ class ModelUserAuth extends Model {
if(isset($query->row['dn']) && $query->row['dn']) {
$a = $query->row;
$ldap_auth = new LDAP($ldap_host, $ldap_port, $a['dn'], $password);
$ldap_auth = new LDAP($ldap_host, $a['dn'], $password);
if(LOG_LEVEL >= NORMAL) { syslog(LOG_INFO, "ldap auth against '" . $ldap_host . "', dn: '" . $a['dn'] . "', result: " . $ldap_auth->is_bind_ok()); }
@ -478,7 +478,7 @@ class ModelUserAuth extends Model {
if(LOG_LEVEL >= NORMAL) { syslog(LOG_INFO, "sso login: $sso_user"); }
$ldap = new LDAP(LDAP_HOST, LDAP_PORT, LDAP_HELPER_DN, LDAP_HELPER_PASSWORD);
$ldap = new LDAP(LDAP_HOST, LDAP_HELPER_DN, LDAP_HELPER_PASSWORD);
if($ldap->is_bind_ok()) {

View File

@ -6,9 +6,9 @@ class LDAP {
private $link;
private $bind;
public function __construct($ldaphost, $ldapport, $binddn, $bindpw) {
public function __construct($ldaphost, $binddn, $bindpw) {
$this->link = ldap_connect($ldaphost, $ldapport) or exit('Error: ldap_connect()');
$this->link = ldap_connect($ldaphost) or exit('Error: ldap_connect()');
ldap_set_option($this->link, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($this->link, LDAP_OPT_REFERRALS, 0);