comparison src/context.cpp @ 268:f941563c2a95 stable-6-0-34

Add require_rdns checking
author Carl Byington <carl@five-ten-sg.com>
date Wed, 22 May 2013 11:29:44 -0700
parents 582cfb9c4031
children f92f24950bd3
comparison
equal deleted inserted replaced
267:db12f6028f8b 268:f941563c2a95
53 const char *token_ok2; 53 const char *token_ok2;
54 const char *token_on; 54 const char *token_on;
55 const char *token_rate; 55 const char *token_rate;
56 const char *token_rbrace; 56 const char *token_rbrace;
57 const char *token_require; 57 const char *token_require;
58 const char *token_requirerdns;
58 const char *token_semi; 59 const char *token_semi;
59 const char *token_soft; 60 const char *token_soft;
60 const char *token_spamassassin; 61 const char *token_spamassassin;
61 const char *token_substitute; 62 const char *token_substitute;
62 const char *token_tld; 63 const char *token_tld;
723 host_random = (parent) ? parent->host_random : false; 724 host_random = (parent) ? parent->host_random : false;
724 tag_limit = (parent) ? parent->tag_limit : 0; 725 tag_limit = (parent) ? parent->tag_limit : 0;
725 tag_limit_message = NULL; 726 tag_limit_message = NULL;
726 spamassassin_limit = (parent) ? parent->spamassassin_limit : 0; 727 spamassassin_limit = (parent) ? parent->spamassassin_limit : 0;
727 require_match = (parent) ? parent->require_match : false; 728 require_match = (parent) ? parent->require_match : false;
729 require_rdns = (parent) ? parent->require_rdns : false;
728 dcc_greylist = (parent) ? parent->dcc_greylist : false; 730 dcc_greylist = (parent) ? parent->dcc_greylist : false;
729 dcc_bulk_threshold = (parent) ? parent->dcc_bulk_threshold : 0; 731 dcc_bulk_threshold = (parent) ? parent->dcc_bulk_threshold : 0;
730 dnsbl_list_parsed = false; 732 dnsbl_list_parsed = false;
731 dnswl_list_parsed = false; 733 dnswl_list_parsed = false;
732 default_rcpt_rate = 36000; // 10 per second 734 default_rcpt_rate = 36000; // 10 per second
1072 for (dnsblp_list::iterator i=dl.begin(); i!=dl.end(); i++) { 1074 for (dnsblp_list::iterator i=dl.begin(); i!=dl.end(); i++) {
1073 DNSBL &d = *(*i); 1075 DNSBL &d = *(*i);
1074 printf(" %s", d.name); 1076 printf(" %s", d.name);
1075 } 1077 }
1076 printf("; \n"); 1078 printf("; \n");
1079 printf("%s require_rdns %s; \n", indent, (require_rdns) ? "yes" : "no");
1077 } 1080 }
1078 1081
1079 { 1082 {
1080 dnswlp_list dl = get_dnswl_list(); 1083 dnswlp_list dl = get_dnswl_list();
1081 printf("%s dnswl_list", indent); 1084 printf("%s dnswl_list", indent);
1342 tok.token_error("dnswl name", have); 1345 tok.token_error("dnswl name", have);
1343 return false; 1346 return false;
1344 } 1347 }
1345 } 1348 }
1346 me.set_dnswll_parsed(); 1349 me.set_dnswll_parsed();
1350 return true;
1351 }
1352
1353
1354 ////////////////////////////////////////////////
1355 //
1356 bool parse_requirerdns(TOKEN &tok, CONFIG &dc, CONTEXT &me);
1357 bool parse_requirerdns(TOKEN &tok, CONFIG &dc, CONTEXT &me) {
1358 const char *have = tok.next();
1359 if (have == token_yes) me.set_requirerdns(true);
1360 else if (have == token_no) me.set_requirerdns(false);
1361 else {
1362 tok.token_error("yes/no", have);
1363 return false;
1364 }
1365 if (!tsa(tok, token_semi)) return false;
1347 return true; 1366 return true;
1348 } 1367 }
1349 1368
1350 1369
1351 //////////////////////////////////////////////// 1370 ////////////////////////////////////////////////
1766 if (!parse_dnswl(tok, dc, *con)) return false; 1785 if (!parse_dnswl(tok, dc, *con)) return false;
1767 } 1786 }
1768 else if (have == token_dnswll) { 1787 else if (have == token_dnswll) {
1769 if (!parse_dnswll(tok, dc, *con)) return false; 1788 if (!parse_dnswll(tok, dc, *con)) return false;
1770 } 1789 }
1790 else if (have == token_requirerdns) {
1791 if (!parse_requirerdns(tok, dc, *con)) return false;
1792 }
1771 else if (have == token_content) { 1793 else if (have == token_content) {
1772 if (!parse_content(tok, dc, *con)) return false; 1794 if (!parse_content(tok, dc, *con)) return false;
1773 } 1795 }
1774 else if (have == token_envto) { 1796 else if (have == token_envto) {
1775 if (!parse_envto(tok, dc, *con)) return false; 1797 if (!parse_envto(tok, dc, *con)) return false;
1875 token_ok2 = register_string("ok2"); 1897 token_ok2 = register_string("ok2");
1876 token_on = register_string("on"); 1898 token_on = register_string("on");
1877 token_rate = register_string("rate_limit"); 1899 token_rate = register_string("rate_limit");
1878 token_rbrace = register_string("}"); 1900 token_rbrace = register_string("}");
1879 token_require = register_string("require_match"); 1901 token_require = register_string("require_match");
1902 token_requirerdns = register_string("require_rdns");
1880 token_semi = register_string(";"); 1903 token_semi = register_string(";");
1881 token_soft = register_string("soft"); 1904 token_soft = register_string("soft");
1882 token_spamassassin = register_string("spamassassin"); 1905 token_spamassassin = register_string("spamassassin");
1883 token_substitute = register_string("substitute"); 1906 token_substitute = register_string("substitute");
1884 token_tld = register_string("tld"); 1907 token_tld = register_string("tld");