Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

values need to be bytes when writing back to ldap #48666

Merged
merged 16 commits into from
Oct 1, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions salt/modules/ldap3.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,19 +572,16 @@ def change(connect_spec, dn, before, after):
# convert the "iterable of values" to lists in case that's what
# modifyModlist() expects (also to ensure that the caller's dicts
# are not modified)
before = dict(((attr, list(vals))
before = dict(((attr, salt.utils.data.encode(vals))
for attr, vals in six.iteritems(before)))
after = dict(((attr, list(vals))
after = dict(((attr, salt.utils.data.encode(vals))
angeloudy marked this conversation as resolved.
Show resolved Hide resolved
for attr, vals in six.iteritems(after)))

if 'unicodePwd' in after:
after['unicodePwd'] = [_format_unicode_password(x) for x in after['unicodePwd']]

modlist = salt.utils.data.decode(
ldap.modlist.modifyModlist(before, after),
to_str=True,
preserve_tuples=True
)
modlist = ldap.modlist.modifyModlist(before, after)

try:
l.c.modify_s(dn, modlist)
except ldap.LDAPError as e:
Expand Down