From 153b9229315e87ffcdbc12a6d26ef78d4ed33d16 Mon Sep 17 00:00:00 2001 From: John Denker Date: Sat, 24 Nov 2012 21:21:37 -0800 Subject: don't print blank lines in log if no valid SPF result --- tools/libskrewt.c | 3 ++- tools/sepofra.c | 6 ++++-- tools/testall | 9 --------- tools/testall-skrewt | 9 +++++++++ tools/testall-ward | 9 +++++++++ 5 files changed, 24 insertions(+), 12 deletions(-) delete mode 100755 tools/testall create mode 100755 tools/testall-skrewt create mode 100755 tools/testall-ward diff --git a/tools/libskrewt.c b/tools/libskrewt.c index f51a8bc..c8f2ccd 100644 --- a/tools/libskrewt.c +++ b/tools/libskrewt.c @@ -223,7 +223,8 @@ void check_spf(name_tester& fqdn, const string ip) { "", /* rcpt_to */ 0 /* verbosity */ ); - cerr << progid << " " << my_spf.explain() << endl; + string exp = my_spf.explain(); + if (exp != "") cerr << progid << " " << exp << endl; // keep a copy of the result: fqdn.spf = neutral; if (my_spf.result == SPF_RESULT_PASS) fqdn.spf = pass; diff --git a/tools/sepofra.c b/tools/sepofra.c index 25b73b7..0a731b9 100644 --- a/tools/sepofra.c +++ b/tools/sepofra.c @@ -123,13 +123,15 @@ void sepofra::check( return; } +// return "" if result is invalid +// otherwise build a string explaining how SPF reached its conclusion string sepofra::explain() const { if (result == SPF_RESULT_INVALID) return ""; -// now build a string stringstream build; string summary = SPF_strresult(result); if (result != SPF_RESULT_PASS - && result != SPF_RESULT_FAIL) summary = "neutral"; + && result != SPF_RESULT_FAIL + && result != SPF_RESULT_INVALID) summary = "neutral"; char hostname[1+HOST_NAME_MAX]; gethostname(hostname, 1+HOST_NAME_MAX); diff --git a/tools/testall b/tools/testall deleted file mode 100755 index 27b912b..0000000 --- a/tools/testall +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/bash - -i=0 -for file in /home/jsd/Maildir/cur/* ; do - ((ii++)) - echo "**** $ii $file" - <$file ./ward -err >/tmp/testall.eml && diff $file /tmp/testall.eml || exit 1 -done -echo OK diff --git a/tools/testall-skrewt b/tools/testall-skrewt new file mode 100755 index 0000000..52e62cb --- /dev/null +++ b/tools/testall-skrewt @@ -0,0 +1,9 @@ +#! /bin/bash + +i=0 +for file in /home/jsd/Maildir/cur/* ; do + ((ii++)) + echo "**** $ii $file" + <$file ./skrewt -err >/tmp/testall.eml && diff $file /tmp/testall.eml || exit 1 +done +echo OK diff --git a/tools/testall-ward b/tools/testall-ward new file mode 100755 index 0000000..27b912b --- /dev/null +++ b/tools/testall-ward @@ -0,0 +1,9 @@ +#! /bin/bash + +i=0 +for file in /home/jsd/Maildir/cur/* ; do + ((ii++)) + echo "**** $ii $file" + <$file ./ward -err >/tmp/testall.eml && diff $file /tmp/testall.eml || exit 1 +done +echo OK -- cgit v1.2.3