From 5c0f63e2fa5d566c8b13743a849c79b9bb8cd4ec Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 9 Feb 2011 17:55:12 +0000 Subject: [PATCH] check_smtp: Abort on missing/unexpected greeting --- debian/changelog | 6 +++- debian/patches/00list | 1 + debian/patches/13_check_smtp_greeting.dpatch | 37 ++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 debian/patches/13_check_smtp_greeting.dpatch diff --git a/debian/changelog b/debian/changelog index bfe6009..cf96643 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,10 @@ nagios-plugins (1.4.15-4) UNRELEASED; urgency=low - * NOT RELEASED YET + * Add 13_check_smtp_greeting.dpatch (Closes: #611914), thanks Daniel Piddock + for spotting and Holger Weiss for providing a fix + - Abort immediately if we don't receive a server greeting or if the + greeting doesn't contain the "--expect"ed string (by default: "220") + instead of blindly sending the EHLO/HELO line. -- Jan Wagner Mon, 27 Dec 2010 22:13:48 +0100 diff --git a/debian/patches/00list b/debian/patches/00list index 3ac91d6..cfc0b18 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -5,3 +5,4 @@ 10_check_disk_smb_spaces.dpatch 11_check_disk_smb_NT_STATUS_ACCESS_DENIED.dpatch 12_check_snmp_1.4.15_regression.dpatch +13_check_smtp_greeting.dpatch diff --git a/debian/patches/13_check_smtp_greeting.dpatch b/debian/patches/13_check_smtp_greeting.dpatch new file mode 100644 index 0000000..26e099b --- /dev/null +++ b/debian/patches/13_check_smtp_greeting.dpatch @@ -0,0 +1,37 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## 13_check_smtp_greeting.dpatch +## Holger Weiss +## +## From: d16f3fb0a9bb37cc1ce73ef14b5de83e907ef23c Tue, 8 Feb 2011 16:07:52 +0000 (+0100) +## From: Holger Weiss +## Date: Tue, 8 Feb 2011 16:07:52 +0000 (+0100) +## Subject: [PATCH] check_smtp: Abort on missing/unexpected greeting +## (Debian #611914) +## X-Git-Url: http://nagiosplug.git.sourceforge.net/git/gitweb.cgi?p=nagiosplug%2Fnagiosplug;a=commitdiff_plain;h=d16f3fb0a9bb37cc1ce73ef14b5de83e907ef23c +## +## DP: Abort on missing/unexpected greeting (http://bugs.debian.org/611914) + +@DPATCH@ + +diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c +index 3da724b..ed49163 100644 +--- a/plugins/check_smtp.c ++++ b/plugins/check_smtp.c +@@ -183,7 +183,7 @@ main (int argc, char **argv) + /* return a WARNING status if we couldn't read any data */ + if (recvlines(buffer, MAX_INPUT_BUFFER) <= 0) { + printf (_("recv() failed\n")); +- result = STATE_WARNING; ++ return STATE_WARNING; + } + else { + if (verbose) +@@ -197,7 +197,7 @@ main (int argc, char **argv) + else + printf (_("Invalid SMTP response received from host on port %d: %s\n"), + server_port, buffer); +- result = STATE_WARNING; ++ return STATE_WARNING; + } + } +