python/samba: Fix incorrect encode of password
authorNoel Power <noel.power@suse.com>
Mon, 14 May 2018 12:38:20 +0000 (13:38 +0100)
committerNoel Power <npower@samba.org>
Thu, 17 May 2018 09:31:28 +0000 (11:31 +0200)
commit7102732b25dfcd5e6815159e3043eed240e918d3
treefa74219c5ec0acbb199da2eea910aa7d6f135c9c
parentb28b6a4565870ac402b3678b4eecfe8e30fb0a73
python/samba: Fix incorrect encode of password

In python2 you can encode a 'str' type which doesn't really make sense
since it is already bytes (as such). In python3 this isn't possible you
can't encode bytes or decode strings. Also because you can call encode
on 'str' in python2 it tries to to what you wanted and it implicity
calls decode('ascii') before performing the encode. This is why we get
mention of ascii codec in the error. This patch should future proof for
python3 also.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13435
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/samdb.py