diff src/dnsbl.cpp @ 358:ef7479b2d64f

use the last @domain in the from: header
author Carl Byington <carl@five-ten-sg.com>
date Mon, 16 Jan 2017 08:23:26 -0800
parents 90d433d1382e
children df45a2377632
line wrap: on
line diff
--- a/src/dnsbl.cpp	Sun Jan 08 21:17:32 2017 -0800
+++ b/src/dnsbl.cpp	Mon Jan 16 08:23:26 2017 -0800
@@ -1526,6 +1526,8 @@
     }
 
     // only look at the first from header
+    // this does NOT fully parse rfc2822 from: headers. In particular, embedded
+    // comments and quoted @ are not handled.
     if ((!priv.fromaddr) && (strcasecmp(headerf, "from") == 0)) {
         const int nmatch = 2;
         regmatch_t match[nmatch];
@@ -1921,7 +1923,7 @@
     }
 
     // setup from domain extraction
-    if (regcomp(&from_pattern, "@([a-zA-Z0-9.-]+)", REG_ICASE | REG_EXTENDED)) {
+    if (regcomp(&from_pattern, ".*@([a-zA-Z0-9.-]+)", REG_ICASE | REG_EXTENDED)) {
         printf("cannot compile regex pattern to find dkim signatures\n");
         exit(3);
     }