diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/check_game.c | 1 | ||||
-rw-r--r-- | plugins/check_http.c | 7 | ||||
-rw-r--r-- | plugins/check_nagios.c | 4 | ||||
-rw-r--r-- | plugins/check_snmp.c | 4 | ||||
-rw-r--r-- | plugins/check_swap.c | 4 | ||||
-rw-r--r-- | plugins/check_tcp.c | 8 | ||||
-rw-r--r-- | plugins/common.h | 2 | ||||
-rw-r--r-- | plugins/netutils.c | 6 | ||||
-rw-r--r-- | plugins/netutils.h | 2 | ||||
-rw-r--r-- | plugins/sslutils.c | 1 |
10 files changed, 19 insertions, 20 deletions
diff --git a/plugins/check_game.c b/plugins/check_game.c index 912072c..8548bbd 100644 --- a/plugins/check_game.c +++ b/plugins/check_game.c | |||
@@ -56,7 +56,6 @@ main (int argc, char **argv) | |||
56 | { | 56 | { |
57 | char *command_line; | 57 | char *command_line; |
58 | int result = STATE_UNKNOWN; | 58 | int result = STATE_UNKNOWN; |
59 | FILE *fp; | ||
60 | char *p, *ret[QSTAT_MAX_RETURN_ARGS]; | 59 | char *p, *ret[QSTAT_MAX_RETURN_ARGS]; |
61 | size_t i = 0; | 60 | size_t i = 0; |
62 | output chld_out; | 61 | output chld_out; |
diff --git a/plugins/check_http.c b/plugins/check_http.c index 413d501..9ff572e 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -746,9 +746,6 @@ check_http (void) | |||
746 | double elapsed_time; | 746 | double elapsed_time; |
747 | int page_len = 0; | 747 | int page_len = 0; |
748 | int result = STATE_UNKNOWN; | 748 | int result = STATE_UNKNOWN; |
749 | #ifdef HAVE_SSL | ||
750 | int sslerr; | ||
751 | #endif | ||
752 | 749 | ||
753 | /* try to connect to the host at the given port number */ | 750 | /* try to connect to the host at the given port number */ |
754 | if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) | 751 | if (my_tcp_connect (server_address, server_port, &sd) != STATE_OK) |
@@ -793,7 +790,7 @@ check_http (void) | |||
793 | asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); | 790 | asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); |
794 | } | 791 | } |
795 | 792 | ||
796 | asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, strlen (http_post_data)); | 793 | asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen (http_post_data)); |
797 | asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); | 794 | asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); |
798 | } | 795 | } |
799 | else { | 796 | else { |
@@ -858,7 +855,7 @@ check_http (void) | |||
858 | if (verbose) | 855 | if (verbose) |
859 | printf ("%s://%s:%d%s is %d characters\n", | 856 | printf ("%s://%s:%d%s is %d characters\n", |
860 | use_ssl ? "https" : "http", server_address, | 857 | use_ssl ? "https" : "http", server_address, |
861 | server_port, server_url, pagesize); | 858 | server_port, server_url, (int)pagesize); |
862 | 859 | ||
863 | /* find status line and null-terminate it */ | 860 | /* find status line and null-terminate it */ |
864 | status_line = page; | 861 | status_line = page; |
diff --git a/plugins/check_nagios.c b/plugins/check_nagios.c index 0ae488f..ab9c877 100644 --- a/plugins/check_nagios.c +++ b/plugins/check_nagios.c | |||
@@ -55,9 +55,9 @@ main (int argc, char **argv) | |||
55 | int procrss = 0; | 55 | int procrss = 0; |
56 | float procpcpu = 0; | 56 | float procpcpu = 0; |
57 | char procstat[8]; | 57 | char procstat[8]; |
58 | /* procetime is unused in most configurations, but may be in PS_VAR_LIST | 58 | #ifdef PS_USES_PROCETIME |
59 | * so it must be here in spite of it producing compiler warnings */ | ||
60 | char procetime[MAX_INPUT_BUFFER]; | 59 | char procetime[MAX_INPUT_BUFFER]; |
60 | #endif /* PS_USES_PROCETIME */ | ||
61 | char procprog[MAX_INPUT_BUFFER]; | 61 | char procprog[MAX_INPUT_BUFFER]; |
62 | char *procargs; | 62 | char *procargs; |
63 | int pos, cols; | 63 | int pos, cols; |
diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 97c86a3..db106f2 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c | |||
@@ -578,7 +578,7 @@ process_arguments (int argc, char **argv) | |||
578 | labels_size += 8; | 578 | labels_size += 8; |
579 | labels = realloc (labels, labels_size); | 579 | labels = realloc (labels, labels_size); |
580 | if (labels == NULL) | 580 | if (labels == NULL) |
581 | die (STATE_UNKNOWN, _("Could not reallocate labels[%d]"), nlabels); | 581 | die (STATE_UNKNOWN, _("Could not reallocate labels[%d]"), (int)nlabels); |
582 | } | 582 | } |
583 | labels[nlabels - 1] = optarg; | 583 | labels[nlabels - 1] = optarg; |
584 | ptr = thisarg (optarg); | 584 | ptr = thisarg (optarg); |
@@ -607,7 +607,7 @@ process_arguments (int argc, char **argv) | |||
607 | unitv_size += 8; | 607 | unitv_size += 8; |
608 | unitv = realloc (unitv, unitv_size); | 608 | unitv = realloc (unitv, unitv_size); |
609 | if (unitv == NULL) | 609 | if (unitv == NULL) |
610 | die (STATE_UNKNOWN, _("Could not reallocate units [%d]\n"), nunits); | 610 | die (STATE_UNKNOWN, _("Could not reallocate units [%d]\n"), (int)nunits); |
611 | } | 611 | } |
612 | unitv[nunits - 1] = optarg; | 612 | unitv[nunits - 1] = optarg; |
613 | ptr = thisarg (optarg); | 613 | ptr = thisarg (optarg); |
diff --git a/plugins/check_swap.c b/plugins/check_swap.c index aeeb9ba..74b9daf 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c | |||
@@ -385,7 +385,7 @@ process_arguments (int argc, char **argv) | |||
385 | } | 385 | } |
386 | else if (strstr (optarg, ",") && | 386 | else if (strstr (optarg, ",") && |
387 | strstr (optarg, "%") && | 387 | strstr (optarg, "%") && |
388 | sscanf (optarg, "%g,%d%%", &warn_size, &warn_percent) == 2) { | 388 | sscanf (optarg, "%lf,%d%%", &warn_size, &warn_percent) == 2) { |
389 | warn_size = floor(warn_size); | 389 | warn_size = floor(warn_size); |
390 | break; | 390 | break; |
391 | } | 391 | } |
@@ -403,7 +403,7 @@ process_arguments (int argc, char **argv) | |||
403 | } | 403 | } |
404 | else if (strstr (optarg, ",") && | 404 | else if (strstr (optarg, ",") && |
405 | strstr (optarg, "%") && | 405 | strstr (optarg, "%") && |
406 | sscanf (optarg, "%g,%d%%", &crit_size, &crit_percent) == 2) { | 406 | sscanf (optarg, "%lf,%d%%", &crit_size, &crit_percent) == 2) { |
407 | crit_size = floor(crit_size); | 407 | crit_size = floor(crit_size); |
408 | break; | 408 | break; |
409 | } | 409 | } |
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 2a77637..cb7a869 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c | |||
@@ -31,7 +31,6 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; | |||
31 | #ifdef HAVE_SSL | 31 | #ifdef HAVE_SSL |
32 | static int check_cert = FALSE; | 32 | static int check_cert = FALSE; |
33 | static int days_till_exp; | 33 | static int days_till_exp; |
34 | static char *randbuff = ""; | ||
35 | # define my_recv(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) | 34 | # define my_recv(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) |
36 | # define my_send(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0)) | 35 | # define my_send(buf, len) ((flags & FLAG_SSL) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0)) |
37 | #else | 36 | #else |
@@ -51,7 +50,6 @@ static char *QUIT = NULL; | |||
51 | static int PROTOCOL = IPPROTO_TCP; /* most common is default */ | 50 | static int PROTOCOL = IPPROTO_TCP; /* most common is default */ |
52 | static int PORT = 0; | 51 | static int PORT = 0; |
53 | 52 | ||
54 | static char timestamp[17] = ""; | ||
55 | static int server_port = 0; | 53 | static int server_port = 0; |
56 | static char *server_address = NULL; | 54 | static char *server_address = NULL; |
57 | static char *server_send = NULL; | 55 | static char *server_send = NULL; |
@@ -199,7 +197,7 @@ main (int argc, char **argv) | |||
199 | if(flags & FLAG_VERBOSE) { | 197 | if(flags & FLAG_VERBOSE) { |
200 | printf("Using service %s\n", SERVICE); | 198 | printf("Using service %s\n", SERVICE); |
201 | printf("Port: %d\n", PORT); | 199 | printf("Port: %d\n", PORT); |
202 | printf("flags: 0x%x\n", flags); | 200 | printf("flags: 0x%x\n", (int)flags); |
203 | } | 201 | } |
204 | 202 | ||
205 | if(EXPECT && !server_expect_count) | 203 | if(EXPECT && !server_expect_count) |
@@ -242,7 +240,7 @@ main (int argc, char **argv) | |||
242 | } | 240 | } |
243 | 241 | ||
244 | if(flags & FLAG_VERBOSE) { | 242 | if(flags & FLAG_VERBOSE) { |
245 | printf("server_expect_count: %d\n", server_expect_count); | 243 | printf("server_expect_count: %d\n", (int)server_expect_count); |
246 | for(i = 0; i < server_expect_count; i++) | 244 | for(i = 0; i < server_expect_count; i++) |
247 | printf("\t%d: %s\n", i, server_expect[i]); | 245 | printf("\t%d: %s\n", i, server_expect[i]); |
248 | } | 246 | } |
@@ -274,7 +272,7 @@ main (int argc, char **argv) | |||
274 | /* print raw output if we're debugging */ | 272 | /* print raw output if we're debugging */ |
275 | if(flags & FLAG_VERBOSE) | 273 | if(flags & FLAG_VERBOSE) |
276 | printf("received %d bytes from host\n#-raw-recv-------#\n%s\n#-raw-recv-------#\n", | 274 | printf("received %d bytes from host\n#-raw-recv-------#\n%s\n#-raw-recv-------#\n", |
277 | len + 1, status); | 275 | (int)len + 1, status); |
278 | while(isspace(status[len])) status[len--] = '\0'; | 276 | while(isspace(status[len])) status[len--] = '\0'; |
279 | 277 | ||
280 | for (i = 0; i < server_expect_count; i++) { | 278 | for (i = 0; i < server_expect_count; i++) { |
diff --git a/plugins/common.h b/plugins/common.h index 5eac63e..b4699ce 100644 --- a/plugins/common.h +++ b/plugins/common.h | |||
@@ -45,7 +45,7 @@ | |||
45 | #include <stdlib.h> | 45 | #include <stdlib.h> |
46 | #include <errno.h> | 46 | #include <errno.h> |
47 | 47 | ||
48 | #ifdef HUGE_VAL_NEEDS_MATH_H | 48 | #ifdef HAVE_MATH_H |
49 | #include <math.h> | 49 | #include <math.h> |
50 | #endif | 50 | #endif |
51 | 51 | ||
diff --git a/plugins/netutils.c b/plugins/netutils.c index 6f3a151..b4c3944 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c | |||
@@ -31,6 +31,8 @@ | |||
31 | * | 31 | * |
32 | ****************************************************************************/ | 32 | ****************************************************************************/ |
33 | 33 | ||
34 | #define LOCAL_TIMEOUT_ALARM_HANDLER | ||
35 | |||
34 | #include "common.h" | 36 | #include "common.h" |
35 | #include "netutils.h" | 37 | #include "netutils.h" |
36 | 38 | ||
@@ -217,14 +219,14 @@ np_net_connect (const char *host_name, int port, int *sd, int proto) | |||
217 | /* else the hostname is interpreted as a path to a unix socket */ | 219 | /* else the hostname is interpreted as a path to a unix socket */ |
218 | else { | 220 | else { |
219 | if(strlen(host_name) >= UNIX_PATH_MAX){ | 221 | if(strlen(host_name) >= UNIX_PATH_MAX){ |
220 | die(_("Supplied path too long unix domain socket")); | 222 | die(STATE_UNKNOWN, _("Supplied path too long unix domain socket")); |
221 | } | 223 | } |
222 | memset(&su, 0, sizeof(su)); | 224 | memset(&su, 0, sizeof(su)); |
223 | su.sun_family = AF_UNIX; | 225 | su.sun_family = AF_UNIX; |
224 | strncpy(su.sun_path, host_name, UNIX_PATH_MAX); | 226 | strncpy(su.sun_path, host_name, UNIX_PATH_MAX); |
225 | *sd = socket(PF_UNIX, SOCK_STREAM, 0); | 227 | *sd = socket(PF_UNIX, SOCK_STREAM, 0); |
226 | if(sd < 0){ | 228 | if(sd < 0){ |
227 | die(_("Socket creation failed")); | 229 | die(STATE_UNKNOWN, _("Socket creation failed")); |
228 | } | 230 | } |
229 | result = connect(*sd, (struct sockaddr *)&su, sizeof(su)); | 231 | result = connect(*sd, (struct sockaddr *)&su, sizeof(su)); |
230 | if (result < 0 && errno == ECONNREFUSED) | 232 | if (result < 0 && errno == ECONNREFUSED) |
diff --git a/plugins/netutils.h b/plugins/netutils.h index 8bc7bd6..1168f9f 100644 --- a/plugins/netutils.h +++ b/plugins/netutils.h | |||
@@ -37,6 +37,7 @@ | |||
37 | 37 | ||
38 | #include "config.h" | 38 | #include "config.h" |
39 | #include "common.h" | 39 | #include "common.h" |
40 | #include "utils.h" | ||
40 | #include <netinet/in.h> | 41 | #include <netinet/in.h> |
41 | #include <arpa/inet.h> | 42 | #include <arpa/inet.h> |
42 | 43 | ||
@@ -77,6 +78,7 @@ int send_request (int sd, int proto, const char *send_buffer, char *recv_buffer, | |||
77 | int is_host (const char *); | 78 | int is_host (const char *); |
78 | int is_addr (const char *); | 79 | int is_addr (const char *); |
79 | int resolve_host_or_addr (const char *, int); | 80 | int resolve_host_or_addr (const char *, int); |
81 | void host_or_die(const char *str); | ||
80 | #define is_inet_addr(addr) resolve_host_or_addr(addr, AF_INET) | 82 | #define is_inet_addr(addr) resolve_host_or_addr(addr, AF_INET) |
81 | #ifdef USE_IPV6 | 83 | #ifdef USE_IPV6 |
82 | # define is_inet6_addr(addr) resolve_host_or_addr(addr, AF_INET6) | 84 | # define is_inet6_addr(addr) resolve_host_or_addr(addr, AF_INET6) |
diff --git a/plugins/sslutils.c b/plugins/sslutils.c index d785fb7..66c7299 100644 --- a/plugins/sslutils.c +++ b/plugins/sslutils.c | |||
@@ -31,6 +31,7 @@ | |||
31 | * | 31 | * |
32 | ****************************************************************************/ | 32 | ****************************************************************************/ |
33 | 33 | ||
34 | #define LOCAL_TIMEOUT_ALARM_HANDLER | ||
34 | #include "common.h" | 35 | #include "common.h" |
35 | #include "netutils.h" | 36 | #include "netutils.h" |
36 | 37 | ||