diff options
Diffstat (limited to 'web/attachments/52959-check_ldap.patch')
-rw-r--r-- | web/attachments/52959-check_ldap.patch | 121 |
1 files changed, 121 insertions, 0 deletions
diff --git a/web/attachments/52959-check_ldap.patch b/web/attachments/52959-check_ldap.patch new file mode 100644 index 0000000..dac7767 --- /dev/null +++ b/web/attachments/52959-check_ldap.patch | |||
@@ -0,0 +1,121 @@ | |||
1 | Index: configure.in | ||
2 | =================================================================== | ||
3 | RCS file: /cvsroot/nagiosplug/nagiosplug/configure.in,v | ||
4 | retrieving revision 1.81 | ||
5 | diff -u -r1.81 configure.in | ||
6 | --- configure.in 12 Jun 2003 04:16:34 -0000 1.81 | ||
7 | +++ configure.in 12 Jun 2003 23:03:02 -0000 | ||
8 | @@ -206,6 +206,7 @@ | ||
9 | LDAPINCLUDE="-I/usr/include/ldap" | ||
10 | AC_SUBST(LDAPLIBS) | ||
11 | AC_SUBST(LDAPINCLUDE) | ||
12 | + AC_CHECK_FUNCS(ldap_set_option) | ||
13 | EXTRAS="$EXTRAS check_ldap" | ||
14 | else | ||
15 | AC_MSG_WARN([Skipping LDAP plugin]) | ||
16 | Index: plugins/check_ldap.c | ||
17 | =================================================================== | ||
18 | RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ldap.c,v | ||
19 | retrieving revision 1.6 | ||
20 | diff -u -r1.6 check_ldap.c | ||
21 | --- plugins/check_ldap.c 12 Mar 2003 02:25:22 -0000 1.6 | ||
22 | +++ plugins/check_ldap.c 12 Jun 2003 23:03:02 -0000 | ||
23 | @@ -34,6 +34,9 @@ | ||
24 | enum { | ||
25 | UNDEFINED = -1, | ||
26 | DEFAULT_PORT = 389 | ||
27 | +#ifdef HAVE_LDAP_SET_OPTION | ||
28 | + , DEFAULT_PROTOCOL = 2 | ||
29 | +#endif | ||
30 | }; | ||
31 | |||
32 | int process_arguments (int, char **); | ||
33 | @@ -48,6 +51,9 @@ | ||
34 | char *ld_passwd = NULL; | ||
35 | char *ld_binddn = NULL; | ||
36 | unsigned int ld_port = DEFAULT_PORT; | ||
37 | +#ifdef HAVE_LDAP_SET_OPTION | ||
38 | +int ld_protocol = DEFAULT_PROTOCOL; | ||
39 | +#endif | ||
40 | int warn_time = UNDEFINED; | ||
41 | int crit_time = UNDEFINED; | ||
42 | |||
43 | @@ -80,6 +86,14 @@ | ||
44 | return STATE_CRITICAL; | ||
45 | } | ||
46 | |||
47 | +#ifdef HAVE_LDAP_SET_OPTION | ||
48 | + /* set ldap options */ | ||
49 | + if (ldap_set_option (ld, LDAP_OPT_PROTOCOL_VERSION, &ld_protocol) != | ||
50 | + LDAP_OPT_SUCCESS ) { | ||
51 | + printf("Could not set protocol version %d\n", ld_protocol); | ||
52 | + return STATE_CRITICAL; | ||
53 | + } | ||
54 | +#endif | ||
55 | /* bind to the ldap server */ | ||
56 | if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) != | ||
57 | LDAP_SUCCESS) { | ||
58 | @@ -141,6 +155,10 @@ | ||
59 | {"attr", required_argument, 0, 'a'}, | ||
60 | {"bind", required_argument, 0, 'D'}, | ||
61 | {"pass", required_argument, 0, 'P'}, | ||
62 | +#ifdef HAVE_LDAP_SET_OPTION | ||
63 | + {"ver2", no_argument, 0, '2'}, | ||
64 | + {"ver3", no_argument, 0, '3'}, | ||
65 | +#endif | ||
66 | {"port", required_argument, 0, 'p'}, | ||
67 | {"warn", required_argument, 0, 'w'}, | ||
68 | {"crit", required_argument, 0, 'c'}, | ||
69 | @@ -156,7 +174,7 @@ | ||
70 | } | ||
71 | |||
72 | while (1) { | ||
73 | - c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:", longopts, &option_index); | ||
74 | + c = getopt_long (argc, argv, "hV23t:c:w:H:b:p:a:D:P:", longopts, &option_index); | ||
75 | |||
76 | if (c == -1 || c == EOF) | ||
77 | break; | ||
78 | @@ -197,6 +215,14 @@ | ||
79 | case 'c': | ||
80 | crit_time = atoi (optarg); | ||
81 | break; | ||
82 | +#ifdef HAVE_LDAP_SET_OPTION | ||
83 | + case '2': | ||
84 | + ld_protocol = 2; | ||
85 | + break; | ||
86 | + case '3': | ||
87 | + ld_protocol = 3; | ||
88 | + break; | ||
89 | +#endif | ||
90 | default: | ||
91 | usage ("check_ldap: could not parse unknown arguments\n"); | ||
92 | break; | ||
93 | @@ -244,9 +270,18 @@ | ||
94 | "\t-D [--bind] ... ldap bind DN (if required)\n" | ||
95 | "\t-P [--pass] ... ldap password (if required)\n" | ||
96 | "\t-p [--port] ... ldap port (default: %d)\n" | ||
97 | +#ifdef HAVE_LDAP_SET_OPTION | ||
98 | + "\t-2 [--ver2] ... use ldap porotocol version 2\n" | ||
99 | + "\t-3 [--ver3] ... use ldap porotocol version 3\n" | ||
100 | + "\t\t(default protocol version: %d)\n" | ||
101 | +#endif | ||
102 | "\t-w [--warn] ... time in secs. - if the exceeds <warn> the STATE_WARNING will be returned\n" | ||
103 | "\t-c [--crit] ... time in secs. - if the exceeds <crit> the STATE_CRITICAL will be returned\n" | ||
104 | - "\n", DEFAULT_PORT); | ||
105 | + "\n", DEFAULT_PORT | ||
106 | +#ifdef HAVE_LDAP_SET_OPTION | ||
107 | + , DEFAULT_PROTOCOL | ||
108 | +#endif | ||
109 | + ); | ||
110 | } | ||
111 | |||
112 | |||
113 | @@ -256,5 +291,8 @@ | ||
114 | printf | ||
115 | ("Usage: %s -H <host> -b <base_dn> [-p <port>] [-a <attr>] [-D <binddn>]\n" | ||
116 | " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n" | ||
117 | +#ifdef HAVE_LDAP_SET_OPTION | ||
118 | + " [-2|-3]\n" | ||
119 | +#endif | ||
120 | "(Note: all times are in seconds.)\n", progname); | ||
121 | } | ||