summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ea6f0f5)
raw | patch | inline | side by side (parent: ea6f0f5)
author | Matthias Eble <psychotrahe@users.sourceforge.net> | |
Sat, 7 Jul 2007 22:20:40 +0000 (22:20 +0000) | ||
committer | Matthias Eble <psychotrahe@users.sourceforge.net> | |
Sat, 7 Jul 2007 22:20:40 +0000 (22:20 +0000) |
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1753 f882894a-f735-0410-b71e-b25c423dba1c
plugins/check_ldap.c | patch | blob | history |
diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c
index fc1d3c6cf0ffea4ec5df885c9344387a677f1db6..a0b739cc573af96e7bd5ce36258f59b974667e6b 100644 (file)
--- a/plugins/check_ldap.c
+++ b/plugins/check_ldap.c
struct timeval tv;
int starttls = FALSE;
int ssl_on_connect = FALSE;
+int verbose = 0;
/* for ldap tls */
}
#else
if (!(ld = ldap_open (ld_host, ld_port))) {
- /*ldap_perror(ld, "ldap_open"); */
+ if (verbose)
+ ldap_perror(ld, "ldap_open");
printf (_("Could not connect to the server at port %i\n"), ld_port);
return STATE_CRITICAL;
}
if (ldap_set_option (ld, LDAP_OPT_X_TLS, &tls) != LDAP_SUCCESS)
{
- /*ldap_perror(ld, "ldaps_option"); */
+ if (verbose)
+ ldap_perror(ld, "ldaps_option");
printf (_("Could not init TLS at port %i!\n"), ld_port);
return STATE_CRITICAL;
}
/* call start_tls */
if (ldap_start_tls_s(ld, NULL, NULL) != LDAP_SUCCESS)
{
- /*ldap_perror(ld, "ldap_start_tls"); */
+ if (verbose)
+ ldap_perror(ld, "ldap_start_tls");
printf (_("Could not init startTLS at port %i!\n"), ld_port);
return STATE_CRITICAL;
}
/* bind to the ldap server */
if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) !=
LDAP_SUCCESS) {
- /*ldap_perror(ld, "ldap_bind"); */
+ if (verbose)
+ ldap_perror(ld, "ldap_bind");
printf (_("Could not bind to the ldap-server\n"));
return STATE_CRITICAL;
}
/* do a search of all objectclasses in the base dn */
if (ldap_search_s (ld, ld_base, LDAP_SCOPE_BASE, ld_attr, NULL, 0, &result)
!= LDAP_SUCCESS) {
- /*ldap_perror(ld, "ldap_search"); */
+ if (verbose)
+ ldap_perror(ld, "ldap_search");
printf (_("Could not search/find objectclasses in %s\n"), ld_base);
return STATE_CRITICAL;
}
{"port", required_argument, 0, 'p'},
{"warn", required_argument, 0, 'w'},
{"crit", required_argument, 0, 'c'},
+ {"verbose", no_argument, 0, 'v'},
{0, 0, 0, 0}
};
}
while (1) {
- c = getopt_long (argc, argv, "hV234TS6t:c:w:H:b:p:a:D:P:", longopts, &option);
+ c = getopt_long (argc, argv, "hvV234TS6t:c:w:H:b:p:a:D:P:", longopts, &option);
if (c == -1 || c == EOF)
break;
case '4':
address_family = AF_INET;
break;
+ case 'v':
+ verbose++;
+ break;
case 'T':
if (! ssl_on_connect)
starttls = TRUE;