We have had LDAP Integration since 5.x-1.1, and it's been enormously helpful to us. We have LDAP Integration set to authenticate against LDAP first, then Drupal. Everything was working fine until the upgrade to 5.x-1.3. No email address was populated automatically, which was a nuisance, but we would manually add this to the user record when assigning roles. We need the email address to be held in the user record in order to use notifications from Workflow and Casetracker modules.

However, this is now broken with the upgrade. Now when users log in, the module authenticates, but since our LDAP/AD server does not contain the email address (or any other useful information other than authentication information), a null is returned and this null replaces the email address manually entered into the user record. Now the users don't receive any of the notification emails they need.

I have backed out 5.x-1.3 and returned to 5.x-1.2. Email addresses now seem to be preserved. I strongly recommend checking the value returned from the email call to see if it is a null, and if so, leaving the existing email address in the user record as-is. (Additionally, making the population of email from LDAP an option rather than an assumed behavior would be much preferred.)

Comments

vaab’s picture

I'm new to drupal and experienced the same problem with a small variation : users hadn't the right on the LDAP server to delete their "mail" field.

I traced down the problem to the "ldapdata_user" function that was called with a "$edit" code that contained the ( "mail" => NULL ) directive with the "update" action.

I do not know why and when is called this function (it occurs at first login page for me).

I looked into the Drupal API and found that description of the 'update' in 'hook_user' :

The user account is being changed. The module should save its custom additions to the user object into the database and set the saved fields to NULL in $edit.

So it seems that having "NULL" set in "mail" is perfectly normal at this state (a previous module or action has done it's job on it). It is ldapdata.module that improperly take this info as a new value for "mail" in LDAP instead of IGNORING it.

so I added this line of code in function 'ldapdata_user_update_drupal_account', in the 'foreach' loop, as the first instruction :

if ($value == null) continue; // This option have already been saved by another action.

This solved my problem (and other NULL related problem).

emdalton’s picture

I understand 5.x-1.4 is now in progress. Has this been addressed?

johnbarclay’s picture

Status: Active » Closed (won't fix)

Closing 5.x issues to clean out issue queue.