diff options
-rw-r--r-- | plugins-root/check_dhcp.c | 12 | ||||
-rw-r--r-- | plugins-root/check_icmp.c | 4 | ||||
-rw-r--r-- | plugins/check_curl.c | 9 | ||||
-rw-r--r-- | plugins/check_ntp_peer.c | 6 | ||||
-rw-r--r-- | plugins/check_ups.c | 14 |
5 files changed, 26 insertions, 19 deletions
diff --git a/plugins-root/check_dhcp.c b/plugins-root/check_dhcp.c index ad67323..2d74234 100644 --- a/plugins-root/check_dhcp.c +++ b/plugins-root/check_dhcp.c | |||
@@ -229,7 +229,7 @@ struct in_addr requested_address; | |||
229 | 229 | ||
230 | int process_arguments(int, char **); | 230 | int process_arguments(int, char **); |
231 | int call_getopt(int, char **); | 231 | int call_getopt(int, char **); |
232 | int validate_arguments(int, int); | 232 | int validate_arguments(int); |
233 | void print_usage(void); | 233 | void print_usage(void); |
234 | void print_help(void); | 234 | void print_help(void); |
235 | 235 | ||
@@ -1059,8 +1059,8 @@ int process_arguments(int argc, char **argv){ | |||
1059 | return ERROR; | 1059 | return ERROR; |
1060 | 1060 | ||
1061 | arg_index = call_getopt(argc,argv); | 1061 | arg_index = call_getopt(argc,argv); |
1062 | return validate_arguments(argc,arg_index); | 1062 | return validate_arguments(argc); |
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | 1065 | ||
1066 | 1066 | ||
@@ -1158,13 +1158,13 @@ int call_getopt(int argc, char **argv){ | |||
1158 | } | 1158 | } |
1159 | 1159 | ||
1160 | 1160 | ||
1161 | int validate_arguments(int argc, int arg_index){ | 1161 | int validate_arguments(int argc){ |
1162 | 1162 | ||
1163 | if(argc-optind > 0) | 1163 | if(argc - optind > 0) |
1164 | usage(_("Got unexpected non-option argument")); | 1164 | usage(_("Got unexpected non-option argument")); |
1165 | 1165 | ||
1166 | return OK; | 1166 | return OK; |
1167 | } | 1167 | } |
1168 | 1168 | ||
1169 | 1169 | ||
1170 | #if defined(__sun__) || defined(__solaris__) || defined(__hpux__) | 1170 | #if defined(__sun__) || defined(__solaris__) || defined(__hpux__) |
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 9ceb35b..edfd694 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
@@ -1436,11 +1436,15 @@ get_ip_address(const char *ifname) | |||
1436 | struct ifreq ifr; | 1436 | struct ifreq ifr; |
1437 | 1437 | ||
1438 | strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); | 1438 | strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name) - 1); |
1439 | |||
1439 | ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; | 1440 | ifr.ifr_name[sizeof(ifr.ifr_name) - 1] = '\0'; |
1441 | |||
1440 | if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1) | 1442 | if(ioctl(icmp_sock, SIOCGIFADDR, &ifr) == -1) |
1441 | crash("Cannot determine IP address of interface %s", ifname); | 1443 | crash("Cannot determine IP address of interface %s", ifname); |
1444 | |||
1442 | memcpy(&ip, &ifr.ifr_addr, sizeof(ip)); | 1445 | memcpy(&ip, &ifr.ifr_addr, sizeof(ip)); |
1443 | #else | 1446 | #else |
1447 | (void) ifname; | ||
1444 | errno = 0; | 1448 | errno = 0; |
1445 | crash("Cannot get interface IP address on this platform."); | 1449 | crash("Cannot get interface IP address on this platform."); |
1446 | #endif | 1450 | #endif |
diff --git a/plugins/check_curl.c b/plugins/check_curl.c index b713714..41c25d9 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c | |||
@@ -244,7 +244,7 @@ void curlhelp_freewritebuffer (curlhelp_write_curlbuf*); | |||
244 | int curlhelp_initreadbuffer (curlhelp_read_curlbuf *, const char *, size_t); | 244 | int curlhelp_initreadbuffer (curlhelp_read_curlbuf *, const char *, size_t); |
245 | int curlhelp_buffer_read_callback (void *, size_t , size_t , void *); | 245 | int curlhelp_buffer_read_callback (void *, size_t , size_t , void *); |
246 | void curlhelp_freereadbuffer (curlhelp_read_curlbuf *); | 246 | void curlhelp_freereadbuffer (curlhelp_read_curlbuf *); |
247 | curlhelp_ssl_library curlhelp_get_ssl_library (CURL*); | 247 | curlhelp_ssl_library curlhelp_get_ssl_library (); |
248 | const char* curlhelp_get_ssl_library_string (curlhelp_ssl_library); | 248 | const char* curlhelp_get_ssl_library_string (curlhelp_ssl_library); |
249 | int net_noopenssl_check_certificate (cert_ptr_union*, int, int); | 249 | int net_noopenssl_check_certificate (cert_ptr_union*, int, int); |
250 | 250 | ||
@@ -297,6 +297,7 @@ main (int argc, char **argv) | |||
297 | 297 | ||
298 | int verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx) | 298 | int verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx) |
299 | { | 299 | { |
300 | (void) preverify_ok; | ||
300 | /* TODO: we get all certificates of the chain, so which ones | 301 | /* TODO: we get all certificates of the chain, so which ones |
301 | * should we test? | 302 | * should we test? |
302 | * TODO: is the last certificate always the server certificate? | 303 | * TODO: is the last certificate always the server certificate? |
@@ -321,6 +322,8 @@ int verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx) | |||
321 | 322 | ||
322 | CURLcode sslctxfun(CURL *curl, SSL_CTX *sslctx, void *parm) | 323 | CURLcode sslctxfun(CURL *curl, SSL_CTX *sslctx, void *parm) |
323 | { | 324 | { |
325 | (void) curl; // ignore unused parameter | ||
326 | (void) parm; // ignore unused parameter | ||
324 | SSL_CTX_set_verify(sslctx, SSL_VERIFY_PEER, verify_callback); | 327 | SSL_CTX_set_verify(sslctx, SSL_VERIFY_PEER, verify_callback); |
325 | 328 | ||
326 | return CURLE_OK; | 329 | return CURLE_OK; |
@@ -646,7 +649,7 @@ check_http (void) | |||
646 | } | 649 | } |
647 | 650 | ||
648 | /* detect SSL library used by libcurl */ | 651 | /* detect SSL library used by libcurl */ |
649 | ssl_library = curlhelp_get_ssl_library (curl); | 652 | ssl_library = curlhelp_get_ssl_library (); |
650 | 653 | ||
651 | /* try hard to get a stack of certificates to verify against */ | 654 | /* try hard to get a stack of certificates to verify against */ |
652 | if (check_cert) { | 655 | if (check_cert) { |
@@ -2381,7 +2384,7 @@ get_content_length (const curlhelp_write_curlbuf* header_buf, const curlhelp_wri | |||
2381 | 2384 | ||
2382 | /* TODO: is there a better way in libcurl to check for the SSL library? */ | 2385 | /* TODO: is there a better way in libcurl to check for the SSL library? */ |
2383 | curlhelp_ssl_library | 2386 | curlhelp_ssl_library |
2384 | curlhelp_get_ssl_library (CURL* curl) | 2387 | curlhelp_get_ssl_library () |
2385 | { | 2388 | { |
2386 | curl_version_info_data* version_data; | 2389 | curl_version_info_data* version_data; |
2387 | char *ssl_version; | 2390 | char *ssl_version; |
diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c index eafafdc..161b495 100644 --- a/plugins/check_ntp_peer.c +++ b/plugins/check_ntp_peer.c | |||
@@ -199,7 +199,7 @@ setup_control_request(ntp_control_message *p, uint8_t opcode, uint16_t seq){ | |||
199 | * status is pretty much useless as syncsource_found is a global variable | 199 | * status is pretty much useless as syncsource_found is a global variable |
200 | * used later in main to check is the server was synchronized. It works | 200 | * used later in main to check is the server was synchronized. It works |
201 | * so I left it alone */ | 201 | * so I left it alone */ |
202 | int ntp_request(const char *host, double *offset, int *offset_result, double *jitter, int *stratum, int *num_truechimers){ | 202 | int ntp_request(double *offset, int *offset_result, double *jitter, int *stratum, int *num_truechimers){ |
203 | int conn=-1, i, npeers=0, num_candidates=0; | 203 | int conn=-1, i, npeers=0, num_candidates=0; |
204 | double tmp_offset = 0; | 204 | double tmp_offset = 0; |
205 | int min_peer_sel=PEER_INCLUDED; | 205 | int min_peer_sel=PEER_INCLUDED; |
@@ -585,8 +585,8 @@ int main(int argc, char *argv[]){ | |||
585 | /* set socket timeout */ | 585 | /* set socket timeout */ |
586 | alarm (socket_timeout); | 586 | alarm (socket_timeout); |
587 | 587 | ||
588 | /* This returns either OK or WARNING (See comment proceeding ntp_request) */ | 588 | /* This returns either OK or WARNING (See comment preceeding ntp_request) */ |
589 | result = ntp_request(server_address, &offset, &offset_result, &jitter, &stratum, &num_truechimers); | 589 | result = ntp_request(&offset, &offset_result, &jitter, &stratum, &num_truechimers); |
590 | 590 | ||
591 | if(offset_result == STATE_UNKNOWN) { | 591 | if(offset_result == STATE_UNKNOWN) { |
592 | /* if there's no sync peer (this overrides ntp_request output): */ | 592 | /* if there's no sync peer (this overrides ntp_request output): */ |
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 12bce21..68737c4 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c | |||
@@ -89,7 +89,7 @@ char *ups_status; | |||
89 | int temp_output_c = 0; | 89 | int temp_output_c = 0; |
90 | 90 | ||
91 | int determine_status (void); | 91 | int determine_status (void); |
92 | int get_ups_variable (const char *, char *, size_t); | 92 | int get_ups_variable (const char *, char *); |
93 | 93 | ||
94 | int process_arguments (int, char **); | 94 | int process_arguments (int, char **); |
95 | int validate_arguments (void); | 95 | int validate_arguments (void); |
@@ -189,7 +189,7 @@ main (int argc, char **argv) | |||
189 | } | 189 | } |
190 | 190 | ||
191 | /* get the ups utility voltage if possible */ | 191 | /* get the ups utility voltage if possible */ |
192 | res=get_ups_variable ("input.voltage", temp_buffer, sizeof (temp_buffer)); | 192 | res=get_ups_variable ("input.voltage", temp_buffer); |
193 | if (res == NOSUCHVAR) supported_options &= ~UPS_UTILITY; | 193 | if (res == NOSUCHVAR) supported_options &= ~UPS_UTILITY; |
194 | else if (res != OK) | 194 | else if (res != OK) |
195 | return STATE_CRITICAL; | 195 | return STATE_CRITICAL; |
@@ -224,7 +224,7 @@ main (int argc, char **argv) | |||
224 | } | 224 | } |
225 | 225 | ||
226 | /* get the ups battery percent if possible */ | 226 | /* get the ups battery percent if possible */ |
227 | res=get_ups_variable ("battery.charge", temp_buffer, sizeof (temp_buffer)); | 227 | res=get_ups_variable ("battery.charge", temp_buffer); |
228 | if (res == NOSUCHVAR) supported_options &= ~UPS_BATTPCT; | 228 | if (res == NOSUCHVAR) supported_options &= ~UPS_BATTPCT; |
229 | else if ( res != OK) | 229 | else if ( res != OK) |
230 | return STATE_CRITICAL; | 230 | return STATE_CRITICAL; |
@@ -253,7 +253,7 @@ main (int argc, char **argv) | |||
253 | } | 253 | } |
254 | 254 | ||
255 | /* get the ups load percent if possible */ | 255 | /* get the ups load percent if possible */ |
256 | res=get_ups_variable ("ups.load", temp_buffer, sizeof (temp_buffer)); | 256 | res=get_ups_variable ("ups.load", temp_buffer); |
257 | if ( res == NOSUCHVAR ) supported_options &= ~UPS_LOADPCT; | 257 | if ( res == NOSUCHVAR ) supported_options &= ~UPS_LOADPCT; |
258 | else if ( res != OK) | 258 | else if ( res != OK) |
259 | return STATE_CRITICAL; | 259 | return STATE_CRITICAL; |
@@ -282,7 +282,7 @@ main (int argc, char **argv) | |||
282 | } | 282 | } |
283 | 283 | ||
284 | /* get the ups temperature if possible */ | 284 | /* get the ups temperature if possible */ |
285 | res=get_ups_variable ("ups.temperature", temp_buffer, sizeof (temp_buffer)); | 285 | res=get_ups_variable ("ups.temperature", temp_buffer); |
286 | if ( res == NOSUCHVAR ) supported_options &= ~UPS_TEMP; | 286 | if ( res == NOSUCHVAR ) supported_options &= ~UPS_TEMP; |
287 | else if ( res != OK) | 287 | else if ( res != OK) |
288 | return STATE_CRITICAL; | 288 | return STATE_CRITICAL; |
@@ -342,7 +342,7 @@ determine_status (void) | |||
342 | char *ptr; | 342 | char *ptr; |
343 | int res; | 343 | int res; |
344 | 344 | ||
345 | res=get_ups_variable ("ups.status", recv_buffer, sizeof (recv_buffer)); | 345 | res=get_ups_variable ("ups.status", recv_buffer); |
346 | if (res == NOSUCHVAR) return OK; | 346 | if (res == NOSUCHVAR) return OK; |
347 | if (res != STATE_OK) { | 347 | if (res != STATE_OK) { |
348 | printf ("%s\n", _("Invalid response received from host")); | 348 | printf ("%s\n", _("Invalid response received from host")); |
@@ -388,7 +388,7 @@ determine_status (void) | |||
388 | 388 | ||
389 | /* gets a variable value for a specific UPS */ | 389 | /* gets a variable value for a specific UPS */ |
390 | int | 390 | int |
391 | get_ups_variable (const char *varname, char *buf, size_t buflen) | 391 | get_ups_variable (const char *varname, char *buf) |
392 | { | 392 | { |
393 | /* char command[MAX_INPUT_BUFFER]; */ | 393 | /* char command[MAX_INPUT_BUFFER]; */ |
394 | char temp_buffer[MAX_INPUT_BUFFER]; | 394 | char temp_buffer[MAX_INPUT_BUFFER]; |