summaryrefslogtreecommitdiffstats
path: root/web/attachments/68846-check_ldap.c.diff
diff options
context:
space:
mode:
Diffstat (limited to 'web/attachments/68846-check_ldap.c.diff')
-rw-r--r--web/attachments/68846-check_ldap.c.diff75
1 files changed, 75 insertions, 0 deletions
diff --git a/web/attachments/68846-check_ldap.c.diff b/web/attachments/68846-check_ldap.c.diff
new file mode 100644
index 0000000..3d47577
--- /dev/null
+++ b/web/attachments/68846-check_ldap.c.diff
@@ -0,0 +1,75 @@
1--- check_ldap.c.orig 2003-01-28 22:16:15.000000000 -0800
2+++ check_ldap.c 2003-11-27 01:31:26.810335706 -0800
3@@ -50,6 +50,7 @@
4 unsigned int ld_port = DEFAULT_PORT;
5 int warn_time = UNDEFINED;
6 int crit_time = UNDEFINED;
7+int protocol_version = 2;
8
9 int
10 main (int argc, char *argv[])
11@@ -58,7 +59,7 @@
12 LDAP *ld;
13 LDAPMessage *result;
14
15- int t_diff;
16+ int t_diff,rc;
17 time_t time0, time1;
18
19 if (process_arguments (argc, argv) == ERROR)
20@@ -79,6 +80,8 @@
21 printf ("Could not connect to the server at port %i\n", ld_port);
22 return STATE_CRITICAL;
23 }
24+ rc = protocol_version;
25+ ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &rc);
26
27 /* bind to the ldap server */
28 if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) !=
29@@ -145,6 +148,7 @@
30 {"port", required_argument, 0, 'p'},
31 {"warn", required_argument, 0, 'w'},
32 {"crit", required_argument, 0, 'c'},
33+ {"protocol", required_argument, 0, 'R'},
34 {0, 0, 0, 0}
35 };
36 #endif
37@@ -159,9 +163,9 @@
38
39 while (1) {
40 #ifdef HAVE_GETOPT_H
41- c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:", longopts, &option_index);
42+ c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:R:", longopts, &option_index);
43 #else
44- c = getopt (argc, argv, "+?hVt:c:w:H:b:p:a:D:P:");
45+ c = getopt (argc, argv, "+?hVt:c:w:H:b:p:a:D:P:R:");
46 #endif
47
48 if (c == -1 || c == EOF)
49@@ -203,6 +207,9 @@
50 case 'c':
51 crit_time = atoi (optarg);
52 break;
53+ case 'R':
54+ protocol_version = atoi (optarg);
55+ break;
56 default:
57 usage ("check_ldap: could not parse arguments\n");
58 break;
59@@ -250,6 +257,7 @@
60 "\t-D [--bind] ... ldap bind DN (if required)\n"
61 "\t-P [--pass] ... ldap password (if required)\n"
62 "\t-p [--port] ... ldap port (default: %d)\n"
63+ "\t-R [--protocol] ... ldap protocol version (default: 2)\n"
64 "\t-w [--warn] ... time in secs. - if the exceeds <warn> the STATE_WARNING will be returned\n"
65 "\t-c [--crit] ... time in secs. - if the exceeds <crit> the STATE_CRITICAL will be returned\n"
66 "\n", DEFAULT_PORT);
67@@ -261,6 +269,7 @@
68 {
69 printf
70 ("Usage: %s -H <host> -b <base_dn> [-p <port>] [-a <attr>] [-D <binddn>]\n"
71- " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n"
72+ " [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout] "
73+ "[-R <protocol number>]\n"
74 "(Note: all times are in seconds.)\n", progname);
75 }