1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-11 16:58:40 +03:00

gp_inf: Read/write files with a UTF-16LE BOM in GptTmpl.inf

Regression caused by 16596842a62bec0a9d974c48d64000e3c079254e

[MS-GPSB] 2.2 Message Syntax says that you have to write a BOM which I
didn't do up until this patch. UTF-16 as input encoding was marked much
higher up in the inheritance tree, which got overriden with the Python 3
fixes. I've now marked the encoding much more obviously for this file.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14004

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>

Autobuild-User(master): Gary Lockyer <gary@samba.org>
Autobuild-Date(master): Fri Jul 19 02:20:47 UTC 2019 on sn-devel-184
This commit is contained in:
Garming Sam 2019-07-18 14:50:57 +12:00 committed by Gary Lockyer
parent b0fc1ca65a
commit 0bcfc550b1
2 changed files with 6 additions and 3 deletions

View File

@ -29,11 +29,11 @@ from samba.gp_parse import GPParser
# [MS-GPSB] Security Protocol Extension
class GptTmplInfParser(GPParser):
sections = None
encoding = 'utf-16le'
encoding = 'utf-16'
output_encoding = 'utf-16le'
class AbstractParam:
__metaclass__ = ABCMeta
encoding = 'utf-16le'
def __init__(self):
self.param_list = []
@ -333,7 +333,10 @@ class GptTmplInfParser(GPParser):
def write_binary(self, filename):
with codecs.open(filename, 'wb+',
self.encoding) as f:
self.output_encoding) as f:
# Write the byte-order mark
f.write(u'\ufeff')
for s in self.sections:
self.sections[s].write_section(s, f)