Permalink
Browse files

Created seperate bind wrapper function

  • Loading branch information...
1 parent 22636c2 commit ea97f85ffa73323f6e106d3796b7a48f00f33110 @craig552uk committed Jan 16, 2011
Showing with 14 additions and 1 deletion.
  1. +14 −1 lib-ldap.php
View
@@ -16,7 +16,7 @@ function my_ldap_connect(){
ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, $ldap_server['protocol_version']);
// Bind to LDAP server
- $bind = ldap_bind($conn, $ldap_server['bind_rdn'], $ldap_server['bind_pass']);
+ $bind = my_ldap_bind($conn);
if ($bind) {
return $conn;
@@ -25,6 +25,19 @@ function my_ldap_connect(){
return false;
}
+/*
+ Bind as user deifned in settings.php
+
+ @param resource LDAP connection resource
+
+ If successful return true
+ Otherwise return false
+*/
+function my_ldap_bind($conn){
+ global $ldap_server;
+ return ldap_bind($conn, $ldap_server['bind_rdn'], $ldap_server['bind_pass']);
+}
+
/*
Search LDAP directory

0 comments on commit ea97f85

Please sign in to comment.