simplify code path for backup relay and remove useless flag
authoreric <eric@openbsd.org>
Mon, 17 Sep 2018 12:16:27 +0000 (12:16 +0000)
committereric <eric@openbsd.org>
Mon, 17 Sep 2018 12:16:27 +0000 (12:16 +0000)
ok gilles@

usr.sbin/smtpd/mta.c
usr.sbin/smtpd/mta_session.c
usr.sbin/smtpd/smtpd.h

index c09fe4d..638ccb9 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: mta.c,v 1.223 2018/09/08 10:05:07 eric Exp $  */
+/*     $OpenBSD: mta.c,v 1.224 2018/09/17 12:16:27 eric Exp $  */
 
 /*
  * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -1720,17 +1720,17 @@ mta_relay(struct envelope *e, struct relayhost *relayh)
        key.helotable = dispatcher->u.remote.helo_source;
        key.heloname = dispatcher->u.remote.helo;
 
-       if (dispatcher->u.remote.backup) {
-               key.backupname = dispatcher->u.remote.backupmx;
-               if (key.backupname == NULL)
-                       key.backupname = e->smtpname;
-               key.domain = mta_domain(e->dest.domain, 0);
-               key.flags |= RELAY_BACKUP;
-       } else if (relayh->hostname[0]) {
+       if (relayh->hostname[0]) {
                key.domain = mta_domain(relayh->hostname, 1);
                key.flags |= RELAY_MX;
-       } else {
+       }
+       else {
                key.domain = mta_domain(e->dest.domain, 0);
+               if (dispatcher->u.remote.backup) {
+                       key.backupname = dispatcher->u.remote.backupmx;
+                       if (key.backupname == NULL)
+                               key.backupname = e->smtpname;
+               }
        }
 
        key.tls = relayh->tls;
index 8b1db21..6cde788 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: mta_session.c,v 1.110 2018/09/08 10:05:07 eric Exp $  */
+/*     $OpenBSD: mta_session.c,v 1.111 2018/09/17 12:16:27 eric Exp $  */
 
 /*
  * Copyright (c) 2008 Pierre-Yves Ritschard <pyr@openbsd.org>
@@ -218,9 +218,6 @@ mta_session(struct mta_relay *relay, struct mta_route *route)
                        fatalx("bad value for relay->tls: %d", relay->tls);
        }
 
-       if (relay->flags & RELAY_BACKUP)
-               s->flags &= ~MTA_FORCE_PLAIN;
-
        log_debug("debug: mta: %p: spawned for relay %s", s,
            mta_relay_to_text(relay));
        stat_increment("mta.session", 1);
index 108632f..4e03177 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: smtpd.h,v 1.559 2018/09/08 10:05:07 eric Exp $        */
+/*     $OpenBSD: smtpd.h,v 1.560 2018/09/17 12:16:27 eric Exp $        */
 
 /*
  * Copyright (c) 2008 Gilles Chehade <gilles@poolp.org>
@@ -90,7 +90,6 @@
 #define RELAY_TLS_NO           3
 
 #define RELAY_AUTH             0x08
-#define RELAY_BACKUP           0x10
 #define RELAY_MX               0x20
 #define RELAY_LMTP             0x80
 #define        RELAY_TLS_VERIFY        0x200