Fixed an issue where if LDAP_SEARCH_BASE_DN is not set then, the value for LDAP_BASE_DN will be considered. Fixes #5487

This commit is contained in:
Khushboo Vashi 2020-05-18 12:35:34 +05:30 committed by Akshay Joshi
parent 9f445dc052
commit d1bdb178e2
3 changed files with 12 additions and 5 deletions

View File

@ -45,10 +45,15 @@ file and modify the values for the following parameters:
entries, you should be able to authenticate by entering admin in the 
*Email Address / Username* field and its corresponding password in the *Password* 
field."
"LDAP_SEARCH_BASE_DN","Specifies an element of the search request that works in
conjunction with the LDAP search scope to define the subtree of entries that
should be considered when processing the search request. You can use this parameter
for limiting the search request to a specific group of users."
"LDAP_SEARCH_BASE_DN","Specifies the distinguished name (DN) for the top-most user
directory that you want to search. You can use this parameter for limiting the search
request to a specific group of users. For example, if you want to search only within
the Organizational Unit named sales, you can define the value for LDAP_SEARCH_BASE_DN
parameter as following:
LDAP_SEARCH_BASE_DN = ou=sales,dc=example,dc=com'
This is an optional parameter. If you do not specify any value for LDAP_SEARCH_BASE_DN,
then the value for LDAP_BASE_DN will be considered for the same."
"LDAP_SEARCH_FILTER","Defines the criteria to retrieve matching entries in an
LDAP search request. For example, LDAP_SEARCH_FILTER = '(objectclass=HR) setting
searches only for users having HR as their objectClass attribute."

View File

@ -43,5 +43,6 @@ Bug fixes
| `Issue #5469 <https://redmine.postgresql.org/issues/5469>`_ - Fixed an issue where select2 hover is inconsistent for the SSL field in create server dialog.
| `Issue #5473 <https://redmine.postgresql.org/issues/5473>`_ - Fixed post-login redirect location when running in server mode under a non-default root.
| `Issue #5480 <https://redmine.postgresql.org/issues/5480>`_ - Fixed an issue where the background job creation fails if there is only a version-specific python binary available in PATH.
| `Issue #5487 <https://redmine.postgresql.org/issues/5487>`_ - Fixed an issue where if LDAP_SEARCH_BASE_DN is not set then, the value for LDAP_BASE_DN will be considered.
| `Issue #5503 <https://redmine.postgresql.org/issues/5503>`_ - Clarify and correct the docs on enabling the pl/debugger plugin on the server.
| `Issue #5510 <https://redmine.postgresql.org/issues/5510>`_ - Fixed Unicode decode error 'utf-8' codec can't decode byte.

View File

@ -158,7 +158,8 @@ class LDAPAuthentication(BaseAuthentication):
search criteria."""
try:
search_base_dn = config.LDAP_SEARCH_BASE_DN
if search_base_dn is None or search_base_dn == '':
if search_base_dn is None or search_base_dn == '' or\
search_base_dn == '<Search-Base-DN>':
search_base_dn = config.LDAP_BASE_DN
self.conn.search(search_base=search_base_dn,
search_filter=config.LDAP_SEARCH_FILTER,