summaryrefslogtreecommitdiffstats
path: root/plugins/check_smtp.c
diff options
context:
space:
mode:
authorBenoit Mortier <opensides@users.sourceforge.net>2006-06-20 11:17:03 (GMT)
committerBenoit Mortier <opensides@users.sourceforge.net>2006-06-20 11:17:03 (GMT)
commitf2d66913f9451674bb7b6dec514cf2fdff9698bc (patch)
tree1f2d685ee02370308f319fabf88ee976b5abac8d /plugins/check_smtp.c
parentf9394308c9c372bcf419a311c61ba420247ae613 (diff)
downloadmonitoring-plugins-f2d66913f9451674bb7b6dec514cf2fdff9698bc.tar.gz
cleaning help and usage + license
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1435 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_smtp.c')
-rw-r--r--plugins/check_smtp.c129
1 files changed, 70 insertions, 59 deletions
diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 3dc444f..e7cf2ea 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -1,26 +1,40 @@
1/****************************************************************************** 1/******************************************************************************
2 2*
3 This program is free software; you can redistribute it and/or modify 3* Nagios check_smtp plugin
4 it under the terms of the GNU General Public License as published by 4*
5 the Free Software Foundation; either version 2 of the License, or 5* License: GPL
6 (at your option) any later version. 6* Copyright (c) 1999-2006 nagios-plugins team
7 7*
8 This program is distributed in the hope that it will be useful, 8* Last Modified: $Date$
9 but WITHOUT ANY WARRANTY; without even the implied warranty of 9*
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10* Description:
11 GNU General Public License for more details. 11*
12 12* This file contains the check_smtp plugin
13 You should have received a copy of the GNU General Public License 13*
14 along with this program; if not, write to the Free Software 14* License Information:
15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 15*
16 16* This program is free software; you can redistribute it and/or modify
17 $Id$ 17* it under the terms of the GNU General Public License as published by
18 18* the Free Software Foundation; either version 2 of the License, or
19* (at your option) any later version.
20*
21* This program is distributed in the hope that it will be useful,
22* but WITHOUT ANY WARRANTY; without even the implied warranty of
23* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24* GNU General Public License for more details.
25*
26* You should have received a copy of the GNU General Public License
27* along with this program; if not, write to the Free Software
28* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29*
30*
31* $Id$
32*
19******************************************************************************/ 33******************************************************************************/
20 34
21const char *progname = "check_smtp"; 35const char *progname = "check_smtp";
22const char *revision = "$Revision$"; 36const char *revision = "$Revision$";
23const char *copyright = "2000-2004"; 37const char *copyright = "2000-2006";
24const char *email = "nagiosplug-devel@lists.sourceforge.net"; 38const char *email = "nagiosplug-devel@lists.sourceforge.net";
25 39
26#include "common.h" 40#include "common.h"
@@ -657,6 +671,15 @@ validate_arguments (void)
657} 671}
658 672
659 673
674int
675my_close (void)
676{
677#ifdef HAVE_SSL
678 np_net_ssl_cleanup();
679#endif
680 return close(sd);
681}
682
660 683
661void 684void
662print_help (void) 685print_help (void)
@@ -669,7 +692,9 @@ print_help (void)
669 printf ("Copyright (c) 1999-2001 Ethan Galstad <nagios@nagios.org>\n"); 692 printf ("Copyright (c) 1999-2001 Ethan Galstad <nagios@nagios.org>\n");
670 printf (COPYRIGHT, copyright, email); 693 printf (COPYRIGHT, copyright, email);
671 694
672 printf(_("This plugin will attempt to open an SMTP connection with the host.\n\n")); 695 printf("%s\n", _("This plugin will attempt to open an SMTP connection with the host."));
696
697 printf ("\n\n");
673 698
674 print_usage (); 699 print_usage ();
675 700
@@ -679,34 +704,29 @@ print_help (void)
679 704
680 printf (_(UT_IPv46)); 705 printf (_(UT_IPv46));
681 706
682 printf (_("\ 707 printf (" %s\n", "-e, --expect=STRING");
683 -e, --expect=STRING\n\ 708 printf (_("String to expect in first line of server response (default: '%s')"),SMTP_EXPECT);
684 String to expect in first line of server response (default: '%s')\n\ 709 printf (" %s\n\n", "-n, nocommand\n");
685 -n, nocommand\n\ 710 printf (" %s\n", _("Suppress SMTP command"));
686 Suppress SMTP command\n\ 711 printf (" %s\n", "-C, --command=STRING");
687 -C, --command=STRING\n\ 712 printf (" %s\n", _("SMTP command (may be used repeatedly)"));
688 SMTP command (may be used repeatedly)\n\ 713 printf (" %s\n", "-R, --command=STRING");
689 -R, --command=STRING\n\ 714 printf (" %s\n", _("Expected response to command (may be used repeatedly)"));
690 Expected response to command (may be used repeatedly)\n\ 715 printf (" %s\n", "-f, --from=STRING");
691 -f, --from=STRING\n\ 716 printf (" %s\n", _("FROM-address to include in MAIL command, required by Exchange 2000")),
692 FROM-address to include in MAIL command, required by Exchange 2000\n"),
693 SMTP_EXPECT);
694#ifdef HAVE_SSL 717#ifdef HAVE_SSL
695 printf (_("\ 718 printf (" %s\n", "-D, --certificate=INTEGER");
696 -D, --certificate=INTEGER\n\ 719 printf (" %s\n", _("Minimum number of days a certificate has to be valid."));
697 Minimum number of days a certificate has to be valid.\n\ 720 printf (" %s\n", "-S, --starttls");
698 -S, --starttls\n\ 721 printf (" %s\n", _("Use STARTTLS for the connection."));
699 Use STARTTLS for the connection.\n"));
700#endif 722#endif
701 723
702 printf("\ 724 printf (" %s\n", "-A, --authtype=STRING");
703 -A, --authtype=STRING\n\ 725 printf (" %s\n", _("SMTP AUTH type to check (default none, only LOGIN supported)"));
704 SMTP AUTH type to check (default none, only LOGIN supported)\n\ 726 printf (" %s\n", "-U, --authuser=STRING");
705 -U, --authuser=STRING\n\ 727 printf (" %s\n", _("SMTP AUTH username"));
706 SMTP AUTH username\n\ 728 printf (" %s\n", "-P, --authpass=STRING");
707 -P, --authpass=STRING\n\ 729 printf (" %s\n", _("SMTP AUTH password"));
708 SMTP AUTH password\n\
709 ");
710 730
711 printf (_(UT_WARN_CRIT)); 731 printf (_(UT_WARN_CRIT));
712 732
@@ -714,11 +734,10 @@ print_help (void)
714 734
715 printf (_(UT_VERBOSE)); 735 printf (_(UT_VERBOSE));
716 736
717 printf(_("\n\ 737 printf ("%s\n", _("Successul connects return STATE_OK, refusals and timeouts return"));
718Successul connects return STATE_OK, refusals and timeouts return\n\ 738 printf ("%s\n", _("STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful"));
719STATE_CRITICAL, other errors return STATE_UNKNOWN. Successful\n\ 739 printf ("%s\n", _("connects, but incorrect reponse messages from the host result in"));
720connects, but incorrect reponse messages from the host result in\n\ 740 printf ("%s\n", _("STATE_WARNING return values."));
721STATE_WARNING return values.\n"));
722 741
723 printf (_(UT_SUPPORT)); 742 printf (_(UT_SUPPORT));
724} 743}
@@ -728,17 +747,9 @@ STATE_WARNING return values.\n"));
728void 747void
729print_usage (void) 748print_usage (void)
730{ 749{
731 printf ("\ 750 printf (_("Usage:"));
732Usage: %s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\ 751 printf ("%s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\
733 [-A authtype -U authuser -P authpass]\n\ 752 [-A authtype -U authuser -P authpass]\n\
734 [-w warn] [-c crit] [-t timeout] [-S] [-D days] [-n] [-v] [-4|-6]\n", progname); 753 [-w warn] [-c crit] [-t timeout] [-S] [-D days] [-n] [-v] [-4|-6]\n", progname);
735} 754}
736 755
737int
738my_close (void)
739{
740#ifdef HAVE_SSL
741 np_net_ssl_cleanup();
742#endif
743 return close(sd);
744}