patch 1028033

minor internationalization fixes


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1013 f882894a-f735-0410-b71e-b25c423dba1c
This commit is contained in:
Benoit Mortier 2004-12-08 00:36:19 +00:00
parent 911af3e7ac
commit e71d2c2b71
9 changed files with 79 additions and 12 deletions

View file

@ -204,6 +204,7 @@ if test "$ac_cv_lib_ldap_main" = "yes"; then
AC_SUBST(LDAPINCLUDE)
AC_CHECK_FUNCS(ldap_set_option)
EXTRAS="$EXTRAS check_ldap"
AC_CHECK_FUNCS(ldap_init ldap_set_option ldap_get_option ldap_start_tls_s)
else
AC_MSG_WARN([Skipping LDAP plugin])
AC_MSG_WARN([install LDAP libs to compile this plugin (see REQUIREMENTS).])

View file

@ -140,8 +140,9 @@ $(check_tcp_programs): check_tcp
install-exec-hook:
cd $(DESTDIR)$(libexecdir) && \
for i in $(check_tcp_programs) ; do rm -f $$i; ln -s check_tcp $$i ; done
for i in $(check_tcp_programs) ; do rm -f $$i; ln -s check_tcp $$i ; done ;\
rm -f check_ldaps ; ln -s -f check_ldap check_ldaps
clean-local:
rm -f $(check_tcp_programs)

View file

@ -393,13 +393,13 @@ To use passive mode, provide multiple '-C' options, and provide\n\
all of -O, -s, and -n options (servicelist order must match '-C'\n\
options)\n"));
printf (_("\n\
printf ("\n\
$ check_by_ssh -H localhost -n lh -s c1:c2:c3 \\\n\
-C uptime -C uptime -C uptime -O /tmp/foo\n\
$ cat /tmp/foo\n\
[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c1;0; up 2 days...\n\
[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c2;0; up 2 days...\n\
[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c3;0; up 2 days...\n"));
[1080933700] PROCESS_SERVICE_CHECK_RESULT;flint;c3;0; up 2 days...\n");
printf (_(UT_SUPPORT));
}

View file

@ -300,9 +300,9 @@ print_help (void)
print_revision (progname, revision);
printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n");
printf (_(COPYRIGHT), copyright, email);
printf (COPYRIGHT, copyright, email);
printf (_("This plugin tests game server connections with the specified host."), progname);
printf (_("This plugin tests game server connections with the specified host."));
print_usage ();

View file

@ -1490,11 +1490,11 @@ the certificate is expired.\n"));
void
print_usage (void)
{
printf (_("\
printf ("\
Usage: %s -H <vhost> | -I <IP-address>) [-u <uri>] [-p <port>]\n\
[-w <warn time>] [-c <critical time>] [-t <timeout>] [-L]\n\
[-a auth] [-f <ok | warn | critcal | follow>] [-e <expect>]\n\
[-s string] [-l] [-r <regex> | -R <case-insensitive regex>]\n\
[-P string] [-m min_pg_size] [-4|-6] [-N] [-M <age>]\n\
[-A string] [-k string]\n"), progname);
[-A string] [-k string]\n", progname);
}

View file

@ -498,7 +498,7 @@ print_help ()
printf ("(C) 1999 Ragnar Hojland Espinosa <ragnar@lightside.dhis.org>\n");
printf (COPYRIGHT, copyright, email);
printf (_("\
printf ("\
Usage: %s [DEVICE] [OPTION]\n\
-d, --device=DEVICE\n\
Select device DEVICE\n\

View file

@ -57,6 +57,10 @@ double warn_time = UNDEFINED;
double crit_time = UNDEFINED;
struct timeval tv;
/* for ldap tls */
char *SERVICE = "LDAP";
int
main (int argc, char *argv[])
{
@ -69,11 +73,20 @@ main (int argc, char *argv[])
int status = STATE_UNKNOWN;
long microsec;
double elapsed_time;
/* for ldap tls */
int tls;
int version=3;
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
if (strstr(argv[0],"check_ldaps")) {
asprintf (&progname, "check_ldaps");
}
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
@ -87,12 +100,19 @@ main (int argc, char *argv[])
gettimeofday (&tv, NULL);
/* initialize ldap */
#ifdef HAVE_LDAP_INIT
if (!(ld = ldap_init (ld_host, ld_port))) {
printf ("Could not connect to the server at port %i\n", ld_port);
return STATE_CRITICAL;
}
#else
if (!(ld = ldap_open (ld_host, ld_port))) {
/*ldap_perror(ld, "ldap_open"); */
printf (_("Could not connect to the server at port %i\n"), ld_port);
return STATE_CRITICAL;
}
#endif /* HAVE_LDAP_INIT */
#ifdef HAVE_LDAP_SET_OPTION
/* set ldap options */
if (ldap_set_option (ld, LDAP_OPT_PROTOCOL_VERSION, &ld_protocol) !=
@ -101,6 +121,51 @@ main (int argc, char *argv[])
return STATE_CRITICAL;
}
#endif
if (strstr(argv[0],"check_ldaps")) {
/* with TLS */
if ( ld_port == LDAPS_PORT ) {
asprintf (&SERVICE, "LDAPS");
#if defined(HAVE_LDAP_SET_OPTION) && defined(LDAP_OPT_X_TLS)
/* ldaps: set option tls */
tls = LDAP_OPT_X_TLS_HARD;
if (ldap_set_option (ld, LDAP_OPT_X_TLS, &tls) != LDAP_SUCCESS)
{
/*ldap_perror(ld, "ldaps_option"); */
printf ("Could not init TLS at port %i!\n", ld_port);
return STATE_CRITICAL;
}
#else
printf ("TLS not supported by the libraries!\n", ld_port);
return STATE_CRITICAL;
#endif /* LDAP_OPT_X_TLS */
} else {
asprintf (&SERVICE, "LDAP-TLS");
#if defined(HAVE_LDAP_SET_OPTION) && defined(HAVE_LDAP_START_TLS_S)
/* ldap with startTLS: set option version */
if (ldap_get_option(ld,LDAP_OPT_PROTOCOL_VERSION, &version) == LDAP_OPT_SUCCESS )
{
if (version < LDAP_VERSION3)
{
version = LDAP_VERSION3;
ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION, &version);
}
}
/* call start_tls */
if (ldap_start_tls_s(ld, NULL, NULL) != LDAP_SUCCESS)
{
/*ldap_perror(ld, "ldap_start_tls"); */
printf ("Could not init startTLS at port %i!\n", ld_port);
return STATE_CRITICAL;
}
#else
printf ("startTLS not supported by the library, needs LDAPv3!\n");
return STATE_CRITICAL;
#endif /* HAVE_LDAP_START_TLS_S */
}
}
/* bind to the ldap server */
if (ldap_bind_s (ld, ld_binddn, ld_passwd, LDAP_AUTH_SIMPLE) !=
LDAP_SUCCESS) {

View file

@ -656,7 +656,7 @@ validate_arguments ()
}
else if ( strcmp(seclevel, "authPriv") == 0 ) {
if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) {
printf (("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n"),secname, authpasswd,privpasswd );
printf (_("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n"),secname, authpasswd,privpasswd );
print_usage ();
exit (STATE_UNKNOWN);
}

View file

@ -479,7 +479,7 @@ process_arguments (int argc, char **argv)
break;
case 'H': /* hostname */
if (is_host (optarg) == FALSE)
usage2 (_("invalid hostname/address"), optarg);
usage2 (_("Invalid hostname/address"), optarg);
server_address = optarg;
break;
case 'c': /* critical */