From e631821f9a2843185e64c07c2b3e9f8919c0edf8 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 23 Sep 2001 09:25:31 +0000 Subject: LMTP problem has been solved. svn path=/trunk/; revision=3470 --- sink.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'sink.c') diff --git a/sink.c b/sink.c index 4fec6cb5..aab220e6 100644 --- a/sink.c +++ b/sink.c @@ -49,6 +49,8 @@ static int lmtp_responses; int smtp_open(struct query *ctl) /* try to open a socket to the appropriate SMTP server for this query */ { + char *parsed_host = NULL; + /* maybe it's time to close the socket in order to force delivery */ if (NUM_NONZERO(ctl->batchlimit) && (ctl->smtp_socket != -1) && ++batchcount == ctl->batchlimit) { @@ -95,7 +97,7 @@ int smtp_open(struct query *ctl) set_timeout(ctl->server.timeout); for (idp = ctl->smtphunt; idp; idp = idp->next) { - char *cp, *parsed_host; + char *cp; #ifdef INET6_ENABLE char *portnum = SMTP_PORT; #else @@ -169,8 +171,19 @@ int smtp_open(struct query *ctl) * or MX but not a CNAME. Some listeners (like exim) * enforce this. Now that we have the actual hostname, * compute what we should canonicalize with. + * + * make sure we do not forget to drop the /port if + * using LMTP (hmh) */ - ctl->destaddr = ctl->smtpaddress ? ctl->smtpaddress : ( ctl->smtphost && ctl->smtphost[0] != '/' ? ctl->smtphost : "localhost"); + if (ctl->listener == LMTP_MODE && !ctl->smtpaddress) + { + if (parsed_host && parsed_host[0] != 0) + ctl->destaddr = xstrdup(parsed_host); + else + ctl->destaddr = (ctl->smtphost && ctl->smtphost[0] != '/') ? ctl->smtphost : "localhost"; + } + else + ctl->destaddr = ctl->smtpaddress ? ctl->smtpaddress : ( ctl->smtphost && ctl->smtphost[0] != '/' ? ctl->smtphost : "localhost"); if (outlevel >= O_DEBUG && ctl->smtp_socket != -1) report(stdout, _("forwarding to %s\n"), ctl->smtphost); @@ -695,8 +708,6 @@ int open_sink(struct query *ctl, struct msgblk *msg, (*good_addresses)++; else { - char errbuf[POPBUFSIZE]; - handle_smtp_report(ctl, msg); (*bad_addresses)++; -- cgit v1.2.3