
LDAP integration for Gallery
The famous online gallery system Gallery has a straightforward install on a LAMP server but getting LDAP to integrate for authentication can have some issues. Following notes are from Sheldon Bradshaw
Issue: No formal LDAP
Using a user-posted hack found at http://codex.gallery2.org/LDAP_authentication, I got it working.
1. Replaced userlogin.inc (original zipped in place)
2. Made the following changes to work with our LDAP:
Line 106
$ret = $user->create($username);
Replace with
$ret = $user->create($form[‘username’]);
Line 229-233
$ldap = array(‘ldaphost’ => ‘ldap://ldap.domain.com’,
‘domain’ => ‘domain.com’,
‘dn’ => ‘ou=Users,dc=domain,dc=com’,
‘binduser’ => ‘CN=Proxy,ou=Users,dc=domain,dc=com’,
‘bindpass’ => ‘proxypassword’
Replace with
$ldap = array(‘ldaphost’ => ‘ldap://odm.wab.edu’,
‘domain’ => ‘wab.edu’,
‘dn’ => ‘cn=users,dc-odm,dc=wab,dc=edu’,
‘binduser’ => ”,
‘bindpass’ => ”
Line 249
$ldapSearchResult = ldap_search($ldapconn, $ldap[‘dn’], “(sAMAccountName=”.$username.”)” , array( “*” ));
Replace with
$ldapSearchResult = ldap_search($ldapconn, $ldap[‘dn’], “(UID=”.$username.”)” , array( “*” ));