diff options
author | Lorenz Kästle <12514511+RincewindsHat@users.noreply.github.com> | 2024-11-08 23:04:19 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-08 23:04:19 +0100 |
commit | b370072a5a1e21876abf8cf95f4622c02565ae07 (patch) | |
tree | 5856b120cba767922c8af0cf9d9b25c48bb32ed9 | |
parent | ef39064f5148d96a6923f60a2fadd12810fcfa06 (diff) | |
parent | e8905c9e9c96b5b57f64edf0d5c7429aa39341b8 (diff) | |
download | monitoring-plugins-b370072a5a1e21876abf8cf95f4622c02565ae07.tar.gz |
Merge pull request #2043 from RincewindsHat/cleanup/leftovers
Cleanup/leftovers
-rw-r--r-- | plugins/check_ide_smart.c | 6 | ||||
-rw-r--r-- | plugins/check_ldap.c | 42 | ||||
-rw-r--r-- | plugins/check_mysql.c | 42 | ||||
-rw-r--r-- | plugins/check_nt.c | 39 | ||||
-rw-r--r-- | plugins/check_ntp.c | 8 | ||||
-rw-r--r-- | plugins/check_nwstat.c | 48 | ||||
-rw-r--r-- | plugins/check_overcr.c | 31 | ||||
-rw-r--r-- | plugins/check_procs.c | 58 | ||||
-rw-r--r-- | plugins/check_radius.c | 28 | ||||
-rw-r--r-- | plugins/check_smtp.c | 98 | ||||
-rw-r--r-- | plugins/check_ups.c | 10 |
11 files changed, 201 insertions, 209 deletions
diff --git a/plugins/check_ide_smart.c b/plugins/check_ide_smart.c index 381dbd80..9640ef70 100644 --- a/plugins/check_ide_smart.c +++ b/plugins/check_ide_smart.c | |||
@@ -113,12 +113,10 @@ typedef struct values_s { | |||
113 | __u8 checksum; | 113 | __u8 checksum; |
114 | } __attribute__((packed)) values_t; | 114 | } __attribute__((packed)) values_t; |
115 | 115 | ||
116 | struct { | 116 | static struct { |
117 | __u8 value; | 117 | __u8 value; |
118 | char *text; | 118 | char *text; |
119 | } | 119 | } offline_status_text[] = {{0x00, "NeverStarted"}, {0x02, "Completed"}, {0x04, "Suspended"}, |
120 | |||
121 | static offline_status_text[] = {{0x00, "NeverStarted"}, {0x02, "Completed"}, {0x04, "Suspended"}, | ||
122 | {0x05, "Aborted"}, {0x06, "Failed"}, {0, 0}}; | 120 | {0x05, "Aborted"}, {0x06, "Failed"}, {0, 0}}; |
123 | 121 | ||
124 | static struct { | 122 | static struct { |
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index 1c728292..87818da6 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c | |||
@@ -47,37 +47,37 @@ enum { | |||
47 | DEFAULT_PORT = 389 | 47 | DEFAULT_PORT = 389 |
48 | }; | 48 | }; |
49 | 49 | ||
50 | int process_arguments (int, char **); | 50 | static int process_arguments (int, char **); |
51 | int validate_arguments (void); | 51 | static int validate_arguments (void); |
52 | void print_help (void); | 52 | static void print_help (void); |
53 | void print_usage (void); | 53 | void print_usage (void); |
54 | 54 | ||
55 | char ld_defattr[] = "(objectclass=*)"; | 55 | static char ld_defattr[] = "(objectclass=*)"; |
56 | char *ld_attr = ld_defattr; | 56 | static char *ld_attr = ld_defattr; |
57 | char *ld_host = NULL; | 57 | static char *ld_host = NULL; |
58 | char *ld_base = NULL; | 58 | static char *ld_base = NULL; |
59 | char *ld_passwd = NULL; | 59 | static char *ld_passwd = NULL; |
60 | char *ld_binddn = NULL; | 60 | static char *ld_binddn = NULL; |
61 | int ld_port = -1; | 61 | static int ld_port = -1; |
62 | #ifdef HAVE_LDAP_SET_OPTION | 62 | #ifdef HAVE_LDAP_SET_OPTION |
63 | int ld_protocol = DEFAULT_PROTOCOL; | 63 | static int ld_protocol = DEFAULT_PROTOCOL; |
64 | #endif | 64 | #endif |
65 | #ifndef LDAP_OPT_SUCCESS | 65 | #ifndef LDAP_OPT_SUCCESS |
66 | # define LDAP_OPT_SUCCESS LDAP_SUCCESS | 66 | # define LDAP_OPT_SUCCESS LDAP_SUCCESS |
67 | #endif | 67 | #endif |
68 | double warn_time = UNDEFINED; | 68 | static double warn_time = UNDEFINED; |
69 | double crit_time = UNDEFINED; | 69 | static double crit_time = UNDEFINED; |
70 | thresholds *entries_thresholds = NULL; | 70 | static thresholds *entries_thresholds = NULL; |
71 | struct timeval tv; | 71 | static struct timeval tv; |
72 | char* warn_entries = NULL; | 72 | static char* warn_entries = NULL; |
73 | char* crit_entries = NULL; | 73 | static char* crit_entries = NULL; |
74 | bool starttls = false; | 74 | static bool starttls = false; |
75 | bool ssl_on_connect = false; | 75 | static bool ssl_on_connect = false; |
76 | bool verbose = false; | 76 | static bool verbose = false; |
77 | 77 | ||
78 | /* for ldap tls */ | 78 | /* for ldap tls */ |
79 | 79 | ||
80 | char *SERVICE = "LDAP"; | 80 | static char *SERVICE = "LDAP"; |
81 | 81 | ||
82 | int | 82 | int |
83 | main (int argc, char *argv[]) | 83 | main (int argc, char *argv[]) |
diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 1f0b7099..8a73772d 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c | |||
@@ -45,23 +45,23 @@ const char *email = "devel@monitoring-plugins.org"; | |||
45 | #include <mysqld_error.h> | 45 | #include <mysqld_error.h> |
46 | #include <errmsg.h> | 46 | #include <errmsg.h> |
47 | 47 | ||
48 | char *db_user = NULL; | 48 | static char *db_user = NULL; |
49 | char *db_host = NULL; | 49 | static char *db_host = NULL; |
50 | char *db_socket = NULL; | 50 | static char *db_socket = NULL; |
51 | char *db_pass = NULL; | 51 | static char *db_pass = NULL; |
52 | char *db = NULL; | 52 | static char *db = NULL; |
53 | char *ca_cert = NULL; | 53 | static char *ca_cert = NULL; |
54 | char *ca_dir = NULL; | 54 | static char *ca_dir = NULL; |
55 | char *cert = NULL; | 55 | static char *cert = NULL; |
56 | char *key = NULL; | 56 | static char *key = NULL; |
57 | char *ciphers = NULL; | 57 | static char *ciphers = NULL; |
58 | bool ssl = false; | 58 | static bool ssl = false; |
59 | char *opt_file = NULL; | 59 | static char *opt_file = NULL; |
60 | char *opt_group = NULL; | 60 | static char *opt_group = NULL; |
61 | unsigned int db_port = MYSQL_PORT; | 61 | static unsigned int db_port = MYSQL_PORT; |
62 | bool check_slave = false; | 62 | static bool check_slave = false; |
63 | bool ignore_auth = false; | 63 | static bool ignore_auth = false; |
64 | int verbose = 0; | 64 | static int verbose = 0; |
65 | 65 | ||
66 | static double warning_time = 0; | 66 | static double warning_time = 0; |
67 | static double critical_time = 0; | 67 | static double critical_time = 0; |
@@ -91,11 +91,11 @@ static const char *metric_counter[LENGTH_METRIC_COUNTER] = { | |||
91 | 91 | ||
92 | #define MYSQLDUMP_THREADS_QUERY "SELECT COUNT(1) mysqldumpThreads FROM information_schema.processlist WHERE info LIKE 'SELECT /*!40001 SQL_NO_CACHE */%'" | 92 | #define MYSQLDUMP_THREADS_QUERY "SELECT COUNT(1) mysqldumpThreads FROM information_schema.processlist WHERE info LIKE 'SELECT /*!40001 SQL_NO_CACHE */%'" |
93 | 93 | ||
94 | thresholds *my_threshold = NULL; | 94 | static thresholds *my_threshold = NULL; |
95 | 95 | ||
96 | int process_arguments (int, char **); | 96 | static int process_arguments (int, char **); |
97 | int validate_arguments (void); | 97 | static int validate_arguments (void); |
98 | void print_help (void); | 98 | static void print_help (void); |
99 | void print_usage (void); | 99 | void print_usage (void); |
100 | 100 | ||
101 | int | 101 | int |
diff --git a/plugins/check_nt.c b/plugins/check_nt.c index 413aad6b..dec0b668 100644 --- a/plugins/check_nt.c +++ b/plugins/check_nt.c | |||
@@ -59,26 +59,25 @@ enum { | |||
59 | PORT = 1248 | 59 | PORT = 1248 |
60 | }; | 60 | }; |
61 | 61 | ||
62 | char *server_address = NULL; | 62 | static char *server_address = NULL; |
63 | char *volume_name = NULL; | 63 | static int server_port = PORT; |
64 | int server_port = PORT; | 64 | static char *value_list = NULL; |
65 | char *value_list = NULL; | 65 | static char *req_password = NULL; |
66 | char *req_password = NULL; | 66 | static unsigned long lvalue_list[MAX_VALUE_LIST]; |
67 | unsigned long lvalue_list[MAX_VALUE_LIST]; | 67 | static unsigned long warning_value = 0L; |
68 | unsigned long warning_value = 0L; | 68 | static unsigned long critical_value = 0L; |
69 | unsigned long critical_value = 0L; | 69 | static bool check_warning_value = false; |
70 | bool check_warning_value = false; | 70 | static bool check_critical_value = false; |
71 | bool check_critical_value = false; | 71 | static enum checkvars vars_to_check = CHECK_NONE; |
72 | enum checkvars vars_to_check = CHECK_NONE; | 72 | static bool show_all = false; |
73 | bool show_all = false; | 73 | |
74 | 74 | static char recv_buffer[MAX_INPUT_BUFFER]; | |
75 | char recv_buffer[MAX_INPUT_BUFFER]; | 75 | |
76 | 76 | static void fetch_data(const char *address, int port, const char *sendb); | |
77 | void fetch_data(const char *address, int port, const char *sendb); | 77 | static int process_arguments(int /*argc*/, char ** /*argv*/); |
78 | int process_arguments(int, char **); | 78 | static void preparelist(char *string); |
79 | void preparelist(char *string); | 79 | static bool strtoularray(unsigned long *array, char *string, const char *delim); |
80 | bool strtoularray(unsigned long *array, char *string, const char *delim); | 80 | static void print_help(void); |
81 | void print_help(void); | ||
82 | void print_usage(void); | 81 | void print_usage(void); |
83 | 82 | ||
84 | int main(int argc, char **argv) { | 83 | int main(int argc, char **argv) { |
diff --git a/plugins/check_ntp.c b/plugins/check_ntp.c index 55a49460..d33f8786 100644 --- a/plugins/check_ntp.c +++ b/plugins/check_ntp.c | |||
@@ -47,10 +47,10 @@ static bool do_jitter = false; | |||
47 | static char *jwarn="5000"; | 47 | static char *jwarn="5000"; |
48 | static char *jcrit="10000"; | 48 | static char *jcrit="10000"; |
49 | 49 | ||
50 | int process_arguments (int, char **); | 50 | static int process_arguments (int /*argc*/, char ** /*argv*/); |
51 | thresholds *offset_thresholds = NULL; | 51 | static thresholds *offset_thresholds = NULL; |
52 | thresholds *jitter_thresholds = NULL; | 52 | static thresholds *jitter_thresholds = NULL; |
53 | void print_help (void); | 53 | static void print_help (void); |
54 | void print_usage (void); | 54 | void print_usage (void); |
55 | 55 | ||
56 | /* number of times to perform each request to get a good average. */ | 56 | /* number of times to perform each request to get a good average. */ |
diff --git a/plugins/check_nwstat.c b/plugins/check_nwstat.c index 3af63603..176dfbc8 100644 --- a/plugins/check_nwstat.c +++ b/plugins/check_nwstat.c | |||
@@ -89,30 +89,30 @@ enum { | |||
89 | PORT = 9999 | 89 | PORT = 9999 |
90 | }; | 90 | }; |
91 | 91 | ||
92 | char *server_address = NULL; | 92 | static char *server_address = NULL; |
93 | char *volume_name = NULL; | 93 | static char *volume_name = NULL; |
94 | char *nlm_name = NULL; | 94 | static char *nlm_name = NULL; |
95 | char *nrmp_name = NULL; | 95 | static char *nrmp_name = NULL; |
96 | char *nrmm_name = NULL; | 96 | static char *nrmm_name = NULL; |
97 | char *nrms_name = NULL; | 97 | static char *nrms_name = NULL; |
98 | char *nss1_name = NULL; | 98 | static char *nss1_name = NULL; |
99 | char *nss2_name = NULL; | 99 | static char *nss2_name = NULL; |
100 | char *nss3_name = NULL; | 100 | static char *nss3_name = NULL; |
101 | char *nss4_name = NULL; | 101 | static char *nss4_name = NULL; |
102 | char *nss5_name = NULL; | 102 | static char *nss5_name = NULL; |
103 | char *nss6_name = NULL; | 103 | static char *nss6_name = NULL; |
104 | char *nss7_name = NULL; | 104 | static char *nss7_name = NULL; |
105 | int server_port = PORT; | 105 | static int server_port = PORT; |
106 | unsigned long warning_value = 0L; | 106 | static unsigned long warning_value = 0L; |
107 | unsigned long critical_value = 0L; | 107 | static unsigned long critical_value = 0L; |
108 | bool check_warning_value = false; | 108 | static bool check_warning_value = false; |
109 | bool check_critical_value = false; | 109 | static bool check_critical_value = false; |
110 | bool check_netware_version = false; | 110 | static bool check_netware_version = false; |
111 | enum checkvar vars_to_check = NONE; | 111 | static enum checkvar vars_to_check = NONE; |
112 | int sap_number = -1; | 112 | static int sap_number = -1; |
113 | 113 | ||
114 | int process_arguments(int, char **); | 114 | static int process_arguments(int /*argc*/, char ** /*argv*/); |
115 | void print_help(void); | 115 | static void print_help(void); |
116 | void print_usage(void); | 116 | void print_usage(void); |
117 | 117 | ||
118 | int main(int argc, char **argv) { | 118 | int main(int argc, char **argv) { |
diff --git a/plugins/check_overcr.c b/plugins/check_overcr.c index e80d4775..599540b7 100644 --- a/plugins/check_overcr.c +++ b/plugins/check_overcr.c | |||
@@ -52,23 +52,22 @@ enum { | |||
52 | PORT = 2000 | 52 | PORT = 2000 |
53 | }; | 53 | }; |
54 | 54 | ||
55 | char *server_address = NULL; | 55 | static char *server_address = NULL; |
56 | int server_port = PORT; | 56 | static int server_port = PORT; |
57 | double warning_value = 0L; | 57 | static double warning_value = 0L; |
58 | double critical_value = 0L; | 58 | static double critical_value = 0L; |
59 | bool check_warning_value = false; | 59 | static bool check_warning_value = false; |
60 | bool check_critical_value = false; | 60 | static bool check_critical_value = false; |
61 | enum checkvar vars_to_check = NONE; | 61 | static enum checkvar vars_to_check = NONE; |
62 | int cmd_timeout = 1; | 62 | |
63 | 63 | static int netstat_port = 0; | |
64 | int netstat_port = 0; | 64 | static char *disk_name = NULL; |
65 | char *disk_name = NULL; | 65 | static char *process_name = NULL; |
66 | char *process_name = NULL; | 66 | static char send_buffer[MAX_INPUT_BUFFER]; |
67 | char send_buffer[MAX_INPUT_BUFFER]; | 67 | |
68 | 68 | static int process_arguments(int, char **); | |
69 | int process_arguments(int, char **); | ||
70 | void print_usage(void); | 69 | void print_usage(void); |
71 | void print_help(void); | 70 | static void print_help(void); |
72 | 71 | ||
73 | int main(int argc, char **argv) { | 72 | int main(int argc, char **argv) { |
74 | int result = STATE_UNKNOWN; | 73 | int result = STATE_UNKNOWN; |
diff --git a/plugins/check_procs.c b/plugins/check_procs.c index 5777ba07..1d78ccee 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c | |||
@@ -51,17 +51,17 @@ const char *email = "devel@monitoring-plugins.org"; | |||
51 | #include <sys/stat.h> | 51 | #include <sys/stat.h> |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | int process_arguments (int, char **); | 54 | static int process_arguments (int /*argc*/, char ** /*argv*/); |
55 | int validate_arguments (void); | 55 | static int validate_arguments (void); |
56 | int convert_to_seconds (char *); | 56 | static int convert_to_seconds (char * /*etime*/); |
57 | void print_help (void); | 57 | static void print_help (void); |
58 | void print_usage (void); | 58 | void print_usage (void); |
59 | 59 | ||
60 | char *warning_range = NULL; | 60 | static char *warning_range = NULL; |
61 | char *critical_range = NULL; | 61 | static char *critical_range = NULL; |
62 | thresholds *procs_thresholds = NULL; | 62 | static thresholds *procs_thresholds = NULL; |
63 | 63 | ||
64 | int options = 0; /* bitmask of filter criteria to test against */ | 64 | static int options = 0; /* bitmask of filter criteria to test against */ |
65 | #define ALL 1 | 65 | #define ALL 1 |
66 | #define STAT 2 | 66 | #define STAT 2 |
67 | #define PPID 4 | 67 | #define PPID 4 |
@@ -89,27 +89,25 @@ enum metric { | |||
89 | }; | 89 | }; |
90 | enum metric metric = METRIC_PROCS; | 90 | enum metric metric = METRIC_PROCS; |
91 | 91 | ||
92 | int verbose = 0; | 92 | static int verbose = 0; |
93 | int uid; | 93 | static int uid; |
94 | pid_t ppid; | 94 | static pid_t ppid; |
95 | int vsz; | 95 | static int vsz; |
96 | int rss; | 96 | static int rss; |
97 | float pcpu; | 97 | static float pcpu; |
98 | char *statopts; | 98 | static char *statopts; |
99 | char *prog; | 99 | static char *prog; |
100 | char *exclude_progs; | 100 | static char *exclude_progs; |
101 | char **exclude_progs_arr = NULL; | 101 | static char **exclude_progs_arr = NULL; |
102 | char exclude_progs_counter = 0; | 102 | static char exclude_progs_counter = 0; |
103 | char *args; | 103 | static char *args; |
104 | char *input_filename = NULL; | 104 | static char *input_filename = NULL; |
105 | regex_t re_args; | 105 | static regex_t re_args; |
106 | char *fmt; | 106 | static char *fmt; |
107 | char *fails; | 107 | static char *fails; |
108 | char tmp[MAX_INPUT_BUFFER]; | 108 | static char tmp[MAX_INPUT_BUFFER]; |
109 | int kthread_filter = 0; | 109 | static int kthread_filter = 0; |
110 | int usepid = 0; /* whether to test for pid or /proc/pid/exe */ | 110 | static int usepid = 0; /* whether to test for pid or /proc/pid/exe */ |
111 | |||
112 | FILE *ps_input = NULL; | ||
113 | 111 | ||
114 | static int | 112 | static int |
115 | stat_exe (const pid_t pid, struct stat *buf) { | 113 | stat_exe (const pid_t pid, struct stat *buf) { |
@@ -834,7 +832,7 @@ be the total number of running processes\n\n")); | |||
834 | printf (" %s\n", "check_procs -w 50000 -c 100000 --metric=VSZ"); | 832 | printf (" %s\n", "check_procs -w 50000 -c 100000 --metric=VSZ"); |
835 | printf (" %s\n\n", _("Alert if VSZ of any processes over 50K or 100K")); | 833 | printf (" %s\n\n", _("Alert if VSZ of any processes over 50K or 100K")); |
836 | printf (" %s\n", "check_procs -w 10 -c 20 --metric=CPU"); | 834 | printf (" %s\n", "check_procs -w 10 -c 20 --metric=CPU"); |
837 | printf (" %s\n", _("Alert if CPU of any processes over 10\% or 20\%")); | 835 | printf (" %s\n", _("Alert if CPU of any processes over 10%% or 20%%")); |
838 | 836 | ||
839 | printf (UT_SUPPORT); | 837 | printf (UT_SUPPORT); |
840 | } | 838 | } |
diff --git a/plugins/check_radius.c b/plugins/check_radius.c index 8ed19e55..d9ff8fa7 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c | |||
@@ -46,8 +46,8 @@ const char *email = "devel@monitoring-plugins.org"; | |||
46 | #include <radiusclient.h> | 46 | #include <radiusclient.h> |
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | int process_arguments (int, char **); | 49 | static int process_arguments (int /*argc*/, char ** /*argv*/); |
50 | void print_help (void); | 50 | static void print_help (void); |
51 | void print_usage (void); | 51 | void print_usage (void); |
52 | 52 | ||
53 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI) | 53 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI) |
@@ -78,22 +78,22 @@ void print_usage (void); | |||
78 | #define REJECT_RC BADRESP_RC | 78 | #define REJECT_RC BADRESP_RC |
79 | #endif | 79 | #endif |
80 | 80 | ||
81 | int my_rc_read_config(char *); | 81 | static int my_rc_read_config(char * /*a*/); |
82 | 82 | ||
83 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI) | 83 | #if defined(HAVE_LIBFREERADIUS_CLIENT) || defined(HAVE_LIBRADIUSCLIENT_NG) || defined(HAVE_LIBRADCLI) |
84 | rc_handle *rch = NULL; | 84 | static rc_handle *rch = NULL; |
85 | #endif | 85 | #endif |
86 | 86 | ||
87 | char *server = NULL; | 87 | static char *server = NULL; |
88 | char *username = NULL; | 88 | static char *username = NULL; |
89 | char *password = NULL; | 89 | static char *password = NULL; |
90 | char *nasid = NULL; | 90 | static char *nasid = NULL; |
91 | char *nasipaddress = NULL; | 91 | static char *nasipaddress = NULL; |
92 | char *expect = NULL; | 92 | static char *expect = NULL; |
93 | char *config_file = NULL; | 93 | static char *config_file = NULL; |
94 | unsigned short port = PW_AUTH_UDP_PORT; | 94 | static unsigned short port = PW_AUTH_UDP_PORT; |
95 | int retries = 1; | 95 | static int retries = 1; |
96 | bool verbose = false; | 96 | static bool verbose = false; |
97 | 97 | ||
98 | /****************************************************************************** | 98 | /****************************************************************************** |
99 | 99 | ||
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index bc175287..e6369e63 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c | |||
@@ -40,8 +40,8 @@ const char *email = "devel@monitoring-plugins.org"; | |||
40 | #include <ctype.h> | 40 | #include <ctype.h> |
41 | 41 | ||
42 | #ifdef HAVE_SSL | 42 | #ifdef HAVE_SSL |
43 | bool check_cert = false; | 43 | static bool check_cert = false; |
44 | int days_till_exp_warn, days_till_exp_crit; | 44 | static int days_till_exp_warn, days_till_exp_crit; |
45 | # define my_recv(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) | 45 | # define my_recv(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_read(buf, len) : read(sd, buf, len)) |
46 | # define my_send(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0)) | 46 | # define my_send(buf, len) (((use_starttls || use_ssl) && ssl_established) ? np_net_ssl_write(buf, len) : send(sd, buf, len, 0)) |
47 | #else /* ifndef HAVE_SSL */ | 47 | #else /* ifndef HAVE_SSL */ |
@@ -64,61 +64,59 @@ enum { | |||
64 | 64 | ||
65 | #define EHLO_SUPPORTS_STARTTLS 1 | 65 | #define EHLO_SUPPORTS_STARTTLS 1 |
66 | 66 | ||
67 | int process_arguments (int, char **); | 67 | static int process_arguments (int, char **); |
68 | int validate_arguments (void); | 68 | static int validate_arguments (void); |
69 | void print_help (void); | 69 | static void print_help (void); |
70 | void print_usage (void); | 70 | void print_usage (void); |
71 | void smtp_quit(void); | 71 | static void smtp_quit(void); |
72 | int recvline(char *, size_t); | 72 | static int recvline(char *, size_t); |
73 | int recvlines(char *, size_t); | 73 | static int recvlines(char *, size_t); |
74 | int my_close(void); | 74 | static int my_close(void); |
75 | 75 | ||
76 | #include "regex.h" | 76 | #include "regex.h" |
77 | char regex_expect[MAX_INPUT_BUFFER] = ""; | 77 | static regex_t preg; |
78 | regex_t preg; | 78 | static regmatch_t pmatch[10]; |
79 | regmatch_t pmatch[10]; | 79 | static char errbuf[MAX_INPUT_BUFFER]; |
80 | char timestamp[20] = ""; | 80 | static int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; |
81 | char errbuf[MAX_INPUT_BUFFER]; | 81 | static int eflags = 0; |
82 | int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE; | 82 | static int errcode, excode; |
83 | int eflags = 0; | 83 | |
84 | int errcode, excode; | 84 | static int server_port = SMTP_PORT; |
85 | 85 | static int server_port_option = 0; | |
86 | int server_port = SMTP_PORT; | 86 | static char *server_address = NULL; |
87 | int server_port_option = 0; | 87 | static char *server_expect = NULL; |
88 | char *server_address = NULL; | 88 | static char *mail_command = NULL; |
89 | char *server_expect = NULL; | 89 | static char *from_arg = NULL; |
90 | char *mail_command = NULL; | 90 | static int send_mail_from=0; |
91 | char *from_arg = NULL; | 91 | static int ncommands=0; |
92 | int send_mail_from=0; | 92 | static int command_size=0; |
93 | int ncommands=0; | 93 | static int nresponses=0; |
94 | int command_size=0; | 94 | static int response_size=0; |
95 | int nresponses=0; | 95 | static char **commands = NULL; |
96 | int response_size=0; | 96 | static char **responses = NULL; |
97 | char **commands = NULL; | 97 | static char *authtype = NULL; |
98 | char **responses = NULL; | 98 | static char *authuser = NULL; |
99 | char *authtype = NULL; | 99 | static char *authpass = NULL; |
100 | char *authuser = NULL; | 100 | static double warning_time = 0; |
101 | char *authpass = NULL; | 101 | static bool check_warning_time = false; |
102 | double warning_time = 0; | 102 | static double critical_time = 0; |
103 | bool check_warning_time = false; | 103 | static bool check_critical_time = false; |
104 | double critical_time = 0; | 104 | static int verbose = 0; |
105 | bool check_critical_time = false; | 105 | static bool use_ssl = false; |
106 | int verbose = 0; | 106 | static bool use_starttls = false; |
107 | bool use_ssl = false; | 107 | static bool use_sni = false; |
108 | bool use_starttls = false; | 108 | static bool use_proxy_prefix = false; |
109 | bool use_sni = false; | 109 | static bool use_ehlo = false; |
110 | bool use_proxy_prefix = false; | 110 | static bool use_lhlo = false; |
111 | bool use_ehlo = false; | 111 | static bool ssl_established = false; |
112 | bool use_lhlo = false; | 112 | static char *localhostname = NULL; |
113 | bool ssl_established = false; | 113 | static int sd; |
114 | char *localhostname = NULL; | 114 | static char buffer[MAX_INPUT_BUFFER]; |
115 | int sd; | ||
116 | char buffer[MAX_INPUT_BUFFER]; | ||
117 | enum { | 115 | enum { |
118 | TCP_PROTOCOL = 1, | 116 | TCP_PROTOCOL = 1, |
119 | UDP_PROTOCOL = 2, | 117 | UDP_PROTOCOL = 2, |
120 | }; | 118 | }; |
121 | bool ignore_send_quit_failure = false; | 119 | static bool ignore_send_quit_failure = false; |
122 | 120 | ||
123 | 121 | ||
124 | int | 122 | int |
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index adb7ab81..526a29df 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c | |||
@@ -97,12 +97,12 @@ ups_config ups_config_init(void) { | |||
97 | } | 97 | } |
98 | 98 | ||
99 | // Forward declarations | 99 | // Forward declarations |
100 | int determine_status(ups_config *, int *supported_options); | 100 | static int determine_status(ups_config * /*config*/, int *supported_options); |
101 | int get_ups_variable(const char *, char *, const ups_config config); | 101 | static int get_ups_variable(const char * /*varname*/, char * /*buf*/, ups_config config); |
102 | 102 | ||
103 | int process_arguments(int, char **, ups_config *); | 103 | static int process_arguments(int /*argc*/, char ** /*argv*/, ups_config * /*config*/); |
104 | int validate_arguments(ups_config); | 104 | static int validate_arguments(ups_config /*config*/); |
105 | void print_help(void); | 105 | static void print_help(void); |
106 | void print_usage(void); | 106 | void print_usage(void); |
107 | 107 | ||
108 | int main(int argc, char **argv) { | 108 | int main(int argc, char **argv) { |