Mercurial > dnsbl
comparison src/dnsbl.cpp @ 333:89574f8a2f64
log regexec error extracting domain from header
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 19 Dec 2016 17:11:39 -0800 |
parents | 9800776436b9 |
children | a4f2fda72422 |
comparison
equal
deleted
inserted
replaced
332:ed04479a8e12 | 333:89574f8a2f64 |
---|---|
1501 } | 1501 } |
1502 | 1502 |
1503 if ((priv.header_count > 2) && (strcasecmp(headerf, "from"))) { | 1503 if ((priv.header_count > 2) && (strcasecmp(headerf, "from"))) { |
1504 const int nmatch = 2; | 1504 const int nmatch = 2; |
1505 regmatch_t match[nmatch]; | 1505 regmatch_t match[nmatch]; |
1506 if (0 == regexec(&from_pattern, msg, nmatch, match, 0)) { | 1506 int err = regexec(&from_pattern, msg, nmatch, match, 0); |
1507 if (err == 0) { | |
1507 int s1 = match[1].rm_so; // domain | 1508 int s1 = match[1].rm_so; // domain |
1508 int e1 = match[1].rm_eo; | 1509 int e1 = match[1].rm_eo; |
1509 if (s1 != -1) { | 1510 if (s1 != -1) { |
1510 msg[e1] = '\0'; | 1511 msg[e1] = '\0'; |
1511 priv.fromaddr = strdup(msg+s1); | 1512 priv.fromaddr = strdup(msg+s1); |
1512 } | 1513 } |
1514 } | |
1515 else { | |
1516 char buf[maxlen]; | |
1517 size_t n = regerror(err, &from_pattern, buf, maxlen); | |
1518 my_syslog(&priv, buf); | |
1513 } | 1519 } |
1514 } | 1520 } |
1515 | 1521 |
1516 // headers that avoid autowhitelisting | 1522 // headers that avoid autowhitelisting |
1517 if (((strcasecmp(headerf, "precedence") == 0) && (strcasecmp(headerv, "bulk") == 0)) || | 1523 if (((strcasecmp(headerf, "precedence") == 0) && (strcasecmp(headerv, "bulk") == 0)) || |