summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_profile/ldap_profile.module
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_profile/ldap_profile.module')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_profile/ldap_profile.module17
1 files changed, 13 insertions, 4 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_profile/ldap_profile.module b/kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_profile/ldap_profile.module
index 787463f..3b62fb7 100644
--- a/kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_profile/ldap_profile.module
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_profile/ldap_profile.module
@@ -83,16 +83,19 @@ function ldap_profile_user_login(&$edit, $account) {
module_load_include('functions.inc', 'ldap_servers');
+ if (!empty($account)) {
+ $ldapuser = ldap_servers_get_user_ldap_data($account);
+ if (!empty($ldapuser) && !empty($ldapuser['dn'])) {
+ $dn = $ldapuser['dn'];
+ }
+ }
+
if (is_array($account->data) && array_key_exists("ldap_authentication", $account->data)) {
$authdata = $account->data["ldap_authentication"];
if (array_key_exists('init', $authdata)) {
$authinit = $authdata['init'];
if (isset($servers[$authinit['sid']])) {
$server = $servers[$authinit['sid']];
- $ldapuser = TRUE;
- if (array_key_exists('dn', $authinit)) {
- $dn = $authinit['dn'];
- }
}
}
}
@@ -181,6 +184,12 @@ function ldap_profile_user_login(&$edit, $account) {
}
}
if (count($changes) > 0) {
+ // preload the previously created account as the original
+ // this is to prevent a cycling condition with entitycache.module
+ // which will continue until memory is exhausted
+ // the new field changes are treated as updates in this case
+ // (Do not reset the cache until after the changes are saved)
+ $account->original = user_load($account->uid, FALSE);
user_save($account, $changes);
}