From 4b9d2e573ad902e3784721e332682c640487bbfa Mon Sep 17 00:00:00 2001 From: eric Date: Wed, 22 Aug 2018 10:11:43 +0000 Subject: [PATCH] Fix a crash when relaying with authentication but auth table is not set. found by and ok stsp@ --- usr.sbin/smtpd/mta.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c index 5b398381123..c219b079c04 100644 --- a/usr.sbin/smtpd/mta.c +++ b/usr.sbin/smtpd/mta.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta.c,v 1.221 2018/07/25 16:00:48 eric Exp $ */ +/* $OpenBSD: mta.c,v 1.222 2018/08/22 10:11:43 eric Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -645,6 +645,17 @@ mta_handle_envelope(struct envelope *evp, const char *smarthost) return; } + if (relayh.flags & RELAY_AUTH && dispatcher->u.remote.auth == NULL) { + log_warnx("warn: No auth table on action \"%s\" for relay %s", + evp->dispatcher, smarthost); + m_create(p_queue, IMSG_MTA_DELIVERY_TEMPFAIL, 0, 0, -1); + m_add_evpid(p_queue, evp->id); + m_add_string(p_queue, "No auth table for relaying"); + m_add_int(p_queue, ESC_OTHER_STATUS); + m_close(p_queue); + return; + } + relay = mta_relay(evp, &relayh); /* ignore if we don't know the limits yet */ if (relay->limits && -- 2.20.1