mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
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 <noel.power@suse.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
parent
e915d18e55
commit
352eee57ae
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user