From: Noel Power Date: Thu, 17 May 2018 14:23:38 +0000 (+0100) Subject: python/samba/netcmd: fix py2/py3 bytes usage for replace X-Git-Tag: ldb-1.5.0~296 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=352eee57ae0b3cd48ea8bab33d483812d57b8efd;p=thirdparty%2Fsamba.git 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 --- 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)