mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-17 10:04:41 +00:00
LDAP/StartTLS userimport, start using correct url and move logic to legacy page. for https://github.com/opnsense/core/issues/3445
This commit is contained in:
parent
ec613d3042
commit
c4fba1c62e
@ -723,16 +723,6 @@ function auth_get_authserver($name)
|
||||
foreach ($config['system']['authserver'] as $authcfg) {
|
||||
if ($authcfg['name'] == $name) {
|
||||
if ($authcfg['type'] == 'ldap' || $authcfg['type'] == 'ldap-totp') {
|
||||
// let's try to avoid regenerating the ldap url in every function.
|
||||
if (strstr($authcfg['ldap_urltype'], "Standard")) {
|
||||
$authcfg['ldap_full_url'] = "ldap://";
|
||||
} else {
|
||||
$authcfg['ldap_full_url'] = "ldaps://";
|
||||
}
|
||||
$authcfg['ldap_full_url'] .= is_ipaddrv6($authcfg['host']) ? "[{$authcfg['host']}]" : $authcfg['host'];
|
||||
if (!empty($authcfg['ldap_port'])) {
|
||||
$authcfg['ldap_full_url'] .= ":{$authcfg['ldap_port']}";
|
||||
}
|
||||
// make sure a user and password entry exists and are null for anonymous usage
|
||||
if (empty($authcfg['ldap_binddn'])) {
|
||||
$authcfg['ldap_binddn'] = null;
|
||||
|
||||
@ -72,6 +72,15 @@ foreach ($servers as $server) {
|
||||
if ($authcfg['type'] == 'ldap' || $authcfg['type'] == 'ldap-totp') {
|
||||
$authName = $server;
|
||||
$ldap_server = $authcfg;
|
||||
if (strstr($ldap_server['ldap_urltype'], "Standard") || strstr($ldap_server['ldap_urltype'], "StartTLS")) {
|
||||
$ldap_server['ldap_full_url'] = "ldap://";
|
||||
} else {
|
||||
$ldap_server['ldap_full_url'] = "ldaps://";
|
||||
}
|
||||
$ldap_server['ldap_full_url'] .= is_ipaddrv6($authcfg['host']) ? "[{$authcfg['host']}]" : $authcfg['host'];
|
||||
if (!empty($ldap_server['ldap_port'])) {
|
||||
$ldap_server['ldap_full_url'] .= ":{$authcfg['ldap_port']}";
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user