The subject error is thrown when the LDAP module attempts to match a user based on Persistent and Unique User ID Attribute.

Changing the variable $name in file /sites/all/modules/ldap/ldap_authentication/ldap_authentication.inc on lines 452 and 454 to $authname resolves this issue:

$user_edit = array(); // array of attributes that are changing for existing users
445 if (!$account_exists && isset($auth_conf->enabledAuthenticationServers[$ldap_user['sid']])) {
446 $ldap_server = $auth_conf->enabledAuthenticationServers[$ldap_user['sid']];
447 $puid = $ldap_server->userPuidFromLdapEntry($ldap_user['attr']);
448 if ($puid) {
449 $account = $ldap_server->userUserEntityFromPuid($puid);
450 if ($account) {
451 $account_exists = TRUE;
452 $user_edit['name'] = $authname;
453 $account = user_save($account, $user_edit, 'ldap_user');
454 user_set_authmaps($account, array("authname_ldap_user" => $authname));
455 }
456 }
457 }

Comments

johnbarclay’s picture

Title: Notice: Undefined variable: name in _ldap_authentication_user_login_authenticate_validate() » LDAP Authentication: Notice: Undefined variable: name in _ldap_authentication_user_login_authenticate_validate()
Version: 7.x-2.0-beta2 » 7.x-2.x-dev
Status: Active » Needs review

Good catch. The patch is close but not quite right.

$authname is the string used on logon form or in SSO from the server
$accountname is the name used for user account ($user->name property)

Generally these are the same, but sometimes not when a transformation occurs. Here's the updated patch http://drupalcode.org/project/ldap.git/commitdiff/753bddca5c5e79cf39914a...

Which fixes another similar error with $authname being used where $accountname should be used. This is committed to 7.x-2.0-dev.

johnbarclay’s picture

Status: Needs review » Closed (fixed)
johnbarclay’s picture

Issue summary: View changes

Added related filename