On a fresh install of Drupal 7.x-18, I install the ldap 7.x-2.0-beta3 (tried 7.x-2.x-dev also) module, I enable Ldap server, and LDAP User, enter the creds that work in ldap 7.x-1.0-beta12 and I get the following error when I attempt to test the server:
Warning: Invalid argument supplied for foreach() in LdapServer->groupUserMembershipsFromEntry() (line 1594 of /var/www/html/sites/all/modules/ldap/ldap_servers/LdapServer.class.php).
Warning: Invalid argument supplied for foreach() in LdapServer->groupUserMembershipsFromEntry() (line 1594 of /var/www/html/sites/all/modules/ldap/ldap_servers/LdapServer.class.php).
I get the following results:
Binding with DN for non-anonymous search (cn=provisionproxy,ou=Test,o=VEC). Using password stored in configuration
Successfully bound to server
No results are returned but error thrown:
Failed to find test user vec72 by searching on uid = vec72. Error Message: Invalid DN syntax
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | ldap_config.txt | 11.41 KB | fbouzek |
Comments
Comment #1
fbouzek commentedTried to attach the ldap_config.html file, but it wouldn't let me. Renamed it .txt.
Comment #2
fbouzek commentedIt seems the issue is in LdapServer.class.php:
function userUserNameToExistingLdapEntry
$basedns = (is_array($this->basedn)) ? $this->basedn : array();
Comment #3
fbouzek commentedThis should probably be critical since it's impossible to get past the errors.
If I change that line to :
$basedns = (is_array($this->basedn)) ? $this->basedn : array($this->basedn);
The search works, but LDAP returns the error "Invalid DN Syntax"
probably because this is what is passed to ldap_search:
ldap_search() call: base_dn: a:1:{i:0;s:5:"o=VEC";}, filter = (uid=vec72), attributes: , attrsonly = 0, sizelimit = 0, timelimit = 0, deref = , scope = 3
Comment #3.0
fbouzek commentedAdded that no results are returned
Comment #4
fbouzek commentedIf I hard-code
$basedns = array("o=vec");
in place of
$basedns = (is_array($this->basedn)) ? $this->basedn : array();
all results are returned correctly, but I get the following errors:
Warning: Invalid argument supplied for foreach() in LdapServer->groupUserMembershipsFromEntry() (line 1618 of /var/www/html/sites/all/modules/ldap/ldap_servers/LdapServer.class.php).
Warning: Invalid argument supplied for foreach() in LdapServer->groupUserMembershipsFromEntry() (line 1618 of /var/www/html/sites/all/modules/ldap/ldap_servers/LdapServer.class.php).
Warning: htmlspecialchars(): Invalid multibyte sequence in argument in check_plain() (line 1545 of /var/www/html/includes/bootstrap.inc).
Warning: htmlspecialchars(): Invalid multibyte sequence in argument in check_plain() (line 1545 of /var/www/html/includes/bootstrap.inc).
Warning: htmlspecialchars(): Invalid multibyte sequence in argument in check_plain() (line 1545 of /var/www/html/includes/bootstrap.inc).
Comment #5
fbouzek commentedI applied the new dev today and the issue still exists as it did before. I believe it has something to do with the serialization of the basedn.
Comment #6
alexanderperlis commented@fbouzek, a band-aid appears here: http://drupal.org/node/1880310#comment-6926478
Comment #7
johnbarclay commentedSee #1880310: LDAP Authentication: (unknown error: 6) comment-6926478
Comment #8
jdurfer commentedUsing Drupal 7.x-19 (upgraded from clean 7.18) tried module (ldap 7.x-2.0-beta3) getting same error as described:
Warning: Invalid argument supplied for foreach() in LdapServer->groupUserMembershipsFromEntry()
(line 1594 of /var/www/html/sites/all/modules/ldap/ldap_servers/LdapServer.class.php).
Removed module (ldap 7.x-2.0-beta3) and installed the dev module (7.x-2.x-dev, with feb 18 date) with appropriate ldap db update and got similar but different error:
Warning: Invalid argument supplied for foreach() in LdapServer->groupUserMembershipsFromEntry()
(line 1665 of /san/DrupalUAT/sites/all/modules/ldap_servers/LdapServer.class.php).
I am successfully binding with DN for non-anonymous search with password stored in configuration
Not critical, but in need of functioning LDAP soon.
Comment #9
jdurfer commentedUsing 7.x-2.x-dev dated 2013-Mar-01.
"Warning: Invalid argument supplied for foreach() in LdapServer->groupUserMembershipsFromEntry() (line 1674 of/san/DrupalUAT/sites/all/modules/ldap/ldap_servers/LdapServer.class.php)."
Keep having to add code to unserialze second time. Edit the LdapServer.class.php and put in code:
// added 01 MARCH 2013////
// debug('initDerivedProperties'); debug($this->basedn);
if (!is_array($this->basedn)) {
$basedn_unserialized = @unserialize($this->basedn);
// debug('basedn_unserialized'); debug($basedn_unserialized);
$this->basedn = $basedn_unserialized;
}
//// /////
The error subsides but it would nice if we didn't have to keep making these edits on our own.
Comment #10
johnbarclay commentedI'll commit this when I get a chance to look at the larger serialization issues. Or someone else does. Its part of the general work on exportables/Features/serialization. Thanks for the nudge though.
Comment #11
johnbarclay commentedLdapServer->basedn should always be an array. In the constructor for LdapServer , LdapServer::initDerivedProperties() is always called and it sets the ->basedn property to an array. I've tweaked the code a bit to make this clearer. http://drupalcode.org/project/ldap.git/commitdiff/6c17eb074d408bdf66b6b7...
The question is still where the double serialization is occurring.
Comment #12
johnbarclay commentedHere's a modification to make sure the array is set, regardless of if its in db or not: http://drupalcode.org/project/ldap.git/commitdiff/991b8006d1f9b9b557d594...
Comment #13
johnbarclay commentedI believe this is fixed with the requirement of ctools and some error checking in LdapServer.class.php::initDerivedProperties (see http://drupalcode.org/project/ldap.git/blame/0e7e9edfddbc19b0ab30f1b6121...).
Can someone who's had this problem before, please try to replicate it?
Comment #14
johnbarclay commentedComment #15
johnbarclay commentedThis is clearly a duplicate of #1903014: ldap_server_get_servers: $this->basedn is not unserialized which I'm working on testing and committting now with an update hook.
Comment #15.0
johnbarclay commentedtest result