diff options
author | Platon Pronko <platon7pronko@gmail.com> | 2023-05-19 15:05:02 +0800 |
---|---|---|
committer | Platon Pronko <platon7pronko@gmail.com> | 2023-05-30 15:35:39 +0800 |
commit | 10863265324a9a9fdf8ce771271af15b7e2f5a4a (patch) | |
tree | 10a5909c436adc93f8cc9f00d010507c3ea35b4f | |
parent | 4ed55a1d40ac8693c7d5c9aa3a7301f0a2236135 (diff) | |
download | monitoring-plugins-1086326.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.
-rw-r--r-- | plugins/check_mysql.c | 5 |
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), |