From 1df6442b81c7df153c3807f53fee9f4682704e71 Mon Sep 17 00:00:00 2001 From: Hubertus Krogmann Date: Tue, 13 Sep 2022 16:37:57 +0200 Subject: [PATCH] MySLQ is using identified with auth_pam by ... instead of identified with pam using ... like mariadb does --- plugins/module_utils/user.py | 8 ++++---- plugins/modules/mysql_user.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plugins/module_utils/user.py b/plugins/module_utils/user.py index dfd97f0..0ac79a2 100644 --- a/plugins/module_utils/user.py +++ b/plugins/module_utils/user.py @@ -170,8 +170,8 @@ def user_add(cursor, user, host, host_all, password, encrypted, elif plugin and plugin_hash_string: query_with_args = "CREATE USER %s@%s IDENTIFIED WITH %s AS %s", (user, host, plugin, plugin_hash_string) elif plugin and plugin_auth_string: - # Mysql and MariaDB differ in naming pam plugin - if plugin == 'pam' or plugin == 'auth_pam': + # Mysql and MariaDB differ in naming pam plugin and Syntax to set it + if plugin == 'pam': query_with_args = "CREATE USER %s@%s IDENTIFIED WITH %s USING %s", (user, host, plugin, plugin_auth_string) else: query_with_args = "CREATE USER %s@%s IDENTIFIED WITH %s BY %s", (user, host, plugin, plugin_auth_string) @@ -309,8 +309,8 @@ def user_mod(cursor, user, host, host_all, password, encrypted, if plugin_hash_string: query_with_args = "ALTER USER %s@%s IDENTIFIED WITH %s AS %s", (user, host, plugin, plugin_hash_string) elif plugin_auth_string: - # Mysql and MariaDB differ in naming pam plugin - if plugin == 'pam' or plugin == 'auth_pam': + # Mysql and MariaDB differ in naming pam plugin and syntax to set it + if plugin == 'pam': query_with_args = "ALTER USER %s@%s IDENTIFIED WITH %s USING %s", (user, host, plugin, plugin_auth_string) else: query_with_args = "ALTER USER %s@%s IDENTIFIED WITH %s BY %s", (user, host, plugin, plugin_auth_string) diff --git a/plugins/modules/mysql_user.py b/plugins/modules/mysql_user.py index f5439a3..ecda445 100644 --- a/plugins/modules/mysql_user.py +++ b/plugins/modules/mysql_user.py @@ -138,7 +138,7 @@ options: plugin_auth_string: description: - User's plugin auth_string (``CREATE USER user IDENTIFIED WITH plugin BY plugin_auth_string``). - - If I(plugin) is ``pam`` or ``auth_pam`` I(plugin_auth_string) can be used to determine the pam service (``CREATE USER user IDENTIFIED WITH plugin USING plugin_auth_string``). + - MariaDB: If I(plugin) is ``pam`` an optional I(plugin_auth_string) ults in (``CREATE USER user IDENTIFIED WITH plugin USING plugin_auth_string``). This was chosen because MySQL and MariaDB store the ``USING plugin_auth_string`` part in the ``authentication_string`` column in ``mysql.user``. type: str version_added: '0.1.0'