On Mon, Jul 16, 2007 at 04:05:46PM +0200, Magnus Holmgren wrote:
> 
> I appreciate your debugging work. Nonetheless, I think most contributors of 
> patches usually let their code be included under the pertinent project 
> license, and are satisfied with an acknowledgement in the changelog, or, 
> after accumulating a substantial amount of contributed work, in the regular 
> AUTHORS file or similar. I would greatly appreciate it if you could do the 
> same, because when code is submitted under different licenses it can, at 
> least eventually, become rather messy to keep track of what parts of the 
> package can be used under what license.

Ok.  I said I would do it if the upstream maintainer requests it.  You're
upstream maintainer in a way now, so that would be fair enough I think.

Patch attached.  You don't need to acknowledge my name, though.

-- 
Robert Millan

My spam trap is [EMAIL PROTECTED]  Note: this address is only intended
for spam harvesters.  Writing to it will get you added to my black list.
diff -ur libspf2-1.2.5.dfsg.old/src/libspf2/spf_interpret.c libspf2-1.2.5.dfsg/src/libspf2/spf_interpret.c
--- libspf2-1.2.5.dfsg.old/src/libspf2/spf_interpret.c	2005-02-22 04:41:27.000000000 +0100
+++ libspf2-1.2.5.dfsg/src/libspf2/spf_interpret.c	2007-07-01 01:03:17.000000000 +0200
@@ -135,7 +145,9 @@
 
 	/* Is this cur_dom? */
 	sender_dom = spf_request->env_from_dp;
-	if (sender_dom == NULL)
+
+	/* For MAILER-DAEMON messages, fallback to helo domain */
+	if ((sender_dom == NULL) || (sender_dom[0] == '\0'))
 		sender_dom = spf_request->helo_dom;
 
 	if ( spf_response->reason == SPF_REASON_LOCAL_POLICY ) {
@@ -214,11 +226,15 @@
 		break;
 
 	case SPF_RESULT_NEUTRAL:
-	case SPF_RESULT_NONE:
 		snprintf( p, p_end - p, "%s is neither permitted nor denied by %s",
 				  ip, spf_source );
 		break;
 
+	case SPF_RESULT_NONE:
+		snprintf( p, p_end - p, "%s doesn't provide an SPF record",
+				  spf_source );
+		break;
+
 	case SPF_RESULT_TEMPERROR:
 		snprintf( p, p_end - p, "encountered temporary error during SPF processing of %s",
 				  spf_source );
@@ -686,8 +702,12 @@
 
 #define SPF_GET_LOOKUP_DATA() \
 	do {												\
-		if ( data == data_end )							\
+		if ( data == data_end ) {								\
 			lookup = spf_request->cur_dom;				\
+			/* For MAILER-DAEMON messages, fallback to helo domain */			\
+			if ((lookup == NULL) || (lookup[0] == '\0'))					\
+				lookup = spf_request->helo_dom;						\
+		}											\
 		else {											\
 			err = SPF_record_expand_data( spf_server,	\
 							spf_request, spf_response,	\
@@ -1022,7 +1042,10 @@
 				if (spf_record_subr)
 					SPF_record_free(spf_record_subr);
 				SPF_FREE_LOOKUP_DATA();
-				return DONE_TEMPERR( err );
+				if (err == SPF_E_DNS_ERROR)
+					return DONE_TEMPERR( err );
+				else
+					return DONE_PERMERR( err );
 			}
 
 			/*
diff -ur libspf2-1.2.5.dfsg.old/src/libspf2/spf_result.c libspf2-1.2.5.dfsg/src/libspf2/spf_result.c
--- libspf2-1.2.5.dfsg.old/src/libspf2/spf_result.c	2004-08-10 15:04:02.000000000 +0200
+++ libspf2-1.2.5.dfsg/src/libspf2/spf_result.c	2007-07-01 01:03:29.000000000 +0200
@@ -187,11 +197,15 @@
 	break;
 	
     case SPF_RESULT_NEUTRAL:
-    case SPF_RESULT_NONE:
 	snprintf( p, p_end - p, "%s is neither permitted nor denied by %s",
 		  ip, spf_source );
 	break;
 
+    case SPF_RESULT_NONE:
+	snprintf( p, p_end - p, "%s doesn't provide an SPF record",
+		  spf_source );
+	break;
+
     case SPF_RESULT_ERROR:
 	snprintf( p, p_end - p, "encountered temporary error during SPF processing of %s",
 		  spf_source );
diff -ur libspf2-1.2.5.dfsg.old/src/libspf2/spf_server.c libspf2-1.2.5.dfsg/src/libspf2/spf_server.c
--- libspf2-1.2.5.dfsg.old/src/libspf2/spf_server.c	2005-02-19 04:52:58.000000000 +0100
+++ libspf2-1.2.5.dfsg/src/libspf2/spf_server.c	2007-07-01 01:04:34.000000000 +0200
@@ -262,6 +272,9 @@
 	SPF_ASSERT_NOTNULL(spf_recordp);
 
 	domain = spf_request->cur_dom;
+	/* For MAILER-DAEMON messages, fallback to helo domain */
+	if ((domain == NULL) || (domain[0] == '\0'))
+		domain = spf_request->helo_dom;
 	SPF_ASSERT_NOTNULL(domain);
 
 	*spf_recordp = NULL;
@@ -279,8 +292,7 @@
 			SPF_dns_rr_free(rr_txt);
 			spf_response->result = SPF_RESULT_NONE;
 			spf_response->reason = SPF_REASON_FAILURE;
-			return SPF_response_add_error(spf_response, 
-SPF_E_NOT_SPF,
+			return SPF_response_add_error(spf_response, SPF_E_NOT_SPF,
 					"Host '%s' not found.", domain);
 			break;
 

Reply via email to