Mercurial > dnsbl
diff 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 |
line wrap: on
line diff
--- a/src/context.cpp Sat Jul 21 13:13:07 2012 -0700 +++ b/src/context.cpp Wed May 22 11:29:44 2013 -0700 @@ -55,6 +55,7 @@ const char *token_rate; const char *token_rbrace; const char *token_require; +const char *token_requirerdns; const char *token_semi; const char *token_soft; const char *token_spamassassin; @@ -725,6 +726,7 @@ tag_limit_message = NULL; spamassassin_limit = (parent) ? parent->spamassassin_limit : 0; require_match = (parent) ? parent->require_match : false; + require_rdns = (parent) ? parent->require_rdns : false; dcc_greylist = (parent) ? parent->dcc_greylist : false; dcc_bulk_threshold = (parent) ? parent->dcc_bulk_threshold : 0; dnsbl_list_parsed = false; @@ -1074,6 +1076,7 @@ printf(" %s", d.name); } printf("; \n"); + printf("%s require_rdns %s; \n", indent, (require_rdns) ? "yes" : "no"); } { @@ -1350,6 +1353,22 @@ //////////////////////////////////////////////// // +bool parse_requirerdns(TOKEN &tok, CONFIG &dc, CONTEXT &me); +bool parse_requirerdns(TOKEN &tok, CONFIG &dc, CONTEXT &me) { + const char *have = tok.next(); + if (have == token_yes) me.set_requirerdns(true); + else if (have == token_no) me.set_requirerdns(false); + else { + tok.token_error("yes/no", have); + return false; + } + if (!tsa(tok, token_semi)) return false; + return true; +} + + +//////////////////////////////////////////////// +// bool parse_content(TOKEN &tok, CONFIG &dc, CONTEXT &me); bool parse_content(TOKEN &tok, CONFIG &dc, CONTEXT &me) { const char *setting = tok.next(); @@ -1768,6 +1787,9 @@ else if (have == token_dnswll) { if (!parse_dnswll(tok, dc, *con)) return false; } + else if (have == token_requirerdns) { + if (!parse_requirerdns(tok, dc, *con)) return false; + } else if (have == token_content) { if (!parse_content(tok, dc, *con)) return false; } @@ -1877,6 +1899,7 @@ token_rate = register_string("rate_limit"); token_rbrace = register_string("}"); token_require = register_string("require_match"); + token_requirerdns = register_string("require_rdns"); token_semi = register_string(";"); token_soft = register_string("soft"); token_spamassassin = register_string("spamassassin");