From: Simon Schubert <2@0x2c.org> Date: Thu, 13 Feb 2014 16:44:43 +0000 (+0100) Subject: deliver_remote: only require host when not using smarthost X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Fdma.git;a=commitdiff_plain;h=89702b7f148445240a308a5be65f79891e865a4b deliver_remote: only require host when not using smarthost --- diff --git a/net.c b/net.c index fa4a3a4..d95a788 100644 --- a/net.c +++ b/net.c @@ -256,7 +256,7 @@ smtp_login(int fd, char *login, char* password) return (0); } else if (res == -2) { /* - * If the return code is -2, then then the login attempt failed, + * If the return code is -2, then then the login attempt failed, * do not try other login mechanisms */ return (1); @@ -493,17 +493,6 @@ deliver_remote(struct qitem *it) int port; int error = 1, smarthost = 0; - host = strrchr(it->addr, '@'); - /* Should not happen */ - if (host == NULL) { - snprintf(errmsg, sizeof(errmsg), "Internal error: badly formed address %s", - it->addr); - return(-1); - } else { - /* Step over the @ */ - host++; - } - port = SMTP_PORT; /* Smarthost support? */ @@ -512,6 +501,17 @@ deliver_remote(struct qitem *it) port = config.port; syslog(LOG_INFO, "using smarthost (%s:%i)", host, port); smarthost = 1; + } else { + host = strrchr(it->addr, '@'); + /* Should not happen */ + if (host == NULL) { + snprintf(errmsg, sizeof(errmsg), "Internal error: badly formed address %s", + it->addr); + return(-1); + } else { + /* Step over the @ */ + host++; + } } error = dns_get_mx_list(host, port, &hosts, smarthost);