Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jan 2018 22:12:14 +0000 (UTC)
From:      Mark Felder <feld@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-branches@freebsd.org
Subject:   svn commit: r457931 - in branches/2018Q1/mail/sendmail: . files
Message-ID:  <201801022212.w02MCEks092120@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: feld
Date: Tue Jan  2 22:12:14 2018
New Revision: 457931
URL: https://svnweb.freebsd.org/changeset/ports/457931

Log:
  MFH: r457930
  
  - fix regression introduced by r457706
  PR: 224452
  
  - add option BLACKLISTD
  https://reviews.freebsd.org/D13475

Added:
  branches/2018Q1/mail/sendmail/files/patch-blacklist.c
     - copied unchanged from r457930, head/mail/sendmail/files/patch-blacklist.c
  branches/2018Q1/mail/sendmail/files/patch-blacklist_client.h
     - copied unchanged from r457930, head/mail/sendmail/files/patch-blacklist_client.h
  branches/2018Q1/mail/sendmail/files/patch-readcf.c
     - copied unchanged from r457930, head/mail/sendmail/files/patch-readcf.c
  branches/2018Q1/mail/sendmail/files/patch-sendmail.8
     - copied unchanged from r457930, head/mail/sendmail/files/patch-sendmail.8
  branches/2018Q1/mail/sendmail/files/smtputf8.patch
     - copied unchanged from r457930, head/mail/sendmail/files/smtputf8.patch
Deleted:
  branches/2018Q1/mail/sendmail/files/extrapatch-smtputf8
  branches/2018Q1/mail/sendmail/files/patch-main.c
Modified:
  branches/2018Q1/mail/sendmail/Makefile
  branches/2018Q1/mail/sendmail/files/patch-Makefile.m4
  branches/2018Q1/mail/sendmail/files/patch-daemon.c
  branches/2018Q1/mail/sendmail/files/patch-sendmail.h
  branches/2018Q1/mail/sendmail/files/patch-srvrsmtp.c
  branches/2018Q1/mail/sendmail/files/patch-usersmtp.c
  branches/2018Q1/mail/sendmail/files/site.config.m4.smtputf8
Directory Properties:
  branches/2018Q1/   (props changed)

Modified: branches/2018Q1/mail/sendmail/Makefile
==============================================================================
--- branches/2018Q1/mail/sendmail/Makefile	Tue Jan  2 21:48:33 2018	(r457930)
+++ branches/2018Q1/mail/sendmail/Makefile	Tue Jan  2 22:12:14 2018	(r457931)
@@ -2,7 +2,7 @@
 
 PORTNAME=	sendmail
 PORTVERSION=	8.15.2
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	mail ipv6
 MASTER_SITES=	ftp://ftp.sendmail.org/pub/sendmail/
 PKGNAMESUFFIX?=	${TLS_SUFFIX}${SASL_SUFFIX}${LDAP_SUFFIX}${BDB_SUFFIX}${PKGNAMESUFFIX2}
@@ -48,8 +48,9 @@ MILTER_SOVER?=	6
 OPTIONS_DEFINE?=	SHMEM SEM LA NIS IPV6 TLS SASL SASLAUTHD LDAP BDB \
 			GDBM SOCKETMAP CYRUSLOOKUP BLACKLISTD SMTPUTF8 \
 			PICKY_HELO_CHECK MILTER DOCS
-OPTIONS_DEFAULT?=	SHMEM SEM LA NIS TLS SASL SASLAUTHD BDB1 SMTPUTF8 \
-			PICKY_HELO_CHECK MILTER
+OPTIONS_DEFAULT?=	SHMEM SEM LA NIS TLS SASL SASLAUTHD BDB1 \
+			BLACKLISTD SMTPUTF8 PICKY_HELO_CHECK MILTER
+OPTIONS_EXCLUDE_FreeBSD_10=	BLACKLISTD
 NO_OPTIONS_SORT=yes
 SHMEM_DESC=		System V shared memory support
 LA_DESC=		load averages support
@@ -100,14 +101,13 @@ IGNORE=		option CYRUSLOOKUP requires option SOCKETMAP
 EXTRA_PATCHES+=	${FILESDIR}/cyruslookup.patch
 .endif
 .endif
+.if ${PORT_OPTIONS:MSMTPUTF8}
+EXTRA_PATCHES+=	${FILESDIR}/smtputf8.patch
+.endif
 .if ${PORT_OPTIONS:MTLS}
 TLS_SUFFIX?=	+tls
 CONFLICTS+=	sendmail-ldap-8.* sendmail-sasl2-8.*
 .endif
-.if ${PORT_OPTIONS:MSMTPUTF8}
-EXTRA_PATCHES+=	${FILESDIR}/extrapatch-smtputf8
-SITE+=	${FILESDIR}/site.config.m4.smtputf8
-.endif
 
 MAKE_PKGNAMES=	for i in "" +tls; do \
 	for j in "" +sasl2; do \
@@ -133,6 +133,9 @@ SITE+=	${FILESDIR}/site.config.m4.ldap
 .endif
 .if ${PORT_OPTIONS:MBLACKLISTD}
 SITE+=	${FILESDIR}/site.config.m4.blacklistd
+.endif
+.if ${PORT_OPTIONS:MSMTPUTF8}
+SITE+=	${FILESDIR}/site.config.m4.smtputf8
 .endif
 .if ${PORT_OPTIONS:MMILTER}
 SITE+=	${FILESDIR}/site.config.m4.milter

Modified: branches/2018Q1/mail/sendmail/files/patch-Makefile.m4
==============================================================================
--- branches/2018Q1/mail/sendmail/files/patch-Makefile.m4	Tue Jan  2 21:48:33 2018	(r457930)
+++ branches/2018Q1/mail/sendmail/files/patch-Makefile.m4	Tue Jan  2 22:12:14 2018	(r457931)
@@ -1,6 +1,13 @@
---- sendmail/Makefile.m4.orig	2014-11-11 15:49:49 UTC
+--- sendmail/Makefile.m4.orig	2015-06-19 12:59:29 UTC
 +++ sendmail/Makefile.m4
