User 1 login fails when the LDAP Authentication module is enabled with "Mixed mode"

The problem is in ldap_authentication.inc
_ldap_authentication_user_login_authenticate_validate() function has a section that rejects any login by user 1.

line 151

 if ($auth_conf->authenticationMode ==  LDAP_AUTHENTICATION_MIXED) {
  if ($account_exists && $account->uid == 1) {
   form_set_error('name', 'Failed Authentication');
   return FALSE;
  }
 }

the comments say...

/**
  *
  * if LDAP_AUTHENTICATION_MIXED return  the Drupal built in authentication will
  * have already been validated (and failed) so if uid == 1 then throw error
  *
  **/

...so I guess that we should not even be here if we are already validated. But we are!

Should there be a test for "validated user" in ldap_authentication.module in the dap_authentication_user_login_authenticate_validate() function?

~jsloan

Comments

jsloan’s picture

for now I'm using this change to _ldap_authentication_user_login_authenticate_validate()

/**
 * validate function for user logon forms.
*/
function ldap_authentication_user_login_authenticate_validate($form, &$form_state) {
  if (!$form_state['uid']){ // can I assume that if validated then we do not go any further??
      require_once('ldap_authentication.inc');
      _ldap_authentication_user_login_authenticate_validate($form_state);
  }
}
johnbarclay’s picture

yeah. So the validation functions are probably in the array in the wrong order; or my logic is flawed. That section of code where the validate functions are added should be heavily commented.

thekevinday’s picture

well,looks like you beat me to this bug report.

subscribe.

johnbarclay’s picture

Version: 7.x-1.0-unstable2 » 7.x-1.0-unstable3
Assigned: Unassigned » johnbarclay
Status: Active » Fixed

I put the same code elsewhere and added a check to make sure user 1 was not authenticating on ldap after failing with drupal authentication.

Thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.