[Mimedefang] prepend new headers?

Matthew.van.Eerde at hbinc.com Matthew.van.Eerde at hbinc.com
Tue Dec 20 13:36:11 EST 2005


David F. Skoll wrote:
> Matthew.van.Eerde at hbinc.com wrote:
> 
>> I'm using a recent version of sendmail (8.13.1) which supports
>> smfi_insheader.
> 
>> Is it possible to configure MIMEDefang to use smfi_insheader instead
>> of smfi_addheader?
> 
> Not currently; patches are welcome!

Patch attached -- if smfi_insheader is available at compile time, MIMEDefang will use it to add headers instead of smfi_addheader.

I test whether smfi_insheader is available by checking whether SMFIR_INSHEADER is defined.

-- 
Matthew.van.Eerde (at) hbinc.com               805.964.4554 x902
Hispanic Business Inc./HireDiversity.com       Software Engineer
-------------- next part --------------
--- mimedefang.c.original	2005-12-20 09:57:27.000000000 -0800
+++ mimedefang.c	2005-12-20 10:17:21.000000000 -0800
@@ -1401,7 +1401,14 @@
 	    if (hdr && val) {
 		percent_decode((unsigned char *) hdr);
 		percent_decode((unsigned char *) val);
+/* Insert headers at the top if we can */
+#ifdef SMFIR_INSHEADER
+		MD_SMFI_TRY(smfi_insheader, (ctx, 0, hdr, val));
+
+#else
+/* If not, add them at the bottom */
 		MD_SMFI_TRY(smfi_addheader, (ctx, hdr, val));
+#endif
 	    }
 	    break;
 
@@ -1472,9 +1479,19 @@
 	if (data->myip) {
 	    snprintf(buffer, SMALLBUF, "%s on %s", scan_body, data->myip);
 	    buffer[SMALLBUF-1] = 0;
+/* Insert headers at the top if we can */
+#ifdef SMFIR_INSHEADER
+	    MD_SMFI_TRY(smfi_insheader, (ctx, 0, "X-Scanned-By", buffer));
+#else
 	    MD_SMFI_TRY(smfi_addheader, (ctx, "X-Scanned-By", buffer));
+#endif
 	} else {
+/* Insert headers at the top if we can */
+#ifdef SMFIR_INSHEADER
+            MD_SMFI_TRY(smfi_insheader, (ctx, 0, "X-Scanned-By", scan_body));
+#else
 	    MD_SMFI_TRY(smfi_addheader, (ctx, "X-Scanned-By", scan_body));
+#endif
 	}
     }
 


More information about the MIMEDefang mailing list