Re: [Patch] fix unset received-spf header and return codes

Wolfgang Breyha <[email protected]> Wed, 01 Jun 2011 17:52:03 +0200
Newsgroups gmane.mail.spam.spf.devel
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------050409020401000306040202
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hi again!

Sorry. I attached the wrong patch.

This is the right one now.

Greetings, Wolfgang

Wolfgang Breyha wrote, on 01.06.2011 17:46:
> Hi!
> 
> The attached patch fixes two things in libspf2 1.2.9
> 
> *) if spf results to NONE or anything else without SPF record
>    no received_header and comment was set
> 
> *) if DNS fails either temporary or permanent the result was (invalid).
>    It returns TEMPERROR and PERMERROR now.
> 
> Greetings, Wolfgang

-- 
Wolfgang Breyha <[email protected]> | http://www.blafasel.at/
Vienna University Computer Center | Austria




-------------------------------------------
Sender Policy Framework: http://www.openspf.org [http://www.openspf.org]
Modify Your Subscription: http://www.listbox.com/member/ [http://www.listbox.com/member/]

Archives: https://www.listbox.com/member/archive/1007/=now
RSS Feed: https://www.listbox.com/member/archive/rss/1007/6959932-f3d1312d
Modify Your Subscription: https://www.listbox.com/member/?member_id=6959932&id_secret=6959932-d95100fc
Unsubscribe Now: https://www.listbox.com/unsubscribe/?member_id=6959932&id_secret=6959932-4aedb9c4&post_id=20110601115210:5624AA8C-8C67-11E0-A57E-348BF559ED1D
Powered by Listbox: http://www.listbox.com

--------------050409020401000306040202
Content-Type: text/x-patch;
 name="libspf2-129-results.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="libspf2-129-results.patch"

diff -urN libspf2-1.2.9.orig/src/libspf2/spf_interpret.c libspf2-1.2.9/src/libspf2/spf_interpret.c
--- libspf2-1.2.9.orig/src/libspf2/spf_interpret.c	2008-10-22 17:47:43.000000000 +0200
+++ libspf2-1.2.9/src/libspf2/spf_interpret.c	2011-06-01 16:54:41.000000000 +0200
@@ -104,7 +104,6 @@
 		case SPF_RESULT_FAIL:
 		case SPF_RESULT_SOFTFAIL:
 		case SPF_RESULT_NEUTRAL:
-		case SPF_RESULT_NONE:
 
 			err = SPF_i_set_explanation(spf_response);
 			if (err != SPF_E_SUCCESS)
@@ -126,6 +125,7 @@
 		case SPF_RESULT_PASS:
 		case SPF_RESULT_TEMPERROR:
 		case SPF_RESULT_PERMERROR:
+		case SPF_RESULT_NONE:
 		default:
 			break;
 	}
diff -urN libspf2-1.2.9.orig/src/libspf2/spf_request.c libspf2-1.2.9/src/libspf2/spf_request.c
--- libspf2-1.2.9.orig/src/libspf2/spf_request.c	2008-11-03 21:34:14.000000000 +0100
+++ libspf2-1.2.9/src/libspf2/spf_request.c	2011-06-01 17:13:11.000000000 +0200
@@ -246,6 +246,7 @@
 	if (err != SPF_E_SUCCESS) {
 		if (spf_record)
 			SPF_record_free(spf_record);
+		SPF_i_done(spf_response, spf_response->result, spf_response->reason, spf_response->err);
 		return err;
 	}
 	/* Now, in theory, SPF_response_errors(spf_response) == 0 */
diff -urN libspf2-1.2.9.orig/src/libspf2/spf_server.c libspf2-1.2.9/src/libspf2/spf_server.c
--- libspf2-1.2.9.orig/src/libspf2/spf_server.c	2008-11-04 01:09:49.000000000 +0100
+++ libspf2-1.2.9/src/libspf2/spf_server.c	2011-06-01 17:12:02.000000000 +0200
@@ -383,6 +383,8 @@
 			if (spf_server->debug > 0)
 				SPF_debugf("get_record(%s): TRY_AGAIN", domain);
 			SPF_dns_rr_free(rr_txt);
+			spf_response->result = SPF_RESULT_TEMPERROR;
+			spf_response->reason = SPF_REASON_FAILURE;
 			return SPF_response_add_error(spf_response, SPF_E_DNS_ERROR,
 					"Temporary DNS failure for '%s'.", domain);
 			// break;
@@ -391,6 +393,8 @@
 			if (spf_server->debug > 0)
 				SPF_debugf("get_record(%s): NO_RECOERY", domain);
 			SPF_dns_rr_free(rr_txt);
+			spf_response->result = SPF_RESULT_PERMERROR;
+			spf_response->reason = SPF_REASON_FAILURE;
 			return SPF_response_add_error(spf_response, SPF_E_DNS_ERROR,
 					"Unrecoverable DNS failure for '%s'.", domain);
 			// break;

--------------050409020401000306040202--