Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Created seperate bind wrapper function

  • Loading branch information...
commit ea97f85ffa73323f6e106d3796b7a48f00f33110 1 parent 22636c2
@craig552uk authored
Showing with 14 additions and 1 deletion.
  1. +14 −1 lib-ldap.php
View
15 lib-ldap.php
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.