-@@ -13,8 +13,7 @@ bldPUSH_SMLIB(`smutil')
+@@ -7,14 +7,14 @@ bldPRODUCT_START(`executable', `sendmail
+ define(`bldBIN_TYPE', `G')
+ define(`bldINSTALL_DIR', `')
+ define(`bldSOURCES', `main.c alias.c arpadate.c bf.c collect.c conf.c control.c convtime.c daemon.c deliver.c domain.c envelope.c err.c headers.c macro.c map.c mci.c milter.c mime.c parseaddr.c queue.c ratectrl.c readcf.c recipient.c sasl.c savemail.c sfsasl.c shmticklib.c sm_resolve.c srvrsmtp.c stab.c stats.c sysexits.c timers.c tls.c trace.c udb.c usersmtp.c util.c version.c ')
++APPENDDEF(`bldSOURCES',`blacklist.c ')
+ PREPENDDEF(`confENVDEF', `confMAPDEF')
+ bldPUSH_SMLIB(`sm')
+ bldPUSH_SMLIB(`smutil')
  
  
  dnl hack: /etc/mail is not defined as "location of .cf" in the build system

Copied: branches/2018Q1/mail/sendmail/files/patch-blacklist.c (from r457930, head/mail/sendmail/files/patch-blacklist.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q1/mail/sendmail/files/patch-blacklist.c	Tue Jan  2 22:12:14 2018	(r457931, copy of r457930, head/mail/sendmail/files/patch-blacklist.c)
@@ -0,0 +1,60 @@
+--- sendmail/blacklist.c.orig	2018-01-02 20:16:44 UTC
++++ sendmail/blacklist.c
+@@ -0,0 +1,57 @@
++/*-
++ * Copyright (c) 2016 The FreeBSD Foundation
++ * All rights reserved.
++ *
++ * This software was developed by Kurt Lidl under sponsorship from the
++ * FreeBSD Foundation.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ *    notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ *    notice, this list of conditions and the following disclaimer in the
++ *    documentation and/or other materials provided with the distribution.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE. */
++
++/* $FreeBSD$ */
++
++#ifdef USE_BLACKLIST
++#include <sm/gen.h>
++#include <sendmail.h>	/* for EXTERN UseBlacklist */
++
++#include <blacklist.h>
++#include "blacklist_client.h"
++
++static struct blacklist *blstate;
++
++void
++blacklist_init(void)
++{
++
++	if (UseBlacklist)
++		blstate = blacklist_open();
++}
++
++void
++blacklist_notify(int action, int fd, const char *msg)
++{
++
++	if (blstate == NULL)
++		return;
++	(void)blacklist_r(blstate, action, fd, msg);
++}
++
++#endif /* USE_BLACKLIST */

Copied: branches/2018Q1/mail/sendmail/files/patch-blacklist_client.h (from r457930, head/mail/sendmail/files/patch-blacklist_client.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q1/mail/sendmail/files/patch-blacklist_client.h	Tue Jan  2 22:12:14 2018	(r457931, copy of r457930, head/mail/sendmail/files/patch-blacklist_client.h)
@@ -0,0 +1,60 @@
+--- sendmail/blacklist_client.h.orig	2018-01-02 20:16:44 UTC
++++ sendmail/blacklist_client.h
+@@ -0,0 +1,57 @@
++/*-
++ * Copyright (c) 2016 The FreeBSD Foundation
++ * All rights reserved.
++ *
++ * This software was developed by Kurt Lidl under sponsorship from the
++ * FreeBSD Foundation.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ *    notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ *    notice, this list of conditions and the following disclaimer in the
++ *    documentation and/or other materials provided with the distribution.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE. */
++
++/* $FreeBSD$ */
++
++#ifndef BLACKLIST_CLIENT_H
++#define BLACKLIST_CLIENT_H
++
++#ifndef BLACKLIST_API_ENUM
++enum {
++	BLACKLIST_AUTH_OK = 0,
++	BLACKLIST_AUTH_FAIL,
++	BLACKLIST_ABUSIVE_BEHAVIOR,
++	BLACKLIST_BAD_USER
++};
++#endif
++
++#ifdef USE_BLACKLIST
++void blacklist_init(void);
++void blacklist_notify(int, int, const char *);
++
++#define BLACKLIST_INIT() blacklist_init()
++#define BLACKLIST_NOTIFY(x, y, msg) blacklist_notify(x, y, msg)
++
++#else
++
++#define BLACKLIST_INIT()
++#define BLACKLIST_NOTIFY(x, y, msg)
++
++#endif
++
++#endif /* BLACKLIST_CLIENT_H */

Modified: branches/2018Q1/mail/sendmail/files/patch-daemon.c
==============================================================================
--- branches/2018Q1/mail/sendmail/files/patch-daemon.c	Tue Jan  2 21:48:33 2018	(r457930)
+++ branches/2018Q1/mail/sendmail/files/patch-daemon.c	Tue Jan  2 22:12:14 2018	(r457931)
@@ -1,12 +1,10 @@
---- sendmail/daemon.c.orig	2016-06-12 18:25:14.196269000 -0400
-+++ sendmail/daemon.c	2016-06-12 18:31:47.159880000 -0400
-@@ -754,6 +754,10 @@
+--- sendmail/daemon.c.orig	2015-02-28 00:50:03 UTC
++++ sendmail/daemon.c
+@@ -754,6 +754,8 @@ getrequests(e)
  						anynet_ntoa(&RealHostAddr));
  			}
  
-+#ifdef USE_BLACKLIST
-+			blacklist_init();
-+#endif
++			BLACKLIST_INIT();
 +
  			if (pipefd[0] != -1)
  			{

Copied: branches/2018Q1/mail/sendmail/files/patch-readcf.c (from r457930, head/mail/sendmail/files/patch-readcf.c)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q1/mail/sendmail/files/patch-readcf.c	Tue Jan  2 22:12:14 2018	(r457931, copy of r457930, head/mail/sendmail/files/patch-readcf.c)
@@ -0,0 +1,26 @@
+--- sendmail/readcf.c.orig	2015-06-17 16:51:58 UTC
++++ sendmail/readcf.c
+@@ -2910,6 +2910,10 @@ static struct optioninfo
+ #endif
+ #define O_USECOMPRESSEDIPV6ADDRESSES 0xec
+ 	{ "UseCompressedIPv6Addresses",	O_USECOMPRESSEDIPV6ADDRESSES, OI_NONE },
++#if USE_BLACKLIST
++# define O_BLACKLIST		0xf2
++	{ "UseBlacklist",	O_BLACKLIST,	OI_NONE	},
++#endif
+ 
+ 	{ NULL,				'\0',		OI_NONE	}
+ };
+@@ -4540,6 +4544,12 @@ setoption(opt, val, safe, sticky, e)
+ 		UseCompressedIPv6Addresses = atobool(val);
+ 		break;
+ 
++#if USE_BLACKLIST
++	  case O_BLACKLIST:
++		UseBlacklist = atobool(val);
++		break;
++#endif
++
+ 	  default:
+ 		if (tTd(37, 1))
+ 		{

Copied: branches/2018Q1/mail/sendmail/files/patch-sendmail.8 (from r457930, head/mail/sendmail/files/patch-sendmail.8)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q1/mail/sendmail/files/patch-sendmail.8	Tue Jan  2 22:12:14 2018	(r457931, copy of r457930, head/mail/sendmail/files/patch-sendmail.8)
@@ -0,0 +1,14 @@
+--- sendmail/sendmail.8.orig	2014-06-13 14:57:59 UTC
++++ sendmail/sendmail.8
+@@ -537,6 +537,11 @@ for this amount of time, 
+ failed messages will be returned to the sender.  
+ The default is five days.
+ .TP
++UseBlacklist
++If set, send authentication failure and success notifications to the
++.BR blacklistd (8)
++daemon.
++.TP
+ .RI UserDatabaseSpec= userdatabase
+ If set, a user database is consulted to get forwarding information.
+ You can consider this an adjunct to the aliasing mechanism, 

Modified: branches/2018Q1/mail/sendmail/files/patch-sendmail.h
==============================================================================
--- branches/2018Q1/mail/sendmail/files/patch-sendmail.h	Tue Jan  2 21:48:33 2018	(r457930)
+++ branches/2018Q1/mail/sendmail/files/patch-sendmail.h	Tue Jan  2 22:12:14 2018	(r457931)
@@ -1,16 +1,24 @@
---- sendmail/sendmail.h.orig	2016-06-12 18:23:05.239106000 -0400
-+++ sendmail/sendmail.h	2016-06-12 18:42:38.972341000 -0400
-@@ -2647,6 +2647,13 @@
- extern char	*milter_unknown __P((char *, ENVELOPE *, char *));
- #endif /* MILTER */
+--- sendmail/sendmail.h.orig	2015-06-19 12:59:29 UTC
++++ sendmail/sendmail.h
+@@ -57,6 +57,10 @@ SM_UNUSED(static char SmailId[]) = "@(#)
+ #endif /* _DEFINE */
  
+ #include "bf.h"
 +#if USE_BLACKLIST
-+/* blacklistd functions */
-+void blacklist_init(void);
-+void blacklist_notify(int, int, char *);
 +#include <blacklist.h>
 +#endif
++#include "blacklist_client.h"
+ #include "timers.h"
+ #include <sm/exc.h>
+ #include <sm/heap.h>
+@@ -2544,6 +2548,10 @@ EXTERN int ConnectionRateWindowSize;
+ EXTERN bool	SSLEngineInitialized;
+ #endif /* STARTTLS && USE_OPENSSL_ENGINE */
+ 
++#if USE_BLACKLIST
++EXTERN bool	UseBlacklist;
++#endif
 +
- extern char	*addquotes __P((char *, SM_RPOOL_T *));
- extern char	*arpadate __P((char *));
- extern bool	atobool __P((char *));
+ /*
+ **  Declarations of useful functions
+ */

Modified: branches/2018Q1/mail/sendmail/files/patch-srvrsmtp.c
==============================================================================
--- branches/2018Q1/mail/sendmail/files/patch-srvrsmtp.c	Tue Jan  2 21:48:33 2018	(r457930)
+++ branches/2018Q1/mail/sendmail/files/patch-srvrsmtp.c	Tue Jan  2 22:12:14 2018	(r457931)
@@ -1,44 +1,33 @@
---- sendmail/srvrsmtp.c.orig	2015-03-18 07:47:12.000000000 -0400
-+++ sendmail/srvrsmtp.c	2016-06-12 18:36:01.372172000 -0400
-@@ -832,6 +832,9 @@
- 	int n_badrcpts_adj;
- #endif /* _FFR_BADRCPT_SHUTDOWN */
- 
-+#ifdef USE_BLACKLIST
-+	int fd;
-+#endif
- 	SevenBitInput_Saved = SevenBitInput;
- 	smtp.sm_nrcpts = 0;
- #if MILTER
-@@ -1328,6 +1331,9 @@
+--- sendmail/srvrsmtp.c.orig	2015-03-18 11:47:12 UTC
++++ sendmail/srvrsmtp.c
+@@ -1328,6 +1328,7 @@ smtp(nullserver, d_flags, e)
  					  (int) tp.tv_sec +
  						(tp.tv_usec >= 500000 ? 1 : 0)
  					 );
-+#ifdef USE_BLACKLIST
-+				blacklist_notify(1, fd, "pre-greeting traffic");
-+#endif
++				BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL, fd, "pre-greeting traffic");
  			}
  		}
  	}
-@@ -1723,6 +1729,10 @@
+@@ -1721,8 +1722,11 @@ smtp(nullserver, d_flags, e)
+ 			}
+ 			else
  			{
++				int fd;
  				/* not SASL_OK or SASL_CONT */
  				message("535 5.7.0 authentication failed");
-+#ifdef USE_BLACKLIST
 +				fd = sm_io_getinfo(InChannel, SM_IO_WHAT_FD, NULL);
-+				blacklist_notify(1, fd, "AUTH FAIL");
-+#endif
++				BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL, fd, "AUTH FAIL");
  				if (LogLevel > 9)
  					sm_syslog(LOG_WARNING, e->e_id,
  						  "AUTH failure (%s): %s (%d) %s, relay=%.100s",
-@@ -3524,6 +3534,10 @@
+@@ -3523,7 +3527,10 @@ doquit:
+ #if MAXBADCOMMANDS > 0
  			if (++n_badcmds > MAXBADCOMMANDS)
  			{
++				int fd;
    stopattack:
-+#ifdef USE_BLACKLIST
 +				fd = sm_io_getinfo(InChannel, SM_IO_WHAT_FD, NULL);
-+				blacklist_notify(1, fd, "too many bad commands");
-+#endif
++				BLACKLIST_NOTIFY(BLACKLIST_ABUSIVE_BEHAVIOR, fd, "too many bad commands");
  				message("421 4.7.0 %s Too many bad commands; closing connection",
  					MyHostName);
  

Modified: branches/2018Q1/mail/sendmail/files/patch-usersmtp.c
==============================================================================
--- branches/2018Q1/mail/sendmail/files/patch-usersmtp.c	Tue Jan  2 21:48:33 2018	(r457930)
+++ branches/2018Q1/mail/sendmail/files/patch-usersmtp.c	Tue Jan  2 22:12:14 2018	(r457931)
@@ -1,26 +1,23 @@
---- sendmail/usersmtp.c.orig	2014-12-05 10:42:28.000000000 -0500
-+++ sendmail/usersmtp.c	2016-06-12 18:35:25.940865000 -0400
-@@ -1825,6 +1825,10 @@
+--- sendmail/usersmtp.c.orig	2014-12-05 15:42:28 UTC
++++ sendmail/usersmtp.c
+@@ -1825,6 +1825,9 @@ attemptauth(m, mci, e, sai)
  
  		if (saslresult != SASL_OK && saslresult != SASL_CONTINUE)
  		{
-+#ifdef USE_BLACKLIST
 +			int fd = sm_io_getinfo(mci->mci_in, SM_IO_WHAT_FD, NULL);
-+			blacklist_notify(1, fd, "AUTH FAIL");
-+#endif
++			BLACKLIST_NOTIFY(BLACKLIST_AUTH_FAIL, fd, "AUTH FAIL");
++
  			if (tTd(95, 5))
  				sm_dprintf("AUTH FAIL=%s (%d)\n",
  					sasl_errstring(saslresult, NULL, NULL),
-@@ -1970,9 +1974,13 @@
+@@ -1970,9 +1973,11 @@ smtpauth(m, mci, e)
  	do
  	{
  		result = attemptauth(m, mci, e, &(mci->mci_sai));
 -		if (result == EX_OK)
 +		if (result == EX_OK) {
-+#ifdef USE_BLACKLIST
 +			int fd = sm_io_getinfo(mci->mci_in, SM_IO_WHAT_FD, NULL);
-+			blacklist_notify(0, fd, "AUTH OK");
-+#endif
++			BLACKLIST_NOTIFY(BLACKLIST_AUTH_OK, fd, "AUTH OK");
  			mci->mci_sasl_auth = true;
 -		else if (result == EX_TEMPFAIL || result == EX_NOPERM)
 +		} else if (result == EX_TEMPFAIL || result == EX_NOPERM)

Modified: branches/2018Q1/mail/sendmail/files/site.config.m4.smtputf8
==============================================================================
--- branches/2018Q1/mail/sendmail/files/site.config.m4.smtputf8	Tue Jan  2 21:48:33 2018	(r457930)
+++ branches/2018Q1/mail/sendmail/files/site.config.m4.smtputf8	Tue Jan  2 22:12:14 2018	(r457931)
@@ -1,2 +1,2 @@
-APPENDDEF(`confLIBS', ` -L/usr/lib/x86_64-linux-gnu -licui18n -licuuc -licudata')
-define(`conf_sendmail_ENVDEF', `-D_FFR_EAI')
+APPENDDEF(`confLIBS', `-licui18n -licuuc -licudata')
+APPENDDEF(`conf_sendmail_ENVDEF', `-D_FFR_EAI')

Copied: branches/2018Q1/mail/sendmail/files/smtputf8.patch (from r457930, head/mail/sendmail/files/smtputf8.patch)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ branches/2018Q1/mail/sendmail/files/smtputf8.patch	Tue Jan  2 22:12:14 2018	(r457931, copy of r457930, head/mail/sendmail/files/smtputf8.patch)
@@ -0,0 +1,600 @@
+diff --git a/sendmail/conf.c b/sendmail/conf.c
+index c73334e..28328e6 100644
+--- sendmail/conf.c.orig
++++ sendmail/conf.c
+@@ -314,6 +314,9 @@ setdefaults(e)
+ 	e->e_xfqgrp = NOQGRP;
+ 	e->e_xfqdir = NOQDIR;
+ 	e->e_ctime = curtime();
++#if _FFR_EAI
++	e->e_smtputf8 = false;
++#endif
+ 	SevenBitInput = false;			/* option 7 */
+ 	MaxMciCache = 1;			/* option k */
+ 	MciCacheTimeout = 5 MINUTES;		/* option K */
+@@ -5746,6 +5749,9 @@ char	*CompileOptions[] =
+ 	"DNSMAP",
+ # endif
+ #endif
++#if _FFR_EAI
++	"EAI",
++#endif
+ #if EGD
+ 	"EGD",
+ #endif
+@@ -6590,3 +6596,6 @@ char	*FFRCompileOptions[] =
+ 	NULL
+ };
+
++#if _FFR_EAI && _FFR_EIGHT_BIT_ADDR_OK
++#error "Cannot enable both of these FFRs"
++#endif
+diff --git a/sendmail/domain.c b/sendmail/domain.c
+index 4d1b92d..adaa6ac 100644
+--- sendmail/domain.c.orig
++++ sendmail/domain.c
+@@ -13,6 +13,9 @@
+
+ #include <sendmail.h>
+ #include "map.h"
++#if _FFR_EAI
++#include <unicode/uidna.h>
++#endif
+
+ #if NAMED_BIND
+ SM_RCSID("@(#)$Id: domain.c,v 8.205 2013-11-22 20:51:55 ca Exp $ (with name server)")
+@@ -236,6 +239,26 @@ getmxrr(host, mxhosts, mxprefs, droplocalhost, rcode, tryfallback, pttl)
+ 	if (host[0] == '[')
+ 		goto punt;
+
++#if _FFR_EAI
++	if (!addr_is_ascii(host))
++	{
++		char buf[1024];
++		UErrorCode error = U_ZERO_ERROR;
++		UIDNAInfo info = UIDNA_INFO_INITIALIZER;
++		UIDNA *idna;
++		int anl;
++
++		idna = uidna_openUTS46(UIDNA_NONTRANSITIONAL_TO_ASCII, &error);
++		anl = uidna_nameToASCII_UTF8(idna,
++					     host, strlen(host),
++					     buf, sizeof(buf) - 1,
++					     &info,
++					     &error);
++		uidna_close(idna);
++		host = sm_rpool_strdup_x(CurEnv->e_rpool, buf);
++	}
++#endif /* _FFR_EAI */
++
+ 	/*
+ 	**  If we don't have MX records in our host switch, don't
+ 	**  try for MX records.  Note that this really isn't "right",
+diff --git a/sendmail/err.c b/sendmail/err.c
+index 0594eb9..67d0d09 100644
+--- sendmail/err.c.orig
++++ sendmail/err.c
+@@ -1010,15 +1010,23 @@ fmtmsg(eb, to, num, enhsc, eno, fmt, ap)
+ 		(void) sm_strlcpyn(eb, spaceleft, 2,
+ 				   shortenstring(to, MAXSHORTSTR), "... ");
+ 		spaceleft -= strlen(eb);
++#if _FFR_EAI
++		eb += strlen(eb);
++#else
+ 		while (*eb != '\0')
+ 			*eb++ &= 0177;
++#endif
+ 	}
+
+ 	/* output the message */
+ 	(void) sm_vsnprintf(eb, spaceleft, fmt, ap);
+ 	spaceleft -= strlen(eb);
++#if _FFR_EAI
++	eb += strlen(eb);
++#else
+ 	while (*eb != '\0')
+ 		*eb++ &= 0177;
++#endif
+
+ 	/* output the error code, if any */
+ 	if (eno != 0)
+diff --git a/sendmail/main.c b/sendmail/main.c
+index 38eebbf..43e17a5 100644
+--- sendmail/main.c.orig
++++ sendmail/main.c
+@@ -1854,6 +1854,9 @@ main(argc, argv, envp)
+
+ 	/* MIME message/xxx subtypes that can be treated as messages */
+ 	setclass('s', "rfc822");
++#ifdef _FFR_EAI
++	setclass('s', "global");
++#endif
+
+ 	/* MIME Content-Transfer-Encodings that can be encoded */
+ 	setclass('e', "7bit");
+diff --git a/sendmail/parseaddr.c b/sendmail/parseaddr.c
+index 2adb39c..9ab0729 100644
+--- sendmail/parseaddr.c.orig
++++ sendmail/parseaddr.c
+@@ -273,12 +273,14 @@ invalidaddr(addr, delimptr, isrcpt)
+ 	}
+ 	for (; *addr != '\0'; addr++)
+ 	{
++#ifndef _FFR_EAI
+ 		if (!EightBitAddrOK && (*addr & 0340) == 0200)
+ 		{
+ 			setstat(EX_USAGE);
+ 			result = true;
+ 			*addr = BAD_CHAR_REPLACEMENT;
+ 		}
++#endif
+ 		if (++len > MAXNAME - 1)
+ 		{
+ 			char saved = *addr;
+@@ -350,7 +352,7 @@ hasctrlchar(addr, isrcpt, complain)
+ 			}
+ 			result = "too long";
+ 		}
+-		if (!EightBitAddrOK && !quoted && (*addr < 32 || *addr == 127))
++		if (!quoted && ((unsigned char)*addr < 32 || *addr == 127))
+ 		{
+ 			result = "non-printable character";
+ 			*addr = BAD_CHAR_REPLACEMENT;
+@@ -368,6 +370,7 @@ hasctrlchar(addr, isrcpt, complain)
+ 				break;
+ 			}
+ 		}
++#ifndef _FFR_EAI
+ 		if (!EightBitAddrOK && (*addr & 0340) == 0200)
+ 		{
+ 			setstat(EX_USAGE);
+@@ -375,6 +378,7 @@ hasctrlchar(addr, isrcpt, complain)
+ 			*addr = BAD_CHAR_REPLACEMENT;
+ 			continue;
+ 		}
++#endif
+ 	}
+ 	if (quoted)
+ 		result = "unbalanced quote"; /* unbalanced quote */
+diff --git a/sendmail/queue.c b/sendmail/queue.c
+index a323301..95344d3 100644
+--- sendmail/queue.c.orig
++++ sendmail/queue.c
+@@ -665,6 +665,10 @@ queueup(e, announce, msync)
+ 		*p++ = 'n';
+ 	if (bitset(EF_SPLIT, e->e_flags))
+ 		*p++ = 's';
++#if _FFR_EAI
++	if (e->e_smtputf8)
++		*p++ = 'e';
++#endif
+ 	*p++ = '\0';
+ 	if (buf[0] != '\0')
+ 		(void) sm_io_fprintf(tfp, SM_TIME_DEFAULT, "F%s\n", buf);
+@@ -4285,6 +4289,12 @@ readqf(e, openonly)
+ 				  case 'w':	/* warning sent */
+ 					e->e_flags |= EF_WARNING;
+ 					break;
++
++#if _FFR_EAI
++				  case 'e':	/* message requires EAI */
++					e->e_smtputf8 = true;
++					break;
++#endif /* _FFR_EAI */
+ 				}
+ 			}
+ 			break;
+@@ -4550,6 +4560,23 @@ readqf(e, openonly)
+ 	/* other checks? */
+ #endif /* _FFR_QF_PARANOIA */
+
++#if _FFR_EAI
++	/*
++	** If this message originates from something other than
++	** srvrsmtp.c, then it might use UTF8 addresses but not be
++	** marked.  We'll just add the mark so we're sure that it
++	** either can be delivered or will be returned.
++	*/
++	if (!e->e_smtputf8) {
++		ADDRESS *q;
++		for (q = e->e_sendqueue; q != NULL; q = q->q_next)
++			if (!addr_is_ascii(q->q_paddr) && !e->e_smtputf8)
++				e->e_smtputf8 = true;
++		if (!addr_is_ascii(e->e_from.q_paddr) && !e->e_smtputf8)
++			e->e_smtputf8 = true;
++	}
++#endif /* _FFR_EAI */
++
+ 	/* possibly set ${dsn_ret} macro */
+ 	if (bitset(EF_RET_PARAM, e->e_flags))
+ 	{
+diff --git a/sendmail/recipient.c b/sendmail/recipient.c
+index 3fad957..09eac64 100644
+--- sendmail/recipient.c.orig
++++ sendmail/recipient.c
+@@ -508,6 +508,11 @@ recipient(new, sendq, aliaslevel, e)
+ 		p = e->e_from.q_mailer->m_addrtype;
+ 		if (p == NULL)
+ 			p = "rfc822";
++#ifdef _FFR_EAI
++		if (sm_strcasecmp(p, "rfc822") == 0 &&
++		    !addr_is_ascii(q->q_user))
++			p = "utf-8";
++#endif
+ 		if (sm_strcasecmp(p, "rfc822") != 0)
+ 		{
+ 			(void) sm_snprintf(frbuf, sizeof(frbuf), "%s; %.800s",
+diff --git a/sendmail/savemail.c b/sendmail/savemail.c
+index 6de8f2f..8a9df36 100644
+--- sendmail/savemail.c.orig
++++ sendmail/savemail.c
+@@ -744,6 +744,34 @@ returntosender(msg, returnq, flags, e)
+ 	return ret;
+ }
+
++
++/*
++** DSNTYPENAME -- Returns the DSN name of the addrtype for this address
++**
++**	Sendmail's addrtypes are largely in different universes, and
++**	'fred' may be a valid address in different addrtype
++**	universes.
++**
++**	EAI extends the rfc822 universe rather than introduce a new
++**	universe.  Because of that, sendmail uses the rfc822 addrtype,
++**	but names it utf-8 when the EAI DSN extension requires that.
++*/
++
++const char *
++dsntypename(addrtype, addr)
++	const char * addrtype;
++	const char * addr;
++{
++	if (sm_strcasecmp(addrtype, "rfc822") != 0)
++		return addrtype;
++#ifdef _FFR_EAI
++	if (!addr_is_ascii(addr))
++		return "utf-8";
++#endif
++	return "rfc822";
++}
++
++
+ /*
+ **  ERRBODY -- output the body of an error message.
+ **
+@@ -1082,7 +1110,13 @@ errbody(mci, e, separator)
+ 		(void) sm_strlcpyn(buf, sizeof(buf), 2, "--", e->e_msgboundary);
+ 		if (!putline("", mci) ||
+ 		    !putline(buf, mci) ||
++#ifdef _FFR_EAI
++		    !putline(e->e_parent->e_smtputf8
++			     ? "Content-Type: message/global-delivery-status"
++			     : "Content-Type: message/delivery-status", mci) ||
++#else
+ 		    !putline("Content-Type: message/delivery-status", mci) ||
++#endif
+ 		    !putline("", mci))
+ 			goto writeerr;
+
+@@ -1223,7 +1257,8 @@ errbody(mci, e, separator)
+ 					(void) sm_snprintf(actual,
+ 							   sizeof(actual),
+ 							   "%s; %.700s@%.100s",
+-							   p, q->q_user,
++							   dsntypename(p, q->q_user),
++							   q->q_user,
+ 							   MyHostName);
+ 				}
+ 				else
+@@ -1231,7 +1266,8 @@ errbody(mci, e, separator)
+ 					(void) sm_snprintf(actual,
+ 							   sizeof(actual),
+ 							   "%s; %.800s",
+-							   p, q->q_user);
++							   dsntypename(p, q->q_user),
++							   q->q_user);
+ 				}
+ 			}
+
+@@ -1248,6 +1284,21 @@ errbody(mci, e, separator)
+ 									   actual);
+ 			}
+
++#ifdef _FFR_EAI
++			if (sm_strncasecmp("rfc822;", q->q_finalrcpt, 7) == 0 &&
++			    !addr_is_ascii(q->q_user)) {
++			        char utf8rcpt[1024];
++				char * a;
++				a = strchr(q->q_finalrcpt, ';');
++				while(*a == ';' || *a == ' ')
++					a++;
++				sm_snprintf(utf8rcpt, 1023,
++					    "utf-8; %.800s", a);
++				q->q_finalrcpt = sm_rpool_strdup_x(e->e_rpool,
++								   utf8rcpt);
++			}
++#endif
++
+ 			if (q->q_finalrcpt != NULL)
+ 			{
+ 				(void) sm_snprintf(buf, sizeof(buf),
+@@ -1373,9 +1424,21 @@ errbody(mci, e, separator)
+
+ 			if (!putline(buf, mci))
+ 				goto writeerr;
++#ifdef _FFR_EAI
++			if (e->e_parent->e_smtputf8)
++				(void) sm_strlcpyn(buf, sizeof(buf), 2,
++						   "Content-Type: message/global",
++						   sendbody ? "" : "-headers");
++			else
++				(void) sm_strlcpyn(buf, sizeof(buf), 2,
++						   "Content-Type: ",
++						sendbody ? "message/rfc822"
++							 : "text/rfc822-headers");
++#else
+ 			(void) sm_strlcpyn(buf, sizeof(buf), 2, "Content-Type: ",
+ 					sendbody ? "message/rfc822"
+ 						 : "text/rfc822-headers");
++#endif
+ 			if (!putline(buf, mci))
+ 				goto writeerr;
+
+diff --git a/sendmail/sendmail.h b/sendmail/sendmail.h
+index b2d0211..63a2378 100644
+--- sendmail/sendmail.h.orig
++++ sendmail/sendmail.h
+@@ -781,8 +781,13 @@ MCI
+ #else
+ # define MCIF_NOTSTICKY	0
+ #endif
++#if _FFR_EAI
++#define MCIF_EAI	0x40000000	/* SMTPUTF8 supported */
++#else
++#define MCIF_EAI	0x00000000	/* for MCIF_EXTENS */
++#endif /* _FFR_EAI */
+
+-#define MCIF_EXTENS	(MCIF_EXPN | MCIF_SIZE | MCIF_8BITMIME | MCIF_DSN | MCIF_8BITOK | MCIF_AUTH | MCIF_ENHSTAT | MCIF_TLS | MCIF_AUTH2)
++#define MCIF_EXTENS	(MCIF_EXPN | MCIF_SIZE | MCIF_8BITMIME | MCIF_DSN | MCIF_8BITOK | MCIF_AUTH | MCIF_ENHSTAT | MCIF_TLS | MCIF_AUTH2 | MCIF_EAI)
+
+ /* states */
+ #define MCIS_CLOSED	0		/* no traffic on this connection */
+@@ -921,6 +926,9 @@ struct envelope
+ 	ADDRESS		e_from;		/* the person it is from */
+ 	char		*e_sender;	/* e_from.q_paddr w comments stripped */
+ 	char		**e_fromdomain;	/* the domain part of the sender */
++#if _FFR_EAI
++	bool		e_smtputf8;	/* whether the sender demanded SMTPUTF8 */
++#endif
+ 	ADDRESS		*e_sendqueue;	/* list of message recipients */
+ 	ADDRESS		*e_errorqueue;	/* the queue for error responses */
+
+@@ -1928,6 +1936,9 @@ struct termescape
+ #define D_CANONREQ	'c'	/* canonification required (cf) */
+ #define D_IFNHELO	'h'	/* use if name for HELO */
+ #define D_FQMAIL	'f'	/* fq sender address required (cf) */
++#if _FFR_EAI
++#define D_EAI		'I'	/* EAI supported */
++#endif
+ #define D_FQRCPT	'r'	/* fq recipient address required (cf) */
+ #define D_SMTPS		's'	/* SMTP over SSL (smtps) */
+ #define D_UNQUALOK	'u'	/* unqualified address is ok (cf) */
+@@ -2355,7 +2366,7 @@ EXTERN bool	ForkQueueRuns;	/* fork for each job when running the queue */
+ EXTERN bool	FromFlag;	/* if set, "From" person is explicit */
+ EXTERN bool	FipsMode;
+ EXTERN bool	GrabTo;		/* if set, get recipients from msg */
+-EXTERN bool	EightBitAddrOK;	/* we'll let 8-bit addresses through */
++EXTERN bool	EightBitAddrOK; /* we'll let 8-bit addresses through */
+ EXTERN bool	HasEightBits;	/* has at least one eight bit input byte */
+ EXTERN bool	HasWildcardMX;	/* don't use MX records when canonifying */
+ EXTERN bool	HoldErrs;	/* only output errors to transcript */
+@@ -2855,6 +2866,10 @@ extern bool	xtextok __P((char *));
+ extern int	xunlink __P((char *));
+ extern char	*xuntextify __P((char *));
+
++#if _FFR_EAI
++extern bool	addr_is_ascii __P((const char *));
++#endif
++
+ #if _FFR_RCPTFLAGS
+ extern bool	newmodmailer __P((ADDRESS *, int));
+ #endif
+diff --git a/sendmail/srvrsmtp.c b/sendmail/srvrsmtp.c
+index b05348d..91e6956 100644
+--- sendmail/srvrsmtp.c.orig
++++ sendmail/srvrsmtp.c
+@@ -65,6 +65,9 @@ static bool	NotFirstDelivery = false;
+ #define SRV_REQ_AUTH	0x0400	/* require AUTH */
+ #define SRV_REQ_SEC	0x0800	/* require security - equiv to AuthOptions=p */
+ #define SRV_TMP_FAIL	0x1000	/* ruleset caused a temporary failure */
++#if _FFR_EAI
++# define SRV_OFFER_EAI	0x2000	/* offer SMTPUTF* */
++#endif
+
+ static unsigned int	srvfeatures __P((ENVELOPE *, char *, unsigned int));
+
+@@ -122,6 +125,29 @@ extern ENVELOPE	BlankEnvelope;
+ #define SKIP_SPACE(s)	while (isascii(*s) && isspace(*s))	\
+ 				(s)++
+
++#if _FFR_EAI
++/*
++** ADDR_IS_ASCII -- check whether an address is 100% printable ASCII
++**
++**	Parameters:
++**		a -- an address (or other string)
++**
++**	Returns:
++**		TRUE if a is non-NULL and points to only printable ASCII
++**		FALSE if a is NULL and points to printable ASCII
++**		FALSE if a is non-NULL and points to something containing 8-bittery
++*/
++
++bool
++addr_is_ascii(a)
++	const char * a;
++{
++	while (a != NULL && *a != '\0' && *a >= ' ' && (unsigned char)*a < 127)
++		a++;
++	return (a != NULL && *a == '\0');
++}
++#endif
++
+ /*
+ **  PARSE_ESMTP_ARGS -- parse EMSTP arguments (for MAIL, RCPT)
+ **
+@@ -722,10 +748,21 @@ do								\
+ #else
+ # define auth_active	false
+ #endif
++#ifdef _FFR_EAI
++#define GET_PROTOCOL()					\
++	(e->e_smtputf8					\
++	    ? (auth_active				\
++		? (tls_active ? "UTF8SMTPSA" : "UTF8SMTPA") \
++		: (tls_active ? "UTF8SMTPS"  : "UTF8SMTP")) \
++            : (auth_active				\
++		? (tls_active ? "ESMTPSA" : "ESMTPA")	\
++		: (tls_active ? "ESMTPS"  : "ESMTP")))
++#else
+ #define GET_PROTOCOL()					\
+ 	(auth_active					\
+ 	    ? (tls_active ? "ESMTPSA" : "ESMTPA")	\
+ 	    : (tls_active ? "ESMTPS"  : "ESMTP"))
++#endif
+
+ static bool SevenBitInput_Saved;	/* saved version of SevenBitInput */
+
+@@ -898,6 +935,9 @@ smtp(nullserver, d_flags, e)
+ 		| (bitset(TLS_I_NO_VRFY, TLS_Srv_Opts) ? SRV_NONE
+ 						       : SRV_VRFY_CLT)
+ #endif /* STARTTLS */
++#if _FFR_EAI
++		| SRV_OFFER_EAI
++#endif /* _FFR_EAI */
+ 		;
+ 	if (nullserver == NULL)
+ 	{
+@@ -2523,6 +2563,10 @@ smtp(nullserver, d_flags, e)
+ 			if (SendMIMEErrors && bitset(SRV_OFFER_DSN, features))
+ 				message("250-DSN");
+ #endif /* DSN */
++#if _FFR_EAI
++			if (bitset(SRV_OFFER_EAI, features))
++				message("250-SMTPUTF8");
++#endif /* _FFR_EAI */
+ 			if (bitset(SRV_OFFER_ETRN, features))
+ 				message("250-ETRN");
+ #if SASL
+@@ -2696,6 +2740,18 @@ smtp(nullserver, d_flags, e)
+ 			if (Errors > 0)
+ 				sm_exc_raisenew_x(&EtypeQuickAbort, 1);
+
++#if _FFR_EAI
++			if (e->e_smtputf8) {
++				protocol = GET_PROTOCOL();
++				macdefine(&e->e_macro, A_PERM, 'r', protocol);
++			}
++			/* UTF8 addresses are only legal with SMTPUTF8 */
++			if (!e->e_smtputf8 && !addr_is_ascii(e->e_from.q_paddr)) {
++				usrerr("553 5.6.7 That address requires SMTPUTF8");
++				sm_exc_raisenew_x(&EtypeQuickAbort, 1);
++			}
++#endif
++
+ #if SASL
+ # if _FFR_AUTH_PASSING
+ 			/* set the default AUTH= if the sender didn't */
+@@ -2933,6 +2989,13 @@ smtp(nullserver, d_flags, e)
+ 				usrerr("501 5.0.0 Missing recipient");
+ 				goto rcpt_done;
+ 			}
++#if _FFR_EAI
++			if (!e->e_smtputf8 && !addr_is_ascii(a->q_paddr))
++			{
++				usrerr("553 5.6.7 Address requires SMTPUTF8");
++				goto rcpt_done;
++			}
++#endif
+
+ 			if (delimptr != NULL && *delimptr != '\0')
+ 				*delimptr++ = '\0';
+@@ -4820,6 +4883,17 @@ mail_esmtp_args(a, kp, vp, e)
+
+ 		/* XXX: check whether more characters follow? */
+ 	}
++#if _FFR_EAI
++	else if (sm_strcasecmp(kp, "smtputf8") == 0)
++	{
++		if (!bitset(SRV_OFFER_EAI, e->e_features))
++		{
++			usrerr("504 5.7.0 Sorry, SMTPUTF8 not supported/enabled");
++			/* NOTREACHED */
++		}
++		e->e_smtputf8 = true;
++	}
++#endif
+ 	else
+ 	{
+ 		usrerr("555 5.5.4 %s parameter unrecognized", kp);
+@@ -5174,6 +5248,9 @@ static struct
+ 	{ 'C',	SRV_REQ_SEC	},
+ 	{ 'D',	SRV_OFFER_DSN	},
+ 	{ 'E',	SRV_OFFER_ETRN	},
++#if _FFR_EAI
++	{ 'I',	SRV_OFFER_EAI	},
++#endif
+ 	{ 'L',	SRV_REQ_AUTH	},
+ #if PIPELINING
+ # if _FFR_NO_PIPE
+diff --git a/sendmail/usersmtp.c b/sendmail/usersmtp.c
+index 24d38ee..cbc6bb7 100644
+--- sendmail/usersmtp.c.orig
++++ sendmail/usersmtp.c
+@@ -465,6 +465,10 @@ helo_options(line, firstline, m, mci, e)
+ 		mci->mci_flags |= MCIF_PIPELINED;
+ 	else if (sm_strcasecmp(line, "verb") == 0)
+ 		mci->mci_flags |= MCIF_VERB;
++#if _FFR_EAI
++	else if (sm_strcasecmp(line, "smtputf8") == 0)
++		mci->mci_flags |= MCIF_EAI;
++#endif /* _FFR_EAI */
+ #if STARTTLS
+ 	else if (sm_strcasecmp(line, "starttls") == 0)
+ 		mci->mci_flags |= MCIF_TLS;
+@@ -2027,6 +2031,19 @@ smtpmailfrom(m, mci, e)
+ 		return EX_TEMPFAIL;
+ 	}
+
++#if _FFR_EAI
++	/*
++	**  Abort right away if the message needs SMTPUTF8 and the
++	**  server does not advertise SMTPUTF8.
++	*/
++
++	if (e->e_smtputf8 && !bitset(MCIF_EAI, mci->mci_flags)) {
++		usrerrenh("5.6.7", "%s does not support SMTPUTF8", CurHostName);
++		mci_setstat(mci, EX_NOTSTICKY, "5.6.7", NULL);
++		return EX_DATAERR;
++	}
++#endif /* _FFR_EAI */
++
+ 	/* set up appropriate options to include */
+ 	if (bitset(MCIF_SIZE, mci->mci_flags) && e->e_msgsize > 0)
+ 	{
+@@ -2040,6 +2057,14 @@ smtpmailfrom(m, mci, e)
+ 		bufp = optbuf;
+ 	}
+
++#if _FFR_EAI
++	if (e->e_smtputf8) {
++		(void) sm_snprintf(bufp, SPACELEFT(optbuf, bufp),
++				 " SMTPUTF8");
++		bufp += strlen(bufp);
++	}
++#endif /* _FFR_EAI */

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801022212.w02MCEks092120>