comparison src/dnsbl.cpp @ 216:784030ac71f1

Never whitelist self addressed mail. Changes for Fedora 10 and const correctness.
author Carl Byington <carl@five-ten-sg.com>
date Sat, 27 Dec 2008 22:40:12 -0800
parents 82886d4dd71f
children 495cfe5caead
comparison
equal deleted inserted replaced
215:faac35ae3ccc 216:784030ac71f1
1025 DNSBLP rejectlist = NULL; // list that caused the reject 1025 DNSBLP rejectlist = NULL; // list that caused the reject
1026 mlfiPriv &priv = *MLFIPRIV; 1026 mlfiPriv &priv = *MLFIPRIV;
1027 CONFIG &dc = *priv.pc; 1027 CONFIG &dc = *priv.pc;
1028 const char *rcptaddr = rcpt[0]; 1028 const char *rcptaddr = rcpt[0];
1029 const char *loto = to_lower_string(rcptaddr); 1029 const char *loto = to_lower_string(rcptaddr);
1030 bool self = (strcmp(loto, priv.mailaddr) == 0);
1030 1031
1031 // some version of sendmail allowed rcpt to:<> and passed it thru to the milters 1032 // some version of sendmail allowed rcpt to:<> and passed it thru to the milters
1032 if (strcmp(loto, "<>") == 0) { 1033 if (strcmp(loto, "<>") == 0) {
1033 smfi_setreply(ctx, (char*)"550", (char*)"5.7.1", (char*)"bogus recipient"); 1034 smfi_setreply(ctx, (char*)"550", (char*)"5.7.1", (char*)"bogus recipient");
1034 return SMFIS_REJECT; 1035 return SMFIS_REJECT;
1070 st = white; 1071 st = white;
1071 } 1072 }
1072 else if (fromvalue == token_black) { 1073 else if (fromvalue == token_black) {
1073 st = black; 1074 st = black;
1074 } 1075 }
1075 else if (fromvalue == token_white) { 1076 else if ((fromvalue == token_white) && !self) {
1076 st = white; 1077 st = white;
1077 } 1078 }
1078 else { 1079 else {
1079 // check the dns based lists 1080 // check the dns based lists
1080 st = (check_dnsbl(priv, con.get_dnsbl_list(), rejectlist)) ? reject : oksofar; 1081 st = (check_dnsbl(priv, con.get_dnsbl_list(), rejectlist)) ? reject : oksofar;
1578 fprintf(stdout, "envelope to <%s> finds context %s\n", to, con->get_full_name(buf,maxlen)); 1579 fprintf(stdout, "envelope to <%s> finds context %s\n", to, con->get_full_name(buf,maxlen));
1579 CONTEXTP fc = con->find_context(from); 1580 CONTEXTP fc = con->find_context(from);
1580 fprintf(stdout, "envelope from <%s> finds context %s\n", from, fc->get_full_name(buf,maxlen)); 1581 fprintf(stdout, "envelope from <%s> finds context %s\n", from, fc->get_full_name(buf,maxlen));
1581 const char *st = fc->find_from(from); 1582 const char *st = fc->find_from(from);
1582 fprintf(stdout, "envelope from <%s> finds status %s\n", from, st); 1583 fprintf(stdout, "envelope from <%s> finds status %s\n", from, st);
1584 bool self = (strcmp(from, to) == 0);
1585 if ((st == token_white) && self) fprintf(stdout, "ignore self whitelisting\n");
1583 delete conf; 1586 delete conf;
1584 } 1587 }
1585 } 1588 }
1586 return 0; 1589 return 0;
1587 } 1590 }