comparison src/dnsbl.cpp @ 257:d11b529ce9c5 stable-6-0-31

Fix uribl lookups on client dns name, need to strip the ip address in brackets
author Carl Byington <carl@five-ten-sg.com>
date Sun, 01 Jul 2012 10:13:30 -0700
parents d6d5c50b9278
children be939802c64e
comparison
equal deleted inserted replaced
256:818cabace58f 257:d11b529ce9c5
485 helo = NULL; 485 helo = NULL;
486 mailaddr = NULL; 486 mailaddr = NULL;
487 queueid = NULL; 487 queueid = NULL;
488 authenticated = NULL; 488 authenticated = NULL;
489 client_name = NULL; 489 client_name = NULL;
490 client_dns_name = NULL;
490 host_uribl = NULL; 491 host_uribl = NULL;
491 helo_uribl = false; 492 helo_uribl = false;
492 client_uribl = false; 493 client_uribl = false;
493 from_uribl = false; 494 from_uribl = false;
494 have_whites = false; 495 have_whites = false;
526 const char *loto = dwp->get_loto(); 527 const char *loto = dwp->get_loto();
527 if (loto) free((void*)loto); 528 if (loto) free((void*)loto);
528 delete dwp; 529 delete dwp;
529 delayer.pop_front(); 530 delayer.pop_front();
530 } 531 }
531 if (mailaddr) free((void*)mailaddr); 532 if (mailaddr) free((void*)mailaddr);
532 if (queueid) free((void*)queueid); 533 if (queueid) free((void*)queueid);
533 if (authenticated) free((void*)authenticated); 534 if (authenticated) free((void*)authenticated);
534 if (client_name) free((void*)client_name); 535 if (client_name) free((void*)client_name);
536 if (client_dns_name) free((void*)client_dns_name);
535 discard(hosts_uribl); 537 discard(hosts_uribl);
536 delayer.clear(); 538 delayer.clear();
537 discard(env_to); 539 discard(env_to);
538 if (memory) delete memory; 540 if (memory) delete memory;
539 if (scanner) delete scanner; 541 if (scanner) delete scanner;
544 eom = false; 546 eom = false;
545 mailaddr = NULL; 547 mailaddr = NULL;
546 queueid = NULL; 548 queueid = NULL;
547 authenticated = NULL; 549 authenticated = NULL;
548 client_name = NULL; 550 client_name = NULL;
551 client_dns_name = NULL;
549 host_uribl = NULL; 552 host_uribl = NULL;
550 helo_uribl = false; 553 helo_uribl = false;
551 client_uribl = false; 554 client_uribl = false;
552 from_uribl = false; 555 from_uribl = false;
553 have_whites = false; 556 have_whites = false;
679 content_host_ignore = &con.get_content_host_ignore(); 682 content_host_ignore = &con.get_content_host_ignore();
680 // if we are using uribl, test helo and client names here 683 // if we are using uribl, test helo and client names here
681 if (uribl_suffix) { 684 if (uribl_suffix) {
682 if (helo) { 685 if (helo) {
683 helo_uribl = check_uribl(*this, hosts_uribl, helo, host_uribl); 686 helo_uribl = check_uribl(*this, hosts_uribl, helo, host_uribl);
684 if (client_name && !helo_uribl) { 687 }
685 client_uribl = check_uribl(*this, hosts_uribl, client_name, host_uribl); 688 if (client_dns_name && !helo_uribl) {
686 if (mailaddr && !client_uribl) { 689 client_uribl = check_uribl(*this, hosts_uribl, client_dns_name, host_uribl);
687 const char *f = strchr(mailaddr, '@'); 690 }
688 if (f) from_uribl = check_uribl(*this, hosts_uribl, f+1, host_uribl); 691 if (mailaddr && !client_uribl) {
689 } 692 const char *f = strchr(mailaddr, '@');
690 } 693 if (f) from_uribl = check_uribl(*this, hosts_uribl, f+1, host_uribl);
691 } 694 }
692 } 695 }
693 } 696 }
694 } 697 }
695 698
1131 priv.queueid = strdup(smfi_getsymval(ctx, (char*)"i")); 1134 priv.queueid = strdup(smfi_getsymval(ctx, (char*)"i"));
1132 priv.authenticated = smfi_getsymval(ctx, (char*)"{auth_authen}"); 1135 priv.authenticated = smfi_getsymval(ctx, (char*)"{auth_authen}");
1133 priv.client_name = smfi_getsymval(ctx, (char*)"_"); 1136 priv.client_name = smfi_getsymval(ctx, (char*)"_");
1134 if (!priv.helo) priv.helo = strdup("unknown"); 1137 if (!priv.helo) priv.helo = strdup("unknown");
1135 if (priv.authenticated) priv.authenticated = strdup(priv.authenticated); 1138 if (priv.authenticated) priv.authenticated = strdup(priv.authenticated);
1136 if (priv.client_name) priv.client_name = strdup(priv.client_name); 1139 if (priv.client_name) {
1140 priv.client_name = strdup(priv.client_name);
1141 const char *p = strstr(priv.client_name, " [");
1142 if (p) {
1143 uint pp = p - priv.client_name;
1144 priv.client_dns_name = strdup(priv.client_name);
1145 priv.client_dns_name[pp] = '\0';
1146 char text[500];
1147 snprintf(text, sizeof(text), "found simple dns client name %s", priv.client_dns_name);
1148 my_syslog(text);
1149 }
1150 }
1137 if (spamc != spamc_empty) { 1151 if (spamc != spamc_empty) {
1138 priv.assassin = new SpamAssassin(&priv, priv.ip, priv.helo, priv.mailaddr, priv.queueid); 1152 priv.assassin = new SpamAssassin(&priv, priv.ip, priv.helo, priv.mailaddr, priv.queueid);
1139 } 1153 }
1140 if (dccifd_port) { 1154 if (dccifd_port) {
1141 priv.dccifd = new DccInterface(dccifd_port, &priv, priv.ip, priv.helo, priv.mailaddr); 1155 priv.dccifd = new DccInterface(dccifd_port, &priv, priv.ip, priv.helo, priv.mailaddr);