mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Do not pass the ldap port separately, but add it to the LDAP URL. PHP's ldap_connect() ignores the passed port parameter if the first parameter is a URL instead of a hostname.
This commit is contained in:
parent
c6023b4ac9
commit
4d89e4d781
@ -615,6 +615,8 @@ function ldap_test_connection($authcfg) {
|
||||
$ldapproto = "ldaps";
|
||||
$ldapserver = "{$ldapproto}://{$authcfg['host']}";
|
||||
$ldapport = $authcfg['ldap_port'];
|
||||
if (!empty($ldapport))
|
||||
$ldapserver .= ":{$ldapport}";
|
||||
$ldapbasedn = $authcfg['ldap_basedn'];
|
||||
$ldapbindun = $authcfg['ldap_binddn'];
|
||||
$ldapbindpw = $authcfg['ldap_bindpw'];
|
||||
@ -630,11 +632,8 @@ function ldap_test_connection($authcfg) {
|
||||
|
||||
/* connect and see if server is up */
|
||||
$error = false;
|
||||
if (empty($ldapport)) {
|
||||
if (!($ldap = ldap_connect($ldapserver)))
|
||||
$error = true;
|
||||
} else if (!($ldap = ldap_connect($ldapserver, $ldapport)))
|
||||
$error = true;
|
||||
if (!($ldap = ldap_connect($ldapserver)))
|
||||
$error = true;
|
||||
|
||||
if ($error == true) {
|
||||
log_error("ERROR! Could not connect to server {$ldapname}.");
|
||||
@ -683,6 +682,8 @@ function ldap_test_bind($authcfg) {
|
||||
$ldapproto = "ldaps";
|
||||
$ldapserver = "{$ldapproto}://{$authcfg['host']}";
|
||||
$ldapport = $authcfg['ldap_port'];
|
||||
if (!empty($ldapport))
|
||||
$ldapserver .= ":{$ldapport}";
|
||||
$ldapbasedn = $authcfg['ldap_basedn'];
|
||||
$ldapbindun = $authcfg['ldap_binddn'];
|
||||
$ldapbindpw = $authcfg['ldap_bindpw'];
|
||||
@ -703,11 +704,8 @@ function ldap_test_bind($authcfg) {
|
||||
|
||||
/* connect and see if server is up */
|
||||
$error = false;
|
||||
if (empty($ldapport)) {
|
||||
if (!($ldap = ldap_connect($ldapserver)))
|
||||
$error = true;
|
||||
} else if (!($ldap = ldap_connect($ldapserver, $ldapport)))
|
||||
$error = true;
|
||||
if (!($ldap = ldap_connect($ldapserver)))
|
||||
$error = true;
|
||||
|
||||
if ($error == true) {
|
||||
log_error("ERROR! Could not connect to server {$ldapname}.");
|
||||
@ -747,6 +745,8 @@ function ldap_get_user_ous($show_complete_ou=true, $authcfg) {
|
||||
$ldapproto = "ldaps";
|
||||
$ldapserver = "{$ldapproto}://{$authcfg['host']}";
|
||||
$ldapport = $authcfg['ldap_port'];
|
||||
if (!empty($ldapport))
|
||||
$ldapserver .= ":{$ldapport}";
|
||||
$ldapbasedn = $authcfg['ldap_basedn'];
|
||||
$ldapbindun = $authcfg['ldap_binddn'];
|
||||
$ldapbindpw = $authcfg['ldap_bindpw'];
|
||||
@ -772,11 +772,8 @@ function ldap_get_user_ous($show_complete_ou=true, $authcfg) {
|
||||
|
||||
/* connect and see if server is up */
|
||||
$error = false;
|
||||
if (empty($ldapport)) {
|
||||
if (!($ldap = ldap_connect($ldapserver)))
|
||||
$error = true;
|
||||
} else if (!($ldap = ldap_connect($ldapserver, $ldapport)))
|
||||
$error = true;
|
||||
if (!($ldap = ldap_connect($ldapserver)))
|
||||
$error = true;
|
||||
|
||||
if ($error == true) {
|
||||
log_error("ERROR! Could not connect to server {$ldapname}.");
|
||||
@ -855,6 +852,8 @@ function ldap_get_groups($username, $authcfg) {
|
||||
$ldapproto = "ldaps";
|
||||
$ldapserver = "{$ldapproto}://{$authcfg['host']}";
|
||||
$ldapport = $authcfg['ldap_port'];
|
||||
if (!empty($ldapport))
|
||||
$ldapserver .= ":{$ldapport}";
|
||||
$ldapbasedn = $authcfg['ldap_basedn'];
|
||||
$ldapbindun = $authcfg['ldap_binddn'];
|
||||
$ldapbindpw = $authcfg['ldap_bindpw'];
|
||||
@ -885,11 +884,8 @@ function ldap_get_groups($username, $authcfg) {
|
||||
|
||||
/* connect and see if server is up */
|
||||
$error = false;
|
||||
if (empty($ldapport)) {
|
||||
if (!($ldap = ldap_connect($ldapserver)))
|
||||
$error = true;
|
||||
} else if (!($ldap = ldap_connect($ldapserver, $ldapport)))
|
||||
$error = true;
|
||||
if (!($ldap = ldap_connect($ldapserver)))
|
||||
$error = true;
|
||||
|
||||
if ($error == true) {
|
||||
log_error("ERROR! ldap_get_groups() Could not connect to server {$ldapname}.");
|
||||
@ -971,6 +967,8 @@ function ldap_backed($username, $passwd, $authcfg) {
|
||||
$ldapproto = "ldaps";
|
||||
$ldapserver = "{$ldapproto}://{$authcfg['host']}";
|
||||
$ldapport = $authcfg['ldap_port'];
|
||||
if (!empty($ldapport))
|
||||
$ldapserver .= ":{$ldapport}";
|
||||
$ldapbasedn = $authcfg['ldap_basedn'];
|
||||
$ldapbindun = $authcfg['ldap_binddn'];
|
||||
$ldapbindpw = $authcfg['ldap_bindpw'];
|
||||
@ -1007,10 +1005,7 @@ function ldap_backed($username, $passwd, $authcfg) {
|
||||
|
||||
/* Make sure we can connect to LDAP */
|
||||
$error = false;
|
||||
if (empty($ldapport)) {
|
||||
if (!($ldap = ldap_connect($ldapserver)))
|
||||
$error = true;
|
||||
} else if (!($ldap = ldap_connect($ldapserver, $ldapport)))
|
||||
if (!($ldap = ldap_connect($ldapserver)))
|
||||
$error = true;
|
||||
|
||||
if ($error == true) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user