--- ../qmail-1.03.orig/rcpthosts.c 2003-12-04 00:17:30.000000000 +0100 +++ rcpthosts.c 2003-12-07 14:17:08.000000000 +0100 @@ -6,11 +6,16 @@ #include "constmap.h" #include "stralloc.h" #include "rcpthosts.h" +#include "dns.h" +#include "ipalloc.h" +#include "ipme.h" static int flagrh = 0; static stralloc rh = {0}; static struct constmap maprh; static int fdmrh; +static int flagrmxl = 0; +static stralloc rmxl = {0}; int rcpthosts_init() { @@ -19,6 +24,8 @@ if (!constmap_init(&maprh,rh.s,rh.len,0)) return flagrh = -1; fdmrh = open_read("control/morercpthosts.cdb"); if (fdmrh == -1) if (errno != error_noent) return flagrh = -1; + flagrmxl = control_readfile(&rmxl, "control/relaymxlookup", 0); + if (flagrmxl == -1) if (errno != error_noent) return flagrh = -1; return 0; } @@ -29,6 +36,8 @@ int len; { int j; + static ipalloc ip = {0}; + unsigned long random; if (flagrh != 1) return 1; @@ -56,5 +65,26 @@ } } + if (flagrmxl == 1) { + random = now() + (getpid() << 16); + switch (dns_mxip(&ip,&host,random)) { + case DNS_MEM: + case DNS_SOFT: + case DNS_HARD: + return 0; + case 1: + if (ip.len <= 0) return 0; + default: + break; + } + + if(ip.len >= 1) { + int i; + for (i = 0;i < ip.len;++i) + if (ipme_is(&ip.ix[i].ip)) + return 1; + } + } + return 0; }