Add more options.

This commit is contained in:
Jens Meißner 2017-10-18 14:57:13 +02:00
parent beecfe3c34
commit 89927b47f7
2 changed files with 6 additions and 1 deletions

View file

@ -40,7 +40,10 @@ if ($config['auth_type'] == 'db') {
}
} elseif ($config['auth_type'] == 'ldap') {
$ldap = @ldap_connect($config['ldap_uri']);
@ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, $config['ldap_version']);
if ($config['ldap_starttls']) {
@ldap_start_tls($ldap);
}
@ldap_bind($ldap, $config['ldap_bind_dn'], $config['ldap_bind_pw']);
$filter = str_replace('%user%', @ldap_escape($input->user, null, LDAP_ESCAPE_FILTER), $config['ldap_search']);
$result = @ldap_search($ldap, $config['ldap_base_dn'], $filter, array('dn'));

View file

@ -28,6 +28,8 @@ $config['auth_type'] = 'db';
// LDAP settings
$config['ldap_uri'] = 'ldapi:///';
$config['ldap_version'] = 3;
$config['ldap_starttls'] = false;
$config['ldap_bind_dn'] = '';
$config['ldap_bind_pw'] = '';
$config['ldap_base_dn'] = '';