From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/68846-check_ldap.c.diff | 75 +++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 web/attachments/68846-check_ldap.c.diff (limited to 'web/attachments/68846-check_ldap.c.diff') 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 @@ +--- check_ldap.c.orig 2003-01-28 22:16:15.000000000 -0800 ++++ check_ldap.c 2003-11-27 01:31:26.810335706 -0800 +@@ -50,6 +50,7 @@ + unsigned int ld_port = DEFAULT_PORT; + int warn_time = UNDEFINED; + int crit_time = UNDEFINED; ++int protocol_version = 2; + + int + main (int argc, char *argv[]) +@@ -58,7 +59,7 @@ + LDAP *ld; + LDAPMessage *result; + +- int t_diff; ++ int t_diff,rc; + time_t time0, time1; + + if (process_arguments (argc, argv) == ERROR) +@@ -79,6 +80,8 @@ + printf ("Could not connect to the server at port %i\n", ld_port); + return STATE_CRITICAL; + } ++ rc = protocol_version; ++ ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &rc); + + /* bind to the ldap server */ + if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) != +@@ -145,6 +148,7 @@ + {"port", required_argument, 0, 'p'}, + {"warn", required_argument, 0, 'w'}, + {"crit", required_argument, 0, 'c'}, ++ {"protocol", required_argument, 0, 'R'}, + {0, 0, 0, 0} + }; + #endif +@@ -159,9 +163,9 @@ + + while (1) { + #ifdef HAVE_GETOPT_H +- c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:", longopts, &option_index); ++ c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:R:", longopts, &option_index); + #else +- c = getopt (argc, argv, "+?hVt:c:w:H:b:p:a:D:P:"); ++ c = getopt (argc, argv, "+?hVt:c:w:H:b:p:a:D:P:R:"); + #endif + + if (c == -1 || c == EOF) +@@ -203,6 +207,9 @@ + case 'c': + crit_time = atoi (optarg); + break; ++ case 'R': ++ protocol_version = atoi (optarg); ++ break; + default: + usage ("check_ldap: could not parse arguments\n"); + break; +@@ -250,6 +257,7 @@ + "\t-D [--bind] ... ldap bind DN (if required)\n" + "\t-P [--pass] ... ldap password (if required)\n" + "\t-p [--port] ... ldap port (default: %d)\n" ++ "\t-R [--protocol] ... ldap protocol version (default: 2)\n" + "\t-w [--warn] ... time in secs. - if the exceeds the STATE_WARNING will be returned\n" + "\t-c [--crit] ... time in secs. - if the exceeds the STATE_CRITICAL will be returned\n" + "\n", DEFAULT_PORT); +@@ -261,6 +269,7 @@ + { + printf + ("Usage: %s -H -b [-p ] [-a ] [-D ]\n" +- " [-P ] [-w ] [-c ] [-t timeout]\n" ++ " [-P ] [-w ] [-c ] [-t timeout] " ++ "[-R ]\n" + "(Note: all times are in seconds.)\n", progname); + } -- cgit v1.2.3-74-g34f1