From 85d9e03ea0e7e6f11ecb9ca7e9ee630d1e9db0e9 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 31 May 2023 16:38:05 +0200 Subject: [PATCH] Adding d/p/23_check_mysql_fix_error_handling from upstream --- .../patches/23_check_mysql_fix_error_handling | 28 +++++++++++++++++++ debian/patches/series | 1 + 2 files changed, 29 insertions(+) create mode 100644 debian/patches/23_check_mysql_fix_error_handling diff --git a/debian/patches/23_check_mysql_fix_error_handling b/debian/patches/23_check_mysql_fix_error_handling new file mode 100644 index 0000000..eb16f3f --- /dev/null +++ b/debian/patches/23_check_mysql_fix_error_handling @@ -0,0 +1,28 @@ +From 10863265324a9a9fdf8ce771271af15b7e2f5a4a Mon Sep 17 00:00:00 2001 +From: Platon Pronko +Date: Fri, 19 May 2023 15:05:02 +0800 +Subject: [PATCH] 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. +--- + plugins/check_mysql.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c +index 6cfa70edb..91e150fbd 100644 +--- a/plugins/check_mysql.c ++++ b/plugins/check_mysql.c +@@ -138,7 +138,10 @@ main (int argc, char **argv) + mysql_ssl_set(&mysql,key,cert,ca_cert,ca_dir,ciphers); + /* establish a connection to the server and error checking */ + if (!mysql_real_connect(&mysql,db_host,db_user,db_pass,db,db_port,db_socket,0)) { +- if (ignore_auth && mysql_errno (&mysql) == ER_ACCESS_DENIED_ERROR) ++ /* Depending on internally-selected auth plugin MySQL might return */ ++ /* ER_ACCESS_DENIED_NO_PASSWORD_ERROR or ER_ACCESS_DENIED_ERROR. */ ++ /* Semantically these errors are the same. */ ++ if (ignore_auth && (mysql_errno (&mysql) == ER_ACCESS_DENIED_ERROR || mysql_errno (&mysql) == ER_ACCESS_DENIED_NO_PASSWORD_ERROR)) + { + printf("MySQL OK - Version: %s (protocol %d)\n", + mysql_get_server_info(&mysql), diff --git a/debian/patches/series b/debian/patches/series index ed61c01..062b069 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -14,6 +14,7 @@ 20_chech_nt_fix_encoding 21_check_pgsql_extra_output 22_check_disk_avoid_mount +23_check_mysql_fix_error_handling # feature patches 30_check_radius_radcli_1.3.1_support 31_checl_mailq_separate_submission_queue