diff src/dnsbl.cpp @ 153:8d7c439bb6fa

add auto whitelisting
author carl
date Sat, 07 Jul 2007 16:10:39 -0700
parents c7fc218686f5
children 89ce226e5383
line wrap: on
line diff
--- a/src/dnsbl.cpp	Sat Jul 07 10:26:31 2007 -0700
+++ b/src/dnsbl.cpp	Sat Jul 07 16:10:39 2007 -0700
@@ -1021,6 +1021,14 @@
 			return SMFIS_REJECT;
 		}
 	}
+	// we will accept the recipient, but add an auto-whitelist entry
+	// if needed to ensure we can accept replies
+	WHITELISTERP w = con2.find_autowhite(priv.mailaddr);
+	if (w) {
+		char *loto = to_lower_string(rcptaddr);
+		w->sent(loto);
+		free(loto);
+	}
 	// accept the recipient
 	if (!con.get_content_filtering()) st = white;
 	if (st == oksofar) {
@@ -1449,6 +1457,8 @@
 	pthread_mutex_init(&syslog_mutex, 0);
 	pthread_mutex_init(&resolve_mutex, 0);
 	pthread_mutex_init(&fd_pool_mutex, 0);
+	pthread_mutex_init(&verifier_mutex, 0);
+	pthread_mutex_init(&whitelister_mutex, 0);
 
 	// drop root privs
 	struct passwd *pw = getpwnam("dnsbl");
@@ -1549,6 +1559,11 @@
 	if (pthread_detach(tid))
 		my_syslog("failed to detach verify closer thread");
 
+	if (pthread_create(&tid, 0, whitelister_writer, 0))
+		my_syslog("failed to create autowhite writer thread");
+	if (pthread_detach(tid))
+		my_syslog("failed to detach autowhite writer thread");
+
 	time_t starting = time(NULL);
 	int rc = smfi_main();
 	if ((rc != MI_SUCCESS) && (time(NULL) > starting+5*60)) {