diff options
Diffstat (limited to 'contrib/sendmail/mail.local')
| -rwxr-xr-x | contrib/sendmail/mail.local/Build | 513 | ||||
| -rw-r--r-- | contrib/sendmail/mail.local/Makefile.m4 | 6 | ||||
| -rw-r--r-- | contrib/sendmail/mail.local/README | 2 | ||||
| -rw-r--r-- | contrib/sendmail/mail.local/mail.local.8 | 2 | ||||
| -rw-r--r-- | contrib/sendmail/mail.local/mail.local.c | 128 | ||||
| -rw-r--r-- | contrib/sendmail/mail.local/pathnames.h | 2 | 
6 files changed, 590 insertions, 63 deletions
| diff --git a/contrib/sendmail/mail.local/Build b/contrib/sendmail/mail.local/Build new file mode 100755 index 0000000000000..ab8a49d78cac9 --- /dev/null +++ b/contrib/sendmail/mail.local/Build @@ -0,0 +1,513 @@ +#!/bin/sh + +# Copyright (c) 1998 Sendmail, Inc.  All rights reserved. +# Copyright (c) 1993, 1996-1997 Eric P. Allman.  All rights reserved. +# Copyright (c) 1993 +#	The Regents of the University of California.  All rights reserved. +# +# By using this file, you agree to the terms and conditions set +# forth in the LICENSE file which can be found at the top level of +# the sendmail distribution. +# +# +#       @(#)Build	8.93 (Berkeley) 6/24/98 +# + +# +#  A quick-and-dirty script to compile sendmail and related programs +#  in the presence of multiple architectures.  To use, just use +#  "sh Build". +# + +trap "rm -f $obj/.settings$$; exit" 1 2 3 15 + +cflag="" +mflag="" +sflag="" +makeargs="" +libdirs="" +incdirs="" +libsrch="" +siteconfig="" +EX_USAGE=64 +EX_NOINPUT=66 +EX_UNAVAILABLE=69 + +while [ ! -z "$1" ] +do +	case $1 +	in +	  -c)	# clean out existing $obj tree +		cflag=1 +		shift +		;; + +	  -m)	# show Makefile name only +		mflag=1 +		shift +		;; + +	  -E*)	# environment variables to pass into Build +		arg=`echo $1 | sed 's/^-E//'` +		if [ -z "$arg" ] +		then +		    shift   # move to argument +		    arg=$1 +		fi +		if [ -z "$arg" ] +		then +			echo "Empty -E flag" >&2 +			exit $EX_USAGE +		else +			case $arg +			in +			  *=*)	# check format +				eval $arg +				export `echo $arg | sed 's;=.*;;'` +				;; +			  *)	# bad format +				echo "Bad format for -E argument ($arg)" >&2 +				exit $EX_USAGE +				;; +			esac +			shift +		fi +		;; + +	  -L*)	# set up LIBDIRS +		libdirs="$libdirs $1" +		shift +		;; + +	  -I*)	# set up INCDIRS +		incdirs="$incdirs $1" +		shift +		;; + +	  -f*)	# select site config file +		arg=`echo $1 | sed 's/^-f//'` +		if [ -z "$arg" ] +		then +		    shift   # move to argument +		    arg=$1 +		fi +		if [ "$siteconfig" ] +		then +			echo "Only one -f flag allowed" >&2 +			exit $EX_USAGE +		else +			siteconfig=$arg +			if [ -z "$siteconfig" ] +			then +				echo "Missing argument for -f flag" >&2 +				exit $EX_USAGE +			elif [ ! -f "$siteconfig" ] +			then +				echo "${siteconfig}: File not found" +				exit $EX_NOINPUT +			else +				shift	# move past argument +			fi +		fi +		;; + +	  -S)	# skip auto-configure +		sflag="-s" +		shift +		;; + +	  *)	# pass argument to make +		makeargs="$makeargs \"$1\"" +		shift +		;; +	esac +done + +# +#  Do heuristic guesses !ONLY! for machines that do not have uname +# +if [ -d /NextApps -a ! -f /bin/uname -a ! -f /usr/bin/uname ] +then +	# probably a NeXT box +	arch=`hostinfo | sed -n 's/.*Processor type: \([^ ]*\).*/\1/p'` +	os=NeXT +	rel=`hostinfo | sed -n 's/.*NeXT Mach \([0-9\.]*\).*/\1/p'` +elif [ -f /usr/sony/bin/machine -a -f /etc/osversion ] +then +	# probably a Sony NEWS 4.x +	os=NEWS-OS +	rel=`awk '{ print $3}' /etc/osversion` +	arch=`/usr/sony/bin/machine` +elif [ -d /usr/omron -a -f /bin/luna ] +then +	# probably a Omron LUNA +	os=LUNA +	if [ -f /bin/luna1 ] && /bin/luna1 +	then +		rel=unios-b +		arch=luna1 +	elif [ -f /bin/luna2 ] && /bin/luna2 +	then +		rel=Mach +		arch=luna2 +	elif [ -f /bin/luna88k ] && /bin/luna88k +	then +		rel=Mach +		arch=luna88k +	fi +elif [ -d /usr/apollo -a -d \`node_data ] +then +	# probably a Apollo/DOMAIN +	os=DomainOS +	arch=$ISP +	rel=`/usr/apollo/bin/bldt | grep Domain | awk '{ print $4 }' | sed -e 's/,//g'` +fi + +if [ ! "$arch" -a ! "$os" -a ! "$rel" ] +then +	arch=`uname -m | sed -e 's/ //g'` +	os=`uname -s | sed -e 's/\//-/g' -e 's/ //g'` +	rel=`uname -r | sed -e 's/(/-/g' -e 's/)//g'` +fi + +# +#  Tweak the values we have already got.  PLEASE LIMIT THESE to +#  tweaks that are absolutely necessary because your system uname +#  routine doesn't return something sufficiently unique.  Don't do +#  it just because you don't like the name that is returned.  You +#  can combine the architecture name with the os name to create a +#  unique Makefile name. +# + +# tweak machine architecture +case $arch +in +  sun4*)	arch=sun4;; + +  9000/*)	arch=`echo $arch | sed -e 's/9000.//' -e 's/..$/xx/'`;; + +  DS/907000)	arch=ds90;; + +  NILE*)	arch=NILE +		os=`uname -v`;; +esac + +# tweak operating system type and release +node=`uname -n | sed -e 's/\//-/g' -e 's/ //g'` +if [ "$os" = "$node" -a "$arch" = "i386" -a "$rel" = 3.2 -a "`uname -v`" = 2 ] +then +	# old versions of SCO UNIX set uname -s the same as uname -n +	os=SCO_SV +fi +if [ "$rel" = 4.0 ] +then +	case $arch in +	  3[34]??|3[34]??,*) +		if [ -d /usr/sadm/sysadm/add-ons/WIN-TCP ] +		then +			os=NCR.MP-RAS.2.x +		elif [ -d /usr/sadm/sysadm/add-ons/inet ] +		then +			os=NCR.MP-RAS.3.x +		fi +		;; +	esac +fi + +case $os +in +  DYNIX-ptx)	os=PTX;; +  Paragon*)	os=Paragon;; +  HP-UX)	rel=`echo $rel | sed -e 's/^[^.]*\.0*//'`;; +  AIX)		rela=$rel +		rel=`uname -v` +		case $rel in +		  2)	arch="" +			;; +		  4)	if [ "$rela" = "3" ] +			then +				arch=$rela +			fi +			;; +		esac +		rel=$rel.$rela +		;; +  BSD-386)	os=BSD-OS;; +  SCO_SV)	os=SCO; rel=`uname -X | sed -n 's/Release = 3.2v//p'`;; +  UNIX_System_V) if [ "$arch" = "ds90" ] +		then +			os="UXPDS" +			rel=`uname -v | sed -e 's/\(V.*\)L.*/\1/'` +		fi;; +  SINIX-?)	os=SINIX;; +  DomainOS)	case $rel in +		  10.4*)	rel=10.4;; +		esac +		;; +esac + +# get "base part" of operating system release +rroot=`echo $rel | sed -e 's/\.[^.]*$//'` +rbase=`echo $rel | sed -e 's/\..*//'` +if [ "$rroot" = "$rbase" ] +then +	rroot=$rel +fi + +# heuristic tweaks to clean up names -- PLEASE LIMIT THESE! +if [ "$os" = "unix" ] +then +	# might be Altos System V +	case $rel +	in +	  5.3*)		os=Altos;; +	esac +elif [ -r /unix -a -r /usr/lib/libseq.a -a -r /lib/cpp ] +then +	# might be a DYNIX/ptx 2.x system, which has a broken uname +	if strings /lib/cpp | grep _SEQUENT_ > /dev/null +	then +		os=PTX +	fi +elif [ -d /usr/nec ] +then +	# NEC machine -- what is it running? +	if [ "$os" = "UNIX_System_V" ] +	then +		os=EWS-UX_V +	elif [ "$os" = "UNIX_SV" ] +	then +		os=UX4800 +	fi +elif [ "$arch" = "mips" ] +then +	case $rel +	in +	  4_*) +		if [ `uname -v` = "UMIPS" ] +		then +			os=RISCos +		fi;; +	esac +fi + +# see if there is a "user suffix" specified +if [ "${SENDMAIL_SUFFIX-}x" = "x" ] +then +	sfx="" +else +	sfx=".${SENDMAIL_SUFFIX}" +fi + +echo "Configuration: os=$os, rel=$rel, rbase=$rbase, rroot=$rroot, arch=$arch, sfx=$sfx" + + +SMROOT=${SMROOT-..} +BUILDTOOLS=${BUILDTOOLS-$SMROOT/BuildTools} +export SMROOT BUILDTOOLS + +# see if we are in a Build-able directory +if [ ! -f Makefile.m4 ]; then +	echo "Makefile.m4 not found.  Build can only be run from a source directory." +	exit $EX_UNAVAILABLE +fi + +# now try to find a reasonable object directory +if [ -r obj.$os.$rel.$arch$sfx ]; then +	obj=obj.$os.$rel.$arch$sfx +elif [ -r obj.$os.$rroot.$arch$sfx ]; then +	obj=obj.$os.$rroot.$arch$sfx +elif [ -r obj.$os.$rbase.x.$arch$sfx ]; then +	obj=obj.$os.$rbase.x.$arch$sfx +elif [ -r obj.$os.$rel$sfx ]; then +	obj=obj.$os.$rel$sfx +elif [ -r obj.$os.$rbase.x$sfx ]; then +	obj=obj.$os.$rbase.x$sfx +elif [ -r obj.$os.$arch$sfx ]; then +	obj=obj.$os.$arch$sfx +elif [ -r obj.$rel.$arch$sfx ]; then +	obj=obj.$rel.$arch$sfx +elif [ -r obj.$rbase.x.$arch$sfx ]; then +	obj=obj.$rbase.x.$arch$sfx +elif [ -r obj.$os$sfx ]; then +	obj=obj.$os$sfx +elif [ -r obj.$arch$sfx ]; then +	obj=obj.$arch$sfx +elif [ -r obj.$rel$sfx ]; then +	obj=obj.$rel$sfx +elif [ -r obj$sfx ]; then +	obj=obj$sfx +fi +if [ -z "$obj" -o "$cflag" ] +then +	if [ -n "$obj" ] +	then +		echo "Clearing out existing $obj tree" +		rm -rf $obj +	else +		# no existing obj directory -- try to create one if Makefile found +		obj=obj.$os.$rel.$arch$sfx +	fi +	if [ -r $BUILDTOOLS/OS/$os.$rel.$arch$sfx ]; then +		oscf=$os.$rel.$arch$sfx +	elif [ -r $BUILDTOOLS/OS/$os.$rel.$arch ]; then +		oscf=$os.$rel.$arch +	elif [ -r $BUILDTOOLS/OS/$os.$rroot.$arch$sfx ]; then +		oscf=$os.$rroot.$arch$sfx +	elif [ -r $BUILDTOOLS/OS/$os.$rroot.$arch ]; then +		oscf=$os.$rroot.$arch +	elif [ -r $BUILDTOOLS/OS/$os.$rbase.x.$arch$sfx ]; then +		oscf=$os.$rbase.x.$arch$sfx +	elif [ -r $BUILDTOOLS/OS/$os.$rbase.x.$arch ]; then +		oscf=$os.$rbase.x.$arch +	elif [ -r $BUILDTOOLS/OS/$os.$rel$sfx ]; then +		oscf=$os.$rel$sfx +	elif [ -r $BUILDTOOLS/OS/$os.$rel ]; then +		oscf=$os.$rel +	elif [ -r $BUILDTOOLS/OS/$os.$rroot$sfx ]; then +		oscf=$os.$rroot$sfx +	elif [ -r $BUILDTOOLS/OS/$os.$rroot ]; then +		oscf=$os.$rroot +	elif [ -r $BUILDTOOLS/OS/$os.$rbase.x$sfx ]; then +		oscf=$os.$rbase.x$sfx +	elif [ -r $BUILDTOOLS/OS/$os.$rbase.x ]; then +		oscf=$os.$rbase.x +	elif [ -r $BUILDTOOLS/OS/$os.$arch$sfx ]; then +		oscf=$os.$arch$sfx +	elif [ -r $BUILDTOOLS/OS/$os.$arch ]; then +		oscf=$os.$arch +	elif [ -r $BUILDTOOLS/OS/$rel.$arch$sfx ]; then +		oscf=$rel.$arch$sfx +	elif [ -r $BUILDTOOLS/OS/$rel.$arch ]; then +		oscf=$rel.$arch +	elif [ -r $BUILDTOOLS/OS/$rroot.$arch$sfx ]; then +		oscf=$rroot.$arch$sfx +	elif [ -r $BUILDTOOLS/OS/$rroot.$arch ]; then +		oscf=$rroot.$arch +	elif [ -r $BUILDTOOLS/OS/$rbase.x.$arch$sfx ]; then +		oscf=$rbase.x.$arch$sfx +	elif [ -r $BUILDTOOLS/OS/$rbase.x.$arch ]; then +		oscf=$rbase.x.$arch +	elif [ -r $BUILDTOOLS/OS/$os$sfx ]; then +		oscf=$os$sfx +	elif [ -r $BUILDTOOLS/OS/$os ]; then +		oscf=$os +	elif [ -r $BUILDTOOLS/OS/$arch$sfx ]; then +		oscf=$arch$sfx +	elif [ -r $BUILDTOOLS/OS/$arch ]; then +		oscf=$arch +	elif [ -r $BUILDTOOLS/OS/$rel$sfx ]; then +		oscf=$rel$sfx +	elif [ -r $BUILDTOOLS/OS/$rel ]; then +		oscf=$rel +	elif [ -r $BUILDTOOLS/OS/$rel$sfx ]; then +		oscf=$rel$sfx +	else +		echo "Cannot determine how to support $arch.$os.$rel" >&2 +		exit $EX_UNAVAILABLE +	fi +	M4=`sh $BUILDTOOLS/bin/find_m4.sh` +	ret=$? +	if [ $ret -ne 0 ] +	then +		exit $ret +	fi +	echo "Using M4=$M4" +	export M4 +	if [ "$mflag" ] +	then +		echo "Will run in virgin $obj using $BUILDTOOLS/OS/$oscf" +		exit 0 +	fi +	if [ "$ABI" ] +	then +		echo "Using ABI $ABI" +	fi +	echo "Creating $obj using $BUILDTOOLS/OS/$oscf" +	mkdir $obj +	(cd $obj; ln -s ../*.[ch158] .) +	if [ -f sendmail.hf ] +	then +		(cd $obj; ln -s ../sendmail.hf .) +	fi + +	rm -f $obj/.settings$$ +	echo 'divert(-1)' > $obj/.settings$$ +	cat $BUILDTOOLS/M4/header.m4 >> $obj/.settings$$ +	if [ "$ABI" ] +	then +		echo "define(\`confABI', \`$ABI')" >> $obj/.settings$$ +	fi +	cat $BUILDTOOLS/OS/$oscf >> $obj/.settings$$ + +	if [ -z "$siteconfig" ] +	then +		# none specified, use defaults +		if [ -f $BUILDTOOLS/Site/site.$oscf$sfx.m4 ] +		then +			siteconfig=$BUILDTOOLS/Site/site.$oscf$sfx.m4 +		elif [ -f $BUILDTOOLS/Site/site.$oscf.m4 ] +		then +			siteconfig=$BUILDTOOLS/Site/site.$oscf.m4 +		fi +		if [ -f $BUILDTOOLS/Site/site.config.m4 ] +		then +			siteconfig="$BUILDTOOLS/Site/site.config.m4 $siteconfig" +		fi +	fi +	if [ ! -z "$siteconfig" ] +	then +		echo "Including $siteconfig" +		cat $siteconfig >> $obj/.settings$$ +	fi +	if [ "$libdirs" ] +	then +		echo "define(\`confLIBDIRS', confLIBDIRS \`\`$libdirs'')" >> $obj/.settings$$ +	fi +	if [ "$incdirs" ] +	then +		echo "define(\`confINCDIRS', confINCDIRS \`\`$incdirs'')" >> $obj/.settings$$ +	fi +	echo 'divert(0)dnl' >> $obj/.settings$$ +	libdirs=`(cat $obj/.settings$$; echo "_SRIDBIL_= confLIBDIRS" ) | \ +		sed -e 's/\(.\)include/\1_include_/g' -e 's/#define/#_define_/g' | \ +		${M4} -DconfBUILDTOOLSDIR=$BUILDTOOLS - | \ +		grep "^_SRIDBIL_=" | \ +		sed -e 's/#_define_/#define/g' -e 's/_include_/include/g' -e "s/^_SRIDBIL_=//"` +	libsrch=`(cat $obj/.settings$$; echo "_HCRSBIL_= confLIBSEARCH" ) | \ +		sed -e 's/\(.\)include/\1_include_/g' -e 's/#define/#_define_/g' | \ +		${M4} -DconfBUILDTOOLSDIR=$BUILDTOOLS - | \ +		grep "^_HCRSBIL_=" | \ +		sed -e 's/#_define_/#define/g' -e 's/_include_/include/g' -e "s/^_HCRSBIL_=//"` +	echo 'divert(-1)' >> $obj/.settings$$ +	LIBDIRS="$libdirs" LIBSRCH="$libsrch" SITECONFIG="$siteconfig" sh $BUILDTOOLS/bin/configure.sh $sflag $oscf >> $obj/.settings$$ +	echo 'divert(0)dnl' >> $obj/.settings$$ +	sed -e 's/\(.\)include/\1_include_/g' -e 's/#define/#_define_/g' $obj/.settings$$ | \ +		${M4} -DconfBUILDTOOLSDIR=$BUILDTOOLS - Makefile.m4 | \ +		sed -e 's/#_define_/#define/g' -e 's/_include_/include/g' > $obj/Makefile +	if [ $? -ne 0 -o ! -s $obj/Makefile ] +	then +		echo "ERROR: ${M4} failed; You may need a newer version of M4, at least as new as System V or GNU" 1>&2 +		rm -rf $obj +		exit $EX_UNAVAILABLE +	fi +	rm -f $obj/.settings$$ +	echo "Making dependencies in $obj" +	(cd $obj; ${MAKE-make} depend) +fi + +if [ "$mflag" ] +then +	makefile=`ls -l $obj/Makefile | sed 's/.* //'` +	if [ -z "$makefile" ] +	then +		echo "ERROR: $obj exists but has no Makefile" >&2 +		exit $EX_NOINPUT +	fi +	echo "Will run in existing $obj using $makefile" +	exit 0 +fi + +echo "Making in $obj" +cd $obj +eval exec ${MAKE-make} $makeargs diff --git a/contrib/sendmail/mail.local/Makefile.m4 b/contrib/sendmail/mail.local/Makefile.m4 index bf9a155eefb12..5dc1857d3b7fa 100644 --- a/contrib/sendmail/mail.local/Makefile.m4 +++ b/contrib/sendmail/mail.local/Makefile.m4 @@ -1,7 +1,7 @@  #  #  This Makefile is designed to work on the old "make" program.  # -#	@(#)Makefile.m4	8.22	(Berkeley)	7/12/1998 +#	@(#)Makefile.m4	8.21	(Berkeley)	6/4/98  #  # C compiler @@ -34,7 +34,7 @@ LIBDIRS=confLIBDIRS  LIBS=	ifdef(`confLIBS', `confLIBS')  # location of mail.local binary (usually /usr/sbin or /usr/etc) -EBINDIR=${DESTDIR}ifdef(`confEBINDIR', `confEBINDIR', `/usr/libexec') +BINDIR=	${DESTDIR}ifdef(`confEBINDIR', `confEBINDIR', `/usr/libexec')  # additional .o files needed  OBJADD=	ifdef(`confOBJADD', `confOBJADD') @@ -91,7 +91,7 @@ install:  force-install: install-mail.local install-docs  install-mail.local: mail.local -	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} mail.local ${EBINDIR} +	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} mail.local ${BINDIR}  install-docs: mail.local.${MAN8SRC}  ifdef(`confNO_MAN_INSTALL', `dnl', diff --git a/contrib/sendmail/mail.local/README b/contrib/sendmail/mail.local/README index 5da44bbfa1cf5..a20506831c9db 100644 --- a/contrib/sendmail/mail.local/README +++ b/contrib/sendmail/mail.local/README @@ -1,4 +1,4 @@ -#       @(#)README	8.1 (Berkeley) 2/17/1998 +#       @(#)README	8.1 (Berkeley) 2/17/98  This directory contains the source files for mail.local. diff --git a/contrib/sendmail/mail.local/mail.local.8 b/contrib/sendmail/mail.local/mail.local.8 index 541a7ee102649..7aa7cdbfa826e 100644 --- a/contrib/sendmail/mail.local/mail.local.8 +++ b/contrib/sendmail/mail.local/mail.local.8 @@ -7,7 +7,7 @@  .\" the sendmail distribution.  .\"  .\" -.\"	@(#)mail.local.8	8.7 (Berkeley) 5/19/1998 +.\"	@(#)mail.local.8	8.7 (Berkeley) 5/19/98  .\"  .Dd May 19, 1998  .Dt MAIL.LOCAL 8 diff --git a/contrib/sendmail/mail.local/mail.local.c b/contrib/sendmail/mail.local/mail.local.c index 2a405c5e86b1d..2a3b07273bdb6 100644 --- a/contrib/sendmail/mail.local/mail.local.c +++ b/contrib/sendmail/mail.local/mail.local.c @@ -1,4 +1,4 @@ -/* +/*-   * Copyright (c) 1998 Sendmail, Inc.  All rights reserved.   * Copyright (c) 1990, 1993, 1994   *	The Regents of the University of California.  All rights reserved. @@ -16,7 +16,7 @@ static char copyright[] =  #endif /* not lint */  #ifndef lint -static char sccsid[] = "@(#)mail.local.c	8.83 (Berkeley) 12/17/1998"; +static char sccsid[] = "@(#)mail.local.c	8.78 (Berkeley) 5/19/98";  #endif /* not lint */  /* @@ -102,7 +102,7 @@ static char sccsid[] = "@(#)mail.local.c	8.83 (Berkeley) 12/17/1998";  # define USE_VSYSLOG	0  #endif -#if defined(NeXT) && !defined(__APPLE__) +#if defined(NeXT)  # include <libc.h>  # define _PATH_MAILDIR	"/usr/spool/mail"  # define __dead		/* empty */ @@ -216,20 +216,18 @@ extern char	*strerror __P((int));  # define S_ISREG(mode)	(((mode) & _S_IFMT) == S_IFREG)  #endif -#ifndef MAILER_DAEMON -# define MAILER_DAEMON	"MAILER-DAEMON" -#endif -  int	eval = EX_OK;			/* sysexits.h error value. */  int	lmtpmode = 0;  u_char	tTdvect[100];  void		deliver __P((int, char *, int, int));  void		e_to_sys __P((int)); +void		err __P((const char *, ...)) __dead2;  void		notifybiff __P((char *));  int		store __P((char *, int));  void		usage __P((void));  void		vwarn __P((const char *, _BSD_VA_LIST_)); +void		warn __P((const char *, ...));  void		lockmbox __P((char *));  void		unlockmbox __P((void));  void		mailerr __P((const char *, const char *, ...)); @@ -273,7 +271,7 @@ main(argc, argv)  		case 'f':  		case 'r':		/* Backward compatible. */  			if (from != NULL) { -				mailerr(NULL, "multiple -f options"); +				warn("multiple -f options");  				usage();  			}  			from = optarg; @@ -346,7 +344,7 @@ parseaddr(s)  				return NULL;  		} else {  			while ((isascii(*p) && isalnum(*p)) || -			       strchr(".-_", *p)) +			       *p == '.' || *p == '-')  				p++;  		}  		if (*p == ',' && p[1] == '@') @@ -357,8 +355,6 @@ parseaddr(s)  			return NULL;  	} -	s = p; -  	/* local-part */  	if (*p == '\"') {  		p++; @@ -398,7 +394,7 @@ parseaddr(s)  				return NULL;  		} else {  			while ((isascii(*p) && isalnum(*p)) || -			       strchr(".-_", *p)) +			       *p == '.' || *p == '-')  				p++;  		}  	} @@ -408,11 +404,6 @@ parseaddr(s)  	if (*p && *p != ' ')  		return NULL;  	len = p - s - 1; -	if (*s == '\0' || len <= 0) -	{ -		s = MAILER_DAEMON; -		len = strlen(s); -	}  	p = malloc(len + 1);  	if (p == NULL) { @@ -600,7 +591,7 @@ store(from, lmtprcpts)  	char *from;  	int lmtprcpts;  { -	FILE *fp = NULL; +	FILE *fp;  	time_t tval;  	int fd, eline;  	char line[2048]; @@ -612,8 +603,8 @@ store(from, lmtprcpts)  			printf("451 4.3.0 unable to open temporary file\r\n");  			return -1;  		} else { -			mailerr("451 4.3.0", "unable to open temporary file"); -			exit(eval); +			e_to_sys(errno); +			err("unable to open temporary file");  		}  	}  	(void)unlink(tmpbuf); @@ -628,21 +619,13 @@ store(from, lmtprcpts)  	line[0] = '\0';  	for (eline = 1; fgets(line, sizeof(line), stdin);) { -		size_t line_len = strlen(line); - -		if (line_len >= 2 && -		    line[line_len - 2] == '\r' && -		    line[line_len - 1] == '\n') { -			strcpy(line + line_len - 2, "\n"); +		if (line[strlen(line)-2] == '\r') { +			strcpy(line+strlen(line)-2, "\n");  		}  		if (lmtprcpts && line[0] == '.') { -			char *src = line + 1, *dest = line; -  			if (line[1] == '\n')  				goto lmtpdot; -			while (*src != '\0') -				*dest++ = *src++; -			*dest = '\0'; +			strcpy(line, line+1);  		}  		if (line[0] == '\n')  			eline = 1; @@ -661,10 +644,8 @@ store(from, lmtprcpts)  				fclose(fp);  				return -1;  			} else { -				mailerr("451 4.3.0", -					"temporary file write error"); -				fclose(fp); -				exit(eval); +				e_to_sys(errno); +				err("temporary file write error");  			}  		}  	} @@ -691,9 +672,8 @@ store(from, lmtprcpts)  			fclose(fp);  			return -1;  		} else { -			mailerr("451 4.3.0", "temporary file write error"); -			fclose(fp); -			exit(eval); +			e_to_sys(errno); +			err("temporary file write error");  		}  	}  	return (fd); @@ -728,13 +708,7 @@ deliver(fd, name, nobiff, nofsync)  			}  		}  		else { -			char *errcode = NULL; - -			if (eval == EX_TEMPFAIL) -				errcode = "451 4.3.0"; -			else -				errcode = "550 5.1.1"; -			mailerr(errcode, "unknown name: %s", name); +			warn("unknown name: %s", name);  		}  		return;  	} @@ -789,8 +763,7 @@ tryagain:  		if (lstat(path, &sb) < 0)  		{  			eval = EX_CANTCREAT; -			mailerr("550 5.2.0", -				"%s: lstat: file changed after open", path); +			warn("%s: lstat: file changed after open", path);  			goto err1;  		}  		else @@ -829,8 +802,7 @@ tryagain:  #endif  	    sb.st_uid != fsb.st_uid) {  		eval = EX_TEMPFAIL; -		mailerr("550 5.2.0", "%s: fstat: file changed after open", -			path); +		warn("%s: fstat: file changed after open", path);  		goto err1;  	} @@ -883,12 +855,9 @@ tryagain:  		mailerr("450 4.2.0", "%s: %s", path, strerror(errno));  err3:  		if (setreuid(0, 0) < 0) { -#if 0 -			/* already printed an error above for this recipient */  			e_to_sys(errno);  			mailerr("450 4.2.0", "setreuid(0, 0): %s",  				strerror(errno)); -#endif  		}  #ifdef DEBUG  		printf("reset euid = %d\n", geteuid()); @@ -991,6 +960,7 @@ notifybiff(msg)  		if ((sp = getservbyname("biff", "udp")) == NULL)  			return;  		if ((hp = gethostbyname("localhost")) == NULL) { +			warn("localhost: %s", strerror(errno));  			return;  		}  		addr.sin_family = hp->h_addrtype; @@ -998,18 +968,20 @@ notifybiff(msg)  		addr.sin_port = sp->s_port;  	}  	if (f < 0 && (f = socket(AF_INET, SOCK_DGRAM, 0)) == -1) { +		warn("socket: %s", strerror(errno));  		return;  	}  	len = strlen(msg) + 1; -	(void) sendto(f, msg, len, 0, (struct sockaddr *)&addr, sizeof(addr)); +	if (sendto(f, msg, len, 0, (struct sockaddr *)&addr, sizeof(addr)) +	    != len) +		warn("sendto biff: %s", strerror(errno));  }  void  usage()  {  	eval = EX_USAGE; -	mailerr(NULL, "usage: mail.local [-b] [-l] [-f from] [-s] user ..."); -	exit(eval); +	err("usage: mail.local [-b] [-l] [-f from] [-s] user ...");  }  void @@ -1031,8 +1003,7 @@ mailerr(hdr, fmt, va_alist)  #endif  	if (lmtpmode)  	{ -		if (hdr != NULL) -			printf("%s ", hdr); +		printf("%s ", hdr);  		vprintf(fmt, ap);  		printf("\r\n");  	} @@ -1043,6 +1014,49 @@ mailerr(hdr, fmt, va_alist)  	}  } +#ifdef __STDC__ +void +err(const char *fmt, ...) +#else +void +err(fmt, va_alist) +	const char *fmt; +	va_dcl +#endif +{ +	va_list ap; + +#ifdef __STDC__ +	va_start(ap, fmt); +#else +	va_start(ap); +#endif +	vwarn(fmt, ap); +	va_end(ap); + +	exit(eval); +} + +void +#ifdef __STDC__ +warn(const char *fmt, ...) +#else +warn(fmt, va_alist) +	const char *fmt; +	va_dcl +#endif +{ +	va_list ap; + +#ifdef __STDC__ +	va_start(ap, fmt); +#else +	va_start(ap); +#endif +	vwarn(fmt, ap); +	va_end(ap); +} +  void  vwarn(fmt, ap)  	const char *fmt; diff --git a/contrib/sendmail/mail.local/pathnames.h b/contrib/sendmail/mail.local/pathnames.h index 33d949e4370c1..5ec006866d85e 100644 --- a/contrib/sendmail/mail.local/pathnames.h +++ b/contrib/sendmail/mail.local/pathnames.h @@ -8,7 +8,7 @@   * the sendmail distribution.   *   * - *	@(#)pathnames.h	8.5 (Berkeley) 5/19/1998 + *	@(#)pathnames.h	8.5 (Berkeley) 5/19/98   */  #include <paths.h> | 
