summaryrefslogtreecommitdiffstats
path: root/plugins/check_tcp.c
diff options
context:
space:
mode:
authorBenoit Mortier <opensides@users.sourceforge.net>2004-12-25 23:17:46 (GMT)
committerBenoit Mortier <opensides@users.sourceforge.net>2004-12-25 23:17:46 (GMT)
commite9ccc6b21a1152bbf150302c4a29a6df79d75bd7 (patch)
tree91bf1ebb6f927fd628b298df2ac5a89580282591 /plugins/check_tcp.c
parent71656b2aafffb69716620bf08cce76c925dc8fa3 (diff)
downloadmonitoring-plugins-e9ccc6b21a1152bbf150302c4a29a6df79d75bd7.tar.gz
various fixes for localization
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1061 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_tcp.c')
-rw-r--r--plugins/check_tcp.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index b922536..fcd6778 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -259,13 +259,13 @@ main (int argc, char **argv)
259#ifdef HAVE_SSL 259#ifdef HAVE_SSL
260 if (use_ssl && check_cert == TRUE) { 260 if (use_ssl && check_cert == TRUE) {
261 if (connect_SSL () != OK) 261 if (connect_SSL () != OK)
262 die (STATE_CRITICAL,"CRITICAL - Could not make SSL connection\n"); 262 die (STATE_CRITICAL,_("CRITICAL - Could not make SSL connection\n"));
263 if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) { 263 if ((server_cert = SSL_get_peer_certificate (ssl)) != NULL) {
264 result = check_certificate (&server_cert); 264 result = check_certificate (&server_cert);
265 X509_free(server_cert); 265 X509_free(server_cert);
266 } 266 }
267 else { 267 else {
268 printf("CRITICAL - Cannot retrieve server certificate.\n"); 268 printf(_("CRITICAL - Cannot retrieve server certificate.\n"));
269 result = STATE_CRITICAL; 269 result = STATE_CRITICAL;
270 } 270 }
271 SSL_shutdown (ssl); 271 SSL_shutdown (ssl);
@@ -434,7 +434,7 @@ process_arguments (int argc, char **argv)
434 }; 434 };
435 435
436 if (argc < 2) 436 if (argc < 2)
437 usage ("No arguments found\n"); 437 usage4 (_("No arguments found"));
438 438
439 /* backwards compatibility */ 439 /* backwards compatibility */
440 for (c = 1; c < argc; c++) { 440 for (c = 1; c < argc; c++) {
@@ -462,14 +462,12 @@ process_arguments (int argc, char **argv)
462 462
463 switch (c) { 463 switch (c) {
464 case '?': /* print short usage statement if args not parsable */ 464 case '?': /* print short usage statement if args not parsable */
465 printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); 465 usage2 (_("Unknown argument"), optarg);
466 print_usage ();
467 exit (STATE_UNKNOWN);
468 case 'h': /* help */ 466 case 'h': /* help */
469 print_help (); 467 print_help ();
470 exit (STATE_OK); 468 exit (STATE_OK);
471 case 'V': /* version */ 469 case 'V': /* version */
472 print_revision (progname, "$Revision$"); 470 print_revision (progname, revision);
473 exit (STATE_OK); 471 exit (STATE_OK);
474 case 'v': /* verbose mode */ 472 case 'v': /* verbose mode */
475 verbose = TRUE; 473 verbose = TRUE;
@@ -575,7 +573,7 @@ process_arguments (int argc, char **argv)
575 case 'D': /* Check SSL cert validity - days 'til certificate expiration */ 573 case 'D': /* Check SSL cert validity - days 'til certificate expiration */
576#ifdef HAVE_SSL 574#ifdef HAVE_SSL
577 if (!is_intnonneg (optarg)) 575 if (!is_intnonneg (optarg))
578 usage2 ("invalid certificate expiration period", optarg); 576 usage2 (_("Invalid certificate expiration period"), optarg);
579 days_till_exp = atoi (optarg); 577 days_till_exp = atoi (optarg);
580 check_cert = TRUE; 578 check_cert = TRUE;
581 use_ssl = TRUE; 579 use_ssl = TRUE;
@@ -583,14 +581,14 @@ process_arguments (int argc, char **argv)
583 case 'S': 581 case 'S':
584 use_ssl = TRUE; 582 use_ssl = TRUE;
585#else 583#else
586 die (STATE_UNKNOWN, "SSL support not available. Install OpenSSL and recompile."); 584 die (STATE_UNKNOWN, _("SSL support not available. Install OpenSSL and recompile."));
587#endif 585#endif
588 break; 586 break;
589 } 587 }
590 } 588 }
591 589
592 if (server_address == NULL) 590 if (server_address == NULL)
593 usage (_("You must provide a server address\n")); 591 usage4 (_("You must provide a server address"));
594 592
595 return TRUE; 593 return TRUE;
596} 594}
@@ -669,7 +667,7 @@ check_certificate (X509 ** certificate)
669 /* Generate tm structure to process timestamp */ 667 /* Generate tm structure to process timestamp */
670 if (tm->type == V_ASN1_UTCTIME) { 668 if (tm->type == V_ASN1_UTCTIME) {
671 if (tm->length < 10) { 669 if (tm->length < 10) {
672 printf ("CRITICAL - Wrong time format in certificate.\n"); 670 printf (_("CRITICAL - Wrong time format in certificate.\n"));
673 return STATE_CRITICAL; 671 return STATE_CRITICAL;
674 } 672 }
675 else { 673 else {
@@ -681,7 +679,7 @@ check_certificate (X509 ** certificate)
681 } 679 }
682 else { 680 else {
683 if (tm->length < 12) { 681 if (tm->length < 12) {
684 printf ("CRITICAL - Wrong time format in certificate.\n"); 682 printf (_("CRITICAL - Wrong time format in certificate.\n"));
685 return STATE_CRITICAL; 683 return STATE_CRITICAL;
686 } 684 }
687 else { 685 else {
@@ -710,20 +708,20 @@ check_certificate (X509 ** certificate)
710 stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min); 708 stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min);
711 709
712 if (days_left > 0 && days_left <= days_till_exp) { 710 if (days_left > 0 && days_left <= days_till_exp) {
713 printf ("Certificate expires in %d day(s) (%s).\n", days_left, timestamp); 711 printf (_("Certificate expires in %d day(s) (%s).\n"), days_left, timestamp);
714 return STATE_WARNING; 712 return STATE_WARNING;
715 } 713 }
716 if (days_left < 0) { 714 if (days_left < 0) {
717 printf ("Certificate expired on %s.\n", timestamp); 715 printf (_("Certificate expired on %s.\n"), timestamp);
718 return STATE_CRITICAL; 716 return STATE_CRITICAL;
719 } 717 }
720 718
721 if (days_left == 0) { 719 if (days_left == 0) {
722 printf ("Certificate expires today (%s).\n", timestamp); 720 printf (_("Certificate expires today (%s).\n"), timestamp);
723 return STATE_WARNING; 721 return STATE_WARNING;
724 } 722 }
725 723
726 printf ("Certificate will expire on %s.\n", timestamp); 724 printf (_("Certificate will expire on %s.\n"), timestamp);
727 725
728 return STATE_OK; 726 return STATE_OK;
729} 727}