- /*
- * RFC 1123 requires that the domain name part of the
- * RCPT TO address be "canonicalized", that is a FQDN
- * 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)
- */
- 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");
+ /*
+ * RFC 1123 requires that the domain name part of the
+ * RCPT TO address be "canonicalized", that is a FQDN
+ * 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.
+ */
+ xfree(ctl->destaddr);
+ if (ctl->smtpaddress)
+ ctl->destaddr = xstrdup(ctl->smtpaddress);
+ /* parsed_host is smtphost without the /port */
+ else if (parsed_host && parsed_host[0] != 0)
+ ctl->destaddr = xstrdup(parsed_host);
+ /* No smtphost is specified or it is a UNIX socket, then use
+ localhost as a domain part. */
+ else
+ ctl->destaddr = xstrdup("localhost");
+ xfree(parsed_host);
+ }
+ /* end if (ctl->smtp_socket == -1) */