Skip to content

Commit

Permalink
ldap_search: make sure to also handle binary strings in Python 3 (ans…
Browse files Browse the repository at this point in the history
…ible-collections#7264)

Make sure to also handle binary strings in Python 3.
  • Loading branch information
felixfontein authored and Eric Trombly committed Oct 25, 2023
1 parent 35fe5b0 commit 33add86
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/7264-ldap_search-strings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "ldap_search - fix string normalization and the ``base64_attributes`` option on Python 3 (https://github.com/ansible-collections/community.general/issues/5704, https://github.com/ansible-collections/community.general/pull/7264)."
4 changes: 2 additions & 2 deletions plugins/modules/ldap_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@

from ansible.module_utils.basic import AnsibleModule, missing_required_lib
from ansible.module_utils.common.text.converters import to_bytes, to_native, to_text
from ansible.module_utils.six import string_types, text_type
from ansible.module_utils.six import binary_type, string_types, text_type
from ansible_collections.community.general.plugins.module_utils.ldap import LdapGeneric, gen_specs, ldap_required_together

LDAP_IMP_ERR = None
Expand Down Expand Up @@ -159,7 +159,7 @@ def main():


def _normalize_string(val, convert_to_base64):
if isinstance(val, string_types):
if isinstance(val, (string_types, binary_type)):
if isinstance(val, text_type):
val = to_bytes(val, encoding='utf-8')
if convert_to_base64:
Expand Down

0 comments on commit 33add86

Please sign in to comment.