1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-23 00:23:53 +03:00

gp: Use read_file() instead of readfp()

readfp() is deprecated and could be removed in a future version of
Python.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton
2023-08-29 16:30:08 +12:00
committed by Andrew Bartlett
parent 34042677b7
commit 2b566979ac
3 changed files with 8 additions and 8 deletions

View File

@@ -2358,9 +2358,9 @@ PasswordComplexity Password must meet complexity requirements
inf_data.optionxform=str
raw = conn.loadfile(inf_file)
try:
inf_data.readfp(StringIO(raw.decode()))
inf_data.read_file(StringIO(raw.decode()))
except UnicodeDecodeError:
inf_data.readfp(StringIO(raw.decode('utf-16')))
inf_data.read_file(StringIO(raw.decode('utf-16')))
except NTSTATUSError as e:
if e.args[0] == NT_STATUS_ACCESS_DENIED:
raise CommandError("The authenticated user does "
@@ -2453,9 +2453,9 @@ samba-tool gpo manage security list {31B2F340-016D-11D2-945F-00C04FB984F9}
inf_data.optionxform=str
raw = conn.loadfile(inf_file)
try:
inf_data.readfp(StringIO(raw.decode()))
inf_data.read_file(StringIO(raw.decode()))
except UnicodeDecodeError:
inf_data.readfp(StringIO(raw.decode('utf-16')))
inf_data.read_file(StringIO(raw.decode('utf-16')))
except NTSTATUSError as e:
if e.args[0] in [NT_STATUS_OBJECT_NAME_INVALID,
NT_STATUS_OBJECT_NAME_NOT_FOUND,