comparison src/dnsbl.cpp @ 230:ad38575e98ca

Prevent auto whitelisting due to outgoing multipart/report delivery notifications.
author Carl Byington <carl@five-ten-sg.com>
date Fri, 08 May 2009 12:55:30 -0700
parents 3fee608becbc
children 4d6bd04d93fa
comparison
equal deleted inserted replaced
229:b3652d1ae010 230:ad38575e98ca
256 pthread_mutex_lock(&config_mutex); 256 pthread_mutex_lock(&config_mutex);
257 pc = config; 257 pc = config;
258 pc->reference_count++; 258 pc->reference_count++;
259 pthread_mutex_unlock(&config_mutex); 259 pthread_mutex_unlock(&config_mutex);
260 get_fd(); 260 get_fd();
261 ctx = NULL; 261 ctx = NULL;
262 eom = false; 262 eom = false;
263 ip = 0; 263 ip = 0;
264 helo = NULL; 264 helo = NULL;
265 mailaddr = NULL; 265 mailaddr = NULL;
266 queueid = NULL; 266 queueid = NULL;
267 authenticated = NULL; 267 authenticated = NULL;
268 client_name = NULL; 268 client_name = NULL;
269 have_whites = false; 269 have_whites = false;
270 only_whites = true; 270 only_whites = true;
271 want_spamassassin = false; 271 want_spamassassin = false;
272 want_dccgrey = false; 272 want_dccgrey = false;
273 want_dccbulk = false; 273 want_dccbulk = false;
274 is_bulk_precedence = false; 274 allow_autowhitelisting = true;
275 content_context = NULL; 275 content_context = NULL;
276 memory = NULL; 276 memory = NULL;
277 scanner = NULL; 277 scanner = NULL;
278 content_suffix = NULL; 278 content_suffix = NULL;
279 content_message = NULL; 279 content_message = NULL;
280 uribl_suffix = NULL; 280 uribl_suffix = NULL;
281 uribl_message = NULL; 281 uribl_message = NULL;
282 content_host_ignore = NULL; 282 content_host_ignore = NULL;
283 assassin = NULL; 283 assassin = NULL;
284 dccifd = NULL; 284 dccifd = NULL;
285 } 285 }
286 286
287 mlfiPriv::~mlfiPriv() { 287 mlfiPriv::~mlfiPriv() {
288 return_fd(); 288 return_fd();
289 pthread_mutex_lock(&config_mutex); 289 pthread_mutex_lock(&config_mutex);
310 if (memory) delete memory; 310 if (memory) delete memory;
311 if (scanner) delete scanner; 311 if (scanner) delete scanner;
312 if (assassin) delete assassin; 312 if (assassin) delete assassin;
313 if (dccifd) delete dccifd; 313 if (dccifd) delete dccifd;
314 if (!final) { 314 if (!final) {
315 ctx = NULL; 315 ctx = NULL;
316 eom = false; 316 eom = false;
317 mailaddr = NULL; 317 mailaddr = NULL;
318 queueid = NULL; 318 queueid = NULL;
319 authenticated = NULL; 319 authenticated = NULL;
320 client_name = NULL; 320 client_name = NULL;
321 have_whites = false; 321 have_whites = false;
322 only_whites = true; 322 only_whites = true;
323 want_spamassassin = false; 323 want_spamassassin = false;
324 want_dccgrey = false; 324 want_dccgrey = false;
325 want_dccbulk = false; 325 want_dccbulk = false;
326 is_bulk_precedence = false; 326 allow_autowhitelisting = true;
327 content_context = NULL; 327 content_context = NULL;
328 memory = NULL; 328 memory = NULL;
329 scanner = NULL; 329 scanner = NULL;
330 content_suffix = NULL; 330 content_suffix = NULL;
331 content_message = NULL; 331 content_message = NULL;
332 uribl_suffix = NULL; 332 uribl_suffix = NULL;
333 uribl_message = NULL; 333 uribl_message = NULL;
334 content_host_ignore = NULL; 334 content_host_ignore = NULL;
335 assassin = NULL; 335 assassin = NULL;
336 dccifd = NULL; 336 dccifd = NULL;
337 } 337 }
338 } 338 }
339 339
340 void mlfiPriv::get_fd() { 340 void mlfiPriv::get_fd() {
341 err = true; 341 err = true;
1175 1175
1176 sfsistat mlfi_header(SMFICTX* ctx, char* headerf, char* headerv) 1176 sfsistat mlfi_header(SMFICTX* ctx, char* headerf, char* headerv)
1177 { 1177 {
1178 mlfiPriv &priv = *MLFIPRIV; 1178 mlfiPriv &priv = *MLFIPRIV;
1179 // detect precedence:bulk for avoiding autowhitelisting 1179 // detect precedence:bulk for avoiding autowhitelisting
1180 if ((strcasecmp(headerf, "precedence") == 0) && 1180 if (((strcasecmp(headerf, "precedence") == 0) && (strcasecmp(headerv, "bulk") == 0)) ||
1181 (strcasecmp(headerv, "bulk") == 0)) priv.is_bulk_precedence = true; 1181 ((strcasecmp(headerf, "content-type") == 0) && (strncasecmp(headerv, "multipart/report", 16) == 0))) {
1182 priv.allow_autowhitelisting = false;
1183 }
1184
1182 // other headers are only needed for content filtering 1185 // other headers are only needed for content filtering
1183 if (priv.authenticated) return SMFIS_CONTINUE; 1186 if (priv.authenticated) return SMFIS_CONTINUE;
1184 if (priv.only_whites) return SMFIS_CONTINUE; 1187 if (priv.only_whites) return SMFIS_CONTINUE;
1185 if (priv.want_spamassassin) priv.assassin->mlfi_header(headerf, headerv); 1188 if (priv.want_spamassassin) priv.assassin->mlfi_header(headerf, headerv);
1186 if (priv.want_dccgrey || priv.want_dccbulk) priv.dccifd->mlfi_header(ctx, headerf, headerv); 1189 if (priv.want_dccgrey || priv.want_dccbulk) priv.dccifd->mlfi_header(ctx, headerf, headerv);
1191 { 1194 {
1192 mlfiPriv &priv = *MLFIPRIV; 1195 mlfiPriv &priv = *MLFIPRIV;
1193 // delayed autowhitelisting 1196 // delayed autowhitelisting
1194 while (!priv.delayer.empty()) { 1197 while (!priv.delayer.empty()) {
1195 DELAYWHITEP dwp = priv.delayer.front(); 1198 DELAYWHITEP dwp = priv.delayer.front();
1196 if (!priv.is_bulk_precedence) { 1199 if (priv.allow_autowhitelisting) {
1197 const char *loto = dwp->get_loto(); 1200 const char *loto = dwp->get_loto();
1198 WHITELISTERP w = dwp->get_w(); 1201 WHITELISTERP w = dwp->get_w();
1199 CONTEXTP con2 = dwp->get_con(); 1202 CONTEXTP con2 = dwp->get_con();
1200 if (debug_syslog > 1) { 1203 if (debug_syslog > 1) {
1201 char buf[maxlen]; 1204 char buf[maxlen];