]> git.ipfire.org Git - people/ms/dma.git/commitdiff
deliver_remote: only require host when not using smarthost
authorSimon Schubert <2@0x2c.org>
Thu, 13 Feb 2014 16:44:43 +0000 (17:44 +0100)
committerSimon Schubert <2@0x2c.org>
Thu, 13 Feb 2014 16:56:05 +0000 (17:56 +0100)
net.c

diff --git a/net.c b/net.c
index fa4a3a4f85a0fe19e0256dea20fdf6f340b1e61c..d95a7884b87e336f72077b64b8b1336d8c170ddc 100644 (file)
--- 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);