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-26 12:43:47 +02:00
committed by Tomas Krizek
parent d39456a882
commit 71a8026496
+1 -1
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()