laurent review

This commit is contained in:
Matthieu Bourgain 2024-04-23 13:53:54 +02:00
commit ea8d348391
No known key found for this signature in database
GPG key ID: 33BA95C808890C39
2 changed files with 1 additions and 23 deletions

View file

@ -190,8 +190,6 @@ def user_add(cursor, user, host, host_all, password, encrypted,
elif salt:
if plugin in ['caching_sha2_password', 'sha256_password']:
generated_hash_string = mysql_sha256_password_hash_hex(password=plugin_auth_string, salt=salt)
else:
module.fail_json(msg="salt not handled for %s authentication plugin" % plugin)
query_with_args = ("CREATE USER %s@%s IDENTIFIED WITH %s AS 0x" + generated_hash_string), (user, host, plugin)
else:
query_with_args = "CREATE USER %s@%s IDENTIFIED WITH %s BY %s", (user, host, plugin, plugin_auth_string)
@ -358,8 +356,6 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
if plugin in ['caching_sha2_password', 'sha256_password']:
if current_plugin[1] != mysql_sha256_password_hash(password=plugin_auth_string, salt=salt):
update = True
else:
module.fail_json(msg="salt not handled for %s authentication plugin" % plugin)
elif plugin_auth_string and current_plugin[1] != plugin_auth_string:
# this case can cause more updates than expected,
# as plugin can hash auth_string in any way it wants
@ -377,8 +373,6 @@ def user_mod(cursor, user, host, host_all, password, encrypted,
elif salt:
if plugin in ['caching_sha2_password', 'sha256_password']:
generated_hash_string = mysql_sha256_password_hash_hex(password=plugin_auth_string, salt=salt)
else:
module.fail_json(msg="salt not handled for %s authentication plugin" % plugin)
query_with_args = ("ALTER USER %s@%s IDENTIFIED WITH %s AS 0x" + generated_hash_string), (user, host, plugin)
else:
query_with_args = "ALTER USER %s@%s IDENTIFIED WITH %s BY %s", (user, host, plugin, plugin_auth_string)