From ea9b7d41e77714942874e4608e9414c42372c440 Mon Sep 17 00:00:00 2001 From: Heinz Hoelzl Date: Thu, 10 Oct 2019 10:14:15 +1300 Subject: [PATCH] samba-tool: py3 compatiblity in 'user syncpasswords --daemon' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BUG: https://bugzilla.samba.org/show_bug.cgi?id=14154 Signed-off-by: Heinz Hölzl Reviewed-by: Douglas Bagnall --- python/samba/netcmd/user.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py index 8ead8e583f3..c22b2b35b33 100644 --- a/python/samba/netcmd/user.py +++ b/python/samba/netcmd/user.py @@ -54,7 +54,7 @@ from samba.netcmd import ( SuperCommand, Option, ) -from samba.compat import text_type +from samba.compat import text_type, PY3 from samba.compat import get_bytes from samba.compat import get_string @@ -1998,7 +1998,11 @@ samba-tool user syncpasswords --terminate \\ assert res is None input = "%s" % (ldif) - reply = sync_command_p.communicate(input)[0] + if PY3: + reply = sync_command_p.communicate( + input.encode('utf-8'))[0].decode('utf-8') + else: + reply = sync_command_p.communicate(input)[0] log_msg("%s\n" % (reply)) res = sync_command_p.poll() if res is None: -- 2.20.1