From 5449391530863d4cb727c37167b369ede66fd832 Mon Sep 17 00:00:00 2001 From: Gilles Chehade Date: Wed, 28 Jan 2009 22:27:57 +0000 Subject: since we're expanding "relay via ssl foobar.org" into two mxhosts (one with F_SSMTP on port 465 and one with F_STARTTLS on port 25) both mxhosts should only retain the flag that they will use ("via ssl" means the mxhost before expansion has both flags set). this will make mta_connect() simpler when we bring ssl support in the way. --- usr.sbin/smtpd/mta.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'usr.sbin/smtpd') diff --git a/usr.sbin/smtpd/mta.c b/usr.sbin/smtpd/mta.c index 30112447c74..f35bab8ebc9 100644 --- a/usr.sbin/smtpd/mta.c +++ b/usr.sbin/smtpd/mta.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mta.c,v 1.16 2009/01/28 21:44:15 gilles Exp $ */ +/* $OpenBSD: mta.c,v 1.17 2009/01/28 22:27:56 gilles Exp $ */ /* * Copyright (c) 2008 Pierre-Yves Ritschard @@ -943,7 +943,9 @@ mta_expand_mxarray(struct session *sessionp) } switch (mxhost.flags & F_SSL) { - case F_SSL: + case F_SSL: { + u_int8_t flags = mxhost.flags; + if (mxhost.ss.ss_family == AF_INET) { ssin->sin_port = htons(465); mxhost.ss = *(struct sockaddr_storage *)ssin; @@ -952,6 +954,7 @@ mta_expand_mxarray(struct session *sessionp) ssin6->sin6_port = htons(465); mxhost.ss = *(struct sockaddr_storage *)ssin6; } + mxhost.flags = flags & ~F_STARTTLS; sessionp->mxarray[j++] = mxhost; if (mxhost.ss.ss_family == AF_INET) { @@ -962,8 +965,10 @@ mta_expand_mxarray(struct session *sessionp) ssin6->sin6_port = htons(25); mxhost.ss = *(struct sockaddr_storage *)ssin6; } + mxhost.flags = flags & ~F_SSMTP; sessionp->mxarray[j++] = mxhost; break; + } case F_SSMTP: if (mxhost.ss.ss_family == AF_INET) { ssin->sin_port = htons(465); -- cgit v1.2.3