Skip to content

Instantly share code, notes, and snippets.

@subharanjanm
Last active August 29, 2015 14:22
Show Gist options
  • Save subharanjanm/1bd560ad9f3ad92489b1 to your computer and use it in GitHub Desktop.
Save subharanjanm/1bd560ad9f3ad92489b1 to your computer and use it in GitHub Desktop.
Active Directory Integration - Authentication failed issue - uid - loginattr - adLDAP
From b5818c205b382c001867a6ee5bd811cbe745f5cb Mon Sep 17 00:00:00 2001
From: Subharanjan Mantri <[email protected]>
Date: Thu, 28 May 2015 14:15:44 +0530
Subject: [PATCH] Quick Fix for the LDAP id issue while authentication in
adLDAP.
---
.../plugins/active-directory-integration/ad_ldap/adLDAP.php | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/wp-content/plugins/active-directory-integration/ad_ldap/adLDAP.php b/wp-content/plugins/active-directory-integration/ad_ldap/adLDAP.php
index abf09a2..db1c013 100644
--- a/wp-content/plugins/active-directory-integration/ad_ldap/adLDAP.php
+++ b/wp-content/plugins/active-directory-integration/ad_ldap/adLDAP.php
@@ -486,7 +486,10 @@ class adLDAP {
// Bind as the user
$ret = true;
- $this->_bind = @ldap_bind($this->_conn, $username . $this->_account_suffix, $password);
+
+ // $this->_bind = @ldap_bind($this->_conn, $username . $this->_account_suffix, $password);
+ $this->_bind = @ldap_bind($this->_conn, 'uid=' . $username . ',' . $this->_base_dn, $password); /* fix for uid */
+
if (!$this->_bind){ $ret = false; }
// Once we've checked their details, kick back into admin mode if we have it
@@ -1213,7 +1216,8 @@ class adLDAP {
$filter="userPrincipalName=".$username;
}
else {
- $filter="samaccountname=".$username;
+ // $filter="samaccountname=".$username;
+ $filter="uid=".$username; /* fix for uid */
}
$filter = "(&(objectCategory=person)({$filter}))";
if ($fields===NULL){ $fields=array("samaccountname","mail","memberof","department","displayname","telephonenumber","primarygroupid","objectsid"); }
--
2.2.1
From 1ba5b78ab2c177a208d2bd297e693a31a620f85c Mon Sep 17 00:00:00 2001
From: Subharanjan Mantri <[email protected]>
Date: Thu, 28 May 2015 16:54:01 +0530
Subject: [PATCH] Fix for getting data from LDAP
---
wp-content/plugins/active-directory-integration/ad_ldap/adLDAP.php | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/wp-content/plugins/active-directory-integration/ad_ldap/adLDAP.php b/wp-content/plugins/active-directory-integration/ad_ldap/adLDAP.php
index db1c013..025ac48 100644
--- a/wp-content/plugins/active-directory-integration/ad_ldap/adLDAP.php
+++ b/wp-content/plugins/active-directory-integration/ad_ldap/adLDAP.php
@@ -1219,7 +1219,10 @@ class adLDAP {
// $filter="samaccountname=".$username;
$filter="uid=".$username; /* fix for uid */
}
- $filter = "(&(objectCategory=person)({$filter}))";
+
+ // $filter = "(&(objectCategory=person)({$filter}))";
+ $filter = "({$filter})"; /* fix for data */
+
if ($fields===NULL){ $fields=array("samaccountname","mail","memberof","department","displayname","telephonenumber","primarygroupid","objectsid"); }
if (!in_array("objectsid",$fields)){
$fields[] = "objectsid";
--
2.2.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment