comparison src/dnsbl.cpp @ 291:9f0d9fcb58dd stable-6-0-42

Never add auto-whitelist entries for outgoing mail from localhost
author Carl Byington <carl@five-ten-sg.com>
date Sat, 28 Jun 2014 17:01:56 -0700
parents bb69fdc3acaa
children fbbc341001cc
comparison
equal deleted inserted replaced
290:bb69fdc3acaa 291:9f0d9fcb58dd
1360 } 1360 }
1361 // we will accept the recipient, but add an auto-whitelist entry 1361 // we will accept the recipient, but add an auto-whitelist entry
1362 // if needed to ensure we can accept replies 1362 // if needed to ensure we can accept replies
1363 loto = to_lower_string(rcptaddr); 1363 loto = to_lower_string(rcptaddr);
1364 WHITELISTERP w = con2.find_autowhite(loto, priv.mailaddr); 1364 WHITELISTERP w = con2.find_autowhite(loto, priv.mailaddr);
1365
1365 // check if local part is too big 1366 // check if local part is too big
1366 const int max_local_size = 30; 1367 const int max_local_size = 30;
1367 const char *p = strchr(loto, '@'); 1368 const char *p = strchr(loto, '@');
1368 int len = (p) ? p-loto : max_local_size; 1369 int len = (p) ? p-loto : max_local_size;
1369 if (len >= max_local_size) w = NULL; // too big, pretend we don't have a whitelister 1370 if (len >= max_local_size) w = NULL; // too big, pretend we don't have a whitelister
1371
1372 // ignore auto whitelisting from outgoing mail from localhost
1373 const u_char *src = (const u_char *)&priv.ip;
1374 if (src[0] == 127) w = NULL; // outgoing mail from localhost, pretend we don't have a whitelister
1375
1370 // record it if we have a whitelister 1376 // record it if we have a whitelister
1371 if (w) { 1377 if (w) {
1372 DELAYWHITEP dwp = new DELAYWHITE(loto, w, &con2); // dwp takes ownership of the string 1378 DELAYWHITEP dwp = new DELAYWHITE(loto, w, &con2); // dwp takes ownership of the string
1373 priv.delayer.push_back(dwp); 1379 priv.delayer.push_back(dwp);
1374 } 1380 }
2068 loader_run = false; // eventually the config loader thread will terminate 2074 loader_run = false; // eventually the config loader thread will terminate
2069 execvp(argv[0], argv); 2075 execvp(argv[0], argv);
2070 } 2076 }
2071 exit((rc == MI_SUCCESS) ? 0 : EX_UNAVAILABLE); 2077 exit((rc == MI_SUCCESS) ? 0 : EX_UNAVAILABLE);
2072 } 2078 }
2073