diff src/dnsbl.cpp @ 179:8b86a894514d

embedded dcc filtering
author carl
date Sat, 06 Oct 2007 10:56:35 -0700
parents d6531c702be3
children cb5c0d7ec451
line wrap: on
line diff
--- a/src/dnsbl.cpp	Thu Oct 04 22:45:21 2007 -0700
+++ b/src/dnsbl.cpp	Sat Oct 06 10:56:35 2007 -0700
@@ -782,6 +782,7 @@
 		if ((src[0] == 172) && (16 <= src[1]) && (src[1] <= 31)) return false;
 		char adr[sizeof "255.255.255.255   "];
 		snprintf(adr, sizeof(adr), "%u.%u.%u.%u", src[3], src[2], src[1], src[0]);
+		// cannot use inet_ntop here since we want the octets reversed.
 		return (uriblookup(priv, hosts, adr, NULL, found));
 	}
 
@@ -988,7 +989,7 @@
 		priv.assassin  = new SpamAssassin(&priv, priv.ip, priv.helo, priv.mailaddr, priv.queueid);
 	}
 	if (dccifd_port) {
-		priv.dccifd = new DccInterface(dccifd_port, &priv, priv.ip, priv.helo, priv.mailaddr, priv.queueid);
+		priv.dccifd = new DccInterface(dccifd_port, &priv, priv.ip, priv.helo, priv.mailaddr);
 	}
 	return SMFIS_CONTINUE;
 }
@@ -1006,13 +1007,13 @@
 		smfi_setreply(ctx, "550", "5.7.1", "bogus recipient");
 		return SMFIS_REJECT;
 	}
-
-	if (priv.assassin) priv.assassin->mlfi_envrcpt(ctx, loto);
-	if (priv.dccifd)   priv.dccifd->mlfi_envrcpt(loto);
 	// priv.mailaddr sending original message to loto
 	CONTEXT 	&con = *(dc.find_context(loto)->find_context(priv.mailaddr));
 	VERIFYP 	 ver = con.find_verify(loto);
 	char  *fromvalue = con.find_from(priv.mailaddr, true);
+	// tell spam assassin and dccifd about this recipient
+	if (priv.assassin) priv.assassin->mlfi_envrcpt(ctx, loto);
+	if (priv.dccifd)   priv.dccifd->mlfi_envrcpt(loto, con.get_grey());
 	// loto sending a reply back to priv.mailaddr
 	CONTEXT    &con2 = *(dc.find_context(priv.mailaddr)->find_context(loto));
 	char *replyvalue = con2.find_from(loto);
@@ -1104,6 +1105,11 @@
 	else {
 		free(loto);
 	}
+
+	// accept the recipient
+	if (!con.get_content_filtering()) st = white;
+
+	if (st == oksofar) {
 	// remember first content filtering context
 	if (con.get_content_filtering()) {
 		if (!priv.content_context) priv.content_context = &con;
@@ -1112,10 +1118,7 @@
 			return SMFIS_TEMPFAIL;
 		}
 	}
-	// accept the recipient
-	if (!con.get_content_filtering()) st = white;
-	if (st == oksofar) {
-		// but remember the non-whites
+		// remember the non-whites
 		priv.need_content_filter(rcptaddr, con);
 		priv.only_whites = false;
 		priv.want_spamassassin |= (priv.assassin) &&					// have spam assassin available and