-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LDAP Plugin - Call to a member function dn() on bool #270
Comments
I would suggest the following: diff --git a/auth-ldap/authentication.php b/auth-ldap/authentication.php
index 69715ec..20aa6b3 100644
--- a/auth-ldap/authentication.php
+++ b/auth-ldap/authentication.php
@@ -238,7 +238,7 @@ class LDAPAuthentication {
$schema['lookup']),
array('sizelimit' => 1)
);
- if (PEAR::isError($r) || !$r->count())
+ if (PEAR::isError($r) || !$r->count() || !$r->current())
return null;
// Attempt to bind as the DN of the user looked up with the password This is because To test this go to the database, go to the plugin table, find the record for LDAP, set Once you do this you can make the changes to the plugin files manually and test the changes. You may need to restart Apache and PHP-FPM (if you're running it) to clear any file cache. Cheers. |
Thanks for your reply, @JediKev . If $r->count() returns 1, the user entry was found in LDAP, right? But how can I now access its dn without using current()? I don't fully understand what's inside $r, so I can't 'extract' the needed information by myself. Best |
Not necessarily, it uses a "_count_cache" so that count could be cached from previous attempts, etc. Also, the Regardless, my patch above still stands as like I said Also, I don't even get to that part in my auth attempts. My connection goes through the typical diff --git a/auth-ldap/authentication.php b/auth-ldap/authentication.php
index 69715ec..3f2aa08 100644
--- a/auth-ldap/authentication.php
+++ b/auth-ldap/authentication.php
@@ -223,6 +223,7 @@ class LDAPAuthentication {
$r = $c->bind($dn, $password);
if (!PEAR::isError($r))
return $this->lookupAndSync($username, $dn);
+ error_log(print_r($r, true));
// Another effort is to search for the user
if (!$this->_bind($c)) Cheers. |
Hi,
I,m using
osTicket v1.17.3 (ca95150)
Apache
MySQL 10.11.2
PHP 8.1.17
389ds on Port 636 (SSL)
I configured the LDAP-Plugin to use the 389ds as LDAP-Source.
Szene1: wrong username & password
[x] working like expected: Access denied
Szene2: correct username & wrong|correct password
[ ] error: stuck at loading spinner on the login screen
So I took a look. tcpdump shows package transfer on the ldap-server. Cool
Webserver Error Log shows:
"
PHP Fatal error: Uncaught Error: Call to a member function dn() on bool in phar:///srv/www/htdocs/osTicket/include/plugins/auth-ldap.phar/authentication.php:246
"Ok. Downloaded the latest dev version of the ldap plugin. Build phar file and stored it into the plugin folder. Same result.
After some tests I assume the error the stick between
$r = $c->search(...)
and$bound = $c->bind($r->current()->dn(), $password);
The plugin fetches the user entry, but $r->current() is empty, Therefore the users dn is unknown ab the plugin is unable to check the password.
@JediKev already adresses a kinda similar error, but not exactly this in #260
How do I fix it, so the bind will work?
If you need any further log output, I'm hopefully able to generate and post it.
Best
Zebbo
The text was updated successfully, but these errors were encountered: