diff options
| author | Gregory Neil Shapiro <gshapiro@FreeBSD.org> | 2002-08-28 17:57:52 +0000 | 
|---|---|---|
| committer | Gregory Neil Shapiro <gshapiro@FreeBSD.org> | 2002-08-28 17:57:52 +0000 | 
| commit | 959366dcbe20824a331bcae977d662025850f481 (patch) | |
| tree | 917921b3db147e850cc818686dc5ee3127c9842b /contrib/sendmail/src | |
| parent | 739ac4d4d3a1d1d68eae4e7bd59c179d842864d2 (diff) | |
Diffstat (limited to 'contrib/sendmail/src')
| -rw-r--r-- | contrib/sendmail/src/Makefile.m4 | 18 | ||||
| -rw-r--r-- | contrib/sendmail/src/TRACEFLAGS | 3 | ||||
| -rw-r--r-- | contrib/sendmail/src/collect.c | 15 | ||||
| -rw-r--r-- | contrib/sendmail/src/conf.c | 41 | ||||
| -rw-r--r-- | contrib/sendmail/src/deliver.c | 39 | ||||
| -rw-r--r-- | contrib/sendmail/src/domain.c | 6 | ||||
| -rw-r--r-- | contrib/sendmail/src/headers.c | 18 | ||||
| -rw-r--r-- | contrib/sendmail/src/main.c | 4 | ||||
| -rw-r--r-- | contrib/sendmail/src/map.c | 5 | ||||
| -rw-r--r-- | contrib/sendmail/src/milter.c | 24 | ||||
| -rw-r--r-- | contrib/sendmail/src/parseaddr.c | 17 | ||||
| -rw-r--r-- | contrib/sendmail/src/queue.c | 75 | ||||
| -rw-r--r-- | contrib/sendmail/src/readcf.c | 7 | ||||
| -rw-r--r-- | contrib/sendmail/src/sasl.c | 4 | ||||
| -rw-r--r-- | contrib/sendmail/src/sendmail.h | 68 | ||||
| -rw-r--r-- | contrib/sendmail/src/sfsasl.c | 18 | ||||
| -rw-r--r-- | contrib/sendmail/src/srvrsmtp.c | 53 | ||||
| -rw-r--r-- | contrib/sendmail/src/usersmtp.c | 22 | ||||
| -rw-r--r-- | contrib/sendmail/src/version.c | 4 | 
19 files changed, 305 insertions, 136 deletions
diff --git a/contrib/sendmail/src/Makefile.m4 b/contrib/sendmail/src/Makefile.m4 index 615ac594f937e..6143bbedd46db 100644 --- a/contrib/sendmail/src/Makefile.m4 +++ b/contrib/sendmail/src/Makefile.m4 @@ -1,4 +1,4 @@ -dnl $Id: Makefile.m4,v 8.91.2.1 2002/06/21 21:58:47 ca Exp $ +dnl $Id: Makefile.m4,v 8.91.2.3 2002/07/29 22:08:09 gshapiro Exp $  include(confBUILDTOOLSDIR`/M4/switch.m4')  define(`confREQUIRE_LIBSM', `true') @@ -20,8 +20,12 @@ define(`bldTARGET_LINKS', ifdef(`confLINKS', `confLINKS',  # location of sendmail statistics file (usually /etc/mail/ or /var/log)  STDIR= ifdef(`confSTDIR', `confSTDIR', `/etc/mail') +# statistics file name +STFILE=	ifdef(`confSTFILE', `confSTFILE', `statistics') +MSPSTFILE=ifdef(`confMSP_STFILE', `confMSP_STFILE', `sm-client.st') +  # full path to installed statistics file (usually ${STDIR}/statistics) -STFILE= ${STDIR}/ifdef(`confSTFILE', `confSTFILE', `statistics') +STPATH= ${STDIR}/${STFILE}  # location of sendmail helpfile file (usually /etc/mail)  HFDIR= ifdef(`confHFDIR', `confHFDIR', `/etc/mail') @@ -66,7 +70,7 @@ install-set-user-id: bldCURRENT_PRODUCT ifdef(`confNO_HELPFILE_INSTALL',, `insta  	${INSTALL} -c -o ${S`'BINOWN} -g ${S`'BINGRP} -m ${S`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR}  	for i in ${sendmailTARGET_LINKS}; do \  		rm -f $$i; \ -		ln -s ${M`'BINDIR}/sendmail $$i; \ +		${LN} ${LNOPTS} ${M`'BINDIR}/sendmail $$i; \  	done  define(`confMTA_LINKS', `${DESTDIR}${UBINDIR}/newaliases ${DESTDIR}${UBINDIR}/mailq ${DESTDIR}${UBINDIR}/hoststat ${DESTDIR}${UBINDIR}/purgestat') @@ -74,7 +78,7 @@ install-sm-mta: bldCURRENT_PRODUCT  	${INSTALL} -c -o ${M`'BINOWN} -g ${M`'BINGRP} -m ${M`'BINMODE} bldCURRENT_PRODUCT ${DESTDIR}${M`'BINDIR}/sm-mta  	for i in confMTA_LINKS; do \  		rm -f $$i; \ -		ln -s ${M`'BINDIR}/sm-mta $$i; \ +		${LN} ${LNOPTS} ${M`'BINDIR}/sm-mta $$i; \  	done  install-hf: @@ -83,7 +87,11 @@ install-hf:  install-st: statistics  	if [ ! -d ${DESTDIR}${STDIR} ]; then mkdir -p ${DESTDIR}${STDIR}; else :; fi -	${INSTALL} -c -o ${SBINOWN} -g ${UBINGRP} -m ifdef(`confSTMODE', `confSTMODE', `0600') statistics ${DESTDIR}${STFILE} +	${INSTALL} -c -o ${SBINOWN} -g ${UBINGRP} -m ifdef(`confSTMODE', `confSTMODE', `0600') statistics ${DESTDIR}${STPATH} + +install-submit-st: statistics ${DESTDIR}${MSPQ} +	${INSTALL} -c -o ${MSPQOWN} -g ${GBINGRP} -m ifdef(`confSTMODE', `confSTMODE', `0600') statistics ${DESTDIR}${MSPQ}/${MSPSTFILE} +  divert(0)  bldPRODUCT_END diff --git a/contrib/sendmail/src/TRACEFLAGS b/contrib/sendmail/src/TRACEFLAGS index c64afd1a4c805..2aad39b80008f 100644 --- a/contrib/sendmail/src/TRACEFLAGS +++ b/contrib/sendmail/src/TRACEFLAGS @@ -1,4 +1,4 @@ -#	$Id: TRACEFLAGS,v 8.37 2002/05/24 23:37:32 ca Exp $ +#	$Id: TRACEFLAGS,v 8.37.2.1 2002/07/01 20:55:47 gshapiro Exp $  0, 4	main.c		main	canonical name, UUCP node name, a.k.a.s  0, 15	main.c		main	print configuration  0, 44	util.c		printav	print address of each string @@ -80,6 +80,7 @@  #if _FFR_QUARANTINE  70	queue.c		quarantining  #endif /* _FFR_QUARANTINE */ +71,>99	milter.c	quarantine on errors  80			content length  81			sun remote mode  91	mci.c		syslogging of MCI cache information diff --git a/contrib/sendmail/src/collect.c b/contrib/sendmail/src/collect.c index a926d61f0ec64..a4149fb0a2602 100644 --- a/contrib/sendmail/src/collect.c +++ b/contrib/sendmail/src/collect.c @@ -13,7 +13,7 @@  #include <sendmail.h> -SM_RCSID("@(#)$Id: collect.c,v 8.242 2002/05/10 15:40:09 ca Exp $") +SM_RCSID("@(#)$Id: collect.c,v 8.242.2.2 2002/08/16 14:56:01 ca Exp $")  static void	collecttimeout __P((time_t));  static void	dferror __P((SM_FILE_T *volatile, char *, ENVELOPE *)); @@ -60,8 +60,8 @@ collect_eoh(e, numhdrs, hdrslen)  	if (tTd(30, 10))  		sm_dprintf("collect: rscheck(\"check_eoh\", \"%s $| %s\")\n",  			   hnum, hsize); -	(void) rscheck("check_eoh", hnum, hsize, e, false, true, 3, NULL, -			e->e_id); +	(void) rscheck("check_eoh", hnum, hsize, e, RSF_UNSTRUCTURED|RSF_COUNT, +			3, NULL, e->e_id);  	/*  	**  Process the header, @@ -765,6 +765,7 @@ readerr:  	{  		char *host;  		char *problem; +		ADDRESS *q;  		host = RealHostName;  		if (host == NULL) @@ -795,6 +796,14 @@ readerr:  		e->e_flags &= ~EF_FATALERRS;  		e->e_flags |= EF_CLRQUEUE; +		/* Don't send any message notification to sender */ +		for (q = e->e_sendqueue; q != NULL; q = q->q_next) +		{ +			if (QS_IS_DEAD(q->q_state)) +				continue; +			q->q_state = QS_FATALERR; +		} +  		finis(true, true, ExitStat);  		/* NOTREACHED */  	} diff --git a/contrib/sendmail/src/conf.c b/contrib/sendmail/src/conf.c index 59e485b845335..a850b2a0065bf 100644 --- a/contrib/sendmail/src/conf.c +++ b/contrib/sendmail/src/conf.c @@ -13,7 +13,7 @@  #include <sendmail.h> -SM_RCSID("@(#)$Id: conf.c,v 8.972 2002/06/18 16:11:44 ca Exp $") +SM_RCSID("@(#)$Id: conf.c,v 8.972.2.5 2002/08/16 14:56:01 ca Exp $")  #include <sendmail/pathnames.h> @@ -2372,12 +2372,15 @@ initsetproctitle(argc, argv, envp)  	**  the top of memory.  	*/ -	for (i = 0; envp[i] != NULL; i++) -		continue; -	environ = (char **) xalloc(sizeof (char *) * (i + 1)); -	for (i = 0; envp[i] != NULL; i++) -		environ[i] = newstr(envp[i]); -	environ[i] = NULL; +	if (envp != NULL) +	{ +		for (i = 0; envp[i] != NULL; i++) +			continue; +		environ = (char **) xalloc(sizeof (char *) * (i + 1)); +		for (i = 0; envp[i] != NULL; i++) +			environ[i] = newstr(envp[i]); +		environ[i] = NULL; +	}  	/*  	**  Save start and extent of argv for setproctitle. @@ -2403,7 +2406,7 @@ initsetproctitle(argc, argv, envp)  		if (i == 0 || LastArgv + 1 == argv[i])  			LastArgv = argv[i] + SPT_ALIGN(strlen(argv[i]), align);  	} -	for (i = 0; LastArgv != NULL && envp[i] != NULL; i++) +	for (i = 0; LastArgv != NULL && envp != NULL && envp[i] != NULL; i++)  	{  		if (LastArgv + 1 == envp[i])  			LastArgv = envp[i] + SPT_ALIGN(strlen(envp[i]), align); @@ -2652,7 +2655,6 @@ SIGFUNC_DECL  reapchild(sig)  	int sig;  { -	int m = 0;  	int save_errno = errno;  	int st;  	pid_t pid; @@ -2690,7 +2692,6 @@ reapchild(sig)  # endif /* HASWAITPID */  		/* Drop PID and check if it was a control socket child */  		proc_list_drop(pid, st, NULL); -		CurRunners -= m; /* Update */  	}  	FIX_SYSV_SIGNAL(sig, reapchild);  	errno = save_errno; @@ -3065,11 +3066,21 @@ static char	*DefaultUserShells[] =  # endif /* defined(__svr4__) || defined(__svr5__) */  # ifdef sgi  	"/sbin/sh",		/* SGI's shells really live in /sbin */ -	"/sbin/csh", +	"/usr/bin/sh", +	"/sbin/bsh",		/* classic borne shell */ +	"/bin/bsh", +	"/usr/bin/bsh", +	"/sbin/csh",		/* standard csh */ +	"/bin/csh", +	"/usr/bin/csh", +	"/sbin/jsh",		/* classic borne shell w/ job control*/ +	"/bin/jsh", +	"/usr/bin/jsh",  	"/bin/ksh",		/* Korn shell */  	"/sbin/ksh",  	"/usr/bin/ksh", -	"/bin/tcsh",		/* Extended csh */ +	"/sbin/tcsh",		/* Extended csh */ +	"/bin/tcsh",  	"/usr/bin/tcsh",  # endif /* sgi */  	NULL @@ -3930,7 +3941,7 @@ validate_connection(sap, hostname, e)  			hostname, anynet_ntoa(sap));  	if (rscheck("check_relay", hostname, anynet_ntoa(sap), -		    e, true, true, 3, NULL, NOQID) != EX_OK) +		    e, RSF_RMCOMM|RSF_COUNT, 3, NULL, NOQID) != EX_OK)  	{  		static char reject[BUFSIZ*2];  		extern char MsgBuf[]; @@ -5955,6 +5966,10 @@ char	*FFRCompileOptions[] =  /* Steven Pitzl */  	"_FFR_NODELAYDSN_ON_HOLD",  #endif /* _FFR_NODELAYDSN_ON_HOLD */ +#if _FFR_NONSTOP_PERSISTENCE +/* Suggested by Jan Krueger of digitalanswers communications consulting gmbh. */ +	"_FFR_NONSTOP_PERSISTENCE", +#endif /* _FFR_NONSTOP_PERSISTENCE */  #if _FFR_NO_PIPE  	"_FFR_NO_PIPE",  #endif /* _FFR_NO_PIPE */ diff --git a/contrib/sendmail/src/deliver.c b/contrib/sendmail/src/deliver.c index e70e1daa54f9a..46f5a912ad42c 100644 --- a/contrib/sendmail/src/deliver.c +++ b/contrib/sendmail/src/deliver.c @@ -14,7 +14,7 @@  #include <sendmail.h>  #include <sys/time.h> -SM_RCSID("@(#)$Id: deliver.c,v 8.940 2002/06/06 00:03:16 gshapiro Exp $") +SM_RCSID("@(#)$Id: deliver.c,v 8.940.2.3 2002/08/16 14:56:01 ca Exp $")  #if HASSETUSERCONTEXT  # include <login_cap.h> @@ -1013,6 +1013,16 @@ dup_queue_file(e, ee, type)  	(void) sm_strlcpy(f1buf, queuename(e, type), sizeof f1buf);  	(void) sm_strlcpy(f2buf, queuename(ee, type), sizeof f2buf); + +	/* Force the df to disk if it's not there yet */ +	if (type == DATAFL_LETTER && e->e_dfp != NULL && +	    sm_io_setinfo(e->e_dfp, SM_BF_COMMIT, NULL) < 0 && +	    errno != EINVAL) +	{ +		syserr("!dup_queue_file: can't commit %s", f1buf); +		/* NOTREACHED */ +	} +  	if (link(f1buf, f2buf) < 0)  	{  		int save_errno = errno; @@ -1545,7 +1555,8 @@ deliver(e, firstto)  		quarantine = (e->e_quarmsg != NULL);  #endif /* _FFR_QUARANTINE */  		rcode = rscheck("check_compat", e->e_from.q_paddr, to->q_paddr, -				e, true, true, 3, NULL, e->e_id); +				e, RSF_RMCOMM|RSF_COUNT, 3, NULL, +				e->e_id);  		if (rcode == EX_OK)  		{  			/* do in-code checking if not discarding */ @@ -2347,10 +2358,14 @@ tryhost:  					pwd = sm_getpwnam(contextaddr->q_ruser);  				else  					pwd = sm_getpwnam(contextaddr->q_user); -				if (pwd != NULL) -					(void) setusercontext(NULL, -							      pwd, pwd->pw_uid, -							      LOGIN_SETRESOURCES|LOGIN_SETPRIORITY); +				if (pwd != NULL && +				    setusercontext(NULL, pwd, pwd->pw_uid, +						   LOGIN_SETRESOURCES|LOGIN_SETPRIORITY) == -1 && +				    suidwarn) +				{ +					syserr("openmailer: setusercontext() failed"); +					exit(EX_TEMPFAIL); +				}  			}  # endif /* HASSETUSERCONTEXT */ @@ -2879,8 +2894,8 @@ reconnect:	/* after switching to an encrypted connection */  				olderrors = Errors;  				QuickAbort = false;  				SuprErrs = true; -				if (rscheck("try_tls", host, NULL, e, true, -					    false, 7, host, NOQID) != EX_OK +				if (rscheck("try_tls", host, NULL, e, +					    RSF_RMCOMM, 7, host, NOQID) != EX_OK  				    || Errors > olderrors)  					usetls = false;  				SuprErrs = saveSuprErrs; @@ -2948,8 +2963,8 @@ reconnect:	/* after switching to an encrypted connection */  			if (rscheck("tls_server",  				    macvalue(macid("{verify}"), e), -				    NULL, e, true, true, 5, host, -				    NOQID) != EX_OK || +				    NULL, e, RSF_RMCOMM|RSF_COUNT, 5, +				    host, NOQID) != EX_OK ||  			    Errors > olderrors ||  			    rcode == EX_SOFTWARE)  			{ @@ -3241,8 +3256,8 @@ do_transfer:  				e->e_to = to->q_paddr;  # if STARTTLS  				i = rscheck("tls_rcpt", to->q_user, NULL, e, -					    true, true, 3, mci->mci_host, -					    e->e_id); +					    RSF_RMCOMM|RSF_COUNT, 3, +					    mci->mci_host, e->e_id);  				if (i != EX_OK)  				{  					markfailure(e, to, mci, i, false); diff --git a/contrib/sendmail/src/domain.c b/contrib/sendmail/src/domain.c index f48f987fd8922..f086d80854310 100644 --- a/contrib/sendmail/src/domain.c +++ b/contrib/sendmail/src/domain.c @@ -14,9 +14,9 @@  #include <sendmail.h>  #if NAMED_BIND -SM_RCSID("@(#)$Id: domain.c,v 8.181 2002/05/24 23:48:42 gshapiro Exp $ (with name server)") +SM_RCSID("@(#)$Id: domain.c,v 8.181.2.1 2002/06/27 16:55:04 ca Exp $ (with name server)")  #else /* NAMED_BIND */ -SM_RCSID("@(#)$Id: domain.c,v 8.181 2002/05/24 23:48:42 gshapiro Exp $ (without name server)") +SM_RCSID("@(#)$Id: domain.c,v 8.181.2.1 2002/06/27 16:55:04 ca Exp $ (without name server)")  #endif /* NAMED_BIND */  #if NAMED_BIND @@ -664,7 +664,7 @@ bestmx_map_lookup(map, name, av, statp)  #endif /* _FFR_BESTMX_BETTER_TRUNCATION */  	_res.options &= ~(RES_DNSRCH|RES_DEFNAMES); -	nmx = getmxrr(name, mxhosts, NULL, false, statp, true, NULL); +	nmx = getmxrr(name, mxhosts, NULL, false, statp, false, NULL);  	_res.options = saveopts;  	if (nmx <= 0)  		return NULL; diff --git a/contrib/sendmail/src/headers.c b/contrib/sendmail/src/headers.c index a56266e7d6bb4..fdcccf6725383 100644 --- a/contrib/sendmail/src/headers.c +++ b/contrib/sendmail/src/headers.c @@ -13,7 +13,7 @@  #include <sendmail.h> -SM_RCSID("@(#)$Id: headers.c,v 8.266 2001/10/12 01:50:12 gshapiro Exp $") +SM_RCSID("@(#)$Id: headers.c,v 8.266.4.1 2002/08/16 14:56:01 ca Exp $")  static size_t	fix_mime_header __P((char *));  static int	priencode __P((char *)); @@ -285,23 +285,27 @@ hse:  	if (bitset(pflag, CHHDR_CHECK))  	{ -		bool stripcom = false; +		int rscheckflags;  		char *rs;  		/* no ruleset? look for default */  		rs = hi->hi_ruleset; +		rscheckflags = RSF_COUNT; +		if (!bitset(hi->hi_flags, H_FROM|H_RCPT)) +			rscheckflags |= RSF_UNSTRUCTURED;  		if (rs == NULL)  		{  			s = stab("*", ST_HEADER, ST_FIND);  			if (s != NULL)  			{  				rs = (&s->s_header)->hi_ruleset; -				stripcom = bitset((&s->s_header)->hi_flags, -						  H_STRIPCOMM); +				if (bitset((&s->s_header)->hi_flags, +					   H_STRIPCOMM)) +					rscheckflags |= RSF_RMCOMM;  			}  		} -		else -			stripcom = bitset(hi->hi_flags, H_STRIPCOMM); +		else if (bitset(hi->hi_flags, H_STRIPCOMM)) +			rscheckflags |= RSF_RMCOMM;  		if (rs != NULL)  		{  			int l, k; @@ -366,7 +370,7 @@ hse:  #endif /* _FFR_HDR_TYPE */  				macdefine(&e->e_macro, A_PERM,  					macid("{addr_type}"), "h"); -			(void) rscheck(rs, fvalue, NULL, e, stripcom, true, 3, +			(void) rscheck(rs, fvalue, NULL, e, rscheckflags, 3,  				       NULL, e->e_id);  		}  	} diff --git a/contrib/sendmail/src/main.c b/contrib/sendmail/src/main.c index 22a1aaccaf0b8..2aff085ab2b49 100644 --- a/contrib/sendmail/src/main.c +++ b/contrib/sendmail/src/main.c @@ -25,7 +25,7 @@ SM_UNUSED(static char copyright[]) =  	The Regents of the University of California.  All rights reserved.\n";  #endif /* ! lint */ -SM_RCSID("@(#)$Id: main.c,v 8.887 2002/06/17 22:25:52 gshapiro Exp $") +SM_RCSID("@(#)$Id: main.c,v 8.887.2.1 2002/08/04 17:36:06 gshapiro Exp $")  #if NETINET || NETINET6 @@ -3380,7 +3380,7 @@ getextenv(envar)  	int l;  	l = strlen(envar); -	for (envp = ExternalEnviron; *envp != NULL; envp++) +	for (envp = ExternalEnviron; envp != NULL && *envp != NULL; envp++)  	{  		if (strncmp(*envp, envar, l) == 0 && (*envp)[l] == '=')  			return &(*envp)[l + 1]; diff --git a/contrib/sendmail/src/map.c b/contrib/sendmail/src/map.c index f0301ebed5f14..feba80bea0af4 100644 --- a/contrib/sendmail/src/map.c +++ b/contrib/sendmail/src/map.c @@ -13,7 +13,7 @@  #include <sendmail.h> -SM_RCSID("@(#)$Id: map.c,v 8.645.2.1 2002/06/21 20:25:23 ca Exp $") +SM_RCSID("@(#)$Id: map.c,v 8.645.2.3 2002/08/09 22:23:13 gshapiro Exp $")  #if LDAPMAP  # include <sm/ldap.h> @@ -3811,6 +3811,8 @@ ldapmap_lookup(map, name, av, statp)  					{  						p += sm_strlcpy(p, attr,  								vsize - (p - vp_tmp)); +						if (p >= vp_tmp + vsize) +							syserr("ldapmap_lookup: Internal error: buffer too small for LDAP values");  						*p++ = lmap->ldap_attrsep;  					}  					p += sm_strlcpy(p, vals[i], @@ -7198,6 +7200,7 @@ ns_map_t_find(mapname)  		ns_map = (ns_map_list_t *) xalloc(sizeof *ns_map);  		ns_map->mapname = newstr(mapname);  		ns_map->map = (ns_map_t *) xalloc(sizeof *ns_map->map); +		memset(ns_map->map, '\0', sizeof *ns_map->map);  		ns_map->next = ns_maps;  		ns_maps = ns_map;  	} diff --git a/contrib/sendmail/src/milter.c b/contrib/sendmail/src/milter.c index 2e45e509ac6dd..271f7dca39503 100644 --- a/contrib/sendmail/src/milter.c +++ b/contrib/sendmail/src/milter.c @@ -10,7 +10,7 @@  #include <sendmail.h> -SM_RCSID("@(#)$Id: milter.c,v 8.197 2002/06/12 22:33:48 gshapiro Exp $") +SM_RCSID("@(#)$Id: milter.c,v 8.197.2.2 2002/08/06 22:58:38 gshapiro Exp $")  #if MILTER  # include <libmilter/mfapi.h> @@ -45,13 +45,33 @@ static char *MilterEnvRcptMacros[MAXFILTERMACROS + 1];  		milter_abort(e); \  	} -# define MILTER_CHECK_ERROR(action) \ +# if _FFR_QUARANTINE +#  define MILTER_CHECK_ERROR(action) \ +	if (tTd(71, 101)) \ +	{ \ +		if (e->e_quarmsg == NULL) \ +		{ \ +			e->e_quarmsg = sm_rpool_strdup_x(e->e_rpool, \ +							 "filter failure"); \ +			macdefine(&e->e_macro, A_PERM, macid("{quarantine}"), \ +				  e->e_quarmsg); \ +		} \ +	} \ +	else if (bitnset(SMF_TEMPFAIL, m->mf_flags)) \ +		*state = SMFIR_TEMPFAIL; \ +	else if (bitnset(SMF_REJECT, m->mf_flags)) \ +		*state = SMFIR_REJECT; \ +	else \ +		action; +# else /* _FFR_QUARANTINE */ +#  define MILTER_CHECK_ERROR(action) \  	if (bitnset(SMF_TEMPFAIL, m->mf_flags)) \  		*state = SMFIR_TEMPFAIL; \  	else if (bitnset(SMF_REJECT, m->mf_flags)) \  		*state = SMFIR_REJECT; \  	else \  		action; +# endif /* _FFR_QUARANTINE */  # define MILTER_CHECK_REPLYCODE(default) \  	if (response == NULL || \ diff --git a/contrib/sendmail/src/parseaddr.c b/contrib/sendmail/src/parseaddr.c index 0c9d49e146fe8..c7de84b07acbc 100644 --- a/contrib/sendmail/src/parseaddr.c +++ b/contrib/sendmail/src/parseaddr.c @@ -13,7 +13,7 @@  #include <sendmail.h> -SM_RCSID("@(#)$Id: parseaddr.c,v 8.359.2.1 2002/06/19 18:24:26 gshapiro Exp $") +SM_RCSID("@(#)$Id: parseaddr.c,v 8.359.2.2 2002/08/16 14:56:01 ca Exp $")  static void	allocaddr __P((ADDRESS *, int, char *, ENVELOPE *));  static int	callsubr __P((char**, int, ENVELOPE *)); @@ -2871,8 +2871,7 @@ dequote_map(map, name, av, statp)  **		p1 -- the first string to check.  **		p2 -- the second string to check -- may be null.  **		e -- the current envelope. -**		rmcomm -- remove comments? -**		cnt -- count rejections (statistics)? +**		flags -- control some behavior, see RSF_ in sendmail.h  **		logl -- logging level.  **		host -- NULL or relay host.  **		logid -- id for sm_syslog. @@ -2883,12 +2882,12 @@ dequote_map(map, name, av, statp)  */  int -rscheck(rwset, p1, p2, e, rmcomm, cnt, logl, host, logid) +rscheck(rwset, p1, p2, e, flags, logl, host, logid)  	char *rwset;  	char *p1;  	char *p2;  	ENVELOPE *e; -	bool rmcomm, cnt; +	int flags;  	int logl;  	char *host;  	char *logid; @@ -2948,7 +2947,7 @@ rscheck(rwset, p1, p2, e, rmcomm, cnt, logl, host, logid)  		SuprErrs = true;  		QuickAbort = false;  		pvp = prescan(buf, '\0', pvpbuf, sizeof pvpbuf, NULL, -			      rmcomm ? NULL : TokTypeNoC); +			      bitset(RSF_RMCOMM, flags) ? NULL : TokTypeNoC);  		SuprErrs = saveSuprErrs;  		if (pvp == NULL)  		{ @@ -2961,7 +2960,11 @@ rscheck(rwset, p1, p2, e, rmcomm, cnt, logl, host, logid)  	*/  			goto finis;  		} +		if (bitset(RSF_UNSTRUCTURED, flags)) +			SuprErrs = true;  		(void) REWRITE(pvp, rsno, e); +		if (bitset(RSF_UNSTRUCTURED, flags)) +			SuprErrs = saveSuprErrs;  		if (pvp[0] == NULL || (pvp[0][0] & 0377) != CANONNET ||  		    pvp[1] == NULL || (strcmp(pvp[1], "error") != 0 &&  				       strcmp(pvp[1], "discard") != 0)) @@ -3012,7 +3015,7 @@ rscheck(rwset, p1, p2, e, rmcomm, cnt, logl, host, logid)  			ExitStat = saveexitstat;  			if (!logged)  			{ -				if (cnt) +				if (bitset(RSF_COUNT, flags))  					markstats(e, &a1, STATS_REJECT);  				logged = true;  			} diff --git a/contrib/sendmail/src/queue.c b/contrib/sendmail/src/queue.c index 98096c7c3f502..26e73f0f52c12 100644 --- a/contrib/sendmail/src/queue.c +++ b/contrib/sendmail/src/queue.c @@ -13,7 +13,7 @@  #include <sendmail.h> -SM_RCSID("@(#)$Id: queue.c,v 8.863.2.2 2002/06/25 21:34:31 gshapiro Exp $") +SM_RCSID("@(#)$Id: queue.c,v 8.863.2.6 2002/08/16 16:27:37 gshapiro Exp $")  #include <dirent.h> @@ -1463,21 +1463,36 @@ runqueue(forkflag, verbose, persistent, runall)  		**  Pick up where we left off (curnum), in case we  		**  used up all the children last time without finishing.  		**  This give a round-robin fairness to queue runs. +		** +		**  Increment CurRunners before calling run_work_group() +		**  to avoid a "race condition" with proc_list_drop() which +		**  decrements CurRunners if the queue runners terminate. +		**  This actually doesn't cause any harm, but CurRunners +		**  might become negative which is at least confusing. +		** +		**  Notice: CurRunners is an upper limit, in some cases +		**  (too few jobs in the queue) this value is larger than +		**  the actual number of queue runners. The discrepancy can +		**  increase if some queue runners "hang" for a long time.  		*/ +		CurRunners += WorkGrp[curnum].wg_maxact;  		ret = run_work_group(curnum, forkflag, verbose, persistent,  				     runall);  		/*  		**  Failure means a message was printed for ETRN  		**  and subsequent queues are likely to fail as well. +		**  Decrement CurRunners in that case because +		**  none have been started.  		*/  		if (!ret) +		{ +			CurRunners -= WorkGrp[curnum].wg_maxact;  			break; +		} -		/* Success means the runner count needs to be updated. */ -		CurRunners += WorkGrp[curnum].wg_maxact;  		if (!persistent)  			schedule_queue_runs(runall, curnum, true);  		INCR_MOD(curnum, NumWorkGroups); @@ -2000,6 +2015,24 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)  			maxrunners = njobs;  		for (loop = 0; loop < maxrunners; loop++)  		{ +#if _FFR_NONSTOP_PERSISTENCE +			/* +			**  Require a free "slot" before processing +			**  this queue runner. +			*/ + +			while (MaxQueueChildren > 0 && +			       CurChildren > MaxQueueChildren) +			{ +				int status; +				pid_t ret; + +				while ((ret = sm_wait(&status)) <= 0) +					continue; +				proc_list_drop(ret, status, NULL); +			} +#endif /* _FFR_NONSTOP_PERSISTENCE */ +  			/*  			**  Since the delivery may happen in a child and the  			**  parent does not wait, the parent may close the @@ -2083,6 +2116,7 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)  		sm_releasesignal(SIGCHLD); +#if !_FFR_NONSTOP_PERSISTENCE  		/*  		**  Wait until all of the runners have completed before  		**  seeing if there is another queue group in the @@ -2101,6 +2135,7 @@ run_work_group(wgrp, forkflag, verbose, persistent, runall)  				continue;  			proc_list_drop(ret, status, NULL);  		} +#endif /* !_FFR_NONSTOP_PERSISTENCE */  	}  	else  	{ @@ -5632,21 +5667,33 @@ setnewqueue(e)  	/* not set somewhere else */  	if (e->e_qgrp == NOQGRP)  	{ +		ADDRESS *q; +  		/* -		**  Use the queue group of the first recipient, as set by +		**  Use the queue group of the "first" recipient, as set by  		**  the "queuegroup" rule set.  If that is not defined, then  		**  use the queue group of the mailer of the first recipient.  		**  If that is not defined either, then use the default  		**  queue group. +		**  Notice: "first" depends on the sorting of sendqueue +		**  in recipient(). +		**  To avoid problems with "bad" recipients look +		**  for a valid address first.  		*/ -		if (e->e_sendqueue == NULL) +		q = e->e_sendqueue; +		while (q != NULL && +		       (QS_IS_BADADDR(q->q_state) || QS_IS_DEAD(q->q_state))) +		{ +			q = q->q_next; +		} +		if (q == NULL)  			e->e_qgrp = 0; -		else if (e->e_sendqueue->q_qgrp >= 0) -			e->e_qgrp = e->e_sendqueue->q_qgrp; -		else if (e->e_sendqueue->q_mailer != NULL && -			 ISVALIDQGRP(e->e_sendqueue->q_mailer->m_qgrp)) -			e->e_qgrp = e->e_sendqueue->q_mailer->m_qgrp; +		else if (q->q_qgrp >= 0) +			e->e_qgrp = q->q_qgrp; +		else if (q->q_mailer != NULL && +			 ISVALIDQGRP(q->q_mailer->m_qgrp)) +			e->e_qgrp = q->q_mailer->m_qgrp;  		else  			e->e_qgrp = 0;  		e->e_dfqgrp = e->e_qgrp; @@ -7670,6 +7717,7 @@ split_across_queue_groups(e)  	ENVELOPE *e;  {  	int naddrs, nsplits, i; +	bool changed;  	char **pvp;  	ADDRESS *q, **addrs;  	ENVELOPE *ee, *es; @@ -7680,6 +7728,7 @@ split_across_queue_groups(e)  	/* Count addresses and assign queue groups. */  	naddrs = 0; +	changed = false;  	for (q = e->e_sendqueue; q != NULL; q = q->q_next)  	{  		if (QS_IS_DEAD(q->q_state)) @@ -7704,6 +7753,7 @@ split_across_queue_groups(e)  				if (ISVALIDQGRP(i))  				{  					q->q_qgrp = i; +					changed = true;  					if (tTd(20, 4))  						sm_syslog(LOG_INFO, NOQID,  							"queue group name %s -> %d", @@ -7717,7 +7767,10 @@ split_across_queue_groups(e)  			}  			if (q->q_mailer != NULL &&  			    ISVALIDQGRP(q->q_mailer->m_qgrp)) +			{ +				changed = true;  				q->q_qgrp = q->q_mailer->m_qgrp; +			}  			else if (ISVALIDQGRP(e->e_qgrp))  				q->q_qgrp = e->e_qgrp;  			else @@ -7726,7 +7779,7 @@ split_across_queue_groups(e)  	}  	/* only one address? nothing to split. */ -	if (naddrs <= 1) +	if (naddrs <= 1 && !changed)  		return SM_SPLIT_NONE;  	/* sort the addresses by queue group */ diff --git a/contrib/sendmail/src/readcf.c b/contrib/sendmail/src/readcf.c index 31810a2a55807..fbfdef136079a 100644 --- a/contrib/sendmail/src/readcf.c +++ b/contrib/sendmail/src/readcf.c @@ -13,7 +13,7 @@  #include <sendmail.h> -SM_RCSID("@(#)$Id: readcf.c,v 8.607 2002/06/14 16:57:32 ca Exp $") +SM_RCSID("@(#)$Id: readcf.c,v 8.607.2.2 2002/08/19 21:50:49 gshapiro Exp $")  #if NETINET || NETINET6  # include <arpa/inet.h> @@ -2039,11 +2039,11 @@ static struct optioninfo  #define O_SRVCERTFILE	0xb4  	{ "ServerCertFile",		O_SRVCERTFILE,	OI_NONE	},  #define O_SRVKEYFILE	0xb5 -	{ "Serverkeyfile",		O_SRVKEYFILE,	OI_NONE	}, +	{ "ServerKeyFile",		O_SRVKEYFILE,	OI_NONE	},  #define O_CLTCERTFILE	0xb6  	{ "ClientCertFile",		O_CLTCERTFILE,	OI_NONE	},  #define O_CLTKEYFILE	0xb7 -	{ "Clientkeyfile",		O_CLTKEYFILE,	OI_NONE	}, +	{ "ClientKeyFile",		O_CLTKEYFILE,	OI_NONE	},  #define O_CACERTFILE	0xb8  	{ "CACERTFile",			O_CACERTFILE,	OI_NONE	},  #define O_CACERTPATH	0xb9 @@ -4101,7 +4101,6 @@ settimeout(name, val, sticky)  		TimeOuts.to_q_return[TOC_NONURGENT] = toval;  		break; -  	  case TO_HOSTSTATUS:  		MciInfoTimeout = toval;  		break; diff --git a/contrib/sendmail/src/sasl.c b/contrib/sendmail/src/sasl.c index f6aa5defc49ab..b172677c51499 100644 --- a/contrib/sendmail/src/sasl.c +++ b/contrib/sendmail/src/sasl.c @@ -9,7 +9,7 @@   */  #include <sm/gen.h> -SM_RCSID("@(#)$Id: sasl.c,v 8.19 2002/06/12 15:06:12 ca Exp $") +SM_RCSID("@(#)$Id: sasl.c,v 8.19.2.1 2002/07/13 18:04:56 ca Exp $")  #if SASL  # include <stdlib.h> @@ -208,7 +208,7 @@ intersect(s1, s2, rpool)  # if SASL >= 20000  /*  **  IPTOSTRING -- create string for SASL_IP*PORT property -**                (borrowed from lib/iptostring.c in Cyrus-IMAP) +**		(borrowed from lib/iptostring.c in Cyrus-IMAP)  **  **	Parameters:  **		addr -- (pointer to) socket address diff --git a/contrib/sendmail/src/sendmail.h b/contrib/sendmail/src/sendmail.h index 544e54ea3b725..7dc34fa4903ca 100644 --- a/contrib/sendmail/src/sendmail.h +++ b/contrib/sendmail/src/sendmail.h @@ -48,7 +48,7 @@  #ifdef _DEFINE  # ifndef lint -SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.919.2.1 2002/06/21 20:25:22 ca Exp $"; +SM_UNUSED(static char SmailId[]) = "@(#)$Id: sendmail.h,v 8.919.2.4 2002/08/16 14:56:01 ca Exp $";  # endif /* ! lint */  #endif /* _DEFINE */ @@ -293,6 +293,7 @@ typedef struct address ADDRESS;  #define QS_REMOVED	12		/* removed (removefromlist()) */  #define QS_DUPLICATE	13		/* duplicate suppressed */  #define QS_INCLUDED	14		/* :include: delivery */ +#define QS_FATALERR	15		/* fatal error, don't deliver */  /* address state testing primitives */  #define QS_IS_OK(s)		((s) == QS_OK) @@ -905,34 +906,34 @@ struct envelope  };  /* values for e_flags */ -#define EF_OLDSTYLE	0x0000001L	/* use spaces (not commas) in hdrs */ -#define EF_INQUEUE	0x0000002L	/* this message is fully queued */ -#define EF_NO_BODY_RETN	0x0000004L	/* omit message body on error */ -#define EF_CLRQUEUE	0x0000008L	/* disk copy is no longer needed */ -#define EF_SENDRECEIPT	0x0000010L	/* send a return receipt */ -#define EF_FATALERRS	0x0000020L	/* fatal errors occurred */ -#define EF_DELETE_BCC	0x0000040L	/* delete Bcc: headers entirely */ -#define EF_RESPONSE	0x0000080L	/* this is an error or return receipt */ -#define EF_RESENT	0x0000100L	/* this message is being forwarded */ -#define EF_VRFYONLY	0x0000200L	/* verify only (don't expand aliases) */ -#define EF_WARNING	0x0000400L	/* warning message has been sent */ -#define EF_QUEUERUN	0x0000800L	/* this envelope is from queue */ -#define EF_GLOBALERRS	0x0001000L	/* treat errors as global */ -#define EF_PM_NOTIFY	0x0002000L	/* send return mail to postmaster */ -#define EF_METOO	0x0004000L	/* send to me too */ -#define EF_LOGSENDER	0x0008000L	/* need to log the sender */ -#define EF_NORECEIPT	0x0010000L	/* suppress all return-receipts */ -#define EF_HAS8BIT	0x0020000L	/* at least one 8-bit char in body */ -#define EF_NL_NOT_EOL	0x0040000L	/* don't accept raw NL as EOLine */ -#define EF_CRLF_NOT_EOL	0x0080000L	/* don't accept CR-LF as EOLine */ -#define EF_RET_PARAM	0x0100000L	/* RCPT command had RET argument */ -#define EF_HAS_DF	0x0200000L	/* set when data file is instantiated */ -#define EF_IS_MIME	0x0400000L	/* really is a MIME message */ -#define EF_DONT_MIME	0x0800000L	/* never MIME this message */ -#define EF_DISCARD	0x1000000L	/* discard the message */ -#define EF_TOOBIG	0x2000000L	/* message is too big */ -#define EF_SPLIT	0x4000000L	/* envelope has been split */ -#define EF_UNSAFE	0x8000000L	/* unsafe: read from untrusted source */ +#define EF_OLDSTYLE	0x00000001L	/* use spaces (not commas) in hdrs */ +#define EF_INQUEUE	0x00000002L	/* this message is fully queued */ +#define EF_NO_BODY_RETN	0x00000004L	/* omit message body on error */ +#define EF_CLRQUEUE	0x00000008L	/* disk copy is no longer needed */ +#define EF_SENDRECEIPT	0x00000010L	/* send a return receipt */ +#define EF_FATALERRS	0x00000020L	/* fatal errors occurred */ +#define EF_DELETE_BCC	0x00000040L	/* delete Bcc: headers entirely */ +#define EF_RESPONSE	0x00000080L	/* this is an error or return receipt */ +#define EF_RESENT	0x00000100L	/* this message is being forwarded */ +#define EF_VRFYONLY	0x00000200L	/* verify only (don't expand aliases) */ +#define EF_WARNING	0x00000400L	/* warning message has been sent */ +#define EF_QUEUERUN	0x00000800L	/* this envelope is from queue */ +#define EF_GLOBALERRS	0x00001000L	/* treat errors as global */ +#define EF_PM_NOTIFY	0x00002000L	/* send return mail to postmaster */ +#define EF_METOO	0x00004000L	/* send to me too */ +#define EF_LOGSENDER	0x00008000L	/* need to log the sender */ +#define EF_NORECEIPT	0x00010000L	/* suppress all return-receipts */ +#define EF_HAS8BIT	0x00020000L	/* at least one 8-bit char in body */ +#define EF_NL_NOT_EOL	0x00040000L	/* don't accept raw NL as EOLine */ +#define EF_CRLF_NOT_EOL	0x00080000L	/* don't accept CR-LF as EOLine */ +#define EF_RET_PARAM	0x00100000L	/* RCPT command had RET argument */ +#define EF_HAS_DF	0x00200000L	/* set when data file is instantiated */ +#define EF_IS_MIME	0x00400000L	/* really is a MIME message */ +#define EF_DONT_MIME	0x00800000L	/* never MIME this message */ +#define EF_DISCARD	0x01000000L	/* discard the message */ +#define EF_TOOBIG	0x02000000L	/* message is too big */ +#define EF_SPLIT	0x04000000L	/* envelope has been split */ +#define EF_UNSAFE	0x08000000L	/* unsafe: read from untrusted source */  #define DLVR_NOTIFY	0x01  #define DLVR_RETURN	0x02 @@ -1086,7 +1087,7 @@ extern int	macid_parse __P((char *, char **));  #define macid(name)  macid_parse(name, NULL)  extern char	*macname __P((int));  extern char	*macvalue __P((int, ENVELOPE *)); -extern int	rscheck __P((char *, char *, char *, ENVELOPE *, bool, bool, int, char *, char *)); +extern int	rscheck __P((char *, char *, char *, ENVELOPE *, int, int, char *, char *));  extern int	rscap __P((char *, char *, char *, ENVELOPE *, char ***, char *, int));  extern void	setclass __P((int, char *));  extern int	strtorwset __P((char *, char **, int)); @@ -1562,6 +1563,13 @@ EXTERN unsigned long	PrivacyFlags;	/* privacy flags */  #define RF_COPYALL		(RF_COPYPARSE|RF_COPYPADDR)  #define RF_COPYNONE		0 +/* +**  Flags passed to rscheck +*/ + +#define RSF_RMCOMM		0x0001	/* strip comments */  +#define RSF_UNSTRUCTURED	0x0002	/* unstructured, ignore syntax errors */ +#define RSF_COUNT		0x0004	/* count rejections (statistics)? */  /*  **  Flags passed to mime8to7 and putheader. diff --git a/contrib/sendmail/src/sfsasl.c b/contrib/sendmail/src/sfsasl.c index 53d72764f2676..dc8742913f567 100644 --- a/contrib/sendmail/src/sfsasl.c +++ b/contrib/sendmail/src/sfsasl.c @@ -9,7 +9,7 @@   */  #include <sm/gen.h> -SM_RCSID("@(#)$Id: sfsasl.c,v 8.91 2002/06/07 00:06:27 geir Exp $") +SM_RCSID("@(#)$Id: sfsasl.c,v 8.91.2.1 2002/08/27 01:35:17 ca Exp $")  #include <stdlib.h>  #include <sendmail.h>  #include <errno.h> @@ -557,9 +557,19 @@ tls_read(fp, buf, size)  */  		break;  	  case SSL_ERROR_SSL: +#if _FFR_DEAL_WITH_ERROR_SSL +		if (r == 0 && errno == 0) /* out of protocol EOF found */ +			break; +#endif /* _FFR_DEAL_WITH_ERROR_SSL */  		err = "generic SSL error";  		if (LogLevel > 9)  			tlslogerr("read"); + +#if _FFR_DEAL_WITH_ERROR_SSL +		/* avoid repeated calls? */ +		if (r == 0) +			r = -1; +#endif /* _FFR_DEAL_WITH_ERROR_SSL */  		break;  	}  	if (err != NULL) @@ -646,6 +656,12 @@ tls_write(fp, buf, size)  */  		if (LogLevel > 9)  			tlslogerr("write"); + +#if _FFR_DEAL_WITH_ERROR_SSL +		/* avoid repeated calls? */ +		if (r == 0) +			r = -1; +#endif /* _FFR_DEAL_WITH_ERROR_SSL */  		break;  	}  	if (err != NULL) diff --git a/contrib/sendmail/src/srvrsmtp.c b/contrib/sendmail/src/srvrsmtp.c index dd14ffa7b269c..8bbc02987e176 100644 --- a/contrib/sendmail/src/srvrsmtp.c +++ b/contrib/sendmail/src/srvrsmtp.c @@ -16,7 +16,7 @@  # include <libmilter/mfdef.h>  #endif /* MILTER */ -SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.829 2002/06/17 21:54:57 gshapiro Exp $") +SM_RCSID("@(#)$Id: srvrsmtp.c,v 8.829.2.4 2002/08/16 14:56:01 ca Exp $")  #if SASL || STARTTLS  # include <sys/time.h> @@ -382,9 +382,9 @@ smtp(nullserver, d_flags, e)  	char *user;  	char *in, *out2;  # if SASL >= 20000 - 	char *auth_id; +	char *auth_id;  	const char *out; - 	sasl_ssf_t ext_ssf; +	sasl_ssf_t ext_ssf;  # else /* SASL >= 20000 */  	char *out;  	const char *errstr; @@ -654,7 +654,7 @@ smtp(nullserver, d_flags, e)  			sasl_ok = ((sasl_setprop(conn, SASL_SSF_EXTERNAL,  						 &ext_ssf) == SASL_OK) &&  				   (sasl_setprop(conn, SASL_AUTH_EXTERNAL, - 						 auth_id) == SASL_OK)); +						 auth_id) == SASL_OK));  # else /* SASL >= 20000 */  			ext_ssf.ssf = 0;  			ext_ssf.auth_id = NULL; @@ -1296,7 +1296,7 @@ smtp(nullserver, d_flags, e)  				/* could this be shorter? XXX */  # if SASL >= 20000  				in = xalloc(strlen(q) + 1); -  				result = sasl_decode64(q, strlen(q), in, +				result = sasl_decode64(q, strlen(q), in,  						       strlen(q), &inlen);  # else /* SASL >= 20000 */  				in = sm_rpool_malloc(e->e_rpool, strlen(q)); @@ -1329,7 +1329,7 @@ smtp(nullserver, d_flags, e)  			/* see if that auth type exists */  # if SASL >= 20000 -  			result = sasl_server_start(conn, p, in, inlen, +			result = sasl_server_start(conn, p, in, inlen,  						   &out, &outlen);  			if (in != NULL)  				sm_free(in); @@ -1597,8 +1597,9 @@ smtp(nullserver, d_flags, e)  			QuickAbort = false;  			if (rscheck("tls_client",  				     macvalue(macid("{verify}"), e), -				     "STARTTLS", e, true, true, 5, -				     NULL, NOQID) != EX_OK || +				     "STARTTLS", e, +				     RSF_RMCOMM|RSF_COUNT, +				     5, NULL, NOQID) != EX_OK ||  			    Errors > 0)  			{  				extern char MsgBuf[]; @@ -1621,9 +1622,9 @@ smtp(nullserver, d_flags, e)  				s = macvalue(macid("{cipher_bits}"), e);  #  if SASL >= 20000  				if (s != NULL && (ext_ssf = atoi(s)) > 0) -  				{ +				{  					auth_id = macvalue(macid("{cert_subject}"), -  								   e); +								   e);  					sasl_ok = ((sasl_setprop(conn, SASL_SSF_EXTERNAL,  								 &ext_ssf) == SASL_OK) &&  						   (sasl_setprop(conn, SASL_AUTH_EXTERNAL, @@ -2133,8 +2134,8 @@ smtp(nullserver, d_flags, e)  				  e->e_from.q_paddr);  #endif /* _FFR_MAIL_MACRO */  			if (rscheck("check_mail", addr, -				    NULL, e, true, true, 3, NULL, -				    e->e_id) != EX_OK || +				    NULL, e, RSF_RMCOMM|RSF_COUNT, 3, +				    NULL, e->e_id) != EX_OK ||  			    Errors > 0)  				sm_exc_raisenew_x(&EtypeQuickAbort, 1);  			macdefine(&e->e_macro, A_PERM, @@ -2373,13 +2374,17 @@ smtp(nullserver, d_flags, e)  			macdefine(&e->e_macro, A_PERM,  				macid("{addr_type}"), "e r");  			if (rscheck("check_rcpt", addr, -				    NULL, e, true, true, 3, NULL, -				    e->e_id) != EX_OK || +				    NULL, e, RSF_RMCOMM|RSF_COUNT, 3, +				    NULL, e->e_id) != EX_OK ||  			    Errors > 0)  				goto rcpt_done;  			macdefine(&e->e_macro, A_PERM,  				macid("{addr_type}"), NULL); +			/* If discarding, don't bother to verify user */ +			if (bitset(EF_DISCARD, e->e_flags)) +				a->q_state = QS_VERIFIED; +  #if MILTER  			if (smtp.sm_milterlist && smtp.sm_milterize &&  			    !bitset(EF_DISCARD, e->e_flags)) @@ -2528,8 +2533,8 @@ smtp(nullserver, d_flags, e)  			{  				/* do config file checking of the address */  				if (rscheck(vrfy ? "check_vrfy" : "check_expn", -					    p, NULL, e, true, false, 3, NULL, -					    NOQID) != EX_OK || +					    p, NULL, e, RSF_RMCOMM, +					    3, NULL, NOQID) != EX_OK ||  				    Errors > 0)  					sm_exc_raisenew_x(&EtypeQuickAbort, 1);  				(void) sendtolist(p, NULLADDR, &vrfyqueue, 0, e); @@ -2624,8 +2629,9 @@ smtp(nullserver, d_flags, e)  			**  available to make a decision.  			*/ -			if (rscheck("check_etrn", p, NULL, e, true, false, 3, -				    NULL, NOQID) != EX_OK || Errors > 0) +			if (rscheck("check_etrn", p, NULL, e, +				    RSF_RMCOMM, 3, NULL, NOQID) != EX_OK || +			    Errors > 0)  				break;  			if (LogLevel > 5) @@ -2883,7 +2889,8 @@ smtp_data(smtp, e)  	}  	(void) sm_snprintf(buf, sizeof buf, "%u", smtp->sm_nrcpts);  	if (rscheck("check_data", buf, NULL, e, -		    true, false, 3, NULL, e->e_id) != EX_OK) +		    RSF_RMCOMM|RSF_UNSTRUCTURED|RSF_COUNT, 3, NULL, +		    e->e_id) != EX_OK)  		return;  	/* put back discard bit */ @@ -2926,8 +2933,8 @@ smtp_data(smtp, e)  #if _FFR_CHECK_EOM  	/* rscheck() will set Errors or EF_DISCARD if it trips */ -	(void) rscheck("check_eom", buf, NULL, e, false, -		       true, 3, NULL, e->e_id); +	(void) rscheck("check_eom", buf, NULL, e, RSF_UNSTRUCTURED|RSF_COUNT, +		       3, NULL, e->e_id);  #endif /* _FFR_CHECK_EOM */  #if MILTER @@ -3593,8 +3600,8 @@ mail_esmtp_args(kp, vp, e)  		SuprErrs = true;  		QuickAbort = false;  		if (strcmp(auth_param, "<>") != 0 && -		     (rscheck("trust_auth", pbuf, NULL, e, true, false, 9, -			      NULL, NOQID) != EX_OK || Errors > 0)) +		     (rscheck("trust_auth", pbuf, NULL, e, RSF_RMCOMM, +			      9, NULL, NOQID) != EX_OK || Errors > 0))  		{  			if (tTd(95, 8))  			{ diff --git a/contrib/sendmail/src/usersmtp.c b/contrib/sendmail/src/usersmtp.c index 2ec9ac49d402d..931e6b3408dcc 100644 --- a/contrib/sendmail/src/usersmtp.c +++ b/contrib/sendmail/src/usersmtp.c @@ -13,7 +13,7 @@  #include <sendmail.h> -SM_RCSID("@(#)$Id: usersmtp.c,v 8.437 2002/05/24 18:53:48 gshapiro Exp $") +SM_RCSID("@(#)$Id: usersmtp.c,v 8.437.2.5 2002/08/16 16:48:11 ca Exp $")  #include <sysexits.h> @@ -918,14 +918,14 @@ getauth(mci, e, sai)  			/* '=base64' (decode) */  # if SASL >= 20000 -  			r = sasl_decode64(pvp[i + 1] + 3, +			ret = sasl_decode64(pvp[i + 1] + 3,  					  (unsigned int) l, (*sai)[r],  					  (unsigned int) l + 1, &len);  # else /* SASL >= 20000 */ -			r = sasl_decode64(pvp[i + 1] + 3, +			ret = sasl_decode64(pvp[i + 1] + 3,  					  (unsigned int) l, (*sai)[r], &len);  # endif /* SASL >= 20000 */ -			if (r != SASL_OK) +			if (ret != SASL_OK)  				goto fail;  			got |= 1 << r;  		} @@ -938,6 +938,7 @@ getauth(mci, e, sai)  	}  	/* did we get the expected data? */ +	/* XXX: EXTERNAL mechanism only requires (and only uses) SASL_USER */  	if (!(bitset(SASL_USER_BIT|SASL_AUTHID_BIT, got) &&  	      bitset(SASL_PASSWORD_BIT, got)))  		goto fail; @@ -1571,8 +1572,8 @@ attemptauth(m, mci, e, sai)  	/* make a new client sasl connection */  # if SASL >= 20000 -  	saslresult = sasl_client_new(bitnset(M_LMTP, m->m_flags) ? "lmtp" -  								 : "smtp", +	saslresult = sasl_client_new(bitnset(M_LMTP, m->m_flags) ? "lmtp" +								 : "smtp",  				     CurHostName, NULL, NULL, NULL, 0,  				     &mci->mci_conn);  # else /* SASL >= 20000 */ @@ -1733,7 +1734,14 @@ attemptauth(m, mci, e, sai)  	(*sai)[SASL_MECH] = mechusing;  	/* send the info across the wire */ -	if (out == NULL) +	if (out == NULL +#if _FFR_SASL_INITIAL_WORKAROUND +		/* login and digest-md5 up to 1.5.28 set out="" */ +	    || (outlen == 0 && +		(sm_strcasecmp(mechusing, "LOGIN") == 0 || +		 sm_strcasecmp(mechusing, "DIGEST-MD5") == 0)) +#endif /* _FFR_SASL_INITIAL_WORKAROUND */ +	   )  	{  		/* no initial response */  		smtpmessage("AUTH %s", m, mci, mechusing); diff --git a/contrib/sendmail/src/version.c b/contrib/sendmail/src/version.c index 3600b84ef0455..882233357f83e 100644 --- a/contrib/sendmail/src/version.c +++ b/contrib/sendmail/src/version.c @@ -13,6 +13,6 @@  #include <sm/gen.h> -SM_RCSID("@(#)$Id: version.c,v 8.104.2.2 2002/06/25 22:51:53 ca Exp $") +SM_RCSID("@(#)$Id: version.c,v 8.104.2.5 2002/08/24 16:27:21 ca Exp $") -char	Version[] = "8.12.5"; +char	Version[] = "8.12.6";  | 
