diff --git a/html/includes/authentication/ad-authorization.inc.php b/html/includes/authentication/ad-authorization.inc.php index 750c3f62dd..010a3e2b6c 100644 --- a/html/includes/authentication/ad-authorization.inc.php +++ b/html/includes/authentication/ad-authorization.inc.php @@ -11,27 +11,27 @@ if (isset($config['auth_ad_check_certificates']) && }; // Set up connection to LDAP server -$ds = @ldap_connect($config['auth_ad_url']); -if (! $ds) { - echo '

Fatal error while connecting to AD url ' . $config['auth_ad_url'] . ': ' . ldap_error($ds) . '

'; +$ldap_connection = @ldap_connect($config['auth_ad_url']); +if (! $ldap_connection) { + echo '

Fatal error while connecting to AD url ' . $config['auth_ad_url'] . ': ' . ldap_error($ldap_connection) . '

'; exit; } // disable referrals and force ldap version to 3 -ldap_set_option($ds, LDAP_OPT_REFERRALS, 0); -ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); +ldap_set_option($ldap_connection, LDAP_OPT_REFERRALS, 0); +ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, 3); // Bind to AD if (isset($config['auth_ad_binduser']) && isset($config['auth_ad_bindpassword'])) { // With specified bind user - if (! ldap_bind($ds, "${config['auth_ad_binduser']}@${config['auth_ad_domain']}", "${config['auth_ad_bindpassword']}")) { - echo ldap_error($ds); + if (! ldap_bind($ldap_connection, "${config['auth_ad_binduser']}@${config['auth_ad_domain']}", "${config['auth_ad_bindpassword']}")) { + echo ldap_error($ldap_connection); } } else { // Anonymous - if (! ldap_bind($ds)) { - echo ldap_error($ds); + if (! ldap_bind($ldap_connection)) { + echo ldap_error($ldap_connection); } } diff --git a/html/includes/authentication/ldap-authorization.inc.php b/html/includes/authentication/ldap-authorization.inc.php index afda92e299..6c0145c4ff 100644 --- a/html/includes/authentication/ldap-authorization.inc.php +++ b/html/includes/authentication/ldap-authorization.inc.php @@ -45,19 +45,19 @@ if (! isset ($_SESSION['username'])) { /** * Set up connection to LDAP server */ -$ds = @ldap_connect ($config['auth_ldap_server'], $config['auth_ldap_port']); -if (! $ds) { - echo '

Fatal error while connecting to LDAP server ' . $config['auth_ldap_server'] . ':' . $config['auth_ldap_port'] . ': ' . ldap_error($ds) . '

'; +$ldap_connection = @ldap_connect ($config['auth_ldap_server'], $config['auth_ldap_port']); +if (! $ldap_connection) { + echo '

Fatal error while connecting to LDAP server ' . $config['auth_ldap_server'] . ':' . $config['auth_ldap_port'] . ': ' . ldap_error($ldap_connection) . '

'; exit; } if ($config['auth_ldap_version']) { - ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, $config['auth_ldap_version']); + ldap_set_option($ldap_connection, LDAP_OPT_PROTOCOL_VERSION, $config['auth_ldap_version']); } if ($config['auth_ldap_starttls'] && ($config['auth_ldap_starttls'] == 'optional' || $config['auth_ldap_starttls'] == 'require')) { - $tls = ldap_start_tls($ds); + $tls = ldap_start_tls($ldap_connection); if ($config['auth_ldap_starttls'] == 'require' && $tls === false) { - echo '

Fatal error: LDAP TLS required but not successfully negotiated:' . ldap_error($ds) . '

'; + echo '

Fatal error: LDAP TLS required but not successfully negotiated:' . ldap_error($ldap_connection) . '

'; exit; } } diff --git a/html/includes/authentication/ldap.inc.php b/html/includes/authentication/ldap.inc.php index 4948b63796..884ce7db14 100644 --- a/html/includes/authentication/ldap.inc.php +++ b/html/includes/authentication/ldap.inc.php @@ -1,11 +1,11 @@ Fatal error: LDAP TLS required but not successfully negotiated:'.ldap_error($ds).''; + echo '

Fatal error: LDAP TLS required but not successfully negotiated:'.ldap_error($ldap_connection).'

'; exit; } }