Skip to content

Instantly share code, notes, and snippets.

@redivy
Created May 14, 2010 14:09
Show Gist options
  • Save redivy/401199 to your computer and use it in GitHub Desktop.
Save redivy/401199 to your computer and use it in GitHub Desktop.
--- /srv/www/htdocs/oid/ldap.php 2010-05-14 18:07:21.052379981 +0400
+++ /srv/www/htdocs/oid/ldap.php 2010-05-14 18:07:08.364395397 +0400
@@ -28,7 +28,7 @@
'password' => 'a897755cdbd28f93eccd3023325ac55b',
# User account
#'testdn' => 'cn=%s,cn=users,dc=domain,dc=local',
- 'testdn' => 'uid=%s,ou=admins,ou=adusers,ou=users,o=scalaxy',
+ 'testdn' => array('uid=%s,ou=admins,ou=adusers,ou=users,o=scalaxy', 'uid=%s,ou=sysarch,ou=adusers,ou=users,o=scalaxy'),
# Searching data
#'searchdn' => 'cn=users,dc=domain,dc=local',
#'searchdn' => 'ou=web-access,ou=groups,ou=scalaxy,ou=sites,o=oversun',
@@ -114,8 +114,10 @@
ldap_set_option($ds,LDAP_OPT_PROTOCOL_VERSION,$ldap['protocol']);
if ($ldap['isad'] == true) ldap_set_option($ds,LDAP_OPT_REFERRALS,0);
- if (ldap_bind($ds,sprintf($ldap['testdn'],$username),$password)) $no = "ok";
- ldap_close($ds);
+ foreach($ldap['testdn'] as $test_dn) {
+ if (ldap_bind($ds,sprintf($test_dn,$username),$password)) $no = "ok";
+ }
+ ldap_close($ds);
}
}
return $no;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment