1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-21 20:59:10 +00:00
community.general/plugins
Emmanuel Benoît 0e4783dcc3
Binary attribute support for ldap_attrs and ldap_entry (#11558)
* Binary attribute support for `ldap_attrs` and `ldap_entry`

This commit implements binary attribute support for the `ldap_attrs` and
`ldap_entry` plugins. This used to be "supported" before, because it was
possible to simply load arbitrary binary data into the attributes, but
no longer functions on recent Ansible versions.

In order to support binary attributes, this commit introduces two new
options to both plugins:

  * `binary_attributes`, a list of attribute names which will be
    considered as being binary,
  * `honor_binary_option`, a flag which is true by default and will
    handle all attributes that include the binary option (see RFC 4522)
    as binary automatically.

When an attribute is determined to be binary through either of these
means, the plugin will assume that the attribute's value is in fact
base64-encoded. It will proceed to decode it and handle it accordingly.

While changes to `ldap_entry` are pretty straightforward, more work was
required on `ldap_attrs`.

  * First, because both `present` and `absent` state require checking
    the attribute's current values and normally do that using LDAP search
    queries for each value, a specific path for binary attributes was
    added that loads and caches all values for the attribute and compares
    the values in the Python code.
  * In addition, generating both the modlist and the diff output require
    re-encoding binary attributes' values into base64 so it can be
    transmitted back to Ansible.

* Various fixes on `ldap_attrs`/`ldap_entry` from PR 11558 discussion

* Rename `honor_binary_option` to `honor_binary`

* Add some general documentation about binary attributes

* Fix changelog fragment after renaming one of the new options

* Add examples of `honor_binary` and `binary_attributes`

* Add note that indicates that binary values are supported from 12.5.0+

* Fix punctuation

* Add links to RFC 4522 to `ldap_attrs` and `ldap_entry`

* Catch base64 decoding errors

* Rephrase changelog fragment

* Use f-string to format the encoding error message
2026-03-12 21:31:37 +01:00
..
action Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
become doas: allow to explicitly enable pipelining (#11481) 2026-03-12 21:13:02 +01:00
cache Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00
callback Add missing __future__ imports (#11567) 2026-03-11 06:42:08 +01:00
connection Add option for wsl_shell_type, protect wsl.exe arguments if SSH shell is Powershell (#11308) 2026-01-16 21:07:11 +01:00
doc_fragments New module icinga2_downtime (#11462) 2026-02-23 05:38:54 +01:00
filter Add missing __future__ imports (#11567) 2026-03-11 06:42:08 +01:00
inventory fix: remove HTTPStatus constructs introduced in Python 3.11 (#11573) 2026-03-12 20:46:55 +01:00
lookup Add missing __future__ imports (#11567) 2026-03-11 06:42:08 +01:00
module_utils fix: remove HTTPStatus constructs introduced in Python 3.11 (#11573) 2026-03-12 20:46:55 +01:00
modules Binary attribute support for ldap_attrs and ldap_entry (#11558) 2026-03-12 21:31:37 +01:00
plugin_utils Add missing __future__ imports (#11567) 2026-03-11 06:42:08 +01:00
test Sort imports with ruff check --fix (#11400) 2026-01-09 07:40:58 +01:00