Mercurial > dnsbl
comparison src/dnsbl.cpp @ 238:7b818a4e21a4 stable-6-0-25
produce correct uribl message
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 29 Sep 2009 12:11:42 -0700 |
parents | c0d2e99c0a1d |
children | d8ee4c97b9ab |
comparison
equal
deleted
inserted
replaced
237:3845f16aa6dc | 238:7b818a4e21a4 |
---|---|
474 helo = NULL; | 474 helo = NULL; |
475 mailaddr = NULL; | 475 mailaddr = NULL; |
476 queueid = NULL; | 476 queueid = NULL; |
477 authenticated = NULL; | 477 authenticated = NULL; |
478 client_name = NULL; | 478 client_name = NULL; |
479 host_uribl = NULL; | |
479 helo_uribl = false; | 480 helo_uribl = false; |
480 client_uribl = false; | 481 client_uribl = false; |
481 from_uribl = false; | 482 from_uribl = false; |
482 have_whites = false; | 483 have_whites = false; |
483 only_whites = true; | 484 only_whites = true; |
518 } | 519 } |
519 if (mailaddr) free((void*)mailaddr); | 520 if (mailaddr) free((void*)mailaddr); |
520 if (queueid) free((void*)queueid); | 521 if (queueid) free((void*)queueid); |
521 if (authenticated) free((void*)authenticated); | 522 if (authenticated) free((void*)authenticated); |
522 if (client_name) free((void*)client_name); | 523 if (client_name) free((void*)client_name); |
524 discard(hosts_uribl); | |
523 delayer.clear(); | 525 delayer.clear(); |
524 discard(env_to); | 526 discard(env_to); |
525 if (memory) delete memory; | 527 if (memory) delete memory; |
526 if (scanner) delete scanner; | 528 if (scanner) delete scanner; |
527 if (assassin) delete assassin; | 529 if (assassin) delete assassin; |
531 eom = false; | 533 eom = false; |
532 mailaddr = NULL; | 534 mailaddr = NULL; |
533 queueid = NULL; | 535 queueid = NULL; |
534 authenticated = NULL; | 536 authenticated = NULL; |
535 client_name = NULL; | 537 client_name = NULL; |
538 host_uribl = NULL; | |
536 helo_uribl = false; | 539 helo_uribl = false; |
537 client_uribl = false; | 540 client_uribl = false; |
538 from_uribl = false; | 541 from_uribl = false; |
539 have_whites = false; | 542 have_whites = false; |
540 only_whites = true; | 543 only_whites = true; |
663 uribl_suffix = con.get_uribl_suffix(); | 666 uribl_suffix = con.get_uribl_suffix(); |
664 uribl_message = con.get_uribl_message(); | 667 uribl_message = con.get_uribl_message(); |
665 content_host_ignore = &con.get_content_host_ignore(); | 668 content_host_ignore = &con.get_content_host_ignore(); |
666 // if we are using uribl, test helo and client names here | 669 // if we are using uribl, test helo and client names here |
667 if (uribl_suffix) { | 670 if (uribl_suffix) { |
668 const char *found = NULL; | |
669 string_set hosts; | |
670 if (helo) { | 671 if (helo) { |
671 helo_uribl = check_uribl(*this, hosts, helo, found); | 672 helo_uribl = check_uribl(*this, hosts_uribl, helo, host_uribl); |
672 } | 673 if (client_name && !helo_uribl) { |
673 if (client_name && !helo_uribl) { | 674 client_uribl = check_uribl(*this, hosts_uribl, client_name, host_uribl); |
674 client_uribl = check_uribl(*this, hosts, client_name, found); | 675 if (mailaddr && !client_uribl) { |
675 } | 676 char *f = strchr(mailaddr, '@'); |
676 if (mailaddr && !client_uribl) { | 677 if (f) from_uribl = check_uribl(*this, hosts_uribl, f+1, host_uribl); |
677 char *f = strchr(mailaddr, '@'); | 678 } |
678 if (f) from_uribl = check_uribl(*this, hosts, f+1, found); | 679 } |
679 } | 680 } |
680 discard(hosts); | |
681 } | 681 } |
682 } | 682 } |
683 } | 683 } |
684 | 684 |
685 | 685 |
1204 priv.need_content_filter(rcptaddr, con); | 1204 priv.need_content_filter(rcptaddr, con); |
1205 char bu[maxlen]; | 1205 char bu[maxlen]; |
1206 bool uri = false; | 1206 bool uri = false; |
1207 // content filtering implies also checking helo name on uribl (if enabled) | 1207 // content filtering implies also checking helo name on uribl (if enabled) |
1208 if (priv.helo_uribl) { | 1208 if (priv.helo_uribl) { |
1209 snprintf(bu, sizeof(bu), "(helo %s)", priv.helo); | 1209 snprintf(bu, sizeof(bu), "(helo %s)", priv.host_uribl); |
1210 uri = true; | 1210 uri = true; |
1211 } | 1211 } |
1212 // content filterint implies also checking client reverse dns name on uribl (if enabled) | 1212 // content filterint implies also checking client reverse dns name on uribl (if enabled) |
1213 if (priv.client_uribl) { | 1213 if (priv.client_uribl) { |
1214 snprintf(bu, sizeof(bu), "(rdns %s)", priv.client_name); | 1214 snprintf(bu, sizeof(bu), "(rdns %s)", priv.host_uribl); |
1215 uri = true; | 1215 uri = true; |
1216 } | 1216 } |
1217 // content filterint implies also checking mail from domain name on uribl (if enabled) | 1217 // content filterint implies also checking mail from domain name on uribl (if enabled) |
1218 if (priv.from_uribl) { | 1218 if (priv.from_uribl) { |
1219 snprintf(bu, sizeof(bu), "(from %s)", priv.mailaddr); | 1219 snprintf(bu, sizeof(bu), "(from %s)", priv.host_uribl); |
1220 uri = true; | 1220 uri = true; |
1221 } | 1221 } |
1222 if (uri) { | 1222 if (uri) { |
1223 char buf[maxlen]; | 1223 char buf[maxlen]; |
1224 snprintf(buf, sizeof(buf), priv.uribl_message, bu); | 1224 snprintf(buf, sizeof(buf), priv.uribl_message, bu, priv.host_uribl); |
1225 smfi_setreply(ctx, (char*)"550", (char*)"5.7.1", buf); | 1225 smfi_setreply(ctx, (char*)"550", (char*)"5.7.1", buf); |
1226 return SMFIS_REJECT; | 1226 return SMFIS_REJECT; |
1227 } | 1227 } |
1228 } | 1228 } |
1229 // remember the non-whites | 1229 // remember the non-whites |