summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorPlaton Pronko <platon7pronko@gmail.com>2023-05-19 15:05:02 +0800
committerPlaton Pronko <platon7pronko@gmail.com>2023-05-30 15:35:39 +0800
commit10863265324a9a9fdf8ce771271af15b7e2f5a4a (patch)
tree10a5909c436adc93f8cc9f00d010507c3ea35b4f /plugins
parent4ed55a1d40ac8693c7d5c9aa3a7301f0a2236135 (diff)
downloadmonitoring-plugins-10863265324a9a9fdf8ce771271af15b7e2f5a4a.tar.gz
check_mysql: handle ER_ACCESS_DENIED_NO_PASSWORD_ERROR if ignore_auth=1
In some situations MySQL might return ER_ACCESS_DENIED_NO_PASSWORD_ERROR instead of ER_ACCESS_DENIED_ERROR. Semantically these errors are the same.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_mysql.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c
index 6cfa70ed..91e150fb 100644
--- a/plugins/check_mysql.c
+++ b/plugins/check_mysql.c
@@ -138,7 +138,10 @@ main (int argc, char **argv)
138 mysql_ssl_set(&mysql,key,cert,ca_cert,ca_dir,ciphers); 138 mysql_ssl_set(&mysql,key,cert,ca_cert,ca_dir,ciphers);
139 /* establish a connection to the server and error checking */ 139 /* establish a connection to the server and error checking */
140 if (!mysql_real_connect(&mysql,db_host,db_user,db_pass,db,db_port,db_socket,0)) { 140 if (!mysql_real_connect(&mysql,db_host,db_user,db_pass,db,db_port,db_socket,0)) {
141 if (ignore_auth && mysql_errno (&mysql) == ER_ACCESS_DENIED_ERROR) 141 /* Depending on internally-selected auth plugin MySQL might return */
142 /* ER_ACCESS_DENIED_NO_PASSWORD_ERROR or ER_ACCESS_DENIED_ERROR. */
143 /* Semantically these errors are the same. */
144 if (ignore_auth && (mysql_errno (&mysql) == ER_ACCESS_DENIED_ERROR || mysql_errno (&mysql) == ER_ACCESS_DENIED_NO_PASSWORD_ERROR))
142 { 145 {
143 printf("MySQL OK - Version: %s (protocol %d)\n", 146 printf("MySQL OK - Version: %s (protocol %d)\n",
144 mysql_get_server_info(&mysql), 147 mysql_get_server_info(&mysql),