From d0a6e81fc0d05e7eeba50259ef55e3b6d6d32a5e Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 17 Sep 2018 12:16:27 +0000 Subject: [PATCH] simplify code path for backup relay and remove useless flag ok gilles@ --- usr.sbin/smtpd/mta.c | 18 +++++++++--------- usr.sbin/smtpd/mta_session.c | 5 +---- usr.sbin/smtpd/smtpd.h | 3 +-- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c index c09fe4d71b4..638ccb958d5 100644 --- a/usr.sbin/smtpd/mta.c +++ b/usr.sbin/smtpd/mta.c @@ -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 @@ -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; diff --git a/usr.sbin/smtpd/mta_session.c b/usr.sbin/smtpd/mta_session.c index 8b1db21f1a9..6cde788b55d 100644 --- a/usr.sbin/smtpd/mta_session.c +++ b/usr.sbin/smtpd/mta_session.c @@ -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 @@ -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); diff --git a/usr.sbin/smtpd/smtpd.h b/usr.sbin/smtpd/smtpd.h index 108632f8dac..4e03177a45b 100644 --- a/usr.sbin/smtpd/smtpd.h +++ b/usr.sbin/smtpd/smtpd.h @@ -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 @@ -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 -- 2.20.1