diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 3310bcebcfce7cd1b548fb4be87f963a8a13f76a..62f102549880fa1c35e76912055335d878e7822b 100644 (file)
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
* License: GPL
* Copyright (c) 2000-2007 Nagios Plugins Development Team
*
-* Last Modified: $Date$
-*
* Description:
*
* This file contains the check_smtp plugin
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
-* $Id$
*
*****************************************************************************/
const char *progname = "check_smtp";
-const char *revision = "$Revision$";
const char *copyright = "2000-2007";
const char *email = "nagiosplug-devel@lists.sourceforge.net";
-#include <ctype.h>
-
#include "common.h"
#include "netutils.h"
#include "utils.h"
#include "base64.h"
+#include <ctype.h>
+
#ifdef HAVE_SSL
int check_cert = FALSE;
int days_till_exp;
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
+ /* Parse extra opts if any */
+ argv=np_extra_opts (&argc, argv, progname);
+
if (process_arguments (argc, argv) == ERROR)
usage4 (_("Could not parse arguments"));
if (verbose && smtp_use_dummycmd)
printf ("FROM CMD: %s", cmd_str);
-
+
/* initialize alarm signal handling */
(void) signal (SIGALRM, socket_timeout_alarm_handler);
/* make sure we find the response we are looking for */
if (!strstr (buffer, server_expect)) {
if (server_port == SMTP_PORT)
- printf (_("Invalid SMTP response received from host\n"));
+ printf (_("Invalid SMTP response received from host: %s\n"), buffer);
else
- printf (_("Invalid SMTP response received from host on port %d\n"),
- server_port);
+ printf (_("Invalid SMTP response received from host on port %d: %s\n"),
+ server_port, buffer);
result = STATE_WARNING;
}
}
# endif /* USE_OPENSSL */
}
#endif
-
+
/* sendmail will syslog a "NOQUEUE" error if session does not attempt
* to do something useful. This can be prevented by giving a command
* even if syntax is illegal (MAIL requires a FROM:<...> argument)
* According to rfc821 you can include a null reversepath in the from command
* - but a log message is generated on the smtp server.
*
- * You can disable sending mail_command with '--nocommand'
* Use the -f option to provide a FROM address
*/
if (smtp_use_dummycmd) {
{"authpass", required_argument, 0, 'P'},
{"command", required_argument, 0, 'C'},
{"response", required_argument, 0, 'R'},
- {"nocommand", required_argument, 0, 'n'},
{"verbose", no_argument, 0, 'v'},
{"version", no_argument, 0, 'V'},
{"use-ipv4", no_argument, 0, '4'},
#endif
break;
case 'V': /* version */
- print_revision (progname, revision);
+ print_revision (progname, NP_VERSION);
exit (STATE_OK);
case 'h': /* help */
print_help ();
}
-int
+int
my_close (void)
{
#ifdef HAVE_SSL
char *myport;
asprintf (&myport, "%d", SMTP_PORT);
- print_revision (progname, revision);
+ print_revision (progname, NP_VERSION);
printf ("Copyright (c) 1999-2001 Ethan Galstad <nagios@nagios.org>\n");
printf (COPYRIGHT, copyright, email);
print_usage ();
printf (_(UT_HELP_VRSN));
+ printf (_(UT_EXTRA_OPTS));
printf (_(UT_HOST_PORT), 'p', myport);
printf (" %s\n", "-e, --expect=STRING");
printf (_(" String to expect in first line of server response (default: '%s')\n"), SMTP_EXPECT);
- printf (" %s\n", "-n, nocommand");
- printf (" %s\n", _("Suppress SMTP command"));
printf (" %s\n", "-C, --command=STRING");
printf (" %s\n", _("SMTP command (may be used repeatedly)"));
printf (" %s\n", "-R, --command=STRING");
printf ("%s\n", _("connects, but incorrect reponse messages from the host result in"));
printf ("%s\n", _("STATE_WARNING return values."));
+#ifdef NP_EXTRA_OPTS
+ printf ("\n");
+ printf ("%s\n", _("Notes:"));
+ printf (_(UT_EXTRA_OPTS_NOTES));
+#endif
+
printf (_(UT_SUPPORT));
}
printf (_("Usage:"));
printf ("%s -H host [-p port] [-e expect] [-C command] [-f from addr]", progname);
printf ("[-A authtype -U authuser -P authpass] [-w warn] [-c crit] [-t timeout]\n");
- printf ("[-S] [-D days] [-n] [-v] [-4|-6]\n");
+ printf ("[-S] [-D days] [-v] [-4|-6]\n");
}