ldap_search: switch off client-chasing referrals (#1618)

* switch off client-chasing referrals

* Add changelog fragment

* Add comment to module

* Sanity check

* Update changelogs/fragments/1618-ldap_search-switch-off-cheasing-referrals.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Add module ref_chasing param to ldap module_utils

* test acces token gitlab

* test acces token gitlab: revert

* Complete referrals_chasing parameter documentation

* Fix parameter value check

* Fix issue #963

* fix sanity check

* Update plugins/doc_fragments/ldap.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update changelogs/fragments/1618-ldap_search-switch-off-cheasing-referrals.yaml

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/doc_fragments/ldap.py

Co-authored-by: Felix Fontein <felix@fontein.de>

Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Mickael Foucher <mikael.foucher@groupama.com>
This commit is contained in:
flammike 2021-01-27 07:56:07 +01:00 committed by GitHub
parent bb323ab12f
commit cd022c3e2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 4 deletions

View file

@ -168,10 +168,14 @@ class LdapSearch(LdapGeneric):
attrlist=self.attrlist,
attrsonly=self.attrsonly
)
if self.schema:
return [dict(dn=result[0], attrs=list(result[1].keys())) for result in results]
else:
return [_extract_entry(result[0], result[1]) for result in results]
ldap_entries = []
for result in results:
if isinstance(result[1], dict):
if self.schema:
ldap_entries.append(dict(dn=result[0], attrs=list(result[1].keys())))
else:
ldap_entries.append(_extract_entry(result[0], result[1]))
return ldap_entries
except ldap.NO_SUCH_OBJECT:
self.module.fail_json(msg="Base not found: {0}".format(self.dn))