Mercurial > dnsbl
comparison 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 |
comparison
equal
deleted
inserted
replaced
357:043424ccb5f7 | 358:ef7479b2d64f |
---|---|
1524 else priv.dkim_ok = false; | 1524 else priv.dkim_ok = false; |
1525 } | 1525 } |
1526 } | 1526 } |
1527 | 1527 |
1528 // only look at the first from header | 1528 // only look at the first from header |
1529 // this does NOT fully parse rfc2822 from: headers. In particular, embedded | |
1530 // comments and quoted @ are not handled. | |
1529 if ((!priv.fromaddr) && (strcasecmp(headerf, "from") == 0)) { | 1531 if ((!priv.fromaddr) && (strcasecmp(headerf, "from") == 0)) { |
1530 const int nmatch = 2; | 1532 const int nmatch = 2; |
1531 regmatch_t match[nmatch]; | 1533 regmatch_t match[nmatch]; |
1532 if (0 == regexec(&from_pattern, value, nmatch, match, 0)) { | 1534 if (0 == regexec(&from_pattern, value, nmatch, match, 0)) { |
1533 int s1 = match[1].rm_so; // domain | 1535 int s1 = match[1].rm_so; // domain |
1919 printf("cannot compile regex pattern to find dkim signatures\n"); | 1921 printf("cannot compile regex pattern to find dkim signatures\n"); |
1920 exit(3); | 1922 exit(3); |
1921 } | 1923 } |
1922 | 1924 |
1923 // setup from domain extraction | 1925 // setup from domain extraction |
1924 if (regcomp(&from_pattern, "@([a-zA-Z0-9.-]+)", REG_ICASE | REG_EXTENDED)) { | 1926 if (regcomp(&from_pattern, ".*@([a-zA-Z0-9.-]+)", REG_ICASE | REG_EXTENDED)) { |
1925 printf("cannot compile regex pattern to find dkim signatures\n"); | 1927 printf("cannot compile regex pattern to find dkim signatures\n"); |
1926 exit(3); | 1928 exit(3); |
1927 } | 1929 } |
1928 | 1930 |
1929 // Process command line options | 1931 // Process command line options |