]> git.ipfire.org Git - thirdparty/samba.git/commit
gpo: Properly decode utf-8/16 inf files from bytes
authorDavid Mulder <dmulder@suse.com>
Mon, 6 Jul 2020 14:13:57 +0000 (08:13 -0600)
committerDavid Mulder <dmulder@samba.org>
Thu, 6 Aug 2020 16:38:36 +0000 (16:38 +0000)
commit0f3066abbb1b65e9cde8df9499483bf0768c273e
tree55b1178224a482f241892936794d71dc7d721ec3
parent70a38eb5485bf82bf068aa3fbcb3cf799ff9ddff
gpo: Properly decode utf-8/16 inf files from bytes

This code was python 2 specific (string handling
has changed dramatically in python 3), and didn't
correctly decode utf-16 in python3. We should
instead read the file as bytes, then attempt a
utf-8 decode (the default), and try utf-16 if
encountering a decode failure.
The existing code actually throws an exception on
the initial file read when the data is utf-16,
since it tries to decode the bytes to a utf-8
string.

Signed-off-by: David Mulder <dmulder@suse.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/gpclass.py
selftest/knownfail.d/gpo [deleted file]