summaryrefslogtreecommitdiffstats
path: root/etc/inc/auth.inc
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-10-25 11:05:11 -0400
committerjim-p <jimp@pfsense.org>2011-10-25 11:05:11 -0400
commit9f27de6d2f1a4d36190797db78bf1394e0ea0dcd (patch)
tree7cc662904a2c5895ea340eb7da2e7fc86a0cdd54 /etc/inc/auth.inc
parentea1cea05ee195fd56eedd095bf25e89b27762972 (diff)
downloadpfsense-9f27de6d2f1a4d36190797db78bf1394e0ea0dcd.zip
pfsense-9f27de6d2f1a4d36190797db78bf1394e0ea0dcd.tar.gz
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.
Diffstat (limited to 'etc/inc/auth.inc')
-rw-r--r--etc/inc/auth.inc43
1 files changed, 19 insertions, 24 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc
index c4cb722..24f221b 100644
--- a/etc/inc/auth.inc
+++ b/etc/inc/auth.inc
@@ -632,6 +632,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'];
@@ -647,11 +649,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(sprintf(gettext("ERROR! Could not connect to server %s."), $ldapname));
@@ -700,6 +699,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'];
@@ -720,11 +721,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(sprintf(gettext("ERROR! Could not connect to server %s."), $ldapname));
@@ -764,6 +762,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'];
@@ -789,11 +789,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(sprintf(gettext("ERROR! Could not connect to server %s."), $ldapname));
@@ -872,6 +869,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'];
@@ -902,11 +901,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(sprintf(gettext("ERROR! ldap_get_groups() Could not connect to server %s."), $ldapname));
@@ -988,6 +984,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'];
@@ -1035,10 +1033,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) {
OpenPOWER on IntegriCloud