diff options
author | jim-p <jimp@pfsense.org> | 2012-06-30 18:11:17 -0400 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2012-06-30 18:11:17 -0400 |
commit | 83e0d4c85c9e5d45c22e82b7a2dfcf0b1d15a413 (patch) | |
tree | 85326f6a34967516f2bd0f626cc822a4bdcdf768 /etc/inc/auth.inc | |
parent | 9deb5107549dc9f471e8402b98e71dc7a06bcfe3 (diff) | |
download | pfsense-83e0d4c85c9e5d45c22e82b7a2dfcf0b1d15a413.zip pfsense-83e0d4c85c9e5d45c22e82b7a2dfcf0b1d15a413.tar.gz |
Fix LDAP over IPv6 (works fine, just needed slight adjustment to URI)
Diffstat (limited to 'etc/inc/auth.inc')
-rw-r--r-- | etc/inc/auth.inc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index 614c93d..7158b78 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -639,7 +639,7 @@ function ldap_test_connection($authcfg) { $ldapproto = "ldap"; else $ldapproto = "ldaps"; - $ldapserver = "{$ldapproto}://{$authcfg['host']}"; + $ldapserver = "{$ldapproto}://" . ldap_format_host($authcfg['host']); $ldapport = $authcfg['ldap_port']; if (!empty($ldapport)) $ldapserver .= ":{$ldapport}"; @@ -706,7 +706,7 @@ function ldap_test_bind($authcfg) { $ldapproto = "ldap"; else $ldapproto = "ldaps"; - $ldapserver = "{$ldapproto}://{$authcfg['host']}"; + $ldapserver = "{$ldapproto}://" . ldap_format_host($authcfg['host']); $ldapport = $authcfg['ldap_port']; if (!empty($ldapport)) $ldapserver .= ":{$ldapport}"; @@ -769,7 +769,7 @@ function ldap_get_user_ous($show_complete_ou=true, $authcfg) { $ldapproto = "ldap"; else $ldapproto = "ldaps"; - $ldapserver = "{$ldapproto}://{$authcfg['host']}"; + $ldapserver = "{$ldapproto}://" . ldap_format_host($authcfg['host']); $ldapport = $authcfg['ldap_port']; if (!empty($ldapport)) $ldapserver .= ":{$ldapport}"; @@ -876,7 +876,7 @@ function ldap_get_groups($username, $authcfg) { $ldapproto = "ldap"; else $ldapproto = "ldaps"; - $ldapserver = "{$ldapproto}://{$authcfg['host']}"; + $ldapserver = "{$ldapproto}://" . ldap_format_host($authcfg['host']); $ldapport = $authcfg['ldap_port']; if (!empty($ldapport)) $ldapserver .= ":{$ldapport}"; @@ -968,6 +968,10 @@ function ldap_get_groups($username, $authcfg) { return $memberof; } +function ldap_format_host($host) { + return is_ipaddrv6($host) ? "[$host]" : $host ; +} + function ldap_backed($username, $passwd, $authcfg) { global $debug, $config; @@ -991,7 +995,7 @@ function ldap_backed($username, $passwd, $authcfg) { $ldapproto = "ldap"; else $ldapproto = "ldaps"; - $ldapserver = "{$ldapproto}://{$authcfg['host']}"; + $ldapserver = "{$ldapproto}://" . ldap_format_host($authcfg['host']); $ldapport = $authcfg['ldap_port']; if (!empty($ldapport)) $ldapserver .= ":{$ldapport}"; |