diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2011-02-08 16:07:52 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2011-02-08 16:07:52 (GMT) |
commit | d16f3fb0a9bb37cc1ce73ef14b5de83e907ef23c (patch) | |
tree | 9827dab60d4987749656a1d5a4c209f73a1bdab0 | |
parent | 4611e41bc50d15275b316c6f21b688997a9c78c4 (diff) | |
download | monitoring-plugins-d16f3fb0a9bb37cc1ce73ef14b5de83e907ef23c.tar.gz |
check_smtp: Abort on missing/unexpected greeting
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.
Spotted by Daniel Piddock, see Debian bug report #611914.
-rw-r--r-- | plugins/check_smtp.c | 4 |
1 files changed, 2 insertions, 2 deletions
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) | |||
183 | /* return a WARNING status if we couldn't read any data */ | 183 | /* return a WARNING status if we couldn't read any data */ |
184 | if (recvlines(buffer, MAX_INPUT_BUFFER) <= 0) { | 184 | if (recvlines(buffer, MAX_INPUT_BUFFER) <= 0) { |
185 | printf (_("recv() failed\n")); | 185 | printf (_("recv() failed\n")); |
186 | result = STATE_WARNING; | 186 | return STATE_WARNING; |
187 | } | 187 | } |
188 | else { | 188 | else { |
189 | if (verbose) | 189 | if (verbose) |
@@ -197,7 +197,7 @@ main (int argc, char **argv) | |||
197 | else | 197 | else |
198 | printf (_("Invalid SMTP response received from host on port %d: %s\n"), | 198 | printf (_("Invalid SMTP response received from host on port %d: %s\n"), |
199 | server_port, buffer); | 199 | server_port, buffer); |
200 | result = STATE_WARNING; | 200 | return STATE_WARNING; |
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||