Mercurial > dnsbl
comparison src/context.cpp @ 362:bcfbffe254ed
check whitelisted dkim signers before dkim_from restrictions
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Mon, 16 Jan 2017 12:38:44 -0800 |
parents | 17f21fcd44a8 |
children | fd145e9a3df0 |
comparison
equal
deleted
inserted
replaced
361:07b88307d90a | 362:bcfbffe254ed |
---|---|
1121 } | 1121 } |
1122 | 1122 |
1123 | 1123 |
1124 const char *CONTEXT::acceptable_content(recorder &memory, int score, int bulk, const char *queueid, string_set &signers, const char *from, string& msg) { | 1124 const char *CONTEXT::acceptable_content(recorder &memory, int score, int bulk, const char *queueid, string_set &signers, const char *from, string& msg) { |
1125 DKIMP dk = find_dkim_from(from); | 1125 DKIMP dk = find_dkim_from(from); |
1126 | |
1127 for (string_set::iterator s=signers.begin(); s!=signers.end(); s++) { | |
1128 const char *st = find_dkim_signer(*s); | |
1129 // signed by a white listed signer | |
1130 if (st == token_white) { | |
1131 log(queueid, "whitelisted dkim signer %s", *s); | |
1132 return token_white; | |
1133 } | |
1134 } | |
1135 | |
1126 if (dk) { | 1136 if (dk) { |
1127 const char *st = dk->action; | 1137 const char *st = dk->action; |
1128 for (string_set::iterator s=signers.begin(); s!=signers.end(); s++) { | 1138 for (string_set::iterator s=signers.begin(); s!=signers.end(); s++) { |
1129 // signed by a white listed signer | 1139 // signed by a white listed signer |
1130 if ((st == token_signed_white) && in_signing_set(*s,dk->signer)) { | 1140 if ((st == token_signed_white) && in_signing_set(*s,dk->signer)) { |
1147 if (st == token_require_signed) { | 1157 if (st == token_require_signed) { |
1148 char buf[maxlen]; | 1158 char buf[maxlen]; |
1149 snprintf(buf, sizeof(buf), "Mail rejected - not dkim signed by %s", dk->signer); | 1159 snprintf(buf, sizeof(buf), "Mail rejected - not dkim signed by %s", dk->signer); |
1150 msg = string(buf); | 1160 msg = string(buf); |
1151 return token_black; | 1161 return token_black; |
1152 } | |
1153 } | |
1154 | |
1155 for (string_set::iterator s=signers.begin(); s!=signers.end(); s++) { | |
1156 const char *st = find_dkim_signer(*s); | |
1157 // signed by a white listed signer | |
1158 if (st == token_white) { | |
1159 log(queueid, "whitelisted dkim signer %s", *s); | |
1160 return token_white; | |
1161 } | 1162 } |
1162 } | 1163 } |
1163 | 1164 |
1164 for (string_set::iterator s=signers.begin(); s!=signers.end(); s++) { | 1165 for (string_set::iterator s=signers.begin(); s!=signers.end(); s++) { |
1165 const char *st = find_dkim_signer(*s); | 1166 const char *st = find_dkim_signer(*s); |