From 352eee57ae0b3cd48ea8bab33d483812d57b8efd Mon Sep 17 00:00:00 2001 From: Noel Power Date: Thu, 17 May 2018 15:23:38 +0100 Subject: [PATCH] python/samba/netcmd: fix py2/py3 bytes usage for replace base64.b64encode returns bytes in py3 make sure associated replace uses 'b' for strings passed to replace Signed-off-by: Noel Power Reviewed-by: Andreas Schneider Reviewed-by: Douglas Bagnall --- python/samba/netcmd/user.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/samba/netcmd/user.py b/python/samba/netcmd/user.py index f211b5158ce..2131c68a0c7 100644 --- a/python/samba/netcmd/user.py +++ b/python/samba/netcmd/user.py @@ -119,7 +119,7 @@ def get_crypt_value(alg, utf8pw, rounds=0): # we can ignore the possible == at the end # of the base64 string # we just need to replace '+' by '.' - b64salt = base64.b64encode(salt)[0:16].replace('+', '.').decode('utf8') + b64salt = base64.b64encode(salt)[0:16].replace(b'+', b'.').decode('utf8') crypt_salt = "" if rounds != 0: crypt_salt = "$%s$rounds=%s$%s$" % (alg, rounds, b64salt)