py3: pass raw entries to LDIFWriter

LDIFWriter.unparse() expects the scalar values of the attributes
of the entries to be bytes as it applies a byte regular expression
to check whether to base64-encode the values or not. Previously,
we were passing the scalar attribute values as strings which
was breaking the LDIFWriter.unparse() exectution.

https://pagure.io/freeipa/issue/7131

Reviewed-By: Felipe Barreto <fbarreto@redhat.com>
This commit is contained in:
Stanislav Laznicka 2017-10-20 15:32:34 +02:00 committed by Tomas Krizek
parent d39456a882
commit 71a8026496
No known key found for this signature in database
GPG Key ID: 22A2A94B5E49415A

View File

@ -1045,7 +1045,7 @@ def _entries_to_ldif(entries):
io = StringIO()
writer = LDIFWriter(io)
for entry in entries:
writer.unparse(str(entry.dn), dict(entry))
writer.unparse(str(entry.dn), dict(entry.raw))
return io.getvalue()