mysql_user: make sure current_pass_hash is a string before using it in comparison (#64059)

* make sure current_pass_hash is a string before using it in comparison

* add changelogs/fragments file

* fix changelogs/fragments file: it is actually a bugfix, not a minor change
This commit is contained in:
Roman Haefeli 2020-01-24 19:32:15 +01:00 committed by jctanner
parent 9df9ed4cd3
commit 4d1e21bf18
2 changed files with 4 additions and 0 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- mysql_user - make sure current_pass_hash is a string before using it in comparison (https://github.com/ansible/ansible/issues/60567).

View file

@ -390,6 +390,8 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
FROM mysql.user WHERE user = %%s AND host = %%s
""" % (colA[0], colA[0], colB[0], colB[0]), (user, host))
current_pass_hash = cursor.fetchone()[0]
if isinstance(current_pass_hash, bytes):
current_pass_hash = current_pass_hash.decode('ascii')
if encrypted:
encrypted_password = password