[nagiosplug] check_smtp: Strip angle brackets from -f ...

Nagios Plugin Development nagios-plugins at users.sourceforge.net
Fri Jun 29 14:20:40 CEST 2012


    Module: nagiosplug
    Branch: master
    Commit: 9976876584e5a1df6e1c9315212c3d274df7a12e
    Author: Anders Kaseorg <andersk at mit.edu>
 Committer: Holger Weiss <holger at zedat.fu-berlin.de>
      Date: Fri Jun 29 06:26:16 2012 -0400
       URL: http://nagiosplug.git.sf.net/git/gitweb.cgi?p=nagiosplug/nagiosplug;a=commit;h=9976876

check_smtp: Strip angle brackets from -f argument, if provided

Apparently some people used -f '<nagios at example.com>' to work around
the bug I just fixed in the MAIL FROM: command generation.  Although
the resulting command wasn't RFC-compliant, it was working with some
MTAs, so let's continue to support this syntax now that we generate
RFC-compliant commands.

Signed-off-by: Anders Kaseorg <andersk at mit.edu>

---

 plugins/check_smtp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c
index 56be585..77ac5ce 100644
--- a/plugins/check_smtp.c
+++ b/plugins/check_smtp.c
@@ -521,7 +521,8 @@ process_arguments (int argc, char **argv)
 			localhostname = strdup(optarg);
 			break;
 		case 'f':									/* from argument */
-			from_arg = optarg;
+			from_arg = optarg + strspn(optarg, "<");
+			from_arg = strndup(from_arg, strcspn(from_arg, ">"));
 			smtp_use_dummycmd = 1;
 			break;
 		case 'A':





More information about the Commits mailing list