Please see if this makes sense:
The ldapauth.module uses a global variable name called "ldap" to instantiate new LDAP objects. It also happens that the ldapdata module also uses the same global variable name "ldap".
In ldapauth.module, the function _ldapauth_save_user invokes the hook user_load and later on uses the global variable $ldap values to save ldap_config info to the user object. However, user_load invokes ldapdata.module as it provides that hook, which over rides the values in the global $ldap object.
This problem is visible in the following environment:
- Multiple LDAP Server Configs are in place and enabled
- User account is not found in the first config but in the later configs
This will cause the global $ldap object to lose its correct server info and get reset in the ldapdata.module.
FIX:
- Follow good coding practices and rename the global variable to module-specific variable. (i.e. Rename
$ldapto$ldapauth_ldap
I will provide a patch fix and I wanted to post the info so that others can comment and agree/disagree.
kreaper
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | ldapgroups.module.patch | 4.72 KB | kreaper |
| #2 | ldapauth.module_1.patch | 6.67 KB | kreaper |
| #1 | ldapdata.module.patch | 534 bytes | kreaper |
Comments
Comment #1
kreaper commentedldapdata.module.patch attached
Comment #2
kreaper commentedldapauth.module.patch attached
Comment #3
kreaper commentedldapgroups.module.patch
Comment #4
kreaper commentedCommitting to HEAD