diff options
author | Lorenz <12514511+RincewindsHat@users.noreply.github.com> | 2023-05-30 23:34:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-30 23:34:11 +0200 |
commit | 5c2f72f74f7528a3e3f5bfe5b7c6538e4f5cf9b0 (patch) | |
tree | 837129824bacfca422e2a2bec8d86605883e1d4f | |
parent | da8d0eb3addfa2a1f966f7feb47a7cbb8124eabc (diff) | |
parent | 10863265324a9a9fdf8ce771271af15b7e2f5a4a (diff) | |
download | monitoring-plugins-5c2f72f.tar.gz |
Merge pull request #1883 from Rogach/pr/check-mysql-handle-error
check_mysql: handle ER_ACCESS_DENIED_NO_PASSWORD_ERROR if ignore_auth=1
-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), |