diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-30 00:03:24 +0200 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-09-30 00:03:24 +0200 |
| commit | 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 (patch) | |
| tree | 1c2b6b21704a294940f87c7892676998d8371707 /web/attachments/38944-check_ldap.c.patch | |
| download | site-0b6423f9c99d9edf8c96fefd0f6c453859395aa1.tar.gz | |
Import Nagios Plugins site
Import the Nagios Plugins web site, Cronjobs, infrastructure scripts,
and configuration files.
Diffstat (limited to 'web/attachments/38944-check_ldap.c.patch')
| -rw-r--r-- | web/attachments/38944-check_ldap.c.patch | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/web/attachments/38944-check_ldap.c.patch b/web/attachments/38944-check_ldap.c.patch new file mode 100644 index 0000000..50c5f86 --- /dev/null +++ b/web/attachments/38944-check_ldap.c.patch | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | --- check_ldap.c Thu Nov 14 17:04:51 2002 | ||
| 2 | +++ check_ldap.c.new Mon Jan 6 02:15:41 2003 | ||
| 3 | @@ -32,6 +32,7 @@ | ||
| 4 | #include <ldap.h> | ||
| 5 | |||
| 6 | #define UNKNOWN -1 | ||
| 7 | +#define E_MOREARGS 3 | ||
| 8 | |||
| 9 | int process_arguments (int, char **); | ||
| 10 | int validate_arguments (void); | ||
| 11 | @@ -53,10 +54,11 @@ | ||
| 12 | |||
| 13 | int t_diff; | ||
| 14 | time_t time0, time1; | ||
| 15 | - | ||
| 16 | - if (process_arguments (argc, argv) == ERROR) | ||
| 17 | + int state = process_arguments (argc, argv); | ||
| 18 | + if (state == ERROR) | ||
| 19 | usage ("check_ldap: could not parse arguments\n"); | ||
| 20 | - | ||
| 21 | + if (state == E_MOREARGS) | ||
| 22 | + usage ("check_ldap: four arguments are required\n"); | ||
| 23 | /* initialize alarm signal handling */ | ||
| 24 | signal (SIGALRM, socket_timeout_alarm_handler); | ||
| 25 | |||
| 26 | @@ -143,7 +145,7 @@ | ||
| 27 | #endif | ||
| 28 | |||
| 29 | if (argc < 2) | ||
| 30 | - return ERROR; | ||
| 31 | + return E_MOREARGS; | ||
| 32 | |||
| 33 | for (c = 1; c < argc; c++) { | ||
| 34 | if (strcmp ("-to", argv[c]) == 0) | ||
| 35 | @@ -212,10 +214,10 @@ | ||
| 36 | int | ||
| 37 | validate_arguments () | ||
| 38 | { | ||
| 39 | - if (ld_host[0] == 0 || | ||
| 40 | - ld_base[0] == 0 || | ||
| 41 | + if (ld_host == 0 || | ||
| 42 | + ld_base == 0 || | ||
| 43 | ld_port == UNKNOWN || warn_time == UNKNOWN || crit_time == UNKNOWN) { | ||
| 44 | - return ERROR; | ||
| 45 | + return E_MOREARGS; | ||
| 46 | } | ||
| 47 | else { | ||
| 48 | return OK; | ||
| 49 | @@ -241,7 +243,7 @@ | ||
| 50 | "\t-b [--base] ... ldap base (eg. ou=my unit, o=my org, c=at)\n" | ||
| 51 | "\t-D [--bind] ... ldap bind DN (if required)\n" | ||
| 52 | "\t-P [--pass] ... ldap password (if required)\n" | ||
| 53 | - "\t-p [--port] ... ldap port (normaly 389)\n" | ||
| 54 | + "\t-p [--port] ... ldap port (defaults to 389)\n" | ||
| 55 | "\t-w [--warn] ... time in secs. - if the exceeds <warn> the STATE_WARNING will be returned\n" | ||
| 56 | "\t-c [--crit] ... time in secs. - if the exceeds <crit> the STATE_CRITICAL will be returned\n" | ||
| 57 | "\n"); | ||
| 58 | @@ -252,7 +254,7 @@ | ||
| 59 | print_usage () | ||
| 60 | { | ||
| 61 | printf | ||
| 62 | - ("Usage: %s -H <host> -b <base_dn> -p <port> [-a <attr>] [-D <binddn>]\n" | ||
| 63 | - " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n" | ||
| 64 | + ("Usage: %s -H <host> -b <base_dn> -w <warn_time> -c <crit_time>\n" | ||
| 65 | + "[-p <port>] [-a <attr>] [-D <binddn>] [-P <password>] [-t time out]\n" | ||
| 66 | "(Note: all times are in seconds.)\n", PROGNAME); | ||
| 67 | } | ||
