From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- ...121778-nagiosplug-cvs-check_mysql-paranoia.diff | 89 ++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 web/attachments/121778-nagiosplug-cvs-check_mysql-paranoia.diff (limited to 'web/attachments/121778-nagiosplug-cvs-check_mysql-paranoia.diff') diff --git a/web/attachments/121778-nagiosplug-cvs-check_mysql-paranoia.diff b/web/attachments/121778-nagiosplug-cvs-check_mysql-paranoia.diff new file mode 100644 index 0000000..6639e29 --- /dev/null +++ b/web/attachments/121778-nagiosplug-cvs-check_mysql-paranoia.diff @@ -0,0 +1,89 @@ +diff -urN ./plugins/check_mysql.c ../plugins/plugins/check_mysql.c +--- ./plugins/check_mysql.c 2005-01-05 21:53:16.000000000 +0100 ++++ ../plugins/plugins/check_mysql.c 2005-02-17 16:08:30.000000000 +0100 +@@ -155,7 +155,7 @@ + int + process_arguments (int argc, char **argv) + { +- int c; ++ int c, i; + + int option = 0; + static struct option longopts[] = { +@@ -193,10 +193,19 @@ + db = optarg; + break; + case 'u': /* username */ +- db_user = optarg; ++ if((db_user = strdup(optarg))) { ++ for(i = 0; i < strlen(argv[optind]); i++) argv[optind][i] = 'x'; ++ } ++ else ++ db_user = optarg; + break; + case 'p': /* authentication information: password */ +- db_pass = optarg; ++ if((db_pass = strdup(optarg))) { ++ /* strdup was successful, so obscure passwd from ps view */ ++ for(i = 0; i < strlen(argv[optind]); i++) argv[optind][i] = 'x'; ++ } ++ else /* strdup failed, so point it to password input string */ ++ db_pass = optarg; + break; + case 'P': /* critical time threshold */ + db_port = atoi (optarg); +@@ -219,18 +228,27 @@ + + while ( argc > c ) { + +- if (strlen(db_host) == 0) ++ if (db_host == NULL || strlen(db_host) == 0) { + if (is_host (argv[c])) { + db_host = argv[c++]; + } + else { + usage2 (_("Invalid hostname/address"), optarg); + } +- else if (strlen(db_user) == 0) +- db_user = argv[c++]; +- else if (strlen(db_pass) == 0) +- db_pass = argv[c++]; +- else if (strlen(db) == 0) ++ } ++ else if (db_user == NULL || strlen(db_user) == 0) { ++ if((db_user = strdup(argv[c++]))) ++ for(i = 0; i < strlen(argv[c]); i++) argv[c][i] = 'x'; ++ else ++ db_user = argv[c]; ++ } ++ else if (db_pass == NULL || strlen(db_pass) == 0) { ++ if((db_pass = strdup(argv[c++]))) ++ for(i = 0; i < strlen(argv[c]); i++) argv[c][i] = 'x'; ++ else ++ db_pass = argv[c]; ++ } ++ else if (db == NULL || strlen(db) == 0) + db = argv[c++]; + else if (is_intnonneg (argv[c])) + db_port = atoi (argv[c++]); +@@ -246,16 +264,16 @@ + validate_arguments (void) + { + if (db_user == NULL) +- db_user = strdup(""); ++ db_user = ""; + + if (db_host == NULL) +- db_host = strdup(""); ++ db_host = ""; + + if (db_pass == NULL) +- db_pass == strdup(""); ++ db_pass == ""; + + if (db == NULL) +- db = strdup(""); ++ db = ""; + + return OK; + } -- cgit v1.2.3-74-g34f1