diff options
-rw-r--r-- | plugins/netutils.c | 5 | ||||
-rw-r--r-- | plugins/netutils.h | 12 | ||||
-rw-r--r-- | plugins/sslutils.c | 1 | ||||
-rw-r--r-- | plugins/utils.c | 7 | ||||
-rw-r--r-- | plugins/utils.h | 9 |
5 files changed, 13 insertions, 21 deletions
diff --git a/plugins/netutils.c b/plugins/netutils.c index 1d6100ab..9f18723a 100644 --- a/plugins/netutils.c +++ b/plugins/netutils.c | |||
@@ -27,11 +27,12 @@ | |||
27 | * | 27 | * |
28 | *****************************************************************************/ | 28 | *****************************************************************************/ |
29 | 29 | ||
30 | #define LOCAL_TIMEOUT_ALARM_HANDLER | ||
31 | |||
32 | #include "common.h" | 30 | #include "common.h" |
33 | #include "netutils.h" | 31 | #include "netutils.h" |
34 | 32 | ||
33 | unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT; | ||
34 | unsigned int socket_timeout_state = STATE_CRITICAL; | ||
35 | |||
35 | int econn_refuse_state = STATE_CRITICAL; | 36 | int econn_refuse_state = STATE_CRITICAL; |
36 | int was_refused = FALSE; | 37 | int was_refused = FALSE; |
37 | #if USE_IPV6 | 38 | #if USE_IPV6 |
diff --git a/plugins/netutils.h b/plugins/netutils.h index 5a495c91..347509e2 100644 --- a/plugins/netutils.h +++ b/plugins/netutils.h | |||
@@ -81,20 +81,14 @@ void host_or_die(const char *str); | |||
81 | # define is_hostname(addr) resolve_host_or_addr(addr, AF_INET) | 81 | # define is_hostname(addr) resolve_host_or_addr(addr, AF_INET) |
82 | #endif | 82 | #endif |
83 | 83 | ||
84 | #ifdef LOCAL_TIMEOUT_ALARM_HANDLER | ||
85 | extern unsigned int socket_timeout; | 84 | extern unsigned int socket_timeout; |
86 | extern int socket_timeout_state; | 85 | extern unsigned int socket_timeout_state; |
87 | RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); | ||
88 | #else | ||
89 | unsigned int socket_timeout = DEFAULT_SOCKET_TIMEOUT; | ||
90 | unsigned int socket_timeout_state = STATE_CRITICAL; | ||
91 | extern RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); | ||
92 | #endif | ||
93 | |||
94 | extern int econn_refuse_state; | 86 | extern int econn_refuse_state; |
95 | extern int was_refused; | 87 | extern int was_refused; |
96 | extern int address_family; | 88 | extern int address_family; |
97 | 89 | ||
90 | RETSIGTYPE socket_timeout_alarm_handler (int) __attribute__((noreturn)); | ||
91 | |||
98 | /* SSL-Related functionality */ | 92 | /* SSL-Related functionality */ |
99 | #ifdef HAVE_SSL | 93 | #ifdef HAVE_SSL |
100 | /* maybe this could be merged with the above np_net_connect, via some flags */ | 94 | /* maybe this could be merged with the above np_net_connect, via some flags */ |
diff --git a/plugins/sslutils.c b/plugins/sslutils.c index 818f7996..b8d45813 100644 --- a/plugins/sslutils.c +++ b/plugins/sslutils.c | |||
@@ -27,7 +27,6 @@ | |||
27 | *****************************************************************************/ | 27 | *****************************************************************************/ |
28 | 28 | ||
29 | #define MAX_CN_LENGTH 256 | 29 | #define MAX_CN_LENGTH 256 |
30 | #define LOCAL_TIMEOUT_ALARM_HANDLER | ||
31 | #include "common.h" | 30 | #include "common.h" |
32 | #include "netutils.h" | 31 | #include "netutils.h" |
33 | 32 | ||
diff --git a/plugins/utils.c b/plugins/utils.c index 8827e31a..b57d5e17 100644 --- a/plugins/utils.c +++ b/plugins/utils.c | |||
@@ -22,8 +22,6 @@ | |||
22 | * | 22 | * |
23 | *****************************************************************************/ | 23 | *****************************************************************************/ |
24 | 24 | ||
25 | #define LOCAL_TIMEOUT_ALARM_HANDLER | ||
26 | |||
27 | #include "common.h" | 25 | #include "common.h" |
28 | #include "utils.h" | 26 | #include "utils.h" |
29 | #include "utils_base.h" | 27 | #include "utils_base.h" |
@@ -38,6 +36,11 @@ extern const char *progname; | |||
38 | #define STRLEN 64 | 36 | #define STRLEN 64 |
39 | #define TXTBLK 128 | 37 | #define TXTBLK 128 |
40 | 38 | ||
39 | unsigned int timeout_state = STATE_CRITICAL; | ||
40 | unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT; | ||
41 | |||
42 | time_t start_time, end_time; | ||
43 | |||
41 | /* ************************************************************************** | 44 | /* ************************************************************************** |
42 | * max_state(STATE_x, STATE_y) | 45 | * max_state(STATE_x, STATE_y) |
43 | * compares STATE_x to STATE_y and returns result based on the following | 46 | * compares STATE_x to STATE_y and returns result based on the following |
diff --git a/plugins/utils.h b/plugins/utils.h index 822be940..657d4bfa 100644 --- a/plugins/utils.h +++ b/plugins/utils.h | |||
@@ -31,17 +31,12 @@ void print_revision (const char *, const char *); | |||
31 | 31 | ||
32 | /* Handle timeouts */ | 32 | /* Handle timeouts */ |
33 | 33 | ||
34 | #ifdef LOCAL_TIMEOUT_ALARM_HANDLER | ||
35 | extern unsigned int timeout_state; | 34 | extern unsigned int timeout_state; |
36 | extern unsigned int timeout_interval; | 35 | extern unsigned int timeout_interval; |
36 | |||
37 | RETSIGTYPE timeout_alarm_handler (int); | 37 | RETSIGTYPE timeout_alarm_handler (int); |
38 | #else | ||
39 | unsigned int timeout_state = STATE_CRITICAL; | ||
40 | unsigned int timeout_interval = DEFAULT_SOCKET_TIMEOUT; | ||
41 | extern RETSIGTYPE timeout_alarm_handler (int); | ||
42 | #endif | ||
43 | 38 | ||
44 | time_t start_time, end_time; | 39 | extern time_t start_time, end_time; |
45 | 40 | ||
46 | /* Test input types */ | 41 | /* Test input types */ |
47 | 42 | ||