1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

ldap_search: make sure to also handle binary strings in Python 3 (#7264)

Make sure to also handle binary strings in Python 3.
This commit is contained in:
Felix Fontein 2023-09-15 19:01:32 +02:00 committed by GitHub
parent e7ff0acdac
commit fc530cd3f5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -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)."

View file

@ -120,7 +120,7 @@ import traceback
from ansible.module_utils.basic import AnsibleModule, missing_required_lib 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.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 from ansible_collections.community.general.plugins.module_utils.ldap import LdapGeneric, gen_specs, ldap_required_together
LDAP_IMP_ERR = None LDAP_IMP_ERR = None
@ -159,7 +159,7 @@ def main():
def _normalize_string(val, convert_to_base64): def _normalize_string(val, convert_to_base64):
if isinstance(val, string_types): if isinstance(val, (string_types, binary_type)):
if isinstance(val, text_type): if isinstance(val, text_type):
val = to_bytes(val, encoding='utf-8') val = to_bytes(val, encoding='utf-8')
if convert_to_base64: if convert_to_base64: