Retry contacting LDAP server and fail with 503 if unavailable.

We can't call $request->DoResponse() at this point because we haven't
done all that stuff yet...
This commit is contained in:
Andrew McMillan 2012-05-14 22:57:52 +12:00
parent 724a549502
commit a267a25165

View File

@ -294,8 +294,13 @@ function LDAP_check($username, $password ){
$ldapDriver = getStaticLdap();
if ( !$ldapDriver->valid ) {
dbg_error_log( "ERROR", "Couldn't contact LDAP server for authentication" );
return false;
sleep(1); // Sleep very briefly to try and survive intermittent issues
$ldapDriver = getStaticLdap();
if ( !$ldapDriver->valid ) {
dbg_error_log( "ERROR", "Couldn't contact LDAP server for authentication" );
header( sprintf("HTTP/1.1 %d %s", 503, translate("Authentication server unavailable.")) );
exit(0);
}
}
$mapping = $c->authenticate_hook['config']['mapping_field'];