Skip to content

Commit

Permalink
mysql_user: make sure current_pass_hash is a string before using it i…
Browse files Browse the repository at this point in the history
…n comparison (ansible#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
  • Loading branch information
reduzent authored and jctanner committed Jan 24, 2020
1 parent 9df9ed4 commit 4d1e21b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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).
2 changes: 2 additions & 0 deletions lib/ansible/modules/database/mysql/mysql_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4d1e21b

Please sign in to comment.