?
avatar oantby
oantby
12 Feb 2021

Steps to reproduce the issue

  1. Enable LDAP authentication with bind-as-user
  2. leave the search_string parameter empty.
  3. Attempt to log in with correct password as valid but unauthorized (i.e. not created in Joomla!) user.
  4. If php errors are set to print, an error will appear with the authentication box. Otherwise, the error may appear only in a log.

Error log indicates:

Warning: ldap_search(): Search: Bad search filter in /opt/app-root/src/libraries/vendor/joomla/ldap/src/LdapClient.php on line 418

Note: valid login will also emit this error, but will only be in log, where this method can display to the screen, given correct configuration.

Expected result

"You do not have access to the x section of this site."

Actual result

"You do not have access to the x section of this site.
Warning: ldap_search(): Search: Bad search filter in /opt/app-root/src/libraries/vendor/joomla/ldap/src/LdapClient.php on line 418"

System information (as much as possible)

Running in docker with Apache + PHP 7.4, display_errors on (default), ldap module enabled in apache.

Additional comments

This issue is caused by the bind mode still using the search_string
I've considered/explore two main options towards fixing this:

  1. Simply updating the description of search_string to remove the indication that it is for search only, potentially adding indication that it is used to get user information after bind.
  2. Updating the actual functionality to filter based on something like ldap_uid, as it is a field that has a default and is therefore never empty (theoretically), and is described as being exactly the field that would properly define a valid filter given the username.

I lean toward option 2, as it drops the need for a user to enter, effectively, the same attribute twice in configuration.

I can/will submit a pull request to that effect.

I do know/understand that this module is deprecated, but saw such a small issue as worth fixing.

avatar oantby oantby - open - 12 Feb 2021
avatar joomla-cms-bot joomla-cms-bot - change - 12 Feb 2021
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 12 Feb 2021
avatar richard67 richard67 - change - 12 Feb 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-02-12 16:42:10
Closed_By richard67
avatar richard67 richard67 - close - 12 Feb 2021
avatar richard67
richard67 - comment - 12 Feb 2021

Closing as having a pull request.

@oantby Thanks for reporting the issue and making the pull request. Just a hint to save you some work in future in case if you want to contribute more often: If you know that you will make a pull request, it doesn't need to open an issue, too. The pull request will be enough, it includes the issue, so to say.

Add a Comment

Login with GitHub to post a comment