Bug #15122
closedPHP errors in LDAP server prevent it from falling back to Local Database
100%
Description
The following error can be hit when attempting to login with a misconfigured LDAP server, which prevents the code from falling back to the Local Database. The error checking in the ldap_backed() function should be moved to before the call to the ldap_setup_caenv() function. I'll be doing some testing and will submit a merge request in the next couple of days.
Fatal error: Uncaught TypeError: ldap_set_option(): Argument #1 ($ldap) must be of type ?LDAP\Connection, bool given in /etc/inc/auth.inc:1100 Stack trace: #0 /etc/inc/auth.inc(1100): ldap_set_option(false, 24582, 1) #1 /etc/inc/auth.inc(1604): ldap_setup_caenv(false, Array) #2 /etc/inc/auth.inc(2103): ldap_backed('admin', 'pfsense', Array, Array) #3 /etc/inc/auth.inc(2161): authenticate_user('admin', 'pfsense', Array, Array) #4 /etc/inc/authgui.inc(37): session_auth() #5 /usr/local/www/guiconfig.inc(62): require_once('/etc/inc/authgu...') #6 /usr/local/www/index.php(46): require_once('/usr/local/www/...') #7 {main} thrown in /etc/inc/auth.inc on line 1100 PHP ERROR: Type: 1, File: /etc/inc/auth.inc, Line: 1100, Message: Uncaught TypeError: ldap_set_option(): Argument #1 ($ldap) must be of type ?LDAP\Connection, bool given in /etc/inc/auth.inc:1100 Stack trace: #0 /etc/inc/auth.inc(1100): ldap_set_option(false, 24582, 1) #1 /etc/inc/auth.inc(1604): ldap_setup_caenv(false, Array) #2 /etc/inc/auth.inc(2103): ldap_backed('admin', 'pfsense', Array, Array) #3 /etc/inc/auth.inc(2161): authenticate_user('admin', 'pfsense', Array, Array) #4 /etc/inc/authgui.inc(37): session_auth() #5 /usr/local/www/guiconfig.inc(62): require_once('/etc/inc/authgu...') #6 /usr/local/www/index.php(46): require_once('/usr/local/www/...') #7 {main} thrown