[Nagiosplug-checkins] CVS: nagiosplug/plugins check_ldap.c,1.6,1.7
Jeremy T. Bouse
undrgrid at users.sourceforge.net
Sun Jun 29 12:55:12 CEST 2003
Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv19765/plugins
Modified Files:
check_ldap.c
Log Message:
Included patch for check_ldap from Patch #753621 by Ziya Suzen
Index: check_ldap.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ldap.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** check_ldap.c 12 Mar 2003 02:25:22 -0000 1.6
--- check_ldap.c 29 Jun 2003 19:54:50 -0000 1.7
***************
*** 34,37 ****
--- 34,40 ----
enum {
UNDEFINED = -1,
+ #ifdef HAVE_LDAP_SET_OPTION
+ DEFAULT_PROTOCOL = 2,
+ #endif
DEFAULT_PORT = 389
};
***************
*** 49,52 ****
--- 52,58 ----
char *ld_binddn = NULL;
unsigned int ld_port = DEFAULT_PORT;
+ #ifdef HAVE_LDAP_SET_OPTION
+ int ld_protocol = DEFAULT_PROTOCOL;
+ #endif
int warn_time = UNDEFINED;
int crit_time = UNDEFINED;
***************
*** 81,84 ****
--- 87,98 ----
}
+ #ifdef HAVE_LDAP_SET_OPTION
+ /* set ldap options */
+ if (ldap_set_option (ld, LDAP_OPT_PROTOCOL_VERSION, &ld_protocol) !=
+ LDAP_OPT_SUCCESS ) {
+ printf("Could not set protocol version %d\n", ld_protocol);
+ return STATE_CRITICAL;
+ }
+ #endif
/* bind to the ldap server */
if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) !=
***************
*** 142,145 ****
--- 156,163 ----
{"bind", required_argument, 0, 'D'},
{"pass", required_argument, 0, 'P'},
+ #ifdef HAVE_LDAP_SET_OPTION
+ {"ver2", no_argument, 0, '2'},
+ {"ver3", no_argument, 0, '3'},
+ #endif
{"port", required_argument, 0, 'p'},
{"warn", required_argument, 0, 'w'},
***************
*** 157,161 ****
while (1) {
! c = getopt_long (argc, argv, "hVt:c:w:H:b:p:a:D:P:", longopts, &option_index);
if (c == -1 || c == EOF)
--- 175,179 ----
while (1) {
! c = getopt_long (argc, argv, "hV23t:c:w:H:b:p:a:D:P:", longopts, &option_index);
if (c == -1 || c == EOF)
***************
*** 198,201 ****
--- 216,227 ----
crit_time = atoi (optarg);
break;
+ #ifdef HAVE_LDAP_SET_OPTION
+ case '2':
+ ld_protocol = 2;
+ break;
+ case '3':
+ ld_protocol = 3;
+ break;
+ #endif
default:
usage ("check_ldap: could not parse unknown arguments\n");
***************
*** 245,251 ****
"\t-P [--pass] ... ldap password (if required)\n"
"\t-p [--port] ... ldap port (default: %d)\n"
"\t-w [--warn] ... time in secs. - if the exceeds <warn> the STATE_WARNING will be returned\n"
"\t-c [--crit] ... time in secs. - if the exceeds <crit> the STATE_CRITICAL will be returned\n"
! "\n", DEFAULT_PORT);
}
--- 271,286 ----
"\t-P [--pass] ... ldap password (if required)\n"
"\t-p [--port] ... ldap port (default: %d)\n"
+ #ifdef HAVE_LDAP_SET_OPTION
+ "\t-2 [--ver2] ... use ldap porotocol version 2\n"
+ "\t-3 [--ver3] ... use ldap porotocol version 3\n"
+ "\t\t(default protocol version: %d)\n"
+ #endif
"\t-w [--warn] ... time in secs. - if the exceeds <warn> the STATE_WARNING will be returned\n"
"\t-c [--crit] ... time in secs. - if the exceeds <crit> the STATE_CRITICAL will be returned\n"
! "\n", DEFAULT_PORT
! #ifdef HAVE_LDAP_SET_OPTION
! , DEFAULT_PROTOCOL
! #endif
! );
}
***************
*** 257,260 ****
--- 292,298 ----
("Usage: %s -H <host> -b <base_dn> [-p <port>] [-a <attr>] [-D <binddn>]\n"
" [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]\n"
+ #ifdef HAVE_LDAP_SET_OPTION
+ " [-2|-3]\n"
+ #endif
"(Note: all times are in seconds.)\n", progname);
}
More information about the Commits
mailing list