X-Git-Url: https://git.distorted.org.uk/~mdw/qmail/blobdiff_plain/2117e02ec495fdfd6e96b39778b701a5bcff8aa5..10649f16bd53e42811fef2ffa9daf6914104c42b:/qmail-smtpd.c diff --git a/qmail-smtpd.c b/qmail-smtpd.c index 50cfc0a..f19dd62 100644 --- a/qmail-smtpd.c +++ b/qmail-smtpd.c @@ -56,6 +56,9 @@ stralloc rcpthosts = {0}; struct constmap maprcpthosts; int bmfok = 0; stralloc bmf = {0}; +int relayhostsok = 0; +stralloc relayhosts = {0}; +struct constmap maprelayhosts; struct constmap mapbmf; int flagbarf; /* defined if seenmail */ @@ -89,6 +92,18 @@ void getenvs() if (!remotehost) remotehost = "unknown"; remoteinfo = env_get("TCPREMOTEINFO"); relayclient = env_get("RELAYCLIENT"); + if (!relayclient && relayhostsok) { + int j; + int l = str_len(remotehost); + relayclient = constmap(&maprelayhosts, remotehost, l); + if (!relayclient) for (j = 0; j < l; ++j) { + if (remotehost[j] == '.' && + (relayclient = constmap(&maprelayhosts, + remotehost + j, + l - j)) != 0) + break; + } + } dohelo(remotehost); } @@ -416,6 +431,14 @@ void getcontrols() bmfok = 1; if (!constmap_init(&mapbmf,bmf.s,bmf.len,0)) die(); } + switch (control_readfile(&relayhosts, "control/relayhosts", 0)) { + case -1: + die(); + case 1: + relayhostsok = 1; + if (!constmap_init(&maprelayhosts, relayhosts.s, relayhosts.len, 1)) + die(); + } } void main()