X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fcheck_ldap.c;h=726ffa64ff63f229dad8a5639edddf1aa5ecbe51;hb=a2a279e262ef341b95fe2511d7164cbc60f6b026;hp=25432de12f9e35b6b8379e97f8150d3b74075eda;hpb=532454485570d76c159b7ddcf218dce1d59c26d3;p=nagiosplug.git diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index 25432de..726ffa6 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c @@ -36,6 +36,7 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; #include "utils.h" #include +#define LDAP_DEPRECATED 1 #include enum { @@ -57,7 +58,7 @@ char *ld_host = NULL; char *ld_base = NULL; char *ld_passwd = NULL; char *ld_binddn = NULL; -int ld_port = DEFAULT_PORT; +int ld_port = -1; #ifdef HAVE_LDAP_SET_OPTION int ld_protocol = DEFAULT_PROTOCOL; #endif @@ -340,7 +341,8 @@ process_arguments (int argc, char **argv) case 'S': if (! starttls) { ssl_on_connect = TRUE; - ld_port = LDAPS_PORT; + if (ld_port == -1) + ld_port = LDAPS_PORT; } else usage_va(_("%s cannot be combined with %s"), "-S/--ssl", "-T/--starttls"); break; @@ -363,6 +365,9 @@ process_arguments (int argc, char **argv) if (ld_base == NULL && argv[c]) ld_base = strdup (argv[c++]); + if (ld_port == -1) + ld_port = DEFAULT_PORT; + return validate_arguments (); } @@ -373,7 +378,7 @@ validate_arguments () if (ld_host==NULL || strlen(ld_host)==0) usage4 (_("Please specify the host name\n")); - if (ld_base==NULL || strlen(ld_base)==0) + if (ld_base==NULL) usage4 (_("Please specify the LDAP base\n")); return OK; @@ -395,12 +400,12 @@ print_help (void) print_usage (); - printf (_(UT_HELP_VRSN)); - printf (_(UT_EXTRA_OPTS)); + printf (UT_HELP_VRSN); + printf (UT_EXTRA_OPTS); - printf (_(UT_HOST_PORT), 'p', myport); + printf (UT_HOST_PORT, 'p', myport); - printf (_(UT_IPv46)); + printf (UT_IPv46); printf (" %s\n", "-a [--attr]"); printf (" %s\n", _("ldap attribute to search (default: \"(objectclass=*)\"")); @@ -423,11 +428,11 @@ print_help (void) printf (" (%s %d)\n", _("default protocol version:"), DEFAULT_PROTOCOL); #endif - printf (_(UT_WARN_CRIT)); + printf (UT_WARN_CRIT); - printf (_(UT_TIMEOUT), DEFAULT_SOCKET_TIMEOUT); + printf (UT_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); - printf (_(UT_VERBOSE)); + printf (UT_VERBOSE); printf ("\n"); printf ("%s\n", _("Notes:")); @@ -436,12 +441,8 @@ print_help (void) printf (" %s\n", _("'SSL on connect' will be used no matter how the plugin was called.")); printf (" %s\n", _("This detection is deprecated, please use 'check_ldap' with the '--starttls' or '--ssl' flags")); printf (" %s\n", _("to define the behaviour explicitly instead.")); -#ifdef NP_EXTRA_OPTS - printf ("\n"); - printf (_(UT_EXTRA_OPTS_NOTES)); -#endif - printf (_(UT_SUPPORT)); + printf (UT_SUPPORT); } /* todo @@ -452,7 +453,7 @@ print_help (void) void print_usage (void) { - printf (_("Usage:")); + printf ("%s\n", _("Usage:")); printf (" %s -H -b [-p ] [-a ] [-D ]",progname); printf ("\n [-P ] [-w ] [-c ] [-t timeout]%s\n", #ifdef HAVE_LDAP_SET_OPTION