diff options
author | Jeremy T. Bouse <undrgrid@users.sourceforge.net> | 2003-06-30 19:47:21 +0000 |
---|---|---|
committer | Jeremy T. Bouse <undrgrid@users.sourceforge.net> | 2003-06-30 19:47:21 +0000 |
commit | f813c747a264906c066d85d220e7b0f4aab3e046 (patch) | |
tree | ba8dd633c0a5b5e92355adb606d190cd0863023b /plugins/check_ldap.c | |
parent | 97634d8fc6bba849f771eda24106d88104e703b9 (diff) | |
download | monitoring-plugins-f813c747a264906c066d85d220e7b0f4aab3e046.tar.gz |
Added -4 and -6 command line options into check_http, check_ldap and
check_smtp
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@575 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_ldap.c')
-rw-r--r-- | plugins/check_ldap.c | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index 8eb89569..af919f27 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c | |||
@@ -159,6 +159,8 @@ process_arguments (int argc, char **argv) | |||
159 | {"ver2", no_argument, 0, '2'}, | 159 | {"ver2", no_argument, 0, '2'}, |
160 | {"ver3", no_argument, 0, '3'}, | 160 | {"ver3", no_argument, 0, '3'}, |
161 | #endif | 161 | #endif |
162 | {"use-ipv4", no_argument, 0, '4'}, | ||
163 | {"use-ipv6", no_argument, 0, '6'}, | ||
162 | {"port", required_argument, 0, 'p'}, | 164 | {"port", required_argument, 0, 'p'}, |
163 | {"warn", required_argument, 0, 'w'}, | 165 | {"warn", required_argument, 0, 'w'}, |
164 | {"crit", required_argument, 0, 'c'}, | 166 | {"crit", required_argument, 0, 'c'}, |
@@ -174,7 +176,7 @@ process_arguments (int argc, char **argv) | |||
174 | } | 176 | } |
175 | 177 | ||
176 | while (1) { | 178 | while (1) { |
177 | c = getopt_long (argc, argv, "hV23t:c:w:H:b:p:a:D:P:", longopts, &option_index); | 179 | c = getopt_long (argc, argv, "hV2346t:c:w:H:b:p:a:D:P:", longopts, &option_index); |
178 | 180 | ||
179 | if (c == -1 || c == EOF) | 181 | if (c == -1 || c == EOF) |
180 | break; | 182 | break; |
@@ -223,14 +225,28 @@ process_arguments (int argc, char **argv) | |||
223 | ld_protocol = 3; | 225 | ld_protocol = 3; |
224 | break; | 226 | break; |
225 | #endif | 227 | #endif |
228 | case '4': | ||
229 | address_family = AF_INET; | ||
230 | break; | ||
231 | case '6': | ||
232 | #ifdef USE_IPV6 | ||
233 | address_family = AF_INET6; | ||
234 | #else | ||
235 | usage ("IPv6 support not available\n"); | ||
236 | #endif | ||
237 | break; | ||
226 | default: | 238 | default: |
227 | usage ("check_ldap: could not parse unknown arguments\n"); | 239 | usage ("check_ldap: could not parse unknown arguments\n"); |
228 | break; | 240 | break; |
229 | } | 241 | } |
230 | } | 242 | } |
231 | 243 | ||
232 | if (ld_host[0] == 0) { | 244 | c = optind; |
233 | asprintf (&ld_host, "%s", argv[c]); | 245 | if (strlen(ld_host) == 0 && is_host(argv[c])) { |
246 | asprintf (&ld_host, "%s", argv[c++]); | ||
247 | } | ||
248 | if (strlen(ld_base) == 0 && argv[c]) { | ||
249 | asprintf (&ld_base, "%s", argv[c++]); | ||
234 | } | 250 | } |
235 | 251 | ||
236 | return validate_arguments (); | 252 | return validate_arguments (); |
@@ -271,8 +287,10 @@ print_help () | |||
271 | "\t-P [--pass] ... ldap password (if required)\n" | 287 | "\t-P [--pass] ... ldap password (if required)\n" |
272 | "\t-p [--port] ... ldap port (default: %d)\n" | 288 | "\t-p [--port] ... ldap port (default: %d)\n" |
273 | #ifdef HAVE_LDAP_SET_OPTION | 289 | #ifdef HAVE_LDAP_SET_OPTION |
274 | "\t-2 [--ver2] ... use ldap porotocol version 2\n" | 290 | "\t-2 [--ver2] ... use ldap protocol version 2\n" |
275 | "\t-3 [--ver3] ... use ldap porotocol version 3\n" | 291 | "\t-3 [--ver3] ... use ldap protocol version 3\n" |
292 | "\t-4 [--use-ipv4] ... use IPv4 protocol\n" | ||
293 | "\t-6 [--use-ipv6] ... use IPv6 protocol\n" | ||
276 | "\t\t(default protocol version: %d)\n" | 294 | "\t\t(default protocol version: %d)\n" |
277 | #endif | 295 | #endif |
278 | "\t-w [--warn] ... time in secs. - if the exceeds <warn> the STATE_WARNING will be returned\n" | 296 | "\t-w [--warn] ... time in secs. - if the exceeds <warn> the STATE_WARNING will be returned\n" |
@@ -292,7 +310,7 @@ print_usage () | |||
292 | ("Usage: %s -H <host> -b <base_dn> [-p <port>] [-a <attr>] [-D <binddn>]\n" | 310 | ("Usage: %s -H <host> -b <base_dn> [-p <port>] [-a <attr>] [-D <binddn>]\n" |
293 | " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n" | 311 | " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n" |
294 | #ifdef HAVE_LDAP_SET_OPTION | 312 | #ifdef HAVE_LDAP_SET_OPTION |
295 | " [-2|-3]\n" | 313 | " [-2|-3] [-4|-6]\n" |
296 | #endif | 314 | #endif |
297 | "(Note: all times are in seconds.)\n", progname); | 315 | "(Note: all times are in seconds.)\n", progname); |
298 | } | 316 | } |