+++ /dev/null
-# @(#)BSD.m4 8.3 (Berkeley) 2/9/1998
-depend: ${BEFORE}
- @mv Makefile Makefile.old
- @sed -e '/^# Do not edit or remove this line or anything below it.$$/,$$d' < Makefile.old > Makefile
- @echo "# Do not edit or remove this line or anything below it." >> Makefile
- mkdep -a -f Makefile ${COPTS} *.c
-
-# End of BSD.m4
+++ /dev/null
-# @(#)CC-M.m4 8.2 (Berkeley) 2/19/1998
-depend: ${BEFORE}
- @mv Makefile Makefile.old
- @sed -e '/^# Do not edit or remove this line or anything below it.$$/,$$d' < Makefile.old > Makefile
- @echo "# Do not edit or remove this line or anything below it." >> Makefile
- ${CC} -M ${COPTS} *.c >> Makefile
-
-# End of CC-M.m4
+++ /dev/null
-# @(#)NCR.m4 8.3 (Berkeley) 2/19/1998
-depend: ${BEFORE}
- @mv Makefile Makefile.old
- @sed -e '/^# Do not edit or remove this line or anything below it.$$/,$$d' < Makefile.old > Makefile
- @echo "# Do not edit or remove this line or anything below it." >> Makefile
- ${CC} -w0 -Hmake ${COPTS} *.c >> Makefile
-
-# End of NCR.m4
+++ /dev/null
-# @(#)Solaris.m4 8.1 (Berkeley) 3/5/1998
-depend: ${BEFORE}
- @mv Makefile Makefile.old
- @sed -e '/^# Do not edit or remove this line or anything below it.$$/,$$d' < Makefile.old > Makefile
- @echo "# Do not edit or remove this line or anything below it." >> Makefile
- ${CC} -xM ${COPTS} *.c >> Makefile
-
-# End of Solaris.m4
+++ /dev/null
-# @(#)X11.m4 8.1 (Berkeley) 4/8/1998
-depend: ${BEFORE}
- makedepend -- ${COPTS} -- *.c
-
-# End of X11.m4
+++ /dev/null
-# @(#)generic.m4 8.2 (Berkeley) 2/9/1998
-# dependencies
-# gross overkill, and yet still not quite enough....
-${OBJS}: ${SRCDIR}/sendmail.h ${SRCDIR}/conf.h
-
-# give a null "depend" list so that the startup script will work
-depend:
-# End of generic.m4
+++ /dev/null
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-# Definitions for Makefile construction for sendmail
-#
-# @(#)header.m4 8.14 (Berkeley) 5/19/1998
-#
-changecom(^A)
-undefine(`format')
-undefine(`hpux')
-ifdef(`pushdef', `',
- `errprint(`You need a newer version of M4, at least as new as
-System V or GNU')
- include(NoSuchFile)')
-define(`confABI', `')
-define(`confCC', `cc')
-define(`confSHELL', `/bin/sh')
-define(`confBEFORE', `')
-define(`confLIBDIRS', `')
-define(`confINCDIRS', `')
-define(`confLIBSEARCH', `db bind resolv 44bsd')
-define(`confSITECONFIG', `site.config')
-define(`confBUILDBIN', `../../BuildTools/bin')
-define(`PUSHDIVERT', `pushdef(`__D__', divnum)divert($1)')
-define(`POPDIVERT', `divert(__D__)popdef(`__D__')')
-define(`APPENDDEF', `define(`$1', ifdef(`$1', `$1 $2', `$2'))')
-define(`PREPENDDEF', `define(`$1', ifdef(`$1', `$2 $1', `$2'))')
+++ /dev/null
-# @(#)386BSD 8.1 (Berkeley) 1/30/1998
-define(`confENVDEF', ` -DMIME')
-define(`confLIBS', `-lutil')
-define(`confLINKS', `/usr/sbin/sendmail /usr/bin/newaliases \
- /usr/sbin/sendmail /usr/bin/mailq \
- /usr/sbin/sendmail /usr/bin/hoststat \
- /usr/sbin/sendmail /usr/bin/purgestat')
+++ /dev/null
-# @(#)A-UX 8.4 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-D_POSIX_SOURCE ')
-define(`confLIBS', `-ldbm -lposix -lUTIL')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
+++ /dev/null
-# @(#)AIX 8.6 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confENVDEF', `-D_AIX3 ')
-define(`confOPTIMIZE', `-g')
-define(`confLIBS', `-ldbm')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `system')
-define(`confSTDIR', `/etc')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `/usr/ucb/install')
+++ /dev/null
-# @(#)AIX.2 8.8 (Berkeley) 3/12/1998
-PUSHDIVERT(1)
-SMROOT= /usr/local/newmail
-POPDIVERT
-define(`confMAPDEF', `-DNIS')
-define(`confENVDEF', `-DBSD -DBSD_INCLUDES -DBSD_REMAP_SIGNAL_TO_SIGVEC \
- -D_PATH_SENDMAILCF=\"${SMROOT}/sendmail.cf\"\
- -D_PATH_SENDMAILPID=\"${SMROOT}/sendmail.pid\"')
-define(`confOPTIMIZE', `-g')
-define(`confINCDIRS', `-I/u/markw/src/db.1.85/PORT/aixrt/include -I/u/markw/src/db.1.85/PORT/aixrt -I/fs/work/src/bind/include')
-define(`confLIBS', `-lbsd /u/markw/src/db.1.85/PORT/aixrt/libdb.a /usr/local/lib/libgldavg.a /fs/work/src/bind/res/libresolv.a')
-define(`confMBINDIR', `${SMROOT}/bin')
-define(`confSBINDIR', `/usr/etc')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `system')
-define(`confSTDIR', `${SMROOT}')
-define(`confHFDIR', `${SMROOT}')
-define(`confINSTALL', `/usr/ucb/install')
+++ /dev/null
-# @(#)AIX.4.2 8.7 (Berkeley) 1/22/1999
-define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
-define(`confENVDEF', `-D_AIX4=40200 ')
-define(`confOPTIMIZE', `-O3 -qstrict')
-define(`confLIBS', `-ldbm')
-define(`confLIBSEARCH', `db resolv 44bsd')
-define(`confSTDIR', `/etc')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `/usr/ucb/install')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `system')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)AIX.4.3 8.5 (Berkeley) 8/6/1998
-define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
-define(`confENVDEF', `-D_AIX4=40300 ')
-define(`confOPTIMIZE', `-O3 -qstrict')
-define(`confCC', `/usr/bin/xlc')
-define(`confLIBS', `-ldbm')
-define(`confSTDIR', `/etc')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `/usr/ucb/install')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `system')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)AIX.4.x 8.8 (Berkeley) 8/6/1998
-define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
-define(`confENVDEF', `-D_AIX4 ')
-define(`confOPTIMIZE', `-O3 -qstrict')
-define(`confLIBS', `-ldbm')
-define(`confSTDIR', `/etc')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `/usr/ucb/install')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `system')
+++ /dev/null
-# @(#)Altos 8.6 (Berkeley) 2/19/1998
-define(`confCC', `gcc')
-define(`confENVDEF', `-DALTOS_SYSTEM_V ')
-define(`confLIBS', `-lsocket -lrpc')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)BSD-OS 8.8 (Berkeley) 6/3/1998
-define(`confMAPDEF', `-DNEWDB -DMAP_REGEX')
-define(`confENVDEF', `-DNETISO')
-define(`confLIBS', `-lutil -lkvm')
-define(`confOPTIMIZE', `-O2')
-define(`confMAN1EXT', `0')
-define(`confMAN5EXT', `0')
-define(`confMAN8EXT', `0')
+++ /dev/null
-# @(#)BSD43 8.5 (Berkeley) 3/12/1998
-define(`confBEFORE', `unistd.h stddef.h stdlib.h dirent.h sys/time.h')
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-DoldBSD43 ')
-define(`confLIBS', `-ldbm -ll')
-define(`confUBINDIR', `/usr/ucb')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-PUSHDIVERT(3)
-unistd.h stddef.h stdlib.h sys/time.h:
- cp /dev/null $@
-
-sys/time.h: sys
-
-sys:
- mkdir sys
-
-dirent.h:
- echo "#include <sys/dir.h>" > dirent.h
- echo "#define dirent direct" >> dirent.h
-POPDIVERT
+++ /dev/null
-# @(#)CLIX 8.8 (Berkeley) 3/12/1998
-define(`confCC', `gcc')
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-DCLIX ')
-define(`confINCDIRS', `-I/usr/include')
-define(`confLIBS', `-lnsl -lbsd')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `mail')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `cp')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)CRAYT3E.2.0.x 8.1 (Berkeley) 4/21/1998
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-DUNICOS ')
-define(`confOPTIMIZE', `-O')
-define(`confINSTALL', `cpset')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/bin')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', ` //usr/spool/mqueue')
-define(`confHFDIR', ` /usr/lib')
+++ /dev/null
-# @(#)CRAYTS.10.0.x 8.1 (Berkeley) 1/22/1999
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-DUNICOS ')
-define(`confOPTIMIZE', `-O')
-define(`confINSTALL', `cpset')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/bin')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', ` //usr/spool/mqueue')
-define(`confHFDIR', ` /usr/lib')
+++ /dev/null
-# @(#)CSOS 8.5 (Berkeley) 2/8/1998
-define(`confLIBS', `-lnet')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confEBINDIR', `/usr/lib')
-define(`confUBINDIR', `/usr/ucb')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
+++ /dev/null
-# @(#)ConvexOS 8.6 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNDBM -DYPCOMPAT -DNIS')
-define(`confENVDEF', `-D__STDC__ -d non_int_bit_field')
-define(`confOPTIMIZE', `-g')
-define(`confLIBS', `-lshare')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
+++ /dev/null
-# @(#)Dell 8.8 (Berkeley) 3/12/1998
-define(`confCC', `gcc')
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-D__svr4__ ')
-define(`confOPTIMIZE', `-O2')
-define(`confLIBS', `-ldbm -lsocket -lnsl -lelf')
-define(`confMBINDIR', `/usr/ucblib')
-define(`confSBINDIR', `/usr/ucblib')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/ucblib')
-define(`confSBINGRP', `mail')
-define(`confSTDIR', `/usr/ucblib')
-define(`confHFDIR', `/usr/ucblib')
-define(`confINSTALL', `/usr/ucb/install')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)DomainOS 8.6 (Berkeley) 6/24/1998
-define(`confCC', `cc -A nansi -A,systype,any -A,runtype,bsd4.3')
-define(`confBEFORE', `unistd.h dirent.h')
-define(`confMAPDEF', `-DNDBM')
-define(`confSBINDIR', `/usr/etc')
-define(`confMBINDIR', `/usr/lib')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-PUSHDIVERT(3)
-unistd.h:
- cp /dev/null unistd.h
-
-dirent.h:
- echo "#include <sys/dir.h>" > dirent.h
- echo "#define dirent direct" >> dirent.h
-POPDIVERT
+++ /dev/null
-# @(#)DomainOS.10.4 8.1 (Berkeley) 6/24/1998
-define(`confCC', `cc -A nansi -A,systype,any -A,runtype,bsd4.3')
-define(`confBEFORE', `dirent.h')
-define(`confMAPDEF', `-DNDBM')
-define(`confSBINDIR', `/usr/etc')
-define(`confMBINDIR', `/usr/lib')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-PUSHDIVERT(3)
-dirent.h:
- echo "#include <sys/dir.h>" > dirent.h
- echo "#define dirent direct" >> dirent.h
-POPDIVERT
+++ /dev/null
-# @(#)Dynix 8.7 (Berkeley) 2/26/1998
-define(`confCC', `gcc')
-define(`confOPTIMIZE', `-O -g')
-define(`confLIBS', `-lseq')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `staff # no kmem group,')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-define(`confOBJADD', `strtol.o')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)EWS-UX_V 8.6 (Berkeley) 3/12/1998
-define(`confCC', `/usr/abiccs/bin/cc -KOlimit=900')
-define(`confBEFORE', `sysexits.h ndbm.h ndbm.o')
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confENVDEF', `-Dnec_ews_svr4 ')
-define(`confLIBS', `ndbm.o -lsocket -lnsl -lelf # # with NDBM')
-define(`confMBINDIR', `/usr/ucblib')
-define(`confSBINDIR', `/usr/ucbetc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/ucblib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/var/ucblib')
-define(`confHFDIR', `/var/ucblib')
-define(`confINSTALL', `/usr/ucb/install')
-PUSHDIVERT(3)
-sysexits.h:
- echo '#ifndef _LOCAL_SYSEXITS_H_' > sysexits.h;
- echo '#define _LOCAL_SYSEXITS_H_' >> sysexits.h;
- cat /usr/abiccs/ucbinclude/sysexits.h >> sysexits.h;
- echo '#endif /* _LOCAL_SYSEXITS_H_ */' >> sysexits.h;
-# ln -s /usr/abiccs/ucbinclude/sysexits.h .
-
-ndbm.h:
- ln -s /usr/abiccs/ucbinclude/ndbm.h .
-
-ndbm.o:
- ar x /usr/abiccs/ucblib/libucb.a ndbm.o
-# ar x /usr/ucblib/libucb.a ndbm.o
-POPDIVERT
+++ /dev/null
-# @(#)FreeBSD 8.5 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNEWDB -DNIS -DMAP_REGEX')
-define(`confLIBS', `-lutil')
+++ /dev/null
-# @(#)HP-UX 8.9 (Berkeley) 3/14/1998
-define(`confCC', `cc -Aa -D_HPUX_SOURCE')
-define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
-define(`confOPTIMIZE', `+O1')
-define(`confLIBS', `-lndbm')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `mail')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
+++ /dev/null
-# @(#)HP-UX.10.x 8.10 (Berkeley) 3/21/1998
-define(`confCC', `cc -Aa -D_HPUX_SOURCE')
-define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
-define(`confENVDEF', `-DV4FS ')
-define(`confOPTIMIZE', `+O3')
-define(`confLIBS', `-lndbm')
-define(`confSHELL', `/usr/bin/sh')
-define(`confSTDIR', `/etc/mail')
-define(`confHFDIR', `/usr/share/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confSBINGRP', `mail')
+++ /dev/null
-# @(#)HP-UX.11.x 8.7 (Berkeley) 3/30/1998
-define(`confCC', `cc -Ae')
-define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
-define(`confENVDEF', `-DV4FS -DHPUX11 ')
-define(`confOPTIMIZE', `+O3')
-define(`confLIBS', `-ldbm -lnsl')
-define(`confSHELL', `/usr/bin/sh')
-define(`confSTDIR', `/etc/mail')
-define(`confHFDIR', `/usr/share/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confSBINGRP', `mail')
+++ /dev/null
-# @(#)IRIX 8.7 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confENVDEF', `-DIRIX ')
-define(`confLIBS', `-lmld -lmalloc -lsun')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/bsd')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)IRIX.5.x 8.7 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confENVDEF', `-DIRIX5 ')
-define(`confLIBS', `-lmld -lmalloc')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/bsd')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/var')
-define(`confHFDIR', `/etc')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)IRIX.6.5 8.2 (Berkeley) 4/24/1998
-PUSHDIVERT(1)
-# Select what ABI we are using -- see abi(5) for details
-# -32 ~ IRIX 5.3 (default: -mips2)
-# - long and pointer are 32 bit
-# -n32 New to IRIX 6.2 (default: -mips3)
-# - long and pointer are 32 bit
-# -64 ~ IRIX 6.1 (default: -mips4)
-# - long and pointer are 64 bit
-# We force ABI here, so then it does not depend on CPU
-#
-# With IDO 6.2 (IRIX 6.2) you need subsystem compiler_dev.sw32.lib
-# for compilation with ABI=-n32 -- alternatively you can set ABI=-32
-# ABI=-64 requires subsystem compiler_dev.sw64.lib, but this runs
-# only with IRIX64 (ie. 64 bit kernels)
-#
-# NOTE: Do not set `confABI' in a site configuration file! The ABI MUST
-# be given on the Build command line using the -E parameter, e.g.:
-#
-# Build -E ABI=-n32
-#
-ABI= confABI
-POPDIVERT
-define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
-define(`confENVDEF', `-DIRIX6 -DHASSNPRINTF=1 ${ABI} ')
-define(`confLDOPTS', `${ABI}')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/bsd')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/var')
-define(`confHFDIR', `/etc')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)IRIX.6.x 8.11 (Berkeley) 4/24/1998
-PUSHDIVERT(1)
-# Select what ABI we are using -- see abi(5) for details
-# -32 ~ IRIX 5.3 (default: -mips2)
-# - long and pointer are 32 bit
-# -n32 New to IRIX 6.2 (default: -mips3)
-# - long and pointer are 32 bit
-# -64 ~ IRIX 6.1 (default: -mips4)
-# - long and pointer are 64 bit
-# We force ABI here, so then it does not depend on CPU
-#
-# With IDO 6.2 (IRIX 6.2) you need subsystem compiler_dev.sw32.lib
-# for compilation with ABI=-n32 -- alternatively you can set ABI=-32
-# ABI=-64 requires subsystem compiler_dev.sw64.lib, but this runs
-# only with IRIX64 (ie. 64 bit kernels)
-#
-# NOTE: Do not set `confABI' in a site configuration file! The ABI MUST
-# be given on the Build command line using the -E parameter, e.g.:
-#
-# Build -E ABI=-n32
-#
-ABI= confABI
-POPDIVERT
-define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
-define(`confENVDEF', `-DIRIX6 ${ABI} ')
-define(`confLDOPTS', `${ABI}')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/bsd')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/var')
-define(`confHFDIR', `/etc')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)IRIX64.6.0 8.10 (Berkeley) 3/12/1998
-PUSHDIVERT(1)
-# Select what ABI we are using -- see abi(5) for details
-# -32 ~ IRIX 5.3 (default: -mips2)
-# - long and pointer are 32 bit
-# -64 ~ IRIX 6.1 (default: -mips4)
-# - long and pointer are 64 bit
-# We force ABI here, so then it does not depend on CPU
-#
-# With IDO 6.2 (IRIX 6.2) you need subsystem compiler_dev.sw32.lib
-# for compilation with ABI=-n32 -- alternatively you can set ABI=-32
-# ABI=-64 requires subsystem compiler_dev.sw64.lib, but this runs
-# only with IRIX64 (ie. 64 bit kernels)
-#
-# NOTE: Do not set `confABI' in a site configuration file! The ABI MUST
-# be given on the Build command line using the -E parameter, e.g.:
-#
-# Build -E ABI=-32
-#
-ABI= confABI
-POPDIVERT
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-DIRIX64 ${ABI} ')
-define(`confLDOPTS', `${ABI}')
-define(`confLIBS', `-lelf -lmalloc')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/bsd')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)IRIX64.6.1 8.10 (Berkeley) 3/12/1998
-PUSHDIVERT(1)
-# Select what ABI we are using -- see abi(5) for details
-# -32 ~ IRIX 5.3 (default: -mips2)
-# - long and pointer are 32 bit
-# -64 ~ IRIX 6.1 (default: -mips4)
-# - long and pointer are 64 bit
-# We force ABI here, so then it does not depend on CPU
-#
-# With IDO 6.2 (IRIX 6.2) you need subsystem compiler_dev.sw32.lib
-# for compilation with ABI=-n32 -- alternatively you can set ABI=-32
-# ABI=-64 requires subsystem compiler_dev.sw64.lib, but this runs
-# only with IRIX64 (ie. 64 bit kernels)
-#
-# NOTE: Do not set `confABI' in a site configuration file! The ABI MUST
-# be given on the Build command line using the -E parameter, e.g.:
-#
-# Build -E ABI=-32
-#
-ABI= confABI
-POPDIVERT
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-DIRIX64 ${ABI} ')
-define(`confLDOPTS', `${ABI}')
-define(`confLIBS', `-lelf -lmalloc')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/bsd')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)IRIX64.6.5 8.1 (Berkeley) 11/29/1998
-PUSHDIVERT(1)
-# Select what ABI we are using -- see abi(5) for details
-# -32 ~ IRIX 5.3 (default: -mips2)
-# - long and pointer are 32 bit
-# -n32 New to IRIX 6.2 (default: -mips3)
-# - long and pointer are 32 bit
-# -64 ~ IRIX 6.1 (default: -mips4)
-# - long and pointer are 64 bit
-# We force ABI here, so then it does not depend on CPU
-#
-# With IDO 6.2 (IRIX 6.2) you need subsystem compiler_dev.sw32.lib
-# for compilation with ABI=-n32 -- alternatively you can set ABI=-32
-# ABI=-64 requires subsystem compiler_dev.sw64.lib, but this runs
-# only with IRIX64 (ie. 64 bit kernels)
-#
-# NOTE: Do not set `confABI' in a site configuration file! The ABI MUST
-# be given on the Build command line using the -E parameter, e.g.:
-#
-# Build -E ABI=-n32
-#
-ABI= confABI
-POPDIVERT
-define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
-define(`confENVDEF', `-DIRIX6 -DHASSNPRINTF=1 ${ABI} ')
-define(`confLDOPTS', `${ABI}')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/bsd')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/var')
-define(`confHFDIR', `/etc')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)IRIX64.6.x 8.11 (Berkeley) 4/24/1998
-PUSHDIVERT(1)
-# Select what ABI we are using -- see abi(5) for details
-# -32 ~ IRIX 5.3 (default: -mips2)
-# - long and pointer are 32 bit
-# -n32 New to IRIX 6.2 (default: -mips3)
-# - long and pointer are 32 bit
-# -64 ~ IRIX 6.1 (default: -mips4)
-# - long and pointer are 64 bit
-# We force ABI here, so then it does not depend on CPU
-#
-# With IDO 6.2 (IRIX 6.2) you need subsystem compiler_dev.sw32.lib
-# for compilation with ABI=-n32 -- alternatively you can set ABI=-32
-# ABI=-64 requires subsystem compiler_dev.sw64.lib, but this runs
-# only with IRIX64 (ie. 64 bit kernels)
-#
-# NOTE: Do not set `confABI' in a site configuration file! The ABI MUST
-# be given on the Build command line using the -E parameter, e.g.:
-#
-# Build -E ABI=-n32
-#
-ABI= confABI
-POPDIVERT
-define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
-define(`confENVDEF', `-DIRIX6 ${ABI} ')
-define(`confLDOPTS', `${ABI}')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/bsd')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/var')
-define(`confHFDIR', `/etc')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)ISC 8.5 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confENVDEF', `-DISC_UNIX -D_POSIX_SOURCE -D_SYSV3 ')
-define(`confLIBS', `-lyp -lrpc -lndbm -linet -lcposix')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/usr/spool/log')
-define(`confHFDIR', `/usr/lib')
+++ /dev/null
-# @(#)KSR 8.4 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confLIBDIRS', `-L/usr/shlib -L/usr/lib')
-define(`confLIBS', `-ldbm')
-define(`confSTDIR', `/var/adm/sendmail')
-define(`confHFDIR', `/usr/share/lib')
-define(`confINSTALL', `installbsd')
+++ /dev/null
-# @(#)LUNA 8.8 (Berkeley) 3/12/1998
-define(`confBEFORE', `dirent.h stddef.h stdlib.h unistd.h limits.h time.h sys/time.h')
-define(`confMAPDEF', `-DNDBM')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-PUSHDIVERT(3)
-dirent.h:
- echo "#include <sys/dir.h>" > dirent.h
- echo "#define dirent direct" >> dirent.h
-
-stddef.h unistd.h limits.h:
- if [ -f /usr/include/$@ ]; then \
- ln -s /usr/include/$@ .; \
- else \
- cp /dev/null $@; \
- fi
-
-stdlib.h:
- if [ -f /usr/include/stdlib.h ]; then \
- ln -s /usr/include/stdlib.h .; \
- else \
- if [ -f /usr/include/libc.h ]; then \
- ln -s /usr/include/libc.h stdlib.h; \
- else \
- cp /dev/null stdlib.h; \
- fi; \
- fi
-
-# just for UNIOS-B
-time.h:
- echo "#ifndef _LOCAL_TIME_H_" > time.h
- echo "#define _LOCAL_TIME_H_" >> time.h
- cat /usr/include/time.h >> time.h
- echo "#endif" >> time.h
-
-sys/time.h:
- -mkdir sys
- echo "#ifndef _LOCAL_SYS_TIME_H_" > sys/time.h
- echo "#define _LOCAL_SYS_TIME_H_" >> sys/time.h
- cat /usr/include/sys/time.h >> sys/time.h
- echo "#endif" >> sys/time.h
-POPDIVERT
+++ /dev/null
-# @(#)Linux 8.4 (Berkeley) 3/22/1998
-define(`confSTDIR', `/etc')
-define(`confHFDIR', `/usr/lib')
-define(`confDEPEND_TYPE', `CC-M')
-define(`confMANROOT', `/usr/man/man')
+++ /dev/null
-# @(#)Linux.ppc 8.3 (Berkeley) 2/12/1998
-define(`confHFDIR', `/usr/lib')
-define(`confSBINGRP', `mail')
+++ /dev/null
-# @(#)Mach386 8.6 (Berkeley) 3/12/1998
-define(`confCC', `gcc')
-define(`confMAPDEF', `-DNDBM')
-define(`confLIBS', `-ldbm')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)NCR.MP-RAS.2.x 8.9 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-DNCR_MP_RAS2 ')
-define(`confOPTIMIZE', `-O2')
-define(`confINCDIRS', `-I/usr/include -I/usr/ucbinclude')
-define(`confLIBDIRS', `-L/usr/ucblib')
-define(`confLIBS', `-lnsl -lnet -lsocket -lelf -lc -lucb')
-define(`confMBINDIR', `/usr/ucblib')
-define(`confSBINDIR', `/usr/ucbetc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/ucblib')
-define(`confSTDIR', `/var/ucblib')
-define(`confHFDIR', `/usr/ucblib')
-define(`confINSTALL', `/usr/ucb/install')
-define(`confDEPEND_TYPE', `NCR')
+++ /dev/null
-# @(#)NCR.MP-RAS.3.x 8.10 (Berkeley) 8/6/1998
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-DNCR_MP_RAS3 ')
-define(`confOPTIMIZE', `-O2')
-define(`confINCDIRS', `-I/usr/include -I/usr/ucbinclude')
-define(`confLIBDIRS', `-L/usr/ucblib')
-define(`confLIBS', `-lresolv -lsocket -lnsl -lelf -lc -lucb')
-define(`confMBINDIR', `/usr/ucblib')
-define(`confSBINDIR', `/usr/ucbetc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/ucblib')
-define(`confSTDIR', `/var/ucblib')
-define(`confHFDIR', `/usr/ucblib')
-define(`confINSTALL', `/usr/ucb/install')
-define(`confDEPEND_TYPE', `NCR')
+++ /dev/null
-# @(#)NEWS-OS.4.x 8.6 (Berkeley) 3/12/1998
-define(`confBEFORE', `limits.h')
-define(`confMAPDEF', `-DNDBM')
-define(`confLIBS', `-lmld')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-PUSHDIVERT(3)
-limits.h:
- touch limits.h
-POPDIVERT
+++ /dev/null
-# @(#)NEWS-OS.6.x 8.8 (Berkeley) 3/12/1998
-define(`confCC', `/bin/cc')
-define(`confBEFORE', `sysexits.h ndbm.o')
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confENVDEF', `-DSYSLOG_BUFSIZE=256 # -DSPT_TYPE=SPT_NONE ')
-define(`confLIBS', `ndbm.o -lelf -lsocket -lnsl # # with NDBM')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/etc')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `/usr/ucb/install')
-PUSHDIVERT(3)
-sysexits.h:
- ln -s /usr/ucbinclude/sysexits.h .
-
-ndbm.o:
- if [ ! -f /usr/include/ndbm.h ]; then \
- ln -s /usr/ucbinclude/ndbm.h .; \
- fi; \
- if [ -f /usr/lib/libndbm.a ]; then \
- ar x /usr/lib/libndbm.a ndbm.o; \
- else \
- ar x /usr/ucblib/libucb.a ndbm.o; \
- fi;
-POPDIVERT
+++ /dev/null
-# @(#)NEXTSTEP.4.x 8.1 (Berkeley) 3/21/1998
-PUSHDIVERT(1)
-# NEXTSTEP 3.1 and 3.2 only support m68k and i386
-#ARCH= -arch m68k -arch i386 -arch hppa -arch sparc
-#ARCH= -arch m68k -arch i386
-#ARCH= ${RC_CFLAGS}
-# For new sendmail Makefile structure, this must go in the ENVDEF and LDOPTS
-POPDIVERT
-define(`confBEFORE', `unistd.h dirent.h')
-define(`confMAPDEF', `-DNDBM -DNIS -DNETINFO')
-define(`confENVDEF', `-DNeXT -Wno-precomp -pipe ${RC_CFLAGS}')
-define(`confLDOPTS', `${RC_CFLAGS}')
-define(`confLIBS', `-ldbm')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/etc/sendmail')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-PUSHDIVERT(3)
-unistd.h:
- cp /dev/null unistd.h
-
-dirent.h:
- echo "#include <sys/dir.h>" > dirent.h
- echo "#define dirent direct" >> dirent.h
-POPDIVERT
+++ /dev/null
-# @(#)NeXT.2.x 8.7 (Berkeley) 3/12/1998
-define(`confBEFORE', `unistd.h dirent.h')
-define(`confMAPDEF', `-DNDBM -DNIS -DNETINFO')
-define(`confENVDEF', `-DNeXT ')
-define(`confLIBS', `-ldbm')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/etc/sendmail')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-PUSHDIVERT(3)
-unistd.h:
- cp /dev/null unistd.h
-
-dirent.h:
- echo "#include <sys/dir.h>" > dirent.h
- echo "#define dirent direct" >> dirent.h
-POPDIVERT
+++ /dev/null
-# @(#)NeXT.3.x 8.7 (Berkeley) 3/12/1998
-PUSHDIVERT(1)
-# NEXTSTEP 3.1 and 3.2 only support m68k and i386
-#ARCH= -arch m68k -arch i386 -arch hppa -arch sparc
-#ARCH= -arch m68k -arch i386
-#ARCH= ${RC_CFLAGS}
-# For new sendmail Makefile structure, this must go in the ENVDEF and LDOPTS
-POPDIVERT
-define(`confBEFORE', `unistd.h dirent.h')
-define(`confMAPDEF', `-DNDBM -DNIS -DNETINFO')
-define(`confENVDEF', `-DNeXT -Wno-precomp -pipe ${RC_CFLAGS}')
-define(`confLDOPTS', `${RC_CFLAGS}')
-define(`confLIBS', `-ldbm')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/etc/sendmail')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-PUSHDIVERT(3)
-unistd.h:
- cp /dev/null unistd.h
-
-dirent.h:
- echo "#include <sys/dir.h>" > dirent.h
- echo "#define dirent direct" >> dirent.h
-POPDIVERT
+++ /dev/null
-# @(#)NeXT.4.x 8.9 (Berkeley) 7/15/1998
-PUSHDIVERT(1)
-# NEXTSTEP 3.1 and 3.2 only support m68k and i386
-#ARCH= -arch m68k -arch i386 -arch hppa -arch sparc
-#ARCH= -arch m68k -arch i386
-#ARCH= ${RC_CFLAGS}
-# For new sendmail Makefile structure, this must go in the ENVDEF and LDOPTS
-POPDIVERT
-define(`confBEFORE', `unistd.h dirent.h')
-define(`confMAPDEF', `-DNDBM -DNIS -DNETINFO')
-define(`confENVDEF', `-DNeXT -Wno-precomp -pipe ${RC_CFLAGS}')
-define(`confLDOPTS', `${RC_CFLAGS}')
-define(`confLIBS', `-ldbm')
-define(`confMANROOT', `/usr/man/cat')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/etc/sendmail')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-PUSHDIVERT(3)
-unistd.h:
- cp /dev/null unistd.h
-
-dirent.h:
- echo "#include <sys/dir.h>" > dirent.h
- echo "#define dirent direct" >> dirent.h
-POPDIVERT
+++ /dev/null
-# @(#)NetBSD 8.6 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNEWDB -DNIS -DMAP_REGEX')
-define(`confENVDEF', ` -DNETISO')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)NetBSD.8.3 8.6 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNEWDB -DNIS -DMAP_REGEX')
-define(`confENVDEF', ` # -DNETISO')
+++ /dev/null
-# @(#)NonStop-UX 8.8 (Berkeley) 3/12/1998
-define(`confCC', `gcc')
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-DNonStop_UX_BXX -D_SVID ')
-define(`confINCDIRS', `-I/usr/include -I/usr/ucbinclude')
-define(`confLIBDIRS', `-L/usr/ucblib')
-define(`confLIBS', `-lsocket -lnsl -lelf -lucb')
-define(`confMBINDIR', `/usr/ucblib')
-define(`confSBINDIR', `/usr/ucbetc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/ucblib')
-define(`confSBINGRP', `mail')
-define(`confSTDIR', `/usr/ucblib')
-define(`confHFDIR', `/usr/ucblib')
-define(`confINSTALL', `/usr/ucb/install')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)OSF1 8.7 (Berkeley) 3/14/1998
-define(`confCC', `cc -Olimit 1000')
-define(`confMAPDEF', `-DNDBM -DNIS -DMAP_REGEX')
-define(`confLIBS', `-ldbm')
-define(`confSTDIR', `/var/adm/sendmail')
-define(`confHFDIR', `/usr/share/lib')
-define(`confINSTALL', `installbsd')
-define(`confUBINDIR', `${BINDIR}')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)OpenBSD 8.5 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNEWDB -DNIS -DMAP_REGEX')
-define(`confENVDEF', ` -DNETISO')
+++ /dev/null
-# @(#)PTX 8.6 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNDBM')
-define(`confOPTIMIZE', `-g')
-define(`confLIBS', `-lsocket -linet -lelf -lnsl -lseq')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
+++ /dev/null
-# @(#)Paragon 8.3 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNDBM')
-define(`confLIBDIRS', `-L/usr/shlib -L/usr/lib')
-define(`confLIBS', `-ldbm')
-define(`confSTDIR', `/var/adm/sendmail')
-define(`confHFDIR', `/usr/share/lib')
-define(`confINSTALL', `installbsd')
-define(`confUBINDIR', `${BINDIR}')
+++ /dev/null
-# @(#)PowerUX 8.5 (Berkeley) 2/12/1998
-define(`confENVDEF', `-D__svr4__ ')
-define(`confLIBS', `-Bstatic -lsocket -lnsl -lelf -lgen')
-define(`confMBINDIR', `/usr/local/etc')
-define(`confSBINDIR', `/usr/local/etc')
-define(`confUBINDIR', `/usr/local/bin')
-define(`confEBINDIR', `/usr/local/lib')
-define(`confSBINGRP', `mail')
-define(`confINSTALL', `/usr/ucb/install')
+++ /dev/null
-# @(#)QNX 8.4 (Berkeley) 2/19/1998
-PUSHDIVERT(1)
-#
-# For this Makefile to work you must compile and install the libdb package
-# and then change DBMINC and DBMLIB as appropriate.
-#
-DBMINC= /usr/local/include
-DBMLIB= /usr/local/lib
-POPDIVERT
-define(`confENVDEF', `-Osax -w4 -zc -fr= -D__BIT_TYPES_DEFINED__')
-define(`confINCDIRS', `${DBMINC}')
-define(`confLIBDIRS', `${DBMLIB}')
-define(`confLIBS', `-lsocket')
-define(`confLDOPTS', `-M -N256k')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
+++ /dev/null
-# @(#)RISCos 8.5 (Berkeley) 3/12/1998
-define(`confCC', `cc -systype bsd43 -Olimit 900')
-define(`confBEFORE', `stdlib.h dirent.h unistd.h stddef.h')
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-DRISCOS ')
-define(`confLIBS', `-lmld')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/etc')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `/usr/bsd43/bin/install')
-PUSHDIVERT(3)
-stdlib.h stddef.h:
- cp /dev/null $@
-
-unistd.h:
- echo "typedef unsigned short mode_t;" > unistd.h
-
-dirent.h:
- echo "#include <sys/dir.h>" > dirent.h
- echo "#define dirent direct" >> dirent.h
-POPDIVERT
+++ /dev/null
-# @(#)RISCos.4_0 8.6 (Berkeley) 3/12/1998
-define(`confCC', `cc -systype bsd43 -Olimit 900')
-define(`confBEFORE', `stdlib.h dirent.h unistd.h stddef.h')
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-DRISCOS -DRISCOS_4_0 ')
-define(`confLIBS', `-lmld')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-PUSHDIVERT(3)
-stdlib.h stddef.h:
- cp /dev/null $@
-
-unistd.h:
- echo "typedef unsigned short mode_t;" > unistd.h
-
-dirent.h:
- echo "#include <sys/dir.h>" > dirent.h
- echo "#define dirent direct" >> dirent.h
-POPDIVERT
+++ /dev/null
-# @(#)ReliantUNIX 8.1 (Berkeley) 1/22/1999
-define(`confCC', `/usr/bin/cc')
-define(`confENVDEF', `-D__svr4__ ')
-define(`confLIBS', `-lsocket -lnsl -lelf')
-define(`confMBINDIR', `/usr/ucblib')
-define(`confSBINDIR', `/usr/ucbetc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/ucblib')
-define(`confSBINGRP', `mail')
-define(`confSTDIR', `/usr/ucblib')
-define(`confHFDIR', `/usr/ucblib')
-define(`confINSTALL', `/usr/ucb/install')
+++ /dev/null
-# @(#)Rhapsody 8.1 (Berkeley) 11/7/1998
-#
-# Wilfredo Sanchez <wsanchez@apple.com>:
-# We look a lot more like 4.4BSD than NeXTStep or OpenStep.
-#
-define(`confMAPDEF', `-DNEWDB -DNIS -DMAP_REGEX -DNETINFO -DAUTO_NETINFO_ALIASES -DAUTO_NETINFO_HOSTS')
-define(`confENVDEF', `-DNETISO -traditional-cpp -pipe ${Extra_CC_Flags}')
-define(`confLDOPTS', `${Extra_LD_Flags}')
-define(`confOPTIMIZE', `-O3')
-define(`confHFDIR', `/usr/share/sendmail')
-define(`confMANOWN', `root')
-define(`confMANGRP', `wheel')
-define(`confUBINOWN', `root')
-define(`confUBINGRP', `wheel')
-define(`confSBINOWN', `root')
-define(`confSBINGRP', `wheel')
+++ /dev/null
-# @(#)SCO 8.3 (Berkeley) 2/8/1998
-define(`confENVDEF', `-D_SCO_unix_ ')
-define(`confLIBS', `-lsocket -lprot_s -lx -lc_s')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
+++ /dev/null
-# @(#)SCO.4.2 8.5 (Berkeley) 6/30/1998
-define(`confENVDEF', `-D_SCO_unix_4_2 ')
-define(`confLIBS', `-lsocket -lndbm -lprot_s -lx -lc_s')
-define(`confMAPDEF', `-DNDBM')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `bin')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
+++ /dev/null
-# @(#)SCO.5.x 8.10 (Berkeley) 6/30/1998
-define(`confCC', `cc -b elf')
-define(`confLIBS', `-lsocket -lndbm -lprot -lcurses -lm -lx -lgen')
-define(`confMAPDEF', `-DMAP_REGEX -DNDBM')
-define(`confSBINGRP', `bin')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/bin')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
+++ /dev/null
-# @(#)SINIX 8.5 (Berkeley) 2/12/1998
-define(`confCC', `/usr/bin/cc')
-define(`confENVDEF', `-D__svr4__ ')
-define(`confLIBS', `-lsocket -lnsl -lelf')
-define(`confMBINDIR', `/usr/ucblib')
-define(`confSBINDIR', `/usr/ucbetc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/ucblib')
-define(`confSBINGRP', `mail')
-define(`confSTDIR', `/usr/ucblib')
-define(`confHFDIR', `/usr/ucblib')
-define(`confINSTALL', `/usr/ucb/install')
+++ /dev/null
-# @(#)SVR4 8.6 (Berkeley) 3/12/1998
-define(`confCC', `gcc')
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-D__svr4__ ')
-define(`confLIBS', `-ldbm -lsocket -lnsl -lelf')
-define(`confMBINDIR', `/usr/ucblib')
-define(`confSBINDIR', `/usr/ucbetc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/ucblib')
-define(`confSBINGRP', `mail')
-define(`confSTDIR', `/usr/ucblib')
-define(`confHFDIR', `/usr/ucblib')
-define(`confINSTALL', `/usr/ucb/install')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)SunOS 8.6 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confLDOPTS', `-Bstatic')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/etc')
-define(`confHFDIR', `/usr/lib')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)SunOS.4.0 8.6 (Berkeley) 3/12/1998
-define(`confBEFORE', `stdlib.h stddef.h limits.h')
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confENVDEF', `-DSUNOS403 ')
-define(`confLDOPTS', `-Bstatic')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', `/etc')
-define(`confHFDIR', `/usr/lib')
-PUSHDIVERT(3)
-stddef.h stdlib.h limits.h:
- cp /dev/null $@
-POPDIVERT
+++ /dev/null
-# @(#)SunOS.5.1 8.8 (Berkeley) 3/21/1998
-define(`confCC', `gcc')
-define(`confBEFORE', `sysexits.h')
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confENVDEF', `-DSOLARIS=20100 ')
-define(`confLIBS', `-lsocket -lnsl -lelf')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/etc/mail')
-define(`confHFDIR', `/etc/mail')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
-PUSHDIVERT(3)
-sysexits.h:
- if [ -r /usr/ucbinclude/sysexits.h ]; \
- then \
- ln -s /usr/ucbinclude/sysexits.h; \
- fi
-POPDIVERT
+++ /dev/null
-# @(#)SunOS.5.2 8.8 (Berkeley) 3/21/1998
-define(`confCC', `gcc')
-define(`confBEFORE', `sysexits.h')
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confENVDEF', `-DSOLARIS=20100 ')
-define(`confLIBS', `-lsocket -lnsl -lelf')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/etc/mail')
-define(`confHFDIR', `/etc/mail')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
-PUSHDIVERT(3)
-sysexits.h:
- if [ -r /usr/ucbinclude/sysexits.h ]; \
- then \
- ln -s /usr/ucbinclude/sysexits.h; \
- fi
-POPDIVERT
+++ /dev/null
-# @(#)SunOS.5.3 8.8 (Berkeley) 3/21/1998
-define(`confCC', `gcc')
-define(`confBEFORE', `sysexits.h')
-define(`confMAPDEF', `-DNDBM -DNIS -DNISPLUS')
-define(`confENVDEF', `-DSOLARIS=20300 ')
-define(`confLIBS', `-lsocket -lnsl -lelf')
-define(`confMBINDIR', `/usr/lib')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/etc/mail')
-define(`confHFDIR', `/etc/mail')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
-PUSHDIVERT(3)
-sysexits.h:
- if [ -r /usr/ucbinclude/sysexits.h ]; \
- then \
- ln -s /usr/ucbinclude/sysexits.h; \
- fi
-POPDIVERT
+++ /dev/null
-# @(#)SunOS.5.4 8.10 (Berkeley) 3/21/1998
-define(`confCC', `gcc')
-define(`confBEFORE', `sysexits.h')
-define(`confMAPDEF', `-DNDBM -DNIS -DNISPLUS')
-define(`confENVDEF', `-DSOLARIS=20400 ')
-define(`confLIBS', `-lsocket -lnsl -lelf')
-define(`confMBINDIR', `/usr/lib')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/etc/mail')
-define(`confHFDIR', `/etc/mail')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
-PUSHDIVERT(3)
-sysexits.h:
- if [ -r /usr/include/sysexits.h ]; \
- then \
- ln -s /usr/include/sysexits.h; \
- fi
-POPDIVERT
+++ /dev/null
-# @(#)SunOS.5.5 8.11 (Berkeley) 3/21/1998
-define(`confCC', `gcc')
-define(`confBEFORE', `sysexits.h')
-define(`confMAPDEF', `-DNDBM -DNIS -DNISPLUS -DMAP_REGEX')
-define(`confENVDEF', `-DSOLARIS=20500 ')
-define(`confLIBS', `-lsocket -lnsl -lkstat')
-define(`confMBINDIR', `/usr/lib')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/etc/mail')
-define(`confHFDIR', `/etc/mail')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
-PUSHDIVERT(3)
-sysexits.h:
- if [ -r /usr/include/sysexits.h ]; \
- then \
- ln -s /usr/include/sysexits.h; \
- fi
-POPDIVERT
+++ /dev/null
-# @(#)SunOS.5.6 8.10 (Berkeley) 3/21/1998
-define(`confCC', `gcc')
-define(`confBEFORE', `sysexits.h')
-define(`confMAPDEF', `-DNDBM -DNIS -DNISPLUS -DMAP_REGEX')
-define(`confENVDEF', `-DSOLARIS=20600 ')
-define(`confLIBS', `-lsocket -lnsl -lkstat')
-define(`confMBINDIR', `/usr/lib')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/etc/mail')
-define(`confHFDIR', `/etc/mail')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
-PUSHDIVERT(3)
-sysexits.h:
- if [ -r /usr/include/sysexits.h ]; \
- then \
- ln -s /usr/include/sysexits.h; \
- fi
-POPDIVERT
+++ /dev/null
-# @(#)SunOS.5.7 8.11 (Berkeley) 3/21/1998
-define(`confCC', `gcc')
-define(`confBEFORE', `sysexits.h')
-define(`confMAPDEF', `-DNDBM -DNIS -DNISPLUS -DMAP_REGEX')
-define(`confENVDEF', `-DSOLARIS=20700 ')
-define(`confLIBS', `-lsocket -lnsl')
-define(`confMBINDIR', `/usr/lib')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/etc/mail')
-define(`confHFDIR', `/etc/mail')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
-PUSHDIVERT(3)
-sysexits.h:
- if [ -r /usr/include/sysexits.h ]; \
- then \
- ln -s /usr/include/sysexits.h; \
- fi
-POPDIVERT
+++ /dev/null
-# @(#)SunOS.5.8 8.1 (Berkeley) 1/17/1999
-define(`confCC', `gcc')
-define(`confBEFORE', `sysexits.h')
-define(`confMAPDEF', `-DNDBM -DNIS -DNISPLUS -DMAP_REGEX')
-define(`confENVDEF', `-DSOLARIS=20800 ')
-define(`confLIBS', `-lsocket -lnsl')
-define(`confMBINDIR', `/usr/lib')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/etc/mail')
-define(`confHFDIR', `/etc/mail')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confDEPEND_TYPE', `CC-M')
-PUSHDIVERT(3)
-sysexits.h:
- if [ -r /usr/include/sysexits.h ]; \
- then \
- ln -s /usr/include/sysexits.h; \
- fi
-POPDIVERT
+++ /dev/null
-# @(#)Titan 8.5 (Berkeley) 3/12/1998
-define(`confCC', `cc -43')
-define(`confBEFORE', `stddef.h stdlib.h')
-define(`confMAPDEF', `-DNDBM')
-define(`confLIBS', `-ldbm')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-PUSHDIVERT(3)
-stddef.h stdlib.h:
- cp /dev/null $@
-POPDIVERT
+++ /dev/null
-# @(#)ULTRIX 8.8 (Berkeley) 12/18/1998
-define(`confCC', `cc -Olimit 970')
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confENVDEF', `-DIDENTPROTO=0 ')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)UMAX 8.5 (Berkeley) 3/12/1998
-define(`confBEFORE', `stddef.h')
-define(`confMAPDEF', `-DNIS')
-define(`confENVDEF', `-DUMAXV ')
-define(`confLIBS', `-lyp -lrpc')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-PUSHDIVERT(3)
-stddef.h:
- echo "#define _STDDEF_H" > stddef.h
- chmod 444 stddef.h
-POPDIVERT
+++ /dev/null
-# @(#)UNICOS 8.7 (Berkeley) 2/26/1998
-define(`confENVDEF', `-DUNICOS ')
-define(`confOPTIMIZE', `-O')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSTDIR', ` /etc/mail')
-define(`confHFDIR', ` /etc/mail')
+++ /dev/null
-# @(#)UNIX_SV.4.x.i386 8.6 (Berkeley) 3/12/1998
-define(`confCC', `gcc')
-define(`confMAPDEF', `-DNDBM')
-define(`confENVDEF', `-D__svr4__ -DUNIXWARE ')
-define(`confLIBS', `-lc -ldbm -lsocket -lnsl -lgen -lelf')
-define(`confMBINDIR', `/usr/ucblib')
-define(`confSBINDIR', `/usr/ucbetc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/ucblib')
-define(`confSBINGRP', `mail')
-define(`confSTDIR', `/usr/ucblib')
-define(`confHFDIR', `/usr/ucblib')
-define(`confINSTALL', `/usr/ucb/install')
-define(`confDEPEND_TYPE', `CC-M')
+++ /dev/null
-# @(#)UX4800 8.8 (Berkeley) 3/12/1998
-define(`confCC', `/usr/abiccs/bin/cc -KOlimit=900')
-define(`confBEFORE', `sysexits.h ndbm.h')
-define(`confMAPDEF', `-DNDBM -DNIS # without NEWDB')
-define(`confENVDEF', `-DHASSNPRINTF=1 ')
-define(`confLIBS', `-lsocket -lnsl -lelf # # without NEWDB')
-define(`confMBINDIR', `/usr/ucblib')
-define(`confSBINDIR', `/usr/ucbetc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/ucblib')
-define(`confSBINGRP', `sys')
-define(`confSTDIR', `/var/ucblib')
-define(`confHFDIR', `/var/ucblib')
-define(`confINSTALL', `/usr/ucb/install')
-PUSHDIVERT(3)
-sysexits.h:
- echo '#ifndef _LOCAL_SYSEXITS_H_' > sysexits.h;
- echo '#define _LOCAL_SYSEXITS_H_' >> sysexits.h;
- cat /usr/abiccs/ucbinclude/sysexits.h >> sysexits.h;
- echo '#endif /* _LOCAL_SYSEXITS_H_ */' >> sysexits.h;
-
-ndbm.h:
- sed 's/void/char/' /usr/abiccs/include/ndbm.h > ndbm.h
-POPDIVERT
+++ /dev/null
-# @(#)UXPDS.V10 8.9 (Berkeley) 3/12/1998
-define(`confCC', `/usr/ccs/bin/cc')
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confENVDEF', `-DUXPDS=10 ')
-define(`confINCDIRS', `-I/usr/include -I/usr/ucbinclude')
-define(`confLIBS', `/usr/ucblib/libdbm.a /usr/ucblib/libucb.a -lsocket -lnsl -lelf')
-define(`confMBINDIR', `/usr/ucblib')
-define(`confSBINDIR', `/usr/ucbetc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/ucblib')
-define(`confSBINGRP', `mail')
-define(`confSTDIR', `/usr/ucblib')
-define(`confHFDIR', `/usr/ucblib')
-define(`confINSTALL', `/usr/ucb/install')
-define(`confMANROOT', `/usr/local/man/man')
+++ /dev/null
-# @(#)UXPDS.V20 8.8 (Berkeley) 3/12/1998
-define(`confCC', `/usr/ccs/bin/cc')
-define(`confBEFORE', `netinet/ip_var.h')
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confENVDEF', `-DUXPDS=20 ')
-define(`confLIBS', `/usr/ucblib/libdbm.a -lsocket -lnsl -lelf')
-define(`confMBINDIR', `/usr/ucblib')
-define(`confSBINDIR', `/usr/ucbetc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/ucblib')
-define(`confSBINGRP', `mail')
-define(`confSTDIR', `/usr/ucblib')
-define(`confHFDIR', `/usr/ucblib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-define(`confMANROOT', `/usr/local/man/man')
-PUSHDIVERT(3)
-netinet/ip_var.h: netinet /usr/include/netinet/ip_var.h
- sed '/ip_var_f.h/d' /usr/include/netinet/ip_var.h > netinet/ip_var.h
-
-netinet:
- mkdir netinet
-POPDIVERT
+++ /dev/null
-# @(#)UnixWare.5.i386 8.2 (Berkeley) 10/15/1998
-#
-# System V Rel 5.x (a.k.a Unixware7 w/o BSD-Compatiblity Libs ie. native)
-# Contributed by Paul Gampe <paulg@apnic.net>
-#
-define(`confCC', `/usr/ccs/bin/cc')
-define(`confMAPDEF', `-DNDBM -DMAP_REGEX')
-define(`confENVDEF', `-D__svr5__')
-define(`confLIBS', `-lsocket -lnsl -lelf')
-define(`confSHELL', `/usr/bin/sh')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/etc/mail')
-define(`confUBINDIR', `/etc/mail')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `mail')
-define(`confSTDIR', `/etc/mail')
-define(`confHFDIR', `/etc/mail')
-define(`confINSTALL', `/usr/ucb/install')
+++ /dev/null
-# @(#)dcosx.1.x.NILE 8.3 (Berkeley) 2/8/1998
-define(`confENVDEF', `-D__svr4__ -DDCOSx ')
-define(`confLIBS', `-lsocket -lnsl -lelf')
-define(`confHFDIR', `/usr/share/lib/mail')
-define(`confINSTALL', `/usr/ucb/install')
-define(`confSBINGRP', `sys')
+++ /dev/null
-# @(#)dgux 8.5 (Berkeley) 3/12/1998
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confLIBS', `-ldbm')
-define(`confMBINDIR', `/usr/bin')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `bin')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/etc')
+++ /dev/null
-# @(#)maxion 8.6 (Berkeley) 3/12/1998
-define(`confCC', `/usr/ucb/cc')
-define(`confMAPDEF', `-DNDBM -DNIS')
-define(`confLIBDIRS', `-L/usr/ucblib')
-define(`confLIBS', `-ldbm -lgen -lucb')
-define(`confMBINDIR', `/usr/ucblib')
-define(`confSBINDIR', `/usr/ucbetc')
-define(`confUBINDIR', `/usr/ucb')
-define(`confEBINDIR', `/usr/ucblib')
-define(`confSBINOWN', `smtp')
-define(`confSBINGRP', `mail')
-define(`confSTDIR', `/var/adm/log')
-define(`confHFDIR', `/etc/ucbmail')
-define(`confINSTALL', `/usr/ucb/install')
+++ /dev/null
-# @(#)uts.systemV 8.10 (Berkeley) 3/12/1998
-PUSHDIVERT(1)
-# Sendmail 8 on UTS requires BIND 4.9's include files and lib44bsd and
-# libresolv libraries. The BIND version on UTS is much too old.
-#
-BINDPATH=../../../bind
-POPDIVERT
-define(`confBEFORE', `stddef.h')
-define(`confMAPDEF', `-DNIS -DNDBM')
-define(`confENVDEF', `-D_UTS ')
-define(`confOPTIMIZE', `-g')
-define(`confINCDIRS', `-I${BINDPATH}/include -I${BINDPATH}/compat/include')
-define(`confLIBDIRS', `-L${BINDPATH}/res -L${BINDPATH}/compat/lib')
-define(`confLIBS', `-lyp -lrpc -lbsd -lsocket -la')
-define(`confMBINDIR', `/usr/lib')
-define(`confSBINDIR', `/usr/etc')
-define(`confUBINDIR', `/usr/lib')
-define(`confEBINDIR', `/usr/lib')
-define(`confSBINGRP', `mail')
-define(`confSTDIR', `/usr/lib')
-define(`confHFDIR', `/usr/lib')
-define(`confINSTALL', `${BUILDBIN}/install.sh')
-PUSHDIVERT(3)
-stddef.h:
- echo "#include <sys/types.h>" > stddef.h
-POPDIVERT
+++ /dev/null
-This directory contains tools. Do not attempt to actually build
-anything in this directory.
-
-The Build script allows you to specify a site configuration file by using
-the -f flag:
-
- Build -f siteconfig.m4
-
-You can put such site configuration files in the Site sub-directory;
-see Site/README for details.
-
-While building a site configuration file, you can add to a definition
-using the APPENDDEF() and PREPENDDEF() macros. For example:
-
- APPENDDEF(`confINCDIRS', `-I/usr/local/bind/include')
-
-will add -I/usr/local/bind/include to the already existing confINCDIRS.
-Note: There must be no trailing spaces after the last quote mark and
-before the closing parenthesis. Also you may need to properly quote
-m4 reserved words as specified by your vendor's m4 command.
-
-By default, sendmail will search your system for include and library
-directories as well as certain libraries (libdb.* for Berkeley DB and
-libbind.a or libresolv.* for name resolution). You can turn off this
-configuration step by specifying the -S flag with the Build command.
-
-The OS subtree contains definitions for variations on a standard
-model for system installation. The M4 variables that can be defined
-and their defaults before referencing the appropriate OS definitons
-are:
-
-confBEFORE [empty] Files to create before sendmail is
- compiled. The methods must be defined
- in the Makefile using PUSHDIVERT(3).
-confBUILDBIN ../../BuildTools/bin
- The location of the build support
- binaries, relative to the obj.*
- directory.
-confCC cc The C compiler to use.
-confOPTIMIZE -O Flags passed to CC as ${O}.
-confDEPEND_TYPE generic How to build dependencies. This should
- be the name of a file in
- BuildTools/M4/depend
-confEBINDIR /usr/libexec The location for binaries executed
- from other binaries, e.g., mail.local
- or smrsh.
-confENVDEF [empty] -D flags passed to cc.
-confHFDIR /usr/share/misc Location of the sendmail help file.
-confINCDIRS [empty] -I flags passed to cc.
-confINSTALL install The BSD-compatible install program.
- Use ${BUILDBIN}/install.sh if none
- is available on your system.
-confLDOPTS [empty] Linker options passed to ld.
-confLIBDIRS [empty] -L flags passed to ld.
-confLIBS [varies] -l flags passed to ld.
-confLIBSEARCH db bind resolv 44bsd
- Search for these libraries for
- linking with programs.
-confLINKS ${UBINDIR}/newaliases ${UBINDIR}/mailq \
- ${UBINDIR}/hoststat ${UBINDIR}/purgestat
- Names of links to sendmail.
-confMANROOT /usr/share/man/cat The root of the man subtree.
-confMAN1 confMANROOT 1 The location of man1 files.
-confMAN1EXT 1 The extension on files in confMAN1.
-confMAN1SRC 0 The source for man pages installed
- in confMAN1.
-confMAN5 confMANROOT 5 The location of man5 files.
-confMAN5EXT 5 The extension on files in confMAN5.
-confMAN5SRC 0 The source for man pages installed
- in confMAN5.
-confMAN8 confMANROOT 8 The location of man8 files.
-confMAN8EXT 8 The extension on files in confMAN8.
-confMAN8SRC 0 The source for man pages installed
- in confMAN8.
-confMANDOC -mandoc The macros used to format man pages.
-confMANOWN bin The owner of installed man pages.
-confMANGRP bin The group of installed man pages.
-confMANMODE 444 The mode of installed man pages.
-confMAPDEF [varies] The map definitions, e.g.,
- -DNDBM -DNEWDB. -DNEWDB is always
- added if a libdb.a can be found.
-confNO_MAN_INSTALL [undefined] If defined, don't install the man
- pages by default.
-confMBINDIR /usr/sbin The location of the MTA (sendmail)
- binary.
-confNROFF groff -Tascii The command to format man pages.
-confOBJADD [empty] Objects that should be included in
- when linking sendmail and the
- associated utilities.
-confSBINDIR /usr/sbin The location of root-oriented
- commands, such as makemap.
-confSBINOWN root The owner for setuid binaries.
-confSBINGRP kmem The group for setuid binaries.
-confSBINMODE 4555 The mode for setuid binaries.
-confSHELL /bin/sh The shell to use inside make.
-confSMOBJADD [empty] Objects that should be included in
- when linking sendmail.
-confSRCDIR ../../src The sendmail source directory
- relative to support program obj.*
- directories.
-confSTDIR /var/log The directory in which to store the
- sendmail status file.
-confUBINDIR /usr/bin The directory for user-executable
- binaries.
-confUBINOWN bin The owner for user-executable binaries.
-confUBINGRP bin The group for user-executable binaries.
-confUBINMODE 555 The mode for user-executable binaries.
-
-
-@(#)README 8.22 (Berkeley) 6/30/1998
+++ /dev/null
-The Build script will look for the default site configuration files in
-this directory. Build will include the following files if they are
-present in this directory:
-
- site.OS.$SENDMAIL_SUFFIX.m4
- site.OS.m4
- site.config.m4
-
-OS is the name of the operating system file selected from the BuildTools/OS
-directory. SENDMAIL_SUFFIX is a user environment variable which can be
-used to further distinguish between site configuration files in this
-directory.
-
-See the README in the BuildTools directory for more information.
-
-@(#)README 8.3 (Berkeley) 3/27/1998
+++ /dev/null
-#!/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.94 (Berkeley) 1/23/1999
-#
-
-#
-# 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`;;
-
- CRAYT3E|CRAYTS)
- os=$arch;;
-
-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
+++ /dev/null
-#!/bin/sh
-
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-# @(#)configure.sh 8.27 (Berkeley) 5/19/1998
-
-#
-# Special script to autoconfigure for M4 generation of Makefile
-#
-
-os=""
-resolver=""
-sflag=""
-
-while [ ! -z "$1" ]
-do
- case $1
- in
- -s) # skip auto-configure
- sflag=1
- shift
- ;;
-
- *) # OS definition
- os=$1
- shift
- ;;
- esac
-done
-
-usewhoami=0
-usehostname=0
-for p in `echo $PATH | sed 's/:/ /g'`
-do
- if [ "x$p" = "x" ]
- then
- p="."
- fi
- if [ -f $p/whoami ]
- then
- usewhoami=1
- if [ $usehostname -ne 0 ]
- then
- break;
- fi
- fi
- if [ -f $p/hostname ]
- then
- usehostname=1
- if [ $usewhoami -ne 0 ]
- then
- break;
- fi
- fi
-done
-if [ $usewhoami -ne 0 ]
-then
- user=`whoami`
-else
- user=$LOGNAME
-fi
-
-if [ $usehostname -ne 0 ]
-then
- host=`hostname`
-else
- host=`uname -n`
-fi
-echo "PUSHDIVERT(0)"
-echo "####################################################################"
-echo "##### This file is automatically generated -- edit at your own risk"
-echo '#####' Built by $user@$host
-echo '#####' on `date` using template OS/$os
-if [ ! -z "$SITECONFIG" ]
-then
- echo '#####' including $SITECONFIG
-fi
-echo '#####' in `pwd` | sed 's/\/tmp_mnt//'
-echo "####################################################################"
-echo ""
-echo "POPDIVERT"
-echo "define(\`__HOST__', \`$host')dnl"
-echo "ifdef(\`confMAPDEF',, \`define(\`confMAPDEF', \`')')dnl"
-echo "ifdef(\`confLIBS',, \`define(\`confLIBS', \`')')dnl"
-
-# If user did not supply ABI for Build, use SGI_ABI
-# so the proper libraries are checked below.
-if [ -z "$ABI" ]
-then
- ABI="$SGI_ABI"
-fi
-
-case $ABI
-in
- -n32) LIBDIRS="$LIBDIRS /lib32 /usr/lib32"
- ;;
- -64) LIBDIRS="$LIBDIRS /lib64 /usr/lib64"
- ;;
- *) LIBDIRS="$LIBDIRS /lib /usr/lib /usr/shlib"
- ;;
-esac
-
-libs=""
-mapdef=""
-for l in $LIBSRCH
-do
- for p in `echo $LIBDIRS | sed -e 's/:/ /g' -e 's/^-L//g' -e 's/ -L/ /g'`
- do
- if [ "x$p" = "x" ]
- then
- p = "."
- fi
- if [ -f $p/lib$l.a -o -f $p/lib$l.so ]
- then
- case $l
- in
- db)
- mapdef="$mapdef -DNEWDB"
- ;;
- bind|resolv)
- if [ -n "$resolver" ]
- then
- continue
- else
- resolver=$l
- fi
- ;;
- 44bsd)
- if [ "x$resolver" != "xresolv" ]
- then
- continue
- fi
- ;;
- esac
- libs="$libs -l$l"
- break
- fi
- done
-done
-
-for p in `echo $PATH | sed 's/:/ /g'`
-do
- pbase=`echo $p | sed -e 's,/bin,,'`
- if [ "x$p" = "x" ]
- then
- p="."
- fi
- if [ -f $p/mkdep ]
- then
- echo "ifdef(\`confDEPEND_TYPE',, \`define(\`confDEPEND_TYPE', \`BSD')')dnl"
- fi
-done
-
-if [ -z "$sflag" ]
-then
- echo "define(\`confMAPDEF', \`$mapdef' confMAPDEF)dnl"
- echo "define(\`confLIBS', \`$libs' confLIBS)dnl"
-fi
+++ /dev/null
-#!/bin/sh
-
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-# @(#)find_m4.sh 8.4 (Berkeley) 5/19/1998
-#
-
-# Try to find a working M4 program.
-# If $M4 is already set, we use it, otherwise we prefer GNU m4.
-
-EX_UNAVAILABLE=69
-
-test="ifdef(\`pushdef', \`',
-\`errprint(\`You need a newer version of M4, at least as new as System V or GNU')
-include(NoSuchFile)')
-define(\`BadNumber', \`10')
-ifdef(\`BadNumber', \`', \`errprint(\`This version of m4 is broken')')"
-
-if [ "$M4" ]
-then
- err=`(echo "$test" | $M4) 2>&1 >/dev/null`
- code=$?
-else
- firstfound=
- ifs="$IFS"; IFS="${IFS}:"
- for m4 in gm4 gnum4 pdm4 m4
- do
- for dir in $PATH /usr/5bin /usr/ccs/bin
- do
- [ -z "$dir" ] && dir=.
- if [ -f $dir/$m4 ]
- then
- err=`(echo "$test" | $dir/$m4) 2>&1 >/dev/null`
- ret=$?
- if [ $ret -eq 0 -a "X$err" = "X" ]
- then
- M4=$dir/$m4
- code=0
- break
- else
- case "$firstfound:$err" in
- :*version\ of*)
- firstfound=$dir/$m4
- firsterr="$err"
- firstcode=$ret
- ;;
- esac
- fi
- fi
- done
- [ "$M4" ] && break
- done
- IFS="$ifs"
- if [ ! "$M4" ]
- then
- if [ "$firstfound" ]
- then
- M4=$firstfound
- err="$firsterr"
- code=$firstcode
- else
- echo "ERROR: Can not locate an M4 program" >&2
- exit $EX_UNAVAILABLE
- fi
- fi
-fi
-if [ $code -ne 0 ]
-then
- echo "ERROR: Using M4=$M4: $err" | grep -v NoSuchFile >&2
- exit $EX_UNAVAILABLE
-elif [ "X$err" != "X" ]
-then
- echo "WARNING: $err" >&2
-fi
-echo $M4
-exit 0
-
+++ /dev/null
-#!/bin/sh
-
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-# @(#)install.sh 8.9 (Berkeley) 5/19/1998
-
-# Set default program
-program=mv
-
-# chown program -- ultrix keeps it in /etc/chown and /usr/etc/chown
-if [ -f /etc/chown ]
-then
- chown=/etc/chown
-elif [ -f /usr/etc/chown ]
-then
- chown=/usr/etc/chown
-else
- chown=chown
-fi
-
-# Check arguments
-while [ ! -z "$1" ]
-do
- case $1
- in
- -o) owner=$2
- shift; shift
- ;;
-
- -g) group=$2
- shift; shift
- ;;
-
- -m) mode=$2
- shift; shift
- ;;
-
- -c) program=cp
- shift
- ;;
-
- -s) strip="strip"
- shift
- ;;
-
- -*) echo $0: Unknown option $1
- exit 1
- ;;
-
- *) break
- ;;
- esac
-done
-
-# Check source file
-if [ -z "$1" ]
-then
- echo "Source file required" >&2
- exit 1
-elif [ -f $1 -o $1 = /dev/null ]
-then
- src=$1
-else
- echo "Source file must be a regular file or /dev/null" >&2
- exit 1
-fi
-
-# Check destination
-if [ -z "$2" ]
-then
- echo "Destination required" >&2
- exit 1
-elif [ -d $2 ]
-then
- dst=$2/$src
-else
- dst=$2
-fi
-
-# Do install operation
-$program $src $dst
-if [ $? != 0 ]
-then
- exit 1
-fi
-
-# Strip if requested
-if [ ! -z "$strip" ]
-then
- $strip $dst
-fi
-
-# Change owner if requested
-if [ ! -z "$owner" ]
-then
- $chown $owner $dst
- if [ $? != 0 ]
- then
- exit 1
- fi
-fi
-
-# Change group if requested
-if [ ! -z "$group" ]
-then
- chgrp $group $dst
- if [ $? != 0 ]
- then
- exit 1
- fi
-fi
-
-# Change mode if requested
-if [ ! -z "$mode" ]
-then
- chmod $mode $dst
- if [ $? != 0 ]
- then
- exit 1
- fi
-fi
-
-exit 0
+++ /dev/null
-# $OpenBSD: Makefile,v 1.2 1998/11/12 19:15:12 millert Exp $
-#
-
-NOOBJ= noobj
-FILES= README
-DIRS= cf domain feature hack m4 mailer ostype sh siteconfig
-
-install:
- @${INSTALL} -d -o ${BINOWN} -g wheel -m 755 \
- ${DESTDIR}${SHAREDIR}/sendmail
- @echo installing ${FILES}
- @-for i in ${FILES}; do \
- cmp -s $$i ${DESTDIR}${SHAREDIR}/sendmail/$$i || \
- ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \
- -m 444 $$i ${DESTDIR}${SHAREDIR}/sendmail/$$i ; \
- done
- @echo installing ${DIRS}
- @-for i in ${DIRS}; do \
- ${INSTALL} -d -o ${BINOWN} -g wheel -m 755 \
- ${DESTDIR}${SHAREDIR}/sendmail/$$i; \
- (cd $$i; for j in *.m[4c] *.sh Makefile; do \
- if [ -f $$j ]; then \
- cmp -s $$j ${DESTDIR}${SHAREDIR}/sendmail/$$i/$$j || \
- ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} \
- -m 444 $$j ${DESTDIR}${SHAREDIR}/sendmail/$$i/$$j; \
- fi; \
- done); \
- done
-
-.include <bsd.prog.mk>
+++ /dev/null
-
-
- NEW SENDMAIL CONFIGURATION FILES
-
- Eric Allman <eric@Sendmail.ORG>
-
- @(#)README 8.186 (Berkeley) 2/3/1999
-
-
-This document describes the sendmail configuration files being used
-at Berkeley. These use features in the new (R8) sendmail; they will
-not work on other versions.
-
-These configuration files are probably not as general as previous
-versions, and don't handle as many of the weird cases automagically.
-I was able to simplify them for two reasons. First, the network
-has become more consistent -- for example, at this point, everyone
-on the internet is supposed to be running a name server, so hacks to
-handle NIC-registered hosts can go away. Second, I assumed that a
-subdomain would be running SMTP internally -- UUCP is presumed to be
-a long-haul protocol. I realize that this is not universal, but it
-does describe the vast majority of sites with which I am familiar,
-including those outside the US.
-
-Of course, the downside of this is that if you do live in a weird
-world, things are going to get weirder for you. I'm sorry about that,
-but at the time we at Berkeley had a problem, and it seemed like the
-right thing to do.
-
-This package requires a post-V7 version of m4; if you are running the
-4.2bsd, SysV.2, or 7th Edition version, I suggest finding a friend with
-a newer version. You can m4-expand on their system, then run locally.
-SunOS's /usr/5bin/m4 or BSD-Net/2's m4 both work. GNU m4 version 1.1
-or later also works. Unfortunately, I'm told that the M4 on BSDI 1.0
-doesn't work -- you'll have to use a Net/2 or GNU version. GNU m4 is
-available from ftp://ftp.gnu.org/pub/gnu/m4-1.4.tar.gz (check for
-the latest version). EXCEPTIONS: DEC's m4 on Digital UNIX 4.x is broken
-(3.x is fine). Use GNU m4 on this platform.
-
-IF YOU DON'T HAVE A BERKELEY MAKE, don't despair! Just run
-"m4 ../m4/cf.m4 foo.mc > foo.cf" -- that should be all you need.
-There is also a fairly crude (but functional) Makefile.dist that works
-on the old version of make.
-
-To get started, you may want to look at tcpproto.mc (for TCP-only
-sites), uucpproto.mc (for UUCP-only sites), and clientproto.mc (for
-clusters of clients using a single mail host). Others are versions
-that we use at Berkeley, although not all are in current use. For
-example, ucbvax has gone away, but I've left ucbvax.mc in because
-it demonstrates some interesting techniques.
-
-I'm not pretending that this README describes everything that these
-configuration files can do; clever people can probably tweak them
-to great effect. But it should get you started.
-
-*******************************************************************
-*** BE SURE YOU CUSTOMIZE THESE FILES! They have some ***
-*** Berkeley-specific assumptions built in, such as the name ***
-*** of our UUCP-relay. You'll want to create your own domain ***
-*** description, and use that in place of ***
-*** domain/Berkeley.EDU.m4. ***
-*******************************************************************
-
-
-+--------------------------+
-| INTRODUCTION AND EXAMPLE |
-+--------------------------+
-
-Configuration files are contained in the subdirectory "cf", with a
-suffix ".mc". They must be run through "m4" to produce a ".cf" file.
-You must pre-load "cf.m4":
-
- m4 ${CFDIR}/m4/cf.m4 config.mc > config.cf
-
-where ${CFDIR} is the root of the cf directory and config.mc is the
-name of your configuration file. If you are running a version of M4
-that understands the __file__ builtin (versions of GNU m4 >= 0.75 do
-this, but the versions distributed with 4.4BSD and derivatives do not)
-or the -I flag (ditto), then ${CFDIR} can be in an arbitrary directory.
-For "traditional" versions, ${CFDIR} ***MUST*** be "..", or you MUST
-use -D_CF_DIR_=/path/to/cf/dir/ -- note the trailing slash! For example:
-
- m4 -D_CF_DIR_=${CFDIR}/ ${CFDIR}/m4/cf.m4 config.mc > config.cf
-
-Let's examine a typical .mc file:
-
- divert(-1)
- #
- # Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- # Copyright (c) 1983 Eric P. Allman. All rights reserved.
- # Copyright (c) 1988, 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.
- #
-
- #
- # This is a Berkeley-specific configuration file for HP-UX 9.x.
- # It applies only to the Computer Science Division at Berkeley,
- # and should not be used elsewhere. It is provided on the sendmail
- # distribution as a sample only. To create your own configuration
- # file, create an appropriate domain file in ../domain, change the
- # `DOMAIN' macro below to reference that file, and copy the result
- # to a name of your own choosing.
- #
- divert(0)
-
-The divert(-1) will delete the crud in the resulting output file.
-The copyright notice can be replaced by whatever your lawyers require;
-our lawyers require the one that I've included in my files. A copyleft
-is a copyright by another name. The divert(0) restores regular output.
-
- VERSIONID(`<SCCS or RCS version id>')
-
-VERSIONID is a macro that stuffs the version information into the
-resulting file. We use SCCS; you could use RCS, something else, or
-omit it completely. This is not the same as the version id included
-in SMTP greeting messages -- this is defined in m4/version.m4.
-
- OSTYPE(hpux9)dnl
-
-You must specify an OSTYPE to properly configure things such as the
-pathname of the help and status files, the flags needed for the local
-mailer, and other important things. If you omit it, you will get an
-error when you try to build the configuration. Look at the ostype
-directory for the list of known operating system types.
-
- DOMAIN(CS.Berkeley.EDU)dnl
-
-This example is specific to the Computer Science Division at Berkeley.
-You can use "DOMAIN(generic)" to get a sufficiently bland definition
-that may well work for you, or you can create a customized domain
-definition appropriate for your environment.
-
- MAILER(local)
- MAILER(smtp)
-
-These describe the mailers used at the default CS site site. The
-local mailer is always included automatically. Beware: MAILER
-declarations should always be at the end of the configuration file,
-and MAILER(smtp) should always precede MAILER(uucp). The general
-rules are that the order should be:
-
- VERSIONID
- OSTYPE
- DOMAIN
- FEATURE
- local macro definitions
- MAILER
- LOCAL_RULESET_*
-
-
-+----------------------------+
-| A BRIEF INTRODUCTION TO M4 |
-+----------------------------+
-
-Sendmail uses the M4 macro processor to ``compile'' the configuration
-files. The most important thing to know is that M4 is stream-based,
-that is, it doesn't understand about lines. For this reason, in some
-places you may see the word ``dnl'', which stands for ``delete
-through newline''; essentially, it deletes all characters starting
-at the ``dnl'' up to and including the next newline character. In
-most cases sendmail uses this only to avoid lots of unnecessary
-blank lines in the output.
-
-Other important directives are define(A, B) which defines the macro
-``A'' to have value ``B''. Macros are expanded as they are read, so
-one normally quotes both values to prevent expansion. For example,
-
- define(`SMART_HOST', `smart.foo.com')
-
-One word of warning: M4 macros are expanded even in lines that appear
-to be comments. For example, if you have
-
- # See FEATURE(foo) above
-
-it will not do what you expect, because the FEATURE(foo) will be
-expanded. This also applies to
-
- # And then define the $X macro to be the return address
-
-because ``define'' is an M4 keyword. If you want to use them, surround
-them with directed quotes, `like this'.
-
-+----------------+
-| FILE LOCATIONS |
-+----------------+
-
-sendmail 8.9 has introduced a new configuration directory for sendmail
-related files, /etc/mail. The new files available for sendmail 8.9 --
-the class 'R' /etc/mail/relay-domains and the access database
-/etc/mail/access -- take advantage of this new directory. 8.9 will
-serve as a transition release. Beginning with 8.10, all of the files
-will use this directory by default.
-
-+--------+
-| OSTYPE |
-+--------+
-
-You MUST define an operating system environment, or the configuration
-file build will puke. There are several environments available; look
-at the "ostype" directory for the current list. This macro changes
-things like the location of the alias file and queue directory. Some
-of these files are identical to one another.
-
-It is IMPERATIVE that the OSTYPE occur before any MAILER definitions.
-In general, the OSTYPE macro should go immediately after any version
-information, and MAILER definitions should always go last.
-
-Operating system definitions are usually easy to write. They may define
-the following variables (everything defaults, so an ostype file may be
-empty). Unfortunately, the list of configuration-supported systems is
-not as broad as the list of source-supported systems, since many of
-the source contributors do not include corresponding ostype files.
-
-ALIAS_FILE [/etc/aliases] The location of the text version
- of the alias file(s). It can be a comma-separated
- list of names (but be sure you quote values with
- commas in them -- for example, use
- define(`ALIAS_FILE', `a,b')
- to get "a" and "b" both listed as alias files;
- otherwise the define() primitive only sees "a").
-HELP_FILE [/usr/lib/sendmail.hf] The name of the file
- containing information printed in response to
- the SMTP HELP command.
-QUEUE_DIR [/var/spool/mqueue] The directory containing
- queue files.
-STATUS_FILE [/etc/sendmail.st] The file containing status
- information.
-LOCAL_MAILER_PATH [/bin/mail] The program used to deliver local mail.
-LOCAL_MAILER_FLAGS [rmn9] The flags used by the local mailer. The
- flags lsDFM are always included.
-LOCAL_MAILER_ARGS [mail -d $u] The arguments passed to deliver local
- mail.
-LOCAL_MAILER_MAX [undefined] If defined, the maximum size of local
- mail that you are willing to accept.
-LOCAL_MAILER_CHARSET [undefined] If defined, messages containing 8-bit data
- that ARRIVE from an address that resolves to the
- local mailer and which are converted to MIME will be
- labeled with this character set.
-LOCAL_SHELL_PATH [/bin/sh] The shell used to deliver piped email.
-LOCAL_SHELL_FLAGS [eu9] The flags used by the shell mailer. The
- flags lsDFM are always included.
-LOCAL_SHELL_ARGS [sh -c $u] The arguments passed to deliver "prog"
- mail.
-LOCAL_SHELL_DIR [$z:/] The directory search path in which the
- shell should run.
-USENET_MAILER_PATH [/usr/lib/news/inews] The name of the program
- used to submit news.
-USENET_MAILER_FLAGS [rlsDFMmn] The mailer flags for the usenet mailer.
-USENET_MAILER_ARGS [-m -h -n] The command line arguments for the
- usenet mailer.
-USENET_MAILER_MAX [100000] The maximum size of messages that will
- be accepted by the usenet mailer.
-SMTP_MAILER_FLAGS [undefined] Flags added to SMTP mailer. Default
- flags are `mDFMUX' for all SMTP-based mailers; the
- "esmtp" mailer adds `a' and "smtp8" adds `8'.
-SMTP_MAILER_MAX [undefined] The maximum size of messages that will
- be transported using the smtp, smtp8, or esmtp
- mailers.
-SMTP_MAILER_ARGS [IPC $h] The arguments passed to the smtp mailer.
- About the only reason you would want to change this
- would be to change the default port.
-ESMTP_MAILER_ARGS [IPC $h] The arguments passed to the esmtp mailer.
-SMTP8_MAILER_ARGS [IPC $h] The arguments passed to the smtp8 mailer.
-RELAY_MAILER_ARGS [IPC $h] The arguments passed to the relay mailer.
-SMTP_MAILER_CHARSET [undefined] If defined, messages containing 8-bit data
- that ARRIVE from an address that resolves to one of
- the SMTP mailers and which are converted to MIME will
- be labeled with this character set.
-UUCP_MAILER_PATH [/usr/bin/uux] The program used to send UUCP mail.
-UUCP_MAILER_FLAGS [undefined] Flags added to UUCP mailer. Default
- flags are `DFMhuU' (and `m' for uucp-new mailer,
- minus `U' for uucp-dom mailer).
-UUCP_MAILER_ARGS [uux - -r -z -a$g -gC $h!rmail ($u)] The arguments
- passed to the UUCP mailer.
-UUCP_MAILER_MAX [100000] The maximum size message accepted for
- transmission by the UUCP mailers.
-UUCP_MAILER_CHARSET [undefined] If defined, messages containing 8-bit data
- that ARRIVE from an address that resolves to one of
- the UUCP mailers and which are converted to MIME will
- be labeled with this character set.
-FAX_MAILER_PATH [/usr/local/lib/fax/mailfax] The program used to
- submit FAX messages.
-FAX_MAILER_ARGS [mailfax $u $h $f] The arguments passed to the FAX
- mailer.
-FAX_MAILER_MAX [100000] The maximum size message accepted for
- transmission by FAX.
-POP_MAILER_PATH [/usr/lib/mh/spop] The pathname of the POP mailer.
-POP_MAILER_FLAGS [Penu] Flags added to POP mailer. Flags "lsDFM"
- are always added.
-POP_MAILER_ARGS [pop $u] The arguments passed to the POP mailer.
-PROCMAIL_MAILER_PATH [/usr/local/bin/procmail] The path to the procmail
- program. This is also used by
- FEATURE(`local_procmail').
-PROCMAIL_MAILER_FLAGS [SPhnu9] Flags added to Procmail mailer. Flags
- ``DFM'' are always set. This is NOT used by
- FEATURE(`local_procmail'); tweak LOCAL_MAILER_FLAGS
- instead.
-PROCMAIL_MAILER_ARGS [procmail -Y -m $h $f $u] The arguments passed to
- the Procmail mailer. This is NOT used by
- FEATURE(`local_procmail'); tweak LOCAL_MAILER_ARGS
- instead.
-PROCMAIL_MAILER_MAX [undefined] If set, the maximum size message that
- will be accepted by the procmail mailer.
-MAIL11_MAILER_PATH [/usr/etc/mail11] The path to the mail11 mailer.
-MAIL11_MAILER_FLAGS [nsFx] Flags for the mail11 mailer.
-MAIL11_MAILER_ARGS [mail11 $g $x $h $u] Arguments passed to the mail11
- mailer.
-PH_MAILER_PATH [/usr/local/etc/phquery] The path to the phquery
- program.
-PH_MAILER_FLAGS [ehmu] Flags for the phquery mailer.
-PH_MAILER_ARGS [phquery -- $u] -- arguments to the phquery mailer.
-CYRUS_MAILER_FLAGS [A5@/:|] The flags used by the cyrus mailer. The
- flags lsDFMnPq are always included.
-CYRUS_MAILER_PATH [/usr/cyrus/bin/deliver] The program used to deliver
- cyrus mail.
-CYRUS_MAILER_ARGS [deliver -e -m $h -- $u] The arguments passed
- to deliver cyrus mail.
-CYRUS_MAILER_MAX [undefined] If set, the maximum size message that
- will be accepted by the cyrus mailer.
-CYRUS_MAILER_USER [cyrus:mail] The user and group to become when
- running the cyrus mailer.
-CYRUS_BB_MAILER_FLAGS [undefined] The flags used by the cyrusbb
- mailer. The flags lsDFMnP are always included.
-CYRUS_BB_MAILER_ARGS [deliver -e -m $u] The arguments passed
- to deliver cyrusbb mail.
-confEBINDIR [/usr/libexec] The directory for executables.
- Currently used for FEATURE(`local_lmtp') and
- FEATURE(`smrsh').
-
-
-
-+---------+
-| DOMAINS |
-+---------+
-
-You will probably want to collect domain-dependent defines into one
-file, referenced by the DOMAIN macro. For example, our Berkeley
-domain file includes definitions for several internal distinguished
-hosts:
-
-UUCP_RELAY The host that will accept UUCP-addressed email.
- If not defined, all UUCP sites must be directly
- connected.
-BITNET_RELAY The host that will accept BITNET-addressed email.
- If not defined, the .BITNET pseudo-domain won't work.
-DECNET_RELAY The host that will accept DECNET-addressed email.
- If not defined, the .DECNET pseudo-domain and addresses
- of the form node::user will not work.
-FAX_RELAY The host that will accept mail to the .FAX pseudo-domain.
- The "fax" mailer overrides this value.
-LOCAL_RELAY DEPRECATED. The site that will handle unqualified
- names -- that is, names with out an @domain extension.
- If not set, they are assumed to belong on this machine.
- This allows you to have a central site to store a
- company- or department-wide alias database. This
- only works at small sites, and only with some user
- agents.
-LUSER_RELAY The site that will handle lusers -- that is, apparently
- local names that aren't local accounts or aliases.
-
-Any of these can be either ``mailer:hostname'' (in which case the
-mailer is the internal mailer name, such as ``uucp-new'' and the hostname
-is the name of the host as appropriate for that mailer) or just a
-``hostname'', in which case a default mailer type (usually ``relay'',
-a variant on SMTP) is used. WARNING: if you have a wildcard MX
-record matching your domain, you probably want to define these to
-have a trailing dot so that you won't get the mail diverted back
-to yourself.
-
-The domain file can also be used to define a domain name, if needed
-(using "DD<domain>") and set certain site-wide features. If all hosts
-at your site masquerade behind one email name, you could also use
-MASQUERADE_AS here.
-
-You do not have to define a domain -- in particular, if you are a
-single machine sitting off somewhere, it is probably more work than
-it's worth. This is just a mechanism for combining "domain dependent
-knowledge" into one place.
-
-+---------+
-| MAILERS |
-+---------+
-
-There are fewer mailers supported in this version than the previous
-version, owing mostly to a simpler world. As a general rule, put the
-MAILER definitions last in your .mc file, and always put MAILER(smtp)
-before MAILER(uucp) -- several features and definitions will modify
-the definition of mailers, and the smtp mailer modifies the UUCP
-mailer.
-
-local The local and prog mailers. You will almost always
- need these; the only exception is if you relay ALL
- your mail to another site. This mailer is included
- automatically.
-
-smtp The Simple Mail Transport Protocol mailer. This does
- not hide hosts behind a gateway or another other
- such hack; it assumes a world where everyone is
- running the name server. This file actually defines
- four mailers: "smtp" for regular (old-style) SMTP to
- other servers, "esmtp" for extended SMTP to other
- servers, "smtp8" to do SMTP to other servers without
- converting 8-bit data to MIME (essentially, this is
- your statement that you know the other end is 8-bit
- clean even if it doesn't say so), and "relay" for
- transmission to our RELAY_HOST, LUSER_RELAY, or
- MAILER_HUB.
-
-uucp The Unix-to-Unix Copy Program mailer. Actually, this
- defines two mailers, "uucp-old" (a.k.a. "uucp") and
- "uucp-new" (a.k.a. "suucp"). The latter is for when you
- know that the UUCP mailer at the other end can handle
- multiple recipients in one transfer. If the smtp mailer
- is also included in your configuration, two other mailers
- ("uucp-dom" and "uucp-uudom") are also defined [warning:
- you MUST specify MAILER(smtp) before MAILER(uucp)]. When you
- include the uucp mailer, sendmail looks for all names in
- the $=U class and sends them to the uucp-old mailer; all
- names in the $=Y class are sent to uucp-new; and all
- names in the $=Z class are sent to uucp-uudom. Note that
- this is a function of what version of rmail runs on
- the receiving end, and hence may be out of your control.
- See the section below describing UUCP mailers in more
- detail.
-
-usenet Usenet (network news) delivery. If this is specified,
- an extra rule is added to ruleset 0 that forwards all
- local email for users named ``group.usenet'' to the
- ``inews'' program. Note that this works for all groups,
- and may be considered a security problem.
-
-fax Facsimile transmission. This is experimental and based
- on Sam Leffler's HylaFAX software. For more information,
- see http://www.vix.com/hylafax/.
-
-pop Post Office Protocol.
-
-procmail An interface to procmail (does not come with sendmail).
- This is designed to be used in mailertables. For example,
- a common question is "how do I forward all mail for a given
- domain to a single person?". If you have this mailer
- defined, you could set up a mailertable reading:
-
- host.com procmail:/etc/procmailrcs/host.com
-
- with the file /etc/procmailrcs/host.com reading:
-
- :0 # forward mail for host.com
- ! -oi -f $1 person@other.host
-
- This would arrange for (anything)@host.com to be sent
- to person@other.host. Within the procmail script, $1 is
- the name of the sender and $2 is the name of the recipient.
- If you use this with FEATURE(`local_procmail'), the FEATURE
- should be listed first.
-
-mail11 The DECnet mail11 mailer, useful only if you have the mail11
- program from gatekeeper.dec.com:/pub/DEC/gwtools (and
- DECnet, of course). This is for Phase IV DECnet support;
- if you have Phase V at your site you may have additional
- problems.
-
-phquery The phquery program. This is somewhat counterintuitively
- referenced as the "ph" mailer internally. It can be used
- to do CCSO name server lookups. The phquery program, which
- this mailer uses, is distributed with the ph client.
-
-cyrus The cyrus and cyrusbb mailers. The cyrus mailer delivers to
- a local cyrus user. this mailer can make use of the
- "user+detail@local.host" syntax; it will deliver the mail to
- the user's "detail" mailbox if the mailbox's ACL permits.
- The cyrusbb mailer delivers to a system-wide cyrus mailbox
- if the mailbox's ACL permits.
-
-
-The local mailer accepts addresses of the form "user+detail", where
-the "+detail" is not used for mailbox matching but is available
-to certain local mail programs (in particular, see
-FEATURE(`local_procmail')). For example, "eric", "eric+sendmail", and
-"eric+sww" all indicate the same user, but additional arguments <null>,
-"sendmail", and "sww" may be provided for use in sorting mail.
-
-
-+----------+
-| FEATURES |
-+----------+
-
-Special features can be requested using the "FEATURE" macro. For
-example, the .mc line:
-
- FEATURE(`use_cw_file')
-
-tells sendmail that you want to have it read an /etc/sendmail.cw
-file to get values for class $=w. The FEATURE may contain a single
-optional parameter -- for example:
-
- FEATURE(`mailertable', `dbm /usr/lib/mailertable')
-
-The default database map type for the table features can be set with
-
- define(`DATABASE_MAP_TYPE', `dbm')
-
-which would set it to use ndbm databases. The default is the Berkeley DB
-hash database format. Note that you must still declare a database map type
-if you specify an argument to a FEATURE. DATABASE_MAP_TYPE is only used
-if no argument is given for the FEATURE.
-
-Available features are:
-
-use_cw_file Read the file /etc/sendmail.cw file to get alternate
- names for this host. This might be used if you were
- on a host that MXed for a dynamic set of other
- hosts. If the set is static, just including the line
- "Cw<name1> <name2> ..." (where the names are fully
- qualified domain names) is probably superior.
- The actual filename can be overridden by redefining
- confCW_FILE.
-
-use_ct_file Read the file /etc/sendmail.ct file to get the names
- of users that will be ``trusted'', that is, able to
- set their envelope from address using -f without
- generating a warning message.
- The actual filename can be overridden by redefining
- confCT_FILE.
-
-redirect Reject all mail addressed to "address.REDIRECT" with
- a ``551 User not local; please try <address>'' message.
- If this is set, you can alias people who have left
- to their new address with ".REDIRECT" appended.
-
-nouucp Don't do anything special with UUCP addresses at all.
-
-nocanonify Don't pass addresses to $[ ... $] for canonification.
- This would generally only be used by sites that only
- act as mail gateways or which have user agents that do
- full canonification themselves. You may also want to
- use "define(`confBIND_OPTS',`-DNSRCH -DEFNAMES')" to
- turn off the usual resolver options that do a similar
- thing.
-
-stickyhost If set, email sent to "user@local.host" are marked
- as "sticky" -- that is, the local addresses aren't
- matched against UDB and don't go through ruleset 5.
- This is used if you want a set up where "user" is
- not necessarily the same as "user@local.host", e.g.,
- to make a distinct domain-wide namespace. Prior to
- 8.7 this was the default, and notsticky was used to
- turn this off.
-
-mailertable Include a "mailer table" which can be used to override
- routing for particular domains. The argument of the
- FEATURE may be the key definition. If none is specified,
- the definition used is:
-
- hash -o /etc/mailertable
-
- Keys in this database are fully qualified domain names
- or partial domains preceded by a dot -- for example,
- "vangogh.CS.Berkeley.EDU" or ".CS.Berkeley.EDU".
- Values must be of the form:
- mailer:domain
- where "mailer" is the internal mailer name, and "domain"
- is where to send the message. These maps are not
- reflected into the message header. As a special case,
- the forms:
- local:user
- will forward to the indicated user using the local mailer,
- local:
- will forward to the original user in the e-mail address
- using the local mailer, and
- error:code message
- will give an error message with the indicated code and
- message.
-
-domaintable Include a "domain table" which can be used to provide
- domain name mapping. Use of this should really be
- limited to your own domains. It may be useful if you
- change names (e.g., your company changes names from
- oldname.com to newname.com). The argument of the
- FEATURE may be the key definition. If none is specified,
- the definition used is:
-
- hash -o /etc/domaintable
-
- The key in this table is the domain name; the value is
- the new (fully qualified) domain. Anything in the
- domaintable is reflected into headers; that is, this
- is done in ruleset 3.
-
-bitdomain Look up bitnet hosts in a table to try to turn them into
- internet addresses. The table can be built using the
- bitdomain program contributed by John Gardiner Myers.
- The argument of the FEATURE may be the key definition; if
- none is specified, the definition used is:
-
- hash -o /etc/bitdomain.db
-
- Keys are the bitnet hostname; values are the corresponding
- internet hostname.
-
-uucpdomain Similar feature for UUCP hosts. The default map definition
- is:
-
- hash -o /etc/uudomain.db
-
- At the moment there is no automagic tool to build this
- database.
-
-always_add_domain
- Include the local host domain even on locally delivered
- mail. Normally it is not added on unqualified names.
- However, if you use a shared message store but do not use
- the same user name space everywhere, you may need the host
- name on local names.
-
-allmasquerade If masquerading is enabled (using MASQUERADE_AS), this
- feature will cause recipient addresses to also masquerade
- as being from the masquerade host. Normally they get
- the local hostname. Although this may be right for
- ordinary users, it can break local aliases. For example,
- if you send to "localalias", the originating sendmail will
- find that alias and send to all members, but send the
- message with "To: localalias@masqueradehost". Since that
- alias likely does not exist, replies will fail. Use this
- feature ONLY if you can guarantee that the ENTIRE
- namespace on your masquerade host supersets all the
- local entries.
-
-limited_masquerade
- Normally, any hosts listed in $=w are masqueraded. If this
- feature is given, only the hosts listed in $=M are masqueraded.
- This is useful if you have several domains with disjoint
- namespaces hosted on the same machine.
-
-masquerade_entire_domain
- If masquerading is enabled (using MASQUERADE_AS) and
- MASQUERADE_DOMAIN (see below) is set, this feature will
- cause addresses to be rewritten such that the masquerading
- domains are actually entire domains to be hidden. All
- hosts within the masquerading domains will be rewritten
- to the masquerade name (used in MASQUERADE_AS). For example,
- if you have:
-
- MASQUERADE_AS(masq.com)
- MASQUERADE_DOMAIN(foo.org)
- MASQUERADE_DOMAIN(bar.com)
-
- then *foo.org and *bar.com are converted to masq.com. Without
- this feature, only foo.org and bar.com are masqueraded.
-
- NOTE: only domains within your jurisdiction and
- current hierarchy should be masqueraded using this.
-
-genericstable This feature will cause certain addresses originating locally
- (i.e. that are unqualified) or a domain listed in $=G to be
- looked up in a map and turned into another ("generic") form,
- which can change both the domain name and the user name. This
- is similar to the userdb functionality. The same types of
- addresses as for masquerading are looked up, i.e. only header
- sender addresses unless the allmasquerade and/or
- masquerade_envelope features are given. Qualified addresses
- must have the domain part in the list of names given by the
- by the macros GENERICS_DOMAIN or GENERICS_DOMAIN_FILE
- (analogously to MASQUERADE_DOMAIN and MASQUERADE_DOMAIN_FILE,
- see below).
-
- The argument of FEATURE(`genericstable') may be the map
- definition; the default map definition is:
-
- hash -o /etc/genericstable
-
- The key for this table is either the full address or the
- unqualified username (the former is tried first); the
- value is the new user address. If the new user address does
- not include a domain, it will be qualified in the standard
- manner, i.e. using $j or the masquerade name. Note that the
- address being looked up must be fully qualified. For local
- mail, it is necessary to use FEATURE(`always_add_domain')
- for the addresses to be qualified.
-
-virtusertable A domain-specific form of aliasing, allowing multiple
- virtual domains to be hosted on one machine. For example,
- if the virtuser table contained:
-
- info@foo.com foo-info
- info@bar.com bar-info
- @baz.org jane@elsewhere.net
-
- then mail addressed to info@foo.com will be sent to the
- address foo-info, mail addressed to info@bar.com will be
- delivered to bar-info, and mail addressed to anyone at
- baz.org will be sent to jane@elsewhere.net. The username
- from the original address is passed as %1 allowing:
-
- @foo.org %1@elsewhere.com
-
- meaning someone@foo.org will be sent to someone@elsewhere.com.
-
- All the host names on the left hand side (foo.com, bar.com,
- and baz.org) must be in $=w. The default map definition is:
-
- hash -o /etc/virtusertable
-
- A new definition can be specified as the second argument of
- the FEATURE macro, such as
-
- FEATURE(`virtusertable', `dbm -o /etc/mail/virtusers')
-
-nodns We aren't running DNS at our site (for example,
- we are UUCP-only connected). It's hard to consider
- this a "feature", but hey, it had to go somewhere.
- Actually, as of 8.7 this is a no-op -- remove "dns" from
- the hosts service switch entry instead.
-
-nullclient This is a special case -- it creates a stripped down
- configuration file containing nothing but support for
- forwarding all mail to a central hub via a local
- SMTP-based network. The argument is the name of that
- hub.
-
- The only other feature that should be used in conjunction
- with this one is "nocanonify" (this causes addresses to
- be sent unqualified via the SMTP connection; normally
- they are qualified with the masquerade name, which
- defaults to the name of the hub machine). No mailers
- should be defined. No aliasing or forwarding is done.
- Also, note that absolutely no anti-spam or anti-relaying
- is done in a null client configuration. More information
- can be found in the ANTI-SPAM CONFIGURATION CONTROL section.
-
-local_lmtp Use an LMTP capable local mailer. The argument to this
- feature is the pathname of an LMTP capable mailer. By
- default, mail.local is used. This is expected to be the
- mail.local which came with the 8.9 distribution which is
- LMTP capable. The path to mail.local is set by the
- confEBINDIR m4 variable -- making the default
- LOCAL_MAILER_PATH /usr/libexec/mail.local.
-
-local_procmail Use procmail as the local mailer. This mailer can
- make use of the "user+indicator@local.host" syntax;
- normally the +indicator is just tossed, but by default
- it is passed as the -a argument to procmail. The
- argument to this feature is the pathname of procmail,
- which defaults to PROCMAIL_MAILER_PATH. Note that this
- does NOT use PROCMAIL_MAILER_FLAGS or PROCMAIL_MAILER_ARGS
- for the local mailer; tweak LOCAL_MAILER_FLAGS and
- LOCAL_MAILER_ARGS instead.
-
-bestmx_is_local Accept mail as though locally addressed for any host that
- lists us as the best possible MX record. This generates
- additional DNS traffic, but should be OK for low to
- medium traffic hosts. The argument may be a set of
- domains, which will limit the feature to only apply to
- these domains -- this will reduce unnecessary DNS
- traffic. THIS FEATURE IS FUNDAMENTALLY INCOMPATIBLE WITH
- WILDCARD MX RECORDS!!! If you have a wildcard MX record
- that matches your domain, you cannot use this feature.
-
-smrsh Use the SendMail Restricted SHell (smrsh) provided
- with the distribution instead of /bin/sh for mailing
- to programs. This improves the ability of the local
- system administrator to control what gets run via
- e-mail. If an argument is provided it is used as the
- pathname to smrsh; otherwise, the path defined by
- confEBINDIR is used for the smrsh binary -- by default,
- /usr/libexec/smrsh is assumed.
-
-promiscuous_relay
- By default, the sendmail configuration files do not permit
- mail relaying (that is, accepting mail from outside your
- domain and sending it to another host outside your domain).
- This option sets your site to allow mail relaying from any
- site to any site. In general, it is better to control the
- relaying more carefully with the access db and the 'R'
- class ($=R). Domains can be added to class 'R' by the
- macros RELAY_DOMAIN or RELAY_DOMAIN_FILE (analogously to
- MASQUERADE_DOMAIN and MASQUERADE_DOMAIN_FILE, see below).
-
-relay_entire_domain
- By default, only hosts listed as RELAY in the access db
- will be allowed to relay. This option also allows any
- host in your domain as defined by the 'm' class ($=m).
-
-relay_hosts_only
- By default, names that are listed as RELAY in the access
- db and class 'R' ($=R) are domain names, not host names.
- For example, if you specify ``foo.com'', then mail to or
- from foo.com, abc.foo.com, or a.very.deep.domain.foo.com
- will all be accepted for relaying. This feature changes
- the behaviour to lookup individual host names only.
-
-relay_based_on_MX
- Turns on the ability to allow relaying based on the MX
- records of the host portion of an incoming recipient; that
- is, if an MX record for host foo.com points to your site,
- you will accept and relay mail addressed to foo.com. See
- description below for more information before using this
- feature. Also, see the KNOWNBUGS entry regarding bestmx
- map lookups.
-
- FEATURE(`relay_based_on_MX') does not necessarily allow
- routing of these messages which you expect to be allowed,
- if route address syntax (or %-hack syntax) is used. If
- this is a problem, add entries to the access-table or use
- FEATURE(`loose_relay_check').
-
-relay_local_from
- Allows relaying if the domain portion of the mail sender
- is a local host. This should only be used if absolutely
- necessary as it opens a window for spammers. Specifically,
- they can send mail to your mail server that claims to be
- from your domain (either directly or via a routed address),
- and you will go ahead and relay it out to arbitrary hosts
- on the Internet.
-
-accept_unqualified_senders
- Normally, MAIL FROM: commands in the SMTP session will be
- refused if the connection is a network connection and the
- sender address does not include a domain name. If your
- setup sends local mail unqualified (i.e. MAIL FROM: <joe>),
- you will need to use this feature to accept unqualified
- sender addresses.
-
-accept_unresolvable_domains
- Normally, MAIL FROM: commands in the SMTP session will be
- refused if the host part of the argument to MAIL FROM: cannot
- be located in the host name service (e.g., DNS). If you are
- inside a firewall that has only a limited view of the
- Internet host name space, this could cause problems. In this
- case you probably want to use this feature to accept all
- domains on input, even if they are unresolvable.
-
-access_db Turns on the access database feature. The access db gives
- you the ability to allow or refuse to accept mail from
- specified domains for administrative reasons. By default,
- the access database specification is:
-
- hash -o /etc/mail/access
-
- The format of the database is described below.
-
-blacklist_recipients
- Turns on the ability to block incoming mail for certain
- recipient usernames, hostnames, or addresses. For
- example, you can block incoming mail to user nobody,
- host foo.mydomain.com, or guest@bar.mydomain.com.
- These specifications are put in the access db as
- described below.
-
-rbl Turns on rejection of hosts found in the Realtime Blackhole
- List. If an argument is provided it is used as the
- name sever to contact; otherwise, the main RBL server at
- rbl.maps.vix.com is used. For details, see
- http://maps.vix.com/rbl/.
-
-loose_relay_check
- Normally, if a recipient using % addressing is used, e.g.
- user%site@othersite, and othersite is in class 'R', the
- check_rcpt ruleset will strip @othersite and recheck
- user@site for relaying. This feature changes that
- behavior. It should not be needed for most installations.
-
-
-+-------+
-| HACKS |
-+-------+
-
-Some things just can't be called features. To make this clear,
-they go in the hack subdirectory and are referenced using the HACK
-macro. These will tend to be site-dependent. The release
-includes the Berkeley-dependent "cssubdomain" hack (that makes
-sendmail accept local names in either Berkeley.EDU or CS.Berkeley.EDU;
-this is intended as a short-term aid while we move hosts into
-subdomains.
-
-
-+--------------------+
-| SITE CONFIGURATION |
-+--------------------+
-
- *****************************************************
- * This section is really obsolete, and is preserved *
- * only for back compatibility. You should plan on *
- * using mailertables for new installations. In *
- * particular, it doesn't work for the newer forms *
- * of UUCP mailers, such as uucp-uudom. *
- *****************************************************
-
-Complex sites will need more local configuration information, such as
-lists of UUCP hosts they speak with directly. This can get a bit more
-tricky. For an example of a "complex" site, see cf/ucbvax.mc.
-
-If your host is known by several different names, you need to augment
-the $=w class. This is a list of names by which you are known, and
-anything sent to an address using a host name in this list will be
-treated as local mail. You can do this in two ways: either create
-the file /etc/sendmail.cw containing a list of your aliases (one per
-line), and use ``FEATURE(`use_cw_file')'' in the .mc file, or add the
-line:
-
- Cw alias.host.name
-
-at the end of that file. See the ``vangogh.mc'' file for an example.
-Be sure you use the fully-qualified name of the host, rather than a
-short name.
-
-The SITECONFIG macro allows you to indirectly reference site-dependent
-configuration information stored in the siteconfig subdirectory. For
-example, the line
-
- SITECONFIG(uucp.ucbvax, ucbvax, U)
-
-reads the file uucp.ucbvax for local connection information. The
-second parameter is the local name (in this case just "ucbvax" since
-it is locally connected, and hence a UUCP hostname). The third
-parameter is the name of both a macro to store the local name (in
-this case, $U) and the name of the class (e.g., $=U) in which to store
-the host information read from the file. Another SITECONFIG line reads
-
- SITECONFIG(uucp.ucbarpa, ucbarpa.Berkeley.EDU, W)
-
-This says that the file uucp.ucbarpa contains the list of UUCP sites
-connected to ucbarpa.Berkeley.EDU. The $=W class will be used to
-store this list, and $W is defined to be ucbarpa.Berkeley.EDU, that
-is, the name of the relay to which the hosts listed in uucp.ucbarpa
-are connected. [The machine ucbarpa is gone now, but I've left
-this out-of-date configuration file around to demonstrate how you
-might do this.]
-
-Note that the case of SITECONFIG with a third parameter of ``U'' is
-special; the second parameter is assumed to be the UUCP name of the
-local site, rather than the name of a remote site, and the UUCP name
-is entered into $=w (the list of local hostnames) as $U.UUCP.
-
-The siteconfig file (e.g., siteconfig/uucp.ucbvax.m4) contains nothing
-more than a sequence of SITE macros describing connectivity. For
-example:
-
- SITE(cnmat)
- SITE(sgi olympus)
-
-The second example demonstrates that you can use two names on the
-same line; these are usually aliases for the same host (or are at
-least in the same company).
-
-
-+--------------------+
-| USING UUCP MAILERS |
-+--------------------+
-
-It's hard to get UUCP mailers right because of the extremely ad hoc
-nature of UUCP addressing. These config files are really designed
-for domain-based addressing, even for UUCP sites.
-
-There are four UUCP mailers available. The choice of which one to
-use is partly a matter of local preferences and what is running at
-the other end of your UUCP connection. Unlike good protocols that
-define what will go over the wire, UUCP uses the policy that you
-should do what is right for the other end; if they change, you have
-to change. This makes it hard to do the right thing, and discourages
-people from updating their software. In general, if you can avoid
-UUCP, please do.
-
-The major choice is whether to go for a domainized scheme or a
-non-domainized scheme. This depends entirely on what the other
-end will recognize. If at all possible, you should encourage the
-other end to go to a domain-based system -- non-domainized addresses
-don't work entirely properly.
-
-The four mailers are:
-
- uucp-old (obsolete name: "uucp")
- This is the oldest, the worst (but the closest to UUCP) way of
- sending messages accros UUCP connections. It does bangify
- everything and prepends $U (your UUCP name) to the sender's
- address (which can already be a bang path itself). It can
- only send to one address at a time, so it spends a lot of
- time copying duplicates of messages. Avoid this if at all
- possible.
-
- uucp-new (obsolete name: "suucp")
- The same as above, except that it assumes that in one rmail
- command you can specify several recipients. It still has a
- lot of other problems.
-
- uucp-dom
- This UUCP mailer keeps everything as domain addresses.
- Basically, it uses the SMTP mailer rewriting rules. This mailer
- is only included if MAILER(smtp) is also specified.
-
- Unfortunately, a lot of UUCP mailer transport agents require
- bangified addresses in the envelope, although you can use
- domain-based addresses in the message header. (The envelope
- shows up as the From_ line on UNIX mail.) So....
-
- uucp-uudom
- This is a cross between uucp-new (for the envelope addresses)
- and uucp-dom (for the header addresses). It bangifies the
- envelope sender (From_ line in messages) without adding the
- local hostname, unless there is no host name on the address
- at all (e.g., "wolf") or the host component is a UUCP host name
- instead of a domain name ("somehost!wolf" instead of
- "some.dom.ain!wolf"). This is also included only if MAILER(smtp)
- is also specified.
-
-Examples:
-
-We are on host grasp.insa-lyon.fr (UUCP host name "grasp"). The
-following summarizes the sender rewriting for various mailers.
-
-Mailer sender rewriting in the envelope
------- ------ -------------------------
-uucp-{old,new} wolf grasp!wolf
-uucp-dom wolf wolf@grasp.insa-lyon.fr
-uucp-uudom wolf grasp.insa-lyon.fr!wolf
-
-uucp-{old,new} wolf@fr.net grasp!fr.net!wolf
-uucp-dom wolf@fr.net wolf@fr.net
-uucp-uudom wolf@fr.net fr.net!wolf
-
-uucp-{old,new} somehost!wolf grasp!somehost!wolf
-uucp-dom somehost!wolf somehost!wolf@grasp.insa-lyon.fr
-uucp-uudom somehost!wolf grasp.insa-lyon.fr!somehost!wolf
-
-If you are using one of the domainized UUCP mailers, you really want
-to convert all UUCP addresses to domain format -- otherwise, it will
-do it for you (and probably not the way you expected). For example,
-if you have the address foo!bar!baz (and you are not sending to foo),
-the heuristics will add the @uucp.relay.name or @local.host.name to
-this address. However, if you map foo to foo.host.name first, it
-will not add the local hostname. You can do this using the uucpdomain
-feature.
-
-
-+-------------------+
-| TWEAKING RULESETS |
-+-------------------+
-
-For more complex configurations, you can define special rules.
-The macro LOCAL_RULE_3 introduces rules that are used in canonicalizing
-the names. Any modifications made here are reflected in the header.
-
-A common use is to convert old UUCP addresses to SMTP addresses using
-the UUCPSMTP macro. For example:
-
- LOCAL_RULE_3
- UUCPSMTP(decvax, decvax.dec.com)
- UUCPSMTP(research, research.att.com)
-
-will cause addresses of the form "decvax!user" and "research!user"
-to be converted to "user@decvax.dec.com" and "user@research.att.com"
-respectively.
-
-This could also be used to look up hosts in a database map:
-
- LOCAL_RULE_3
- R$* < @ $+ > $* $: $1 < @ $(hostmap $2 $) > $3
-
-This map would be defined in the LOCAL_CONFIG portion, as shown below.
-
-Similarly, LOCAL_RULE_0 can be used to introduce new parsing rules.
-For example, new rules are needed to parse hostnames that you accept
-via MX records. For example, you might have:
-
- LOCAL_RULE_0
- R$+ <@ host.dom.ain.> $#uucp $@ cnmat $: $1 < @ host.dom.ain.>
-
-You would use this if you had installed an MX record for cnmat.Berkeley.EDU
-pointing at this host; this rule catches the message and forwards it on
-using UUCP.
-
-You can also tweak rulesets 1 and 2 using LOCAL_RULE_1 and LOCAL_RULE_2.
-These rulesets are normally empty.
-
-A similar macro is LOCAL_CONFIG. This introduces lines added after the
-boilerplate option setting but before rulesets, and can be used to
-declare local database maps or whatever. For example:
-
- LOCAL_CONFIG
- Khostmap hash /etc/hostmap.db
- Kyplocal nis -m hosts.byname
-
-
-+---------------------------+
-| MASQUERADING AND RELAYING |
-+---------------------------+
-
-You can have your host masquerade as another using
-
- MASQUERADE_AS(host.domain)
-
-This causes mail being sent to be labeled as coming from the
-indicated host.domain, rather than $j. One normally masquerades as
-one of one's own subdomains (for example, it's unlikely that I would
-choose to masquerade as an MIT site). This behaviour is modified by
-a plethora of FEATUREs; in particular, see masquerade_envelope,
-allmasquerade, limited_masquerade, and masquerade_entire_domain.
-
-The masquerade name is not normally canonified, so it is important
-that it be your One True Name, that is, fully qualified and not a
-CNAME. However, if you use a CNAME, the receiving side may canonify
-it for you, so don't think you can cheat CNAME mapping this way.
-
-Normally the only addresses that are masqueraded are those that come
-from this host (that is, are either unqualified or in $=w, the list
-of local domain names). You can augment this list using
-
- MASQUERADE_DOMAIN(otherhost.domain)
-
-The effect of this is that although mail to user@otherhost.domain
-will not be delivered locally, any mail including any user@otherhost.domain
-will, when relayed, be rewritten to have the MASQUERADE_AS address.
-This can be a space-separated list of names.
-
-If these names are in a file, you can use
-
- MASQUERADE_DOMAIN_FILE(filename)
-
-to read the list of names from the indicated file.
-
-Normally only header addresses are masqueraded. If you want to
-masquerade the envelope as well, use
-
- FEATURE(`masquerade_envelope')
-
-There are always users that need to be "exposed" -- that is, their
-internal site name should be displayed instead of the masquerade name.
-Root is an example. You can add users to this list using
-
- EXPOSED_USER(usernames)
-
-This adds users to class E; you could also use something like
-
- FE/etc/sendmail.cE
-
-You can also arrange to relay all unqualified names (that is, names
-without @host) to a relay host. For example, if you have a central
-email server, you might relay to that host so that users don't have
-to have .forward files or aliases. You can do this using
-
- define(`LOCAL_RELAY', `mailer:hostname')
-
-The ``mailer:'' can be omitted, in which case the mailer defaults to
-"relay". There are some user names that you don't want relayed, perhaps
-because of local aliases. A common example is root, which may be
-locally aliased. You can add entries to this list using
-
- LOCAL_USER(usernames)
-
-This adds users to class L; you could also use something like
-
- FL/etc/sendmail.cL
-
-If you want all incoming mail sent to a centralized hub, as for a
-shared /var/spool/mail scheme, use
-
- define(`MAIL_HUB', `mailer:hostname')
-
-Again, ``mailer:'' defaults to "relay". If you define both LOCAL_RELAY
-and MAIL_HUB _AND_ you have FEATURE(`stickyhost'), unqualified names will
-be sent to the LOCAL_RELAY and other local names will be sent to MAIL_HUB.
-Names in $=L will be delivered locally, so you MUST have aliases or
-.forward files for them.
-
-For example, if you are on machine mastodon.CS.Berkeley.EDU and you have
-FEATURE(`stickyhost'), the following combinations of settings will have the
-indicated effects:
-
-email sent to.... eric eric@mastodon.CS.Berkeley.EDU
-
-LOCAL_RELAY set to mail.CS.Berkeley.EDU (delivered locally)
-mail.CS.Berkeley.EDU (no local aliasing) (aliasing done)
-
-MAIL_HUB set to mammoth.CS.Berkeley.EDU mammoth.CS.Berkeley.EDU
-mammoth.CS.Berkeley.EDU (aliasing done) (aliasing done)
-
-Both LOCAL_RELAY and mail.CS.Berkeley.EDU mammoth.CS.Berkeley.EDU
-MAIL_HUB set as above (no local aliasing) (aliasing done)
-
-If you do not have FEATURE(`stickyhost') set, then LOCAL_RELAY and
-MAIL_HUB act identically, with MAIL_HUB taking precedence.
-
-If you want all outgoing mail to go to a central relay site, define
-SMART_HOST as well. Briefly:
-
- LOCAL_RELAY applies to unqualified names (e.g., "eric").
- MAIL_HUB applies to names qualified with the name of the
- local host (e.g., "eric@mastodon.CS.Berkeley.EDU").
- SMART_HOST applies to names qualified with other hosts.
-
-However, beware that other relays (e.g., UUCP_RELAY, BITNET_RELAY,
-DECNET_RELAY, and FAX_RELAY) take precedence over SMART_HOST, so if you
-really want absolutely everything to go to a single central site you will
-need to unset all the other relays -- or better yet, find or build a
-minimal config file that does this.
-
-For duplicate suppression to work properly, the host name is best
-specified with a terminal dot:
-
- define(`MAIL_HUB', `host.domain.')
- note the trailing dot ---^
-
-
-+---------------------------------+
-| ANTI-SPAM CONFIGURATION CONTROL |
-+---------------------------------+
-
-The primary anti-spam features available in sendmail are:
-
-* Relaying is denied by default.
-* Better checking on sender information.
-* Access database.
-* Header checks.
-
-Relaying (transmission of messages from a site outside your domain to
-another site outside your domain) is denied by default. Note that
-this changed in sendmail 8.9; previous versions allowed relaying by
-default. If you want to revert to the old behaviour, you will need
-to use FEATURE(`promiscuous_relay'). You can allow certain domains to
-relay through your server by adding their domain name or IP address to
-class 'R' ($=R) using RELAY_DOMAIN() and RELAY_DOMAIN_FILE() or via the
-access database (described below).
-
-If you use
-
- FEATURE(`relay_entire_domain')
-
-then any host in any of your local domains (that is, the $=m class)
-will be relayed (that is, you will accept mail either to or from any
-host in your domain).
-
-You can also allow relaying based on the MX records of the host
-portion of an incoming recipient address by using
-
- FEATURE(`relay_based_on_MX')
-
-For example, if your server receives a recipient of user@domain.com
-and domain.com lists your server in its MX records, the mail will be
-accepted for relay to domain.com. Note that this will stop spammers
-from using your host to relay spam but it will not stop outsiders from
-using your server as a relay for their site (that is, they set up an
-MX record pointing to your mail server, and you will relay mail addressed
-to them without any prior arrangement). Along the same lines,
-
- FEATURE(`relay_local_from')
-
-will allow relaying if the sender specifies a return path (i.e.
-MAIL FROM: <user@domain>) domain which is a local domain. This a
-dangerous feature as it will allow spammers to spam using your mail
-server by simply specifying a return address of user@your.domain.com.
-It should not be used unless absolutely necessary.
-
-If source routing is used in the recipient address (i.e.
-RCPT TO: <user%site.com@othersite.com>), sendmail will check
-user@site.com for relaying if othersite.com is an allowed relay host
-in either class 'R', class 'm' if FEATURE(`relay_entire_domain') is used,
-or the access database if FEATURE(`access_db') is used. To prevent
-the address from being stripped down, use:
-
- FEATURE(`loose_relay_check')
-
-If you think you need to use this feature, you probably do not. This
-should only be used for sites which have no control over the addresses
-that they provide a gateway for. Use this FEATURE with caution as it
-can allow spammers to relay through your server if not setup properly.
-
-As of 8.9, sendmail will refuse mail if the MAIL FROM: parameter has
-an unresolvable domain (i.e., one that DNS, your local name service,
-or special case rules in ruleset 3 cannot locate). If you want to
-continue to accept such domains, e.g. because you are inside a
-firewall that has only a limited view of the Internet host name space
-(note that you will not be able to return mail to them unless you have
-some "smart host" forwarder), use
-
- FEATURE(`accept_unresolvable_domains')
-
-sendmail will also refuse mail if the MAIL FROM: parameter is not
-fully qualified (i.e., contains a domain as well as a user). If you
-want to continue to accept such senders, use
-
- FEATURE(`accept_unqualified_senders')
-
-An ``access'' database can be created to accept or reject mail from
-selected domains. For example, you may choose to reject all mail
-originating from known spammers. To enable such a database, use
-
- FEATURE(`access_db')
-
-The FEATURE macro can accept a second parameter giving the key file
-definition for the database; for example
-
- FEATURE(`access_db', `hash -o /etc/mail/access')
-
-Remember, since /etc/mail/access is a database, after creating the text
-file as described below, you must use makemap to create the database
-map. For example:
-
- makemap hash /etc/mail/access < /etc/mail/access
-
-The table itself uses e-mail addresses, domain names, and network
-numbers as keys. For example,
-
- spammer@aol.com REJECT
- cyberspammer.com REJECT
- 192.168.212 REJECT
-
-would refuse mail from spammer@aol.com, any user from cyberspammer.com
-(or any host within the cyberspammer.com domain), and any host on the
-192.168.212.* network.
-
-The value part of the map can contain:
-
- OK Accept mail even if other rules in the
- running ruleset would reject it, for example,
- if the domain name is unresolvable.
- RELAY Accept mail addressed to the indicated domain or
- received from the indicated domain for relaying
- through your SMTP server. RELAY also serves as
- an implicit OK for the other checks.
- REJECT Reject the sender or recipient with a general
- purpose message.
- DISCARD Discard the message completely using the
- $#discard mailer. This only works for sender
- addresses (i.e., it indicates that you should
- discard anything received from the indicated
- domain).
- ### any text where ### is an RFC 821 compliant error code
- and "any text" is a message to return for
- the command.
-
-For example:
-
- cyberspammer.com 550 We don't accept mail from spammers
- okay.cyberspammer.com OK
- sendmail.org OK
- 128.32 RELAY
-
-would accept mail from okay.cyberspammer.com, but would reject mail
-from all other hosts at cyberspammer.com with the indicated message.
-It would allow accept mail from any hosts in the sendmail.org domain,
-and allow relaying for the 128.32.*.* network. Note, UUCP users may
-need to add hostname.UUCP to the access database or class 'R' ($=R).
-If you also use:
-
- FEATURE(`relay_hosts_only')
-
-then the above example will allow relaying for sendmail.org, but not
-hosts within the sendmail.org domain. Note that this will also require
-hosts listed in class 'R' ($=R) to be fully qualified host names.
-
-You can also use the access database to block sender addresses based on
-the username portion of the address. For example:
-
- FREE.STEALTH.MAILER@ 550 Spam not accepted
-
-Note that you must include the @ after the username to signify that
-this database entry is for checking only the username portion of the
-sender address.
-
-If you use:
-
- FEATURE(`blacklist_recipients')
-
-then you can add entries to the map for local users, hosts in your
-domains, or addresses in your domain which should not receive mail:
-
- badlocaluser 550 Mailbox disabled for this username
- host.mydomain.com 550 That host does not accept mail
- user@otherhost.mydomain.com 550 Mailbox disabled for this recipient
-
-This would prevent a recipient of badlocaluser@mydomain.com, any
-user at host.mydomain.com, and the single address
-user@otherhost.mydomain.com from receiving mail. Enabling this
-feature will keep you from sending mails to all addresses that
-have an error message or REJECT as value part in the access map.
-Taking the example from above:
-
- spammer@aol.com REJECT
- cyberspammer.com REJECT
-
-Mail can't be sent to spammer@aol.com or anyone at cyberspammer.com.
-
-There is also a ``Realtime Blackhole List'' run by the MAPS project
-at http://maps.vix.com/. This is a database maintained in DNS of
-spammers. To use this database, use
-
- FEATURE(`rbl')
-
-This will cause sendmail to reject mail from any site in the
-Realtime Blackhole List database. You can specify an alternative
-RBL name server to contact by specifying an argument to the FEATURE.
-
-The features described above make use of the check_relay, check_mail,
-and check_rcpt rulesets. If you wish to include your own checks,
-you can put your checks in the rulesets Local_check_relay,
-Local_check_mail, and Local_check_rcpt. For example if you wanted to
-block senders with all numeric usernames (i.e. 2312343@bigisp.com),
-you would use Local_check_mail and the new regex map:
-
- LOCAL_CONFIG
- Kallnumbers regex -a@MATCH ^[0-9]+$
-
- LOCAL_RULESETS
- SLocal_check_mail
- # check address against various regex checks
- R$* $: $>Parse0 $>3 $1
- R$+ < @ bigisp.com. > $* $: $(allnumbers $1 $)
- R@MATCH $#error $: 553 Header Error
-
-These rules are called with the original arguments of the corresponding
-check_* ruleset. If the local ruleset returns $#OK, no further checking
-is done by the features described above and the mail is accepted. If the
-local ruleset resolves to a mailer (such as $#error or $#discard), the
-appropriate action is taken. Otherwise, the results of the local
-rewriting are ignored.
-
-
-You can also reject mail on the basis of the contents of headers.
-This is done by adding a ruleset call to the 'H' header definition command
-in sendmail.cf. For example, this can be used to check the validity of
-a Message-ID: header:
-
- LOCAL_RULESETS
- HMessage-Id: $>CheckMessageId
-
- SCheckMessageId
- R< $+ @ $+ > $@ OK
- R$* $#error $: 553 Header Error
-
-Users of FEATURE(`nullclient') who desire to use the anti-spam and
-anti-relaying capabilities should replace FEATURE(`nullclient', `mailhub')
-with:
-
- undefine(`ALIAS_FILE')
- define(`MAIL_HUB', `mailhub')
- define(`SMART_HOST', `mailhub')
- define(`confFORWARD_PATH', `')
-
-where mailhub is the fully qualified hostname for their mail server.
-The above rules will provide the relaying to the mailhub without local
-alias and forward file expansion. To match the other behavior of
-FEATURE(`nullclient'), you should also add these lines along with those
-listed above:
-
- MASQUERADE_AS(`mailhub')
- FEATURE(`allmasquerade')
- FEATURE(`masquerade_envelope')
-
-
-+--------------------------------+
-| ADDING NEW MAILERS OR RULESETS |
-+--------------------------------+
-
-Sometimes you may need to add entirely new mailers or rulesets. They
-should be introduced with the constructs MAILER_DEFINITIONS and
-LOCAL_RULESETS respectively. For example:
-
- MAILER_DEFINITIONS
- Mmymailer, ...
- ...
-
- LOCAL_RULESETS
- Smyruleset
- ...
-
-
-+-------------------------------+
-| NON-SMTP BASED CONFIGURATIONS |
-+-------------------------------+
-
-These configuration files are designed primarily for use by SMTP-based
-sites. I don't pretend that they are well tuned for UUCP-only or
-UUCP-primarily nodes (the latter is defined as a small local net
-connected to the rest of the world via UUCP). However, there is one
-hook to handle some special cases.
-
-You can define a ``smart host'' that understands a richer address syntax
-using:
-
- define(`SMART_HOST', `mailer:hostname')
-
-In this case, the ``mailer:'' defaults to "relay". Any messages that
-can't be handled using the usual UUCP rules are passed to this host.
-
-If you are on a local SMTP-based net that connects to the outside
-world via UUCP, you can use LOCAL_NET_CONFIG to add appropriate rules.
-For example:
-
- define(`SMART_HOST', `suucp:uunet')
- LOCAL_NET_CONFIG
- R$* < @ $* .$m. > $* $#smtp $@ $2.$m. $: $1 < @ $2.$m. > $3
-
-This will cause all names that end in your domain name ($m) via
-SMTP; anything else will be sent via suucp (smart UUCP) to uunet.
-If you have FEATURE(`nocanonify'), you may need to omit the dots after
-the $m. If you are running a local DNS inside your domain which is
-not otherwise connected to the outside world, you probably want to
-use:
-
- define(`SMART_HOST', `smtp:fire.wall.com')
- LOCAL_NET_CONFIG
- R$* < @ $* . > $* $#smtp $@ $2. $: $1 < @ $2. > $3
-
-That is, send directly only to things you found in your DNS lookup;
-anything else goes through SMART_HOST.
-
-You may need to turn off the anti-spam rules in order to accept
-UUCP mail with FEATURE(`promiscuous_relay') and
-FEATURE(`accept_unresolvable_domains').
-
-
-+-----------+
-| WHO AM I? |
-+-----------+
-
-Normally, the $j macro is automatically defined to be your fully
-qualified domain name (FQDN). Sendmail does this by getting your
-host name using gethostname and then calling gethostbyname on the
-result. For example, in some environments gethostname returns
-only the root of the host name (such as "foo"); gethostbyname is
-supposed to return the FQDN ("foo.bar.com"). In some (fairly rare)
-cases, gethostbyname may fail to return the FQDN. In this case
-you MUST define confDOMAIN_NAME to be your fully qualified domain
-name. This is usually done using:
-
- Dmbar.com
- define(`confDOMAIN_NAME', `$w.$m')dnl
-
-
-+--------------------+
-| USING MAILERTABLES |
-+--------------------+
-
-To use FEATURE(`mailertable'), you will have to create an external
-database containing the routing information for various domains.
-For example, a mailertable file in text format might be:
-
- .my.domain xnet:%1.my.domain
- uuhost1.my.domain suucp:uuhost1
- .bitnet smtp:relay.bit.net
-
-This should normally be stored in /etc/mailertable. The actual
-database version of the mailertable is built using:
-
- makemap hash /etc/mailertable.db < /etc/mailertable
-
-The semantics are simple. Any LHS entry that does not begin with
-a dot matches the full host name indicated. LHS entries beginning
-with a dot match anything ending with that domain name -- that is,
-they can be thought of as having a leading "*" wildcard. Matching
-is done in order of most-to-least qualified -- for example, even
-though ".my.domain" is listed first in the above example, an entry
-of "uuhost1.my.domain" will match the second entry since it is
-more explicit.
-
-The RHS should always be a "mailer:host" pair. The mailer is the
-configuration name of a mailer (that is, an `M' line in the
-sendmail.cf file). The "host" will be the hostname passed to
-that mailer. In domain-based matches (that is, those with leading
-dots) the "%1" may be used to interpolate the wildcarded part of
-the host name. For example, the first line above sends everything
-addressed to "anything.my.domain" to that same host name, but using
-the (presumably experimental) xnet mailer.
-
-In some cases you may want to temporarily turn off MX records,
-particularly on gateways. For example, you may want to MX
-everything in a domain to one machine that then forwards it
-directly. To do this, you might use the DNS configuration:
-
- *.domain. IN MX 0 relay.machine
-
-and on relay.machine use the mailertable:
-
- .domain smtp:[gateway.domain]
-
-The [square brackets] turn off MX records for this host only.
-If you didn't do this, the mailertable would use the MX record
-again, which would give you an MX loop.
-
-
-+--------------------------------+
-| USING USERDB TO MAP FULL NAMES |
-+--------------------------------+
-
-The user database was not originally intended for mapping full names
-to login names (e.g., Eric.Allman => eric), but some people are using
-it that way. (I would recommend that you set up aliases for this
-purpose instead -- since you can specify multiple alias files, this
-is fairly easy.) The intent was to locate the default maildrop at
-a site, but allow you to override this by sending to a specific host.
-
-If you decide to set up the user database in this fashion, it is
-imperative that you not use FEATURE(`stickyhost') -- otherwise,
-e-mail sent to Full.Name@local.host.name will be rejected.
-
-To build the internal form of the user database, use:
-
- makemap btree /usr/data/base.db < /usr/data/base.txt
-
-As a general rule, I am adamantly opposed to using full names as
-e-mail addresses, since they are not in any sense unique. For example,
-the Unix software-development community has two Andy Tannenbaums,
-at least two well-known Peter Deutsches, and at one time Bell Labs
-had two Stephen R. Bournes with offices along the same hallway.
-Which one will be forced to suffer the indignity of being
-Stephen_R_Bourne_2? The less famous of the two, or the one that
-was hired later?
-
-Finger should handle full names (and be fuzzy). Mail should use
-handles, and not be fuzzy. [Not that I expect anyone to pay any
-attention to my opinions.]
-
-
-+--------------------------------+
-| MISCELLANEOUS SPECIAL FEATURES |
-+--------------------------------+
-
-Plussed users
- Sometimes it is convenient to merge configuration on a
- centralized mail machine, for example, to forward all
- root mail to a mail server. In this case it might be
- useful to be able to treat the root addresses as a class
- of addresses with subtle differences. You can do this
- using plussed users. For example, a client might include
- the alias:
-
- root: root+client1@server
-
- On the server, this will match an alias for "root+client1".
- If that is not found, the alias "root+*" will be tried,
- then "root".
-
-LDAP
- For notes on use LDAP in sendmail, see
- http://www.stanford.edu/~bbense/Inst.html
-
-
-
-+----------------+
-| SECURITY NOTES |
-+----------------+
-
-A lot of sendmail security comes down to you. Sendmail 8 is much
-more careful about checking for security problems than previous
-versions, but there are some things that you still need to watch
-for. In particular:
-
-* Make sure the aliases file isn't writable except by trusted
- system personnel. This includes both the text and database
- version.
-
-* Make sure that other files that sendmail reads, such as the
- mailertable, are only writable by trusted system personnel.
-
-* The queue directory should not be world writable PARTICULARLY
- if your system allows "file giveaways" (that is, if a non-root
- user can chown any file they own to any other user).
-
-* If your system allows file giveaways, DO NOT create a publically
- writable directory for forward files. This will allow anyone
- to steal anyone else's e-mail. Instead, create a script that
- copies the .forward file from users' home directories once a
- night (if you want the non-NFS-mounted forward directory).
-
-* If your system allows file giveaways, you'll find that
- sendmail is much less trusting of :include: files -- in
- particular, you'll have to have /SENDMAIL/ANY/SHELL/ in
- /etc/shells before they will be trusted (that is, before
- files and programs listed in them will be honored).
-
-In general, file giveaways are a mistake -- if you can turn them
-off I recommend you do so.
-
-
-+--------------------------------+
-| TWEAKING CONFIGURATION OPTIONS |
-+--------------------------------+
-
-There are a large number of configuration options that don't normally
-need to be changed. However, if you feel you need to tweak them, you
-can define the following M4 variables. This list is shown in four
-columns: the name you define, the default value for that definition,
-the option or macro that is affected (either Ox for an option or Dx
-for a macro), and a brief description. Greater detail of the semantics
-can be found in the Installation and Operations Guide.
-
-Some options are likely to be deprecated in future versions -- that is,
-the option is only included to provide back-compatibility. These are
-marked with "*".
-
-Remember that these options are M4 variables, and hence may need to
-be quoted. In particular, arguments with commas will usually have to
-be ``double quoted, like this phrase'' to avoid having the comma
-confuse things. This is common for alias file definitions and for
-the read timeout.
-
-M4 Variable Name Configuration Description & [Default]
-================ ============= =======================
-confMAILER_NAME $n macro [MAILER-DAEMON] The sender name used
- for internally generated outgoing
- messages.
-confDOMAIN_NAME $j macro If defined, sets $j. This should
- only be done if your system cannot
- determine your local domain name,
- and then it should be set to
- $w.Foo.COM, where Foo.COM is your
- domain name.
-confCF_VERSION $Z macro If defined, this is appended to the
- configuration version name.
-confFROM_HEADER From: [$?x$x <$g>$|$g$.] The format of an
- internally generated From: address.
-confRECEIVED_HEADER Received:
- [$?sfrom $s $.$?_($?s$|from $.$_)
- $.by $j ($v/$Z)$?r with $r$. id $i$?u
- for $u; $|;
- $.$b]
- The format of the Received: header
- in messages passed through this host.
- It is unwise to try to change this.
-confCW_FILE Fw class [/etc/sendmail.cw] Name of file used
- to get the local additions to the $=w
- (local host names) class.
-confCT_FILE Ft class [/etc/sendmail.ct] Name of file used
- to get the local additions to the $=t
- (trusted users) class.
-confCR_FILE FR class [/etc/mail/relay-domains] Name of
- file used to get the local additions
- to the $=R (hosts allowed to relay)
- class.
-confTRUSTED_USERS Ct class [no default] Names of users to add to
- the list of trusted users. This list
- always includes root, uucp, and daemon.
- See also FEATURE(`use_ct_file').
-confSMTP_MAILER - [esmtp] The mailer name used when
- SMTP connectivity is required.
- One of "smtp", "smtp8", or "esmtp".
-confUUCP_MAILER - [uucp-old] The mailer to be used by
- default for bang-format recipient
- addresses. See also discussion of
- $=U, $=Y, and $=Z in the MAILER(uucp)
- section.
-confLOCAL_MAILER - [local] The mailer name used when
- local connectivity is required.
- Almost always "local".
-confRELAY_MAILER - [relay] The default mailer name used
- for relaying any mail (e.g., to a
- BITNET_RELAY, a SMART_HOST, or
- whatever). This can reasonably be
- "uucp-new" if you are on a
- UUCP-connected site.
-confSEVEN_BIT_INPUT SevenBitInput [False] Force input to seven bits?
-confEIGHT_BIT_HANDLING EightBitMode [pass8] 8-bit data handling
-confALIAS_WAIT AliasWait [10m] Time to wait for alias file
- rebuild until you get bored and
- decide that the apparently pending
- rebuild failed.
-confMIN_FREE_BLOCKS MinFreeBlocks [100] Minimum number of free blocks on
- queue filesystem to accept SMTP mail.
- (Prior to 8.7 this was minfree/maxsize,
- where minfree was the number of free
- blocks and maxsize was the maximum
- message size. Use confMAX_MESSAGE_SIZE
- for the second value now.)
-confMAX_MESSAGE_SIZE MaxMessageSize [infinite] The maximum size of messages
- that will be accepted (in bytes).
-confBLANK_SUB BlankSub [.] Blank (space) substitution
- character.
-confCON_EXPENSIVE HoldExpensive [False] Avoid connecting immediately
- to mailers marked expensive?
-confCHECKPOINT_INTERVAL CheckpointInterval
- [10] Checkpoint queue files every N
- recipients.
-confDELIVERY_MODE DeliveryMode [background] Default delivery mode.
-confAUTO_REBUILD AutoRebuildAliases
- [False] Automatically rebuild alias
- file if needed.
-confERROR_MODE ErrorMode [print] Error message mode.
-confERROR_MESSAGE ErrorHeader [undefined] Error message header/file.
-confSAVE_FROM_LINES SaveFromLine Save extra leading From_ lines.
-confTEMP_FILE_MODE TempFileMode [0600] Temporary file mode.
-confMATCH_GECOS MatchGECOS [False] Match GECOS field.
-confMAX_HOP MaxHopCount [25] Maximum hop count.
-confIGNORE_DOTS* IgnoreDots [False; always False in -bs or -bd mode]
- Ignore dot as terminator for incoming
- messages?
-confBIND_OPTS ResolverOptions [undefined] Default options for DNS
- resolver.
-confMIME_FORMAT_ERRORS* SendMimeErrors [True] Send error messages as MIME-
- encapsulated messages per RFC 1344.
-confFORWARD_PATH ForwardPath [$z/.forward.$w:$z/.forward]
- The colon-separated list of places to
- search for .forward files. N.B.: see
- the Security Notes section.
-confMCI_CACHE_SIZE ConnectionCacheSize
- [2] Size of open connection cache.
-confMCI_CACHE_TIMEOUT ConnectionCacheTimeout
- [5m] Open connection cache timeout.
-confHOST_STATUS_DIRECTORY HostStatusDirectory
- [undefined] If set, host status is kept
- on disk between sendmail runs in the
- named directory tree. This need not be
- a full pathname, in which case it is
- interpreted relative to the queue
- directory.
-confSINGLE_THREAD_DELIVERY SingleThreadDelivery
- [False] If this option and the
- HostStatusDirectory option are both
- set, single thread deliveries to other
- hosts. That is, don't allow any two
- sendmails on this host to connect
- simultaneously to any other single
- host. This can slow down delivery in
- some cases, in particular since a
- cached but otherwise idle connection
- to a host will prevent other sendmails
- from connecting to the other host.
-confUSE_ERRORS_TO* UserErrorsTo [False] Use the Errors-To: header to
- deliver error messages. This should
- not be necessary because of general
- acceptance of the envelope/header
- distinction.
-confLOG_LEVEL LogLevel [9] Log level.
-confME_TOO MeToo [False] Include sender in group
- expansions.
-confCHECK_ALIASES CheckAliases [False] Check RHS of aliases when
- running newaliases. Since this does
- DNS lookups on every address, it can
- slow down the alias rebuild process
- considerably on large alias files.
-confOLD_STYLE_HEADERS* OldStyleHeaders [True] Assume that headers without
- special chars are old style.
-confDAEMON_OPTIONS DaemonPortOptions
- [none] SMTP daemon options.
-confPRIVACY_FLAGS PrivacyOptions [authwarnings] Privacy flags.
-confCOPY_ERRORS_TO PostmasterCopy [undefined] Address for additional
- copies of all error messages.
-confQUEUE_FACTOR QueueFactor [600000] Slope of queue-only function.
-confDONT_PRUNE_ROUTES DontPruneRoutes [False] Don't prune down route-addr
- syntax addresses to the minimum
- possible.
-confSAFE_QUEUE* SuperSafe [True] Commit all messages to disk
- before forking.
-confTO_INITIAL Timeout.initial [5m] The timeout waiting for a response
- on the initial connect.
-confTO_CONNECT Timeout.connect [0] The timeout waiting for an initial
- connect() to complete. This can only
- shorten connection timeouts; the kernel
- silently enforces an absolute maximum
- (which varies depending on the system).
-confTO_ICONNECT Timeout.iconnect
- [undefined] Like Timeout.connect, but
- applies only to the very first attempt
- to connect to a host in a message.
- This allows a single very fast pass
- followed by more careful delivery
- attempts in the future.
-confTO_HELO Timeout.helo [5m] The timeout waiting for a response
- to a HELO or EHLO command.
-confTO_MAIL Timeout.mail [10m] The timeout waiting for a
- response to the MAIL command.
-confTO_RCPT Timeout.rcpt [1h] The timeout waiting for a response
- to the RCPT command.
-confTO_DATAINIT Timeout.datainit
- [5m] The timeout waiting for a 354
- response from the DATA command.
-confTO_DATABLOCK Timeout.datablock
- [1h] The timeout waiting for a block
- during DATA phase.
-confTO_DATAFINAL Timeout.datafinal
- [1h] The timeout waiting for a response
- to the final "." that terminates a
- message.
-confTO_RSET Timeout.rset [5m] The timeout waiting for a response
- to the RSET command.
-confTO_QUIT Timeout.quit [2m] The timeout waiting for a response
- to the QUIT command.
-confTO_MISC Timeout.misc [2m] The timeout waiting for a response
- to other SMTP commands.
-confTO_COMMAND Timeout.command [1h] In server SMTP, the timeout waiting
- for a command to be issued.
-confTO_IDENT Timeout.ident [30s] The timeout waiting for a response
- to an IDENT query.
-confTO_FILEOPEN Timeout.fileopen
- [60s] The timeout waiting for a file
- (e.g., :include: file) to be opened.
-confTO_QUEUERETURN Timeout.queuereturn
- [5d] The timeout before a message is
- returned as undeliverable.
-confTO_QUEUERETURN_NORMAL
- Timeout.queuereturn.normal
- [undefined] As above, for normal
- priority messages.
-confTO_QUEUERETURN_URGENT
- Timeout.queuereturn.urgent
- [undefined] As above, for urgent
- priority messages.
-confTO_QUEUERETURN_NONURGENT
- Timeout.queuereturn.non-urgent
- [undefined] As above, for non-urgent
- (low) priority messages.
-confTO_QUEUEWARN Timeout.queuewarn
- [4h] The timeout before a warning
- message is sent to the sender telling
- them that the message has been deferred.
-confTO_QUEUEWARN_NORMAL Timeout.queuewarn.normal
- [undefined] As above, for normal
- priority messages.
-confTO_QUEUEWARN_URGENT Timeout.queuewarn.urgent
- [undefined] As above, for urgent
- priority messages.
-confTO_QUEUEWARN_NONURGENT
- Timeout.queuewarn.non-urgent
- [undefined] As above, for non-urgent
- (low) priority messages.
-confTO_HOSTSTATUS Timeout.hoststatus
- [30m] How long information about host
- statuses will be maintained before it
- is considered stale and the host should
- be retried. This applies both within
- a single queue run and to persistent
- information (see below).
-confTIME_ZONE TimeZoneSpec [USE_SYSTEM] Time zone info -- can be
- USE_SYSTEM to use the system's idea,
- USE_TZ to use the user's TZ envariable,
- or something else to force that value.
-confDEF_USER_ID DefaultUser [1:1] Default user id.
-confUSERDB_SPEC UserDatabaseSpec
- [undefined] User database specification.
-confFALLBACK_MX FallbackMXhost [undefined] Fallback MX host.
-confTRY_NULL_MX_LIST TryNullMXList [False] If we are the best MX for a
- host and haven't made other
- arrangements, try connecting to the
- host directly; normally this would be
- a config error.
-confQUEUE_LA QueueLA [8] Load average at which queue-only
- function kicks in.
-confREFUSE_LA RefuseLA [12] Load average at which incoming
- SMTP connections are refused.
-confMAX_DAEMON_CHILDREN MaxDaemonChildren
- [undefined] The maximum number of
- children the daemon will permit. After
- this number, connections will be
- rejected. If not set or <= 0, there is
- no limit.
-confCONNECTION_RATE_THROTTLE ConnectionRateThrottle
- [undefined] The maximum number of
- connections permitted per second.
- After this many connections are
- accepted, further connections will be
- delayed. If not set or <= 0, there is
- no limit.
-confWORK_RECIPIENT_FACTOR
- RecipientFactor [30000] Cost of each recipient.
-confSEPARATE_PROC ForkEachJob [False] Run all deliveries in a separate
- process.
-confWORK_CLASS_FACTOR ClassFactor [1800] Priority multiplier for class.
-confWORK_TIME_FACTOR RetryFactor [90000] Cost of each delivery attempt.
-confQUEUE_SORT_ORDER QueueSortOrder [Priority] Queue sort algorithm:
- Priority, Host, or Time.
-confMIN_QUEUE_AGE MinQueueAge [0] The minimum amount of time a job
- must sit in the queue between queue
- runs. This allows you to set the
- queue run interval low for better
- responsiveness without trying all
- jobs in each run.
-confDEF_CHAR_SET DefaultCharSet [unknown-8bit] When converting
- unlabeled 8 bit input to MIME, the
- character set to use by default.
-confSERVICE_SWITCH_FILE ServiceSwitchFile
- [/etc/service.switch] The file to use
- for the service switch on systems that
- do not have a system-defined switch.
-confHOSTS_FILE HostsFile [/etc/hosts] The file to use when doing
- "file" type access of hosts names.
-confDIAL_DELAY DialDelay [0s] If a connection fails, wait this
- long and try again. Zero means "don't
- retry". This is to allow "dial on
- demand" connections to have enough time
- to complete a connection.
-confNO_RCPT_ACTION NoRecipientAction
- [none] What to do if there are no legal
- recipient fields (To:, Cc: or Bcc:)
- in the message. Legal values can
- be "none" to just leave the
- nonconforming message as is, "add-to"
- to add a To: header with all the
- known recipients (which may expose
- blind recipients), "add-apparently-to"
- to do the same but use Apparently-To:
- instead of To:, "add-bcc" to add an
- empty Bcc: header, or
- "add-to-undisclosed" to add the header
- ``To: undisclosed-recipients:;''.
-confSAFE_FILE_ENV SafeFileEnvironment
- [undefined] If set, sendmail will do a
- chroot() into this directory before
- writing files.
-confCOLON_OK_IN_ADDR ColonOkInAddr [True unless Configuration Level > 6]
- If set, colons are treated as a regular
- character in addresses. If not set,
- they are treated as the introducer to
- the RFC 822 "group" syntax. Colons are
- handled properly in route-addrs. This
- option defaults on for V5 and lower
- configuration files.
-confMAX_QUEUE_RUN_SIZE MaxQueueRunSize [0] If set, limit the maximum size of
- any given queue run to this number of
- entries. Essentially, this will stop
- reading the queue directory after this
- number of entries are reached; it does
- _not_ pick the highest priority jobs,
- so this should be as large as your
- system can tolerate. If not set, there
- is no limit.
-confDONT_EXPAND_CNAMES DontExpandCnames
- [False] If set, $[ ... $] lookups that
- do DNS based lookups do not expand
- CNAME records. This currently violates
- the published standards, but the IETF
- seems to be moving toward legalizing
- this. For example, if "FTP.Foo.ORG"
- is a CNAME for "Cruft.Foo.ORG", then
- with this option set a lookup of
- "FTP" will return "FTP.Foo.ORG"; if
- clear it returns "Cruft.FOO.ORG". N.B.
- you may not see any effect until your
- downstream neighbors stop doing CNAME
- lookups as well.
-confFROM_LINE UnixFromLine [From $g $d] The From_ line used
- when sending to files or programs.
-confSINGLE_LINE_FROM_HEADER SingleLineFromHeader
- [False] From: lines that have
- embedded newlines are unwrapped
- onto one line.
-confALLOW_BOGUS_HELO AllowBogusHELO [False] Allow HELO SMTP command that
- does not include a host name.
-confMUST_QUOTE_CHARS MustQuoteChars [.'] Characters to be quoted in a full
- name phrase (@,;:\()[] are automatic).
-confOPERATORS OperatorChars [.:%@!^/[]+] Address operator
- characters.
-confSMTP_LOGIN_MSG SmtpGreetingMessage
- [$j Sendmail $v/$Z; $b]
- The initial (spontaneous) SMTP
- greeting message. The word "ESMTP"
- will be inserted between the first and
- second words to convince other
- sendmails to try to speak ESMTP.
-confDONT_INIT_GROUPS DontInitGroups [False] If set, the initgroups(3)
- routine will never be invoked. You
- might want to do this if you are
- running NIS and you have a large group
- map, since this call does a sequential
- scan of the map; in a large site this
- can cause your ypserv to run
- essentially full time. If you set
- this, agents run on behalf of users
- will only have their primary
- (/etc/passwd) group permissions.
-confUNSAFE_GROUP_WRITES UnsafeGroupWrites
- [False] If set, group-writable
- :include: and .forward files are
- considered "unsafe", that is, programs
- and files cannot be directly referenced
- from such files. World-writable files
- are always considered unsafe.
-confDOUBLE_BOUNCE_ADDRESS DoubleBounceAddress
- [postmaster] If an error occurs when
- sending an error message, send that
- "double bounce" error message to this
- address.
-confRUN_AS_USER RunAsUser [undefined] If set, become this user
- when reading and delivering mail.
- Causes all file reads (e.g., .forward
- and :include: files) to be done as
- this user. Also, all programs will
- be run as this user, and all output
- files will be written as this user.
- Intended for use only on firewalls
- where users do not have accounts.
-confMAX_RCPTS_PER_MESSAGE MaxRecipientsPerMessage
- [infinite] If set, allow no more than
- the specified number of recipients in
- an SMTP envelope. Further recipients
- receive a 452 error code (i.e., they
- are deferred for the next delivery
- attempt).
-confDONT_PROBE_INTERFACES DontProbeInterfaces
- [False] If set, sendmail will _not_
- insert the names and addresses of any
- local interfaces into the $=w class
- (list of known "equivalent" addresses).
- If you set this, you must also include
- some support for these addresses (e.g.,
- in a mailertable entry) -- otherwise,
- mail to addresses in this list will
- bounce with a configuration error.
-confDONT_BLAME_SENDMAIL DontBlameSendmail
- [safe] Override sendmail's file
- safety checks. This will definitely
- compromise system security and should
- not be used unless absolutely
- necessary.
-confREJECT_MSG - [550 Access denied] The message
- given if the access database contains
- REJECT in the value portion.
-
-See also the description of OSTYPE for some parameters that can be
-tweaked (generally pathnames to mailers).
-
-
-+-----------+
-| HIERARCHY |
-+-----------+
-
-Within this directory are several subdirectories, to wit:
-
-m4 General support routines. These are typically
- very important and should not be changed without
- very careful consideration.
-
-cf The configuration files themselves. They have
- ".mc" suffixes, and must be run through m4 to
- become complete. The resulting output should
- have a ".cf" suffix.
-
-ostype Definitions describing a particular operating
- system type. These should always be referenced
- using the OSTYPE macro in the .mc file. Examples
- include "bsd4.3", "bsd4.4", "sunos3.5", and
- "sunos4.1".
-
-domain Definitions describing a particular domain, referenced
- using the DOMAIN macro in the .mc file. These are
- site dependent; for example, "CS.Berkeley.EDU.m4"
- describes hosts in the CS.Berkeley.EDU subdomain.
-
-mailer Descriptions of mailers. These are referenced using
- the MAILER macro in the .mc file.
-
-sh Shell files used when building the .cf file from the
- .mc file in the cf subdirectory.
-
-feature These hold special orthogonal features that you might
- want to include. They should be referenced using
- the FEATURE macro.
-
-hack Local hacks. These can be referenced using the HACK
- macro. They shouldn't be of more than voyeuristic
- interest outside the .Berkeley.EDU domain, but who knows?
- We've all got our own peccadillos.
-
-siteconfig Site configuration -- e.g., tables of locally connected
- UUCP sites.
-
-
-+------------------------+
-| ADMINISTRATIVE DETAILS |
-+------------------------+
-
-The following sections detail usage of certain internal parts of the
-sendmail.cf file. Read them carefully if you are trying to modify
-the current model. If you find the above descriptions adequate, these
-should be {boring, confusing, tedious, ridiculous} (pick one or more).
-
-RULESETS (* means built in to sendmail)
-
- 0 * Parsing
- 1 * Sender rewriting
- 2 * Recipient rewriting
- 3 * Canonicalization
- 4 * Post cleanup
- 5 * Local address rewrite (after aliasing)
- 1x mailer rules (sender qualification)
- 2x mailer rules (recipient qualification)
- 3x mailer rules (sender header qualification)
- 4x mailer rules (recipient header qualification)
- 5x mailer subroutines (general)
- 6x mailer subroutines (general)
- 7x mailer subroutines (general)
- 8x reserved
- 90 Mailertable host stripping
- 96 Bottom half of Ruleset 3 (ruleset 6 in old sendmail)
- 97 Hook for recursive ruleset 0 call (ruleset 7 in old sendmail)
- 98 Local part of ruleset 0 (ruleset 8 in old sendmail)
- 99 Guaranteed null (for debugging)
-
-
-MAILERS
-
- 0 local, prog local and program mailers
- 1 [e]smtp, relay SMTP channel
- 2 uucp-* UNIX-to-UNIX Copy Program
- 3 netnews Network News delivery
- 4 fax Sam Leffler's HylaFAX software
- 5 mail11 DECnet mailer
-
-
-MACROS
-
- A
- B Bitnet Relay
- C DECnet Relay
- D The local domain -- usually not needed
- E reserved for X.400 Relay
- F FAX Relay
- G
- H mail Hub (for mail clusters)
- I
- J
- K
- L Luser Relay
- M Masquerade (who I claim to be)
- N
- O
- P
- Q
- R Relay (for unqualified names)
- S Smart Host
- T
- U my UUCP name (if I have a UUCP connection)
- V UUCP Relay (class V hosts)
- W UUCP Relay (class W hosts)
- X UUCP Relay (class X hosts)
- Y UUCP Relay (all other hosts)
- Z Version number
-
-
-CLASSES
-
- A
- B domains that are candidates for bestmx lookup
- C
- D
- E addresses that should not seem to come from $M
- F hosts we forward for
- G domains that should be looked up in genericstable
- H
- I
- J
- K
- L addresses that should not be forwarded to $R
- M domains that should be mapped to $M
- N
- O operators that indicate network operations (cannot be in local names)
- P top level pseudo-domains: BITNET, DECNET, FAX, UUCP, etc.
- Q
- R domains we are willing to relay (pass anti-spam filters)
- S
- T
- U locally connected UUCP hosts
- V UUCP hosts connected to relay $V
- W UUCP hosts connected to relay $W
- X UUCP hosts connected to relay $X
- Y locally connected smart UUCP hosts
- Z locally connected domain-ized UUCP hosts
- . the class containing only a dot
- [ the class containing only a left bracket
-
-
-M4 DIVERSIONS
-
- 1 Local host detection and resolution
- 2 Local Ruleset 3 additions
- 3 Local Ruleset 0 additions
- 4 UUCP Ruleset 0 additions
- 5 locally interpreted names (overrides $R)
- 6 local configuration (at top of file)
- 7 mailer definitions
- 8
- 9 special local rulesets (1 and 2)
+++ /dev/null
-#!/bin/sh
-
-# Copyright (c) 1998 Sendmail, Inc. 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.3 (Berkeley) 5/19/1998
-#
-
-#
-# A quick-and-dirty script to create cf files.
-#
-
-SMROOT=${SMROOT-../..}
-BUILDTOOLS=${BUILDTOOLS-$SMROOT/BuildTools}
-
-M4=`sh $BUILDTOOLS/bin/find_m4.sh`
-ret=$?
-if [ $ret -ne 0 ]
-then
- exit $ret
-fi
-echo "Using M4=$M4"
-
-eval exec ${MAKE-make} M4=$M4 $*
+++ /dev/null
-# $OpenBSD: Makefile,v 1.18 1999/01/01 20:32:29 millert Exp $
-#
-# Makefile for configuration files.
-#
-# @(#)Makefile 8.17 (Berkeley) 4/2/1998
-#
-
-#
-# Create configuration files using "m4 ../m4/cf.m4 file.mc > file.cf";
-# this may be easier than tweaking the Makefile. You do need to
-# have a fairly modern M4 available (GNU m4 works). On SunOS, use
-# /usr/5bin/m4.
-#
-
-M4= m4
-CFDIR= ..
-CHMOD= chmod
-ROMODE= 444
-RM= rm -f
-
-.SUFFIXES: .mc .cf
-
-.mc.cf:
- $(RM) $@
- (cd ${.CURDIR} && $(M4) ${@:R}.mc > ${.OBJDIR}/$@)
- $(CHMOD) $(ROMODE) $@
-
-ALL= boat-anchor.cf trinity.cf \
- clientproto.cf openbsd-proto.cf tcpproto.cf uucpproto.cf \
- gandalf.cf saruman.cf alatar.cf nettan.cf waldorf.cf \
- lucifier.cf elbereth.cf corpse.cf
-
-all: $(ALL)
-
-clean cleandir:
- $(RM) $(ALL) core
-
-depend install:
-
-distribution: openbsd-proto.cf
- ${INSTALL} ${INSTALL_COPY} -o root -g wheel -m 644 openbsd-proto.cf \
- ${DESTDIR}/etc/sendmail.cf
-
-# this is overkill, but....
-M4FILES=\
- ${CFDIR}/domain/Berkeley.EDU.m4 \
- ${CFDIR}/domain/CS.Berkeley.EDU.m4 \
- ${CFDIR}/domain/EECS.Berkeley.EDU.m4 \
- ${CFDIR}/domain/S2K.Berkeley.EDU.m4 \
- ${CFDIR}/domain/berkeley-only.m4 \
- ${CFDIR}/domain/generic.m4 \
- ${CFDIR}/feature/accept_unqualified_senders.m4 \
- ${CFDIR}/feature/accept_unresolvable_domains.m4 \
- ${CFDIR}/feature/access_db.m4 \
- ${CFDIR}/feature/allmasquerade.m4 \
- ${CFDIR}/feature/always_add_domain.m4 \
- ${CFDIR}/feature/bestmx_is_local.m4 \
- ${CFDIR}/feature/bitdomain.m4 \
- ${CFDIR}/feature/blacklist_recipients.m4 \
- ${CFDIR}/feature/loose_relay_check.m4 \
- ${CFDIR}/feature/domaintable.m4 \
- ${CFDIR}/feature/genericstable.m4 \
- ${CFDIR}/feature/limited_masquerade.m4 \
- ${CFDIR}/feature/local_lmtp.m4 \
- ${CFDIR}/feature/local_procmail.m4 \
- ${CFDIR}/feature/mailertable.m4 \
- ${CFDIR}/feature/masquerade_entire_domain.m4 \
- ${CFDIR}/feature/masquerade_envelope.m4 \
- ${CFDIR}/feature/nocanonify.m4 \
- ${CFDIR}/feature/nodns.m4 \
- ${CFDIR}/feature/notsticky.m4 \
- ${CFDIR}/feature/nouucp.m4 \
- ${CFDIR}/feature/nullclient.m4 \
- ${CFDIR}/feature/promiscuous_relay.m4 \
- ${CFDIR}/feature/rbl.m4 \
- ${CFDIR}/feature/redirect.m4 \
- ${CFDIR}/feature/relay_based_on_MX.m4 \
- ${CFDIR}/feature/relay_entire_domain.m4 \
- ${CFDIR}/feature/relay_hosts_only.m4 \
- ${CFDIR}/feature/relay_local_from.m4 \
- ${CFDIR}/feature/smrsh.m4 \
- ${CFDIR}/feature/stickyhost.m4 \
- ${CFDIR}/feature/use_ct_file.m4 \
- ${CFDIR}/feature/use_cw_file.m4 \
- ${CFDIR}/feature/uucpdomain.m4 \
- ${CFDIR}/feature/virtusertable.m4 \
- ${CFDIR}/hack/cssubdomain.m4 \
- ${CFDIR}/m4/cf.m4 \
- ${CFDIR}/m4/cfhead.m4 \
- ${CFDIR}/m4/nullrelay.m4 \
- ${CFDIR}/m4/proto.m4 \
- ${CFDIR}/m4/version.m4 \
- ${CFDIR}/mailer/cyrus.m4 \
- ${CFDIR}/mailer/fax.m4 \
- ${CFDIR}/mailer/local.m4 \
- ${CFDIR}/mailer/mail11.m4 \
- ${CFDIR}/mailer/pop.m4 \
- ${CFDIR}/mailer/procmail.m4 \
- ${CFDIR}/mailer/smtp.m4 \
- ${CFDIR}/mailer/usenet.m4 \
- ${CFDIR}/mailer/uucp.m4 \
- ${CFDIR}/ostype/aix2.m4 \
- ${CFDIR}/ostype/aix3.m4 \
- ${CFDIR}/ostype/altos.m4 \
- ${CFDIR}/ostype/amdahl-uts.m4 \
- ${CFDIR}/ostype/aux.m4 \
- ${CFDIR}/ostype/bsd4.3.m4 \
- ${CFDIR}/ostype/bsd4.4.m4 \
- ${CFDIR}/ostype/bsdi1.0.m4 \
- ${CFDIR}/ostype/bsdi2.0.m4 \
- ${CFDIR}/ostype/dgux.m4 \
- ${CFDIR}/ostype/domainos.m4 \
- ${CFDIR}/ostype/dynix3.2.m4 \
- ${CFDIR}/ostype/gnuhurd.m4 \
- ${CFDIR}/ostype/hpux10.m4 \
- ${CFDIR}/ostype/hpux9.m4 \
- ${CFDIR}/ostype/irix4.m4 \
- ${CFDIR}/ostype/irix5.m4 \
- ${CFDIR}/ostype/irix6.m4 \
- ${CFDIR}/ostype/linux.m4 \
- ${CFDIR}/ostype/maxion.m4 \
- ${CFDIR}/ostype/mklinux.m4 \
- ${CFDIR}/ostype/nextstep.m4 \
- ${CFDIR}/ostype/osf1.m4 \
- ${CFDIR}/ostype/powerux.m4 \
- ${CFDIR}/ostype/ptx2.m4 \
- ${CFDIR}/ostype/qnx.m4 \
- ${CFDIR}/ostype/riscos4.5.m4 \
- ${CFDIR}/ostype/sco-uw-2.1.m4 \
- ${CFDIR}/ostype/sco3.2.m4 \
- ${CFDIR}/ostype/solaris2.m4 \
- ${CFDIR}/ostype/solaris2.ml.m4 \
- ${CFDIR}/ostype/sunos3.5.m4 \
- ${CFDIR}/ostype/sunos4.1.m4 \
- ${CFDIR}/ostype/svr4.m4 \
- ${CFDIR}/ostype/ultrix4.m4 \
- ${CFDIR}/ostype/unknown.m4 \
- ${CFDIR}/ostype/uxpds.m4 \
- ${CFDIR}/siteconfig/uucp.cogsci.m4 \
- ${CFDIR}/siteconfig/uucp.old.arpa.m4 \
- ${CFDIR}/siteconfig/uucp.ucbarpa.m4 \
- ${CFDIR}/siteconfig/uucp.ucbvax.m4 \
-
-$(ALL): $(M4FILES)
-
-.include <bsd.prog.mk>
+++ /dev/null
-#
-# Makefile for configuration files.
-#
-# @(#)Makefile 8.17 (Berkeley) 4/2/98
-#
-
-#
-# Create configuration files using "m4 ../m4/cf.m4 file.mc > file.cf";
-# this may be easier than tweaking the Makefile. You do need to
-# have a fairly modern M4 available (GNU m4 works). On SunOS, use
-# /usr/5bin/m4.
-#
-
-M4= m4
-CFDIR= ..
-CHMOD= chmod
-ROMODE= 444
-RM= rm -f
-
-.SUFFIXES: .mc .cf
-
-.mc.cf:
- $(RM) $@
- $(M4) ${CFDIR}/m4/cf.m4 $*.mc > $@ || ( $(RM) $@ && exit 1 )
- $(CHMOD) $(ROMODE) $@
-
-ALL= generic-bsd4.4.cf generic-hpux9.cf generic-hpux10.cf \
- generic-osf1.cf generic-solaris2.cf \
- generic-sunos4.1.cf generic-ultrix4.cf \
- cs-hpux9.cf cs-osf1.cf cs-solaris2.cf \
- cs-sunos4.1.cf cs-ultrix4.cf \
- s2k-osf1.cf s2k-ultrix4.cf \
- chez.cs.cf huginn.cs.cf mail.cs.cf mail.eecs.cf mailspool.cs.cf \
- python.cs.cf ucbarpa.cf ucbvax.cf vangogh.cs.cf knecht.cf
-
-all: $(ALL)
-
-clean cleandir:
- $(RM) $(ALL) core
-
-depend install:
-
-# this is overkill, but....
-M4FILES=\
- ${CFDIR}/domain/Berkeley.EDU.m4 \
- ${CFDIR}/domain/CS.Berkeley.EDU.m4 \
- ${CFDIR}/domain/EECS.Berkeley.EDU.m4 \
- ${CFDIR}/domain/S2K.Berkeley.EDU.m4 \
- ${CFDIR}/domain/berkeley-only.m4 \
- ${CFDIR}/domain/generic.m4 \
- ${CFDIR}/feature/accept_unqualified_senders.m4 \
- ${CFDIR}/feature/accept_unresolvable_domains.m4 \
- ${CFDIR}/feature/access_db.m4 \
- ${CFDIR}/feature/allmasquerade.m4 \
- ${CFDIR}/feature/always_add_domain.m4 \
- ${CFDIR}/feature/bestmx_is_local.m4 \
- ${CFDIR}/feature/bitdomain.m4 \
- ${CFDIR}/feature/blacklist_recipients.m4 \
- ${CFDIR}/feature/loose_relay_check.m4 \
- ${CFDIR}/feature/domaintable.m4 \
- ${CFDIR}/feature/genericstable.m4 \
- ${CFDIR}/feature/limited_masquerade.m4 \
- ${CFDIR}/feature/local_lmtp.m4 \
- ${CFDIR}/feature/local_procmail.m4 \
- ${CFDIR}/feature/mailertable.m4 \
- ${CFDIR}/feature/masquerade_entire_domain.m4 \
- ${CFDIR}/feature/masquerade_envelope.m4 \
- ${CFDIR}/feature/nocanonify.m4 \
- ${CFDIR}/feature/nodns.m4 \
- ${CFDIR}/feature/notsticky.m4 \
- ${CFDIR}/feature/nouucp.m4 \
- ${CFDIR}/feature/nullclient.m4 \
- ${CFDIR}/feature/promiscuous_relay.m4 \
- ${CFDIR}/feature/rbl.m4 \
- ${CFDIR}/feature/redirect.m4 \
- ${CFDIR}/feature/relay_based_on_MX.m4 \
- ${CFDIR}/feature/relay_entire_domain.m4 \
- ${CFDIR}/feature/relay_hosts_only.m4 \
- ${CFDIR}/feature/relay_local_from.m4 \
- ${CFDIR}/feature/smrsh.m4 \
- ${CFDIR}/feature/stickyhost.m4 \
- ${CFDIR}/feature/use_ct_file.m4 \
- ${CFDIR}/feature/use_cw_file.m4 \
- ${CFDIR}/feature/uucpdomain.m4 \
- ${CFDIR}/feature/virtusertable.m4 \
- ${CFDIR}/hack/cssubdomain.m4 \
- ${CFDIR}/m4/cf.m4 \
- ${CFDIR}/m4/cfhead.m4 \
- ${CFDIR}/m4/nullrelay.m4 \
- ${CFDIR}/m4/proto.m4 \
- ${CFDIR}/m4/version.m4 \
- ${CFDIR}/mailer/cyrus.m4 \
- ${CFDIR}/mailer/fax.m4 \
- ${CFDIR}/mailer/local.m4 \
- ${CFDIR}/mailer/mail11.m4 \
- ${CFDIR}/mailer/pop.m4 \
- ${CFDIR}/mailer/procmail.m4 \
- ${CFDIR}/mailer/smtp.m4 \
- ${CFDIR}/mailer/usenet.m4 \
- ${CFDIR}/mailer/uucp.m4 \
- ${CFDIR}/ostype/aix2.m4 \
- ${CFDIR}/ostype/aix3.m4 \
- ${CFDIR}/ostype/altos.m4 \
- ${CFDIR}/ostype/amdahl-uts.m4 \
- ${CFDIR}/ostype/aux.m4 \
- ${CFDIR}/ostype/bsd4.3.m4 \
- ${CFDIR}/ostype/bsd4.4.m4 \
- ${CFDIR}/ostype/bsdi1.0.m4 \
- ${CFDIR}/ostype/bsdi2.0.m4 \
- ${CFDIR}/ostype/dgux.m4 \
- ${CFDIR}/ostype/domainos.m4 \
- ${CFDIR}/ostype/dynix3.2.m4 \
- ${CFDIR}/ostype/gnuhurd.m4 \
- ${CFDIR}/ostype/hpux10.m4 \
- ${CFDIR}/ostype/hpux9.m4 \
- ${CFDIR}/ostype/irix4.m4 \
- ${CFDIR}/ostype/irix5.m4 \
- ${CFDIR}/ostype/irix6.m4 \
- ${CFDIR}/ostype/linux.m4 \
- ${CFDIR}/ostype/maxion.m4 \
- ${CFDIR}/ostype/mklinux.m4 \
- ${CFDIR}/ostype/nextstep.m4 \
- ${CFDIR}/ostype/osf1.m4 \
- ${CFDIR}/ostype/powerux.m4 \
- ${CFDIR}/ostype/ptx2.m4 \
- ${CFDIR}/ostype/qnx.m4 \
- ${CFDIR}/ostype/riscos4.5.m4 \
- ${CFDIR}/ostype/sco-uw-2.1.m4 \
- ${CFDIR}/ostype/sco3.2.m4 \
- ${CFDIR}/ostype/solaris2.m4 \
- ${CFDIR}/ostype/solaris2.ml.m4 \
- ${CFDIR}/ostype/sunos3.5.m4 \
- ${CFDIR}/ostype/sunos4.1.m4 \
- ${CFDIR}/ostype/svr4.m4 \
- ${CFDIR}/ostype/ultrix4.m4 \
- ${CFDIR}/ostype/unknown.m4 \
- ${CFDIR}/ostype/uxpds.m4 \
- ${CFDIR}/siteconfig/uucp.cogsci.m4 \
- ${CFDIR}/siteconfig/uucp.old.arpa.m4 \
- ${CFDIR}/siteconfig/uucp.ucbarpa.m4 \
- ${CFDIR}/siteconfig/uucp.ucbvax.m4 \
-
-$(ALL): $(M4FILES)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1997 SigmaSoft, Th. Lockert
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by SigmaSoft, Th. Lockert
-# 4. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-#
-
-include(`../m4/cf.m4')dnl
-VERSIONID(`$OpenBSD: alatar.mc,v 1.2 1998/08/15 18:17:10 millert Exp $')dnl
-OSTYPE(openbsd)dnl
-FEATURE(nullclient, gandalf.$m)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1993 Adam Glass
-# Copyright (c) 1983 Eric P. Allman
-# Copyright (c) 1988 The Regents of the University of California.
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by the University of
-# California, Berkeley and its contributors.
-# 4. Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-#
-
-include(`../m4/cf.m4')
-VERSIONID(`@(#)boat-anchor.mc $Revision: 1.2 $')
-OSTYPE(bsd4.4)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
-define(`UUCP_RELAY', ucbvax.Berkeley.EDU)dnl
-define(`BITNET_RELAY', mailhost.Berkeley.EDU)dnl
-define(`CSNET_RELAY', mailhost.Berkeley.EDU)dnl
-define(`LOCAL_RELAY', sun-lamp.CS.Berkeley.EDU)
-define(`MAIL_HUB', sun-lamp.CS.Berkeley.EDU)
-define(`confCHECKPOINT_INTERVAL', 4)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for a specific
-# machine in the Computer Science Division at Berkeley, and should
-# not be used elsewhere. It is provided on the sendmail distribution
-# as a sample only.
-#
-# This file is for a home machine that wants to masquerade as an
-# on-campus machine. Additionally, all addresses without a hostname
-# will be forwarded to that machine.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)chez.cs.mc 8.11 (Berkeley) 5/19/1998')
-OSTYPE(bsd4.4)dnl
-DOMAIN(CS.Berkeley.EDU)dnl
-define(`LOCAL_RELAY', vangogh.CS.Berkeley.EDU)dnl
-MASQUERADE_AS(vangogh.CS.Berkeley.EDU)dnl
-FEATURE(use_cw_file)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This the prototype for a "null client" -- that is, a client that
-# does nothing except forward all mail to a mail hub. IT IS NOT
-# USABLE AS IS!!!
-#
-# To use this, you MUST use the nullclient feature with the name of
-# the mail hub as its argument. You MUST also define an `OSTYPE' to
-# define the location of the queue directories and the like.
-# In addition, you MAY select the nocanonify feature. This causes
-# addresses to be sent unqualified via the SMTP connection; normally
-# they are qualifed with the masquerade name, which defaults to the
-# name of the hub machine.
-# Other than these, it should never contain any other lines.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)clientproto.mc 8.12 (Berkeley) 5/19/1998')
-
-OSTYPE(unknown)
-FEATURE(nullclient, mailhost.$m)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1997 Michael Shalayeff
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Michael Shalayeff.
-# 4. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 REGENTS 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.
-#
-
-include(`../m4/cf.m4')
-VERSIONID(`$OpenBSD: corpse.mc,v 1.2 1998/08/15 18:17:11 millert Exp $')dnl
-
-OSTYPE(openbsd)dnl
-
-define(`confFROM_HEADER', <$g$s>)dnl
-define(`LOCAL_RELAY',`mail.$m')dnl
-define(`_NO_CANONIFY_', 1)dnl
-FEATURE(`always_add_domain')dnl
-FEATURE(`nullclient',`mail.$m')dnl
-
-LOCAL_CONFIG
-S1
-R$- $@ $1@$H user -> user@hub
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for HP-UX 9.x.
-# It applies only to the Computer Science Division at Berkeley,
-# and should not be used elsewhere. It is provided on the sendmail
-# distribution as a sample only. To create your own configuration
-# file, create an appropriate domain file in ../domain, change the
-# `DOMAIN' macro below to reference that file, and copy the result
-# to a name of your own choosing.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)cs-hpux10.mc 8.10 (Berkeley) 5/19/1998')
-OSTYPE(hpux10)dnl
-DOMAIN(CS.Berkeley.EDU)dnl
-define(`MAIL_HUB', mailspool.CS.Berkeley.EDU)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for HP-UX 9.x.
-# It applies only to the Computer Science Division at Berkeley,
-# and should not be used elsewhere. It is provided on the sendmail
-# distribution as a sample only. To create your own configuration
-# file, create an appropriate domain file in ../domain, change the
-# `DOMAIN' macro below to reference that file, and copy the result
-# to a name of your own choosing.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)cs-hpux9.mc 8.11 (Berkeley) 5/19/1998')
-OSTYPE(hpux9)dnl
-DOMAIN(CS.Berkeley.EDU)dnl
-define(`MAIL_HUB', mailspool.CS.Berkeley.EDU)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for OSF/1.
-# It applies only to the Computer Science Division at Berkeley,
-# and should not be used elsewhere. It is provided on the sendmail
-# distribution as a sample only. To create your own configuration
-# file, create an appropriate domain file in ../domain, change the
-# `DOMAIN' macro below to reference that file, and copy the result
-# to a name of your own choosing.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)cs-osf1.mc 8.10 (Berkeley) 5/19/1998')
-OSTYPE(osf1)dnl
-DOMAIN(CS.Berkeley.EDU)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for Solaris 2.x.
-# It applies only to the Computer Science Division at Berkeley,
-# and should not be used elsewhere. It is provided on the sendmail
-# distribution as a sample only. To create your own configuration
-# file, create an appropriate domain file in ../domain, change the
-# `DOMAIN' macro below to reference that file, and copy the result
-# to a name of your own choosing.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)cs-solaris2.mc 8.9 (Berkeley) 5/19/1998')
-OSTYPE(solaris2)dnl
-DOMAIN(CS.Berkeley.EDU)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for SunOS 4.1.x.
-# It applies only to the Computer Science Division at Berkeley,
-# and should not be used elsewhere. It is provided on the sendmail
-# distribution as a sample only. To create your own configuration
-# file, create an appropriate domain file in ../domain, change the
-# `DOMAIN' macro below to reference that file, and copy the result
-# to a name of your own choosing.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)cs-sunos4.1.mc 8.10 (Berkeley) 5/19/1998')
-OSTYPE(sunos4.1)dnl
-DOMAIN(CS.Berkeley.EDU)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for Ultrix 4.x.
-# It applies only to the Computer Science Division at Berkeley,
-# and should not be used elsewhere. It is provided on the sendmail
-# distribution as a sample only. To create your own configuration
-# file, create an appropriate domain file in ../domain, change the
-# `DOMAIN' macro below to reference that file, and copy the result
-# to a name of your own choosing.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)cs-ultrix4.mc 8.10 (Berkeley) 5/19/1998')
-OSTYPE(ultrix4)dnl
-DOMAIN(CS.Berkeley.EDU)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-divert(-1)
-#
-# (C) Copyright 1995 by Carnegie Mellon University
-#
-# All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
-#
-# Contributed to Berkeley by John Gardiner Myers <jgm+@CMU.EDU>.
-#
-# This sample mc file is for a site that uses the Cyrus IMAP server
-# exclusively for local mail.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)cyrusproto.mc 8.3 (Carnegie Mellon) @(#)cyrusproto.mc 8.3')
-define(`confBIND_OPTS',`-DNSRCH -DEFNAMES')
-FEATURE(nouucp)
-FEATURE(nocanonify)
-FEATURE(always_add_domain)
-MAILER(smtp)
-MAILER(cyrus)
-
-define(`confLOCAL_MAILER',`cyrus')
-
-LOCAL_RULE_0
-Rbb + $+ < @ $=w . > $#cyrusbb $: $1
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1997 Ken Stailey
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by SigmaSoft, Th. Lockert
-# 4. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-#
-
-include(`../m4/cf.m4')dnl
-VERSIONID(`$OpenBSD: elbereth.mc,v 1.5 1999/08/19 17:58:22 kstailey Exp $')dnl
-OSTYPE(openbsd)dnl
-MASQUERADE_AS(primark.com)dnl
-FEATURE(masquerade_envelope)dnl
-define(`SMART_HOST', `mailhost.disclosure.com')
-MAILER(local)dnl
-MAILER(smtp)dnl
-
-Cw elbereth elbereth.primark.com elbereth.disclosure.com localhost localhost.primark.com localhost.disclosure.com
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1996 SigmaSoft, Th. Lockert
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by SigmaSoft, Th. Lockert
-# 4. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-#
-
-include(`../m4/cf.m4')dnl
-VERSIONID(`$OpenBSD: gandalf.mc,v 1.5 1998/10/17 06:00:05 tholo Exp $')dnl
-OSTYPE(openbsd)dnl
-DOMAIN(sigmasoft)dnl
-MASQUERADE_AS(SigmaSoft.COM)dnl
-FEATURE(allmasquerade)dnl
-FEATURE(local_procmail)dnl
-FEATURE(access_db)dnl
-define(`confAUTO_REBUILD', True)dnl
-MAILER(local)dnl
-MAILER(procmail)dnl
-MAILER(smtp)dnl
-
-Cw SigmaSoft.COM
-
-LOCAL_CONFIG
-#
-# Regular expression to reject:
-# * numeric-only localparts from aol.com and msn.com
-# * localparts starting with a digit from juno.com
-# * localparts longer than 10 characters from aol.com
-#
-Kcheckaddress regex -a@MATCH
- ^([0-9]+<@(aol|msn)\.com|[0-9][^<]*<@juno\.com|.{10}[^<]+<@aol\.com)\.?>
-
-#
-# Names that won't be allowed in a To: line (local-part and domains)
-#
-C{RejectToLocalparts} friend you
-C{RejectToDomains} public.com
-
-LOCAL_RULESETS
-HTo: $>CheckTo
-
-SCheckTo
-R$={RejectToLocalparts}@$* $#error $: "553 Header error"
-R$*@$={RejectToDomains} $#error $: "553 Header error"
-
-HMessage-Id: $>CheckMessageId
-
-SCheckMessageId
-R< $+ @ $+ > $@ OK
-R$* $#error $: "553 Header error"
-
-LOCAL_RULESETS
-SLocal_check_mail
-# check address against various regex checks
-R$* $: $>Parse0 $>3 $1
-R$+ $: $(checkaddress $1 $)
-R@MATCH $#error $: "553 Header error"
+++ /dev/null
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-######################################################################
-######################################################################
-#####
-##### SENDMAIL CONFIGURATION FILE
-#####
-##### built by gshapiro@knecht.sendmail.org on Thu Feb 4 16:39:22 PST 1999
-##### in /home/eric/src/sendmail/cf/cf
-##### using ../ as configuration include directory
-#####
-######################################################################
-######################################################################
-
-##### @(#)cfhead.m4 8.23 (Berkeley) 10/6/1998 #####
-##### @(#)cf.m4 8.29 (Berkeley) 5/19/1998 #####
-##### @(#)generic-bsd4.4.mc 8.7 (Berkeley) 5/19/1998 #####
-
-##### @(#)bsd4.4.m4 8.10 (Berkeley) 10/6/1998 #####
-
-##### @(#)generic.m4 8.9 (Berkeley) 5/19/1998 #####
-
-##### @(#)redirect.m4 8.10 (Berkeley) 5/19/1998 #####
-
-
-
-
-##### @(#)use_cw_file.m4 8.6 (Berkeley) 5/19/1998 #####
-
-
-
-##### @(#)proto.m4 8.243 (Berkeley) 2/2/1999 #####
-
-
-# level 8 config file format
-V8/Berkeley
-
-# override file safeties - setting this option compromises system security
-# need to set this now for the sake of class files
-#O DontBlameSendmail=safe
-
-##################
-# local info #
-##################
-
-Cwlocalhost
-# file containing names of hosts for which we receive email
-Fw/etc/sendmail.cw
-
-# my official domain name
-# ... define this only if sendmail cannot automatically determine your domain
-#Dj$w.Foo.COM
-
-
-CP.
-
-# "Smart" relay host (may be null)
-DS
-
-
-# operators that cannot be in local usernames (i.e., network indicators)
-CO @ % !
-
-# a class with just dot (for identifying canonical names)
-C..
-
-# a class with just a left bracket (for identifying domain literals)
-C[[
-
-
-
-
-
-
-
-
-
-# Resolve map (to check if a host exists in check_mail)
-Kresolve host -a<OK> -T<TEMP>
-
-# Hosts that will permit relaying ($=R)
-FR-o /etc/mail/relay-domains
-
-# who I send unqualified names to (null means deliver locally)
-DR
-
-# who gets all local email traffic ($R has precedence for unqualified names)
-DH
-
-# dequoting map
-Kdequote dequote
-
-# class E: names that should be exposed as from this host, even if we masquerade
-# class L: names that should be delivered locally, even if we have a relay
-# class M: domains that should be converted to $M
-#CL root
-CE root
-
-# who I masquerade as (null for no masquerading) (see also $=M)
-DM
-
-# my name for error messages
-DnMAILER-DAEMON
-
-
-CPREDIRECT
-
-# Configuration version number
-DZ8.9.3
-
-
-###############
-# Options #
-###############
-
-# strip message body to 7 bits on input?
-O SevenBitInput=False
-
-# 8-bit data handling
-O EightBitMode=pass8
-
-
-# wait for alias file rebuild (default units: minutes)
-O AliasWait=10
-
-# location of alias file
-O AliasFile=/etc/aliases
-
-# minimum number of free blocks on filesystem
-O MinFreeBlocks=100
-
-# maximum message size
-#O MaxMessageSize=1000000
-
-# substitution for space (blank) characters
-O BlankSub=.
-
-# avoid connecting to "expensive" mailers on initial submission?
-O HoldExpensive=False
-
-# checkpoint queue runs after every N successful deliveries
-#O CheckpointInterval=10
-
-# default delivery mode
-O DeliveryMode=background
-
-# automatically rebuild the alias database?
-#O AutoRebuildAliases
-
-# error message header/file
-#O ErrorHeader=/etc/sendmail.oE
-
-# error mode
-#O ErrorMode=print
-
-# save Unix-style "From_" lines at top of header?
-#O SaveFromLine
-
-# temporary file mode
-O TempFileMode=0600
-
-# match recipients against GECOS field?
-#O MatchGECOS
-
-# maximum hop count
-#O MaxHopCount=17
-
-# location of help file
-O HelpFile=/usr/share/misc/sendmail.hf
-
-# ignore dots as terminators in incoming messages?
-#O IgnoreDots
-
-# name resolver options
-#O ResolverOptions=+AAONLY
-
-# deliver MIME-encapsulated error messages?
-O SendMimeErrors=True
-
-# Forward file search path
-O ForwardPath=$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z/.forward
-
-# open connection cache size
-O ConnectionCacheSize=2
-
-# open connection cache timeout
-O ConnectionCacheTimeout=5m
-
-# persistent host status directory
-#O HostStatusDirectory=.hoststat
-
-# single thread deliveries (requires HostStatusDirectory)?
-#O SingleThreadDelivery
-
-# use Errors-To: header?
-O UseErrorsTo=False
-
-# log level
-O LogLevel=9
-
-# send to me too, even in an alias expansion?
-#O MeToo
-
-# verify RHS in newaliases?
-O CheckAliases=False
-
-# default messages to old style headers if no special punctuation?
-O OldStyleHeaders=True
-
-# SMTP daemon options
-#O DaemonPortOptions=Port=esmtp
-
-# privacy flags
-O PrivacyOptions=authwarnings
-
-# who (if anyone) should get extra copies of error messages
-#O PostMasterCopy=Postmaster
-
-# slope of queue-only function
-#O QueueFactor=600000
-
-# queue directory
-O QueueDirectory=/var/spool/mqueue
-
-# timeouts (many of these)
-#O Timeout.initial=5m
-#O Timeout.connect=5m
-#O Timeout.iconnect=5m
-#O Timeout.helo=5m
-#O Timeout.mail=10m
-#O Timeout.rcpt=1h
-#O Timeout.datainit=5m
-#O Timeout.datablock=1h
-#O Timeout.datafinal=1h
-#O Timeout.rset=5m
-#O Timeout.quit=2m
-#O Timeout.misc=2m
-#O Timeout.command=1h
-#O Timeout.ident=30s
-#O Timeout.fileopen=60s
-O Timeout.queuereturn=5d
-#O Timeout.queuereturn.normal=5d
-#O Timeout.queuereturn.urgent=2d
-#O Timeout.queuereturn.non-urgent=7d
-O Timeout.queuewarn=4h
-#O Timeout.queuewarn.normal=4h
-#O Timeout.queuewarn.urgent=1h
-#O Timeout.queuewarn.non-urgent=12h
-#O Timeout.hoststatus=30m
-
-# should we not prune routes in route-addr syntax addresses?
-#O DontPruneRoutes
-
-# queue up everything before forking?
-O SuperSafe=True
-
-# status file
-O StatusFile=/var/log/sendmail.st
-
-# time zone handling:
-# if undefined, use system default
-# if defined but null, use TZ envariable passed in
-# if defined and non-null, use that info
-#O TimeZoneSpec=
-
-# default UID (can be username or userid:groupid)
-#O DefaultUser=mailnull
-
-# list of locations of user database file (null means no lookup)
-#O UserDatabaseSpec=/etc/userdb
-
-# fallback MX host
-#O FallbackMXhost=fall.back.host.net
-
-# if we are the best MX host for a site, try it directly instead of config err
-#O TryNullMXList
-
-# load average at which we just queue messages
-#O QueueLA=8
-
-# load average at which we refuse connections
-#O RefuseLA=12
-
-# maximum number of children we allow at one time
-#O MaxDaemonChildren=12
-
-# maximum number of new connections per second
-#O ConnectionRateThrottle=3
-
-# work recipient factor
-#O RecipientFactor=30000
-
-# deliver each queued job in a separate process?
-#O ForkEachJob
-
-# work class factor
-#O ClassFactor=1800
-
-# work time factor
-#O RetryFactor=90000
-
-# shall we sort the queue by hostname first?
-#O QueueSortOrder=priority
-
-# minimum time in queue before retry
-#O MinQueueAge=30m
-
-# default character set
-#O DefaultCharSet=iso-8859-1
-
-# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
-#O ServiceSwitchFile=/etc/service.switch
-
-# hosts file (normally /etc/hosts)
-#O HostsFile=/etc/hosts
-
-# dialup line delay on connection failure
-#O DialDelay=10s
-
-# action to take if there are no recipients in the message
-#O NoRecipientAction=add-to-undisclosed
-
-# chrooted environment for writing to files
-#O SafeFileEnvironment=/arch
-
-# are colons OK in addresses?
-#O ColonOkInAddr
-
-# how many jobs can you process in the queue?
-#O MaxQueueRunSize=10000
-
-# shall I avoid expanding CNAMEs (violates protocols)?
-#O DontExpandCnames
-
-# SMTP initial login message (old $e macro)
-O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
-
-# UNIX initial From header format (old $l macro)
-O UnixFromLine=From $g $d
-
-# From: lines that have embedded newlines are unwrapped onto one line
-#O SingleLineFromHeader=False
-
-# Allow HELO SMTP command that does not include a host name
-#O AllowBogusHELO=False
-
-# Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
-#O MustQuoteChars=.
-
-# delimiter (operator) characters (old $o macro)
-O OperatorChars=.:%@!^/[]+
-
-# shall I avoid calling initgroups(3) because of high NIS costs?
-#O DontInitGroups
-
-# are group-writable :include: and .forward files (un)trustworthy?
-#O UnsafeGroupWrites
-
-# where do errors that occur when sending errors get sent?
-#O DoubleBounceAddress=postmaster
-
-# what user id do we assume for the majority of the processing?
-#O RunAsUser=sendmail
-
-# maximum number of recipients per SMTP envelope
-#O MaxRecipientsPerMessage=100
-
-# shall we get local names from our installed interfaces?
-#O DontProbeInterfaces
-
-
-
-
-
-
-###########################
-# Message precedences #
-###########################
-
-Pfirst-class=0
-Pspecial-delivery=100
-Plist=-30
-Pbulk=-60
-Pjunk=-100
-
-#####################
-# Trusted users #
-#####################
-
-# this is equivalent to setting class "t"
-#Ft/etc/sendmail.ct
-Troot
-Tdaemon
-Tuucp
-
-#########################
-# Format of headers #
-#########################
-
-H?P?Return-Path: <$g>
-HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
- $.by $j ($v/$Z)$?r with $r$. id $i$?u
- for $u; $|;
- $.$b
-H?D?Resent-Date: $a
-H?D?Date: $a
-H?F?Resent-From: $?x$x <$g>$|$g$.
-H?F?From: $?x$x <$g>$|$g$.
-H?x?Full-Name: $x
-# HPosted-Date: $a
-# H?l?Received-Date: $b
-H?M?Resent-Message-Id: <$t.$i@$j>
-H?M?Message-Id: <$t.$i@$j>
-#\f
-######################################################################
-######################################################################
-#####
-##### REWRITING RULES
-#####
-######################################################################
-######################################################################
-
-############################################
-### Ruleset 3 -- Name Canonicalization ###
-############################################
-S3
-
-# handle null input (translate to <@> special case)
-R$@ $@ <@>
-
-# strip group: syntax (not inside angle brackets!) and trailing semicolon
-R$* $: $1 <@> mark addresses
-R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
-R@ $* <@> $: @ $1 unmark @host:...
-R$* :: $* <@> $: $1 :: $2 unmark node::addr
-R:include: $* <@> $: :include: $1 unmark :include:...
-R$* [ $* : $* ] <@> $: $1 [ $2 : $3 ] unmark IPv6 addrs
-R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon
-R$* : $* <@> $: $2 strip colon if marked
-R$* <@> $: $1 unmark
-R$* ; $1 strip trailing semi
-R$* < $* ; > $1 < $2 > bogus bracketed semi
-
-# null input now results from list:; syntax
-R$@ $@ :; <@>
-
-# strip angle brackets -- note RFC733 heuristic to get innermost item
-R$* $: < $1 > housekeeping <>
-R$+ < $* > < $2 > strip excess on left
-R< $* > $+ < $1 > strip excess on right
-R<> $@ < @ > MAIL FROM:<> case
-R< $+ > $: $1 remove housekeeping <>
-
-# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
-R@ $+ , $+ @ $1 : $2 change all "," to ":"
-
-# localize and dispose of route-based addresses
-R@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr>
-
-# find focus for list syntax
-R $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax
-R $+ : $* ; $@ $1 : $2; list syntax
-
-# find focus for @ syntax addresses
-R$+ @ $+ $: $1 < @ $2 > focus on domain
-R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
-R$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical
-
-# do some sanity checking
-R$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs
-
-# convert old-style addresses to a domain-based address
-R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names
-R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps
-R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains
-
-# if we have % signs, take the rightmost one
-R$* % $* $1 @ $2 First make them all @s.
-R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
-R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish
-
-# else we must be a local name
-R$* $@ $>96 $1
-
-
-################################################
-### Ruleset 96 -- bottom half of ruleset 3 ###
-################################################
-
-S96
-
-# handle special cases for local names
-R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
-R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
-R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain
-R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d]
-R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
-R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr
-
-
-
-
-
-# if really UUCP, handle it immediately
-
-# try UUCP traffic as a local address
-R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3
-R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3
-
-# pass to name server to make hostname canonical
-R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4
-
-# local host aliases and pseudo-domains are always canonical
-R$* < @ $=w > $* $: $1 < @ $2 . > $3
-R$* < @ $j > $* $: $1 < @ $j . > $2
-R$* < @ $=M > $* $: $1 < @ $2 . > $3
-R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4
-R$* < @ $* . . > $* $1 < @ $2 . > $3
-
-
-##################################################
-### Ruleset 4 -- Final Output Post-rewriting ###
-##################################################
-S4
-
-R$* <@> $@ handle <> and list:;
-
-# strip trailing dot off possibly canonical name
-R$* < @ $+ . > $* $1 < @ $2 > $3
-
-# eliminate internal code -- should never get this far!
-R$* < @ *LOCAL* > $* $1 < @ $j > $2
-
-# externalize local domain info
-R$* < $+ > $* $1 $2 $3 defocus
-R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
-R@ $* $@ @ $1 ... and exit
-
-# UUCP must always be presented in old form
-R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u
-
-# delete duplicate local names
-R$+ % $=w @ $=w $1 @ $2 u%host@host => u@host
-
-
-
-##############################################################
-### Ruleset 97 -- recanonicalize and call ruleset zero ###
-### (used for recursive calls) ###
-##############################################################
-
-S97
-R$* $: $>3 $1
-R$* $@ $>0 $1
-
-
-######################################
-### Ruleset 0 -- Parse Address ###
-######################################
-
-S0
-
-R$* $: $>Parse0 $1 initial parsing
-R<@> $#local $: <@> special case error msgs
-R$* $: $>98 $1 handle local hacks
-R$* $: $>Parse1 $1 final parsing
-
-#
-# Parse0 -- do initial syntax checking and eliminate local addresses.
-# This should either return with the (possibly modified) input
-# or return with a #error mailer. It should not return with a
-# #mailer other than the #error mailer.
-#
-
-SParse0
-R<@> $@ <@> special case error msgs
-R$* : $* ; <@> $#error $@ 5.1.3 $: "List:; syntax illegal for recipient addresses"
-#R@ <@ $* > < @ $1 > catch "@@host" bogosity
-R<@ $+> $#error $@ 5.1.3 $: "User address required"
-R$* $: <> $1
-R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3
-R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "Colon illegal in host name part"
-R<> $* $1
-R$* < @ . $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-
-# now delete the local info -- note $=O to find characters that cause forwarding
-R$* < @ > $* $@ $>Parse0 $>3 $1 user@ => user
-R< @ $=w . > : $* $@ $>Parse0 $>3 $2 @here:... -> ...
-R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here
-R< @ $+ > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ $=w . > $@ $>Parse0 $>3 $1 $2 $3 ...@here -> ...
-R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"
-R< @ *LOCAL* > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ *LOCAL* >
- $@ $>Parse0 $>3 $1 $2 $3 ...@*LOCAL* -> ...
-R$* < @ *LOCAL* > $: $1
-
-#
-# Parse1 -- the bottom half of ruleset 0.
-#
-
-SParse1
-# handle numeric address spec
-R$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec
-R$* < @ [ $+ ] > $* $#esmtp $@ [$2] $: $1 < @ [$2] > $3 still numeric: send
-
-
-# short circuit local delivery so forwarded email works
-R$=L < @ $=w . > $#local $: @ $1 special local names
-R$+ < @ $=w . > $#local $: $1 regular local name
-
-
-# resolve remotely connected UUCP links (if any)
-
-# resolve fake top level domains by forwarding to other hosts
-
-
-
-# pass names that still have a host to a smarthost (if defined)
-R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name
-
-# deal with other remote names
-R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain
-
-# handle locally delivered names
-R$=L $#local $: @ $1 special local names
-R$+ $#local $: $1 regular local names
-
-###########################################################################
-### Ruleset 5 -- special rewriting after aliases have been expanded ###
-###########################################################################
-
-S5
-
-# deal with plussed users so aliases work nicely
-R$+ + * $#local $@ $&h $: $1
-R$+ + $* $#local $@ + $2 $: $1 + *
-
-# prepend an empty "forward host" on the front
-R$+ $: <> $1
-
-
-# see if we have a relay or a hub
-R< > $+ $: < $H > $1 try hub
-R< > $+ $: < $R > $1 try relay
-R< > $+ $: < > < $1 $&h > nope, restore +detail
-R< > < $+ + $* > $* < > < $1 > + $2 $3 find the user part
-R< > < $+ > + $* $#local $@ $2 $: @ $1 strip the extra +
-R< > < $+ > $@ $1 no +detail
-R$+ $: $1 <> $&h add +detail back in
-R$+ <> + $* $: $1 + $2 check whether +detail
-R$+ <> $* $: $1 else discard
-R< local : $* > $* $: $>95 < local : $1 > $2 no host extension
-R< error : $* > $* $: $>95 < error : $1 > $2 no host extension
-R< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 >
-R< $+ > $+ $@ $>95 < $1 > $2 < @ $1 >
-
-
-###################################################################
-### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
-###################################################################
-
-S95
-R< > $* $@ $1 strip off null relay
-R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2
-R< local : $* > $* $>CanonLocal < $1 > $2
-R< $- : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
-R< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
-R< $=w > $* $@ $2 delete local host
-R< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer
-
-###################################################################
-### Ruleset CanonLocal -- canonify local: syntax ###
-###################################################################
-
-SCanonLocal
-# strip local host from routed addresses
-R< $* > < @ $+ > : $+ $@ $>97 $3
-R< $* > $+ $=O $+ < @ $+ > $@ $>97 $2 $3 $4
-
-# strip trailing dot from any host name that may appear
-R< $* > $* < @ $* . > $: < $1 > $2 < @ $3 >
-
-# handle local: syntax -- use old user, either with or without host
-R< > $* < @ $* > $* $#local $@ $1@$2 $: $1
-R< > $+ $#local $@ $1 $: $1
-
-# handle local:user@host syntax -- ignore host part
-R< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 >
-
-# handle local:user syntax
-R< $+ > $* <@ $* > $* $#local $@ $2@$3 $: $1
-R< $+ > $* $#local $@ $2 $: $1
-
-###################################################################
-### Ruleset 93 -- convert header names to masqueraded form ###
-###################################################################
-
-S93
-
-
-# special case the users that should be exposed
-R$=E < @ *LOCAL* > $@ $1 < @ $j . > leave exposed
-R$=E < @ $=M . > $@ $1 < @ $2 . >
-R$=E < @ $=w . > $@ $1 < @ $2 . >
-
-# handle domain-specific masquerading
-R$* < @ $=M . > $* $: $1 < @ $2 . @ $M > $3 convert masqueraded doms
-R$* < @ $=w . > $* $: $1 < @ $2 . @ $M > $3
-R$* < @ *LOCAL* > $* $: $1 < @ $j . @ $M > $2
-R$* < @ $+ @ > $* $: $1 < @ $2 > $3 $M is null
-R$* < @ $+ @ $+ > $* $: $1 < @ $3 . > $4 $M is not null
-
-###################################################################
-### Ruleset 94 -- convert envelope names to masqueraded form ###
-###################################################################
-
-S94
-R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
-
-###################################################################
-### Ruleset 98 -- local part of ruleset zero (can be null) ###
-###################################################################
-
-S98
-
-# addresses sent to foo@host.REDIRECT will give a 551 error code
-R$* < @ $+ .REDIRECT. > $: $1 < @ $2 . REDIRECT . > < ${opMode} >
-R$* < @ $+ .REDIRECT. > <i> $: $1 < @ $2 . REDIRECT. >
-R$* < @ $+ .REDIRECT. > < $- > $# error $@ 5.1.1 $: "551 User has moved; please try " <$1@$2>
-
-
-
-######################################################################
-### CanonAddr -- Convert an address into a standard form for
-### relay checking. Route address syntax is
-### crudely converted into a %-hack address.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed address, not in source route form
-######################################################################
-
-SCanonAddr
-R$* $: $>Parse0 $>3 $1 make domain canonical
-R< @ $+ > : $* @ $* < @ $1 > : $2 % $3 change @ to % in src route
-R$* < @ $+ > : $* : $* $3 $1 < @ $2 > : $4 change to % hack.
-R$* < @ $+ > : $* $3 $1 < @ $2 >
-
-######################################################################
-### ParseRecipient -- Strip off hosts in $=R as well as possibly
-### $* $=m or the access database.
-### Check user portion for host separators.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed, non-local-relaying address
-######################################################################
-
-SParseRecipient
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots
-R<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part
-
-# if no $=O character, no host in the user portion, we are done
-R<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4>
-R<?> $* $@ $1
-
-
-
-R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 >
-
-R<RELAY> $* < @ $* > $@ $>ParseRecipient $1
-R<$-> $* $@ $2
-
-######################################################################
-### check_relay -- check hostname/address on SMTP startup
-######################################################################
-
-SLocal_check_relay
-Scheck_relay
-R$* $: $1 $| $>"Local_check_relay" $1
-R$* $| $* $| $#$* $#$3
-R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
-
-SBasic_check_relay
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-
-
-######################################################################
-### check_mail -- check SMTP `MAIL FROM:' command argument
-######################################################################
-
-SLocal_check_mail
-Scheck_mail
-R$* $: $1 $| $>"Local_check_mail" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_mail" $1
-
-SBasic_check_mail
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R<> $@ <OK>
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots
-# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
-R<?> $* < $* $=P > $* $: <OK> $1 < @ $2 $3 > $4
-R<?> $* < @ $+ > $* $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 > $3
-R<? $* <$->> $* < @ $+ > $*
- $: <$2> $3 < @ $4 > $5
-
-# handle case of @localhost on address
-R<$+> $* < @localhost > $: < ? $&{client_name} > <$1> $2 < @localhost >
-R<$+> $* < @localhost.$m >
- $: < ? $&{client_name} > <$1> $2 < @localhost.$m >
-R<$+> $* < @localhost.UUCP >
- $: < ? $&{client_name} > <$1> $2 < @localhost.UUCP >
-R<? $=w> <$+> $* <?> <$2> $3
-R<? $+> <$+> $* $#error $@ 5.5.4 $: "553 Real domain name required"
-R<?> <$+> $* $: <$1> $2
-
-
-# handle case of no @domain on address
-R<?> $* $: < ? $&{client_name} > $1
-R<?> $* $@ <OK> ...local unqualed ok
-R<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required"
- ...remote is not
-# check results
-R<?> $* $@ <OK>
-R<OK> $* $@ <OK>
-R<TEMP> $* $#error $@ 4.1.8 $: "451 Sender domain must resolve"
-R<PERM> $* $#error $@ 5.1.8 $: "501 Sender domain must exist"
-
-######################################################################
-### check_rcpt -- check SMTP `RCPT TO:' command argument
-######################################################################
-
-SLocal_check_rcpt
-Scheck_rcpt
-R$* $: $1 $| $>"Local_check_rcpt" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_rcpt" $1
-
-SBasic_check_rcpt
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R$* $: $>ParseRecipient $1 strip relayable hosts
-
-
-
-
-# anything terminating locally is ok
-R$+ < @ $=w > $@ OK
-R$+ < @ $* $=R > $@ OK
-
-
-# check for local user (i.e. unqualified address)
-R$* $: <?> $1
-R<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 >
-# local user is ok
-R<?> $+ $@ OK
-R<$+> $* $: $2
-
-# anything originating locally is ok
-R$* $: <?> $&{client_name}
-# check if bracketed IP address (forward lookup != reverse lookup)
-R<?> [$+] $: <BAD> [$1]
-# pass to name server to make hostname canonical
-R<?> $* $~P $: <?> $[ $1 $2 $]
-R<$-> $* $: $2
-R$* . $1 strip trailing dots
-R$@ $@ OK
-R$=w $@ OK
-R$* $=R $@ OK
-
-# check IP address
-R$* $: $&{client_addr}
-R$@ $@ OK originated locally
-R0 $@ OK originated locally
-R$=R $* $@ OK relayable IP address
-R$* $: [ $1 ] put brackets around it...
-R$=w $@ OK ... and see if it is local
-
-
-# anything else is bogus
-R$* $#error $@ 5.7.1 $: "550 Relaying denied"
-
-#\f
-######################################################################
-######################################################################
-#####
-##### MAILER DEFINITIONS
-#####
-######################################################################
-######################################################################
-
-
-##################################################
-### Local and Program Mailer specification ###
-##################################################
-
-##### @(#)local.m4 8.30 (Berkeley) 6/30/1998 #####
-
-Mlocal, P=/usr/libexec/mail.local, F=lsDFMAw5:/|@qrmn9, S=10/30, R=20/40,
- T=DNS/RFC822/X-Unix,
- A=mail -d $u
-Mprog, P=/bin/sh, F=lsDFMoqeu9, S=10/30, R=20/40, D=$z:/,
- T=X-Unix,
- A=sh -c $u
-
-#
-# Envelope sender rewriting
-#
-S10
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>94 $1 do masquerading
-
-#
-# Envelope recipient rewriting
-#
-S20
-R$+ < @ $* > $: $1 strip host part
-
-#
-# Header sender rewriting
-#
-S30
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>93 $1 do masquerading
-
-#
-# Header recipient rewriting
-#
-S40
-R$+ $: $>50 $1 add local domain if needed
-
-#
-# Common code to add local domain name (only if always-add-domain)
-#
-S50
-
-#####################################
-### SMTP Mailer specification ###
-#####################################
-
-##### @(#)smtp.m4 8.38 (Berkeley) 5/19/1998 #####
-
-Msmtp, P=[IPC], F=mDFMuX, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mesmtp, P=[IPC], F=mDFMuXa, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Msmtp8, P=[IPC], F=mDFMuX8, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mrelay, P=[IPC], F=mDFMuXa8, S=11/31, R=61, E=\r\n, L=2040,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-
-#
-# envelope sender rewriting
-#
-S11
-R$+ $: $>51 $1 sender/recipient common
-R$* :; <@> $@ list:; special case
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>94 $1 do masquerading
-
-
-#
-# envelope recipient rewriting --
-# also header recipient if not masquerading recipients
-#
-S21
-R$+ $: $>51 $1 sender/recipient common
-R$+ $: $>61 $1 qualify unqual'ed names
-
-
-#
-# header sender and masquerading header recipient rewriting
-#
-S31
-R$+ $: $>51 $1 sender/recipient common
-R:; <@> $@ list:; special case
-
-# do special header rewriting
-R$* <@> $* $@ $1 <@> $2 pass null host through
-R< @ $* > $* $@ < @ $1 > $2 pass route-addr through
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>93 $1 do masquerading
-
-
-#
-# convert pseudo-domain addresses to real domain addresses
-#
-S51
-
-# pass <route-addr>s through
-R< @ $+ > $* $@ < @ $1 > $2 resolve <route-addr>
-
-# output fake domains as user%fake@relay
-
-# do UUCP heuristics; note that these are shared with UUCP mailers
-R$+ < @ $+ .UUCP. > $: < $2 ! > $1 convert to UUCP form
-R$+ < @ $* > $* $@ $1 < @ $2 > $3 not UUCP form
-
-# leave these in .UUCP form to avoid further tampering
-R< $&h ! > $- ! $+ $@ $2 < @ $1 .UUCP. >
-R< $&h ! > $-.$+ ! $+ $@ $3 < @ $1.$2 >
-R< $&h ! > $+ $@ $1 < @ $&h .UUCP. >
-R< $+ ! > $+ $: $1 ! $2 < @ $Y > use UUCP_RELAY
-R$+ < @ $+ : $+ > $@ $1 < @ $3 > strip mailer: part
-R$+ < @ > $: $1 < @ *LOCAL* > if no UUCP_RELAY
-
-
-#
-# common sender and masquerading recipient rewriting
-#
-S61
-
-R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
-R$+ $@ $1 < @ *LOCAL* > add local qualification
-
-
-#
-# relay mailer header masquerading recipient rewriting
-#
-S71
-
-R$+ $: $>61 $1
-R$+ $: $>93 $1
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a generic configuration file for 4.4 BSD-based systems,
-# including 4.4-Lite, BSDi, NetBSD, and FreeBSD.
-# It has support for local and SMTP mail only. If you want to
-# customize it, copy it to a name appropriate for your environment
-# and do the modifications there.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)generic-bsd4.4.mc 8.7 (Berkeley) 5/19/1998')
-OSTYPE(bsd4.4)dnl
-DOMAIN(generic)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-######################################################################
-######################################################################
-#####
-##### SENDMAIL CONFIGURATION FILE
-#####
-##### built by gshapiro@knecht.sendmail.org on Thu Feb 4 16:39:22 PST 1999
-##### in /home/eric/src/sendmail/cf/cf
-##### using ../ as configuration include directory
-#####
-######################################################################
-######################################################################
-
-##### @(#)cfhead.m4 8.23 (Berkeley) 10/6/1998 #####
-##### @(#)cf.m4 8.29 (Berkeley) 5/19/1998 #####
-##### @(#)generic-hpux10.mc 8.8 (Berkeley) 5/19/1998 #####
-
-##### @(#)hpux10.m4 8.14 (Berkeley) 10/6/1998 #####
-
-
-##### @(#)generic.m4 8.9 (Berkeley) 5/19/1998 #####
-
-##### @(#)redirect.m4 8.10 (Berkeley) 5/19/1998 #####
-
-
-
-
-##### @(#)use_cw_file.m4 8.6 (Berkeley) 5/19/1998 #####
-
-
-
-##### @(#)proto.m4 8.243 (Berkeley) 2/2/1999 #####
-
-
-# level 8 config file format
-V8/Berkeley
-
-# override file safeties - setting this option compromises system security
-# need to set this now for the sake of class files
-#O DontBlameSendmail=safe
-
-##################
-# local info #
-##################
-
-Cwlocalhost
-# file containing names of hosts for which we receive email
-Fw/etc/sendmail.cw
-
-# my official domain name
-# ... define this only if sendmail cannot automatically determine your domain
-#Dj$w.Foo.COM
-
-
-CP.
-
-# "Smart" relay host (may be null)
-DS
-
-
-# operators that cannot be in local usernames (i.e., network indicators)
-CO @ % !
-
-# a class with just dot (for identifying canonical names)
-C..
-
-# a class with just a left bracket (for identifying domain literals)
-C[[
-
-
-
-
-
-
-
-
-
-# Resolve map (to check if a host exists in check_mail)
-Kresolve host -a<OK> -T<TEMP>
-
-# Hosts that will permit relaying ($=R)
-FR-o /etc/mail/relay-domains
-
-# who I send unqualified names to (null means deliver locally)
-DR
-
-# who gets all local email traffic ($R has precedence for unqualified names)
-DH
-
-# dequoting map
-Kdequote dequote
-
-# class E: names that should be exposed as from this host, even if we masquerade
-# class L: names that should be delivered locally, even if we have a relay
-# class M: domains that should be converted to $M
-#CL root
-CE root
-
-# who I masquerade as (null for no masquerading) (see also $=M)
-DM
-
-# my name for error messages
-DnMAILER-DAEMON
-
-
-CPREDIRECT
-
-# Configuration version number
-DZ8.9.3
-
-
-###############
-# Options #
-###############
-
-# strip message body to 7 bits on input?
-O SevenBitInput=False
-
-# 8-bit data handling
-O EightBitMode=pass8
-
-
-# wait for alias file rebuild (default units: minutes)
-O AliasWait=10
-
-# location of alias file
-O AliasFile=/etc/mail/aliases
-
-# minimum number of free blocks on filesystem
-O MinFreeBlocks=100
-
-# maximum message size
-#O MaxMessageSize=1000000
-
-# substitution for space (blank) characters
-O BlankSub=.
-
-# avoid connecting to "expensive" mailers on initial submission?
-O HoldExpensive=False
-
-# checkpoint queue runs after every N successful deliveries
-#O CheckpointInterval=10
-
-# default delivery mode
-O DeliveryMode=background
-
-# automatically rebuild the alias database?
-#O AutoRebuildAliases
-
-# error message header/file
-#O ErrorHeader=/etc/sendmail.oE
-
-# error mode
-#O ErrorMode=print
-
-# save Unix-style "From_" lines at top of header?
-#O SaveFromLine
-
-# temporary file mode
-O TempFileMode=0600
-
-# match recipients against GECOS field?
-#O MatchGECOS
-
-# maximum hop count
-#O MaxHopCount=17
-
-# location of help file
-O HelpFile=/usr/share/lib/sendmail.hf
-
-# ignore dots as terminators in incoming messages?
-#O IgnoreDots
-
-# name resolver options
-#O ResolverOptions=+AAONLY
-
-# deliver MIME-encapsulated error messages?
-O SendMimeErrors=True
-
-# Forward file search path
-O ForwardPath=$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z/.forward
-
-# open connection cache size
-O ConnectionCacheSize=2
-
-# open connection cache timeout
-O ConnectionCacheTimeout=5m
-
-# persistent host status directory
-#O HostStatusDirectory=.hoststat
-
-# single thread deliveries (requires HostStatusDirectory)?
-#O SingleThreadDelivery
-
-# use Errors-To: header?
-O UseErrorsTo=False
-
-# log level
-O LogLevel=9
-
-# send to me too, even in an alias expansion?
-#O MeToo
-
-# verify RHS in newaliases?
-O CheckAliases=False
-
-# default messages to old style headers if no special punctuation?
-O OldStyleHeaders=True
-
-# SMTP daemon options
-#O DaemonPortOptions=Port=esmtp
-
-# privacy flags
-O PrivacyOptions=authwarnings
-
-# who (if anyone) should get extra copies of error messages
-#O PostMasterCopy=Postmaster
-
-# slope of queue-only function
-#O QueueFactor=600000
-
-# queue directory
-O QueueDirectory=/var/spool/mqueue
-
-# timeouts (many of these)
-#O Timeout.initial=5m
-#O Timeout.connect=5m
-#O Timeout.iconnect=5m
-#O Timeout.helo=5m
-#O Timeout.mail=10m
-#O Timeout.rcpt=1h
-#O Timeout.datainit=5m
-#O Timeout.datablock=1h
-#O Timeout.datafinal=1h
-#O Timeout.rset=5m
-#O Timeout.quit=2m
-#O Timeout.misc=2m
-#O Timeout.command=1h
-#O Timeout.ident=30s
-#O Timeout.fileopen=60s
-O Timeout.queuereturn=5d
-#O Timeout.queuereturn.normal=5d
-#O Timeout.queuereturn.urgent=2d
-#O Timeout.queuereturn.non-urgent=7d
-O Timeout.queuewarn=4h
-#O Timeout.queuewarn.normal=4h
-#O Timeout.queuewarn.urgent=1h
-#O Timeout.queuewarn.non-urgent=12h
-#O Timeout.hoststatus=30m
-
-# should we not prune routes in route-addr syntax addresses?
-#O DontPruneRoutes
-
-# queue up everything before forking?
-O SuperSafe=True
-
-# status file
-O StatusFile=/etc/mail/sendmail.st
-
-# time zone handling:
-# if undefined, use system default
-# if defined but null, use TZ envariable passed in
-# if defined and non-null, use that info
-O TimeZoneSpec=
-
-# default UID (can be username or userid:groupid)
-#O DefaultUser=mailnull
-
-# list of locations of user database file (null means no lookup)
-#O UserDatabaseSpec=/etc/userdb
-
-# fallback MX host
-#O FallbackMXhost=fall.back.host.net
-
-# if we are the best MX host for a site, try it directly instead of config err
-#O TryNullMXList
-
-# load average at which we just queue messages
-#O QueueLA=8
-
-# load average at which we refuse connections
-#O RefuseLA=12
-
-# maximum number of children we allow at one time
-#O MaxDaemonChildren=12
-
-# maximum number of new connections per second
-#O ConnectionRateThrottle=3
-
-# work recipient factor
-#O RecipientFactor=30000
-
-# deliver each queued job in a separate process?
-#O ForkEachJob
-
-# work class factor
-#O ClassFactor=1800
-
-# work time factor
-#O RetryFactor=90000
-
-# shall we sort the queue by hostname first?
-#O QueueSortOrder=priority
-
-# minimum time in queue before retry
-#O MinQueueAge=30m
-
-# default character set
-#O DefaultCharSet=iso-8859-1
-
-# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
-#O ServiceSwitchFile=/etc/service.switch
-
-# hosts file (normally /etc/hosts)
-#O HostsFile=/etc/hosts
-
-# dialup line delay on connection failure
-#O DialDelay=10s
-
-# action to take if there are no recipients in the message
-#O NoRecipientAction=add-to-undisclosed
-
-# chrooted environment for writing to files
-#O SafeFileEnvironment=/arch
-
-# are colons OK in addresses?
-#O ColonOkInAddr
-
-# how many jobs can you process in the queue?
-#O MaxQueueRunSize=10000
-
-# shall I avoid expanding CNAMEs (violates protocols)?
-#O DontExpandCnames
-
-# SMTP initial login message (old $e macro)
-O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
-
-# UNIX initial From header format (old $l macro)
-O UnixFromLine=From $g $d
-
-# From: lines that have embedded newlines are unwrapped onto one line
-#O SingleLineFromHeader=False
-
-# Allow HELO SMTP command that does not include a host name
-#O AllowBogusHELO=False
-
-# Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
-#O MustQuoteChars=.
-
-# delimiter (operator) characters (old $o macro)
-O OperatorChars=.:%@!^/[]+
-
-# shall I avoid calling initgroups(3) because of high NIS costs?
-#O DontInitGroups
-
-# are group-writable :include: and .forward files (un)trustworthy?
-#O UnsafeGroupWrites
-
-# where do errors that occur when sending errors get sent?
-#O DoubleBounceAddress=postmaster
-
-# what user id do we assume for the majority of the processing?
-#O RunAsUser=sendmail
-
-# maximum number of recipients per SMTP envelope
-#O MaxRecipientsPerMessage=100
-
-# shall we get local names from our installed interfaces?
-#O DontProbeInterfaces
-
-
-
-
-
-
-###########################
-# Message precedences #
-###########################
-
-Pfirst-class=0
-Pspecial-delivery=100
-Plist=-30
-Pbulk=-60
-Pjunk=-100
-
-#####################
-# Trusted users #
-#####################
-
-# this is equivalent to setting class "t"
-#Ft/etc/sendmail.ct
-Troot
-Tdaemon
-Tuucp
-
-#########################
-# Format of headers #
-#########################
-
-H?P?Return-Path: <$g>
-HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
- $.by $j ($v/$Z)$?r with $r$. id $i$?u
- for $u; $|;
- $.$b
-H?D?Resent-Date: $a
-H?D?Date: $a
-H?F?Resent-From: $?x$x <$g>$|$g$.
-H?F?From: $?x$x <$g>$|$g$.
-H?x?Full-Name: $x
-# HPosted-Date: $a
-# H?l?Received-Date: $b
-H?M?Resent-Message-Id: <$t.$i@$j>
-H?M?Message-Id: <$t.$i@$j>
-#\f
-######################################################################
-######################################################################
-#####
-##### REWRITING RULES
-#####
-######################################################################
-######################################################################
-
-############################################
-### Ruleset 3 -- Name Canonicalization ###
-############################################
-S3
-
-# handle null input (translate to <@> special case)
-R$@ $@ <@>
-
-# strip group: syntax (not inside angle brackets!) and trailing semicolon
-R$* $: $1 <@> mark addresses
-R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
-R@ $* <@> $: @ $1 unmark @host:...
-R$* :: $* <@> $: $1 :: $2 unmark node::addr
-R:include: $* <@> $: :include: $1 unmark :include:...
-R$* [ $* : $* ] <@> $: $1 [ $2 : $3 ] unmark IPv6 addrs
-R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon
-R$* : $* <@> $: $2 strip colon if marked
-R$* <@> $: $1 unmark
-R$* ; $1 strip trailing semi
-R$* < $* ; > $1 < $2 > bogus bracketed semi
-
-# null input now results from list:; syntax
-R$@ $@ :; <@>
-
-# strip angle brackets -- note RFC733 heuristic to get innermost item
-R$* $: < $1 > housekeeping <>
-R$+ < $* > < $2 > strip excess on left
-R< $* > $+ < $1 > strip excess on right
-R<> $@ < @ > MAIL FROM:<> case
-R< $+ > $: $1 remove housekeeping <>
-
-# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
-R@ $+ , $+ @ $1 : $2 change all "," to ":"
-
-# localize and dispose of route-based addresses
-R@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr>
-
-# find focus for list syntax
-R $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax
-R $+ : $* ; $@ $1 : $2; list syntax
-
-# find focus for @ syntax addresses
-R$+ @ $+ $: $1 < @ $2 > focus on domain
-R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
-R$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical
-
-# do some sanity checking
-R$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs
-
-# convert old-style addresses to a domain-based address
-R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names
-R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps
-R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains
-
-# if we have % signs, take the rightmost one
-R$* % $* $1 @ $2 First make them all @s.
-R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
-R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish
-
-# else we must be a local name
-R$* $@ $>96 $1
-
-
-################################################
-### Ruleset 96 -- bottom half of ruleset 3 ###
-################################################
-
-S96
-
-# handle special cases for local names
-R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
-R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
-R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain
-R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d]
-R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
-R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr
-
-
-
-
-
-# if really UUCP, handle it immediately
-
-# try UUCP traffic as a local address
-R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3
-R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3
-
-# pass to name server to make hostname canonical
-R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4
-
-# local host aliases and pseudo-domains are always canonical
-R$* < @ $=w > $* $: $1 < @ $2 . > $3
-R$* < @ $j > $* $: $1 < @ $j . > $2
-R$* < @ $=M > $* $: $1 < @ $2 . > $3
-R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4
-R$* < @ $* . . > $* $1 < @ $2 . > $3
-
-
-##################################################
-### Ruleset 4 -- Final Output Post-rewriting ###
-##################################################
-S4
-
-R$* <@> $@ handle <> and list:;
-
-# strip trailing dot off possibly canonical name
-R$* < @ $+ . > $* $1 < @ $2 > $3
-
-# eliminate internal code -- should never get this far!
-R$* < @ *LOCAL* > $* $1 < @ $j > $2
-
-# externalize local domain info
-R$* < $+ > $* $1 $2 $3 defocus
-R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
-R@ $* $@ @ $1 ... and exit
-
-# UUCP must always be presented in old form
-R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u
-
-# delete duplicate local names
-R$+ % $=w @ $=w $1 @ $2 u%host@host => u@host
-
-
-
-##############################################################
-### Ruleset 97 -- recanonicalize and call ruleset zero ###
-### (used for recursive calls) ###
-##############################################################
-
-S97
-R$* $: $>3 $1
-R$* $@ $>0 $1
-
-
-######################################
-### Ruleset 0 -- Parse Address ###
-######################################
-
-S0
-
-R$* $: $>Parse0 $1 initial parsing
-R<@> $#local $: <@> special case error msgs
-R$* $: $>98 $1 handle local hacks
-R$* $: $>Parse1 $1 final parsing
-
-#
-# Parse0 -- do initial syntax checking and eliminate local addresses.
-# This should either return with the (possibly modified) input
-# or return with a #error mailer. It should not return with a
-# #mailer other than the #error mailer.
-#
-
-SParse0
-R<@> $@ <@> special case error msgs
-R$* : $* ; <@> $#error $@ 5.1.3 $: "List:; syntax illegal for recipient addresses"
-#R@ <@ $* > < @ $1 > catch "@@host" bogosity
-R<@ $+> $#error $@ 5.1.3 $: "User address required"
-R$* $: <> $1
-R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3
-R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "Colon illegal in host name part"
-R<> $* $1
-R$* < @ . $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-
-# now delete the local info -- note $=O to find characters that cause forwarding
-R$* < @ > $* $@ $>Parse0 $>3 $1 user@ => user
-R< @ $=w . > : $* $@ $>Parse0 $>3 $2 @here:... -> ...
-R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here
-R< @ $+ > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ $=w . > $@ $>Parse0 $>3 $1 $2 $3 ...@here -> ...
-R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"
-R< @ *LOCAL* > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ *LOCAL* >
- $@ $>Parse0 $>3 $1 $2 $3 ...@*LOCAL* -> ...
-R$* < @ *LOCAL* > $: $1
-
-#
-# Parse1 -- the bottom half of ruleset 0.
-#
-
-SParse1
-# handle numeric address spec
-R$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec
-R$* < @ [ $+ ] > $* $#esmtp $@ [$2] $: $1 < @ [$2] > $3 still numeric: send
-
-
-# short circuit local delivery so forwarded email works
-R$=L < @ $=w . > $#local $: @ $1 special local names
-R$+ < @ $=w . > $#local $: $1 regular local name
-
-
-# resolve remotely connected UUCP links (if any)
-
-# resolve fake top level domains by forwarding to other hosts
-
-
-
-# pass names that still have a host to a smarthost (if defined)
-R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name
-
-# deal with other remote names
-R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain
-
-# handle locally delivered names
-R$=L $#local $: @ $1 special local names
-R$+ $#local $: $1 regular local names
-
-###########################################################################
-### Ruleset 5 -- special rewriting after aliases have been expanded ###
-###########################################################################
-
-S5
-
-# deal with plussed users so aliases work nicely
-R$+ + * $#local $@ $&h $: $1
-R$+ + $* $#local $@ + $2 $: $1 + *
-
-# prepend an empty "forward host" on the front
-R$+ $: <> $1
-
-
-# see if we have a relay or a hub
-R< > $+ $: < $H > $1 try hub
-R< > $+ $: < $R > $1 try relay
-R< > $+ $: < > < $1 $&h > nope, restore +detail
-R< > < $+ + $* > $* < > < $1 > + $2 $3 find the user part
-R< > < $+ > + $* $#local $@ $2 $: @ $1 strip the extra +
-R< > < $+ > $@ $1 no +detail
-R$+ $: $1 <> $&h add +detail back in
-R$+ <> + $* $: $1 + $2 check whether +detail
-R$+ <> $* $: $1 else discard
-R< local : $* > $* $: $>95 < local : $1 > $2 no host extension
-R< error : $* > $* $: $>95 < error : $1 > $2 no host extension
-R< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 >
-R< $+ > $+ $@ $>95 < $1 > $2 < @ $1 >
-
-
-###################################################################
-### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
-###################################################################
-
-S95
-R< > $* $@ $1 strip off null relay
-R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2
-R< local : $* > $* $>CanonLocal < $1 > $2
-R< $- : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
-R< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
-R< $=w > $* $@ $2 delete local host
-R< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer
-
-###################################################################
-### Ruleset CanonLocal -- canonify local: syntax ###
-###################################################################
-
-SCanonLocal
-# strip local host from routed addresses
-R< $* > < @ $+ > : $+ $@ $>97 $3
-R< $* > $+ $=O $+ < @ $+ > $@ $>97 $2 $3 $4
-
-# strip trailing dot from any host name that may appear
-R< $* > $* < @ $* . > $: < $1 > $2 < @ $3 >
-
-# handle local: syntax -- use old user, either with or without host
-R< > $* < @ $* > $* $#local $@ $1@$2 $: $1
-R< > $+ $#local $@ $1 $: $1
-
-# handle local:user@host syntax -- ignore host part
-R< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 >
-
-# handle local:user syntax
-R< $+ > $* <@ $* > $* $#local $@ $2@$3 $: $1
-R< $+ > $* $#local $@ $2 $: $1
-
-###################################################################
-### Ruleset 93 -- convert header names to masqueraded form ###
-###################################################################
-
-S93
-
-
-# special case the users that should be exposed
-R$=E < @ *LOCAL* > $@ $1 < @ $j . > leave exposed
-R$=E < @ $=M . > $@ $1 < @ $2 . >
-R$=E < @ $=w . > $@ $1 < @ $2 . >
-
-# handle domain-specific masquerading
-R$* < @ $=M . > $* $: $1 < @ $2 . @ $M > $3 convert masqueraded doms
-R$* < @ $=w . > $* $: $1 < @ $2 . @ $M > $3
-R$* < @ *LOCAL* > $* $: $1 < @ $j . @ $M > $2
-R$* < @ $+ @ > $* $: $1 < @ $2 > $3 $M is null
-R$* < @ $+ @ $+ > $* $: $1 < @ $3 . > $4 $M is not null
-
-###################################################################
-### Ruleset 94 -- convert envelope names to masqueraded form ###
-###################################################################
-
-S94
-R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
-
-###################################################################
-### Ruleset 98 -- local part of ruleset zero (can be null) ###
-###################################################################
-
-S98
-
-# addresses sent to foo@host.REDIRECT will give a 551 error code
-R$* < @ $+ .REDIRECT. > $: $1 < @ $2 . REDIRECT . > < ${opMode} >
-R$* < @ $+ .REDIRECT. > <i> $: $1 < @ $2 . REDIRECT. >
-R$* < @ $+ .REDIRECT. > < $- > $# error $@ 5.1.1 $: "551 User has moved; please try " <$1@$2>
-
-
-
-######################################################################
-### CanonAddr -- Convert an address into a standard form for
-### relay checking. Route address syntax is
-### crudely converted into a %-hack address.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed address, not in source route form
-######################################################################
-
-SCanonAddr
-R$* $: $>Parse0 $>3 $1 make domain canonical
-R< @ $+ > : $* @ $* < @ $1 > : $2 % $3 change @ to % in src route
-R$* < @ $+ > : $* : $* $3 $1 < @ $2 > : $4 change to % hack.
-R$* < @ $+ > : $* $3 $1 < @ $2 >
-
-######################################################################
-### ParseRecipient -- Strip off hosts in $=R as well as possibly
-### $* $=m or the access database.
-### Check user portion for host separators.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed, non-local-relaying address
-######################################################################
-
-SParseRecipient
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots
-R<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part
-
-# if no $=O character, no host in the user portion, we are done
-R<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4>
-R<?> $* $@ $1
-
-
-
-R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 >
-
-R<RELAY> $* < @ $* > $@ $>ParseRecipient $1
-R<$-> $* $@ $2
-
-######################################################################
-### check_relay -- check hostname/address on SMTP startup
-######################################################################
-
-SLocal_check_relay
-Scheck_relay
-R$* $: $1 $| $>"Local_check_relay" $1
-R$* $| $* $| $#$* $#$3
-R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
-
-SBasic_check_relay
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-
-
-######################################################################
-### check_mail -- check SMTP `MAIL FROM:' command argument
-######################################################################
-
-SLocal_check_mail
-Scheck_mail
-R$* $: $1 $| $>"Local_check_mail" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_mail" $1
-
-SBasic_check_mail
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R<> $@ <OK>
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots
-# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
-R<?> $* < $* $=P > $* $: <OK> $1 < @ $2 $3 > $4
-R<?> $* < @ $+ > $* $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 > $3
-R<? $* <$->> $* < @ $+ > $*
- $: <$2> $3 < @ $4 > $5
-
-# handle case of @localhost on address
-R<$+> $* < @localhost > $: < ? $&{client_name} > <$1> $2 < @localhost >
-R<$+> $* < @localhost.$m >
- $: < ? $&{client_name} > <$1> $2 < @localhost.$m >
-R<$+> $* < @localhost.UUCP >
- $: < ? $&{client_name} > <$1> $2 < @localhost.UUCP >
-R<? $=w> <$+> $* <?> <$2> $3
-R<? $+> <$+> $* $#error $@ 5.5.4 $: "553 Real domain name required"
-R<?> <$+> $* $: <$1> $2
-
-
-# handle case of no @domain on address
-R<?> $* $: < ? $&{client_name} > $1
-R<?> $* $@ <OK> ...local unqualed ok
-R<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required"
- ...remote is not
-# check results
-R<?> $* $@ <OK>
-R<OK> $* $@ <OK>
-R<TEMP> $* $#error $@ 4.1.8 $: "451 Sender domain must resolve"
-R<PERM> $* $#error $@ 5.1.8 $: "501 Sender domain must exist"
-
-######################################################################
-### check_rcpt -- check SMTP `RCPT TO:' command argument
-######################################################################
-
-SLocal_check_rcpt
-Scheck_rcpt
-R$* $: $1 $| $>"Local_check_rcpt" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_rcpt" $1
-
-SBasic_check_rcpt
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R$* $: $>ParseRecipient $1 strip relayable hosts
-
-
-
-
-# anything terminating locally is ok
-R$+ < @ $=w > $@ OK
-R$+ < @ $* $=R > $@ OK
-
-
-# check for local user (i.e. unqualified address)
-R$* $: <?> $1
-R<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 >
-# local user is ok
-R<?> $+ $@ OK
-R<$+> $* $: $2
-
-# anything originating locally is ok
-R$* $: <?> $&{client_name}
-# check if bracketed IP address (forward lookup != reverse lookup)
-R<?> [$+] $: <BAD> [$1]
-# pass to name server to make hostname canonical
-R<?> $* $~P $: <?> $[ $1 $2 $]
-R<$-> $* $: $2
-R$* . $1 strip trailing dots
-R$@ $@ OK
-R$=w $@ OK
-R$* $=R $@ OK
-
-# check IP address
-R$* $: $&{client_addr}
-R$@ $@ OK originated locally
-R0 $@ OK originated locally
-R$=R $* $@ OK relayable IP address
-R$* $: [ $1 ] put brackets around it...
-R$=w $@ OK ... and see if it is local
-
-
-# anything else is bogus
-R$* $#error $@ 5.7.1 $: "550 Relaying denied"
-
-#\f
-######################################################################
-######################################################################
-#####
-##### MAILER DEFINITIONS
-#####
-######################################################################
-######################################################################
-
-
-##################################################
-### Local and Program Mailer specification ###
-##################################################
-
-##### @(#)local.m4 8.30 (Berkeley) 6/30/1998 #####
-
-Mlocal, P=/usr/bin/rmail, F=lsDFMAw5:/|@qm9, S=10/30, R=20/40,
- T=DNS/RFC822/X-Unix,
- A=rmail -d $u
-Mprog, P=/usr/bin/sh, F=lsDFMoqeu9, S=10/30, R=20/40, D=$z:/,
- T=X-Unix,
- A=sh -c $u
-
-#
-# Envelope sender rewriting
-#
-S10
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>94 $1 do masquerading
-
-#
-# Envelope recipient rewriting
-#
-S20
-R$+ < @ $* > $: $1 strip host part
-
-#
-# Header sender rewriting
-#
-S30
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>93 $1 do masquerading
-
-#
-# Header recipient rewriting
-#
-S40
-R$+ $: $>50 $1 add local domain if needed
-
-#
-# Common code to add local domain name (only if always-add-domain)
-#
-S50
-
-#####################################
-### SMTP Mailer specification ###
-#####################################
-
-##### @(#)smtp.m4 8.38 (Berkeley) 5/19/1998 #####
-
-Msmtp, P=[IPC], F=mDFMuX, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mesmtp, P=[IPC], F=mDFMuXa, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Msmtp8, P=[IPC], F=mDFMuX8, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mrelay, P=[IPC], F=mDFMuXa8, S=11/31, R=61, E=\r\n, L=2040,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-
-#
-# envelope sender rewriting
-#
-S11
-R$+ $: $>51 $1 sender/recipient common
-R$* :; <@> $@ list:; special case
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>94 $1 do masquerading
-
-
-#
-# envelope recipient rewriting --
-# also header recipient if not masquerading recipients
-#
-S21
-R$+ $: $>51 $1 sender/recipient common
-R$+ $: $>61 $1 qualify unqual'ed names
-
-
-#
-# header sender and masquerading header recipient rewriting
-#
-S31
-R$+ $: $>51 $1 sender/recipient common
-R:; <@> $@ list:; special case
-
-# do special header rewriting
-R$* <@> $* $@ $1 <@> $2 pass null host through
-R< @ $* > $* $@ < @ $1 > $2 pass route-addr through
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>93 $1 do masquerading
-
-
-#
-# convert pseudo-domain addresses to real domain addresses
-#
-S51
-
-# pass <route-addr>s through
-R< @ $+ > $* $@ < @ $1 > $2 resolve <route-addr>
-
-# output fake domains as user%fake@relay
-
-# do UUCP heuristics; note that these are shared with UUCP mailers
-R$+ < @ $+ .UUCP. > $: < $2 ! > $1 convert to UUCP form
-R$+ < @ $* > $* $@ $1 < @ $2 > $3 not UUCP form
-
-# leave these in .UUCP form to avoid further tampering
-R< $&h ! > $- ! $+ $@ $2 < @ $1 .UUCP. >
-R< $&h ! > $-.$+ ! $+ $@ $3 < @ $1.$2 >
-R< $&h ! > $+ $@ $1 < @ $&h .UUCP. >
-R< $+ ! > $+ $: $1 ! $2 < @ $Y > use UUCP_RELAY
-R$+ < @ $+ : $+ > $@ $1 < @ $3 > strip mailer: part
-R$+ < @ > $: $1 < @ *LOCAL* > if no UUCP_RELAY
-
-
-#
-# common sender and masquerading recipient rewriting
-#
-S61
-
-R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
-R$+ $@ $1 < @ *LOCAL* > add local qualification
-
-
-#
-# relay mailer header masquerading recipient rewriting
-#
-S71
-
-R$+ $: $>61 $1
-R$+ $: $>93 $1
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a generic configuration file for HP-UX 9.x.
-# It has support for local and SMTP mail only. If you want to
-# customize it, copy it to a name appropriate for your environment
-# and do the modifications there.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)generic-hpux10.mc 8.8 (Berkeley) 5/19/1998')
-OSTYPE(hpux10)dnl
-DOMAIN(generic)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-######################################################################
-######################################################################
-#####
-##### SENDMAIL CONFIGURATION FILE
-#####
-##### built by gshapiro@knecht.sendmail.org on Thu Feb 4 16:39:22 PST 1999
-##### in /home/eric/src/sendmail/cf/cf
-##### using ../ as configuration include directory
-#####
-######################################################################
-######################################################################
-
-##### @(#)cfhead.m4 8.23 (Berkeley) 10/6/1998 #####
-##### @(#)cf.m4 8.29 (Berkeley) 5/19/1998 #####
-##### @(#)generic-hpux9.mc 8.8 (Berkeley) 5/19/1998 #####
-
-##### @(#)hpux9.m4 8.19 (Berkeley) 10/6/1998 #####
-
-
-##### @(#)generic.m4 8.9 (Berkeley) 5/19/1998 #####
-
-##### @(#)redirect.m4 8.10 (Berkeley) 5/19/1998 #####
-
-
-
-
-##### @(#)use_cw_file.m4 8.6 (Berkeley) 5/19/1998 #####
-
-
-
-##### @(#)proto.m4 8.243 (Berkeley) 2/2/1999 #####
-
-
-# level 8 config file format
-V8/Berkeley
-
-# override file safeties - setting this option compromises system security
-# need to set this now for the sake of class files
-#O DontBlameSendmail=safe
-
-##################
-# local info #
-##################
-
-Cwlocalhost
-# file containing names of hosts for which we receive email
-Fw/etc/sendmail.cw
-
-# my official domain name
-# ... define this only if sendmail cannot automatically determine your domain
-#Dj$w.Foo.COM
-
-
-CP.
-
-# "Smart" relay host (may be null)
-DS
-
-
-# operators that cannot be in local usernames (i.e., network indicators)
-CO @ % !
-
-# a class with just dot (for identifying canonical names)
-C..
-
-# a class with just a left bracket (for identifying domain literals)
-C[[
-
-
-
-
-
-
-
-
-
-# Resolve map (to check if a host exists in check_mail)
-Kresolve host -a<OK> -T<TEMP>
-
-# Hosts that will permit relaying ($=R)
-FR-o /etc/mail/relay-domains
-
-# who I send unqualified names to (null means deliver locally)
-DR
-
-# who gets all local email traffic ($R has precedence for unqualified names)
-DH
-
-# dequoting map
-Kdequote dequote
-
-# class E: names that should be exposed as from this host, even if we masquerade
-# class L: names that should be delivered locally, even if we have a relay
-# class M: domains that should be converted to $M
-#CL root
-CE root
-
-# who I masquerade as (null for no masquerading) (see also $=M)
-DM
-
-# my name for error messages
-DnMAILER-DAEMON
-
-
-CPREDIRECT
-
-# Configuration version number
-DZ8.9.3
-
-
-###############
-# Options #
-###############
-
-# strip message body to 7 bits on input?
-O SevenBitInput=False
-
-# 8-bit data handling
-O EightBitMode=pass8
-
-
-# wait for alias file rebuild (default units: minutes)
-O AliasWait=10
-
-# location of alias file
-O AliasFile=/usr/lib/aliases
-
-# minimum number of free blocks on filesystem
-O MinFreeBlocks=100
-
-# maximum message size
-#O MaxMessageSize=1000000
-
-# substitution for space (blank) characters
-O BlankSub=.
-
-# avoid connecting to "expensive" mailers on initial submission?
-O HoldExpensive=False
-
-# checkpoint queue runs after every N successful deliveries
-#O CheckpointInterval=10
-
-# default delivery mode
-O DeliveryMode=background
-
-# automatically rebuild the alias database?
-#O AutoRebuildAliases
-
-# error message header/file
-#O ErrorHeader=/etc/sendmail.oE
-
-# error mode
-#O ErrorMode=print
-
-# save Unix-style "From_" lines at top of header?
-#O SaveFromLine
-
-# temporary file mode
-O TempFileMode=0600
-
-# match recipients against GECOS field?
-#O MatchGECOS
-
-# maximum hop count
-#O MaxHopCount=17
-
-# location of help file
-O HelpFile=/usr/lib/sendmail.hf
-
-# ignore dots as terminators in incoming messages?
-#O IgnoreDots
-
-# name resolver options
-#O ResolverOptions=+AAONLY
-
-# deliver MIME-encapsulated error messages?
-O SendMimeErrors=True
-
-# Forward file search path
-O ForwardPath=$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z/.forward
-
-# open connection cache size
-O ConnectionCacheSize=2
-
-# open connection cache timeout
-O ConnectionCacheTimeout=5m
-
-# persistent host status directory
-#O HostStatusDirectory=.hoststat
-
-# single thread deliveries (requires HostStatusDirectory)?
-#O SingleThreadDelivery
-
-# use Errors-To: header?
-O UseErrorsTo=False
-
-# log level
-O LogLevel=9
-
-# send to me too, even in an alias expansion?
-#O MeToo
-
-# verify RHS in newaliases?
-O CheckAliases=False
-
-# default messages to old style headers if no special punctuation?
-O OldStyleHeaders=True
-
-# SMTP daemon options
-#O DaemonPortOptions=Port=esmtp
-
-# privacy flags
-O PrivacyOptions=authwarnings
-
-# who (if anyone) should get extra copies of error messages
-#O PostMasterCopy=Postmaster
-
-# slope of queue-only function
-#O QueueFactor=600000
-
-# queue directory
-O QueueDirectory=/usr/spool/mqueue
-
-# timeouts (many of these)
-#O Timeout.initial=5m
-#O Timeout.connect=5m
-#O Timeout.iconnect=5m
-#O Timeout.helo=5m
-#O Timeout.mail=10m
-#O Timeout.rcpt=1h
-#O Timeout.datainit=5m
-#O Timeout.datablock=1h
-#O Timeout.datafinal=1h
-#O Timeout.rset=5m
-#O Timeout.quit=2m
-#O Timeout.misc=2m
-#O Timeout.command=1h
-#O Timeout.ident=30s
-#O Timeout.fileopen=60s
-O Timeout.queuereturn=5d
-#O Timeout.queuereturn.normal=5d
-#O Timeout.queuereturn.urgent=2d
-#O Timeout.queuereturn.non-urgent=7d
-O Timeout.queuewarn=4h
-#O Timeout.queuewarn.normal=4h
-#O Timeout.queuewarn.urgent=1h
-#O Timeout.queuewarn.non-urgent=12h
-#O Timeout.hoststatus=30m
-
-# should we not prune routes in route-addr syntax addresses?
-#O DontPruneRoutes
-
-# queue up everything before forking?
-O SuperSafe=True
-
-# status file
-O StatusFile=/usr/lib/sendmail.st
-
-# time zone handling:
-# if undefined, use system default
-# if defined but null, use TZ envariable passed in
-# if defined and non-null, use that info
-O TimeZoneSpec=
-
-# default UID (can be username or userid:groupid)
-#O DefaultUser=mailnull
-
-# list of locations of user database file (null means no lookup)
-#O UserDatabaseSpec=/etc/userdb
-
-# fallback MX host
-#O FallbackMXhost=fall.back.host.net
-
-# if we are the best MX host for a site, try it directly instead of config err
-#O TryNullMXList
-
-# load average at which we just queue messages
-#O QueueLA=8
-
-# load average at which we refuse connections
-#O RefuseLA=12
-
-# maximum number of children we allow at one time
-#O MaxDaemonChildren=12
-
-# maximum number of new connections per second
-#O ConnectionRateThrottle=3
-
-# work recipient factor
-#O RecipientFactor=30000
-
-# deliver each queued job in a separate process?
-#O ForkEachJob
-
-# work class factor
-#O ClassFactor=1800
-
-# work time factor
-#O RetryFactor=90000
-
-# shall we sort the queue by hostname first?
-#O QueueSortOrder=priority
-
-# minimum time in queue before retry
-#O MinQueueAge=30m
-
-# default character set
-#O DefaultCharSet=iso-8859-1
-
-# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
-#O ServiceSwitchFile=/etc/service.switch
-
-# hosts file (normally /etc/hosts)
-#O HostsFile=/etc/hosts
-
-# dialup line delay on connection failure
-#O DialDelay=10s
-
-# action to take if there are no recipients in the message
-#O NoRecipientAction=add-to-undisclosed
-
-# chrooted environment for writing to files
-#O SafeFileEnvironment=/arch
-
-# are colons OK in addresses?
-#O ColonOkInAddr
-
-# how many jobs can you process in the queue?
-#O MaxQueueRunSize=10000
-
-# shall I avoid expanding CNAMEs (violates protocols)?
-#O DontExpandCnames
-
-# SMTP initial login message (old $e macro)
-O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
-
-# UNIX initial From header format (old $l macro)
-O UnixFromLine=From $g $d
-
-# From: lines that have embedded newlines are unwrapped onto one line
-#O SingleLineFromHeader=False
-
-# Allow HELO SMTP command that does not include a host name
-#O AllowBogusHELO=False
-
-# Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
-#O MustQuoteChars=.
-
-# delimiter (operator) characters (old $o macro)
-O OperatorChars=.:%@!^/[]+
-
-# shall I avoid calling initgroups(3) because of high NIS costs?
-#O DontInitGroups
-
-# are group-writable :include: and .forward files (un)trustworthy?
-#O UnsafeGroupWrites
-
-# where do errors that occur when sending errors get sent?
-#O DoubleBounceAddress=postmaster
-
-# what user id do we assume for the majority of the processing?
-#O RunAsUser=sendmail
-
-# maximum number of recipients per SMTP envelope
-#O MaxRecipientsPerMessage=100
-
-# shall we get local names from our installed interfaces?
-#O DontProbeInterfaces
-
-
-
-
-
-
-###########################
-# Message precedences #
-###########################
-
-Pfirst-class=0
-Pspecial-delivery=100
-Plist=-30
-Pbulk=-60
-Pjunk=-100
-
-#####################
-# Trusted users #
-#####################
-
-# this is equivalent to setting class "t"
-#Ft/etc/sendmail.ct
-Troot
-Tdaemon
-Tuucp
-
-#########################
-# Format of headers #
-#########################
-
-H?P?Return-Path: <$g>
-HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
- $.by $j ($v/$Z)$?r with $r$. id $i$?u
- for $u; $|;
- $.$b
-H?D?Resent-Date: $a
-H?D?Date: $a
-H?F?Resent-From: $?x$x <$g>$|$g$.
-H?F?From: $?x$x <$g>$|$g$.
-H?x?Full-Name: $x
-# HPosted-Date: $a
-# H?l?Received-Date: $b
-H?M?Resent-Message-Id: <$t.$i@$j>
-H?M?Message-Id: <$t.$i@$j>
-#\f
-######################################################################
-######################################################################
-#####
-##### REWRITING RULES
-#####
-######################################################################
-######################################################################
-
-############################################
-### Ruleset 3 -- Name Canonicalization ###
-############################################
-S3
-
-# handle null input (translate to <@> special case)
-R$@ $@ <@>
-
-# strip group: syntax (not inside angle brackets!) and trailing semicolon
-R$* $: $1 <@> mark addresses
-R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
-R@ $* <@> $: @ $1 unmark @host:...
-R$* :: $* <@> $: $1 :: $2 unmark node::addr
-R:include: $* <@> $: :include: $1 unmark :include:...
-R$* [ $* : $* ] <@> $: $1 [ $2 : $3 ] unmark IPv6 addrs
-R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon
-R$* : $* <@> $: $2 strip colon if marked
-R$* <@> $: $1 unmark
-R$* ; $1 strip trailing semi
-R$* < $* ; > $1 < $2 > bogus bracketed semi
-
-# null input now results from list:; syntax
-R$@ $@ :; <@>
-
-# strip angle brackets -- note RFC733 heuristic to get innermost item
-R$* $: < $1 > housekeeping <>
-R$+ < $* > < $2 > strip excess on left
-R< $* > $+ < $1 > strip excess on right
-R<> $@ < @ > MAIL FROM:<> case
-R< $+ > $: $1 remove housekeeping <>
-
-# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
-R@ $+ , $+ @ $1 : $2 change all "," to ":"
-
-# localize and dispose of route-based addresses
-R@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr>
-
-# find focus for list syntax
-R $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax
-R $+ : $* ; $@ $1 : $2; list syntax
-
-# find focus for @ syntax addresses
-R$+ @ $+ $: $1 < @ $2 > focus on domain
-R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
-R$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical
-
-# do some sanity checking
-R$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs
-
-# convert old-style addresses to a domain-based address
-R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names
-R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps
-R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains
-
-# if we have % signs, take the rightmost one
-R$* % $* $1 @ $2 First make them all @s.
-R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
-R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish
-
-# else we must be a local name
-R$* $@ $>96 $1
-
-
-################################################
-### Ruleset 96 -- bottom half of ruleset 3 ###
-################################################
-
-S96
-
-# handle special cases for local names
-R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
-R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
-R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain
-R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d]
-R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
-R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr
-
-
-
-
-
-# if really UUCP, handle it immediately
-
-# try UUCP traffic as a local address
-R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3
-R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3
-
-# pass to name server to make hostname canonical
-R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4
-
-# local host aliases and pseudo-domains are always canonical
-R$* < @ $=w > $* $: $1 < @ $2 . > $3
-R$* < @ $j > $* $: $1 < @ $j . > $2
-R$* < @ $=M > $* $: $1 < @ $2 . > $3
-R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4
-R$* < @ $* . . > $* $1 < @ $2 . > $3
-
-
-##################################################
-### Ruleset 4 -- Final Output Post-rewriting ###
-##################################################
-S4
-
-R$* <@> $@ handle <> and list:;
-
-# strip trailing dot off possibly canonical name
-R$* < @ $+ . > $* $1 < @ $2 > $3
-
-# eliminate internal code -- should never get this far!
-R$* < @ *LOCAL* > $* $1 < @ $j > $2
-
-# externalize local domain info
-R$* < $+ > $* $1 $2 $3 defocus
-R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
-R@ $* $@ @ $1 ... and exit
-
-# UUCP must always be presented in old form
-R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u
-
-# delete duplicate local names
-R$+ % $=w @ $=w $1 @ $2 u%host@host => u@host
-
-
-
-##############################################################
-### Ruleset 97 -- recanonicalize and call ruleset zero ###
-### (used for recursive calls) ###
-##############################################################
-
-S97
-R$* $: $>3 $1
-R$* $@ $>0 $1
-
-
-######################################
-### Ruleset 0 -- Parse Address ###
-######################################
-
-S0
-
-R$* $: $>Parse0 $1 initial parsing
-R<@> $#local $: <@> special case error msgs
-R$* $: $>98 $1 handle local hacks
-R$* $: $>Parse1 $1 final parsing
-
-#
-# Parse0 -- do initial syntax checking and eliminate local addresses.
-# This should either return with the (possibly modified) input
-# or return with a #error mailer. It should not return with a
-# #mailer other than the #error mailer.
-#
-
-SParse0
-R<@> $@ <@> special case error msgs
-R$* : $* ; <@> $#error $@ 5.1.3 $: "List:; syntax illegal for recipient addresses"
-#R@ <@ $* > < @ $1 > catch "@@host" bogosity
-R<@ $+> $#error $@ 5.1.3 $: "User address required"
-R$* $: <> $1
-R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3
-R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "Colon illegal in host name part"
-R<> $* $1
-R$* < @ . $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-
-# now delete the local info -- note $=O to find characters that cause forwarding
-R$* < @ > $* $@ $>Parse0 $>3 $1 user@ => user
-R< @ $=w . > : $* $@ $>Parse0 $>3 $2 @here:... -> ...
-R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here
-R< @ $+ > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ $=w . > $@ $>Parse0 $>3 $1 $2 $3 ...@here -> ...
-R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"
-R< @ *LOCAL* > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ *LOCAL* >
- $@ $>Parse0 $>3 $1 $2 $3 ...@*LOCAL* -> ...
-R$* < @ *LOCAL* > $: $1
-
-#
-# Parse1 -- the bottom half of ruleset 0.
-#
-
-SParse1
-# handle numeric address spec
-R$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec
-R$* < @ [ $+ ] > $* $#esmtp $@ [$2] $: $1 < @ [$2] > $3 still numeric: send
-
-
-# short circuit local delivery so forwarded email works
-R$=L < @ $=w . > $#local $: @ $1 special local names
-R$+ < @ $=w . > $#local $: $1 regular local name
-
-
-# resolve remotely connected UUCP links (if any)
-
-# resolve fake top level domains by forwarding to other hosts
-
-
-
-# pass names that still have a host to a smarthost (if defined)
-R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name
-
-# deal with other remote names
-R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain
-
-# handle locally delivered names
-R$=L $#local $: @ $1 special local names
-R$+ $#local $: $1 regular local names
-
-###########################################################################
-### Ruleset 5 -- special rewriting after aliases have been expanded ###
-###########################################################################
-
-S5
-
-# deal with plussed users so aliases work nicely
-R$+ + * $#local $@ $&h $: $1
-R$+ + $* $#local $@ + $2 $: $1 + *
-
-# prepend an empty "forward host" on the front
-R$+ $: <> $1
-
-
-# see if we have a relay or a hub
-R< > $+ $: < $H > $1 try hub
-R< > $+ $: < $R > $1 try relay
-R< > $+ $: < > < $1 $&h > nope, restore +detail
-R< > < $+ + $* > $* < > < $1 > + $2 $3 find the user part
-R< > < $+ > + $* $#local $@ $2 $: @ $1 strip the extra +
-R< > < $+ > $@ $1 no +detail
-R$+ $: $1 <> $&h add +detail back in
-R$+ <> + $* $: $1 + $2 check whether +detail
-R$+ <> $* $: $1 else discard
-R< local : $* > $* $: $>95 < local : $1 > $2 no host extension
-R< error : $* > $* $: $>95 < error : $1 > $2 no host extension
-R< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 >
-R< $+ > $+ $@ $>95 < $1 > $2 < @ $1 >
-
-
-###################################################################
-### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
-###################################################################
-
-S95
-R< > $* $@ $1 strip off null relay
-R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2
-R< local : $* > $* $>CanonLocal < $1 > $2
-R< $- : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
-R< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
-R< $=w > $* $@ $2 delete local host
-R< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer
-
-###################################################################
-### Ruleset CanonLocal -- canonify local: syntax ###
-###################################################################
-
-SCanonLocal
-# strip local host from routed addresses
-R< $* > < @ $+ > : $+ $@ $>97 $3
-R< $* > $+ $=O $+ < @ $+ > $@ $>97 $2 $3 $4
-
-# strip trailing dot from any host name that may appear
-R< $* > $* < @ $* . > $: < $1 > $2 < @ $3 >
-
-# handle local: syntax -- use old user, either with or without host
-R< > $* < @ $* > $* $#local $@ $1@$2 $: $1
-R< > $+ $#local $@ $1 $: $1
-
-# handle local:user@host syntax -- ignore host part
-R< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 >
-
-# handle local:user syntax
-R< $+ > $* <@ $* > $* $#local $@ $2@$3 $: $1
-R< $+ > $* $#local $@ $2 $: $1
-
-###################################################################
-### Ruleset 93 -- convert header names to masqueraded form ###
-###################################################################
-
-S93
-
-
-# special case the users that should be exposed
-R$=E < @ *LOCAL* > $@ $1 < @ $j . > leave exposed
-R$=E < @ $=M . > $@ $1 < @ $2 . >
-R$=E < @ $=w . > $@ $1 < @ $2 . >
-
-# handle domain-specific masquerading
-R$* < @ $=M . > $* $: $1 < @ $2 . @ $M > $3 convert masqueraded doms
-R$* < @ $=w . > $* $: $1 < @ $2 . @ $M > $3
-R$* < @ *LOCAL* > $* $: $1 < @ $j . @ $M > $2
-R$* < @ $+ @ > $* $: $1 < @ $2 > $3 $M is null
-R$* < @ $+ @ $+ > $* $: $1 < @ $3 . > $4 $M is not null
-
-###################################################################
-### Ruleset 94 -- convert envelope names to masqueraded form ###
-###################################################################
-
-S94
-R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
-
-###################################################################
-### Ruleset 98 -- local part of ruleset zero (can be null) ###
-###################################################################
-
-S98
-
-# addresses sent to foo@host.REDIRECT will give a 551 error code
-R$* < @ $+ .REDIRECT. > $: $1 < @ $2 . REDIRECT . > < ${opMode} >
-R$* < @ $+ .REDIRECT. > <i> $: $1 < @ $2 . REDIRECT. >
-R$* < @ $+ .REDIRECT. > < $- > $# error $@ 5.1.1 $: "551 User has moved; please try " <$1@$2>
-
-
-
-######################################################################
-### CanonAddr -- Convert an address into a standard form for
-### relay checking. Route address syntax is
-### crudely converted into a %-hack address.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed address, not in source route form
-######################################################################
-
-SCanonAddr
-R$* $: $>Parse0 $>3 $1 make domain canonical
-R< @ $+ > : $* @ $* < @ $1 > : $2 % $3 change @ to % in src route
-R$* < @ $+ > : $* : $* $3 $1 < @ $2 > : $4 change to % hack.
-R$* < @ $+ > : $* $3 $1 < @ $2 >
-
-######################################################################
-### ParseRecipient -- Strip off hosts in $=R as well as possibly
-### $* $=m or the access database.
-### Check user portion for host separators.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed, non-local-relaying address
-######################################################################
-
-SParseRecipient
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots
-R<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part
-
-# if no $=O character, no host in the user portion, we are done
-R<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4>
-R<?> $* $@ $1
-
-
-
-R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 >
-
-R<RELAY> $* < @ $* > $@ $>ParseRecipient $1
-R<$-> $* $@ $2
-
-######################################################################
-### check_relay -- check hostname/address on SMTP startup
-######################################################################
-
-SLocal_check_relay
-Scheck_relay
-R$* $: $1 $| $>"Local_check_relay" $1
-R$* $| $* $| $#$* $#$3
-R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
-
-SBasic_check_relay
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-
-
-######################################################################
-### check_mail -- check SMTP `MAIL FROM:' command argument
-######################################################################
-
-SLocal_check_mail
-Scheck_mail
-R$* $: $1 $| $>"Local_check_mail" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_mail" $1
-
-SBasic_check_mail
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R<> $@ <OK>
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots
-# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
-R<?> $* < $* $=P > $* $: <OK> $1 < @ $2 $3 > $4
-R<?> $* < @ $+ > $* $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 > $3
-R<? $* <$->> $* < @ $+ > $*
- $: <$2> $3 < @ $4 > $5
-
-# handle case of @localhost on address
-R<$+> $* < @localhost > $: < ? $&{client_name} > <$1> $2 < @localhost >
-R<$+> $* < @localhost.$m >
- $: < ? $&{client_name} > <$1> $2 < @localhost.$m >
-R<$+> $* < @localhost.UUCP >
- $: < ? $&{client_name} > <$1> $2 < @localhost.UUCP >
-R<? $=w> <$+> $* <?> <$2> $3
-R<? $+> <$+> $* $#error $@ 5.5.4 $: "553 Real domain name required"
-R<?> <$+> $* $: <$1> $2
-
-
-# handle case of no @domain on address
-R<?> $* $: < ? $&{client_name} > $1
-R<?> $* $@ <OK> ...local unqualed ok
-R<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required"
- ...remote is not
-# check results
-R<?> $* $@ <OK>
-R<OK> $* $@ <OK>
-R<TEMP> $* $#error $@ 4.1.8 $: "451 Sender domain must resolve"
-R<PERM> $* $#error $@ 5.1.8 $: "501 Sender domain must exist"
-
-######################################################################
-### check_rcpt -- check SMTP `RCPT TO:' command argument
-######################################################################
-
-SLocal_check_rcpt
-Scheck_rcpt
-R$* $: $1 $| $>"Local_check_rcpt" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_rcpt" $1
-
-SBasic_check_rcpt
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R$* $: $>ParseRecipient $1 strip relayable hosts
-
-
-
-
-# anything terminating locally is ok
-R$+ < @ $=w > $@ OK
-R$+ < @ $* $=R > $@ OK
-
-
-# check for local user (i.e. unqualified address)
-R$* $: <?> $1
-R<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 >
-# local user is ok
-R<?> $+ $@ OK
-R<$+> $* $: $2
-
-# anything originating locally is ok
-R$* $: <?> $&{client_name}
-# check if bracketed IP address (forward lookup != reverse lookup)
-R<?> [$+] $: <BAD> [$1]
-# pass to name server to make hostname canonical
-R<?> $* $~P $: <?> $[ $1 $2 $]
-R<$-> $* $: $2
-R$* . $1 strip trailing dots
-R$@ $@ OK
-R$=w $@ OK
-R$* $=R $@ OK
-
-# check IP address
-R$* $: $&{client_addr}
-R$@ $@ OK originated locally
-R0 $@ OK originated locally
-R$=R $* $@ OK relayable IP address
-R$* $: [ $1 ] put brackets around it...
-R$=w $@ OK ... and see if it is local
-
-
-# anything else is bogus
-R$* $#error $@ 5.7.1 $: "550 Relaying denied"
-
-#\f
-######################################################################
-######################################################################
-#####
-##### MAILER DEFINITIONS
-#####
-######################################################################
-######################################################################
-
-
-##################################################
-### Local and Program Mailer specification ###
-##################################################
-
-##### @(#)local.m4 8.30 (Berkeley) 6/30/1998 #####
-
-Mlocal, P=/bin/rmail, F=lsDFMAw5:/|@qm9, S=10/30, R=20/40,
- T=DNS/RFC822/X-Unix,
- A=rmail -d $u
-Mprog, P=/bin/sh, F=lsDFMoqeu9, S=10/30, R=20/40, D=$z:/,
- T=X-Unix,
- A=sh -c $u
-
-#
-# Envelope sender rewriting
-#
-S10
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>94 $1 do masquerading
-
-#
-# Envelope recipient rewriting
-#
-S20
-R$+ < @ $* > $: $1 strip host part
-
-#
-# Header sender rewriting
-#
-S30
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>93 $1 do masquerading
-
-#
-# Header recipient rewriting
-#
-S40
-R$+ $: $>50 $1 add local domain if needed
-
-#
-# Common code to add local domain name (only if always-add-domain)
-#
-S50
-
-#####################################
-### SMTP Mailer specification ###
-#####################################
-
-##### @(#)smtp.m4 8.38 (Berkeley) 5/19/1998 #####
-
-Msmtp, P=[IPC], F=mDFMuX, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mesmtp, P=[IPC], F=mDFMuXa, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Msmtp8, P=[IPC], F=mDFMuX8, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mrelay, P=[IPC], F=mDFMuXa8, S=11/31, R=61, E=\r\n, L=2040,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-
-#
-# envelope sender rewriting
-#
-S11
-R$+ $: $>51 $1 sender/recipient common
-R$* :; <@> $@ list:; special case
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>94 $1 do masquerading
-
-
-#
-# envelope recipient rewriting --
-# also header recipient if not masquerading recipients
-#
-S21
-R$+ $: $>51 $1 sender/recipient common
-R$+ $: $>61 $1 qualify unqual'ed names
-
-
-#
-# header sender and masquerading header recipient rewriting
-#
-S31
-R$+ $: $>51 $1 sender/recipient common
-R:; <@> $@ list:; special case
-
-# do special header rewriting
-R$* <@> $* $@ $1 <@> $2 pass null host through
-R< @ $* > $* $@ < @ $1 > $2 pass route-addr through
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>93 $1 do masquerading
-
-
-#
-# convert pseudo-domain addresses to real domain addresses
-#
-S51
-
-# pass <route-addr>s through
-R< @ $+ > $* $@ < @ $1 > $2 resolve <route-addr>
-
-# output fake domains as user%fake@relay
-
-# do UUCP heuristics; note that these are shared with UUCP mailers
-R$+ < @ $+ .UUCP. > $: < $2 ! > $1 convert to UUCP form
-R$+ < @ $* > $* $@ $1 < @ $2 > $3 not UUCP form
-
-# leave these in .UUCP form to avoid further tampering
-R< $&h ! > $- ! $+ $@ $2 < @ $1 .UUCP. >
-R< $&h ! > $-.$+ ! $+ $@ $3 < @ $1.$2 >
-R< $&h ! > $+ $@ $1 < @ $&h .UUCP. >
-R< $+ ! > $+ $: $1 ! $2 < @ $Y > use UUCP_RELAY
-R$+ < @ $+ : $+ > $@ $1 < @ $3 > strip mailer: part
-R$+ < @ > $: $1 < @ *LOCAL* > if no UUCP_RELAY
-
-
-#
-# common sender and masquerading recipient rewriting
-#
-S61
-
-R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
-R$+ $@ $1 < @ *LOCAL* > add local qualification
-
-
-#
-# relay mailer header masquerading recipient rewriting
-#
-S71
-
-R$+ $: $>61 $1
-R$+ $: $>93 $1
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a generic configuration file for HP-UX 9.x.
-# It has support for local and SMTP mail only. If you want to
-# customize it, copy it to a name appropriate for your environment
-# and do the modifications there.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)generic-hpux9.mc 8.8 (Berkeley) 5/19/1998')
-OSTYPE(hpux9)dnl
-DOMAIN(generic)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a generic configuration file for NEXTSTEP 3.3 systems.
-# It has support for local and SMTP mail only. If you want to
-# customize it, copy it to a name appropriate for your environment
-# and do the modifications there.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)generic-nextstep3.3.mc 8.7 (Berkeley) 5/19/1998')
-OSTYPE(nextstep)dnl
-DOMAIN(generic)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-######################################################################
-######################################################################
-#####
-##### SENDMAIL CONFIGURATION FILE
-#####
-##### built by gshapiro@knecht.sendmail.org on Thu Feb 4 16:39:23 PST 1999
-##### in /home/eric/src/sendmail/cf/cf
-##### using ../ as configuration include directory
-#####
-######################################################################
-######################################################################
-
-##### @(#)cfhead.m4 8.23 (Berkeley) 10/6/1998 #####
-##### @(#)cf.m4 8.29 (Berkeley) 5/19/1998 #####
-##### @(#)generic-osf1.mc 8.8 (Berkeley) 5/19/1998 #####
-
-##### @(#)osf1.m4 8.11 (Berkeley) 10/6/1998 #####
-
-
-##### @(#)generic.m4 8.9 (Berkeley) 5/19/1998 #####
-
-##### @(#)redirect.m4 8.10 (Berkeley) 5/19/1998 #####
-
-
-
-
-##### @(#)use_cw_file.m4 8.6 (Berkeley) 5/19/1998 #####
-
-
-
-##### @(#)proto.m4 8.243 (Berkeley) 2/2/1999 #####
-
-
-# level 8 config file format
-V8/Berkeley
-
-# override file safeties - setting this option compromises system security
-# need to set this now for the sake of class files
-#O DontBlameSendmail=safe
-
-##################
-# local info #
-##################
-
-Cwlocalhost
-# file containing names of hosts for which we receive email
-Fw/etc/sendmail.cw
-
-# my official domain name
-# ... define this only if sendmail cannot automatically determine your domain
-#Dj$w.Foo.COM
-
-
-CP.
-
-# "Smart" relay host (may be null)
-DS
-
-
-# operators that cannot be in local usernames (i.e., network indicators)
-CO @ % !
-
-# a class with just dot (for identifying canonical names)
-C..
-
-# a class with just a left bracket (for identifying domain literals)
-C[[
-
-
-
-
-
-
-
-
-
-# Resolve map (to check if a host exists in check_mail)
-Kresolve host -a<OK> -T<TEMP>
-
-# Hosts that will permit relaying ($=R)
-FR-o /etc/mail/relay-domains
-
-# who I send unqualified names to (null means deliver locally)
-DR
-
-# who gets all local email traffic ($R has precedence for unqualified names)
-DH
-
-# dequoting map
-Kdequote dequote
-
-# class E: names that should be exposed as from this host, even if we masquerade
-# class L: names that should be delivered locally, even if we have a relay
-# class M: domains that should be converted to $M
-#CL root
-CE root
-
-# who I masquerade as (null for no masquerading) (see also $=M)
-DM
-
-# my name for error messages
-DnMAILER-DAEMON
-
-
-CPREDIRECT
-
-# Configuration version number
-DZ8.9.3
-
-
-###############
-# Options #
-###############
-
-# strip message body to 7 bits on input?
-O SevenBitInput=False
-
-# 8-bit data handling
-O EightBitMode=pass8
-
-
-# wait for alias file rebuild (default units: minutes)
-O AliasWait=10
-
-# location of alias file
-O AliasFile=/usr/adm/sendmail/aliases
-
-# minimum number of free blocks on filesystem
-O MinFreeBlocks=100
-
-# maximum message size
-#O MaxMessageSize=1000000
-
-# substitution for space (blank) characters
-O BlankSub=.
-
-# avoid connecting to "expensive" mailers on initial submission?
-O HoldExpensive=False
-
-# checkpoint queue runs after every N successful deliveries
-#O CheckpointInterval=10
-
-# default delivery mode
-O DeliveryMode=background
-
-# automatically rebuild the alias database?
-#O AutoRebuildAliases
-
-# error message header/file
-#O ErrorHeader=/etc/sendmail.oE
-
-# error mode
-#O ErrorMode=print
-
-# save Unix-style "From_" lines at top of header?
-#O SaveFromLine
-
-# temporary file mode
-O TempFileMode=0600
-
-# match recipients against GECOS field?
-#O MatchGECOS
-
-# maximum hop count
-#O MaxHopCount=17
-
-# location of help file
-O HelpFile=/usr/share/lib/sendmail.hf
-
-# ignore dots as terminators in incoming messages?
-#O IgnoreDots
-
-# name resolver options
-#O ResolverOptions=+AAONLY
-
-# deliver MIME-encapsulated error messages?
-O SendMimeErrors=True
-
-# Forward file search path
-O ForwardPath=$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z/.forward
-
-# open connection cache size
-O ConnectionCacheSize=2
-
-# open connection cache timeout
-O ConnectionCacheTimeout=5m
-
-# persistent host status directory
-#O HostStatusDirectory=.hoststat
-
-# single thread deliveries (requires HostStatusDirectory)?
-#O SingleThreadDelivery
-
-# use Errors-To: header?
-O UseErrorsTo=False
-
-# log level
-O LogLevel=9
-
-# send to me too, even in an alias expansion?
-#O MeToo
-
-# verify RHS in newaliases?
-O CheckAliases=False
-
-# default messages to old style headers if no special punctuation?
-O OldStyleHeaders=True
-
-# SMTP daemon options
-#O DaemonPortOptions=Port=esmtp
-
-# privacy flags
-O PrivacyOptions=authwarnings
-
-# who (if anyone) should get extra copies of error messages
-#O PostMasterCopy=Postmaster
-
-# slope of queue-only function
-#O QueueFactor=600000
-
-# queue directory
-O QueueDirectory=/var/spool/mqueue
-
-# timeouts (many of these)
-#O Timeout.initial=5m
-#O Timeout.connect=5m
-#O Timeout.iconnect=5m
-#O Timeout.helo=5m
-#O Timeout.mail=10m
-#O Timeout.rcpt=1h
-#O Timeout.datainit=5m
-#O Timeout.datablock=1h
-#O Timeout.datafinal=1h
-#O Timeout.rset=5m
-#O Timeout.quit=2m
-#O Timeout.misc=2m
-#O Timeout.command=1h
-#O Timeout.ident=30s
-#O Timeout.fileopen=60s
-O Timeout.queuereturn=5d
-#O Timeout.queuereturn.normal=5d
-#O Timeout.queuereturn.urgent=2d
-#O Timeout.queuereturn.non-urgent=7d
-O Timeout.queuewarn=4h
-#O Timeout.queuewarn.normal=4h
-#O Timeout.queuewarn.urgent=1h
-#O Timeout.queuewarn.non-urgent=12h
-#O Timeout.hoststatus=30m
-
-# should we not prune routes in route-addr syntax addresses?
-#O DontPruneRoutes
-
-# queue up everything before forking?
-O SuperSafe=True
-
-# status file
-O StatusFile=/usr/adm/sendmail/sendmail.st
-
-# time zone handling:
-# if undefined, use system default
-# if defined but null, use TZ envariable passed in
-# if defined and non-null, use that info
-#O TimeZoneSpec=
-
-# default UID (can be username or userid:groupid)
-O DefaultUser=daemon
-
-# list of locations of user database file (null means no lookup)
-#O UserDatabaseSpec=/etc/userdb
-
-# fallback MX host
-#O FallbackMXhost=fall.back.host.net
-
-# if we are the best MX host for a site, try it directly instead of config err
-#O TryNullMXList
-
-# load average at which we just queue messages
-#O QueueLA=8
-
-# load average at which we refuse connections
-#O RefuseLA=12
-
-# maximum number of children we allow at one time
-#O MaxDaemonChildren=12
-
-# maximum number of new connections per second
-#O ConnectionRateThrottle=3
-
-# work recipient factor
-#O RecipientFactor=30000
-
-# deliver each queued job in a separate process?
-#O ForkEachJob
-
-# work class factor
-#O ClassFactor=1800
-
-# work time factor
-#O RetryFactor=90000
-
-# shall we sort the queue by hostname first?
-#O QueueSortOrder=priority
-
-# minimum time in queue before retry
-#O MinQueueAge=30m
-
-# default character set
-#O DefaultCharSet=iso-8859-1
-
-# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
-#O ServiceSwitchFile=/etc/service.switch
-
-# hosts file (normally /etc/hosts)
-#O HostsFile=/etc/hosts
-
-# dialup line delay on connection failure
-#O DialDelay=10s
-
-# action to take if there are no recipients in the message
-#O NoRecipientAction=add-to-undisclosed
-
-# chrooted environment for writing to files
-#O SafeFileEnvironment=/arch
-
-# are colons OK in addresses?
-#O ColonOkInAddr
-
-# how many jobs can you process in the queue?
-#O MaxQueueRunSize=10000
-
-# shall I avoid expanding CNAMEs (violates protocols)?
-#O DontExpandCnames
-
-# SMTP initial login message (old $e macro)
-O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
-
-# UNIX initial From header format (old $l macro)
-O UnixFromLine=From $g $d
-
-# From: lines that have embedded newlines are unwrapped onto one line
-#O SingleLineFromHeader=False
-
-# Allow HELO SMTP command that does not include a host name
-#O AllowBogusHELO=False
-
-# Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
-#O MustQuoteChars=.
-
-# delimiter (operator) characters (old $o macro)
-O OperatorChars=.:%@!^/[]+
-
-# shall I avoid calling initgroups(3) because of high NIS costs?
-#O DontInitGroups
-
-# are group-writable :include: and .forward files (un)trustworthy?
-#O UnsafeGroupWrites
-
-# where do errors that occur when sending errors get sent?
-#O DoubleBounceAddress=postmaster
-
-# what user id do we assume for the majority of the processing?
-#O RunAsUser=sendmail
-
-# maximum number of recipients per SMTP envelope
-#O MaxRecipientsPerMessage=100
-
-# shall we get local names from our installed interfaces?
-#O DontProbeInterfaces
-
-
-
-
-
-
-###########################
-# Message precedences #
-###########################
-
-Pfirst-class=0
-Pspecial-delivery=100
-Plist=-30
-Pbulk=-60
-Pjunk=-100
-
-#####################
-# Trusted users #
-#####################
-
-# this is equivalent to setting class "t"
-#Ft/etc/sendmail.ct
-Troot
-Tdaemon
-Tuucp
-
-#########################
-# Format of headers #
-#########################
-
-H?P?Return-Path: <$g>
-HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
- $.by $j ($v/$Z)$?r with $r$. id $i$?u
- for $u; $|;
- $.$b
-H?D?Resent-Date: $a
-H?D?Date: $a
-H?F?Resent-From: $?x$x <$g>$|$g$.
-H?F?From: $?x$x <$g>$|$g$.
-H?x?Full-Name: $x
-# HPosted-Date: $a
-# H?l?Received-Date: $b
-H?M?Resent-Message-Id: <$t.$i@$j>
-H?M?Message-Id: <$t.$i@$j>
-#\f
-######################################################################
-######################################################################
-#####
-##### REWRITING RULES
-#####
-######################################################################
-######################################################################
-
-############################################
-### Ruleset 3 -- Name Canonicalization ###
-############################################
-S3
-
-# handle null input (translate to <@> special case)
-R$@ $@ <@>
-
-# strip group: syntax (not inside angle brackets!) and trailing semicolon
-R$* $: $1 <@> mark addresses
-R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
-R@ $* <@> $: @ $1 unmark @host:...
-R$* :: $* <@> $: $1 :: $2 unmark node::addr
-R:include: $* <@> $: :include: $1 unmark :include:...
-R$* [ $* : $* ] <@> $: $1 [ $2 : $3 ] unmark IPv6 addrs
-R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon
-R$* : $* <@> $: $2 strip colon if marked
-R$* <@> $: $1 unmark
-R$* ; $1 strip trailing semi
-R$* < $* ; > $1 < $2 > bogus bracketed semi
-
-# null input now results from list:; syntax
-R$@ $@ :; <@>
-
-# strip angle brackets -- note RFC733 heuristic to get innermost item
-R$* $: < $1 > housekeeping <>
-R$+ < $* > < $2 > strip excess on left
-R< $* > $+ < $1 > strip excess on right
-R<> $@ < @ > MAIL FROM:<> case
-R< $+ > $: $1 remove housekeeping <>
-
-# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
-R@ $+ , $+ @ $1 : $2 change all "," to ":"
-
-# localize and dispose of route-based addresses
-R@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr>
-
-# find focus for list syntax
-R $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax
-R $+ : $* ; $@ $1 : $2; list syntax
-
-# find focus for @ syntax addresses
-R$+ @ $+ $: $1 < @ $2 > focus on domain
-R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
-R$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical
-
-# do some sanity checking
-R$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs
-
-# convert old-style addresses to a domain-based address
-R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names
-R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps
-R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains
-
-# if we have % signs, take the rightmost one
-R$* % $* $1 @ $2 First make them all @s.
-R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
-R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish
-
-# else we must be a local name
-R$* $@ $>96 $1
-
-
-################################################
-### Ruleset 96 -- bottom half of ruleset 3 ###
-################################################
-
-S96
-
-# handle special cases for local names
-R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
-R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
-R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain
-R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d]
-R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
-R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr
-
-
-
-
-
-# if really UUCP, handle it immediately
-
-# try UUCP traffic as a local address
-R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3
-R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3
-
-# pass to name server to make hostname canonical
-R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4
-
-# local host aliases and pseudo-domains are always canonical
-R$* < @ $=w > $* $: $1 < @ $2 . > $3
-R$* < @ $j > $* $: $1 < @ $j . > $2
-R$* < @ $=M > $* $: $1 < @ $2 . > $3
-R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4
-R$* < @ $* . . > $* $1 < @ $2 . > $3
-
-
-##################################################
-### Ruleset 4 -- Final Output Post-rewriting ###
-##################################################
-S4
-
-R$* <@> $@ handle <> and list:;
-
-# strip trailing dot off possibly canonical name
-R$* < @ $+ . > $* $1 < @ $2 > $3
-
-# eliminate internal code -- should never get this far!
-R$* < @ *LOCAL* > $* $1 < @ $j > $2
-
-# externalize local domain info
-R$* < $+ > $* $1 $2 $3 defocus
-R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
-R@ $* $@ @ $1 ... and exit
-
-# UUCP must always be presented in old form
-R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u
-
-# delete duplicate local names
-R$+ % $=w @ $=w $1 @ $2 u%host@host => u@host
-
-
-
-##############################################################
-### Ruleset 97 -- recanonicalize and call ruleset zero ###
-### (used for recursive calls) ###
-##############################################################
-
-S97
-R$* $: $>3 $1
-R$* $@ $>0 $1
-
-
-######################################
-### Ruleset 0 -- Parse Address ###
-######################################
-
-S0
-
-R$* $: $>Parse0 $1 initial parsing
-R<@> $#local $: <@> special case error msgs
-R$* $: $>98 $1 handle local hacks
-R$* $: $>Parse1 $1 final parsing
-
-#
-# Parse0 -- do initial syntax checking and eliminate local addresses.
-# This should either return with the (possibly modified) input
-# or return with a #error mailer. It should not return with a
-# #mailer other than the #error mailer.
-#
-
-SParse0
-R<@> $@ <@> special case error msgs
-R$* : $* ; <@> $#error $@ 5.1.3 $: "List:; syntax illegal for recipient addresses"
-#R@ <@ $* > < @ $1 > catch "@@host" bogosity
-R<@ $+> $#error $@ 5.1.3 $: "User address required"
-R$* $: <> $1
-R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3
-R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "Colon illegal in host name part"
-R<> $* $1
-R$* < @ . $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-
-# now delete the local info -- note $=O to find characters that cause forwarding
-R$* < @ > $* $@ $>Parse0 $>3 $1 user@ => user
-R< @ $=w . > : $* $@ $>Parse0 $>3 $2 @here:... -> ...
-R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here
-R< @ $+ > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ $=w . > $@ $>Parse0 $>3 $1 $2 $3 ...@here -> ...
-R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"
-R< @ *LOCAL* > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ *LOCAL* >
- $@ $>Parse0 $>3 $1 $2 $3 ...@*LOCAL* -> ...
-R$* < @ *LOCAL* > $: $1
-
-#
-# Parse1 -- the bottom half of ruleset 0.
-#
-
-SParse1
-# handle numeric address spec
-R$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec
-R$* < @ [ $+ ] > $* $#esmtp $@ [$2] $: $1 < @ [$2] > $3 still numeric: send
-
-
-# short circuit local delivery so forwarded email works
-R$=L < @ $=w . > $#local $: @ $1 special local names
-R$+ < @ $=w . > $#local $: $1 regular local name
-
-
-# resolve remotely connected UUCP links (if any)
-
-# resolve fake top level domains by forwarding to other hosts
-
-
-
-# pass names that still have a host to a smarthost (if defined)
-R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name
-
-# deal with other remote names
-R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain
-
-# handle locally delivered names
-R$=L $#local $: @ $1 special local names
-R$+ $#local $: $1 regular local names
-
-###########################################################################
-### Ruleset 5 -- special rewriting after aliases have been expanded ###
-###########################################################################
-
-S5
-
-# deal with plussed users so aliases work nicely
-R$+ + * $#local $@ $&h $: $1
-R$+ + $* $#local $@ + $2 $: $1 + *
-
-# prepend an empty "forward host" on the front
-R$+ $: <> $1
-
-
-# see if we have a relay or a hub
-R< > $+ $: < $H > $1 try hub
-R< > $+ $: < $R > $1 try relay
-R< > $+ $: < > < $1 $&h > nope, restore +detail
-R< > < $+ + $* > $* < > < $1 > + $2 $3 find the user part
-R< > < $+ > + $* $#local $@ $2 $: @ $1 strip the extra +
-R< > < $+ > $@ $1 no +detail
-R$+ $: $1 <> $&h add +detail back in
-R$+ <> + $* $: $1 + $2 check whether +detail
-R$+ <> $* $: $1 else discard
-R< local : $* > $* $: $>95 < local : $1 > $2 no host extension
-R< error : $* > $* $: $>95 < error : $1 > $2 no host extension
-R< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 >
-R< $+ > $+ $@ $>95 < $1 > $2 < @ $1 >
-
-
-###################################################################
-### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
-###################################################################
-
-S95
-R< > $* $@ $1 strip off null relay
-R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2
-R< local : $* > $* $>CanonLocal < $1 > $2
-R< $- : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
-R< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
-R< $=w > $* $@ $2 delete local host
-R< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer
-
-###################################################################
-### Ruleset CanonLocal -- canonify local: syntax ###
-###################################################################
-
-SCanonLocal
-# strip local host from routed addresses
-R< $* > < @ $+ > : $+ $@ $>97 $3
-R< $* > $+ $=O $+ < @ $+ > $@ $>97 $2 $3 $4
-
-# strip trailing dot from any host name that may appear
-R< $* > $* < @ $* . > $: < $1 > $2 < @ $3 >
-
-# handle local: syntax -- use old user, either with or without host
-R< > $* < @ $* > $* $#local $@ $1@$2 $: $1
-R< > $+ $#local $@ $1 $: $1
-
-# handle local:user@host syntax -- ignore host part
-R< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 >
-
-# handle local:user syntax
-R< $+ > $* <@ $* > $* $#local $@ $2@$3 $: $1
-R< $+ > $* $#local $@ $2 $: $1
-
-###################################################################
-### Ruleset 93 -- convert header names to masqueraded form ###
-###################################################################
-
-S93
-
-
-# special case the users that should be exposed
-R$=E < @ *LOCAL* > $@ $1 < @ $j . > leave exposed
-R$=E < @ $=M . > $@ $1 < @ $2 . >
-R$=E < @ $=w . > $@ $1 < @ $2 . >
-
-# handle domain-specific masquerading
-R$* < @ $=M . > $* $: $1 < @ $2 . @ $M > $3 convert masqueraded doms
-R$* < @ $=w . > $* $: $1 < @ $2 . @ $M > $3
-R$* < @ *LOCAL* > $* $: $1 < @ $j . @ $M > $2
-R$* < @ $+ @ > $* $: $1 < @ $2 > $3 $M is null
-R$* < @ $+ @ $+ > $* $: $1 < @ $3 . > $4 $M is not null
-
-###################################################################
-### Ruleset 94 -- convert envelope names to masqueraded form ###
-###################################################################
-
-S94
-R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
-
-###################################################################
-### Ruleset 98 -- local part of ruleset zero (can be null) ###
-###################################################################
-
-S98
-
-# addresses sent to foo@host.REDIRECT will give a 551 error code
-R$* < @ $+ .REDIRECT. > $: $1 < @ $2 . REDIRECT . > < ${opMode} >
-R$* < @ $+ .REDIRECT. > <i> $: $1 < @ $2 . REDIRECT. >
-R$* < @ $+ .REDIRECT. > < $- > $# error $@ 5.1.1 $: "551 User has moved; please try " <$1@$2>
-
-
-
-######################################################################
-### CanonAddr -- Convert an address into a standard form for
-### relay checking. Route address syntax is
-### crudely converted into a %-hack address.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed address, not in source route form
-######################################################################
-
-SCanonAddr
-R$* $: $>Parse0 $>3 $1 make domain canonical
-R< @ $+ > : $* @ $* < @ $1 > : $2 % $3 change @ to % in src route
-R$* < @ $+ > : $* : $* $3 $1 < @ $2 > : $4 change to % hack.
-R$* < @ $+ > : $* $3 $1 < @ $2 >
-
-######################################################################
-### ParseRecipient -- Strip off hosts in $=R as well as possibly
-### $* $=m or the access database.
-### Check user portion for host separators.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed, non-local-relaying address
-######################################################################
-
-SParseRecipient
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots
-R<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part
-
-# if no $=O character, no host in the user portion, we are done
-R<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4>
-R<?> $* $@ $1
-
-
-
-R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 >
-
-R<RELAY> $* < @ $* > $@ $>ParseRecipient $1
-R<$-> $* $@ $2
-
-######################################################################
-### check_relay -- check hostname/address on SMTP startup
-######################################################################
-
-SLocal_check_relay
-Scheck_relay
-R$* $: $1 $| $>"Local_check_relay" $1
-R$* $| $* $| $#$* $#$3
-R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
-
-SBasic_check_relay
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-
-
-######################################################################
-### check_mail -- check SMTP `MAIL FROM:' command argument
-######################################################################
-
-SLocal_check_mail
-Scheck_mail
-R$* $: $1 $| $>"Local_check_mail" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_mail" $1
-
-SBasic_check_mail
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R<> $@ <OK>
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots
-# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
-R<?> $* < $* $=P > $* $: <OK> $1 < @ $2 $3 > $4
-R<?> $* < @ $+ > $* $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 > $3
-R<? $* <$->> $* < @ $+ > $*
- $: <$2> $3 < @ $4 > $5
-
-# handle case of @localhost on address
-R<$+> $* < @localhost > $: < ? $&{client_name} > <$1> $2 < @localhost >
-R<$+> $* < @localhost.$m >
- $: < ? $&{client_name} > <$1> $2 < @localhost.$m >
-R<$+> $* < @localhost.UUCP >
- $: < ? $&{client_name} > <$1> $2 < @localhost.UUCP >
-R<? $=w> <$+> $* <?> <$2> $3
-R<? $+> <$+> $* $#error $@ 5.5.4 $: "553 Real domain name required"
-R<?> <$+> $* $: <$1> $2
-
-
-# handle case of no @domain on address
-R<?> $* $: < ? $&{client_name} > $1
-R<?> $* $@ <OK> ...local unqualed ok
-R<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required"
- ...remote is not
-# check results
-R<?> $* $@ <OK>
-R<OK> $* $@ <OK>
-R<TEMP> $* $#error $@ 4.1.8 $: "451 Sender domain must resolve"
-R<PERM> $* $#error $@ 5.1.8 $: "501 Sender domain must exist"
-
-######################################################################
-### check_rcpt -- check SMTP `RCPT TO:' command argument
-######################################################################
-
-SLocal_check_rcpt
-Scheck_rcpt
-R$* $: $1 $| $>"Local_check_rcpt" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_rcpt" $1
-
-SBasic_check_rcpt
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R$* $: $>ParseRecipient $1 strip relayable hosts
-
-
-
-
-# anything terminating locally is ok
-R$+ < @ $=w > $@ OK
-R$+ < @ $* $=R > $@ OK
-
-
-# check for local user (i.e. unqualified address)
-R$* $: <?> $1
-R<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 >
-# local user is ok
-R<?> $+ $@ OK
-R<$+> $* $: $2
-
-# anything originating locally is ok
-R$* $: <?> $&{client_name}
-# check if bracketed IP address (forward lookup != reverse lookup)
-R<?> [$+] $: <BAD> [$1]
-# pass to name server to make hostname canonical
-R<?> $* $~P $: <?> $[ $1 $2 $]
-R<$-> $* $: $2
-R$* . $1 strip trailing dots
-R$@ $@ OK
-R$=w $@ OK
-R$* $=R $@ OK
-
-# check IP address
-R$* $: $&{client_addr}
-R$@ $@ OK originated locally
-R0 $@ OK originated locally
-R$=R $* $@ OK relayable IP address
-R$* $: [ $1 ] put brackets around it...
-R$=w $@ OK ... and see if it is local
-
-
-# anything else is bogus
-R$* $#error $@ 5.7.1 $: "550 Relaying denied"
-
-#\f
-######################################################################
-######################################################################
-#####
-##### MAILER DEFINITIONS
-#####
-######################################################################
-######################################################################
-
-
-##################################################
-### Local and Program Mailer specification ###
-##################################################
-
-##### @(#)local.m4 8.30 (Berkeley) 6/30/1998 #####
-
-Mlocal, P=/bin/mail, F=lsDFMAw5:/|@qrmn9, S=10/30, R=20/40,
- T=DNS/RFC822/X-Unix,
- A=mail -d $u
-Mprog, P=/bin/sh, F=lsDFMoqeu9, S=10/30, R=20/40, D=$z:/,
- T=X-Unix,
- A=sh -c $u
-
-#
-# Envelope sender rewriting
-#
-S10
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>94 $1 do masquerading
-
-#
-# Envelope recipient rewriting
-#
-S20
-R$+ < @ $* > $: $1 strip host part
-
-#
-# Header sender rewriting
-#
-S30
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>93 $1 do masquerading
-
-#
-# Header recipient rewriting
-#
-S40
-R$+ $: $>50 $1 add local domain if needed
-
-#
-# Common code to add local domain name (only if always-add-domain)
-#
-S50
-
-#####################################
-### SMTP Mailer specification ###
-#####################################
-
-##### @(#)smtp.m4 8.38 (Berkeley) 5/19/1998 #####
-
-Msmtp, P=[IPC], F=mDFMuX, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mesmtp, P=[IPC], F=mDFMuXa, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Msmtp8, P=[IPC], F=mDFMuX8, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mrelay, P=[IPC], F=mDFMuXa8, S=11/31, R=61, E=\r\n, L=2040,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-
-#
-# envelope sender rewriting
-#
-S11
-R$+ $: $>51 $1 sender/recipient common
-R$* :; <@> $@ list:; special case
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>94 $1 do masquerading
-
-
-#
-# envelope recipient rewriting --
-# also header recipient if not masquerading recipients
-#
-S21
-R$+ $: $>51 $1 sender/recipient common
-R$+ $: $>61 $1 qualify unqual'ed names
-
-
-#
-# header sender and masquerading header recipient rewriting
-#
-S31
-R$+ $: $>51 $1 sender/recipient common
-R:; <@> $@ list:; special case
-
-# do special header rewriting
-R$* <@> $* $@ $1 <@> $2 pass null host through
-R< @ $* > $* $@ < @ $1 > $2 pass route-addr through
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>93 $1 do masquerading
-
-
-#
-# convert pseudo-domain addresses to real domain addresses
-#
-S51
-
-# pass <route-addr>s through
-R< @ $+ > $* $@ < @ $1 > $2 resolve <route-addr>
-
-# output fake domains as user%fake@relay
-
-# do UUCP heuristics; note that these are shared with UUCP mailers
-R$+ < @ $+ .UUCP. > $: < $2 ! > $1 convert to UUCP form
-R$+ < @ $* > $* $@ $1 < @ $2 > $3 not UUCP form
-
-# leave these in .UUCP form to avoid further tampering
-R< $&h ! > $- ! $+ $@ $2 < @ $1 .UUCP. >
-R< $&h ! > $-.$+ ! $+ $@ $3 < @ $1.$2 >
-R< $&h ! > $+ $@ $1 < @ $&h .UUCP. >
-R< $+ ! > $+ $: $1 ! $2 < @ $Y > use UUCP_RELAY
-R$+ < @ $+ : $+ > $@ $1 < @ $3 > strip mailer: part
-R$+ < @ > $: $1 < @ *LOCAL* > if no UUCP_RELAY
-
-
-#
-# common sender and masquerading recipient rewriting
-#
-S61
-
-R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
-R$+ $@ $1 < @ *LOCAL* > add local qualification
-
-
-#
-# relay mailer header masquerading recipient rewriting
-#
-S71
-
-R$+ $: $>61 $1
-R$+ $: $>93 $1
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a generic configuration file for OSF/1.
-# It has support for local and SMTP mail only. If you want to
-# customize it, copy it to a name appropriate for your environment
-# and do the modifications there.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)generic-osf1.mc 8.8 (Berkeley) 5/19/1998')
-OSTYPE(osf1)dnl
-DOMAIN(generic)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-######################################################################
-######################################################################
-#####
-##### SENDMAIL CONFIGURATION FILE
-#####
-##### built by gshapiro@knecht.sendmail.org on Thu Feb 4 16:39:23 PST 1999
-##### in /home/eric/src/sendmail/cf/cf
-##### using ../ as configuration include directory
-#####
-######################################################################
-######################################################################
-
-##### @(#)cfhead.m4 8.23 (Berkeley) 10/6/1998 #####
-##### @(#)cf.m4 8.29 (Berkeley) 5/19/1998 #####
-##### @(#)generic-solaris2.mc 8.8 (Berkeley) 5/19/1998 #####
-
-##### @(#)solaris2.m4 8.16 (Berkeley) 10/6/1998 #####
-
-##### @(#)generic.m4 8.9 (Berkeley) 5/19/1998 #####
-
-##### @(#)redirect.m4 8.10 (Berkeley) 5/19/1998 #####
-
-
-
-
-##### @(#)use_cw_file.m4 8.6 (Berkeley) 5/19/1998 #####
-
-
-
-##### @(#)proto.m4 8.243 (Berkeley) 2/2/1999 #####
-
-
-# level 8 config file format
-V8/Berkeley
-
-# override file safeties - setting this option compromises system security
-# need to set this now for the sake of class files
-#O DontBlameSendmail=safe
-
-##################
-# local info #
-##################
-
-Cwlocalhost
-# file containing names of hosts for which we receive email
-Fw/etc/mail/sendmail.cw
-
-# my official domain name
-# ... define this only if sendmail cannot automatically determine your domain
-#Dj$w.Foo.COM
-
-
-CP.
-
-# "Smart" relay host (may be null)
-DS
-
-
-# operators that cannot be in local usernames (i.e., network indicators)
-CO @ % !
-
-# a class with just dot (for identifying canonical names)
-C..
-
-# a class with just a left bracket (for identifying domain literals)
-C[[
-
-
-
-
-
-
-
-
-
-# Resolve map (to check if a host exists in check_mail)
-Kresolve host -a<OK> -T<TEMP>
-
-# Hosts that will permit relaying ($=R)
-FR-o /etc/mail/relay-domains
-
-# who I send unqualified names to (null means deliver locally)
-DR
-
-# who gets all local email traffic ($R has precedence for unqualified names)
-DH
-
-# dequoting map
-Kdequote dequote
-
-# class E: names that should be exposed as from this host, even if we masquerade
-# class L: names that should be delivered locally, even if we have a relay
-# class M: domains that should be converted to $M
-#CL root
-CE root
-
-# who I masquerade as (null for no masquerading) (see also $=M)
-DM
-
-# my name for error messages
-DnMAILER-DAEMON
-
-
-CPREDIRECT
-
-# Configuration version number
-DZ8.9.3
-
-
-###############
-# Options #
-###############
-
-# strip message body to 7 bits on input?
-O SevenBitInput=False
-
-# 8-bit data handling
-O EightBitMode=pass8
-
-
-# wait for alias file rebuild (default units: minutes)
-O AliasWait=10
-
-# location of alias file
-O AliasFile=/etc/mail/aliases
-
-# minimum number of free blocks on filesystem
-O MinFreeBlocks=100
-
-# maximum message size
-#O MaxMessageSize=1000000
-
-# substitution for space (blank) characters
-O BlankSub=.
-
-# avoid connecting to "expensive" mailers on initial submission?
-O HoldExpensive=False
-
-# checkpoint queue runs after every N successful deliveries
-#O CheckpointInterval=10
-
-# default delivery mode
-O DeliveryMode=background
-
-# automatically rebuild the alias database?
-#O AutoRebuildAliases
-
-# error message header/file
-#O ErrorHeader=/etc/sendmail.oE
-
-# error mode
-#O ErrorMode=print
-
-# save Unix-style "From_" lines at top of header?
-#O SaveFromLine
-
-# temporary file mode
-O TempFileMode=0600
-
-# match recipients against GECOS field?
-#O MatchGECOS
-
-# maximum hop count
-#O MaxHopCount=17
-
-# location of help file
-O HelpFile=/etc/mail/sendmail.hf
-
-# ignore dots as terminators in incoming messages?
-#O IgnoreDots
-
-# name resolver options
-#O ResolverOptions=+AAONLY
-
-# deliver MIME-encapsulated error messages?
-O SendMimeErrors=True
-
-# Forward file search path
-O ForwardPath=$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z/.forward
-
-# open connection cache size
-O ConnectionCacheSize=2
-
-# open connection cache timeout
-O ConnectionCacheTimeout=5m
-
-# persistent host status directory
-#O HostStatusDirectory=.hoststat
-
-# single thread deliveries (requires HostStatusDirectory)?
-#O SingleThreadDelivery
-
-# use Errors-To: header?
-O UseErrorsTo=False
-
-# log level
-O LogLevel=9
-
-# send to me too, even in an alias expansion?
-#O MeToo
-
-# verify RHS in newaliases?
-O CheckAliases=False
-
-# default messages to old style headers if no special punctuation?
-O OldStyleHeaders=True
-
-# SMTP daemon options
-#O DaemonPortOptions=Port=esmtp
-
-# privacy flags
-O PrivacyOptions=authwarnings
-
-# who (if anyone) should get extra copies of error messages
-#O PostMasterCopy=Postmaster
-
-# slope of queue-only function
-#O QueueFactor=600000
-
-# queue directory
-O QueueDirectory=/var/spool/mqueue
-
-# timeouts (many of these)
-#O Timeout.initial=5m
-#O Timeout.connect=5m
-#O Timeout.iconnect=5m
-#O Timeout.helo=5m
-#O Timeout.mail=10m
-#O Timeout.rcpt=1h
-#O Timeout.datainit=5m
-#O Timeout.datablock=1h
-#O Timeout.datafinal=1h
-#O Timeout.rset=5m
-#O Timeout.quit=2m
-#O Timeout.misc=2m
-#O Timeout.command=1h
-#O Timeout.ident=30s
-#O Timeout.fileopen=60s
-O Timeout.queuereturn=5d
-#O Timeout.queuereturn.normal=5d
-#O Timeout.queuereturn.urgent=2d
-#O Timeout.queuereturn.non-urgent=7d
-O Timeout.queuewarn=4h
-#O Timeout.queuewarn.normal=4h
-#O Timeout.queuewarn.urgent=1h
-#O Timeout.queuewarn.non-urgent=12h
-#O Timeout.hoststatus=30m
-
-# should we not prune routes in route-addr syntax addresses?
-#O DontPruneRoutes
-
-# queue up everything before forking?
-O SuperSafe=True
-
-# status file
-O StatusFile=/etc/mail/sendmail.st
-
-# time zone handling:
-# if undefined, use system default
-# if defined but null, use TZ envariable passed in
-# if defined and non-null, use that info
-#O TimeZoneSpec=
-
-# default UID (can be username or userid:groupid)
-#O DefaultUser=mailnull
-
-# list of locations of user database file (null means no lookup)
-#O UserDatabaseSpec=/etc/userdb
-
-# fallback MX host
-#O FallbackMXhost=fall.back.host.net
-
-# if we are the best MX host for a site, try it directly instead of config err
-#O TryNullMXList
-
-# load average at which we just queue messages
-#O QueueLA=8
-
-# load average at which we refuse connections
-#O RefuseLA=12
-
-# maximum number of children we allow at one time
-#O MaxDaemonChildren=12
-
-# maximum number of new connections per second
-#O ConnectionRateThrottle=3
-
-# work recipient factor
-#O RecipientFactor=30000
-
-# deliver each queued job in a separate process?
-#O ForkEachJob
-
-# work class factor
-#O ClassFactor=1800
-
-# work time factor
-#O RetryFactor=90000
-
-# shall we sort the queue by hostname first?
-#O QueueSortOrder=priority
-
-# minimum time in queue before retry
-#O MinQueueAge=30m
-
-# default character set
-#O DefaultCharSet=iso-8859-1
-
-# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
-#O ServiceSwitchFile=/etc/service.switch
-
-# hosts file (normally /etc/hosts)
-#O HostsFile=/etc/hosts
-
-# dialup line delay on connection failure
-#O DialDelay=10s
-
-# action to take if there are no recipients in the message
-#O NoRecipientAction=add-to-undisclosed
-
-# chrooted environment for writing to files
-#O SafeFileEnvironment=/arch
-
-# are colons OK in addresses?
-#O ColonOkInAddr
-
-# how many jobs can you process in the queue?
-#O MaxQueueRunSize=10000
-
-# shall I avoid expanding CNAMEs (violates protocols)?
-#O DontExpandCnames
-
-# SMTP initial login message (old $e macro)
-O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
-
-# UNIX initial From header format (old $l macro)
-O UnixFromLine=From $g $d
-
-# From: lines that have embedded newlines are unwrapped onto one line
-#O SingleLineFromHeader=False
-
-# Allow HELO SMTP command that does not include a host name
-#O AllowBogusHELO=False
-
-# Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
-#O MustQuoteChars=.
-
-# delimiter (operator) characters (old $o macro)
-O OperatorChars=.:%@!^/[]+
-
-# shall I avoid calling initgroups(3) because of high NIS costs?
-#O DontInitGroups
-
-# are group-writable :include: and .forward files (un)trustworthy?
-#O UnsafeGroupWrites
-
-# where do errors that occur when sending errors get sent?
-#O DoubleBounceAddress=postmaster
-
-# what user id do we assume for the majority of the processing?
-#O RunAsUser=sendmail
-
-# maximum number of recipients per SMTP envelope
-#O MaxRecipientsPerMessage=100
-
-# shall we get local names from our installed interfaces?
-#O DontProbeInterfaces
-
-
-
-
-
-
-###########################
-# Message precedences #
-###########################
-
-Pfirst-class=0
-Pspecial-delivery=100
-Plist=-30
-Pbulk=-60
-Pjunk=-100
-
-#####################
-# Trusted users #
-#####################
-
-# this is equivalent to setting class "t"
-#Ft/etc/sendmail.ct
-Troot
-Tdaemon
-Tuucp
-
-#########################
-# Format of headers #
-#########################
-
-H?P?Return-Path: <$g>
-HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
- $.by $j ($v/$Z)$?r with $r$. id $i$?u
- for $u; $|;
- $.$b
-H?D?Resent-Date: $a
-H?D?Date: $a
-H?F?Resent-From: $?x$x <$g>$|$g$.
-H?F?From: $?x$x <$g>$|$g$.
-H?x?Full-Name: $x
-# HPosted-Date: $a
-# H?l?Received-Date: $b
-H?M?Resent-Message-Id: <$t.$i@$j>
-H?M?Message-Id: <$t.$i@$j>
-#\f
-######################################################################
-######################################################################
-#####
-##### REWRITING RULES
-#####
-######################################################################
-######################################################################
-
-############################################
-### Ruleset 3 -- Name Canonicalization ###
-############################################
-S3
-
-# handle null input (translate to <@> special case)
-R$@ $@ <@>
-
-# strip group: syntax (not inside angle brackets!) and trailing semicolon
-R$* $: $1 <@> mark addresses
-R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
-R@ $* <@> $: @ $1 unmark @host:...
-R$* :: $* <@> $: $1 :: $2 unmark node::addr
-R:include: $* <@> $: :include: $1 unmark :include:...
-R$* [ $* : $* ] <@> $: $1 [ $2 : $3 ] unmark IPv6 addrs
-R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon
-R$* : $* <@> $: $2 strip colon if marked
-R$* <@> $: $1 unmark
-R$* ; $1 strip trailing semi
-R$* < $* ; > $1 < $2 > bogus bracketed semi
-
-# null input now results from list:; syntax
-R$@ $@ :; <@>
-
-# strip angle brackets -- note RFC733 heuristic to get innermost item
-R$* $: < $1 > housekeeping <>
-R$+ < $* > < $2 > strip excess on left
-R< $* > $+ < $1 > strip excess on right
-R<> $@ < @ > MAIL FROM:<> case
-R< $+ > $: $1 remove housekeeping <>
-
-# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
-R@ $+ , $+ @ $1 : $2 change all "," to ":"
-
-# localize and dispose of route-based addresses
-R@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr>
-
-# find focus for list syntax
-R $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax
-R $+ : $* ; $@ $1 : $2; list syntax
-
-# find focus for @ syntax addresses
-R$+ @ $+ $: $1 < @ $2 > focus on domain
-R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
-R$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical
-
-# do some sanity checking
-R$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs
-
-# convert old-style addresses to a domain-based address
-R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names
-R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps
-R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains
-
-# if we have % signs, take the rightmost one
-R$* % $* $1 @ $2 First make them all @s.
-R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
-R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish
-
-# else we must be a local name
-R$* $@ $>96 $1
-
-
-################################################
-### Ruleset 96 -- bottom half of ruleset 3 ###
-################################################
-
-S96
-
-# handle special cases for local names
-R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
-R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
-R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain
-R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d]
-R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
-R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr
-
-
-
-
-
-# if really UUCP, handle it immediately
-
-# try UUCP traffic as a local address
-R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3
-R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3
-
-# pass to name server to make hostname canonical
-R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4
-
-# local host aliases and pseudo-domains are always canonical
-R$* < @ $=w > $* $: $1 < @ $2 . > $3
-R$* < @ $j > $* $: $1 < @ $j . > $2
-R$* < @ $=M > $* $: $1 < @ $2 . > $3
-R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4
-R$* < @ $* . . > $* $1 < @ $2 . > $3
-
-
-##################################################
-### Ruleset 4 -- Final Output Post-rewriting ###
-##################################################
-S4
-
-R$* <@> $@ handle <> and list:;
-
-# strip trailing dot off possibly canonical name
-R$* < @ $+ . > $* $1 < @ $2 > $3
-
-# eliminate internal code -- should never get this far!
-R$* < @ *LOCAL* > $* $1 < @ $j > $2
-
-# externalize local domain info
-R$* < $+ > $* $1 $2 $3 defocus
-R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
-R@ $* $@ @ $1 ... and exit
-
-# UUCP must always be presented in old form
-R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u
-
-# delete duplicate local names
-R$+ % $=w @ $=w $1 @ $2 u%host@host => u@host
-
-
-
-##############################################################
-### Ruleset 97 -- recanonicalize and call ruleset zero ###
-### (used for recursive calls) ###
-##############################################################
-
-S97
-R$* $: $>3 $1
-R$* $@ $>0 $1
-
-
-######################################
-### Ruleset 0 -- Parse Address ###
-######################################
-
-S0
-
-R$* $: $>Parse0 $1 initial parsing
-R<@> $#local $: <@> special case error msgs
-R$* $: $>98 $1 handle local hacks
-R$* $: $>Parse1 $1 final parsing
-
-#
-# Parse0 -- do initial syntax checking and eliminate local addresses.
-# This should either return with the (possibly modified) input
-# or return with a #error mailer. It should not return with a
-# #mailer other than the #error mailer.
-#
-
-SParse0
-R<@> $@ <@> special case error msgs
-R$* : $* ; <@> $#error $@ 5.1.3 $: "List:; syntax illegal for recipient addresses"
-#R@ <@ $* > < @ $1 > catch "@@host" bogosity
-R<@ $+> $#error $@ 5.1.3 $: "User address required"
-R$* $: <> $1
-R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3
-R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "Colon illegal in host name part"
-R<> $* $1
-R$* < @ . $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-
-# now delete the local info -- note $=O to find characters that cause forwarding
-R$* < @ > $* $@ $>Parse0 $>3 $1 user@ => user
-R< @ $=w . > : $* $@ $>Parse0 $>3 $2 @here:... -> ...
-R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here
-R< @ $+ > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ $=w . > $@ $>Parse0 $>3 $1 $2 $3 ...@here -> ...
-R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"
-R< @ *LOCAL* > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ *LOCAL* >
- $@ $>Parse0 $>3 $1 $2 $3 ...@*LOCAL* -> ...
-R$* < @ *LOCAL* > $: $1
-
-#
-# Parse1 -- the bottom half of ruleset 0.
-#
-
-SParse1
-# handle numeric address spec
-R$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec
-R$* < @ [ $+ ] > $* $#esmtp $@ [$2] $: $1 < @ [$2] > $3 still numeric: send
-
-
-# short circuit local delivery so forwarded email works
-R$=L < @ $=w . > $#local $: @ $1 special local names
-R$+ < @ $=w . > $#local $: $1 regular local name
-
-
-# resolve remotely connected UUCP links (if any)
-
-# resolve fake top level domains by forwarding to other hosts
-
-
-
-# pass names that still have a host to a smarthost (if defined)
-R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name
-
-# deal with other remote names
-R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain
-
-# handle locally delivered names
-R$=L $#local $: @ $1 special local names
-R$+ $#local $: $1 regular local names
-
-###########################################################################
-### Ruleset 5 -- special rewriting after aliases have been expanded ###
-###########################################################################
-
-S5
-
-# deal with plussed users so aliases work nicely
-R$+ + * $#local $@ $&h $: $1
-R$+ + $* $#local $@ + $2 $: $1 + *
-
-# prepend an empty "forward host" on the front
-R$+ $: <> $1
-
-
-# see if we have a relay or a hub
-R< > $+ $: < $H > $1 try hub
-R< > $+ $: < $R > $1 try relay
-R< > $+ $: < > < $1 $&h > nope, restore +detail
-R< > < $+ + $* > $* < > < $1 > + $2 $3 find the user part
-R< > < $+ > + $* $#local $@ $2 $: @ $1 strip the extra +
-R< > < $+ > $@ $1 no +detail
-R$+ $: $1 <> $&h add +detail back in
-R$+ <> + $* $: $1 + $2 check whether +detail
-R$+ <> $* $: $1 else discard
-R< local : $* > $* $: $>95 < local : $1 > $2 no host extension
-R< error : $* > $* $: $>95 < error : $1 > $2 no host extension
-R< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 >
-R< $+ > $+ $@ $>95 < $1 > $2 < @ $1 >
-
-
-###################################################################
-### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
-###################################################################
-
-S95
-R< > $* $@ $1 strip off null relay
-R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2
-R< local : $* > $* $>CanonLocal < $1 > $2
-R< $- : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
-R< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
-R< $=w > $* $@ $2 delete local host
-R< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer
-
-###################################################################
-### Ruleset CanonLocal -- canonify local: syntax ###
-###################################################################
-
-SCanonLocal
-# strip local host from routed addresses
-R< $* > < @ $+ > : $+ $@ $>97 $3
-R< $* > $+ $=O $+ < @ $+ > $@ $>97 $2 $3 $4
-
-# strip trailing dot from any host name that may appear
-R< $* > $* < @ $* . > $: < $1 > $2 < @ $3 >
-
-# handle local: syntax -- use old user, either with or without host
-R< > $* < @ $* > $* $#local $@ $1@$2 $: $1
-R< > $+ $#local $@ $1 $: $1
-
-# handle local:user@host syntax -- ignore host part
-R< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 >
-
-# handle local:user syntax
-R< $+ > $* <@ $* > $* $#local $@ $2@$3 $: $1
-R< $+ > $* $#local $@ $2 $: $1
-
-###################################################################
-### Ruleset 93 -- convert header names to masqueraded form ###
-###################################################################
-
-S93
-
-
-# special case the users that should be exposed
-R$=E < @ *LOCAL* > $@ $1 < @ $j . > leave exposed
-R$=E < @ $=M . > $@ $1 < @ $2 . >
-R$=E < @ $=w . > $@ $1 < @ $2 . >
-
-# handle domain-specific masquerading
-R$* < @ $=M . > $* $: $1 < @ $2 . @ $M > $3 convert masqueraded doms
-R$* < @ $=w . > $* $: $1 < @ $2 . @ $M > $3
-R$* < @ *LOCAL* > $* $: $1 < @ $j . @ $M > $2
-R$* < @ $+ @ > $* $: $1 < @ $2 > $3 $M is null
-R$* < @ $+ @ $+ > $* $: $1 < @ $3 . > $4 $M is not null
-
-###################################################################
-### Ruleset 94 -- convert envelope names to masqueraded form ###
-###################################################################
-
-S94
-R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
-
-###################################################################
-### Ruleset 98 -- local part of ruleset zero (can be null) ###
-###################################################################
-
-S98
-
-# addresses sent to foo@host.REDIRECT will give a 551 error code
-R$* < @ $+ .REDIRECT. > $: $1 < @ $2 . REDIRECT . > < ${opMode} >
-R$* < @ $+ .REDIRECT. > <i> $: $1 < @ $2 . REDIRECT. >
-R$* < @ $+ .REDIRECT. > < $- > $# error $@ 5.1.1 $: "551 User has moved; please try " <$1@$2>
-
-
-
-######################################################################
-### CanonAddr -- Convert an address into a standard form for
-### relay checking. Route address syntax is
-### crudely converted into a %-hack address.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed address, not in source route form
-######################################################################
-
-SCanonAddr
-R$* $: $>Parse0 $>3 $1 make domain canonical
-R< @ $+ > : $* @ $* < @ $1 > : $2 % $3 change @ to % in src route
-R$* < @ $+ > : $* : $* $3 $1 < @ $2 > : $4 change to % hack.
-R$* < @ $+ > : $* $3 $1 < @ $2 >
-
-######################################################################
-### ParseRecipient -- Strip off hosts in $=R as well as possibly
-### $* $=m or the access database.
-### Check user portion for host separators.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed, non-local-relaying address
-######################################################################
-
-SParseRecipient
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots
-R<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part
-
-# if no $=O character, no host in the user portion, we are done
-R<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4>
-R<?> $* $@ $1
-
-
-
-R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 >
-
-R<RELAY> $* < @ $* > $@ $>ParseRecipient $1
-R<$-> $* $@ $2
-
-######################################################################
-### check_relay -- check hostname/address on SMTP startup
-######################################################################
-
-SLocal_check_relay
-Scheck_relay
-R$* $: $1 $| $>"Local_check_relay" $1
-R$* $| $* $| $#$* $#$3
-R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
-
-SBasic_check_relay
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-
-
-######################################################################
-### check_mail -- check SMTP `MAIL FROM:' command argument
-######################################################################
-
-SLocal_check_mail
-Scheck_mail
-R$* $: $1 $| $>"Local_check_mail" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_mail" $1
-
-SBasic_check_mail
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R<> $@ <OK>
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots
-# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
-R<?> $* < $* $=P > $* $: <OK> $1 < @ $2 $3 > $4
-R<?> $* < @ $+ > $* $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 > $3
-R<? $* <$->> $* < @ $+ > $*
- $: <$2> $3 < @ $4 > $5
-
-# handle case of @localhost on address
-R<$+> $* < @localhost > $: < ? $&{client_name} > <$1> $2 < @localhost >
-R<$+> $* < @localhost.$m >
- $: < ? $&{client_name} > <$1> $2 < @localhost.$m >
-R<$+> $* < @localhost.UUCP >
- $: < ? $&{client_name} > <$1> $2 < @localhost.UUCP >
-R<? $=w> <$+> $* <?> <$2> $3
-R<? $+> <$+> $* $#error $@ 5.5.4 $: "553 Real domain name required"
-R<?> <$+> $* $: <$1> $2
-
-
-# handle case of no @domain on address
-R<?> $* $: < ? $&{client_name} > $1
-R<?> $* $@ <OK> ...local unqualed ok
-R<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required"
- ...remote is not
-# check results
-R<?> $* $@ <OK>
-R<OK> $* $@ <OK>
-R<TEMP> $* $#error $@ 4.1.8 $: "451 Sender domain must resolve"
-R<PERM> $* $#error $@ 5.1.8 $: "501 Sender domain must exist"
-
-######################################################################
-### check_rcpt -- check SMTP `RCPT TO:' command argument
-######################################################################
-
-SLocal_check_rcpt
-Scheck_rcpt
-R$* $: $1 $| $>"Local_check_rcpt" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_rcpt" $1
-
-SBasic_check_rcpt
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R$* $: $>ParseRecipient $1 strip relayable hosts
-
-
-
-
-# anything terminating locally is ok
-R$+ < @ $=w > $@ OK
-R$+ < @ $* $=R > $@ OK
-
-
-# check for local user (i.e. unqualified address)
-R$* $: <?> $1
-R<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 >
-# local user is ok
-R<?> $+ $@ OK
-R<$+> $* $: $2
-
-# anything originating locally is ok
-R$* $: <?> $&{client_name}
-# check if bracketed IP address (forward lookup != reverse lookup)
-R<?> [$+] $: <BAD> [$1]
-# pass to name server to make hostname canonical
-R<?> $* $~P $: <?> $[ $1 $2 $]
-R<$-> $* $: $2
-R$* . $1 strip trailing dots
-R$@ $@ OK
-R$=w $@ OK
-R$* $=R $@ OK
-
-# check IP address
-R$* $: $&{client_addr}
-R$@ $@ OK originated locally
-R0 $@ OK originated locally
-R$=R $* $@ OK relayable IP address
-R$* $: [ $1 ] put brackets around it...
-R$=w $@ OK ... and see if it is local
-
-
-# anything else is bogus
-R$* $#error $@ 5.7.1 $: "550 Relaying denied"
-
-#\f
-######################################################################
-######################################################################
-#####
-##### MAILER DEFINITIONS
-#####
-######################################################################
-######################################################################
-
-
-##################################################
-### Local and Program Mailer specification ###
-##################################################
-
-##### @(#)local.m4 8.30 (Berkeley) 6/30/1998 #####
-
-Mlocal, P=/bin/mail, F=lsDFMAw5:/|@qSnE9, S=10/30, R=20/40,
- T=DNS/RFC822/X-Unix,
- A=mail -f $g -d $u
-Mprog, P=/bin/sh, F=lsDFMoqeu9, S=10/30, R=20/40, D=$z:/,
- T=X-Unix,
- A=sh -c $u
-
-#
-# Envelope sender rewriting
-#
-S10
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>94 $1 do masquerading
-
-#
-# Envelope recipient rewriting
-#
-S20
-R$+ < @ $* > $: $1 strip host part
-
-#
-# Header sender rewriting
-#
-S30
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>93 $1 do masquerading
-
-#
-# Header recipient rewriting
-#
-S40
-R$+ $: $>50 $1 add local domain if needed
-
-#
-# Common code to add local domain name (only if always-add-domain)
-#
-S50
-
-#####################################
-### SMTP Mailer specification ###
-#####################################
-
-##### @(#)smtp.m4 8.38 (Berkeley) 5/19/1998 #####
-
-Msmtp, P=[IPC], F=mDFMuX, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mesmtp, P=[IPC], F=mDFMuXa, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Msmtp8, P=[IPC], F=mDFMuX8, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mrelay, P=[IPC], F=mDFMuXa8, S=11/31, R=61, E=\r\n, L=2040,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-
-#
-# envelope sender rewriting
-#
-S11
-R$+ $: $>51 $1 sender/recipient common
-R$* :; <@> $@ list:; special case
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>94 $1 do masquerading
-
-
-#
-# envelope recipient rewriting --
-# also header recipient if not masquerading recipients
-#
-S21
-R$+ $: $>51 $1 sender/recipient common
-R$+ $: $>61 $1 qualify unqual'ed names
-
-
-#
-# header sender and masquerading header recipient rewriting
-#
-S31
-R$+ $: $>51 $1 sender/recipient common
-R:; <@> $@ list:; special case
-
-# do special header rewriting
-R$* <@> $* $@ $1 <@> $2 pass null host through
-R< @ $* > $* $@ < @ $1 > $2 pass route-addr through
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>93 $1 do masquerading
-
-
-#
-# convert pseudo-domain addresses to real domain addresses
-#
-S51
-
-# pass <route-addr>s through
-R< @ $+ > $* $@ < @ $1 > $2 resolve <route-addr>
-
-# output fake domains as user%fake@relay
-
-# do UUCP heuristics; note that these are shared with UUCP mailers
-R$+ < @ $+ .UUCP. > $: < $2 ! > $1 convert to UUCP form
-R$+ < @ $* > $* $@ $1 < @ $2 > $3 not UUCP form
-
-# leave these in .UUCP form to avoid further tampering
-R< $&h ! > $- ! $+ $@ $2 < @ $1 .UUCP. >
-R< $&h ! > $-.$+ ! $+ $@ $3 < @ $1.$2 >
-R< $&h ! > $+ $@ $1 < @ $&h .UUCP. >
-R< $+ ! > $+ $: $1 ! $2 < @ $Y > use UUCP_RELAY
-R$+ < @ $+ : $+ > $@ $1 < @ $3 > strip mailer: part
-R$+ < @ > $: $1 < @ *LOCAL* > if no UUCP_RELAY
-
-
-#
-# common sender and masquerading recipient rewriting
-#
-S61
-
-R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
-R$+ $@ $1 < @ *LOCAL* > add local qualification
-
-
-#
-# relay mailer header masquerading recipient rewriting
-#
-S71
-
-R$+ $: $>61 $1
-R$+ $: $>93 $1
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a generic configuration file for SunOS 5.x (a.k.a. Solaris 2.x)
-# It has support for local and SMTP mail only. If you want to
-# customize it, copy it to a name appropriate for your environment
-# and do the modifications there.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)generic-solaris2.mc 8.8 (Berkeley) 5/19/1998')
-OSTYPE(solaris2)dnl
-DOMAIN(generic)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-######################################################################
-######################################################################
-#####
-##### SENDMAIL CONFIGURATION FILE
-#####
-##### built by gshapiro@knecht.sendmail.org on Thu Feb 4 16:39:23 PST 1999
-##### in /home/eric/src/sendmail/cf/cf
-##### using ../ as configuration include directory
-#####
-######################################################################
-######################################################################
-
-##### @(#)cfhead.m4 8.23 (Berkeley) 10/6/1998 #####
-##### @(#)cf.m4 8.29 (Berkeley) 5/19/1998 #####
-##### @(#)generic-sunos4.1.mc 8.8 (Berkeley) 5/19/1998 #####
-
-##### @(#)sunos4.1.m4 8.7 (Berkeley) 5/19/1998 #####
-
-
-##### @(#)generic.m4 8.9 (Berkeley) 5/19/1998 #####
-
-##### @(#)redirect.m4 8.10 (Berkeley) 5/19/1998 #####
-
-
-
-
-##### @(#)use_cw_file.m4 8.6 (Berkeley) 5/19/1998 #####
-
-
-
-##### @(#)proto.m4 8.243 (Berkeley) 2/2/1999 #####
-
-
-# level 8 config file format
-V8/Berkeley
-
-# override file safeties - setting this option compromises system security
-# need to set this now for the sake of class files
-#O DontBlameSendmail=safe
-
-##################
-# local info #
-##################
-
-Cwlocalhost
-# file containing names of hosts for which we receive email
-Fw/etc/sendmail.cw
-
-# my official domain name
-# ... define this only if sendmail cannot automatically determine your domain
-#Dj$w.Foo.COM
-
-
-CP.
-
-# "Smart" relay host (may be null)
-DS
-
-
-# operators that cannot be in local usernames (i.e., network indicators)
-CO @ % !
-
-# a class with just dot (for identifying canonical names)
-C..
-
-# a class with just a left bracket (for identifying domain literals)
-C[[
-
-
-
-
-
-
-
-
-
-# Resolve map (to check if a host exists in check_mail)
-Kresolve host -a<OK> -T<TEMP>
-
-# Hosts that will permit relaying ($=R)
-FR-o /etc/mail/relay-domains
-
-# who I send unqualified names to (null means deliver locally)
-DR
-
-# who gets all local email traffic ($R has precedence for unqualified names)
-DH
-
-# dequoting map
-Kdequote dequote
-
-# class E: names that should be exposed as from this host, even if we masquerade
-# class L: names that should be delivered locally, even if we have a relay
-# class M: domains that should be converted to $M
-#CL root
-CE root
-
-# who I masquerade as (null for no masquerading) (see also $=M)
-DM
-
-# my name for error messages
-DnMAILER-DAEMON
-
-
-CPREDIRECT
-
-# Configuration version number
-DZ8.9.3
-
-
-###############
-# Options #
-###############
-
-# strip message body to 7 bits on input?
-O SevenBitInput=False
-
-# 8-bit data handling
-O EightBitMode=pass8
-
-
-# wait for alias file rebuild (default units: minutes)
-O AliasWait=10
-
-# location of alias file
-O AliasFile=/etc/aliases
-
-# minimum number of free blocks on filesystem
-O MinFreeBlocks=100
-
-# maximum message size
-#O MaxMessageSize=1000000
-
-# substitution for space (blank) characters
-O BlankSub=.
-
-# avoid connecting to "expensive" mailers on initial submission?
-O HoldExpensive=False
-
-# checkpoint queue runs after every N successful deliveries
-#O CheckpointInterval=10
-
-# default delivery mode
-O DeliveryMode=background
-
-# automatically rebuild the alias database?
-#O AutoRebuildAliases
-
-# error message header/file
-#O ErrorHeader=/etc/sendmail.oE
-
-# error mode
-#O ErrorMode=print
-
-# save Unix-style "From_" lines at top of header?
-#O SaveFromLine
-
-# temporary file mode
-O TempFileMode=0600
-
-# match recipients against GECOS field?
-#O MatchGECOS
-
-# maximum hop count
-#O MaxHopCount=17
-
-# location of help file
-O HelpFile=/usr/lib/sendmail.hf
-
-# ignore dots as terminators in incoming messages?
-#O IgnoreDots
-
-# name resolver options
-#O ResolverOptions=+AAONLY
-
-# deliver MIME-encapsulated error messages?
-O SendMimeErrors=True
-
-# Forward file search path
-O ForwardPath=$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z/.forward
-
-# open connection cache size
-O ConnectionCacheSize=2
-
-# open connection cache timeout
-O ConnectionCacheTimeout=5m
-
-# persistent host status directory
-#O HostStatusDirectory=.hoststat
-
-# single thread deliveries (requires HostStatusDirectory)?
-#O SingleThreadDelivery
-
-# use Errors-To: header?
-O UseErrorsTo=False
-
-# log level
-O LogLevel=9
-
-# send to me too, even in an alias expansion?
-#O MeToo
-
-# verify RHS in newaliases?
-O CheckAliases=False
-
-# default messages to old style headers if no special punctuation?
-O OldStyleHeaders=True
-
-# SMTP daemon options
-#O DaemonPortOptions=Port=esmtp
-
-# privacy flags
-O PrivacyOptions=authwarnings
-
-# who (if anyone) should get extra copies of error messages
-#O PostMasterCopy=Postmaster
-
-# slope of queue-only function
-#O QueueFactor=600000
-
-# queue directory
-O QueueDirectory=/var/spool/mqueue
-
-# timeouts (many of these)
-#O Timeout.initial=5m
-#O Timeout.connect=5m
-#O Timeout.iconnect=5m
-#O Timeout.helo=5m
-#O Timeout.mail=10m
-#O Timeout.rcpt=1h
-#O Timeout.datainit=5m
-#O Timeout.datablock=1h
-#O Timeout.datafinal=1h
-#O Timeout.rset=5m
-#O Timeout.quit=2m
-#O Timeout.misc=2m
-#O Timeout.command=1h
-#O Timeout.ident=30s
-#O Timeout.fileopen=60s
-O Timeout.queuereturn=5d
-#O Timeout.queuereturn.normal=5d
-#O Timeout.queuereturn.urgent=2d
-#O Timeout.queuereturn.non-urgent=7d
-O Timeout.queuewarn=4h
-#O Timeout.queuewarn.normal=4h
-#O Timeout.queuewarn.urgent=1h
-#O Timeout.queuewarn.non-urgent=12h
-#O Timeout.hoststatus=30m
-
-# should we not prune routes in route-addr syntax addresses?
-#O DontPruneRoutes
-
-# queue up everything before forking?
-O SuperSafe=True
-
-# status file
-O StatusFile=/etc/sendmail.st
-
-# time zone handling:
-# if undefined, use system default
-# if defined but null, use TZ envariable passed in
-# if defined and non-null, use that info
-#O TimeZoneSpec=
-
-# default UID (can be username or userid:groupid)
-#O DefaultUser=mailnull
-
-# list of locations of user database file (null means no lookup)
-#O UserDatabaseSpec=/etc/userdb
-
-# fallback MX host
-#O FallbackMXhost=fall.back.host.net
-
-# if we are the best MX host for a site, try it directly instead of config err
-#O TryNullMXList
-
-# load average at which we just queue messages
-#O QueueLA=8
-
-# load average at which we refuse connections
-#O RefuseLA=12
-
-# maximum number of children we allow at one time
-#O MaxDaemonChildren=12
-
-# maximum number of new connections per second
-#O ConnectionRateThrottle=3
-
-# work recipient factor
-#O RecipientFactor=30000
-
-# deliver each queued job in a separate process?
-#O ForkEachJob
-
-# work class factor
-#O ClassFactor=1800
-
-# work time factor
-#O RetryFactor=90000
-
-# shall we sort the queue by hostname first?
-#O QueueSortOrder=priority
-
-# minimum time in queue before retry
-#O MinQueueAge=30m
-
-# default character set
-#O DefaultCharSet=iso-8859-1
-
-# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
-#O ServiceSwitchFile=/etc/service.switch
-
-# hosts file (normally /etc/hosts)
-#O HostsFile=/etc/hosts
-
-# dialup line delay on connection failure
-#O DialDelay=10s
-
-# action to take if there are no recipients in the message
-#O NoRecipientAction=add-to-undisclosed
-
-# chrooted environment for writing to files
-#O SafeFileEnvironment=/arch
-
-# are colons OK in addresses?
-#O ColonOkInAddr
-
-# how many jobs can you process in the queue?
-#O MaxQueueRunSize=10000
-
-# shall I avoid expanding CNAMEs (violates protocols)?
-#O DontExpandCnames
-
-# SMTP initial login message (old $e macro)
-O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
-
-# UNIX initial From header format (old $l macro)
-O UnixFromLine=From $g $d
-
-# From: lines that have embedded newlines are unwrapped onto one line
-#O SingleLineFromHeader=False
-
-# Allow HELO SMTP command that does not include a host name
-#O AllowBogusHELO=False
-
-# Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
-#O MustQuoteChars=.
-
-# delimiter (operator) characters (old $o macro)
-O OperatorChars=.:%@!^/[]+
-
-# shall I avoid calling initgroups(3) because of high NIS costs?
-#O DontInitGroups
-
-# are group-writable :include: and .forward files (un)trustworthy?
-#O UnsafeGroupWrites
-
-# where do errors that occur when sending errors get sent?
-#O DoubleBounceAddress=postmaster
-
-# what user id do we assume for the majority of the processing?
-#O RunAsUser=sendmail
-
-# maximum number of recipients per SMTP envelope
-#O MaxRecipientsPerMessage=100
-
-# shall we get local names from our installed interfaces?
-#O DontProbeInterfaces
-
-
-
-
-
-
-###########################
-# Message precedences #
-###########################
-
-Pfirst-class=0
-Pspecial-delivery=100
-Plist=-30
-Pbulk=-60
-Pjunk=-100
-
-#####################
-# Trusted users #
-#####################
-
-# this is equivalent to setting class "t"
-#Ft/etc/sendmail.ct
-Troot
-Tdaemon
-Tuucp
-
-#########################
-# Format of headers #
-#########################
-
-H?P?Return-Path: <$g>
-HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
- $.by $j ($v/$Z)$?r with $r$. id $i$?u
- for $u; $|;
- $.$b
-H?D?Resent-Date: $a
-H?D?Date: $a
-H?F?Resent-From: $?x$x <$g>$|$g$.
-H?F?From: $?x$x <$g>$|$g$.
-H?x?Full-Name: $x
-# HPosted-Date: $a
-# H?l?Received-Date: $b
-H?M?Resent-Message-Id: <$t.$i@$j>
-H?M?Message-Id: <$t.$i@$j>
-#\f
-######################################################################
-######################################################################
-#####
-##### REWRITING RULES
-#####
-######################################################################
-######################################################################
-
-############################################
-### Ruleset 3 -- Name Canonicalization ###
-############################################
-S3
-
-# handle null input (translate to <@> special case)
-R$@ $@ <@>
-
-# strip group: syntax (not inside angle brackets!) and trailing semicolon
-R$* $: $1 <@> mark addresses
-R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
-R@ $* <@> $: @ $1 unmark @host:...
-R$* :: $* <@> $: $1 :: $2 unmark node::addr
-R:include: $* <@> $: :include: $1 unmark :include:...
-R$* [ $* : $* ] <@> $: $1 [ $2 : $3 ] unmark IPv6 addrs
-R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon
-R$* : $* <@> $: $2 strip colon if marked
-R$* <@> $: $1 unmark
-R$* ; $1 strip trailing semi
-R$* < $* ; > $1 < $2 > bogus bracketed semi
-
-# null input now results from list:; syntax
-R$@ $@ :; <@>
-
-# strip angle brackets -- note RFC733 heuristic to get innermost item
-R$* $: < $1 > housekeeping <>
-R$+ < $* > < $2 > strip excess on left
-R< $* > $+ < $1 > strip excess on right
-R<> $@ < @ > MAIL FROM:<> case
-R< $+ > $: $1 remove housekeeping <>
-
-# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
-R@ $+ , $+ @ $1 : $2 change all "," to ":"
-
-# localize and dispose of route-based addresses
-R@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr>
-
-# find focus for list syntax
-R $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax
-R $+ : $* ; $@ $1 : $2; list syntax
-
-# find focus for @ syntax addresses
-R$+ @ $+ $: $1 < @ $2 > focus on domain
-R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
-R$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical
-
-# do some sanity checking
-R$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs
-
-# convert old-style addresses to a domain-based address
-R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names
-R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps
-R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains
-
-# if we have % signs, take the rightmost one
-R$* % $* $1 @ $2 First make them all @s.
-R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
-R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish
-
-# else we must be a local name
-R$* $@ $>96 $1
-
-
-################################################
-### Ruleset 96 -- bottom half of ruleset 3 ###
-################################################
-
-S96
-
-# handle special cases for local names
-R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
-R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
-R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain
-R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d]
-R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
-R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr
-
-
-
-
-
-# if really UUCP, handle it immediately
-
-# try UUCP traffic as a local address
-R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3
-R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3
-
-# pass to name server to make hostname canonical
-R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4
-
-# local host aliases and pseudo-domains are always canonical
-R$* < @ $=w > $* $: $1 < @ $2 . > $3
-R$* < @ $j > $* $: $1 < @ $j . > $2
-R$* < @ $=M > $* $: $1 < @ $2 . > $3
-R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4
-R$* < @ $* . . > $* $1 < @ $2 . > $3
-
-
-##################################################
-### Ruleset 4 -- Final Output Post-rewriting ###
-##################################################
-S4
-
-R$* <@> $@ handle <> and list:;
-
-# strip trailing dot off possibly canonical name
-R$* < @ $+ . > $* $1 < @ $2 > $3
-
-# eliminate internal code -- should never get this far!
-R$* < @ *LOCAL* > $* $1 < @ $j > $2
-
-# externalize local domain info
-R$* < $+ > $* $1 $2 $3 defocus
-R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
-R@ $* $@ @ $1 ... and exit
-
-# UUCP must always be presented in old form
-R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u
-
-# delete duplicate local names
-R$+ % $=w @ $=w $1 @ $2 u%host@host => u@host
-
-
-
-##############################################################
-### Ruleset 97 -- recanonicalize and call ruleset zero ###
-### (used for recursive calls) ###
-##############################################################
-
-S97
-R$* $: $>3 $1
-R$* $@ $>0 $1
-
-
-######################################
-### Ruleset 0 -- Parse Address ###
-######################################
-
-S0
-
-R$* $: $>Parse0 $1 initial parsing
-R<@> $#local $: <@> special case error msgs
-R$* $: $>98 $1 handle local hacks
-R$* $: $>Parse1 $1 final parsing
-
-#
-# Parse0 -- do initial syntax checking and eliminate local addresses.
-# This should either return with the (possibly modified) input
-# or return with a #error mailer. It should not return with a
-# #mailer other than the #error mailer.
-#
-
-SParse0
-R<@> $@ <@> special case error msgs
-R$* : $* ; <@> $#error $@ 5.1.3 $: "List:; syntax illegal for recipient addresses"
-#R@ <@ $* > < @ $1 > catch "@@host" bogosity
-R<@ $+> $#error $@ 5.1.3 $: "User address required"
-R$* $: <> $1
-R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3
-R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "Colon illegal in host name part"
-R<> $* $1
-R$* < @ . $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-
-# now delete the local info -- note $=O to find characters that cause forwarding
-R$* < @ > $* $@ $>Parse0 $>3 $1 user@ => user
-R< @ $=w . > : $* $@ $>Parse0 $>3 $2 @here:... -> ...
-R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here
-R< @ $+ > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ $=w . > $@ $>Parse0 $>3 $1 $2 $3 ...@here -> ...
-R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"
-R< @ *LOCAL* > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ *LOCAL* >
- $@ $>Parse0 $>3 $1 $2 $3 ...@*LOCAL* -> ...
-R$* < @ *LOCAL* > $: $1
-
-#
-# Parse1 -- the bottom half of ruleset 0.
-#
-
-SParse1
-# handle numeric address spec
-R$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec
-R$* < @ [ $+ ] > $* $#esmtp $@ [$2] $: $1 < @ [$2] > $3 still numeric: send
-
-
-# short circuit local delivery so forwarded email works
-R$=L < @ $=w . > $#local $: @ $1 special local names
-R$+ < @ $=w . > $#local $: $1 regular local name
-
-
-# resolve remotely connected UUCP links (if any)
-
-# resolve fake top level domains by forwarding to other hosts
-
-
-
-# pass names that still have a host to a smarthost (if defined)
-R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name
-
-# deal with other remote names
-R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain
-
-# handle locally delivered names
-R$=L $#local $: @ $1 special local names
-R$+ $#local $: $1 regular local names
-
-###########################################################################
-### Ruleset 5 -- special rewriting after aliases have been expanded ###
-###########################################################################
-
-S5
-
-# deal with plussed users so aliases work nicely
-R$+ + * $#local $@ $&h $: $1
-R$+ + $* $#local $@ + $2 $: $1 + *
-
-# prepend an empty "forward host" on the front
-R$+ $: <> $1
-
-
-# see if we have a relay or a hub
-R< > $+ $: < $H > $1 try hub
-R< > $+ $: < $R > $1 try relay
-R< > $+ $: < > < $1 $&h > nope, restore +detail
-R< > < $+ + $* > $* < > < $1 > + $2 $3 find the user part
-R< > < $+ > + $* $#local $@ $2 $: @ $1 strip the extra +
-R< > < $+ > $@ $1 no +detail
-R$+ $: $1 <> $&h add +detail back in
-R$+ <> + $* $: $1 + $2 check whether +detail
-R$+ <> $* $: $1 else discard
-R< local : $* > $* $: $>95 < local : $1 > $2 no host extension
-R< error : $* > $* $: $>95 < error : $1 > $2 no host extension
-R< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 >
-R< $+ > $+ $@ $>95 < $1 > $2 < @ $1 >
-
-
-###################################################################
-### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
-###################################################################
-
-S95
-R< > $* $@ $1 strip off null relay
-R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2
-R< local : $* > $* $>CanonLocal < $1 > $2
-R< $- : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
-R< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
-R< $=w > $* $@ $2 delete local host
-R< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer
-
-###################################################################
-### Ruleset CanonLocal -- canonify local: syntax ###
-###################################################################
-
-SCanonLocal
-# strip local host from routed addresses
-R< $* > < @ $+ > : $+ $@ $>97 $3
-R< $* > $+ $=O $+ < @ $+ > $@ $>97 $2 $3 $4
-
-# strip trailing dot from any host name that may appear
-R< $* > $* < @ $* . > $: < $1 > $2 < @ $3 >
-
-# handle local: syntax -- use old user, either with or without host
-R< > $* < @ $* > $* $#local $@ $1@$2 $: $1
-R< > $+ $#local $@ $1 $: $1
-
-# handle local:user@host syntax -- ignore host part
-R< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 >
-
-# handle local:user syntax
-R< $+ > $* <@ $* > $* $#local $@ $2@$3 $: $1
-R< $+ > $* $#local $@ $2 $: $1
-
-###################################################################
-### Ruleset 93 -- convert header names to masqueraded form ###
-###################################################################
-
-S93
-
-
-# special case the users that should be exposed
-R$=E < @ *LOCAL* > $@ $1 < @ $j . > leave exposed
-R$=E < @ $=M . > $@ $1 < @ $2 . >
-R$=E < @ $=w . > $@ $1 < @ $2 . >
-
-# handle domain-specific masquerading
-R$* < @ $=M . > $* $: $1 < @ $2 . @ $M > $3 convert masqueraded doms
-R$* < @ $=w . > $* $: $1 < @ $2 . @ $M > $3
-R$* < @ *LOCAL* > $* $: $1 < @ $j . @ $M > $2
-R$* < @ $+ @ > $* $: $1 < @ $2 > $3 $M is null
-R$* < @ $+ @ $+ > $* $: $1 < @ $3 . > $4 $M is not null
-
-###################################################################
-### Ruleset 94 -- convert envelope names to masqueraded form ###
-###################################################################
-
-S94
-R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
-
-###################################################################
-### Ruleset 98 -- local part of ruleset zero (can be null) ###
-###################################################################
-
-S98
-
-# addresses sent to foo@host.REDIRECT will give a 551 error code
-R$* < @ $+ .REDIRECT. > $: $1 < @ $2 . REDIRECT . > < ${opMode} >
-R$* < @ $+ .REDIRECT. > <i> $: $1 < @ $2 . REDIRECT. >
-R$* < @ $+ .REDIRECT. > < $- > $# error $@ 5.1.1 $: "551 User has moved; please try " <$1@$2>
-
-
-
-######################################################################
-### CanonAddr -- Convert an address into a standard form for
-### relay checking. Route address syntax is
-### crudely converted into a %-hack address.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed address, not in source route form
-######################################################################
-
-SCanonAddr
-R$* $: $>Parse0 $>3 $1 make domain canonical
-R< @ $+ > : $* @ $* < @ $1 > : $2 % $3 change @ to % in src route
-R$* < @ $+ > : $* : $* $3 $1 < @ $2 > : $4 change to % hack.
-R$* < @ $+ > : $* $3 $1 < @ $2 >
-
-######################################################################
-### ParseRecipient -- Strip off hosts in $=R as well as possibly
-### $* $=m or the access database.
-### Check user portion for host separators.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed, non-local-relaying address
-######################################################################
-
-SParseRecipient
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots
-R<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part
-
-# if no $=O character, no host in the user portion, we are done
-R<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4>
-R<?> $* $@ $1
-
-
-
-R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 >
-
-R<RELAY> $* < @ $* > $@ $>ParseRecipient $1
-R<$-> $* $@ $2
-
-######################################################################
-### check_relay -- check hostname/address on SMTP startup
-######################################################################
-
-SLocal_check_relay
-Scheck_relay
-R$* $: $1 $| $>"Local_check_relay" $1
-R$* $| $* $| $#$* $#$3
-R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
-
-SBasic_check_relay
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-
-
-######################################################################
-### check_mail -- check SMTP `MAIL FROM:' command argument
-######################################################################
-
-SLocal_check_mail
-Scheck_mail
-R$* $: $1 $| $>"Local_check_mail" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_mail" $1
-
-SBasic_check_mail
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R<> $@ <OK>
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots
-# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
-R<?> $* < $* $=P > $* $: <OK> $1 < @ $2 $3 > $4
-R<?> $* < @ $+ > $* $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 > $3
-R<? $* <$->> $* < @ $+ > $*
- $: <$2> $3 < @ $4 > $5
-
-# handle case of @localhost on address
-R<$+> $* < @localhost > $: < ? $&{client_name} > <$1> $2 < @localhost >
-R<$+> $* < @localhost.$m >
- $: < ? $&{client_name} > <$1> $2 < @localhost.$m >
-R<$+> $* < @localhost.UUCP >
- $: < ? $&{client_name} > <$1> $2 < @localhost.UUCP >
-R<? $=w> <$+> $* <?> <$2> $3
-R<? $+> <$+> $* $#error $@ 5.5.4 $: "553 Real domain name required"
-R<?> <$+> $* $: <$1> $2
-
-
-# handle case of no @domain on address
-R<?> $* $: < ? $&{client_name} > $1
-R<?> $* $@ <OK> ...local unqualed ok
-R<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required"
- ...remote is not
-# check results
-R<?> $* $@ <OK>
-R<OK> $* $@ <OK>
-R<TEMP> $* $#error $@ 4.1.8 $: "451 Sender domain must resolve"
-R<PERM> $* $#error $@ 5.1.8 $: "501 Sender domain must exist"
-
-######################################################################
-### check_rcpt -- check SMTP `RCPT TO:' command argument
-######################################################################
-
-SLocal_check_rcpt
-Scheck_rcpt
-R$* $: $1 $| $>"Local_check_rcpt" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_rcpt" $1
-
-SBasic_check_rcpt
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R$* $: $>ParseRecipient $1 strip relayable hosts
-
-
-
-
-# anything terminating locally is ok
-R$+ < @ $=w > $@ OK
-R$+ < @ $* $=R > $@ OK
-
-
-# check for local user (i.e. unqualified address)
-R$* $: <?> $1
-R<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 >
-# local user is ok
-R<?> $+ $@ OK
-R<$+> $* $: $2
-
-# anything originating locally is ok
-R$* $: <?> $&{client_name}
-# check if bracketed IP address (forward lookup != reverse lookup)
-R<?> [$+] $: <BAD> [$1]
-# pass to name server to make hostname canonical
-R<?> $* $~P $: <?> $[ $1 $2 $]
-R<$-> $* $: $2
-R$* . $1 strip trailing dots
-R$@ $@ OK
-R$=w $@ OK
-R$* $=R $@ OK
-
-# check IP address
-R$* $: $&{client_addr}
-R$@ $@ OK originated locally
-R0 $@ OK originated locally
-R$=R $* $@ OK relayable IP address
-R$* $: [ $1 ] put brackets around it...
-R$=w $@ OK ... and see if it is local
-
-
-# anything else is bogus
-R$* $#error $@ 5.7.1 $: "550 Relaying denied"
-
-#\f
-######################################################################
-######################################################################
-#####
-##### MAILER DEFINITIONS
-#####
-######################################################################
-######################################################################
-
-
-##################################################
-### Local and Program Mailer specification ###
-##################################################
-
-##### @(#)local.m4 8.30 (Berkeley) 6/30/1998 #####
-
-Mlocal, P=/bin/mail, F=lsDFMAw5:/|@qrmn9, S=10/30, R=20/40,
- T=DNS/RFC822/X-Unix,
- A=mail -d $u
-Mprog, P=/bin/sh, F=lsDFMoqeu9, S=10/30, R=20/40, D=$z:/,
- T=X-Unix,
- A=sh -c $u
-
-#
-# Envelope sender rewriting
-#
-S10
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>94 $1 do masquerading
-
-#
-# Envelope recipient rewriting
-#
-S20
-R$+ < @ $* > $: $1 strip host part
-
-#
-# Header sender rewriting
-#
-S30
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>93 $1 do masquerading
-
-#
-# Header recipient rewriting
-#
-S40
-R$+ $: $>50 $1 add local domain if needed
-
-#
-# Common code to add local domain name (only if always-add-domain)
-#
-S50
-
-#####################################
-### SMTP Mailer specification ###
-#####################################
-
-##### @(#)smtp.m4 8.38 (Berkeley) 5/19/1998 #####
-
-Msmtp, P=[IPC], F=mDFMuX, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mesmtp, P=[IPC], F=mDFMuXa, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Msmtp8, P=[IPC], F=mDFMuX8, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mrelay, P=[IPC], F=mDFMuXa8, S=11/31, R=61, E=\r\n, L=2040,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-
-#
-# envelope sender rewriting
-#
-S11
-R$+ $: $>51 $1 sender/recipient common
-R$* :; <@> $@ list:; special case
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>94 $1 do masquerading
-
-
-#
-# envelope recipient rewriting --
-# also header recipient if not masquerading recipients
-#
-S21
-R$+ $: $>51 $1 sender/recipient common
-R$+ $: $>61 $1 qualify unqual'ed names
-
-
-#
-# header sender and masquerading header recipient rewriting
-#
-S31
-R$+ $: $>51 $1 sender/recipient common
-R:; <@> $@ list:; special case
-
-# do special header rewriting
-R$* <@> $* $@ $1 <@> $2 pass null host through
-R< @ $* > $* $@ < @ $1 > $2 pass route-addr through
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>93 $1 do masquerading
-
-
-#
-# convert pseudo-domain addresses to real domain addresses
-#
-S51
-
-# pass <route-addr>s through
-R< @ $+ > $* $@ < @ $1 > $2 resolve <route-addr>
-
-# output fake domains as user%fake@relay
-
-# do UUCP heuristics; note that these are shared with UUCP mailers
-R$+ < @ $+ .UUCP. > $: < $2 ! > $1 convert to UUCP form
-R$+ < @ $* > $* $@ $1 < @ $2 > $3 not UUCP form
-
-# leave these in .UUCP form to avoid further tampering
-R< $&h ! > $- ! $+ $@ $2 < @ $1 .UUCP. >
-R< $&h ! > $-.$+ ! $+ $@ $3 < @ $1.$2 >
-R< $&h ! > $+ $@ $1 < @ $&h .UUCP. >
-R< $+ ! > $+ $: $1 ! $2 < @ $Y > use UUCP_RELAY
-R$+ < @ $+ : $+ > $@ $1 < @ $3 > strip mailer: part
-R$+ < @ > $: $1 < @ *LOCAL* > if no UUCP_RELAY
-
-
-#
-# common sender and masquerading recipient rewriting
-#
-S61
-
-R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
-R$+ $@ $1 < @ *LOCAL* > add local qualification
-
-
-#
-# relay mailer header masquerading recipient rewriting
-#
-S71
-
-R$+ $: $>61 $1
-R$+ $: $>93 $1
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a generic configuration file for SunOS 4.1.x.
-# It has support for local and SMTP mail only. If you want to
-# customize it, copy it to a name appropriate for your environment
-# and do the modifications there.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)generic-sunos4.1.mc 8.8 (Berkeley) 5/19/1998')
-OSTYPE(sunos4.1)dnl
-DOMAIN(generic)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-######################################################################
-######################################################################
-#####
-##### SENDMAIL CONFIGURATION FILE
-#####
-##### built by gshapiro@knecht.sendmail.org on Thu Feb 4 16:39:23 PST 1999
-##### in /home/eric/src/sendmail/cf/cf
-##### using ../ as configuration include directory
-#####
-######################################################################
-######################################################################
-
-##### @(#)cfhead.m4 8.23 (Berkeley) 10/6/1998 #####
-##### @(#)cf.m4 8.29 (Berkeley) 5/19/1998 #####
-##### @(#)generic-ultrix4.mc 8.8 (Berkeley) 5/19/1998 #####
-
-##### @(#)ultrix4.m4 8.8 (Berkeley) 5/19/1998 #####
-
-
-##### @(#)generic.m4 8.9 (Berkeley) 5/19/1998 #####
-
-##### @(#)redirect.m4 8.10 (Berkeley) 5/19/1998 #####
-
-
-
-
-##### @(#)use_cw_file.m4 8.6 (Berkeley) 5/19/1998 #####
-
-
-
-##### @(#)proto.m4 8.243 (Berkeley) 2/2/1999 #####
-
-
-# level 8 config file format
-V8/Berkeley
-
-# override file safeties - setting this option compromises system security
-# need to set this now for the sake of class files
-#O DontBlameSendmail=safe
-
-##################
-# local info #
-##################
-
-Cwlocalhost
-# file containing names of hosts for which we receive email
-Fw/etc/sendmail.cw
-
-# my official domain name
-# ... define this only if sendmail cannot automatically determine your domain
-#Dj$w.Foo.COM
-
-
-CP.
-
-# "Smart" relay host (may be null)
-DS
-
-
-# operators that cannot be in local usernames (i.e., network indicators)
-CO @ % !
-
-# a class with just dot (for identifying canonical names)
-C..
-
-# a class with just a left bracket (for identifying domain literals)
-C[[
-
-
-
-
-
-
-
-
-
-# Resolve map (to check if a host exists in check_mail)
-Kresolve host -a<OK> -T<TEMP>
-
-# Hosts that will permit relaying ($=R)
-FR-o /etc/mail/relay-domains
-
-# who I send unqualified names to (null means deliver locally)
-DR
-
-# who gets all local email traffic ($R has precedence for unqualified names)
-DH
-
-# dequoting map
-Kdequote dequote
-
-# class E: names that should be exposed as from this host, even if we masquerade
-# class L: names that should be delivered locally, even if we have a relay
-# class M: domains that should be converted to $M
-#CL root
-CE root
-
-# who I masquerade as (null for no masquerading) (see also $=M)
-DM
-
-# my name for error messages
-DnMAILER-DAEMON
-
-
-CPREDIRECT
-
-# Configuration version number
-DZ8.9.3
-
-
-###############
-# Options #
-###############
-
-# strip message body to 7 bits on input?
-O SevenBitInput=False
-
-# 8-bit data handling
-O EightBitMode=pass8
-
-
-# wait for alias file rebuild (default units: minutes)
-O AliasWait=10
-
-# location of alias file
-O AliasFile=/etc/aliases
-
-# minimum number of free blocks on filesystem
-O MinFreeBlocks=100
-
-# maximum message size
-#O MaxMessageSize=1000000
-
-# substitution for space (blank) characters
-O BlankSub=.
-
-# avoid connecting to "expensive" mailers on initial submission?
-O HoldExpensive=False
-
-# checkpoint queue runs after every N successful deliveries
-#O CheckpointInterval=10
-
-# default delivery mode
-O DeliveryMode=background
-
-# automatically rebuild the alias database?
-#O AutoRebuildAliases
-
-# error message header/file
-#O ErrorHeader=/etc/sendmail.oE
-
-# error mode
-#O ErrorMode=print
-
-# save Unix-style "From_" lines at top of header?
-#O SaveFromLine
-
-# temporary file mode
-O TempFileMode=0600
-
-# match recipients against GECOS field?
-#O MatchGECOS
-
-# maximum hop count
-#O MaxHopCount=17
-
-# location of help file
-O HelpFile=/usr/lib/sendmail.hf
-
-# ignore dots as terminators in incoming messages?
-#O IgnoreDots
-
-# name resolver options
-#O ResolverOptions=+AAONLY
-
-# deliver MIME-encapsulated error messages?
-O SendMimeErrors=True
-
-# Forward file search path
-O ForwardPath=$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z/.forward
-
-# open connection cache size
-O ConnectionCacheSize=2
-
-# open connection cache timeout
-O ConnectionCacheTimeout=5m
-
-# persistent host status directory
-#O HostStatusDirectory=.hoststat
-
-# single thread deliveries (requires HostStatusDirectory)?
-#O SingleThreadDelivery
-
-# use Errors-To: header?
-O UseErrorsTo=False
-
-# log level
-O LogLevel=9
-
-# send to me too, even in an alias expansion?
-#O MeToo
-
-# verify RHS in newaliases?
-O CheckAliases=False
-
-# default messages to old style headers if no special punctuation?
-O OldStyleHeaders=True
-
-# SMTP daemon options
-#O DaemonPortOptions=Port=esmtp
-
-# privacy flags
-O PrivacyOptions=authwarnings
-
-# who (if anyone) should get extra copies of error messages
-#O PostMasterCopy=Postmaster
-
-# slope of queue-only function
-#O QueueFactor=600000
-
-# queue directory
-O QueueDirectory=/var/spool/mqueue
-
-# timeouts (many of these)
-#O Timeout.initial=5m
-#O Timeout.connect=5m
-#O Timeout.iconnect=5m
-#O Timeout.helo=5m
-#O Timeout.mail=10m
-#O Timeout.rcpt=1h
-#O Timeout.datainit=5m
-#O Timeout.datablock=1h
-#O Timeout.datafinal=1h
-#O Timeout.rset=5m
-#O Timeout.quit=2m
-#O Timeout.misc=2m
-#O Timeout.command=1h
-#O Timeout.ident=30s
-#O Timeout.fileopen=60s
-O Timeout.queuereturn=5d
-#O Timeout.queuereturn.normal=5d
-#O Timeout.queuereturn.urgent=2d
-#O Timeout.queuereturn.non-urgent=7d
-O Timeout.queuewarn=4h
-#O Timeout.queuewarn.normal=4h
-#O Timeout.queuewarn.urgent=1h
-#O Timeout.queuewarn.non-urgent=12h
-#O Timeout.hoststatus=30m
-
-# should we not prune routes in route-addr syntax addresses?
-#O DontPruneRoutes
-
-# queue up everything before forking?
-O SuperSafe=True
-
-# status file
-O StatusFile=/etc/sendmail.st
-
-# time zone handling:
-# if undefined, use system default
-# if defined but null, use TZ envariable passed in
-# if defined and non-null, use that info
-#O TimeZoneSpec=
-
-# default UID (can be username or userid:groupid)
-#O DefaultUser=mailnull
-
-# list of locations of user database file (null means no lookup)
-#O UserDatabaseSpec=/etc/userdb
-
-# fallback MX host
-#O FallbackMXhost=fall.back.host.net
-
-# if we are the best MX host for a site, try it directly instead of config err
-#O TryNullMXList
-
-# load average at which we just queue messages
-#O QueueLA=8
-
-# load average at which we refuse connections
-#O RefuseLA=12
-
-# maximum number of children we allow at one time
-#O MaxDaemonChildren=12
-
-# maximum number of new connections per second
-#O ConnectionRateThrottle=3
-
-# work recipient factor
-#O RecipientFactor=30000
-
-# deliver each queued job in a separate process?
-#O ForkEachJob
-
-# work class factor
-#O ClassFactor=1800
-
-# work time factor
-#O RetryFactor=90000
-
-# shall we sort the queue by hostname first?
-#O QueueSortOrder=priority
-
-# minimum time in queue before retry
-#O MinQueueAge=30m
-
-# default character set
-#O DefaultCharSet=iso-8859-1
-
-# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
-#O ServiceSwitchFile=/etc/service.switch
-
-# hosts file (normally /etc/hosts)
-#O HostsFile=/etc/hosts
-
-# dialup line delay on connection failure
-#O DialDelay=10s
-
-# action to take if there are no recipients in the message
-#O NoRecipientAction=add-to-undisclosed
-
-# chrooted environment for writing to files
-#O SafeFileEnvironment=/arch
-
-# are colons OK in addresses?
-#O ColonOkInAddr
-
-# how many jobs can you process in the queue?
-#O MaxQueueRunSize=10000
-
-# shall I avoid expanding CNAMEs (violates protocols)?
-#O DontExpandCnames
-
-# SMTP initial login message (old $e macro)
-O SmtpGreetingMessage=$j Sendmail $v/$Z; $b
-
-# UNIX initial From header format (old $l macro)
-O UnixFromLine=From $g $d
-
-# From: lines that have embedded newlines are unwrapped onto one line
-#O SingleLineFromHeader=False
-
-# Allow HELO SMTP command that does not include a host name
-#O AllowBogusHELO=False
-
-# Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
-#O MustQuoteChars=.
-
-# delimiter (operator) characters (old $o macro)
-O OperatorChars=.:%@!^/[]+
-
-# shall I avoid calling initgroups(3) because of high NIS costs?
-#O DontInitGroups
-
-# are group-writable :include: and .forward files (un)trustworthy?
-#O UnsafeGroupWrites
-
-# where do errors that occur when sending errors get sent?
-#O DoubleBounceAddress=postmaster
-
-# what user id do we assume for the majority of the processing?
-#O RunAsUser=sendmail
-
-# maximum number of recipients per SMTP envelope
-#O MaxRecipientsPerMessage=100
-
-# shall we get local names from our installed interfaces?
-#O DontProbeInterfaces
-
-
-
-
-
-
-###########################
-# Message precedences #
-###########################
-
-Pfirst-class=0
-Pspecial-delivery=100
-Plist=-30
-Pbulk=-60
-Pjunk=-100
-
-#####################
-# Trusted users #
-#####################
-
-# this is equivalent to setting class "t"
-#Ft/etc/sendmail.ct
-Troot
-Tdaemon
-Tuucp
-
-#########################
-# Format of headers #
-#########################
-
-H?P?Return-Path: <$g>
-HReceived: $?sfrom $s $.$?_($?s$|from $.$_)
- $.by $j ($v/$Z)$?r with $r$. id $i$?u
- for $u; $|;
- $.$b
-H?D?Resent-Date: $a
-H?D?Date: $a
-H?F?Resent-From: $?x$x <$g>$|$g$.
-H?F?From: $?x$x <$g>$|$g$.
-H?x?Full-Name: $x
-# HPosted-Date: $a
-# H?l?Received-Date: $b
-H?M?Resent-Message-Id: <$t.$i@$j>
-H?M?Message-Id: <$t.$i@$j>
-#\f
-######################################################################
-######################################################################
-#####
-##### REWRITING RULES
-#####
-######################################################################
-######################################################################
-
-############################################
-### Ruleset 3 -- Name Canonicalization ###
-############################################
-S3
-
-# handle null input (translate to <@> special case)
-R$@ $@ <@>
-
-# strip group: syntax (not inside angle brackets!) and trailing semicolon
-R$* $: $1 <@> mark addresses
-R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
-R@ $* <@> $: @ $1 unmark @host:...
-R$* :: $* <@> $: $1 :: $2 unmark node::addr
-R:include: $* <@> $: :include: $1 unmark :include:...
-R$* [ $* : $* ] <@> $: $1 [ $2 : $3 ] unmark IPv6 addrs
-R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon
-R$* : $* <@> $: $2 strip colon if marked
-R$* <@> $: $1 unmark
-R$* ; $1 strip trailing semi
-R$* < $* ; > $1 < $2 > bogus bracketed semi
-
-# null input now results from list:; syntax
-R$@ $@ :; <@>
-
-# strip angle brackets -- note RFC733 heuristic to get innermost item
-R$* $: < $1 > housekeeping <>
-R$+ < $* > < $2 > strip excess on left
-R< $* > $+ < $1 > strip excess on right
-R<> $@ < @ > MAIL FROM:<> case
-R< $+ > $: $1 remove housekeeping <>
-
-# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
-R@ $+ , $+ @ $1 : $2 change all "," to ":"
-
-# localize and dispose of route-based addresses
-R@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr>
-
-# find focus for list syntax
-R $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax
-R $+ : $* ; $@ $1 : $2; list syntax
-
-# find focus for @ syntax addresses
-R$+ @ $+ $: $1 < @ $2 > focus on domain
-R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
-R$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical
-
-# do some sanity checking
-R$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs
-
-# convert old-style addresses to a domain-based address
-R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names
-R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps
-R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains
-
-# if we have % signs, take the rightmost one
-R$* % $* $1 @ $2 First make them all @s.
-R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
-R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish
-
-# else we must be a local name
-R$* $@ $>96 $1
-
-
-################################################
-### Ruleset 96 -- bottom half of ruleset 3 ###
-################################################
-
-S96
-
-# handle special cases for local names
-R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
-R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
-R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain
-R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d]
-R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
-R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr
-
-
-
-
-
-# if really UUCP, handle it immediately
-
-# try UUCP traffic as a local address
-R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3
-R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3
-
-# pass to name server to make hostname canonical
-R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4
-
-# local host aliases and pseudo-domains are always canonical
-R$* < @ $=w > $* $: $1 < @ $2 . > $3
-R$* < @ $j > $* $: $1 < @ $j . > $2
-R$* < @ $=M > $* $: $1 < @ $2 . > $3
-R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4
-R$* < @ $* . . > $* $1 < @ $2 . > $3
-
-
-##################################################
-### Ruleset 4 -- Final Output Post-rewriting ###
-##################################################
-S4
-
-R$* <@> $@ handle <> and list:;
-
-# strip trailing dot off possibly canonical name
-R$* < @ $+ . > $* $1 < @ $2 > $3
-
-# eliminate internal code -- should never get this far!
-R$* < @ *LOCAL* > $* $1 < @ $j > $2
-
-# externalize local domain info
-R$* < $+ > $* $1 $2 $3 defocus
-R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
-R@ $* $@ @ $1 ... and exit
-
-# UUCP must always be presented in old form
-R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u
-
-# delete duplicate local names
-R$+ % $=w @ $=w $1 @ $2 u%host@host => u@host
-
-
-
-##############################################################
-### Ruleset 97 -- recanonicalize and call ruleset zero ###
-### (used for recursive calls) ###
-##############################################################
-
-S97
-R$* $: $>3 $1
-R$* $@ $>0 $1
-
-
-######################################
-### Ruleset 0 -- Parse Address ###
-######################################
-
-S0
-
-R$* $: $>Parse0 $1 initial parsing
-R<@> $#local $: <@> special case error msgs
-R$* $: $>98 $1 handle local hacks
-R$* $: $>Parse1 $1 final parsing
-
-#
-# Parse0 -- do initial syntax checking and eliminate local addresses.
-# This should either return with the (possibly modified) input
-# or return with a #error mailer. It should not return with a
-# #mailer other than the #error mailer.
-#
-
-SParse0
-R<@> $@ <@> special case error msgs
-R$* : $* ; <@> $#error $@ 5.1.3 $: "List:; syntax illegal for recipient addresses"
-#R@ <@ $* > < @ $1 > catch "@@host" bogosity
-R<@ $+> $#error $@ 5.1.3 $: "User address required"
-R$* $: <> $1
-R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3
-R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "Colon illegal in host name part"
-R<> $* $1
-R$* < @ . $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-
-# now delete the local info -- note $=O to find characters that cause forwarding
-R$* < @ > $* $@ $>Parse0 $>3 $1 user@ => user
-R< @ $=w . > : $* $@ $>Parse0 $>3 $2 @here:... -> ...
-R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here
-R< @ $+ > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ $=w . > $@ $>Parse0 $>3 $1 $2 $3 ...@here -> ...
-R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"
-R< @ *LOCAL* > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ *LOCAL* >
- $@ $>Parse0 $>3 $1 $2 $3 ...@*LOCAL* -> ...
-R$* < @ *LOCAL* > $: $1
-
-#
-# Parse1 -- the bottom half of ruleset 0.
-#
-
-SParse1
-# handle numeric address spec
-R$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec
-R$* < @ [ $+ ] > $* $#esmtp $@ [$2] $: $1 < @ [$2] > $3 still numeric: send
-
-
-# short circuit local delivery so forwarded email works
-R$=L < @ $=w . > $#local $: @ $1 special local names
-R$+ < @ $=w . > $#local $: $1 regular local name
-
-
-# resolve remotely connected UUCP links (if any)
-
-# resolve fake top level domains by forwarding to other hosts
-
-
-
-# pass names that still have a host to a smarthost (if defined)
-R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name
-
-# deal with other remote names
-R$* < @$* > $* $#esmtp $@ $2 $: $1 < @ $2 > $3 user@host.domain
-
-# handle locally delivered names
-R$=L $#local $: @ $1 special local names
-R$+ $#local $: $1 regular local names
-
-###########################################################################
-### Ruleset 5 -- special rewriting after aliases have been expanded ###
-###########################################################################
-
-S5
-
-# deal with plussed users so aliases work nicely
-R$+ + * $#local $@ $&h $: $1
-R$+ + $* $#local $@ + $2 $: $1 + *
-
-# prepend an empty "forward host" on the front
-R$+ $: <> $1
-
-
-# see if we have a relay or a hub
-R< > $+ $: < $H > $1 try hub
-R< > $+ $: < $R > $1 try relay
-R< > $+ $: < > < $1 $&h > nope, restore +detail
-R< > < $+ + $* > $* < > < $1 > + $2 $3 find the user part
-R< > < $+ > + $* $#local $@ $2 $: @ $1 strip the extra +
-R< > < $+ > $@ $1 no +detail
-R$+ $: $1 <> $&h add +detail back in
-R$+ <> + $* $: $1 + $2 check whether +detail
-R$+ <> $* $: $1 else discard
-R< local : $* > $* $: $>95 < local : $1 > $2 no host extension
-R< error : $* > $* $: $>95 < error : $1 > $2 no host extension
-R< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 >
-R< $+ > $+ $@ $>95 < $1 > $2 < @ $1 >
-
-
-###################################################################
-### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
-###################################################################
-
-S95
-R< > $* $@ $1 strip off null relay
-R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2
-R< local : $* > $* $>CanonLocal < $1 > $2
-R< $- : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
-R< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
-R< $=w > $* $@ $2 delete local host
-R< $+ > $* $#relay $@ $1 $: $2 use unqualified mailer
-
-###################################################################
-### Ruleset CanonLocal -- canonify local: syntax ###
-###################################################################
-
-SCanonLocal
-# strip local host from routed addresses
-R< $* > < @ $+ > : $+ $@ $>97 $3
-R< $* > $+ $=O $+ < @ $+ > $@ $>97 $2 $3 $4
-
-# strip trailing dot from any host name that may appear
-R< $* > $* < @ $* . > $: < $1 > $2 < @ $3 >
-
-# handle local: syntax -- use old user, either with or without host
-R< > $* < @ $* > $* $#local $@ $1@$2 $: $1
-R< > $+ $#local $@ $1 $: $1
-
-# handle local:user@host syntax -- ignore host part
-R< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 >
-
-# handle local:user syntax
-R< $+ > $* <@ $* > $* $#local $@ $2@$3 $: $1
-R< $+ > $* $#local $@ $2 $: $1
-
-###################################################################
-### Ruleset 93 -- convert header names to masqueraded form ###
-###################################################################
-
-S93
-
-
-# special case the users that should be exposed
-R$=E < @ *LOCAL* > $@ $1 < @ $j . > leave exposed
-R$=E < @ $=M . > $@ $1 < @ $2 . >
-R$=E < @ $=w . > $@ $1 < @ $2 . >
-
-# handle domain-specific masquerading
-R$* < @ $=M . > $* $: $1 < @ $2 . @ $M > $3 convert masqueraded doms
-R$* < @ $=w . > $* $: $1 < @ $2 . @ $M > $3
-R$* < @ *LOCAL* > $* $: $1 < @ $j . @ $M > $2
-R$* < @ $+ @ > $* $: $1 < @ $2 > $3 $M is null
-R$* < @ $+ @ $+ > $* $: $1 < @ $3 . > $4 $M is not null
-
-###################################################################
-### Ruleset 94 -- convert envelope names to masqueraded form ###
-###################################################################
-
-S94
-R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2
-
-###################################################################
-### Ruleset 98 -- local part of ruleset zero (can be null) ###
-###################################################################
-
-S98
-
-# addresses sent to foo@host.REDIRECT will give a 551 error code
-R$* < @ $+ .REDIRECT. > $: $1 < @ $2 . REDIRECT . > < ${opMode} >
-R$* < @ $+ .REDIRECT. > <i> $: $1 < @ $2 . REDIRECT. >
-R$* < @ $+ .REDIRECT. > < $- > $# error $@ 5.1.1 $: "551 User has moved; please try " <$1@$2>
-
-
-
-######################################################################
-### CanonAddr -- Convert an address into a standard form for
-### relay checking. Route address syntax is
-### crudely converted into a %-hack address.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed address, not in source route form
-######################################################################
-
-SCanonAddr
-R$* $: $>Parse0 $>3 $1 make domain canonical
-R< @ $+ > : $* @ $* < @ $1 > : $2 % $3 change @ to % in src route
-R$* < @ $+ > : $* : $* $3 $1 < @ $2 > : $4 change to % hack.
-R$* < @ $+ > : $* $3 $1 < @ $2 >
-
-######################################################################
-### ParseRecipient -- Strip off hosts in $=R as well as possibly
-### $* $=m or the access database.
-### Check user portion for host separators.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed, non-local-relaying address
-######################################################################
-
-SParseRecipient
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots
-R<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part
-
-# if no $=O character, no host in the user portion, we are done
-R<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4>
-R<?> $* $@ $1
-
-
-
-R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 >
-
-R<RELAY> $* < @ $* > $@ $>ParseRecipient $1
-R<$-> $* $@ $2
-
-######################################################################
-### check_relay -- check hostname/address on SMTP startup
-######################################################################
-
-SLocal_check_relay
-Scheck_relay
-R$* $: $1 $| $>"Local_check_relay" $1
-R$* $| $* $| $#$* $#$3
-R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
-
-SBasic_check_relay
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-
-
-######################################################################
-### check_mail -- check SMTP `MAIL FROM:' command argument
-######################################################################
-
-SLocal_check_mail
-Scheck_mail
-R$* $: $1 $| $>"Local_check_mail" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_mail" $1
-
-SBasic_check_mail
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R<> $@ <OK>
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots
-# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
-R<?> $* < $* $=P > $* $: <OK> $1 < @ $2 $3 > $4
-R<?> $* < @ $+ > $* $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 > $3
-R<? $* <$->> $* < @ $+ > $*
- $: <$2> $3 < @ $4 > $5
-
-# handle case of @localhost on address
-R<$+> $* < @localhost > $: < ? $&{client_name} > <$1> $2 < @localhost >
-R<$+> $* < @localhost.$m >
- $: < ? $&{client_name} > <$1> $2 < @localhost.$m >
-R<$+> $* < @localhost.UUCP >
- $: < ? $&{client_name} > <$1> $2 < @localhost.UUCP >
-R<? $=w> <$+> $* <?> <$2> $3
-R<? $+> <$+> $* $#error $@ 5.5.4 $: "553 Real domain name required"
-R<?> <$+> $* $: <$1> $2
-
-
-# handle case of no @domain on address
-R<?> $* $: < ? $&{client_name} > $1
-R<?> $* $@ <OK> ...local unqualed ok
-R<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required"
- ...remote is not
-# check results
-R<?> $* $@ <OK>
-R<OK> $* $@ <OK>
-R<TEMP> $* $#error $@ 4.1.8 $: "451 Sender domain must resolve"
-R<PERM> $* $#error $@ 5.1.8 $: "501 Sender domain must exist"
-
-######################################################################
-### check_rcpt -- check SMTP `RCPT TO:' command argument
-######################################################################
-
-SLocal_check_rcpt
-Scheck_rcpt
-R$* $: $1 $| $>"Local_check_rcpt" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_rcpt" $1
-
-SBasic_check_rcpt
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R$* $: $>ParseRecipient $1 strip relayable hosts
-
-
-
-
-# anything terminating locally is ok
-R$+ < @ $=w > $@ OK
-R$+ < @ $* $=R > $@ OK
-
-
-# check for local user (i.e. unqualified address)
-R$* $: <?> $1
-R<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 >
-# local user is ok
-R<?> $+ $@ OK
-R<$+> $* $: $2
-
-# anything originating locally is ok
-R$* $: <?> $&{client_name}
-# check if bracketed IP address (forward lookup != reverse lookup)
-R<?> [$+] $: <BAD> [$1]
-# pass to name server to make hostname canonical
-R<?> $* $~P $: <?> $[ $1 $2 $]
-R<$-> $* $: $2
-R$* . $1 strip trailing dots
-R$@ $@ OK
-R$=w $@ OK
-R$* $=R $@ OK
-
-# check IP address
-R$* $: $&{client_addr}
-R$@ $@ OK originated locally
-R0 $@ OK originated locally
-R$=R $* $@ OK relayable IP address
-R$* $: [ $1 ] put brackets around it...
-R$=w $@ OK ... and see if it is local
-
-
-# anything else is bogus
-R$* $#error $@ 5.7.1 $: "550 Relaying denied"
-
-#\f
-######################################################################
-######################################################################
-#####
-##### MAILER DEFINITIONS
-#####
-######################################################################
-######################################################################
-
-
-##################################################
-### Local and Program Mailer specification ###
-##################################################
-
-##### @(#)local.m4 8.30 (Berkeley) 6/30/1998 #####
-
-Mlocal, P=/bin/mail, F=lsDFMAw5:/|@qrmn9, S=10/30, R=20/40,
- T=DNS/RFC822/X-Unix,
- A=mail -d $u
-Mprog, P=/bin/sh, F=lsDFMoqeu9, S=10/30, R=20/40, D=$z:/,
- T=X-Unix,
- A=sh -c $u
-
-#
-# Envelope sender rewriting
-#
-S10
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>94 $1 do masquerading
-
-#
-# Envelope recipient rewriting
-#
-S20
-R$+ < @ $* > $: $1 strip host part
-
-#
-# Header sender rewriting
-#
-S30
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>93 $1 do masquerading
-
-#
-# Header recipient rewriting
-#
-S40
-R$+ $: $>50 $1 add local domain if needed
-
-#
-# Common code to add local domain name (only if always-add-domain)
-#
-S50
-
-#####################################
-### SMTP Mailer specification ###
-#####################################
-
-##### @(#)smtp.m4 8.38 (Berkeley) 5/19/1998 #####
-
-Msmtp, P=[IPC], F=mDFMuX, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mesmtp, P=[IPC], F=mDFMuXa, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Msmtp8, P=[IPC], F=mDFMuX8, S=11/31, R=21, E=\r\n, L=990,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-Mrelay, P=[IPC], F=mDFMuXa8, S=11/31, R=61, E=\r\n, L=2040,
- T=DNS/RFC822/SMTP,
- A=IPC $h
-
-#
-# envelope sender rewriting
-#
-S11
-R$+ $: $>51 $1 sender/recipient common
-R$* :; <@> $@ list:; special case
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>94 $1 do masquerading
-
-
-#
-# envelope recipient rewriting --
-# also header recipient if not masquerading recipients
-#
-S21
-R$+ $: $>51 $1 sender/recipient common
-R$+ $: $>61 $1 qualify unqual'ed names
-
-
-#
-# header sender and masquerading header recipient rewriting
-#
-S31
-R$+ $: $>51 $1 sender/recipient common
-R:; <@> $@ list:; special case
-
-# do special header rewriting
-R$* <@> $* $@ $1 <@> $2 pass null host through
-R< @ $* > $* $@ < @ $1 > $2 pass route-addr through
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>93 $1 do masquerading
-
-
-#
-# convert pseudo-domain addresses to real domain addresses
-#
-S51
-
-# pass <route-addr>s through
-R< @ $+ > $* $@ < @ $1 > $2 resolve <route-addr>
-
-# output fake domains as user%fake@relay
-
-# do UUCP heuristics; note that these are shared with UUCP mailers
-R$+ < @ $+ .UUCP. > $: < $2 ! > $1 convert to UUCP form
-R$+ < @ $* > $* $@ $1 < @ $2 > $3 not UUCP form
-
-# leave these in .UUCP form to avoid further tampering
-R< $&h ! > $- ! $+ $@ $2 < @ $1 .UUCP. >
-R< $&h ! > $-.$+ ! $+ $@ $3 < @ $1.$2 >
-R< $&h ! > $+ $@ $1 < @ $&h .UUCP. >
-R< $+ ! > $+ $: $1 ! $2 < @ $Y > use UUCP_RELAY
-R$+ < @ $+ : $+ > $@ $1 < @ $3 > strip mailer: part
-R$+ < @ > $: $1 < @ *LOCAL* > if no UUCP_RELAY
-
-
-#
-# common sender and masquerading recipient rewriting
-#
-S61
-
-R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
-R$+ $@ $1 < @ *LOCAL* > add local qualification
-
-
-#
-# relay mailer header masquerading recipient rewriting
-#
-S71
-
-R$+ $: $>61 $1
-R$+ $: $>93 $1
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a generic configuration file for Ultrix 4.x.
-# It has support for local and SMTP mail only. If you want to
-# customize it, copy it to a name appropriate for your environment
-# and do the modifications there.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)generic-ultrix4.mc 8.8 (Berkeley) 5/19/1998')
-OSTYPE(ultrix4)dnl
-DOMAIN(generic)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for a specific
-# machine in the Computer Science Division at Berkeley, and should
-# not be used elsewhere. It is provided on the sendmail distribution
-# as a sample only.
-#
-# This file is for the backup CS Division mail server.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)huginn.cs.mc 8.12 (Berkeley) 5/19/1998')
-OSTYPE(hpux9)dnl
-DOMAIN(CS.Berkeley.EDU)dnl
-MASQUERADE_AS(CS.Berkeley.EDU)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
-
-LOCAL_CONFIG
-DDBerkeley.EDU
-
-# hosts for which we accept and forward mail (must be in .Berkeley.EDU)
-CF CS
-FF/etc/sendmail.cw
-
-LOCAL_RULE_0
-R< @ $=F . $D . > : $* $@ $>7 $2 @here:... -> ...
-R$* $=O $* < @ $=F . $D . > $@ $>7 $1 $2 $3 ...@here -> ...
-
-R$* < @ $=F . $D . > $#local $: $1 use UDB
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is specific to Eric's home machine.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)knecht.mc 8.31 (Berkeley) 1/30/1999')
-OSTYPE(bsd4.4)dnl
-DOMAIN(generic)dnl
-define(`confFORWARD_PATH', `$z/.forward.$w:$z/.forward+$h:$z/.forward')dnl
-define(`confDEF_USER_ID', `mailnull')dnl
-define(`confHOST_STATUS_DIRECTORY', `.hoststat')dnl
-define(`confTO_ICONNECT', `10s')dnl
-define(`confCOPY_ERRORS_TO', `Postmaster')dnl
-define(`confTO_QUEUEWARN', `8h')dnl
-define(`confTRUSTED_USERS', `www')dnl
-define(`confPRIVACY_FLAGS', ``authwarnings,noexpn,novrfy'')dnl
-FEATURE(virtusertable, `hash /etc/mail/virtusertable')dnl
-FEATURE(access_db)dnl
-FEATURE(local_lmtp)dnl
-define(`LOCAL_MAILER_FLAGS', CONCAT(LOCAL_MAILER_FLAGS,P))dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
-
-LOCAL_CONFIG
-#
-# Regular expression to reject:
-# * numeric-only localparts from aol.com and msn.com
-# * localparts starting with a digit from juno.com
-# * localparts longer than 10 characters from aol.com
-#
-Kcheckaddress regex -a@MATCH
- ^([0-9]+<@(aol|msn)\.com|[0-9][^<]*<@juno\.com|.{10}[^<]+<@aol\.com)\.?>
-
-#
-# Names that won't be allowed in a To: line (local-part and domains)
-#
-C{RejectToLocalparts} friend you
-C{RejectToDomains} public.com
-
-LOCAL_RULESETS
-HTo: $>CheckTo
-
-SCheckTo
-R$={RejectToLocalparts}@$* $#error $: "553 Header error"
-R$*@$={RejectToDomains} $#error $: "553 Header error"
-
-HMessage-Id: $>CheckMessageId
-
-SCheckMessageId
-R< $+ @ $+ > $@ OK
-R$* $#error $: "553 Header error"
-
-LOCAL_RULESETS
-SLocal_check_mail
-# check address against various regex checks
-R$* $: $>Parse0 $>3 $1
-R$+ $: $(checkaddress $1 $)
-R@MATCH $#error $: "553 Header error"
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1997 Michael Shalayeff
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Michael Shalayeff.
-# 4. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 REGENTS 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.
-#
-
-include(`../m4/cf.m4')dnl
-VERSIONID(`$OpenBSD: lucifier.mc,v 1.4 1998/08/15 18:17:15 millert Exp $')dnl
-OSTYPE(openbsd)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
-MASQUERADE_AS(lucifier.dial-up.user.akula.net)dnl
-MASQUERADE_DOMAIN(lucifier.dial-up.user.akula.net)dnl
-FEATURE(allmasquerade)dnl
-
-define(`BITNET_RELAY', relay.uu.net)dnl
-
-define(`confAUTO_REBUILD', True)dnl
-define(`confCHECK_ALIASES', True)dnl
-
-define(`confMIN_FREE_BLOCKS', 1024)dnl
-define(`confSEPARATE_PROC', True)dnl
-define(`confBIND_OPTS', +AAONLY)dnl
-define(`confFORWARD_PATH', /var/forward/$u:$z/.forward.$w:$z/.forward)dnl
-define(`confUSE_ERRORS_TO', TRUE)dnl
-define(`confPRIVACY_FLAGS', `noexpn novrfy needmailhelo')
-
-define(`confDEF_CHAR_SET', `koi8-r')
-define(`confSEVEN_BIT_INPUT', False)
-define(`confEIGHT_BIT_HANDLING', `pass8')
-
-LOCAL_CONFIG
-O AliasFile=/home/majordomo/etc/aliases
-
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for a specific
-# machine in the Computer Science Division at Berkeley, and should
-# not be used elsewhere. It is provided on the sendmail distribution
-# as a sample only.
-#
-# This file is for the primary CS Division mail server.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)mail.cs.mc 8.15 (Berkeley) 5/19/1998')
-OSTYPE(ultrix4)dnl
-DOMAIN(Berkeley.EDU)dnl
-MASQUERADE_AS(CS.Berkeley.EDU)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
-define(`confUSERDB_SPEC', ``/usr/local/lib/users.cs.db,/usr/local/lib/users.eecs.db'')dnl
-
-LOCAL_CONFIG
-DDBerkeley.EDU
-
-# hosts for which we accept and forward mail (must be in .Berkeley.EDU)
-CF CS
-FF/etc/sendmail.cw
-
-LOCAL_RULE_0
-R< @ $=F . $D . > : $* $@ $>7 $2 @here:... -> ...
-R$* $=O $* < @ $=F . $D . > $@ $>7 $1 $2 $3 ...@here -> ...
-
-R$* < @ $=F . $D . > $#local $: $1 use UDB
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for a specific
-# machine in Electrical Engineering and Computer Sciences at Berkeley,
-# and should not be used elsewhere. It is provided on the sendmail
-# distribution as a sample only.
-#
-# This file is for the primary EECS mail server.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)mail.eecs.mc 8.15 (Berkeley) 5/19/1998')
-OSTYPE(ultrix4)dnl
-DOMAIN(EECS.Berkeley.EDU)dnl
-MASQUERADE_AS(EECS.Berkeley.EDU)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
-define(`confUSERDB_SPEC', `/usr/local/lib/users.eecs.db,/usr/local/lib/users.cs.db,/usr/local/lib/users.coe.db')dnl
-
-LOCAL_CONFIG
-DDBerkeley.EDU
-
-# hosts for which we accept and forward mail (must be in .Berkeley.EDU)
-CF EECS
-FF/etc/sendmail.cw
-
-LOCAL_RULE_0
-R< @ $=F . $D . > : $* $@ $>7 $2 @here:... -> ...
-R$* $=O $* < @ $=F . $D . > $@ $>7 $1 $2 $3 ...@here -> ...
-
-R$* < @ $=F . $D . > $#local $: $1 use UDB
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for a specific
-# machine in the Computer Science Division at Berkeley, and should
-# not be used elsewhere. It is provided on the sendmail distribution
-# as a sample only.
-#
-# This file is for our mail spool machine. For a while we were using
-# "root.machinename" instead of "root+machinename", so this is included
-# for back compatibility.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)mailspool.cs.mc 8.9 (Berkeley) 5/19/1998')
-OSTYPE(sunos4.1)dnl
-DOMAIN(CS.Berkeley.EDU)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
-
-LOCAL_CONFIG
-CDroot sys-custodian
-
-LOCAL_RULE_3
-R$=D . $+ $1 + $2
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1993, 1994, 1995 Adam Glass
-# Copyright (c) 1983 Eric P. Allman
-# Copyright (c) 1988 The Regents of the University of California.
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by the University of
-# California, Berkeley and its contributors.
-# 4. Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-#
-
-include(`../m4/cf.m4')
-VERSIONID(`$OpenBSD: nettan.mc,v 1.2 1996/05/10 16:58:46 niklas Exp $')
-OSTYPE(bsd4.4)dnl
-FEATURE(nullclient,mail.appli.se)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is the prototype file for a configuration that supports nothing
-# but basic SMTP connections via TCP.
-#
-
-divert(0)dnl
-include(`../m4/cf.m4')
-VERSIONID(`@(#)openbsd-proto.mc $Revision: 1.3 $')
-OSTYPE(openbsd)
-FEATURE(nouucp)
-MAILER(local)
-MAILER(smtp)
-dnl
-dnl Enforce valid Message-Id to help stop spammers
-dnl
-LOCAL_RULESETS
-HMessage-Id: $>CheckMessageId
-
-SCheckMessageId
-R< $+ @ $+ > $@ OK
-R$* $#error $: 553 Header Error
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for a specific
-# machine in the Computer Science Division at Berkeley, and should
-# not be used elsewhere. It is provided on the sendmail distribution
-# as a sample only.
-#
-# This file is for a home machine that wants to masquerade as an
-# on-campus machine. Additionally, all addresses without a hostname
-# will be forwarded to that machine.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)python.cs.mc 8.9 (Berkeley) 5/19/1998')
-OSTYPE(bsd4.4)dnl
-DOMAIN(CS.Berkeley.EDU)dnl
-define(`LOCAL_RELAY', vangogh.CS.Berkeley.EDU)dnl
-MASQUERADE_AS(vangogh.CS.Berkeley.EDU)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
-
-# accept mail sent to the domain head
-DDBostic.COM
-
-LOCAL_RULE_0
-# accept mail sent to the domain head
-R< @ $D . > : $* $@ $>7 $1 @here:... -> ...
-R$* $=O $* < @ $D . > $@ $>7 $1 $2 $3 ...@here -> ...
-R$* < @ $D . > $#local $: $1 user@here -> user
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for OSF/1.
-# It applies only to the Sequoia 2000 Project at Berkeley,
-# and should not be used elsewhere. It is provided on the sendmail
-# distribution as a sample only. To create your own configuration
-# file, create an appropriate domain file in ../domain, change the
-# `DOMAIN' macro below to reference that file, and copy the result
-# to a name of your own choosing.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)s2k-osf1.mc 8.10 (Berkeley) 5/19/1998')
-OSTYPE(osf1)dnl
-DOMAIN(S2K.Berkeley.EDU)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for Ultrix 4.x.
-# It applies only to the Sequoia 2000 Project at Berkeley,
-# and should not be used elsewhere. It is provided on the sendmail
-# distribution as a sample only. To create your own configuration
-# file, create an appropriate domain file in ../domain, change the
-# `DOMAIN' macro below to reference that file, and copy the result
-# to a name of your own choosing.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)s2k-ultrix4.mc 8.10 (Berkeley) 5/19/1998')
-OSTYPE(ultrix4)dnl
-DOMAIN(S2K.Berkeley.EDU)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1996 SigmaSoft, Th. Lockert
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by SigmaSoft, Th. Lockert
-# 4. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-#
-
-include(`../m4/cf.m4')dnl
-VERSIONID(`$OpenBSD: saruman.mc,v 1.2 1998/08/15 18:17:18 millert Exp $')dnl
-OSTYPE(openbsd)dnl
-FEATURE(nullclient, gandalf.$m)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is the prototype file for a configuration that supports nothing
-# but basic SMTP connections via TCP.
-#
-# You MUST change the `OSTYPE' macro to specify the operating system
-# on which this will run; this will set the location of various
-# support files for your operating system environment. You MAY
-# create a domain file in ../domain and reference it by adding a
-# `DOMAIN' macro after the `OSTYPE' macro. I recommend that you
-# first copy this to another file name so that new sendmail releases
-# will not trash your changes.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)tcpproto.mc 8.10 (Berkeley) 5/19/1998')
-OSTYPE(unknown)
-FEATURE(nouucp)
-MAILER(local)
-MAILER(smtp)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1983 Eric P. Allman
-# Copyright (c) 1988 The Regents of the University of California.
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by the University of
-# California, Berkeley and its contributors.
-# 4. Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-#
-
-include(`../m4/cf.m4')
-VERSIONID(`$Id: trinity.mc,v 1.2 1996/01/29 01:41:06 dm Exp $')
-OSTYPE(bsd4.4)dnl
-define(`UUCP_RELAY', life.ai.mit.edu)dnl
-define(`BITNET_RELAY', mitvma.mit.edu)dnl
-define(`LOCAL_RELAY', albert.gnu.ai.mit.edu)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
-define(`confCHECKPOINT_INTERVAL', 4)dnl
-define(`confAUTO_REBUILD', True)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This machine has been decommissioned at Berkeley, and hence should
-# not be considered to be tested. This file is provided as an example
-# only, of how you might set up a joint SMTP/UUCP configuration. At
-# this point I recommend using `FEATURE(mailertable)' instead of
-# `SITECONFIG'. See also ucbvax.mc.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)ucbarpa.mc 8.9 (Berkeley) 5/19/1998')
-DOMAIN(CS.Berkeley.EDU)dnl
-OSTYPE(bsd4.4)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
-MAILER(uucp)dnl
-SITECONFIG(uucp.ucbarpa, ucbarpa, U)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This machine has been decommissioned at Berkeley, and hence should
-# not be considered to be tested. This file is provided as an example
-# only, of how you might set up a fairly complex configuration.
-# Ucbvax was our main relay (both SMTP and UUCP) for many years.
-# At this point I recommend using `FEATURE(mailertable)' instead of
-# `SITECONFIG' for routing of UUCP within your domain.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)ucbvax.mc 8.11 (Berkeley) 5/19/1998')
-OSTYPE(bsd4.3)
-DOMAIN(CS.Berkeley.EDU)
-MASQUERADE_AS(CS.Berkeley.EDU)
-MAILER(local)
-MAILER(smtp)
-MAILER(uucp)
-undefine(`UUCP_RELAY')dnl
-
-LOCAL_CONFIG
-DDBerkeley.EDU
-
-# names for which we act as a local forwarding agent
-CF CS
-FF/etc/sendmail.cw
-
-# local UUCP connections, and our local uucp name
-SITECONFIG(uucp.ucbvax, ucbvax, U)
-
-# remote UUCP connections, and the machine they are on
-SITECONFIG(uucp.ucbarpa, ucbarpa.Berkeley.EDU, W)
-
-SITECONFIG(uucp.cogsci, cogsci.Berkeley.EDU, X)
-
-LOCAL_RULE_3
-# map old UUCP names into Internet names
-UUCPSMTP(bellcore, bellcore.com)
-UUCPSMTP(decvax, decvax.dec.com)
-UUCPSMTP(decwrl, decwrl.dec.com)
-UUCPSMTP(hplabs, hplabs.hp.com)
-UUCPSMTP(lbl-csam, lbl-csam.arpa)
-UUCPSMTP(pur-ee, ecn.purdue.edu)
-UUCPSMTP(purdue, purdue.edu)
-UUCPSMTP(research, research.att.com)
-UUCPSMTP(sdcarl, sdcarl.ucsd.edu)
-UUCPSMTP(sdcsvax, sdcsvax.ucsd.edu)
-UUCPSMTP(ssyx, ssyx.ucsc.edu)
-UUCPSMTP(sun, sun.com)
-UUCPSMTP(ucdavis, ucdavis.ucdavis.edu)
-UUCPSMTP(ucivax, ics.uci.edu)
-UUCPSMTP(ucla-cs, cs.ucla.edu)
-UUCPSMTP(ucla-se, seas.ucla.edu)
-UUCPSMTP(ucsbcsl, ucsbcsl.ucsb.edu)
-UUCPSMTP(ucscc, c.ucsc.edu)
-UUCPSMTP(ucsd, ucsd.edu)
-UUCPSMTP(ucsfcgl, cgl.ucsf.edu)
-UUCPSMTP(unmvax, unmvax.cs.unm.edu)
-UUCPSMTP(uwvax, spool.cs.wisc.edu)
-
-LOCAL_RULE_0
-
-# make sure we handle the local domain as absolute
-R$* < @ $* $D > $* $: $1 < @ $2 $D . > $3
-
-# handle names we forward for as though they were local, so we will use UDB
-R< @ $=F . $D . > : $* $@ $>7 $2 @here:... -> ...
-R< @ $D . > : $* $@ $>7 $1 @here:... -> ...
-R$* $=O $* < @ $=F . $D . > $@ $>7 $1 $2 $3 ...@here -> ...
-R$* $=O $* < @ $D . > $@ $>7 $1 $2 $3 ...@here -> ...
-
-R$* < @ $=F . $D . > $#local $: $1 use UDB
-
-# handle local UUCP connections in the Berkeley.EDU domain
-R$+<@cnmat.$D . > $#uucp$@cnmat$:$1
-R$+<@cnmat.CS.$D . > $#uucp$@cnmat$:$1
-R$+<@craig.$D . > $#uucp$@craig$:$1
-R$+<@craig.CS.$D . > $#uucp$@craig$:$1
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is the prototype for a configuration that only supports UUCP
-# and does not have DNS support at all.
-#
-# You MUST change the `OSTYPE' macro to specify the operating system
-# on which this will run; this will set the location of various
-# support files for your operating system environment. You MAY
-# create a domain file in ../domain and reference it by adding a
-# `DOMAIN' macro after the `OSTYPE' macro. I recommend that you
-# first copy this to another file name so that new sendmail releases
-# will not trash your changes.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)uucpproto.mc 8.12 (Berkeley) 5/19/1998')
-OSTYPE(unknown)
-FEATURE(promiscuous_relay)dnl
-FEATURE(accept_unresolvable_domains)dnl
-MAILER(local)dnl
-MAILER(uucp)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This is a Berkeley-specific configuration file for a specific
-# machine in the Computer Science Division at Berkeley, and should
-# not be used elsewhere. It is provided on the sendmail distribution
-# as a sample only.
-#
-# This file is for the BSD development machine; it has some parameters
-# set up (to stress sendmail) and accepts mail for some other machines.
-#
-
-divert(0)dnl
-VERSIONID(`@(#)vangogh.cs.mc 8.10 (Berkeley) 5/19/1998')
-DOMAIN(CS.Berkeley.EDU)dnl
-OSTYPE(bsd4.4)dnl
-MAILER(local)dnl
-MAILER(smtp)dnl
-define(`MCI_CACHE_SIZE', 5)
-Cw okeeffe.CS.Berkeley.EDU
-Cw python.CS.Berkeley.EDU
+++ /dev/null
-divert(-1)
-# $OpenBSD: waldorf.mc,v 1.6 1998/08/15 18:17:19 millert Exp $
-#
-# Copyright (c) 1996 Niklas Hallqvist
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Niklas Hallqvist.
-# 4. Neither the name of the University nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
-#
-
-include(`../m4/cf.m4')
-VERSIONID(`$OpenBSD: waldorf.mc,v 1.6 1998/08/15 18:17:19 millert Exp $')
-OSTYPE(openbsd)dnl
-
-MASQUERADE_AS(appli.se)
-MASQUERADE_DOMAIN(appli.se)
-
-FEATURE(local_procmail)dnl
-
-MAILER(local)dnl
-MAILER(smtp)dnl
-
-FEATURE(limited_masquerade)dnl
-FEATURE(always_add_domain)dnl
-FEATURE(virtusertable)dnl
-FEATURE(use_cw_file)dnl
-
-define(`confAUTO_REBUILD', True)dnl
-
-LOCAL_RULE_0
-# We take care of all mail directed to either appli.se or *.appli.se
-R$+<@$*$m.> $#local $:$1
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-divert(0)
-VERSIONID(`@(#)Berkeley.EDU.m4 8.14 (Berkeley) 5/19/1998')
-DOMAIN(berkeley-only)dnl
-define(`BITNET_RELAY', `bitnet-relay.Berkeley.EDU')dnl
-define(`UUCP_RELAY', `uucp-relay.Berkeley.EDU')dnl
-define(`confFORWARD_PATH', `$z/.forward.$w:$z/.forward')dnl
-define(`confCW_FILE', `-o /etc/sendmail.cw')dnl
-define(`confDONT_INIT_GROUPS', True)dnl
-FEATURE(redirect)dnl
-FEATURE(use_cw_file)dnl
-FEATURE(stickyhost)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-divert(0)
-VERSIONID(`@(#)CS.Berkeley.EDU.m4 8.7 (Berkeley) 5/19/1998')
-DOMAIN(Berkeley.EDU)dnl
-HACK(cssubdomain)dnl
-define(`confUSERDB_SPEC',
- `/usr/sww/share/lib/users.cs.db,/usr/sww/share/lib/users.eecs.db')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-divert(0)
-VERSIONID(`@(#)EECS.Berkeley.EDU.m4 8.7 (Berkeley) 5/19/1998')
-DOMAIN(Berkeley.EDU)dnl
-MASQUERADE_AS(EECS.Berkeley.EDU)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-divert(0)
-VERSIONID(`@(#)S2K.Berkeley.EDU.m4 8.7 (Berkeley) 5/19/1998')
-DOMAIN(CS.Berkeley.EDU)dnl
-MASQUERADE_AS(postgres.Berkeley.EDU)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-divert(0)
-VERSIONID(`@(#)unspecified-domain.m4 8.7 (Berkeley) 5/19/1998')
-errprint(`*** ERROR: You are trying to use the Berkeley sample configuration')
-errprint(` files outside of the Computer Science Division at Berkeley.')
-errprint(` The configuration (.mc) files must be customized to reference')
-errprint(` domain files appropriate for your environment.')
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# The following is a generic domain file. You should be able to
-# use it anywhere. If you want to customize it, copy it to a file
-# named with your domain and make the edits; then, copy the appropriate
-# .mc files and change `DOMAIN(generic)' to reference your updated domain
-# files.
-#
-divert(0)
-VERSIONID(`@(#)generic.m4 8.9 (Berkeley) 5/19/1998')
-define(`confFORWARD_PATH', `$z/.forward.$w+$h:$z/.forward+$h:$z/.forward.$w:$z/.forward')dnl
-FEATURE(redirect)dnl
-FEATURE(use_cw_file)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1996 SigmaSoft, Th. Lockert
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by SigmaSoft, Th. Lockert
-# 4. The name of the author may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
-#
-divert(0)
-VERSIONID(`$OpenBSD: sigmasoft.m4,v 1.2 1998/08/02 06:50:23 tholo Exp $')dnl
-define(`UUCP_RELAY', relay1.uu.net)dnl
-define(`BITNET_RELAY', relay2.uu.net)dnl
-define(`confME_TOO', True)dnl
-FEATURE(rbl)dnl
-FEATURE(redirect)dnl
-FEATURE(relay_based_on_MX)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)accept_unqualified_senders.m4 8.3 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_ACCEPT_UNQUALIFIED_SENDERS_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)accept_unresolvable_domains.m4 8.7 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_ACCEPT_UNRESOLVABLE_DOMAINS_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)access_db.m4 8.8 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`ACCESS_TABLE',
- ifelse(_ARG_, `',
- DATABASE_MAP_TYPE` -o /etc/mail/access',
- `_ARG_'))dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)allmasquerade.m4 8.7 (Berkeley) 5/19/1998')
-divert(-1)
-
-
-define(`_ALL_MASQUERADE_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)always_add_domain.m4 8.6 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_ALWAYS_ADD_DOMAIN_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)bestmx_is_local.m4 8.14 (Berkeley) 1/25/1999')
-divert(-1)
-
-define(_BESTMX_IS_LOCAL_, _ARG_)
-
-LOCAL_CONFIG
-# turn on bestMX lookup table
-Kbestmx bestmx
-ifelse(_ARG_, `', `dnl',`
-# limit bestmx to these domains
-CB`'_ARG_')
-
-LOCAL_NET_CONFIG
-
-# If we are the best MX for a site, then we want to accept
-# its mail as local. We assume we've already weeded out mail to
-# UUCP sites which are connected to us, which should also have
-# listed us as their best MX.
-#
-# Warning: this may generate a lot of extra DNS traffic -- a
-# lower cost method is to list all the expected best MX hosts
-# in $=w. This should be fine (and easier to administer) for
-# low to medium traffic hosts. If you use the limited bestmx
-# by passing in a set of possible domains it will improve things.
-
-ifelse(_ARG_, `', `dnl
-# unlimited bestmx
-R$* < @ $* > $* $: $1 < @ $2 @@ $(bestmx $2 $) > $3',
-`dnl
-# limit bestmx to $=B
-R$* < @ $* $=B . > $* $: $1 < @ $2 $3 . @@ $(bestmx $2 $3 . $) > $4')
-R$* $=O $* < @ $* @@ $=w . > $* $@ $>97 $1 $2 $3
-R< @ $* @@ $=w . > : $* $@ $>97 $3
-R$* < @ $* @@ $=w . > $* $#local $: $1
-R$* < @ $* @@ $* > $* $: $1 < @ $2 > $4
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)bitdomain.m4 8.14 (Berkeley) 10/6/1998')
-divert(-1)
-
-define(`BITDOMAIN_TABLE', ifelse(_ARG_, `',
- ifdef(`_USE_ETC_MAIL_',
- DATABASE_MAP_TYPE` -o /etc/mail/bitdomain',
- DATABASE_MAP_TYPE` -o /etc/bitdomain'),
- `_ARG_'))dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)blacklist_recipients.m4 8.9 (Berkeley) 5/19/1998')
-divert(-1)
-
-ifdef(`ACCESS_TABLE',
- `define(`_BLACKLIST_RCPT_', 1)',
- `errprint(`*** ERROR: FEATURE(blacklist_recipients) requires FEATURE(access_db)
-')')
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)domaintable.m4 8.9 (Berkeley) 10/6/1998')
-divert(-1)
-
-define(`DOMAIN_TABLE', ifelse(_ARG_, `',
- ifdef(`_USE_ETC_MAIL_',
- DATABASE_MAP_TYPE` -o /etc/mail/domaintable',
- DATABASE_MAP_TYPE` -o /etc/domaintable'),
- `_ARG_'))dnl
-
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)genericstable.m4 8.8 (Berkeley) 10/6/1998')
-divert(-1)
-
-define(`GENERICS_TABLE', ifelse(_ARG_, `',
- ifdef(`_USE_ETC_MAIL_',
- DATABASE_MAP_TYPE` -o /etc/mail/genericstable',
- DATABASE_MAP_TYPE` -o /etc/genericstable'),
- `_ARG_'))dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)limited_masquerade.m4 8.6 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_LIMITED_MASQUERADE_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)local_lmtp.m4 8.5 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`LOCAL_MAILER_PATH',
- ifelse(_ARG_, `',
- ifdef(`confEBINDIR', confEBINDIR, `/usr/libexec')`/mail.local',
- _ARG_))
-define(`LOCAL_MAILER_FLAGS', `SXfmnz9')
-define(`LOCAL_MAILER_ARGS', `mail.local -l')
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1994 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)local_procmail.m4 8.11 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`LOCAL_MAILER_PATH',
- ifelse(_ARG_, `',
- ifdef(`PROCMAIL_MAILER_PATH',
- PROCMAIL_MAILER_PATH,
- `/usr/local/bin/procmail'),
- _ARG_))
-define(`LOCAL_MAILER_FLAGS', `SPfhn9')
-define(`LOCAL_MAILER_ARGS', `procmail -Y -a $h -d $u')
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)loose_relay_check.m4 8.3 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_LOOSE_RELAY_CHECK_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)mailertable.m4 8.10 (Berkeley) 10/6/1998')
-divert(-1)
-
-define(`MAILER_TABLE', ifelse(_ARG_, `',
- ifdef(`_USE_ETC_MAIL_',
- DATABASE_MAP_TYPE` -o /etc/mail/mailertable',
- DATABASE_MAP_TYPE` -o /etc/mailertable'),
- `_ARG_'))dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)masquerade_entire_domain.m4 8.6 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_MASQUERADE_ENTIRE_DOMAIN_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)masquerade_envelope.m4 8.6 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_MASQUERADE_ENVELOPE_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)nocanonify.m4 8.6 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_NO_CANONIFY_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)nodns.m4 8.9 (Berkeley) 10/6/1998')
-divert(-1)
-
-undefine(`confBIND_OPTS')dnl
-errprint(`FEATURE(nodns) is no-op.
-Use ServiceSwitchFile ('ifdef(`confSERVICE_SWITCH_FILE',confSERVICE_SWITCH_FILE,ifdef(`_USE_ETC_MAIL_',`/etc/mail/service.switch',`/etc/service.switch'))`) if your OS does not provide its own instead.
-')
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)notsticky.m4 8.8 (Berkeley) 5/19/1998')
-#
-# This is now the default. Use ``FEATURE(stickyhost)'' if you want
-# the old default behaviour.
-#
-divert(-1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)nouucp.m4 8.6 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_NO_UUCP_', 1)
+++ /dev/null
-PUSHDIVERT(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-ifdef(`SMTP_MAILER_FLAGS',, `define(`SMTP_MAILER_FLAGS', `')')
-define(_NULL_CLIENT_ONLY_, `1')
-ifelse(_ARG_, `', `errprint(`Feature "nullclient" requires argument')',
- `define(`MAIL_HUB', _ARG_)')
-POPDIVERT
-
-#
-# This is used only for relaying mail from a client to a hub when
-# that client does absolutely nothing else -- i.e., it is a "null
-# mailer". In this sense, it acts like the "R" option in Sun
-# sendmail.
-#
-
-VERSIONID(`@(#)nullclient.m4 8.12 (Berkeley) 5/19/1998')
-
-PUSHDIVERT(6)
-# hub host (to which all mail is sent)
-DH`'ifdef(`MAIL_HUB', MAIL_HUB,
- `errprint(`MAIL_HUB not defined for nullclient feature')')
-ifdef(`MASQUERADE_NAME',, `define(`MASQUERADE_NAME', MAIL_HUB)')dnl
-
-# route-addr separators
-C: : ,
-POPDIVERT
-PUSHDIVERT(7)
-############################################
-### Null Client Mailer specification ###
-############################################
-
-ifdef(`confRELAY_MAILER',,
- `define(`confRELAY_MAILER', `nullclient')')dnl
-ifdef(`confFROM_HEADER',,
- `define(`confFROM_HEADER', <$g>)')dnl
-ifdef(`SMTP_MAILER_ARGS',, `define(`SMTP_MAILER_ARGS', `IPC $h')')dnl
-
-Mnullclient, P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS),ifdef(`SMTP_MAILER_MAX', ` M=SMTP_MAILER_MAX,')
- A=SMTP_MAILER_ARGS
-POPDIVERT
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)promiscuous_relay.m4 8.7 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_PROMISCUOUS_RELAY_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)rbl.m4 8.8 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_RBL_', ifelse(_ARG_, `', `rbl.maps.vix.com', `_ARG_'))dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)redirect.m4 8.10 (Berkeley) 5/19/1998')
-divert(-1)
-
-
-PUSHDIVERT(3)
-# addresses sent to foo@host.REDIRECT will give a 551 error code
-R$* < @ $+ .REDIRECT. > $: $1 < @ $2 . REDIRECT . > < ${opMode} >
-R$* < @ $+ .REDIRECT. > <i> $: $1 < @ $2 . REDIRECT. >
-R$* < @ $+ .REDIRECT. > < $- > $# error $@ 5.1.1 $: "551 User has moved; please try " <$1@$2>
-POPDIVERT
-
-PUSHDIVERT(6)
-CPREDIRECT
-POPDIVERT
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)relay_based_on_MX.m4 8.7 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_RELAY_MX_SERVED_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)relay_entire_domain.m4 8.7 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_RELAY_ENTIRE_DOMAIN_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)relay_hosts_only.m4 8.7 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_RELAY_HOSTS_ONLY_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)relay_local_from.m4 8.2 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_RELAY_LOCAL_FROM_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)smrsh.m4 8.8 (Berkeley) 5/19/1998')
-divert(-1)
-
-ifdef(`_MAILER_local_',
- `errprint(`*** FEATURE(smrsh) must occur before MAILER(local)')')dnl
-define(`LOCAL_SHELL_PATH',
- ifelse(_ARG_, `',
- ifdef(`confEBINDIR', confEBINDIR, `/usr/libexec')`/smrsh',
- _ARG_))
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)stickyhost.m4 8.6 (Berkeley) 5/19/1998')
-divert(-1)
-
-define(`_STICKY_LOCAL_DOMAIN_', 1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)use_ct_file.m4 8.6 (Berkeley) 5/19/1998')
-divert(-1)
-
-# if defined, the sendmail.cf will read the /etc/sendmail.ct file
-# to find the names of trusted users. There should only be a few
-# of these, and normally this is done directly in the .cf file.
-
-define(`_USE_CT_FILE_', `')
-
-divert(0)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)use_cw_file.m4 8.6 (Berkeley) 5/19/1998')
-divert(-1)
-
-# if defined, the sendmail.cf will read the /etc/sendmail.cw file
-# to find alternate names for this host. Typically only used when
-# several hosts have been squashed into one another at high speed.
-
-define(`USE_CW_FILE', `')
-
-divert(0)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)uucpdomain.m4 8.14 (Berkeley) 10/6/1998')
-divert(-1)
-
-define(`UUDOMAIN_TABLE', ifelse(_ARG_, `',
- ifdef(`_USE_ETC_MAIL_',
- DATABASE_MAP_TYPE` -o /etc/mail/uudomain',
- DATABASE_MAP_TYPE` -o /etc/uudomain'),
- `_ARG_'))dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)virtusertable.m4 8.8 (Berkeley) 10/6/1998')
-divert(-1)
-
-define(`VIRTUSER_TABLE', ifelse(_ARG_, `',
- ifdef(`_USE_ETC_MAIL_',
- DATABASE_MAP_TYPE` -o /etc/mail/virtusertable',
- DATABASE_MAP_TYPE` -o /etc/virtusertable'),
- `_ARG_'))dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-divert(0)
-VERSIONID(`@(#)cssubdomain.m4 8.6 (Berkeley) 5/19/1998')
-
-divert(2)
-# find possible (old & new) versions of our name via short circuit hack
-# (this code should exist ONLY during the transition from .Berkeley.EDU
-# names to .CS.Berkeley.EDU names -- probably not more than a few months)
-R$* < @ $=w .CS.Berkeley.EDU > $* $: $1 < @ $j > $3
-R$* < @ $=w .Berkeley.EDU> $* $: $1 < @ $j > $3
-divert(0)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-#
-# This file is included so that multiple includes of cf.m4 will work
-#
-
-# figure out where the CF files live
-ifdef(`_CF_DIR_', `',
- `ifelse(__file__, `__file__',
- `define(`_CF_DIR_', `../')',
- `define(`_CF_DIR_',
- substr(__file__, 0, eval(len(__file__) - 8)))')')
-
-divert(0)dnl
-ifdef(`OSTYPE', `dnl',
-`include(_CF_DIR_`'m4/cfhead.m4)dnl
-VERSIONID(`@(#)cf.m4 8.29 (Berkeley) 5/19/1998')')
+++ /dev/null
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-######################################################################
-######################################################################
-#####
-##### SENDMAIL CONFIGURATION FILE
-#####
-define(`TEMPFILE', maketemp(/tmp/cfXXXXXX))dnl
-syscmd(sh _CF_DIR_`'sh/makeinfo.sh _CF_DIR_ > TEMPFILE)dnl
-include(TEMPFILE)dnl
-syscmd(rm -f TEMPFILE)dnl
-#####
-######################################################################
-######################################################################
-
-divert(-1)
-
-changecom(\ 1)
-undefine(`format')
-undefine(`hpux')
-ifdef(`pushdef', `',
- `errprint(`You need a newer version of M4, at least as new as
-System V or GNU')
- include(NoSuchFile)')
-define(`PUSHDIVERT', `pushdef(`__D__', divnum)divert($1)')
-define(`POPDIVERT', `divert(__D__)popdef(`__D__')')
-define(`OSTYPE',
- `PUSHDIVERT(-1)
- ifdef(`__OSTYPE__', `errprint(`duplicate OSTYPE'($1))')
- define(`__OSTYPE__', $1)
- define(`_ARG_', $2)
- include(_CF_DIR_`'ostype/$1.m4)POPDIVERT`'')
-define(`MAILER',
-`ifdef(`_MAILER_$1_', `dnl`'',
-`define(`_MAILER_$1_', `')PUSHDIVERT(7)include(_CF_DIR_`'mailer/$1.m4)POPDIVERT`'')')
-define(`DOMAIN', `PUSHDIVERT(-1)define(`_ARG_', $2)include(_CF_DIR_`'domain/$1.m4)POPDIVERT`'')
-define(`FEATURE', `PUSHDIVERT(-1)define(`_ARG_', $2)include(_CF_DIR_`'feature/$1.m4)POPDIVERT`'')
-define(`HACK', `PUSHDIVERT(-1)define(`_ARG_', $2)include(_CF_DIR_`'hack/$1.m4)POPDIVERT`'')
-define(`VERSIONID', ``##### $1 #####'')
-define(`LOCAL_RULE_0', `divert(3)')
-define(`LOCAL_RULE_1',
-`divert(9)dnl
-#######################################
-### Ruleset 1 -- Sender Rewriting ###
-#######################################
-
-S1
-')
-define(`LOCAL_RULE_2',
-`divert(9)dnl
-##########################################
-### Ruleset 2 -- Recipient Rewriting ###
-##########################################
-
-S2
-')
-define(`LOCAL_RULESETS',
-`divert(9)
-
-')
-define(`LOCAL_RULE_3', `divert(2)')
-define(`LOCAL_CONFIG', `divert(6)')
-define(`MAILER_DEFINITIONS', `divert(7)')
-define(`LOCAL_NET_CONFIG', `define(`_LOCAL_RULES_', 1)divert(1)')
-define(`UUCPSMTP', `R DOL(*) < @ $1 .UUCP > DOL(*) DOL(1) < @ $2 > DOL(2)')
-define(`CONCAT', `$1$2$3$4$5$6$7')
-define(`DOL', ``$'$1')
-define(`SITECONFIG',
-`CONCAT(D, $3, $2)
-define(`_CLASS_$3_', `')dnl
-ifelse($3, U, Cw$2 $2.UUCP, `dnl')
-define(`SITE', `ifelse(CONCAT($'2`, $3), SU,
- CONCAT(CY, $'1`),
- CONCAT(C, $3, $'1`))')
-sinclude(_CF_DIR_`'siteconfig/$1.m4)')
-define(`EXPOSED_USER', `PUSHDIVERT(5)CE$1
-POPDIVERT`'dnl`'')
-define(`LOCAL_USER', `PUSHDIVERT(5)CL$1
-POPDIVERT`'dnl`'')
-define(`MASQUERADE_AS', `define(`MASQUERADE_NAME', $1)')
-define(`MASQUERADE_DOMAIN', `PUSHDIVERT(5)CM$1
-POPDIVERT`'dnl`'')
-define(`MASQUERADE_DOMAIN_FILE', `PUSHDIVERT(5)FM$1
-POPDIVERT`'dnl`'')
-define(`GENERICS_DOMAIN', `PUSHDIVERT(5)CG$1
-POPDIVERT`'dnl`'')
-define(`GENERICS_DOMAIN_FILE', `PUSHDIVERT(5)FG$1
-POPDIVERT`'dnl`'')
-define(`RELAY_DOMAIN', `PUSHDIVERT(5)CR$1
-POPDIVERT`'dnl`'')
-define(`RELAY_DOMAIN_FILE', `PUSHDIVERT(5)FR$1
-POPDIVERT`'dnl`'')
-define(`_OPTINS', `ifdef(`$1', `$2$1$3')')
-
-m4wrap(`include(_CF_DIR_`m4/proto.m4')')
-
-# set up default values for options
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/etc/aliases'))
-define(`confMAILER_NAME', ``MAILER-DAEMON'')
-define(`confFROM_LINE', `From $g $d')
-define(`confOPERATORS', `.:%@!^/[]+')
-define(`confSMTP_LOGIN_MSG', `$j Sendmail $v/$Z; $b')
-define(`confRECEIVED_HEADER', `$?sfrom $s $.$?_($?s$|from $.$_)
- $.by $j ($v/$Z)$?r with $r$. id $i$?u
- for $u; $|;
- $.$b')
-define(`confSEVEN_BIT_INPUT', `False')
-define(`confEIGHT_BIT_HANDLING', `pass8')
-define(`confALIAS_WAIT', `10')
-define(`confMIN_FREE_BLOCKS', `100')
-define(`confBLANK_SUB', `.')
-define(`confCON_EXPENSIVE', `False')
-define(`confDELIVERY_MODE', `background')
-define(`confTEMP_FILE_MODE', `0600')
-define(`confMCI_CACHE_SIZE', `2')
-define(`confMCI_CACHE_TIMEOUT', `5m')
-define(`confUSE_ERRORS_TO', `False')
-define(`confLOG_LEVEL', `9')
-define(`confCHECK_ALIASES', `False')
-define(`confOLD_STYLE_HEADERS', `True')
-define(`confPRIVACY_FLAGS', `authwarnings')
-define(`confSAFE_QUEUE', `True')
-define(`confTO_QUEUERETURN', `5d')
-define(`confTO_QUEUEWARN', `4h')
-define(`confTIME_ZONE', `USE_SYSTEM')
-define(`confCW_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/local-host-names', `/etc/sendmail.cw'))
-define(`confMIME_FORMAT_ERRORS', `True')
-define(`confFORWARD_PATH', `$z/.forward.$w:$z/.forward')
-define(`confCR_FILE', `-o /etc/mail/relay-domains')
-
-divert(0)dnl
-VERSIONID(`@(#)cfhead.m4 8.23 (Berkeley) 10/6/1998')
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-divert(0)
-
-VERSIONID(`@(#)nullrelay.m4 8.19 (Berkeley) 5/19/1998')
-
-#
-# This configuration applies only to relay-only hosts. They send
-# all mail to a hub without consideration of the address syntax
-# or semantics, except for adding the hub qualification to the
-# addresses.
-#
-# This is based on a prototype done by Bryan Costales of ICSI.
-#
-
-######################################################################
-######################################################################
-#####
-##### REWRITING RULES
-#####
-######################################################################
-######################################################################
-
-###########################################
-### Rulset 3 -- Name Canonicalization ###
-###########################################
-S3
-
-# handle null input
-R$@ $@ <@>
-
-# strip group: syntax (not inside angle brackets!) and trailing semicolon
-R$* $: $1 <@> mark addresses
-R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
-R$* :: $* <@> $: $1 :: $2 unmark node::addr
-R:`include': $* <@> $: :`include': $1 unmark :`include':...
-R$* : $* <@> $: $2 strip colon if marked
-R$* <@> $: $1 unmark
-R$* ; $1 strip trailing semi
-R$* < $* ; > $1 < $2 > bogus bracketed semi
-
-# null input now results from list:; syntax
-R$@ $@ :; <@>
-
-# basic textual canonicalization -- note RFC733 heuristic here
-R$* $: < $1 > housekeeping <>
-R$+ < $* > < $2 > strip excess on left
-R< $* > $+ < $1 > strip excess on right
-R<> $@ < @ > MAIL FROM:<> case
-R< $+ > $: $1 remove housekeeping <>
-
-ifdef(`_NO_CANONIFY_', `dnl',
-`# eliminate local host if present
-R@ $=w $=: $+ $@ @ $M $2 $3 @thishost ...
-R@ $+ $@ @ $1 @somewhere ...
-
-R$=E @ $=w $@ $1 @ $2 leave exposed
-R$+ @ $=w $@ $1 @ $M ...@thishost
-R$+ @ $+ $@ $1 @ $2 ...@somewhere
-
-R$=w ! $=E $@ $2 @ $1 leave exposed
-R$=w ! $+ $@ $2 @ $M thishost!...
-R$+ ! $+ $@ $1 ! $2 @ $M somewhere ! ...
-
-R$=E % $=w $@ $1 @ $2 leave exposed
-R$+ % $=w $@ $1 @ $M ...%thishost
-R$+ % $+ $@ $1 @ $2 ...%somewhere
-
-R$=E $@ $1 @ $j leave exposed
-R$+ $@ $1 @ $M unadorned user')
-
-
-######################################
-### Ruleset 0 -- Parse Address ###
-######################################
-
-S0
-
-R$*:;<@> $#error $@ USAGE $: "List:; syntax illegal for recipient addresses"
-
-# pass everything else to a relay host
-R$* $#_RELAY_ $@ $H $: $1
-
-
-##################################################
-### Ruleset 4 -- Final Output Post-rewriting ###
-##################################################
-S4
-
-R$* <@> $@ handle <> and list:;
-
-# strip trailing dot off before passing to nullclient relay
-R$* @ $+ . $1 @ $2
-
-#\f
-######################################################################
-######################################################################
-#####
-`##### MAILER DEFINITIONS'
-#####
-######################################################################
-######################################################################
-undivert(7)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-divert(0)
-
-VERSIONID(`@(#)proto.m4 8.243 (Berkeley) 2/2/1999')
-
-MAILER(local)dnl
-
-# level 8 config file format
-V8/ifdef(`VENDOR_NAME', `VENDOR_NAME', `Berkeley')
-divert(-1)
-
-# do some sanity checking
-ifdef(`__OSTYPE__',,
- `errprint(`*** ERROR: No system type defined (use OSTYPE macro)')')
-
-# pick our default mailers
-ifdef(`confSMTP_MAILER',, `define(`confSMTP_MAILER', `esmtp')')
-ifdef(`confLOCAL_MAILER',, `define(`confLOCAL_MAILER', `local')')
-ifdef(`confRELAY_MAILER',,
- `define(`confRELAY_MAILER',
- `ifdef(`_MAILER_smtp_', `relay',
- `ifdef(`_MAILER_uucp', `uucp-new', `unknown')')')')
-ifdef(`confUUCP_MAILER',, `define(`confUUCP_MAILER', `uucp-old')')
-define(`_SMTP_', `confSMTP_MAILER')dnl for readability only
-define(`_LOCAL_', `confLOCAL_MAILER')dnl for readability only
-define(`_RELAY_', `confRELAY_MAILER')dnl for readability only
-define(`_UUCP_', `confUUCP_MAILER')dnl for readability only
-
-# set our default hashed database type
-ifdef(`DATABASE_MAP_TYPE',, `define(`DATABASE_MAP_TYPE', `hash')')
-
-# back compatibility with old config files
-ifdef(`confDEF_GROUP_ID',
- `errprint(`*** confDEF_GROUP_ID is obsolete.')
- errprint(` Use confDEF_USER_ID with a colon in the value instead.')')
-ifdef(`confREAD_TIMEOUT',
- `errprint(`*** confREAD_TIMEOUT is obsolete.')
- errprint(` Use individual confTO_<timeout> parameters instead.')')
-ifdef(`confMESSAGE_TIMEOUT',
- `define(`_ARG_', index(confMESSAGE_TIMEOUT, /))
- ifelse(_ARG_, -1,
- `define(`confTO_QUEUERETURN', confMESSAGE_TIMEOUT)',
- `define(`confTO_QUEUERETURN',
- substr(confMESSAGE_TIMEOUT, 0, _ARG_))
- define(`confTO_QUEUEWARN',
- substr(confMESSAGE_TIMEOUT, eval(_ARG_+1)))')')
-ifdef(`confMIN_FREE_BLOCKS', `ifelse(index(confMIN_FREE_BLOCKS, /), -1,,
- `errprint(`*** compound confMIN_FREE_BLOCKS is obsolete.')
- errprint(` Use confMAX_MESSAGE_SIZE for the second part of the value.')')')
-
-# clean option definitions below....
-define(`_OPTION', `ifdef(`$2', `O $1=$2', `#O $1`'ifelse($3, `',, `=$3')')')dnl
-
-divert(0)dnl
-
-# override file safeties - setting this option compromises system security
-# need to set this now for the sake of class files
-_OPTION(DontBlameSendmail, `confDONT_BLAME_SENDMAIL', safe)
-
-##################
-# local info #
-##################
-
-Cwlocalhost
-ifdef(`USE_CW_FILE',
-`# file containing names of hosts for which we receive email
-Fw`'confCW_FILE',
- `dnl')
-
-# my official domain name
-# ... `define' this only if sendmail cannot automatically determine your domain
-ifdef(`confDOMAIN_NAME', `Dj`'confDOMAIN_NAME', `#Dj$w.Foo.COM')
-
-ifdef(`_NULL_CLIENT_ONLY_', `divert(-1)')dnl
-
-CP.
-
-ifdef(`UUCP_RELAY',
-`# UUCP relay host
-DY`'UUCP_RELAY
-CPUUCP
-
-')dnl
-ifdef(`BITNET_RELAY',
-`# BITNET relay host
-DB`'BITNET_RELAY
-CPBITNET
-
-')dnl
-ifdef(`DECNET_RELAY',
-`define(`_USE_DECNET_SYNTAX_', 1)dnl
-# DECnet relay host
-DC`'DECNET_RELAY
-CPDECNET
-
-')dnl
-ifdef(`FAX_RELAY',
-`# FAX relay host
-DF`'FAX_RELAY
-CPFAX
-
-')dnl
-# "Smart" relay host (may be null)
-DS`'ifdef(`SMART_HOST', SMART_HOST)
-
-ifdef(`LUSER_RELAY', `dnl
-# place to which unknown users should be forwarded
-Kuser user -m -a<>
-DL`'LUSER_RELAY',
-`dnl')
-
-# operators that cannot be in local usernames (i.e., network indicators)
-CO @ % ifdef(`_NO_UUCP_', `', `!')
-
-# a class with just dot (for identifying canonical names)
-C..
-
-# a class with just a left bracket (for identifying domain literals)
-C[[
-
-ifdef(`MAILER_TABLE', `dnl
-# Mailer table (overriding domains)
-Kmailertable MAILER_TABLE',
-`dnl')
-
-ifdef(`DOMAIN_TABLE', `dnl
-# Domain table (adding domains)
-Kdomaintable DOMAIN_TABLE',
-`dnl')
-
-ifdef(`GENERICS_TABLE', `dnl
-# Generics table (mapping outgoing addresses)
-Kgenerics GENERICS_TABLE',
-`dnl')
-
-ifdef(`UUDOMAIN_TABLE', `dnl
-# UUCP domain table
-Kuudomain UUDOMAIN_TABLE',
-`dnl')
-
-ifdef(`BITDOMAIN_TABLE', `dnl
-# BITNET mapping table
-Kbitdomain BITDOMAIN_TABLE',
-`dnl')
-
-ifdef(`VIRTUSER_TABLE', `dnl
-# Virtual user table (maps incoming users)
-Kvirtuser VIRTUSER_TABLE',
-`dnl')
-
-ifdef(`ACCESS_TABLE', `dnl
-# Access list database (for spam stomping)
-Kaccess ACCESS_TABLE',
-`dnl')
-
-ifdef(`_RELAY_MX_SERVED_', `dnl
-# MX map (to allow relaying to hosts that we MX for)
-Kmxserved bestmx -z: -T<TEMP>',
-`dnl')
-
-ifdef(`_ACCEPT_UNRESOLVABLE_DOMAINS_',`dnl',`dnl
-# Resolve map (to check if a host exists in check_mail)
-Kresolve host -a<OK> -T<TEMP>')
-
-ifdef(`confCR_FILE', `dnl
-# Hosts that will permit relaying ($=R)
-FR`'confCR_FILE',
-`dnl')
-
-# who I send unqualified names to (null means deliver locally)
-DR`'ifdef(`LOCAL_RELAY', LOCAL_RELAY)
-
-# who gets all local email traffic ($R has precedence for unqualified names)
-DH`'ifdef(`MAIL_HUB', MAIL_HUB)
-
-# dequoting map
-Kdequote dequote
-
-divert(0)dnl # end of nullclient diversion
-# class E: names that should be exposed as from this host, even if we masquerade
-ifdef(`_NULL_CLIENT_ONLY_', `#',
-`# class L: names that should be delivered locally, even if we have a relay
-# class M: domains that should be converted to $M
-#CL root
-')CE root
-undivert(5)dnl
-
-# who I masquerade as (null for no masquerading) (see also $=M)
-DM`'ifdef(`MASQUERADE_NAME', MASQUERADE_NAME)
-
-# my name for error messages
-ifdef(`confMAILER_NAME', `Dn`'confMAILER_NAME', `#DnMAILER-DAEMON')
-
-undivert(6)dnl
-include(_CF_DIR_`m4/version.m4')
-
-###############
-# Options #
-###############
-
-# strip message body to 7 bits on input?
-_OPTION(SevenBitInput, `confSEVEN_BIT_INPUT')
-
-# 8-bit data handling
-_OPTION(EightBitMode, `confEIGHT_BIT_HANDLING', adaptive)
-
-ifdef(`_NULL_CLIENT_ONLY_', `dnl', `
-# wait for alias file rebuild (default units: minutes)
-_OPTION(AliasWait, `confALIAS_WAIT', 5m)
-
-# location of alias file
-_OPTION(AliasFile, `ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', /etc/mail/aliases, /etc/aliases))
-')
-# minimum number of free blocks on filesystem
-_OPTION(MinFreeBlocks, `confMIN_FREE_BLOCKS', 100)
-
-# maximum message size
-_OPTION(MaxMessageSize, `confMAX_MESSAGE_SIZE', 1000000)
-
-# substitution for space (blank) characters
-_OPTION(BlankSub, `confBLANK_SUB', _)
-
-# avoid connecting to "expensive" mailers on initial submission?
-_OPTION(HoldExpensive, `confCON_EXPENSIVE')
-
-# checkpoint queue runs after every N successful deliveries
-_OPTION(CheckpointInterval, `confCHECKPOINT_INTERVAL', 10)
-
-# default delivery mode
-_OPTION(DeliveryMode, `confDELIVERY_MODE', background)
-
-# automatically rebuild the alias database?
-_OPTION(AutoRebuildAliases, `confAUTO_REBUILD')
-
-# error message header/file
-_OPTION(ErrorHeader, `confERROR_MESSAGE', ifdef(`_USE_ETC_MAIL_', /etc/mail/error-header, /etc/sendmail.oE))
-
-# error mode
-_OPTION(ErrorMode, `confERROR_MODE', print)
-
-# save Unix-style "From_" lines at top of header?
-_OPTION(SaveFromLine, `confSAVE_FROM_LINES')
-
-# temporary file mode
-_OPTION(TempFileMode, `confTEMP_FILE_MODE', 0600)
-
-# match recipients against GECOS field?
-_OPTION(MatchGECOS, `confMATCH_GECOS')
-
-# maximum hop count
-_OPTION(MaxHopCount, `confMAX_HOP', 17)
-
-# location of help file
-O HelpFile=ifdef(`HELP_FILE', HELP_FILE, ifdef(`_USE_ETC_MAIL_', /etc/mail/helpfile, /usr/lib/sendmail.hf))
-
-# ignore dots as terminators in incoming messages?
-_OPTION(IgnoreDots, `confIGNORE_DOTS')
-
-# name resolver options
-_OPTION(ResolverOptions, `confBIND_OPTS', +AAONLY)
-
-# deliver MIME-encapsulated error messages?
-_OPTION(SendMimeErrors, `confMIME_FORMAT_ERRORS')
-
-# Forward file search path
-_OPTION(ForwardPath, `confFORWARD_PATH', /var/forward/$u:$z/.forward.$w:$z/.forward)
-
-# open connection cache size
-_OPTION(ConnectionCacheSize, `confMCI_CACHE_SIZE', 2)
-
-# open connection cache timeout
-_OPTION(ConnectionCacheTimeout, `confMCI_CACHE_TIMEOUT', 5m)
-
-# persistent host status directory
-_OPTION(HostStatusDirectory, `confHOST_STATUS_DIRECTORY', .hoststat)
-
-# single thread deliveries (requires HostStatusDirectory)?
-_OPTION(SingleThreadDelivery, `confSINGLE_THREAD_DELIVERY')
-
-# use Errors-To: header?
-_OPTION(UseErrorsTo, `confUSE_ERRORS_TO')
-
-# log level
-_OPTION(LogLevel, `confLOG_LEVEL', 10)
-
-# send to me too, even in an alias expansion?
-_OPTION(MeToo, `confME_TOO')
-
-# verify RHS in newaliases?
-_OPTION(CheckAliases, `confCHECK_ALIASES')
-
-# default messages to old style headers if no special punctuation?
-_OPTION(OldStyleHeaders, `confOLD_STYLE_HEADERS')
-
-# SMTP daemon options
-_OPTION(DaemonPortOptions, `confDAEMON_OPTIONS', Port=esmtp)
-
-# privacy flags
-_OPTION(PrivacyOptions, `confPRIVACY_FLAGS', authwarnings)
-
-# who (if anyone) should get extra copies of error messages
-_OPTION(PostMasterCopy, `confCOPY_ERRORS_TO', Postmaster)
-
-# slope of queue-only function
-_OPTION(QueueFactor, `confQUEUE_FACTOR', 600000)
-
-# queue directory
-O QueueDirectory=ifdef(`QUEUE_DIR', QUEUE_DIR, /var/spool/mqueue)
-
-# timeouts (many of these)
-_OPTION(Timeout.initial, `confTO_INITIAL', 5m)
-_OPTION(Timeout.connect, `confTO_CONNECT', 5m)
-_OPTION(Timeout.iconnect, `confTO_ICONNECT', 5m)
-_OPTION(Timeout.helo, `confTO_HELO', 5m)
-_OPTION(Timeout.mail, `confTO_MAIL', 10m)
-_OPTION(Timeout.rcpt, `confTO_RCPT', 1h)
-_OPTION(Timeout.datainit, `confTO_DATAINIT', 5m)
-_OPTION(Timeout.datablock, `confTO_DATABLOCK', 1h)
-_OPTION(Timeout.datafinal, `confTO_DATAFINAL', 1h)
-_OPTION(Timeout.rset, `confTO_RSET', 5m)
-_OPTION(Timeout.quit, `confTO_QUIT', 2m)
-_OPTION(Timeout.misc, `confTO_MISC', 2m)
-_OPTION(Timeout.command, `confTO_COMMAND', 1h)
-_OPTION(Timeout.ident, `confTO_IDENT', 30s)
-_OPTION(Timeout.fileopen, `confTO_FILEOPEN', 60s)
-_OPTION(Timeout.queuereturn, `confTO_QUEUERETURN', 5d)
-_OPTION(Timeout.queuereturn.normal, `confTO_QUEUERETURN_NORMAL', 5d)
-_OPTION(Timeout.queuereturn.urgent, `confTO_QUEUERETURN_URGENT', 2d)
-_OPTION(Timeout.queuereturn.non-urgent, `confTO_QUEUERETURN_NONURGENT', 7d)
-_OPTION(Timeout.queuewarn, `confTO_QUEUEWARN', 4h)
-_OPTION(Timeout.queuewarn.normal, `confTO_QUEUEWARN_NORMAL', 4h)
-_OPTION(Timeout.queuewarn.urgent, `confTO_QUEUEWARN_URGENT', 1h)
-_OPTION(Timeout.queuewarn.non-urgent, `confTO_QUEUEWARN_NONURGENT', 12h)
-_OPTION(Timeout.hoststatus, `confTO_HOSTSTATUS', 30m)
-
-# should we not prune routes in route-addr syntax addresses?
-_OPTION(DontPruneRoutes, `confDONT_PRUNE_ROUTES')
-
-# queue up everything before forking?
-_OPTION(SuperSafe, `confSAFE_QUEUE')
-
-# status file
-O StatusFile=ifdef(`STATUS_FILE', `STATUS_FILE', ifdef(`_USE_ETC_MAIL_', /etc/mail/statistics, /etc/sendmail.st))
-
-# time zone handling:
-# if undefined, use system default
-# if defined but null, use TZ envariable passed in
-# if defined and non-null, use that info
-ifelse(confTIME_ZONE, `USE_SYSTEM', `#O TimeZoneSpec=',
- confTIME_ZONE, `USE_TZ', `O TimeZoneSpec=',
- `O TimeZoneSpec=confTIME_ZONE')
-
-# default UID (can be username or userid:groupid)
-_OPTION(DefaultUser, `confDEF_USER_ID', mailnull)
-
-# list of locations of user database file (null means no lookup)
-_OPTION(UserDatabaseSpec, `confUSERDB_SPEC', ifdef(`_USE_ETC_MAIL_', /etc/mail/userdb, /etc/userdb))
-
-# fallback MX host
-_OPTION(FallbackMXhost, `confFALLBACK_MX', fall.back.host.net)
-
-# if we are the best MX host for a site, try it directly instead of config err
-_OPTION(TryNullMXList, `confTRY_NULL_MX_LIST')
-
-# load average at which we just queue messages
-_OPTION(QueueLA, `confQUEUE_LA', 8)
-
-# load average at which we refuse connections
-_OPTION(RefuseLA, `confREFUSE_LA', 12)
-
-# maximum number of children we allow at one time
-_OPTION(MaxDaemonChildren, `confMAX_DAEMON_CHILDREN', 12)
-
-# maximum number of new connections per second
-_OPTION(ConnectionRateThrottle, `confCONNECTION_RATE_THROTTLE', 3)
-
-# work recipient factor
-_OPTION(RecipientFactor, `confWORK_RECIPIENT_FACTOR', 30000)
-
-# deliver each queued job in a separate process?
-_OPTION(ForkEachJob, `confSEPARATE_PROC')
-
-# work class factor
-_OPTION(ClassFactor, `confWORK_CLASS_FACTOR', 1800)
-
-# work time factor
-_OPTION(RetryFactor, `confWORK_TIME_FACTOR', 90000)
-
-# shall we sort the queue by hostname first?
-_OPTION(QueueSortOrder, `confQUEUE_SORT_ORDER', priority)
-
-# minimum time in queue before retry
-_OPTION(MinQueueAge, `confMIN_QUEUE_AGE', 30m)
-
-# default character set
-_OPTION(DefaultCharSet, `confDEF_CHAR_SET', iso-8859-1)
-
-# service switch file (ignored on Solaris, Ultrix, OSF/1, others)
-_OPTION(ServiceSwitchFile, `confSERVICE_SWITCH_FILE', ifdef(`_USE_ETC_MAIL_', /etc/mail/service.switch, /etc/service.switch))
-
-# hosts file (normally /etc/hosts)
-_OPTION(HostsFile, `confHOSTS_FILE', /etc/hosts)
-
-# dialup line delay on connection failure
-_OPTION(DialDelay, `confDIAL_DELAY', 10s)
-
-# action to take if there are no recipients in the message
-_OPTION(NoRecipientAction, `confNO_RCPT_ACTION', add-to-undisclosed)
-
-# chrooted environment for writing to files
-_OPTION(SafeFileEnvironment, `confSAFE_FILE_ENV', /arch)
-
-# are colons OK in addresses?
-_OPTION(ColonOkInAddr, `confCOLON_OK_IN_ADDR')
-
-# how many jobs can you process in the queue?
-_OPTION(MaxQueueRunSize, `confMAX_QUEUE_RUN_SIZE', 10000)
-
-# shall I avoid expanding CNAMEs (violates protocols)?
-_OPTION(DontExpandCnames, `confDONT_EXPAND_CNAMES')
-
-# SMTP initial login message (old $e macro)
-_OPTION(SmtpGreetingMessage, `confSMTP_LOGIN_MSG')
-
-# UNIX initial From header format (old $l macro)
-_OPTION(UnixFromLine, `confFROM_LINE')
-
-# From: lines that have embedded newlines are unwrapped onto one line
-_OPTION(SingleLineFromHeader, `confSINGLE_LINE_FROM_HEADER', False)
-
-# Allow HELO SMTP command that does not `include' a host name
-_OPTION(AllowBogusHELO, `confALLOW_BOGUS_HELO', False)
-
-# Characters to be quoted in a full name phrase (@,;:\()[] are automatic)
-_OPTION(MustQuoteChars, `confMUST_QUOTE_CHARS', .)
-
-# delimiter (operator) characters (old $o macro)
-_OPTION(OperatorChars, `confOPERATORS')
-
-# shall I avoid calling initgroups(3) because of high NIS costs?
-_OPTION(DontInitGroups, `confDONT_INIT_GROUPS')
-
-# are group-writable `:include:' and .forward files (un)trustworthy?
-_OPTION(UnsafeGroupWrites, `confUNSAFE_GROUP_WRITES')
-
-# where do errors that occur when sending errors get sent?
-_OPTION(DoubleBounceAddress, `confDOUBLE_BOUNCE_ADDRESS', postmaster)
-
-# what user id do we assume for the majority of the processing?
-_OPTION(RunAsUser, `confRUN_AS_USER', sendmail)
-
-# maximum number of recipients per SMTP envelope
-_OPTION(MaxRecipientsPerMessage, `confMAX_RCPTS_PER_MESSAGE', 100)
-
-# shall we get local names from our installed interfaces?
-_OPTION(DontProbeInterfaces, `confDONT_PROBE_INTERFACES')
-
-ifdef(`confTRUSTED_USER',
-`# Trusted user for file ownership and starting the daemon
-O TrustedUser=confTRUSTED_USER
-')
-ifdef(`confCONTROL_SOCKET_NAME',
-`# Control socket for daemon management
-O ControlSocketName=confCONTROL_SOCKET_NAME
-')
-ifdef(`confMAX_MIME_HEADER_LENGTH',
-`# Maximum MIME header length to protect MUAs
-O MaxMimeHeaderLength=confMAX_MIME_HEADER_LENGTH
-')
-ifdef(`confMAX_HEADERS_LENGTH',
-`# Maximum length of the sum of all headers
-O MaxHeadersLength=confMAX_HEADERS_LENGTH
-')
-
-###########################
-# Message precedences #
-###########################
-
-Pfirst-class=0
-Pspecial-delivery=100
-Plist=-30
-Pbulk=-60
-Pjunk=-100
-
-#####################
-# Trusted users #
-#####################
-
-# this is equivalent to setting class "t"
-ifdef(`_USE_CT_FILE_', `', `#')Ft`'ifdef(`confCT_FILE', confCT_FILE, ifdef(`_USE_ETC_MAIL_', `/etc/mail/trusted-users', `/etc/sendmail.ct'))
-Troot
-Tdaemon
-ifdef(`_NO_UUCP_', `dnl', `Tuucp')
-ifdef(`confTRUSTED_USERS', `T`'confTRUSTED_USERS', `dnl')
-
-#########################
-# Format of headers #
-#########################
-
-ifdef(`confFROM_HEADER',, `define(`confFROM_HEADER', `$?x$x <$g>$|$g$.')')dnl
-H?P?Return-Path: <$g>
-HReceived: confRECEIVED_HEADER
-H?D?Resent-Date: $a
-H?D?Date: $a
-H?F?Resent-From: confFROM_HEADER
-H?F?From: confFROM_HEADER
-H?x?Full-Name: $x
-# HPosted-Date: $a
-# H?l?Received-Date: $b
-H?M?Resent-Message-Id: <$t.$i@$j>
-H?M?Message-Id: <$t.$i@$j>
-ifdef(`_NULL_CLIENT_ONLY_',
- `include(_CF_DIR_`'m4/nullrelay.m4)m4exit',
- `dnl')
-#\f
-######################################################################
-######################################################################
-#####
-##### REWRITING RULES
-#####
-######################################################################
-######################################################################
-
-############################################
-### Ruleset 3 -- Name Canonicalization ###
-############################################
-S3
-
-# handle null input (translate to <@> special case)
-R$@ $@ <@>
-
-# strip group: syntax (not inside angle brackets!) and trailing semicolon
-R$* $: $1 <@> mark addresses
-R$* < $* > $* <@> $: $1 < $2 > $3 unmark <addr>
-R@ $* <@> $: @ $1 unmark @host:...
-R$* :: $* <@> $: $1 :: $2 unmark node::addr
-R:`include': $* <@> $: :`include': $1 unmark :`include':...
-R$* [ $* : $* ] <@> $: $1 [ $2 : $3 ] unmark IPv6 addrs
-R$* : $* [ $* ] $: $1 : $2 [ $3 ] <@> remark if leading colon
-R$* : $* <@> $: $2 strip colon if marked
-R$* <@> $: $1 unmark
-R$* ; $1 strip trailing semi
-R$* < $* ; > $1 < $2 > bogus bracketed semi
-
-# null input now results from list:; syntax
-R$@ $@ :; <@>
-
-# strip angle brackets -- note RFC733 heuristic to get innermost item
-R$* $: < $1 > housekeeping <>
-R$+ < $* > < $2 > strip excess on left
-R< $* > $+ < $1 > strip excess on right
-R<> $@ < @ > MAIL FROM:<> case
-R< $+ > $: $1 remove housekeeping <>
-
-# make sure <@a,@b,@c:user@d> syntax is easy to parse -- undone later
-R@ $+ , $+ @ $1 : $2 change all "," to ":"
-
-# localize and dispose of route-based addresses
-R@ $+ : $+ $@ $>96 < @$1 > : $2 handle <route-addr>
-
-# find focus for list syntax
-R $+ : $* ; @ $+ $@ $>96 $1 : $2 ; < @ $3 > list syntax
-R $+ : $* ; $@ $1 : $2; list syntax
-
-# find focus for @ syntax addresses
-R$+ @ $+ $: $1 < @ $2 > focus on domain
-R$+ < $+ @ $+ > $1 $2 < @ $3 > move gaze right
-R$+ < @ $+ > $@ $>96 $1 < @ $2 > already canonical
-
-# do some sanity checking
-R$* < @ $* : $* > $* $1 < @ $2 $3 > $4 nix colons in addrs
-
-ifdef(`_NO_UUCP_', `dnl',
-`# convert old-style addresses to a domain-based address
-R$- ! $+ $@ $>96 $2 < @ $1 .UUCP > resolve uucp names
-R$+ . $- ! $+ $@ $>96 $3 < @ $1 . $2 > domain uucps
-R$+ ! $+ $@ $>96 $2 < @ $1 .UUCP > uucp subdomains
-')
-ifdef(`_USE_DECNET_SYNTAX_',
-`# convert node::user addresses into a domain-based address
-R$- :: $+ $@ $>96 $2 < @ $1 .DECNET > resolve DECnet names
-R$- . $- :: $+ $@ $>96 $3 < @ $1.$2 .DECNET > numeric DECnet addr
-',
- `dnl')
-# if we have % signs, take the rightmost one
-R$* % $* $1 @ $2 First make them all @s.
-R$* @ $* @ $* $1 % $2 @ $3 Undo all but the last.
-R$* @ $* $@ $>96 $1 < @ $2 > Insert < > and finish
-
-# else we must be a local name
-R$* $@ $>96 $1
-
-
-################################################
-### Ruleset 96 -- bottom half of ruleset 3 ###
-################################################
-
-S96
-
-# handle special cases for local names
-R$* < @ localhost > $* $: $1 < @ $j . > $2 no domain at all
-R$* < @ localhost . $m > $* $: $1 < @ $j . > $2 local domain
-ifdef(`_NO_UUCP_', `dnl',
-`R$* < @ localhost . UUCP > $* $: $1 < @ $j . > $2 .UUCP domain')
-R$* < @ [ $+ ] > $* $: $1 < @@ [ $2 ] > $3 mark [a.b.c.d]
-R$* < @@ $=w > $* $: $1 < @ $j . > $3 self-literal
-R$* < @@ $+ > $* $@ $1 < @ $2 > $3 canon IP addr
-
-ifdef(`DOMAIN_TABLE', `dnl
-# look up domains in the domain table
-R$* < @ $+ > $* $: $1 < @ $(domaintable $2 $) > $3', `dnl')
-
-undivert(2)dnl
-
-ifdef(`BITDOMAIN_TABLE', `dnl
-# handle BITNET mapping
-R$* < @ $+ .BITNET > $* $: $1 < @ $(bitdomain $2 $: $2.BITNET $) > $3', `dnl')
-
-ifdef(`UUDOMAIN_TABLE', `dnl
-# handle UUCP mapping
-R$* < @ $+ .UUCP > $* $: $1 < @ $(uudomain $2 $: $2.UUCP $) > $3', `dnl')
-
-ifdef(`_NO_UUCP_', `dnl',
-`ifdef(`UUCP_RELAY',
-`# pass UUCP addresses straight through
-R$* < @ $+ . UUCP > $* $@ $1 < @ $2 . UUCP . > $3',
-`# if really UUCP, handle it immediately
-ifdef(`_CLASS_U_',
-`R$* < @ $=U . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl')
-ifdef(`_CLASS_V_',
-`R$* < @ $=V . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl')
-ifdef(`_CLASS_W_',
-`R$* < @ $=W . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl')
-ifdef(`_CLASS_X_',
-`R$* < @ $=X . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl')
-ifdef(`_CLASS_Y_',
-`R$* < @ $=Y . UUCP > $* $@ $1 < @ $2 . UUCP . > $3', `dnl')
-
-ifdef(`_NO_CANONIFY_', `dnl', `dnl
-# try UUCP traffic as a local address
-R$* < @ $+ . UUCP > $* $: $1 < @ $[ $2 $] . UUCP . > $3
-R$* < @ $+ . . UUCP . > $* $@ $1 < @ $2 . > $3')
-')')
-ifdef(`_NO_CANONIFY_', `dnl', `dnl
-# pass to name server to make hostname canonical
-R$* < @ $* $~P > $* $: $1 < @ $[ $2 $3 $] > $4')
-
-# local host aliases and pseudo-domains are always canonical
-R$* < @ $=w > $* $: $1 < @ $2 . > $3
-R$* < @ $j > $* $: $1 < @ $j . > $2
-ifdef(`_MASQUERADE_ENTIRE_DOMAIN_',
-`R$* < @ $* $=M > $* $: $1 < @ $2 $3 . > $4',
-`R$* < @ $=M > $* $: $1 < @ $2 . > $3')
-R$* < @ $* $=P > $* $: $1 < @ $2 $3 . > $4
-R$* < @ $* . . > $* $1 < @ $2 . > $3
-
-
-##################################################
-### Ruleset 4 -- Final Output Post-rewriting ###
-##################################################
-S4
-
-R$* <@> $@ handle <> and list:;
-
-# strip trailing dot off possibly canonical name
-R$* < @ $+ . > $* $1 < @ $2 > $3
-
-# eliminate internal code -- should never get this far!
-R$* < @ *LOCAL* > $* $1 < @ $j > $2
-
-# externalize local domain info
-R$* < $+ > $* $1 $2 $3 defocus
-R@ $+ : @ $+ : $+ @ $1 , @ $2 : $3 <route-addr> canonical
-R@ $* $@ @ $1 ... and exit
-
-ifdef(`_NO_UUCP_', `dnl',
-`# UUCP must always be presented in old form
-R$+ @ $- . UUCP $2!$1 u@h.UUCP => h!u')
-
-ifdef(`_USE_DECNET_SYNTAX_',
-`# put DECnet back in :: form
-R$+ @ $+ . DECNET $2 :: $1 u@h.DECNET => h::u',
- `dnl')
-# delete duplicate local names
-R$+ % $=w @ $=w $1 @ $2 u%host@host => u@host
-
-
-
-##############################################################
-### Ruleset 97 -- recanonicalize and call ruleset zero ###
-### (used for recursive calls) ###
-##############################################################
-
-S`'97
-R$* $: $>3 $1
-R$* $@ $>0 $1
-
-
-######################################
-### Ruleset 0 -- Parse Address ###
-######################################
-
-S0
-
-R$* $: $>Parse0 $1 initial parsing
-R<@> $#_LOCAL_ $: <@> special case error msgs
-R$* $: $>98 $1 handle local hacks
-R$* $: $>Parse1 $1 final parsing
-
-#
-# Parse0 -- do initial syntax checking and eliminate local addresses.
-# This should either return with the (possibly modified) input
-# or return with a #error mailer. It should not return with a
-# #mailer other than the #error mailer.
-#
-
-SParse0
-R<@> $@ <@> special case error msgs
-R$* : $* ; <@> $#error $@ 5.1.3 $: "List:; syntax illegal for recipient addresses"
-#R@ <@ $* > < @ $1 > catch "@@host" bogosity
-R<@ $+> $#error $@ 5.1.3 $: "User address required"
-R$* $: <> $1
-R<> $* < @ [ $+ ] > $* $1 < @ [ $2 ] > $3
-R<> $* <$* : $* > $* $#error $@ 5.1.3 $: "Colon illegal in host name part"
-R<> $* $1
-R$* < @ . $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-R$* < @ $* .. $* > $* $#error $@ 5.1.2 $: "Invalid host name"
-
-# now delete the local info -- note $=O to find characters that cause forwarding
-R$* < @ > $* $@ $>Parse0 $>3 $1 user@ => user
-R< @ $=w . > : $* $@ $>Parse0 $>3 $2 @here:... -> ...
-R$- < @ $=w . > $: $(dequote $1 $) < @ $2 . > dequote "foo"@here
-R< @ $+ > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ $=w . > $@ $>Parse0 $>3 $1 $2 $3 ...@here -> ...
-R$- $: $(dequote $1 $) < @ *LOCAL* > dequote "foo"
-R< @ *LOCAL* > $#error $@ 5.1.3 $: "User address required"
-R$* $=O $* < @ *LOCAL* >
- $@ $>Parse0 $>3 $1 $2 $3 ...@*LOCAL* -> ...
-R$* < @ *LOCAL* > $: $1
-
-#
-# Parse1 -- the bottom half of ruleset 0.
-#
-
-SParse1
-ifdef(`_MAILER_smtp_',
-`# handle numeric address spec
-R$* < @ [ $+ ] > $* $: $>98 $1 < @ [ $2 ] > $3 numeric internet spec
-R$* < @ [ $+ ] > $* $#_SMTP_ $@ [$2] $: $1 < @ [$2] > $3 still numeric: send',
- `dnl')
-
-ifdef(`VIRTUSER_TABLE', `dnl
-# handle virtual users
-R$+ < @ $=w . > $: < $(virtuser $1 @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
-R<@> $+ + $* < @ $* . >
- $: < $(virtuser $1 + * @ $3 $@ $1 $: @ $) > $1 + $2 < @ $3 . >
-R<@> $+ + $* < @ $* . >
- $: < $(virtuser $1 @ $3 $@ $1 $: @ $) > $1 + $2 < @ $3 . >
-R<@> $+ < @ $+ . > $: < $(virtuser @ $2 $@ $1 $: @ $) > $1 < @ $2 . >
-R<@> $+ $: $1
-R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2
-R< $+ > $+ < @ $+ > $: $>97 $1',
-`dnl')
-
-# short circuit local delivery so forwarded email works
-ifdef(`_MAILER_usenet_', `dnl
-R$+ . USENET < @ $=w . > $#usenet $: $1 handle usenet specially', `dnl')
-ifdef(`_STICKY_LOCAL_DOMAIN_',
-`R$+ < @ $=w . > $: < $H > $1 < @ $2 . > first try hub
-R< $+ > $+ < $+ > $>95 < $1 > $2 < $3 > yep ....
-R< > $+ + $* < $+ > $#_LOCAL_ $: $1 + $2 plussed name?
-R< > $+ < $+ > $#_LOCAL_ $: @ $1 nope, local address',
-`R$=L < @ $=w . > $#_LOCAL_ $: @ $1 special local names
-R$+ < @ $=w . > $#_LOCAL_ $: $1 regular local name')
-
-ifdef(`MAILER_TABLE', `dnl
-# not local -- try mailer table lookup
-R$* <@ $+ > $* $: < $2 > $1 < @ $2 > $3 extract host name
-R< $+ . > $* $: < $1 > $2 strip trailing dot
-R< $+ > $* $: < $(mailertable $1 $) > $2 lookup
-R< $~[ : $* > $* $>95 < $1 : $2 > $3 check -- resolved?
-R< $+ > $* $: $>90 <$1> $2 try domain',
-`dnl')
-undivert(4)dnl
-
-ifdef(`_NO_UUCP_', `dnl',
-`# resolve remotely connected UUCP links (if any)
-ifdef(`_CLASS_V_',
-`R$* < @ $=V . UUCP . > $* $: $>95 < $V > $1 <@$2.UUCP.> $3',
- `dnl')
-ifdef(`_CLASS_W_',
-`R$* < @ $=W . UUCP . > $* $: $>95 < $W > $1 <@$2.UUCP.> $3',
- `dnl')
-ifdef(`_CLASS_X_',
-`R$* < @ $=X . UUCP . > $* $: $>95 < $X > $1 <@$2.UUCP.> $3',
- `dnl')')
-
-# resolve fake top level domains by forwarding to other hosts
-ifdef(`BITNET_RELAY',
-`R$*<@$+.BITNET.>$* $: $>95 < $B > $1 <@$2.BITNET.> $3 user@host.BITNET',
- `dnl')
-ifdef(`DECNET_RELAY',
-`R$*<@$+.DECNET.>$* $: $>95 < $C > $1 <@$2.DECNET.> $3 user@host.DECNET',
- `dnl')
-ifdef(`_MAILER_pop_',
-`R$+ < @ POP. > $#pop $: $1 user@POP',
- `dnl')
-ifdef(`_MAILER_fax_',
-`R$+ < @ $+ .FAX. > $#fax $@ $2 $: $1 user@host.FAX',
-`ifdef(`FAX_RELAY',
-`R$*<@$+.FAX.>$* $: $>95 < $F > $1 <@$2.FAX.> $3 user@host.FAX',
- `dnl')')
-
-ifdef(`UUCP_RELAY',
-`# forward non-local UUCP traffic to our UUCP relay
-R$*<@$*.UUCP.>$* $: $>95 < $Y > $1 <@$2.UUCP.> $3 uucp mail',
-`ifdef(`_MAILER_uucp_',
-`# forward other UUCP traffic straight to UUCP
-R$* < @ $+ .UUCP. > $* $#_UUCP_ $@ $2 $: $1 < @ $2 .UUCP. > $3 user@host.UUCP',
- `dnl')')
-ifdef(`_MAILER_usenet_', `
-# addresses sent to net.group.USENET will get forwarded to a newsgroup
-R$+ . USENET $#usenet $: $1',
- `dnl')
-
-ifdef(`_LOCAL_RULES_',
-`# figure out what should stay in our local mail system
-undivert(1)', `dnl')
-
-# pass names that still have a host to a smarthost (if defined)
-R$* < @ $* > $* $: $>95 < $S > $1 < @ $2 > $3 glue on smarthost name
-
-# deal with other remote names
-ifdef(`_MAILER_smtp_',
-`R$* < @$* > $* $#_SMTP_ $@ $2 $: $1 < @ $2 > $3 user@host.domain',
-`R$* < @$* > $* $#error $@ 5.1.2 $: "Unrecognized host name " $2')
-
-# handle locally delivered names
-R$=L $#_LOCAL_ $: @ $1 special local names
-R$+ $#_LOCAL_ $: $1 regular local names
-
-###########################################################################
-### Ruleset 5 -- special rewriting after aliases have been expanded ###
-###########################################################################
-
-S5
-
-# deal with plussed users so aliases work nicely
-R$+ + * $#_LOCAL_ $@ $&h $: $1
-R$+ + $* $#_LOCAL_ $@ + $2 $: $1 + *
-
-# prepend an empty "forward host" on the front
-R$+ $: <> $1
-
-ifdef(`LUSER_RELAY', `dnl
-# send unrecognized local users to a relay host
-R< > $+ $: < $L . > $(user $1 $) look up user
-R< $* > $+ <> $* $: < > $2 $3 found; strip $L
-R< $* . > $+ $: < $1 > $2 strip extra dot',
-`dnl')
-
-# see if we have a relay or a hub
-R< > $+ $: < $H > $1 try hub
-R< > $+ $: < $R > $1 try relay
-R< > $+ $: < > < $1 $&h > nope, restore +detail
-R< > < $+ + $* > $* < > < $1 > + $2 $3 find the user part
-R< > < $+ > + $* $#_LOCAL_ $@ $2 $: @ $1 strip the extra +
-R< > < $+ > $@ $1 no +detail
-R$+ $: $1 <> $&h add +detail back in
-R$+ <> + $* $: $1 + $2 check whether +detail
-R$+ <> $* $: $1 else discard
-R< local : $* > $* $: $>95 < local : $1 > $2 no host extension
-R< error : $* > $* $: $>95 < error : $1 > $2 no host extension
-R< $- : $+ > $+ $: $>95 < $1 : $2 > $3 < @ $2 >
-R< $+ > $+ $@ $>95 < $1 > $2 < @ $1 >
-
-ifdef(`MAILER_TABLE', `dnl
-###################################################################
-### Ruleset 90 -- try domain part of mailertable entry ###
-###################################################################
-
-S90
-R$* <$- . $+ > $* $: $1$2 < $(mailertable .$3 $@ $1$2 $@ $2 $) > $4
-R$* <$~[ : $* > $* $>95 < $2 : $3 > $4 check -- resolved?
-R$* < . $+ > $* $@ $>90 $1 . <$2> $3 no -- strip & try again
-R$* < $* > $* $: < $(mailertable . $@ $1$2 $) > $3 try "."
-R< $~[ : $* > $* $>95 < $1 : $2 > $3 "." found?
-R< $* > $* $@ $2 no mailertable match',
-`dnl')
-
-###################################################################
-### Ruleset 95 -- canonify mailer:[user@]host syntax to triple ###
-###################################################################
-
-S95
-R< > $* $@ $1 strip off null relay
-R< error : $- $+ > $* $#error $@ $(dequote $1 $) $: $2
-R< local : $* > $* $>CanonLocal < $1 > $2
-R< $- : $+ @ $+ > $*<$*>$* $# $1 $@ $3 $: $2<@$3> use literal user
-R< $- : $+ > $* $# $1 $@ $2 $: $3 try qualified mailer
-R< $=w > $* $@ $2 delete local host
-R< $+ > $* $#_RELAY_ $@ $1 $: $2 use unqualified mailer
-
-###################################################################
-### Ruleset CanonLocal -- canonify local: syntax ###
-###################################################################
-
-SCanonLocal
-# strip local host from routed addresses
-R< $* > < @ $+ > : $+ $@ $>97 $3
-R< $* > $+ $=O $+ < @ $+ > $@ $>97 $2 $3 $4
-
-# strip trailing dot from any host name that may appear
-R< $* > $* < @ $* . > $: < $1 > $2 < @ $3 >
-
-# handle local: syntax -- use old user, either with or without host
-R< > $* < @ $* > $* $#_LOCAL_ $@ $1@$2 $: $1
-R< > $+ $#_LOCAL_ $@ $1 $: $1
-
-# handle local:user@host syntax -- ignore host part
-R< $+ @ $+ > $* < @ $* > $: < $1 > $3 < @ $4 >
-
-# handle local:user syntax
-R< $+ > $* <@ $* > $* $#_LOCAL_ $@ $2@$3 $: $1
-R< $+ > $* $#_LOCAL_ $@ $2 $: $1
-
-###################################################################
-### Ruleset 93 -- convert header names to masqueraded form ###
-###################################################################
-
-S93
-
-ifdef(`GENERICS_TABLE', `dnl
-# handle generics database
-ifdef(`_GENERICS_ENTIRE_DOMAIN_',
-`R$+ < @ $* $=G . > $: < $1@$2$3 > $1 < @ $2$3 . > @ mark',
-`R$+ < @ $=G . > $: < $1@$2 > $1 < @ $2 . > @ mark')
-R$+ < @ *LOCAL* > $: < $1@$j > $1 < @ *LOCAL* > @ mark
-R< $+ > $+ < $* > @ $: < $(generics $1 $: $) > $2 < $3 >
-R< > $+ < @ $+ > $: < $(generics $1 $: $) > $1 < @ $2 >
-R< $* @ $* > $* < $* > $@ $>3 $1 @ $2 found qualified
-R< $+ > $* < $* > $: $>3 $1 @ *LOCAL* found unqualified
-R< > $* $: $1 not found',
-`dnl')
-
-# special case the users that should be exposed
-R$=E < @ *LOCAL* > $@ $1 < @ $j . > leave exposed
-ifdef(`_MASQUERADE_ENTIRE_DOMAIN_',
-`R$=E < @ $* $=M . > $@ $1 < @ $2 $3 . >',
-`R$=E < @ $=M . > $@ $1 < @ $2 . >')
-ifdef(`_LIMITED_MASQUERADE_', `dnl',
-`R$=E < @ $=w . > $@ $1 < @ $2 . >')
-
-# handle domain-specific masquerading
-ifdef(`_MASQUERADE_ENTIRE_DOMAIN_',
-`R$* < @ $* $=M . > $* $: $1 < @ $2 $3 . @ $M > $4 convert masqueraded doms',
-`R$* < @ $=M . > $* $: $1 < @ $2 . @ $M > $3 convert masqueraded doms')
-ifdef(`_LIMITED_MASQUERADE_', `dnl',
-`R$* < @ $=w . > $* $: $1 < @ $2 . @ $M > $3')
-R$* < @ *LOCAL* > $* $: $1 < @ $j . @ $M > $2
-R$* < @ $+ @ > $* $: $1 < @ $2 > $3 $M is null
-R$* < @ $+ @ $+ > $* $: $1 < @ $3 . > $4 $M is not null
-
-###################################################################
-### Ruleset 94 -- convert envelope names to masqueraded form ###
-###################################################################
-
-S94
-ifdef(`_MASQUERADE_ENVELOPE_',
-`R$+ $@ $>93 $1',
-`R$* < @ *LOCAL* > $* $: $1 < @ $j . > $2')
-
-###################################################################
-### Ruleset 98 -- local part of ruleset zero (can be null) ###
-###################################################################
-
-S98
-undivert(3)dnl
-
-ifelse(substr(confDELIVERY_MODE,0,1), `d', `errprint(`WARNING: Antispam rules not available in deferred delivery mode.')')
-ifdef(`ACCESS_TABLE', `dnl
-######################################################################
-### LookUpDomain -- search for domain in access database
-###
-### Parameters:
-### <$1> -- key (domain name)
-### <$2> -- default (what to return if not found in db)
-### <$3> -- passthru (additional data passed unchanged through)
-######################################################################
-
-SLookUpDomain
-R<$+> <$+> <$*> $: < $(access $1 $: ? $) > <$1> <$2> <$3>
-R<?> <$+.$+> <$+> <$*> $@ $>LookUpDomain <$2> <$3> <$4>
-R<?> <$+> <$+> <$*> $@ <$2> <$3>
-R<$*> <$+> <$+> <$*> $@ <$1> <$4>
-
-######################################################################
-### LookUpAddress -- search for host address in access database
-###
-### Parameters:
-### <$1> -- key (dot quadded host address)
-### <$2> -- default (what to return if not found in db)
-### <$3> -- passthru (additional data passed through)
-######################################################################
-
-SLookUpAddress
-R<$+> <$+> <$*> $: < $(access $1 $: ? $) > <$1> <$2> <$3>
-R<?> <$+.$-> <$+> <$*> $@ $>LookUpAddress <$1> <$3> <$4>
-R<?> <$+> <$+> <$*> $@ <$2> <$3>
-R<$*> <$+> <$+> <$*> $@ <$1> <$4>',
-`dnl')
-
-######################################################################
-### CanonAddr -- Convert an address into a standard form for
-### relay checking. Route address syntax is
-### crudely converted into a %-hack address.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed address, not in source route form
-######################################################################
-
-SCanonAddr
-R$* $: $>Parse0 $>3 $1 make domain canonical
-R< @ $+ > : $* @ $* < @ $1 > : $2 % $3 change @ to % in src route
-R$* < @ $+ > : $* : $* $3 $1 < @ $2 > : $4 change to % hack.
-R$* < @ $+ > : $* $3 $1 < @ $2 >
-
-######################################################################
-### ParseRecipient -- Strip off hosts in $=R as well as possibly
-### $* $=m or the access database.
-### Check user portion for host separators.
-###
-### Parameters:
-### $1 -- full recipient address
-###
-### Returns:
-### parsed, non-local-relaying address
-######################################################################
-
-SParseRecipient
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $* . > <?> $1 < @ $2 > strip trailing dots
-R<?> $- < @ $* > $: <?> $(dequote $1 $) < @ $2 > dequote local part
-
-# if no $=O character, no host in the user portion, we are done
-R<?> $* $=O $* < @ $* > $: <NO> $1 $2 $3 < @ $4>
-R<?> $* $@ $1
-
-ifdef(`_RELAY_ENTIRE_DOMAIN_', `dnl
-# if we relay, check username portion for user%host so host can be checked also
-R<NO> $* < @ $* $=m > $: <RELAY> $1 < @ $2 $3 >', `dnl')
-
-ifdef(`_RELAY_MX_SERVED_', `dnl
-R<NO> $* < @ $+ > $: <MX> < : $(mxserved $2 $) : > < $1 < @$2 > >
-R<MX> < : $* <TEMP> : > $* $#error $@ 4.7.1 $: "450 Can not check MX records for recipient host " $1
-R<MX> < $* : $=w. : $* > < $+ > $: <RELAY> $4
-R<MX> < : $* : > < $+ > $: <NO> $2', `dnl')
-
-ifdef(`_RELAY_HOSTS_ONLY_',
-`R<NO> $* < @ $=R > $: <RELAY> $1 < @ $2 >
-ifdef(`ACCESS_TABLE', `dnl
-R<NO> $* < @ $+ > $: <$(access $2 $: NO $)> $1 < @ $2 >',`dnl')',
-`R<NO> $* < @ $* $=R > $: <RELAY> $1 < @ $2 $3 >
-ifdef(`ACCESS_TABLE', `dnl
-R<NO> $* < @ $+ > $: $>LookUpDomain <$2> <NO> <$1 < @ $2 >>
-R<$+> <$+> $: <$1> $2',`dnl')')
-
-R<RELAY> $* < @ $* > $@ $>ParseRecipient $1
-R<$-> $* $@ $2
-
-######################################################################
-### check_relay -- check hostname/address on SMTP startup
-######################################################################
-
-SLocal_check_relay
-Scheck_relay
-R$* $: $1 $| $>"Local_check_relay" $1
-R$* $| $* $| $#$* $#$3
-R$* $| $* $| $* $@ $>"Basic_check_relay" $1 $| $2
-
-SBasic_check_relay
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-ifdef(`ACCESS_TABLE', `dnl
-R$+ $| $+ $: $>LookUpDomain < $1 > <?> < $2 >
-R<?> < $+ > $: $>LookUpAddress < $1 > <?> < $1 >
-R<?> < $+ > $: $1
-R<OK> < $* > $@ OK
-R<RELAY> < $* > $@ RELAY
-R<REJECT> $* $#error $@ 5.7.1 $: "ifdef(`confREJECT_MSG', `confREJECT_MSG', `550 Access denied')"
-R<DISCARD> $* $#discard $: discard
-R<$+> $* $#error $@ 5.7.1 $: $1', `dnl')
-
-ifdef(`_RBL_', `dnl
-# DNS based IP address spam lists
-R$* $: $&{client_addr}
-R$-.$-.$-.$- $: $(host $4.$3.$2.$1._RBL_. $: OK $)
-ROK $@ OK
-R$+ $#error $@ 5.7.1 $: "Mail from " $&{client_addr} " refused by blackhole site _RBL_"',
-`dnl')
-
-######################################################################
-### check_mail -- check SMTP ``MAIL FROM:'' command argument
-######################################################################
-
-SLocal_check_mail
-Scheck_mail
-R$* $: $1 $| $>"Local_check_mail" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_mail" $1
-
-SBasic_check_mail
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-R<> $@ <OK>
-R$* $: <?> $>CanonAddr $1
-R<?> $* < @ $+ . > <?> $1 < @ $2 > strip trailing dots
-# handle non-DNS hostnames (*.bitnet, *.decnet, *.uucp, etc)
-R<?> $* < $* $=P > $* $: <OK> $1 < @ $2 $3 > $4
-ifdef(`_ACCEPT_UNRESOLVABLE_DOMAINS_',
-`R<?> $* < @ $+ > $* $: <OK> $1 < @ $2 > $3 ... unresolvable OK',
-`R<?> $* < @ $+ > $* $: <? $(resolve $2 $: $2 <PERM> $) > $1 < @ $2 > $3
-R<? $* <$->> $* < @ $+ > $*
- $: <$2> $3 < @ $4 > $5')
-
-ifdef(`_ACCEPT_UNQUALIFIED_SENDERS_',`dnl',`dnl
-# handle case of @localhost on address
-R<$+> $* < @localhost > $: < ? $&{client_name} > <$1> $2 < @localhost >
-R<$+> $* < @localhost.$m >
- $: < ? $&{client_name} > <$1> $2 < @localhost.$m >
-ifdef(`_NO_UUCP_', `dnl',
-`R<$+> $* < @localhost.UUCP >
- $: < ? $&{client_name} > <$1> $2 < @localhost.UUCP >')
-R<? $=w> <$+> $* <?> <$2> $3
-R<? $+> <$+> $* $#error $@ 5.5.4 $: "553 Real domain name required"
-R<?> <$+> $* $: <$1> $2')
-
-ifdef(`ACCESS_TABLE', `dnl
-# lookup localpart (user@)
-R<$+> $* < @ $+ > $* $: <USER $(access $2@ $: ? $) > <$1> $2 < @ $3 > $4
-# no match, try full address (user@domain rest)
-R<USER ?> <$+> $* < @ $* > $*
- $: <USER $(access $2@$3$4 $: ? $) > <$1> $2 < @ $3 > $4
-# no match, try address (user@domain)
-R<USER ?> <$+> $+ < @ $+ > $*
- $: <USER $(access $2@$3 $: ? $) > <$1> $2 < @ $3 > $4
-# no match, try (sub)domain (domain)
-R<USER ?> <$+> $* < @ $+ > $*
- $: $>LookUpDomain <$3> <$1> <>
-# check unqualified user in access database
-R<?> $* $: <USER $(access $1@ $: ? $) > <?> $1
-# retransform for further use
-R<USER $+> <$+> $* $: <$1> $3',
-`dnl')
-
-ifdef(`_ACCEPT_UNQUALIFIED_SENDERS_',`dnl',`dnl
-# handle case of no @domain on address
-R<?> $* $: < ? $&{client_name} > $1
-R<?> $* $@ <OK> ...local unqualed ok
-R<? $+> $* $#error $@ 5.5.4 $: "553 Domain name required"
- ...remote is not')
-# check results
-R<?> $* $@ <OK>
-R<OK> $* $@ <OK>
-R<TEMP> $* $#error $@ 4.1.8 $: "451 Sender domain must resolve"
-R<PERM> $* $#error $@ 5.1.8 $: "501 Sender domain must exist"
-ifdef(`ACCESS_TABLE', `dnl
-R<RELAY> $* $@ <RELAY>
-R<DISCARD> $* $#discard $: discard
-R<REJECT> $* $#error $@ 5.7.1 $: "ifdef(`confREJECT_MSG', `confREJECT_MSG', `550 Access denied')"
-R<$+> $* $#error $@ 5.7.1 $: $1 error from access db',
-`dnl')
-
-######################################################################
-### check_rcpt -- check SMTP ``RCPT TO:'' command argument
-######################################################################
-
-SLocal_check_rcpt
-Scheck_rcpt
-R$* $: $1 $| $>"Local_check_rcpt" $1
-R$* $| $#$* $#$2
-R$* $| $* $@ $>"Basic_check_rcpt" $1
-
-SBasic_check_rcpt
-# check for deferred delivery mode
-R$* $: < ${deliveryMode} > $1
-R< d > $* $@ deferred
-R< $* > $* $: $2
-
-ifdef(`_LOOSE_RELAY_CHECK_',`dnl
-R$* $: $>CanonAddr $1
-R$* < @ $* . > $1 < @ $2 > strip trailing dots',
-`R$* $: $>ParseRecipient $1 strip relayable hosts')
-
-ifdef(`_BESTMX_IS_LOCAL_',`dnl
-ifelse(_BESTMX_IS_LOCAL_, `', `dnl
-# unlimited bestmx
-R$* < @ $* > $* $: $1 < @ $2 @@ $(bestmx $2 $) > $3',
-`dnl
-# limit bestmx to $=B
-R$* < @ $* $=B > $* $: $1 < @ $2 $3 @@ $(bestmx $2 $3 $) > $4')
-R$* $=O $* < @ $* @@ $=w . > $* $@ $>Basic_check_rcpt $1 $2 $3
-R$* < @ $* @@ $=w . > $* $: $1 < @ $3 > $4
-R$* < @ $* @@ $* > $* $: $1 < @ $2 > $4')
-
-ifdef(`_BLACKLIST_RCPT_',`dnl
-ifdef(`ACCESS_TABLE', `dnl
-# blacklist local users or any host from receiving mail
-R$* $: <?> $1
-R<?> $+ < @ $=w > $: <> <USER $1> <FULL $1@$2> <HOST $2> <$1 < @ $2 >>
-R<?> $+ < @ $* > $: <> <FULL $1@$2> <HOST $2> <$1 < @ $2 >>
-R<?> $+ $: <> <USER $1> <$1>
-R<> <USER $+> $* $: <$(access $1 $: $)> $2
-R<> <FULL $+> $* $: <$(access $1 $: $)> $2
-R<OK> <FULL $+> $* $: <$(access $1 $: $)> $2
-R<> <HOST $+> $* $: <$(access $1 $: $)> $2
-R<OK> <HOST $+> $* $: <$(access $1 $: $)> $2
-R<> <$*> $: $1
-R<OK> <$*> $: $1
-R<RELAY> <$*> $: $1
-R<REJECT> $* $#error $@ 5.2.1 $: "550 Mailbox disabled for this recipient"
-R<$+> $* $#error $@ 5.2.1 $: $1 error from access db', `dnl')', `dnl')
-
-ifdef(`_PROMISCUOUS_RELAY_', `dnl', `dnl
-# anything terminating locally is ok
-ifdef(`_RELAY_ENTIRE_DOMAIN_', `dnl
-R$+ < @ $* $=m > $@ OK', `dnl')
-R$+ < @ $=w > $@ OK
-ifdef(`_RELAY_HOSTS_ONLY_',
-`R$+ < @ $=R > $@ OK
-ifdef(`ACCESS_TABLE', `dnl
-R$+ < @ $* > $: <$(access $2 $: ? $)> <$1 < @ $2 >>',`dnl')',
-`R$+ < @ $* $=R > $@ OK
-ifdef(`ACCESS_TABLE', `dnl
-R$+ < @ $* > $: $>LookUpDomain <$2> <?> <$1 < @ $2 >>',`dnl')')
-ifdef(`ACCESS_TABLE', `dnl
-R<RELAY> $* $@ RELAY
-R<$*> <$*> $: $2',`dnl')
-
-ifdef(`_RELAY_MX_SERVED_', `dnl
-# allow relaying for hosts which we MX serve
-R$+ < @ $* > $: < : $(mxserved $2 $) : > $1 < @ $2 >
-R< : $* <TEMP> : > $* $#error $@ 4.7.1 $: "450 Can not check MX records for recipient host " $1
-R<$* : $=w . : $*> $* $@ OK
-R< : $* : > $* $: $2',
-`dnl')
-
-# check for local user (i.e. unqualified address)
-R$* $: <?> $1
-R<?> $* < @ $+ > $: <REMOTE> $1 < @ $2 >
-# local user is ok
-R<?> $+ $@ OK
-R<$+> $* $: $2
-
-# anything originating locally is ok
-R$* $: <?> $&{client_name}
-# check if bracketed IP address (forward lookup != reverse lookup)
-R<?> [$+] $: <BAD> [$1]
-# pass to name server to make hostname canonical
-R<?> $* $~P $: <?> $[ $1 $2 $]
-R<$-> $* $: $2
-R$* . $1 strip trailing dots
-R$@ $@ OK
-ifdef(`_RELAY_ENTIRE_DOMAIN_', `dnl
-R$* $=m $@ OK', `dnl')
-R$=w $@ OK
-ifdef(`_RELAY_HOSTS_ONLY_',
-`R$=R $@ OK
-ifdef(`ACCESS_TABLE', `dnl
-R$* $: <$(access $1 $: ? $)> <$1>',`dnl')',
-`R$* $=R $@ OK
-ifdef(`ACCESS_TABLE', `dnl
-R$* $: $>LookUpDomain <$1> <?> <$1>',`dnl')')
-ifdef(`ACCESS_TABLE', `dnl
-R<RELAY> $* $@ RELAY
-R<$*> <$*> $: $2',`dnl')
-
-# check IP address
-R$* $: $&{client_addr}
-R$@ $@ OK originated locally
-R0 $@ OK originated locally
-R$=R $* $@ OK relayable IP address
-ifdef(`ACCESS_TABLE', `dnl
-R$* $: $>LookUpAddress <$1> <?> <$1>
-R<RELAY> $* $@ RELAY relayable IP address
-R<$*> <$*> $: $2', `dnl')
-R$* $: [ $1 ] put brackets around it...
-R$=w $@ OK ... and see if it is local
-
-ifdef(`_RELAY_LOCAL_FROM_', `dnl
-# anything with a local FROM is ok
-R$* $: $1 $| $>CanonAddr $&f
-R$* $| $+ < @ $=w . > $@ OK FROM local
-R$* $| $* $: $1
-', `dnl')
-
-# anything else is bogus
-R$* $#error $@ 5.7.1 $: "550 Relaying denied"')
-
-undivert(9)dnl
-#\f
-######################################################################
-######################################################################
-#####
-`##### MAILER DEFINITIONS'
-#####
-######################################################################
-######################################################################
-undivert(7)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-VERSIONID(`@(#)version.m4 8.9.3.1 (Berkeley) 2/4/1999')
-#
-divert(0)
-# Configuration version number
-DZ8.9.3`'ifdef(`confCF_VERSION', `/confCF_VERSION')
+++ /dev/null
-PUSHDIVERT(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-# This code incorporates code from Carnegie Mellon University, whose
-# copyright notice and conditions of redistribution are as follows:
-#
-#***************************************************************************
-# (C) Copyright 1995 by Carnegie Mellon University
-#
-# All Rights Reserved
-#
-# Permission to use, copy, modify, and distribute this software and its
-# documentation for any purpose and without fee is hereby granted,
-# provided that the above copyright notice appear in all copies and that
-# both that copyright notice and this permission notice appear in
-# supporting documentation, and that the name of CMU not be
-# used in advertising or publicity pertaining to distribution of the
-# software without specific, written prior permission.
-#
-# CMU DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-# CMU BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-# SOFTWARE.
-#
-# Contributed to Berkeley by John Gardiner Myers <jgm+@CMU.EDU>.
-#
-
-ifdef(`CYRUS_MAILER_FLAGS',, `define(`CYRUS_MAILER_FLAGS', `A5@/:|')')
-ifdef(`CYRUS_MAILER_PATH',, `define(`CYRUS_MAILER_PATH', /usr/cyrus/bin/deliver)')
-ifdef(`CYRUS_MAILER_ARGS',, `define(`CYRUS_MAILER_ARGS', `deliver -e -m $h -- $u')')
-ifdef(`CYRUS_MAILER_USER',, `define(`CYRUS_MAILER_USER', `cyrus:mail')')
-ifdef(`CYRUS_BB_MAILER_FLAGS',, `define(`CYRUS_BB_MAILER_FLAGS', `')')
-ifdef(`CYRUS_BB_MAILER_ARGS',, `define(`CYRUS_BB_MAILER_ARGS', `deliver -e -m $u')')
-
-POPDIVERT
-
-##################################################
-### Cyrus Mailer specification ###
-##################################################
-
-VERSIONID(`@(#)cyrus.m4 8.9 (Carnegie Mellon) 5/19/1998')
-
-Mcyrus, P=CYRUS_MAILER_PATH, F=CONCAT(`lsDFMnPq', CYRUS_MAILER_FLAGS), S=10, R=20/40, T=X-Unix,
- ifdef(`CYRUS_MAILER_MAX', `M=CYRUS_MAILER_MAX, ')U=CYRUS_MAILER_USER,
- A=CYRUS_MAILER_ARGS
-
-Mcyrusbb, P=CYRUS_MAILER_PATH, F=CONCAT(`lsDFMnP', CYRUS_BB_MAILER_FLAGS), S=10, R=20/40, T=X-Unix,
- ifdef(`CYRUS_MAILER_MAX', `M=CYRUS_MAILER_MAX, ')U=CYRUS_MAILER_USER,
- A=CYRUS_BB_MAILER_ARGS
+++ /dev/null
-PUSHDIVERT(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-# This assumes you already have Sam Leffler's HylaFAX software.
-#
-# Tested with HylaFAX 4.0pl1
-#
-
-ifdef(`FAX_MAILER_ARGS',,
- `define(`FAX_MAILER_ARGS', faxmail -d $u@$h $f)')
-ifdef(`FAX_MAILER_PATH',,
- `define(`FAX_MAILER_PATH', /usr/local/bin/faxmail)')
-ifdef(`FAX_MAILER_MAX',,
- `define(`FAX_MAILER_MAX', 100000)')
-POPDIVERT
-####################################
-### FAX Mailer specification ###
-####################################
-
-VERSIONID(`@(#)fax.m4 8.11 (Berkeley) 5/19/1998')
-
-Mfax, P=FAX_MAILER_PATH, F=DFMhu, S=14, R=24, M=FAX_MAILER_MAX, T=X-Phone/X-FAX/X-Unix,
- A=FAX_MAILER_ARGS
-
-LOCAL_CONFIG
-CPFAX
+++ /dev/null
-PUSHDIVERT(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', `rmn9')')
-ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/mail)')
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -d $u')')
-ifdef(`LOCAL_SHELL_FLAGS',, `define(`LOCAL_SHELL_FLAGS', `eu9')')
-ifdef(`LOCAL_SHELL_PATH',, `define(`LOCAL_SHELL_PATH', /bin/sh)')
-ifdef(`LOCAL_SHELL_ARGS',, `define(`LOCAL_SHELL_ARGS', `sh -c $u')')
-ifdef(`LOCAL_SHELL_DIR',, `define(`LOCAL_SHELL_DIR', `$z:/')')
-POPDIVERT
-
-##################################################
-### Local and Program Mailer specification ###
-##################################################
-
-VERSIONID(`@(#)local.m4 8.30 (Berkeley) 6/30/1998')
-
-Mlocal, P=LOCAL_MAILER_PATH, F=CONCAT(`lsDFMAw5:/|@q', LOCAL_MAILER_FLAGS), S=10/30, R=20/40,
- _OPTINS(`LOCAL_MAILER_MAX', `M=', `, ')_OPTINS(`LOCAL_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/X-Unix,
- A=LOCAL_MAILER_ARGS
-Mprog, P=LOCAL_SHELL_PATH, F=CONCAT(`lsDFMoq', LOCAL_SHELL_FLAGS), S=10/30, R=20/40, D=LOCAL_SHELL_DIR,
- _OPTINS(`LOCAL_MAILER_MAX', `M=', `, ')T=X-Unix,
- A=LOCAL_SHELL_ARGS
-
-#
-# Envelope sender rewriting
-#
-S10
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>94 $1 do masquerading
-
-#
-# Envelope recipient rewriting
-#
-S20
-R$+ < @ $* > $: $1 strip host part
-
-#
-# Header sender rewriting
-#
-S30
-R<@> $n errors to mailer-daemon
-R@ <@ $*> $n temporarily bypass Sun bogosity
-R$+ $: $>50 $1 add local domain if needed
-R$* $: $>93 $1 do masquerading
-
-#
-# Header recipient rewriting
-#
-S40
-R$+ $: $>50 $1 add local domain if needed
-ifdef(`_ALL_MASQUERADE_', `dnl
-R$* $: $>93 $1 do all-masquerading', `dnl')
-
-#
-# Common code to add local domain name (only if always-add-domain)
-#
-S50
-ifdef(`_ALWAYS_ADD_DOMAIN_', `dnl
-R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
-R$+ $@ $1 < @ *LOCAL* > add local qualification',
-`dnl')
+++ /dev/null
-PUSHDIVERT(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-# Not exciting enough to bother with copyrights and most of the
-# rulesets are based from those provided by DEC.
-# Barb Dijker, Labyrinth Computer Services, barb@labyrinth.com
-#
-# This mailer is only useful if you have DECNET and the
-# mail11 program - gatekeeper.dec.com:/pub/DEC/gwtools.
-#
-# For local delivery of DECNET style addresses to the local
-# DECNET node, you will need feature(use_cw_file) and put
-# your DECNET nodename in in the cw file.
-#
-ifdef(`MAIL11_MAILER_PATH',, `define(`MAIL11_MAILER_PATH', /usr/etc/mail11)')
-ifdef(`MAIL11_MAILER_FLAGS',, `define(`MAIL11_MAILER_FLAGS', nsFx)')
-ifdef(`MAIL11_MAILER_ARGS',, `define(`MAIL11_MAILER_ARGS', mail11 $g $x $h $u)')
-define(`_USE_DECNET_SYNTAX_')
-define(`_LOCAL_', ifdef(`confLOCAL_MAILER', confLOCAL_MAILER, `local'))
-
-POPDIVERT
-
-PUSHDIVERT(3)
-# DECNET delivery
-R$* < @ $=w .DECNET. > $#_LOCAL_ $: $1 local DECnet
-R$+ < @ $+ .DECNET. > $#mail11 $@ $2 $: $1 DECnet user
-POPDIVERT
-
-PUSHDIVERT(6)
-CPDECNET
-POPDIVERT
-
-###########################################
-### UTK-MAIL11 Mailer specification ###
-###########################################
-
-VERSIONID(`@(#)mail11.m4 8.8 (Berkeley) 5/19/1998')
-
-Mmail11, P=MAIL11_MAILER_PATH, F=MAIL11_MAILER_FLAGS, S=15, R=25,
- A=MAIL11_MAILER_ARGS
-
-S15
-R$+ $: $>25 $1 preprocess
-R$w :: $+ $@ $w :: $1 ready to go
-
-S25
-R$+ < @ $- .UUCP > $: $2 ! $1 back to old style
-R$+ < @ $- .DECNET > $: $2 :: $1 convert to DECnet style
-R$+ < @ $- .LOCAL > $: $2 :: $1 convert to DECnet style
-R$+ < @ $=w. > $: $2 :: $1 convert to DECnet style
-R$=w :: $+ $2 strip local names
-R$+ :: $+ $@ $1 :: $2 already qualified
+++ /dev/null
-PUSHDIVERT(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-# Contributed by Kimmo Suominen <kim@tac.nyc.ny.us>.
-#
-
-ifdef(`PH_MAILER_PATH',, `define(`PH_MAILER_PATH', /usr/local/etc/phquery)')
-ifdef(`PH_MAILER_FLAGS',, `define(`PH_MAILER_FLAGS', `ehmu')')
-ifdef(`PH_MAILER_ARGS',, `define(`PH_MAILER_ARGS', `phquery -- $u')')
-
-POPDIVERT
-
-####################################
-### PH Mailer specification ###
-####################################
-
-VERSIONID(`@(#)phquery.m4 8.6 (Berkeley) 5/19/1998')
-
-Mph, P=PH_MAILER_PATH, F=CONCAT(`nrDFM', PH_MAILER_FLAGS), S=10, R=20/40,
- A=PH_MAILER_ARGS
+++ /dev/null
-PUSHDIVERT(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-ifdef(`POP_MAILER_PATH',, `define(`POP_MAILER_PATH', /usr/lib/mh/spop)')
-ifdef(`POP_MAILER_FLAGS',, `define(`POP_MAILER_FLAGS', `Penu')')
-ifdef(`POP_MAILER_ARGS',, `define(`POP_MAILER_ARGS', `pop $u')')
-
-POPDIVERT
-
-####################################
-### POP Mailer specification ###
-####################################
-
-VERSIONID(`@(#)pop.m4 8.11 (Berkeley) 5/19/1998')
-
-Mpop, P=POP_MAILER_PATH, F=CONCAT(`lsDFMq', POP_MAILER_FLAGS), S=10, R=20/40, T=DNS/RFC822/X-Unix,
- A=POP_MAILER_ARGS
-
-LOCAL_CONFIG
-# POP mailer is a pseudo-domain
-CPPOP
+++ /dev/null
-PUSHDIVERT(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-ifdef(`PROCMAIL_MAILER_PATH',,
- `ifdef(`PROCMAIL_PATH',
- `define(`PROCMAIL_MAILER_PATH', PROCMAIL_PATH)',
- `define(`PROCMAIL_MAILER_PATH', /usr/local/bin/procmail)')')
-ifdef(`PROCMAIL_MAILER_FLAGS',,
- `define(`PROCMAIL_MAILER_FLAGS', `SPhnu9')')
-ifdef(`PROCMAIL_MAILER_ARGS',,
- `define(`PROCMAIL_MAILER_ARGS', `procmail -Y -m $h $f $u')')
-
-POPDIVERT
-
-######################*****##############
-### PROCMAIL Mailer specification ###
-##################*****##################
-
-VERSIONID(`@(#)procmail.m4 8.11 (Berkeley) 5/19/1998')
-
-Mprocmail, P=PROCMAIL_MAILER_PATH, F=CONCAT(`DFM', PROCMAIL_MAILER_FLAGS), S=11/31, R=21/31, T=DNS/RFC822/X-Unix,
- ifdef(`PROCMAIL_MAILER_MAX', `M=PROCMAIL_MAILER_MAX, ')A=PROCMAIL_MAILER_ARGS
+++ /dev/null
-PUSHDIVERT(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-ifdef(`SMTP_MAILER_FLAGS',, `define(`SMTP_MAILER_FLAGS', `')')
-ifdef(`SMTP_MAILER_ARGS',, `define(`SMTP_MAILER_ARGS', `IPC $h')')
-ifdef(`ESMTP_MAILER_ARGS',, `define(`ESMTP_MAILER_ARGS', `IPC $h')')
-ifdef(`SMTP8_MAILER_ARGS',, `define(`SMTP8_MAILER_ARGS', `IPC $h')')
-ifdef(`RELAY_MAILER_ARGS',, `define(`RELAY_MAILER_ARGS', `IPC $h')')
-ifdef(`_MAILER_uucp_',
- `errprint(`*** MAILER(smtp) must appear before MAILER(uucp)')')dnl
-POPDIVERT
-#####################################
-### SMTP Mailer specification ###
-#####################################
-
-VERSIONID(`@(#)smtp.m4 8.38 (Berkeley) 5/19/1998')
-
-Msmtp, P=[IPC], F=CONCAT(mDFMuX, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `21/31', `21'), E=\r\n, L=990,
- _OPTINS(`SMTP_MAILER_MAX', `M=', `, ')_OPTINS(`SMTP_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,
- A=SMTP_MAILER_ARGS
-Mesmtp, P=[IPC], F=CONCAT(mDFMuXa, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `21/31', `21'), E=\r\n, L=990,
- _OPTINS(`SMTP_MAILER_MAX', `M=', `, ')_OPTINS(`SMTP_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,
- A=ESMTP_MAILER_ARGS
-Msmtp8, P=[IPC], F=CONCAT(mDFMuX8, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `21/31', `21'), E=\r\n, L=990,
- _OPTINS(`SMTP_MAILER_MAX', `M=', `, ')_OPTINS(`SMTP_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,
- A=SMTP8_MAILER_ARGS
-Mrelay, P=[IPC], F=CONCAT(mDFMuXa8, SMTP_MAILER_FLAGS), S=11/31, R=ifdef(`_ALL_MASQUERADE_', `61/71', `61'), E=\r\n, L=2040,
- _OPTINS(`RELAY_MAILER_CHARSET', `C=', `, ')T=DNS/RFC822/SMTP,
- A=RELAY_MAILER_ARGS
-
-#
-# envelope sender rewriting
-#
-S11
-R$+ $: $>51 $1 sender/recipient common
-R$* :; <@> $@ list:; special case
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>94 $1 do masquerading
-
-
-#
-# envelope recipient rewriting --
-# also header recipient if not masquerading recipients
-#
-S21
-R$+ $: $>51 $1 sender/recipient common
-R$+ $: $>61 $1 qualify unqual'ed names
-
-
-#
-# header sender and masquerading header recipient rewriting
-#
-S31
-R$+ $: $>51 $1 sender/recipient common
-R:; <@> $@ list:; special case
-
-# do special header rewriting
-R$* <@> $* $@ $1 <@> $2 pass null host through
-R< @ $* > $* $@ < @ $1 > $2 pass route-addr through
-R$* $: $>61 $1 qualify unqual'ed names
-R$+ $: $>93 $1 do masquerading
-
-
-#
-# convert pseudo-domain addresses to real domain addresses
-#
-S51
-
-# pass <route-addr>s through
-R< @ $+ > $* $@ < @ $1 > $2 resolve <route-addr>
-
-# output fake domains as user%fake@relay
-ifdef(`BITNET_RELAY',
-`R$+ <@ $+ .BITNET. > $: $1 % $2 .BITNET < @ $B > user@host.BITNET
-R$+.BITNET <@ $+:$+ > $: $1 .BITNET < @ $3 > strip mailer: part',
- `dnl')
-ifdef(`_NO_UUCP_', `dnl', `
-# do UUCP heuristics; note that these are shared with UUCP mailers
-R$+ < @ $+ .UUCP. > $: < $2 ! > $1 convert to UUCP form
-R$+ < @ $* > $* $@ $1 < @ $2 > $3 not UUCP form
-
-# leave these in .UUCP form to avoid further tampering
-R< $&h ! > $- ! $+ $@ $2 < @ $1 .UUCP. >
-R< $&h ! > $-.$+ ! $+ $@ $3 < @ $1.$2 >
-R< $&h ! > $+ $@ $1 < @ $&h .UUCP. >
-R< $+ ! > $+ $: $1 ! $2 < @ $Y > use UUCP_RELAY
-R$+ < @ $+ : $+ > $@ $1 < @ $3 > strip mailer: part
-R$+ < @ > $: $1 < @ *LOCAL* > if no UUCP_RELAY')
-
-
-#
-# common sender and masquerading recipient rewriting
-#
-S61
-
-R$* < @ $* > $* $@ $1 < @ $2 > $3 already fully qualified
-R$+ $@ $1 < @ *LOCAL* > add local qualification
-
-
-#
-# relay mailer header masquerading recipient rewriting
-#
-S71
-
-R$+ $: $>61 $1
-R$+ $: $>93 $1
+++ /dev/null
-PUSHDIVERT(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-ifdef(`USENET_MAILER_PATH',, `define(`USENET_MAILER_PATH', /usr/lib/news/inews)')
-ifdef(`USENET_MAILER_FLAGS',, `define(`USENET_MAILER_FLAGS', `rlsDFMmn')')
-ifdef(`USENET_MAILER_ARGS',, `define(`USENET_MAILER_ARGS', `inews -m -h -n')')
-POPDIVERT
-####################################
-### USENET Mailer specification ###
-####################################
-
-VERSIONID(`@(#)usenet.m4 8.10 (Berkeley) 5/19/1998')
-
-Musenet, P=USENET_MAILER_PATH, F=USENET_MAILER_FLAGS, S=10, R=20,
- _OPTINS(`USENET_MAILER_MAX', `M=', `, ')T=X-Usenet/X-Usenet/X-Unix,
- A=USENET_MAILER_ARGS $u
+++ /dev/null
-PUSHDIVERT(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')
-ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -a$g -gC $h!rmail ($u)')')
-ifdef(`UUCP_MAILER_FLAGS',, `define(`UUCP_MAILER_FLAGS', `')')
-ifdef(`UUCP_MAILER_MAX',,
- `define(`UUCP_MAILER_MAX',
- `ifdef(`UUCP_MAX_SIZE', `UUCP_MAX_SIZE', 100000)')')
-POPDIVERT
-#####################################
-### UUCP Mailer specification ###
-#####################################
-
-VERSIONID(`@(#)uucp.m4 8.30 (Berkeley) 5/19/1998')
-
-#
-# There are innumerable variations on the UUCP mailer. It really
-# is rather absurd.
-#
-
-# old UUCP mailer (two names)
-Muucp, P=UUCP_MAILER_PATH, F=CONCAT(DFMhuUd, UUCP_MAILER_FLAGS), S=12, R=22/42, M=UUCP_MAILER_MAX,
- _OPTINS(`UUCP_MAILER_CHARSET', `C=', `, ')T=X-UUCP/X-UUCP/X-Unix,
- A=UUCP_MAILER_ARGS
-Muucp-old, P=UUCP_MAILER_PATH, F=CONCAT(DFMhuUd, UUCP_MAILER_FLAGS), S=12, R=22/42, M=UUCP_MAILER_MAX,
- _OPTINS(`UUCP_MAILER_CHARSET', `C=', `, ')T=X-UUCP/X-UUCP/X-Unix,
- A=UUCP_MAILER_ARGS
-
-# smart UUCP mailer (handles multiple addresses) (two names)
-Msuucp, P=UUCP_MAILER_PATH, F=CONCAT(mDFMhuUd, UUCP_MAILER_FLAGS), S=12, R=22/42, M=UUCP_MAILER_MAX,
- _OPTINS(`UUCP_MAILER_CHARSET', `C=', `, ')T=X-UUCP/X-UUCP/X-Unix,
- A=UUCP_MAILER_ARGS
-Muucp-new, P=UUCP_MAILER_PATH, F=CONCAT(mDFMhuUd, UUCP_MAILER_FLAGS), S=12, R=22/42, M=UUCP_MAILER_MAX,
- _OPTINS(`UUCP_MAILER_CHARSET', `C=', `, ')T=X-UUCP/X-UUCP/X-Unix,
- A=UUCP_MAILER_ARGS
-
-ifdef(`_MAILER_smtp_',
-`# domain-ized UUCP mailer
-Muucp-dom, P=UUCP_MAILER_PATH, F=CONCAT(mDFMhud, UUCP_MAILER_FLAGS), S=52/31, R=ifdef(`_ALL_MASQUERADE_', `21/31', `21'), M=UUCP_MAILER_MAX,
- _OPTINS(`UUCP_MAILER_CHARSET', `C=', `, ')T=X-UUCP/X-UUCP/X-Unix,
- A=UUCP_MAILER_ARGS
-
-# domain-ized UUCP mailer with UUCP-style sender envelope
-Muucp-uudom, P=UUCP_MAILER_PATH, F=CONCAT(mDFMhud, UUCP_MAILER_FLAGS), S=72/31, R=ifdef(`_ALL_MASQUERADE_', `21/31', `21'), M=UUCP_MAILER_MAX,
- _OPTINS(`UUCP_MAILER_CHARSET', `C=', `, ')T=X-UUCP/X-UUCP/X-Unix,
- A=UUCP_MAILER_ARGS')
-
-
-#
-# envelope and header sender rewriting
-#
-S12
-
-# handle error address as a special case
-R<@> $n errors to mailer-daemon
-
-# list:; syntax should disappear
-R:; <@> $@
-
-R$* < @ $* . > $* $1 < @ $2 > $3 strip trailing dots
-R$* < @ $=w > $1 strip local name
-R<@ $- . UUCP > : $+ $1 ! $2 convert to UUCP format
-R<@ $+ > : $+ $1 ! $2 convert to UUCP format
-R$* < @ $- . UUCP > $2 ! $1 convert to UUCP format
-R$* < @ $+ > $2 ! $1 convert to UUCP format
-R$&h ! $+ ! $+ $@ $1 ! $2 $h!...!user => ...!user
-R$&h ! $+ $@ $&h ! $1 $h!user => $h!user
-R$+ $: $U ! $1 prepend our name
-R! $+ $: $k ! $1 in case $U undefined
-
-#
-# envelope recipient rewriting
-#
-S22
-
-# list:; should disappear
-R:; <@> $@
-
-R$* < @ $* . > $* $1 < @ $2 > $3 strip trailing dots
-R$* < @ $=w > $1 strip local name
-R<@ $- . UUCP > : $+ $1 ! $2 convert to UUCP format
-R<@ $+ > : $+ $1 ! $2 convert to UUCP format
-R$* < @ $- . UUCP > $2 ! $1 convert to UUCP format
-R$* < @ $+ > $2 ! $1 convert to UUCP format
-
-#
-# header recipient rewriting
-#
-S42
-
-# list:; syntax should disappear
-R:; <@> $@
-
-R$* < @ $* . > $* $1 < @ $2 > $3 strip trailing dots
-R$* < @ $=w > $1 strip local name
-R<@ $- . UUCP > : $+ $1 ! $2 convert to UUCP format
-R<@ $+ > : $+ $1 ! $2 convert to UUCP format
-R$* < @ $- . UUCP > $2 ! $1 convert to UUCP format
-R$* < @ $+ > $2 ! $1 convert to UUCP format
-R$&h ! $+ ! $+ $@ $1 ! $2 $h!...!user => ...!user
-R$&h ! $+ $@ $&h ! $1 $h!user => $h!user
-R$+ $: $U ! $1 prepend our name
-R! $+ $: $k ! $1 in case $U undefined
-
-
-ifdef(`_MAILER_smtp_',
-`#
-# envelope sender rewriting for uucp-dom mailer
-#
-S52
-
-# handle error address as a special case
-R<@> $n errors to mailer-daemon
-
-# pass everything to standard SMTP mailer rewriting
-R$* $@ $>11 $1
-
-#
-# envelope sender rewriting for uucp-uudom mailer
-#
-S72
-
-# handle error address as a special case
-R<@> $n errors to mailer-daemon
-
-# do standard SMTP mailer rewriting
-R$* $: $>11 $1
-
-R$* < @ $* . > $* $1 < @ $2 > $3 strip trailing dots
-R<@ $- . UUCP > : $+ $@ $1 ! $2 convert to UUCP format
-R<@ $+ > : $+ $@ $1 ! $2 convert to UUCP format
-R$* < @ $- . UUCP > $@ $2 ! $1 convert to UUCP format
-R$* < @ $+ > $@ $2 ! $1 convert to UUCP format')
-
-
-PUSHDIVERT(4)
-# resolve locally connected UUCP links
-R$* < @ $=Z . UUCP. > $* $#uucp-uudom $@ $2 $: $1 < @ $2 .UUCP. > $3
-R$* < @ $=Y . UUCP. > $* $#uucp-new $@ $2 $: $1 < @ $2 .UUCP. > $3
-R$* < @ $=U . UUCP. > $* $#uucp-old $@ $2 $: $1 < @ $2 .UUCP. > $3
-POPDIVERT
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)aix2.m4 8.8 (Berkeley) 5/19/1998')
-define(`LOCAL_MAILER_PATH', /bin/bellmail)dnl
-define(`LOCAL_MAILER_ARGS', mail $u)dnl
-define(`LOCAL_MAILER_FLAGS', `mn9')dnl
-define(`confEBINDIR', `/usr/lib')dnl
-define(`confTIME_ZONE', `USE_TZ')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)aix3.m4 8.12 (Berkeley) 5/19/1998')
-ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/bellmail)')dnl
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', mail $u)')dnl
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', `mn9')')dnl
-define(`confEBINDIR', `/usr/lib')dnl
-define(`confTIME_ZONE', `USE_TZ')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1996 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)aix4.m4 8.7 (Berkeley) 5/19/1998')
-ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/bellmail)')dnl
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', mail -F $g $u)')dnl
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', `mn9')')dnl
-define(`confEBINDIR', `/usr/lib')dnl
-define(`confTIME_ZONE', `USE_TZ')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1996 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-# Contributed by Tim Rice <tim@trr.metro.NET>.
-#
-
-divert(0)
-VERSIONID(`@(#)altos.m4 8.10 (Berkeley) 10/6/1998')
-
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/lib/mail/aliases'))dnl
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/usr/lib/sendmail.st'))')dnl
-ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')dnl
-ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /usr/bin/lmail)')dnl
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', mPuhCE9)')dnl
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `lmail $u')')dnl
-ifdef(`LOCAL_SHELL_FLAGS',, `define(`LOCAL_SHELL_FLAGS', Peu)')dnl
-ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -a$g $h!rmail ($u)')')dnl
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)amdahl-uts.m4 8.11 (Berkeley) 10/6/1998')
-divert(-1)
-
-define(`ALIAS_FILE', /etc/mail/aliases)
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/etc/mail/sendmail.hf'))')
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/usr/lib/sendmail.st'))')
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', `fSn9')')
-define(`confCW_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/local-host-names', `/etc/mail/sendmail.cw'))
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)aux.m4 8.11 (Berkeley) 10/6/1998')
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/lib/aliases'))dnl
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/usr/lib/sendmail.st'))')dnl
-ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')dnl
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', mn9)')dnl
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -d -r $f $u')')dnl
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)bsd4.3.m4 8.9 (Berkeley) 5/19/1998')
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl
-ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -z -a$g $h!rmail ($u)')')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-#
-
-divert(0)
-VERSIONID(`@(#)bsd4.4.m4 8.10 (Berkeley) 10/6/1998')
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/usr/share/misc/sendmail.hf'))')dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/var/log/sendmail.st'))')dnl
-ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /usr/libexec/mail.local)')dnl
-ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -z -a$g $h!rmail ($u)')')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)bsdi1.0.m4 8.7 (Berkeley) 5/19/1998')dnl
-include(_CF_DIR_`'ostype/bsd4.4.m4)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)bsdi2.0.m4 8.6 (Berkeley) 5/19/1998')dnl
-include(_CF_DIR_`'ostype/bsd4.4.m4)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)dgux.m4 8.10 (Berkeley) 5/19/1998')
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', m9)')dnl
-define(`confTIME_ZONE', `USE_TZ')dnl
-define(`confEBINDIR', `/usr/lib')dnl
-LOCAL_CONFIG
-E_FORCE_MAIL_LOCAL_=yes
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)domainos.m4 8.10 (Berkeley) 10/6/1998')
-divert(-1)
-
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/lib/aliases'))
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/usr/lib/sendmail.st'))')
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)dynix3.2.m4 8.10 (Berkeley) 10/6/1998')
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/lib/aliases'))dnl
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1997 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-#
-
-divert(0)
-VERSIONID(`@(#)gnuhurd.m4 8.8 (Berkeley) 10/6/1998')
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/share/misc/sendmail.hf'))')dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/var/log/sendmail.st'))')dnl
-ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /libexec/mail.local)')dnl
-define(`confEBINDIR', `/libexec')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)hpux10.m4 8.14 (Berkeley) 10/6/1998')
-
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /var/spool/mqueue)')dnl
-define(`ALIAS_FILE', /etc/mail/aliases)dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/etc/mail/sendmail.st'))')dnl
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/usr/share/lib/sendmail.hf'))')dnl
-ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /usr/bin/rmail)')dnl
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', `m9')')dnl
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `rmail -d $u')')dnl
-ifdef(`LOCAL_SHELL_PATH',, `define(`LOCAL_SHELL_PATH', /usr/bin/sh)')dnl
-ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -a$g -gC $h!rmail ($u)')')dnl
-define(`confTIME_ZONE', `USE_TZ')dnl
-dnl
-dnl For maximum compability with HP-UX, use:
-dnl define(`confME_TOO', True)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)hpux9.m4 8.19 (Berkeley) 10/6/1998')
-
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/lib/aliases'))dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/usr/lib/sendmail.st'))')dnl
-ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', `/bin/rmail')')dnl
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', `m9')')dnl
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `rmail -d $u')')dnl
-ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -a$g -gC $h!rmail ($u)')')dnl
-define(`confTIME_ZONE', `USE_TZ')dnl
-define(`confEBINDIR', `/usr/lib')dnl
-dnl
-dnl For maximum compability with HP-UX, use:
-dnl define(`confME_TOO', True)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)irix4.m4 8.14 (Berkeley) 10/6/1998')
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', Ehm9)')dnl
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/lib/aliases'))dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/usr/lib/sendmail.st'))')dnl
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-# Contributed by Kari E. Hurtta <Kari.Hurtta@dionysos.fmi.fi>
-#
-
-#
-# Notes:
-# - SGI's /etc/sendmail.cf defines also 'u' for local mailer flags -- you
-# perhaps don't want it.
-# - Perhaps is should also add define(`LOCAL_MAILER_CHARSET', iso-8859-1)
-# put some Asian sites may prefer otherwise -- or perhaps not.
-# - SGI's /etc/sendmail.cf seems use: A=mail -s -d $u
-# It seems work without that -s however.
-# - SGI's /etc/sendmail.cf set's default uid and gid to 998 (guest)
-# - In SGI seems that TZ variable is needed that correct time is marked to
-# syslog
-# - helpfile is in /etc/sendmail.hf in SGI's /etc/sendmail.cf
-#
-
-divert(0)
-VERSIONID(`@(#)irix5.m4 8.11 (Berkeley) 10/6/1998')
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', Ehmu9)')dnl
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -s -d $u')')dnl
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /var/spool/mqueue)')dnl
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/etc/aliases'))dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/var/sendmail.st'))')dnl
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/etc/sendmail.hf'))')dnl
-define(`confDEF_USER_ID', `998:998')dnl
-define(`confTIME_ZONE', USE_TZ)dnl
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1995 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-# Contributed by Kari E. Hurtta <Kari.Hurtta@dionysos.fmi.fi>
-#
-
-#
-# Notes:
-# - SGI's /etc/sendmail.cf defines also 'u' for local mailer flags -- you
-# perhaps don't want it.
-# - Perhaps is should also add define(`LOCAL_MAILER_CHARSET', iso-8859-1)
-# put some Asian sites may prefer otherwise -- or perhaps not.
-# - SGI's /etc/sendmail.cf seems use: A=mail -s -d $u
-# It seems work without that -s however.
-# - SGI's /etc/sendmail.cf set's default uid and gid to 998 (guest)
-# - In SGI seems that TZ variable is needed that correct time is marked to
-# syslog
-# - helpfile is in /etc/sendmail.hf in SGI's /etc/sendmail.cf
-#
-
-divert(0)
-VERSIONID(`@(#)irix6.m4 8.8 (Berkeley) 10/6/1998')
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', Ehmu9)')dnl
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -s -d $u')')dnl
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /var/spool/mqueue)')dnl
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/etc/aliases'))dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/var/sendmail.st'))')dnl
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/etc/sendmail.hf'))')dnl
-define(`confDEF_USER_ID', `998:998')dnl
-define(`confTIME_ZONE', USE_TZ)dnl
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-#
-
-divert(0)
-VERSIONID(`@(#)isc4.1.m4 8.11 (Berkeley) 10/6/1998')
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/lib/aliases'))dnl
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/usr/lib/sendmail.hf'))')dnl
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `lmail -s $u')')dnl
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', `humS9')')dnl
-ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /bin/lmail)')dnl
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/usr/lib/sendmail.st'))')dnl
-ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -gC $h!rmail ($u)')')dnl
-ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')dnl
-define(`confTIME_ZONE', `USE_TZ')dnl
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)linux.m4 8.7 (Berkeley) 5/19/1998')
-define(`LOCAL_MAILER_PATH', /bin/mail.local)dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1996 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-# Concurrent Computer Corporation Maxion system support contributed
-# by Donald R. Laster Jr. <Laster@access.digex.com>.
-#
-
-divert(0)
-VERSIONID(`@(#)maxion.m4 8.11 (Berkeley) 10/6/1998')
-
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/etc/ucbmail/aliases'))dnl
-define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/etc/ucbmail/sendmail.hf'))dnl
-define(`QUEUE_DIR', `/var/spool/mqueue')dnl
-define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/var/adm/log/sendmail.st'))dnl
-define(`LOCAL_MAILER_PATH', `/usr/bin/mail')dnl
-define(`LOCAL_MAILER_FLAGS',`rmn9')dnl
-define(`LOCAL_SHELL_FLAGS', `ehuP')dnl
-define(`LOCAL_MAILER_ARGS', `mail $u')dnl
-define(`UUCP_MAILER_ARGS', `uux - -r -a$g -gmedium $h!rmail ($u)')dnl
-define(`confEBINDIR', `/usr/ucblib')dnl
-divert(-1)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-# MkLinux support contributed by Paul DuBois <dubois@primate.wisc.edu>
-#
-
-divert(0)
-VERSIONID(`@(#)mklinux.m4 8.8 (Berkeley) 10/6/1998')
-ifdef(`STATUS_FILE',,
- `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/var/log/sendmail.st'))')
-ifdef(`PROCMAIL_MAILER_PATH',,
- define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail'))
-FEATURE(local_procmail)
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)nextstep.m4 8.15 (Berkeley) 10/6/1998')
-define(`ALIAS_FILE', /etc/sendmail/aliases)dnl
-define(`confCW_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/local-host-names', `/etc/sendmail/sendmail.cw'))dnl
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/usr/lib/sendmail.hf'))')dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/etc/sendmail/sendmail.st'))')dnl
-ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')dnl
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', `rmnP9')')dnl
-ifdef(`LOCAL_SHELL_FLAGS',, `define(`LOCAL_SHELL_FLAGS', `euP')')dnl
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-# mail.local is not setuid on OpenBSD 2.4 and higher
-#
-
-divert(0)
-VERSIONID(`@(#)bsd4.4.m4 8.10 (Berkeley) 10/6/1998')
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/usr/share/misc/sendmail.hf'))')dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/var/log/sendmail.st'))')dnl
-ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /usr/libexec/mail.local)')dnl
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', `rmn9S')')dnl
-ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -z -a$g $h!rmail ($u)')')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)osf1.m4 8.11 (Berkeley) 10/6/1998')
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/adm/sendmail/aliases'))dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/usr/adm/sendmail/sendmail.st'))')dnl
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/usr/share/lib/sendmail.hf'))')dnl
-define(`confDEF_USER_ID', `daemon')
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)powerux.m4 8.8 (Berkeley) 10/6/1998')
-
-define(`ALIAS_FILE', /etc/mail/aliases)dnl
-ifdef(`HELP_FILE',,`define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/etc/mail/sendmail.hf'))')dnl
-ifdef(`STATUS_FILE',,`define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/etc/mail/sendmail.st'))')dnl
-define(`LOCAL_MAILER_PATH', `/usr/bin/rmail')dnl
-define(`LOCAL_MAILER_FLAGS', `mn9')dnl
-define(`LOCAL_MAILER_ARGS', `rmail $u')dnl
-define(`LOCAL_SHELL_FLAGS', `ehuP')dnl
-define(`UUCP_MAILER_ARGS', `uux - -r -a$g -gmedium $h!rmail ($u)')dnl
-define(`confEBINDIR', `/usr/local/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1994 Eric P. Allman. All rights reserved.
-# Copyright (c) 1994
-# 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.
-#
-#
-
-# Support for DYNIX/ptx 2.x.
-
-divert(0)
-VERSIONID(`@(#)ptx2.m4 8.12 (Berkeley) 10/6/1998')
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/lib/aliases'))dnl
-ifdef(`HELP_FILE',,`define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/usr/lib/sendmail.hf'))')dnl
-ifdef(`STATUS_FILE',,`define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/usr/lib/sendmail.st'))')dnl
-define(`LOCAL_MAILER_PATH', `/bin/mail')dnl
-define(`LOCAL_MAILER_FLAGS', `fmn9')dnl
-define(`LOCAL_SHELL_FLAGS', `eu')dnl
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1997 Eric P. Allman. 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.
-#
-#
-# Contributed by Glen McCready <glen@qnx.com>
-#
-
-divert(0)
-VERSIONID(`@(#)qnx.m4 8.8 (Berkeley) 10/6/1998')
-define(`QUEUE_DIR', /usr/spool/mqueue)dnl
-define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/etc/sendmail.hf'))dnl
-define(`LOCAL_MAILER_ARGS', `mail $u')dnl
-define(`LOCAL_MAILER_FLAGS', `Sh')dnl
-define(`LOCAL_MAILER_PATH', /usr/bin/mailx)dnl
-define(`UUCP_MAILER_ARGS', `uux - -r -z -a$f $h!rmail ($u)')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)riscos4.5.m4 8.11 (Berkeley) 10/6/1998')
-
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `rmail -d $u')')dnl
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/lib/aliases'))dnl
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', `/usr/spool/mqueue')')dnl
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/usr/lib/sendmail.hf'))')dnl
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-# SCO UnixWare 2.1.2 ostype file
-#
-# Contributed by Christopher Durham <chrisdu@SCO.COM> of SCO.
-#
-divert(0)
-VERSIONID(`@(#)sco-uw-2.1.m4 8.8 (Berkeley) 1/25/1999')
-
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/lib/mail/aliases'))dnl
-ifdef(`HELP_FILE',,`define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/usr/ucblib/sendmail.hf'))')dnl
-ifdef(`STATUS_FILE',,`define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/usr/ucblib/sendmail.st'))')dnl
-define(`LOCAL_MAILER_PATH', `/usr/bin/rmail')dnl
-define(`LOCAL_MAILER_FLAGS', `fhCEn9')dnl
-define(`LOCAL_SHELL_FLAGS', `ehuP')dnl
-define(`UUCP_MAILER_ARGS', `uux - -r -a$g -gmedium $h!rmail ($u)')dnl
-define(`LOCAL_MAILER_ARGS',`rmail $u')dnl
-define(`confEBINDIR', `/usr/lib')dnl
-define(`confTIME_ZONE', `USE_TZ')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)sco3.2.m4 8.11 (Berkeley) 10/6/1998')
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/lib/mail/aliases'))dnl
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/usr/lib/sendmail.st'))')dnl
-ifdef(`UUCP_MAILER_PATH',, `define(`UUCP_MAILER_PATH', /usr/bin/uux)')dnl
-ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', /usr/bin/lmail)')dnl
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', PuhCE9)')dnl
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `lmail $u')')dnl
-ifdef(`LOCAL_SHELL_FLAGS',, `define(`LOCAL_SHELL_FLAGS', Peu)')dnl
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1996 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)sinix.m4 8.9 (Berkeley) 10/6/1998')
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /var/spool/mqueue)')dnl
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/etc/aliases'))dnl
-define(`LOCAL_MAILER_PATH', `/bin/mail.local')dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/var/sendmail.st'))')dnl
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/etc/sendmail.hf'))')dnl
-define(`confEBINDIR', `/usr/ucblib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)solaris2.m4 8.16 (Berkeley) 10/6/1998')
-divert(-1)
-
-define(`ALIAS_FILE', /etc/mail/aliases)
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/etc/mail/sendmail.hf'))')
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/etc/mail/sendmail.st'))')
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', `SnE9')')
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail -f $g -d $u')')
-ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -a$g $h!rmail ($u)')')
-define(`confCW_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/local-host-names', `/etc/mail/sendmail.cw'))
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-# This ostype file is suitable for use on Solaris 2.x systems that
-# have mail.local installed. It is my understanding that this is
-# standard as of Solaris 2.5.
-#
-
-divert(0)
-VERSIONID(`@(#)solaris2.ml.m4 8.9 (Berkeley) 10/6/1998')
-divert(-1)
-
-define(`ALIAS_FILE', /etc/mail/aliases)
-ifdef(`HELP_FILE',, `define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/etc/mail/sendmail.hf'))')
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/etc/mail/sendmail.st'))')
-ifdef(`LOCAL_MAILER_PATH',, `define(`LOCAL_MAILER_PATH', `/usr/lib/mail.local')')
-ifdef(`LOCAL_MAILER_FLAGS',, `define(`LOCAL_MAILER_FLAGS', `fSmn9')')
-ifdef(`LOCAL_MAILER_ARGS',, `define(`LOCAL_MAILER_ARGS', `mail.local -d $u')')
-ifdef(`UUCP_MAILER_ARGS',, `define(`UUCP_MAILER_ARGS', `uux - -r -a$g $h!rmail ($u)')')
-define(`confCW_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/local-host-names', `/etc/mail/sendmail.cw'))
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)sunos3.5.m4 8.7 (Berkeley) 5/19/1998')
-
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)sunos4.1.m4 8.7 (Berkeley) 5/19/1998')
-
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)svr4.m4 8.11 (Berkeley) 10/6/1998')
-
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/ucblib/aliases'))dnl
-ifdef(`HELP_FILE',,`define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/usr/ucblib/sendmail.hf'))')dnl
-ifdef(`STATUS_FILE',,`define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/usr/ucblib/sendmail.st'))')dnl
-define(`LOCAL_MAILER_PATH', `/usr/ucblib/binmail')dnl
-define(`LOCAL_MAILER_FLAGS', `rmn9')dnl
-define(`LOCAL_SHELL_FLAGS', `ehuP')dnl
-define(`UUCP_MAILER_ARGS', `uux - -r -a$g -gmedium $h!rmail ($u)')dnl
-define(`confEBINDIR', `/usr/ucblib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)ultrix4.m4 8.8 (Berkeley) 5/19/1998')
-
-define(`confEBINDIR', `/usr/lib')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)unixware7.m4 8.2 (Berkeley) 1/25/1999')
-define(`ALIAS_FILE', `/etc/mail/aliases')dnl
-ifdef(`QUEUE_DIR',, `define(`QUEUE_DIR', /usr/spool/mqueue)')dnl
-ifdef(`STATUS_FILE',, `define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/etc/mailer/sendmail.st'))')dnl
-define(`confEBINDIR', `/usr/lib')dnl
-define(`confTIME_ZONE', `USE_TZ')dnl
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-
-divert(0)
-VERSIONID(`@(#)unknown.m4 8.6 (Berkeley) 5/19/1998')
-errprint(`*** ERROR: You have not specified a valid operating system type.')
-errprint(` Use the OSTYPE macro to select a valid system type. This')
-errprint(` is necessary in order to get the proper pathnames and flags')
-errprint(` appropriate for your environment.')
+++ /dev/null
-divert(-1)
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-# Definitions for UXP/DS (Fujitsu/ICL DS/90 series)
-# Diego R. Lopez, CICA (Seville). 1995
-#
-
-divert(0)
-VERSIONID(`@(#)uxpds.m4 8.10 (Berkeley) 10/6/1998')
-
-define(`confDEF_GROUP_ID', `6')
-define(`ALIAS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/aliases', `/usr/ucblib/aliases'))dnl
-ifdef(`HELP_FILE',,`define(`HELP_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/helpfile', `/usr/ucblib/sendmail.hf'))')dnl
-ifdef(`STATUS_FILE',,`define(`STATUS_FILE', ifdef(`_USE_ETC_MAIL_', `/etc/mail/statistics', `/usr/ucblib/sendmail.st'))')dnl
-define(`LOCAL_MAILER_PATH', `/usr/ucblib/binmail')dnl
-define(`LOCAL_MAILER_FLAGS', `rmn9')dnl
-define(`LOCAL_SHELL_FLAGS', `ehuP')dnl
-define(`UUCP_MAILER_ARGS', `uux - -r -a$f -gmedium $h!rmail ($u)')dnl
-define(`confEBINDIR', `/usr/ucblib')dnl
+++ /dev/null
-#!/bin/sh
-#
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988, 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.
-#
-#
-# @(#)makeinfo.sh 8.11 (Berkeley) 5/19/1998
-#
-
-usewhoami=0
-usehostname=0
-for p in `echo $PATH | sed 's/:/ /g'`
-do
- if [ "x$p" = "x" ]
- then
- p="."
- fi
- if [ -f $p/whoami ]
- then
- usewhoami=1
- if [ $usehostname -ne 0 ]
- then
- break;
- fi
- fi
- if [ -f $p/hostname ]
- then
- usehostname=1
- if [ $usewhoami -ne 0 ]
- then
- break;
- fi
- fi
-done
-if [ $usewhoami -ne 0 ]
-then
- user=`whoami`
-else
- user=$LOGNAME
-fi
-
-if [ $usehostname -ne 0 ]
-then
- host=`hostname`
-else
- host=`uname -n`
-fi
-echo '#####' built by $user@$host on `date`
-echo '#####' in `pwd` | sed 's/\/tmp_mnt//'
-echo '#####' using $1 as configuration include directory | sed 's/\/tmp_mnt//'
-echo "define(\`__HOST__', $host)dnl"
+++ /dev/null
-SITE(contessa)
-SITE(emind)
-SITE(hoptoad)
-SITE(nkainc)
-SITE(well)
-SITE(ferdy)
+++ /dev/null
-SITE(endotsew)
-SITE(fateman)
-SITE(interlan)
-SITE(metron)
+++ /dev/null
-SITE(Padova)
-SITE(Shasta)
-SITE(alice)
-SITE(allegra)
-SITE(amdcad)
-SITE(att)
-SITE(attunix)
-SITE(avsd)
-SITE(bellcore bellcor)
-SITE(calma)
-SITE(cithep)
-SITE(cnmat)
-SITE(craig)
-SITE(craylab)
-SITE(decusj)
-SITE(decvax, S)
-SITE(decwrl)
-SITE(dssovax)
-SITE(eagle)
-SITE(ecovax)
-SITE(floyd)
-SITE(franz)
-SITE(geoff)
-SITE(harpo)
-SITE(ho3e2)
-SITE(hpda)
-SITE(hplabs)
-SITE(ibmsupt ibmuupa ibmpa)
-SITE(iiasa70)
-SITE(imagen)
-SITE(isunix menlo70)
-SITE(kentmth)
-SITE(lbl-csam lbl-csa)
-SITE(lime)
-SITE(mothra)
-SITE(mseonyx)
-SITE(mtxinu)
-SITE(pixar)
-SITE(pur-ee)
-SITE(purdue)
-SITE(pwbd)
-SITE(sdcarl)
-SITE(sftig)
-SITE(sgi olympus)
-SITE(sii)
-SITE(srivisi)
-SITE(ssyx)
-SITE(sun)
-SITE(trwrb)
-SITE(twg)
-SITE(ucivax)
-SITE(ucla-se)
-SITE(ucla-cs)
-SITE(ucsbcsl ucsbhub)
-SITE(ucscc)
-SITE(ucsd)
-SITE(ucsfcgl)
-SITE(ucsfmis)
-SITE(ulysses)
-SITE(unisoft)
-SITE(unmvax)
-SITE(usenix)
-SITE(uw)
-SITE(uwvax)
-SITE(vax135)
-SITE(voder)
-SITE(wheps)
-SITE(whuxle)
-SITE(whuxlj)
-SITE(xicomp)
-SITE(xprin)
-SITE(zehntel)
-SITE(zilog)
+++ /dev/null
-Everything in this directory (except this file) has been contributed.
-We will not fix bugs in these programs. Contact the original author
-for assistance.
-
-Some of these are patches to sendmail itself. You may need to take
-care -- some of the patches may be out of date with the latest release
-of sendmail. Also, the previous comment applies -- patches belong to
-the original author, not to me.
-
-Eric Allman, 26 May 1993
+++ /dev/null
-/*
- * By John G. Myers, jgm+@cmu.edu
- * Version 1.2
- *
- * Process a BITNET "internet.listing" file, producing output
- * suitable for input to makemap.
- *
- * The input file can be obtained via anonymous FTP to bitnic.educom.edu.
- * Change directory to "netinfo" and get the file internet.listing
- * The file is updated monthly.
- *
- * Feed the output of this program to "makemap hash /etc/bitdomain.db"
- * to create the table used by the "FEATURE(bitdomain)" config file macro.
- * If your sendmail does not have the db library compiled in, you can instead
- * use "makemap dbm /etc/bitdomain" and
- * "FEATURE(bitdomain,`dbm -o /etc/bitdomain')"
- *
- * The bitdomain table should be rebuilt monthly.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-#include <netdb.h>
-#include <ctype.h>
-#include <string.h>
-
-/* don't use sizeof because sizeof(long) is different on 64-bit machines */
-#define SHORTSIZE 2 /* size of a short (really, must be 2) */
-#define LONGSIZE 4 /* size of a long (really, must be 4) */
-
-typedef union
-{
- HEADER qb1;
- char qb2[PACKETSZ];
-} querybuf;
-
-extern int h_errno;
-extern char *malloc();
-extern char *optarg;
-extern int optind;
-
-char *lookup();
-
-main(argc, argv)
-int argc;
-char **argv;
-{
- int opt;
-
- while ((opt = getopt(argc, argv, "o:")) != EOF) {
- switch (opt) {
- case 'o':
- if (!freopen(optarg, "w", stdout)) {
- perror(optarg);
- exit(1);
- }
- break;
-
- default:
- fprintf(stderr, "usage: %s [-o outfile] [internet.listing]\n",
- argv[0]);
- exit(1);
- }
- }
-
- if (optind < argc) {
- if (!freopen(argv[optind], "r", stdin)) {
- perror(argv[optind]);
- exit(1);
- }
- }
- readfile(stdin);
- finish();
- exit(0);
-}
-
-/*
- * Parse and process an input file
- */
-readfile(infile)
-FILE *infile;
-{
- int skippingheader = 1;
- char buf[1024], *node, *hostname, *p;
-
- while (fgets(buf, sizeof(buf), infile)) {
- for (p = buf; *p && isspace(*p); p++);
- if (!*p) {
- skippingheader = 0;
- continue;
- }
- if (skippingheader) continue;
-
- node = p;
- for (; *p && !isspace(*p); p++) {
- if (isupper(*p)) *p = tolower(*p);
- }
- if (!*p) {
- fprintf(stderr, "%-8s: no domain name in input file\n", node);
- continue;
- }
- *p++ = '\0';
-
- for (; *p && isspace(*p); p++) ;
- if (!*p) {
- fprintf(stderr, "%-8s no domain name in input file\n", node);
- continue;
- }
-
- hostname = p;
- for (; *p && !isspace(*p); p++) {
- if (isupper(*p)) *p = tolower(*p);
- }
- *p = '\0';
-
- /* Chop off any trailing .bitnet */
- if (strlen(hostname) > 7 &&
- !strcmp(hostname+strlen(hostname)-7, ".bitnet")) {
- hostname[strlen(hostname)-7] = '\0';
- }
- entry(node, hostname, sizeof(buf)-(hostname - buf));
- }
-}
-
-/*
- * Process a single entry in the input file.
- * The entry tells us that "node" expands to "domain".
- * "domain" can either be a domain name or a bitnet node name
- * The buffer pointed to by "domain" may be overwritten--it
- * is of size "domainlen".
- */
-entry(node, domain, domainlen)
-char *node;
-char *domain;
-char *domainlen;
-{
- char *otherdomain, *p, *err;
-
- /* See if we have any remembered information about this node */
- otherdomain = lookup(node);
-
- if (otherdomain && strchr(otherdomain, '.')) {
- /* We already have a domain for this node */
- if (!strchr(domain, '.')) {
- /*
- * This entry is an Eric Thomas FOO.BITNET kludge.
- * He doesn't want LISTSERV to do transitive closures, so we
- * do them instead. Give the the domain expansion for "node"
- * (which is in "otherdomian") to FOO (which is in "domain")
- * if "domain" doesn't have a domain expansion already.
- */
- p = lookup(domain);
- if (!p || !strchr(p, '.')) remember(domain, otherdomain);
- }
- }
- else {
- if (!strchr(domain, '.') || valhost(domain, domainlen)) {
- remember(node, domain);
- if (otherdomain) {
- /*
- * We previously mapped the node "node" to the node
- * "otherdomain". If "otherdomain" doesn't already
- * have a domain expansion, give it the expansion "domain".
- */
- p = lookup(otherdomain);
- if (!p || !strchr(p, '.')) remember(otherdomain, domain);
- }
- }
- else {
- switch (h_errno) {
- case HOST_NOT_FOUND:
- err = "not registered in DNS";
- break;
-
- case TRY_AGAIN:
- err = "temporary DNS lookup failure";
- break;
-
- case NO_RECOVERY:
- err = "non-recoverable nameserver error";
- break;
-
- case NO_DATA:
- err = "registered in DNS, but not mailable";
- break;
-
- default:
- err = "unknown nameserver error";
- break;
- }
-
- fprintf(stderr, "%-8s %s %s\n", node, domain, err);
- }
- }
-}
-
-/*
- * Validate whether the mail domain "host" is registered in the DNS.
- * If "host" is a CNAME, it is expanded in-place if the expansion fits
- * into the buffer of size "hbsize". Returns nonzero if it is, zero
- * if it is not. A BIND error code is left in h_errno.
- */
-int
-valhost(host, hbsize)
- char *host;
- int hbsize;
-{
- register u_char *eom, *ap;
- register int n;
- HEADER *hp;
- querybuf answer;
- int ancount, qdcount;
- int ret;
- int type;
- int qtype;
- char nbuf[1024];
-
- if ((_res.options & RES_INIT) == 0 && res_init() == -1)
- return (0);
-
- _res.options &= ~(RES_DNSRCH|RES_DEFNAMES);
- _res.retrans = 30;
- _res.retry = 10;
-
- qtype = T_ANY;
-
- for (;;) {
- h_errno = NO_DATA;
- ret = res_querydomain(host, "", C_IN, qtype,
- &answer, sizeof(answer));
- if (ret <= 0)
- {
- if (errno == ECONNREFUSED || h_errno == TRY_AGAIN)
- {
- /* the name server seems to be down */
- h_errno = TRY_AGAIN;
- return 0;
- }
-
- if (h_errno != HOST_NOT_FOUND)
- {
- /* might have another type of interest */
- if (qtype == T_ANY)
- {
- qtype = T_A;
- continue;
- }
- else if (qtype == T_A)
- {
- qtype = T_MX;
- continue;
- }
- }
-
- /* otherwise, no record */
- return 0;
- }
-
- /*
- ** This might be a bogus match. Search for A, MX, or
- ** CNAME records.
- */
-
- hp = (HEADER *) &answer;
- ap = (u_char *) &answer + sizeof(HEADER);
- eom = (u_char *) &answer + ret;
-
- /* skip question part of response -- we know what we asked */
- for (qdcount = ntohs(hp->qdcount); qdcount--; ap += ret + QFIXEDSZ)
- {
- if ((ret = dn_skipname(ap, eom)) < 0)
- {
- return 0; /* ???XXX??? */
- }
- }
-
- for (ancount = ntohs(hp->ancount); --ancount >= 0 && ap < eom; ap += n)
- {
- n = dn_expand((u_char *) &answer, eom, ap,
- (u_char *) nbuf, sizeof nbuf);
- if (n < 0)
- break;
- ap += n;
- GETSHORT(type, ap);
- ap += SHORTSIZE + LONGSIZE;
- GETSHORT(n, ap);
- switch (type)
- {
- case T_MX:
- case T_A:
- return 1;
-
- case T_CNAME:
- /* value points at name */
- if ((ret = dn_expand((u_char *)&answer,
- eom, ap, (u_char *)nbuf, sizeof(nbuf))) < 0)
- break;
- if (strlen(nbuf) < hbsize) {
- (void)strcpy(host, nbuf);
- }
- return 1;
-
- default:
- /* not a record of interest */
- continue;
- }
- }
-
- /*
- ** If this was a T_ANY query, we may have the info but
- ** need an explicit query. Try T_A, then T_MX.
- */
-
- if (qtype == T_ANY)
- qtype = T_A;
- else if (qtype == T_A)
- qtype = T_MX;
- else
- return 0;
- }
-}
-
-struct entry {
- struct entry *next;
- char *node;
- char *domain;
-};
-struct entry *firstentry;
-
-/*
- * Find any remembered information about "node"
- */
-char *lookup(node)
-char *node;
-{
- struct entry *p;
-
- for (p = firstentry; p; p = p->next) {
- if (!strcmp(node, p->node)) {
- return p->domain;
- }
- }
- return 0;
-}
-
-/*
- * Mark the node "node" as equivalent to "domain". "domain" can either
- * be a bitnet node or a domain name--if it is the latter, the mapping
- * will be written to stdout.
- */
-remember(node, domain)
-char *node;
-char *domain;
-{
- struct entry *p;
-
- if (strchr(domain, '.')) {
- fprintf(stdout, "%-8s %s\n", node, domain);
- }
-
- for (p = firstentry; p; p = p->next) {
- if (!strcmp(node, p->node)) {
- p->domain = malloc(strlen(domain)+1);
- if (!p->domain) {
- goto outofmemory;
- }
- strcpy(p->domain, domain);
- return;
- }
- }
-
- p = (struct entry *)malloc(sizeof(struct entry));
- if (!p) goto outofmemory;
-
- p->next = firstentry;
- firstentry = p;
- p->node = malloc(strlen(node)+1);
- p->domain = malloc(strlen(domain)+1);
- if (!p->node || !p->domain) goto outofmemory;
- strcpy(p->node, node);
- strcpy(p->domain, domain);
- return;
-
- outofmemory:
- fprintf(stderr, "Out of memory\n");
- exit(1);
-}
-
-/*
- * Walk through the database, looking for any cases where we know
- * node FOO is equivalent to node BAR and node BAR has a domain name.
- * For those cases, give FOO the same domain name as BAR.
- */
-finish()
-{
- struct entry *p;
- char *domain;
-
- for (p = firstentry; p; p = p->next) {
- if (!strchr(p->domain, '.') && (domain = lookup(p->domain))) {
- remember(p->node, domain);
- }
- }
-}
-
+++ /dev/null
-Return-Path: sanders@austin.BSDI.COM
-Received: from hofmann.CS.Berkeley.EDU (hofmann.CS.Berkeley.EDU [128.32.34.35]) by orodruin.CS.Berkeley.EDU (8.6.9/8.7.0.Beta0) with ESMTP id KAA28278 for <eric@orodruin.CS.Berkeley.EDU>; Sat, 10 Dec 1994 10:49:08 -0800
-Received: from austin.BSDI.COM (austin.BSDI.COM [137.39.95.2]) by hofmann.CS.Berkeley.EDU (8.6.9/8.6.6.Beta11) with ESMTP id KAA09482 for <eric@cs.berkeley.edu>; Sat, 10 Dec 1994 10:49:03 -0800
-Received: from austin.BSDI.COM (sanders@localhost [127.0.0.1]) by austin.BSDI.COM (8.6.9/8.6.9) with ESMTP id MAA14919 for <eric@cs.berkeley.edu>; Sat, 10 Dec 1994 12:49:01 -0600
-Message-Id: <199412101849.MAA14919@austin.BSDI.COM>
-To: Eric Allman <eric@cs.berkeley.edu>
-Subject: Re: sorting mailings lists with fastest delivery users first
-In-reply-to: Your message of Sat, 10 Dec 1994 08:25:30 PST.
-References: <199412101625.IAA15407@mastodon.CS.Berkeley.EDU>
-From: Tony Sanders <sanders@bsdi.com>
-Organization: Berkeley Software Design, Inc.
-Date: Sat, 10 Dec 1994 12:49:00 -0600
-Sender: sanders@austin.BSDI.COM
-
-(some random text deleted)
-
-I'll send you something else I've hacked up. You are free to use this
-or do with it as you like (I hereby make all my parts public domain).
-It's a sample .mc file that has comments (mostly taken from the README)
-and examples describing most of the common things people need to setup.
-
-#
-# /usr/share/sendmail/cf/sample.mc
-#
-# Do not edit /etc/sendmail.cf directly unless you cannot do what you
-# want in the master config file (/usr/share/sendmail/cf/sample.mc).
-# To create /etc/sendmail.cf from the master:
-# cd /usr/share/sendmail/cf
-# mv /etc/sendmail.cf /etc/sendmail.cf.save
-# m4 < sample.mc > /etc/sendmail.cf
-#
-# Then kill and restart sendmail:
-# sh -c 'set `cat /var/run/sendmail.pid`; kill $1; shift; eval "$@"'
-#
-# See /usr/share/sendmail/README for help in building a configuration file.
-#
-include(`../m4/cf.m4')
-VERSIONID(`@(#)$Id: bsdi.mc,v 1.3 1998/07/12 19:43:44 millert Exp $')
-
-dnl # Specify your OS type below
-OSTYPE(`bsd4.4')
-
-dnl # NOTE: `dnl' is the m4 command for delete-to-newline; these are
-dnl # used to prevent those lines from appearing in the sendmail.cf.
-dnl #
-dnl # UUCP-only sites should configure FEATURE(`nodns') and SMART_HOST.
-dnl # The uucp-dom mailer requires MAILER(smtp). For more info, see
-dnl # `UUCP Config' at the end of this file.
-
-dnl # If you are not running DNS at all, it is important to use
-dnl # FEATURE(nodns) to avoid having sendmail queue everything
-dnl # waiting for the name server to come up.
-dnl # Example:
-dnl FEATURE(`nodns')
-
-dnl # Use FEATURE(`nocanonify') to skip address canonification via $[ ... $].
-dnl # This would generally only be used by sites that only act as mail gateways
-dnl # or which have user agents that do full canonification themselves.
-dnl # You may also want to use:
-dnl # define(`confBIND_OPTS',`-DNSRCH -DEFNAMES')
-dnl # to turn off the usual resolver options that do a similar thing.
-dnl # Examples:
-dnl FEATURE(`nocanonify')
-dnl define(`confBIND_OPTS',`-DNSRCH -DEFNAMES')
-
-dnl # If /bin/hostname is not set to the FQDN (Full Qualified Domain Name;
-dnl # for example, foo.bar.com) *and* you are not running a nameserver
-dnl # (that is, you do not have an /etc/resolv.conf and are not running
-dnl # named) *and* the canonical name for your machine in /etc/hosts
-dnl # (the canonical name is the first name listed for a given IP Address)
-dnl # is not the FQDN version then define NEED_DOMAIN and specify your
-dnl # domain using `DD' (for example, if your hostname is `foo.bar.com'
-dnl # then use DDbar.com). If in doubt, just define it anyway; doesn't hurt.
-dnl # Examples:
-dnl define(`NEED_DOMAIN', `1')
-dnl DDyour.site.domain
-
-dnl # Define SMART_HOST if you want all outgoing mail to go to a central
-dnl # site. SMART_HOST applies to names qualified with non-local names.
-dnl # Example:
-dnl define(`SMART_HOST', `smtp:firewall.bar.com')
-
-dnl # Define MAIL_HUB if you want all incoming mail sent to a
-dnl # centralized hub, as for a shared /var/spool/mail scheme.
-dnl # MAIL_HUB applies to names qualified with the name of the
-dnl # local host (e.g., "eric@foo.bar.com").
-dnl # Example:
-dnl define(`MAIL_HUB', `smtp:mailhub.bar.com')
-
-dnl # LOCAL_RELAY is a site that will handle unqualified names, this is
-dnl # basically for site/company/department wide alias forwarding. By
-dnl # default mail is delivered on the local host.
-dnl # Example:
-dnl define(`LOCAL_RELAY', `smtp:mailgate.bar.com')
-
-dnl # Relay hosts for fake domains: .UUCP .BITNET .CSNET
-dnl # Examples:
-dnl define(`UUCP_RELAY', `mailer:your_relay_host')
-dnl define(`BITNET_RELAY', `mailer:your_relay_host')
-dnl define(`CSNET_RELAY', `mailer:your_relay_host')
-
-dnl # Define `MASQUERADE_AS' is used to hide behind a gateway.
-dnl # add any accounts you wish to be exposed (i.e., not hidden) to the
-dnl # `EXPOSED_USER' list.
-dnl # Example:
-dnl MASQUERADE_AS(`some.other.host')
-
-dnl # If masquerading, EXPOSED_USER defines the list of accounts
-dnl # that retain the local hostname in their address.
-dnl # Example:
-dnl EXPOSED_USER(`postmaster hostmaster webmaster')
-
-dnl # If masquerading is enabled (using MASQUERADE_AS above) then
-dnl # FEATURE(allmasquerade) will cause recipient addresses to
-dnl # masquerade as being from the masquerade host instead of
-dnl # getting the local hostname. Although this may be right for
-dnl # ordinary users, it breaks local aliases that aren't exposed
-dnl # using EXPOSED_USER.
-dnl # Example:
-dnl FEATURE(allmasquerade)
-
-dnl # Include any required mailers
-MAILER(local)
-MAILER(smtp)
-MAILER(uucp)
-
-LOCAL_CONFIG
-# If this machine should be accepting mail as local for other hostnames
-# that are MXed to this hostname then add those hostnames below using
-# a line like:
-# Cw bar.com
-# The most common case where you need this is if this machine is supposed
-# to be accepting mail for the domain. That is, if this machine is
-# foo.bar.com and you have an MX record in the DNS that looks like:
-# bar.com. IN MX 0 foo.bar.com.
-# Then you will need to add `Cw bar.com' to the config file for foo.bar.com.
-# DO NOT add Cw entries for hosts whom you simply store and forward mail
-# for or else it will attempt local delivery. So just because bubba.bar.com
-# is MXed to your machine you should not add a `Cw bubba.bar.com' entry
-# unless you want local delivery and your machine is the highest-priority
-# MX entry (that is is has the lowest preference value in the DNS.
-
-LOCAL_RULE_0
-# `LOCAL_RULE_0' can be used to introduce alternate delivery rules.
-# For example, let's say you accept mail via an MX record for widgets.com
-# (don't forget to add widgets.com to your Cw list, as above).
-#
-# If wigets.com only has an AOL address (widgetsinc) then you could use:
-# R$+ <@ widgets.com.> $#smtp $@aol.com. $:widgetsinc<@aol.com.>
-#
-# Or, if widgets.com was connected to you via UUCP as the UUCP host
-# widgets you might have:
-# R$+ <@ widgets.com.> $#uucp $@widgets $:$1<@widgets.com.>
-
-dnl ###
-dnl ### UUCP Config
-dnl ###
-
-dnl # `SITECONFIG(site_config_file, name_of_site, connection)'
-dnl # site_config_file the name of a file in the cf/siteconfig
-dnl # directory (less the `.m4')
-dnl # name_of_site the actual name of your UUCP site
-dnl # connection one of U, W, X, or Y; where U means the sites listed
-dnl # in the config file are connected locally; W, X, and Y
-dnl # build remote UUCP hub classes ($=W, etc).
-dnl # You will need to create the specific site_config_file in
-dnl # /usr/share/sendmail/siteconfig/site_config_file.m4
-dnl # The site_config_file contains a list of directly connected UUCP hosts,
-dnl # e.g., if you only connect to UUCP site gargoyle then you could just:
-dnl # echo 'SITE(gargoyle)' > /usr/share/sendmail/siteconfig/uucp.foobar.m4
-dnl # Example:
-dnl SITECONFIG(`uucp.foobar', `foobar', U)
-
-dnl # If you are on a local SMTP-based net that connects to the outside
-dnl # world via UUCP, you can use LOCAL_NET_CONFIG to add appropriate rules.
-dnl # For example:
-dnl # define(`SMART_HOST', suucp:uunet)
-dnl # LOCAL_NET_CONFIG
-dnl # R$* < @ $* .$m. > $* $#smtp $@ $2.$m. $: $1 < @ $2.$m. > $3
-dnl # This will cause all names that end in your domain name ($m) to be sent
-dnl # via SMTP; anything else will be sent via suucp (smart UUCP) to uunet.
-dnl # If you have FEATURE(nocanonify), you may need to omit the dots after
-dnl # the $m.
-dnl #
-dnl # If you are running a local DNS inside your domain which is not
-dnl # otherwise connected to the outside world, you probably want to use:
-dnl # define(`SMART_HOST', smtp:fire.wall.com)
-dnl # LOCAL_NET_CONFIG
-dnl # R$* < @ $* . > $* $#smtp $@ $2. $: $1 < @ $2. > $3
-dnl # That is, send directly only to things you found in your DNS lookup;
-dnl # anything else goes through SMART_HOST.
+++ /dev/null
-
- Converting Standard Sun Config
- Files to Sendmail Version 8
-
- Rick McCarty
- Texas Instruments Inc.
- Latest Update: 08/25/93 - RJMc
-
-This document details the changes necessary to continue using your
-current SunOS sendmail.cf with sendmail version 8. In the longer term,
-it is recommended that one move to using an m4 based configuration such
-as those shipped with sendmail, but if you're like me and have made
-enough modifications to your .cf file that you'd rather put that task
-off until later, here's the sum total of my experience to get you to
-version 8 with minimal pain. I'll cover .cf as well as build issues.
-
-Some background - as many are surely aware, Sun has some "special"
-features in the sendmail they ship ($%x, %y LHS lookup, NIS alias DB
-search, etc.). (Some of those features can be had in alternative forms
-in IDA sendmail, but v8 has picked up some IDA capabilities as well as
-new ones, making it IMHO a most desirable version to go to.) What I
-will explain below includes v8 functional "equivalences" to these Sun
-sendmail features.
-
-So with that out of the way, let's begin.
-
-First, some assumptions:
-
- 1) I'm going to assume you've got sendmail version 8.6 or
- later in hand - if not, grab it from ftp.cs.berkeley.edu
- in the ucb/sendmail directory. There are bugs in earlier
- versions which affect some of the needed functionality.
-
- 2) Second, I'm going to detail this based upon the
- "sendmail.main.cf" configuration. (BTW, if you attempt
- to move to using an m4 generated config in the future,
- MAIL_HUB is the feature which should provide similar
- functionality).
-
- In general, the changes will be similar for a subsidiary
- file, but since we (my TI group) funnel all non-local mail
- through our mailhost, we're not as interested in getting v8
- to run on such systems and I haven't tried it.
-
- 3) You're using DNS and sendmail.mx. If you're not, you ought
- to be, even if you're also running it along with NIS (which
- we do - except for gethostbyxxx() lookups, which I'll be
- talking about later). I would imagine you could get things
- running OK without DNS support, but I haven't tried it myself.
-
- 4) You're not mounting /var/spool/mail from other systems.
- I haven't found a v8 feature to guarantee this will work
- correctly. Anyway, in the past, we've tried doing that
- here and found it to be a rather "ugly" feature, though
- Sun ostensibly supports it ("R" option). Perhaps v8
- will one day have a similar feature, but for now, bottom
- line, I would recommend against it.
-
- 5) You're not on Solaris or using NIS+. I'm on 4.1.3. I've
- looked at Solaris briefly and have noted that things are
- pretty much similar there except that they've moved some
- things into the /etc/mail directory. I'd guess the
- executables aren't functionally all that different from
- what they had before - the configs are roughly the same.
- So I'd bet most of what I say in here will apply to
- Solaris.
-
-OK, let's configure our sendmail.cf! I'll just go from the top down...
-
- VARIOUS DECLARATIONS
-
-1) For v8, you need to define your .cf as AT LEAST a version level 4
- configuration. Add the following line:
-
- V4
-
- There are some issues regarding certain predefined macros - $w, $j, and
- $m. With a V4 configuration:
-
- $w is defined to be the hostname, which will usually be fully
- qualified (i.e. "firefly.add.itg.ti.com").
-
- $j should have the same value as $w.
-
- $m will be predefined as the domain portion of $w
- (ex. "add.itg.ti.com").
-
- One note about this - if your configuration relies on the "w" macro to
- be the "simple" hostname (as mine does)...
-
- If the configuration version is 5 or larger:
-
- $w is supposed to be the "simple" name (ex. "firefly")
-
- $j should be the fully qualified name (i.e. "firefly.add.itg.ti.com")
-
- $m will be predefined as the domain portion of $j
- (ex. "add.itg.ti.com").
-
- I have not experimented with the various combinations, so I cannot
- guarantee you that the above definitions will always come out as
- expected. Bottom line: if your sendmail.cf depends on $w being the
- simple hostname, test it carefully or define the name explicitly,
- for example:
-
- Dwfirefly
-
-2) To replace the Sun's "%y" feature, we must use a hostname mapping
- feature in v8. If you want to do similar lookups with v8, you need
- to define the following map (we'll go over the rules that use this
- map later):
-
- Khostlookup host -f -m -a.
-
- This will define a "lookup only" map that is otherwise the same as
- sendmail version 8's built-in "host" map (see the "Sendmail
- Installation and Operation Guide" for details on this map.).
-
- An important note: Whether or not these lookups will be done via
- NIS is a function of what gethostbyxxx() functions you link into
- your sendmail. DO NOT redefine your host mapping to use NIS
- explicitly within sendmail - there can be unexpected behaviour if
- you do so (if you do any canonicalization in your .cf, you can get
- incorrect results, for one thing).
-
- For example, DO NOT TRY:
-
- Khost nis -f -a. hosts.byname
-
-3) If you're doing reverse alias mapping as done in ruleset 22, instead of:
-
- DZmail.byaddr
-
- you'll need to declare the following:
-
- Kaliasrev nis -f -N mail.byaddr
-
-4) If you are doing any other NIS map lookups, you'll need to define the
- map as done in the below example. I have a "mailhosts" map, which I
- use to distinguish between local and non-local hosts. Look at the
- sendmail doc for details on this stuff.
-
- Kmailhosts nis -f -m -a. mailhosts
-
-5) You might wish to add the following line to support Errors-To: headers.
- I don't.
-
- Ol
-
-6) Comment out/remove the following line:
-
- OR
-
- The R option means something different under v8 - check the documentation
- if you're interested in using it.
-
-7) If you're running NIS and have a separate alias map, BELOW the
- following line where the alias file is declared:
-
- OA/etc/aliases
-
- ADD the following:
-
- OAnis:mail.aliases
-
- This will set things up so v8 will look at the local alias DB first,
- then the NIS map, just as Sun sendmail does.
-
-8) Though you don't have to, I'd suggest changing:
-
- OT3d
-
- to use v8's warning feature, which allows a warning message to be
- sent if a message cannot be delivered within a specified period.
- I use:
-
- OT5d/4h
-
- which says - bounce after 5 days, warn after 4 hours.
-
-9) I set the following option to be explicit about how I want DNS
- handled:
-
- OI +DNSRCH +DEFNAMES
-
-10) The following line:
-
- T root daemon uucp
-
- may be deleted, though it will be ignored if you leave it around.
-
-11) It would probably be good to change the version macro value (which
- shows up in "Received:" headers) so no one debugging mail problems
- gets the wrong idea about what config you're running under. Look
- for something like:
-
- DVSMI-4.1
-
- Mine, for example is:
-
- DVADD-HUB-2.1
-
- RULESETS
-
-1) In ruleset 3, BELOW this rule:
-
- # basic textual canonicalization
- R$*<$+>$* $2 basic RFC822 parsing
-
-
-I add the following rule to remove a trailing dot in the domain spec so
-it won't interfere with v8 mapping features, etc. (Having a trailing dot is
-not RFC-compliant anyway.):
-
- R$+. $1
-
-2) Because ruleset 5 is special in v8, I rename it to S95 and also change
- all RHS expressions containing ">5" to use ">95" instead. In v8,
- 5 is executed against addresses which resolve to the local mailer and
- are not an alias. If you don't change S5 to something else, you might
- get a surprise!
-
-3) If you're doing any lookups via the generalized NIS "$%x/$!x"
- mechanisms (such as with the mailhost map I referred to earlier) it's
- done differently under v8. For example:
-
- DMmailhosts
- ...
- R$*<@$%M.uucp>$* $#ether $@$2 $:$1<@$2>$3
-
- takes a different map definition and two rules under version 8:
-
- Kmailhosts nis -f -m -a. mailhosts
- ...
- R$*<@$+.uucp>$* $: $1<@$(mailhosts $2 $).uucp>$3
- R$*<@$+..uucp>$* $#ether $@$2 $:$1<@$2>$3
-
-4) Sun has a special case of the "$%x" feature for host lookups - "%y" is
- automagically defined to do an NIS "hosts.byname" search with no other
- definition, as done in the below example:
-
- R$*<@$%y.LOCAL>$* $#ether $@$2 $:$1<@$2>$3
-
- (Sun does this in more than one place. But the above syntax is almost
- identical in each - mostly a case of changing names to protect the
- innocent.)
-
- In version 8, the predefined "host" map can be used to do essentially
- the same thing. (However, whether or not it does an NIS lookup is
- a function of what gethostbyxxx() functions are linked in.)
-
- Recall the map definition I mentioned earlier in the DECLARATIONS
- section:
-
- Khostlookup host -f -m -a.
-
- Here's where we will use it. It will take two rules:
-
- R$*<@$+.LOCAL>$* $: $1<@$(hostlookup $2 $).LOCAL>$3
- R$*<@$+..LOCAL>$* $#ether $@$2 $:$1<@$2>$3
-
- Note that this is almost verbatim the same change as was used in the
- previous "mailhosts" example.
-
-5) Although Sun's default configs don't do this, because I mentioned
- canonicalization earlier, it deserves an example, as it's illustrative
- of the functional difference in the map definitions I discussed before.
- This stuff is also convered in the "Sendmail Installation and Operation
- Guide".
-
- Remember the built-in "host" map definition? As you'll recall, unlike
- the "hostlookup" map we defined, "host" will actually CHANGE the
- hostname in addition to appending a dot. "hostlookup" only appends a
- dot if the name is found and doesn't change it otherwise. Anyway,
- here's the example:
-
- R$*<@$+>$* $: $1<@$(host $2 $)>$3 canonicalize
- R$*<@$+.>$* $1<@$2>$3 remove trailing dot
-
- Using the above, say you had input of:
-
- joe<@tilde>
-
- OR
-
- joe<@[128.247.160.56]>
-
- Assuming "tilde" or the IP address is found, it might be
- canonicalized as:
-
- joe<@tilde.csc.ti.com>
-
-6) As another instance of the NIS lookup feature, with a slightly
- different twist, Sun implements reverse alias mapping in ruleset 22
- with the below:
-
- DZmail.byaddr
- ...
- R$-<@$-> $:$>3${Z$1@$2$} invert aliases
-
- To use this feature under v8, change the above rule a (remember to
- define the alias map as I showed earlier):
-
- R$-<@$-> $:$>3$(aliasrev $1@$2 $) invert aliases
-
-
- MAILER DEFINITIONS
-
-1) Where "TCP" is defined in the "P=" and "A=" parameters of mailers, I
- changed it to "IPC". Version 8 will accept "TCP", but "IPC" is
- preferred.
-
-2) On all IPC mailers, I also defined "E=\r\n" and added an "L=1000" as
- in the below example:
-
- Mether, P=[IPC], F=mDFMuCX, S=11, R=21, L=1000, E=\r\n, A=IPC $h
-
- The "E=\r\n" will save you headaches interoperating with such things as
- VMS TCP products.
-
- The "L=1000" is for RFC821 compatibility. Not strictly necessary.
-
- I also removed the "s" (strip quotes) mailer flag Sun puts in for
- these mailers. Stripping quotes violates protocols, which say
- clearly that you can't touch the local-part (left hand side of
- the @) until you are on the delivering host.
-
-NOW. If I haven't left anything out, you should be able to run through
-your Sun sendmail.cf file and convert it to run under v8.
-
- BUILD ISSUES
-
-Some important notes on building v8 on SunOS:
-
-Makefile
-
-The default makefile in the version 8 source (src) directory assumes the
-new Berkeley make. Unless you want to go to the trouble of building it,
-you can use your regular make, but you need to use a different makefile.
-You can use "Makefile.dist" or "Makefile.SunOS" in the src directory. I
-made changes to get it to build so it is as compatible as possible with
-the file/directory locations Sun uses. Here are some relevant sections
-out of my makefile:
-
- CC=gcc
-
- # use O=-O (usual) or O=-g (debugging)
- O= -O
-
- # define the database mechanisms available for map & alias lookups:
- # -DNDBM -- use new DBM
- # -DNEWDB -- use new Berkeley DB
- # -DNDBM -DNEWDB -DYPCOMPAT -- use both plus YP compatility
- # -DNIS -- include client NIS support
- # The really old (V7) DBM library is no longer supported.
- # See README for a description of how these flags interact.
- #DBMDEF= -DNDBM -DNEWDB
- DBMDEF= -DNDBM -DNIS
-
- # environment definitions (e.g., -D_AIX3)
- ENVDEF=
-
- # see also conf.h for additional compilation flags
-
- # library directories
- LIBDIRS=-L/usr/local/lib
-
- # libraries required on your system
- #LIBS= -ldb -ldbm
- LIBS= -ldbm -lresolv
-
- # location of sendmail binary (usually /usr/sbin or /usr/lib)
- BINDIR= ${DESTDIR}/usr/lib
-
- # location of sendmail.st file (usually /var/log or /usr/lib)
- STDIR= ${DESTDIR}/etc
-
- # location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
- HFDIR= ${DESTDIR}/usr/lib
-
-For the resolver library, you can use the one shipped with Sun if you
-want. But I'd recommend using another version of the resolver library
-(such as the one with Bind 4.8.3 or 4.9). Sun's resolver stuff (at
-least with 4.1.x) is quite old - I believe it is of 4.3.1 vintage. (Do
-you get the impression I don't TRUST what Sun ships with their systems?)
-
-If you want NIS host lookup while maintaining DNS capability, you might
-take a look at resolv+, which has NIS capable gethostbyxxx() functions
-in it. My recommendation, however, is to avoid doing NIS host lookups
-in sendmail altogether, and to use a "pure" version of the resolver
-library.
-
-There are probably no situations (at least I think so) where it makes
-any sense to link in Sun's NIS gethostbyxxx() functions from libc.
-You could, I guess do it (I haven't tried it) and wind up with a
-sendmail equivalent to the non-mx version Sun ships. You'd need to
-insure that NAMED_BIND is not defined in the build. (If you do
-this and have the "-b" DNS passthru option set in NIS, remember that
-while you have some DNS functionality you'll not have any MX support.
-(This, IMO, is what makes this a non-optimal choice.)
-
- INSTALLATION/TESTING ISSUES
-
-The sendmail.hf file in the src directory should replace the one currently
-in /usr/lib. You also might choose to edit it a bit to "localize" what it
-says.
-
-The sendmail executable goes, of course, in /usr/lib in place of the current
-one. What I did was create a subdirectory in /usr/lib and put all of the
-Sun sendmail stuff in there. I named the v8 sendmail executable to be
-sendmail.v8.mx and then symbolically linked it to sendmail.
-
-One other thing. If you use address test mode, keep in mind that
-Version 8 is like IDA in that it does not automatically execute ruleset
-3 first. So say you're playing around with things testing addresses and
-you're used to things like:
-
- 0 jimbob@good.old.boy.com
-
-under v8 you need to say instead:
-
- 3,0 jimbob@good.old.boy.com
-
- INTEROPERABILITY ISSUES YOU MIGHT ENCOUNTER
-
-Be aware that sendmail v8 issues a multi-line SMTP welcome (220)
-response upon a client connection. Most systems in your network should
-handle it OK, but there are some that choke on it, because whoever wrote
-the clients assumed only a single line. THIS IS NOT SENDMAIL's FAULT.
-A multi-line 220 response is perfectly valid. A likely place you'll
-encounter this problem is with non-Un*x SMTP clients. If you do run
-into it, you should report it to the vendor.
-
-A final note about version 8 - if you follow the above configuration
-scenario, you'll notice it doesn't like to get envelope sender
-addresses it doesn't know how to get back to. Sun sendmail would take
-anything, even though it might not be able to bounce the message back
-should something happen downstream. So if another sendmail on a host
-that's not locally known is trying to pump mail through your v8 host,
-the ENVELOPE sender it gives had better be fully qualified. This is
-a GREAT thing, because it helps clear up problems we've had with not
-being able to get things back to the sender, resulting in an
-overburdened postmaster.
-
-I hope this helps those running Sun sendmail feel more at ease with moving
-on to v8. It's really worth going to.
+++ /dev/null
-#!/usr/bin/perl
-# doublebounce.pl
-# attempt to return a doubly-bounced email to a postmaster
-# jr@terra.net, 12/4/97
-#
-# invoke by creating an mail alias such as:
-# doublebounce: "|/usr/local/sbin/doublebounce"
-# then adding this line to your sendmail.cf:
-# O DoubleBounceAddress=doublebounce
-#
-# optionally, add a "-d" flag in the aliases file, to send a
-# debug trace to your own postmaster showing what is going on
-#
-# this allows the "postmaster" address to still go to a human being,
-# while bounce messages can go to this script, which will bounce them
-# back to the postmaster at the sending site.
-#
-# the algorithm is to scan the double-bounce error report generated
-# by sendmail on stdin, for the original message (it starts after the
-# second "Orignal message follows" marker), look for From, Sender, and
-# Received headers from the point closest to the sender back to the point
-# closest to us, and try to deliver a double-bounce report back to a
-# postmaster at one of these sites in the hope that they can
-# return the message to the original sender, or do something about
-# the fact that that sender's return address is not valid.
-
-
-use Socket;
-
-# look for debug flag
-#
-$dflag = 0;
-$dflag = 1 if ($ARGV[0] eq "-d");
-
-# get local host name
-# you may need to edit these two lines for however your system does this
-#
-$host = `hostname`; chop($host);
-$domain = `dnsdomainname`; chop($domain);
-
-# get temp file name
-$tmp = "/tmp/doubb$$";
-
-# save message from STDIN to a file
-# I thought about reading it into a buffer here, but some messages
-# are 10+Mb so a buffer may not be a good idea
-#
-if (! open(MSG, "+> $tmp")) {
- # can't open temp file -- send message to local postmaster
- # open(MAIL, "| /usr/sbin/sendmail -oeq postmaster");
- print MAIL <STDIN>;
- close(MAIL);
- exit(1);
-}
-print MSG <STDIN>;
-
-# scan message for list of possible sender sites
-# note that original message appears after the second
-# "Original message follows" marker
-# look for From, Sender, and Reply-To and try them, too
-#
-$inhdr = 0;
-$hdrs = 0;
-$skip = 0;
-seek(MSG, 0, 0);
-while (<MSG>) {
- chop;
- if (/^ ----- Original message follows -----$/
- || /^ ----Unsent message follows----$/) {
- $i = 0;
- $inhdr = 1;
- $hdrs++;
- $skip = 1;
- next;
- }
- if ($skip) {
- $skip--;
- next;
- }
- if (/^$/) {
- last if ($hdrs >= 2);
- $inhdr = 0;
- next;
- }
- if (! $inhdr) {
- next;
- }
- if (! /^[ \t]/) { $hdr[$i++] = $_ }
- else {
- $i--;
- $hdr[$i++] .= $_;
- }
-}
-$rcvd = 0;
-for ($j = 0; $j < $i; $j++) {
- print STDERR "DEBUG hdr[$j] = $hdr[$j]\n";
- if ($hdr[$j] =~ /^received:/i) {
- ($addr[$rcvd++]) = $hdr[$j] =~ m/.*\sby\s([^\s]+)\s.*/;
- }
- if ($hdr[$j] =~ /^reply-to:/i) {
- ($addr1{"reply-to"} = $hdr[$j]) =~ s/^reply-to: *//i;
- }
- if ($hdr[$j] =~ /^sender:/i) {
- ($addr1{"sender"} = $hdr[$j]) =~ s/^sender: *//i;
- }
- if ($hdr[$j] =~ /^from:/i) {
- ($addr1{"from"} = $hdr[$j]) =~ s/^from: *//i;
- }
-}
-
-# %addr and %addr1 arrays now contain lists of possible sites (or From headers).
-# Go through them parsing for the site name, and attempting to send
-# to the named person or postmaster@ each site in turn until successful
-#
-if ($dflag) {
- open(DEBUG, "|/usr/sbin/sendmail postmaster");
- print DEBUG "Subject: double bounce dialog\n";
-}
-$sent = 0;
-# foreach $x ("from", "sender", "reply-to") {
-foreach $x ("from", "sender") {
- $y = &parseaddr($addr1{$x});
- if ($y) {
- print DEBUG "Trying $y\n" if ($dflag);
- if (&sendbounce("$y")) {
- $sent++;
- last;
- }
- $y =~ s/.*@//;
- print DEBUG "Trying postmaster\@$y\n" if ($dflag);
- if (&sendbounce("postmaster\@$y")) {
- $sent++;
- last;
- }
- }
-}
-if (! $sent) {
- $rcvd--;
- for ($i = $rcvd; $i >= 0; $i--) {
- $y = &parseaddr($addr[$i]);
- $y =~ s/.*@//;
- if ($y) {
- print DEBUG "Trying postmaster\@$y\n" if ($dflag);
- if (&sendbounce("postmaster\@$y")) {
- $sent++;
- last;
- }
- }
- }
-}
-if (! $sent) {
- # queer things are happening to me
- # $addr[0] should be own domain, so we should have just
- # tried postmaster@our.domain. theoretically, we should
- # not get here...
- if ($dflag) {
- print DEBUG "queer things are happening to me\n";
- print DEBUG "Trying postmaster\n";
- }
- &sendbounce("postmaster");
-}
-
-# clean up and get out
-#
-if ($dflag) {
- seek(MSG, 0, 0);
- print DEBUG "\n---\n"; print DEBUG <MSG>;
- close(DEBUG);
-}
-close(MSG);
-unlink("$tmp");
-exit(0);
-
-
-
-
-
-# parseaddr()
-# parse hostname from From: header
-#
-sub parseaddr {
- local($hdr) = @_;
- local($addr);
-
- if ($hdr =~ /<.*>/) {
- ($addr) = $hdr =~ m/<(.*)>/;
- return $addr;
- }
- if ($addr =~ /\s*\(/) {
- ($addr) = $hdr =~ m/\s*(.*)\s*\(/;
- return $addr;
- }
- ($addr) = $hdr =~ m/\s*(.*)\s*/;
- return $addr;
-}
-
-
-# sendbounce()
-# send bounce to postmaster
-#
-# this re-invokes sendmail in immediate and quiet mode to try
-# to deliver to a postmaster. sendmail's exit status tells us
-# wether the delivery attempt really was successful.
-#
-sub sendbounce {
- local($dest) = @_;
- local($st);
-
- open(MAIL, "| /usr/sbin/sendmail -ocn -odi -oeq $dest");
- print MAIL <<EOT;
-From: Mail Delivery Subsystem <mail-router\@$domain>
-Subject: Postmaster notify: double bounce
-Reply-To: nobody\@$domain
-Errors-To: nobody\@$domain
-Precedence: junk
-Auto-Submitted: auto-generated (postmaster notification)
-
-The following message was received at $host.$domain for an invalid
-recipient. The sender's address was also invalid. Since the message
-originated at or transited through your mailer, this notification is being
-sent to you in the hope that you will determine the real originator and
-have them correct their From or Sender address.
-
-The invalid sender address was: $addr1{"from"}.
-
- ----- The following is a double bounce at $host.$domain -----
-
-EOT
- seek(MSG, 0, 0);
- print MAIL <MSG>;
- return close(MAIL);
-}
+++ /dev/null
-#!/usr/local/bin/perl
-'di ';
-'ds 00 \\"';
-'ig 00 ';
-#
-# THIS PROGRAM IS ITS OWN MANUAL PAGE. INSTALL IN man & bin.
-#
-
-# hardcoded constants, should work fine for BSD-based systems
-use Socket;
-use Getopt::Std;
-$sockaddr = 'S n a4 x8';
-
-# system requirements:
-# must have 'hostname' program.
-
-#############################################################################
-# Copyright (c) 1996 John T. Beck <john@beck.org>
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by John T. Beck.
-# 4. The name of John Beck may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY JOHN T. BECK ``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 JOHN T. BECK 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.
-#
-# This copyright notice derived from material copyrighted by the Regents
-# of the University of California.
-#
-# Contributions accepted.
-#############################################################################
-# Further disclaimer: the etrn.pl script was highly leveraged from the
-# expn.pl script which is (C) 1993 David Muir Sharnoff.
-#############################################################################
-
-$port = 'smtp';
-$av0 = $0;
-select(STDERR);
-
-$0 = "$av0 - running hostname";
-chop($name = `hostname || uname -n`);
-
-$0 = "$av0 - lookup host FQDN and IP addr";
-($hostname,$aliases,$type,$len,$thisaddr) = gethostbyname($name);
-
-$0 = "$av0 - parsing args";
-$usage = "Usage: $av0 [-wd] host [args]";
-getopts('dw');
-$watch = $opt_w;
-$debug = $opt_d;
-$server = shift(@ARGV);
-@hosts = @ARGV;
-die $usage unless $server;
-@cwfiles = ();
-
-if (!@hosts) {
- push(@hosts,$hostname);
-
- $0 = "$av0 - parsing sendmail.cf";
- open(CF, "</etc/sendmail.cf") || die "open /etc/sendmail.cf: $!";
- while (<CF>){
- if (/^Fw.*$/){ # look for a line starting with "Fw"
- $cwfile = $_;
- chop($cwfile);
- $optional = /^Fw-o/;
- $cwfile =~ s,^Fw[^/]*,,; # extract the file name
-
- if (-r $cwfile) {
- push (@cwfiles, $cwfile);
- } else {
- die "$cwfile is not readable" unless $optional;
- }
- }
- if (/^Cw(.*)$/){ # look for a line starting with "Cw"
- @cws = split (' ', $1);
- while (@cws) {
- $thishost = shift(@cws);
- push(@hosts, $thishost) unless $thishost =~ "$hostname|localhost";
- }
- }
- }
- close(CF);
-
- for $cwfile (@cwfiles) {
- $0 = "$av0 - reading $cwfile";
- if (open(CW, "<$cwfile")){
- while (<CW>){
- next if /^\#/;
- $thishost = $_;
- chop($thishost);
- push(@hosts, $thishost) unless $thishost =~ $hostname;
- }
- close(CW);
- } else {
- die "open $cwfile: $!";
- }
- }
-}
-
-$0 = "$av0 - building local socket";
-($name,$aliases,$proto) = getprotobyname('tcp');
-($name,$aliases,$port) = getservbyname($port,'tcp')
- unless $port =~ /^\d+/;
-
-# look it up
-$0 = "$av0 - gethostbyname($server)";
-
-($name,$aliases,$type,$len,$thataddr) = gethostbyname($server);
-
-# get a connection
-$0 = "$av0 - socket to $server";
-$that = pack($sockaddr, &AF_INET, $port, $thataddr);
-socket(S, &AF_INET, &SOCK_STREAM, $proto)
- || die "socket: $!";
-$0 = "$av0 - connect to $server";
-print "debug = $debug server = $server\n" if $debug > 8;
-if (! connect(S, $that)) {
- $0 = "$av0 - $server: could not connect: $!\n";
-}
-select((select(S),$| = 1)[0]); # don't buffer output to S
-
-# read the greeting
-$0 = "$av0 - talking to $server";
-&alarm("greeting with $server",'');
-while(<S>) {
- alarm(0);
- print if $watch;
- if (/^(\d+)([- ])/) {
- if ($1 != 220) {
- $0 = "$av0 - bad numeric response from $server";
- &alarm("giving up after bad response from $server",'');
- &read_response($2,$watch);
- alarm(0);
- print STDERR "$server: NOT 220 greeting: $_"
- if ($debug || $watch);
- }
- last if ($2 eq " ");
- } else {
- $0 = "$av0 - bad response from $server";
- print STDERR "$server: NOT 220 greeting: $_"
- if ($debug || $watch);
- close(S);
- }
- &alarm("greeting with $server",'');
-}
-alarm(0);
-
-# if this causes problems, remove it
-$0 = "$av0 - sending helo to $server";
-&alarm("sending ehlo to $server","");
-&ps("ehlo $hostname");
-$etrn_support = 0;
-while(<S>) {
- if (/^250([- ])ETRN(.+)$/){
- $etrn_support = 1;
- }
- print if $watch;
- last if /^\d+ /;
-}
-alarm(0);
-
-if ($etrn_support){
- print "ETRN supported\n" if ($debug);
- &alarm("sending etrn to $server",'');
- while (@hosts) {
- $server = shift(@hosts);
- &ps("etrn $server");
- while(<S>) {
- print if $watch;
- last if /^\d+ /;
- }
- sleep(1);
- }
-} else {
- print "\nETRN not supported\n\n"
-}
-
-&alarm("sending 'quit' to $server",'');
-$0 = "$av0 - sending 'quit' to $server";
-&ps("quit");
-while(<S>) {
- print if $watch;
- last if /^\d+ /;
-}
-close(S);
-alarm(0);
-
-select(STDOUT);
-exit(0);
-
-# print to the server (also to stdout, if -w)
-sub ps
-{
- local($p) = @_;
- print ">>> $p\n" if $watch;
- print S "$p\n";
-}
-
-sub alarm
-{
- local($alarm_action,$alarm_redirect,$alarm_user) = @_;
- alarm(3600);
- $SIG{ALRM} = 'handle_alarm';
-}
-
-sub handle_alarm
-{
- &giveup($alarm_redirect,"Timed out during $alarm_action",$alarm_user);
-}
-
-# read the rest of the current smtp daemon's response (and toss it away)
-sub read_response
-{
- local($done,$watch) = @_;
- local(@resp);
- print $s if $watch;
- while(($done eq "-") && ($s = <S>) && ($s =~ /^\d+([- ])/)) {
- print $s if $watch;
- $done = $1;
- push(@resp,$s);
- }
- return @resp;
-}
-# to pass perl -w:
-@tp;
-$flag_a;
-$flag_d;
-&handle_alarm;
-################### BEGIN PERL/TROFF TRANSITION
-.00 ;
-
-'di
-.nr nl 0-1
-.nr % 0
-.\\"'; __END__
-.\" ############## END PERL/TROFF TRANSITION
-.TH ETRN 1 "January 25, 1997"
-.AT 3
-.SH NAME
-etrn \- start mail queue run
-.SH SYNOPSIS
-.B etrn
-.RI [ -w ]
-.RI [ -d ]
-.IR hostname
-.RI [ args ]
-.SH DESCRIPTION
-.B etrn
-will use the SMTP
-.B etrn
-command to start mail delivery from the host given on the command line.
-.B etrn
-usually sends an
-.B etrn
-for each host the local sendmail accepts e-mail for, but if
-.IR args
-are specified,
-.B etrn
-uses these as arguments for the SMTP
-.B etrn
-commands passed to the host given on the command line.
-.SH OPTIONS
-.LP
-The normal mode of operation for
-.B etrn
-is to do all of its work silently.
-The following options make it more verbose.
-It is not necessary to make it verbose to see what it is
-doing because as it works, it changes its
-.BR argv [0]
-variable to reflect its current activity.
-The
-.IR -w ,
-watch, flag will cause
-.B etrn
-to show you its conversations with the mail daemons.
-The
-.IR -d ,
-debug, flag will expose many of the inner workings so that
-it is possible to eliminate bugs.
-.SH ENVIRONMENT
-No enviroment variables are used.
-.SH FILES
-.B /etc/sendmail.cf
-.SH SEE ALSO
-.BR sendmail (8),
-RFC 1985.
-.SH BUGS
-Not all mail daemons will implement
-.B etrn .
-.LP
-It is assumed that you are running domain names.
-.SH CREDITS
-Leveraged from David Muir Sharnoff's expn.pl script.
-Christian von Roques added support for
-.IR args
-and fixed a couple of bugs.
-.SH AVAILABILITY
-The latest version of
-.B etrn
-is available in the contrib directory of the sendmail
-distribution through anonymous ftp at
-.IR ftp://ftp.sendmail.org/ucb/src/sendmail/ .
-.SH AUTHOR
-.I John T. Beck\ \ \ \ <john@beck.org>
+++ /dev/null
-#!/usr/bin/perl
-'di ';
-'ds 00 \\"';
-'ig 00 ';
-#
-# THIS PROGRAM IS ITS OWN MANUAL PAGE. INSTALL IN man & bin.
-#
-
-use 5.001;
-use IO::Socket;
-
-# system requirements:
-# must have 'nslookup' and 'hostname' programs.
-
-# $Header: /home/cvs/src/usr.sbin/sendmail/contrib/Attic/expn.pl,v 1.5 1998/07/12 19:43:47 millert Exp $
-
-# TODO:
-# less magic should apply to command-line addresses
-# less magic should apply to local addresses
-# add magic to deal with cross-domain cnames
-# disconnect & reconnect after 25 commands to the same sendmail 8.8.* host
-
-# Checklist: (hard addresses)
-# 250 Kimmo Suominen <"|/usr/local/mh/lib/slocal -user kim"@grendel.tac.nyc.ny.us>
-# harry@hofmann.cs.Berkeley.EDU -> harry@tenet (.berkeley.edu) [dead]
-# bks@cs.berkeley.edu -> shiva.CS (.berkeley.edu) [dead]
-# dan@tc.cornell.edu -> brown@tiberius (.tc.cornell.edu)
-
-#############################################################################
-#
-# Copyright (c) 1993 David Muir Sharnoff
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by the David Muir Sharnoff.
-# 4. The name of David Sharnoff may not be used to endorse or promote products
-# derived from this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE DAVID MUIR SHARNOFF ``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 DAVID MUIR SHARNOFF 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.
-#
-# This copyright notice derrived from material copyrighted by the Regents
-# of the University of California.
-#
-# Contributions accepted.
-#
-#############################################################################
-
-# overall structure:
-# in an effort to not trace each address individually, but rather
-# ask each server in turn a whole bunch of questions, addresses to
-# be expanded are queued up.
-#
-# This means that all accounting w.r.t. an address must be stored in
-# various arrays. Generally these arrays are indexed by the
-# string "$addr *** $server" where $addr is the address to be
-# expanded "foo" or maybe "foo@bar" and $server is the hostname
-# of the SMTP server to contact.
-#
-
-# important global variables:
-#
-# @hosts : list of servers still to be contacted
-# $server : name of the current we are currently looking at
-# @users = $users{@hosts[0]} : addresses to expand at this server
-# $u = $users[0] : the current address being expanded
-# $names{"$users[0] *** $server"} : the 'name' associated with the address
-# $mxbacktrace{"$users[0] *** $server"} : record of mx expansion
-# $mx_secondary{$server} : other mx relays at the same priority
-# $domainify_fallback{"$users[0] *** $server"} : alternative names to try
-# instead of $server if $server doesn't work
-# $temporary_redirect{"$users[0] *** $server"} : when trying alternates,
-# temporarily channel all tries along current path
-# $giveup{$server} : do not bother expanding addresses at $server
-# $verbose : -v
-# $watch : -w
-# $vw : -v or -w
-# $debug : -d
-# $valid : -a
-# $levels : -1
-# $S : the socket connection to $server
-
-$have_nslookup = 1; # we have the nslookup program
-$port = 'smtp';
-$av0 = $0;
-$ENV{'PATH'} .= ":/usr/etc" unless $ENV{'PATH'} =~ m,/usr/etc,;
-$ENV{'PATH'} .= ":/usr/ucb" unless $ENV{'PATH'} =~ m,/usr/ucb,;
-select(STDERR);
-
-$0 = "$av0 - running hostname";
-chop($name = `hostname || uname -n`);
-
-$0 = "$av0 - lookup host FQDN and IP addr";
-($hostname,$aliases,$type,$len,$thisaddr) = gethostbyname($name);
-
-$0 = "$av0 - parsing args";
-$usage = "Usage: $av0 [-1avwd] user[\@host] [user2[host2] ...]";
-for $a (@ARGV) {
- die $usage if $a eq "-";
- while ($a =~ s/^(-.*)([1avwd])/$1/) {
- eval '$'."flag_$2 += 1";
- }
- next if $a eq "-";
- die $usage if $a =~ /^-/;
- &expn(&parse($a,$hostname,undef,1));
-}
-$verbose = $flag_v;
-$watch = $flag_w;
-$vw = $flag_v + $flag_w;
-$debug = $flag_d;
-$valid = $flag_a;
-$levels = $flag_1;
-
-die $usage unless @hosts;
-if ($valid) {
- if ($valid == 1) {
- $validRequirement = 0.8;
- } elsif ($valid == 2) {
- $validRequirement = 1.0;
- } elsif ($valid == 3) {
- $validRequirement = 0.9;
- } else {
- $validRequirement = (1 - (1/($valid-3)));
- print "validRequirement = $validRequirement\n" if $debug;
- }
-}
-
-HOST:
-while (@hosts) {
- $server = shift(@hosts);
- @users = split(' ',$users{$server});
- delete $users{$server};
-
- # is this server already known to be bad?
- $0 = "$av0 - looking up $server";
- if ($giveup{$server}) {
- &giveup('mx domainify',$giveup{$server});
- next;
- }
-
- # do we already have an mx record for this host?
- next HOST if &mxredirect($server,*users);
-
- # look it up, or try for an mx.
- $0 = "$av0 - gethostbyname($server)";
-
- ($name,$aliases,$type,$len,$thataddr) = gethostbyname($server);
- # if we can't get an A record, try for an MX record.
- unless($thataddr) {
- &mxlookup(1,$server,"$server: could not resolve name",*users);
- next HOST;
- }
-
- # get a connection, or look for an mx
- $0 = "$av0 - socket to $server";
-
- $S = new IO::Socket::INET (
- 'PeerAddr' => $server,
- 'PeerPort' => $port,
- 'Proto' => 'tcp');
-
- if (! $S || ($debug == 10 && $server =~ /relay\d.UU.NET$/i)) {
- $0 = "$av0 - $server: could not connect: $!\n";
- $emsg = $!;
- unless (&mxlookup(0,$server,"$server: could not connect: $!",*users)) {
- &giveup('mx',"$server: Could not connect: $emsg");
- }
- next HOST;
- }
- $S->autoflush(1);
-
- # read the greeting
- $0 = "$av0 - talking to $server";
- &alarm("greeting with $server",'');
- while(<$S>) {
- alarm(0);
- print if $watch;
- if (/^(\d+)([- ])/) {
- if ($1 != 220) {
- $0 = "$av0 - bad numeric response from $server";
- &alarm("giving up after bad response from $server",'');
- &read_response($2,$watch);
- alarm(0);
- print STDERR "$server: NOT 220 greeting: $_"
- if ($debug || $vw);
- if (&mxlookup(0,$server,"$server: did not respond with a 220 greeting",*users)) {
- close($S);
- next HOST;
- }
- }
- last if ($2 eq " ");
- } else {
- $0 = "$av0 - bad response from $server";
- print STDERR "$server: NOT 220 greeting: $_"
- if ($debug || $vw);
- unless (&mxlookup(0,$server,"$server: did not respond with SMTP codes",*users)) {
- &giveup('',"$server: did not talk SMTP");
- }
- close($S);
- next HOST;
- }
- &alarm("greeting with $server",'');
- }
- alarm(0);
-
- # if this causes problems, remove it
- $0 = "$av0 - sending helo to $server";
- &alarm("sending helo to $server","");
- &ps("helo $hostname");
- while(<$S>) {
- print if $watch;
- last if /^\d+ /;
- }
- alarm(0);
-
- # try the users, one by one
- USER:
- while(@users) {
- $u = shift(@users);
- $0 = "$av0 - expanding $u [\@$server]";
-
- # do we already have a name for this user?
- $oldname = $names{"$u *** $server"};
-
- print &compact($u,$server)." ->\n" if ($verbose && ! $valid);
- if ($valid) {
- #
- # when running with -a, we delay taking any action
- # on the results of our query until we have looked
- # at the complete output. @toFinal stores expansions
- # that will be final if we take them. @toExpn stores
- # expnansions that are not final. @isValid keeps
- # track of our ability to send mail to each of the
- # expansions.
- #
- @isValid = ();
- @toFinal = ();
- @toExpn = ();
- }
-
-# ($ecode,@expansion) = &expn_vrfy($u,$server);
- (@foo) = &expn_vrfy($u,$server);
- ($ecode,@expansion) = @foo;
- if ($ecode) {
- &giveup('',$ecode,$u);
- last USER;
- }
-
- for $s (@expansion) {
- $s =~ s/[\n\r]//g;
- $0 = "$av0 - parsing $server: $s";
-
- $skipwatch = $watch;
-
- if ($s =~ /^[25]51([- ]).*<(.+)>/) {
- print "$s" if $watch;
- print "(pretending 250$1<$2>)" if ($debug && $watch);
- print "\n" if $watch;
- $s = "250$1<$2>";
- $skipwatch = 0;
- }
-
- if ($s =~ /^250([- ])(.+)/) {
- print "$s\n" if $skipwatch;
- ($done,$addr) = ($1,$2);
- ($newhost, $newaddr, $newname) = &parse($addr,$server,$oldname, $#expansion == 0);
- print "($newhost, $newaddr, $newname) = &parse($addr, $server, $oldname)\n" if $debug;
- if (! $newhost) {
- # no expansion is possible w/o a new server to call
- if ($valid) {
- push(@isValid, &validAddr($newaddr));
- push(@toFinal,$newaddr,$server,$newname);
- } else {
- &verbose(&final($newaddr,$server,$newname));
- }
- } else {
- $newmxhost = &mx($newhost,$newaddr);
- print "$newmxhost = &mx($newhost)\n"
- if ($debug && $newhost ne $newmxhost);
- $0 = "$av0 - parsing $newaddr [@$newmxhost]";
- print "levels = $levels, level{$u *** $server} = ".$level{"$u *** $server"}."\n" if ($debug > 1);
- # If the new server is the current one,
- # it would have expanded things for us
- # if it could have. Mx records must be
- # followed to compare server names.
- # We are also done if the recursion
- # count has been exceeded.
- if (&trhost($newmxhost) eq &trhost($server) || ($levels && $level{"$u *** $server"} >= $levels)) {
- if ($valid) {
- push(@isValid, &validAddr($newaddr));
- push(@toFinal,$newaddr,$newmxhost,$newname);
- } else {
- &verbose(&final($newaddr,$newmxhost,$newname));
- }
- } else {
- # more work to do...
- if ($valid) {
- push(@isValid, &validAddr($newaddr));
- push(@toExpn,$newmxhost,$newaddr,$newname,$level{"$u *** $server"});
- } else {
- &verbose(&expn($newmxhost,$newaddr,$newname,$level{"$u *** $server"}));
- }
- }
- }
- last if ($done eq " ");
- next;
- }
- # 550 is a known code... Should the be
- # included in -a output? Might be a bug
- # here. Does it matter? Can assume that
- # there won't be UNKNOWN USER responses
- # mixed with valid users?
- if ($s =~ /^(550)([- ])/) {
- if ($valid) {
- print STDERR "\@$server:$u ($oldname) USER UNKNOWN\n";
- } else {
- &verbose(&final($u,$server,$oldname,"USER UNKNOWN"));
- }
- last if ($2 eq " ");
- next;
- }
- # 553 is a known code...
- if ($s =~ /^(553)([- ])/) {
- if ($valid) {
- print STDERR "\@$server:$u ($oldname) USER AMBIGUOUS\n";
- } else {
- &verbose(&final($u,$server,$oldname,"USER AMBIGUOUS"));
- }
- last if ($2 eq " ");
- next;
- }
- # 252 is a known code...
- if ($s =~ /^(252)([- ])/) {
- if ($valid) {
- print STDERR "\@$server:$u ($oldname) REFUSED TO VRFY\n";
- } else {
- &verbose(&final($u,$server,$oldname,"REFUSED TO VRFY"));
- }
- last if ($2 eq " ");
- next;
- }
- &giveup('',"$server: did not grok '$s'",$u);
- last USER;
- }
-
- if ($valid) {
- #
- # now we decide if we are going to take these
- # expansions or roll them back.
- #
- $avgValid = &average(@isValid);
- print "avgValid = $avgValid\n" if $debug;
- if ($avgValid >= $validRequirement) {
- print &compact($u,$server)." ->\n" if $verbose;
- while (@toExpn) {
- &verbose(&expn(splice(@toExpn,0,4)));
- }
- while (@toFinal) {
- &verbose(&final(splice(@toFinal,0,3)));
- }
- } else {
- print "Tossing some valid to avoid invalid ".&compact($u,$server)."\n" if ($avgValid > 0.0 && ($vw || $debug));
- print &compact($u,$server)." ->\n" if $verbose;
- &verbose(&final($u,$server,$newname));
- }
- }
- }
-
- &alarm("sending 'quit' to $server",'');
- $0 = "$av0 - sending 'quit' to $server";
- &ps("quit");
- while(<$S>) {
- print if $watch;
- last if /^\d+ /;
- }
- close($S);
- alarm(0);
-}
-
-$0 = "$av0 - printing final results";
-print "----------\n" if $vw;
-select(STDOUT);
-for $f (sort @final) {
- print "$f\n";
-}
-unlink("/tmp/expn$$");
-exit(0);
-
-
-# abandon all attempts deliver to $server
-# register the current addresses as the final ones
-sub giveup
-{
- local($redirect_okay,$reason,$user) = @_;
- local($us,@so,$nh,@remaining_users);
- local($pk,$file,$line);
- ($pk, $file, $line) = caller;
-
- $0 = "$av0 - giving up on $server: $reason";
- #
- # add back a user if we gave up in the middle
- #
- push(@users,$user) if $user;
- #
- # don't bother with this system anymore
- #
- unless ($giveup{$server}) {
- $giveup{$server} = $reason;
- print STDERR "$reason\n";
- }
- print "Giveup at $file:$line!!! redirect okay = $redirect_okay; $reason\n" if $debug;
- #
- # Wait!
- # Before giving up, see if there is a chance that
- # there is another host to redirect to!
- # (Kids, don't do this at home! Hacking is a dangerous
- # crime and you could end up behind bars.)
- #
- for $u (@users) {
- if ($redirect_okay =~ /\bmx\b/) {
- next if &try_fallback('mx',$u,*server,
- *mx_secondary,
- *already_mx_fellback);
- }
- if ($redirect_okay =~ /\bdomainify\b/) {
- next if &try_fallback('domainify',$u,*server,
- *domainify_fallback,
- *already_domainify_fellback);
- }
- push(@remaining_users,$u);
- }
- @users = @remaining_users;
- for $u (@users) {
- print &compact($u,$server)." ->\n" if ($verbose && $valid && $u);
- &verbose(&final($u,$server,$names{"$u *** $server"},$reason));
- }
-}
-#
-# This routine is used only within &giveup. It checks to
-# see if we really have to giveup or if there is a second
-# chance because we did something before that can be
-# backtracked.
-#
-# %fallback{"$user *** $host"} tracks what is able to fallback
-# %fellback{"$user *** $host"} tracks what has fallen back
-#
-# If there is a valid backtrack, then queue up the new possibility
-#
-sub try_fallback
-{
- local($method,$user,*host,*fall_table,*fellback) = @_;
- local($us,$fallhost,$oldhost,$ft,$i);
-
- if ($debug > 8) {
- print "Fallback table $method:\n";
- for $i (sort keys %fall_table) {
- print "\t'$i'\t\t'$fall_table{$i}'\n";
- }
- print "Fellback table $method:\n";
- for $i (sort keys %fellback) {
- print "\t'$i'\t\t'$fellback{$i}'\n";
- }
- print "U: $user H: $host\n";
- }
-
- $us = "$user *** $host";
- if (defined $fellback{$us}) {
- #
- # Undo a previous fallback so that we can try again
- # Nested fallbacks are avoided because they could
- # lead to infinite loops
- #
- $fallhost = $fellback{$us};
- print "Already $method fell back from $us -> \n" if $debug;
- $us = "$user *** $fallhost";
- $oldhost = $fallhost;
- } elsif (($method eq 'mx') && (defined $mxbacktrace{$us}) && (defined $mx_secondary{$mxbacktrace{$us}})) {
- print "Fallback an MX expansion $us -> \n" if $debug;
- $oldhost = $mxbacktrace{$us};
- } else {
- print "Oldhost($host, $us) = " if $debug;
- $oldhost = $host;
- }
- print "$oldhost\n" if $debug;
- if (((defined $fall_table{$us}) && ($ft = $us)) || ((defined $fall_table{$oldhost}) && ($ft = $oldhost))) {
- print "$method Fallback = ".$fall_table{$ft}."\n" if $debug;
- local(@so,$newhost);
- @so = split(' ',$fall_table{$ft});
- $newhost = shift(@so);
- print "Falling back ($method) $us -> $newhost (from $oldhost)\n" if $debug;
- if ($method eq 'mx') {
- if (! defined ($mxbacktrace{"$user *** $newhost"})) {
- if (defined $mxbacktrace{"$user *** $oldhost"}) {
- print "resetting oldhost $oldhost to the original: " if $debug;
- $oldhost = $mxbacktrace{"$user *** $oldhost"};
- print "$oldhost\n" if $debug;
- }
- $mxbacktrace{"$user *** $newhost"} = $oldhost;
- print "mxbacktrace $user *** $newhost -> $oldhost\n" if $debug;
- }
- $mx{&trhost($oldhost)} = $newhost;
- } else {
- $temporary_redirect{$us} = $newhost;
- }
- if (@so) {
- print "Can still $method $us: @so\n" if $debug;
- $fall_table{$ft} = join(' ',@so);
- } else {
- print "No more fallbacks for $us\n" if $debug;
- delete $fall_table{$ft};
- }
- if (defined $create_host_backtrack{$us}) {
- $create_host_backtrack{"$user *** $newhost"}
- = $create_host_backtrack{$us};
- }
- $fellback{"$user *** $newhost"} = $oldhost;
- &expn($newhost,$user,$names{$us},$level{$us});
- return 1;
- }
- delete $temporary_redirect{$us};
- $host = $oldhost;
- return 0;
-}
-# return 1 if you could send mail to the address as is.
-sub validAddr
-{
- local($addr) = @_;
- $res = &do_validAddr($addr);
- print "validAddr($addr) = $res\n" if $debug;
- $res;
-}
-sub do_validAddr
-{
- local($addr) = @_;
- local($urx) = "[-A-Za-z_.0-9+]+";
-
- # \u
- return 0 if ($addr =~ /^\\/);
- # ?@h
- return 1 if ($addr =~ /.\@$urx$/);
- # @h:?
- return 1 if ($addr =~ /^\@$urx\:./);
- # h!u
- return 1 if ($addr =~ /^$urx!./);
- # u
- return 1 if ($addr =~ /^$urx$/);
- # ?
- print "validAddr($addr) = ???\n" if $debug;
- return 0;
-}
-# Some systems use expn and vrfy interchangeably. Some only
-# implement one or the other. Some check expn against mailing
-# lists and vrfy against users. It doesn't appear to be
-# consistent.
-#
-# So, what do we do? We try everything!
-#
-#
-# Ranking of result codes: good: 250, 251/551, 252, 550, anything else
-#
-# Ranking of inputs: best: user@host.domain, okay: user
-#
-# Return value: $error_string, @responses_from_server
-sub expn_vrfy
-{
- local($u,$server) = @_;
- local(@c) = ('expn', 'vrfy');
- local(@try_u) = $u;
- local(@ret,$code);
-
- if (($u =~ /(.+)@(.+)/) && (&trhost($2) eq &trhost($server))) {
- push(@try_u,$1);
- }
-
- TRY:
- for $c (@c) {
- for $try_u (@try_u) {
- &alarm("${c}'ing $try_u on $server",'',$u);
- &ps("$c $try_u");
- alarm(0);
- $s = <$S>;
- if ($s eq '') {
- return "$server: lost connection";
- }
- if ($s !~ /^(\d+)([- ])/) {
- return "$server: garbled reply to '$c $try_u'";
- }
- if ($1 == 250) {
- $code = 250;
- @ret = ("",$s);
- push(@ret,&read_response($2,$debug));
- return (@ret);
- }
- if ($1 == 551 || $1 == 251) {
- $code = $1;
- @ret = ("",$s);
- push(@ret,&read_response($2,$debug));
- next;
- }
- if ($1 == 252 && ($code == 0 || $code == 550)) {
- $code = 252;
- @ret = ("",$s);
- push(@ret,&read_response($2,$watch));
- next;
- }
- if ($1 == 550 && $code == 0) {
- $code = 550;
- @ret = ("",$s);
- push(@ret,&read_response($2,$watch));
- next;
- }
- &read_response($2,$watch);
- }
- }
- return "$server: expn/vrfy not implemented" unless @ret;
- return @ret;
-}
-# sometimes the old parse routine (now parse2) didn't
-# reject funky addresses.
-sub parse
-{
- local($oldaddr,$server,$oldname,$one_to_one) = @_;
- local($newhost, $newaddr, $newname, $um) = &parse2($oldaddr,$server,$oldname,$one_to_one);
- if ($newaddr =~ m,^["/],) {
- return (undef, $oldaddr, $newname) if $valid;
- return (undef, $um, $newname);
- }
- return ($newhost, $newaddr, $newname);
-}
-
-# returns ($new_smtp_server,$new_address,$new_name)
-# given a response from a SMTP server ($newaddr), the
-# current host ($server), the old "name" and a flag that
-# indicates if it is being called during the initial
-# command line parsing ($parsing_args)
-sub parse2
-{
- local($newaddr,$context_host,$old_name,$parsing_args) = @_;
- local(@names) = $old_name;
- local($urx) = "[-A-Za-z_.0-9+]+";
- local($unmangle);
-
- #
- # first, separate out the address part.
- #
-
- #
- # [NAME] <ADDR [(NAME)]>
- # [NAME] <[(NAME)] ADDR
- # ADDR [(NAME)]
- # (NAME) ADDR
- # [(NAME)] <ADDR>
- #
- if ($newaddr =~ /^\<(.*)\>$/) {
- print "<A:$1>\n" if $debug;
- ($newaddr) = &trim($1);
- print "na = $newaddr\n" if $debug;
- }
- if ($newaddr =~ /^([^\<\>]*)\<([^\<\>]*)\>([^\<\>]*)$/) {
- # address has a < > pair in it.
- print "N:$1 <A:$2> N:$3\n" if $debug;
- ($newaddr) = &trim($2);
- unshift(@names, &trim($3,$1));
- print "na = $newaddr\n" if $debug;
- }
- if ($newaddr =~ /^([^\(\)]*)\(([^\(\)]*)\)([^\(\)]*)$/) {
- # address has a ( ) pair in it.
- print "A:$1 (N:$2) A:$3\n" if $debug;
- unshift(@names,&trim($2));
- local($f,$l) = (&trim($1),&trim($3));
- if (($f && $l) || !($f || $l)) {
- # address looks like:
- # foo (bar) baz or (bar)
- # not allowed!
- print STDERR "Could not parse $newaddr\n" if $vw;
- return(undef,$newaddr,&firstname(@names));
- }
- $newaddr = $f if $f;
- $newaddr = $l if $l;
- print "newaddr now = $newaddr\n" if $debug;
- }
- #
- # @foo:bar
- # j%k@l
- # a@b
- # b!a
- # a
- #
- $unmangle = $newaddr;
- if ($newaddr =~ /^\@($urx)\:(.+)$/) {
- print "(\@:)" if $debug;
- # this is a bit of a cheat, but it seems necessary
- return (&domainify($1,$context_host,$2),$2,&firstname(@names),$unmangle);
- }
- if ($newaddr =~ /^(.+)\@($urx)$/) {
- print "(\@)" if $debug;
- return (&domainify($2,$context_host,$newaddr),$newaddr,&firstname(@names),$unmangle);
- }
- if ($parsing_args) {
- if ($newaddr =~ /^($urx)\!(.+)$/) {
- return (&domainify($1,$context_host,$newaddr),$newaddr,&firstname(@names),$unmangle);
- }
- if ($newaddr =~ /^($urx)$/) {
- return ($context_host,$newaddr,&firstname(@names),$unmangle);
- }
- print STDERR "Could not parse $newaddr\n";
- }
- print "(?)" if $debug;
- return(undef,$newaddr,&firstname(@names),$unmangle);
-}
-# return $u (@$server) unless $u includes reference to $server
-sub compact
-{
- local($u, $server) = @_;
- local($se) = $server;
- local($sp);
- $se =~ s/(\W)/\\$1/g;
- $sp = " (\@$server)";
- if ($u !~ /$se/i) {
- return "$u$sp";
- }
- return $u;
-}
-# remove empty (spaces don't count) members from an array
-sub trim
-{
- local(@v) = @_;
- local($v,@r);
- for $v (@v) {
- $v =~ s/^\s+//;
- $v =~ s/\s+$//;
- push(@r,$v) if ($v =~ /\S/);
- }
- return(@r);
-}
-# using the host part of an address, and the server name, add the
-# servers' domain to the address if it doesn't already have a
-# domain. Since this sometimes fails, save a back reference so
-# it can be unrolled.
-sub domainify
-{
- local($host,$domain_host,$u) = @_;
- local($domain,$newhost);
-
- # cut of trailing dots
- $host =~ s/\.$//;
- $domain_host =~ s/\.$//;
-
- if ($domain_host !~ /\./) {
- #
- # domain host isn't, keep $host whatever it is
- #
- print "domainify($host,$domain_host) = $host\n" if $debug;
- return $host;
- }
-
- #
- # There are several weird situtations that need to be
- # accounted for. They have to do with domain relay hosts.
- #
- # Examples:
- # host server "right answer"
- #
- # shiva.cs cs.berkeley.edu shiva.cs.berkeley.edu
- # shiva cs.berkeley.edu shiva.cs.berekley.edu
- # cumulus reed.edu @reed.edu:cumulus.uucp
- # tiberius tc.cornell.edu tiberius.tc.cornell.edu
- #
- # The first try must always be to cut the domain part out of
- # the server and tack it onto the host.
- #
- # A reasonable second try is to tack the whole server part onto
- # the host and for each possible repeated element, eliminate
- # just that part.
- #
- # These extra "guesses" get put into the %domainify_fallback
- # array. They will be used to give addresses a second chance
- # in the &giveup routine
- #
-
- local(%fallback);
-
- local($long);
- $long = "$host $domain_host";
- $long =~ tr/A-Z/a-z/;
- print "long = $long\n" if $debug;
- if ($long =~ s/^([^ ]+\.)([^ ]+) \2(\.[^ ]+\.[^ ]+)/$1$2$3/) {
- # matches shiva.cs cs.berkeley.edu and returns shiva.cs.berkeley.edu
- print "condensed fallback $host $domain_host -> $long\n" if $debug;
- $fallback{$long} = 9;
- }
-
- local($fh);
- $fh = $domain_host;
- while ($fh =~ /\./) {
- print "FALLBACK $host.$fh = 1\n" if $debug > 7;
- $fallback{"$host.$fh"} = 1;
- $fh =~ s/^[^\.]+\.//;
- }
-
- $fallback{"$host.$domain_host"} = 2;
-
- ($domain = $domain_host) =~ s/^[^\.]+//;
- $fallback{"$host$domain"} = 6
- if ($domain =~ /\./);
-
- if ($host =~ /\./) {
- #
- # Host is already okay, but let's look for multiple
- # interpretations
- #
- print "domainify($host,$domain_host) = $host\n" if $debug;
- delete $fallback{$host};
- $domainify_fallback{"$u *** $host"} = join(' ',sort {$fallback{$b} <=> $fallback{$a};} keys %fallback) if %fallback;
- return $host;
- }
-
- $domain = ".$domain_host"
- if ($domain !~ /\..*\./);
- $newhost = "$host$domain";
-
- $create_host_backtrack{"$u *** $newhost"} = $domain_host;
- print "domainify($host,$domain_host) = $newhost\n" if $debug;
- delete $fallback{$newhost};
- $domainify_fallback{"$u *** $newhost"} = join(' ',sort {$fallback{$b} <=> $fallback{$a};} keys %fallback) if %fallback;
- if ($debug) {
- print "fallback = ";
- print $domainify_fallback{"$u *** $newhost"}
- if defined($domainify_fallback{"$u *** $newhost"});
- print "\n";
- }
- return $newhost;
-}
-# return the first non-empty element of an array
-sub firstname
-{
- local(@names) = @_;
- local($n);
- while(@names) {
- $n = shift(@names);
- return $n if $n =~ /\S/;
- }
- return undef;
-}
-# queue up more addresses to expand
-sub expn
-{
- local($host,$addr,$name,$level) = @_;
- if ($host) {
- $host = &trhost($host);
-
- if (($debug > 3) || (defined $giveup{$host})) {
- unshift(@hosts,$host) unless $users{$host};
- } else {
- push(@hosts,$host) unless $users{$host};
- }
- $users{$host} .= " $addr";
- $names{"$addr *** $host"} = $name;
- $level{"$addr *** $host"} = $level + 1;
- print "expn($host,$addr,$name)\n" if $debug;
- return "\t$addr\n";
- } else {
- return &final($addr,'NONE',$name);
- }
-}
-# compute the numerical average value of an array
-sub average
-{
- local(@e) = @_;
- return 0 unless @e;
- local($e,$sum);
- for $e (@e) {
- $sum += $e;
- }
- $sum / @e;
-}
-# print to the server (also to stdout, if -w)
-sub ps
-{
- local($p) = @_;
- print ">>> $p\n" if $watch;
- print $S "$p\n";
-}
-# return case-adjusted name for a host (for comparison purposes)
-sub trhost
-{
- # treat foo.bar as an alias for Foo.BAR
- local($host) = @_;
- local($trhost) = $host;
- $trhost =~ tr/A-Z/a-z/;
- if ($trhost{$trhost}) {
- $host = $trhost{$trhost};
- } else {
- $trhost{$trhost} = $host;
- }
- $trhost{$trhost};
-}
-# re-queue users if an mx record dictates a redirect
-# don't allow a user to be redirected more than once
-sub mxredirect
-{
- local($server,*users) = @_;
- local($u,$nserver,@still_there);
-
- $nserver = &mx($server);
-
- if (&trhost($nserver) ne &trhost($server)) {
- $0 = "$av0 - mx redirect $server -> $nserver\n";
- for $u (@users) {
- if (defined $mxbacktrace{"$u *** $nserver"}) {
- push(@still_there,$u);
- } else {
- $mxbacktrace{"$u *** $nserver"} = $server;
- print "mxbacktrace{$u *** $nserver} = $server\n"
- if ($debug > 1);
- &expn($nserver,$u,$names{"$u *** $server"});
- }
- }
- @users = @still_there;
- if (! @users) {
- return $nserver;
- } else {
- return undef;
- }
- }
- return undef;
-}
-# follow mx records, return a hostname
-# also follow temporary redirections comming from &domainify and
-# &mxlookup
-sub mx
-{
- local($h,$u) = @_;
-
- for (;;) {
- if (defined $mx{&trhost($h)} && $h ne $mx{&trhost($h)}) {
- $0 = "$av0 - mx expand $h";
- $h = $mx{&trhost($h)};
- return $h;
- }
- if ($u) {
- if (defined $temporary_redirect{"$u *** $h"}) {
- $0 = "$av0 - internal redirect $h";
- print "Temporary redirect taken $u *** $h -> " if $debug;
- $h = $temporary_redirect{"$u *** $h"};
- print "$h\n" if $debug;
- next;
- }
- $htr = &trhost($h);
- if (defined $temporary_redirect{"$u *** $htr"}) {
- $0 = "$av0 - internal redirect $h";
- print "temporary redirect taken $u *** $h -> " if $debug;
- $h = $temporary_redirect{"$u *** $htr"};
- print "$h\n" if $debug;
- next;
- }
- }
- return $h;
- }
-}
-# look up mx records with the name server.
-# re-queue expansion requests if possible
-# optionally give up on this host.
-sub mxlookup
-{
- local($lastchance,$server,$giveup,*users) = @_;
- local(*T);
- local(*NSLOOKUP);
- local($nh, $pref,$cpref);
- local($o0) = $0;
- local($nserver);
- local($name,$aliases,$type,$len,$thataddr);
- local(%fallback);
-
- return 1 if &mxredirect($server,*users);
-
- if ((defined $mx{$server}) || (! $have_nslookup)) {
- return 0 unless $lastchance;
- &giveup('mx domainify',$giveup);
- return 0;
- }
-
- $0 = "$av0 - nslookup of $server";
- open(T,">/tmp/expn$$") || die "open > /tmp/expn$$: $!\n";
- print T "set querytype=MX\n";
- print T "$server\n";
- close(T);
- $cpref = 1.0E12;
- undef $nserver;
- open(NSLOOKUP,"nslookup < /tmp/expn$$ 2>&1 |") || die "open nslookup: $!";
- while(<NSLOOKUP>) {
- print if ($debug > 2);
- if (/mail exchanger = ([-A-Za-z_.0-9+]+)/) {
- $nh = $1;
- if (/preference = (\d+)/) {
- $pref = $1;
- if ($pref < $cpref) {
- $nserver = $nh;
- $cpref = $pref;
- } elsif ($pref) {
- $fallback{$pref} .= " $nh";
- }
- }
- }
- if (/Non-existent domain/) {
- #
- # These addresss are hosed. Kaput! Dead!
- # However, if we created the address in the
- # first place then there is a chance of
- # salvation.
- #
- 1 while(<NSLOOKUP>);
- close(NSLOOKUP);
- return 0 unless $lastchance;
- &giveup('domainify',"$server: Non-existent domain",undef,1);
- return 0;
- }
-
- }
- close(NSLOOKUP);
- unlink("/tmp/expn$$");
- unless ($nserver) {
- $0 = "$o0 - finished mxlookup";
- return 0 unless $lastchance;
- &giveup('mx domainify',"$server: Could not resolve address");
- return 0;
- }
-
- # provide fallbacks in case $nserver doesn't work out
- if (defined $fallback{$cpref}) {
- $mx_secondary{$server} = $fallback{$cpref};
- }
-
- $0 = "$av0 - gethostbyname($nserver)";
- ($name,$aliases,$type,$len,$thataddr) = gethostbyname($nserver);
-
- unless ($thataddr) {
- $0 = $o0;
- return 0 unless $lastchance;
- &giveup('mx domainify',"$nserver: could not resolve address");
- return 0;
- }
- print "MX($server) = $nserver\n" if $debug;
- print "$server -> $nserver\n" if $vw && !$debug;
- $mx{&trhost($server)} = $nserver;
- # redeploy the users
- unless (&mxredirect($server,*users)) {
- return 0 unless $lastchance;
- &giveup('mx domainify',"$nserver: only one level of mx redirect allowed");
- return 0;
- }
- $0 = "$o0 - finished mxlookup";
- return 1;
-}
-# if mx expansion did not help to resolve an address
-# (ie: foo@bar became @baz:foo@bar, then undo the
-# expansion).
-# this is only used by &final
-sub mxunroll
-{
- local(*host,*addr) = @_;
- local($r) = 0;
- print "looking for mxbacktrace{$addr *** $host}\n"
- if ($debug > 1);
- while (defined $mxbacktrace{"$addr *** $host"}) {
- print "Unrolling MX expnasion: \@$host:$addr -> "
- if ($debug || $verbose);
- $host = $mxbacktrace{"$addr *** $host"};
- print "\@$host:$addr\n"
- if ($debug || $verbose);
- $r = 1;
- }
- return 1 if $r;
- $addr = "\@$host:$addr"
- if ($host =~ /\./);
- return 0;
-}
-# register a completed expnasion. Make the final address as
-# simple as possible.
-sub final
-{
- local($addr,$host,$name,$error) = @_;
- local($he);
- local($hb,$hr);
- local($au,$ah);
-
- if ($error =~ /Non-existent domain/) {
- #
- # If we created the domain, then let's undo the
- # damage...
- #
- if (defined $create_host_backtrack{"$addr *** $host"}) {
- while (defined $create_host_backtrack{"$addr *** $host"}) {
- print "Un&domainifying($host) = " if $debug;
- $host = $create_host_backtrack{"$addr *** $host"};
- print "$host\n" if $debug;
- }
- $error = "$host: could not locate";
- } else {
- #
- # If we only want valid addresses, toss out
- # bad host names.
- #
- if ($valid) {
- print STDERR "\@$host:$addr ($name) Non-existent domain\n";
- return "";
- }
- }
- }
-
- MXUNWIND: {
- $0 = "$av0 - final parsing of \@$host:$addr";
- ($he = $host) =~ s/(\W)/\\$1/g;
- if ($addr !~ /@/) {
- # addr does not contain any host
- $addr = "$addr@$host";
- } elsif ($addr !~ /$he/i) {
- # if host part really something else, use the something
- # else.
- if ($addr =~ m/(.*)\@([^\@]+)$/) {
- ($au,$ah) = ($1,$2);
- print "au = $au ah = $ah\n" if $debug;
- if (defined $temporary_redirect{"$addr *** $ah"}) {
- $addr = "$au\@".$temporary_redirect{"$addr *** $ah"};
- print "Rewrite! to $addr\n" if $debug;
- next MXUNWIND;
- }
- }
- # addr does not contain full host
- if ($valid) {
- if ($host =~ /^([^\.]+)(\..+)$/) {
- # host part has a . in it - foo.bar
- ($hb, $hr) = ($1, $2);
- if ($addr =~ /\@([^\.\@]+)$/ && ($1 eq $hb)) {
- # addr part has not .
- # and matches beginning of
- # host part -- tack on a
- # domain name.
- $addr .= $hr;
- } else {
- &mxunroll(*host,*addr)
- && redo MXUNWIND;
- }
- } else {
- &mxunroll(*host,*addr)
- && redo MXUNWIND;
- }
- } else {
- $addr = "${addr}[\@$host]"
- if ($host =~ /\./);
- }
- }
- }
- $name = "$name " if $name;
- $error = " $error" if $error;
- if ($valid) {
- push(@final,"$name<$addr>");
- } else {
- push(@final,"$name<$addr>$error");
- }
- "\t$name<$addr>$error\n";
-}
-
-sub alarm
-{
- local($alarm_action,$alarm_redirect,$alarm_user) = @_;
- alarm(3600);
- $SIG{ALRM} = 'handle_alarm';
-}
-# this involves one great big ugly hack.
-# the "next HOST" unwinds the stack!
-sub handle_alarm
-{
- &giveup($alarm_redirect,"Timed out during $alarm_action",$alarm_user);
- next HOST;
-}
-
-# read the rest of the current smtp daemon's response (and toss it away)
-sub read_response
-{
- local($done,$watch) = @_;
- local(@resp);
- print $s if $watch;
- while(($done eq "-") && ($s = <$S>) && ($s =~ /^\d+([- ])/)) {
- print $s if $watch;
- $done = $1;
- push(@resp,$s);
- }
- return @resp;
-}
-# print args if verbose. Return them in any case
-sub verbose
-{
- local(@tp) = @_;
- print "@tp" if $verbose;
-}
-# to pass perl -w:
-@tp;
-$flag_a;
-$flag_d;
-$flag_1;
-%already_domainify_fellback;
-%already_mx_fellback;
-&handle_alarm;
-################### BEGIN PERL/TROFF TRANSITION
-.00 ;
-
-'di
-.nr nl 0-1
-.nr % 0
-.\\"'; __END__
-.\" ############## END PERL/TROFF TRANSITION
-.TH EXPN 1 "March 11, 1993"
-.AT 3
-.SH NAME
-expn \- recursively expand mail aliases
-.SH SYNOPSIS
-.B expn
-.RI [ -a ]
-.RI [ -v ]
-.RI [ -w ]
-.RI [ -d ]
-.RI [ -1 ]
-.IR user [@ hostname ]
-.RI [ user [@ hostname ]]...
-.SH DESCRIPTION
-.B expn
-will use the SMTP
-.B expn
-and
-.B vrfy
-commands to expand mail aliases.
-It will first look up the addresses you provide on the command line.
-If those expand into addresses on other systems, it will
-connect to the other systems and expand again. It will keep
-doing this until no further expansion is possible.
-.SH OPTIONS
-The default output of
-.B expn
-can contain many lines which are not valid
-email addresses. With the
-.I -aa
-flag, only expansions that result in legal addresses
-are used. Since many mailing lists have an illegal
-address or two, the single
-.IR -a ,
-address, flag specifies that a few illegal addresses can
-be mixed into the results. More
-.I -a
-flags vary the ratio. Read the source to track down
-the formula. With the
-.I -a
-option, you should be able to construct a new mailing
-list out of an existing one.
-.LP
-If you wish to limit the number of levels deep that
-.B expn
-will recurse as it traces addresses, use the
-.I -1
-option. For each
-.I -1
-another level will be traversed. So,
-.I -111
-will traverse no more than three levels deep.
-.LP
-The normal mode of operation for
-.B expn
-is to do all of its work silently.
-The following options make it more verbose.
-It is not necessary to make it verbose to see what it is
-doing because as it works, it changes its
-.BR argv [0]
-variable to reflect its current activity.
-To see how it is expanding things, the
-.IR -v ,
-verbose, flag will cause
-.B expn
-to show each address before
-and after translation as it works.
-The
-.IR -w ,
-watch, flag will cause
-.B expn
-to show you its conversations with the mail daemons.
-Finally, the
-.IR -d ,
-debug, flag will expose many of the inner workings so that
-it is possible to eliminate bugs.
-.SH ENVIRONMENT
-No enviroment variables are used.
-.SH FILES
-.PD 0
-.B /tmp/expn$$
-.B temporary file used as input to
-.BR nslookup .
-.SH SEE ALSO
-.BR aliases (5),
-.BR sendmail (8),
-.BR nslookup (8),
-RFC 823, and RFC 1123.
-.SH BUGS
-Not all mail daemons will implement
-.B expn
-or
-.BR vrfy .
-It is not possible to verify addresses that are served
-by such daemons.
-.LP
-When attempting to connect to a system to verify an address,
-.B expn
-only tries one IP address. Most mail daemons
-will try harder.
-.LP
-It is assumed that you are running domain names and that
-the
-.BR nslookup (8)
-program is available. If not,
-.B expn
-will not be able to verify many addresses. It will also pause
-for a long time unless you change the code where it says
-.I $have_nslookup = 1
-to read
-.I $have_nslookup =
-.IR 0 .
-.LP
-Lastly,
-.B expn
-does not handle every valid address. If you have an example,
-please submit a bug report.
-.SH CREDITS
-In 1986 or so, Jon Broome wrote a program of the same name
-that did about the same thing. It has since suffered bit rot
-and Jon Broome has dropped off the face of the earth!
-(Jon, if you are out there, drop me a line)
-.SH AVAILABILITY
-The latest version of
-.B expn
-is available through anonymous ftp at
-.IR ftp://ftp.idiom.com/pub/muir-programs/expn .
-.SH AUTHOR
-.I David Muir Sharnoff\ \ \ \ <muir@idiom.com>
+++ /dev/null
-From: Karl London <karl@borg.demon.co.uk>
-Message-Id: <199308111712.SAA05454@borg.demon.co.uk>
-Subject: Final port of mail.local to Linux
-To: eric@cs.berkeley.edu
-Date: Wed, 11 Aug 1993 18:12:27 +0100 (BST)
-X-Mailer: ELM [version 2.4 PL21]
-MIME-Version: 1.0
-Content-Type: text/plain; charset=US-ASCII
-Content-Transfer-Encoding: 7bit
-Content-Length: 11415
-
-Hi,
- Sorry about this.. This is a final version of mail.local for
-linux..
-
-This is what I would like to see distributed with 8.6 if poss...
-
-Karl
-
---------------
-
-begin 600 mail.local.linux.tar.Z
-M'YV0;<*D8>."S9LQ8=B\`,"PH<.'$"-*G$BQHL6*(&C`N`$#!@@`($#$N%'#
-M(TB1)$V&7,D2A$<0-6C,D$%3QHT8+V/HI$$#9(V+0(,*'4HT8ITY=,+("0E@
-MC5(V12<ZE0,UJM6K6+-JW<KU:L"!!0\F?`$G#!TT;L*T*3/'!9JN<*WBA*%1
-M)<J2'T..Q'NRY0P;,6:$+`DC!@V:,VK(T#MCQDV0,.)*GFP4J5*F4ZMNS4RY
-ML^?/H#^_4-%"`0@5((:\@9-'3IHS:.B`0#$FA<@<.3Q205,&A)0R9\JXH3,'
-MQ!LS(,[VKN(FC9TR<N:DH9/'./(A"=.8>2.G>1@7IE$'8<,&A&O8Q,VSA?Z<
-M#/C3X7V7(9,&J6LQ=>BD>>,&1!@W9(!P5&]I]#?'&W7(,49O_P4H1H%*5;>=
-M'&W,P0((=TR'AG%+97@6@G3$U\8;])F1!D+Z\7>A4KW!`5T;T]$Q'PAPR/&&
-M'6F0,>-99B7'&PC;D?=&AFZ<`<(8_-&7HAMSQ,<B"&O1H4-\,;@@'WWVI8'?
-MDL4=!\*!"2YX)(F]M7&4;'*4D52!/C(HQHV](<G:>;'%MY(;;^BWX(5GU0<"
-M&_7)YB62`$ZW'Y/^`=@FD&\(2:216([!AD!KR?$>:C)8^1N6=-R7WZ'%L?E@
-M6G)(R%T;4)ZI7HTDUB&F<OZ]^=R8<[Y6YVDLX:EG&7RBX2>@2%DW9J%<)AH@
-MK$$:]"@(D4Z:1J4@L*F<G2&1<5`=:PUGUJ'&OL"=<<HM%9",KB54'*LXZAB@
-MAQO"RJFG2UX*P@Q6CE=>&&0\)X=^TA4)I5G0I6$NE,(M6:"19I1A5H)L<2C@
-M'+UYV6=Q!YI!QQTL4IMJL%C",6EUR#:J[,'^C;$&GG>P,5]PV4H97@*[^<DJ
-M&:[*5J"D=>A(\7$7/ZGC<P:YZ"#(/S+G''3246?=R]@!.J%W%PH!W1IEJ%Q=
-M@]&F1VBG6N;'75OQT6"E$V5H"-VB::TE+*Q&ZYMT=7@N!6O:#7LY77%;P_NU
-MQ@%5)T9O`Q[[!@C"61M=Q$NQ.J*,--I(\QCIZ>A:>T#:B.K$7_*,<9H:LPOB
-MERZ.H=V)C>_7H6MTR-B?BQ36)QU_E\9'!1))3`'"%$\80<4504A1!`BU@P"%
-M%$]8D00111`!@A!9@##[[[X?48035-@>A!/*#_$$]5(D(4055#PAA>U@@!&$
-M[;6?<`((UQ,1W_7-%X'%\$5,8;OXP#<!!1-))`\"[U*0PO6HT+\I7"@)3A@"
-M$ZI`!`0>(6K@`X$3GD`%$/"O"4F@@O_"=Z'GQ2<)^N.?_P`H0.H5$`2Y`T$3
-MBB"%(2!A@$$00A+X1X7FM0\$1LB@$^IG.R/@+PC"ZQT!AU`%)O1.>%60`A2>
-M,(4BO,]W(&C@%!08!!`FSTK`<X($GP""(EAA>A6<P@N9P`3G(0%Z19`>]>XG
-MA=1LCPK=^U[XQK>\W_$OADQP(JY\V$;X13$)OAL"%0Z(/4`609"$',+QP!@$
-M)EQH"E`X9!(:>2'Y%2&$O<O"A?"G/2<T,0I5`.,DF1`?(@2A"4&0GNU0@$`%
-M,M"!$*S@!"MXP0QN\`D7&MX3B.B[%5(/A4:X716$,`4"4@%\OSO"$YY`A"G$
-M!W]-E(+QAE"_'5B0B?<+9A6:>"%34B$(FVRC+G-8/6OB[WM30"`/LZC!`%8!
-M"@3<7@KB@X0G7,&++$Q-$+;IOQMNCWU.:-[SQ->\%-Y1AC34Y/_.^+PV(M"-
-MW`L"(F\'QR0(,CX'G6$&%8J_.5:0E0E<8`.=<`0)II%_:J0F"MM(P3-*X0JU
-M*X)M>E<[!V81H,WC71:>&<$4/@\$_`2F&8.'.]T!L`B5_*(6DQ#,(!#!>$U4
-MGD_/*#QL>D^C-01F?*90!1=&\92I+$+L3I,`(*!@!"DHRUGHUA8T)*`&+A`,
-M"J0F!ZI9S38Q>,%(7I"#&(3G!0H8P<W8D+/>\$"M:&BK#Q006!V9R`V]^0(4
-M@C"[+S!AEU307P)$\`(ZM`$.+S`(0@B"A=*:5@0*"(UJ5_L5@HAV+*T-RVA=
-M,(;5@F8N=<G+7>RR%[NP9"0PJ$$-!B.3FMBD(XSAR0T@8]OF#N5,E_D(9[@R
-M7>=:][K8E<QH2H,KU=0*/;.IS6URX[P?_28XP^D2<MC6'+=-ISI>:IIVN.,=
-M>=G+/+9*3YH@)H?VC!4UFPH4O+B%M0%%RT`(4A"#%#6J"#&*0A;"D(8<YKG\
-MB(A$HT/1H5:4)AJ]*$8S0E>.=H2&'H7,420CE))`Y:0.1VE*N*K2E03<M6)Y
-M"4P*'I..-H8F-0FD/[`*@ZSBM)K6Y%=CNCH1KWSTJT`)2\6&XD]QL';BD?FK
-M692"CKPR->,L;0E4!P9!@TOU8%29*5AIFIFK>A/D(=/*R.A!<IZ4W*LF!VM0
-M28HRHJC\HV0-B618?M;9I,4;C5EK#-@JV+;XTZUOY8DWX@)8N=AP+ANE:T;L
-M6M2[:GPH>=&+?>3Q3[Z@PR^2C2M@`VO9H4B6L(7MUV$&EIBO=F:QS96!;ZKJ
-MV,<6Y>=EA<%D*%,9&5A6,!BK`&:S;ERK('=@G.DL<[7V61F`MIH9B8%HRVDO
-MTMZ[-++*]VD"B]K4JE:&JRGJ;L/BVI:^)B^Q2;!LX4*;6B*VWJ)I.SK<CIN\
-MUZ+>K.&-/^KV6G3X%@:_`0YB@B,<@+Z&.&4OKD6.JUEQ)'>T`)G!<DRF=<\X
-MAZN55%@V<PA=ADOWK3N@3G4>;MT<7N>&_P[5=D7=7>]^%SQ=&@]YRF.>&=&H
-MQNH!-'MOC"/XQ$<^\Z%O"NK[^?L"VL7Y^<Y^*\W?_OJG/!(.L(")%"DLEQ?!
-M65H0A+94'@=W_L$04OU_O2LA`>LGU!6V\(74BR%6;8@]'.IPG7QD7Q"E,,0B
-M'A$*25QB$Y_X.RE2T8I$P.)#)]A%I89QC&7\:?3`R$:(5E2.1*_CU_&H1]3D
-MW8\-#.0@LQCZ0XZ^E8N,NR-O%TE%4K+IE]Q?)L,)T4^&TH2-+"5853F;5FJ=
-MI+'<(BW!KD&QXU)XQ./E)<$H5*X2TYC(!($RF>E,7$&3A=.LYC6AGD)^=I.R
-MX(SZ.#,X!7.V$9WJA#H"VRF%=\;3"?/$53WO^<4V#F&?4?TY"K7HQX%*H:#!
-ME%$)=2%7P%`N=5.=!$<2-7K%U#T7A2L"N%&TYU&]%U*O1%(F=00H-3TJA3\M
-MQ4(PU40SU3WIA($/Y4<ZQ5,5-%6_$U13152Y(W.^DU33`SQ-]50Q)57!]%."
-METX(M5%:A2M<Y56FA$K2<RF`%5C:`2!E@!R`,AP*,`8EMA1R`F>QL05=``(]
-MH``B8%9HE1I%1B>R01MXA1NZ85[`43#]QEY'@V]*$U_9`6[?P05NP`6F<5]B
-M6!S[Q1[SX0)T*`([$%B%HQT@,!H@H"M_4B"RH0))*%AFP(1.J(@*8!EZ<B13
-M^"5C,`;20098J(4@T(5GE0*Q]5H$,09OY0(V,!MT95?E9ALVH%<YP%<Q`(B"
-M6"C(88B(^(2+V(B#55@@P`-SD`=S0!9*H19NL5B"Y0;.9EC!.(R4>(Q*J(R$
-MM6/`*(PO<"`FHR;0F(S+^(O-^`(FHC+;V(O4"%GZ88XO4"#C*(V^6(US8!!G
-ML([=R`-F,`;#01!H@(SD:%CF2`9B((_3:%AP<`?ND8_1.(_ZL18`V8YUT!Q(
-M49#ZR([4"!W=\08+28T/N1\7R8QT0`:`\H\&R8T!Z8U<4R0;^8F(Q59N@5J-
-MU80%4@8)8`3@QP0)D`!^-0*.]9(),$LR^4TT"0.,I8@)H".`HB\@\`62A0(H
-MH(@7(H67H0(ID`*!:`=OD",)0)%'F91+.1Q-*66RX91+H0(7X@)D&953695D
-MD`!)9@9Y\"!F@!Q("05*"9:G898*()1(P1V1I95T"952J0!4:95'$0;!D95R
-MB0*!209VJ0!?X08HH!1G,`8<=@9V,$\)H(C^(0>1&8@)T)<J`)EV$(A[H`!7
-MB0?DTA^8N1KG2`:<60:F"1W]T9>J"9F<:1\U0R-AL'($>1H#R9F8*8478@9D
-M<"'3EA"<60<Y\@6R@9RL29I]>7%OT`:!2)K5Y@;PB`(B,(IBP08B<"&7=022
-MQ4+$(P7>^03@B4HS])>D"9VHT@,25$1,P)EWX"LJ,QNTL2'N&1QTH)J/J9F2
-MF9F4>2$B0`9FH`-RH`,B$)4@$`+N602Y8YD),`<>(H7W:1NC69,(`3$@<`)D
-M<`(Z4).&*`:_M@:;$R!(\EG;(@;UR8BD69-BD"9AL`:<V9FYV1LG8`8>VJ(9
-M:J-RX*$@BAHB:C(E.B8HJA\JVALL6I.7B1PHP)X0F@`L09$HT).OEYUUP`;Z
-MX3&]T0+(H9J@DJ`SF@#LZ8FSJ9EA^J(*(Z,Z6J,;^@,Y6I..%097ZC)*.IC!
-M@0)_69-]0)J0.08@T`+NZ:4`PIF@"0(K$*APL)K3N:2S$0*?J9F5V:)V6@9X
-MNJBC09JXD@3(,::(&')E(#HF,A\78F!S,V^5$YT@H)_P6"!X&BWU=FM0BAK,
-M^2]T((5L<2&/!AT9`C&CJJ&EJC9C"BMEH9O<87$#`:NX@B1RL%]PD&?^LI^+
-MPIS@$:N`E0"SFI]JPIR52IJ$B`(A,*8F8`*-VJ08AZUTL*J.J:!\P`>8NA(A
-M@`(#Z8GZ.9!I0Z[1J:Y\0"-WT`(^,)!?,*L,*B`Y$I4M.J;N":]W(*]J,I#:
-MRIP*^@/ZRJ_^2C<@H`.?^`,82XOK&2#NF9=I8J]MD*<3,AO%61[N"0/6]*B4
-M:4TKL`*@":$E"P)\X)Y$V89-.IRG\;*MB0?3@0(E^Y=[.HG[^;%.ZIR7J`+L
-M*9JDF4-Y=!IF``><F9!EH)S)80?&R:W#`20X6S4OR9E]20=N<"%/6`9;(`-T
-M@0-=L*A@ZXGV03-P@`*215E(8%F8I3]YVJTWZXEML`9(40:?A0)@JZ`]X)XM
-M$`,RFZ_O^K2>*)S5>;,">@<KD*`$6Y-22J6K)P(-*63U":W5F1Q^VZQRX&#A
-M6`9@2IJ(B98IT)!/N`:`ZP8BFR:4&KB+>KH#*[4H8`)T8+5LD*>TJYA/ZQK#
-M809-"@<":@085P+%@;S=>:IMT)2VB[NZNY@),+9;``-9Z)XGP`4P<`*<.;(^
-M.[:>&`/69`;Z.0<H,+87(AUZ4`;'<;XOF0+IVY$%(I46VJ+=2KW6JX782X<G
-M\*1<"UGA.Z-5HZ$76I/=^K^]$:Z)"%G5>[W8:P3KH\`A(`9C\+?H^XG&BZK+
-M6P.3JZ2]FU;Y,08H<`(^<`+!"0=Y2KG@>[(SNJ<U^<&_JXC"^[0"JKQB^[XS
-MVJT)LZS<,;P=G`!H&J.<&;0)8(B:2C`K1YB]@8B0E3(OZ;FMDQ8R@K.0-2/_
-M03BF&;I6DJ3=&@(%HB-XX+Z0=2'9ZP;]"Z$?#`<A/,+\>\)Y:HA/D!]J+!MA
-M<(AEX,2094VZLF2?JS3\-@=*/&4=EA#*TH>G4:UIO,9E;,)`@L*SFY@I\):$
-M-0=HX,.^R:0[;"-RX,,PNZQ3.I,"*B.?Q1VB>ZP8@CJ]09'<4;H)D"9TD"".
-M*9Q`RU@UJR^.>XCS9IF8*9Q>>[1TH[01VBFW28E?(@:U*<S,-JP2&B`JT)M8
-M^Y4P.L47T@9B()P7X@9R<,UW@*MO>2']=;6=>8EN:085<@9;,!==<"'X809;
-M@`,J@!,R0`/IC)MGL06H-#]RFT=.D+;4^994BV@VTLU_`C%EP+KJ6<0J@*FH
-M003U0<A#PBQ<JR\@,S@->3)#TA]L]:<M`#J?*C#ET5IO@@<-@Q#]\3<*#0(E
-M!B#"%F:P`C$`TEK^`2@U6ARC.ZV'S*U,^J[Q:J[TJA8H0#=16;^4Z\D\"<J?
-M6-$H@]'S9K$VC,MKD<*N#,LH$`-Y2L0?''+`2P?"BU@U/(Q-';>5A9Y,$'K7
-MG,N+VL6T$<TSXIZ4EA1T`*]F@0878@)S(`8*&J[M&A(H4-<N@!1?8)T%L@8+
-MZIZ&NZZW\P6UPP1.L`1[_8]^/2(Z$M0@4,!26M0^V=46N[HS,KK+BUA0G:W=
-M,=55S5@(?=*[`1UE<`)39AZ_UAN0MJ4;?3&#PRH+LG(-TR=N(-C*X3>/=B1J
-M308GC2S'BD4Q4QQK\1_%(=SU2=*(^#<"`MBYW8<*7:UX2\W"J85Y;1PNXIA<
-MC4)?$`10$$G8PP=/\`5#X#N41=Y?<`7$XP1,H%!3@-CM-P52P`?QG017L$U2
-MH*`\X!)"?95$34&6B]D@T-3=;1^JO,D4B2=V69-1'=I4/<2D_<TFZQ*<:8BF
-M9;%/L-U?@@8(P@8!XM`):P:BM08G0#+*70;61-`9X0(T0$R)=].,VJ0EC@+6
-MC;.7-01+\`7RHZ"4'>!4,."?B+Q,/0>='=?QFR8\K.#+RN!0K;L!W*)GD">#
-M(Z+-F0!$#-#'@1QL3="L>^,7`@.KUT1%L./30P2\"\E8+<,H,,[EW-5`4`(@
-M_H=EO19-F2!;?K=,2FEE4-"W+.:/5`1E_@5-1`6V,;BSL>7*F0*%^]^5:]0B
-M(,J@6\HJ4^3+B^!+[K--_@8-WLI03M@S.N70:N423IKS:<I*B<V>"*-D<,OK
-MG+YIL+[MN\Z2[0/^7;#?@@);[HDH:QW(T=_8K,=+`:B'N,V^;JCNZ09W\*1X
-MJ^R>:'+30:E@+F9U@!PKX.O7+`?\[=^3W:)#O<F67:5$7N!&?B$'WBD)KND5
-MV>DU*>J#(\S*&*8NW*VJWM\PX.B>+.21_KFD3&:C:^E)GNX+SNE_">]C\*$)
-M`,,&#S`V7LTXJ^5O^>0)$>583MJ7&JNWHR:+<M%G@S5G8"-U``=8A`2!PATG
-M0LAYH,X%`M-IIC!3G''^$2(8KS!2^"\#`=%%"1UY@$57L,2#8Q!%<C;6DG$K
-MLG+8@N(E9C.O>M(<'QV^`@<.PSHPLG)@=@>H;8G_$1S'\MH8DIO^H1ZYR6@C
-M:RT'<]('8M,L:N4?VJUC\-NVT:(P+(47W?#6'+']>@?_FB/FOJ]W_P5G,+"/
-MC+IF$(S*2/>*N0,_&D7\<0*R@3'3\6`"`@=D`#!;C,B0+"EO`#&&+Y6)GP2?
-M!2BBLYS6>1!K4/FDW<44#J%KV9;:(;QN/@=GD*</[IBI'XA!FY@*L/KC;..P
-M;YE]6<[`3(FD8YO,AHU.009D(`=?P";XDOS'O"U^NLN>6+C'+`>WZ>%]F[4J
-M@`902YK$#W)\J/TAYYM9JS)N<-8YW?R6TB]?8`9J,1!Y\-^&*#5?<JQ92XCC
-M_"7LH62'F"?^8;4#07.5`=-GP'+:7H-ZYHJ_V(%K0S>PTSA;7IB+#,`!R?6D
-M9E\.,X#<3V%]"*3``.<-=B)%V(\.4,!NIZ0JFX"#="`P\TD)<G?IT%VF&WCL
-MS@*V*!>6`-1?7RL0[>_]L8'JX)ZX'[]"`U]`_5$'%S&C*%B100$^T`<`0?4W
-MUVP@^V."*`T._,`O8/[.P%E(84X0!X(NV="QI*`/F`-?8`M*N!GWZUP""%!@
-M38IMD3XU@0*"@!%`;#N$`>V2'4<$CH``:0)A3G`1+JI&`@$<N#N!E^T3&3\U
-M`?"^A`O49.K.R<TH&5CQII=P8%N=POSQOMAGJ$3")9L-+HT,[*<F-<U@G]@2
-M#F'N0NPU9`9R2)_ZJTLF``JJ+_8EO-3?Y&()`<O\=;(_&.0@728<=:VO$&(Z
-M1`@#9QE@0DL*8%+A*05PH1Y=(,1<@"PX6"SM-%I`P!;@4LPK"PV(I4"67$#I
-M"EJ.*"L5$R(P!)#201I)P*@C0:9M-,!NC4AJ1U8K=&DFQ5*+2@1CP7W9$"EM
-MPV[X!12`E,),]<'])04VT)68Q%<Z6N2,#HRELB2(^)P]]&3YT"PDA.#4!NB`
-M+KM_<T`?@K/GU!`YD]7Z`F1`4K1#[4`,2=-%!!9TK/O%0T)'!;BA-TP`%]$R
-M[(O'1+R`1$/\2R.@''K$,/`%5.);"P..;".:`8_8C*[3=^)Q`80A"D3_D!-1
-M(DTL'"Q1S\V&A+@/81;/>FL13@'LJ>Q"%:NB5;R*6#$K:L6M*!&8X5AH`C'*
-M):D,KJ@5<`MR.0F]1;>DQ;[0$F2`3B`N,Z$F<(2<(`-L@&)@+F2QN4"7I2!=
-MGD)7J"YY,3`*1LDP`LI**`*+5&-TG2*YLHK(3?P3"7KE!L@BQJ)+CD`/2`!>
-MD0TH`%3B!'#`9<R,+@`HR9`)<@6<P&6T$7E"`8S&)L!,BD`/H`'"I0:H1@02
-M>GK`"Q@5C,4%[*-?)`;F@'M@%?%H;RV6P4@<BZ-Q/(Z",3.^`-"(`Y!C13"+
-MO"4EJ$7IR!97@@VP`3>`!@R&CF`#8*,,4`RI2"0TAL?@$IPC9=B+F,$O4A?U
-M:![;HWMD"'Y(!("A[Q(;PDL9(B^G33Z@E_0@:[)-&WH;PN+;T!>!`1[B(Z@I
-M#WE(/2A`Z18?%8"!##!>YE,PF@*CH=@$CA$36&/,F`H(<R$R3<G1$"#"07(!
-M^0C9,LRB"5N9J45\F-018BS-B-EZ)J;/B(P_XR^@#)<0D?+Q2;P8'"D2-,5\
-MH#%?1LH(BPM)9';,F>DQ:P+(_`@A`R?>C!CBD7=BSNP)F`<2GTR>*19\IC?T
-M&D!3'R1%EK$4/)++0,B`4RQ$!83P=Z>"QZR*B/,JEJ2;J4)/TD!&R5U19XI#
-ME<0SQ`+,9$E&@6*N3)=T%M""T-P:.5DMKD7+.)&-9BGDJDA#+CQ:I;D1+U+"
-MG`5-`R0E9,OAD9_FON`+?5%J_,6IF33&K6"L&G_1:E[9J_D6L:;>^(F*L7$&
-MY8AD"4>26=0'CU%P>,V,]#7`9D@(&V(S'*9$?$0V,H--V@R)U#!8I:V!:-1&
-M:(@9;`-4[@V`/`XX,@$(R.X0;I;'N+$:QL+?I!N]$1T*Y*MT-V3#;,B-'T&Q
-M^F.S_(_YYEO\JKJ!'-!-WJ@Q>X-0_@N#\S!VQ.`H'`PGZEF./`%QEDWD"!B4
-M(U@E&V.9,>3EQ^%HH(ITU`C3<<I`S.KX,%0/=N!('CD[8)!1F3G`PW;8G$62
-M<P0*59D\:T3_)""A,T>*SOG(F$FG??!(/R(_Z`?W<2AF9X2DG:M3/[+.!7H@
-M7$>64)"O@T&*C_,X/A[$0(*0J2,S`PC-S"8JA(6X$!CR@[+*#2$G.P3J?)Z]
-MTW>,B#@)/$S$B1A(C&EXC`CB43Q:A/'@DU\B1AI)Y/F8:83R1)V1Z3V&#AT1
-M`G9DD@B!/,(C/P_3*3T3A38:DKR90%)/((0DDN3U6!),\G]H3R>Q/:(D]QC(
-M(A165HGON9G!Q^O4$I\Y=G2)\O$E*RB8.)]BDD&BS_1I)CSR^D@3BZ)]+@OW
-MT2;<Y*M\$]HS?LI)U$$_41-]4`_QY'Z2@#SAD?,'G]@?_--/ZLX_Z3]GA*`(
-ME0A40PB0`<HG#V5D+J!'4E$NBH$DGAREC5`@D.)*1DI)V2$:*`FDE-_A@1I*
-M")(I[(,$V903Q'12D(%\`CUE!U$5%Z0^+:8,0BJ-IP8Q%?:!@_(/"ZHJ]N.J
-M)!2M8B"'$!+X*D9(K$S,7^F%1)%`<"W;R07@@`1@`Q2H*KJ6K2@CO`";,!D;
-MI`L@`@$B""S,\F`3+D0,P`U^Y8+*!K'F`G)<(P$!.,!!/H$FX0*FP(9P`J=$
-M:SH!,W-`94M"<)!.($!XK#)Q0,-,'0-I;P`/.$@7>CNRP`2!`NG$F;B`&6KS
-M$.AH4:%0SPB4!^00!)8">W*05;1>4D.R-$0W!/*8(MT#GMA.)X!#4058!`ND
-M2`&PNN3V(RP#@%`*`:)`S+'(EQP&QQ4K'"W@.'`I4X8U<.)V(P.A0C9`*YJ'
-M!K#H4IB&&XJ%0H$?>D`50$U3`*?-D&I1QJ0JG%L=TUTY0HLZM0'H(*$`'("D
-M/\)+"<DGX?5ZS1SPE4*@/+2`I&`D6D"&T(0;`@_(TBOJ`I*`;)"B0()]6%'+
-MH0"F@,AA2XLB$T('U;9)"V01T(PNP),J@"10*-)%'9AX,.V/!3*6]B.`*!Y(
-MD3CO642[H9$H",=GH0X*`'SU&FMS-198;_@;?\\--`=_D6E:6DDR$N4C@Z$*
-M]0$>@`CXVAH_!NGUABSA+^(IQE$?O6*?%HYA6APH5A]-#H+&$*J%3QHLR\`?
-MM9>$X]=LB%J&V@)$-&4+R9"3`A$5]1\$&_CR$WYTH"8<0HK$,FH]355J30ZL
-MTI2&]4(7Y#@;**!\E+#^%2TJC4,5J74T452'CZHDRP1&56(*X-35/"1QI1Q$
-MF0@48;$_C*PZYD]15=*I63""7)C3`JE,\R-,&UV"+)7A`9PA'8#&3EV#ZV+"
-M.$@L8$5+'`B0`4&5/O'0FP=2X<!#=0^=]),>,5A1/L99TE&`_,]/S#YR.E:7
-M0OEB#QU0;0@&%J``8$7^6Y!+P4^LI30P([P$14T3%K6&QE50.BB9:&8,AOH!
-M4"@-UX1N/`*CF0.NHK9%&*SA`SP"(;JC2\XX9*($`39:Z(:8'L:CO6%.!YE*
-M_Q0K_5.O=%)^L8+A(&UI%[$#SD,+*(`J@'!R*L00I$O2K=J(A0DP$*K:T`/\
-M(6+T5.?*%I+"9S&FR)2(,JWZ05M5Z6UUI3EB4G:6SQ):$JAI,2U_ZD25!<C1
-M6V7#(BU$G@6TD"(7<%Y+2V'E=^I00APK%NI;W^L+2(?+\8"^@&D8#/D+,;6F
-MLC)-0`[ND`<<Y#'MHK=#T+$/)H`[^FH3%0D@@+#2UZ6`!S(AAM6P9!5(F-7%
-M`&+]JII0@(&U-PQ6"WNB`)ELP`$9UL)F0IB60ETK"*`=Q82@*``@`EI9QW%=
-M&DN4AJ+1[:0`D&"#>$)&`L&R.I+A]:Q>J/%Z,.VQQC\%$%)91!QU`UA4-MB!
-M&P`"P(/7$U8VXN.IA3)Z8<'#>SRS:#;-JMDURV;;K)M]LW`VSLK9.4MGZZR=
-HO;-X-L_JV3W+9_NLG_VS@#;0"MI!2V@+K:$]M(@VT2K:1<MH&^UD`$MG
-`
-end
+++ /dev/null
-Received: from austin.bsdi.com (root{9l9gVDC7v8t3dlv0OtXTlby6X1zBWd56}@austin.BSDI.COM [205.230.224.49]) by knecht.Sendmail.ORG (8.8.2/8.8.2) with ESMTP id JAA05023 for <eric@sendmail.org>; Thu, 31 Oct 1996 09:29:47 -0800 (PST)
-Received: from austin.bsdi.com (localhost [127.0.0.1]) by austin.bsdi.com (8.7.4/8.7.3) with ESMTP id KAA19250; Thu, 31 Oct 1996 10:28:18 -0700 (MST)
-Message-Id: <199610311728.KAA19250@austin.bsdi.com>
-To: Eric Allman <eric@sendmail.org>
-cc: marc@xfree86.org
-Subject: Updated mailprio_0_93.shar
-From: Tony Sanders <sanders@earth.com>
-Organization: Berkeley Software Design, Inc.
-Date: Thu, 31 Oct 1996 10:28:14 -0700
-Sender: sanders@austin.bsdi.com
-
-Eric, please update contrib/mailprio in the sendmail distribution
-to this version at your convenience. Thanks.
-
-I've also made this available in:
- ftp://ftp.earth.com/pub/postmaster/
-
-mailprio_0_93.shar follows...
-
-#!/bin/sh
-# This is a shell archive (produced by GNU sharutils 4.1).
-# To extract the files from this archive, save it to some FILE, remove
-# everything before the `!/bin/sh' line above, then type `sh FILE'.
-#
-# Made on 1996-10-31 10:07 MST by <sanders@earth.com>.
-#
-# Existing files will *not* be overwritten unless `-c' is specified.
-#
-# This shar contains:
-# length mode name
-# ------ ---------- ------------------------------------------
-# 8260 -rwxr-xr-x mailprio
-# 3402 -rw-r--r-- mailprio.README
-# 4182 -rwxr-xr-x mailprio_mkdb
-#
-touch -am 1231235999 $$.touch >/dev/null 2>&1
-if test ! -f 1231235999 && test -f $$.touch; then
- shar_touch=touch
-else
- shar_touch=:
- echo
- echo 'WARNING: not restoring timestamps. Consider getting and'
- echo "installing GNU \`touch', distributed in GNU File Utilities..."
- echo
-fi
-rm -f 1231235999 $$.touch
-#
-# ============= mailprio ==============
-if test -f 'mailprio' && test X"$1" != X"-c"; then
- echo 'x - skipping mailprio (file already exists)'
-else
- echo 'x - extracting mailprio (text)'
- sed 's/^X//' << 'SHAR_EOF' > 'mailprio' &&
-#!/usr/bin/perl
-#
-# mailprio,v 1.4 1996/10/31 17:03:52 sanders Exp
-# Version 0.93 -- Thu Oct 31 09:42:25 MST 1996
-#
-# mailprio -- setup mail priorities for a mailing list
-#
-# Copyright 1994, 1996, Tony Sanders <sanders@earth.com>
-# Rights are hereby granted to download, use, modify, sell, copy, and
-# redistribute this software so long as the original copyright notice
-# and this list of conditions remain intact and modified versions are
-# noted as such.
-#
-# I would also very much appreciate it if you could send me a copy of
-# any changes you make so I can possibly integrate them into my version.
-#
-# Options:
-# -p priority_database -- Specify database to use if not default
-# -q -- Process sendmail V8.8.X queue format files
-#
-# Sort mailing lists or sendmail queue files by mailprio database.
-# Files listed on the command line are locked and then sorted in place, in
-# the absence of any file arguments it will read STDIN and write STDOUT.
-#
-# Examples:
-# mailprio < mailing-list > sorted_list
-# mailprio mailing-list1 mailing-list2 mailing-list3 ...
-# mailprio -q /var/spool/mqueue/qf*
-# To double check results:
-# sort sorted_list > checkit; sort orig-mailing-list | diff - checkit
-#
-# To get the maximum value from a transaction delay based priority
-# function you need to reorder the distribution list (and the mail
-# queue files for that matter) fairly often; you could even have
-# your mailing list software reorder the list before each outgoing
-# message.
-#
-$usage = "Usage: mailprio [-p priodb] [-q] [mailinglists ...]\n";
-$home = "/home/sanders/lists";
-$priodb = "$home/mailprio";
-$locking = "flock"; # "flock" or "fcntl"
-X
-# In shell, it would go more or less like this:
-# old_mailprio > /tmp/a
-# fgrep -f lists/inet-access /tmp/a | sed -e 's/^.......//' > /tmp/b
-# ; /tmp/b contains list of known users, faster delivery first
-# fgrep -v -f /tmp/b lists/inet-access > /tmp/c
-# ; put all unknown stuff at the top of new list for now
-# echo '# -----' >> /tmp/c
-# cat /tmp/b >> /tmp/c
-X
-$qflag = 0;
-while ($main'ARGV[0] =~ /^-/) {
-X $args = shift;
-X if ($args =~ m/\?/) { print $usage; exit 0; }
-X if ($args =~ m/q/) { $qflag = 1; }
-X if ($args =~ m/p/) {
-X $priodb = shift || die $usage, "-p requires argument\n"; }
-}
-X
-push(@main'ARGV, '-') if ($#ARGV < 0);
-while ($file = shift @ARGV) {
-X if ($file eq "-") {
-X $source = "main'STDIN";
-X $sink = "main'STDOUT";
-X } else {
-X $sink = $source = "FH";
-X open($source, "+< $file") || do { warn "$file: $!\n"; next; };
-X if (!defined &seize($source, &LOCK_EX | &LOCK_NB)) {
-X # couldn't get lock, just skip it
-X close($source);
-X next;
-X }
-X }
-X
-X local(*list);
-X &process($source, *list);
-X
-X # setup to write output
-X if ($file ne "-") {
-X # zero the file (FH is hardcoded because truncate requires it, sigh)
-X seek(FH, 0, 0) || die "$file: seek: $!\n";
-X truncate(FH, 0) || die "$file: truncate: $!\n";
-X }
-X
-X # do the dirty work
-X &output($sink, *list);
-X
-X close($sink) || warn "$file: $!\n"; # close clears the lock
-X close($source);
-}
-X
-sub process {
-X # Setup %list and @list
-X local($source, *list) = @_;
-X local($addr, $canon);
-X while ($addr = <$source>) {
-X chop $addr;
-X next if $addr =~ /^# ----- /; # that's our line
-X push(@list, $addr), next if $addr =~ /^\s*#/; # save comments
-X if ($qflag) {
-X next if $addr =~ m/^\./;
-X push(@list, $addr), next if !($addr =~ s/^(R[^:]*:)//);
-X $Rflags = $1;
-X }
-X $canon = &canonicalize((&simplify_address($addr))[0]);
-X unless (defined $canon) {
-X warn "$file: no address found: $addr\n";
-X push(@list, ($qflag?$Rflags:'') . $addr); # save it as is
-X next;
-X }
-X if (defined $list{$canon}) {
-X warn "$file: duplicate: ``$addr -> $canon''\n";
-X push(@list, ($qflag?$Rflags:'') . $addr); # save it as is
-X next;
-X }
-X $list{$canon} = $addr;
-X }
-}
-X
-sub output {
-X local($sink, *list) = @_;
-X
-X local($to, *prio, *userprio, *useracct);
-X dbmopen(%prio, $priodb, 0644) || die "$priodb: $!\n";
-X foreach $to (keys %list) {
-X if (defined $prio{$to}) {
-X # add to list of found users (%userprio) and remove from %list
-X # so that we know what users were not yet prioritized
-X $userprio{$to} = $prio{$to}; # priority
-X $useracct{$to} = $list{$to}; # string
-X delete $list{$to};
-X }
-X }
-X dbmclose(%prio);
-X
-X # Put all the junk we found at the very top
-X # (this might not always be a feature)
-X print $sink join("\n", @list), "\n" if int(@list);
-X
-X # prioritized list of users
-X if (int(keys %userprio)) {
-X print $sink '# ----- prioritized users', "\n" unless $qflag;
-X foreach $to (sort by_userprio keys %userprio) {
-X die "Opps! Something is seriously wrong with useracct: $to\n"
-X unless defined $useracct{$to};
-X print $sink 'RFD:' if $qflag;
-X print $sink $useracct{$to}, "\n";
-X }
-X }
-X
-X # unprioritized users go last, fast accounts will get moved up eventually
-X # XXX: should go before the "really slow" prioritized users?
-X if (int(keys %list)) {
-X print $sink '# ----- unprioritized users', "\n" unless $qflag;
-X foreach $to (keys %list) {
-X print $sink 'RFD:' if $qflag;
-X print $sink $list{$to}, "\n";
-X }
-X }
-X
-X print $sink ".\n" if $qflag;
-}
-X
-sub by_userprio {
-X # sort first by priority, then by key.
-X $userprio{$a} <=> $userprio{$b} || $a cmp $b;
-}
-X
-# REPL-LIB ---------------------------------------------------------------
-X
-sub canonicalize {
-X local($addr) = @_;
-X # lowercase, strip leading/trailing whitespace
-X $addr =~ y/A-Z/a-z/; $addr =~ s/^\s+//; $addr =~ s/\s+$//; $addr;
-}
-X
-# @addrs = simplify_address($addr);
-sub simplify_address {
-X local($_) = shift;
-X 1 while s/\([^\(\)]*\)//g; # strip comments
-X 1 while s/"[^"]*"//g; # strip comments
-X split(/,/); # split into parts
-X foreach (@_) {
-X 1 while s/.*<(.*)>.*/\1/;
-X s/^\s+//;
-X s/\s+$//;
-X }
-X @_;
-}
-X
-### ---- ###
-#
-# Error codes
-#
-do 'errno.ph';
-eval 'sub ENOENT {2;}' unless defined &ENOENT;
-eval 'sub EINTR {4;}' unless defined &EINTR;
-eval 'sub EINVAL {22;}' unless defined &EINVAL;
-X
-#
-# File locking
-#
-do 'sys/unistd.ph';
-eval 'sub SEEK_SET {0;}' unless defined &SEEK_SET;
-X
-do 'sys/file.ph';
-eval 'sub LOCK_SH {0x01;}' unless defined &LOCK_SH;
-eval 'sub LOCK_EX {0x02;}' unless defined &LOCK_EX;
-eval 'sub LOCK_NB {0x04;}' unless defined &LOCK_NB;
-eval 'sub LOCK_UN {0x08;}' unless defined &LOCK_UN;
-X
-do 'fcntl.ph';
-eval 'sub F_GETFD {1;}' unless defined &F_GETFD;
-eval 'sub F_SETFD {2;}' unless defined &F_SETFD;
-eval 'sub F_GETFL {3;}' unless defined &F_GETFL;
-eval 'sub F_SETFL {4;}' unless defined &F_SETFL;
-eval 'sub O_NONBLOCK {0x0004;}' unless defined &O_NONBLOCK;
-eval 'sub F_SETLK {8;}' unless defined &F_SETLK; # nonblocking
-eval 'sub F_SETLKW {9;}' unless defined &F_SETLKW; # lockwait
-eval 'sub F_RDLCK {1;}' unless defined &F_RDLCK;
-eval 'sub F_UNLCK {2;}' unless defined &F_UNLCK;
-eval 'sub F_WRLCK {3;}' unless defined &F_WRLCK;
-$s_flock = "sslll"; # struct flock {type, whence, start, len, pid}
-X
-# return undef on failure
-sub seize {
-X local ($FH, $lock) = @_;
-X local ($ret);
-X if ($locking eq "flock") {
-X $ret = flock($FH, $lock);
-X return ($ret == 0 ? undef : 1);
-X } else {
-X local ($flock, $type) = 0;
-X if ($lock & &LOCK_SH) { $type = &F_RDLCK; }
-X elsif ($lock & &LOCK_EX) { $type = &F_WRLCK; }
-X elsif ($lock & &LOCK_UN) { $type = &F_UNLCK; }
-X else { $! = &EINVAL; return undef; }
-X $flock = pack($s_flock, $type, &SEEK_SET, 0, 0, 0);
-X $ret = fcntl($FH, ($lock & &LOCK_NB) ? &F_SETLK : &F_SETLKW, $flock);
-X return ($ret == -1 ? undef : 1);
-X }
-}
-SHAR_EOF
- $shar_touch -am 1031100396 'mailprio' &&
- chmod 0755 'mailprio' ||
- echo 'restore of mailprio failed'
- shar_count="`wc -c < 'mailprio'`"
- test 8260 -eq "$shar_count" ||
- echo "mailprio: original size 8260, current size $shar_count"
-fi
-# ============= mailprio.README ==============
-if test -f 'mailprio.README' && test X"$1" != X"-c"; then
- echo 'x - skipping mailprio.README (file already exists)'
-else
- echo 'x - extracting mailprio.README (text)'
- sed 's/^X//' << 'SHAR_EOF' > 'mailprio.README' &&
-mailprio README
-X
-mailprio.README,v 1.2 1996/10/31 17:03:54 sanders Exp
-Version 0.93 -- Thu Oct 31 09:42:25 MST 1996
-X
-Copyright 1994, 1996, Tony Sanders <sanders@earth.com>
-Rights are hereby granted to download, use, modify, sell, copy, and
-redistribute this software so long as the original copyright notice
-and this list of conditions remain intact and modified versions are
-noted as such.
-X
-I would also very much appreciate it if you could send me a copy of
-any changes you make so I can possibly integrate them into my version.
-X
-The current version of this and other related mail tools are available in:
-X ftp://ftp.earth.com/pub/postmaster/
-X
-Even with the new persistent host status in sendmail V8.8.X this
-function can still reduce the lag time distributing mail to a large
-group of people. It also makes it a little more likely that everyone
-will get mailing list mail in the order sent which can help reduce
-duplicate postings. Basically, the goal is to put slow hosts at
-the bottom of the list so that as many fast hosts are delivered
-as quickly as possible.
-X
-CONTENTS
-========
-X
-X mailprio.README -- simple docs
-X mailprio -- the address sorter
-X mailprio_mkdb -- builds the database for the sorter
-X
-X
-CHANGES
-=======
-X Version 0.92
-X Initial public release.
-X
-X Version 0.93
-X Updated to make use of the (somewhat) new xdelay statistic.
-X Changed -q flag to support new sendmail queue file format (RFD:<addr>).
-X Fixed argument parsing bug.
-X Fixed bug with database getting "garbage" in it.
-X
-X
-CONFIGURATION
-=============
-X
-X You need to edit each script and ensure proper configuration.
-X
-X In mailprio check: #!perl path, $home, $priodb, $locking
-X
-X In mailprio_mkdb check: #!perl path, $home, $priodb, $maillog
-X
-X
-USAGE: mailprio
-===============
-X
-X Usage: mailprio [-p priodb] [-q] [mailinglists ...]
-X -p priority_database -- Specify database to use if not default
-X -q -- Process sendmail queue format files
-X [USE WITH CAUTION]
-X
-X Sort mailing lists or sendmail V8 queue files by mailprio database.
-X Files listed on the command line are locked and then sorted in place, in
-X the absence of any file arguments it will read STDIN and write STDOUT.
-X
-X Examples:
-X mailprio < mailing-list > sorted_list
-X mailprio mailing-list1 mailing-list2 mailing-list3 ...
-X mailprio -q /var/spool/mqueue/qf* [not recommended]
-X To double check results:
-X sort sorted_list > checkit; sort orig-mailing-list | diff - checkit
-X
-X NOTE:
-X To get the maximum value from a transaction delay based priority
-X function you need to reorder the distribution list (and the mail
-X queue files for that matter) fairly often; you could even have
-X your mailing list software reorder the list before each outgoing
-X message.
-X
-X
-USAGE: mailprio_mkdb
-====================
-X
-X Usage: mailprio_mkdb [-l maillog] [-p priodb]
-X -l maillog -- Specify maillog to process if not default
-X -p priority_database -- Specify database to use if not default
-X
-X Builds the mail priority database using information from the maillog.
-X
-X Run at least nightly before you rotate the maillog. If you are
-X going to run mailprio more often than that then you will need to
-X load the current maillog information before that will do any good
-X (and to keep from reloading the same information you will need
-X some kind of incremental maillog information to load from).
-SHAR_EOF
- $shar_touch -am 1031100396 'mailprio.README' &&
- chmod 0644 'mailprio.README' ||
- echo 'restore of mailprio.README failed'
- shar_count="`wc -c < 'mailprio.README'`"
- test 3402 -eq "$shar_count" ||
- echo "mailprio.README: original size 3402, current size $shar_count"
-fi
-# ============= mailprio_mkdb ==============
-if test -f 'mailprio_mkdb' && test X"$1" != X"-c"; then
- echo 'x - skipping mailprio_mkdb (file already exists)'
-else
- echo 'x - extracting mailprio_mkdb (text)'
- sed 's/^X//' << 'SHAR_EOF' > 'mailprio_mkdb' &&
-#!/usr/bin/perl
-#
-# mailprio_mkdb,v 1.5 1996/10/31 17:03:53 sanders Exp
-# Version 0.93 -- Thu Oct 31 09:42:25 MST 1996
-#
-# mailprio_mkdb -- make mail priority database based on delay times
-#
-# Copyright 1994, 1996, Tony Sanders <sanders@earth.com>
-# Rights are hereby granted to download, use, modify, sell, copy, and
-# redistribute this software so long as the original copyright notice
-# and this list of conditions remain intact and modified versions are
-# noted as such.
-#
-# I would also very much appreciate it if you could send me a copy of
-# any changes you make so I can possibly integrate them into my version.
-#
-# The average function moves the value around quite rapidly (half-steps)
-# which may or may not be a feature. This version uses the new xdelay
-# statistic (new as of sendmail V8) which is per transaction. We also
-# weight the result based on the overall delay.
-#
-# Something that might be worth doing for systems that don't support
-# xdelay would be to compute an approximation of the transaction delay
-# by sorting by messages-id and delay then computing the difference
-# between adjacent delay values.
-#
-# To get the maximum value from a transaction delay based priority
-# function you need to reorder the distribution list (and the mail
-# queue files for that matter) fairly often; you could even have
-# your mailing list software reorder the list before each outgoing
-# message.
-X
-$usage = "Usage: mailprio_mkdb [-l maillog] [-p priodb]\n";
-$home = "/home/sanders/lists";
-$maillog = "/var/log/maillog";
-$priodb = "$home/mailprio";
-X
-while ($ARGV[0] =~ /^-/) {
-X $args = shift;
-X if ($args =~ m/\?/) { print $usage; exit 0; }
-X if ($args =~ m/l/) {
-X $maillog = shift || die $usage, "-l requires argument\n"; }
-X if ($args =~ m/p/) {
-X $priodb = shift || die $usage, "-p requires argument\n"; }
-}
-X
-$SIG{'PIPE'} = 'handle_pipe';
-X
-# will merge with existing information
-dbmopen(%prio, $priodb, 0644) || die "$priodb: $!\n";
-&getlog_stats($maillog, *prio);
-dbmclose(%prio);
-exit(0);
-X
-sub handle_pipe {
-X dbmclose(%prio);
-}
-X
-sub getlog_stats {
-X local($maillog, *stats) = @_;
-X local($to, $delay);
-X local($h, $m, $s);
-X open(MAILLOG, "< $maillog") || die "$maillog: $!\n";
-X while (<MAILLOG>) {
-X next unless / to=/ && / stat=/;
-X next if / stat=queued/;
-X if (/ stat=sent/i) {
-X # read delay and xdelay and convert to seconds
-X ($delay) = (m/ delay=([^,]*),/);
-X next unless $delay;
-X ($h, $m, $s) = split(/:/, $delay);
-X $delay = ($h * 60 * 60) + ($m * 60) + $s;
-X
-X ($xdelay) = (m/ xdelay=([^,]*),/);
-X next unless $xdelay;
-X ($h, $m, $s) = split(/:/, $xdelay);
-X $xdelay = ($h * 60 * 60) + ($m * 60) + $s;
-X
-X # Now weight the delay factor by the transaction delay (xdelay).
-X $xdelay /= 300; # [0 - 1(@5 min)]
-X $xdelay += 0.5; # [0.5 - 1.5]
-X $xdelay = 1.5 if $xdelay > 1.5; # clamp
-X $delay *= $xdelay; # weight delay by xdelay
-X }
-X elsif (/, stat=/) {
-X # delivery failure of some sort (i.e. bad)
-X $delay = 432000; # force 5 days
-X }
-X $delay = 1000000 if $delay > 1000000;
-X
-X # filter the address(es); isn't perfect but is "good enough"
-X $to = $_; $to =~ s/^.* to=//;
-X 1 while $to =~ s/\([^\(\)]*\)//g; # strip comments
-X 1 while $to =~ s/"[^"]*"//g; # strip comments
-X $to =~ s/, .*//; # remove other stat info
-X foreach $addr (&simplify_address($to)) {
-X next unless $addr;
-X $addr = &canonicalize($addr);
-X $stats{$addr} = $delay unless defined $stats{$addr}; # init
-X # pseudo-average in the new delay (half-steps)
-X # simple, moving average
-X $stats{$addr} = int(($stats{$addr} + $delay) / 2);
-X }
-X }
-X close(MAILLOG);
-}
-X
-# REPL-LIB ---------------------------------------------------------------
-X
-sub canonicalize {
-X local($addr) = @_;
-X # lowercase, strip leading/trailing whitespace
-X $addr =~ y/A-Z/a-z/; $addr =~ s/^\s+//; $addr =~ s/\s+$//; $addr;
-}
-X
-# @addrs = simplify_address($addr);
-sub simplify_address {
-X local($_) = shift;
-X 1 while s/\([^\(\)]*\)//g; # strip comments
-X 1 while s/"[^"]*"//g; # strip comments
-X split(/,/); # split into parts
-X foreach (@_) {
-X 1 while s/.*<(.*)>.*/\1/;
-X s/^\s+//;
-X s/\s+$//;
-X }
-X @_;
-}
-SHAR_EOF
- $shar_touch -am 1031100396 'mailprio_mkdb' &&
- chmod 0755 'mailprio_mkdb' ||
- echo 'restore of mailprio_mkdb failed'
- shar_count="`wc -c < 'mailprio_mkdb'`"
- test 4182 -eq "$shar_count" ||
- echo "mailprio_mkdb: original size 4182, current size $shar_count"
-fi
-exit 0
+++ /dev/null
-Message-Id: <199309031900.OAA19417@ignatz.acs.depaul.edu>
-To: bug-mh@ics.uci.edu
-cc: mh-users@ics.uci.edu, eric@cs.berkeley.edu
-Subject: MH-6.8.1/Sendmail 8.X (MH patch) updated
-Date: Fri, 03 Sep 1993 14:00:46 -0500
-From: Dave Nelson <dcn@ignatz.acs.depaul.edu>
-
-
- This patch will fix the "X-auth..." warnings from the newer
-Sendmails (8.X) while continuing to work with the old sendmails.
-
- I think the following patch will make everyone happy.
-
- 1) Anybody with MH-6.8.1 can install this. It doesn't matter
- what version of sendmail you're running. It doesn't matter
- if you're not running sendmail (but it won't fix anything
- for you).
-
- 2) No configuration file hacks. If the -client switch is
- absent (the default), the new sendmails will get an EHLO
- using what LocalName() returns as the hostname. On my systems,
- this returns the FQDN. If the EHLO fails with a result between
- 500 and 599 and the -client switch is not set, we give up on
- sending EHLO/HELO and just go deliver the mail.
-
- 3) No new configuration options.
-
- 4) Retains the undocumented -client switch. One warning: it
- is possible using the -client switch to cause the old sendmails
- to return "I refuse to talk to myself". You could do this under
- the old code as well. This will happen if you claim to be the
- same system as the sendmail you're sending to is running on.
- That's pointless, but possible. If you do this, just like under
- the old code, you will get an error.
-
- 5) If you're running a site with both old and new sendmails, you only
- have to build MH once. The code's the same; works with them
- both.
-
- If you decide to install this, make sure that you look the patch
-over and that you agree with what it is doing. It works for me, but I
-can't test it on every possible combination. Make sure that it works
-before you really install it for your users, if any. No promises.
-
- To install this, save this to a file in the mts/sendmail directory.
-Feed it to patch. Patch will ignore the non-patch stuff. You should have
-"mts sendmail/smtp" in your configuration file. This works with old and
-new sendmails. Using "mts sendmail" will cause the new sendmails to
-print an "X-auth..." warning about who owns the process piping the mail
-message. I don't know of anyway of getting rid of these.
-
- mh-config (if necessary), make, make inst-all.
-
-
-I hope this helps people.
-
-/dcn
-
-Dave Nelson
-Academic Computer Services
-DePaul University, Chicago
-
-*** smail.c Fri Sep 3 11:58:05 1993
---- smail.c Fri Sep 3 11:57:27 1993
-***************
-*** 239,261 ****
- return RP_RPLY;
- }
-
-! if (client && *client) {
-! doingEHLO = 1;
-! result = smtalk (SM_HELO, "EHLO %s", client);
-! doingEHLO = 0;
-
-! if (500 <= result && result <= 599)
- result = smtalk (SM_HELO, "HELO %s", client);
-!
-! switch (result) {
- case 250:
-! break;
-
- default:
- (void) sm_end (NOTOK);
- return RP_RPLY;
- }
- }
-
- #ifndef ZMAILER
- if (onex)
---- 239,276 ----
- return RP_RPLY;
- }
-
-! doingEHLO = 1;
-! result = smtalk (SM_HELO, "EHLO %s",
-! (client && *client) ? client : LocalName());
-! doingEHLO = 0;
-!
-! switch (result)
-! {
-! case 250:
-! break;
-
-! default:
-! if (!(500 <= result && result <= 599))
-! {
-! (void) sm_end (NOTOK);
-! return RP_RPLY;
-! }
-!
-! if (client && *client)
-! {
- result = smtalk (SM_HELO, "HELO %s", client);
-! switch (result)
-! {
- case 250:
-! break;
-
- default:
- (void) sm_end (NOTOK);
- return RP_RPLY;
-+ }
- }
- }
-+
-
- #ifndef ZMAILER
- if (onex)
-***************
-*** 357,380 ****
- return RP_RPLY;
- }
-
-! if (client && *client) {
-! doingEHLO = 1;
-! result = smtalk (SM_HELO, "EHLO %s", client);
-! doingEHLO = 0;
-
-! if (500 <= result && result <= 599)
- result = smtalk (SM_HELO, "HELO %s", client);
-!
-! switch (result) {
-! case 250:
- break;
-
-! default:
- (void) sm_end (NOTOK);
- return RP_RPLY;
- }
- }
-!
- send_options: ;
- if (watch && EHLOset ("XVRB"))
- (void) smtalk (SM_HELO, "VERB on");
---- 372,409 ----
- return RP_RPLY;
- }
-
-! doingEHLO = 1;
-! result = smtalk (SM_HELO, "EHLO %s",
-! (client && *client) ? client : LocalName());
-! doingEHLO = 0;
-!
-! switch (result)
-! {
-! case 250:
-! break;
-!
-! default:
-! if (!(500 <= result && result <= 599))
-! {
-! (void) sm_end (NOTOK);
-! return RP_RPLY;
-! }
-
-! if (client && *client)
-! {
- result = smtalk (SM_HELO, "HELO %s", client);
-! switch (result)
-! {
-! case 250:
- break;
-
-! default:
- (void) sm_end (NOTOK);
- return RP_RPLY;
-+ }
- }
- }
-!
- send_options: ;
- if (watch && EHLOset ("XVRB"))
- (void) smtalk (SM_HELO, "VERB on");
+++ /dev/null
-From: "Michael S. Muegel" <mmuegel@cssun6.corp.mot.com>
-Message-Id: <199307280818.AA08111@cssun6.corp.mot.com>
-Subject: Re: contributed software
-To: eric@cs.berkeley.edu (Eric Allman)
-Date: Wed, 28 Jul 1993 03:18:02 -0500 (CDT)
-In-Reply-To: <199307221853.LAA04266@mastodon.CS.Berkeley.EDU> from "Eric Allman" at Jul 22, 93 11:53:47 am
-X-Mailer: ELM [version 2.4 PL22]
-Mime-Version: 1.0
-Content-Type: text/plain; charset=US-ASCII
-Content-Transfer-Encoding: 7bit
-Content-Length: 69132
-
-OK. Here is a new shell archive.
-
-Cheers,
--Mike
-
----- Cut Here and feed the following to sh ----
-#!/bin/sh
-# This is a shell archive (produced by shar 3.49)
-# To extract the files from this archive, save it to a file, remove
-# everything above the "!/bin/sh" line above, and type "sh file_name".
-#
-# made 07/28/1993 08:13 UTC by mmuegel@mot.com (Michael S. Muegel)
-# Source directory /home/ustart/NeXT/src/mail-tools/dist/foo
-#
-# existing files will NOT be overwritten unless -c is specified
-#
-# This shar contains:
-# length mode name
-# ------ ---------- ------------------------------------------
-# 4308 -r--r--r-- README
-# 12339 -r--r--r-- libs/date.pl
-# 3198 -r--r--r-- libs/elapsed.pl
-# 4356 -r--r--r-- libs/mail.pl
-# 6908 -r--r--r-- libs/mqueue.pl
-# 7024 -r--r--r-- libs/newgetopts.pl
-# 4687 -r--r--r-- libs/strings1.pl
-# 1609 -r--r--r-- libs/timespec.pl
-# 5212 -r--r--r-- man/cqueue.1
-# 2078 -r--r--r-- man/postclip.1
-# 6647 -r-xr-xr-x src/cqueue
-# 1836 -r-xr-xr-x src/postclip
-#
-# ============= README ==============
-if test -f 'README' -a X"$1" != X"-c"; then
- echo 'x - skipping README (File already exists)'
-else
-echo 'x - extracting README (Text)'
-sed 's/^X//' << 'SHAR_EOF' > 'README' &&
--------------------------------------------------------------------------------
-Document Revision Control Information:
-X mmuegel
-X /usr/local/ustart/src/mail-tools/dist/foo/README,v
-X 1.1 of 1993/07/28 08:12:53
--------------------------------------------------------------------------------
-X
-1. Introduction
----------------
-X
-These tools may be of use to those sites using sendmail. Both are written in
-Perl. Our site, Mot.COM, receives a ton of mail being a top-level domain
-gateway. We have over 24 domains under us. Needless to say, we must have
-a robust mail system or my head, and others, would be on the chopping block.
-X
-2. Description
---------------
-X
-The first tool, cqueue, checks the sendmail queue for problems. We use
-it to flag problems with subdomain mail servers (and even our own servers
-once in a while ;-). We run it via a cron job every hour during the day.
-You may find this too frequent, however.
-X
-The other program, postclip, is used to "filter" non-deliverable NDNs that
-get sent to our Postmaster account now and then. This ensures privacy of
-e-mail and helps avoid disk problems from huge NDNs. It is different than
-a brute force "just keep the header" approach because it tries hard to keep
-other parts of the message that look like non-delivery information.
-X
-Both have been used for some time at our site with no problems. Everything
-you need should be in this distribution: source, manual pages, and support
-libs. See the manual pages for a complete description of each tool.
-X
-3. Installation
----------------
-X
-No fancy Makefile simply because these tools are all under a large
-hierarchy at my site. Installation should be a snap, however. Install
-the nroff(1) man(5) manual pages from the man subdirectory to the
-appropriate directory on your system. This might be something like
-/usr/local/man/man1.
-X
-Next, install all of the Perl libraries located in the lib subdirectory
-to your Perl library area. /usr/local/lib/perl is a good bet. The person
-who installed Perl at your site will be able to tell you for sure.
-X
-Finally, you need to install the programs. Note that cqueue wants to
-run setuid root by default. This is because the sendmail queue is normally
-only readable by root or some special group. In order to let any user
-run this suidperl is used. suidperl allows a Perl program to run with the
-privileges of another user.
-X
-You will have to edit both the cqueue and postclip programs to change
-the #! line at the top of each. Just change the pathname to whatever is
-appropriate on your system. Note that Larry Wall's fixin program from
-the Camel book can also be used to do this. It is very handy. It changes
-#! lines by looking at your PATH.
-X
-If you do not have suidperl on your system change the #! line in cqueue
-to reference perl instead of suidperl.
-X
-You may also wish to change some constants in cqueue. $DEF_QUEUE should be
-changed to your queue directory if it is not /usr/spool/mqueue. $DEF_TIME
-could be changed easy enough also. It is the time spec for the time duration
-after which a mail message will be reported on if the -a option has not been
-specified. See the manual page for more information and the format of this
-constant (same as the -t argument). Then again, neither of these has to
-be changed. Command line options are there to override their default
-values.
-X
-After you have edited the programs as necessary, all that remains is to
-install them to some executable directory. Install postclip mode 555
-and cqueue mode 4555 with owner root (if using suidperl) or mode 555
-(if not using suidperl).
-X
-4. Gripes, Comments, Etc
-------------------------
-X
-If you start using either of these let me know. I have other mail tools I
-will likely post in the future if these prove useful. Also, if you think
-something is just plain dumb/wrong/stupid let me know!
-X
-Cheers,
--Mike
-X
---
-+----------------------------------------------------------------------------+
-| Michael S. Muegel | Internet E-Mail: mmuegel@mot.com |
-| UNIX Applications Startup Group | Moto Dist E-Mail: X10090 |
-| Corporate Information Office | Voice: (708) 576-0507 |
-| Motorola | Fax: (708) 576-4153 |
-+----------------------------------------------------------------------------+
-SHAR_EOF
-chmod 0444 README ||
-echo 'restore of README failed'
-Wc_c="`wc -c < 'README'`"
-test 4308 -eq "$Wc_c" ||
- echo 'README: original size 4308, current size' "$Wc_c"
-fi
-# ============= libs/date.pl ==============
-if test ! -d 'libs'; then
- echo 'x - creating directory libs'
- mkdir 'libs'
-fi
-if test -f 'libs/date.pl' -a X"$1" != X"-c"; then
- echo 'x - skipping libs/date.pl (File already exists)'
-else
-echo 'x - extracting libs/date.pl (Text)'
-sed 's/^X//' << 'SHAR_EOF' > 'libs/date.pl' &&
-;#
-;# Name
-;# date.pl - Perl emulation of (the output side of) date(1)
-;#
-;# Synopsis
-;# require "date.pl";
-;# $Date = &date(time);
-;# $Date = &date(time, $format);
-;#
-;# Description
-;# This package implements the output formatting functions of date(1) in
-;# Perl. The format options are based on those supported by Ultrix 4.0
-;# plus a couple of additions from SunOS 4.1.1 and elsewhere:
-;#
-;# %a abbreviated weekday name - Sun to Sat
-;# %A full weekday name - Sunday to Saturday
-;# %b abbreviated month name - Jan to Dec
-;# %B full month name - January to December
-;# %c date and time in local format [+]
-;# %C date and time in long local format [+]
-;# %d day of month - 01 to 31
-;# %D date as mm/dd/yy
-;# %e day of month (space padded) - ` 1' to `31'
-;# %E day of month (with suffix: 1st, 2nd, 3rd...)
-;# %f month of year (space padded) - ` 1' to `12'
-;# %h abbreviated month name - Jan to Dec
-;# %H hour - 00 to 23
-;# %i hour (space padded) - ` 1' to `12'
-;# %I hour - 01 to 12
-;# %j day of the year (Julian date) - 001 to 366
-;# %k hour (space padded) - ` 0' to `23'
-;# %l date in ls(1) format
-;# %m month of year - 01 to 12
-;# %M minute - 00 to 59
-;# %n insert a newline character
-;# %p ante-meridiem or post-meridiem indicator (AM or PM)
-;# %r time in AM/PM notation
-;# %R time as HH:MM
-;# %S second - 00 to 59
-;# %t insert a tab character
-;# %T time as HH:MM:SS
-;# %u date/time in date(1) required format
-;# %U week number, Sunday as first day of week - 00 to 53
-;# %V date-time in SysV touch format (mmddHHMMyy)
-;# %w day of week - 0 (Sunday) to 6
-;# %W week number, Monday as first day of week - 00 to 53
-;# %x date in local format [+]
-;# %X time in local format [+]
-;# %y last 2 digits of year - 00 to 99
-;# %Y all 4 digits of year ~ 1700 to 2000 odd ?
-;# %z time zone from TZ environment variable w/ a trailing space
-;# %Z time zone from TZ environment variable
-;# %% insert a `%' character
-;# %+ insert a `+' character
-;#
-;# [+]: These may need adjustment to fit local conventions, see below.
-;#
-;# For the sake of compatibility, a leading `+' in the format
-;# specificaiton is removed if present.
-;#
-;# Remarks
-;# This is version 3.4 of date.pl
-;#
-;# An extension of `ctime.pl' by Waldemar Kebsch (kebsch.pad@nixpbe.UUCP),
-;# as modified by Marion Hakanson (hakanson@ogicse.ogi.edu).
-;#
-;# Unlike date(1), unknown format tags are silently replaced by "".
-;#
-;# defaultTZ is a blatant hack, but I wanted to be able to get date(1)
-;# like behaviour by default and there does'nt seem to be an easy (read
-;# portable) way to get the local TZ name back...
-;#
-;# For a cheap date, try...
-;#
-;# #!/usr/local/bin/perl
-;# require "date.pl";
-;# exit print (&date(time, shift @ARGV) . "\n") ? 0 : 1;
-;#
-;# This package is redistributable under the same terms as apply to
-;# the Perl 4.0 release. See the COPYING file in your Perl kit for
-;# more information.
-;#
-;# Please send any bug reports or comments to tmcgonigal@gallium.com
-;#
-;# Modification History
-;# Nmemonic Version Date Who
-;#
-;# NONE 1.0 02feb91 Terry McGonigal (tmcgonigal@gallium.com)
-;# Created from ctime.pl
-;#
-;# NONE 2.0 07feb91 tmcgonigal
-;# Added some of Marion Hakanson (hakanson@ogicse.ogi.edu)'s ctime.pl
-;# TZ handling changes.
-;#
-;# NONE 2.1 09feb91 tmcgonigal
-;# Corrected week number calculations.
-;#
-;# NONE 2.2 21oct91 tmcgonigal
-;# Added ls(1) date format, `%l'.
-;#
-;# NONE 2.3 06nov91 tmcgonigal
-;# Added SysV touch(1) date-time format, `%V' (pretty thin as
-;# mnemonics go, I know, but `t' and `T' were both gone already!)
-;#
-;# NONE 2.4 05jan92 tmcgonigal
-;# Corrected slight (cosmetic) problem with %V replacment string
-;#
-;# NONE 3.0 09jul92 tmcgonigal
-;# Fixed a couple of problems with &ls as pointed out by
-;# Thomas Richter (richter@ki1.chemie.fu-berlin.de), thanks Thomas!
-;# Also added a couple of SunOS 4.1.1 strftime-ish formats, %i and %k
-;# for space padded hours (` 1' to `12' and ` 0' to `23' respectivly),
-;# and %C for locale long date/time format. Changed &mH to take a
-;# pad char parameter to make to evaled code for %i and %k simpler.
-;# Added %E for suffixed day-of-month (ie 1st, 3rd, 4th etc).
-;#
-;# NONE 3.1 16jul92 tmcgonigal
-;# Added `%u' format to generate date/time in date(1) required
-;# format (ie '%y%m%d%H%M.%S').
-;#
-;# NONE 3.2 23jan93 tmcgonigal
-;# Added `%f' format to generate space padded month numbers, added
-;# `%E' to the header comments, it seems to have been left out (and
-;# I'm sure I wanted to use it at some point in the past...).
-;#
-;# NONE 3.3 03feb93 tmcgonigal
-;# Corrected some problems with AM/PM handling pointed out by
-;# Michael S. Muegel (mmuegel@mot.com). Thanks Michael, I hope
-;# this is the behaviour you were looking for, it seems more
-;# correct to me...
-;#
-;# NONE 3.4 26jul93 tmcgonigal
-;# Incorporated some fixes provided by DaviD W. Sanderson
-;# (dws@ssec.wisc.edu): February was spelled incorrectly and
-;# &wkno() was always using the current year while calculating
-;# week numbers, regardless of year implied by the time value
-;# passed to &date(). DaviD also contributed an improved &date()
-;# test script, thanks DaviD, I appreciate the effort. Finally,
-;# changed my mailling address from @gvc.com to @gallium.com
-;# to reflect, well, my new address!
-;#
-;# SccsId = "%W% %E%"
-;#
-require 'timelocal.pl';
-package date;
-X
-# Months of the year
-@MoY = ('January', 'February', 'March', 'April', 'May', 'June',
-X 'July', 'August', 'September','October', 'November', 'December');
-X
-# days of the week
-@DoW = ('Sunday', 'Monday', 'Tuesday', 'Wednesday',
-X 'Thursday', 'Friday', 'Saturday');
-X
-# CUSTOMIZE - defaults
-$defaultTZ = 'CST'; # time zone (hack!)
-$defaultFMT = '%a %h %e %T %z%Y'; # format (ala date(1))
-X
-# CUSTOMIZE - `local' formats
-$locTF = '%T'; # time (as HH:MM:SS)
-$locDF = '%D'; # date (as mm/dd/yy)
-$locDTF = '%a %b %d %T %Y'; # date/time (as dow mon dd HH:MM:SS yyyy)
-$locLDTF = '%i:%M:%S %p %A %B %E %Y'; # long date/time (as HH:MM:SS a/p day month dom yyyy)
-X
-# Time zone info
-$TZ; # wkno needs this info too
-X
-# define the known format tags as associative keys with their associated
-# replacement strings as values. Each replacement string should be
-# an eval-able expresion assigning a value to $rep. These expressions are
-# eval-ed, then the value of $rep is substituted into the supplied
-# format (if any).
-%Tags = ( '%a', q|($rep = $DoW[$wday])=~ s/^(...).*/\1/|, # abbr. weekday name - Sun to Sat
-X '%A', q|$rep = $DoW[$wday]|, # full weekday name - Sunday to Saturday
-X '%b', q|($rep = $MoY[$mon]) =~ s/^(...).*/\1/|, # abbr. month name - Jan to Dec
-X '%B', q|$rep = $MoY[$mon]|, # full month name - January to December
-X '%c', q|$rep = $locDTF; 1|, # date/time in local format
-X '%C', q|$rep = $locLDTF; 1|, # date/time in local long format
-X '%d', q|$rep = &date'pad($mday, 2, "0")|, # day of month - 01 to 31
-X '%D', q|$rep = '%m/%d/%y'|, # date as mm/dd/yy
-X '%e', q|$rep = &date'pad($mday, 2, " ")|, # day of month (space padded) ` 1' to `31'
-X '%E', q|$rep = &date'dsuf($mday)|, # day of month (w/suffix) `1st' to `31st'
-X '%f', q|$rep = &date'pad($mon+1, 2, " ")|, # month of year (space padded) ` 1' to `12'
-X '%h', q|$rep = '%b'|, # abbr. month name (same as %b)
-X '%H', q|$rep = &date'pad($hour, 2, "0")|, # hour - 00 to 23
-X '%i', q|$rep = &date'ampmH($hour, " ")|, # hour (space padded ` 1' to `12'
-X '%I', q|$rep = &date'ampmH($hour, "0")|, # hour - 01 to 12
-X '%j', q|$rep = &date'pad($yday+1, 3, "0")|, # Julian date 001 - 366
-X '%k', q|$rep = &date'pad($hour, 2, " ")|, # hour (space padded) ` 0' to `23'
-X '%l', q|$rep = '%b %d ' . &date'ls($year)|, # ls(1) style date
-X '%m', q|$rep = &date'pad($mon+1, 2, "0")|, # month of year - 01 to 12
-X '%M', q|$rep = &date'pad($min, 2, "0")|, # minute - 00 to 59
-X '%n', q|$rep = "\n"|, # insert a newline
-X '%p', q|$rep = &date'ampmD($hour)|, # insert `AM' or `PM'
-X '%r', q|$rep = '%I:%M:%S %p'|, # time in AM/PM notation
-X '%R', q|$rep = '%H:%M'|, # time as HH:MM
-X '%S', q|$rep = &date'pad($sec, 2, "0")|, # second - 00 to 59
-X '%t', q|$rep = "\t"|, # insert a tab
-X '%T', q|$rep = '%H:%M:%S'|, # time as HH:MM:SS
-X '%u', q|$rep = '%y%m%d%H%M.%S'|, # daaate/time in date(1) required format
-X '%U', q|$rep = &date'wkno($year, $yday, 0)|, # week number (weeks start on Sun) - 00 to 53
-X '%V', q|$rep = '%m%d%H%M%y'|, # SysV touch(1) date-time format (mmddHHMMyy)
-X '%w', q|$rep = $wday; 1|, # day of week - Sunday = 0
-X '%W', q|$rep = &date'wkno($year, $yday, 1)|, # week number (weeks start on Mon) - 00 to 53
-X '%x', q|$rep = $locDF; 1|, # date in local format
-X '%X', q|$rep = $locTF; 1|, # time in local format
-X '%y', q|($rep = $year) =~ s/..(..)/\1/|, # last 2 digits of year - 00 to 99
-X '%Y', q|$rep = "$year"; 1|, # full year ~ 1700 to 2000 odd
-X '%z', q|$rep = $TZ eq "" ? "" : "$TZ "|, # time zone from TZ env var (w/trail. space)
-X '%Z', q|$rep = $TZ; 1|, # time zone from TZ env. var.
-X '%%', q|$rep = '%'; $adv=1|, # insert a `%'
-X '%+', q|$rep = '+'| # insert a `+'
-);
-X
-sub main'date {
-X local($time, $format) = @_;
-X local($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
-X local($pos, $tag, $rep, $adv) = (0, "", "", 0);
-X
-X # default to date/ctime format or strip leading `+'...
-X if ($format eq "") {
-X $format = $defaultFMT;
-X } elsif ($format =~ /^\+/) {
-X $format = $';
-X }
-X
-X # Use local time if can't find a TZ in the environment
-X $TZ = defined($ENV{'TZ'}) ? $ENV{'TZ'} : $defaultTZ;
-X ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) =
-X &gettime ($TZ, $time);
-X
-X # Hack to deal with 'PST8PDT' format of TZ
-X # Note that this can't deal with all the esoteric forms, but it
-X # does recognize the most common: [:]STDoff[DST[off][,rule]]
-X if ($TZ =~ /^([^:\d+\-,]{3,})([+-]?\d{1,2}(:\d{1,2}){0,2})([^\d+\-,]{3,})?/) {
-X $TZ = $isdst ? $4 : $1;
-X }
-X
-X # watch out in 2070...
-X $year += ($year < 70) ? 2000 : 1900;
-X
-X # now loop throught the supplied format looking for tags...
-X while (($pos = index ($format, '%')) != -1) {
-X
-X # grab the format tag
-X $tag = substr($format, $pos, 2);
-X $adv = 0; # for `%%' processing
-X
-X # do we have a replacement string?
-X if (defined $Tags{$tag}) {
-X
-X # trap dead evals...
-X if (! eval $Tags{$tag}) {
-X print STDERR "date.pl: internal error: eval for $tag failed: $@\n";
-X return "";
-X }
-X } else {
-X $rep = "";
-X }
-X
-X # do the substitution
-X substr ($format, $pos, 2) =~ s/$tag/$rep/;
-X $pos++ if ($adv);
-X }
-X
-X $format;
-}
-X
-# dsuf - add `st', `nd', `rd', `th' to a date (ie 1st, 22nd, 29th)
-sub dsuf {
-X local ($mday) = @_;
-X
-X return $mday . 'st' if ($mday =~ m/.*1$/);
-X return $mday . 'nd' if ($mday =~ m/.*2$/);
-X return $mday . 'rd' if ($mday =~ m/.*3$/);
-X return $mday . 'th';
-}
-X
-# weekno - figure out week number
-sub wkno {
-X local ($year, $yday, $firstweekday) = @_;
-X local ($jan1, @jan1, $wks);
-X
-X # figure out the `time' value for January 1 of the given year
-X $jan1 = &maketime ($TZ, 0, 0, 0, 1, 0, $year-1900);
-X
-X # figure out what day of the week January 1 was
-X @jan1= &gettime ($TZ, $jan1);
-X
-X # and calculate the week number
-X $wks = (($yday + ($jan1[6] - $firstweekday)) + 1)/ 7;
-X $wks += (($wks - int($wks) > 0.0) ? 1 : 0);
-X
-X # supply zero padding
-X &pad (int($wks), 2, "0");
-}
-X
-# ampmH - figure out am/pm (1 - 12) mode hour value, padded with $p (0 or ' ')
-sub ampmH { local ($h, $p) = @_; &pad($h>12 ? $h-12 : ($h ? $h : 12), 2, $p); }
-X
-# ampmD - figure out am/pm designator
-sub ampmD { shift @_ >= 12 ? "PM" : "AM"; }
-X
-# gettime - get the time via {local,gmt}time
-sub gettime { ((shift @_) eq 'GMT') ? gmtime(shift @_) : localtime(shift @_); }
-X
-# maketime - make a time via time{local,gmt}
-sub maketime { ((shift @_) eq 'GMT') ? &main'timegm(@_) : &main'timelocal(@_); }
-X
-# ls - generate the time/year portion of an ls(1) style date
-sub ls {
-X return ((&gettime ($TZ, time))[5] == @_[0]) ? "%R" : " %Y";
-}
-X
-# pad - pad $in with leading $pad until lenght $len
-sub pad {
-X local ($in, $len, $pad) = @_;
-X local ($out) = "$in";
-X
-X $out = $pad . $out until (length ($out) == $len);
-X return $out;
-}
-X
-1;
-SHAR_EOF
-chmod 0444 libs/date.pl ||
-echo 'restore of libs/date.pl failed'
-Wc_c="`wc -c < 'libs/date.pl'`"
-test 12339 -eq "$Wc_c" ||
- echo 'libs/date.pl: original size 12339, current size' "$Wc_c"
-fi
-# ============= libs/elapsed.pl ==============
-if test -f 'libs/elapsed.pl' -a X"$1" != X"-c"; then
- echo 'x - skipping libs/elapsed.pl (File already exists)'
-else
-echo 'x - extracting libs/elapsed.pl (Text)'
-sed 's/^X//' << 'SHAR_EOF' > 'libs/elapsed.pl' &&
-;# NAME
-;# elapsed.pl - convert seconds to elapsed time format
-;#
-;# AUTHOR
-;# Michael S. Muegel <mmuegel@mot.com>
-;#
-;# RCS INFORMATION
-;# mmuegel
-;# /usr/local/ustart/src/mail-tools/dist/foo/libs/elapsed.pl,v
-;# 1.1 of 1993/07/28 08:07:19
-X
-package elapsed;
-X
-# Time field types
-$DAYS = 1;
-$HOURS = 2;
-$MINUTES = 3;
-$SECONDS = 4;
-X
-# The array contains four records each with four fields. The fields are,
-# in order:
-#
-# Type Specifies what kind of time field this is. Once of
-# $DAYS, $HOURS, $MINUTES, or $SECONDS.
-#
-# Multiplier Specifies what time field this is via the minimum
-# number of seconds this time field may specify. For
-# example, the minutes field would be non-zero
-# when there are 60 or more seconds.
-#
-# Separator How to separate this time field from the next
-# *greater* field.
-#
-# Format sprintf() format specifier on how to print this
-# time field.
-@MULT_AND_SEPS = ($DAYS, 60 * 60 * 24, "+", "%d",
-X $HOURS, 60 * 60, ":", "%d",
-X $MINUTES, 60, ":", "%02d",
-X $SECONDS, 1, "", "%02d"
-X );
-X
-;###############################################################################
-;# Seconds_To_Elapsed
-;#
-;# Coverts a seconds count to form [d+]h:mm:ss. If $Collapse
-;# is true then the result is compacted somewhat. The string returned
-;# will be of the form [d+][[h:]mm]:ss.
-;#
-;# Arguments:
-;# $Seconds, $Collapse
-;#
-;# Examples:
-;# &Seconds_To_Elapsed (0, 0) -> 0:00:00
-;# &Seconds_To_Elapsed (0, 1) -> :00
-;#
-;# &Seconds_To_Elapsed (119, 0) -> 0:01:59
-;# &Seconds_To_Elapsed (119, 1) -> 01:59
-;#
-;# &Seconds_To_Elapsed (3601, 0) -> 1:00:01
-;# &Seconds_To_Elapsed (3601, 1) -> 1:00:01
-;#
-;# &Seconds_To_Elapsed (86401, 0) -> 1+0:00:01
-;# &Seconds_To_Elapsed (86401, 1) -> 1+:01
-;#
-;# Returns:
-;# $Elapsed
-;###############################################################################
-sub main'Seconds_To_Elapsed
-{
-X local ($Seconds, $Collapse) = @_;
-X local ($Type, $Multiplier, @Multipliers, $Separator, $DHMS_Used,
-X $Elapsed, @Mult_And_Seps, $Print_Field);
-X
-X $Multiplier = 1;
-X @Mult_And_Seps = @MULT_AND_SEPS;
-X
-X # Keep subtracting the number of seconds corresponding to a time field
-X # from the number of seconds passed to the function.
-X while (1)
-X {
-X ($Type, $Multiplier, $Separator, $Format) = splice (@Mult_And_Seps, 0, 4);
-X last if (! $Multiplier);
-X $Seconds -= $DHMS_Used * $Multiplier
-X if ($DHMS_Used = int ($Seconds / $Multiplier));
-X
-X # Figure out if we should print this field
-X if ($Type == $DAYS)
-X {
-X $Print_Field = $DHMS_Used;
-X }
-X
-X elsif ($Collapse)
-X {
-X if ($Type == $HOURS)
-X {
-X $Print_Field = $DHMS_Used;
-X }
-X elsif ($Type == $MINUTES)
-X {
-X $Print_Field = $DHMS_Used || $Printed_Field {$HOURS};
-X }
-X else
-X {
-X $Format = ":%02d"
-X if (! $Printed_Field {$MINUTES});
-X $Print_Field = 1;
-X };
-X }
-X
-X else
-X {
-X $Print_Field = 1;
-X };
-X
-X $Printed_Field {$Type} = $Print_Field;
-X $Elapsed .= sprintf ("$Format%s", $DHMS_Used, $Separator)
-X if ($Print_Field);
-X };
-X
-X return ($Elapsed);
-};
-X
-1;
-SHAR_EOF
-chmod 0444 libs/elapsed.pl ||
-echo 'restore of libs/elapsed.pl failed'
-Wc_c="`wc -c < 'libs/elapsed.pl'`"
-test 3198 -eq "$Wc_c" ||
- echo 'libs/elapsed.pl: original size 3198, current size' "$Wc_c"
-fi
-# ============= libs/mail.pl ==============
-if test -f 'libs/mail.pl' -a X"$1" != X"-c"; then
- echo 'x - skipping libs/mail.pl (File already exists)'
-else
-echo 'x - extracting libs/mail.pl (Text)'
-sed 's/^X//' << 'SHAR_EOF' > 'libs/mail.pl' &&
-;# NAME
-;# mail.pl - perl function(s) to handle mail processing
-;#
-;# AUTHOR
-;# Michael S. Muegel (mmuegel@mot.com)
-;#
-;# RCS INFORMATION
-;# mmuegel
-;# /usr/local/ustart/src/mail-tools/dist/foo/libs/mail.pl,v 1.1 1993/07/28 08:07:19 mmuegel Exp
-X
-package mail;
-X
-# Mailer statement to eval. $Users, $Subject, and $Verbose are substituted
-# via eval
-$BIN_MAILER = "/usr/ucb/mail \$Verbose -s '\$Subject' \$Users";
-X
-# Sendmail command to use when $Use_Sendmail is true.
-$SENDMAIL = '/usr/lib/sendmail $Verbose $Users';
-X
-;###############################################################################
-;# Send_Mail
-;#
-;# Sends $Message to $Users with a subject of $Subject. If $Message_Is_File
-;# is true then $Message is assumed to be a filename pointing to the mail
-;# message. This is a new option and thus the backwards-compatible hack.
-;# $Users should be a space separated list of mail-ids.
-;#
-;# If everything went OK $Status will be 1 and $Error_Msg can be ignored;
-;# otherwise, $Status will be 0 and $Error_Msg will contain an error message.
-;#
-;# If $Use_Sendmail is 1 then sendmail is used to send the message. Normally
-;# a mailer such as Mail is used. By specifiying this you can include
-;# headers in addition to text in either $Message or $Message_Is_File.
-;# If either $Message or $Message_Is_File contain a Subject: header then
-;# $Subject is ignored; otherwise, a Subject: header is automatically created.
-;# Similar to the Subject: header, if a To: header does not exist one
-;# is automatically created from the $Users argument. The mail is still
-;# sent, however, to the recipients listed in $Users. This is keeping with
-;# normal sendmail usage (header vs. envelope).
-;#
-;# In both bin mailer and sendmail modes $Verbose will turn on verbose mode
-;# (normally just sendmail verbose mode output).
-;#
-;# Arguments:
-;# $Users, $Subject, $Message, $Message_Is_File, $Verbose, $Use_Sendmail
-;#
-;# Returns:
-;# $Status, $Error_Msg
-;###############################################################################
-sub main'Send_Mail
-{
-X local ($Users, $Subject, $Message, $Message_Is_File, $Verbose,
-X $Use_Sendmail) = @_;
-X local ($BIN_MAILER_HANDLE, $Mailer_Command, $Header_Found, %Header_Map,
-X $Header_Extra, $Mailer);
-X
-X # If the message is contained in a file read it in so we can have one
-X # consistent interface
-X if ($Message_Is_File)
-X {
-X undef $/;
-X $Message_Is_File = 0;
-X open (Message) || return (0, "error reading $Message: $!");
-X $Message = <Message>;
-X close (Message);
-X };
-X
-X # If sendmail mode see if we need to add some headers
-X if ($Use_Sendmail)
-X {
-X # Determine if a header block is included in the message and what headers
-X # are there
-X foreach (split (/\n/, $Message))
-X {
-X last if ($_ eq "");
-X $Header_Found = $Header_Map {$1} = 1 if (/^([A-Z]\S*): /);
-X };
-X
-X # Add some headers?
-X if (! $Header_Map {"To"})
-X {
-X $Header_Extra .= "To: " . join (", ", $Users) . "\n";
-X };
-X if (($Subject ne "") && (! $Header_Map {"Subject"}))
-X {
-X $Header_Extra .= "Subject: $Subject\n";
-X };
-X
-X # Add the required blank line between header/body if there where no
-X # headers to begin with
-X if ($Header_Found)
-X {
-X $Message = "$Header_Extra$Message";
-X }
-X else
-X {
-X $Message = "$Header_Extra\n$Message";
-X };
-X };
-X
-X # Get a string that is the mail command
-X $Verbose = ($Verbose) ? "-v" : "";
-X $Mailer = ($Use_Sendmail) ? $SENDMAIL : $BIN_MAILER;
-X eval "\$Mailer = \"$Mailer\"";
-X return (0, "error setting \$Mailer: $@") if ($@);
-X
-X # need to catch SIGPIPE in case the $Mailer call fails
-X $SIG {'PIPE'} = "mail'Cleanup";
-X
-X # Open mailer
-X return (0, "can not open mail program: $Mailer") if (! open (MAILER, "| $Mailer"));
-X
-X # Send off the mail!
-X print MAILER $Message;
-X close (MAILER);
-X return (0, "error running mail program: $Mailer") if ($?);
-X
-X # Everything must have went AOK
-X return (1);
-};
-X
-;###############################################################################
-;# Cleanup
-;#
-;# Simply here so we can catch SIGPIPE and not exit.
-;#
-;# Globals:
-;# None
-;#
-;# Arguments:
-;# None
-;#
-;# Returns:
-;# Nothing exciting
-;###############################################################################
-sub Cleanup
-{
-};
-X
-1;
-SHAR_EOF
-chmod 0444 libs/mail.pl ||
-echo 'restore of libs/mail.pl failed'
-Wc_c="`wc -c < 'libs/mail.pl'`"
-test 4356 -eq "$Wc_c" ||
- echo 'libs/mail.pl: original size 4356, current size' "$Wc_c"
-fi
-# ============= libs/mqueue.pl ==============
-if test -f 'libs/mqueue.pl' -a X"$1" != X"-c"; then
- echo 'x - skipping libs/mqueue.pl (File already exists)'
-else
-echo 'x - extracting libs/mqueue.pl (Text)'
-sed 's/^X//' << 'SHAR_EOF' > 'libs/mqueue.pl' &&
-;# NAME
-;# mqueue.pl - functions to work with the sendmail queue
-;#
-;# DESCRIPTION
-;# Both Get_Queue_IDs and Parse_Control_File are available to get
-;# information about the sendmail queue. The cqueue program is a good
-;# example of how these functions work.
-;#
-;# AUTHOR
-;# Michael S. Muegel (mmuegel@mot.com)
-;#
-;# RCS INFORMATION
-;# mmuegel
-;# /usr/local/ustart/src/mail-tools/dist/foo/libs/mqueue.pl,v
-;# 1.1 of 1993/07/28 08:07:19
-X
-package mqueue;
-X
-;###############################################################################
-;# Get_Queue_IDs
-;#
-;# Will figure out the queue IDs in $Queue that have both control and data
-;# files. They are returned in @Valid_IDs. Those IDs that have a
-;# control file and no data file are saved to the array globbed by
-;# *Missing_Control_IDs. Likewise, those IDs that have a data file and no
-;# control file are saved to the array globbed by *Missing_Data_IDs.
-;#
-;# If $Skip_Locked is true they a message that has a lock file is skipped
-;# and will not show up in any of the arrays.
-;#
-;# If everything went AOK then $Status is 1; otherwise, $Status is 0 and
-;# $Msg tells what went wrong.
-;#
-;# Globals:
-;# None
-;#
-;# Arguments:
-;# $Queue, $Skip_Locked, *Missing_Control_IDs, *Missing_Data_IDs
-;#
-;# Returns:
-;# $Status, $Msg, @Valid_IDs
-;###############################################################################
-sub main'Get_Queue_IDs
-{
-X local ($Queue, $Skip_Locked, *Missing_Control_IDs,
-X *Missing_Data_IDs) = @_;
-X local (*QUEUE, @Files, %Lock_IDs, %Data_IDs, %Control_IDs, $_);
-X
-X # Make sure that the * argument @arrays ar empty
-X @Missing_Control_IDs = @Missing_Data_IDs = ();
-X
-X # Save each data, lock, and queue file in @Files
-X opendir (QUEUE, $Queue) || return (0, "error getting directory listing of $Queue");
-X @Files = grep (/^(df|lf|qf)/, readdir (QUEUE));
-X closedir (QUEUE);
-X
-X # Create indexed list of data and control files. IF $Skip_Locked is true
-X # then skip either if there is a lock file present.
-X if ($Skip_Locked)
-X {
-X grep ((s/^lf//) && ($Lock_IDs {$_} = 1), @Files);
-X grep ((s/^df//) && (! $Lock_IDs {$_}) && ($Data_IDs {$_} = 1), @Files);
-X grep ((s/^qf//) && (! $Lock_IDs {$_}) && ($Control_IDs {$_} = 1), @Files);
-X }
-X else
-X {
-X grep ((s/^df//) && ($Data_IDs {$_} = 1), @Files);
-X grep ((s/^qf//) && ($Control_IDs {$_} = 1), @Files);
-X };
-X
-X # Find missing control and data files and remove them from the lists of each
-X @Missing_Control_IDs = sort (grep ((! $Control_IDs {$_}) && (delete $Data_IDs {$_}), keys (%Data_IDs)));
-X @Missing_Data_IDs = sort (grep ((! $Data_IDs {$_} && (delete $Control_IDs {$_})), keys (%Control_IDs)));
-X
-X
-X # Return the IDs in an appartently random order
-X return (1, "", keys (%Control_IDs));
-};
-X
-X
-;###############################################################################
-;# Parse_Control_File
-;#
-;# Will pase a sendmail queue control file for useful information. See the
-;# Sendmail Installtion and Operation Guide (SMM:07) for a complete
-;# explanation of each field.
-;#
-;# The following globbed variables are set (or cleared) by this function:
-;#
-;# $Sender The sender's address.
-;#
-;# @Recipients One or more addresses for the recipient of the mail.
-;#
-;# @Errors_To One or more addresses for addresses to which mail
-;# delivery errors should be sent.
-;#
-;# $Creation_Time The job creation time in time(3) format. That is,
-;# seconds since 00:00:00 GMT 1/1/70.
-;#
-;# $Priority An integer representing the current message priority.
-;# This is used to order the queue. Higher numbers mean
-;# lower priorities.
-;#
-;# $Status_Message The status of the mail message. It can contain any
-;# text.
-;#
-;# @Headers Message headers unparsed but in their original order.
-;# Headers that span multiple lines are not mucked with,
-;# embedded \ns will be evident.
-;#
-;# In all e-mail addresses bounding <> pairs are stripped.
-;#
-;# If everything went AOK then $Status is 1. If the message with queue ID
-;# $Queue_ID just does not exist anymore -1 is returned. This is very
-;# possible and should be allowed for. Otherwise, $Status is 0 and $Msg
-;# tells what went wrong.
-;#
-;# Globals:
-;# None
-;#
-;# Arguments:
-;# $Queue, $Queue_ID, *Sender, *Recipients, *Errors_To, *Creation_Time,
-;# *Priority, *Status_Message, *Headers
-;#
-;# Returns:
-;# $Status, $Msg
-;###############################################################################
-sub main'Parse_Control_File
-{
-X local ($Queue, $Queue_ID, *Sender, *Recipients, *Errors_To, *Creation_Time,
-X *Priority, *Status_Message, *Headers) = @_;
-X local (*Control, $_, $Not_Empty);
-X
-X # Required variables and the associated control. If empty at the end of
-X # parsing we return a bad status.
-X @REQUIRED_INFO = ('$Creation_Time', 'T', '$Sender', 'S', '@Recipients', 'R',
-X '$Priority', 'P');
-X
-X # Open up the control file for read
-X $Control = "$Queue/qf$Queue_ID";
-X if (! open (Control))
-X {
-X return (-1) if ((-x $Queue) && (! -f "$Queue/qf$Queue_ID") &&
-X (! -f "$Queue/df$Queue_ID"));
-X return (0, "error opening $Control for read: $!");
-X };
-X
-X # Reset the globbed variables just in case
-X $Sender = $Creation_Time = $Priority = $Status_Message = "";
-X @Recipients = @Errors_To = @Headers = ();
-X
-X # Look for a few things in the control file
-X READ: while (<Control>)
-X {
-X $Not_Empty = 1;
-X chop;
-X
-X PARSE:
-X {
-X if (/^T(\d+)$/)
-X {
-X $Creation_Time = $1;
-X }
-X elsif (/^S(<)?([^>]+)/)
-X {
-X $Sender = $2;
-X }
-X elsif (/^R(<)?([^>]+)/)
-X {
-X push (@Recipients, $2);
-X }
-X elsif (/^E(<)?([^>]+)/)
-X {
-X push (@Errors_To, $2);
-X }
-X elsif (/^M(.*)/)
-X {
-X $Status_Message = $1;
-X }
-X elsif (/^P(\d+)$/)
-X {
-X $Priority = $1;
-X }
-X elsif (/^H(.*)/)
-X {
-X $Header = $1;
-X while (<Control>)
-X {
-X chop;
-X last if (/^[A-Z]/);
-X $Header .= "\n$_";
-X };
-X push (@Headers, $Header);
-X redo PARSE if ($_);
-X last if (eof);
-X };
-X };
-X };
-X
-X # If the file was empty scream bloody murder
-X return (0, "empty control file") if (! $Not_Empty);
-X
-X # Yell if we could not find a required field
-X while (($Var, $Control) = splice (@REQUIRED_INFO, 0, 2))
-X {
-X eval "return (0, 'required control field $Control not found')
-X if (! $Var)";
-X return (0, "error checking \$Var: $@") if ($@);
-X };
-X
-X # Everything went AOK
-X return (1);
-};
-X
-1;
-SHAR_EOF
-chmod 0444 libs/mqueue.pl ||
-echo 'restore of libs/mqueue.pl failed'
-Wc_c="`wc -c < 'libs/mqueue.pl'`"
-test 6908 -eq "$Wc_c" ||
- echo 'libs/mqueue.pl: original size 6908, current size' "$Wc_c"
-fi
-# ============= libs/newgetopts.pl ==============
-if test -f 'libs/newgetopts.pl' -a X"$1" != X"-c"; then
- echo 'x - skipping libs/newgetopts.pl (File already exists)'
-else
-echo 'x - extracting libs/newgetopts.pl (Text)'
-sed 's/^X//' << 'SHAR_EOF' > 'libs/newgetopts.pl' &&
-;# NAME
-;# newgetopts.pl - a better newgetopt (which is a better getopts which is
-;# a better getopt ;-)
-;#
-;# AUTHOR
-;# Mike Muegel (mmuegel@mot.com)
-;#
-;# mmuegel
-;# /usr/local/ustart/src/mail-tools/dist/foo/libs/newgetopts.pl,v 1.1 1993/07/28 08:07:19 mmuegel Exp
-X
-;###############################################################################
-;# New_Getopts
-;#
-;# Does not care about order of switches, options, and arguments like
-;# getopts.pl. Thus all non-switches/options will be kept in ARGV even if they
-;# are not at the end. If $Pass_Invalid is set all unkown options will be
-;# passed back to the caller by keeping them in @ARGV. This is useful when
-;# parsing a command line for your script while ignoring options that you
-;# may pass to another script. If this is set New_Getopts tries to maintain
-;# the switch clustering on the unkown switches.
-;#
-;# Accepts the special argument -usage to print the Usage string. Also accepts
-;# the special option -version which prints the contents of the string
-;# $VERSION. $VERSION may or may not have an embeded \n in it. If -usage
-;# or -version are specified a status of -1 is returned. Note that the usage
-;# option is only accepted if the usage string is not null.
-;#
-;# $Switches is just like the formal arguemnt of getopts.pl. $Usage is a usage
-;# string with or without a trailing \n. *Switch_To_Order is an optional
-;# pointer to the name of an associative array which will contain a mapping of
-;# switch names to the order in which (if at all) the argument was entered.
-;#
-;# For example, if @ARGV contains -v, -x, test:
-;#
-;# $Switch_To_Order {"v"} = 1;
-;# $Switch_To_Order {"x"} = 2;
-;#
-;# Note that in the case of multiple occurances of an option $Switch_To_Order
-;# will store each occurance of the argument via a string that emulates
-;# an array. This is done by using join ($;, ...). You can retrieve the
-;# array by using split (/$;/, ...).
-;#
-;# *Split_ARGV is an optional pointer to an array which will conatin the
-;# original switches along with their values. For the example used above
-;# Split_ARGV would contain:
-;#
-;# @Split_ARGV = ("v", "", "x", "test");
-;#
-;# Another exciting ;-) feature that newgetopts has. Along with creating the
-;# normal $opt_ scalars for the last value of an argument the list @opt_ is
-;# created. It is an array which contains all the values of arguments to the
-;# basename of the variable. They are stored in the order which they occured
-;# on the command line starting with $[. Note that blank arguments are stored
-;# as "". Along with providing support for multiple options on the command
-;# line this also provides a method of counting the number of times an option
-;# was specified via $#opt_.
-;#
-;# Automatically resets all $opt_, @opt_, %Switch_To_Order, and @Split_ARGV
-;# variables so that New_Getopts may be called more than once from within
-;# the same program. Thus, if $opt_v is set upon entry to New_Getopts and
-;# -v is not in @ARGV $opt_v will not be set upon exit.
-;#
-;# Arguments:
-;# $Switches, $Usage, $Pass_Invalid, *Switch_To_Order, *Split_ARGV
-;#
-;# Returns:
-;# -1, 0, or 1 depending on status (printed Usage/Version, OK, not OK)
-;###############################################################################
-sub New_Getopts
-{
-X local($taint_argumentative, $Usage, $Pass_Invalid, *Switch_To_Order,
-X *Split_ARGV) = @_;
-X local(@args,$_,$first,$rest,$errs, @leftovers, @current_leftovers,
-X %Switch_Found);
-X local($[, $*, $Script_Name, $argumentative);
-X
-X # Untaint the argument cluster so that we can use this with taintperl
-X $taint_argumentative =~ /^(.*)$/;
-X $argumentative = $1;
-X
-X # Clear anything that might still be set from a previous New_Getopts
-X # call.
-X @Split_ARGV = ();
-X
-X # Get the basename of the calling script
-X ($Script_Name = $0) =~ s/.*\///;
-X
-X # Make Usage have a trailing \n
-X $Usage .= "\n" if ($Usage !~ /\n$/);
-X
-X @args = split( / */, $argumentative );
-X
-X # Clear anything that might still be set from a previous New_Getopts call.
-X foreach $first (@args)
-X {
-X next if ($first eq ":");
-X delete $Switch_Found {$first};
-X delete $Switch_To_Order {$first};
-X eval "undef \@opt_$first; undef \$opt_$first;";
-X };
-X
-X while (@ARGV)
-X {
-X # Let usage through
-X if (($ARGV[0] eq "-usage") && ($Usage ne "\n"))
-X {
-X print $Usage;
-X exit (-1);
-X }
-X
-X elsif ($ARGV[0] eq "-version")
-X {
-X if ($VERSION)
-X {
-X print $VERSION;
-X print "\n" if ($VERSION !~ /\n$/);
-X }
-X else
-X {
-X warn "${Script_Name}: no version information available, sorry\n";
-X }
-X exit (-1);
-X }
-X
-X elsif (($_ = $ARGV[0]) =~ /^-(.)(.*)/)
-X {
-X ($first,$rest) = ($1,$2);
-X $pos = index($argumentative,$first);
-X
-X $Switch_To_Order {$first} = join ($;, split (/$;/, $Switch_To_Order {$first}), ++$Order);
-X
-X if($pos >= $[)
-X {
-X if($args[$pos+1] eq ':')
-X {
-X shift(@ARGV);
-X if($rest eq '')
-X {
-X $rest = shift(@ARGV);
-X }
-X
-X eval "\$opt_$first = \$rest;";
-X eval "push (\@opt_$first, \$rest);";
-X push (@Split_ARGV, $first, $rest);
-X }
-X else
-X {
-X eval "\$opt_$first = 1";
-X eval "push (\@opt_$first, '');";
-X push (@Split_ARGV, $first, "");
-X
-X if($rest eq '')
-X {
-X shift(@ARGV);
-X }
-X else
-X {
-X $ARGV[0] = "-$rest";
-X }
-X }
-X }
-X
-X else
-X {
-X # Save any other switches if $Pass_Valid
-X if ($Pass_Invalid)
-X {
-X push (@current_leftovers, $first);
-X }
-X else
-X {
-X warn "${Script_Name}: unknown option: $first\n";
-X ++$errs;
-X };
-X if($rest ne '')
-X {
-X $ARGV[0] = "-$rest";
-X }
-X else
-X {
-X shift(@ARGV);
-X }
-X }
-X }
-X
-X else
-X {
-X push (@leftovers, shift (@ARGV));
-X };
-X
-X # Save any other switches if $Pass_Valid
-X if ((@current_leftovers) && ($rest eq ''))
-X {
-X push (@leftovers, "-" . join ("", @current_leftovers));
-X @current_leftovers = ();
-X };
-X };
-X
-X # Automatically print Usage if a warning was given
-X @ARGV = @leftovers;
-X if ($errs != 0)
-X {
-X warn $Usage;
-X return (0);
-X }
-X else
-X {
-X return (1);
-X }
-X
-}
-X
-1;
-SHAR_EOF
-chmod 0444 libs/newgetopts.pl ||
-echo 'restore of libs/newgetopts.pl failed'
-Wc_c="`wc -c < 'libs/newgetopts.pl'`"
-test 7024 -eq "$Wc_c" ||
- echo 'libs/newgetopts.pl: original size 7024, current size' "$Wc_c"
-fi
-# ============= libs/strings1.pl ==============
-if test -f 'libs/strings1.pl' -a X"$1" != X"-c"; then
- echo 'x - skipping libs/strings1.pl (File already exists)'
-else
-echo 'x - extracting libs/strings1.pl (Text)'
-sed 's/^X//' << 'SHAR_EOF' > 'libs/strings1.pl' &&
-;# NAME
-;# strings1.pl - FUN with strings #1
-;#
-;# NOTES
-;# I wrote Format_Text_Block when I just started programming Perl so
-;# it is probably not very Perlish code. Center is more like it :-).
-;#
-;# AUTHOR
-;# Michael S. Muegel (mmuegel@mot.com)
-;#
-;# RCS INFORMATION
-;# mmuegel
-;# /usr/local/ustart/src/mail-tools/dist/foo/libs/strings1.pl,v 1.1 1993/07/28 08:07:19 mmuegel Exp
-X
-package strings1;
-X
-;###############################################################################;# Center
-;#
-;# Center $Text assuming the output should be $Columns wide. $Text can span
-;# multiple lines, of course :-). Lines within $Text that contain only
-;# whitespace are not centered and are instead collapsed. This may save time
-;# when printing them later.
-;#
-;# Arguments:
-;# $Text, $Columns
-;#
-;# Returns:
-;# $Centered_Text
-;###############################################################################
-sub main'Center
-{
-X local ($_, $Columns) = @_;
-X local ($*) = 1;
-X
-X s@^(.*)$@" " x (($Columns - length ($1)) / 2) . $1@eg;
-X s/^[\t ]*$//g;
-X return ($_);
-};
-X
-;###############################################################################
-;# Format_Text_Block
-;#
-;# Formats a text string to be printed to the display or other similar device.
-;# Text in $String will be fomratted such that the following hold:
-;#
-;# + $String contains the (possibly) multi-line text to print. It is
-;# automatically word-wrapped to fit in $Columns.
-;#
-;# + \n'd are maintained and are not folded.
-;#
-;# + $Offset is pre-pended before each separate line of text.
-;#
-;# + If $Offset_Once is $TRUE $Offset will only appear on the first line.
-;# All other lines will be indented to match the amount of whitespace of
-;# $Offset.
-;#
-;# + If $Bullet_Indent is $TRUE $Offset will only be applied to the begining
-;# of lines as they occured in the original $String. Lines that are created
-;# by this routine will always be indented by blank spaces.
-;#
-;# + If $Columns is 0 no word-wrap is done. This might be useful to still
-;# to offset each line in a buffer.
-;#
-;# + If $Split_Expr is supplied the string is split on it. If not supplied
-;# the string is split on " \t\/\-\,\." by default.
-;#
-;# + If $Offset_Blank is $TRUE then empty lines will have $Offset pre-pended
-;# to them. Otherwise, they will still empty.
-;#
-;# This is a realy workhorse routine that I use in many places because of its
-;# veratility.
-;#
-;# Arguments:
-;# $String, $Offset, $Offset_Once, $Bullet_Indent, $Columns, $Split_Expr,
-;# $Offset_Blank
-;#
-;# Returns:
-;# $Buffer
-;###############################################################################
-sub main'Format_Text_Block
-{
-X local ($String, $Real_Offset, $Offset_Once, $Bullet_Indent, $Columns,
-X $Split_Expr, $Offset_Blank) = @_;
-X
-X local ($New_Line, $Line, $Chars_Per_Line, $Space_Offset, $Buffer,
-X $Next_New_Line, $Num_Lines, $Num_Offsets, $Offset);
-X local ($*) = 0;
-X local ($BLANK_TAG) = "__FORMAT_BLANK__";
-X local ($Blank_Offset) = $Real_Offset if ($Offset_Blank);
-X
-X # What should we split on?
-X $Split_Expr = " \\t\\/\\-\\,\\." if (! $Split_Expr);
-X
-X # Pre-process the string - convert blank lines to __FORMAT_BLANK__ sequence
-X $String =~ s/\n\n/\n$BLANK_TAG\n/g;
-X $String =~ s/^\n/$BLANK_TAG\n/g;
-X $String =~ s/\n$/\n$BLANK_TAG/g;
-X
-X # If bad $Columns/$Offset combo or no $Columns make a VERRRYYY wide $Column
-X $Offset = $Real_Offset;
-X $Chars_Per_Line = 16000 if (($Chars_Per_Line = $Columns - length ($Offset)) <= 0);
-X $Space_Offset = " " x length ($Offset);
-X
-X # Get a buffer
-X foreach $Line (split ("\n", $String))
-X {
-X $Offset = $Real_Offset if ($Bullet_Indent);
-X
-X # Find where to split the line
-X if ($Line ne $BLANK_TAG)
-X {
-X $New_Line = "";
-X while ($Line =~ /^([$Split_Expr]*)([^$Split_Expr]+)/)
-X {
-X if (length ("$New_Line$&") >= $Chars_Per_Line)
-X {
-X $Next_New_Line = $+;
-X $New_Line = "$Offset$New_Line$1";
-X $Buffer .= "\n" if ($Num_Lines++);
-X $Buffer .= $New_Line;
-X $Offset = $Space_Offset if (($Offset) && ($Offset_Once));
-X $New_Line = $Next_New_Line;
-X ++$Num_Lines;
-X }
-X else
-X {
-X $New_Line .= $&;
-X };
-X $Line = $';
-X };
-X
-X $Buffer .= "\n" if ($Num_Lines++);
-X $Buffer .= "$Offset$New_Line$Line";
-X $Offset = $Space_Offset if (($Offset) && ($Offset_Once));
-X }
-X
-X else
-X {
-X $Buffer .= "\n$Blank_Offset";
-X };
-X };
-X
-X return ($Buffer);
-X
-};
-X
-1;
-SHAR_EOF
-chmod 0444 libs/strings1.pl ||
-echo 'restore of libs/strings1.pl failed'
-Wc_c="`wc -c < 'libs/strings1.pl'`"
-test 4687 -eq "$Wc_c" ||
- echo 'libs/strings1.pl: original size 4687, current size' "$Wc_c"
-fi
-# ============= libs/timespec.pl ==============
-if test -f 'libs/timespec.pl' -a X"$1" != X"-c"; then
- echo 'x - skipping libs/timespec.pl (File already exists)'
-else
-echo 'x - extracting libs/timespec.pl (Text)'
-sed 's/^X//' << 'SHAR_EOF' > 'libs/timespec.pl' &&
-;# NAME
-;# timespec.pl - convert a pre-defined time specifyer to seconds
-;#
-;# AUTHOR
-;# Michael S. Muegel (mmuegel@mot.com)
-;#
-;# RCS INFORMATION
-;# mmuegel
-;# /usr/local/ustart/src/mail-tools/dist/foo/libs/timespec.pl,v 1.1 1993/07/28 08:07:19 mmuegel Exp
-X
-package timespec;
-X
-%TIME_SPEC_TO_SECONDS = ("s", 1,
-X "m", 60,
-X "h", 60 * 60,
-X "d", 60 * 60 * 24
-X );
-X
-$VALID_TIME_SPEC_EXPR = "[" . join ("", keys (%TIME_SPEC_TO_SECONDS)) . "]";
-X
-;###############################################################################
-;# Time_Spec_To_Seconds
-;#
-;# Converts a string of the form:
-;#
-;# (<number>(s|m|h|d))+
-;#
-;# to seconds. The second part of the time spec specifies seconds, minutes,
-;# hours, or days, respectfully. The first part is the number of those untis.
-;# There can be any number of such specifiers. As an example, 1h30m means 1
-;# hour and 30 minutes.
-;#
-;# If the parsing went OK then $Status is 1, $Msg is undefined, and $Seconds
-;# is $Time_Spec converted to seconds. If something went wrong then $Status
-;# is 0 and $Msg explains what went wrong.
-;#
-;# Arguments:
-;# $Time_Spec
-;#
-;# Returns:
-;# $Status, $Msg, $Seconds
-;###############################################################################
-sub main'Time_Spec_To_Seconds
-{
-X $Time_Spec = $_[0];
-X
-X $Seconds = 0;
-X while ($Time_Spec =~ /^(\d+)($VALID_TIME_SPEC_EXPR)/)
-X {
-X $Seconds += $1 * $TIME_SPEC_TO_SECONDS {$2};
-X $Time_Spec = $';
-X };
-X
-X return (0, "error parsing time spec: $Time_Spec") if ($Time_Spec ne "");
-X return (1, "", $Seconds);
-X
-};
-X
-X
-1;
-SHAR_EOF
-chmod 0444 libs/timespec.pl ||
-echo 'restore of libs/timespec.pl failed'
-Wc_c="`wc -c < 'libs/timespec.pl'`"
-test 1609 -eq "$Wc_c" ||
- echo 'libs/timespec.pl: original size 1609, current size' "$Wc_c"
-fi
-# ============= man/cqueue.1 ==============
-if test ! -d 'man'; then
- echo 'x - creating directory man'
- mkdir 'man'
-fi
-if test -f 'man/cqueue.1' -a X"$1" != X"-c"; then
- echo 'x - skipping man/cqueue.1 (File already exists)'
-else
-echo 'x - extracting man/cqueue.1 (Text)'
-sed 's/^X//' << 'SHAR_EOF' > 'man/cqueue.1' &&
-.TH CQUEUE 1L
-\"
-\" mmuegel
-\" /usr/local/ustart/src/mail-tools/dist/foo/man/cqueue.1,v 1.1 1993/07/28 08:08:25 mmuegel Exp
-\"
-.ds mp \fBcqueue\fR
-.de IB
-.IP \(bu 2
-..
-.SH NAME
-\*(mp - check sendmail queue for problems
-.SH SYNOPSIS
-.IP \*(mp 7
-[ \fB-abdms\fR ] [ \fB-q\fR \fIqueue-dir\fI ] [ \fB-t\fR \fItime\fR ]
-[ \fB-u\fR \fIusers\fR ] [ \fB-w\fR \fIwidth\fR ]
-.SH DESCRIPTION
-Reports on problems in the sendmail queue. With no options this simply
-means listing messages that have been in the queue longer than a default
-period along with a summary of queue mail by host and status message.
-.SH OPTIONS
-.IP \fB-a\fR 14
-Report on all messages in the queue. This is equivalent to saying \fB-t\fR 0s.
-You may like this command so much that you use it as a replacement for
-\fBmqueue\fR. For example:
-.sp 1
-.RS
-.RS
-\fBalias mqueue cqueue -a\fR
-.RE
-.RE
-.IP \fB-b\fR 14
-Also report on bogus queue files. Those are files that
-have data files and no control files or vice versa.
-.IP \fB-d\fR
-Print a detailed report of mail messages that have been queued longer than
-the specified or default time. Information that is presented includes:
-.RS
-.RS
-.IB
-Sendmail queue identifier.
-.IB
-Date the message was first queued.
-.IB
-Sender of the message.
-.IB
-One or more recipients of the message.
-.IB
-An optional status of the message. This usually indicates why the message
-has not been delivered.
-.RE
-.RE
-.IP \fB-m\fR 14
-Mail off the results if any problems were found.
-Normaly results are printed to stdout. If this option
-is specified they are mailed to one or more users. Results
-are not printed to stdout in this case. Results are \fBonly\fR
-mailed if \*(mp found something wrong.
-.IP "\fB-q\fR \fIqueue-dir\fI"
-The sendmail mail queue directory. Default is \fB/usr/spool/mqueue\fR or
-some other site configured value.
-.IP "\fB-t\fR \fItime\fR"
-List messages that have been in the queue longer than
-\fItime\fR. Time should of the form:
-.sp 1
-.RS
-.RS
-(<number>(s|m|h|d))+
-.sp 1
-.RE
-.RE
-.RS 14
-The second portion of the above definition
-specifies seconds, minutes, hours, or
-days, respectfully. The first portion is the number of
-those units. There can be any number of such specifiers.
-As an example, 1h30m means 1 hour and 30 minutes.
-.sp 1
-The default is 2 hours.
-.RE
-.IP \fB-s\fR 14
-Print a summary of messages that have been queued longer than
-the specified or default time. Two separate types of summaries are printed.
-The first summarizes the queue messages by destination host. The host name
-is gleaned from the recipient addresses for each message.
-Thus the actual host names for this summary should be taken with a grain
-of salt since ruleset 0 has not been applied to the address the host was
-taken from nor were MX records consulted. It would be possible to add
-this; however, the execution time of the script would increase
-dramatically. The second summary is by status message.
-.IP "\fB-u\fR \fIusers\fR"
-Specify list of users to send a mail report to other than
-the invoker. This option is only valid when \fB-m\fR has been
-specified. Multiple recipients may be separated by spaces.
-.IP "\fB-w\fR \fIwidth\fR"
-Specify the page width to which the output should tailored. \fIwidth\fR
-should be an integer representing some character position. The default is
-80 or some other site configured value. Output is folded neatly to match
-\fIwidth\fR.
-.SH EXAMPLES
-.nf
-% \fBdate\fR
-Tue Jan 19 12:07:20 CST 1993
-X
-% \fBcqueue -t 21h45m -w 70\fR
-X
-Summary of messages in queue longer than 21:45:00 by destination
-host:
-X
-X Number of
-X Messages Destination Host
-X --------- ----------------
-X 2 cigseg.rtsg.mot.com
-X 1 mnesouth.corp.mot.com
-X ---------
-X 3
-X
-Summary of messages in queue longer than 21:45:00 by status message:
-X
-X Number of
-X Messages Status Message
-X --------- --------------
-X 1 Deferred: Connection refused by mnesouth.corp.mot.com
-X 2 Deferred: Host Name Lookup Failure
-X ---------
-X 3
-X
-Detail of messages in queue longer than 21:45:00 sorted by creation
-date:
-X
-X ID: AA20573
-X Date: 02:09:27 PM 01/18/93
-X Sender: melrose-place-owner@ferkel.ucsb.edu
-X Recipient: pbaker@cigseg.rtsg.mot.com
-X Status: Deferred: Host Name Lookup Failure
-X
-X ID: AA20757
-X Date: 02:11:30 PM 01/18/93
-X Sender: 90210-owner@ferkel.ucsb.edu
-X Recipient: pbaker@cigseg.rtsg.mot.com
-X Status: Deferred: Host Name Lookup Failure
-X
-X ID: AA21110
-X Date: 02:17:01 PM 01/18/93
-X Sender: rd_lap_wg@mdd.comm.mot.com
-X Recipient: jim_mathis@mnesouth.corp.mot.com
-X Status: Deferred: Connection refused by mnesouth.corp.mot.com
-.fi
-.SH AUTHOR
-.nf
-Michael S. Muegel (mmuegel@mot.com)
-UNIX Applications Startup Group
-Corporate Information Office, Schaumburg, IL
-Motorola, Inc.
-.fi
-.SH COPYRIGHT NOTICE
-Copyright 1993, Motorola, Inc.
-.sp 1
-Permission to use, copy, modify and distribute without charge this
-software, documentation, etc. is granted, provided that this
-comment and the author's name is retained. The author nor Motorola assume any
-responsibility for problems resulting from the use of this software.
-.SH SEE ALSO
-.nf
-\fBsendmail(8)\fR
-\fISendmail Installation and Operation Guide\fR.
-.fi
-SHAR_EOF
-chmod 0444 man/cqueue.1 ||
-echo 'restore of man/cqueue.1 failed'
-Wc_c="`wc -c < 'man/cqueue.1'`"
-test 5212 -eq "$Wc_c" ||
- echo 'man/cqueue.1: original size 5212, current size' "$Wc_c"
-fi
-# ============= man/postclip.1 ==============
-if test -f 'man/postclip.1' -a X"$1" != X"-c"; then
- echo 'x - skipping man/postclip.1 (File already exists)'
-else
-echo 'x - extracting man/postclip.1 (Text)'
-sed 's/^X//' << 'SHAR_EOF' > 'man/postclip.1' &&
-.TH POSTCLIP 1L
-\"
-\" mmuegel
-\" /usr/local/ustart/src/mail-tools/dist/foo/man/postclip.1,v 1.1 1993/07/28 08:08:25 mmuegel Exp
-\"
-.ds mp \fBpostclip\fR
-.SH NAME
-\*(mp - send only the headers to Postmaster
-.SH SYNOPSIS
-\*(mp [ \fB-v\fR ] [ \fIto\fR ... ]
-.SH DESCRIPTION
-\*(mp will forward non-delivery reports to a postmaster after deleting the body
-of the message. This keeps bounced mail private and helps to avoid disk space problems. \*(mp tries its best to keep as much of the header trail as possible.
-Hopefully only the original body of the message will be filtered. Only messages
-that have a subject that begins with 'Returned mail:' are filtered. This
-ensures that other mail is not accidently mucked with. Finally, note that
-\fBsendmail\fR is used to deliver the message after it has been (possibly)
-filtered. All of the original headers will remain intact.
-.sp 1
-You can use this with any \fBsendmail\fR by modifying the Postmaster alias.
-If you use IDA \fBsendmail\fR you could add the following to <machine>.m4:
-.sp 1
-.RS
-define(POSTMASTERBOUNCE, mailer-errors)
-.RE
-.sp 1
-In the aliases file, add a line similar to the following:
-.sp 1
-.RS
-mailer-errors: "|/usr/local/bin/postclip postmaster"
-.RE
-.SH OPTIONS
-.IP \fB-v\fR
-Be verbose about delivery. Probably only useful when debugging \*(mp.
-.IP \fIto\fR
-A list of one or more e-mail ids to send the modified
-Postmaster messages to. If none are specified postmaster
-is used.
-.SH AUTHOR
-.nf
-Michael S. Muegel (mmuegel@mot.com)
-UNIX Applications Startup Group
-Corporate Information Office, Schaumburg, IL
-Motorola, Inc.
-.fi
-.SH CREDITS
-The original idea to filter Postmaster mail was taken from a script by
-Christopher Davis <ckd@eff.org>.
-.SH COPYRIGHT NOTICE
-Copyright 1992, Motorola, Inc.
-.sp 1
-Permission to use, copy, modify and distribute without charge this
-software, documentation, etc. is granted, provided that this
-comment and the author's name is retained. The author nor Motorola assume any
-responsibility for problems resulting from the use of this software.
-.SH SEE ALSO
-.nf
-\fBsendmail(8)\fR
-.fi
-SHAR_EOF
-chmod 0444 man/postclip.1 ||
-echo 'restore of man/postclip.1 failed'
-Wc_c="`wc -c < 'man/postclip.1'`"
-test 2078 -eq "$Wc_c" ||
- echo 'man/postclip.1: original size 2078, current size' "$Wc_c"
-fi
-# ============= src/cqueue ==============
-if test ! -d 'src'; then
- echo 'x - creating directory src'
- mkdir 'src'
-fi
-if test -f 'src/cqueue' -a X"$1" != X"-c"; then
- echo 'x - skipping src/cqueue (File already exists)'
-else
-echo 'x - extracting src/cqueue (Text)'
-sed 's/^X//' << 'SHAR_EOF' > 'src/cqueue' &&
-#!/usr/local/ustart/bin/suidperl
-X
-# NAME
-# cqueue - check sendmail queue for problems
-#
-# SYNOPSIS
-# Type cqueue -usage
-#
-# AUTHOR
-# Michael S. Muegel <mmuegel@mot.com>
-#
-# RCS INFORMATION
-# mmuegel
-# /usr/local/ustart/src/mail-tools/dist/foo/src/cqueue,v 1.1 1993/07/28 08:09:02 mmuegel Exp
-X
-# So that date.pl does not yell (Domain/OS version does a ``)
-$ENV{'PATH'} = "";
-X
-# A better getopts routine
-require "newgetopts.pl";
-require "timespec.pl";
-require "mail.pl";
-require "date.pl";
-require "mqueue.pl";
-require "strings1.pl";
-require "elapsed.pl";
-X
-($Script_Name = $0) =~ s/.*\///;
-X
-# Some defaults you may want to change
-$DEF_TIME = "2h";
-$DEF_QUEUE = "/usr/spool/mqueue";
-$DEF_COLUMNS = 80;
-$DATE_FORMAT = "%r %D";
-X
-# Constants that probably should not be changed
-$USAGE = "Usage: $Script_Name [ -abdms ] [ -q queue-dir ] [ -t time ] [ -u user ] [ -w width ]\n";
-$VERSION = "${Script_Name} by mmuegel; 1.1 of 1993/07/28 08:09:02";
-$SWITCHES = "abdmst:u:q:w:";
-$SPLIT_EXPR = '\s,\.@!%:';
-$ADDR_PART_EXPR = '[^!@%]+';
-X
-# Let getopts parse for switches
-$Status = &New_Getopts ($SWITCHES, $USAGE);
-exit (0) if ($Status == -1);
-exit (1) if (! $Status);
-X
-# Check args
-die "${Script_Name}: -u only valid with -m\n" if (($opt_u) && (! $opt_m));
-die "${Script_Name}: -a not valid with -t option\n" if ($opt_a && $opt_t);
-$opt_u = getlogin || (getpwuid ($<))[0] || $ENV{"USER"} || die "${Script_Name}: can not determine who you are!\n" if (! $opt_u);
-X
-# Set defaults
-$opt_t = "0s" if ($opt_a);
-$opt_t = $DEF_TIME if ($opt_t eq "");
-$opt_w = $DEF_COLUMNS if ($opt_w eq "");
-$opt_q = $DEF_QUEUE if ($opt_q eq "");
-$opt_s = $opt_d = 1 if (! ($opt_s || $opt_d));
-X
-# Untaint the users to mail to
-$opt_u =~ /^(.*)$/;
-$Users = $1;
-X
-# Convert time option to seconds and seconds to elapsed form
-die "${Script_Name}: $Msg\n" if (! (($Status, $Msg, $Seconds) = &Time_Spec_To_Seconds ($opt_t))[0]);
-$Elapsed = &Seconds_To_Elapsed ($Seconds, 1);
-$Time_Info = " longer than $Elapsed" if ($Seconds);
-X
-# Get the current time
-$Current_Time = time;
-$Current_Date = &date ($Current_Time, $DATE_FORMAT);
-X
-($Status, $Msg, @Queue_IDs) = &Get_Queue_IDs ($opt_q, 1, @Missing_Control_IDs,
-X @Missing_Data_IDs);
-die "$Script_Name: $Msg\n" if (! $Status);
-X
-# Yell about missing data/control files?
-if ($opt_b)
-{
-X
-X $Report = "\nMessages missing control files:\n\n " .
-X join ("\n ", @Missing_Control_IDs) .
-X "\n"
-X if (@Missing_Control_IDs);
-X
-X $Report .= "\nMessages missing data files:\n\n " .
-X join ("\n ", @Missing_Data_IDs) .
-X "\n"
-X if (@Missing_Data_IDs);
-};
-X
-# See if any mail messages are older than $Seconds
-foreach $Queue_ID (@Queue_IDs)
-{
-X # Get lots of info about this sendmail message via the control file
-X ($Status, $Msg) = &Parse_Control_File ($opt_q, $Queue_ID, *Sender,
-X *Recipients, *Errors_To, *Creation_Time, *Priority, *Status_Message,
-X *Headers);
-X next if ($Status == -1);
-X if (! $Status)
-X {
-X warn "$Script_Name: $Queue_ID: $Msg\n";
-X next;
-X };
-X
-X # Report on message if it is older than $Seconds
-X if ($Current_Time - $Creation_Time >= $Seconds)
-X {
-X # Build summary by host information. Keep track of each host destination
-X # encountered.
-X if ($opt_s)
-X {
-X %Host_Map = ();
-X foreach (@Recipients)
-X {
-X if ((/@($ADDR_PART_EXPR)$/) || (/($ADDR_PART_EXPR)!$ADDR_PART_EXPR$/))
-X {
-X ($Host = $1) =~ tr/A-Z/a-z/;
-X $Host_Map {$Host} = 1;
-X }
-X else
-X {
-X warn "$Script_Name: could not find host part from $_; contact author\n";
-X };
-X };
-X
-X # For each unique target host add to its stats
-X grep ($Host_Queued {$_}++, keys (%Host_Map));
-X
-X # Build summary by message information.
-X $Message_Queued {$Status_Message}++ if ($Status_Message);
-X };
-X
-X # Build long report information for this creation time (there may be
-X # more than one message created at the same time)
-X if ($opt_d)
-X {
-X $Creation_Date = &date ($Creation_Time, $DATE_FORMAT);
-X $Recipient_Info = &Format_Text_Block (join (", ", @Recipients),
-X " Recipient: ", 1, 0, $opt_w, $SPLIT_EXPR);
-X $Time_To_Report {$Creation_Time} .= <<"EOS";
-X
-X ID: $Queue_ID
-X Date: $Creation_Date
-X Sender: $Sender
-$Recipient_Info
-EOS
-X
-X # Add the status message if available to long report
-X if ($Status_Message)
-X {
-X $Time_To_Report {$Creation_Time} .= &Format_Text_Block ($Status_Message,
-X " Status: ", 1, 0, $opt_w, $SPLIT_EXPR) . "\n";
-X };
-X };
-X };
-X
-};
-X
-# Add the summary report by target host?
-if ($opt_s)
-{
-X foreach $Host (sort (keys (%Host_Queued)))
-X {
-X $Host_Report .= &Format_Text_Block ($Host,
-X sprintf (" %-9d ", $Host_Queued{$Host}), 1, 0, $opt_w,
-X $SPLIT_EXPR) . "\n";
-X $Num_Hosts += $Host_Queued{$Host};
-X };
-X if ($Host_Report)
-X {
-X chop ($Host_Report);
-X $Report .= &Format_Text_Block("\nSummary of messages in queue$Time_Info by destination host:\n", "", 0, 0, $opt_w);
-X
-X $Report .= <<"EOS";
-X
-X Number of
-X Messages Destination Host
-X --------- ----------------
-$Host_Report
-X ---------
-X $Num_Hosts
-EOS
-X };
-};
-X
-# Add the summary by message report?
-if ($opt_s)
-{
-X foreach $Message (sort (keys (%Message_Queued)))
-X {
-X $Message_Report .= &Format_Text_Block ($Message,
-X sprintf (" %-9d ", $Message_Queued{$Message}), 1, 0, $opt_w,
-X $SPLIT_EXPR) . "\n";
-X $Num_Messages += $Message_Queued{$Message};
-X };
-X if ($Message_Report)
-X {
-X chop ($Message_Report);
-X $Report .= &Format_Text_Block ("\nSummary of messages in queue$Time_Info by status message:\n", "", 0, 0, $opt_w);
-X
-X $Report .= <<"EOS";
-X
-X Number of
-X Messages Status Message
-X --------- --------------
-$Message_Report
-X ---------
-X $Num_Messages
-EOS
-X };
-};
-X
-# Add the detailed message reports?
-if ($opt_d)
-{
-X foreach $Time (sort { $a <=> $b} (keys (%Time_To_Report)))
-X {
-X $Report .= &Format_Text_Block ("\nDetail of messages in queue$Time_Info sorted by creation date:\n","", 0, 0, $opt_w) if (! $Detailed_Header++);
-X $Report .= $Time_To_Report {$Time};
-X };
-};
-X
-# Now mail or print the report
-if ($Report)
-{
-X $Report .= "\n";
-X if ($opt_m)
-X {
-X ($Status, $Msg) = &Send_Mail ($Users, "sendmail queue report for $Current_Date", $Report, 0);
-X die "${Script_Name}: $Msg" if (! $Status);
-X }
-X
-X else
-X {
-X print $Report;
-X };
-X
-};
-X
-# I am outta here...
-exit (0);
-SHAR_EOF
-chmod 0555 src/cqueue ||
-echo 'restore of src/cqueue failed'
-Wc_c="`wc -c < 'src/cqueue'`"
-test 6647 -eq "$Wc_c" ||
- echo 'src/cqueue: original size 6647, current size' "$Wc_c"
-fi
-# ============= src/postclip ==============
-if test -f 'src/postclip' -a X"$1" != X"-c"; then
- echo 'x - skipping src/postclip (File already exists)'
-else
-echo 'x - extracting src/postclip (Text)'
-sed 's/^X//' << 'SHAR_EOF' > 'src/postclip' &&
-#!/usr/local/bin/perl
-X
-# NAME
-# postclip - send only the headers to Postmaster
-#
-# SYNOPSIS
-# postclip [ -v ] [ to ... ]
-#
-# AUTHOR
-# Michael S. Muegel <mmuegel@mot.com>
-#
-# RCS INFORMATION
-# /usr/local/ustart/src/mail-tools/dist/foo/src/postclip,v
-# 1.1 of 1993/07/28 08:09:02
-X
-# We use this to send off the mail
-require "newgetopts.pl";
-require "mail.pl";
-X
-# Get the basename of the script
-($Script_Name = $0) =~ s/.*\///;
-X
-# Some famous constants
-$USAGE = "Usage: $Script_Name [ -v ] [ to ... ]\n";
-$VERSION = "${Script_Name} by mmuegel; 1.1 of 1993/07/28 08:09:02";
-$SWITCHES = "v";
-X
-# Let getopts parse for switches
-$Status = &New_Getopts ($SWITCHES, $USAGE);
-exit (0) if ($Status == -1);
-exit (1) if (! $Status);
-X
-# Who should we send the modified mail to?
-@ARGV = ("postmaster") if (! @ARGV);
-$Users = join (" ", @ARGV);
-@ARGV = ();
-X
-# Suck in the original header and save a few interesting lines
-while (<>)
-{
-X $Buffer .= $_ if (! /^From /);
-X $Subject = $1 if (/^Subject:\s+(.*)$/);
-X $From = $1 if (/^From:\s+(.*)$/);
-X last if (/^$/);
-};
-X
-# Do not filter the message unless it has a subject and the subject indicates
-# it is an NDN
-if ($Subject && ($Subject =~ /^returned mail/i))
-{
-X # Slurp input by paragraph. Keep track of the last time we saw what
-X # appeared to be NDN text. We keep this.
-X $/ = "\n\n";
-X $* = 1;
-X while (<>)
-X {
-X push (@Paragraphs, $_);
-X $Last_Error_Para = $#Paragraphs
-X if (/unsent message follows/i || /was not delivered because/);
-X };
-X
-X # Now save the NDN text into $Buffer
-X $Buffer .= join ("", @Paragraphs [0..$Last_Error_Para]);
-}
-X
-else
-{
-X undef $/;
-X $Buffer .= <>;
-};
-X
-# Send off the (possibly) modified mail
-($Status, $Msg) = &Send_Mail ($Users, "", $Buffer, 0, $opt_v, 1);
-die "$Script_Name: $Msg\n" if (! $Status);
-SHAR_EOF
-chmod 0555 src/postclip ||
-echo 'restore of src/postclip failed'
-Wc_c="`wc -c < 'src/postclip'`"
-test 1836 -eq "$Wc_c" ||
- echo 'src/postclip: original size 1836, current size' "$Wc_c"
-fi
-exit 0
-
---
-+----------------------------------------------------------------------------+
-| Michael S. Muegel | Internet E-Mail: mmuegel@mot.com |
-| UNIX Applications Startup Group | Moto Dist E-Mail: X10090 |
-| Corporate Information Office | Voice: (708) 576-0507 |
-| Motorola | Fax: (708) 576-4153 |
-+----------------------------------------------------------------------------+
-
- "I'm disturbed, I'm depressed, I'm inadequate -- I've got it all!"
- -- George from _Seinfeld_
+++ /dev/null
-/*
-** OLDBIND.COMPAT.C
-**
-** Very old systems do not have res_query(), res_querydomain() or
-** res_search(), so emulate them here.
-**
-** You really ought to be upgrading to a newer version of BIND
-** (4.8.2 or later) rather than be using this.
-**
-** J.R. Oldroyd <jr@inset.com>
-*/
-
-#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/nameser.h>
-#include <resolv.h>
-
-typedef union
-{
- HEADER qb1;
- char qb2[PACKETSZ];
-} querybuf;
-
-res_query(dname, class, type, data, datalen)
- char * dname;
- int class;
- int type;
- char * data;
- int datalen;
-{
- int n;
- querybuf buf;
-
- n = res_mkquery(QUERY, dname, class, type, (char *) NULL, 0,
- NULL, (char *) &buf, sizeof buf);
- n = res_send((char *)&buf, n, data, datalen);
-
- return n;
-}
-
-res_querydomain(host, dname, class, type, data, datalen)
- char * host;
- char * dname;
- int class;
- int type;
- char * data;
- int datalen;
-{
- int n;
- querybuf buf;
- char dbuf[256];
-
- strcpy(dbuf, host);
- if (dbuf[strlen(dbuf)-1] != '.')
- strcat(dbuf, ".");
- strcat(dbuf, dname);
- n = res_mkquery(QUERY, dbuf, class, type, (char *) NULL, 0,
- NULL, (char *)&buf, sizeof buf);
- n = res_send((char *) &buf, n, data, datalen);
-
- return n;
-}
-
-res_search(dname, class, type, data, datalen)
- char * dname;
- int class;
- int type;
- char * data;
- int datalen;
-{
- int n;
- querybuf buf;
-
- n = res_mkquery(QUERY, dname, class, type, (char *)NULL, 0,
- NULL, (char *) &buf, sizeof buf);
- n = res_send((char *) &buf, n, data, datalen);
-
- return n;
-}
+++ /dev/null
-#!/bin/perl
-
-#
-# Convert GECOS information in password files to alias syntax.
-#
-# Contributed by Kari E. Hurtta <Kari.Hurtta@ozone.fmi.fi>
-#
-
-print "# Generated from passwd by $0\n";
-
-while (@a = getpwent) {
- ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$dir,$shell) = @a;
-
- ($fullname = $gcos) =~ s/,.*$//;
-
- if (!-d $dir || !-x $shell) {
- print "$name: root\n";
- }
-
- $fullname =~ s/\.*[ _]+\.*/./g;
- $fullname =~ tr [åäöÅÄÖé] [aaoAAOe]; # <hakan@af.lu.se> 1997-06-15
- if ($fullname =~ /^[a-zA-Z][a-zA-Z-]+(\.[a-zA-Z][a-zA-Z-]+)+$/) {
-# if ($fullname =~ /^[a-zA-Z]+(\.[a-zA-Z]+)+$/) { # Kari E. Hurtta
- print "$fullname: $name\n";
- } else {
- print "# $fullname: $name\n";
- }
-};
-
-endpwent;
+++ /dev/null
-#!/usr/bin/perl
-#
-# re-mqueue -- requeue messages from queueA to queueB based on age.
-#
-# Contributed by Paul Pomes <ppomes@Qualcomm.COM>.
-# http://www.qualcomm.com/~ppomes/
-#
-# Usage: re-mqueue [-d] queueA queueB seconds
-#
-# -d enable debugging
-# queueA source directory
-# queueB destination directory
-# seconds select files older than this number of seconds
-#
-# Example: re-mqueue /var/spool/mqueue /var/spool/mqueue2 2700
-#
-# Moves the qf* and df* files for a message from /var/spool/mqueue to
-# /var/spool/mqueue2 if the df* file is over 2700 seconds old.
-#
-# The qf* file can't be used for age checking as it's partially re-written
-# with the results of the last queue run.
-#
-# Rationale: With a limited number of sendmail processes allowed to run,
-# messages that can't be delivered immediately slow down the ones that can.
-# This becomes especially important when messages are being queued instead
-# of delivered right away, or when the queue becomes excessively deep.
-# By putting messages that have already failed one or more delivery attempts
-# into another queue, the primary queue can be kept small and fast.
-#
-# On postoffice.cso.uiuc.edu, the primary sendmail daemon runs the queue
-# every thirty minutes. Messages over 45 minutues old are moved to
-# /var/spool/mqueue2 where sendmail runs every hour. Messages more than
-# 3.25 hours old are moved to /var/spool/mqueue3 where sendmail runs every
-# four hours. Messages more than a day old are moved to /var/spool/mqueue4
-# where sendmail runs three times a day. The idea is that a message is
-# tried at least twice in the first three queues before being moved to the
-# old-age ghetto.
-#
-# (Each must be re-formed into a single line before using in crontab)
-#
-# 08 * * * * /usr/local/libexec/re-mqueue /var/spool/mqueue ## /var/spool/mqueue2 2700
-# 11 * * * * /usr/lib/sendmail -oQ/var/spool/mqueue2 -q > ## > /var/log/mqueue2 2>&1
-# 38 * * * * /usr/local/libexec/re-mqueue /var/spool/mqueue2
-# /var/spool/mqueue3 11700
-# 41 1,5,9,13,17,21 * * * /usr/lib/sendmail -oQ/var/spool/mqueue3 -q ## > /var/log/mqueue3 2>&1
-# 48 * * * * /usr/local/libexec/re-mqueue /var/spool/mqueue3
-# /var/spool/mqueue4 100000
-#53 3,11,19 * * * /usr/lib/sendmail -oQ/var/spool/mqueue4 -q > ## > /var/log/mqueue4 2>&1
-#
-#
-# N.B., the moves are done with link(). This has two effects: 1) the mqueue*
-# directories must all be on the same filesystem, and 2) the file modification
-# times are not changed. All times must be cumulative from when the df*
-# file was created.
-#
-# Copyright (c) 1995 University of Illinois Board of Trustees and Paul Pomes
-# All rights reserved.
-#
-# 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.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by the University of
-# Illinois at Urbana and their contributors.
-# 4. Neither the name of the University nor the names of their contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE TRUSTEES 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 TRUSTEES 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.
-#
-# @(#)$Id: re-mqueue.pl,v 1.2 1998/07/12 19:43:49 millert Exp $
-
-require "syslog.pl";
-
-$LOCK_EX = 2;
-$LOCK_NB = 4;
-$LOCK_UN = 8;
-
-# Count arguments, exit if wrong in any way.
-die "Usage: $0 [-d] queueA queueB seconds\n" if ($#ARGV < 2);
-
-while ($_ = $ARGV[0], /^-/) {
- shift;
- last if /^--$/;
- /^-d/ && $debug++;
-}
-
-$queueA = shift;
-$queueB = shift;
-$age = shift;
-
-die "$0: $queueA not a directory\n" if (! -d $queueA);
-die "$0: $queueB not a directory\n" if (! -d $queueB);
-die "$0: $age isn't a valid number of seconds for age\n" if ($age =~ /\D/);
-
-# chdir to $queueA and read the directory. When a df* file is found, stat it.
-# If it's older than $age, lock the corresponding qf* file. If the lock
-# fails, give up and move on. Once the lock is obtained, verify that files
-# of the same name *don't* already exist in $queueB and move on if they do.
-# Otherwise re-link the qf* and df* files into $queueB then release the lock.
-
-chdir "$queueA" || die "$0: can't cd to $queueA: $!\n";
-opendir (QA, ".") || die "$0: can't open directory $queueA for reading: $!\n";
-@dfiles = grep(/^df/, readdir(QA));
-$now = time();
-($program = $0) =~ s,.*/,,;
-&openlog($program, 'pid', 'mail');
-
-# Loop through the dfiles
-while ($dfile = pop(@dfiles)) {
- print "Checking $dfile\n" if ($debug);
- ($qfile = $dfile) =~ s/^d/q/;
- ($mfile = $dfile) =~ s/^df//;
- if (! -e $dfile || -z $dfile) {
- print "$dfile is gone or zero bytes - skipping\n" if ($debug);
- next;
- }
- if (! -e $qfile || -z $qfile) {
- print "$qfile is gone or zero bytes - skipping\n" if ($debug);
- next;
- }
-
- $mtime = $now;
- ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
- $atime,$mtime,$ctime,$blksize,$blocks) = stat($dfile);
-
- # Compare timestamps
- if (($mtime + $age) > $now) {
- printf ("%s is %d seconds old - skipping\n", $dfile, $now-$mtime) if ($debug);
- next;
- }
-
- # See if files of the same name already exist in $queueB
- if (-e "$queueB/$dfile") {
- print "$queueb/$dfile already exists - skipping\n" if ($debug);
- next;
- }
- if (-e "$queueB/$qfile") {
- print "$queueb/$qfile already exists - skipping\n" if ($debug);
- next;
- }
-
- # Try and lock qf* file
- unless (open(QF, ">>$qfile")) {
- print "$qfile: $!\n" if ($debug);
- next;
- }
- $retval = flock(QF, $LOCK_EX|$LOCK_NB) || ($retval = -1);
- if ($retval == -1) {
- print "$qfile already flock()ed - skipping\n" if ($debug);
- close(QF);
- next;
- }
- print "$qfile now flock()ed\n" if ($debug);
-
- # Show time! Do the link()s
- if (link("$dfile", "$queueB/$dfile") == 0) {
- &syslog('err', 'link(%s, %s/%s): %m', $dfile, $queueB, $dfile);
- print STDERR "$0: link($dfile, $queueB/$dfile): $!\n";
- exit (1);
- }
- if (link("$qfile", "$queueB/$qfile") == 0) {
- &syslog('err', 'link(%s, %s/%s): %m', $qfile, $queueB, $qfile);
- print STDERR "$0: link($qfile, $queueB/$qfile): $!\n";
- unlink("$queueB/$dfile");
- exit (1);
- }
-
- # Links created successfully. Unlink the original files, release the
- # lock, and close the file.
- print "links ok\n" if ($debug);
- if (unlink($qfile) == 0) {
- &syslog('err', 'unlink(%s): %m', $qfile);
- print STDERR "$0: unlink($qfile): $!\n";
- exit (1);
- }
- if (unlink($dfile) == 0) {
- &syslog('err', 'unlink(%s): %m', $dfile);
- print STDERR "$0: unlink($dfile): $!\n";
- exit (1);
- }
- flock(QF, $LOCK_UN);
- close(QF);
- &syslog('info', '%s moved to %s', $mfile, $queueB);
- print "Done with $dfile $qfile\n\n" if ($debug);
-}
-exit 0;
+++ /dev/null
-From: Bill Gianopoulos <wag@sccux1.msd.ray.com>
-Message-Id: <199405191527.LAA03463@sccux1.msd.ray.com>
-Subject: Patch to rmail to elliminate need for snprintf
-To: sendmail@CS.Berkeley.EDU
-Date: Thu, 19 May 1994 11:27:16 -0400 (EDT)
-
-I have written the following patch to rmail which removes the requirement
-for snprintf while maintaining the protection from buffer overruns. It also
-fixes it to compile with compilers which don't understand ANSI function
-prototypes. Perhaps this should be included in the next version?
-
-*** rmail/rmail.c.orig Mon May 31 18:10:44 1993
---- rmail/rmail.c Thu May 19 11:04:50 1994
-***************
-*** 78,86 ****
---- 78,109 ----
- #include <sysexits.h>
- #include <unistd.h>
-
-+ #ifdef __STDC__
- void err __P((int, const char *, ...));
- void usage __P((void));
-+ #else
-+ void err ();
-+ void usage ();
-+ #endif
-
-+ #define strdup(s) strcpy(xalloc(strlen(s) + 1), s)
-+
-+ char *
-+ xalloc(sz)
-+ register int sz;
-+ {
-+ register char *p;
-+
-+ /* some systems can't handle size zero mallocs */
-+ if (sz <= 0)
-+ sz = 1;
-+
-+ p = malloc((unsigned) sz);
-+ if (p == NULL)
-+ err(EX_UNAVAILABLE, "Out of memory!!");
-+ return (p);
-+ }
-+
- int
- main(argc, argv)
- int argc;
-***************
-*** 230,250 ****
- args[i++] = "-oi"; /* Ignore '.' on a line by itself. */
-
- if (from_sys != NULL) { /* Set sender's host name. */
-! if (strchr(from_sys, '.') == NULL)
-! (void)snprintf(buf, sizeof(buf),
- "-oMs%s.%s", from_sys, domain);
-! else
-! (void)snprintf(buf, sizeof(buf), "-oMs%s", from_sys);
- if ((args[i++] = strdup(buf)) == NULL)
- err(EX_TEMPFAIL, NULL);
- }
- /* Set protocol used. */
-! (void)snprintf(buf, sizeof(buf), "-oMr%s", domain);
- if ((args[i++] = strdup(buf)) == NULL)
- err(EX_TEMPFAIL, NULL);
-
- /* Set name of ``from'' person. */
-! (void)snprintf(buf, sizeof(buf), "-f%s%s",
- from_path ? from_path : "", from_user);
- if ((args[i++] = strdup(buf)) == NULL)
- err(EX_TEMPFAIL, NULL);
---- 253,285 ----
- args[i++] = "-oi"; /* Ignore '.' on a line by itself. */
-
- if (from_sys != NULL) { /* Set sender's host name. */
-! if (strchr(from_sys, '.') == NULL) {
-! if ((strlen(from_sys) + strlen(domain) + 6)
-! > sizeof(buf))
-! err(EX_DATAERR, "sender hostname too long");
-! (void)sprintf(buf,
- "-oMs%s.%s", from_sys, domain);
-! }
-! else {
-! if ((strlen(from_sys) + 5) > sizeof(buf))
-! err(EX_DATAERR ,"sender hostname too long");
-! (void)sprintf(buf, "-oMs%s", from_sys);
-! }
- if ((args[i++] = strdup(buf)) == NULL)
- err(EX_TEMPFAIL, NULL);
- }
- /* Set protocol used. */
-! if ((strlen(domain) + 5) > sizeof(buf))
-! err(EX_DATAERR, "protocol name too long");
-! (void)sprintf(buf, "-oMr%s", domain);
- if ((args[i++] = strdup(buf)) == NULL)
- err(EX_TEMPFAIL, NULL);
-
- /* Set name of ``from'' person. */
-! if (((from_path ? strlen(from_path) : 0) + strlen(from_user) + 3)
-! > sizeof(buf))
-! err(EX_DATAERR, "from address too long");
-! (void)sprintf(buf, "-f%s%s",
- from_path ? from_path : "", from_user);
- if ((args[i++] = strdup(buf)) == NULL)
- err(EX_TEMPFAIL, NULL);
---
-William A. Gianopoulos; Raytheon Missile Systems Division
-wag@sccux1.msd.ray.com
+++ /dev/null
-#!/usr/local/bin/perl -w
-
-use FileHandle;
-use Socket;
-
-$sendmailDaemon = "/usr/sbin/sendmail -q30m -bd";
-
-##########################################################################
-#
-# &get_controlname -- read ControlSocketName option from sendmail.cf
-#
-# Parameters:
-# none.
-#
-# Returns:
-# control socket filename, undef if not found
-#
-
-sub get_controlname
-{
- my $cn = undef;
- my $qd = undef;
-
- open(CF, "</etc/sendmail.cf") or return $cn;
- while (<CF>)
- {
- chomp;
- if (/^O ControlSocketName\s*=\s*([^#]+)$/o)
- {
- $cn = $1;
- }
- if (/^O QueueDirectory\s*=\s*([^#]+)$/o)
- {
- $qd = $1;
- }
- if (/^OQ([^#]+)$/o)
- {
- $qd = $1;
- }
- }
- close(CF);
- if (not defined $cn)
- {
- return undef;
- }
- if ($cn !~ /^\//o)
- {
- return undef if (not defined $qd);
-
- $cn = $qd . "/" . $cn;
- }
- return $cn;
-}
-
-##########################################################################
-#
-# &do_command -- send command to sendmail daemon view control socket
-#
-# Parameters:
-# controlsocket -- filename for socket
-# command -- command to send
-#
-# Returns:
-# reply from sendmail daemon
-#
-
-sub do_command
-{
- my $controlsocket = shift;
- my $command = shift;
- my $proto = getprotobyname('ip');
- my @reply;
-
- socket(SOCK, PF_UNIX, SOCK_STREAM, $proto) or return undef;
-
- for ($i = 0; $i < 4; $i++)
- {
- if (!connect(SOCK, sockaddr_un($controlsocket)))
- {
- if ($i == 3)
- {
- close(SOCK);
- return undef;
- }
- sleep 1;
- next;
- }
- last;
- }
- autoflush SOCK 1;
- print SOCK "$command\n";
- @reply = <SOCK>;
- close(SOCK);
- return join '', @reply;
-}
-
-##########################################################################
-#
-# &sendmail_running -- check if sendmail is running via SMTP
-#
-# Parameters:
-# none
-#
-# Returns:
-# 1 if running, undef otherwise
-#
-
-sub sendmail_running
-{
- my $port = getservbyname("smtp", "tcp") || 25;
- my $proto = getprotobyname("tcp");
- my $iaddr = inet_aton("localhost");
- my $paddr = sockaddr_in($port, $iaddr);
-
- socket(SOCK, PF_INET, SOCK_STREAM, $proto) or return undef;
- if (!connect(SOCK, $paddr))
- {
- close(SOCK);
- return undef;
- }
- autoflush SOCK 1;
- while (<SOCK>)
- {
- if (/^(\d{3})([ -])/)
- {
- if ($1 != 220)
- {
- close(SOCK);
- return undef;
- }
- }
- else
- {
- close(SOCK);
- return undef;
- }
- last if ($2 eq " ");
- }
- print SOCK "QUIT\n";
- while (<SOCK>)
- {
- last if (/^\d{3} /);
- }
- close(SOCK);
- return 1;
-}
-
-##########################################################################
-#
-# &munge_status -- turn machine readable status into human readable text
-#
-# Parameters:
-# raw -- raw results from sendmail daemon STATUS query
-#
-# Returns:
-# human readable text
-#
-
-sub munge_status
-{
- my $raw = shift;
- my $cooked = "";
- my $daemonStatus = "";
-
- if ($raw =~ /^(\d+)\/(\d+)$/mg)
- {
- $cooked .= "Current number of children: $1";
- if ($2 > 0)
- {
- $cooked .= " (maximum $2)";
- }
- $cooked .= "\n";
- }
- while ($raw =~ /^(\d+) (.*)$/mg)
- {
- if (not $daemonStatus)
- {
- $daemonStatus = "(process $1) " . ucfirst($2) . "\n";
- }
- else
- {
- $cooked .= "Child Process $1 Status: $2\n";
- }
- }
- return ($daemonStatus, $cooked);
-}
-
-##########################################################################
-#
-# &start_daemon -- fork off a sendmail daemon
-#
-# Parameters:
-# control -- control socket name
-#
-# Returns:
-# Error message or "OK" if successful
-#
-
-sub start_daemon
-{
- my $control = shift;
- my $pid;
-
- if ($pid = fork)
- {
- my $exitstat;
-
- waitpid $pid, 0 or return "Could not get status of created process: $!\n";
- $exitstat = $? / 256;
- if ($exitstat != 0)
- {
- return "sendmail daemon startup exited with exit value $exitstat";
- }
- }
- elsif (defined $pid)
- {
- exec($main::sendmailDaemon);
- die "Unable to start sendmail daemon: $!.\n";
- }
- else
- {
- return "Could not create new process: $!\n";
- }
- return "OK\n";
-}
-
-##########################################################################
-#
-# &stop_daemon -- stop the sendmail daemon using control socket
-#
-# Parameters:
-# control -- control socket name
-#
-# Returns:
-# Error message or status message
-#
-
-sub stop_daemon
-{
- my $control = shift;
- my $status;
-
- if (not defined $control)
- {
- return "The control socket is not configured so the daemon can not be stopped.\n";
- }
- return &do_command($control, "SHUTDOWN");
-}
-
-##########################################################################
-#
-# &restart_daemon -- restart the sendmail daemon using control socket
-#
-# Parameters:
-# control -- control socket name
-#
-# Returns:
-# Error message or status message
-#
-
-sub restart_daemon
-{
- my $control = shift;
- my $status;
-
- if (not defined $control)
- {
- return "The control socket is not configured so the daemon can not be restarted.";
- }
- return &do_command($control, "RESTART");
-}
-
-##########################################################################
-#
-# &help -- get help from the daemon using the control socket
-#
-# Parameters:
-# control -- control socket name
-#
-# Returns:
-# Error message or status message
-#
-
-sub help
-{
- my $control = shift;
- my $status;
-
- if (not defined $control)
- {
- return "The control socket is not configured so the daemon can not be queried for help.";
- }
- return &do_command($control, "HELP");
-}
-
-my $command = shift;
-my $control = &get_controlname;
-my $status = undef;
-my $daemonStatus = undef;
-
-if (not defined $control)
-{
- die "No control socket available.\n";
-}
-if (not defined $command)
-{
- die "Usage: $0 command\n";
-}
-if ($command eq "status")
-{
- $status = &do_command($control, "STATUS");
- if (not defined $status)
- {
- # Not responding on control channel, query via SMTP
- if (&sendmail_running)
- {
- $daemonStatus = "Sendmail is running but not answering status queries.";
- }
- else
- {
- $daemonStatus = "Sendmail does not appear to be running.";
- }
- }
- else
- {
- # Munge control channel output
- ($daemonStatus, $status) = &munge_status($status);
- }
-}
-elsif (lc($command) eq "shutdown")
-{
- $status = &stop_daemon($control);
-}
-elsif (lc($command) eq "restart")
-{
- $status = &restart_daemon($control);
-}
-elsif (lc($command) eq "start")
-{
- $status = &start_daemon($control);
-}
-elsif (lc($command) eq "help")
-{
- $status = &help($control);
-}
-else
-{
- die "Unrecognized command $command\n";
-}
-if (defined $daemonStatus)
-{
- print "Daemon Status: $daemonStatus\n";
-}
-if (defined $status)
-{
- print "$status\n";
-}
-else
-{
- die "No response\n";
-}
+++ /dev/null
-# @(#)Makefile 8.1 (Berkeley) 4/13/1994
-
-DIR= smm/09.sendmail
-SRCS= changes.me
-MACROS= -me
-
-all: changes.ps
-
-changes.ps: ${SRCS}
- rm -f ${.TARGET}
- ${PIC} ${SRCS} | ${ROFF} > ${.TARGET}
-
-.include <bsd.doc.mk>
+++ /dev/null
-.\" Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-.\" Copyright (c) 1994 Eric P. Allman. All rights reserved.
-.\" Copyright (c) 1988, 1994
-.\" 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.
-.\"
-.\"
-.\" @(#)changes.me 8.7 (Berkeley) 5/19/1998
-.\"
-.\" ditroff -me -Pxx changes.me
-.eh '%''Changes in Sendmail Version 8'
-.oh 'Changes in Sendmail Version 8''%'
-.nr si 3n
-.if n .ls 2
-.+c
-.(l C
-.sz 14
-Changes in Sendmail Version 8*
-.sz
-.sp
-Eric Allman
-.sp 0.5
-.i
-University of California, Berkeley
-Mammoth Project
-.)l
-.(f
-*An earlier version of this paper was printed in the
-Proceedings of the 1994 AUUG Queensland Summer Technical Conference,
-Gateway Hotel, Brisbane, March 1994.
-.)f
-.sp
-.(l F
-.ce
-ABSTRACT
-.sp \n(psu
-Version 8 of
-.i sendmail
-includes a number of major changes from previous versions.
-This paper gives a very short history of
-.i sendmail ,
-a summary of the major differences between version 5
-(the last publically available version)
-and version 8,
-and some discussion of future directions.
-.)l
-.sp 2
-.pp
-In 1987, the author stopped major work on
-.i sendmail
-due to other time committments,
-only to return to active work in 1991.
-This paper explores why work resumed
-and what changes have been made.
-.pp
-Section 1 gives a short history of
-.i sendmail
-through version 5 and the motivation behind working on version 8.
-Section 2 has
-a rather detailed description of what has changed
-between version 5 and version 8.
-The paper finishes off with some thoughts
-about what still needs to be done.
-.sh 1 "HISTORY"
-.pp
-As discussed elsewhere,
-[Allman83a, Allman83b, Allman&Amos85]
-sendmail has existed in various forms since 1980.
-It was released under the name
-.i delivermail
-in 4BSD and 4.1BSD, and as
-.i sendmail
-in 4.2BSD.
-.\"4.0BSD delivermail 1.10
-.\"4.1BSD delivermail 1.10
-.\"4.2BSD sendmail 4.12
-.\"4.3BSD sendmail 5.52
-It quickly became the dominant mail system for networked UNIX systems.
-.pp
-Prior the release of 4.3BSD in November 1986,
-the author had left the University for private industry,
-but continued to do some work on
-.i sendmail
-with activity slowly trailing off
-until effectively stopping after February 1987.
-There was minimal support done by many people for several years,
-until July of 1991 when the original author,
-who had returned the University,
-started active work on it again.
-.pp
-There were several reasons for renewed work on
-.i sendmail .
-There was a desire at Berkeley to convert to a subdomained structure
-so that individuals were identified by their subdomain
-rather than by their individual workstation;
-although possible in the old code, there were some problems,
-and the author was the obvious person to address them.
-The Computer Systems Research Group (CSRG),
-the group that produced the Berkeley Software Distributions,
-was working on 4.4BSD,
-and wanted an update to the mail system.
-Bryan Costales was working on a book on
-.i sendmail
-that was being reviewed by the author,
-which encouraged him to make some revisions.
-And the author wanted to try to unify some of the disparate versions of
-.i sendmail
-that had been permitted to proliferate.
-.pp
-During the 1987\-91 fallow period,
-many vendors and outside volunteers
-had produced variants of
-.i sendmail .
-Perhaps the best known is the IDA version
-[IDA87].
-Originally intended to be a new set of configuration files,
-IDA expanded into a fairly large set of patches for the code.
-Originally produced in Sweden,
-IDA development passed to the University of Illinois,
-and was widely used by the fairly large set of people
-who prefer to get and compile their own source code
-rather than use vendor-supplied binaries.
-.pp
-In about the same time frame,
-attempts were made to clean up and extend the Simple Mail Transport Protocol
-(SMTP)
-[RFC821].
-This involved clarifications of some ambiguities in the protocol,
-and correction of some problem areas
-[RFC1123],
-as well as extensions for additional functionality
-(dubbed Extended Simple Mail Transport Protocol, or ESMTP)
-[RFC1425, RFC1426, RFC1427]
-and a richer set of semantics in the body of messages
-(the Multipurpose Internet Mail Extensions, a.k.a. MIME)
-[RFC1521, RFC1344].
-Neither the IDA group nor most vendors
-were modifying
-.i sendmail
-to conform to these new standards.
-It seemed clear that these were ``good things''
-that should be encouraged.
-However, since no one was working on a publically available version of
-.i sendmail
-with these updates,
-they were unlikely to be widely deployed any time in the near future.
-.pp
-There are, of course, other mail transport agents available,
-such as
-.i MMDF
-.\"[ref],
-.i zmailer
-.\"[ref],
-.i smail
-.\"[ref],
-and
-.i PP
-.\"[ref].
-However, none of these seemed to be gaining the prominence of
-.i sendmail ;
-it appeared that most companies would not convert to another
-mail transport agent any time in the forseeable future.
-However, they might be persuaded to convert to a newer version of
-.i sendmail .
-.pp
-All of these convinced the author
-to work on a updated version of
-.i sendmail
-for public distribution.
-.pp
-The new version of
-.i sendmail
-is referred to as version eight (V8).
-Versions six and seven were skipped
-because of an agreement
-that all files in 4.4BSD would be numbered as
-.q 8.1 .
-Rather than have an external version number
-that differed from the file version numbers,
-.i sendmail
-just jumped directly to V8.
-.sh 1 "CHANGES IN VERSION EIGHT"
-.pp
-The following is a summary of the changes between the last commonly
-available version of sendmail from Berkeley (5.67) and the latest
-version (8.6.6).
-.pp
-Many of these are ideas that had been tried in IDA,
-but many of them were generalized in V8.
-.sh 2 "Performance Enhancements"
-.pp
-Instead of closing SMTP connections immediately, open connections are
-cached for possible future use. There is a limit to the number of
-simultaneous open connections and the idle time of any individual
-connection.
-.pp
-This is of best help during queue processing (since there is the
-potential of many different messages going to one site), although
-it can also help when processing MX records which aren't handled
-by MX Piggybacking.
-.pp
-If two hosts with different names in a single message happen to
-have the same set of MX hosts, they can be sent in the same
-transaction. Version 8 notices this and tries to batch the messages.
-.pp
-For example, if two sites ``foo.com'' and ``bar.com'' are both
-served by UUNET, they will have the same set of MX hosts and will
-be sent in one transaction. UUNET will then split the message
-and send it to the two individual hosts.
-.sh 2 "RFC 1123 Changes"
-.pp
-A number of changes have been made to make sendmail ``conditionally
-compliant'' (that is, it satisfies all of the MUST clauses and most
-but not all of the SHOULD clauses in RFC 1123).
-.pp
-The major areas of change are (numbers are RFC 1123 section numbers):
-.nr ii 0.75i
-.ip \(sc5.2.7
-Response to RCPT command is fast. Previously, sendmail
-expanded all aliases as far as it could \*- this could
-take a very long time, particularly if there were
-name server delays. Version 8 only checks for the
-existence of an alias and does the expansion later.
-It does still do a DNS lookup if there is an explicit host name
-in the RCPT command,
-but this time is bounded.
-.ip \(sc5.2.8
-Numeric IP addresses are logged in Received: lines.
-This helps tracing spoofed messages.
-.ip \(sc5.2.17
-Self domain literal is properly handled. Previously,
-if someone sent to user@[1.2.3.4], where 1.2.3.4 is
-your IP address, the mail would probably be rejected
-with a ``configuration error''.
-Version 8 can handle these addresses.
-.ip \(sc5.3.2
-Better control over individual timeouts. RFC 821 specified
-no timeouts. Older versions of sendmail had a single
-timeout, typically set to two hours. Version 8 allows
-the configuration file to set timeouts for various
-SMTP commands individually.
-.ip \(sc5.3.3
-Error messages are sent as From:<>. This was urged by
-RFC 821 and reiterated by RFC 1123, but older versions
-of sendmail never really did it properly. Version 8
-does. However, some systems cannot handle this
-perfectly legal address; if necessary, you can create
-a special mailer that uses the `g' flag to disable this.
-.ip \(sc5.3.3
-Error messages are never sent to <>. Previously,
-sendmail was happy to send responses-to-responses which
-sometimes resulted in responses-to-responses-to-responses
-which resulted in .... you get the idea.
-.ip \(sc5.3.3
-Route-addrs (the ugly ``<@hosta,@hostb:user@hostc>''
-syntax) are pruned. RFC 821 urged the use of this
-bletcherous syntax. RFC 1123 has seen the light and
-officially deprecates them, further urging that you
-eliminate all but ``user@hostc'' should you receive
-one of these things. Version 8 is slightly more generous
-than the standards suggest; instead of stripping off all
-the route addressees, it only strips hosts off up to
-the one before the last one known to DNS, thus allowing
-you to have pseudo-hosts such as foo.BITNET. The `R'
-option will turn this off.
-.lp
-The areas in which sendmail is not ``unconditionally compliant'' are:
-.ip \(sc5.2.6
-Sendmail does do header munging.
-.ip \(sc5.2.10
-Sendmail doesn't always use the exact SMTP message
-text from RFC 821. This is a rather silly requirement.
-.ip \(sc5.3.1.1
-Sendmail doesn't guarantee only one connect for each
-host on queue runs. Connection caching gives you most
-of this, but it does not provide a guarantee.
-.ip \(sc5.3.1.1
-Sendmail doesn't always provide an adequate limit
-on concurrency. That is, there can be several
-independent sendmails running at once. My feeling
-is that doing an absolute limit would be a mistake
-(it might result in lost mail). However, if you use
-the XLA contributed software, most of this will be
-guaranteed (but I don't guarantee the guarantee).
-.sh 2 "Extended SMTP Support
-.pp
-Version 8 includes both sending and receiving support for Extended
-SMTP support as defined by RFC 1425 (basic) and RFC 1427 (SIZE);
-and limited support for RFC 1426 (BODY).
-The body support is minimal because the
-.q 8BITMIME
-body type is not currently advertised.
-Although such a body type will be accepted,
-it will not be correctly converted to 7 bits
-if speaking to a non-8-bit-MIME aware SMTP server.
-.pp
-.i Sendmail
-tries to speak ESMTP if you have the `a' flag set
-in the flags for the mailer descriptor,
-or if the other end advertises the fact that it speaks ESMTP.
-This is a non-standard advertisement:
-.i sendmail
-announces
-.q "ESMTP spoken here"
-during the initial connection message,
-and client sendmails search for this message.
-This creates some problems for some PC-based mailers,
-which do not understand two-line greeting messages
-as required by RFC 821.
-.sh 2 "Eight-Bit Clean
-.pp
-Previous versions of sendmail used the 0200 bit for quoting. This
-version avoids that use.
-However, you can set option `7' to get seven bit stripping
-for compatibility with RFC 821,
-which is a 7-bit protocol.
-This option says ``strip to 7 bits on input''.
-.pp
-Individual mailers can still produce seven bit out put using the
-`7' mailer flag.
-This flag says ``strip to 7 bits on output''.
-.sh 2 "User Database"
-.pp
-The User Database (UDB) is an as-yet experimental attempt to provide
-unified large-site name support.
-We are installing it at Berkeley;
-future versions may show significant modifications.
-Briefly, UDB contains a database that is intended to contain
-all the per-user information for your workgroup,
-such as people's full names, their .plan information,
-their outgoing mail name, and their mail drop.
-.pp
-The user database allows you to map both incoming and outgoing
-addresses, much like IDA. However, the interface is still
-better with IDA;
-in particular, the alias file with incoming/outgoing marks
-provides better locality of information.
-.sh 2 "Improved BIND Support"
-.pp
-The BIND support, particularly for MX records, had a number of
-annoying ``features'' which have been removed in this release. In
-particular, these more tightly bind (pun intended) the name server
-to sendmail, so that the name server resolution rules are incorporated
-directly into sendmail.
-.pp
-The major change has been that the $[ ... $] operator didn't fully
-qualify names that were in DNS as A or MX records. Version 8 does
-this qualification.
-.pp
-This has proven to be an annoyance in Sun shops,
-who often still run without BIND support.
-However, it is really critical that this be supported,
-since MX records are mandatory.
-In SunOS you can choose either MX support or NIS support,
-but not both.
-This is fixed in Solaris,
-and some
-.i sendmail
-support to allow this in SunOS should be forthcoming in a future release.
-.sh 2 "Keyed Files"
-.pp
-Generalized keyed files is an idea taken directly from IDA sendmail
-(albeit with a completely different implementation).
-They can be useful on large sites.
-.pp
-Version 8 includes the following built-in map classes:
-.ip dbm
-Support for the ndbm(3) library.
-.ip hash
-Support for the ``Hash'' type from the new Berkeley db(3) library.
-this library provides substantially better database support
-than ndbm(3),
-including in-memory caching,
-arbitrarily long keys and values,
-and better disk utilization.
-.ip btree
-Support for the ``B-Tree'' type from the new Berkeley db(3) library.
-B-Trees provide better clustering than Hashed files
-if you are fetching lots of records that have similar keys,
-such as searching a dictionary for words beginning with ``detr''.
-.ip nis
-Support for NIS (a.k.a. YP) maps.
-NIS+ is not supported in this version.
-.ip host
-Support for DNS lookups.
-.ip dequote
-A ``pseudo-map'' (that is, once that does not have any external data)
-that allows a configuration file to break apart a quoted string
-in the address.
-This is necessary primarily for DECnet addresses,
-which often have quoted addresses that need to be unwrapped on gateways.
-.sh 2 "Multi-Word Classes & Macros in Classes"
-.pp
-Classes can now be multiple words. For example,
-.(b
-CShofmann.CS.Berkeley.EDU
-.)b
-allows you to match the entire string ``hofmann.CS.Berkeley.EDU''
-using the single construct ``$=S''.
-.pp
-Class definitions are now allowed to include macros \*- for example:
-.(b
-Cw$k
-.)b
-is legal.
-.sh 2 "IDENT Protocol Support"
-.pp
-The IDENT protocol as defined in RFC 1413 [RFC1413] is supported.
-However, many systems have a TCP/IP bug that renders this useless,
-and the feature must be turned off.
-Roughly, if one of these system receives a
-.q "No route to host"
-message (ICMP message ICMP_UNREACH_HOST) on
-.i any
-connection, all connections to that host are closed.
-Some firewalls return this error if you try to connect
-to the IDENT port,
-so you can't receive email from these hosts on these systems.
-It's possible that if the firewall used a more specific message
-(such as ICMP_UNREACH_PROTOCOL, ICMP_UNREACH_PORT or ICMP_UNREACH_NET_PROHIB)
-it would work, but this hasn't been verified.
-.pp
-IDENT protocol support cannot be used on
-4.3BSD,
-Apollo DomainOS,
-Apple A/UX,
-ConvexOS,
-Data General DG/UX,
-HP-UX,
-Sequent Dynix,
-or
-Ultrix 4.x, x \(<= 3.
-It seems to work on
-4.4BSD,
-IBM AIX 3.x,
-OSF/1,
-SGI IRIX,
-Solaris,
-SunOS,
-and Ultrix 4.4.
-.sh 2 "Separate Envelope/Header Processing
-.pp
-Since the From: line is passed in separately from the envelope
-sender, these have both been made visible; the $g macro is set to
-the envelope sender during processing of mailer argument vectors
-and the header sender during processing of headers.
-.pp
-It is also possible to specify separate per-mailer envelope and
-header processing. The SenderRWSet and RecipientRWset arguments
-for mailers can be specified as ``envelope/header'' to give different
-rewritings for envelope versus header addresses.
-.sh 2 "Owner-List Propagates to Envelope
-.pp
-When an alias has an associated owner-list name, that alias is used
-to change the envelope sender address. This will cause downstream
-errors to be returned to that owner.
-.pp
-Some people find this confusing
-because the envelope sender is what appears in the first
-``From_'' line in UNIX messages
-(that is, the line beginning ``From<space>''
-instead of ``From:'';
-the latter is the header from, which
-.i does
-indicate the sender of the message).
-In previous versions,
-.i sendmail
-has tried to avoid changing the envelope sender
-for back compatibility with UNIX convention;
-at this point that back compatibility is creating too many problems,
-and it is necessary to move forward into the 1980s.
-.sh 2 "Command Line Flags"
-.pp
-The
-.b \-B
-flag has been added to pass in body type information.
-.pp
-The
-.b \-p
-flag has been added to pass in protocol information
-that was previously passed in by defining the
-.b $r
-and
-.b $s
-macros.
-.pp
-The
-.b \-X
-flag has been added to allow logging of all protocol in and
-out of sendmail for debugging.
-You can set
-.q "\-X filename"
-and a complete transcript will be logged in that file.
-This gets big fast: the option is only for debugging.
-.pp
-The
-.b \-q
-flag can limit limit a queue run to specific recipients,
-senders, or queue ids using \-qRsubstring, \-qSsubstring, or
-\-qIsubstring respectively.
-.sh 2 "New Configuration Line Types
-.pp
-The `T' (Trusted users) configuration line has been deleted. It
-will still be accepted but will be ignored.
-.pp
-The `K' line has been added to declare database maps.
-.pp
-The `V' line has been added to declare the configuration version
-level.
-.pp
-The `M' (mailer) line takes a D= field to specify execution
-directory.
-.sh 2 "New and Extended Options"
-.pp
-Several new options have been added, many to support new features,
-others to allow tuning that was previously available only by
-recompiling. Briefly:
-.nr ii 0.5i
-.ip A
-The alias file specification can now be a list of alias files.
-Also, the configuration can specify a class of file.
-For example, to search the NIS aliases, use
-.q OAnis:mail.aliases .
-.ip b
-Insist on a minimum number of disk blocks.
-.ip C
-Delivery checkpoint interval. Checkpoint the queue (to avoid
-duplicate deliveries) every C addresses.
-.ip E
-Default error message. This message (or the contents of the
-indicated file) are prepended to error messages.
-.ip G
-Enable GECOS matching. If you can't find a local user name
-and this option is enabled, do a sequential scan of the passwd
-file to match against full names. Previously a compile option.
-.ip h
-Maximum hop count. Previously this was compiled in.
-.ip I
-This option has been extended to allow setting of resolver parameters.
-.ip j
-Send errors in MIME-encapsulated format.
-.ip J
-Forward file path. Where to search for .forward files \*- defaults
-to $HOME/.forward.
-.ip k
-Connection cache size. The total number of connections that will
-be kept open at any time.
-.ip K
-Connection cache lifetime. The amount of time any connection
-will be permitted to sit idle.
-.ip l
-Enable Errors-To: header. These headers violate RFC 1123;
-this option is included to provide back compatibility with
-old versions of sendmail.
-.ip O
-Incoming daemon options (e.g., use alternate SMTP port).
-.ip p
-Privacy options. These can be used to make your SMTP server
-less friendly.
-.ip r
-This option has been extended to allow finer grained control
-over timeouts.
-For example, you can set the timeout for SMTP commands individually.
-.ip R
-Don't prune route-addrs. Normally, if version 8 sees an address
-like "<@hostA,@hostB:user@hostC>, sendmail will try to strip off
-as much as it can (up to user@hostC) as suggested by RFC 1123.
-This option disables that behaviour.
-.ip T
-The
-.q "Return To Sender"
-timeout has been extended
-to allow specification of a warning message interval,
-typically something on the order of four hours.
-If a message cannot be delivered in that interval,
-a warning message is sent back to the sender
-but the message continues to be tried.
-.ip U
-User database spec. This is still experimental.
-.ip V
-Fallback ``MX'' host. This can be thought of as an MX host
-that applies to all addresses that has a very high preference
-value (that is, use it only if everything else fails).
-.ip w
-If set, assume that if you are the best MX host for a host,
-you should send directly to that host. This is intended
-for compatibility with UIUC sendmail, and may have some
-use on firewalls.
-.ip 7
-Do not run eight bit clean. Technically, you have to assert
-this option to be RFC 821 compatible.
-.sh 2 "New Mailer Definitions"
-.ip L=
-Set the allowable line length. In V5, the L mailer flag implied
-a line length limit of 990 characters; this is now settable to
-an arbitrary value.
-.ip F=a
-Try to use ESMTP. It will fall back to SMTP if the initial
-EHLO packet is rejected.
-.ip F=b
-Ensure a blank line at the end of messages. Useful on the
-*file* mailer.
-.ip F=c
-Strip all comments from addresses; this should only be used as
-a last resort when dealing with cranky mailers.
-.ip F=g
-Never use the null sender as the envelope sender, even when
-running SMTP. This violates RFC 1123.
-.ip F=7
-Strip all output to this mailer to 7 bits.
-.ip F=L
-Used to set the line limit to 990 bytes for SMTP compatibility.
-It now does that only if the L= keyletter is not specified.
-This flag is obsolete and should not be used.
-.sh 2 "New or Changed Pre-Defined Macros"
-.ip $k
-UUCP node name from uname(2).
-.ip $m
-Domain part of our full hostname.
-.ip $_
-RFC 1413-provided sender address.
-.ip $w
-Previously was sometimes the full domain name, sometimes
-just the first word. Now guaranteed to be the first word
-of the domain name (i.e., the host name).
-.ip $j
-Previously had to be defined \*- it is now predefined to be
-the full domain name, if that can be determined. That is,
-it is equivalent to $w.$m.
-.sh 2 "New and Changed Classes"
-.ip $=k
-Initialized to contain $k.
-.ip $=w
-Now includes
-.q [1.2.3.4]
-(where 1.2.3.4 is your IP address)
-to allow the configuration file to recognize your own IP address.
-.sh 2 "New Rewriting Tokens"
-.pp
-The
-.b $&
-construct has been adopted from IDA to defer macro evaluation.
-Normally, macros in rulesets are bound when the rule is first parsed
-during startup.
-Some macros change during processing and are uninteresting during startup.
-However, that macro can be referenced using
-.q $&x
-to defer the evaulation of
-$x
-until the rule is processed.
-.pp
-The tokens
-.b $(
-and
-.b $)
-have been added to allow specification of map rewriting.
-.pp
-Version 8 allows
-.b $@
-on the Left Hand Side of an `R' line to match
-zero tokens.
-This is intended to be used to match the null input.
-.sh 2 "Bigger Defaults
-.pp
-Version 8 allows up to 100 rulesets instead of 30. It is recommended
-that rulesets 0\-9 be reserved for sendmail's dedicated use in future
-releases.
-.pp
-The total number of MX records that can be used has been raised to
-20.
-.pp
-The number of queued messages that can be handled at one time has
-been raised from 600 to 1000.
-.sh 2 "Different Default Tuning Parameters
-.pp
-Version 8 has changed the default parameters for tuning queue costs
-to make the number of recipients more important than the size of
-the message (for small messages). This is reasonable if you are
-connected with reasonably fast links.
-.sh 2 "Auto-Quoting in Addresses
-.pp
-Previously, the ``Full Name <email address>'' syntax would generate
-incorrect protocol output if ``Full Name'' had special characters
-such as dot. This version puts quotes around such names.
-.sh 2 "Symbolic Names On Error Mailer
-.pp
-Several names have been built in to the $@ portion of the $#error
-mailer. For example:
-.(b
-$#error $@NOHOST $: Host unknown
-.)b
-Prints the indicated message
-and sets the exit status of
-.i sendmail
-to
-.sm EX_NOHOST .
-.sh 2 "New Built-In Mailers"
-.pp
-Two new mailers, *file* and *include*, are included to define options
-when mailing to a file or a :include: file respectively. Previously
-these were overloaded on the local mailer.
-.sh 2 "SMTP VRFY Doesn't Expand
-.pp
-Previous versions of sendmail treated VRFY and EXPN the same. In
-this version, VRFY doesn't expand aliases or follow .forward files.
-.pp
-As an optimization, if you run with your default delivery mode
-being queue-only, the RCPT command will also not chase aliases and
-\&.forward files.
-It will chase them when it processes the queue.
-This speeds up RCPT processing.
-.sh 2 "[IPC] Mailers Allow Multiple Hosts
-.pp
-When an address resolves to a mailer that has ``[IPC]'' as its
-``Path'', the $@ part (host name) can be a colon-separated list of
-hosts instead of a single hostname. This asks sendmail to search
-the list for the first entry that is available exactly as though
-it were an MX record. The intent is to route internal traffic
-through internal networks without publishing an MX record to the
-net. MX expansion is still done on the individual items.
-.sh 2 "Aliases Extended"
-.pp
-The implementation has been merged with maps. Among other things,
-this supports multiple alias files and NIS-based aliases. For
-example:
-.(b
-OA/etc/aliases,nis:mail.aliases
-.)b
-will search first the local database
-.q /etc/aliases
-followed by the NIS map
-
-.sh 2 "Portability and Security Enhancements
-.pp
-A number of internal changes have been made to enhance portability.
-.pp
-Several fixes have been made to increase the paranoia factor.
-.pp
-In particular, the permissions required for .forward and :include:
-files have been tightened up considerably. V5 would pretty much
-read any file it could get to as root, which exposed some security
-holes. V8 insists that all directories leading up to the .forward
-or :include: file be searchable ("x" permission) by the controlling
-user" (defined below), that the file itself be readable by the
-controlling user, and that .forward files be owned by the user
-who is being forwarded to or root.
-.pp
-The "controlling user" is the user on whose behalf the mail is
-being delivered. For example, if you mail to "user1" then the
-controlling user for ~user1/.forward and any mailers invoked
-by that .forward file, including :include: files.
-.pp
-Previously, anyone who had a home directory could create a .forward
-could forward to a program. Now, sendmail checks to make sure
-that they have an "approved shell", that is, a shell listed in
-the /etc/shells file.
-.sh 2 "Miscellaneous Fixes and Enhancements"
-.pp
-A number of small bugs having to do with things like backslash-escaped
-quotes inside of comments have been fixed.
-.pp
-The fixed size limit on header lines
-(such as
-.q To:
-and
-.q Cc: )
-has been eliminated;
-those buffers are dynamically allocated now.
-.pp
-Sendmail writes a /etc/sendmail.pid file with the current process id
-and the current invocation flags.
-.pp
-Two people using the same program (e.g., submit) are considered
-"different" so that duplicate elimination doesn't delete one of
-them. For example, two people forwarding their email to
-|submit will be treated as two recipients.
-.pp
-The mailstats program prints mailer names and gets the location of
-the sendmail.st file from /etc/sendmail.cf.
-.pp
-Many minor bugs have been fixed, such as handling of backslashes
-inside of quotes.
-.pp
-A hook has been added to allow rewriting of local addresses after
-aliasing.
-.sh 1 "FUTURE WORK"
-.pp
-The previous section describes
-.i sendmail
-as of version 8.6.6.
-There is still much to be done.
-Some high points are described below.
-This list is by no means exhaustive.
-.sh 2 "Full MIME Support"
-.pp
-Currently
-.i sendmail
-only supports seven bit MIME messages.
-Although it can pass eight bit MIME messages,
-it cannot advertise that fact because the standards say
-that the mail agent must be able to do 8- to 7-bit conversion
-to have full 8-bit support.
-This requires far more extensive modification of the message body
-than is currently supported.
-.pp
-The best way to do this would be to support the general concept
-of an external
-``message filter''
-that could do arbitrary modifications of the message.
-This would allow MIME conversion as well as such things as
-automatic encryption of messages sent over external links.
-This is probably an extremely non-trivial change.
-.sh 2 "Service Switch Abstraction"
-.pp
-Most modern systems include some concept of a
-.q "service switch"
-\*- for example, to look up host names you can try
-DNS, NIS, NIS+, text tables, NetInfo,
-or other services in some arbitrary order.
-This is currently very clumsy in
-.i sendmail ,
-with only limited control of the services provided.
-.sh 2 "More Control of Local Addresses"
-.pp
-Currently some addresses are declared as
-.q local
-and are handled specially \*-
-for example, they may have .forward files,
-may be translated into program calls or file deliveries,
-and so forth.
-These should be broken out into separate flags
-to allow the local system administrator
-to have more fine-grained control over operations.
-.sh 2 "More Run-Time Configuration Options"
-.pp
-There are many options that are configured at compile time,
-such as the method of file locking
-and the use of the IDENT protocol
-[RFC1413].
-These should be transfered to run time
-by adding new options.
-.pp
-Similarly, some options are currently overloaded,
-that is, a single option controls more than one thing.
-These should probably be broken out into separate options.
-.pp
-This implies that options will change from single characters
-to words.
-.sh 2 "More Configuration Control Over Errors"
-.pp
-Currently,
-the configuration file can generate an error message during parsing.
-However,
-it cannot tweak other operations,
-such as issuing a warning message to the system postmaster.
-Similarly,
-some errors should not be triggered if they are in aliases
-during an alias file rebuild,
-but should be triggered if that alias is actually used.
-.sh 2 "Long Term Host State"
-.pp
-Currently,
-.i sendmail
-only remembers host status during a single queue run.
-This should be converted to long term status
-stored on disk
-so it can be shared between instantiations of
-.i sendmail .
-Entries will have to be timestamped
-so they can time out.
-This will allow
-.i sendmail
-to implement exponential backoff on queue runs
-on a per-host basis.
-.sh 2 "Connection Control"
-.pp
-Modern networks have different types of connectivity
-than the past.
-In particular, the rising prominence of dialup IP
-has created certain challenges for automated servers.
-It is not uncommon to try to make a connection to a host
-and have it fail, even though if you tried again it would succeed.
-The connection management could be a bit cleverer
-to try to adapt to such situations.
-.sh 2 "Other Caching"
-.pp
-When you do an MX record lookup,
-the name server automatically returns the IP addresses
-of the associated MX servers.
-This information is currently ignored,
-and another query is done to get this information.
-It should be cached to avoid excess name server traffic.
-.sh 1 "REFERENCES"
-.ip [Allman83a]
-.q "Sendmail \*- An Internetwork Mail Router."
-E. Allman.
-In
-.ul
-Unix Programmers's Manual,
-4.2 Berkeley Software Distribution,
-volume 2C.
-August 1983.
-.ip [Allman83b]
-.q "Mail Systems and Addressing in 4.2BSD."
-E. Allman
-In
-.ul
-UNICOM Conference Proceedings.
-San Diego, California.
-January 1983.
-.ip [Allman&Amos85]
-``Sendmail Revisited.''
-E. Allman and M. Amos.
-In
-.ul
-Usenix Summer 1985 Conference Proceedings.
-Portland, Oregon.
-June 1985.
-.ip [IDA87]
-.ul 3
-Electronic Mail Addressing in Theory and Practice
-with the IDA Sendmail Enhancement Kit
-(or The Postmaster's Last Will and Testament).
-Lennart Lo\*:vstrand.
-Department of Computer and Information Science,
-University of Linko\*:ping,
-Sweden,
-Report no. LiTH-IDA-Ex-8715.
-May 1987.
-.ip [RFC821]
-.ul
-Simple Mail Transport Protocol.
-J. Postel.
-August 1982.
-.ip [RFC1123]
-.ul
-Requirements for Internet Hosts \*- Application and Support.
-Internet Engineering Task Force,
-R. Braden, Editor.
-October 1989.
-.ip [RFC1344]
-.ul
-Implications of MIME for Internet Mail Gateways.
-N. Borenstein.
-June 1992.
-.ip [RFC1413]
-.ul
-Identification Protocol.
-M. St. Johns.
-February 1993.
-.ip [RFC1425]
-.ul
-SMTP Service Extensions.
-J. Klensin, N. Freed, M. Rose, E. Stefferud, and D. Crocker.
-February 1993.
-.ip [RFC1426]
-.ul
-SMTP Service Extension for 8bit-MIMEtransport.
-J. Klensin, N. Freed, M. Rose, E. Stefferud, and D. Crocker.
-February 1993.
-.ip [RFC1427]
-.ul
-SMTP Service Extension for Message Size Declaration.
-J. Klensin, N. Freed, and K. Moore.
-February 1993.
-.ip [RFC1521]
-.ul 3
-MIME (Multipurpose Internet Mail Extensions) Part One:
-Mechanisms for Specifying and Describing
-the Format of Internet Message Bodies.
-N. Borenstein and N. Freed.
-September 1993.
+++ /dev/null
-%!PS-Adobe-3.0
-%%Creator: groff version 1.10
-%%CreationDate: Tue May 19 16:37:14 1998
-%%DocumentNeededResources: font Times-Roman
-%%+ font Times-Italic
-%%+ font Times-Bold
-%%+ font Symbol
-%%DocumentSuppliedResources: procset grops 1.10 0
-%%Pages: 11
-%%PageOrder: Ascend
-%%Orientation: Portrait
-%%EndComments
-%%BeginProlog
-%%BeginResource: procset grops 1.10 0
-/setpacking where{
-pop
-currentpacking
-true setpacking
-}if
-/grops 120 dict dup begin
-/SC 32 def
-/A/show load def
-/B{0 SC 3 -1 roll widthshow}bind def
-/C{0 exch ashow}bind def
-/D{0 exch 0 SC 5 2 roll awidthshow}bind def
-/E{0 rmoveto show}bind def
-/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
-/G{0 rmoveto 0 exch ashow}bind def
-/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/I{0 exch rmoveto show}bind def
-/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
-/K{0 exch rmoveto 0 exch ashow}bind def
-/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/M{rmoveto show}bind def
-/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
-/O{rmoveto 0 exch ashow}bind def
-/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/Q{moveto show}bind def
-/R{moveto 0 SC 3 -1 roll widthshow}bind def
-/S{moveto 0 exch ashow}bind def
-/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/SF{
-findfont exch
-[exch dup 0 exch 0 exch neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/MF{
-findfont
-[5 2 roll
-0 3 1 roll
-neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/level0 0 def
-/RES 0 def
-/PL 0 def
-/LS 0 def
-/MANUAL{
-statusdict begin/manualfeed true store end
-}bind def
-/PLG{
-gsave newpath clippath pathbbox grestore
-exch pop add exch pop
-}bind def
-/BP{
-/level0 save def
-1 setlinecap
-1 setlinejoin
-72 RES div dup scale
-LS{
-90 rotate
-}{
-0 PL translate
-}ifelse
-1 -1 scale
-}bind def
-/EP{
-level0 restore
-showpage
-}bind def
-/DA{
-newpath arcn stroke
-}bind def
-/SN{
-transform
-.25 sub exch .25 sub exch
-round .25 add exch round .25 add exch
-itransform
-}bind def
-/DL{
-SN
-moveto
-SN
-lineto stroke
-}bind def
-/DC{
-newpath 0 360 arc closepath
-}bind def
-/TM matrix def
-/DE{
-TM currentmatrix pop
-translate scale newpath 0 0 .5 0 360 arc closepath
-TM setmatrix
-}bind def
-/RC/rcurveto load def
-/RL/rlineto load def
-/ST/stroke load def
-/MT/moveto load def
-/CL/closepath load def
-/FL{
-currentgray exch setgray fill setgray
-}bind def
-/BL/fill load def
-/LW/setlinewidth load def
-/RE{
-findfont
-dup maxlength 1 index/FontName known not{1 add}if dict begin
-{
-1 index/FID ne{def}{pop pop}ifelse
-}forall
-/Encoding exch def
-dup/FontName exch def
-currentdict end definefont pop
-}bind def
-/DEFS 0 def
-/EBEGIN{
-moveto
-DEFS begin
-}bind def
-/EEND/end load def
-/CNT 0 def
-/level1 0 def
-/PBEGIN{
-/level1 save def
-translate
-div 3 1 roll div exch scale
-neg exch neg exch translate
-0 setgray
-0 setlinecap
-1 setlinewidth
-0 setlinejoin
-10 setmiterlimit
-[]0 setdash
-/setstrokeadjust where{
-pop
-false setstrokeadjust
-}if
-/setoverprint where{
-pop
-false setoverprint
-}if
-newpath
-/CNT countdictstack def
-userdict begin
-/showpage{}def
-}bind def
-/PEND{
-clear
-countdictstack CNT sub{end}repeat
-level1 restore
-}bind def
-end def
-/setpacking where{
-pop
-setpacking
-}if
-%%EndResource
-%%IncludeResource: font Times-Roman
-%%IncludeResource: font Times-Italic
-%%IncludeResource: font Times-Bold
-%%IncludeResource: font Symbol
-grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
-def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron
-/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
-/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
-/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
-/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
-/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
-/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
-/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
-/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
-/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
-/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
-/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
-/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
-/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
-/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
-/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
-/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
-/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
-/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
-/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
-/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
-/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
-/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
-/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
-/Times-Bold@0 ENC0/Times-Bold RE/Times-Italic@0 ENC0/Times-Italic RE
-/Times-Roman@0 ENC0/Times-Roman RE
-%%EndProlog
-%%Page: 1 1
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 14/Times-Roman@0 SF(Changes in Sendmail V)196.615 141 Q(ersion 8*)
--1.554 E/F1 10/Times-Roman@0 SF(Eric Allman)263.42 165 Q/F2 10
-/Times-Italic@0 SF(Univer)220.2 183 Q(sity of California, Berk)-.1 E
-(ele)-.1 E(y)-.3 E(Mammoth Pr)251.98 195 Q(oject)-.45 E F1(ABSTRA)
-262.085 227.4 Q(CT)-.4 E -1.11(Ve)112 243.6 S 1.709(rsion 8 of)1.11 F F2
-(sendmail)4.209 E F1 1.709(includes a number of major changes from pre)
-4.209 F 1.71(vious v)-.25 F(ersions.)-.15 E .701(This paper gi)112 255.6
-R -.15(ve)-.25 G 3.201(sav).15 G .701(ery short history of)-3.351 F F2
-(sendmail)3.201 E F1 3.201(,as)C .7(ummary of the major dif)-3.201 F
-(ferences)-.25 E .953(between v)112 267.6 R .954
-(ersion 5 \(the last publically a)-.15 F -.25(va)-.2 G .954(ilable v).25
-F .954(ersion\) and v)-.15 F .954(ersion 8, and some dis-)-.15 F
-(cussion of future directions.)112 279.6 Q .48
-(In 1987, the author stopped major w)97 324 R .48(ork on)-.1 F F2
-(sendmail)2.98 E F1 .48(due to other time committments, only to return)
-2.98 F(to acti)72 336 Q .3 -.15(ve w)-.25 H(ork in 1991.).05 E
-(This paper e)5 E(xplores wh)-.15 E 2.5(yw)-.05 G
-(ork resumed and what changes ha)-2.6 E .3 -.15(ve b)-.2 H(een made.).15
-E .58(Section 1 gi)97 352.2 R -.15(ve)-.25 G 3.08(sas).15 G .58
-(hort history of)-3.08 F F2(sendmail)3.08 E F1 .58(through v)3.08 F .58
-(ersion 5 and the moti)-.15 F -.25(va)-.25 G .58(tion behind w).25 F .58
-(orking on)-.1 F -.15(ve)72 364.2 S .126(rsion 8.).15 F .126(Section 2 has a rather detailed description of what has changed between v)
-5.126 F .125(ersion 5 and v)-.15 F .125(ersion 8.)-.15 F
-(The paper \214nishes of)72 376.2 Q 2.5(fw)-.25 G
-(ith some thoughts about what still needs to be done.)-2.5 E/F3 10
-/Times-Bold@0 SF 2.5(1. HIST)72 400.2 R(OR)-.18 E(Y)-.35 E F1 .151
-(As discussed else)112 416.4 R .151
-(where, [Allman83a, Allman83b, Allman&Amos85] sendmail has e)-.25 F .151
-(xisted in v)-.15 F(ar)-.25 E(-)-.2 E .405(ious forms since 1980.)87
-428.4 R .405(It w)5.405 F .405(as released under the name)-.1 F F2
-(delivermail)2.905 E F1 .404(in 4BSD and 4.1BSD, and as)2.905 F F2
-(send-)2.904 E(mail)87 440.4 Q F1(in 4.2BSD.)2.5 E
-(It quickly became the dominant mail system for netw)5 E(ork)-.1 E
-(ed UNIX systems.)-.1 E 1.569(Prior the release of 4.3BSD in No)112
-456.6 R -.15(ve)-.15 G 1.569(mber 1986, the author had left the Uni).15
-F -.15(ve)-.25 G 1.57(rsity for pri).15 F -.25(va)-.25 G(te).25 E
-(industry)87 468.6 Q 3.347(,b)-.65 G .847(ut continued to do some w)
--3.547 F .847(ork on)-.1 F F2(sendmail)3.347 E F1 .847(with acti)3.347 F
-.846(vity slo)-.25 F .846(wly trailing of)-.25 F 3.346(fu)-.25 G .846
-(ntil ef)-3.346 F(fecti)-.25 E -.15(ve)-.25 G(ly).15 E .255
-(stopping after February 1987.)87 480.6 R .255(There w)5.255 F .255
-(as minimal support done by man)-.1 F 2.756(yp)-.15 G .256(eople for se)
--2.756 F -.15(ve)-.25 G .256(ral years, until).15 F
-(July of 1991 when the original author)87 492.6 Q 2.5(,w)-.4 G
-(ho had returned the Uni)-2.5 E -.15(ve)-.25 G(rsity).15 E 2.5(,s)-.65 G
-(tarted acti)-2.5 E .3 -.15(ve w)-.25 H(ork on it ag).05 E(ain.)-.05 E
-1.271(There were se)112 508.8 R -.15(ve)-.25 G 1.271
-(ral reasons for rene).15 F 1.271(wed w)-.25 F 1.271(ork on)-.1 F F2
-(sendmail)3.771 E F1 6.271(.T)C 1.271(here w)-6.271 F 1.27
-(as a desire at Berk)-.1 F(ele)-.1 E 3.77(yt)-.15 G(o)-3.77 E(con)87
-520.8 Q -.15(ve)-.4 G .097(rt to a subdomained structure so that indi)
-.15 F .098(viduals were identi\214ed by their subdomain rather than by)
--.25 F 1.758(their indi)87 532.8 R 1.758(vidual w)-.25 F 1.758(orkstation; although possible in the old code, there were some problems, and the)
--.1 F .66(author w)87 544.8 R .66(as the ob)-.1 F .66
-(vious person to address them.)-.15 F .66
-(The Computer Systems Research Group \(CSRG\), the)5.66 F 1.89
-(group that produced the Berk)87 556.8 R(ele)-.1 E 4.39(yS)-.15 G(oftw)
--4.39 E 1.89(are Distrib)-.1 F 1.89(utions, w)-.2 F 1.89(as w)-.1 F 1.89
-(orking on 4.4BSD, and w)-.1 F 1.89(anted an)-.1 F .053
-(update to the mail system.)87 568.8 R .053(Bryan Costales w)5.053 F
-.053(as w)-.1 F .053(orking on a book on)-.1 F F2(sendmail)2.553 E F1
-.053(that w)2.553 F .053(as being re)-.1 F(vie)-.25 E(wed)-.25 E .923
-(by the author)87 580.8 R 3.423(,w)-.4 G .923
-(hich encouraged him to mak)-3.423 F 3.422(es)-.1 G .922(ome re)-3.422 F
-3.422(visions. And)-.25 F .922(the author w)3.422 F .922
-(anted to try to unify)-.1 F(some of the disparate v)87 592.8 Q
-(ersions of)-.15 E F2(sendmail)2.5 E F1
-(that had been permitted to proliferate.)2.5 E .023
-(During the 1987\25591 f)112 609 R(allo)-.1 E 2.523(wp)-.25 G .023
-(eriod, man)-2.523 F 2.523(yv)-.15 G .023(endors and outside v)-2.673 F
-.023(olunteers had produced v)-.2 F .024(ariants of)-.25 F F2(sendmail)
-87 621 Q F1 5.518(.P)C .517(erhaps the best kno)-5.518 F .517
-(wn is the ID)-.25 F 3.017(Av)-.4 G .517(ersion [ID)-3.167 F 3.017
-(A87]. Originally)-.4 F .517(intended to be a ne)3.017 F 3.017(ws)-.25 G
-.517(et of)-3.017 F .268(con\214guration \214les, ID)87 633 R 2.768(Ae)
--.4 G .269(xpanded into a f)-2.918 F .269(airly lar)-.1 F .269
-(ge set of patches for the code.)-.18 F .269(Originally produced in)
-5.269 F .471(Sweden, ID)87 645 R 2.971(Ad)-.4 G -2.15 -.25(ev e)-2.971 H
-.471(lopment passed to the Uni).25 F -.15(ve)-.25 G .471
-(rsity of Illinois, and w).15 F .47(as widely used by the f)-.1 F .47
-(airly lar)-.1 F(ge)-.18 E .077
-(set of people who prefer to get and compile their o)87 657 R .077
-(wn source code rather than use v)-.25 F(endor)-.15 E .078
-(-supplied bina-)-.2 F(ries.)87 669 Q .32 LW 76 678.6 72 678.6 DL 80
-678.6 76 678.6 DL 84 678.6 80 678.6 DL 88 678.6 84 678.6 DL 92 678.6 88
-678.6 DL 96 678.6 92 678.6 DL 100 678.6 96 678.6 DL 104 678.6 100 678.6
-DL 108 678.6 104 678.6 DL 112 678.6 108 678.6 DL 116 678.6 112 678.6 DL
-120 678.6 116 678.6 DL 124 678.6 120 678.6 DL 128 678.6 124 678.6 DL 132
-678.6 128 678.6 DL 136 678.6 132 678.6 DL 140 678.6 136 678.6 DL 144
-678.6 140 678.6 DL 148 678.6 144 678.6 DL 152 678.6 148 678.6 DL 156
-678.6 152 678.6 DL 160 678.6 156 678.6 DL 164 678.6 160 678.6 DL 168
-678.6 164 678.6 DL 172 678.6 168 678.6 DL 176 678.6 172 678.6 DL 180
-678.6 176 678.6 DL 184 678.6 180 678.6 DL 188 678.6 184 678.6 DL 192
-678.6 188 678.6 DL 196 678.6 192 678.6 DL 200 678.6 196 678.6 DL 204
-678.6 200 678.6 DL 208 678.6 204 678.6 DL 212 678.6 208 678.6 DL 216
-678.6 212 678.6 DL/F4 8/Times-Roman@0 SF .045(*An earlier v)93.6 690.6 R
-.045(ersion of this paper w)-.12 F .044
-(as printed in the Proceedings of the 1994 A)-.08 F .044
-(UUG Queensland Summer T)-.44 F .044(echnical Conference,)-.56 F(Gate)72
-700.2 Q -.08(wa)-.2 G 2(yH).08 G(otel, Brisbane, March 1994.)-2 E F3
-(Changes in Sendmail V)72 756 Q(ersion 8)-1 E(1)294.65 E EP
-%%Page: 2 2
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF 294.65(2C)72 60 S(hanges in Sendmail V)-294.65 E
-(ersion 8)-1 E/F1 10/Times-Roman@0 SF .151
-(In about the same time frame, attempts were made to clean up and e)112
-96 R .151(xtend the Simple Mail T)-.15 F(rans-)-.35 E .468
-(port Protocol \(SMTP\) [RFC821].)87 108 R .468(This in)5.468 F -.2(vo)
--.4 G(lv).2 E .469
-(ed clari\214cations of some ambiguities in the protocol, and)-.15 F
-.085(correction of some problem areas [RFC1123], as well as e)87 120 R
-.084(xtensions for additional functionality \(dubbed)-.15 F 1.052
-(Extended Simple Mail T)87 132 R 1.053
-(ransport Protocol, or ESMTP\) [RFC1425, RFC1426, RFC1427] and a richer)
--.35 F 1.376(set of semantics in the body of messages \(the Multipurpose Internet Mail Extensions, a.k.a. MIME\))
-87 144 R .497([RFC1521, RFC1344].)87 156 R .497(Neither the ID)5.497 F
-2.998(Ag)-.4 G .498(roup nor most v)-2.998 F .498(endors were modifying)
--.15 F/F2 10/Times-Italic@0 SF(sendmail)2.998 E F1 .498(to conform)2.998
-F 1.7(to these ne)87 168 R 4.2(ws)-.25 G 4.2(tandards. It)-4.2 F 1.699
-(seemed clear that these were `)4.2 F 1.699(`good things')-.74 F 4.199
-('t)-.74 G 1.699(hat should be encouraged.)-4.199 F(Ho)87 180 Q(we)-.25
-E -.15(ve)-.25 G 1.635 -.4(r, s).15 H .835(ince no one w).4 F .835(as w)
--.1 F .835(orking on a publically a)-.1 F -.25(va)-.2 G .835(ilable v)
-.25 F .836(ersion of)-.15 F F2(sendmail)3.336 E F1 .836
-(with these updates,)3.336 F(the)87 192 Q 2.5(yw)-.15 G(ere unlik)-2.5 E
-(ely to be widely deplo)-.1 E(yed an)-.1 E 2.5(yt)-.15 G
-(ime in the near future.)-2.5 E .466
-(There are, of course, other mail transport agents a)112 208.2 R -.25
-(va)-.2 G .465(ilable, such as).25 F F2 .465(MMDF zmailer smail)2.965 F
-F1(and)2.965 E F2(PP)2.965 E F1(Ho)87 220.2 Q(we)-.25 E -.15(ve)-.25 G
-.842 -.4(r, n).15 H .042(one of these seemed to be g).4 F .043
-(aining the prominence of)-.05 F F2(sendmail)2.543 E F1 2.543(;i)C 2.543
-(ta)-2.543 G .043(ppeared that most compa-)-2.543 F .238(nies w)87 232.2
-R .238(ould not con)-.1 F -.15(ve)-.4 G .238
-(rt to another mail transport agent an).15 F 2.737(yt)-.15 G .237
-(ime in the forseeable future.)-2.737 F(Ho)5.237 E(we)-.25 E -.15(ve)
--.25 G 1.037 -.4(r, t).15 H(he).4 E(y)-.15 E(might be persuaded to con)
-87 244.2 Q -.15(ve)-.4 G(rt to a ne).15 E(wer v)-.25 E(ersion of)-.15 E
-F2(sendmail)2.5 E F1(.)A .841(All of these con)112 260.4 R .841
-(vinced the author to w)-.4 F .841(ork on a updated v)-.1 F .841
-(ersion of)-.15 F F2(sendmail)3.342 E F1 .842(for public distrib)3.342 F
-(u-)-.2 E(tion.)87 272.4 Q 1.024(The ne)112 288.6 R 3.524(wv)-.25 G
-1.023(ersion of)-3.674 F F2(sendmail)3.523 E F1 1.023
-(is referred to as v)3.523 F 1.023(ersion eight \(V8\).)-.15 F -1.11(Ve)
-6.023 G 1.023(rsions six and se)1.11 F -.15(ve)-.25 G 3.523(nw).15 G
-(ere)-3.523 E 1.281
-(skipped because of an agreement that all \214les in 4.4BSD w)87 300.6 R
-1.281(ould be numbered as \2318.1\232.)-.1 F 1.282(Rather than)6.282 F
-(ha)87 312.6 Q 2.05 -.15(ve a)-.2 H 4.25(ne).15 G 1.75(xternal v)-4.4 F
-1.75(ersion number that dif)-.15 F 1.75(fered from the \214le v)-.25 F
-1.75(ersion numbers,)-.15 F F2(sendmail)4.25 E F1 1.75(just jumped)4.25
-F(directly to V8.)87 324.6 Q F0 2.5(2. CHANGES)72 348.6 R
-(IN VERSION EIGHT)2.5 E F1 .138(The follo)112 364.8 R .139
-(wing is a summary of the changes between the last commonly a)-.25 F
--.25(va)-.2 G .139(ilable v).25 F .139(ersion of send-)-.15 F
-(mail from Berk)87 376.8 Q(ele)-.1 E 2.5(y\()-.15 G
-(5.67\) and the latest v)-2.5 E(ersion \(8.6.6\).)-.15 E(Man)112 393 Q
-2.5(yo)-.15 G 2.5(ft)-2.5 G(hese are ideas that had been tried in ID)
--2.5 E(A, b)-.4 E(ut man)-.2 E 2.5(yo)-.15 G 2.5(ft)-2.5 G
-(hem were generalized in V8.)-2.5 E F0 2.5(2.1. P)87 417 R(erf)-.2 E
-(ormance Enhancements)-.25 E F1 .549
-(Instead of closing SMTP connections immediately)127 433.2 R 3.049(,o)
--.65 G .549(pen connections are cached for possible)-3.049 F .029
-(future use.)102 445.2 R .029(There is a limit to the number of simultaneous open connections and the idle time of an)
-5.029 F(y)-.15 E(indi)102 457.2 Q(vidual connection.)-.25 E 1.219(This is of best help during queue processing \(since there is the potential of man)
-127 473.4 R 3.719(yd)-.15 G(if)-3.719 E(ferent)-.25 E 1.113(messages going to one site\), although it can also help when processing MX records which aren')
-102 485.4 R(t)-.18 E(handled by MX Piggybacking.)102 497.4 Q 1.258
-(If tw)127 513.6 R 3.757(oh)-.1 G 1.257(osts with dif)-3.757 F 1.257
-(ferent names in a single message happen to ha)-.25 F 1.557 -.15(ve t)
--.2 H 1.257(he same set of MX).15 F .94(hosts, the)102 525.6 R 3.44(yc)
--.15 G .94(an be sent in the same transaction.)-3.44 F -1.11(Ve)5.94 G
-.94(rsion 8 notices this and tries to batch the mes-)1.11 F(sages.)102
-537.6 Q -.15(Fo)127 553.8 S 3.638(re).15 G 1.138(xample, if tw)-3.788 F
-3.637(os)-.1 G 1.137(ites `)-3.637 F(`foo.com')-.74 E 3.637('a)-.74 G
-1.137(nd `)-3.637 F(`bar)-.74 E(.com')-.55 E 3.637('a)-.74 G 1.137
-(re both serv)-3.637 F 1.137(ed by UUNET)-.15 F 3.637(,t)-.74 G(he)
--3.637 E 3.637(yw)-.15 G(ill)-3.637 E(ha)102 565.8 Q .557 -.15(ve t)-.2
-H .257(he same set of MX hosts and will be sent in one transaction.).15
-F .258(UUNET will then split the mes-)5.258 F
-(sage and send it to the tw)102 577.8 Q 2.5(oi)-.1 G(ndi)-2.5 E
-(vidual hosts.)-.25 E F0 2.5(2.2. RFC)87 601.8 R(1123 Changes)2.5 E F1
-2.607(An)127 618 S .107(umber of changes ha)-2.607 F .407 -.15(ve b)-.2
-H .106(een made to mak).15 F 2.606(es)-.1 G .106(endmail `)-2.606 F .106
-(`conditionally compliant')-.74 F 2.606('\()-.74 G .106(that is, it)
--2.606 F(satis\214es all of the MUST clauses and most b)102 630 Q
-(ut not all of the SHOULD clauses in RFC 1123\).)-.2 E(The major areas of change are \(numbers are RFC 1123 section numbers\):)
-127 646.2 Q 26.5(\2475.2.7 Response)102 662.4 R .565
-(to RCPT command is f)3.065 F 3.065(ast. Pre)-.1 F(viously)-.25 E 3.065
-(,s)-.65 G .565(endmail e)-3.065 F .565(xpanded all aliases as f)-.15 F
-(ar)-.1 E .686(as it could \212 this could tak)156 674.4 R 3.186(eav)-.1
-G .685(ery long time, particularly if there were name serv)-3.336 F(er)
--.15 E 3.891(delays. V)156 686.4 R 1.391(ersion 8 only checks for the e)
--1.11 F 1.392(xistence of an alias and does the e)-.15 F(xpansion)-.15 E
-(later)156 698.4 Q 5.176(.I)-.55 G 2.676(td)-5.176 G .176
-(oes still do a DNS lookup if there is an e)-2.676 F .175
-(xplicit host name in the RCPT com-)-.15 F(mand, b)156 710.4 Q
-(ut this time is bounded.)-.2 E EP
-%%Page: 3 3
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(Changes in Sendmail V)72 60 Q(ersion 8)-1 E(3)
-294.65 E/F1 10/Times-Roman@0 SF 26.5(\2475.2.8 Numeric)102 96 R .612
-(IP addresses are logged in Recei)3.112 F -.15(ve)-.25 G .613(d: lines.)
-.15 F .613(This helps tracing spoofed mes-)5.613 F(sages.)156 108 Q 21.5
-(\2475.2.17 Self)102 124.2 R .127(domain literal is properly handled.)
-2.627 F(Pre)5.126 E(viously)-.25 E 2.626(,i)-.65 G 2.626(fs)-2.626 G
-.126(omeone sent to user@[1.2.3.4],)-2.626 F .12
-(where 1.2.3.4 is your IP address, the mail w)156 136.2 R .12
-(ould probably be rejected with a `)-.1 F(`con\214gu-)-.74 E
-(ration error')156 148.2 Q 2.5('. V)-.74 F
-(ersion 8 can handle these addresses.)-1.11 E 26.5(\2475.3.2 Better)102
-164.4 R 1.189(control o)3.69 F -.15(ve)-.15 G 3.689(ri).15 G(ndi)-3.689
-E 1.189(vidual timeouts.)-.25 F 1.189(RFC 821 speci\214ed no timeouts.)
-6.189 F 1.189(Older v)6.189 F(er)-.15 E(-)-.2 E .002
-(sions of sendmail had a single timeout, typically set to tw)156 176.4 R
-2.502(oh)-.1 G 2.502(ours. V)-2.502 F .002(ersion 8 allo)-1.11 F .002
-(ws the)-.25 F(con\214guration \214le to set timeouts for v)156 188.4 Q
-(arious SMTP commands indi)-.25 E(vidually)-.25 E(.)-.65 E 26.5
-(\2475.3.3 Error)102 204.6 R 1.06(messages are sent as From:<>.)3.56 F
-1.059(This w)6.059 F 1.059(as ur)-.1 F 1.059
-(ged by RFC 821 and reiterated by)-.18 F .237(RFC 1123, b)156 216.6 R
-.237(ut older v)-.2 F .237(ersions of sendmail ne)-.15 F -.15(ve)-.25 G
-2.737(rr).15 G .237(eally did it properly)-2.737 F 5.237(.V)-.65 G .238
-(ersion 8 does.)-6.347 F(Ho)156 228.6 Q(we)-.25 E -.15(ve)-.25 G 1.934
--.4(r, s).15 H 1.134(ome systems cannot handle this perfectly le).4 F
--.05(ga)-.15 G 3.633(la).05 G 1.133(ddress; if necessary)-3.633 F 3.633
-(,y)-.65 G(ou)-3.633 E
-(can create a special mailer that uses the `g' \215ag to disable this.)
-156 240.6 Q 26.5(\2475.3.3 Error)102 256.8 R 3.212(messages are ne)5.712
-F -.15(ve)-.25 G 5.712(rs).15 G 3.212(ent to <>.)-5.712 F(Pre)8.213 E
-(viously)-.25 E 5.713(,s)-.65 G 3.213(endmail w)-5.713 F 3.213(as happ)
--.1 F 5.713(yt)-.1 G 5.713(os)-5.713 G(end)-5.713 E 6(responses-to-responses which sometimes resulted in responses-to-responses-to-)
-156 268.8 R(responses which resulted in ....)156 280.8 Q
-(you get the idea.)5 E 26.5(\2475.3.3 Route-addrs)102 297 R .111
-(\(the ugly `)2.611 F(`<@hosta,@hostb:user@hostc>')-.74 E 2.611('s)-.74
-G .111(yntax\) are pruned.)-2.611 F .112(RFC 821)5.112 F(ur)156 309 Q
-1.001(ged the use of this bletcherous syntax.)-.18 F 1
-(RFC 1123 has seen the light and of)6.001 F(\214cially)-.25 E 1.124
-(deprecates them, further ur)156 321 R 1.125
-(ging that you eliminate all b)-.18 F 1.125(ut `)-.2 F(`user@hostc')-.74
-E 3.625('s)-.74 G 1.125(hould you)-3.625 F(recei)156 333 Q 1.698 -.15
-(ve o)-.25 H 1.398(ne of these things.).15 F -1.11(Ve)6.398 G 1.398
-(rsion 8 is slightly more generous than the standards)1.11 F .753
-(suggest; instead of stripping of)156 345 R 3.253(fa)-.25 G .753
-(ll the route addressees, it only strips hosts of)-3.253 F 3.254(fu)-.25
-G 3.254(pt)-3.254 G(o)-3.254 E 1.29(the one before the last one kno)156
-357 R 1.289(wn to DNS, thus allo)-.25 F 1.289(wing you to ha)-.25 F
-1.589 -.15(ve p)-.2 H(seudo-hosts).15 E(such as foo.BITNET)156 369 Q 5
-(.T)-.74 G(he `R' option will turn this of)-5 E(f.)-.25 E
-(The areas in which sendmail is not `)102 385.2 Q
-(`unconditionally compliant')-.74 E 2.5('a)-.74 G(re:)-2.5 E 26.5
-(\2475.2.6 Sendmail)102 401.4 R(does do header munging.)2.5 E 21.5
-(\2475.2.10 Sendmail)102 417.6 R(doesn')3.2 E 3.2(ta)-.18 G -.1(lwa)-3.2
-G .7(ys use the e).1 F .701(xact SMTP message te)-.15 F .701
-(xt from RFC 821.)-.15 F .701(This is a)5.701 F
-(rather silly requirement.)156 429.6 Q 19(\2475.3.1.1 Sendmail)102 445.8
-R(doesn')3.512 E 3.512(tg)-.18 G 1.012
-(uarantee only one connect for each host on queue runs.)-3.512 F
-(Connec-)6.011 E(tion caching gi)156 457.8 Q -.15(ve)-.25 G 2.5(sy).15 G
-(ou most of this, b)-2.5 E(ut it does not pro)-.2 E(vide a guarantee.)
--.15 E 19(\2475.3.1.1 Sendmail)102 474 R(doesn')2.843 E 2.843(ta)-.18 G
--.1(lwa)-2.843 G .343(ys pro).1 F .343
-(vide an adequate limit on concurrenc)-.15 F 4.144 -.65(y. T)-.15 H .344
-(hat is, there can).65 F .757(be se)156 486 R -.15(ve)-.25 G .757
-(ral independent sendmails running at once.).15 F .757
-(My feeling is that doing an abso-)5.757 F 1.047(lute limit w)156 498 R
-1.047(ould be a mistak)-.1 F 3.547(e\()-.1 G 1.048
-(it might result in lost mail\).)-3.547 F(Ho)6.048 E(we)-.25 E -.15(ve)
--.25 G 1.848 -.4(r, i).15 H 3.548(fy).4 G 1.048(ou use the)-3.548 F .801
-(XLA contrib)156 510 R .801(uted softw)-.2 F .801
-(are, most of this will be guaranteed \(b)-.1 F .801(ut I don')-.2 F 3.3
-(tg)-.18 G .8(uarantee the)-3.3 F(guarantee\).)156 522 Q F0 2.5
-(2.3. Extended)87 546 R(SMTP Support)2.5 E F1 -1.11(Ve)127 562.2 S .154
-(rsion 8 includes both sending and recei)1.11 F .155
-(ving support for Extended SMTP support as de\214ned)-.25 F .229(by RFC 1425 \(basic\) and RFC 1427 \(SIZE\); and limited support for RFC 1426 \(BOD)
-102 574.2 R 2.729(Y\). The)-.55 F(body)2.729 E .275(support is minimal because the \2318BITMIME\232 body type is not currently adv)
-102 586.2 R 2.776(ertised. Although)-.15 F(such)2.776 E 3.076(ab)102
-598.2 S .576(ody type will be accepted, it will not be correctly con)
--3.076 F -.15(ve)-.4 G .576(rted to 7 bits if speaking to a non-8-bit-)
-.15 F(MIME a)102 610.2 Q -.1(wa)-.15 G(re SMTP serv).1 E(er)-.15 E(.)
--.55 E/F2 10/Times-Italic@0 SF(Sendmail)127 626.4 Q F1 .287
-(tries to speak ESMTP if you ha)2.787 F .588 -.15(ve t)-.2 H .288
-(he `a' \215ag set in the \215ags for the mailer descrip-).15 F(tor)102
-638.4 Q 3.322(,o)-.4 G 3.322(ri)-3.322 G 3.322(ft)-3.322 G .822
-(he other end adv)-3.322 F .822(ertises the f)-.15 F .822
-(act that it speaks ESMTP)-.1 F 5.822(.T)-1.11 G .821
-(his is a non-standard adv)-5.822 F(ertise-)-.15 E(ment:)102 650.4 Q F2
-(sendmail)2.98 E F1 .48(announces \231ESMTP spok)2.98 F .48
-(en here\232 during the initial connection message, and client)-.1 F
-.587(sendmails search for this message.)102 662.4 R .586
-(This creates some problems for some PC-based mailers, which)5.586 F
-(do not understand tw)102 674.4 Q
-(o-line greeting messages as required by RFC 821.)-.1 E EP
-%%Page: 4 4
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF 294.65(4C)72 60 S(hanges in Sendmail V)-294.65 E
-(ersion 8)-1 E 2.5(2.4. Eight-Bit)87 96 R(Clean)2.5 E/F1 10
-/Times-Roman@0 SF(Pre)127 112.2 Q 1.263(vious v)-.25 F 1.263
-(ersions of sendmail used the 0200 bit for quoting.)-.15 F 1.264(This v)
-6.264 F 1.264(ersion a)-.15 F -.2(vo)-.2 G 1.264(ids that use.).2 F(Ho)
-102 124.2 Q(we)-.25 E -.15(ve)-.25 G 1.119 -.4(r, y).15 H .318
-(ou can set option `7' to get se).4 F -.15(ve)-.25 G 2.818(nb).15 G .318
-(it stripping for compatibility with RFC 821, which is)-2.818 F 2.5(a7)
-102 136.2 S(-bit protocol.)-2.5 E(This option says `)5 E
-(`strip to 7 bits on input')-.74 E('.)-.74 E(Indi)127 152.4 Q .375
-(vidual mailers can still produce se)-.25 F -.15(ve)-.25 G 2.875(nb).15
-G .376(it out put using the `7' mailer \215ag.)-2.875 F .376
-(This \215ag says)5.376 F -.74(``)102 164.4 S
-(strip to 7 bits on output').74 E('.)-.74 E F0 2.5(2.5. User)87 188.4 R
-(Database)2.5 E F1 1.926(The User Database \(UDB\) is an as-yet e)127
-204.6 R 1.926(xperimental attempt to pro)-.15 F 1.925
-(vide uni\214ed lar)-.15 F(ge-site)-.18 E .396(name support.)102 216.6 R
-1.996 -.8(We a)5.396 H .396(re installing it at Berk).8 F(ele)-.1 E .396
-(y; future v)-.15 F .396(ersions may sho)-.15 F 2.897(ws)-.25 G .397
-(igni\214cant modi\214cations.)-2.897 F(Brie\215y)102 228.6 Q 3.583(,U)
--.65 G 1.083
-(DB contains a database that is intended to contain all the per)-3.583 F
-1.082(-user information for your)-.2 F -.1(wo)102 240.6 S .172
-(rkgroup, such as people').1 F 2.673(sf)-.55 G .173(ull names, their .plan information, their outgoing mail name, and their)
--2.673 F(mail drop.)102 252.6 Q .438(The user database allo)127 268.8 R
-.438(ws you to map both incoming and outgoing addresses, much lik)-.25 F
-2.937(eI)-.1 G -.4(DA)-2.937 G(.).4 E(Ho)102 280.8 Q(we)-.25 E -.15(ve)
--.25 G 1.799 -.4(r, t).15 H .999(he interf).4 F .999
-(ace is still better with ID)-.1 F .999(A; in particular)-.4 F 3.499(,t)
--.4 G 1(he alias \214le with incoming/outgoing)-3.499 F(marks pro)102
-292.8 Q(vides better locality of information.)-.15 E F0 2.5(2.6. Impr)87
-316.8 R -.1(ove)-.18 G 2.5(dB).1 G(IND Support)-2.5 E F1 .262
-(The BIND support, particularly for MX records, had a number of anno)127
-333 R .261(ying `)-.1 F(`features')-.74 E 2.761('w)-.74 G(hich)-2.761 E
-(ha)102 345 Q 1.212 -.15(ve b)-.2 H .912(een remo).15 F -.15(ve)-.15 G
-3.412(di).15 G 3.412(nt)-3.412 G .912(his release.)-3.412 F .912
-(In particular)5.912 F 3.412(,t)-.4 G .912
-(hese more tightly bind \(pun intended\) the name)-3.412 F(serv)102 357
-Q(er to sendmail, so that the name serv)-.15 E
-(er resolution rules are incorporated directly into sendmail.)-.15 E
-.688(The major change has been that the $[ ... $] operator didn')127
-373.2 R 3.188(tf)-.18 G .688(ully qualify names that were in)-3.188 F
-(DNS as A or MX records.)102 385.2 Q -1.11(Ve)5 G
-(rsion 8 does this quali\214cation.)1.11 E .429(This has pro)127 401.4 R
--.15(ve)-.15 G 2.929(nt).15 G 2.929(ob)-2.929 G 2.929(ea)-2.929 G 2.929
-(na)-2.929 G(nno)-2.929 E .43
-(yance in Sun shops, who often still run without BIND support.)-.1 F(Ho)
-102 413.4 Q(we)-.25 E -.15(ve)-.25 G 1.001 -.4(r, i).15 H 2.701(ti).4 G
-2.701(sr)-2.701 G .201
-(eally critical that this be supported, since MX records are mandatory)
--2.701 F 5.2(.I)-.65 G 2.7(nS)-5.2 G .2(unOS you)-2.7 F .101
-(can choose either MX support or NIS support, b)102 425.4 R .101
-(ut not both.)-.2 F .101(This is \214x)5.101 F .101
-(ed in Solaris, and some)-.15 F/F2 10/Times-Italic@0 SF(send-)2.602 E
-(mail)102 437.4 Q F1(support to allo)2.5 E 2.5(wt)-.25 G
-(his in SunOS should be forthcoming in a future release.)-2.5 E F0 2.5
-(2.7. K)87 461.4 R(ey)-.25 E(ed Files)-.1 E F1 .242(Generalized k)127
-477.6 R -.15(ey)-.1 G .242(ed \214les is an idea tak).15 F .241
-(en directly from ID)-.1 F 2.741(As)-.4 G .241
-(endmail \(albeit with a completely)-2.741 F(dif)102 489.6 Q
-(ferent implementation\).)-.25 E(The)5 E 2.5(yc)-.15 G
-(an be useful on lar)-2.5 E(ge sites.)-.18 E -1.11(Ve)127 505.8 S
-(rsion 8 includes the follo)1.11 E(wing b)-.25 E(uilt-in map classes:)
--.2 E 33.72(dbm Support)102 522 R(for the ndbm\(3\) library)2.5 E(.)-.65
-E 33.17(hash Support)102 538.2 R 1.229(for the `)3.729 F(`Hash')-.74 E
-3.729('t)-.74 G 1.229(ype from the ne)-3.729 F 3.729(wB)-.25 G(erk)
--3.729 E(ele)-.1 E 3.729(yd)-.15 G 1.229(b\(3\) library)-3.729 F 6.23
-(.t)-.65 G 1.23(his library pro-)-6.23 F 4.094(vides substantially better database support than ndbm\(3\), including in-memory)
-156 550.2 R(caching, arbitrarily long k)156 562.2 Q -.15(ey)-.1 G 2.5
-(sa).15 G(nd v)-2.5 E(alues, and better disk utilization.)-.25 E 31.51
-(btree Support)102 578.4 R .547(for the `)3.047 F(`B-T)-.74 E(ree')-.35
-E 3.047('t)-.74 G .547(ype from the ne)-3.047 F 3.048(wB)-.25 G(erk)
--3.048 E(ele)-.1 E 3.048(yd)-.15 G .548(b\(3\) library)-3.048 F 5.548
-(.B)-.65 G(-T)-5.548 E .548(rees pro)-.35 F(vide)-.15 E .521(better clustering than Hashed \214les if you are fetching lots of records that ha)
-156 590.4 R .821 -.15(ve s)-.2 H(imilar).15 E -.1(ke)156 602.4 S
-(ys, such as searching a dictionary for w)-.05 E(ords be)-.1 E
-(ginning with `)-.15 E(`detr')-.74 E('.)-.74 E 39.83(nis Support)102
-618.6 R(for NIS \(a.k.a. YP\) maps.)2.5 E
-(NIS+ is not supported in this v)5 E(ersion.)-.15 E 34.83(host Support)
-102 634.8 R(for DNS lookups.)2.5 E 19.84(dequote A)102 651 R -.74(``)
-2.642 G(pseudo-map').74 E 2.642('\()-.74 G .142
-(that is, once that does not ha)-2.642 F .442 -.15(ve a)-.2 H .442 -.15
-(ny ex).15 H .142(ternal data\) that allo).15 F .142(ws a con-)-.25 F
-.099(\214guration \214le to break apart a quoted string in the address.)
-156 663 R .098(This is necessary primarily)5.098 F .726
-(for DECnet addresses, which often ha)156 675 R 1.026 -.15(ve q)-.2 H
-.726(uoted addresses that need to be unwrapped).15 F(on g)156 687 Q(ate)
--.05 E -.1(wa)-.25 G(ys.).1 E EP
-%%Page: 5 5
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(Changes in Sendmail V)72 60 Q(ersion 8)-1 E(5)
-294.65 E 2.5(2.8. Multi-W)87 96 R(ord Classes & Macr)-.75 E
-(os in Classes)-.18 E/F1 10/Times-Roman@0 SF(Classes can no)127 112.2 Q
-2.5(wb)-.25 G 2.5(em)-2.5 G(ultiple w)-2.5 E 2.5(ords. F)-.1 F(or e)-.15
-E(xample,)-.15 E(CShofmann.CS.Berk)142 128.4 Q(ele)-.1 E -.65(y.)-.15 G
-(EDU).65 E(allo)102 144.6 Q 2.395(ws you to match the entire string `)
--.25 F(`hofmann.CS.Berk)-.74 E(ele)-.1 E -.65(y.)-.15 G(EDU').65 E 4.894
-('u)-.74 G 2.394(sing the single construct)-4.894 F -.74(``)102 156.6 S
-($=S').74 E('.)-.74 E(Class de\214nitions are no)127 172.8 Q 2.5(wa)-.25
-G(llo)-2.5 E(wed to include macros \212 for e)-.25 E(xample:)-.15 E
-(Cw$k)142 189 Q(is le)102 205.2 Q -.05(ga)-.15 G(l.).05 E F0 2.5
-(2.9. IDENT)87 229.2 R(Pr)2.5 E(otocol Support)-.18 E F1 .633
-(The IDENT protocol as de\214ned in RFC 1413 [RFC1413] is supported.)127
-245.4 R(Ho)5.633 E(we)-.25 E -.15(ve)-.25 G 1.433 -.4(r, m).15 H(an).4 E
-3.134(ys)-.15 G(ys-)-3.134 E .909(tems ha)102 257.4 R 1.209 -.15(ve a T)
--.2 H .909(CP/IP b).15 F .908
-(ug that renders this useless, and the feature must be turned of)-.2 F
-3.408(f. Roughly)-.25 F 3.408(,i)-.65 G(f)-3.408 E 8.538
-(one of these system recei)102 269.4 R -.15(ve)-.25 G 11.038(sa\231).15
-G 8.539(No route to host\232 message \(ICMP message)-11.038 F
-(ICMP_UNREA)102 281.4 Q .829(CH_HOST\) on)-.4 F/F2 10/Times-Italic@0 SF
-(any)3.329 E F1 .828
-(connection, all connections to that host are closed.)3.329 F .828
-(Some \214re-)5.828 F -.1(wa)102 293.4 S .087(lls return this error if you try to connect to the IDENT port, so you can')
-.1 F 2.587(tr)-.18 G(ecei)-2.587 E .387 -.15(ve e)-.25 H .087
-(mail from these).15 F 1.712(hosts on these systems.)102 305.4 R(It')
-6.712 E 4.212(sp)-.55 G 1.712(ossible that if the \214re)-4.212 F -.1
-(wa)-.25 G 1.712(ll used a more speci\214c message \(such as).1 F
-(ICMP_UNREA)102 317.4 Q(CH_PR)-.4 E -1.88 -.4(OT O)-.4 H 4.316
-(COL, ICMP_UNREA).4 F(CH_POR)-.4 E 6.817(To)-.6 G 6.817(rI)-6.817 G
-(CMP_UNREA)-6.817 E(CH_NET_PR)-.4 E(O-)-.4 E(HIB\) it w)102 329.4 Q
-(ould w)-.1 E(ork, b)-.1 E(ut this hasn')-.2 E 2.5(tb)-.18 G(een v)-2.5
-E(eri\214ed.)-.15 E .678(IDENT protocol support cannot be used on 4.3BSD, Apollo DomainOS, Apple A/UX, Con-)
-127 345.6 R -.15(vex)102 357.6 S .949
-(OS, Data General DG/UX, HP-UX, Sequent Dynix, or Ultrix 4.x, x).15 F/F3
-10/Symbol SF<a3>3.449 E F1 3.449(3. It)3.449 F .949(seems to w)3.449 F
-.949(ork on)-.1 F
-(4.4BSD, IBM AIX 3.x, OSF/1, SGI IRIX, Solaris, SunOS, and Ultrix 4.4.)
-102 369.6 Q F0 2.5(2.10. Separate)87 393.6 R(En)2.5 E -.1(ve)-.4 G
-(lope/Header Pr).1 E(ocessing)-.18 E F1 .854
-(Since the From: line is passed in separately from the en)127 409.8 R
--.15(ve)-.4 G .854(lope sender).15 F 3.354(,t)-.4 G .854(hese ha)-3.354
-F 1.154 -.15(ve b)-.2 H .854(oth been).15 F .427
-(made visible; the $g macro is set to the en)102 421.8 R -.15(ve)-.4 G
-.428(lope sender during processing of mailer ar).15 F .428(gument v)-.18
-F(ec-)-.15 E(tors and the header sender during processing of headers.)
-102 433.8 Q .085(It is also possible to specify separate per)127 450 R
-.085(-mailer en)-.2 F -.15(ve)-.4 G .084(lope and header processing.).15
-F .084(The Sender)5.084 F(-)-.2 E -.55(RW)102 462 S 1.085
-(Set and RecipientR).55 F 1.085(Wset ar)-.55 F 1.085
-(guments for mailers can be speci\214ed as `)-.18 F(`en)-.74 E -.15(ve)
--.4 G(lope/header').15 E 3.585('t)-.74 G 3.585(og)-3.585 G -2.15 -.25
-(iv e)-3.585 H(dif)102 474 Q(ferent re)-.25 E(writings for en)-.25 E
--.15(ve)-.4 G(lope v).15 E(ersus header addresses.)-.15 E F0 2.5
-(2.11. Owner)87 498 R(-List Pr)-.37 E(opagates to En)-.18 E -.1(ve)-.4 G
-(lope).1 E F1 1.168(When an alias has an associated o)127 514.2 R(wner)
--.25 E 1.168(-list name, that alias is used to change the en)-.2 F -.15
-(ve)-.4 G(lope).15 E(sender address.)102 526.2 Q(This will cause do)5 E
-(wnstream errors to be returned to that o)-.25 E(wner)-.25 E(.)-.55 E
-1.813(Some people \214nd this confusing because the en)127 542.4 R -.15
-(ve)-.4 G 1.813(lope sender is what appears in the \214rst).15 F -.74
-(``)102 554.4 S(From_').74 E 3.127('l)-.74 G .627
-(ine in UNIX messages \(that is, the line be)-3.127 F .627(ginning `)
--.15 F(`From<space>')-.74 E 3.127('i)-.74 G .627(nstead of `)-3.127 F
-(`From:')-.74 E(';)-.74 E .502(the latter is the header from, which)102
-566.4 R F2(does)3.002 E F1 .503(indicate the sender of the message\).)
-3.002 F .503(In pre)5.503 F .503(vious v)-.25 F(ersions,)-.15 E F2
-(sendmail)102 578.4 Q F1 .057(has tried to a)2.557 F -.2(vo)-.2 G .057
-(id changing the en).2 F -.15(ve)-.4 G .056
-(lope sender for back compatibility with UNIX con).15 F -.15(ve)-.4 G
-(n-).15 E .177
-(tion; at this point that back compatibility is creating too man)102
-590.4 R 2.678(yp)-.15 G .178(roblems, and it is necessary to mo)-2.678 F
--.15(ve)-.15 G(forw)102 602.4 Q(ard into the 1980s.)-.1 E F0 2.5
-(2.12. Command)87 626.4 R(Line Flags)2.5 E F1(The)127 642.6 Q F0<ad42>
-2.5 E F1(\215ag has been added to pass in body type information.)2.5 E
-(The)127 658.8 Q F0<ad70>3.057 E F1 .557
-(\215ag has been added to pass in protocol information that w)3.057 F
-.557(as pre)-.1 F .556(viously passed in by)-.25 F(de\214ning the)102
-670.8 Q F0($r)2.5 E F1(and)2.5 E F0($s)2.5 E F1(macros.)2.5 E(The)127
-687 Q F0<ad58>2.6 E F1 .1(\215ag has been added to allo)2.6 F 2.6(wl)
--.25 G .1(ogging of all protocol in and out of sendmail for deb)-2.6 F
-(ug-)-.2 E 2.732(ging. Y)102 699 R .232(ou can set \231\255X \214lename\232 and a complete transcript will be logged in that \214le.)
--1.1 F .231(This gets big)5.231 F -.1(fa)102 711 S
-(st: the option is only for deb).1 E(ugging.)-.2 E EP
-%%Page: 6 6
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF 294.65(6C)72 60 S(hanges in Sendmail V)-294.65 E
-(ersion 8)-1 E/F1 10/Times-Roman@0 SF(The)127 96 Q F0<ad71>4.006 E F1
-1.507(\215ag can limit limit a queue run to speci\214c recipients, senders, or queue ids using)
-4.006 F(\255qRsubstring, \255qSsubstring, or \255qIsubstring respecti)
-102 108 Q -.15(ve)-.25 G(ly).15 E(.)-.65 E F0 2.5(2.13. New)87 132 R
-(Con\214guration Line T)2.5 E(ypes)-.74 E F1 .674(The `T' \(T)127 148.2
-R .674(rusted users\) con\214guration line has been deleted.)-.35 F .674
-(It will still be accepted b)5.674 F .674(ut will)-.2 F(be ignored.)102
-160.2 Q(The `K' line has been added to declare database maps.)127 176.4
-Q(The `V' line has been added to declare the con\214guration v)127 192.6
-Q(ersion le)-.15 E -.15(ve)-.25 G(l.).15 E(The `M' \(mailer\) line tak)
-127 208.8 Q(es a D= \214eld to specify e)-.1 E -.15(xe)-.15 G
-(cution directory).15 E(.)-.65 E F0 2.5(2.14. New)87 232.8 R
-(and Extended Options)2.5 E F1(Se)127 249 Q -.15(ve)-.25 G .9(ral ne).15
-F 3.4(wo)-.25 G .9(ptions ha)-3.4 F 1.2 -.15(ve b)-.2 H .9
-(een added, man).15 F 3.4(yt)-.15 G 3.4(os)-3.4 G .9(upport ne)-3.4 F
-3.4(wf)-.25 G .9(eatures, others to allo)-3.4 F 3.4(wt)-.25 G(uning)-3.4
-E(that w)102 261 Q(as pre)-.1 E(viously a)-.25 E -.25(va)-.2 G
-(ilable only by recompiling.).25 E(Brie\215y:)5 E 28.78(AT)102 277.2 S
-.099(he alias \214le speci\214cation can no)-28.78 F 2.599(wb)-.25 G
-2.599(eal)-2.599 G .099(ist of alias \214les.)-2.599 F .098
-(Also, the con\214guration can spec-)5.099 F(ify a class of \214le.)138
-289.2 Q -.15(Fo)5 G 2.5(re).15 G
-(xample, to search the NIS aliases, use \231O)-2.65 E
-(Anis:mail.aliases\232.)-.35 E 31(bI)102 305.4 S
-(nsist on a minimum number of disk blocks.)-31 E 29.33(CD)102 321.6 S
-(eli)-29.33 E -.15(ve)-.25 G .24(ry checkpoint interv).15 F 2.74
-(al. Checkpoint)-.25 F .24(the queue \(to a)2.74 F -.2(vo)-.2 G .24
-(id duplicate deli).2 F -.15(ve)-.25 G .24(ries\) e).15 F -.15(ve)-.25 G
-.24(ry C).15 F(addresses.)138 333.6 Q 29.89(ED)102 349.8 S(ef)-29.89 E
-.712(ault error message.)-.1 F .711
-(This message \(or the contents of the indicated \214le\) are prepended)
-5.712 F(to error messages.)138 361.8 Q 28.78(GE)102 378 S .785
-(nable GECOS matching.)-28.78 F .785(If you can')5.785 F 3.285<748c>-.18
-G .786(nd a local user name and this option is enabled,)-3.285 F .59
-(do a sequential scan of the passwd \214le to match ag)138 390 R .589
-(ainst full names.)-.05 F(Pre)5.589 E .589(viously a compile)-.25 F
-(option.)138 402 Q 31(hM)102 418.2 S(aximum hop count.)-31 E(Pre)5 E
-(viously this w)-.25 E(as compiled in.)-.1 E 32.67(IT)102 434.4 S
-(his option has been e)-32.67 E(xtended to allo)-.15 E 2.5(ws)-.25 G
-(etting of resolv)-2.5 E(er parameters.)-.15 E 33.22(jS)102 450.6 S
-(end errors in MIME-encapsulated format.)-33.22 E 32.11(JF)102 466.8 S
-(orw)-32.26 E(ard \214le path.)-.1 E(Where to search for .forw)5 E
-(ard \214les \212 def)-.1 E(aults to $HOME/.forw)-.1 E(ard.)-.1 E 31(kC)
-102 483 S .05(onnection cache size.)-31 F .05
-(The total number of connections that will be k)5.05 F .05
-(ept open at an)-.1 F 2.55(yt)-.15 G(ime.)-2.55 E 28.78(KC)102 499.2 S
-1.395(onnection cache lifetime.)-28.78 F 1.395(The amount of time an)
-6.395 F 3.895(yc)-.15 G 1.394(onnection will be permitted to sit)-3.895
-F(idle.)138 511.2 Q 33.22(lE)102 527.4 S .333(nable Errors-T)-33.22 F
-.333(o: header)-.8 F 5.334(.T)-.55 G .334
-(hese headers violate RFC 1123; this option is included to pro-)-5.334 F
-(vide back compatibility with old v)138 539.4 Q(ersions of sendmail.)
--.15 E 28.78(OI)102 555.6 S
-(ncoming daemon options \(e.g., use alternate SMTP port\).)-28.78 E 31
-(pP)102 571.8 S(ri)-31 E -.25(va)-.25 G .3 -.15(cy o).25 H 2.5
-(ptions. These).15 F(can be used to mak)2.5 E 2.5(ey)-.1 G
-(our SMTP serv)-2.5 E(er less friendly)-.15 E(.)-.65 E 32.67(rT)102 588
-S .67(his option has been e)-32.67 F .67(xtended to allo)-.15 F 3.17
-<778c>-.25 G .67(ner grained control o)-3.17 F -.15(ve)-.15 G 3.17(rt)
-.15 G 3.17(imeouts. F)-3.17 F .67(or e)-.15 F(xample,)-.15 E
-(you can set the timeout for SMTP commands indi)138 600 Q(vidually)-.25
-E(.)-.65 E 29.33(RD)102 616.2 S(on')-29.33 E 11.797(tp)-.18 G 9.297
-(rune route-addrs.)-11.797 F(Normally)14.297 E 11.797(,i)-.65 G 11.797
-(fv)-11.797 G 9.297(ersion 8 sees an address lik)-11.947 F(e)-.1 E 1.256
-("<@hostA,@hostB:user@hostC>, sendmail will try to strip of)138 628.2 R
-3.755(fa)-.25 G 3.755(sm)-3.755 G 1.255(uch as it can \(up to)-3.755 F
-(user@hostC\) as suggested by RFC 1123.)138 640.2 Q
-(This option disables that beha)5 E(viour)-.2 E(.)-.55 E 29.89(TT)102
-656.4 S 1.485(he \231Return T)-29.89 F 3.985(oS)-.8 G 1.485
-(ender\232 timeout has been e)-3.985 F 1.485(xtended to allo)-.15 F
-3.986(ws)-.25 G 1.486(peci\214cation of a w)-3.986 F(arning)-.1 E .789
-(message interv)138 668.4 R .789
-(al, typically something on the order of four hours.)-.25 F .788
-(If a message cannot be)5.788 F(deli)138 680.4 Q -.15(ve)-.25 G 1.245
-(red in that interv).15 F 1.245(al, a w)-.25 F 1.245
-(arning message is sent back to the sender b)-.1 F 1.246(ut the message)
--.2 F(continues to be tried.)138 692.4 Q 28.78(UU)102 708.6 S
-(ser database spec.)-28.78 E(This is still e)5 E(xperimental.)-.15 E EP
-%%Page: 7 7
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(Changes in Sendmail V)72 60 Q(ersion 8)-1 E(7)
-294.65 E/F1 10/Times-Roman@0 SF 28.78(VF)102 96 S .758(allback `)-28.93
-F(`MX')-.74 E 3.258('h)-.74 G 3.258(ost. This)-3.258 F .757
-(can be thought of as an MX host that applies to all addresses)3.258 F
-(that has a v)138 108 Q(ery high preference v)-.15 E
-(alue \(that is, use it only if e)-.25 E -.15(ve)-.25 G(rything else f)
-.15 E(ails\).)-.1 E 28.78(wI)102 124.2 S 3.066(fs)-28.78 G .566(et, assume that if you are the best MX host for a host, you should send directly to that)
--3.066 F 3.213(host. This)138 136.2 R .713
-(is intended for compatibility with UIUC sendmail, and may ha)3.213 F
-1.013 -.15(ve s)-.2 H .712(ome use on).15 F(\214re)138 148.2 Q -.1(wa)
--.25 G(lls.).1 E 31(7D)102 164.4 S 2.758(on)-31 G .258
-(ot run eight bit clean.)-2.758 F -.7(Te)5.258 G(chnically).7 E 2.758
-(,y)-.65 G .258(ou ha)-2.758 F .558 -.15(ve t)-.2 H 2.758(oa).15 G .259
-(ssert this option to be RFC 821 com-)-2.758 F(patible.)138 176.4 Q F0
-2.5(2.15. New)87 200.4 R(Mailer De\214nitions)2.5 E F1 21.75(L= Set)102
-216.6 R .93(the allo)3.43 F -.1(wa)-.25 G .93(ble line length.).1 F .93
-(In V5, the L mailer \215ag implied a line length limit of 990)5.93 F
-(characters; this is no)138 228.6 Q 2.5(ws)-.25 G
-(ettable to an arbitrary v)-2.5 E(alue.)-.25 E 17.86(F=a T)102 244.8 R
-(ry to use ESMTP)-.35 E 5(.I)-1.11 G 2.5(tw)-5 G(ill f)-2.5 E
-(all back to SMTP if the initial EHLO pack)-.1 E(et is rejected.)-.1 E
-17.3(F=b Ensure)102 261 R 2.5(ab)2.5 G
-(lank line at the end of messages.)-2.5 E(Useful on the *\214le* mailer)
-5 E(.)-.55 E 17.86(F=c Strip)102 277.2 R .68(all comments from addresses; this should only be used as a last resort when dealing)
-3.18 F(with crank)138 289.2 Q 2.5(ym)-.15 G(ailers.)-2.5 E 17.3(F=g Ne)
-102 305.4 R -.15(ve)-.25 G 2.88(ru).15 G .38
-(se the null sender as the en)-2.88 F -.15(ve)-.4 G .379(lope sender).15
-F 2.879(,e)-.4 G -.15(ve)-3.129 G 2.879(nw).15 G .379(hen running SMTP)
--2.879 F 5.379(.T)-1.11 G .379(his violates)-5.379 F(RFC 1123.)138 317.4
-Q 17.3(F=7 Strip)102 333.6 R(all output to this mailer to 7 bits.)2.5 E
-16.19(F=L Used)102 349.8 R .198
-(to set the line limit to 990 bytes for SMTP compatibility)2.697 F 5.198
-(.I)-.65 G 2.698(tn)-5.198 G .698 -.25(ow d)-2.698 H .198
-(oes that only if the).25 F(L= k)138 361.8 Q -.15(ey)-.1 G
-(letter is not speci\214ed.).15 E
-(This \215ag is obsolete and should not be used.)5 E F0 2.5(2.16. New)87
-385.8 R(or Changed Pr)2.5 E(e-De\214ned Macr)-.18 E(os)-.18 E F1 23.5
-($k UUCP)102 402 R(node name from uname\(2\).)2.5 E 20.72($m Domain)102
-418.2 R(part of our full hostname.)2.5 E 23.5($_ RFC)102 434.4 R
-(1413-pro)2.5 E(vided sender address.)-.15 E 21.28($w Pre)102 450.6 R
-.148(viously w)-.25 F .148
-(as sometimes the full domain name, sometimes just the \214rst w)-.1 F
-2.647(ord. No)-.1 F 2.647(wg)-.25 G(uar)-2.647 E(-)-.2 E
-(anteed to be the \214rst w)138 462.6 Q
-(ord of the domain name \(i.e., the host name\).)-.1 E 25.72($j Pre)102
-478.8 R .193(viously had to be de\214ned \212 it is no)-.25 F 2.693(wp)
--.25 G .194(rede\214ned to be the full domain name, if that can)-2.693 F
-(be determined.)138 490.8 Q(That is, it is equi)5 E -.25(va)-.25 G
-(lent to $w).25 E(.$m.)-.65 E F0 2.5(2.17. New)87 514.8 R
-(and Changed Classes)2.5 E F1 17.86($=k Initialized)102 531 R
-(to contain $k.)2.5 E 15.64($=w No)102 547.2 R 3.069(wi)-.25 G .569
-(ncludes \231[1.2.3.4]\232 \(where 1.2.3.4 is your IP address\) to allo)
--3.069 F 3.068(wt)-.25 G .568(he con\214guration \214le)-3.068 F
-(to recognize your o)138 559.2 Q(wn IP address.)-.25 E F0 2.5(2.18. New)
-87 583.2 R(Rewriting T)2.5 E(ok)-.92 E(ens)-.1 E F1(The)127 599.4 Q F0
-($&)3.25 E F1 .75(construct has been adopted from ID)3.25 F 3.25(At)-.4
-G 3.25(od)-3.25 G .75(efer macro e)-3.25 F -.25(va)-.25 G 3.25
-(luation. Normally).25 F 3.25(,m)-.65 G(acros)-3.25 E .476
-(in rulesets are bound when the rule is \214rst parsed during startup.)
-102 611.4 R .476(Some macros change during pro-)5.476 F .046
-(cessing and are uninteresting during startup.)102 623.4 R(Ho)5.046 E
-(we)-.25 E -.15(ve)-.25 G .846 -.4(r, t).15 H .047
-(hat macro can be referenced using \231$&x\232 to).4 F(defer the e)102
-635.4 Q -.25(va)-.25 G(ulation of $x until the rule is processed.).25 E
-(The tok)127 651.6 Q(ens)-.1 E F0($\()2.5 E F1(and)2.5 E F0($\))2.5 E F1
-(ha)2.5 E .3 -.15(ve b)-.2 H(een added to allo).15 E 2.5(ws)-.25 G
-(peci\214cation of map re)-2.5 E(writing.)-.25 E -1.11(Ve)127 667.8 S
-1.499(rsion 8 allo)1.11 F(ws)-.25 E F0($@)3.999 E F1 1.499
-(on the Left Hand Side of an `R' line to match zero tok)3.999 F 3.998
-(ens. This)-.1 F(is)3.998 E
-(intended to be used to match the null input.)102 679.8 Q EP
-%%Page: 8 8
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF 294.65(8C)72 60 S(hanges in Sendmail V)-294.65 E
-(ersion 8)-1 E 2.5(2.19. Bigger)87 96 R(Defaults)2.5 E/F1 10
-/Times-Roman@0 SF -1.11(Ve)127 112.2 S 1.283(rsion 8 allo)1.11 F 1.284
-(ws up to 100 rulesets instead of 30.)-.25 F 1.284
-(It is recommended that rulesets 0\2559 be)6.284 F(reserv)102 124.2 Q
-(ed for sendmail')-.15 E 2.5(sd)-.55 G(edicated use in future releases.)
--2.5 E
-(The total number of MX records that can be used has been raised to 20.)
-127 140.4 Q .335(The number of queued messages that can be handled at one time has been raised from 600 to)
-127 156.6 R(1000.)102 168.6 Q F0 2.5(2.20. Differ)87 192.6 R
-(ent Default T)-.18 E(uning P)-.92 E(arameters)-.1 E F1 -1.11(Ve)127
-208.8 S .8(rsion 8 has changed the def)1.11 F .8
-(ault parameters for tuning queue costs to mak)-.1 F 3.3(et)-.1 G .8
-(he number of)-3.3 F .712(recipients more important than the size of the message \(for small messages\).)
-102 220.8 R .712(This is reasonable if)5.712 F
-(you are connected with reasonably f)102 232.8 Q(ast links.)-.1 E F0 2.5
-(2.21. A)87 256.8 R(uto-Quoting in Addr)-.5 E(esses)-.18 E F1(Pre)127
-273 Q(viously)-.25 E 3.2(,t)-.65 G .701(he `)-3.2 F .701
-(`Full Name <email address>')-.74 F 3.201('s)-.74 G .701(yntax w)-3.201
-F .701(ould generate incorrect protocol out-)-.1 F .006(put if `)102 285
-R .006(`Full Name')-.74 F 2.506('h)-.74 G .006
-(ad special characters such as dot.)-2.506 F .005(This v)5.006 F .005
-(ersion puts quotes around such names.)-.15 F F0 2.5(2.22. Symbolic)87
-309 R(Names On Err)2.5 E(or Mailer)-.18 E F1(Se)127 325.2 Q -.15(ve)-.25
-G(ral names ha).15 E .3 -.15(ve b)-.2 H(een b).15 E
-(uilt in to the $@ portion of the $#error mailer)-.2 E 5(.F)-.55 G(or e)
--5.15 E(xample:)-.15 E($#error $@NOHOST $: Host unkno)142 341.4 Q(wn)
--.25 E(Prints the indicated message and sets the e)102 357.6 Q
-(xit status of)-.15 E/F2 10/Times-Italic@0 SF(sendmail)2.5 E F1(to)2.5 E
-/F3 9/Times-Roman@0 SF(EX_NOHOST)2.5 E F1(.)A F0 2.5(2.23. New)87 381.6
-R(Built-In Mailers)2.5 E F1 -1 -.8(Tw o)127 397.8 T(ne)3.901 E 3.101(wm)
--.25 G .601(ailers, *\214le* and *include*, are included to de\214ne options when mailing to a \214le)
--3.101 F(or a :include: \214le respecti)102 409.8 Q -.15(ve)-.25 G(ly)
-.15 E 5(.P)-.65 G(re)-5 E(viously these were o)-.25 E -.15(ve)-.15 G
-(rloaded on the local mailer).15 E(.)-.55 E F0 2.5(2.24. SMTP)87 433.8 R
-(VRFY Doesn't Expand)2.5 E F1(Pre)127 450 Q 1.438(vious v)-.25 F 1.438
-(ersions of sendmail treated VRFY and EXPN the same.)-.15 F 1.437
-(In this v)6.437 F 1.437(ersion, VRFY)-.15 F(doesn')102 462 Q 2.5(te)
--.18 G(xpand aliases or follo)-2.65 E 2.5(w.)-.25 G(forw)-2.5 E
-(ard \214les.)-.1 E .663(As an optimization, if you run with your def)
-127 478.2 R .664(ault deli)-.1 F -.15(ve)-.25 G .664
-(ry mode being queue-only).15 F 3.164(,t)-.65 G .664(he RCPT)-3.164 F
-1.09(command will also not chase aliases and .forw)102 490.2 R 1.09
-(ard \214les.)-.1 F 1.09(It will chase them when it processes the)6.09 F
-2.5(queue. This)102 502.2 R(speeds up RCPT processing.)2.5 E F0 2.5
-(2.25. [IPC])87 526.2 R(Mailers Allo)2.5 E 2.5(wM)-.1 G(ultiple Hosts)
--2.5 E F1 .099(When an address resolv)127 542.4 R .099
-(es to a mailer that has `)-.15 F(`[IPC]')-.74 E 2.599('a)-.74 G 2.6(si)
--2.599 G .1(ts `)-2.6 F(`P)-.74 E(ath')-.15 E .1
-(', the $@ part \(host name\))-.74 F .138
-(can be a colon-separated list of hosts instead of a single hostname.)
-102 554.4 R .137(This asks sendmail to search the)5.137 F .16
-(list for the \214rst entry that is a)102 566.4 R -.25(va)-.2 G .16
-(ilable e).25 F .161(xactly as though it were an MX record.)-.15 F .161
-(The intent is to route)5.161 F .738(internal traf)102 578.4 R .738
-(\214c through internal netw)-.25 F .738
-(orks without publishing an MX record to the net.)-.1 F .737(MX e)5.737
-F(xpan-)-.15 E(sion is still done on the indi)102 590.4 Q(vidual items.)
--.25 E F0 2.5(2.26. Aliases)87 614.4 R(Extended)2.5 E F1 .298
-(The implementation has been mer)127 630.6 R .298(ged with maps.)-.18 F
-.299(Among other things, this supports multiple)5.298 F
-(alias \214les and NIS-based aliases.)102 642.6 Q -.15(Fo)5 G 2.5(re).15
-G(xample:)-2.65 E -.35(OA)142 658.8 S(/etc/aliases,nis:mail.aliases).35
-E(will search \214rst the local database \231/etc/aliases\232 follo)102
-675 Q(wed by the NIS map)-.25 E EP
-%%Page: 9 9
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(Changes in Sendmail V)72 60 Q(ersion 8)-1 E(9)
-294.65 E 2.5(2.27. P)87 96 R(ortability and Security Enhancements)-.2 E
-/F1 10/Times-Roman@0 SF 2.5(An)127 112.2 S(umber of internal changes ha)
--2.5 E .3 -.15(ve b)-.2 H(een made to enhance portability).15 E(.)-.65 E
-(Se)127 128.4 Q -.15(ve)-.25 G(ral \214x).15 E(es ha)-.15 E .3 -.15
-(ve b)-.2 H(een made to increase the paranoia f).15 E(actor)-.1 E(.)-.55
-E .46(In particular)127 144.6 R 2.96(,t)-.4 G .46
-(he permissions required for .forw)-2.96 F .46
-(ard and :include: \214les ha)-.1 F .76 -.15(ve b)-.2 H .46
-(een tightened up).15 F(considerably)102 156.6 Q 5.182(.V)-.65 G 2.683
-(5w)-5.182 G .183(ould pretty much read an)-2.783 F 2.683<798c>-.15 G
-.183(le it could get to as root, which e)-2.683 F .183
-(xposed some secu-)-.15 F 1.02(rity holes.)102 168.6 R 1.02
-(V8 insists that all directories leading up to the .forw)6.02 F 1.02
-(ard or :include: \214le be searchable)-.1 F .334
-(\("x" permission\) by the controlling user" \(de\214ned belo)102 180.6
-R .335(w\), that the \214le itself be readable by the con-)-.25 F
-(trolling user)102 192.6 Q 2.5(,a)-.4 G(nd that .forw)-2.5 E
-(ard \214les be o)-.1 E(wned by the user who is being forw)-.25 E
-(arded to or root.)-.1 E .565(The "controlling user" is the user on whose behalf the mail is being deli)
-127 208.8 R -.15(ve)-.25 G 3.065(red. F).15 F .565(or e)-.15 F(xample,)
--.15 E .459
-(if you mail to "user1" then the controlling user for ~user1/.forw)102
-220.8 R .46(ard and an)-.1 F 2.96(ym)-.15 G .46(ailers in)-2.96 F -.2
-(vo)-.4 G -.1(ke).2 G 2.96(db).1 G 2.96(yt)-2.96 G(hat)-2.96 E(.forw)102
-232.8 Q(ard \214le, including :include: \214les.)-.1 E(Pre)127 249 Q
-(viously)-.25 E 2.816(,a)-.65 G -.15(ny)-2.816 G .316
-(one who had a home directory could create a .forw).15 F .316
-(ard could forw)-.1 F .316(ard to a pro-)-.1 F 2.965(gram. No)102 261 R
-1.765 -.65(w, s)-.25 H .466(endmail checks to mak).65 F 2.966(es)-.1 G
-.466(ure that the)-2.966 F 2.966(yh)-.15 G -2.25 -.2(av e)-2.966 H .466
-(an "appro)3.166 F -.15(ve)-.15 G 2.966(ds).15 G .466
-(hell", that is, a shell listed)-2.966 F(in the /etc/shells \214le.)102
-273 Q F0 2.5(2.28. Miscellaneous)87 297 R(Fixes and Enhancements)2.5 E
-F1 4.03(An)127 313.2 S 1.53(umber of small b)-4.03 F 1.53(ugs ha)-.2 F
-1.53(ving to do with things lik)-.2 F 4.03(eb)-.1 G 1.53
-(ackslash-escaped quotes inside of)-4.03 F(comments ha)102 325.2 Q .3
--.15(ve b)-.2 H(een \214x).15 E(ed.)-.15 E 1.552(The \214x)127 341.4 R
-1.552(ed size limit on header lines \(such as \231T)-.15 F 1.553
-(o:\232 and \231Cc:\232\) has been eliminated; those)-.8 F -.2(bu)102
-353.4 S -.25(ff).2 G(ers are dynamically allocated no).25 E -.65(w.)-.25
-G .289(Sendmail writes a /etc/sendmail.pid \214le with the current process id and the current in)
-127 369.6 R -.2(vo)-.4 G(cation).2 E(\215ags.)102 381.6 Q -1 -.8(Tw o)
-127 397.8 T .218
-(people using the same program \(e.g., submit\) are considered "dif)
-3.518 F .219(ferent" so that duplicate)-.25 F .508(elimination doesn')
-102 409.8 R 3.008(td)-.18 G .508(elete one of them.)-3.008 F -.15(Fo)
-5.508 G 3.008(re).15 G .508(xample, tw)-3.158 F 3.008(op)-.1 G .508
-(eople forw)-3.008 F .508(arding their email to |submit)-.1 F
-(will be treated as tw)102 421.8 Q 2.5(or)-.1 G(ecipients.)-2.5 E .721(The mailstats program prints mailer names and gets the location of the sendmail.st \214le from)
-127 438 R(/etc/sendmail.cf.)102 450 Q(Man)127 466.2 Q 2.5(ym)-.15 G
-(inor b)-2.5 E(ugs ha)-.2 E .3 -.15(ve b)-.2 H(een \214x).15 E
-(ed, such as handling of backslashes inside of quotes.)-.15 E 2.5(Ah)127
-482.4 S(ook has been added to allo)-2.5 E 2.5(wr)-.25 G -.25(ew)-2.5 G
-(riting of local addresses after aliasing.).25 E F0 2.5(3. FUTURE)72
-506.4 R -.1(WO)2.5 G(RK).1 E F1 1.719(The pre)112 522.6 R 1.719
-(vious section describes)-.25 F/F2 10/Times-Italic@0 SF(sendmail)4.219 E
-F1 1.719(as of v)4.219 F 1.719(ersion 8.6.6.)-.15 F 1.718
-(There is still much to be done.)6.719 F
-(Some high points are described belo)87 534.6 Q 3.8 -.65(w. T)-.25 H
-(his list is by no means e).65 E(xhausti)-.15 E -.15(ve)-.25 G(.).15 E
-F0 2.5(3.1. Full)87 558.6 R(MIME Support)2.5 E F1(Currently)127 574.8 Q
-F2(sendmail)3.305 E F1 .805(only supports se)3.305 F -.15(ve)-.25 G
-3.305(nb).15 G .805(it MIME messages.)-3.305 F .806
-(Although it can pass eight bit)5.805 F .371
-(MIME messages, it cannot adv)102 586.8 R .371(ertise that f)-.15 F .37
-(act because the standards say that the mail agent must be)-.1 F .26
-(able to do 8- to 7-bit con)102 598.8 R -.15(ve)-.4 G .26(rsion to ha)
-.15 F .561 -.15(ve f)-.2 H .261(ull 8-bit support.).15 F .261
-(This requires f)5.261 F .261(ar more e)-.1 F(xtensi)-.15 E .561 -.15
-(ve m)-.25 H(odi\214-).15 E
-(cation of the message body than is currently supported.)102 610.8 Q
-.464(The best w)127 627 R .464(ay to do this w)-.1 F .463
-(ould be to support the general concept of an e)-.1 F .463(xternal `)
--.15 F .463(`message \214l-)-.74 F(ter')102 639 Q 3.319('t)-.74 G .819
-(hat could do arbitrary modi\214cations of the message.)-3.319 F .819
-(This w)5.819 F .82(ould allo)-.1 F 3.32(wM)-.25 G .82(IME con)-3.32 F
--.15(ve)-.4 G .82(rsion as).15 F .63
-(well as such things as automatic encryption of messages sent o)102 651
-R -.15(ve)-.15 G 3.129(re).15 G .629(xternal links.)-3.279 F .629
-(This is probably)5.629 F(an e)102 663 Q(xtremely non-tri)-.15 E
-(vial change.)-.25 E F0 2.5(3.2. Ser)87 687 R(vice Switch Abstraction)
--.1 E F1 .369(Most modern systems include some concept of a \231service switch\232 \212 for e)
-127 703.2 R .37(xample, to look up)-.15 F .984
-(host names you can try DNS, NIS, NIS+, te)102 715.2 R .984
-(xt tables, NetInfo, or other services in some arbitrary)-.15 F EP
-%%Page: 10 10
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF 287.15(10 Changes)72 60 R(in Sendmail V)2.5 E
-(ersion 8)-1 E/F1 10/Times-Roman@0 SF(order)102 96 Q 5.174(.T)-.55 G
-.174(his is currently v)-5.174 F .174(ery clumsy in)-.15 F/F2 10
-/Times-Italic@0 SF(sendmail)2.674 E F1 2.674(,w)C .174
-(ith only limited control of the services pro)-2.674 F(vided.)-.15 E F0
-2.5(3.3. Mor)87 120 R 2.5(eC)-.18 G(ontr)-2.5 E(ol of Local Addr)-.18 E
-(esses)-.18 E F1 .943(Currently some addresses are declared as \231local\232 and are handled specially \212 for e)
-127 136.2 R(xample,)-.15 E(the)102 148.2 Q 3.455(ym)-.15 G .955(ay ha)
--3.455 F 1.255 -.15(ve .)-.2 H(forw).15 E .956
-(ard \214les, may be translated into program calls or \214le deli)-.1 F
--.15(ve)-.25 G .956(ries, and so forth.).15 F .311(These should be brok)
-102 160.2 R .311(en out into separate \215ags to allo)-.1 F 2.811(wt)
--.25 G .31(he local system administrator to ha)-2.811 F .61 -.15(ve m)
--.2 H(ore).15 E(\214ne-grained control o)102 172.2 Q -.15(ve)-.15 G 2.5
-(ro).15 G(perations.)-2.5 E F0 2.5(3.4. Mor)87 196.2 R 2.5(eR)-.18 G
-(un-T)-2.5 E(ime Con\214guration Options)-.18 E F1 .016(There are man)
-127 212.4 R 2.516(yo)-.15 G .016(ptions that are con\214gured at compile time, such as the method of \214le locking)
--2.516 F .719(and the use of the IDENT protocol [RFC1413].)102 224.4 R
-.719(These should be transfered to run time by adding)5.719 F(ne)102
-236.4 Q 2.5(wo)-.25 G(ptions.)-2.5 E(Similarly)127 252.6 Q 3.413(,s)-.65
-G .913(ome options are currently o)-3.413 F -.15(ve)-.15 G .913
-(rloaded, that is, a single option controls more than).15 F(one thing.)
-102 264.6 Q(These should probably be brok)5 E
-(en out into separate options.)-.1 E
-(This implies that options will change from single characters to w)127
-280.8 Q(ords.)-.1 E F0 2.5(3.5. Mor)87 304.8 R 2.5(eC)-.18 G
-(on\214guration Contr)-2.5 E(ol Ov)-.18 E(er Err)-.1 E(ors)-.18 E F1
-(Currently)127 321 Q 3.649(,t)-.65 G 1.148(he con\214guration \214le can generate an error message during parsing.)
--3.649 F(Ho)6.148 E(we)-.25 E -.15(ve)-.25 G 1.948 -.4(r, i).15 H(t).4 E
-.569(cannot tweak other operations, such as issuing a w)102 333 R .57
-(arning message to the system postmaster)-.1 F 5.57(.S)-.55 G(imi-)-5.57
-E(larly)102 345 Q 2.558(,s)-.65 G .057
-(ome errors should not be triggered if the)-2.558 F 2.557(ya)-.15 G .057
-(re in aliases during an alias \214le reb)-2.557 F .057(uild, b)-.2 F
-.057(ut should)-.2 F(be triggered if that alias is actually used.)102
-357 Q F0 2.5(3.6. Long)87 381 R -.92(Te)2.5 G(rm Host State).92 E F1
-(Currently)127 397.2 Q(,)-.65 E F2(sendmail)3.731 E F1 1.231
-(only remembers host status during a single queue run.)3.731 F 1.232
-(This should be)6.232 F(con)102 409.2 Q -.15(ve)-.4 G .492(rted to long term status stored on disk so it can be shared between instantiations of)
-.15 F F2(sendmail)2.991 E F1(.)A .866(Entries will ha)102 421.2 R 1.167
--.15(ve t)-.2 H 3.367(ob).15 G 3.367(et)-3.367 G .867(imestamped so the)
--3.367 F 3.367(yc)-.15 G .867(an time out.)-3.367 F .867(This will allo)
-5.867 F(w)-.25 E F2(sendmail)3.367 E F1 .867(to implement)3.367 F -.15
-(ex)102 433.2 S(ponential back).15 E(of)-.1 E 2.5(fo)-.25 G 2.5(nq)-2.5
-G(ueue runs on a per)-2.5 E(-host basis.)-.2 E F0 2.5(3.7. Connection)87
-457.2 R(Contr)2.5 E(ol)-.18 E F1 .819(Modern netw)127 473.4 R .819
-(orks ha)-.1 F 1.119 -.15(ve d)-.2 H(if).15 E .819
-(ferent types of connecti)-.25 F .818(vity than the past.)-.25 F .818
-(In particular)5.818 F 3.318(,t)-.4 G .818(he rising)-3.318 F .636(prominence of dialup IP has created certain challenges for automated serv)
-102 485.4 R 3.136(ers. It)-.15 F .636(is not uncommon)3.136 F .732
-(to try to mak)102 497.4 R 3.232(eac)-.1 G .732
-(onnection to a host and ha)-3.232 F 1.032 -.15(ve i)-.2 H 3.232(tf).15
-G .732(ail, e)-3.332 F -.15(ve)-.25 G 3.232(nt).15 G .732
-(hough if you tried ag)-3.232 F .732(ain it w)-.05 F .731(ould suc-)-.1
-F 2.5(ceed. The)102 509.4 R(connection management could be a bit cle)2.5
-E -.15(ve)-.25 G(rer to try to adapt to such situations.).15 E F0 2.5
-(3.8. Other)87 533.4 R(Caching)2.5 E F1 .074
-(When you do an MX record lookup, the name serv)127 549.6 R .075
-(er automatically returns the IP addresses of)-.15 F .518
-(the associated MX serv)102 561.6 R 3.018(ers. This)-.15 F .518
-(information is currently ignored, and another query is done to get)
-3.018 F(this information.)102 573.6 Q(It should be cached to a)5 E -.2
-(vo)-.2 G(id e).2 E(xcess name serv)-.15 E(er traf)-.15 E(\214c.)-.25 E
-F0 2.5(4. REFERENCES)72 597.6 R F1([Allman83a])87 613.8 Q .137
-(\231Sendmail \212 An Internetw)123 625.8 R .137(ork Mail Router)-.1 F
-4.037 -.7(.\232 E)-.55 H 2.638(.A).7 G 2.638(llman. In)-2.638 F F2 .138
-(Unix Pr)2.638 F -.1(og)-.45 G -.15(ra).1 G(mmer).15 E(s')-.1 E 2.638
-(sM)-.4 G(anual,)-2.638 E F1(4.2)2.638 E(Berk)123 637.8 Q(ele)-.1 E 2.5
-(yS)-.15 G(oftw)-2.5 E(are Distrib)-.1 E(ution, v)-.2 E(olume 2C.)-.2 E
-(August 1983.)5 E([Allman83b])87 654 Q .384
-(\231Mail Systems and Addressing in 4.2BSD.)123 666 R 5.384<9a45>-.7 G
-2.884(.A)-5.384 G .383(llman In)-2.884 F F2 .383(UNICOM Confer)2.883 F
-.383(ence Pr)-.37 F(oceedings.)-.45 E F1(San Die)123 678 Q
-(go, California.)-.15 E(January 1983.)5 E([Allman&Amos85])87 694.2 Q
--.74(``)123 706.2 S 1.145(Sendmail Re).74 F(visited.)-.25 E 5.125 -.74
-('' E)-.7 H 3.645(.A).74 G 1.145(llman and M. Amos.)-3.645 F(In)6.145 E
-F2 1.145(Usenix Summer 1985 Confer)3.645 F 1.145(ence Pr)-.37 F(o-)-.45
-E(ceedings.)123 718.2 Q F1(Portland, Ore)5 E 2.5(gon. June)-.15 F(1985.)
-2.5 E EP
-%%Page: 11 11
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(Changes in Sendmail V)72 60 Q(ersion 8)-1 E(11)
-289.65 E/F1 10/Times-Roman@0 SF([ID)87 96 Q(A87])-.4 E/F2 10
-/Times-Italic@0 SF(Electr)1.97 E .983(onic Mail Addr)-.45 F .983
-(essing in Theory and Pr)-.37 F .982(actice with the ID)-.15 F 3.482(AS)
--.35 G .982(endmail Enhancement Kit)-3.482 F .563(\(or The P)123 108 R
-(ostmaster')-.8 E 3.063(sL)-.4 G .563(ast W)-3.063 F .564(ill and T)-.55
-F(estament\).)-.92 E F1 .564(Lennart Lo)5.564 F -.5(..)-5 -6 O 3.064
-(vstrand. Department)1 6 N .564(of Computer)3.064 F 1.267
-(and Information Science, Uni)123 120 R -.15(ve)-.25 G 1.267
-(rsity of Link).15 F(o)-.1 E -.5(..)-5 -6 O 1.266
-(ping, Sweden, Report no. LiTH-ID)1 6 N(A-Ex-8715.)-.4 E(May 1987.)123
-132 Q([RFC821])87 148.2 Q F2(Simple Mail T)123 160.2 Q -.15(ra)-.55 G
-(nsport Pr).15 E(otocol.)-.45 E F1(J. Postel.)5 E(August 1982.)5 E
-([RFC1123])87 176.4 Q F2(Requir)123 188.4 Q .163
-(ements for Internet Hosts \212 Application and Support.)-.37 F F1 .164
-(Internet Engineering T)5.164 F .164(ask F)-.8 F(orce,)-.15 E
-(R. Braden, Editor)123 200.4 Q 5(.O)-.55 G(ctober 1989.)-5 E([RFC1344])
-87 216.6 Q F2(Implications of MIME for Internet Mail Gate)123 228.6 Q
-(ways.)-.15 E F1(N. Borenstein.)5 E(June 1992.)5 E([RFC1413])87 244.8 Q
-F2(Identi\214cation Pr)123 256.8 Q(otocol.)-.45 E F1(M. St. Johns.)5 E
-(February 1993.)5 E([RFC1425])87 273 Q F2 2.352
-(SMTP Service Extensions.)123 285 R F1 2.352
-(J. Klensin, N. Freed, M. Rose, E. Stef)7.352 F 2.351
-(ferud, and D. Crock)-.25 F(er)-.1 E(.)-.55 E(February 1993.)123 297 Q
-([RFC1426])87 313.2 Q F2 .12(SMTP Service Extension for 8bit-MIMEtr)123
-325.2 R(ansport.)-.15 E F1 .12(J. Klensin, N. Freed, M. Rose, E. Stef)
-5.12 F(ferud,)-.25 E(and D. Crock)123 337.2 Q(er)-.1 E 5(.F)-.55 G
-(ebruary 1993.)-5 E([RFC1427])87 353.4 Q F2 .813
-(SMTP Service Extension for Messa)123 365.4 R 1.013 -.1(ge S)-.1 H .813
-(ize Declar).1 F(ation.)-.15 E F1 .813
-(J. Klensin, N. Freed, and K. Moore.)5.813 F(February 1993.)123 377.4 Q
-([RFC1521])87 393.6 Q F2 2.033
-(MIME \(Multipurpose Internet Mail Extensions\) P)123 405.6 R 2.033
-(art One: Mec)-.8 F 2.033(hanisms for Specifying and)-.15 F .933
-(Describing the F)123 417.6 R .933(ormat of Internet Messa)-1.05 F 1.133
--.1(ge B)-.1 H(odies.).1 E F1 .932(N. Borenstein and N. Freed.)5.932 F
-(September)5.932 E(1993.)123 429.6 Q EP
-%%Trailer
-end
-%%EOF
+++ /dev/null
-# @(#)Makefile 8.2 (Berkeley) 2/28/1994
-
-DIR= smm/09.sendmail
-SRCS= intro.me
-MACROS= -me
-
-all: intro.ps
-
-intro.ps: ${SRCS}
- rm -f ${.TARGET}
- ${PIC} ${SRCS} | ${ROFF} > ${.TARGET}
-
-.include <bsd.doc.mk>
+++ /dev/null
-.\" Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-.\" Copyright (c) 1983 Eric P. Allman. All rights reserved.
-.\" Copyright (c) 1988, 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.
-.\"
-.\"
-.\" @(#)intro.me 8.7 (Berkeley) 5/19/1998
-.\"
-.\" pic -Pxx intro.me | ditroff -me -Pxx
-.eh 'SMM:9-%''SENDMAIL \*- An Internetwork Mail Router'
-.oh 'SENDMAIL \*- An Internetwork Mail Router''SMM:9-%'
-.nr si 3n
-.if n .ls 2
-.+c
-.(l C
-.sz 14
-SENDMAIL \*- An Internetwork Mail Router
-.sz
-.sp
-Eric Allman*
-.sp 0.5
-.i
-University of California, Berkeley
-Mammoth Project
-.)l
-.sp
-.(l F
-.ce
-ABSTRACT
-.sp \n(psu
-Routing mail through a heterogenous internet presents many new
-problems. Among the worst of these is that of address mapping.
-Historically, this has been handled on an
-.i "ad hoc"
-basis. However,
-this approach has become unmanageable as internets grow.
-.sp \n(psu
-Sendmail acts a unified "post office" to which all mail can be
-submitted. Address interpretation is controlled by a production
-system, which can parse both domain-based addressing and old-style
-.i "ad hoc"
-addresses.
-The production system is powerful
-enough to rewrite addresses in the message header to conform to the
-standards of a number of common target networks, including old
-(NCP/RFC733) Arpanet, new (TCP/RFC822) Arpanet, UUCP, and Phonenet.
-Sendmail also implements an SMTP server, message
-queueing, and aliasing.
-.)l
-.sp 2
-.(f
-*A considerable part of this work
-was done while under the employ
-of the INGRES Project
-at the University of California at Berkeley
-and at Britton Lee.
-.)f
-.pp
-.i Sendmail
-implements a general internetwork mail routing facility,
-featuring aliasing and forwarding,
-automatic routing to network gateways,
-and flexible configuration.
-.pp
-In a simple network,
-each node has an address,
-and resources can be identified
-with a host-resource pair;
-in particular,
-the mail system can refer to users
-using a host-username pair.
-Host names and numbers have to be administered by a central authority,
-but usernames can be assigned locally to each host.
-.pp
-In an internet,
-multiple networks with different characterstics
-and managements
-must communicate.
-In particular,
-the syntax and semantics of resource identification change.
-Certain special cases can be handled trivially
-by
-.i "ad hoc"
-techniques,
-such as
-providing network names that appear local to hosts
-on other networks,
-as with the Ethernet at Xerox PARC.
-However, the general case is extremely complex.
-For example,
-some networks require point-to-point routing,
-which simplifies the database update problem
-since only adjacent hosts must be entered
-into the system tables,
-while others use end-to-end addressing.
-Some networks use a left-associative syntax
-and others use a right-associative syntax,
-causing ambiguity in mixed addresses.
-.pp
-Internet standards seek to eliminate these problems.
-Initially, these proposed expanding the address pairs
-to address triples,
-consisting of
-{network, host, resource}
-triples.
-Network numbers must be universally agreed upon,
-and hosts can be assigned locally
-on each network.
-The user-level presentation was quickly expanded
-to address domains,
-comprised of a local resource identification
-and a hierarchical domain specification
-with a common static root.
-The domain technique
-separates the issue of physical versus logical addressing.
-For example,
-an address of the form
-.q "eric@a.cc.berkeley.arpa"
-describes only the logical
-organization of the address space.
-.pp
-.i Sendmail
-is intended to help bridge the gap
-between the totally
-.i "ad hoc"
-world
-of networks that know nothing of each other
-and the clean, tightly-coupled world
-of unique network numbers.
-It can accept old arbitrary address syntaxes,
-resolving ambiguities using heuristics
-specified by the system administrator,
-as well as domain-based addressing.
-It helps guide the conversion of message formats
-between disparate networks.
-In short,
-.i sendmail
-is designed to assist a graceful transition
-to consistent internetwork addressing schemes.
-.sp
-.pp
-Section 1 discusses the design goals for
-.i sendmail .
-Section 2 gives an overview of the basic functions of the system.
-In section 3,
-details of usage are discussed.
-Section 4 compares
-.i sendmail
-to other internet mail routers,
-and an evaluation of
-.i sendmail
-is given in section 5,
-including future plans.
-.sh 1 "DESIGN GOALS"
-.pp
-Design goals for
-.i sendmail
-include:
-.np
-Compatibility with the existing mail programs,
-including Bell version 6 mail,
-Bell version 7 mail
-[UNIX83],
-Berkeley
-.i Mail
-[Shoens79],
-BerkNet mail
-[Schmidt79],
-and hopefully UUCP mail
-[Nowitz78a, Nowitz78b].
-ARPANET mail
-[Crocker77a, Postel77]
-was also required.
-.np
-Reliability, in the sense of guaranteeing
-that every message is correctly delivered
-or at least brought to the attention of a human
-for correct disposal;
-no message should ever be completely lost.
-This goal was considered essential
-because of the emphasis on mail in our environment.
-It has turned out to be one of the hardest goals to satisfy,
-especially in the face of the many anomalous message formats
-produced by various ARPANET sites.
-For example,
-certain sites generate improperly formated addresses,
-occasionally
-causing error-message loops.
-Some hosts use blanks in names,
-causing problems with
-UNIX mail programs that assume that an address
-is one word.
-The semantics of some fields
-are interpreted slightly differently
-by different sites.
-In summary,
-the obscure features of the ARPANET mail protocol
-really
-.i are
-used and
-are difficult to support,
-but must be supported.
-.np
-Existing software to do actual delivery
-should be used whenever possible.
-This goal derives as much from political and practical considerations
-as technical.
-.np
-Easy expansion to
-fairly complex environments,
-including multiple
-connections to a single network type
-(such as with multiple UUCP or Ether nets
-[Metcalfe76]).
-This goal requires consideration of the contents of an address
-as well as its syntax
-in order to determine which gateway to use.
-For example,
-the ARPANET is bringing up the
-TCP protocol to replace the old NCP protocol.
-No host at Berkeley runs both TCP and NCP,
-so it is necessary to look at the ARPANET host name
-to determine whether to route mail to an NCP gateway
-or a TCP gateway.
-.np
-Configuration should not be compiled into the code.
-A single compiled program should be able to run as is at any site
-(barring such basic changes as the CPU type or the operating system).
-We have found this seemingly unimportant goal
-to be critical in real life.
-Besides the simple problems that occur when any program gets recompiled
-in a different environment,
-many sites like to
-.q fiddle
-with anything that they will be recompiling anyway.
-.np
-.i Sendmail
-must be able to let various groups maintain their own mailing lists,
-and let individuals specify their own forwarding,
-without modifying the system alias file.
-.np
-Each user should be able to specify which mailer to execute
-to process mail being delivered for him.
-This feature allows users who are using specialized mailers
-that use a different format to build their environment
-without changing the system,
-and facilitates specialized functions
-(such as returning an
-.q "I am on vacation"
-message).
-.np
-Network traffic should be minimized
-by batching addresses to a single host where possible,
-without assistance from the user.
-.pp
-These goals motivated the architecture illustrated in figure 1.
-.(z
-.hl
-.ie t \
-\{\
-.ie !"\*(.T"" \
-\{\
-.PS
-boxht = 0.5i
-boxwid = 1.0i
-
- down
-S: [
- right
- S1: box "sender1"
- move
- box "sender2"
- move
- S3: box "sender3"
- ]
- arrow
-SM: box "sendmail" wid 2i ht boxht
- arrow
-M: [
- right
- M1: box "mailer1"
- move
- box "mailer2"
- move
- M3: box "mailer3"
- ]
-
- arrow from S.S1.s to 1/2 between SM.nw and SM.n
- arrow from S.S3.s to 1/2 between SM.n and SM.ne
-
- arrow from 1/2 between SM.sw and SM.s to M.M1.n
- arrow from 1/2 between SM.s and SM.se to M.M3.n
-.PE
-.\}
-.el \
-. sp 18
-.\}
-.el \{\
-.(c
-+---------+ +---------+ +---------+
-| sender1 | | sender2 | | sender3 |
-+---------+ +---------+ +---------+
- | | |
- +----------+ + +----------+
- | | |
- v v v
- +-------------+
- | sendmail |
- +-------------+
- | | |
- +----------+ + +----------+
- | | |
- v v v
-+---------+ +---------+ +---------+
-| mailer1 | | mailer2 | | mailer3 |
-+---------+ +---------+ +---------+
-.)c
-.\}
-
-.ce
-Figure 1 \*- Sendmail System Structure.
-.hl
-.)z
-The user interacts with a mail generating and sending program.
-When the mail is created,
-the generator calls
-.i sendmail ,
-which routes the message to the correct mailer(s).
-Since some of the senders may be network servers
-and some of the mailers may be network clients,
-.i sendmail
-may be used as an internet mail gateway.
-.sh 1 "OVERVIEW"
-.sh 2 "System Organization"
-.pp
-.i Sendmail
-neither interfaces with the user
-nor does actual mail delivery.
-Rather,
-it collects a message
-generated by a user interface program (UIP)
-such as Berkeley
-.i Mail ,
-MS
-[Crocker77b],
-or MH
-[Borden79],
-edits the message as required by the destination network,
-and calls appropriate mailers
-to do mail delivery or queueing for network transmission\**.
-.(f
-\**except when mailing to a file,
-when
-.i sendmail
-does the delivery directly.
-.)f
-This discipline allows the insertion of new mailers
-at minimum cost.
-In this sense
-.i sendmail
-resembles the Message Processing Module (MPM)
-of [Postel79b].
-.sh 2 "Interfaces to the Outside World"
-.pp
-There are three ways
-.i sendmail
-can communicate with the outside world,
-both in receiving and in sending mail.
-These are using the conventional UNIX
-argument vector/return status,
-speaking SMTP over a pair of UNIX pipes,
-and speaking SMTP over an interprocess(or) channel.
-.sh 3 "Argument vector/exit status"
-.pp
-This technique is the standard UNIX method
-for communicating with the process.
-A list of recipients is sent in the argument vector,
-and the message body is sent on the standard input.
-Anything that the mailer prints
-is simply collected and sent back to the sender
-if there were any problems.
-The exit status from the mailer is collected
-after the message is sent,
-and a diagnostic is printed if appropriate.
-.sh 3 "SMTP over pipes"
-.pp
-The SMTP protocol
-[Postel82]
-can be used to run an interactive lock-step interface
-with the mailer.
-A subprocess is still created,
-but no recipient addresses are passed to the mailer
-via the argument list.
-Instead, they are passed one at a time
-in commands sent to the processes standard input.
-Anything appearing on the standard output
-must be a reply code
-in a special format.
-.sh 3 "SMTP over an IPC connection"
-.pp
-This technique is similar to the previous technique,
-except that it uses a 4.2bsd IPC channel
-[UNIX83].
-This method is exceptionally flexible
-in that the mailer need not reside
-on the same machine.
-It is normally used to connect to a sendmail process
-on another machine.
-.sh 2 "Operational Description"
-.pp
-When a sender wants to send a message,
-it issues a request to
-.i sendmail
-using one of the three methods described above.
-.i Sendmail
-operates in two distinct phases.
-In the first phase,
-it collects and stores the message.
-In the second phase,
-message delivery occurs.
-If there were errors during processing
-during the second phase,
-.i sendmail
-creates and returns a new message describing the error
-and/or returns an status code
-telling what went wrong.
-.sh 3 "Argument processing and address parsing"
-.pp
-If
-.i sendmail
-is called using one of the two subprocess techniques,
-the arguments
-are first scanned
-and option specifications are processed.
-Recipient addresses are then collected,
-either from the command line
-or from the SMTP
-RCPT command,
-and a list of recipients is created.
-Aliases are expanded at this step,
-including mailing lists.
-As much validation as possible of the addresses
-is done at this step:
-syntax is checked, and local addresses are verified,
-but detailed checking of host names and addresses
-is deferred until delivery.
-Forwarding is also performed
-as the local addresses are verified.
-.pp
-.i Sendmail
-appends each address
-to the recipient list after parsing.
-When a name is aliased or forwarded,
-the old name is retained in the list,
-and a flag is set that tells the delivery phase
-to ignore this recipient.
-This list is kept free from duplicates,
-preventing alias loops
-and duplicate messages deliverd to the same recipient,
-as might occur if a person is in two groups.
-.sh 3 "Message collection"
-.pp
-.i Sendmail
-then collects the message.
-The message should have a header at the beginning.
-No formatting requirements are imposed on the message
-except that they must be lines of text
-(i.e., binary data is not allowed).
-The header is parsed and stored in memory,
-and the body of the message is saved
-in a temporary file.
-.pp
-To simplify the program interface,
-the message is collected even if no addresses were valid.
-The message will be returned with an error.
-.sh 3 "Message delivery"
-.pp
-For each unique mailer and host in the recipient list,
-.i sendmail
-calls the appropriate mailer.
-Each mailer invocation sends to all users receiving the message on one host.
-Mailers that only accept one recipient at a time
-are handled properly.
-.pp
-The message is sent to the mailer
-using one of the same three interfaces
-used to submit a message to sendmail.
-Each copy of the message is
-prepended by a customized header.
-The mailer status code is caught and checked,
-and a suitable error message given as appropriate.
-The exit code must conform to a system standard
-or a generic message
-(\c
-.q "Service unavailable" )
-is given.
-.sh 3 "Queueing for retransmission"
-.pp
-If the mailer returned an status that
-indicated that it might be able to handle the mail later,
-.i sendmail
-will queue the mail and try again later.
-.sh 3 "Return to sender"
-.pp
-If errors occur during processing,
-.i sendmail
-returns the message to the sender for retransmission.
-The letter can be mailed back
-or written in the file
-.q dead.letter
-in the sender's home directory\**.
-.(f
-\**Obviously, if the site giving the error is not the originating
-site, the only reasonable option is to mail back to the sender.
-Also, there are many more error disposition options,
-but they only effect the error message \*- the
-.q "return to sender"
-function is always handled in one of these two ways.
-.)f
-.sh 2 "Message Header Editing"
-.pp
-Certain editing of the message header
-occurs automatically.
-Header lines can be inserted
-under control of the configuration file.
-Some lines can be merged;
-for example,
-a
-.q From:
-line and a
-.q Full-name:
-line can be merged under certain circumstances.
-.sh 2 "Configuration File"
-.pp
-Almost all configuration information is read at runtime
-from an ASCII file,
-encoding
-macro definitions
-(defining the value of macros used internally),
-header declarations
-(telling sendmail the format of header lines that it will process specially,
-i.e., lines that it will add or reformat),
-mailer definitions
-(giving information such as the location and characteristics
-of each mailer),
-and address rewriting rules
-(a limited production system to rewrite addresses
-which is used to parse and rewrite the addresses).
-.pp
-To improve performance when reading the configuration file,
-a memory image can be provided.
-This provides a
-.q compiled
-form of the configuration file.
-.sh 1 "USAGE AND IMPLEMENTATION"
-.sh 2 "Arguments"
-.pp
-Arguments may be flags and addresses.
-Flags set various processing options.
-Following flag arguments,
-address arguments may be given,
-unless we are running in SMTP mode.
-Addresses follow the syntax in RFC822
-[Crocker82]
-for ARPANET
-address formats.
-In brief, the format is:
-.np
-Anything in parentheses is thrown away
-(as a comment).
-.np
-Anything in angle brackets (\c
-.q "<\|>" )
-is preferred
-over anything else.
-This rule implements the ARPANET standard that addresses of the form
-.(b
-user name <machine-address>
-.)b
-will send to the electronic
-.q machine-address
-rather than the human
-.q "user name."
-.np
-Double quotes
-(\ "\ )
-quote phrases;
-backslashes quote characters.
-Backslashes are more powerful
-in that they will cause otherwise equivalent phrases
-to compare differently \*- for example,
-.i user
-and
-.i
-"user"
-.r
-are equivalent,
-but
-.i \euser
-is different from either of them.
-.pp
-Parentheses, angle brackets, and double quotes
-must be properly balanced and nested.
-The rewriting rules control remaining parsing\**.
-.(f
-\**Disclaimer: Some special processing is done
-after rewriting local names; see below.
-.)f
-.sh 2 "Mail to Files and Programs"
-.pp
-Files and programs are legitimate message recipients.
-Files provide archival storage of messages,
-useful for project administration and history.
-Programs are useful as recipients in a variety of situations,
-for example,
-to maintain a public repository of systems messages
-(such as the Berkeley
-.i msgs
-program,
-or the MARS system
-[Sattley78]).
-.pp
-Any address passing through the initial parsing algorithm
-as a local address
-(i.e, not appearing to be a valid address for another mailer)
-is scanned for two special cases.
-If prefixed by a vertical bar (\c
-.q \^|\^ )
-the rest of the address is processed as a shell command.
-If the user name begins with a slash mark (\c
-.q /\^ )
-the name is used as a file name,
-instead of a login name.
-.pp
-Files that have setuid or setgid bits set
-but no execute bits set
-have those bits honored if
-.i sendmail
-is running as root.
-.sh 2 "Aliasing, Forwarding, Inclusion"
-.pp
-.i Sendmail
-reroutes mail three ways.
-Aliasing applies system wide.
-Forwarding allows each user to reroute incoming mail
-destined for that account.
-Inclusion directs
-.i sendmail
-to read a file for a list of addresses,
-and is normally used
-in conjunction with aliasing.
-.sh 3 "Aliasing"
-.pp
-Aliasing maps names to address lists using a system-wide file.
-This file is indexed to speed access.
-Only names that parse as local
-are allowed as aliases;
-this guarantees a unique key
-(since there are no nicknames for the local host).
-.sh 3 "Forwarding"
-.pp
-After aliasing,
-recipients that are local and valid
-are checked for the existence of a
-.q .forward
-file in their home directory.
-If it exists,
-the message is
-.i not
-sent to that user,
-but rather to the list of users in that file.
-Often
-this list will contain only one address,
-and the feature will be used for network mail forwarding.
-.pp
-Forwarding also permits a user to specify a private incoming mailer.
-For example,
-forwarding to:
-.(b
-"\^|\|/usr/local/newmail myname"
-.)b
-will use a different incoming mailer.
-.sh 3 "Inclusion"
-.pp
-Inclusion is specified in RFC 733 [Crocker77a] syntax:
-.(b
-:Include: pathname
-.)b
-An address of this form reads the file specified by
-.i pathname
-and sends to all users listed in that file.
-.pp
-The intent is
-.i not
-to support direct use of this feature,
-but rather to use this as a subset of aliasing.
-For example,
-an alias of the form:
-.(b
-project: :include:/usr/project/userlist
-.)b
-is a method of letting a project maintain a mailing list
-without interaction with the system administration,
-even if the alias file is protected.
-.pp
-It is not necessary to rebuild the index on the alias database
-when a :include: list is changed.
-.sh 2 "Message Collection"
-.pp
-Once all recipient addresses are parsed and verified,
-the message is collected.
-The message comes in two parts:
-a message header and a message body,
-separated by a blank line.
-.pp
-The header is formatted as a series of lines
-of the form
-.(b
- field-name: field-value
-.)b
-Field-value can be split across lines by starting the following
-lines with a space or a tab.
-Some header fields have special internal meaning,
-and have appropriate special processing.
-Other headers are simply passed through.
-Some header fields may be added automatically,
-such as time stamps.
-.pp
-The body is a series of text lines.
-It is completely uninterpreted and untouched,
-except that lines beginning with a dot
-have the dot doubled
-when transmitted over an SMTP channel.
-This extra dot is stripped by the receiver.
-.sh 2 "Message Delivery"
-.pp
-The send queue is ordered by receiving host
-before transmission
-to implement message batching.
-Each address is marked as it is sent
-so rescanning the list is safe.
-An argument list is built as the scan proceeds.
-Mail to files is detected during the scan of the send list.
-The interface to the mailer
-is performed using one of the techniques
-described in section 2.2.
-.pp
-After a connection is established,
-.i sendmail
-makes the per-mailer changes to the header
-and sends the result to the mailer.
-If any mail is rejected by the mailer,
-a flag is set to invoke the return-to-sender function
-after all delivery completes.
-.sh 2 "Queued Messages"
-.pp
-If the mailer returns a
-.q "temporary failure"
-exit status,
-the message is queued.
-A control file is used to describe the recipients to be sent to
-and various other parameters.
-This control file is formatted as a series of lines,
-each describing a sender,
-a recipient,
-the time of submission,
-or some other salient parameter of the message.
-The header of the message is stored
-in the control file,
-so that the associated data file in the queue
-is just the temporary file that was originally collected.
-.sh 2 "Configuration"
-.pp
-Configuration is controlled primarily by a configuration file
-read at startup.
-.i Sendmail
-should not need to be recomplied except
-.np
-To change operating systems
-(V6, V7/32V, 4BSD).
-.np
-To remove or insert the DBM
-(UNIX database)
-library.
-.np
-To change ARPANET reply codes.
-.np
-To add headers fields requiring special processing.
-.lp
-Adding mailers or changing parsing
-(i.e., rewriting)
-or routing information
-does not require recompilation.
-.pp
-If the mail is being sent by a local user,
-and the file
-.q .mailcf
-exists in the sender's home directory,
-that file is read as a configuration file
-after the system configuration file.
-The primary use of this feature is to add header lines.
-.pp
-The configuration file encodes macro definitions,
-header definitions,
-mailer definitions,
-rewriting rules,
-and options.
-.sh 3 Macros
-.pp
-Macros can be used in three ways.
-Certain macros transmit
-unstructured textual information
-into the mail system,
-such as the name
-.i sendmail
-will use to identify itself in error messages.
-Other macros transmit information from
-.i sendmail
-to the configuration file
-for use in creating other fields
-(such as argument vectors to mailers);
-e.g., the name of the sender,
-and the host and user
-of the recipient.
-Other macros are unused internally,
-and can be used as shorthand in the configuration file.
-.sh 3 "Header declarations"
-.pp
-Header declarations inform
-.i sendmail
-of the format of known header lines.
-Knowledge of a few header lines
-is built into
-.i sendmail ,
-such as the
-.q From:
-and
-.q Date:
-lines.
-.pp
-Most configured headers
-will be automatically inserted
-in the outgoing message
-if they don't exist in the incoming message.
-Certain headers are suppressed by some mailers.
-.sh 3 "Mailer declarations"
-.pp
-Mailer declarations tell
-.i sendmail
-of the various mailers available to it.
-The definition specifies the internal name of the mailer,
-the pathname of the program to call,
-some flags associated with the mailer,
-and an argument vector to be used on the call;
-this vector is macro-expanded before use.
-.sh 3 "Address rewriting rules"
-.pp
-The heart of address parsing in
-.i sendmail
-is a set of rewriting rules.
-These are an ordered list of pattern-replacement rules,
-(somewhat like a production system,
-except that order is critical),
-which are applied to each address.
-The address is rewritten textually until it is either rewritten
-into a special canonical form
-(i.e.,
-a (mailer, host, user)
-3-tuple,
-such as {arpanet, usc-isif, postel}
-representing the address
-.q "postel@usc-isif" ),
-or it falls off the end.
-When a pattern matches,
-the rule is reapplied until it fails.
-.pp
-The configuration file also supports the editing of addresses
-into different formats.
-For example,
-an address of the form:
-.(b
-ucsfcgl!tef
-.)b
-might be mapped into:
-.(b
-tef@ucsfcgl.UUCP
-.)b
-to conform to the domain syntax.
-Translations can also be done in the other direction.
-.sh 3 "Option setting"
-.pp
-There are several options that can be set
-from the configuration file.
-These include the pathnames of various support files,
-timeouts,
-default modes,
-etc.
-.sh 1 "COMPARISON WITH OTHER MAILERS"
-.sh 2 "Delivermail"
-.pp
-.i Sendmail
-is an outgrowth of
-.i delivermail .
-The primary differences are:
-.np
-Configuration information is not compiled in.
-This change simplifies many of the problems
-of moving to other machines.
-It also allows easy debugging of new mailers.
-.np
-Address parsing is more flexible.
-For example,
-.i delivermail
-only supported one gateway to any network,
-whereas
-.i sendmail
-can be sensitive to host names
-and reroute to different gateways.
-.np
-Forwarding and
-:include:
-features eliminate the requirement that the system alias file
-be writable by any user
-(or that an update program be written,
-or that the system administration make all changes).
-.np
-.i Sendmail
-supports message batching across networks
-when a message is being sent to multiple recipients.
-.np
-A mail queue is provided in
-.i sendmail.
-Mail that cannot be delivered immediately
-but can potentially be delivered later
-is stored in this queue for a later retry.
-The queue also provides a buffer against system crashes;
-after the message has been collected
-it may be reliably redelivered
-even if the system crashes during the initial delivery.
-.np
-.i Sendmail
-uses the networking support provided by 4.2BSD
-to provide a direct interface networks such as the ARPANET
-and/or Ethernet
-using SMTP (the Simple Mail Transfer Protocol)
-over a TCP/IP connection.
-.sh 2 "MMDF"
-.pp
-MMDF
-[Crocker79]
-spans a wider problem set than
-.i sendmail .
-For example,
-the domain of
-MMDF includes a
-.q "phone network"
-mailer, whereas
-.i sendmail
-calls on preexisting mailers in most cases.
-.pp
-MMDF and
-.i sendmail
-both support aliasing,
-customized mailers,
-message batching,
-automatic forwarding to gateways,
-queueing,
-and retransmission.
-MMDF supports two-stage timeout,
-which
-.i sendmail
-does not support.
-.pp
-The configuration for MMDF
-is compiled into the code\**.
-.(f
-\**Dynamic configuration tables are currently being considered
-for MMDF;
-allowing the installer to select either compiled
-or dynamic tables.
-.)f
-.pp
-Since MMDF does not consider backwards compatibility
-as a design goal,
-the address parsing is simpler but much less flexible.
-.pp
-It is somewhat harder to integrate a new channel\**
-.(f
-\**The MMDF equivalent of a
-.i sendmail
-.q mailer.
-.)f
-into MMDF.
-In particular,
-MMDF must know the location and format
-of host tables for all channels,
-and the channel must speak a special protocol.
-This allows MMDF to do additional verification
-(such as verifying host names)
-at submission time.
-.pp
-MMDF strictly separates the submission and delivery phases.
-Although
-.i sendmail
-has the concept of each of these stages,
-they are integrated into one program,
-whereas in MMDF they are split into two programs.
-.sh 2 "Message Processing Module"
-.pp
-The Message Processing Module (MPM)
-discussed by Postel [Postel79b]
-matches
-.i sendmail
-closely in terms of its basic architecture.
-However,
-like MMDF,
-the MPM includes the network interface software
-as part of its domain.
-.pp
-MPM also postulates a duplex channel to the receiver,
-as does MMDF,
-thus allowing simpler handling of errors
-by the mailer
-than is possible in
-.i sendmail .
-When a message queued by
-.i sendmail
-is sent,
-any errors must be returned to the sender
-by the mailer itself.
-Both MPM and MMDF mailers
-can return an immediate error response,
-and a single error processor can create an appropriate response.
-.pp
-MPM prefers passing the message as a structured object,
-with type-length-value tuples\**.
-.(f
-\**This is similar to the NBS standard.
-.)f
-Such a convention requires a much higher degree of cooperation
-between mailers than is required by
-.i sendmail .
-MPM also assumes a universally agreed upon internet name space
-(with each address in the form of a net-host-user tuple),
-which
-.i sendmail
-does not.
-.sh 1 "EVALUATIONS AND FUTURE PLANS"
-.pp
-.i Sendmail
-is designed to work in a nonhomogeneous environment.
-Every attempt is made to avoid imposing unnecessary constraints
-on the underlying mailers.
-This goal has driven much of the design.
-One of the major problems
-has been the lack of a uniform address space,
-as postulated in [Postel79a]
-and [Postel79b].
-.pp
-A nonuniform address space implies that a path will be specified
-in all addresses,
-either explicitly (as part of the address)
-or implicitly
-(as with implied forwarding to gateways).
-This restriction has the unpleasant effect of making replying to messages
-exceedingly difficult,
-since there is no one
-.q address
-for any person,
-but only a way to get there from wherever you are.
-.pp
-Interfacing to mail programs
-that were not initially intended to be applied
-in an internet environment
-has been amazingly successful,
-and has reduced the job to a manageable task.
-.pp
-.i Sendmail
-has knowledge of a few difficult environments
-built in.
-It generates ARPANET FTP/SMTP compatible error messages
-(prepended with three-digit numbers
-[Neigus73, Postel74, Postel82])
-as necessary,
-optionally generates UNIX-style
-.q From
-lines on the front of messages for some mailers,
-and knows how to parse the same lines on input.
-Also,
-error handling has an option customized for BerkNet.
-.pp
-The decision to avoid doing any type of delivery where possible
-(even, or perhaps especially, local delivery)
-has turned out to be a good idea.
-Even with local delivery,
-there are issues of the location of the mailbox,
-the format of the mailbox,
-the locking protocol used,
-etc.,
-that are best decided by other programs.
-One surprisingly major annoyance in many internet mailers
-is that the location and format of local mail is built in.
-The feeling seems to be that local mail is so common
-that it should be efficient.
-This feeling is not born out by
-our experience;
-on the contrary,
-the location and format of mailboxes seems to vary widely
-from system to system.
-.pp
-The ability to automatically generate a response to incoming mail
-(by forwarding mail to a program)
-seems useful
-(\c
-.q "I am on vacation until late August...." )
-but can create problems
-such as forwarding loops
-(two people on vacation whose programs send notes back and forth,
-for instance)
-if these programs are not well written.
-A program could be written to do standard tasks correctly,
-but this would solve the general case.
-.pp
-It might be desirable to implement some form of load limiting.
-I am unaware of any mail system that addresses this problem,
-nor am I aware of any reasonable solution at this time.
-.pp
-The configuration file is currently practically inscrutable;
-considerable convenience could be realized
-with a higher-level format.
-.pp
-It seems clear that common protocols will be changing soon
-to accommodate changing requirements and environments.
-These changes will include modifications to the message header
-(e.g., [NBS80])
-or to the body of the message itself
-(such as for multimedia messages
-[Postel80]).
-Experience indicates that
-these changes should be relatively trivial to integrate
-into the existing system.
-.pp
-In tightly coupled environments,
-it would be nice to have a name server
-such as Grapvine
-[Birrell82]
-integrated into the mail system.
-This would allow a site such as
-.q Berkeley
-to appear as a single host,
-rather than as a collection of hosts,
-and would allow people to move transparently among machines
-without having to change their addresses.
-Such a facility
-would require an automatically updated database
-and some method of resolving conflicts.
-Ideally this would be effective even without
-all hosts being under
-a single management.
-However,
-it is not clear whether this feature
-should be integrated into the
-aliasing facility
-or should be considered a
-.q "value added"
-feature outside
-.i sendmail
-itself.
-.pp
-As a more interesting case,
-the CSNET name server
-[Solomon81]
-provides an facility that goes beyond a single
-tightly-coupled environment.
-Such a facility would normally exist outside of
-.i sendmail
-however.
-.sh 0 "ACKNOWLEDGEMENTS"
-.pp
-Thanks are due to Kurt Shoens for his continual cheerful
-assistance and good advice,
-Bill Joy for pointing me in the correct direction
-(over and over),
-and Mark Horton for more advice,
-prodding,
-and many of the good ideas.
-Kurt and Eric Schmidt are to be credited
-for using
-.i delivermail
-as a server for their programs
-(\c
-.i Mail
-and BerkNet respectively)
-before any sane person should have,
-and making the necessary modifications
-promptly and happily.
-Eric gave me considerable advice about the perils
-of network software which saved me an unknown
-amount of work and grief.
-Mark did the original implementation of the DBM version
-of aliasing, installed the VFORK code,
-wrote the current version of
-.i rmail ,
-and was the person who really convinced me
-to put the work into
-.i delivermail
-to turn it into
-.i sendmail .
-Kurt deserves accolades for using
-.i sendmail
-when I was myself afraid to take the risk;
-how a person can continue to be so enthusiastic
-in the face of so much bitter reality is beyond me.
-.pp
-Kurt,
-Mark,
-Kirk McKusick,
-Marvin Solomon,
-and many others have reviewed this paper,
-giving considerable useful advice.
-.pp
-Special thanks are reserved for Mike Stonebraker at Berkeley
-and Bob Epstein at Britton-Lee,
-who both knowingly allowed me to put so much work into this
-project
-when there were so many other things I really should
-have been working on.
-.+c
-.ce
-REFERENCES
-.nr ii 1.5i
-.ip [Birrell82]
-Birrell, A. D.,
-Levin, R.,
-Needham, R. M.,
-and
-Schroeder, M. D.,
-.q "Grapevine: An Exercise in Distributed Computing."
-In
-.ul
-Comm. A.C.M. 25,
-4,
-April 82.
-.ip [Borden79]
-Borden, S.,
-Gaines, R. S.,
-and
-Shapiro, N. Z.,
-.ul
-The MH Message Handling System: Users' Manual.
-R-2367-PAF.
-Rand Corporation.
-October 1979.
-.ip [Crocker77a]
-Crocker, D. H.,
-Vittal, J. J.,
-Pogran, K. T.,
-and
-Henderson, D. A. Jr.,
-.ul
-Standard for the Format of ARPA Network Text Messages.
-RFC 733,
-NIC 41952.
-In [Feinler78].
-November 1977.
-.ip [Crocker77b]
-Crocker, D. H.,
-.ul
-Framework and Functions of the MS Personal Message System.
-R-2134-ARPA,
-Rand Corporation,
-Santa Monica, California.
-1977.
-.ip [Crocker79]
-Crocker, D. H.,
-Szurkowski, E. S.,
-and
-Farber, D. J.,
-.ul
-An Internetwork Memo Distribution Facility \*- MMDF.
-6th Data Communication Symposium,
-Asilomar.
-November 1979.
-.ip [Crocker82]
-Crocker, D. H.,
-.ul
-Standard for the Format of Arpa Internet Text Messages.
-RFC 822.
-Network Information Center,
-SRI International,
-Menlo Park, California.
-August 1982.
-.ip [Metcalfe76]
-Metcalfe, R.,
-and
-Boggs, D.,
-.q "Ethernet: Distributed Packet Switching for Local Computer Networks" ,
-.ul
-Communications of the ACM 19,
-7.
-July 1976.
-.ip [Feinler78]
-Feinler, E.,
-and
-Postel, J.
-(eds.),
-.ul
-ARPANET Protocol Handbook.
-NIC 7104,
-Network Information Center,
-SRI International,
-Menlo Park, California.
-1978.
-.ip [NBS80]
-National Bureau of Standards,
-.ul
-Specification of a Draft Message Format Standard.
-Report No. ICST/CBOS 80-2.
-October 1980.
-.ip [Neigus73]
-Neigus, N.,
-.ul
-File Transfer Protocol for the ARPA Network.
-RFC 542, NIC 17759.
-In [Feinler78].
-August, 1973.
-.ip [Nowitz78a]
-Nowitz, D. A.,
-and
-Lesk, M. E.,
-.ul
-A Dial-Up Network of UNIX Systems.
-Bell Laboratories.
-In
-UNIX Programmer's Manual, Seventh Edition,
-Volume 2.
-August, 1978.
-.ip [Nowitz78b]
-Nowitz, D. A.,
-.ul
-Uucp Implementation Description.
-Bell Laboratories.
-In
-UNIX Programmer's Manual, Seventh Edition,
-Volume 2.
-October, 1978.
-.ip [Postel74]
-Postel, J.,
-and
-Neigus, N.,
-Revised FTP Reply Codes.
-RFC 640, NIC 30843.
-In [Feinler78].
-June, 1974.
-.ip [Postel77]
-Postel, J.,
-.ul
-Mail Protocol.
-NIC 29588.
-In [Feinler78].
-November 1977.
-.ip [Postel79a]
-Postel, J.,
-.ul
-Internet Message Protocol.
-RFC 753,
-IEN 85.
-Network Information Center,
-SRI International,
-Menlo Park, California.
-March 1979.
-.ip [Postel79b]
-Postel, J. B.,
-.ul
-An Internetwork Message Structure.
-In
-.ul
-Proceedings of the Sixth Data Communications Symposium,
-IEEE.
-New York.
-November 1979.
-.ip [Postel80]
-Postel, J. B.,
-.ul
-A Structured Format for Transmission of Multi-Media Documents.
-RFC 767.
-Network Information Center,
-SRI International,
-Menlo Park, California.
-August 1980.
-.ip [Postel82]
-Postel, J. B.,
-.ul
-Simple Mail Transfer Protocol.
-RFC821
-(obsoleting RFC788).
-Network Information Center,
-SRI International,
-Menlo Park, California.
-August 1982.
-.ip [Schmidt79]
-Schmidt, E.,
-.ul
-An Introduction to the Berkeley Network.
-University of California, Berkeley California.
-1979.
-.ip [Shoens79]
-Shoens, K.,
-.ul
-Mail Reference Manual.
-University of California, Berkeley.
-In UNIX Programmer's Manual,
-Seventh Edition,
-Volume 2C.
-December 1979.
-.ip [Sluizer81]
-Sluizer, S.,
-and
-Postel, J. B.,
-.ul
-Mail Transfer Protocol.
-RFC 780.
-Network Information Center,
-SRI International,
-Menlo Park, California.
-May 1981.
-.ip [Solomon81]
-Solomon, M., Landweber, L., and Neuhengen, D.,
-.q "The Design of the CSNET Name Server."
-CS-DN-2,
-University of Wisconsin, Madison.
-November 1981.
-.ip [Su82]
-Su, Zaw-Sing,
-and
-Postel, Jon,
-.ul
-The Domain Naming Convention for Internet User Applications.
-RFC819.
-Network Information Center,
-SRI International,
-Menlo Park, California.
-August 1982.
-.ip [UNIX83]
-.ul
-The UNIX Programmer's Manual, Seventh Edition,
-Virtual VAX-11 Version,
-Volume 1.
-Bell Laboratories,
-modified by the University of California,
-Berkeley, California.
-March, 1983.
+++ /dev/null
-%!PS-Adobe-3.0
-%%Creator: groff version 1.10
-%%CreationDate: Tue May 19 16:37:12 1998
-%%DocumentNeededResources: font Times-Roman
-%%+ font Times-Italic
-%%+ font Times-Bold
-%%DocumentSuppliedResources: procset grops 1.10 0
-%%Pages: 13
-%%PageOrder: Ascend
-%%Orientation: Portrait
-%%EndComments
-%%BeginProlog
-%%BeginResource: procset grops 1.10 0
-/setpacking where{
-pop
-currentpacking
-true setpacking
-}if
-/grops 120 dict dup begin
-/SC 32 def
-/A/show load def
-/B{0 SC 3 -1 roll widthshow}bind def
-/C{0 exch ashow}bind def
-/D{0 exch 0 SC 5 2 roll awidthshow}bind def
-/E{0 rmoveto show}bind def
-/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
-/G{0 rmoveto 0 exch ashow}bind def
-/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/I{0 exch rmoveto show}bind def
-/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
-/K{0 exch rmoveto 0 exch ashow}bind def
-/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/M{rmoveto show}bind def
-/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
-/O{rmoveto 0 exch ashow}bind def
-/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/Q{moveto show}bind def
-/R{moveto 0 SC 3 -1 roll widthshow}bind def
-/S{moveto 0 exch ashow}bind def
-/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/SF{
-findfont exch
-[exch dup 0 exch 0 exch neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/MF{
-findfont
-[5 2 roll
-0 3 1 roll
-neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/level0 0 def
-/RES 0 def
-/PL 0 def
-/LS 0 def
-/MANUAL{
-statusdict begin/manualfeed true store end
-}bind def
-/PLG{
-gsave newpath clippath pathbbox grestore
-exch pop add exch pop
-}bind def
-/BP{
-/level0 save def
-1 setlinecap
-1 setlinejoin
-72 RES div dup scale
-LS{
-90 rotate
-}{
-0 PL translate
-}ifelse
-1 -1 scale
-}bind def
-/EP{
-level0 restore
-showpage
-}bind def
-/DA{
-newpath arcn stroke
-}bind def
-/SN{
-transform
-.25 sub exch .25 sub exch
-round .25 add exch round .25 add exch
-itransform
-}bind def
-/DL{
-SN
-moveto
-SN
-lineto stroke
-}bind def
-/DC{
-newpath 0 360 arc closepath
-}bind def
-/TM matrix def
-/DE{
-TM currentmatrix pop
-translate scale newpath 0 0 .5 0 360 arc closepath
-TM setmatrix
-}bind def
-/RC/rcurveto load def
-/RL/rlineto load def
-/ST/stroke load def
-/MT/moveto load def
-/CL/closepath load def
-/FL{
-currentgray exch setgray fill setgray
-}bind def
-/BL/fill load def
-/LW/setlinewidth load def
-/RE{
-findfont
-dup maxlength 1 index/FontName known not{1 add}if dict begin
-{
-1 index/FID ne{def}{pop pop}ifelse
-}forall
-/Encoding exch def
-dup/FontName exch def
-currentdict end definefont pop
-}bind def
-/DEFS 0 def
-/EBEGIN{
-moveto
-DEFS begin
-}bind def
-/EEND/end load def
-/CNT 0 def
-/level1 0 def
-/PBEGIN{
-/level1 save def
-translate
-div 3 1 roll div exch scale
-neg exch neg exch translate
-0 setgray
-0 setlinecap
-1 setlinewidth
-0 setlinejoin
-10 setmiterlimit
-[]0 setdash
-/setstrokeadjust where{
-pop
-false setstrokeadjust
-}if
-/setoverprint where{
-pop
-false setoverprint
-}if
-newpath
-/CNT countdictstack def
-userdict begin
-/showpage{}def
-}bind def
-/PEND{
-clear
-countdictstack CNT sub{end}repeat
-level1 restore
-}bind def
-end def
-/setpacking where{
-pop
-setpacking
-}if
-%%EndResource
-%%IncludeResource: font Times-Roman
-%%IncludeResource: font Times-Italic
-%%IncludeResource: font Times-Bold
-grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
-def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron
-/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
-/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
-/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
-/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
-/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
-/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
-/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
-/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
-/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
-/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
-/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
-/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
-/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
-/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
-/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
-/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
-/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
-/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
-/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
-/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
-/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
-/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
-/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
-/Times-Bold@0 ENC0/Times-Bold RE/Times-Italic@0 ENC0/Times-Italic RE
-/Times-Roman@0 ENC0/Times-Roman RE
-%%EndProlog
-%%Page: 1 1
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 14/Times-Roman@0 SF(SENDMAIL \212 An Internetw)159.172 141 Q
-(ork Mail Router)-.14 E/F1 10/Times-Roman@0 SF(Eric Allman*)260.92 165 Q
-/F2 10/Times-Italic@0 SF(Univer)220.2 183 Q(sity of California, Berk)-.1
-E(ele)-.1 E(y)-.3 E(Mammoth Pr)251.98 195 Q(oject)-.45 E F1(ABSTRA)
-262.085 227.4 Q(CT)-.4 E 1.41
-(Routing mail through a heterogenous internet presents man)112 243.6 R
-3.91(yn)-.15 G 1.91 -.25(ew p)-3.91 H 3.91(roblems. Among).25 F .297
-(the w)112 255.6 R .297(orst of these is that of address mapping.)-.1 F
-(Historically)5.297 E 2.797(,t)-.65 G .298(his has been handled on an)
--2.797 F F2(ad hoc)112 267.6 Q F1 2.5(basis. Ho)2.5 F(we)-.25 E -.15(ve)
--.25 G .8 -.4(r, t).15 H
-(his approach has become unmanageable as internets gro).4 E -.65(w.)-.25
-G .15(Sendmail acts a uni\214ed "post of)112 283.8 R .15
-(\214ce" to which all mail can be submitted.)-.25 F .15(Address inter)
-5.15 F(-)-.2 E .426(pretation is controlled by a production system, which can parse both domain-based ad-)
-112 295.8 R .423(dressing and old-style)112 307.8 R F2 .423(ad hoc)2.923
-F F1 2.923(addresses. The)2.923 F .422(production system is po)2.922 F
-.422(werful enough to)-.25 F(re)112 319.8 Q 1.357(write addresses in the message header to conform to the standards of a number of)
--.25 F 1.15(common tar)112 331.8 R 1.15(get netw)-.18 F 1.15
-(orks, including old \(NCP/RFC733\) Arpanet, ne)-.1 F 3.65(w\()-.25 G
-(TCP/RFC822\))-3.65 E 1.119(Arpanet, UUCP)112 343.8 R 3.619(,a)-1.11 G
-1.119(nd Phonenet.)-3.619 F 1.119(Sendmail also implements an SMTP serv)
-6.119 F(er)-.15 E 3.619(,m)-.4 G(essage)-3.619 E
-(queueing, and aliasing.)112 355.8 Q F2(Sendmail)97 400.2 Q F1 .501
-(implements a general internetw)3 F .501(ork mail routing f)-.1 F
-(acility)-.1 E 3.001(,f)-.65 G .501(eaturing aliasing and forw)-3.001 F
-(arding,)-.1 E(automatic routing to netw)72 412.2 Q(ork g)-.1 E(ate)-.05
-E -.1(wa)-.25 G(ys, and \215e).1 E(xible con\214guration.)-.15 E .624
-(In a simple netw)97 428.4 R .624(ork, each node has an address, and resources can be identi\214ed with a host-resource)
--.1 F .374(pair; in particular)72 440.4 R 2.874(,t)-.4 G .374
-(he mail system can refer to users using a host-username pair)-2.874 F
-5.374(.H)-.55 G .375(ost names and numbers)-5.374 F(ha)72 452.4 Q .3
--.15(ve t)-.2 H 2.5(ob).15 G 2.5(ea)-2.5 G
-(dministered by a central authority)-2.5 E 2.5(,b)-.65 G
-(ut usernames can be assigned locally to each host.)-2.7 E .649
-(In an internet, multiple netw)97 468.6 R .649(orks with dif)-.1 F .649
-(ferent characterstics and managements must communicate.)-.25 F .389
-(In particular)72 480.6 R 2.889(,t)-.4 G .389
-(he syntax and semantics of resource identi\214cation change.)-2.889 F
-.39(Certain special cases can be han-)5.389 F 1.033(dled tri)72 492.6 R
-1.033(vially by)-.25 F F2 1.033(ad hoc)3.533 F F1 1.032
-(techniques, such as pro)3.533 F 1.032(viding netw)-.15 F 1.032
-(ork names that appear local to hosts on other)-.1 F(netw)72 504.6 Q
-1.454(orks, as with the Ethernet at Xerox P)-.1 F 3.955(ARC. Ho)-.92 F
-(we)-.25 E -.15(ve)-.25 G 4.755 -.4(r, t).15 H 1.455
-(he general case is e).4 F 1.455(xtremely comple)-.15 F 3.955(x. F)-.15
-F(or)-.15 E -.15(ex)72 516.6 S .192(ample, some netw).15 F .192(orks require point-to-point routing, which simpli\214es the database update problem since)
--.1 F .618(only adjacent hosts must be entered into the system tables, while others use end-to-end addressing.)
-72 528.6 R(Some)5.618 E(netw)72 540.6 Q .123(orks use a left-associati)
--.1 F .423 -.15(ve s)-.25 H .123(yntax and others use a right-associati)
-.15 F .423 -.15(ve s)-.25 H .123(yntax, causing ambiguity in mix).15 F
-(ed)-.15 E(addresses.)72 552.6 Q .678
-(Internet standards seek to eliminate these problems.)97 568.8 R
-(Initially)5.678 E 3.178(,t)-.65 G .679(hese proposed e)-3.178 F .679
-(xpanding the address)-.15 F .65
-(pairs to address triples, consisting of {netw)72 580.8 R .649
-(ork, host, resource} triples.)-.1 F(Netw)5.649 E .649
-(ork numbers must be uni)-.1 F -.15(ve)-.25 G -.2(r-).15 G 1.452
-(sally agreed upon, and hosts can be assigned locally on each netw)72
-592.8 R 3.952(ork. The)-.1 F(user)3.952 E(-le)-.2 E -.15(ve)-.25 G 3.952
-(lp).15 G 1.452(resentation w)-3.952 F(as)-.1 E 2.352(quickly e)72 604.8
-R 2.352(xpanded to address domains, comprised of a local resource identi\214cation and a hierarchical)
--.15 F .256(domain speci\214cation with a common static root.)72 616.8 R
-.257(The domain technique separates the issue of ph)5.257 F .257
-(ysical v)-.05 F(er)-.15 E(-)-.2 E .807(sus logical addressing.)72 628.8
-R -.15(Fo)5.807 G 3.307(re).15 G .807
-(xample, an address of the form \231eric@a.cc.berk)-3.457 F(ele)-.1 E
--.65(y.)-.15 G .807(arpa\232 describes only the).65 F(logical or)72
-640.8 Q -.05(ga)-.18 G(nization of the address space.).05 E F2(Sendmail)
-97 657 Q F1 .493(is intended to help bridge the g)2.992 F .493
-(ap between the totally)-.05 F F2 .493(ad hoc)2.993 F F1 -.1(wo)2.993 G
-.493(rld of netw).1 F .493(orks that kno)-.1 F(w)-.25 E .855
-(nothing of each other and the clean, tightly-coupled w)72 669 R .854
-(orld of unique netw)-.1 F .854(ork numbers.)-.1 F .854
-(It can accept old)5.854 F .32 LW 76 678.6 72 678.6 DL 80 678.6 76 678.6
-DL 84 678.6 80 678.6 DL 88 678.6 84 678.6 DL 92 678.6 88 678.6 DL 96
-678.6 92 678.6 DL 100 678.6 96 678.6 DL 104 678.6 100 678.6 DL 108 678.6
-104 678.6 DL 112 678.6 108 678.6 DL 116 678.6 112 678.6 DL 120 678.6 116
-678.6 DL 124 678.6 120 678.6 DL 128 678.6 124 678.6 DL 132 678.6 128
-678.6 DL 136 678.6 132 678.6 DL 140 678.6 136 678.6 DL 144 678.6 140
-678.6 DL 148 678.6 144 678.6 DL 152 678.6 148 678.6 DL 156 678.6 152
-678.6 DL 160 678.6 156 678.6 DL 164 678.6 160 678.6 DL 168 678.6 164
-678.6 DL 172 678.6 168 678.6 DL 176 678.6 172 678.6 DL 180 678.6 176
-678.6 DL 184 678.6 180 678.6 DL 188 678.6 184 678.6 DL 192 678.6 188
-678.6 DL 196 678.6 192 678.6 DL 200 678.6 196 678.6 DL 204 678.6 200
-678.6 DL 208 678.6 204 678.6 DL 212 678.6 208 678.6 DL 216 678.6 212
-678.6 DL/F3 8/Times-Roman@0 SF .557(*A considerable part of this w)93.6
-690.6 R .557(ork w)-.08 F .557(as done while under the emplo)-.08 F
-2.557(yo)-.08 G 2.556(ft)-2.557 G .556(he INGRES Project at the Uni)
--2.556 F -.12(ve)-.2 G .556(rsity of California at).12 F(Berk)72 700.2 Q
-(ele)-.08 E 2(ya)-.12 G(nd at Britton Lee.)-2 E/F4 10/Times-Bold@0 SF
-(SENDMAIL \212 An Inter)72 756 Q(netw)-.15 E(ork Mail Router)-.1 E
-(SMM:9-1)194.78 E EP
-%%Page: 2 2
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF 192.28(SMM:9-2 SENDMAIL)72 60 R 2.5<8a41>2.5 G
-2.5(nI)-2.5 G(nter)-2.5 E(netw)-.15 E(ork Mail Router)-.1 E/F1 10
-/Times-Roman@0 SF .632(arbitrary address syntax)72 96 R .633(es, resolving ambiguities using heuristics speci\214ed by the system administrator)
--.15 F 3.133(,a)-.4 G(s)-3.133 E .348(well as domain-based addressing.)
-72 108 R .347(It helps guide the con)5.347 F -.15(ve)-.4 G .347
-(rsion of message formats between disparate net-).15 F -.1(wo)72 120 S
-3.394(rks. In).1 F(short,)3.394 E/F2 10/Times-Italic@0 SF(sendmail)3.394
-E F1 .894
-(is designed to assist a graceful transition to consistent internetw)
-3.394 F .895(ork addressing)-.1 F(schemes.)72 132 Q .153
-(Section 1 discusses the design goals for)97 160.2 R F2(sendmail)2.653 E
-F1 5.153(.S)C .152(ection 2 gi)-5.153 F -.15(ve)-.25 G 2.652(sa).15 G
-2.652(no)-2.652 G -.15(ve)-2.802 G(rvie).15 E 2.652(wo)-.25 G 2.652(ft)
--2.652 G .152(he basic functions)-2.652 F .644(of the system.)72 172.2 R
-.644(In section 3, details of usage are discussed.)5.644 F .644
-(Section 4 compares)5.644 F F2(sendmail)3.144 E F1 .645
-(to other internet)3.144 F(mail routers, and an e)72 184.2 Q -.25(va)
--.25 G(luation of).25 E F2(sendmail)2.5 E F1(is gi)2.5 E -.15(ve)-.25 G
-2.5(ni).15 G 2.5(ns)-2.5 G(ection 5, including future plans.)-2.5 E F0
-2.5(1. DESIGN)72 208.2 R(GO)2.5 E(ALS)-.4 E F1(Design goals for)112
-224.4 Q F2(sendmail)2.5 E F1(include:)2.5 E 12.5(\(1\) Compatibility)92
-240.6 R 1.363(with the e)3.864 F 1.363
-(xisting mail programs, including Bell v)-.15 F 1.363
-(ersion 6 mail, Bell v)-.15 F 1.363(ersion 7)-.15 F 1.202
-(mail [UNIX83], Berk)118.66 252.6 R(ele)-.1 E(y)-.15 E F2(Mail)3.702 E
-F1 1.202([Shoens79], BerkNet mail [Schmidt79], and hopefully UUCP)3.702
-F(mail [No)118.66 264.6 Q(witz78a, No)-.25 E 2.5(witz78b]. ARP)-.25 F
-(ANET mail [Crock)-.92 E(er77a, Postel77] w)-.1 E(as also required.)-.1
-E 12.5(\(2\) Reliability)92 280.8 R 4.003(,i)-.65 G 4.003(nt)-4.003 G
-1.502(he sense of guaranteeing that e)-4.003 F -.15(ve)-.25 G 1.502
-(ry message is correctly deli).15 F -.15(ve)-.25 G 1.502
-(red or at least).15 F .368(brought to the attention of a human for correct disposal; no message should e)
-118.66 292.8 R -.15(ve)-.25 G 2.868(rb).15 G 2.868(ec)-2.868 G
-(ompletely)-2.868 E 2.541(lost. This)118.66 304.8 R .041(goal w)2.541 F
-.041(as considered essential because of the emphasis on mail in our en)
--.1 F 2.54(vironment. It)-.4 F 1.754
-(has turned out to be one of the hardest goals to satisfy)118.66 316.8 R
-4.255(,e)-.65 G 1.755(specially in the f)-4.255 F 1.755(ace of the man)
--.1 F(y)-.15 E .978(anomalous message formats produced by v)118.66 328.8
-R .977(arious ARP)-.25 F .977(ANET sites.)-.92 F -.15(Fo)5.977 G 3.477
-(re).15 G .977(xample, certain sites)-3.627 F .069
-(generate improperly formated addresses, occasionally causing error)
-118.66 340.8 R .069(-message loops.)-.2 F .069(Some hosts)5.069 F .063(use blanks in names, causing problems with UNIX mail programs that assume that an address is)
-118.66 352.8 R .111(one w)118.66 364.8 R 2.611(ord. The)-.1 F .111
-(semantics of some \214elds are interpreted slightly dif)2.611 F .112
-(ferently by dif)-.25 F .112(ferent sites.)-.25 F(In)5.112 E(summary)
-118.66 376.8 Q 3.023(,t)-.65 G .523(he obscure features of the ARP)
--3.023 F .523(ANET mail protocol really)-.92 F F2(ar)3.023 E(e)-.37 E F1
-.522(used and are dif)3.023 F(\214cult)-.25 E(to support, b)118.66 388.8
-Q(ut must be supported.)-.2 E 12.5(\(3\) Existing)92 405 R(softw)2.938 E
-.438(are to do actual deli)-.1 F -.15(ve)-.25 G .439
-(ry should be used whene).15 F -.15(ve)-.25 G 2.939(rp).15 G 2.939
-(ossible. This)-2.939 F .439(goal deri)2.939 F -.15(ve)-.25 G 2.939(sa)
-.15 G(s)-2.939 E
-(much from political and practical considerations as technical.)118.66
-417 Q 12.5(\(4\) Easy)92 433.2 R -.15(ex)2.899 G .399(pansion to f).15 F
-.399(airly comple)-.1 F 2.898(xe)-.15 G -.4(nv)-2.898 G .398
-(ironments, including multiple connections to a single net-).4 F -.1(wo)
-118.66 445.2 S .115
-(rk type \(such as with multiple UUCP or Ether nets [Metcalfe76]\).).1 F
-.115(This goal requires consid-)5.115 F .587(eration of the contents of an address as well as its syntax in order to determine which g)
-118.66 457.2 R(ate)-.05 E -.1(wa)-.25 G(y).1 E 1.018(to use.)118.66
-469.2 R -.15(Fo)6.018 G 3.518(re).15 G 1.018(xample, the ARP)-3.668 F
-1.019(ANET is bringing up the TCP protocol to replace the old NCP)-.92 F
-4.791(protocol. No)118.66 481.2 R 2.291(host at Berk)4.791 F(ele)-.1 E
-4.791(yr)-.15 G 2.291(uns both TCP and NCP)-4.791 F 4.791(,s)-1.11 G
-4.79(oi)-4.791 G 4.79(ti)-4.79 G 4.79(sn)-4.79 G 2.29
-(ecessary to look at the)-4.79 F(ARP)118.66 493.2 Q .016
-(ANET host name to determine whether to route mail to an NCP g)-.92 F
-(ate)-.05 E -.1(wa)-.25 G 2.517(yo).1 G 2.517(raT)-2.517 G .017(CP g)
--2.517 F(ate)-.05 E -.1(wa)-.25 G -.65(y.).1 G 12.5
-(\(5\) Con\214guration)92 509.4 R .145
-(should not be compiled into the code.)2.645 F 2.645(As)5.145 G .145
-(ingle compiled program should be able)-2.645 F .91(to run as is at an)
-118.66 521.4 R 3.41(ys)-.15 G .91(ite \(barring such basic changes as the CPU type or the operating system\).)
--3.41 F 2.61 -.8(We h)118.66 533.4 T -2.25 -.2(av e).8 H 1.009
-(found this seemingly unimportant goal to be critical in real life.)3.71
-F 1.009(Besides the simple)6.009 F .66(problems that occur when an)
-118.66 545.4 R 3.16(yp)-.15 G .66(rogram gets recompiled in a dif)-3.16
-F .66(ferent en)-.25 F .66(vironment, man)-.4 F 3.16(ys)-.15 G(ites)
--3.16 E(lik)118.66 557.4 Q 2.5(et)-.1 G 2.5<6f99>-2.5 G
-(\214ddle\232 with an)-2.5 E(ything that the)-.15 E 2.5(yw)-.15 G
-(ill be recompiling an)-2.5 E(yw)-.15 E(ay)-.1 E(.)-.65 E(\(6\))92 573.6
-Q F2(Sendmail)15 E F1 .184(must be able to let v)2.684 F .184
-(arious groups maintain their o)-.25 F .184
-(wn mailing lists, and let indi)-.25 F(viduals)-.25 E(specify their o)
-118.66 585.6 Q(wn forw)-.25 E
-(arding, without modifying the system alias \214le.)-.1 E 12.5
-(\(7\) Each)92 601.8 R .313
-(user should be able to specify which mailer to e)2.813 F -.15(xe)-.15 G
-.313(cute to process mail being deli).15 F -.15(ve)-.25 G .314(red for)
-.15 F 3.098(him. This)118.66 613.8 R .598(feature allo)3.098 F .598
-(ws users who are using specialized mailers that use a dif)-.25 F .598
-(ferent format to)-.25 F -.2(bu)118.66 625.8 S .25(ild their en).2 F .25
-(vironment without changing the system, and f)-.4 F .25
-(acilitates specialized functions \(such)-.1 F
-(as returning an \231I am on v)118.66 637.8 Q(acation\232 message\).)
--.25 E 12.5(\(8\) Netw)92 654 R 1.553(ork traf)-.1 F 1.552(\214c should be minimized by batching addresses to a single host where possible,)
--.25 F(without assistance from the user)118.66 666 Q(.)-.55 E .374
-(These goals moti)112 682.2 R -.25(va)-.25 G .374
-(ted the architecture illustrated in \214gure 1.).25 F .375
-(The user interacts with a mail gen-)5.375 F .491
-(erating and sending program.)87 694.2 R .491
-(When the mail is created, the generator calls)5.491 F F2(sendmail)2.99
-E F1 2.99(,w)C .49(hich routes the)-2.99 F .84
-(message to the correct mailer\(s\).)87 706.2 R .841
-(Since some of the senders may be netw)5.84 F .841(ork serv)-.1 F .841
-(ers and some of the)-.15 F(mailers may be netw)87 718.2 Q(ork clients,)
--.1 E F2(sendmail)2.5 E F1(may be used as an internet mail g)2.5 E(ate)
--.05 E -.1(wa)-.25 G -.65(y.).1 G EP
-%%Page: 3 3
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(SENDMAIL \212 An Inter)72 60 Q(netw)-.15 E
-(ork Mail Router)-.1 E(SMM:9-3)194.78 E .4 LW 77 108 72 108 DL 79 108 74
-108 DL 84 108 79 108 DL 89 108 84 108 DL 94 108 89 108 DL 99 108 94 108
-DL 104 108 99 108 DL 109 108 104 108 DL 114 108 109 108 DL 119 108 114
-108 DL 124 108 119 108 DL 129 108 124 108 DL 134 108 129 108 DL 139 108
-134 108 DL 144 108 139 108 DL 149 108 144 108 DL 154 108 149 108 DL 159
-108 154 108 DL 164 108 159 108 DL 169 108 164 108 DL 174 108 169 108 DL
-179 108 174 108 DL 184 108 179 108 DL 189 108 184 108 DL 194 108 189 108
-DL 199 108 194 108 DL 204 108 199 108 DL 209 108 204 108 DL 214 108 209
-108 DL 219 108 214 108 DL 224 108 219 108 DL 229 108 224 108 DL 234 108
-229 108 DL 239 108 234 108 DL 244 108 239 108 DL 249 108 244 108 DL 254
-108 249 108 DL 259 108 254 108 DL 264 108 259 108 DL 269 108 264 108 DL
-274 108 269 108 DL 279 108 274 108 DL 284 108 279 108 DL 289 108 284 108
-DL 294 108 289 108 DL 299 108 294 108 DL 304 108 299 108 DL 309 108 304
-108 DL 314 108 309 108 DL 319 108 314 108 DL 324 108 319 108 DL 329 108
-324 108 DL 334 108 329 108 DL 339 108 334 108 DL 344 108 339 108 DL 349
-108 344 108 DL 354 108 349 108 DL 359 108 354 108 DL 364 108 359 108 DL
-369 108 364 108 DL 374 108 369 108 DL 379 108 374 108 DL 384 108 379 108
-DL 389 108 384 108 DL 394 108 389 108 DL 399 108 394 108 DL 404 108 399
-108 DL 409 108 404 108 DL 414 108 409 108 DL 419 108 414 108 DL 424 108
-419 108 DL 429 108 424 108 DL 434 108 429 108 DL 439 108 434 108 DL 444
-108 439 108 DL 449 108 444 108 DL 454 108 449 108 DL 459 108 454 108 DL
-464 108 459 108 DL 469 108 464 108 DL 474 108 469 108 DL 479 108 474 108
-DL 484 108 479 108 DL 489 108 484 108 DL 494 108 489 108 DL 499 108 494
-108 DL 504 108 499 108 DL 216 171.6 MT 0 -36 RL -72 0 RL 0 36 RL CL ST
-/F1 10/Times-Roman@0 SF(sender1)164.45 155.8 Q 324 171.6 MT 0 -36 RL -72
-0 RL 0 36 RL CL ST(sender2)272.45 155.8 Q 432 171.6 MT 0 -36 RL -72 0 RL
-0 36 RL CL ST(sender3)380.45 155.8 Q 288 207.6 288 171.6 DL 288 207.6 MT
--1.8 -7.2 RL 3.6 0 RL CL BL 288 207.6 MT -1.8 -7.2 RL 3.6 0 RL CL ST 360
-243.6 MT 0 -36 RL -144 0 RL 0 36 RL CL ST(sendmail)269.945 227.8 Q 288
-279.6 288 243.6 DL 288 279.6 MT -1.8 -7.2 RL 3.6 0 RL CL BL 288 279.6 MT
--1.8 -7.2 RL 3.6 0 RL CL ST 216 315.6 MT 0 -36 RL -72 0 RL 0 36 RL CL ST
-(mailer1)164.725 299.8 Q 324 315.6 MT 0 -36 RL -72 0 RL 0 36 RL CL ST
-(mailer2)272.725 299.8 Q 432 315.6 MT 0 -36 RL -72 0 RL 0 36 RL CL ST
-(mailer3)380.725 299.8 Q 252 207.6 180 171.6 DL 252 207.6 MT -7.272
--1.584 RL 1.584 -3.24 RL CL BL 252 207.6 MT -7.272 -1.584 RL 1.584 -3.24
-RL CL ST 324 207.6 396 171.6 DL 324 207.6 MT 5.616 -4.824 RL 1.584 3.24
-RL CL BL 324 207.6 MT 5.616 -4.824 RL 1.584 3.24 RL CL ST 180 279.6 252
-243.6 DL 180 279.6 MT 5.616 -4.824 RL 1.584 3.24 RL CL BL 180 279.6 MT
-5.616 -4.824 RL 1.584 3.24 RL CL ST 396 279.6 324 243.6 DL 396 279.6 MT
--7.272 -1.584 RL 1.584 -3.24 RL CL BL 396 279.6 MT -7.272 -1.584 RL
-1.584 -3.24 RL CL ST(Figure 1 \212 Sendmail System Structure.)208 346.8
-Q 77 358.8 72 358.8 DL 79 358.8 74 358.8 DL 84 358.8 79 358.8 DL 89
-358.8 84 358.8 DL 94 358.8 89 358.8 DL 99 358.8 94 358.8 DL 104 358.8 99
-358.8 DL 109 358.8 104 358.8 DL 114 358.8 109 358.8 DL 119 358.8 114
-358.8 DL 124 358.8 119 358.8 DL 129 358.8 124 358.8 DL 134 358.8 129
-358.8 DL 139 358.8 134 358.8 DL 144 358.8 139 358.8 DL 149 358.8 144
-358.8 DL 154 358.8 149 358.8 DL 159 358.8 154 358.8 DL 164 358.8 159
-358.8 DL 169 358.8 164 358.8 DL 174 358.8 169 358.8 DL 179 358.8 174
-358.8 DL 184 358.8 179 358.8 DL 189 358.8 184 358.8 DL 194 358.8 189
-358.8 DL 199 358.8 194 358.8 DL 204 358.8 199 358.8 DL 209 358.8 204
-358.8 DL 214 358.8 209 358.8 DL 219 358.8 214 358.8 DL 224 358.8 219
-358.8 DL 229 358.8 224 358.8 DL 234 358.8 229 358.8 DL 239 358.8 234
-358.8 DL 244 358.8 239 358.8 DL 249 358.8 244 358.8 DL 254 358.8 249
-358.8 DL 259 358.8 254 358.8 DL 264 358.8 259 358.8 DL 269 358.8 264
-358.8 DL 274 358.8 269 358.8 DL 279 358.8 274 358.8 DL 284 358.8 279
-358.8 DL 289 358.8 284 358.8 DL 294 358.8 289 358.8 DL 299 358.8 294
-358.8 DL 304 358.8 299 358.8 DL 309 358.8 304 358.8 DL 314 358.8 309
-358.8 DL 319 358.8 314 358.8 DL 324 358.8 319 358.8 DL 329 358.8 324
-358.8 DL 334 358.8 329 358.8 DL 339 358.8 334 358.8 DL 344 358.8 339
-358.8 DL 349 358.8 344 358.8 DL 354 358.8 349 358.8 DL 359 358.8 354
-358.8 DL 364 358.8 359 358.8 DL 369 358.8 364 358.8 DL 374 358.8 369
-358.8 DL 379 358.8 374 358.8 DL 384 358.8 379 358.8 DL 389 358.8 384
-358.8 DL 394 358.8 389 358.8 DL 399 358.8 394 358.8 DL 404 358.8 399
-358.8 DL 409 358.8 404 358.8 DL 414 358.8 409 358.8 DL 419 358.8 414
-358.8 DL 424 358.8 419 358.8 DL 429 358.8 424 358.8 DL 434 358.8 429
-358.8 DL 439 358.8 434 358.8 DL 444 358.8 439 358.8 DL 449 358.8 444
-358.8 DL 454 358.8 449 358.8 DL 459 358.8 454 358.8 DL 464 358.8 459
-358.8 DL 469 358.8 464 358.8 DL 474 358.8 469 358.8 DL 479 358.8 474
-358.8 DL 484 358.8 479 358.8 DL 489 358.8 484 358.8 DL 494 358.8 489
-358.8 DL 499 358.8 494 358.8 DL 504 358.8 499 358.8 DL F0 2.5(2. O)72
-394.8 R(VER)-.5 E(VIEW)-.55 E 2.5(2.1. System)87 418.8 R(Or)2.5 E
-(ganization)-.1 E/F2 10/Times-Italic@0 SF(Sendmail)127 435 Q F1 .874
-(neither interf)3.374 F .874
-(aces with the user nor does actual mail deli)-.1 F -.15(ve)-.25 G(ry)
-.15 E 5.873(.R)-.65 G(ather)-5.873 E 3.373(,i)-.4 G 3.373(tc)-3.373 G
-.873(ollects a)-3.373 F .619(message generated by a user interf)102 447
-R .619(ace program \(UIP\) such as Berk)-.1 F(ele)-.1 E(y)-.15 E F2
-(Mail)3.12 E F1 3.12(,M)C 3.12(S[)-3.12 G(Crock)-3.12 E .62(er77b], or)
--.1 F 1.428
-(MH [Borden79], edits the message as required by the destination netw)
-102 459 R 1.427(ork, and calls appropriate)-.1 F .28
-(mailers to do mail deli)102 473 R -.15(ve)-.25 G .281
-(ry or queueing for netw).15 F .281(ork transmission)-.1 F/F3 7
-/Times-Roman@0 SF(1)-4 I F1 5.281(.T)4 K .281(his discipline allo)-5.281
-F .281(ws the inser)-.25 F(-)-.2 E 1.354(tion of ne)102 485 R 3.854(wm)
--.25 G 1.354(ailers at minimum cost.)-3.854 F 1.354(In this sense)6.354
-F F2(sendmail)3.853 E F1 1.353(resembles the Message Processing)3.853 F
-(Module \(MPM\) of [Postel79b].)102 497 Q F0 2.5(2.2. Interfaces)87 521
-R(to the Outside W)2.5 E(orld)-.75 E F1 .041(There are three w)127 537.2
-R(ays)-.1 E F2(sendmail)2.541 E F1 .041
-(can communicate with the outside w)2.541 F .042(orld, both in recei)-.1
-F .042(ving and)-.25 F 1.195(in sending mail.)102 549.2 R 1.194
-(These are using the con)6.194 F -.15(ve)-.4 G 1.194(ntional UNIX ar).15
-F 1.194(gument v)-.18 F 1.194(ector/return status, speaking)-.15 F
-(SMTP o)102 561.2 Q -.15(ve)-.15 G 2.5(rap).15 G
-(air of UNIX pipes, and speaking SMTP o)-2.5 E -.15(ve)-.15 G 2.5(ra).15
-G 2.5(ni)-2.5 G(nterprocess\(or\) channel.)-2.5 E F0 2.5(2.2.1. Ar)102
-585.2 R(gument v)-.1 E(ector/exit status)-.1 E F1 .52(This technique is the standard UNIX method for communicating with the process.)
-142 601.4 R 3.02(Al)5.52 G(ist)-3.02 E .442
-(of recipients is sent in the ar)117 613.4 R .441(gument v)-.18 F(ector)
--.15 E 2.941(,a)-.4 G .441
-(nd the message body is sent on the standard input.)-2.941 F(An)117
-625.4 Q .351(ything that the mailer prints is simply collected and sent back to the sender if there were an)
--.15 F(y)-.15 E 2.621(problems. The)117 637.4 R -.15(ex)2.621 G .121(it status from the mailer is collected after the message is sent, and a diagnostic)
-.15 F(is printed if appropriate.)117 649.4 Q .32 LW 76 678.8 72 678.8 DL
-80 678.8 76 678.8 DL 84 678.8 80 678.8 DL 88 678.8 84 678.8 DL 92 678.8
-88 678.8 DL 96 678.8 92 678.8 DL 100 678.8 96 678.8 DL 104 678.8 100
-678.8 DL 108 678.8 104 678.8 DL 112 678.8 108 678.8 DL 116 678.8 112
-678.8 DL 120 678.8 116 678.8 DL 124 678.8 120 678.8 DL 128 678.8 124
-678.8 DL 132 678.8 128 678.8 DL 136 678.8 132 678.8 DL 140 678.8 136
-678.8 DL 144 678.8 140 678.8 DL 148 678.8 144 678.8 DL 152 678.8 148
-678.8 DL 156 678.8 152 678.8 DL 160 678.8 156 678.8 DL 164 678.8 160
-678.8 DL 168 678.8 164 678.8 DL 172 678.8 168 678.8 DL 176 678.8 172
-678.8 DL 180 678.8 176 678.8 DL 184 678.8 180 678.8 DL 188 678.8 184
-678.8 DL 192 678.8 188 678.8 DL 196 678.8 192 678.8 DL 200 678.8 196
-678.8 DL 204 678.8 200 678.8 DL 208 678.8 204 678.8 DL 212 678.8 208
-678.8 DL 216 678.8 212 678.8 DL/F4 5/Times-Roman@0 SF(1)93.6 689.2 Q/F5
-8/Times-Roman@0 SF -.12(ex)3.2 K(cept when mailing to a \214le, when).12
-E/F6 8/Times-Italic@0 SF(sendmail)2 E F5(does the deli)2 E -.12(ve)-.2 G
-(ry directly).12 E(.)-.52 E EP
-%%Page: 4 4
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF 192.28(SMM:9-4 SENDMAIL)72 60 R 2.5<8a41>2.5 G
-2.5(nI)-2.5 G(nter)-2.5 E(netw)-.15 E(ork Mail Router)-.1 E 2.5
-(2.2.2. SMTP)102 96 R -.1(ove)2.5 G 2.5(rp).1 G(ipes)-2.5 E/F1 10
-/Times-Roman@0 SF .774
-(The SMTP protocol [Postel82] can be used to run an interacti)142 112.2
-R 1.074 -.15(ve l)-.25 H .774(ock-step interf).15 F .774(ace with)-.1 F
-.507(the mailer)117 124.2 R 5.507(.A)-.55 G .506
-(subprocess is still created, b)-2.5 F .506
-(ut no recipient addresses are passed to the mailer via)-.2 F .075
-(the ar)117 136.2 R .075(gument list.)-.18 F .075(Instead, the)5.075 F
-2.575(ya)-.15 G .075
-(re passed one at a time in commands sent to the processes stan-)-2.575
-F .19(dard input.)117 148.2 R(An)5.19 E .19(ything appearing on the standard output must be a reply code in a special format.)
--.15 F F0 2.5(2.2.3. SMTP)102 172.2 R -.1(ove)2.5 G 2.5(ra).1 G 2.5(nI)
--2.5 G(PC connection)-2.5 E F1 .366
-(This technique is similar to the pre)142 188.4 R .366
-(vious technique, e)-.25 F .366(xcept that it uses a 4.2bsd IPC chan-)
--.15 F .953(nel [UNIX83].)117 200.4 R .953(This method is e)5.953 F .953
-(xceptionally \215e)-.15 F .952
-(xible in that the mailer need not reside on the)-.15 F(same machine.)
-117 212.4 Q(It is normally used to connect to a sendmail process on another machine.)
-5 E F0 2.5(2.3. Operational)87 236.4 R(Description)2.5 E F1 .228
-(When a sender w)127 252.6 R .228
-(ants to send a message, it issues a request to)-.1 F/F2 10
-/Times-Italic@0 SF(sendmail)2.729 E F1 .229(using one of the three)2.729
-F 1.028(methods described abo)102 264.6 R -.15(ve)-.15 G(.).15 E F2
-(Sendmail)6.028 E F1 1.028(operates in tw)3.528 F 3.528(od)-.1 G 1.028
-(istinct phases.)-3.528 F 1.028(In the \214rst phase, it collects)6.028
-F .612(and stores the message.)102 276.6 R .612
-(In the second phase, message deli)5.612 F -.15(ve)-.25 G .612
-(ry occurs.).15 F .612(If there were errors during)5.612 F 1.59
-(processing during the second phase,)102 288.6 R F2(sendmail)4.09 E F1
-1.59(creates and returns a ne)4.09 F 4.09(wm)-.25 G 1.59
-(essage describing the)-4.09 F
-(error and/or returns an status code telling what went wrong.)102 300.6
-Q F0 2.5(2.3.1. Ar)102 324.6 R(gument pr)-.1 E(ocessing and addr)-.18 E
-(ess parsing)-.18 E F1(If)142 340.8 Q F2(sendmail)3.321 E F1 .821
-(is called using one of the tw)3.321 F 3.322(os)-.1 G .822
-(ubprocess techniques, the ar)-3.322 F .822(guments are \214rst)-.18 F
-.797(scanned and option speci\214cations are processed.)117 352.8 R .796
-(Recipient addresses are then collected, either)5.796 F .717(from the command line or from the SMTP RCPT command, and a list of recipients is created.)
-117 364.8 R .347(Aliases are e)117 376.8 R .347
-(xpanded at this step, including mailing lists.)-.15 F .347(As much v)
-5.347 F .346(alidation as possible of the)-.25 F 1.001
-(addresses is done at this step: syntax is check)117 388.8 R 1.002
-(ed, and local addresses are v)-.1 F 1.002(eri\214ed, b)-.15 F 1.002
-(ut detailed)-.2 F .709
-(checking of host names and addresses is deferred until deli)117 400.8 R
--.15(ve)-.25 G(ry).15 E 5.708(.F)-.65 G(orw)-5.858 E .708
-(arding is also performed)-.1 F(as the local addresses are v)117 412.8 Q
-(eri\214ed.)-.15 E F2(Sendmail)142 429 Q F1 .307
-(appends each address to the recipient list after parsing.)2.807 F .307
-(When a name is aliased)5.307 F .322(or forw)117 441 R .322(arded, the old name is retained in the list, and a \215ag is set that tells the deli)
--.1 F -.15(ve)-.25 G .322(ry phase to).15 F .479(ignore this recipient.)
-117 453 R .479(This list is k)5.479 F .479
-(ept free from duplicates, pre)-.1 F -.15(ve)-.25 G .48
-(nting alias loops and duplicate).15 F(messages deli)117 465 Q -.15(ve)
--.25 G(rd to the same recipient, as might occur if a person is in tw).15
-E 2.5(og)-.1 G(roups.)-2.5 E F0 2.5(2.3.2. Message)102 489 R(collection)
-2.5 E F2(Sendmail)142 505.2 Q F1 .454(then collects the message.)2.954 F
-.454(The message should ha)5.454 F .754 -.15(ve a h)-.2 H .453
-(eader at the be).15 F(ginning.)-.15 E .778
-(No formatting requirements are imposed on the message e)117 517.2 R
-.778(xcept that the)-.15 F 3.278(ym)-.15 G .778(ust be lines of te)
--3.278 F(xt)-.15 E .78(\(i.e., binary data is not allo)117 529.2 R 3.28
-(wed\). The)-.25 F .779(header is parsed and stored in memory)3.28 F
-3.279(,a)-.65 G .779(nd the body of)-3.279 F(the message is sa)117 541.2
-Q -.15(ve)-.2 G 2.5(di).15 G 2.5(nat)-2.5 G(emporary \214le.)-2.5 E
-3.227 -.8(To s)142 557.4 T 1.627(implify the program interf).8 F 1.628
-(ace, the message is collected e)-.1 F -.15(ve)-.25 G 4.128(ni).15 G
-4.128(fn)-4.128 G 4.128(oa)-4.128 G 1.628(ddresses were)-4.128 F -.25
-(va)117 569.4 S 2.5(lid. The).25 F
-(message will be returned with an error)2.5 E(.)-.55 E F0 2.5
-(2.3.3. Message)102 593.4 R(deli)2.5 E -.1(ve)-.1 G(ry).1 E F1 -.15(Fo)
-142 609.6 S 2.618(re).15 G .117
-(ach unique mailer and host in the recipient list,)-2.618 F F2(sendmail)
-2.617 E F1 .117(calls the appropriate mailer)2.617 F(.)-.55 E .619
-(Each mailer in)117 621.6 R -.2(vo)-.4 G .619
-(cation sends to all users recei).2 F .619
-(ving the message on one host.)-.25 F .62(Mailers that only)5.62 F
-(accept one recipient at a time are handled properly)117 633.6 Q(.)-.65
-E .47
-(The message is sent to the mailer using one of the same three interf)
-142 649.8 R .47(aces used to submit a)-.1 F 1.465(message to sendmail.)
-117 661.8 R 1.465(Each cop)6.465 F 3.965(yo)-.1 G 3.965(ft)-3.965 G
-1.465(he message is prepended by a customized header)-3.965 F 6.465(.T)
--.55 G(he)-6.465 E 1.455(mailer status code is caught and check)117
-673.8 R 1.455(ed, and a suitable error message gi)-.1 F -.15(ve)-.25 G
-3.955(na).15 G 3.955(sa)-3.955 G(ppropriate.)-3.955 E .589(The e)117
-685.8 R .589(xit code must conform to a system standard or a generic message \(\231Service una)
--.15 F -.25(va)-.2 G(ilable\232\)).25 E(is gi)117 697.8 Q -.15(ve)-.25 G
-(n.).15 E EP
-%%Page: 5 5
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(SENDMAIL \212 An Inter)72 60 Q(netw)-.15 E
-(ork Mail Router)-.1 E(SMM:9-5)194.78 E 2.5(2.3.4. Queueing)102 96 R
--.25(fo)2.5 G 2.5(rr).25 G(etransmission)-2.68 E/F1 10/Times-Roman@0 SF
-.209(If the mailer returned an status that indicated that it might be able to handle the mail later)
-142 112.2 R(,)-.4 E/F2 10/Times-Italic@0 SF(sendmail)117 124.2 Q F1
-(will queue the mail and try ag)2.5 E(ain later)-.05 E(.)-.55 E F0 2.5
-(2.3.5. Retur)102 148.2 R 2.5(nt)-.15 G 2.5(os)-2.5 G(ender)-2.5 E F1
-.588(If errors occur during processing,)142 164.4 R F2(sendmail)3.088 E
-F1 .589(returns the message to the sender for retrans-)3.088 F 3.133
-(mission. The)117 176.4 R .632(letter can be mailed back or written in the \214le \231dead.letter\232 in the sender')
-3.133 F 3.132(sh)-.55 G(ome)-3.132 E(directory)117 190.4 Q/F3 7
-/Times-Roman@0 SF(2)-4 I F1(.)4 I F0 2.5(2.4. Message)87 214.4 R
-(Header Editing)2.5 E F1 1.756
-(Certain editing of the message header occurs automatically)127 230.6 R
-6.756(.H)-.65 G 1.756(eader lines can be inserted)-6.756 F .41
-(under control of the con\214guration \214le.)102 242.6 R .41
-(Some lines can be mer)5.41 F .41(ged; for e)-.18 F .41
-(xample, a \231From:\232 line and)-.15 F 2.5<6199>102 254.6 S
-(Full-name:\232 line can be mer)-2.5 E(ged under certain circumstances.)
--.18 E F0 2.5(2.5. Con\214guration)87 278.6 R(File)2.5 E F1 .798(Almost all con\214guration information is read at runtime from an ASCII \214le, encoding macro)
-127 294.8 R .679(de\214nitions \(de\214ning the v)102 306.8 R .678(alue of macros used internally\), header declarations \(telling sendmail the)
--.25 F 1.009(format of header lines that it will process specially)102
-318.8 R 3.509(,i)-.65 G 1.009
-(.e., lines that it will add or reformat\), mailer)-3.509 F .478
-(de\214nitions \(gi)102 330.8 R .478(ving information such as the location and characteristics of each mailer\), and address)
--.25 F(re)102 342.8 Q .428
-(writing rules \(a limited production system to re)-.25 F .429
-(write addresses which is used to parse and re)-.25 F(write)-.25 E
-(the addresses\).)102 354.8 Q 2.828 -.8(To i)127 371 T(mpro).8 E 1.528
--.15(ve p)-.15 H 1.228(erformance when reading the con\214guration \214le, a memory image can be pro-)
-.15 F 2.5(vided. This)102 383 R(pro)2.5 E
-(vides a \231compiled\232 form of the con\214guration \214le.)-.15 E F0
-2.5(3. USA)72 407 R(GE AND IMPLEMENT)-.55 E -.95(AT)-.9 G(ION).95 E 2.5
-(3.1. Ar)87 431 R(guments)-.1 E F1(Ar)127 447.2 Q .376
-(guments may be \215ags and addresses.)-.18 F .377(Flags set v)5.377 F
-.377(arious processing options.)-.25 F -.15(Fo)5.377 G(llo).15 E .377
-(wing \215ag)-.25 F(ar)102 459.2 Q .281(guments, address ar)-.18 F .281
-(guments may be gi)-.18 F -.15(ve)-.25 G .281
-(n, unless we are running in SMTP mode.).15 F .28(Addresses fol-)5.28 F
-(lo)102 471.2 Q 2.5(wt)-.25 G(he syntax in RFC822 [Crock)-2.5 E
-(er82] for ARP)-.1 E(ANET address formats.)-.92 E
-(In brief, the format is:)5 E 12.5(\(1\) An)107 487.4 R
-(ything in parentheses is thro)-.15 E(wn a)-.25 E -.1(wa)-.15 G 2.5(y\()
-.1 G(as a comment\).)-2.5 E 12.5(\(2\) An)107 503.6 R .051
-(ything in angle brack)-.15 F .051(ets \(\231<)-.1 F .051
-(>\232\) is preferred o)1.666 F -.15(ve)-.15 G 2.551(ra).15 G -.15(ny)
--2.551 G .051(thing else.).15 F .051(This rule implements the)5.051 F
-(ARP)133.66 515.6 Q(ANET standard that addresses of the form)-.92 E
-(user name <machine-address>)173.66 531.8 Q(will send to the electronic \231machine-address\232 rather than the human \231user name.)
-133.66 548 Q<9a>-.7 E 12.5(\(3\) Double)107 564.2 R 2.246(quotes \()
-4.746 F -2.754 2.5("\) q)2.5 H 2.246
-(uote phrases; backslashes quote characters.)-2.5 F 2.246
-(Backslashes are more)7.246 F(po)133.66 576.2 Q .654(werful in that the)
--.25 F 3.154(yw)-.15 G .655(ill cause otherwise equi)-3.154 F -.25(va)
--.25 G .655(lent phrases to compare dif).25 F .655(ferently \212 for)
--.25 F -.15(ex)133.66 588.2 S(ample,).15 E F2(user)2.5 E F1(and)2.5 E F2
-("user")2.5 E F1(are equi)2.5 E -.25(va)-.25 G(lent, b).25 E(ut)-.2 E F2
-(\\user)2.5 E F1(is dif)2.5 E(ferent from either of them.)-.25 E -.15
-(Pa)127 604.4 S 1.12(rentheses, angle brack).15 F 1.12
-(ets, and double quotes must be properly balanced and nested.)-.1 F(The)
-6.12 E(re)102 618.4 Q(writing rules control remaining parsing)-.25 E F3
-(3)-4 I F1(.)4 I .32 LW 76 646 72 646 DL 80 646 76 646 DL 84 646 80 646
-DL 88 646 84 646 DL 92 646 88 646 DL 96 646 92 646 DL 100 646 96 646 DL
-104 646 100 646 DL 108 646 104 646 DL 112 646 108 646 DL 116 646 112 646
-DL 120 646 116 646 DL 124 646 120 646 DL 128 646 124 646 DL 132 646 128
-646 DL 136 646 132 646 DL 140 646 136 646 DL 144 646 140 646 DL 148 646
-144 646 DL 152 646 148 646 DL 156 646 152 646 DL 160 646 156 646 DL 164
-646 160 646 DL 168 646 164 646 DL 172 646 168 646 DL 176 646 172 646 DL
-180 646 176 646 DL 184 646 180 646 DL 188 646 184 646 DL 192 646 188 646
-DL 196 646 192 646 DL 200 646 196 646 DL 204 646 200 646 DL 208 646 204
-646 DL 212 646 208 646 DL 216 646 212 646 DL/F4 5/Times-Roman@0 SF(2)
-93.6 656.4 Q/F5 8/Times-Roman@0 SF(Ob)3.2 I(viously)-.12 E 2.226(,i)-.52
-G 2.226(ft)-2.226 G .226(he site gi)-2.226 F .226(ving the error is not the originating site, the only reasonable option is to mail back to the sender)
--.2 F 4.227(.A)-.44 G(lso,)-4.227 E .191(there are man)72 669.2 R 2.191
-(ym)-.12 G .19(ore error disposition options, b)-2.191 F .19(ut the)-.16
-F 2.19(yo)-.12 G .19(nly ef)-2.19 F .19(fect the error message \212 the \231return to sender\232 function is al)
--.2 F -.08(wa)-.08 G .19(ys han-).08 F(dled in one of these tw)72 678.8
-Q 2(ow)-.08 G(ays.)-2.08 E F4(3)93.6 689.2 Q F5
-(Disclaimer: Some special processing is done after re)3.2 I
-(writing local names; see belo)-.2 E -.52(w.)-.2 G EP
-%%Page: 6 6
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF 192.28(SMM:9-6 SENDMAIL)72 60 R 2.5<8a41>2.5 G
-2.5(nI)-2.5 G(nter)-2.5 E(netw)-.15 E(ork Mail Router)-.1 E 2.5
-(3.2. Mail)87 96 R(to Files and Pr)2.5 E(ograms)-.18 E/F1 10
-/Times-Roman@0 SF .609(Files and programs are le)127 112.2 R .609
-(gitimate message recipients.)-.15 F .609(Files pro)5.609 F .609
-(vide archi)-.15 F -.25(va)-.25 G 3.109(ls).25 G .61(torage of mes-)
--3.109 F .124(sages, useful for project administration and history)102
-124.2 R 5.124(.P)-.65 G .124(rograms are useful as recipients in a v)
--5.124 F .124(ariety of)-.25 F .69(situations, for e)102 136.2 R .691(xample, to maintain a public repository of systems messages \(such as the Berk)
--.15 F(ele)-.1 E(y)-.15 E/F2 10/Times-Italic@0 SF(msgs)102 148.2 Q F1
-(program, or the MARS system [Sattle)2.5 E(y78]\).)-.15 E(An)127 164.4 Q
-3.188(ya)-.15 G .688(ddress passing through the initial parsing algorithm as a local address \(i.e, not appear)
--3.188 F(-)-.2 E .276(ing to be a v)102 176.4 R .276
-(alid address for another mailer\) is scanned for tw)-.25 F 2.776(os)-.1
-G .277(pecial cases.)-2.776 F .277(If pre\214x)5.277 F .277(ed by a v)
--.15 F(erti-)-.15 E .18(cal bar \(\231)102 188.4 R .833<7c9a>.833 G 2.68
-(\)t)-.833 G .179
-(he rest of the address is processed as a shell command.)-2.68 F .179
-(If the user name be)5.179 F .179(gins with a)-.15 F(slash mark \(\231/)
-102 200.4 Q
-(\232\) the name is used as a \214le name, instead of a login name.).833
-E .241(Files that ha)127 216.6 R .541 -.15(ve s)-.2 H .241
-(etuid or setgid bits set b).15 F .241(ut no e)-.2 F -.15(xe)-.15 G .241
-(cute bits set ha).15 F .541 -.15(ve t)-.2 H .241(hose bits honored if)
-.15 F F2(send-)2.742 E(mail)102 228.6 Q F1(is running as root.)2.5 E F0
-2.5(3.3. Aliasing,)87 252.6 R -.25(Fo)2.5 G(rwarding, Inclusion).25 E F2
-(Sendmail)127 268.8 Q F1 1.075(reroutes mail three w)3.575 F 3.575
-(ays. Aliasing)-.1 F 1.074(applies system wide.)3.575 F -.15(Fo)6.074 G
-(rw).15 E 1.074(arding allo)-.1 F 1.074(ws each)-.25 F .233
-(user to reroute incoming mail destined for that account.)102 280.8 R
-.233(Inclusion directs)5.233 F F2(sendmail)2.733 E F1 .233
-(to read a \214le for)2.733 F 2.5(al)102 292.8 S
-(ist of addresses, and is normally used in conjunction with aliasing.)
--2.5 E F0 2.5(3.3.1. Aliasing)102 316.8 R F1 1.554
-(Aliasing maps names to address lists using a system-wide \214le.)142
-333 R 1.553(This \214le is inde)6.553 F -.15(xe)-.15 G 4.053(dt).15 G(o)
--4.053 E 1.1(speed access.)117 345 R 1.101
-(Only names that parse as local are allo)6.1 F 1.101
-(wed as aliases; this guarantees a unique)-.25 F -.1(ke)117 357 S 2.5
-(y\()-.05 G(since there are no nicknames for the local host\).)-2.5 E F0
-2.5(3.3.2. F)102 381 R(orwarding)-.25 E F1 .651
-(After aliasing, recipients that are local and v)142 397.2 R .651
-(alid are check)-.25 F .65(ed for the e)-.1 F .65
-(xistence of a \231.for)-.15 F(-)-.2 E -.1(wa)117 409.2 S .493
-(rd\232 \214le in their home directory).1 F 5.493(.I)-.65 G 2.994(fi)
--5.493 G 2.994(te)-2.994 G .494(xists, the message is)-3.144 F F2(not)
-2.994 E F1 .494(sent to that user)2.994 F 2.994(,b)-.4 G .494
-(ut rather to)-3.194 F .37(the list of users in that \214le.)117 421.2 R
-.37
-(Often this list will contain only one address, and the feature will be)
-5.37 F(used for netw)117 433.2 Q(ork mail forw)-.1 E(arding.)-.1 E -.15
-(Fo)142 449.4 S(rw).15 E 1.151
-(arding also permits a user to specify a pri)-.1 F -.25(va)-.25 G 1.152
-(te incoming mailer).25 F 6.152(.F)-.55 G 1.152(or e)-6.302 F 1.152
-(xample, for)-.15 F(-)-.2 E -.1(wa)117 461.4 S(rding to:).1 E -2.5 .833
-("| /)157 477.6 T(usr/local/ne)-.833 E(wmail myname")-.25 E
-(will use a dif)117 493.8 Q(ferent incoming mailer)-.25 E(.)-.55 E F0
-2.5(3.3.3. Inclusion)102 517.8 R F1
-(Inclusion is speci\214ed in RFC 733 [Crock)142 534 Q(er77a] syntax:)-.1
-E(:Include: pathname)157 550.2 Q .391
-(An address of this form reads the \214le speci\214ed by)117 566.4 R F2
-(pathname)2.891 E F1 .391(and sends to all users listed in that)2.891 F
-(\214le.)117 578.4 Q .644(The intent is)142 594.6 R F2(not)3.144 E F1
-.644(to support direct use of this feature, b)3.144 F .644
-(ut rather to use this as a subset of)-.2 F 2.5(aliasing. F)117 606.6 R
-(or e)-.15 E(xample, an alias of the form:)-.15 E
-(project: :include:/usr/project/userlist)157 622.8 Q 1.93(is a method of letting a project maintain a mailing list without interaction with the system)
-117 639 R(administration, e)117 651 Q -.15(ve)-.25 G 2.5(ni).15 G 2.5
-(ft)-2.5 G(he alias \214le is protected.)-2.5 E 2.024
-(It is not necessary to reb)142 667.2 R 2.024(uild the inde)-.2 F 4.524
-(xo)-.15 G 4.524(nt)-4.524 G 2.025
-(he alias database when a :include: list is)-4.524 F(changed.)117 679.2
-Q EP
-%%Page: 7 7
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(SENDMAIL \212 An Inter)72 60 Q(netw)-.15 E
-(ork Mail Router)-.1 E(SMM:9-7)194.78 E 2.5(3.4. Message)87 96 R
-(Collection)2.5 E/F1 10/Times-Roman@0 SF .857
-(Once all recipient addresses are parsed and v)127 112.2 R .857
-(eri\214ed, the message is collected.)-.15 F .856(The message)5.857 F
-(comes in tw)102 124.2 Q 2.5(op)-.1 G
-(arts: a message header and a message body)-2.5 E 2.5(,s)-.65 G
-(eparated by a blank line.)-2.5 E
-(The header is formatted as a series of lines of the form)127 140.4 Q
-(\214eld-name: \214eld-v)178 156.6 Q(alue)-.25 E(Field-v)102 172.8 Q
-1.366(alue can be split across lines by starting the follo)-.25 F 1.366
-(wing lines with a space or a tab)-.25 F 6.366(.S)-.4 G(ome)-6.366 E
-.211(header \214elds ha)102 184.8 R .511 -.15(ve s)-.2 H .211
-(pecial internal meaning, and ha).15 F .511 -.15(ve a)-.2 H .211
-(ppropriate special processing.).15 F .21(Other headers)5.21 F
-(are simply passed through.)102 196.8 Q
-(Some header \214elds may be added automatically)5 E 2.5(,s)-.65 G
-(uch as time stamps.)-2.5 E .86(The body is a series of te)127 213 R
-.861(xt lines.)-.15 F .861
-(It is completely uninterpreted and untouched, e)5.861 F .861
-(xcept that)-.15 F 1.43(lines be)102 225 R 1.43(ginning with a dot ha)
--.15 F 1.729 -.15(ve t)-.2 H 1.429(he dot doubled when transmitted o).15
-F -.15(ve)-.15 G 3.929(ra).15 G 3.929(nS)-3.929 G 1.429(MTP channel.)
--3.929 F(This)6.429 E -.15(ex)102 237 S
-(tra dot is stripped by the recei).15 E -.15(ve)-.25 G -.55(r.).15 G F0
-2.5(3.5. Message)87 261 R(Deli)2.5 E -.1(ve)-.1 G(ry).1 E F1 .028
-(The send queue is ordered by recei)127 277.2 R .029
-(ving host before transmission to implement message batch-)-.25 F 3.07
-(ing. Each)102 289.2 R .57(address is mark)3.07 F .57
-(ed as it is sent so rescanning the list is safe.)-.1 F .57(An ar)5.57 F
-.57(gument list is b)-.18 F .57(uilt as)-.2 F 1.138(the scan proceeds.)
-102 301.2 R 1.139
-(Mail to \214les is detected during the scan of the send list.)6.139 F
-1.139(The interf)6.139 F 1.139(ace to the)-.1 F(mailer is performed using one of the techniques described in section 2.2.)
-102 313.2 Q .996(After a connection is established,)127 329.4 R/F2 10
-/Times-Italic@0 SF(sendmail)3.496 E F1(mak)3.495 E .995(es the per)-.1 F
-.995(-mailer changes to the header and)-.2 F .236
-(sends the result to the mailer)102 341.4 R 5.236(.I)-.55 G 2.736(fa)
--5.236 G .537 -.15(ny m)-2.736 H .237(ail is rejected by the mailer).15
-F 2.737(,a\215)-.4 G .237(ag is set to in)-2.737 F -.2(vo)-.4 G .437 -.1
-(ke t).2 H .237(he return-).1 F(to-sender function after all deli)102
-353.4 Q -.15(ve)-.25 G(ry completes.).15 E F0 2.5(3.6. Queued)87 377.4 R
-(Messages)2.5 E F1 .163(If the mailer returns a \231temporary f)127
-393.6 R .163(ailure\232 e)-.1 F .162(xit status, the message is queued.)
--.15 F 2.662(Ac)5.162 G .162(ontrol \214le is)-2.662 F .85
-(used to describe the recipients to be sent to and v)102 405.6 R .851
-(arious other parameters.)-.25 F .851(This control \214le is for)5.851 F
-(-)-.2 E 1.011(matted as a series of lines, each describing a sender)102
-417.6 R 3.511(,ar)-.4 G 1.011(ecipient, the time of submission, or some)
--3.511 F .776(other salient parameter of the message.)102 429.6 R .776
-(The header of the message is stored in the control \214le, so)5.776 F(that the associated data \214le in the queue is just the temporary \214le that w)
-102 441.6 Q(as originally collected.)-.1 E F0 2.5(3.7. Con\214guration)
-87 465.6 R F1 .493(Con\214guration is controlled primarily by a con\214guration \214le read at startup.)
-127 481.8 R F2(Sendmail)5.492 E F1(should)2.992 E
-(not need to be recomplied e)102 493.8 Q(xcept)-.15 E 12.5(\(1\) T)107
-510 R 2.5(oc)-.8 G(hange operating systems \(V6, V7/32V)-2.5 E 2.5(,4)
--1.29 G(BSD\).)-2.5 E 12.5(\(2\) T)107 526.2 R 2.5(or)-.8 G(emo)-2.5 E
-.3 -.15(ve o)-.15 H 2.5(ri).15 G
-(nsert the DBM \(UNIX database\) library)-2.5 E(.)-.65 E 12.5(\(3\) T)
-107 542.4 R 2.5(oc)-.8 G(hange ARP)-2.5 E(ANET reply codes.)-.92 E 12.5
-(\(4\) T)107 558.6 R 2.5(oa)-.8 G
-(dd headers \214elds requiring special processing.)-2.5 E .434
-(Adding mailers or changing parsing \(i.e., re)102 574.8 R .435
-(writing\) or routing information does not require recom-)-.25 F
-(pilation.)102 586.8 Q 1.317(If the mail is being sent by a local user)
-127 603 R 3.817(,a)-.4 G 1.317(nd the \214le \231.mailcf\232 e)-3.817 F
-1.317(xists in the sender')-.15 F 3.817(sh)-.55 G(ome)-3.817 E
-(directory)102 615 Q 2.721(,t)-.65 G .221(hat \214le is read as a con\214guration \214le after the system con\214guration \214le.)
--2.721 F .222(The primary use)5.222 F
-(of this feature is to add header lines.)102 627 Q 3.25(The con\214guration \214le encodes macro de\214nitions, header de\214nitions, mailer de\214nitions,)
-127 643.2 R(re)102 655.2 Q(writing rules, and options.)-.25 E F0 2.5
-(3.7.1. Macr)102 679.2 R(os)-.18 E F1 .332
-(Macros can be used in three w)142 695.4 R 2.833(ays. Certain)-.1 F .333
-(macros transmit unstructured te)2.833 F .333(xtual informa-)-.15 F .07
-(tion into the mail system, such as the name)117 707.4 R F2(sendmail)
-2.57 E F1 .07(will use to identify itself in error messages.)2.57 F
-1.247(Other macros transmit information from)117 719.4 R F2(sendmail)
-3.747 E F1 1.247(to the con\214guration \214le for use in creating)3.747
-F EP
-%%Page: 8 8
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF 192.28(SMM:9-8 SENDMAIL)72 60 R 2.5<8a41>2.5 G
-2.5(nI)-2.5 G(nter)-2.5 E(netw)-.15 E(ork Mail Router)-.1 E/F1 10
-/Times-Roman@0 SF .312(other \214elds \(such as ar)117 96 R .312
-(gument v)-.18 F .312(ectors to mailers\); e.g., the name of the sender)
--.15 F 2.811(,a)-.4 G .311(nd the host and)-2.811 F .848
-(user of the recipient.)117 108 R .848
-(Other macros are unused internally)5.848 F 3.348(,a)-.65 G .848
-(nd can be used as shorthand in the)-3.348 F(con\214guration \214le.)117
-120 Q F0 2.5(3.7.2. Header)102 144 R(declarations)2.5 E F1 .355
-(Header declarations inform)142 160.2 R/F2 10/Times-Italic@0 SF
-(sendmail)2.854 E F1 .354(of the format of kno)2.854 F .354
-(wn header lines.)-.25 F(Kno)5.354 E .354(wledge of)-.25 F 2.5(af)117
-172.2 S .5 -.25(ew h)-2.5 H(eader lines is b).25 E(uilt into)-.2 E F2
-(sendmail)2.5 E F1 2.5(,s)C
-(uch as the \231From:\232 and \231Date:\232 lines.)-2.5 E 1.201(Most con\214gured headers will be automatically inserted in the outgoing message if the)
-142 188.4 R(y)-.15 E(don')117 200.4 Q 2.5(te)-.18 G
-(xist in the incoming message.)-2.65 E
-(Certain headers are suppressed by some mailers.)5 E F0 2.5
-(3.7.3. Mailer)102 224.4 R(declarations)2.5 E F1 1.756
-(Mailer declarations tell)142 240.6 R F2(sendmail)4.256 E F1 1.756
-(of the v)4.256 F 1.756(arious mailers a)-.25 F -.25(va)-.2 G 1.756
-(ilable to it.).25 F 1.755(The de\214nition)6.755 F .119
-(speci\214es the internal name of the mailer)117 252.6 R 2.619(,t)-.4 G
-.12(he pathname of the program to call, some \215ags associ-)-2.619 F
-2.036(ated with the mailer)117 264.6 R 4.536(,a)-.4 G 2.036(nd an ar)
--4.536 F 2.036(gument v)-.18 F 2.036
-(ector to be used on the call; this v)-.15 F 2.035(ector is macro-)-.15
-F -.15(ex)117 276.6 S(panded before use.).15 E F0 2.5(3.7.4. Addr)102
-300.6 R(ess r)-.18 E(ewriting rules)-.18 E F1 .458
-(The heart of address parsing in)142 316.8 R F2(sendmail)2.959 E F1 .459
-(is a set of re)2.959 F .459(writing rules.)-.25 F .459
-(These are an ordered)5.459 F .561
-(list of pattern-replacement rules, \(some)117 328.8 R .561(what lik)
--.25 F 3.061(eap)-.1 G .561(roduction system, e)-3.061 F .56
-(xcept that order is criti-)-.15 F 1.905
-(cal\), which are applied to each address.)117 340.8 R 1.905
-(The address is re)6.905 F 1.906(written te)-.25 F 1.906
-(xtually until it is either)-.15 F(re)117 352.8 Q .308
-(written into a special canonical form \(i.e., a \(mailer)-.25 F 2.807
-(,h)-.4 G .307(ost, user\) 3-tuple, such as {arpanet, usc-)-2.807 F .64
-(isif, postel} representing the address \231postel@usc-isif\232\), or it f)
-117 364.8 R .641(alls of)-.1 F 3.141(ft)-.25 G .641(he end.)-3.141 F
-.641(When a pattern)5.641 F(matches, the rule is reapplied until it f)
-117 376.8 Q(ails.)-.1 E 1.222(The con\214guration \214le also supports the editing of addresses into dif)
-142 393 R 1.221(ferent formats.)-.25 F -.15(Fo)6.221 G(r).15 E -.15(ex)
-117 405 S(ample, an address of the form:).15 E(ucsfcgl!tef)157 421.2 Q
-(might be mapped into:)117 437.4 Q(tef@ucsfcgl.UUCP)157 453.6 Q
-(to conform to the domain syntax.)117 469.8 Q -.35(Tr)5 G
-(anslations can also be done in the other direction.).35 E F0 2.5
-(3.7.5. Option)102 493.8 R(setting)2.5 E F1 1.168(There are se)142 510 R
--.15(ve)-.25 G 1.169
-(ral options that can be set from the con\214guration \214le.).15 F
-1.169(These include the)6.169 F(pathnames of v)117 522 Q
-(arious support \214les, timeouts, def)-.25 E(ault modes, etc.)-.1 E F0
-2.5(4. COMP)72 546 R(ARISON WITH O)-.74 E(THER MAILERS)-.4 E 2.5
-(4.1. Deli)87 570 R -.1(ve)-.1 G(rmail).1 E F2(Sendmail)127 586.2 Q F1
-(is an outgro)2.5 E(wth of)-.25 E F2(delivermail)2.5 E F1 5(.T)C
-(he primary dif)-5 E(ferences are:)-.25 E 12.5(\(1\) Con\214guration)107
-602.4 R .273(information is not compiled in.)2.773 F .272
-(This change simpli\214es man)5.273 F 2.772(yo)-.15 G 2.772(ft)-2.772 G
-.272(he problems)-2.772 F(of mo)133.66 614.4 Q(ving to other machines.)
--.15 E(It also allo)5 E(ws easy deb)-.25 E(ugging of ne)-.2 E 2.5(wm)
--.25 G(ailers.)-2.5 E 12.5(\(2\) Address)107 630.6 R .681
-(parsing is more \215e)3.181 F 3.182(xible. F)-.15 F .682(or e)-.15 F
-(xample,)-.15 E F2(delivermail)3.182 E F1 .682(only supported one g)
-3.182 F(ate)-.05 E -.1(wa)-.25 G 3.182(yt).1 G(o)-3.182 E(an)133.66
-642.6 Q 2.817(yn)-.15 G(etw)-2.817 E .317(ork, whereas)-.1 F F2
-(sendmail)2.817 E F1 .317(can be sensiti)2.817 F .616 -.15(ve t)-.25 H
-2.816(oh).15 G .316(ost names and reroute to dif)-2.816 F .316(ferent g)
--.25 F(ate-)-.05 E -.1(wa)133.66 654.6 S(ys.).1 E 12.5(\(3\) F)107 670.8
-R(orw)-.15 E 1.627(arding and :include: features eliminate the requirement that the system alias \214le be)
--.1 F .074(writable by an)133.66 682.8 R 2.574(yu)-.15 G .073(ser \(or that an update program be written, or that the system administration)
--2.574 F(mak)133.66 694.8 Q 2.5(ea)-.1 G(ll changes\).)-2.5 E(\(4\))107
-711 Q F2(Sendmail)15 E F1 .4(supports message batching across netw)2.9 F
-.401(orks when a message is being sent to mul-)-.1 F(tiple recipients.)
-133.66 723 Q EP
-%%Page: 9 9
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(SENDMAIL \212 An Inter)72 60 Q(netw)-.15 E
-(ork Mail Router)-.1 E(SMM:9-9)194.78 E/F1 10/Times-Roman@0 SF 12.5
-(\(5\) A)107 96 R .875(mail queue is pro)3.375 F .874(vided in)-.15 F/F2
-10/Times-Italic@0 SF(sendmail.)3.374 E F1 .874(Mail that cannot be deli)
-5.874 F -.15(ve)-.25 G .874(red immediately b).15 F .874(ut can)-.2 F
-1.063(potentially be deli)133.66 108 R -.15(ve)-.25 G 1.064
-(red later is stored in this queue for a later retry).15 F 6.064(.T)-.65
-G 1.064(he queue also pro-)-6.064 F .896(vides a b)133.66 120 R(uf)-.2 E
-.896(fer ag)-.25 F .895(ainst system crashes; after the message has been collected it may be reli-)
--.05 F(ably redeli)133.66 132 Q -.15(ve)-.25 G(red e).15 E -.15(ve)-.25
-G 2.5(ni).15 G 2.5(ft)-2.5 G(he system crashes during the initial deli)
--2.5 E -.15(ve)-.25 G(ry).15 E(.)-.65 E(\(6\))107 148.2 Q F2(Sendmail)15
-E F1 .197(uses the netw)2.696 F .197(orking support pro)-.1 F .197
-(vided by 4.2BSD to pro)-.15 F .197(vide a direct interf)-.15 F .197
-(ace net-)-.1 F -.1(wo)133.66 160.2 S .07(rks such as the ARP).1 F .07
-(ANET and/or Ethernet using SMTP \(the Simple Mail T)-.92 F .07
-(ransfer Proto-)-.35 F(col\) o)133.66 172.2 Q -.15(ve)-.15 G 2.5(raT).15
-G(CP/IP connection.)-2.5 E F0 2.5(4.2. MMDF)87 196.2 R F1 .957
-(MMDF [Crock)127 212.4 R .957(er79] spans a wider problem set than)-.1 F
-F2(sendmail)3.458 E F1 5.958(.F)C .958(or e)-6.108 F .958
-(xample, the domain of)-.15 F .721(MMDF includes a \231phone netw)102
-224.4 R .721(ork\232 mailer)-.1 F 3.221(,w)-.4 G(hereas)-3.221 E F2
-(sendmail)3.221 E F1 .721(calls on pree)3.221 F .72
-(xisting mailers in most)-.15 F(cases.)102 236.4 Q .175(MMDF and)127
-252.6 R F2(sendmail)2.675 E F1 .175
-(both support aliasing, customized mailers, message batching, automatic)
-2.675 F(forw)102 264.6 Q .792(arding to g)-.1 F(ate)-.05 E -.1(wa)-.25 G
-.792(ys, queueing, and retransmission.).1 F .792(MMDF supports tw)5.792
-F .792(o-stage timeout, which)-.1 F F2(sendmail)102 276.6 Q F1
-(does not support.)2.5 E
-(The con\214guration for MMDF is compiled into the code)127 294.8 Q/F3 7
-/Times-Roman@0 SF(4)-4 I F1(.)4 I .037
-(Since MMDF does not consider backw)127 311 R .037
-(ards compatibility as a design goal, the address parsing)-.1 F
-(is simpler b)102 323 Q(ut much less \215e)-.2 E(xible.)-.15 E 1.159
-(It is some)127 341.2 R 1.159(what harder to inte)-.25 F 1.159
-(grate a ne)-.15 F 3.659(wc)-.25 G(hannel)-3.659 E F3(5)-4 I F1 1.159
-(into MMDF)3.659 4 N 6.16(.I)-.8 G 3.66(np)-6.16 G(articular)-3.66 E
-3.66(,M)-.4 G 1.16(MDF must)-3.66 F(kno)102 353.2 Q 3.225(wt)-.25 G .725
-(he location and format of host tables for all channels, and the channel must speak a special)
--3.225 F 2.525(protocol. This)102 365.2 R(allo)2.525 E .025
-(ws MMDF to do additional v)-.25 F .025(eri\214cation \(such as v)-.15 F
-.025(erifying host names\) at submis-)-.15 F(sion time.)102 377.2 Q
-1.761(MMDF strictly separates the submission and deli)127 393.4 R -.15
-(ve)-.25 G 1.761(ry phases.).15 F(Although)6.761 E F2(sendmail)4.261 E
-F1 1.76(has the)4.261 F .784(concept of each of these stages, the)102
-405.4 R 3.284(ya)-.15 G .784(re inte)-3.284 F .785
-(grated into one program, whereas in MMDF the)-.15 F 3.285(ya)-.15 G(re)
--3.285 E(split into tw)102 417.4 Q 2.5(op)-.1 G(rograms.)-2.5 E F0 2.5
-(4.3. Message)87 441.4 R(Pr)2.5 E(ocessing Module)-.18 E F1 .925(The Message Processing Module \(MPM\) discussed by Postel [Postel79b] matches)
-127 457.6 R F2(sendmail)3.425 E F1 1.364
-(closely in terms of its basic architecture.)102 469.6 R(Ho)6.364 E(we)
--.25 E -.15(ve)-.25 G 2.164 -.4(r, l).15 H(ik).4 E 3.864(eM)-.1 G(MDF)
--3.864 E 3.864(,t)-.8 G 1.365(he MPM includes the netw)-3.864 F(ork)-.1
-E(interf)102 481.6 Q(ace softw)-.1 E(are as part of its domain.)-.1 E
-.408(MPM also postulates a duple)127 497.8 R 2.907(xc)-.15 G .407
-(hannel to the recei)-2.907 F -.15(ve)-.25 G 1.207 -.4(r, a).15 H 2.907
-(sd).4 G .407(oes MMDF)-2.907 F 2.907(,t)-.8 G .407(hus allo)-2.907 F
-.407(wing simpler)-.25 F .302
-(handling of errors by the mailer than is possible in)102 509.8 R F2
-(sendmail)2.802 E F1 5.302(.W)C .302(hen a message queued by)-5.302 F F2
-(sendmail)2.802 E F1 .23(is sent, an)102 521.8 R 2.73(ye)-.15 G .23
-(rrors must be returned to the sender by the mailer itself.)-2.73 F .229
-(Both MPM and MMDF mail-)5.229 F .883(ers can return an immediate error response, and a single error processor can create an appropriate)
-102 533.8 R(response.)102 545.8 Q 2.24(MPM prefers passing the message as a structured object, with type-length-v)
-127 564 R 2.24(alue tuples)-.25 F F3(6)-4 I F1(.)4 I .874(Such a con)102
-576 R -.15(ve)-.4 G .874(ntion requires a much higher de).15 F .875
-(gree of cooperation between mailers than is required)-.15 F(by)102 588
-Q F2(sendmail)2.796 E F1 5.296(.M)C .296(PM also assumes a uni)-5.296 F
--.15(ve)-.25 G .296
-(rsally agreed upon internet name space \(with each address).15 F
-(in the form of a net-host-user tuple\), which)102 600 Q F2(sendmail)2.5
-E F1(does not.)2.5 E .32 LW 76 642 72 642 DL 80 642 76 642 DL 84 642 80
-642 DL 88 642 84 642 DL 92 642 88 642 DL 96 642 92 642 DL 100 642 96 642
-DL 104 642 100 642 DL 108 642 104 642 DL 112 642 108 642 DL 116 642 112
-642 DL 120 642 116 642 DL 124 642 120 642 DL 128 642 124 642 DL 132 642
-128 642 DL 136 642 132 642 DL 140 642 136 642 DL 144 642 140 642 DL 148
-642 144 642 DL 152 642 148 642 DL 156 642 152 642 DL 160 642 156 642 DL
-164 642 160 642 DL 168 642 164 642 DL 172 642 168 642 DL 176 642 172 642
-DL 180 642 176 642 DL 184 642 180 642 DL 188 642 184 642 DL 192 642 188
-642 DL 196 642 192 642 DL 200 642 196 642 DL 204 642 200 642 DL 208 642
-204 642 DL 212 642 208 642 DL 216 642 212 642 DL/F4 5/Times-Roman@0 SF
-(4)93.6 652.4 Q/F5 8/Times-Roman@0 SF .179(Dynamic con\214guration tables are currently being considered for MMDF; allo)
-3.2 J .18(wing the installer to select either compiled or dy-)-.2 F
-(namic tables.)72 665.2 Q F4(5)93.6 675.6 Q F5(The MMDF equi)3.2 I -.2
-(va)-.2 G(lent of a).2 E/F6 8/Times-Italic@0 SF(sendmail)2 E F5
-(\231mailer)2 E -.56<2e9a>-.44 G F4(6)93.6 689.2 Q F5
-(This is similar to the NBS standard.)3.2 I EP
-%%Page: 10 10
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF 187.28(SMM:9-10 SENDMAIL)72 60 R 2.5<8a41>2.5 G
-2.5(nI)-2.5 G(nter)-2.5 E(netw)-.15 E(ork Mail Router)-.1 E 2.5(5. EV)72
-96 R(ALU)-1.35 E -.95(AT)-.6 G(IONS AND FUTURE PLANS).95 E/F1 10
-/Times-Italic@0 SF(Sendmail)112 112.2 Q/F2 10/Times-Roman@0 SF 1.851
-(is designed to w)4.351 F 1.851(ork in a nonhomogeneous en)-.1 F 4.352
-(vironment. Ev)-.4 F 1.852(ery attempt is made to)-.15 F -.2(avo)87
-124.2 S 1.037
-(id imposing unnecessary constraints on the underlying mailers.).2 F
-1.036(This goal has dri)6.036 F -.15(ve)-.25 G 3.536(nm).15 G 1.036
-(uch of the)-3.536 F 2.723(design. One)87 136.2 R .223(of the major problems has been the lack of a uniform address space, as postulated in [Pos-)
-2.723 F(tel79a] and [Postel79b].)87 148.2 Q 2.647(An)112 164.4 S .147(onuniform address space implies that a path will be speci\214ed in all addresses, either e)
--2.647 F(xplicitly)-.15 E .472
-(\(as part of the address\) or implicitly \(as with implied forw)87
-176.4 R .473(arding to g)-.1 F(ate)-.05 E -.1(wa)-.25 G 2.973
-(ys\). This).1 F .473(restriction has the)2.973 F .493(unpleasant ef)87
-188.4 R .493(fect of making replying to messages e)-.25 F .493
-(xceedingly dif)-.15 F .493
-(\214cult, since there is no one \231address\232)-.25 F(for an)87 200.4
-Q 2.5(yp)-.15 G(erson, b)-2.5 E(ut only a w)-.2 E
-(ay to get there from where)-.1 E -.15(ve)-.25 G 2.5(ry).15 G(ou are.)
--2.5 E(Interf)112 216.6 Q .448(acing to mail programs that were not initially intended to be applied in an internet en)
--.1 F(viron-)-.4 E(ment has been amazingly successful, and has reduced the job to a manageable task.)
-87 228.6 Q F1(Sendmail)112 244.8 Q F2 2.906(has kno)5.406 F 2.906
-(wledge of a fe)-.25 F 5.406(wd)-.25 G(if)-5.406 E 2.906(\214cult en)
--.25 F 2.906(vironments b)-.4 F 2.906(uilt in.)-.2 F 2.905
-(It generates ARP)7.906 F(ANET)-.92 E .648(FTP/SMTP compatible error messages \(prepended with three-digit numbers [Neigus73, Postel74, Pos-)
-87 256.8 R .771(tel82]\) as necessary)87 268.8 R 3.271(,o)-.65 G .771(ptionally generates UNIX-style \231From\232 lines on the front of messages for some)
--3.271 F 1.669(mailers, and kno)87 280.8 R 1.669(ws ho)-.25 F 4.169(wt)
--.25 G 4.169(op)-4.169 G 1.669(arse the same lines on input.)-4.169 F
-1.67(Also, error handling has an option cus-)6.67 F
-(tomized for BerkNet.)87 292.8 Q 1.482(The decision to a)112 309 R -.2
-(vo)-.2 G 1.482(id doing an).2 F 3.982(yt)-.15 G 1.481(ype of deli)
--3.982 F -.15(ve)-.25 G 1.481(ry where possible \(e).15 F -.15(ve)-.25 G
-1.481(n, or perhaps especially).15 F(,)-.65 E .574(local deli)87 321 R
--.15(ve)-.25 G .574(ry\) has turned out to be a good idea.).15 F(Ev)
-5.574 E .574(en with local deli)-.15 F -.15(ve)-.25 G(ry).15 E 3.074(,t)
--.65 G .575(here are issues of the loca-)-3.074 F .469(tion of the mailbox, the format of the mailbox, the locking protocol used, etc., that are best decided by)
-87 333 R .038(other programs.)87 345 R .038(One surprisingly major anno)
-5.038 F .038(yance in man)-.1 F 2.538(yi)-.15 G .038
-(nternet mailers is that the location and for)-2.538 F(-)-.2 E .138
-(mat of local mail is b)87 357 R .138(uilt in.)-.2 F .137(The feeling seems to be that local mail is so common that it should be ef)
-5.137 F<8c2d>-.25 E 3.045(cient. This)87 369 R .545
-(feeling is not born out by our e)3.045 F .545
-(xperience; on the contrary)-.15 F 3.045(,t)-.65 G .545
-(he location and format of mail-)-3.045 F(box)87 381 Q(es seems to v)
--.15 E(ary widely from system to system.)-.25 E .681(The ability to automatically generate a response to incoming mail \(by forw)
-112 397.2 R .68(arding mail to a pro-)-.1 F .435
-(gram\) seems useful \(\231I am on v)87 409.2 R .435
-(acation until late August....)-.25 F 2.935(\232\) b)-.7 F .435
-(ut can create problems such as forw)-.2 F(ard-)-.1 E .143
-(ing loops \(tw)87 421.2 R 2.643(op)-.1 G .143(eople on v)-2.643 F .143
-(acation whose programs send notes back and forth, for instance\) if these pro-)
--.25 F .732(grams are not well written.)87 433.2 R 3.232(Ap)5.732 G .732
-(rogram could be written to do standard tasks correctly)-3.232 F 3.233
-(,b)-.65 G .733(ut this w)-3.433 F(ould)-.1 E(solv)87 445.2 Q 2.5(et)
--.15 G(he general case.)-2.5 E .225
-(It might be desirable to implement some form of load limiting.)112
-461.4 R 2.725(Ia)5.225 G 2.724(mu)-2.725 G(na)-2.724 E -.1(wa)-.15 G
-.224(re of an).1 F 2.724(ym)-.15 G .224(ail system)-2.724 F
-(that addresses this problem, nor am I a)87 473.4 Q -.1(wa)-.15 G
-(re of an).1 E 2.5(yr)-.15 G(easonable solution at this time.)-2.5 E
-.113(The con\214guration \214le is currently practically inscrutable; considerable con)
-112 489.6 R -.15(ve)-.4 G .114(nience could be real-).15 F
-(ized with a higher)87 501.6 Q(-le)-.2 E -.15(ve)-.25 G 2.5(lf).15 G
-(ormat.)-2.5 E .778(It seems clear that common protocols will be changing soon to accommodate changing require-)
-112 517.8 R 2.774(ments and en)87 529.8 R 5.274(vironments. These)-.4 F
-2.774
-(changes will include modi\214cations to the message header \(e.g.,)
-5.274 F .859([NBS80]\) or to the body of the message itself \(such as for multimedia messages [Postel80]\).)
-87 541.8 R(Experi-)5.859 E
-(ence indicates that these changes should be relati)87 553.8 Q -.15(ve)
--.25 G(ly tri).15 E(vial to inte)-.25 E(grate into the e)-.15 E
-(xisting system.)-.15 E .811(In tightly coupled en)112 570 R .812
-(vironments, it w)-.4 F .812(ould be nice to ha)-.1 F 1.112 -.15(ve a n)
--.2 H .812(ame serv).15 F .812(er such as Grapvine [Bir)-.15 F(-)-.2 E
-.095(rell82] inte)87 582 R .095(grated into the mail system.)-.15 F .095
-(This w)5.095 F .095(ould allo)-.1 F 2.594(was)-.25 G .094
-(ite such as \231Berk)-2.594 F(ele)-.1 E .094
-(y\232 to appear as a single)-.15 F 2.606
-(host, rather than as a collection of hosts, and w)87 594 R 2.606
-(ould allo)-.1 F 5.106(wp)-.25 G 2.606(eople to mo)-5.106 F 2.906 -.15
-(ve t)-.15 H 2.606(ransparently among).15 F 1.664(machines without ha)87
-606 R 1.664(ving to change their addresses.)-.2 F 1.664(Such a f)6.664 F
-1.664(acility w)-.1 F 1.663(ould require an automatically)-.1 F .428
-(updated database and some method of resolving con\215icts.)87 618 R
-.428(Ideally this w)5.428 F .428(ould be ef)-.1 F(fecti)-.25 E .728 -.15
-(ve e)-.25 H -.15(ve)-.1 G 2.928(nw).15 G(ithout)-2.928 E .184
-(all hosts being under a single management.)87 630 R(Ho)5.184 E(we)-.25
-E -.15(ve)-.25 G .984 -.4(r, i).15 H 2.684(ti).4 G 2.683(sn)-2.684 G
-.183(ot clear whether this feature should be inte-)-2.683 F
-(grated into the aliasing f)87 642 Q
-(acility or should be considered a \231v)-.1 E
-(alue added\232 feature outside)-.25 E F1(sendmail)2.5 E F2(itself.)2.5
-E .79(As a more interesting case, the CSNET name serv)112 658.2 R .791
-(er [Solomon81] pro)-.15 F .791(vides an f)-.15 F .791
-(acility that goes)-.1 F(be)87 670.2 Q .375
-(yond a single tightly-coupled en)-.15 F 2.875(vironment. Such)-.4 F
-2.875(af)2.875 G .375(acility w)-2.975 F .374(ould normally e)-.1 F .374
-(xist outside of)-.15 F F1(sendmail)2.874 E F2(ho)87 682.2 Q(we)-.25 E
--.15(ve)-.25 G -.55(r.).15 G EP
-%%Page: 11 11
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(SENDMAIL \212 An Inter)72 60 Q(netw)-.15 E
-(ork Mail Router)-.1 E(SMM:9-11)189.78 E -.55(AC)72 96 S(KNO).55 E
-(WLEDGEMENTS)-.5 E/F1 10/Times-Roman@0 SF 1.203(Thanks are due to K)97
-112.2 R 1.204(urt Shoens for his continual cheerful assistance and good advice, Bill Jo)
--.15 F 3.704(yf)-.1 G(or)-3.704 E .102
-(pointing me in the correct direction \(o)72 124.2 R -.15(ve)-.15 G
-2.602(ra).15 G .102(nd o)-2.602 F -.15(ve)-.15 G .102
-(r\), and Mark Horton for more advice, prodding, and man).15 F(y)-.15 E
-.453(of the good ideas.)72 136.2 R -.15(Ku)5.453 G .453
-(rt and Eric Schmidt are to be credited for using).15 F/F2 10
-/Times-Italic@0 SF(delivermail)2.953 E F1 .453(as a serv)2.953 F .453
-(er for their pro-)-.15 F 1.663(grams \()72 148.2 R F2(Mail)A F1 1.663
-(and BerkNet respecti)4.163 F -.15(ve)-.25 G 1.663(ly\) before an).15 F
-4.163(ys)-.15 G 1.663(ane person should ha)-4.163 F -.15(ve)-.2 G 4.163
-(,a).15 G 1.662(nd making the necessary)-4.163 F .078
-(modi\214cations promptly and happily)72 160.2 R 5.078(.E)-.65 G .078
-(ric g)-5.078 F -2.25 -.2(av e)-.05 H .079
-(me considerable advice about the perils of netw)2.778 F .079(ork softw)
--.1 F(are)-.1 E .179(which sa)72 172.2 R -.15(ve)-.2 G 2.679(dm).15 G
-2.679(ea)-2.679 G 2.679(nu)-2.679 G(nkno)-2.679 E .178(wn amount of w)
--.25 F .178(ork and grief.)-.1 F .178
-(Mark did the original implementation of the DBM)5.178 F -.15(ve)72
-184.2 S .341
-(rsion of aliasing, installed the VFORK code, wrote the current v).15 F
-.341(ersion of)-.15 F F2(rmail)2.841 E F1 2.841(,a)C .341(nd w)-2.841 F
-.342(as the person who)-.1 F .61(really con)72 196.2 R .61
-(vinced me to put the w)-.4 F .61(ork into)-.1 F F2(delivermail)3.109 E
-F1 .609(to turn it into)3.109 F F2(sendmail)3.109 E F1 5.609(.K)C .609
-(urt deserv)-5.759 F .609(es accolades for)-.15 F(using)72 208.2 Q F2
-(sendmail)2.57 E F1 .07(when I w)2.57 F .07(as myself afraid to tak)-.1
-F 2.57(et)-.1 G .07(he risk; ho)-2.57 F 2.57(wap)-.25 G .07
-(erson can continue to be so enthusiastic in)-2.57 F(the f)72 220.2 Q
-(ace of so much bitter reality is be)-.1 E(yond me.)-.15 E -.15(Ku)97
-236.4 S 1.505(rt, Mark, Kirk McK).15 F 1.505
-(usick, Marvin Solomon, and man)-.15 F 4.005(yo)-.15 G 1.504(thers ha)
--4.005 F 1.804 -.15(ve r)-.2 H -.25(ev).15 G(ie).25 E 1.504
-(wed this paper)-.25 F 4.004(,g)-.4 G -.25(iv)-4.004 G(ing).25 E
-(considerable useful advice.)72 248.4 Q .846(Special thanks are reserv)
-97 264.6 R .846(ed for Mik)-.15 F 3.346(eS)-.1 G(tonebrak)-3.346 E .846
-(er at Berk)-.1 F(ele)-.1 E 3.347(ya)-.15 G .847
-(nd Bob Epstein at Britton-Lee, who)-3.347 F .542(both kno)72 276.6 R
-.542(wingly allo)-.25 F .542(wed me to put so much w)-.25 F .541
-(ork into this project when there were so man)-.1 F 3.041(yo)-.15 G .541
-(ther things I)-3.041 F(really should ha)72 288.6 Q .3 -.15(ve b)-.2 H
-(een w).15 E(orking on.)-.1 E EP
-%%Page: 12 12
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF(REFERENCES)256.605 132 Q 62.73
-([Birrell82] Birrell,)72 148.2 R 1.084(A. D., Le)3.584 F 1.084
-(vin, R., Needham, R. M., and Schroeder)-.25 F 3.584(,M)-.4 G 3.585(.D)
--3.584 G 1.085(., \231Grape)-3.585 F(vine:)-.25 E(An Ex)180 160.2 Q
-(ercise in Distrib)-.15 E(uted Computing.)-.2 E 5<9a49>-.7 G(n)-5 E/F1
-10/Times-Italic@0 SF(Comm. A.C.M. 25,)2.5 E F0(4, April 82.)2.5 E 59.4
-([Borden79] Borden,)72 176.4 R .796
-(S., Gaines, R. S., and Shapiro, N. Z.,)3.296 F F1 .795(The MH Messa)
-3.295 F .995 -.1(ge H)-.1 H .795(andling Sys-).1 F(tem: User)180 188.4 Q
-(s' Manual.)-.1 E F0(R-2367-P)5 E(AF)-.92 E 5(.R)-.8 G(and Corporation.)
--5 E(October 1979.)5 E([Crock)72 204.6 Q 52.29(er77a] Crock)-.1 F(er)-.1
-E 2.508(,D)-.4 G 2.508(.H)-2.508 G .008(., V)-2.508 F .009
-(ittal, J. J., Pogran, K. T)-.6 F .009(., and Henderson, D. A. Jr)-.74 F
-(.,)-.55 E F1(Standar)2.509 E 2.509(df)-.37 G(or)-2.509 E .955(the F)180
-216.6 R .955(ormat of ARP)-1.05 F 3.454(AN)-.9 G .954(etwork T)-3.454 F
--.2(ex)-.92 G 3.454(tM).2 G(essa)-3.454 E -.1(ge)-.1 G(s.).1 E F0 .954
-(RFC 733, NIC 41952.)5.954 F .954(In [Fein-)5.954 F 2.5(ler78]. No)180
-228.6 R -.15(ve)-.15 G(mber 1977.).15 E([Crock)72 244.8 Q 51.73
-(er77b] Crock)-.1 F(er)-.1 E 3.04(,D)-.4 G 3.04(.H)-3.04 G(.,)-3.04 E F1
--1.55 -.55(Fr a)3.04 H(me).55 E .54(work and Functions of the MS P)-.15
-F(er)-.8 E .54(sonal Messa)-.1 F .74 -.1(ge S)-.1 H(ystem.).1 E F0
-(R-2134-ARP)180 256.8 Q(A, Rand Corporation, Santa Monica, California.)
--.92 E(1977.)5 E([Crock)72 273 Q 56.73(er79] Crock)-.1 F(er)-.1 E 2.557
-(,D)-.4 G 2.557(.H)-2.557 G .056(., Szurk)-2.557 F -.25(ow)-.1 G .056
-(ski, E. S., and F).25 F(arber)-.15 E 2.556(,D)-.4 G 2.556(.J)-2.556 G
-(.,)-2.556 E F1 .056(An Internetwork Memo Dis-)2.556 F(trib)180 285 Q
-1.341(ution F)-.2 F 1.341(acility \212 MMDF)-.75 F(.)-1.35 E F0 1.341
-(6th Data Communication Symposium, Asilomar)6.341 F(.)-.55 E(No)180 297
-Q -.15(ve)-.15 G(mber 1979.).15 E([Crock)72 313.2 Q 56.73(er82] Crock)
--.1 F(er)-.1 E 3.383(,D)-.4 G 3.383(.H)-3.383 G(.,)-3.383 E F1(Standar)
-3.383 E 3.383(df)-.37 G .883(or the F)-3.383 F .882
-(ormat of Arpa Internet T)-1.05 F -.2(ex)-.92 G 3.382(tM).2 G(essa)
--3.382 E -.1(ge)-.1 G(s.).1 E F0(RFC)5.882 E 4.197(822. Netw)180 325.2 R
-1.697(ork Information Center)-.1 F 4.197(,S)-.4 G 1.698
-(RI International, Menlo P)-4.197 F 1.698(ark, California.)-.15 F
-(August 1982.)180 337.2 Q 53.3([Metcalfe76] Metcalfe,)72 353.4 R .727
-(R., and Boggs, D., \231Ethernet: Distrib)3.227 F .727(uted P)-.2 F(ack)
--.15 E .727(et Switching for Local)-.1 F(Computer Netw)180 365.4 Q
-(orks\232,)-.1 E F1(Communications of the A)2.5 E(CM 19,)-.3 E F0 2.5
-(7. July)2.5 F(1976.)2.5 E 60.51([Feinler78] Feinler)72 381.6 R 4.438
-(,E)-.4 G 1.938(., and Postel, J.)-4.438 F(\(eds.\),)6.938 E F1(ARP)
-4.438 E 1.938(ANET Pr)-.9 F 1.938(otocol Handbook.)-.45 F F0 1.938
-(NIC 7104,)6.938 F(Netw)180 393.6 Q(ork Information Center)-.1 E 2.5(,S)
--.4 G(RI International, Menlo P)-2.5 E(ark, California.)-.15 E(1978.)5 E
-69.39([NBS80] National)72 409.8 R 1.46(Bureau of Standards,)3.96 F F1
-1.46(Speci\214cation of a Dr)3.96 F 1.46(aft Messa)-.15 F 1.66 -.1(ge F)
--.1 H 1.46(ormat Stan-)-.95 F(dar)180 421.8 Q(d.)-.37 E F0
-(Report No. ICST/CBOS 80-2.)5 E(October 1980.)5 E 60.51
-([Neigus73] Neigus,)72 438 R(N.,)5.186 E F1 -.45(Fi)5.186 G 2.686(le T)
-.45 F -.15(ra)-.55 G 2.686(nsfer Pr).15 F 2.686(otocol for the ARP)-.45
-F 5.187(AN)-.9 G(etwork.)-5.187 E F0 2.687(RFC 542, NIC)7.687 F 2.5
-(17759. In)180 450 R 2.5([Feinler78]. August,)2.5 F(1973.)2.5 E([No)72
-466.2 Q 55.21(witz78a] No)-.25 F 1.633(witz, D. A., and Lesk, M. E.,)
--.25 F F1 4.132(AD)4.132 G 1.632(ial-Up Network of UNIX Systems.)-4.132
-F F0(Bell)6.632 E 5.403(Laboratories. In)180 478.2 R 2.904
-(UNIX Programmer')5.403 F 5.404(sM)-.55 G 2.904(anual, Se)-5.404 F -.15
-(ve)-.25 G 2.904(nth Edition, V).15 F 2.904(olume 2.)-1.29 F
-(August, 1978.)180 490.2 Q([No)72 506.4 Q 54.65(witz78b] No)-.25 F .633
-(witz, D. A.,)-.25 F F1 .632(Uucp Implementation Description.)3.132 F F0
-.632(Bell Laboratories.)5.632 F .632(In UNIX)5.632 F(Programmer')180
-518.4 Q 2.5(sM)-.55 G(anual, Se)-2.5 E -.15(ve)-.25 G(nth Edition, V).15
-E(olume 2.)-1.29 E(October)5 E 2.5(,1)-.4 G(978.)-2.5 E 64.39
-([Postel74] Postel,)72 534.6 R .24(J., and Neigus, N., Re)2.74 F .241
-(vised FTP Reply Codes.)-.25 F .241(RFC 640, NIC 30843.)5.241 F(In)5.241
-E 2.5([Feinler78]. June,)180 546.6 R(1974.)2.5 E 64.39
-([Postel77] Postel,)72 562.8 R(J.,)2.5 E F1(Mail Pr)2.5 E(otocol.)-.45 E
-F0(NIC 29588.)5 E(In [Feinler78].)5 E(No)5 E -.15(ve)-.15 G(mber 1977.)
-.15 E 59.95([Postel79a] Postel,)72 579 R(J.,)3.144 E F1 .644
-(Internet Messa)3.144 F .844 -.1(ge P)-.1 H -.45(ro).1 G(tocol.).45 E F0
-.644(RFC 753, IEN 85.)5.644 F(Netw)5.644 E .644(ork Information)-.1 F
-(Center)180 591 Q 2.5(,S)-.4 G(RI International, Menlo P)-2.5 E
-(ark, California.)-.15 E(March 1979.)5 E 59.39([Postel79b] Postel,)72
-607.2 R 1.305(J. B.,)3.805 F F1 1.305(An Internetwork Messa)3.805 F
-1.505 -.1(ge S)-.1 H(tructur).1 E -.15(e.)-.37 G F0(In)6.456 E F1(Pr)
-3.806 E 1.306(oceedings of the Sixth)-.45 F
-(Data Communications Symposium,)180 619.2 Q F0 2.5(IEEE. Ne)2.5 F 2.5
-(wY)-.25 G 2.5(ork. No)-3.6 F -.15(ve)-.15 G(mber 1979.).15 E 64.39
-([Postel80] Postel,)72 635.4 R .639(J. B.,)3.139 F F1 3.139(AS)3.139 G
-(tructur)-3.139 E .639(ed F)-.37 F .639(ormat for T)-1.05 F -.15(ra)-.55
-G .639(nsmission of Multi-Media Documents.).15 F F0 .418(RFC 767.)180
-647.4 R(Netw)5.419 E .419(ork Information Center)-.1 F 2.919(,S)-.4 G
-.419(RI International, Menlo P)-2.919 F .419(ark, Califor)-.15 F(-)-.2 E
-2.5(nia. August)180 659.4 R(1980.)2.5 E 64.39([Postel82] Postel,)72
-675.6 R 2.05(J. B.,)4.55 F F1 2.05(Simple Mail T)4.55 F -.15(ra)-.55 G
-2.05(nsfer Pr).15 F(otocol.)-.45 E F0 2.05
-(RFC821 \(obsoleting RFC788\).)7.05 F(Netw)180 687.6 Q .273
-(ork Information Center)-.1 F 2.774(,S)-.4 G .274
-(RI International, Menlo P)-2.774 F .274(ark, California.)-.15 F(August)
-5.274 E(1982.)180 699.6 Q/F2 10/Times-Bold@0 SF 187.28
-(SMM:9-12 SENDMAIL)72 756 R 2.5<8a41>2.5 G 2.5(nI)-2.5 G(nter)-2.5 E
-(netw)-.15 E(ork Mail Router)-.1 E EP
-%%Page: 13 13
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(SENDMAIL \212 An Inter)72 60 Q(netw)-.15 E
-(ork Mail Router)-.1 E(SMM:9-13)189.78 E/F1 10/Times-Roman@0 SF 55.5
-([Schmidt79] Schmidt,)72 96 R(E.,)2.972 E/F2 10/Times-Italic@0 SF .472
-(An Intr)2.972 F .472(oduction to the Berk)-.45 F(ele)-.1 E 2.972(yN)-.3
-G(etwork.)-2.972 E F1(Uni)5.472 E -.15(ve)-.25 G .472
-(rsity of California,).15 F(Berk)180 108 Q(ele)-.1 E 2.5(yC)-.15 G 2.5
-(alifornia. 1979.)-2.5 F 59.95([Shoens79] Shoens,)72 124.2 R(K.,)4.894 E
-F2 2.394(Mail Refer)4.894 F 2.394(ence Manual.)-.37 F F1(Uni)7.394 E
--.15(ve)-.25 G 2.395(rsity of California, Berk).15 F(ele)-.1 E 6.195
--.65(y. I)-.15 H(n).65 E(UNIX Programmer')180 136.2 Q 2.5(sM)-.55 G
-(anual, Se)-2.5 E -.15(ve)-.25 G(nth Edition, V).15 E(olume 2C.)-1.29 E
-(December 1979.)5 E 60.51([Sluizer81] Sluizer)72 152.4 R 2.872(,S)-.4 G
-.372(., and Postel, J. B.,)-2.872 F F2 .372(Mail T)2.872 F -.15(ra)-.55
-G .372(nsfer Pr).15 F(otocol.)-.45 E F1 .371(RFC 780.)5.371 F(Netw)5.371
-E .371(ork Infor)-.1 F(-)-.2 E(mation Center)180 164.4 Q 2.5(,S)-.4 G
-(RI International, Menlo P)-2.5 E(ark, California.)-.15 E(May 1981.)5 E
-52.72([Solomon81] Solomon,)72 180.6 R .96(M., Landweber)3.46 F 3.46(,L)
--.4 G .96(., and Neuhengen, D., \231The Design of the CSNET)-3.46 F
-(Name Serv)180 192.6 Q(er)-.15 E 3.9 -.7(.\232 C)-.55 H(S-DN-2, Uni).7 E
--.15(ve)-.25 G(rsity of W).15 E(isconsin, Madison.)-.4 E(No)5 E -.15(ve)
--.15 G(mber 1981.).15 E 78.28([Su82] Su,)72 208.8 R(Za)4.344 E 1.844
-(w-Sing, and Postel, Jon,)-.15 F F2 1.844(The Domain Naming Con)4.344 F
-1.844(vention for Internet)-.4 F 1.717(User Applications.)180 220.8 R F1
-4.217(RFC819. Netw)6.717 F 1.717(ork Information Center)-.1 F 4.217(,S)
--.4 G 1.718(RI International,)-4.217 F(Menlo P)180 232.8 Q
-(ark, California.)-.15 E(August 1982.)5 E([UNIX83])72 249 Q F2 2.12
-(The UNIX Pr)66.35 F -.1(og)-.45 G -.15(ra).1 G(mmer').15 E 4.62(sM)-.4
-G 2.12(anual, Se)-4.62 F 2.12(venth Edition,)-.15 F F1 -.6(Vi)4.62 G
-2.12(rtual V).6 F 2.12(AX-11 V)-1.35 F(ersion,)-1.11 E -1.29(Vo)180 261
-S 1.027(lume 1.)1.29 F 1.027(Bell Laboratories, modi\214ed by the Uni)
-6.027 F -.15(ve)-.25 G 1.027(rsity of California, Berk).15 F(e-)-.1 E
-(le)180 273 Q 1.3 -.65(y, C)-.15 H 2.5(alifornia. March,).65 F(1983.)2.5
-E EP
-%%Trailer
-end
-%%EOF
+++ /dev/null
-# @(#)Makefile 8.2 (Berkeley) 2/28/1994
-
-DIR= smm/08.sendmailop
-SRCS= op.me
-MACROS= -me
-
-all: op.ps
-
-op.ps: ${SRCS}
- rm -f ${.TARGET}
- ${PIC} ${SRCS} | ${EQN} | ${ROFF} > ${.TARGET}
-
-.include <bsd.doc.mk>
+++ /dev/null
-.\" Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-.\" Copyright (c) 1983, 1995 Eric P. Allman. All rights reserved.
-.\" Copyright (c) 1983, 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.
-.\"
-.\"
-.\" @(#)op.me 8.135 (Berkeley) 1/16/1999
-.\"
-.\" eqn op.me | pic | troff -me
-.eh 'SMM:08-%''Sendmail Installation and Operation Guide'
-.oh 'Sendmail Installation and Operation Guide''SMM:08-%'
-.\" SD is lib if sendmail is installed in /usr/lib, sbin if in /usr/sbin
-.ds SD sbin
-.\" SB is bin if newaliases/mailq are installed in /usr/bin, ucb if in /usr/ucb
-.ds SB bin
-.nr si 3n
-.de $0
-.(x
-.in \\$3u*3n
-.ti -3n
-\\$2. \\$1
-.)x
-..
-.de $C
-.(x
-.in 0
-\\$1 \\$2. \\$3
-.)x
-..
-.sc
-.+c
-.(l C
-.sz 16
-.b SENDMAIL\u\s-6TM\s0\d
-.sz 12
-.sp
-.b "INSTALLATION AND OPERATION GUIDE"
-.sz 10
-.sp
-.r
-Eric Allman
-Sendmail, Inc.
-eric@Sendmail.COM
-.sp
-Version 8.135
-.sp
-For Sendmail Version 8.9
-.)l
-.(f
-Sendmail is a trademark of Sendmail, Inc.
-.)f
-.sp 2
-.pp
-.i Sendmail \u\s-2TM\s0\d
-implements a general purpose internetwork mail routing facility
-under the UNIX\(rg
-operating system.
-It is not tied to any one transport protocol \*-
-its function may be likened to a crossbar switch,
-relaying messages from one domain into another.
-In the process,
-it can do a limited amount of message header editing
-to put the message into a format that is appropriate
-for the receiving domain.
-All of this is done under the control of a configuration file.
-.pp
-Due to the requirements of flexibility
-for
-.i sendmail ,
-the configuration file can seem somewhat unapproachable.
-However, there are only a few basic configurations
-for most sites,
-for which standard configuration files have been supplied.
-Most other configurations
-can be built by adjusting an existing configuration file
-incrementally.
-.pp
-.i Sendmail
-is based on
-RFC821 (Simple Mail Transport Protocol),
-RFC822 (Internet Mail Headers Format),
-RFC1123 (Internet Host Requirements),
-RFC2045 (MIME),
-RFC1869 (SMTP Service Extensions),
-RFC1652 (SMTP 8BITMIME Extension),
-RFC1870 (SMTP SIZE Extension),
-RFC1891 (SMTP Delivery Status Notifications),
-RFC1892 (Multipart/Report),
-RFC1893 (Mail System Status Codes),
-RFC1894 (Delivery Status Notifications),
-RFC1985 (SMTP Service Extension for Remote Message Queue Starting),
-and
-RFC2033 (Local Message Transmission Protocol).
-However, since
-.i sendmail
-is designed to work in a wider world,
-in many cases it can be configured to exceed these protocols.
-These cases are described herein.
-.pp
-Although
-.i sendmail
-is intended to run
-without the need for monitoring,
-it has a number of features
-that may be used to monitor or adjust the operation
-under unusual circumstances.
-These features are described.
-.pp
-Section one describes how to do a basic
-.i sendmail
-installation.
-Section two
-explains the day-to-day information you should know
-to maintain your mail system.
-If you have a relatively normal site,
-these two sections should contain sufficient information
-for you to install
-.i sendmail
-and keep it happy.
-Section three
-describes some parameters that may be safely tweaked.
-Section four
-has information regarding the command line arguments.
-Section five
-contains the nitty-gritty information about the configuration
-file.
-This section is for masochists
-and people who must write their own configuration file.
-Section six
-describes configuration that can be done at compile time.
-The appendixes give a brief
-but detailed explanation of a number of features
-not described in the rest of the paper.
-.pp
-.\"XXX
-.b DISCLAIMER:
-This documentation is under modification.
-.bp
-.rs
-.sp |4i
-.ce 2
-This page intentionally left blank;
-replace it with a blank sheet for double-sided output.
-.bp 7
-.sh 1 "BASIC INSTALLATION"
-.pp
-There are two basic steps to installing
-.i sendmail .
-First, you have to compile and install the binary.
-If
-.i sendmail
-has already been ported to your operating system
-that should be simple.
-Second, you must build a run-time configuration file.
-This is a file that
-.i sendmail
-reads when it starts up
-that describes the mailers it knows about,
-how to parse addresses,
-how to rewrite the message header,
-and the settings of various options.
-Although the configuration file can be quite complex,
-a configuration can usually be built
-using an M4-based configuration language.
-.pp
-The remainder of this section will describe the installation of
-.i sendmail
-assuming you can use one of the existing configurations
-and that the standard installation parameters are acceptable.
-All pathnames and examples
-are given from the root of the
-.i sendmail
-subtree,
-normally
-.i /usr/src/usr.\*(SD/sendmail
-on 4.4BSD.
-.pp
-If you are loading this off the tape,
-continue with the next section.
-If you have a running binary already on your system,
-you should probably skip to section 1.2.
-.sh 2 "Compiling Sendmail"
-.pp
-All
-.i sendmail
-source is in the
-.i src
-subdirectory.
-To compile sendmail,
-.q cd
-into the
-.i src
-directory and type
-.(b
-\&./Build
-.)b
-This will leave the binary in an appropriately named subdirectory,
-e.g.,
-obj.BSD-OS.2.1.i386.
-It works for multiple object versions
-compiled out of the same directory.
-.sh 3 "Tweaking the Build Invocation"
-.pp
-You can give parameters on the
-.i Build
-command.
-In most cases these are only used when the
-.i obj.*
-directory is first created.
-These commands include:
-.nr ii 0.5i
-.ip "\-L \fIlibdirs\fP"
-A list of directories to search for libraries.
-.ip "\-I \fIincdirs\fP"
-A list of directories to search for include files.
-.ip "\-E \fIenvar\fP=\fIvalue\fP"
-Set an environment variable to an indicated
-.i value
-before compiling.
-This is normally used to set an ABI on Irix.
-.ip "\-c"
-Create a new
-.i obj.*
-tree before running.
-.ip "\-f \fIsiteconfig\fP"
-Read the indicated site configuration file.
-If this parameter is not specified,
-.i Build
-includes
-.i all
-of the files
-.i $BUILDTOOLS/Site/site.$oscf.m4
-and
-.i $BUILDTOOLS/Site/site.config.m4 ,
-where $BUILDTOOLS is normally
-.i \&../BuildTools
-and $oscf is the same name as used on the
-.i obj.*
-directory.
-See below for a description of the site configuration file.
-.ip "\-S"
-Skip auto-configuration.
-.i Build
-will avoid auto-detecting libraries if this is set.
-All libraries and map definitions must be specified
-in the site configuration file.
-.lp
-Any other parameters are passed to the
-.i make
-program.
-.sh 3 "Creating a Site Configuration File"
-.\"XXX
-.pp
-(This section is not yet complete.
-For now, see the file BuildTools/README for details.)
-.sh 3 "Tweaking the Makefile"
-.pp
-.\" .b "XXX This should all be in the Site Configuration File section."
-.i Sendmail
-supports two different formats
-for the local (on disk) version of databases,
-notably the
-.i aliases
-database.
-At least one of these should be defined if at all possible.
-.nr ii 1i
-.ip NDBM
-The ``new DBM'' format,
-available on nearly all systems around today.
-This was the preferred format prior to 4.4BSD.
-It allows such complex things as multiple databases
-and closing a currently open database.
-.ip NEWDB
-The Berkeley DB package.
-If you have this, use it.
-It allows
-long records,
-multiple open databases,
-real in-memory caching,
-and so forth.
-You can define this in conjunction with
-.sm NDBM ;
-if you do,
-old alias databases are read,
-but when a new database is created it will be in NEWDB format.
-As a nasty hack,
-if you have NEWDB, NDBM, and NIS defined,
-and if the alias file name includes the substring
-.q /yp/ ,
-.i sendmail
-will create both new and old versions of the alias file
-during a
-.i newalias
-command.
-This is required because the Sun NIS/YP system
-reads the DBM version of the alias file.
-It's ugly as sin,
-but it works.
-.lp
-If neither of these are defined,
-.i sendmail
-reads the alias file into memory on every invocation.
-This can be slow and should be avoided.
-There are also several methods for remote database access:
-.ip NIS
-Sun's Network Information Services (formerly YP).
-.ip NISPLUS
-Sun's NIS+ services.
-.ip NETINFO
-NeXT's NetInfo service.
-.ip HESIOD
-Hesiod service (from Athena).
-.lp
-Other compilation flags are set in conf.h
-and should be predefined for you
-unless you are porting to a new environment.
-.sh 3 "Compilation and installation"
-.pp
-After making the local system configuration described above,
-You should be able to compile and install the system.
-The script
-.q Build
-is the best approach on most systems:
-.(b
-\&./Build
-.)b
-This will use
-.i uname (1)
-to create a custom Makefile for your environment.
-.pp
-If you are installing in the standard places,
-you should be able to install using
-.(b
-\&./Build install
-.)b
-This should install the binary in
-/usr/\*(SD
-and create links from
-/usr/\*(SB/newaliases
-and
-/usr/\*(SB/mailq
-to
-/usr/\*(SD/sendmail.
-On 4.4BSD systems it will also format and install man pages.
-.sh 2 "Configuration Files"
-.pp
-.i Sendmail
-cannot operate without a configuration file.
-The configuration defines the mail delivery mechanisms understood at this site,
-how to access them,
-how to forward email to remote mail systems,
-and a number of tuning parameters.
-This configuration file is detailed
-in the later portion of this document.
-.pp
-The
-.i sendmail
-configuration can be daunting at first.
-The world is complex,
-and the mail configuration reflects that.
-The distribution includes an m4-based configuration package
-that hides a lot of the complexity.
-.pp
-These configuration files are simpler than old versions
-largely because the world has become simpler;
-in particular,
-text-based host files are officially eliminated,
-obviating the need to
-.q hide
-hosts behind a registered internet gateway.
-.pp
-These files also assume that most of your neighbors
-use domain-based UUCP addressing;
-that is,
-instead of naming hosts as
-.q host!user
-they will use
-.q host.domain!user .
-The configuration files can be customized to work around this,
-but it is more complex.
-.pp
-Our configuration files are processed by
-.i m4
-to facilitate local customization;
-the directory
-.i cf
-of the
-.i sendmail
-distribution directory
-contains the source files.
-This directory contains several subdirectories:
-.nr ii 1i
-.ip cf
-Both site-dependent and site-independent descriptions of hosts.
-These can be literal host names
-(e.g.,
-.q ucbvax.mc )
-when the hosts are gateways
-or more general descriptions
-(such as
-.q "generic-solaris2.mc"
-as a general description of an SMTP-connected host
-running Solaris 2.x.
-Files ending
-.b \&.mc
-(``Master Configuration'')
-are the input descriptions;
-the output is in the corresponding
-.b \&.cf
-file.
-The general structure of these files is described below.
-.ip domain
-Site-dependent subdomain descriptions.
-These are tied to the way your organization wants to do addressing.
-For example,
-.b domain/CS.Berkeley.EDU.m4
-is our description for hosts in the CS.Berkeley.EDU subdomain.
-These are referenced using the
-.sm DOMAIN
-.b m4
-macro in the
-.b \&.mc
-file.
-.ip feature
-Definitions of specific features that some particular host in your site
-might want.
-These are referenced using the
-.sm FEATURE
-.b m4
-macro.
-An example feature is
-use_cw_file
-(which tells
-.i sendmail
-to read an /etc/sendmail.cw file on startup
-to find the set of local names).
-.ip hack
-Local hacks, referenced using the
-.sm HACK
-.b m4
-macro.
-Try to avoid these.
-The point of having them here is to make it clear that they smell.
-.ip m4
-Site-independent
-.i m4 (1)
-include files that have information common to all configuration files.
-This can be thought of as a
-.q #include
-directory.
-.ip mailer
-Definitions of mailers,
-referenced using the
-.sm MAILER
-.b m4
-macro.
-The mailer types that are known in this distribution are
-fax,
-local,
-smtp,
-uucp,
-and usenet.
-For example, to include support for the UUCP-based mailers,
-use
-.q MAILER(uucp) .
-.ip ostype
-Definitions describing various operating system environments
-(such as the location of support files).
-These are referenced using the
-.sm OSTYPE
-.b m4
-macro.
-.ip sh
-Shell files used by the
-.b m4
-build process.
-You shouldn't have to mess with these.
-.ip siteconfig
-Local UUCP connectivity information.
-This directory has been supplanted by the mailertable feature;
-any new configurations should use that feature to do UUCP
-(and other) routing.
-.pp
-If you are in a new domain
-(e.g., a company),
-you will probably want to create a
-cf/domain
-file for your domain.
-This consists primarily of relay definitions
-and features you want enabled site-wide:
-for example, Berkeley's domain definition
-defines relays for
-BitNET
-and UUCP.
-These are specific to Berkeley,
-and should be fully-qualified internet-style domain names.
-Please check to make certain they are reasonable for your domain.
-.pp
-Subdomains at Berkeley are also represented in the
-cf/domain
-directory.
-For example,
-the domain
-CS.Berkeley.EDU
-is the Computer Science subdomain,
-EECS.Berkeley.EDU
-is the Electrical Engineering and Computer Sciences subdomain,
-and
-S2K.Berkeley.EDU
-is the Sequoia 2000 subdomain.
-You will probably have to add an entry to this directory
-to be appropriate for your domain.
-.pp
-You will have to use or create
-.b \&.mc
-files in the
-.i cf/cf
-subdirectory for your hosts.
-This is detailed in the
-cf/README
-file.
-.sh 2 "Details of Installation Files"
-.pp
-This subsection describes the files that
-comprise the
-.i sendmail
-installation.
-.sh 3 "/usr/\*(SD/sendmail"
-.pp
-The binary for
-.i sendmail
-is located in /usr/\*(SD\**.
-.(f
-\**This is usually
-/usr/sbin
-on 4.4BSD and newer systems;
-many systems install it in
-/usr/lib.
-I understand it is in /usr/ucblib
-on System V Release 4.
-.)f
-It should be setuid root.
-For security reasons,
-/, /usr, and /usr/\*(SD
-should be owned by root, mode 755\**.
-.(f
-\**Some vendors ship them owned by bin;
-this creates a security hole that is not actually related to
-.i sendmail .
-Other important directories that should have restrictive ownerships
-and permissions are
-/bin, /usr/bin, /etc, /usr/etc, /lib, and /usr/lib.
-.)f
-.sh 3 "/etc/sendmail.cf"
-.pp
-This is the configuration file for
-.i sendmail \**.
-.(f
-\**Actually, the pathname varies depending on the operating system;
-/etc is the preferred directory.
-Some older systems install it in
-.b /usr/lib/sendmail.cf ,
-and I've also seen it in
-.b /usr/ucblib
-and
-.b /etc/mail .
-If you want to move this file,
-add -D_PATH_SENDMAILCF=\e"/file/name\e"
-to the flags passed to the C compiler.
-Moving this file is not recommended:
-other programs and scripts know of this location.
-.)f
-This is the only non-library file name compiled into
-.i sendmail \**.
-.(f
-\**The system libraries can reference other files;
-in particular, system library subroutines that
-.i sendmail
-calls probably reference
-.i /etc/passwd
-and
-.i /etc/resolv.conf .
-.)f
-.pp
-The configuration file is normally created
-using the distribution files described above.
-If you have a particularly unusual system configuration
-you may need to create a special version.
-The format of this file is detailed in later sections
-of this document.
-.sh 3 "/usr/\*(SB/newaliases"
-.pp
-The
-.i newaliases
-command should just be a link to
-.i sendmail :
-.(b
-rm \-f /usr/\*(SB/newaliases
-ln \-s /usr/\*(SD/sendmail /usr/\*(SB/newaliases
-.)b
-This can be installed in whatever search path you prefer
-for your system.
-.sh 3 "/usr/\*(SB/hoststat"
-.pp
-The
-.i hoststat
-command should just be a link to
-.i sendmail ,
-in a fashion similar to
-.i newaliases .
-This command lists the status of the last mail transaction
-with all remote hosts. The
-.b \-v
-flag will prevent the status display from being truncated.
-It functions only when the
-.b HostStatusDirectory
-option is set.
-.sh 3 "/usr/\*(SB/purgestat"
-.pp
-This command is also a link to
-.i sendmail .
-It flushes all information that is stored in the
-.b HostStatusDirectory
-tree.
-.sh 3 "/var/spool/mqueue"
-.pp
-The directory
-.i /var/spool/mqueue
-should be created to hold the mail queue.
-This directory should be mode 700
-and owned by root.
-.pp
-The actual path of this directory
-is defined in the
-.b Q
-option of the
-.i sendmail.cf
-file.
-.sh 3 "/var/spool/mqueue/.hoststat"
-.pp
-This is a typical value for the
-.b HostStatusDirectory
-option,
-containing one file per host
-that this sendmail has chatted with recently.
-It is normally a subdirectory of
-.i mqueue .
-.sh 3 "/etc/aliases*"
-.pp
-The system aliases are held in
-.q /etc/aliases .
-A sample is given in
-.q lib/aliases
-which includes some aliases which
-.i must
-be defined:
-.(b
-cp lib/aliases /etc/aliases
-.i "edit /etc/aliases"
-.)b
-You should extend this file with any aliases that are apropos to your system.
-.pp
-Normally
-.i sendmail
-looks at a database version of the files,
-stored either in
-.q /etc/aliases.dir
-and
-.q /etc/aliases.pag
-or
-.q /etc/aliases.db
-depending on which database package you are using.
-The actual path of this file
-is defined in the
-.b AliasFile
-option of the
-.i sendmail.cf
-file.
-.sh 3 "/etc/rc or /etc/init.d/sendmail"
-.pp
-It will be necessary to start up the
-.i sendmail
-daemon when your system reboots.
-This daemon performs two functions:
-it listens on the SMTP socket for connections
-(to receive mail from a remote system)
-and it processes the queue periodically
-to insure that mail gets delivered when hosts come up.
-.pp
-Add the following lines to
-.q /etc/rc
-(or
-.q /etc/rc.local
-as appropriate)
-in the area where it is starting up the daemons
-on a BSD-base system,
-or on a System-V-based system
-in one of the startup files, typically
-.q /etc/init.d/sendmail :
-.(b
-if [ \-f /usr/\*(SD/sendmail \-a \-f /etc/sendmail.cf ]; then
- (cd /var/spool/mqueue; rm \-f [lnx]f*)
- /usr/\*(SD/sendmail \-bd \-q30m &
- echo \-n ' sendmail' >/dev/console
-fi
-.)b
-The
-.q cd
-and
-.q rm
-commands insure that all lock files have been removed;
-extraneous lock files may be left around
-if the system goes down in the middle of processing a message.
-The line that actually invokes
-.i sendmail
-has two flags:
-.q \-bd
-causes it to listen on the SMTP port,
-and
-.q \-q30m
-causes it to run the queue every half hour.
-.pp
-Some people use a more complex startup script,
-removing zero length qf files and df files for which there is no qf file.
-For example, see Figure 1
-for an example of a complex script which does this clean up.
-.(z
-.hl
-#!/bin/sh
-# remove zero length qf files
-for qffile in qf*
-do
- if [ \-r $qffile ]
- then
- if [ ! \-s $qffile ]
- then
- echo \-n " <zero: $qffile>" > /dev/console
- rm \-f $qffile
- fi
- fi
-done
-# rename tf files to be qf if the qf does not exist
-for tffile in tf*
-do
- qffile=`echo $tffile | sed 's/t/q/'`
- if [ \-r $tffile \-a ! \-f $qffile ]
- then
- echo \-n " <recovering: $tffile>" > /dev/console
- mv $tffile $qffile
- else
- if [ \-f $tffile ]
- then
- echo \-n " <extra: $tffile>" > /dev/console
- rm \-f $tffile
- fi
- fi
-done
-# remove df files with no corresponding qf files
-for dffile in df*
-do
- qffile=`echo $dffile | sed 's/d/q/'`
- if [ \-r $dffile \-a ! \-f $qffile ]
- then
- echo \-n " <incomplete: $dffile>" > /dev/console
- mv $dffile `echo $dffile | sed 's/d/D/'`
- fi
-done
-# announce files that have been saved during disaster recovery
-for xffile in [A-Z]f*
-do
- if [ \-f $xffile ]
- then
- echo \-n " <panic: $xffile>" > /dev/console
- fi
-done
-.sp
-.ce
-Figure 1 \(em A complex startup script
-.hl
-.)z
-.pp
-If you are not running a version of UNIX
-that supports Berkeley TCP/IP,
-do not include the
-.b \-bd
-flag.
-.sh 3 "/usr/lib/sendmail.hf"
-.pp
-This is the help file used by the SMTP
-.b HELP
-command.
-It should be copied from
-.q lib/sendmail.hf :
-.(b
-cp lib/sendmail.hf /usr/lib
-.)b
-The actual path of this file
-is defined in the
-.b HelpFile
-option of the
-.i sendmail.cf
-file.
-.sh 3 "/etc/sendmail.st"
-.pp
-If you wish to collect statistics
-about your mail traffic,
-you should create the file
-.q /etc/sendmail.st :
-.(b
-cp /dev/null /etc/sendmail.st
-chmod 644 /etc/sendmail.st
-.)b
-This file does not grow.
-It is printed with the program
-.q mailstats/mailstats.c.
-The actual path of this file
-is defined in the
-.b S
-option of the
-.i sendmail.cf
-file.
-.sh 3 "/usr/\*(SB/mailq"
-.pp
-If
-.i sendmail
-is invoked as
-.q mailq,
-it will simulate the
-.b \-bp
-flag
-(i.e.,
-.i sendmail
-will print the contents of the mail queue;
-see below).
-This should be a link to /usr/\*(SD/sendmail.
-.sh 1 "NORMAL OPERATIONS"
-.sh 2 "The System Log"
-.pp
-The system log is supported by the
-.i syslogd \|(8)
-program.
-All messages from
-.i sendmail
-are logged under the
-.sm LOG_MAIL
-facility\**.
-.(f
-\**Except on Ultrix,
-which does not support facilities in the syslog.
-.)f
-.sh 3 "Format"
-.pp
-Each line in the system log
-consists of a timestamp,
-the name of the machine that generated it
-(for logging from several machines
-over the local area network),
-the word
-.q sendmail: ,
-and a message\**.
-.(f
-\**This format may vary slightly if your vendor has changed
-the syntax.
-.)f
-Most messages are a sequence of
-.i name \c
-=\c
-.i value
-pairs.
-.pp
-The two most common lines are logged when a message is processed.
-The first logs the receipt of a message;
-there will be exactly one of these per message.
-Some fields may be omitted if they do not contain interesting information.
-Fields are:
-.ip from
-The envelope sender address.
-.ip size
-The size of the message in bytes.
-.ip class
-The class (i.e., numeric precedence) of the message.
-.ip pri
-The initial message priority (used for queue sorting).
-.ip nrcpts
-The number of envelope recipients for this message
-(after aliasing and forwarding).
-.ip msgid
-The message id of the message (from the header).
-.ip proto
-The protocol used to receive this message (e.g., ESMTP or UUCP)
-.ip relay
-The machine from which it was received.
-.lp
-There is also one line logged per delivery attempt
-(so there can be several per message if delivery is deferred
-or there are multiple recipients).
-Fields are:
-.ip to
-A comma-separated list of the recipients to this mailer.
-.ip ctladdr
-The ``controlling user'', that is, the name of the user
-whose credentials we use for delivery.
-.ip delay
-The total delay between the time this message was received
-and the time it was delivered.
-.ip xdelay
-The amount of time needed in this delivery attempt
-(normally indicative of the speed of the connection).
-.ip mailer
-The name of the mailer used to deliver to this recipient.
-.ip relay
-The name of the host that actually accepted (or rejected) this recipient.
-.ip stat
-The delivery status.
-.lp
-Not all fields are present in all messages;
-for example, the relay is not listed for local deliveries.
-.sh 3 "Levels"
-.pp
-If you have
-.i syslogd \|(8)
-or an equivalent installed,
-you will be able to do logging.
-There is a large amount of information that can be logged.
-The log is arranged as a succession of levels.
-At the lowest level
-only extremely strange situations are logged.
-At the highest level,
-even the most mundane and uninteresting events
-are recorded for posterity.
-As a convention,
-log levels under ten
-are considered generally
-.q useful;
-log levels above 64
-are reserved for debugging purposes.
-Levels from 11\-64 are reserved for verbose information
-that some sites might want.
-.pp
-A complete description of the log levels
-is given in section
-.\" XREF
-4.6.
-.sh 2 "Dumping State"
-.pp
-You can ask
-.i sendmail
-to log a dump of the open files
-and the connection cache
-by sending it a
-.sm SIGUSR1
-signal.
-The results are logged at
-.sm LOG_DEBUG
-priority.
-.sh 2 "The Mail Queue"
-.pp
-Sometimes a host cannot handle a message immediately.
-For example, it may be down or overloaded, causing it to refuse connections.
-The sending host is then expected to save this message in
-its mail queue
-and attempt to deliver it later.
-.pp
-Under normal conditions the mail queue will be processed transparently.
-However, you may find that manual intervention is sometimes necessary.
-For example,
-if a major host is down for a period of time
-the queue may become clogged.
-Although
-.i sendmail
-ought to recover gracefully when the host comes up,
-you may find performance unacceptably bad in the meantime.
-.sh 3 "Printing the queue"
-.pp
-The contents of the queue can be printed
-using the
-.i mailq
-command
-(or by specifying the
-.b \-bp
-flag to
-.i sendmail ):
-.(b
-mailq
-.)b
-This will produce a listing of the queue id's,
-the size of the message,
-the date the message entered the queue,
-and the sender and recipients.
-.sh 3 "Forcing the queue"
-.pp
-.i Sendmail
-should run the queue automatically
-at intervals.
-The algorithm is to read and sort the queue,
-and then to attempt to process all jobs in order.
-When it attempts to run the job,
-.i sendmail
-first checks to see if the job is locked.
-If so, it ignores the job.
-.pp
-There is no attempt to insure that only one queue processor
-exists at any time,
-since there is no guarantee that a job cannot take forever
-to process
-(however,
-.i sendmail
-does include heuristics to try to abort jobs
-that are taking absurd amounts of time;
-technically, this violates RFC 821, but is blessed by RFC 1123).
-Due to the locking algorithm,
-it is impossible for one job to freeze the entire queue.
-However,
-an uncooperative recipient host
-or a program recipient
-that never returns
-can accumulate many processes in your system.
-Unfortunately,
-there is no completely general way to solve this.
-.pp
-In some cases,
-you may find that a major host going down
-for a couple of days
-may create a prohibitively large queue.
-This will result in
-.i sendmail
-spending an inordinate amount of time
-sorting the queue.
-This situation can be fixed by moving the queue to a temporary place
-and creating a new queue.
-The old queue can be run later when the offending host returns to service.
-.pp
-To do this,
-it is acceptable to move the entire queue directory:
-.(b
-cd /var/spool
-mv mqueue omqueue; mkdir mqueue; chmod 700 mqueue
-.)b
-You should then kill the existing daemon
-(since it will still be processing in the old queue directory)
-and create a new daemon.
-.pp
-To run the old mail queue,
-run the following command:
-.(b
-/usr/\*(SD/sendmail \-oQ/var/spool/omqueue \-q
-.)b
-The
-.b \-oQ
-flag specifies an alternate queue directory
-and the
-.b \-q
-flag says to just run every job in the queue.
-If you have a tendency toward voyeurism,
-you can use the
-.b \-v
-flag to watch what is going on.
-.pp
-When the queue is finally emptied,
-you can remove the directory:
-.(b
-rmdir /var/spool/omqueue
-.)b
-.sh 2 "Disk Based Connection Information"
-.pp
-.i Sendmail
-stores a large amount of information about each remote system it
-has connected to in memory. It is now possible to preserve some
-of this information on disk as well, by using the
-.b HostStatusDirectory
-option, so that it may be shared between several invocations of
-.i sendmail .
-This allows mail to be queued immediately or skipped during a queue run if
-there has been a recent failure in connecting to a remote machine.
-.pp
-Additionally enabling
-.b SingleThreadDelivery
-has the added effect of single-threading mail delivery to a destination.
-This can be quite helpful
-if the remote machine is running an SMTP server that is easily overloaded
-or cannot accept more than a single connection at a time,
-but can cause some messages to be punted to a future queue run.
-It also applies to
-.i all
-hosts, so setting this because you have one machine on site
-that runs some software that is easily overrun
-can cause mail to other hosts to be slowed down.
-If this option is set,
-you probably want to set the
-.b MinQueueAge
-option as well and run the queue fairly frequently;
-this way jobs that are skipped because another
-.i sendmail
-is talking to the same host will be tried again quickly
-rather than being delayed for a long time.
-.pp
-The disk based host information is stored in a subdirectory of the
-.b mqueue
-directory called
-.b \&.hoststat \**.
-.(f
-\**This is the usual value of the
-.b HostStatusDirectory
-option;
-it can, of course, go anywhere you like in your filesystem.
-.)f
-Removing this directory and its subdirectories has an effect similar to
-the
-.i purgestat
-command and is completely safe.
-The information in these directories can
-be perused with the
-.i hoststat
-command, which will indicate the host name, the last access, and the
-status of that access.
-An asterisk in the left most column indicates that a
-.i sendmail
-process currently has the host locked for mail delivery.
-.pp
-The disk based connection information is treated the same way as memory based
-connection information for the purpose of timeouts.
-By default, information about host failures is valid for 30 minutes.
-This can be adjusted with
-the
-.b Timeout.hoststatus
-option.
-.pp
-The connection information stored on disk may be purged at any time
-with the
-.i purgestat
-command or by invoking sendmail with the
-.b \-bH
-switch.
-The connection information may be viewed with the
-.i hoststat
-command or by invoking sendmail with the
-.b \-bh
-switch.
-.sh 2 "The Service Switch"
-.pp
-The implementation of certain system services
-such as host and user name lookup
-is controlled by the service switch.
-If the host operating system supports such a switch
-.i sendmail
-will use the native version.
-Ultrix, Solaris, and DEC OSF/1 are examples of such systems\**.
-.(f
-\**HP-UX 10 has service switch support,
-but since the APIs are apparently not available in the libraries
-.i sendmail
-does not use the native service switch in this release.
-.)f
-.pp
-If the underlying operating system does not support a service switch
-(e.g., SunOS 4.X, HP-UX, BSD)
-then
-.i sendmail
-will provide a stub implementation.
-The
-.b ServiceSwitchFile
-option points to the name of a file that has the service definitions.
-Each line has the name of a service
-and the possible implementations of that service.
-For example, the file:
-.(b
-hosts dns files nis
-aliases files nis
-.)b
-will ask
-.i sendmail
-to look for hosts in the Domain Name System first.
-If the requested host name is not found,
-it tries local files,
-and if that fails it tries NIS.
-Similarly,
-when looking for aliases
-it will try the local files first
-followed by NIS.
-.pp
-Service switches are not completely integrated.
-For example, despite the fact that the host entry listed in the above example
-specifies to look in NIS,
-on SunOS this won't happen because the system implementation of
-.i gethostbyname \|(3)
-doesn't understand this.
-If there is enough demand
-.i sendmail
-may reimplement
-.i gethostbyname \|(3),
-.i gethostbyaddr \|(3),
-.i getpwent \|(3),
-and the other system routines that would be necessary
-to make this work seamlessly.
-.sh 2 "The Alias Database"
-.pp
-After recipient addresses are read from the SMTP connection
-or command line
-they are parsed by ruleset 0,
-which must resolve to a
-{\c
-.i mailer ,
-.i host ,
-.i user }
-triple.
-If the flags selected by the
-.i mailer
-include the
-.b A
-(aliasable) flag,
-the
-.i user
-part of the triple is looked up as the key
-(i.e., the left hand side)
-into the alias database.
-If there is a match, the address is deleted from the send queue
-and all addresses on the right hand side of the alias
-are added in place of the alias that was found.
-This is a recursive operation,
-so aliases found in the right hand side of the alias
-are similarly expanded.
-.pp
-The alias database exists in two forms.
-One is a text form,
-maintained in the file
-.i /etc/aliases.
-The aliases are of the form
-.(b
-name: name1, name2, ...
-.)b
-Only local names may be aliased;
-e.g.,
-.(b
-eric@prep.ai.MIT.EDU: eric@CS.Berkeley.EDU
-.)b
-will not have the desired effect
-(except on prep.ai.MIT.EDU,
-and they probably don't want me)\**.
-.(f
-\**Actually, any mailer that has the `A' mailer flag set
-will permit aliasing;
-this is normally limited to the local mailer.
-.)f
-Aliases may be continued by starting any continuation lines
-with a space or a tab.
-Blank lines and lines beginning with a sharp sign
-(\c
-.q # )
-are comments.
-.pp
-The second form is processed by the
-.i ndbm \|(3)\**
-.(f
-\**The
-.i gdbm
-package does not work.
-.)f
-or the Berkeley DB library.
-This form is in the file
-.i /etc/aliases.db
-(if using NEWDB)
-or
-.i /etc/aliases.dir
-and
-.i /etc/aliases.pag
-(if using NDBM).
-This is the form that
-.i sendmail
-actually uses to resolve aliases.
-This technique is used to improve performance.
-.pp
-The control of search order is actually set by the service switch.
-Essentially, the entry
-.(b
-O AliasFile=switch:aliases
-.)b
-is always added as the first alias entry;
-also, the first alias file name without a class
-(e.g., without
-.q nis:
-on the front)
-will be used as the name of the file for a ``files'' entry
-in the aliases switch.
-For example, if the configuration file contains
-.(b
-O AliasFile=/etc/aliases
-.)b
-and the service switch contains
-.(b
-aliases nis files nisplus
-.)b
-then aliases will first be searched in the NIS database,
-then in /etc/aliases,
-then in the NIS+ database.
-.pp
-You can also use
-.sm NIS -based
-alias files.
-For example, the specification:
-.(b
-O AliasFile=/etc/aliases
-O AliasFile=nis:mail.aliases@my.nis.domain
-.)b
-will first search the /etc/aliases file
-and then the map named
-.q mail.aliases
-in
-.q my.nis.domain .
-Warning: if you build your own
-.sm NIS -based
-alias files,
-be sure to provide the
-.b \-l
-flag to
-.i makedbm (8)
-to map upper case letters in the keys to lower case;
-otherwise, aliases with upper case letters in their names
-won't match incoming addresses.
-.pp
-Additional flags can be added after the colon
-exactly like a
-.b K
-line \(em for example:
-.(b
-O AliasFile=nis:\-N mail.aliases@my.nis.domain
-.)b
-will search the appropriate NIS map and always include null bytes in the key.
-Also:
-.(b
-O AliasFile=nis:\-f mail.aliases@my.nis.domain
-.)b
-will prevent sendmail from downcasing the key before the alias lookup.
-.sh 3 "Rebuilding the alias database"
-.pp
-The
-.i hash
-or
-.i dbm
-version of the database
-may be rebuilt explicitly by executing the command
-.(b
-newaliases
-.)b
-This is equivalent to giving
-.i sendmail
-the
-.b \-bi
-flag:
-.(b
-/usr/\*(SD/sendmail \-bi
-.)b
-.pp
-If the
-.b RebuildAliases
-(old
-.b D )
-option is specified in the configuration,
-.i sendmail
-will rebuild the alias database automatically
-if possible
-when it is out of date.
-Auto-rebuild can be dangerous
-on heavily loaded machines
-with large alias files;
-if it might take more than the rebuild timeout
-(option
-.b AliasWait ,
-old
-.b a ,
-which is normally five minutes)
-to rebuild the database,
-there is a chance that several processes will start the rebuild process
-simultaneously.
-.pp
-If you have multiple aliases databases specified,
-the
-.b \-bi
-flag rebuilds all the database types it understands
-(for example, it can rebuild NDBM databases but not NIS databases).
-.sh 3 "Potential problems"
-.pp
-There are a number of problems that can occur
-with the alias database.
-They all result from a
-.i sendmail
-process accessing the DBM version
-while it is only partially built.
-This can happen under two circumstances:
-One process accesses the database
-while another process is rebuilding it,
-or the process rebuilding the database dies
-(due to being killed or a system crash)
-before completing the rebuild.
-.pp
-Sendmail has three techniques to try to relieve these problems.
-First, it ignores interrupts while rebuilding the database;
-this avoids the problem of someone aborting the process
-leaving a partially rebuilt database.
-Second,
-it locks the database source file during the rebuild \(em
-but that may not work over NFS or if the file is unwritable.
-Third,
-at the end of the rebuild
-it adds an alias of the form
-.(b
-@: @
-.)b
-(which is not normally legal).
-Before
-.i sendmail
-will access the database,
-it checks to insure that this entry exists\**.
-.(f
-\**The
-.b AliasWait
-option is required in the configuration
-for this action to occur.
-This should normally be specified.
-.)f
-.sh 3 "List owners"
-.pp
-If an error occurs on sending to a certain address,
-say
-.q \fIx\fP ,
-.i sendmail
-will look for an alias
-of the form
-.q owner-\fIx\fP
-to receive the errors.
-This is typically useful
-for a mailing list
-where the submitter of the list
-has no control over the maintenance of the list itself;
-in this case the list maintainer would be the owner of the list.
-For example:
-.(b
-unix-wizards: eric@ucbarpa, wnj@monet, nosuchuser,
- sam@matisse
-owner-unix-wizards: unix-wizards-request
-unix-wizards-request: eric@ucbarpa
-.)b
-would cause
-.q eric@ucbarpa
-to get the error that will occur
-when someone sends to
-unix-wizards
-due to the inclusion of
-.q nosuchuser
-on the list.
-.pp
-List owners also cause the envelope sender address to be modified.
-The contents of the owner alias are used if they point to a single user,
-otherwise the name of the alias itself is used.
-For this reason, and to obey Internet conventions,
-the
-.q owner-
-address normally points at the
-.q -request
-address; this causes messages to go out with the typical Internet convention
-of using ``\c
-.i list -request''
-as the return address.
-.sh 2 "User Information Database"
-.pp
-If you have a version of
-.i sendmail
-with the user information database
-compiled in,
-and you have specified one or more databases using the
-.b U
-option,
-the databases will be searched for a
-.i user :maildrop
-entry.
-If found, the mail will be sent to the specified address.
-.sh 2 "Per-User Forwarding (.forward Files)"
-.pp
-As an alternative to the alias database,
-any user may put a file with the name
-.q .forward
-in his or her home directory.
-If this file exists,
-.i sendmail
-redirects mail for that user
-to the list of addresses listed in the .forward file.
-For example, if the home directory for user
-.q mckusick
-has a .forward file with contents:
-.(b
-mckusick@ernie
-kirk@calder
-.)b
-then any mail arriving for
-.q mckusick
-will be redirected to the specified accounts.
-.pp
-Actually, the configuration file defines a sequence of filenames to check.
-By default, this is the user's .forward file,
-but can be defined to be more generally using the
-.b ForwardPath
-option.
-If you change this,
-you will have to inform your user base of the change;
-\&.forward is pretty well incorporated into the collective subconscious.
-.sh 2 "Special Header Lines"
-.pp
-Several header lines have special interpretations
-defined by the configuration file.
-Others have interpretations built into
-.i sendmail
-that cannot be changed without changing the code.
-These builtins are described here.
-.sh 3 "Errors-To:"
-.pp
-If errors occur anywhere during processing,
-this header will cause error messages to go to
-the listed addresses.
-This is intended for mailing lists.
-.pp
-The Errors-To: header was created in the bad old days
-when UUCP didn't understand the distinction between an envelope and a header;
-this was a hack to provide what should now be passed
-as the envelope sender address.
-It should go away.
-It is only used if the
-.b UseErrorsTo
-option is set.
-.pp
-The Errors-To: header is officially deprecated
-and will go away in a future release.
-.sh 3 "Apparently-To:"
-.pp
-RFC 822 requires at least one recipient field
-(To:, Cc:, or Bcc: line)
-in every message.
-If a message comes in with no recipients listed in the message
-then
-.i sendmail
-will adjust the header based on the
-.q NoRecipientAction
-option.
-One of the possible actions is to add an
-.q "Apparently-To:"
-header line for any recipients it is aware of.
-.pp
-The Apparently-To: header is non-standard
-and is deprecated.
-.sh 3 "Precedence"
-.pp
-The Precedence: header can be used as a crude control of message priority.
-It tweaks the sort order in the queue
-and can be configured to change the message timeout values.
-.sh 2 "IDENT Protocol Support"
-.pp
-.i Sendmail
-supports the IDENT protocol as defined in RFC 1413.
-Although this enhances identification
-of the author of an email message
-by doing a ``call back'' to the originating system to include
-the owner of a particular TCP connection
-in the audit trail
-it is in no sense perfect;
-a determined forger can easily spoof the IDENT protocol.
-The following description is excerpted from RFC 1413:
-.ba +5
-.lp
-6. Security Considerations
-.lp
-The information returned by this protocol is at most as trustworthy
-as the host providing it OR the organization operating the host. For
-example, a PC in an open lab has few if any controls on it to prevent
-a user from having this protocol return any identifier the user
-wants. Likewise, if the host has been compromised the information
-returned may be completely erroneous and misleading.
-.lp
-The Identification Protocol is not intended as an authorization or
-access control protocol. At best, it provides some additional
-auditing information with respect to TCP connections. At worst, it
-can provide misleading, incorrect, or maliciously incorrect
-information.
-.lp
-The use of the information returned by this protocol for other than
-auditing is strongly discouraged. Specifically, using Identification
-Protocol information to make access control decisions - either as the
-primary method (i.e., no other checks) or as an adjunct to other
-methods may result in a weakening of normal host security.
-.lp
-An Identification server may reveal information about users,
-entities, objects or processes which might normally be considered
-private. An Identification server provides service which is a rough
-analog of the CallerID services provided by some phone companies and
-many of the same privacy considerations and arguments that apply to
-the CallerID service apply to Identification. If you wouldn't run a
-"finger" server due to privacy considerations you may not want to run
-this protocol.
-.ba
-.lp
-In some cases your system may not work properly with IDENT support
-due to a bug in the TCP/IP implementation.
-The symptoms will be that for some hosts
-the SMTP connection will be closed
-almost immediately.
-If this is true or if you do not want to use IDENT,
-you should set the IDENT timeout to zero;
-this will disable the IDENT protocol.
-.sh 1 "ARGUMENTS"
-.pp
-The complete list of arguments to
-.i sendmail
-is described in detail in Appendix A.
-Some important arguments are described here.
-.sh 2 "Queue Interval"
-.pp
-The amount of time between forking a process
-to run through the queue
-is defined by the
-.b \-q
-flag.
-If you run with delivery mode set to
-.b i
-or
-.b b
-this can be relatively large,
-since it will only be relevant
-when a host that was down comes back up.
-If you run in
-.b q
-mode
-it should be relatively short,
-since it defines the maximum amount of time that a message
-may sit in the queue.
-(See also the MinQueueAge option.)
-.pp
-RFC 1123 section 5.3.1.1 says that this value should be at least 30 minutes
-(although that probably doesn't make sense if you use ``queue-only'' mode).
-.sh 2 "Daemon Mode"
-.pp
-If you allow incoming mail over an IPC connection,
-you should have a daemon running.
-This should be set by your
-.i /etc/rc
-file using the
-.b \-bd
-flag.
-The
-.b \-bd
-flag and the
-.b \-q
-flag may be combined in one call:
-.(b
-/usr/\*(SD/sendmail \-bd \-q30m
-.)b
-.pp
-An alternative approach is to invoke sendmail from
-.i inetd (8)
-(use the
-.b \-bs
-flag to ask sendmail to speak SMTP on its standard input and output).
-This works and allows you to wrap
-.i sendmail
-in a TCP wrapper program,
-but may be a bit slower since the configuration file
-has to be re-read on every message that comes in.
-If you do this, you still need to have a
-.i sendmail
-running to flush the queue:
-.(b
-/usr/\*(SD/sendmail \-q30m
-.)b
-.sh 2 "Forcing the Queue"
-.pp
-In some cases you may find that the queue has gotten clogged for some reason.
-You can force a queue run
-using the
-.b \-q
-flag (with no value).
-It is entertaining to use the
-.b \-v
-flag (verbose)
-when this is done to watch what happens:
-.(b
-/usr/\*(SD/sendmail \-q \-v
-.)b
-.pp
-You can also limit the jobs to those with a particular queue identifier,
-sender, or recipient
-using one of the queue modifiers.
-For example,
-.q \-qRberkeley
-restricts the queue run to jobs that have the string
-.q berkeley
-somewhere in one of the recipient addresses.
-Similarly,
-.q \-qSstring
-limits the run to particular senders and
-.q \-qIstring
-limits it to particular queue identifiers.
-.sh 2 "Debugging"
-.pp
-There are a fairly large number of debug flags
-built into
-.i sendmail .
-Each debug flag has a number and a level,
-where higher levels means to print out more information.
-The convention is that levels greater than nine are
-.q absurd,
-i.e.,
-they print out so much information that you wouldn't normally
-want to see them except for debugging that particular piece of code.
-Debug flags are set using the
-.b \-d
-option;
-the syntax is:
-.(b
-.ta \w'debug-option 'u
-debug-flag: \fB\-d\fP debug-list
-debug-list: debug-option [ , debug-option ]*
-debug-option: debug-range [ . debug-level ]
-debug-range: integer | integer \- integer
-debug-level: integer
-.)b
-where spaces are for reading ease only.
-For example,
-.(b
-\-d12 Set flag 12 to level 1
-\-d12.3 Set flag 12 to level 3
-\-d3\-17 Set flags 3 through 17 to level 1
-\-d3\-17.4 Set flags 3 through 17 to level 4
-.)b
-For a complete list of the available debug flags
-you will have to look at the code
-(they are too dynamic to keep this documentation up to date).
-.sh 2 "Changing the Values of Options"
-.pp
-Options can be overridden using the
-.b \-o
-or
-.b \-O
-command line flags.
-For example,
-.(b
-/usr/\*(SD/sendmail \-oT2m
-.)b
-sets the
-.b T
-(timeout) option to two minutes
-for this run only;
-the equivalent line using the long option name is
-.(b
-/usr/\*(SD/sendmail -OTimeout.queuereturn=2m
-.)b
-.pp
-Some options have security implications.
-Sendmail allows you to set these,
-but relinquishes its setuid root permissions thereafter\**.
-.(f
-\**That is, it sets its effective uid to the real uid;
-thus, if you are executing as root,
-as from root's crontab file or during system startup
-the root permissions will still be honored.
-.)f
-.sh 2 "Trying a Different Configuration File"
-.pp
-An alternative configuration file
-can be specified using the
-.b \-C
-flag; for example,
-.(b
-/usr/\*(SD/sendmail \-Ctest.cf \-oQ/tmp/mqueue
-.)b
-uses the configuration file
-.i test.cf
-instead of the default
-.i /etc/sendmail.cf.
-If the
-.b \-C
-flag has no value
-it defaults to
-.i sendmail.cf
-in the current directory.
-.pp
-.i Sendmail
-gives up its setuid root permissions
-when you use this flag, so it is common to use a publicly writable directory
-(such as /tmp)
-as the spool directory (QueueDirectory or Q option) while testing.
-.sh 2 "Logging Traffic"
-.pp
-Many SMTP implementations do not fully implement the protocol.
-For example, some personal computer based SMTPs
-do not understand continuation lines in reply codes.
-These can be very hard to trace.
-If you suspect such a problem, you can set traffic logging using the
-.b \-X
-flag.
-For example,
-.(b
-/usr/\*(SD/sendmail \-X /tmp/traffic \-bd
-.)b
-will log all traffic in the file
-.i /tmp/traffic .
-.pp
-This logs a lot of data very quickly and should
-.b NEVER
-be used
-during normal operations.
-After starting up such a daemon,
-force the errant implementation to send a message to your host.
-All message traffic in and out of
-.i sendmail ,
-including the incoming SMTP traffic,
-will be logged in this file.
-.sh 2 "Testing Configuration Files"
-.pp
-When you build a configuration table,
-you can do a certain amount of testing
-using the
-.q "test mode"
-of
-.i sendmail .
-For example,
-you could invoke
-.i sendmail
-as:
-.(b
-sendmail \-bt \-Ctest.cf
-.)b
-which would read the configuration file
-.q test.cf
-and enter test mode.
-In this mode,
-you enter lines of the form:
-.(b
-rwset address
-.)b
-where
-.i rwset
-is the rewriting set you want to use
-and
-.i address
-is an address to apply the set to.
-Test mode shows you the steps it takes
-as it proceeds,
-finally showing you the address it ends up with.
-You may use a comma separated list of rwsets
-for sequential application of rules to an input.
-For example:
-.(b
-3,1,21,4 monet:bollard
-.)b
-first applies ruleset three to the input
-.q monet:bollard.
-Ruleset one is then applied to the output of ruleset three,
-followed similarly by rulesets twenty-one and four.
-.pp
-If you need more detail,
-you can also use the
-.q \-d21
-flag to turn on more debugging.
-For example,
-.(b
-sendmail \-bt \-d21.99
-.)b
-turns on an incredible amount of information;
-a single word address
-is probably going to print out several pages worth of information.
-.pp
-You should be warned that internally,
-.i sendmail
-applies ruleset 3 to all addresses.
-In test mode
-you will have to do that manually.
-For example, older versions allowed you to use
-.(b
-0 bruce@broadcast.sony.com
-.)b
-This version requires that you use:
-.(b
-3,0 bruce@broadcast.sony.com
-.)b
-.pp
-As of version 8.7,
-some other syntaxes are available in test mode:
-.bu
-\&.D\|x\|value
-defines macro
-.i x
-to have the indicated
-.i value .
-This is useful when debugging rules that use the
-.b $& \c
-.i x
-syntax.
-.bu
-\&.C\|c\|value
-adds the indicated
-.i value
-to class
-.i c .
-.bu
-\&.S\|ruleset
-dumps the contents of the indicated ruleset.
-.bu
-\-d\|debug-spec
-is equivalent to the command-line flag.
-.sh 2 "Persistent Host Status Information"
-.pp
-When
-.b HostStatusDirectory
-is enabled,
-information about the status of hosts is maintained on disk
-and can thus be shared between different instantiations of
-.i sendmail .
-The status of the last connection with each remote host
-may be viewed with the command:
-.(b
-sendmail \-bh
-.)b
-This information may be flushed with the command:
-.(b
-sendmail \-bH
-.)b
-Flushing the information prevents new
-.i sendmail
-processes from loading it,
-but does not prevent existing processes from using the status information
-that they already have.
-.sh 1 "TUNING"
-.pp
-There are a number of configuration parameters
-you may want to change,
-depending on the requirements of your site.
-Most of these are set
-using an option in the configuration file.
-For example,
-the line
-.q "O Timeout.queuereturn=5d"
-sets option
-.q Timeout.queuereturn
-to the value
-.q 5d
-(five days).
-.pp
-Most of these options have appropriate defaults for most sites.
-However,
-sites having very high mail loads may find they need to tune them
-as appropriate for their mail load.
-In particular,
-sites experiencing a large number of small messages,
-many of which are delivered to many recipients,
-may find that they need to adjust the parameters
-dealing with queue priorities.
-.pp
-All versions of
-.i sendmail
-prior to 8.7
-had single character option names.
-As of 8.7,
-options have long (multi-character names).
-Although old short names are still accepted,
-most new options do not have short equivalents.
-.pp
-This section only describes the options you are most likely
-to want to tweak;
-read section
-.\"XREF
-5
-for more details.
-.sh 2 "Timeouts"
-.pp
-All time intervals are set
-using a scaled syntax.
-For example,
-.q 10m
-represents ten minutes, whereas
-.q 2h30m
-represents two and a half hours.
-The full set of scales is:
-.(b
-.ta 4n
-s seconds
-m minutes
-h hours
-d days
-w weeks
-.)b
-.sh 3 "Queue interval"
-.pp
-The argument to the
-.b \-q
-flag
-specifies how often a sub-daemon will run the queue.
-This is typically set to between fifteen minutes
-and one hour.
-RFC 1123 section 5.3.1.1 recommends that this be at least 30 minutes.
-.sh 3 "Read timeouts"
-.pp
-Timeouts all have option names
-.q Timeout.\fIsuboption\fP .
-The recognized
-.i suboption s,
-their default values, and the minimum values
-allowed by RFC 1123 section 5.3.2 are:
-.nr ii 1i
-.ip connect
-The time to wait for an SMTP connection to open
-(the
-.i connect (2)
-system call)
-[0, unspecified].
-If zero, uses the kernel default.
-In no case can this option extend the timeout
-longer than the kernel provides, but it can shorten it.
-This is to get around kernels that provide an absurdly long connection timeout
-(90 minutes in one case).
-.ip iconnect
-The same as
-.i connect,
-except it applies only to the initial attempt to connect to a host
-for a given message
-[0, unspecified].
-The concept is that this should be very short (a few seconds);
-hosts that are well connected and responsive will thus be serviced immediately.
-Hosts that are slow will not hold up other deliveries in the initial
-delivery attempt.
-.ip initial
-The wait for the initial 220 greeting message
-[5m, 5m].
-.ip helo
-The wait for a reply from a HELO or EHLO command
-[5m, unspecified].
-This may require a host name lookup, so
-five minutes is probably a reasonable minimum.
-.ip mail\(dg
-The wait for a reply from a MAIL command
-[10m, 5m].
-.ip rcpt\(dg
-The wait for a reply from a RCPT command
-[1h, 5m].
-This should be long
-because it could be pointing at a list
-that takes a long time to expand
-(see below).
-.ip datainit\(dg
-The wait for a reply from a DATA command
-[5m, 2m].
-.ip datablock\(dg
-The wait for reading a data block
-(that is, the body of the message).
-[1h, 3m].
-This should be long because it also applies to programs
-piping input to
-.i sendmail
-which have no guarantee of promptness.
-.ip datafinal\(dg
-The wait for a reply from the dot terminating a message.
-[1h, 10m].
-If this is shorter than the time actually needed
-for the receiver to deliver the message,
-duplicates will be generated.
-This is discussed in RFC 1047.
-.ip rset
-The wait for a reply from a RSET command
-[5m, unspecified].
-.ip quit
-The wait for a reply from a QUIT command
-[2m, unspecified].
-.ip misc
-The wait for a reply from miscellaneous (but short) commands
-such as NOOP (no-operation) and VERB (go into verbose mode).
-[2m, unspecified].
-.ip command\(dg
-In server SMTP,
-the time to wait for another command.
-[1h, 5m].
-.ip ident
-The timeout waiting for a reply to an IDENT query
-[30s\**, unspecified].
-.(f
-\**On some systems the default is zero to turn the protocol off entirely.
-.)f
-.ip fileopen
-The timeout for opening .forward and :include: files [60s, none].
-.ip hoststatus
-How long status information about a host
-(e.g., host down)
-will be cached before it is considered stale
-[30m, unspecified].
-.lp
-For compatibility with old configuration files,
-if no
-.i suboption
-is specified,
-all the timeouts marked with \(dg are set to the indicated value.
-.pp
-Many of the RFC 1123 minimum values
-may well be too short.
-.i Sendmail
-was designed to the RFC 822 protocols,
-which did not specify read timeouts;
-hence, versions of
-.i sendmail
-prior to version 8.1 did not guarantee to reply to messages promptly.
-In particular, a
-.q RCPT
-command specifying a mailing list
-will expand and verify the entire list;
-a large list on a slow system
-may easily take more than five minutes\**.
-.(f
-\**This verification includes looking up every address
-with the name server;
-this involves network delays,
-and can in some cases can be considerable.
-.)f
-I recommend a one hour timeout \*-
-since a communications failure during the RCPT phase is rare,
-a long timeout is not onerous
-and may ultimately help reduce network load
-and duplicated messages.
-.pp
-For example, the lines:
-.(b
-O Timeout.command=25m
-O Timeout.datablock=3h
-.)b
-sets the server SMTP command timeout to 25 minutes
-and the input data block timeout to three hours.
-.sh 3 "Message timeouts"
-.pp
-After sitting in the queue for a few days,
-a message will time out.
-This is to insure that at least the sender is aware
-of the inability to send a message.
-The timeout is typically set to five days.
-It is sometimes considered convenient to also send a warning message
-if the message is in the queue longer than a few hours
-(assuming you normally have good connectivity;
-if your messages normally took several hours to send
-you wouldn't want to do this because it wouldn't be an unusual event).
-These timeouts are set using the
-.b Timeout.queuereturn
-and
-.b Timeout.queuewarn
-options in the configuration file
-(previously both were set using the
-.b T
-option).
-.pp
-Since these options are global,
-and since you can not know
-.i "a priori"
-how long another host outside your domain will be down,
-a five day timeout is recommended.
-This allows a recipient to fix the problem even if it occurs
-at the beginning of a long weekend.
-RFC 1123 section 5.3.1.1 says that this parameter
-should be ``at least 4\-5 days''.
-.pp
-The
-.b Timeout.queuewarn
-value can be piggybacked on the
-.b T
-option by indicating a time after which
-a warning message should be sent;
-the two timeouts are separated by a slash.
-For example, the line
-.(b
-OT5d/4h
-.)b
-causes email to fail after five days,
-but a warning message will be sent after four hours.
-This should be large enough that the message will have been tried
-several times.
-.sh 2 "Forking During Queue Runs"
-.pp
-By setting the
-.b ForkEachJob
-(\c
-.b Y )
-option,
-.i sendmail
-will fork before each individual message
-while running the queue.
-This will prevent
-.i sendmail
-from consuming large amounts of memory,
-so it may be useful in memory-poor environments.
-However, if the
-.b ForkEachJob
-option is not set,
-.i sendmail
-will keep track of hosts that are down during a queue run,
-which can improve performance dramatically.
-.pp
-If the
-.b ForkEachJob
-option is set,
-.i sendmail
-can not use connection caching.
-.sh 2 "Queue Priorities"
-.pp
-Every message is assigned a priority when it is first instantiated,
-consisting of the message size (in bytes)
-offset by the message class
-(which is determined from the Precedence: header)
-times the
-.q "work class factor"
-and the number of recipients times the
-.q "work recipient factor."
-The priority is used to order the queue.
-Higher numbers for the priority mean that the message will be processed later
-when running the queue.
-.pp
-The message size is included so that large messages are penalized
-relative to small messages.
-The message class allows users to send
-.q "high priority"
-messages by including a
-.q Precedence:
-field in their message;
-the value of this field is looked up in the
-.b P
-lines of the configuration file.
-Since the number of recipients affects the amount of load a message presents
-to the system,
-this is also included into the priority.
-.pp
-The recipient and class factors
-can be set in the configuration file using the
-.b RecipientFactor
-(\c
-.b y )
-and
-.b ClassFactor
-(\c
-.b z )
-options respectively.
-They default to 30000 (for the recipient factor)
-and 1800
-(for the class factor).
-The initial priority is:
-.EQ
-pri = msgsize - (class times bold ClassFactor) + (nrcpt times bold RecipientFactor)
-.EN
-(Remember, higher values for this parameter actually mean
-that the job will be treated with lower priority.)
-.pp
-The priority of a job can also be adjusted each time it is processed
-(that is, each time an attempt is made to deliver it)
-using the
-.q "work time factor,"
-set by the
-.b RetryFactor
-(\c
-.b Z )
-option.
-This is added to the priority,
-so it normally decreases the precedence of the job,
-on the grounds that jobs that have failed many times
-will tend to fail again in the future.
-The
-.b RetryFactor
-option defaults to 90000.
-.sh 2 "Load Limiting"
-.pp
-.i Sendmail
-can be asked to queue (but not deliver)
-mail if the system load average gets too high
-using the
-.b QueueLA
-(\c
-.b x )
-option.
-When the load average exceeds the value of the
-.b QueueLA
-option,
-the delivery mode is set to
-.b q
-(queue only)
-if the
-.b QueueFactor
-(\c
-.b q )
-option divided by the difference in the current load average and the
-.b QueueLA
-option
-plus one
-exceeds the priority of the message \(em
-that is, the message is queued iff:
-.EQ
-pri > { bold QueueFactor } over { LA - { bold QueueLA } + 1 }
-.EN
-The
-.b QueueFactor
-option defaults to 600000,
-so each point of load average is worth 600000
-priority points
-(as described above).
-.pp
-For drastic cases,
-the
-.b RefuseLA
-(\c
-.b X )
-option defines a load average at which
-.i sendmail
-will refuse
-to accept network connections.
-Locally generated mail
-(including incoming UUCP mail)
-is still accepted.
-.sh 2 "Delivery Mode"
-.pp
-There are a number of delivery modes that
-.i sendmail
-can operate in,
-set by the
-.b DeliveryMode
-(\c
-.b d )
-configuration option.
-These modes
-specify how quickly mail will be delivered.
-Legal modes are:
-.(b
-.ta 4n
-i deliver interactively (synchronously)
-b deliver in background (asynchronously)
-q queue only (don't deliver)
-d defer delvery attempts (don't deliver)
-.)b
-There are tradeoffs.
-Mode
-.q i
-gives the sender the quickest feedback,
-but may slow down some mailers and
-is hardly ever necessary.
-Mode
-.q b
-delivers promptly but
-can cause large numbers of processes
-if you have a mailer that takes a long time to deliver a message.
-Mode
-.q q
-minimizes the load on your machine,
-but means that delivery may be delayed for up to the queue interval.
-Mode
-.q d
-is identical to mode
-.q q
-except that it also prevents all the early map lookups from working;
-it is intended for ``dial on demand'' sites where DNS lookups
-might cost real money.
-Some simple error messages
-(e.g., host unknown during the SMTP protocol)
-will be delayed using this mode.
-Mode
-.q b
-is the usual default.
-.pp
-If you run in mode
-.q q
-(queue only),
-.q d
-(defer),
-or
-.q b
-(deliver in background)
-.i sendmail
-will not expand aliases and follow .forward files
-upon initial receipt of the mail.
-This speeds up the response to RCPT commands.
-Mode
-.q i
-cannot be used by the SMTP server.
-.sh 2 "Log Level"
-.pp
-The level of logging can be set for
-.i sendmail .
-The default using a standard configuration table is level 9.
-The levels are as follows:
-.nr ii 0.5i
-.ip 0
-Minimal logging.
-.ip 1
-Serious system failures and potential security problems.
-.ip 2
-Lost communications (network problems) and protocol failures.
-.ip 3
-Other serious failures, malformed addresses, transient forward/include
-errors, connection timeouts.
-.ip 4
-Minor failures, out of date alias databases, connection rejections
-via check_ rulesets.
-.ip 5
-Message collection statistics.
-.ip 6
-Creation of error messages,
-VRFY and EXPN commands.
-.ip 7
-Delivery failures (host or user unknown, etc.).
-.ip 8
-Successful deliveries and alias database rebuilds.
-.ip 9
-Messages being deferred
-(due to a host being down, etc.).
-.ip 10
-Database expansion (alias, forward, and userdb lookups).
-.ip 11
-NIS errors and end of job processing.
-.ip 12
-Logs all SMTP connections.
-.ip 13
-Log bad user shells, files with improper permissions, and other
-questionable situations.
-.ip 14
-Logs refused connections.
-.ip 15
-Log all incoming and outgoing SMTP commands.
-.ip 20
-Logs attempts to run locked queue files.
-These are not errors,
-but can be useful to note if your queue appears to be clogged.
-.ip 30
-Lost locks (only if using lockf instead of flock).
-.lp
-Additionally,
-values above 64 are reserved for extremely verbose debugging output.
-No normal site would ever set these.
-.sh 2 "File Modes"
-.pp
-The modes used for files depend on what functionality you want
-and the level of security you require.
-In many cases
-.i sendmail
-does careful checking of the modes
-of files and directories
-to avoid accidental compromise;
-if you want to make it possible to have group-writable support files
-you may need to use the
-.b DontBlameSendmail
-option to turn off some of these checks.
-.sh 3 "To suid or not to suid?"
-.pp
-.i Sendmail
-is normally installed
-setuid to root.
-At the point where it is about to
-.i exec \|(2)
-a mailer,
-it checks to see if the userid is zero (root);
-if so,
-it resets the userid and groupid to a default
-(set by the
-.b U=
-equate in the mailer line;
-if that is not set, the
-.b DefaultUser
-option is used).
-This can be overridden
-by setting the
-.b S
-flag to the mailer
-for mailers that are trusted
-and must be called as root.
-However,
-this will cause mail processing
-to be accounted
-(using
-.i sa \|(8))
-to root
-rather than to the user sending the mail.
-.pp
-If you don't make
-.i sendmail
-setuid to root, it will still run but you lose a lot of functionality
-and a lot of privacy, since you'll have to make the queue directory
-world readable.
-You could also make
-.i sendmail
-setuid to some pseudo-user
-(e.g., create a user called
-.q sendmail
-and make
-.i sendmail
-setuid to that)
-which will fix the privacy problems
-but not the functionality issues.
-Also, this isn't a guarantee of security:
-for example,
-root occasionally sends mail,
-and the daemon often runs as root.
-Note however that
-.i sendmail
-must run as root in order to create the SMTP listener socket.
-.pp
-A middle ground is to make
-.i sendmail
-setuid to root,
-but set the
-.b RunAsUser
-option.
-This causes
-.i sendmail
-to become the indicated user as soon as it has done the startup
-that requires root privileges
-(primarily, opening the
-.sm SMTP
-socket).
-If you use
-.b RunAsUser ,
-the queue directory
-(normally
-.i /var/spool/mqueue )
-should be owned by that user,
-and all files and databases
-(including user
-.i \&.forward
-files,
-alias files,
-:include: files,
-and external databases)
-must be readable by that user.
-.b RunAsUser
-is probably best suited for firewall configurations
-that don't have regular user logins.
-.sh 3 "Turning off security checks"
-.pp
-.i Sendmail
-is very particular about the modes of files that it reads or writes.
-For example, by default it will refuse to read most files
-that are group writable
-on the grounds that they might have been tampered with
-by someone other than the owner;
-it will even refuse to read files in group writable directories.
-.pp
-If you are
-.i quite
-sure that your configuration is safe and you want
-.i sendmail
-to avoid these security checks,
-you can turn off certain checks using the
-.b DontBlameSendmail
-option.
-This option takes one or more names that disable checks.
-In the descriptions that follow,
-.q "unsafe directory"
-means a directory that is writable by anyone other than the owner.
-The values are:
-.nr ii 0.5i
-.ip Safe
-No special handling.
-.ip AssumeSafeChown
-Assume that the
-.i chown
-system call is restricted to root.
-Since some versions of Unix permit regular users
-to give away their files to other users on some filesystems,
-.i sendmail
-often cannot assume that a given file was created by the owner,
-particularly when it is in a writable directory.
-You can set this flag if you know that file giveaway is restricted
-on your system.
-.ip ClassFileInUnsafeDirPath
-When reading class files (using the
-.b F
-line in the configuration file),
-allow files that are in unsafe directories.
-.ip ErrorHeaderInUnsafeDirPath
-Allow the file named in the
-.b ErrorHeader
-option to be in an unsafe directory.
-.ip GroupWritableDirPathSafe
-Change the definition of
-.q "unsafe directory"
-to consider group-writable directories to be safe.
-World-writable directories are always unsafe.
-.ip GroupWritableForwardFileSafe
-Accept group-writable
-.i \&.forward
-files.
-.ip GroupWritableIncludeFileSafe
-Accept group-writable
-.i :include:
-files.
-.ip GroupWritableAliasFile
-Allow group-writable alias files.
-.ip HelpFileInUnsafeDirPath
-Allow the file named in the
-.b HelpFile
-option to be in an unsafe directory.
-.ip WorldWritableAliasFile
-Accept world-writable alias files.
-.ip ForwardFileInGroupWritableDirPath
-Allow
-.i \&.forward
-files in group writable directories.
-.ip IncludeFileInGroupWritableDirPath
-Allow
-.i :include:
-files in group writable directories.
-.ip ForwardFileInUnsafeDirPath
-Allow
-.i \&.forward
-files in unsafe directories.
-.ip IncludeFileInUnsafeDirPath
-Allow
-.i :include:
-files in unsafe directories.
-.ip ForwardFileInUnsafeDirPathSafe
-Allow a
-.i \&.forward
-file that is in an unsafe directory to include references
-to program and files.
-.ip IncludeFileInUnsafeDirPathSafe
-Allow a
-.i :include:
-file that is in an unsafe directory to include references
-to program and files.
-.ip MapInUnsafeDirPath
-Allow maps (e.g.,
-.i hash ,
-.i btree ,
-and
-.i dbm
-files)
-in unsafe directories.
-.ip LinkedAliasFileInWritableDir
-Allow an alias file that is a link in a writable directory.
-.ip LinkedClassFileInWritableDir
-Allow class files that are links in writable directories.
-.ip LinkedForwardFileInWritableDir
-Allow
-.i \&.forward
-files that are links in writable directories.
-.ip LinkedIncludeFileInWritableDir
-Allow
-.i :include:
-files that are links in writable directories.
-.ip LinkedMapInWritableDir
-Allow map files that are links in writable directories.
-.ip LinkedServiceSwitchFileInWritableDir
-Allow the service switch file to be a link
-even if the directory is writable.
-.ip FileDeliveryToHardLink
-Allow delivery to files that are hard links.
-.ip FileDeliveryToSymLink
-Allow delivery to files that are symbolic links.
-.ip RunProgramInUnsafeDirPath
-Go ahead and run programs that are in writable directories.
-.ip RunWritableProgram
-Go ahead and run programs that are group- or world-writable.
-.ip WriteMapToHardLink
-Allow writes to maps that are hard links.
-.ip WriteMapToSymLink
-Allow writes to maps that are symbolic links.
-.ip WriteStatsToHardLink
-Allow the status file to be a hard link.
-.ip WriteStatsToSymLink
-Allow the status file to be a symbolic link.
-.sh 2 "Connection Caching"
-.pp
-When processing the queue,
-.i sendmail
-will try to keep the last few open connections open
-to avoid startup and shutdown costs.
-This only applies to IPC connections.
-.pp
-When trying to open a connection
-the cache is first searched.
-If an open connection is found, it is probed to see if it is still active
-by sending a
-.sm RSET
-command.
-It is not an error if this fails;
-instead, the connection is closed and reopened.
-.pp
-Two parameters control the connection cache.
-The
-.b ConnectionCacheSize
-(\c
-.b k )
-option defines the number of simultaneous open connections
-that will be permitted.
-If it is set to zero,
-connections will be closed as quickly as possible.
-The default is one.
-This should be set as appropriate for your system size;
-it will limit the amount of system resources that
-.i sendmail
-will use during queue runs.
-Never set this higher than 4.
-.pp
-The
-.b ConnectionCacheTimeout
-(\c
-.b K )
-option specifies the maximum time that any cached connection
-will be permitted to idle.
-When the idle time exceeds this value
-the connection is closed.
-This number should be small
-(under ten minutes)
-to prevent you from grabbing too many resources
-from other hosts.
-The default is five minutes.
-.sh 2 "Name Server Access"
-.pp
-Control of host address lookups is set by the
-.b hosts
-service entry in your service switch file.
-If you are on a system that has built-in service switch support
-(e.g., Ultrix, Solaris, or DEC OSF/1)
-then your system is probably configured properly already.
-Otherwise,
-.i sendmail
-will consult the file
-.b /etc/service.switch ,
-which should be created.
-.i Sendmail
-only uses two entries:
-.b hosts
-and
-.b aliases ,
-although system routines may use other services
-(notably the
-.b passwd
-service for user name lookups by
-.i getpwname ).
-.pp
-However, some systems (such as SunOS 4.X)
-will do DNS lookups
-regardless of the setting of the service switch entry.
-In particular, the system routine
-.i gethostbyname (3)
-is used to look up host names,
-and many vendor versions try some combination of DNS, NIS,
-and file lookup in /etc/hosts
-without consulting a service switch.
-.i Sendmail
-makes no attempt to work around this problem,
-and the DNS lookup will be done anyway.
-If you do not have a nameserver configured at all,
-such as at a UUCP-only site,
-.i sendmail
-will get a
-.q "connection refused"
-message when it tries to connect to the name server.
-If the
-.b hosts
-switch entry has the service
-.q dns
-listed somewhere in the list,
-.i sendmail
-will interpret this to mean a temporary failure
-and will queue the mail for later processing;
-otherwise, it ignores the name server data.
-.pp
-The same technique is used to decide whether to do MX lookups.
-If you want MX support, you
-.i must
-have
-.q dns
-listed as a service in the
-.b hosts
-switch entry.
-.pp
-The
-.b ResolverOptions
-(\c
-.b I )
-option allows you to tweak name server options.
-The command line takes a series of flags as documented in
-.i resolver (3)
-(with the leading
-.q RES_
-deleted).
-Each can be preceded by an optional `+' or `\(mi'.
-For example, the line
-.(b
-O ResolverOptions=+AAONLY \(miDNSRCH
-.)b
-turns on the AAONLY (accept authoritative answers only)
-and turns off the DNSRCH (search the domain path) options.
-Most resolver libraries default DNSRCH, DEFNAMES, and RECURSE
-flags on and all others off.
-You can also include
-.q HasWildcardMX
-to specify that there is a wildcard MX record matching your domain;
-this turns off MX matching when canonifying names,
-which can lead to inappropriate canonifications.
-.pp
-Version level 1 configurations
-turn DNSRCH and DEFNAMES off when doing delivery lookups,
-but leave them on everywhere else.
-Version 8 of
-.i sendmail
-ignores them when doing canonification lookups
-(that is, when using $[ ... $]),
-and always does the search.
-If you don't want to do automatic name extension,
-don't call $[ ... $].
-.pp
-The search rules for $[ ... $] are somewhat different than usual.
-If the name being looked up
-has at least one dot, it always tries the unmodified name first.
-If that fails, it tries the reduced search path,
-and lastly tries the unmodified name
-(but only for names without a dot,
-since names with a dot have already been tried).
-This allows names such as
-``utc.CS''
-to match the site in Czechoslovakia
-rather than the site in your local Computer Science department.
-It also prefers A and CNAME records over MX records \*-
-that is, if it finds an MX record it makes note of it,
-but keeps looking.
-This way, if you have a wildcard MX record matching your domain,
-it will not assume that all names match.
-.pp
-To completely turn off all name server access
-on systems without service switch support
-(such as SunOS 4.X)
-you will have to recompile with
-\-DNAMED_BIND=0
-and remove \-lresolv from the list of libraries to be searched
-when linking.
-.sh 2 "Moving the Per-User Forward Files"
-.pp
-Some sites mount each user's home directory
-from a local disk on their workstation,
-so that local access is fast.
-However, the result is that .forward file lookups are slow.
-In some cases,
-mail can even be delivered on machines inappropriately
-because of a file server being down.
-The performance can be especially bad if you run the automounter.
-.pp
-The
-.b ForwardPath
-(\c
-.b J )
-option allows you to set a path of forward files.
-For example, the config file line
-.(b
-O ForwardPath=/var/forward/$u:$z/.forward.$w
-.)b
-would first look for a file with the same name as the user's login
-in /var/forward;
-if that is not found (or is inaccessible)
-the file
-``.forward.\c
-.i machinename ''
-in the user's home directory is searched.
-A truly perverse site could also search by sender
-by using $r, $s, or $f.
-.pp
-If you create a directory such as /var/forward,
-it should be mode 1777
-(that is, the sticky bit should be set).
-Users should create the files mode 644.
-Note that you must use the
-forwardfileinunsafedirpath and
-forwardfileinunsafedirpathsafe
-flags with the DontBlameSendmail option
-to allow forward files in a world
-writable directory.
-This might also be used as a
-denial of service
-attack (users could create forward files for other users);
-a better approach might be to create
-/var/forward
-mode 755
-and create empty files for each user,
-owned by that user,
-mode 644.
-If you do this, you don't have to set the DontBlameSendmail options
-indicated above.
-.sh 2 "Free Space"
-.pp
-On systems that have one of the system calls in the
-.i statfs (2)
-family
-(including
-.i statvfs
-and
-.i ustat ),
-you can specify a minimum number of free blocks on the queue filesystem
-using the
-.b MinFreeBlocks
-(\c
-.b b )
-option.
-If there are fewer than the indicated number of blocks free
-on the filesystem on which the queue is mounted
-the SMTP server will reject mail
-with the
-452 error code.
-This invites the SMTP client to try again later.
-.pp
-Beware of setting this option too high;
-it can cause rejection of email
-when that mail would be processed without difficulty.
-.sh 2 "Maximum Message Size"
-.pp
-To avoid overflowing your system with a large message,
-the
-.b MaxMessageSize
-option can be set to set an absolute limit
-on the size of any one message.
-This will be advertised in the ESMTP dialogue
-and checked during message collection.
-.sh 2 "Privacy Flags"
-.pp
-The
-.b PrivacyOptions
-(\c
-.b p )
-option allows you to set certain
-``privacy''
-flags.
-Actually, many of them don't give you any extra privacy,
-rather just insisting that client SMTP servers
-use the HELO command
-before using certain commands
-or adding extra headers to indicate possible spoof attempts.
-.pp
-The option takes a series of flag names;
-the final privacy is the inclusive or of those flags.
-For example:
-.(b
-O PrivacyOptions=needmailhelo, noexpn
-.)b
-insists that the HELO or EHLO command be used before a MAIL command is accepted
-and disables the EXPN command.
-.pp
-The flags are detailed in section
-.\"XREF
-5.6.
-.sh 2 "Send to Me Too"
-.pp
-Normally,
-.i sendmail
-deletes the (envelope) sender from any list expansions.
-For example, if
-.q matt
-sends to a list that contains
-.q matt
-as one of the members he won't get a copy of the message.
-If the
-.b \-m
-(me too)
-command line flag, or if the
-.b MeToo
-(\c
-.b m )
-option is set in the configuration file,
-this behaviour is suppressed.
-Some sites like to run the
-.sm SMTP
-daemon with
-.b \-m .
-.sh 1 "THE WHOLE SCOOP ON THE CONFIGURATION FILE"
-.pp
-This section describes the configuration file
-in detail.
-.pp
-There is one point that should be made clear immediately:
-the syntax of the configuration file
-is designed to be reasonably easy to parse,
-since this is done every time
-.i sendmail
-starts up,
-rather than easy for a human to read or write.
-On the
-.q "future project"
-list is a
-configuration-file compiler.
-.pp
-The configuration file is organized as a series of lines,
-each of which begins with a single character
-defining the semantics for the rest of the line.
-Lines beginning with a space or a tab
-are continuation lines
-(although the semantics are not well defined in many places).
-Blank lines and lines beginning with a sharp symbol
-(`#')
-are comments.
-.sh 2 "R and S \*- Rewriting Rules"
-.pp
-The core of address parsing
-are the rewriting rules.
-These are an ordered production system.
-.i Sendmail
-scans through the set of rewriting rules
-looking for a match on the left hand side
-(LHS)
-of the rule.
-When a rule matches,
-the address is replaced by the right hand side
-(RHS)
-of the rule.
-.pp
-There are several sets of rewriting rules.
-Some of the rewriting sets are used internally
-and must have specific semantics.
-Other rewriting sets
-do not have specifically assigned semantics,
-and may be referenced by the mailer definitions
-or by other rewriting sets.
-.pp
-The syntax of these two commands are:
-.(b F
-.b S \c
-.i n
-.)b
-Sets the current ruleset being collected to
-.i n .
-If you begin a ruleset more than once
-it appends to the old definition.
-.(b F
-.b R \c
-.i lhs
-.i rhs
-.i comments
-.)b
-The
-fields must be separated
-by at least one tab character;
-there may be embedded spaces
-in the fields.
-The
-.i lhs
-is a pattern that is applied to the input.
-If it matches,
-the input is rewritten to the
-.i rhs .
-The
-.i comments
-are ignored.
-.pp
-Macro expansions of the form
-.b $ \c
-.i x
-are performed when the configuration file is read.
-Expansions of the form
-.b $& \c
-.i x
-are performed at run time using a somewhat less general algorithm.
-This is intended only for referencing internally defined macros
-such as
-.b $h
-that are changed at runtime.
-.sh 3 "The left hand side"
-.pp
-The left hand side of rewriting rules contains a pattern.
-Normal words are simply matched directly.
-Metasyntax is introduced using a dollar sign.
-The metasymbols are:
-.(b
-.ta \w'\fB$=\fP\fIx\fP 'u
-\fB$*\fP Match zero or more tokens
-\fB$+\fP Match one or more tokens
-\fB$\-\fP Match exactly one token
-\fB$=\fP\fIx\fP Match any phrase in class \fIx\fP
-\fB$~\fP\fIx\fP Match any word not in class \fIx\fP
-.)b
-If any of these match,
-they are assigned to the symbol
-.b $ \c
-.i n
-for replacement on the right hand side,
-where
-.i n
-is the index in the LHS.
-For example,
-if the LHS:
-.(b
-$\-:$+
-.)b
-is applied to the input:
-.(b
-UCBARPA:eric
-.)b
-the rule will match, and the values passed to the RHS will be:
-.(b
-.ta 4n
-$1 UCBARPA
-$2 eric
-.)b
-.pp
-Additionally, the LHS can include
-.b $@
-to match zero tokens.
-This is
-.i not
-bound to a
-.b $ \c
-.i n
-on the RHS, and is normally only used when it stands alone
-in order to match the null input.
-.sh 3 "The right hand side"
-.pp
-When the left hand side of a rewriting rule matches,
-the input is deleted and replaced by the right hand side.
-Tokens are copied directly from the RHS
-unless they begin with a dollar sign.
-Metasymbols are:
-.(b
-.ta \w'$#mailer\0\0\0'u
-\fB$\fP\fIn\fP Substitute indefinite token \fIn\fP from LHS
-\fB$[\fP\fIname\fP\fB$]\fP Canonicalize \fIname\fP
-\fB$(\fP\fImap key\fP \fB$@\fP\fIarguments\fP \fB$:\fP\fIdefault\fP \fB$)\fP
- Generalized keyed mapping function
-\fB$>\fP\fIn\fP \*(lqCall\*(rq ruleset \fIn\fP
-\fB$#\fP\fImailer\fP Resolve to \fImailer\fP
-\fB$@\fP\fIhost\fP Specify \fIhost\fP
-\fB$:\fP\fIuser\fP Specify \fIuser\fP
-.)b
-.pp
-The
-.b $ \c
-.i n
-syntax substitutes the corresponding value from a
-.b $+ ,
-.b $\- ,
-.b $* ,
-.b $= ,
-or
-.b $~
-match on the LHS.
-It may be used anywhere.
-.pp
-A host name enclosed between
-.b $[
-and
-.b $]
-is looked up in the host database(s)
-and replaced by the canonical name\**.
-.(f
-\**This is actually
-completely equivalent
-to $(host \fIhostname\fP$).
-In particular, a
-.b $:
-default can be used.
-.)f
-For example,
-.q $[ftp$]
-might become
-.q ftp.CS.Berkeley.EDU
-and
-.q $[[128.32.130.2]$]
-would become
-.q vangogh.CS.Berkeley.EDU.
-.i Sendmail
-recognizes its numeric IP address
-without calling the name server
-and replaces it with its canonical name.
-.pp
-The
-.b $(
-\&...
-.b $)
-syntax is a more general form of lookup;
-it uses a named map instead of an implicit map.
-If no lookup is found, the indicated
-.i default
-is inserted;
-if no default is specified and no lookup matches,
-the value is left unchanged.
-The
-.i arguments
-are passed to the map for possible use.
-.pp
-The
-.b $> \c
-.i n
-syntax
-causes the remainder of the line to be substituted as usual
-and then passed as the argument to ruleset
-.i n .
-The final value of ruleset
-.i n
-then becomes
-the substitution for this rule.
-The
-.b $>
-syntax expands everything after the ruleset name
-to the end of the replacement string
-and then passes that as the initial input to the ruleset.
-Recursive calls are allowed.
-For example,
-.(b
-$>0 $>3 $1
-.)b
-expands $1, passes that to ruleset 3, and then passes the result
-of ruleset 3 to ruleset 0.
-.pp
-The
-.b $#
-syntax should
-.i only
-be used in ruleset zero
-or a subroutine of ruleset zero.
-It causes evaluation of the ruleset to terminate immediately,
-and signals to
-.i sendmail
-that the address has completely resolved.
-The complete syntax is:
-.(b
-\fB$#\fP\fImailer\fP \fB$@\fP\fIhost\fP \fB$:\fP\fIuser\fP
-.)b
-This specifies the
-{mailer, host, user}
-3-tuple necessary to direct the mailer.
-If the mailer is local
-the host part may be omitted\**.
-.(f
-\**You may want to use it for special
-.q "per user"
-extensions.
-For example, in the address
-.q jgm+foo@CMU.EDU ;
-the
-.q +foo
-part is not part of the user name,
-and is passed to the local mailer for local use.
-.)f
-The
-.i mailer
-must be a single word,
-but the
-.i host
-and
-.i user
-may be multi-part.
-If the
-.i mailer
-is the builtin IPC mailer,
-the
-.i host
-may be a colon-separated list of hosts
-that are searched in order for the first working address
-(exactly like MX records).
-The
-.i user
-is later rewritten by the mailer-specific envelope rewriting set
-and assigned to the
-.b $u
-macro.
-As a special case, if the mailer specified has the
-.b F=@
-flag specified
-and the first character of the
-.b $:
-value is
-.q @ ,
-the
-.q @
-is stripped off, and a flag is set in the address descriptor
-that causes sendmail to not do ruleset 5 processing.
-.pp
-Normally, a rule that matches is retried,
-that is,
-the rule loops until it fails.
-A RHS may also be preceded by a
-.b $@
-or a
-.b $:
-to change this behavior.
-A
-.b $@
-prefix causes the ruleset to return with the remainder of the RHS
-as the value.
-A
-.b $:
-prefix causes the rule to terminate immediately,
-but the ruleset to continue;
-this can be used to avoid continued application of a rule.
-The prefix is stripped before continuing.
-.pp
-The
-.b $@
-and
-.b $:
-prefixes may precede a
-.b $>
-spec;
-for example:
-.(b
-.ta 8n
-R$+ $: $>7 $1
-.)b
-matches anything,
-passes that to ruleset seven,
-and continues;
-the
-.b $:
-is necessary to avoid an infinite loop.
-.pp
-Substitution occurs in the order described,
-that is,
-parameters from the LHS are substituted,
-hostnames are canonicalized,
-.q subroutines
-are called,
-and finally
-.b $# ,
-.b $@ ,
-and
-.b $:
-are processed.
-.sh 3 "Semantics of rewriting rule sets"
-.pp
-There are six rewriting sets
-that have specific semantics.
-Five of these are related as depicted by figure 1.
-.(z
-.hl
-.ie n \{\
-.(c
- +---+
- -->| 0 |-->resolved address
- / +---+
- / +---+ +---+
- / ---->| 1 |-->| S |--
- +---+ / +---+ / +---+ +---+ \e +---+
-addr-->| 3 |-->| D |-- --->| 4 |-->msg
- +---+ +---+ \e +---+ +---+ / +---+
- --->| 2 |-->| R |--
- +---+ +---+
-.)c
-
-.\}
-.el .ie !"\*(.T"" \
-\{\
-.PS
-boxwid = 0.3i
-boxht = 0.3i
-movewid = 0.3i
-moveht = 0.3i
-linewid = 0.3i
-lineht = 0.3i
-
- box invis "addr"; arrow
-Box3: box "3"
-A1: arrow
-BoxD: box "D"; line; L1: Here
-C: [
- C1: arrow; box "1"; arrow; box "S"; line; E1: Here
- move to C1 down 0.5; right
- C2: arrow; box "2"; arrow; box "R"; line; E2: Here
- ] with .w at L1 + (0.5, 0)
- move to C.e right 0.5
-L4: arrow; box "4"; arrow; box invis "msg"
- line from L1 to C.C1
- line from L1 to C.C2
- line from C.E1 to L4
- line from C.E2 to L4
- move to BoxD.n up 0.6; right
-Box0: arrow; box "0"
- arrow; box invis "resolved address" width 1.3
- line from 1/3 of the way between A1 and BoxD.w to Box0
-.PE
-.\}
-.el .sp 2i
-.ce
-Figure 1 \*- Rewriting set semantics
-.(c
-D \*- sender domain addition
-S \*- mailer-specific sender rewriting
-R \*- mailer-specific recipient rewriting
-.)c
-.hl
-.)z
-.pp
-Ruleset three
-should turn the address into
-.q "canonical form."
-This form should have the basic syntax:
-.(b
-local-part@host-domain-spec
-.)b
-Ruleset three
-is applied by
-.i sendmail
-before doing anything with any address.
-.pp
-If no
-.q @
-sign is specified,
-then the
-host-domain-spec
-.i may
-be appended (box
-.q D
-in Figure 1)
-from the
-sender address
-(if the
-.b C
-flag is set in the mailer definition
-corresponding to the
-.i sending
-mailer).
-.pp
-Ruleset zero
-is applied after ruleset three
-to addresses that are going to actually specify recipients.
-It must resolve to a
-.i "{mailer, host, user}"
-triple.
-The
-.i mailer
-must be defined in the mailer definitions
-from the configuration file.
-The
-.i host
-is defined into the
-.b $h
-macro
-for use in the argv expansion of the specified mailer.
-.pp
-Rulesets one and two
-are applied to all sender and recipient addresses respectively.
-They are applied before any specification
-in the mailer definition.
-They must never resolve.
-.pp
-Ruleset four is applied to all addresses
-in the message.
-It is typically used
-to translate internal to external form.
-.pp
-In addition,
-ruleset 5 is applied to all local addresses
-(specifically, those that resolve to a mailer with the `F=5'
-flag set)
-that do not have aliases.
-This allows a last minute hook for local names.
-.sh 3 "Ruleset hooks"
-.pp
-A few extra rulesets are defined as
-.q hooks
-that can be defined to get special features.
-They are all named rulesets.
-The
-.q check_*
-forms all give accept/reject status;
-falling off the end or returning normally is an accept,
-and resolving to
-.b $#error
-is a reject.
-Many of these can also resolve to the special mailer
-.b $#discard ;
-this accepts the message as though it were successful
-but then discards it without delivery.
-.sh 4 "check_relay"
-.pp
-The
-.i check_relay
-ruleset is called after a connection is accepted.
-It is passed
-.(b
-client.host.name $| client.host.address
-.)b
-where
-.b $|
-is a metacharacter separating the two parts.
-This ruleset can reject connections from various locations.
-.sh 4 "check_mail"
-.pp
-The
-.i check_mail
-ruleset is passed the user name parameter of the
-.sm "SMTP MAIL"
-command.
-It can accept or reject the address.
-.sh 4 "check_rcpt"
-.pp
-The
-.i check_rcpt
-ruleset is passed the user name parameter of the
-.sm "SMTP RCPT"
-command.
-It can accept or reject the address.
-.sh 4 "check_compat"
-.pp
-The
-.i check_compat
-ruleset is passed
-.(b
-sender-address $| recipient-address
-.)b
-where
-.b $|
-is a metacharacter separating the addresses.
-It can accept or reject mail transfer between these two addresses
-much like the
-.i checkcompat()
-function.
-.sh 3 "IPC mailers"
-.pp
-Some special processing occurs
-if the ruleset zero resolves to an IPC mailer
-(that is, a mailer that has
-.q [IPC]
-listed as the Path in the
-.b M
-configuration line.
-The host name passed after
-.q $@
-has MX expansion performed;
-this looks the name up in DNS to find alternate delivery sites.
-.pp
-The host name can also be provided as a dotted quad in square brackets;
-for example:
-.(b
-[128.32.149.78]
-.)b
-This causes direct conversion of the numeric value
-to an IP host address.
-.pp
-The host name passed in after the
-.q $@
-may also be a colon-separated list of hosts.
-Each is separately MX expanded and the results are concatenated
-to make (essentially) one long MX list.
-The intent here is to create
-.q fake
-MX records that are not published in DNS
-for private internal networks.
-.pp
-As a final special case, the host name can be passed in
-as a text string
-in square brackets:
-.(b
-[ucbvax.berkeley.edu]
-.)b
-This form avoids the MX mapping.
-.b N.B.:
-.i
-This is intended only for situations where you have a network firewall
-or other host that will do special processing for all your mail,
-so that your MX record points to a gateway machine;
-this machine could then do direct delivery to machines
-within your local domain.
-Use of this feature directly violates RFC 1123 section 5.3.5:
-it should not be used lightly.
-.r
-.sh 2 "D \*- Define Macro"
-.pp
-Macros are named with a single character
-or with a word in {braces}.
-Single character names may be selected from the entire ASCII set,
-but user-defined macros
-should be selected from the set of upper case letters only.
-Lower case letters
-and special symbols
-are used internally.
-Long names beginning with a lower case letter or a punctuation character
-are reserved for use by sendmail,
-so user-defined long macro names should begin with an upper case letter.
-.pp
-The syntax for macro definitions is:
-.(b F
-.b D \c
-.i x\|val
-.)b
-where
-.i x
-is the name of the macro
-(which may be a single character
-or a word in braces)
-and
-.i val
-is the value it should have.
-There should be no spaces given
-that do not actually belong in the macro value.
-.pp
-Macros are interpolated
-using the construct
-.b $ \c
-.i x ,
-where
-.i x
-is the name of the macro to be interpolated.
-This interpolation is done when the configuration file is read,
-except in
-.b M
-lines.
-The special construct
-.b $& \c
-.i x
-can be used in
-.b R
-lines to get deferred interpolation.
-.pp
-Conditionals can be specified using the syntax:
-.(b
-$?x text1 $| text2 $.
-.)b
-This interpolates
-.i text1
-if the macro
-.b $x
-is set,
-and
-.i text2
-otherwise.
-The
-.q else
-(\c
-.b $| )
-clause may be omitted.
-.pp
-Lower case macro names are reserved to have
-special semantics,
-used to pass information in or out of
-.i sendmail ,
-and special characters are reserved to
-provide conditionals, etc.
-Upper case names
-(that is,
-.b $A
-through
-.b $Z )
-are specifically reserved for configuration file authors.
-.pp
-The following macros are defined and/or used internally by
-.i sendmail
-for interpolation into argv's for mailers
-or for other contexts.
-The ones marked \(dg are information passed into sendmail\**,
-.(f
-\**As of version 8.6,
-all of these macros have reasonable defaults.
-Previous versions required that they be defined.
-.)f
-the ones marked \(dd are information passed both in and out of sendmail,
-and the unmarked macros are passed out of sendmail
-but are not otherwise used internally.
-These macros are:
-.nr ii 5n
-.ip $a
-The origination date in RFC 822 format.
-This is extracted from the Date: line.
-.ip $b
-The current date in RFC 822 format.
-.ip $c
-The hop count.
-This is a count of the number of Received: lines
-plus the value of the
-.b \-h
-command line flag.
-.ip $d
-The current date in UNIX (ctime) format.
-.ip $e\(dg
-(Obsolete; use SmtpGreetingMessage option instead.)
-The SMTP entry message.
-This is printed out when SMTP starts up.
-The first word must be the
-.b $j
-macro as specified by RFC821.
-Defaults to
-.q "$j Sendmail $v ready at $b" .
-Commonly redefined to include the configuration version number, e.g.,
-.q "$j Sendmail $v/$Z ready at $b"
-.ip $f
-The envelope sender (from) address.
-.ip $g
-The sender address relative to the recipient.
-For example, if
-.b $f
-is
-.q foo ,
-.b $g
-will be
-.q host!foo ,
-.q foo@host.domain ,
-or whatever is appropriate for the receiving mailer.
-.ip $h
-The recipient host.
-This is set in ruleset 0 from the $@ field of a parsed address.
-.ip $i
-The queue id,
-e.g.,
-.q HAA12345 .
-.ip $j\(dd
-The \*(lqofficial\*(rq domain name for this site.
-This is fully qualified if the full qualification can be found.
-It
-.i must
-be redefined to be the fully qualified domain name
-if your system is not configured so that information can find
-it automatically.
-.ip $k
-The UUCP node name (from the uname system call).
-.ip $l\(dg
-(Obsolete; use UnixFromLine option instead.)
-The format of the UNIX from line.
-Unless you have changed the UNIX mailbox format,
-you should not change the default,
-which is
-.q "From $g $d" .
-.ip $m
-The domain part of the \fIgethostname\fP return value.
-Under normal circumstances,
-.b $j
-is equivalent to
-.b $w.$m .
-.ip $n\(dg
-The name of the daemon (for error messages).
-Defaults to
-.q MAILER-DAEMON .
-.ip $o\(dg
-(Obsolete: use OperatorChars option instead.)
-The set of \*(lqoperators\*(rq in addresses.
-A list of characters
-which will be considered tokens
-and which will separate tokens
-when doing parsing.
-For example, if
-.q @
-were in the
-.b $o
-macro, then the input
-.q a@b
-would be scanned as three tokens:
-.q a,
-.q @,
-and
-.q b.
-Defaults to
-.q ".:@[]" ,
-which is the minimum set necessary to do RFC 822 parsing;
-a richer set of operators is
-.q ".:%@!/[]" ,
-which adds support for UUCP, the %-hack, and X.400 addresses.
-.ip $p
-Sendmail's process id.
-.ip $q\(dg
-Default format of sender address.
-The
-.b $q
-macro specifies how an address should appear in a message
-when it is defaulted.
-Defaults to
-.q "<$g>" .
-It is commonly redefined to be
-.q "$?x$x <$g>$|$g$."
-or
-.q "$g$?x ($x)$." ,
-corresponding to the following two formats:
-.(b
-Eric Allman <eric@CS.Berkeley.EDU>
-eric@CS.Berkeley.EDU (Eric Allman)
-.)b
-.i Sendmail
-properly quotes names that have special characters
-if the first form is used.
-.ip $r
-Protocol used to receive the message.
-Set from the
-.b \-p
-command line flag or by the SMTP server code.
-.ip $s
-Sender's host name.
-Set from the
-.b \-p
-command line flag or by the SMTP server code.
-.ip $t
-A numeric representation of the current time.
-.ip $u
-The recipient user.
-.ip $v
-The version number of the
-.i sendmail
-binary.
-.ip $w\(dd
-The hostname of this site.
-This is the root name of this host (but see below for caveats).
-.ip $x
-The full name of the sender.
-.ip $z
-The home directory of the recipient.
-.ip $_
-The validated sender address.
-.ip ${bodytype}
-The message body type
-(7BIT or 8BITMIME),
-as determined from the envelope.
-.ip ${client_addr}
-The IP address of the SMTP client.
-Defined in the SMTP server only.
-.ip ${client_name}
-The host name of the SMTP client.
-This may be the client's bracketed IP address
-in the form [ nnn.nnn.nnn.nnn ] if the client's
-IP address is not resolvable.
-Defined in the SMTP server only.
-.ip ${client_port}
-The port number of the SMTP client.
-Defined in the SMTP server only.
-.ip ${envid}
-The envelope id passed to sendmail as part of the envelope.
-.ip ${opMode}
-The current operation mode (from the
-.b \-b
-flag).
-.ip ${deliveryMode}
-The current delivery mode
-(from the
-.b DeliveryMode
-option).
-.pp
-There are three types of dates that can be used.
-The
-.b $a
-and
-.b $b
-macros are in RFC 822 format;
-.b $a
-is the time as extracted from the
-.q Date:
-line of the message
-(if there was one),
-and
-.b $b
-is the current date and time
-(used for postmarks).
-If no
-.q Date:
-line is found in the incoming message,
-.b $a
-is set to the current time also.
-The
-.b $d
-macro is equivalent to the
-.b $b
-macro in UNIX
-(ctime)
-format.
-.pp
-The macros
-.b $w ,
-.b $j ,
-and
-.b $m
-are set to the identity of this host.
-.i Sendmail
-tries to find the fully qualified name of the host
-if at all possible;
-it does this by calling
-.i gethostname (2)
-to get the current hostname
-and then passing that to
-.i gethostbyname (3)
-which is supposed to return the canonical version of that host name.\**
-.(f
-\**For example, on some systems
-.i gethostname
-might return
-.q foo
-which would be mapped to
-.q foo.bar.com
-by
-.i gethostbyname .
-.)f
-Assuming this is successful,
-.b $j
-is set to the fully qualified name
-and
-.b $m
-is set to the domain part of the name
-(everything after the first dot).
-The
-.b $w
-macro is set to the first word
-(everything before the first dot)
-if you have a level 5 or higher configuration file;
-otherwise, it is set to the same value as
-.b $j .
-If the canonification is not successful,
-it is imperative that the config file set
-.b $j
-to the fully qualified domain name\**.
-.(f
-\**Older versions of sendmail didn't pre-define
-.b $j
-at all, so up until 8.6,
-config files
-.i always
-had to define
-.b $j .
-.)f
-.pp
-The
-.b $f
-macro is the id of the sender
-as originally determined;
-when mailing to a specific host
-the
-.b $g
-macro is set to the address of the sender
-.ul
-relative to the recipient.
-For example,
-if I send to
-.q bollard@matisse.CS.Berkeley.EDU
-from the machine
-.q vangogh.CS.Berkeley.EDU
-the
-.b $f
-macro will be
-.q eric
-and the
-.b $g
-macro will be
-.q eric@vangogh.CS.Berkeley.EDU.
-.pp
-The
-.b $x
-macro is set to the full name of the sender.
-This can be determined in several ways.
-It can be passed as flag to
-.i sendmail .
-It can be defined in the
-.sm NAME
-environment variable.
-The third choice is the value of the
-.q Full-Name:
-line in the header if it exists,
-and the fourth choice is the comment field
-of a
-.q From:
-line.
-If all of these fail,
-and if the message is being originated locally,
-the full name is looked up in the
-.i /etc/passwd
-file.
-.pp
-When sending,
-the
-.b $h ,
-.b $u ,
-and
-.b $z
-macros get set to the host, user, and home directory
-(if local)
-of the recipient.
-The first two are set from the
-.b $@
-and
-.b $:
-part of the rewriting rules, respectively.
-.pp
-The
-.b $p
-and
-.b $t
-macros are used to create unique strings
-(e.g., for the
-.q Message-Id:
-field).
-The
-.b $i
-macro is set to the queue id on this host;
-if put into the timestamp line
-it can be extremely useful for tracking messages.
-The
-.b $v
-macro is set to be the version number of
-.i sendmail ;
-this is normally put in timestamps
-and has been proven extremely useful for debugging.
-.pp
-The
-.b $c
-field is set to the
-.q "hop count,"
-i.e., the number of times this message has been processed.
-This can be determined
-by the
-.b \-h
-flag on the command line
-or by counting the timestamps in the message.
-.pp
-The
-.b $r
-and
-.b $s
-fields are set to the protocol used to communicate with
-.i sendmail
-and the sending hostname.
-They can be set together using the
-.b \-p
-command line flag or separately using the
-.b \-M
-or
-.b \-oM
-flags.
-.pp
-The
-.b $_
-is set to a validated sender host name.
-If the sender is running an RFC 1413 compliant IDENT server
-and the receiver has the IDENT protocol turned on,
-it will include the user name on that host.
-.pp
-The
-.b ${client_name} ,
-.b ${client_addr} ,
-and
-.b ${client_port}
-macros
-are set to the name, address, and port number of the SMTP client
-who is invoking
-.i sendmail
-as a server.
-These can be used in the
-.i check_*
-rulesets (using the
-.b $&
-deferred evaluation form, of course!).
-.sh 2 "C and F \*- Define Classes"
-.pp
-Classes of phrases may be defined
-to match on the left hand side of rewriting rules,
-where a
-.q phrase
-is a sequence of characters that does not contain space characters.
-For example
-a class of all local names for this site
-might be created
-so that attempts to send to oneself
-can be eliminated.
-These can either be defined directly in the configuration file
-or read in from another file.
-Classes are named as a single letter or a word in {braces}.
-Class names beginning with lower case letters
-and special characters are reserved for system use.
-Classes defined in config files may be given names
-from the set of upper case letters for short names
-or beginning with an upper case letter for long names.
-.pp
-The syntax is:
-.(b F
-.b C \c
-.i c\|phrase1
-.i phrase2...
-.br
-.b F \c
-.i c\|file
-.)b
-The first form defines the class
-.i c
-to match any of the named words.
-It is permissible to split them among multiple lines;
-for example, the two forms:
-.(b
-CHmonet ucbmonet
-.)b
-and
-.(b
-CHmonet
-CHucbmonet
-.)b
-are equivalent.
-The ``F'' form
-reads the elements of the class
-.i c
-from the named
-.i file .
-.pp
-Elements of classes can be accessed in rules using
-.b $=
-or
-.b $~ .
-The
-.b $~
-(match entries not in class)
-only matches a single word;
-multi-word entries in the class are ignored in this context.
-.pp
-Some classes have internal meaning to
-.i sendmail :
-.nr ii 0.5i
-.\".ip $=b
-.\"A set of Content-Types that will not have the newline character
-.\"translated to CR-LF before encoding into base64 MIME.
-.\"The class can have major times
-.\"(e.g.,
-.\".q image )
-.\"or full types
-.\"(such as
-.\".q application/octet-stream ).
-.\"The class is initialized with
-.\".q application/octet-stream ,
-.\".q image ,
-.\".q audio ,
-.\"and
-.\".q video .
-.ip $=e
-contains the Content-Transfer-Encodings that can be 8\(->7 bit encoded.
-It is predefined to contain
-.q 7bit ,
-.q 8bit ,
-and
-.q binary .
-.ip $=k
-set to be the same as
-.b $k ,
-that is, the UUCP node name.
-.ip $=m
-set to the set of domains by which this host is known,
-initially just
-.b $m .
-.ip $=n
-can be set to the set of MIME body types
-that can never be eight to seven bit encoded.
-It defaults to
-.q multipart/signed .
-Message types
-.q message/*
-and
-.q multipart/*
-are never encoded directly.
-Multipart messages are always handled recursively.
-The handling of message/* messages
-are controlled by class
-.b $=s .
-.ip $=q
-A set of Content-Types that will never be encoded as base64
-(if they have to be encoded, they will be encoded as quoted-printable).
-It can have primary types
-(e.g.,
-.q text )
-or full types
-(such as
-.q text/plain ).
-The class is initialized to have
-.q text/plain
-only.
-.ip $=s
-contains the set of subtypes of message that can be treated recursively.
-By default it contains only
-.q rfc822 .
-Other
-.q message/*
-types cannot be 8\(->7 bit encoded.
-If a message containing eight bit data is sent to a seven bit host,
-and that message cannot be encoded into seven bits,
-it will be stripped to 7 bits.
-.ip $=t
-set to the set of trusted users by the
-.b T
-configuration line.
-If you want to read trusted users from a file, use
-.b Ft \c
-.i /file/name .
-.ip $=w
-set to be the set of all names
-this host is known by.
-This can be used to match local hostnames.
-.pp
-.i Sendmail
-can be compiled to allow a
-.i scanf (3)
-string on the
-.b F
-line.
-This lets you do simplistic parsing of text files.
-For example, to read all the user names in your system
-.i /etc/passwd
-file into a class, use
-.(b
-FL/etc/passwd %[^:]
-.)b
-which reads every line up to the first colon.
-.sh 2 "M \*- Define Mailer"
-.pp
-Programs and interfaces to mailers
-are defined in this line.
-The format is:
-.(b F
-.b M \c
-.i name ,
-{\c
-.i field =\c
-.i value \|}*
-.)b
-where
-.i name
-is the name of the mailer
-(used internally only)
-and the
-.q field=name
-pairs define attributes of the mailer.
-Fields are:
-.(b
-.ta 1i
-Path The pathname of the mailer
-Flags Special flags for this mailer
-Sender Rewriting set(s) for sender addresses
-Recipient Rewriting set(s) for recipient addresses
-Argv An argument vector to pass to this mailer
-Eol The end-of-line string for this mailer
-Maxsize The maximum message length to this mailer
-Linelimit The maximum line length in the message body
-Directory The working directory for the mailer
-Userid The default user and group id to run as
-Nice The nice(2) increment for the mailer
-Charset The default character set for 8-bit characters
-Type The MTS type information (used for error messages)
-.)b
-Only the first character of the field name is checked.
-.pp
-The following flags may be set in the mailer description.
-Any other flags may be used freely
-to conditionally assign headers to messages
-destined for particular mailers.
-Flags marked with \(dg
-are not interpreted by the
-.i sendmail
-binary;
-these are the conventionally used to correlate to the flags portion
-of the
-.b H
-line.
-Flags marked with \(dd
-apply to the mailers for the sender address
-rather than the usual recipient mailers.
-.nr ii 4n
-.ip a
-Run Extended SMTP (ESMTP) protocol (defined in RFCs 1869, 1652, and 1870).
-This flag defaults on if the SMTP greeting message includes the word
-.q ESMTP .
-.ip A
-Look up the user part of the address in the alias database.
-Normally this is only set for local mailers.
-.ip b
-Force a blank line on the end of a message.
-This is intended to work around some stupid versions of
-/bin/mail
-that require a blank line, but do not provide it themselves.
-It would not normally be used on network mail.
-.ip c
-Do not include comments in addresses.
-This should only be used if you have to work around
-a remote mailer that gets confused by comments.
-This strips addresses of the form
-.q "Phrase <address>"
-or
-.q "address (Comment)"
-down to just
-.q address .
-.ip C\(dd
-If mail is
-.i received
-from a mailer with this flag set,
-any addresses in the header that do not have an at sign
-(\c
-.q @ )
-after being rewritten by ruleset three
-will have the
-.q @domain
-clause from the sender envelope address
-tacked on.
-This allows mail with headers of the form:
-.(b
-From: usera@hosta
-To: userb@hostb, userc
-.)b
-to be rewritten as:
-.(b
-From: usera@hosta
-To: userb@hostb, userc@hosta
-.)b
-automatically.
-However, it doesn't really work reliably.
-.ip d
-Do not include angle brackets around route-address syntax addresses.
-This is useful on mailers that are going to pass addresses to a shell
-that might interpret angle brackets as I/O redirection.
-.ip D\(dg
-This mailer wants a
-.q Date:
-header line.
-.ip e
-This mailer is expensive to connect to,
-so try to avoid connecting normally;
-any necessary connection will occur during a queue run.
-.ip E
-Escape lines beginning with
-.q From\0
-in the message with a `>' sign.
-.ip f
-The mailer wants a
-.b \-f
-.i from
-flag,
-but only if this is a network forward operation
-(i.e.,
-the mailer will give an error
-if the executing user
-does not have special permissions).
-.ip F\(dg
-This mailer wants a
-.q From:
-header line.
-.ip g
-Normally,
-.i sendmail
-sends internally generated email (e.g., error messages)
-using the null return address
-as required by RFC 1123.
-However, some mailers don't accept a null return address.
-If necessary,
-you can set the
-.b g
-flag to prevent
-.i sendmail
-from obeying the standards;
-error messages will be sent as from the MAILER-DAEMON
-(actually, the value of the
-.b $n
-macro).
-.ip h
-Upper case should be preserved in host names
-for this mailer.
-.ip i
-Do User Database rewriting on envelope sender address.
-.ip I
-This mailer will be speaking SMTP
-to another
-.i sendmail
-\*-
-as such it can use special protocol features.
-This option is not required
-(i.e.,
-if this option is omitted the transmission will still operate successfully,
-although perhaps not as efficiently as possible).
-.ip j
-Do User Database rewriting on recipients as well as senders.
-.ip k
-Normally when
-.i sendmail
-connects to a host via SMTP,
-it checks to make sure that this isn't accidently the same host name
-as might happen if
-.i sendmail
-is misconfigured or if a long-haul network interface is set in loopback mode.
-This flag disables the loopback check.
-It should only be used under very unusual circumstances.
-.ip K
-Currently unimplemented.
-Reserved for chunking.
-.ip l
-This mailer is local
-(i.e.,
-final delivery will be performed).
-.ip L
-Limit the line lengths as specified in RFC821.
-This deprecated option should be replaced by the
-.b L=
-mail declaration.
-For historic reasons, the
-.b L
-flag also sets the
-.b 7
-flag.
-.ip m
-This mailer can send to multiple users
-on the same host
-in one transaction.
-When a
-.b $u
-macro occurs in the
-.i argv
-part of the mailer definition,
-that field will be repeated as necessary
-for all qualifying users.
-.ip M\(dg
-This mailer wants a
-.q Message-Id:
-header line.
-.ip n
-Do not insert a UNIX-style
-.q From
-line on the front of the message.
-.ip o
-Always run as the owner of the recipient mailbox.
-Normally
-.i sendmail
-runs as the sender for locally generated mail
-or as
-.q daemon
-(actually, the user specified in the
-.b u
-option)
-when delivering network mail.
-The normal behaviour is required by most local mailers,
-which will not allow the envelope sender address
-to be set unless the mailer is running as daemon.
-This flag is ignored if the
-.b S
-flag is set.
-.ip p
-Use the route-addr style reverse-path in the SMTP
-.q "MAIL FROM:"
-command
-rather than just the return address;
-although this is required in RFC821 section 3.1,
-many hosts do not process reverse-paths properly.
-Reverse-paths are officially discouraged by RFC 1123.
-.ip P\(dg
-This mailer wants a
-.q Return-Path:
-line.
-.ip q
-When an address that resolves to this mailer is verified
-(SMTP VRFY command),
-generate 250 responses instead of 252 responses.
-This will imply that the address is local.
-.ip r
-Same as
-.b f ,
-but sends a
-.b \-r
-flag.
-.ip R
-Open SMTP connections from a
-.q secure
-port.
-Secure ports aren't
-(secure, that is)
-except on UNIX machines,
-so it is unclear that this adds anything.
-.ip s
-Strip quote characters (" and \e) off of the address
-before calling the mailer.
-.ip S
-Don't reset the userid
-before calling the mailer.
-This would be used in a secure environment
-where
-.i sendmail
-ran as root.
-This could be used to avoid forged addresses.
-If the
-.b U=
-field is also specified,
-this flag causes the user id to always be set to that user and group
-(instead of leaving it as root).
-.ip u
-Upper case should be preserved in user names
-for this mailer.
-.ip U
-This mailer wants UUCP-style
-.q From
-lines with the ugly
-.q "remote from <host>"
-on the end.
-.ip w
-The user must have a valid account on this machine,
-i.e.,
-getpwnam
-must succeed.
-If not,
-the mail is bounced.
-This is required to get
-.q \&.forward
-capability.
-.ip x\(dg
-This mailer wants a
-.q Full-Name:
-header line.
-.ip X
-This mailer want to use the hidden dot algorithm
-as specified in RFC821;
-basically,
-any line beginning with a dot
-will have an extra dot prepended
-(to be stripped at the other end).
-This insures that lines in the message containing a dot
-will not terminate the message prematurely.
-.ip z
-Run Local Mail Transfer Protocol (LMTP)
-between
-.i sendmail
-and the local mailer.
-This is a variant on SMTP
-defined in RFC 2033
-that is specifically designed for delivery to a local mailbox.
-.ip 0
-Don't look up MX records for hosts sent via SMTP.
-.ip 3
-Extend the list of characters converted to =XX notation
-when converting to Quoted-Printable
-to include those that don't map cleanly between ASCII and EBCDIC.
-Useful if you have IBM mainframes on site.
-.ip 5
-If no aliases are found for this address,
-pass the address through ruleset 5 for possible alternate resolution.
-This is intended to forward the mail to an alternate delivery spot.
-.ip 7
-Strip all output to seven bits.
-This is the default if the
-.b L
-flag is set.
-Note that clearing this option is not
-sufficient to get full eight bit data passed through
-.i sendmail .
-If the
-.b 7
-option is set, this is essentially always set,
-since the eighth bit was stripped on input.
-Note that this option will only impact messages
-that didn't have 8\(->7 bit MIME conversions performed.
-.ip 8
-If set,
-it is acceptable to send eight bit data to this mailer;
-the usual attempt to do 8\(->7 bit MIME conversions will be bypassed.
-.ip 9
-If set,
-do
-.i limited
-7\(->8 bit MIME conversions.
-These conversions are limited to text/plain data.
-.ip :
-Check addresses to see if they begin
-.q :include: ;
-if they do, convert them to the
-.q *include*
-mailer.
-.ip |
-Check addresses to see if they begin with a `|';
-if they do, convert them to the
-.q prog
-mailer.
-.ip /
-Check addresses to see if they begin with a `/';
-if they do, convert them to the
-.q *file*
-mailer.
-.ip @
-Look up addresses in the user database.
-.pp
-Configuration files prior to level 6
-assume the `A', `w', `5', `:', `|', `/', and `@' options
-on the mailer named
-.q local .
-.pp
-The mailer with the special name
-.q error
-can be used to generate a user error.
-The (optional) host field is an exit status to be returned,
-and the user field is a message to be printed.
-The exit status may be numeric or one of the values
-USAGE, NOUSER, NOHOST, UNAVAILABLE, SOFTWARE, TEMPFAIL, PROTOCOL, or CONFIG
-to return the corresponding EX_ exit code,
-or an enhanced error code as described in RFC 1893,
-.ul
-Enhanced Mail System Status Codes.
-For example, the entry:
-.(b
-$#error $@ NOHOST $: Host unknown in this domain
-.)b
-on the RHS of a rule
-will cause the specified error to be generated
-and the
-.q "Host unknown"
-exit status to be returned
-if the LHS matches.
-This mailer is only functional in rulesets 0, 5,
-or one of the check_* rulesets.
-.pp
-The mailer with the special name
-.q discard
-causes any mail sent to it to be discarded
-but otherwise treated as though it were successfully delivered.
-.pp
-The mailer named
-.q local
-.i must
-be defined in every configuration file.
-This is used to deliver local mail,
-and is treated specially in several ways.
-Additionally, three other mailers named
-.q prog ,
-.q *file* ,
-and
-.q *include*
-may be defined to tune the delivery of messages to programs,
-files,
-and :include: lists respectively.
-They default to:
-.(b
-Mprog, P=/bin/sh, F=lsoDq9, T=DNS/RFC822/X-Unix, A=sh \-c $u
-M*file*, P=[FILE], F=lsDFMPEouq9, T=DNS/RFC822/X-Unix, A=FILE $u
-M*include*, P=/dev/null, F=su, A=INCLUDE $u
-.)b
-.pp
-The Sender and Recipient rewriting sets
-may either be a simple ruleset id
-or may be two ids separated by a slash;
-if so, the first rewriting set is applied to envelope
-addresses
-and the second is applied to headers.
-Setting any value zero disables corresponding mailer-specific rewriting.
-.pp
-The Directory
-is actually a colon-separated path of directories to try.
-For example, the definition
-.q D=$z:/
-first tries to execute in the recipient's home directory;
-if that is not available,
-it tries to execute in the root of the filesystem.
-This is intended to be used only on the
-.q prog
-mailer,
-since some shells (such as
-.i csh )
-refuse to execute if they cannot read the home directory.
-Since the queue directory is not normally readable by unprivileged users
-.i csh
-scripts as recipients can fail.
-.pp
-The Userid
-specifies the default user and group id to run as,
-overriding the
-.b DefaultUser
-option (q.v.).
-If the
-.b S
-mailer flag is also specified,
-this is the user and group to run as in all circumstances.
-This may be given as
-.i user:group
-to set both the user and group id;
-either may be an integer or a symbolic name to be looked up
-in the
-.i passwd
-and
-.i group
-files respectively.
-If only a symbolic user name is specified,
-the group id in the
-.i passwd
-file for that user is used as the group id.
-.pp
-The Charset field
-is used when converting a message to MIME;
-this is the character set used in the
-Content-Type: header.
-If this is not set, the
-.b DefaultCharset
-option is used,
-and if that is not set, the value
-.q unknown-8bit
-is used.
-.b WARNING:
-this field applies to the sender's mailer,
-not the recipient's mailer.
-For example, if the envelope sender address
-lists an address on the local network
-and the recipient is on an external network,
-the character set will be set from the Charset= field
-for the local network mailer,
-not that of the external network mailer.
-.pp
-The Type= field
-sets the type information
-used in MIME error messages
-as defined by
-RFC 1894.
-It is actually three values separated by slashes:
-the MTA-type (that is, the description of how hosts are named),
-the address type (the description of e-mail addresses),
-and the diagnostic type (the description of error diagnostic codes).
-Each of these must be a registered value
-or begin with
-.q X\- .
-The default is
-.q dns/rfc822/smtp .
-.sh 2 "H \*- Define Header"
-.pp
-The format of the header lines that
-.i sendmail
-inserts into the message
-are defined by the
-.b H
-line.
-The syntax of this line is:
-.(b F
-.b H [\c
-.b ? \c
-.i mflags \c
-.b ? ]\c
-.i hname \c
-.b :
-.i htemplate
-.)b
-Continuation lines in this spec
-are reflected directly into the outgoing message.
-The
-.i htemplate
-is macro-expanded before insertion into the message.
-If the
-.i mflags
-(surrounded by question marks)
-are specified,
-at least one of the specified flags
-must be stated in the mailer definition
-for this header to be automatically output.
-If one of these headers is in the input
-it is reflected to the output
-regardless of these flags.
-.pp
-Some headers have special semantics
-that will be described later.
-.pp
-A secondary syntax allows validation of headers as they are being read.
-To enable validation, use:
-.(b
-.b H \c
-.i Header \c
-.b ": $>" \c
-.i Ruleset
-.)b
-The indicated
-.i Ruleset
-is called for the specified
-.i Header ,
-and can return
-.b $#error
-to reject the message or
-.b $#discard
-to discard the message
-(as with the other
-.b check_ *
-rulesets).
-The header is treated as a structured field,
-that is,
-comments (in parentheses) are deleted before processing.
-.pp
-For example, the configuration lines:
-.(b
-HMessage-Id: $>CheckMessageId
-
-SCheckMessageId
-R< $+ @ $+ > $@ OK
-R$* $#error $: Illegal Message-Id header
-.)b
-would refuse any message that had a Message-Id: header of any of the
-following forms:
-.(b
-Message-Id: <>
-Message-Id: some text
-Message-Id: <legal text@domain> extra crud
-.)b
-.sh 2 "O \*- Set Option"
-.pp
-There are a number of
-global
-options that
-can be set from a configuration file.
-Options are represented by full words;
-some are also representable as single characters
-for back compatibility.
-The syntax of this line is:
-.(b F
-.b O \0
-.i option \c
-.b = \c
-.i value
-.)b
-This sets option
-.i option
-to be
-.i value .
-Note that there
-.i must
-be a space between the letter `O' and the name of the option.
-An older version is:
-.(b F
-.b O \c
-.i o\|value
-.)b
-where the option
-.i o
-is a single character.
-Depending on the option,
-.i value
-may be a string, an integer,
-a boolean
-(with legal values
-.q t ,
-.q T ,
-.q f ,
-or
-.q F ;
-the default is TRUE),
-or
-a time interval.
-.pp
-The options supported (with the old, one character names in brackets) are:
-.nr ii 1i
-.ip "AliasFile=\fIspec, spec, ...\fP"
-[A]
-Specify possible alias file(s).
-Each
-.i spec
-should be in the format
-``\c
-.i class \c
-.b :
-.i file ''
-where
-.i class \c
-.b :
-is optional and defaults to ``implicit''.
-Depending on how
-.i sendmail
-is compiled, valid classes are
-.q implicit
-(search through a compiled-in list of alias file types,
-for back compatibility),
-.q hash
-(if
-.sm NEWDB
-is specified),
-.q dbm
-(if
-.sm NDBM
-is specified),
-.q stab
-(internal symbol table \*- not normally used
-unless you have no other database lookup),
-or
-.q nis
-(if
-.sm NIS
-is specified).
-If a list of
-.i spec s
-are provided,
-.i sendmail
-searches them in order.
-.ip AliasWait=\fItimeout\fP
-[a]
-If set,
-wait up to
-.i timeout
-(units default to minutes)
-for an
-.q @:@
-entry to exist in the alias database
-before starting up.
-If it does not appear in the
-.i timeout
-interval
-rebuild the database
-(if the
-.b AutoRebuildAliases
-option is also set)
-or issue a warning.
-.ip AllowBogusHELO
-[no short name]
-If set, allow HELO SMTP commands that don't include a host name.
-Setting this violates RFC 1123 section 5.2.5,
-but is necessary to interoperate with several SMTP clients.
-If there is a value, it is still checked for legitimacy.
-.ip AutoRebuildAliases
-[D]
-If set,
-rebuild the alias database if necessary and possible.
-If this option is not set,
-.i sendmail
-will never rebuild the alias database
-unless explicitly requested
-using
-.b \-bi .
-Not recommended \(em can cause thrashing.
-.ip BlankSub=\fIc\fP
-[B]
-Set the blank substitution character to
-.i c .
-Unquoted spaces in addresses are replaced by this character.
-Defaults to space (i.e., no change is made).
-.ip CheckAliases
-[n]
-Validate the RHS of aliases when rebuilding the alias database.
-.ip CheckpointInterval=\fIN\fP
-[C]
-Checkpoints the queue every
-.i N
-(default 10)
-addresses sent.
-If your system crashes during delivery to a large list,
-this prevents retransmission to any but the last
-.I N
-recipients.
-.ip ClassFactor=\fIfact\fP
-[z]
-The indicated
-.i fact or
-is multiplied by the message class
-(determined by the Precedence: field in the user header
-and the
-.b P
-lines in the configuration file)
-and subtracted from the priority.
-Thus, messages with a higher Priority: will be favored.
-Defaults to 1800.
-.ip ColonOkInAddr
-[no short name]
-If set, colons are acceptable in e-mail addresses
-(e.g.,
-.q host:user ).
-If not set, colons indicate the beginning of a RFC 822 group construct
-(\c
-.q "groupname: member1, member2, ... memberN;" ).
-Doubled colons are always acceptable
-(\c
-.q nodename::user )
-and proper route-addr nesting is understood
-(\c
-.q <@relay:user@host> ).
-Furthermore, this option defaults on if the configuration version level
-is less than 6 (for back compatibility).
-However, it must be off for full compatibility with RFC 822.
-.ip ConnectionCacheSize=\fIN\fP
-[k]
-The maximum number of open connections that will be cached at a time.
-The default is one.
-This delays closing the current connection until
-either this invocation of
-.i sendmail
-needs to connect to another host
-or it terminates.
-Setting it to zero defaults to the old behavior,
-that is, connections are closed immediately.
-Since this consumes file descriptors,
-the connection cache should be kept small:
-4 is probably a practical maximum.
-.ip ConnectionCacheTimeout=\fItimeout\fP
-[K]
-The maximum amount of time a cached connection will be permitted to idle
-without activity.
-If this time is exceeded,
-the connection is immediately closed.
-This value should be small (on the order of ten minutes).
-Before
-.i sendmail
-uses a cached connection,
-it always sends a RSET command
-to check the connection;
-if this fails, it reopens the connection.
-This keeps your end from failing if the other end times out.
-The point of this option is to be a good network neighbor
-and avoid using up excessive resources
-on the other end.
-The default is five minutes.
-.ip ConnectionRateThrottle=\fIN\fP
-[no short name]
-If set to a positive value,
-allow no more than
-.i N
-incoming daemon connections in a one second period.
-This is intended to flatten out peaks
-and allow the load average checking to cut in.
-Defaults to zero (no limits).
-.ip DaemonPortOptions=\fIoptions\fP
-[O]
-Set server SMTP options.
-The options are
-.i key=value
-pairs.
-Known keys are:
-.(b
-.ta 1i
-Port Name/number of listening port (defaults to "smtp")
-Addr Address mask (defaults INADDR_ANY)
-Family Address family (defaults to INET)
-Listen Size of listen queue (defaults to 10)
-SndBufSize Size of TCP send buffer
-RcvBufSize Size of TCP receive buffer
-.)b
-The
-.i Addr ess
-mask may be a numeric address in dot notation
-or a network name.
-.ip DefaultCharSet=\fIcharset\fP
-[no short name]
-When a message that has 8-bit characters but is not in MIME format
-is converted to MIME
-(see the EightBitMode option)
-a character set must be included in the Content-Type: header.
-This character set is normally set from the Charset= field
-of the mailer descriptor.
-If that is not set, the value of this option is used.
-If this option is not set, the value
-.q unknown-8bit
-is used.
-.ip DefaultUser=\fIuser:group\fP
-[u]
-Set the default userid for mailers to
-.i user:group .
-If
-.i group
-is omitted and
-.i user
-is a user name
-(as opposed to a numeric user id)
-the default group listed in the /etc/passwd file for that user is used
-as the default group.
-Both
-.i user
-and
-.i group
-may be numeric.
-Mailers without the
-.i S
-flag in the mailer definition
-will run as this user.
-Defaults to 1:1.
-The value can also be given as a symbolic user name.\**
-.(f
-\**The old
-.b g
-option has been combined into the
-.b DefaultUser
-option.
-.)f
-.ip DeliveryMode=\fIx\fP
-[d]
-Deliver in mode
-.i x .
-Legal modes are:
-.(b
-.ta 4n
-i Deliver interactively (synchronously)
-b Deliver in background (asynchronously)
-q Just queue the message (deliver during queue run)
-d Defer delivery and all map lookups (deliver during queue run)
-.)b
-Defaults to ``b'' if no option is specified,
-``i'' if it is specified but given no argument
-(i.e., ``Od'' is equivalent to ``Odi'').
-The
-.b \-v
-command line flag sets this to
-.b i .
-.ip DialDelay=\fIsleeptime\fP
-[no short name]
-Dial-on-demand network connections can see timeouts
-if a connection is opened before the call is set up.
-If this is set to an interval and a connection times out
-on the first connection being attempted
-.i sendmail
-will sleep for this amount of time and try again.
-This should give your system time to establish the connection
-to your service provider.
-Units default to seconds, so
-.q DialDelay=5
-uses a five second delay.
-Defaults to zero
-(no retry).
-.ip DontBlameSendmail=\fIoption,option,...\fP
-[no short name]
-In order to avoid possible cracking attempts
-caused by world- and group-writable files and directories,
-.i sendmail
-does paranoid checking when opening most of its support files.
-If for some reason you absolutely must run with,
-for example,
-a group-writable
-.i /etc
-directory,
-then you will have to turn off this checking
-(at the cost of making your system more vulnerable to attack).
-The arguments are individual options that turn off checking:
-.(b
-Safe
-AssumeSafeChown
-ClassFileInUnsafeDirPath
-ErrorHeaderInUnsafeDirPath
-FileDeliveryToHardLink
-FileDeliveryToSymLink
-ForwardFileInUnsafeDirPath
-ForwardFileInUnsafeDirPathSafe
-ForwardFileIngroupWritableDirPath
-GroupWritableAliasFile
-GroupWritableDirPathSafe
-GroupWritableForwardFileSafe
-GroupWritableIncludeFileSafe
-HelpFileinUnsafeDirPath
-IncludeFileInUnsafeDirPath
-IncludeFileInUnsafeDirPathSafe
-IncludeFileIngroupWritableDirPath
-LinkedAliasFileInWritableDir
-LinkedClassFileInWritableDir
-LinkedForwardFileInWritableDir
-LinkedIncludeFileInWritableDir
-LinkedMapInWritableDir
-LinkedServiceSwitchFileInWritableDir
-MapInUnsafeDirPath
-RunProgramInUnsafeDirPath
-RunWritableProgram
-WorldWritableAliasFile
-WriteMapToHardLink
-WriteMapToSymLink
-WriteStatsToHardLink
-WriteStatsToSymLink
-.)b
-.b Safe
-is the default.
-The details of these flags are described above.
-.\"XXX should have more here!!! XXX
-.b "Use of this option is not recommended."
-.ip DontExpandCnames
-[no short name]
-The standards say that all host addresses used in a mail message
-must be fully canonical.
-For example, if your host is named
-.q Cruft.Foo.ORG
-and also has an alias of
-.q FTP.Foo.ORG ,
-the former name must be used at all times.
-This is enforced during host name canonification
-($[ ... $] lookups).
-If this option is set, the protocols are ignored and the
-.q wrong
-thing is done.
-However, the IETF is moving toward changing this standard,
-so the behaviour may become acceptable.
-Please note that hosts downstream may still rewrite the address
-to be the true canonical name however.
-.ip DontInitGroups
-[no short name]
-If set,
-.i sendmail
-will avoid using the initgroups(3) call.
-If you are running NIS,
-this causes a sequential scan of the groups.byname map,
-which can cause your NIS server to be badly overloaded in a large domain.
-The cost of this is that the only group found for users
-will be their primary group (the one in the password file),
-which will make file access permissions somewhat more restrictive.
-Has no effect on systems that don't have group lists.
-.ip DontProbeInterfaces
-[no short name]
-.i Sendmail
-normally finds the names of all interfaces active on your machine
-when it starts up
-and adds their name to the
-.b $=w
-class of known host aliases.
-If you have a large number of virtual interfaces
-or if your DNS inverse lookups are slow
-this can be time consuming.
-This option turns off that probing.
-However, you will need to be certain to include all variant names
-in the
-.b $=w
-class by some other mechanism.
-.ip DontPruneRoutes
-[R]
-Normally,
-.i sendmail
-tries to eliminate any unnecessary explicit routes
-when sending an error message
-(as discussed in RFC 1123 \(sc 5.2.6).
-For example,
-when sending an error message to
-.(b
-<@known1,@known2,@known3:user@unknown>
-.)b
-.i sendmail
-will strip off the
-.q @known1,@known2
-in order to make the route as direct as possible.
-However, if the
-.b R
-option is set, this will be disabled,
-and the mail will be sent to the first address in the route,
-even if later addresses are known.
-This may be useful if you are caught behind a firewall.
-.ip DoubleBounceAddress=\fIerror-address\fP
-[no short name]
-If an error occurs when sending an error message,
-send the error report
-(termed a
-.q "double bounce"
-because it is an error
-.q bounce
-that occurs when trying to send another error
-.q bounce )
-to the indicated address.
-If not set, defaults to
-.q postmaster .
-.ip EightBitMode=\fIaction\fP
-[8]
-Set handling of eight-bit data.
-There are two kinds of eight-bit data:
-that declared as such using the
-.b BODY=8BITMIME
-ESMTP declaration or the
-.b \-B8BITMIME
-command line flag,
-and undeclared 8-bit data, that is,
-input that just happens to be eight bits.
-There are three basic operations that can happen:
-undeclared 8-bit data can be automatically converted to 8BITMIME,
-undeclared 8-bit data can be passed as-is without conversion to MIME
-(``just send 8''),
-and declared 8-bit data can be converted to 7-bits
-for transmission to a non-8BITMIME mailer.
-The possible
-.i action s
-are:
-.(b
-.\" r Reject undeclared 8-bit data;
-.\" don't convert 8BITMIME\(->7BIT (``reject'')
- s Reject undeclared 8-bit data (``strict'')
-.\" do convert 8BITMIME\(->7BIT (``strict'')
-.\" c Convert undeclared 8-bit data to MIME;
-.\" don't convert 8BITMIME\(->7BIT (``convert'')
- m Convert undeclared 8-bit data to MIME (``mime'')
-.\" do convert 8BITMIME\(->7BIT (``mime'')
-.\" j Pass undeclared 8-bit data;
-.\" don't convert 8BITMIME\(->7BIT (``just send 8'')
- p Pass undeclared 8-bit data (``pass'')
-.\" do convert 8BITMIME\(->7BIT (``pass'')
-.\" a Adaptive algorithm: see below
-.)b
-.\"The adaptive algorithm is to accept 8-bit data,
-.\"converting it to 8BITMIME only if the receiver understands that,
-.\"otherwise just passing it as undeclared 8-bit data;
-.\"8BITMIME\(->7BIT conversions are done.
-In all cases properly declared 8BITMIME data will be converted to 7BIT
-as needed.
-.ip ErrorHeader=\fIfile-or-message\fP
-[E]
-Prepend error messages with the indicated message.
-If it begins with a slash,
-it is assumed to be the pathname of a file
-containing a message (this is the recommended setting).
-Otherwise, it is a literal message.
-The error file might contain the name, email address, and/or phone number
-of a local postmaster who could provide assistance
-in to end users.
-If the option is missing or null,
-or if it names a file which does not exist or which is not readable,
-no message is printed.
-.ip ErrorMode=\fIx\fP
-[e]
-Dispose of errors using mode
-.i x .
-The values for
-.i x
-are:
-.(b
-p Print error messages (default)
-q No messages, just give exit status
-m Mail back errors
-w Write back errors (mail if user not logged in)
-e Mail back errors and give zero exit stat always
-.)b
-.ip FallbackMXhost=\fIfallbackhost\fP
-[V]
-If specified, the
-.i fallbackhost
-acts like a very low priority MX
-on every host.
-This is intended to be used by sites with poor network connectivity.
-.ip ForkEachJob
-[Y]
-If set,
-deliver each job that is run from the queue in a separate process.
-Use this option if you are short of memory,
-since the default tends to consume considerable amounts of memory
-while the queue is being processed.
-.ip ForwardPath=\fIpath\fP
-[J]
-Set the path for searching for users' .forward files.
-The default is
-.q $z/.forward .
-Some sites that use the automounter may prefer to change this to
-.q /var/forward/$u
-to search a file with the same name as the user in a system directory.
-It can also be set to a sequence of paths separated by colons;
-.i sendmail
-stops at the first file it can successfully and safely open.
-For example,
-.q /var/forward/$u:$z/.forward
-will search first in /var/forward/\c
-.i username
-and then in
-.i ~username /.forward
-(but only if the first file does not exist).
-.ip HelpFile=\fIfile\fP
-[H]
-Specify the help file
-for SMTP.
-.ip HoldExpensive
-[c]
-If an outgoing mailer is marked as being expensive,
-don't connect immediately.
-This requires that queueing be compiled in,
-since it will depend on a queue run process to
-actually send the mail.
-.ip HostsFile=\fIpath\fP
-[no short name]
-The path to the hosts database,
-normally
-.q /etc/hosts .
-This option is only consulted when sendmail
-is canonifying addresses,
-and then only when
-.q files
-is in the
-.q hosts
-service switch entry.
-In particular, this file is
-.i never
-used when looking up host addresses;
-that is under the control of the system
-.i gethostbyname (3)
-routine.
-.ip HostStatusDirectory=\fIpath\fP
-[no short name]
-The location of the long term host status information.
-When set,
-information about the status of hosts
-(e.g., host down or not accepting connections)
-will be shared between all
-.i sendmail
-processes;
-normally, this information is only held within a single queue run.
-This option requires a connection cache of at least 1 to function.
-If the option begins with a leading `/',
-it is an absolute pathname;
-otherwise,
-it is relative to the mail queue directory.
-A suggested value for sites desiring persistent host status is
-.q \&.hoststat
-(i.e., a subdirectory of the queue directory).
-.ip IgnoreDots
-[i]
-Ignore dots in incoming messages.
-This is always disabled (that is, dots are always accepted)
-when reading SMTP mail.
-.ip LogLevel=\fIn\fP
-[L]
-Set the log level to
-.i n .
-Defaults to 9.
-.ip M\fIx\|value\fP
-[no long version]
-Set the macro
-.i x
-to
-.i value .
-This is intended only for use from the command line.
-The
-.b \-M
-flag is preferred.
-.ip MatchGECOS
-[G]
-Allow fuzzy matching on the GECOS field.
-If this flag is set,
-and the usual user name lookups fail
-(that is, there is no alias with this name and a
-.i getpwnam
-fails),
-sequentially search the password file
-for a matching entry in the GECOS field.
-This also requires that MATCHGECOS
-be turned on during compilation.
-This option is not recommended.
-.ip MaxDaemonChildren=\fIN\fP
-[no short name]
-If set,
-.i sendmail
-will refuse connections when it has more than
-.i N
-children processing incoming mail.
-This does not limit the number of outgoing connections.
-If not set, there is no limit to the number of children --
-that is, the system load averaging controls this.
-.ip MaxHopCount=\fIN\fP
-[h]
-The maximum hop count.
-Messages that have been processed more than
-.i N
-times are assumed to be in a loop and are rejected.
-Defaults to 25.
-.ip MaxHostStatAge=\fIage\fP
-[no short name]
-Not yet implemented.
-This option specifies how long host status information will be retained.
-For example, if a host is found to be down,
-connections to that host will not be retried for this interval.
-The units default to minutes.
-.ip MaxMessageSize=\fIN\fP
-[no short name]
-Specify the maximum message size
-to be advertised in the ESMTP EHLO response.
-Messages larger than this will be rejected.
-.ip MaxQueueRunSize=\fIN\fP
-[no short name]
-The maximum number of jobs that will be processed
-in a single queue run.
-If not set, there is no limit on the size.
-If you have very large queues or a very short queue run interval
-this could be unstable.
-However, since the first
-.i N
-jobs in queue directory order are run (rather than the
-.i N
-highest priority jobs)
-this should be set as high as possible to avoid
-.q losing
-jobs that happen to fall late in the queue directory.
-.ip MaxRecipientsPerMessage=\fIN\fP
-[no short name]
-The maximum number of recipients that will be accepted per message
-in an SMTP transaction.
-Note: setting this too low can interfere with sending mail from
-MUAs that use SMTP for initial submission.
-If not set, there is no limit on the number of recipients per envelope.
-.ip MeToo
-[m]
-Send to me too,
-even if I am in an alias expansion.
-.ip MinFreeBlocks=\fIN\fP
-[b]
-Insist on at least
-.i N
-blocks free on the filesystem that holds the queue files
-before accepting email via SMTP.
-If there is insufficient space
-.i sendmail
-gives a 452 response
-to the MAIL command.
-This invites the sender to try again later.
-.ip MinQueueAge=\fPage\fP
-[no short name]
-Don't process any queued jobs
-that have been in the queue less than the indicated time interval.
-This is intended to allow you to get responsiveness
-by processing the queue fairly frequently
-without thrashing your system by trying jobs too often.
-The default units are minutes.
-.ip MustQuoteChars=\fIs\fP
-[no short name]
-Sets the list of characters that must be quoted if used in a full name
-that is in the phrase part of a ``phrase <address>'' syntax.
-The default is ``\'.''.
-The characters ``@,;:\e()[]'' are always added to this list.
-.ip NoRecipientAction
-[no short name]
-The action to take when you receive a message that has no valid
-recipient headers (To:, Cc:, Bcc:, or Apparently-To: \(em
-the last included for back compatibility with old
-.i sendmail s).
-It can be
-.b None
-to pass the message on unmodified,
-which violates the protocol,
-.b Add-To
-to add a To: header with any recipients it can find in the envelope
-(which might expose Bcc: recipients),
-.b Add-Apparently-To
-to add an Apparently-To: header
-(this is only for back-compatibility
-and is officially deprecated),
-.b Add-To-Undisclosed
-to add a header
-.q "To: undisclosed-recipients:;"
-to make the header legal without disclosing anything,
-or
-.b Add-Bcc
-to add an empty Bcc: header.
-.ip OldStyleHeaders
-[o]
-Assume that the headers may be in old format,
-i.e.,
-spaces delimit names.
-This actually turns on
-an adaptive algorithm:
-if any recipient address contains a comma, parenthesis,
-or angle bracket,
-it will be assumed that commas already exist.
-If this flag is not on,
-only commas delimit names.
-Headers are always output with commas between the names.
-Defaults to off.
-.ip OperatorChars=\fIcharlist\fP
-[$o macro]
-The list of characters that are considered to be
-.q operators ,
-that is, characters that delimit tokens.
-All operator characters are tokens by themselves;
-sequences of non-operator characters are also tokens.
-White space characters separate tokens
-but are not tokens themselves \(em for example,
-.q AAA.BBB
-has three tokens, but
-.q "AAA BBB"
-has two.
-If not set, OperatorChars defaults to
-.q \&.\|:\|@\|[\|] ;
-additionally, the characters
-.q (\|)\|<\|>\|,\|;
-are always operators.
-.ip PostmasterCopy=\fIpostmaster\fP
-[P]
-If set,
-copies of error messages will be sent to the named
-.i postmaster .
-Only the header of the failed message is sent.
-Since most errors are user problems,
-this is probably not a good idea on large sites,
-and arguably contains all sorts of privacy violations,
-but it seems to be popular with certain operating systems vendors.
-Defaults to no postmaster copies.
-.ip PrivacyOptions=\fI\|opt,opt,...\fP
-[p]
-Set the privacy
-.i opt ions.
-``Privacy'' is really a misnomer;
-many of these are just a way of insisting on stricter adherence
-to the SMTP protocol.
-The
-.i opt ions
-can be selected from:
-.(b
-.ta \w'needvrfyhelo'u+3n
-public Allow open access
-needmailhelo Insist on HELO or EHLO command before MAIL
-needexpnhelo Insist on HELO or EHLO command before EXPN
-noexpn Disallow EXPN entirely
-needvrfyhelo Insist on HELO or EHLO command before VRFY
-novrfy Disallow VRFY entirely
-noetrn Disallow ETRN entirely
-noverb Disallow VERB entirely
-restrictmailq Restrict mailq command
-restrictqrun Restrict \-q command line flag
-noreceipts Don't return success DSNs\**
-goaway Disallow essentially all SMTP status queries
-authwarnings Put X-Authentication-Warning: headers in messages
-.)b
-.(f
-\**N.B.:
-the
-.b noreceipts
-flag causes
-.i sendmail
-to violate RFC 1891,
-which requires that return receipts be provided
-if Delivery Status Notifications are supported.
-.)f
-The
-.q goaway
-pseudo-flag sets all flags except
-.q restrictmailq
-and
-.q restrictqrun .
-If mailq is restricted,
-only people in the same group as the queue directory
-can print the queue.
-If queue runs are restricted,
-only root and the owner of the queue directory
-can run the queue.
-Authentication Warnings add warnings about various conditions
-that may indicate attempts to spoof the mail system,
-such as using an non-standard queue directory.
-.ip QueueDirectory=\fIdir\fP
-[Q]
-Use the named
-.i dir
-as the queue directory.
-.ip QueueFactor=\fIfactor\fP
-[q]
-Use
-.i factor
-as the multiplier in the map function
-to decide when to just queue up jobs rather than run them.
-This value is divided by the difference between the current load average
-and the load average limit
-(\c
-.b QueueLA
-option)
-to determine the maximum message priority
-that will be sent.
-Defaults to 600000.
-.ip QueueLA=\fILA\fP
-[x]
-When the system load average exceeds
-.i LA ,
-just queue messages
-(i.e., don't try to send them).
-Defaults to 8.
-.ip QueueSortOrder=\fIalgorithm\fP
-[no short name]
-Sets the
-.i algorithm
-used for sorting the queue.
-Only the first character of the value is used.
-Legal values are
-.q host
-(to order by the name of the first host name of the first recipient),
-.q time
-(to order by the submission time),
-and
-.q priority
-(to order by message priority).
-Host ordering makes better use of the connection cache,
-but may tend to process low priority messages
-that go to a single host
-over high priority messages that go to several hosts;
-it probably shouldn't be used on slow network links.
-Time ordering is almost always a bad idea,
-since it allows large, bulk mail to go out
-before smaller, personal mail,
-but may have applicability on some hosts with very fast connections.
-Priority ordering is the default.
-.ip QueueTimeout=\fItimeout\fP
-[T]
-A synonym for
-.q Timeout.queuereturn .
-Use that form instead of the
-.q QueueTimeout
-form.
-.ip ResolverOptions=\fIoptions\fP
-[I]
-Set resolver options.
-Values can be set using
-.b + \c
-.i flag
-and cleared using
-.b \- \c
-.i flag ;
-the
-.i flag s
-can be
-.q debug ,
-.q aaonly ,
-.q usevc ,
-.q primary ,
-.q igntc ,
-.q recurse ,
-.q defnames ,
-.q stayopen ,
-or
-.q dnsrch .
-The string
-.q HasWildcardMX
-(without a
-.b +
-or
-.b \- )
-can be specified to turn off matching against MX records
-when doing name canonifications.
-.b N.B.
-Prior to 8.7,
-this option indicated that the name server be responding
-in order to accept addresses.
-This has been replaced by checking to see
-if the
-.q dns
-method is listed in the service switch entry for the
-.q hosts
-service.
-.ip RunAsUser=\fIuser\fP
-[no short name]
-The
-.i user
-parameter may be a user name
-(looked up in
-.i /etc/passwd )
-or a numeric user id;
-either form can have
-.q ":group"
-attached
-(where group can be numeric or symbolic).
-If set to a non-zero (non-root) value,
-.i sendmail
-will change to this user id shortly after startup\**.
-.(f
-\**When running as a daemon,
-it changes to this user after accepting a connection
-but before reading any
-.sm SMTP
-commands.
-.)f
-This avoids a certain class of security problems.
-However, this means that all
-.q \&.forward
-and
-.q :include:
-files must be readable by the indicated
-.i user ,
-and on systems that don't support the saved uid bit properly,
-all files to be written must be writable by
-.i user
-and all programs will be executed by
-.i user .
-It is also incompatible with the
-.b SafeFileEnvironment
-option.
-In other words, it may not actually add much to security on an average system,
-and may in fact detract from security
-(because other file permissions must be loosened).
-However, it should be useful on firewalls and other
-places where users don't have accounts and the aliases file is
-well constrained.
-.ip RecipientFactor=\fIfact\fP
-[y]
-The indicated
-.i fact or
-is added to the priority (thus
-.i lowering
-the priority of the job)
-for each recipient,
-i.e., this value penalizes jobs with large numbers of recipients.
-Defaults to 30000.
-.ip RefuseLA=\fILA\fP
-[X]
-When the system load average exceeds
-.i LA ,
-refuse incoming SMTP connections.
-Defaults to 12.
-.ip RetryFactor=\fIfact\fP
-[Z]
-The
-.i fact or
-is added to the priority
-every time a job is processed.
-Thus,
-each time a job is processed,
-its priority will be decreased by the indicated value.
-In most environments this should be positive,
-since hosts that are down are all too often down for a long time.
-Defaults to 90000.
-.ip SafeFileEnvironment=\fIdir\fP
-[no short name]
-If this option is set,
-.i sendmail
-will do a
-.i chroot (2)
-call into the indicated
-.i dir ectory
-before doing any file writes.
-If the file name specified by the user begins with
-.i dir ,
-that partial path name will be stripped off before writing,
-so (for example)
-if the SafeFileEnvironment variable is set to
-.q /safe
-then aliases of
-.q /safe/logs/file
-and
-.q /logs/file
-actually indicate the same file.
-Additionally, if this option is set,
-.i sendmail
-refuses to deliver to symbolic links.
-.ip SaveFromLine
-[f]
-Save
-Unix-style
-.q From
-lines at the front of headers.
-Normally they are assumed redundant
-and discarded.
-.ip SendMIMEErrors
-[j]
-If set, send error messages in MIME format
-(see RFC2045 and RFC1344 for details).
-If disabled,
-.i sendmail
-will not return the DSN keyword in response to an EHLO
-and will not do Delivery Status Notification processing as described in
-RFC1891.
-.ip ServiceSwitchFile=\fIfilename\fP
-[no short name]
-If your host operating system has a service switch abstraction
-(e.g., /etc/nsswitch.conf on Solaris
-or /etc/svc.conf on Ultrix and DEC OSF/1)
-that service will be consulted and this option is ignored.
-Otherwise, this is the name of a file
-that provides the list of methods used to implement particular services.
-The syntax is a series of lines,
-each of which is a sequence of words.
-The first word is the service name,
-and following words are service types.
-The services that
-.i sendmail
-consults directly are
-.q aliases
-and
-.q hosts.
-Service types can be
-.q dns ,
-.q nis ,
-.q nisplus ,
-or
-.q files
-(with the caveat that the appropriate support
-must be compiled in
-before the service can be referenced).
-If ServiceSwitchFile is not specified, it defaults to /etc/service.switch.
-If that file does not exist, the default switch is:
-.(b
-aliases files
-hosts dns nis files
-.)b
-The default file is
-.q /etc/service.switch .
-.ip SevenBitInput
-[7]
-Strip input to seven bits for compatibility with old systems.
-This shouldn't be necessary.
-.ip SingleLineFromHeader
-[no short name]
-If set, From: lines that have embedded newlines are unwrapped
-onto one line.
-This is to get around a botch in Lotus Notes
-that apparently cannot understand legally wrapped RFC822 headers.
-.ip SingleThreadDelivery
-[no short name]
-If set, a client machine will never try to open two SMTP connections
-to a single server machine at the same time,
-even in different processes.
-That is, if another
-.i sendmail
-is already talking to some host a new
-.i sendmail
-will not open another connection.
-This property is of mixed value;
-although this reduces the load on the other machine,
-it can cause mail to be delayed
-(for example, if one
-.i sendmail
-is delivering a huge message, other
-.i sendmail s
-won't be able to send even small messages).
-Also, it requires another file descriptor
-(for the lock file)
-per connection, so you may have to reduce the
-.b ConnectionCacheSize
-option to avoid running out of per-process file descriptors.
-Requires the
-.b HostStatusDirectory
-option.
-.ip SmtpGreetingMessage=\fImessage\fP
-[$e macro]
-The message printed when the SMTP server starts up.
-Defaults to
-.q "$j Sendmail $v ready at $b".
-.ip StatusFile=\fIfile\fP
-[S]
-Log summary statistics in the named
-.i file .
-If not set,
-no summary statistics are saved.
-This file does not grow in size.
-It can be printed using the
-.i mailstats (8)
-program.
-.ip SuperSafe
-[s]
-Be super-safe when running things,
-i.e.,
-always instantiate the queue file,
-even if you are going to attempt immediate delivery.
-.i Sendmail
-always instantiates the queue file
-before returning control to the client
-under any circumstances.
-This should really
-.i always
-be set.
-.ip TempFileMode=\fImode\fP
-[F]
-The file mode for queue files.
-It is interpreted in octal by default.
-Defaults to 0600.
-.ip Timeout.\fItype\fP=\|\fItimeout\fP
-[r; subsumes old T option as well]
-Set timeout values.
-The actual timeout is indicated by the
-.i type .
-The recognized timeouts and their default values, and their
-minimum values specified in RFC 1123 section 5.3.2 are:
-.(b
-.ta \w'datafinal'u+3n
-initial wait for initial greeting message [5m, 5m]
-helo reply to HELO or EHLO command [5m, none]
-mail reply to MAIL command [10m, 5m]
-rcpt reply to RCPT command [1h, 5m]
-datainit reply to DATA command [5m, 2m]
-datablock data block read [1h, 3m]
-datafinal reply to final ``.'' in data [1h, 10m]
-rset reply to RSET command [5m, none]
-quit reply to QUIT command [2m, none]
-misc reply to NOOP and VERB commands [2m, none]
-ident IDENT protocol timeout [30s, none]
-fileopen\(dg timeout on opening .forward and :include: files [60s, none]
-command\(dg command read [1h, 5m]
-queuereturn\(dg how long until a message is returned [5d, 5d]
-queuewarn\(dg how long until a warning is sent [none, none]
-hoststatus\(dg how long until host status is ``stale'' [30m, none]
-.)b
-All but those marked with a dagger (\(dg)
-apply to client SMTP.
-If the message is submitted using the
-.sm NOTIFY
-.sm SMTP
-extension,
-warning messages will only be sent if
-.sm NOTIFY=DELAY
-is specified.
-The queuereturn and queuewarn timeouts
-can be further qualified with a tag based on the Precedence: field
-in the message;
-they must be one of
-.q urgent
-(indicating a positive non-zero precedence)
-.q normal
-(indicating a zero precedence), or
-.q non-urgent
-(indicating negative precedences).
-For example, setting
-.q Timeout.queuewarn.urgent=1h
-sets the warning timeout for urgent messages only
-to one hour.
-The default if no precedence is indicated
-is to set the timeout for all precedences.
-.ip TimeZoneSpec=\fItzinfo\fP
-[t]
-Set the local time zone info to
-.i tzinfo
-\*- for example,
-.q PST8PDT .
-Actually, if this is not set,
-the TZ environment variable is cleared (so the system default is used);
-if set but null, the user's TZ variable is used,
-and if set and non-null the TZ variable is set to this value.
-.ip TryNullMXList
-[w]
-If this system is the
-.q best
-(that is, lowest preference)
-MX for a given host,
-its configuration rules should normally detect this situation
-and treat that condition specially
-by forwarding the mail to a UUCP feed,
-treating it as local,
-or whatever.
-However, in some cases (such as Internet firewalls)
-you may want to try to connect directly to that host
-as though it had no MX records at all.
-Setting this option causes
-.i sendmail
-to try this.
-The downside is that errors in your configuration
-are likely to be diagnosed as
-.q "host unknown"
-or
-.q "message timed out"
-instead of something more meaningful.
-This option is disrecommended.
-.ip UnixFromLine=\fIfromline\fP
-[$l macro]
-Defines the format used when
-.i sendmail
-must add a UNIX-style From_ line
-(that is, a line beginning
-.q From<space>user ).
-Defaults to
-.q "From $g $d" .
-Don't change this unless your system uses a different UNIX mailbox format
-(very unlikely).
-.ip UnsafeGroupWrites
-[no short name]
-If set,
-:include: and .forward files that are group writable are considered
-.q unsafe ,
-that is,
-they cannot reference programs or write directly to files.
-World writable :include: and .forward files
-are always unsafe..
-.ip UseErrorsTo
-[l]
-If there is an
-.q Errors-To:
-header, send error messages to the addresses listed there.
-They normally go to the envelope sender.
-Use of this option causes
-.i sendmail
-to violate RFC 1123.
-This option is disrecommended and deprecated.
-.ip UserDatabaseSpec=\fIudbspec\fP
-[U]
-The user database specification.
-.ip UserSubmission
-[no short name]
-This is an initial submission directly from a Mail User Agent.
-This can be set in the configuration file if you have
-MUAs that don't pass the
-.b \-U
-flag or use the
-XUSR
-ESMTP extension,
-but some relayed mail may get inappropriately rewritten if you do.
-.ip Verbose
-[v]
-Run in verbose mode.
-If this is set,
-.i sendmail
-adjusts options
-.b HoldExpensive
-(old
-.b c )
-and
-.b DeliveryMode
-(old
-.b d )
-so that all mail is delivered completely
-in a single job
-so that you can see the entire delivery process.
-Option
-.b Verbose
-should
-.i never
-be set in the configuration file;
-it is intended for command line use only.
-.lp
-All options can be specified on the command line using the
-\-O or \-o flag,
-but most will cause
-.i sendmail
-to relinquish its setuid permissions.
-The options that will not cause this are
-MinFreeBlocks [b],
-DeliveryMode [d],
-ErrorMode [e],
-IgnoreDots [i],
-LogLevel [L],
-MeToo [m],
-OldStyleHeaders [o],
-PrivacyOptions [p],
-Timeouts [r],
-SuperSafe [s],
-Verbose [v],
-CheckpointInterval [C],
-and
-SevenBitInput [7].
-Also, M (define macro) when defining the r or s macros
-is also considered
-.q safe .
-.sh 2 "P \*- Precedence Definitions"
-.pp
-Values for the
-.q "Precedence:"
-field may be defined using the
-.b P
-control line.
-The syntax of this field is:
-.(b
-\fBP\fP\fIname\fP\fB=\fP\fInum\fP
-.)b
-When the
-.i name
-is found in a
-.q Precedence:
-field,
-the message class is set to
-.i num .
-Higher numbers mean higher precedence.
-Numbers less than zero
-have the special property
-that if an error occurs during processing
-the body of the message will not be returned;
-this is expected to be used for
-.q "bulk"
-mail such as through mailing lists.
-The default precedence is zero.
-For example,
-our list of precedences is:
-.(b
-Pfirst-class=0
-Pspecial-delivery=100
-Plist=\-30
-Pbulk=\-60
-Pjunk=\-100
-.)b
-People writing mailing list exploders
-are encouraged to use
-.q "Precedence: list" .
-Older versions of
-.i sendmail
-(which discarded all error returns for negative precedences)
-didn't recognize this name, giving it a default precedence of zero.
-This allows list maintainers to see error returns
-on both old and new versions of
-.i sendmail .
-.sh 2 "V \*- Configuration Version Level"
-.pp
-To provide compatibility with old configuration files,
-the
-.b V
-line has been added to define some very basic semantics
-of the configuration file.
-These are not intended to be long term supports;
-rather, they describe compatibility features
-which will probably be removed in future releases.
-.pp
-.b N.B.:
-these version
-.i levels
-have nothing
-to do with the version
-.i number
-on the files.
-For example,
-as of this writing
-version 8 config files
-(specifically, 8.9)
-used version level 8 configurations.
-.pp
-.q Old
-configuration files are defined as version level one.
-Version level two files make the following changes:
-.np
-Host name canonification ($[ ... $])
-appends a dot if the name is recognized;
-this gives the config file a way of finding out if anything matched.
-(Actually, this just initializes the
-.q host
-map with the
-.q \-a.
-flag \*- you can reset it to anything you prefer
-by declaring the map explicitly.)
-.np
-Default host name extension is consistent throughout processing;
-version level one configurations turned off domain extension
-(that is, adding the local domain name)
-during certain points in processing.
-Version level two configurations are expected to include a trailing dot
-to indicate that the name is already canonical.
-.np
-Local names that are not aliases
-are passed through a new distinguished ruleset five;
-this can be used to append a local relay.
-This behaviour can be prevented by resolving the local name
-with an initial `@'.
-That is, something that resolves to a local mailer and a user name of
-.q vikki
-will be passed through ruleset five,
-but a user name of
-.q @vikki
-will have the `@' stripped,
-will not be passed through ruleset five,
-but will otherwise be treated the same as the prior example.
-The expectation is that this might be used to implement a policy
-where mail sent to
-.q vikki
-was handled by a central hub,
-but mail sent to
-.q vikki@localhost
-was delivered directly.
-.pp
-Version level three files
-allow # initiated comments on all lines.
-Exceptions are backslash escaped # marks
-and the $# syntax.
-.pp
-Version level four configurations
-are completely equivalent to level three
-for historical reasons.
-.pp
-Version level five configuration files
-change the default definition of
-.b $w
-to be just the first component of the hostname.
-.pp
-Version level six configuration files
-change many of the local processing options
-(such as aliasing and matching the beginning of the address for
-`|' characters)
-to be mailer flags;
-this allows fine-grained control over the special local processing.
-Level six configuration files may also use long option names.
-The
-.b ColonOkInAddr
-option (to allow colons in the local-part of addresses)
-defaults
-.b on
-for lower numbered configuration files;
-the configuration file requires some additional intelligence
-to properly handle the RFC 822 group construct.
-.pp
-Version level seven configuration files
-used new option names to replace old macros
-(\c
-.b $e
-became
-.b SmtpGreeetingMessage ,
-.b $l
-became
-.b UnixFromLine ,
-and
-.b $o
-became
-.b OperatorChars .
-Also, prior to version seven,
-the
-.b F=q
-flag (use 250 instead of 252 return value for
-.sm "SMTP VRFY"
-commands)
-was assumed.
-.pp
-Version level eight configuration files allow
-.b $#
-on the left hand side of ruleset lines.
-.pp
-The
-.b V
-line may have an optional
-.b / \c
-.i vendor
-to indicate that this configuration file uses modifications
-specific to a particular vendor\**.
-.(f
-\**And of course, vendors are encouraged to add themselves
-to the list of recognized vendors by editing the routine
-.i setvendor
-in
-.i conf.c .
-Please send e-mail to sendmail@Sendmail.ORG
-to register your vendor dialect.
-.)f
-You may use
-.q /Berkeley
-to emphasize that this configuration file
-uses the Berkeley dialect of
-.i sendmail .
-.sh 2 "K \*- Key File Declaration"
-.pp
-Special maps can be defined using the line:
-.(b
-Kmapname mapclass arguments
-.)b
-The
-.i mapname
-is the handle by which this map is referenced in the rewriting rules.
-The
-.i mapclass
-is the name of a type of map;
-these are compiled in to
-.i sendmail .
-The
-.i arguments
-are interpreted depending on the class;
-typically,
-there would be a single argument naming the file containing the map.
-.pp
-Maps are referenced using the syntax:
-.(b
-$( \fImap\fP \fIkey\fP $@ \fIarguments\fP $: \fIdefault\fP $)
-.)b
-where either or both of the
-.i arguments
-or
-.i default
-portion may be omitted.
-The
-.i "$@ arguments"
-may appear more than once.
-The indicated
-.i key
-and
-.i arguments
-are passed to the appropriate mapping function.
-If it returns a value, it replaces the input.
-If it does not return a value and the
-.i default
-is specified, the
-.i default
-replaces the input.
-Otherwise, the input is unchanged.
-.pp
-The
-.i arguments
-are passed to the map for arbitrary use.
-Most map classes can interpolate these arguments
-into their values using the syntax
-.q %\fIn\fP
-(where
-.i n
-is a digit)
-to indicate the corresponding
-.i argument .
-Argument
-.q %0
-indicates the database key.
-For example, the rule
-.(b
-.ta 1.5i
-R$\- ! $+ $: $(uucp $1 $@ $2 $: %1 @ %0 . UUCP $)
-.)b
-Looks up the UUCP name in a (user defined) UUCP map;
-if not found it turns it into
-.q \&.UUCP
-form.
-The database might contain records like:
-.(b
-decvax %1@%0.DEC.COM
-research %1@%0.ATT.COM
-.)b
-Note that
-.i default
-clauses never do this mapping.
-.pp
-The built in map with both name and class
-.q host
-is the host name canonicalization lookup.
-Thus,
-the syntax:
-.(b
-$(host \fIhostname\fP$)
-.)b
-is equivalent to:
-.(b
-$[\fIhostname\fP$]
-.)b
-.pp
-There are many defined classes.
-.ip dbm
-Database lookups using the ndbm(3) library.
-.i Sendmail
-must be compiled with
-.b NDBM
-defined.
-.ip btree
-Database lookups using the btree interface to the Berkeley DB
-library.
-.i Sendmail
-must be compiled with
-.b NEWDB
-defined.
-.ip hash
-Database lookups using the hash interface to the Berkeley DB
-library.
-.i Sendmail
-must be compiled with
-.b NEWDB
-defined.
-.ip nis
-NIS lookups.
-.i Sendmail
-must be compiled with
-.b NIS
-defined.
-.ip nisplus
-NIS+ lookups.
-.i Sendmail
-must be compiled with
-.b NISPLUS
-defined.
-The argument is the name of the table to use for lookups,
-and the
-.b \-k
-and
-.b \-v
-flags may be used to set the key and value columns respectively.
-.ip hesiod
-Hesiod lookups.
-.i Sendmail
-must be compiled with
-.b HESIOD
-defined.
-.ip ldapx
-LDAP X500 directory lookups.
-.i Sendmail
-must be compiled with
-.b LDAPMAP
-defined.
-The map supports most of the standard arguments
-and most of the command line arguments of the
-.i ldapsearch
-program.
-.ip netinfo
-NeXT NetInfo lookups.
-.i Sendmail
-must be compiled with
-.b NETINFO
-defined.
-.ip text
-Text file lookups.
-The format of the text file is defined by the
-.b \-k
-(key field number),
-.b \-v
-(value field number),
-and
-.b \-z
-(field delimiter)
-flags.
-.ip stab
-Internal symbol table lookups.
-Used internally for aliasing.
-.ip implicit
-Really should be called
-.q alias
-\(em this is used to get the default lookups
-for alias files,
-and is the default if no class is specified for alias files.
-.ip user
-Looks up users using
-.i getpwnam (3).
-The
-.b \-v
-flag can be used to specify the name of the field to return
-(although this is normally used only to check the existence
-of a user).
-.ip host
-Canonifies host domain names.
-Given a host name it calls the name server
-to find the canonical name for that host.
-.ip bestmx
-Returns the best MX record for a host name given as the key.
-The current machine is always preferred \*-
-that is, if the current machine is one of the hosts listed as a
-lowest-preference MX record, then it will be guaranteed to be returned.
-This can be used to find out if this machine is the target for an MX record,
-and mail can be accepted on that basis.
-If the
-.b \-z
-flag is given, then all MX names are returned,
-separated by the given delimiter.
-.ip sequence
-The arguments on the `K' line are a list of maps;
-the resulting map searches the argument maps in order
-until it finds a match for the indicated key.
-For example, if the key definition is:
-.(b
-Kmap1 ...
-Kmap2 ...
-Kseqmap sequence map1 map2
-.)b
-then a lookup against
-.q seqmap
-first does a lookup in map1.
-If that is found, it returns immediately.
-Otherwise, the same key is used for map2.
-.ip switch
-Much like the
-.q sequence
-map except that the order of maps is determined by the service switch.
-The argument is the name of the service to be looked up;
-the values from the service switch are appended to the map name
-to create new map names.
-For example, consider the key definition:
-.(b
-Kali switch aliases
-.)b
-together with the service switch entry:
-.(b
-aliases nis files
-.)b
-This causes a query against the map
-.q ali
-to search maps named
-.q ali.nis
-and
-.q ali.files
-in that order.
-.ip dequote
-Strip double quotes (") from a name.
-It does not strip backslashes,
-and will not strip quotes if the resulting string
-would contain unscannable syntax
-(that is, basic errors like unbalanced angle brackets;
-more sophisticated errors such as unknown hosts are not checked).
-The intent is for use when trying to accept mail from systems such as
-DECnet
-that routinely quote odd syntax such as
-.(b
-"49ers::ubell"
-.)b
-A typical usage is probably something like:
-.(b
-Kdequote dequote
-
-\&...
-
-R$\- $: $(dequote $1 $)
-R$\- $+ $: $>3 $1 $2
-.)b
-Care must be taken to prevent unexpected results;
-for example,
-.(b
-"|someprogram < input > output"
-.)b
-will have quotes stripped,
-but the result is probably not what you had in mind.
-Fortunately these cases are rare.
-.ip regex
-The map definition on the
-.b K
-line contains a regular expression.
-Any key input is compared to that expression using the
-POSIX regular expressions routines regcomp(), regerr(), and regexec().
-Refer to the documentation for those routines for more information
-about the regular expression matching.
-No rewriting of the key is done if the
-.b \-m
-flag is used. Without it, the key is discarded or if
-.b \-s
-if used, it is substituted by the substring matches, delimited by
-.b $|
-or the string specified with the the
-.b \-d
-flag. The flags available for the map are
-.(b
--n not
--f case sensitive
--b basic regular expressions
- (default is extended)
--s substring match
--d set the delimiter used for -s
--a append string to key
--m match only, do not
- replace/discard value
-.)b
-The
-.b \-s
-flag can include an optional parameter which can be used
-to select the substrings in the result of the lookup. For example,
-.(b
--s1,3,4
-.)b
-.ip program
-The arguments on the
-.b K
-line are the pathname to a program and any initial parameters to be passed.
-When the map is called,
-the key is added to the initial parameters
-and the program is invoked
-as the default user/group id.
-The first line of standard output is returned as the value of the lookup.
-This has many potential security problems,
-and has terrible performance;
-it should be used only when absolutely necessary.
-.pp
-Most of these accept as arguments the same optional flags
-and a filename
-(or a mapname for NIS;
-the filename is the root of the database path,
-so that
-.q .db
-or some other extension appropriate for the database type
-will be added to get the actual database name).
-Known flags are:
-.ip "\-o"
-Indicates that this map is optional \*- that is,
-if it cannot be opened,
-no error is produced,
-and
-.i sendmail
-will behave as if the map existed but was empty.
-.ip "\-N, \-O"
-If neither
-.b \-N
-or
-.b \-O
-are specified,
-.i sendmail
-uses an adaptive algorithm to decide whether or not to look for null bytes
-on the end of keys.
-It starts by trying both;
-if it finds any key with a null byte it never tries again without a null byte
-and vice versa.
-If
-.b \-N
-is specified it never tries without a null byte and
-if
-.b \-O
-is specified it never tries with a null byte.
-Setting one of
-these can speed matches but are never necessary.
-If both
-.b \-N
-and
-.b \-O
-are specified,
-.i sendmail
-will never try any matches at all \(em
-that is, everything will appear to fail.
-.ip "\-a\fIx\fP"
-Append the string
-.i x
-on successful matches.
-For example, the default
-.i host
-map appends a dot on successful matches.
-.ip "\-T\fIx\fP"
-Append the string
-.i x
-on temporary failures.
-For example,
-.i x
-would be appended if a DNS lookup returned
-.q "server failed"
-or an NIS lookup could not locate a server.
-See also the
-.b \-t
-flag.
-.ip "\-f"
-Do not fold upper to lower case before looking up the key.
-.ip "\-m"
-Match only (without replacing the value).
-If you only care about the existence of a key and not the value
-(as you might when searching the NIS map
-.q hosts.byname
-for example),
-this flag prevents the map from substituting the value.
-However,
-The \-a argument is still appended on a match,
-and the default is still taken if the match fails.
-.ip "\-k\fIkeycol\fP"
-The key column name (for NIS+) or number
-(for text lookups).
-For LDAP maps this is a filter string
-passed to printf with a %s where the string to be
-.q "mapped"
-is inserted.
-.ip "\-v\fIvalcol\fP"
-The value column name (for NIS+) or number
-(for text lookups).
-For LDAP maps this is the name of the
-attribute to be returned.
-.ip "\-z\fIdelim\fP"
-The column delimiter (for text lookups).
-It can be a single character or one of the special strings
-.q \|\en
-or
-.q \|\et
-to indicate newline or tab respectively.
-If omitted entirely,
-the column separator is any sequence of whitespace.
-.ip "\-t"
-Normally, when a map attempts to do a lookup
-and the server fails
-(e.g.,
-.i sendmail
-couldn't contact any name server;
-this is
-.i not
-the same as an entry not being found in the map),
-the message being processed is queued for future processing.
-The
-.b \-t
-flag turns off this behaviour,
-letting the temporary failure (server down)
-act as though it were a permanent failure (entry not found).
-It is particularly useful for DNS lookups,
-where someone else's misconfigured name server can cause problems
-on your machine.
-However, care must be taken to ensure that you don't bounce mail
-that would be resolved correctly if you tried again.
-A common strategy is to forward such mail
-to another, possibly better connected, mail server.
-.ip "\-s\fIspacesub\fP
-For the dequote map only,
-the character to use to replace space characters
-after a successful dequote.
-.ip "\-q"
-Don't dequote the key before lookup.
-.ip "\-A"
-When rebuilding an alias file,
-the
-.b \-A
-flag causes duplicate entries in the text version
-to be merged.
-For example, two entries:
-.(b
-list: user1, user2
-list: user3
-.)b
-would be treated as though it were the single entry
-.(b
-list: user1, user2, user3
-.)b
-in the presence of the
-.b \-A
-flag.
-.pp
-The
-.i dbm
-map appends the strings
-.q \&.pag
-and
-.q \&.dir
-to the given filename;
-the
-.i hash
-and
-.i btree
-maps append
-.q \&.db .
-For example, the map specification
-.(b
-Kuucp dbm \-o \-N /usr/lib/uucpmap
-.)b
-specifies an optional map named
-.q uucp
-of class
-.q dbm ;
-it always has null bytes at the end of every string,
-and the data is located in
-/usr/lib/uucpmap.{dir,pag}.
-.pp
-The program
-.i makemap (8)
-can be used to build any of the three database-oriented maps.
-It takes the following flags:
-.ip \-f
-Do not fold upper to lower case in the map.
-.ip \-N
-Include null bytes in keys.
-.ip \-o
-Append to an existing (old) file.
-.ip \-r
-Allow replacement of existing keys;
-normally, re-inserting an existing key is an error.
-.ip \-v
-Print what is happening.
-.lp
-The
-.i sendmail
-daemon does not have to be restarted to read the new maps
-as long as you change them in place;
-file locking is used so that the maps won't be read
-while they are being updated.\**
-.(f
-\**That is, don't create new maps and then use
-.i mv (1)
-to move them into place.
-Since the maps are already open
-the new maps will never be seen.
-.)f
-.pp
-New classes can be added in the routine
-.b setupmaps
-in file
-.b conf.c .
-.sh 2 "The User Database"
-.pp
-If you have a version of
-.i sendmail
-with the user database package
-compiled in,
-the handling of sender and recipient addresses
-is modified.
-.pp
-The location of this database is controlled with the
-.b UserDatabaseSpec
-option.
-.sh 3 "Structure of the user database"
-.pp
-The database is a sorted (BTree-based) structure.
-User records are stored with the key:
-.(b
-\fIuser-name\fP\fB:\fP\fIfield-name\fP
-.)b
-The sorted database format ensures that user records are clustered together.
-Meta-information is always stored with a leading colon.
-.pp
-Field names define both the syntax and semantics of the value.
-Defined fields include:
-.nr ii 1i
-.ip maildrop
-The delivery address for this user.
-There may be multiple values of this record.
-In particular,
-mailing lists will have one
-.i maildrop
-record for each user on the list.
-.ip "mailname"
-The outgoing mailname for this user.
-For each outgoing name,
-there should be an appropriate
-.i maildrop
-record for that name to allow return mail.
-See also
-.i :default:mailname .
-.ip mailsender
-Changes any mail sent to this address to have the indicated envelope sender.
-This is intended for mailing lists,
-and will normally be the name of an appropriate -request address.
-It is very similar to the owner-\c
-.i list
-syntax in the alias file.
-.ip fullname
-The full name of the user.
-.ip office-address
-The office address for this user.
-.ip office-phone
-The office phone number for this user.
-.ip office-fax
-The office FAX number for this user.
-.ip home-address
-The home address for this user.
-.ip home-phone
-The home phone number for this user.
-.ip home-fax
-The home FAX number for this user.
-.ip project
-A (short) description of the project this person is affiliated with.
-In the University this is often just the name of their graduate advisor.
-.ip plan
-A pointer to a file from which plan information can be gathered.
-.pp
-As of this writing,
-only a few of these fields are actually being used by
-.i sendmail :
-.i maildrop
-and
-.i mailname .
-A
-.i finger
-program that uses the other fields is planned.
-.sh 3 "User database semantics"
-.pp
-When the rewriting rules submit an address to the local mailer,
-the user name is passed through the alias file.
-If no alias is found (or if the alias points back to the same address),
-the name (with
-.q :maildrop
-appended)
-is then used as a key in the user database.
-If no match occurs (or if the maildrop points at the same address),
-forwarding is tried.
-.pp
-If the first token of the user name returned by ruleset 0
-is an
-.q @
-sign, the user database lookup is skipped.
-The intent is that the user database will act as a set of defaults
-for a cluster (in our case, the Computer Science Division);
-mail sent to a specific machine should ignore these defaults.
-.pp
-When mail is sent,
-the name of the sending user is looked up in the database.
-If that user has a
-.q mailname
-record,
-the value of that record is used as their outgoing name.
-For example, I might have a record:
-.(b
-eric:mailname Eric.Allman@CS.Berkeley.EDU
-.)b
-This would cause my outgoing mail to be sent as Eric.Allman.
-.pp
-If a
-.q maildrop
-is found for the user,
-but no corresponding
-.q mailname
-record exists,
-the record
-.q :default:mailname
-is consulted.
-If present, this is the name of a host to override the local host.
-For example, in our case we would set it to
-.q CS.Berkeley.EDU .
-The effect is that anyone known in the database
-gets their outgoing mail stamped as
-.q user@CS.Berkeley.EDU ,
-but people not listed in the database use the local hostname.
-.sh 3 "Creating the database\**"
-.(f
-\**These instructions are known to be incomplete.
-A future version of the user database is planned
-including things such as finger service \*- and good documentation.
-.)f
-.pp
-The user database is built from a text file
-using the
-.i makemap
-utility
-(in the distribution in the makemap subdirectory).
-The text file is a series of lines corresponding to userdb records;
-each line has a key and a value separated by white space.
-The key is always in the format described above \*-
-for example:
-.(b
-eric:maildrop
-.)b
-This file is normally installed in a system directory;
-for example, it might be called
-.i /etc/userdb .
-To make the database version of the map, run the program:
-.(b
-makemap btree /etc/userdb.db < /etc/userdb
-.)b
-Then create a config file that uses this.
-For example, using the V8 M4 configuration, include the
-following line in your .mc file:
-.(b
-define(\`confUSERDB_SPEC\', /etc/userdb.db)
-.)b
-.sh 1 "OTHER CONFIGURATION"
-.pp
-There are some configuration changes that can be made by
-recompiling
-.i sendmail .
-This section describes what changes can be made
-and what has to be modified to make them.
-In most cases this should be unnecessary
-unless you are porting
-.i sendmail
-to a new environment.
-.sh 2 "Parameters in BuildTools/OS/$oscf"
-.pp
-These parameters are intended to describe the compilation environment,
-not site policy,
-and should normally be defined in the operating system
-configuration file.
-.b "This section needs a complete rewrite."
-.ip NDBM
-If set,
-the new version of the DBM library
-that allows multiple databases will be used.
-If neither NDBM nor NEWDB are set,
-a much less efficient method of alias lookup is used.
-.ip NEWDB
-If set, use the new database package from Berkeley (from 4.4BSD).
-This package is substantially faster than DBM or NDBM.
-If NEWDB and NDBM are both set,
-.i sendmail
-will read DBM files,
-but will create and use NEWDB files.
-.ip NIS
-Include support for NIS.
-If set together with
-.i both
-NEWDB and NDBM,
-.i sendmail
-will create both DBM and NEWDB files if and only if
-an alias file includes the substring
-.q /yp/
-in the name.
-This is intended for compatibility with Sun Microsystems'
-.i mkalias
-program used on YP masters.
-.ip NISPLUS
-Compile in support for NIS+.
-.ip NETINFO
-Compile in support for NetInfo (NeXT stations).
-.ip LDAPMAP
-Compile in support for LDAP X500 queries.
-Requires libldap and liblber
-from the Umich LDAP 3.2 or 3.3 release.
-.ip HESIOD
-Compile in support for Hesiod.
-.ip _PATH_SENDMAILCF
-The pathname of the sendmail.cf file.
-.ip _PATH_SENDMAILPID
-The pathname of the sendmail.pid file.
-.pp
-There are also several compilation flags to indicate the environment
-such as
-.q _AIX3
-and
-.q _SCO_unix_ .
-See the src/README
-file for the latest scoop on these flags.
-.sh 2 "Parameters in src/conf.h"
-.pp
-Parameters and compilation options
-are defined in conf.h.
-Most of these need not normally be tweaked;
-common parameters are all in sendmail.cf.
-However, the sizes of certain primitive vectors, etc.,
-are included in this file.
-The numbers following the parameters
-are their default value.
-.pp
-This document is not the best source of information
-for compilation flags in conf.h \(em
-see src/README or src/conf.h itself.
-.nr ii 1.2i
-.ip "MAXLINE [2048]"
-The maximum line length of any input line.
-If message lines exceed this length
-they will still be processed correctly;
-however, header lines,
-configuration file lines,
-alias lines,
-etc.,
-must fit within this limit.
-.ip "MAXNAME [256]"
-The maximum length of any name,
-such as a host or a user name.
-.ip "MAXPV [40]"
-The maximum number of parameters to any mailer.
-This limits the number of recipients that may be passed in one transaction.
-It can be set to any arbitrary number above about 10,
-since
-.i sendmail
-will break up a delivery into smaller batches as needed.
-A higher number may reduce load on your system, however.
-.ip "MAXATOM [100]"
-The maximum number of atoms
-(tokens)
-in a single address.
-For example,
-the address
-.q "eric@CS.Berkeley.EDU"
-is seven atoms.
-.ip "MAXMAILERS [25]"
-The maximum number of mailers that may be defined
-in the configuration file.
-.ip "MAXRWSETS [200]"
-The maximum number of rewriting sets
-that may be defined.
-The first half of these are reserved for numeric specification
-(e.g., ``S92''),
-while the upper half are reserved for auto-numbering
-(e.g., ``Sfoo'').
-Thus, with a value of 200 an attempt to use ``S99'' will succeed,
-but ``S100'' will fail.
-.ip "MAXPRIORITIES [25]"
-The maximum number of values for the
-.q Precedence:
-field that may be defined
-(using the
-.b P
-line in sendmail.cf).
-.ip "MAXUSERENVIRON [100]"
-The maximum number of items in the user environment
-that will be passed to subordinate mailers.
-.ip "MAXMXHOSTS [100]"
-The maximum number of MX records we will accept for any single host.
-.ip "MAXALIASDB [12]"
-The maximum number of alias databases that can be open at any time.
-Note that there may also be an open file limit.
-.ip "MAXMAPSTACK [12]"
-The maximum number of maps that may be "stacked" in a
-.b sequence
-class map.
-.ip "MAXMIMEARGS [20]"
-The maximum number of arguments in a MIME Content-Type: header;
-additional arguments will be ignored.
-.ip "MAXMIMENESTING [20]"
-The maximum depth to which MIME messages may be nested
-(that is, nested Message or Multipart documents;
-this does not limit the number of components in a single Multipart document).
-.lp
-A number of other compilation options exist.
-These specify whether or not specific code should be compiled in.
-Ones marked with \(dg
-are 0/1 valued.
-.nr ii 1.2i
-.ip NETINET\(dg
-If set,
-support for Internet protocol networking is compiled in.
-Previous versions of
-.i sendmail
-referred to this as
-.sm DAEMON ;
-this old usage is now incorrect.
-Defaults on;
-turn it off in the Makefile
-if your system doesn't support the Internet protocols.
-.ip NETISO\(dg
-If set,
-support for ISO protocol networking is compiled in
-(it may be appropriate to #define this in the Makefile instead of conf.h).
-.ip LOG
-If set,
-the
-.i syslog
-routine in use at some sites is used.
-This makes an informational log record
-for each message processed,
-and makes a higher priority log record
-for internal system errors.
-.b "STRONGLY RECOMMENDED"
-\(em if you want no logging, turn it off in the configuration file.
-.ip MATCHGECOS\(dg
-Compile in the code to do ``fuzzy matching'' on the GECOS field
-in /etc/passwd.
-This also requires that the
-.b MatchGECOS
-option be turned on.
-.ip NAMED_BIND\(dg
-Compile in code to use the
-Berkeley Internet Name Domain (BIND) server
-to resolve TCP/IP host names.
-.ip NOTUNIX
-If you are using a non-UNIX mail format,
-you can set this flag to turn off special processing
-of UNIX-style
-.q "From "
-lines.
-.ip QUEUE\(dg
-This flag should be set to compile in the queueing code.
-If this is not set,
-mailers must accept the mail immediately
-or it will be returned to the sender.
-.ip SMTP\(dg
-If set,
-the code to handle user and server SMTP will be compiled in.
-This is only necessary if your machine has some mailer
-that speaks SMTP
-(this means most machines everywhere).
-.ip USERDB\(dg
-Include the
-.b experimental
-Berkeley user information database package.
-This adds a new level of local name expansion
-between aliasing and forwarding.
-It also uses the NEWDB package.
-This may change in future releases.
-.lp
-The following options are normally turned on
-in per-operating-system clauses in conf.h.
-.ip IDENTPROTO\(dg
-Compile in the IDENT protocol as defined in RFC 1413.
-This defaults on for all systems except Ultrix,
-which apparently has the interesting
-.q feature
-that when it receives a
-.q "host unreachable"
-message it closes all open connections to that host.
-Since some firewall gateways send this error code
-when you access an unauthorized port (such as 113, used by IDENT),
-Ultrix cannot receive email from such hosts.
-.ip SYSTEM5
-Set all of the compilation parameters appropriate for System V.
-.ip HASFLOCK\(dg
-Use Berkeley-style
-.b flock
-instead of System V
-.b lockf
-to do file locking.
-Due to the highly unusual semantics of locks
-across forks in
-.b lockf ,
-this should always be used if at all possible.
-.ip HASINITGROUPS
-Set this if your system has the
-.i initgroups()
-call
-(if you have multiple group support).
-This is the default if SYSTEM5 is
-.i not
-defined or if you are on HPUX.
-.ip HASUNAME
-Set this if you have the
-.i uname (2)
-system call (or corresponding library routine).
-Set by default if
-SYSTEM5
-is set.
-.ip HASGETDTABLESIZE
-Set this if you have the
-.i getdtablesize (2)
-system call.
-.ip HASWAITPID
-Set this if you have the
-.i haswaitpid (2)
-system call.
-.ip SFS_TYPE
-The mechanism that can be used to get file system capacity information.
-The values can be one of
-SFS_USTAT (use the ustat(2) syscall),
-SFS_4ARGS (use the four argument statfs(2) syscall),
-SFS_VFS (use the two argument statfs(2) syscall including <sys/vfs.h>),
-SFS_MOUNT (use the two argument statfs(2) syscall including <sys/mount.h>),
-SFS_STATFS (use the two argument statfs(2) syscall including <sys/statfs.h>),
-SFS_STATVFS (use the two argument statfs(2) syscall including <sys/statvfs.h>),
-or
-SFS_NONE (no way to get this information).
-.ip LA_TYPE
-The load average type.
-Details are described below.
-.lp
-The are several built-in ways of computing the load average.
-.i Sendmail
-tries to auto-configure them based on imperfect guesses;
-you can select one using the
-.i cc
-option
-.b \-DLA_TYPE= \c
-.i type ,
-where
-.i type
-is:
-.ip LA_INT
-The kernel stores the load average in the kernel as an array of long integers.
-The actual values are scaled by a factor FSCALE
-(default 256).
-.ip LA_SHORT
-The kernel stores the load average in the kernel as an array of short integers.
-The actual values are scaled by a factor FSCALE
-(default 256).
-.ip LA_FLOAT
-The kernel stores the load average in the kernel as an array of
-double precision floats.
-.ip LA_MACH
-Use MACH-style load averages.
-.ip LA_SUBR
-Call the
-.i getloadavg
-routine to get the load average as an array of doubles.
-.ip LA_ZERO
-Always return zero as the load average.
-This is the fallback case.
-.lp
-If type
-.sm LA_INT ,
-.sm LA_SHORT ,
-or
-.sm LA_FLOAT
-is specified,
-you may also need to specify
-.sm _PATH_UNIX
-(the path to your system binary)
-and
-.sm LA_AVENRUN
-(the name of the variable containing the load average in the kernel;
-usually
-.q _avenrun
-or
-.q avenrun ).
-.sh 2 "Configuration in src/conf.c"
-.pp
-The following changes can be made in conf.c.
-.sh 3 "Built-in Header Semantics"
-.pp
-Not all header semantics are defined in the configuration file.
-Header lines that should only be included by certain mailers
-(as well as other more obscure semantics)
-must be specified in the
-.i HdrInfo
-table in
-.i conf.c .
-This table contains the header name
-(which should be in all lower case)
-and a set of header control flags (described below),
-The flags are:
-.ip H_ACHECK
-Normally when the check is made to see if a header line is compatible
-with a mailer,
-.i sendmail
-will not delete an existing line.
-If this flag is set,
-.i sendmail
-will delete
-even existing header lines.
-That is,
-if this bit is set and the mailer does not have flag bits set
-that intersect with the required mailer flags
-in the header definition in
-sendmail.cf,
-the header line is
-.i always
-deleted.
-.ip H_EOH
-If this header field is set,
-treat it like a blank line,
-i.e.,
-it will signal the end of the header
-and the beginning of the message text.
-.ip H_FORCE
-Add this header entry
-even if one existed in the message before.
-If a header entry does not have this bit set,
-.i sendmail
-will not add another header line if a header line
-of this name already existed.
-This would normally be used to stamp the message
-by everyone who handled it.
-.ip H_TRACE
-If set,
-this is a timestamp
-(trace)
-field.
-If the number of trace fields in a message
-exceeds a preset amount
-the message is returned
-on the assumption that it has an aliasing loop.
-.ip H_RCPT
-If set,
-this field contains recipient addresses.
-This is used by the
-.b \-t
-flag to determine who to send to
-when it is collecting recipients from the message.
-.ip H_FROM
-This flag indicates that this field
-specifies a sender.
-The order of these fields in the
-.i HdrInfo
-table specifies
-.i sendmail 's
-preference
-for which field to return error messages to.
-.ip H_ERRORSTO
-Addresses in this header should receive error messages.
-.ip H_CTE
-This header is a Content-Transfer-Encoding header.
-.ip H_CTYPE
-This header is a Content-Type header.
-.ip H_STRIPVAL
-Strip the value from the header (for Bcc:).
-.nr ii 5n
-.lp
-Let's look at a sample
-.i HdrInfo
-specification:
-.(b
-.ta 4n +\w'"content-transfer-encoding", 'u
-struct hdrinfo HdrInfo[] =
-\&{
- /* originator fields, most to least significant */
- "resent-sender", H_FROM,
- "resent-from", H_FROM,
- "sender", H_FROM,
- "from", H_FROM,
- "full-name", H_ACHECK,
- "errors-to", H_FROM\^|\^H_ERRORSTO,
- /* destination fields */
- "to", H_RCPT,
- "resent-to", H_RCPT,
- "cc", H_RCPT,
- "bcc", H_RCPT\^|\^H_STRIPVAL,
- /* message identification and control */
- "message", H_EOH,
- "text", H_EOH,
- /* trace fields */
- "received", H_TRACE\^|\^H_FORCE,
- /* miscellaneous fields */
- "content-transfer-encoding", H_CTE,
- "content-type", H_CTYPE,
-
- NULL, 0,
-};
-.)b
-This structure indicates that the
-.q To: ,
-.q Resent-To: ,
-and
-.q Cc:
-fields
-all specify recipient addresses.
-Any
-.q Full-Name:
-field will be deleted unless the required mailer flag
-(indicated in the configuration file)
-is specified.
-The
-.q Message:
-and
-.q Text:
-fields will terminate the header;
-these are used by random dissenters around the network world.
-The
-.q Received:
-field will always be added,
-and can be used to trace messages.
-.pp
-There are a number of important points here.
-First,
-header fields are not added automatically just because they are in the
-.i HdrInfo
-structure;
-they must be specified in the configuration file
-in order to be added to the message.
-Any header fields mentioned in the configuration file but not
-mentioned in the
-.i HdrInfo
-structure have default processing performed;
-that is,
-they are added unless they were in the message already.
-Second,
-the
-.i HdrInfo
-structure only specifies cliched processing;
-certain headers are processed specially by ad hoc code
-regardless of the status specified in
-.i HdrInfo .
-For example,
-the
-.q Sender:
-and
-.q From:
-fields are always scanned on ARPANET mail
-to determine the sender\**;
-.(f
-\**Actually, this is no longer true in SMTP;
-this information is contained in the envelope.
-The older ARPANET protocols did not completely distinguish
-envelope from header.
-.)f
-this is used to perform the
-.q "return to sender"
-function.
-The
-.q "From:"
-and
-.q "Full-Name:"
-fields are used to determine the full name of the sender
-if possible;
-this is stored in the macro
-.b $x
-and used in a number of ways.
-.sh 3 "Restricting Use of Email"
-.pp
-If it is necessary to restrict mail through a relay,
-the
-.i checkcompat
-routine can be modified.
-This routine is called for every recipient address.
-It returns an exit status
-indicating the status of the message.
-The status
-.sm EX_OK
-accepts the address,
-.sm EX_TEMPFAIL
-queues the message for a later try,
-and other values
-(commonly
-.sm EX_UNAVAILABLE )
-reject the message.
-It is up to
-.i checkcompat
-to print an error message
-(using
-.i usrerr )
-if the message is rejected.
-For example,
-.i checkcompat
-could read:
-.(b
-.re
-.sz -1
-.ta 4n +4n +4n +4n +4n +4n +4n
-int
-checkcompat(to, e)
- register ADDRESS *to;
- register ENVELOPE *e;
-\&{
- register STAB *s;
-
- s = stab("private", ST_MAILER, ST_FIND);
- if (s != NULL && e\->e_from.q_mailer != LocalMailer &&
- to->q_mailer == s->s_mailer)
- {
- usrerr("No private net mail allowed through this machine");
- return (EX_UNAVAILABLE);
- }
- if (MsgSize > 50000 && bitnset(M_LOCALMAILER, to\->q_mailer))
- {
- usrerr("Message too large for non-local delivery");
- e\->e_flags |= EF_NORETURN;
- return (EX_UNAVAILABLE);
- }
- return (EX_OK);
-}
-.sz
-.)b
-This would reject messages greater than 50000 bytes
-unless they were local.
-The
-.i EF_NORETURN
-flag can be set in
-.i e\(->e_flags
-to suppress the return of the actual body
-of the message in the error return.
-The actual use of this routine is highly dependent on the
-implementation,
-and use should be limited.
-.sh 3 "New Database Map Classes"
-.pp
-New key maps can be added by creating a class initialization function
-and a lookup function.
-These are then added to the routine
-.i setupmaps.
-.pp
-The initialization function is called as
-.(b
-\fIxxx\fP_map_init(MAP *map, char *args)
-.)b
-The
-.i map
-is an internal data structure.
-The
-.i args
-is a pointer to the portion of the configuration file line
-following the map class name;
-flags and filenames can be extracted from this line.
-The initialization function must return
-.sm TRUE
-if it successfully opened the map,
-.sm FALSE
-otherwise.
-.pp
-The lookup function is called as
-.(b
-\fIxxx\fP_map_lookup(MAP *map, char buf[], char **av, int *statp)
-.)b
-The
-.i map
-defines the map internally.
-The
-.i buf
-has the input key.
-This may be (and often is) used destructively.
-The
-.i av
-is a list of arguments passed in from the rewrite line.
-The lookup function should return a pointer to the new value.
-If the map lookup fails,
-.i *statp
-should be set to an exit status code;
-in particular, it should be set to
-.sm EX_TEMPFAIL
-if recovery is to be attempted by the higher level code.
-.sh 3 "Queueing Function"
-.pp
-The routine
-.i shouldqueue
-is called to decide if a message should be queued
-or processed immediately.
-Typically this compares the message priority to the current load average.
-The default definition is:
-.(b
-bool
-shouldqueue(pri, ctime)
- long pri;
- time_t ctime;
-{
- if (CurrentLA < QueueLA)
- return (FALSE);
- return (pri > (QueueFactor / (CurrentLA \- QueueLA + 1)));
-}
-.)b
-If the current load average
-(global variable
-.i CurrentLA ,
-which is set before this function is called)
-is less than the low threshold load average
-(option
-.b x ,
-variable
-.i QueueLA ),
-.i shouldqueue
-returns
-.sm FALSE
-immediately
-(that is, it should
-.i not
-queue).
-If the current load average exceeds the high threshold load average
-(option
-.b X ,
-variable
-.i RefuseLA ),
-.i shouldqueue
-returns
-.sm TRUE
-immediately.
-Otherwise, it computes the function based on the message priority,
-the queue factor
-(option
-.b q ,
-global variable
-.i QueueFactor ),
-and the current and threshold load averages.
-.pp
-An implementation wishing to take the actual age of the message into account
-can also use the
-.i ctime
-parameter,
-which is the time that the message was first submitted to
-.i sendmail .
-Note that the
-.i pri
-parameter is already weighted
-by the number of times the message has been tried
-(although this tends to lower the priority of the message with time);
-the expectation is that the
-.i ctime
-would be used as an
-.q "escape clause"
-to ensure that messages are eventually processed.
-.sh 3 "Refusing Incoming SMTP Connections"
-.pp
-The function
-.i refuseconnections
-returns
-.sm TRUE
-if incoming SMTP connections should be refused.
-The current implementation is based exclusively on the current load average
-and the refuse load average option
-(option
-.b X ,
-global variable
-.i RefuseLA ):
-.(b
-bool
-refuseconnections()
-{
- return (CurrentLA >= RefuseLA);
-}
-.)b
-A more clever implementation
-could look at more system resources.
-.sh 3 "Load Average Computation"
-.pp
-The routine
-.i getla
-returns the current load average (as a rounded integer).
-The distribution includes several possible implementations.
-If you are porting to a new environment
-you may need to add some new tweaks.\**
-.(f
-\**If you do, please send updates to
-sendmail@Sendmail.ORG.
-.)f
-.sh 2 "Configuration in src/daemon.c"
-.pp
-The file
-.i src/daemon.c
-contains a number of routines that are dependent
-on the local networking environment.
-The version supplied assumes you have BSD style sockets.
-.pp
-In previous releases,
-we recommended that you modify the routine
-.i maphostname
-if you wanted to generalize
-.b $[
-\&...\&
-.b $]
-lookups.
-We now recommend that you create a new keyed map instead.
-.sh 1 "ACKNOWLEDGEMENTS"
-.pp
-I've worked on
-.i sendmail
-for many years,
-and many employers have been remarkably patient
-about letting me work on a large project
-that was not part of my official job.
-This includes time on the INGRES Project at
-the University of California at Berkeley,
-at Britton Lee,
-and again on the Mammoth and Titan Projects at Berkeley.
-.pp
-Much of the second wave of improvements
-resulting in version 8.1
-should be credited to Bryan Costales of the
-International Computer Science Institute.
-As he passed me drafts of his book on
-.i sendmail
-I was inspired to start working on things again.
-Bryan was also available to bounce ideas off of.
-.pp
-Gregory Neil Shapiro
-of Worchester Polytechnic Institute
-has become instrumental in all phases of
-.i sendmail
-support and development,
-and was largely responsible for getting versions 8.8 and 8.9
-out the door.
-.pp
-Many, many people contributed chunks of code and ideas to
-.i sendmail .
-It has proven to be a group network effort.
-Version 8 in particular was a group project.
-The following people made notable contributions:
-.(l
-John Beck, Hewlett-Packard & Sun Microsystems
-Keith Bostic, CSRG, University of California, Berkeley
-Andrew Cheng, Sun Microsystems
-Michael J. Corrigan, University of California, San Diego
-Bryan Costales, International Computer Science Institute & InfoBeat
-Pa\*:r (Pell) Emanuelsson
-Craig Everhart, Transarc Corporation
-Per Hedeland, Ericsson
-Tom Ivar Helbekkmo, Norwegian School of Economics
-Kari Hurtta, Finnish Meteorological Institute
-Allan E. Johannesen, WPI
-Jonathan Kamens, OpenVision Technologies, Inc.
-Takahiro Kanbe, Fuji Xerox Information Systems Co., Ltd.
-Brian Kantor, University of California, San Diego
-John Kennedy, Cal State University, Chico
-Murray S. Kucherawy, HookUp Communication Corp.
-Bruce Lilly, Sony U.S.
-Karl London
-Motonori Nakamura, Ritsumeikan University & Kyoto University
-John Gardiner Myers, Carnegie Mellon University
-Neil Rickert, Northern Illinois University
-Gregory Neil Shapiro, WPI
-Eric Schnoebelen, Convex Computer Corp.
-Eric Wassenaar, National Institute for Nuclear and High Energy Physics, Amsterdam
-Randall Winchester, University of Maryland
-Christophe Wolfhugel, Pasteur Institute & Herve Schauer Consultants (Paris)
-.)l
-I apologize for anyone I have omitted, misspelled, misattributed, or
-otherwise missed.
-At this point, I suspect that at least a hundred people
-have contributed code,
-and many more have contributed ideas, comments, and encouragement.
-I've tried to list them in the RELEASE_NOTES in the distribution directory.
-I appreciate their contribution as well.
-.pp
-Special thanks are reserved for Michael Corrigan and Christophe Wolfhugel,
-who besides being wonderful guinea pigs and contributors
-have also consented to be added to the ``sendmail@Sendmail.ORG'' list
-and, by answering the bulk of the questions sent to that list,
-have freed me up to do other work.
-.++ A
-.+c "COMMAND LINE FLAGS"
-.ba 0
-.nr ii 1i
-.pp
-Arguments must be presented with flags before addresses.
-The flags are:
-.ip \-b\fIx\fP
-Set operation mode to
-.i x .
-Operation modes are:
-.(b
-.ta 4n
-m Deliver mail (default)
-s Speak SMTP on input side
-a\(dg ``Arpanet'' mode (get envelope sender information from header)
-d Run as a daemon in background
-D Run as a daemon in foreground
-t Run in test mode
-v Just verify addresses, don't collect or deliver
-i Initialize the alias database
-p Print the mail queue
-.)b
-.(f
-\(dgDeprecated.
-.)f
-.ip \-B\fItype\fP
-Indicate body type.
-.ip \-C\fIfile\fP
-Use a different configuration file.
-.i Sendmail
-runs as the invoking user (rather than root)
-when this flag is specified.
-.ip \-d\fIlevel\fP
-Set debugging level.
-.ip "\-f\ \fIaddr\fP"
-The sender's machine address is
-.i addr .
-.ip \-F\ \fIname\fP
-Sets the full name of this user to
-.i name .
-.ip "\-h\ \fIcnt\fP"
-Sets the
-.q "hop count"
-to
-.i cnt .
-This represents the number of times this message has been processed
-by
-.i sendmail
-(to the extent that it is supported by the underlying networks).
-.i Cnt
-is incremented during processing,
-and if it reaches
-MAXHOP
-(currently 30)
-.i sendmail
-throws away the message with an error.
-.ip \-n
-Don't do aliasing or forwarding.
-.ip "\-N \fInotifications\fP"
-Tag all addresses being sent as wanting the indicated
-.i notifications ,
-which consists of the word
-.q NEVER
-or a comma-separated list of
-.q SUCCESS ,
-.q FAILURE ,
-and
-.q DELAY
-for successful delivery,
-failure,
-and a message that is stuck in a queue somewhere.
-The default is
-.q FAILURE,DELAY .
-.ip "\-r\ \fIaddr\fP"
-An obsolete form of
-.b \-f .
-.ip \-o\fIx\|value\fP
-Set option
-.i x
-to the specified
-.i value .
-These options are described in Section 5.6.
-.ip \-O\fIoption\fP\fB=\fP\fIvalue\fP
-Set
-.i option
-to the specified
-.i value
-(for long form option names).
-These options are described in Section 5.6.
-.ip \-M\fIx\|value
-Set macro
-.i x
-to the specified
-.i value .
-.ip \-p\fIprotocol\fP
-Set the sending protocol.
-Programs are encouraged to set this.
-The protocol field can be in the form
-.i protocol \c
-.b : \c
-.i host
-to set both the sending protocol and sending host.
-For example,
-.q \-pUUCP:uunet
-sets the sending protocol to UUCP
-and the sending host to uunet.
-(Some existing programs use \-oM to set the r and s macros;
-this is equivalent to using \-p.)
-.ip \-q\fItime\fP
-Try to process the queued up mail.
-If the time is given,
-a
-.i sendmail
-will run through the queue at the specified interval
-to deliver queued mail;
-otherwise, it only runs once.
-.ip \-q\fIXstring\fP
-Run the queue once,
-limiting the jobs to those matching
-.i Xstring .
-The key letter
-.i X
-can be
-.b I
-to limit based on queue identifier,
-.b R
-to limit based on recipient,
-or
-.b S
-to limit based on sender.
-A particular queued job is accepted if one of the corresponding addresses
-contains the indicated
-.i string .
-Multiple
-.i \-q\fIX\fP
-flags are permitted,
-with items with the same key letter
-.q or'ed
-together, and items with different key letters
-.q and'ed
-together.
-.ip "\-R ret"
-What information you want returned if the message bounces;
-.i ret
-can be
-.q HDRS
-for headers only or
-.q FULL
-for headers plus body.
-This is a request only;
-the other end is not required to honor the parameter.
-.ip \-t
-Read the header for
-.q To: ,
-.q Cc: ,
-and
-.q Bcc:
-lines, and send to everyone listed in those lists.
-The
-.q Bcc:
-line will be deleted before sending.
-Any addresses in the argument vector will be deleted
-from the send list.
-.ip "\-U"
-Indicate that this is an initial User Agent submission.
-In future releases, sendmail may complain about syntactically invalid messages
-rather than fixing them when this flag is not set.
-.ip "\-V envid"
-The indicated
-.i envid
-is passed with the envelope of the message
-and returned if the message bounces.
-.ip "\-X \fIlogfile\fP"
-Log all traffic in and out of
-.i sendmail
-in the indicated
-.i logfile
-for debugging mailer problems.
-This produces a lot of data very quickly and should be used sparingly.
-.pp
-There are a number of options that may be specified as
-primitive flags.
-These are the e, i, m, and v options.
-Also,
-the f option
-may be specified as the
-.b \-s
-flag.
-.+c "QUEUE FILE FORMATS"
-.pp
-This appendix describes the format of the queue files.
-These files live in the directory defined by the
-.b Q
-option in the
-.i sendmail.cf
-file, usually
-.i /var/spool/mqueue
-or
-.i /usr/spool/mqueue .
-.pp
-All queue files have the name
-\fIx\fP\|\fBf\fP\fIAAA99999\fP
-where
-.i AAA99999
-is the
-.i id
-for this message
-and the
-.i x
-is a type.
-The first letter of the id encodes the hour of the day
-that the message was received by the system
-(with A being the hour between midnight and 1:00AM).
-All files with the same id collectively define one message.
-.pp
-The types are:
-.nr ii 0.5i
-.ip d
-The data file.
-The message body (excluding the header) is kept in this file.
-.ip q
-The queue control file.
-This file contains the information necessary to process the job.
-.ip t
-A temporary file.
-These are an image of the
-.b qf
-file when it is being rebuilt.
-It should be renamed to a
-.b qf
-file very quickly.
-.ip x
-A transcript file,
-existing during the life of a session
-showing everything that happens
-during that session.
-.pp
-The
-.b qf
-file is structured as a series of lines
-each beginning with a code letter.
-The lines are as follows:
-.ip V
-The version number of the queue file format,
-used to allow new
-.i sendmail
-binaries to read queue files created by older versions.
-Defaults to version zero.
-Must be the first line of the file if present.
-.ip H
-A header definition.
-There may be any number of these lines.
-The order is important:
-they represent the order in the final message.
-These use the same syntax
-as header definitions in the configuration file.
-.ip C
-The controlling address.
-The syntax is
-.q localuser:aliasname .
-Recipient addresses following this line
-will be flagged so that deliveries will be run as the
-.i localuser
-(a user name from the /etc/passwd file);
-.i aliasname
-is the name of the alias that expanded to this address
-(used for printing messages).
-.ip Q
-The ``original recipient'',
-specified by the ORCPT= field in an ESMTP transaction.
-Used exclusively for Delivery Status Notifications.
-It applies only to the immediately following `R' line.
-.ip R
-A recipient address.
-This will normally be completely aliased,
-but is actually realiased when the job is processed.
-There will be one line
-for each recipient.
-Version 1 qf files
-also include a leading colon-terminated list of flags,
-which can be
-`S' to return a message on successful final delivery,
-`F' to return a message on failure,
-`D' to return a message if the message is delayed,
-`B' to indicate that the body should be returned,
-`N' to suppress returning the body,
-and
-`P' to declare this as a ``primary'' (command line or SMTP-session) address.
-.ip S
-The sender address.
-There may only be one of these lines.
-.ip T
-The job creation time.
-This is used to compute when to time out the job.
-.ip P
-The current message priority.
-This is used to order the queue.
-Higher numbers mean lower priorities.
-The priority changes
-as the message sits in the queue.
-The initial priority depends on the message class
-and the size of the message.
-.ip M
-A message.
-This line is printed by the
-.i mailq
-command,
-and is generally used to store status information.
-It can contain any text.
-.ip F
-Flag bits, represented as one letter per flag.
-Defined flag bits are
-.b r
-indicating that this is a response message
-and
-.b w
-indicating that a warning message has been sent
-announcing that the mail has been delayed.
-.ip N
-The total number of delivery attempts.
-.ip K
-The time (as seconds since January 1, 1970)
-of the last delivery attempt.
-.ip I
-The i-number of the data file;
-this can be used to recover your mail queue
-after a disastrous disk crash.
-.ip $
-A macro definition.
-The values of certain macros
-(as of this writing, only
-.b $r
-and
-.b $s )
-are passed through to the queue run phase.
-.ip B
-The body type.
-The remainder of the line is a text string defining the body type.
-If this field is missing,
-the body type is assumed to be
-.q "undefined"
-and no special processing is attempted.
-Legal values are
-.q 7BIT
-and
-.q 8BITMIME .
-.ip O
-The original MTS value (from the ESMTP transaction).
-For Deliver Status Notifications only.
-.ip Z
-The original envelope id (from the ESMTP transaction).
-For Deliver Status Notifications only.
-.pp
-As an example,
-the following is a queue file sent to
-.q eric@mammoth.Berkeley.EDU
-and
-.q bostic@okeeffe.CS.Berkeley.EDU \**:
-.(f
-\**This example is contrived and probably inaccurate for your environment.
-Glance over it to get an idea;
-nothing can replace looking at what your own system generates.
-.)f
-.(b
-P835771
-T404261372
-Seric
-Ceric:sendmail@vangogh.CS.Berkeley.EDU
-Reric@mammoth.Berkeley.EDU
-Rbostic@okeeffe.CS.Berkeley.EDU
-H?P?Return-path: <owner-sendmail@vangogh.CS.Berkeley.EDU>
-HReceived: by vangogh.CS.Berkeley.EDU (5.108/2.7) id AAA06703;
- Fri, 17 Jul 1992 00:28:55 -0700
-HReceived: from mail.CS.Berkeley.EDU by vangogh.CS.Berkeley.EDU (5.108/2.7)
- id AAA06698; Fri, 17 Jul 1992 00:28:54 -0700
-HReceived: from [128.32.31.21] by mail.CS.Berkeley.EDU (5.96/2.5)
- id AA22777; Fri, 17 Jul 1992 03:29:14 -0400
-HReceived: by foo.bar.baz.de (5.57/Ultrix3.0-C)
- id AA22757; Fri, 17 Jul 1992 09:31:25 GMT
-H?F?From: eric@foo.bar.baz.de (Eric Allman)
-H?x?Full-name: Eric Allman
-HMessage-id: <9207170931.AA22757@foo.bar.baz.de>
-HTo: sendmail@vangogh.CS.Berkeley.EDU
-HSubject: this is an example message
-.)b
-This shows
-the person who sent the message,
-the submission time
-(in seconds since January 1, 1970),
-the message priority,
-the message class,
-the recipients,
-and the headers for the message.
-.+c "SUMMARY OF SUPPORT FILES"
-.pp
-This is a summary of the support files
-that
-.i sendmail
-creates or generates.
-Many of these can be changed by editing the sendmail.cf file;
-check there to find the actual pathnames.
-.nr ii 1i
-.ip "/usr/\*(SD/sendmail"
-The binary of
-.i sendmail .
-.ip /usr/\*(SB/newaliases
-A link to /usr/\*(SD/sendmail;
-causes the alias database to be rebuilt.
-Running this program is completely equivalent to giving
-.i sendmail
-the
-.b \-bi
-flag.
-.ip /usr/\*(SB/mailq
-Prints a listing of the mail queue.
-This program is equivalent to using the
-.b \-bp
-flag to
-.i sendmail .
-.ip /etc/sendmail.cf
-The configuration file,
-in textual form.
-.ip /usr/lib/sendmail.hf
-The SMTP help file.
-.ip /etc/sendmail.st
-A statistics file; need not be present.
-.ip /etc/sendmail.pid
-Created in daemon mode;
-it contains the process id of the current SMTP daemon.
-If you use this in scripts;
-use ``head \-1'' to get just the first line;
-the second line contains the command line used to invoke the daemon,
-and later versions of
-.i sendmail
-may add more information to subsequent lines.
-.ip /etc/aliases
-The textual version of the alias file.
-.ip /etc/aliases.db
-The alias file in
-.i hash \|(3)
-format.
-.ip /etc/aliases.{pag,dir}
-The alias file in
-.i ndbm \|(3)
-format.
-.ip /var/spool/mqueue
-The directory in which the mail queue
-and temporary files reside.
-.ip /var/spool/mqueue/qf*
-Control (queue) files for messages.
-.ip /var/spool/mqueue/df*
-Data files.
-.ip /var/spool/mqueue/tf*
-Temporary versions of the qf files,
-used during queue file rebuild.
-.ip /var/spool/mqueue/xf*
-A transcript of the current session.
-.if o \
-\{\
-. bp
-. rs
-. sp |4i
-. ce 2
-This page intentionally left blank;
-replace it with a blank sheet for double-sided output.
-.\}
-.\".ro
-.\".ls 1
-.\".tp
-.\".sp 2i
-.\".in 0
-.\".ce 100
-.\".sz 24
-.\".b SENDMAIL
-.\".sz 14
-.\".sp
-.\"INSTALLATION AND OPERATION GUIDE
-.\".sp
-.\".sz 10
-.\"Eric Allman
-.\".sp
-.\"Version 8.135
-.\".ce 0
-.bp 3
-.ce
-.sz 12
-TABLE OF CONTENTS
-.sz 10
-.sp
-.\" remove some things to avoid "out of temp file space" problem
-.rm sh
-.rm (x
-.rm )x
-.rm ip
-.rm pp
-.rm lp
-.rm he
-.rm fo
-.rm eh
-.rm oh
-.rm ef
-.rm of
-.xp
-.if o \
-\{\
-. bp
-. rs
-. sp |4i
-. ce 2
-This page intentionally left blank;
-replace it with a blank sheet for double-sided output.
-.\}
+++ /dev/null
-# @(#)Makefile 8.2 (Berkeley) 2/28/1994
-
-SRCS= usenix.me
-MACROS= -me
-
-all: usenix.ps
-
-usenix.ps: ${SRCS}
- rm -f ${.TARGET}
- ${PIC} ${SRCS} | ${ROFF} > ${.TARGET}
-
-.include <bsd.doc.mk>
+++ /dev/null
-.nr si 3n
-.he 'Mail Systems and Addressing in 4.2bsd''%'
-.fo 'Version 8.2'USENIX \- Jan 83'Last Mod 11/27/1993'
-.if n .ls 2
-.+c
-.(l C
-.sz 14
-Mail Systems and Addressing
-in 4.2bsd
-.sz
-.sp
-Eric Allman*
-.sp 0.5
-.i
-Britton-Lee, Inc.
-1919 Addison Street, Suite 105.
-Berkeley, California 94704.
-.sp 0.5
-.r
-eric@Berkeley.ARPA
-ucbvax!eric
-.)l
-.sp
-.(l F
-.ce
-ABSTRACT
-.sp \n(psu
-Routing mail through a heterogeneous internet presents many new
-problems.
-Among the worst of these is that of address mapping.
-Historically, this has been handled on an ad hoc basis.
-However,
-this approach has become unmanageable as internets grow.
-.sp \n(psu
-Sendmail acts a unified
-.q "post office"
-to which all mail can be
-submitted.
-Address interpretation is controlled by a production
-system,
-which can parse both old and new format addresses.
-The
-new format is
-.q "domain-based,"
-a flexible technique that can
-handle many common situations.
-Sendmail is not intended to perform
-user interface functions.
-.sp \n(psu
-Sendmail will replace delivermail in the Berkeley 4.2 distribution.
-Several major hosts are now or will soon be running sendmail.
-This change will affect any users that route mail through a sendmail
-gateway.
-The changes that will be user visible are emphasized.
-.)l
-.sp 2
-.(f
-*A considerable part of this work
-was done while under the employ
-of the INGRES Project
-at the University of California at Berkeley.
-.)f
-.pp
-The mail system to appear in 4.2bsd
-will contain a number of changes.
-Most of these changes are based on the replacement of
-.i delivermail
-with a new module called
-.i sendmail.
-.i Sendmail
-implements a general internetwork mail routing facility,
-featuring aliasing and forwarding,
-automatic routing to network gateways,
-and flexible configuration.
-Of key interest to the mail system user
-will be the changes in the network addressing structure.
-.pp
-In a simple network,
-each node has an address,
-and resources can be identified
-with a host-resource pair;
-in particular,
-the mail system can refer to users
-using a host-username pair.
-Host names and numbers have to be administered by a central authority,
-but usernames can be assigned locally to each host.
-.pp
-In an internet,
-multiple networks with different characteristics
-and managements
-must communicate.
-In particular,
-the syntax and semantics of resource identification change.
-Certain special cases can be handled trivially
-by
-.i "ad hoc"
-techniques,
-such as
-providing network names that appear local to hosts
-on other networks,
-as with the Ethernet at Xerox PARC.
-However, the general case is extremely complex.
-For example,
-some networks require that the route the message takes
-be explicitly specified by the sender,
-simplifying the database update problem
-since only adjacent hosts must be entered
-into the system tables,
-while others use logical addressing,
-where the sender specifies the location of the recipient
-but not how to get there.
-Some networks use a left-associative syntax
-and others use a right-associative syntax,
-causing ambiguity in mixed addresses.
-.pp
-Internet standards seek to eliminate these problems.
-Initially, these proposed expanding the address pairs
-to address triples,
-consisting of
-{network, host, username}
-triples.
-Network numbers must be universally agreed upon,
-and hosts can be assigned locally
-on each network.
-The user-level presentation was changed
-to address domains,
-comprised of a local resource identification
-and a hierarchical domain specification
-with a common static root.
-The domain technique
-separates the issue of physical versus logical addressing.
-For example,
-an address of the form
-.q "eric@a.cc.berkeley.arpa"
-describes the logical
-organization of the address space
-(user
-.q eric
-on host
-.q a
-in the Computer Center
-at Berkeley)
-but not the physical networks used
-(for example, this could go over different networks
-depending on whether
-.q a
-were on an ethernet
-or a store-and-forward network).
-.pp
-.i Sendmail
-is intended to help bridge the gap
-between the totally
-.i "ad hoc"
-world
-of networks that know nothing of each other
-and the clean, tightly-coupled world
-of unique network numbers.
-It can accept old arbitrary address syntaxes,
-resolving ambiguities using heuristics
-specified by the system administrator,
-as well as domain-based addressing.
-It helps guide the conversion of message formats
-between disparate networks.
-In short,
-.i sendmail
-is designed to assist a graceful transition
-to consistent internetwork addressing schemes.
-.sp
-.pp
-Section 1 defines some of the terms
-frequently left fuzzy
-when working in mail systems.
-Section 2 discusses the design goals for
-.i sendmail .
-In section 3,
-the new address formats
-and basic features of
-.i sendmail
-are described.
-Section 4 discusses some of the special problems
-of the UUCP network.
-The differences between
-.i sendmail
-and
-.i delivermail
-are presented in section 5.
-.sp
-.(l F
-.b DISCLAIMER:
-A number of examples
-in this paper
-use names of actual people
-and organizations.
-This is not intended
-to imply a commitment
-or even an intellectual agreement
-on the part of these people or organizations.
-In particular,
-Bell Telephone Laboratories (BTL),
-Digital Equipment Corporation (DEC),
-Lawrence Berkeley Laboratories (LBL),
-Britton-Lee Incorporated (BLI),
-and the University of California at Berkeley
-are not committed to any of these proposals at this time.
-Much of this paper
-represents no more than
-the personal opinions of the author.
-.)l
-.sh 1 "DEFINITIONS"
-.pp
-There are four basic concepts
-that must be clearly distinguished
-when dealing with mail systems:
-the user (or the user's agent),
-the user's identification,
-the user's address,
-and the route.
-These are distinguished primarily by their position independence.
-.sh 2 "User and Identification"
-.pp
-The user is the being
-(a person or program)
-that is creating or receiving a message.
-An
-.i agent
-is an entity operating on behalf of the user \*-
-such as a secretary who handles my mail.
-or a program that automatically returns a
-message such as
-.q "I am at the UNICOM conference."
-.pp
-The identification is the tag
-that goes along with the particular user.
-This tag is completely independent of location.
-For example,
-my identification is the string
-.q "Eric Allman,"
-and this identification does not change
-whether I am located at U.C. Berkeley,
-at Britton-Lee,
-or at a scientific institute in Austria.
-.pp
-Since the identification is frequently ambiguous
-(e.g., there are two
-.q "Robert Henry" s
-at Berkeley)
-it is common to add other disambiguating information
-that is not strictly part of the identification
-(e.g.,
-Robert
-.q "Code Generator"
-Henry
-versus
-Robert
-.q "System Administrator"
-Henry).
-.sh 2 "Address"
-.pp
-The address specifies a location.
-As I move around,
-my address changes.
-For example,
-my address might change from
-.q eric@Berkeley.ARPA
-to
-.q eric@bli.UUCP
-or
-.q allman@IIASA.Austria
-depending on my current affiliation.
-.pp
-However,
-an address is independent of the location of anyone else.
-That is,
-my address remains the same to everyone who might be sending me mail.
-For example,
-a person at MIT and a person at USC
-could both send to
-.q eric@Berkeley.ARPA
-and have it arrive to the same mailbox.
-.pp
-Ideally a
-.q "white pages"
-service would be provided to map user identifications
-into addresses
-(for example, see
-[Solomon81]).
-Currently this is handled by passing around
-scraps of paper
-or by calling people on the telephone
-to find out their address.
-.sh 2 "Route"
-.pp
-While an address specifies
-.i where
-to find a mailbox,
-a route specifies
-.i how
-to find the mailbox.
-Specifically,
-it specifies a path
-from sender to receiver.
-As such, the route is potentially different
-for every pair of people in the electronic universe.
-.pp
-Normally the route is hidden from the user
-by the software.
-However,
-some networks put the burden of determining the route
-onto the sender.
-Although this simplifies the software,
-it also greatly impairs the usability
-for most users.
-The UUCP network is an example of such a network.
-.sh 1 "DESIGN GOALS"
-.pp
-Design goals for
-.i sendmail \**
-.(f
-\**This section makes no distinction between
-.i delivermail
-and
-.i sendmail.
-.)f
-include:
-.np
-Compatibility with the existing mail programs,
-including Bell version 6 mail,
-Bell version 7 mail,
-Berkeley
-.i Mail
-[Shoens79],
-BerkNet mail
-[Schmidt79],
-and hopefully UUCP mail
-[Nowitz78].
-ARPANET mail
-[Crocker82]
-was also required.
-.np
-Reliability, in the sense of guaranteeing
-that every message is correctly delivered
-or at least brought to the attention of a human
-for correct disposal;
-no message should ever be completely lost.
-This goal was considered essential
-because of the emphasis on mail in our environment.
-It has turned out to be one of the hardest goals to satisfy,
-especially in the face of the many anomalous message formats
-produced by various ARPANET sites.
-For example,
-certain sites generate improperly formated addresses,
-occasionally
-causing error-message loops.
-Some hosts use blanks in names,
-causing problems with
-mail programs that assume that an address
-is one word.
-The semantics of some fields
-are interpreted slightly differently
-by different sites.
-In summary,
-the obscure features of the ARPANET mail protocol
-really
-.i are
-used and
-are difficult to support,
-but must be supported.
-.np
-Existing software to do actual delivery
-should be used whenever possible.
-This goal derives as much from political and practical considerations
-as technical.
-.np
-Easy expansion to
-fairly complex environments,
-including multiple
-connections to a single network type
-(such as with multiple UUCP or Ethernets).
-This goal requires consideration of the contents of an address
-as well as its syntax
-in order to determine which gateway to use.
-.np
-Configuration information should not be compiled into the code.
-A single compiled program should be able to run as is at any site
-(barring such basic changes as the CPU type or the operating system).
-We have found this seemingly unimportant goal
-to be critical in real life.
-Besides the simple problems that occur when any program gets recompiled
-in a different environment,
-many sites like to
-.q fiddle
-with anything that they will be recompiling anyway.
-.np
-.i Sendmail
-must be able to let various groups maintain their own mailing lists,
-and let individuals specify their own forwarding,
-without modifying the system alias file.
-.np
-Each user should be able to specify which mailer to execute
-to process mail being delivered for him.
-This feature allows users who are using specialized mailers
-that use a different format to build their environment
-without changing the system,
-and facilitates specialized functions
-(such as returning an
-.q "I am on vacation"
-message).
-.np
-Network traffic should be minimized
-by batching addresses to a single host where possible,
-without assistance from the user.
-.pp
-These goals motivated the architecture illustrated in figure 1.
-.(z
-.hl
-.ie t \
-. sp 18
-.el \{\
-.(c
-+---------+ +---------+ +---------+
-| sender1 | | sender2 | | sender3 |
-+---------+ +---------+ +---------+
- | | |
- +----------+ + +----------+
- | | |
- v v v
- +-------------+
- | sendmail |
- +-------------+
- | | |
- +----------+ + +----------+
- | | |
- v v v
-+---------+ +---------+ +---------+
-| mailer1 | | mailer2 | | mailer3 |
-+---------+ +---------+ +---------+
-.)c
-.\}
-
-.ce
-Figure 1 \*- Sendmail System Structure.
-.hl
-.)z
-The user interacts with a mail generating and sending program.
-When the mail is created,
-the generator calls
-.i sendmail ,
-which routes the message to the correct mailer(s).
-Since some of the senders may be network servers
-and some of the mailers may be network clients,
-.i sendmail
-may be used as an internet mail gateway.
-.sh 1 "USAGE"
-.sh 2 "Address Formats"
-.pp
-Arguments may be flags or addresses.
-Flags set various processing options.
-Following flag arguments,
-address arguments may be given.
-Addresses follow the syntax in RFC822
-[Crocker82]
-for ARPANET
-address formats.
-In brief, the format is:
-.np
-Anything in parentheses is thrown away
-(as a comment).
-.np
-Anything in angle brackets (\c
-.q "<\|>" )
-is preferred
-over anything else.
-This rule implements the ARPANET standard that addresses of the form
-.(b
-user name <machine-address>
-.)b
-will send to the electronic
-.q machine-address
-rather than the human
-.q "user name."
-.np
-Double quotes
-(\ "\ )
-quote phrases;
-backslashes quote characters.
-Backslashes are more powerful
-in that they will cause otherwise equivalent phrases
-to compare differently \*- for example,
-.i user
-and
-.i
-"user"
-.r
-are equivalent,
-but
-.i \euser
-is different from either of them.
-This might be used
-to avoid normal aliasing
-or duplicate suppression algorithms.
-.pp
-Parentheses, angle brackets, and double quotes
-must be properly balanced and nested.
-The rewriting rules control remaining parsing\**.
-.(f
-\**Disclaimer: Some special processing is done
-after rewriting local names; see below.
-.)f
-.pp
-Although old style addresses are still accepted
-in most cases,
-the preferred address format
-is based on ARPANET-style domain-based addresses
-[Su82a].
-These addresses are based on a hierarchical, logical decomposition
-of the address space.
-The addresses are hierarchical in a sense
-similar to the U.S. postal addresses:
-the messages may first be routed to the correct state,
-with no initial consideration of the city
-or other addressing details.
-The addresses are logical
-in that each step in the hierarchy
-corresponds to a set of
-.q "naming authorities"
-rather than a physical network.
-.pp
-For example,
-the address:
-.(l
-eric@HostA.BigSite.ARPA
-.)l
-would first look up the domain
-BigSite
-in the namespace administrated by
-ARPA.
-A query could then be sent to
-BigSite
-for interpretation of
-HostA.
-Eventually the mail would arrive at
-HostA,
-which would then do final delivery
-to user
-.q eric.
-.sh 2 "Mail to Files and Programs"
-.pp
-Files and programs are legitimate message recipients.
-Files provide archival storage of messages,
-useful for project administration and history.
-Programs are useful as recipients in a variety of situations,
-for example,
-to maintain a public repository of systems messages
-(such as the Berkeley
-.i msgs
-program).
-.pp
-Any address passing through the initial parsing algorithm
-as a local address
-(i.e, not appearing to be a valid address for another mailer)
-is scanned for two special cases.
-If prefixed by a vertical bar (\c
-.q \^|\^ )
-the rest of the address is processed as a shell command.
-If the user name begins with a slash mark (\c
-.q /\^ )
-the name is used as a file name,
-instead of a login name.
-.sh 2 "Aliasing, Forwarding, Inclusion"
-.pp
-.i Sendmail
-reroutes mail three ways.
-Aliasing applies system wide.
-Forwarding allows each user to reroute incoming mail
-destined for that account.
-Inclusion directs
-.i sendmail
-to read a file for a list of addresses,
-and is normally used
-in conjunction with aliasing.
-.sh 3 "Aliasing"
-.pp
-Aliasing maps local addresses to address lists using a system-wide file.
-This file is hashed to speed access.
-Only addresses that parse as local
-are allowed as aliases;
-this guarantees a unique key
-(since there are no nicknames for the local host).
-.sh 3 "Forwarding"
-.pp
-After aliasing,
-if an recipient address specifies a local user
-.i sendmail
-searches for a
-.q .forward
-file in the recipient's home directory.
-If it exists,
-the message is
-.i not
-sent to that user,
-but rather to the list of addresses in that file.
-Often
-this list will contain only one address,
-and the feature will be used for network mail forwarding.
-.pp
-Forwarding also permits a user to specify a private incoming mailer.
-For example,
-forwarding to:
-.(b
-"\^|\|/usr/local/newmail myname"
-.)b
-will use a different incoming mailer.
-.sh 3 "Inclusion"
-.pp
-Inclusion is specified in RFC 733 [Crocker77] syntax:
-.(b
-:Include: pathname
-.)b
-An address of this form reads the file specified by
-.i pathname
-and sends to all users listed in that file.
-.pp
-The intent is
-.i not
-to support direct use of this feature,
-but rather to use this as a subset of aliasing.
-For example,
-an alias of the form:
-.(b
-project: :include:/usr/project/userlist
-.)b
-is a method of letting a project maintain a mailing list
-without interaction with the system administration,
-even if the alias file is protected.
-.pp
-It is not necessary to rebuild the index on the alias database
-when a :include: list is changed.
-.sh 2 "Message Collection"
-.pp
-Once all recipient addresses are parsed and verified,
-the message is collected.
-The message comes in two parts:
-a message header and a message body,
-separated by a blank line.
-The body is an uninterpreted
-sequence of text lines.
-.pp
-The header is formated as a series of lines
-of the form
-.(b
- field-name: field-value
-.)b
-Field-value can be split across lines by starting the following
-lines with a space or a tab.
-Some header fields have special internal meaning,
-and have appropriate special processing.
-Other headers are simply passed through.
-Some header fields may be added automatically,
-such as time stamps.
-.sh 1 "THE UUCP PROBLEM"
-.pp
-Of particular interest
-is the UUCP network.
-The explicit routing
-used in the UUCP environment
-causes a number of serious problems.
-First,
-giving out an address
-is impossible
-without knowing the address of your potential correspondent.
-This is typically handled
-by specifying the address
-relative to some
-.q "well-known"
-host
-(e.g.,
-ucbvax or decvax).
-Second,
-it is often difficult to compute
-the set of addresses
-to reply to
-without some knowledge
-of the topology of the network.
-Although it may be easy for a human being
-to do this
-under many circumstances,
-a program does not have equally sophisticated heuristics
-built in.
-Third,
-certain addresses will become painfully and unnecessarily long,
-as when a message is routed through many hosts in the USENET.
-And finally,
-certain
-.q "mixed domain"
-addresses
-are impossible to parse unambiguously \*-
-e.g.,
-.(l
-decvax!ucbvax!lbl-h!user@LBL-CSAM
-.)l
-might have many possible resolutions,
-depending on whether the message was first routed
-to decvax
-or to LBL-CSAM.
-.pp
-To solve this problem,
-the UUCP syntax
-would have to be changed to use addresses
-rather than routes.
-For example,
-the address
-.q decvax!ucbvax!eric
-might be expressed as
-.q eric@ucbvax.UUCP
-(with the hop through decvax implied).
-This address would itself be a domain-based address;
-for example,
-an address might be of the form:
-.(l
-mark@d.cbosg.btl.UUCP
-.)l
-Hosts outside of Bell Telephone Laboratories
-would then only need to know
-how to get to a designated BTL relay,
-and the BTL topology
-would only be maintained inside Bell.
-.pp
-There are three major problems
-associated with turning UUCP addresses
-into something reasonable:
-defining the namespace,
-creating and propagating the necessary software,
-and building and maintaining the database.
-.sh 2 "Defining the Namespace"
-.pp
-Putting all UUCP hosts into a flat namespace
-(e.g.,
-.q \&...@host.UUCP )
-is not practical for a number of reasons.
-First,
-with over 1600 sites already,
-and (with the increasing availability of inexpensive microcomputers
-and autodialers)
-several thousand more coming within a few years,
-the database update problem
-is simply intractable
-if the namespace is flat.
-Second,
-there are almost certainly name conflicts today.
-Third,
-as the number of sites grow
-the names become ever less mnemonic.
-.pp
-It seems inevitable
-that there be some sort of naming authority
-for the set of top level names
-in the UUCP domain,
-as unpleasant a possibility
-as that may seem.
-It will simply not be possible
-to have one host resolving all names.
-It may however be possible
-to handle this
-in a fashion similar to that of assigning names of newsgroups
-in USENET.
-However,
-it will be essential to encourage everyone
-to become subdomains of an existing domain
-whenever possible \*-
-even though this will certainly bruise some egos.
-For example,
-if a new host named
-.q blid
-were to be added to the UUCP network,
-it would probably actually be addressed as
-.q d.bli.UUCP
-(i.e.,
-as host
-.q d
-in the pseudo-domain
-.q bli
-rather than as host
-.q blid
-in the UUCP domain).
-.sh 2 "Creating and Propagating the Software"
-.pp
-The software required to implement a consistent namespace
-is relatively trivial.
-Two modules are needed,
-one to handle incoming mail
-and one to handle outgoing mail.
-.pp
-The incoming module
-must be prepared to handle either old or new style addresses.
-New-style addresses
-can be passed through unchanged.
-Old style addresses
-must be turned into new style addresses
-where possible.
-.pp
-The outgoing module
-is slightly trickier.
-It must do a database lookup on the recipient addresses
-(passed on the command line)
-to determine what hosts to send the message to.
-If those hosts do not accept new-style addresses,
-it must transform all addresses in the header of the message
-into old style using the database lookup.
-.pp
-Both of these modules
-are straightforward
-except for the issue of modifying the header.
-It seems prudent to choose one format
-for the message headers.
-For a number of reasons,
-Berkeley has elected to use the ARPANET protocols
-for message formats.
-However,
-this protocol is somewhat difficult to parse.
-.pp
-Propagation is somewhat more difficult.
-There are a large number of hosts
-connected to UUCP
-that will want to run completely standard systems
-(for very good reasons).
-The strategy is not to convert the entire network \*-
-only enough of it it alleviate the problem.
-.sh 2 "Building and Maintaining the Database"
-.pp
-This is by far the most difficult problem.
-A prototype for this database
-already exists,
-but it is maintained by hand
-and does not pretend to be complete.
-.pp
-This problem will be reduced considerably
-if people choose to group their hosts
-into subdomains.
-This would require a global update
-only when a new top level domain
-joined the network.
-A message to a host in a subdomain
-could simply be routed to a known domain gateway
-for further processing.
-For example,
-the address
-.q eric@a.bli.UUCP
-might be routed to the
-.q bli
-gateway
-for redistribution;
-new hosts could be added
-within BLI
-without notifying the rest of the world.
-Of course,
-other hosts
-.i could
-be notified as an efficiency measure.
-.pp
-There may be more than one domain gateway.
-A domain such as BTL,
-for instance,
-might have a dozen gateways to the outside world;
-a non-BTL site
-could choose the closest gateway.
-The only restriction
-would be that all gateways
-maintain a consistent view of the domain
-they represent.
-.sh 2 "Logical Structure"
-.pp
-Logically,
-domains are organized into a tree.
-There need not be a host actually associated
-with each level in the tree \*-
-for example,
-there will be no host associated with the name
-.q UUCP.
-Similarly,
-an organization might group names together for administrative reasons;
-for example,
-the name
-.(l
-CAD.research.BigCorp.UUCP
-.)l
-might not actually have a host representing
-.q research.
-.pp
-However,
-it may frequently be convenient to have a host
-or hosts
-that
-.q represent
-a domain.
-For example,
-if a single host exists that
-represents
-Berkeley,
-then mail from outside Berkeley
-can forward mail to that host
-for further resolution
-without knowing Berkeley's
-(rather volatile)
-topology.
-This is not unlike the operation
-of the telephone network.
-.pp
-This may also be useful
-inside certain large domains.
-For example,
-at Berkeley it may be presumed
-that most hosts know about other hosts
-inside the Berkeley domain.
-But if they process an address
-that is unknown,
-they can pass it
-.q upstairs
-for further examination.
-Thus as new hosts are added
-only one host
-(the domain master)
-.i must
-be updated immediately;
-other hosts can be updated as convenient.
-.pp
-Ideally this name resolution process
-would be performed by a name server
-(e.g., [Su82b])
-to avoid unnecessary copying
-of the message.
-However,
-in a batch network
-such as UUCP
-this could result in unnecessary delays.
-.sh 1 "COMPARISON WITH DELIVERMAIL"
-.pp
-.i Sendmail
-is an outgrowth of
-.i delivermail .
-The primary differences are:
-.np
-Configuration information is not compiled in.
-This change simplifies many of the problems
-of moving to other machines.
-It also allows easy debugging of new mailers.
-.np
-Address parsing is more flexible.
-For example,
-.i delivermail
-only supported one gateway to any network,
-whereas
-.i sendmail
-can be sensitive to host names
-and reroute to different gateways.
-.np
-Forwarding and
-:include:
-features eliminate the requirement that the system alias file
-be writable by any user
-(or that an update program be written,
-or that the system administration make all changes).
-.np
-.i Sendmail
-supports message batching across networks
-when a message is being sent to multiple recipients.
-.np
-A mail queue is provided in
-.i sendmail.
-Mail that cannot be delivered immediately
-but can potentially be delivered later
-is stored in this queue for a later retry.
-The queue also provides a buffer against system crashes;
-after the message has been collected
-it may be reliably redelivered
-even if the system crashes during the initial delivery.
-.np
-.i Sendmail
-uses the networking support provided by 4.2BSD
-to provide a direct interface networks such as the ARPANET
-and/or Ethernet
-using SMTP (the Simple Mail Transfer Protocol)
-over a TCP/IP connection.
-.+c
-.ce
-REFERENCES
-.nr ii 1.5i
-.ip [Crocker77]
-Crocker, D. H.,
-Vittal, J. J.,
-Pogran, K. T.,
-and
-Henderson, D. A. Jr.,
-.ul
-Standard for the Format of ARPA Network Text Messages.
-RFC 733,
-NIC 41952.
-In [Feinler78].
-November 1977.
-.ip [Crocker82]
-Crocker, D. H.,
-.ul
-Standard for the Format of Arpa Internet Text Messages.
-RFC 822.
-Network Information Center,
-SRI International,
-Menlo Park, California.
-August 1982.
-.ip [Feinler78]
-Feinler, E.,
-and
-Postel, J.
-(eds.),
-.ul
-ARPANET Protocol Handbook.
-NIC 7104,
-Network Information Center,
-SRI International,
-Menlo Park, California.
-1978.
-.ip [Nowitz78]
-Nowitz, D. A.,
-and
-Lesk, M. E.,
-.ul
-A Dial-Up Network of UNIX Systems.
-Bell Laboratories.
-In
-UNIX Programmer's Manual, Seventh Edition,
-Volume 2.
-August, 1978.
-.ip [Schmidt79]
-Schmidt, E.,
-.ul
-An Introduction to the Berkeley Network.
-University of California, Berkeley California.
-1979.
-.ip [Shoens79]
-Shoens, K.,
-.ul
-Mail Reference Manual.
-University of California, Berkeley.
-In UNIX Programmer's Manual,
-Seventh Edition,
-Volume 2C.
-December 1979.
-.ip [Solomon81]
-Solomon, M.,
-Landweber, L.,
-and
-Neuhengen, D.,
-.ul
-The Design of the CSNET Name Server.
-CS-DN-2.
-University of Wisconsin,
-Madison.
-October 1981.
-.ip [Su82a]
-Su, Zaw-Sing,
-and
-Postel, Jon,
-.ul
-The Domain Naming Convention for Internet User Applications.
-RFC819.
-Network Information Center,
-SRI International,
-Menlo Park, California.
-August 1982.
-.ip [Su82b]
-Su, Zaw-Sing,
-.ul
-A Distributed System for Internet Name Service.
-RFC830.
-Network Information Center,
-SRI International,
-Menlo Park, California.
-October 1982.
+++ /dev/null
-%!PS-Adobe-3.0
-%%Creator: groff version 1.10
-%%CreationDate: Tue Dec 29 09:59:22 1998
-%%DocumentNeededResources: font Times-Roman
-%%+ font Times-Italic
-%%+ font Times-Bold
-%%DocumentSuppliedResources: procset grops 1.10 0
-%%Pages: 9
-%%PageOrder: Ascend
-%%Orientation: Portrait
-%%EndComments
-%%BeginProlog
-%%BeginResource: procset grops 1.10 0
-/setpacking where{
-pop
-currentpacking
-true setpacking
-}if
-/grops 120 dict dup begin
-/SC 32 def
-/A/show load def
-/B{0 SC 3 -1 roll widthshow}bind def
-/C{0 exch ashow}bind def
-/D{0 exch 0 SC 5 2 roll awidthshow}bind def
-/E{0 rmoveto show}bind def
-/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def
-/G{0 rmoveto 0 exch ashow}bind def
-/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/I{0 exch rmoveto show}bind def
-/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def
-/K{0 exch rmoveto 0 exch ashow}bind def
-/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/M{rmoveto show}bind def
-/N{rmoveto 0 SC 3 -1 roll widthshow}bind def
-/O{rmoveto 0 exch ashow}bind def
-/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/Q{moveto show}bind def
-/R{moveto 0 SC 3 -1 roll widthshow}bind def
-/S{moveto 0 exch ashow}bind def
-/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def
-/SF{
-findfont exch
-[exch dup 0 exch 0 exch neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/MF{
-findfont
-[5 2 roll
-0 3 1 roll
-neg 0 0]makefont
-dup setfont
-[exch/setfont cvx]cvx bind def
-}bind def
-/level0 0 def
-/RES 0 def
-/PL 0 def
-/LS 0 def
-/MANUAL{
-statusdict begin/manualfeed true store end
-}bind def
-/PLG{
-gsave newpath clippath pathbbox grestore
-exch pop add exch pop
-}bind def
-/BP{
-/level0 save def
-1 setlinecap
-1 setlinejoin
-72 RES div dup scale
-LS{
-90 rotate
-}{
-0 PL translate
-}ifelse
-1 -1 scale
-}bind def
-/EP{
-level0 restore
-showpage
-}bind def
-/DA{
-newpath arcn stroke
-}bind def
-/SN{
-transform
-.25 sub exch .25 sub exch
-round .25 add exch round .25 add exch
-itransform
-}bind def
-/DL{
-SN
-moveto
-SN
-lineto stroke
-}bind def
-/DC{
-newpath 0 360 arc closepath
-}bind def
-/TM matrix def
-/DE{
-TM currentmatrix pop
-translate scale newpath 0 0 .5 0 360 arc closepath
-TM setmatrix
-}bind def
-/RC/rcurveto load def
-/RL/rlineto load def
-/ST/stroke load def
-/MT/moveto load def
-/CL/closepath load def
-/FL{
-currentgray exch setgray fill setgray
-}bind def
-/BL/fill load def
-/LW/setlinewidth load def
-/RE{
-findfont
-dup maxlength 1 index/FontName known not{1 add}if dict begin
-{
-1 index/FID ne{def}{pop pop}ifelse
-}forall
-/Encoding exch def
-dup/FontName exch def
-currentdict end definefont pop
-}bind def
-/DEFS 0 def
-/EBEGIN{
-moveto
-DEFS begin
-}bind def
-/EEND/end load def
-/CNT 0 def
-/level1 0 def
-/PBEGIN{
-/level1 save def
-translate
-div 3 1 roll div exch scale
-neg exch neg exch translate
-0 setgray
-0 setlinecap
-1 setlinewidth
-0 setlinejoin
-10 setmiterlimit
-[]0 setdash
-/setstrokeadjust where{
-pop
-false setstrokeadjust
-}if
-/setoverprint where{
-pop
-false setoverprint
-}if
-newpath
-/CNT countdictstack def
-userdict begin
-/showpage{}def
-}bind def
-/PEND{
-clear
-countdictstack CNT sub{end}repeat
-level1 restore
-}bind def
-end def
-/setpacking where{
-pop
-setpacking
-}if
-%%EndResource
-%%IncludeResource: font Times-Roman
-%%IncludeResource: font Times-Italic
-%%IncludeResource: font Times-Bold
-grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72
-def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron
-/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef
-/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent
-/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen
-/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon
-/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O
-/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex
-/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y
-/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft
-/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl
-/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut
-/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash
-/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen
-/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft
-/logicalnot/minus/registered/macron/degree/plusminus/twosuperior
-/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior
-/ordmasculine/guilsinglright/onequarter/onehalf/threequarters
-/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE
-/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex
-/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis
-/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn
-/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla
-/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis
-/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash
-/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def
-/Times-Bold@0 ENC0/Times-Bold RE/Times-Italic@0 ENC0/Times-Italic RE
-/Times-Roman@0 ENC0/Times-Roman RE
-%%EndProlog
-%%Page: 1 1
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 14/Times-Roman@0 SF(Mail Systems and Addressing)204.196 141 Q
-(in 4.2bsd)262.331 157.8 Q/F1 10/Times-Roman@0 SF(Eric Allman*)260.92
-181.8 Q/F2 10/Times-Italic@0 SF(Britton-Lee)254.86 199.8 Q 2.5(,I)-.1 G
-(nc.)-2.5 E(1919 Addison Str)225.13 211.8 Q(eet, Suite 105.)-.37 E(Berk)
-232.645 223.8 Q(ele)-.1 E 1.1 -.55(y, C)-.3 H(alifornia 94704.).55 E F1
-(eric@Berk)244.175 241.8 Q(ele)-.1 E -.65(y.)-.15 G(ARP).65 E(A)-.92 E
-(ucb)264.6 253.8 Q -.25(va)-.15 G(x!eric).25 E(ABSTRA)262.085 286.2 Q
-(CT)-.4 E .966
-(Routing mail through a heterogeneous internet presents man)112 302.4 R
-3.466(yn)-.15 G 1.466 -.25(ew p)-3.466 H 3.466(roblems. Among).25 F .297
-(the w)112 314.4 R .297(orst of these is that of address mapping.)-.1 F
-(Historically)5.297 E 2.797(,t)-.65 G .298(his has been handled on an)
--2.797 F(ad hoc basis.)112 326.4 Q(Ho)5 E(we)-.25 E -.15(ve)-.25 G .8
--.4(r, t).15 H(his approach has become unmanageable as internets gro).4
-E -.65(w.)-.25 G .099(Sendmail acts a uni\214ed \231post of)112 342.6 R
-.098(\214ce\232 to which all mail can be submitted.)-.25 F .098
-(Address inter)5.098 F(-)-.2 E .754(pretation is controlled by a production system, which can parse both old and ne)
-112 354.6 R 3.255(wf)-.25 G(or)-3.255 E(-)-.2 E .242(mat addresses.)112
-366.6 R .242(The ne)5.242 F 2.742(wf)-.25 G .242
-(ormat is \231domain-based,)-2.742 F 2.742<9a618d>-.7 G -.15(ex)-2.742 G
-.241(ible technique that can handle).15 F(man)112 378.6 Q 2.606(yc)-.15
-G .106(ommon situations.)-2.606 F .106
-(Sendmail is not intended to perform user interf)5.106 F .107
-(ace functions.)-.1 F .399(Sendmail will replace deli)112 394.8 R -.15
-(ve)-.25 G .399(rmail in the Berk).15 F(ele)-.1 E 2.899(y4)-.15 G .399
-(.2 distrib)-2.899 F 2.899(ution. Se)-.2 F -.15(ve)-.25 G .399
-(ral major hosts).15 F .421(are no)112 406.8 R 2.921(wo)-.25 G 2.921(rw)
--2.921 G .421(ill soon be running sendmail.)-2.921 F .421
-(This change will af)5.421 F .422(fect an)-.25 F 2.922(yu)-.15 G .422
-(sers that route)-2.922 F 1.5(mail through a sendmail g)112 418.8 R(ate)
--.05 E -.1(wa)-.25 G 5.3 -.65(y. T).1 H 1.5
-(he changes that will be user visible are empha-).65 F(sized.)112 430.8
-Q .906
-(The mail system to appear in 4.2bsd will contain a number of changes.)
-97 475.2 R .906(Most of these changes are)5.906 F .469
-(based on the replacement of)72 487.2 R F2(delivermail)2.969 E F1 .469
-(with a ne)2.969 F 2.969(wm)-.25 G .469(odule called)-2.969 F F2 2.97
-(sendmail. Sendmail)2.97 F F1 .47(implements a gen-)2.97 F 1.834
-(eral internetw)72 499.2 R 1.834(ork mail routing f)-.1 F(acility)-.1 E
-4.333(,f)-.65 G 1.833(eaturing aliasing and forw)-4.333 F 1.833
-(arding, automatic routing to netw)-.1 F(ork)-.1 E -.05(ga)72 511.2 S
-(te).05 E -.1(wa)-.25 G .205(ys, and \215e).1 F .205
-(xible con\214guration.)-.15 F .205(Of k)5.205 F .505 -.15(ey i)-.1 H
-.205(nterest to the mail system user will be the changes in the net-).15
-F -.1(wo)72 523.2 S(rk addressing structure.).1 E .624(In a simple netw)
-97 539.4 R .624(ork, each node has an address, and resources can be identi\214ed with a host-resource)
--.1 F .374(pair; in particular)72 551.4 R 2.874(,t)-.4 G .374
-(he mail system can refer to users using a host-username pair)-2.874 F
-5.374(.H)-.55 G .375(ost names and numbers)-5.374 F(ha)72 563.4 Q .3
--.15(ve t)-.2 H 2.5(ob).15 G 2.5(ea)-2.5 G
-(dministered by a central authority)-2.5 E 2.5(,b)-.65 G
-(ut usernames can be assigned locally to each host.)-2.7 E .397
-(In an internet, multiple netw)97 579.6 R .396(orks with dif)-.1 F .396
-(ferent characteristics and managements must communicate.)-.25 F .389
-(In particular)72 591.6 R 2.889(,t)-.4 G .389
-(he syntax and semantics of resource identi\214cation change.)-2.889 F
-.39(Certain special cases can be han-)5.389 F 1.033(dled tri)72 603.6 R
-1.033(vially by)-.25 F F2 1.033(ad hoc)3.533 F F1 1.032
-(techniques, such as pro)3.533 F 1.032(viding netw)-.15 F 1.032
-(ork names that appear local to hosts on other)-.1 F(netw)72 615.6 Q
-1.621(orks, as with the Ethernet at Xerox P)-.1 F 4.121(ARC. Ho)-.92 F
-(we)-.25 E -.15(ve)-.25 G 2.421 -.4(r, t).15 H 1.622
-(he general case is e).4 F 1.622(xtremely comple)-.15 F 4.122(x. F)-.15
-F(or)-.15 E -.15(ex)72 627.6 S .29(ample, some netw).15 F .29
-(orks require that the route the message tak)-.1 F .29(es be e)-.1 F .29
-(xplicitly speci\214ed by the sender)-.15 F 2.79(,s)-.4 G(im-)-2.79 E
-1.618(plifying the database update problem since only adjacent hosts must be entered into the system tables,)
-72 639.6 R .573(while others use logical addressing, where the sender speci\214es the location of the recipient b)
-72 651.6 R .573(ut not ho)-.2 F 3.072(wt)-.25 G(o)-3.072 E 1.065
-(get there.)72 663.6 R 1.065(Some netw)6.065 F 1.066
-(orks use a left-associati)-.1 F 1.366 -.15(ve s)-.25 H 1.066
-(yntax and others use a right-associati).15 F 1.366 -.15(ve s)-.25 H
-1.066(yntax, causing).15 F .32 LW 76 673.2 72 673.2 DL 80 673.2 76 673.2
-DL 84 673.2 80 673.2 DL 88 673.2 84 673.2 DL 92 673.2 88 673.2 DL 96
-673.2 92 673.2 DL 100 673.2 96 673.2 DL 104 673.2 100 673.2 DL 108 673.2
-104 673.2 DL 112 673.2 108 673.2 DL 116 673.2 112 673.2 DL 120 673.2 116
-673.2 DL 124 673.2 120 673.2 DL 128 673.2 124 673.2 DL 132 673.2 128
-673.2 DL 136 673.2 132 673.2 DL 140 673.2 136 673.2 DL 144 673.2 140
-673.2 DL 148 673.2 144 673.2 DL 152 673.2 148 673.2 DL 156 673.2 152
-673.2 DL 160 673.2 156 673.2 DL 164 673.2 160 673.2 DL 168 673.2 164
-673.2 DL 172 673.2 168 673.2 DL 176 673.2 172 673.2 DL 180 673.2 176
-673.2 DL 184 673.2 180 673.2 DL 188 673.2 184 673.2 DL 192 673.2 188
-673.2 DL 196 673.2 192 673.2 DL 200 673.2 196 673.2 DL 204 673.2 200
-673.2 DL 208 673.2 204 673.2 DL 212 673.2 208 673.2 DL 216 673.2 212
-673.2 DL/F3 8/Times-Roman@0 SF .556(*A considerable part of this w)93.6
-685.2 R .556(ork w)-.08 F .556(as done while under the emplo)-.08 F
-2.557(yo)-.08 G 2.557(ft)-2.557 G .557(he INGRES Project at the Uni)
--2.557 F -.12(ve)-.2 G .557(rsity of California at).12 F(Berk)72 694.8 Q
-(ele)-.08 E -.52(y.)-.12 G/F4 10/Times-Bold@0 SF(Mail Systems and Addr)
-72 756 Q(essing in 4.2bsd)-.18 E(1)259.93 E EP
-%%Page: 2 2
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(Mail Systems and Addr)72 60 Q(essing in 4.2bsd)
--.18 E(2)259.93 E/F1 10/Times-Roman@0 SF(ambiguity in mix)72 96 Q
-(ed addresses.)-.15 E .679
-(Internet standards seek to eliminate these problems.)97 112.2 R
-(Initially)5.678 E 3.178(,t)-.65 G .678(hese proposed e)-3.178 F .678
-(xpanding the address)-.15 F .331
-(pairs to address triples, consisting of {netw)72 124.2 R .331
-(ork, host, username} triples.)-.1 F(Netw)5.332 E .332
-(ork numbers must be uni)-.1 F -.15(ve)-.25 G -.2(r-).15 G 1.452
-(sally agreed upon, and hosts can be assigned locally on each netw)72
-136.2 R 3.952(ork. The)-.1 F(user)3.952 E(-le)-.2 E -.15(ve)-.25 G 3.952
-(lp).15 G 1.452(resentation w)-3.952 F(as)-.1 E .249(changed to address domains, comprised of a local resource identi\214cation and a hierarchical domain speci\214-)
-72 148.2 R 1.54(cation with a common static root.)72 160.2 R 1.539
-(The domain technique separates the issue of ph)6.539 F 1.539(ysical v)
--.05 F 1.539(ersus logical)-.15 F 3.001(addressing. F)72 172.2 R .501
-(or e)-.15 F .502(xample, an address of the form \231eric@a.cc.berk)-.15
-F(ele)-.1 E -.65(y.)-.15 G .502(arpa\232 describes the logical or).65 F
--.05(ga)-.18 G(niza-).05 E .443(tion of the address space \(user \231eric\232 on host \231a\232 in the Computer Center at Berk)
-72 184.2 R(ele)-.1 E .443(y\) b)-.15 F .443(ut not the ph)-.2 F(ysical)
--.05 E(netw)72 196.2 Q .934(orks used \(for e)-.1 F .934
-(xample, this could go o)-.15 F -.15(ve)-.15 G 3.434(rd).15 G(if)-3.434
-E .934(ferent netw)-.25 F .935
-(orks depending on whether \231a\232 were on an)-.1 F
-(ethernet or a store-and-forw)72 208.2 Q(ard netw)-.1 E(ork\).)-.1 E/F2
-10/Times-Italic@0 SF(Sendmail)97 224.4 Q F1 .493
-(is intended to help bridge the g)2.993 F .493(ap between the totally)
--.05 F F2 .493(ad hoc)2.993 F F1 -.1(wo)2.993 G .493(rld of netw).1 F
-.493(orks that kno)-.1 F(w)-.25 E .854
-(nothing of each other and the clean, tightly-coupled w)72 236.4 R .854
-(orld of unique netw)-.1 F .855(ork numbers.)-.1 F .855
-(It can accept old)5.855 F .633(arbitrary address syntax)72 248.4 R .632
-(es, resolving ambiguities using heuristics speci\214ed by the system administrator)
--.15 F 3.132(,a)-.4 G(s)-3.132 E .347(well as domain-based addressing.)
-72 260.4 R .347(It helps guide the con)5.347 F -.15(ve)-.4 G .347
-(rsion of message formats between disparate net-).15 F -.1(wo)72 272.4 S
-3.395(rks. In).1 F(short,)3.395 E F2(sendmail)3.395 E F1 .894
-(is designed to assist a graceful transition to consistent internetw)
-3.395 F .894(ork addressing)-.1 F(schemes.)72 284.4 Q .689
-(Section 1 de\214nes some of the terms frequently left fuzzy when w)97
-312.6 R .69(orking in mail systems.)-.1 F .69(Section 2)5.69 F .595
-(discusses the design goals for)72 324.6 R F2(sendmail)3.095 E F1 5.595
-(.I)C 3.095(ns)-5.595 G .595(ection 3, the ne)-3.095 F 3.095(wa)-.25 G
-.594(ddress formats and basic features of)-3.095 F F2(send-)3.094 E
-(mail)72 336.6 Q F1 .893(are described.)3.393 F .893
-(Section 4 discusses some of the special problems of the UUCP netw)5.893
-F 3.394(ork. The)-.1 F(dif)3.394 E(fer)-.25 E(-)-.2 E(ences between)72
-348.6 Q F2(sendmail)2.5 E F1(and)2.5 E F2(delivermail)2.5 E F1
-(are presented in section 5.)2.5 E F0(DISCLAIMER:)112 376.8 Q F1 3.333
-(An)3.333 G .833(umber of e)-3.333 F .832
-(xamples in this paper use names of actual people and)-.15 F(or)112
-388.8 Q -.05(ga)-.18 G 4.572(nizations. This).05 F 2.072
-(is not intended to imply a commitment or e)4.572 F -.15(ve)-.25 G 4.573
-(na).15 G 4.573(ni)-4.573 G(ntellectual)-4.573 E 1.094
-(agreement on the part of these people or or)112 400.8 R -.05(ga)-.18 G
-3.594(nizations. In).05 F(particular)3.594 E 3.594(,B)-.4 G 1.094(ell T)
--3.594 F(elephone)-.7 E .656
-(Laboratories \(BTL\), Digital Equipment Corporation \(DEC\), La)112
-412.8 R .657(wrence Berk)-.15 F(ele)-.1 E 3.157(yL)-.15 G(abo-)-3.157 E
-2.136(ratories \(LBL\), Britton-Lee Incorporated \(BLI\), and the Uni)
-112 424.8 R -.15(ve)-.25 G 2.136(rsity of California at).15 F(Berk)112
-436.8 Q(ele)-.1 E 3.088(ya)-.15 G .588(re not committed to an)-3.088 F
-3.089(yo)-.15 G 3.089(ft)-3.089 G .589(hese proposals at this time.)
--3.089 F .589(Much of this paper)5.589 F
-(represents no more than the personal opinions of the author)112 448.8 Q
-(.)-.55 E F0 2.5(1. DEFINITIONS)72 477 R F1 .266(There are four basic concepts that must be clearly distinguished when dealing with mail systems:)
-112 493.2 R .514(the user \(or the user')87 505.2 R 3.014(sa)-.55 G .515
-(gent\), the user')-3.014 F 3.015(si)-.55 G .515
-(denti\214cation, the user')-3.015 F 3.015(sa)-.55 G .515
-(ddress, and the route.)-3.015 F .515(These are dis-)5.515 F
-(tinguished primarily by their position independence.)87 517.2 Q F0 2.5
-(1.1. User)87 541.2 R(and Identi\214cation)2.5 E F1 .264(The user is the being \(a person or program\) that is creating or recei)
-127 557.4 R .263(ving a message.)-.25 F(An)5.263 E F2 -.1(age)2.763 G
-(nt).1 E F1 .659(is an entity operating on behalf of the user \212 such as a secretary who handles my mail.)
-102 569.4 R .66(or a pro-)5.66 F(gram that automatically returns a message such as \231I am at the UNICOM conference.)
-102 581.4 Q<9a>-.7 E .931(The identi\214cation is the tag that goes along with the particular user)
-127 597.6 R 5.931(.T)-.55 G .931(his tag is completely)-5.931 F .216
-(independent of location.)102 609.6 R -.15(Fo)5.216 G 2.716(re).15 G
-.216(xample, my identi\214cation is the string \231Eric Allman,)-2.866 F
-2.717<9a61>-.7 G .217(nd this identi-)-2.717 F 1.228
-(\214cation does not change whether I am located at U.C. Berk)102 621.6
-R(ele)-.1 E 2.527 -.65(y, a)-.15 H 3.727(tB).65 G 1.227
-(ritton-Lee, or at a scienti\214c)-3.727 F(institute in Austria.)102
-633.6 Q 2.379(Since the identi\214cation is frequently ambiguous \(e.g., there are tw)
-127 649.8 R 4.879<6f99>-.1 G 2.38(Robert Henry\232s at)-4.879 F(Berk)102
-661.8 Q(ele)-.1 E .316(y\) it is common to add other disambiguating information that is not strictly part of the iden-)
--.15 F(ti\214cation \(e.g., Robert \231Code Generator\232 Henry v)102
-673.8 Q(ersus Robert \231System Administrator\232 Henry\).)-.15 E F0 -1
-(Ve)72 756 S(rsion 8.2)1 E(USENIX \255 J)130.475 E(an 83)-.15 E
-(Last Mod 11/27/1993)88.355 E EP
-%%Page: 3 3
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(Mail Systems and Addr)72 60 Q(essing in 4.2bsd)
--.18 E(3)259.93 E 2.5(1.2. Addr)87 96 R(ess)-.18 E/F1 10/Times-Roman@0
-SF .785(The address speci\214es a location.)127 112.2 R .786(As I mo)
-5.786 F 1.086 -.15(ve a)-.15 H .786(round, my address changes.).15 F
--.15(Fo)5.786 G 3.286(re).15 G .786(xample, my)-3.436 F .749
-(address might change from \231eric@Berk)102 124.2 R(ele)-.1 E -.65(y.)
--.15 G(ARP).65 E .749
-(A\232 to \231eric@bli.UUCP\232 or \231allman@IIASA.Aus-)-.92 F
-(tria\232 depending on my current af)102 136.2 Q(\214liation.)-.25 E(Ho)
-127 152.4 Q(we)-.25 E -.15(ve)-.25 G 2.819 -.4(r, a).15 H 4.519(na).4 G
-2.019(ddress is independent of the location of an)-4.519 F 2.019
-(yone else.)-.15 F 2.02(That is, my address)7.02 F .385
-(remains the same to e)102 164.4 R -.15(ve)-.25 G .385
-(ryone who might be sending me mail.).15 F -.15(Fo)5.385 G 2.885(re).15
-G .385(xample, a person at MIT and a)-3.035 F
-(person at USC could both send to \231eric@Berk)102 176.4 Q(ele)-.1 E
--.65(y.)-.15 G(ARP).65 E(A\232 and ha)-.92 E .3 -.15(ve i)-.2 H 2.5(ta)
-.15 G(rri)-2.5 E .3 -.15(ve t)-.25 H 2.5(ot).15 G(he same mailbox.)-2.5
-E .627(Ideally a \231white pages\232 service w)127 192.6 R .627
-(ould be pro)-.1 F .627
-(vided to map user identi\214cations into addresses)-.15 F .444(\(for e)
-102 204.6 R .444(xample, see [Solomon81]\).)-.15 F .444
-(Currently this is handled by passing around scraps of paper or by)5.444
-F(calling people on the telephone to \214nd out their address.)102 216.6
-Q F0 2.5(1.3. Route)87 240.6 R F1 .288(While an address speci\214es)127
-256.8 R/F2 10/Times-Italic@0 SF(wher)2.788 E(e)-.37 E F1 .289
-(to \214nd a mailbox, a route speci\214es)2.789 F F2(how)2.789 E F1 .289
-(to \214nd the mailbox.)2.789 F(Speci\214cally)102 268.8 Q 2.607(,i)-.65
-G 2.607(ts)-2.607 G .106(peci\214es a path from sender to recei)-2.607 F
--.15(ve)-.25 G 3.706 -.55(r. A).15 H 2.606(ss).55 G .106
-(uch, the route is potentially dif)-2.606 F .106(ferent for)-.25 F -2.15
--.25(ev e)102 280.8 T(ry pair of people in the electronic uni).25 E -.15
-(ve)-.25 G(rse.).15 E .258
-(Normally the route is hidden from the user by the softw)127 297 R 2.758
-(are. Ho)-.1 F(we)-.25 E -.15(ve)-.25 G 1.058 -.4(r, s).15 H .258
-(ome netw).4 F .258(orks put the)-.1 F -.2(bu)102 309 S 1.972
-(rden of determining the route onto the sender).2 F 6.971(.A)-.55 G
-1.971(lthough this simpli\214es the softw)-6.971 F 1.971(are, it also)
--.1 F(greatly impairs the usability for most users.)102 321 Q
-(The UUCP netw)5 E(ork is an e)-.1 E(xample of such a netw)-.15 E(ork.)
--.1 E F0 2.5(2. DESIGN)72 345 R(GO)2.5 E(ALS)-.4 E F1(Design goals for)
-112 363.2 Q F2(sendmail)2.5 E/F3 7/Times-Roman@0 SF(1)-4 I F1(include:)
-2.5 4 M 12.5(\(1\) Compatibility)92 379.4 R 1.363(with the e)3.863 F
-1.363(xisting mail programs, including Bell v)-.15 F 1.363
-(ersion 6 mail, Bell v)-.15 F 1.364(ersion 7)-.15 F 3.589(mail, Berk)
-118.66 391.4 R(ele)-.1 E(y)-.15 E F2(Mail)6.089 E F1 3.589
-([Shoens79], BerkNet mail [Schmidt79], and hopefully UUCP mail)6.089 F
-([No)118.66 403.4 Q 2.5(witz78]. ARP)-.25 F(ANET mail [Crock)-.92 E
-(er82] w)-.1 E(as also required.)-.1 E 12.5(\(2\) Reliability)92 419.6 R
-4.002(,i)-.65 G 4.002(nt)-4.002 G 1.502(he sense of guaranteeing that e)
--4.002 F -.15(ve)-.25 G 1.502(ry message is correctly deli).15 F -.15
-(ve)-.25 G 1.503(red or at least).15 F .368(brought to the attention of a human for correct disposal; no message should e)
-118.66 431.6 R -.15(ve)-.25 G 2.868(rb).15 G 2.868(ec)-2.868 G
-(ompletely)-2.868 E 2.54(lost. This)118.66 443.6 R .04(goal w)2.54 F
-.041(as considered essential because of the emphasis on mail in our en)
--.1 F 2.541(vironment. It)-.4 F 1.755
-(has turned out to be one of the hardest goals to satisfy)118.66 455.6 R
-4.254(,e)-.65 G 1.754(specially in the f)-4.254 F 1.754(ace of the man)
--.1 F(y)-.15 E .977(anomalous message formats produced by v)118.66 467.6
-R .977(arious ARP)-.25 F .977(ANET sites.)-.92 F -.15(Fo)5.977 G 3.478
-(re).15 G .978(xample, certain sites)-3.628 F .069
-(generate improperly formated addresses, occasionally causing error)
-118.66 479.6 R .069(-message loops.)-.2 F .068(Some hosts)5.069 F .766(use blanks in names, causing problems with mail programs that assume that an address is one)
-118.66 491.6 R -.1(wo)118.66 503.6 S 3.924(rd. The).1 F 1.423
-(semantics of some \214elds are interpreted slightly dif)3.923 F 1.423
-(ferently by dif)-.25 F 1.423(ferent sites.)-.25 F(In)6.423 E(summary)
-118.66 515.6 Q 3.022(,t)-.65 G .523(he obscure features of the ARP)
--3.022 F .523(ANET mail protocol really)-.92 F F2(ar)3.023 E(e)-.37 E F1
-.523(used and are dif)3.023 F(\214cult)-.25 E(to support, b)118.66 527.6
-Q(ut must be supported.)-.2 E 12.5(\(3\) Existing)92 543.8 R(softw)2.939
-E .439(are to do actual deli)-.1 F -.15(ve)-.25 G .439
-(ry should be used whene).15 F -.15(ve)-.25 G 2.938(rp).15 G 2.938
-(ossible. This)-2.938 F .438(goal deri)2.938 F -.15(ve)-.25 G 2.938(sa)
-.15 G(s)-2.938 E
-(much from political and practical considerations as technical.)118.66
-555.8 Q 12.5(\(4\) Easy)92 572 R -.15(ex)2.898 G .398(pansion to f).15 F
-.398(airly comple)-.1 F 2.898(xe)-.15 G -.4(nv)-2.898 G .399
-(ironments, including multiple connections to a single net-).4 F -.1(wo)
-118.66 584 S .63(rk type \(such as with multiple UUCP or Ethernets\).).1
-F .63(This goal requires consideration of the)5.63 F(contents of an address as well as its syntax in order to determine which g)
-118.66 596 Q(ate)-.05 E -.1(wa)-.25 G 2.5(yt).1 G 2.5(ou)-2.5 G(se.)-2.5
-E 12.5(\(5\) Con\214guration)92 612.2 R 1.048
-(information should not be compiled into the code.)3.548 F 3.549(As)
-6.049 G 1.049(ingle compiled program)-3.549 F .084
-(should be able to run as is at an)118.66 624.2 R 2.584(ys)-.15 G .083
-(ite \(barring such basic changes as the CPU type or the operat-)-2.584
-F .342(ing system\).)118.66 636.2 R 1.942 -.8(We h)5.342 H -2.25 -.2
-(av e).8 H .343
-(found this seemingly unimportant goal to be critical in real life.)
-3.042 F(Besides)5.343 E .734(the simple problems that occur when an)
-118.66 648.2 R 3.234(yp)-.15 G .734(rogram gets recompiled in a dif)
--3.234 F .733(ferent en)-.25 F(vironment,)-.4 E(man)118.66 660.2 Q 2.5
-(ys)-.15 G(ites lik)-2.5 E 2.5(et)-.1 G 2.5<6f99>-2.5 G
-(\214ddle\232 with an)-2.5 E(ything that the)-.15 E 2.5(yw)-.15 G
-(ill be recompiling an)-2.5 E(yw)-.15 E(ay)-.1 E(.)-.65 E .32 LW 76
-678.8 72 678.8 DL 80 678.8 76 678.8 DL 84 678.8 80 678.8 DL 88 678.8 84
-678.8 DL 92 678.8 88 678.8 DL 96 678.8 92 678.8 DL 100 678.8 96 678.8 DL
-104 678.8 100 678.8 DL 108 678.8 104 678.8 DL 112 678.8 108 678.8 DL 116
-678.8 112 678.8 DL 120 678.8 116 678.8 DL 124 678.8 120 678.8 DL 128
-678.8 124 678.8 DL 132 678.8 128 678.8 DL 136 678.8 132 678.8 DL 140
-678.8 136 678.8 DL 144 678.8 140 678.8 DL 148 678.8 144 678.8 DL 152
-678.8 148 678.8 DL 156 678.8 152 678.8 DL 160 678.8 156 678.8 DL 164
-678.8 160 678.8 DL 168 678.8 164 678.8 DL 172 678.8 168 678.8 DL 176
-678.8 172 678.8 DL 180 678.8 176 678.8 DL 184 678.8 180 678.8 DL 188
-678.8 184 678.8 DL 192 678.8 188 678.8 DL 196 678.8 192 678.8 DL 200
-678.8 196 678.8 DL 204 678.8 200 678.8 DL 208 678.8 204 678.8 DL 212
-678.8 208 678.8 DL 216 678.8 212 678.8 DL/F4 5/Times-Roman@0 SF(1)93.6
-689.2 Q/F5 8/Times-Roman@0 SF(This section mak)3.2 I
-(es no distinction between)-.08 E/F6 8/Times-Italic@0 SF(delivermail)2 E
-F5(and)2 E F6(sendmail.)2 E F0 -1(Ve)72 756 S(rsion 8.2)1 E
-(USENIX \255 J)130.475 E(an 83)-.15 E(Last Mod 11/27/1993)88.355 E EP
-%%Page: 4 4
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(Mail Systems and Addr)72 60 Q(essing in 4.2bsd)
--.18 E(4)259.93 E/F1 10/Times-Roman@0 SF(\(6\))92 96 Q/F2 10
-/Times-Italic@0 SF(Sendmail)15 E F1 .184(must be able to let v)2.684 F
-.184(arious groups maintain their o)-.25 F .184
-(wn mailing lists, and let indi)-.25 F(viduals)-.25 E(specify their o)
-118.66 108 Q(wn forw)-.25 E
-(arding, without modifying the system alias \214le.)-.1 E 12.5
-(\(7\) Each)92 124.2 R .313
-(user should be able to specify which mailer to e)2.814 F -.15(xe)-.15 G
-.313(cute to process mail being deli).15 F -.15(ve)-.25 G .313(red for)
-.15 F 3.098(him. This)118.66 136.2 R .598(feature allo)3.098 F .598
-(ws users who are using specialized mailers that use a dif)-.25 F .598
-(ferent format to)-.25 F -.2(bu)118.66 148.2 S .25(ild their en).2 F .25
-(vironment without changing the system, and f)-.4 F .25
-(acilitates specialized functions \(such)-.1 F
-(as returning an \231I am on v)118.66 160.2 Q(acation\232 message\).)
--.25 E 12.5(\(8\) Netw)92 176.4 R 1.552(ork traf)-.1 F 1.552(\214c should be minimized by batching addresses to a single host where possible,)
--.25 F(without assistance from the user)118.66 188.4 Q(.)-.55 E .375
-(These goals moti)112 204.6 R -.25(va)-.25 G .375
-(ted the architecture illustrated in \214gure 1.).25 F .374
-(The user interacts with a mail gen-)5.375 F .49
-(erating and sending program.)87 216.6 R .491
-(When the mail is created, the generator calls)5.49 F F2(sendmail)2.991
-E F1 2.991(,w)C .491(hich routes the)-2.991 F .841
-(message to the correct mailer\(s\).)87 228.6 R .841
-(Since some of the senders may be netw)5.841 F .84(ork serv)-.1 F .84
-(ers and some of the)-.15 F(mailers may be netw)87 240.6 Q(ork clients,)
--.1 E F2(sendmail)2.5 E F1(may be used as an internet mail g)2.5 E(ate)
--.05 E -.1(wa)-.25 G -.65(y.).1 G F0 2.5(3. USA)72 264.6 R(GE)-.55 E 2.5
-(3.1. Addr)87 288.6 R(ess F)-.18 E(ormats)-.25 E F1(Ar)127 304.8 Q .886
-(guments may be \215ags or addresses.)-.18 F .886(Flags set v)5.886 F
-.886(arious processing options.)-.25 F -.15(Fo)5.886 G(llo).15 E .886
-(wing \215ag)-.25 F(ar)102 316.8 Q .611(guments, address ar)-.18 F .611
-(guments may be gi)-.18 F -.15(ve)-.25 G 3.111(n. Addresses).15 F(follo)
-3.111 E 3.111(wt)-.25 G .611(he syntax in RFC822 [Crock)-3.111 F(er82])
--.1 E(for ARP)102 328.8 Q(ANET address formats.)-.92 E
-(In brief, the format is:)5 E 12.5(\(1\) An)107 345 R
-(ything in parentheses is thro)-.15 E(wn a)-.25 E -.1(wa)-.15 G 2.5(y\()
-.1 G(as a comment\).)-2.5 E 12.5(\(2\) An)107 361.2 R .051
-(ything in angle brack)-.15 F .051(ets \(\231<)-.1 F .051
-(>\232\) is preferred o)1.666 F -.15(ve)-.15 G 2.551(ra).15 G -.15(ny)
--2.551 G .051(thing else.).15 F .051(This rule implements the)5.051 F
-(ARP)133.66 373.2 Q(ANET standard that addresses of the form)-.92 E .4
-LW 77 408 72 408 DL 79 408 74 408 DL 84 408 79 408 DL 89 408 84 408 DL
-94 408 89 408 DL 99 408 94 408 DL 104 408 99 408 DL 109 408 104 408 DL
-114 408 109 408 DL 119 408 114 408 DL 124 408 119 408 DL 129 408 124 408
-DL 134 408 129 408 DL 139 408 134 408 DL 144 408 139 408 DL 149 408 144
-408 DL 154 408 149 408 DL 159 408 154 408 DL 164 408 159 408 DL 169 408
-164 408 DL 174 408 169 408 DL 179 408 174 408 DL 184 408 179 408 DL 189
-408 184 408 DL 194 408 189 408 DL 199 408 194 408 DL 204 408 199 408 DL
-209 408 204 408 DL 214 408 209 408 DL 219 408 214 408 DL 224 408 219 408
-DL 229 408 224 408 DL 234 408 229 408 DL 239 408 234 408 DL 244 408 239
-408 DL 249 408 244 408 DL 254 408 249 408 DL 259 408 254 408 DL 264 408
-259 408 DL 269 408 264 408 DL 274 408 269 408 DL 279 408 274 408 DL 284
-408 279 408 DL 289 408 284 408 DL 294 408 289 408 DL 299 408 294 408 DL
-304 408 299 408 DL 309 408 304 408 DL 314 408 309 408 DL 319 408 314 408
-DL 324 408 319 408 DL 329 408 324 408 DL 334 408 329 408 DL 339 408 334
-408 DL 344 408 339 408 DL 349 408 344 408 DL 354 408 349 408 DL 359 408
-354 408 DL 364 408 359 408 DL 369 408 364 408 DL 374 408 369 408 DL 379
-408 374 408 DL 384 408 379 408 DL 389 408 384 408 DL 394 408 389 408 DL
-399 408 394 408 DL 404 408 399 408 DL 409 408 404 408 DL 414 408 409 408
-DL 419 408 414 408 DL 424 408 419 408 DL 429 408 424 408 DL 434 408 429
-408 DL 439 408 434 408 DL 444 408 439 408 DL 449 408 444 408 DL 454 408
-449 408 DL 459 408 454 408 DL 464 408 459 408 DL 469 408 464 408 DL 474
-408 469 408 DL 479 408 474 408 DL 484 408 479 408 DL 489 408 484 408 DL
-494 408 489 408 DL 499 408 494 408 DL 504 408 499 408 DL
-(Figure 1 \212 Sendmail System Structure.)208 660 Q 77 672 72 672 DL 79
-672 74 672 DL 84 672 79 672 DL 89 672 84 672 DL 94 672 89 672 DL 99 672
-94 672 DL 104 672 99 672 DL 109 672 104 672 DL 114 672 109 672 DL 119
-672 114 672 DL 124 672 119 672 DL 129 672 124 672 DL 134 672 129 672 DL
-139 672 134 672 DL 144 672 139 672 DL 149 672 144 672 DL 154 672 149 672
-DL 159 672 154 672 DL 164 672 159 672 DL 169 672 164 672 DL 174 672 169
-672 DL 179 672 174 672 DL 184 672 179 672 DL 189 672 184 672 DL 194 672
-189 672 DL 199 672 194 672 DL 204 672 199 672 DL 209 672 204 672 DL 214
-672 209 672 DL 219 672 214 672 DL 224 672 219 672 DL 229 672 224 672 DL
-234 672 229 672 DL 239 672 234 672 DL 244 672 239 672 DL 249 672 244 672
-DL 254 672 249 672 DL 259 672 254 672 DL 264 672 259 672 DL 269 672 264
-672 DL 274 672 269 672 DL 279 672 274 672 DL 284 672 279 672 DL 289 672
-284 672 DL 294 672 289 672 DL 299 672 294 672 DL 304 672 299 672 DL 309
-672 304 672 DL 314 672 309 672 DL 319 672 314 672 DL 324 672 319 672 DL
-329 672 324 672 DL 334 672 329 672 DL 339 672 334 672 DL 344 672 339 672
-DL 349 672 344 672 DL 354 672 349 672 DL 359 672 354 672 DL 364 672 359
-672 DL 369 672 364 672 DL 374 672 369 672 DL 379 672 374 672 DL 384 672
-379 672 DL 389 672 384 672 DL 394 672 389 672 DL 399 672 394 672 DL 404
-672 399 672 DL 409 672 404 672 DL 414 672 409 672 DL 419 672 414 672 DL
-424 672 419 672 DL 429 672 424 672 DL 434 672 429 672 DL 439 672 434 672
-DL 444 672 439 672 DL 449 672 444 672 DL 454 672 449 672 DL 459 672 454
-672 DL 464 672 459 672 DL 469 672 464 672 DL 474 672 469 672 DL 479 672
-474 672 DL 484 672 479 672 DL 489 672 484 672 DL 494 672 489 672 DL 499
-672 494 672 DL 504 672 499 672 DL F0 -1(Ve)72 756 S(rsion 8.2)1 E
-(USENIX \255 J)130.475 E(an 83)-.15 E(Last Mod 11/27/1993)88.355 E EP
-%%Page: 5 5
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(Mail Systems and Addr)72 60 Q(essing in 4.2bsd)
--.18 E(5)259.93 E/F1 10/Times-Roman@0 SF(user name <machine-address>)
-173.66 96 Q(will send to the electronic \231machine-address\232 rather than the human \231user name.)
-133.66 112.2 Q<9a>-.7 E 12.5(\(3\) Double)107 128.4 R 2.246(quotes \()
-4.746 F -2.754 2.5("\) q)2.5 H 2.246
-(uote phrases; backslashes quote characters.)-2.5 F 2.246
-(Backslashes are more)7.246 F(po)133.66 140.4 Q .654(werful in that the)
--.25 F 3.154(yw)-.15 G .655(ill cause otherwise equi)-3.154 F -.25(va)
--.25 G .655(lent phrases to compare dif).25 F .655(ferently \212 for)
--.25 F -.15(ex)133.66 152.4 S(ample,).15 E/F2 10/Times-Italic@0 SF(user)
-3.873 E F1(and)3.873 E F2("user")3.872 E F1 1.372(are equi)3.872 F -.25
-(va)-.25 G 1.372(lent, b).25 F(ut)-.2 E F2(\\user)3.872 E F1 1.372
-(is dif)3.872 F 1.372(ferent from either of them.)-.25 F(This)6.372 E
-(might be used to a)133.66 164.4 Q -.2(vo)-.2 G
-(id normal aliasing or duplicate suppression algorithms.).2 E -.15(Pa)
-127 180.6 S 1.12(rentheses, angle brack).15 F 1.12
-(ets, and double quotes must be properly balanced and nested.)-.1 F(The)
-6.12 E(re)102 194.6 Q(writing rules control remaining parsing)-.25 E/F3
-7/Times-Roman@0 SF(2)-4 I F1(.)4 I .644(Although old style addresses are still accepted in most cases, the preferred address format is)
-127 210.8 R .299(based on ARP)102 222.8 R(ANET)-.92 E .299
-(-style domain-based addresses [Su82a].)-.92 F .299
-(These addresses are based on a hierar)5.299 F(-)-.2 E .13
-(chical, logical decomposition of the address space.)102 234.8 R .13
-(The addresses are hierarchical in a sense similar)5.13 F 1.133(to the U.S. postal addresses: the messages may \214rst be routed to the correct state, with no initial)
-102 246.8 R .72(consideration of the city or other addressing details.)
-102 258.8 R .72(The addresses are logical in that each step in)5.72 F
-(the hierarch)102 270.8 Q 2.5(yc)-.05 G
-(orresponds to a set of \231naming authorities\232 rather than a ph)-2.5
-E(ysical netw)-.05 E(ork.)-.1 E -.15(Fo)127 287 S 2.5(re).15 G
-(xample, the address:)-2.65 E(eric@HostA.BigSite.ARP)142 303.2 Q(A)-.92
-E -.1(wo)102 319.4 S .851(uld \214rst look up the domain BigSite in the namespace administrated by ARP)
-.1 F 3.351(A. A)-.92 F .851(query could)3.351 F 1.476
-(then be sent to BigSite for interpretation of HostA.)102 331.4 R(Ev)
-6.475 E 1.475(entually the mail w)-.15 F 1.475(ould arri)-.1 F 1.775
--.15(ve a)-.25 H 3.975(tH).15 G(ostA,)-3.975 E(which w)102 343.4 Q
-(ould then do \214nal deli)-.1 E -.15(ve)-.25 G(ry to user \231eric.).15
-E<9a>-.7 E F0 2.5(3.2. Mail)87 367.4 R(to Files and Pr)2.5 E(ograms)-.18
-E F1 .609(Files and programs are le)127 383.6 R .609
-(gitimate message recipients.)-.15 F .609(Files pro)5.609 F .609
-(vide archi)-.15 F -.25(va)-.25 G 3.109(ls).25 G .61(torage of mes-)
--3.109 F .124(sages, useful for project administration and history)102
-395.6 R 5.124(.P)-.65 G .124(rograms are useful as recipients in a v)
--5.124 F .124(ariety of)-.25 F .69(situations, for e)102 407.6 R .691(xample, to maintain a public repository of systems messages \(such as the Berk)
--.15 F(ele)-.1 E(y)-.15 E F2(msgs)102 419.6 Q F1(program\).)2.5 E(An)127
-435.8 Q 3.188(ya)-.15 G .688(ddress passing through the initial parsing algorithm as a local address \(i.e, not appear)
--3.188 F(-)-.2 E .276(ing to be a v)102 447.8 R .276
-(alid address for another mailer\) is scanned for tw)-.25 F 2.776(os)-.1
-G .277(pecial cases.)-2.776 F .277(If pre\214x)5.277 F .277(ed by a v)
--.15 F(erti-)-.15 E .18(cal bar \(\231)102 459.8 R .833<7c9a>.833 G 2.68
-(\)t)-.833 G .179
-(he rest of the address is processed as a shell command.)-2.68 F .179
-(If the user name be)5.179 F .179(gins with a)-.15 F(slash mark \(\231/)
-102 471.8 Q
-(\232\) the name is used as a \214le name, instead of a login name.).833
-E F0 2.5(3.3. Aliasing,)87 495.8 R -.25(Fo)2.5 G(rwarding, Inclusion).25
-E F2(Sendmail)127 512 Q F1 1.074(reroutes mail three w)3.574 F 3.574
-(ays. Aliasing)-.1 F 1.075(applies system wide.)3.575 F -.15(Fo)6.075 G
-(rw).15 E 1.075(arding allo)-.1 F 1.075(ws each)-.25 F .233
-(user to reroute incoming mail destined for that account.)102 524 R .233
-(Inclusion directs)5.233 F F2(sendmail)2.733 E F1 .233
-(to read a \214le for)2.733 F 2.5(al)102 536 S
-(ist of addresses, and is normally used in conjunction with aliasing.)
--2.5 E F0 2.5(3.3.1. Aliasing)102 560 R F1 .065(Aliasing maps local addresses to address lists using a system-wide \214le.)
-142 576.2 R .065(This \214le is hashed)5.065 F 1.546(to speed access.)
-117 588.2 R 1.545(Only addresses that parse as local are allo)6.546 F
-1.545(wed as aliases; this guarantees a)-.25 F(unique k)117 600.2 Q .3
--.15(ey \()-.1 H(since there are no nicknames for the local host\).).15
-E F0 2.5(3.3.2. F)102 624.2 R(orwarding)-.25 E F1 .641
-(After aliasing, if an recipient address speci\214es a local user)142
-640.4 R F2(sendmail)3.141 E F1 .641(searches for a \231.for)3.141 F(-)
--.2 E -.1(wa)117 652.4 S .413(rd\232 \214le in the recipient').1 F 2.913
-(sh)-.55 G .413(ome directory)-2.913 F 5.413(.I)-.65 G 2.913(fi)-5.413 G
-2.913(te)-2.913 G .413(xists, the message is)-3.063 F F2(not)2.913 E F1
-.412(sent to that user)2.913 F 2.912(,b)-.4 G(ut)-3.112 E .745
-(rather to the list of addresses in that \214le.)117 664.4 R .746
-(Often this list will contain only one address, and the)5.746 F
-(feature will be used for netw)117 676.4 Q(ork mail forw)-.1 E(arding.)
--.1 E .32 LW 76 686 72 686 DL 80 686 76 686 DL 84 686 80 686 DL 88 686
-84 686 DL 92 686 88 686 DL 96 686 92 686 DL 100 686 96 686 DL 104 686
-100 686 DL 108 686 104 686 DL 112 686 108 686 DL 116 686 112 686 DL 120
-686 116 686 DL 124 686 120 686 DL 128 686 124 686 DL 132 686 128 686 DL
-136 686 132 686 DL 140 686 136 686 DL 144 686 140 686 DL 148 686 144 686
-DL 152 686 148 686 DL 156 686 152 686 DL 160 686 156 686 DL 164 686 160
-686 DL 168 686 164 686 DL 172 686 168 686 DL 176 686 172 686 DL 180 686
-176 686 DL 184 686 180 686 DL 188 686 184 686 DL 192 686 188 686 DL 196
-686 192 686 DL 200 686 196 686 DL 204 686 200 686 DL 208 686 204 686 DL
-212 686 208 686 DL 216 686 212 686 DL/F4 5/Times-Roman@0 SF(2)93.6 696.4
-Q/F5 8/Times-Roman@0 SF
-(Disclaimer: Some special processing is done after re)3.2 I
-(writing local names; see belo)-.2 E -.52(w.)-.2 G F0 -1(Ve)72 756 S
-(rsion 8.2)1 E(USENIX \255 J)130.475 E(an 83)-.15 E(Last Mod 11/27/1993)
-88.355 E EP
-%%Page: 6 6
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(Mail Systems and Addr)72 60 Q(essing in 4.2bsd)
--.18 E(6)259.93 E/F1 10/Times-Roman@0 SF -.15(Fo)142 96 S(rw).15 E 1.152
-(arding also permits a user to specify a pri)-.1 F -.25(va)-.25 G 1.151
-(te incoming mailer).25 F 6.151(.F)-.55 G 1.151(or e)-6.301 F 1.151
-(xample, for)-.15 F(-)-.2 E -.1(wa)117 108 S(rding to:).1 E -2.5 .833
-("| /)157 124.2 T(usr/local/ne)-.833 E(wmail myname")-.25 E
-(will use a dif)117 140.4 Q(ferent incoming mailer)-.25 E(.)-.55 E F0
-2.5(3.3.3. Inclusion)102 164.4 R F1
-(Inclusion is speci\214ed in RFC 733 [Crock)142 180.6 Q(er77] syntax:)
--.1 E(:Include: pathname)157 196.8 Q .391
-(An address of this form reads the \214le speci\214ed by)117 213 R/F2 10
-/Times-Italic@0 SF(pathname)2.891 E F1 .391
-(and sends to all users listed in that)2.891 F(\214le.)117 225 Q .645
-(The intent is)142 241.2 R F2(not)3.145 E F1 .644
-(to support direct use of this feature, b)3.145 F .644
-(ut rather to use this as a subset of)-.2 F 2.5(aliasing. F)117 253.2 R
-(or e)-.15 E(xample, an alias of the form:)-.15 E
-(project: :include:/usr/project/userlist)157 269.4 Q 1.93(is a method of letting a project maintain a mailing list without interaction with the system)
-117 285.6 R(administration, e)117 297.6 Q -.15(ve)-.25 G 2.5(ni).15 G
-2.5(ft)-2.5 G(he alias \214le is protected.)-2.5 E 2.025
-(It is not necessary to reb)142 313.8 R 2.025(uild the inde)-.2 F 4.524
-(xo)-.15 G 4.524(nt)-4.524 G 2.024
-(he alias database when a :include: list is)-4.524 F(changed.)117 325.8
-Q F0 2.5(3.4. Message)87 349.8 R(Collection)2.5 E F1 .857
-(Once all recipient addresses are parsed and v)127 366 R .857
-(eri\214ed, the message is collected.)-.15 F .857(The message)5.857 F
-.574(comes in tw)102 378 R 3.074(op)-.1 G .574
-(arts: a message header and a message body)-3.074 F 3.074(,s)-.65 G .574
-(eparated by a blank line.)-3.074 F .573(The body is)5.574 F
-(an uninterpreted sequence of te)102 390 Q(xt lines.)-.15 E
-(The header is formated as a series of lines of the form)127 406.2 Q
-(\214eld-name: \214eld-v)178 422.4 Q(alue)-.25 E(Field-v)102 438.6 Q
-1.366(alue can be split across lines by starting the follo)-.25 F 1.366
-(wing lines with a space or a tab)-.25 F 6.366(.S)-.4 G(ome)-6.366 E
-.211(header \214elds ha)102 450.6 R .511 -.15(ve s)-.2 H .211
-(pecial internal meaning, and ha).15 F .511 -.15(ve a)-.2 H .211
-(ppropriate special processing.).15 F .21(Other headers)5.21 F
-(are simply passed through.)102 462.6 Q
-(Some header \214elds may be added automatically)5 E 2.5(,s)-.65 G
-(uch as time stamps.)-2.5 E F0 2.5(4. THE)72 486.6 R(UUCP PR)2.5 E
-(OBLEM)-.3 E F1 .43(Of particular interest is the UUCP netw)112 502.8 R
-2.93(ork. The)-.1 F -.15(ex)2.93 G .43
-(plicit routing used in the UUCP en).15 F(vironment)-.4 E .909
-(causes a number of serious problems.)87 514.8 R .909(First, gi)5.909 F
-.908(ving out an address is impossible without kno)-.25 F .908(wing the)
--.25 F .453(address of your potential correspondent.)87 526.8 R .454
-(This is typically handled by specifying the address relati)5.453 F .754
--.15(ve t)-.25 H(o).15 E 1.208(some \231well-kno)87 538.8 R 1.208
-(wn\232 host \(e.g., ucb)-.25 F -.25(va)-.15 G 3.708(xo).25 G 3.708(rd)
--3.708 G(ecv)-3.708 E 3.708(ax\). Second,)-.25 F 1.207(it is often dif)
-3.708 F 1.207(\214cult to compute the set of)-.25 F .157
-(addresses to reply to without some kno)87 550.8 R .157
-(wledge of the topology of the netw)-.25 F 2.657(ork. Although)-.1 F
-.157(it may be easy)2.657 F .352(for a human being to do this under man)
-87 562.8 R 2.851(yc)-.15 G .351(ircumstances, a program does not ha)
--2.851 F .651 -.15(ve e)-.2 H .351(qually sophisticated).15 F 1.153
-(heuristics b)87 574.8 R 1.153(uilt in.)-.2 F 1.154(Third, certain addresses will become painfully and unnecessarily long, as when a)
-6.153 F .406(message is routed through man)87 586.8 R 2.906(yh)-.15 G
-.406(osts in the USENET)-2.906 F 5.406(.A)-.74 G .406(nd \214nally)
--5.406 F 2.905(,c)-.65 G .405(ertain \231mix)-2.905 F .405
-(ed domain\232 addresses)-.15 F
-(are impossible to parse unambiguously \212 e.g.,)87 598.8 Q(decv)127
-615 Q(ax!ucb)-.25 E -.25(va)-.15 G(x!lbl-h!user@LBL-CSAM).25 E .378
-(might ha)87 631.2 R .678 -.15(ve m)-.2 H(an).15 E 2.878(yp)-.15 G .379
-(ossible resolutions, depending on whether the message w)-2.878 F .379
-(as \214rst routed to decv)-.1 F .379(ax or)-.25 F(to LBL-CSAM.)87 643.2
-Q 2.32 -.8(To s)112 659.4 T(olv).8 E 3.22(et)-.15 G .72
-(his problem, the UUCP syntax w)-3.22 F .719(ould ha)-.1 F 1.019 -.15
-(ve t)-.2 H 3.219(ob).15 G 3.219(ec)-3.219 G .719
-(hanged to use addresses rather than)-3.219 F 3.718(routes. F)87 671.4 R
-1.218(or e)-.15 F 1.218(xample, the address \231decv)-.15 F(ax!ucb)-.25
-E -.25(va)-.15 G 1.218(x!eric\232 might be e).25 F 1.218
-(xpressed as \231eric@ucb)-.15 F -.25(va)-.15 G(x.UUCP\232).25 E .079
-(\(with the hop through decv)87 683.4 R .079(ax implied\).)-.25 F .079
-(This address w)5.079 F .078
-(ould itself be a domain-based address; for e)-.1 F(xam-)-.15 E
-(ple, an address might be of the form:)87 695.4 Q(mark@d.cbosg.btl.UUCP)
-127 711.6 Q F0 -1(Ve)72 756 S(rsion 8.2)1 E(USENIX \255 J)130.475 E
-(an 83)-.15 E(Last Mod 11/27/1993)88.355 E EP
-%%Page: 7 7
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(Mail Systems and Addr)72 60 Q(essing in 4.2bsd)
--.18 E(7)259.93 E/F1 10/Times-Roman@0 SF .311(Hosts outside of Bell T)87
-96 R .311(elephone Laboratories w)-.7 F .311(ould then only need to kno)
--.1 F 2.811(wh)-.25 G .811 -.25(ow t)-2.811 H 2.811(og).25 G .312
-(et to a designated)-2.811 F(BTL relay)87 108 Q 2.5(,a)-.65 G
-(nd the BTL topology w)-2.5 E(ould only be maintained inside Bell.)-.1 E
-.543(There are three major problems associated with turning UUCP addresses into something reason-)
-112 124.2 R .465(able: de\214ning the namespace, creating and propag)87
-136.2 R .465(ating the necessary softw)-.05 F .466(are, and b)-.1 F .466
-(uilding and main-)-.2 F(taining the database.)87 148.2 Q F0 2.5
-(4.1. De\214ning)87 172.2 R(the Namespace)2.5 E F1 1.015(Putting all UUCP hosts into a \215at namespace \(e.g., \231...@host.UUCP\232\) is not practical for a)
-127 188.4 R .222(number of reasons.)102 200.4 R .222(First, with o)5.222
-F -.15(ve)-.15 G 2.722(r1).15 G .222(600 sites already)-2.722 F 2.722
-(,a)-.65 G .222(nd \(with the increasing a)-2.722 F -.25(va)-.2 G .222
-(ilability of ine).25 F(x-)-.15 E(pensi)102 212.4 Q 1.973 -.15(ve m)-.25
-H 1.673(icrocomputers and autodialers\) se).15 F -.15(ve)-.25 G 1.672
-(ral thousand more coming within a fe).15 F 4.172(wy)-.25 G 1.672
-(ears, the)-4.172 F .078(database update problem is simply intractable if the namespace is \215at.)
-102 224.4 R .078(Second, there are almost cer)5.078 F(-)-.2 E 2.446
-(tainly name con\215icts today)102 236.4 R 7.446(.T)-.65 G 2.446
-(hird, as the number of sites gro)-7.446 F 4.946(wt)-.25 G 2.446
-(he names become e)-4.946 F -.15(ve)-.25 G 4.946(rl).15 G(ess)-4.946 E
-(mnemonic.)102 248.4 Q .534(It seems ine)127 264.6 R .535(vitable that there be some sort of naming authority for the set of top le)
--.25 F -.15(ve)-.25 G 3.035(ln).15 G(ames)-3.035 E .157
-(in the UUCP domain, as unpleasant a possibility as that may seem.)102
-276.6 R .157(It will simply not be possible to)5.157 F(ha)102 288.6 Q
-.536 -.15(ve o)-.2 H .236(ne host resolving all names.).15 F .236
-(It may ho)5.236 F(we)-.25 E -.15(ve)-.25 G 2.736(rb).15 G 2.736(ep)
--2.736 G .236(ossible to handle this in a f)-2.736 F .237
-(ashion similar to)-.1 F 1.582(that of assigning names of ne)102 300.6 R
-1.582(wsgroups in USENET)-.25 F 6.582(.H)-.74 G -.25(ow)-6.582 G -2.15
--.25(ev e).25 H 2.382 -.4(r, i).25 H 4.082(tw).4 G 1.582
-(ill be essential to encourage)-4.082 F -2.15 -.25(ev e)102 312.6 T .52
-(ryone to become subdomains of an e).25 F .52(xisting domain whene)-.15
-F -.15(ve)-.25 G 3.02(rp).15 G .52(ossible \212 e)-3.02 F -.15(ve)-.25 G
-3.02(nt).15 G .52(hough this will)-3.02 F .077(certainly bruise some e)
-102 324.6 R 2.577(gos. F)-.15 F .077(or e)-.15 F .077(xample, if a ne)
--.15 F 2.577(wh)-.25 G .076
-(ost named \231blid\232 were to be added to the UUCP)-2.577 F(netw)102
-336.6 Q .65(ork, it w)-.1 F .651(ould probably actually be addressed as \231d.bli.UUCP\232 \(i.e., as host \231d\232 in the pseudo-)
--.1 F(domain \231bli\232 rather than as host \231blid\232 in the UUCP domain\).)
-102 348.6 Q F0 2.5(4.2. Cr)87 372.6 R(eating and Pr)-.18 E
-(opagating the Softwar)-.18 E(e)-.18 E F1 .078(The softw)127 388.8 R
-.078(are required to implement a consistent namespace is relati)-.1 F
--.15(ve)-.25 G .077(ly tri).15 F 2.577(vial. T)-.25 F .277 -.1(wo m)-.8
-H(odules).1 E(are needed, one to handle incoming mail and one to handle outgoing mail.)
-102 400.8 Q 1.136
-(The incoming module must be prepared to handle either old or ne)127 417
-R 3.636(ws)-.25 G 1.136(tyle addresses.)-3.636 F(Ne)6.136 E(w-)-.25 E
-.025(style addresses can be passed through unchanged.)102 429 R .024
-(Old style addresses must be turned into ne)5.025 F 2.524(ws)-.25 G
-(tyle)-2.524 E(addresses where possible.)102 441 Q 2.247
-(The outgoing module is slightly trickier)127 457.2 R 7.247(.I)-.55 G
-4.747(tm)-7.247 G 2.247(ust do a database lookup on the recipient)-4.747
-F .823(addresses \(passed on the command line\) to determine what hosts to send the message to.)
-102 469.2 R .823(If those)5.823 F .023(hosts do not accept ne)102 481.2
-R .024(w-style addresses, it must transform all addresses in the header of the message)
--.25 F(into old style using the database lookup.)102 493.2 Q 1.197
-(Both of these modules are straightforw)127 509.4 R 1.197(ard e)-.1 F
-1.197(xcept for the issue of modifying the header)-.15 F 6.197(.I)-.55 G
-(t)-6.197 E .944
-(seems prudent to choose one format for the message headers.)102 521.4 R
--.15(Fo)5.944 G 3.444(ran).15 G .944(umber of reasons, Berk)-3.444 F
-(ele)-.1 E(y)-.15 E .824(has elected to use the ARP)102 533.4 R .824
-(ANET protocols for message formats.)-.92 F(Ho)5.823 E(we)-.25 E -.15
-(ve)-.25 G 1.623 -.4(r, t).15 H .823(his protocol is some-).4 F
-(what dif)102 545.4 Q(\214cult to parse.)-.25 E(Propag)127 561.6 Q 1.903
-(ation is some)-.05 F 1.903(what more dif)-.25 F 4.403(\214cult. There)
--.25 F 1.903(are a lar)4.403 F 1.903(ge number of hosts connected to)
--.18 F .812(UUCP that will w)102 573.6 R .811
-(ant to run completely standard systems \(for v)-.1 F .811
-(ery good reasons\).)-.15 F .811(The strate)5.811 F .811(gy is)-.15 F
-(not to con)102 585.6 Q -.15(ve)-.4 G(rt the entire netw).15 E
-(ork \212 only enough of it it alle)-.1 E(viate the problem.)-.25 E F0
-2.5(4.3. Building)87 609.6 R(and Maintaining the Database)2.5 E F1 .127
-(This is by f)127 625.8 R .127(ar the most dif)-.1 F .128
-(\214cult problem.)-.25 F 2.628(Ap)5.128 G .128
-(rototype for this database already e)-2.628 F .128(xists, b)-.15 F .128
-(ut it is)-.2 F(maintained by hand and does not pretend to be complete.)
-102 637.8 Q .701(This problem will be reduced considerably if people choose to group their hosts into subdo-)
-127 654 R 3.219(mains. This)102 666 R -.1(wo)3.219 G .719
-(uld require a global update only when a ne).1 F 3.22(wt)-.25 G .72
-(op le)-3.22 F -.15(ve)-.25 G 3.22(ld).15 G .72(omain joined the netw)
--3.22 F(ork.)-.1 E 2.805(Am)102 678 S .305
-(essage to a host in a subdomain could simply be routed to a kno)-2.805
-F .304(wn domain g)-.25 F(ate)-.05 E -.1(wa)-.25 G 2.804(yf).1 G .304
-(or further)-2.804 F 3.073(processing. F)102 690 R .573(or e)-.15 F .573
-(xample, the address \231eric@a.bli.UUCP\232 might be routed to the \231bli\232 g)
--.15 F(ate)-.05 E -.1(wa)-.25 G 3.074(yf).1 G(or)-3.074 E(redistrib)102
-702 Q 1.376(ution; ne)-.2 F 3.876(wh)-.25 G 1.375
-(osts could be added within BLI without notifying the rest of the w)
--3.876 F 3.875(orld. Of)-.1 F(course, other hosts)102 714 Q/F2 10
-/Times-Italic@0 SF(could)2.5 E F1(be noti\214ed as an ef)2.5 E
-(\214cienc)-.25 E 2.5(ym)-.15 G(easure.)-2.5 E F0 -1(Ve)72 756 S
-(rsion 8.2)1 E(USENIX \255 J)130.475 E(an 83)-.15 E(Last Mod 11/27/1993)
-88.355 E EP
-%%Page: 8 8
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Bold@0 SF(Mail Systems and Addr)72 60 Q(essing in 4.2bsd)
--.18 E(8)259.93 E/F1 10/Times-Roman@0 SF .966
-(There may be more than one domain g)127 96 R(ate)-.05 E -.1(wa)-.25 G
-4.767 -.65(y. A).1 H .967(domain such as BTL, for instance, might)4.117
-F(ha)102 108 Q .653 -.15(ve a d)-.2 H .353(ozen g).15 F(ate)-.05 E -.1
-(wa)-.25 G .353(ys to the outside w).1 F .352
-(orld; a non-BTL site could choose the closest g)-.1 F(ate)-.05 E -.1
-(wa)-.25 G 4.152 -.65(y. T).1 H(he).65 E .308(only restriction w)102 120
-R .308(ould be that all g)-.1 F(ate)-.05 E -.1(wa)-.25 G .308
-(ys maintain a consistent vie).1 F 2.808(wo)-.25 G 2.808(ft)-2.808 G
-.308(he domain the)-2.808 F 2.808(yr)-.15 G(epresent.)-2.808 E F0 2.5
-(4.4. Logical)87 144 R(Structur)2.5 E(e)-.18 E F1(Logically)127 160.2 Q
-3.803(,d)-.65 G 1.303(omains are or)-3.803 F -.05(ga)-.18 G 1.303
-(nized into a tree.).05 F 1.303
-(There need not be a host actually associated)6.303 F .462(with each le)
-102 172.2 R -.15(ve)-.25 G 2.962(li).15 G 2.962(nt)-2.962 G .462
-(he tree \212 for e)-2.962 F .462
-(xample, there will be no host associated with the name \231UUCP)-.15 F
--.7<2e9a>-1.11 G(Similarly)102 184.2 Q 3.115(,a)-.65 G 3.115(no)-3.115 G
--2.19 -.18(rg a)-3.115 H .614
-(nization might group names together for administrati).18 F .914 -.15
-(ve r)-.25 H .614(easons; for e).15 F .614(xample, the)-.15 F(name)102
-196.2 Q(CAD.research.BigCorp.UUCP)142 212.4 Q(might not actually ha)102
-228.6 Q .3 -.15(ve a h)-.2 H(ost representing \231research.).15 E<9a>-.7
-E(Ho)127 244.8 Q(we)-.25 E -.15(ve)-.25 G 1.531 -.4(r, i).15 H 3.231(tm)
-.4 G .731(ay frequently be con)-3.231 F -.15(ve)-.4 G .731(nient to ha)
-.15 F 1.031 -.15(ve a h)-.2 H .732
-(ost or hosts that \231represent\232 a domain.).15 F -.15(Fo)102 256.8 S
-3.466(re).15 G .966(xample, if a single host e)-3.616 F .966
-(xists that represents Berk)-.15 F(ele)-.1 E 2.266 -.65(y, t)-.15 H .966
-(hen mail from outside Berk).65 F(ele)-.1 E 3.466(yc)-.15 G(an)-3.466 E
-(forw)102 268.8 Q .796
-(ard mail to that host for further resolution without kno)-.1 F .796
-(wing Berk)-.25 F(ele)-.1 E(y')-.15 E 3.296(s\()-.55 G .797(rather v)
--3.296 F .797(olatile\) topol-)-.2 F(ogy)102 280.8 Q 5(.T)-.65 G
-(his is not unlik)-5 E 2.5(et)-.1 G(he operation of the telephone netw)
--2.5 E(ork.)-.1 E .053(This may also be useful inside certain lar)127
-297 R .053(ge domains.)-.18 F -.15(Fo)5.053 G 2.553(re).15 G .053
-(xample, at Berk)-2.703 F(ele)-.1 E 2.553(yi)-.15 G 2.553(tm)-2.553 G
-.053(ay be pre-)-2.553 F .722(sumed that most hosts kno)102 309 R 3.222
-(wa)-.25 G .722(bout other hosts inside the Berk)-3.222 F(ele)-.1 E
-3.223(yd)-.15 G 3.223(omain. But)-3.223 F .723(if the)3.223 F 3.223(yp)
--.15 G .723(rocess an)-3.223 F .405(address that is unkno)102 321 R .405
-(wn, the)-.25 F 2.905(yc)-.15 G .405
-(an pass it \231upstairs\232 for further e)-2.905 F 2.905
-(xamination. Thus)-.15 F .405(as ne)2.905 F 2.905(wh)-.25 G .405
-(osts are)-2.905 F .488(added only one host \(the domain master\))102
-333 R/F2 10/Times-Italic@0 SF(must)2.989 E F1 .489
-(be updated immediately; other hosts can be updated)2.989 F(as con)102
-345 Q -.15(ve)-.4 G(nient.).15 E .583
-(Ideally this name resolution process w)127 361.2 R .583
-(ould be performed by a name serv)-.1 F .582(er \(e.g., [Su82b]\) to)
--.15 F -.2(avo)102 373.2 S .507(id unnecessary cop).2 F .507
-(ying of the message.)-.1 F(Ho)5.507 E(we)-.25 E -.15(ve)-.25 G 1.307
--.4(r, i).15 H 3.007(nab).4 G .507(atch netw)-3.007 F .508
-(ork such as UUCP this could)-.1 F(result in unnecessary delays.)102
-385.2 Q F0 2.5(5. COMP)72 409.2 R(ARISON WITH DELIVERMAIL)-.74 E F2
-(Sendmail)112 425.4 Q F1(is an outgro)2.5 E(wth of)-.25 E F2
-(delivermail)2.5 E F1 5(.T)C(he primary dif)-5 E(ferences are:)-.25 E
-12.5(\(1\) Con\214guration)92 441.6 R .573
-(information is not compiled in.)3.073 F .572
-(This change simpli\214es man)5.572 F 3.072(yo)-.15 G 3.072(ft)-3.072 G
-.572(he problems of)-3.072 F(mo)118.66 453.6 Q(ving to other machines.)
--.15 E(It also allo)5 E(ws easy deb)-.25 E(ugging of ne)-.2 E 2.5(wm)
--.25 G(ailers.)-2.5 E 12.5(\(2\) Address)92 469.8 R .491
-(parsing is more \215e)2.991 F 2.991(xible. F)-.15 F .491(or e)-.15 F
-(xample,)-.15 E F2(delivermail)2.992 E F1 .492(only supported one g)
-2.992 F(ate)-.05 E -.1(wa)-.25 G 2.992(yt).1 G 2.992(oa)-2.992 G -.15
-(ny)-2.992 G(netw)118.66 481.8 Q(ork, whereas)-.1 E F2(sendmail)2.5 E F1
-(can be sensiti)2.5 E .3 -.15(ve t)-.25 H 2.5(oh).15 G
-(ost names and reroute to dif)-2.5 E(ferent g)-.25 E(ate)-.05 E -.1(wa)
--.25 G(ys.).1 E 12.5(\(3\) F)92 498 R(orw)-.15 E 2.878(arding and :include: features eliminate the requirement that the system alias \214le be)
--.1 F 1.073(writable by an)118.66 510 R 3.573(yu)-.15 G 1.073(ser \(or that an update program be written, or that the system administration)
--3.573 F(mak)118.66 522 Q 2.5(ea)-.1 G(ll changes\).)-2.5 E(\(4\))92
-538.2 Q F2(Sendmail)15 E F1 .443(supports message batching across netw)
-2.944 F .443(orks when a message is being sent to multiple)-.1 F
-(recipients.)118.66 550.2 Q 12.5(\(5\) A)92 566.4 R 1.945
-(mail queue is pro)4.445 F 1.946(vided in)-.15 F F2(sendmail.)4.446 E F1
-1.946(Mail that cannot be deli)6.946 F -.15(ve)-.25 G 1.946
-(red immediately b).15 F 1.946(ut can)-.2 F .439(potentially be deli)
-118.66 578.4 R -.15(ve)-.25 G .438
-(red later is stored in this queue for a later retry).15 F 5.438(.T)-.65
-G .438(he queue also pro)-5.438 F .438(vides a)-.15 F -.2(bu)118.66
-590.4 S -.25(ff).2 G .838(er ag).25 F .839(ainst system crashes; after the message has been collected it may be reliably redeli)
--.05 F(v-)-.25 E(ered e)118.66 602.4 Q -.15(ve)-.25 G 2.5(ni).15 G 2.5
-(ft)-2.5 G(he system crashes during the initial deli)-2.5 E -.15(ve)-.25
-G(ry).15 E(.)-.65 E(\(6\))92 618.6 Q F2(Sendmail)15 E F1 1.351
-(uses the netw)3.851 F 1.351(orking support pro)-.1 F 1.351
-(vided by 4.2BSD to pro)-.15 F 1.35(vide a direct interf)-.15 F 1.35
-(ace net-)-.1 F -.1(wo)118.66 630.6 S .283(rks such as the ARP).1 F .284
-(ANET and/or Ethernet using SMTP \(the Simple Mail T)-.92 F .284
-(ransfer Protocol\))-.35 F -.15(ove)118.66 642.6 S 2.5(raT).15 G
-(CP/IP connection.)-2.5 E F0 -1(Ve)72 756 S(rsion 8.2)1 E(USENIX \255 J)
-130.475 E(an 83)-.15 E(Last Mod 11/27/1993)88.355 E EP
-%%Page: 9 9
-%%BeginPageSetup
-BP
-%%EndPageSetup
-/F0 10/Times-Roman@0 SF(REFERENCES)264.105 132 Q([Crock)87 148.2 Q 56.73
-(er77] Crock)-.1 F(er)-.1 E 3.535(,D)-.4 G 3.535(.H)-3.535 G 1.035(., V)
--3.535 F 1.035(ittal, J. J., Pogran, K. T)-.6 F 1.035
-(., and Henderson, D. A. Jr)-.74 F(.,)-.55 E/F1 10/Times-Italic@0 SF
-(Stan-)3.535 E(dar)195 160.2 Q 2.627(df)-.37 G .127(or the F)-2.627 F
-.127(ormat of ARP)-1.05 F 2.627(AN)-.9 G .128(etwork T)-2.627 F -.2(ex)
--.92 G 2.628(tM).2 G(essa)-2.628 E -.1(ge)-.1 G(s.).1 E F0 .128
-(RFC 733, NIC 41952.)5.128 F(In [Feinler78].)195 172.2 Q(No)5 E -.15(ve)
--.15 G(mber 1977.).15 E([Crock)87 188.4 Q 56.73(er82] Crock)-.1 F(er)-.1
-E 4.272(,D)-.4 G 4.272(.H)-4.272 G(.,)-4.272 E F1(Standar)4.272 E 4.272
-(df)-.37 G 1.772(or the F)-4.272 F 1.772(ormat of Arpa Internet T)-1.05
-F -.2(ex)-.92 G 4.271(tM).2 G(essa)-4.271 E -.1(ge)-.1 G(s.).1 E F0 .025
-(RFC 822.)195 200.4 R(Netw)5.025 E .025(ork Information Center)-.1 F
-2.526(,S)-.4 G .026(RI International, Menlo P)-2.526 F .026(ark, Cali-)
--.15 F 2.5(fornia. August)195 212.4 R(1982.)2.5 E 60.51
-([Feinler78] Feinler)87 228.6 R 2.938(,E)-.4 G .438(., and Postel, J.)
--2.938 F(\(eds.\),)5.438 E F1(ARP)2.938 E .438(ANET Pr)-.9 F .438
-(otocol Handbook.)-.45 F F0 .438(NIC 7104,)5.438 F(Netw)195 240.6 Q
-3.011(ork Information Center)-.1 F 5.511(,S)-.4 G 3.012
-(RI International, Menlo P)-5.511 F 3.012(ark, California.)-.15 F(1978.)
-195 252.6 Q([No)87 268.8 Q 59.65(witz78] No)-.25 F .479
-(witz, D. A., and Lesk, M. E.,)-.25 F F1 2.978(AD)2.978 G .478
-(ial-Up Network of UNIX Systems.)-2.978 F F0(Bell)5.478 E 3.528
-(Laboratories. In)195 280.8 R 1.029(UNIX Programmer')3.528 F 3.529(sM)
--.55 G 1.029(anual, Se)-3.529 F -.15(ve)-.25 G 1.029(nth Edition, V).15
-F 1.029(olume 2.)-1.29 F(August, 1978.)195 292.8 Q 55.5
-([Schmidt79] Schmidt,)87 309 R(E.,)2.631 E F1 .131(An Intr)2.631 F .131
-(oduction to the Berk)-.45 F(ele)-.1 E 2.631(yN)-.3 G(etwork.)-2.631 E
-F0(Uni)5.131 E -.15(ve)-.25 G .131(rsity of Califor).15 F(-)-.2 E
-(nia, Berk)195 321 Q(ele)-.1 E 2.5(yC)-.15 G 2.5(alifornia. 1979.)-2.5 F
-59.95([Shoens79] Shoens,)87 337.2 R(K.,)3.227 E F1 .728(Mail Refer)3.227
-F .728(ence Manual.)-.37 F F0(Uni)5.728 E -.15(ve)-.25 G .728
-(rsity of California, Berk).15 F(ele)-.1 E 4.528 -.65(y. I)-.15 H(n).65
-E 3.478(UNIX Programmer')195 349.2 R 5.977(sM)-.55 G 3.477(anual, Se)
--5.977 F -.15(ve)-.25 G 3.477(nth Edition, V).15 F 3.477(olume 2C.)-1.29
-F(December)8.477 E(1979.)195 361.2 Q 52.72([Solomon81] Solomon,)87 377.4
-R .251(M., Landweber)2.75 F 2.751(,L)-.4 G .251(., and Neuhengen, D.,)
--2.751 F F1 .251(The Design of the CSNET)2.751 F .397(Name Server)195
-389.4 R(.)-1.11 E F0 2.896(CS-DN-2. Uni)5.397 F -.15(ve)-.25 G .396
-(rsity of W).15 F .396(isconsin, Madison.)-.4 F .396(October 1981.)5.396
-F 73.84([Su82a] Su,)87 405.6 R(Za)2.844 E .344(w-Sing, and Postel, Jon,)
--.15 F F1 .344(The Domain Naming Con)2.844 F .344(vention for Internet)
--.4 F 2.71(User Applications.)195 417.6 R F0 5.21(RFC819. Netw)7.71 F
-2.71(ork Information Center)-.1 F 5.21(,S)-.4 G 2.71(RI Interna-)-5.21 F
-(tional, Menlo P)195 429.6 Q(ark, California.)-.15 E(August 1982.)5 E
-73.28([Su82b] Su,)87 445.8 R(Za)4.174 E(w-Sing,)-.15 E F1 4.174(AD)4.174
-G(istrib)-4.174 E 1.675(uted System for Internet Name Service)-.2 F(.)
--.15 E F0(RFC830.)6.675 E(Netw)195 457.8 Q 3.012(ork Information Center)
--.1 F 5.512(,S)-.4 G 3.011(RI International, Menlo P)-5.512 F 3.011
-(ark, California.)-.15 F(October 1982.)195 469.8 Q/F2 10/Times-Bold@0 SF
-(Mail Systems and Addr)72 756 Q(essing in 4.2bsd)-.18 E(9)259.93 E EP
-%%Trailer
-end
-%%EOF
+++ /dev/null
-# $OpenBSD: Makefile,v 1.2 1996/12/14 21:16:45 downsj Exp $
-# @(#)Makefile 8.2 (Berkeley) 9/21/96
-
-PROG= mailstats
-MAN= mailstats.8
-CFLAGS+=-I${.CURDIR}/../src
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
+++ /dev/null
-#
-# This Makefile is designed to work on the old "make" program.
-#
-# @(#)Makefile.m4 8.15 (Berkeley) 7/12/1998
-#
-
-# C compiler
-CC= confCC
-
-# Shell
-SHELL= confSHELL
-
-# use O=-O (usual) or O=-g (debugging)
-O= ifdef(`confOPTIMIZE', `confOPTIMIZE', `-O')
-
-# location of sendmail source directory
-SRCDIR= ifdef(`confSRCDIR', `confSRCDIR', `../../src')
-
-# environment definitions (e.g., -D_AIX3)
-ENVDEF= ifdef(`confENVDEF', `confENVDEF')
-
-# see also conf.h for additional compilation flags
-
-# include directories
-INCDIRS=-I${SRCDIR} confINCDIRS
-
-# loader options
-LDOPTS= ifdef(`confLDOPTS', `confLDOPTS')
-
-# library directories
-LIBDIRS=confLIBDIRS
-
-# libraries required on your system
-LIBS= ifdef(`confLIBS', `confLIBS')
-
-# location of mailstats binary (usually /usr/sbin or /usr/etc)
-SBINDIR=${DESTDIR}ifdef(`confSBINDIR', `confSBINDIR', `/usr/sbin')
-
-# additional .o files needed
-OBJADD= ifdef(`confOBJADD', `confOBJADD')
-
-undivert(1)
-
-################### end of user configuration flags ######################
-
-BUILDBIN=confBUILDBIN
-COPTS= -I. ${INCDIRS} ${ENVDEF}
-CFLAGS= $O ${COPTS}
-
-BEFORE= confBEFORE
-OBJS= mailstats.o ${OBJADD}
-
-NROFF= ifdef(`confNROFF', `confNROFF', `groff -Tascii')
-MANDOC= ifdef(`confMANDOC', `confMANDOC', `-mandoc')
-
-INSTALL=ifdef(`confINSTALL', `confINSTALL', `install')
-BINOWN= ifdef(`confUBINOWN', `confUBINOWN', `bin')
-BINGRP= ifdef(`confUBINGRP', `confUBINGRP', `bin')
-BINMODE=ifdef(`confUBINMODE', `confUBINMODE', `555')
-
-MANOWN= ifdef(`confMANOWN', `confMANOWN', `bin')
-MANGRP= ifdef(`confMANGRP', `confMANGRP', `bin')
-MANMODE=ifdef(`confMANMODE', `confMANMODE', `444')
-
-MANROOT=${DESTDIR}ifdef(`confMANROOT', `confMANROOT', `/usr/share/man/cat')
-MAN8= ${MANROOT}ifdef(`confMAN8', `confMAN8', `8')
-MAN8EXT=ifdef(`confMAN8EXT', `confMAN8EXT', `8')
-MAN8SRC=ifdef(`confMAN8SRC', `confMAN8SRC', `0')
-
-ALL= mailstats mailstats.${MAN8SRC}
-
-all: ${ALL}
-
-mailstats: ${BEFORE} ${OBJS}
- ${CC} -o mailstats ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
-
-undivert(3)
-
-mailstats.${MAN8SRC}: mailstats.8
- ${NROFF} ${MANDOC} mailstats.8 > mailstats.${MAN8SRC}
-
-install: install-mailstats install-docs
-
-install-mailstats: mailstats
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} mailstats ${SBINDIR}
-
-install-docs: mailstats.${MAN8SRC}
-ifdef(`confNO_MAN_INSTALL', `dnl',
-` ${INSTALL} -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} mailstats.${MAN8SRC} ${MAN8}/mailstats.${MAN8EXT}')
-
-clean:
- rm -f ${OBJS} mailstats mailstats.${MAN8SRC}
-
-################ Dependency scripts
-include(confBUILDTOOLSDIR/M4/depend/ifdef(`confDEPEND_TYPE', `confDEPEND_TYPE',
-`generic').m4)dnl
-################ End of dependency scripts
+++ /dev/null
-.\" Copyright (c) 1998 Sendmail, Inc. 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.
-.\"
-.\"
-.\" @(#)mailstats.8 8.8 (Berkeley) 11/13/1998
-.\"
-.Dd April 25, 1996
-.Dt MAILSTATS 1
-.Os
-.Sh NAME
-.Nm mailstats
-.Nd display mail statistics
-.Sh SYNOPSIS
-.Nm mailstats
-.Op Fl o
-.if \nP .Op Fl p
-.Op Fl C Ar cffile
-.Op Fl f Ar stfile
-.Sh DESCRIPTION
-The
-.Nm mailstats
-utility displays the current mail statistics.
-.Pp
-First, the time at which statistics started being kept is displayed,
-in the format specified by
-.Xr ctime 3 .
-Then,
-the statistics for each mailer are displayed on a single line,
-each with the following whitespace separated fields:
-.Pp
-.Bl -tag -width 10n -offset indent -compact
-.It Sy M
-The mailer number.
-.It Sy msgsfr
-Number of messages from the mailer.
-.It Sy bytes_from
-Kbytes from the mailer.
-.It Sy msgsto
-Number of messages to the mailer.
-.It Sy bytes_to
-Kbytes to the mailer.
-.It Sy msgsrej
-Number of messages rejected.
-.It Sy msgsdis
-Number of messages discarded.
-.It Sy Mailer
-The name of the mailer.
-.El
-.Pp
-After this display, a line totaling the values for all of the mailers
-is displayed,
-separated from the previous information by a line containing only equals
-.Pq Dq \&=
-characters.
-.Pp
-The options are as follows:
-.Bl -tag -width Ds
-.It Fl C
-Read the specified file instead of the default
-.Nm sendmail
-.Dq cf
-file.
-.It Fl f
-Read the specified statistics file instead of the statistics file
-specified in the
-.Nm sendmail
-.Dq cf
-file.
-.if \nP \
-\{
-.It Fl p
-Output information in program-readable mode and clear statistics.
-.\}
-.It Fl o
-Don't display the name of the mailer in the output.
-.El
-.Pp
-The
-.Nm mailstats
-utility exits 0 on success, and >0 if an error occurs.
-.Sh FILES
-.Bl -tag -width /var/log/sendmail.stXX -compact
-.ie \nP .It Pa /etc/mail/sendmail.cf
-.el .It Pa /etc/sendmail.cf
-The default
-.Nm sendmail
-.Dq cf
-file.
-.ie \nP .It Pa /etc/mail/statistics
-.el .It Pa /var/log/sendmail.st
-The default
-.Nm sendmail
-statistics file.
-.El
-.Sh SEE ALSO
-.Xr mailq 1 ,
-.Xr sendmail 8
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- *
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1988, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)mailstats.c 8.29 (Berkeley) 1/25/1999";
-#endif /* not lint */
-
-#ifndef NOT_SENDMAIL
-# define NOT_SENDMAIL
-#endif
-#include <sendmail.h>
-#include <mailstats.h>
-#include <pathnames.h>
-
-#define MNAMELEN 20 /* max length of mailer name */
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- extern char *optarg;
- extern int optind;
- struct statistics stat;
- register int i;
- int mno;
- int ch, fd;
- char *sfile;
- char *cfile;
- FILE *cfp;
- bool mnames;
- bool progmode;
- long frmsgs = 0, frbytes = 0, tomsgs = 0, tobytes = 0, rejmsgs = 0;
- long dismsgs = 0;
- char mtable[MAXMAILERS][MNAMELEN+1];
- char sfilebuf[MAXLINE];
- char buf[MAXLINE];
- time_t now;
- extern char *ctime();
-
- cfile = _PATH_SENDMAILCF;
- sfile = NULL;
- mnames = TRUE;
- progmode = FALSE;
- while ((ch = getopt(argc, argv, "C:f:op")) != EOF)
- {
- switch (ch)
- {
- case 'C':
- cfile = optarg;
- break;
-
- case 'f':
- sfile = optarg;
- break;
-
- case 'o':
- mnames = FALSE;
- break;
-
-#if _FFR_MAILSTATS_PROGMODE
- case 'p':
- progmode = TRUE;
- break;
-#endif
-
- case '?':
- default:
- usage:
-#if _FFR_MAILSTATS_PROGMODE
- fputs("usage: mailstats [-C cffile] [-f stfile] -o -p\n",
- stderr);
-#else
- fputs("usage: mailstats [-C cffile] [-f stfile] -o \n",
- stderr);
-#endif
- exit(EX_USAGE);
- }
- }
- argc -= optind;
- argv += optind;
-
- if (argc != 0)
- goto usage;
-
- if ((cfp = fopen(cfile, "r")) == NULL)
- {
- fprintf(stderr, "mailstats: ");
- perror(cfile);
- exit(EX_NOINPUT);
- }
-
- mno = 0;
- (void) strcpy(mtable[mno++], "prog");
- (void) strcpy(mtable[mno++], "*file*");
- (void) strcpy(mtable[mno++], "*include*");
-
- while (fgets(buf, sizeof(buf), cfp) != NULL)
- {
- register char *b;
- char *s;
- register char *m;
-
- b = buf;
- switch (*b++)
- {
- case 'M': /* mailer definition */
- break;
-
- case 'O': /* option -- see if .st file */
- if (strncasecmp(b, " StatusFile", 11) == 0 &&
- !(isascii(b[11]) && isalnum(b[11])))
- {
- /* new form -- find value */
- b = strchr(b, '=');
- if (b == NULL)
- continue;
- while (isascii(*++b) && isspace(*b))
- continue;
- }
- else if (*b++ != 'S')
- {
- /* something else boring */
- continue;
- }
-
- /* this is the S or StatusFile option -- save it */
- if (strlen(b) >= sizeof sfilebuf)
- {
- fprintf(stderr,
- "StatusFile filename too long: %.30s...\n",
- b);
- exit(EX_CONFIG);
- }
- strcpy(sfilebuf, b);
- b = strchr(sfilebuf, '#');
- if (b == NULL)
- b = strchr(sfilebuf, '\n');
- if (b == NULL)
- b = &sfilebuf[strlen(sfilebuf)];
- while (isascii(*--b) && isspace(*b))
- continue;
- *++b = '\0';
- if (sfile == NULL)
- sfile = sfilebuf;
-
- default:
- continue;
- }
-
- if (mno >= MAXMAILERS)
- {
- fprintf(stderr,
- "Too many mailers defined, %d max.\n",
- MAXMAILERS);
- exit(EX_SOFTWARE);
- }
- m = mtable[mno];
- s = m + MNAMELEN; /* is [MNAMELEN+1] */
- while (*b != ',' && !(isascii(*b) && isspace(*b)) &&
- *b != '\0' && m < s)
- *m++ = *b++;
- *m = '\0';
- for (i = 0; i < mno; i++)
- {
- if (strcmp(mtable[i], mtable[mno]) == 0)
- break;
- }
- if (i == mno)
- mno++;
- }
- (void) fclose(cfp);
- for (; mno < MAXMAILERS; mno++)
- mtable[mno][0]='\0';
-
- if (sfile == NULL)
- {
- fprintf(stderr, "mailstats: no statistics file located\n");
- exit (EX_OSFILE);
- }
-
- if ((fd = open(sfile, O_RDONLY)) < 0 ||
- (i = read(fd, &stat, sizeof stat)) < 0)
- {
- fputs("mailstats: ", stderr);
- perror(sfile);
- exit(EX_NOINPUT);
- }
- if (i == 0)
- {
- sleep(1);
- if ((i = read(fd, &stat, sizeof stat)) < 0)
- {
- fputs("mailstats: ", stderr);
- perror(sfile);
- exit(EX_NOINPUT);
- }
- else if (i == 0)
- {
- bzero((ARBPTR_T) &stat, sizeof stat);
- (void) time(&stat.stat_itime);
- }
- }
- if (i != 0)
- {
- if (stat.stat_magic != STAT_MAGIC)
- {
- fprintf(stderr,
- "mailstats: incorrect magic number in %s\n",
- sfile);
- exit(EX_OSERR);
- }
- else if (stat.stat_version != STAT_VERSION)
- {
- fprintf(stderr,
- "mailstats version (%d) incompatible with %s version(%d)\n",
- STAT_VERSION, sfile, stat.stat_version);
- exit(EX_OSERR);
- }
- else if (i != sizeof stat || stat.stat_size != sizeof(stat))
- {
- fputs("mailstats: file size changed.\n", stderr);
- exit(EX_OSERR);
- }
- }
-
- if (progmode)
- {
- time(&now);
- printf("%ld %ld\n", (long) stat.stat_itime, (long) now);
- }
- else
- {
- printf("Statistics from %s", ctime(&stat.stat_itime));
- printf(" M msgsfr bytes_from msgsto bytes_to msgsrej msgsdis%s\n",
- mnames ? " Mailer" : "");
- }
- for (i = 0; i < MAXMAILERS; i++)
- {
- if (stat.stat_nf[i] || stat.stat_nt[i] ||
- stat.stat_nr[i] || stat.stat_nd[i])
- {
- char *format;
-
- if (progmode)
- format = "%2d %8ld %10ld %8ld %10ld %6ld %6ld";
- else
- format = "%2d %8ld %10ldK %8ld %10ldK %6ld %6ld";
- printf(format, i,
- stat.stat_nf[i], stat.stat_bf[i],
- stat.stat_nt[i], stat.stat_bt[i],
- stat.stat_nr[i], stat.stat_nd[i]);
- if (mnames)
- printf(" %s", mtable[i]);
- printf("\n");
- frmsgs += stat.stat_nf[i];
- frbytes += stat.stat_bf[i];
- tomsgs += stat.stat_nt[i];
- tobytes += stat.stat_bt[i];
- rejmsgs += stat.stat_nr[i];
- dismsgs += stat.stat_nd[i];
- }
- }
- if (progmode)
- {
- printf(" T %8ld %10ld %8ld %10ld %6ld %6ld\n",
- frmsgs, frbytes, tomsgs, tobytes, rejmsgs, dismsgs);
- close(fd);
- fd = open(sfile, O_RDWR | O_TRUNC);
- if (fd >= 0)
- close(fd);
- }
- else
- {
- printf("=============================================================\n");
- printf(" T %8ld %10ldK %8ld %10ldK %6ld %6ld\n",
- frmsgs, frbytes, tomsgs, tobytes, rejmsgs, dismsgs);
- }
- exit(EX_OK);
-}
+++ /dev/null
-# $OpenBSD: Makefile,v 1.3 1997/07/15 07:23:53 downsj Exp $
-# @(#)Makefile 8.1 (Berkeley) 6/7/93
-
-.PATH: ${.CURDIR}/../src
-
-PROG= makemap
-MAN= makemap.8
-CFLAGS+=-I${.CURDIR}/../src -DNEWDB -DNOT_SENDMAIL
-
-SRCS= makemap.c safefile.c
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
+++ /dev/null
-#
-# This Makefile is designed to work on the old "make" program.
-#
-# @(#)Makefile.m4 8.21 (Berkeley) 7/12/1998
-#
-
-# C compiler
-CC= confCC
-
-# Shell
-SHELL= confSHELL
-
-# use O=-O (usual) or O=-g (debugging)
-O= ifdef(`confOPTIMIZE', `confOPTIMIZE', `-O')
-
-# location of sendmail source directory
-SRCDIR= ifdef(`confSRCDIR', `confSRCDIR', `../../src')
-
-# define the database mechanisms available for map & alias lookups:
-# -DNDBM -- use new DBM
-# -DNEWDB -- use new Berkeley DB
-# The really old (V7) DBM library is no longer supported.
-#
-MAPDEF= ifdef(`confMAPDEF', `confMAPDEF')
-
-# environment definitions (e.g., -D_AIX3)
-ENVDEF= -DNOT_SENDMAIL ifdef(`confENVDEF', `confENVDEF')
-
-# see also conf.h for additional compilation flags
-
-# include directories
-INCDIRS=-I${SRCDIR} confINCDIRS
-
-# loader options
-LDOPTS= ifdef(`confLDOPTS', `confLDOPTS')
-
-# library directories
-LIBDIRS=confLIBDIRS
-
-# libraries required on your system
-LIBS= ifdef(`confLIBS', `confLIBS')
-
-# location of makemap binary (usually /usr/sbin or /usr/etc)
-SBINDIR=${DESTDIR}ifdef(`confSBINDIR', `confSBINDIR', `/usr/sbin')
-
-# additional .o files needed
-OBJADD= ifdef(`confOBJADD', `confOBJADD')
-
-undivert(1)
-
-################### end of user configuration flags ######################
-
-BUILDBIN=confBUILDBIN
-COPTS= -I. ${INCDIRS} ${MAPDEF} ${ENVDEF}
-CFLAGS= $O ${COPTS}
-
-BEFORE= confBEFORE safefile.c snprintf.c
-OBJS= makemap.o safefile.o snprintf.o ${OBJADD}
-
-NROFF= ifdef(`confNROFF', `confNROFF', `groff -Tascii')
-MANDOC= ifdef(`confMANDOC', `confMANDOC', `-mandoc')
-
-INSTALL=ifdef(`confINSTALL', `confINSTALL', `install')
-BINOWN= ifdef(`confUBINOWN', `confUBINOWN', `bin')
-BINGRP= ifdef(`confUBINGRP', `confUBINGRP', `bin')
-BINMODE=ifdef(`confUBINMODE', `confUBINMODE', `555')
-
-MANOWN= ifdef(`confMANOWN', `confMANOWN', `bin')
-MANGRP= ifdef(`confMANGRP', `confMANGRP', `bin')
-MANMODE=ifdef(`confMANMODE', `confMANMODE', `444')
-
-MANROOT=${DESTDIR}ifdef(`confMANROOT', `confMANROOT', `/usr/share/man/cat')
-MAN8= ${MANROOT}ifdef(`confMAN8', `confMAN8', `8')
-MAN8EXT=ifdef(`confMAN8EXT', `confMAN8EXT', `8')
-MAN8SRC=ifdef(`confMAN8SRC', `confMAN8SRC', `0')
-
-ALL= makemap makemap.${MAN8SRC}
-
-all: ${ALL}
-
-makemap: ${BEFORE} ${OBJS}
- ${CC} -o makemap ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
-
-safefile.c: ${SRCDIR}/safefile.c
- -ln -s ${SRCDIR}/safefile.c safefile.c
-
-snprintf.c: ${SRCDIR}/snprintf.c
- -ln -s ${SRCDIR}/snprintf.c snprintf.c
-
-undivert(3)
-
-makemap.${MAN8SRC}: makemap.8
- ${NROFF} ${MANDOC} makemap.8 > makemap.${MAN8SRC}
-
-install: install-makemap install-docs
-
-install-makemap: makemap
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} makemap ${SBINDIR}
-
-install-docs: makemap.${MAN8SRC}
-ifdef(`confNO_MAN_INSTALL', `dnl',
-` ${INSTALL} -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} makemap.${MAN8SRC} ${MAN8}/makemap.${MAN8EXT}')
-
-clean:
- rm -f ${OBJS} makemap makemap.${MAN8SRC}
-
-################ Dependency scripts
-include(confBUILDTOOLSDIR/M4/depend/ifdef(`confDEPEND_TYPE', `confDEPEND_TYPE',
-`generic').m4)dnl
-################ End of dependency scripts
+++ /dev/null
-.\" Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-.\" Copyright (c) 1988, 1991, 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.
-.\"
-.\"
-.\" @(#)makemap.8 8.12 (Berkeley) 11/13/1998
-.\"
-.Dd November 16, 1992
-.Dt MAKEMAP 8
-.Os
-.Sh NAME
-.Nm makemap
-.Nd create database maps for sendmail
-.Sh SYNOPSIS
-.Nm makemap
-.Op Fl N
-.if \nP .Op Fl c Ar cachesize
-.Op Fl d
-.Op Fl f
-.if \nP .Op Fl l
-.Op Fl o
-.Op Fl r
-.Op Fl s
-.Op Fl v
-.Ar maptype
-.Ar mapname
-.Sh DESCRIPTION
-.Nm
-creates the database maps used by the keyed map lookups in
-.Xr sendmail 8 .
-It reads input from the standard input
-and outputs them to the indicated
-.Ar mapname .
-.Pp
-Depending on how it is compiled,
-.Nm
-handles up to three different database formats,
-selected using the
-.Ar maptype
-parameter.
-They may be
-.Bl -tag -width Fl
-.It Li dbm
-DBM format maps.
-This requires the
-.Xr ndbm 3
-library.
-.It Li btree
-B-Tree format maps.
-This requires the new Berkeley DB
-library.
-.It Li hash
-Hash format maps.
-This also requires the Berkeley DB
-library.
-.El
-.Pp
-In all cases,
-.Nm
-reads lines from the standard input consisting of two
-words separated by whitespace.
-The first is the database key,
-the second is the value.
-The value may contain
-``%\fIn\fP''
-strings to indicated parameter substitution.
-Literal percents should be doubled
-(``%%'').
-Blank lines and lines beginning with ``#'' are ignored.
-.Ss Flags
-.Bl -tag -width Fl
-.It Fl N
-Include the null byte that terminates strings
-in the map.
-This must match the \-N flag in the sendmail.cf
-``K'' line.
-.if \nP \
-\{\
-.It Fl c
-Use the specified hash and B-Tree cache size.
-.\}
-.It Fl d
-Allow duplicate keys in the map.
-This is only allowed on B-Tree format maps.
-If two identical keys are read,
-they will both be inserted into the map.
-.It Fl f
-Normally all upper case letters in the key
-are folded to lower case.
-This flag disables that behaviour.
-This is intended to mesh with the
-\-f flag in the
-\fBK\fP
-line in sendmail.cf.
-The value is never case folded.
-.if \nP \
-\{\
-.It Fl l
-List supported map types.
-.\}
-.It Fl o
-Append to an old file.
-This allows you to augment an existing file.
-.It Fl r
-Allow replacement of existing keys.
-Normally
-.Nm
-complains if you repeat a key,
-and does not do the insert.
-.It Fl s
-Ignore safety checks on maps being created.
-This includes checking for hard or symbolic
-links in world writable directories.
-.It Fl v
-Verbosely print what it is doing.
-.El
-.Sh SEE ALSO
-.Xr sendmail 8
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.4 .
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1992 Eric P. Allman. All rights reserved.
- * Copyright (c) 1992, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)makemap.c 8.71 (Berkeley) 11/29/1998";
-#endif /* not lint */
-
-#include <sys/types.h>
-#include <sys/errno.h>
-#ifndef ISC_UNIX
-# include <sys/file.h>
-#endif
-#include "sendmail.h"
-#include "pathnames.h"
-
-#ifdef NDBM
-# include <ndbm.h>
-#endif
-
-#ifdef NEWDB
-# include <db.h>
-# ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-# endif
-#endif
-
-enum type { T_DBM, T_BTREE, T_HASH, T_ERR, T_UNKNOWN };
-
-union dbent
-{
-#ifdef NDBM
- datum dbm;
-#endif
-#ifdef NEWDB
- DBT db;
-#endif
- struct
- {
- char *data;
- size_t size;
- } xx;
-};
-
-uid_t RealUid;
-gid_t RealGid;
-char *RealUserName;
-uid_t RunAsUid;
-uid_t RunAsGid;
-char *RunAsUserName;
-int Verbose = 2;
-bool DontInitGroups = FALSE;
-long DontBlameSendmail = DBS_SAFE;
-u_char tTdvect[100];
-uid_t TrustedUid = 0;
-
-#define BUFSIZE 1024
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- char *progname;
- char *cfile;
- bool inclnull = FALSE;
- bool notrunc = FALSE;
- bool allowreplace = FALSE;
- bool allowdups = FALSE;
- bool verbose = FALSE;
- bool foldcase = TRUE;
- int exitstat;
- int opt;
- char *typename = NULL;
- char *mapname = NULL;
- char *ext = NULL;
- int lineno;
- int st;
- int mode;
- int putflags = 0;
-#ifdef NEWDB
- long dbcachesize = 1024 * 1024;
-#endif
- enum type type;
-#if !O_EXLOCK
- int fd;
-#endif
- int sff = SFF_ROOTOK|SFF_REGONLY;
- struct passwd *pw;
- union
- {
-#ifdef NDBM
- DBM *dbm;
-#endif
-#ifdef NEWDB
- DB *db;
-#endif
- void *dbx;
- } dbp;
- union dbent key, val;
-#ifdef NEWDB
-# if DB_VERSION_MAJOR < 2
- BTREEINFO bti;
- HASHINFO hinfo;
-# else
- DB_INFO dbinfo;
-# endif
-#endif
- char ibuf[BUFSIZE];
- char fbuf[MAXNAME];
- char dbuf[MAXNAME];
-#ifdef NDBM
- char pbuf[MAXNAME];
-#endif
-#if _FFR_TRUSTED_USER
- FILE *cfp;
- char buf[MAXLINE];
-#endif
- static char rnamebuf[MAXNAME]; /* holds RealUserName */
- struct stat std;
-#ifdef NDBM
- struct stat stp;
-#endif
- extern char *optarg;
- extern int optind;
-
- progname = argv[0];
- cfile = _PATH_SENDMAILCF;
-
- RunAsUid = RealUid = getuid();
- RunAsGid = RealGid = getgid();
- pw = getpwuid(RealUid);
- if (pw != NULL)
- {
- if (strlen(pw->pw_name) > MAXNAME - 1)
- pw->pw_name[MAXNAME] = 0;
- sprintf(rnamebuf, "%s", pw->pw_name);
- }
- else
- sprintf(rnamebuf, "Unknown UID %d", (int) RealUid);
- RunAsUserName = RealUserName = rnamebuf;
-
-#if _FFR_NEW_MAKEMAP_FLAGS
-#define OPTIONS "C:Nc:dflorsv"
-#else
-#define OPTIONS "C:Ndforsv"
-#endif
- while ((opt = getopt(argc, argv, OPTIONS)) != EOF)
- {
- switch (opt)
- {
- case 'C':
- cfile = optarg;
- break;
-
- case 'N':
- inclnull = TRUE;
- break;
-
-#if _FFR_NEW_MAKEMAP_FLAGS
- case 'c':
-# ifdef NEWDB
- dbcachesize = atol(optarg);
-# endif
- break;
-#endif
-
- case 'd':
- allowdups = TRUE;
- break;
-
- case 'f':
- foldcase = FALSE;
- break;
-
-#if _FFR_NEW_MAKEMAP_FLAGS
- case 'l':
-# ifdef NDBM
- printf("dbm\n");
-# endif
-# ifdef NEWDB
- printf("hash\n");
- printf("btree\n");
-# endif
- exit(EX_OK);
- break;
-#endif
-
- case 'o':
- notrunc = TRUE;
- break;
-
- case 'r':
- allowreplace = TRUE;
- break;
-
- case 's':
- DontBlameSendmail |= DBS_MAPINUNSAFEDIRPATH|DBS_WRITEMAPTOHARDLINK|DBS_WRITEMAPTOSYMLINK|DBS_LINKEDMAPINWRITABLEDIR;
- break;
-
- case 'v':
- verbose = TRUE;
- break;
-
- default:
- type = T_ERR;
- break;
- }
- }
-
- if (!bitset(DBS_WRITEMAPTOSYMLINK, DontBlameSendmail))
- sff |= SFF_NOSLINK;
- if (!bitset(DBS_WRITEMAPTOHARDLINK, DontBlameSendmail))
- sff |= SFF_NOHLINK;
- if (!bitset(DBS_LINKEDMAPINWRITABLEDIR, DontBlameSendmail))
- sff |= SFF_NOWLINK;
-
- argc -= optind;
- argv += optind;
- if (argc != 2)
- type = T_ERR;
- else
- {
- typename = argv[0];
- mapname = argv[1];
- ext = NULL;
-
- if (strcmp(typename, "dbm") == 0)
- {
- type = T_DBM;
- }
- else if (strcmp(typename, "btree") == 0)
- {
- type = T_BTREE;
- ext = ".db";
- }
- else if (strcmp(typename, "hash") == 0)
- {
- type = T_HASH;
- ext = ".db";
- }
- else
- type = T_UNKNOWN;
- }
-
-#if _FFR_TRUSTED_USER
- if ((cfp = fopen(cfile, "r")) == NULL)
- {
- fprintf(stderr, "mailstats: ");
- perror(cfile);
- exit(EX_NOINPUT);
- }
- while (fgets(buf, sizeof(buf), cfp) != NULL)
- {
- register char *b;
-
- if ((b = strchr(buf, '\n')) != NULL)
- *b = '\0';
-
- b = buf;
- switch (*b++)
- {
- case 'O': /* option */
- if (strncasecmp(b, " TrustedUser", 12) == 0 &&
- !(isascii(b[12]) && isalnum(b[12])))
- {
- b = strchr(b, '=');
- if (b == NULL)
- continue;
- while (isascii(*++b) && isspace(*b))
- continue;
- if (isascii(*b) && isdigit(*b))
- TrustedUid = atoi(b);
- else
- {
- register struct passwd *pw;
-
- TrustedUid = 0;
- pw = getpwnam(b);
- if (pw == NULL)
- fprintf(stderr,
- "TrustedUser: unknown user %s\n", b);
- else
- TrustedUid = pw->pw_uid;
- }
-
-# ifdef UID_MAX
- if (TrustedUid > UID_MAX)
- {
- syserr("TrustedUser: uid value (%ld) > UID_MAX (%ld)",
- TrustedUid, UID_MAX);
- TrustedUid = 0;
- }
-# endif
- break;
- }
-
-
- default:
- continue;
- }
- }
- (void) fclose(cfp);
-#endif
- switch (type)
- {
- case T_ERR:
-#if _FFR_NEW_MAKEMAP_FLAGS
- fprintf(stderr,
- "Usage: %s [-N] [-c cachesize] [-d] [-f] [-l] [-o] [-r] [-s] [-v] type mapname\n",
- progname);
-#else
- fprintf(stderr, "Usage: %s [-N] [-d] [-f] [-o] [-r] [-s] [-v] type mapname\n", progname);
-#endif
- exit(EX_USAGE);
-
- case T_UNKNOWN:
- fprintf(stderr, "%s: Unknown database type %s\n",
- progname, typename);
- exit(EX_USAGE);
-
-#ifndef NDBM
- case T_DBM:
-#endif
-#ifndef NEWDB
- case T_BTREE:
- case T_HASH:
-#endif
- fprintf(stderr, "%s: Type %s not supported in this version\n",
- progname, typename);
- exit(EX_UNAVAILABLE);
-
-#ifdef NEWDB
- case T_BTREE:
-# if DB_VERSION_MAJOR < 2
- bzero(&bti, sizeof bti);
-# else
- bzero(&dbinfo, sizeof dbinfo);
-# endif
- if (allowdups)
- {
-# if DB_VERSION_MAJOR < 2
- bti.flags |= R_DUP;
-# else
- dbinfo.flags |= DB_DUP;
-# endif
- }
- if (allowdups || allowreplace)
- putflags = 0;
- else
- {
-# if DB_VERSION_MAJOR < 2
- putflags = R_NOOVERWRITE;
-# else
- putflags = DB_NOOVERWRITE;
-# endif
- }
- break;
-
- case T_HASH:
-# if DB_VERSION_MAJOR < 2
- bzero(&hinfo, sizeof hinfo);
-# else
- bzero(&dbinfo, sizeof dbinfo);
-# endif
- if (allowreplace)
- putflags = 0;
- else
- {
-# if DB_VERSION_MAJOR < 2
- putflags = R_NOOVERWRITE;
-# else
- putflags = DB_NOOVERWRITE;
-# endif
- }
- break;
-#endif
-#ifdef NDBM
- case T_DBM:
- if (allowdups)
- {
- fprintf(stderr, "%s: Type %s does not support -d (allow dups)\n",
- progname, typename);
- exit(EX_UNAVAILABLE);
- }
- if (allowreplace)
- putflags = DBM_REPLACE;
- else
- putflags = DBM_INSERT;
- break;
-#endif
- }
-
- /*
- ** Adjust file names.
- */
-
- if (ext != NULL)
- {
- int el, fl;
-
- el = strlen(ext);
- fl = strlen(mapname);
- if (el + fl + 1 >= sizeof fbuf)
- {
- fprintf(stderr, "%s: file name too long", mapname);
- exit(EX_USAGE);
- }
- if (fl < el || strcmp(&mapname[fl - el], ext) != 0)
- {
- strcpy(fbuf, mapname);
- strcat(fbuf, ext);
- mapname = fbuf;
- }
- }
-
- if (!notrunc)
- sff |= SFF_CREAT;
- switch (type)
- {
-#ifdef NEWDB
- case T_BTREE:
- case T_HASH:
- if (strlen(mapname) >= sizeof dbuf)
- {
- fprintf(stderr,
- "%s: map name too long\n", mapname);
- exit(EX_USAGE);
- }
- strcpy(dbuf, mapname);
- if ((st = safefile(dbuf, RealUid, RealGid, RealUserName,
- sff, S_IWUSR, &std)) != 0)
- {
- fprintf(stderr,
- "%s: could not create: %s\n",
- dbuf, errstring(st));
- exit(EX_CANTCREAT);
- }
- break;
-#endif
-#ifdef NDBM
- case T_DBM:
- if (strlen(mapname) + 5 > sizeof dbuf)
- {
- fprintf(stderr,
- "%s: map name too long\n", mapname);
- exit(EX_USAGE);
- }
- sprintf(dbuf, "%s.dir", mapname);
- if ((st = safefile(dbuf, RealUid, RealGid, RealUserName,
- sff, S_IWUSR, &std)) != 0)
- {
- fprintf(stderr,
- "%s: could not create: %s\n",
- dbuf, errstring(st));
- exit(EX_CANTCREAT);
- }
- sprintf(pbuf, "%s.pag", mapname);
- if ((st = safefile(pbuf, RealUid, RealGid, RealUserName,
- sff, S_IWUSR, &stp)) != 0)
- {
- fprintf(stderr,
- "%s: could not create: %s\n",
- pbuf, errstring(st));
- exit(EX_CANTCREAT);
- }
- break;
-#endif
- default:
- fprintf(stderr,
- "%s: internal error: type %d\n",
- progname,
- type);
- exit(EX_SOFTWARE);
- }
-
- /*
- ** Create the database.
- */
-
- mode = O_RDWR;
- if (!notrunc)
- mode |= O_CREAT|O_TRUNC;
-#if O_EXLOCK
- mode |= O_EXLOCK;
-#else
- /* pre-lock the database */
- fd = safeopen(dbuf, mode & ~O_TRUNC, 0644, sff);
- if (fd < 0)
- {
- fprintf(stderr, "%s: cannot create type %s map %s\n",
- progname, typename, mapname);
- exit(EX_CANTCREAT);
- }
-#endif
- switch (type)
- {
-#ifdef NDBM
- case T_DBM:
- dbp.dbm = dbm_open(mapname, mode, 0644);
- if (dbp.dbm != NULL &&
- dbm_dirfno(dbp.dbm) == dbm_pagfno(dbp.dbm))
- {
- fprintf(stderr, "dbm map %s: cannot run with GDBM\n",
- mapname);
- dbm_close(dbp.dbm);
- exit(EX_CONFIG);
- }
- if (dbp.dbm != NULL &&
- (filechanged(dbuf, dbm_dirfno(dbp.dbm), &std) ||
- filechanged(pbuf, dbm_pagfno(dbp.dbm), &stp)))
- {
- fprintf(stderr,
- "dbm map %s: file changed after open\n",
- mapname);
- dbm_close(dbp.dbm);
- exit(EX_CANTCREAT);
- }
-#if _FFR_TRUSTED_USER
- if (geteuid() == 0 && TrustedUid != 0)
- {
- if (fchown(dbm_dirfno(dbp.dbm), TrustedUid, -1) < 0 ||
- fchown(dbm_pagfno(dbp.dbm), TrustedUid, -1) < 0)
- {
- fprintf(stderr,
- "WARNING: ownership change on %s failed: %s",
- mapname, errstring(errno));
- }
- }
-#endif
-
- break;
-#endif
-
-#ifdef NEWDB
- case T_HASH:
- /* tweak some parameters for performance */
-# if DB_VERSION_MAJOR < 2
- hinfo.nelem = 4096;
- hinfo.cachesize = dbcachesize;
-# else
- dbinfo.h_nelem = 4096;
- dbinfo.db_cachesize = dbcachesize;
-# endif
-
-# if DB_VERSION_MAJOR < 2
- dbp.db = dbopen(mapname, mode, 0644, DB_HASH, &hinfo);
-# else
- {
- int flags = 0;
-
- if (bitset(O_CREAT, mode))
- flags |= DB_CREATE;
- if (bitset(O_TRUNC, mode))
- flags |= DB_TRUNCATE;
-
- dbp.db = NULL;
- errno = db_open(mapname, DB_HASH, flags, 0644,
- NULL, &dbinfo, &dbp.db);
- }
-# endif
- if (dbp.db != NULL)
- {
- int fd;
-
-# if DB_VERSION_MAJOR < 2
- fd = dbp.db->fd(dbp.db);
-# else
- fd = -1;
- errno = dbp.db->fd(dbp.db, &fd);
-# endif
- if (filechanged(dbuf, fd, &std))
- {
- fprintf(stderr,
- "db map %s: file changed after open\n",
- mapname);
-# if DB_VERSION_MAJOR < 2
- dbp.db->close(dbp.db);
-# else
- errno = dbp.db->close(dbp.db, 0);
-# endif
- exit(EX_CANTCREAT);
- }
- (void) (*dbp.db->sync)(dbp.db, 0);
-#if _FFR_TRUSTED_USER
- if (geteuid() == 0 && TrustedUid != 0)
- {
- if (fchown(fd, TrustedUid, -1) < 0)
- {
- fprintf(stderr,
- "WARNING: ownership change on %s failed: %s",
- mapname, errstring(errno));
- }
- }
-#endif
- }
- break;
-
- case T_BTREE:
- /* tweak some parameters for performance */
-# if DB_VERSION_MAJOR < 2
- bti.cachesize = dbcachesize;
-# else
- dbinfo.db_cachesize = dbcachesize;
-# endif
-
-# if DB_VERSION_MAJOR < 2
- dbp.db = dbopen(mapname, mode, 0644, DB_BTREE, &bti);
-# else
- {
- int flags = 0;
-
- if (bitset(O_CREAT, mode))
- flags |= DB_CREATE;
- if (bitset(O_TRUNC, mode))
- flags |= DB_TRUNCATE;
-
- dbp.db = NULL;
- errno = db_open(mapname, DB_BTREE, flags, 0644,
- NULL, &dbinfo, &dbp.db);
- }
-# endif
- if (dbp.db != NULL)
- {
- int fd;
-
-# if DB_VERSION_MAJOR < 2
- fd = dbp.db->fd(dbp.db);
-# else
- fd = -1;
- errno = dbp.db->fd(dbp.db, &fd);
-# endif
- if (filechanged(dbuf, fd, &std))
- {
- fprintf(stderr,
- "db map %s: file changed after open\n",
- mapname);
-# if DB_VERSION_MAJOR < 2
- dbp.db->close(dbp.db);
-# else
- errno = dbp.db->close(dbp.db, 0);
-# endif
- exit(EX_CANTCREAT);
- }
- (void) (*dbp.db->sync)(dbp.db, 0);
-#if _FFR_TRUSTED_USER
- if (geteuid() == 0 && TrustedUid != 0)
- {
- if (fchown(fd, TrustedUid, -1) < 0)
- {
- fprintf(stderr,
- "WARNING: ownership change on %s failed: %s",
- mapname, errstring(errno));
- }
- }
-#endif
- }
- break;
-#endif
-
- default:
- fprintf(stderr, "%s: internal error: type %d\n",
- progname, type);
- exit(EX_SOFTWARE);
- }
-
- if (dbp.dbx == NULL)
- {
- fprintf(stderr, "%s: cannot open type %s map %s\n",
- progname, typename, mapname);
- exit(EX_CANTCREAT);
- }
-
- /*
- ** Copy the data
- */
-
- lineno = 0;
- exitstat = EX_OK;
- while (fgets(ibuf, sizeof ibuf, stdin) != NULL)
- {
- register char *p;
-
- lineno++;
-
- /*
- ** Parse the line.
- */
-
- p = strchr(ibuf, '\n');
- if (p != NULL)
- *p = '\0';
- else if (!feof(stdin))
- {
- fprintf(stderr, "%s: %s: line %d: line too long (%ld bytes max)\n",
- progname, mapname, lineno, (long) sizeof ibuf);
- continue;
- }
-
- if (ibuf[0] == '\0' || ibuf[0] == '#')
- continue;
- if (isascii(ibuf[0]) && isspace(ibuf[0]))
- {
- fprintf(stderr, "%s: %s: line %d: syntax error (leading space)\n",
- progname, mapname, lineno);
- continue;
- }
-#ifdef NEWDB
- if (type == T_HASH || type == T_BTREE)
- {
- bzero(&key.db, sizeof key.db);
- bzero(&val.db, sizeof val.db);
- }
-#endif
-
- key.xx.data = ibuf;
- for (p = ibuf; *p != '\0' && !(isascii(*p) && isspace(*p)); p++)
- {
- if (foldcase && isascii(*p) && isupper(*p))
- *p = tolower(*p);
- }
- key.xx.size = p - key.xx.data;
- if (inclnull)
- key.xx.size++;
- if (*p != '\0')
- *p++ = '\0';
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p == '\0')
- {
- fprintf(stderr, "%s: %s: line %d: no RHS for LHS %s\n",
- progname, mapname, lineno, key.xx.data);
- continue;
- }
- val.xx.data = p;
- val.xx.size = strlen(p);
- if (inclnull)
- val.xx.size++;
-
- /*
- ** Do the database insert.
- */
-
- if (verbose)
- {
- printf("key=`%s', val=`%s'\n", key.xx.data, val.xx.data);
- }
-
- switch (type)
- {
-#ifdef NDBM
- case T_DBM:
- st = dbm_store(dbp.dbm, key.dbm, val.dbm, putflags);
- break;
-#endif
-
-#ifdef NEWDB
- case T_BTREE:
- case T_HASH:
-# if DB_VERSION_MAJOR < 2
- st = (*dbp.db->put)(dbp.db, &key.db, &val.db, putflags);
-# else
- errno = (*dbp.db->put)(dbp.db, NULL, &key.db,
- &val.db, putflags);
- switch (errno)
- {
- case DB_KEYEXIST:
- st = 1;
- break;
-
- case 0:
- st = 0;
- break;
-
- default:
- st = -1;
- break;
- }
-# endif
- break;
-#endif
- default:
- break;
- }
-
- if (st < 0)
- {
- fprintf(stderr, "%s: %s: line %d: key %s: put error\n",
- progname, mapname, lineno, key.xx.data);
- perror(mapname);
- exitstat = EX_IOERR;
- }
- else if (st > 0)
- {
- fprintf(stderr,
- "%s: %s: line %d: key %s: duplicate key\n",
- progname, mapname, lineno, key.xx.data);
- }
- }
-
- /*
- ** Now close the database.
- */
-
- switch (type)
- {
-#ifdef NDBM
- case T_DBM:
- dbm_close(dbp.dbm);
- break;
-#endif
-
-#ifdef NEWDB
- case T_HASH:
- case T_BTREE:
-# if DB_VERSION_MAJOR < 2
- if ((*dbp.db->close)(dbp.db) < 0)
-# else
- if ((errno = (*dbp.db->close)(dbp.db, 0)) != 0)
-# endif
- {
- fprintf(stderr, "%s: %s: error on close\n",
- progname, mapname);
- perror(mapname);
- exitstat = EX_IOERR;
- }
-#endif
- default:
- break;
- }
-
-#if !O_EXLOCK
- /* release locks */
- close(fd);
-#endif
-
- exit (exitstat);
-}
-\f/*
-** LOCKFILE -- lock a file using flock or (shudder) fcntl locking
-**
-** Parameters:
-** fd -- the file descriptor of the file.
-** filename -- the file name (for error messages).
-** ext -- the filename extension.
-** type -- type of the lock. Bits can be:
-** LOCK_EX -- exclusive lock.
-** LOCK_NB -- non-blocking.
-**
-** Returns:
-** TRUE if the lock was acquired.
-** FALSE otherwise.
-*/
-
-bool
-lockfile(fd, filename, ext, type)
- int fd;
- char *filename;
- char *ext;
- int type;
-{
-# if !HASFLOCK
- int action;
- struct flock lfd;
- extern int errno;
-
- bzero(&lfd, sizeof lfd);
- if (bitset(LOCK_UN, type))
- lfd.l_type = F_UNLCK;
- else if (bitset(LOCK_EX, type))
- lfd.l_type = F_WRLCK;
- else
- lfd.l_type = F_RDLCK;
- if (bitset(LOCK_NB, type))
- action = F_SETLK;
- else
- action = F_SETLKW;
-
- if (fcntl(fd, action, &lfd) >= 0)
- return TRUE;
-
- /*
- ** On SunOS, if you are testing using -oQ/tmp/mqueue or
- ** -oA/tmp/aliases or anything like that, and /tmp is mounted
- ** as type "tmp" (that is, served from swap space), the
- ** previous fcntl will fail with "Invalid argument" errors.
- ** Since this is fairly common during testing, we will assume
- ** that this indicates that the lock is successfully grabbed.
- */
-
- if (errno == EINVAL)
- return TRUE;
-
-# else /* HASFLOCK */
-
- if (flock(fd, type) >= 0)
- return TRUE;
-
-# endif
-
- return FALSE;
-}
-
-/*VARARGS1*/
-void
-#ifdef __STDC__
-message(const char *msg, ...)
-#else
-message(msg, va_alist)
- const char *msg;
- va_dcl
-#endif
-{
- const char *m;
- VA_LOCAL_DECL
-
- m = msg;
- if (isascii(m[0]) && isdigit(m[0]) &&
- isascii(m[1]) && isdigit(m[1]) &&
- isascii(m[2]) && isdigit(m[2]) && m[3] == ' ')
- m += 4;
- VA_START(msg);
- vfprintf(stderr, m, ap);
- VA_END;
- fprintf(stderr, "\n");
-}
-
-/*VARARGS1*/
-void
-#ifdef __STDC__
-syserr(const char *msg, ...)
-#else
-syserr(msg, va_alist)
- const char *msg;
- va_dcl
-#endif
-{
- const char *m;
- VA_LOCAL_DECL
-
- m = msg;
- if (isascii(m[0]) && isdigit(m[0]) &&
- isascii(m[1]) && isdigit(m[1]) &&
- isascii(m[2]) && isdigit(m[2]) && m[3] == ' ')
- m += 4;
- VA_START(msg);
- vfprintf(stderr, m, ap);
- VA_END;
- fprintf(stderr, "\n");
-}
-
-const char *
-errstring(err)
- int err;
-{
-#if !HASSTRERROR
- static char errstr[64];
-# if !defined(ERRLIST_PREDEFINED)
- extern char *sys_errlist[];
- extern int sys_nerr;
-# endif
-#endif
-
- /* handle pseudo-errors internal to sendmail */
- switch (err)
- {
- case E_SM_OPENTIMEOUT:
- return "Timeout on file open";
-
- case E_SM_NOSLINK:
- return "Symbolic links not allowed";
-
- case E_SM_NOHLINK:
- return "Hard links not allowed";
-
- case E_SM_REGONLY:
- return "Regular files only";
-
- case E_SM_ISEXEC:
- return "Executable files not allowed";
-
- case E_SM_WWDIR:
- return "World writable directory";
-
- case E_SM_GWDIR:
- return "Group writable directory";
-
- case E_SM_FILECHANGE:
- return "File changed after open";
-
- case E_SM_WWFILE:
- return "World writable file";
-
- case E_SM_GWFILE:
- return "Group writable file";
- }
-
-#if HASSTRERROR
- return strerror(err);
-#else
- if (err < 0 || err >= sys_nerr)
- {
- sprintf(errstr, "Error %d", err);
- return errstr;
- }
- return sys_errlist[err];
-#endif
-}
+++ /dev/null
-# $OpenBSD: Makefile,v 1.3 1996/12/14 21:16:51 downsj Exp $
-# @(#)Makefile 8.1 (Berkeley) 6/7/93
-
-PROG= praliases
-CFLAGS+=-I${.CURDIR}/../src -DNEWDB
-MAN= praliases.1
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
+++ /dev/null
-#
-# This Makefile is designed to work on the old "make" program.
-#
-# @(#)Makefile.m4 8.16 (Berkeley) 7/12/1998
-#
-
-# C compiler
-CC= confCC
-
-# Shell
-SHELL= confSHELL
-
-# use O=-O (usual) or O=-g (debugging)
-O= ifdef(`confOPTIMIZE', `confOPTIMIZE', `-O')
-
-# location of sendmail source directory
-SRCDIR= ifdef(`confSRCDIR', `confSRCDIR', `../../src')
-
-# define the database mechanisms available for map & alias lookups:
-# -DNDBM -- use new DBM
-# -DNEWDB -- use new Berkeley DB
-# The really old (V7) DBM library is no longer supported.
-#
-MAPDEF= ifdef(`confMAPDEF', `confMAPDEF')
-
-# environment definitions (e.g., -D_AIX3)
-ENVDEF= ifdef(`confENVDEF', `confENVDEF')
-
-# see also conf.h for additional compilation flags
-
-# include directories
-INCDIRS=-I${SRCDIR} confINCDIRS
-
-# loader options
-LDOPTS= ifdef(`confLDOPTS', `confLDOPTS')
-
-# library directories
-LIBDIRS=confLIBDIRS
-
-# libraries required on your system
-LIBS= ifdef(`confLIBS', `confLIBS')
-
-# location of praliases binary (usually /usr/sbin or /usr/etc)
-SBINDIR=${DESTDIR}ifdef(`confSBINDIR', `confSBINDIR', `/usr/sbin')
-
-# additional .o files needed
-OBJADD= ifdef(`confOBJADD', `confOBJADD')
-
-undivert(1)
-
-################### end of user configuration flags ######################
-
-BUILDBIN=confBUILDBIN
-COPTS= -I. ${INCDIRS} ${MAPDEF} ${ENVDEF}
-CFLAGS= $O ${COPTS}
-
-BEFORE= confBEFORE
-OBJS= praliases.o ${OBJADD}
-
-NROFF= ifdef(`confNROFF', `confNROFF', `groff -Tascii')
-MANDOC= ifdef(`confMANDOC', `confMANDOC', `-mandoc')
-
-INSTALL=ifdef(`confINSTALL', `confINSTALL', `install')
-BINOWN= ifdef(`confUBINOWN', `confUBINOWN', `bin')
-BINGRP= ifdef(`confUBINGRP', `confUBINGRP', `bin')
-BINMODE=ifdef(`confUBINMODE', `confUBINMODE', `555')
-
-MANOWN= ifdef(`confMANOWN', `confMANOWN', `bin')
-MANGRP= ifdef(`confMANGRP', `confMANGRP', `bin')
-MANMODE=ifdef(`confMANMODE', `confMANMODE', `444')
-
-MANROOT=${DESTDIR}ifdef(`confMANROOT', `confMANROOT', `/usr/share/man/cat')
-MAN8= ${MANROOT}ifdef(`confMAN8', `confMAN8', `8')
-MAN8EXT=ifdef(`confMAN8EXT', `confMAN8EXT', `8')
-MAN8SRC=ifdef(`confMAN8SRC', `confMAN8SRC', `0')
-
-ALL= praliases praliases.${MAN8SRC}
-
-all: ${ALL}
-
-praliases: ${BEFORE} ${OBJS}
- ${CC} -o praliases ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
-
-undivert(3)
-
-praliases.${MAN8SRC}: praliases.8
- ${NROFF} ${MANDOC} praliases.8 > praliases.${MAN8SRC}
-
-install: install-praliases install-docs
-
-install-praliases: praliases
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} praliases ${SBINDIR}
-
-install-docs: praliases.${MAN8SRC}
-ifdef(`confNO_MAN_INSTALL', `dnl',
-` ${INSTALL} -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} praliases.${MAN8SRC} ${MAN8}/praliases.${MAN8EXT}')
-
-clean:
- rm -f ${OBJS} praliases praliases.${MAN8SRC}
-
-################ Dependency scripts
-include(confBUILDTOOLSDIR/M4/depend/ifdef(`confDEPEND_TYPE', `confDEPEND_TYPE',
-`generic').m4)dnl
-################ End of dependency scripts
+++ /dev/null
-.\" Copyright (c) 1998 Sendmail, Inc. 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.
-.\"
-.\"
-.\" @(#)praliases.8 8.5 (Berkeley) 5/19/1998
-.\"
-.Dd April 25, 1996
-.Dt PRALIASES 1
-.Os
-.Sh NAME
-.Nm praliases
-.Nd display system mail aliases
-.Sh SYNOPSIS
-.Nm praliases
-.Op Fl f Ar file
-.Sh DESCRIPTION
-The
-.Nm praliases
-utility displays the current system aliases,
-one per line, in no particular order.
-.Pp
-The options are as follows:
-.Bl -tag -width Ds
-.It Fl f
-Read the specified file instead of the default
-.Nm sendmail
-system aliases file.
-.El
-.Pp
-The
-.Nm praliases
-utility exits 0 on success, and >0 if an error occurs.
-.Sh FILES
-.Bl -tag -width /var/log/sendmail.stXX -compact
-.It Pa /etc/aliases
-The default
-.Nm sendmail
-system aliases file.
-.It Pa /etc/aliases.db
-The database version of the
-.Pa /etc/aliases
-file.
-.El
-.Sh SEE ALSO
-.Xr mailq 1 ,
-.Xr sendmail 8
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1988, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)praliases.c 8.21 (Berkeley) 12/27/1998";
-#endif /* not lint */
-
-#if !defined(NDBM) && !defined(NEWDB)
- ERROR README: You must define one of NDBM or NEWDB in order to compile
- ERROR README: praliases.
-#endif
-
-#ifdef NDBM
-# include <ndbm.h>
-#endif
-#ifndef NOT_SENDMAIL
-# define NOT_SENDMAIL
-#endif
-#include <sendmail.h>
-#include <pathnames.h>
-#ifdef NEWDB
-# include <db.h>
-# ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-# endif
-#endif
-
-#if defined(IRIX64) || defined(IRIX5) || defined(IRIX6) || \
- defined(BSD4_4) || defined(__osf__) || defined(__GNU_LIBRARY__)
-# ifndef HASSTRERROR
-# define HASSTRERROR 1 /* has strerror(3) */
-# endif
-#endif
-
-#if !HASSTRERROR
-extern char *strerror __P((int));
-#endif
-
-static void praliases __P((char *, int, char **));
-#ifdef NDBM
-static void praliases_dbm __P((char *, int, char **));
-#endif
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- extern char *optarg;
- extern int optind;
- char *cfile;
-#if _FFR_GRAB_ALIASFILE_OPTION
- char *filename = NULL;
-#else
- char *filename = "/etc/aliases";
-#endif
- FILE *cfp;
- int ch;
- char afilebuf[MAXLINE];
- char buf[MAXLINE];
-
- cfile = _PATH_SENDMAILCF;
-#if _FFR_GRAB_ALIASFILE_OPTION
- while ((ch = getopt(argc, argv, "C:f:")) != EOF)
-#else
- while ((ch = getopt(argc, argv, "f:")) != EOF)
-#endif
- {
- switch ((char)ch) {
- case 'C':
- cfile = optarg;
- break;
- case 'f':
- filename = optarg;
- break;
- case '?':
- default:
- (void)fprintf(stderr,
-#if _FFR_GRAB_ALIASFILE_OPTION
- "usage: praliases [-C cffile] [-f aliasfile]\n");
-#else
- "usage: praliases [-f aliasfile]\n");
-#endif
- exit(EX_USAGE);
- }
- }
- argc -= optind;
- argv += optind;
-
- if (filename != NULL)
- {
- praliases(filename, argc, argv);
- exit(EX_OK);
- }
-
- if ((cfp = fopen(cfile, "r")) == NULL)
- {
- fprintf(stderr, "praliases: ");
- perror(cfile);
- exit(EX_NOINPUT);
- }
-
- while (fgets(buf, sizeof(buf), cfp) != NULL)
- {
- register char *b, *p;
-
- b = buf;
- switch (*b++)
- {
- case 'O': /* option -- see if alias file */
- if (strncasecmp(b, " AliasFile", 10) == 0 &&
- !(isascii(b[10]) && isalnum(b[10])))
- {
- /* new form -- find value */
- b = strchr(b, '=');
- if (b == NULL)
- continue;
- while (isascii(*++b) && isspace(*b))
- continue;
- }
- else if (*b++ != 'A')
- {
- /* something else boring */
- continue;
- }
-
- /* this is the A or AliasFile option -- save it */
- if (strlen(b) >= sizeof afilebuf)
- {
- fprintf(stderr,
- "AliasFile filename too long: %.30s...\n",
- b);
- (void) fclose(cfp);
- exit(EX_CONFIG);
- }
- strcpy(afilebuf, b);
- b = afilebuf;
-
- for (p = b; p != NULL; )
- {
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p == '\0')
- break;
- b = p;
-
- p = strpbrk(p, " ,/");
- /* find end of spec */
- if (p != NULL)
- p = strpbrk(p, ",\n");
- if (p != NULL)
- *p++ = '\0';
-
- praliases(b, argc, argv);
- }
-
- default:
- continue;
- }
- }
- (void) fclose(cfp);
- exit(EX_OK);
-}
-
-static void
-praliases(filename, argc, argv)
- char *filename;
- int argc;
- char **argv;
-{
-#ifdef NEWDB
- DB *db;
- DBT newdbkey, newdbcontent;
- char buf[MAXNAME];
-#endif
- char *class;
-
- class = strchr(filename, ':');
- if (class != NULL)
- {
- if (strncasecmp(filename, "dbm:", 4) == 0)
- {
-#ifdef NDBM
- praliases_dbm(class + 1, argc, argv);
- return;
-#else
- fprintf(stderr, "class dbm not available\n");
- exit(EX_DATAERR);
-#endif
- }
- filename = class + 1;
- }
-#ifdef NEWDB
- if (strlen(filename) + 4 >= sizeof buf)
- {
- fprintf(stderr, "Alias filename too long: %.30s...\n", filename);
- exit(EX_USAGE);
- }
- (void) strcpy(buf, filename);
- (void) strcat(buf, ".db");
-# if DB_VERSION_MAJOR < 2
- db = dbopen(buf, O_RDONLY, 0444, DB_HASH, NULL);
-# else
- db = NULL;
- errno = db_open(buf, DB_HASH, DB_RDONLY, 0444, NULL, NULL, &db);
-# endif
- if (db != NULL)
- {
- if (!argc)
- {
-# if DB_VERSION_MAJOR > 1
- DBC *dbc;
-# endif
- bzero(&newdbkey, sizeof newdbkey);
- bzero(&newdbcontent, sizeof newdbcontent);
-
-# if DB_VERSION_MAJOR < 2
- while(!db->seq(db, &newdbkey, &newdbcontent, R_NEXT))
-# else
-# if DB_VERSION_MAJOR > 2 || DB_VERSION_MINOR >=6
- if ((errno = db->cursor(db, NULL, &dbc, 0)) == 0)
-# else
- if ((errno = db->cursor(db, NULL, &dbc)) == 0)
-# endif
- {
- while ((errno = dbc->c_get(dbc, &newdbkey,
- &newdbcontent,
- DB_NEXT)) == 0)
-# endif
- printf("%.*s:%.*s\n",
- (int) newdbkey.size,
- (char *) newdbkey.data,
- (int) newdbcontent.size,
- (char *) newdbcontent.data);
-# if DB_VERSION_MAJOR > 1
- (void) dbc->c_close(dbc);
- }
- else
- {
- fprintf(stderr,
- "praliases: %s: Could not set cursor: %s\n",
- buf, strerror(errno));
- errno = db->close(db, 0);
- exit(EX_DATAERR);
- }
-# endif
- }
- else for (; *argv; ++argv)
- {
- bzero(&newdbkey, sizeof newdbkey);
- bzero(&newdbcontent, sizeof newdbcontent);
- newdbkey.data = *argv;
- newdbkey.size = strlen(*argv) + 1;
-# if DB_VERSION_MAJOR < 2
- if (!db->get(db, &newdbkey, &newdbcontent, 0))
-# else
- if ((errno = db->get(db, NULL, &newdbkey,
- &newdbcontent, 0)) == 0)
-# endif
- printf("%s:%.*s\n", (char *) newdbkey.data,
- (int) newdbcontent.size,
- (char *) newdbcontent.data);
- else
- printf("%s: No such key\n",
- (char *) newdbkey.data);
- }
-# if DB_VERSION_MAJOR < 2
- (void)db->close(db);
-# else
- errno = db->close(db, 0);
-# endif
- }
- else
- {
-#endif
-#ifdef NDBM
- praliases_dbm(filename, argc, argv);
-#endif
-#ifdef NEWDB
- }
-#endif
-}
-
-#ifdef NDBM
-static void
-praliases_dbm(filename, argc, argv)
- char *filename;
- int argc;
- char **argv;
-{
- DBM *dbp;
- datum content, key;
-
- if ((dbp = dbm_open(filename, O_RDONLY, 0)) == NULL)
- {
- (void)fprintf(stderr,
- "praliases: %s: %s\n", filename, strerror(errno));
- exit(EX_OSFILE);
- }
- if (!argc)
- {
- for (key = dbm_firstkey(dbp);
- key.dptr != NULL; key = dbm_nextkey(dbp))
- {
- content = dbm_fetch(dbp, key);
- (void)printf("%.*s:%.*s\n",
- (int) key.dsize, key.dptr,
- (int) content.dsize, content.dptr);
- }
- }
- else
- {
- for (; *argv; ++argv)
- {
- /*
- ** Use the sendmail adaptive algorithm of trying
- ** the key first without, then if needed with,
- ** the terminating NULL byte.
- */
- key.dptr = *argv;
- key.dsize = strlen(*argv);
- content = dbm_fetch(dbp, key);
- if (content.dptr == NULL)
- {
- key.dsize++;
- content = dbm_fetch(dbp, key);
- }
- if (content.dptr != NULL)
- (void)printf("%s:%.*s\n", key.dptr,
- (int) content.dsize, content.dptr);
- else
- (void)printf("%s: No such key\n", key.dptr);
- }
- }
- dbm_close(dbp);
-}
-#endif
-
-#if !HASSTRERROR
-
-char *
-strerror(eno)
- int eno;
-{
- extern int sys_nerr;
- extern char *sys_errlist[];
- static char ebuf[60];
-
- if (eno >= 0 && eno < sys_nerr)
- return sys_errlist[eno];
- (void) sprintf(ebuf, "Error %d", eno);
- return ebuf;
-}
-
-#endif /* !HASSTRERROR */
+++ /dev/null
-# $OpenBSD: Makefile,v 1.2 2000/02/16 16:51:09 form Exp $
-# @(#)Makefile 8.1 (Berkeley) 7/2/95
-
-PROG= smrsh
-MAN= smrsh.8
-CFLAGS+=-I${.CURDIR}/../src -DCMDDIR=\"/usr/libexec/sm.bin\"
-
-BINDIR= /usr/libexec
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
+++ /dev/null
-#
-# This Makefile is designed to work on the old "make" program.
-#
-# @(#)Makefile.m4 8.14 (Berkeley) 7/12/1998
-#
-
-# C compiler
-CC= confCC
-
-# Shell
-SHELL= confSHELL
-
-# use O=-O (usual) or O=-g (debugging)
-O= ifdef(`confOPTIMIZE', `confOPTIMIZE', `-O')
-
-# location of sendmail source directory
-SRCDIR= ifdef(`confSRCDIR', `confSRCDIR', `../../src')
-
-# environment definitions (e.g., -D_AIX3)
-ENVDEF= ifdef(`confENVDEF', `confENVDEF')
-
-# include directories
-INCDIRS=-I${SRCDIR} confINCDIRS
-
-# loader options
-LDOPTS= ifdef(`confLDOPTS', `confLDOPTS')
-
-# library directories
-LIBDIRS=confLIBDIRS
-
-# libraries required on your system
-LIBS= ifdef(`confLIBS', `confLIBS')
-
-# location of smrsh binary (usually /usr/libexec or /usr/etc)
-EBINDIR=${DESTDIR}ifdef(`confEBINDIR', `confEBINDIR', `/usr/libexec')
-
-# additional .o files needed
-OBJADD= ifdef(`confOBJADD', `confOBJADD')
-
-undivert(1)
-
-################### end of user configuration flags ######################
-
-BUILDBIN=confBUILDBIN
-COPTS= -I. ${INCDIRS} ${ENVDEF}
-CFLAGS= $O ${COPTS}
-
-BEFORE= confBEFORE
-OBJS= smrsh.o ${OBJADD}
-
-# Which *roff program has -mandoc support
-NROFF= ifdef(`confNROFF', `confNROFF', `groff -Tascii')
-MANDOC= ifdef(`confMANDOC', `confMANDOC', `-mandoc')
-
-INSTALL=ifdef(`confINSTALL', `confINSTALL', `install')
-BINOWN= ifdef(`confUBINOWN', `confUBINOWN', `bin')
-BINGRP= ifdef(`confUBINGRP', `confUBINGRP', `bin')
-BINMODE=ifdef(`confUBINMODE', `confUBINMODE', `555')
-
-MANOWN= ifdef(`confMANOWN', `confMANOWN', `bin')
-MANGRP= ifdef(`confMANGRP', `confMANGRP', `bin')
-MANMODE=ifdef(`confMANMODE', `confMANMODE', `444')
-
-MANROOT=${DESTDIR}ifdef(`confMANROOT', `confMANROOT', `/usr/share/man/cat')
-MAN8= ${MANROOT}ifdef(`confMAN8', `confMAN8', `8')
-MAN8EXT=ifdef(`confMAN8EXT', `confMAN8EXT', `8')
-MAN8SRC=ifdef(`confMAN8SRC', `confMAN8SRC', `0')
-
-ALL= smrsh smrsh.${MAN8SRC}
-
-all: ${ALL}
-
-smrsh: ${BEFORE} ${OBJS}
- ${CC} -o smrsh ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
-
-undivert(3)
-
-smrsh.${MAN8SRC}: smrsh.8
- ${NROFF} ${MANDOC} smrsh.8 > smrsh.${MAN8SRC}
-
-install: install-smrsh install-docs
-
-install-smrsh: smrsh
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} smrsh ${EBINDIR}
-
-install-docs: smrsh.${MAN8SRC}
-ifdef(`confNO_MAN_INSTALL', `dnl',
-` ${INSTALL} -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} smrsh.${MAN8SRC} ${MAN8}/smrsh.${MAN8EXT}')
-
-clean:
- rm -f ${OBJS} smrsh smrsh.${MAN8SRC}
-
-################ Dependency scripts
-include(confBUILDTOOLSDIR/M4/depend/ifdef(`confDEPEND_TYPE', `confDEPEND_TYPE',
-`generic').m4)dnl
-################ End of dependency scripts
+++ /dev/null
-
-
-
-README smrsh - sendmail restricted shell.
-
- @(#)README 8.2 11/11/1995
-
-
-This README file is provided as a courtesy of the CERT Coordination Center,
-Software Engineering Institute, Carnegie Mellon University. This file is
-intended as a supplement to the CERT advisory CA-93:16.sendmail.vulnerability,
-and to the software, smrsh.c, written by Eric Allman.
-
-
-
-The smrsh(8) program is intended as a replacement for /bin/sh in the
-program mailer definition of sendmail(8). This README file describes
-the steps needed to compile and install smrsh.
-
-smrsh is a restricted shell utility that provides the ability to
-specify, through a configuration, an explicit list of executable
-programs. When used in conjunction with sendmail, smrsh effectively
-limits sendmail's scope of program execution to only those programs
-specified in smrsh's configuration.
-
-smrsh has been written with portability in mind, and uses traditional
-Unix library utilities. As such, smrsh should compile on most
-Unix C compilers.
-
-
-
-To compile smrsh.c, use the following command:
-
-host.domain% cc -o smrsh smrsh.c
-
-For machines that provide dynamic linking, it is advisable to compile
-smrsh without dynamic linking. As an example with the Sun Microsystems
-compiler, you should compile with the -Bstatic option.
-
-host.domain% cc -Bstatic -o smrsh smrsh.c
-
-
-Choose a directory that smrsh will reside in. We will use the traditional
-/usr/local/etc directory for the remainder of this document.
-
-As root, install smrsh in /usr/local/etc directory, with mode 511.
-
-host.domain# mv smrsh /usr/local/etc
-host.domain# chmod 511 /usr/local/etc/smrsh
-
-
-
-Next, determine the list of commands that smrsh should allow sendmail
-to run. This list of allowable commands can be determined by:
-
- 1. examining your /etc/aliases file, to indicate what commands
- are being used by the system.
-
- 2. surveying your host's .forward files, to determine what
- commands users have specified.
-
-See the man page for aliases(5) if you are unfamiliar with the format of
-these specifications. Additionally, you should include in the list,
-popular commands such as /usr/ucb/vacation.
-
-You should NOT include interpreter programs such as sh(1), csh(1),
-perl(1), uudecode(1) or the stream editor sed(1) in your list of
-acceptable commands.
-
-
-You will next need to create the directory /usr/adm/sm.bin and populate
-it with the programs that your site feels are allowable for sendmail
-to execute. This directory is explicitly specified in the source
-code for smrsh, so changing this directory must be accompanied with
-a change in smrsh.c.
-
-
-You will have to be root to make these modifications.
-
-After creating the /usr/adm/sm.bin directory, either copy the programs
-to the directory, or establish links to the allowable programs from
-/usr/adm/sm.bin. Change the file permissions, so that these programs
-can not be modified by non-root users. If you use links, you should
-ensure that the target programs are not modifiable.
-
-To allow the popular vacation(1) program by creating a link in the
-/usr/adm/sm.bin directory, you should:
-
-host.domain# cd /usr/adm/sm.bin
-host.domain# ln -s /usr/ucb/vacation vacation
-
-
-
-
-After populating the /usr/adm/sm.bin directory, you can now configure
-sendmail to use the restricted shell. Save the current sendmail.cf
-file prior to modifying it, as a prudent precaution.
-
-Typically, the program mailer is defined by a single line in the
-sendmail configuration file, sendmail.cf. This file is traditionally
-found in the /etc, /usr/lib or /etc/mail directories, depending on
-the UNIX vendor.
-
-If you are unsure of the location of the actual sendmail configuration
-file, a search of the strings(1) output of the sendmail binary, will
-help to locate it.
-
-In order to configure sendmail to use smrsh, you must modify the Mprog
-definition in the sendmail.cf file, by replacing the /bin/sh specification
-with /usr/local/etc/smrsh.
-
-As an example:
-
-In most Sun Microsystems' sendmail.cf files, the line is:
-Mprog, P=/bin/sh, F=lsDFMeuP, S=10, R=20, A=sh -c $u
-
-which should be changed to:
-Mprog, P=/usr/local/etc/smrsh, F=lsDFMeuP, S=10, R=20, A=sh -c $u
- ^^^^^^^^^^^^^^^^^^^^
-
-A more generic line may be:
-Mprog, P=/bin/sh, F=lsDFM, A=sh -c $u
-
-and should be changed to;
-Mprog, P=/usr/local/etc/smrsh, F=lsDFM, A=sh -c $u
-
-
-After modifying the Mprog definition in the sendmail.cf file, if a frozen
-configuration file is being used, it is essential to create a new one.
-You can determine if you need a frozen configuration by discovering
-if a sendmail.fc file currently exists in either the /etc/, /usr/lib,
-or /etc/mail directories. The specific location can be determined using
-a search of the strings(1) output of the sendmail binary.
-
-In order to create a new frozen configuration, if it is required:
-host.domain# /usr/lib/sendmail -bz
-
-Now re-start the sendmail process. An example of how to do this on
-a typical system follows:
-
-host.domain# /usr/bin/ps aux | /usr/bin/grep sendmail
-root 130 0.0 0.0 168 0 ? IW Oct 2 0:10 /usr/lib/sendmail -bd -q
-host.domain# /bin/kill -9 130
-host.domain# /usr/lib/sendmail -bd -q30m
+++ /dev/null
-.\" Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-.\" Copyright (c) 1993 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.
-.\"
-.\"
-.\" @(#)smrsh.8 8.7 (Berkeley) 5/19/1998
-.\"
-.TH SMRSH 8 11/02/93
-.SH NAME
-smrsh \- restricted shell for sendmail
-.SH SYNOPSIS
-.B smrsh
-.B \-c
-command
-.SH DESCRIPTION
-The
-.I smrsh
-program is intended as a replacement for
-.I sh
-for use in the ``prog'' mailer in
-.IR sendmail (8)
-configuration files.
-It sharply limits the commands that can be run using the
-``|program'' syntax of
-.I sendmail
-in order to improve the over all security of your system.
-Briefly, even if a ``bad guy'' can get sendmail to run a program
-without going through an alias or forward file,
-.I smrsh
-limits the set of programs that he or she can execute.
-.PP
-Briefly,
-.I smrsh
-limits programs to be in the directory
-/usr/libexec/sm.bin,
-allowing the system administrator to choose the set of acceptable commands.
-It also rejects any commands with the characters
-`\`', `<', `>', `|', `;', `&', `$', `(', `)', `\er' (carriage return),
-or `\en' (newline)
-on the command line to prevent ``end run'' attacks.
-.PP
-Initial pathnames on programs are stripped,
-so forwarding to ``/usr/bin/vacation'',
-``/home/server/mydir/bin/vacation'',
-and
-``vacation''
-all actually forward to
-``/usr/libexec/sm.bin/vacation''.
-.PP
-System administrators should be conservative about populating
-/usr/libexec/sm.bin.
-Reasonable additions are
-.IR vacation (1),
-.IR procmail (1),
-and the like.
-No matter how brow-beaten you may be,
-never include any shell or shell-like program
-(such as
-.IR perl (1))
-in the
-sm.bin
-directory.
-Note that this does not restrict the use of shell or perl scripts
-in the sm.bin directory (using the ``#!'' syntax);
-it simply disallows execution of arbitrary programs.
-.SH COMPILATION
-Compilation should be trivial on most systems.
-You may need to use \-DPATH=\e"\fIpath\fP\e"
-to adjust the default search path
-(defaults to ``/bin:/usr/bin'')
-and/or \-DCMDBIN=\e"\fIdir\fP\e"
-to change the default program directory
-(defaults to ``/usr/libexec/sm.bin'').
-.SH FILES
-/usr/libexec/sm.bin \- directory for restricted programs
-.SH SEE ALSO
-sendmail(8)
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1993 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)smrsh.c 8.11 (Berkeley) 5/19/1998";
-#endif /* not lint */
-
-/*
-** SMRSH -- sendmail restricted shell
-**
-** This is a patch to get around the prog mailer bugs in most
-** versions of sendmail.
-**
-** Use this in place of /bin/sh in the "prog" mailer definition
-** in your sendmail.cf file. You then create CMDDIR (owned by
-** root, mode 755) and put links to any programs you want
-** available to prog mailers in that directory. This should
-** include things like "vacation" and "procmail", but not "sed"
-** or "sh".
-**
-** Leading pathnames are stripped from program names so that
-** existing .forward files that reference things like
-** "/usr/ucb/vacation" will continue to work.
-**
-** The following characters are completely illegal:
-** < > | ^ ; & $ ` ( ) \n \r
-** This is more restrictive than strictly necessary.
-**
-** To use this, edit /etc/sendmail.cf, search for ^Mprog, and
-** change P=/bin/sh to P=/usr/local/etc/smrsh, where this compiled
-** binary is installed /usr/local/etc/smrsh.
-**
-** This can be used on any version of sendmail.
-**
-** In loving memory of RTM. 11/02/93.
-*/
-
-#include <unistd.h>
-#include <stdio.h>
-#include <sys/file.h>
-#include <string.h>
-#include <ctype.h>
-#ifdef EX_OK
-# undef EX_OK
-#endif
-#include <sysexits.h>
-#include <syslog.h>
-#include <stdlib.h>
-
-/* directory in which all commands must reside */
-#ifndef CMDDIR
-# define CMDDIR "/usr/adm/sm.bin"
-#endif
-
-/* characters disallowed in the shell "-c" argument */
-#define SPECIALS "<|>^();&`$\r\n"
-
-/* default search path */
-#ifndef PATH
-# define PATH "/bin:/usr/bin:/usr/ucb"
-#endif
-
-int
-main(argc, argv)
- int argc;
- char **argv;
-{
- register char *p;
- register char *q;
- register char *cmd;
- int i;
- char *newenv[2];
- char cmdbuf[1000];
- char pathbuf[1000];
-
-#ifndef LOG_MAIL
- openlog("smrsh", 0);
-#else
- openlog("smrsh", LOG_ODELAY|LOG_CONS, LOG_MAIL);
-#endif
-
- strcpy(pathbuf, "PATH=");
- strcat(pathbuf, PATH);
- newenv[0] = pathbuf;
- newenv[1] = NULL;
-
- /*
- ** Do basic argv usage checking
- */
-
- if (argc != 3 || strcmp(argv[1], "-c") != 0)
- {
- fprintf(stderr, "Usage: %s -c command\n", argv[0]);
- syslog(LOG_ERR, "usage");
- exit(EX_USAGE);
- }
-
- /*
- ** Disallow special shell syntax. This is overly restrictive,
- ** but it should shut down all attacks.
- ** Be sure to include 8-bit versions, since many shells strip
- ** the address to 7 bits before checking.
- */
-
- strcpy(cmdbuf, SPECIALS);
- for (p = cmdbuf; *p != '\0'; p++)
- *p |= '\200';
- strcat(cmdbuf, SPECIALS);
- p = strpbrk(argv[2], cmdbuf);
- if (p != NULL)
- {
- fprintf(stderr, "%s: cannot use %c in command\n",
- argv[0], *p);
- syslog(LOG_CRIT, "uid %d: attempt to use %c in command: %s",
- getuid(), *p, argv[2]);
- exit(EX_UNAVAILABLE);
- }
-
- /*
- ** Do a quick sanity check on command line length.
- */
-
- i = strlen(argv[2]);
- if (i > (sizeof cmdbuf - sizeof CMDDIR - 2))
- {
- fprintf(stderr, "%s: command too long: %s\n", argv[0], argv[2]);
- syslog(LOG_WARNING, "command too long: %.40s", argv[2]);
- exit(EX_UNAVAILABLE);
- }
-
- /*
- ** Strip off a leading pathname on the command name. For
- ** example, change /usr/ucb/vacation to vacation.
- */
-
- /* strip leading spaces */
- for (q = argv[2]; *q != '\0' && isascii(*q) && isspace(*q); )
- q++;
-
- /* find the end of the command name */
- p = strpbrk(q, " \t");
- if (p == NULL)
- cmd = &q[strlen(q)];
- else
- {
- *p = '\0';
- cmd = p;
- }
-
- /* search backwards for last / (allow for 0200 bit) */
- while (cmd > q)
- {
- if ((*--cmd & 0177) == '/')
- {
- cmd++;
- break;
- }
- }
-
- /* cmd now points at final component of path name */
-
- /*
- ** Check to see if the command name is legal.
- */
-
- (void) strcpy(cmdbuf, CMDDIR);
- (void) strcat(cmdbuf, "/");
- (void) strcat(cmdbuf, cmd);
-#ifdef DEBUG
- printf("Trying %s\n", cmdbuf);
-#endif
- if (access(cmdbuf, X_OK) < 0)
- {
- /* oops.... crack attack possiblity */
- fprintf(stderr, "%s: %s not available for sendmail programs\n",
- argv[0], cmd);
- if (p != NULL)
- *p = ' ';
- syslog(LOG_CRIT, "uid %d: attempt to use %s", getuid(), cmd);
- exit(EX_UNAVAILABLE);
- }
- if (p != NULL)
- *p = ' ';
-
- /*
- ** Create the actual shell input.
- */
-
- strcpy(cmdbuf, CMDDIR);
- strcat(cmdbuf, "/");
- strcat(cmdbuf, cmd);
-
- /*
- ** Now invoke the shell
- */
-
-#ifdef DEBUG
- printf("%s\n", cmdbuf);
-#endif
- execle("/bin/sh", "/bin/sh", "-c", cmdbuf, NULL, newenv);
- syslog(LOG_CRIT, "Cannot exec /bin/sh: %m");
- perror("/bin/sh");
- exit(EX_OSFILE);
-}
+++ /dev/null
-# $OpenBSD: Makefile,v 1.22 1999/08/02 19:50:09 jakob Exp $
-#
-# OpenBSD Makefile
-#
-#
-
-.include <bsd.own.mk>
-
-PROG= sendmail
-
-# define the database mechanisms available for map & alias lookups:
-# -DNDBM -- use new DBM
-# -DNEWDB -- use new Berkeley DB
-# -DNIS -- include NIS support
-# The really old (V7) DBM library is no longer supported.
-# See README for a description of how these flags interact.
-#
-MAPDEF= -DNEWDB -DMAP_REGEX
-
-.if (${YP} == "yes")
-MAPDEF+=-DNIS
-.endif
-
-# environment definitions (e.g., -DNETISO)
-ENVDEF= -DNETISO -D_FFR_MAX_MIME_HEADER_LENGTH=1 -D_FFR_MAX_HEADER_LINES=1
-
-.if (${TCP_WRAPPERS} == "yes")
-ENVDEF+=-DTCPWRAPPERS
-DPADD= ${LIBWRAP}
-LDADD= -lwrap
-.endif
-
-CFLAGS+=-I${.CURDIR} ${MAPDEF} ${ENVDEF}
-
-SRCS= alias.c arpadate.c clock.c collect.c conf.c control.c convtime.c \
- daemon.c deliver.c domain.c envelope.c err.c headers.c macro.c main.c \
- map.c mci.c mime.c parseaddr.c queue.c readcf.c recipient.c safefile.c \
- savemail.c snprintf.c srvrsmtp.c stab.c stats.c sysexits.c trace.c \
- udb.c usersmtp.c util.c version.c
-MAN= aliases.5 mailq.1 newaliases.1 sendmail.8
-BINDIR= /usr/libexec/sendmail
-BINOWN= root
-BINGRP= bin
-BINMODE=4555
-
-beforeinstall:
- ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \
- ${DESTDIR}/var/log/sendmail.st
- ${INSTALL} ${INSTALL_COPY} -o ${BINOWN} -g ${BINGRP} -m 444 \
- ${.CURDIR}/sendmail.hf ${DESTDIR}/usr/share/misc
-
-.include "../../Makefile.inc"
-.include <bsd.prog.mk>
+++ /dev/null
-#
-# This Makefile is designed to work on any reasonably current version of
-# "make" program.
-#
-# @(#)Makefile.m4 8.26 (Berkeley) 1/23/1999
-#
-
-# C compiler
-CC= confCC
-
-# Shell
-SHELL= confSHELL
-
-# use O=-O (usual) or O=-g (debugging)
-O= ifdef(`confOPTIMIZE', `confOPTIMIZE', `-O')
-
-# location of sendmail source directory
-SRCDIR= .
-
-# define the database mechanisms available for map & alias lookups:
-# -DNDBM -- use new DBM
-# -DNEWDB -- use new Berkeley DB
-# -DNIS -- include NIS support
-# The really old (V7) DBM library is no longer supported.
-# See README for a description of how these flags interact.
-#
-MAPDEF= ifdef(`confMAPDEF', `confMAPDEF')
-
-# environment definitions (e.g., -D_AIX3)
-ENVDEF= ifdef(`confENVDEF', `confENVDEF')
-
-# see also conf.h for additional compilation flags
-
-# include directories
-INCDIRS=confINCDIRS
-
-# loader options
-LDOPTS= ifdef(`confLDOPTS', `confLDOPTS')
-
-# library directories
-LIBDIRS=confLIBDIRS
-
-# libraries required on your system
-# delete -l44bsd if you are not running BIND 4.9.x
-LIBS= ifdef(`confLIBS', `confLIBS')
-
-# location of sendmail binary (usually /usr/sbin or /usr/lib)
-BINDIR= ${DESTDIR}ifdef(`confMBINDIR', `confMBINDIR', `/usr/sbin')
-
-# location of "user" binaries (usually /usr/bin or /usr/ucb)
-UBINDIR=${DESTDIR}ifdef(`confUBINDIR', `confUBINDIR', `/usr/bin')
-
-# location of sendmail.st file (usually /var/log or /usr/lib)
-STDIR= ${DESTDIR}ifdef(`confSTDIR', `confSTDIR', `/var/log')
-
-# location of sendmail.hf file (usually /usr/share/misc or /usr/lib)
-HFDIR= ${DESTDIR}ifdef(`confHFDIR', `confHFDIR', `/usr/share/misc')
-
-# additional .o files needed
-OBJADD= ifdef(`confOBJADD', `confOBJADD') ifdef(`confSMOBJADD', `confSMOBJADD')
-
-undivert(1)
-
-################### end of user configuration flags ######################
-
-BUILDBIN=confBUILDBIN
-COPTS= -I. ${INCDIRS} ${MAPDEF} ${ENVDEF}
-CFLAGS= $O ${COPTS}
-
-BEFORE= confBEFORE
-OBJS= alias.o arpadate.o clock.o collect.o conf.o control.o convtime.o \
- daemon.o deliver.o domain.o envelope.o err.o headers.o macro.o \
- main.o map.o mci.o mime.o parseaddr.o queue.o readcf.o recipient.o \
- safefile.o savemail.o snprintf.o srvrsmtp.o stab.o stats.o \
- sysexits.o trace.o udb.o usersmtp.o util.o version.o ${OBJADD}
-
-LINKS= ifdef(`confLINKS', `confLINKS',
- `${UBINDIR}/newaliases \
- ${UBINDIR}/mailq \
- ${UBINDIR}/hoststat \
- ${UBINDIR}/purgestat')
-
-NROFF= ifdef(`confNROFF', `confNROFF', `groff -Tascii')
-MANDOC= ifdef(`confMANDOC', `confMANDOC', `-mandoc')
-
-INSTALL=ifdef(`confINSTALL', `confINSTALL', `install')
-BINOWN= ifdef(`confSBINOWN', `confSBINOWN', `root')
-BINGRP= ifdef(`confSBINGRP', `confSBINGRP', `kmem')
-BINMODE=ifdef(`confSBINMODE', `confSBINMODE', `4555')
-
-MANOWN= ifdef(`confMANOWN', `confMANOWN', `bin')
-MANGRP= ifdef(`confMANGRP', `confMANGRP', `bin')
-MANMODE=ifdef(`confMANMODE', `confMANMODE', `444')
-
-MANROOT=${DESTDIR}ifdef(`confMANROOT', `confMANROOT', `/usr/share/man/cat')
-MAN1= ${MANROOT}ifdef(`confMAN1', `confMAN1', `1')
-MAN1EXT=ifdef(`confMAN1EXT', `confMAN1EXT', `1')
-MAN1SRC=ifdef(`confMAN1SRC', `confMAN1SRC', `0')
-MAN5= ${MANROOT}ifdef(`confMAN5', `confMAN5', `5')
-MAN5EXT=ifdef(`confMAN5EXT', `confMAN5EXT', `5')
-MAN5SRC=ifdef(`confMAN5SRC', `confMAN5SRC', `0')
-MAN8= ${MANROOT}ifdef(`confMAN8', `confMAN8', `8')
-MAN8EXT=ifdef(`confMAN8EXT', `confMAN8EXT', `8')
-MAN8SRC=ifdef(`confMAN8SRC', `confMAN8SRC', `0')
-
-ALL= sendmail sendmail.st aliases.${MAN5SRC} mailq.${MAN1SRC} newaliases.${MAN1SRC} sendmail.${MAN8SRC}
-
-all: ${ALL}
-
-sendmail: ${BEFORE} ${OBJS}
- ${CC} -o sendmail ${LDOPTS} ${LIBDIRS} ${OBJS} ${LIBS}
-
-undivert(3)
-
-sendmail.st:
- cp /dev/null sendmail.st
-
-aliases.${MAN5SRC}: aliases.5
- ${NROFF} ${MANDOC} aliases.5 > aliases.${MAN5SRC}
-
-mailq.${MAN1SRC}: mailq.1
- ${NROFF} ${MANDOC} mailq.1 > mailq.${MAN1SRC}
-
-newaliases.${MAN1SRC}: newaliases.1
- ${NROFF} ${MANDOC} newaliases.1 > newaliases.${MAN1SRC}
-
-sendmail.${MAN8SRC}: sendmail.8
- ${NROFF} ${MANDOC} sendmail.8 > sendmail.${MAN8SRC}
-
-install: install-sendmail install-docs
-
-install-sendmail: sendmail
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR}
- for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf \
- ${HFDIR}/sendmail.hf
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 sendmail.st \
- ${STDIR}/sendmail.st
-
-install-docs: aliases.${MAN5SRC} mailq.${MAN1SRC} newaliases.${MAN1SRC} sendmail.${MAN8SRC}
-ifdef(`confNO_MAN_INSTALL', `dnl',
-` ${INSTALL} -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} sendmail.${MAN8SRC} ${MAN8}/sendmail.${MAN8EXT}
- ${INSTALL} -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} aliases.${MAN5SRC} ${MAN5}/aliases.${MAN5EXT}
- ${INSTALL} -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} mailq.${MAN1SRC} ${MAN1}/mailq.${MAN1EXT}
- ${INSTALL} -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} newaliases.${MAN1SRC} ${MAN1}/newaliases.${MAN1EXT}')
-
-clean:
- rm -f ${OBJS} sendmail aliases.${MAN5SRC} mailq.${MAN1SRC} newaliases.${MAN1SRC} sendmail.${MAN8SRC}
-
-################ Dependency scripts
-include(confBUILDTOOLSDIR/M4/depend/ifdef(`confDEPEND_TYPE', `confDEPEND_TYPE', `generic').m4)dnl
-################ End of dependency scripts
+++ /dev/null
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
-# Copyright (c) 1988
-# 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.
-#
-#
-# @(#)README 8.211 (Berkeley) 2/2/1999
-#
-
-This directory contains the source files for sendmail(TM).
-
-*********************
-!! DO NOT USE MAKE !! in this directory to compile sendmail --
-********************* instead, use the "Build" script located in
-the src directory. It will build an appropriate Makefile, and
-create an appropriate obj.* subdirectory so that multiplatform
-support works easily.
-
- **********************************************************
- ** Read below for more details on building sendmail. **
- **********************************************************
-
-**************************************************************************
-** IMPORTANT: Read the appropriate paragraphs in the section on **
-** ``Operating System and Compile Quirks''. **
-**************************************************************************
-
-For detailed instructions, please read the document ../doc/op/op.me:
-
- eqn ../doc/op/op.me | pic | ditroff -me
-
-Sendmail is a trademark of Sendmail, Inc.
-
-
-+-------------------+
-| BUILDING SENDMAIL |
-+-------------------+
-
-By far, the easiest way to compile sendmail is to use the "Build"
-script:
-
- sh Build
-
-This uses the "uname" command to figure out what architecture you are
-on and creates a proper Makefile accordingly. It also creates a
-subdirectory per object format, so that multiarchitecture support is
-easy. In general this should be all you need. IRIX 6.x users should
-read the note below in the OPERATING SYSTEM AND COMPILE QUIRKS section.
-
-If you need to look at other include or library directories, use the
--I or -L flags on the command line, e.g.,
-
- sh Build -I/usr/sww/include -L/usr/sww/lib
-
-It's also possible to create local site configuration in the file
-site.config.m4 (or another file settable with the -f flag). This
-file contains M4 definitions for various compilation values; the
-most useful are:
-
-confMAPDEF -D flags to specify database types to be included
- (see below)
-confENVDEF -D flags to specify other environment information
-confINCDIRS -I flags for finding include files during compilation
-confLIBDIRS -L flags for finding libraries during linking
-confLIBS -l flags for selecting libraries during linking
-confLDOPTS other ld(1) linker options
-
-Others can be found by examining Makefile.m4. Please read
-../BuildTools/README for more information about the site.config.m4
-file.
-
-You can recompile from scratch using the -c flag with the Build
-command. This removes the existing compilation directory for the
-current platform and builds a new one.
-
-Porting to a new Unix-based system should be a matter of creating
-an appropriate configuration file in the BuildTools/OS/ directory.
-
-
-
-+----------------------+
-| DATABASE DEFINITIONS |
-+----------------------+
-
-There are several database formats that can be used for the alias files
-and for general maps. When used for alias files they interact in an
-attempt to be backward compatible.
-
-The options are:
-
-NEWDB The new Berkeley DB package. Some systems (e.g., BSD/OS and
- Digital UNIX 4.0) have some version of this package
- pre-installed. If your system does not have Berkeley DB
- pre-installed, or the version installed is not version 2.0
- or greater (e.g., is Berkeley DB 1.85 or 1.86), get the
- current version from http://www.sleepycat.com/. DO NOT
- use a version from any of the University of California,
- Berkeley "Net" or other distributions. If you are still
- running BSD/386 1.x, you will need to upgrade the included
- Berkeley DB library to a current version. NEWDB is included
- automatically if the Build script can find a library named
- libdb.a.
-NDBM The older NDBM implementation -- the very old V7 DBM
- implementation is no longer supported.
-NIS Network Information Services. To use this you must have
- NIS support on your system.
-NISPLUS NIS+ (the revised NIS released with Solaris 2). You must
- have NIS+ support on your system to use this flag.
-HESIOD Support for Hesiod (from the DEC/Athena distribution). You
- must already have Hesiod support on your system for this to
- work. You may be able to get this to work with the MIT/Athena
- version of Hesiod, but that's likely to be a lot of work.
-LDAPMAP Lightweight Directory Lookup Protocol support. You will
- have to install the UMich or OpenLDAP ldap and lber
- libraries to use this flag.
-MAP_REGEX Regular Expression support. You will need to use an
- operating system which comes with the POSIX regex()
- routines or install a regexp library such as libregex from
- the Free Software Foundation.
-
->>> NOTE WELL for NEWDB support: If you want to get ndbm support, for
->>> Berkeley DB versions under 2.0, it is CRITICAL that you remove
->>> ndbm.o from libdb.a before you install it and DO NOT install ndbm.h;
->>> for Berkeley DB versions 2.0 through 2.3.14, remove dbm.o from libdb.a
->>> before you install it. If you don't delete these, there is absolutely
->>> no point to including -DNDBM, since it will just get you another
->>> (inferior) API to the same format database. These files OVERRIDE
->>> calls to ndbm routines -- in particular, if you leave ndbm.h in,
->>> you can find yourself using the new db package even if you don't
->>> define NEWDB. Berkeley DB versions later than 2.3.14 do not need
->>> to be modified. Please also consult the README in the top level
->>> directory of the sendmail distribution for other important information.
->>>
->>> Further note: DO NOT remove your existing /usr/include/ndbm.h --
->>> you need that one. But do not install an updated ndbm.h in
->>> /usr/include, /usr/local/include, or anywhere else.
-
-If NEWDB and NDBM are defined (but not NIS), then sendmail will read
-NDBM format alias files, but the next time a newaliases is run the
-format will be converted to NEWDB; that format will be used forever
-more. This is intended as a transition feature.
-
-If NEWDB, NDBM, and NIS are all defined and the name of the file includes
-the string "/yp/", sendmail will rebuild BOTH the NEWDB and NDBM format
-alias files. However, it will only read the NEWDB file; the NDBM format
-file is used only by the NIS subsystem. This is needed because the NIS
-maps on an NIS server are built directly from the NDBM files.
-
-If NDBM and NIS are defined (regardless of the definition of NEWDB),
-and the filename includes the string "/yp/", sendmail adds the special
-tokens "YP_LAST_MODIFIED" and "YP_MASTER_NAME", both of which are
-required if the NDBM file is to be used as an NIS map.
-
-All of these flags are normally defined in the DBMDEF line in the
-Makefile.
-
-If you define NEWDB or HESIOD you get the User Database (USERDB)
-automatically. Generally you do want to have NEWDB for it to do
-anything interesting. See above for getting the Berkeley DB
-package (i.e., NEWDB). There is no separate "user database"
-package -- don't bother searching for it on the net.
-
-Hesiod and LDAP require libraries that may not be installed with your
-system. These are outside of my ability to provide support. See the
-"Quirks" section for more information.
-
-The regex map can be used to see if an address matches a certain regular
-expression. For example, all-numerics local parts are common spam
-addresses, so "^[0-9]+$" would match this. By using such a map in a
-check_* rule-set, you can block a certain range of addresses that would
-otherwise be considered valid.
-
-+---------------+
-| COMPILE FLAGS |
-+---------------+
-
-Wherever possible, I try to make sendmail pull in the correct
-compilation options needed to compile on various environments based on
-automatically defined symbols. Some machines don't seem to have useful
-symbols available, requiring that a compilation flag be defined in
-the Makefile; see the Buildtools/OS subdirectory for the supported
-architectures.
-
-If you are a system to which sendmail has already been ported you
-should not have to touch the following symbols. But if you are porting,
-you may have to tweak the following compilation flags in conf.h in order
-to get it to compile and link properly:
-
-SYSTEM5 Adjust for System V (not necessarily Release 4).
-SYS5SIGNALS Use System V signal semantics -- the signal handler
- is automatically dropped when the signal is caught.
- If this is not set, use POSIX/BSD semantics, where the
- signal handler stays in force until an exec or an
- explicit delete. Implied by SYSTEM5.
-SYS5SETPGRP Use System V setpgrp() semantics. Implied by SYSTEM5.
-HASFCHMOD Define this to one if you have the fchmod(2) system call.
- This improves security.
-HASFLOCK Set this if you prefer to use the flock(2) system call
- rather than using fcntl-based locking. Fcntl locking
- has some semantic gotchas, but many vendor systems
- also interface it to lockd(8) to do NFS-style locking.
- Unfortunately, may vendors implementations of fcntl locking
- is just plain broken (e.g., locks are never released,
- causing your sendmail to deadlock; when the kernel runs
- out of locks your system crashes). For this reason, I
- recommend always defining this unless you are absolutely
- certain that your fcntl locking implementation really works.
-HASUNAME Set if you have the "uname" system call. Implied by
- SYSTEM5.
-HASUNSETENV Define this if your system library has the "unsetenv"
- subroutine.
-HASSETSID Define this if you have the setsid(2) system call. This
- is implied if your system appears to be POSIX compliant.
-HASINITGROUPS Define this if you have the initgroups(3) routine.
-HASSETVBUF Define this if you have the setvbuf(3) library call.
- If you don't, setlinebuf will be used instead. This
- defaults on if your compiler defines __STDC__.
-HASSETREUID Define this if you have setreuid(2) ***AND*** root can
- use setreuid to change to an arbitrary user. This second
- condition is not satisfied on AIX 3.x. You may find that
- your system has setresuid(2), (for example, on HP-UX) in
- which case you will also have to #define setreuid(r, e)
- to be the appropriate call. Some systems (such as Solaris)
- have a compatibility routine that doesn't work properly,
- but may have "saved user ids" properly implemented so you
- can ``#define setreuid(r, e) seteuid(e)'' and have it work.
- The important thing is that you have a call that will set
- the effective uid independently of the real or saved uid
- and be able to set the effective uid back again when done.
- There's a test program in ../test/t_setreuid.c that will
- try things on your system. Setting this improves the
- security, since sendmail doesn't have to read .forward
- and :include: files as root. There are certain attacks
- that may be unpreventable without this call.
-USESETEUID Define this to 1 if you have a seteuid(2) system call that
- will allow root to set only the effective user id to an
- arbitrary value ***AND*** you have saved user ids. This is
- preferable to HASSETREUID if these conditions are fulfilled.
- These are the semantics of the to-be-released revision of
- Posix.1. The test program ../test/t_seteuid.c will try
- this out on your system. If you define both HASSETREUID
- and USESETEUID, the former is ignored.
-HASLSTAT Define this if you have symbolic links (and thus the
- lstat(2) system call). This improves security. Unlike
- most other options, this one is on by default, so you
- need to #undef it in conf.h if you don't have symbolic
- links (these days everyone does).
-HASSETRLIMIT Define this to 1 if you have the setrlimit(2) syscall.
- You can define it to 0 to force it off. It is assumed
- if you are running a BSD-like system.
-HASULIMIT Define this if you have the ulimit(2) syscall (System V
- style systems). HASSETRLIMIT overrides, as it is more
- general.
-HASWAITPID Define this if you have the waitpid(2) syscall.
-HASGETDTABLESIZE
- Define this if you have the getdtablesize(2) syscall.
-HAS_ST_GEN Define this to 1 if your system has the st_gen field in
- the stat structure (see stat(2)).
-USESTRERROR Define this if you have the libc strerror function (which
- should be declared in <errno.h>), and it should be used
- instead of sys_errlist.
-NEEDGETOPT Define this if you need a reimplementation of getopt(3).
- On some systems, getopt does very odd things if called
- to scan the arguments twice. This flag will ask sendmail
- to compile in a local version of getopt that works
- properly.
-NEEDSTRTOL Define this if your standard C library does not define
- strtol(3). This will compile in a local version.
-NEEDVPRINTF Define this if your standard C library does not define
- vprintf(3). Note that the resulting fake implementation
- is not very elegant and may not even work on some
- architectures.
-NEEDFSYNC Define this if your standard C library does not define
- fsync(2). This will try to simulate the operation using
- fcntl(2); if that is not available it does nothing, which
- isn't great, but at least it compiles and runs.
-HASGETUSERSHELL Define this to 1 if you have getusershell(3) in your
- standard C library. If this is not defined, or is defined
- to be 0, sendmail will scan the /etc/shells file (no
- NIS-style support, defaults to /bin/sh and /bin/csh if
- that file does not exist) to get a list of unrestricted
- user shells. This is used to determine whether users
- are allowed to forward their mail to a program or a file.
-NEEDPUTENV Define this if your system needs am emulation of the
- putenv(3) call. Define to 1 to implement it in terms
- of setenv(3) or to 2 to do it in terms of primitives.
-NOFTRUNCATE Define this if you don't have the ftruncate(2) syscall.
- If you don't have this system call, there is an unavoidable
- race condition that occurs when creating alias databases.
-GIDSET_T The type of entries in a gidset passed as the second
- argument to getgroups(2). Historically this has been an
- int, so this is the default, but some systems (such as
- IRIX) pass it as a gid_t, which is an unsigned short.
- This will make a difference, so it is important to get
- this right! However, it is only an issue if you have
- group sets.
-SLEEP_T The type returned by the system sleep() function.
- Defaults to "unsigned int". Don't worry about this
- if you don't have compilation problems.
-ARBPTR_T The type of an arbitrary pointer -- defaults to "void *".
- If you are an very old compiler you may need to define
- this to be "char *".
-SOCKADDR_LEN_T The type used for the third parameter to accept(2),
- getsockname(2), and getpeername(2), representing the
- length of a struct sockaddr. Defaults to int.
-SOCKOPT_LEN_T The type used for the fifth parameter to getsockopt(2)
- and setsockopt(2), representing the length of the option
- buffer. Defaults to int.
-LA_TYPE The type of load average your kernel supports. These
- can be one of:
- LA_ZERO (1) -- it always returns the load average as
- "zero" (and does so on all architectures).
- LA_INT (2) to read /dev/kmem for the symbol avenrun and
- interpret as a long integer.
- LA_FLOAT (3) same, but interpret the result as a floating
- point number.
- LA_SHORT (6) to interpret as a short integer.
- LA_SUBR (4) if you have the getloadavg(3) routine in your
- system library.
- LA_MACH (5) to use MACH-style load averages (calls
- processor_set_info()),
- LA_PROCSTR (7) to read /proc/loadavg and interpret it
- as a string representing a floating-point
- number (Linux-style).
- LA_READKSYM (8) is an implementation suitable for some
- versions of SVr4 that uses the MIOC_READKSYM ioctl
- call to read /dev/kmem.
- LA_DGUX (9) is a special implementation for DG/UX that uses
- the dg_sys_info system call.
- LA_HPUX (10) is an HP-UX specific version that uses the
- pstat_getdynamic system call.
- LA_IRIX6 (11) is an IRIX 6.x specific version that adapts
- to 32 or 64 bit kernels; it is otherwise very similar
- to LA_INT.
- LA_KSTAT (12) uses the (Solaris-specific) kstat(3k)
- implementation.
- LA_DEVSHORT (13) reads a short from a system file (default:
- /dev/table/avenrun) and scales it in the same manner
- as LA_SHORT.
- LA_INT, LA_SHORT, LA_FLOAT, and LA_READKSYM have several
- other parameters that they try to divine: the name of your
- kernel, the name of the variable in the kernel to examine,
- the number of bits of precision in a fixed point load average,
- and so forth. LA_DEVSHORT uses _PATH_AVENRUN to find the
- device to be read to find the load average.
- In desperation, use LA_ZERO. The actual code is in
- conf.c -- it can be tweaked if you are brave.
-FSHIFT For LA_INT, LA_SHORT, and LA_READKSYM, this is the number
- of bits of load average after the binary point -- i.e.,
- the number of bits to shift right in order to scale the
- integer to get the true integer load average. Defaults to 8.
-_PATH_UNIX The path to your kernel. Needed only for LA_INT, LA_SHORT,
- and LA_FLOAT. Defaults to "/unix" on System V, "/vmunix"
- everywhere else.
-LA_AVENRUN For LA_INT, LA_SHORT, and LA_FLOAT, the name of the kernel
- variable that holds the load average. Defaults to "avenrun"
- on System V, "_avenrun" everywhere else.
-SFS_TYPE Encodes how your kernel can locate the amount of free
- space on a disk partition. This can be set to SFS_NONE
- (0) if you have no way of getting this information,
- SFS_USTAT (1) if you have the ustat(2) system call,
- SFS_4ARGS (2) if you have a four-argument statfs(2)
- system call (and the include file is <sys/statfs.h>),
- SFS_VFS (3), SFS_MOUNT (4), SFS_STATFS (5) if you have
- the two-argument statfs(2) system call with includes in
- <sys/vfs.h>, <sys/mount.h>, or <sys/statfs.h> respectively,
- or SFS_STATVFS (6) if you have the two-argument statvfs(2)
- call. The default if nothing is defined is SFS_NONE.
-SFS_BAVAIL with SFS_4ARGS you can also set SFS_BAVAIL to the field name
- in the statfs structure that holds the useful information;
- this defaults to f_bavail.
-SPT_TYPE Encodes how your system can display what a process is doing
- on a ps(1) command (SPT stands for Set Process Title). Can
- be set to:
- SPT_NONE (0) -- Don't try to set the process title at all.
- SPT_REUSEARGV (1) -- Pad out your argv with the information;
- this is the default if none specified.
- SPT_BUILTIN (2) -- The system library has setproctitle.
- SPT_PSTAT (3) -- Use the PSTAT_SETCMD option to pstat(2)
- to set the process title; this is used by HP-UX.
- SPT_PSSTRINGS (4) -- Use the magic PS_STRINGS pointer (4.4BSD).
- SPT_SYSMIPS (5) -- Use sysmips() supported by NEWS-OS 6.
- SPT_SCO (6) -- Write kernel u. area.
- SPT_CHANGEARGV (7) -- Write pointers to our own strings into
- the existing argv vector.
-SPT_PADCHAR Character used to pad the process title; if undefined,
- the space character (0x20) is used. This is ignored if
- SPT_TYPE != SPT_REUSEARGV
-ERRLIST_PREDEFINED
- If set, assumes that some header file defines sys_errlist.
- This may be needed if you get type conflicts on this
- variable -- otherwise don't worry about it.
-WAITUNION The wait(2) routine takes a "union wait" argument instead
- of an integer argument. This is for compatibility with
- old versions of BSD.
-SCANF You can set this to extend the F command to accept a
- scanf string -- this gives you a primitive parser for
- class definitions -- BUT it can make you vulnerable to
- core dumps if the target file is poorly formed.
-SYSLOG_BUFSIZE You can define this to be the size of the buffer that
- syslog accepts. If it is not defined, it assumes a
- 1024-byte buffer. If the buffer is very small (under
- 256 bytes) the log message format changes -- each
- e-mail message will log many more messages, since it
- will log each piece of information as a separate line
- in syslog.
-BROKEN_RES_SEARCH
- On Ultrix (and maybe other systems?) if you use the
- res_search routine with an unknown host name, it returns
- -1 but sets h_errno to 0 instead of HOST_NOT_FOUND. If
- you set this, sendmail considers 0 to be the same as
- HOST_NOT_FOUND.
-NAMELISTMASK If defined, values returned by nlist(3) are masked
- against this value before use -- a common value is
- 0x7fffffff to strip off the top bit.
-BSD4_4_SOCKADDR If defined, socket addresses have an sa_len field that
- defines the length of this address.
-SAFENFSPATHCONF Set this to 1 if and only if you have verified that a
- pathconf(2) call with _PC_CHOWN_RESTRICTED argument on an
- NFS filesystem where the underlying system allows users to
- give away files to other users returns <= 0. Be sure you
- try both on NFS V2 and V3. Some systems assume that their
- local policy apply to NFS servers -- this is a bad
- assumption! The test/t_pathconf.c program will try this
- for you -- you have to run it in a directory that is
- mounted from a server that allows file giveaway.
-SIOCGIFCONF_IS_BROKEN
- Set this if your system has an SIOCGIFCONF ioctl defined,
- but it doesn't behave the same way as "most" systems (BSD,
- Solaris, SunOS, HP-UX, etc.)
-SIOCGIFNUM_IS_BROKEN
- Set this if your system has an SIOCGIFNUM ioctl defined,
- but it doesn't behave the same way as "most" systems
- (Solaris, HP-UX).
-NEED_PERCENTQ Set this if your system doesn't support the printf
- format strings %lld or %llu. If this is set, %qd and
- %qu are used instead.
-
-
-
-+-----------------------+
-| COMPILE-TIME FEATURES |
-+-----------------------+
-
-There are a bunch of features that you can decide to compile in, such
-as selecting various database packages and special protocol support.
-Several are assumed based on other compilation flags -- if you want to
-"un-assume" something, you probably need to edit conf.h. Compilation
-flags that add support for special features include:
-
-NDBM Include support for "new" DBM library for aliases and maps.
- Normally defined in the Makefile.
-NEWDB Include support for Berkeley DB package (hash & btree)
- for aliases and maps. Normally defined in the Makefile.
- If the version of NEWDB you have is the old one that does
- not include the "fd" call (this call was added in version
- 1.5 of the Berkeley DB code), you must upgrade to the
- current version of Berkeley DB.
-NIS Define this to get NIS (YP) support for aliases and maps.
- Normally defined in the Makefile.
-NISPLUS Define this to get NIS+ support for aliases and maps.
- Normally defined in the Makefile.
-HESIOD Define this to get Hesiod support for aliases and maps.
- Normally defined in the Makefile.
-NETINFO Define this to get NeXT NetInfo support for aliases and maps.
- Normally defined in the Makefile.
-USERDB Define this to 1 to include support for the User Information
- Database. Implied by NEWDB or HESIOD. You can use
- -DUSERDB=0 to explicitly turn it off.
-IDENTPROTO Define this as 1 to get IDENT (RFC 1413) protocol support.
- This is assumed unless you are running on Ultrix or
- HP-UX, both of which have a problem in the UDP
- implementation. You can define it to be 0 to explicitly
- turn off IDENT protocol support. If defined off, the code
- is actually still compiled in, but it defaults off; you
- can turn it on by setting the IDENT timeout to 30s in the
- configuration file.
-IP_SRCROUTE Define this to 1 to get IP source routing information
- displayed in the Received: header. This is assumed on
- most systems, but some (e.g., Ultrix) apparently have a
- broken version of getsockopt that doesn't properly
- support the IP_OPTIONS call. You probably want this if
- your OS can cope with it. Symptoms of failure will be that
- it won't compile properly (that is, no support for fetching
- IP_OPTIONs), or it compiles but source-routed TCP connections
- either refuse to open or open and hang for no apparent reason.
- Ultrix and AIX3 are known to fail this way.
-LOG Set this to get syslog(3) support. Defined by default
- in conf.h. You want this if at all possible.
-NETINET Set this to get TCP/IP support. Defined by default
- in conf.h. You probably want this.
-NETISO Define this to get ISO networking support.
-NETUNIX Define this to get Unix domain networking support. Defined
- by default. A few bizarre systems (SCO, ISC, Altos) don't
- support this networking domain.
-SMTP Define this to get the SMTP code. Implied by NETINET
- or NETISO.
-NAMED_BIND If non-zero, include DNS (name daemon) support, including
- MX support. The specs say you must use this if you run
- SMTP. You don't have to be running a name server daemon
- on your machine to need this -- any use of the DNS resolver,
- including remote access to another machine, requires this
- option. Defined by default in conf.h. Define it to zero
- ONLY on machines that do not use DNS in any way.
-QUEUE Define this to get queueing code. Implied by NETINET
- or NETISO; required by SMTP. This gives you other good
- stuff -- it should be on.
-DAEMON Define this to get general network support. Implied by
- NETINET or NETISO. Defined by default in conf.h. You
- almost certainly want it on.
-MATCHGECOS Permit fuzzy matching of user names against the full
- name (GECOS) field in the /etc/passwd file. This should
- probably be on, since you can disable it from the config
- file if you want to. Defined by default in conf.h.
-MIME8TO7 If non-zero, include 8 to 7 bit MIME conversions. This
- also controls advertisement of 8BITMIME in the ESMTP
- startup dialogue.
-MIME7TO8 If non-zero, include 7 to 8 bit MIME conversions.
-HES_GETMAILHOST Define this to 1 if you are using Hesiod with the
- hes_getmailhost() routine. This is included with the MIT
- Hesiod distribution, but not with the DEC Hesiod distribution.
-XDEBUG Do additional internal checking. These don't cost too
- much; you might as well leave this on.
-TCPWRAPPERS Turns on support for the TCP wrappers library (-lwrap).
- See below for further information.
-SECUREWARE Enable calls to the SecureWare luid enabling/changing routines.
- SecureWare is a C2 security package added to several UNIX's
- (notably ConvexOS) to get a C2 Secure system. This
- option causes mail delivery to be done with the luid of the
- recipient.
-SHARE_V1 Support for the fair share scheduler, version 1. Setting to
- 1 causes final delivery to be done using the recipients
- resource limitations. So far as I know, this is only
- supported on ConvexOS.
-
-
-+---------------------+
-| DNS/RESOLVER ISSUES |
-+---------------------+
-
-Many systems have old versions of the resolver library. At a minimum,
-you should be running BIND 4.8.3; older versions may compile, but they
-have known bugs that should give you pause.
-
-Common problems in old versions include "undefined" errors for
-dn_skipname.
-
-Some people have had a problem with BIND 4.9; it uses some routines
-that it expects to be externally defined such as strerror(). It may
-help to link with "-l44bsd" to solve this problem. This has apparently
-been fixed in later versions of BIND, starting around 4.9.3. In other
-words, if you use 4.9.0 through 4.9.2, you need -l44bsd; for earlier or
-later versions, you do not.
-
-!PLEASE! be sure to link with the same version of the resolver as
-the header files you used -- some people have used the 4.9 headers
-and linked with BIND 4.8 or vice versa, and it doesn't work.
-Unfortunately, it doesn't fail in an obvious way -- things just
-subtly don't work.
-
-WILDCARD MX RECORDS ARE A BAD IDEA! The only situation in which they
-work reliably is if you have two versions of DNS, one in the real world
-which has a wildcard pointing to your firewall, and a completely
-different version of the database internally that does not include
-wildcard MX records that match your domain. ANYTHING ELSE WILL GIVE
-YOU HEADACHES!
-
-
-+-------------------------------------+
-| OPERATING SYSTEM AND COMPILE QUIRKS |
-+-------------------------------------+
-
-GCC problems
- *****************************************************************
- ** IMPORTANT: DO NOT USE OPTIMIZATION (``-O'') IF YOU ARE **
- ** RUNNING GCC 2.4.x or 2.5.x. THERE IS A BUG IN THE GCC **
- ** OPTIMIZER THAT CAUSES SENDMAIL COMPILES TO FAIL MISERABLY. **
- *****************************************************************
-
- Jim Wilson of Cygnus believes he has found the problem -- it will
- probably be fixed in GCC 2.5.6 -- but until this is verified, be
- very suspicious of gcc -O. This problem is reported to have been
- fixed in gcc 2.6.
-
- A bug in gcc 2.5.5 caused problems compiling sendmail 8.6.5 with
- optimization on a Sparc. If you are using gcc 2.5.5, youi should
- upgrade to the latest version of gcc.
-
- Apparently GCC 2.7.0 on the Pentium processor has optimization
- problems. I recommend against using -O on that architecture. This
- has been seen on FreeBSD 2.0.5 RELEASE.
-
- Solaris 2.X users should use version 2.7.2.3 over 2.7.2.
-
- We have been told there are problems with gcc 2.8.0. If you are
- using this version, you should upgrade to 2.8.1 or later.
-
-GDBM GDBM does not work with sendmail 8.8 because the additional
- security checks and file locking cause problems. Unfortunately,
- gdbm does not provide a compile flag in its version of ndbm.h so
- the code can adapt. Until the GDBM authors can fix these problems,
- GDBM will not be supported. Please use Berkeley DB instead.
-
-Configuration file location
- Up to 8.6, sendmail tried to find the sendmail.cf file in the same
- place as the vendors had put it, even when this was obviously
- stupid. As of 8.7, sendmail ALWAYS looks for /etc/sendmail.cf.
- Beginning with 8.10, sendmail will use /etc/mail/sendmail.cf.
- You can get sendmail to use the stupid vendor .cf location by
- adding -DUSE_VENDOR_CF_PATH during compilation, but this may break
- support programs and scripts that need to find sendmail.cf. You
- are STRONGLY urged to use symbolic links if you want to use the
- vendor location rather than changing the location in the sendmail
- binary.
-
-SunOS 4.x (Solaris 1.x)
- You may have to use -lresolv on SunOS. However, beware that
- this links in a new version of gethostbyname that does not
- understand NIS, so you must have all of your hosts in DNS.
-
- Some people have reported problems with the SunOS version of
- -lresolv and/or in.named, and suggest that you get a newer
- version. The symptoms are delays when you connect to the
- SMTP server on a SunOS machine or having your domain added to
- addresses inappropriately. There is a version of BIND
- version 4.9 on gatekeeper.DEC.COM in pub/BSD/bind/4.9.
-
- There is substantial disagreement about whether you can make
- this work with resolv+, which allows you to specify a search-path
- of services. Some people report that it works fine, others
- claim it doesn't work at all (including causing sendmail to
- drop core when it tries to do multiple resolv+ lookups for a
- single job). I haven't tried resolv+, as we use DNS exclusively.
-
- Should you want to try resolv+, it is on ftp.uu.net in
- /networking/ip/dns.
-
- Apparently getservbyname() can fail under moderate to high
- load under some circumstances. This will exhibit itself as
- the message ``554 makeconnection: service "smtp" unknown''.
- The problem has been traced to one or more blank lines in
- /etc/services on the NIS server machine. Delete these
- and it should work. This info is thanks to Brian Bartholomew
- <bb@math.ufl.edu> of I-Kinetics, Inc.
-
-SunOS 4.0.2 (Sun 386i)
- Date: Fri, 25 Aug 1995 11:13:58 +0200 (MET DST)
- From: teus@oce.nl
-
- Sendmail 8.7.Beta.12 compiles and runs nearly out of the box with the
- following changes:
- * Don't use /usr/5bin in your PATH, but make /usr/5bin/uname
- available as "uname" command.
- * Use the defines "-DBSD4_3 -DNAMED_BIND=0" in
- BuildTools/OS/SunOS.4.0, which is selected via the "uname" command.
- I recommend to make available the db-library on the system first
- (and change the Makefile to use this library).
- Note that the sendmail.cf and aliases files are found in /etc.
-
-SunOS 4.1.3, 4.1.3_U1
- Sendmail causes crashes on SunOS 4.1.3 and 4.1.3_U1. According
- to Sun bug number 1077939:
-
- If an application does a getsockopt() on a SOCK_STREAM (TCP) socket
- after the other side of the connection has sent a TCP RESET for
- the stream, the kernel gets a Bus Trap in the tcp_ctloutput() or
- ip_ctloutput() routine.
-
- For 4.1.3, this is fixed in patch 100584-08, available on the
- Sunsolve 2.7.1 or later CDs. For 4.1.3_U1, this was fixed in patch
- 101790-01 (SunOS 4.1.3_U1: TCP socket and reset problems), later
- obsoleted by patch 102010-05.
-
- Sun patch 100584-08 is not currently publicly available on their
- ftp site but a user has reported it can be found at other sites
- using a web search engine.
-
-Solaris 2.x (SunOS 5.x)
- To compile for Solaris, the Makefile built by Build must
- include a SOLARIS definition which reflects the Solaris version
- (i.e. -DSOLARIS=20400 for 2.4 or -DSOLARIS=20501 for 2.5.1).
- If you are using gcc, make sure -I/usr/include is not used (or
- it might complain about TopFrame). If you are using Sun's cc,
- make sure /opt/SUNWspro/bin/cc is used instead of /usr/ucb/cc
- (or it might complain about tm_zone).
-
- To the best of my knowledge, Solaris does not have the
- gethostbyname problem described above. However, it does
- have another one:
-
- From a correspondent:
-
- For solaris 2.2, I have
-
- hosts: files dns
-
- in /etc/nsswitch.conf and /etc/hosts has to have the fully
- qualified host name. I think "files" has to be before "dns"
- in /etc/nsswitch.conf during bootup.
-
- From another correspondent:
-
- When running sendmail under Solaris, the gethostbyname()
- hack in conf.c which should perform proper canonicalization
- of host names could fail. Result: the host name is not
- canonicalized despite the hack, and you'll have to define $j
- and $m in sendmail.cf somewhere.
-
- The reason could be that /etc/nsswitch.conf is improperly
- configured (at least from sendmail's point of view). For
- example, the line
-
- hosts: files nisplus dns
-
- will make gethostbyname() look in /etc/hosts first, then ask
- nisplus, then dns. However, if /etc/hosts does not contain
- the full canonicalized hostname, then no amount of
- gethostbyname()s will work.
-
- Solution (or rather, a workaround): Ask nisplus first, then
- dns, then local files:
-
- hosts: nisplus dns [NOTFOUND=return] files
-
- The Solaris "syslog" function is apparently limited to something
- about 90 characters because of a kernel limitation. If you have
- source code, you can probably up this number. You can get patches
- that fix this problem: the patch ids are:
-
- Solaris 2.1 100834
- Solaris 2.2 100999
- Solaris 2.3 101318
-
- Be sure you have the appropriate patch installed or you won't
- see system logging.
-
-Solaris 2.4 (SunOS 5.4)
- If you include /usr/lib at the end of your LD_LIBRARY_PATH you run
- the risk of getting the wrong libraries under some circumstances.
- This is because of a new feature in Solaris 2.4, described by
- Rod.Evans@Eng.Sun.COM:
-
- >> Prior to SunOS 5.4, any LD_LIBRARY_PATH setting was ignored by the
- >> runtime linker if the application was setxid (secure), thus your
- >> applications search path would be:
- >>
- >> /usr/local/lib LD_LIBRARY_PATH component - IGNORED
- >> /usr/lib LD_LIBRARY_PATH component - IGNORED
- >> /usr/local/lib RPATH - honored
- >> /usr/lib RPATH - honored
- >>
- >> the effect is that path 3 would be the first used, and this would
- >> satisfy your resolv.so lookup.
- >>
- >> In SunOS 5.4 we made the LD_LIBRARY_PATH a little more flexible.
- >> People who developed setxid applications wanted to be able to alter
- >> the library search path to some degree to allow for their own
- >> testing and debugging mechanisms. It was decided that the only
- >> secure way to do this was to allow a `trusted' path to be used in
- >> LD_LIBRARY_PATH. The only trusted directory we presently define
- >> is /usr/lib. Thus a setuid root developer could play with some
- >> alternative shared object implementations and place them in
- >> /usr/lib (being root we assume they'ed have access to write in this
- >> directory). This change was made as part of 1155380 - after a
- >> *huge* amount of discussion regarding the security aspect of things.
- >>
- >> So, in SunOS 5.4 your applications search path would be:
- >>
- >> /usr/local/lib from LD_LIBRARY_PATH - IGNORED (untrustworthy)
- >> /usr/lib from LD_LIBRARY_PATH - honored (trustworthy)
- >> /usr/local/lib from RPATH - honored
- >> /usr/lib from RPATH - honored
- >>
- >> here, path 2 would be the first used.
-
-Solaris 2.6 (SunOS 5.6)
- If you built sendmail 8.8.1 through 8.8.4 inclusive on a Solaris 2.5
- system, that binary will not run on Solaris 2.6, due to problems with
- incompatible snprintf(3s) calls. This problem is fixed in sendmail
- 8.8.5.
-
-Solaris 2.5.1 (SunOS 5.5.1) and 2.6 (SunOS 5.6)
- Apparently Solaris 2.5.1 patch 103663-01 installs a new
- /usr/include/resolv.h file that defines the __P macro without
- checking to see if it is already defined. This new resolv.h is also
- included in the Solaris 2.6 distribution. This causes compile
- warnings such as:
-
- In file included from daemon.c:51:
- /usr/include/resolv.h:208: warning: `__P' redefined
- cdefs.h:58: warning: this is the location of the previous definition
-
- These warnings can be safely ignored or you can create a resolv.h
- file in the obj.SunOS.5.5.1.* or obj.SunOS.5.6.* directory that reads:
-
- #undef __P
- #include "/usr/include/resolv.h"
-
- Sun is aware of the problem (Sun bug ID 4081053) and it will be fixed
- in Solaris 2.7.
-
-Ultrix
- By default, the IDENT protocol is turned off on Ultrix. If you
- are running Ultrix 4.4 or later, or if you have included patch
- CXO-8919 for Ultrix 4.2 or 4.3 to fix the TCP problem, you can turn
- IDENT on in the configuration file by setting the "ident" timeout
- to 30 seconds.
-
-Digital UNIX (formerly DEC OSF/1)
- If you are compiling on OSF/1 (DEC Alpha), you must use
- -L/usr/shlib (otherwise it core dumps on startup). You may also
- need -mld to get the nlist() function, although some versions
- apparently don't need this.
-
- Also, the enclosed makefile removed /usr/sbin/smtpd; if you need
- it, just create the link to the sendmail binary.
-
- On DEC OSF/1 3.2 or earlier, the MatchGECOS option doesn't work
- properly due to a bug in the getpw* routines. If you want to use
- this, use -DDEC_OSF_BROKEN_GETPWENT=1. The problem is fixed in 3.2C.
-
- Digital's mail delivery agent, /bin/mail (aka /bin/binmail), will
- only preserve the envelope sender in the "From " header if
- DefaultUserID is set to daemon. Setting this to mailnull will
- cause all mail to have the header "From mailnull ...". To use
- a different DefaultUserID, you will need to use a different mail
- delivery agent (such as mail.local found in the sendmail
- distribution).
-
- On Digital UNIX 4.0 and later, Berkeley DB 1.85 is included with the
- operating system and already has the ndbm.o module removed. However,
- Digital has modified the original Berkeley DB db.h include file.
- This results in the following warning while compiling map.c and udb.c:
-
- cc: Warning: /usr/include/db.h, line 74: The redefinition of the macro
- "__signed" conflicts with a current definition because the replacement
- lists differ. The redefinition is now in effect.
- #define __signed signed
- ------------------------^
-
- This warning can be ignored.
-
- Digital UNIX's linker checks /usr/ccs/lib/ before /usr/lib/.
- If you have installed a new version of BIND in /usr/include
- and /usr/lib, you will experience difficulties as Digital ships
- libresolv.a in /usr/ccs/lib/ as well. Be sure to replace both
- copies of libresolv.a.
-
-IRIX
- The header files on SGI IRIX are completely prototyped, and as
- a result you can sometimes get some warning messages during
- compilation. These can be ignored. There are two errors in
- deliver only if you are using gcc, both of the form ``warning:
- passing arg N of `execve' from incompatible pointer type''.
- Also, if you compile with -DNIS, you will get a complaint
- about a declaration of struct dom_binding in a prototype
- when compiling map.c; this is not important because the
- function being prototyped is not used in that file.
-
- In order to compile sendmail you will have had to install
- the developers' option in order to get the necessary include
- files.
-
- If you compile with -lmalloc (the fast memory allocator), you may
- get warning messages such as the following:
-
- ld32: WARNING 85: definition of _calloc in /usr/lib32/libmalloc.so
- preempts that definition in /usr/lib32/mips3/libc.so.
- ld32: WARNING 85: definition of _malloc in /usr/lib32/libmalloc.so
- preempts that definition in /usr/lib32/mips3/libc.so.
- ld32: WARNING 85: definition of _realloc in /usr/lib32/libmalloc.so
- preempts that definition in /usr/lib32/mips3/libc.so.
- ld32: WARNING 85: definition of _free in /usr/lib32/libmalloc.so
- preempts that definition in /usr/lib32/mips3/libc.so.
- ld32: WARNING 85: definition of _cfree in /usr/lib32/libmalloc.so
- preempts that definition in /usr/lib32/mips3/libc.so.
-
- These are unavoidable and innocuous -- just ignore them.
-
- According to Dave Sill <de5@ornl.gov>, there is a version of the
- Berkeley DB library patched to run on Irix 6.2 available from
- http://reality.sgi.com/ariel/freeware/#db .
-
-IRIX 6.x
- It is important that on IRIX 6.x you give used ABI in command
- line of Build, otherwise configuration script does not work
- correctly, e.g.,
-
- sh Build -E ABI=-n32
-
- If you are using XFS filesystem, avoid using ABI=-32 if possible.
-
-NeXT or NEXTSTEP
- NEXTSTEP 3.3 and earlier ship with the old DBM library. Also,
- Berkeley DB does not currently run on NEXTSTEP.
-
- If you are compiling on NEXTSTEP, you will have to create an
- empty file "unistd.h" and create a file "dirent.h" containing:
-
- #include <sys/dir.h>
- #define dirent direct
-
- (BuildTools/OS/NeXT should try to do both of these for you.)
-
- Apparently, there is a bug in getservbyname on Nextstep 3.0
- that causes it to fail under some circumstances with the
- message "SYSERR: service "smtp" unknown" logged. You should
- be able to work around this by including the line:
-
- OOPort=25
-
- in your .cf file.
-
- You may have to use -DNeXT.
-
-BSDI (BSD/386) 1.0, NetBSD 0.9, FreeBSD 1.0
- The "m4" from BSDI won't handle the config files properly.
- I haven't had a chance to test this myself.
-
- The M4 shipped in FreeBSD and NetBSD 0.9 don't handle the config
- files properly. One must use either GNU m4 1.1 or the PD-M4
- recently posted in comp.os.386bsd.bugs (and maybe others).
- NetBSD-current includes the PD-M4 (as stated in the NetBSD file
- CHANGES).
-
- FreeBSD 1.0 RELEASE has uname(2) now. Use -DUSEUNAME in order to
- use it (look into BuildTools/OS/FreeBSD). NetBSD-current may have
- it too but it has not been verified.
-
- The latest version of Berkeley DB uses a different naming
- scheme than the version that is supplied with your release. This
- means you will be able to use the current version of Berkeley DB
- with sendmail as long you use the new db.h when compiling
- sendmail and link it against the new libdb.a. You should probably
- keep the original db.h in /usr/include and the new db.h in
- /usr/local/include.
-
-4.3BSD
- If you are running a "virgin" version of 4.3BSD, you'll have
- a very old resolver and be missing some header files. The
- header files are simple -- create empty versions and everything
- will work fine. For the resolver you should really port a new
- version (4.8.3 or later) of the resolver; 4.9 is available on
- gatekeeper.DEC.COM in pub/BSD/bind/4.9. If you are really
- determined to continue to use your old, buggy version (or as
- a shortcut to get sendmail working -- I'm sure you have the
- best intentions to port a modern version of BIND), you can
- copy ../contrib/oldbind.compat.c into src and add
- oldbind.compat.o to OBJADD in the Makefile.
-
-A/UX
- Date: Tue, 12 Oct 1993 18:28:28 -0400 (EDT)
- From: "Eric C. Hagberg" <hagberg@med.cornell.edu>
- Subject: Fix for A/UX ndbm
-
- I guess this isn't really a sendmail bug, however, it is something
- that A/UX users should be aware of when compiling sendmail 8.6.
-
- Apparently, the calls that sendmail is using to the ndbm routines
- in A/UX 3.0.x contain calls to "broken" routines, in that the
- aliases database will break when it gets "just a little big"
- (sorry I don't have exact numbers here, but it broke somewhere
- around 20-25 aliases for me.), making all aliases non-functional
- after exceeding this point.
-
- What I did was to get the gnu-dbm-1.6 package, compile it, and
- then re-compile sendmail with "-lgdbm", "-DNDBM", and using the
- ndbm.h header file that comes with the gnu-package. This makes
- things behave properly.
- [NOTE: see comment above about GDBM]
-
- I suppose porting the New Berkeley DB package is another route,
- however, I made a quick attempt at it, and found it difficult
- (not easy at least); the gnu-dbm package "configured" and
- compiled easily.
-
- [NOTE: Berkeley DB version 2.X runs on A/UX and can be used for
- database maps.]
-
-SCO Unix
- From: Thomas Essebier <tom@stallion.oz.au>
- Organisation: Stallion Technologies Pty Ltd.
-
- It will probably help those who are trying to configure sendmail 8.6.9
- to know that if they are on SCO, they had better set
- OI-dnsrch
- or they will core dump as soon as they try to use the resolver.
- ie. although SCO has _res.dnsrch defined, and is kinda BIND 4.8.3, it
- does not inititialise it, nor does it understand 'search' in
- /etc/named.boot.
- - sigh -
-
- According to SCO, the m4 which ships with UnixWare 2.1.2 is broken.
- We recommend installing GNU m4 before attempting to build sendmail.
-
-DG/UX
- Doug Anderson <dlander@afterlife.ncsc.mil> has successfully run
- V8 on the DG/UX 5.4.2 and 5.4R3.x platforms under heavy usage.
- Originally, the DG /bin/mail program wasn't compatible with
- the V8 sendmail, since the DG /bin/mail requires the environment
- variable "_FORCE_MAIL_LOCAL_=yes" be set. Version 8.7 now includes
- this in the environment before invoking the local mailer. Some
- have used procmail to avoid this problem in the past. It works
- but some have experienced file locking problems with their DG/UX
- ports of procmail.
-
-Apollo DomainOS
- If you are compiling on Apollo, you will have to create an empty
- file "unistd.h" (for DomainOS 10.3 and earlier) and create a file
- "dirent.h" containing:
-
- #include <sys/dir.h>
- #define dirent direct
-
- (BuildTools/OS/DomainOS will attempt to do both of these for you.)
-
-HP-UX 8.00
- Date: Mon, 24 Jan 1994 13:25:45 +0200
- From: Kimmo Suominen <Kimmo.Suominen@lut.fi>
- Subject: 8.6.5 w/ HP-UX 8.00 on s300
-
- Just compiled and fought with sendmail 8.6.5 on a HP9000/360 (ie. a
- series 300 machine) running HP-UX 8.00.
-
- I was getting segmentation fault when delivering to a local user.
- With debugging I saw it was faulting when doing _free@libc... *sigh*
- It seems the new implementation of malloc on s300 is buggy as of 8.0,
- so I tried out the one in -lmalloc (malloc(3X)). With that it seems
- to work just dandy.
-
- When linking, you will get the following error:
-
- ld: multiply defined symbol _freespace in file /usr/lib/libmalloc.a
-
- but you can just ignore it. You might want to add this info to the
- README file for the future...
-
-Linux
- Something broke between versions 0.99.13 and 0.99.14 of Linux:
- the flock() system call gives errors. If you are running .14,
- you must not use flock. You can do this with -DHASFLOCK=0.
-
- Around the inclusion of bind-4.9.3 & Linux libc-4.6.20, the
- initialization of the _res structure changed. If /etc/hosts.conf
- was configured as "hosts, bind" the resolver code could return
- "Name server failure" errors. This is supposedly fixed in
- later versions of libc (>= 4.6.29?), and later versions of
- sendmail (> 8.6.10) try to work around the problem.
-
- Some older versions (< 4.6.20?) of the libc/include files conflict
- with sendmail's version of cdefs.h. Deleting sendmail's version
- on those systems should be non-harmful, and new versions don't care.
-
- Sendmail assumes that libc has snprintf, which has been true since
- libc 4.7.0. If you are running an older version, you will need to
- use -DHASSNPRINTF=0 in the Makefile. If may be able to use -lbsd
- (which includes snprintf) instead of turning this off on versions
- of libc between 4.4.4 and 4.7.0 (snprintf improves security, so
- you want to use this if at all possible).
-
- NOTE ON LINUX & BIND: By default, the Makefile generated for Linux
- includes header files in /usr/local/include and libraries in
- /usr/local/lib. If you've installed BIND on your system, the header
- files typically end up in the search path and you need to add
- "-lresolv" to the LIBS line in your Makefile. Really old versions
- may need to include "-l44bsd" as well (particularly if the link phase
- complains about missing strcasecmp, strncasecmp or strpbrk).
- Complaints about an undefined reference to `__dn_skipname' in
- domain.o are a sure sign that you need to add -lresolv to LIBS.
- Newer versions of Linux are basically threaded BIND, so you may or
- may not see complaints if you accidentally mix BIND
- headers/libraries with virginal libc. If you have BIND headers in
- /usr/local/include (resolv.h, etc) you *should* be adding -lresolv
- to LIBS. Data structures may change and you'd be asking for a
- core dump.
-
- A number of problems have been reported regarding the Linux 2.2.0
- kernel. So far, these problems have been tracked down to syslog()
- and DNS resolution. We believe the problem is with the poll()
- implementation in the Linux 2.2.0 kernel and poll()-aware versions
- of glib (at least up to 2.0.111).
-
-AIX 4.2
- The AIX m4 implements a different mechanism for ifdef which is
- inconsistent with other versions of m4. Therefore, it will not
- work properly with the sendmail Build architecture or m4
- configuration method. To work around this problem, please use
- GNU m4 from ftp://ftp.gnu.org/pub/gnu/.
-
-AIX 3.x
- This version of sendmail does not support MB, MG, and MR resource
- records, which are supported by AIX sendmail.
-
- Several people have reported that the IBM-supplied named returns
- fairly random results -- the named should be replaced. It is not
- necessary to replace the resolver, which will simplify installation.
- A new BIND resolver can be found at http://www.isc.org/isc/.
-
-AIX 3.1.x
- The supplied load average code only works correctly for AIX 3.2.x.
- For 3.1, use -DLA_TYPE=LA_SUBR and get the latest ``monitor''
- package by Jussi Maki <jmaki@hut.fi> from ftp.funet.fi in the
- directory pub/unix/AIX/rs6000/monitor-1.12.tar.Z; use the loadavgd
- daemon, and the getloadavg subroutine supplied with that package.
- If you don't care about load average throttling, just turn off
- load average checking using -DLA_TYPE=LA_ZERO.
-
-AIX 2.2.1
- Date: Mon Dec 4 14:14:56 CST 1995
- From: Mark Whetzel <markw@antimatr.houston.tx.us>
- Subject: Porting sendmail 8.7.2 to AIX V2 on the RT.
-
- This version of sendmail does not support MB, MG, and MR resource
- records, which are supported by AIX sendmail.
-
- AIX V2 on the RT does not have 'paths.h'. Create a null
- file in the 'obj' directory to remove this compile error.
-
- A patch file is needed to get the BSD 'db' library to compile
- for AIX/RT. I have sent the necessary updates to the author,
- but they may not be immediately available.
- [NOTE: Berkeley DB version 2.X runs on AIX/RT.]
-
- The original AIX/RT resolver libraries are very old, and you
- should get the latest BIND to replace it. The 4.8.3 version
- has been tested, but 4.9.x is out and should work.
-
- To make the load average code work correctly requires an
- external routine, as the kernel does not maintain system
- load averages, similar to AIX V3.1.x. A reverse port of the
- older 1.05 'monitor' load average daemon code written by
- Jussi Maki that will work on AIX V2 for the RT is available
- by E-mail to Mark Whetzel <markw@antimatr.houston.tx.us>.
- That code depends on an external daemon to collect system
- load information, and the external routine 'getloadavg',
- that will return that information. The 'LA_SUBR' define
- will handle this for AIX V2 on the RT.
-
- Note: You will have to change BuildTools/OS/AIX.2 to correctly
- point to the locatons of the updated BIND source tree and
- the location of the 'newdb' tree and library location.
- You will also have to change BuildTools/OS/AIX.2 to know
- about the location of the 'getloadavg' routine if you use
- the LA_SUBR define.
-
-
- Manual pages will format correctly if given the mandoc macros
- and used with nroff. I have not tried groff.
-
-RISC/os
- RISC/os from MIPS is a merged AT&T/Berkeley system. When you
- compile on that platform you will get duplicate definitions
- on many files. You can ignore these.
-
-System V Release 4 Based Systems
- There is a single BuildTools OS that is intended for all SVR4-based
- systems (built from BuildTools/OS/SVR4). It defines __svr4__,
- which is predefined by some compilers. If your compiler already
- defines this compile variable, you can delete the definition from
- the generated Makefile or create a BuildTools/Site/site.config.m4
- file.
-
- It's been tested on Dell Issue 2.2.
-
-DELL SVR4
- Date: Mon, 06 Dec 1993 10:42:29 EST
- From: "Kimmo Suominen" <kim@grendel.lut.fi>
- Message-ID: <2d0352f9.lento29@lento29.UUCP>
- To: eric@cs.berkeley.edu
- Cc: sendmail@cs.berkeley.edu
- Subject: Notes for DELL SVR4
-
- Eric,
-
- Here are some notes for compiling Sendmail 8.6.4 on DELL SVR4. I ran
- across these things when helping out some people who contacted me by
- e-mail.
-
- 1) Use gcc 2.4.5 (or later?). Dell distributes gcc 2.1 with their
- Issue 2.2 Unix. It is too old, and gives you problems with
- clock.c, because sigset_t won't get defined in <sys/signal.h>.
- This is due to a problematic protection rule in there, and is
- fixed with gcc 2.4.5.
-
- 2) If you don't use the new Berkeley DB (-DNEWDB), then you need
- to add "-lc -lucb" to the libraries to link with. This is because
- the -ldbm distributed by Dell needs the bcopy, bcmp and bzero
- functions. It is important that you specify both libraries in
- the given order to be sure you only get the BSTRING functions
- from the UCB library (and not the signal routines etc.).
-
- 3) Don't leave out "-lelf" even if compiling with "-lc -lucb".
- The UCB library also has another copy of the nlist routines,
- but we do want the ones from "-lelf".
-
- If anyone needs a compiled gcc 2.4.5 and/or a ported DB library, they
- can use anonymous ftp to fetch them from lut.fi in the /kim directory.
- They are copies of what I use on grendel.lut.fi, and offering them
- does not imply that I would also support them. I have sent the DB
- port for SVR4 back to Keith Bostic for inclusion in the official
- distribution, but I haven't heard anything from him as of today.
-
- - gcc-2.4.5-svr4.tar.gz (gcc 2.4.5 and the corresponding libg++)
- - db-1.72.tar.gz (with source, objects and a installed copy)
-
- Cheers
- + Kim
- --
- * Kimmo.Suominen@lut.fi * SysVr4 enthusiast at GRENDEL.LUT.FI *
- * KIM@FINFILES.BITNET * Postmaster and Hostmaster at LUT.FI *
- * + 358 200 865 718 * Unix area moderator at NIC.FUNET.FI *
-
-ConvexOS 10.1 and below
- In order to use the name server, you must create the file
- /etc/use_nameserver. If this file does not exist, the call
- to res_init() will fail and you will have absolutely no
- access to DNS, including MX records.
-
-Amdahl UTS 2.1.5
- In order to get UTS to work, you will have to port BIND 4.9.
- The vendor's BIND is reported to be ``totally inadequate.''
- See sendmail/contrib/AmdahlUTS.patch for the patches necessary
- to get BIND 4.9 compiled for UTS.
-
-UnixWare
- According to Alexander Kolbasov <sasha@unitech.gamma.ru>,
- the m4 on UnixWare 2.0 (still in Beta) will core dump on the
- config files. GNU m4 and the m4 from UnixWare 1.x both work.
-
- According to Larry Rosenman <ler@lerami.lerctr.org>:
-
- UnixWare 2.1.[23]'s m4 chokes (not obviously) when
- processing the 8.9.0 cf files.
-
- I had a LOCAL_RULE_0 that wound up AFTER the
- SBasic_check_rcpt rules using the SCO supplied M4.
- GNU M4 works fine.
-
-UNICOS 8.0.3.4
- Some people have reported that the -O flag on UNICOS can cause
- problems. You may want to turn this off if you have problems
- running sendmail. Reported by Jerry G. DeLapp <jgd@acl.lanl.gov>.
-
-GNU getopt
- I'm told that GNU getopt has a problem in that it gets confused
- by the double call. Use the version in conf.c instead.
-
-BIND 4.9.2 and Ultrix
- If you are running on Ultrix, be sure you read conf/Info.Ultrix
- in the BIND distribution very carefully -- there is information
- in there that you need to know in order to avoid errors of the
- form:
-
- /lib/libc.a(gethostent.o): sethostent: multiply defined
- /lib/libc.a(gethostent.o): endhostent: multiply defined
- /lib/libc.a(gethostent.o): gethostbyname: multiply defined
- /lib/libc.a(gethostent.o): gethostbyaddr: multiply defined
-
- during the link stage.
-
-strtoul
- Some compilers (notably gcc) claim to be ANSI C but do not
- include the ANSI-required routine "strtoul". If your compiler
- has this problem, you will get an error in srvrsmtp.c on the
- code:
-
- # ifdef defined(__STDC__) && !defined(BROKEN_ANSI_LIBRARY)
- e->e_msgsize = strtoul(vp, (char **) NULL, 10);
- # else
- e->e_msgsize = strtol(vp, (char **) NULL, 10);
- # endif
-
- You can use -DBROKEN_ANSI_LIBRARY to get around this problem.
-
-Listproc 6.0c
- Date: 23 Sep 1995 23:56:07 GMT
- Message-ID: <95925101334.~INN-AUMa00187.comp-news@dl.ac.uk>
- From: alansz@mellers1.psych.berkeley.edu (Alan Schwartz)
- Subject: Listproc 6.0c + Sendmail 8.7 [Helpful hint]
-
- Just upgraded to sendmail 8.7, and discovered that listproc 6.0c
- breaks, because it, by default, sends a blank "HELO" rather than
- a "HELO hostname" when using the 'system' or 'telnet' mailmethod.
-
- The fix is to include -DZMAILER in the compilation, which will
- cause it to use "HELO hostname" (which Z-mail apparently requires
- as well. :)
-
-LDAP
- LDAP was provided by Booker Bense <bbense+ldap@stanford.edu> of
- Stanford University. From Booker:
-
- - The patch attached to this message implements an Ldap map class.
- Currently we are using this at stanford to support campus-wide
- email addressing. More information can be found at
- http://www.stanford.edu/~bbense/Inst.html.
-
- - Currently we are using the ldap map as follows:
-
- Kluser ldapx
- -h"localhost borax.stanford.edu borate.stanford.edu boron.stanford.edu"
- -k"mailacceptinggeneralid=%s" -v maildrop
-
- and in Rule set S5
-
- # Now attempt to lookup in luser (ldap map)
- R< $L > $+ $: < $L > $( luser $1 $)
- R< $* > $+ @ $+ $: < $3 > $2 Rewrite if forward
-
- - The map definition supports most of the standard Map args plus most
- of the command line options of ldapsearch. The software is currently
- limited to only accepting the first entry returned. It expects that
- the map defines an ldap filter that returns at most 1 valid entry.
- It requires the ldap and lber libraries from the Umich Ldap3.2
- release.
-
- The software has been in production on Solaris.2.5.1 at Stanford
- for over 2 years.
-
- The LDAP map supports both the UMich LDAP 3.2 and 3.3 libraries as
- well as the OpenLDAP (http://www.openldap.org/) libraries.
-
-TCP Wrappers
- If you are using -DTCPWRAPPERS to get TCP Wrappers support you will
- also need to install libwrap.a and modify your site.config.m4 file
- or the generated Makefile to include -lwrap in the LIBS line
- (make sure that INCDIRS and LIBDIRS point to where the tcpd.h and
- libwrap.a can be found).
-
- TCP Wrappers is available on ftp.win.tue.nl in /pub/security;
- grab tcp_wrappers_<VER>.tar.gz (where <VER> is the highest
- numbered version).
-
- If you have alternate MX sites for your site, be sure that all of
- your MX sites reject the same set of hosts. If not, a bad guy whom
- you reject will connect to your site, fail, and move on to the next
- MX site, which will accept the mail for you and forward it on to you.
-
-Regular Expressions (MAP_REGEX)
- If sendmail linking fails with:
-
- undefined reference to 'regcomp'
-
- or sendmail gives an error about a regular expression with:
-
- pattern-compile-error: : Operation not applicable
-
- Your libc does not include a running version of POSIX-regex. Use
- librx or regex.o from the GNU Free Software Foundation,
- ftp://ftp.gnu.org/pub/gnu/rx-?.?.tar.gz or
- ftp://ftp.gnu.org/pub/gnu/regex-?.?.tar.gz.
- You can also use the regex-lib by Henry Spencer,
- ftp://ftp.funet.fi/pub/languages/C/spencer/regex.shar.gz
- Make sure, your compiler reads regex.h from the distribution,
- not from /usr/include, otherwise sendmail will dump a core.
-
-
-+--------------+
-| MANUAL PAGES |
-+--------------+
-
-The manual pages have been written against the -mandoc macros
-instead of the -man macros. The latest version of groff has them
-included. You can also get a copy from FTP.UU.NET in the directory
-/systems/unix/bsd-sources/share/tmac. groff is available from
-ftp.gnu.org in the /pub/gnu directory.
-
-
-+-----------------+
-| DEBUGGING HOOKS |
-+-----------------+
-
-As of 8.6.5, sendmail daemons will catch a SIGUSR1 signal and log
-some debugging output (logged at LOG_DEBUG severity). The
-information dumped is:
-
- * The value of the $j macro.
- * A warning if $j is not in the set $=w.
- * A list of the open file descriptors.
- * The contents of the connection cache.
- * If ruleset 89 is defined, it is evaluated and the results printed.
-
-This allows you to get information regarding the runtime state of the
-daemon on the fly. This should not be done too frequently, since
-the process of rewriting may lose memory which will not be recovered.
-Also, ruleset 89 may call non-reentrant routines, so there is a small
-non-zero probability that this will cause other problems. It is
-really only for debugging serious problems.
-
-A typical formulation of ruleset 89 would be:
-
- R$* $@ $>0 some test address
-
-
-+-----------------------------+
-| DESCRIPTION OF SOURCE FILES |
-+-----------------------------+
-
-The following list describes the files in this directory:
-
-Makefile.m4 A template for constructing a makefile based on the
- information in the BuildTools directory.
-README This file.
-TRACEFLAGS My own personal list of the trace flags -- not guaranteed
- to be particularly up to date.
-alias.c Does name aliasing in all forms.
-arpadate.c A subroutine which creates ARPANET standard dates.
-clock.c Routines to implement real-time oriented functions
- in sendmail -- e.g., timeouts.
-collect.c The routine that actually reads the mail into a temp
- file. It also does a certain amount of parsing of
- the header, etc.
-conf.c The configuration file. This contains information
- that is presumed to be quite static and non-
- controversial, or code compiled in for efficiency
- reasons. Most of the configuration is in sendmail.cf.
-conf.h Configuration that must be known everywhere.
-convtime.c A routine to sanely process times.
-daemon.c Routines to implement daemon mode. This version is
- specifically for Berkeley 4.1 IPC.
-deliver.c Routines to deliver mail.
-domain.c Routines that interface with DNS (the Domain Name
- System).
-err.c Routines to print error messages.
-envelope.c Routines to manipulate the envelope structure.
-headers.c Routines to process message headers.
-macro.c The macro expander. This is used internally to
- insert information from the configuration file.
-main.c The main routine to sendmail. This file also
- contains some miscellaneous routines.
-map.c Support for database maps.
-mci.c Routines that handle mail connection information caching.
-mime.c MIME conversion routines.
-parseaddr.c The routines which do address parsing.
-queue.c Routines to implement message queueing.
-readcf.c The routine that reads the configuration file and
- translates it to internal form.
-recipient.c Routines that manipulate the recipient list.
-safefile.c Routines to do careful checking of file modes and permissions
- when opening or creating files.
-savemail.c Routines which save the letter on processing errors.
-sendmail.h Main header file for sendmail.
-snprintf.c Routines to manipulate strings but prevent buffer overflows.
-srvrsmtp.c Routines to implement server SMTP.
-stab.c Routines to manage the symbol table.
-stats.c Routines to collect and post the statistics.
-sysexits.c List of error messages associated with error codes
- in sysexits.h.
-trace.c The trace package. These routines allow setting and
- testing of trace flags with a high granularity.
-udb.c The user database interface module.
-usersmtp.c Routines to implement user SMTP.
-util.c Some general purpose routines used by sendmail.
-version.c The version number and information about this
- version of sendmail. Theoretically, this gets
- modified on every change.
-
-Eric Allman
-
-(Version 8.211, last update 2/2/1999 15:28:18)
+++ /dev/null
-# @(#)TRACEFLAGS 8.21 (Berkeley) 4/27/1998
-0, 1 main.c main skip background fork
-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
-0, 101 main.c main print version and exit
-1 main.c main print from person
-2 main.c finis
-3 conf.c getla, shouldqueue
-4 conf.c enoughspace
-5 clock.c setevent, clrevent, tick
-6 savemail.c savemail, returntosender
-7 queue.c queuename
-8 domain.c getmxrr, getcanonname
-9 daemon.c getauthinfo IDENT protocol
-9 daemon.c maphostname
-10 deliver.c deliver
-11 deliver.c openmailer, mailfile
-12 parseaddr.c remotename
-13 deliver.c sendall, sendenvelope
-14 headers.c commaize
-15 daemon.c getrequests
-16 daemon.c makeconnection
-17 deliver.c hostsignature
-17 domain.c mxrand
-18 usersmtp.c reply, smtpmessage, smtpinit, smtpmailfrom
-19 srvrsmtp.c smtp
-20 parseaddr.c parseaddr
-21 parseaddr.c rewrite
-22 parseaddr.c prescan
-24 parseaddr.c buildaddr, allocaddr
-25 recipient.c sendtolist
-26 recipient.c recipient
-27 alias.c alias
-27 alias.c readaliases
-27 alias.c forward
-27 recipient.c include
-28 udb.c udbexpand, udbsender
-29 parseaddr.c maplocaluser
-29 recipient.c recipient (local users), finduser
-30 collect.c collect
-30 collect.c eatfrom
-31 headers.c chompheader
-32 headers.c eatheader
-33 headers.c crackaddr
-34 headers.c putheader
-35 macro.c expand, define
-36 stab.c stab
-37 readcf.c (many)
-38 map.c initmaps
-39 map.c map_rewrite
-40 queue.c queueup, orderq, dowork
-41 queue.c orderq
-42 mci.c mci_get
-43 mime.c mime8to7
-44 recipient.c writeable
-44 safefile.c safefile, safedirpath, filechanged
-45 envelope.c setsender
-46 envelope.c openxscript
-47 main.c drop_privileges
-48 parseaddr.c rscheck
-48 conf.c validate_connection
-49 conf.c checkcompat
-50 envelope.c dropenvelope
-51 queue.c unlockqueue
-52 main.c disconnect
-53 util.c xfclose
-54 err.c putoutmsg
-55 conf.c lockfile
-56 mci.c persistent host status
-57 util.c snprintf
-60 map.c
-61 conf.c sm_gethostbyname
-62 multiple file descriptor checking
-80 content length
-81 sun remote mode
-91 mci.c syslogging of MCI cache information
-94 srvrsmtp.c cause commands to fail (for protocol testing)
-99 main.c avoid backgrounding (no printed output)
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. 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.
- *
- * Copyright (c) 1988, 1993
- * The Regents of the University of California. All rights reserved.
- */
-
-# include "sendmail.h"
-
-#ifndef lint
-static char sccsid[] = "@(#)alias.c 8.96 (Berkeley) 12/18/1998";
-#endif /* not lint */
-
-
-MAP *AliasFileMap = NULL; /* the actual aliases.files map */
-int NAliasFileMaps; /* the number of entries in AliasFileMap */
-\f/*
-** ALIAS -- Compute aliases.
-**
-** Scans the alias file for an alias for the given address.
-** If found, it arranges to deliver to the alias list instead.
-** Uses libdbm database if -DDBM.
-**
-** Parameters:
-** a -- address to alias.
-** sendq -- a pointer to the head of the send queue
-** to put the aliases in.
-** aliaslevel -- the current alias nesting depth.
-** e -- the current envelope.
-**
-** Returns:
-** none
-**
-** Side Effects:
-** Aliases found are expanded.
-**
-** Deficiencies:
-** It should complain about names that are aliased to
-** nothing.
-*/
-
-void
-alias(a, sendq, aliaslevel, e)
- register ADDRESS *a;
- ADDRESS **sendq;
- int aliaslevel;
- register ENVELOPE *e;
-{
- register char *p;
- char *owner;
- auto int stat = EX_OK;
- char obuf[MAXNAME + 7];
- extern char *aliaslookup __P((char *, int *, ENVELOPE *));
-
- if (tTd(27, 1))
- printf("alias(%s)\n", a->q_user);
-
- /* don't realias already aliased names */
- if (bitset(QDONTSEND|QBADADDR|QVERIFIED, a->q_flags))
- return;
-
- if (NoAlias)
- return;
-
- e->e_to = a->q_paddr;
-
- /*
- ** Look up this name.
- **
- ** If the map was unavailable, we will queue this message
- ** until the map becomes available; otherwise, we could
- ** bounce messages inappropriately.
- */
-
- p = aliaslookup(a->q_user, &stat, e);
- if (stat == EX_TEMPFAIL || stat == EX_UNAVAILABLE)
- {
- a->q_flags |= QQUEUEUP;
- if (e->e_message == NULL)
- e->e_message = newstr("alias database unavailable");
- return;
- }
- if (p == NULL)
- return;
-
- /*
- ** Match on Alias.
- ** Deliver to the target list.
- */
-
- if (tTd(27, 1))
- printf("%s (%s, %s) aliased to %s\n",
- a->q_paddr, a->q_host, a->q_user, p);
- if (bitset(EF_VRFYONLY, e->e_flags))
- {
- a->q_flags |= QVERIFIED;
- return;
- }
- message("aliased to %s", shortenstring(p, MAXSHORTSTR));
- if (LogLevel > 9)
- sm_syslog(LOG_INFO, e->e_id,
- "alias %.100s => %s",
- a->q_paddr, shortenstring(p, MAXSHORTSTR));
- a->q_flags &= ~QSELFREF;
- if (tTd(27, 5))
- {
- printf("alias: QDONTSEND ");
- printaddr(a, FALSE);
- }
- a->q_flags |= QDONTSEND;
- (void) sendtolist(p, a, sendq, aliaslevel + 1, e);
- if (bitset(QSELFREF, a->q_flags))
- a->q_flags &= ~QDONTSEND;
-
- /*
- ** Look for owner of alias
- */
-
- (void) strcpy(obuf, "owner-");
- if (strncmp(a->q_user, "owner-", 6) == 0 ||
- strlen(a->q_user) > (SIZE_T) sizeof obuf - 7)
- (void) strcat(obuf, "owner");
- else
- (void) strcat(obuf, a->q_user);
- owner = aliaslookup(obuf, &stat, e);
- if (owner == NULL)
- return;
-
- /* reflect owner into envelope sender */
- if (strpbrk(owner, ",:/|\"") != NULL)
- owner = obuf;
- a->q_owner = newstr(owner);
-
- /* announce delivery to this alias; NORECEIPT bit set later */
- if (e->e_xfp != NULL)
- fprintf(e->e_xfp, "Message delivered to mailing list %s\n",
- a->q_paddr);
- e->e_flags |= EF_SENDRECEIPT;
- a->q_flags |= QDELIVERED|QEXPANDED;
-}
-\f/*
-** ALIASLOOKUP -- look up a name in the alias file.
-**
-** Parameters:
-** name -- the name to look up.
-** pstat -- a pointer to a place to put the status.
-** e -- the current envelope.
-**
-** Returns:
-** the value of name.
-** NULL if unknown.
-**
-** Side Effects:
-** none.
-**
-** Warnings:
-** The return value will be trashed across calls.
-*/
-
-char *
-aliaslookup(name, pstat, e)
- char *name;
- int *pstat;
- ENVELOPE *e;
-{
- static MAP *map = NULL;
-
- if (map == NULL)
- {
- STAB *s = stab("aliases", ST_MAP, ST_FIND);
-
- if (s == NULL)
- return NULL;
- map = &s->s_map;
- }
- if (!bitset(MF_OPEN, map->map_mflags))
- return NULL;
-
- /* special case POstMastER -- always use lower case */
- if (strcasecmp(name, "postmaster") == 0)
- name = "postmaster";
-
- return (*map->map_class->map_lookup)(map, name, NULL, pstat);
-}
-\f/*
-** SETALIAS -- set up an alias map
-**
-** Called when reading configuration file.
-**
-** Parameters:
-** spec -- the alias specification
-**
-** Returns:
-** none.
-*/
-
-void
-setalias(spec)
- char *spec;
-{
- register char *p;
- register MAP *map;
- char *class;
- STAB *s;
-
- if (tTd(27, 8))
- printf("setalias(%s)\n", spec);
-
- for (p = spec; p != NULL; )
- {
- char buf[50];
-
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p == '\0')
- break;
- spec = p;
-
- if (NAliasFileMaps >= MAXMAPSTACK)
- {
- syserr("Too many alias databases defined, %d max",
- MAXMAPSTACK);
- return;
- }
- if (AliasFileMap == NULL)
- {
- strcpy(buf, "aliases.files sequence");
- AliasFileMap = makemapentry(buf);
- if (AliasFileMap == NULL)
- {
- syserr("setalias: cannot create aliases.files map");
- return;
- }
- }
- (void) snprintf(buf, sizeof buf, "Alias%d", NAliasFileMaps);
- s = stab(buf, ST_MAP, ST_ENTER);
- map = &s->s_map;
- bzero(map, sizeof *map);
- map->map_mname = s->s_name;
-
- p = strpbrk(p, " ,/:");
- if (p != NULL && *p == ':')
- {
- /* map name */
- *p++ = '\0';
- class = spec;
- spec = p;
- }
- else
- {
- class = "implicit";
- map->map_mflags = MF_INCLNULL;
- }
-
- /* find end of spec */
- if (p != NULL)
- p = strchr(p, ',');
- if (p != NULL)
- *p++ = '\0';
-
- if (tTd(27, 20))
- printf(" map %s:%s %s\n", class, s->s_name, spec);
-
- /* look up class */
- s = stab(class, ST_MAPCLASS, ST_FIND);
- if (s == NULL)
- {
- syserr("setalias: unknown alias class %s", class);
- }
- else if (!bitset(MCF_ALIASOK, s->s_mapclass.map_cflags))
- {
- syserr("setalias: map class %s can't handle aliases",
- class);
- }
- else
- {
- map->map_class = &s->s_mapclass;
- if (map->map_class->map_parse(map, spec))
- {
- map->map_mflags |= MF_VALID|MF_ALIAS;
- AliasFileMap->map_stack[NAliasFileMaps++] = map;
- }
- }
- }
-}
-\f/*
-** ALIASWAIT -- wait for distinguished @:@ token to appear.
-**
-** This can decide to reopen or rebuild the alias file
-**
-** Parameters:
-** map -- a pointer to the map descriptor for this alias file.
-** ext -- the filename extension (e.g., ".db") for the
-** database file.
-** isopen -- if set, the database is already open, and we
-** should check for validity; otherwise, we are
-** just checking to see if it should be created.
-**
-** Returns:
-** TRUE -- if the database is open when we return.
-** FALSE -- if the database is closed when we return.
-*/
-
-bool
-aliaswait(map, ext, isopen)
- MAP *map;
- char *ext;
- int isopen;
-{
- bool attimeout = FALSE;
- time_t mtime;
- struct stat stb;
- char buf[MAXNAME + 1];
-
- if (tTd(27, 3))
- printf("aliaswait(%s:%s)\n",
- map->map_class->map_cname, map->map_file);
- if (bitset(MF_ALIASWAIT, map->map_mflags))
- return isopen;
- map->map_mflags |= MF_ALIASWAIT;
-
- if (SafeAlias > 0)
- {
- auto int st;
- time_t toolong = curtime() + SafeAlias;
- unsigned int sleeptime = 2;
-
- while (isopen &&
- map->map_class->map_lookup(map, "@", NULL, &st) == NULL)
- {
- if (curtime() > toolong)
- {
- /* we timed out */
- attimeout = TRUE;
- break;
- }
-
- /*
- ** Close and re-open the alias database in case
- ** the one is mv'ed instead of cp'ed in.
- */
-
- if (tTd(27, 2))
- printf("aliaswait: sleeping for %d seconds\n",
- sleeptime);
-
- map->map_class->map_close(map);
- map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
- sleep(sleeptime);
- sleeptime *= 2;
- if (sleeptime > 60)
- sleeptime = 60;
- isopen = map->map_class->map_open(map, O_RDONLY);
- }
- }
-
- /* see if we need to go into auto-rebuild mode */
- if (!bitset(MCF_REBUILDABLE, map->map_class->map_cflags))
- {
- if (tTd(27, 3))
- printf("aliaswait: not rebuildable\n");
- map->map_mflags &= ~MF_ALIASWAIT;
- return isopen;
- }
- if (stat(map->map_file, &stb) < 0)
- {
- if (tTd(27, 3))
- printf("aliaswait: no source file\n");
- map->map_mflags &= ~MF_ALIASWAIT;
- return isopen;
- }
- mtime = stb.st_mtime;
- snprintf(buf, sizeof buf, "%s%s",
- map->map_file, ext == NULL ? "" : ext);
- if (stat(buf, &stb) < 0 || stb.st_mtime < mtime || attimeout)
- {
- /* database is out of date */
- if (AutoRebuild && stb.st_ino != 0 &&
- (stb.st_uid == geteuid() ||
- (geteuid() == 0 && stb.st_uid == TrustedUid)))
- {
- bool oldSuprErrs;
-
- message("auto-rebuilding alias database %s", buf);
- oldSuprErrs = SuprErrs;
- SuprErrs = TRUE;
- if (isopen)
- {
- map->map_class->map_close(map);
- map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
- }
- (void) rebuildaliases(map, TRUE);
- isopen = map->map_class->map_open(map, O_RDONLY);
- SuprErrs = oldSuprErrs;
- }
- else
- {
- if (LogLevel > 3)
- sm_syslog(LOG_INFO, NOQID,
- "alias database %s out of date",
- buf);
- message("Warning: alias database %s out of date", buf);
- }
- }
- map->map_mflags &= ~MF_ALIASWAIT;
- return isopen;
-}
-\f/*
-** REBUILDALIASES -- rebuild the alias database.
-**
-** Parameters:
-** map -- the database to rebuild.
-** automatic -- set if this was automatically generated.
-**
-** Returns:
-** TRUE if successful; FALSE otherwise.
-**
-** Side Effects:
-** Reads the text version of the database, builds the
-** DBM or DB version.
-*/
-
-bool
-rebuildaliases(map, automatic)
- register MAP *map;
- bool automatic;
-{
- FILE *af;
- bool nolock = FALSE;
- bool success = FALSE;
- int sff = SFF_OPENASROOT|SFF_REGONLY|SFF_NOLOCK;
- sigfunc_t oldsigint, oldsigquit;
-#ifdef SIGTSTP
- sigfunc_t oldsigtstp;
-#endif
-
- if (!bitset(MCF_REBUILDABLE, map->map_class->map_cflags))
- return FALSE;
-
- if (!bitset(DBS_LINKEDALIASFILEINWRITABLEDIR, DontBlameSendmail))
- sff |= SFF_NOWLINK;
- if (!bitset(DBS_GROUPWRITABLEALIASFILE, DontBlameSendmail))
- sff |= SFF_NOGWFILES;
- if (!bitset(DBS_WORLDWRITABLEALIASFILE, DontBlameSendmail))
- sff |= SFF_NOWWFILES;
-
- /* try to lock the source file */
- if ((af = safefopen(map->map_file, O_RDWR, 0, sff)) == NULL)
- {
- struct stat stb;
-
- if ((errno != EACCES && errno != EROFS) || automatic ||
- (af = safefopen(map->map_file, O_RDONLY, 0, sff)) == NULL)
- {
- int saveerr = errno;
-
- if (tTd(27, 1))
- printf("Can't open %s: %s\n",
- map->map_file, errstring(saveerr));
- if (!automatic && !bitset(MF_OPTIONAL, map->map_mflags))
- message("newaliases: cannot open %s: %s",
- map->map_file, errstring(saveerr));
- errno = 0;
- return FALSE;
- }
- nolock = TRUE;
- if (tTd(27, 1) ||
- fstat(fileno(af), &stb) < 0 ||
- bitset(S_IWUSR|S_IWGRP|S_IWOTH, stb.st_mode))
- message("warning: cannot lock %s: %s",
- map->map_file, errstring(errno));
- }
-
- /* see if someone else is rebuilding the alias file */
- if (!nolock &&
- !lockfile(fileno(af), map->map_file, NULL, LOCK_EX|LOCK_NB))
- {
- /* yes, they are -- wait until done */
- message("Alias file %s is locked (maybe being rebuilt)",
- map->map_file);
- if (OpMode != MD_INITALIAS)
- {
- /* wait for other rebuild to complete */
- (void) lockfile(fileno(af), map->map_file, NULL,
- LOCK_EX);
- }
- (void) xfclose(af, "rebuildaliases1", map->map_file);
- errno = 0;
- return FALSE;
- }
-
- oldsigint = setsignal(SIGINT, SIG_IGN);
- oldsigquit = setsignal(SIGQUIT, SIG_IGN);
-#ifdef SIGTSTP
- oldsigtstp = setsignal(SIGTSTP, SIG_IGN);
-#endif
-
- if (map->map_class->map_open(map, O_RDWR))
- {
- if (LogLevel > 7)
- {
- sm_syslog(LOG_NOTICE, NOQID,
- "alias database %s %srebuilt by %s",
- map->map_file, automatic ? "auto" : "",
- username());
- }
- map->map_mflags |= MF_OPEN|MF_WRITABLE;
- map->map_pid = getpid();
- readaliases(map, af, !automatic, TRUE);
- success = TRUE;
- }
- else
- {
- if (tTd(27, 1))
- printf("Can't create database for %s: %s\n",
- map->map_file, errstring(errno));
- if (!automatic)
- syserr("Cannot create database for alias file %s",
- map->map_file);
- }
-
- /* close the file, thus releasing locks */
- xfclose(af, "rebuildaliases2", map->map_file);
-
- /* add distinguished entries and close the database */
- if (bitset(MF_OPEN, map->map_mflags))
- {
- map->map_class->map_close(map);
- map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
- }
-
- /* restore the old signals */
- (void) setsignal(SIGINT, oldsigint);
- (void) setsignal(SIGQUIT, oldsigquit);
-#ifdef SIGTSTP
- (void) setsignal(SIGTSTP, oldsigtstp);
-#endif
- return success;
-}
-\f/*
-** READALIASES -- read and process the alias file.
-**
-** This routine implements the part of initaliases that occurs
-** when we are not going to use the DBM stuff.
-**
-** Parameters:
-** map -- the alias database descriptor.
-** af -- file to read the aliases from.
-** announcestats -- anounce statistics regarding number of
-** aliases, longest alias, etc.
-** logstats -- lot the same info.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Reads aliasfile into the symbol table.
-** Optionally, builds the .dir & .pag files.
-*/
-
-void
-readaliases(map, af, announcestats, logstats)
- register MAP *map;
- FILE *af;
- bool announcestats;
- bool logstats;
-{
- register char *p;
- char *rhs;
- bool skipping;
- long naliases, bytes, longest;
- ADDRESS al, bl;
- char line[BUFSIZ];
-
- /*
- ** Read and interpret lines
- */
-
- FileName = map->map_file;
- LineNumber = 0;
- naliases = bytes = longest = 0;
- skipping = FALSE;
- while (fgets(line, sizeof (line), af) != NULL)
- {
- int lhssize, rhssize;
- int c;
-
- LineNumber++;
- p = strchr(line, '\n');
-#if _FFR_BACKSLASH_IN_ALIASES
- while (p != NULL && p > line && p[-1] == '\\')
- {
- p--;
- if (fgets(p, SPACELEFT(line, p), af) == NULL)
- break;
- LineNumber++;
- p = strchr(p, '\n');
- }
-#endif
- if (p != NULL)
- *p = '\0';
- else if (!feof(af))
- {
- syserr("554 alias line too long");
-
- /* flush to end of line */
- while ((c = getc(af)) != EOF && c != '\n')
- continue;
-
- /* skip any continuation lines */
- skipping = TRUE;
- continue;
- }
- switch (line[0])
- {
- case '#':
- case '\0':
- skipping = FALSE;
- continue;
-
- case ' ':
- case '\t':
- if (!skipping)
- syserr("554 Non-continuation line starts with space");
- skipping = TRUE;
- continue;
- }
- skipping = FALSE;
-
- /*
- ** Process the LHS
- ** Find the colon separator, and parse the address.
- ** It should resolve to a local name -- this will
- ** be checked later (we want to optionally do
- ** parsing of the RHS first to maximize error
- ** detection).
- */
-
- for (p = line; *p != '\0' && *p != ':' && *p != '\n'; p++)
- continue;
- if (*p++ != ':')
- {
- syserr("554 missing colon");
- continue;
- }
- if (parseaddr(line, &al, RF_COPYALL, ':', NULL, CurEnv) == NULL)
- {
- syserr("554 %.40s... illegal alias name", line);
- continue;
- }
-
- /*
- ** Process the RHS.
- ** 'al' is the internal form of the LHS address.
- ** 'p' points to the text of the RHS.
- */
-
- while (isascii(*p) && isspace(*p))
- p++;
- rhs = p;
- for (;;)
- {
- register char *nlp;
-
- nlp = &p[strlen(p)];
- if (nlp[-1] == '\n')
- *--nlp = '\0';
-
- if (CheckAliases)
- {
- /* do parsing & compression of addresses */
- while (*p != '\0')
- {
- auto char *delimptr;
-
- while ((isascii(*p) && isspace(*p)) ||
- *p == ',')
- p++;
- if (*p == '\0')
- break;
- if (parseaddr(p, &bl, RF_COPYNONE, ',',
- &delimptr, CurEnv) == NULL)
- usrerr("553 %s... bad address", p);
- p = delimptr;
- }
- }
- else
- {
- p = nlp;
- }
-
- /* see if there should be a continuation line */
- c = getc(af);
- if (!feof(af))
- (void) ungetc(c, af);
- if (c != ' ' && c != '\t')
- break;
-
- /* read continuation line */
- if (fgets(p, sizeof line - (p - line), af) == NULL)
- break;
- LineNumber++;
-
- /* check for line overflow */
- if (strchr(p, '\n') == NULL && !feof(af))
- {
- usrerr("554 alias too long");
- while ((c = fgetc(af)) != EOF && c != '\n')
- continue;
- skipping = TRUE;
- break;
- }
- }
-
- if (skipping)
- continue;
-
- if (!bitnset(M_ALIASABLE, al.q_mailer->m_flags))
- {
- syserr("554 %s... cannot alias non-local names",
- al.q_paddr);
- continue;
- }
-
- /*
- ** Insert alias into symbol table or database file.
- **
- ** Special case pOStmaStER -- always make it lower case.
- */
-
- if (strcasecmp(al.q_user, "postmaster") == 0)
- makelower(al.q_user);
-
- lhssize = strlen(al.q_user);
- rhssize = strlen(rhs);
- map->map_class->map_store(map, al.q_user, rhs);
-
- if (al.q_paddr != NULL)
- free(al.q_paddr);
- if (al.q_host != NULL)
- free(al.q_host);
- if (al.q_user != NULL)
- free(al.q_user);
-
- /* statistics */
- naliases++;
- bytes += lhssize + rhssize;
- if (rhssize > longest)
- longest = rhssize;
- }
-
- CurEnv->e_to = NULL;
- FileName = NULL;
- if (Verbose || announcestats)
- message("%s: %d aliases, longest %d bytes, %d bytes total",
- map->map_file, naliases, longest, bytes);
- if (LogLevel > 7 && logstats)
- sm_syslog(LOG_INFO, NOQID,
- "%s: %d aliases, longest %d bytes, %d bytes total",
- map->map_file, naliases, longest, bytes);
-}
-\f/*
-** FORWARD -- Try to forward mail
-**
-** This is similar but not identical to aliasing.
-**
-** Parameters:
-** user -- the name of the user who's mail we would like
-** to forward to. It must have been verified --
-** i.e., the q_home field must have been filled
-** in.
-** sendq -- a pointer to the head of the send queue to
-** put this user's aliases in.
-** aliaslevel -- the current alias nesting depth.
-** e -- the current envelope.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** New names are added to send queues.
-*/
-
-void
-forward(user, sendq, aliaslevel, e)
- ADDRESS *user;
- ADDRESS **sendq;
- int aliaslevel;
- register ENVELOPE *e;
-{
- char *pp;
- char *ep;
- bool got_transient;
-
- if (tTd(27, 1))
- printf("forward(%s)\n", user->q_paddr);
-
- if (!bitnset(M_HASPWENT, user->q_mailer->m_flags) ||
- bitset(QBADADDR, user->q_flags))
- return;
- if (user->q_home == NULL)
- {
- syserr("554 forward: no home");
- user->q_home = "/no/such/directory";
- }
-
- /* good address -- look for .forward file in home */
- define('z', user->q_home, e);
- define('u', user->q_user, e);
- define('h', user->q_host, e);
- if (ForwardPath == NULL)
- ForwardPath = newstr("\201z/.forward");
-
- got_transient = FALSE;
- for (pp = ForwardPath; pp != NULL; pp = ep)
- {
- int err;
- char buf[MAXPATHLEN+1];
-
- ep = strchr(pp, ':');
- if (ep != NULL)
- *ep = '\0';
- expand(pp, buf, sizeof buf, e);
- if (ep != NULL)
- *ep++ = ':';
- if (buf[0] == '\0')
- continue;
- if (tTd(27, 3))
- printf("forward: trying %s\n", buf);
-
- err = include(buf, TRUE, user, sendq, aliaslevel, e);
- if (err == 0)
- break;
- else if (transienterror(err))
- {
- /* we may have to suspend this message */
- got_transient = TRUE;
- if (tTd(27, 2))
- printf("forward: transient error on %s\n", buf);
- if (LogLevel > 2)
- sm_syslog(LOG_ERR, e->e_id,
- "forward %s: transient error: %s",
- buf, errstring(err));
- }
- else
- {
- switch (err)
- {
- case ENOENT:
- break;
-
-#if _FFR_FORWARD_SYSERR
- case E_SM_NOSLINK:
- case E_SM_NOHLINK:
- case E_SM_REGONLY:
- case E_SM_ISEXEC:
- case E_SM_WWDIR:
- case E_SM_GWDIR:
- case E_SM_WWFILE:
- case E_SM_GWFILE:
- syserr("forward: %s: %s", buf, errstring(err));
- break;
-#endif
-
- default:
- if (LogLevel > (RunAsUid == 0 ? 2 : 10))
- sm_syslog(LOG_WARNING, e->e_id,
- "forward %s: %s", buf,
- errstring(err));
- if (Verbose)
- message("forward: %s: %s",
- buf,
- errstring(err));
- break;
- }
- }
- }
- if (pp == NULL && got_transient)
- {
- /*
- ** There was no successful .forward open and at least one
- ** transient open. We have to defer this address for
- ** further delivery.
- */
-
- message("transient .forward open error: message queued");
- user->q_flags |= QQUEUEUP;
- return;
- }
-}
+++ /dev/null
-#
-# @(#)aliases 8.2 (Berkeley) 3/5/94
-#
-# Aliases in this file will NOT be expanded in the header from
-# Mail, but WILL be visible over networks or from /bin/mail.
-#
-# >>>>>>>>>> The program "newaliases" must be run after
-# >> NOTE >> this file is updated for any changes to
-# >>>>>>>>>> show through to sendmail.
-#
-
-# Basic system aliases -- these MUST be present.
-MAILER-DAEMON: postmaster
-postmaster: root
-
-# General redirections for pseudo accounts.
-bin: root
-daemon: root
-games: root
-ingres: root
-nobody: root
-system: root
-toor: root
-uucp: root
-
-# Well-known aliases.
-manager: root
-dumper: root
-operator: root
-
-# trap decode to catch security attacks
-decode: root
-
-# OFFICIAL CSRG/BUG ADDRESSES
-
-# Ftp maintainer.
-ftp: ftp-bugs
-ftp-bugs: bigbug@cs.berkeley.edu
-
-# Distribution office.
-bsd-dist: bsd-dist@cs.berkeley.edu
-
-# Fortune maintainer.
-fortune: fortune@cs.berkeley.edu
-
-# Termcap maintainer.
-termcap: termcap@cs.berkeley.edu
-
-# General bug address.
-ucb-fixes: bigbug@cs.berkeley.edu
-ucb-fixes-request: bigbug@cs.berkeley.edu
-bugs: bugs@cs.berkeley.edu
-# END OFFICIAL BUG ADDRESSES
+++ /dev/null
-.\" Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-.\" Copyright (c) 1983, 1997 Eric P. Allman. All rights reserved.
-.\" Copyright (c) 1985, 1991, 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.
-.\"
-.\"
-.\" @(#)aliases.5 8.8 (Berkeley) 5/19/1998
-.\"
-.Dd May 19, 1998
-.Dt ALIASES 5
-.Os
-.Sh NAME
-.Nm aliases
-.Nd aliases file for sendmail
-.Sh SYNOPSIS
-.Nm aliases
-.Sh DESCRIPTION
-This file describes user
-.Tn ID
-aliases used by
-.Pa /usr/sbin/sendmail .
-The file resides in
-.Pa /etc
-and
-is formatted as a series of lines of the form
-.Bd -filled -offset indent
-name: name_1, name2, name_3, . . .
-.Ed
-.Pp
-The
-.Em name
-is the name to alias, and the
-.Em name_n
-are the aliases for that name.
-Lines beginning with whitespace are continuation lines.
-Lines beginning with
-.Ql #
-are comments.
-.Pp
-Aliasing occurs only on local names.
-Loops can not occur, since no message will be sent to any person more than once.
-.Pp
-After aliasing has been done, local and valid recipients who have a
-.Dq Pa .forward
-file in their home directory have messages forwarded to the
-list of users defined in that file.
-.Pp
-This is only the raw data file; the actual aliasing information is
-placed into a binary format in the file
-.Pa /etc/aliases.db
-using the program
-.Xr newaliases 1 .
-A
-.Xr newaliases
-command should be executed each time the aliases file is changed for the
-change to take effect.
-.Sh SEE ALSO
-.Xr newaliases 1 ,
-.Xr dbopen 3 ,
-.Xr dbm 3 ,
-.Xr sendmail 8
-.Rs
-.%T "SENDMAIL Installation and Operation Guide"
-.Re
-.Rs
-.%T "SENDMAIL An Internetwork Mail Router"
-.Re
-.Sh BUGS
-If you have compiled
-.Xr sendmail
-with DBM support instead of NEWDB,
-you may have encountered problems in
-.Xr dbm 3
-restricting a single alias to about 1000 bytes of information.
-You can get longer aliases by ``chaining''; that is, make the last name in
-the alias be a dummy name which is a continuation alias.
-.Sh HISTORY
-The
-.Nm
-file format appeared in
-.Bx 4.0 .
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)arpadate.c 8.14 (Berkeley) 2/2/1999";
-#endif /* not lint */
-
-# include "sendmail.h"
-
-/*
-** ARPADATE -- Create date in ARPANET format
-**
-** Parameters:
-** ud -- unix style date string. if NULL, one is created.
-**
-** Returns:
-** pointer to an ARPANET date field
-**
-** Side Effects:
-** none
-**
-** WARNING:
-** date is stored in a local buffer -- subsequent
-** calls will overwrite.
-**
-** Bugs:
-** Timezone is computed from local time, rather than
-** from whereever (and whenever) the message was sent.
-** To do better is very hard.
-**
-** Some sites are now inserting the timezone into the
-** local date. This routine should figure out what
-** the format is and work appropriately.
-*/
-
-#ifndef TZNAME_MAX
-# define TZNAME_MAX 50 /* max size of timezone */
-#endif
-
-/* values for TZ_TYPE */
-#define TZ_NONE 0 /* no character timezone support */
-#define TZ_TM_NAME 1 /* use tm->tm_name */
-#define TZ_TM_ZONE 2 /* use tm->tm_zone */
-#define TZ_TZNAME 3 /* use tzname[] */
-#define TZ_TIMEZONE 4 /* use timezone() */
-
-char *
-arpadate(ud)
- register char *ud;
-{
- register char *p;
- register char *q;
- register int off;
- register int i;
- register struct tm *lt;
- time_t t;
- struct tm gmt;
- char *tz;
- static char b[43 + TZNAME_MAX];
-
- /*
- ** Get current time.
- ** This will be used if a null argument is passed and
- ** to resolve the timezone.
- */
-
- t = curtime();
- if (ud == NULL)
- ud = ctime(&t);
-
- /*
- ** Crack the UNIX date line in a singularly unoriginal way.
- */
-
- q = b;
-
- p = &ud[0]; /* Mon */
- *q++ = *p++;
- *q++ = *p++;
- *q++ = *p++;
- *q++ = ',';
- *q++ = ' ';
-
- p = &ud[8]; /* 16 */
- if (*p == ' ')
- p++;
- else
- *q++ = *p++;
- *q++ = *p++;
- *q++ = ' ';
-
- p = &ud[4]; /* Sep */
- *q++ = *p++;
- *q++ = *p++;
- *q++ = *p++;
- *q++ = ' ';
-
- p = &ud[20]; /* 1979 */
- *q++ = *p++;
- *q++ = *p++;
- *q++ = *p++;
- *q++ = *p++;
- *q++ = ' ';
-
- p = &ud[11]; /* 01:03:52 */
- for (i = 8; i > 0; i--)
- *q++ = *p++;
-
- /*
- * should really get the timezone from the time in "ud" (which
- * is only different if a non-null arg was passed which is different
- * from the current time), but for all practical purposes, returning
- * the current local zone will do (its all that is ever needed).
- */
- gmt = *gmtime(&t);
- lt = localtime(&t);
-
- off = (lt->tm_hour - gmt.tm_hour) * 60 + lt->tm_min - gmt.tm_min;
-
- /* assume that offset isn't more than a day ... */
- if (lt->tm_year < gmt.tm_year)
- off -= 24 * 60;
- else if (lt->tm_year > gmt.tm_year)
- off += 24 * 60;
- else if (lt->tm_yday < gmt.tm_yday)
- off -= 24 * 60;
- else if (lt->tm_yday > gmt.tm_yday)
- off += 24 * 60;
-
- *q++ = ' ';
- if (off == 0)
- {
- *q++ = 'G';
- *q++ = 'M';
- *q++ = 'T';
- }
- else
- {
- tz = NULL;
-#if TZ_TYPE == TZ_TM_NAME
- tz = lt->tm_name;
-#endif
-#if TZ_TYPE == TZ_TM_ZONE
- tz = lt->tm_zone;
-#endif
-#if TZ_TYPE == TZ_TZNAME
- {
- extern char *tzname[];
-
- if (lt->tm_isdst > 0)
- tz = tzname[1];
- else if (lt->tm_isdst == 0)
- tz = tzname[0];
- else
- tz = NULL;
- }
-#endif
-#if TZ_TYPE == TZ_TIMEZONE
- {
- extern char *timezone();
-
- tz = timezone(off, lt->tm_isdst);
- }
-#endif
- if (off < 0)
- {
- off = -off;
- *q++ = '-';
- }
- else
- *q++ = '+';
-
- if (off >= 24*60) /* should be impossible */
- off = 23*60+59; /* if not, insert silly value */
-
- *q++ = (off / 600) + '0';
- *q++ = (off / 60) % 10 + '0';
- off %= 60;
- *q++ = (off / 10) + '0';
- *q++ = (off % 10) + '0';
- if (tz != NULL && *tz != '\0')
- {
- *q++ = ' ';
- *q++ = '(';
- while (*tz != '\0' && q < &b[sizeof b - 3])
- *q++ = *tz++;
- *q++ = ')';
- }
- }
- *q = '\0';
-
- return (b);
-}
+++ /dev/null
-/*
- * Copyright (c) 1991, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * This code is derived from software contributed to Berkeley by
- * Berkeley Software Design, Inc.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- * @(#)cdefs.h 8.8 (Berkeley) 1/9/95
- */
-
-#ifndef _CDEFS_H_
-#define _CDEFS_H_
-
-#if defined(__cplusplus)
-#define __BEGIN_DECLS extern "C" {
-#define __END_DECLS };
-#else
-#define __BEGIN_DECLS
-#define __END_DECLS
-#endif
-
-/*
- * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
- * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
- * The __CONCAT macro is a bit tricky -- make sure you don't put spaces
- * in between its arguments. __CONCAT can also concatenate double-quoted
- * strings produced by the __STRING macro, but this only works with ANSI C.
- */
-#if defined(__STDC__) || defined(__cplusplus)
-#define __P(protos) protos /* full-blown ANSI C */
-#define __CONCAT(x,y) x ## y
-#define __STRING(x) #x
-
-#define __const const /* define reserved names to standard */
-#define __signed signed
-#define __volatile volatile
-#if defined(__cplusplus)
-#define __inline inline /* convert to C++ keyword */
-#else
-#ifndef __GNUC__
-#define __inline /* delete GCC keyword */
-#endif /* !__GNUC__ */
-#endif /* !__cplusplus */
-
-#else /* !(__STDC__ || __cplusplus) */
-#define __P(protos) () /* traditional C preprocessor */
-#define __CONCAT(x,y) x/**/y
-#define __STRING(x) "x"
-
-#ifndef __GNUC__
-#define __const /* delete pseudo-ANSI C keywords */
-#define __inline
-#define __signed
-#define __volatile
-/*
- * In non-ANSI C environments, new programs will want ANSI-only C keywords
- * deleted from the program and old programs will want them left alone.
- * When using a compiler other than gcc, programs using the ANSI C keywords
- * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
- * When using "gcc -traditional", we assume that this is the intent; if
- * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
- */
-#ifndef NO_ANSI_KEYWORDS
-#define const /* delete ANSI C keywords */
-#define inline
-#define signed
-#define volatile
-#endif
-#endif /* !__GNUC__ */
-#endif /* !(__STDC__ || __cplusplus) */
-
-/*
- * GCC1 and some versions of GCC2 declare dead (non-returning) and
- * pure (no side effects) functions using "volatile" and "const";
- * unfortunately, these then cause warnings under "-ansi -pedantic".
- * GCC2 uses a new, peculiar __attribute__((attrs)) style. All of
- * these work for GNU C++ (modulo a slight glitch in the C++ grammar
- * in the distribution version of 2.5.5).
- */
-#if !defined(__GNUC__) || __GNUC__ < 2 || \
- (__GNUC__ == 2 && __GNUC_MINOR__ < 5)
-#define __attribute__(x) /* delete __attribute__ if non-gcc or gcc1 */
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-#define __dead __volatile
-#define __pure __const
-#endif
-#endif
-
-/* Delete pseudo-keywords wherever they are not available or needed. */
-#ifndef __dead
-#define __dead
-#define __pure
-#endif
-
-#endif /* !_CDEFS_H_ */
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)clock.c 8.35 (Berkeley) 2/2/1999";
-#endif /* not lint */
-
-# include "sendmail.h"
-
-# ifndef sigmask
-# define sigmask(s) (1 << ((s) - 1))
-# endif
-
-/*
-** SETEVENT -- set an event to happen at a specific time.
-**
-** Events are stored in a sorted list for fast processing.
-** An event only applies to the process that set it.
-**
-** Parameters:
-** intvl -- intvl until next event occurs.
-** func -- function to call on event.
-** arg -- argument to func on event.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** none.
-*/
-
-EVENT *FreeEventList; /* list of free events */
-
-static SIGFUNC_DECL tick __P((int));
-
-EVENT *
-setevent(intvl, func, arg)
- time_t intvl;
- void (*func)();
- int arg;
-{
- register EVENT **evp;
- register EVENT *ev;
- auto time_t now;
- int wasblocked;
-
- if (intvl <= 0)
- {
- syserr("554 setevent: intvl=%ld\n", intvl);
- return (NULL);
- }
-
- wasblocked = blocksignal(SIGALRM);
- now = curtime();
-
- /* search event queue for correct position */
- for (evp = &EventQueue; (ev = *evp) != NULL; evp = &ev->ev_link)
- {
- if (ev->ev_time >= now + intvl)
- break;
- }
-
- /* insert new event */
- ev = FreeEventList;
- if (ev == NULL)
- ev = (EVENT *) xalloc(sizeof *ev);
- else
- FreeEventList = ev->ev_link;
- ev->ev_time = now + intvl;
- ev->ev_func = func;
- ev->ev_arg = arg;
- ev->ev_pid = getpid();
- ev->ev_link = *evp;
- *evp = ev;
-
- if (tTd(5, 5))
- printf("setevent: intvl=%ld, for=%ld, func=%lx, arg=%d, ev=%lx\n",
- (long) intvl, (long)(now + intvl), (u_long) func,
- arg, (u_long) ev);
-
- setsignal(SIGALRM, tick);
- intvl = EventQueue->ev_time - now;
- (void) alarm((unsigned) intvl < 1 ? 1 : intvl);
- if (wasblocked == 0)
- (void) releasesignal(SIGALRM);
- return (ev);
-}
-\f/*
-** CLREVENT -- remove an event from the event queue.
-**
-** Parameters:
-** ev -- pointer to event to remove.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** arranges for event ev to not happen.
-*/
-
-void
-clrevent(ev)
- register EVENT *ev;
-{
- register EVENT **evp;
- int wasblocked;
-
- if (tTd(5, 5))
- printf("clrevent: ev=%lx\n", (u_long) ev);
- if (ev == NULL)
- return;
-
- /* find the parent event */
- wasblocked = blocksignal(SIGALRM);
- for (evp = &EventQueue; *evp != NULL; evp = &(*evp)->ev_link)
- {
- if (*evp == ev)
- break;
- }
-
- /* now remove it */
- if (*evp != NULL)
- {
- *evp = ev->ev_link;
- ev->ev_link = FreeEventList;
- FreeEventList = ev;
- }
-
- /* restore clocks and pick up anything spare */
- if (wasblocked == 0)
- releasesignal(SIGALRM);
- if (EventQueue != NULL)
- kill(getpid(), SIGALRM);
-}
-\f/*
-** TICK -- take a clock tick
-**
-** Called by the alarm clock. This routine runs events as needed.
-** Always called as a signal handler, so we assume that SIGALRM
-** has been blocked.
-**
-** Parameters:
-** One that is ignored; for compatibility with signal handlers.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** calls the next function in EventQueue.
-*/
-
-/* ARGSUSED */
-static SIGFUNC_DECL
-tick(sig)
- int sig;
-{
- register time_t now;
- register EVENT *ev;
- int mypid = getpid();
- int olderrno = errno;
-
- (void) alarm(0);
- now = curtime();
-
- if (tTd(5, 4))
- printf("tick: now=%ld\n", (long) now);
-
- /* reset signal in case System V semantics */
- (void) setsignal(SIGALRM, tick);
- while ((ev = EventQueue) != NULL &&
- (ev->ev_time <= now || ev->ev_pid != mypid))
- {
- void (*f)();
- int arg;
- int pid;
-
- /* process the event on the top of the queue */
- ev = EventQueue;
- EventQueue = EventQueue->ev_link;
- if (tTd(5, 6))
- printf("tick: ev=%lx, func=%lx, arg=%d, pid=%d\n",
- (u_long) ev, (u_long) ev->ev_func,
- ev->ev_arg, ev->ev_pid);
-
- /* we must be careful in here because ev_func may not return */
- f = ev->ev_func;
- arg = ev->ev_arg;
- pid = ev->ev_pid;
- ev->ev_link = FreeEventList;
- FreeEventList = ev;
- if (pid != getpid())
- continue;
- if (EventQueue != NULL)
- {
- if (EventQueue->ev_time > now)
- (void) alarm((unsigned) (EventQueue->ev_time - now));
- else
- (void) alarm(3);
- }
-
- /* call ev_func */
- errno = olderrno;
- (*f)(arg);
- (void) alarm(0);
- now = curtime();
- }
- if (EventQueue != NULL)
- (void) alarm((unsigned) (EventQueue->ev_time - now));
- errno = olderrno;
- return SIGFUNC_RETURN;
-}
-\f/*
-** SLEEP -- a version of sleep that works with this stuff
-**
-** Because sleep uses the alarm facility, I must reimplement
-** it here.
-**
-** Parameters:
-** intvl -- time to sleep.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** waits for intvl time. However, other events can
-** be run during that interval.
-*/
-
-static bool SleepDone;
-static void endsleep __P((void));
-
-#ifndef SLEEP_T
-# define SLEEP_T unsigned int
-#endif
-
-SLEEP_T
-sleep(intvl)
- unsigned int intvl;
-{
- int was_held;
-
- if (intvl == 0)
- return (SLEEP_T) 0;
- SleepDone = FALSE;
- (void) setevent((time_t) intvl, endsleep, 0);
- was_held = releasesignal(SIGALRM);
- while (!SleepDone)
- pause();
- if (was_held > 0)
- blocksignal(SIGALRM);
- return (SLEEP_T) 0;
-}
-
-static void
-endsleep()
-{
- SleepDone = TRUE;
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)collect.c 8.93 (Berkeley) 1/26/1999";
-#endif /* not lint */
-
-# include <errno.h>
-# include "sendmail.h"
-
-/*
-** COLLECT -- read & parse message header & make temp file.
-**
-** Creates a temporary file name and copies the standard
-** input to that file. Leading UNIX-style "From" lines are
-** stripped off (after important information is extracted).
-**
-** Parameters:
-** fp -- file to read.
-** smtpmode -- if set, we are running SMTP: give an RFC821
-** style message to say we are ready to collect
-** input, and never ignore a single dot to mean
-** end of message.
-** hdrp -- the location to stash the header.
-** e -- the current envelope.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Temp file is created and filled.
-** The from person may be set.
-*/
-
-static jmp_buf CtxCollectTimeout;
-static void collecttimeout __P((time_t));
-static bool CollectProgress;
-static EVENT *CollectTimeout;
-
-/* values for input state machine */
-#define IS_NORM 0 /* middle of line */
-#define IS_BOL 1 /* beginning of line */
-#define IS_DOT 2 /* read a dot at beginning of line */
-#define IS_DOTCR 3 /* read ".\r" at beginning of line */
-#define IS_CR 4 /* read a carriage return */
-
-/* values for message state machine */
-#define MS_UFROM 0 /* reading Unix from line */
-#define MS_HEADER 1 /* reading message header */
-#define MS_BODY 2 /* reading message body */
-#define MS_DISCARD 3 /* discarding rest of message */
-
-void
-collect(fp, smtpmode, hdrp, e)
- FILE *fp;
- bool smtpmode;
- HDR **hdrp;
- register ENVELOPE *e;
-{
- register FILE *volatile tf;
- volatile bool ignrdot = smtpmode ? FALSE : IgnrDot;
- volatile time_t dbto = smtpmode ? TimeOuts.to_datablock : 0;
- register char *volatile bp;
- volatile int c = EOF;
- volatile bool inputerr = FALSE;
- bool headeronly;
- char *volatile buf;
- volatile int buflen;
- volatile int istate;
- volatile int mstate;
- u_char *volatile pbp;
- int hdrslen = 0;
- u_char peekbuf[8];
- char dfname[MAXQFNAME];
- char bufbuf[MAXLINE];
- extern bool isheader __P((char *));
- extern void tferror __P((FILE *volatile, ENVELOPE *));
-
- headeronly = hdrp != NULL;
-
- /*
- ** Create the temp file name and create the file.
- */
-
- if (!headeronly)
- {
- int tfd;
- struct stat stbuf;
-
- strcpy(dfname, queuename(e, 'd'));
- tfd = dfopen(dfname, O_WRONLY|O_CREAT|O_TRUNC, FileMode, SFF_ANYFILE);
- if (tfd < 0 || (tf = fdopen(tfd, "w")) == NULL)
- {
- syserr("Cannot create %s", dfname);
- e->e_flags |= EF_NO_BODY_RETN;
- finis(TRUE, ExitStat);
- }
- if (fstat(fileno(tf), &stbuf) < 0)
- e->e_dfino = -1;
- else
- {
- e->e_dfdev = stbuf.st_dev;
- e->e_dfino = stbuf.st_ino;
- }
- HasEightBits = FALSE;
- e->e_msgsize = 0;
- e->e_flags |= EF_HAS_DF;
- }
-
- /*
- ** Tell ARPANET to go ahead.
- */
-
- if (smtpmode)
- message("354 Enter mail, end with \".\" on a line by itself");
-
- if (tTd(30, 2))
- printf("collect\n");
-
- /*
- ** Read the message.
- **
- ** This is done using two interleaved state machines.
- ** The input state machine is looking for things like
- ** hidden dots; the message state machine is handling
- ** the larger picture (e.g., header versus body).
- */
-
- buf = bp = bufbuf;
- buflen = sizeof bufbuf;
- pbp = peekbuf;
- istate = IS_BOL;
- mstate = SaveFrom ? MS_HEADER : MS_UFROM;
- CollectProgress = FALSE;
-
- if (dbto != 0)
- {
- /* handle possible input timeout */
- if (setjmp(CtxCollectTimeout) != 0)
- {
- if (LogLevel > 2)
- sm_syslog(LOG_NOTICE, e->e_id,
- "timeout waiting for input from %s during message collect",
- CurHostName ? CurHostName : "<local machine>");
- errno = 0;
- usrerr("451 timeout waiting for input during message collect");
- goto readerr;
- }
- CollectTimeout = setevent(dbto, collecttimeout, dbto);
- }
-
- for (;;)
- {
- if (tTd(30, 35))
- printf("top, istate=%d, mstate=%d\n", istate, mstate);
- for (;;)
- {
- if (pbp > peekbuf)
- c = *--pbp;
- else
- {
- while (!feof(fp) && !ferror(fp))
- {
- errno = 0;
- c = getc(fp);
- if (errno != EINTR)
- break;
- clearerr(fp);
- }
- CollectProgress = TRUE;
- if (TrafficLogFile != NULL && !headeronly)
- {
- if (istate == IS_BOL)
- fprintf(TrafficLogFile, "%05d <<< ",
- (int) getpid());
- if (c == EOF)
- fprintf(TrafficLogFile, "[EOF]\n");
- else
- putc(c, TrafficLogFile);
- }
- if (c == EOF)
- goto readerr;
- if (SevenBitInput)
- c &= 0x7f;
- else
- HasEightBits |= bitset(0x80, c);
- }
- if (tTd(30, 94))
- printf("istate=%d, c=%c (0x%x)\n",
- istate, c, c);
- switch (istate)
- {
- case IS_BOL:
- if (c == '.')
- {
- istate = IS_DOT;
- continue;
- }
- break;
-
- case IS_DOT:
- if (c == '\n' && !ignrdot &&
- !bitset(EF_NL_NOT_EOL, e->e_flags))
- goto readerr;
- else if (c == '\r' &&
- !bitset(EF_CRLF_NOT_EOL, e->e_flags))
- {
- istate = IS_DOTCR;
- continue;
- }
- else if (c != '.' ||
- (OpMode != MD_SMTP &&
- OpMode != MD_DAEMON &&
- OpMode != MD_ARPAFTP))
- {
- *pbp++ = c;
- c = '.';
- }
- break;
-
- case IS_DOTCR:
- if (c == '\n' && !ignrdot)
- goto readerr;
- else
- {
- /* push back the ".\rx" */
- *pbp++ = c;
- *pbp++ = '\r';
- c = '.';
- }
- break;
-
- case IS_CR:
- if (c == '\n')
- istate = IS_BOL;
- else
- {
- ungetc(c, fp);
- c = '\r';
- istate = IS_NORM;
- }
- goto bufferchar;
- }
-
- if (c == '\r' && !bitset(EF_CRLF_NOT_EOL, e->e_flags))
- {
- istate = IS_CR;
- continue;
- }
- else if (c == '\n' && !bitset(EF_NL_NOT_EOL, e->e_flags))
- istate = IS_BOL;
- else
- istate = IS_NORM;
-
-bufferchar:
- if (!headeronly)
- e->e_msgsize++;
- switch (mstate)
- {
- case MS_BODY:
- /* just put the character out */
- if (MaxMessageSize <= 0 ||
- e->e_msgsize <= MaxMessageSize)
- putc(c, tf);
-
- /* fall through */
-
- case MS_DISCARD:
- continue;
- }
-
- /* header -- buffer up */
- if (bp >= &buf[buflen - 2])
- {
- char *obuf;
-
- if (mstate != MS_HEADER)
- break;
-
- /* out of space for header */
- obuf = buf;
- if (buflen < MEMCHUNKSIZE)
- buflen *= 2;
- else
- buflen += MEMCHUNKSIZE;
- buf = xalloc(buflen);
- bcopy(obuf, buf, bp - obuf);
- bp = &buf[bp - obuf];
- if (obuf != bufbuf)
- free(obuf);
- }
- if (c >= 0200 && c <= 0237)
- {
-#if 0 /* causes complaints -- figure out something for 8.9 */
- usrerr("Illegal character 0x%x in header", c);
-#endif
- }
- else if (c != '\0')
- {
- *bp++ = c;
- if (MaxHeadersLength > 0 &&
- ++hdrslen > MaxHeadersLength)
- {
- sm_syslog(LOG_NOTICE, e->e_id,
- "headers too large (%d max) from %s during message collect",
- MaxHeadersLength,
- CurHostName != NULL ? CurHostName : "localhost");
- errno = 0;
- e->e_flags |= EF_CLRQUEUE;
- e->e_status = "5.6.0";
- usrerr("552 Headers too large (%d max)",
- MaxHeadersLength);
- mstate = MS_DISCARD;
- }
- }
- if (istate == IS_BOL)
- break;
- }
- *bp = '\0';
-
-nextstate:
- if (tTd(30, 35))
- printf("nextstate, istate=%d, mstate=%d, line = \"%s\"\n",
- istate, mstate, buf);
- switch (mstate)
- {
- case MS_UFROM:
- mstate = MS_HEADER;
-#ifndef NOTUNIX
- if (strncmp(buf, "From ", 5) == 0)
- {
- extern void eatfrom __P((char *volatile, ENVELOPE *));
-
- bp = buf;
- eatfrom(buf, e);
- continue;
- }
-#endif
- /* fall through */
-
- case MS_HEADER:
- if (!isheader(buf))
- {
- mstate = MS_BODY;
- goto nextstate;
- }
-
- /* check for possible continuation line */
- do
- {
- clearerr(fp);
- errno = 0;
- c = getc(fp);
- } while (errno == EINTR);
- if (c != EOF)
- ungetc(c, fp);
- if (c == ' ' || c == '\t')
- {
- /* yep -- defer this */
- continue;
- }
-
- /* trim off trailing CRLF or NL */
- if (*--bp != '\n' || *--bp != '\r')
- bp++;
- *bp = '\0';
-
- if (bitset(H_EOH, chompheader(buf, FALSE, hdrp, e)))
- {
- mstate = MS_BODY;
- goto nextstate;
- }
- break;
-
- case MS_BODY:
- if (tTd(30, 1))
- printf("EOH\n");
- if (headeronly)
- goto readerr;
- bp = buf;
-
- /* toss blank line */
- if ((!bitset(EF_CRLF_NOT_EOL, e->e_flags) &&
- bp[0] == '\r' && bp[1] == '\n') ||
- (!bitset(EF_NL_NOT_EOL, e->e_flags) &&
- bp[0] == '\n'))
- {
- break;
- }
-
- /* if not a blank separator, write it out */
- if (MaxMessageSize <= 0 ||
- e->e_msgsize <= MaxMessageSize)
- {
- while (*bp != '\0')
- putc(*bp++, tf);
- }
- break;
- }
- bp = buf;
- }
-
-readerr:
- if ((feof(fp) && smtpmode) || ferror(fp))
- {
- const char *errmsg = errstring(errno);
-
- if (tTd(30, 1))
- printf("collect: premature EOM: %s\n", errmsg);
- if (LogLevel >= 2)
- sm_syslog(LOG_WARNING, e->e_id,
- "collect: premature EOM: %s", errmsg);
- inputerr = TRUE;
- }
-
- /* reset global timer */
- clrevent(CollectTimeout);
-
- if (headeronly)
- return;
-
- if (tf != NULL &&
- (fflush(tf) != 0 || ferror(tf) ||
- (SuperSafe && fsync(fileno(tf)) < 0) ||
- fclose(tf) < 0))
- {
- tferror(tf, e);
- flush_errors(TRUE);
- finis(TRUE, ExitStat);
- }
-
- /* An EOF when running SMTP is an error */
- if (inputerr && (OpMode == MD_SMTP || OpMode == MD_DAEMON))
- {
- char *host;
- char *problem;
-
- host = RealHostName;
- if (host == NULL)
- host = "localhost";
-
- if (feof(fp))
- problem = "unexpected close";
- else if (ferror(fp))
- problem = "I/O error";
- else
- problem = "read timeout";
- if (LogLevel > 0 && feof(fp))
- sm_syslog(LOG_NOTICE, e->e_id,
- "collect: %s on connection from %.100s, sender=%s: %s",
- problem, host,
- shortenstring(e->e_from.q_paddr, MAXSHORTSTR),
- errstring(errno));
- if (feof(fp))
- usrerr("451 collect: %s on connection from %s, from=%s",
- problem, host,
- shortenstring(e->e_from.q_paddr, MAXSHORTSTR));
- else
- syserr("451 collect: %s on connection from %s, from=%s",
- problem, host,
- shortenstring(e->e_from.q_paddr, MAXSHORTSTR));
-
- /* don't return an error indication */
- e->e_to = NULL;
- e->e_flags &= ~EF_FATALERRS;
- e->e_flags |= EF_CLRQUEUE;
-
- /* and don't try to deliver the partial message either */
- if (InChild)
- ExitStat = EX_QUIT;
- finis(TRUE, ExitStat);
- }
-
- /*
- ** Find out some information from the headers.
- ** Examples are who is the from person & the date.
- */
-
- eatheader(e, TRUE);
-
- if (GrabTo && e->e_sendqueue == NULL)
- usrerr("No recipient addresses found in header");
-
- /* collect statistics */
- if (OpMode != MD_VERIFY)
- markstats(e, (ADDRESS *) NULL, FALSE);
-
-#if _FFR_DSN_RRT_OPTION
- /*
- ** If we have a Return-Receipt-To:, turn it into a DSN.
- */
-
- if (RrtImpliesDsn && hvalue("return-receipt-to", e->e_header) != NULL)
- {
- ADDRESS *q;
-
- for (q = e->e_sendqueue; q != NULL; q = q->q_next)
- if (!bitset(QHASNOTIFY, q->q_flags))
- q->q_flags |= QHASNOTIFY|QPINGONSUCCESS;
- }
-#endif
-
- /*
- ** Add an Apparently-To: line if we have no recipient lines.
- */
-
- if (hvalue("to", e->e_header) != NULL ||
- hvalue("cc", e->e_header) != NULL ||
- hvalue("apparently-to", e->e_header) != NULL)
- {
- /* have a valid recipient header -- delete Bcc: headers */
- e->e_flags |= EF_DELETE_BCC;
- }
- else if (hvalue("bcc", e->e_header) == NULL)
- {
- /* no valid recipient headers */
- register ADDRESS *q;
- char *hdr = NULL;
-
- /* create an Apparently-To: field */
- /* that or reject the message.... */
- switch (NoRecipientAction)
- {
- case NRA_ADD_APPARENTLY_TO:
- hdr = "Apparently-To";
- break;
-
- case NRA_ADD_TO:
- hdr = "To";
- break;
-
- case NRA_ADD_BCC:
- addheader("Bcc", " ", &e->e_header);
- break;
-
- case NRA_ADD_TO_UNDISCLOSED:
- addheader("To", "undisclosed-recipients:;", &e->e_header);
- break;
- }
-
- if (hdr != NULL)
- {
- for (q = e->e_sendqueue; q != NULL; q = q->q_next)
- {
- if (q->q_alias != NULL)
- continue;
- if (tTd(30, 3))
- printf("Adding %s: %s\n",
- hdr, q->q_paddr);
- addheader(hdr, q->q_paddr, &e->e_header);
- }
- }
- }
-
- /* check for message too large */
- if (MaxMessageSize > 0 && e->e_msgsize > MaxMessageSize)
- {
- e->e_flags |= EF_NO_BODY_RETN|EF_CLRQUEUE;
- e->e_status = "5.2.3";
- usrerr("552 Message exceeds maximum fixed size (%ld)",
- MaxMessageSize);
- if (LogLevel > 6)
- sm_syslog(LOG_NOTICE, e->e_id,
- "message size (%ld) exceeds maximum (%ld)",
- e->e_msgsize, MaxMessageSize);
- }
-
- /* check for illegal 8-bit data */
- if (HasEightBits)
- {
- e->e_flags |= EF_HAS8BIT;
- if (!bitset(MM_PASS8BIT|MM_MIME8BIT, MimeMode) &&
- !bitset(EF_IS_MIME, e->e_flags))
- {
- e->e_status = "5.6.1";
- usrerr("554 Eight bit data not allowed");
- }
- }
- else
- {
- /* if it claimed to be 8 bits, well, it lied.... */
- if (e->e_bodytype != NULL &&
- strcasecmp(e->e_bodytype, "8BITMIME") == 0)
- e->e_bodytype = "7BIT";
- }
-
- if ((e->e_dfp = fopen(dfname, "r")) == NULL)
- {
- /* we haven't acked receipt yet, so just chuck this */
- syserr("Cannot reopen %s", dfname);
- finis(TRUE, ExitStat);
- }
-}
-
-
-static void
-collecttimeout(timeout)
- time_t timeout;
-{
- /* if no progress was made, die now */
- if (!CollectProgress)
- longjmp(CtxCollectTimeout, 1);
-
- /* otherwise reset the timeout */
- CollectTimeout = setevent(timeout, collecttimeout, timeout);
- CollectProgress = FALSE;
-}
-\f/*
-** TFERROR -- signal error on writing the temporary file.
-**
-** Parameters:
-** tf -- the file pointer for the temporary file.
-** e -- the current envelope.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Gives an error message.
-** Arranges for following output to go elsewhere.
-*/
-
-void
-tferror(tf, e)
- FILE *volatile tf;
- register ENVELOPE *e;
-{
- setstat(EX_IOERR);
- if (errno == ENOSPC)
- {
-#if STAT64 > 0
- struct stat64 st;
-#else
- struct stat st;
-#endif
- long avail;
- long bsize;
- extern long freediskspace __P((char *, long *));
-
- e->e_flags |= EF_NO_BODY_RETN;
-
- if (
-#if STAT64 > 0
- fstat64(fileno(tf), &st)
-#else
- fstat(fileno(tf), &st)
-#endif
- < 0)
- st.st_size = 0;
- (void) freopen(queuename(e, 'd'), "w", tf);
- if (st.st_size <= 0)
- fprintf(tf, "\n*** Mail could not be accepted");
- else if (sizeof st.st_size > sizeof (long))
- fprintf(tf, "\n*** Mail of at least %s bytes could not be accepted\n",
- quad_to_string(st.st_size));
- else
- fprintf(tf, "\n*** Mail of at least %lu bytes could not be accepted\n",
- (unsigned long) st.st_size);
- fprintf(tf, "*** at %s due to lack of disk space for temp file.\n",
- MyHostName);
- avail = freediskspace(QueueDir, &bsize);
- if (avail > 0)
- {
- if (bsize > 1024)
- avail *= bsize / 1024;
- else if (bsize < 1024)
- avail /= 1024 / bsize;
- fprintf(tf, "*** Currently, %ld kilobytes are available for mail temp files.\n",
- avail);
- }
- e->e_status = "4.3.1";
- usrerr("452 Out of disk space for temp file");
- }
- else
- syserr("collect: Cannot write tf%s", e->e_id);
- if (freopen("/dev/null", "w", tf) == NULL)
- sm_syslog(LOG_ERR, e->e_id,
- "tferror: freopen(\"/dev/null\") failed: %s",
- errstring(errno));
-}
-\f/*
-** EATFROM -- chew up a UNIX style from line and process
-**
-** This does indeed make some assumptions about the format
-** of UNIX messages.
-**
-** Parameters:
-** fm -- the from line.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** extracts what information it can from the header,
-** such as the date.
-*/
-
-# ifndef NOTUNIX
-
-char *DowList[] =
-{
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", NULL
-};
-
-char *MonthList[] =
-{
- "Jan", "Feb", "Mar", "Apr", "May", "Jun",
- "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
- NULL
-};
-
-void
-eatfrom(fm, e)
- char *volatile fm;
- register ENVELOPE *e;
-{
- register char *p;
- register char **dt;
-
- if (tTd(30, 2))
- printf("eatfrom(%s)\n", fm);
-
- /* find the date part */
- p = fm;
- while (*p != '\0')
- {
- /* skip a word */
- while (*p != '\0' && *p != ' ')
- p++;
- while (*p == ' ')
- p++;
- if (!(isascii(*p) && isupper(*p)) ||
- p[3] != ' ' || p[13] != ':' || p[16] != ':')
- continue;
-
- /* we have a possible date */
- for (dt = DowList; *dt != NULL; dt++)
- if (strncmp(*dt, p, 3) == 0)
- break;
- if (*dt == NULL)
- continue;
-
- for (dt = MonthList; *dt != NULL; dt++)
- if (strncmp(*dt, &p[4], 3) == 0)
- break;
- if (*dt != NULL)
- break;
- }
-
- if (*p != '\0')
- {
- char *q;
-
- /* we have found a date */
- q = xalloc(25);
- (void) strncpy(q, p, 25);
- q[24] = '\0';
- q = arpadate(q);
- define('a', newstr(q), e);
- }
-}
-
-# endif /* NOTUNIX */
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)conf.c 8.452 (Berkeley) 1/26/1999";
-#endif /* not lint */
-
-# include "sendmail.h"
-# include "pathnames.h"
-# include <sys/ioctl.h>
-# include <sys/param.h>
-# include <limits.h>
-
-/*
-** CONF.C -- Sendmail Configuration Tables.
-**
-** Defines the configuration of this installation.
-**
-** Configuration Variables:
-** HdrInfo -- a table describing well-known header fields.
-** Each entry has the field name and some flags,
-** which are described in sendmail.h.
-**
-** Notes:
-** I have tried to put almost all the reasonable
-** configuration information into the configuration
-** file read at runtime. My intent is that anything
-** here is a function of the version of UNIX you
-** are running, or is really static -- for example
-** the headers are a superset of widely used
-** protocols. If you find yourself playing with
-** this file too much, you may be making a mistake!
-*/
-
-
-/*
-** Header info table
-** Final (null) entry contains the flags used for any other field.
-**
-** Not all of these are actually handled specially by sendmail
-** at this time. They are included as placeholders, to let
-** you know that "someday" I intend to have sendmail do
-** something with them.
-*/
-
-struct hdrinfo HdrInfo[] =
-{
- /* originator fields, most to least significant */
- { "resent-sender", H_FROM|H_RESENT },
- { "resent-from", H_FROM|H_RESENT },
- { "resent-reply-to", H_FROM|H_RESENT },
- { "sender", H_FROM },
- { "from", H_FROM },
- { "reply-to", H_FROM },
- { "errors-to", H_FROM|H_ERRORSTO },
- { "full-name", H_ACHECK },
- { "return-receipt-to", H_RECEIPTTO },
-
- /* destination fields */
- { "to", H_RCPT },
- { "resent-to", H_RCPT|H_RESENT },
- { "cc", H_RCPT },
- { "resent-cc", H_RCPT|H_RESENT },
- { "bcc", H_RCPT|H_BCC },
- { "resent-bcc", H_RCPT|H_BCC|H_RESENT },
- { "apparently-to", H_RCPT },
-
- /* message identification and control */
- { "message-id", 0 },
- { "resent-message-id", H_RESENT },
- { "message", H_EOH },
- { "text", H_EOH },
-
- /* date fields */
- { "date", 0 },
- { "resent-date", H_RESENT },
-
- /* trace fields */
- { "received", H_TRACE|H_FORCE },
- { "x400-received", H_TRACE|H_FORCE },
- { "via", H_TRACE|H_FORCE },
- { "mail-from", H_TRACE|H_FORCE },
-
- /* miscellaneous fields */
- { "comments", H_FORCE|H_ENCODABLE },
- { "return-path", H_FORCE|H_ACHECK },
- { "content-transfer-encoding", H_CTE },
- { "content-type", H_CTYPE },
- { "content-length", H_ACHECK },
- { "subject", H_ENCODABLE },
-
- { NULL, 0 }
-};
-
-
-
-/*
-** Privacy values
-*/
-
-struct prival PrivacyValues[] =
-{
- { "public", PRIV_PUBLIC },
- { "needmailhelo", PRIV_NEEDMAILHELO },
- { "needexpnhelo", PRIV_NEEDEXPNHELO },
- { "needvrfyhelo", PRIV_NEEDVRFYHELO },
- { "noexpn", PRIV_NOEXPN },
- { "novrfy", PRIV_NOVRFY },
- { "restrictmailq", PRIV_RESTRICTMAILQ },
- { "restrictqrun", PRIV_RESTRICTQRUN },
- { "noetrn", PRIV_NOETRN },
- { "noverb", PRIV_NOVERB },
- { "authwarnings", PRIV_AUTHWARNINGS },
- { "noreceipts", PRIV_NORECEIPTS },
- { "goaway", PRIV_GOAWAY },
- { NULL, 0 }
-};
-
-/*
-** DontBlameSendmail values
-*/
-struct dbsval DontBlameSendmailValues[] =
-{
- { "safe", DBS_SAFE },
- { "assumesafechown", DBS_ASSUMESAFECHOWN },
- { "groupwritabledirpathsafe", DBS_GROUPWRITABLEDIRPATHSAFE },
- { "groupwritableforwardfilesafe",
- DBS_GROUPWRITABLEFORWARDFILESAFE },
- { "groupwritableincludefilesafe",
- DBS_GROUPWRITABLEINCLUDEFILESAFE },
- { "groupwritablealiasfile", DBS_GROUPWRITABLEALIASFILE },
- { "worldwritablealiasfile", DBS_WORLDWRITABLEALIASFILE },
- { "forwardfileinunsafedirpath", DBS_FORWARDFILEINUNSAFEDIRPATH },
- { "includefileinunsafedirpath", DBS_INCLUDEFILEINUNSAFEDIRPATH },
- { "mapinunsafedirpath", DBS_MAPINUNSAFEDIRPATH },
- { "linkedaliasfileinwritabledir",
- DBS_LINKEDALIASFILEINWRITABLEDIR },
- { "linkedclassfileinwritabledir",
- DBS_LINKEDCLASSFILEINWRITABLEDIR },
- { "linkedforwardfileinwritabledir",
- DBS_LINKEDFORWARDFILEINWRITABLEDIR },
- { "linkedincludefileinwritabledir",
- DBS_LINKEDINCLUDEFILEINWRITABLEDIR },
- { "linkedmapinwritabledir", DBS_LINKEDMAPINWRITABLEDIR },
- { "linkedserviceswitchfileinwritabledir",
- DBS_LINKEDSERVICESWITCHFILEINWRITABLEDIR },
- { "filedeliverytohardlink", DBS_FILEDELIVERYTOHARDLINK },
- { "filedeliverytosymlink", DBS_FILEDELIVERYTOSYMLINK },
- { "writemaptohardlink", DBS_WRITEMAPTOHARDLINK },
- { "writemaptosymlink", DBS_WRITEMAPTOSYMLINK },
- { "writestatstohardlink", DBS_WRITESTATSTOHARDLINK },
- { "writestatstosymlink", DBS_WRITESTATSTOSYMLINK },
- { "forwardfileingroupwritabledirpath",
- DBS_FORWARDFILEINGROUPWRITABLEDIRPATH },
- { "includefileingroupwritabledirpath",
- DBS_INCLUDEFILEINGROUPWRITABLEDIRPATH },
- { "classfileinunsafedirpath", DBS_CLASSFILEINUNSAFEDIRPATH },
- { "errorheaderinunsafedirpath", DBS_ERRORHEADERINUNSAFEDIRPATH },
- { "helpfileinunsafedirpath", DBS_HELPFILEINUNSAFEDIRPATH },
- { "forwardfileinunsafedirpathsafe",
- DBS_FORWARDFILEINUNSAFEDIRPATHSAFE },
- { "includefileinunsafedirpathsafe",
- DBS_INCLUDEFILEINUNSAFEDIRPATHSAFE },
- { "runprograminunsafedirpath", DBS_RUNPROGRAMINUNSAFEDIRPATH },
- { "runwritableprogram", DBS_RUNWRITABLEPROGRAM },
- { NULL, 0 }
-};
-
-
-/*
-** Miscellaneous stuff.
-*/
-
-int DtableSize = 50; /* max open files; reset in 4.2bsd */
-\f/*
-** SETDEFAULTS -- set default values
-**
-** Because of the way freezing is done, these must be initialized
-** using direct code.
-**
-** Parameters:
-** e -- the default envelope.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Initializes a bunch of global variables to their
-** default values.
-*/
-
-#define MINUTES * 60
-#define HOURS * 60 MINUTES
-#define DAYS * 24 HOURS
-
-#ifndef _PATH_VARTMP
-# define _PATH_VARTMP "/usr/tmp/"
-#endif
-
-#ifndef MAXRULERECURSION
-# define MAXRULERECURSION 50 /* max ruleset recursion depth */
-#endif
-
-void
-setdefaults(e)
- register ENVELOPE *e;
-{
- int i;
- struct passwd *pw;
- char buf[MAXNAME];
- extern void setdefuser __P((void));
- extern void setupmaps __P((void));
- extern void setupmailers __P((void));
- extern void setupheaders __P((void));
-
- SpaceSub = ' '; /* option B */
- QueueLA = 8; /* option x */
- RefuseLA = 12; /* option X */
- WkRecipFact = 30000L; /* option y */
- WkClassFact = 1800L; /* option z */
- WkTimeFact = 90000L; /* option Z */
- QueueFactor = WkRecipFact * 20; /* option q */
- FileMode = (RealUid != geteuid()) ? 0644 : 0600;
- /* option F */
-
- if (((pw = getpwnam("mailnull")) != NULL && pw->pw_uid != 0) ||
- ((pw = getpwnam("sendmail")) != NULL && pw->pw_uid != 0) ||
- ((pw = getpwnam("daemon")) != NULL && pw->pw_uid != 0))
- {
- DefUid = pw->pw_uid; /* option u */
- DefGid = pw->pw_gid; /* option g */
- DefUser = newstr(pw->pw_name);
- }
- else
- {
- DefUid = 1; /* option u */
- DefGid = 1; /* option g */
- setdefuser();
- }
- TrustedUid = 0;
- if (tTd(37, 4))
- printf("setdefaults: DefUser=%s, DefUid=%d, DefGid=%d\n",
- DefUser != NULL ? DefUser : "<1:1>",
- (int) DefUid, (int) DefGid);
- CheckpointInterval = 10; /* option C */
- MaxHopCount = 25; /* option h */
- e->e_sendmode = SM_FORK; /* option d */
- e->e_errormode = EM_PRINT; /* option e */
- SevenBitInput = FALSE; /* option 7 */
- MaxMciCache = 1; /* option k */
- MciCacheTimeout = 5 MINUTES; /* option K */
- LogLevel = 9; /* option L */
- inittimeouts(NULL); /* option r */
- PrivacyFlags = PRIV_PUBLIC; /* option p */
- DontBlameSendmail = DBS_SAFE; /* DontBlameSendmail option */
-#if MIME8TO7
- MimeMode = MM_CVTMIME|MM_PASS8BIT; /* option 8 */
-#else
- MimeMode = MM_PASS8BIT;
-#endif
- for (i = 0; i < MAXTOCLASS; i++)
- {
- TimeOuts.to_q_return[i] = 5 DAYS; /* option T */
- TimeOuts.to_q_warning[i] = 0; /* option T */
- }
- ServiceSwitchFile = "/etc/service.switch";
- ServiceCacheMaxAge = (time_t) 10;
- HostsFile = _PATH_HOSTS;
- PidFile = newstr(_PATH_SENDMAILPID);
- MustQuoteChars = "@,;:\\()[].'";
- MciInfoTimeout = 30 MINUTES;
- MaxRuleRecursion = MAXRULERECURSION;
- MaxAliasRecursion = 10;
- MaxMacroRecursion = 10;
- ColonOkInAddr = TRUE;
- DontLockReadFiles = TRUE;
- DoubleBounceAddr = "postmaster";
- MaxHeadersLength = MAXHDRSLEN;
- snprintf(buf, sizeof buf, "%s%sdead.letter",
- _PATH_VARTMP,
- _PATH_VARTMP[sizeof _PATH_VARTMP - 2] == '/' ? "" : "/");
- DeadLetterDrop = newstr(buf);
-#ifdef HESIOD_INIT
- HesiodContext = NULL;
-#endif
- ControlSocketName = NULL;
- setupmaps();
- setupmailers();
- setupheaders();
-}
-
-
-/*
-** SETDEFUSER -- set/reset DefUser using DefUid (for initgroups())
-*/
-
-void
-setdefuser()
-{
- struct passwd *defpwent;
- static char defuserbuf[40];
-
- DefUser = defuserbuf;
- defpwent = sm_getpwuid(DefUid);
- snprintf(defuserbuf, sizeof defuserbuf, "%s",
- defpwent == NULL ? "nobody" : defpwent->pw_name);
- if (tTd(37, 4))
- printf("setdefuser: DefUid=%d, DefUser=%s\n",
- (int) DefUid, DefUser);
-}
-\f/*
-** SETUPMAILERS -- initialize default mailers
-*/
-
-void
-setupmailers()
-{
- char buf[100];
-
- strcpy(buf, "prog, P=/bin/sh, F=lsoDq9, T=DNS/RFC822/X-Unix, A=sh -c \201u");
- makemailer(buf);
-
- strcpy(buf, "*file*, P=[FILE], F=lsDFMPEouq9, T=DNS/RFC822/X-Unix, A=FILE \201u");
- makemailer(buf);
-
- strcpy(buf, "*include*, P=/dev/null, F=su, A=INCLUDE \201u");
- makemailer(buf);
-}
-\f/*
-** SETUPMAPS -- set up map classes
-*/
-
-#define MAPDEF(name, ext, flags, parse, open, close, lookup, store) \
- { \
- extern bool parse __P((MAP *, char *)); \
- extern bool open __P((MAP *, int)); \
- extern void close __P((MAP *)); \
- extern char *lookup __P((MAP *, char *, char **, int *)); \
- extern void store __P((MAP *, char *, char *)); \
- s = stab(name, ST_MAPCLASS, ST_ENTER); \
- s->s_mapclass.map_cname = name; \
- s->s_mapclass.map_ext = ext; \
- s->s_mapclass.map_cflags = flags; \
- s->s_mapclass.map_parse = parse; \
- s->s_mapclass.map_open = open; \
- s->s_mapclass.map_close = close; \
- s->s_mapclass.map_lookup = lookup; \
- s->s_mapclass.map_store = store; \
- }
-
-void
-setupmaps()
-{
- register STAB *s;
-
-#ifdef NEWDB
- MAPDEF("hash", ".db", MCF_ALIASOK|MCF_REBUILDABLE,
- map_parseargs, hash_map_open, db_map_close,
- db_map_lookup, db_map_store);
-
- MAPDEF("btree", ".db", MCF_ALIASOK|MCF_REBUILDABLE,
- map_parseargs, bt_map_open, db_map_close,
- db_map_lookup, db_map_store);
-#endif
-
-#ifdef NDBM
- MAPDEF("dbm", ".dir", MCF_ALIASOK|MCF_REBUILDABLE,
- map_parseargs, ndbm_map_open, ndbm_map_close,
- ndbm_map_lookup, ndbm_map_store);
-#endif
-
-#ifdef NIS
- MAPDEF("nis", NULL, MCF_ALIASOK,
- map_parseargs, nis_map_open, null_map_close,
- nis_map_lookup, null_map_store);
-#endif
-
-#ifdef NISPLUS
- MAPDEF("nisplus", NULL, MCF_ALIASOK,
- map_parseargs, nisplus_map_open, null_map_close,
- nisplus_map_lookup, null_map_store);
-#endif
-#ifdef LDAPMAP
- MAPDEF("ldapx", NULL, 0,
- ldap_map_parseargs, ldap_map_open, ldap_map_close,
- ldap_map_lookup, null_map_store);
-#endif
-
-#ifdef HESIOD
- MAPDEF("hesiod", NULL, MCF_ALIASOK|MCF_ALIASONLY,
- map_parseargs, hes_map_open, null_map_close,
- hes_map_lookup, null_map_store);
-#endif
-
-#if NETINFO
- MAPDEF("netinfo", NULL, MCF_ALIASOK,
- map_parseargs, ni_map_open, null_map_close,
- ni_map_lookup, null_map_store);
-#endif
-
-#if 0
- MAPDEF("dns", NULL, 0,
- dns_map_init, null_map_open, null_map_close,
- dns_map_lookup, null_map_store);
-#endif
-
-#if NAMED_BIND
- /* best MX DNS lookup */
- MAPDEF("bestmx", NULL, MCF_OPTFILE,
- map_parseargs, null_map_open, null_map_close,
- bestmx_map_lookup, null_map_store);
-#endif
-
- MAPDEF("host", NULL, 0,
- host_map_init, null_map_open, null_map_close,
- host_map_lookup, null_map_store);
-
- MAPDEF("text", NULL, MCF_ALIASOK,
- map_parseargs, text_map_open, null_map_close,
- text_map_lookup, null_map_store);
-
- MAPDEF("stab", NULL, MCF_ALIASOK|MCF_ALIASONLY,
- map_parseargs, stab_map_open, null_map_close,
- stab_map_lookup, stab_map_store);
-
- MAPDEF("implicit", NULL, MCF_ALIASOK|MCF_ALIASONLY|MCF_REBUILDABLE,
- map_parseargs, impl_map_open, impl_map_close,
- impl_map_lookup, impl_map_store);
-
- /* access to system passwd file */
- MAPDEF("user", NULL, MCF_OPTFILE,
- map_parseargs, user_map_open, null_map_close,
- user_map_lookup, null_map_store);
-
- /* dequote map */
- MAPDEF("dequote", NULL, 0,
- dequote_init, null_map_open, null_map_close,
- dequote_map, null_map_store);
-
-#ifdef MAP_REGEX
- MAPDEF("regex", NULL, 0,
- regex_map_init, null_map_open, null_map_close,
- regex_map_lookup, null_map_store);
-#endif
-
-#if USERDB
- /* user database */
- MAPDEF("userdb", ".db", 0,
- map_parseargs, null_map_open, null_map_close,
- udb_map_lookup, null_map_store);
-#endif
-
- /* arbitrary programs */
- MAPDEF("program", NULL, MCF_ALIASOK,
- map_parseargs, null_map_open, null_map_close,
- prog_map_lookup, null_map_store);
-
- /* sequenced maps */
- MAPDEF("sequence", NULL, MCF_ALIASOK,
- seq_map_parse, null_map_open, null_map_close,
- seq_map_lookup, seq_map_store);
-
- /* switched interface to sequenced maps */
- MAPDEF("switch", NULL, MCF_ALIASOK,
- map_parseargs, switch_map_open, null_map_close,
- seq_map_lookup, seq_map_store);
-
- /* null map lookup -- really for internal use only */
- MAPDEF("null", NULL, MCF_ALIASOK|MCF_OPTFILE,
- map_parseargs, null_map_open, null_map_close,
- null_map_lookup, null_map_store);
-
-#if _FFR_MAP_SYSLOG
- /* syslog map -- logs information to syslog */
- MAPDEF("syslog", NULL, 0,
- syslog_map_parseargs, null_map_open, null_map_close,
- syslog_map_lookup, null_map_store);
-#endif
-}
-
-#undef MAPDEF
-\f/*
-** INITHOSTMAPS -- initial host-dependent maps
-**
-** This should act as an interface to any local service switch
-** provided by the host operating system.
-**
-** Parameters:
-** none
-**
-** Returns:
-** none
-**
-** Side Effects:
-** Should define maps "host" and "users" as necessary
-** for this OS. If they are not defined, they will get
-** a default value later. It should check to make sure
-** they are not defined first, since it's possible that
-** the config file has provided an override.
-*/
-
-void
-inithostmaps()
-{
- register int i;
- int nmaps;
- char *maptype[MAXMAPSTACK];
- short mapreturn[MAXMAPACTIONS];
- char buf[MAXLINE];
-
- /*
- ** Set up default hosts maps.
- */
-
-#if 0
- nmaps = switch_map_find("hosts", maptype, mapreturn);
- for (i = 0; i < nmaps; i++)
- {
- if (strcmp(maptype[i], "files") == 0 &&
- stab("hosts.files", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "hosts.files text -k 0 -v 1 /etc/hosts");
- (void) makemapentry(buf);
- }
-#if NAMED_BIND
- else if (strcmp(maptype[i], "dns") == 0 &&
- stab("hosts.dns", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "hosts.dns dns A");
- (void) makemapentry(buf);
- }
-#endif
-#ifdef NISPLUS
- else if (strcmp(maptype[i], "nisplus") == 0 &&
- stab("hosts.nisplus", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "hosts.nisplus nisplus -k name -v address -d hosts.org_dir");
- (void) makemapentry(buf);
- }
-#endif
-#ifdef NIS
- else if (strcmp(maptype[i], "nis") == 0 &&
- stab("hosts.nis", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "hosts.nis nis -d -k 0 -v 1 hosts.byname");
- (void) makemapentry(buf);
- }
-#endif
-#if NETINFO
- else if (strcmp(maptype[i], "netinfo") == 0) &&
- stab("hosts.netinfo", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "hosts.netinfo netinfo -v name /machines");
- (void) makemapentry(buf);
- }
-#endif
- }
-#endif
-
- /*
- ** Make sure we have a host map.
- */
-
- if (stab("host", ST_MAP, ST_FIND) == NULL)
- {
- /* user didn't initialize: set up host map */
- strcpy(buf, "host host");
-#if NAMED_BIND
- if (ConfigLevel >= 2)
- strcat(buf, " -a.");
-#endif
- (void) makemapentry(buf);
- }
-
- /*
- ** Set up default aliases maps
- */
-
- nmaps = switch_map_find("aliases", maptype, mapreturn);
- for (i = 0; i < nmaps; i++)
- {
- if (strcmp(maptype[i], "files") == 0 &&
- stab("aliases.files", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "aliases.files null");
- (void) makemapentry(buf);
- }
-#ifdef NISPLUS
- else if (strcmp(maptype[i], "nisplus") == 0 &&
- stab("aliases.nisplus", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "aliases.nisplus nisplus -kalias -vexpansion -d mail_aliases.org_dir");
- (void) makemapentry(buf);
- }
-#endif
-#ifdef NIS
- else if (strcmp(maptype[i], "nis") == 0 &&
- stab("aliases.nis", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "aliases.nis nis -d mail.aliases");
- (void) makemapentry(buf);
- }
-#endif
-#ifdef NETINFO
- else if (strcmp(maptype[i], "netinfo") == 0 &&
- stab("aliases.netinfo", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "aliases.netinfo netinfo -z, /aliases");
- (void) makemapentry(buf);
- }
-#endif
-#ifdef HESIOD
- else if (strcmp(maptype[i], "hesiod") == 0 &&
- stab("aliases.hesiod", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "aliases.hesiod hesiod aliases");
- (void) makemapentry(buf);
- }
-#endif
- }
- if (stab("aliases", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "aliases switch aliases");
- (void) makemapentry(buf);
- }
-
-#if 0 /* "user" map class is a better choice */
- /*
- ** Set up default users maps.
- */
-
- nmaps = switch_map_find("passwd", maptype, mapreturn);
- for (i = 0; i < nmaps; i++)
- {
- if (strcmp(maptype[i], "files") == 0 &&
- stab("users.files", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "users.files text -m -z: -k0 -v6 /etc/passwd");
- (void) makemapentry(buf);
- }
-#ifdef NISPLUS
- else if (strcmp(maptype[i], "nisplus") == 0 &&
- stab("users.nisplus", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "users.nisplus nisplus -m -kname -vhome -d passwd.org_dir");
- (void) makemapentry(buf);
- }
-#endif
-#ifdef NIS
- else if (strcmp(maptype[i], "nis") == 0 &&
- stab("users.nis", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "users.nis nis -m -d passwd.byname");
- (void) makemapentry(buf);
- }
-#endif
-#ifdef HESIOD
- else if (strcmp(maptype[i], "hesiod") == 0) &&
- stab("users.hesiod", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "users.hesiod hesiod");
- (void) makemapentry(buf);
- }
-#endif
- }
- if (stab("users", ST_MAP, ST_FIND) == NULL)
- {
- strcpy(buf, "users switch -m passwd");
- (void) makemapentry(buf);
- }
-#endif
-}
-\f/*
-** SWITCH_MAP_FIND -- find the list of types associated with a map
-**
-** This is the system-dependent interface to the service switch.
-**
-** Parameters:
-** service -- the name of the service of interest.
-** maptype -- an out-array of strings containing the types
-** of access to use for this service. There can
-** be at most MAXMAPSTACK types for a single service.
-** mapreturn -- an out-array of return information bitmaps
-** for the map.
-**
-** Returns:
-** The number of map types filled in, or -1 for failure.
-*/
-
-#if defined(SOLARIS) || (defined(sony_news) && defined(__svr4))
-# define _USE_SUN_NSSWITCH_
-#endif
-
-#ifdef _USE_SUN_NSSWITCH_
-# include <nsswitch.h>
-#endif
-
-#if defined(ultrix) || (defined(__osf__) && defined(__alpha))
-# define _USE_DEC_SVC_CONF_
-#endif
-
-#ifdef _USE_DEC_SVC_CONF_
-# include <sys/svcinfo.h>
-#endif
-
-int
-switch_map_find(service, maptype, mapreturn)
- char *service;
- char *maptype[MAXMAPSTACK];
- short mapreturn[MAXMAPACTIONS];
-{
- int svcno;
-
-#ifdef _USE_SUN_NSSWITCH_
- struct __nsw_switchconfig *nsw_conf;
- enum __nsw_parse_err pserr;
- struct __nsw_lookup *lk;
- static struct __nsw_lookup lkp0 =
- { "files", {1, 0, 0, 0}, NULL, NULL };
- static struct __nsw_switchconfig lkp_default =
- { 0, "sendmail", 3, &lkp0 };
-
- for (svcno = 0; svcno < MAXMAPACTIONS; svcno++)
- mapreturn[svcno] = 0;
-
- if ((nsw_conf = __nsw_getconfig(service, &pserr)) == NULL)
- lk = lkp_default.lookups;
- else
- lk = nsw_conf->lookups;
- svcno = 0;
- while (lk != NULL)
- {
- maptype[svcno] = lk->service_name;
- if (lk->actions[__NSW_NOTFOUND] == __NSW_RETURN)
- mapreturn[MA_NOTFOUND] |= 1 << svcno;
- if (lk->actions[__NSW_TRYAGAIN] == __NSW_RETURN)
- mapreturn[MA_TRYAGAIN] |= 1 << svcno;
- if (lk->actions[__NSW_UNAVAIL] == __NSW_RETURN)
- mapreturn[MA_TRYAGAIN] |= 1 << svcno;
- svcno++;
- lk = lk->next;
- }
- return svcno;
-#endif
-
-#ifdef _USE_DEC_SVC_CONF_
- struct svcinfo *svcinfo;
- int svc;
-
- for (svcno = 0; svcno < MAXMAPACTIONS; svcno++)
- mapreturn[svcno] = 0;
-
- svcinfo = getsvc();
- if (svcinfo == NULL)
- goto punt;
- if (strcmp(service, "hosts") == 0)
- svc = SVC_HOSTS;
- else if (strcmp(service, "aliases") == 0)
- svc = SVC_ALIASES;
- else if (strcmp(service, "passwd") == 0)
- svc = SVC_PASSWD;
- else
- return -1;
- for (svcno = 0; svcno < SVC_PATHSIZE; svcno++)
- {
- switch (svcinfo->svcpath[svc][svcno])
- {
- case SVC_LOCAL:
- maptype[svcno] = "files";
- break;
-
- case SVC_YP:
- maptype[svcno] = "nis";
- break;
-
- case SVC_BIND:
- maptype[svcno] = "dns";
- break;
-
-#ifdef SVC_HESIOD
- case SVC_HESIOD:
- maptype[svcno] = "hesiod";
- break;
-#endif
-
- case SVC_LAST:
- return svcno;
- }
- }
- return svcno;
-#endif
-
-#if !defined(_USE_SUN_NSSWITCH_) && !defined(_USE_DEC_SVC_CONF_)
- /*
- ** Fall-back mechanism.
- */
-
- STAB *st;
- time_t now = curtime();
-
- for (svcno = 0; svcno < MAXMAPACTIONS; svcno++)
- mapreturn[svcno] = 0;
-
- if ((now - ServiceCacheTime) > (time_t) ServiceCacheMaxAge)
- {
- /* (re)read service switch */
- register FILE *fp;
- int sff = SFF_REGONLY|SFF_OPENASROOT|SFF_NOLOCK;
-
- if (!bitset(DBS_LINKEDSERVICESWITCHFILEINWRITABLEDIR, DontBlameSendmail))
- sff |= SFF_NOWLINK;
-
- if (ConfigFileRead)
- ServiceCacheTime = now;
- fp = safefopen(ServiceSwitchFile, O_RDONLY, 0, sff);
- if (fp != NULL)
- {
- char buf[MAXLINE];
-
- while (fgets(buf, sizeof buf, fp) != NULL)
- {
- register char *p;
-
- p = strpbrk(buf, "#\n");
- if (p != NULL)
- *p = '\0';
- p = strpbrk(buf, " \t");
- if (p != NULL)
- *p++ = '\0';
- if (buf[0] == '\0')
- continue;
- if (p == NULL)
- {
- sm_syslog(LOG_ERR, NOQID,
- "Bad line on %.100s: %.100s",
- ServiceSwitchFile,
- buf);
- continue;
- }
- while (isspace(*p))
- p++;
- if (*p == '\0')
- continue;
-
- /*
- ** Find/allocate space for this service entry.
- ** Space for all of the service strings
- ** are allocated at once. This means
- ** that we only have to free the first
- ** one to free all of them.
- */
-
- st = stab(buf, ST_SERVICE, ST_ENTER);
- if (st->s_service[0] != NULL)
- free((void *) st->s_service[0]);
- p = newstr(p);
- for (svcno = 0; svcno < MAXMAPSTACK; )
- {
- if (*p == '\0')
- break;
- st->s_service[svcno++] = p;
- p = strpbrk(p, " \t");
- if (p == NULL)
- break;
- *p++ = '\0';
- while (isspace(*p))
- p++;
- }
- if (svcno < MAXMAPSTACK)
- st->s_service[svcno] = NULL;
- }
- fclose(fp);
- }
- }
-
- /* look up entry in cache */
- st = stab(service, ST_SERVICE, ST_FIND);
- if (st != NULL && st->s_service[0] != NULL)
- {
- /* extract data */
- svcno = 0;
- while (svcno < MAXMAPSTACK)
- {
- maptype[svcno] = st->s_service[svcno];
- if (maptype[svcno++] == NULL)
- break;
- }
- return --svcno;
- }
-#endif
-
-#if !defined(_USE_SUN_NSSWITCH_)
- /* if the service file doesn't work, use an absolute fallback */
-# ifdef _USE_DEC_SVC_CONF_
- punt:
-# endif
- for (svcno = 0; svcno < MAXMAPACTIONS; svcno++)
- mapreturn[svcno] = 0;
- svcno = 0;
- if (strcmp(service, "aliases") == 0)
- {
- maptype[svcno++] = "files";
-# ifdef AUTO_NIS_ALIASES
-# ifdef NISPLUS
- maptype[svcno++] = "nisplus";
-# endif
-# ifdef NIS
- maptype[svcno++] = "nis";
-# endif
-# endif
- return svcno;
- }
- if (strcmp(service, "hosts") == 0)
- {
-# if NAMED_BIND
- maptype[svcno++] = "dns";
-# else
-# if defined(sun) && !defined(BSD)
- /* SunOS */
- maptype[svcno++] = "nis";
-# endif
-# endif
- maptype[svcno++] = "files";
- return svcno;
- }
- return -1;
-#endif
-}
-\f/*
-** USERNAME -- return the user id of the logged in user.
-**
-** Parameters:
-** none.
-**
-** Returns:
-** The login name of the logged in user.
-**
-** Side Effects:
-** none.
-**
-** Notes:
-** The return value is statically allocated.
-*/
-
-char *
-username()
-{
- static char *myname = NULL;
- extern char *getlogin();
- register struct passwd *pw;
-
- /* cache the result */
- if (myname == NULL)
- {
- myname = getlogin();
- if (myname == NULL || myname[0] == '\0')
- {
- pw = sm_getpwuid(RealUid);
- if (pw != NULL)
- myname = newstr(pw->pw_name);
- }
- else
- {
- uid_t uid = RealUid;
-
- myname = newstr(myname);
- if ((pw = sm_getpwnam(myname)) == NULL ||
- (uid != 0 && uid != pw->pw_uid))
- {
- pw = sm_getpwuid(uid);
- if (pw != NULL)
- myname = newstr(pw->pw_name);
- }
- }
- if (myname == NULL || myname[0] == '\0')
- {
- syserr("554 Who are you?");
- myname = "postmaster";
- }
- }
-
- return (myname);
-}
-\f/*
-** TTYPATH -- Get the path of the user's tty
-**
-** Returns the pathname of the user's tty. Returns NULL if
-** the user is not logged in or if s/he has write permission
-** denied.
-**
-** Parameters:
-** none
-**
-** Returns:
-** pathname of the user's tty.
-** NULL if not logged in or write permission denied.
-**
-** Side Effects:
-** none.
-**
-** WARNING:
-** Return value is in a local buffer.
-**
-** Called By:
-** savemail
-*/
-
-char *
-ttypath()
-{
- struct stat stbuf;
- register char *pathn;
- extern char *ttyname();
- extern char *getlogin();
-
- /* compute the pathname of the controlling tty */
- if ((pathn = ttyname(2)) == NULL && (pathn = ttyname(1)) == NULL &&
- (pathn = ttyname(0)) == NULL)
- {
- errno = 0;
- return (NULL);
- }
-
- /* see if we have write permission */
- if (stat(pathn, &stbuf) < 0 || !bitset(S_IWOTH, stbuf.st_mode))
- {
- errno = 0;
- return (NULL);
- }
-
- /* see if the user is logged in */
- if (getlogin() == NULL)
- return (NULL);
-
- /* looks good */
- return (pathn);
-}
-\f/*
-** CHECKCOMPAT -- check for From and To person compatible.
-**
-** This routine can be supplied on a per-installation basis
-** to determine whether a person is allowed to send a message.
-** This allows restriction of certain types of internet
-** forwarding or registration of users.
-**
-** If the hosts are found to be incompatible, an error
-** message should be given using "usrerr" and an EX_ code
-** should be returned. You can also set to->q_status to
-** a DSN-style status code.
-**
-** EF_NO_BODY_RETN can be set in e->e_flags to suppress the
-** body during the return-to-sender function; this should be done
-** on huge messages. This bit may already be set by the ESMTP
-** protocol.
-**
-** Parameters:
-** to -- the person being sent to.
-**
-** Returns:
-** an exit status
-**
-** Side Effects:
-** none (unless you include the usrerr stuff)
-*/
-
-int
-checkcompat(to, e)
- register ADDRESS *to;
- register ENVELOPE *e;
-{
-# ifdef lint
- if (to == NULL)
- to++;
-# endif /* lint */
-
- if (tTd(49, 1))
- printf("checkcompat(to=%s, from=%s)\n",
- to->q_paddr, e->e_from.q_paddr);
-
-# ifdef EXAMPLE_CODE
- /* this code is intended as an example only */
- register STAB *s;
-
- s = stab("arpa", ST_MAILER, ST_FIND);
- if (s != NULL && strcmp(e->e_from.q_mailer->m_name, "local") != 0 &&
- to->q_mailer == s->s_mailer)
- {
- usrerr("553 No ARPA mail through this machine: see your system administration");
- /* e->e_flags |= EF_NO_BODY_RETN; to supress body on return */
- to->q_status = "5.7.1";
- return (EX_UNAVAILABLE);
- }
-# endif /* EXAMPLE_CODE */
- return (EX_OK);
-}
-\f/*
-** SETSIGNAL -- set a signal handler
-**
-** This is essentially old BSD "signal(3)".
-*/
-
-sigfunc_t
-setsignal(sig, handler)
- int sig;
- sigfunc_t handler;
-{
-#if defined(SYS5SIGNALS) || defined(BSD4_3)
-# ifdef BSD4_3
- return signal(sig, handler);
-# else
- return sigset(sig, handler);
-# endif
-#else
- struct sigaction n, o;
-
- bzero(&n, sizeof n);
-# if USE_SA_SIGACTION
- n.sa_sigaction = (void(*)(int, siginfo_t *, void *)) handler;
- n.sa_flags = SA_RESTART|SA_SIGINFO;
-# else
- n.sa_handler = handler;
-# ifdef SA_RESTART
- n.sa_flags = SA_RESTART;
-# endif
-# endif
- if (sigaction(sig, &n, &o) < 0)
- return SIG_ERR;
- return o.sa_handler;
-#endif
-}
-\f/*
-** BLOCKSIGNAL -- hold a signal to prevent delivery
-**
-** Parameters:
-** sig -- the signal to block.
-**
-** Returns:
-** 1 signal was previously blocked
-** 0 signal was not previously blocked
-** -1 on failure.
-*/
-
-int
-blocksignal(sig)
- int sig;
-{
-#ifdef BSD4_3
-# ifndef sigmask
-# define sigmask(s) (1 << ((s) - 1))
-# endif
- return (sigblock(sigmask(sig)) & sigmask(sig)) != 0;
-#else
-# ifdef ALTOS_SYSTEM_V
- sigfunc_t handler;
-
- handler = sigset(sig, SIG_HOLD);
- if (handler == SIG_ERR)
- return -1;
- else
- return handler == SIG_HOLD;
-# else
- sigset_t sset, oset;
-
- sigemptyset(&sset);
- sigaddset(&sset, sig);
- if (sigprocmask(SIG_BLOCK, &sset, &oset) < 0)
- return -1;
- else
- return sigismember(&oset, sig);
-# endif
-#endif
-}
-\f/*
-** RELEASESIGNAL -- release a held signal
-**
-** Parameters:
-** sig -- the signal to release.
-**
-** Returns:
-** 1 signal was previously blocked
-** 0 signal was not previously blocked
-** -1 on failure.
-*/
-
-int
-releasesignal(sig)
- int sig;
-{
-#ifdef BSD4_3
- return (sigsetmask(sigblock(0) & ~sigmask(sig)) & sigmask(sig)) != 0;
-#else
-# ifdef ALTOS_SYSTEM_V
- sigfunc_t handler;
-
- handler = sigset(sig, SIG_HOLD);
- if (sigrelse(sig) < 0)
- return -1;
- else
- return handler == SIG_HOLD;
-# else
- sigset_t sset, oset;
-
- sigemptyset(&sset);
- sigaddset(&sset, sig);
- if (sigprocmask(SIG_UNBLOCK, &sset, &oset) < 0)
- return -1;
- else
- return sigismember(&oset, sig);
-# endif
-#endif
-}
-\f/*
-** HOLDSIGS -- arrange to hold all signals
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Arranges that signals are held.
-*/
-
-void
-holdsigs()
-{
-}
-\f/*
-** RLSESIGS -- arrange to release all signals
-**
-** This undoes the effect of holdsigs.
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Arranges that signals are released.
-*/
-
-void
-rlsesigs()
-{
-}
-\f/*
-** INIT_MD -- do machine dependent initializations
-**
-** Systems that have global modes that should be set should do
-** them here rather than in main.
-*/
-
-#ifdef _AUX_SOURCE
-# include <compat.h>
-#endif
-
-#if SHARE_V1
-# include <shares.h>
-#endif
-
-void
-init_md(argc, argv)
- int argc;
- char **argv;
-{
-#ifdef _AUX_SOURCE
- setcompat(getcompat() | COMPAT_BSDPROT);
-#endif
-
-#ifdef SUN_EXTENSIONS
- init_md_sun();
-#endif
-
-#if _CONVEX_SOURCE
- /* keep gethostby*() from stripping the local domain name */
- set_domain_trim_off();
-#endif
-#ifdef __QNX__
- /*
- ** Due to QNX's network distributed nature, you can target a tcpip
- ** stack on a different node in the qnx network; this patch lets
- ** this feature work. The __sock_locate() must be done before the
- ** environment is clear.
- */
- __sock_locate();
-#endif
-#if SECUREWARE || defined(_SCO_unix_)
- set_auth_parameters(argc, argv);
-
-# ifdef _SCO_unix_
- /*
- ** This is required for highest security levels (the kernel
- ** won't let it call set*uid() or run setuid binaries without
- ** it). It may be necessary on other SECUREWARE systems.
- */
-
- if (getluid() == -1)
- setluid(0);
-# endif
-#endif
-
-#ifdef VENDOR_DEFAULT
- VendorCode = VENDOR_DEFAULT;
-#else
- VendorCode = VENDOR_BERKELEY;
-#endif
-}
-\f/*
-** INIT_VENDOR_MACROS -- vendor-dependent macro initializations
-**
-** Called once, on startup.
-**
-** Parameters:
-** e -- the global envelope.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** vendor-dependent.
-*/
-
-void
-init_vendor_macros(e)
- register ENVELOPE *e;
-{
-}
-\f/*
-** GETLA -- get the current load average
-**
-** This code stolen from la.c.
-**
-** Parameters:
-** none.
-**
-** Returns:
-** The current load average as an integer.
-**
-** Side Effects:
-** none.
-*/
-
-/* try to guess what style of load average we have */
-#define LA_ZERO 1 /* always return load average as zero */
-#define LA_INT 2 /* read kmem for avenrun; interpret as long */
-#define LA_FLOAT 3 /* read kmem for avenrun; interpret as float */
-#define LA_SUBR 4 /* call getloadavg */
-#define LA_MACH 5 /* MACH load averages (as on NeXT boxes) */
-#define LA_SHORT 6 /* read kmem for avenrun; interpret as short */
-#define LA_PROCSTR 7 /* read string ("1.17") from /proc/loadavg */
-#define LA_READKSYM 8 /* SVR4: use MIOC_READKSYM ioctl call */
-#define LA_DGUX 9 /* special DGUX implementation */
-#define LA_HPUX 10 /* special HPUX implementation */
-#define LA_IRIX6 11 /* special IRIX 6.2 implementation */
-#define LA_KSTAT 12 /* special Solaris kstat(3k) implementation */
-#define LA_DEVSHORT 13 /* read short from a device */
-#define LA_ALPHAOSF 14 /* Digital UNIX (OSF/1 on Alpha) table() call */
-
-/* do guesses based on general OS type */
-#ifndef LA_TYPE
-# define LA_TYPE LA_ZERO
-#endif
-
-#ifndef FSHIFT
-# if defined(unixpc)
-# define FSHIFT 5
-# endif
-
-# if defined(__alpha) || defined(IRIX)
-# define FSHIFT 10
-# endif
-
-#endif
-
-#ifndef FSHIFT
-# define FSHIFT 8
-#endif
-
-#ifndef FSCALE
-# define FSCALE (1 << FSHIFT)
-#endif
-
-#ifndef LA_AVENRUN
-# ifdef SYSTEM5
-# define LA_AVENRUN "avenrun"
-# else
-# define LA_AVENRUN "_avenrun"
-# endif
-#endif
-
-/* _PATH_KMEM should be defined in <paths.h> */
-#ifndef _PATH_KMEM
-# define _PATH_KMEM "/dev/kmem"
-#endif
-
-#if (LA_TYPE == LA_INT) || (LA_TYPE == LA_FLOAT) || (LA_TYPE == LA_SHORT)
-
-#include <nlist.h>
-
-/* _PATH_UNIX should be defined in <paths.h> */
-#ifndef _PATH_UNIX
-# if defined(SYSTEM5)
-# define _PATH_UNIX "/unix"
-# else
-# define _PATH_UNIX "/vmunix"
-# endif
-#endif
-
-#ifdef _AUX_SOURCE
-struct nlist Nl[2];
-#else
-struct nlist Nl[] =
-{
- { LA_AVENRUN },
- { 0 },
-};
-#endif
-#define X_AVENRUN 0
-
-int
-getla()
-{
- static int kmem = -1;
-#if LA_TYPE == LA_INT
- long avenrun[3];
-#else
-# if LA_TYPE == LA_SHORT
- short avenrun[3];
-# else
- double avenrun[3];
-# endif
-#endif
- extern int errno;
- extern off_t lseek();
-
- if (kmem < 0)
- {
-#ifdef _AUX_SOURCE
- strcpy(Nl[X_AVENRUN].n_name, LA_AVENRUN);
- Nl[1].n_name[0] = '\0';
-#endif
-
-#if defined(_AIX3) || defined(_AIX4)
- if (knlist(Nl, 1, sizeof Nl[0]) < 0)
-#else
- if (nlist(_PATH_UNIX, Nl) < 0)
-#endif
- {
- if (tTd(3, 1))
- printf("getla: nlist(%s): %s\n", _PATH_UNIX,
- errstring(errno));
- return (-1);
- }
- if (Nl[X_AVENRUN].n_value == 0)
- {
- if (tTd(3, 1))
- printf("getla: nlist(%s, %s) ==> 0\n",
- _PATH_UNIX, LA_AVENRUN);
- return (-1);
- }
-#ifdef NAMELISTMASK
- Nl[X_AVENRUN].n_value &= NAMELISTMASK;
-#endif
-
- kmem = open(_PATH_KMEM, 0, 0);
- if (kmem < 0)
- {
- if (tTd(3, 1))
- printf("getla: open(/dev/kmem): %s\n",
- errstring(errno));
- return (-1);
- }
- (void) fcntl(kmem, F_SETFD, 1);
- }
- if (tTd(3, 20))
- printf("getla: symbol address = %#lx\n",
- (u_long) Nl[X_AVENRUN].n_value);
- if (lseek(kmem, (off_t) Nl[X_AVENRUN].n_value, SEEK_SET) == -1 ||
- read(kmem, (char *) avenrun, sizeof(avenrun)) < sizeof(avenrun))
- {
- /* thank you Ian */
- if (tTd(3, 1))
- printf("getla: lseek or read: %s\n", errstring(errno));
- return (-1);
- }
-# if (LA_TYPE == LA_INT) || (LA_TYPE == LA_SHORT)
- if (tTd(3, 5))
- {
-# if LA_TYPE == LA_SHORT
- printf("getla: avenrun = %d", avenrun[0]);
- if (tTd(3, 15))
- printf(", %d, %d", avenrun[1], avenrun[2]);
-# else
- printf("getla: avenrun = %ld", avenrun[0]);
- if (tTd(3, 15))
- printf(", %ld, %ld", avenrun[1], avenrun[2]);
-# endif
- printf("\n");
- }
- if (tTd(3, 1))
- printf("getla: %d\n", (int) (avenrun[0] + FSCALE/2) >> FSHIFT);
- return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT);
-# else /* LA_TYPE == LA_FLOAT */
- if (tTd(3, 5))
- {
- printf("getla: avenrun = %g", avenrun[0]);
- if (tTd(3, 15))
- printf(", %g, %g", avenrun[1], avenrun[2]);
- printf("\n");
- }
- if (tTd(3, 1))
- printf("getla: %d\n", (int) (avenrun[0] +0.5));
- return ((int) (avenrun[0] + 0.5));
-# endif
-}
-
-#endif /* LA_TYPE == LA_INT or LA_SHORT or LA_FLOAT */
-
-#if LA_TYPE == LA_READKSYM
-
-# include <sys/ksym.h>
-
-getla()
-{
- static int kmem = -1;
- long avenrun[3];
- extern int errno;
- struct mioc_rksym mirk;
-
- if (kmem < 0)
- {
- kmem = open("/dev/kmem", 0, 0);
- if (kmem < 0)
- {
- if (tTd(3, 1))
- printf("getla: open(/dev/kmem): %s\n",
- errstring(errno));
- return (-1);
- }
- (void) fcntl(kmem, F_SETFD, 1);
- }
- mirk.mirk_symname = LA_AVENRUN;
- mirk.mirk_buf = avenrun;
- mirk.mirk_buflen = sizeof(avenrun);
- if (ioctl(kmem, MIOC_READKSYM, &mirk) < 0)
- {
- if (tTd(3, 1))
- printf("getla: ioctl(MIOC_READKSYM) failed: %s\n",
- errstring(errno));
- return -1;
- }
- if (tTd(3, 5))
- {
- printf("getla: avenrun = %d", avenrun[0]);
- if (tTd(3, 15))
- printf(", %d, %d", avenrun[1], avenrun[2]);
- printf("\n");
- }
- if (tTd(3, 1))
- printf("getla: %d\n", (int) (avenrun[0] + FSCALE/2) >> FSHIFT);
- return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT);
-}
-
-#endif /* LA_TYPE == LA_READKSYM */
-
-#if LA_TYPE == LA_DGUX
-
-# include <sys/dg_sys_info.h>
-
-int
-getla()
-{
- struct dg_sys_info_load_info load_info;
-
- dg_sys_info((long *)&load_info,
- DG_SYS_INFO_LOAD_INFO_TYPE, DG_SYS_INFO_LOAD_VERSION_0);
-
- if (tTd(3, 1))
- printf("getla: %d\n", (int) (load_info.one_minute + 0.5));
-
- return((int) (load_info.one_minute + 0.5));
-}
-
-#endif /* LA_TYPE == LA_DGUX */
-
-#if LA_TYPE == LA_HPUX
-
-/* forward declarations to keep gcc from complaining */
-struct pst_dynamic;
-struct pst_status;
-struct pst_static;
-struct pst_vminfo;
-struct pst_diskinfo;
-struct pst_processor;
-struct pst_lv;
-struct pst_swapinfo;
-
-# include <sys/param.h>
-# include <sys/pstat.h>
-
-int
-getla()
-{
- struct pst_dynamic pstd;
-
- if (pstat_getdynamic(&pstd, sizeof(struct pst_dynamic),
- (size_t) 1, 0) == -1)
- return 0;
-
- if (tTd(3, 1))
- printf("getla: %d\n", (int) (pstd.psd_avg_1_min + 0.5));
-
- return (int) (pstd.psd_avg_1_min + 0.5);
-}
-
-#endif /* LA_TYPE == LA_HPUX */
-
-#if LA_TYPE == LA_SUBR
-
-int
-getla()
-{
- double avenrun[3];
-
- if (getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[0])) < 0)
- {
- if (tTd(3, 1))
- perror("getla: getloadavg failed:");
- return (-1);
- }
- if (tTd(3, 1))
- printf("getla: %d\n", (int) (avenrun[0] +0.5));
- return ((int) (avenrun[0] + 0.5));
-}
-
-#endif /* LA_TYPE == LA_SUBR */
-
-#if LA_TYPE == LA_MACH
-
-/*
-** This has been tested on NEXTSTEP release 2.1/3.X.
-*/
-
-#if defined(NX_CURRENT_COMPILER_RELEASE) && NX_CURRENT_COMPILER_RELEASE > NX_COMPILER_RELEASE_3_0
-# include <mach/mach.h>
-#else
-# include <mach.h>
-#endif
-
-int
-getla()
-{
- processor_set_t default_set;
- kern_return_t error;
- unsigned int info_count;
- struct processor_set_basic_info info;
- host_t host;
-
- error = processor_set_default(host_self(), &default_set);
- if (error != KERN_SUCCESS)
- {
- if (tTd(3, 1))
- perror("getla: processor_set_default failed:");
- return -1;
- }
- info_count = PROCESSOR_SET_BASIC_INFO_COUNT;
- if (processor_set_info(default_set, PROCESSOR_SET_BASIC_INFO,
- &host, (processor_set_info_t)&info,
- &info_count) != KERN_SUCCESS)
- {
- if (tTd(3, 1))
- perror("getla: processor_set_info failed:");
- return -1;
- }
- if (tTd(3, 1))
- printf("getla: %d\n", (int) (info.load_average + (LOAD_SCALE / 2)) / LOAD_SCALE);
- return (int) (info.load_average + (LOAD_SCALE / 2)) / LOAD_SCALE;
-}
-
-#endif /* LA_TYPE == LA_MACH */
-
-#if LA_TYPE == LA_PROCSTR
-
-/*
-** Read /proc/loadavg for the load average. This is assumed to be
-** in a format like "0.15 0.12 0.06".
-**
-** Initially intended for Linux. This has been in the kernel
-** since at least 0.99.15.
-*/
-
-# ifndef _PATH_LOADAVG
-# define _PATH_LOADAVG "/proc/loadavg"
-# endif
-
-int
-getla()
-{
- double avenrun;
- register int result;
- FILE *fp;
-
- fp = fopen(_PATH_LOADAVG, "r");
- if (fp == NULL)
- {
- if (tTd(3, 1))
- printf("getla: fopen(%s): %s\n",
- _PATH_LOADAVG, errstring(errno));
- return -1;
- }
- result = fscanf(fp, "%lf", &avenrun);
- fclose(fp);
- if (result != 1)
- {
- if (tTd(3, 1))
- printf("getla: fscanf() = %d: %s\n",
- result, errstring(errno));
- return -1;
- }
-
- if (tTd(3, 1))
- printf("getla(): %.2f\n", avenrun);
-
- return ((int) (avenrun + 0.5));
-}
-
-#endif /* LA_TYPE == LA_PROCSTR */
-
-#if LA_TYPE == LA_IRIX6
-#include <sys/sysmp.h>
-
-int getla(void)
-{
- static int kmem = -1;
- int avenrun[3];
-
- if (kmem < 0)
- {
- kmem = open(_PATH_KMEM, 0, 0);
- if (kmem < 0)
- {
- if (tTd(3, 1))
- printf("getla: open(%s): %s\n", _PATH_KMEM,
- errstring(errno));
- return -1;
- }
- (void) fcntl(kmem, F_SETFD, 1);
- }
-
- if (lseek(kmem, (sysmp(MP_KERNADDR, MPKA_AVENRUN) & 0x7fffffff), SEEK_SET) == -1 ||
- read(kmem, (char *)avenrun, sizeof(avenrun)) < sizeof(avenrun))
- {
- if (tTd(3, 1))
- printf("getla: lseek or read: %s\n",
- errstring(errno));
- return -1;
- }
- if (tTd(3, 5))
- {
- printf("getla: avenrun = %ld", (long int) avenrun[0]);
- if (tTd(3, 15))
- printf(", %ld, %ld",
- (long int) avenrun[1], (long int) avenrun[2]);
- printf("\n");
- }
-
- if (tTd(3, 1))
- printf("getla: %d\n", (int) (avenrun[0] + FSCALE/2) >> FSHIFT);
- return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT);
-
-}
-#endif
-
-#if LA_TYPE == LA_KSTAT
-
-#include <kstat.h>
-
-int
-getla()
-{
- static kstat_ctl_t *kc = NULL;
- static kstat_t *ksp = NULL;
- kstat_named_t *ksn;
- int la;
-
- if (kc == NULL) /* if not initialized before */
- kc = kstat_open();
- if (kc == NULL)
- {
- if (tTd(3, 1))
- printf("getla: kstat_open(): %s\n",
- errstring(errno));
- return -1;
- }
- if (ksp == NULL)
- ksp = kstat_lookup(kc, "unix", 0, "system_misc");
- if (ksp == NULL)
- {
- if (tTd(3, 1))
- printf("getla: kstat_lookup(): %s\n",
- errstring(errno));
- return -1;
- }
- if (kstat_read(kc, ksp, NULL) < 0)
- {
- if (tTd(3, 1))
- printf("getla: kstat_read(): %s\n",
- errstring(errno));
- return -1;
- }
- ksn = (kstat_named_t *) kstat_data_lookup(ksp, "avenrun_1min");
- la = ((double)ksn->value.ul + FSCALE/2) / FSCALE;
- /* kstat_close(kc); /o do not close for fast access */
- return la;
-}
-
-#endif /* LA_TYPE == LA_KSTAT */
-
-#if LA_TYPE == LA_DEVSHORT
-
-/*
-** Read /dev/table/avenrun for the load average. This should contain
-** three shorts for the 1, 5, and 15 minute loads. We only read the
-** first, since that's all we care about.
-**
-** Intended for SCO OpenServer 5.
-*/
-
-# ifndef _PATH_AVENRUN
-# define _PATH_AVENRUN "/dev/table/avenrun"
-# endif
-
-int
-getla()
-{
- static int afd = -1;
- short avenrun;
- int loadav;
- int r;
-
- errno = EBADF;
-
- if (afd == -1 || lseek(afd, 0L, SEEK_SET) == -1)
- {
- if (errno != EBADF)
- return -1;
- afd = open(_PATH_AVENRUN, O_RDONLY|O_SYNC);
- if (afd < 0)
- {
- sm_syslog(LOG_ERR, NOQID,
- "can't open %s: %m",
- _PATH_AVENRUN);
- return -1;
- }
- }
-
- r = read(afd, &avenrun, sizeof avenrun);
-
- if (tTd(3, 5))
- printf("getla: avenrun = %d\n", avenrun);
- loadav = (int) (avenrun + FSCALE/2) >> FSHIFT;
- if (tTd(3, 1))
- printf("getla: %d\n", loadav);
- return loadav;
-}
-
-#endif /* LA_TYPE == LA_DEVSHORT */
-
-#if LA_TYPE == LA_ALPHAOSF
-struct rtentry;
-struct mbuf;
-# include <sys/table.h>
-
-int getla()
-{
- int ave = 0;
- struct tbl_loadavg tab;
-
- if (table(TBL_LOADAVG, 0, &tab, 1, sizeof(tab)) == -1)
- {
- if (tTd(3, 1))
- printf("getla: table %s\n", errstring(errno));
- return (-1);
- }
-
- if (tTd(3, 1))
- printf("getla: scale = %d\n", tab.tl_lscale);
-
- if (tab.tl_lscale)
- ave = (tab.tl_avenrun.l[0] + (tab.tl_lscale/2)) / tab.tl_lscale;
- else
- ave = (int) (tab.tl_avenrun.d[0] + 0.5);
-
- if (tTd(3, 1))
- printf("getla: %d\n", ave);
-
- return ave;
-}
-
-#endif
-
-#if LA_TYPE == LA_ZERO
-
-int
-getla()
-{
- if (tTd(3, 1))
- printf("getla: ZERO\n");
- return (0);
-}
-
-#endif /* LA_TYPE == LA_ZERO */
-
-/*
- * Copyright 1989 Massachusetts Institute of Technology
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of M.I.T. not be used in advertising or
- * publicity pertaining to distribution of the software without specific,
- * written prior permission. M.I.T. makes no representations about the
- * suitability of this software for any purpose. It is provided "as is"
- * without express or implied warranty.
- *
- * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
- * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- *
- * Authors: Many and varied...
- */
-
-/* Non Apollo stuff removed by Don Lewis 11/15/93 */
-#ifndef lint
-static char rcsid[] = "@(#)$Id: conf.c,v 1.13 1999/02/05 05:59:23 millert Exp $";
-#endif /* !lint */
-
-#ifdef apollo
-# undef volatile
-# include <apollo/base.h>
-
-/* ARGSUSED */
-int getloadavg( call_data )
- caddr_t call_data; /* pointer to (double) return value */
-{
- double *avenrun = (double *) call_data;
- int i;
- status_$t st;
- long loadav[3];
- proc1_$get_loadav(loadav, &st);
- *avenrun = loadav[0] / (double) (1 << 16);
- return(0);
-}
-# endif /* apollo */
-\f/*
-** SHOULDQUEUE -- should this message be queued or sent?
-**
-** Compares the message cost to the load average to decide.
-**
-** Parameters:
-** pri -- the priority of the message in question.
-** ctime -- the message creation time.
-**
-** Returns:
-** TRUE -- if this message should be queued up for the
-** time being.
-** FALSE -- if the load is low enough to send this message.
-**
-** Side Effects:
-** none.
-*/
-
-extern int get_num_procs_online __P((void));
-
-bool
-shouldqueue(pri, ctime)
- long pri;
- time_t ctime;
-{
- bool rval;
- int queuela = QueueLA * get_num_procs_online();
-
- if (tTd(3, 30))
- printf("shouldqueue: CurrentLA=%d, pri=%ld: ", CurrentLA, pri);
- if (CurrentLA < queuela)
- {
- if (tTd(3, 30))
- printf("FALSE (CurrentLA < QueueLA)\n");
- return (FALSE);
- }
-#if 0 /* this code is reported to cause oscillation around RefuseLA */
- if (CurrentLA >= RefuseLA && QueueLA < RefuseLA)
- {
- if (tTd(3, 30))
- printf("TRUE (CurrentLA >= RefuseLA)\n");
- return (TRUE);
- }
-#endif
- rval = pri > (QueueFactor / (CurrentLA - queuela + 1));
- if (tTd(3, 30))
- printf("%s (by calculation)\n", rval ? "TRUE" : "FALSE");
- return rval;
-}
-\f/*
-** REFUSECONNECTIONS -- decide if connections should be refused
-**
-** Parameters:
-** port -- port number (for error messages only)
-**
-** Returns:
-** TRUE if incoming SMTP connections should be refused
-** (for now).
-** FALSE if we should accept new work.
-**
-** Side Effects:
-** Sets process title when it is rejecting connections.
-*/
-
-bool
-refuseconnections(port)
- int port;
-{
- int refusela = RefuseLA * get_num_procs_online();
- time_t now;
- static time_t lastconn = (time_t) 0;
- static int conncnt = 0;
- extern bool enoughdiskspace __P((long));
-
-#ifdef XLA
- if (!xla_smtp_ok())
- return TRUE;
-#endif
-
- now = curtime();
- if (now != lastconn)
- {
- lastconn = now;
- conncnt = 0;
- }
- else if (conncnt++ > ConnRateThrottle && ConnRateThrottle > 0)
- {
- /* sleep to flatten out connection load */
- sm_setproctitle(TRUE, "deferring connections on port %d: %d per second",
- port, ConnRateThrottle);
- if (LogLevel >= 14)
- sm_syslog(LOG_INFO, NOQID,
- "deferring connections on port %d: %d per second",
- port, ConnRateThrottle);
- sleep(1);
- }
-
- CurrentLA = getla();
- if (CurrentLA >= refusela)
- {
- sm_setproctitle(TRUE, "rejecting connections on port %d: load average: %d",
- port, CurrentLA);
- if (LogLevel >= 14)
- sm_syslog(LOG_INFO, NOQID,
- "rejecting connections on port %d: load average: %d",
- port, CurrentLA);
- return TRUE;
- }
-
- if (!enoughdiskspace(MinBlocksFree + 1))
- {
- sm_setproctitle(TRUE, "rejecting connections on port %d: min free: %d",
- port, MinBlocksFree);
- if (LogLevel >= 14)
- sm_syslog(LOG_INFO, NOQID,
- "rejecting connections on port %d: min free: %d",
- port, MinBlocksFree);
- return TRUE;
- }
-
- if (MaxChildren > 0 && CurChildren >= MaxChildren)
- {
- proc_list_probe();
- if (CurChildren >= MaxChildren)
- {
- sm_setproctitle(TRUE, "rejecting connections on port %d: %d children, max %d",
- port, CurChildren, MaxChildren);
- if (LogLevel >= 14)
- sm_syslog(LOG_INFO, NOQID,
- "rejecting connections on port %d: %d children, max %d",
- port, CurChildren, MaxChildren);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-\f/*
-** SETPROCTITLE -- set process title for ps
-**
-** Parameters:
-** fmt -- a printf style format string.
-** a, b, c -- possible parameters to fmt.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Clobbers argv of our main procedure so ps(1) will
-** display the title.
-*/
-
-#define SPT_NONE 0 /* don't use it at all */
-#define SPT_REUSEARGV 1 /* cover argv with title information */
-#define SPT_BUILTIN 2 /* use libc builtin */
-#define SPT_PSTAT 3 /* use pstat(PSTAT_SETCMD, ...) */
-#define SPT_PSSTRINGS 4 /* use PS_STRINGS->... */
-#define SPT_SYSMIPS 5 /* use sysmips() supported by NEWS-OS 6 */
-#define SPT_SCO 6 /* write kernel u. area */
-#define SPT_CHANGEARGV 7 /* write our own strings into argv[] */
-
-#ifndef SPT_TYPE
-# define SPT_TYPE SPT_REUSEARGV
-#endif
-
-#if SPT_TYPE != SPT_NONE && SPT_TYPE != SPT_BUILTIN
-
-# if SPT_TYPE == SPT_PSTAT
-# include <sys/pstat.h>
-# endif
-# if SPT_TYPE == SPT_PSSTRINGS
-# include <machine/vmparam.h>
-# include <sys/exec.h>
-# ifndef PS_STRINGS /* hmmmm.... apparently not available after all */
-# undef SPT_TYPE
-# define SPT_TYPE SPT_REUSEARGV
-# else
-# ifndef NKPDE /* FreeBSD 2.0 */
-# define NKPDE 63
-typedef unsigned int *pt_entry_t;
-# endif
-# endif
-# endif
-
-# if SPT_TYPE == SPT_PSSTRINGS || SPT_TYPE == SPT_CHANGEARGV
-# define SETPROC_STATIC static
-# else
-# define SETPROC_STATIC
-# endif
-
-# if SPT_TYPE == SPT_SYSMIPS
-# include <sys/sysmips.h>
-# include <sys/sysnews.h>
-# endif
-
-# if SPT_TYPE == SPT_SCO
-# include <sys/immu.h>
-# include <sys/dir.h>
-# include <sys/user.h>
-# include <sys/fs/s5param.h>
-# if PSARGSZ > MAXLINE
-# define SPT_BUFSIZE PSARGSZ
-# endif
-# endif
-
-# ifndef SPT_PADCHAR
-# define SPT_PADCHAR ' '
-# endif
-
-#endif /* SPT_TYPE != SPT_NONE && SPT_TYPE != SPT_BUILTIN */
-
-# ifndef SPT_BUFSIZE
-# define SPT_BUFSIZE MAXLINE
-# endif
-
-/*
-** Pointers for setproctitle.
-** This allows "ps" listings to give more useful information.
-*/
-
-char **Argv = NULL; /* pointer to argument vector */
-char *LastArgv = NULL; /* end of argv */
-
-void
-initsetproctitle(argc, argv, envp)
- int argc;
- char **argv;
- char **envp;
-{
- register int i, envpsize = 0;
- extern char **environ;
-
- /*
- ** Move the environment so setproctitle can use the space at
- ** the top of memory.
- */
-
- for (i = 0; envp[i] != NULL; i++)
- envpsize += strlen(envp[i]) + 1;
- 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.
- */
-
- Argv = argv;
-
- /*
- ** Determine how much space we can use for setproctitle.
- ** Use all contiguous argv and envp pointers starting at argv[0]
- */
- for (i = 0; i < argc; i++)
- {
- if (i==0 || LastArgv + 1 == argv[i])
- LastArgv = argv[i] + strlen(argv[i]);
- else
- continue;
- }
- for (i=0; envp[i] != NULL; i++)
- {
- if (LastArgv + 1 == envp[i])
- LastArgv = envp[i] + strlen(envp[i]);
- else
- continue;
- }
-}
-
-#if SPT_TYPE != SPT_BUILTIN
-
-
-/*VARARGS1*/
-void
-# ifdef __STDC__
-setproctitle(const char *fmt, ...)
-# else
-setproctitle(fmt, va_alist)
- const char *fmt;
- va_dcl
-# endif
-{
-# if SPT_TYPE != SPT_NONE
- register char *p;
- register int i;
- SETPROC_STATIC char buf[SPT_BUFSIZE];
- VA_LOCAL_DECL
-# if SPT_TYPE == SPT_PSTAT
- union pstun pst;
-# endif
-# if SPT_TYPE == SPT_SCO
- off_t seek_off;
- static int kmem = -1;
- static int kmempid = -1;
- struct user u;
-# endif
-
- p = buf;
-
- /* print sendmail: heading for grep */
- (void) strcpy(p, "sendmail: ");
- p += strlen(p);
-
- /* print the argument string */
- VA_START(fmt);
- (void) vsnprintf(p, SPACELEFT(buf, p), fmt, ap);
- VA_END;
-
- i = strlen(buf);
-
-# if SPT_TYPE == SPT_PSTAT
- pst.pst_command = buf;
- pstat(PSTAT_SETCMD, pst, i, 0, 0);
-# endif
-# if SPT_TYPE == SPT_PSSTRINGS
- PS_STRINGS->ps_nargvstr = 1;
- PS_STRINGS->ps_argvstr = buf;
-# endif
-# if SPT_TYPE == SPT_SYSMIPS
- sysmips(SONY_SYSNEWS, NEWS_SETPSARGS, buf);
-# endif
-# if SPT_TYPE == SPT_SCO
- if (kmem < 0 || kmempid != getpid())
- {
- if (kmem >= 0)
- close(kmem);
- kmem = open(_PATH_KMEM, O_RDWR, 0);
- if (kmem < 0)
- return;
- (void) fcntl(kmem, F_SETFD, 1);
- kmempid = getpid();
- }
- buf[PSARGSZ - 1] = '\0';
- seek_off = UVUBLK + (off_t) u.u_psargs - (off_t) &u;
- if (lseek(kmem, (off_t) seek_off, SEEK_SET) == seek_off)
- (void) write(kmem, buf, PSARGSZ);
-# endif
-# if SPT_TYPE == SPT_REUSEARGV
- if (i > LastArgv - Argv[0] - 2)
- {
- i = LastArgv - Argv[0] - 2;
- buf[i] = '\0';
- }
- (void) strcpy(Argv[0], buf);
- p = &Argv[0][i];
- while (p < LastArgv)
- *p++ = SPT_PADCHAR;
- Argv[1] = NULL;
-# endif
-# if SPT_TYPE == SPT_CHANGEARGV
- Argv[0] = buf;
- Argv[1] = 0;
-# endif
-# endif /* SPT_TYPE != SPT_NONE */
-}
-
-#endif /* SPT_TYPE != SPT_BUILTIN */
-\f/*
-** SM_SETPROCTITLE -- set process task and set process title for ps
-**
-** Possibly set process status and call setproctitle() to
-** change the ps display.
-**
-** Parameters:
-** status -- whether or not to store as process status
-** fmt -- a printf style format string.
-** a, b, c -- possible parameters to fmt.
-**
-** Returns:
-** none.
-*/
-
-/*VARARGS2*/
-void
-# ifdef __STDC__
-sm_setproctitle(bool status, const char *fmt, ...)
-# else
-sm_setproctitle(status, fmt, va_alist)
- bool status;
- const char *fmt;
- va_dcl
-#endif
-{
- char buf[SPT_BUFSIZE];
-
- VA_LOCAL_DECL
- /* print the argument string */
- VA_START(fmt);
- (void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap);
- VA_END;
-
- if (status)
- proc_list_set(getpid(), buf);
- setproctitle("%s", buf);
-}
-\f/*
-** WAITFOR -- wait for a particular process id.
-**
-** Parameters:
-** pid -- process id to wait for.
-**
-** Returns:
-** status of pid.
-** -1 if pid never shows up.
-**
-** Side Effects:
-** none.
-*/
-
-int
-waitfor(pid)
- pid_t pid;
-{
-#ifdef WAITUNION
- union wait st;
-#else
- auto int st;
-#endif
- pid_t i;
-#if defined(ISC_UNIX) || defined(_SCO_unix_)
- int savesig;
-#endif
-
- do
- {
- errno = 0;
-#if defined(ISC_UNIX) || defined(_SCO_unix_)
- savesig = releasesignal(SIGCHLD);
-#endif
- i = wait(&st);
-#if defined(ISC_UNIX) || defined(_SCO_unix_)
- if (savesig > 0)
- blocksignal(SIGCHLD);
-#endif
- if (i > 0)
- proc_list_drop(i);
- } while ((i >= 0 || errno == EINTR) && i != pid);
- if (i < 0)
- return -1;
-#ifdef WAITUNION
- return st.w_status;
-#else
- return st;
-#endif
-}
-\f/*
-** REAPCHILD -- pick up the body of my child, lest it become a zombie
-**
-** Parameters:
-** sig -- the signal that got us here (unused).
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Picks up extant zombies.
-*/
-
-SIGFUNC_DECL
-reapchild(sig)
- int sig;
-{
- int olderrno = errno;
- pid_t pid;
-# ifdef HASWAITPID
- auto int status;
- int count;
-
- count = 0;
- while ((pid = waitpid(-1, &status, WNOHANG)) > 0)
- {
- if (count++ > 1000)
- {
- if (LogLevel > 0)
- sm_syslog(LOG_ALERT, NOQID,
- "reapchild: waitpid loop: pid=%d, status=%x",
- pid, status);
- break;
- }
- proc_list_drop(pid);
- }
-# else
-# ifdef WNOHANG
- union wait status;
-
- while ((pid = wait3(&status, WNOHANG, (struct rusage *) NULL)) > 0)
- proc_list_drop(pid);
-# else /* WNOHANG */
- auto int status;
-
- /*
- ** Catch one zombie -- we will be re-invoked (we hope) if there
- ** are more. Unreliable signals probably break this, but this
- ** is the "old system" situation -- waitpid or wait3 are to be
- ** strongly preferred.
- */
-
- if ((pid = wait(&status)) > 0)
- proc_list_drop(pid);
-# endif /* WNOHANG */
-# endif
-# ifdef SYS5SIGNALS
- (void) setsignal(SIGCHLD, reapchild);
-# endif
- errno = olderrno;
- return SIGFUNC_RETURN;
-}
-\f/*
-** PUTENV -- emulation of putenv() in terms of setenv()
-**
-** Not needed on Posix-compliant systems.
-** This doesn't have full Posix semantics, but it's good enough
-** for sendmail.
-**
-** Parameter:
-** env -- the environment to put.
-**
-** Returns:
-** none.
-*/
-
-#ifdef NEEDPUTENV
-
-# if NEEDPUTENV == 2 /* no setenv(3) call available */
-
-int
-putenv(str)
- char *str;
-{
- char **current;
- int matchlen, envlen=0;
- char *tmp;
- char **newenv;
- static int first=1;
- extern char **environ;
-
- /*
- * find out how much of str to match when searching
- * for a string to replace.
- */
- if ((tmp = strchr(str, '=')) == NULL || tmp == str)
- matchlen = strlen(str);
- else
- matchlen = (int) (tmp - str);
- ++matchlen;
-
- /*
- * Search for an existing string in the environment and find the
- * length of environ. If found, replace and exit.
- */
- for (current=environ; *current; current++) {
- ++envlen;
-
- if (strncmp(str, *current, matchlen) == 0) {
- /* found it, now insert the new version */
- *current = (char *)str;
- return(0);
- }
- }
-
- /*
- * There wasn't already a slot so add space for a new slot.
- * If this is our first time through, use malloc(), else realloc().
- */
- if (first) {
- newenv = (char **) malloc(sizeof(char *) * (envlen + 2));
- if (newenv == NULL)
- return(-1);
-
- first=0;
- (void) memcpy(newenv, environ, sizeof(char *) * envlen);
- } else {
- newenv = (char **) realloc((char *)environ, sizeof(char *) * (envlen + 2));
- if (newenv == NULL)
- return(-1);
- }
-
- /* actually add in the new entry */
- environ = newenv;
- environ[envlen] = (char *)str;
- environ[envlen+1] = NULL;
-
- return(0);
-}
-
-#else /* implement putenv() in terms of setenv() */
-
-int
-putenv(env)
- char *env;
-{
- char *p;
- int l;
- char nbuf[100];
-
- p = strchr(env, '=');
- if (p == NULL)
- return 0;
- l = p - env;
- if (l > sizeof nbuf - 1)
- l = sizeof nbuf - 1;
- bcopy(env, nbuf, l);
- nbuf[l] = '\0';
- return setenv(nbuf, ++p, 1);
-}
-
-# endif
-#endif
-\f/*
-** UNSETENV -- remove a variable from the environment
-**
-** Not needed on newer systems.
-**
-** Parameters:
-** name -- the string name of the environment variable to be
-** deleted from the current environment.
-**
-** Returns:
-** none.
-**
-** Globals:
-** environ -- a pointer to the current environment.
-**
-** Side Effects:
-** Modifies environ.
-*/
-
-#ifndef HASUNSETENV
-
-void
-unsetenv(name)
- char *name;
-{
- extern char **environ;
- register char **pp;
- int len = strlen(name);
-
- for (pp = environ; *pp != NULL; pp++)
- {
- if (strncmp(name, *pp, len) == 0 &&
- ((*pp)[len] == '=' || (*pp)[len] == '\0'))
- break;
- }
-
- for (; *pp != NULL; pp++)
- *pp = pp[1];
-}
-
-#endif
-\f/*
-** GETDTABLESIZE -- return number of file descriptors
-**
-** Only on non-BSD systems
-**
-** Parameters:
-** none
-**
-** Returns:
-** size of file descriptor table
-**
-** Side Effects:
-** none
-*/
-
-#ifdef SOLARIS
-# include <sys/resource.h>
-#endif
-
-int
-getdtsize()
-{
-#ifdef RLIMIT_NOFILE
- struct rlimit rl;
-
- if (getrlimit(RLIMIT_NOFILE, &rl) >= 0)
- return rl.rlim_cur;
-#endif
-
-# ifdef HASGETDTABLESIZE
- return getdtablesize();
-# else
-# ifdef _SC_OPEN_MAX
- return sysconf(_SC_OPEN_MAX);
-# else
- return NOFILE;
-# endif
-# endif
-}
-\f/*
-** UNAME -- get the UUCP name of this system.
-*/
-
-#ifndef HASUNAME
-
-int
-uname(name)
- struct utsname *name;
-{
- FILE *file;
- char *n;
-
- name->nodename[0] = '\0';
-
- /* try /etc/whoami -- one line with the node name */
- if ((file = fopen("/etc/whoami", "r")) != NULL)
- {
- (void) fgets(name->nodename, NODE_LENGTH + 1, file);
- (void) fclose(file);
- n = strchr(name->nodename, '\n');
- if (n != NULL)
- *n = '\0';
- if (name->nodename[0] != '\0')
- return (0);
- }
-
- /* try /usr/include/whoami.h -- has a #define somewhere */
- if ((file = fopen("/usr/include/whoami.h", "r")) != NULL)
- {
- char buf[MAXLINE];
-
- while (fgets(buf, MAXLINE, file) != NULL)
- if (sscanf(buf, "#define sysname \"%*[^\"]\"",
- NODE_LENGTH, name->nodename) > 0)
- break;
- (void) fclose(file);
- if (name->nodename[0] != '\0')
- return (0);
- }
-
-#ifdef TRUST_POPEN
- /*
- ** Popen is known to have security holes.
- */
-
- /* try uuname -l to return local name */
- if ((file = popen("uuname -l", "r")) != NULL)
- {
- (void) fgets(name, NODE_LENGTH + 1, file);
- (void) pclose(file);
- n = strchr(name, '\n');
- if (n != NULL)
- *n = '\0';
- if (name->nodename[0] != '\0')
- return (0);
- }
-#endif
-
- return (-1);
-}
-#endif /* HASUNAME */
-\f/*
-** INITGROUPS -- initialize groups
-**
-** Stub implementation for System V style systems
-*/
-
-#ifndef HASINITGROUPS
-
-initgroups(name, basegid)
- char *name;
- int basegid;
-{
- return 0;
-}
-
-#endif
-\f/*
-** SETGROUPS -- set group list
-**
-** Stub implementation for systems that don't have group lists
-*/
-
-#ifndef NGROUPS_MAX
-
-int
-setgroups(ngroups, grouplist)
- int ngroups;
- GIDSET_T grouplist[];
-{
- return 0;
-}
-
-#endif
-\f/*
-** SETSID -- set session id (for non-POSIX systems)
-*/
-
-#ifndef HASSETSID
-
-pid_t
-setsid __P ((void))
-{
-#ifdef TIOCNOTTY
- int fd;
-
- fd = open("/dev/tty", O_RDWR, 0);
- if (fd >= 0)
- {
- (void) ioctl(fd, (int) TIOCNOTTY, (char *) 0);
- (void) close(fd);
- }
-#endif /* TIOCNOTTY */
-# ifdef SYS5SETPGRP
- return setpgrp();
-# else
- return setpgid(0, getpid());
-# endif
-}
-
-#endif
-\f/*
-** FSYNC -- dummy fsync
-*/
-
-#ifdef NEEDFSYNC
-
-fsync(fd)
- int fd;
-{
-# ifdef O_SYNC
- return fcntl(fd, F_SETFL, O_SYNC);
-# else
- /* nothing we can do */
- return 0;
-# endif
-}
-
-#endif
-\f/*
-** DGUX_INET_ADDR -- inet_addr for DG/UX
-**
-** Data General DG/UX version of inet_addr returns a struct in_addr
-** instead of a long. This patches things. Only needed on versions
-** prior to 5.4.3.
-*/
-
-#ifdef DGUX_5_4_2
-
-#undef inet_addr
-
-long
-dgux_inet_addr(host)
- char *host;
-{
- struct in_addr haddr;
-
- haddr = inet_addr(host);
- return haddr.s_addr;
-}
-
-#endif
-\f/*
-** GETOPT -- for old systems or systems with bogus implementations
-*/
-
-#ifdef NEEDGETOPT
-
-/*
- * Copyright (c) 1985 Regents of the University of California.
- * All rights reserved. The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
- */
-
-
-/*
-** this version hacked to add `atend' flag to allow state machine
-** to reset if invoked by the program to scan args for a 2nd time
-*/
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)getopt.c 4.3 (Berkeley) 3/9/86";
-#endif /* LIBC_SCCS and not lint */
-
-#include <stdio.h>
-
-/*
- * get option letter from argument vector
- */
-#ifdef _CONVEX_SOURCE
-extern int optind, opterr, optopt;
-extern char *optarg;
-#else
-int opterr = 1; /* if error message should be printed */
-int optind = 1; /* index into parent argv vector */
-int optopt = 0; /* character checked for validity */
-char *optarg = NULL; /* argument associated with option */
-#endif
-
-#define BADCH (int)'?'
-#define EMSG ""
-#define tell(s) if (opterr) {fputs(*nargv,stderr);fputs(s,stderr); \
- fputc(optopt,stderr);fputc('\n',stderr);return(BADCH);}
-
-int
-getopt(nargc,nargv,ostr)
- int nargc;
- char *const *nargv;
- const char *ostr;
-{
- static char *place = EMSG; /* option letter processing */
- static char atend = 0;
- register char *oli = NULL; /* option letter list index */
-
- if (atend) {
- atend = 0;
- place = EMSG;
- }
- if(!*place) { /* update scanning pointer */
- if (optind >= nargc || *(place = nargv[optind]) != '-' || !*++place) {
- atend++;
- return -1;
- }
- if (*place == '-') { /* found "--" */
- ++optind;
- atend++;
- return -1;
- }
- } /* option letter okay? */
- if ((optopt = (int)*place++) == (int)':' || !(oli = strchr(ostr,optopt))) {
- if (!*place) ++optind;
- tell(": illegal option -- ");
- }
- if (oli && *++oli != ':') { /* don't need argument */
- optarg = NULL;
- if (!*place) ++optind;
- }
- else { /* need an argument */
- if (*place) optarg = place; /* no white space */
- else if (nargc <= ++optind) { /* no arg */
- place = EMSG;
- tell(": option requires an argument -- ");
- }
- else optarg = nargv[optind]; /* white space */
- place = EMSG;
- ++optind;
- }
- return(optopt); /* dump back option letter */
-}
-
-#endif
-\f/*
-** VFPRINTF, VSPRINTF -- for old 4.3 BSD systems missing a real version
-*/
-
-#ifdef NEEDVPRINTF
-
-#define MAXARG 16
-
-vfprintf(fp, fmt, ap)
- FILE *fp;
- char *fmt;
- char **ap;
-{
- char *bp[MAXARG];
- int i = 0;
-
- while (*ap && i < MAXARG)
- bp[i++] = *ap++;
- fprintf(fp, fmt, bp[0], bp[1], bp[2], bp[3],
- bp[4], bp[5], bp[6], bp[7],
- bp[8], bp[9], bp[10], bp[11],
- bp[12], bp[13], bp[14], bp[15]);
-}
-
-vsprintf(s, fmt, ap)
- char *s;
- char *fmt;
- char **ap;
-{
- char *bp[MAXARG];
- int i = 0;
-
- while (*ap && i < MAXARG)
- bp[i++] = *ap++;
- sprintf(s, fmt, bp[0], bp[1], bp[2], bp[3],
- bp[4], bp[5], bp[6], bp[7],
- bp[8], bp[9], bp[10], bp[11],
- bp[12], bp[13], bp[14], bp[15]);
-}
-
-#endif
-\f/*
-** USERSHELLOK -- tell if a user's shell is ok for unrestricted use
-**
-** Parameters:
-** user -- the name of the user we are checking.
-** shell -- the user's shell from /etc/passwd
-**
-** Returns:
-** TRUE -- if it is ok to use this for unrestricted access.
-** FALSE -- if the shell is restricted.
-*/
-
-#if !HASGETUSERSHELL
-
-# ifndef _PATH_SHELLS
-# define _PATH_SHELLS "/etc/shells"
-# endif
-
-# if defined(_AIX3) || defined(_AIX4)
-# include <userconf.h>
-# if _AIX4 >= 40200
-# include <userpw.h>
-# endif
-# include <usersec.h>
-# endif
-
-char *DefaultUserShells[] =
-{
- "/bin/sh", /* standard shell */
- "/usr/bin/sh",
- "/bin/csh", /* C shell */
- "/usr/bin/csh",
-#ifdef __hpux
-# ifdef V4FS
- "/usr/bin/rsh", /* restricted Bourne shell */
- "/usr/bin/ksh", /* Korn shell */
- "/usr/bin/rksh", /* restricted Korn shell */
- "/usr/bin/pam",
- "/usr/bin/keysh", /* key shell (extended Korn shell) */
- "/usr/bin/posix/sh",
-# else
- "/bin/rsh", /* restricted Bourne shell */
- "/bin/ksh", /* Korn shell */
- "/bin/rksh", /* restricted Korn shell */
- "/bin/pam",
- "/usr/bin/keysh", /* key shell (extended Korn shell) */
- "/bin/posix/sh",
-# endif
-#endif
-#if defined(_AIX3) || defined(_AIX4)
- "/bin/ksh", /* Korn shell */
- "/usr/bin/ksh",
- "/bin/tsh", /* trusted shell */
- "/usr/bin/tsh",
- "/bin/bsh", /* Bourne shell */
- "/usr/bin/bsh",
-#endif
-#if defined(__svr4__) || defined(__svr5__)
- "/bin/ksh", /* Korn shell */
- "/usr/bin/ksh",
-#endif
-#ifdef sgi
- "/sbin/sh", /* SGI's shells really live in /sbin */
- "/sbin/csh",
- "/bin/ksh", /* Korn shell */
- "/sbin/ksh",
- "/usr/bin/ksh",
- "/bin/tcsh", /* Extended csh */
- "/usr/bin/tcsh",
-#endif
- NULL
-};
-
-#endif
-
-#define WILDCARD_SHELL "/SENDMAIL/ANY/SHELL/"
-
-bool
-usershellok(user, shell)
- char *user;
- char *shell;
-{
-#if HASGETUSERSHELL
- register char *p;
- extern char *getusershell();
-
- if (shell == NULL || shell[0] == '\0' || wordinclass(user, 't') ||
- ConfigLevel <= 1)
- return TRUE;
-
- setusershell();
- while ((p = getusershell()) != NULL)
- if (strcmp(p, shell) == 0 || strcmp(p, WILDCARD_SHELL) == 0)
- break;
- endusershell();
- return p != NULL;
-#else
-# if USEGETCONFATTR
- auto char *v;
-# endif
- register FILE *shellf;
- char buf[MAXLINE];
-
- if (shell == NULL || shell[0] == '\0' || wordinclass(user, 't') ||
- ConfigLevel <= 1)
- return TRUE;
-
-# if USEGETCONFATTR
- /*
- ** Naturally IBM has a "better" idea.....
- **
- ** What a crock. This interface isn't documented, it is
- ** considered part of the security library (-ls), and it
- ** only works if you are running as root (since the list
- ** of valid shells is obviously a source of great concern).
- ** I recommend that you do NOT define USEGETCONFATTR,
- ** especially since you are going to have to set up an
- ** /etc/shells anyhow to handle the cases where getconfattr
- ** fails.
- */
-
- if (getconfattr(SC_SYS_LOGIN, SC_SHELLS, &v, SEC_LIST) == 0 && v != NULL)
- {
- while (*v != '\0')
- {
- if (strcmp(v, shell) == 0 || strcmp(v, WILDCARD_SHELL) == 0)
- return TRUE;
- v += strlen(v) + 1;
- }
- return FALSE;
- }
-# endif
-
- shellf = fopen(_PATH_SHELLS, "r");
- if (shellf == NULL)
- {
- /* no /etc/shells; see if it is one of the std shells */
- char **d;
-
- if (errno != ENOENT && LogLevel > 3)
- sm_syslog(LOG_ERR, NOQID,
- "usershellok: cannot open %s: %s",
- _PATH_SHELLS, errstring(errno));
-
- for (d = DefaultUserShells; *d != NULL; d++)
- {
- if (strcmp(shell, *d) == 0)
- return TRUE;
- }
- return FALSE;
- }
-
- while (fgets(buf, sizeof buf, shellf) != NULL)
- {
- register char *p, *q;
-
- p = buf;
- while (*p != '\0' && *p != '#' && *p != '/')
- p++;
- if (*p == '#' || *p == '\0')
- continue;
- q = p;
- while (*p != '\0' && *p != '#' && !(isascii(*p) && isspace(*p)))
- p++;
- *p = '\0';
- if (strcmp(shell, q) == 0 || strcmp(WILDCARD_SHELL, q) == 0)
- {
- fclose(shellf);
- return TRUE;
- }
- }
- fclose(shellf);
- return FALSE;
-#endif
-}
-\f/*
-** FREEDISKSPACE -- see how much free space is on the queue filesystem
-**
-** Only implemented if you have statfs.
-**
-** Parameters:
-** dir -- the directory in question.
-** bsize -- a variable into which the filesystem
-** block size is stored.
-**
-** Returns:
-** The number of bytes free on the queue filesystem.
-** -1 if the statfs call fails.
-**
-** Side effects:
-** Puts the filesystem block size into bsize.
-*/
-
-/* statfs types */
-#define SFS_NONE 0 /* no statfs implementation */
-#define SFS_USTAT 1 /* use ustat */
-#define SFS_4ARGS 2 /* use four-argument statfs call */
-#define SFS_VFS 3 /* use <sys/vfs.h> implementation */
-#define SFS_MOUNT 4 /* use <sys/mount.h> implementation */
-#define SFS_STATFS 5 /* use <sys/statfs.h> implementation */
-#define SFS_STATVFS 6 /* use <sys/statvfs.h> implementation */
-
-#ifndef SFS_TYPE
-# define SFS_TYPE SFS_NONE
-#endif
-
-#if SFS_TYPE == SFS_USTAT
-# include <ustat.h>
-#endif
-#if SFS_TYPE == SFS_4ARGS || SFS_TYPE == SFS_STATFS
-# include <sys/statfs.h>
-#endif
-#if SFS_TYPE == SFS_VFS
-# include <sys/vfs.h>
-#endif
-#if SFS_TYPE == SFS_MOUNT
-# include <sys/mount.h>
-#endif
-#if SFS_TYPE == SFS_STATVFS
-# include <sys/statvfs.h>
-#endif
-
-long
-freediskspace(dir, bsize)
- char *dir;
- long *bsize;
-{
-#if SFS_TYPE != SFS_NONE
-# if SFS_TYPE == SFS_USTAT
- struct ustat fs;
- struct stat statbuf;
-# define FSBLOCKSIZE DEV_BSIZE
-# define SFS_BAVAIL f_tfree
-# else
-# if defined(ultrix)
- struct fs_data fs;
-# define SFS_BAVAIL fd_bfreen
-# define FSBLOCKSIZE 1024L
-# else
-# if SFS_TYPE == SFS_STATVFS
- struct statvfs fs;
-# define FSBLOCKSIZE fs.f_frsize
-# else
- struct statfs fs;
-# define FSBLOCKSIZE fs.f_bsize
-# endif
-# endif
-# endif
-# ifndef SFS_BAVAIL
-# define SFS_BAVAIL f_bavail
-# endif
-
-# if SFS_TYPE == SFS_USTAT
- if (stat(dir, &statbuf) == 0 && ustat(statbuf.st_dev, &fs) == 0)
-# else
-# if SFS_TYPE == SFS_4ARGS
- if (statfs(dir, &fs, sizeof fs, 0) == 0)
-# else
-# if SFS_TYPE == SFS_STATVFS
- if (statvfs(dir, &fs) == 0)
-# else
-# if defined(ultrix)
- if (statfs(dir, &fs) > 0)
-# else
- if (statfs(dir, &fs) == 0)
-# endif
-# endif
-# endif
-# endif
- {
- if (bsize != NULL)
- *bsize = FSBLOCKSIZE;
- if (fs.SFS_BAVAIL <= 0)
- return 0;
- else if (fs.SFS_BAVAIL > LONG_MAX)
- return LONG_MAX;
- else
- return (long) fs.SFS_BAVAIL;
- }
-#endif
- return (-1);
-}
-\f/*
-** ENOUGHDISKSPACE -- is there enough free space on the queue fs?
-**
-** Only implemented if you have statfs.
-**
-** Parameters:
-** msize -- the size to check against. If zero, we don't yet
-** know how big the message will be, so just check for
-** a "reasonable" amount.
-**
-** Returns:
-** TRUE if there is enough space.
-** FALSE otherwise.
-*/
-
-bool
-enoughdiskspace(msize)
- long msize;
-{
- long bfree, bsize;
-
- if (MinBlocksFree <= 0 && msize <= 0)
- {
- if (tTd(4, 80))
- printf("enoughdiskspace: no threshold\n");
- return TRUE;
- }
-
- if ((bfree = freediskspace(QueueDir, &bsize)) >= 0)
- {
- if (tTd(4, 80))
- printf("enoughdiskspace: bavail=%ld, need=%ld\n",
- bfree, msize);
-
- /* convert msize to block count */
- msize = msize / bsize + 1;
- if (MinBlocksFree >= 0)
- msize += MinBlocksFree;
-
- if (bfree < msize)
- {
- if (LogLevel > 0)
- sm_syslog(LOG_ALERT, CurEnv->e_id,
- "low on space (have %ld, %s needs %ld in %s)",
- bfree,
- CurHostName == NULL ? "SMTP-DAEMON" : CurHostName,
- msize, QueueDir);
- return FALSE;
- }
- }
- else if (tTd(4, 80))
- printf("enoughdiskspace failure: min=%ld, need=%ld: %s\n",
- MinBlocksFree, msize, errstring(errno));
- return TRUE;
-}
-\f/*
-** TRANSIENTERROR -- tell if an error code indicates a transient failure
-**
-** This looks at an errno value and tells if this is likely to
-** go away if retried later.
-**
-** Parameters:
-** err -- the errno code to classify.
-**
-** Returns:
-** TRUE if this is probably transient.
-** FALSE otherwise.
-*/
-
-bool
-transienterror(err)
- int err;
-{
- switch (err)
- {
- case EIO: /* I/O error */
- case ENXIO: /* Device not configured */
- case EAGAIN: /* Resource temporarily unavailable */
- case ENOMEM: /* Cannot allocate memory */
- case ENODEV: /* Operation not supported by device */
- case ENFILE: /* Too many open files in system */
- case EMFILE: /* Too many open files */
- case ENOSPC: /* No space left on device */
-#ifdef ETIMEDOUT
- case ETIMEDOUT: /* Connection timed out */
-#endif
-#ifdef ESTALE
- case ESTALE: /* Stale NFS file handle */
-#endif
-#ifdef ENETDOWN
- case ENETDOWN: /* Network is down */
-#endif
-#ifdef ENETUNREACH
- case ENETUNREACH: /* Network is unreachable */
-#endif
-#ifdef ENETRESET
- case ENETRESET: /* Network dropped connection on reset */
-#endif
-#ifdef ECONNABORTED
- case ECONNABORTED: /* Software caused connection abort */
-#endif
-#ifdef ECONNRESET
- case ECONNRESET: /* Connection reset by peer */
-#endif
-#ifdef ENOBUFS
- case ENOBUFS: /* No buffer space available */
-#endif
-#ifdef ESHUTDOWN
- case ESHUTDOWN: /* Can't send after socket shutdown */
-#endif
-#ifdef ECONNREFUSED
- case ECONNREFUSED: /* Connection refused */
-#endif
-#ifdef EHOSTDOWN
- case EHOSTDOWN: /* Host is down */
-#endif
-#ifdef EHOSTUNREACH
- case EHOSTUNREACH: /* No route to host */
-#endif
-#ifdef EDQUOT
- case EDQUOT: /* Disc quota exceeded */
-#endif
-#ifdef EPROCLIM
- case EPROCLIM: /* Too many processes */
-#endif
-#ifdef EUSERS
- case EUSERS: /* Too many users */
-#endif
-#ifdef EDEADLK
- case EDEADLK: /* Resource deadlock avoided */
-#endif
-#ifdef EISCONN
- case EISCONN: /* Socket already connected */
-#endif
-#ifdef EINPROGRESS
- case EINPROGRESS: /* Operation now in progress */
-#endif
-#ifdef EALREADY
- case EALREADY: /* Operation already in progress */
-#endif
-#ifdef EADDRINUSE
- case EADDRINUSE: /* Address already in use */
-#endif
-#ifdef EADDRNOTAVAIL
- case EADDRNOTAVAIL: /* Can't assign requested address */
-#endif
-#ifdef ETXTBSY
- case ETXTBSY: /* (Apollo) file locked */
-#endif
-#if defined(ENOSR) && (!defined(ENOBUFS) || (ENOBUFS != ENOSR))
- case ENOSR: /* Out of streams resources */
-#endif
- case E_SM_OPENTIMEOUT: /* PSEUDO: open timed out */
- return TRUE;
- }
-
- /* nope, must be permanent */
- return FALSE;
-}
-\f/*
-** LOCKFILE -- lock a file using flock or (shudder) fcntl locking
-**
-** Parameters:
-** fd -- the file descriptor of the file.
-** filename -- the file name (for error messages).
-** ext -- the filename extension.
-** type -- type of the lock. Bits can be:
-** LOCK_EX -- exclusive lock.
-** LOCK_NB -- non-blocking.
-**
-** Returns:
-** TRUE if the lock was acquired.
-** FALSE otherwise.
-*/
-
-bool
-lockfile(fd, filename, ext, type)
- int fd;
- char *filename;
- char *ext;
- int type;
-{
- int i;
- int save_errno;
-# if !HASFLOCK
- int action;
- struct flock lfd;
-
- if (ext == NULL)
- ext = "";
-
- bzero(&lfd, sizeof lfd);
- if (bitset(LOCK_UN, type))
- lfd.l_type = F_UNLCK;
- else if (bitset(LOCK_EX, type))
- lfd.l_type = F_WRLCK;
- else
- lfd.l_type = F_RDLCK;
-
- if (bitset(LOCK_NB, type))
- action = F_SETLK;
- else
- action = F_SETLKW;
-
- if (tTd(55, 60))
- printf("lockfile(%s%s, action=%d, type=%d): ",
- filename, ext, action, lfd.l_type);
-
- while ((i = fcntl(fd, action, &lfd)) < 0 && errno == EINTR)
- continue;
- if (i >= 0)
- {
- if (tTd(55, 60))
- printf("SUCCESS\n");
- return TRUE;
- }
- save_errno = errno;
-
- if (tTd(55, 60))
- printf("(%s) ", errstring(save_errno));
-
- /*
- ** On SunOS, if you are testing using -oQ/tmp/mqueue or
- ** -oA/tmp/aliases or anything like that, and /tmp is mounted
- ** as type "tmp" (that is, served from swap space), the
- ** previous fcntl will fail with "Invalid argument" errors.
- ** Since this is fairly common during testing, we will assume
- ** that this indicates that the lock is successfully grabbed.
- */
-
- if (save_errno == EINVAL)
- {
- if (tTd(55, 60))
- printf("SUCCESS\n");
- return TRUE;
- }
-
- if (!bitset(LOCK_NB, type) || (save_errno != EACCES && save_errno != EAGAIN))
- {
- int omode = -1;
-# ifdef F_GETFL
- (void) fcntl(fd, F_GETFL, &omode);
- errno = save_errno;
-# endif
- syserr("cannot lockf(%s%s, fd=%d, type=%o, omode=%o, euid=%d)",
- filename, ext, fd, type, omode, geteuid());
- dumpfd(fd, TRUE, TRUE);
- }
-# else
- if (ext == NULL)
- ext = "";
-
- if (tTd(55, 60))
- printf("lockfile(%s%s, type=%o): ", filename, ext, type);
-
- while ((i = flock(fd, type)) < 0 && errno == EINTR)
- continue;
- if (i >= 0)
- {
- if (tTd(55, 60))
- printf("SUCCESS\n");
- return TRUE;
- }
- save_errno = errno;
-
- if (tTd(55, 60))
- printf("(%s) ", errstring(save_errno));
-
- if (!bitset(LOCK_NB, type) || save_errno != EWOULDBLOCK)
- {
- int omode = -1;
-# ifdef F_GETFL
- (void) fcntl(fd, F_GETFL, &omode);
- errno = save_errno;
-# endif
- syserr("cannot flock(%s%s, fd=%d, type=%o, omode=%o, euid=%d)",
- filename, ext, fd, type, omode, geteuid());
- dumpfd(fd, TRUE, TRUE);
- }
-# endif
- if (tTd(55, 60))
- printf("FAIL\n");
- errno = save_errno;
- return FALSE;
-}
-\f/*
-** CHOWNSAFE -- tell if chown is "safe" (executable only by root)
-**
-** Unfortunately, given that we can't predict other systems on which
-** a remote mounted (NFS) filesystem will be mounted, the answer is
-** almost always that this is unsafe.
-**
-** Note also that many operating systems have non-compliant
-** implementations of the _POSIX_CHOWN_RESTRICTED variable and the
-** fpathconf() routine. According to IEEE 1003.1-1990, if
-** _POSIX_CHOWN_RESTRICTED is defined and not equal to -1, then
-** no non-root process can give away the file. However, vendors
-** don't take NFS into account, so a comfortable value of
-** _POSIX_CHOWN_RESTRICTED tells us nothing.
-**
-** Also, some systems (e.g., IRIX 6.2) return 1 from fpathconf()
-** even on files where chown is not restricted. Many systems get
-** this wrong on NFS-based filesystems (that is, they say that chown
-** is restricted [safe] on NFS filesystems where it may not be, since
-** other systems can access the same filesystem and do file giveaway;
-** only the NFS server knows for sure!) Hence, it is important to
-** get the value of SAFENFSPATHCONF correct -- it should be defined
-** _only_ after testing (see test/t_pathconf.c) a system on an unsafe
-** NFS-based filesystem to ensure that you can get meaningful results.
-** If in doubt, assume unsafe!
-**
-** You may also need to tweak IS_SAFE_CHOWN -- it should be a
-** condition indicating whether the return from pathconf indicates
-** that chown is safe (typically either > 0 or >= 0 -- there isn't
-** even any agreement about whether a zero return means that a file
-** is or is not safe). It defaults to "> 0".
-**
-** If the parent directory is safe (writable only by owner back
-** to the root) then we can relax slightly and trust fpathconf
-** in more circumstances. This is really a crock -- if this is an
-** NFS mounted filesystem then we really know nothing about the
-** underlying implementation. However, most systems pessimize and
-** return an error (EINVAL or EOPNOTSUPP) on NFS filesystems, which
-** we interpret as unsafe, as we should. Thus, this heuristic gets
-** us into a possible problem only on systems that have a broken
-** pathconf implementation and which are also poorly configured
-** (have :include: files in group- or world-writable directories).
-**
-** Parameters:
-** fd -- the file descriptor to check.
-** safedir -- set if the parent directory is safe.
-**
-** Returns:
-** TRUE -- if the chown(2) operation is "safe" -- that is,
-** only root can chown the file to an arbitrary user.
-** FALSE -- if an arbitrary user can give away a file.
-*/
-
-#ifndef IS_SAFE_CHOWN
-# define IS_SAFE_CHOWN > 0
-#endif
-
-bool
-chownsafe(fd, safedir)
- int fd;
- bool safedir;
-{
-#if (!defined(_POSIX_CHOWN_RESTRICTED) || _POSIX_CHOWN_RESTRICTED != -1) && \
- (defined(_PC_CHOWN_RESTRICTED) || defined(_GNU_TYPES_H))
- int rval;
-
- /* give the system administrator a chance to override */
- if (bitset(DBS_ASSUMESAFECHOWN, DontBlameSendmail))
- return TRUE;
-
- /*
- ** Some systems (e.g., SunOS) seem to have the call and the
- ** #define _PC_CHOWN_RESTRICTED, but don't actually implement
- ** the call. This heuristic checks for that.
- */
-
- errno = 0;
- rval = fpathconf(fd, _PC_CHOWN_RESTRICTED);
-# if SAFENFSPATHCONF
- return errno == 0 && rval IS_SAFE_CHOWN;
-# else
- return safedir && errno == 0 && rval IS_SAFE_CHOWN;
-# endif
-#else
- return bitset(DBS_ASSUMESAFECHOWN, DontBlameSendmail);
-#endif
-}
-\f/*
-** RESETLIMITS -- reset system controlled resource limits
-**
-** This is to avoid denial-of-service attacks
-**
-** Parameters:
-** none
-**
-** Returns:
-** none
-*/
-
-#if HASSETRLIMIT
-# ifdef RLIMIT_NEEDS_SYS_TIME_H
-# include <sys/time.h>
-# endif
-# include <sys/resource.h>
-#endif
-#ifndef FD_SETSIZE
-# define FD_SETSIZE 256
-#endif
-
-void
-resetlimits()
-{
-#if HASSETRLIMIT
- struct rlimit lim;
-
- lim.rlim_cur = lim.rlim_max = RLIM_INFINITY;
- (void) setrlimit(RLIMIT_CPU, &lim);
- (void) setrlimit(RLIMIT_FSIZE, &lim);
-# ifdef RLIMIT_NOFILE
- lim.rlim_cur = lim.rlim_max = FD_SETSIZE;
- (void) setrlimit(RLIMIT_NOFILE, &lim);
-# endif
-#else
-# if HASULIMIT
- (void) ulimit(2, 0x3fffff);
- (void) ulimit(4, FD_SETSIZE);
-# endif
-#endif
- errno = 0;
-}
-\f/*
-** GETCFNAME -- return the name of the .cf file.
-**
-** Some systems (e.g., NeXT) determine this dynamically.
-*/
-
-char *
-getcfname()
-{
-
- if (ConfFile != NULL)
- return ConfFile;
-#if NETINFO
- {
- extern char *ni_propval __P((char *, char *, char *, char *, int));
- char *cflocation;
-
- cflocation = ni_propval("/locations", NULL, "sendmail",
- "sendmail.cf", '\0');
- if (cflocation != NULL)
- return cflocation;
- }
-#endif
-
- return _PATH_SENDMAILCF;
-}
-\f/*
-** SETVENDOR -- process vendor code from V configuration line
-**
-** Parameters:
-** vendor -- string representation of vendor.
-**
-** Returns:
-** TRUE -- if ok.
-** FALSE -- if vendor code could not be processed.
-**
-** Side Effects:
-** It is reasonable to set mode flags here to tweak
-** processing in other parts of the code if necessary.
-** For example, if you are a vendor that uses $%y to
-** indicate YP lookups, you could enable that here.
-*/
-
-bool
-setvendor(vendor)
- char *vendor;
-{
- if (strcasecmp(vendor, "Berkeley") == 0)
- {
- VendorCode = VENDOR_BERKELEY;
- return TRUE;
- }
-
- /* add vendor extensions here */
-
-#ifdef SUN_EXTENSIONS
- if (strcasecmp(vendor, "Sun") == 0)
- {
- VendorCode = VENDOR_SUN;
- return TRUE;
- }
-#endif
-
-#if defined(VENDOR_NAME) && defined(VENDOR_CODE)
- if (strcasecmp(vendor, VENDOR_NAME) == 0)
- {
- VendorCode = VENDOR_CODE;
- return TRUE;
- }
-#endif
-
- return FALSE;
-}
-\f/*
-** GETVENDOR -- return vendor name based on vendor code
-**
-** Parameters:
-** vendorcode -- numeric representation of vendor.
-**
-** Returns:
-** string containing vendor name.
-*/
-
-char *
-getvendor(vendorcode)
- int vendorcode;
-{
-#if defined(VENDOR_NAME) && defined(VENDOR_CODE)
- /*
- ** Can't have the same switch case twice so need to
- ** handle VENDOR_CODE outside of switch. It might
- ** match one of the existing VENDOR_* codes.
- */
-
- if (vendorcode == VENDOR_CODE)
- return VENDOR_NAME;
-#endif
-
- switch (vendorcode)
- {
- case VENDOR_BERKELEY:
- return "Berkeley";
-
- case VENDOR_SUN:
- return "Sun";
-
- case VENDOR_HP:
- return "HP";
-
- case VENDOR_IBM:
- return "IBM";
-
- case VENDOR_SENDMAIL:
- return "Sendmail";
-
- default:
- return "Unknown";
- }
-}
-\f/*
-** VENDOR_PRE_DEFAULTS, VENDOR_POST_DEFAULTS -- set vendor-specific defaults
-**
-** Vendor_pre_defaults is called before reading the configuration
-** file; vendor_post_defaults is called immediately after.
-**
-** Parameters:
-** e -- the global environment to initialize.
-**
-** Returns:
-** none.
-*/
-
-#if SHARE_V1
-int DefShareUid; /* default share uid to run as -- unused??? */
-#endif
-
-void
-vendor_pre_defaults(e)
- ENVELOPE *e;
-{
-#if SHARE_V1
- /* OTHERUID is defined in shares.h, do not be alarmed */
- DefShareUid = OTHERUID;
-#endif
-#if defined(SUN_EXTENSIONS) && defined(SUN_DEFAULT_VALUES)
- sun_pre_defaults(e);
-#endif
-#ifdef apollo
- /* stupid domain/os can't even open /etc/sendmail.cf without this */
- setuserenv("ISP", NULL);
- setuserenv("SYSTYPE", NULL);
-#endif
-}
-
-
-void
-vendor_post_defaults(e)
- ENVELOPE *e;
-{
-#ifdef __QNX__
- char *p;
-
- /* Makes sure the SOCK environment variable remains */
- if (p = getextenv("SOCK"))
- setuserenv("SOCK", p);
-#endif
-#if defined(SUN_EXTENSIONS) && defined(SUN_DEFAULT_VALUES)
- sun_post_defaults(e);
-#endif
-}
-\f/*
-** VENDOR_DAEMON_SETUP -- special vendor setup needed for daemon mode
-*/
-
-void
-vendor_daemon_setup(e)
- ENVELOPE *e;
-{
-#if SECUREWARE
- if (getluid() != -1)
- {
- usrerr("Daemon cannot have LUID");
- finis(FALSE, EX_USAGE);
- }
-#endif /* SECUREWARE */
-}
-\f/*
-** VENDOR_SET_UID -- do setup for setting a user id
-**
-** This is called when we are still root.
-**
-** Parameters:
-** uid -- the uid we are about to become.
-**
-** Returns:
-** none.
-*/
-
-void
-vendor_set_uid(uid)
- UID_T uid;
-{
- /*
- ** We need to setup the share groups (lnodes)
- ** and and auditing inforation (luid's)
- ** before we loose our ``root''ness.
- */
-#if SHARE_V1
- if (setupshares(uid, syserr) != 0)
- syserr("Unable to set up shares");
-#endif
-#if SECUREWARE
- (void) setup_secure(uid);
-#endif
-}
-\f/*
-** VALIDATE_CONNECTION -- check connection for rationality
-**
-** If the connection is rejected, this routine should log an
-** appropriate message -- but should never issue any SMTP protocol.
-**
-** Parameters:
-** sap -- a pointer to a SOCKADDR naming the peer.
-** hostname -- the name corresponding to sap.
-** e -- the current envelope.
-**
-** Returns:
-** error message from rejection.
-** NULL if not rejected.
-*/
-
-#if TCPWRAPPERS
-# include <tcpd.h>
-
-/* tcpwrappers does no logging, but you still have to declare these -- ugh */
-int allow_severity = LOG_INFO;
-int deny_severity = LOG_NOTICE;
-#endif
-
-#if DAEMON
-char *
-validate_connection(sap, hostname, e)
- SOCKADDR *sap;
- char *hostname;
- ENVELOPE *e;
-{
-#if TCPWRAPPERS
- char *host;
-#endif
-
- if (tTd(48, 3))
- printf("validate_connection(%s, %s)\n",
- hostname, anynet_ntoa(sap));
-
- if (rscheck("check_relay", hostname, anynet_ntoa(sap), e) != EX_OK)
- {
- static char reject[BUFSIZ*2];
- extern char MsgBuf[];
-
- if (tTd(48, 4))
- printf(" ... validate_connection: BAD (rscheck)\n");
-
- if (strlen(MsgBuf) > 5)
- {
- if (isascii(MsgBuf[0]) && isdigit(MsgBuf[0]) &&
- isascii(MsgBuf[1]) && isdigit(MsgBuf[1]) &&
- isascii(MsgBuf[2]) && isdigit(MsgBuf[2]))
- strcpy(reject, &MsgBuf[4]);
- else
- strcpy(reject, MsgBuf);
- }
- else
- strcpy(reject, "Access denied");
-
- return reject;
- }
-
-#if TCPWRAPPERS
- if (hostname[0] == '[' && hostname[strlen(hostname) - 1] == ']')
- host = "unknown";
- else
- host = hostname;
- if (!hosts_ctl("sendmail", host, anynet_ntoa(sap), STRING_UNKNOWN))
- {
- if (tTd(48, 4))
- printf(" ... validate_connection: BAD (tcpwrappers)\n");
- if (LogLevel >= 4)
- sm_syslog(LOG_NOTICE, NOQID,
- "tcpwrappers (%s, %s) rejection",
- host, anynet_ntoa(sap));
- return "Access denied";
- }
-#endif
- if (tTd(48, 4))
- printf(" ... validate_connection: OK\n");
- return NULL;
-}
-
-#endif
-\f/*
-** STRTOL -- convert string to long integer
-**
-** For systems that don't have it in the C library.
-**
-** This is taken verbatim from the 4.4-Lite C library.
-*/
-
-#ifdef NEEDSTRTOL
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strtol.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * Convert a string to a long integer.
- *
- * Ignores `locale' stuff. Assumes that the upper and lower case
- * alphabets and digits are each contiguous.
- */
-
-long
-strtol(nptr, endptr, base)
- const char *nptr;
- char **endptr;
- register int base;
-{
- register const char *s = nptr;
- register unsigned long acc;
- register int c;
- register unsigned long cutoff;
- register int neg = 0, any, cutlim;
-
- /*
- * Skip white space and pick up leading +/- sign if any.
- * If base is 0, allow 0x for hex and 0 for octal, else
- * assume decimal; if base is already 16, allow 0x.
- */
- do {
- c = *s++;
- } while (isspace(c));
- if (c == '-') {
- neg = 1;
- c = *s++;
- } else if (c == '+')
- c = *s++;
- if ((base == 0 || base == 16) &&
- c == '0' && (*s == 'x' || *s == 'X')) {
- c = s[1];
- s += 2;
- base = 16;
- }
- if (base == 0)
- base = c == '0' ? 8 : 10;
-
- /*
- * Compute the cutoff value between legal numbers and illegal
- * numbers. That is the largest legal value, divided by the
- * base. An input number that is greater than this value, if
- * followed by a legal input character, is too big. One that
- * is equal to this value may be valid or not; the limit
- * between valid and invalid numbers is then based on the last
- * digit. For instance, if the range for longs is
- * [-2147483648..2147483647] and the input base is 10,
- * cutoff will be set to 214748364 and cutlim to either
- * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated
- * a value > 214748364, or equal but the next digit is > 7 (or 8),
- * the number is too big, and we will return a range error.
- *
- * Set any if any `digits' consumed; make it negative to indicate
- * overflow.
- */
- cutoff = neg ? -(unsigned long)LONG_MIN : LONG_MAX;
- cutlim = cutoff % (unsigned long)base;
- cutoff /= (unsigned long)base;
- for (acc = 0, any = 0;; c = *s++) {
- if (isdigit(c))
- c -= '0';
- else if (isalpha(c))
- c -= isupper(c) ? 'A' - 10 : 'a' - 10;
- else
- break;
- if (c >= base)
- break;
- if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
- any = -1;
- else {
- any = 1;
- acc *= base;
- acc += c;
- }
- }
- if (any < 0) {
- acc = neg ? LONG_MIN : LONG_MAX;
- errno = ERANGE;
- } else if (neg)
- acc = -acc;
- if (endptr != 0)
- *endptr = (char *)(any ? s - 1 : nptr);
- return (acc);
-}
-
-#endif
-\f/*
-** STRSTR -- find first substring in string
-**
-** Parameters:
-** big -- the big (full) string.
-** little -- the little (sub) string.
-**
-** Returns:
-** A pointer to the first instance of little in big.
-** big if little is the null string.
-** NULL if little is not contained in big.
-*/
-
-#ifdef NEEDSTRSTR
-
-char *
-strstr(big, little)
- char *big;
- char *little;
-{
- register char *p = big;
- int l;
-
- if (*little == '\0')
- return big;
- l = strlen(little);
-
- while ((p = strchr(p, *little)) != NULL)
- {
- if (strncmp(p, little, l) == 0)
- return p;
- p++;
- }
- return NULL;
-}
-
-#endif
-\f/*
-** SM_GETHOSTBY{NAME,ADDR} -- compatibility routines for gethostbyXXX
-**
-** Some operating systems have wierd problems with the gethostbyXXX
-** routines. For example, Solaris versions at least through 2.3
-** don't properly deliver a canonical h_name field. This tries to
-** work around these problems.
-*/
-
-struct hostent *
-sm_gethostbyname(name)
- char *name;
-{
- struct hostent *h;
-#if (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204) || (defined(sony_news) && defined(__svr4))
-# if SOLARIS == 20300 || SOLARIS == 203
- static struct hostent hp;
- static char buf[1000];
- extern struct hostent *_switch_gethostbyname_r();
-
- if (tTd(61, 10))
- printf("_switch_gethostbyname_r(%s)... ", name);
- h = _switch_gethostbyname_r(name, &hp, buf, sizeof(buf), &h_errno);
-# else
- extern struct hostent *__switch_gethostbyname();
-
- if (tTd(61, 10))
- printf("__switch_gethostbyname(%s)... ", name);
- h = __switch_gethostbyname(name);
-# endif
-#else
- int nmaps;
- char *maptype[MAXMAPSTACK];
- short mapreturn[MAXMAPACTIONS];
- char hbuf[MAXNAME];
-
- if (tTd(61, 10))
- printf("gethostbyname(%s)... ", name);
- h = gethostbyname(name);
- if (h == NULL)
- {
- if (tTd(61, 10))
- printf("failure\n");
-
- nmaps = switch_map_find("hosts", maptype, mapreturn);
- while (--nmaps >= 0)
- if (strcmp(maptype[nmaps], "nis") == 0 ||
- strcmp(maptype[nmaps], "files") == 0)
- break;
- if (nmaps >= 0)
- {
- /* try short name */
- if (strlen(name) > (SIZE_T) sizeof hbuf - 1)
- return NULL;
- strcpy(hbuf, name);
- shorten_hostname(hbuf);
-
- /* if it hasn't been shortened, there's no point */
- if (strcmp(hbuf, name) != 0)
- {
- if (tTd(61, 10))
- printf("gethostbyname(%s)... ", hbuf);
- h = gethostbyname(hbuf);
- }
- }
- }
-#endif
- if (tTd(61, 10))
- {
- if (h == NULL)
- printf("failure\n");
- else
- printf("%s\n", h->h_name);
- }
- return h;
-}
-
-struct hostent *
-sm_gethostbyaddr(addr, len, type)
- char *addr;
- int len;
- int type;
-{
-#if (SOLARIS > 10000 && SOLARIS < 20400) || (defined(SOLARIS) && SOLARIS < 204)
-# if SOLARIS == 20300 || SOLARIS == 203
- static struct hostent hp;
- static char buf[1000];
- extern struct hostent *_switch_gethostbyaddr_r();
-
- return _switch_gethostbyaddr_r(addr, len, type, &hp, buf, sizeof(buf), &h_errno);
-# else
- extern struct hostent *__switch_gethostbyaddr();
-
- return __switch_gethostbyaddr(addr, len, type);
-# endif
-#else
- return gethostbyaddr(addr, len, type);
-#endif
-}
-\f/*
-** SM_GETPW{NAM,UID} -- wrapper for getpwnam and getpwuid
-*/
-
-struct passwd *
-sm_getpwnam(user)
- char *user;
-{
-#ifdef _AIX4
- extern struct passwd *_getpwnam_shadow(const char *, const int);
-
- return _getpwnam_shadow(user, 0);
-#else
- return getpwnam(user);
-#endif
-}
-
-struct passwd *
-sm_getpwuid(uid)
- UID_T uid;
-{
-#if defined(_AIX4) && 0
- extern struct passwd *_getpwuid_shadow(const int, const int);
-
- return _getpwuid_shadow(uid,0);
-#else
- return getpwuid(uid);
-#endif
-}
-\f/*
-** SECUREWARE_SETUP_SECURE -- Convex SecureWare setup
-**
-** Set up the trusted computing environment for C2 level security
-** under SecureWare.
-**
-** Parameters:
-** uid -- uid of the user to initialize in the TCB
-**
-** Returns:
-** none
-**
-** Side Effects:
-** Initialized the user in the trusted computing base
-*/
-
-#if SECUREWARE
-
-# include <sys/security.h>
-# include <prot.h>
-
-void
-secureware_setup_secure(uid)
- UID_T uid;
-{
- int rc;
-
- if (getluid() != -1)
- return;
-
- if ((rc = set_secure_info(uid)) != SSI_GOOD_RETURN)
- {
- switch (rc)
- {
- case SSI_NO_PRPW_ENTRY:
- syserr("No protected passwd entry, uid = %d", uid);
- break;
-
- case SSI_LOCKED:
- syserr("Account has been disabled, uid = %d", uid);
- break;
-
- case SSI_RETIRED:
- syserr("Account has been retired, uid = %d", uid);
- break;
-
- case SSI_BAD_SET_LUID:
- syserr("Could not set LUID, uid = %d", uid);
- break;
-
- case SSI_BAD_SET_PRIVS:
- syserr("Could not set kernel privs, uid = %d", uid);
-
- default:
- syserr("Unknown return code (%d) from set_secure_info(%d)",
- rc, uid);
- break;
- }
- finis(FALSE, EX_NOPERM);
- }
-}
-#endif /* SECUREWARE */
-\f/*
-** ADD_LOCAL_HOST_NAMES -- Add a hostname to class 'w' based on IP address
-**
-** Add hostnames to class 'w' based on the IP address read from
-** the network interface.
-**
-** Parameters:
-** sa -- a pointer to a SOCKADDR containing the address
-**
-** Returns:
-** 0 if successful, -1 if host lookup fails.
-*/
-
-int
-add_hostnames(sa)
- SOCKADDR *sa;
-{
- struct hostent *hp;
-
- /* lookup name with IP address */
- switch (sa->sa.sa_family)
- {
- case AF_INET:
- hp = sm_gethostbyaddr((char *) &sa->sin.sin_addr,
- sizeof(sa->sin.sin_addr), sa->sa.sa_family);
- break;
-
- default:
-#if _FFR_LOG_UNSUPPORTED_FAMILIES
- /* XXX: Give warning about unsupported family */
- if (LogLevel > 3)
- sm_syslog(LOG_WARNING, NOQID,
- "Unsupported address family %d: %.100s",
- sa->sa.sa_family, anynet_ntoa(sa));
-#endif
- return -1;
- }
-
- if (hp == NULL)
- {
- int save_errno = errno;
-
- if (LogLevel > 3)
- sm_syslog(LOG_WARNING, NOQID,
- "gethostbyaddr(%.100s) failed: %d\n",
- anynet_ntoa(sa),
-#if NAMED_BIND
- h_errno
-#else
- -1
-#endif
- );
- errno = save_errno;
- return -1;
- }
-
- /* save its cname */
- if (!wordinclass((char *) hp->h_name, 'w'))
- {
- setclass('w', (char *) hp->h_name);
- if (tTd(0, 4))
- printf("\ta.k.a.: %s\n", hp->h_name);
- }
-
- /* save all it aliases name */
- while (*hp->h_aliases)
- {
- if (!wordinclass(*hp->h_aliases, 'w'))
- {
- setclass('w', *hp->h_aliases);
- if (tTd(0, 4))
- printf("\ta.k.a.: %s\n", *hp->h_aliases);
- }
- hp->h_aliases++;
- }
- return 0;
-}
-\f/*
-** LOAD_IF_NAMES -- load interface-specific names into $=w
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Loads $=w with the names of all the interfaces.
-*/
-
-#if defined(SIOCGIFCONF) && !SIOCGIFCONF_IS_BROKEN
-struct rtentry;
-struct mbuf;
-# include <arpa/inet.h>
-# ifndef SUNOS403
-# include <sys/time.h>
-# endif
-# if _AIX4 >= 40300
-# undef __P
-# endif
-# include <net/if.h>
-#endif
-
-void
-load_if_names()
-{
-#if defined(SIOCGIFCONF) && !SIOCGIFCONF_IS_BROKEN
- int s;
- int i;
- struct ifconf ifc;
- int numifs;
-
- s = socket(AF_INET, SOCK_DGRAM, 0);
- if (s == -1)
- return;
-
- /* get the list of known IP address from the kernel */
-# if defined(SIOCGIFNUM) && !SIOCGIFNUM_IS_BROKEN
- if (ioctl(s, SIOCGIFNUM, (char *) &numifs) < 0)
- {
- /* can't get number of interfaces -- fall back */
- if (tTd(0, 4))
- printf("SIOCGIFNUM failed: %s\n", errstring(errno));
- numifs = -1;
- }
- else if (tTd(0, 42))
- printf("system has %d interfaces\n", numifs);
- if (numifs < 0)
-# endif
- numifs = 512;
-
- if (numifs <= 0)
- {
- close(s);
- return;
- }
- ifc.ifc_len = numifs * sizeof (struct ifreq);
- ifc.ifc_buf = xalloc(ifc.ifc_len);
- if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0)
- {
- if (tTd(0, 4))
- printf("SIOGIFCONF failed: %s\n", errstring(errno));
- close(s);
- return;
- }
-
- /* scan the list of IP address */
- if (tTd(0, 40))
- printf("scanning for interface specific names, ifc_len=%d\n",
- ifc.ifc_len);
-
- for (i = 0; i < ifc.ifc_len; )
- {
- struct ifreq *ifr = (struct ifreq *) &ifc.ifc_buf[i];
- SOCKADDR *sa = (SOCKADDR *) &ifr->ifr_addr;
- struct in_addr ia;
-#ifdef SIOCGIFFLAGS
- struct ifreq ifrf;
-#endif
- char ip_addr[256];
- extern char *inet_ntoa();
-
-#ifdef BSD4_4_SOCKADDR
- if (sa->sa.sa_len > sizeof ifr->ifr_addr)
- i += sizeof ifr->ifr_name + sa->sa.sa_len;
- else
-#endif
- i += sizeof *ifr;
-
- if (tTd(0, 20))
- printf("%s\n", anynet_ntoa(sa));
-
- if (ifr->ifr_addr.sa_family != AF_INET)
- continue;
-
-#ifdef SIOCGIFFLAGS
- bzero(&ifrf, sizeof(struct ifreq));
- strncpy(ifrf.ifr_name, ifr->ifr_name, sizeof(ifrf.ifr_name));
- ioctl(s, SIOCGIFFLAGS, (char *) &ifrf);
- if (tTd(0, 41))
- printf("\tflags: %x\n", ifrf.ifr_flags);
-# define IFRFREF ifrf
-#else
-# define IFRFREF (*ifr)
-#endif
- if (!bitset(IFF_UP, IFRFREF.ifr_flags))
- continue;
-
- /* extract IP address from the list*/
- ia = sa->sin.sin_addr;
- if (ia.s_addr == INADDR_ANY || ia.s_addr == INADDR_NONE)
- {
- message("WARNING: interface %s is UP with %s address",
- ifr->ifr_name, inet_ntoa(ia));
- continue;
- }
-
- /* save IP address in text from */
- (void) snprintf(ip_addr, sizeof ip_addr, "[%.*s]",
- sizeof ip_addr - 3,
- inet_ntoa(ia));
- if (!wordinclass(ip_addr, 'w'))
- {
- setclass('w', ip_addr);
- if (tTd(0, 4))
- printf("\ta.k.a.: %s\n", ip_addr);
- }
-
- /* skip "loopback" interface "lo" */
- if (bitset(IFF_LOOPBACK, IFRFREF.ifr_flags))
- continue;
-
- (void) add_hostnames(sa);
- }
- free(ifc.ifc_buf);
- close(s);
-# undef IFRFREF
-#endif
-}
-\f/*
-** GET_NUM_PROCS_ONLINE -- return the number of processors currently online
-**
-** Parameters:
-** none.
-**
-** Returns:
-** The number of processors online.
-*/
-
-int
-get_num_procs_online()
-{
- int nproc = 0;
-
-#if _FFR_SCALE_LA_BY_NUM_PROCS
-#ifdef _SC_NPROCESSORS_ONLN
- nproc = (int) sysconf(_SC_NPROCESSORS_ONLN);
-#endif
-#endif
- if (nproc <= 0)
- nproc = 1;
- return nproc;
-}
-\f/*
-** SM_SYSLOG -- syslog wrapper to keep messages under SYSLOG_BUFSIZE
-**
-** Parameters:
-** level -- syslog level
-** id -- envelope ID or NULL (NOQUEUE)
-** fmt -- format string
-** arg... -- arguments as implied by fmt.
-**
-** Returns:
-** none
-*/
-
-/* VARARGS3 */
-void
-# ifdef __STDC__
-sm_syslog(int level, const char *id, const char *fmt, ...)
-# else
-sm_syslog(level, id, fmt, va_alist)
- int level;
- const char *id;
- const char *fmt;
- va_dcl
-#endif
-{
- static char *buf = NULL;
- static size_t bufsize = MAXLINE;
- char *begin, *end;
- int seq = 1;
- int idlen;
- extern int SnprfOverflow;
- extern int SyslogErrno;
- extern char *DoprEnd;
- VA_LOCAL_DECL
- extern void sm_dopr __P((char *, const char *, va_list));
-
- SyslogErrno = errno;
- if (id == NULL)
- {
- id = "NOQUEUE";
- idlen = 9;
- }
- else if (strcmp(id, NOQID) == 0)
- {
- id = "";
- idlen = 0;
- }
- else
- idlen = strlen(id + 2);
-bufalloc:
- if (buf == NULL)
- buf = (char *) xalloc(sizeof(char) * bufsize);
-
- /* do a virtual vsnprintf into buf */
- VA_START(fmt);
- buf[0] = 0;
- DoprEnd = buf + bufsize - 1;
- SnprfOverflow = 0;
- sm_dopr(buf, fmt, ap);
- *DoprEnd = '\0';
- VA_END;
- /* end of virtual vsnprintf */
-
- if (SnprfOverflow)
- {
- /* String too small, redo with correct size */
- bufsize += SnprfOverflow + 1;
- free(buf);
- buf = NULL;
- goto bufalloc;
- }
- if ((strlen(buf) + idlen + 1) < SYSLOG_BUFSIZE)
- {
-#if LOG
- if (*id == '\0')
- syslog(level, "%s", buf);
- else
- syslog(level, "%s: %s", id, buf);
-#else
- /*XXX should do something more sensible */
- if (*id == '\0')
- fprintf(stderr, "%s\n", buf);
- else
- fprintf(stderr, "%s: %s\n", id, buf);
-#endif
- return;
- }
-
- begin = buf;
- while (*begin != '\0' &&
- (strlen(begin) + idlen + 5) > SYSLOG_BUFSIZE)
- {
- char save;
-
- if (seq == 999)
- {
- /* Too many messages */
- break;
- }
- end = begin + SYSLOG_BUFSIZE - idlen - 12;
- while (end > begin)
- {
- /* Break on comma or space */
- if (*end == ',' || *end == ' ')
- {
- end++; /* Include separator */
- break;
- }
- end--;
- }
- /* No separator, break midstring... */
- if (end == begin)
- end = begin + SYSLOG_BUFSIZE - idlen - 12;
- save = *end;
- *end = 0;
-#if LOG
- syslog(level, "%s[%d]: %s ...", id, seq++, begin);
-#else
- fprintf(stderr, "%s[%d]: %s ...\n", id, seq++, begin);
-#endif
- *end = save;
- begin = end;
- }
- if (seq == 999)
-#if LOG
- syslog(level, "%s[%d]: log terminated, too many parts", id, seq);
-#else
- fprintf(stderr, "%s[%d]: log terminated, too many parts\n", id, seq);
-#endif
- else if (*begin != '\0')
-#if LOG
- syslog(level, "%s[%d]: %s", id, seq, begin);
-#else
- fprintf(stderr, "%s[%d]: %s\n", id, seq, begin);
-#endif
-}
-\f/*
-** HARD_SYSLOG -- call syslog repeatedly until it works
-**
-** Needed on HP-UX, which apparently doesn't guarantee that
-** syslog succeeds during interrupt handlers.
-*/
-
-#if defined(__hpux) && !defined(HPUX11)
-
-# define MAXSYSLOGTRIES 100
-# undef syslog
-# ifdef V4FS
-# define XCNST const
-# define CAST (const char *)
-# else
-# define XCNST
-# define CAST
-# endif
-
-void
-# ifdef __STDC__
-hard_syslog(int pri, XCNST char *msg, ...)
-# else
-hard_syslog(pri, msg, va_alist)
- int pri;
- XCNST char *msg;
- va_dcl
-# endif
-{
- int i;
- char buf[SYSLOG_BUFSIZE];
- VA_LOCAL_DECL;
-
- VA_START(msg);
- vsnprintf(buf, sizeof buf, msg, ap);
- VA_END;
-
- for (i = MAXSYSLOGTRIES; --i >= 0 && syslog(pri, CAST "%s", buf) < 0; )
- continue;
-}
-
-# undef CAST
-#endif
-\f/*
-** LOCAL_HOSTNAME_LENGTH
-**
-** This is required to get sendmail to compile against BIND 4.9.x
-** on Ultrix.
-*/
-
-#if defined(ultrix) && NAMED_BIND
-
-# include <resolv.h>
-# if __RES >= 19931104 && __RES < 19950621
-
-int
-local_hostname_length(hostname)
- char *hostname;
-{
- int len_host, len_domain;
-
- if (!*_res.defdname)
- res_init();
- len_host = strlen(hostname);
- len_domain = strlen(_res.defdname);
- if (len_host > len_domain &&
- (strcasecmp(hostname + len_host - len_domain,_res.defdname) == 0) &&
- hostname[len_host - len_domain - 1] == '.')
- return len_host - len_domain - 1;
- else
- return 0;
-}
-
-# endif
-#endif
-\f/*
-** Compile-Time options
-*/
-
-char *CompileOptions[] =
-{
-#ifdef HESIOD
- "HESIOD",
-#endif
-#if HES_GETMAILHOST
- "HES_GETMAILHOST",
-#endif
-#ifdef LDAPMAP
- "LDAPMAP",
-#endif
-#ifdef MAP_REGEX
- "MAP_REGEX",
-#endif
-#if LOG
- "LOG",
-#endif
-#if MATCHGECOS
- "MATCHGECOS",
-#endif
-#if MIME7TO8
- "MIME7TO8",
-#endif
-#if MIME8TO7
- "MIME8TO7",
-#endif
-#if NAMED_BIND
- "NAMED_BIND",
-#endif
-#ifdef NDBM
- "NDBM",
-#endif
-#if NETINET
- "NETINET",
-#endif
-#if NETINFO
- "NETINFO",
-#endif
-#if NETISO
- "NETISO",
-#endif
-#if NETNS
- "NETNS",
-#endif
-#if NETUNIX
- "NETUNIX",
-#endif
-#if NETX25
- "NETX25",
-#endif
-#ifdef NEWDB
- "NEWDB",
-#endif
-#ifdef NIS
- "NIS",
-#endif
-#ifdef NISPLUS
- "NISPLUS",
-#endif
-#if QUEUE
- "QUEUE",
-#endif
-#if SCANF
- "SCANF",
-#endif
-#if SMTP
- "SMTP",
-#endif
-#if SMTPDEBUG
- "SMTPDEBUG",
-#endif
-#ifdef SUID_ROOT_FILES_OK
- "SUID_ROOT_FILES_OK",
-#endif
-#if TCPWRAPPERS
- "TCPWRAPPERS",
-#endif
-#if USERDB
- "USERDB",
-#endif
-#if XDEBUG
- "XDEBUG",
-#endif
-#ifdef XLA
- "XLA",
-#endif
- NULL
-};
-
-
-/*
-** OS compile options.
-*/
-
-char *OsCompileOptions[] =
-{
-#if BOGUS_O_EXCL
- "BOGUS_O_EXCL",
-#endif
-#if HASFCHMOD
- "HASFCHMOD",
-#endif
-#if HASFLOCK
- "HASFLOCK",
-#endif
-#if HASGETDTABLESIZE
- "HASGETDTABLESIZE",
-#endif
-#if HASGETUSERSHELL
- "HASGETUSERSHELL",
-#endif
-#if HASINITGROUPS
- "HASINITGROUPS",
-#endif
-#if HASLSTAT
- "HASLSTAT",
-#endif
-#if HASSETREUID
- "HASSETREUID",
-#endif
-#if HASSETRLIMIT
- "HASSETRLIMIT",
-#endif
-#if HASSETSID
- "HASSETSID",
-#endif
-#if HASSETUSERCONTEXT
- "HASSETUSERCONTEXT",
-#endif
-#if HASSETVBUF
- "HASSETVBUF",
-#endif
-#if HASSNPRINTF
- "HASSNPRINTF",
-#endif
-#if HAS_ST_GEN
- "HAS_ST_GEN",
-#endif
-#if HASSTRERROR
- "HASSTRERROR",
-#endif
-#if HASULIMIT
- "HASULIMIT",
-#endif
-#if HASUNAME
- "HASUNAME",
-#endif
-#if HASUNSETENV
- "HASUNSETENV",
-#endif
-#if HASWAITPID
- "HASWAITPID",
-#endif
-#if IDENTPROTO
- "IDENTPROTO",
-#endif
-#if IP_SRCROUTE
- "IP_SRCROUTE",
-#endif
-#if O_EXLOCK && HASFLOCK && !BOGUS_O_EXCL
- "LOCK_ON_OPEN",
-#endif
-#if NEEDFSYNC
- "NEEDFSYNC",
-#endif
-#if NOFTRUNCATE
- "NOFTRUNCATE",
-#endif
-#if RLIMIT_NEEDS_SYS_TIME_H
- "RLIMIT_NEEDS_SYS_TIME_H",
-#endif
-#if SAFENFSPATHCONF
- "SAFENFSPATHCONF",
-#endif
-#if SECUREWARE
- "SECUREWARE",
-#endif
-#if SHARE_V1
- "SHARE_V1",
-#endif
-#if SIOCGIFCONF_IS_BROKEN
- "SIOCGIFCONF_IS_BROKEN",
-#endif
-#if SIOCGIFNUM_IS_BROKEN
- "SIOCGIFNUM_IS_BROKEN",
-#endif
-#if SYS5SETPGRP
- "SYS5SETPGRP",
-#endif
-#if SYSTEM5
- "SYSTEM5",
-#endif
-#if USE_SA_SIGACTION
- "USE_SA_SIGACTION",
-#endif
-#if USE_SIGLONGJMP
- "USE_SIGLONGJMP",
-#endif
-#if USESETEUID
- "USESETEUID",
-#endif
- NULL
-};
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- *
- * @(#)conf.h 8.385 (Berkeley) 1/28/1999
- */
-
-/*
-** CONF.H -- All user-configurable parameters for sendmail
-**
-** Send updates to sendmail@Sendmail.ORG so they will be
-** included in the next release.
-*/
-
-#ifdef __GNUC__
-struct rusage; /* forward declaration to get gcc to shut up in wait.h */
-#endif
-
-# include <sys/param.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-#ifndef __QNX__
-/* in QNX this grabs bogus LOCK_* manifests */
-# include <sys/file.h>
-#endif
-# include <sys/wait.h>
-# include <limits.h>
-# include <fcntl.h>
-# include <signal.h>
-# include <netdb.h>
-# include <pwd.h>
-
-/**********************************************************************
-** Table sizes, etc....
-** There shouldn't be much need to change these....
-**********************************************************************/
-
-# define MAXLINE 2048 /* max line length */
-# define MAXNAME 256 /* max length of a name */
-# define MAXPV 40 /* max # of parms to mailers */
-# define MAXATOM 200 /* max atoms per address */
-# define MAXMAILERS 25 /* maximum mailers known to system */
-# define MAXRWSETS 200 /* max # of sets of rewriting rules */
-# define MAXPRIORITIES 25 /* max values for Precedence: field */
-# define MAXMXHOSTS 100 /* max # of MX records for one host */
-# define SMTPLINELIM 990 /* maximum SMTP line length */
-# define MAXKEY 128 /* maximum size of a database key */
-# define MEMCHUNKSIZE 1024 /* chunk size for memory allocation */
-# define MAXUSERENVIRON 100 /* max envars saved, must be >= 3 */
-# define MAXALIASDB 12 /* max # of alias databases */
-# define MAXMAPSTACK 12 /* max # of stacked or sequenced maps */
-# define MAXTOCLASS 8 /* max # of message timeout classes */
-# define MAXMIMEARGS 20 /* max args in Content-Type: */
-# define MAXMIMENESTING 20 /* max MIME multipart nesting */
-# define QUEUESEGSIZE 1000 /* increment for queue size */
-# define MAXQFNAME 20 /* max qf file name length */
-# define MACBUFSIZE 4096 /* max expanded macro buffer size */
-# define TOBUFSIZE 512 /* max buffer to hold address list */
-# define MAXSHORTSTR 203 /* max short string length */
-# if _FFR_MAX_MIME_HEADER_LENGTH
-# define MAXMACNAMELEN 25 /* max macro name length */
-# else
-# define MAXMACNAMELEN 20 /* max macro name length */
-# endif
-# ifndef MAXHDRSLEN
-# define MAXHDRSLEN (32 * 1024) /* max size of message headers */
-# endif
-
-/**********************************************************************
-** Compilation options.
-** #define these to 1 if they are available;
-** #define them to 0 otherwise.
-** All can be overridden from Makefile.
-**********************************************************************/
-
-# ifndef NETINET
-# define NETINET 1 /* include internet support */
-# endif
-
-# ifndef NETISO
-# define NETISO 0 /* do not include ISO socket support */
-# endif
-
-# ifndef NAMED_BIND
-# define NAMED_BIND 1 /* use Berkeley Internet Domain Server */
-# endif
-
-# ifndef XDEBUG
-# define XDEBUG 1 /* enable extended debugging */
-# endif
-
-# ifndef MATCHGECOS
-# define MATCHGECOS 1 /* match user names from gecos field */
-# endif
-
-# ifndef DSN
-# define DSN 1 /* include delivery status notification code */
-# endif
-
-# if !defined(USERDB) && (defined(NEWDB) || defined(HESIOD))
-# define USERDB 1 /* look in user database */
-# endif
-
-# ifndef MIME8TO7
-# define MIME8TO7 1 /* 8->7 bit MIME conversions */
-# endif
-
-# ifndef MIME7TO8
-# define MIME7TO8 1 /* 7->8 bit MIME conversions */
-# endif
-
-/**********************************************************************
-** "Hard" compilation options.
-** #define these if they are available; comment them out otherwise.
-** These cannot be overridden from the Makefile, and should really not
-** be turned off unless absolutely necessary.
-**********************************************************************/
-
-# define LOG 1 /* enable logging -- don't turn off */
-
-/**********************************************************************
-** End of site-specific configuration.
-**********************************************************************/
-\f/*
-** General "standard C" defines.
-**
-** These may be undone later, to cope with systems that claim to
-** be Standard C but aren't. Gcc is the biggest offender -- it
-** doesn't realize that the library is part of the language.
-**
-** Life would be much easier if we could get rid of this sort
-** of bozo problems.
-*/
-
-#ifdef __STDC__
-# define HASSETVBUF 1 /* we have setvbuf(3) in libc */
-#endif
-
-/*
-** Assume you have standard calls; can be #undefed below if necessary.
-*/
-
-# define HASLSTAT 1 /* has lstat(2) call */
-\f/**********************************************************************
-** Operating system configuration.
-**
-** Unless you are porting to a new OS, you shouldn't have to
-** change these.
-**********************************************************************/
-
-/*
-** HP-UX -- tested for 8.07, 9.00, and 9.01.
-**
-** If V4FS is defined, compile for HP-UX 10.0.
-** 11.x support from Richard Allen <ra@hp.is>.
-*/
-
-#ifdef __hpux
- /* common definitions for HP-UX 9.x and 10.x */
-# undef m_flags /* conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h on HP 300 */
-# define SYSTEM5 1 /* include all the System V defines */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define HASFCHMOD 1 /* has fchmod(2) syscall */
-# define USESETEUID 1 /* has useable seteuid(2) call */
-# define BOGUS_O_EXCL 1 /* exclusive open follows symlinks */
-# define seteuid(e) setresuid(-1, e, -1)
-# define IP_SRCROUTE 1 /* can check IP source routing */
-# define LA_TYPE LA_HPUX
-# define SPT_TYPE SPT_PSTAT
-# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
-# define GIDSET_T gid_t
-# ifndef HASGETUSERSHELL
-# define HASGETUSERSHELL 0 /* getusershell(3) causes core dumps */
-# endif
-# ifndef HPUX11
-# define syslog hard_syslog
-# endif
-# define SAFENFSPATHCONF 1 /* pathconf(2) pessimizes on NFS filesystems */
-
-# ifdef V4FS
- /* HP-UX 10.x */
-# define _PATH_UNIX "/stand/vmunix"
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/etc/mail/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/etc/mail/sendmail.pid"
-# endif
-# ifndef IDENTPROTO
-# define IDENTPROTO 1 /* TCP/IP implementation fixed in 10.0 */
-# endif
-
-# else
- /* HP-UX 9.x */
-# define _PATH_UNIX "/hp-ux"
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
-# endif
-# ifndef IDENTPROTO
-# define IDENTPROTO 0 /* TCP/IP implementation is broken */
-# endif
-# ifdef __STDC__
-extern void hard_syslog(int, char *, ...);
-# else
-extern void hard_syslog();
-# endif
-# define FDSET_CAST (int *) /* cast for fd_set parameters to select */
-# endif
-
-#endif
-
-
-/*
-** IBM AIX 4.x
-*/
-
-#ifdef _AIX4
-# define _AIX3 1 /* pull in AIX3 stuff */
-# define USESETEUID 1 /* seteuid(2) works */
-# define TZ_TYPE TZ_NAME /* use tzname[] vector */
-# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */
-# if _AIX4 >= 40200
-# define HASSETREUID 1 /* setreuid(2) works as of AIX 4.2 */
-# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */
-# endif
-# if defined(_ILS_MACROS) /* IBM versions aren't side-effect clean */
-# undef isascii
-# define isascii(c) !(c & ~0177)
-# undef isdigit
-# define isdigit(__a) (_IS(__a,_ISDIGIT))
-# undef isspace
-# define isspace(__a) (_IS(__a,_ISSPACE))
-# endif
-#endif
-
-
-/*
-** IBM AIX 3.x -- actually tested for 3.2.3
-*/
-
-#ifdef _AIX3
-# include <paths.h>
-# include <sys/machine.h> /* to get byte order */
-# include <sys/select.h>
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define HASUNAME 1 /* use System V uname(2) system call */
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
-# define HASFCHMOD 1 /* has fchmod(2) syscall */
-# define IP_SRCROUTE 0 /* Something is broken with getsockopt() */
-# define GIDSET_T gid_t
-# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */
-# define SPT_PADCHAR '\0' /* pad process title with nulls */
-# define LA_TYPE LA_INT
-# define FSHIFT 16
-# define LA_AVENRUN "avenrun"
-#endif
-
-
-/*
-** IBM AIX 2.2.1 -- actually tested for osupdate level 2706+1773
-**
-** From Mark Whetzel <markw@wg.waii.com>.
-*/
-
-#ifdef AIX /* AIX/RT compiler pre-defines this */
-# include <paths.h>
-# include <sys/time.h> /* AIX/RT resource.h does NOT include this */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define HASUNAME 1 /* use System V uname(2) system call */
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
-# define HASFCHMOD 0 /* does not have fchmod(2) syscall */
-# define HASSETREUID 1 /* use setreuid(2) -lbsd system call */
-# define HASSETVBUF 1 /* use setvbuf(2) system call */
-# define HASSETRLIMIT 0 /* does not have setrlimit call */
-# define HASFLOCK 0 /* does not have flock call - use fcntl */
-# define HASULIMIT 1 /* use ulimit instead of setrlimit call */
-# define NEEDGETOPT 1 /* Do we need theirs or ours */
-# define SYS5SETPGRP 1 /* don't have setpgid on AIX/RT */
-# define IP_SRCROUTE 0 /* Something is broken with getsockopt() */
-# define BSD4_3 1 /* NOT bsd 4.4 or posix signals */
-# define GIDSET_T int
-# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */
-# define SPT_PADCHAR '\0' /* pad process title with nulls */
-# define LA_TYPE LA_SUBR /* use our ported loadavgd daemon */
-# define TZ_TYPE TZ_TZNAME /* use tzname[] vector */
-# define ARBPTR_T int *
-# define void int
-typedef int pid_t;
-/* RTisms for BSD compatibility, specified in the Makefile
- define BSD 1
- define BSD_INCLUDES 1
- define BSD_REMAP_SIGNAL_TO_SIGVEC
- RTisms needed above */
-/* make this sendmail in a completely different place */
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/local/newmail/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/usr/local/newmail/sendmail.pid"
-# endif
-#endif
-
-
-/*
-** Silicon Graphics IRIX
-**
-** Compiles on 4.0.1.
-**
-** Use IRIX64 instead of IRIX for 64-bit IRIX (6.0).
-** Use IRIX5 instead of IRIX for IRIX 5.x.
-**
-** This version tries to be adaptive using _MIPS_SIM:
-** _MIPS_SIM == _ABIO32 (= 1) Abi: -32 on IRIX 6.2
-** _MIPS_SIM == _ABIN32 (= 2) Abi: -n32 on IRIX 6.2
-** _MIPS_SIM == _ABI64 (= 3) Abi: -64 on IRIX 6.2
-**
-** _MIPS_SIM is 1 also on IRIX 5.3
-**
-** IRIX64 changes from Mark R. Levinson <ml@cvdev.rochester.edu>.
-** IRIX5 changes from Kari E. Hurtta <Kari.Hurtta@fmi.fi>.
-** Adaptive changes from Kari E. Hurtta <Kari.Hurtta@fmi.fi>.
-*/
-
-#if defined(__sgi)
-# ifndef IRIX
-# define IRIX
-# endif
-# if _MIPS_SIM > 0 && !defined(IRIX5)
-# define IRIX5 /* IRIX5 or IRIX6 */
-# endif
-# if _MIPS_SIM > 1 && !defined(IRIX6) && !defined(IRIX64)
-# define IRIX6 /* IRIX6 */
-# endif
-
-#endif
-
-#ifdef IRIX
-# define SYSTEM5 1 /* this is a System-V derived system */
-# define HASSETREUID 1 /* has setreuid(2) call */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define HASFCHMOD 1 /* has fchmod(2) syscall */
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
-# define IP_SRCROUTE 1 /* can check IP source routing */
-# define setpgid BSDsetpgrp
-# define GIDSET_T gid_t
-# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */
-# define SFS_BAVAIL f_bfree /* alternate field name */
-# define SYSLOG_BUFSIZE 512
-# ifdef IRIX6
-# define STAT64 1
-# define QUAD_T unsigned long long
-# define LA_TYPE LA_IRIX6 /* figure out at run time */
-# define SAFENFSPATHCONF 0 /* pathconf(2) lies on NFS filesystems */
-# else
-# define LA_TYPE LA_INT
-
-# ifdef IRIX64
-# define STAT64 1
-# define QUAD_T unsigned long long
-# define NAMELISTMASK 0x7fffffffffffffff /* mask for nlist() values */
-# else
-# define STAT64 0
-# define NAMELISTMASK 0x7fffffff /* mask for nlist() values */
-# endif
-# endif
-# if defined(IRIX64) || defined(IRIX5) || defined(IRIX6)
-# include <sys/cdefs.h>
-# include <paths.h>
-# define ARGV_T char *const *
-# define HASSETRLIMIT 1 /* has setrlimit(2) syscall */
-# define HASGETDTABLESIZE 1 /* has getdtablesize(2) syscall */
-# define HASSTRERROR 1 /* has strerror(3) */
-# else
-# define ARGV_T const char **
-# define WAITUNION 1 /* use "union wait" as wait argument type */
-# endif
-#endif
-
-
-/*
-** SunOS and Solaris
-**
-** Tested on SunOS 4.1.x (a.k.a. Solaris 1.1.x) and
-** Solaris 2.4 (a.k.a. SunOS 5.4).
-*/
-
-#if defined(sun) && !defined(BSD)
-
-# include <sys/time.h>
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define HASUNAME 1 /* use System V uname(2) system call */
-# define HASFCHMOD 1 /* has fchmod(2) syscall */
-# define IP_SRCROUTE 1 /* can check IP source routing */
-# define SAFENFSPATHCONF 1 /* pathconf(2) pessimizes on NFS filesystems */
-
-# ifdef SOLARIS_2_3
-# define SOLARIS 20300 /* for back compat only -- use -DSOLARIS=20300 */
-# endif
-
-# if defined(NOT_SENDMAIL) && !defined(SOLARIS) && defined(sun) && (defined(__svr4__) || defined(__SVR4))
-# define SOLARIS 1 /* unknown Solaris version */
-# endif
-
-# ifdef SOLARIS
- /* Solaris 2.x (a.k.a. SunOS 5.x) */
-# ifndef __svr4__
-# define __svr4__ /* use all System V Releae 4 defines below */
-# endif
-# define GIDSET_T gid_t
-# define USE_SA_SIGACTION 1 /* use sa_sigaction field */
-# ifndef _PATH_UNIX
-# define _PATH_UNIX "/dev/ksyms"
-# endif
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/etc/mail/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/etc/mail/sendmail.pid"
-# endif
-# ifndef _PATH_HOSTS
-# define _PATH_HOSTS "/etc/inet/hosts"
-# endif
-# ifndef SYSLOG_BUFSIZE
-# define SYSLOG_BUFSIZE 1024 /* allow full size syslog buffer */
-# endif
-# ifndef TZ_TYPE
-# define TZ_TYPE TZ_TZNAME
-# endif
-# if SOLARIS >= 20300 || (SOLARIS < 10000 && SOLARIS >= 203)
-# define USESETEUID 1 /* seteuid works as of 2.3 */
-# endif
-# if SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205)
-# define HASSETREUID 1 /* setreuid works as of 2.5 */
-# if SOLARIS < 207 || (SOLARIS > 10000 && SOLARIS < 20700)
-# ifndef LA_TYPE
-# define LA_TYPE LA_KSTAT /* use kstat(3k) -- may work in < 2.5 */
-# endif
-# endif
-# endif
-# if SOLARIS >= 20600 || (SOLARIS < 10000 && SOLARIS >= 206)
-# define HASSNPRINTF 1 /* has snprintf starting in 2.6 */
-# endif
-# if SOLARIS >= 20700 || (SOLARIS < 10000 && SOLARIS >= 207)
-# ifndef LA_TYPE
-# define LA_TYPE LA_SUBR /* getloadavg(3c) appears in 2.7 */
-# endif
-# define HASGETUSERSHELL 1 /* getusershell(3c) bug fixed in 2.7 */
-# endif
-# ifndef HASGETUSERSHELL
-# define HASGETUSERSHELL 0 /* getusershell(3) causes core dumps pre-2.7 */
-# endif
-
-# else
- /* SunOS 4.0.3 or 4.1.x */
-# define HASGETUSERSHELL 1 /* DOES have getusershell(3) call in libc */
-# define HASSETREUID 1 /* has setreuid(2) call */
-# ifndef HASFLOCK
-# define HASFLOCK 1 /* has flock(2) call */
-# endif
-# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
-# define TZ_TYPE TZ_TM_ZONE /* use tm->tm_zone */
-# include <memory.h>
-# include <vfork.h>
-# ifdef __GNUC__
-# define strtoul strtol /* gcc library bogosity */
-# endif
-
-# ifdef SUNOS403
- /* special tweaking for SunOS 4.0.3 */
-# include <malloc.h>
-# define BSD4_3 1 /* 4.3 BSD-based */
-# define NEEDSTRSTR 1 /* need emulation of strstr(3) routine */
-# define WAITUNION 1 /* use "union wait" as wait argument type */
-# undef WIFEXITED
-# undef WEXITSTATUS
-# undef HASUNAME
-# define setpgid setpgrp
-# define MODE_T int
-typedef int pid_t;
-extern char *getenv();
-
-# else
- /* 4.1.x specifics */
-# define HASSETSID 1 /* has Posix setsid(2) call */
-# define HASSETVBUF 1 /* we have setvbuf(3) in libc */
-
-# endif
-# endif
-
-# ifndef LA_TYPE
-# define LA_TYPE LA_INT
-# endif
-
-#endif /* sun && !BSD */
-
-/*
-** DG/UX
-**
-** Tested on 5.4.2 and 5.4.3. Use DGUX_5_4_2 to get the
-** older support.
-** 5.4.3 changes from Mark T. Robinson <mtr@ornl.gov>.
-*/
-
-#ifdef DGUX_5_4_2
-# define DGUX 1
-#endif
-
-#ifdef DGUX
-# define SYSTEM5 1
-# define LA_TYPE LA_DGUX
-# define HASSETREUID 1 /* has setreuid(2) call */
-# define HASUNAME 1 /* use System V uname(2) system call */
-# define HASSETSID 1 /* has Posix setsid(2) call */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define IP_SRCROUTE 0 /* does not have <netinet/ip_var.h> */
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) */
-# define HASSNPRINTF 1 /* has snprintf(3) */
-# ifndef IDENTPROTO
-# define IDENTPROTO 0 /* TCP/IP implementation is broken */
-# endif
-# define SPT_TYPE SPT_NONE /* don't use setproctitle */
-# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */
-
-/* these include files must be included early on DG/UX */
-# include <netinet/in.h>
-# include <arpa/inet.h>
-
-/* compiler doesn't understand const? */
-# define const
-
-# ifdef DGUX_5_4_2
-# define inet_addr dgux_inet_addr
-extern long dgux_inet_addr();
-# endif
-#endif
-
-
-/*
-** Digital Ultrix 4.2A or 4.3
-**
-** Apparently, fcntl locking is broken on 4.2A, in that locks are
-** not dropped when the process exits. This causes major problems,
-** so flock is the only alternative.
-*/
-
-#ifdef ultrix
-# define HASSETREUID 1 /* has setreuid(2) call */
-# define HASUNSETENV 1 /* has unsetenv(3) call */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define HASUNAME 1 /* use System V uname(2) system call */
-# define HASFCHMOD 1 /* has fchmod(2) syscall */
-# ifndef HASFLOCK
-# define HASFLOCK 1 /* has flock(2) call */
-# endif
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
-# ifndef BROKEN_RES_SEARCH
-# define BROKEN_RES_SEARCH 1 /* res_search(unknown) returns h_errno=0 */
-# endif
-# ifdef vax
-# define LA_TYPE LA_FLOAT
-# else
-# define LA_TYPE LA_INT
-# define LA_AVENRUN "avenrun"
-# endif
-# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
-# ifndef IDENTPROTO
-# define IDENTPROTO 0 /* pre-4.4 TCP/IP implementation is broken */
-# endif
-# define SYSLOG_BUFSIZE 256
-#endif
-
-
-/*
-** OSF/1 for KSR.
-**
-** Contributed by Todd C. Miller <Todd.Miller@cs.colorado.edu>
-*/
-
-#ifdef __ksr__
-# define __osf__ 1 /* get OSF/1 defines below */
-# ifndef TZ_TYPE
-# define TZ_TYPE TZ_TZNAME /* use tzname[] vector */
-# endif
-#endif
-
-
-/*
-** OSF/1 for Intel Paragon.
-**
-** Contributed by Jeff A. Earickson <jeff@ssd.intel.com>
-** of Intel Scalable Systems Divison.
-*/
-
-#ifdef __PARAGON__
-# define __osf__ 1 /* get OSF/1 defines below */
-# ifndef TZ_TYPE
-# define TZ_TYPE TZ_TZNAME /* use tzname[] vector */
-# endif
-# define GIDSET_T gid_t
-# define MAXNAMLEN NAME_MAX
-#endif
-
-
-/*
-** OSF/1 (tested on Alpha) -- now known as Digital UNIX.
-**
-** Tested for 3.2 and 4.0.
-*/
-
-#ifdef __osf__
-# define HASUNSETENV 1 /* has unsetenv(3) call */
-# define USESETEUID 1 /* has useable seteuid(2) call */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define HASFCHMOD 1 /* has fchmod(2) syscall */
-# define IP_SRCROUTE 1 /* can check IP source routing */
-# define HAS_ST_GEN 1 /* has st_gen field in stat struct */
-# ifndef HASFLOCK
-# define HASFLOCK 1 /* has flock(2) call */
-# endif
-# define LA_TYPE LA_ALPHAOSF
-# define SFS_TYPE SFS_STATVFS /* use <sys/statvfs.h> statfs() impl */
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/var/adm/sendmail/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/var/run/sendmail.pid"
-# endif
-# define bcopy(s, d, l) (memmove((d), (s), (l)))
-# define bzero(d, l) (memset((d), '\0', (l)))
-# define bcmp(s, d, l) (memcmp((s), (d), (l)))
-#endif
-
-
-/*
-** NeXTstep
-*/
-
-#ifdef NeXT
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define NEEDPUTENV 2 /* need putenv(3) call; no setenv(3) call */
-# ifndef HASFLOCK
-# define HASFLOCK 1 /* has flock(2) call */
-# endif
-# define NEEDGETOPT 1 /* need a replacement for getopt(3) */
-# define WAITUNION 1 /* use "union wait" as wait argument type */
-# define UID_T int /* compiler gripes on uid_t */
-# define GID_T int /* ditto for gid_t */
-# define MODE_T int /* and mode_t */
-# define setpgid setpgrp
-# ifndef NOT_SENDMAIL
-# define sleep sleepX
-# endif
-# ifndef LA_TYPE
-# define LA_TYPE LA_MACH
-# endif
-# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
-# ifndef _POSIX_SOURCE
-typedef int pid_t;
-# undef WEXITSTATUS
-# undef WIFEXITED
-# endif
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/etc/sendmail/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/etc/sendmail/sendmail.pid"
-# endif
-
-# ifdef TCPWRAPPERS
-# ifndef HASUNSETENV
-# define HASUNSETENV 1
-# endif
-# undef NEEDPUTENV
-# endif
-
-#endif
-
-/*
-** Apple Rhapsody
-** Contributed by Wilfredo Sanchez <wsanchez@apple.com>
-*/
-
-#ifdef __APPLE__
-# define HASFCHMOD 1 /* has fchmod(2) syscall */
-# define HASFLOCK 1 /* has flock(2) syscall */
-# define HASUNAME 1 /* has uname(2) syscall */
-# define HASUNSETENV 1
-# define HASSETSID 1 /* has the setsid(2) POSIX syscall */
-# define HASINITGROUPS 1
-# define HASSETVBUF 1
-# define HASSETREUID 1
-# define USESETEUID 1 /* has useable seteuid(2) call */
-# define HASLSTAT 1
-# define HASSETRLIMIT 1
-# define HASWAITPID 1
-# define HASSTRERROR 1 /* has strerror(3) */
-# define HASSNPRINTF 1 /* has snprintf(3) and vsnprintf(3) */
-# define USESTRERROR 1 /* has strerror(3) */
-# define HASGETDTABLESIZE 1
-# define HASGETUSERSHELL 1
-# define NEEDGETOPT 1 /* need a replacement for getopt(3) */
-# define BSD4_4_SOCKADDR /* has sa_len */
-# define NETLINK 1 /* supports AF_LINK */
-# define HAS_ST_GEN 1 /* has st_gen field in stat struct */
-# define GIDSET_T gid_t
-# define LA_TYPE LA_SUBR /* use getloadavg(3) */
-# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
-# define SPT_TYPE SPT_PSSTRINGS
-# define SPT_PADCHAR '\0' /* pad process title with nulls */
-# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
-#endif
-
-
-/*
-** 4.4 BSD
-**
-** See also BSD defines.
-*/
-
-#if defined(BSD4_4) && !defined(__bsdi__) && !defined(__GNU__)
-# include <paths.h>
-# define HASUNSETENV 1 /* has unsetenv(3) call */
-# define USESETEUID 1 /* has useable seteuid(2) call */
-# define HASFCHMOD 1 /* has fchmod(2) syscall */
-# define HASSNPRINTF 1 /* has snprintf(3) and vsnprintf(3) */
-# define HASSTRERROR 1 /* has strerror(3) */
-# define HAS_ST_GEN 1 /* has st_gen field in stat struct */
-# include <sys/cdefs.h>
-# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
-# define BSD4_4_SOCKADDR /* has sa_len */
-# define NEED_PRINTF_PERCENTQ 1 /* doesn't have %lld */
-# define NETLINK 1 /* supports AF_LINK */
-# ifndef LA_TYPE
-# define LA_TYPE LA_SUBR
-# endif
-# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
-# define SPT_TYPE SPT_PSSTRINGS /* use PS_STRINGS pointer */
-#endif
-
-
-/*
-** BSD/OS (was BSD/386) (all versions)
-** From Tony Sanders, BSDI
-*/
-
-#ifdef __bsdi__
-# include <paths.h>
-# define HASUNSETENV 1 /* has the unsetenv(3) call */
-# define HASSETSID 1 /* has the setsid(2) POSIX syscall */
-# define USESETEUID 1 /* has useable seteuid(2) call */
-# define HASFCHMOD 1 /* has fchmod(2) syscall */
-# define HASSNPRINTF 1 /* has snprintf(3) and vsnprintf(3) */
-# define HASUNAME 1 /* has uname(2) syscall */
-# define HASSTRERROR 1 /* has strerror(3) */
-# define HAS_ST_GEN 1 /* has st_gen field in stat struct */
-# include <sys/cdefs.h>
-# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
-# define BSD4_4_SOCKADDR /* has sa_len */
-# define NETLINK 1 /* supports AF_LINK */
-# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
-# ifndef LA_TYPE
-# define LA_TYPE LA_SUBR
-# endif
-# define GIDSET_T gid_t
-# define QUAD_T quad_t
-# if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199312
- /* version 1.1 or later */
-# undef SPT_TYPE
-# define SPT_TYPE SPT_BUILTIN /* setproctitle is in libc */
-# else
- /* version 1.0 or earlier */
-# define SPT_PADCHAR '\0' /* pad process title with nulls */
-# endif
-# if defined(_BSDI_VERSION) && _BSDI_VERSION >= 199701 /* on 3.x */
-# define HASSETUSERCONTEXT 1 /* has setusercontext */
-# endif
-#endif
-
-
-/*
-** QNX 4.2x
-** Contributed by Glen McCready <glen@qnx.com>.
-**
-** Should work with all versions of QNX.
-*/
-
-#if defined(__QNX__)
-# include <unix.h>
-# include <sys/select.h>
-# undef NGROUPS_MAX
-# define HASSETSID 1 /* has the setsid(2) POSIX syscall */
-# define USESETEUID 1 /* has useable seteuid(2) call */
-# define HASFCHMOD 1 /* has fchmod(2) syscall */
-# define HASGETDTABLESIZE 1 /* has getdtablesize(2) call */
-# define HASSETREUID 1 /* has setreuid(2) call */
-# define HASSTRERROR 1 /* has strerror(3) */
-# define HASFLOCK 0
-# undef HASINITGROUPS /* has initgroups(3) call */
-# define NEEDGETOPT 1 /* use sendmail's getopt */
-# define IP_SRCROUTE 1 /* can check IP source routing */
-# define TZ_TYPE TZ_TMNAME /* use tmname variable */
-# define GIDSET_T gid_t
-# define LA_TYPE LA_ZERO
-# define SFS_TYPE SFS_NONE
-# define SPT_TYPE SPT_REUSEARGV
-# define SPT_PADCHAR '\0' /* pad process title with nulls */
-# define HASGETUSERSHELL 0
-# define E_PSEUDOBASE 512
-# define bcopy(s, d, l) (memmove((d), (s), (l)))
-# define bzero(d, l) (memset((d), '\0', (l)))
-# define bcmp(s, d, l) (memcmp((s), (d), (l)))
-# define _FILE_H_INCLUDED
-#endif
-
-
-/*
-** FreeBSD / NetBSD / OpenBSD (all architectures, all versions)
-**
-** 4.3BSD clone, closer to 4.4BSD for FreeBSD 1.x and NetBSD 0.9x
-** 4.4BSD-Lite based for FreeBSD 2.x and NetBSD 1.x
-**
-** See also BSD defines.
-*/
-
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
-# include <paths.h>
-# define HASUNSETENV 1 /* has unsetenv(3) call */
-# define HASSETSID 1 /* has the setsid(2) POSIX syscall */
-# define USESETEUID 1 /* has useable seteuid(2) call */
-# define HASFCHMOD 1 /* has fchmod(2) syscall */
-# define HASSNPRINTF 1 /* has snprintf(3) and vsnprintf(3) */
-# define HASUNAME 1 /* has uname(2) syscall */
-# define HASSTRERROR 1 /* has strerror(3) */
-# define HAS_ST_GEN 1 /* has st_gen field in stat struct */
-# define NEED_PRINTF_PERCENTQ 1 /* doesn't have %lld */
-# include <sys/cdefs.h>
-# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
-# define BSD4_4_SOCKADDR /* has sa_len */
-# define NETLINK 1 /* supports AF_LINK */
-# define SAFENFSPATHCONF 1 /* pathconf(2) pessimizes on NFS filesystems */
-# define GIDSET_T gid_t
-# define QUAD_T unsigned long long
-# ifndef LA_TYPE
-# define LA_TYPE LA_SUBR
-# endif
-# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */
-# if defined(__NetBSD__) && (NetBSD > 199307 || NetBSD0_9 > 1)
-# undef SPT_TYPE
-# define SPT_TYPE SPT_BUILTIN /* setproctitle is in libc */
-# endif
-# if defined(__FreeBSD__)
-# undef SPT_TYPE
-# if __FreeBSD__ >= 2
-# include <osreldate.h>
-# if __FreeBSD_version >= 199512 /* 2.2-current when it appeared */
-# include <libutil.h>
-# define SPT_TYPE SPT_BUILTIN
-# endif
-# if __FreeBSD_version >= 222000 /* 2.2.2-release and later */
-# define HASSETUSERCONTEXT 1 /* BSDI-style login classes */
-# endif
-# endif
-# ifndef SPT_TYPE
-# define SPT_TYPE SPT_REUSEARGV
-# define SPT_PADCHAR '\0' /* pad process title with nulls */
-# endif
-# endif
-# if defined(__OpenBSD__)
-# undef SPT_TYPE
-# define SPT_TYPE SPT_BUILTIN /* setproctitle is in libc */
-# endif
-#endif
-
-
-
-/*
-** Mach386
-**
-** For mt Xinu's Mach386 system.
-*/
-
-#if defined(MACH) && defined(i386) && !defined(__GNU__)
-# define MACH386 1
-# define HASUNSETENV 1 /* has unsetenv(3) call */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# ifndef HASFLOCK
-# define HASFLOCK 1 /* has flock(2) call */
-# endif
-# define NEEDGETOPT 1 /* need a replacement for getopt(3) */
-# define NEEDSTRTOL 1 /* need the strtol() function */
-# define setpgid setpgrp
-# ifndef LA_TYPE
-# define LA_TYPE LA_FLOAT
-# endif
-# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
-# undef HASSETVBUF /* don't actually have setvbuf(3) */
-# undef WEXITSTATUS
-# undef WIFEXITED
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/etc/sendmail.pid"
-# endif
-#endif
-
-
-
-/*
-** GNU OS (hurd)
-** Largely BSD & posix compatible.
-** Port contributed by Miles Bader <miles@gnu.ai.mit.edu>.
-*/
-
-#ifdef __GNU_HURD__
-# define SIOCGIFCONF_IS_BROKEN 1
-# define IP_SRCROUTE 0
-# define HASFCHMOD 1
-# define HASFLOCK 1
-# define HASUNAME 1
-# define HASUNSETENV 1
-# define HASSETSID 1
-# define HASINITGROUPS 1
-# define HASSETVBUF 1
-# define HASSETREUID 1
-# define USESETEUID 1
-# define HASLSTAT 1
-# define HASSETRLIMIT 1
-# define HASWAITPID 1
-# define HASGETDTABLESIZE 1
-# define HASSTRERROR 1
-/* # define NEEDGETOPT 1 */
-# define HASGETUSERSHELL 1
-# define ERRLIST_PREDEFINED 1
-# define BSD4_4_SOCKADDR 1
-# define GIDSET_T gid_t
-# define LA_TYPE LA_MACH
-
-/* GNU uses mach[34], which renames some rpcs from mach2.x. */
-# define host_self mach_host_self
-# define SFS_TYPE SFS_STATFS
-# define SPT_TYPE SPT_CHANGEARGV
-
-/* GNU has no MAXPATHLEN; ideally the code should be changed to not use it. */
-# define MAXPATHLEN 2048
-
-/* Define device num frobbing macros. */
-# define major(x) ((x)>>8)
-# define minor(x) ((x)&0xFF)
-#endif /* GNU */
-
-/*
-** 4.3 BSD -- this is for very old systems
-**
-** Should work for mt Xinu MORE/BSD and Mips UMIPS-BSD 2.1.
-**
-** You'll also have to install a new resolver library.
-** I don't guarantee that support for this environment is complete.
-*/
-
-#if defined(oldBSD43) || defined(MORE_BSD) || defined(umipsbsd)
-# define NEEDVPRINTF 1 /* need a replacement for vprintf(3) */
-# define NEEDGETOPT 1 /* need a replacement for getopt(3) */
-# define ARBPTR_T char *
-# define setpgid setpgrp
-# ifndef LA_TYPE
-# define LA_TYPE LA_FLOAT
-# endif
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
-# endif
-# ifndef IDENTPROTO
-# define IDENTPROTO 0 /* TCP/IP implementation is broken */
-# endif
-# undef WEXITSTATUS
-# undef WIFEXITED
-typedef short pid_t;
-extern int errno;
-#endif
-
-
-/*
-** SCO Unix
-**
-** This includes three parts:
-**
-** The first is for SCO OpenServer 5.
-** (Contributed by Keith Reynolds <keithr@sco.COM>).
-**
-** SCO OpenServer 5 has a compiler version number macro,
-** which we can use to figure out what version we're on.
-** This may have to change in future releases.
-**
-** The second is for SCO UNIX 3.2v4.2/Open Desktop 3.0.
-** (Contributed by Philippe Brand <phb@colombo.telesys-innov.fr>).
-**
-** The third is for SCO UNIX 3.2v4.0/Open Desktop 2.0 and earlier.
-*/
-
-/* SCO OpenServer 5 */
-#if _SCO_DS >= 1
-# include <paths.h>
-# define SIOCGIFNUM_IS_BROKEN 1 /* SIOCGIFNUM returns bogus value */
-# define HASSNPRINTF 1 /* has snprintf(3) call */
-# define HASFCHMOD 1 /* has fchmod(2) call */
-# define HASSETRLIMIT 1 /* has setrlimit(2) call */
-# define USESETEUID 1 /* has seteuid(2) call */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define HASGETDTABLESIZE 1 /* has getdtablesize(2) call */
-# define RLIMIT_NEEDS_SYS_TIME_H 1
-# ifndef LA_TYPE
-# define LA_TYPE LA_DEVSHORT
-# endif
-# define _PATH_AVENRUN "/dev/table/avenrun"
-# ifndef _SCO_unix_4_2
-# define _SCO_unix_4_2
-# else
-# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */
-# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */
-# endif
-#endif
-
-/* SCO UNIX 3.2v4.2/Open Desktop 3.0 */
-#ifdef _SCO_unix_4_2
-# define _SCO_unix_
-# define HASSETREUID 1 /* has setreuid(2) call */
-#endif
-
-/* SCO UNIX 3.2v4.0 Open Desktop 2.0 and earlier */
-#ifdef _SCO_unix_
-# include <sys/stream.h> /* needed for IP_SRCROUTE */
-# define SYSTEM5 1 /* include all the System V defines */
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
-# define NOFTRUNCATE 0 /* has (simulated) ftruncate call */
-# define USE_SIGLONGJMP 1 /* sigsetjmp needed for signal handling */
-# define MAXPATHLEN PATHSIZE
-# define SFS_TYPE SFS_4ARGS /* use <sys/statfs.h> 4-arg impl */
-# define SFS_BAVAIL f_bfree /* alternate field name */
-# define SPT_TYPE SPT_SCO /* write kernel u. area */
-# define TZ_TYPE TZ_TM_NAME /* use tm->tm_name */
-# define UID_T uid_t
-# define GID_T gid_t
-# define GIDSET_T gid_t
-# define _PATH_UNIX "/unix"
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/etc/sendmail.pid"
-# endif
-
-/* stuff fixed in later releases */
-# ifndef _SCO_unix_4_2
-# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
-# endif
-
-# ifndef _SCO_DS
-# define ftruncate chsize /* use chsize(2) to emulate ftruncate */
-# define NEEDFSYNC 1 /* needs the fsync(2) call stub */
-# define NETUNIX 0 /* no unix domain socket support */
-# define LA_TYPE LA_SHORT
-# endif
-
-#endif
-
-
-/*
-** ISC (SunSoft) Unix.
-**
-** Contributed by J.J. Bailey <jjb@jagware.bcc.com>
-*/
-
-#ifdef ISC_UNIX
-# include <net/errno.h>
-# include <sys/stream.h> /* needed for IP_SRCROUTE */
-# include <sys/bsdtypes.h>
-# define SYSTEM5 1 /* include all the System V defines */
-# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
-# define HASSETREUID 1 /* has setreuid(2) call */
-# define NEEDFSYNC 1 /* needs the fsync(2) call stub */
-# define NETUNIX 0 /* no unix domain socket support */
-# define MAXPATHLEN 1024
-# define LA_TYPE LA_SHORT
-# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */
-# define SFS_BAVAIL f_bfree /* alternate field name */
-# define _PATH_UNIX "/unix"
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/etc/sendmail.pid"
-# endif
-
-#endif
-
-
-/*
-** Altos System V (5.3.1)
-** Contributed by Tim Rice <tim@trr.metro.net>.
-*/
-
-#ifdef ALTOS_SYSTEM_V
-# include <sys/stream.h>
-# include <limits.h>
-# define SYSTEM5 1 /* include all the System V defines */
-# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
-# define WAITUNION 1 /* use "union wait" as wait argument type */
-# define NEEDFSYNC 1 /* no fsync(2) in system library */
-# define NEEDSTRSTR 1 /* need emulation of the strstr(3) call */
-# define NOFTRUNCATE 1 /* do not have ftruncate(2) */
-# define MAXPATHLEN PATH_MAX
-# define LA_TYPE LA_SHORT
-# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */
-# define SFS_BAVAIL f_bfree /* alternate field name */
-# define TZ_TYPE TZ_TZNAME /* use tzname[] vector */
-# define NETUNIX 0 /* no unix domain socket support */
-# undef WIFEXITED
-# undef WEXITSTATUS
-# define strtoul strtol /* gcc library bogosity */
-
-typedef unsigned short uid_t;
-typedef unsigned short gid_t;
-typedef short pid_t;
-typedef unsigned long mode_t;
-
-/* some stuff that should have been in the include files */
-# include <grp.h>
-extern char *malloc();
-extern struct passwd *getpwent();
-extern struct passwd *getpwnam();
-extern struct passwd *getpwuid();
-extern char *getenv();
-extern struct group *getgrgid();
-extern struct group *getgrnam();
-
-#endif
-
-
-/*
-** ConvexOS 11.0 and later
-**
-** "Todd C. Miller" <millert@mroe.cs.colorado.edu> claims this
-** works on 9.1 as well.
-**
-** ConvexOS 11.5 and later, should work on 11.0 as defined.
-** For pre-ConvexOOS 11.0, define NEEDGETOPT, undef IDENTPROTO
-**
-** Eric Schnoebelen (eric@cirr.com) For CONVEX Computer Corp.
-** (now the CONVEX Technologies Center of Hewlett Packard)
-*/
-
-#ifdef _CONVEX_SOURCE
-# define HASGETDTABLESIZE 1 /* has getdtablesize(2) */
-# define HASINITGROUPS 1 /* has initgroups(3) */
-# define HASUNAME 1 /* use System V uname(2) system call */
-# define HASSETSID 1 /* has POSIX setsid(2) call */
-# define HASUNSETENV 1 /* has unsetenv(3) */
-# define HASFLOCK 1 /* has flock(2) */
-# define HASSETRLIMIT 1 /* has setrlimit(2) */
-# define HASSETREUID 1 /* has setreuid(2) */
-# define BROKEN_RES_SEARCH 1 /* res_search(unknown) returns h_error=0 */
-# define NEEDPUTENV 1 /* needs putenv (written in terms of setenv) */
-# define NEEDGETOPT 0 /* need replacement for getopt(3) */
-# define IP_SRCROUTE 0 /* Something is broken with getsockopt() */
-# define LA_TYPE LA_FLOAT
-# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
-# endif
-# ifndef S_IREAD
-# define S_IREAD _S_IREAD
-# define S_IWRITE _S_IWRITE
-# define S_IEXEC _S_IEXEC
-# define S_IFMT _S_IFMT
-# define S_IFCHR _S_IFCHR
-# define S_IFBLK _S_IFBLK
-# endif
-# ifndef TZ_TYPE
-# define TZ_TYPE TZ_TIMEZONE
-# endif
-# ifndef IDENTPROTO
-# define IDENTPROTO 1
-# endif
-# ifndef SHARE_V1
-# define SHARE_V1 1 /* version 1 of the fair share scheduler */
-# endif
-# if !defined(__GNUC__ )
-# define UID_T int /* GNUC gets it right, ConvexC botches */
-# define GID_T int /* GNUC gets it right, ConvexC botches */
-# endif
-# if SECUREWARE
-# define FORK fork /* SecureWare wants the real fork! */
-# else
-# define FORK vfork /* the rest of the OS versions don't care */
-# endif
-#endif
-
-
-/*
-** RISC/os 4.52
-**
-** Gives a ton of warning messages, but otherwise compiles.
-*/
-
-#ifdef RISCOS
-
-# define HASUNSETENV 1 /* has unsetenv(3) call */
-# ifndef HASFLOCK
-# define HASFLOCK 1 /* has flock(2) call */
-# endif
-# define WAITUNION 1 /* use "union wait" as wait argument type */
-# define NEEDGETOPT 1 /* need a replacement for getopt(3) */
-# define NEEDPUTENV 1 /* need putenv(3) call */
-# define NEEDSTRSTR 1 /* need emulation of the strstr(3) call */
-# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
-# define LA_TYPE LA_INT
-# define LA_AVENRUN "avenrun"
-# define _PATH_UNIX "/unix"
-# undef WIFEXITED
-
-# define setpgid setpgrp
-
-extern int errno;
-typedef int pid_t;
-# define SIGFUNC_DEFINED
-# define SIGFUNC_RETURN (0)
-# define SIGFUNC_DECL int
-typedef int (*sigfunc_t)();
-extern char *getenv();
-extern void *malloc();
-
-/* added for RISC/os 4.01...which is dumber than 4.50 */
-# ifdef RISCOS_4_0
-# ifndef ARBPTR_T
-# define ARBPTR_T char *
-# endif
-# undef HASFLOCK
-# define HASFLOCK 0
-# endif /* RISCOS_4_0 */
-
-# include <sys/time.h>
-
-#endif
-
-
-/*
-** Linux 0.99pl10 and above...
-**
-** Thanks to, in reverse order of contact:
-**
-** John Kennedy <warlock@csuchico.edu>
-** Andrew Pam <avatar@aus.xanadu.com>
-** Florian La Roche <rzsfl@rz.uni-sb.de>
-** Karl London <karl@borg.demon.co.uk>
-**
-** Last compiled against: [07/21/98 @ 11:47:34 AM (Tuesday)]
-** sendmail 8.9.1 bind-8.1.2 db-2.4.14
-** gcc-2.8.1 glibc-2.0.94 linux-2.1.109
-**
-** NOTE: Override HASFLOCK as you will but, as of 1.99.6, mixed-style
-** file locking is no longer allowed. In particular, make sure
-** your DBM library and sendmail are both using either flock(2)
-** *or* fcntl(2) file locking, but not both.
-*/
-
-#ifdef __linux__
-# define BSD 1 /* include BSD defines */
-# define USESETEUID 0 /* Have it due to POSIX, but doesn't work */
-# define NEEDGETOPT 1 /* need a replacement for getopt(3) */
-# define HASUNAME 1 /* use System V uname(2) system call */
-# define HASUNSETENV 1 /* has unsetenv(3) call */
-# ifndef HASSNPRINTF
-# define HASSNPRINTF 1 /* has snprintf(3) and vsnprintf(3) */
-# endif
-# define ERRLIST_PREDEFINED /* don't declare sys_errlist */
-# define GIDSET_T gid_t /* from <linux/types.h> */
-# define HASGETUSERSHELL 0 /* getusershell(3) broken in Slackware 2.0 */
-# define IP_SRCROUTE 0 /* linux <= 1.2.8 doesn't support IP_OPTIONS */
-# define USE_SIGLONGJMP 1 /* sigsetjmp needed for signal handling */
-# ifndef HASFLOCK
-# include <linux/version.h>
-# if LINUX_VERSION_CODE < 66399
-# define HASFLOCK 0 /* flock(2) is broken after 0.99.13 */
-# else
-# define HASFLOCK 1 /* flock(2) fixed after 1.3.95 */
-# endif
-# endif
-# ifndef LA_TYPE
-# define LA_TYPE LA_PROCSTR
-# endif
-# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() impl */
-# define SPT_PADCHAR '\0' /* pad process title with nulls */
-# ifndef TZ_TYPE
-# define TZ_TYPE TZ_NONE /* no standard for Linux */
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/var/run/sendmail.pid"
-# endif
-# include <sys/sysmacros.h>
-# undef atol /* wounded in <stdlib.h> */
-#endif
-
-
-/*
-** DELL SVR4 Issue 2.2, and others
-** From Kimmo Suominen <kim@grendel.lut.fi>
-**
-** It's on #ifdef DELL_SVR4 because Solaris also gets __svr4__
-** defined, and the definitions conflict.
-**
-** Peter Wemm <peter@perth.DIALix.oz.au> claims that the setreuid
-** trick works on DELL 2.2 (SVR4.0/386 version 4.0) and ESIX 4.0.3A
-** (SVR4.0/386 version 3.0).
-*/
-
-#ifdef DELL_SVR4
- /* no changes necessary */
- /* see general __svr4__ defines below */
-#endif
-
-
-/*
-** Apple A/UX 3.0
-*/
-
-#ifdef _AUX_SOURCE
-# include <sys/sysmacros.h>
-# define BSD /* has BSD routines */
-# define HASSETRLIMIT 0 /* ... but not setrlimit(2) */
-# define BROKEN_RES_SEARCH 1 /* res_search(unknown) returns h_errno=0 */
-# define BOGUS_O_EXCL 1 /* exclusive open follows symlinks */
-# define HASUNAME 1 /* use System V uname(2) system call */
-# define HASFCHMOD 1 /* has fchmod(2) syscall */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define HASSETVBUF 1 /* has setvbuf(3) in libc */
-# define HASSTRERROR 1 /* has strerror(3) */
-# define SIGFUNC_DEFINED /* sigfunc_t already defined */
-# define SIGFUNC_RETURN /* POSIX-mode */
-# define SIGFUNC_DECL void /* POSIX-mode */
-# define ERRLIST_PREDEFINED 1
-# ifndef IDENTPROTO
-# define IDENTPROTO 0 /* TCP/IP implementation is broken */
-# endif
-# ifndef LA_TYPE
-# define LA_TYPE LA_INT
-# define FSHIFT 16
-# endif
-# define LA_AVENRUN "avenrun"
-# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
-# define TZ_TYPE TZ_TZNAME
-# ifndef _PATH_UNIX
-# define _PATH_UNIX "/unix" /* should be in <paths.h> */
-# endif
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
-# endif
-# undef WIFEXITED
-# undef WEXITSTATUS
-#endif
-
-
-/*
-** Encore UMAX V
-**
-** Not extensively tested.
-*/
-
-#ifdef UMAXV
-# define HASUNAME 1 /* use System V uname(2) system call */
-# define HASSETVBUF 1 /* we have setvbuf(3) in libc */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
-# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
-# define SYS5SETPGRP 1 /* use System V setpgrp(2) syscall */
-# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */
-# define MAXPATHLEN PATH_MAX
-extern struct passwd *getpwent(), *getpwnam(), *getpwuid();
-extern struct group *getgrent(), *getgrnam(), *getgrgid();
-# undef WIFEXITED
-# undef WEXITSTATUS
-#endif
-
-
-/*
-** Stardent Titan 3000 running TitanOS 4.2.
-**
-** Must be compiled in "cc -43" mode.
-**
-** From Kate Hedstrom <kate@ahab.rutgers.edu>.
-**
-** Note the tweaking below after the BSD defines are set.
-*/
-
-#ifdef titan
-# define setpgid setpgrp
-typedef int pid_t;
-# undef WIFEXITED
-# undef WEXITSTATUS
-#endif
-
-
-/*
-** Sequent DYNIX 3.2.0
-**
-** From Jim Davis <jdavis@cs.arizona.edu>.
-*/
-
-#ifdef sequent
-
-# define BSD 1
-# define HASUNSETENV 1
-# define BSD4_3 1 /* to get signal() in conf.c */
-# define WAITUNION 1
-# define LA_TYPE LA_FLOAT
-# ifdef _POSIX_VERSION
-# undef _POSIX_VERSION /* set in <unistd.h> */
-# endif
-# undef HASSETVBUF /* don't actually have setvbuf(3) */
-# define setpgid setpgrp
-
-/* Have to redefine WIFEXITED to take an int, to work with waitfor() */
-# undef WIFEXITED
-# define WIFEXITED(s) (((union wait*)&(s))->w_stopval != WSTOPPED && \
- ((union wait*)&(s))->w_termsig == 0)
-# define WEXITSTATUS(s) (((union wait*)&(s))->w_retcode)
-typedef int pid_t;
-# define isgraph(c) (isprint(c) && (c != ' '))
-
-# ifndef IDENTPROTO
-# define IDENTPROTO 0 /* TCP/IP implementation is broken */
-# endif
-
-# ifndef _PATH_UNIX
-# define _PATH_UNIX "/dynix"
-# endif
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
-# endif
-#endif
-
-
-/*
-** Sequent DYNIX/ptx v2.0 (and higher)
-**
-** For DYNIX/ptx v1.x, undefine HASSETREUID.
-**
-** From Tim Wright <timw@sequent.com>.
-** Update from Jack Woolley <jwoolley@sctcorp.com>, 26 Dec 1995,
-** for DYNIX/ptx 4.0.2.
-*/
-
-#ifdef _SEQUENT_
-# include <sys/stream.h>
-# define SYSTEM5 1 /* include all the System V defines */
-# define HASSETSID 1 /* has POSIX setsid(2) call */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define HASSETREUID 1 /* has setreuid(2) call */
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
-# define GIDSET_T gid_t
-# define LA_TYPE LA_INT
-# define SFS_TYPE SFS_STATFS /* use <sys/statfs.h> statfs() impl */
-# define SPT_TYPE SPT_NONE /* don't use setproctitle */
-# ifndef IDENTPROTO
-# define IDENTPROTO 0 /* TCP/IP implementation is broken */
-# endif
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/etc/sendmail.pid"
-# endif
-#endif
-
-
-/*
-** Cray Unicos
-**
-** Ported by David L. Kensiski, Sterling Sofware <kensiski@nas.nasa.gov>
-*/
-
-#ifdef UNICOS
-# define SYSTEM5 1 /* include all the System V defines */
-# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
-# define MAXPATHLEN PATHSIZE
-# define LA_TYPE LA_ZERO
-# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */
-# define SFS_BAVAIL f_bfree /* alternate field name */
-#endif
-
-
-/*
-** Apollo DomainOS
-**
-** From Todd Martin <tmartint@tus.ssi1.com> & Don Lewis <gdonl@gv.ssi1.com>
-**
-** 15 Jan 1994; updated 2 Aug 1995
-**
-*/
-
-#ifdef apollo
-# define HASSETREUID 1 /* has setreuid(2) call */
-# define HASINITGROUPS 1 /* has initgroups(2) call */
-# define IP_SRCROUTE 0 /* does not have <netinet/ip_var.h> */
-# define SPT_TYPE SPT_NONE /* don't use setproctitle */
-# define LA_TYPE LA_SUBR /* use getloadavg.c */
-# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */
-# define SFS_BAVAIL f_bfree /* alternate field name */
-# define TZ_TYPE TZ_TZNAME
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/etc/sendmail.pid"
-# endif
-# undef S_IFSOCK /* S_IFSOCK and S_IFIFO are the same */
-# undef S_IFIFO
-# define S_IFIFO 0010000
-# ifndef IDENTPROTO
-# define IDENTPROTO 0 /* TCP/IP implementation is broken */
-# endif
-# define RLIMIT_NEEDS_SYS_TIME_H 1
-# if defined(NGROUPS_MAX) && !NGROUPS_MAX
-# undef NGROUPS_MAX
-# endif
-#endif
-
-/*
-** System V Rel 5.x (a.k.a Unixware7 w/o BSD-Compatiblity Libs ie. native)
-**
-** Contributed by Paul Gampe <paulg@apnic.net>
-*/
-
-#ifdef __svr5__
-# include <sys/mkdev.h>
-# define __svr4__
-# define SYS5SIGNALS 1
-# define HASSETSID 1
-# define HASSETREUID 1
-# define HASWAITPID 1
-# define HASGETDTABLESIZE 1
-# define GIDSET_T gid_t
-# define SOCKADDR_LEN_T size_t
-# define SOCKOPT_LEN_T size_t
-# ifndef _PATH_UNIX
-# define _PATH_UNIX "/stand/unix"
-# endif
-# define SPT_PADCHAR '\0' /* pad process title with nulls */
-# define SYSLOG_BUFSIZE 1024 /* unsure */
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/etc/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/etc/sendmail.pid"
-# endif
-#endif
-
-/* ###################################################################### */
-
-/*
-** UnixWare 2.x
-*/
-
-#ifdef UNIXWARE2
-# define UNIXWARE 1
-# define HASSNPRINTF 1 /* has snprintf(3) and vsnprintf(3) */
-# undef offsetof /* avoid stddefs.h, sys/sysmacros.h conflict */
-#endif
-
-
-/*
-** UnixWare 1.1.2.
-**
-** Updated by Petr Lampa <lampa@fee.vutbr.cz>.
-** From Evan Champion <evanc@spatial.synapse.org>.
-*/
-
-#ifdef UNIXWARE
-# include <sys/mkdev.h>
-# define SYSTEM5 1
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
-# define HASSETREUID 1
-# define HASSETSID 1
-# define HASINITGROUPS 1
-# define GIDSET_T gid_t
-# define SLEEP_T unsigned
-# define SFS_TYPE SFS_STATVFS
-# define LA_TYPE LA_ZERO
-# undef WIFEXITED
-# undef WEXITSTATUS
-# ifndef _PATH_UNIX
-# define _PATH_UNIX "/unix"
-# endif
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/ucblib/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/usr/ucblib/sendmail.pid"
-# endif
-# define SYSLOG_BUFSIZE 128
-#endif
-
-
-/*
-** Intergraph CLIX 3.1
-**
-** From Paul Southworth <pauls@locust.cic.net>
-*/
-
-#ifdef CLIX
-# define SYSTEM5 1 /* looks like System V */
-# ifndef HASGETUSERSHELL
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
-# endif
-# define DEV_BSIZE 512 /* device block size not defined */
-# define GIDSET_T gid_t
-# undef LOG /* syslog not available */
-# define NEEDFSYNC 1 /* no fsync in system library */
-# define GETSHORT _getshort
-#endif
-
-
-/*
-** NCR MP-RAS 2.x (SysVr4) with Wollongong TCP/IP
-**
-** From Kevin Darcy <kevin@tech.mis.cfc.com>.
-*/
-
-#ifdef NCR_MP_RAS2
-# include <sys/sockio.h>
-# define __svr4__
-# define IP_SRCROUTE 0 /* Something is broken with getsockopt() */
-# define SYSLOG_BUFSIZE 1024
-# define SPT_TYPE SPT_NONE
-#endif
-
-
-/*
-** NCR MP-RAS 3.x (SysVr4) with STREAMware TCP/IP
-**
-** From Tom Moore <Tom.Moore@DaytonOH.NCR.COM>
-*/
-
-#ifdef NCR_MP_RAS3
-# define __svr4__
-# define SIOCGIFNUM_IS_BROKEN 1 /* SIOCGIFNUM has non-std interface */
-# define SYSLOG_BUFSIZE 1024
-# define SPT_TYPE SPT_NONE
-#endif
-
-
-/*
-** Tandem NonStop-UX SVR4
-**
-** From Rick McCarty <mccarty@mpd.tandem.com>.
-*/
-
-#ifdef NonStop_UX_BXX
-# define __svr4__
-#endif
-
-
-/*
-** Hitachi 3050R & 3050RX Workstations running HI-UX/WE2.
-**
-** Tested for 1.04 and 1.03
-** From Akihiro Hashimoto ("Hash") <hash@dominic.ipc.chiba-u.ac.jp>.
-*/
-
-#ifdef __H3050R
-# define SYSTEM5 1 /* include all the System V defines */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define setreuid(r, e) setresuid(r, e, -1)
-# define LA_TYPE LA_FLOAT
-# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
-# define HASSETVBUF /* HI-UX has no setlinebuf */
-# ifndef GIDSET_T
-# define GIDSET_T gid_t
-# endif
-# ifndef _PATH_UNIX
-# define _PATH_UNIX "/HI-UX"
-# endif
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
-# endif
-# ifndef IDENTPROTO
-# define IDENTPROTO 0 /* TCP/IP implementation is broken */
-# endif
-# ifndef HASGETUSERSHELL
-# define HASGETUSERSHELL 0 /* getusershell(3) causes core dumps */
-# endif
-
-/*
-** avoid m_flags conflict between Berkeley DB 1.85 db.h & sys/sysmacros.h
-** on HIUX 3050
-*/
-# undef m_flags
-
-# ifdef __STDC__
-extern int syslog(int, char *, ...);
-#else
-extern int syslog();
-# endif
-
-#endif
-
-
-/*
-** Amdahl UTS System V 2.1.5 (SVr3-based)
-**
-** From: Janet Jackson <janet@dialix.oz.au>.
-*/
-
-#ifdef _UTS
-# include <sys/sysmacros.h>
-# undef HASLSTAT /* has symlinks, but they cause problems */
-# define NEEDFSYNC 1 /* system fsync(2) fails on non-EFS filesys */
-# define SYS5SIGNALS 1 /* System V signal semantics */
-# define SYS5SETPGRP 1 /* use System V setpgrp(2) syscall */
-# define HASUNAME 1 /* use System V uname(2) system call */
-# define HASINITGROUPS 1 /* has initgroups(3) function */
-# define HASSETVBUF 1 /* has setvbuf(3) function */
-# ifndef HASGETUSERSHELL
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) function */
-# endif
-# define GIDSET_T gid_t /* type of 2nd arg to getgroups(2) isn't int */
-# define LA_TYPE LA_ZERO /* doesn't have load average */
-# define SFS_TYPE SFS_4ARGS /* use 4-arg statfs() */
-# define SFS_BAVAIL f_bfree /* alternate field name */
-# define _PATH_UNIX "/unix"
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
-# endif
-#endif
-
-/*
-** Cray Computer Corporation's CSOS
-**
-** From Scott Bolte <scott@craycos.com>.
-*/
-
-#ifdef _CRAYCOM
-# define SYSTEM5 1 /* include all the System V defines */
-# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
-# define NEEDFSYNC 1 /* no fsync in system library */
-# define MAXPATHLEN PATHSIZE
-# define LA_TYPE LA_ZERO
-# define SFS_TYPE SFS_4ARGS /* four argument statfs() call */
-# define SFS_BAVAIL f_bfree /* alternate field name */
-# define _POSIX_CHOWN_RESTRICTED -1
-extern struct group *getgrent(), *getgrnam(), *getgrgid();
-#endif
-
-
-/*
-** Sony NEWS-OS 4.2.1R and 6.0.3
-**
-** From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
-*/
-
-#ifdef sony_news
-# ifndef __svr4
- /* NEWS-OS 4.2.1R */
-# ifndef BSD
-# define BSD /* has BSD routines */
-# endif
-# define HASUNSETENV 1 /* has unsetenv(2) call */
-# undef HASSETVBUF /* don't actually have setvbuf(3) */
-# define WAITUNION 1 /* use "union wait" as wait argument type */
-# define LA_TYPE LA_INT
-# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
-# ifndef HASFLOCK
-# define HASFLOCK 1 /* has flock(2) call */
-# endif
-# define setpgid setpgrp
-# undef WIFEXITED
-# undef WEXITSTATUS
-# define MODE_T int /* system include files have no mode_t */
-typedef int pid_t;
-typedef int (*sigfunc_t)();
-# define SIGFUNC_DEFINED
-# define SIGFUNC_RETURN (0)
-# define SIGFUNC_DECL int
-
-# else
- /* NEWS-OS 6.0.3 with /bin/cc */
-# ifndef __svr4__
-# define __svr4__ /* use all System V Releae 4 defines below */
-# endif
-# define HASSETSID 1 /* has Posix setsid(2) call */
-# define HASGETUSERSHELL 1 /* DOES have getusershell(3) call in libc */
-# define LA_TYPE LA_READKSYM /* use MIOC_READKSYM ioctl */
-# ifndef SPT_TYPE
-# define SPT_TYPE SPT_SYSMIPS /* use sysmips() (OS 6.0.2 or later) */
-# endif
-# define GIDSET_T gid_t
-# undef WIFEXITED
-# undef WEXITSTATUS
-# ifndef SYSLOG_BUFSIZE
-# define SYSLOG_BUFSIZE 1024
-# endif
-# define _PATH_UNIX "/stand/unix"
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/etc/mail/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/etc/mail/sendmail.pid"
-# endif
-
-# endif
-#endif
-
-
-/*
-** Omron LUNA/UNIOS-B 3.0, LUNA2/Mach and LUNA88K Mach
-**
-** From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
-*/
-
-#ifdef luna
-# ifndef IDENTPROTO
-# define IDENTPROTO 0 /* TCP/IP implementation is broken */
-# endif
-# define HASUNSETENV 1 /* has unsetenv(2) call */
-# define NEEDPUTENV 1 /* need putenv(3) call */
-# define NEEDGETOPT 1 /* need a replacement for getopt(3) */
-# define NEEDSTRSTR 1 /* need emulation of the strstr(3) call */
-# define WAITUNION 1 /* use "union wait" as wait argument type */
-# ifdef uniosb
-# include <sys/time.h>
-# define NEEDVPRINTF 1 /* need a replacement for vprintf(3) */
-# define LA_TYPE LA_INT
-# define TZ_TYPE TZ_TM_ZONE /* use tm->tm_zone */
-# endif
-# ifdef luna2
-# define LA_TYPE LA_SUBR
-# define TZ_TYPE TZ_TM_ZONE /* use tm->tm_zone */
-# endif
-# ifdef luna88k
-# define HASSNPRINTF 1 /* has snprintf(3) and vsnprintf(3) */
-# define LA_TYPE LA_INT
-# endif
-# define SFS_TYPE SFS_VFS /* use <sys/vfs.h> statfs() implementation */
-# define setpgid setpgrp
-# undef WIFEXITED
-# undef WEXITSTATUS
-typedef int pid_t;
-typedef int (*sigfunc_t)();
-# define SIGFUNC_DEFINED
-# define SIGFUNC_RETURN (0)
-# define SIGFUNC_DECL int
-extern char *getenv();
-extern int errno;
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/lib/sendmail.cf"
-# endif
-#endif
-
-
-/*
-** NEC EWS-UX/V 4.2 (with /usr/ucb/cc)
-**
-** From Motonori NAKAMURA <motonori@cs.ritsumei.ac.jp>.
-*/
-
-#if defined(nec_ews_svr4) || defined(_nec_ews_svr4)
-# ifndef __svr4__
-# define __svr4__ /* use all System V Releae 4 defines below */
-# endif
-# define SYS5SIGNALS 1 /* SysV signal semantics -- reset on each sig */
-# define HASSETSID 1 /* has Posix setsid(2) call */
-# define LA_TYPE LA_READKSYM /* use MIOC_READSYM ioctl */
-# define SFS_TYPE SFS_USTAT /* use System V ustat(2) syscall */
-# define GIDSET_T gid_t
-# undef WIFEXITED
-# undef WEXITSTATUS
-# define NAMELISTMASK 0x7fffffff /* mask for nlist() values */
-# ifndef SYSLOG_BUFSIZE
-# define SYSLOG_BUFSIZE 1024 /* allow full size syslog buffer */
-# endif
-#endif
-
-
-/*
-** Fujitsu/ICL UXP/DS (For the DS/90 Series)
-**
-** From Diego R. Lopez <drlopez@cica.es>.
-** Additional changes from Fumio Moriya and Toshiaki Nomura of the
-** Fujitsu Fresoftware gruop <dsfrsoft@oai6.yk.fujitsu.co.jp>.
-*/
-
-#ifdef __uxp__
-# include <arpa/nameser.h>
-# include <sys/sysmacros.h>
-# include <sys/mkdev.h>
-# define __svr4__
-# define HASGETUSERSHELL 0
-# define HASFLOCK 0
-# if UXPDS == 10
-# define HASSNPRINTF 0 /* no snprintf(3) or vsnprintf(3) */
-# else
-# define HASSNPRINTF 1 /* has snprintf(3) and vsnprintf(3) */
-# endif
-# define _PATH_UNIX "/stand/unix"
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/ucblib/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/usr/ucblib/sendmail.pid"
-# endif
-#endif
-
-/*
-** Pyramid DC/OSx
-**
-** From Earle Ake <akee@wpdiss1.wpafb.af.mil>.
-*/
-
-#ifdef DCOSx
-# define GIDSET_T gid_t
-# ifndef IDENTPROTO
-# define IDENTPROTO 0 /* TCP/IP implementation is broken */
-# endif
-#endif
-
-/*
-** Concurrent Computer Corporation Maxion
-**
-** From Donald R. Laster Jr. <laster@access.digex.net>.
-*/
-
-#ifdef __MAXION__
-
-# include <sys/stream.h>
-# define __svr4__ 1 /* SVR4.2MP */
-# define HASSETREUID 1 /* have setreuid(2) */
-# define HASLSTAT 1 /* have lstat(2) */
-# define HASSETRLIMIT 1 /* have setrlimit(2) */
-# define HASGETDTABLESIZE 1 /* have getdtablesize(2) */
-# define HASSNPRINTF 1 /* have snprintf(3) */
-# define HASGETUSERSHELL 1 /* have getusershell(3) */
-# define NOFTRUNCATE 1 /* do not have ftruncate(2) */
-# define SLEEP_T unsigned
-# define SFS_TYPE SFS_STATVFS
-# define SFS_BAVAIL f_bavail
-# ifndef SYSLOG_BUFSIZE
-# define SYSLOG_BUFSIZE 256 /* Use 256 bytes */
-# endif
-
-# undef WUNTRACED
-# undef WIFEXITED
-# undef WIFSIGNALED
-# undef WIFSTOPPED
-# undef WEXITSTATUS
-# undef WTERMSIG
-# undef WSTOPSIG
-
-#endif
-
-/*
-** Harris Nighthawk PowerUX (nh6000 box)
-**
-** Contributed by Bob Miorelli, Pratt & Whitney <miorelli@pweh.com>
-*/
-
-#ifdef _PowerUX
-# ifndef __svr4__
-# define __svr4__
-# endif
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/etc/mail/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/etc/mail/sendmail.pid"
-# endif
-# define SYSLOG_BUFSIZE 1024
-# define HASSNPRINTF 1 /* has snprintf(3) and vsnprintf(3) */
-# define LA_TYPE LA_ZERO
-typedef struct msgb mblk_t;
-# undef offsetof /* avoid stddefs.h and sys/sysmacros.h conflict */
-#endif
-
-/*
-** Siemens Nixdorf Informationssysteme AG SINIX
-**
-** Contributed by Gerald Rinske <Gerald.Rinske@mch.sni.de>
-** of Siemens Business Services VAS.
-*/
-#ifdef sinix
-# define SYSLOG_BUFSIZE 1024
-#endif
-
-/*
-** CRAY T3E
-**
-** Contributed by Manu Mahonen <mailadm@csc.fi>
-** of Center for Scientific Computing.
-*/
-#ifdef _CRAY
-# define GET_IPOPT_DST(dst) *(struct in_addr *)&(dst)
-#endif
-
-/**********************************************************************
-** End of Per-Operating System defines
-**********************************************************************/
-\f/**********************************************************************
-** More general defines
-**********************************************************************/
-
-/* general BSD defines */
-#ifdef BSD
-# define HASGETDTABLESIZE 1 /* has getdtablesize(2) call */
-# define HASSETREUID 1 /* has setreuid(2) call */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# ifndef IP_SRCROUTE
-# define IP_SRCROUTE 1 /* can check IP source routing */
-# endif
-# ifndef HASSETRLIMIT
-# define HASSETRLIMIT 1 /* has setrlimit(2) call */
-# endif
-# ifndef HASFLOCK
-# define HASFLOCK 1 /* has flock(2) call */
-# endif
-# ifndef TZ_TYPE
-# define TZ_TYPE TZ_TM_ZONE /* use tm->tm_zone variable */
-# endif
-#endif
-
-/* general System V Release 4 defines */
-#ifdef __svr4__
-# define SYSTEM5 1
-# define USESETEUID 1 /* has useable seteuid(2) call */
-# define HASINITGROUPS 1 /* has initgroups(3) call */
-# define BSD_COMP 1 /* get BSD ioctl calls */
-# ifndef HASSETRLIMIT
-# define HASSETRLIMIT 1 /* has setrlimit(2) call */
-# endif
-# ifndef HASGETUSERSHELL
-# define HASGETUSERSHELL 0 /* does not have getusershell(3) call */
-# endif
-# ifndef HASFCHMOD
-# define HASFCHMOD 1 /* most (all?) SVr4s seem to have fchmod(2) */
-# endif
-
-# ifndef _PATH_UNIX
-# define _PATH_UNIX "/unix"
-# endif
-# ifndef _PATH_VENDOR_CF
-# define _PATH_VENDOR_CF "/usr/ucblib/sendmail.cf"
-# endif
-# ifndef _PATH_SENDMAILPID
-# define _PATH_SENDMAILPID "/usr/ucblib/sendmail.pid"
-# endif
-# ifndef SYSLOG_BUFSIZE
-# define SYSLOG_BUFSIZE 128
-# endif
-# ifndef SFS_TYPE
-# define SFS_TYPE SFS_STATVFS
-# endif
-
-# define USE_SIGLONGJMP 1 /* sigsetjmp needed for signal handling */
-#endif
-
-/* general System V defines */
-#ifdef SYSTEM5
-# include <sys/sysmacros.h>
-# define HASUNAME 1 /* use System V uname(2) system call */
-# define SYS5SETPGRP 1 /* use System V setpgrp(2) syscall */
-# define HASSETVBUF 1 /* we have setvbuf(3) in libc */
-# ifndef HASULIMIT
-# define HASULIMIT 1 /* has the ulimit(2) syscall */
-# endif
-# ifndef LA_TYPE
-# ifdef MIOC_READKSYM
-# define LA_TYPE LA_READKSYM /* use MIOC_READKSYM ioctl */
-# else
-# define LA_TYPE LA_INT /* assume integer load average */
-# endif
-# endif
-# ifndef SFS_TYPE
-# define SFS_TYPE SFS_USTAT /* use System V ustat(2) syscall */
-# endif
-# ifndef TZ_TYPE
-# define TZ_TYPE TZ_TZNAME /* use tzname[] vector */
-# endif
-# define bcopy(s, d, l) (memmove((d), (s), (l)))
-# define bzero(d, l) (memset((d), '\0', (l)))
-# define bcmp(s, d, l) (memcmp((s), (d), (l)))
-#endif
-
-/* general POSIX defines */
-#ifdef _POSIX_VERSION
-# define HASSETSID 1 /* has Posix setsid(2) call */
-# define HASWAITPID 1 /* has Posix waitpid(2) call */
-# if _POSIX_VERSION >= 199500 && !defined(USESETEUID)
-# define USESETEUID 1 /* has useable seteuid(2) call */
-# endif
-# ifndef bcopy
-# define bcopy(s, d, l) (memmove((d), (s), (l)))
-# define bzero(d, l) (memset((d), '\0', (l)))
-# define bcmp(s, d, l) (memcmp((s), (d), (l)))
-# endif
-#endif
-\f/*
-** Tweaking for systems that (for example) claim to be BSD or POSIX
-** but don't have all the standard BSD or POSIX routines (boo hiss).
-*/
-
-#ifdef titan
-# undef HASINITGROUPS /* doesn't have initgroups(3) call */
-#endif
-
-#ifdef _CRAYCOM
-# undef HASSETSID /* despite POSIX claim, doesn't have setsid */
-#endif
-
-#ifdef ISC_UNIX
-# undef bcopy /* despite SystemV claim, uses BSD bcopy */
-#endif
-
-#ifdef ALTOS_SYSTEM_V
-# undef bcopy /* despite SystemV claim, uses BSD bcopy */
-# undef bzero /* despite SystemV claim, uses BSD bzero */
-# undef bcmp /* despite SystemV claim, uses BSD bcmp */
-#endif
-
-#if defined(sun) && !defined(BSD) && !defined(SOLARIS) && !defined(__svr4__) && !defined(__SVR4)
-# undef bcopy /* SunOS 4 doesn't have memmove() */
-#endif
-
-
-/*
-** Due to a "feature" in some operating systems such as Ultrix 4.3 and
-** HPUX 8.0, if you receive a "No route to host" message (ICMP message
-** ICMP_UNREACH_HOST) on _any_ connection, all connections to that host
-** are closed. Some firewalls return this error if you try to connect
-** to the IDENT port (113), so you can't receive email from these hosts
-** on these systems. The firewall really should use a more specific
-** message such as ICMP_UNREACH_PROTOCOL or _PORT or _FILTER_PROHIB. If
-** not explicitly set to zero above, default it on.
-*/
-
-#ifndef IDENTPROTO
-# define IDENTPROTO 1 /* use IDENT proto (RFC 1413) */
-#endif
-
-#ifndef IP_SRCROUTE
-# define IP_SRCROUTE 1 /* Detect IP source routing */
-#endif
-
-#ifndef HASGETUSERSHELL
-# define HASGETUSERSHELL 1 /* libc has getusershell(3) call */
-#endif
-
-#ifndef NETUNIX
-# define NETUNIX 1 /* include unix domain support */
-#endif
-
-#ifndef HASFLOCK
-# define HASFLOCK 0 /* assume no flock(2) support */
-#endif
-
-#ifndef HASSETREUID
-# define HASSETREUID 0 /* assume no setreuid(2) call */
-#endif
-
-#ifndef HASFCHMOD
-# define HASFCHMOD 0 /* assume no fchmod(2) syscall */
-#endif
-
-#ifndef USESETEUID
-# define USESETEUID 0 /* assume no seteuid(2) call or no saved ids */
-#endif
-
-#ifndef HASSETRLIMIT
-# define HASSETRLIMIT 0 /* assume no setrlimit(2) support */
-#endif
-
-#ifndef HASULIMIT
-# define HASULIMIT 0 /* assume no ulimit(2) support */
-#endif
-
-#ifndef SECUREWARE
-# define SECUREWARE 0 /* assume no SecureWare C2 auditing hooks */
-#endif
-
-#ifndef USE_SIGLONGJMP
-# define USE_SIGLONGJMP 0 /* assume setjmp handles signals properly */
-#endif
-
-#ifndef FDSET_CAST
-# define FDSET_CAST /* (empty) cast for fd_set arg to select */
-#endif
-
-/*
-** If no type for argument two of getgroups call is defined, assume
-** it's an integer -- unfortunately, there seem to be several choices
-** here.
-*/
-
-#ifndef GIDSET_T
-# define GIDSET_T int
-#endif
-
-#ifndef UID_T
-# define UID_T uid_t
-#endif
-
-#ifndef GID_T
-# define GID_T gid_t
-#endif
-
-#ifndef SIZE_T
-# define SIZE_T size_t
-#endif
-
-#ifndef MODE_T
-# define MODE_T mode_t
-#endif
-
-#ifndef ARGV_T
-# define ARGV_T char **
-#endif
-
-#ifndef SOCKADDR_LEN_T
-# define SOCKADDR_LEN_T int
-#endif
-
-#ifndef SOCKOPT_LEN_T
-# define SOCKOPT_LEN_T int
-#endif
-
-#ifndef QUAD_T
-# define QUAD_T unsigned long
-#endif
-\f/**********************************************************************
-** Remaining definitions should never have to be changed. They are
-** primarily to provide back compatibility for older systems -- for
-** example, it includes some POSIX compatibility definitions
-**********************************************************************/
-
-/* System 5 compatibility */
-#ifndef S_ISREG
-# define S_ISREG(foo) ((foo & S_IFMT) == S_IFREG)
-#endif
-#ifndef S_ISDIR
-# define S_ISDIR(foo) ((foo & S_IFMT) == S_IFDIR)
-#endif
-#if !defined(S_ISLNK) && defined(S_IFLNK)
-# define S_ISLNK(foo) ((foo & S_IFMT) == S_IFLNK)
-#endif
-#ifndef S_IRUSR
-# define S_IRUSR 0400
-#endif
-#ifndef S_IWUSR
-# define S_IWUSR 0200
-#endif
-#ifndef S_IRGRP
-# define S_IRGRP 0040
-#endif
-#ifndef S_IWGRP
-# define S_IWGRP 0020
-#endif
-#ifndef S_IROTH
-# define S_IROTH 0004
-#endif
-#ifndef S_IWOTH
-# define S_IWOTH 0002
-#endif
-
-/*
-** Older systems don't have this error code -- it should be in
-** /usr/include/sysexits.h.
-*/
-
-# ifndef EX_CONFIG
-# define EX_CONFIG 78 /* configuration error */
-# endif
-
-/* pseudo-code used in server SMTP */
-# define EX_QUIT 22 /* drop out of server immediately */
-
-/* pseudo-code used for mci_setstat */
-# define EX_NOTSTICKY -5 /* don't save persistent status */
-
-
-/*
-** An "impossible" file mode to indicate that the file does not exist.
-*/
-
-#define ST_MODE_NOFILE 0171147 /* unlikely to occur */
-
-
-/*
-** These are used in a few cases where we need some special
-** error codes, but where the system doesn't provide something
-** reasonable. They are printed in errstring.
-*/
-
-#ifndef E_PSEUDOBASE
-# define E_PSEUDOBASE 256
-#endif
-
-#define E_SM_OPENTIMEOUT (E_PSEUDOBASE + 0) /* Timeout on file open */
-#define E_SM_NOSLINK (E_PSEUDOBASE + 1) /* Symbolic links not allowed */
-#define E_SM_NOHLINK (E_PSEUDOBASE + 2) /* Hard links not allowed */
-#define E_SM_REGONLY (E_PSEUDOBASE + 3) /* Regular files only */
-#define E_SM_ISEXEC (E_PSEUDOBASE + 4) /* Executable files not allowed */
-#define E_SM_WWDIR (E_PSEUDOBASE + 5) /* World writable directory */
-#define E_SM_GWDIR (E_PSEUDOBASE + 6) /* Group writable directory */
-#define E_SM_FILECHANGE (E_PSEUDOBASE + 7) /* File changed after open */
-#define E_SM_WWFILE (E_PSEUDOBASE + 8) /* World writable file */
-#define E_SM_GWFILE (E_PSEUDOBASE + 9) /* Group writable file */
-#define E_DNSBASE (E_PSEUDOBASE + 20) /* base for DNS h_errno */
-
-/* type of arbitrary pointer */
-#ifndef ARBPTR_T
-# define ARBPTR_T void *
-#endif
-
-#ifndef __P
-# include "cdefs.h"
-#endif
-
-#if HESIOD && !defined(NAMED_BIND)
-# define NAMED_BIND 1 /* not one without the other */
-#endif
-
-#if NAMED_BIND && !defined(__ksr__) && !defined(h_errno)
-extern int h_errno;
-#endif
-
-/*
-** Do some required dependencies
-*/
-
-#if NETINET || NETISO
-# ifndef SMTP
-# define SMTP 1 /* enable user and server SMTP */
-# endif
-# ifndef QUEUE
-# define QUEUE 1 /* enable queueing */
-# endif
-# ifndef DAEMON
-# define DAEMON 1 /* include the daemon (requires IPC & SMTP) */
-# endif
-#endif
-
-
-/*
-** Arrange to use either varargs or stdargs
-*/
-
-# ifdef __STDC__
-
-# include <stdarg.h>
-
-# define VA_LOCAL_DECL va_list ap;
-# define VA_START(f) va_start(ap, f)
-# define VA_END va_end(ap)
-
-# else
-
-# include <varargs.h>
-
-# define VA_LOCAL_DECL va_list ap;
-# define VA_START(f) va_start(ap)
-# define VA_END va_end(ap)
-
-# endif
-
-#ifdef HASUNAME
-# include <sys/utsname.h>
-# ifdef newstr
-# undef newstr
-# endif
-#else /* ! HASUNAME */
-# define NODE_LENGTH 32
-struct utsname
-{
- char nodename[NODE_LENGTH+1];
-};
-#endif /* HASUNAME */
-
-#if !defined(MAXHOSTNAMELEN) && !defined(_SCO_unix_) && !defined(NonStop_UX_BXX) && !defined(ALTOS_SYSTEM_V)
-# define MAXHOSTNAMELEN 256
-#endif
-
-#if !defined(SIGCHLD) && defined(SIGCLD)
-# define SIGCHLD SIGCLD
-#endif
-
-#ifndef STDIN_FILENO
-# define STDIN_FILENO 0
-#endif
-
-#ifndef STDOUT_FILENO
-# define STDOUT_FILENO 1
-#endif
-
-#ifndef STDERR_FILENO
-# define STDERR_FILENO 2
-#endif
-
-#ifndef LOCK_SH
-# define LOCK_SH 0x01 /* shared lock */
-# define LOCK_EX 0x02 /* exclusive lock */
-# define LOCK_NB 0x04 /* non-blocking lock */
-# define LOCK_UN 0x08 /* unlock */
-#endif
-
-#ifndef S_IXOTH
-# define S_IXOTH (S_IEXEC >> 6)
-#endif
-
-#ifndef S_IXGRP
-# define S_IXGRP (S_IEXEC >> 3)
-#endif
-
-#ifndef S_IXUSR
-# define S_IXUSR (S_IEXEC)
-#endif
-
-#ifndef SEEK_SET
-# define SEEK_SET 0
-# define SEEK_CUR 1
-# define SEEK_END 2
-#endif
-
-#ifndef SIG_ERR
-# define SIG_ERR ((void (*)()) -1)
-#endif
-
-#ifndef WEXITSTATUS
-# define WEXITSTATUS(st) (((st) >> 8) & 0377)
-#endif
-#ifndef WIFEXITED
-# define WIFEXITED(st) (((st) & 0377) == 0)
-#endif
-
-#ifndef SIGFUNC_DEFINED
-typedef void (*sigfunc_t) __P((int));
-#endif
-#ifndef SIGFUNC_RETURN
-# define SIGFUNC_RETURN
-#endif
-#ifndef SIGFUNC_DECL
-# define SIGFUNC_DECL void
-#endif
-
-/* size of syslog buffer */
-#ifndef SYSLOG_BUFSIZE
-# define SYSLOG_BUFSIZE 1024
-#endif
-
-/*
-** Size of prescan buffer.
-** Despite comments in the _sendmail_ book, this probably should
-** not be changed; there are some hard-to-define dependencies.
-*/
-
-# define PSBUFSIZE (MAXNAME + MAXATOM) /* size of prescan buffer */
-
-/* fork routine -- set above using #ifdef _osname_ or in Makefile */
-# ifndef FORK
-# define FORK fork /* function to call to fork mailer */
-# endif
-
-/*
-** Default to using scanf in readcf.
-*/
-
-#ifndef SCANF
-# define SCANF 1
-#endif
-
-/*
-** SVr4 and similar systems use different routines for setjmp/longjmp
-** with signal support
-*/
-
-#if USE_SIGLONGJMP
-# ifdef jmp_buf
-# undef jmp_buf
-# endif
-# define jmp_buf sigjmp_buf
-# ifdef setjmp
-# undef setjmp
-# endif
-# define setjmp(env) sigsetjmp(env, 1)
-# ifdef longjmp
-# undef longjmp
-# endif
-# define longjmp(env, val) siglongjmp(env, val)
-#endif
-
-#if !defined(NGROUPS_MAX) && defined(NGROUPS)
-# define NGROUPS_MAX NGROUPS /* POSIX naming convention */
-#endif
-
-/*
-** If we don't have a system syslog, simulate it.
-*/
-
-#if !LOG
-# define LOG_EMERG 0 /* system is unusable */
-# define LOG_ALERT 1 /* action must be taken immediately */
-# define LOG_CRIT 2 /* critical conditions */
-# define LOG_ERR 3 /* error conditions */
-# define LOG_WARNING 4 /* warning conditions */
-# define LOG_NOTICE 5 /* normal but significant condition */
-# define LOG_INFO 6 /* informational */
-# define LOG_DEBUG 7 /* debug-level messages */
-#endif
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)control.c 8.18 (Berkeley) 1/17/1999";
-#endif /* not lint */
-
-#include "sendmail.h"
-
-int ControlSocket = -1;
-
-\f/*
-** OPENCONTROLSOCKET -- create/open the daemon control named socket
-**
-** Creates and opens a named socket for external control over
-** the sendmail daemon.
-**
-** Parameters:
-** none.
-**
-** Returns:
-** 0 if successful, -1 otherwise
-*/
-
-int
-opencontrolsocket()
-{
-#ifdef NETUNIX
-# if _FFR_CONTROL_SOCKET
- int rval;
- int sff = SFF_SAFEDIRPATH|SFF_OPENASROOT|SFF_NOLINK|SFF_CREAT|SFF_MUSTOWN;
- struct sockaddr_un controladdr;
-
- if (ControlSocketName == NULL)
- return 0;
-
- if (strlen(ControlSocketName) >= sizeof controladdr.sun_path)
- {
- errno = ENAMETOOLONG;
- return -1;
- }
-
- rval = safefile(ControlSocketName, RunAsUid, RunAsGid, RunAsUserName,
- sff, S_IRUSR|S_IWUSR, NULL);
-
- /* if not safe, don't create */
- if (rval != 0)
- {
- errno = rval;
- return -1;
- }
-
- ControlSocket = socket(AF_UNIX, SOCK_STREAM, 0);
- if (ControlSocket < 0)
- return -1;
-
- unlink(ControlSocketName);
- bzero(&controladdr, sizeof controladdr);
- controladdr.sun_family = AF_UNIX;
- strcpy(controladdr.sun_path, ControlSocketName);
-
- if (bind(ControlSocket, (struct sockaddr *) &controladdr,
- sizeof controladdr) < 0)
- {
- int save_errno = errno;
-
- clrcontrol();
- errno = save_errno;
- return -1;
- }
-
-# if _FFR_TRUSTED_USER
- if (geteuid() == 0 && TrustedUid != 0)
- {
- if (chown(ControlSocketName, TrustedUid, -1) < 0)
- {
- int save_errno = errno;
-
- sm_syslog(LOG_ALERT, NOQID,
- "ownership change on %s failed: %s",
- ControlSocketName, errstring(save_errno));
- message("050 ownership change on %s failed: %s",
- ControlSocketName, errstring(save_errno));
- closecontrolsocket(TRUE);
- errno = save_errno;
- return -1;
- }
- }
-# endif
-
- if (chmod(ControlSocketName, S_IRUSR|S_IWUSR) < 0)
- {
- int save_errno = errno;
-
- closecontrolsocket(TRUE);
- errno = save_errno;
- return -1;
- }
-
- if (listen(ControlSocket, 8) < 0)
- {
- int save_errno = errno;
-
- closecontrolsocket(TRUE);
- errno = save_errno;
- return -1;
- }
-# endif
-#endif
- return 0;
-}
-\f/*
-** CLOSECONTROLSOCKET -- close the daemon control named socket
-**
-** Close a named socket.
-**
-** Parameters:
-** fullclose -- if set, close the socket and remove it;
-** otherwise, just remove it
-**
-** Returns:
-** none.
-*/
-
-void
-closecontrolsocket(fullclose)
- bool fullclose;
-{
-#ifdef NETUNIX
-# if _FFR_CONTROL_SOCKET
- int sff = SFF_SAFEDIRPATH|SFF_OPENASROOT|SFF_NOLINK|SFF_CREAT|SFF_MUSTOWN;
-
- if (ControlSocket >= 0)
- {
- int rval;
-
- if (fullclose)
- {
- (void) close(ControlSocket);
- ControlSocket = -1;
- }
-
- rval = safefile(ControlSocketName, RunAsUid, RunAsGid, RunAsUserName,
- sff, S_IRUSR|S_IWUSR, NULL);
-
- /* if not safe, don't unlink */
- if (rval != 0)
- return;
-
- if (unlink(ControlSocketName) < 0)
- {
- sm_syslog(LOG_WARNING, NOQID,
- "Could not remove control socket: %s",
- errstring(errno));
- return;
- }
- }
-# endif
-#endif
- return;
-}
-\f/*
-** CLRCONTROL -- reset the control connection
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** releases any resources used by the control interface.
-*/
-
-void
-clrcontrol()
-{
-#ifdef NETUNIX
-# if _FFR_CONTROL_SOCKET
- if (ControlSocket >= 0)
- (void) close(ControlSocket);
- ControlSocket = -1;
-# endif
-#endif
-}
-
-#ifndef NOT_SENDMAIL
-
-\f/*
-** CONTROL_COMMAND -- read and process command from named socket
-**
-** Read and process the command from the opened socket.
-** Return the results down the same socket.
-**
-** Parameters:
-** sock -- the opened socket from getrequests()
-** e -- the current envelope
-**
-** Returns:
-** none.
-*/
-
-struct cmd
-{
- char *cmdname; /* command name */
- int cmdcode; /* internal code, see below */
-};
-
-/* values for cmdcode */
-# define CMDERROR 0 /* bad command */
-# define CMDRESTART 1 /* restart daemon */
-# define CMDSHUTDOWN 2 /* end daemon */
-# define CMDHELP 3 /* help */
-# define CMDSTATUS 4 /* daemon status */
-
-static struct cmd CmdTab[] =
-{
- { "help", CMDHELP },
- { "restart", CMDRESTART },
- { "shutdown", CMDSHUTDOWN },
- { "status", CMDSTATUS },
- { NULL, CMDERROR }
-};
-
-void
-control_command(sock, e)
- int sock;
- ENVELOPE *e;
-{
- FILE *s;
- FILE *traffic;
- FILE *oldout;
- char *cmd;
- char *p;
- struct cmd *c;
- char cmdbuf[MAXLINE];
- char inp[MAXLINE];
- extern char **SaveArgv;
- extern void help __P((char *));
-
- sm_setproctitle(FALSE, "control cmd read");
-
- s = fdopen(sock, "r+");
- if (s == NULL)
- {
- int save_errno = errno;
-
- close(sock);
- errno = save_errno;
- return;
- }
- setbuf(s, NULL);
-
- if (fgets(inp, sizeof inp, s) == NULL)
- {
- fclose(s);
- return;
- }
- (void) fflush(s);
-
- /* clean up end of line */
- fixcrlf(inp, TRUE);
-
- sm_setproctitle(FALSE, "control: %s", inp);
-
- /* break off command */
- for (p = inp; isascii(*p) && isspace(*p); p++)
- continue;
- cmd = cmdbuf;
- while (*p != '\0' &&
- !(isascii(*p) && isspace(*p)) &&
- cmd < &cmdbuf[sizeof cmdbuf - 2])
- *cmd++ = *p++;
- *cmd = '\0';
-
- /* throw away leading whitespace */
- while (isascii(*p) && isspace(*p))
- p++;
-
- /* decode command */
- for (c = CmdTab; c->cmdname != NULL; c++)
- {
- if (!strcasecmp(c->cmdname, cmdbuf))
- break;
- }
-
- switch (c->cmdcode)
- {
- case CMDHELP: /* get help */
- traffic = TrafficLogFile;
- TrafficLogFile = NULL;
- oldout = OutChannel;
- OutChannel = s;
- help("control");
- TrafficLogFile = traffic;
- OutChannel = oldout;
- break;
-
- case CMDRESTART: /* restart the daemon */
- if (SaveArgv[0][0] != '/')
- {
- fprintf(s, "ERROR: could not restart: need full path\r\n");
- break;
- }
- if (LogLevel > 3)
- sm_syslog(LOG_INFO, NOQID,
- "restarting %s on due to control command",
- SaveArgv[0]);
- closecontrolsocket(FALSE);
- if (drop_privileges(TRUE) != EX_OK)
- {
- if (LogLevel > 0)
- sm_syslog(LOG_ALERT, NOQID,
- "could not set[ug]id(%d, %d): %m",
- RunAsUid, RunAsGid);
-
- fprintf(s, "ERROR: could not set[ug]id(%d, %d): %s, exiting...\r\n",
- (int)RunAsUid, (int)RunAsGid, errstring(errno));
- finis(FALSE, EX_OSERR);
- }
- fprintf(s, "OK\r\n");
- clrcontrol();
- (void) fcntl(sock, F_SETFD, 1);
- execve(SaveArgv[0], (ARGV_T) SaveArgv, (ARGV_T) ExternalEnviron);
- if (LogLevel > 0)
- sm_syslog(LOG_ALERT, NOQID, "could not exec %s: %m",
- SaveArgv[0]);
- fprintf(s, "ERROR: could not exec %s: %s, exiting...\r\n",
- SaveArgv[0], errstring(errno));
- finis(FALSE, EX_OSFILE);
- break;
-
- case CMDSHUTDOWN: /* kill the daemon */
- fprintf(s, "OK\r\n");
- finis(FALSE, EX_OK);
- break;
-
- case CMDSTATUS: /* daemon status */
- proc_list_probe();
- fprintf(s, "%d/%d\r\n", CurChildren, MaxChildren);
- proc_list_display(s);
- break;
-
- case CMDERROR: /* unknown command */
- fprintf(s, "Bad command (%s)\r\n", cmdbuf);
- break;
- }
- fclose(s);
-}
-#endif
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)convtime.c 8.14 (Berkeley) 5/19/1998";
-#endif /* not lint */
-
-# include "sendmail.h"
-
-/*
-** CONVTIME -- convert time
-**
-** Takes a time as an ascii string with a trailing character
-** giving units:
-** s -- seconds
-** m -- minutes
-** h -- hours
-** d -- days (default)
-** w -- weeks
-** For example, "3d12h" is three and a half days.
-**
-** Parameters:
-** p -- pointer to ascii time.
-** units -- default units if none specified.
-**
-** Returns:
-** time in seconds.
-**
-** Side Effects:
-** none.
-*/
-
-time_t
-convtime(p, units)
- char *p;
- char units;
-{
- register time_t t, r;
- register char c;
-
- r = 0;
- while (*p != '\0')
- {
- t = 0;
- while ((c = *p++) != '\0' && isascii(c) && isdigit(c))
- t = t * 10 + (c - '0');
- if (c == '\0')
- {
- c = units;
- p--;
- }
- else if (strchr("wdhms", c) == NULL)
- {
- usrerr("Invalid time unit `%c'", c);
- c = units;
- }
- switch (c)
- {
- case 'w': /* weeks */
- t *= 7;
-
- case 'd': /* days */
- default:
- t *= 24;
-
- case 'h': /* hours */
- t *= 60;
-
- case 'm': /* minutes */
- t *= 60;
-
- case 's': /* seconds */
- break;
- }
- r += t;
- }
-
- return (r);
-}
-\f/*
-** PINTVL -- produce printable version of a time interval
-**
-** Parameters:
-** intvl -- the interval to be converted
-** brief -- if TRUE, print this in an extremely compact form
-** (basically used for logging).
-**
-** Returns:
-** A pointer to a string version of intvl suitable for
-** printing or framing.
-**
-** Side Effects:
-** none.
-**
-** Warning:
-** The string returned is in a static buffer.
-*/
-
-# define PLURAL(n) ((n) == 1 ? "" : "s")
-
-char *
-pintvl(intvl, brief)
- time_t intvl;
- bool brief;
-{
- static char buf[256];
- register char *p;
- int wk, dy, hr, mi, se;
-
- if (intvl == 0 && !brief)
- return ("zero seconds");
-
- /* decode the interval into weeks, days, hours, minutes, seconds */
- se = intvl % 60;
- intvl /= 60;
- mi = intvl % 60;
- intvl /= 60;
- hr = intvl % 24;
- intvl /= 24;
- if (brief)
- {
- dy = intvl;
- wk = 0;
- }
- else
- {
- dy = intvl % 7;
- intvl /= 7;
- wk = intvl;
- }
-
- /* now turn it into a sexy form */
- p = buf;
- if (brief)
- {
- if (dy > 0)
- {
- (void) snprintf(p, SPACELEFT(buf, p), "%d+", dy);
- p += strlen(p);
- }
- (void) snprintf(p, SPACELEFT(buf, p), "%02d:%02d:%02d",
- hr, mi, se);
- return (buf);
- }
-
- /* use the verbose form */
- if (wk > 0)
- {
- (void) snprintf(p, SPACELEFT(buf, p), ", %d week%s", wk, PLURAL(wk));
- p += strlen(p);
- }
- if (dy > 0)
- {
- (void) snprintf(p, SPACELEFT(buf, p), ", %d day%s", dy, PLURAL(dy));
- p += strlen(p);
- }
- if (hr > 0)
- {
- (void) snprintf(p, SPACELEFT(buf, p), ", %d hour%s", hr, PLURAL(hr));
- p += strlen(p);
- }
- if (mi > 0)
- {
- (void) snprintf(p, SPACELEFT(buf, p), ", %d minute%s", mi, PLURAL(mi));
- p += strlen(p);
- }
- if (se > 0)
- {
- (void) snprintf(p, SPACELEFT(buf, p), ", %d second%s", se, PLURAL(se));
- p += strlen(p);
- }
-
- return (buf + 2);
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#include <errno.h>
-#include "sendmail.h"
-
-#ifndef lint
-#ifdef DAEMON
-static char sccsid[] = "@(#)daemon.c 8.236 (Berkeley) 1/25/1999 (with daemon mode)";
-#else
-static char sccsid[] = "@(#)daemon.c 8.236 (Berkeley) 1/25/1999 (without daemon mode)";
-#endif
-#endif /* not lint */
-
-#if defined(SOCK_STREAM) || defined(__GNU_LIBRARY__)
-# define USE_SOCK_STREAM 1
-#endif
-
-#if DAEMON || defined(USE_SOCK_STREAM)
-# include <arpa/inet.h>
-# if NAMED_BIND
-# include <resolv.h>
-# ifndef NO_DATA
-# define NO_DATA NO_ADDRESS
-# endif
-# endif
-#endif
-
-#if DAEMON
-
-# include <sys/time.h>
-
-# if IP_SRCROUTE
-# include <netinet/in_systm.h>
-# include <netinet/ip.h>
-# include <netinet/ip_var.h>
-# endif
-
-/*
-** DAEMON.C -- routines to use when running as a daemon.
-**
-** This entire file is highly dependent on the 4.2 BSD
-** interprocess communication primitives. No attempt has
-** been made to make this file portable to Version 7,
-** Version 6, MPX files, etc. If you should try such a
-** thing yourself, I recommend chucking the entire file
-** and starting from scratch. Basic semantics are:
-**
-** getrequests(e)
-** Opens a port and initiates a connection.
-** Returns in a child. Must set InChannel and
-** OutChannel appropriately.
-** clrdaemon()
-** Close any open files associated with getting
-** the connection; this is used when running the queue,
-** etc., to avoid having extra file descriptors during
-** the queue run and to avoid confusing the network
-** code (if it cares).
-** makeconnection(host, port, outfile, infile, e)
-** Make a connection to the named host on the given
-** port. Set *outfile and *infile to the files
-** appropriate for communication. Returns zero on
-** success, else an exit status describing the
-** error.
-** host_map_lookup(map, hbuf, avp, pstat)
-** Convert the entry in hbuf into a canonical form.
-*/
-\f/*
-** GETREQUESTS -- open mail IPC port and get requests.
-**
-** Parameters:
-** e -- the current envelope.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Waits until some interesting activity occurs. When
-** it does, a child is created to process it, and the
-** parent waits for completion. Return from this
-** routine is always in the child. The file pointers
-** "InChannel" and "OutChannel" should be set to point
-** to the communication channel.
-*/
-
-int DaemonSocket = -1; /* fd describing socket */
-SOCKADDR DaemonAddr; /* socket for incoming */
-int ListenQueueSize = 10; /* size of listen queue */
-int TcpRcvBufferSize = 0; /* size of TCP receive buffer */
-int TcpSndBufferSize = 0; /* size of TCP send buffer */
-
-void
-getrequests(e)
- ENVELOPE *e;
-{
- int t;
- time_t refuse_connections_until = 0;
- bool firsttime = TRUE;
- FILE *pidf;
- int sff;
- int socksize;
- u_short port;
-#if XDEBUG
- bool j_has_dot;
-#endif
- char status[MAXLINE];
- extern void reapchild __P((int));
-#ifdef NETUNIX
- extern int ControlSocket;
-#endif
- extern int opendaemonsocket __P((bool));
- extern int opencontrolsocket __P((void));
-
- /*
- ** Set up the address for the mailer.
- */
-
- switch (DaemonAddr.sa.sa_family)
- {
- case AF_UNSPEC:
- DaemonAddr.sa.sa_family = AF_INET;
- /* fall through ... */
-
- case AF_INET:
- if (DaemonAddr.sin.sin_addr.s_addr == 0)
- DaemonAddr.sin.sin_addr.s_addr = INADDR_ANY;
- port = DaemonAddr.sin.sin_port;
- break;
-
- default:
- /* unknown protocol */
- port = 0;
- break;
- }
- if (port == 0)
- {
- register struct servent *sp;
-
- sp = getservbyname("smtp", "tcp");
- if (sp == NULL)
- {
- syserr("554 service \"smtp\" unknown");
- port = htons(25);
- }
- else
- port = sp->s_port;
- }
-
- switch (DaemonAddr.sa.sa_family)
- {
- case AF_INET:
- DaemonAddr.sin.sin_port = port;
- break;
-
- default:
- /* unknown protocol */
- break;
- }
-
- /*
- ** Try to actually open the connection.
- */
-
- if (tTd(15, 1))
- printf("getrequests: port 0x%x\n", port);
-
- /* get a socket for the SMTP connection */
- socksize = opendaemonsocket(TRUE);
-
- if (opencontrolsocket() < 0)
- sm_syslog(LOG_WARNING, NOQID,
- "daemon could not open control socket %s: %s",
- ControlSocketName, errstring(errno));
-
- (void) setsignal(SIGCHLD, reapchild);
-
- /* write the pid to the log file for posterity */
- sff = SFF_NOLINK|SFF_ROOTOK|SFF_REGONLY|SFF_CREAT;
- if (TrustedUid != 0 && RealUid == TrustedUid)
- sff |= SFF_OPENASROOT;
- pidf = safefopen(PidFile, O_WRONLY|O_TRUNC, 0644, sff);
- if (pidf == NULL)
- {
- sm_syslog(LOG_ERR, NOQID, "unable to write %s", PidFile);
- }
- else
- {
- extern char *CommandLineArgs;
-
- /* write the process id on line 1 */
- fprintf(pidf, "%ld\n", (long) getpid());
-
- /* line 2 contains all command line flags */
- fprintf(pidf, "%s\n", CommandLineArgs);
-
- /* flush and close */
- fclose(pidf);
- }
-
-#if XDEBUG
- {
- char jbuf[MAXHOSTNAMELEN];
-
- expand("\201j", jbuf, sizeof jbuf, e);
- j_has_dot = strchr(jbuf, '.') != NULL;
- }
-#endif
-
- /* Add parent process as first item */
- proc_list_add(getpid(), "Sendmail daemon");
-
- if (tTd(15, 1))
- printf("getrequests: %d\n", DaemonSocket);
-
- for (;;)
- {
- register pid_t pid;
- auto SOCKADDR_LEN_T lotherend;
- bool timedout = FALSE;
- bool control = FALSE;
- int savederrno;
- int pipefd[2];
- extern bool refuseconnections __P((int));
-
- /* see if we are rejecting connections */
- (void) blocksignal(SIGALRM);
- if (curtime() >= refuse_connections_until)
- {
- if (refuseconnections(ntohs(port)))
- {
- if (DaemonSocket >= 0)
- {
- /* close socket so peer fails quickly */
- (void) close(DaemonSocket);
- DaemonSocket = -1;
- }
-
- /* refuse connections for next 15 seconds */
- refuse_connections_until = curtime() + 15;
- }
- else if (DaemonSocket < 0 || firsttime)
- {
- /* arrange to (re)open the socket if needed */
- (void) opendaemonsocket(FALSE);
- firsttime = FALSE;
- }
- }
-
-#if XDEBUG
- /* check for disaster */
- {
- char jbuf[MAXHOSTNAMELEN];
- extern void dumpstate __P((char *));
-
- expand("\201j", jbuf, sizeof jbuf, e);
- if (!wordinclass(jbuf, 'w'))
- {
- dumpstate("daemon lost $j");
- sm_syslog(LOG_ALERT, NOQID,
- "daemon process doesn't have $j in $=w; see syslog");
- abort();
- }
- else if (j_has_dot && strchr(jbuf, '.') == NULL)
- {
- dumpstate("daemon $j lost dot");
- sm_syslog(LOG_ALERT, NOQID,
- "daemon process $j lost dot; see syslog");
- abort();
- }
- }
-#endif
-
-#if 0
- /*
- ** Andrew Sun <asun@ieps-sun.ml.com> claims that this will
- ** fix the SVr4 problem. But it seems to have gone away,
- ** so is it worth doing this?
- */
-
- if (DaemonSocket >= 0 &&
- SetNonBlocking(DaemonSocket, FALSE) < 0)
- log an error here;
-#endif
- (void) releasesignal(SIGALRM);
- for (;;)
- {
- int highest = -1;
- fd_set readfds;
- struct timeval timeout;
-
- FD_ZERO(&readfds);
-
- /* wait for a connection */
- if (DaemonSocket >= 0)
- {
- sm_setproctitle(TRUE,
- "accepting connections on port %d",
- ntohs(port));
- if (DaemonSocket > highest)
- highest = DaemonSocket;
- FD_SET(DaemonSocket, &readfds);
- }
-#ifdef NETUNIX
- if (ControlSocket >= 0)
- {
- if (ControlSocket > highest)
- highest = ControlSocket;
- FD_SET(ControlSocket, &readfds);
- }
-#endif
- if (DaemonSocket >= 0)
- timeout.tv_sec = 60;
- else
- timeout.tv_sec = 5;
- timeout.tv_usec = 0;
-
- t = select(highest + 1, FDSET_CAST &readfds,
- NULL, NULL, &timeout);
-
- if (DoQueueRun)
- (void) runqueue(TRUE, FALSE);
- if (t <= 0)
- {
- timedout = TRUE;
- break;
- }
-
- control = FALSE;
- errno = 0;
- if (DaemonSocket >= 0 &&
- FD_ISSET(DaemonSocket, &readfds))
- {
- lotherend = socksize;
- t = accept(DaemonSocket,
- (struct sockaddr *)&RealHostAddr,
- &lotherend);
- }
-#ifdef NETUNIX
- else if (ControlSocket >= 0 &&
- FD_ISSET(ControlSocket, &readfds))
- {
- struct sockaddr_un sa_un;
-
- lotherend = sizeof sa_un;
- t = accept(ControlSocket,
- (struct sockaddr *)&sa_un,
- &lotherend);
- control = TRUE;
- }
-#endif
- if (t >= 0 || errno != EINTR)
- break;
- }
- if (timedout)
- {
- timedout = FALSE;
- continue;
- }
- if (control)
- {
- if (t >= 0)
- {
- extern void control_command __P((int, ENVELOPE *));
-
- control_command(t, e);
- }
- else
- syserr("getrequests: control accept");
- continue;
- }
- savederrno = errno;
- (void) blocksignal(SIGALRM);
- if (t < 0)
- {
- errno = savederrno;
- syserr("getrequests: accept");
-
- /* arrange to re-open the socket next time around */
- (void) close(DaemonSocket);
- DaemonSocket = -1;
- continue;
- }
-
- /*
- ** Create a subprocess to process the mail.
- */
-
- if (tTd(15, 2))
- printf("getrequests: forking (fd = %d)\n", t);
-
- /*
- ** Create a pipe to keep the child from writing to the
- ** socket until after the parent has closed it. Otherwise
- ** the parent may hang if the child has closed it first.
- */
-
- if (pipe(pipefd) < 0)
- pipefd[0] = pipefd[1] = -1;
-
- blocksignal(SIGCHLD);
- pid = fork();
- if (pid < 0)
- {
- syserr("daemon: cannot fork");
- if (pipefd[0] != -1)
- {
- (void) close(pipefd[0]);
- (void) close(pipefd[1]);
- }
- (void) releasesignal(SIGCHLD);
- sleep(10);
- (void) close(t);
- continue;
- }
-
- if (pid == 0)
- {
- char *p;
- extern SIGFUNC_DECL intsig __P((int));
- FILE *inchannel, *outchannel;
-
- /*
- ** CHILD -- return to caller.
- ** Collect verified idea of sending host.
- ** Verify calling user id if possible here.
- */
-
- (void) releasesignal(SIGALRM);
- (void) releasesignal(SIGCHLD);
- (void) setsignal(SIGCHLD, SIG_DFL);
- (void) setsignal(SIGHUP, intsig);
- (void) close(DaemonSocket);
- clrcontrol();
- proc_list_clear();
-
- /* Add parent process as first child item */
- proc_list_add(getpid(), "daemon child");
-
- /* don't schedule queue runs if we are told to ETRN */
- QueueIntvl = 0;
-
- sm_setproctitle(TRUE, "startup with %s",
- anynet_ntoa(&RealHostAddr));
-
- if (pipefd[0] != -1)
- {
- auto char c;
-
- /*
- ** Wait for the parent to close the write end
- ** of the pipe, which we will see as an EOF.
- ** This guarantees that we won't write to the
- ** socket until after the parent has closed
- ** the pipe.
- */
-
- /* close the write end of the pipe */
- (void) close(pipefd[1]);
-
- /* we shouldn't be interrupted, but ... */
- while (read(pipefd[0], &c, 1) < 0 &&
- errno == EINTR)
- continue;
- (void) close(pipefd[0]);
- }
-
- /* determine host name */
- p = hostnamebyanyaddr(&RealHostAddr);
- if (strlen(p) > (SIZE_T) MAXNAME)
- p[MAXNAME] = '\0';
- RealHostName = newstr(p);
- sm_setproctitle(TRUE, "startup with %s", p);
-
- if ((inchannel = fdopen(t, "r")) == NULL ||
- (t = dup(t)) < 0 ||
- (outchannel = fdopen(t, "w")) == NULL)
- {
- syserr("cannot open SMTP server channel, fd=%d", t);
- finis(FALSE, EX_OK);
- }
-
- InChannel = inchannel;
- OutChannel = outchannel;
- DisConnected = FALSE;
-
-#ifdef XLA
- if (!xla_host_ok(RealHostName))
- {
- message("421 Too many SMTP sessions for this host");
- finis(FALSE, EX_OK);
- }
-#endif
- break;
- }
-
- /* parent -- keep track of children */
- snprintf(status, sizeof status, "SMTP server child for %s",
- anynet_ntoa(&RealHostAddr));
- proc_list_add(pid, status);
- (void) releasesignal(SIGCHLD);
-
- /* close the read end of the synchronization pipe */
- if (pipefd[0] != -1)
- (void) close(pipefd[0]);
-
- /* close the port so that others will hang (for a while) */
- (void) close(t);
-
- /* release the child by closing the read end of the sync pipe */
- if (pipefd[1] != -1)
- (void) close(pipefd[1]);
- }
- if (tTd(15, 2))
- printf("getreq: returning\n");
- return;
-}
-\f/*
-** OPENDAEMONSOCKET -- open the SMTP socket
-**
-** Deals with setting all appropriate options. DaemonAddr must
-** be set up in advance.
-**
-** Parameters:
-** firsttime -- set if this is the initial open.
-**
-** Returns:
-** Size in bytes of the daemon socket addr.
-**
-** Side Effects:
-** Leaves DaemonSocket set to the open socket.
-** Exits if the socket cannot be created.
-*/
-
-#define MAXOPENTRIES 10 /* maximum number of tries to open connection */
-
-int
-opendaemonsocket(firsttime)
- bool firsttime;
-{
- int on = 1;
- int socksize = 0;
- int ntries = 0;
- int saveerrno;
-
- if (tTd(15, 2))
- printf("opendaemonsocket()\n");
-
- do
- {
- if (ntries > 0)
- sleep(5);
- if (firsttime || DaemonSocket < 0)
- {
- DaemonSocket = socket(DaemonAddr.sa.sa_family, SOCK_STREAM, 0);
- if (DaemonSocket < 0)
- {
- saveerrno = errno;
- syserr("opendaemonsocket: can't create server SMTP socket");
- severe:
- if (LogLevel > 0)
- sm_syslog(LOG_ALERT, NOQID,
- "problem creating SMTP socket");
- DaemonSocket = -1;
- continue;
- }
-
- /* turn on network debugging? */
- if (tTd(15, 101))
- (void) setsockopt(DaemonSocket, SOL_SOCKET,
- SO_DEBUG, (char *)&on,
- sizeof on);
-
- (void) setsockopt(DaemonSocket, SOL_SOCKET,
- SO_REUSEADDR, (char *)&on, sizeof on);
- (void) setsockopt(DaemonSocket, SOL_SOCKET,
- SO_KEEPALIVE, (char *)&on, sizeof on);
-
-#ifdef SO_RCVBUF
- if (TcpRcvBufferSize > 0)
- {
- if (setsockopt(DaemonSocket, SOL_SOCKET,
- SO_RCVBUF,
- (char *) &TcpRcvBufferSize,
- sizeof(TcpRcvBufferSize)) < 0)
- syserr("opendaemonsocket: setsockopt(SO_RCVBUF)");
- }
-#endif
-
- switch (DaemonAddr.sa.sa_family)
- {
-# if NETINET
- case AF_INET:
- socksize = sizeof DaemonAddr.sin;
- break;
-# endif
-
-# if NETISO
- case AF_ISO:
- socksize = sizeof DaemonAddr.siso;
- break;
-# endif
-
- default:
- socksize = sizeof DaemonAddr;
- break;
- }
-
- if (bind(DaemonSocket, &DaemonAddr.sa, socksize) < 0)
- {
- /* probably another daemon already */
- saveerrno = errno;
- syserr("opendaemonsocket: cannot bind");
- (void) close(DaemonSocket);
- goto severe;
- }
- }
- if (!firsttime && listen(DaemonSocket, ListenQueueSize) < 0)
- {
- saveerrno = errno;
- syserr("opendaemonsocket: cannot listen");
- (void) close(DaemonSocket);
- goto severe;
- }
- return socksize;
- } while (ntries++ < MAXOPENTRIES && transienterror(saveerrno));
- syserr("!opendaemonsocket: server SMTP socket wedged: exiting");
- /*NOTREACHED*/
- return -1; /* avoid compiler warning on IRIX */
-}
-\f/*
-** CLRDAEMON -- reset the daemon connection
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** releases any resources used by the passive daemon.
-*/
-
-void
-clrdaemon()
-{
- if (DaemonSocket >= 0)
- (void) close(DaemonSocket);
- DaemonSocket = -1;
-}
-\f/*
-** SETDAEMONOPTIONS -- set options for running the daemon
-**
-** Parameters:
-** p -- the options line.
-**
-** Returns:
-** none.
-*/
-
-void
-setdaemonoptions(p)
- register char *p;
-{
- if (DaemonAddr.sa.sa_family == AF_UNSPEC)
- DaemonAddr.sa.sa_family = AF_INET;
-
- while (p != NULL)
- {
- register char *f;
- register char *v;
-
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p == '\0')
- break;
- f = p;
- p = strchr(p, ',');
- if (p != NULL)
- *p++ = '\0';
- v = strchr(f, '=');
- if (v == NULL)
- continue;
- while (isascii(*++v) && isspace(*v))
- continue;
- if (isascii(*f) && islower(*f))
- *f = toupper(*f);
-
- switch (*f)
- {
- case 'F': /* address family */
- if (isascii(*v) && isdigit(*v))
- DaemonAddr.sa.sa_family = atoi(v);
-#if NETINET
- else if (strcasecmp(v, "inet") == 0)
- DaemonAddr.sa.sa_family = AF_INET;
-#endif
-#if NETISO
- else if (strcasecmp(v, "iso") == 0)
- DaemonAddr.sa.sa_family = AF_ISO;
-#endif
-#if NETNS
- else if (strcasecmp(v, "ns") == 0)
- DaemonAddr.sa.sa_family = AF_NS;
-#endif
-#if NETX25
- else if (strcasecmp(v, "x.25") == 0)
- DaemonAddr.sa.sa_family = AF_CCITT;
-#endif
- else
- syserr("554 Unknown address family %s in Family=option", v);
- break;
-
- case 'A': /* address */
- switch (DaemonAddr.sa.sa_family)
- {
-#if NETINET
- case AF_INET:
- if (isascii(*v) && isdigit(*v))
- DaemonAddr.sin.sin_addr.s_addr = inet_addr(v);
- else
- {
- register struct hostent *hp;
-
- hp = sm_gethostbyname(v);
- if (hp == NULL)
- syserr("554 host \"%s\" unknown", v);
- else
- bcopy(hp->h_addr, &DaemonAddr.sin.sin_addr, INADDRSZ);
- }
- break;
-#endif
-
- default:
- syserr("554 Address= option unsupported for family %d",
- DaemonAddr.sa.sa_family);
- break;
- }
- break;
-
- case 'P': /* port */
- switch (DaemonAddr.sa.sa_family)
- {
-#if NETISO
- short port;
-#endif
-
-#if NETINET
- case AF_INET:
- if (isascii(*v) && isdigit(*v))
- DaemonAddr.sin.sin_port = htons(atoi(v));
- else
- {
- register struct servent *sp;
-
- sp = getservbyname(v, "tcp");
- if (sp == NULL)
- syserr("554 service \"%s\" unknown", v);
- else
- DaemonAddr.sin.sin_port = sp->s_port;
- }
- break;
-#endif
-
-#if NETISO
- case AF_ISO:
- /* assume two byte transport selector */
- if (isascii(*v) && isdigit(*v))
- port = htons(atoi(v));
- else
- {
- register struct servent *sp;
-
- sp = getservbyname(v, "tcp");
- if (sp == NULL)
- syserr("554 service \"%s\" unknown", v);
- else
- port = sp->s_port;
- }
- bcopy((char *) &port, TSEL(&DaemonAddr.siso), 2);
- break;
-#endif
-
- default:
- syserr("554 Port= option unsupported for family %d",
- DaemonAddr.sa.sa_family);
- break;
- }
- break;
-
- case 'L': /* listen queue size */
- ListenQueueSize = atoi(v);
- break;
-
- case 'S': /* send buffer size */
- TcpSndBufferSize = atoi(v);
- break;
-
- case 'R': /* receive buffer size */
- TcpRcvBufferSize = atoi(v);
- break;
-
- default:
- syserr("554 DaemonPortOptions parameter \"%s\" unknown", f);
- }
- }
-}
-\f/*
-** MAKECONNECTION -- make a connection to an SMTP socket on another machine.
-**
-** Parameters:
-** host -- the name of the host.
-** port -- the port number to connect to.
-** mci -- a pointer to the mail connection information
-** structure to be filled in.
-** e -- the current envelope.
-**
-** Returns:
-** An exit code telling whether the connection could be
-** made and if not why not.
-**
-** Side Effects:
-** none.
-*/
-
-static jmp_buf CtxConnectTimeout;
-
-static void
-connecttimeout()
-{
- errno = ETIMEDOUT;
- longjmp(CtxConnectTimeout, 1);
-}
-
-SOCKADDR CurHostAddr; /* address of current host */
-
-int
-makeconnection(host, port, mci, e)
- char *host;
- u_short port;
- register MCI *mci;
- ENVELOPE *e;
-{
- register volatile int addrno = 0;
- register volatile int s;
- register struct hostent *volatile hp = (struct hostent *)NULL;
- SOCKADDR addr;
- int sav_errno;
- volatile int addrlen;
- volatile bool firstconnect;
- EVENT *volatile ev = NULL;
-
- /*
- ** Set up the address for the mailer.
- ** Accept "[a.b.c.d]" syntax for host name.
- */
-
-#if NAMED_BIND
- h_errno = 0;
-#endif
- errno = 0;
- bzero(&CurHostAddr, sizeof CurHostAddr);
- SmtpPhase = mci->mci_phase = "initial connection";
- CurHostName = host;
-
- if (host[0] == '[')
- {
-#if NETINET
- unsigned long hid = INADDR_NONE;
-#endif
- register char *p = strchr(host, ']');
-
- if (p != NULL)
- {
- *p = '\0';
-#if NETINET
- hid = inet_addr(&host[1]);
- if (hid == INADDR_NONE)
-#endif
- {
- /* try it as a host name (avoid MX lookup) */
- hp = sm_gethostbyname(&host[1]);
- if (hp == NULL && p[-1] == '.')
- {
-#if NAMED_BIND
- int oldopts = _res.options;
-
- _res.options &= ~(RES_DEFNAMES|RES_DNSRCH);
-#endif
- p[-1] = '\0';
- hp = sm_gethostbyname(&host[1]);
- p[-1] = '.';
-#if NAMED_BIND
- _res.options = oldopts;
-#endif
- }
- *p = ']';
- goto gothostent;
- }
- *p = ']';
- }
- if (p == NULL)
- {
- extern char MsgBuf[];
-
- usrerr("553 Invalid numeric domain spec \"%s\"", host);
- mci_setstat(mci, EX_NOHOST, "5.1.2", MsgBuf);
- return EX_NOHOST;
- }
-#if NETINET
- addr.sin.sin_family = AF_INET; /*XXX*/
- addr.sin.sin_addr.s_addr = hid;
-#endif
- }
- else
- {
- /* contortion to get around SGI cc complaints */
- {
- register char *p = &host[strlen(host) - 1];
-
- hp = sm_gethostbyname(host);
- if (hp == NULL && *p == '.')
- {
-#if NAMED_BIND
- int oldopts = _res.options;
-
- _res.options &= ~(RES_DEFNAMES|RES_DNSRCH);
-#endif
- *p = '\0';
- hp = sm_gethostbyname(host);
- *p = '.';
-#if NAMED_BIND
- _res.options = oldopts;
-#endif
- }
- }
-gothostent:
- if (hp == NULL)
- {
-#if NAMED_BIND
- /* check for name server timeouts */
- if (errno == ETIMEDOUT || h_errno == TRY_AGAIN ||
- (errno == ECONNREFUSED && UseNameServer))
- {
- mci_setstat(mci, EX_TEMPFAIL, "4.4.3", NULL);
- return EX_TEMPFAIL;
- }
-#endif
- mci_setstat(mci, EX_NOHOST, "5.1.2", NULL);
- return (EX_NOHOST);
- }
- addr.sa.sa_family = hp->h_addrtype;
- switch (hp->h_addrtype)
- {
-#if NETINET
- case AF_INET:
- bcopy(hp->h_addr,
- &addr.sin.sin_addr,
- INADDRSZ);
- break;
-#endif
-
- default:
- if (hp->h_length > sizeof addr.sa.sa_data)
- {
- syserr("makeconnection: long sa_data: family %d len %d",
- hp->h_addrtype, hp->h_length);
- mci_setstat(mci, EX_NOHOST, "5.1.2", NULL);
- return EX_NOHOST;
- }
- bcopy(hp->h_addr,
- addr.sa.sa_data,
- hp->h_length);
- break;
- }
- addrno = 1;
- }
-
- /*
- ** Determine the port number.
- */
-
- if (port == 0)
- {
- register struct servent *sp = getservbyname("smtp", "tcp");
-
- if (sp == NULL)
- {
- if (LogLevel > 2)
- sm_syslog(LOG_ERR, NOQID,
- "makeconnection: service \"smtp\" unknown");
- port = htons(25);
- }
- else
- port = sp->s_port;
- }
-
- switch (addr.sa.sa_family)
- {
-#if NETINET
- case AF_INET:
- addr.sin.sin_port = port;
- addrlen = sizeof (struct sockaddr_in);
- break;
-#endif
-
-#if NETISO
- case AF_ISO:
- /* assume two byte transport selector */
- bcopy((char *) &port, TSEL((struct sockaddr_iso *) &addr), 2);
- addrlen = sizeof (struct sockaddr_iso);
- break;
-#endif
-
- default:
- syserr("Can't connect to address family %d", addr.sa.sa_family);
- mci_setstat(mci, EX_NOHOST, "5.1.2", NULL);
- return (EX_NOHOST);
- }
-
- /*
- ** Try to actually open the connection.
- */
-
-#ifdef XLA
- /* if too many connections, don't bother trying */
- if (!xla_noqueue_ok(host))
- return EX_TEMPFAIL;
-#endif
-
- firstconnect = TRUE;
- for (;;)
- {
- if (tTd(16, 1))
- printf("makeconnection (%s [%s])\n",
- host, anynet_ntoa(&addr));
-
- /* save for logging */
- CurHostAddr = addr;
-
- if (bitnset(M_SECURE_PORT, mci->mci_mailer->m_flags))
- {
- int rport = IPPORT_RESERVED - 1;
-
- s = rresvport(&rport);
- }
- else
- {
- s = socket(addr.sa.sa_family, SOCK_STREAM, 0);
- }
- if (s < 0)
- {
- sav_errno = errno;
- syserr("makeconnection: cannot create socket");
-#ifdef XLA
- xla_host_end(host);
-#endif
- mci_setstat(mci, EX_TEMPFAIL, "4.4.5", NULL);
- return EX_TEMPFAIL;
- }
-
-#ifdef SO_SNDBUF
- if (TcpSndBufferSize > 0)
- {
- if (setsockopt(s, SOL_SOCKET, SO_SNDBUF,
- (char *) &TcpSndBufferSize,
- sizeof(TcpSndBufferSize)) < 0)
- syserr("makeconnection: setsockopt(SO_SNDBUF)");
- }
-#endif
-
- if (tTd(16, 1))
- printf("makeconnection: fd=%d\n", s);
-
- /* turn on network debugging? */
- if (tTd(16, 101))
- {
- int on = 1;
- (void) setsockopt(s, SOL_SOCKET, SO_DEBUG,
- (char *)&on, sizeof on);
- }
- if (e->e_xfp != NULL)
- (void) fflush(e->e_xfp); /* for debugging */
- errno = 0; /* for debugging */
-
- /*
- ** Linux seems to hang in connect for 90 minutes (!!!).
- ** Time out the connect to avoid this problem.
- */
-
- if (setjmp(CtxConnectTimeout) == 0)
- {
- int i;
-
- if (e->e_ntries <= 0 && TimeOuts.to_iconnect != 0)
- ev = setevent(TimeOuts.to_iconnect, connecttimeout, 0);
- else if (TimeOuts.to_connect != 0)
- ev = setevent(TimeOuts.to_connect, connecttimeout, 0);
- else
- ev = NULL;
-
-#if _FFR_CONNECTONLYTO_OPTION
- /* for testing */
- if (ConnectOnlyTo != 0)
- addr.sin.sin_addr.s_addr = ConnectOnlyTo;
-#endif
- i = connect(s, (struct sockaddr *) &addr, addrlen);
- sav_errno = errno;
- if (ev != NULL)
- clrevent(ev);
- if (i >= 0)
- break;
- }
- else
- sav_errno = errno;
-
- /* if running demand-dialed connection, try again */
- if (DialDelay > 0 && firstconnect)
- {
- if (tTd(16, 1))
- printf("Connect failed (%s); trying again...\n",
- errstring(sav_errno));
- firstconnect = FALSE;
- sleep(DialDelay);
- continue;
- }
-
- /* couldn't connect.... figure out why */
- (void) close(s);
-
- if (LogLevel >= 14)
- sm_syslog(LOG_INFO, e->e_id,
- "makeconnection (%s [%s]) failed: %s",
- host, anynet_ntoa(&addr),
- errstring(sav_errno));
-
- if (hp != NULL && hp->h_addr_list[addrno] != NULL)
- {
- if (tTd(16, 1))
- printf("Connect failed (%s); trying new address....\n",
- errstring(sav_errno));
- switch (addr.sa.sa_family)
- {
-#if NETINET
- case AF_INET:
- bcopy(hp->h_addr_list[addrno++],
- &addr.sin.sin_addr,
- INADDRSZ);
- break;
-#endif
-
- default:
- bcopy(hp->h_addr_list[addrno++],
- addr.sa.sa_data,
- hp->h_length);
- break;
- }
- continue;
- }
-
- /* couldn't open connection */
-#ifdef XLA
- xla_host_end(host);
-#endif
- mci_setstat(mci, EX_TEMPFAIL, "4.4.1", NULL);
- return EX_TEMPFAIL;
- }
-
- /* connection ok, put it into canonical form */
- if ((mci->mci_out = fdopen(s, "w")) == NULL ||
- (s = dup(s)) < 0 ||
- (mci->mci_in = fdopen(s, "r")) == NULL)
- {
- syserr("cannot open SMTP client channel, fd=%d", s);
- mci_setstat(mci, EX_TEMPFAIL, "4.4.5", NULL);
- return EX_TEMPFAIL;
- }
-
- mci_setstat(mci, EX_OK, NULL, NULL);
- return (EX_OK);
-}
-\f/*
-** MYHOSTNAME -- return the name of this host.
-**
-** Parameters:
-** hostbuf -- a place to return the name of this host.
-** size -- the size of hostbuf.
-**
-** Returns:
-** A list of aliases for this host.
-**
-** Side Effects:
-** Adds numeric codes to $=w.
-*/
-
-struct hostent *
-myhostname(hostbuf, size)
- char hostbuf[];
- int size;
-{
- register struct hostent *hp;
-
- if (gethostname(hostbuf, size) < 0)
- {
- (void) strcpy(hostbuf, "localhost");
- }
- hp = sm_gethostbyname(hostbuf);
- if (hp == NULL)
- return NULL;
- if (strchr(hp->h_name, '.') != NULL || strchr(hostbuf, '.') == NULL)
- {
- (void) strncpy(hostbuf, hp->h_name, size - 1);
- hostbuf[size - 1] = '\0';
- }
-
- /*
- ** If there is still no dot in the name, try looking for a
- ** dotted alias.
- */
-
- if (strchr(hostbuf, '.') == NULL)
- {
- char **ha;
-
- for (ha = hp->h_aliases; *ha != NULL; ha++)
- {
- if (strchr(*ha, '.') != NULL)
- {
- (void) strncpy(hostbuf, *ha, size - 1);
- hostbuf[size - 1] = '\0';
- break;
- }
- }
- }
-
- /*
- ** If _still_ no dot, wait for a while and try again -- it is
- ** possible that some service is starting up. This can result
- ** in excessive delays if the system is badly configured, but
- ** there really isn't a way around that, particularly given that
- ** the config file hasn't been read at this point.
- ** All in all, a bit of a mess.
- */
-
- if (strchr(hostbuf, '.') == NULL &&
- !getcanonname(hostbuf, size, TRUE))
- {
- sm_syslog(LOG_CRIT, NOQID,
- "My unqualified host name (%s) unknown; sleeping for retry",
- hostbuf);
- message("My unqualified host name (%s) unknown; sleeping for retry",
- hostbuf);
- sleep(60);
- if (!getcanonname(hostbuf, size, TRUE))
- {
- sm_syslog(LOG_ALERT, NOQID,
- "unable to qualify my own domain name (%s) -- using short name",
- hostbuf);
- message("WARNING: unable to qualify my own domain name (%s) -- using short name",
- hostbuf);
- }
- }
- return (hp);
-}
-\f/*
-** ADDRCMP -- compare two host addresses
-**
-** Parameters:
-** hp -- hostent structure for the first address
-** ha -- actual first address
-** sa -- second address
-**
-** Returns:
-** 0 -- if ha and sa match
-** else -- they don't match
-*/
-
-int
-addrcmp(hp, ha, sa)
- struct hostent *hp;
- char *ha;
- SOCKADDR *sa;
-{
- switch (sa->sa.sa_family)
- {
- case AF_INET:
- if (hp->h_addrtype == AF_INET)
- return bcmp(ha, (char *) &sa->sin.sin_addr, hp->h_length);
- break;
-
- }
- return -1;
-}
-\f/*
-** GETAUTHINFO -- get the real host name asociated with a file descriptor
-**
-** Uses RFC1413 protocol to try to get info from the other end.
-**
-** Parameters:
-** fd -- the descriptor
-** may_be_forged -- an outage that is set to TRUE if the
-** forward lookup of RealHostName does not match
-** RealHostAddr; set to FALSE if they do match.
-**
-** Returns:
-** The user@host information associated with this descriptor.
-*/
-
-static jmp_buf CtxAuthTimeout;
-
-static void
-authtimeout()
-{
- longjmp(CtxAuthTimeout, 1);
-}
-
-char *
-getauthinfo(fd, may_be_forged)
- int fd;
- bool *may_be_forged;
-{
- SOCKADDR_LEN_T falen;
- register char *volatile p = NULL;
- SOCKADDR la;
- SOCKADDR_LEN_T lalen;
- register struct servent *sp;
- volatile int s;
- int i = 0;
- EVENT *ev;
- int nleft;
- struct hostent *hp;
- char *ostype = NULL;
- char **ha;
- char ibuf[MAXNAME + 1];
- static char hbuf[MAXNAME * 2 + 11];
-
- *may_be_forged = FALSE;
- falen = sizeof RealHostAddr;
- if (isatty(fd) || (i = getpeername(fd, &RealHostAddr.sa, &falen)) < 0 ||
- falen <= 0 || RealHostAddr.sa.sa_family == 0)
- {
- if (i < 0 && errno != ENOTSOCK)
- return NULL;
- (void) snprintf(hbuf, sizeof hbuf, "%s@localhost",
- RealUserName);
- if (tTd(9, 1))
- printf("getauthinfo: %s\n", hbuf);
- return hbuf;
- }
-
- if (RealHostName == NULL)
- {
- /* translate that to a host name */
- RealHostName = newstr(hostnamebyanyaddr(&RealHostAddr));
- if (strlen(RealHostName) > MAXNAME)
- RealHostName[MAXNAME] = '\0';
- }
-
- /* cross check RealHostName with forward DNS lookup */
- if (anynet_ntoa(&RealHostAddr)[0] == '[' ||
- RealHostName[0] == '[')
- {
- /*
- ** address is not a socket or have an
- ** IP address with no forward lookup
- */
- *may_be_forged = FALSE;
- }
- else
- {
- /* try to match the reverse against the forward lookup */
- hp = sm_gethostbyname(RealHostName);
-
- if (hp == NULL)
- *may_be_forged = TRUE;
- else
- {
- for (ha = hp->h_addr_list; *ha != NULL; ha++)
- if (addrcmp(hp, *ha, &RealHostAddr) == 0)
- break;
- *may_be_forged = *ha == NULL;
- }
- }
-
- if (TimeOuts.to_ident == 0)
- goto noident;
-
- lalen = sizeof la;
- if (RealHostAddr.sa.sa_family != AF_INET ||
- getsockname(fd, &la.sa, &lalen) < 0 || lalen <= 0 ||
- la.sa.sa_family != AF_INET)
- {
- /* no ident info */
- goto noident;
- }
-
- /* create ident query */
- (void) snprintf(ibuf, sizeof ibuf, "%d,%d\r\n",
- ntohs(RealHostAddr.sin.sin_port), ntohs(la.sin.sin_port));
-
- /* create local address */
- la.sin.sin_port = 0;
-
- /* create foreign address */
- sp = getservbyname("auth", "tcp");
- if (sp != NULL)
- RealHostAddr.sin.sin_port = sp->s_port;
- else
- RealHostAddr.sin.sin_port = htons(113);
-
- s = -1;
- if (setjmp(CtxAuthTimeout) != 0)
- {
- if (s >= 0)
- (void) close(s);
- goto noident;
- }
-
- /* put a timeout around the whole thing */
- ev = setevent(TimeOuts.to_ident, authtimeout, 0);
-
- /* connect to foreign IDENT server using same address as SMTP socket */
- s = socket(AF_INET, SOCK_STREAM, 0);
- if (s < 0)
- {
- clrevent(ev);
- goto noident;
- }
- if (bind(s, &la.sa, sizeof la.sin) < 0 ||
- connect(s, &RealHostAddr.sa, sizeof RealHostAddr.sin) < 0)
- {
- goto closeident;
- }
-
- if (tTd(9, 10))
- printf("getauthinfo: sent %s", ibuf);
-
- /* send query */
- if (write(s, ibuf, strlen(ibuf)) < 0)
- goto closeident;
-
- /* get result */
- p = &ibuf[0];
- nleft = sizeof ibuf - 1;
- while ((i = read(s, p, nleft)) > 0)
- {
- p += i;
- nleft -= i;
- *p = '\0';
- if (strchr(ibuf, '\n') != NULL)
- break;
- }
- (void) close(s);
- clrevent(ev);
- if (i < 0 || p == &ibuf[0])
- goto noident;
-
- if (*--p == '\n' && *--p == '\r')
- p--;
- *++p = '\0';
-
- if (tTd(9, 3))
- printf("getauthinfo: got %s\n", ibuf);
-
- /* parse result */
- p = strchr(ibuf, ':');
- if (p == NULL)
- {
- /* malformed response */
- goto noident;
- }
- while (isascii(*++p) && isspace(*p))
- continue;
- if (strncasecmp(p, "userid", 6) != 0)
- {
- /* presumably an error string */
- goto noident;
- }
- p += 6;
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p++ != ':')
- {
- /* either useridxx or malformed response */
- goto noident;
- }
-
- /* p now points to the OSTYPE field */
- while (isascii(*p) && isspace(*p))
- p++;
- ostype = p;
- p = strchr(p, ':');
- if (p == NULL)
- {
- /* malformed response */
- goto noident;
- }
- else
- {
- char *charset;
-
- *p = '\0';
- charset = strchr(ostype, ',');
- if (charset != NULL)
- *charset = '\0';
- }
-
- /* 1413 says don't do this -- but it's broken otherwise */
- while (isascii(*++p) && isspace(*p))
- continue;
-
- /* p now points to the authenticated name -- copy carefully */
- if (strncasecmp(ostype, "other", 5) == 0 &&
- (ostype[5] == ' ' || ostype[5] == '\0'))
- {
- snprintf(hbuf, sizeof hbuf, "IDENT:");
- cleanstrcpy(&hbuf[6], p, MAXNAME);
- }
- else
- cleanstrcpy(hbuf, p, MAXNAME);
- i = strlen(hbuf);
- snprintf(&hbuf[i], sizeof hbuf - i, "@%s",
- RealHostName == NULL ? "localhost" : RealHostName);
- goto postident;
-
-closeident:
- (void) close(s);
- clrevent(ev);
-
-noident:
- if (RealHostName == NULL)
- {
- if (tTd(9, 1))
- printf("getauthinfo: NULL\n");
- return NULL;
- }
- snprintf(hbuf, sizeof hbuf, "%s", RealHostName);
-
-postident:
-#if IP_SRCROUTE
-# ifndef GET_IPOPT_DST
-# define GET_IPOPT_DST(dst) (dst)
-# endif
- /*
- ** Extract IP source routing information.
- **
- ** Format of output for a connection from site a through b
- ** through c to d:
- ** loose: @site-c@site-b:site-a
- ** strict: !@site-c@site-b:site-a
- **
- ** o - pointer within ipopt_list structure.
- ** q - pointer within ls/ss rr route data
- ** p - pointer to hbuf
- */
-
- if (RealHostAddr.sa.sa_family == AF_INET)
- {
- SOCKOPT_LEN_T ipoptlen;
- int j;
- u_char *q;
- u_char *o;
- int l;
- struct in_addr addr;
- struct ipoption ipopt;
-
- ipoptlen = sizeof ipopt;
- if (getsockopt(fd, IPPROTO_IP, IP_OPTIONS,
- (char *) &ipopt, &ipoptlen) < 0)
- goto noipsr;
- if (ipoptlen == 0)
- goto noipsr;
- o = (u_char *) ipopt.ipopt_list;
- while (o != NULL && o < (u_char *) &ipopt + ipoptlen)
- {
- switch (*o)
- {
- case IPOPT_EOL:
- o = NULL;
- break;
-
- case IPOPT_NOP:
- o++;
- break;
-
- case IPOPT_SSRR:
- case IPOPT_LSRR:
- /*
- ** Source routing.
- ** o[0] is the option type (loose/strict).
- ** o[1] is the length of this option,
- ** including option type and
- ** length.
- ** o[2] is the pointer into the route
- ** data.
- ** o[3] begins the route data.
- */
-
- p = &hbuf[strlen(hbuf)];
- l = sizeof hbuf - (hbuf - p) - 6;
- snprintf(p, SPACELEFT(hbuf, p), " [%s@%.*s",
- *o == IPOPT_SSRR ? "!" : "",
- l > 240 ? 120 : l / 2,
- inet_ntoa(GET_IPOPT_DST(ipopt.ipopt_dst)));
- i = strlen(p);
- p += i;
- l -= strlen(p);
-
- j = o[1] / sizeof(struct in_addr) - 1;
-
- /* q skips length and router pointer to data */
- q = &o[3];
- for ( ; j >= 0; j--)
- {
- memcpy(&addr, q, sizeof(addr));
- snprintf(p, SPACELEFT(hbuf, p),
- "%c%.*s",
- j != 0 ? '@' : ':',
- l > 240 ? 120 :
- j == 0 ? l : l / 2,
- inet_ntoa(addr));
- i = strlen(p);
- p += i;
- l -= i + 1;
- q += sizeof(struct in_addr);
- }
- o += o[1];
- break;
-
- default:
- /* Skip over option */
- o += o[1];
- break;
- }
- }
- snprintf(p, SPACELEFT(hbuf, p), "]");
- goto postipsr;
- }
-
-noipsr:
-#endif
- if (RealHostName != NULL && RealHostName[0] != '[')
- {
- p = &hbuf[strlen(hbuf)];
- (void) snprintf(p, SPACELEFT(hbuf, p), " [%.100s]",
- anynet_ntoa(&RealHostAddr));
- }
- if (*may_be_forged)
- {
- p = &hbuf[strlen(hbuf)];
- (void) snprintf(p, SPACELEFT(hbuf, p), " (may be forged)");
- }
-
-#if IP_SRCROUTE
-postipsr:
-#endif
- if (tTd(9, 1))
- printf("getauthinfo: %s\n", hbuf);
- return hbuf;
-}
-\f/*
-** HOST_MAP_LOOKUP -- turn a hostname into canonical form
-**
-** Parameters:
-** map -- a pointer to this map.
-** name -- the (presumably unqualified) hostname.
-** av -- unused -- for compatibility with other mapping
-** functions.
-** statp -- an exit status (out parameter) -- set to
-** EX_TEMPFAIL if the name server is unavailable.
-**
-** Returns:
-** The mapping, if found.
-** NULL if no mapping found.
-**
-** Side Effects:
-** Looks up the host specified in hbuf. If it is not
-** the canonical name for that host, return the canonical
-** name (unless MF_MATCHONLY is set, which will cause the
-** status only to be returned).
-*/
-
-char *
-host_map_lookup(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- register struct hostent *hp;
- struct in_addr in_addr;
- char *cp;
- register STAB *s;
- char hbuf[MAXNAME + 1];
-
- /*
- ** See if we have already looked up this name. If so, just
- ** return it.
- */
-
- s = stab(name, ST_NAMECANON, ST_ENTER);
- if (bitset(NCF_VALID, s->s_namecanon.nc_flags))
- {
- if (tTd(9, 1))
- printf("host_map_lookup(%s) => CACHE %s\n",
- name,
- s->s_namecanon.nc_cname == NULL
- ? "NULL"
- : s->s_namecanon.nc_cname);
- errno = s->s_namecanon.nc_errno;
-#if NAMED_BIND
- h_errno = s->s_namecanon.nc_herrno;
-#endif
- *statp = s->s_namecanon.nc_stat;
- if (*statp == EX_TEMPFAIL)
- {
- CurEnv->e_status = "4.4.3";
- message("851 %s: Name server timeout",
- shortenstring(name, 33));
- }
- if (*statp != EX_OK)
- return NULL;
- if (s->s_namecanon.nc_cname == NULL)
- {
- syserr("host_map_lookup(%s): bogus NULL cache entry, errno = %d, h_errno = %d",
- name,
- s->s_namecanon.nc_errno,
- s->s_namecanon.nc_herrno);
- return NULL;
- }
- if (bitset(MF_MATCHONLY, map->map_mflags))
- cp = map_rewrite(map, name, strlen(name), NULL);
- else
- cp = map_rewrite(map,
- s->s_namecanon.nc_cname,
- strlen(s->s_namecanon.nc_cname),
- av);
- return cp;
- }
-
- /*
- ** If we are running without a regular network connection (usually
- ** dial-on-demand) and we are just queueing, we want to avoid DNS
- ** lookups because those could try to connect to a server.
- */
-
- if (CurEnv->e_sendmode == SM_DEFER)
- {
- if (tTd(9, 1))
- printf("host_map_lookup(%s) => DEFERRED\n", name);
- *statp = EX_TEMPFAIL;
- return NULL;
- }
-
- /*
- ** If first character is a bracket, then it is an address
- ** lookup. Address is copied into a temporary buffer to
- ** strip the brackets and to preserve name if address is
- ** unknown.
- */
-
- if (*name != '[')
- {
- if (tTd(9, 1))
- printf("host_map_lookup(%s) => ", name);
- s->s_namecanon.nc_flags |= NCF_VALID; /* will be soon */
- snprintf(hbuf, sizeof hbuf, "%s", name);
- if (getcanonname(hbuf, sizeof hbuf - 1, !HasWildcardMX))
- {
- if (tTd(9, 1))
- printf("%s\n", hbuf);
- s->s_namecanon.nc_stat = EX_OK;
- s->s_namecanon.nc_cname = newstr(hbuf);
- if (bitset(MF_MATCHONLY, map->map_mflags))
- cp = map_rewrite(map, name, strlen(name), NULL);
- else
- cp = map_rewrite(map, hbuf, strlen(hbuf), av);
- return cp;
- }
- else
- {
- s->s_namecanon.nc_errno = errno;
-#if NAMED_BIND
- s->s_namecanon.nc_herrno = h_errno;
- if (tTd(9, 1))
- printf("FAIL (%d)\n", h_errno);
- switch (h_errno)
- {
- case TRY_AGAIN:
- if (UseNameServer)
- {
- CurEnv->e_status = "4.4.3";
- message("851 %s: Name server timeout",
- shortenstring(name, 33));
- }
- *statp = EX_TEMPFAIL;
- break;
-
- case HOST_NOT_FOUND:
- case NO_DATA:
- *statp = EX_NOHOST;
- break;
-
- case NO_RECOVERY:
- *statp = EX_SOFTWARE;
- break;
-
- default:
- *statp = EX_UNAVAILABLE;
- break;
- }
-#else
- if (tTd(9, 1))
- printf("FAIL\n");
- *statp = EX_NOHOST;
-#endif
- s->s_namecanon.nc_stat = *statp;
- return NULL;
- }
- }
- if ((cp = strchr(name, ']')) == NULL)
- return (NULL);
- *cp = '\0';
- in_addr.s_addr = inet_addr(&name[1]);
- *cp = ']';
-
- /* nope -- ask the name server */
- hp = sm_gethostbyaddr((char *)&in_addr, INADDRSZ, AF_INET);
- s->s_namecanon.nc_errno = errno;
-#if NAMED_BIND
- s->s_namecanon.nc_herrno = h_errno;
-#endif
- s->s_namecanon.nc_flags |= NCF_VALID; /* will be soon */
- if (hp == NULL)
- {
- s->s_namecanon.nc_stat = *statp = EX_NOHOST;
- return (NULL);
- }
-
- /* found a match -- copy out */
- hp->h_name = denlstring((char *) hp->h_name, TRUE, TRUE);
- s->s_namecanon.nc_stat = *statp = EX_OK;
- s->s_namecanon.nc_cname = newstr(hp->h_name);
- if (bitset(MF_MATCHONLY, map->map_mflags))
- cp = map_rewrite(map, name, strlen(name), NULL);
- else
- cp = map_rewrite(map, hp->h_name, strlen(hp->h_name), av);
- return cp;
-}
-
-# else /* DAEMON */
-/* code for systems without sophisticated networking */
-
-/*
-** MYHOSTNAME -- stub version for case of no daemon code.
-**
-** Can't convert to upper case here because might be a UUCP name.
-**
-** Mark, you can change this to be anything you want......
-*/
-
-char **
-myhostname(hostbuf, size)
- char hostbuf[];
- int size;
-{
- register FILE *f;
-
- hostbuf[0] = '\0';
- f = fopen("/usr/include/whoami", "r");
- if (f != NULL)
- {
- (void) fgets(hostbuf, size, f);
- fixcrlf(hostbuf, TRUE);
- (void) fclose(f);
- }
- return (NULL);
-}
-\f/*
-** GETAUTHINFO -- get the real host name asociated with a file descriptor
-**
-** Parameters:
-** fd -- the descriptor
-** may_be_forged -- an outage that is set to TRUE if the
-** forward lookup of RealHostName does not match
-** RealHostAddr; set to FALSE if they do match.
-**
-** Returns:
-** The host name associated with this descriptor, if it can
-** be determined.
-** NULL otherwise.
-**
-** Side Effects:
-** none
-*/
-
-char *
-getauthinfo(fd, may_be_forged)
- int fd;
- bool *may_be_forged;
-{
- *may_be_forged = FALSE;
- return NULL;
-}
-\f/*
-** MAPHOSTNAME -- turn a hostname into canonical form
-**
-** Parameters:
-** map -- a pointer to the database map.
-** name -- a buffer containing a hostname.
-** avp -- a pointer to a (cf file defined) argument vector.
-** statp -- an exit status (out parameter).
-**
-** Returns:
-** mapped host name
-** FALSE otherwise.
-**
-** Side Effects:
-** Looks up the host specified in name. If it is not
-** the canonical name for that host, replace it with
-** the canonical name. If the name is unknown, or it
-** is already the canonical name, leave it unchanged.
-*/
-
-/*ARGSUSED*/
-char *
-host_map_lookup(map, name, avp, statp)
- MAP *map;
- char *name;
- char **avp;
- char *statp;
-{
- register struct hostent *hp;
- char *cp;
-
- hp = sm_gethostbyname(name);
- if (hp == NULL)
- {
- *statp = EX_NOHOST;
- return NULL;
- }
- if (bitset(MF_MATCHONLY, map->map_mflags))
- cp = map_rewrite(map, name, strlen(name), NULL);
- else
- cp = map_rewrite(map, hp->h_name, strlen(hp->h_name), avp);
- return cp;
-}
-
-#endif /* DAEMON */
-\f/*
-** HOST_MAP_INIT -- initialize host class structures
-*/
-
-bool
-host_map_init(map, args)
- MAP *map;
- char *args;
-{
- register char *p = args;
-
- for (;;)
- {
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p != '-')
- break;
- switch (*++p)
- {
- case 'a':
- map->map_app = ++p;
- break;
-
- case 'T':
- map->map_tapp = ++p;
- break;
-
- case 'm':
- map->map_mflags |= MF_MATCHONLY;
- break;
-
- case 't':
- map->map_mflags |= MF_NODEFER;
- break;
- }
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- if (*p != '\0')
- *p++ = '\0';
- }
- if (map->map_app != NULL)
- map->map_app = newstr(map->map_app);
- if (map->map_tapp != NULL)
- map->map_tapp = newstr(map->map_tapp);
- return TRUE;
-}
-\f/*
-** ANYNET_NTOA -- convert a network address to printable form.
-**
-** Parameters:
-** sap -- a pointer to a sockaddr structure.
-**
-** Returns:
-** A printable version of that sockaddr.
-*/
-
-#ifdef USE_SOCK_STREAM
-
-#if NETLINK
-# include <net/if_dl.h>
-#endif
-
-char *
-anynet_ntoa(sap)
- register SOCKADDR *sap;
-{
- register char *bp;
- register char *ap;
- int l;
- static char buf[100];
-
- /* check for null/zero family */
- if (sap == NULL)
- return "NULLADDR";
- if (sap->sa.sa_family == 0)
- return "0";
-
- switch (sap->sa.sa_family)
- {
-#if NETUNIX
- case AF_UNIX:
- if (sap->sunix.sun_path[0] != '\0')
- snprintf(buf, sizeof buf, "[UNIX: %.64s]",
- sap->sunix.sun_path);
- else
- snprintf(buf, sizeof buf, "[UNIX: localhost]");
- return buf;
-#endif
-
-#if NETINET
- case AF_INET:
- return inet_ntoa(sap->sin.sin_addr);
-#endif
-
-#if NETLINK
- case AF_LINK:
- snprintf(buf, sizeof buf, "[LINK: %s]",
- link_ntoa((struct sockaddr_dl *) &sap->sa));
- return buf;
-#endif
- default:
- /* this case is needed when nothing is #defined */
- /* in order to keep the switch syntactically correct */
- break;
- }
-
- /* unknown family -- just dump bytes */
- (void) snprintf(buf, sizeof buf, "Family %d: ", sap->sa.sa_family);
- bp = &buf[strlen(buf)];
- ap = sap->sa.sa_data;
- for (l = sizeof sap->sa.sa_data; --l >= 0; )
- {
- (void) snprintf(bp, SPACELEFT(buf, bp), "%02x:", *ap++ & 0377);
- bp += 3;
- }
- *--bp = '\0';
- return buf;
-}
-\f/*
-** HOSTNAMEBYANYADDR -- return name of host based on address
-**
-** Parameters:
-** sap -- SOCKADDR pointer
-**
-** Returns:
-** text representation of host name.
-**
-** Side Effects:
-** none.
-*/
-
-char *
-hostnamebyanyaddr(sap)
- register SOCKADDR *sap;
-{
- register struct hostent *hp;
- int saveretry;
-
-#if NAMED_BIND
- /* shorten name server timeout to avoid higher level timeouts */
- saveretry = _res.retry;
- _res.retry = 3;
-#endif /* NAMED_BIND */
-
- switch (sap->sa.sa_family)
- {
-#if NETINET
- case AF_INET:
- hp = sm_gethostbyaddr((char *) &sap->sin.sin_addr,
- INADDRSZ,
- AF_INET);
- break;
-#endif
-
-#if NETISO
- case AF_ISO:
- hp = sm_gethostbyaddr((char *) &sap->siso.siso_addr,
- sizeof sap->siso.siso_addr,
- AF_ISO);
- break;
-#endif
-
-#if NETUNIX
- case AF_UNIX:
- hp = NULL;
- break;
-#endif
-
- default:
- hp = sm_gethostbyaddr(sap->sa.sa_data,
- sizeof sap->sa.sa_data,
- sap->sa.sa_family);
- break;
- }
-
-#if NAMED_BIND
- _res.retry = saveretry;
-#endif /* NAMED_BIND */
-
- if (hp != NULL && hp->h_name[0] != '[' &&
- inet_addr(hp->h_name) == INADDR_NONE)
- return denlstring((char *) hp->h_name, TRUE, TRUE);
-#if NETUNIX
- else if (sap->sa.sa_family == AF_UNIX && sap->sunix.sun_path[0] == '\0')
- return "localhost";
-#endif
- else
- {
- /* produce a dotted quad */
- static char buf[203];
-
- (void) snprintf(buf, sizeof buf, "[%.200s]", anynet_ntoa(sap));
- return buf;
- }
-}
-
-#endif /* SOCK_STREAM */
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)deliver.c 8.367 (Berkeley) 1/18/1999";
-#endif /* not lint */
-
-#include "sendmail.h"
-#include <errno.h>
-#include <grp.h>
-#if NAMED_BIND
-#include <resolv.h>
-#endif
-
-#if HASSETUSERCONTEXT
-# include <login_cap.h>
-#endif
-
-#if SMTP
-extern char SmtpError[];
-#endif
-
-/*
-** SENDALL -- actually send all the messages.
-**
-** Parameters:
-** e -- the envelope to send.
-** mode -- the delivery mode to use. If SM_DEFAULT, use
-** the current e->e_sendmode.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Scans the send lists and sends everything it finds.
-** Delivers any appropriate error messages.
-** If we are running in a non-interactive mode, takes the
-** appropriate action.
-*/
-
-void
-sendall(e, mode)
- ENVELOPE *e;
- int mode;
-{
- register ADDRESS *q;
- char *owner;
- int otherowners;
- register ENVELOPE *ee;
- ENVELOPE *splitenv = NULL;
- int oldverbose = Verbose;
- bool somedeliveries = FALSE, expensive = FALSE;
- pid_t pid;
- void sendenvelope __P((ENVELOPE *, int));
-
- /*
- ** If this message is to be discarded, don't bother sending
- ** the message at all.
- */
-
- if (bitset(EF_DISCARD, e->e_flags))
- {
- if (tTd(13, 1))
- printf("sendall: discarding id %s\n", e->e_id);
- e->e_flags |= EF_CLRQUEUE;
- if (LogLevel > 4)
- sm_syslog(LOG_INFO, e->e_id, "discarded");
- markstats(e, NULL, TRUE);
- return;
- }
-
- /*
- ** If we have had global, fatal errors, don't bother sending
- ** the message at all if we are in SMTP mode. Local errors
- ** (e.g., a single address failing) will still cause the other
- ** addresses to be sent.
- */
-
- if (bitset(EF_FATALERRS, e->e_flags) &&
- (OpMode == MD_SMTP || OpMode == MD_DAEMON))
- {
- e->e_flags |= EF_CLRQUEUE;
- return;
- }
-
- /* determine actual delivery mode */
- if (mode == SM_DEFAULT)
- {
- mode = e->e_sendmode;
- if (mode != SM_VERIFY && mode != SM_DEFER &&
- shouldqueue(e->e_msgpriority, e->e_ctime))
- mode = SM_QUEUE;
- }
-
- if (tTd(13, 1))
- {
- extern void printenvflags __P((ENVELOPE *));
-
- printf("\n===== SENDALL: mode %c, id %s, e_from ",
- mode, e->e_id);
- printaddr(&e->e_from, FALSE);
- printf("\te_flags = ");
- printenvflags(e);
- printf("sendqueue:\n");
- printaddr(e->e_sendqueue, TRUE);
- }
-
- /*
- ** Do any preprocessing necessary for the mode we are running.
- ** Check to make sure the hop count is reasonable.
- ** Delete sends to the sender in mailing lists.
- */
-
- CurEnv = e;
- if (tTd(62, 1))
- checkfds(NULL);
-
- if (e->e_hopcount > MaxHopCount)
- {
- errno = 0;
-#if QUEUE
- queueup(e, mode == SM_QUEUE || mode == SM_DEFER);
-#endif
- e->e_flags |= EF_FATALERRS|EF_PM_NOTIFY|EF_CLRQUEUE;
- syserr("554 Too many hops %d (%d max): from %s via %s, to %s",
- e->e_hopcount, MaxHopCount, e->e_from.q_paddr,
- RealHostName == NULL ? "localhost" : RealHostName,
- e->e_sendqueue->q_paddr);
- e->e_sendqueue->q_status = "5.4.6";
- return;
- }
-
- /*
- ** Do sender deletion.
- **
- ** If the sender has the QQUEUEUP flag set, skip this.
- ** This can happen if the name server is hosed when you
- ** are trying to send mail. The result is that the sender
- ** is instantiated in the queue as a recipient.
- */
-
- if (!bitset(EF_METOO, e->e_flags) &&
- !bitset(QQUEUEUP, e->e_from.q_flags))
- {
- if (tTd(13, 5))
- {
- printf("sendall: QDONTSEND ");
- printaddr(&e->e_from, FALSE);
- }
- e->e_from.q_flags |= QDONTSEND;
- (void) recipient(&e->e_from, &e->e_sendqueue, 0, e);
- }
-
- /*
- ** Handle alias owners.
- **
- ** We scan up the q_alias chain looking for owners.
- ** We discard owners that are the same as the return path.
- */
-
- for (q = e->e_sendqueue; q != NULL; q = q->q_next)
- {
- register struct address *a;
-
- for (a = q; a != NULL && a->q_owner == NULL; a = a->q_alias)
- continue;
- if (a != NULL)
- q->q_owner = a->q_owner;
-
- if (q->q_owner != NULL &&
- !bitset(QDONTSEND, q->q_flags) &&
- strcmp(q->q_owner, e->e_from.q_paddr) == 0)
- q->q_owner = NULL;
- }
-
- if (tTd(13, 25))
- {
- printf("\nAfter first owner pass, sendq =\n");
- printaddr(e->e_sendqueue, TRUE);
- }
-
- owner = "";
- otherowners = 1;
- while (owner != NULL && otherowners > 0)
- {
- if (tTd(13, 28))
- printf("owner = \"%s\", otherowners = %d\n",
- owner, otherowners);
- owner = NULL;
- otherowners = bitset(EF_SENDRECEIPT, e->e_flags) ? 1 : 0;
-
- for (q = e->e_sendqueue; q != NULL; q = q->q_next)
- {
- if (tTd(13, 30))
- {
- printf("Checking ");
- printaddr(q, FALSE);
- }
- if (bitset(QDONTSEND, q->q_flags))
- {
- if (tTd(13, 30))
- printf(" ... QDONTSEND\n");
- continue;
- }
- if (tTd(13, 29) && !tTd(13, 30))
- {
- printf("Checking ");
- printaddr(q, FALSE);
- }
-
- if (q->q_owner != NULL)
- {
- if (owner == NULL)
- {
- if (tTd(13, 40))
- printf(" ... First owner = \"%s\"\n",
- q->q_owner);
- owner = q->q_owner;
- }
- else if (owner != q->q_owner)
- {
- if (strcmp(owner, q->q_owner) == 0)
- {
- if (tTd(13, 40))
- printf(" ... Same owner = \"%s\"\n",
- owner);
-
- /* make future comparisons cheap */
- q->q_owner = owner;
- }
- else
- {
- if (tTd(13, 40))
- printf(" ... Another owner \"%s\"\n",
- q->q_owner);
- otherowners++;
- }
- owner = q->q_owner;
- }
- else if (tTd(13, 40))
- printf(" ... Same owner = \"%s\"\n",
- owner);
- }
- else
- {
- if (tTd(13, 40))
- printf(" ... Null owner\n");
- otherowners++;
- }
-
- /*
- ** If this mailer is expensive, and if we don't
- ** want to make connections now, just mark these
- ** addresses and return. This is useful if we
- ** want to batch connections to reduce load. This
- ** will cause the messages to be queued up, and a
- ** daemon will come along to send the messages later.
- */
-
- if (bitset(QBADADDR|QQUEUEUP, q->q_flags))
- {
- if (tTd(13, 30))
- printf(" ... QBADADDR|QQUEUEUP\n");
- continue;
- }
- if (NoConnect && !Verbose &&
- bitnset(M_EXPENSIVE, q->q_mailer->m_flags))
- {
- if (tTd(13, 30))
- printf(" ... expensive\n");
- q->q_flags |= QQUEUEUP;
- expensive = TRUE;
- }
- else
- {
- if (tTd(13, 30))
- printf(" ... deliverable\n");
- somedeliveries = TRUE;
- }
- }
-
- if (owner != NULL && otherowners > 0)
- {
- extern HDR *copyheader __P((HDR *));
- extern ADDRESS *copyqueue __P((ADDRESS *));
- extern void dup_queue_file __P((ENVELOPE *, ENVELOPE *, int));
-
- /*
- ** Split this envelope into two.
- */
-
- ee = (ENVELOPE *) xalloc(sizeof(ENVELOPE));
- *ee = *e;
- ee->e_id = NULL;
- (void) queuename(ee, '\0');
-
- if (tTd(13, 1))
- printf("sendall: split %s into %s, owner = \"%s\", otherowners = %d\n",
- e->e_id, ee->e_id, owner, otherowners);
-
- ee->e_header = copyheader(e->e_header);
- ee->e_sendqueue = copyqueue(e->e_sendqueue);
- ee->e_errorqueue = copyqueue(e->e_errorqueue);
- ee->e_flags = e->e_flags & ~(EF_INQUEUE|EF_CLRQUEUE|EF_FATALERRS|EF_SENDRECEIPT|EF_RET_PARAM);
- ee->e_flags |= EF_NORECEIPT;
- setsender(owner, ee, NULL, '\0', TRUE);
- if (tTd(13, 5))
- {
- printf("sendall(split): QDONTSEND ");
- printaddr(&ee->e_from, FALSE);
- }
- ee->e_from.q_flags |= QDONTSEND;
- ee->e_dfp = NULL;
- ee->e_xfp = NULL;
- ee->e_errormode = EM_MAIL;
- ee->e_sibling = splitenv;
- splitenv = ee;
-
- for (q = e->e_sendqueue; q != NULL; q = q->q_next)
- {
- if (q->q_owner == owner)
- {
- q->q_flags |= QDONTSEND;
- q->q_flags &= ~(QQUEUEUP|QBADADDR);
- if (tTd(13, 6))
- printf("\t... stripping %s from original envelope\n",
- q->q_paddr);
- }
- }
- for (q = ee->e_sendqueue; q != NULL; q = q->q_next)
- {
- if (q->q_owner != owner)
- {
- q->q_flags |= QDONTSEND;
- q->q_flags &= ~(QQUEUEUP|QBADADDR);
- if (tTd(13, 6))
- printf("\t... dropping %s from cloned envelope\n",
- q->q_paddr);
- }
- else
- {
- /* clear DSN parameters */
- q->q_flags &= ~(QHASNOTIFY|Q_PINGFLAGS);
- q->q_flags |= DefaultNotify & ~QPINGONSUCCESS;
- if (tTd(13, 6))
- printf("\t... moving %s to cloned envelope\n",
- q->q_paddr);
- }
- }
-
- if (mode != SM_VERIFY && bitset(EF_HAS_DF, e->e_flags))
- dup_queue_file(e, ee, 'd');
- openxscript(ee);
- if (mode != SM_VERIFY && LogLevel > 4)
- sm_syslog(LOG_INFO, ee->e_id,
- "clone %s, owner=%s",
- e->e_id, owner);
- }
- }
-
- if (owner != NULL)
- {
- setsender(owner, e, NULL, '\0', TRUE);
- if (tTd(13, 5))
- {
- printf("sendall(owner): QDONTSEND ");
- printaddr(&e->e_from, FALSE);
- }
- e->e_from.q_flags |= QDONTSEND;
- e->e_errormode = EM_MAIL;
- e->e_flags |= EF_NORECEIPT;
- e->e_flags &= ~EF_FATALERRS;
- }
-
- /* if nothing to be delivered, just queue up everything */
- if (!somedeliveries && mode != SM_QUEUE && mode != SM_DEFER &&
- mode != SM_VERIFY)
- {
- if (tTd(13, 29))
- printf("No deliveries: auto-queuing\n");
- mode = SM_QUEUE;
-
- /* treat this as a delivery in terms of counting tries */
- e->e_dtime = curtime();
- if (!expensive)
- e->e_ntries++;
- for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
- {
- ee->e_dtime = curtime();
- if (!expensive)
- ee->e_ntries++;
- }
- }
-
-# if QUEUE
- if ((mode == SM_QUEUE || mode == SM_DEFER || mode == SM_FORK ||
- (mode != SM_VERIFY && SuperSafe)) &&
- (!bitset(EF_INQUEUE, e->e_flags) || splitenv != NULL))
- {
- /* be sure everything is instantiated in the queue */
- queueup(e, mode == SM_QUEUE || mode == SM_DEFER);
- for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
- queueup(ee, mode == SM_QUEUE || mode == SM_DEFER);
- }
-#endif /* QUEUE */
-
- if (tTd(62, 10))
- checkfds("after envelope splitting");
-
- /*
- ** If we belong in background, fork now.
- */
-
- if (tTd(13, 20))
- {
- printf("sendall: final mode = %c\n", mode);
- if (tTd(13, 21))
- {
- printf("\n================ Final Send Queue(s) =====================\n");
- printf("\n *** Envelope %s, e_from=%s ***\n",
- e->e_id, e->e_from.q_paddr);
- printaddr(e->e_sendqueue, TRUE);
- for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
- {
- printf("\n *** Envelope %s, e_from=%s ***\n",
- ee->e_id, ee->e_from.q_paddr);
- printaddr(ee->e_sendqueue, TRUE);
- }
- printf("==========================================================\n\n");
- }
- }
- switch (mode)
- {
- case SM_VERIFY:
- Verbose = 2;
- break;
-
- case SM_QUEUE:
- case SM_DEFER:
-# if HASFLOCK
- queueonly:
-# endif
- if (e->e_nrcpts > 0)
- e->e_flags |= EF_INQUEUE;
- dropenvelope(e, splitenv != NULL);
- for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
- {
- if (ee->e_nrcpts > 0)
- ee->e_flags |= EF_INQUEUE;
- dropenvelope(ee, FALSE);
- }
- return;
-
- case SM_FORK:
- if (e->e_xfp != NULL)
- (void) fflush(e->e_xfp);
-
-# if !HASFLOCK
- /*
- ** Since fcntl locking has the interesting semantic that
- ** the lock is owned by a process, not by an open file
- ** descriptor, we have to flush this to the queue, and
- ** then restart from scratch in the child.
- */
-
- {
- /* save id for future use */
- char *qid = e->e_id;
-
- /* now drop the envelope in the parent */
- e->e_flags |= EF_INQUEUE;
- dropenvelope(e, splitenv != NULL);
-
- /* arrange to reacquire lock after fork */
- e->e_id = qid;
- }
-
- for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
- {
- /* save id for future use */
- char *qid = ee->e_id;
-
- /* drop envelope in parent */
- ee->e_flags |= EF_INQUEUE;
- dropenvelope(ee, FALSE);
-
- /* and save qid for reacquisition */
- ee->e_id = qid;
- }
-
-# endif /* !HASFLOCK */
-
- pid = fork();
- if (pid < 0)
- {
-# if HASFLOCK
- goto queueonly;
-# else
- e->e_id = NULL;
- for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
- ee->e_id = NULL;
- return;
-# endif /* HASFLOCK */
- }
- else if (pid > 0)
- {
-# if HASFLOCK
- /* be sure we leave the temp files to our child */
- /* close any random open files in the envelope */
- closexscript(e);
- if (e->e_dfp != NULL)
- (void) xfclose(e->e_dfp, "sendenvelope dfp", e->e_id);
- e->e_dfp = NULL;
- e->e_flags &= ~EF_HAS_DF;
-
- /* can't call unlockqueue to avoid unlink of xfp */
- if (e->e_lockfp != NULL)
- (void) xfclose(e->e_lockfp, "sendenvelope lockfp", e->e_id);
- e->e_lockfp = NULL;
-# endif
-
- /* make sure the parent doesn't own the envelope */
- e->e_id = NULL;
-
- /* catch intermediate zombie */
- (void) waitfor(pid);
- return;
- }
-
- /* double fork to avoid zombies */
- pid = fork();
- if (pid > 0)
- exit(EX_OK);
-
- /* be sure we are immune from the terminal */
- disconnect(2, e);
-
- /* prevent parent from waiting if there was an error */
- if (pid < 0)
- {
-# if HASFLOCK
- e->e_flags |= EF_INQUEUE;
-# else
- e->e_id = NULL;
-# endif /* HASFLOCK */
- finis(TRUE, ExitStat);
- }
-
- /* be sure to give error messages in child */
- QuickAbort = FALSE;
-
- /*
- ** Close any cached connections.
- **
- ** We don't send the QUIT protocol because the parent
- ** still knows about the connection.
- **
- ** This should only happen when delivering an error
- ** message.
- */
-
- mci_flush(FALSE, NULL);
-
- /*
- ** Since the delivery may happen in a child and the parent
- ** does not wait, the parent may close the maps thereby
- ** removing any shared memory used by the map. Therefore,
- ** open a copy of the maps for the delivery process.
- */
-
- initmaps(FALSE, e);
-
-# if HASFLOCK
- break;
-# else
-
- /*
- ** Now reacquire and run the various queue files.
- */
-
- for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
- {
- ENVELOPE *sibling = ee->e_sibling;
-
- (void) dowork(ee->e_id, FALSE, FALSE, ee);
- ee->e_sibling = sibling;
- }
- (void) dowork(e->e_id, FALSE, FALSE, e);
- finis(TRUE, ExitStat);
-# endif /* !HASFLOCK */
- }
-
- sendenvelope(e, mode);
- dropenvelope(e, TRUE);
- for (ee = splitenv; ee != NULL; ee = ee->e_sibling)
- {
- CurEnv = ee;
- if (mode != SM_VERIFY)
- openxscript(ee);
- sendenvelope(ee, mode);
- dropenvelope(ee, TRUE);
- }
- CurEnv = e;
-
- Verbose = oldverbose;
- if (mode == SM_FORK)
- finis(TRUE, ExitStat);
-}
-
-void
-sendenvelope(e, mode)
- register ENVELOPE *e;
- int mode;
-{
- register ADDRESS *q;
- bool didany;
-
- if (tTd(13, 10))
- printf("sendenvelope(%s) e_flags=0x%lx\n",
- e->e_id == NULL ? "[NOQUEUE]" : e->e_id,
- e->e_flags);
- if (LogLevel > 80)
- sm_syslog(LOG_DEBUG, e->e_id,
- "sendenvelope, flags=0x%x",
- e->e_flags);
-
- /*
- ** If we have had global, fatal errors, don't bother sending
- ** the message at all if we are in SMTP mode. Local errors
- ** (e.g., a single address failing) will still cause the other
- ** addresses to be sent.
- */
-
- if (bitset(EF_FATALERRS, e->e_flags) &&
- (OpMode == MD_SMTP || OpMode == MD_DAEMON))
- {
- e->e_flags |= EF_CLRQUEUE;
- return;
- }
-
- /*
- ** Run through the list and send everything.
- **
- ** Set EF_GLOBALERRS so that error messages during delivery
- ** result in returned mail.
- */
-
- e->e_nsent = 0;
- e->e_flags |= EF_GLOBALERRS;
- define(macid("{envid}", NULL), e->e_envid, e);
- define(macid("{bodytype}", NULL), e->e_bodytype, e);
- didany = FALSE;
-
- /* now run through the queue */
- for (q = e->e_sendqueue; q != NULL; q = q->q_next)
- {
-#if XDEBUG
- char wbuf[MAXNAME + 20];
-
- (void) snprintf(wbuf, sizeof wbuf, "sendall(%.*s)",
- MAXNAME, q->q_paddr);
- checkfd012(wbuf);
-#endif
- if (mode == SM_VERIFY)
- {
- e->e_to = q->q_paddr;
- if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
- {
- if (q->q_host != NULL && q->q_host[0] != '\0')
- message("deliverable: mailer %s, host %s, user %s",
- q->q_mailer->m_name,
- q->q_host,
- q->q_user);
- else
- message("deliverable: mailer %s, user %s",
- q->q_mailer->m_name,
- q->q_user);
- }
- }
- else if (!bitset(QDONTSEND|QBADADDR, q->q_flags))
- {
- extern int deliver __P((ENVELOPE *, ADDRESS *));
-
-# if QUEUE
- /*
- ** Checkpoint the send list every few addresses
- */
-
- if (e->e_nsent >= CheckpointInterval)
- {
- queueup(e, FALSE);
- e->e_nsent = 0;
- }
-# endif /* QUEUE */
- (void) deliver(e, q);
- didany = TRUE;
- }
- }
- if (didany)
- {
- e->e_dtime = curtime();
- e->e_ntries++;
- }
-
-#if XDEBUG
- checkfd012("end of sendenvelope");
-#endif
-}
-\f/*
-** DUP_QUEUE_FILE -- duplicate a queue file into a split queue
-**
-** Parameters:
-** e -- the existing envelope
-** ee -- the new envelope
-** type -- the queue file type (e.g., 'd')
-**
-** Returns:
-** none
-*/
-
-void
-dup_queue_file(e, ee, type)
- struct envelope *e, *ee;
- int type;
-{
- char f1buf[MAXQFNAME], f2buf[MAXQFNAME];
-
- ee->e_dfp = NULL;
- ee->e_xfp = NULL;
- snprintf(f1buf, sizeof f1buf, "%s", queuename(e, type));
- snprintf(f2buf, sizeof f2buf, "%s", queuename(ee, type));
- if (link(f1buf, f2buf) < 0)
- {
- int saverrno = errno;
-
- syserr("sendall: link(%s, %s)", f1buf, f2buf);
- if (saverrno == EEXIST)
- {
- if (unlink(f2buf) < 0)
- {
- syserr("!sendall: unlink(%s): permanent",
- f2buf);
- /*NOTREACHED*/
- }
- if (link(f1buf, f2buf) < 0)
- {
- syserr("!sendall: link(%s, %s): permanent",
- f1buf, f2buf);
- /*NOTREACHED*/
- }
- }
- }
-}
-\f/*
-** DOFORK -- do a fork, retrying a couple of times on failure.
-**
-** This MUST be a macro, since after a vfork we are running
-** two processes on the same stack!!!
-**
-** Parameters:
-** none.
-**
-** Returns:
-** From a macro??? You've got to be kidding!
-**
-** Side Effects:
-** Modifies the ==> LOCAL <== variable 'pid', leaving:
-** pid of child in parent, zero in child.
-** -1 on unrecoverable error.
-**
-** Notes:
-** I'm awfully sorry this looks so awful. That's
-** vfork for you.....
-*/
-
-# define NFORKTRIES 5
-
-# ifndef FORK
-# define FORK fork
-# endif
-
-# define DOFORK(fORKfN) \
-{\
- register int i;\
-\
- for (i = NFORKTRIES; --i >= 0; )\
- {\
- pid = fORKfN();\
- if (pid >= 0)\
- break;\
- if (i > 0)\
- sleep((unsigned) NFORKTRIES - i);\
- }\
-}
-\f/*
-** DOFORK -- simple fork interface to DOFORK.
-**
-** Parameters:
-** none.
-**
-** Returns:
-** pid of child in parent.
-** zero in child.
-** -1 on error.
-**
-** Side Effects:
-** returns twice, once in parent and once in child.
-*/
-
-int
-dofork()
-{
- register pid_t pid = -1;
-
- DOFORK(fork);
- return (pid);
-}
-\f/*
-** DELIVER -- Deliver a message to a list of addresses.
-**
-** This routine delivers to everyone on the same host as the
-** user on the head of the list. It is clever about mailers
-** that don't handle multiple users. It is NOT guaranteed
-** that it will deliver to all these addresses however -- so
-** deliver should be called once for each address on the
-** list.
-**
-** Parameters:
-** e -- the envelope to deliver.
-** firstto -- head of the address list to deliver to.
-**
-** Returns:
-** zero -- successfully delivered.
-** else -- some failure, see ExitStat for more info.
-**
-** Side Effects:
-** The standard input is passed off to someone.
-*/
-
-#ifndef NO_UID
-# define NO_UID -1
-#endif
-#ifndef NO_GID
-# define NO_GID -1
-#endif
-
-int
-deliver(e, firstto)
- register ENVELOPE *e;
- ADDRESS *firstto;
-{
- char *host; /* host being sent to */
- char *user; /* user being sent to */
- char **pvp;
- register char **mvp;
- register char *p;
- register MAILER *m; /* mailer for this recipient */
- ADDRESS *volatile ctladdr;
- ADDRESS *volatile contextaddr = NULL;
- register MCI *volatile mci;
- register ADDRESS *to = firstto;
- volatile bool clever = FALSE; /* running user smtp to this mailer */
- ADDRESS *volatile tochain = NULL; /* users chain in this mailer call */
- int rcode; /* response code */
- int lmtp_rcode = EX_OK;
- char *firstsig; /* signature of firstto */
- pid_t pid = -1;
- char *volatile curhost;
- register u_short port = 0;
- time_t xstart;
- bool suidwarn;
- bool anyok; /* at least one address was OK */
- bool goodmxfound = FALSE; /* at least one MX was OK */
- int mpvect[2];
- int rpvect[2];
- char *pv[MAXPV+1];
- char tobuf[TOBUFSIZE]; /* text line of to people */
- char buf[MAXNAME + 1];
- char rpathbuf[MAXNAME + 1]; /* translated return path */
- extern int checkcompat __P((ADDRESS *, ENVELOPE *));
- extern void markfailure __P((ENVELOPE *, ADDRESS *, MCI *, int));
-
- errno = 0;
- if (bitset(QDONTSEND|QBADADDR|QQUEUEUP, to->q_flags))
- return (0);
-
- suidwarn = geteuid() == 0;
-
-#if NAMED_BIND
- /* unless interactive, try twice, over a minute */
- if (OpMode == MD_DAEMON || OpMode == MD_SMTP)
- {
- _res.retrans = 30;
- _res.retry = 2;
- }
-#endif
-
- m = to->q_mailer;
- host = to->q_host;
- CurEnv = e; /* just in case */
- e->e_statmsg = NULL;
-#if SMTP
- SmtpError[0] = '\0';
-#endif
- xstart = curtime();
-
- if (tTd(10, 1))
- printf("\n--deliver, id=%s, mailer=%s, host=`%s', first user=`%s'\n",
- e->e_id, m->m_name, host, to->q_user);
- if (tTd(10, 100))
- printopenfds(FALSE);
-
- /*
- ** Clear $&{client_*} macros if this is a bounce message to
- ** prevent rejection by check_compat ruleset.
- */
-
- if (bitset(EF_RESPONSE, e->e_flags))
- {
- define(macid("{client_name}", NULL), "", e);
- define(macid("{client_addr}", NULL), "", e);
- define(macid("{client_port}", NULL), "", e);
- }
-
- /*
- ** Do initial argv setup.
- ** Insert the mailer name. Notice that $x expansion is
- ** NOT done on the mailer name. Then, if the mailer has
- ** a picky -f flag, we insert it as appropriate. This
- ** code does not check for 'pv' overflow; this places a
- ** manifest lower limit of 4 for MAXPV.
- ** The from address rewrite is expected to make
- ** the address relative to the other end.
- */
-
- /* rewrite from address, using rewriting rules */
- rcode = EX_OK;
- if (bitnset(M_UDBENVELOPE, e->e_from.q_mailer->m_flags))
- p = e->e_sender;
- else
- p = e->e_from.q_paddr;
- p = remotename(p, m, RF_SENDERADDR|RF_CANONICAL, &rcode, e);
- if (strlen(p) >= (SIZE_T) sizeof rpathbuf)
- {
- p = shortenstring(p, MAXSHORTSTR);
- syserr("remotename: huge return %s", p);
- }
- snprintf(rpathbuf, sizeof rpathbuf, "%s", p);
- define('g', rpathbuf, e); /* translated return path */
- define('h', host, e); /* to host */
- Errors = 0;
- pvp = pv;
- *pvp++ = m->m_argv[0];
-
- /* insert -f or -r flag as appropriate */
- if (FromFlag && (bitnset(M_FOPT, m->m_flags) || bitnset(M_ROPT, m->m_flags)))
- {
- if (bitnset(M_FOPT, m->m_flags))
- *pvp++ = "-f";
- else
- *pvp++ = "-r";
- *pvp++ = newstr(rpathbuf);
- }
-
- /*
- ** Append the other fixed parts of the argv. These run
- ** up to the first entry containing "$u". There can only
- ** be one of these, and there are only a few more slots
- ** in the pv after it.
- */
-
- for (mvp = m->m_argv; (p = *++mvp) != NULL; )
- {
- /* can't use strchr here because of sign extension problems */
- while (*p != '\0')
- {
- if ((*p++ & 0377) == MACROEXPAND)
- {
- if (*p == 'u')
- break;
- }
- }
-
- if (*p != '\0')
- break;
-
- /* this entry is safe -- go ahead and process it */
- expand(*mvp, buf, sizeof buf, e);
- *pvp++ = newstr(buf);
- if (pvp >= &pv[MAXPV - 3])
- {
- syserr("554 Too many parameters to %s before $u", pv[0]);
- return (-1);
- }
- }
-
- /*
- ** If we have no substitution for the user name in the argument
- ** list, we know that we must supply the names otherwise -- and
- ** SMTP is the answer!!
- */
-
- if (*mvp == NULL)
- {
- /* running SMTP */
-# if SMTP
- clever = TRUE;
- *pvp = NULL;
-# else /* SMTP */
- /* oops! we don't implement SMTP */
- syserr("554 SMTP style mailer not implemented");
- return (EX_SOFTWARE);
-# endif /* SMTP */
- }
-
- /*
- ** At this point *mvp points to the argument with $u. We
- ** run through our address list and append all the addresses
- ** we can. If we run out of space, do not fret! We can
- ** always send another copy later.
- */
-
- tobuf[0] = '\0';
- e->e_to = tobuf;
- ctladdr = NULL;
- firstsig = hostsignature(firstto->q_mailer, firstto->q_host, e);
- for (; to != NULL; to = to->q_next)
- {
- /* avoid sending multiple recipients to dumb mailers */
- if (tobuf[0] != '\0' && !bitnset(M_MUSER, m->m_flags))
- break;
-
- /* if already sent or not for this host, don't send */
- if (bitset(QDONTSEND|QBADADDR|QQUEUEUP, to->q_flags) ||
- to->q_mailer != firstto->q_mailer ||
- strcmp(hostsignature(to->q_mailer, to->q_host, e), firstsig) != 0)
- continue;
-
- /* avoid overflowing tobuf */
- if (sizeof tobuf < (strlen(to->q_paddr) + strlen(tobuf) + 2))
- break;
-
- if (tTd(10, 1))
- {
- printf("\nsend to ");
- printaddr(to, FALSE);
- }
-
- /* compute effective uid/gid when sending */
- if (bitnset(M_RUNASRCPT, to->q_mailer->m_flags))
- contextaddr = ctladdr = getctladdr(to);
-
- if (tTd(10, 2))
- {
- printf("ctladdr=");
- printaddr(ctladdr, FALSE);
- }
-
- user = to->q_user;
- e->e_to = to->q_paddr;
- if (tTd(10, 5))
- {
- printf("deliver: QDONTSEND ");
- printaddr(to, FALSE);
- }
- to->q_flags |= QDONTSEND;
-
- /*
- ** Check to see that these people are allowed to
- ** talk to each other.
- */
-
- if (m->m_maxsize != 0 && e->e_msgsize > m->m_maxsize)
- {
- e->e_flags |= EF_NO_BODY_RETN;
- if (bitnset(M_LOCALMAILER, to->q_mailer->m_flags))
- to->q_status = "5.2.3";
- else
- to->q_status = "5.3.4";
- usrerr("552 Message is too large; %ld bytes max", m->m_maxsize);
- markfailure(e, to, NULL, EX_UNAVAILABLE);
- giveresponse(EX_UNAVAILABLE, m, NULL, ctladdr, xstart, e);
- continue;
- }
-#if NAMED_BIND
- h_errno = 0;
-#endif
-
- /* do config file checking of compatibility */
- rcode = rscheck("check_compat",
- e->e_from.q_paddr, to->q_paddr, e);
- if (rcode == EX_OK)
- {
- /* do in-code checking if not discarding */
- if (!bitset(EF_DISCARD, e->e_flags))
- rcode = checkcompat(to, e);
- }
- if (rcode != EX_OK)
- {
- markfailure(e, to, NULL, rcode);
- giveresponse(rcode, m, NULL, ctladdr, xstart, e);
- continue;
- }
- if (bitset(EF_DISCARD, e->e_flags))
- {
- if (tTd(10, 5))
- {
- printf("deliver: discarding recipient ");
- printaddr(to, FALSE);
- }
-
- /*
- ** Remove discard bit to prevent discard of
- ** future recipients
- */
- e->e_flags &= ~EF_DISCARD;
-
- continue;
- }
-
- /*
- ** Strip quote bits from names if the mailer is dumb
- ** about them.
- */
-
- if (bitnset(M_STRIPQ, m->m_flags))
- {
- stripquotes(user);
- stripquotes(host);
- }
-
- /* hack attack -- delivermail compatibility */
- if (m == ProgMailer && *user == '|')
- user++;
-
- /*
- ** If an error message has already been given, don't
- ** bother to send to this address.
- **
- ** >>>>>>>>>> This clause assumes that the local mailer
- ** >> NOTE >> cannot do any further aliasing; that
- ** >>>>>>>>>> function is subsumed by sendmail.
- */
-
- if (bitset(QBADADDR|QQUEUEUP, to->q_flags))
- continue;
-
- /*
- ** See if this user name is "special".
- ** If the user name has a slash in it, assume that this
- ** is a file -- send it off without further ado. Note
- ** that this type of addresses is not processed along
- ** with the others, so we fudge on the To person.
- */
-
- if (strcmp(m->m_mailer, "[FILE]") == 0)
- {
- define('u', user, e); /* to user */
- p = to->q_home;
- if (p == NULL && ctladdr != NULL)
- p = ctladdr->q_home;
- define('z', p, e); /* user's home */
- expand(m->m_argv[1], buf, sizeof buf, e);
- if (strlen(buf) > 0)
- rcode = mailfile(buf, m, ctladdr, SFF_CREAT, e);
- else
- {
- syserr("empty filename specification for mailer %s",
- m->m_name);
- rcode = EX_CONFIG;
- }
- giveresponse(rcode, m, NULL, ctladdr, xstart, e);
- markfailure(e, to, NULL, rcode);
- e->e_nsent++;
- if (rcode == EX_OK)
- {
- to->q_flags |= QSENT;
- if (bitnset(M_LOCALMAILER, m->m_flags) &&
- bitset(QPINGONSUCCESS, to->q_flags))
- {
- to->q_flags |= QDELIVERED;
- to->q_status = "2.1.5";
- fprintf(e->e_xfp, "%s... Successfully delivered\n",
- to->q_paddr);
- }
- }
- to->q_statdate = curtime();
- markstats(e, to, FALSE);
- continue;
- }
-
- /*
- ** Address is verified -- add this user to mailer
- ** argv, and add it to the print list of recipients.
- */
-
- /* link together the chain of recipients */
- to->q_tchain = tochain;
- tochain = to;
-
- /* create list of users for error messages */
- (void) strcat(tobuf, ",");
- (void) strcat(tobuf, to->q_paddr);
- define('u', user, e); /* to user */
- p = to->q_home;
- if (p == NULL && ctladdr != NULL)
- p = ctladdr->q_home;
- define('z', p, e); /* user's home */
-
- /*
- ** Expand out this user into argument list.
- */
-
- if (!clever)
- {
- expand(*mvp, buf, sizeof buf, e);
- *pvp++ = newstr(buf);
- if (pvp >= &pv[MAXPV - 2])
- {
- /* allow some space for trailing parms */
- break;
- }
- }
- }
-
- /* see if any addresses still exist */
- if (tobuf[0] == '\0')
- {
- define('g', (char *) NULL, e);
- return (0);
- }
-
- /* print out messages as full list */
- e->e_to = tobuf + 1;
-
- /*
- ** Fill out any parameters after the $u parameter.
- */
-
- while (!clever && *++mvp != NULL)
- {
- expand(*mvp, buf, sizeof buf, e);
- *pvp++ = newstr(buf);
- if (pvp >= &pv[MAXPV])
- syserr("554 deliver: pv overflow after $u for %s", pv[0]);
- }
- *pvp++ = NULL;
-
- /*
- ** Call the mailer.
- ** The argument vector gets built, pipes
- ** are created as necessary, and we fork & exec as
- ** appropriate.
- ** If we are running SMTP, we just need to clean up.
- */
-
- /*XXX this seems a bit wierd */
- if (ctladdr == NULL && m != ProgMailer && m != FileMailer &&
- bitset(QGOODUID, e->e_from.q_flags))
- ctladdr = &e->e_from;
-
-#if NAMED_BIND
- if (ConfigLevel < 2)
- _res.options &= ~(RES_DEFNAMES | RES_DNSRCH); /* XXX */
-#endif
-
- if (tTd(11, 1))
- {
- printf("openmailer:");
- printav(pv);
- }
- errno = 0;
-#if NAMED_BIND
- h_errno = 0;
-#endif
-
- CurHostName = NULL;
-
- /*
- ** Deal with the special case of mail handled through an IPC
- ** connection.
- ** In this case we don't actually fork. We must be
- ** running SMTP for this to work. We will return a
- ** zero pid to indicate that we are running IPC.
- ** We also handle a debug version that just talks to stdin/out.
- */
-
- curhost = NULL;
- SmtpPhase = NULL;
- mci = NULL;
-
-#if XDEBUG
- {
- char wbuf[MAXLINE];
-
- /* make absolutely certain 0, 1, and 2 are in use */
- snprintf(wbuf, sizeof wbuf, "%s... openmailer(%s)",
- shortenstring(e->e_to, MAXSHORTSTR), m->m_name);
- checkfd012(wbuf);
- }
-#endif
-
- /* check for 8-bit available */
- if (bitset(EF_HAS8BIT, e->e_flags) &&
- bitnset(M_7BITS, m->m_flags) &&
- (bitset(EF_DONT_MIME, e->e_flags) ||
- !(bitset(MM_MIME8BIT, MimeMode) ||
- (bitset(EF_IS_MIME, e->e_flags) &&
- bitset(MM_CVTMIME, MimeMode)))))
- {
- usrerr("554 Cannot send 8-bit data to 7-bit destination");
- rcode = EX_DATAERR;
- e->e_status = "5.6.3";
- goto give_up;
- }
-
- if (tTd(62, 8))
- checkfds("before delivery");
-
- /* check for Local Person Communication -- not for mortals!!! */
- if (strcmp(m->m_mailer, "[LPC]") == 0)
- {
- mci = (MCI *) xalloc(sizeof *mci);
- bzero((char *) mci, sizeof *mci);
- mci->mci_in = stdin;
- mci->mci_out = stdout;
- mci->mci_state = clever ? MCIS_OPENING : MCIS_OPEN;
- mci->mci_mailer = m;
- }
- else if (strcmp(m->m_mailer, "[IPC]") == 0 ||
- strcmp(m->m_mailer, "[TCP]") == 0)
- {
-#if DAEMON
- register int i;
-
- if (pv[0] == NULL || pv[1] == NULL || pv[1][0] == '\0')
- {
- syserr("null host name for %s mailer", m->m_mailer);
- rcode = EX_CONFIG;
- goto give_up;
- }
-
- CurHostName = pv[1];
- curhost = hostsignature(m, pv[1], e);
-
- if (curhost == NULL || curhost[0] == '\0')
- {
- syserr("null host signature for %s", pv[1]);
- rcode = EX_CONFIG;
- goto give_up;
- }
-
- if (!clever)
- {
- syserr("554 non-clever IPC");
- rcode = EX_CONFIG;
- goto give_up;
- }
- if (pv[2] != NULL)
- {
- port = htons(atoi(pv[2]));
- if (port == 0)
- {
- struct servent *sp = getservbyname(pv[2], "tcp");
-
- if (sp == NULL)
- syserr("Service %s unknown", pv[2]);
- else
- port = sp->s_port;
- }
- }
-tryhost:
- while (*curhost != '\0')
- {
- static char hostbuf[MAXNAME + 1];
- extern int makeconnection __P((char *, u_short, MCI *, ENVELOPE *));
-
- /* pull the next host from the signature */
- p = strchr(curhost, ':');
- if (p == NULL)
- p = (char *) &curhost[strlen(curhost)];
- if (p == curhost)
- {
- syserr("deliver: null host name in signature");
- curhost++;
- continue;
- }
- i = p - curhost;
- if (i >= sizeof hostbuf)
- i = sizeof hostbuf - 1;
- strncpy(hostbuf, curhost, i);
- hostbuf[i] = '\0';
- if (*p != '\0')
- p++;
- curhost = p;
-
- /* see if we already know that this host is fried */
- CurHostName = hostbuf;
- mci = mci_get(hostbuf, m);
- if (mci->mci_state != MCIS_CLOSED)
- {
- if (tTd(11, 1))
- {
- printf("openmailer: ");
- mci_dump(mci, FALSE);
- }
- CurHostName = mci->mci_host;
- message("Using cached %sSMTP connection to %s via %s...",
- bitset(MCIF_ESMTP, mci->mci_flags) ? "E" : "",
- hostbuf, m->m_name);
- break;
- }
- mci->mci_mailer = m;
- if (mci->mci_exitstat != EX_OK)
- {
- if (mci->mci_exitstat == EX_TEMPFAIL)
- goodmxfound = TRUE;
- continue;
- }
-
- if (mci_lock_host(mci) != EX_OK)
- {
- mci_setstat(mci, EX_TEMPFAIL, "4.4.5", NULL);
- goodmxfound = TRUE;
- continue;
- }
-
- /* try the connection */
- sm_setproctitle(TRUE, "%s %s: %s", e->e_id, hostbuf, "user open");
- if (port == 0)
- message("Connecting to %s via %s...",
- hostbuf, m->m_name);
- else
- message("Connecting to %s port %d via %s...",
- hostbuf, ntohs(port), m->m_name);
- i = makeconnection(hostbuf, port, mci, e);
- mci->mci_lastuse = curtime();
- mci->mci_exitstat = i;
- mci->mci_errno = errno;
-#if NAMED_BIND
- mci->mci_herrno = h_errno;
-#endif
- if (i == EX_OK)
- {
- goodmxfound = TRUE;
- mci->mci_state = MCIS_OPENING;
- mci_cache(mci);
- if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d === CONNECT %s\n",
- (int) getpid(), hostbuf);
- break;
- }
- else
- {
- if (tTd(11, 1))
- printf("openmailer: makeconnection => stat=%d, errno=%d\n",
- i, errno);
- if (i == EX_TEMPFAIL)
- goodmxfound = TRUE;
- mci_unlock_host(mci);
- }
-
- /* enter status of this host */
- setstat(i);
-
- /* should print some message here for -v mode */
- }
- if (mci == NULL)
- {
- syserr("deliver: no host name");
- rcode = EX_SOFTWARE;
- goto give_up;
- }
- mci->mci_pid = 0;
-#else /* no DAEMON */
- syserr("554 openmailer: no IPC");
- if (tTd(11, 1))
- printf("openmailer: NULL\n");
- rcode = EX_UNAVAILABLE;
- goto give_up;
-#endif /* DAEMON */
- }
- else
- {
- /* flush any expired connections */
- (void) mci_scan(NULL);
- mci = NULL;
-
-#if SMTP
- if (bitnset(M_LMTP, m->m_flags))
- {
- /* try to get a cached connection */
- mci = mci_get(m->m_name, m);
- if (mci->mci_host == NULL)
- mci->mci_host = m->m_name;
- CurHostName = mci->mci_host;
- if (mci->mci_state != MCIS_CLOSED)
- {
- message("Using cached LMTP connection for %s...",
- m->m_name);
- goto do_transfer;
- }
- }
-#endif
-
- /* announce the connection to verbose listeners */
- if (host == NULL || host[0] == '\0')
- message("Connecting to %s...", m->m_name);
- else
- message("Connecting to %s via %s...", host, m->m_name);
- if (TrafficLogFile != NULL)
- {
- char **av;
-
- fprintf(TrafficLogFile, "%05d === EXEC", (int) getpid());
- for (av = pv; *av != NULL; av++)
- fprintf(TrafficLogFile, " %s", *av);
- fprintf(TrafficLogFile, "\n");
- }
-
-#if XDEBUG
- checkfd012("before creating mail pipe");
-#endif
-
- /* create a pipe to shove the mail through */
- if (pipe(mpvect) < 0)
- {
- syserr("%s... openmailer(%s): pipe (to mailer)",
- shortenstring(e->e_to, MAXSHORTSTR), m->m_name);
- if (tTd(11, 1))
- printf("openmailer: NULL\n");
- rcode = EX_OSERR;
- goto give_up;
- }
-
-#if XDEBUG
- /* make sure we didn't get one of the standard I/O files */
- if (mpvect[0] < 3 || mpvect[1] < 3)
- {
- syserr("%s... openmailer(%s): bogus mpvect %d %d",
- shortenstring(e->e_to, MAXSHORTSTR), m->m_name,
- mpvect[0], mpvect[1]);
- printopenfds(TRUE);
- if (tTd(11, 1))
- printf("openmailer: NULL\n");
- rcode = EX_OSERR;
- goto give_up;
- }
-
- /* make sure system call isn't dead meat */
- checkfdopen(mpvect[0], "mpvect[0]");
- checkfdopen(mpvect[1], "mpvect[1]");
- if (mpvect[0] == mpvect[1] ||
- (e->e_lockfp != NULL &&
- (mpvect[0] == fileno(e->e_lockfp) ||
- mpvect[1] == fileno(e->e_lockfp))))
- {
- if (e->e_lockfp == NULL)
- syserr("%s... openmailer(%s): overlapping mpvect %d %d",
- shortenstring(e->e_to, MAXSHORTSTR),
- m->m_name, mpvect[0], mpvect[1]);
- else
- syserr("%s... openmailer(%s): overlapping mpvect %d %d, lockfp = %d",
- shortenstring(e->e_to, MAXSHORTSTR),
- m->m_name, mpvect[0], mpvect[1],
- fileno(e->e_lockfp));
- }
-#endif
-
- /* if this mailer speaks smtp, create a return pipe */
-#if SMTP
- if (clever)
- {
- if (pipe(rpvect) < 0)
- {
- syserr("%s... openmailer(%s): pipe (from mailer)",
- shortenstring(e->e_to, MAXSHORTSTR),
- m->m_name);
- (void) close(mpvect[0]);
- (void) close(mpvect[1]);
- if (tTd(11, 1))
- printf("openmailer: NULL\n");
- rcode = EX_OSERR;
- goto give_up;
- }
-# if XDEBUG
- checkfdopen(rpvect[0], "rpvect[0]");
- checkfdopen(rpvect[1], "rpvect[1]");
-# endif
- }
-#endif
-
- /*
- ** Actually fork the mailer process.
- ** DOFORK is clever about retrying.
- **
- ** Dispose of SIGCHLD signal catchers that may be laying
- ** around so that endmail will get it.
- */
-
- if (e->e_xfp != NULL)
- (void) fflush(e->e_xfp); /* for debugging */
- (void) fflush(stdout);
- (void) setsignal(SIGCHLD, SIG_DFL);
- DOFORK(FORK);
- /* pid is set by DOFORK */
- if (pid < 0)
- {
- /* failure */
- syserr("%s... openmailer(%s): cannot fork",
- shortenstring(e->e_to, MAXSHORTSTR), m->m_name);
- (void) close(mpvect[0]);
- (void) close(mpvect[1]);
-#if SMTP
- if (clever)
- {
- (void) close(rpvect[0]);
- (void) close(rpvect[1]);
- }
-#endif
- if (tTd(11, 1))
- printf("openmailer: NULL\n");
- rcode = EX_OSERR;
- goto give_up;
- }
- else if (pid == 0)
- {
- int i;
- int saveerrno;
- int new_euid = NO_UID;
- int new_ruid = NO_UID;
- int new_gid = NO_GID;
- struct stat stb;
- extern int DtableSize;
-
- if (e->e_lockfp != NULL)
- (void) close(fileno(e->e_lockfp));
-
- /* child -- set up input & exec mailer */
- (void) setsignal(SIGINT, SIG_IGN);
- (void) setsignal(SIGHUP, SIG_IGN);
- (void) setsignal(SIGTERM, SIG_DFL);
-
- if (m != FileMailer || stat(tochain->q_user, &stb) < 0)
- stb.st_mode = 0;
-
-#if HASSETUSERCONTEXT
- /*
- ** Set user resources.
- */
-
- if (contextaddr != NULL)
- {
- struct passwd *pwd;
-
- if (contextaddr->q_ruser != NULL)
- 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);
- }
-#endif
-
- /* tweak niceness */
- if (m->m_nice != 0)
- nice(m->m_nice);
-
- /* reset group id */
- if (bitnset(M_SPECIFIC_UID, m->m_flags))
- new_gid = m->m_gid;
- else if (bitset(S_ISGID, stb.st_mode))
- new_gid = stb.st_gid;
- else if (ctladdr != NULL && ctladdr->q_gid != 0)
- {
- if (!DontInitGroups)
- {
- char *u = ctladdr->q_ruser;
-
- if (u == NULL)
- u = ctladdr->q_user;
-
- if (initgroups(u, ctladdr->q_gid) == -1 && suidwarn)
- syserr("openmailer: initgroups(%s, %d) failed",
- u, ctladdr->q_gid);
- }
- else
- {
- GIDSET_T gidset[1];
-
- gidset[0] = ctladdr->q_gid;
- if (setgroups(1, gidset) == -1 && suidwarn)
- syserr("openmailer: setgroups() failed");
- }
- new_gid = ctladdr->q_gid;
- }
- else
- {
- if (!DontInitGroups)
- {
- if (initgroups(DefUser, DefGid) == -1 && suidwarn)
- syserr("openmailer: initgroups(%s, %d) failed",
- DefUser, DefGid);
- }
- else
- {
- GIDSET_T gidset[1];
-
- gidset[0] = DefGid;
- if (setgroups(1, gidset) == -1 && suidwarn)
- syserr("openmailer: setgroups() failed");
- }
- if (m->m_gid == 0)
- new_gid = DefGid;
- else
- new_gid = m->m_gid;
- }
- if (new_gid != NO_GID && setgid(new_gid) < 0 && suidwarn)
- syserr("openmailer: setgid(%ld) failed",
- (long) new_gid);
-
- /* reset user id */
- endpwent();
- if (bitnset(M_SPECIFIC_UID, m->m_flags))
- new_euid = m->m_uid;
- else if (bitset(S_ISUID, stb.st_mode))
- new_ruid = stb.st_uid;
- else if (ctladdr != NULL && ctladdr->q_uid != 0)
- new_ruid = ctladdr->q_uid;
- else if (m->m_uid != 0)
- new_ruid = m->m_uid;
- else
- new_ruid = DefUid;
- if (new_euid != NO_UID)
- {
- vendor_set_uid(new_euid);
-#if USESETEUID
- if (seteuid(new_euid) < 0 && suidwarn)
- syserr("openmailer: seteuid(%ld) failed",
- (long) new_euid);
-#else
-# if HASSETREUID
- if (setreuid(new_ruid, new_euid) < 0 && suidwarn)
- syserr("openmailer: setreuid(%ld, %ld) failed",
- (long) new_ruid, (long) new_euid);
-# else
- if (new_euid != geteuid() && setuid(new_euid) < 0 && suidwarn)
- syserr("openmailer: setuid(%ld) failed",
- (long) new_euid);
-# endif
-#endif
- }
- else if (new_ruid != NO_UID)
- {
- vendor_set_uid(new_ruid);
- if (setuid(new_ruid) < 0 && suidwarn)
- syserr("openmailer: setuid(%ld) failed",
- (long) new_ruid);
- }
-
- if (tTd(11, 2))
- printf("openmailer: running as r/euid=%d/%d\n",
- (int) getuid(), (int) geteuid());
-
- /* move into some "safe" directory */
- if (m->m_execdir != NULL)
- {
- char *q;
- char buf[MAXLINE + 1];
-
- for (p = m->m_execdir; p != NULL; p = q)
- {
- q = strchr(p, ':');
- if (q != NULL)
- *q = '\0';
- expand(p, buf, sizeof buf, e);
- if (q != NULL)
- *q++ = ':';
- if (tTd(11, 20))
- printf("openmailer: trydir %s\n",
- buf);
- if (buf[0] != '\0' && chdir(buf) >= 0)
- break;
- }
- }
-
- /* arrange to filter std & diag output of command */
-#if SMTP
- if (clever)
- {
- (void) close(rpvect[0]);
- if (dup2(rpvect[1], STDOUT_FILENO) < 0)
- {
- syserr("%s... openmailer(%s): cannot dup pipe %d for stdout",
- shortenstring(e->e_to, MAXSHORTSTR),
- m->m_name, rpvect[1]);
- _exit(EX_OSERR);
- }
- (void) close(rpvect[1]);
- }
- else
- {
- /* put mailer output in transcript */
- if (dup2(fileno(e->e_xfp), STDOUT_FILENO) < 0)
- {
- syserr("%s... openmailer(%s): cannot dup xscript %d for stdout",
- shortenstring(e->e_to, MAXSHORTSTR),
- m->m_name, fileno(e->e_xfp));
- _exit(EX_OSERR);
- }
- }
-#endif
- if (dup2(STDOUT_FILENO, STDERR_FILENO) < 0)
- {
- syserr("%s... openmailer(%s): cannot dup stdout for stderr",
- shortenstring(e->e_to, MAXSHORTSTR),
- m->m_name);
- _exit(EX_OSERR);
- }
-
- /* arrange to get standard input */
- (void) close(mpvect[1]);
- if (dup2(mpvect[0], STDIN_FILENO) < 0)
- {
- syserr("%s... openmailer(%s): cannot dup pipe %d for stdin",
- shortenstring(e->e_to, MAXSHORTSTR),
- m->m_name, mpvect[0]);
- _exit(EX_OSERR);
- }
- (void) close(mpvect[0]);
-
- /* arrange for all the files to be closed */
- for (i = 3; i < DtableSize; i++)
- {
- register int j;
-
- if ((j = fcntl(i, F_GETFD, 0)) != -1)
- (void) fcntl(i, F_SETFD, j | 1);
- }
-
- /* run disconnected from terminal */
- (void) setsid();
-
- /* try to execute the mailer */
- execve(m->m_mailer, (ARGV_T) pv, (ARGV_T) UserEnviron);
- saveerrno = errno;
- syserr("Cannot exec %s", m->m_mailer);
- if (bitnset(M_LOCALMAILER, m->m_flags) ||
- transienterror(saveerrno))
- _exit(EX_OSERR);
- _exit(EX_UNAVAILABLE);
- }
-
- /*
- ** Set up return value.
- */
-
- if (mci == NULL)
- {
- mci = (MCI *) xalloc(sizeof *mci);
- bzero((char *) mci, sizeof *mci);
- }
- mci->mci_mailer = m;
- if (clever)
- {
- mci->mci_state = MCIS_OPENING;
- mci_cache(mci);
- }
- else
- {
- mci->mci_state = MCIS_OPEN;
- }
- mci->mci_pid = pid;
- (void) close(mpvect[0]);
- mci->mci_out = fdopen(mpvect[1], "w");
- if (mci->mci_out == NULL)
- {
- syserr("deliver: cannot create mailer output channel, fd=%d",
- mpvect[1]);
- (void) close(mpvect[1]);
-#if SMTP
- if (clever)
- {
- (void) close(rpvect[0]);
- (void) close(rpvect[1]);
- }
-#endif
- rcode = EX_OSERR;
- goto give_up;
- }
-#if SMTP
- if (clever)
- {
- (void) close(rpvect[1]);
- mci->mci_in = fdopen(rpvect[0], "r");
- if (mci->mci_in == NULL)
- {
- syserr("deliver: cannot create mailer input channel, fd=%d",
- mpvect[1]);
- (void) close(rpvect[0]);
- fclose(mci->mci_out);
- mci->mci_out = NULL;
- rcode = EX_OSERR;
- goto give_up;
- }
- }
- else
-#endif
- {
- mci->mci_flags |= MCIF_TEMP;
- mci->mci_in = NULL;
- }
- }
-
- /*
- ** If we are in SMTP opening state, send initial protocol.
- */
-
- if (bitnset(M_7BITS, m->m_flags) &&
- (!clever || mci->mci_state == MCIS_OPENING))
- mci->mci_flags |= MCIF_7BIT;
-#if SMTP
- if (clever && mci->mci_state != MCIS_CLOSED)
- {
- extern void smtpinit __P((MAILER *, MCI *, ENVELOPE *));
-
- smtpinit(m, mci, e);
- }
-#endif
-
-do_transfer:
- /* clear out per-message flags from connection structure */
- mci->mci_flags &= ~(MCIF_CVT7TO8|MCIF_CVT8TO7);
-
- if (bitset(EF_HAS8BIT, e->e_flags) &&
- !bitset(EF_DONT_MIME, e->e_flags) &&
- bitnset(M_7BITS, m->m_flags))
- mci->mci_flags |= MCIF_CVT8TO7;
-
-#if MIME7TO8
- if (bitnset(M_MAKE8BIT, m->m_flags) &&
- !bitset(MCIF_7BIT, mci->mci_flags) &&
- (p = hvalue("Content-Transfer-Encoding", e->e_header)) != NULL &&
- (strcasecmp(p, "quoted-printable") == 0 ||
- strcasecmp(p, "base64") == 0) &&
- (p = hvalue("Content-Type", e->e_header)) != NULL)
- {
- /* may want to convert 7 -> 8 */
- /* XXX should really parse it here -- and use a class XXX */
- if (strncasecmp(p, "text/plain", 10) == 0 &&
- (p[10] == '\0' || p[10] == ' ' || p[10] == ';'))
- mci->mci_flags |= MCIF_CVT7TO8;
- }
-#endif
-
- if (tTd(11, 1))
- {
- printf("openmailer: ");
- mci_dump(mci, FALSE);
- }
-
- if (mci->mci_state != MCIS_OPEN)
- {
- /* couldn't open the mailer */
- rcode = mci->mci_exitstat;
- errno = mci->mci_errno;
-#if NAMED_BIND
- h_errno = mci->mci_herrno;
-#endif
- if (rcode == EX_OK)
- {
- /* shouldn't happen */
- syserr("554 deliver: mci=%lx rcode=%d errno=%d state=%d sig=%s",
- (long) mci, rcode, errno, mci->mci_state,
- firstsig);
- mci_dump_all(TRUE);
- rcode = EX_SOFTWARE;
- }
-#if DAEMON
- else if (curhost != NULL && *curhost != '\0')
- {
- /* try next MX site */
- goto tryhost;
- }
-#endif
- }
- else if (!clever)
- {
- /*
- ** Format and send message.
- */
-
- mci->mci_contentlen = 0;
- putfromline(mci, e);
- (*e->e_puthdr)(mci, e->e_header, e, M87F_OUTER);
- (*e->e_putbody)(mci, e, NULL);
-
- /* get the exit status */
- rcode = endmailer(mci, e, pv);
- }
- else
-#if SMTP
- {
- extern int smtpmailfrom __P((MAILER *, MCI *, ENVELOPE *));
- extern int smtprcpt __P((ADDRESS *, MAILER *, MCI *, ENVELOPE *));
- extern int smtpdata __P((MAILER *, MCI *, ENVELOPE *));
-
- /*
- ** Send the MAIL FROM: protocol
- */
-
- rcode = smtpmailfrom(m, mci, e);
- if (rcode == EX_OK)
- {
- register char *t = tobuf;
- register int i;
-
- /* send the recipient list */
- tobuf[0] = '\0';
- for (to = tochain; to != NULL; to = to->q_tchain)
- {
- e->e_to = to->q_paddr;
- if (strlen(to->q_paddr) + (t - tobuf) + 2 > sizeof tobuf)
- {
- /* not enough room */
- continue;
- }
- else if ((i = smtprcpt(to, m, mci, e)) != EX_OK)
- {
- markfailure(e, to, mci, i);
- giveresponse(i, m, mci, ctladdr, xstart, e);
- }
- else
- {
- *t++ = ',';
- for (p = to->q_paddr; *p; *t++ = *p++)
- continue;
- *t = '\0';
- }
- }
-
- /* now send the data */
- if (tobuf[0] == '\0')
- {
- rcode = EX_OK;
- e->e_to = NULL;
- if (bitset(MCIF_CACHED, mci->mci_flags))
- smtprset(m, mci, e);
- }
- else
- {
- e->e_to = tobuf + 1;
- rcode = smtpdata(m, mci, e);
- }
- }
-# if DAEMON
- if (rcode == EX_TEMPFAIL && curhost != NULL && *curhost != '\0')
- {
- /* try next MX site */
- goto tryhost;
- }
-# endif
- }
-#else /* not SMTP */
- {
- syserr("554 deliver: need SMTP compiled to use clever mailer");
- rcode = EX_CONFIG;
- goto give_up;
- }
-#endif /* SMTP */
-#if NAMED_BIND
- if (ConfigLevel < 2)
- _res.options |= RES_DEFNAMES | RES_DNSRCH; /* XXX */
-#endif
-
- if (tTd(62, 1))
- checkfds("after delivery");
-
- /*
- ** Do final status disposal.
- ** We check for something in tobuf for the SMTP case.
- ** If we got a temporary failure, arrange to queue the
- ** addressees.
- */
-
- give_up:
-#if SMTP
- if (bitnset(M_LMTP, m->m_flags))
- {
- lmtp_rcode = rcode;
- tobuf[0] = '\0';
- anyok = FALSE;
- }
- else
-#endif
- anyok = rcode == EX_OK;
-
- for (to = tochain; to != NULL; to = to->q_tchain)
- {
- /* see if address already marked */
- if (bitset(QBADADDR|QQUEUEUP, to->q_flags))
- continue;
-
-#if SMTP
- /* if running LMTP, get the status for each address */
- if (bitnset(M_LMTP, m->m_flags))
- {
- extern int smtpgetstat __P((MAILER *, MCI *, ENVELOPE *));
-
- if (lmtp_rcode == EX_OK)
- rcode = smtpgetstat(m, mci, e);
- if (rcode == EX_OK)
- {
- if (strlen(to->q_paddr) + strlen(tobuf) + 2 > sizeof tobuf)
- {
- syserr("LMTP tobuf overflow");
- }
- else
- {
- strcat(tobuf, ",");
- strcat(tobuf, to->q_paddr);
- }
- anyok = TRUE;
- }
- else
- {
- e->e_to = to->q_paddr;
- markfailure(e, to, mci, rcode);
- giveresponse(rcode, m, mci, ctladdr, xstart, e);
- e->e_to = tobuf + 1;
- continue;
- }
- }
- else
-#endif
- {
- /* mark bad addresses */
- if (rcode != EX_OK)
- {
- if (goodmxfound && rcode == EX_NOHOST)
- rcode = EX_TEMPFAIL;
- markfailure(e, to, mci, rcode);
- continue;
- }
- }
-
- /* successful delivery */
- to->q_flags |= QSENT;
- to->q_statdate = curtime();
- e->e_nsent++;
- if (bitnset(M_LOCALMAILER, m->m_flags) &&
- bitset(QPINGONSUCCESS, to->q_flags))
- {
- to->q_flags |= QDELIVERED;
- to->q_status = "2.1.5";
- fprintf(e->e_xfp, "%s... Successfully delivered\n",
- to->q_paddr);
- }
- else if (bitset(QPINGONSUCCESS, to->q_flags) &&
- bitset(QPRIMARY, to->q_flags) &&
- !bitset(MCIF_DSN, mci->mci_flags))
- {
- to->q_flags |= QRELAYED;
- fprintf(e->e_xfp, "%s... relayed; expect no further notifications\n",
- to->q_paddr);
- }
- }
-
-#if SMTP
- if (bitnset(M_LMTP, m->m_flags))
- {
- /*
- ** Global information applies to the last recipient only;
- ** clear it out to avoid bogus errors.
- */
-
- rcode = EX_OK;
- e->e_statmsg = NULL;
-
- /* reset the mci state for the next transaction */
- if (mci != NULL && mci->mci_state == MCIS_ACTIVE)
- mci->mci_state = MCIS_OPEN;
- }
-#endif
-
- if (tobuf[0] != '\0')
- giveresponse(rcode, m, mci, ctladdr, xstart, e);
- if (anyok)
- markstats(e, tochain, FALSE);
- mci_store_persistent(mci);
-
-#if SMTP
- /* now close the connection */
- if (clever && mci != NULL && mci->mci_state != MCIS_CLOSED &&
- !bitset(MCIF_CACHED, mci->mci_flags))
- smtpquit(m, mci, e);
-#endif
-
- /*
- ** Restore state and return.
- */
-
-#if XDEBUG
- {
- char wbuf[MAXLINE];
-
- /* make absolutely certain 0, 1, and 2 are in use */
- snprintf(wbuf, sizeof wbuf, "%s... end of deliver(%s)",
- e->e_to == NULL ? "NO-TO-LIST"
- : shortenstring(e->e_to, MAXSHORTSTR),
- m->m_name);
- checkfd012(wbuf);
- }
-#endif
-
- errno = 0;
- define('g', (char *) NULL, e);
- return (rcode);
-}
-\f/*
-** MARKFAILURE -- mark a failure on a specific address.
-**
-** Parameters:
-** e -- the envelope we are sending.
-** q -- the address to mark.
-** mci -- mailer connection information.
-** rcode -- the code signifying the particular failure.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** marks the address (and possibly the envelope) with the
-** failure so that an error will be returned or
-** the message will be queued, as appropriate.
-*/
-
-void
-markfailure(e, q, mci, rcode)
- register ENVELOPE *e;
- register ADDRESS *q;
- register MCI *mci;
- int rcode;
-{
- char *stat = NULL;
-
- switch (rcode)
- {
- case EX_OK:
- break;
-
- case EX_TEMPFAIL:
- case EX_IOERR:
- case EX_OSERR:
- q->q_flags |= QQUEUEUP;
- q->q_flags &= ~QDONTSEND;
- break;
-
- default:
- q->q_flags |= QBADADDR;
- break;
- }
-
- /* find most specific error code possible */
- if (mci != NULL && mci->mci_status != NULL)
- {
- q->q_status = mci->mci_status;
- if (mci->mci_rstatus != NULL)
- q->q_rstatus = newstr(mci->mci_rstatus);
- else
- q->q_rstatus = NULL;
- }
- else if (e->e_status != NULL)
- {
- q->q_status = e->e_status;
- q->q_rstatus = NULL;
- }
- else
- {
- switch (rcode)
- {
- case EX_USAGE:
- stat = "5.5.4";
- break;
-
- case EX_DATAERR:
- stat = "5.5.2";
- break;
-
- case EX_NOUSER:
- stat = "5.1.1";
- break;
-
- case EX_NOHOST:
- stat = "5.1.2";
- break;
-
- case EX_NOINPUT:
- case EX_CANTCREAT:
- case EX_NOPERM:
- stat = "5.3.0";
- break;
-
- case EX_UNAVAILABLE:
- case EX_SOFTWARE:
- case EX_OSFILE:
- case EX_PROTOCOL:
- case EX_CONFIG:
- stat = "5.5.0";
- break;
-
- case EX_OSERR:
- case EX_IOERR:
- stat = "4.5.0";
- break;
-
- case EX_TEMPFAIL:
- stat = "4.2.0";
- break;
- }
- if (stat != NULL)
- q->q_status = stat;
- }
-
- q->q_statdate = curtime();
- if (CurHostName != NULL && CurHostName[0] != '\0')
- q->q_statmta = newstr(CurHostName);
- if (rcode != EX_OK && q->q_rstatus == NULL &&
- q->q_mailer != NULL && q->q_mailer->m_diagtype != NULL &&
- strcasecmp(q->q_mailer->m_diagtype, "UNIX") == 0)
- {
- char buf[30];
-
- (void) snprintf(buf, sizeof buf, "%d", rcode);
- q->q_rstatus = newstr(buf);
- }
-}
-\f/*
-** ENDMAILER -- Wait for mailer to terminate.
-**
-** We should never get fatal errors (e.g., segmentation
-** violation), so we report those specially. For other
-** errors, we choose a status message (into statmsg),
-** and if it represents an error, we print it.
-**
-** Parameters:
-** pid -- pid of mailer.
-** e -- the current envelope.
-** pv -- the parameter vector that invoked the mailer
-** (for error messages).
-**
-** Returns:
-** exit code of mailer.
-**
-** Side Effects:
-** none.
-*/
-
-int
-endmailer(mci, e, pv)
- register MCI *mci;
- register ENVELOPE *e;
- char **pv;
-{
- int st;
-
- mci_unlock_host(mci);
-
- /* close any connections */
- if (mci->mci_in != NULL)
- (void) xfclose(mci->mci_in, mci->mci_mailer->m_name, "mci_in");
- if (mci->mci_out != NULL)
- (void) xfclose(mci->mci_out, mci->mci_mailer->m_name, "mci_out");
- mci->mci_in = mci->mci_out = NULL;
- mci->mci_state = MCIS_CLOSED;
-
- /* in the IPC case there is nothing to wait for */
- if (mci->mci_pid == 0)
- return (EX_OK);
-
-#if _FFR_TIMEOUT_WAIT
- put a timeout around the wait
-#endif
-
- /* wait for the mailer process to die and collect status */
- st = waitfor(mci->mci_pid);
- if (st == -1)
- {
- syserr("endmailer %s: wait", mci->mci_mailer->m_name);
- return (EX_SOFTWARE);
- }
-
- if (WIFEXITED(st))
- {
- /* normal death -- return status */
- return (WEXITSTATUS(st));
- }
-
- /* it died a horrid death */
- syserr("451 mailer %s died with signal %o",
- mci->mci_mailer->m_name, st);
-
- /* log the arguments */
- if (pv != NULL && e->e_xfp != NULL)
- {
- register char **av;
-
- fprintf(e->e_xfp, "Arguments:");
- for (av = pv; *av != NULL; av++)
- fprintf(e->e_xfp, " %s", *av);
- fprintf(e->e_xfp, "\n");
- }
-
- ExitStat = EX_TEMPFAIL;
- return (EX_TEMPFAIL);
-}
-\f/*
-** GIVERESPONSE -- Interpret an error response from a mailer
-**
-** Parameters:
-** stat -- the status code from the mailer (high byte
-** only; core dumps must have been taken care of
-** already).
-** m -- the mailer info for this mailer.
-** mci -- the mailer connection info -- can be NULL if the
-** response is given before the connection is made.
-** ctladdr -- the controlling address for the recipient
-** address(es).
-** xstart -- the transaction start time, for computing
-** transaction delays.
-** e -- the current envelope.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Errors may be incremented.
-** ExitStat may be set.
-*/
-
-void
-giveresponse(stat, m, mci, ctladdr, xstart, e)
- int stat;
- register MAILER *m;
- register MCI *mci;
- ADDRESS *ctladdr;
- time_t xstart;
- ENVELOPE *e;
-{
- register const char *statmsg;
- extern char *SysExMsg[];
- register int i;
- extern int N_SysEx;
- char buf[MAXLINE];
-
- if (e == NULL)
- syserr("giveresponse: null envelope");
-
- /*
- ** Compute status message from code.
- */
-
- i = stat - EX__BASE;
- if (stat == 0)
- {
- statmsg = "250 Sent";
- if (e->e_statmsg != NULL)
- {
- (void) snprintf(buf, sizeof buf, "%s (%s)",
- statmsg, shortenstring(e->e_statmsg, 403));
- statmsg = buf;
- }
- }
- else if (i < 0 || i >= N_SysEx)
- {
- (void) snprintf(buf, sizeof buf, "554 unknown mailer error %d",
- stat);
- stat = EX_UNAVAILABLE;
- statmsg = buf;
- }
- else if (stat == EX_TEMPFAIL)
- {
- char *bp = buf;
-
- snprintf(bp, SPACELEFT(buf, bp), "%s", SysExMsg[i] + 1);
- bp += strlen(bp);
-#if NAMED_BIND
- if (h_errno == TRY_AGAIN)
- statmsg = errstring(h_errno+E_DNSBASE);
- else
-#endif
- {
- if (errno != 0)
- statmsg = errstring(errno);
- else
- {
-#if SMTP
- statmsg = SmtpError;
-#else /* SMTP */
- statmsg = NULL;
-#endif /* SMTP */
- }
- }
- if (statmsg != NULL && statmsg[0] != '\0')
- snprintf(bp, SPACELEFT(buf, bp), ": %s", statmsg);
- statmsg = buf;
- }
-#if NAMED_BIND
- else if (stat == EX_NOHOST && h_errno != 0)
- {
- statmsg = errstring(h_errno + E_DNSBASE);
- (void) snprintf(buf, sizeof buf, "%s (%s)",
- SysExMsg[i] + 1, statmsg);
- statmsg = buf;
- }
-#endif
- else
- {
- statmsg = SysExMsg[i];
- if (*statmsg++ == ':' && errno != 0)
- {
- (void) snprintf(buf, sizeof buf, "%s: %s",
- statmsg, errstring(errno));
- statmsg = buf;
- }
- }
-
- /*
- ** Print the message as appropriate
- */
-
- if (stat == EX_OK || stat == EX_TEMPFAIL)
- {
- extern char MsgBuf[];
-
- message("%s", &statmsg[4]);
- if (stat == EX_TEMPFAIL && e->e_xfp != NULL)
- fprintf(e->e_xfp, "%s\n", &MsgBuf[4]);
- }
- else
- {
- char mbuf[8];
-
- Errors++;
- snprintf(mbuf, sizeof mbuf, "%.3s %%s", statmsg);
- usrerr(mbuf, &statmsg[4]);
- }
-
- /*
- ** Final cleanup.
- ** Log a record of the transaction. Compute the new
- ** ExitStat -- if we already had an error, stick with
- ** that.
- */
-
- if (OpMode != MD_VERIFY && !bitset(EF_VRFYONLY, e->e_flags) &&
- LogLevel > ((stat == EX_TEMPFAIL) ? 8 : (stat == EX_OK) ? 7 : 6))
- logdelivery(m, mci, &statmsg[4], ctladdr, xstart, e);
-
- if (tTd(11, 2))
- printf("giveresponse: stat=%d, e->e_message=%s\n",
- stat, e->e_message == NULL ? "<NULL>" : e->e_message);
-
- if (stat != EX_TEMPFAIL)
- setstat(stat);
- if (stat != EX_OK && (stat != EX_TEMPFAIL || e->e_message == NULL))
- {
- if (e->e_message != NULL)
- free(e->e_message);
- e->e_message = newstr(&statmsg[4]);
- }
- errno = 0;
-#if NAMED_BIND
- h_errno = 0;
-#endif
-}
-\f/*
-** LOGDELIVERY -- log the delivery in the system log
-**
-** Care is taken to avoid logging lines that are too long, because
-** some versions of syslog have an unfortunate proclivity for core
-** dumping. This is a hack, to be sure, that is at best empirical.
-**
-** Parameters:
-** m -- the mailer info. Can be NULL for initial queue.
-** mci -- the mailer connection info -- can be NULL if the
-** log is occuring when no connection is active.
-** stat -- the message to print for the status.
-** ctladdr -- the controlling address for the to list.
-** xstart -- the transaction start time, used for
-** computing transaction delay.
-** e -- the current envelope.
-**
-** Returns:
-** none
-**
-** Side Effects:
-** none
-*/
-
-void
-logdelivery(m, mci, stat, ctladdr, xstart, e)
- MAILER *m;
- register MCI *mci;
- const char *stat;
- ADDRESS *ctladdr;
- time_t xstart;
- register ENVELOPE *e;
-{
- register char *bp;
- register char *p;
- int l;
- char buf[1024];
-
-# if (SYSLOG_BUFSIZE) >= 256
- /* ctladdr: max 106 bytes */
- bp = buf;
- if (ctladdr != NULL)
- {
- snprintf(bp, SPACELEFT(buf, bp), ", ctladdr=%s",
- shortenstring(ctladdr->q_paddr, 83));
- bp += strlen(bp);
- if (bitset(QGOODUID, ctladdr->q_flags))
- {
- (void) snprintf(bp, SPACELEFT(buf, bp), " (%d/%d)",
- ctladdr->q_uid, ctladdr->q_gid);
- bp += strlen(bp);
- }
- }
-
- /* delay & xdelay: max 41 bytes */
- snprintf(bp, SPACELEFT(buf, bp), ", delay=%s",
- pintvl(curtime() - e->e_ctime, TRUE));
- bp += strlen(bp);
-
- if (xstart != (time_t) 0)
- {
- snprintf(bp, SPACELEFT(buf, bp), ", xdelay=%s",
- pintvl(curtime() - xstart, TRUE));
- bp += strlen(bp);
- }
-
- /* mailer: assume about 19 bytes (max 10 byte mailer name) */
- if (m != NULL)
- {
- snprintf(bp, SPACELEFT(buf, bp), ", mailer=%s", m->m_name);
- bp += strlen(bp);
- }
-
- /* relay: max 66 bytes for IPv4 addresses */
- if (mci != NULL && mci->mci_host != NULL)
- {
-# if DAEMON
- extern SOCKADDR CurHostAddr;
-# endif
-
- snprintf(bp, SPACELEFT(buf, bp), ", relay=%s",
- shortenstring(mci->mci_host, 40));
- bp += strlen(bp);
-
-# if DAEMON
- if (CurHostAddr.sa.sa_family != 0)
- {
- snprintf(bp, SPACELEFT(buf, bp), " [%s]",
- anynet_ntoa(&CurHostAddr));
- }
-# endif
- }
- else if (strcmp(stat, "queued") != 0)
- {
- p = macvalue('h', e);
- if (p != NULL && p[0] != '\0')
- {
- snprintf(bp, SPACELEFT(buf, bp), ", relay=%s",
- shortenstring(p, 40));
- }
- }
- bp += strlen(bp);
-
-#define STATLEN (((SYSLOG_BUFSIZE) - 100) / 4)
-#if (STATLEN) < 63
-# undef STATLEN
-# define STATLEN 63
-#endif
-#if (STATLEN) > 203
-# undef STATLEN
-# define STATLEN 203
-#endif
-
- /* stat: max 210 bytes */
- if ((bp - buf) > (sizeof buf - ((STATLEN) + 20)))
- {
- /* desperation move -- truncate data */
- bp = buf + sizeof buf - ((STATLEN) + 17);
- strcpy(bp, "...");
- bp += 3;
- }
-
- (void) strcpy(bp, ", stat=");
- bp += strlen(bp);
-
- (void) strcpy(bp, shortenstring(stat, (STATLEN)));
-
- /* id, to: max 13 + TOBUFSIZE bytes */
- l = SYSLOG_BUFSIZE - 100 - strlen(buf);
- p = e->e_to;
- while (strlen(p) >= (SIZE_T) l)
- {
- register char *q = strchr(p + l, ',');
-
- if (q == NULL)
- break;
- sm_syslog(LOG_INFO, e->e_id,
- "to=%.*s [more]%s",
- ++q - p, p, buf);
- p = q;
- }
- sm_syslog(LOG_INFO, e->e_id, "to=%s%s", p, buf);
-
-# else /* we have a very short log buffer size */
-
- l = SYSLOG_BUFSIZE - 85;
- p = e->e_to;
- while (strlen(p) >= (SIZE_T) l)
- {
- register char *q = strchr(p + l, ',');
-
- if (q == NULL)
- break;
- sm_syslog(LOG_INFO, e->e_id,
- "to=%.*s [more]",
- ++q - p, p);
- p = q;
- }
- sm_syslog(LOG_INFO, e->e_id, "to=%s", p);
-
- if (ctladdr != NULL)
- {
- bp = buf;
- snprintf(bp, SPACELEFT(buf, bp), "ctladdr=%s",
- shortenstring(ctladdr->q_paddr, 83));
- bp += strlen(bp);
- if (bitset(QGOODUID, ctladdr->q_flags))
- {
- (void) snprintf(bp, SPACELEFT(buf, bp), " (%d/%d)",
- ctladdr->q_uid, ctladdr->q_gid);
- bp += strlen(bp);
- }
- sm_syslog(LOG_INFO, e->e_id, "%s", buf);
- }
- bp = buf;
- snprintf(bp, SPACELEFT(buf, bp), "delay=%s",
- pintvl(curtime() - e->e_ctime, TRUE));
- bp += strlen(bp);
- if (xstart != (time_t) 0)
- {
- snprintf(bp, SPACELEFT(buf, bp), ", xdelay=%s",
- pintvl(curtime() - xstart, TRUE));
- bp += strlen(bp);
- }
-
- if (m != NULL)
- {
- snprintf(bp, SPACELEFT(buf, bp), ", mailer=%s", m->m_name);
- bp += strlen(bp);
- }
- sm_syslog(LOG_INFO, e->e_id, "%.1000s", buf);
-
- buf[0] = '\0';
- bp = buf;
- if (mci != NULL && mci->mci_host != NULL)
- {
-# if DAEMON
- extern SOCKADDR CurHostAddr;
-# endif
-
- snprintf(bp, SPACELEFT(buf, bp), "relay=%.100s", mci->mci_host);
- bp += strlen(bp);
-
-# if DAEMON
- if (CurHostAddr.sa.sa_family != 0)
- snprintf(bp, SPACELEFT(buf, bp), " [%.100s]",
- anynet_ntoa(&CurHostAddr));
-# endif
- }
- else if (strcmp(stat, "queued") != 0)
- {
- p = macvalue('h', e);
- if (p != NULL && p[0] != '\0')
- snprintf(buf, sizeof buf, "relay=%.100s", p);
- }
- if (buf[0] != '\0')
- sm_syslog(LOG_INFO, e->e_id, "%.1000s", buf);
-
- sm_syslog(LOG_INFO, e->e_id, "stat=%s", shortenstring(stat, 63));
-# endif /* short log buffer */
-}
-\f/*
-** PUTFROMLINE -- output a UNIX-style from line (or whatever)
-**
-** This can be made an arbitrary message separator by changing $l
-**
-** One of the ugliest hacks seen by human eyes is contained herein:
-** UUCP wants those stupid "remote from <host>" lines. Why oh why
-** does a well-meaning programmer such as myself have to deal with
-** this kind of antique garbage????
-**
-** Parameters:
-** mci -- the connection information.
-** e -- the envelope.
-**
-** Returns:
-** none
-**
-** Side Effects:
-** outputs some text to fp.
-*/
-
-void
-putfromline(mci, e)
- register MCI *mci;
- ENVELOPE *e;
-{
- char *template = UnixFromLine;
- char buf[MAXLINE];
- char xbuf[MAXLINE];
-
- if (bitnset(M_NHDR, mci->mci_mailer->m_flags))
- return;
-
- mci->mci_flags |= MCIF_INHEADER;
-
- if (bitnset(M_UGLYUUCP, mci->mci_mailer->m_flags))
- {
- char *bang;
-
- expand("\201g", buf, sizeof buf, e);
- bang = strchr(buf, '!');
- if (bang == NULL)
- {
- char *at;
- char hname[MAXNAME];
-
- /*
- ** If we can construct a UUCP path, do so
- */
-
- at = strrchr(buf, '@');
- if (at == NULL)
- {
- expand( "\201k", hname, sizeof hname, e);
- at = hname;
- }
- else
- *at++ = '\0';
- (void) snprintf(xbuf, sizeof xbuf,
- "From %.800s \201d remote from %.100s\n",
- buf, at);
- }
- else
- {
- *bang++ = '\0';
- (void) snprintf(xbuf, sizeof xbuf,
- "From %.800s \201d remote from %.100s\n",
- bang, buf);
- template = xbuf;
- }
- }
- expand(template, buf, sizeof buf, e);
- putxline(buf, strlen(buf), mci, PXLF_HEADER);
-}
-\f/*
-** PUTBODY -- put the body of a message.
-**
-** Parameters:
-** mci -- the connection information.
-** e -- the envelope to put out.
-** separator -- if non-NULL, a message separator that must
-** not be permitted in the resulting message.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** The message is written onto fp.
-*/
-
-/* values for output state variable */
-#define OS_HEAD 0 /* at beginning of line */
-#define OS_CR 1 /* read a carriage return */
-#define OS_INLINE 2 /* putting rest of line */
-
-void
-putbody(mci, e, separator)
- register MCI *mci;
- register ENVELOPE *e;
- char *separator;
-{
- char buf[MAXLINE];
- char *boundaries[MAXMIMENESTING + 1];
-
- /*
- ** Output the body of the message
- */
-
- if (e->e_dfp == NULL && bitset(EF_HAS_DF, e->e_flags))
- {
- char *df = queuename(e, 'd');
-
- e->e_dfp = fopen(df, "r");
- if (e->e_dfp == NULL)
- syserr("putbody: Cannot open %s for %s from %s",
- df, e->e_to, e->e_from.q_paddr);
- }
- if (e->e_dfp == NULL)
- {
- if (bitset(MCIF_INHEADER, mci->mci_flags))
- {
- putline("", mci);
- mci->mci_flags &= ~MCIF_INHEADER;
- }
- putline("<<< No Message Collected >>>", mci);
- goto endofmessage;
- }
- if (e->e_dfino == (ino_t) 0)
- {
- struct stat stbuf;
-
- if (fstat(fileno(e->e_dfp), &stbuf) < 0)
- e->e_dfino = -1;
- else
- {
- e->e_dfdev = stbuf.st_dev;
- e->e_dfino = stbuf.st_ino;
- }
- }
- rewind(e->e_dfp);
-
-#if MIME8TO7
- if (bitset(MCIF_CVT8TO7, mci->mci_flags))
- {
- /*
- ** Do 8 to 7 bit MIME conversion.
- */
-
- /* make sure it looks like a MIME message */
- if (hvalue("MIME-Version", e->e_header) == NULL)
- putline("MIME-Version: 1.0", mci);
-
- if (hvalue("Content-Type", e->e_header) == NULL)
- {
- snprintf(buf, sizeof buf,
- "Content-Type: text/plain; charset=%s",
- defcharset(e));
- putline(buf, mci);
- }
-
- /* now do the hard work */
- boundaries[0] = NULL;
- mci->mci_flags |= MCIF_INHEADER;
- mime8to7(mci, e->e_header, e, boundaries, M87F_OUTER);
- }
-# if MIME7TO8
- else if (bitset(MCIF_CVT7TO8, mci->mci_flags))
- {
- mime7to8(mci, e->e_header, e);
- }
-# endif
- else if (MaxMimeHeaderLength > 0 || MaxMimeFieldLength > 0)
- {
- /* Use mime8to7 to check multipart for MIME header overflows */
- boundaries[0] = NULL;
- mci->mci_flags |= MCIF_INHEADER;
- mime8to7(mci, e->e_header, e, boundaries, M87F_OUTER|M87F_NO8TO7);
- }
- else
-#endif
- {
- int ostate;
- register char *bp;
- register char *pbp;
- register int c;
- register char *xp;
- int padc;
- char *buflim;
- int pos = 0;
- size_t eol_len;
- char peekbuf[10];
-
- if (bitset(MCIF_INHEADER, mci->mci_flags))
- {
- putline("", mci);
- mci->mci_flags &= ~MCIF_INHEADER;
- }
-
- /* determine end of buffer; allow for short mailer lines */
- buflim = &buf[sizeof buf - 1];
- if (mci->mci_mailer->m_linelimit > 0 &&
- mci->mci_mailer->m_linelimit < sizeof buf - 1)
- buflim = &buf[mci->mci_mailer->m_linelimit - 1];
- eol_len = strlen(mci->mci_mailer->m_eol);
-
- /* copy temp file to output with mapping */
- ostate = OS_HEAD;
- bp = buf;
- pbp = peekbuf;
- while (!ferror(mci->mci_out))
- {
- if (pbp > peekbuf)
- c = *--pbp;
- else if ((c = getc(e->e_dfp)) == EOF)
- break;
- if (bitset(MCIF_7BIT, mci->mci_flags))
- c &= 0x7f;
- switch (ostate)
- {
- case OS_HEAD:
-#if _FFR_NONULLS
- if (c == '\0' &&
- bitnset(M_NONULLS, mci->mci_mailer->m_flags))
- break;
-#endif
- if (c != '\r' && c != '\n' && bp < buflim)
- {
- *bp++ = c;
- break;
- }
-
- /* check beginning of line for special cases */
- *bp = '\0';
- pos = 0;
- padc = EOF;
- if (buf[0] == 'F' &&
- bitnset(M_ESCFROM, mci->mci_mailer->m_flags) &&
- strncmp(buf, "From ", 5) == 0)
- {
- padc = '>';
- }
- if (buf[0] == '-' && buf[1] == '-' &&
- separator != NULL)
- {
- /* possible separator */
- int sl = strlen(separator);
-
- if (strncmp(&buf[2], separator, sl) == 0)
- padc = ' ';
- }
- if (buf[0] == '.' &&
- bitnset(M_XDOT, mci->mci_mailer->m_flags))
- {
- padc = '.';
- }
-
- /* now copy out saved line */
- if (TrafficLogFile != NULL)
- {
- fprintf(TrafficLogFile, "%05d >>> ",
- (int) getpid());
- if (padc != EOF)
- putc(padc, TrafficLogFile);
- for (xp = buf; xp < bp; xp++)
- putc(*xp, TrafficLogFile);
- if (c == '\n')
- fputs(mci->mci_mailer->m_eol,
- TrafficLogFile);
- }
- if (padc != EOF)
- {
- putc(padc, mci->mci_out);
- mci->mci_contentlen++;
- pos++;
- }
- for (xp = buf; xp < bp; xp++)
- {
- putc(*xp, mci->mci_out);
- mci->mci_contentlen++;
- }
- if (c == '\n')
- {
- fputs(mci->mci_mailer->m_eol,
- mci->mci_out);
- mci->mci_contentlen += eol_len;
- pos = 0;
- }
- else
- {
- pos += bp - buf;
- if (c != '\r')
- *pbp++ = c;
- }
- bp = buf;
-
- /* determine next state */
- if (c == '\n')
- ostate = OS_HEAD;
- else if (c == '\r')
- ostate = OS_CR;
- else
- ostate = OS_INLINE;
- continue;
-
- case OS_CR:
- if (c == '\n')
- {
- /* got CRLF */
- fputs(mci->mci_mailer->m_eol, mci->mci_out);
- mci->mci_contentlen += eol_len;
- if (TrafficLogFile != NULL)
- {
- fputs(mci->mci_mailer->m_eol,
- TrafficLogFile);
- }
- ostate = OS_HEAD;
- continue;
- }
-
- /* had a naked carriage return */
- *pbp++ = c;
- c = '\r';
- ostate = OS_INLINE;
- goto putch;
-
- case OS_INLINE:
- if (c == '\r')
- {
- ostate = OS_CR;
- continue;
- }
-#if _FFR_NONULLS
- if (c == '\0' &&
- bitnset(M_NONULLS, mci->mci_mailer->m_flags))
- break;
-#endif
-putch:
- if (mci->mci_mailer->m_linelimit > 0 &&
- pos > mci->mci_mailer->m_linelimit &&
- c != '\n')
- {
- putc('!', mci->mci_out);
- mci->mci_contentlen++;
- fputs(mci->mci_mailer->m_eol, mci->mci_out);
- mci->mci_contentlen += eol_len;
- if (TrafficLogFile != NULL)
- {
- fprintf(TrafficLogFile, "!%s",
- mci->mci_mailer->m_eol);
- }
- ostate = OS_HEAD;
- *pbp++ = c;
- continue;
- }
- if (c == '\n')
- {
- if (TrafficLogFile != NULL)
- fputs(mci->mci_mailer->m_eol,
- TrafficLogFile);
- fputs(mci->mci_mailer->m_eol, mci->mci_out);
- mci->mci_contentlen += eol_len;
- pos = 0;
- ostate = OS_HEAD;
- }
- else
- {
- if (TrafficLogFile != NULL)
- putc(c, TrafficLogFile);
- putc(c, mci->mci_out);
- mci->mci_contentlen++;
- pos++;
- ostate = OS_INLINE;
- }
- break;
- }
- }
-
- /* make sure we are at the beginning of a line */
- if (bp > buf)
- {
- if (TrafficLogFile != NULL)
- {
- for (xp = buf; xp < bp; xp++)
- putc(*xp, TrafficLogFile);
- }
- for (xp = buf; xp < bp; xp++)
- {
- putc(*xp, mci->mci_out);
- mci->mci_contentlen++;
- }
- pos += bp - buf;
- }
- if (pos > 0)
- {
- if (TrafficLogFile != NULL)
- fputs(mci->mci_mailer->m_eol, TrafficLogFile);
- fputs(mci->mci_mailer->m_eol, mci->mci_out);
- mci->mci_contentlen += eol_len;
- }
- }
-
- if (ferror(e->e_dfp))
- {
- syserr("putbody: df%s: read error", e->e_id);
- ExitStat = EX_IOERR;
- }
-
-endofmessage:
- /* some mailers want extra blank line at end of message */
- if (bitnset(M_BLANKEND, mci->mci_mailer->m_flags) &&
- buf[0] != '\0' && buf[0] != '\n')
- putline("", mci);
-
- (void) fflush(mci->mci_out);
- if (ferror(mci->mci_out) && errno != EPIPE)
- {
- syserr("putbody: write error");
- ExitStat = EX_IOERR;
- }
- errno = 0;
-}
-\f/*
-** MAILFILE -- Send a message to a file.
-**
-** If the file has the setuid/setgid bits set, but NO execute
-** bits, sendmail will try to become the owner of that file
-** rather than the real user. Obviously, this only works if
-** sendmail runs as root.
-**
-** This could be done as a subordinate mailer, except that it
-** is used implicitly to save messages in ~/dead.letter. We
-** view this as being sufficiently important as to include it
-** here. For example, if the system is dying, we shouldn't have
-** to create another process plus some pipes to save the message.
-**
-** Parameters:
-** filename -- the name of the file to send to.
-** mailer -- mailer definition for recipient -- if NULL,
-** use FileMailer.
-** ctladdr -- the controlling address header -- includes
-** the userid/groupid to be when sending.
-** sfflags -- flags for opening.
-** e -- the current envelope.
-**
-** Returns:
-** The exit code associated with the operation.
-**
-** Side Effects:
-** none.
-*/
-
-static jmp_buf CtxMailfileTimeout;
-static void mailfiletimeout __P((void));
-
-int
-mailfile(filename, mailer, ctladdr, sfflags, e)
- char *volatile filename;
- MAILER *volatile mailer;
- ADDRESS *ctladdr;
- volatile int sfflags;
- register ENVELOPE *e;
-{
- register FILE *f;
- register pid_t pid = -1;
- volatile int mode = ST_MODE_NOFILE;
- bool suidwarn = geteuid() == 0;
- char *p;
- EVENT *ev;
-
- if (tTd(11, 1))
- {
- printf("mailfile %s\n ctladdr=", filename);
- printaddr(ctladdr, FALSE);
- }
-
- if (mailer == NULL)
- mailer = FileMailer;
-
- if (e->e_xfp != NULL)
- fflush(e->e_xfp);
-
- /*
- ** Special case /dev/null. This allows us to restrict file
- ** delivery to regular files only.
- */
-
- if (strcmp(filename, "/dev/null") == 0)
- return EX_OK;
-
- /* check for 8-bit available */
- if (bitset(EF_HAS8BIT, e->e_flags) &&
- bitnset(M_7BITS, mailer->m_flags) &&
- (bitset(EF_DONT_MIME, e->e_flags) ||
- !(bitset(MM_MIME8BIT, MimeMode) ||
- (bitset(EF_IS_MIME, e->e_flags) &&
- bitset(MM_CVTMIME, MimeMode)))))
- {
- usrerr("554 Cannot send 8-bit data to 7-bit destination");
- e->e_status = "5.6.3";
- return(EX_DATAERR);
- }
-
- /*
- ** Fork so we can change permissions here.
- ** Note that we MUST use fork, not vfork, because of
- ** the complications of calling subroutines, etc.
- */
-
- DOFORK(fork);
-
- if (pid < 0)
- return (EX_OSERR);
- else if (pid == 0)
- {
- /* child -- actually write to file */
- struct stat stb;
- MCI mcibuf;
- int err;
- volatile int oflags = O_WRONLY|O_APPEND;
-
- if (e->e_lockfp != NULL)
- (void) close(fileno(e->e_lockfp));
-
- (void) setsignal(SIGINT, SIG_DFL);
- (void) setsignal(SIGHUP, SIG_DFL);
- (void) setsignal(SIGTERM, SIG_DFL);
- (void) umask(OldUmask);
- e->e_to = filename;
- ExitStat = EX_OK;
-
- if (setjmp(CtxMailfileTimeout) != 0)
- {
- exit(EX_TEMPFAIL);
- }
-
- if (TimeOuts.to_fileopen > 0)
- ev = setevent(TimeOuts.to_fileopen, mailfiletimeout, 0);
- else
- ev = NULL;
-
-#ifdef HASLSTAT
- if (bitset(DBS_FILEDELIVERYTOSYMLINK, DontBlameSendmail))
- err = stat(filename, &stb);
- else
- err = lstat(filename, &stb);
- if (err < 0)
-#else
- if (stat(filename, &stb) < 0)
-#endif
- {
- stb.st_mode = ST_MODE_NOFILE;
- mode = FileMode;
- oflags |= O_CREAT|O_EXCL;
- }
- else if (bitset(S_IXUSR|S_IXGRP|S_IXOTH, stb.st_mode) ||
- (!bitset(DBS_FILEDELIVERYTOHARDLINK, DontBlameSendmail) &&
- stb.st_nlink != 1) ||
- (SafeFileEnv != NULL && !S_ISREG(stb.st_mode)))
- exit(EX_CANTCREAT);
- if (mode == ST_MODE_NOFILE)
- mode = stb.st_mode;
-
- /* limit the errors to those actually caused in the child */
- errno = 0;
- ExitStat = EX_OK;
-
- if (ctladdr != NULL || bitset(SFF_RUNASREALUID, sfflags))
- {
- /* ignore setuid and setgid bits */
- mode &= ~(S_ISGID|S_ISUID);
- }
-
- /* we have to open the dfile BEFORE setuid */
- if (e->e_dfp == NULL && bitset(EF_HAS_DF, e->e_flags))
- {
- char *df = queuename(e, 'd');
-
- e->e_dfp = fopen(df, "r");
- if (e->e_dfp == NULL)
- {
- syserr("mailfile: Cannot open %s for %s from %s",
- df, e->e_to, e->e_from.q_paddr);
- }
- }
-
- /* select a new user to run as */
- if (!bitset(SFF_RUNASREALUID, sfflags))
- {
- if (bitnset(M_SPECIFIC_UID, mailer->m_flags))
- {
- RealUserName = NULL;
- RealUid = mailer->m_uid;
- }
- else if (bitset(S_ISUID, mode))
- {
- RealUserName = NULL;
- RealUid = stb.st_uid;
- }
- else if (ctladdr != NULL && ctladdr->q_uid != 0)
- {
- if (ctladdr->q_ruser != NULL)
- RealUserName = ctladdr->q_ruser;
- else
- RealUserName = ctladdr->q_user;
- RealUid = ctladdr->q_uid;
- }
- else if (mailer != NULL && mailer->m_uid != 0)
- {
- RealUserName = DefUser;
- RealUid = mailer->m_uid;
- }
- else
- {
- RealUserName = DefUser;
- RealUid = DefUid;
- }
-
- /* select a new group to run as */
- if (bitnset(M_SPECIFIC_UID, mailer->m_flags))
- RealGid = mailer->m_gid;
- else if (bitset(S_ISGID, mode))
- RealGid = stb.st_gid;
- else if (ctladdr != NULL && ctladdr->q_uid != 0)
- RealGid = ctladdr->q_gid;
- else if (mailer != NULL && mailer->m_gid != 0)
- RealGid = mailer->m_gid;
- else
- RealGid = DefGid;
- }
-
- /* last ditch */
- if (!bitset(SFF_ROOTOK, sfflags))
- {
- if (RealUid == 0)
- RealUid = DefUid;
- if (RealGid == 0)
- RealGid = DefGid;
- }
-
- /* set group id list (needs /etc/group access) */
- if (RealUserName != NULL && !DontInitGroups)
- {
- if (initgroups(RealUserName, RealGid) == -1 && suidwarn)
- syserr("mailfile: initgroups(%s, %d) failed",
- RealUserName, RealGid);
- }
- else
- {
- GIDSET_T gidset[1];
-
- gidset[0] = RealGid;
- if (setgroups(1, gidset) == -1 && suidwarn)
- syserr("mailfile: setgroups() failed");
- }
-
- /* if you have a safe environment, go into it */
- if (SafeFileEnv != NULL && SafeFileEnv[0] != '\0')
- {
- int i;
-
- if (chroot(SafeFileEnv) < 0)
- {
- syserr("mailfile: Cannot chroot(%s)",
- SafeFileEnv);
- exit(EX_CANTCREAT);
- }
- i = strlen(SafeFileEnv);
- if (strncmp(SafeFileEnv, filename, i) == 0)
- filename += i;
- }
- if (chdir("/") < 0)
- syserr("mailfile: cannot chdir(/)");
-
- /* now reset the group and user ids */
- endpwent();
- if (setgid(RealGid) < 0 && suidwarn)
- syserr("mailfile: setgid(%ld) failed", (long) RealGid);
- vendor_set_uid(RealUid);
- if (setuid(RealUid) < 0 && suidwarn)
- syserr("mailfile: setuid(%ld) failed", (long) RealUid);
-
- /* move into some "safe" directory */
- if (mailer->m_execdir != NULL)
- {
- char *q;
- char buf[MAXLINE + 1];
-
- for (p = mailer->m_execdir; p != NULL; p = q)
- {
- q = strchr(p, ':');
- if (q != NULL)
- *q = '\0';
- expand(p, buf, sizeof buf, e);
- if (q != NULL)
- *q++ = ':';
- if (tTd(11, 20))
- printf("mailfile: trydir %s\n",
- buf);
- if (buf[0] != '\0' && chdir(buf) >= 0)
- break;
- }
- }
-
- sfflags |= SFF_NOPATHCHECK;
- if (!bitset(DBS_FILEDELIVERYTOSYMLINK, DontBlameSendmail))
- sfflags |= SFF_NOSLINK;
- if (!bitset(DBS_FILEDELIVERYTOHARDLINK, DontBlameSendmail))
- sfflags |= SFF_NOHLINK;
- sfflags &= ~SFF_OPENASROOT;
- f = safefopen(filename, oflags, FileMode, sfflags);
- if (f == NULL)
- {
- message("554 cannot open %s: %s",
- shortenstring(filename, MAXSHORTSTR),
- errstring(errno));
- exit(EX_CANTCREAT);
- }
- if (filechanged(filename, fileno(f), &stb))
- {
- message("554 file changed after open");
- exit(EX_CANTCREAT);
- }
- if (fstat(fileno(f), &stb) < 0)
- {
- message("554 cannot fstat %s", errstring(errno));
- exit(EX_CANTCREAT);
- }
-
- if (ev != NULL)
- clrevent(ev);
-
- bzero(&mcibuf, sizeof mcibuf);
- mcibuf.mci_mailer = mailer;
- mcibuf.mci_out = f;
- mcibuf.mci_contentlen = 0;
- if (bitnset(M_7BITS, mailer->m_flags))
- mcibuf.mci_flags |= MCIF_7BIT;
-
- /* clear out per-message flags from connection structure */
- mcibuf.mci_flags &= ~(MCIF_CVT7TO8|MCIF_CVT8TO7);
-
- if (bitset(EF_HAS8BIT, e->e_flags) &&
- !bitset(EF_DONT_MIME, e->e_flags) &&
- bitnset(M_7BITS, mailer->m_flags))
- mcibuf.mci_flags |= MCIF_CVT8TO7;
-
-#if MIME7TO8
- if (bitnset(M_MAKE8BIT, mailer->m_flags) &&
- !bitset(MCIF_7BIT, mcibuf.mci_flags) &&
- (p = hvalue("Content-Transfer-Encoding", e->e_header)) != NULL &&
- (strcasecmp(p, "quoted-printable") == 0 ||
- strcasecmp(p, "base64") == 0) &&
- (p = hvalue("Content-Type", e->e_header)) != NULL)
- {
- /* may want to convert 7 -> 8 */
- /* XXX should really parse it here -- and use a class XXX */
- if (strncasecmp(p, "text/plain", 10) == 0 &&
- (p[10] == '\0' || p[10] == ' ' || p[10] == ';'))
- mcibuf.mci_flags |= MCIF_CVT7TO8;
- }
-#endif
-
- putfromline(&mcibuf, e);
- (*e->e_puthdr)(&mcibuf, e->e_header, e, M87F_OUTER);
- (*e->e_putbody)(&mcibuf, e, NULL);
- putline("\n", &mcibuf);
- if (fflush(f) < 0 || ferror(f))
- {
- message("451 I/O error: %s", errstring(errno));
- setstat(EX_IOERR);
- }
-
- /* reset ISUID & ISGID bits for paranoid systems */
-#if HASFCHMOD
- (void) fchmod(fileno(f), (MODE_T) stb.st_mode);
-#else
- (void) chmod(filename, (MODE_T) stb.st_mode);
-#endif
- (void) xfclose(f, "mailfile", filename);
- (void) fflush(stdout);
- setuid(RealUid);
- exit(ExitStat);
- /*NOTREACHED*/
- }
- else
- {
- /* parent -- wait for exit status */
- int st;
-
- st = waitfor(pid);
- if (st == -1)
- {
- syserr("mailfile: %s: wait", mailer->m_name);
- return (EX_SOFTWARE);
- }
- if (WIFEXITED(st))
- return (WEXITSTATUS(st));
- else
- {
- syserr("mailfile: %s: child died on signal %d",
- mailer->m_name, st);
- return (EX_UNAVAILABLE);
- }
- /*NOTREACHED*/
- }
- return EX_UNAVAILABLE; /* avoid compiler warning on IRIX */
-}
-
-static void
-mailfiletimeout()
-{
- longjmp(CtxMailfileTimeout, 1);
-}
-\f/*
-** HOSTSIGNATURE -- return the "signature" for a host.
-**
-** The signature describes how we are going to send this -- it
-** can be just the hostname (for non-Internet hosts) or can be
-** an ordered list of MX hosts.
-**
-** Parameters:
-** m -- the mailer describing this host.
-** host -- the host name.
-** e -- the current envelope.
-**
-** Returns:
-** The signature for this host.
-**
-** Side Effects:
-** Can tweak the symbol table.
-*/
-
-char *
-hostsignature(m, host, e)
- register MAILER *m;
- char *host;
- ENVELOPE *e;
-{
- register char *p;
- register STAB *s;
- int i;
- int len;
-#if NAMED_BIND
- int nmx;
- char *hp;
- char *endp;
- int oldoptions = _res.options;
- char *mxhosts[MAXMXHOSTS + 1];
-#endif
-
- /*
- ** Check to see if this uses IPC -- if not, it can't have MX records.
- */
-
- p = m->m_mailer;
- if (strcmp(p, "[IPC]") != 0 && strcmp(p, "[TCP]") != 0)
- {
- /* just an ordinary mailer */
- return host;
- }
-
- /*
- ** Look it up in the symbol table.
- */
-
- s = stab(host, ST_HOSTSIG, ST_ENTER);
- if (s->s_hostsig != NULL)
- return s->s_hostsig;
-
- /*
- ** Not already there -- create a signature.
- */
-
-#if NAMED_BIND
- if (ConfigLevel < 2)
- _res.options &= ~(RES_DEFNAMES | RES_DNSRCH); /* XXX */
-
- for (hp = host; hp != NULL; hp = endp)
- {
- endp = strchr(hp, ':');
- if (endp != NULL)
- *endp = '\0';
-
- if (bitnset(M_NOMX, m->m_flags))
- {
- /* skip MX lookups */
- nmx = 1;
- mxhosts[0] = hp;
- }
- else
- {
- auto int rcode;
-
- nmx = getmxrr(hp, mxhosts, TRUE, &rcode);
- if (nmx <= 0)
- {
- register MCI *mci;
-
- /* update the connection info for this host */
- mci = mci_get(hp, m);
- mci->mci_errno = errno;
- mci->mci_herrno = h_errno;
- mci->mci_lastuse = curtime();
- mci_setstat(mci, rcode, NULL, NULL);
-
- /* use the original host name as signature */
- nmx = 1;
- mxhosts[0] = hp;
- }
- }
-
- len = 0;
- for (i = 0; i < nmx; i++)
- {
- len += strlen(mxhosts[i]) + 1;
- }
- if (s->s_hostsig != NULL)
- len += strlen(s->s_hostsig) + 1;
- p = xalloc(len);
- if (s->s_hostsig != NULL)
- {
- (void) strcpy(p, s->s_hostsig);
- free(s->s_hostsig);
- s->s_hostsig = p;
- p += strlen(p);
- *p++ = ':';
- }
- else
- s->s_hostsig = p;
- for (i = 0; i < nmx; i++)
- {
- if (i != 0)
- *p++ = ':';
- strcpy(p, mxhosts[i]);
- p += strlen(p);
- }
- if (endp != NULL)
- *endp++ = ':';
- }
- makelower(s->s_hostsig);
- if (ConfigLevel < 2)
- _res.options = oldoptions;
-#else
- /* not using BIND -- the signature is just the host name */
- s->s_hostsig = host;
-#endif
- if (tTd(17, 1))
- printf("hostsignature(%s) = %s\n", host, s->s_hostsig);
- return s->s_hostsig;
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1986, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#include "sendmail.h"
-
-#ifndef lint
-#if NAMED_BIND
-static char sccsid[] = "@(#)domain.c 8.81 (Berkeley) 1/21/1999 (with name server)";
-#else
-static char sccsid[] = "@(#)domain.c 8.81 (Berkeley) 1/21/1999 (without name server)";
-#endif
-#endif /* not lint */
-
-#if NAMED_BIND
-
-#include <errno.h>
-#include <resolv.h>
-#include <arpa/inet.h>
-
-/*
-** The standard udp packet size PACKETSZ (512) is not sufficient for some
-** nameserver answers containing very many resource records. The resolver
-** may switch to tcp and retry if it detects udp packet overflow.
-** Also note that the resolver routines res_query and res_search return
-** the size of the *un*truncated answer in case the supplied answer buffer
-** it not big enough to accommodate the entire answer.
-*/
-
-#ifndef MAXPACKET
-# define MAXPACKET 8192 /* max packet size used internally by BIND */
-#endif
-
-typedef union
-{
- HEADER qb1;
- u_char qb2[MAXPACKET];
-} querybuf;
-
-#ifndef MXHOSTBUFSIZE
-# define MXHOSTBUFSIZE (128 * MAXMXHOSTS)
-#endif
-
-static char MXHostBuf[MXHOSTBUFSIZE];
-
-#ifndef MAXDNSRCH
-# define MAXDNSRCH 6 /* number of possible domains to search */
-#endif
-
-#ifndef MAX
-# define MAX(a, b) ((a) > (b) ? (a) : (b))
-#endif
-
-#ifndef NO_DATA
-# define NO_DATA NO_ADDRESS
-#endif
-
-#ifndef HFIXEDSZ
-# define HFIXEDSZ 12 /* sizeof(HEADER) */
-#endif
-
-#define MAXCNAMEDEPTH 10 /* maximum depth of CNAME recursion */
-
-#if defined(__RES) && (__RES >= 19940415)
-# define RES_UNC_T char *
-#else
-# define RES_UNC_T u_char *
-#endif
-\f/*
-** GETMXRR -- get MX resource records for a domain
-**
-** Parameters:
-** host -- the name of the host to MX.
-** mxhosts -- a pointer to a return buffer of MX records.
-** droplocalhost -- If TRUE, all MX records less preferred
-** than the local host (as determined by $=w) will
-** be discarded.
-** rcode -- a pointer to an EX_ status code.
-**
-** Returns:
-** The number of MX records found.
-** -1 if there is an internal failure.
-** If no MX records are found, mxhosts[0] is set to host
-** and 1 is returned.
-*/
-
-int
-getmxrr(host, mxhosts, droplocalhost, rcode)
- char *host;
- char **mxhosts;
- bool droplocalhost;
- int *rcode;
-{
- register u_char *eom, *cp;
- register int i, j, n;
- int nmx = 0;
- register char *bp;
- HEADER *hp;
- querybuf answer;
- int ancount, qdcount, buflen;
- bool seenlocal = FALSE;
- u_short pref, type;
- u_short localpref = 256;
- char *fallbackMX = FallBackMX;
- bool trycanon = FALSE;
- int (*resfunc)();
- extern int res_query(), res_search();
- u_short prefer[MAXMXHOSTS];
- int weight[MAXMXHOSTS];
- extern int mxrand __P((char *));
-
- if (tTd(8, 2))
- printf("getmxrr(%s, droplocalhost=%d)\n", host, droplocalhost);
-
- if (fallbackMX != NULL && droplocalhost &&
- wordinclass(fallbackMX, 'w'))
- {
- /* don't use fallback for this pass */
- fallbackMX = NULL;
- }
-
- *rcode = EX_OK;
-
- /* efficiency hack -- numeric or non-MX lookups */
- if (host[0] == '[')
- goto punt;
-
- /*
- ** If we don't have MX records in our host switch, don't
- ** try for MX records. Note that this really isn't "right",
- ** since we might be set up to try NIS first and then DNS;
- ** if the host is found in NIS we really shouldn't be doing
- ** MX lookups. However, that should be a degenerate case.
- */
-
- if (!UseNameServer)
- goto punt;
- if (HasWildcardMX && ConfigLevel >= 6)
- resfunc = res_query;
- else
- resfunc = res_search;
-
- errno = 0;
- n = (*resfunc)(host, C_IN, T_MX, (u_char *) &answer, sizeof(answer));
- if (n < 0)
- {
- if (tTd(8, 1))
- printf("getmxrr: res_search(%s) failed (errno=%d, h_errno=%d)\n",
- (host == NULL) ? "<NULL>" : host, errno, h_errno);
- switch (h_errno)
- {
- case NO_DATA:
- trycanon = TRUE;
- /* fall through */
-
- case NO_RECOVERY:
- /* no MX data on this host */
- goto punt;
-
- case HOST_NOT_FOUND:
-#if BROKEN_RES_SEARCH
- case 0: /* Ultrix resolver retns failure w/ h_errno=0 */
-#endif
- /* host doesn't exist in DNS; might be in /etc/hosts */
- trycanon = TRUE;
- *rcode = EX_NOHOST;
- goto punt;
-
- case TRY_AGAIN:
- case -1:
- /* couldn't connect to the name server */
- if (fallbackMX != NULL)
- {
- /* name server is hosed -- push to fallback */
- mxhosts[nmx++] = fallbackMX;
- return nmx;
- }
- /* it might come up later; better queue it up */
- *rcode = EX_TEMPFAIL;
- break;
-
- default:
- syserr("getmxrr: res_search (%s) failed with impossible h_errno (%d)\n",
- host, h_errno);
- *rcode = EX_OSERR;
- break;
- }
-
- /* irreconcilable differences */
- return (-1);
- }
-
- /* avoid problems after truncation in tcp packets */
- if (n > sizeof(answer))
- n = sizeof(answer);
-
- /* find first satisfactory answer */
- hp = (HEADER *)&answer;
- cp = (u_char *)&answer + HFIXEDSZ;
- eom = (u_char *)&answer + n;
- for (qdcount = ntohs(hp->qdcount); qdcount--; cp += n + QFIXEDSZ)
- if ((n = dn_skipname(cp, eom)) < 0)
- goto punt;
- buflen = sizeof(MXHostBuf) - 1;
- bp = MXHostBuf;
- ancount = ntohs(hp->ancount);
- while (--ancount >= 0 && cp < eom && nmx < MAXMXHOSTS - 1)
- {
- if ((n = dn_expand((u_char *)&answer,
- eom, cp, (RES_UNC_T) bp, buflen)) < 0)
- break;
- cp += n;
- GETSHORT(type, cp);
- cp += INT16SZ + INT32SZ;
- GETSHORT(n, cp);
- if (type != T_MX)
- {
- if (tTd(8, 8) || _res.options & RES_DEBUG)
- printf("unexpected answer type %d, size %d\n",
- type, n);
- cp += n;
- continue;
- }
- GETSHORT(pref, cp);
- if ((n = dn_expand((u_char *)&answer, eom, cp,
- (RES_UNC_T) bp, buflen)) < 0)
- break;
- cp += n;
- if (wordinclass(bp, 'w'))
- {
- if (tTd(8, 3))
- printf("found localhost (%s) in MX list, pref=%d\n",
- bp, pref);
- if (droplocalhost)
- {
- if (!seenlocal || pref < localpref)
- localpref = pref;
- seenlocal = TRUE;
- continue;
- }
- weight[nmx] = 0;
- }
- else
- weight[nmx] = mxrand(bp);
- prefer[nmx] = pref;
- mxhosts[nmx++] = bp;
- n = strlen(bp);
- bp += n;
- if (bp[-1] != '.')
- {
- *bp++ = '.';
- n++;
- }
- *bp++ = '\0';
- buflen -= n + 1;
- }
-
- /* sort the records */
- for (i = 0; i < nmx; i++)
- {
- for (j = i + 1; j < nmx; j++)
- {
- if (prefer[i] > prefer[j] ||
- (prefer[i] == prefer[j] && weight[i] > weight[j]))
- {
- register int temp;
- register char *temp1;
-
- temp = prefer[i];
- prefer[i] = prefer[j];
- prefer[j] = temp;
- temp1 = mxhosts[i];
- mxhosts[i] = mxhosts[j];
- mxhosts[j] = temp1;
- temp = weight[i];
- weight[i] = weight[j];
- weight[j] = temp;
- }
- }
- if (seenlocal && prefer[i] >= localpref)
- {
- /* truncate higher preference part of list */
- nmx = i;
- }
- }
-
- /* delete duplicates from list (yes, some bozos have duplicates) */
- for (i = 0; i < nmx - 1; )
- {
- if (strcasecmp(mxhosts[i], mxhosts[i + 1]) != 0)
- i++;
- else
- {
- /* compress out duplicate */
- for (j = i + 1; j < nmx; j++)
- mxhosts[j] = mxhosts[j + 1];
- nmx--;
- }
- }
-
- if (nmx == 0)
- {
-punt:
- if (seenlocal &&
- (!TryNullMXList || sm_gethostbyname(host) == NULL))
- {
- /*
- ** If we have deleted all MX entries, this is
- ** an error -- we should NEVER send to a host that
- ** has an MX, and this should have been caught
- ** earlier in the config file.
- **
- ** Some sites prefer to go ahead and try the
- ** A record anyway; that case is handled by
- ** setting TryNullMXList. I believe this is a
- ** bad idea, but it's up to you....
- */
-
- *rcode = EX_CONFIG;
- syserr("MX list for %s points back to %s",
- host, MyHostName);
- return -1;
- }
- if (strlen(host) >= (SIZE_T) sizeof MXHostBuf)
- {
- *rcode = EX_CONFIG;
- syserr("Host name %s too long",
- shortenstring(host, MAXSHORTSTR));
- return -1;
- }
- snprintf(MXHostBuf, sizeof MXHostBuf, "%s", host);
- mxhosts[0] = MXHostBuf;
- if (host[0] == '[')
- {
- register char *p;
-
- /* this may be an MX suppression-style address */
- p = strchr(MXHostBuf, ']');
- if (p != NULL)
- {
- *p = '\0';
- if (inet_addr(&MXHostBuf[1]) != INADDR_NONE)
- {
- nmx++;
- *p = ']';
- }
- else
- {
- trycanon = TRUE;
- mxhosts[0]++;
- }
- }
- }
- if (trycanon &&
- getcanonname(mxhosts[0], sizeof MXHostBuf - 2, FALSE))
- {
- bp = &MXHostBuf[strlen(MXHostBuf)];
- if (bp[-1] != '.')
- {
- *bp++ = '.';
- *bp = '\0';
- }
- nmx = 1;
- }
- }
-
- /* if we have a default lowest preference, include that */
- if (fallbackMX != NULL && !seenlocal)
- mxhosts[nmx++] = fallbackMX;
-
- return (nmx);
-}
-\f/*
-** MXRAND -- create a randomizer for equal MX preferences
-**
-** If two MX hosts have equal preferences we want to randomize
-** the selection. But in order for signatures to be the same,
-** we need to randomize the same way each time. This function
-** computes a pseudo-random hash function from the host name.
-**
-** Parameters:
-** host -- the name of the host.
-**
-** Returns:
-** A random but repeatable value based on the host name.
-**
-** Side Effects:
-** none.
-*/
-
-int
-mxrand(host)
- register char *host;
-{
- int hfunc;
- static unsigned int seed;
-
- if (seed == 0)
- {
- seed = (int) curtime() & 0xffff;
- if (seed == 0)
- seed++;
- }
-
- if (tTd(17, 9))
- printf("mxrand(%s)", host);
-
- hfunc = seed;
- while (*host != '\0')
- {
- int c = *host++;
-
- if (isascii(c) && isupper(c))
- c = tolower(c);
- hfunc = ((hfunc << 1) ^ c) % 2003;
- }
-
- hfunc &= 0xff;
- hfunc++;
-
- if (tTd(17, 9))
- printf(" = %d\n", hfunc);
- return hfunc;
-}
-\f/*
-** BESTMX -- find the best MX for a name
-**
-** This is really a hack, but I don't see any obvious way
-** to generalize it at the moment.
-*/
-
-/* ARGSUSED3 */
-char *
-bestmx_map_lookup(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- int nmx;
- int saveopts = _res.options;
- int i, len = 0;
- char *p;
- char *mxhosts[MAXMXHOSTS + 1];
- char buf[PSBUFSIZE / 2];
-
- _res.options &= ~(RES_DNSRCH|RES_DEFNAMES);
- nmx = getmxrr(name, mxhosts, FALSE, statp);
- _res.options = saveopts;
- if (nmx <= 0)
- return NULL;
- if (bitset(MF_MATCHONLY, map->map_mflags))
- return map_rewrite(map, name, strlen(name), NULL);
- if ((map->map_coldelim == '\0') || (nmx == 1))
- return map_rewrite(map, mxhosts[0], strlen(mxhosts[0]), av);
-
- /*
- ** We were given a -z flag (return all MXs) and there are multiple
- ** ones. We need to build them all into a list.
- */
- p = buf;
- for (i = 0; i < nmx; i++)
- {
- int slen;
-
- if (strchr(mxhosts[i], map->map_coldelim) != NULL)
- {
- syserr("bestmx_map_lookup: MX host %.64s includes map delimiter character 0x%02X",
- mxhosts[i], map->map_coldelim);
- return NULL;
- }
- slen = strlen(mxhosts[i]);
- if (len + slen + 2 > sizeof buf)
- break;
- if (i > 0)
- {
- *p++ = map->map_coldelim;
- len++;
- }
- strcpy(p, mxhosts[i]);
- p += slen;
- len += slen;
- }
- return map_rewrite(map, buf, len, av);
-}
-\f/*
-** DNS_GETCANONNAME -- get the canonical name for named host using DNS
-**
-** This algorithm tries to be smart about wildcard MX records.
-** This is hard to do because DNS doesn't tell is if we matched
-** against a wildcard or a specific MX.
-**
-** We always prefer A & CNAME records, since these are presumed
-** to be specific.
-**
-** If we match an MX in one pass and lose it in the next, we use
-** the old one. For example, consider an MX matching *.FOO.BAR.COM.
-** A hostname bletch.foo.bar.com will match against this MX, but
-** will stop matching when we try bletch.bar.com -- so we know
-** that bletch.foo.bar.com must have been right. This fails if
-** there was also an MX record matching *.BAR.COM, but there are
-** some things that just can't be fixed.
-**
-** Parameters:
-** host -- a buffer containing the name of the host.
-** This is a value-result parameter.
-** hbsize -- the size of the host buffer.
-** trymx -- if set, try MX records as well as A and CNAME.
-** statp -- pointer to place to store status.
-**
-** Returns:
-** TRUE -- if the host matched.
-** FALSE -- otherwise.
-*/
-
-bool
-dns_getcanonname(host, hbsize, trymx, statp)
- char *host;
- int hbsize;
- bool trymx;
- int *statp;
-{
- register u_char *eom, *ap;
- register char *cp;
- register int n;
- HEADER *hp;
- querybuf answer;
- int ancount, qdcount;
- int ret;
- char **domain;
- int type;
- char **dp;
- char *mxmatch;
- bool amatch;
- bool gotmx = FALSE;
- int qtype;
- int loopcnt;
- char *xp;
- char nbuf[MAX(MAXPACKET, MAXDNAME*2+2)];
- char *searchlist[MAXDNSRCH+2];
- extern char *gethostalias __P((char *));
-
- if (tTd(8, 2))
- printf("dns_getcanonname(%s, trymx=%d)\n", host, trymx);
-
- if ((_res.options & RES_INIT) == 0 && res_init() == -1)
- {
- *statp = EX_UNAVAILABLE;
- return FALSE;
- }
-
- /*
- ** Initialize domain search list. If there is at least one
- ** dot in the name, search the unmodified name first so we
- ** find "vse.CS" in Czechoslovakia instead of in the local
- ** domain (e.g., vse.CS.Berkeley.EDU).
- **
- ** Older versions of the resolver could create this
- ** list by tearing apart the host name.
- */
-
- loopcnt = 0;
-cnameloop:
- /* Check for dots in the name */
- for (cp = host, n = 0; *cp != '\0'; cp++)
- if (*cp == '.')
- n++;
-
- /*
- ** If this is a simple name, determine whether it matches an
- ** alias in the file defined by the environment variable HOSTALIASES.
- */
- if (n == 0 && (xp = gethostalias(host)) != NULL)
- {
- if (loopcnt++ > MAXCNAMEDEPTH)
- {
- syserr("loop in ${HOSTALIASES} file");
- }
- else
- {
- strncpy(host, xp, hbsize);
- host[hbsize - 1] = '\0';
- goto cnameloop;
- }
- }
-
- /*
- ** Build the search list.
- ** If there is at least one dot in name, start with a null
- ** domain to search the unmodified name first.
- ** If name does not end with a dot and search up local domain
- ** tree desired, append each local domain component to the
- ** search list; if name contains no dots and default domain
- ** name is desired, append default domain name to search list;
- ** else if name ends in a dot, remove that dot.
- */
-
- dp = searchlist;
- if (n > 0)
- *dp++ = "";
- if (n >= 0 && *--cp != '.' && bitset(RES_DNSRCH, _res.options))
- {
- for (domain = _res.dnsrch; *domain != NULL; )
- *dp++ = *domain++;
- }
- else if (n == 0 && bitset(RES_DEFNAMES, _res.options))
- {
- *dp++ = _res.defdname;
- }
- else if (*cp == '.')
- {
- *cp = '\0';
- }
- *dp = NULL;
-
- /*
- ** Now loop through the search list, appending each domain in turn
- ** name and searching for a match.
- */
-
- mxmatch = NULL;
- qtype = T_ANY;
-
- for (dp = searchlist; *dp != NULL; )
- {
- if (qtype == T_ANY)
- gotmx = FALSE;
- if (tTd(8, 5))
- printf("dns_getcanonname: trying %s.%s (%s)\n",
- host, *dp,
- qtype == T_ANY ? "ANY" : qtype == T_A ? "A" :
- qtype == T_MX ? "MX" : "???");
- ret = res_querydomain(host, *dp, C_IN, qtype,
- answer.qb2, sizeof(answer.qb2));
- if (ret <= 0)
- {
- if (tTd(8, 7))
- printf("\tNO: errno=%d, h_errno=%d\n",
- errno, h_errno);
-
- if (errno == ECONNREFUSED || h_errno == TRY_AGAIN)
- {
- /* the name server seems to be down */
- h_errno = TRY_AGAIN;
- *statp = EX_TEMPFAIL;
- return FALSE;
- }
-
- if (h_errno != HOST_NOT_FOUND)
- {
- /* might have another type of interest */
- if (qtype == T_ANY)
- {
- qtype = T_A;
- continue;
- }
- else if (qtype == T_A && !gotmx && (trymx || **dp == '\0'))
- {
- qtype = T_MX;
- continue;
- }
- }
-
- /* definite no -- try the next domain */
- dp++;
- qtype = T_ANY;
- continue;
- }
- else if (tTd(8, 7))
- printf("\tYES\n");
-
- /* avoid problems after truncation in tcp packets */
- if (ret > sizeof(answer))
- ret = sizeof(answer);
-
- /*
- ** Appear to have a match. Confirm it by searching for A or
- ** CNAME records. If we don't have a local domain
- ** wild card MX record, we will accept MX as well.
- */
-
- hp = (HEADER *) &answer;
- ap = (u_char *) &answer + HFIXEDSZ;
- eom = (u_char *) &answer + ret;
-
- /* skip question part of response -- we know what we asked */
- for (qdcount = ntohs(hp->qdcount); qdcount--; ap += ret + QFIXEDSZ)
- {
- if ((ret = dn_skipname(ap, eom)) < 0)
- {
- if (tTd(8, 20))
- printf("qdcount failure (%d)\n",
- ntohs(hp->qdcount));
- *statp = EX_SOFTWARE;
- return FALSE; /* ???XXX??? */
- }
- }
-
- amatch = FALSE;
- for (ancount = ntohs(hp->ancount); --ancount >= 0 && ap < eom;
- ap += n)
- {
- n = dn_expand((u_char *) &answer, eom, ap,
- (RES_UNC_T) nbuf, sizeof nbuf);
- if (n < 0)
- break;
- ap += n;
- GETSHORT(type, ap);
- ap += INT16SZ + INT32SZ;
- GETSHORT(n, ap);
- switch (type)
- {
- case T_MX:
- gotmx = TRUE;
- if (**dp != '\0' && HasWildcardMX)
- {
- /*
- ** If we are using MX matches and have
- ** not yet gotten one, save this one
- ** but keep searching for an A or
- ** CNAME match.
- */
-
- if (trymx && mxmatch == NULL)
- mxmatch = *dp;
- continue;
- }
-
- /*
- ** If we did not append a domain name, this
- ** must have been a canonical name to start
- ** with. Even if we did append a domain name,
- ** in the absence of a wildcard MX this must
- ** still be a real MX match.
- ** Such MX matches are as good as an A match,
- ** fall through.
- */
-
- case T_A:
- /* Flag that a good match was found */
- amatch = TRUE;
-
- /* continue in case a CNAME also exists */
- continue;
-
- case T_CNAME:
- if (DontExpandCnames)
- {
- /* got CNAME -- guaranteed canonical */
- amatch = TRUE;
- break;
- }
-
- if (loopcnt++ > MAXCNAMEDEPTH)
- {
- /*XXX should notify postmaster XXX*/
- message("DNS failure: CNAME loop for %s",
- host);
- if (CurEnv->e_message == NULL)
- {
- char ebuf[MAXLINE];
-
- snprintf(ebuf, sizeof ebuf,
- "Deferred: DNS failure: CNAME loop for %.100s",
- host);
- CurEnv->e_message = newstr(ebuf);
- }
- h_errno = NO_RECOVERY;
- *statp = EX_CONFIG;
- return FALSE;
- }
-
- /* value points at name */
- if ((ret = dn_expand((u_char *)&answer,
- eom, ap, (RES_UNC_T) nbuf, sizeof(nbuf))) < 0)
- break;
- (void)strncpy(host, nbuf, hbsize); /* XXX */
- host[hbsize - 1] = '\0';
-
- /*
- ** RFC 1034 section 3.6 specifies that CNAME
- ** should point at the canonical name -- but
- ** urges software to try again anyway.
- */
-
- goto cnameloop;
-
- default:
- /* not a record of interest */
- continue;
- }
- }
-
- if (amatch)
- {
- /*
- ** Got a good match -- either an A, CNAME, or an
- ** exact MX record. Save it and get out of here.
- */
-
- mxmatch = *dp;
- break;
- }
-
- /*
- ** Nothing definitive yet.
- ** If this was a T_ANY query, we don't really know what
- ** was returned -- it might have been a T_NS,
- ** for example. Try T_A to be more specific
- ** during the next pass.
- ** If this was a T_A query and we haven't yet found a MX
- ** match, try T_MX if allowed to do so.
- ** Otherwise, try the next domain.
- */
-
- if (qtype == T_ANY)
- qtype = T_A;
- else if (qtype == T_A && !gotmx && (trymx || **dp == '\0'))
- qtype = T_MX;
- else
- {
- qtype = T_ANY;
- dp++;
- }
- }
-
- /* if nothing was found, we are done */
- if (mxmatch == NULL)
- {
- *statp = EX_NOHOST;
- return FALSE;
- }
-
- /*
- ** Create canonical name and return.
- ** If saved domain name is null, name was already canonical.
- ** Otherwise append the saved domain name.
- */
-
- (void) snprintf(nbuf, sizeof nbuf, "%.*s%s%.*s", MAXDNAME, host,
- *mxmatch == '\0' ? "" : ".",
- MAXDNAME, mxmatch);
- strncpy(host, nbuf, hbsize);
- host[hbsize - 1] = '\0';
- if (tTd(8, 5))
- printf("dns_getcanonname: %s\n", host);
- *statp = EX_OK;
- return TRUE;
-}
-
-
-
-char *
-gethostalias(host)
- char *host;
-{
- char *fname;
- FILE *fp;
- register char *p = NULL;
- int sff = SFF_REGONLY;
- char buf[MAXLINE];
- static char hbuf[MAXDNAME];
-
- if (DontLockReadFiles)
- sff |= SFF_NOLOCK;
- fname = getenv("HOSTALIASES");
- if (fname == NULL ||
- (fp = safefopen(fname, O_RDONLY, 0, sff)) == NULL)
- return NULL;
- while (fgets(buf, sizeof buf, fp) != NULL)
- {
- for (p = buf; p != '\0' && !(isascii(*p) && isspace(*p)); p++)
- continue;
- if (*p == 0)
- {
- /* syntax error */
- continue;
- }
- *p++ = '\0';
- if (strcasecmp(buf, host) == 0)
- break;
- }
-
- if (feof(fp))
- {
- /* no match */
- fclose(fp);
- return NULL;
- }
- fclose(fp);
-
- /* got a match; extract the equivalent name */
- while (*p != '\0' && isascii(*p) && isspace(*p))
- p++;
- host = p;
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- *p = '\0';
- strncpy(hbuf, host, sizeof hbuf - 1);
- hbuf[sizeof hbuf - 1] = '\0';
- return hbuf;
-}
-
-#endif /* NAMED_BIND */
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)envelope.c 8.122 (Berkeley) 1/25/1999";
-#endif /* not lint */
-
-#include "sendmail.h"
-
-/*
-** NEWENVELOPE -- allocate a new envelope
-**
-** Supports inheritance.
-**
-** Parameters:
-** e -- the new envelope to fill in.
-** parent -- the envelope to be the parent of e.
-**
-** Returns:
-** e.
-**
-** Side Effects:
-** none.
-*/
-
-ENVELOPE *
-newenvelope(e, parent)
- register ENVELOPE *e;
- register ENVELOPE *parent;
-{
- if (e == parent && e->e_parent != NULL)
- parent = e->e_parent;
- clearenvelope(e, TRUE);
- if (e == CurEnv)
- bcopy((char *) &NullAddress, (char *) &e->e_from, sizeof e->e_from);
- else
- bcopy((char *) &CurEnv->e_from, (char *) &e->e_from, sizeof e->e_from);
- e->e_parent = parent;
- e->e_ctime = curtime();
- if (parent != NULL)
- e->e_msgpriority = parent->e_msgsize;
- e->e_puthdr = putheader;
- e->e_putbody = putbody;
- if (CurEnv->e_xfp != NULL)
- (void) fflush(CurEnv->e_xfp);
-
- return (e);
-}
-\f/*
-** DROPENVELOPE -- deallocate an envelope.
-**
-** Parameters:
-** e -- the envelope to deallocate.
-** fulldrop -- if set, do return receipts.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** housekeeping necessary to dispose of an envelope.
-** Unlocks this queue file.
-*/
-
-void
-dropenvelope(e, fulldrop)
- register ENVELOPE *e;
- bool fulldrop;
-{
- bool queueit = FALSE;
- bool message_timeout = FALSE;
- bool failure_return = FALSE;
- bool delay_return = FALSE;
- bool success_return = FALSE;
- register ADDRESS *q;
- char *id = e->e_id;
- char buf[MAXLINE];
-
- if (tTd(50, 1))
- {
- extern void printenvflags __P((ENVELOPE *));
-
- printf("dropenvelope %lx: id=", (u_long) e);
- xputs(e->e_id);
- printf(", flags=");
- printenvflags(e);
- if (tTd(50, 10))
- {
- printf("sendq=");
- printaddr(e->e_sendqueue, TRUE);
- }
- }
-
- if (LogLevel > 84)
- sm_syslog(LOG_DEBUG, id,
- "dropenvelope, e_flags=0x%x, OpMode=%c, pid=%d",
- e->e_flags, OpMode, getpid());
-
- /* we must have an id to remove disk files */
- if (id == NULL)
- return;
-
- /* if verify-only mode, we can skip most of this */
- if (OpMode == MD_VERIFY)
- goto simpledrop;
-
- if (LogLevel > 4 && bitset(EF_LOGSENDER, e->e_flags))
- logsender(e, NULL);
- e->e_flags &= ~EF_LOGSENDER;
-
- /* post statistics */
- poststats(StatFile);
-
- /*
- ** Extract state information from dregs of send list.
- */
-
- if (curtime() > e->e_ctime + TimeOuts.to_q_return[e->e_timeoutclass])
- message_timeout = TRUE;
-
- e->e_flags &= ~EF_QUEUERUN;
- for (q = e->e_sendqueue; q != NULL; q = q->q_next)
- {
- if (bitset(QQUEUEUP, q->q_flags) &&
- bitset(QDONTSEND, q->q_flags))
- {
- /* I'm not sure how this happens..... */
- if (tTd(50, 2))
- {
- printf("Bogus flags: ");
- printaddr(q, FALSE);
- }
- q->q_flags &= ~QDONTSEND;
- }
- if (!bitset(QBADADDR|QDONTSEND|QSENT, q->q_flags))
- queueit = TRUE;
-#if XDEBUG
- else if (bitset(QQUEUEUP, q->q_flags))
- sm_syslog(LOG_DEBUG, e->e_id,
- "dropenvelope: q_flags = %x, paddr = %s",
- q->q_flags, q->q_paddr);
-#endif
-
- /* see if a notification is needed */
- if (bitset(QPINGONFAILURE, q->q_flags) &&
- ((message_timeout && bitset(QQUEUEUP, q->q_flags)) ||
- bitset(QBADADDR, q->q_flags)))
- {
- failure_return = TRUE;
- if (q->q_owner == NULL && !emptyaddr(&e->e_from))
- (void) sendtolist(e->e_from.q_paddr, NULLADDR,
- &e->e_errorqueue, 0, e);
- }
- else if (bitset(QPINGONSUCCESS, q->q_flags) &&
- ((bitset(QSENT, q->q_flags) &&
- bitnset(M_LOCALMAILER, q->q_mailer->m_flags)) ||
- bitset(QRELAYED|QEXPANDED|QDELIVERED, q->q_flags)))
- {
- success_return = TRUE;
- }
- }
-
- if (e->e_class < 0)
- e->e_flags |= EF_NO_BODY_RETN;
-
- /*
- ** See if the message timed out.
- */
-
- if (!queueit)
- /* nothing to do */ ;
- else if (message_timeout)
- {
- if (failure_return)
- {
- (void) snprintf(buf, sizeof buf,
- "Cannot send message within %s",
- pintvl(TimeOuts.to_q_return[e->e_timeoutclass], FALSE));
- if (e->e_message != NULL)
- free(e->e_message);
- e->e_message = newstr(buf);
- message(buf);
- e->e_flags |= EF_CLRQUEUE;
- }
- fprintf(e->e_xfp, "Message could not be delivered for %s\n",
- pintvl(TimeOuts.to_q_return[e->e_timeoutclass], FALSE));
- fprintf(e->e_xfp, "Message will be deleted from queue\n");
- for (q = e->e_sendqueue; q != NULL; q = q->q_next)
- {
- if (!bitset(QBADADDR|QDONTSEND|QSENT, q->q_flags))
- {
- q->q_flags |= QBADADDR;
- q->q_status = "4.4.7";
- }
- }
- }
- else if (TimeOuts.to_q_warning[e->e_timeoutclass] > 0 &&
- curtime() > e->e_ctime + TimeOuts.to_q_warning[e->e_timeoutclass])
- {
- if (!bitset(EF_WARNING|EF_RESPONSE, e->e_flags) &&
- e->e_class >= 0 &&
- e->e_from.q_paddr != NULL &&
- strcmp(e->e_from.q_paddr, "<>") != 0 &&
- strncasecmp(e->e_from.q_paddr, "owner-", 6) != 0 &&
- (strlen(e->e_from.q_paddr) <= (SIZE_T) 8 ||
- strcasecmp(&e->e_from.q_paddr[strlen(e->e_from.q_paddr) - 8], "-request") != 0))
- {
- for (q = e->e_sendqueue; q != NULL; q = q->q_next)
- {
- if (bitset(QQUEUEUP, q->q_flags) &&
- bitset(QPINGONDELAY, q->q_flags))
- {
- q->q_flags |= QDELAYED;
- delay_return = TRUE;
- }
- }
- }
- if (delay_return)
- {
- (void) snprintf(buf, sizeof buf,
- "Warning: could not send message for past %s",
- pintvl(TimeOuts.to_q_warning[e->e_timeoutclass], FALSE));
- if (e->e_message != NULL)
- free(e->e_message);
- e->e_message = newstr(buf);
- message(buf);
- e->e_flags |= EF_WARNING;
- }
- fprintf(e->e_xfp,
- "Warning: message still undelivered after %s\n",
- pintvl(TimeOuts.to_q_warning[e->e_timeoutclass], FALSE));
- fprintf(e->e_xfp, "Will keep trying until message is %s old\n",
- pintvl(TimeOuts.to_q_return[e->e_timeoutclass], FALSE));
- }
-
- if (tTd(50, 2))
- printf("failure_return=%d delay_return=%d success_return=%d queueit=%d\n",
- failure_return, delay_return, success_return, queueit);
-
- /*
- ** If we had some fatal error, but no addresses are marked as
- ** bad, mark them _all_ as bad.
- */
-
- if (bitset(EF_FATALERRS, e->e_flags) && !failure_return)
- {
- for (q = e->e_sendqueue; q != NULL; q = q->q_next)
- {
- if (!bitset(QDONTSEND, q->q_flags) &&
- bitset(QPINGONFAILURE, q->q_flags))
- {
- failure_return = TRUE;
- q->q_flags |= QBADADDR;
- }
- }
- }
-
- /*
- ** Send back return receipts as requested.
- */
-
- if (success_return && !failure_return && !delay_return && fulldrop &&
- !bitset(PRIV_NORECEIPTS, PrivacyFlags) &&
- strcmp(e->e_from.q_paddr, "<>") != 0)
- {
- auto ADDRESS *rlist = NULL;
-
- if (tTd(50, 8))
- printf("dropenvelope(%s): sending return receipt\n", id);
- e->e_flags |= EF_SENDRECEIPT;
- (void) sendtolist(e->e_from.q_paddr, NULLADDR, &rlist, 0, e);
- (void) returntosender("Return receipt", rlist, RTSF_NO_BODY, e);
- }
- e->e_flags &= ~EF_SENDRECEIPT;
-
- /*
- ** Arrange to send error messages if there are fatal errors.
- */
-
- if ((failure_return || delay_return) && e->e_errormode != EM_QUIET)
- {
- extern void savemail __P((ENVELOPE *, bool));
-
- if (tTd(50, 8))
- printf("dropenvelope(%s): saving mail\n", id);
- savemail(e, !bitset(EF_NO_BODY_RETN, e->e_flags));
- }
-
- /*
- ** Arrange to send warning messages to postmaster as requested.
- */
-
- if ((failure_return || bitset(EF_PM_NOTIFY, e->e_flags)) &&
- PostMasterCopy != NULL &&
- !bitset(EF_RESPONSE, e->e_flags) && e->e_class >= 0)
- {
- auto ADDRESS *rlist = NULL;
-
- if (tTd(50, 8))
- printf("dropenvelope(%s): sending postmaster copy\n", id);
- (void) sendtolist(PostMasterCopy, NULLADDR, &rlist, 0, e);
- (void) returntosender(e->e_message, rlist, RTSF_PM_BOUNCE, e);
- }
-
- /*
- ** Instantiate or deinstantiate the queue.
- */
-
-simpledrop:
- if (tTd(50, 8))
- printf("dropenvelope(%s): at simpledrop, queueit=%d\n",
- id, queueit);
- if (!queueit || bitset(EF_CLRQUEUE, e->e_flags))
- {
- if (tTd(50, 1))
- {
- extern void printenvflags __P((ENVELOPE *));
-
- printf("\n===== Dropping [dq]f%s... queueit=%d, e_flags=",
- e->e_id, queueit);
- printenvflags(e);
- }
- xunlink(queuename(e, 'd'));
- xunlink(queuename(e, 'q'));
-
- if (LogLevel > 10)
- sm_syslog(LOG_INFO, id, "done");
- }
- else if (queueit || !bitset(EF_INQUEUE, e->e_flags))
- {
-#if QUEUE
- queueup(e, FALSE);
-#else /* QUEUE */
- syserr("554 dropenvelope: queueup");
-#endif /* QUEUE */
- }
-
- /* now unlock the job */
- if (tTd(50, 8))
- printf("dropenvelope(%s): unlocking job\n", id);
- closexscript(e);
- unlockqueue(e);
-
- /* make sure that this envelope is marked unused */
- if (e->e_dfp != NULL)
- (void) xfclose(e->e_dfp, "dropenvelope df", e->e_id);
- e->e_dfp = NULL;
- e->e_id = NULL;
- e->e_flags &= ~EF_HAS_DF;
-}
-\f/*
-** CLEARENVELOPE -- clear an envelope without unlocking
-**
-** This is normally used by a child process to get a clean
-** envelope without disturbing the parent.
-**
-** Parameters:
-** e -- the envelope to clear.
-** fullclear - if set, the current envelope is total
-** garbage and should be ignored; otherwise,
-** release any resources it may indicate.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Closes files associated with the envelope.
-** Marks the envelope as unallocated.
-*/
-
-void
-clearenvelope(e, fullclear)
- register ENVELOPE *e;
- bool fullclear;
-{
- register HDR *bh;
- register HDR **nhp;
- extern ENVELOPE BlankEnvelope;
-
- if (!fullclear)
- {
- /* clear out any file information */
- if (e->e_xfp != NULL)
- (void) xfclose(e->e_xfp, "clearenvelope xfp", e->e_id);
- if (e->e_dfp != NULL)
- (void) xfclose(e->e_dfp, "clearenvelope dfp", e->e_id);
- e->e_xfp = e->e_dfp = NULL;
- }
-
- /* now clear out the data */
- STRUCTCOPY(BlankEnvelope, *e);
- e->e_message = NULL;
- if (Verbose)
- e->e_sendmode = SM_DELIVER;
- bh = BlankEnvelope.e_header;
- nhp = &e->e_header;
- while (bh != NULL)
- {
- *nhp = (HDR *) xalloc(sizeof *bh);
- bcopy((char *) bh, (char *) *nhp, sizeof *bh);
- bh = bh->h_link;
- nhp = &(*nhp)->h_link;
- }
-}
-\f/*
-** INITSYS -- initialize instantiation of system
-**
-** In Daemon mode, this is done in the child.
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Initializes the system macros, some global variables,
-** etc. In particular, the current time in various
-** forms is set.
-*/
-
-void
-initsys(e)
- register ENVELOPE *e;
-{
- char cbuf[5]; /* holds hop count */
- char pbuf[10]; /* holds pid */
-#ifdef TTYNAME
- static char ybuf[60]; /* holds tty id */
- register char *p;
- extern char *ttyname();
-#endif /* TTYNAME */
- extern void settime __P((ENVELOPE *));
-
- /*
- ** Give this envelope a reality.
- ** I.e., an id, a transcript, and a creation time.
- */
-
- openxscript(e);
- e->e_ctime = curtime();
-
- /*
- ** Set OutChannel to something useful if stdout isn't it.
- ** This arranges that any extra stuff the mailer produces
- ** gets sent back to the user on error (because it is
- ** tucked away in the transcript).
- */
-
- if (OpMode == MD_DAEMON && bitset(EF_QUEUERUN, e->e_flags) &&
- e->e_xfp != NULL)
- OutChannel = e->e_xfp;
-
- /*
- ** Set up some basic system macros.
- */
-
- /* process id */
- (void) snprintf(pbuf, sizeof pbuf, "%d", getpid());
- define('p', newstr(pbuf), e);
-
- /* hop count */
- (void) snprintf(cbuf, sizeof cbuf, "%d", e->e_hopcount);
- define('c', newstr(cbuf), e);
-
- /* time as integer, unix time, arpa time */
- settime(e);
-
-#ifdef TTYNAME
- /* tty name */
- if (macvalue('y', e) == NULL)
- {
- p = ttyname(2);
- if (p != NULL)
- {
- if (strrchr(p, '/') != NULL)
- p = strrchr(p, '/') + 1;
- snprintf(ybuf, sizeof ybuf, "%s", p);
- define('y', ybuf, e);
- }
- }
-#endif /* TTYNAME */
-}
-\f/*
-** SETTIME -- set the current time.
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Sets the various time macros -- $a, $b, $d, $t.
-*/
-
-void
-settime(e)
- register ENVELOPE *e;
-{
- register char *p;
- auto time_t now;
- char tbuf[20]; /* holds "current" time */
- char dbuf[30]; /* holds ctime(tbuf) */
- register struct tm *tm;
- extern struct tm *gmtime();
-
- now = curtime();
- tm = gmtime(&now);
- (void) snprintf(tbuf, sizeof tbuf, "%04d%02d%02d%02d%02d", tm->tm_year + 1900,
- tm->tm_mon+1, tm->tm_mday, tm->tm_hour, tm->tm_min);
- define('t', newstr(tbuf), e);
- (void) strcpy(dbuf, ctime(&now));
- p = strchr(dbuf, '\n');
- if (p != NULL)
- *p = '\0';
- define('d', newstr(dbuf), e);
- p = arpadate(dbuf);
- p = newstr(p);
- if (macvalue('a', e) == NULL)
- define('a', p, e);
- define('b', p, e);
-}
-\f/*
-** OPENXSCRIPT -- Open transcript file
-**
-** Creates a transcript file for possible eventual mailing or
-** sending back.
-**
-** Parameters:
-** e -- the envelope to create the transcript in/for.
-**
-** Returns:
-** none
-**
-** Side Effects:
-** Creates the transcript file.
-*/
-
-#ifndef O_APPEND
-#define O_APPEND 0
-#endif
-
-void
-openxscript(e)
- register ENVELOPE *e;
-{
- register char *p;
- int fd;
-
- if (e->e_xfp != NULL)
- return;
- p = queuename(e, 'x');
- fd = open(p, O_WRONLY|O_CREAT|O_APPEND, FileMode);
- if (fd < 0)
- {
- syserr("Can't create transcript file %s", p);
- fd = open("/dev/null", O_WRONLY, 0644);
- if (fd < 0)
- syserr("!Can't open /dev/null");
- }
- e->e_xfp = fdopen(fd, "a");
- if (e->e_xfp == NULL)
- syserr("!Can't create transcript stream %s", p);
-#ifdef HASSETVBUF
- setvbuf(e->e_xfp, NULL, _IOLBF, 0);
-#else
- setlinebuf(e->e_xfp);
-#endif
- if (tTd(46, 9))
- {
- printf("openxscript(%s):\n ", p);
- dumpfd(fileno(e->e_xfp), TRUE, FALSE);
- }
-}
-\f/*
-** CLOSEXSCRIPT -- close the transcript file.
-**
-** Parameters:
-** e -- the envelope containing the transcript to close.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** none.
-*/
-
-void
-closexscript(e)
- register ENVELOPE *e;
-{
- if (e->e_xfp == NULL)
- return;
- (void) xfclose(e->e_xfp, "closexscript", e->e_id);
- e->e_xfp = NULL;
-}
-\f/*
-** SETSENDER -- set the person who this message is from
-**
-** Under certain circumstances allow the user to say who
-** s/he is (using -f or -r). These are:
-** 1. The user's uid is zero (root).
-** 2. The user's login name is in an approved list (typically
-** from a network server).
-** 3. The address the user is trying to claim has a
-** "!" character in it (since #2 doesn't do it for
-** us if we are dialing out for UUCP).
-** A better check to replace #3 would be if the
-** effective uid is "UUCP" -- this would require me
-** to rewrite getpwent to "grab" uucp as it went by,
-** make getname more nasty, do another passwd file
-** scan, or compile the UID of "UUCP" into the code,
-** all of which are reprehensible.
-**
-** Assuming all of these fail, we figure out something
-** ourselves.
-**
-** Parameters:
-** from -- the person we would like to believe this message
-** is from, as specified on the command line.
-** e -- the envelope in which we would like the sender set.
-** delimptr -- if non-NULL, set to the location of the
-** trailing delimiter.
-** delimchar -- the character that will delimit the sender
-** address.
-** internal -- set if this address is coming from an internal
-** source such as an owner alias.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** sets sendmail's notion of who the from person is.
-*/
-
-void
-setsender(from, e, delimptr, delimchar, internal)
- char *from;
- register ENVELOPE *e;
- char **delimptr;
- int delimchar;
- bool internal;
-{
- register char **pvp;
- char *realname = NULL;
- register struct passwd *pw;
- char *bp;
- char buf[MAXNAME + 2];
- char pvpbuf[PSBUFSIZE];
- extern char *FullName;
-
- if (tTd(45, 1))
- printf("setsender(%s)\n", from == NULL ? "" : from);
-
- /*
- ** Figure out the real user executing us.
- ** Username can return errno != 0 on non-errors.
- */
-
- if (bitset(EF_QUEUERUN, e->e_flags) || OpMode == MD_SMTP ||
- OpMode == MD_ARPAFTP || OpMode == MD_DAEMON)
- realname = from;
- if (realname == NULL || realname[0] == '\0')
- realname = username();
-
- if (ConfigLevel < 2)
- SuprErrs = TRUE;
-
- e->e_from.q_flags = QBADADDR;
- if (from == NULL ||
- parseaddr(from, &e->e_from, RF_COPYALL|RF_SENDERADDR,
- delimchar, delimptr, e) == NULL ||
- bitset(QBADADDR, e->e_from.q_flags) ||
- e->e_from.q_mailer == ProgMailer ||
- e->e_from.q_mailer == FileMailer ||
- e->e_from.q_mailer == InclMailer)
- {
- /* log garbage addresses for traceback */
- if (from != NULL && LogLevel > 2)
- {
- char *p;
- char ebuf[MAXNAME * 2 + 2];
-
- p = macvalue('_', e);
- if (p == NULL)
- {
- char *host = RealHostName;
-
- if (host == NULL)
- host = MyHostName;
- (void) snprintf(ebuf, sizeof ebuf, "%.*s@%.*s",
- MAXNAME, realname,
- MAXNAME, host);
- p = ebuf;
- }
- sm_syslog(LOG_NOTICE, e->e_id,
- "setsender: %s: invalid or unparseable, received from %s",
- shortenstring(from, 83), p);
- }
- if (from != NULL)
- {
- if (!bitset(QBADADDR, e->e_from.q_flags))
- {
- /* it was a bogus mailer in the from addr */
- e->e_status = "5.1.7";
- usrerr("553 Invalid sender address");
- }
- SuprErrs = TRUE;
- }
- if (from == realname ||
- parseaddr(from = newstr(realname), &e->e_from,
- RF_COPYALL|RF_SENDERADDR, ' ', NULL, e) == NULL)
- {
- char nbuf[100];
-
- SuprErrs = TRUE;
- expand("\201n", nbuf, sizeof nbuf, e);
- if (parseaddr(from = newstr(nbuf), &e->e_from,
- RF_COPYALL, ' ', NULL, e) == NULL &&
- parseaddr(from = "postmaster", &e->e_from,
- RF_COPYALL, ' ', NULL, e) == NULL)
- syserr("553 setsender: can't even parse postmaster!");
- }
- }
- else
- FromFlag = TRUE;
- e->e_from.q_flags |= QDONTSEND;
- if (tTd(45, 5))
- {
- printf("setsender: QDONTSEND ");
- printaddr(&e->e_from, FALSE);
- }
- SuprErrs = FALSE;
-
-# if USERDB
- if (bitnset(M_CHECKUDB, e->e_from.q_mailer->m_flags))
- {
- register char *p;
- extern char *udbsender __P((char *));
-
- p = udbsender(e->e_from.q_user);
- if (p != NULL)
- from = p;
- }
-# endif /* USERDB */
-
- if (bitnset(M_HASPWENT, e->e_from.q_mailer->m_flags))
- {
- if (!internal)
- {
- /* if the user already given fullname don't redefine */
- if (FullName == NULL)
- FullName = macvalue('x', e);
- if (FullName != NULL && FullName[0] == '\0')
- FullName = NULL;
- }
-
- if (e->e_from.q_user[0] != '\0' &&
- (pw = sm_getpwnam(e->e_from.q_user)) != NULL)
- {
- /*
- ** Process passwd file entry.
- */
-
- /* extract home directory */
- if (strcmp(pw->pw_dir, "/") == 0)
- e->e_from.q_home = newstr("");
- else
- e->e_from.q_home = newstr(pw->pw_dir);
- define('z', e->e_from.q_home, e);
-
- /* extract user and group id */
- e->e_from.q_uid = pw->pw_uid;
- e->e_from.q_gid = pw->pw_gid;
- e->e_from.q_flags |= QGOODUID;
-
- /* extract full name from passwd file */
- if (FullName == NULL && pw->pw_gecos != NULL &&
- strcmp(pw->pw_name, e->e_from.q_user) == 0 &&
- !internal)
- {
- buildfname(pw->pw_gecos, e->e_from.q_user, buf, sizeof buf);
- if (buf[0] != '\0')
- FullName = newstr(buf);
- }
- }
- else
- {
- e->e_from.q_home = "/no/such/directory";
- }
- if (FullName != NULL && !internal)
- define('x', FullName, e);
- }
- else if (!internal && OpMode != MD_DAEMON && OpMode != MD_SMTP)
- {
- if (e->e_from.q_home == NULL)
- {
- e->e_from.q_home = getenv("HOME");
- if (e->e_from.q_home != NULL &&
- strcmp(e->e_from.q_home, "/") == 0)
- e->e_from.q_home++;
- }
- e->e_from.q_uid = RealUid;
- e->e_from.q_gid = RealGid;
- e->e_from.q_flags |= QGOODUID;
- }
-
- /*
- ** Rewrite the from person to dispose of possible implicit
- ** links in the net.
- */
-
- pvp = prescan(from, delimchar, pvpbuf, sizeof pvpbuf, NULL, NULL);
- if (pvp == NULL)
- {
- /* don't need to give error -- prescan did that already */
- if (LogLevel > 2)
- sm_syslog(LOG_NOTICE, e->e_id,
- "cannot prescan from (%s)",
- shortenstring(from, MAXSHORTSTR));
- finis(TRUE, ExitStat);
- }
- (void) rewrite(pvp, 3, 0, e);
- (void) rewrite(pvp, 1, 0, e);
- (void) rewrite(pvp, 4, 0, e);
- bp = buf + 1;
- cataddr(pvp, NULL, bp, sizeof buf - 2, '\0');
- if (*bp == '@' && !bitnset(M_NOBRACKET, e->e_from.q_mailer->m_flags))
- {
- /* heuristic: route-addr: add angle brackets */
- strcat(bp, ">");
- *--bp = '<';
- }
- e->e_sender = newstr(bp);
- define('f', e->e_sender, e);
-
- /* save the domain spec if this mailer wants it */
- if (e->e_from.q_mailer != NULL &&
- bitnset(M_CANONICAL, e->e_from.q_mailer->m_flags))
- {
- char **lastat;
- extern char **copyplist __P((char **, bool));
-
- /* get rid of any pesky angle brackets */
- (void) rewrite(pvp, 3, 0, e);
- (void) rewrite(pvp, 1, 0, e);
- (void) rewrite(pvp, 4, 0, e);
-
- /* strip off to the last "@" sign */
- for (lastat = NULL; *pvp != NULL; pvp++)
- if (strcmp(*pvp, "@") == 0)
- lastat = pvp;
- if (lastat != NULL)
- {
- e->e_fromdomain = copyplist(lastat, TRUE);
- if (tTd(45, 3))
- {
- printf("Saving from domain: ");
- printav(e->e_fromdomain);
- }
- }
- }
-}
-\f/*
-** PRINTENVFLAGS -- print envelope flags for debugging
-**
-** Parameters:
-** e -- the envelope with the flags to be printed.
-**
-** Returns:
-** none.
-*/
-
-struct eflags
-{
- char *ef_name;
- u_long ef_bit;
-};
-
-struct eflags EnvelopeFlags[] =
-{
- { "OLDSTYLE", EF_OLDSTYLE },
- { "INQUEUE", EF_INQUEUE },
- { "NO_BODY_RETN", EF_NO_BODY_RETN },
- { "CLRQUEUE", EF_CLRQUEUE },
- { "SENDRECEIPT", EF_SENDRECEIPT },
- { "FATALERRS", EF_FATALERRS },
- { "DELETE_BCC", EF_DELETE_BCC },
- { "RESPONSE", EF_RESPONSE },
- { "RESENT", EF_RESENT },
- { "VRFYONLY", EF_VRFYONLY },
- { "WARNING", EF_WARNING },
- { "QUEUERUN", EF_QUEUERUN },
- { "GLOBALERRS", EF_GLOBALERRS },
- { "PM_NOTIFY", EF_PM_NOTIFY },
- { "METOO", EF_METOO },
- { "LOGSENDER", EF_LOGSENDER },
- { "NORECEIPT", EF_NORECEIPT },
- { "HAS8BIT", EF_HAS8BIT },
- { "NL_NOT_EOL", EF_NL_NOT_EOL },
- { "CRLF_NOT_EOL", EF_CRLF_NOT_EOL },
- { "RET_PARAM", EF_RET_PARAM },
- { "HAS_DF", EF_HAS_DF },
- { "IS_MIME", EF_IS_MIME },
- { "DONT_MIME", EF_DONT_MIME },
- { NULL }
-};
-
-void
-printenvflags(e)
- register ENVELOPE *e;
-{
- register struct eflags *ef;
- bool first = TRUE;
-
- printf("%lx", e->e_flags);
- for (ef = EnvelopeFlags; ef->ef_name != NULL; ef++)
- {
- if (!bitset(ef->ef_bit, e->e_flags))
- continue;
- if (first)
- printf("<%s", ef->ef_name);
- else
- printf(",%s", ef->ef_name);
- first = FALSE;
- }
- if (!first)
- printf(">\n");
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)err.c 8.74 (Berkeley) 6/4/1998";
-#endif /* not lint */
-
-# include "sendmail.h"
-# include <errno.h>
-
-/*
-** SYSERR -- Print error message.
-**
-** Prints an error message via printf to the diagnostic output.
-**
-** If the first character of the syserr message is `!' it will
-** log this as an ALERT message and exit immediately. This can
-** leave queue files in an indeterminate state, so it should not
-** be used lightly.
-**
-** Parameters:
-** fmt -- the format string. If it does not begin with
-** a three-digit SMTP reply code, either 554 or
-** 451 is assumed depending on whether errno
-** is set.
-** (others) -- parameters
-**
-** Returns:
-** none
-** Through TopFrame if QuickAbort is set.
-**
-** Side Effects:
-** increments Errors.
-** sets ExitStat.
-*/
-
-char MsgBuf[BUFSIZ*2]; /* text of most recent message */
-char HeldMessageBuf[sizeof MsgBuf]; /* for held messages */
-
-extern void putoutmsg __P((char *, bool, bool));
-extern void puterrmsg __P((char *));
-static void fmtmsg __P((char *, const char *, const char *, int, const char *, va_list));
-
-#if NAMED_BIND && !defined(NO_DATA)
-# define NO_DATA NO_ADDRESS
-#endif
-
-void
-/*VARARGS1*/
-#ifdef __STDC__
-syserr(const char *fmt, ...)
-#else
-syserr(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
-{
- register char *p;
- int olderrno = errno;
- bool panic;
- char *uname;
- struct passwd *pw;
- char ubuf[80];
- VA_LOCAL_DECL
-
- panic = *fmt == '!';
- if (panic)
- {
- fmt++;
- HoldErrs = FALSE;
- }
-
- /* format and output the error message */
- if (olderrno == 0)
- p = "554";
- else
- p = "451";
- VA_START(fmt);
- fmtmsg(MsgBuf, (char *) NULL, p, olderrno, fmt, ap);
- VA_END;
- puterrmsg(MsgBuf);
-
- /* save this message for mailq printing */
- if (!panic && CurEnv != NULL)
- {
- if (CurEnv->e_message != NULL)
- free(CurEnv->e_message);
- CurEnv->e_message = newstr(MsgBuf + 4);
- }
-
- /* determine exit status if not already set */
- if (ExitStat == EX_OK)
- {
- if (olderrno == 0)
- ExitStat = EX_SOFTWARE;
- else
- ExitStat = EX_OSERR;
- if (tTd(54, 1))
- printf("syserr: ExitStat = %d\n", ExitStat);
- }
-
- pw = sm_getpwuid(getuid());
- if (pw != NULL)
- uname = pw->pw_name;
- else
- {
- uname = ubuf;
- snprintf(ubuf, sizeof ubuf, "UID%d", getuid());
- }
-
- if (LogLevel > 0)
- sm_syslog(panic ? LOG_ALERT : LOG_CRIT,
- CurEnv == NULL ? NOQID : CurEnv->e_id,
- "SYSERR(%s): %.900s",
- uname, &MsgBuf[4]);
- switch (olderrno)
- {
- case EBADF:
- case ENFILE:
- case EMFILE:
- case ENOTTY:
-#ifdef EFBIG
- case EFBIG:
-#endif
-#ifdef ESPIPE
- case ESPIPE:
-#endif
-#ifdef EPIPE
- case EPIPE:
-#endif
-#ifdef ENOBUFS
- case ENOBUFS:
-#endif
-#ifdef ESTALE
- case ESTALE:
-#endif
- printopenfds(TRUE);
- mci_dump_all(TRUE);
- break;
- }
- if (panic)
- {
-#ifdef XLA
- xla_all_end();
-#endif
- if (tTd(0, 1))
- abort();
- exit(EX_OSERR);
- }
- errno = 0;
- if (QuickAbort)
- longjmp(TopFrame, 2);
-}
-\f/*
-** USRERR -- Signal user error.
-**
-** This is much like syserr except it is for user errors.
-**
-** Parameters:
-** fmt -- the format string. If it does not begin with
-** a three-digit SMTP reply code, 501 is assumed.
-** (others) -- printf strings
-**
-** Returns:
-** none
-** Through TopFrame if QuickAbort is set.
-**
-** Side Effects:
-** increments Errors.
-*/
-
-/*VARARGS1*/
-void
-#ifdef __STDC__
-usrerr(const char *fmt, ...)
-#else
-usrerr(fmt, va_alist)
- const char *fmt;
- va_dcl
-#endif
-{
- VA_LOCAL_DECL
-
- if (SuprErrs)
- return;
-
- VA_START(fmt);
- fmtmsg(MsgBuf, CurEnv->e_to, "501", 0, fmt, ap);
- VA_END;
-
- /* save this message for mailq printing */
- switch (MsgBuf[0])
- {
- case '4':
- case '8':
- if (CurEnv->e_message != NULL)
- break;
-
- /* fall through.... */
-
- case '5':
- case '6':
- if (CurEnv->e_message != NULL)
- free(CurEnv->e_message);
- if (MsgBuf[0] == '6')
- {
- char buf[MAXLINE];
-
- snprintf(buf, sizeof buf, "Postmaster warning: %.*s",
- sizeof buf - 22, MsgBuf + 4);
- CurEnv->e_message = newstr(buf);
- }
- else
- {
- CurEnv->e_message = newstr(MsgBuf + 4);
- }
- break;
- }
-
- puterrmsg(MsgBuf);
-
- if (LogLevel > 3 && LogUsrErrs)
- sm_syslog(LOG_NOTICE, CurEnv->e_id,
- "%.900s",
- &MsgBuf[4]);
-
- if (QuickAbort)
- longjmp(TopFrame, 1);
-}
-\f/*
-** MESSAGE -- print message (not necessarily an error)
-**
-** Parameters:
-** msg -- the message (printf fmt) -- it can begin with
-** an SMTP reply code. If not, 050 is assumed.
-** (others) -- printf arguments
-**
-** Returns:
-** none
-**
-** Side Effects:
-** none.
-*/
-
-/*VARARGS1*/
-void
-#ifdef __STDC__
-message(const char *msg, ...)
-#else
-message(msg, va_alist)
- const char *msg;
- va_dcl
-#endif
-{
- VA_LOCAL_DECL
-
- errno = 0;
- VA_START(msg);
- fmtmsg(MsgBuf, CurEnv->e_to, "050", 0, msg, ap);
- VA_END;
- putoutmsg(MsgBuf, FALSE, FALSE);
-
- /* save this message for mailq printing */
- switch (MsgBuf[0])
- {
- case '4':
- case '8':
- if (CurEnv->e_message != NULL)
- break;
- /* fall through.... */
-
- case '5':
- if (CurEnv->e_message != NULL)
- free(CurEnv->e_message);
- CurEnv->e_message = newstr(MsgBuf + 4);
- break;
- }
-}
-\f/*
-** NMESSAGE -- print message (not necessarily an error)
-**
-** Just like "message" except it never puts the to... tag on.
-**
-** Parameters:
-** msg -- the message (printf fmt) -- if it begins
-** with a three digit SMTP reply code, that is used,
-** otherwise 050 is assumed.
-** (others) -- printf arguments
-**
-** Returns:
-** none
-**
-** Side Effects:
-** none.
-*/
-
-/*VARARGS1*/
-void
-#ifdef __STDC__
-nmessage(const char *msg, ...)
-#else
-nmessage(msg, va_alist)
- const char *msg;
- va_dcl
-#endif
-{
- VA_LOCAL_DECL
-
- errno = 0;
- VA_START(msg);
- fmtmsg(MsgBuf, (char *) NULL, "050", 0, msg, ap);
- VA_END;
- putoutmsg(MsgBuf, FALSE, FALSE);
-
- /* save this message for mailq printing */
- switch (MsgBuf[0])
- {
- case '4':
- case '8':
- if (CurEnv->e_message != NULL)
- break;
- /* fall through.... */
-
- case '5':
- if (CurEnv->e_message != NULL)
- free(CurEnv->e_message);
- CurEnv->e_message = newstr(MsgBuf + 4);
- break;
- }
-}
-\f/*
-** PUTOUTMSG -- output error message to transcript and channel
-**
-** Parameters:
-** msg -- message to output (in SMTP format).
-** holdmsg -- if TRUE, don't output a copy of the message to
-** our output channel.
-** heldmsg -- if TRUE, this is a previously held message;
-** don't log it to the transcript file.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Outputs msg to the transcript.
-** If appropriate, outputs it to the channel.
-** Deletes SMTP reply code number as appropriate.
-*/
-
-void
-putoutmsg(msg, holdmsg, heldmsg)
- char *msg;
- bool holdmsg;
- bool heldmsg;
-{
- char msgcode = msg[0];
-
- /* display for debugging */
- if (tTd(54, 8))
- printf("--- %s%s%s\n", msg, holdmsg ? " (hold)" : "",
- heldmsg ? " (held)" : "");
-
- /* map warnings to something SMTP can handle */
- if (msgcode == '6')
- msg[0] = '5';
- else if (msgcode == '8')
- msg[0] = '4';
-
- /* output to transcript if serious */
- if (!heldmsg && CurEnv != NULL && CurEnv->e_xfp != NULL &&
- strchr("45", msg[0]) != NULL)
- fprintf(CurEnv->e_xfp, "%s\n", msg);
-
- if (LogLevel >= 15 && (OpMode == MD_SMTP || OpMode == MD_DAEMON))
- sm_syslog(LOG_INFO, CurEnv->e_id,
- "--> %s%s",
- msg, holdmsg ? " (held)" : "");
-
- if (msgcode == '8')
- msg[0] = '0';
-
- /* output to channel if appropriate */
- if (!Verbose && msg[0] == '0')
- return;
- if (holdmsg)
- {
- /* save for possible future display */
- msg[0] = msgcode;
- snprintf(HeldMessageBuf, sizeof HeldMessageBuf, "%s", msg);
- return;
- }
-
- (void) fflush(stdout);
-
- if (OutChannel == NULL)
- return;
-
- /* if DisConnected, OutChannel now points to the transcript */
- if (!DisConnected &&
- (OpMode == MD_SMTP || OpMode == MD_DAEMON || OpMode == MD_ARPAFTP))
- fprintf(OutChannel, "%s\r\n", msg);
- else
- fprintf(OutChannel, "%s\n", &msg[4]);
- if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d >>> %s\n", (int) getpid(),
- (OpMode == MD_SMTP || OpMode == MD_DAEMON) ? msg : &msg[4]);
- if (msg[3] == ' ')
- (void) fflush(OutChannel);
- if (!ferror(OutChannel) || DisConnected)
- return;
-
- /*
- ** Error on output -- if reporting lost channel, just ignore it.
- ** Also, ignore errors from QUIT response (221 message) -- some
- ** rude servers don't read result.
- */
-
- if (InChannel == NULL || feof(InChannel) || ferror(InChannel) ||
- strncmp(msg, "221", 3) == 0)
- return;
-
- /* can't call syserr, 'cause we are using MsgBuf */
- HoldErrs = TRUE;
- if (LogLevel > 0)
- sm_syslog(LOG_CRIT, CurEnv->e_id,
- "SYSERR: putoutmsg (%s): error on output channel sending \"%s\": %s",
- CurHostName == NULL ? "NO-HOST" : CurHostName,
- shortenstring(msg, MAXSHORTSTR), errstring(errno));
-}
-\f/*
-** PUTERRMSG -- like putoutmsg, but does special processing for error messages
-**
-** Parameters:
-** msg -- the message to output.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Sets the fatal error bit in the envelope as appropriate.
-*/
-
-void
-puterrmsg(msg)
- char *msg;
-{
- char msgcode = msg[0];
-
- /* output the message as usual */
- putoutmsg(msg, HoldErrs, FALSE);
-
- /* be careful about multiple error messages */
- if (OnlyOneError)
- HoldErrs = TRUE;
-
- /* signal the error */
- Errors++;
-
- if (CurEnv == NULL)
- return;
-
- if (msgcode == '6')
- {
- /* notify the postmaster */
- CurEnv->e_flags |= EF_PM_NOTIFY;
- }
- else if (msgcode == '5' && bitset(EF_GLOBALERRS, CurEnv->e_flags))
- {
- /* mark long-term fatal errors */
- CurEnv->e_flags |= EF_FATALERRS;
- }
-}
-\f/*
-** FMTMSG -- format a message into buffer.
-**
-** Parameters:
-** eb -- error buffer to get result.
-** to -- the recipient tag for this message.
-** num -- arpanet error number.
-** en -- the error number to display.
-** fmt -- format of string.
-** a, b, c, d, e -- arguments.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** none.
-*/
-
-static void
-fmtmsg(eb, to, num, eno, fmt, ap)
- register char *eb;
- const char *to;
- const char *num;
- int eno;
- const char *fmt;
- va_list ap;
-{
- char del;
- int l;
- int spaceleft = sizeof MsgBuf;
-
- /* output the reply code */
- if (isascii(fmt[0]) && isdigit(fmt[0]) &&
- isascii(fmt[1]) && isdigit(fmt[1]) &&
- isascii(fmt[2]) && isdigit(fmt[2]))
- {
- num = fmt;
- fmt += 4;
- }
- if (num[3] == '-')
- del = '-';
- else
- del = ' ';
- (void) snprintf(eb, spaceleft, "%3.3s%c", num, del);
- eb += 4;
- spaceleft -= 4;
-
- /* output the file name and line number */
- if (FileName != NULL)
- {
- (void) snprintf(eb, spaceleft, "%s: line %d: ",
- shortenstring(FileName, 83), LineNumber);
- eb += (l = strlen(eb));
- spaceleft -= l;
- }
-
- /* output the "to" person */
- if (to != NULL && to[0] != '\0' &&
- strncmp(num, "551", 3) != 0 &&
- strncmp(num, "251", 3) != 0)
- {
- (void) snprintf(eb, spaceleft, "%s... ",
- shortenstring(to, MAXSHORTSTR));
- spaceleft -= strlen(eb);
- while (*eb != '\0')
- *eb++ &= 0177;
- }
-
- /* output the message */
- (void) vsnprintf(eb, spaceleft, fmt, ap);
- spaceleft -= strlen(eb);
- while (*eb != '\0')
- *eb++ &= 0177;
-
- /* output the error code, if any */
- if (eno != 0)
- (void) snprintf(eb, spaceleft, ": %s", errstring(eno));
-}
-\f/*
-** BUFFER_ERRORS -- arrange to buffer future error messages
-**
-** Parameters:
-** none
-**
-** Returns:
-** none.
-*/
-
-void
-buffer_errors()
-{
- HeldMessageBuf[0] = '\0';
- HoldErrs = TRUE;
-}
-\f/*
-** FLUSH_ERRORS -- flush the held error message buffer
-**
-** Parameters:
-** print -- if set, print the message, otherwise just
-** delete it.
-**
-** Returns:
-** none.
-*/
-
-void
-flush_errors(print)
- bool print;
-{
- if (print && HeldMessageBuf[0] != '\0')
- putoutmsg(HeldMessageBuf, FALSE, TRUE);
- HeldMessageBuf[0] = '\0';
- HoldErrs = FALSE;
-}
-\f/*
-** ERRSTRING -- return string description of error code
-**
-** Parameters:
-** errnum -- the error number to translate
-**
-** Returns:
-** A string description of errnum.
-**
-** Side Effects:
-** none.
-*/
-
-const char *
-errstring(errnum)
- int errnum;
-{
- char *dnsmsg;
- char *bp;
- static char buf[MAXLINE];
-# if !HASSTRERROR && !defined(ERRLIST_PREDEFINED)
- extern char *sys_errlist[];
- extern int sys_nerr;
-# endif
-# if SMTP
- extern char *SmtpPhase;
-# endif /* SMTP */
-
- /*
- ** Handle special network error codes.
- **
- ** These are 4.2/4.3bsd specific; they should be in daemon.c.
- */
-
- dnsmsg = NULL;
- switch (errnum)
- {
-# if defined(DAEMON) && defined(ETIMEDOUT)
- case ETIMEDOUT:
- case ECONNRESET:
- bp = buf;
-#if HASSTRERROR
- snprintf(bp, SPACELEFT(buf, bp), "%s", strerror(errnum));
-#else
- if (errnum >= 0 && errnum < sys_nerr)
- snprintf(bp, SPACELEFT(buf, bp), "%s", sys_errlist[errnum]);
- else
- snprintf(bp, SPACELEFT(buf, bp), "Error %d", errnum);
-#endif
- bp += strlen(bp);
- if (CurHostName != NULL)
- {
- if (errnum == ETIMEDOUT)
- {
- snprintf(bp, SPACELEFT(buf, bp), " with ");
- bp += strlen(bp);
- }
- else
- {
- bp = buf;
- snprintf(bp, SPACELEFT(buf, bp),
- "Connection reset by ");
- bp += strlen(bp);
- }
- snprintf(bp, SPACELEFT(buf, bp), "%s",
- shortenstring(CurHostName, MAXSHORTSTR));
- bp += strlen(buf);
- }
- if (SmtpPhase != NULL)
- {
- snprintf(bp, SPACELEFT(buf, bp), " during %s",
- SmtpPhase);
- }
- return (buf);
-
- case EHOSTDOWN:
- if (CurHostName == NULL)
- break;
- (void) snprintf(buf, sizeof buf, "Host %s is down",
- shortenstring(CurHostName, MAXSHORTSTR));
- return (buf);
-
- case ECONNREFUSED:
- if (CurHostName == NULL)
- break;
- (void) snprintf(buf, sizeof buf, "Connection refused by %s",
- shortenstring(CurHostName, MAXSHORTSTR));
- return (buf);
-# endif
-
-# if NAMED_BIND
- case HOST_NOT_FOUND + E_DNSBASE:
- dnsmsg = "host not found";
- break;
-
- case TRY_AGAIN + E_DNSBASE:
- dnsmsg = "host name lookup failure";
- break;
-
- case NO_RECOVERY + E_DNSBASE:
- dnsmsg = "non-recoverable error";
- break;
-
- case NO_DATA + E_DNSBASE:
- dnsmsg = "no data known";
- break;
-# endif
-
- case EPERM:
- /* SunOS gives "Not owner" -- this is the POSIX message */
- return "Operation not permitted";
-
- /*
- ** Error messages used internally in sendmail.
- */
-
- case E_SM_OPENTIMEOUT:
- return "Timeout on file open";
-
- case E_SM_NOSLINK:
- return "Symbolic links not allowed";
-
- case E_SM_NOHLINK:
- return "Hard links not allowed";
-
- case E_SM_REGONLY:
- return "Regular files only";
-
- case E_SM_ISEXEC:
- return "Executable files not allowed";
-
- case E_SM_WWDIR:
- return "World writable directory";
-
- case E_SM_GWDIR:
- return "Group writable directory";
-
- case E_SM_FILECHANGE:
- return "File changed after open";
-
- case E_SM_WWFILE:
- return "World writable file";
-
- case E_SM_GWFILE:
- return "Group writable file";
- }
-
- if (dnsmsg != NULL)
- {
- bp = buf;
- strcpy(bp, "Name server: ");
- bp += strlen(bp);
- if (CurHostName != NULL)
- {
- snprintf(bp, SPACELEFT(buf, bp), "%s: ",
- shortenstring(CurHostName, MAXSHORTSTR));
- bp += strlen(bp);
- }
- snprintf(bp, SPACELEFT(buf, bp), "%s", dnsmsg);
- return buf;
- }
-
-#if HASSTRERROR
- return strerror(errnum);
-#else
- if (errnum > 0 && errnum < sys_nerr)
- return (sys_errlist[errnum]);
-
- (void) snprintf(buf, sizeof buf, "Error %d", errnum);
- return (buf);
-#endif
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)headers.c 8.136 (Berkeley) 1/26/1999";
-#endif /* not lint */
-
-# include <errno.h>
-# include "sendmail.h"
-
-/*
-** SETUPHEADERS -- initialize headers in symbol table
-**
-** Parameters:
-** none
-**
-** Returns:
-** none
-*/
-
-void
-setupheaders()
-{
- struct hdrinfo *hi;
- STAB *s;
-
- for (hi = HdrInfo; hi->hi_field != NULL; hi++)
- {
- s = stab(hi->hi_field, ST_HEADER, ST_ENTER);
- s->s_header.hi_flags = hi->hi_flags;
- s->s_header.hi_ruleset = NULL;
- }
-}
-\f/*
-** CHOMPHEADER -- process and save a header line.
-**
-** Called by collect and by readcf to deal with header lines.
-**
-** Parameters:
-** line -- header as a text line.
-** def -- if set, this is a default value.
-** hdrp -- a pointer to the place to save the header.
-** e -- the envelope including this header.
-**
-** Returns:
-** flags for this header.
-**
-** Side Effects:
-** The header is saved on the header list.
-** Contents of 'line' are destroyed.
-*/
-
-struct hdrinfo NormalHeader = { NULL, 0, NULL };
-
-int
-chompheader(line, def, hdrp, e)
- char *line;
- bool def;
- HDR **hdrp;
- register ENVELOPE *e;
-{
- register char *p;
- register HDR *h;
- HDR **hp;
- char *fname;
- char *fvalue;
- bool cond = FALSE;
- bool headeronly;
- STAB *s;
- struct hdrinfo *hi;
- bool nullheader = FALSE;
- BITMAP mopts;
-
- if (tTd(31, 6))
- {
- printf("chompheader: ");
- xputs(line);
- printf("\n");
- }
-
- headeronly = hdrp != NULL;
- if (!headeronly)
- hdrp = &e->e_header;
-
- /* strip off options */
- clrbitmap(mopts);
- p = line;
- if (*p == '?')
- {
- /* have some */
- register char *q = strchr(p + 1, *p);
-
- if (q != NULL)
- {
- *q++ = '\0';
- while (*++p != '\0')
- setbitn(*p, mopts);
- p = q;
- }
- else
- syserr("553 header syntax error, line \"%s\"", line);
- cond = TRUE;
- }
-
- /* find canonical name */
- fname = p;
- while (isascii(*p) && isgraph(*p) && *p != ':')
- p++;
- fvalue = p;
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p++ != ':' || fname == fvalue)
- {
- syserr("553 header syntax error, line \"%s\"", line);
- return 0;
- }
- *fvalue = '\0';
-
- /* strip field value on front */
- if (*p == ' ')
- p++;
- fvalue = p;
-
- /* if the field is null, go ahead and use the default */
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p == '\0')
- nullheader = TRUE;
-
- /* security scan: long field names are end-of-header */
- if (strlen(fname) > 100)
- return H_EOH;
-
- /* check to see if it represents a ruleset call */
- if (def)
- {
- char hbuf[50];
-
- (void) expand(fvalue, hbuf, sizeof hbuf, e);
- for (p = hbuf; isascii(*p) && isspace(*p); )
- p++;
- if ((*p++ & 0377) == CALLSUBR)
- {
- auto char *endp;
-
- if (strtorwset(p, &endp, ST_ENTER) > 0)
- {
- *endp = '\0';
- s = stab(fname, ST_HEADER, ST_ENTER);
- s->s_header.hi_ruleset = newstr(p);
- }
- return 0;
- }
- }
-
- /* see if it is a known type */
- s = stab(fname, ST_HEADER, ST_FIND);
- if (s != NULL)
- hi = &s->s_header;
- else
- hi = &NormalHeader;
-
- if (tTd(31, 9))
- {
- if (s == NULL)
- printf("no header flags match\n");
- else
- printf("header match, flags=%x, ruleset=%s\n",
- hi->hi_flags,
- hi->hi_ruleset == NULL ? "<NULL>" : hi->hi_ruleset);
- }
-
- /* see if this is a resent message */
- if (!def && !headeronly && bitset(H_RESENT, hi->hi_flags))
- e->e_flags |= EF_RESENT;
-
- /* if this is an Errors-To: header keep track of it now */
- if (UseErrorsTo && !def && !headeronly &&
- bitset(H_ERRORSTO, hi->hi_flags))
- (void) sendtolist(fvalue, NULLADDR, &e->e_errorqueue, 0, e);
-
- /* if this means "end of header" quit now */
- if (!headeronly && bitset(H_EOH, hi->hi_flags))
- return hi->hi_flags;
-
- /*
- ** Horrible hack to work around problem with Lotus Notes SMTP
- ** mail gateway, which generates From: headers with newlines in
- ** them and the <address> on the second line. Although this is
- ** legal RFC 822, many MUAs don't handle this properly and thus
- ** never find the actual address.
- */
-
- if (bitset(H_FROM, hi->hi_flags) && SingleLineFromHeader)
- {
- while ((p = strchr(fvalue, '\n')) != NULL)
- *p = ' ';
- }
-
- /*
- ** If there is a check ruleset, verify it against the header.
- */
-
- if (!def && hi->hi_ruleset != NULL)
- (void) rscheck(hi->hi_ruleset, fvalue, NULL, e);
-
- /*
- ** Drop explicit From: if same as what we would generate.
- ** This is to make MH (which doesn't always give a full name)
- ** insert the full name information in all circumstances.
- */
-
- p = "resent-from";
- if (!bitset(EF_RESENT, e->e_flags))
- p += 7;
- if (!def && !headeronly && !bitset(EF_QUEUERUN, e->e_flags) &&
- strcasecmp(fname, p) == 0)
- {
- if (tTd(31, 2))
- {
- printf("comparing header from (%s) against default (%s or %s)\n",
- fvalue, e->e_from.q_paddr, e->e_from.q_user);
- }
- if (e->e_from.q_paddr != NULL &&
- (strcmp(fvalue, e->e_from.q_paddr) == 0 ||
- strcmp(fvalue, e->e_from.q_user) == 0))
- return hi->hi_flags;
- }
-
- /* delete default value for this header */
- for (hp = hdrp; (h = *hp) != NULL; hp = &h->h_link)
- {
- if (strcasecmp(fname, h->h_field) == 0 &&
- bitset(H_DEFAULT, h->h_flags) &&
- !bitset(H_FORCE, h->h_flags))
- {
- if (nullheader)
- {
- /* user-supplied value was null */
- return 0;
- }
- h->h_value = NULL;
- if (!cond)
- {
- /* copy conditions from default case */
- bcopy((char *)h->h_mflags, (char *)mopts,
- sizeof mopts);
- }
- }
- }
-
- /* create a new node */
- h = (HDR *) xalloc(sizeof *h);
- h->h_field = newstr(fname);
- h->h_value = newstr(fvalue);
- h->h_link = NULL;
- bcopy((char *) mopts, (char *) h->h_mflags, sizeof mopts);
- *hp = h;
- h->h_flags = hi->hi_flags;
-
- /* strip EOH flag if parsing MIME headers */
- if (headeronly)
- h->h_flags &= ~H_EOH;
- if (def)
- h->h_flags |= H_DEFAULT;
- if (cond)
- h->h_flags |= H_CHECK;
-
- /* hack to see if this is a new format message */
- if (!def && !headeronly && bitset(H_RCPT|H_FROM, h->h_flags) &&
- (strchr(fvalue, ',') != NULL || strchr(fvalue, '(') != NULL ||
- strchr(fvalue, '<') != NULL || strchr(fvalue, ';') != NULL))
- {
- e->e_flags &= ~EF_OLDSTYLE;
- }
-
- return h->h_flags;
-}
-\f/*
-** ADDHEADER -- add a header entry to the end of the queue.
-**
-** This bypasses the special checking of chompheader.
-**
-** Parameters:
-** field -- the name of the header field.
-** value -- the value of the field.
-** hp -- an indirect pointer to the header structure list.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** adds the field on the list of headers for this envelope.
-*/
-
-void
-addheader(field, value, hdrlist)
- char *field;
- char *value;
- HDR **hdrlist;
-{
- register HDR *h;
- STAB *s;
- HDR **hp;
-
- /* find info struct */
- s = stab(field, ST_HEADER, ST_FIND);
-
- /* find current place in list -- keep back pointer? */
- for (hp = hdrlist; (h = *hp) != NULL; hp = &h->h_link)
- {
- if (strcasecmp(field, h->h_field) == 0)
- break;
- }
-
- /* allocate space for new header */
- h = (HDR *) xalloc(sizeof *h);
- h->h_field = field;
- h->h_value = newstr(value);
- h->h_link = *hp;
- h->h_flags = H_DEFAULT;
- if (s != NULL)
- h->h_flags |= s->s_header.hi_flags;
- clrbitmap(h->h_mflags);
- *hp = h;
-}
-\f/*
-** HVALUE -- return value of a header.
-**
-** Only "real" fields (i.e., ones that have not been supplied
-** as a default) are used.
-**
-** Parameters:
-** field -- the field name.
-** header -- the header list.
-**
-** Returns:
-** pointer to the value part.
-** NULL if not found.
-**
-** Side Effects:
-** none.
-*/
-
-char *
-hvalue(field, header)
- char *field;
- HDR *header;
-{
- register HDR *h;
-
- for (h = header; h != NULL; h = h->h_link)
- {
- if (!bitset(H_DEFAULT, h->h_flags) &&
- strcasecmp(h->h_field, field) == 0)
- return (h->h_value);
- }
- return (NULL);
-}
-\f/*
-** ISHEADER -- predicate telling if argument is a header.
-**
-** A line is a header if it has a single word followed by
-** optional white space followed by a colon.
-**
-** Header fields beginning with two dashes, although technically
-** permitted by RFC822, are automatically rejected in order
-** to make MIME work out. Without this we could have a technically
-** legal header such as ``--"foo:bar"'' that would also be a legal
-** MIME separator.
-**
-** Parameters:
-** h -- string to check for possible headerness.
-**
-** Returns:
-** TRUE if h is a header.
-** FALSE otherwise.
-**
-** Side Effects:
-** none.
-*/
-
-bool
-isheader(h)
- char *h;
-{
- register char *s = h;
-
- if (s[0] == '-' && s[1] == '-')
- return FALSE;
-
- while (*s > ' ' && *s != ':' && *s != '\0')
- s++;
-
- if (h == s)
- return FALSE;
-
- /* following technically violates RFC822 */
- while (isascii(*s) && isspace(*s))
- s++;
-
- return (*s == ':');
-}
-\f/*
-** EATHEADER -- run through the stored header and extract info.
-**
-** Parameters:
-** e -- the envelope to process.
-** full -- if set, do full processing (e.g., compute
-** message priority). This should not be set
-** when reading a queue file because some info
-** needed to compute the priority is wrong.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Sets a bunch of global variables from information
-** in the collected header.
-** Aborts the message if the hop count is exceeded.
-*/
-
-void
-eatheader(e, full)
- register ENVELOPE *e;
- bool full;
-{
- register HDR *h;
- register char *p;
- int hopcnt = 0;
- char *msgid;
- char buf[MAXLINE];
- extern int priencode __P((char *));
-
- /*
- ** Set up macros for possible expansion in headers.
- */
-
- define('f', e->e_sender, e);
- define('g', e->e_sender, e);
- if (e->e_origrcpt != NULL && *e->e_origrcpt != '\0')
- define('u', e->e_origrcpt, e);
- else
- define('u', NULL, e);
-
- /* full name of from person */
- p = hvalue("full-name", e->e_header);
- if (p != NULL)
- {
- extern bool rfc822_string __P((char *));
-
- if (!rfc822_string(p))
- {
- extern char *addquotes __P((char *));
-
- /*
- ** Quote a full name with special characters
- ** as a comment so crackaddr() doesn't destroy
- ** the name portion of the address.
- */
- p = addquotes(p);
- }
- define('x', p, e);
- }
-
- if (tTd(32, 1))
- printf("----- collected header -----\n");
- msgid = NULL;
- for (h = e->e_header; h != NULL; h = h->h_link)
- {
- if (tTd(32, 1))
- printf("%s: ", h->h_field);
- if (h->h_value == NULL)
- {
- if (tTd(32, 1))
- printf("<NULL>\n");
- continue;
- }
-
- /* do early binding */
- if (bitset(H_DEFAULT, h->h_flags))
- {
- if (tTd(32, 1))
- {
- printf("(");
- xputs(h->h_value);
- printf(") ");
- }
- expand(h->h_value, buf, sizeof buf, e);
- if (buf[0] != '\0')
- {
- if (bitset(H_FROM, h->h_flags))
- {
- extern char *crackaddr __P((char *));
-
- expand(crackaddr(buf), buf, sizeof buf, e);
- }
- h->h_value = newstr(buf);
- h->h_flags &= ~H_DEFAULT;
- }
- }
-
- if (tTd(32, 1))
- {
- xputs(h->h_value);
- printf("\n");
- }
-
- /* count the number of times it has been processed */
- if (bitset(H_TRACE, h->h_flags))
- hopcnt++;
-
- /* send to this person if we so desire */
- if (GrabTo && bitset(H_RCPT, h->h_flags) &&
- !bitset(H_DEFAULT, h->h_flags) &&
- (!bitset(EF_RESENT, e->e_flags) || bitset(H_RESENT, h->h_flags)))
- {
-#if 0
- int saveflags = e->e_flags;
-#endif
-
- (void) sendtolist(h->h_value, NULLADDR,
- &e->e_sendqueue, 0, e);
-
-#if 0
- /*
- ** Change functionality so a fatal error on an
- ** address doesn't affect the entire envelope.
- */
-
- /* delete fatal errors generated by this address */
- if (!bitset(EF_FATALERRS, saveflags))
- e->e_flags &= ~EF_FATALERRS;
-#endif
- }
-
- /* save the message-id for logging */
- p = "resent-message-id";
- if (!bitset(EF_RESENT, e->e_flags))
- p += 7;
- if (strcasecmp(h->h_field, p) == 0)
- {
- msgid = h->h_value;
- while (isascii(*msgid) && isspace(*msgid))
- msgid++;
- }
- }
- if (tTd(32, 1))
- printf("----------------------------\n");
-
- /* if we are just verifying (that is, sendmail -t -bv), drop out now */
- if (OpMode == MD_VERIFY)
- return;
-
- /* store hop count */
- if (hopcnt > e->e_hopcount)
- e->e_hopcount = hopcnt;
-
- /* message priority */
- p = hvalue("precedence", e->e_header);
- if (p != NULL)
- e->e_class = priencode(p);
- if (e->e_class < 0)
- e->e_timeoutclass = TOC_NONURGENT;
- else if (e->e_class > 0)
- e->e_timeoutclass = TOC_URGENT;
- if (full)
- {
- e->e_msgpriority = e->e_msgsize
- - e->e_class * WkClassFact
- + e->e_nrcpts * WkRecipFact;
- }
-
- /* message timeout priority */
- p = hvalue("priority", e->e_header);
- if (p != NULL)
- {
- /* (this should be in the configuration file) */
- if (strcasecmp(p, "urgent") == 0)
- e->e_timeoutclass = TOC_URGENT;
- else if (strcasecmp(p, "normal") == 0)
- e->e_timeoutclass = TOC_NORMAL;
- else if (strcasecmp(p, "non-urgent") == 0)
- e->e_timeoutclass = TOC_NONURGENT;
- }
-
- /* date message originated */
- p = hvalue("posted-date", e->e_header);
- if (p == NULL)
- p = hvalue("date", e->e_header);
- if (p != NULL)
- define('a', p, e);
-
- /* check to see if this is a MIME message */
- if ((e->e_bodytype != NULL &&
- strcasecmp(e->e_bodytype, "8BITMIME") == 0) ||
- hvalue("MIME-Version", e->e_header) != NULL)
- {
- e->e_flags |= EF_IS_MIME;
- if (HasEightBits)
- e->e_bodytype = "8BITMIME";
- }
- else if ((p = hvalue("Content-Type", e->e_header)) != NULL)
- {
- /* this may be an RFC 1049 message */
- p = strpbrk(p, ";/");
- if (p == NULL || *p == ';')
- {
- /* yep, it is */
- e->e_flags |= EF_DONT_MIME;
- }
- }
-
- /*
- ** From person in antiquated ARPANET mode
- ** required by UK Grey Book e-mail gateways (sigh)
- */
-
- if (OpMode == MD_ARPAFTP)
- {
- register struct hdrinfo *hi;
-
- for (hi = HdrInfo; hi->hi_field != NULL; hi++)
- {
- if (bitset(H_FROM, hi->hi_flags) &&
- (!bitset(H_RESENT, hi->hi_flags) ||
- bitset(EF_RESENT, e->e_flags)) &&
- (p = hvalue(hi->hi_field, e->e_header)) != NULL)
- break;
- }
- if (hi->hi_field != NULL)
- {
- if (tTd(32, 2))
- printf("eatheader: setsender(*%s == %s)\n",
- hi->hi_field, p);
- setsender(p, e, NULL, '\0', TRUE);
- }
- }
-
- /*
- ** Log collection information.
- */
-
- if (bitset(EF_LOGSENDER, e->e_flags) && LogLevel > 4)
- logsender(e, msgid);
- e->e_flags &= ~EF_LOGSENDER;
-}
-\f/*
-** LOGSENDER -- log sender information
-**
-** Parameters:
-** e -- the envelope to log
-** msgid -- the message id
-**
-** Returns:
-** none
-*/
-
-void
-logsender(e, msgid)
- register ENVELOPE *e;
- char *msgid;
-{
- char *name;
- register char *sbp;
- register char *p;
- int l;
- char hbuf[MAXNAME + 1];
- char sbuf[MAXLINE + 1];
- char mbuf[MAXNAME + 1];
-
- /* don't allow newlines in the message-id */
- if (msgid != NULL)
- {
- l = strlen(msgid);
- if (l > sizeof mbuf - 1)
- l = sizeof mbuf - 1;
- bcopy(msgid, mbuf, l);
- mbuf[l] = '\0';
- p = mbuf;
- while ((p = strchr(p, '\n')) != NULL)
- *p++ = ' ';
- }
-
- if (bitset(EF_RESPONSE, e->e_flags))
- name = "[RESPONSE]";
- else if ((name = macvalue('_', e)) != NULL)
- ;
- else if (RealHostName == NULL)
- name = "localhost";
- else if (RealHostName[0] == '[')
- name = RealHostName;
- else
- {
- name = hbuf;
- (void) snprintf(hbuf, sizeof hbuf, "%.80s", RealHostName);
- if (RealHostAddr.sa.sa_family != 0)
- {
- p = &hbuf[strlen(hbuf)];
- (void) snprintf(p, SPACELEFT(hbuf, p), " (%.100s)",
- anynet_ntoa(&RealHostAddr));
- }
- }
-
- /* some versions of syslog only take 5 printf args */
-# if (SYSLOG_BUFSIZE) >= 256
- sbp = sbuf;
- snprintf(sbp, SPACELEFT(sbuf, sbp),
- "from=%.200s, size=%ld, class=%d, pri=%ld, nrcpts=%d",
- e->e_from.q_paddr == NULL ? "<NONE>" : e->e_from.q_paddr,
- e->e_msgsize, e->e_class, e->e_msgpriority, e->e_nrcpts);
- sbp += strlen(sbp);
- if (msgid != NULL)
- {
- snprintf(sbp, SPACELEFT(sbuf, sbp), ", msgid=%.100s", mbuf);
- sbp += strlen(sbp);
- }
- if (e->e_bodytype != NULL)
- {
- (void) snprintf(sbp, SPACELEFT(sbuf, sbp), ", bodytype=%.20s",
- e->e_bodytype);
- sbp += strlen(sbp);
- }
- p = macvalue('r', e);
- if (p != NULL)
- (void) snprintf(sbp, SPACELEFT(sbuf, sbp), ", proto=%.20s", p);
- sm_syslog(LOG_INFO, e->e_id,
- "%.850s, relay=%.100s",
- sbuf, name);
-
-# else /* short syslog buffer */
-
- sm_syslog(LOG_INFO, e->e_id,
- "from=%s",
- e->e_from.q_paddr == NULL ? "<NONE>"
- : shortenstring(e->e_from.q_paddr, 83));
- sm_syslog(LOG_INFO, e->e_id,
- "size=%ld, class=%ld, pri=%ld, nrcpts=%d",
- e->e_msgsize, e->e_class, e->e_msgpriority, e->e_nrcpts);
- if (msgid != NULL)
- sm_syslog(LOG_INFO, e->e_id,
- "msgid=%s",
- shortenstring(mbuf, 83));
- sbp = sbuf;
- *sbp = '\0';
- if (e->e_bodytype != NULL)
- {
- snprintf(sbp, SPACELEFT(sbuf, sbp), "bodytype=%.20s, ", e->e_bodytype);
- sbp += strlen(sbp);
- }
- p = macvalue('r', e);
- if (p != NULL)
- {
- snprintf(sbp, SPACELEFT(sbuf, sbp), "proto=%.20s, ", p);
- sbp += strlen(sbp);
- }
- sm_syslog(LOG_INFO, e->e_id,
- "%.400srelay=%.100s", sbuf, name);
-# endif
-}
-\f/*
-** PRIENCODE -- encode external priority names into internal values.
-**
-** Parameters:
-** p -- priority in ascii.
-**
-** Returns:
-** priority as a numeric level.
-**
-** Side Effects:
-** none.
-*/
-
-int
-priencode(p)
- char *p;
-{
- register int i;
-
- for (i = 0; i < NumPriorities; i++)
- {
- if (!strcasecmp(p, Priorities[i].pri_name))
- return (Priorities[i].pri_val);
- }
-
- /* unknown priority */
- return (0);
-}
-\f/*
-** CRACKADDR -- parse an address and turn it into a macro
-**
-** This doesn't actually parse the address -- it just extracts
-** it and replaces it with "$g". The parse is totally ad hoc
-** and isn't even guaranteed to leave something syntactically
-** identical to what it started with. However, it does leave
-** something semantically identical.
-**
-** This algorithm has been cleaned up to handle a wider range
-** of cases -- notably quoted and backslash escaped strings.
-** This modification makes it substantially better at preserving
-** the original syntax.
-**
-** Parameters:
-** addr -- the address to be cracked.
-**
-** Returns:
-** a pointer to the new version.
-**
-** Side Effects:
-** none.
-**
-** Warning:
-** The return value is saved in local storage and should
-** be copied if it is to be reused.
-*/
-
-char *
-crackaddr(addr)
- register char *addr;
-{
- register char *p;
- register char c;
- int cmtlev;
- int realcmtlev;
- int anglelev, realanglelev;
- int copylev;
- int bracklev;
- bool qmode;
- bool realqmode;
- bool skipping;
- bool putgmac = FALSE;
- bool quoteit = FALSE;
- bool gotangle = FALSE;
- bool gotcolon = FALSE;
- register char *bp;
- char *buflim;
- char *bufhead;
- char *addrhead;
- static char buf[MAXNAME + 1];
-
- if (tTd(33, 1))
- printf("crackaddr(%s)\n", addr);
-
- /* strip leading spaces */
- while (*addr != '\0' && isascii(*addr) && isspace(*addr))
- addr++;
-
- /*
- ** Start by assuming we have no angle brackets. This will be
- ** adjusted later if we find them.
- */
-
- bp = bufhead = buf;
- buflim = &buf[sizeof buf - 7];
- p = addrhead = addr;
- copylev = anglelev = realanglelev = cmtlev = realcmtlev = 0;
- bracklev = 0;
- qmode = realqmode = FALSE;
-
- while ((c = *p++) != '\0')
- {
- /*
- ** If the buffer is overful, go into a special "skipping"
- ** mode that tries to keep legal syntax but doesn't actually
- ** output things.
- */
-
- skipping = bp >= buflim;
-
- if (copylev > 0 && !skipping)
- *bp++ = c;
-
- /* check for backslash escapes */
- if (c == '\\')
- {
- /* arrange to quote the address */
- if (cmtlev <= 0 && !qmode)
- quoteit = TRUE;
-
- if ((c = *p++) == '\0')
- {
- /* too far */
- p--;
- goto putg;
- }
- if (copylev > 0 && !skipping)
- *bp++ = c;
- goto putg;
- }
-
- /* check for quoted strings */
- if (c == '"' && cmtlev <= 0)
- {
- qmode = !qmode;
- if (copylev > 0 && !skipping)
- realqmode = !realqmode;
- continue;
- }
- if (qmode)
- goto putg;
-
- /* check for comments */
- if (c == '(')
- {
- cmtlev++;
-
- /* allow space for closing paren */
- if (!skipping)
- {
- buflim--;
- realcmtlev++;
- if (copylev++ <= 0)
- {
- if (bp != bufhead)
- *bp++ = ' ';
- *bp++ = c;
- }
- }
- }
- if (cmtlev > 0)
- {
- if (c == ')')
- {
- cmtlev--;
- copylev--;
- if (!skipping)
- {
- realcmtlev--;
- buflim++;
- }
- }
- continue;
- }
- else if (c == ')')
- {
- /* syntax error: unmatched ) */
- if (copylev > 0 && !skipping)
- bp--;
- }
-
- /* count nesting on [ ... ] (for IPv6 domain literals) */
- if (c == '[')
- bracklev++;
- else if (c == ']')
- bracklev--;
-
- /* check for group: list; syntax */
- if (c == ':' && anglelev <= 0 && bracklev <= 0 &&
- !gotcolon && !ColonOkInAddr)
- {
- register char *q;
-
- /*
- ** Check for DECnet phase IV ``::'' (host::user)
- ** or ** DECnet phase V ``:.'' syntaxes. The latter
- ** covers ``user@DEC:.tay.myhost'' and
- ** ``DEC:.tay.myhost::user'' syntaxes (bletch).
- */
-
- if (*p == ':' || *p == '.')
- {
- if (cmtlev <= 0 && !qmode)
- quoteit = TRUE;
- if (copylev > 0 && !skipping)
- {
- *bp++ = c;
- *bp++ = *p;
- }
- p++;
- goto putg;
- }
-
- gotcolon = TRUE;
-
- bp = bufhead;
- if (quoteit)
- {
- *bp++ = '"';
-
- /* back up over the ':' and any spaces */
- --p;
- while (isascii(*--p) && isspace(*p))
- continue;
- p++;
- }
- for (q = addrhead; q < p; )
- {
- c = *q++;
- if (bp < buflim)
- {
- if (quoteit && c == '"')
- *bp++ = '\\';
- *bp++ = c;
- }
- }
- if (quoteit)
- {
- if (bp == &bufhead[1])
- bp--;
- else
- *bp++ = '"';
- while ((c = *p++) != ':')
- {
- if (bp < buflim)
- *bp++ = c;
- }
- *bp++ = c;
- }
-
- /* any trailing white space is part of group: */
- while (isascii(*p) && isspace(*p) && bp < buflim)
- *bp++ = *p++;
- copylev = 0;
- putgmac = quoteit = FALSE;
- bufhead = bp;
- addrhead = p;
- continue;
- }
-
- if (c == ';' && copylev <= 0 && !ColonOkInAddr)
- {
- if (bp < buflim)
- *bp++ = c;
- }
-
- /* check for characters that may have to be quoted */
- if (strchr(MustQuoteChars, c) != NULL)
- {
- /*
- ** If these occur as the phrase part of a <>
- ** construct, but are not inside of () or already
- ** quoted, they will have to be quoted. Note that
- ** now (but don't actually do the quoting).
- */
-
- if (cmtlev <= 0 && !qmode)
- quoteit = TRUE;
- }
-
- /* check for angle brackets */
- if (c == '<')
- {
- register char *q;
-
- /* assume first of two angles is bogus */
- if (gotangle)
- quoteit = TRUE;
- gotangle = TRUE;
-
- /* oops -- have to change our mind */
- anglelev = 1;
- if (!skipping)
- realanglelev = 1;
-
- bp = bufhead;
- if (quoteit)
- {
- *bp++ = '"';
-
- /* back up over the '<' and any spaces */
- --p;
- while (isascii(*--p) && isspace(*p))
- continue;
- p++;
- }
- for (q = addrhead; q < p; )
- {
- c = *q++;
- if (bp < buflim)
- {
- if (quoteit && c == '"')
- *bp++ = '\\';
- *bp++ = c;
- }
- }
- if (quoteit)
- {
- if (bp == &buf[1])
- bp--;
- else
- *bp++ = '"';
- while ((c = *p++) != '<')
- {
- if (bp < buflim)
- *bp++ = c;
- }
- *bp++ = c;
- }
- copylev = 0;
- putgmac = quoteit = FALSE;
- continue;
- }
-
- if (c == '>')
- {
- if (anglelev > 0)
- {
- anglelev--;
- if (!skipping)
- {
- realanglelev--;
- buflim++;
- }
- }
- else if (!skipping)
- {
- /* syntax error: unmatched > */
- if (copylev > 0)
- bp--;
- quoteit = TRUE;
- continue;
- }
- if (copylev++ <= 0)
- *bp++ = c;
- continue;
- }
-
- /* must be a real address character */
- putg:
- if (copylev <= 0 && !putgmac)
- {
- if (bp > bufhead && bp[-1] == ')')
- *bp++ = ' ';
- *bp++ = MACROEXPAND;
- *bp++ = 'g';
- putgmac = TRUE;
- }
- }
-
- /* repair any syntactic damage */
- if (realqmode)
- *bp++ = '"';
- while (realcmtlev-- > 0)
- *bp++ = ')';
- while (realanglelev-- > 0)
- *bp++ = '>';
- *bp++ = '\0';
-
- if (tTd(33, 1))
- {
- printf("crackaddr=>`");
- xputs(buf);
- printf("'\n");
- }
-
- return (buf);
-}
-\f/*
-** PUTHEADER -- put the header part of a message from the in-core copy
-**
-** Parameters:
-** mci -- the connection information.
-** h -- the header to put.
-** e -- envelope to use.
-** flags -- MIME conversion flags.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** none.
-*/
-
-/*
- * Macro for fast max (not available in e.g. DG/UX, 386/ix).
- */
-#ifndef MAX
-# define MAX(a,b) (((a)>(b))?(a):(b))
-#endif
-
-void
-putheader(mci, hdr, e, flags)
- register MCI *mci;
- HDR *hdr;
- register ENVELOPE *e;
- int flags;
-{
- register HDR *h;
- char buf[MAX(MAXLINE,BUFSIZ)];
- char obuf[MAXLINE];
-
- if (tTd(34, 1))
- printf("--- putheader, mailer = %s ---\n",
- mci->mci_mailer->m_name);
-
- /*
- ** If we're in MIME mode, we're not really in the header of the
- ** message, just the header of one of the parts of the body of
- ** the message. Therefore MCIF_INHEADER should not be turned on.
- */
-
- if (!bitset(MCIF_INMIME, mci->mci_flags))
- mci->mci_flags |= MCIF_INHEADER;
-
- for (h = hdr; h != NULL; h = h->h_link)
- {
- register char *p = h->h_value;
- extern bool bitintersect __P((BITMAP, BITMAP));
-
- if (tTd(34, 11))
- {
- printf(" %s: ", h->h_field);
- xputs(p);
- }
-
-#if _FFR_MAX_MIME_HEADER_LENGTH
- /* heuristic shortening of MIME fields to avoid MUA overflows */
- if (MaxMimeFieldLength > 0 &&
- wordinclass(h->h_field,
- macid("{checkMIMEFieldHeaders}", NULL)))
- {
- extern bool fix_mime_header __P((char *));
-
- if (fix_mime_header(h->h_value))
- {
- sm_syslog(LOG_ALERT, e->e_id,
- "Truncated MIME %s header due to field size (possible attack)",
- h->h_field);
- if (tTd(34, 11))
- printf(" truncated MIME %s header due to field size (possible attack)\n",
- h->h_field);
- }
- }
-
- if (MaxMimeHeaderLength > 0 &&
- wordinclass(h->h_field,
- macid("{checkMIMETextHeaders}", NULL)))
- {
- if (strlen(h->h_value) > MaxMimeHeaderLength)
- {
- h->h_value[MaxMimeHeaderLength - 1] = '\0';
- sm_syslog(LOG_ALERT, e->e_id,
- "Truncated long MIME %s header (possible attack)",
- h->h_field);
- if (tTd(34, 11))
- printf(" truncated long MIME %s header (possible attack)\n",
- h->h_field);
- }
- }
-
- if (MaxMimeHeaderLength > 0 &&
- wordinclass(h->h_field,
- macid("{checkMIMEHeaders}", NULL)))
- {
- extern bool shorten_rfc822_string __P((char *, int));
-
- if (shorten_rfc822_string(h->h_value, MaxMimeHeaderLength))
- {
- sm_syslog(LOG_ALERT, e->e_id,
- "Truncated long MIME %s header (possible attack)",
- h->h_field);
- if (tTd(34, 11))
- printf(" truncated long MIME %s header (possible attack)\n",
- h->h_field);
- }
- }
-#endif
-
- /*
- ** Suppress Content-Transfer-Encoding: if we are MIMEing
- ** and we are potentially converting from 8 bit to 7 bit
- ** MIME. If converting, add a new CTE header in
- ** mime8to7().
- */
- if (bitset(H_CTE, h->h_flags) &&
- bitset(MCIF_CVT8TO7|MCIF_CVT7TO8|MCIF_INMIME,
- mci->mci_flags) &&
- !bitset(M87F_NO8TO7, flags))
- {
- if (tTd(34, 11))
- printf(" (skipped (content-transfer-encoding))\n");
- continue;
- }
-
- if (bitset(MCIF_INMIME, mci->mci_flags))
- {
- if (tTd(34, 11))
- printf("\n");
- put_vanilla_header(h, p, mci);
- continue;
- }
-
- if (bitset(H_CHECK|H_ACHECK, h->h_flags) &&
- !bitintersect(h->h_mflags, mci->mci_mailer->m_flags))
- {
- if (tTd(34, 11))
- printf(" (skipped)\n");
- continue;
- }
-
- /* handle Resent-... headers specially */
- if (bitset(H_RESENT, h->h_flags) && !bitset(EF_RESENT, e->e_flags))
- {
- if (tTd(34, 11))
- printf(" (skipped (resent))\n");
- continue;
- }
-
- /* suppress return receipts if requested */
- if (bitset(H_RECEIPTTO, h->h_flags) &&
-#if _FFR_DSN_RRT_OPTION
- (RrtImpliesDsn || bitset(EF_NORECEIPT, e->e_flags)))
-#else
- bitset(EF_NORECEIPT, e->e_flags))
-#endif
- {
- if (tTd(34, 11))
- printf(" (skipped (receipt))\n");
- continue;
- }
-
- /* macro expand value if generated internally */
- if (bitset(H_DEFAULT, h->h_flags))
- {
- expand(p, buf, sizeof buf, e);
- p = buf;
- if (*p == '\0')
- {
- if (tTd(34, 11))
- printf(" (skipped -- null value)\n");
- continue;
- }
- }
-
- if (bitset(H_BCC, h->h_flags))
- {
- /* Bcc: field -- either truncate or delete */
- if (bitset(EF_DELETE_BCC, e->e_flags))
- {
- if (tTd(34, 11))
- printf(" (skipped -- bcc)\n");
- }
- else
- {
- /* no other recipient headers: truncate value */
- (void) snprintf(obuf, sizeof obuf, "%s:",
- h->h_field);
- putline(obuf, mci);
- }
- continue;
- }
-
- if (tTd(34, 11))
- printf("\n");
-
- if (bitset(H_FROM|H_RCPT, h->h_flags))
- {
- /* address field */
- bool oldstyle = bitset(EF_OLDSTYLE, e->e_flags);
-
- if (bitset(H_FROM, h->h_flags))
- oldstyle = FALSE;
- commaize(h, p, oldstyle, mci, e);
- }
- else
- {
- put_vanilla_header(h, p, mci);
- }
- }
-
- /*
- ** If we are converting this to a MIME message, add the
- ** MIME headers.
- */
-
-#if MIME8TO7
- if (bitset(MM_MIME8BIT, MimeMode) &&
- bitset(EF_HAS8BIT, e->e_flags) &&
- !bitset(EF_DONT_MIME, e->e_flags) &&
- !bitnset(M_8BITS, mci->mci_mailer->m_flags) &&
- !bitset(MCIF_CVT8TO7|MCIF_CVT7TO8, mci->mci_flags))
- {
- if (hvalue("MIME-Version", e->e_header) == NULL)
- putline("MIME-Version: 1.0", mci);
- if (hvalue("Content-Type", e->e_header) == NULL)
- {
- snprintf(obuf, sizeof obuf,
- "Content-Type: text/plain; charset=%s",
- defcharset(e));
- putline(obuf, mci);
- }
- if (hvalue("Content-Transfer-Encoding", e->e_header) == NULL)
- putline("Content-Transfer-Encoding: 8bit", mci);
- }
-#endif
-}
-\f/*
-** PUT_VANILLA_HEADER -- output a fairly ordinary header
-**
-** Parameters:
-** h -- the structure describing this header
-** v -- the value of this header
-** mci -- the connection info for output
-**
-** Returns:
-** none.
-*/
-
-void
-put_vanilla_header(h, v, mci)
- HDR *h;
- char *v;
- MCI *mci;
-{
- register char *nlp;
- register char *obp;
- int putflags;
- char obuf[MAXLINE];
-
- putflags = PXLF_HEADER;
-#if _FFR_7BITHDRS
- if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags))
- putflags |= PXLF_STRIP8BIT;
-#endif
- (void) snprintf(obuf, sizeof obuf, "%.200s: ", h->h_field);
- obp = obuf + strlen(obuf);
- while ((nlp = strchr(v, '\n')) != NULL)
- {
- int l;
-
- l = nlp - v;
- if (SPACELEFT(obuf, obp) - 1 < l)
- l = SPACELEFT(obuf, obp) - 1;
-
- snprintf(obp, SPACELEFT(obuf, obp), "%.*s", l, v);
- putxline(obuf, strlen(obuf), mci, putflags);
- v += l + 1;
- obp = obuf;
- if (*v != ' ' && *v != '\t')
- *obp++ = ' ';
- }
- snprintf(obp, SPACELEFT(obuf, obp), "%.*s",
- sizeof obuf - (obp - obuf) - 1, v);
- putxline(obuf, strlen(obuf), mci, putflags);
-}
-\f/*
-** COMMAIZE -- output a header field, making a comma-translated list.
-**
-** Parameters:
-** h -- the header field to output.
-** p -- the value to put in it.
-** oldstyle -- TRUE if this is an old style header.
-** mci -- the connection information.
-** e -- the envelope containing the message.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** outputs "p" to file "fp".
-*/
-
-void
-commaize(h, p, oldstyle, mci, e)
- register HDR *h;
- register char *p;
- bool oldstyle;
- register MCI *mci;
- register ENVELOPE *e;
-{
- register char *obp;
- int opos;
- int omax;
- bool firstone = TRUE;
- int putflags = PXLF_HEADER;
- char obuf[MAXLINE + 3];
-
- /*
- ** Output the address list translated by the
- ** mailer and with commas.
- */
-
- if (tTd(14, 2))
- printf("commaize(%s: %s)\n", h->h_field, p);
-
-#if _FFR_7BITHDRS
- if (bitnset(M_7BITHDRS, mci->mci_mailer->m_flags))
- putflags |= PXLF_STRIP8BIT;
-#endif
-
- obp = obuf;
- (void) snprintf(obp, SPACELEFT(obuf, obp), "%.200s: ", h->h_field);
- opos = strlen(h->h_field) + 2;
- if (opos > 202)
- opos = 202;
- obp += opos;
- omax = mci->mci_mailer->m_linelimit - 2;
- if (omax < 0 || omax > 78)
- omax = 78;
-
- /*
- ** Run through the list of values.
- */
-
- while (*p != '\0')
- {
- register char *name;
- register int c;
- char savechar;
- int flags;
- auto int stat;
-
- /*
- ** Find the end of the name. New style names
- ** end with a comma, old style names end with
- ** a space character. However, spaces do not
- ** necessarily delimit an old-style name -- at
- ** signs mean keep going.
- */
-
- /* find end of name */
- while ((isascii(*p) && isspace(*p)) || *p == ',')
- p++;
- name = p;
- for (;;)
- {
- auto char *oldp;
- char pvpbuf[PSBUFSIZE];
-
- (void) prescan(p, oldstyle ? ' ' : ',', pvpbuf,
- sizeof pvpbuf, &oldp, NULL);
- p = oldp;
-
- /* look to see if we have an at sign */
- while (*p != '\0' && isascii(*p) && isspace(*p))
- p++;
-
- if (*p != '@')
- {
- p = oldp;
- break;
- }
- p += *p == '@' ? 1 : 2;
- while (*p != '\0' && isascii(*p) && isspace(*p))
- p++;
- }
- /* at the end of one complete name */
-
- /* strip off trailing white space */
- while (p >= name &&
- ((isascii(*p) && isspace(*p)) || *p == ',' || *p == '\0'))
- p--;
- if (++p == name)
- continue;
- savechar = *p;
- *p = '\0';
-
- /* translate the name to be relative */
- flags = RF_HEADERADDR|RF_ADDDOMAIN;
- if (bitset(H_FROM, h->h_flags))
- flags |= RF_SENDERADDR;
-#if USERDB
- else if (e->e_from.q_mailer != NULL &&
- bitnset(M_UDBRECIPIENT, e->e_from.q_mailer->m_flags))
- {
- extern char *udbsender __P((char *));
- char *q;
-
- q = udbsender(name);
- if (q != NULL)
- name = q;
- }
-#endif
- stat = EX_OK;
- name = remotename(name, mci->mci_mailer, flags, &stat, e);
- if (*name == '\0')
- {
- *p = savechar;
- continue;
- }
- name = denlstring(name, FALSE, TRUE);
-
- /* output the name with nice formatting */
- opos += strlen(name);
- if (!firstone)
- opos += 2;
- if (opos > omax && !firstone)
- {
- snprintf(obp, SPACELEFT(obuf, obp), ",\n");
- putxline(obuf, strlen(obuf), mci, putflags);
- obp = obuf;
- (void) strcpy(obp, " ");
- opos = strlen(obp);
- obp += opos;
- opos += strlen(name);
- }
- else if (!firstone)
- {
- snprintf(obp, SPACELEFT(obuf, obp), ", ");
- obp += 2;
- }
-
- while ((c = *name++) != '\0' && obp < &obuf[MAXLINE])
- *obp++ = c;
- firstone = FALSE;
- *p = savechar;
- }
- *obp = '\0';
- putxline(obuf, strlen(obuf), mci, putflags);
-}
-\f/*
-** COPYHEADER -- copy header list
-**
-** This routine is the equivalent of newstr for header lists
-**
-** Parameters:
-** header -- list of header structures to copy.
-**
-** Returns:
-** a copy of 'header'.
-**
-** Side Effects:
-** none.
-*/
-
-HDR *
-copyheader(header)
- register HDR *header;
-{
- register HDR *newhdr;
- HDR *ret;
- register HDR **tail = &ret;
-
- while (header != NULL)
- {
- newhdr = (HDR *) xalloc(sizeof(HDR));
- STRUCTCOPY(*header, *newhdr);
- *tail = newhdr;
- tail = &newhdr->h_link;
- header = header->h_link;
- }
- *tail = NULL;
-
- return ret;
-}
-\f/*
-** FIX_MIME_HEADER -- possibly truncate/rebalance parameters in a MIME header
-**
-** Run through all of the parameters of a MIME header and
-** possibly truncate and rebalance the parameter according
-** to MaxMimeFieldLength.
-**
-** Parameters:
-** string -- the full header
-**
-** Returns:
-** TRUE if the header was modified, FALSE otherwise
-**
-** Side Effects:
-** string modified in place
-*/
-
-bool
-fix_mime_header(string)
- char *string;
-{
- bool modified = FALSE;
- char *begin = string;
- char *end;
- extern char *find_character __P((char *, char));
- extern bool shorten_rfc822_string __P((char *, int));
-
- if (string == NULL || *string == '\0')
- return FALSE;
-
- /* Split on each ';' */
- while ((end = find_character(begin, ';')) != NULL)
- {
- char save = *end;
- char *bp;
-
- *end = '\0';
-
- /* Shorten individual parameter */
- if (shorten_rfc822_string(begin, MaxMimeFieldLength))
- modified = TRUE;
-
- /* Collapse the possibly shortened string with rest */
- bp = begin + strlen(begin);
- if (bp != end)
- {
- char *ep = end;
-
- *end = save;
- end = bp;
-
- /* copy character by character due to overlap */
- while (*ep != '\0')
- *bp++ = *ep++;
- *bp = '\0';
- }
- else
- *end = save;
- if (*end == '\0')
- break;
-
- /* Move past ';' */
- begin = end + 1;
- }
- return modified;
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. 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.
- *
- */
-
-/*
-** Support for LDAP.
-**
-** Contributed by Booker C. Bense <bbense+ldap@stanford.edu>.
-** Please go to him for support -- since I (Eric) don't run LDAP, I
-** can't help you at all.
-**
-** @(#)ldap_map.h 8.12 (Berkeley) 2/2/1999
-*/
-
-#ifndef _LDAP_MAP_H
-#define _LDAP_MAP_H
-
-#include <sys/time.h>
-
-struct ldap_map_struct
-{
- /* needed for ldap_open */
- char *ldaphost;
- int ldapport;
-
- /* Options set in ld struct before ldap_bind_s */
- int deref;
- int timelimit;
- int sizelimit;
- int ldap_options;
-
- /* args for ldap_bind_s */
- LDAP *ld;
- char *binddn;
- char *passwd;
- int method;
-
- /* args for ldap_search_st */
- char *base;
- int scope;
- char *filter;
- char *attr[2];
- int attrsonly;
- struct timeval timeout;
- LDAPMessage *res;
-};
-
-typedef struct ldap_map_struct LDAP_MAP_STRUCT;
-
-#define DEFAULT_LDAP_MAP_PORT LDAP_PORT
-#define DEFAULT_LDAP_MAP_SCOPE LDAP_SCOPE_SUBTREE
-#define DEFAULT_LDAP_MAP_BINDDN NULL
-#define DEFAULT_LDAP_MAP_PASSWD NULL
-#define DEFAULT_LDAP_MAP_METHOD LDAP_AUTH_SIMPLE
-#define DEFAULT_LDAP_MAP_TIMELIMIT 5
-#define DEFAULT_LDAP_MAP_DEREF LDAP_DEREF_NEVER
-#define DEFAULT_LDAP_MAP_SIZELIMIT 0
-#define DEFAULT_LDAP_MAP_ATTRSONLY 0
-#define LDAP_MAP_MAX_FILTER 1024
-#ifdef LDAP_REFERRALS
-# define DEFAULT_LDAP_MAP_LDAP_OPTIONS LDAP_OPT_REFERRALS
-#else /* LDAP_REFERRALS */
-# define DEFAULT_LDAP_MAP_LDAP_OPTIONS 0
-#endif /* LDAP_REFERRALS */
-
-/*
-** ldap_init(3) is broken in Umich 3.x and OpenLDAP 1.0/1.1.
-** Use the lack of LDAP_OPT_SIZELIMIT to detect old API implementations
-** and assume (falsely) that all old API implementations are broken.
-** (OpenLDAP 1.2 and later have a working ldap_init(), add -DUSE_LDAP_INIT)
-*/
-
-#if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_INIT)
-# define USE_LDAP_INIT 1
-#endif
-
-/*
-** LDAP_OPT_SIZELIMIT is not defined under Umich 3.x nor OpenLDAP 1.x,
-** hence ldap_set_option() must not exist.
-*/
-
-#if defined(LDAP_OPT_SIZELIMIT) && !defined(USE_LDAP_SET_OPTION)
-# define USE_LDAP_SET_OPTION 1
-#endif
-
-#endif /* _LDAP_MAP_H */
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)macro.c 8.26 (Berkeley) 11/8/1998";
-#endif /* not lint */
-
-# include "sendmail.h"
-
-char *MacroName[256]; /* macro id to name table */
-int NextMacroId = 0240; /* codes for long named macros */
-
-
-/*
-** EXPAND -- macro expand a string using $x escapes.
-**
-** Parameters:
-** s -- the string to expand.
-** buf -- the place to put the expansion.
-** bufsize -- the size of the buffer.
-** e -- envelope in which to work.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** none.
-*/
-
-void
-expand(s, buf, bufsize, e)
- register char *s;
- register char *buf;
- size_t bufsize;
- register ENVELOPE *e;
-{
- register char *xp;
- register char *q;
- bool skipping; /* set if conditionally skipping output */
- bool recurse = FALSE; /* set if recursion required */
- int i;
- int skiplev; /* skipping nesting level */
- int iflev; /* if nesting level */
- char xbuf[MACBUFSIZE];
- static int explevel = 0;
-
- if (tTd(35, 24))
- {
- printf("expand(");
- xputs(s);
- printf(")\n");
- }
-
- skipping = FALSE;
- skiplev = 0;
- iflev = 0;
- if (s == NULL)
- s = "";
- for (xp = xbuf; *s != '\0'; s++)
- {
- int c;
-
- /*
- ** Check for non-ordinary (special?) character.
- ** 'q' will be the interpolated quantity.
- */
-
- q = NULL;
- c = *s;
- switch (c & 0377)
- {
- case CONDIF: /* see if var set */
- iflev++;
- c = *++s;
- if (skipping)
- skiplev++;
- else
- skipping = macvalue(c, e) == NULL;
- continue;
-
- case CONDELSE: /* change state of skipping */
- if (iflev == 0)
- break;
- if (skiplev == 0)
- skipping = !skipping;
- continue;
-
- case CONDFI: /* stop skipping */
- if (iflev == 0)
- break;
- iflev--;
- if (skiplev == 0)
- skipping = FALSE;
- if (skipping)
- skiplev--;
- continue;
-
- case MACROEXPAND: /* macro interpolation */
- c = *++s & 0377;
- if (c != '\0')
- q = macvalue(c, e);
- else
- {
- s--;
- q = NULL;
- }
- if (q == NULL)
- continue;
- break;
- }
-
- /*
- ** Interpolate q or output one character
- */
-
- if (skipping || xp >= &xbuf[sizeof xbuf - 1])
- continue;
- if (q == NULL)
- *xp++ = c;
- else
- {
- /* copy to end of q or max space remaining in buf */
- while ((c = *q++) != '\0' && xp < &xbuf[sizeof xbuf - 1])
- {
- /* check for any sendmail metacharacters */
- if ((c & 0340) == 0200)
- recurse = TRUE;
- *xp++ = c;
- }
- }
- }
- *xp = '\0';
-
- if (tTd(35, 24))
- {
- printf("expand ==> ");
- xputs(xbuf);
- printf("\n");
- }
-
- /* recurse as appropriate */
- if (recurse)
- {
- if (explevel < MaxMacroRecursion)
- {
- explevel++;
- expand(xbuf, buf, bufsize, e);
- explevel--;
- return;
- }
- syserr("expand: recursion too deep (%d max)",
- MaxMacroRecursion);
- }
-
- /* copy results out */
- i = xp - xbuf;
- if (i >= bufsize)
- i = bufsize - 1;
- bcopy(xbuf, buf, i);
- buf[i] = '\0';
-}
-\f/*
-** DEFINE -- define a macro.
-**
-** this would be better done using a #define macro.
-**
-** Parameters:
-** n -- the macro name.
-** v -- the macro value.
-** e -- the envelope to store the definition in.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** e->e_macro[n] is defined.
-**
-** Notes:
-** There is one macro for each ASCII character,
-** although they are not all used. The currently
-** defined macros are:
-**
-** $a date in ARPANET format (preferring the Date: line
-** of the message)
-** $b the current date (as opposed to the date as found
-** the message) in ARPANET format
-** $c hop count
-** $d (current) date in UNIX (ctime) format
-** $e the SMTP entry message+
-** $f raw from address
-** $g translated from address
-** $h to host
-** $i queue id
-** $j official SMTP hostname, used in messages+
-** $k UUCP node name
-** $l UNIX-style from line+
-** $m The domain part of our full name.
-** $n name of sendmail ("MAILER-DAEMON" on local
-** net typically)+
-** $o delimiters ("operators") for address tokens+
-** (set via OperatorChars option in V6 or later
-** sendmail.cf files)
-** $p my process id in decimal
-** $q the string that becomes an address -- this is
-** normally used to combine $g & $x.
-** $r protocol used to talk to sender
-** $s sender's host name
-** $t the current time in seconds since 1/1/1970
-** $u to user
-** $v version number of sendmail
-** $w our host name (if it can be determined)
-** $x signature (full name) of from person
-** $y the tty id of our terminal
-** $z home directory of to person
-** $_ RFC1413 authenticated sender address
-**
-** Macros marked with + must be defined in the
-** configuration file and are used internally, but
-** are not set.
-**
-** There are also some macros that can be used
-** arbitrarily to make the configuration file
-** cleaner. In general all upper-case letters
-** are available.
-*/
-
-void
-define(n, v, e)
- int n;
- char *v;
- register ENVELOPE *e;
-{
- if (tTd(35, 9))
- {
- printf("%sdefine(%s as ",
- (e->e_macro[n & 0377] == NULL) ? "" : "re", macname(n));
- xputs(v);
- printf(")\n");
- }
- e->e_macro[n & 0377] = v;
-}
-\f/*
-** MACVALUE -- return uninterpreted value of a macro.
-**
-** Parameters:
-** n -- the name of the macro.
-**
-** Returns:
-** The value of n.
-**
-** Side Effects:
-** none.
-*/
-
-char *
-macvalue(n, e)
- int n;
- register ENVELOPE *e;
-{
- n &= 0377;
- while (e != NULL)
- {
- register char *p = e->e_macro[n];
-
- if (p != NULL)
- return (p);
- e = e->e_parent;
- }
- return (NULL);
-}
-\f/*
-** MACNAME -- return the name of a macro given its internal id
-**
-** Parameter:
-** n -- the id of the macro
-**
-** Returns:
-** The name of n.
-**
-** Side Effects:
-** none.
-*/
-
-char *
-macname(n)
- int n;
-{
- static char mbuf[2];
-
- n &= 0377;
- if (bitset(0200, n))
- {
- char *p = MacroName[n];
-
- if (p != NULL)
- return p;
- return "***UNDEFINED MACRO***";
- }
- mbuf[0] = n;
- mbuf[1] = '\0';
- return mbuf;
-}
-\f/*
-** MACID -- return id of macro identified by its name
-**
-** Parameters:
-** p -- pointer to name string -- either a single
-** character or {name}.
-** ep -- filled in with the pointer to the byte
-** after the name.
-**
-** Returns:
-** The internal id code for this macro. This will
-** fit into a single byte.
-**
-** Side Effects:
-** If this is a new macro name, a new id is allocated.
-*/
-
-int
-macid(p, ep)
- register char *p;
- char **ep;
-{
- int mid;
- register char *bp;
- char mbuf[MAXMACNAMELEN + 1];
-
- if (tTd(35, 14))
- {
- printf("macid(");
- xputs(p);
- printf(") => ");
- }
-
- if (*p == '\0' || (p[0] == '{' && p[1] == '}'))
- {
- syserr("Name required for macro/class");
- if (ep != NULL)
- *ep = p;
- if (tTd(35, 14))
- printf("NULL\n");
- return '\0';
- }
- if (*p != '{')
- {
- /* the macro is its own code */
- if (ep != NULL)
- *ep = p + 1;
- if (tTd(35, 14))
- printf("%c\n", *p);
- return *p;
- }
- bp = mbuf;
- while (*++p != '\0' && *p != '}' && bp < &mbuf[sizeof mbuf - 1])
- {
- if (isascii(*p) && (isalnum(*p) || *p == '_'))
- *bp++ = *p;
- else
- syserr("Invalid macro/class character %c", *p);
- }
- *bp = '\0';
- mid = -1;
- if (*p == '\0')
- {
- syserr("Unbalanced { on %s", mbuf); /* missing } */
- }
- else if (*p != '}')
- {
- syserr("Macro/class name ({%s}) too long (%d chars max)",
- mbuf, sizeof mbuf - 1);
- }
- else if (mbuf[1] == '\0')
- {
- /* ${x} == $x */
- mid = mbuf[0];
- p++;
- }
- else
- {
- register STAB *s;
-
- s = stab(mbuf, ST_MACRO, ST_ENTER);
- if (s->s_macro != 0)
- mid = s->s_macro;
- else
- {
- if (NextMacroId > 0377)
- {
- syserr("Macro/class {%s}: too many long names", mbuf);
- s->s_macro = -1;
- }
- else
- {
- MacroName[NextMacroId] = s->s_name;
- s->s_macro = mid = NextMacroId++;
- }
- }
- p++;
- }
- if (ep != NULL)
- *ep = p;
- if (tTd(35, 14))
- printf("0x%x\n", mid);
- return mid;
-}
-\f/*
-** WORDINCLASS -- tell if a word is in a specific class
-**
-** Parameters:
-** str -- the name of the word to look up.
-** cl -- the class name.
-**
-** Returns:
-** TRUE if str can be found in cl.
-** FALSE otherwise.
-*/
-
-bool
-wordinclass(str, cl)
- char *str;
- int cl;
-{
- register STAB *s;
-
- s = stab(str, ST_CLASS, ST_FIND);
- return s != NULL && bitnset(cl & 0xff, s->s_class);
-}
+++ /dev/null
-.\" Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-.\" Copyright (c) 1983, 1997 Eric P. Allman. All rights reserved.
-.\" Copyright (c) 1985, 1990, 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.
-.\"
-.\"
-.\" @(#)mailq.1 8.10 (Berkeley) 5/19/1998
-.\"
-.Dd May 19, 1998
-.Dt MAILQ 1
-.Os
-.Sh NAME
-.Nm mailq
-.Nd print the mail queue
-.Sh SYNOPSIS
-.Nm mailq
-.Op Fl v
-.Sh DESCRIPTION
-.Nm Mailq
-prints a summary of the mail messages queued for future delivery.
-.Pp
-The first line printed for each message
-shows the internal identifier used on this host
-for the message,
-the size of the message in bytes,
-the date and time the message was accepted into the queue,
-and the envelope sender of the message.
-The second line shows the error message that caused this message
-to be retained in the queue;
-it will not be present if the message is being processed
-for the first time.
-The following lines show message recipients,
-one per line.
-.Pp
-.Nm Mailq
-is identical to
-.Dq Li "sendmail -bp" .
-.Pp
-The options are as follows:
-.Bl -tag -width Ds
-.It Fl v
-Print verbose information.
-This adds the priority of the message and
-a single character indicator (``+'' or blank)
-indicating whether a warning message has been sent
-on the first line of the message.
-Additionally, extra lines may be intermixed with the recipients
-indicating the ``controlling user'' information;
-this shows who will own any programs that are executed
-on behalf of this message
-and the name of the alias this command expanded from, if any.
-.El
-.Pp
-The
-.Nm mailq
-utility exits 0 on success, and >0 if an error occurs.
-.Sh SEE ALSO
-.Xr mailer.conf 5 ,
-.Xr sendmail 8
-.Sh HISTORY
-The
-.Nm mailq
-command appeared in
-.Bx 4.0 .
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- *
- * @(#)mailstats.h 8.8 (Berkeley) 5/19/1998
- */
-
-#define STAT_VERSION 2
-#define STAT_MAGIC 0x1B1DE
-
-/*
-** Statistics structure.
-*/
-
-struct statistics
-{
- int stat_magic; /* magic number */
- int stat_version; /* stat file version */
- time_t stat_itime; /* file initialization time */
- short stat_size; /* size of this structure */
- long stat_nf[MAXMAILERS]; /* # msgs from each mailer */
- long stat_bf[MAXMAILERS]; /* kbytes from each mailer */
- long stat_nt[MAXMAILERS]; /* # msgs to each mailer */
- long stat_bt[MAXMAILERS]; /* kbytes to each mailer */
- long stat_nr[MAXMAILERS]; /* # rejects by each mailer */
- long stat_nd[MAXMAILERS]; /* # discards by each mailer */
-};
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char copyright[] =
-"@(#) Copyright (c) 1998 Sendmail, Inc. All rights reserved.\n\
- Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.\n\
- Copyright (c) 1988, 1993\n\
- The Regents of the University of California. All rights reserved.\n";
-#endif /* not lint */
-
-#ifndef lint
-static char sccsid[] = "@(#)main.c 8.322 (Berkeley) 12/18/1998";
-#endif /* not lint */
-
-#define _DEFINE
-
-#include "sendmail.h"
-#include <arpa/inet.h>
-#include <grp.h>
-#if NAMED_BIND
-#include <resolv.h>
-#endif
-
-/*
-** SENDMAIL -- Post mail to a set of destinations.
-**
-** This is the basic mail router. All user mail programs should
-** call this routine to actually deliver mail. Sendmail in
-** turn calls a bunch of mail servers that do the real work of
-** delivering the mail.
-**
-** Sendmail is driven by settings read in from /etc/sendmail.cf
-** (read by readcf.c).
-**
-** Usage:
-** /usr/lib/sendmail [flags] addr ...
-**
-** See the associated documentation for details.
-**
-** Author:
-** Eric Allman, UCB/INGRES (until 10/81).
-** Britton-Lee, Inc., purveyors of fine
-** database computers (11/81 - 10/88).
-** International Computer Science Institute
-** (11/88 - 9/89).
-** UCB/Mammoth Project (10/89 - 7/95).
-** InReference, Inc. (8/95 - 1/97).
-** Sendmail, Inc. (1/98 - present).
-** The support of the my employers is gratefully acknowledged.
-** Few of them (Britton-Lee in particular) have had
-** anything to gain from my involvement in this project.
-*/
-
-
-int NextMailer; /* "free" index into Mailer struct */
-char *FullName; /* sender's full name */
-ENVELOPE BlankEnvelope; /* a "blank" envelope */
-ENVELOPE MainEnvelope; /* the envelope around the basic letter */
-ADDRESS NullAddress = /* a null address */
- { "", "", NULL, "" };
-char *CommandLineArgs; /* command line args for pid file */
-bool Warn_Q_option = FALSE; /* warn about Q option use */
-char **SaveArgv; /* argument vector for re-execing */
-int MissingFds = 0; /* bit map of fds missing on startup */
-
-#ifdef NGROUPS_MAX
-GIDSET_T InitialGidSet[NGROUPS_MAX];
-#endif
-
-static void obsolete __P((char **));
-extern void printmailer __P((MAILER *));
-extern void tTflag __P((char *));
-
-#if DAEMON && !SMTP
-ERROR %%%% Cannot have DAEMON mode without SMTP %%%% ERROR
-#endif /* DAEMON && !SMTP */
-#if SMTP && !QUEUE
-ERROR %%%% Cannot have SMTP mode without QUEUE %%%% ERROR
-#endif /* DAEMON && !SMTP */
-
-#define MAXCONFIGLEVEL 8 /* highest config version level known */
-
-int
-main(argc, argv, envp)
- int argc;
- char **argv;
- char **envp;
-{
- register char *p;
- char **av;
- extern char Version[];
- char *ep, *from;
- STAB *st;
- register int i;
- int j;
- bool queuemode = FALSE; /* process queue requests */
- bool safecf = TRUE;
- bool warn_C_flag = FALSE;
- char warn_f_flag = '\0';
- bool run_in_foreground = FALSE; /* -bD mode */
- static bool reenter = FALSE;
- struct passwd *pw;
- struct hostent *hp;
- char *nullserver = NULL;
- bool forged;
- char jbuf[MAXHOSTNAMELEN]; /* holds MyHostName */
- static char rnamebuf[MAXNAME]; /* holds RealUserName */
- char *emptyenviron[1];
- QUEUE_CHAR *new;
- extern int DtableSize;
- extern int optind;
- extern int opterr;
- extern char *optarg;
- extern char **environ;
- extern time_t convtime __P((char *, char));
- extern SIGFUNC_DECL intsig __P((int));
- extern struct hostent *myhostname __P((char *, int));
- extern char *getauthinfo __P((int, bool *));
- extern char *getcfname __P((void));
- extern SIGFUNC_DECL sigusr1 __P((int));
- extern SIGFUNC_DECL sighup __P((int));
- extern SIGFUNC_DECL quiesce __P((int));
- extern void initmacros __P((ENVELOPE *));
- extern void init_md __P((int, char **));
- extern int getdtsize __P((void));
- extern void tTsetup __P((u_char *, int, char *));
- extern void setdefaults __P((ENVELOPE *));
- extern void initsetproctitle __P((int, char **, char **));
- extern void init_vendor_macros __P((ENVELOPE *));
- extern void load_if_names __P((void));
- extern void vendor_pre_defaults __P((ENVELOPE *));
- extern void vendor_post_defaults __P((ENVELOPE *));
- extern void readcf __P((char *, bool, ENVELOPE *));
- extern void printqueue __P((void));
- extern void sendtoargv __P((char **, ENVELOPE *));
- extern void resetlimits __P((void));
-#ifndef HASUNSETENV
- extern void unsetenv __P((char *));
-#endif
-
- /*
- ** Check to see if we reentered.
- ** This would normally happen if e_putheader or e_putbody
- ** were NULL when invoked.
- */
-
- if (reenter)
- {
- syserr("main: reentered!");
- abort();
- }
- reenter = TRUE;
-
- /* avoid null pointer dereferences */
- TermEscape.te_rv_on = TermEscape.te_rv_off = "";
-
- /* do machine-dependent initializations */
- init_md(argc, argv);
-
- /* in 4.4BSD, the table can be huge; impose a reasonable limit */
- DtableSize = getdtsize();
- if (DtableSize > 256)
- DtableSize = 256;
-
- /*
- ** Be sure we have enough file descriptors.
- ** But also be sure that 0, 1, & 2 are open.
- */
-
- fill_fd(STDIN_FILENO, NULL);
- fill_fd(STDOUT_FILENO, NULL);
- fill_fd(STDERR_FILENO, NULL);
-
- i = DtableSize;
- while (--i > 0)
- {
- if (i != STDIN_FILENO && i != STDOUT_FILENO && i != STDERR_FILENO)
- (void) close(i);
- }
- errno = 0;
-
-#if LOG
-# ifdef LOG_MAIL
- openlog("sendmail", LOG_PID, LOG_MAIL);
-# else
- openlog("sendmail", LOG_PID);
-# endif
-#endif
-
- if (MissingFds != 0)
- {
- char mbuf[MAXLINE];
-
- mbuf[0] = '\0';
- if (bitset(1 << STDIN_FILENO, MissingFds))
- strcat(mbuf, ", stdin");
- if (bitset(1 << STDOUT_FILENO, MissingFds))
- strcat(mbuf, ", stdout");
- if (bitset(1 << STDERR_FILENO, MissingFds))
- strcat(mbuf, ", stderr");
- syserr("File descriptors missing on startup: %s", &mbuf[2]);
- }
-
- /* reset status from syserr() calls for missing file descriptors */
- Errors = 0;
- ExitStat = EX_OK;
-
-#if XDEBUG
- checkfd012("after openlog");
-#endif
-
- tTsetup(tTdvect, sizeof tTdvect, "0-99.1");
-
-#ifdef NGROUPS_MAX
- /* save initial group set for future checks */
- i = getgroups(NGROUPS_MAX, InitialGidSet);
- if (i == 0)
- InitialGidSet[0] = (GID_T) -1;
- while (i < NGROUPS_MAX)
- InitialGidSet[i++] = InitialGidSet[0];
-#endif
-
- /* drop group id privileges (RunAsUser not yet set) */
- (void) drop_privileges(FALSE);
-
-#ifdef SIGUSR1
- /* arrange to dump state on user-1 signal */
- setsignal(SIGUSR1, sigusr1);
-#endif
-
- /* initialize for setproctitle */
- initsetproctitle(argc, argv, envp);
-
- /* Handle any non-getoptable constructions. */
- obsolete(argv);
-
- /*
- ** Do a quick prescan of the argument list.
- */
-
-#if defined(__osf__) || defined(_AIX3)
-# define OPTIONS "B:b:C:cd:e:F:f:h:IiM:mN:nO:o:p:q:R:r:sTtUV:vX:x"
-#endif
-#if defined(sony_news)
-# define OPTIONS "B:b:C:cd:E:e:F:f:h:IiJ:M:mN:nO:o:p:q:R:r:sTtUV:vX:"
-#endif
-#ifndef OPTIONS
-# define OPTIONS "B:b:C:cd:e:F:f:h:IiM:mN:nO:o:p:q:R:r:sTtUV:vX:"
-#endif
- opterr = 0;
- while ((j = getopt(argc, argv, OPTIONS)) != -1)
- {
- switch (j)
- {
- case 'd':
- /* hack attack -- see if should use ANSI mode */
- if (strcmp(optarg, "ANSI") == 0)
- {
- TermEscape.te_rv_on = "\033[7m";
- TermEscape.te_rv_off = "\033[0m";
- break;
- }
- tTflag(optarg);
- setbuf(stdout, (char *) NULL);
- break;
- }
- }
- opterr = 1;
-
- /* set up the blank envelope */
- BlankEnvelope.e_puthdr = putheader;
- BlankEnvelope.e_putbody = putbody;
- BlankEnvelope.e_xfp = NULL;
- STRUCTCOPY(NullAddress, BlankEnvelope.e_from);
- CurEnv = &BlankEnvelope;
- STRUCTCOPY(NullAddress, MainEnvelope.e_from);
-
- /*
- ** Set default values for variables.
- ** These cannot be in initialized data space.
- */
-
- setdefaults(&BlankEnvelope);
-
- RealUid = getuid();
- RealGid = getgid();
-
- pw = sm_getpwuid(RealUid);
- if (pw != NULL)
- (void) snprintf(rnamebuf, sizeof rnamebuf, "%s", pw->pw_name);
- else
- (void) snprintf(rnamebuf, sizeof rnamebuf, "Unknown UID %d", RealUid);
- RealUserName = rnamebuf;
-
- if (tTd(0, 101))
- {
- printf("Version %s\n", Version);
- finis(FALSE, EX_OK);
- }
-
- /*
- ** if running non-setuid binary as non-root, pretend
- ** we are the RunAsUid
- */
- if (RealUid != 0 && geteuid() == RealUid)
- {
- if (tTd(47, 1))
- printf("Non-setuid binary: RunAsUid = RealUid = %d\n",
- (int)RealUid);
- RunAsUid = RealUid;
- }
- else if (geteuid() != 0)
- RunAsUid = geteuid();
-
- if (RealUid != 0 && getegid() == RealGid)
- RunAsGid = RealGid;
-
- if (tTd(47, 5))
- {
- printf("main: e/ruid = %d/%d e/rgid = %d/%d\n",
- (int)geteuid(), (int)getuid(), (int)getegid(), (int)getgid());
- printf("main: RunAsUser = %d:%d\n", (int)RunAsUid, (int)RunAsGid);
- }
-
- /* save command line arguments */
- i = 0;
- for (av = argv; *av != NULL; )
- i += strlen(*av++) + 1;
- SaveArgv = (char **) xalloc(sizeof (char *) * (argc + 1));
- CommandLineArgs = xalloc(i);
- p = CommandLineArgs;
- for (av = argv, i = 0; *av != NULL; )
- {
- SaveArgv[i++] = newstr(*av);
- if (av != argv)
- *p++ = ' ';
- strcpy(p, *av++);
- p += strlen(p);
- }
- SaveArgv[i] = NULL;
-
- if (tTd(0, 1))
- {
- int ll;
- extern char *CompileOptions[];
-
- printf("Version %s\n Compiled with:", Version);
- av = CompileOptions;
- ll = 7;
- while (*av != NULL)
- {
- if (ll + strlen(*av) > 63)
- {
- putchar('\n');
- ll = 0;
- }
- if (ll == 0)
- {
- putchar('\t');
- putchar('\t');
- }
- else
- putchar(' ');
- printf("%s", *av);
- ll += strlen(*av++) + 1;
- }
- putchar('\n');
- }
- if (tTd(0, 10))
- {
- int ll;
- extern char *OsCompileOptions[];
-
- printf(" OS Defines:");
- av = OsCompileOptions;
- ll = 7;
- while (*av != NULL)
- {
- if (ll + strlen(*av) > 63)
- {
- putchar('\n');
- ll = 0;
- }
- if (ll == 0)
- {
- putchar('\t');
- putchar('\t');
- }
- else
- putchar(' ');
- printf("%s", *av);
- ll += strlen(*av++) + 1;
- }
- putchar('\n');
-#ifdef _PATH_UNIX
- printf("Kernel symbols:\t%s\n", _PATH_UNIX);
-#endif
- printf(" Def Conf file:\t%s\n", getcfname());
- printf(" Pid file:\t%s\n", PidFile);
- }
-
- InChannel = stdin;
- OutChannel = stdout;
-
- /* clear sendmail's environment */
- ExternalEnviron = environ;
- emptyenviron[0] = NULL;
- environ = emptyenviron;
-
- /*
- ** restore any original TZ setting until TimeZoneSpec has been
- ** determined - or early log messages may get bogus time stamps
- */
- if ((p = getextenv("TZ")) != NULL)
- {
- char *tz;
- int tzlen;
-
- tzlen = strlen(p) + 4;
- tz = xalloc(tzlen);
- snprintf(tz, tzlen, "TZ=%s", p);
- putenv(tz);
- }
-
- /* prime the child environment */
- setuserenv("AGENT", "sendmail");
-
- if (setsignal(SIGINT, SIG_IGN) != SIG_IGN)
- (void) setsignal(SIGINT, intsig);
- (void) setsignal(SIGTERM, intsig);
- (void) setsignal(SIGPIPE, SIG_IGN);
- OldUmask = umask(022);
- OpMode = MD_DELIVER;
- FullName = getextenv("NAME");
-
- /*
- ** Initialize name server if it is going to be used.
- */
-
-#if NAMED_BIND
- if (!bitset(RES_INIT, _res.options))
- res_init();
- if (tTd(8, 8))
- _res.options |= RES_DEBUG;
- else
- _res.options &= ~RES_DEBUG;
-# ifdef RES_NOALIASES
- _res.options |= RES_NOALIASES;
-# endif
-#endif
-
- errno = 0;
- from = NULL;
-
- /* initialize some macros, etc. */
- initmacros(CurEnv);
- init_vendor_macros(CurEnv);
-
- /* version */
- define('v', Version, CurEnv);
-
- /* hostname */
- hp = myhostname(jbuf, sizeof jbuf);
- if (jbuf[0] != '\0')
- {
- struct utsname utsname;
-
- if (tTd(0, 4))
- printf("canonical name: %s\n", jbuf);
- define('w', newstr(jbuf), CurEnv); /* must be new string */
- define('j', newstr(jbuf), CurEnv);
- setclass('w', jbuf);
-
- p = strchr(jbuf, '.');
- if (p != NULL)
- {
- if (p[1] != '\0')
- {
- define('m', newstr(&p[1]), CurEnv);
- }
- while (p != NULL && strchr(&p[1], '.') != NULL)
- {
- *p = '\0';
- if (tTd(0, 4))
- printf("\ta.k.a.: %s\n", jbuf);
- setclass('w', jbuf);
- *p++ = '.';
- p = strchr(p, '.');
- }
- }
-
- if (uname(&utsname) >= 0)
- p = utsname.nodename;
- else
- {
- if (tTd(0, 22))
- printf("uname failed (%s)\n", errstring(errno));
- makelower(jbuf);
- p = jbuf;
- }
- if (tTd(0, 4))
- printf(" UUCP nodename: %s\n", p);
- p = newstr(p);
- define('k', p, CurEnv);
- setclass('k', p);
- setclass('w', p);
- }
- if (hp != NULL)
- {
- for (av = hp->h_aliases; av != NULL && *av != NULL; av++)
- {
- if (tTd(0, 4))
- printf("\ta.k.a.: %s\n", *av);
- setclass('w', *av);
- }
-#if NETINET
- if (hp->h_addrtype == AF_INET && hp->h_length == INADDRSZ)
- {
- for (i = 0; hp->h_addr_list[i] != NULL; i++)
- {
- char ipbuf[103];
-
- snprintf(ipbuf, sizeof ipbuf, "[%.100s]",
- inet_ntoa(*((struct in_addr *) hp->h_addr_list[i])));
- if (tTd(0, 4))
- printf("\ta.k.a.: %s\n", ipbuf);
- setclass('w', ipbuf);
- }
- }
-#endif
- }
-
- /* current time */
- define('b', arpadate((char *) NULL), CurEnv);
-
- QueueLimitRecipient = (QUEUE_CHAR *) NULL;
- QueueLimitSender = (QUEUE_CHAR *) NULL;
- QueueLimitId = (QUEUE_CHAR *) NULL;
-
- /*
- ** Crack argv.
- */
-
- av = argv;
- p = strrchr(*av, '/');
- if (p++ == NULL)
- p = *av;
- if (strcmp(p, "newaliases") == 0)
- OpMode = MD_INITALIAS;
- else if (strcmp(p, "mailq") == 0)
- OpMode = MD_PRINT;
- else if (strcmp(p, "smtpd") == 0)
- OpMode = MD_DAEMON;
- else if (strcmp(p, "hoststat") == 0)
- OpMode = MD_HOSTSTAT;
- else if (strcmp(p, "purgestat") == 0)
- OpMode = MD_PURGESTAT;
-
- optind = 1;
- while ((j = getopt(argc, argv, OPTIONS)) != -1)
- {
- switch (j)
- {
- case 'b': /* operations mode */
- switch (j = *optarg)
- {
- case MD_DAEMON:
- case MD_FGDAEMON:
-# if !DAEMON
- usrerr("Daemon mode not implemented");
- ExitStat = EX_USAGE;
- break;
-# endif /* DAEMON */
- case MD_SMTP:
-# if !SMTP
- usrerr("I don't speak SMTP");
- ExitStat = EX_USAGE;
- break;
-# endif /* SMTP */
-
- case MD_INITALIAS:
- case MD_DELIVER:
- case MD_VERIFY:
- case MD_TEST:
- case MD_PRINT:
- case MD_HOSTSTAT:
- case MD_PURGESTAT:
- case MD_ARPAFTP:
- OpMode = j;
- break;
-
- case MD_FREEZE:
- usrerr("Frozen configurations unsupported");
- ExitStat = EX_USAGE;
- break;
-
- default:
- usrerr("Invalid operation mode %c", j);
- ExitStat = EX_USAGE;
- break;
- }
- break;
-
- case 'B': /* body type */
- CurEnv->e_bodytype = optarg;
- break;
-
- case 'C': /* select configuration file (already done) */
- if (RealUid != 0)
- warn_C_flag = TRUE;
- ConfFile = optarg;
- (void) drop_privileges(TRUE);
- safecf = FALSE;
- break;
-
- case 'd': /* debugging -- already done */
- break;
-
- case 'f': /* from address */
- case 'r': /* obsolete -f flag */
- if (from != NULL)
- {
- usrerr("More than one \"from\" person");
- ExitStat = EX_USAGE;
- break;
- }
- from = newstr(denlstring(optarg, TRUE, TRUE));
- if (strcmp(RealUserName, from) != 0)
- warn_f_flag = j;
- break;
-
- case 'F': /* set full name */
- FullName = newstr(optarg);
- break;
-
- case 'h': /* hop count */
- CurEnv->e_hopcount = strtol(optarg, &ep, 10);
- if (*ep)
- {
- usrerr("Bad hop count (%s)", optarg);
- ExitStat = EX_USAGE;
- }
- break;
-
- case 'n': /* don't alias */
- NoAlias = TRUE;
- break;
-
- case 'N': /* delivery status notifications */
- DefaultNotify |= QHASNOTIFY;
- if (strcasecmp(optarg, "never") == 0)
- break;
- for (p = optarg; p != NULL; optarg = p)
- {
- p = strchr(p, ',');
- if (p != NULL)
- *p++ = '\0';
- if (strcasecmp(optarg, "success") == 0)
- DefaultNotify |= QPINGONSUCCESS;
- else if (strcasecmp(optarg, "failure") == 0)
- DefaultNotify |= QPINGONFAILURE;
- else if (strcasecmp(optarg, "delay") == 0)
- DefaultNotify |= QPINGONDELAY;
- else
- {
- usrerr("Invalid -N argument");
- ExitStat = EX_USAGE;
- }
- }
- break;
-
- case 'o': /* set option */
- setoption(*optarg, optarg + 1, FALSE, TRUE, CurEnv);
- break;
-
- case 'O': /* set option (long form) */
- setoption(' ', optarg, FALSE, TRUE, CurEnv);
- break;
-
- case 'p': /* set protocol */
- p = strchr(optarg, ':');
- if (p != NULL)
- {
- *p++ = '\0';
- if (*p != '\0')
- {
- ep = xalloc(strlen(p) + 1);
- cleanstrcpy(ep, p, MAXNAME);
- define('s', ep, CurEnv);
- }
- }
- if (*optarg != '\0')
- {
- ep = xalloc(strlen(optarg) + 1);
- cleanstrcpy(ep, optarg, MAXNAME);
- define('r', ep, CurEnv);
- }
- break;
-
- case 'q': /* run queue files at intervals */
-# if QUEUE
- FullName = NULL;
- queuemode = TRUE;
- switch (optarg[0])
- {
- case 'I':
- if ((new = (QUEUE_CHAR *)malloc(sizeof(QUEUE_CHAR))) == NULL)
- syserr("!Out of memory!!");
- new->queue_match = newstr(&optarg[1]);
- new->queue_next = QueueLimitId;
- QueueLimitId = new;
- break;
-
- case 'R':
- if ((new = (QUEUE_CHAR *)malloc(sizeof(QUEUE_CHAR))) == NULL)
- syserr("!Out of memory!!");
- new->queue_match = newstr(&optarg[1]);
- new->queue_next = QueueLimitRecipient;
- QueueLimitRecipient = new;
- break;
-
- case 'S':
- if ((new = (QUEUE_CHAR *)malloc(sizeof(QUEUE_CHAR))) == NULL)
- syserr("!Out of memory!!");
- new->queue_match = newstr(&optarg[1]);
- new->queue_next = QueueLimitSender;
- QueueLimitSender = new;
- break;
-
- default:
- QueueIntvl = convtime(optarg, 'm');
- break;
- }
-# else /* QUEUE */
- usrerr("I don't know about queues");
- ExitStat = EX_USAGE;
-# endif /* QUEUE */
- break;
-
- case 'R': /* DSN RET: what to return */
- if (bitset(EF_RET_PARAM, CurEnv->e_flags))
- {
- usrerr("Duplicate -R flag");
- ExitStat = EX_USAGE;
- break;
- }
- CurEnv->e_flags |= EF_RET_PARAM;
- if (strcasecmp(optarg, "hdrs") == 0)
- CurEnv->e_flags |= EF_NO_BODY_RETN;
- else if (strcasecmp(optarg, "full") != 0)
- {
- usrerr("Invalid -R value");
- ExitStat = EX_USAGE;
- }
- break;
-
- case 't': /* read recipients from message */
- GrabTo = TRUE;
- break;
-
- case 'U': /* initial (user) submission */
- UserSubmission = TRUE;
- break;
-
- case 'V': /* DSN ENVID: set "original" envelope id */
- if (!xtextok(optarg))
- {
- usrerr("Invalid syntax in -V flag");
- ExitStat = EX_USAGE;
- }
- else
- CurEnv->e_envid = newstr(optarg);
- break;
-
- case 'X': /* traffic log file */
- (void) drop_privileges(TRUE);
- TrafficLogFile = fopen(optarg, "a");
- if (TrafficLogFile == NULL)
- {
- syserr("cannot open %s", optarg);
- ExitStat = EX_CANTCREAT;
- break;
- }
-#ifdef HASSETVBUF
- setvbuf(TrafficLogFile, NULL, _IOLBF, 0);
-#else
- setlinebuf(TrafficLogFile);
-#endif
- break;
-
- /* compatibility flags */
- case 'c': /* connect to non-local mailers */
- case 'i': /* don't let dot stop me */
- case 'm': /* send to me too */
- case 'T': /* set timeout interval */
- case 'v': /* give blow-by-blow description */
- setoption(j, "T", FALSE, TRUE, CurEnv);
- break;
-
- case 'e': /* error message disposition */
- case 'M': /* define macro */
- setoption(j, optarg, FALSE, TRUE, CurEnv);
- break;
-
- case 's': /* save From lines in headers */
- setoption('f', "T", FALSE, TRUE, CurEnv);
- break;
-
-# ifdef DBM
- case 'I': /* initialize alias DBM file */
- OpMode = MD_INITALIAS;
- break;
-# endif /* DBM */
-
-# if defined(__osf__) || defined(_AIX3)
- case 'x': /* random flag that OSF/1 & AIX mailx passes */
- break;
-# endif
-# if defined(sony_news)
- case 'E':
- case 'J': /* ignore flags for Japanese code conversion
- impremented on Sony NEWS */
- break;
-# endif
-
- default:
- finis(TRUE, EX_USAGE);
- break;
- }
- }
- av += optind;
-
- /*
- ** Do basic initialization.
- ** Read system control file.
- ** Extract special fields for local use.
- */
-
- /* set up ${opMode} for use in config file */
- {
- char mbuf[2];
-
- mbuf[0] = OpMode;
- mbuf[1] = '\0';
- define(MID_OPMODE, newstr(mbuf), CurEnv);
- }
-
-#if XDEBUG
- checkfd012("before readcf");
-#endif
- vendor_pre_defaults(CurEnv);
- readcf(getcfname(), safecf, CurEnv);
- ConfigFileRead = TRUE;
- vendor_post_defaults(CurEnv);
-
- /* Enforce use of local time (null string overrides this) */
- if (TimeZoneSpec == NULL)
- unsetenv("TZ");
- else if (TimeZoneSpec[0] != '\0')
- setuserenv("TZ", TimeZoneSpec);
- else
- setuserenv("TZ", NULL);
- tzset();
-
- /* avoid denial-of-service attacks */
- resetlimits();
-
- if (OpMode != MD_DAEMON && OpMode != MD_FGDAEMON)
- {
- /* drop privileges -- daemon mode done after socket/bind */
- (void) drop_privileges(FALSE);
- }
-
- /*
- ** Find our real host name for future logging.
- */
-
- p = getauthinfo(STDIN_FILENO, &forged);
- define('_', p, CurEnv);
-
- /* suppress error printing if errors mailed back or whatever */
- if (CurEnv->e_errormode != EM_PRINT)
- HoldErrs = TRUE;
-
- /* set up the $=m class now, after .cf has a chance to redefine $m */
- expand("\201m", jbuf, sizeof jbuf, CurEnv);
- setclass('m', jbuf);
-
- /* probe interfaces and locate any additional names */
- if (!DontProbeInterfaces)
- load_if_names();
-
- if (tTd(0, 1))
- {
- printf("\n============ SYSTEM IDENTITY (after readcf) ============");
- printf("\n (short domain name) $w = ");
- xputs(macvalue('w', CurEnv));
- printf("\n (canonical domain name) $j = ");
- xputs(macvalue('j', CurEnv));
- printf("\n (subdomain name) $m = ");
- xputs(macvalue('m', CurEnv));
- printf("\n (node name) $k = ");
- xputs(macvalue('k', CurEnv));
- printf("\n========================================================\n\n");
- }
-
- /*
- ** Do more command line checking -- these are things that
- ** have to modify the results of reading the config file.
- */
-
- /* process authorization warnings from command line */
- if (warn_C_flag)
- auth_warning(CurEnv, "Processed by %s with -C %s",
- RealUserName, ConfFile);
- if (Warn_Q_option)
- auth_warning(CurEnv, "Processed from queue %s", QueueDir);
-
- /* check body type for legality */
- if (CurEnv->e_bodytype == NULL)
- /* nothing */ ;
- else if (strcasecmp(CurEnv->e_bodytype, "7BIT") == 0)
- SevenBitInput = TRUE;
- else if (strcasecmp(CurEnv->e_bodytype, "8BITMIME") == 0)
- SevenBitInput = FALSE;
- else
- {
- usrerr("Illegal body type %s", CurEnv->e_bodytype);
- CurEnv->e_bodytype = NULL;
- }
-
- /* tweak default DSN notifications */
- if (DefaultNotify == 0)
- DefaultNotify = QPINGONFAILURE|QPINGONDELAY;
-
- /* be sure we don't pick up bogus HOSTALIASES environment variable */
- if (queuemode && RealUid != 0)
- (void) unsetenv("HOSTALIASES");
-
- /* check for sane configuration level */
- if (ConfigLevel > MAXCONFIGLEVEL)
- {
- syserr("Warning: .cf version level (%d) exceeds sendmail version %s functionality (%d)",
- ConfigLevel, Version, MAXCONFIGLEVEL);
- }
-
- /* need MCI cache to have persistence */
- if (HostStatDir != NULL && MaxMciCache == 0)
- {
- HostStatDir = NULL;
- printf("Warning: HostStatusDirectory disabled with ConnectionCacheSize = 0\n");
- }
-
- /* need HostStatusDir in order to have SingleThreadDelivery */
- if (SingleThreadDelivery && HostStatDir == NULL)
- {
- SingleThreadDelivery = FALSE;
- printf("Warning: HostStatusDirectory required for SingleThreadDelivery\n");
- }
-
- /* check for permissions */
- if ((OpMode == MD_DAEMON ||
- OpMode == MD_FGDAEMON ||
- OpMode == MD_PURGESTAT) &&
- RealUid != 0 &&
- RealUid != TrustedUid)
- {
- if (LogLevel > 1)
- sm_syslog(LOG_ALERT, NOQID,
- "user %d attempted to %s",
- RealUid,
- OpMode != MD_PURGESTAT ? "run daemon"
- : "purge host status");
- usrerr("Permission denied");
- finis(FALSE, EX_USAGE);
- }
- if (OpMode == MD_INITALIAS &&
- RealUid != 0 &&
- RealUid != TrustedUid &&
- !wordinclass(RealUserName, 't'))
- {
- if (LogLevel > 1)
- sm_syslog(LOG_ALERT, NOQID,
- "user %d attempted to rebuild the alias map",
- RealUid);
- usrerr("Permission denied");
- finis(FALSE, EX_USAGE);
- }
-
- if (MeToo)
- BlankEnvelope.e_flags |= EF_METOO;
-
- switch (OpMode)
- {
- case MD_TEST:
- /* don't have persistent host status in test mode */
- HostStatDir = NULL;
- if (Verbose == 0)
- Verbose = 2;
- CurEnv->e_errormode = EM_PRINT;
- HoldErrs = FALSE;
- break;
-
- case MD_VERIFY:
- CurEnv->e_errormode = EM_PRINT;
- HoldErrs = FALSE;
- /* arrange to exit cleanly on hangup signal */
- if (setsignal(SIGHUP, SIG_IGN) == (sigfunc_t) SIG_DFL)
- setsignal(SIGHUP, intsig);
- break;
-
- case MD_FGDAEMON:
- run_in_foreground = TRUE;
- OpMode = MD_DAEMON;
- /* fall through ... */
-
- case MD_DAEMON:
- vendor_daemon_setup(CurEnv);
-
- /* remove things that don't make sense in daemon mode */
- FullName = NULL;
- GrabTo = FALSE;
-
- /* arrange to restart on hangup signal */
- if (SaveArgv[0] == NULL || SaveArgv[0][0] != '/')
- sm_syslog(LOG_WARNING, NOQID,
- "daemon invoked without full pathname; kill -1 won't work");
- setsignal(SIGHUP, sighup);
-
- /* workaround: can't seem to release the signal in the parent */
- releasesignal(SIGHUP);
- break;
-
- case MD_INITALIAS:
- Verbose = 2;
- CurEnv->e_errormode = EM_PRINT;
- HoldErrs = FALSE;
- /* fall through... */
-
- case MD_PRINT:
- /* to handle sendmail -bp -qSfoobar properly */
- queuemode = FALSE;
- /* fall through... */
-
- default:
- /* arrange to exit cleanly on hangup signal */
- if (setsignal(SIGHUP, SIG_IGN) == (sigfunc_t) SIG_DFL)
- setsignal(SIGHUP, intsig);
- break;
- }
-
- /* special considerations for FullName */
- if (FullName != NULL)
- {
- char *full = NULL;
- extern bool rfc822_string __P((char *));
-
- /* full names can't have newlines */
- if (strchr(FullName, '\n') != NULL)
- {
- FullName = full = newstr(denlstring(FullName, TRUE, TRUE));
- }
- /* check for characters that may have to be quoted */
- if (!rfc822_string(FullName))
- {
- extern char *addquotes __P((char *));
-
- /*
- ** Quote a full name with special characters
- ** as a comment so crackaddr() doesn't destroy
- ** the name portion of the address.
- */
- FullName = addquotes(FullName);
- if (full != NULL)
- free(full);
- }
- }
-
- /* do heuristic mode adjustment */
- if (Verbose)
- {
- /* turn off noconnect option */
- setoption('c', "F", TRUE, FALSE, CurEnv);
-
- /* turn on interactive delivery */
- setoption('d', "", TRUE, FALSE, CurEnv);
- }
-
-#ifdef VENDOR_CODE
- /* check for vendor mismatch */
- if (VendorCode != VENDOR_CODE)
- {
- extern char *getvendor __P((int));
-
- message("Warning: .cf file vendor code mismatch: sendmail expects vendor %s, .cf file vendor is %s",
- getvendor(VENDOR_CODE), getvendor(VendorCode));
- }
-#endif
-
- /* check for out of date configuration level */
- if (ConfigLevel < MAXCONFIGLEVEL)
- {
- message("Warning: .cf file is out of date: sendmail %s supports version %d, .cf file is version %d",
- Version, MAXCONFIGLEVEL, ConfigLevel);
- }
-
- if (ConfigLevel < 3)
- {
- UseErrorsTo = TRUE;
- }
-
- /* set options that were previous macros */
- if (SmtpGreeting == NULL)
- {
- if (ConfigLevel < 7 && (p = macvalue('e', CurEnv)) != NULL)
- SmtpGreeting = newstr(p);
- else
- SmtpGreeting = "\201j Sendmail \201v ready at \201b";
- }
- if (UnixFromLine == NULL)
- {
- if (ConfigLevel < 7 && (p = macvalue('l', CurEnv)) != NULL)
- UnixFromLine = newstr(p);
- else
- UnixFromLine = "From \201g \201d";
- }
-
- /* our name for SMTP codes */
- expand("\201j", jbuf, sizeof jbuf, CurEnv);
- MyHostName = jbuf;
- if (strchr(jbuf, '.') == NULL)
- message("WARNING: local host name (%s) is not qualified; fix $j in config file",
- jbuf);
-
- /* make certain that this name is part of the $=w class */
- setclass('w', MyHostName);
-
- /* the indices of built-in mailers */
- st = stab("local", ST_MAILER, ST_FIND);
- if (st != NULL)
- LocalMailer = st->s_mailer;
- else if (OpMode != MD_TEST || !warn_C_flag)
- syserr("No local mailer defined");
-
- st = stab("prog", ST_MAILER, ST_FIND);
- if (st == NULL)
- syserr("No prog mailer defined");
- else
- {
- ProgMailer = st->s_mailer;
- clrbitn(M_MUSER, ProgMailer->m_flags);
- }
-
- st = stab("*file*", ST_MAILER, ST_FIND);
- if (st == NULL)
- syserr("No *file* mailer defined");
- else
- {
- FileMailer = st->s_mailer;
- clrbitn(M_MUSER, FileMailer->m_flags);
- }
-
- st = stab("*include*", ST_MAILER, ST_FIND);
- if (st == NULL)
- syserr("No *include* mailer defined");
- else
- InclMailer = st->s_mailer;
-
- if (ConfigLevel < 6)
- {
- /* heuristic tweaking of local mailer for back compat */
- if (LocalMailer != NULL)
- {
- setbitn(M_ALIASABLE, LocalMailer->m_flags);
- setbitn(M_HASPWENT, LocalMailer->m_flags);
- setbitn(M_TRYRULESET5, LocalMailer->m_flags);
- setbitn(M_CHECKINCLUDE, LocalMailer->m_flags);
- setbitn(M_CHECKPROG, LocalMailer->m_flags);
- setbitn(M_CHECKFILE, LocalMailer->m_flags);
- setbitn(M_CHECKUDB, LocalMailer->m_flags);
- }
- if (ProgMailer != NULL)
- setbitn(M_RUNASRCPT, ProgMailer->m_flags);
- if (FileMailer != NULL)
- setbitn(M_RUNASRCPT, FileMailer->m_flags);
- }
- if (ConfigLevel < 7)
- {
- if (LocalMailer != NULL)
- setbitn(M_VRFY250, LocalMailer->m_flags);
- if (ProgMailer != NULL)
- setbitn(M_VRFY250, ProgMailer->m_flags);
- if (FileMailer != NULL)
- setbitn(M_VRFY250, FileMailer->m_flags);
- }
-
- /* MIME Content-Types that cannot be transfer encoded */
- setclass('n', "multipart/signed");
-
- /* MIME message/xxx subtypes that can be treated as messages */
- setclass('s', "rfc822");
-
- /* MIME Content-Transfer-Encodings that can be encoded */
- setclass('e', "7bit");
- setclass('e', "8bit");
- setclass('e', "binary");
-
-#ifdef USE_B_CLASS
- /* MIME Content-Types that should be treated as binary */
- setclass('b', "image");
- setclass('b', "audio");
- setclass('b', "video");
- setclass('b', "application/octet-stream");
-#endif
-
-#if _FFR_MAX_MIME_HEADER_LENGTH
- /* MIME headers which have fields to check for overflow */
- setclass(macid("{checkMIMEFieldHeaders}", NULL), "content-disposition");
- setclass(macid("{checkMIMEFieldHeaders}", NULL), "content-type");
-
- /* MIME headers to check for length overflow */
- setclass(macid("{checkMIMETextHeaders}", NULL), "content-description");
-
- /* MIME headers to check for overflow and rebalance */
- setclass(macid("{checkMIMEHeaders}", NULL), "content-disposition");
- setclass(macid("{checkMIMEHeaders}", NULL), "content-id");
- setclass(macid("{checkMIMEHeaders}", NULL), "content-transfer-encoding");
- setclass(macid("{checkMIMEHeaders}", NULL), "content-type");
- setclass(macid("{checkMIMEHeaders}", NULL), "mime-version");
-#endif
-
- /* operate in queue directory */
- if (QueueDir == NULL)
- {
- if (OpMode != MD_TEST)
- {
- syserr("QueueDirectory (Q) option must be set");
- ExitStat = EX_CONFIG;
- }
- }
- else
- {
- /* test path to get warning messages */
- (void) safedirpath(QueueDir, (uid_t) 0, (gid_t) 0, NULL, SFF_ANYFILE);
- if (OpMode != MD_TEST && chdir(QueueDir) < 0)
- {
- syserr("cannot chdir(%s)", QueueDir);
- ExitStat = EX_CONFIG;
- }
- }
-
- /* check host status directory for validity */
- if (HostStatDir != NULL && !path_is_dir(HostStatDir, FALSE))
- {
- /* cannot use this value */
- if (tTd(0, 2))
- printf("Cannot use HostStatusDirectory = %s: %s\n",
- HostStatDir, errstring(errno));
- HostStatDir = NULL;
- }
-
-# if QUEUE
- if (queuemode && RealUid != 0 && bitset(PRIV_RESTRICTQRUN, PrivacyFlags))
- {
- struct stat stbuf;
-
- /* check to see if we own the queue directory */
- if (stat(".", &stbuf) < 0)
- syserr("main: cannot stat %s", QueueDir);
- if (stbuf.st_uid != RealUid)
- {
- /* nope, really a botch */
- usrerr("You do not have permission to process the queue");
- finis(FALSE, EX_NOPERM);
- }
- }
-# endif /* QUEUE */
-
- /* if we've had errors so far, exit now */
- if (ExitStat != EX_OK && OpMode != MD_TEST)
- finis(FALSE, ExitStat);
-
-#if XDEBUG
- checkfd012("before main() initmaps");
-#endif
-
- /*
- ** Do operation-mode-dependent initialization.
- */
-
- switch (OpMode)
- {
- case MD_PRINT:
- /* print the queue */
-#if QUEUE
- dropenvelope(CurEnv, TRUE);
- signal(SIGPIPE, quiesce);
- printqueue();
- finis(FALSE, EX_OK);
-#else /* QUEUE */
- usrerr("No queue to print");
- finis(FALSE, ExitStat);
-#endif /* QUEUE */
- break;
-
- case MD_HOSTSTAT:
- signal(SIGPIPE, quiesce);
- mci_traverse_persistent(mci_print_persistent, NULL);
- finis(FALSE, EX_OK);
- break;
-
- case MD_PURGESTAT:
- mci_traverse_persistent(mci_purge_persistent, NULL);
- finis(FALSE, EX_OK);
- break;
-
- case MD_INITALIAS:
- /* initialize maps */
- initmaps(TRUE, CurEnv);
- finis(FALSE, ExitStat);
- break;
-
- case MD_SMTP:
- case MD_DAEMON:
- /* reset DSN parameters */
- DefaultNotify = QPINGONFAILURE|QPINGONDELAY;
- CurEnv->e_envid = NULL;
- CurEnv->e_flags &= ~(EF_RET_PARAM|EF_NO_BODY_RETN);
-
- /* don't open maps for daemon -- done below in child */
- break;
-
- default:
- /* open the maps */
- initmaps(FALSE, CurEnv);
- break;
- }
-
- if (tTd(0, 15))
- {
- extern void printrules __P((void));
-
- /* print configuration table (or at least part of it) */
- if (tTd(0, 90))
- printrules();
- for (i = 0; i < MAXMAILERS; i++)
- {
- if (Mailer[i] != NULL)
- printmailer(Mailer[i]);
- }
- }
-
- /*
- ** Switch to the main envelope.
- */
-
- CurEnv = newenvelope(&MainEnvelope, CurEnv);
- MainEnvelope.e_flags = BlankEnvelope.e_flags;
-
- /*
- ** If test mode, read addresses from stdin and process.
- */
-
- if (OpMode == MD_TEST)
- {
- char buf[MAXLINE];
- SIGFUNC_DECL intindebug __P((int));
-
- if (isatty(fileno(stdin)))
- Verbose = 2;
-
- if (Verbose)
- {
- printf("ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)\n");
- printf("Enter <ruleset> <address>\n");
- }
- if (setjmp(TopFrame) > 0)
- printf("\n");
- (void) setsignal(SIGINT, intindebug);
- for (;;)
- {
- extern void testmodeline __P((char *, ENVELOPE *));
-
- if (Verbose == 2)
- printf("> ");
- (void) fflush(stdout);
- if (fgets(buf, sizeof buf, stdin) == NULL)
- finis(TRUE, ExitStat);
- p = strchr(buf, '\n');
- if (p != NULL)
- *p = '\0';
- if (Verbose < 2)
- printf("> %s\n", buf);
- testmodeline(buf, CurEnv);
- }
- }
-
-# if QUEUE
- /*
- ** If collecting stuff from the queue, go start doing that.
- */
-
- if (queuemode && OpMode != MD_DAEMON && QueueIntvl == 0)
- {
- (void) runqueue(FALSE, Verbose);
- finis(TRUE, ExitStat);
- }
-# endif /* QUEUE */
-
- /*
- ** If a daemon, wait for a request.
- ** getrequests will always return in a child.
- ** If we should also be processing the queue, start
- ** doing it in background.
- ** We check for any errors that might have happened
- ** during startup.
- */
-
- if (OpMode == MD_DAEMON || QueueIntvl != 0)
- {
- char dtype[200];
- extern void getrequests __P((ENVELOPE *));
-
- if (!run_in_foreground && !tTd(99, 100))
- {
- /* put us in background */
- i = fork();
- if (i < 0)
- syserr("daemon: cannot fork");
- if (i != 0)
- finis(FALSE, EX_OK);
-
- /* disconnect from our controlling tty */
- disconnect(2, CurEnv);
- }
-
- dtype[0] = '\0';
- if (OpMode == MD_DAEMON)
- strcat(dtype, "+SMTP");
- if (QueueIntvl != 0)
- {
- strcat(dtype, "+queueing@");
- strcat(dtype, pintvl(QueueIntvl, TRUE));
- }
- if (tTd(0, 1))
- strcat(dtype, "+debugging");
-
- sm_syslog(LOG_INFO, NOQID,
- "starting daemon (%s): %s", Version, dtype + 1);
-#ifdef XLA
- xla_create_file();
-#endif
-
-# if QUEUE
- if (queuemode)
- {
- (void) runqueue(TRUE, FALSE);
- if (OpMode != MD_DAEMON)
- {
- for (;;)
- {
- pause();
- if (DoQueueRun)
- (void) runqueue(TRUE, FALSE);
- }
- }
- }
-# endif /* QUEUE */
- dropenvelope(CurEnv, TRUE);
-
-#if DAEMON
- getrequests(CurEnv);
-
- /* drop privileges */
- (void) drop_privileges(FALSE);
-
- /* at this point we are in a child: reset state */
- (void) newenvelope(CurEnv, CurEnv);
-
- /*
- ** Get authentication data
- */
-
- p = getauthinfo(fileno(InChannel), &forged);
- define('_', p, &BlankEnvelope);
-#endif /* DAEMON */
- }
-
-# if SMTP
- /*
- ** If running SMTP protocol, start collecting and executing
- ** commands. This will never return.
- */
-
- if (OpMode == MD_SMTP || OpMode == MD_DAEMON)
- {
- char pbuf[20];
- extern void smtp __P((char *, ENVELOPE *));
-
- /*
- ** Save some macros for check_* rulesets.
- */
-
- if (forged)
- {
- char ipbuf[103];
-
- snprintf(ipbuf, sizeof ipbuf, "[%.100s]",
- inet_ntoa(RealHostAddr.sin.sin_addr));
-
- define(macid("{client_name}", NULL),
- newstr(ipbuf), &BlankEnvelope);
- }
- else
- define(macid("{client_name}", NULL), RealHostName, &BlankEnvelope);
- define(macid("{client_addr}", NULL),
- newstr(anynet_ntoa(&RealHostAddr)), &BlankEnvelope);
- if (RealHostAddr.sa.sa_family == AF_INET)
- snprintf(pbuf, sizeof pbuf, "%d", RealHostAddr.sin.sin_port);
- else
- snprintf(pbuf, sizeof pbuf, "0");
- define(macid("{client_port}", NULL), newstr(pbuf), &BlankEnvelope);
-
- /* initialize maps now for check_relay ruleset */
- initmaps(FALSE, CurEnv);
-
- if (OpMode == MD_DAEMON)
- {
- /* validate the connection */
- HoldErrs = TRUE;
- nullserver = validate_connection(&RealHostAddr,
- RealHostName, CurEnv);
- HoldErrs = FALSE;
- }
- smtp(nullserver, CurEnv);
- }
-# endif /* SMTP */
-
- clearenvelope(CurEnv, FALSE);
- if (OpMode == MD_VERIFY)
- {
- CurEnv->e_sendmode = SM_VERIFY;
- PostMasterCopy = NULL;
- }
- else
- {
- /* interactive -- all errors are global */
- CurEnv->e_flags |= EF_GLOBALERRS|EF_LOGSENDER;
- }
-
- /*
- ** Do basic system initialization and set the sender
- */
-
- initsys(CurEnv);
- if (warn_f_flag != '\0' && !wordinclass(RealUserName, 't'))
- auth_warning(CurEnv, "%s set sender to %s using -%c",
- RealUserName, from, warn_f_flag);
- setsender(from, CurEnv, NULL, '\0', FALSE);
- if (macvalue('s', CurEnv) == NULL)
- define('s', RealHostName, CurEnv);
-
- if (*av == NULL && !GrabTo)
- {
- CurEnv->e_flags |= EF_GLOBALERRS;
- usrerr("Recipient names must be specified");
-
- /* collect body for UUCP return */
- if (OpMode != MD_VERIFY)
- collect(InChannel, FALSE, NULL, CurEnv);
- finis(TRUE, ExitStat);
- }
-
- /*
- ** Scan argv and deliver the message to everyone.
- */
-
- sendtoargv(av, CurEnv);
-
- /* if we have had errors sofar, arrange a meaningful exit stat */
- if (Errors > 0 && ExitStat == EX_OK)
- ExitStat = EX_USAGE;
-
-#if _FFR_FIX_DASHT
- /*
- ** If using -t, force not sending to argv recipients, even
- ** if they are mentioned in the headers.
- */
-
- if (GrabTo)
- {
- ADDRESS *q;
-
- for (q = CurEnv->e_sendqueue; q != NULL; q = q->q_next)
- q->q_flags |= QDONTSEND;
- }
-#endif
-
- /*
- ** Read the input mail.
- */
-
- CurEnv->e_to = NULL;
- if (OpMode != MD_VERIFY || GrabTo)
- {
- long savedflags = CurEnv->e_flags & EF_FATALERRS;
-
- CurEnv->e_flags |= EF_GLOBALERRS;
- CurEnv->e_flags &= ~EF_FATALERRS;
- collect(InChannel, FALSE, NULL, CurEnv);
-
- /* bail out if message too large */
- if (bitset(EF_CLRQUEUE, CurEnv->e_flags))
- {
- finis(TRUE, ExitStat);
- /*NOTREACHED*/
- return -1;
- }
- CurEnv->e_flags |= savedflags;
- }
- errno = 0;
-
- if (tTd(1, 1))
- printf("From person = \"%s\"\n", CurEnv->e_from.q_paddr);
-
- /*
- ** Actually send everything.
- ** If verifying, just ack.
- */
-
- CurEnv->e_from.q_flags |= QDONTSEND;
- if (tTd(1, 5))
- {
- printf("main: QDONTSEND ");
- printaddr(&CurEnv->e_from, FALSE);
- }
- CurEnv->e_to = NULL;
- CurrentLA = getla();
- GrabTo = FALSE;
- sendall(CurEnv, SM_DEFAULT);
-
- /*
- ** All done.
- ** Don't send return error message if in VERIFY mode.
- */
-
- finis(TRUE, ExitStat);
- /*NOTREACHED*/
- return -1;
-}
-
-/* ARGSUSED */
-SIGFUNC_DECL
-quiesce(sig)
- int sig;
-{
- finis(FALSE, EX_OK);
-}
-
-/* ARGSUSED */
-SIGFUNC_DECL
-intindebug(sig)
- int sig;
-{
- longjmp(TopFrame, 1);
- return SIGFUNC_RETURN;
-}
-
-
-\f/*
-** FINIS -- Clean up and exit.
-**
-** Parameters:
-** drop -- whether or not to drop CurEnv envelope
-** exitstat -- exit status to use for exit() call
-**
-** Returns:
-** never
-**
-** Side Effects:
-** exits sendmail
-*/
-
-void
-finis(drop, exitstat)
- bool drop;
- volatile int exitstat;
-{
- extern void closemaps __P((void));
-#ifdef USERDB
- extern void _udbx_close __P((void));
-#endif
-
- if (tTd(2, 1))
- {
- extern void printenvflags __P((ENVELOPE *));
-
- printf("\n====finis: stat %d e_id=%s e_flags=",
- exitstat,
- CurEnv->e_id == NULL ? "NOQUEUE" : CurEnv->e_id);
- printenvflags(CurEnv);
- }
- if (tTd(2, 9))
- printopenfds(FALSE);
-
- /* if we fail in finis(), just exit */
- if (setjmp(TopFrame) != 0)
- {
- /* failed -- just give it up */
- goto forceexit;
- }
-
- /* clean up temp files */
- CurEnv->e_to = NULL;
- if (drop && CurEnv->e_id != NULL)
- dropenvelope(CurEnv, TRUE);
-
- /* flush any cached connections */
- mci_flush(TRUE, NULL);
-
- /* close maps belonging to this pid */
- closemaps();
-
-#ifdef USERDB
- /* close UserDatabase */
- _udbx_close();
-#endif
-
-# ifdef XLA
- /* clean up extended load average stuff */
- xla_all_end();
-# endif
-
- /* and exit */
- forceexit:
- if (LogLevel > 78)
- sm_syslog(LOG_DEBUG, CurEnv->e_id,
- "finis, pid=%d",
- getpid());
- if (exitstat == EX_TEMPFAIL || CurEnv->e_errormode == EM_BERKNET)
- exitstat = EX_OK;
-
- /* reset uid for process accounting */
- endpwent();
- setuid(RealUid);
-
- exit(exitstat);
-}
-\f/*
-** INTSIG -- clean up on interrupt
-**
-** This just arranges to exit. It pessimises in that it
-** may resend a message.
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Unlocks the current job.
-*/
-
-/* ARGSUSED */
-SIGFUNC_DECL
-intsig(sig)
- int sig;
-{
- if (LogLevel > 79)
- sm_syslog(LOG_DEBUG, CurEnv->e_id, "interrupt");
- FileName = NULL;
- unlockqueue(CurEnv);
- closecontrolsocket(TRUE);
-#ifdef XLA
- xla_all_end();
-#endif
- finis(FALSE, EX_OK);
-}
-\f/*
-** INITMACROS -- initialize the macro system
-**
-** This just involves defining some macros that are actually
-** used internally as metasymbols to be themselves.
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** initializes several macros to be themselves.
-*/
-
-struct metamac MetaMacros[] =
-{
- /* LHS pattern matching characters */
- { '*', MATCHZANY }, { '+', MATCHANY }, { '-', MATCHONE },
- { '=', MATCHCLASS }, { '~', MATCHNCLASS },
-
- /* these are RHS metasymbols */
- { '#', CANONNET }, { '@', CANONHOST }, { ':', CANONUSER },
- { '>', CALLSUBR },
-
- /* the conditional operations */
- { '?', CONDIF }, { '|', CONDELSE }, { '.', CONDFI },
-
- /* the hostname lookup characters */
- { '[', HOSTBEGIN }, { ']', HOSTEND },
- { '(', LOOKUPBEGIN }, { ')', LOOKUPEND },
-
- /* miscellaneous control characters */
- { '&', MACRODEXPAND },
-
- { '\0' }
-};
-
-#define MACBINDING(name, mid) \
- stab(name, ST_MACRO, ST_ENTER)->s_macro = mid; \
- MacroName[mid] = name;
-
-void
-initmacros(e)
- register ENVELOPE *e;
-{
- register struct metamac *m;
- register int c;
- char buf[5];
- extern char *MacroName[256];
-
- for (m = MetaMacros; m->metaname != '\0'; m++)
- {
- buf[0] = m->metaval;
- buf[1] = '\0';
- define(m->metaname, newstr(buf), e);
- }
- buf[0] = MATCHREPL;
- buf[2] = '\0';
- for (c = '0'; c <= '9'; c++)
- {
- buf[1] = c;
- define(c, newstr(buf), e);
- }
-
- /* set defaults for some macros sendmail will use later */
- define('n', "MAILER-DAEMON", e);
-
- /* set up external names for some internal macros */
- MACBINDING("opMode", MID_OPMODE);
- /*XXX should probably add equivalents for all short macros here XXX*/
-}
-\f/*
-** DISCONNECT -- remove our connection with any foreground process
-**
-** Parameters:
-** droplev -- how "deeply" we should drop the line.
-** 0 -- ignore signals, mail back errors, make sure
-** output goes to stdout.
-** 1 -- also, make stdout go to transcript.
-** 2 -- also, disconnect from controlling terminal
-** (only for daemon mode).
-** e -- the current envelope.
-**
-** Returns:
-** none
-**
-** Side Effects:
-** Trys to insure that we are immune to vagaries of
-** the controlling tty.
-*/
-
-void
-disconnect(droplev, e)
- int droplev;
- register ENVELOPE *e;
-{
- int fd;
-
- if (tTd(52, 1))
- printf("disconnect: In %d Out %d, e=%lx\n",
- fileno(InChannel), fileno(OutChannel), (u_long) e);
- if (tTd(52, 100))
- {
- printf("don't\n");
- return;
- }
- if (LogLevel > 93)
- sm_syslog(LOG_DEBUG, e->e_id,
- "disconnect level %d",
- droplev);
-
- /* be sure we don't get nasty signals */
- (void) setsignal(SIGINT, SIG_IGN);
- (void) setsignal(SIGQUIT, SIG_IGN);
-
- /* we can't communicate with our caller, so.... */
- HoldErrs = TRUE;
- CurEnv->e_errormode = EM_MAIL;
- Verbose = 0;
- DisConnected = TRUE;
-
- /* all input from /dev/null */
- if (InChannel != stdin)
- {
- (void) fclose(InChannel);
- InChannel = stdin;
- }
- if (freopen("/dev/null", "r", stdin) == NULL)
- sm_syslog(LOG_ERR, e->e_id,
- "disconnect: freopen(\"/dev/null\") failed: %s",
- errstring(errno));
-
- /* output to the transcript */
- if (OutChannel != stdout)
- {
- (void) fclose(OutChannel);
- OutChannel = stdout;
- }
- if (droplev > 0)
- {
- if (e->e_xfp == NULL)
- {
- fd = open("/dev/null", O_WRONLY, 0666);
- if (fd == -1)
- sm_syslog(LOG_ERR, e->e_id,
- "disconnect: open(\"/dev/null\") failed: %s",
- errstring(errno));
- }
- else
- {
- fd = fileno(e->e_xfp);
- if (fd == -1)
- sm_syslog(LOG_ERR, e->e_id,
- "disconnect: fileno(e->e_xfp) failed: %s",
- errstring(errno));
- }
- (void) fflush(stdout);
- dup2(fd, STDOUT_FILENO);
- dup2(fd, STDERR_FILENO);
- if (e->e_xfp == NULL)
- close(fd);
- }
-
- /* drop our controlling TTY completely if possible */
- if (droplev > 1)
- {
- (void) setsid();
- errno = 0;
- }
-
-#if XDEBUG
- checkfd012("disconnect");
-#endif
-
- if (LogLevel > 71)
- sm_syslog(LOG_DEBUG, e->e_id,
- "in background, pid=%d",
- getpid());
-
- errno = 0;
-}
-
-static void
-obsolete(argv)
- char *argv[];
-{
- register char *ap;
- register char *op;
-
- while ((ap = *++argv) != NULL)
- {
- /* Return if "--" or not an option of any form. */
- if (ap[0] != '-' || ap[1] == '-')
- return;
-
- /* skip over options that do have a value */
- op = strchr(OPTIONS, ap[1]);
- if (op != NULL && *++op == ':' && ap[2] == '\0' &&
- ap[1] != 'd' &&
-#if defined(sony_news)
- ap[1] != 'E' && ap[1] != 'J' &&
-#endif
- argv[1] != NULL && argv[1][0] != '-')
- {
- argv++;
- continue;
- }
-
- /* If -C doesn't have an argument, use sendmail.cf. */
-#define __DEFPATH "sendmail.cf"
- if (ap[1] == 'C' && ap[2] == '\0')
- {
- *argv = xalloc(sizeof(__DEFPATH) + 2);
- argv[0][0] = '-';
- argv[0][1] = 'C';
- (void)strcpy(&argv[0][2], __DEFPATH);
- }
-
- /* If -q doesn't have an argument, run it once. */
- if (ap[1] == 'q' && ap[2] == '\0')
- *argv = "-q0";
-
- /* if -d doesn't have an argument, use 0-99.1 */
- if (ap[1] == 'd' && ap[2] == '\0')
- *argv = "-d0-99.1";
-
-# if defined(sony_news)
- /* if -E doesn't have an argument, use -EC */
- if (ap[1] == 'E' && ap[2] == '\0')
- *argv = "-EC";
-
- /* if -J doesn't have an argument, use -JJ */
- if (ap[1] == 'J' && ap[2] == '\0')
- *argv = "-JJ";
-# endif
- }
-}
-\f/*
-** AUTH_WARNING -- specify authorization warning
-**
-** Parameters:
-** e -- the current envelope.
-** msg -- the text of the message.
-** args -- arguments to the message.
-**
-** Returns:
-** none.
-*/
-
-void
-#ifdef __STDC__
-auth_warning(register ENVELOPE *e, const char *msg, ...)
-#else
-auth_warning(e, msg, va_alist)
- register ENVELOPE *e;
- const char *msg;
- va_dcl
-#endif
-{
- char buf[MAXLINE];
- VA_LOCAL_DECL
-
- if (bitset(PRIV_AUTHWARNINGS, PrivacyFlags))
- {
- register char *p;
- static char hostbuf[48];
- extern struct hostent *myhostname __P((char *, int));
-
- if (hostbuf[0] == '\0')
- (void) myhostname(hostbuf, sizeof hostbuf);
-
- (void) snprintf(buf, sizeof buf, "%s: ", hostbuf);
- p = &buf[strlen(buf)];
- VA_START(msg);
- vsnprintf(p, SPACELEFT(buf, p), msg, ap);
- VA_END;
- addheader("X-Authentication-Warning", buf, &e->e_header);
- if (LogLevel > 3)
- sm_syslog(LOG_INFO, e->e_id,
- "Authentication-Warning: %.400s",
- buf);
- }
-}
-\f/*
-** GETEXTENV -- get from external environment
-**
-** Parameters:
-** envar -- the name of the variable to retrieve
-**
-** Returns:
-** The value, if any.
-*/
-
-char *
-getextenv(envar)
- const char *envar;
-{
- char **envp;
- int l;
-
- l = strlen(envar);
- for (envp = ExternalEnviron; *envp != NULL; envp++)
- {
- if (strncmp(*envp, envar, l) == 0 && (*envp)[l] == '=')
- return &(*envp)[l + 1];
- }
- return NULL;
-}
-\f/*
-** SETUSERENV -- set an environment in the propogated environment
-**
-** Parameters:
-** envar -- the name of the environment variable.
-** value -- the value to which it should be set. If
-** null, this is extracted from the incoming
-** environment. If that is not set, the call
-** to setuserenv is ignored.
-**
-** Returns:
-** none.
-*/
-
-void
-setuserenv(envar, value)
- const char *envar;
- const char *value;
-{
- int i;
- char **evp = UserEnviron;
- char *p;
-
- if (value == NULL)
- {
- value = getextenv(envar);
- if (value == NULL)
- return;
- }
-
- i = strlen(envar);
- p = (char *) xalloc(strlen(value) + i + 2);
- strcpy(p, envar);
- p[i++] = '=';
- strcpy(&p[i], value);
-
- while (*evp != NULL && strncmp(*evp, p, i) != 0)
- evp++;
- if (*evp != NULL)
- {
- *evp++ = p;
- }
- else if (evp < &UserEnviron[MAXUSERENVIRON])
- {
- *evp++ = p;
- *evp = NULL;
- }
-
- /* make sure it is in our environment as well */
- if (putenv(p) < 0)
- syserr("setuserenv: putenv(%s) failed", p);
-}
-\f/*
-** DUMPSTATE -- dump state
-**
-** For debugging.
-*/
-
-void
-dumpstate(when)
- char *when;
-{
- register char *j = macvalue('j', CurEnv);
- int rs;
-
- sm_syslog(LOG_DEBUG, CurEnv->e_id,
- "--- dumping state on %s: $j = %s ---",
- when,
- j == NULL ? "<NULL>" : j);
- if (j != NULL)
- {
- if (!wordinclass(j, 'w'))
- sm_syslog(LOG_DEBUG, CurEnv->e_id,
- "*** $j not in $=w ***");
- }
- sm_syslog(LOG_DEBUG, CurEnv->e_id, "CurChildren = %d", CurChildren);
- sm_syslog(LOG_DEBUG, CurEnv->e_id, "--- open file descriptors: ---");
- printopenfds(TRUE);
- sm_syslog(LOG_DEBUG, CurEnv->e_id, "--- connection cache: ---");
- mci_dump_all(TRUE);
- rs = strtorwset("debug_dumpstate", NULL, ST_FIND);
- if (rs > 0)
- {
- int stat;
- register char **pvp;
- char *pv[MAXATOM + 1];
-
- pv[0] = NULL;
- stat = rewrite(pv, rs, 0, CurEnv);
- sm_syslog(LOG_DEBUG, CurEnv->e_id,
- "--- ruleset debug_dumpstate returns stat %d, pv: ---",
- stat);
- for (pvp = pv; *pvp != NULL; pvp++)
- sm_syslog(LOG_DEBUG, CurEnv->e_id, "%s", *pvp);
- }
- sm_syslog(LOG_DEBUG, CurEnv->e_id, "--- end of state dump ---");
-}
-
-
-/* ARGSUSED */
-SIGFUNC_DECL
-sigusr1(sig)
- int sig;
-{
- dumpstate("user signal");
- return SIGFUNC_RETURN;
-}
-
-
-/* ARGSUSED */
-SIGFUNC_DECL
-sighup(sig)
- int sig;
-{
- if (SaveArgv[0][0] != '/')
- {
- if (LogLevel > 3)
- sm_syslog(LOG_INFO, NOQID, "could not restart: need full path");
- finis(FALSE, EX_OSFILE);
- }
- if (LogLevel > 3)
- sm_syslog(LOG_INFO, NOQID, "restarting %s on signal", SaveArgv[0]);
- alarm(0);
- releasesignal(SIGHUP);
- closecontrolsocket(TRUE);
- if (drop_privileges(TRUE) != EX_OK)
- {
- if (LogLevel > 0)
- sm_syslog(LOG_ALERT, NOQID, "could not set[ug]id(%d, %d): %m",
- RunAsUid, RunAsGid);
- finis(FALSE, EX_OSERR);
- }
- execve(SaveArgv[0], (ARGV_T) SaveArgv, (ARGV_T) ExternalEnviron);
- if (LogLevel > 0)
- sm_syslog(LOG_ALERT, NOQID, "could not exec %s: %m", SaveArgv[0]);
- finis(FALSE, EX_OSFILE);
-}
-\f/*
-** DROP_PRIVILEGES -- reduce privileges to those of the RunAsUser option
-**
-** Parameters:
-** to_real_uid -- if set, drop to the real uid instead
-** of the RunAsUser.
-**
-** Returns:
-** EX_OSERR if the setuid failed.
-** EX_OK otherwise.
-*/
-
-int
-drop_privileges(to_real_uid)
- bool to_real_uid;
-{
- int rval = EX_OK;
- GIDSET_T emptygidset[1];
-
- if (tTd(47, 1))
- printf("drop_privileges(%d): Real[UG]id=%d:%d, RunAs[UG]id=%d:%d\n",
- (int)to_real_uid, (int)RealUid, (int)RealGid, (int)RunAsUid, (int)RunAsGid);
-
- if (to_real_uid)
- {
- RunAsUserName = RealUserName;
- RunAsUid = RealUid;
- RunAsGid = RealGid;
- }
-
- /* make sure no one can grab open descriptors for secret files */
- endpwent();
-
- /* reset group permissions; these can be set later */
- emptygidset[0] = (to_real_uid || RunAsGid != 0) ? RunAsGid : getegid();
- if (setgroups(1, emptygidset) == -1 && geteuid() == 0)
- rval = EX_OSERR;
-
- /* reset primary group and user id */
- if ((to_real_uid || RunAsGid != 0) && setgid(RunAsGid) < 0)
- rval = EX_OSERR;
- if ((to_real_uid || RunAsUid != 0) && setuid(RunAsUid) < 0)
- rval = EX_OSERR;
- if (tTd(47, 5))
- {
- printf("drop_privileges: e/ruid = %d/%d e/rgid = %d/%d\n",
- (int)geteuid(), (int)getuid(), (int)getegid(), (int)getgid());
- printf("drop_privileges: RunAsUser = %d:%d\n", (int)RunAsUid, (int)RunAsGid);
- }
- return rval;
-}
-\f/*
-** FILL_FD -- make sure a file descriptor has been properly allocated
-**
-** Used to make sure that stdin/out/err are allocated on startup
-**
-** Parameters:
-** fd -- the file descriptor to be filled.
-** where -- a string used for logging. If NULL, this is
-** being called on startup, and logging should
-** not be done.
-**
-** Returns:
-** none
-*/
-
-void
-fill_fd(fd, where)
- int fd;
- char *where;
-{
- int i;
- struct stat stbuf;
-
- if (fstat(fd, &stbuf) >= 0 || errno != EBADF)
- return;
-
- if (where != NULL)
- syserr("fill_fd: %s: fd %d not open", where, fd);
- else
- MissingFds |= 1 << fd;
- i = open("/dev/null", fd == 0 ? O_RDONLY : O_WRONLY, 0666);
- if (i < 0)
- {
- syserr("!fill_fd: %s: cannot open /dev/null",
- where == NULL ? "startup" : where);
- }
- if (fd != i)
- {
- (void) dup2(i, fd);
- (void) close(i);
- }
-}
-\f/*
-** TESTMODELINE -- process a test mode input line
-**
-** Parameters:
-** line -- the input line.
-** e -- the current environment.
-** Syntax:
-** # a comment
-** .X process X as a configuration line
-** =X dump a configuration item (such as mailers)
-** $X dump a macro or class
-** /X try an activity
-** X normal process through rule set X
-*/
-
-void
-testmodeline(line, e)
- char *line;
- ENVELOPE *e;
-{
- register char *p;
- char *q;
- auto char *delimptr;
- int mid;
- int i, rs;
- STAB *map;
- char **s;
- struct rewrite *rw;
- ADDRESS a;
- static int tryflags = RF_COPYNONE;
- char exbuf[MAXLINE];
- extern bool invalidaddr __P((char *, char *));
- extern char *crackaddr __P((char *));
- extern void dump_class __P((STAB *, int));
- extern void translate_dollars __P((char *));
- extern void help __P((char *));
-
- switch (line[0])
- {
- case '#':
- case 0:
- return;
-
- case '?':
- help("-bt");
- return;
-
- case '.': /* config-style settings */
- switch (line[1])
- {
- case 'D':
- mid = macid(&line[2], &delimptr);
- if (mid == '\0')
- return;
- translate_dollars(delimptr);
- define(mid, newstr(delimptr), e);
- break;
-
- case 'C':
- if (line[2] == '\0') /* not to call syserr() */
- return;
-
- mid = macid(&line[2], &delimptr);
- if (mid == '\0')
- return;
- translate_dollars(delimptr);
- expand(delimptr, exbuf, sizeof exbuf, e);
- p = exbuf;
- while (*p != '\0')
- {
- register char *wd;
- char delim;
-
- while (*p != '\0' && isascii(*p) && isspace(*p))
- p++;
- wd = p;
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- delim = *p;
- *p = '\0';
- if (wd[0] != '\0')
- setclass(mid, wd);
- *p = delim;
- }
- break;
-
- case '\0':
- printf("Usage: .[DC]macro value(s)\n");
- break;
-
- default:
- printf("Unknown \".\" command %s\n", line);
- break;
- }
- return;
-
- case '=': /* config-style settings */
- switch (line[1])
- {
- case 'S': /* dump rule set */
- rs = strtorwset(&line[2], NULL, ST_FIND);
- if (rs < 0)
- {
- printf("Undefined ruleset %s\n", &line[2]);
- return;
- }
- rw = RewriteRules[rs];
- if (rw == NULL)
- return;
- do
- {
- putchar('R');
- s = rw->r_lhs;
- while (*s != NULL)
- {
- xputs(*s++);
- putchar(' ');
- }
- putchar('\t');
- putchar('\t');
- s = rw->r_rhs;
- while (*s != NULL)
- {
- xputs(*s++);
- putchar(' ');
- }
- putchar('\n');
- } while ((rw = rw->r_next) != NULL);
- break;
-
- case 'M':
- for (i = 0; i < MAXMAILERS; i++)
- {
- if (Mailer[i] != NULL)
- printmailer(Mailer[i]);
- }
- break;
-
- case '\0':
- printf("Usage: =Sruleset or =M\n");
- break;
-
- default:
- printf("Unknown \"=\" command %s\n", line);
- break;
- }
- return;
-
- case '-': /* set command-line-like opts */
- switch (line[1])
- {
- case 'd':
- tTflag(&line[2]);
- break;
-
- case '\0':
- printf("Usage: -d{debug arguments}\n");
- break;
-
- default:
- printf("Unknown \"-\" command %s\n", line);
- break;
- }
- return;
-
- case '$':
- if (line[1] == '=')
- {
- mid = macid(&line[2], NULL);
- if (mid != '\0')
- stabapply(dump_class, mid);
- return;
- }
- mid = macid(&line[1], NULL);
- if (mid == '\0')
- return;
- p = macvalue(mid, e);
- if (p == NULL)
- printf("Undefined\n");
- else
- {
- xputs(p);
- printf("\n");
- }
- return;
-
- case '/': /* miscellaneous commands */
- p = &line[strlen(line)];
- while (--p >= line && isascii(*p) && isspace(*p))
- *p = '\0';
- p = strpbrk(line, " \t");
- if (p != NULL)
- {
- while (isascii(*p) && isspace(*p))
- *p++ = '\0';
- }
- else
- p = "";
- if (line[1] == '\0')
- {
- printf("Usage: /[canon|map|mx|parse|try|tryflags]\n");
- return;
- }
- if (strcasecmp(&line[1], "mx") == 0)
- {
-#if NAMED_BIND
- /* look up MX records */
- int nmx;
- auto int rcode;
- char *mxhosts[MAXMXHOSTS + 1];
-
- if (*p == '\0')
- {
- printf("Usage: /mx address\n");
- return;
- }
- nmx = getmxrr(p, mxhosts, FALSE, &rcode);
- printf("getmxrr(%s) returns %d value(s):\n", p, nmx);
- for (i = 0; i < nmx; i++)
- printf("\t%s\n", mxhosts[i]);
-#else
- printf("No MX code compiled in\n");
-#endif
- }
- else if (strcasecmp(&line[1], "canon") == 0)
- {
- char host[MAXHOSTNAMELEN];
-
- if (*p == '\0')
- {
- printf("Usage: /canon address\n");
- return;
- }
- else if (strlen(p) >= sizeof host)
- {
- printf("Name too long\n");
- return;
- }
- strcpy(host, p);
- (void) getcanonname(host, sizeof(host), HasWildcardMX);
- printf("getcanonname(%s) returns %s\n", p, host);
- }
- else if (strcasecmp(&line[1], "map") == 0)
- {
- auto int rcode = EX_OK;
- char *av[2];
-
- if (*p == '\0')
- {
- printf("Usage: /map mapname key\n");
- return;
- }
- for (q = p; *q != '\0' && !(isascii(*q) && isspace(*q)); q++)
- continue;
- if (*q == '\0')
- {
- printf("No key specified\n");
- return;
- }
- *q++ = '\0';
- map = stab(p, ST_MAP, ST_FIND);
- if (map == NULL)
- {
- printf("Map named \"%s\" not found\n", p);
- return;
- }
- if (!bitset(MF_OPEN, map->s_map.map_mflags))
- {
- printf("Map named \"%s\" not open\n", p);
- return;
- }
- printf("map_lookup: %s (%s) ", p, q);
- av[0] = q;
- av[1] = NULL;
- p = (*map->s_map.map_class->map_lookup)
- (&map->s_map, q, av, &rcode);
- if (p == NULL)
- printf("no match (%d)\n", rcode);
- else
- printf("returns %s (%d)\n", p, rcode);
- }
- else if (strcasecmp(&line[1], "try") == 0)
- {
- MAILER *m;
- STAB *s;
- auto int rcode = EX_OK;
-
- q = strpbrk(p, " \t");
- if (q != NULL)
- {
- while (isascii(*q) && isspace(*q))
- *q++ = '\0';
- }
- if (q == NULL || *q == '\0')
- {
- printf("Usage: /try mailer address\n");
- return;
- }
- s = stab(p, ST_MAILER, ST_FIND);
- if (s == NULL)
- {
- printf("Unknown mailer %s\n", p);
- return;
- }
- m = s->s_mailer;
- printf("Trying %s %s address %s for mailer %s\n",
- bitset(RF_HEADERADDR, tryflags) ? "header" : "envelope",
- bitset(RF_SENDERADDR, tryflags) ? "sender" : "recipient",
- q, p);
- p = remotename(q, m, tryflags, &rcode, CurEnv);
- printf("Rcode = %d, addr = %s\n",
- rcode, p == NULL ? "<NULL>" : p);
- e->e_to = NULL;
- }
- else if (strcasecmp(&line[1], "tryflags") == 0)
- {
- if (*p == '\0')
- {
- printf("Usage: /tryflags [Hh|Ee][Ss|Rr]\n");
- return;
- }
- for (; *p != '\0'; p++)
- {
- switch (*p)
- {
- case 'H':
- case 'h':
- tryflags |= RF_HEADERADDR;
- break;
-
- case 'E':
- case 'e':
- tryflags &= ~RF_HEADERADDR;
- break;
-
- case 'S':
- case 's':
- tryflags |= RF_SENDERADDR;
- break;
-
- case 'R':
- case 'r':
- tryflags &= ~RF_SENDERADDR;
- break;
- }
- }
- }
- else if (strcasecmp(&line[1], "parse") == 0)
- {
- if (*p == '\0')
- {
- printf("Usage: /parse address\n");
- return;
- }
- q = crackaddr(p);
- printf("Cracked address = ");
- xputs(q);
- printf("\nParsing %s %s address\n",
- bitset(RF_HEADERADDR, tryflags) ? "header" : "envelope",
- bitset(RF_SENDERADDR, tryflags) ? "sender" : "recipient");
- if (parseaddr(p, &a, tryflags, '\0', NULL, e) == NULL)
- printf("Cannot parse\n");
- else if (a.q_host != NULL && a.q_host[0] != '\0')
- printf("mailer %s, host %s, user %s\n",
- a.q_mailer->m_name, a.q_host, a.q_user);
- else
- printf("mailer %s, user %s\n",
- a.q_mailer->m_name, a.q_user);
- e->e_to = NULL;
- }
- else
- {
- printf("Unknown \"/\" command %s\n", line);
- }
- return;
- }
-
- for (p = line; isascii(*p) && isspace(*p); p++)
- continue;
- q = p;
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- if (*p == '\0')
- {
- printf("No address!\n");
- return;
- }
- *p = '\0';
- if (invalidaddr(p + 1, NULL))
- return;
- do
- {
- register char **pvp;
- char pvpbuf[PSBUFSIZE];
-
- pvp = prescan(++p, ',', pvpbuf, sizeof pvpbuf,
- &delimptr, NULL);
- if (pvp == NULL)
- continue;
- p = q;
- while (*p != '\0')
- {
- int stat;
-
- rs = strtorwset(p, NULL, ST_FIND);
- if (rs < 0)
- {
- printf("Undefined ruleset %s\n", p);
- break;
- }
- stat = rewrite(pvp, rs, 0, e);
- if (stat != EX_OK)
- printf("== Ruleset %s (%d) status %d\n",
- p, rs, stat);
- while (*p != '\0' && *p++ != ',')
- continue;
- }
- } while (*(p = delimptr) != '\0');
-}
-
-
-void
-dump_class(s, id)
- register STAB *s;
- int id;
-{
- if (s->s_type != ST_CLASS)
- return;
- if (bitnset(id & 0xff, s->s_class))
- printf("%s\n", s->s_name);
-}
+++ /dev/null
-#!/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.94 (Berkeley) 1/23/1999
-#
-
-#
-# 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`;;
-
- CRAYT3E|CRAYTS)
- os=$arch;;
-
-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
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1992, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1992, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)map.c 8.261 (Berkeley) 2/2/1999";
-#endif /* not lint */
-
-#include "sendmail.h"
-
-#ifdef NDBM
-# include <ndbm.h>
-# ifdef R_FIRST
- ERROR README: You are running the Berkeley DB version of ndbm.h. See
- ERROR README: the README file about tweaking Berkeley DB so it can
- ERROR README: coexist with NDBM, or delete -DNDBM from the Makefile
- ERROR README: and use -DNEWDB instead.
-# endif
-#endif
-#ifdef NEWDB
-# include <db.h>
-# ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-# endif
-#endif
-#ifdef NIS
- struct dom_binding; /* forward reference needed on IRIX */
-# include <rpcsvc/ypclnt.h>
-# ifdef NDBM
-# define NDBM_YP_COMPAT /* create YP-compatible NDBM files */
-# endif
-#endif
-
-/*
-** MAP.C -- implementations for various map classes.
-**
-** Each map class implements a series of functions:
-**
-** bool map_parse(MAP *map, char *args)
-** Parse the arguments from the config file. Return TRUE
-** if they were ok, FALSE otherwise. Fill in map with the
-** values.
-**
-** char *map_lookup(MAP *map, char *key, char **args, int *pstat)
-** Look up the key in the given map. If found, do any
-** rewriting the map wants (including "args" if desired)
-** and return the value. Set *pstat to the appropriate status
-** on error and return NULL. Args will be NULL if called
-** from the alias routines, although this should probably
-** not be relied upon. It is suggested you call map_rewrite
-** to return the results -- it takes care of null termination
-** and uses a dynamically expanded buffer as needed.
-**
-** void map_store(MAP *map, char *key, char *value)
-** Store the key:value pair in the map.
-**
-** bool map_open(MAP *map, int mode)
-** Open the map for the indicated mode. Mode should
-** be either O_RDONLY or O_RDWR. Return TRUE if it
-** was opened successfully, FALSE otherwise. If the open
-** failed an the MF_OPTIONAL flag is not set, it should
-** also print an error. If the MF_ALIAS bit is set
-** and this map class understands the @:@ convention, it
-** should call aliaswait() before returning.
-**
-** void map_close(MAP *map)
-** Close the map.
-**
-** This file also includes the implementation for getcanonname.
-** It is currently implemented in a pretty ad-hoc manner; it ought
-** to be more properly integrated into the map structure.
-*/
-
-#define DBMMODE 0644
-
-#ifndef EX_NOTFOUND
-# define EX_NOTFOUND EX_NOHOST
-#endif
-
-extern bool aliaswait __P((MAP *, char *, int));
-extern bool extract_canonname __P((char *, char *, char[], int));
-
-#if O_EXLOCK && HASFLOCK && !BOGUS_O_EXCL
-# define LOCK_ON_OPEN 1 /* we can open/create a locked file */
-#else
-# define LOCK_ON_OPEN 0 /* no such luck -- bend over backwards */
-#endif
-
-#ifndef O_ACCMODE
-# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
-#endif
-\f/*
-** MAP_PARSEARGS -- parse config line arguments for database lookup
-**
-** This is a generic version of the map_parse method.
-**
-** Parameters:
-** map -- the map being initialized.
-** ap -- a pointer to the args on the config line.
-**
-** Returns:
-** TRUE -- if everything parsed OK.
-** FALSE -- otherwise.
-**
-** Side Effects:
-** null terminates the filename; stores it in map
-*/
-
-bool
-map_parseargs(map, ap)
- MAP *map;
- char *ap;
-{
- register char *p = ap;
-
- map->map_mflags |= MF_TRY0NULL | MF_TRY1NULL;
- for (;;)
- {
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p != '-')
- break;
- switch (*++p)
- {
- case 'N':
- map->map_mflags |= MF_INCLNULL;
- map->map_mflags &= ~MF_TRY0NULL;
- break;
-
- case 'O':
- map->map_mflags &= ~MF_TRY1NULL;
- break;
-
- case 'o':
- map->map_mflags |= MF_OPTIONAL;
- break;
-
- case 'f':
- map->map_mflags |= MF_NOFOLDCASE;
- break;
-
- case 'm':
- map->map_mflags |= MF_MATCHONLY;
- break;
-
- case 'A':
- map->map_mflags |= MF_APPEND;
- break;
-
- case 'q':
- map->map_mflags |= MF_KEEPQUOTES;
- break;
-
- case 'a':
- map->map_app = ++p;
- break;
-
- case 'T':
- map->map_tapp = ++p;
- break;
-
- case 'k':
- while (isascii(*++p) && isspace(*p))
- continue;
- map->map_keycolnm = p;
- break;
-
- case 'v':
- while (isascii(*++p) && isspace(*p))
- continue;
- map->map_valcolnm = p;
- break;
-
- case 'z':
- if (*++p != '\\')
- map->map_coldelim = *p;
- else
- {
- switch (*++p)
- {
- case 'n':
- map->map_coldelim = '\n';
- break;
-
- case 't':
- map->map_coldelim = '\t';
- break;
-
- default:
- map->map_coldelim = '\\';
- }
- }
- break;
-
- case 't':
- map->map_mflags |= MF_NODEFER;
- break;
-
-#ifdef RESERVED_FOR_SUN
- case 'd':
- map->map_mflags |= MF_DOMAIN_WIDE;
- break;
-
- case 's':
- /* info type */
- break;
-#endif
- }
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- if (*p != '\0')
- *p++ = '\0';
- }
- if (map->map_app != NULL)
- map->map_app = newstr(map->map_app);
- if (map->map_tapp != NULL)
- map->map_tapp = newstr(map->map_tapp);
- if (map->map_keycolnm != NULL)
- map->map_keycolnm = newstr(map->map_keycolnm);
- if (map->map_valcolnm != NULL)
- map->map_valcolnm = newstr(map->map_valcolnm);
-
- if (*p != '\0')
- {
- map->map_file = p;
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- if (*p != '\0')
- *p++ = '\0';
- map->map_file = newstr(map->map_file);
- }
-
- while (*p != '\0' && isascii(*p) && isspace(*p))
- p++;
- if (*p != '\0')
- map->map_rebuild = newstr(p);
-
- if (map->map_file == NULL &&
- !bitset(MCF_OPTFILE, map->map_class->map_cflags))
- {
- syserr("No file name for %s map %s",
- map->map_class->map_cname, map->map_mname);
- return FALSE;
- }
- return TRUE;
-}
-\f/*
-** MAP_REWRITE -- rewrite a database key, interpolating %n indications.
-**
-** It also adds the map_app string. It can be used as a utility
-** in the map_lookup method.
-**
-** Parameters:
-** map -- the map that causes this.
-** s -- the string to rewrite, NOT necessarily null terminated.
-** slen -- the length of s.
-** av -- arguments to interpolate into buf.
-**
-** Returns:
-** Pointer to rewritten result. This is static data that
-** should be copied if it is to be saved!
-**
-** Side Effects:
-** none.
-*/
-
-char *
-map_rewrite(map, s, slen, av)
- register MAP *map;
- register const char *s;
- size_t slen;
- char **av;
-{
- register char *bp;
- register char c;
- char **avp;
- register char *ap;
- size_t l;
- size_t len;
- static size_t buflen = 0;
- static char *buf = NULL;
-
- if (tTd(39, 1))
- {
- printf("map_rewrite(%.*s), av =", (int)slen, s);
- if (av == NULL)
- printf(" (nullv)");
- else
- {
- for (avp = av; *avp != NULL; avp++)
- printf("\n\t%s", *avp);
- }
- printf("\n");
- }
-
- /* count expected size of output (can safely overestimate) */
- l = len = slen;
- if (av != NULL)
- {
- const char *sp = s;
-
- while (l-- > 0 && (c = *sp++) != '\0')
- {
- if (c != '%')
- continue;
- if (l-- <= 0)
- break;
- c = *sp++;
- if (!(isascii(c) && isdigit(c)))
- continue;
- for (avp = av; --c >= '0' && *avp != NULL; avp++)
- continue;
- if (*avp == NULL)
- continue;
- len += strlen(*avp);
- }
- }
- if (map->map_app != NULL)
- len += strlen(map->map_app);
- if (buflen < ++len)
- {
- /* need to malloc additional space */
- buflen = len;
- if (buf != NULL)
- free(buf);
- buf = xalloc(buflen);
- }
-
- bp = buf;
- if (av == NULL)
- {
- bcopy(s, bp, slen);
- bp += slen;
- }
- else
- {
- while (slen-- > 0 && (c = *s++) != '\0')
- {
- if (c != '%')
- {
- pushc:
- *bp++ = c;
- continue;
- }
- if (slen-- <= 0 || (c = *s++) == '\0')
- c = '%';
- if (c == '%')
- goto pushc;
- if (!(isascii(c) && isdigit(c)))
- {
- *bp++ = '%';
- goto pushc;
- }
- for (avp = av; --c >= '0' && *avp != NULL; avp++)
- continue;
- if (*avp == NULL)
- continue;
-
- /* transliterate argument into output string */
- for (ap = *avp; (c = *ap++) != '\0'; )
- *bp++ = c;
- }
- }
- if (map->map_app != NULL)
- strcpy(bp, map->map_app);
- else
- *bp = '\0';
- if (tTd(39, 1))
- printf("map_rewrite => %s\n", buf);
- return buf;
-}
-\f/*
-** INITMAPS -- initialize for aliasing
-**
-** Parameters:
-** rebuild -- if TRUE, this rebuilds the cached versions.
-** e -- current envelope.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** initializes aliases:
-** if alias database: opens the database.
-** if no database available: reads aliases into the symbol table.
-*/
-
-void
-initmaps(rebuild, e)
- bool rebuild;
- register ENVELOPE *e;
-{
- extern void map_init __P((STAB *, int));
-
-#if XDEBUG
- checkfd012("entering initmaps");
-#endif
- CurEnv = e;
-
- stabapply(map_init, 0);
- stabapply(map_init, rebuild ? 2 : 1);
-#if XDEBUG
- checkfd012("exiting initmaps");
-#endif
-}
-
-void
-map_init(s, pass)
- register STAB *s;
- int pass;
-{
- bool rebuildable;
- register MAP *map;
-
- /* has to be a map */
- if (s->s_type != ST_MAP)
- return;
-
- map = &s->s_map;
- if (!bitset(MF_VALID, map->map_mflags))
- return;
-
- if (tTd(38, 2))
- printf("map_init(%s:%s, %s, %d)\n",
- map->map_class->map_cname == NULL ? "NULL" :
- map->map_class->map_cname,
- map->map_mname == NULL ? "NULL" : map->map_mname,
- map->map_file == NULL ? "NULL" : map->map_file,
- pass);
-
- /*
- ** Pass 0 opens all non-rebuildable maps.
- ** Pass 1 opens all rebuildable maps for read.
- ** Pass 2 rebuilds all rebuildable maps.
- */
-
- rebuildable = (bitset(MF_ALIAS, map->map_mflags) &&
- bitset(MCF_REBUILDABLE, map->map_class->map_cflags));
-
- if ((pass == 0 && rebuildable) ||
- ((pass == 1 || pass == 2) && !rebuildable))
- {
- if (tTd(38, 3))
- printf("\twrong pass (pass = %d, rebuildable = %d)\n",
- pass, rebuildable);
- return;
- }
-
- /* if already open, close it (for nested open) */
- if (bitset(MF_OPEN, map->map_mflags))
- {
- map->map_class->map_close(map);
- map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
- }
-
- if (pass == 2)
- {
- (void) rebuildaliases(map, FALSE);
- return;
- }
-
- if (map->map_class->map_open(map, O_RDONLY))
- {
- if (tTd(38, 4))
- printf("\t%s:%s %s: valid\n",
- map->map_class->map_cname == NULL ? "NULL" :
- map->map_class->map_cname,
- map->map_mname == NULL ? "NULL" :
- map->map_mname,
- map->map_file == NULL ? "NULL" :
- map->map_file);
- map->map_mflags |= MF_OPEN;
- map->map_pid = getpid();
- }
- else
- {
- if (tTd(38, 4))
- printf("\t%s:%s %s: invalid: %s\n",
- map->map_class->map_cname == NULL ? "NULL" :
- map->map_class->map_cname,
- map->map_mname == NULL ? "NULL" :
- map->map_mname,
- map->map_file == NULL ? "NULL" :
- map->map_file,
- errstring(errno));
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- {
- extern MAPCLASS BogusMapClass;
-
- map->map_class = &BogusMapClass;
- map->map_mflags |= MF_OPEN;
- map->map_pid = getpid();
- }
- }
-}
-\f/*
-** CLOSEMAPS -- close all open maps opened by the current pid.
-**
-** Parameters:
-** none
-**
-** Returns:
-** none.
-*/
-
-void
-closemaps()
-{
- extern void map_close __P((STAB *, int));
-
- stabapply(map_close, 0);
-}
-
-/* ARGSUSED1 */
-void
-map_close(s, unused)
- register STAB *s;
- int unused;
-{
- MAP *map;
-
- if (s->s_type != ST_MAP)
- return;
-
- map = &s->s_map;
-
- if (!bitset(MF_VALID, map->map_mflags) ||
- !bitset(MF_OPEN, map->map_mflags) ||
- map->map_pid != getpid())
- return;
-
- if (tTd(38, 5))
- printf("closemaps: closing %s (%s)\n",
- map->map_mname == NULL ? "NULL" : map->map_mname,
- map->map_file == NULL ? "NULL" : map->map_file);
-
- map->map_class->map_close(map);
- map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
-}
-\f/*
-** GETCANONNAME -- look up name using service switch
-**
-** Parameters:
-** host -- the host name to look up.
-** hbsize -- the size of the host buffer.
-** trymx -- if set, try MX records.
-**
-** Returns:
-** TRUE -- if the host was found.
-** FALSE -- otherwise.
-*/
-
-bool
-getcanonname(host, hbsize, trymx)
- char *host;
- int hbsize;
- bool trymx;
-{
- int nmaps;
- int mapno;
- bool found = FALSE;
- bool got_tempfail = FALSE;
- auto int stat;
- char *maptype[MAXMAPSTACK];
- short mapreturn[MAXMAPACTIONS];
-
- nmaps = switch_map_find("hosts", maptype, mapreturn);
- for (mapno = 0; mapno < nmaps; mapno++)
- {
- int i;
-
- if (tTd(38, 20))
- printf("getcanonname(%s), trying %s\n",
- host, maptype[mapno]);
- if (strcmp("files", maptype[mapno]) == 0)
- {
- extern bool text_getcanonname __P((char *, int, int *));
-
- found = text_getcanonname(host, hbsize, &stat);
- }
-#ifdef NIS
- else if (strcmp("nis", maptype[mapno]) == 0)
- {
- extern bool nis_getcanonname __P((char *, int, int *));
-
- found = nis_getcanonname(host, hbsize, &stat);
- }
-#endif
-#ifdef NISPLUS
- else if (strcmp("nisplus", maptype[mapno]) == 0)
- {
- extern bool nisplus_getcanonname __P((char *, int, int *));
-
- found = nisplus_getcanonname(host, hbsize, &stat);
- }
-#endif
-#if NAMED_BIND
- else if (strcmp("dns", maptype[mapno]) == 0)
- {
- extern bool dns_getcanonname __P((char *, int, bool, int *));
-
- found = dns_getcanonname(host, hbsize, trymx, &stat);
- }
-#endif
-#if NETINFO
- else if (strcmp("netinfo", maptype[mapno]) == 0)
- {
- extern bool ni_getcanonname __P((char *, int, int *));
-
- found = ni_getcanonname(host, hbsize, &stat);
- }
-#endif
- else
- {
- found = FALSE;
- stat = EX_UNAVAILABLE;
- }
-
- /*
- ** Heuristic: if $m is not set, we are running during system
- ** startup. In this case, when a name is apparently found
- ** but has no dot, treat is as not found. This avoids
- ** problems if /etc/hosts has no FQDN but is listed first
- ** in the service switch.
- */
-
- if (found &&
- (macvalue('m', CurEnv) != NULL || strchr(host, '.') != NULL))
- break;
-
- /* see if we should continue */
- if (stat == EX_TEMPFAIL)
- {
- i = MA_TRYAGAIN;
- got_tempfail = TRUE;
- }
- else if (stat == EX_NOTFOUND)
- i = MA_NOTFOUND;
- else
- i = MA_UNAVAIL;
- if (bitset(1 << mapno, mapreturn[i]))
- break;
- }
-
- if (found)
- {
- char *d;
-
- if (tTd(38, 20))
- printf("getcanonname(%s), found\n", host);
-
- /*
- ** If returned name is still single token, compensate
- ** by tagging on $m. This is because some sites set
- ** up their DNS or NIS databases wrong.
- */
-
- if ((d = strchr(host, '.')) == NULL || d[1] == '\0')
- {
- d = macvalue('m', CurEnv);
- if (d != NULL &&
- hbsize > (int) (strlen(host) + strlen(d) + 1))
- {
- if (host[strlen(host) - 1] != '.')
- strcat(host, ".");
- strcat(host, d);
- }
- else
- {
- return FALSE;
- }
- }
- return TRUE;
- }
-
- if (tTd(38, 20))
- printf("getcanonname(%s), failed, stat=%d\n", host, stat);
-
-#if NAMED_BIND
- if (got_tempfail)
- h_errno = TRY_AGAIN;
- else
- h_errno = HOST_NOT_FOUND;
-#endif
-
- return FALSE;
-}
-\f/*
-** EXTRACT_CANONNAME -- extract canonical name from /etc/hosts entry
-**
-** Parameters:
-** name -- the name against which to match.
-** line -- the /etc/hosts line.
-** cbuf -- the location to store the result.
-** cbuflen -- the size of cbuf.
-**
-** Returns:
-** TRUE -- if the line matched the desired name.
-** FALSE -- otherwise.
-*/
-
-bool
-extract_canonname(name, line, cbuf, cbuflen)
- char *name;
- char *line;
- char cbuf[];
- int cbuflen;
-{
- int i;
- char *p;
- bool found = FALSE;
- extern char *get_column __P((char *, int, char, char *, int));
-
- cbuf[0] = '\0';
- if (line[0] == '#')
- return FALSE;
-
- for (i = 1; ; i++)
- {
- char nbuf[MAXNAME + 1];
-
- p = get_column(line, i, '\0', nbuf, sizeof nbuf);
- if (p == NULL)
- break;
- if (*p == '\0')
- continue;
- if (cbuf[0] == '\0' ||
- (strchr(cbuf, '.') == NULL && strchr(p, '.') != NULL))
- {
- snprintf(cbuf, cbuflen, "%s", p);
- }
- if (strcasecmp(name, p) == 0)
- found = TRUE;
- }
- if (found && strchr(cbuf, '.') == NULL)
- {
- /* try to add a domain on the end of the name */
- char *domain = macvalue('m', CurEnv);
-
- if (domain != NULL &&
- strlen(domain) + strlen(cbuf) + 1 < cbuflen)
- {
- p = &cbuf[strlen(cbuf)];
- *p++ = '.';
- strcpy(p, domain);
- }
- }
- return found;
-}
-\f/*
-** NDBM modules
-*/
-
-#ifdef NDBM
-
-/*
-** NDBM_MAP_OPEN -- DBM-style map open
-*/
-
-bool
-ndbm_map_open(map, mode)
- MAP *map;
- int mode;
-{
- register DBM *dbm;
- struct stat st;
- int dfd;
- int pfd;
- int sff;
- int ret;
- int smode = S_IREAD;
- char dirfile[MAXNAME + 1];
- char pagfile[MAXNAME + 1];
- struct stat std, stp;
-
- if (tTd(38, 2))
- printf("ndbm_map_open(%s, %s, %d)\n",
- map->map_mname, map->map_file, mode);
- map->map_lockfd = -1;
- mode &= O_ACCMODE;
-
- /* do initial file and directory checks */
- snprintf(dirfile, sizeof dirfile, "%s.dir", map->map_file);
- snprintf(pagfile, sizeof pagfile, "%s.pag", map->map_file);
- sff = SFF_ROOTOK|SFF_REGONLY;
- if (mode == O_RDWR)
- {
- sff |= SFF_CREAT;
- if (!bitset(DBS_WRITEMAPTOSYMLINK, DontBlameSendmail))
- sff |= SFF_NOSLINK;
- if (!bitset(DBS_WRITEMAPTOHARDLINK, DontBlameSendmail))
- sff |= SFF_NOHLINK;
- smode = S_IWRITE;
- }
- else
- {
- if (!bitset(DBS_LINKEDMAPINWRITABLEDIR, DontBlameSendmail))
- sff |= SFF_NOWLINK;
- }
- if (!bitset(DBS_MAPINUNSAFEDIRPATH, DontBlameSendmail))
- sff |= SFF_SAFEDIRPATH;
- ret = safefile(dirfile, RunAsUid, RunAsGid, RunAsUserName,
- sff, smode, &std);
- if (ret == 0)
- ret = safefile(pagfile, RunAsUid, RunAsGid, RunAsUserName,
- sff, smode, &stp);
- if (ret == ENOENT && AutoRebuild &&
- bitset(MCF_REBUILDABLE, map->map_class->map_cflags) &&
- (bitset(MF_IMPL_NDBM, map->map_mflags) ||
- bitset(MF_ALIAS, map->map_mflags)) &&
- mode == O_RDONLY)
- {
- bool impl = bitset(MF_IMPL_NDBM, map->map_mflags);
- extern bool impl_map_open __P((MAP *, int));
-
- /* may be able to rebuild */
- map->map_mflags &= ~MF_IMPL_NDBM;
- if (!rebuildaliases(map, TRUE))
- return FALSE;
- if (impl)
- return impl_map_open(map, O_RDONLY);
- else
- return ndbm_map_open(map, O_RDONLY);
- }
- if (ret != 0)
- {
- char *prob = "unsafe";
-
- /* cannot open this map */
- if (ret == ENOENT)
- prob = "missing";
- if (tTd(38, 2))
- printf("\t%s map file: %d\n", prob, ret);
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- syserr("dbm map \"%s\": %s map file %s",
- map->map_mname, prob, map->map_file);
- return FALSE;
- }
- if (std.st_mode == ST_MODE_NOFILE)
- mode |= O_CREAT|O_EXCL;
-
-#if LOCK_ON_OPEN
- if (mode == O_RDONLY)
- mode |= O_SHLOCK;
- else
- mode |= O_TRUNC|O_EXLOCK;
-#else
- if ((mode & O_ACCMODE) == O_RDWR)
- {
-# if NOFTRUNCATE
- /*
- ** Warning: race condition. Try to lock the file as
- ** quickly as possible after opening it.
- ** This may also have security problems on some systems,
- ** but there isn't anything we can do about it.
- */
-
- mode |= O_TRUNC;
-# else
- /*
- ** This ugly code opens the map without truncating it,
- ** locks the file, then truncates it. Necessary to
- ** avoid race conditions.
- */
-
- int dirfd;
- int pagfd;
- int sff = SFF_CREAT|SFF_OPENASROOT;
-
- if (!bitset(DBS_WRITEMAPTOSYMLINK, DontBlameSendmail))
- sff |= SFF_NOSLINK;
- if (!bitset(DBS_WRITEMAPTOHARDLINK, DontBlameSendmail))
- sff |= SFF_NOHLINK;
-
- dirfd = safeopen(dirfile, mode, DBMMODE, sff);
- pagfd = safeopen(pagfile, mode, DBMMODE, sff);
-
- if (dirfd < 0 || pagfd < 0)
- {
- int save_errno = errno;
-
- if (dirfd >= 0)
- (void) close(dirfd);
- if (pagfd >= 0)
- (void) close(pagfd);
- errno = save_errno;
- syserr("ndbm_map_open: cannot create database %s",
- map->map_file);
- return FALSE;
- }
- if (ftruncate(dirfd, (off_t) 0) < 0 ||
- ftruncate(pagfd, (off_t) 0) < 0)
- {
- int save_errno = errno;
-
- (void) close(dirfd);
- (void) close(pagfd);
- errno = save_errno;
- syserr("ndbm_map_open: cannot truncate %s.{dir,pag}",
- map->map_file);
- return FALSE;
- }
-
- /* if new file, get "before" bits for later filechanged check */
- if (std.st_mode == ST_MODE_NOFILE &&
- (fstat(dirfd, &std) < 0 || fstat(pagfd, &stp) < 0))
- {
- int save_errno = errno;
-
- (void) close(dirfd);
- (void) close(pagfd);
- errno = save_errno;
- syserr("ndbm_map_open(%s.{dir,pag}): cannot fstat pre-opened file",
- map->map_file);
- return FALSE;
- }
-
- /* have to save the lock for the duration (bletch) */
- map->map_lockfd = dirfd;
- close(pagfd);
-
- /* twiddle bits for dbm_open */
- mode &= ~(O_CREAT|O_EXCL);
-# endif
- }
-#endif
-
- /* open the database */
- dbm = dbm_open(map->map_file, mode, DBMMODE);
- if (dbm == NULL)
- {
- int save_errno = errno;
-
- if (bitset(MF_ALIAS, map->map_mflags) &&
- aliaswait(map, ".pag", FALSE))
- return TRUE;
-#if !LOCK_ON_OPEN && !NOFTRUNCATE
- if (map->map_lockfd >= 0)
- close(map->map_lockfd);
-#endif
- errno = save_errno;
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- syserr("Cannot open DBM database %s", map->map_file);
- return FALSE;
- }
- dfd = dbm_dirfno(dbm);
- pfd = dbm_pagfno(dbm);
- if (dfd == pfd)
- {
- /* heuristic: if files are linked, this is actually gdbm */
- dbm_close(dbm);
-#if !LOCK_ON_OPEN && !NOFTRUNCATE
- if (map->map_lockfd >= 0)
- close(map->map_lockfd);
-#endif
- errno = 0;
- syserr("dbm map \"%s\": cannot support GDBM",
- map->map_mname);
- return FALSE;
- }
-
- if (filechanged(dirfile, dfd, &std) ||
- filechanged(pagfile, pfd, &stp))
- {
- int save_errno = errno;
-
- dbm_close(dbm);
-#if !LOCK_ON_OPEN && !NOFTRUNCATE
- if (map->map_lockfd >= 0)
- close(map->map_lockfd);
-#endif
- errno = save_errno;
- syserr("ndbm_map_open(%s): file changed after open",
- map->map_file);
- return FALSE;
- }
-
- map->map_db1 = (ARBPTR_T) dbm;
- if (mode == O_RDONLY)
- {
-#if LOCK_ON_OPEN
- if (dfd >= 0)
- (void) lockfile(dfd, map->map_file, ".dir", LOCK_UN);
- if (pfd >= 0)
- (void) lockfile(pfd, map->map_file, ".pag", LOCK_UN);
-#endif
- if (bitset(MF_ALIAS, map->map_mflags) &&
- !aliaswait(map, ".pag", TRUE))
- return FALSE;
- }
- else
- {
- map->map_mflags |= MF_LOCKED;
-#if _FFR_TRUSTED_USER
- if (geteuid() == 0 && TrustedUid != 0)
- {
- if (fchown(dfd, TrustedUid, -1) < 0 ||
- fchown(pfd, TrustedUid, -1) < 0)
- {
- int err = errno;
-
- sm_syslog(LOG_ALERT, NOQID,
- "ownership change on %s failed: %s",
- map->map_file, errstring(err));
- message("050 ownership change on %s failed: %s",
- map->map_file, errstring(err));
- }
- }
-#endif
- }
- if (fstat(dfd, &st) >= 0)
- map->map_mtime = st.st_mtime;
- return TRUE;
-}
-
-
-/*
-** NDBM_MAP_LOOKUP -- look up a datum in a DBM-type map
-*/
-
-char *
-ndbm_map_lookup(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- datum key, val;
- int fd;
- char keybuf[MAXNAME + 1];
- struct stat stbuf;
-
- if (tTd(38, 20))
- printf("ndbm_map_lookup(%s, %s)\n",
- map->map_mname, name);
-
- key.dptr = name;
- key.dsize = strlen(name);
- if (!bitset(MF_NOFOLDCASE, map->map_mflags))
- {
- if (key.dsize > sizeof keybuf - 1)
- key.dsize = sizeof keybuf - 1;
- bcopy(key.dptr, keybuf, key.dsize);
- keybuf[key.dsize] = '\0';
- makelower(keybuf);
- key.dptr = keybuf;
- }
-lockdbm:
- fd = dbm_dirfno((DBM *) map->map_db1);
- if (fd >= 0 && !bitset(MF_LOCKED, map->map_mflags))
- (void) lockfile(fd, map->map_file, ".dir", LOCK_SH);
- if (fd < 0 || fstat(fd, &stbuf) < 0 || stbuf.st_mtime > map->map_mtime)
- {
- /* Reopen the database to sync the cache */
- int omode = bitset(map->map_mflags, MF_WRITABLE) ? O_RDWR
- : O_RDONLY;
-
- map->map_class->map_close(map);
- map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
- if (map->map_class->map_open(map, omode))
- {
- map->map_mflags |= MF_OPEN;
- map->map_pid = getpid();
- if ((omode && O_ACCMODE) == O_RDWR)
- map->map_mflags |= MF_WRITABLE;
- goto lockdbm;
- }
- else
- {
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- {
- extern MAPCLASS BogusMapClass;
-
- *statp = EX_TEMPFAIL;
- map->map_class = &BogusMapClass;
- map->map_mflags |= MF_OPEN;
- map->map_pid = getpid();
- syserr("Cannot reopen NDBM database %s",
- map->map_file);
- }
- return NULL;
- }
- }
- val.dptr = NULL;
- if (bitset(MF_TRY0NULL, map->map_mflags))
- {
- val = dbm_fetch((DBM *) map->map_db1, key);
- if (val.dptr != NULL)
- map->map_mflags &= ~MF_TRY1NULL;
- }
- if (val.dptr == NULL && bitset(MF_TRY1NULL, map->map_mflags))
- {
- key.dsize++;
- val = dbm_fetch((DBM *) map->map_db1, key);
- if (val.dptr != NULL)
- map->map_mflags &= ~MF_TRY0NULL;
- }
- if (fd >= 0 && !bitset(MF_LOCKED, map->map_mflags))
- (void) lockfile(fd, map->map_file, ".dir", LOCK_UN);
- if (val.dptr == NULL)
- return NULL;
- if (bitset(MF_MATCHONLY, map->map_mflags))
- return map_rewrite(map, name, strlen(name), NULL);
- else
- return map_rewrite(map, val.dptr, val.dsize, av);
-}
-
-
-/*
-** NDBM_MAP_STORE -- store a datum in the database
-*/
-
-void
-ndbm_map_store(map, lhs, rhs)
- register MAP *map;
- char *lhs;
- char *rhs;
-{
- datum key;
- datum data;
- int stat;
- char keybuf[MAXNAME + 1];
-
- if (tTd(38, 12))
- printf("ndbm_map_store(%s, %s, %s)\n",
- map->map_mname, lhs, rhs);
-
- key.dsize = strlen(lhs);
- key.dptr = lhs;
- if (!bitset(MF_NOFOLDCASE, map->map_mflags))
- {
- if (key.dsize > sizeof keybuf - 1)
- key.dsize = sizeof keybuf - 1;
- bcopy(key.dptr, keybuf, key.dsize);
- keybuf[key.dsize] = '\0';
- makelower(keybuf);
- key.dptr = keybuf;
- }
-
- data.dsize = strlen(rhs);
- data.dptr = rhs;
-
- if (bitset(MF_INCLNULL, map->map_mflags))
- {
- key.dsize++;
- data.dsize++;
- }
-
- stat = dbm_store((DBM *) map->map_db1, key, data, DBM_INSERT);
- if (stat > 0)
- {
- if (!bitset(MF_APPEND, map->map_mflags))
- message("050 Warning: duplicate alias name %s", lhs);
- else
- {
- static char *buf = NULL;
- static int bufsiz = 0;
- auto int xstat;
- datum old;
-
- old.dptr = ndbm_map_lookup(map, key.dptr,
- (char **)NULL, &xstat);
- if (old.dptr != NULL && *(char *) old.dptr != '\0')
- {
- old.dsize = strlen(old.dptr);
- if (data.dsize + old.dsize + 2 > bufsiz)
- {
- if (buf != NULL)
- (void) free(buf);
- bufsiz = data.dsize + old.dsize + 2;
- buf = xalloc(bufsiz);
- }
- snprintf(buf, bufsiz, "%s,%s",
- data.dptr, old.dptr);
- data.dsize = data.dsize + old.dsize + 1;
- data.dptr = buf;
- if (tTd(38, 9))
- printf("ndbm_map_store append=%s\n", data.dptr);
- }
- }
- stat = dbm_store((DBM *) map->map_db1, key, data, DBM_REPLACE);
- }
- if (stat != 0)
- syserr("readaliases: dbm put (%s)", lhs);
-}
-
-
-/*
-** NDBM_MAP_CLOSE -- close the database
-*/
-
-void
-ndbm_map_close(map)
- register MAP *map;
-{
- if (tTd(38, 9))
- printf("ndbm_map_close(%s, %s, %lx)\n",
- map->map_mname, map->map_file, map->map_mflags);
-
- if (bitset(MF_WRITABLE, map->map_mflags))
- {
-#ifdef NDBM_YP_COMPAT
- bool inclnull;
- char buf[MAXHOSTNAMELEN];
-
- inclnull = bitset(MF_INCLNULL, map->map_mflags);
- map->map_mflags &= ~MF_INCLNULL;
-
- if (strstr(map->map_file, "/yp/") != NULL)
- {
- long save_mflags = map->map_mflags;
-
- map->map_mflags |= MF_NOFOLDCASE;
-
- (void) snprintf(buf, sizeof buf, "%010ld", curtime());
- ndbm_map_store(map, "YP_LAST_MODIFIED", buf);
-
- (void) gethostname(buf, sizeof buf);
- ndbm_map_store(map, "YP_MASTER_NAME", buf);
-
- map->map_mflags = save_mflags;
- }
-
- if (inclnull)
- map->map_mflags |= MF_INCLNULL;
-#endif
-
- /* write out the distinguished alias */
- ndbm_map_store(map, "@", "@");
- }
- dbm_close((DBM *) map->map_db1);
-
- /* release lock (if needed) */
-#if !LOCK_ON_OPEN
- if (map->map_lockfd >= 0)
- (void) close(map->map_lockfd);
-#endif
-}
-
-#endif
-\f/*
-** NEWDB (Hash and BTree) Modules
-*/
-
-#ifdef NEWDB
-
-/*
-** BT_MAP_OPEN, HASH_MAP_OPEN -- database open primitives.
-**
-** These do rather bizarre locking. If you can lock on open,
-** do that to avoid the condition of opening a database that
-** is being rebuilt. If you don't, we'll try to fake it, but
-** there will be a race condition. If opening for read-only,
-** we immediately release the lock to avoid freezing things up.
-** We really ought to hold the lock, but guarantee that we won't
-** be pokey about it. That's hard to do.
-*/
-
-#if DB_VERSION_MAJOR < 2
-extern bool db_map_open __P((MAP *, int, char *, DBTYPE, const void *));
-#else
-extern bool db_map_open __P((MAP *, int, char *, DBTYPE, DB_INFO *));
-#endif
-
-/* these should be K line arguments */
-#if DB_VERSION_MAJOR < 2
-# define db_cachesize cachesize
-# define h_nelem nelem
-# ifndef DB_CACHE_SIZE
-# define DB_CACHE_SIZE (1024 * 1024) /* database memory cache size */
-# endif
-# ifndef DB_HASH_NELEM
-# define DB_HASH_NELEM 4096 /* (starting) size of hash table */
-# endif
-#endif
-
-bool
-bt_map_open(map, mode)
- MAP *map;
- int mode;
-{
-#if DB_VERSION_MAJOR < 2
- BTREEINFO btinfo;
-#else
- DB_INFO btinfo;
-#endif
-
- if (tTd(38, 2))
- printf("bt_map_open(%s, %s, %d)\n",
- map->map_mname, map->map_file, mode);
-
- bzero(&btinfo, sizeof btinfo);
-#ifdef DB_CACHE_SIZE
- btinfo.db_cachesize = DB_CACHE_SIZE;
-#endif
- return db_map_open(map, mode, "btree", DB_BTREE, &btinfo);
-}
-
-bool
-hash_map_open(map, mode)
- MAP *map;
- int mode;
-{
-#if DB_VERSION_MAJOR < 2
- HASHINFO hinfo;
-#else
- DB_INFO hinfo;
-#endif
-
- if (tTd(38, 2))
- printf("hash_map_open(%s, %s, %d)\n",
- map->map_mname, map->map_file, mode);
-
- bzero(&hinfo, sizeof hinfo);
-#ifdef DB_HASH_NELEM
- hinfo.h_nelem = DB_HASH_NELEM;
-#endif
-#ifdef DB_CACHE_SIZE
- hinfo.db_cachesize = DB_CACHE_SIZE;
-#endif
- return db_map_open(map, mode, "hash", DB_HASH, &hinfo);
-}
-
-bool
-db_map_open(map, mode, mapclassname, dbtype, openinfo)
- MAP *map;
- int mode;
- char *mapclassname;
- DBTYPE dbtype;
-#if DB_VERSION_MAJOR < 2
- const void *openinfo;
-#else
- DB_INFO *openinfo;
-#endif
-{
- DB *db = NULL;
- int i;
- int omode;
- int smode = S_IREAD;
- int fd;
- int sff;
- int saveerrno;
- struct stat st;
- char buf[MAXNAME + 1];
-
- /* do initial file and directory checks */
- snprintf(buf, sizeof buf - 3, "%s", map->map_file);
- i = strlen(buf);
- if (i < 3 || strcmp(&buf[i - 3], ".db") != 0)
- (void) strcat(buf, ".db");
-
- mode &= O_ACCMODE;
- omode = mode;
-
- sff = SFF_ROOTOK|SFF_REGONLY;
- if (mode == O_RDWR)
- {
- sff |= SFF_CREAT;
- if (!bitset(DBS_WRITEMAPTOSYMLINK, DontBlameSendmail))
- sff |= SFF_NOSLINK;
- if (!bitset(DBS_WRITEMAPTOHARDLINK, DontBlameSendmail))
- sff |= SFF_NOHLINK;
- smode = S_IWRITE;
- }
- else
- {
- if (!bitset(DBS_LINKEDMAPINWRITABLEDIR, DontBlameSendmail))
- sff |= SFF_NOWLINK;
- }
- if (!bitset(DBS_MAPINUNSAFEDIRPATH, DontBlameSendmail))
- sff |= SFF_SAFEDIRPATH;
- i = safefile(buf, RunAsUid, RunAsGid, RunAsUserName, sff, smode, &st);
- if (i == ENOENT && AutoRebuild &&
- bitset(MCF_REBUILDABLE, map->map_class->map_cflags) &&
- (bitset(MF_IMPL_HASH, map->map_mflags) ||
- bitset(MF_ALIAS, map->map_mflags)) &&
- mode == O_RDONLY)
- {
- bool impl = bitset(MF_IMPL_HASH, map->map_mflags);
- extern bool impl_map_open __P((MAP *, int));
-
- /* may be able to rebuild */
- map->map_mflags &= ~MF_IMPL_HASH;
- if (!rebuildaliases(map, TRUE))
- return FALSE;
- if (impl)
- return impl_map_open(map, O_RDONLY);
- else
- return db_map_open(map, O_RDONLY, mapclassname,
- dbtype, openinfo);
- }
-
- if (i != 0)
- {
- char *prob = "unsafe";
-
- /* cannot open this map */
- if (i == ENOENT)
- prob = "missing";
- if (tTd(38, 2))
- printf("\t%s map file: %s\n", prob, errstring(i));
- errno = i;
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- syserr("%s map \"%s\": %s map file %s",
- mapclassname, map->map_mname, prob, buf);
- return FALSE;
- }
- if (st.st_mode == ST_MODE_NOFILE)
- omode |= O_CREAT|O_EXCL;
-
- map->map_lockfd = -1;
-
-#if LOCK_ON_OPEN
- if (mode == O_RDWR)
- omode |= O_TRUNC|O_EXLOCK;
- else
- omode |= O_SHLOCK;
-#else
- /*
- ** Pre-lock the file to avoid race conditions. In particular,
- ** since dbopen returns NULL if the file is zero length, we
- ** must have a locked instance around the dbopen.
- */
-
- fd = open(buf, omode, DBMMODE);
- if (fd < 0)
- {
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- syserr("db_map_open: cannot pre-open database %s", buf);
- return FALSE;
- }
-
- /* make sure no baddies slipped in just before the open... */
- if (filechanged(buf, fd, &st))
- {
- int save_errno = errno;
-
- (void) close(fd);
- errno = save_errno;
- syserr("db_map_open(%s): file changed after pre-open", buf);
- return FALSE;
- }
-
- /* if new file, get the "before" bits for later filechanged check */
- if (st.st_mode == ST_MODE_NOFILE && fstat(fd, &st) < 0)
- {
- int save_errno = errno;
-
- (void) close(fd);
- errno = save_errno;
- syserr("db_map_open(%s): cannot fstat pre-opened file",
- buf);
- return FALSE;
- }
-
- /* actually lock the pre-opened file */
- if (!lockfile(fd, buf, NULL, mode == O_RDONLY ? LOCK_SH : LOCK_EX))
- syserr("db_map_open: cannot lock %s", buf);
-
- /* set up mode bits for dbopen */
- if (mode == O_RDWR)
- omode |= O_TRUNC;
- omode &= ~(O_EXCL|O_CREAT);
-#endif
-
-#if DB_VERSION_MAJOR < 2
- db = dbopen(buf, omode, DBMMODE, dbtype, openinfo);
-#else
- {
- int flags = 0;
-
- if (mode == O_RDONLY)
- flags |= DB_RDONLY;
- if (bitset(O_CREAT, omode))
- flags |= DB_CREATE;
- if (bitset(O_TRUNC, omode))
- flags |= DB_TRUNCATE;
-
- errno = db_open(buf, dbtype, flags, DBMMODE,
- NULL, openinfo, &db);
- }
-#endif
- saveerrno = errno;
-
-#if !LOCK_ON_OPEN
- if (mode == O_RDWR)
- map->map_lockfd = fd;
- else
- (void) close(fd);
-#endif
-
- if (db == NULL)
- {
- if (mode == O_RDONLY && bitset(MF_ALIAS, map->map_mflags) &&
- aliaswait(map, ".db", FALSE))
- return TRUE;
-#if !LOCK_ON_OPEN
- if (map->map_lockfd >= 0)
- (void) close(map->map_lockfd);
-#endif
- errno = saveerrno;
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- syserr("Cannot open %s database %s",
- mapclassname, buf);
- return FALSE;
- }
-
-#if DB_VERSION_MAJOR < 2
- fd = db->fd(db);
-#else
- fd = -1;
- errno = db->fd(db, &fd);
-#endif
- if (filechanged(buf, fd, &st))
- {
- int save_errno = errno;
-
-#if DB_VERSION_MAJOR < 2
- db->close(db);
-#else
- errno = db->close(db, 0);
-#endif
-#if !LOCK_ON_OPEN
- if (map->map_lockfd >= 0)
- close(map->map_lockfd);
-#endif
- errno = save_errno;
- syserr("db_map_open(%s): file changed after open", buf);
- return FALSE;
- }
-
- if (mode == O_RDWR)
- map->map_mflags |= MF_LOCKED;
-#if LOCK_ON_OPEN
- if (fd >= 0 && mode == O_RDONLY)
- {
- (void) lockfile(fd, buf, NULL, LOCK_UN);
- }
-#endif
-
- /* try to make sure that at least the database header is on disk */
- if (mode == O_RDWR)
- {
- (void) db->sync(db, 0);
-#if _FFR_TRUSTED_USER
- if (geteuid() == 0 && TrustedUid != 0)
- {
- if (fchown(fd, TrustedUid, -1) < 0)
- {
- int err = errno;
-
- sm_syslog(LOG_ALERT, NOQID,
- "ownership change on %s failed: %s",
- buf, errstring(err));
- message("050 ownership change on %s failed: %s",
- buf, errstring(err));
- }
- }
-#endif
- }
-
- if (fd >= 0 && fstat(fd, &st) >= 0)
- map->map_mtime = st.st_mtime;
-
- map->map_db2 = (ARBPTR_T) db;
- if (mode == O_RDONLY && bitset(MF_ALIAS, map->map_mflags) &&
- !aliaswait(map, ".db", TRUE))
- return FALSE;
- return TRUE;
-}
-
-
-/*
-** DB_MAP_LOOKUP -- look up a datum in a BTREE- or HASH-type map
-*/
-
-char *
-db_map_lookup(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- DBT key, val;
- register DB *db = (DB *) map->map_db2;
- int i;
- int st;
- int saveerrno;
- int fd;
- struct stat stbuf;
- char keybuf[MAXNAME + 1];
- char buf[MAXNAME + 1];
-
- bzero(&key, sizeof key);
- bzero(&val, sizeof val);
-
- if (tTd(38, 20))
- printf("db_map_lookup(%s, %s)\n",
- map->map_mname, name);
-
- i = strlen(map->map_file);
- if (i > MAXNAME)
- i = MAXNAME;
- strncpy(buf, map->map_file, i);
- buf[i] = '\0';
- if (i > 3 && strcmp(&buf[i - 3], ".db") == 0)
- buf[i - 3] = '\0';
-
- key.size = strlen(name);
- if (key.size > sizeof keybuf - 1)
- key.size = sizeof keybuf - 1;
- key.data = keybuf;
- bcopy(name, keybuf, key.size);
- keybuf[key.size] = '\0';
- if (!bitset(MF_NOFOLDCASE, map->map_mflags))
- makelower(keybuf);
- lockdb:
-#if DB_VERSION_MAJOR < 2
- fd = db->fd(db);
-#else
- fd = -1;
- errno = db->fd(db, &fd);
-#endif
- if (fd >= 0 && !bitset(MF_LOCKED, map->map_mflags))
- (void) lockfile(fd, buf, ".db", LOCK_SH);
- if (fd < 0 || fstat(fd, &stbuf) < 0 || stbuf.st_mtime > map->map_mtime)
- {
- /* Reopen the database to sync the cache */
- int omode = bitset(map->map_mflags, MF_WRITABLE) ? O_RDWR
- : O_RDONLY;
-
- map->map_class->map_close(map);
- map->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
- if (map->map_class->map_open(map, omode))
- {
- map->map_mflags |= MF_OPEN;
- map->map_pid = getpid();
- if ((omode && O_ACCMODE) == O_RDWR)
- map->map_mflags |= MF_WRITABLE;
- db = (DB *) map->map_db2;
- goto lockdb;
- }
- else
- {
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- {
- extern MAPCLASS BogusMapClass;
-
- *statp = EX_TEMPFAIL;
- map->map_class = &BogusMapClass;
- map->map_mflags |= MF_OPEN;
- map->map_pid = getpid();
- syserr("Cannot reopen DB database %s",
- map->map_file);
- }
- return NULL;
- }
- }
-
- st = 1;
- if (bitset(MF_TRY0NULL, map->map_mflags))
- {
-#if DB_VERSION_MAJOR < 2
- st = db->get(db, &key, &val, 0);
-#else
- errno = db->get(db, NULL, &key, &val, 0);
- switch (errno)
- {
- case DB_NOTFOUND:
- case DB_KEYEMPTY:
- st = 1;
- break;
-
- case 0:
- st = 0;
- break;
-
- default:
- st = -1;
- break;
- }
-#endif
- if (st == 0)
- map->map_mflags &= ~MF_TRY1NULL;
- }
- if (st != 0 && bitset(MF_TRY1NULL, map->map_mflags))
- {
- key.size++;
-#if DB_VERSION_MAJOR < 2
- st = db->get(db, &key, &val, 0);
-#else
- errno = db->get(db, NULL, &key, &val, 0);
- switch (errno)
- {
- case DB_NOTFOUND:
- case DB_KEYEMPTY:
- st = 1;
- break;
-
- case 0:
- st = 0;
- break;
-
- default:
- st = -1;
- break;
- }
-#endif
- if (st == 0)
- map->map_mflags &= ~MF_TRY0NULL;
- }
- saveerrno = errno;
- if (fd >= 0 && !bitset(MF_LOCKED, map->map_mflags))
- (void) lockfile(fd, buf, ".db", LOCK_UN);
- if (st != 0)
- {
- errno = saveerrno;
- if (st < 0)
- syserr("db_map_lookup: get (%s)", name);
- return NULL;
- }
- if (bitset(MF_MATCHONLY, map->map_mflags))
- return map_rewrite(map, name, strlen(name), NULL);
- else
- return map_rewrite(map, val.data, val.size, av);
-}
-
-
-/*
-** DB_MAP_STORE -- store a datum in the NEWDB database
-*/
-
-void
-db_map_store(map, lhs, rhs)
- register MAP *map;
- char *lhs;
- char *rhs;
-{
- int stat;
- DBT key;
- DBT data;
- register DB *db = map->map_db2;
- char keybuf[MAXNAME + 1];
-
- bzero(&key, sizeof key);
- bzero(&data, sizeof data);
-
- if (tTd(38, 12))
- printf("db_map_store(%s, %s, %s)\n",
- map->map_mname, lhs, rhs);
-
- key.size = strlen(lhs);
- key.data = lhs;
- if (!bitset(MF_NOFOLDCASE, map->map_mflags))
- {
- if (key.size > sizeof keybuf - 1)
- key.size = sizeof keybuf - 1;
- bcopy(key.data, keybuf, key.size);
- keybuf[key.size] = '\0';
- makelower(keybuf);
- key.data = keybuf;
- }
-
- data.size = strlen(rhs);
- data.data = rhs;
-
- if (bitset(MF_INCLNULL, map->map_mflags))
- {
- key.size++;
- data.size++;
- }
-
-#if DB_VERSION_MAJOR < 2
- stat = db->put(db, &key, &data, R_NOOVERWRITE);
-#else
- errno = db->put(db, NULL, &key, &data, DB_NOOVERWRITE);
- switch (errno)
- {
- case DB_KEYEXIST:
- stat = 1;
- break;
-
- case 0:
- stat = 0;
- break;
-
- default:
- stat = -1;
- break;
- }
-#endif
- if (stat > 0)
- {
- if (!bitset(MF_APPEND, map->map_mflags))
- message("050 Warning: duplicate alias name %s", lhs);
- else
- {
- static char *buf = NULL;
- static int bufsiz = 0;
- DBT old;
-
- bzero(&old, sizeof old);
-
- old.data = db_map_lookup(map, key.data,
- (char **)NULL, &stat);
- if (old.data != NULL)
- {
- old.size = strlen(old.data);
- if (data.size + old.size + 2 > bufsiz)
- {
- if (buf != NULL)
- (void) free(buf);
- bufsiz = data.size + old.size + 2;
- buf = xalloc(bufsiz);
- }
- snprintf(buf, bufsiz, "%s,%s",
- (char *) data.data, (char *) old.data);
- data.size = data.size + old.size + 1;
- data.data = buf;
- if (tTd(38, 9))
- printf("db_map_store append=%s\n",
- (char *) data.data);
- }
- }
-#if DB_VERSION_MAJOR < 2
- stat = db->put(db, &key, &data, 0);
-#else
- stat = errno = db->put(db, NULL, &key, &data, 0);
-#endif
- }
- if (stat != 0)
- syserr("readaliases: db put (%s)", lhs);
-}
-
-
-/*
-** DB_MAP_CLOSE -- add distinguished entries and close the database
-*/
-
-void
-db_map_close(map)
- MAP *map;
-{
- register DB *db = map->map_db2;
-
- if (tTd(38, 9))
- printf("db_map_close(%s, %s, %lx)\n",
- map->map_mname, map->map_file, map->map_mflags);
-
- if (bitset(MF_WRITABLE, map->map_mflags))
- {
- /* write out the distinguished alias */
- db_map_store(map, "@", "@");
- }
-
- (void) db->sync(db, 0);
-
-#if !LOCK_ON_OPEN
- if (map->map_lockfd >= 0)
- (void) close(map->map_lockfd);
-#endif
-
-#if DB_VERSION_MAJOR < 2
- if (db->close(db) != 0)
-#else
- /*
- ** Berkeley DB can use internal shared memory
- ** locking for its memory pool. Closing a map
- ** opened by another process will interfere
- ** with the shared memory and locks of the parent
- ** process leaving things in a bad state.
- */
-
- /*
- ** If this map was not opened by the current
- ** process, do not close the map but recover
- ** the file descriptor.
- */
- if (map->map_pid != getpid())
- {
- int fd = -1;
-
- errno = db->fd(db, &fd);
- if (fd >= 0)
- (void) close(fd);
- return;
- }
-
- if ((errno = db->close(db, 0)) != 0)
-#endif
- syserr("db_map_close(%s, %s, %lx): db close failure",
- map->map_mname, map->map_file, map->map_mflags);
-}
-
-#endif
-\f/*
-** NIS Modules
-*/
-
-# ifdef NIS
-
-# ifndef YPERR_BUSY
-# define YPERR_BUSY 16
-# endif
-
-/*
-** NIS_MAP_OPEN -- open DBM map
-*/
-
-bool
-nis_map_open(map, mode)
- MAP *map;
- int mode;
-{
- int yperr;
- register char *p;
- auto char *vp;
- auto int vsize;
-
- if (tTd(38, 2))
- printf("nis_map_open(%s, %s, %d)\n",
- map->map_mname, map->map_file, mode);
-
- mode &= O_ACCMODE;
- if (mode != O_RDONLY)
- {
- /* issue a pseudo-error message */
-#ifdef ENOSYS
- errno = ENOSYS;
-#else
-# ifdef EFTYPE
- errno = EFTYPE;
-# else
- errno = ENXIO;
-# endif
-#endif
- return FALSE;
- }
-
- p = strchr(map->map_file, '@');
- if (p != NULL)
- {
- *p++ = '\0';
- if (*p != '\0')
- map->map_domain = p;
- }
-
- if (*map->map_file == '\0')
- map->map_file = "mail.aliases";
-
- if (map->map_domain == NULL)
- {
- yperr = yp_get_default_domain(&map->map_domain);
- if (yperr != 0)
- {
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- syserr("421 NIS map %s specified, but NIS not running",
- map->map_file);
- return FALSE;
- }
- }
-
- /* check to see if this map actually exists */
- yperr = yp_match(map->map_domain, map->map_file, "@", 1,
- &vp, &vsize);
- if (tTd(38, 10))
- printf("nis_map_open: yp_match(@, %s, %s) => %s\n",
- map->map_domain, map->map_file, yperr_string(yperr));
- if (yperr == 0 || yperr == YPERR_KEY || yperr == YPERR_BUSY)
- {
- /*
- ** We ought to be calling aliaswait() here if this is an
- ** alias file, but powerful HP-UX NIS servers apparently
- ** don't insert the @:@ token into the alias map when it
- ** is rebuilt, so aliaswait() just hangs. I hate HP-UX.
- */
-
-#if 0
- if (!bitset(MF_ALIAS, map->map_mflags) ||
- aliaswait(map, NULL, TRUE))
-#endif
- return TRUE;
- }
-
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- {
- syserr("421 Cannot bind to map %s in domain %s: %s",
- map->map_file, map->map_domain, yperr_string(yperr));
- }
-
- return FALSE;
-}
-
-
-/*
-** NIS_MAP_LOOKUP -- look up a datum in a NIS map
-*/
-
-/* ARGSUSED3 */
-char *
-nis_map_lookup(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- char *vp;
- auto int vsize;
- int buflen;
- int yperr;
- char keybuf[MAXNAME + 1];
-
- if (tTd(38, 20))
- printf("nis_map_lookup(%s, %s)\n",
- map->map_mname, name);
-
- buflen = strlen(name);
- if (buflen > sizeof keybuf - 1)
- buflen = sizeof keybuf - 1;
- bcopy(name, keybuf, buflen);
- keybuf[buflen] = '\0';
- if (!bitset(MF_NOFOLDCASE, map->map_mflags))
- makelower(keybuf);
- yperr = YPERR_KEY;
- if (bitset(MF_TRY0NULL, map->map_mflags))
- {
- yperr = yp_match(map->map_domain, map->map_file, keybuf, buflen,
- &vp, &vsize);
- if (yperr == 0)
- map->map_mflags &= ~MF_TRY1NULL;
- }
- if (yperr == YPERR_KEY && bitset(MF_TRY1NULL, map->map_mflags))
- {
- buflen++;
- yperr = yp_match(map->map_domain, map->map_file, keybuf, buflen,
- &vp, &vsize);
- if (yperr == 0)
- map->map_mflags &= ~MF_TRY0NULL;
- }
- if (yperr != 0)
- {
- if (yperr != YPERR_KEY && yperr != YPERR_BUSY)
- map->map_mflags &= ~(MF_VALID|MF_OPEN);
- return NULL;
- }
- if (bitset(MF_MATCHONLY, map->map_mflags))
- return map_rewrite(map, name, strlen(name), NULL);
- else
- return map_rewrite(map, vp, vsize, av);
-}
-
-
-/*
-** NIS_GETCANONNAME -- look up canonical name in NIS
-*/
-
-bool
-nis_getcanonname(name, hbsize, statp)
- char *name;
- int hbsize;
- int *statp;
-{
- char *vp;
- auto int vsize;
- int keylen;
- int yperr;
- static bool try0null = TRUE;
- static bool try1null = TRUE;
- static char *yp_domain = NULL;
- char host_record[MAXLINE];
- char cbuf[MAXNAME];
- char nbuf[MAXNAME + 1];
-
- if (tTd(38, 20))
- printf("nis_getcanonname(%s)\n", name);
-
- if (strlen(name) >= sizeof nbuf)
- {
- *statp = EX_UNAVAILABLE;
- return FALSE;
- }
- (void) strcpy(nbuf, name);
- shorten_hostname(nbuf);
- keylen = strlen(nbuf);
-
- if (yp_domain == NULL)
- yp_get_default_domain(&yp_domain);
- makelower(nbuf);
- yperr = YPERR_KEY;
- if (try0null)
- {
- yperr = yp_match(yp_domain, "hosts.byname", nbuf, keylen,
- &vp, &vsize);
- if (yperr == 0)
- try1null = FALSE;
- }
- if (yperr == YPERR_KEY && try1null)
- {
- keylen++;
- yperr = yp_match(yp_domain, "hosts.byname", nbuf, keylen,
- &vp, &vsize);
- if (yperr == 0)
- try0null = FALSE;
- }
- if (yperr != 0)
- {
- if (yperr == YPERR_KEY)
- *statp = EX_NOHOST;
- else if (yperr == YPERR_BUSY)
- *statp = EX_TEMPFAIL;
- else
- *statp = EX_UNAVAILABLE;
- return FALSE;
- }
- if (vsize >= sizeof host_record)
- vsize = sizeof host_record - 1;
- strncpy(host_record, vp, vsize);
- host_record[vsize] = '\0';
- if (tTd(38, 44))
- printf("got record `%s'\n", host_record);
- if (!extract_canonname(nbuf, host_record, cbuf, sizeof cbuf))
- {
- /* this should not happen, but.... */
- *statp = EX_NOHOST;
- return FALSE;
- }
- if (hbsize < strlen(cbuf))
- {
- *statp = EX_UNAVAILABLE;
- return FALSE;
- }
- strcpy(name, cbuf);
- *statp = EX_OK;
- return TRUE;
-}
-
-#endif
-\f/*
-** NISPLUS Modules
-**
-** This code donated by Sun Microsystems.
-*/
-
-#ifdef NISPLUS
-
-#undef NIS /* symbol conflict in nis.h */
-#undef T_UNSPEC /* symbol conflict in nis.h -> ... -> sys/tiuser.h */
-#include <rpcsvc/nis.h>
-#include <rpcsvc/nislib.h>
-
-#define EN_col(col) zo_data.objdata_u.en_data.en_cols.en_cols_val[(col)].ec_value.ec_value_val
-#define COL_NAME(res,i) ((res->objects.objects_val)->TA_data.ta_cols.ta_cols_val)[i].tc_name
-#define COL_MAX(res) ((res->objects.objects_val)->TA_data.ta_cols.ta_cols_len)
-#define PARTIAL_NAME(x) ((x)[strlen(x) - 1] != '.')
-
-/*
-** NISPLUS_MAP_OPEN -- open nisplus table
-*/
-
-bool
-nisplus_map_open(map, mode)
- MAP *map;
- int mode;
-{
- nis_result *res = NULL;
- int retry_cnt, max_col, i;
- char qbuf[MAXLINE + NIS_MAXNAMELEN];
-
- if (tTd(38, 2))
- printf("nisplus_map_open(%s, %s, %d)\n",
- map->map_mname, map->map_file, mode);
-
- mode &= O_ACCMODE;
- if (mode != O_RDONLY)
- {
- errno = EPERM;
- return FALSE;
- }
-
- if (*map->map_file == '\0')
- map->map_file = "mail_aliases.org_dir";
-
- if (PARTIAL_NAME(map->map_file) && map->map_domain == NULL)
- {
- /* set default NISPLUS Domain to $m */
- extern char *nisplus_default_domain __P((void));
-
- map->map_domain = newstr(nisplus_default_domain());
- if (tTd(38, 2))
- printf("nisplus_map_open(%s): using domain %s\n",
- map->map_file, map->map_domain);
- }
- if (!PARTIAL_NAME(map->map_file))
- {
- map->map_domain = newstr("");
- snprintf(qbuf, sizeof qbuf, "%s", map->map_file);
- }
- else
- {
- /* check to see if this map actually exists */
- snprintf(qbuf, sizeof qbuf, "%s.%s",
- map->map_file, map->map_domain);
- }
-
- retry_cnt = 0;
- while (res == NULL || res->status != NIS_SUCCESS)
- {
- res = nis_lookup(qbuf, FOLLOW_LINKS);
- switch (res->status)
- {
- case NIS_SUCCESS:
- break;
-
- case NIS_TRYAGAIN:
- case NIS_RPCERROR:
- case NIS_NAMEUNREACHABLE:
- if (retry_cnt++ > 4)
- {
- errno = EAGAIN;
- return FALSE;
- }
- /* try not to overwhelm hosed server */
- sleep(2);
- break;
-
- default: /* all other nisplus errors */
-#if 0
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- syserr("421 Cannot find table %s.%s: %s",
- map->map_file, map->map_domain,
- nis_sperrno(res->status));
-#endif
- errno = EAGAIN;
- return FALSE;
- }
- }
-
- if (NIS_RES_NUMOBJ(res) != 1 ||
- (NIS_RES_OBJECT(res)->zo_data.zo_type != TABLE_OBJ))
- {
- if (tTd(38, 10))
- printf("nisplus_map_open: %s is not a table\n", qbuf);
-#if 0
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- syserr("421 %s.%s: %s is not a table",
- map->map_file, map->map_domain,
- nis_sperrno(res->status));
-#endif
- errno = EBADF;
- return FALSE;
- }
- /* default key column is column 0 */
- if (map->map_keycolnm == NULL)
- map->map_keycolnm = newstr(COL_NAME(res,0));
-
- max_col = COL_MAX(res);
-
- /* verify the key column exist */
- for (i=0; i< max_col; i++)
- {
- if (!strcmp(map->map_keycolnm, COL_NAME(res,i)))
- break;
- }
- if (i == max_col)
- {
- if (tTd(38, 2))
- printf("nisplus_map_open(%s): can not find key column %s\n",
- map->map_file, map->map_keycolnm);
- errno = ENOENT;
- return FALSE;
- }
-
- /* default value column is the last column */
- if (map->map_valcolnm == NULL)
- {
- map->map_valcolno = max_col - 1;
- return TRUE;
- }
-
- for (i=0; i< max_col; i++)
- {
- if (strcmp(map->map_valcolnm, COL_NAME(res,i)) == 0)
- {
- map->map_valcolno = i;
- return TRUE;
- }
- }
-
- if (tTd(38, 2))
- printf("nisplus_map_open(%s): can not find column %s\n",
- map->map_file, map->map_keycolnm);
- errno = ENOENT;
- return FALSE;
-}
-
-
-/*
-** NISPLUS_MAP_LOOKUP -- look up a datum in a NISPLUS table
-*/
-
-char *
-nisplus_map_lookup(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- char *p;
- auto int vsize;
- char *skp;
- int skleft;
- char search_key[MAXNAME + 4];
- char qbuf[MAXLINE + NIS_MAXNAMELEN];
- nis_result *result;
-
- if (tTd(38, 20))
- printf("nisplus_map_lookup(%s, %s)\n",
- map->map_mname, name);
-
- if (!bitset(MF_OPEN, map->map_mflags))
- {
- if (nisplus_map_open(map, O_RDONLY))
- {
- map->map_mflags |= MF_OPEN;
- map->map_pid = getpid();
- }
- else
- {
- *statp = EX_UNAVAILABLE;
- return NULL;
- }
- }
-
- /*
- ** Copy the name to the key buffer, escaping double quote characters
- ** by doubling them and quoting "]" and "," to avoid having the
- ** NIS+ parser choke on them.
- */
-
- skleft = sizeof search_key - 4;
- skp = search_key;
- for (p = name; *p != '\0' && skleft > 0; p++)
- {
- switch (*p)
- {
- case ']':
- case ',':
- /* quote the character */
- *skp++ = '"';
- *skp++ = *p;
- *skp++ = '"';
- skleft -= 3;
- break;
-
- case '"':
- /* double the quote */
- *skp++ = '"';
- skleft--;
- /* fall through... */
-
- default:
- *skp++ = *p;
- skleft--;
- break;
- }
- }
- *skp = '\0';
- if (!bitset(MF_NOFOLDCASE, map->map_mflags))
- makelower(search_key);
-
- /* construct the query */
- if (PARTIAL_NAME(map->map_file))
- snprintf(qbuf, sizeof qbuf, "[%s=%s],%s.%s",
- map->map_keycolnm, search_key, map->map_file,
- map->map_domain);
- else
- snprintf(qbuf, sizeof qbuf, "[%s=%s],%s",
- map->map_keycolnm, search_key, map->map_file);
-
- if (tTd(38, 20))
- printf("qbuf=%s\n", qbuf);
- result = nis_list(qbuf, FOLLOW_LINKS | FOLLOW_PATH, NULL, NULL);
- if (result->status == NIS_SUCCESS)
- {
- int count;
- char *str;
-
- if ((count = NIS_RES_NUMOBJ(result)) != 1)
- {
- if (LogLevel > 10)
- sm_syslog(LOG_WARNING, CurEnv->e_id,
- "%s: lookup error, expected 1 entry, got %d",
- map->map_file, count);
-
- /* ignore second entry */
- if (tTd(38, 20))
- printf("nisplus_map_lookup(%s), got %d entries, additional entries ignored\n",
- name, count);
- }
-
- p = ((NIS_RES_OBJECT(result))->EN_col(map->map_valcolno));
- /* set the length of the result */
- if (p == NULL)
- p = "";
- vsize = strlen(p);
- if (tTd(38, 20))
- printf("nisplus_map_lookup(%s), found %s\n",
- name, p);
- if (bitset(MF_MATCHONLY, map->map_mflags))
- str = map_rewrite(map, name, strlen(name), NULL);
- else
- str = map_rewrite(map, p, vsize, av);
- nis_freeresult(result);
- *statp = EX_OK;
- return str;
- }
- else
- {
- if (result->status == NIS_NOTFOUND)
- *statp = EX_NOTFOUND;
- else if (result->status == NIS_TRYAGAIN)
- *statp = EX_TEMPFAIL;
- else
- {
- *statp = EX_UNAVAILABLE;
- map->map_mflags &= ~(MF_VALID|MF_OPEN);
- }
- }
- if (tTd(38, 20))
- printf("nisplus_map_lookup(%s), failed\n", name);
- nis_freeresult(result);
- return NULL;
-}
-
-
-
-/*
-** NISPLUS_GETCANONNAME -- look up canonical name in NIS+
-*/
-
-bool
-nisplus_getcanonname(name, hbsize, statp)
- char *name;
- int hbsize;
- int *statp;
-{
- char *vp;
- auto int vsize;
- nis_result *result;
- char *p;
- char nbuf[MAXNAME + 1];
- char qbuf[MAXLINE + NIS_MAXNAMELEN];
-
- if (strlen(name) >= sizeof nbuf)
- {
- *statp = EX_UNAVAILABLE;
- return FALSE;
- }
- (void) strcpy(nbuf, name);
- shorten_hostname(nbuf);
-
- p = strchr(nbuf, '.');
- if (p == NULL)
- {
- /* single token */
- snprintf(qbuf, sizeof qbuf, "[name=%s],hosts.org_dir", nbuf);
- }
- else if (p[1] != '\0')
- {
- /* multi token -- take only first token in nbuf */
- *p = '\0';
- snprintf(qbuf, sizeof qbuf, "[name=%s],hosts.org_dir.%s",
- nbuf, &p[1]);
- }
- else
- {
- *statp = EX_NOHOST;
- return FALSE;
- }
-
- if (tTd(38, 20))
- printf("\nnisplus_getcanoname(%s), qbuf=%s\n",
- name, qbuf);
-
- result = nis_list(qbuf, EXPAND_NAME|FOLLOW_LINKS|FOLLOW_PATH,
- NULL, NULL);
-
- if (result->status == NIS_SUCCESS)
- {
- int count;
- char *domain;
-
- if ((count = NIS_RES_NUMOBJ(result)) != 1)
- {
- if (LogLevel > 10)
- sm_syslog(LOG_WARNING, CurEnv->e_id,
- "nisplus_getcanonname: lookup error, expected 1 entry, got %d",
- count);
-
- /* ignore second entry */
- if (tTd(38, 20))
- printf("nisplus_getcanoname(%s), got %d entries, all but first ignored\n",
- name, count);
- }
-
- if (tTd(38, 20))
- printf("nisplus_getcanoname(%s), found in directory \"%s\"\n",
- name, (NIS_RES_OBJECT(result))->zo_domain);
-
-
- vp = ((NIS_RES_OBJECT(result))->EN_col(0));
- vsize = strlen(vp);
- if (tTd(38, 20))
- printf("nisplus_getcanonname(%s), found %s\n",
- name, vp);
- if (strchr(vp, '.') != NULL)
- {
- domain = "";
- }
- else
- {
- domain = macvalue('m', CurEnv);
- if (domain == NULL)
- domain = "";
- }
- if (hbsize > vsize + (int) strlen(domain) + 1)
- {
- if (domain[0] == '\0')
- strcpy(name, vp);
- else
- snprintf(name, hbsize, "%s.%s", vp, domain);
- *statp = EX_OK;
- }
- else
- *statp = EX_NOHOST;
- nis_freeresult(result);
- return TRUE;
- }
- else
- {
- if (result->status == NIS_NOTFOUND)
- *statp = EX_NOHOST;
- else if (result->status == NIS_TRYAGAIN)
- *statp = EX_TEMPFAIL;
- else
- *statp = EX_UNAVAILABLE;
- }
- if (tTd(38, 20))
- printf("nisplus_getcanonname(%s), failed, status=%d, nsw_stat=%d\n",
- name, result->status, *statp);
- nis_freeresult(result);
- return FALSE;
-}
-
-
-char *
-nisplus_default_domain()
-{
- static char default_domain[MAXNAME + 1] = "";
- char *p;
-
- if (default_domain[0] != '\0')
- return(default_domain);
-
- p = nis_local_directory();
- snprintf(default_domain, sizeof default_domain, "%s", p);
- return default_domain;
-}
-
-#endif /* NISPLUS */
-\f/*
-** LDAP Modules
-**
-** Contributed by Booker C. Bense <bbense@networking.stanford.edu>.
-** Get your support from him.
-*/
-
-#ifdef LDAPMAP
-
-# undef NEEDGETOPT /* used for something else in LDAP */
-
-# include <lber.h>
-# include <ldap.h>
-# include "ldap_map.h"
-
-/*
-** LDAP_MAP_OPEN -- open LDAP map
-**
-** Since LDAP is TCP-based there is not much we can or should do
-** here. It might be a good idea to attempt an open/close here.
-*/
-
-bool
-ldap_map_open(map, mode)
- MAP *map;
- int mode;
-{
- if (tTd(38, 2))
- printf("ldap_map_open(%s, %d)\n", map->map_mname, mode);
-
- mode &= O_ACCMODE;
- if (mode != O_RDONLY)
- {
- /* issue a pseudo-error message */
-#ifdef ENOSYS
- errno = ENOSYS;
-#else
-# ifdef EFTYPE
- errno = EFTYPE;
-# else
- errno = ENXIO;
-# endif
-#endif
- return FALSE;
- }
- return TRUE;
-}
-
-
-/*
-** LDAP_MAP_START -- actually open LDAP map
-**
-** Caching should be investigated.
-*/
-
-static jmp_buf LDAPTimeout;
-
-static void
-ldaptimeout(sig_no)
- int sig_no;
-{
- longjmp(LDAPTimeout, 1);
-}
-
-bool
-ldap_map_start(map)
- MAP *map;
-{
- LDAP_MAP_STRUCT *lmap;
- LDAP *ld;
- register EVENT *ev = NULL;
-
- if (tTd(38, 2))
- printf("ldap_map_start(%s)\n", map->map_mname);
-
- lmap = (LDAP_MAP_STRUCT *) map->map_db1;
-
- if (tTd(38,9))
- printf("ldap_open(%s, %d)\n", lmap->ldaphost, lmap->ldapport);
-
- /* Need to set an alarm here, ldap_open is hopelessly broken. */
-
- /* set the timeout */
- if (lmap->timeout.tv_sec != 0)
- {
- if (setjmp(LDAPTimeout) != 0)
- {
- if (LogLevel > 1)
- sm_syslog(LOG_NOTICE, CurEnv->e_id,
- "timeout waiting for ldap_open to %.100s",
- lmap->ldaphost);
- return (FALSE);
- }
- ev = setevent(lmap->timeout.tv_sec, ldaptimeout, 0);
- }
-
-#ifdef USE_LDAP_INIT
- ld = ldap_init(lmap->ldaphost,lmap->ldapport);
-#else
- ld = ldap_open(lmap->ldaphost,lmap->ldapport);
-#endif
-
- /* clear the event if it has not sprung */
- if (lmap->timeout.tv_sec != 0)
- clrevent(ev);
-
- if (ld == NULL)
- {
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- {
- syserr("%sldapopen failed to %s in map %s",
- bitset(MF_NODEFER, map->map_mflags) ? "" : "421 ",
- lmap->ldaphost, map->map_mname);
- }
- return FALSE;
- }
-
-#ifdef USE_LDAP_SET_OPTION
- ldap_set_option(ld, LDAP_OPT_DEREF, &lmap->deref);
- ldap_set_option(ld, LDAP_OPT_TIMELIMIT, &lmap->timelimit);
- ldap_set_option(ld, LDAP_OPT_SIZELIMIT, &lmap->sizelimit);
- ldap_set_option(ld, LDAP_OPT_REFERRALS,
- bitset(LDAP_OPT_REFERRALS, lmap->ldap_options) ?
- LDAP_OPT_ON : LDAP_OPT_OFF);
-#else
- /* From here on in we can use ldap internal timelimits */
- ld->ld_deref = lmap->deref;
- ld->ld_timelimit = lmap->timelimit;
- ld->ld_sizelimit = lmap->sizelimit;
- ld->ld_options = lmap->ldap_options;
-#endif
-
-#ifdef USE_LDAP_INIT
- /* ld needs to be cast into the map struct */
- lmap->ld = ld;
- return TRUE;
-#else
- if (ldap_bind_s(ld, lmap->binddn,lmap->passwd,lmap->method) != LDAP_SUCCESS)
- {
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- {
- syserr("421 Cannot bind to map %s in ldap server %s",
- map->map_mname, lmap->ldaphost);
- }
- }
- else
- {
- /* We need to cast ld into the map structure */
- lmap->ld = ld;
- return TRUE;
- }
-
- return FALSE;
-#endif
-}
-
-
-/*
-** LDAP_MAP_STOP -- close the ldap connection
-*/
-
-void
-ldap_map_stop(map)
- MAP *map;
-{
- LDAP_MAP_STRUCT *lmap;
-
- lmap = (LDAP_MAP_STRUCT *) map->map_db1;
- if (lmap->ld != NULL)
- {
- ldap_unbind(lmap->ld);
- lmap->ld = NULL;
- }
-}
-
-/*
-** LDAP_MAP_CLOSE -- close ldap map
-*/
-
-void
-ldap_map_close(map)
- MAP *map;
-{
- ldap_map_stop(map);
-}
-
-#ifdef SUNET_ID
-/*
-** SUNET_ID_HASH -- Convert a string to it's Sunet_id canonical form
-** This only makes sense at Stanford University.
-*/
-
-char *
-sunet_id_hash(str)
- char *str;
-{
- char *p, *p_last;
-
- p = str;
- p_last = p;
- while (*p != '\0')
- {
- if (islower(*p) || isdigit(*p))
- {
- *p_last = *p;
- p_last++;
- }
- else if (isupper(*p))
- {
- *p_last = tolower(*p);
- p_last++;
- }
- ++p;
- }
- if (*p_last != '\0')
- *p_last = '\0';
- return (str);
-}
-
-
-
-#endif /* SUNET_ID */
-/*
-** LDAP_MAP_LOOKUP -- look up a datum in a LDAP map
-*/
-
-char *
-ldap_map_lookup(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- LDAP_MAP_STRUCT *lmap = NULL;
- LDAPMessage *entry;
- char *vp;
- auto int vsize;
- char keybuf[MAXNAME + 1];
- char filter[LDAP_MAP_MAX_FILTER + 1];
- char **attr_values = NULL;
- char *result;
- int name_len;
- char *fp, *p, *q;
-
- if (tTd(38, 20))
- printf("ldap_map_lookup(%s, %s)\n", map->map_mname, name);
-
- /* actually open the map */
- if (!ldap_map_start(map))
- {
- result = NULL;
- *statp = EX_TEMPFAIL;
- goto quick_exit;
- }
-
- /* Get ldap struct pointer from map */
- lmap = (LDAP_MAP_STRUCT *) map->map_db1;
-
- name_len = strlen(name);
- if (name_len > MAXNAME)
- name_len = MAXNAME;
- strncpy(keybuf, name, name_len);
- keybuf[name_len] = '\0';
-
- if (!bitset(MF_NOFOLDCASE, map->map_mflags))
-#ifdef SUNET_ID
- sunet_id_hash(keybuf);
-#else
- makelower(keybuf);
-#endif /*SUNET_ID */
-
- /* substitute keybuf into filter, perhaps multiple times */
- fp = filter;
- p = lmap->filter;
- while ((q = strchr(p, '%')) != NULL)
- {
- if (q[1] == 's')
- {
- snprintf(fp, SPACELEFT(filter, fp), "%.*s%s",
- q - p, p, keybuf);
- p = q + 2;
- }
- else
- {
- snprintf(fp, SPACELEFT(filter, fp), "%.*s",
- q - p + 1, p);
- p = q + (q[1] == '%' ? 2 : 1);
- }
- fp += strlen(fp);
- }
- snprintf(fp, SPACELEFT(filter, fp), "%s", p);
- if (tTd(38, 20))
- printf("ldap search filter=%s\n", filter);
-
- if (ldap_search_st(lmap->ld, lmap->base,lmap->scope,filter,
- lmap->attr, lmap->attrsonly, &(lmap->timeout),
- &(lmap->res)) != LDAP_SUCCESS)
- {
- /* try stopping/starting map */
- ldap_map_stop(map);
- if (!ldap_map_start(map))
- {
- result = NULL;
- *statp = EX_TEMPFAIL;
- goto quick_exit;
- }
- if (ldap_search_st(lmap->ld, lmap->base, lmap->scope, filter,
- lmap->attr, lmap->attrsonly,
- &(lmap->timeout), &(lmap->res))
- != LDAP_SUCCESS)
- {
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- {
- syserr("%sError in ldap_search_st using %s in map %s",
- bitset(MF_NODEFER, map->map_mflags) ? "" : "421 ",
- filter, map->map_mname);
- }
- result = NULL;
- *statp = EX_TEMPFAIL;
- goto quick_exit;
- }
- }
-
- entry = ldap_first_entry(lmap->ld,lmap->res);
- if (entry == NULL)
- {
- result = NULL;
- *statp = EX_NOTFOUND;
- goto quick_exit;
- }
-
- /* Need to build the args for map_rewrite here */
- attr_values = ldap_get_values(lmap->ld,entry,lmap->attr[0]);
- if (attr_values == NULL)
- {
- /* bad things happened */
- result = NULL;
- *statp = EX_NOTFOUND;
- goto quick_exit;
- }
-
- *statp = EX_OK;
-
- /* If there is more that one use the first */
- vp = attr_values[0];
- vsize = strlen(vp);
-
- if (LogLevel > 9)
- sm_syslog(LOG_INFO, CurEnv->e_id,
- "ldap %.100s => %s",
- name, vp);
- if (bitset(MF_MATCHONLY, map->map_mflags))
- result = map_rewrite(map, name, strlen(name), NULL);
- else
- result = map_rewrite(map, vp, vsize, av);
-
- quick_exit:
- if (attr_values != NULL)
- ldap_value_free(attr_values);
- if (lmap != NULL)
- ldap_msgfree(lmap->res);
- ldap_map_stop(map);
- return result ;
-}
-
-
-/*
-** LDAP_MAP_DEQUOTE - helper routine for ldap_map_parseargs
-*/
-
-char *
-ldap_map_dequote(str)
- char *str;
-{
- char *p;
- char *start;
- p = str;
-
- if (*p == '"')
- {
- start = ++p;
- /* Should probably swallow initial whitespace here */
- }
- else
- {
- return(str);
- }
- while (*p != '"' && *p != '\0')
- {
- p++;
- }
- if (*p != '\0')
- *p = '\0';
- return start;
-}
-
-/*
-** LDAP_MAP_PARSEARGS -- parse ldap map definition args.
-*/
-
-bool
-ldap_map_parseargs(map,args)
- MAP *map;
- char *args;
-{
- register char *p = args;
- register int done;
- LDAP_MAP_STRUCT *lmap;
-
- /* We need to alloc an LDAP_MAP_STRUCT struct */
- lmap = (LDAP_MAP_STRUCT *) xalloc(sizeof(LDAP_MAP_STRUCT));
-
- /* Set default int's here , default strings below */
- lmap->ldapport = DEFAULT_LDAP_MAP_PORT;
- lmap->deref = DEFAULT_LDAP_MAP_DEREF;
- lmap->timelimit = DEFAULT_LDAP_MAP_TIMELIMIT;
- lmap->sizelimit = DEFAULT_LDAP_MAP_SIZELIMIT;
- lmap->ldap_options = DEFAULT_LDAP_MAP_LDAP_OPTIONS;
- lmap->method = DEFAULT_LDAP_MAP_METHOD;
- lmap->scope = DEFAULT_LDAP_MAP_SCOPE;
- lmap->attrsonly = DEFAULT_LDAP_MAP_ATTRSONLY;
- lmap->timeout.tv_sec = DEFAULT_LDAP_MAP_TIMELIMIT;
- lmap->timeout.tv_usec = 0;
-
- /* Default char ptrs to NULL */
- lmap->binddn = NULL;
- lmap->passwd = NULL;
- lmap->base = NULL;
- lmap->ldaphost = NULL;
-
- /* Default general ptrs to NULL */
- lmap->ld = NULL;
- lmap->res = NULL;
-
- map->map_mflags |= MF_TRY0NULL | MF_TRY1NULL;
- for (;;)
- {
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p != '-')
- break;
- switch (*++p)
- {
- case 'N':
- map->map_mflags |= MF_INCLNULL;
- map->map_mflags &= ~MF_TRY0NULL;
- break;
-
- case 'O':
- map->map_mflags &= ~MF_TRY1NULL;
- break;
-
- case 'o':
- map->map_mflags |= MF_OPTIONAL;
- break;
-
- case 'f':
- map->map_mflags |= MF_NOFOLDCASE;
- break;
-
- case 'm':
- map->map_mflags |= MF_MATCHONLY;
- break;
-
- case 'A':
- map->map_mflags |= MF_APPEND;
- break;
-
- case 'q':
- map->map_mflags |= MF_KEEPQUOTES;
- break;
-
- case 't':
- map->map_mflags |= MF_NODEFER;
- break;
-
- case 'a':
- map->map_app = ++p;
- break;
-
- case 'T':
- map->map_tapp = ++p;
- break;
-
- /* Start of ldap_map specific args */
- case 'k': /* search field */
- while (isascii(*++p) && isspace(*p))
- continue;
- lmap->filter = p;
- break;
-
- case 'v': /* attr to return */
- while (isascii(*++p) && isspace(*p))
- continue;
- lmap->attr[0] = p;
- lmap->attr[1] = NULL;
- break;
-
- /* args stolen from ldapsearch.c */
- case 'R': /* don't auto chase referrals */
-#ifdef LDAP_REFERRALS
- lmap->ldap_options &= ~LDAP_OPT_REFERRALS;
-#else /* LDAP_REFERRALS */
- syserr("compile with -DLDAP_REFERRALS for referral support\n");
-#endif /* LDAP_REFERRALS */
- break;
-
- case 'n': /* retrieve attribute names only -- no values */
- lmap->attrsonly += 1;
- break;
-
- case 's': /* search scope */
- if (strncasecmp(++p, "base", 4) == 0)
- {
- lmap->scope = LDAP_SCOPE_BASE;
- }
- else if (strncasecmp(p, "one", 3) == 0)
- {
- lmap->scope = LDAP_SCOPE_ONELEVEL;
- }
- else if (strncasecmp(p, "sub", 3) == 0)
- {
- lmap->scope = LDAP_SCOPE_SUBTREE;
- }
- else
- { /* bad config line */
- if (!bitset(MCF_OPTFILE, map->map_class->map_cflags))
- {
- char *ptr;
-
- if ((ptr = strchr(p, ' ')) != NULL)
- *ptr = '\0';
- syserr("Scope must be [base|one|sub] not %s in map %s",
- p, map->map_mname);
- if (ptr != NULL)
- *ptr = ' ';
- return FALSE;
- }
- }
- break;
-
- case 'h': /* ldap host */
- while (isascii(*++p) && isspace(*p))
- continue;
- map->map_domain = p;
- lmap->ldaphost = p;
- break;
-
- case 'b': /* search base */
- while (isascii(*++p) && isspace(*p))
- continue;
- lmap->base = p;
- break;
-
- case 'p': /* ldap port */
- while (isascii(*++p) && isspace(*p))
- continue;
- lmap->ldapport = atoi(p);
- break;
-
- case 'l': /* time limit */
- while (isascii(*++p) && isspace(*p))
- continue;
- lmap->timelimit = atoi(p);
- lmap->timeout.tv_sec = lmap->timelimit;
- break;
-
- }
-
- /* need to account for quoted strings here arggg... */
- done = isascii(*p) && isspace(*p);
- while (*p != '\0' && !done)
- {
- if (*p == '"')
- {
- while (*++p != '"' && *p != '\0')
- {
- continue;
- }
- if (*p != '\0')
- p++;
- }
- else
- {
- p++;
- }
- done = isascii(*p) && isspace(*p);
- }
-
- if (*p != '\0')
- *p++ = '\0';
- }
-
- if (map->map_app != NULL)
- map->map_app = newstr(ldap_map_dequote(map->map_app));
- if (map->map_tapp != NULL)
- map->map_tapp = newstr(ldap_map_dequote(map->map_tapp));
- if (map->map_domain != NULL)
- map->map_domain = newstr(ldap_map_dequote(map->map_domain));
-
- /*
- ** We need to swallow up all the stuff into a struct
- ** and dump it into map->map_dbptr1
- */
-
- if (lmap->ldaphost != NULL)
- lmap->ldaphost = newstr(ldap_map_dequote(lmap->ldaphost));
- else
- {
- syserr("LDAP map: -h flag is required");
- return FALSE;
- }
-
- if (lmap->binddn != NULL)
- lmap->binddn = newstr(ldap_map_dequote(lmap->binddn));
- else
- lmap->binddn = DEFAULT_LDAP_MAP_BINDDN;
-
-
- if (lmap->passwd != NULL)
- lmap->passwd = newstr(ldap_map_dequote(lmap->passwd));
- else
- lmap->passwd = DEFAULT_LDAP_MAP_PASSWD;
-
- if (lmap->base != NULL)
- lmap->base = newstr(ldap_map_dequote(lmap->base));
- else
- {
- syserr("LDAP map: -b flag is required");
- return FALSE;
- }
-
-
- if (lmap->filter != NULL)
- lmap->filter = newstr(ldap_map_dequote(lmap->filter));
- else
- {
- if (!bitset(MCF_OPTFILE, map->map_class->map_cflags))
- {
- syserr("No filter given in map %s", map->map_mname);
- return FALSE;
- }
- }
- if (lmap->attr[0] != NULL)
- lmap->attr[0] = newstr(ldap_map_dequote(lmap->attr[0]));
- else
- {
- if (!bitset(MCF_OPTFILE, map->map_class->map_cflags))
- {
- syserr("No return attribute in %s", map->map_mname);
- return FALSE;
- }
- }
-
- map->map_db1 = (ARBPTR_T) lmap;
- return TRUE;
-}
-
-#endif /* LDAP Modules */
-\f/*
-** syslog map
-*/
-
-#if _FFR_MAP_SYSLOG
-
-#define map_prio map_lockfd /* overload field */
-
-/*
-** SYSLOG_MAP_PARSEARGS -- check for priority level to syslog messages.
-*/
-
-bool
-syslog_map_parseargs(map, args)
- MAP *map;
- char *args;
-{
- char *p = args;
- char *priority = NULL;
-
- for (;;)
- {
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p != '-')
- break;
- if (*++p == 'L')
- priority = ++p;
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- if (*p != '\0')
- *p++ = '\0';
- }
-
- if (priority == NULL)
- map->map_prio = LOG_INFO;
- else
- {
- if (strncasecmp("LOG_", priority, 4) == 0)
- priority += 4;
-
-#ifdef LOG_EMERG
- if (strcasecmp("EMERG", priority) == 0)
- map->map_prio = LOG_EMERG;
- else
-#endif
-#ifdef LOG_ALERT
- if (strcasecmp("ALERT", priority) == 0)
- map->map_prio = LOG_ALERT;
- else
-#endif
-#ifdef LOG_CRIT
- if (strcasecmp("CRIT", priority) == 0)
- map->map_prio = LOG_CRIT;
- else
-#endif
-#ifdef LOG_ERR
- if (strcasecmp("ERR", priority) == 0)
- map->map_prio = LOG_ERR;
- else
-#endif
-#ifdef LOG_WARNING
- if (strcasecmp("WARNING", priority) == 0)
- map->map_prio = LOG_WARNING;
- else
-#endif
-#ifdef LOG_NOTICE
- if (strcasecmp("NOTICE", priority) == 0)
- map->map_prio = LOG_NOTICE;
- else
-#endif
-#ifdef LOG_INFO
- if (strcasecmp("INFO", priority) == 0)
- map->map_prio = LOG_INFO;
- else
-#endif
-#ifdef LOG_DEBUG
- if (strcasecmp("DEBUG", priority) == 0)
- map->map_prio = LOG_DEBUG;
- else
-#endif
- {
- syserr("syslog_map_parseargs: Unknown priority %s\n",
- priority);
- return FALSE;
- }
- }
- return TRUE;
-}
-
-/*
-** SYSLOG_MAP_LOOKUP -- rewrite and syslog message. Always return empty string
-*/
-
-char *
-syslog_map_lookup(map, string, args, statp)
- MAP *map;
- char *string;
- char **args;
- int *statp;
-{
- char *ptr = map_rewrite(map, string, strlen(string), args);
-
- if (ptr != NULL)
- {
- if (tTd(38, 20))
- printf("syslog_map_lookup(%s (priority %d): %s\n",
- map->map_mname, map->map_prio, ptr);
-
- sm_syslog(map->map_prio, CurEnv->e_id, "%s", ptr);
- }
-
- *statp = EX_OK;
- return "";
-}
-
-#endif /* _FFR_MAP_SYSLOG */
-\f/*
-** HESIOD Modules
-*/
-
-#ifdef HESIOD
-
-bool
-hes_map_open(map, mode)
- MAP *map;
- int mode;
-{
- if (tTd(38, 2))
- printf("hes_map_open(%s, %s, %d)\n",
- map->map_mname, map->map_file, mode);
-
- if (mode != O_RDONLY)
- {
- /* issue a pseudo-error message */
-#ifdef ENOSYS
- errno = ENOSYS;
-#else
-# ifdef EFTYPE
- errno = EFTYPE;
-# else
- errno = ENXIO;
-# endif
-#endif
- return FALSE;
- }
-
-#ifdef HESIOD_INIT
- if (HesiodContext != NULL || hesiod_init(&HesiodContext) == 0)
- return TRUE;
-
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- syserr("421 cannot initialize Hesiod map (%s)",
- errstring(errno));
- return FALSE;
-#else
- if (hes_error() == HES_ER_UNINIT)
- hes_init();
- switch (hes_error())
- {
- case HES_ER_OK:
- case HES_ER_NOTFOUND:
- return TRUE;
- }
-
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- syserr("421 cannot initialize Hesiod map (%d)", hes_error());
-
- return FALSE;
-#endif /* HESIOD_INIT */
-}
-
-char *
-hes_map_lookup(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- char **hp;
-
- if (tTd(38, 20))
- printf("hes_map_lookup(%s, %s)\n", map->map_file, name);
-
- if (name[0] == '\\')
- {
- char *np;
- int nl;
- char nbuf[MAXNAME];
-
- nl = strlen(name);
- if (nl < sizeof nbuf - 1)
- np = nbuf;
- else
- np = xalloc(strlen(name) + 2);
- np[0] = '\\';
- strcpy(&np[1], name);
-#ifdef HESIOD_INIT
- hp = hesiod_resolve(HesiodContext, np, map->map_file);
-#else
- hp = hes_resolve(np, map->map_file);
-#endif /* HESIOD_INIT */
- if (np != nbuf)
- free(np);
- }
- else
- {
-#ifdef HESIOD_INIT
- hp = hesiod_resolve(HesiodContext, name, map->map_file);
-#else
- hp = hes_resolve(name, map->map_file);
-#endif /* HESIOD_INIT */
- }
-#ifdef HESIOD_INIT
- if (hp == NULL)
- return NULL;
- if (*hp == NULL)
- {
- hesiod_free_list(HesiodContext, hp);
- switch (errno)
- {
- case ENOENT:
- *statp = EX_NOTFOUND;
- break;
- case ECONNREFUSED:
- case EMSGSIZE:
- *statp = EX_TEMPFAIL;
- break;
- case ENOMEM:
- default:
- *statp = EX_UNAVAILABLE;
- break;
- }
- return NULL;
- }
-#else
- if (hp == NULL || hp[0] == NULL)
- {
- switch (hes_error())
- {
- case HES_ER_OK:
- *statp = EX_OK;
- break;
-
- case HES_ER_NOTFOUND:
- *statp = EX_NOTFOUND;
- break;
-
- case HES_ER_CONFIG:
- *statp = EX_UNAVAILABLE;
- break;
-
- case HES_ER_NET:
- *statp = EX_TEMPFAIL;
- break;
- }
- return NULL;
- }
-#endif /* HESIOD_INIT */
-
- if (bitset(MF_MATCHONLY, map->map_mflags))
- return map_rewrite(map, name, strlen(name), NULL);
- else
- return map_rewrite(map, hp[0], strlen(hp[0]), av);
-}
-
-#endif
-\f/*
-** NeXT NETINFO Modules
-*/
-
-#if NETINFO
-
-# define NETINFO_DEFAULT_DIR "/aliases"
-# define NETINFO_DEFAULT_PROPERTY "members"
-
-extern char *ni_propval __P((char *, char *, char *, char *, int));
-
-
-/*
-** NI_MAP_OPEN -- open NetInfo Aliases
-*/
-
-bool
-ni_map_open(map, mode)
- MAP *map;
- int mode;
-{
- if (tTd(38, 2))
- printf("ni_map_open(%s, %s, %d)\n",
- map->map_mname, map->map_file, mode);
- mode &= O_ACCMODE;
-
- if (*map->map_file == '\0')
- map->map_file = NETINFO_DEFAULT_DIR;
-
- if (map->map_valcolnm == NULL)
- map->map_valcolnm = NETINFO_DEFAULT_PROPERTY;
-
- if (map->map_coldelim == '\0' && bitset(MF_ALIAS, map->map_mflags))
- map->map_coldelim = ',';
-
- return TRUE;
-}
-
-
-/*
-** NI_MAP_LOOKUP -- look up a datum in NetInfo
-*/
-
-char *
-ni_map_lookup(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- char *res;
- char *propval;
-
- if (tTd(38, 20))
- printf("ni_map_lookup(%s, %s)\n", map->map_mname, name);
-
- propval = ni_propval(map->map_file, map->map_keycolnm, name,
- map->map_valcolnm, map->map_coldelim);
-
- if (propval == NULL)
- return NULL;
-
- if (bitset(MF_MATCHONLY, map->map_mflags))
- res = map_rewrite(map, name, strlen(name), NULL);
- else
- res = map_rewrite(map, propval, strlen(propval), av);
- free(propval);
- return res;
-}
-
-
-bool
-ni_getcanonname(name, hbsize, statp)
- char *name;
- int hbsize;
- int *statp;
-{
- char *vptr;
- char *ptr;
- char nbuf[MAXNAME + 1];
-
- if (tTd(38, 20))
- printf("ni_getcanonname(%s)\n", name);
-
- if (strlen(name) >= sizeof nbuf)
- {
- *statp = EX_UNAVAILABLE;
- return FALSE;
- }
- (void) strcpy(nbuf, name);
- shorten_hostname(nbuf);
-
- /* we only accept single token search key */
- if (strchr(nbuf, '.'))
- {
- *statp = EX_NOHOST;
- return FALSE;
- }
-
- /* Do the search */
- vptr = ni_propval("/machines", NULL, nbuf, "name", '\n');
-
- if (vptr == NULL)
- {
- *statp = EX_NOHOST;
- return FALSE;
- }
-
- /* Only want the first machine name */
- if ((ptr = strchr(vptr, '\n')) != NULL)
- *ptr = '\0';
-
- if (hbsize >= strlen(vptr))
- {
- strcpy(name, vptr);
- *statp = EX_OK;
- return TRUE;
- }
- *statp = EX_UNAVAILABLE;
- free(vptr);
- return FALSE;
-}
-
-
-/*
-** NI_PROPVAL -- NetInfo property value lookup routine
-**
-** Parameters:
-** keydir -- the NetInfo directory name in which to search
-** for the key.
-** keyprop -- the name of the property in which to find the
-** property we are interested. Defaults to "name".
-** keyval -- the value for which we are really searching.
-** valprop -- the property name for the value in which we
-** are interested.
-** sepchar -- if non-nil, this can be multiple-valued, and
-** we should return a string separated by this
-** character.
-**
-** Returns:
-** NULL -- if:
-** 1. the directory is not found
-** 2. the property name is not found
-** 3. the property contains multiple values
-** 4. some error occured
-** else -- the value of the lookup.
-**
-** Example:
-** To search for an alias value, use:
-** ni_propval("/aliases", "name", aliasname, "members", ',')
-**
-** Notes:
-** Caller should free the return value of ni_proval
-*/
-
-# include <netinfo/ni.h>
-
-# define LOCAL_NETINFO_DOMAIN "."
-# define PARENT_NETINFO_DOMAIN ".."
-# define MAX_NI_LEVELS 256
-
-char *
-ni_propval(keydir, keyprop, keyval, valprop, sepchar)
- char *keydir;
- char *keyprop;
- char *keyval;
- char *valprop;
- int sepchar;
-{
- char *propval = NULL;
- int i;
- int j, alen;
- void *ni = NULL;
- void *lastni = NULL;
- ni_status nis;
- ni_id nid;
- ni_namelist ninl;
- register char *p;
- char keybuf[1024];
-
- /*
- ** Create the full key from the two parts.
- **
- ** Note that directory can end with, e.g., "name=" to specify
- ** an alternate search property.
- */
-
- i = strlen(keydir) + strlen(keyval) + 2;
- if (keyprop != NULL)
- i += strlen(keyprop) + 1;
- if (i > sizeof keybuf)
- return NULL;
- strcpy(keybuf, keydir);
- strcat(keybuf, "/");
- if (keyprop != NULL)
- {
- strcat(keybuf, keyprop);
- strcat(keybuf, "=");
- }
- strcat(keybuf, keyval);
-
- if (tTd(38, 21))
- printf("ni_propval(%s, %s, %s, %s, %d) keybuf='%s'\n",
- keydir, keyprop, keyval, valprop, sepchar, keybuf);
- /*
- ** If the passed directory and property name are found
- ** in one of netinfo domains we need to search (starting
- ** from the local domain moving all the way back to the
- ** root domain) set propval to the property's value
- ** and return it.
- */
-
- for (i = 0; i < MAX_NI_LEVELS && propval == NULL; i++)
- {
- if (i == 0)
- {
- nis = ni_open(NULL, LOCAL_NETINFO_DOMAIN, &ni);
- if (tTd(38, 20))
- printf("ni_open(LOCAL) = %d\n", nis);
- }
- else
- {
- if (lastni != NULL)
- ni_free(lastni);
- lastni = ni;
- nis = ni_open(lastni, PARENT_NETINFO_DOMAIN, &ni);
- if (tTd(38, 20))
- printf("ni_open(PARENT) = %d\n", nis);
- }
-
- /*
- ** Don't bother if we didn't get a handle on a
- ** proper domain. This is not necessarily an error.
- ** We would get a positive ni_status if, for instance
- ** we never found the directory or property and tried
- ** to open the parent of the root domain!
- */
-
- if (nis != 0)
- break;
-
- /*
- ** Find the path to the server information.
- */
-
- if (ni_pathsearch(ni, &nid, keybuf) != 0)
- continue;
-
- /*
- ** Find associated value information.
- */
-
- if (ni_lookupprop(ni, &nid, valprop, &ninl) != 0)
- continue;
-
- if (tTd(38, 20))
- printf("ni_lookupprop: len=%d\n", ninl.ni_namelist_len);
- /*
- ** See if we have an acceptable number of values.
- */
-
- if (ninl.ni_namelist_len <= 0)
- continue;
-
- if (sepchar == '\0' && ninl.ni_namelist_len > 1)
- {
- ni_namelist_free(&ninl);
- continue;
- }
-
- /*
- ** Calculate number of bytes needed and build result
- */
-
- alen = 1;
- for (j = 0; j < ninl.ni_namelist_len; j++)
- alen += strlen(ninl.ni_namelist_val[j]) + 1;
- propval = p = xalloc(alen);
- for (j = 0; j < ninl.ni_namelist_len; j++)
- {
- strcpy(p, ninl.ni_namelist_val[j]);
- p += strlen(p);
- *p++ = sepchar;
- }
- *--p = '\0';
-
- ni_namelist_free(&ninl);
- }
-
- /*
- ** Clean up.
- */
-
- if (ni != NULL)
- ni_free(ni);
- if (lastni != NULL && ni != lastni)
- ni_free(lastni);
- if (tTd(38, 20))
- printf("ni_propval returns: '%s'\n", propval);
-
- return propval;
-}
-
-#endif /* NETINFO */
-\f/*
-** TEXT (unindexed text file) Modules
-**
-** This code donated by Sun Microsystems.
-*/
-
-#define map_sff map_lockfd /* overload field */
-
-
-/*
-** TEXT_MAP_OPEN -- open text table
-*/
-
-bool
-text_map_open(map, mode)
- MAP *map;
- int mode;
-{
- int sff;
- int i;
-
- if (tTd(38, 2))
- printf("text_map_open(%s, %s, %d)\n",
- map->map_mname, map->map_file, mode);
-
- mode &= O_ACCMODE;
- if (mode != O_RDONLY)
- {
- errno = EPERM;
- return FALSE;
- }
-
- if (*map->map_file == '\0')
- {
- syserr("text map \"%s\": file name required",
- map->map_mname);
- return FALSE;
- }
-
- if (map->map_file[0] != '/')
- {
- syserr("text map \"%s\": file name must be fully qualified",
- map->map_mname);
- return FALSE;
- }
-
- sff = SFF_ROOTOK|SFF_REGONLY;
- if (!bitset(DBS_LINKEDMAPINWRITABLEDIR, DontBlameSendmail))
- sff |= SFF_NOWLINK;
- if (!bitset(DBS_MAPINUNSAFEDIRPATH, DontBlameSendmail))
- sff |= SFF_SAFEDIRPATH;
- if ((i = safefile(map->map_file, RunAsUid, RunAsGid, RunAsUserName,
- sff, S_IRUSR, NULL)) != 0)
- {
- /* cannot open this map */
- if (tTd(38, 2))
- printf("\tunsafe map file: %d\n", i);
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- syserr("text map \"%s\": unsafe map file %s",
- map->map_mname, map->map_file);
- return FALSE;
- }
-
- if (map->map_keycolnm == NULL)
- map->map_keycolno = 0;
- else
- {
- if (!(isascii(*map->map_keycolnm) && isdigit(*map->map_keycolnm)))
- {
- syserr("text map \"%s\", file %s: -k should specify a number, not %s",
- map->map_mname, map->map_file,
- map->map_keycolnm);
- return FALSE;
- }
- map->map_keycolno = atoi(map->map_keycolnm);
- }
-
- if (map->map_valcolnm == NULL)
- map->map_valcolno = 0;
- else
- {
- if (!(isascii(*map->map_valcolnm) && isdigit(*map->map_valcolnm)))
- {
- syserr("text map \"%s\", file %s: -v should specify a number, not %s",
- map->map_mname, map->map_file,
- map->map_valcolnm);
- return FALSE;
- }
- map->map_valcolno = atoi(map->map_valcolnm);
- }
-
- if (tTd(38, 2))
- {
- printf("text_map_open(%s, %s): delimiter = ",
- map->map_mname, map->map_file);
- if (map->map_coldelim == '\0')
- printf("(white space)\n");
- else
- printf("%c\n", map->map_coldelim);
- }
-
- map->map_sff = sff;
- return TRUE;
-}
-
-
-/*
-** TEXT_MAP_LOOKUP -- look up a datum in a TEXT table
-*/
-
-char *
-text_map_lookup(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- char *vp;
- auto int vsize;
- int buflen;
- FILE *f;
- char delim;
- int key_idx;
- bool found_it;
- int sff = map->map_sff;
- char search_key[MAXNAME + 1];
- char linebuf[MAXLINE];
- char buf[MAXNAME + 1];
- extern char *get_column __P((char *, int, char, char *, int));
-
- found_it = FALSE;
- if (tTd(38, 20))
- printf("text_map_lookup(%s, %s)\n", map->map_mname, name);
-
- buflen = strlen(name);
- if (buflen > sizeof search_key - 1)
- buflen = sizeof search_key - 1;
- bcopy(name, search_key, buflen);
- search_key[buflen] = '\0';
- if (!bitset(MF_NOFOLDCASE, map->map_mflags))
- makelower(search_key);
-
- f = safefopen(map->map_file, O_RDONLY, FileMode, sff);
- if (f == NULL)
- {
- map->map_mflags &= ~(MF_VALID|MF_OPEN);
- *statp = EX_UNAVAILABLE;
- return NULL;
- }
- key_idx = map->map_keycolno;
- delim = map->map_coldelim;
- while (fgets(linebuf, MAXLINE, f) != NULL)
- {
- char *p;
-
- /* skip comment line */
- if (linebuf[0] == '#')
- continue;
- p = strchr(linebuf, '\n');
- if (p != NULL)
- *p = '\0';
- p = get_column(linebuf, key_idx, delim, buf, sizeof buf);
- if (p != NULL && strcasecmp(search_key, p) == 0)
- {
- found_it = TRUE;
- break;
- }
- }
- fclose(f);
- if (!found_it)
- {
- *statp = EX_NOTFOUND;
- return NULL;
- }
- vp = get_column(linebuf, map->map_valcolno, delim, buf, sizeof buf);
- if (vp == NULL)
- {
- *statp = EX_NOTFOUND;
- return NULL;
- }
- vsize = strlen(vp);
- *statp = EX_OK;
- if (bitset(MF_MATCHONLY, map->map_mflags))
- return map_rewrite(map, name, strlen(name), NULL);
- else
- return map_rewrite(map, vp, vsize, av);
-}
-
-
-/*
-** TEXT_GETCANONNAME -- look up canonical name in hosts file
-*/
-
-bool
-text_getcanonname(name, hbsize, statp)
- char *name;
- int hbsize;
- int *statp;
-{
- bool found;
- FILE *f;
- char linebuf[MAXLINE];
- char cbuf[MAXNAME + 1];
- char nbuf[MAXNAME + 1];
-
- if (tTd(38, 20))
- printf("text_getcanonname(%s)\n", name);
-
- if (strlen(name) >= (SIZE_T) sizeof nbuf)
- {
- *statp = EX_UNAVAILABLE;
- return FALSE;
- }
- (void) strcpy(nbuf, name);
- shorten_hostname(nbuf);
-
- f = fopen(HostsFile, "r");
- if (f == NULL)
- {
- *statp = EX_UNAVAILABLE;
- return FALSE;
- }
- found = FALSE;
- while (!found && fgets(linebuf, MAXLINE, f) != NULL)
- {
- char *p = strpbrk(linebuf, "#\n");
-
- if (p != NULL)
- *p = '\0';
- if (linebuf[0] != '\0')
- found = extract_canonname(nbuf, linebuf, cbuf, sizeof cbuf);
- }
- fclose(f);
- if (!found)
- {
- *statp = EX_NOHOST;
- return FALSE;
- }
-
- if ((SIZE_T) hbsize >= strlen(cbuf))
- {
- strcpy(name, cbuf);
- *statp = EX_OK;
- return TRUE;
- }
- *statp = EX_UNAVAILABLE;
- return FALSE;
-}
-\f/*
-** STAB (Symbol Table) Modules
-*/
-
-
-/*
-** STAB_MAP_LOOKUP -- look up alias in symbol table
-*/
-
-/* ARGSUSED2 */
-char *
-stab_map_lookup(map, name, av, pstat)
- register MAP *map;
- char *name;
- char **av;
- int *pstat;
-{
- register STAB *s;
-
- if (tTd(38, 20))
- printf("stab_lookup(%s, %s)\n",
- map->map_mname, name);
-
- s = stab(name, ST_ALIAS, ST_FIND);
- if (s != NULL)
- return (s->s_alias);
- return (NULL);
-}
-
-
-/*
-** STAB_MAP_STORE -- store in symtab (actually using during init, not rebuild)
-*/
-
-void
-stab_map_store(map, lhs, rhs)
- register MAP *map;
- char *lhs;
- char *rhs;
-{
- register STAB *s;
-
- s = stab(lhs, ST_ALIAS, ST_ENTER);
- s->s_alias = newstr(rhs);
-}
-
-
-/*
-** STAB_MAP_OPEN -- initialize (reads data file)
-**
-** This is a wierd case -- it is only intended as a fallback for
-** aliases. For this reason, opens for write (only during a
-** "newaliases") always fails, and opens for read open the
-** actual underlying text file instead of the database.
-*/
-
-bool
-stab_map_open(map, mode)
- register MAP *map;
- int mode;
-{
- FILE *af;
- int sff;
- struct stat st;
-
- if (tTd(38, 2))
- printf("stab_map_open(%s, %s, %d)\n",
- map->map_mname, map->map_file, mode);
-
- mode &= O_ACCMODE;
- if (mode != O_RDONLY)
- {
- errno = EPERM;
- return FALSE;
- }
-
- sff = SFF_ROOTOK|SFF_REGONLY;
- if (!bitset(DBS_LINKEDMAPINWRITABLEDIR, DontBlameSendmail))
- sff |= SFF_NOWLINK;
- if (!bitset(DBS_MAPINUNSAFEDIRPATH, DontBlameSendmail))
- sff |= SFF_SAFEDIRPATH;
- af = safefopen(map->map_file, O_RDONLY, 0444, sff);
- if (af == NULL)
- return FALSE;
- readaliases(map, af, FALSE, FALSE);
-
- if (fstat(fileno(af), &st) >= 0)
- map->map_mtime = st.st_mtime;
- fclose(af);
-
- return TRUE;
-}
-\f/*
-** Implicit Modules
-**
-** Tries several types. For back compatibility of aliases.
-*/
-
-
-/*
-** IMPL_MAP_LOOKUP -- lookup in best open database
-*/
-
-char *
-impl_map_lookup(map, name, av, pstat)
- MAP *map;
- char *name;
- char **av;
- int *pstat;
-{
- if (tTd(38, 20))
- printf("impl_map_lookup(%s, %s)\n",
- map->map_mname, name);
-
-#ifdef NEWDB
- if (bitset(MF_IMPL_HASH, map->map_mflags))
- return db_map_lookup(map, name, av, pstat);
-#endif
-#ifdef NDBM
- if (bitset(MF_IMPL_NDBM, map->map_mflags))
- return ndbm_map_lookup(map, name, av, pstat);
-#endif
- return stab_map_lookup(map, name, av, pstat);
-}
-
-/*
-** IMPL_MAP_STORE -- store in open databases
-*/
-
-void
-impl_map_store(map, lhs, rhs)
- MAP *map;
- char *lhs;
- char *rhs;
-{
- if (tTd(38, 12))
- printf("impl_map_store(%s, %s, %s)\n",
- map->map_mname, lhs, rhs);
-#ifdef NEWDB
- if (bitset(MF_IMPL_HASH, map->map_mflags))
- db_map_store(map, lhs, rhs);
-#endif
-#ifdef NDBM
- if (bitset(MF_IMPL_NDBM, map->map_mflags))
- ndbm_map_store(map, lhs, rhs);
-#endif
- stab_map_store(map, lhs, rhs);
-}
-
-/*
-** IMPL_MAP_OPEN -- implicit database open
-*/
-
-bool
-impl_map_open(map, mode)
- MAP *map;
- int mode;
-{
- if (tTd(38, 2))
- printf("impl_map_open(%s, %s, %d)\n",
- map->map_mname, map->map_file, mode);
-
- mode &= O_ACCMODE;
-#ifdef NEWDB
- map->map_mflags |= MF_IMPL_HASH;
- if (hash_map_open(map, mode))
- {
-# ifdef NDBM_YP_COMPAT
- if (mode == O_RDONLY || strstr(map->map_file, "/yp/") == NULL)
-# endif
- return TRUE;
- }
- else
- map->map_mflags &= ~MF_IMPL_HASH;
-#endif
-#ifdef NDBM
- map->map_mflags |= MF_IMPL_NDBM;
- if (ndbm_map_open(map, mode))
- {
- return TRUE;
- }
- else
- map->map_mflags &= ~MF_IMPL_NDBM;
-#endif
-
-#if defined(NEWDB) || defined(NDBM)
- if (Verbose)
- message("WARNING: cannot open alias database %s%s",
- map->map_file,
- mode == O_RDONLY ? "; reading text version" : "");
-#else
- if (mode != O_RDONLY)
- usrerr("Cannot rebuild aliases: no database format defined");
-#endif
-
- if (mode == O_RDONLY)
- return stab_map_open(map, mode);
- else
- return FALSE;
-}
-
-
-/*
-** IMPL_MAP_CLOSE -- close any open database(s)
-*/
-
-void
-impl_map_close(map)
- MAP *map;
-{
- if (tTd(38, 9))
- printf("impl_map_close(%s, %s, %lx)\n",
- map->map_mname, map->map_file, map->map_mflags);
-#ifdef NEWDB
- if (bitset(MF_IMPL_HASH, map->map_mflags))
- {
- db_map_close(map);
- map->map_mflags &= ~MF_IMPL_HASH;
- }
-#endif
-
-#ifdef NDBM
- if (bitset(MF_IMPL_NDBM, map->map_mflags))
- {
- ndbm_map_close(map);
- map->map_mflags &= ~MF_IMPL_NDBM;
- }
-#endif
-}
-\f/*
-** User map class.
-**
-** Provides access to the system password file.
-*/
-
-/*
-** USER_MAP_OPEN -- open user map
-**
-** Really just binds field names to field numbers.
-*/
-
-bool
-user_map_open(map, mode)
- MAP *map;
- int mode;
-{
- if (tTd(38, 2))
- printf("user_map_open(%s, %d)\n",
- map->map_mname, mode);
-
- mode &= O_ACCMODE;
- if (mode != O_RDONLY)
- {
- /* issue a pseudo-error message */
-#ifdef ENOSYS
- errno = ENOSYS;
-#else
-# ifdef EFTYPE
- errno = EFTYPE;
-# else
- errno = ENXIO;
-# endif
-#endif
- return FALSE;
- }
- if (map->map_valcolnm == NULL)
- /* nothing */ ;
- else if (strcasecmp(map->map_valcolnm, "name") == 0)
- map->map_valcolno = 1;
- else if (strcasecmp(map->map_valcolnm, "passwd") == 0)
- map->map_valcolno = 2;
- else if (strcasecmp(map->map_valcolnm, "uid") == 0)
- map->map_valcolno = 3;
- else if (strcasecmp(map->map_valcolnm, "gid") == 0)
- map->map_valcolno = 4;
- else if (strcasecmp(map->map_valcolnm, "gecos") == 0)
- map->map_valcolno = 5;
- else if (strcasecmp(map->map_valcolnm, "dir") == 0)
- map->map_valcolno = 6;
- else if (strcasecmp(map->map_valcolnm, "shell") == 0)
- map->map_valcolno = 7;
- else
- {
- syserr("User map %s: unknown column name %s",
- map->map_mname, map->map_valcolnm);
- return FALSE;
- }
- return TRUE;
-}
-
-
-/*
-** USER_MAP_LOOKUP -- look up a user in the passwd file.
-*/
-
-/* ARGSUSED3 */
-char *
-user_map_lookup(map, key, av, statp)
- MAP *map;
- char *key;
- char **av;
- int *statp;
-{
- struct passwd *pw;
- auto bool fuzzy;
-
- if (tTd(38, 20))
- printf("user_map_lookup(%s, %s)\n",
- map->map_mname, key);
-
- pw = finduser(key, &fuzzy);
- if (pw == NULL)
- return NULL;
- if (bitset(MF_MATCHONLY, map->map_mflags))
- return map_rewrite(map, key, strlen(key), NULL);
- else
- {
- char *rwval = NULL;
- char buf[30];
-
- switch (map->map_valcolno)
- {
- case 0:
- case 1:
- rwval = pw->pw_name;
- break;
-
- case 2:
- rwval = pw->pw_passwd;
- break;
-
- case 3:
- snprintf(buf, sizeof buf, "%d", pw->pw_uid);
- rwval = buf;
- break;
-
- case 4:
- snprintf(buf, sizeof buf, "%d", pw->pw_gid);
- rwval = buf;
- break;
-
- case 5:
- rwval = pw->pw_gecos;
- break;
-
- case 6:
- rwval = pw->pw_dir;
- break;
-
- case 7:
- rwval = pw->pw_shell;
- break;
- }
- return map_rewrite(map, rwval, strlen(rwval), av);
- }
-}
-\f/*
-** Program map type.
-**
-** This provides access to arbitrary programs. It should be used
-** only very sparingly, since there is no way to bound the cost
-** of invoking an arbitrary program.
-*/
-
-char *
-prog_map_lookup(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- int i;
- register char *p;
- int fd;
- auto pid_t pid;
- char *rval;
- int stat;
- char *argv[MAXPV + 1];
- char buf[MAXLINE];
-
- if (tTd(38, 20))
- printf("prog_map_lookup(%s, %s) %s\n",
- map->map_mname, name, map->map_file);
-
- i = 0;
- argv[i++] = map->map_file;
- if (map->map_rebuild != NULL)
- {
- snprintf(buf, sizeof buf, "%s", map->map_rebuild);
- for (p = strtok(buf, " \t"); p != NULL; p = strtok(NULL, " \t"))
- {
- if (i >= MAXPV - 1)
- break;
- argv[i++] = p;
- }
- }
- argv[i++] = name;
- argv[i] = NULL;
- if (tTd(38, 21))
- {
- printf("prog_open:");
- for (i = 0; argv[i] != NULL; i++)
- printf(" %s", argv[i]);
- printf("\n");
- }
- (void) blocksignal(SIGCHLD);
- pid = prog_open(argv, &fd, CurEnv);
- if (pid < 0)
- {
- if (!bitset(MF_OPTIONAL, map->map_mflags))
- syserr("prog_map_lookup(%s) failed (%s) -- closing",
- map->map_mname, errstring(errno));
- else if (tTd(38, 9))
- printf("prog_map_lookup(%s) failed (%s) -- closing",
- map->map_mname, errstring(errno));
- map->map_mflags &= ~(MF_VALID|MF_OPEN);
- *statp = EX_OSFILE;
- return NULL;
- }
- i = read(fd, buf, sizeof buf - 1);
- if (i < 0)
- {
- syserr("prog_map_lookup(%s): read error %s\n",
- map->map_mname, errstring(errno));
- rval = NULL;
- }
- else if (i == 0)
- {
- if (tTd(38, 20))
- printf("prog_map_lookup(%s): empty answer\n",
- map->map_mname);
- rval = NULL;
- }
- else
- {
- buf[i] = '\0';
- p = strchr(buf, '\n');
- if (p != NULL)
- *p = '\0';
-
- /* collect the return value */
- if (bitset(MF_MATCHONLY, map->map_mflags))
- rval = map_rewrite(map, name, strlen(name), NULL);
- else
- rval = map_rewrite(map, buf, strlen(buf), NULL);
-
- /* now flush any additional output */
- while ((i = read(fd, buf, sizeof buf)) > 0)
- continue;
- }
-
- /* wait for the process to terminate */
- close(fd);
- stat = waitfor(pid);
- (void) releasesignal(SIGCHLD);
-
- if (stat == -1)
- {
- syserr("prog_map_lookup(%s): wait error %s\n",
- map->map_mname, errstring(errno));
- *statp = EX_SOFTWARE;
- rval = NULL;
- }
- else if (WIFEXITED(stat))
- {
- if ((*statp = WEXITSTATUS(stat)) != EX_OK)
- rval = NULL;
- }
- else
- {
- syserr("prog_map_lookup(%s): child died on signal %d",
- map->map_mname, stat);
- *statp = EX_UNAVAILABLE;
- rval = NULL;
- }
- return rval;
-}
-\f/*
-** Sequenced map type.
-**
-** Tries each map in order until something matches, much like
-** implicit. Stores go to the first map in the list that can
-** support storing.
-**
-** This is slightly unusual in that there are two interfaces.
-** The "sequence" interface lets you stack maps arbitrarily.
-** The "switch" interface builds a sequence map by looking
-** at a system-dependent configuration file such as
-** /etc/nsswitch.conf on Solaris or /etc/svc.conf on Ultrix.
-**
-** We don't need an explicit open, since all maps are
-** opened during startup, including underlying maps.
-*/
-
-/*
-** SEQ_MAP_PARSE -- Sequenced map parsing
-*/
-
-bool
-seq_map_parse(map, ap)
- MAP *map;
- char *ap;
-{
- int maxmap;
-
- if (tTd(38, 2))
- printf("seq_map_parse(%s, %s)\n", map->map_mname, ap);
- maxmap = 0;
- while (*ap != '\0')
- {
- register char *p;
- STAB *s;
-
- /* find beginning of map name */
- while (isascii(*ap) && isspace(*ap))
- ap++;
- for (p = ap; isascii(*p) && isalnum(*p); p++)
- continue;
- if (*p != '\0')
- *p++ = '\0';
- while (*p != '\0' && (!isascii(*p) || !isalnum(*p)))
- p++;
- if (*ap == '\0')
- {
- ap = p;
- continue;
- }
- s = stab(ap, ST_MAP, ST_FIND);
- if (s == NULL)
- {
- syserr("Sequence map %s: unknown member map %s",
- map->map_mname, ap);
- }
- else if (maxmap == MAXMAPSTACK)
- {
- syserr("Sequence map %s: too many member maps (%d max)",
- map->map_mname, MAXMAPSTACK);
- maxmap++;
- }
- else if (maxmap < MAXMAPSTACK)
- {
- map->map_stack[maxmap++] = &s->s_map;
- }
- ap = p;
- }
- return TRUE;
-}
-
-
-/*
-** SWITCH_MAP_OPEN -- open a switched map
-**
-** This looks at the system-dependent configuration and builds
-** a sequence map that does the same thing.
-**
-** Every system must define a switch_map_find routine in conf.c
-** that will return the list of service types associated with a
-** given service class.
-*/
-
-bool
-switch_map_open(map, mode)
- MAP *map;
- int mode;
-{
- int mapno;
- int nmaps;
- char *maptype[MAXMAPSTACK];
-
- if (tTd(38, 2))
- printf("switch_map_open(%s, %s, %d)\n",
- map->map_mname, map->map_file, mode);
-
- mode &= O_ACCMODE;
- nmaps = switch_map_find(map->map_file, maptype, map->map_return);
- if (tTd(38, 19))
- {
- printf("\tswitch_map_find => %d\n", nmaps);
- for (mapno = 0; mapno < nmaps; mapno++)
- printf("\t\t%s\n", maptype[mapno]);
- }
- if (nmaps <= 0 || nmaps > MAXMAPSTACK)
- return FALSE;
-
- for (mapno = 0; mapno < nmaps; mapno++)
- {
- register STAB *s;
- char nbuf[MAXNAME + 1];
-
- if (maptype[mapno] == NULL)
- continue;
- (void) snprintf(nbuf, sizeof nbuf, "%s.%s",
- map->map_mname, maptype[mapno]);
- s = stab(nbuf, ST_MAP, ST_FIND);
- if (s == NULL)
- {
- syserr("Switch map %s: unknown member map %s",
- map->map_mname, nbuf);
- }
- else
- {
- map->map_stack[mapno] = &s->s_map;
- if (tTd(38, 4))
- printf("\tmap_stack[%d] = %s:%s\n",
- mapno, s->s_map.map_class->map_cname,
- nbuf);
- }
- }
- return TRUE;
-}
-
-
-/*
-** SEQ_MAP_CLOSE -- close all underlying maps
-*/
-
-void
-seq_map_close(map)
- MAP *map;
-{
- int mapno;
-
- if (tTd(38, 9))
- printf("seq_map_close(%s)\n", map->map_mname);
-
- for (mapno = 0; mapno < MAXMAPSTACK; mapno++)
- {
- MAP *mm = map->map_stack[mapno];
-
- if (mm == NULL || !bitset(MF_OPEN, mm->map_mflags))
- continue;
- mm->map_class->map_close(mm);
- mm->map_mflags &= ~(MF_OPEN|MF_WRITABLE);
- }
-}
-
-
-/*
-** SEQ_MAP_LOOKUP -- sequenced map lookup
-*/
-
-char *
-seq_map_lookup(map, key, args, pstat)
- MAP *map;
- char *key;
- char **args;
- int *pstat;
-{
- int mapno;
- int mapbit = 0x01;
- bool tempfail = FALSE;
-
- if (tTd(38, 20))
- printf("seq_map_lookup(%s, %s)\n", map->map_mname, key);
-
- for (mapno = 0; mapno < MAXMAPSTACK; mapbit <<= 1, mapno++)
- {
- MAP *mm = map->map_stack[mapno];
- char *rv;
-
- if (mm == NULL)
- continue;
- if (!bitset(MF_OPEN, mm->map_mflags))
- {
- if (bitset(mapbit, map->map_return[MA_UNAVAIL]))
- {
- *pstat = EX_UNAVAILABLE;
- return NULL;
- }
- continue;
- }
- *pstat = EX_OK;
- rv = mm->map_class->map_lookup(mm, key, args, pstat);
- if (rv != NULL)
- return rv;
- if (*pstat == EX_TEMPFAIL)
- {
- if (bitset(mapbit, map->map_return[MA_TRYAGAIN]))
- return NULL;
- tempfail = TRUE;
- }
- else if (bitset(mapbit, map->map_return[MA_NOTFOUND]))
- break;
- }
- if (tempfail)
- *pstat = EX_TEMPFAIL;
- else if (*pstat == EX_OK)
- *pstat = EX_NOTFOUND;
- return NULL;
-}
-
-
-/*
-** SEQ_MAP_STORE -- sequenced map store
-*/
-
-void
-seq_map_store(map, key, val)
- MAP *map;
- char *key;
- char *val;
-{
- int mapno;
-
- if (tTd(38, 12))
- printf("seq_map_store(%s, %s, %s)\n",
- map->map_mname, key, val);
-
- for (mapno = 0; mapno < MAXMAPSTACK; mapno++)
- {
- MAP *mm = map->map_stack[mapno];
-
- if (mm == NULL || !bitset(MF_WRITABLE, mm->map_mflags))
- continue;
-
- mm->map_class->map_store(mm, key, val);
- return;
- }
- syserr("seq_map_store(%s, %s, %s): no writable map",
- map->map_mname, key, val);
-}
-\f/*
-** NULL stubs
-*/
-
-/* ARGSUSED */
-bool
-null_map_open(map, mode)
- MAP *map;
- int mode;
-{
- return TRUE;
-}
-
-/* ARGSUSED */
-void
-null_map_close(map)
- MAP *map;
-{
- return;
-}
-
-char *
-null_map_lookup(map, key, args, pstat)
- MAP *map;
- char *key;
- char **args;
- int *pstat;
-{
- *pstat = EX_NOTFOUND;
- return NULL;
-}
-
-/* ARGSUSED */
-void
-null_map_store(map, key, val)
- MAP *map;
- char *key;
- char *val;
-{
- return;
-}
-
-
-/*
-** BOGUS stubs
-*/
-
-char *
-bogus_map_lookup(map, key, args, pstat)
- MAP *map;
- char *key;
- char **args;
- int *pstat;
-{
- *pstat = EX_TEMPFAIL;
- return NULL;
-}
-
-MAPCLASS BogusMapClass =
-{
- "bogus-map", NULL, 0,
- NULL, bogus_map_lookup, null_map_store,
- null_map_open, null_map_close,
-};
-\f/*
-** REGEX modules
-*/
-
-#ifdef MAP_REGEX
-
-# include <regex.h>
-
-# define DEFAULT_DELIM CONDELSE
-
-# define END_OF_FIELDS -1
-
-# define ERRBUF_SIZE 80
-# define MAX_MATCH 32
-
-# define xnalloc(s) memset(xalloc(s), 0, s);
-
-struct regex_map
-{
- regex_t pattern_buf; /* xalloc it */
- int *regex_subfields; /* move to type MAP */
- char *delim; /* move to type MAP */
-};
-
-static int
-parse_fields(s, ibuf, blen, nr_substrings)
- char *s;
- int *ibuf; /* array */
- int blen; /* number of elements in ibuf */
- int nr_substrings; /* number of substrings in the pattern */
-{
- register char *cp;
- int i = 0;
- bool lastone = FALSE;
-
- blen--; /* for terminating END_OF_FIELDS */
- cp = s;
- do
- {
- for (;; cp++)
- {
- if (*cp == ',')
- {
- *cp = '\0';
- break;
- }
- if (*cp == '\0')
- {
- lastone = TRUE;
- break;
- }
- }
- if (i < blen)
- {
- int val = atoi(s);
-
- if (val < 0 || val >= nr_substrings)
- {
- syserr("field (%d) out of range, only %d substrings in pattern",
- val, nr_substrings);
- return -1;
- }
- ibuf[i++] = val;
- }
- else
- {
- syserr("too many fields, %d max\n", blen);
- return -1;
- }
- s = ++cp;
- } while (!lastone);
- ibuf[i] = END_OF_FIELDS;
- return i;
-}
-
-bool
-regex_map_init(map, ap)
- MAP *map;
- char *ap;
-{
- int regerr;
- struct regex_map *map_p;
- register char *p;
- char *sub_param = NULL;
- int pflags;
- static char defdstr[] = { (char)DEFAULT_DELIM, '\0' };
-
- if (tTd(38, 2))
- printf("regex_map_init: mapname '%s', args '%s'\n",
- map->map_mname, ap);
-
- pflags = REG_ICASE | REG_EXTENDED | REG_NOSUB;
-
- p = ap;
-
- map_p = (struct regex_map *) xnalloc(sizeof(struct regex_map));
-
- for (;;)
- {
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p != '-')
- break;
- switch (*++p)
- {
- case 'n': /* not */
- map->map_mflags |= MF_REGEX_NOT;
- break;
-
- case 'f': /* case sensitive */
- map->map_mflags |= MF_NOFOLDCASE;
- pflags &= ~REG_ICASE;
- break;
-
- case 'b': /* basic regular expressions */
- pflags &= ~REG_EXTENDED;
- break;
-
- case 's': /* substring match () syntax */
- sub_param = ++p;
- pflags &= ~REG_NOSUB;
- break;
-
- case 'd': /* delimiter */
- map_p->delim = ++p;
- break;
-
- case 'a': /* map append */
- map->map_app = ++p;
- break;
-
- case 'm': /* matchonly */
- map->map_mflags |= MF_MATCHONLY;
- break;
-
- }
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- if (*p != '\0')
- *p++ = '\0';
- }
- if (tTd(38, 3))
- printf("regex_map_init: compile '%s' 0x%x\n", p, pflags);
-
- if ((regerr = regcomp(&(map_p->pattern_buf), p, pflags)) != 0)
- {
- /* Errorhandling */
- char errbuf[ERRBUF_SIZE];
-
- regerror(regerr, &(map_p->pattern_buf), errbuf, ERRBUF_SIZE);
- syserr("pattern-compile-error: %s\n", errbuf);
- free(map_p);
- return FALSE;
- }
-
- if (map->map_app != NULL)
- map->map_app = newstr(map->map_app);
- if (map_p->delim != NULL)
- map_p->delim = newstr(map_p->delim);
- else
- map_p->delim = defdstr;
-
- if (!bitset(REG_NOSUB, pflags))
- {
- /* substring matching */
- int substrings;
- int *fields = (int *)xalloc(sizeof(int) * (MAX_MATCH + 1));
-
- substrings = map_p->pattern_buf.re_nsub + 1;
-
- if (tTd(38, 3))
- printf("regex_map_init: nr of substrings %d\n", substrings);
-
- if (substrings >= MAX_MATCH)
- {
- syserr("too many substrings, %d max\n", MAX_MATCH);
- free(map_p);
- return FALSE;
- }
- if (sub_param != NULL && sub_param[0] != '\0')
- {
- /* optional parameter -sfields */
- if (parse_fields(sub_param, fields,
- MAX_MATCH + 1, substrings) == -1)
- return FALSE;
- }
- else
- {
- /* set default fields */
- int i;
-
- for (i = 0; i < substrings; i++)
- fields[i] = i;
- fields[i] = END_OF_FIELDS;
- }
- map_p->regex_subfields = fields;
- if (tTd(38, 3))
- {
- int *ip;
-
- printf("regex_map_init: subfields");
- for (ip = fields; *ip != END_OF_FIELDS; ip++)
- printf(" %d", *ip);
- printf("\n");
- }
- }
- map->map_db1 = (ARBPTR_T)map_p; /* dirty hack */
-
- return TRUE;
-}
-
-static char *
-regex_map_rewrite(map, s, slen, av)
- MAP *map;
- const char *s;
- size_t slen;
- char **av;
-{
- if (bitset(MF_MATCHONLY, map->map_mflags))
- return map_rewrite(map, av[0], strlen(av[0]), NULL);
- else
- return map_rewrite(map, s, slen, NULL);
-}
-
-char *
-regex_map_lookup(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- int reg_res;
- struct regex_map *map_p;
- regmatch_t pmatch[MAX_MATCH];
-
- if (tTd(38, 20))
- {
- char **cpp;
-
- printf("regex_map_lookup: key '%s'\n", name);
- for (cpp = av; cpp && *cpp; cpp++)
- printf("regex_map_lookup: arg '%s'\n", *cpp);
- }
-
- map_p = (struct regex_map *)(map->map_db1);
- reg_res = regexec(&(map_p->pattern_buf), name, MAX_MATCH, pmatch, 0);
-
- if (bitset(MF_REGEX_NOT, map->map_mflags))
- {
- /* option -n */
- if (reg_res == REG_NOMATCH)
- return regex_map_rewrite(map, "", (size_t)0, av);
- else
- return NULL;
- }
- if (reg_res == REG_NOMATCH)
- return NULL;
-
- if (map_p->regex_subfields != NULL)
- {
- /* option -s */
- static char retbuf[MAXNAME];
- int fields[MAX_MATCH + 1];
- bool first = TRUE;
- int anglecnt = 0, cmntcnt = 0, spacecnt = 0;
- bool quotemode = FALSE, bslashmode = FALSE;
- register char *dp, *sp;
- char *endp, *ldp;
- int *ip;
-
- dp = retbuf;
- ldp = retbuf + sizeof(retbuf) - 1;
-
- if (av[1] != NULL)
- {
- if (parse_fields(av[1], fields, MAX_MATCH + 1,
- (int) map_p->pattern_buf.re_nsub + 1) == -1)
- {
- *statp = EX_CONFIG;
- return NULL;
- }
- ip = fields;
- }
- else
- ip = map_p->regex_subfields;
-
- for ( ; *ip != END_OF_FIELDS; ip++)
- {
- if (!first)
- {
- for (sp = map_p->delim; *sp; sp++)
- {
- if (dp < ldp)
- *dp++ = *sp;
- }
- }
- else
- first = FALSE;
-
-
- if (pmatch[*ip].rm_so < 0 || pmatch[*ip].rm_eo < 0)
- continue;
-
- sp = name + pmatch[*ip].rm_so;
- endp = name + pmatch[*ip].rm_eo;
- for (; endp > sp; sp++)
- {
- if (dp < ldp)
- {
- if(bslashmode)
- {
- *dp++ = *sp;
- bslashmode = FALSE;
- }
- else if(quotemode && *sp != '"' &&
- *sp != '\\')
- {
- *dp++ = *sp;
- }
- else switch(*dp++ = *sp)
- {
- case '\\':
- bslashmode = TRUE;
- break;
-
- case '(':
- cmntcnt++;
- break;
-
- case ')':
- cmntcnt--;
- break;
-
- case '<':
- anglecnt++;
- break;
-
- case '>':
- anglecnt--;
- break;
-
- case ' ':
- spacecnt++;
- break;
-
- case '"':
- quotemode = !quotemode;
- break;
- }
- }
- }
- }
- if (anglecnt != 0 || cmntcnt != 0 || quotemode ||
- bslashmode || spacecnt != 0)
- {
- sm_syslog(LOG_WARNING, NOQID,
- "Warning: regex may cause prescan() failure map=%s lookup=%s",
- map->map_mname, name);
- return NULL;
- }
-
- *dp = '\0';
-
- return regex_map_rewrite(map, retbuf, strlen(retbuf), av);
- }
- return regex_map_rewrite(map, "", (size_t)0, av);
-}
-#endif /* MAP_REGEX */
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)mci.c 8.83 (Berkeley) 10/13/1998";
-#endif /* not lint */
-
-#include "sendmail.h"
-#include <arpa/inet.h>
-#include <dirent.h>
-
-/*
-** Mail Connection Information (MCI) Caching Module.
-**
-** There are actually two separate things cached. The first is
-** the set of all open connections -- these are stored in a
-** (small) list. The second is stored in the symbol table; it
-** has the overall status for all hosts, whether or not there
-** is a connection open currently.
-**
-** There should never be too many connections open (since this
-** could flood the socket table), nor should a connection be
-** allowed to sit idly for too long.
-**
-** MaxMciCache is the maximum number of open connections that
-** will be supported.
-**
-** MciCacheTimeout is the time (in seconds) that a connection
-** is permitted to survive without activity.
-**
-** We actually try any cached connections by sending a NOOP
-** before we use them; if the NOOP fails we close down the
-** connection and reopen it. Note that this means that a
-** server SMTP that doesn't support NOOP will hose the
-** algorithm -- but that doesn't seem too likely.
-**
-** The persistent MCI code is donated by Mark Lovell and Paul
-** Vixie. It is based on the long term host status code in KJS
-** written by Paul but has been adapted by Mark to fit into the
-** MCI structure.
-*/
-
-MCI **MciCache; /* the open connection cache */
-
-extern int mci_generate_persistent_path __P((const char *, char *, int, bool));
-extern bool mci_load_persistent __P((MCI *));
-extern void mci_uncache __P((MCI **, bool));
-\f/*
-** MCI_CACHE -- enter a connection structure into the open connection cache
-**
-** This may cause something else to be flushed.
-**
-** Parameters:
-** mci -- the connection to cache.
-**
-** Returns:
-** none.
-*/
-
-void
-mci_cache(mci)
- register MCI *mci;
-{
- register MCI **mcislot;
-
- /*
- ** Find the best slot. This may cause expired connections
- ** to be closed.
- */
-
- mcislot = mci_scan(mci);
- if (mcislot == NULL)
- {
- /* we don't support caching */
- return;
- }
-
- if (mci->mci_host == NULL)
- return;
-
- /* if this is already cached, we are done */
- if (bitset(MCIF_CACHED, mci->mci_flags))
- return;
-
- /* otherwise we may have to clear the slot */
- if (*mcislot != NULL)
- mci_uncache(mcislot, TRUE);
-
- if (tTd(42, 5))
- printf("mci_cache: caching %lx (%s) in slot %d\n",
- (u_long) mci, mci->mci_host, (int)(mcislot - MciCache));
- if (tTd(91, 100))
- sm_syslog(LOG_DEBUG, CurEnv->e_id,
- "mci_cache: caching %x (%.100s) in slot %d",
- mci, mci->mci_host, mcislot - MciCache);
-
- *mcislot = mci;
- mci->mci_flags |= MCIF_CACHED;
-}
-\f/*
-** MCI_SCAN -- scan the cache, flush junk, and return best slot
-**
-** Parameters:
-** savemci -- never flush this one. Can be null.
-**
-** Returns:
-** The LRU (or empty) slot.
-*/
-
-MCI **
-mci_scan(savemci)
- MCI *savemci;
-{
- time_t now;
- register MCI **bestmci;
- register MCI *mci;
- register int i;
-
- if (MaxMciCache <= 0)
- {
- /* we don't support caching */
- return NULL;
- }
-
- if (MciCache == NULL)
- {
- /* first call */
- MciCache = (MCI **) xalloc(MaxMciCache * sizeof *MciCache);
- bzero((char *) MciCache, MaxMciCache * sizeof *MciCache);
- return (&MciCache[0]);
- }
-
- now = curtime();
- bestmci = &MciCache[0];
- for (i = 0; i < MaxMciCache; i++)
- {
- mci = MciCache[i];
- if (mci == NULL || mci->mci_state == MCIS_CLOSED)
- {
- bestmci = &MciCache[i];
- continue;
- }
- if (mci->mci_lastuse + MciCacheTimeout < now && mci != savemci)
- {
- /* connection idle too long -- close it */
- bestmci = &MciCache[i];
- mci_uncache(bestmci, TRUE);
- continue;
- }
- if (*bestmci == NULL)
- continue;
- if (mci->mci_lastuse < (*bestmci)->mci_lastuse)
- bestmci = &MciCache[i];
- }
- return bestmci;
-}
-\f/*
-** MCI_UNCACHE -- remove a connection from a slot.
-**
-** May close a connection.
-**
-** Parameters:
-** mcislot -- the slot to empty.
-** doquit -- if TRUE, send QUIT protocol on this connection.
-** if FALSE, we are assumed to be in a forked child;
-** all we want to do is close the file(s).
-**
-** Returns:
-** none.
-*/
-
-void
-mci_uncache(mcislot, doquit)
- register MCI **mcislot;
- bool doquit;
-{
- register MCI *mci;
- extern ENVELOPE BlankEnvelope;
-
- mci = *mcislot;
- if (mci == NULL)
- return;
- *mcislot = NULL;
- if (mci->mci_host == NULL)
- return;
-
- mci_unlock_host(mci);
-
- if (tTd(42, 5))
- printf("mci_uncache: uncaching %lx (%s) from slot %d (%d)\n",
- (u_long) mci, mci->mci_host,
- (int)(mcislot - MciCache), doquit);
- if (tTd(91, 100))
- sm_syslog(LOG_DEBUG, CurEnv->e_id,
- "mci_uncache: uncaching %x (%.100s) from slot %d (%d)",
- mci, mci->mci_host, mcislot - MciCache, doquit);
-
-#if SMTP
- if (doquit)
- {
- message("Closing connection to %s", mci->mci_host);
-
- mci->mci_flags &= ~MCIF_CACHED;
-
- /* only uses the envelope to flush the transcript file */
- if (mci->mci_state != MCIS_CLOSED)
- smtpquit(mci->mci_mailer, mci, &BlankEnvelope);
-#ifdef XLA
- xla_host_end(mci->mci_host);
-#endif
- }
- else
-#endif
- {
- if (mci->mci_in != NULL)
- xfclose(mci->mci_in, "mci_uncache", "mci_in");
- if (mci->mci_out != NULL)
- xfclose(mci->mci_out, "mci_uncache", "mci_out");
- mci->mci_in = mci->mci_out = NULL;
- mci->mci_state = MCIS_CLOSED;
- mci->mci_exitstat = EX_OK;
- mci->mci_errno = 0;
- mci->mci_flags = 0;
- }
-}
-\f/*
-** MCI_FLUSH -- flush the entire cache
-**
-** Parameters:
-** doquit -- if TRUE, send QUIT protocol.
-** if FALSE, just close the connection.
-** allbut -- but leave this one open.
-**
-** Returns:
-** none.
-*/
-
-void
-mci_flush(doquit, allbut)
- bool doquit;
- MCI *allbut;
-{
- register int i;
-
- if (MciCache == NULL)
- return;
-
- for (i = 0; i < MaxMciCache; i++)
- if (allbut != MciCache[i])
- mci_uncache(&MciCache[i], doquit);
-}
-\f/*
-** MCI_GET -- get information about a particular host
-*/
-
-MCI *
-mci_get(host, m)
- char *host;
- MAILER *m;
-{
- register MCI *mci;
- register STAB *s;
-
-#if DAEMON
- extern SOCKADDR CurHostAddr;
-
- /* clear CurHostAddr so we don't get a bogus address with this name */
- bzero(&CurHostAddr, sizeof CurHostAddr);
-#endif
-
- /* clear out any expired connections */
- (void) mci_scan(NULL);
-
- if (m->m_mno < 0)
- syserr("negative mno %d (%s)", m->m_mno, m->m_name);
- s = stab(host, ST_MCI + m->m_mno, ST_ENTER);
- mci = &s->s_mci;
- mci->mci_host = s->s_name;
-
- if (!mci_load_persistent(mci))
- {
- if (tTd(42, 2))
- printf("mci_get(%s %s): lock failed\n", host, m->m_name);
- mci->mci_exitstat = EX_TEMPFAIL;
- mci->mci_state = MCIS_CLOSED;
- mci->mci_statfile = NULL;
- return mci;
- }
-
- if (tTd(42, 2))
- {
- printf("mci_get(%s %s): mci_state=%d, _flags=%x, _exitstat=%d, _errno=%d\n",
- host, m->m_name, mci->mci_state, mci->mci_flags,
- mci->mci_exitstat, mci->mci_errno);
- }
-
-#if SMTP
- if (mci->mci_state == MCIS_OPEN)
- {
- extern int smtpprobe __P((MCI *));
-
- /* poke the connection to see if it's still alive */
- (void) smtpprobe(mci);
-
- /* reset the stored state in the event of a timeout */
- if (mci->mci_state != MCIS_OPEN)
- {
- mci->mci_errno = 0;
- mci->mci_exitstat = EX_OK;
- mci->mci_state = MCIS_CLOSED;
- }
-# if DAEMON
- else
- {
- /* get peer host address for logging reasons only */
- /* (this should really be in the mci struct) */
- SOCKADDR_LEN_T socklen = sizeof CurHostAddr;
-
- (void) getpeername(fileno(mci->mci_in),
- (struct sockaddr *) &CurHostAddr, &socklen);
- }
-# endif
- }
-#endif
- if (mci->mci_state == MCIS_CLOSED)
- {
- time_t now = curtime();
-
- /* if this info is stale, ignore it */
- if (now > mci->mci_lastuse + MciInfoTimeout)
- {
- mci->mci_lastuse = now;
- mci->mci_errno = 0;
- mci->mci_exitstat = EX_OK;
- }
- }
-
- return mci;
-}
-\f/*
-** MCI_SETSTAT -- set status codes in MCI structure.
-**
-** Parameters:
-** mci -- the MCI structure to set.
-** xstat -- the exit status code.
-** dstat -- the DSN status code.
-** rstat -- the SMTP status code.
-**
-** Returns:
-** none.
-*/
-
-void
-mci_setstat(mci, xstat, dstat, rstat)
- MCI *mci;
- int xstat;
- char *dstat;
- char *rstat;
-{
- /* protocol errors should never be interpreted as sticky */
- if (xstat != EX_NOTSTICKY && xstat != EX_PROTOCOL)
- mci->mci_exitstat = xstat;
-
- mci->mci_status = dstat;
- if (mci->mci_rstatus != NULL)
- free(mci->mci_rstatus);
- if (rstat != NULL)
- rstat = newstr(rstat);
- mci->mci_rstatus = rstat;
-}
-\f/*
-** MCI_DUMP -- dump the contents of an MCI structure.
-**
-** Parameters:
-** mci -- the MCI structure to dump.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** none.
-*/
-
-struct mcifbits
-{
- int mcif_bit; /* flag bit */
- char *mcif_name; /* flag name */
-};
-struct mcifbits MciFlags[] =
-{
- { MCIF_VALID, "VALID" },
- { MCIF_TEMP, "TEMP" },
- { MCIF_CACHED, "CACHED" },
- { MCIF_ESMTP, "ESMTP" },
- { MCIF_EXPN, "EXPN" },
- { MCIF_SIZE, "SIZE" },
- { MCIF_8BITMIME, "8BITMIME" },
- { MCIF_7BIT, "7BIT" },
- { MCIF_MULTSTAT, "MULTSTAT" },
- { MCIF_INHEADER, "INHEADER" },
- { MCIF_CVT8TO7, "CVT8TO7" },
- { MCIF_DSN, "DSN" },
- { MCIF_8BITOK, "8BITOK" },
- { MCIF_CVT7TO8, "CVT7TO8" },
- { MCIF_INMIME, "INMIME" },
- { 0, NULL }
-};
-
-
-void
-mci_dump(mci, logit)
- register MCI *mci;
- bool logit;
-{
- register char *p;
- char *sep;
- char buf[4000];
- extern char *ctime();
-
- sep = logit ? " " : "\n\t";
- p = buf;
- snprintf(p, SPACELEFT(buf, p), "MCI@%x: ", mci);
- p += strlen(p);
- if (mci == NULL)
- {
- snprintf(p, SPACELEFT(buf, p), "NULL");
- goto printit;
- }
- snprintf(p, SPACELEFT(buf, p), "flags=%x", mci->mci_flags);
- p += strlen(p);
- if (mci->mci_flags != 0)
- {
- struct mcifbits *f;
-
- *p++ = '<';
- for (f = MciFlags; f->mcif_bit != 0; f++)
- {
- if (!bitset(f->mcif_bit, mci->mci_flags))
- continue;
- snprintf(p, SPACELEFT(buf, p), "%s,", f->mcif_name);
- p += strlen(p);
- }
- p[-1] = '>';
- }
- snprintf(p, SPACELEFT(buf, p),
- ",%serrno=%d, herrno=%d, exitstat=%d, state=%d, pid=%d,%s",
- sep, mci->mci_errno, mci->mci_herrno,
- mci->mci_exitstat, mci->mci_state, mci->mci_pid, sep);
- p += strlen(p);
- snprintf(p, SPACELEFT(buf, p),
- "maxsize=%ld, phase=%s, mailer=%s,%s",
- mci->mci_maxsize,
- mci->mci_phase == NULL ? "NULL" : mci->mci_phase,
- mci->mci_mailer == NULL ? "NULL" : mci->mci_mailer->m_name,
- sep);
- p += strlen(p);
- snprintf(p, SPACELEFT(buf, p),
- "status=%s, rstatus=%s,%s",
- mci->mci_status == NULL ? "NULL" : mci->mci_status,
- mci->mci_rstatus == NULL ? "NULL" : mci->mci_rstatus,
- sep);
- p += strlen(p);
- snprintf(p, SPACELEFT(buf, p),
- "host=%s, lastuse=%s",
- mci->mci_host == NULL ? "NULL" : mci->mci_host,
- ctime(&mci->mci_lastuse));
-printit:
- if (logit)
- sm_syslog(LOG_DEBUG, CurEnv->e_id, "%.1000s", buf);
- else
- printf("%s\n", buf);
-}
-\f/*
-** MCI_DUMP_ALL -- print the entire MCI cache
-**
-** Parameters:
-** logit -- if set, log the result instead of printing
-** to stdout.
-**
-** Returns:
-** none.
-*/
-
-void
-mci_dump_all(logit)
- bool logit;
-{
- register int i;
-
- if (MciCache == NULL)
- return;
-
- for (i = 0; i < MaxMciCache; i++)
- mci_dump(MciCache[i], logit);
-}
-\f/*
-** MCI_LOCK_HOST -- Lock host while sending.
-**
-** If we are contacting a host, we'll need to
-** update the status information in the host status
-** file, and if we want to do that, we ought to have
-** locked it. This has the (according to some)
-** desirable effect of serializing connectivity with
-** remote hosts -- i.e.: one connection to a give
-** host at a time.
-**
-** Parameters:
-** mci -- containing the host we want to lock.
-**
-** Returns:
-** EX_OK -- got the lock.
-** EX_TEMPFAIL -- didn't get the lock.
-*/
-
-int
-mci_lock_host(mci)
- MCI *mci;
-{
- if (mci == NULL)
- {
- if (tTd(56, 1))
- printf("mci_lock_host: NULL mci\n");
- return EX_OK;
- }
-
- if (!SingleThreadDelivery)
- return EX_OK;
-
- return mci_lock_host_statfile(mci);
-}
-
-int
-mci_lock_host_statfile(mci)
- MCI *mci;
-{
- int savedErrno = errno;
- int retVal = EX_OK;
- char fname[MAXPATHLEN+1];
-
- if (HostStatDir == NULL || mci->mci_host == NULL)
- return EX_OK;
-
- if (tTd(56, 2))
- printf("mci_lock_host: attempting to lock %s\n",
- mci->mci_host);
-
- if (mci_generate_persistent_path(mci->mci_host, fname, sizeof fname, TRUE) < 0)
- {
- /* of course this should never happen */
- if (tTd(56, 2))
- printf("mci_lock_host: Failed to generate host path for %s\n",
- mci->mci_host);
-
- retVal = EX_TEMPFAIL;
- goto cleanup;
- }
-
- mci->mci_statfile = safefopen(fname, O_RDWR, FileMode,
- SFF_NOLOCK|SFF_NOLINK|SFF_OPENASROOT|SFF_REGONLY|SFF_SAFEDIRPATH|SFF_CREAT);
-
- if (mci->mci_statfile == NULL)
- {
- syserr("mci_lock_host: cannot create host lock file %s",
- fname);
- goto cleanup;
- }
-
- if (!lockfile(fileno(mci->mci_statfile), fname, "", LOCK_EX|LOCK_NB))
- {
- if (tTd(56, 2))
- printf("mci_lock_host: couldn't get lock on %s\n",
- fname);
- fclose(mci->mci_statfile);
- mci->mci_statfile = NULL;
- retVal = EX_TEMPFAIL;
- goto cleanup;
- }
-
- if (tTd(56, 12) && mci->mci_statfile != NULL)
- printf("mci_lock_host: Sanity check -- lock is good\n");
-
-cleanup:
- errno = savedErrno;
- return retVal;
-}
-\f/*
-** MCI_UNLOCK_HOST -- unlock host
-**
-** Clean up the lock on a host, close the file, let
-** someone else use it.
-**
-** Parameters:
-** mci -- us.
-**
-** Returns:
-** nothing.
-*/
-
-void
-mci_unlock_host(mci)
- MCI *mci;
-{
- int saveErrno = errno;
-
- if (mci == NULL)
- {
- if (tTd(56, 1))
- printf("mci_unlock_host: NULL mci\n");
- return;
- }
-
- if (HostStatDir == NULL || mci->mci_host == NULL)
- return;
-
- if (!SingleThreadDelivery && mci_lock_host_statfile(mci) == EX_TEMPFAIL)
- {
- if (tTd(56, 1))
- printf("mci_unlock_host: stat file already locked\n");
- }
- else
- {
- if (tTd(56, 2))
- printf("mci_unlock_host: store prior to unlock\n");
-
- mci_store_persistent(mci);
- }
-
- if (mci->mci_statfile != NULL)
- {
- fclose(mci->mci_statfile);
- mci->mci_statfile = NULL;
- }
-
- errno = saveErrno;
-}
-\f/*
-** MCI_LOAD_PERSISTENT -- load persistent host info
-**
-** Load information about host that is kept
-** in common for all running sendmails.
-**
-** Parameters:
-** mci -- the host/connection to load persistent info
-** for.
-**
-** Returns:
-** TRUE -- lock was successful
-** FALSE -- lock failed
-*/
-
-bool
-mci_load_persistent(mci)
- MCI *mci;
-{
- int saveErrno = errno;
- bool locked = TRUE;
- FILE *fp;
- char fname[MAXPATHLEN+1];
-
- if (mci == NULL)
- {
- if (tTd(56, 1))
- printf("mci_load_persistent: NULL mci\n");
- return TRUE;
- }
-
- if (IgnoreHostStatus || HostStatDir == NULL || mci->mci_host == NULL)
- return TRUE;
-
- /* Already have the persistent information in memory */
- if (SingleThreadDelivery && mci->mci_statfile != NULL)
- return TRUE;
-
- if (tTd(56, 1))
- printf("mci_load_persistent: Attempting to load persistent information for %s\n",
- mci->mci_host);
-
- if (mci_generate_persistent_path(mci->mci_host, fname, sizeof fname, FALSE) < 0)
- {
- /* Not much we can do if the file isn't there... */
- if (tTd(56, 1))
- printf("mci_load_persistent: Couldn't generate host path\n");
- goto cleanup;
- }
-
- fp = safefopen(fname, O_RDONLY, FileMode,
- SFF_NOLOCK|SFF_NOLINK|SFF_OPENASROOT|SFF_REGONLY|SFF_SAFEDIRPATH);
- if (fp == NULL)
- {
- /* I can't think of any reason this should ever happen */
- if (tTd(56, 1))
- printf("mci_load_persistent: open(%s): %s\n",
- fname, errstring(errno));
- goto cleanup;
- }
-
- FileName = fname;
- locked = lockfile(fileno(fp), fname, "", LOCK_SH|LOCK_NB);
- (void) mci_read_persistent(fp, mci);
- FileName = NULL;
- if (locked)
- lockfile(fileno(fp), fname, "", LOCK_UN);
- fclose(fp);
-
-cleanup:
- errno = saveErrno;
- return locked;
-}
-\f/*
-** MCI_READ_PERSISTENT -- read persistent host status file
-**
-** Parameters:
-** fp -- the file pointer to read.
-** mci -- the pointer to fill in.
-**
-** Returns:
-** -1 -- if the file was corrupt.
-** 0 -- otherwise.
-**
-** Warning:
-** This code makes the assumption that this data
-** will be read in an atomic fashion, and that the data
-** was written in an atomic fashion. Any other functioning
-** may lead to some form of insanity. This should be
-** perfectly safe due to underlying stdio buffering.
-*/
-
-int
-mci_read_persistent(fp, mci)
- FILE *fp;
- register MCI *mci;
-{
- int ver;
- register char *p;
- int saveLineNumber = LineNumber;
- char buf[MAXLINE];
-
- if (fp == NULL)
- syserr("mci_read_persistent: NULL fp");
- if (mci == NULL)
- syserr("mci_read_persistent: NULL mci");
- if (tTd(56, 93))
- {
- printf("mci_read_persistent: fp=%lx, mci=", (u_long) fp);
- mci_dump(mci, FALSE);
- }
-
- mci->mci_status = NULL;
- if (mci->mci_rstatus != NULL)
- free(mci->mci_rstatus);
- mci->mci_rstatus = NULL;
-
- rewind(fp);
- ver = -1;
- LineNumber = 0;
- while (fgets(buf, sizeof buf, fp) != NULL)
- {
- LineNumber++;
- p = strchr(buf, '\n');
- if (p != NULL)
- *p = '\0';
- switch (buf[0])
- {
- case 'V': /* version stamp */
- ver = atoi(&buf[1]);
- if (ver < 0 || ver > 0)
- syserr("Unknown host status version %d: %d max",
- ver, 0);
- break;
-
- case 'E': /* UNIX error number */
- mci->mci_errno = atoi(&buf[1]);
- break;
-
- case 'H': /* DNS error number */
- mci->mci_herrno = atoi(&buf[1]);
- break;
-
- case 'S': /* UNIX exit status */
- mci->mci_exitstat = atoi(&buf[1]);
- break;
-
- case 'D': /* DSN status */
- mci->mci_status = newstr(&buf[1]);
- break;
-
- case 'R': /* SMTP status */
- mci->mci_rstatus = newstr(&buf[1]);
- break;
-
- case 'U': /* last usage time */
- mci->mci_lastuse = atol(&buf[1]);
- break;
-
- case '.': /* end of file */
- return 0;
-
- default:
- sm_syslog(LOG_CRIT, NOQID,
- "%s: line %d: Unknown host status line \"%s\"",
- FileName == NULL ? mci->mci_host : FileName,
- LineNumber, buf);
- LineNumber = saveLineNumber;
- return -1;
- }
- }
- LineNumber = saveLineNumber;
- if (ver < 0)
- return -1;
- return 0;
-}
-\f/*
-** MCI_STORE_PERSISTENT -- Store persistent MCI information
-**
-** Store information about host that is kept
-** in common for all running sendmails.
-**
-** Parameters:
-** mci -- the host/connection to store persistent info for.
-**
-** Returns:
-** none.
-*/
-
-void
-mci_store_persistent(mci)
- MCI *mci;
-{
- int saveErrno = errno;
-
- if (mci == NULL)
- {
- if (tTd(56, 1))
- printf("mci_store_persistent: NULL mci\n");
- return;
- }
-
- if (HostStatDir == NULL || mci->mci_host == NULL)
- return;
-
- if (tTd(56, 1))
- printf("mci_store_persistent: Storing information for %s\n",
- mci->mci_host);
-
- if (mci->mci_statfile == NULL)
- {
- if (tTd(56, 1))
- printf("mci_store_persistent: no statfile\n");
- return;
- }
-
- rewind(mci->mci_statfile);
-#if !NOFTRUNCATE
- (void) ftruncate(fileno(mci->mci_statfile), (off_t) 0);
-#endif
-
- fprintf(mci->mci_statfile, "V0\n");
- fprintf(mci->mci_statfile, "E%d\n", mci->mci_errno);
- fprintf(mci->mci_statfile, "H%d\n", mci->mci_herrno);
- fprintf(mci->mci_statfile, "S%d\n", mci->mci_exitstat);
- if (mci->mci_status != NULL)
- fprintf(mci->mci_statfile, "D%.80s\n",
- denlstring(mci->mci_status, TRUE, FALSE));
- if (mci->mci_rstatus != NULL)
- fprintf(mci->mci_statfile, "R%.80s\n",
- denlstring(mci->mci_rstatus, TRUE, FALSE));
- fprintf(mci->mci_statfile, "U%ld\n", (long)(mci->mci_lastuse));
- fprintf(mci->mci_statfile, ".\n");
-
- fflush(mci->mci_statfile);
-
- errno = saveErrno;
- return;
-}
-\f/*
-** MCI_TRAVERSE_PERSISTENT -- walk persistent status tree
-**
-** Recursively find all the mci host files in `pathname'. Default to
-** main host status directory if no path is provided.
-** Call (*action)(pathname, host) for each file found.
-**
-** Note: all information is collected in a list before it is processed.
-** This may not be the best way to do it, but it seems safest, since
-** the file system would be touched while we are attempting to traverse
-** the directory tree otherwise (during purges).
-**
-** Parameters:
-** action -- function to call on each node. If returns < 0,
-** return immediately.
-** pathname -- root of tree. If null, use main host status
-** directory.
-**
-** Returns:
-** < 0 -- if any action routine returns a negative value, that
-** value is returned.
-** 0 -- if we successfully went to completion.
-*/
-
-int
-mci_traverse_persistent(action, pathname)
- int (*action)();
- char *pathname;
-{
- struct stat statbuf;
- DIR *d;
- int ret;
-
- if (pathname == NULL)
- pathname = HostStatDir;
- if (pathname == NULL)
- return -1;
-
- if (tTd(56, 1))
- printf("mci_traverse: pathname is %s\n", pathname);
-
- ret = stat(pathname, &statbuf);
- if (ret < 0)
- {
- if (tTd(56, 2))
- printf("mci_traverse: Failed to stat %s: %s\n",
- pathname, errstring(errno));
- return ret;
- }
- if (S_ISDIR(statbuf.st_mode))
- {
- struct dirent *e;
- char *newptr;
- char newpath[MAXPATHLEN+1];
-
- if ((d = opendir(pathname)) == NULL)
- {
- if (tTd(56, 2))
- printf("mci_traverse: opendir %s: %s\n",
- pathname, errstring(errno));
- return -1;
- }
-
- if (strlen(pathname) >= sizeof newpath - MAXNAMLEN - 3)
- {
- if (tTd(56, 2))
- printf("mci_traverse: path \"%s\" too long",
- pathname);
- return -1;
- }
- strcpy(newpath, pathname);
- newptr = newpath + strlen(newpath);
- *newptr++ = '/';
-
- while ((e = readdir(d)) != NULL)
- {
- if (e->d_name[0] == '.')
- continue;
-
- strncpy(newptr, e->d_name,
- sizeof newpath - (newptr - newpath) - 1);
- newpath[sizeof newpath - 1] = '\0';
-
- ret = mci_traverse_persistent(action, newpath);
- if (ret < 0)
- break;
-
- /*
- ** The following appears to be
- ** necessary during purges, since
- ** we modify the directory structure
- */
-
- if (action == mci_purge_persistent)
- rewinddir(d);
- }
-
- /* purge (or whatever) the directory proper */
- *--newptr = '\0';
- ret = (*action)(newpath, NULL);
- closedir(d);
- }
- else if (S_ISREG(statbuf.st_mode))
- {
- char *end = pathname + strlen(pathname) - 1;
- char *start;
- char *scan;
- char host[MAXHOSTNAMELEN];
- char *hostptr = host;
-
- /*
- ** Reconstruct the host name from the path to the
- ** persistent information.
- */
-
- do
- {
- if (hostptr != host)
- *(hostptr++) = '.';
- start = end;
- while (*(start - 1) != '/')
- start--;
-
- if (*end == '.')
- end--;
-
- for (scan = start; scan <= end; scan++)
- *(hostptr++) = *scan;
-
- end = start - 2;
- } while (*end == '.');
-
- *hostptr = '\0';
-
- /*
- ** Do something with the file containing the persistent
- ** information.
- */
- ret = (*action)(pathname, host);
- }
-
- return ret;
-}
-\f/*
-** MCI_PRINT_PERSISTENT -- print persisten info
-**
-** Dump the persistent information in the file 'pathname'
-**
-** Parameters:
-** pathname -- the pathname to the status file.
-** hostname -- the corresponding host name.
-**
-** Returns:
-** 0
-*/
-
-int
-mci_print_persistent(pathname, hostname)
- char *pathname;
- char *hostname;
-{
- static int initflag = FALSE;
- FILE *fp;
- int width = Verbose ? 78 : 25;
- bool locked;
- MCI mcib;
-
- /* skip directories */
- if (hostname == NULL)
- return 0;
-
- if (!initflag)
- {
- initflag = TRUE;
- printf(" -------------- Hostname --------------- How long ago ---------Results---------\n");
- }
-
- fp = safefopen(pathname, O_RDWR, FileMode,
- SFF_NOLOCK|SFF_NOLINK|SFF_OPENASROOT|SFF_REGONLY|SFF_SAFEDIRPATH);
-
- if (fp == NULL)
- {
- if (tTd(56, 1))
- printf("mci_print_persistent: cannot open %s: %s\n",
- pathname, errstring(errno));
- return 0;
- }
-
- FileName = pathname;
- bzero(&mcib, sizeof mcib);
- if (mci_read_persistent(fp, &mcib) < 0)
- {
- syserr("%s: could not read status file", pathname);
- fclose(fp);
- FileName = NULL;
- return 0;
- }
-
- locked = !lockfile(fileno(fp), pathname, "", LOCK_EX|LOCK_NB);
- fclose(fp);
- FileName = NULL;
-
- printf("%c%-39s %12s ",
- locked ? '*' : ' ', hostname,
- pintvl(curtime() - mcib.mci_lastuse, TRUE));
- if (mcib.mci_rstatus != NULL)
- printf("%.*s\n", width, mcib.mci_rstatus);
- else if (mcib.mci_exitstat == EX_TEMPFAIL && mcib.mci_errno != 0)
- printf("Deferred: %.*s\n", width - 10, errstring(mcib.mci_errno));
- else if (mcib.mci_exitstat != 0)
- {
- int i = mcib.mci_exitstat - EX__BASE;
- extern int N_SysEx;
- extern char *SysExMsg[];
-
- if (i < 0 || i >= N_SysEx)
- {
- char buf[80];
-
- snprintf(buf, sizeof buf, "Unknown mailer error %d",
- mcib.mci_exitstat);
- printf("%.*s\n", width, buf);
- }
- else
- printf("%.*s\n", width, &(SysExMsg[i])[5]);
- }
- else if (mcib.mci_errno == 0)
- printf("OK\n");
- else
- printf("OK: %.*s\n", width - 4, errstring(mcib.mci_errno));
-
- return 0;
-}
-\f/*
-** MCI_PURGE_PERSISTENT -- Remove a persistence status file.
-**
-** Parameters:
-** pathname -- path to the status file.
-** hostname -- name of host corresponding to that file.
-** NULL if this is a directory (domain).
-**
-** Returns:
-** 0
-*/
-
-int
-mci_purge_persistent(pathname, hostname)
- char *pathname;
- char *hostname;
-{
- char *end = pathname + strlen(pathname) - 1;
-
- if (tTd(56, 1))
- printf("mci_purge_persistent: purging %s\n", pathname);
-
- if (hostname != NULL)
- {
- /* remove the file */
- if (unlink(pathname) < 0)
- {
- if (tTd(56, 2))
- printf("mci_purge_persistent: failed to unlink %s: %s\n",
- pathname, errstring(errno));
- }
- }
- else
- {
- /* remove the directory */
- if (*end != '.')
- return 0;
-
- if (tTd(56, 1))
- printf("mci_purge_persistent: dpurge %s\n", pathname);
-
- if (rmdir(pathname) < 0)
- {
- if (tTd(56, 2))
- printf("mci_purge_persistent: rmdir %s: %s\n",
- pathname, errstring(errno));
- }
-
- }
-
- return 0;
-}
-\f/*
-** MCI_GENERATE_PERSISTENT_PATH -- generate path from hostname
-**
-** Given `host', convert from a.b.c to $QueueDir/.hoststat/c./b./a,
-** putting the result into `path'. if `createflag' is set, intervening
-** directories will be created as needed.
-**
-** Parameters:
-** host -- host name to convert from.
-** path -- place to store result.
-** pathlen -- length of path buffer.
-** createflag -- if set, create intervening directories as
-** needed.
-**
-** Returns:
-** 0 -- success
-** -1 -- failure
-*/
-
-int
-mci_generate_persistent_path(host, path, pathlen, createflag)
- const char *host;
- char *path;
- int pathlen;
- bool createflag;
-{
- char *elem, *p, *x, ch;
- int ret = 0;
- int len;
- char t_host[MAXHOSTNAMELEN];
-
- /*
- ** Rationality check the arguments.
- */
-
- if (host == NULL)
- {
- syserr("mci_generate_persistent_path: null host");
- return -1;
- }
- if (path == NULL)
- {
- syserr("mci_generate_persistent_path: null path");
- return -1;
- }
-
- if (tTd(56, 80))
- printf("mci_generate_persistent_path(%s): ", host);
-
- if (*host == '\0' || *host == '.')
- return -1;
-
- /* make certain this is not a bracketed host number */
- if (strlen(host) > sizeof t_host - 1)
- return -1;
- if (host[0] == '[')
- strcpy(t_host, host + 1);
- else
- strcpy(t_host, host);
-
- /*
- ** Delete any trailing dots from the hostname.
- ** Leave 'elem' pointing at the \0.
- */
-
- elem = t_host + strlen(t_host);
- while (elem > t_host &&
- (elem[-1] == '.' || (host[0] == '[' && elem[-1] == ']')))
- *--elem = '\0';
-
- /* check for bogus bracketed address */
- if (host[0] == '[' && inet_addr(t_host) == INADDR_NONE)
- return -1;
-
- /* check for what will be the final length of the path */
- len = strlen(HostStatDir) + 2;
- for (p = (char *) t_host; *p != '\0'; p++)
- {
- if (*p == '.')
- len++;
- len++;
- if (p[0] == '.' && p[1] == '.')
- return -1;
- }
- if (len > pathlen || len < 1)
- return -1;
-
- strcpy(path, HostStatDir);
- p = path + strlen(path);
-
- while (elem > t_host)
- {
- if (!path_is_dir(path, createflag))
- {
- ret = -1;
- break;
- }
- elem--;
- while (elem >= t_host && *elem != '.')
- elem--;
- *p++ = '/';
- x = elem + 1;
- while ((ch = *x++) != '\0' && ch != '.')
- {
- if (isascii(ch) && isupper(ch))
- ch = tolower(ch);
- if (ch == '/')
- ch = ':'; /* / -> : */
- *p++ = ch;
- }
- if (elem >= t_host)
- *p++ = '.';
- *p = '\0';
- }
-
- if (tTd(56, 80))
- {
- if (ret < 0)
- printf("FAILURE %d\n", ret);
- else
- printf("SUCCESS %s\n", path);
- }
-
- return (ret);
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1994, 1996-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1994
- * 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.
- *
- */
-
-# include "sendmail.h"
-# include <string.h>
-
-#ifndef lint
-static char sccsid[] = "@(#)mime.c 8.71 (Berkeley) 1/18/1999";
-#endif /* not lint */
-
-/*
-** MIME support.
-**
-** I am indebted to John Beck of Hewlett-Packard, who contributed
-** his code to me for inclusion. As it turns out, I did not use
-** his code since he used a "minimum change" approach that used
-** several temp files, and I wanted a "minimum impact" approach
-** that would avoid copying. However, looking over his code
-** helped me cement my understanding of the problem.
-**
-** I also looked at, but did not directly use, Nathaniel
-** Borenstein's "code.c" module. Again, it functioned as
-** a file-to-file translator, which did not fit within my
-** design bounds, but it was a useful base for understanding
-** the problem.
-*/
-
-#if MIME8TO7
-
-/* character set for hex and base64 encoding */
-char Base16Code[] = "0123456789ABCDEF";
-char Base64Code[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-
-/* types of MIME boundaries */
-#define MBT_SYNTAX 0 /* syntax error */
-#define MBT_NOTSEP 1 /* not a boundary */
-#define MBT_INTERMED 2 /* intermediate boundary (no trailing --) */
-#define MBT_FINAL 3 /* final boundary (trailing -- included) */
-
-static char *MimeBoundaryNames[] =
-{
- "SYNTAX", "NOTSEP", "INTERMED", "FINAL"
-};
-
-bool MapNLtoCRLF;
-
-extern int mimeboundary __P((char *, char **));
-\f/*
-** MIME8TO7 -- output 8 bit body in 7 bit format
-**
-** The header has already been output -- this has to do the
-** 8 to 7 bit conversion. It would be easy if we didn't have
-** to deal with nested formats (multipart/xxx and message/rfc822).
-**
-** We won't be called if we don't have to do a conversion, and
-** appropriate MIME-Version: and Content-Type: fields have been
-** output. Any Content-Transfer-Encoding: field has not been
-** output, and we can add it here.
-**
-** Parameters:
-** mci -- mailer connection information.
-** header -- the header for this body part.
-** e -- envelope.
-** boundaries -- the currently pending message boundaries.
-** NULL if we are processing the outer portion.
-** flags -- to tweak processing.
-**
-** Returns:
-** An indicator of what terminated the message part:
-** MBT_FINAL -- the final boundary
-** MBT_INTERMED -- an intermediate boundary
-** MBT_NOTSEP -- an end of file
-*/
-
-struct args
-{
- char *field; /* name of field */
- char *value; /* value of that field */
-};
-
-int
-mime8to7(mci, header, e, boundaries, flags)
- register MCI *mci;
- HDR *header;
- register ENVELOPE *e;
- char **boundaries;
- int flags;
-{
- register char *p;
- int linelen;
- int bt;
- off_t offset;
- size_t sectionsize, sectionhighbits;
- int i;
- char *type;
- char *subtype;
- char *cte;
- char **pvp;
- int argc = 0;
- char *bp;
- bool use_qp = FALSE;
- struct args argv[MAXMIMEARGS];
- char bbuf[128];
- char buf[MAXLINE];
- char pvpbuf[MAXLINE];
- extern u_char MimeTokenTab[256];
- extern int mime_getchar __P((FILE *, char **, int *));
- extern int mime_getchar_crlf __P((FILE *, char **, int *));
-
- if (tTd(43, 1))
- {
- printf("mime8to7: flags = %x, boundaries =", flags);
- if (boundaries[0] == NULL)
- printf(" <none>");
- else
- {
- for (i = 0; boundaries[i] != NULL; i++)
- printf(" %s", boundaries[i]);
- }
- printf("\n");
- }
- MapNLtoCRLF = TRUE;
- p = hvalue("Content-Transfer-Encoding", header);
- if (p == NULL ||
- (pvp = prescan(p, '\0', pvpbuf, sizeof pvpbuf, NULL,
- MimeTokenTab)) == NULL ||
- pvp[0] == NULL)
- {
- cte = NULL;
- }
- else
- {
- cataddr(pvp, NULL, buf, sizeof buf, '\0');
- cte = newstr(buf);
- }
-
- type = subtype = NULL;
- p = hvalue("Content-Type", header);
- if (p == NULL)
- {
- if (bitset(M87F_DIGEST, flags))
- p = "message/rfc822";
- else
- p = "text/plain";
- }
- if (p != NULL &&
- (pvp = prescan(p, '\0', pvpbuf, sizeof pvpbuf, NULL,
- MimeTokenTab)) != NULL &&
- pvp[0] != NULL)
- {
- if (tTd(43, 40))
- {
- for (i = 0; pvp[i] != NULL; i++)
- printf("pvp[%d] = \"%s\"\n", i, pvp[i]);
- }
- type = *pvp++;
- if (*pvp != NULL && strcmp(*pvp, "/") == 0 &&
- *++pvp != NULL)
- {
- subtype = *pvp++;
- }
-
- /* break out parameters */
- while (*pvp != NULL && argc < MAXMIMEARGS)
- {
- /* skip to semicolon separator */
- while (*pvp != NULL && strcmp(*pvp, ";") != 0)
- pvp++;
- if (*pvp++ == NULL || *pvp == NULL)
- break;
-
- /* extract field name */
- argv[argc].field = *pvp++;
-
- /* see if there is a value */
- if (*pvp != NULL && strcmp(*pvp, "=") == 0 &&
- (*++pvp == NULL || strcmp(*pvp, ";") != 0))
- {
- argv[argc].value = *pvp;
- argc++;
- }
- }
- }
-
- /* check for disaster cases */
- if (type == NULL)
- type = "-none-";
- if (subtype == NULL)
- subtype = "-none-";
-
- /* don't propogate some flags more than one level into the message */
- flags &= ~M87F_DIGEST;
-
- /*
- ** Check for cases that can not be encoded.
- **
- ** For example, you can't encode certain kinds of types
- ** or already-encoded messages. If we find this case,
- ** just copy it through.
- */
-
- snprintf(buf, sizeof buf, "%.100s/%.100s", type, subtype);
- if (wordinclass(buf, 'n') || (cte != NULL && !wordinclass(cte, 'e')))
- flags |= M87F_NO8BIT;
-
-#ifdef USE_B_CLASS
- if (wordinclass(buf, 'b') || wordinclass(type, 'b'))
- MapNLtoCRLF = FALSE;
-#endif
- if (wordinclass(buf, 'q') || wordinclass(type, 'q'))
- use_qp = TRUE;
-
- /*
- ** Multipart requires special processing.
- **
- ** Do a recursive descent into the message.
- */
-
- if (strcasecmp(type, "multipart") == 0 &&
- (!bitset(M87F_NO8BIT, flags) || bitset(M87F_NO8TO7, flags)))
- {
- int blen;
-
- if (strcasecmp(subtype, "digest") == 0)
- flags |= M87F_DIGEST;
-
- for (i = 0; i < argc; i++)
- {
- if (strcasecmp(argv[i].field, "boundary") == 0)
- break;
- }
- if (i >= argc || argv[i].value == NULL)
- {
- syserr("mime8to7: Content-Type: \"%s\": %s boundary",
- i >= argc ? "missing" : "bogus", p);
- p = "---";
-
- /* avoid bounce loops */
- e->e_flags |= EF_DONT_MIME;
- }
- else
- {
- p = argv[i].value;
- stripquotes(p);
- }
- blen = strlen(p);
- if (blen > sizeof bbuf - 1)
- {
- syserr("mime8to7: multipart boundary \"%s\" too long",
- p);
- blen = sizeof bbuf - 1;
-
- /* avoid bounce loops */
- e->e_flags |= EF_DONT_MIME;
- }
- strncpy(bbuf, p, blen);
- bbuf[blen] = '\0';
- if (tTd(43, 1))
- printf("mime8to7: multipart boundary \"%s\"\n", bbuf);
- for (i = 0; i < MAXMIMENESTING; i++)
- if (boundaries[i] == NULL)
- break;
- if (i >= MAXMIMENESTING)
- {
- syserr("mime8to7: multipart nesting boundary too deep");
-
- /* avoid bounce loops */
- e->e_flags |= EF_DONT_MIME;
- }
- else
- {
- boundaries[i] = bbuf;
- boundaries[i + 1] = NULL;
- }
- mci->mci_flags |= MCIF_INMIME;
-
- /* skip the early "comment" prologue */
- putline("", mci);
- mci->mci_flags &= ~MCIF_INHEADER;
- while (fgets(buf, sizeof buf, e->e_dfp) != NULL)
- {
- bt = mimeboundary(buf, boundaries);
- if (bt != MBT_NOTSEP)
- break;
- putxline(buf, strlen(buf), mci, PXLF_MAPFROM|PXLF_STRIP8BIT);
- if (tTd(43, 99))
- printf(" ...%s", buf);
- }
- if (feof(e->e_dfp))
- bt = MBT_FINAL;
- while (bt != MBT_FINAL)
- {
- auto HDR *hdr = NULL;
-
- snprintf(buf, sizeof buf, "--%s", bbuf);
- putline(buf, mci);
- if (tTd(43, 35))
- printf(" ...%s\n", buf);
- collect(e->e_dfp, FALSE, &hdr, e);
- if (tTd(43, 101))
- putline("+++after collect", mci);
- putheader(mci, hdr, e, flags);
- if (tTd(43, 101))
- putline("+++after putheader", mci);
- bt = mime8to7(mci, hdr, e, boundaries, flags);
- }
- snprintf(buf, sizeof buf, "--%s--", bbuf);
- putline(buf, mci);
- if (tTd(43, 35))
- printf(" ...%s\n", buf);
- boundaries[i] = NULL;
- mci->mci_flags &= ~MCIF_INMIME;
-
- /* skip the late "comment" epilogue */
- while (fgets(buf, sizeof buf, e->e_dfp) != NULL)
- {
- bt = mimeboundary(buf, boundaries);
- if (bt != MBT_NOTSEP)
- break;
- putxline(buf, strlen(buf), mci, PXLF_MAPFROM|PXLF_STRIP8BIT);
- if (tTd(43, 99))
- printf(" ...%s", buf);
- }
- if (feof(e->e_dfp))
- bt = MBT_FINAL;
- if (tTd(43, 3))
- printf("\t\t\tmime8to7=>%s (multipart)\n",
- MimeBoundaryNames[bt]);
- return bt;
- }
-
- /*
- ** Message/xxx types -- recurse exactly once.
- **
- ** Class 's' is predefined to have "rfc822" only.
- */
-
- if (strcasecmp(type, "message") == 0)
- {
- if (!wordinclass(subtype, 's'))
- {
- flags |= M87F_NO8BIT;
- }
- else
- {
- auto HDR *hdr = NULL;
-
- putline("", mci);
-
- mci->mci_flags |= MCIF_INMIME;
- collect(e->e_dfp, FALSE, &hdr, e);
- if (tTd(43, 101))
- putline("+++after collect", mci);
- putheader(mci, hdr, e, flags);
- if (tTd(43, 101))
- putline("+++after putheader", mci);
- if (hvalue("MIME-Version", hdr) == NULL)
- putline("MIME-Version: 1.0", mci);
- bt = mime8to7(mci, hdr, e, boundaries, flags);
- mci->mci_flags &= ~MCIF_INMIME;
- return bt;
- }
- }
-
- /*
- ** Non-compound body type
- **
- ** Compute the ratio of seven to eight bit characters;
- ** use that as a heuristic to decide how to do the
- ** encoding.
- */
-
- sectionsize = sectionhighbits = 0;
- if (!bitset(M87F_NO8BIT|M87F_NO8TO7, flags))
- {
- /* remember where we were */
- offset = ftell(e->e_dfp);
- if (offset == -1)
- syserr("mime8to7: cannot ftell on df%s", e->e_id);
-
- /* do a scan of this body type to count character types */
- while (fgets(buf, sizeof buf, e->e_dfp) != NULL)
- {
- if (mimeboundary(buf, boundaries) != MBT_NOTSEP)
- break;
- for (p = buf; *p != '\0'; p++)
- {
- /* count bytes with the high bit set */
- sectionsize++;
- if (bitset(0200, *p))
- sectionhighbits++;
- }
-
- /*
- ** Heuristic: if 1/4 of the first 4K bytes are 8-bit,
- ** assume base64. This heuristic avoids double-reading
- ** large graphics or video files.
- */
-
- if (sectionsize >= 4096 &&
- sectionhighbits > sectionsize / 4)
- break;
- }
-
- /* return to the original offset for processing */
- /* XXX use relative seeks to handle >31 bit file sizes? */
- if (fseek(e->e_dfp, offset, SEEK_SET) < 0)
- syserr("mime8to7: cannot fseek on df%s", e->e_id);
- else
- clearerr(e->e_dfp);
- }
-
- /*
- ** Heuristically determine encoding method.
- ** If more than 1/8 of the total characters have the
- ** eighth bit set, use base64; else use quoted-printable.
- ** However, only encode binary encoded data as base64,
- ** since otherwise the NL=>CRLF mapping will be a problem.
- */
-
- if (tTd(43, 8))
- {
- printf("mime8to7: %ld high bit(s) in %ld byte(s), cte=%s, type=%s/%s\n",
- (long) sectionhighbits, (long) sectionsize,
- cte == NULL ? "[none]" : cte,
- type == NULL ? "[none]" : type,
- subtype == NULL ? "[none]" : subtype);
- }
- if (cte != NULL && strcasecmp(cte, "binary") == 0)
- sectionsize = sectionhighbits;
- linelen = 0;
- bp = buf;
- if (sectionhighbits == 0)
- {
- /* no encoding necessary */
- if (cte != NULL &&
- bitset(MCIF_INMIME, mci->mci_flags) &&
- !bitset(M87F_NO8TO7, flags))
- {
- /*
- ** Skip _unless_ in MIME mode and potentially
- ** converting from 8 bit to 7 bit MIME. See
- ** putheader() for the counterpart where the
- ** CTE header is skipped in the opposite
- ** situation.
- */
-
- snprintf(buf, sizeof buf,
- "Content-Transfer-Encoding: %.200s", cte);
- putline(buf, mci);
- if (tTd(43, 36))
- printf(" ...%s\n", buf);
- }
- putline("", mci);
- mci->mci_flags &= ~MCIF_INHEADER;
- while (fgets(buf, sizeof buf, e->e_dfp) != NULL)
- {
- bt = mimeboundary(buf, boundaries);
- if (bt != MBT_NOTSEP)
- break;
- putline(buf, mci);
- }
- if (feof(e->e_dfp))
- bt = MBT_FINAL;
- }
- else if (!MapNLtoCRLF ||
- (sectionsize / 8 < sectionhighbits && !use_qp))
- {
- /* use base64 encoding */
- int c1, c2;
-
- if (tTd(43, 36))
- printf(" ...Content-Transfer-Encoding: base64\n");
- putline("Content-Transfer-Encoding: base64", mci);
- snprintf(buf, sizeof buf,
- "X-MIME-Autoconverted: from 8bit to base64 by %s id %s",
- MyHostName, e->e_id);
- putline(buf, mci);
- putline("", mci);
- mci->mci_flags &= ~MCIF_INHEADER;
- while ((c1 = mime_getchar_crlf(e->e_dfp, boundaries, &bt)) != EOF)
- {
- if (linelen > 71)
- {
- *bp = '\0';
- putline(buf, mci);
- linelen = 0;
- bp = buf;
- }
- linelen += 4;
- *bp++ = Base64Code[(c1 >> 2)];
- c1 = (c1 & 0x03) << 4;
- c2 = mime_getchar_crlf(e->e_dfp, boundaries, &bt);
- if (c2 == EOF)
- {
- *bp++ = Base64Code[c1];
- *bp++ = '=';
- *bp++ = '=';
- break;
- }
- c1 |= (c2 >> 4) & 0x0f;
- *bp++ = Base64Code[c1];
- c1 = (c2 & 0x0f) << 2;
- c2 = mime_getchar_crlf(e->e_dfp, boundaries, &bt);
- if (c2 == EOF)
- {
- *bp++ = Base64Code[c1];
- *bp++ = '=';
- break;
- }
- c1 |= (c2 >> 6) & 0x03;
- *bp++ = Base64Code[c1];
- *bp++ = Base64Code[c2 & 0x3f];
- }
- *bp = '\0';
- putline(buf, mci);
- }
- else
- {
- /* use quoted-printable encoding */
- int c1, c2;
- int fromstate;
- BITMAP badchars;
-
- /* set up map of characters that must be mapped */
- clrbitmap(badchars);
- for (c1 = 0x00; c1 < 0x20; c1++)
- setbitn(c1, badchars);
- clrbitn('\t', badchars);
- for (c1 = 0x7f; c1 < 0x100; c1++)
- setbitn(c1, badchars);
- setbitn('=', badchars);
- if (bitnset(M_EBCDIC, mci->mci_mailer->m_flags))
- for (p = "!\"#$@[\\]^`{|}~"; *p != '\0'; p++)
- setbitn(*p, badchars);
-
- if (tTd(43, 36))
- printf(" ...Content-Transfer-Encoding: quoted-printable\n");
- putline("Content-Transfer-Encoding: quoted-printable", mci);
- snprintf(buf, sizeof buf,
- "X-MIME-Autoconverted: from 8bit to quoted-printable by %s id %s",
- MyHostName, e->e_id);
- putline(buf, mci);
- putline("", mci);
- mci->mci_flags &= ~MCIF_INHEADER;
- fromstate = 0;
- c2 = '\n';
- while ((c1 = mime_getchar(e->e_dfp, boundaries, &bt)) != EOF)
- {
- if (c1 == '\n')
- {
- if (c2 == ' ' || c2 == '\t')
- {
- *bp++ = '=';
- *bp++ = Base16Code[(c2 >> 4) & 0x0f];
- *bp++ = Base16Code[c2 & 0x0f];
- }
- if (buf[0] == '.' && bp == &buf[1])
- {
- buf[0] = '=';
- *bp++ = Base16Code[('.' >> 4) & 0x0f];
- *bp++ = Base16Code['.' & 0x0f];
- }
- *bp = '\0';
- putline(buf, mci);
- linelen = fromstate = 0;
- bp = buf;
- c2 = c1;
- continue;
- }
- if (c2 == ' ' && linelen == 4 && fromstate == 4 &&
- bitnset(M_ESCFROM, mci->mci_mailer->m_flags))
- {
- *bp++ = '=';
- *bp++ = '2';
- *bp++ = '0';
- linelen += 3;
- }
- else if (c2 == ' ' || c2 == '\t')
- {
- *bp++ = c2;
- linelen++;
- }
- if (linelen > 72 &&
- (linelen > 75 || c1 != '.' ||
- (linelen > 73 && c2 == '.')))
- {
- if (linelen > 73 && c2 == '.')
- bp--;
- else
- c2 = '\n';
- *bp++ = '=';
- *bp = '\0';
- putline(buf, mci);
- linelen = fromstate = 0;
- bp = buf;
- if (c2 == '.')
- {
- *bp++ = '.';
- linelen++;
- }
- }
- if (bitnset(c1 & 0xff, badchars))
- {
- *bp++ = '=';
- *bp++ = Base16Code[(c1 >> 4) & 0x0f];
- *bp++ = Base16Code[c1 & 0x0f];
- linelen += 3;
- }
- else if (c1 != ' ' && c1 != '\t')
- {
- if (linelen < 4 && c1 == "From"[linelen])
- fromstate++;
- *bp++ = c1;
- linelen++;
- }
- c2 = c1;
- }
-
- /* output any saved character */
- if (c2 == ' ' || c2 == '\t')
- {
- *bp++ = '=';
- *bp++ = Base16Code[(c2 >> 4) & 0x0f];
- *bp++ = Base16Code[c2 & 0x0f];
- linelen += 3;
- }
-
- if (linelen > 0 || boundaries[0] != NULL)
- {
- *bp = '\0';
- putline(buf, mci);
- }
-
- }
- if (tTd(43, 3))
- printf("\t\t\tmime8to7=>%s (basic)\n", MimeBoundaryNames[bt]);
- return bt;
-}
-\f/*
-** MIME_GETCHAR -- get a character for MIME processing
-**
-** Treats boundaries as EOF.
-**
-** Parameters:
-** fp -- the input file.
-** boundaries -- the current MIME boundaries.
-** btp -- if the return value is EOF, *btp is set to
-** the type of the boundary.
-**
-** Returns:
-** The next character in the input stream.
-*/
-
-int
-mime_getchar(fp, boundaries, btp)
- register FILE *fp;
- char **boundaries;
- int *btp;
-{
- int c;
- static u_char *bp = NULL;
- static int buflen = 0;
- static bool atbol = TRUE; /* at beginning of line */
- static int bt = MBT_SYNTAX; /* boundary type of next EOF */
- static u_char buf[128]; /* need not be a full line */
- int start = 0; /* indicates position of - in buffer */
-
- if (buflen == 1 && *bp == '\n')
- {
- /* last \n in buffer may be part of next MIME boundary */
- c = *bp;
- }
- else if (buflen > 0)
- {
- buflen--;
- return *bp++;
- }
- else
- c = getc(fp);
- bp = buf;
- buflen = 0;
- if (c == '\n')
- {
- /* might be part of a MIME boundary */
- *bp++ = c;
- atbol = TRUE;
- c = getc(fp);
- if (c == '\n')
- {
- ungetc(c, fp);
- return c;
- }
- start = 1;
- }
- if (c != EOF)
- *bp++ = c;
- else
- bt = MBT_FINAL;
- if (atbol && c == '-')
- {
- /* check for a message boundary */
- c = getc(fp);
- if (c != '-')
- {
- if (c != EOF)
- *bp++ = c;
- else
- bt = MBT_FINAL;
- buflen = bp - buf - 1;
- bp = buf;
- return *bp++;
- }
-
- /* got "--", now check for rest of separator */
- *bp++ = '-';
- while (bp < &buf[sizeof buf - 2] &&
- (c = getc(fp)) != EOF && c != '\n')
- {
- *bp++ = c;
- }
- *bp = '\0';
- bt = mimeboundary((char *) &buf[start], boundaries);
- switch (bt)
- {
- case MBT_FINAL:
- case MBT_INTERMED:
- /* we have a message boundary */
- buflen = 0;
- *btp = bt;
- return EOF;
- }
-
- atbol = c == '\n';
- if (c != EOF)
- *bp++ = c;
- }
-
- buflen = bp - buf - 1;
- if (buflen < 0)
- {
- *btp = bt;
- return EOF;
- }
- bp = buf;
- return *bp++;
-}
-\f/*
-** MIME_GETCHAR_CRLF -- do mime_getchar, but translate NL => CRLF
-**
-** Parameters:
-** fp -- the input file.
-** boundaries -- the current MIME boundaries.
-** btp -- if the return value is EOF, *btp is set to
-** the type of the boundary.
-**
-** Returns:
-** The next character in the input stream.
-*/
-
-int
-mime_getchar_crlf(fp, boundaries, btp)
- register FILE *fp;
- char **boundaries;
- int *btp;
-{
- static bool sendlf = FALSE;
- int c;
-
- if (sendlf)
- {
- sendlf = FALSE;
- return '\n';
- }
- c = mime_getchar(fp, boundaries, btp);
- if (c == '\n' && MapNLtoCRLF)
- {
- sendlf = TRUE;
- return '\r';
- }
- return c;
-}
-\f/*
-** MIMEBOUNDARY -- determine if this line is a MIME boundary & its type
-**
-** Parameters:
-** line -- the input line.
-** boundaries -- the set of currently pending boundaries.
-**
-** Returns:
-** MBT_NOTSEP -- if this is not a separator line
-** MBT_INTERMED -- if this is an intermediate separator
-** MBT_FINAL -- if this is a final boundary
-** MBT_SYNTAX -- if this is a boundary for the wrong
-** enclosure -- i.e., a syntax error.
-*/
-
-int
-mimeboundary(line, boundaries)
- register char *line;
- char **boundaries;
-{
- int type = MBT_NOTSEP;
- int i;
- int savec;
- extern int isboundary __P((char *, char **));
-
- if (line[0] != '-' || line[1] != '-' || boundaries == NULL)
- return MBT_NOTSEP;
- i = strlen(line);
- if (line[i - 1] == '\n')
- i--;
-
- /* strip off trailing whitespace */
- while (line[i - 1] == ' ' || line[i - 1] == '\t')
- i--;
- savec = line[i];
- line[i] = '\0';
-
- if (tTd(43, 5))
- printf("mimeboundary: line=\"%s\"... ", line);
-
- /* check for this as an intermediate boundary */
- if (isboundary(&line[2], boundaries) >= 0)
- type = MBT_INTERMED;
- else if (i > 2 && strncmp(&line[i - 2], "--", 2) == 0)
- {
- /* check for a final boundary */
- line[i - 2] = '\0';
- if (isboundary(&line[2], boundaries) >= 0)
- type = MBT_FINAL;
- line[i - 2] = '-';
- }
-
- line[i] = savec;
- if (tTd(43, 5))
- printf("%s\n", MimeBoundaryNames[type]);
- return type;
-}
-\f/*
-** DEFCHARSET -- return default character set for message
-**
-** The first choice for character set is for the mailer
-** corresponding to the envelope sender. If neither that
-** nor the global configuration file has a default character
-** set defined, return "unknown-8bit" as recommended by
-** RFC 1428 section 3.
-**
-** Parameters:
-** e -- the envelope for this message.
-**
-** Returns:
-** The default character set for that mailer.
-*/
-
-char *
-defcharset(e)
- register ENVELOPE *e;
-{
- if (e != NULL && e->e_from.q_mailer != NULL &&
- e->e_from.q_mailer->m_defcharset != NULL)
- return e->e_from.q_mailer->m_defcharset;
- if (DefaultCharSet != NULL)
- return DefaultCharSet;
- return "unknown-8bit";
-}
-\f/*
-** ISBOUNDARY -- is a given string a currently valid boundary?
-**
-** Parameters:
-** line -- the current input line.
-** boundaries -- the list of valid boundaries.
-**
-** Returns:
-** The index number in boundaries if the line is found.
-** -1 -- otherwise.
-**
-*/
-
-int
-isboundary(line, boundaries)
- char *line;
- char **boundaries;
-{
- register int i;
-
- for (i = 0; boundaries[i] != NULL; i++)
- {
- if (strcmp(line, boundaries[i]) == 0)
- return i;
- }
- return -1;
-}
-
-#endif /* MIME8TO7 */
-\f
-#if MIME7TO8
-
-/*
-** MIME7TO8 -- output 7 bit encoded MIME body in 8 bit format
-**
-** This is a hack. Supports translating the two 7-bit body-encodings
-** (quoted-printable and base64) to 8-bit coded bodies.
-**
-** There is not much point in supporting multipart here, as the UA
-** will be able to deal with encoded MIME bodies if it can parse MIME
-** multipart messages.
-**
-** Note also that we wont be called unless it is a text/plain MIME
-** message, encoded base64 or QP and mailer flag '9' has been defined
-** on mailer.
-**
-** Contributed by Marius Olaffson <marius@rhi.hi.is>.
-**
-** Parameters:
-** mci -- mailer connection information.
-** header -- the header for this body part.
-** e -- envelope.
-**
-** Returns:
-** none.
-*/
-
-extern int mime_fromqp __P((u_char *, u_char **, int, int));
-
-static char index_64[128] =
-{
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63,
- 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1,-1,-1,-1,
- -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14,
- 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1,
- -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40,
- 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1
-};
-
-#define CHAR64(c) (((c) < 0 || (c) > 127) ? -1 : index_64[(c)])
-
-
-void
-mime7to8(mci, header, e)
- register MCI *mci;
- HDR *header;
- register ENVELOPE *e;
-{
- register char *p;
- char *cte;
- char **pvp;
- u_char *fbufp;
- char buf[MAXLINE];
- u_char fbuf[MAXLINE + 1];
- char pvpbuf[MAXLINE];
- extern u_char MimeTokenTab[256];
-
- p = hvalue("Content-Transfer-Encoding", header);
- if (p == NULL ||
- (pvp = prescan(p, '\0', pvpbuf, sizeof pvpbuf, NULL,
- MimeTokenTab)) == NULL ||
- pvp[0] == NULL)
- {
- /* "can't happen" -- upper level should have caught this */
- syserr("mime7to8: unparsable CTE %s", p == NULL ? "<NULL>" : p);
-
- /* avoid bounce loops */
- e->e_flags |= EF_DONT_MIME;
-
- /* cheap failsafe algorithm -- should work on text/plain */
- if (p != NULL)
- {
- snprintf(buf, sizeof buf,
- "Content-Transfer-Encoding: %s", p);
- putline(buf, mci);
- }
- putline("", mci);
- mci->mci_flags &= ~MCIF_INHEADER;
- while (fgets(buf, sizeof buf, e->e_dfp) != NULL)
- putline(buf, mci);
- return;
- }
- cataddr(pvp, NULL, buf, sizeof buf, '\0');
- cte = newstr(buf);
-
- mci->mci_flags |= MCIF_INHEADER;
- putline("Content-Transfer-Encoding: 8bit", mci);
- snprintf(buf, sizeof buf,
- "X-MIME-Autoconverted: from %.200s to 8bit by %s id %s",
- cte, MyHostName, e->e_id);
- putline(buf, mci);
- putline("", mci);
- mci->mci_flags &= ~MCIF_INHEADER;
-
- /*
- ** Translate body encoding to 8-bit. Supports two types of
- ** encodings; "base64" and "quoted-printable". Assume qp if
- ** it is not base64.
- */
-
- if (strcasecmp(cte, "base64") == 0)
- {
- int c1, c2, c3, c4;
-
- fbufp = fbuf;
- while ((c1 = fgetc(e->e_dfp)) != EOF)
- {
- if (isascii(c1) && isspace(c1))
- continue;
-
- do
- {
- c2 = fgetc(e->e_dfp);
- } while (isascii(c2) && isspace(c2));
- if (c2 == EOF)
- break;
-
- do
- {
- c3 = fgetc(e->e_dfp);
- } while (isascii(c3) && isspace(c3));
- if (c3 == EOF)
- break;
-
- do
- {
- c4 = fgetc(e->e_dfp);
- } while (isascii(c4) && isspace(c4));
- if (c4 == EOF)
- break;
-
- if (c1 == '=' || c2 == '=')
- continue;
- c1 = CHAR64(c1);
- c2 = CHAR64(c2);
-
- *fbufp = (c1 << 2) | ((c2 & 0x30) >> 4);
- if (*fbufp++ == '\n' || fbufp >= &fbuf[MAXLINE])
- {
- if (*--fbufp != '\n' ||
- (fbufp > fbuf && *--fbufp != '\r'))
- fbufp++;
- putxline((char *) fbuf, fbufp - fbuf,
- mci, PXLF_MAPFROM);
- fbufp = fbuf;
- }
- if (c3 == '=')
- continue;
- c3 = CHAR64(c3);
- *fbufp = ((c2 & 0x0f) << 4) | ((c3 & 0x3c) >> 2);
- if (*fbufp++ == '\n' || fbufp >= &fbuf[MAXLINE])
- {
- if (*--fbufp != '\n' ||
- (fbufp > fbuf && *--fbufp != '\r'))
- fbufp++;
- putxline((char *) fbuf, fbufp - fbuf,
- mci, PXLF_MAPFROM);
- fbufp = fbuf;
- }
- if (c4 == '=')
- continue;
- c4 = CHAR64(c4);
- *fbufp = ((c3 & 0x03) << 6) | c4;
- if (*fbufp++ == '\n' || fbufp >= &fbuf[MAXLINE])
- {
- if (*--fbufp != '\n' ||
- (fbufp > fbuf && *--fbufp != '\r'))
- fbufp++;
- putxline((char *) fbuf, fbufp - fbuf,
- mci, PXLF_MAPFROM);
- fbufp = fbuf;
- }
- }
- }
- else
- {
- /* quoted-printable */
- fbufp = fbuf;
- while (fgets(buf, sizeof buf, e->e_dfp) != NULL)
- {
- if (mime_fromqp((u_char *) buf, &fbufp, 0,
- &fbuf[MAXLINE] - fbufp) == 0)
- continue;
-
- if (fbufp - fbuf > 0)
- putxline((char *) fbuf, fbufp - fbuf - 1, mci,
- PXLF_MAPFROM);
- fbufp = fbuf;
- }
- }
-
- /* force out partial last line */
- if (fbufp > fbuf)
- {
- *fbufp = '\0';
- putxline((char *) fbuf, fbufp - fbuf, mci, PXLF_MAPFROM);
- }
- if (tTd(43, 3))
- printf("\t\t\tmime7to8 => %s to 8bit done\n", cte);
-}
-\f/*
-** The following is based on Borenstein's "codes.c" module, with simplifying
-** changes as we do not deal with multipart, and to do the translation in-core,
-** with an attempt to prevent overrun of output buffers.
-**
-** What is needed here are changes to defned this code better against
-** bad encodings. Questionable to always return 0xFF for bad mappings.
-*/
-
-static char index_hex[128] =
-{
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1, -1,-1,-1,-1,
- -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1,
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1,
- -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1,
- -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1
-};
-
-#define HEXCHAR(c) (((c) < 0 || (c) > 127) ? -1 : index_hex[(c)])
-
-int
-mime_fromqp(infile, outfile, state, maxlen)
- u_char *infile;
- u_char **outfile;
- int state; /* Decoding body (0) or header (1) */
- int maxlen; /* Max # of chars allowed in outfile */
-{
- int c1, c2;
- int nchar = 0;
-
- while ((c1 = *infile++) != '\0')
- {
- if (c1 == '=')
- {
- if ((c1 = *infile++) == 0)
- break;
-
- if (c1 == '\n' || (c1 = HEXCHAR(c1)) == -1)
- {
- /* ignore it */
- if (state == 0)
- return 0;
- }
- else
- {
- do
- {
- if ((c2 = *infile++) == '\0')
- {
- c2 = -1;
- break;
- }
- } while ((c2 = HEXCHAR(c2)) == -1);
-
- if (c2 == -1 || ++nchar > maxlen)
- break;
-
- *(*outfile)++ = c1 << 4 | c2;
- }
- }
- else
- {
- if (state == 1 && c1 == '_')
- c1 = ' ';
-
- if (++nchar > maxlen)
- break;
-
- *(*outfile)++ = c1;
-
- if (c1 == '\n')
- break;
- }
- }
- *(*outfile)++ = '\0';
- return 1;
-}
-
-
-#endif /* MIME7TO8 */
+++ /dev/null
-.\" Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-.\" Copyright (c) 1983, 1997 Eric P. Allman. All rights reserved.
-.\" Copyright (c) 1985, 1990, 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.
-.\"
-.\"
-.\" @(#)newaliases.1 8.10 (Berkeley) 5/19/1998
-.\"
-.Dd May 19, 1998
-.Dt NEWALIASES 1
-.Os
-.Sh NAME
-.Nm newaliases
-.Nd rebuild the data base for the mail aliases file
-.Sh SYNOPSIS
-.Nm newaliases
-.Sh DESCRIPTION
-.Nm Newaliases
-rebuilds the random access data base for the mail aliases file
-.Pa /etc/aliases .
-It must be run each time this file is changed in order
-for the change to take effect.
-.Pp
-.Nm Newaliases
-is identical to
-.Dq Li "sendmail -bi" .
-.Pp
-The
-.Nm newaliases
-utility exits 0 on success, and >0 if an error occurs.
-.Sh FILES
-.Bl -tag -width /etc/aliases -compact
-.It Pa /etc/aliases
-The mail aliases file
-.El
-.Sh SEE ALSO
-.Xr aliases 5 ,
-.Xr mailer.conf 5 ,
-.Xr sendmail 8
-.Sh HISTORY
-The
-.Nm newaliases
-command appeared in
-.Bx 4.0 .
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)parseaddr.c 8.156 (Berkeley) 10/27/1998";
-#endif /* not lint */
-
-# include "sendmail.h"
-
-/*
-** PARSEADDR -- Parse an address
-**
-** Parses an address and breaks it up into three parts: a
-** net to transmit the message on, the host to transmit it
-** to, and a user on that host. These are loaded into an
-** ADDRESS header with the values squirreled away if necessary.
-** The "user" part may not be a real user; the process may
-** just reoccur on that machine. For example, on a machine
-** with an arpanet connection, the address
-** csvax.bill@berkeley
-** will break up to a "user" of 'csvax.bill' and a host
-** of 'berkeley' -- to be transmitted over the arpanet.
-**
-** Parameters:
-** addr -- the address to parse.
-** a -- a pointer to the address descriptor buffer.
-** If NULL, a header will be created.
-** flags -- describe detail for parsing. See RF_ definitions
-** in sendmail.h.
-** delim -- the character to terminate the address, passed
-** to prescan.
-** delimptr -- if non-NULL, set to the location of the
-** delim character that was found.
-** e -- the envelope that will contain this address.
-**
-** Returns:
-** A pointer to the address descriptor header (`a' if
-** `a' is non-NULL).
-** NULL on error.
-**
-** Side Effects:
-** none
-*/
-
-/* following delimiters are inherent to the internal algorithms */
-# define DELIMCHARS "()<>,;\r\n" /* default word delimiters */
-
-ADDRESS *
-parseaddr(addr, a, flags, delim, delimptr, e)
- char *addr;
- register ADDRESS *a;
- int flags;
- int delim;
- char **delimptr;
- register ENVELOPE *e;
-{
- register char **pvp;
- auto char *delimptrbuf;
- bool queueup;
- char pvpbuf[PSBUFSIZE];
- extern bool invalidaddr __P((char *, char *));
- extern void allocaddr __P((ADDRESS *, int, char *));
-
- /*
- ** Initialize and prescan address.
- */
-
- e->e_to = addr;
- if (tTd(20, 1))
- printf("\n--parseaddr(%s)\n", addr);
-
- if (delimptr == NULL)
- delimptr = &delimptrbuf;
-
- pvp = prescan(addr, delim, pvpbuf, sizeof pvpbuf, delimptr, NULL);
- if (pvp == NULL)
- {
- if (tTd(20, 1))
- printf("parseaddr-->NULL\n");
- return (NULL);
- }
-
- if (invalidaddr(addr, delim == '\0' ? NULL : *delimptr))
- {
- if (tTd(20, 1))
- printf("parseaddr-->bad address\n");
- return NULL;
- }
-
- /*
- ** Save addr if we are going to have to.
- **
- ** We have to do this early because there is a chance that
- ** the map lookups in the rewriting rules could clobber
- ** static memory somewhere.
- */
-
- if (bitset(RF_COPYPADDR, flags) && addr != NULL)
- {
- char savec = **delimptr;
-
- if (savec != '\0')
- **delimptr = '\0';
- e->e_to = addr = newstr(addr);
- if (savec != '\0')
- **delimptr = savec;
- }
-
- /*
- ** Apply rewriting rules.
- ** Ruleset 0 does basic parsing. It must resolve.
- */
-
- queueup = FALSE;
- if (rewrite(pvp, 3, 0, e) == EX_TEMPFAIL)
- queueup = TRUE;
- if (rewrite(pvp, 0, 0, e) == EX_TEMPFAIL)
- queueup = TRUE;
-
-
- /*
- ** Build canonical address from pvp.
- */
-
- a = buildaddr(pvp, a, flags, e);
-
- /*
- ** Make local copies of the host & user and then
- ** transport them out.
- */
-
- allocaddr(a, flags, addr);
- if (bitset(QBADADDR, a->q_flags))
- return a;
-
- /*
- ** If there was a parsing failure, mark it for queueing.
- */
-
- if (queueup && OpMode != MD_INITALIAS)
- {
- char *msg = "Transient parse error -- message queued for future delivery";
-
- if (e->e_sendmode == SM_DEFER)
- msg = "Deferring message until queue run";
- if (tTd(20, 1))
- printf("parseaddr: queuing message\n");
- message(msg);
- if (e->e_message == NULL && e->e_sendmode != SM_DEFER)
- e->e_message = newstr(msg);
- a->q_flags |= QQUEUEUP;
- a->q_status = "4.4.3";
- }
-
- /*
- ** Compute return value.
- */
-
- if (tTd(20, 1))
- {
- printf("parseaddr-->");
- printaddr(a, FALSE);
- }
-
- return (a);
-}
-\f/*
-** INVALIDADDR -- check for address containing meta-characters
-**
-** Parameters:
-** addr -- the address to check.
-**
-** Returns:
-** TRUE -- if the address has any "wierd" characters
-** FALSE -- otherwise.
-*/
-
-bool
-invalidaddr(addr, delimptr)
- register char *addr;
- char *delimptr;
-{
- char savedelim = '\0';
-
- if (delimptr != NULL)
- {
- savedelim = *delimptr;
- if (savedelim != '\0')
- *delimptr = '\0';
- }
- if (strlen(addr) > TOBUFSIZE - 2)
- {
- usrerr("553 Address too long (%d bytes max)", TOBUFSIZE - 2);
- goto failure;
- }
- for (; *addr != '\0'; addr++)
- {
- if ((*addr & 0340) == 0200)
- break;
- }
- if (*addr == '\0')
- {
- if (delimptr != NULL && savedelim != '\0')
- *delimptr = savedelim;
- return FALSE;
- }
- setstat(EX_USAGE);
- usrerr("553 Address contained invalid control characters");
-failure:
- if (delimptr != NULL && savedelim != '\0')
- *delimptr = savedelim;
- return TRUE;
-}
-\f/*
-** ALLOCADDR -- do local allocations of address on demand.
-**
-** Also lowercases the host name if requested.
-**
-** Parameters:
-** a -- the address to reallocate.
-** flags -- the copy flag (see RF_ definitions in sendmail.h
-** for a description).
-** paddr -- the printname of the address.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Copies portions of a into local buffers as requested.
-*/
-
-void
-allocaddr(a, flags, paddr)
- register ADDRESS *a;
- int flags;
- char *paddr;
-{
- if (tTd(24, 4))
- printf("allocaddr(flags=%x, paddr=%s)\n", flags, paddr);
-
- a->q_paddr = paddr;
-
- if (a->q_user == NULL)
- a->q_user = "";
- if (a->q_host == NULL)
- a->q_host = "";
-
- if (bitset(RF_COPYPARSE, flags))
- {
- a->q_host = newstr(a->q_host);
- if (a->q_user != a->q_paddr)
- a->q_user = newstr(a->q_user);
- }
-
- if (a->q_paddr == NULL)
- a->q_paddr = a->q_user;
-}
-\f/*
-** PRESCAN -- Prescan name and make it canonical
-**
-** Scans a name and turns it into a set of tokens. This process
-** deletes blanks and comments (in parentheses).
-**
-** This routine knows about quoted strings and angle brackets.
-**
-** There are certain subtleties to this routine. The one that
-** comes to mind now is that backslashes on the ends of names
-** are silently stripped off; this is intentional. The problem
-** is that some versions of sndmsg (like at LBL) set the kill
-** character to something other than @ when reading addresses;
-** so people type "csvax.eric\@berkeley" -- which screws up the
-** berknet mailer.
-**
-** Parameters:
-** addr -- the name to chomp.
-** delim -- the delimiter for the address, normally
-** '\0' or ','; \0 is accepted in any case.
-** If '\t' then we are reading the .cf file.
-** pvpbuf -- place to put the saved text -- note that
-** the pointers are static.
-** pvpbsize -- size of pvpbuf.
-** delimptr -- if non-NULL, set to the location of the
-** terminating delimiter.
-** toktab -- if set, a token table to use for parsing.
-** If NULL, use the default table.
-**
-** Returns:
-** A pointer to a vector of tokens.
-** NULL on error.
-*/
-
-/* states and character types */
-# define OPR 0 /* operator */
-# define ATM 1 /* atom */
-# define QST 2 /* in quoted string */
-# define SPC 3 /* chewing up spaces */
-# define ONE 4 /* pick up one character */
-# define ILL 5 /* illegal character */
-
-# define NSTATES 6 /* number of states */
-# define TYPE 017 /* mask to select state type */
-
-/* meta bits for table */
-# define M 020 /* meta character; don't pass through */
-# define B 040 /* cause a break */
-# define MB M|B /* meta-break */
-
-static short StateTab[NSTATES][NSTATES] =
-{
- /* oldst chtype> OPR ATM QST SPC ONE ILL */
- /*OPR*/ { OPR|B, ATM|B, QST|B, SPC|MB, ONE|B, ILL|MB },
- /*ATM*/ { OPR|B, ATM, QST|B, SPC|MB, ONE|B, ILL|MB },
- /*QST*/ { QST, QST, OPR, QST, QST, QST },
- /*SPC*/ { OPR, ATM, QST, SPC|M, ONE, ILL|MB },
- /*ONE*/ { OPR, OPR, OPR, OPR, OPR, ILL|MB },
- /*ILL*/ { OPR|B, ATM|B, QST|B, SPC|MB, ONE|B, ILL|M },
-};
-
-/* token type table -- it gets modified with $o characters */
-static u_char TokTypeTab[256] =
-{
- /* nul soh stx etx eot enq ack bel bs ht nl vt np cr so si */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,SPC,SPC,SPC,SPC,SPC,ATM,ATM,
- /* dle dc1 dc2 dc3 dc4 nak syn etb can em sub esc fs gs rs us */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
- /* sp ! " # $ % & ' ( ) * + , - . / */
- SPC,ATM,QST,ATM,ATM,ATM,ATM,ATM, ATM,SPC,ATM,ATM,ATM,ATM,ATM,ATM,
- /* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
- /* @ A B C D E F G H I J K L M N O */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
- /* P Q R S T U V W X Y Z [ \ ] ^ _ */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
- /* ` a b c d e f g h i j k l m n o */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
- /* p q r s t u v w x y z { | } ~ del */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
-
- /* nul soh stx etx eot enq ack bel bs ht nl vt np cr so si */
- OPR,OPR,ONE,OPR,OPR,OPR,OPR,OPR, OPR,OPR,OPR,OPR,OPR,OPR,OPR,OPR,
- /* dle dc1 dc2 dc3 dc4 nak syn etb can em sub esc fs gs rs us */
- OPR,OPR,OPR,ONE,ONE,ONE,OPR,OPR, OPR,OPR,OPR,OPR,OPR,OPR,OPR,OPR,
- /* sp ! " # $ % & ' ( ) * + , - . / */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
- /* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
- /* @ A B C D E F G H I J K L M N O */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
- /* P Q R S T U V W X Y Z [ \ ] ^ _ */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
- /* ` a b c d e f g h i j k l m n o */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
- /* p q r s t u v w x y z { | } ~ del */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
-};
-
-/* token type table for MIME parsing */
-u_char MimeTokenTab[256] =
-{
- /* nul soh stx etx eot enq ack bel bs ht nl vt np cr so si */
- ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL, ILL,SPC,SPC,SPC,SPC,SPC,ILL,ILL,
- /* dle dc1 dc2 dc3 dc4 nak syn etb can em sub esc fs gs rs us */
- ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL, ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,
- /* sp ! " # $ % & ' ( ) * + , - . / */
- SPC,ATM,QST,ATM,ATM,ATM,ATM,ATM, ATM,SPC,ATM,ATM,OPR,ATM,ATM,OPR,
- /* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,OPR,OPR,OPR,OPR,OPR,OPR,
- /* @ A B C D E F G H I J K L M N O */
- OPR,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
- /* P Q R S T U V W X Y Z [ \ ] ^ _ */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,OPR,OPR,OPR,ATM,ATM,
- /* ` a b c d e f g h i j k l m n o */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
- /* p q r s t u v w x y z { | } ~ del */
- ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM, ATM,ATM,ATM,ATM,ATM,ATM,ATM,ATM,
-
- /* nul soh stx etx eot enq ack bel bs ht nl vt np cr so si */
- ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL, ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,
- /* dle dc1 dc2 dc3 dc4 nak syn etb can em sub esc fs gs rs us */
- ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL, ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,
- /* sp ! " # $ % & ' ( ) * + , - . / */
- ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL, ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,
- /* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
- ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL, ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,
- /* @ A B C D E F G H I J K L M N O */
- ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL, ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,
- /* P Q R S T U V W X Y Z [ \ ] ^ _ */
- ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL, ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,
- /* ` a b c d e f g h i j k l m n o */
- ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL, ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,
- /* p q r s t u v w x y z { | } ~ del */
- ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL, ILL,ILL,ILL,ILL,ILL,ILL,ILL,ILL,
-};
-
-
-# define NOCHAR -1 /* signal nothing in lookahead token */
-
-char **
-prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab)
- char *addr;
- int delim;
- char pvpbuf[];
- int pvpbsize;
- char **delimptr;
- u_char *toktab;
-{
- register char *p;
- register char *q;
- register int c;
- char **avp;
- bool bslashmode;
- bool route_syntax;
- int cmntcnt;
- int anglecnt;
- char *tok;
- int state;
- int newstate;
- char *saveto = CurEnv->e_to;
- static char *av[MAXATOM+1];
- static char firsttime = TRUE;
- extern int errno;
-
- if (firsttime)
- {
- /* initialize the token type table */
- char obuf[50];
-
- firsttime = FALSE;
- if (OperatorChars == NULL)
- {
- if (ConfigLevel < 7)
- OperatorChars = macvalue('o', CurEnv);
- if (OperatorChars == NULL)
- OperatorChars = ".:@[]";
- }
- expand(OperatorChars, obuf, sizeof obuf - sizeof DELIMCHARS, CurEnv);
- strcat(obuf, DELIMCHARS);
- for (p = obuf; *p != '\0'; p++)
- {
- if (TokTypeTab[*p & 0xff] == ATM)
- TokTypeTab[*p & 0xff] = OPR;
- }
- }
- if (toktab == NULL)
- toktab = TokTypeTab;
-
- /* make sure error messages don't have garbage on them */
- errno = 0;
-
- q = pvpbuf;
- bslashmode = FALSE;
- route_syntax = FALSE;
- cmntcnt = 0;
- anglecnt = 0;
- avp = av;
- state = ATM;
- c = NOCHAR;
- p = addr;
- CurEnv->e_to = p;
- if (tTd(22, 11))
- {
- printf("prescan: ");
- xputs(p);
- (void) putchar('\n');
- }
-
- do
- {
- /* read a token */
- tok = q;
- for (;;)
- {
- /* store away any old lookahead character */
- if (c != NOCHAR && !bslashmode)
- {
- /* see if there is room */
- if (q >= &pvpbuf[pvpbsize - 5])
- {
- usrerr("553 Address too long");
- if (strlen(addr) > (SIZE_T) MAXNAME)
- addr[MAXNAME] = '\0';
- returnnull:
- if (delimptr != NULL)
- *delimptr = p;
- CurEnv->e_to = saveto;
- return (NULL);
- }
-
- /* squirrel it away */
- *q++ = c;
- }
-
- /* read a new input character */
- c = *p++;
- if (c == '\0')
- {
- /* diagnose and patch up bad syntax */
- if (state == QST)
- {
- usrerr("653 Unbalanced '\"'");
- c = '"';
- }
- else if (cmntcnt > 0)
- {
- usrerr("653 Unbalanced '('");
- c = ')';
- }
- else if (anglecnt > 0)
- {
- c = '>';
- usrerr("653 Unbalanced '<'");
- }
- else
- break;
-
- p--;
- }
- else if (c == delim && cmntcnt <= 0 && state != QST)
- {
- if (anglecnt <= 0)
- break;
-
- /* special case for better error management */
- if (delim == ',' && !route_syntax)
- {
- usrerr("653 Unbalanced '<'");
- c = '>';
- p--;
- }
- }
-
- if (tTd(22, 101))
- printf("c=%c, s=%d; ", c, state);
-
- /* chew up special characters */
- *q = '\0';
- if (bslashmode)
- {
- bslashmode = FALSE;
-
- /* kludge \! for naive users */
- if (cmntcnt > 0)
- {
- c = NOCHAR;
- continue;
- }
- else if (c != '!' || state == QST)
- {
- *q++ = '\\';
- continue;
- }
- }
-
- if (c == '\\')
- {
- bslashmode = TRUE;
- }
- else if (state == QST)
- {
- /* do nothing, just avoid next clauses */
- }
- else if (c == '(')
- {
- cmntcnt++;
- c = NOCHAR;
- }
- else if (c == ')')
- {
- if (cmntcnt <= 0)
- {
- usrerr("653 Unbalanced ')'");
- c = NOCHAR;
- }
- else
- cmntcnt--;
- }
- else if (cmntcnt > 0)
- c = NOCHAR;
- else if (c == '<')
- {
- char *q = p;
-
- anglecnt++;
- while (isascii(*q) && isspace(*q))
- q++;
- if (*q == '@')
- route_syntax = TRUE;
- }
- else if (c == '>')
- {
- if (anglecnt <= 0)
- {
- usrerr("653 Unbalanced '>'");
- c = NOCHAR;
- }
- else
- anglecnt--;
- route_syntax = FALSE;
- }
- else if (delim == ' ' && isascii(c) && isspace(c))
- c = ' ';
-
- if (c == NOCHAR)
- continue;
-
- /* see if this is end of input */
- if (c == delim && anglecnt <= 0 && state != QST)
- break;
-
- newstate = StateTab[state][toktab[c & 0xff]];
- if (tTd(22, 101))
- printf("ns=%02o\n", newstate);
- state = newstate & TYPE;
- if (state == ILL)
- {
- if (isascii(c) && isprint(c))
- usrerr("653 Illegal character %c", c);
- else
- usrerr("653 Illegal character 0x%02x", c);
- }
- if (bitset(M, newstate))
- c = NOCHAR;
- if (bitset(B, newstate))
- break;
- }
-
- /* new token */
- if (tok != q)
- {
- *q++ = '\0';
- if (tTd(22, 36))
- {
- printf("tok=");
- xputs(tok);
- (void) putchar('\n');
- }
- if (avp >= &av[MAXATOM])
- {
- usrerr("553 prescan: too many tokens");
- goto returnnull;
- }
- if (q - tok > MAXNAME)
- {
- usrerr("553 prescan: token too long");
- goto returnnull;
- }
- *avp++ = tok;
- }
- } while (c != '\0' && (c != delim || anglecnt > 0));
- *avp = NULL;
- p--;
- if (delimptr != NULL)
- *delimptr = p;
- if (tTd(22, 12))
- {
- printf("prescan==>");
- printav(av);
- }
- CurEnv->e_to = saveto;
- if (av[0] == NULL)
- {
- if (tTd(22, 1))
- printf("prescan: null leading token\n");
- return (NULL);
- }
- return (av);
-}
-\f/*
-** REWRITE -- apply rewrite rules to token vector.
-**
-** This routine is an ordered production system. Each rewrite
-** rule has a LHS (called the pattern) and a RHS (called the
-** rewrite); 'rwr' points the the current rewrite rule.
-**
-** For each rewrite rule, 'avp' points the address vector we
-** are trying to match against, and 'pvp' points to the pattern.
-** If pvp points to a special match value (MATCHZANY, MATCHANY,
-** MATCHONE, MATCHCLASS, MATCHNCLASS) then the address in avp
-** matched is saved away in the match vector (pointed to by 'mvp').
-**
-** When a match between avp & pvp does not match, we try to
-** back out. If we back up over MATCHONE, MATCHCLASS, or MATCHNCLASS
-** we must also back out the match in mvp. If we reach a
-** MATCHANY or MATCHZANY we just extend the match and start
-** over again.
-**
-** When we finally match, we rewrite the address vector
-** and try over again.
-**
-** Parameters:
-** pvp -- pointer to token vector.
-** ruleset -- the ruleset to use for rewriting.
-** reclevel -- recursion level (to catch loops).
-** e -- the current envelope.
-**
-** Returns:
-** A status code. If EX_TEMPFAIL, higher level code should
-** attempt recovery.
-**
-** Side Effects:
-** pvp is modified.
-*/
-
-struct match
-{
- char **first; /* first token matched */
- char **last; /* last token matched */
- char **pattern; /* pointer to pattern */
-};
-
-# define MAXMATCH 9 /* max params per rewrite */
-
-
-int
-rewrite(pvp, ruleset, reclevel, e)
- char **pvp;
- int ruleset;
- int reclevel;
- register ENVELOPE *e;
-{
- register char *ap; /* address pointer */
- register char *rp; /* rewrite pointer */
- register char **avp; /* address vector pointer */
- register char **rvp; /* rewrite vector pointer */
- register struct match *mlp; /* cur ptr into mlist */
- register struct rewrite *rwr; /* pointer to current rewrite rule */
- int ruleno; /* current rule number */
- int rstat = EX_OK; /* return status */
- int loopcount;
- struct match mlist[MAXMATCH]; /* stores match on LHS */
- char *npvp[MAXATOM+1]; /* temporary space for rebuild */
- char buf[MAXLINE];
- extern int callsubr __P((char**, int, ENVELOPE *));
- extern int sm_strcasecmp __P((char *, char *));
-
- if (OpMode == MD_TEST || tTd(21, 1))
- {
- printf("rewrite: ruleset %3d input:", ruleset);
- printav(pvp);
- }
- if (ruleset < 0 || ruleset >= MAXRWSETS)
- {
- syserr("554 rewrite: illegal ruleset number %d", ruleset);
- return EX_CONFIG;
- }
- if (reclevel++ > MaxRuleRecursion)
- {
- syserr("rewrite: excessive recursion (max %d), ruleset %d",
- MaxRuleRecursion, ruleset);
- return EX_CONFIG;
- }
- if (pvp == NULL)
- return EX_USAGE;
-
- /*
- ** Run through the list of rewrite rules, applying
- ** any that match.
- */
-
- ruleno = 1;
- loopcount = 0;
- for (rwr = RewriteRules[ruleset]; rwr != NULL; )
- {
- int stat;
-
- /* if already canonical, quit now */
- if (pvp[0] != NULL && (pvp[0][0] & 0377) == CANONNET)
- break;
-
- if (tTd(21, 12))
- {
- printf("-----trying rule:");
- printav(rwr->r_lhs);
- }
-
- /* try to match on this rule */
- mlp = mlist;
- rvp = rwr->r_lhs;
- avp = pvp;
- if (++loopcount > 100)
- {
- syserr("554 Infinite loop in ruleset %d, rule %d",
- ruleset, ruleno);
- if (tTd(21, 1))
- {
- printf("workspace: ");
- printav(pvp);
- }
- break;
- }
-
- while ((ap = *avp) != NULL || *rvp != NULL)
- {
- rp = *rvp;
- if (tTd(21, 35))
- {
- printf("ADVANCE rp=");
- xputs(rp);
- printf(", ap=");
- xputs(ap);
- printf("\n");
- }
- if (rp == NULL)
- {
- /* end-of-pattern before end-of-address */
- goto backup;
- }
- if (ap == NULL && (*rp & 0377) != MATCHZANY &&
- (*rp & 0377) != MATCHZERO)
- {
- /* end-of-input with patterns left */
- goto backup;
- }
-
- switch (*rp & 0377)
- {
- case MATCHCLASS:
- /* match any phrase in a class */
- mlp->pattern = rvp;
- mlp->first = avp;
- extendclass:
- ap = *avp;
- if (ap == NULL)
- goto backup;
- mlp->last = avp++;
- cataddr(mlp->first, mlp->last, buf, sizeof buf, '\0');
- if (!wordinclass(buf, rp[1]))
- {
- if (tTd(21, 36))
- {
- printf("EXTEND rp=");
- xputs(rp);
- printf(", ap=");
- xputs(ap);
- printf("\n");
- }
- goto extendclass;
- }
- if (tTd(21, 36))
- printf("CLMATCH\n");
- mlp++;
- break;
-
- case MATCHNCLASS:
- /* match any token not in a class */
- if (wordinclass(ap, rp[1]))
- goto backup;
-
- /* fall through */
-
- case MATCHONE:
- case MATCHANY:
- /* match exactly one token */
- mlp->pattern = rvp;
- mlp->first = avp;
- mlp->last = avp++;
- mlp++;
- break;
-
- case MATCHZANY:
- /* match zero or more tokens */
- mlp->pattern = rvp;
- mlp->first = avp;
- mlp->last = avp - 1;
- mlp++;
- break;
-
- case MATCHZERO:
- /* match zero tokens */
- break;
-
- case MACRODEXPAND:
- /*
- ** Match against run-time macro.
- ** This algorithm is broken for the
- ** general case (no recursive macros,
- ** improper tokenization) but should
- ** work for the usual cases.
- */
-
- ap = macvalue(rp[1], e);
- mlp->first = avp;
- if (tTd(21, 2))
- printf("rewrite: LHS $&%s => \"%s\"\n",
- macname(rp[1]),
- ap == NULL ? "(NULL)" : ap);
-
- if (ap == NULL)
- break;
- while (*ap != '\0')
- {
- if (*avp == NULL ||
- strncasecmp(ap, *avp, strlen(*avp)) != 0)
- {
- /* no match */
- avp = mlp->first;
- goto backup;
- }
- ap += strlen(*avp++);
- }
-
- /* match */
- break;
-
- default:
- /* must have exact match */
- if (sm_strcasecmp(rp, ap))
- goto backup;
- avp++;
- break;
- }
-
- /* successful match on this token */
- rvp++;
- continue;
-
- backup:
- /* match failed -- back up */
- while (--mlp >= mlist)
- {
- rvp = mlp->pattern;
- rp = *rvp;
- avp = mlp->last + 1;
- ap = *avp;
-
- if (tTd(21, 36))
- {
- printf("BACKUP rp=");
- xputs(rp);
- printf(", ap=");
- xputs(ap);
- printf("\n");
- }
-
- if (ap == NULL)
- {
- /* run off the end -- back up again */
- continue;
- }
- if ((*rp & 0377) == MATCHANY ||
- (*rp & 0377) == MATCHZANY)
- {
- /* extend binding and continue */
- mlp->last = avp++;
- rvp++;
- mlp++;
- break;
- }
- if ((*rp & 0377) == MATCHCLASS)
- {
- /* extend binding and try again */
- mlp->last = avp;
- goto extendclass;
- }
- }
-
- if (mlp < mlist)
- {
- /* total failure to match */
- break;
- }
- }
-
- /*
- ** See if we successfully matched
- */
-
- if (mlp < mlist || *rvp != NULL)
- {
- if (tTd(21, 10))
- printf("----- rule fails\n");
- rwr = rwr->r_next;
- ruleno++;
- loopcount = 0;
- continue;
- }
-
- rvp = rwr->r_rhs;
- if (tTd(21, 12))
- {
- printf("-----rule matches:");
- printav(rvp);
- }
-
- rp = *rvp;
- if ((*rp & 0377) == CANONUSER)
- {
- rvp++;
- rwr = rwr->r_next;
- ruleno++;
- loopcount = 0;
- }
- else if ((*rp & 0377) == CANONHOST)
- {
- rvp++;
- rwr = NULL;
- }
-
- /* substitute */
- for (avp = npvp; *rvp != NULL; rvp++)
- {
- register struct match *m;
- register char **pp;
-
- rp = *rvp;
- if ((*rp & 0377) == MATCHREPL)
- {
- /* substitute from LHS */
- m = &mlist[rp[1] - '1'];
- if (m < mlist || m >= mlp)
- {
- syserr("554 rewrite: ruleset %d: replacement $%c out of bounds",
- ruleset, rp[1]);
- return EX_CONFIG;
- }
- if (tTd(21, 15))
- {
- printf("$%c:", rp[1]);
- pp = m->first;
- while (pp <= m->last)
- {
- printf(" %lx=\"", (u_long) *pp);
- (void) fflush(stdout);
- printf("%s\"", *pp++);
- }
- printf("\n");
- }
- pp = m->first;
- while (pp <= m->last)
- {
- if (avp >= &npvp[MAXATOM])
- {
- syserr("554 rewrite: expansion too long");
- return EX_DATAERR;
- }
- *avp++ = *pp++;
- }
- }
- else
- {
- /* some sort of replacement */
- if (avp >= &npvp[MAXATOM])
- {
- toolong:
- syserr("554 rewrite: expansion too long");
- return EX_DATAERR;
- }
- if ((*rp & 0377) != MACRODEXPAND)
- {
- /* vanilla replacement */
- *avp++ = rp;
- }
- else
- {
- /* $&x replacement */
- char *mval = macvalue(rp[1], e);
- char **xpvp;
- int trsize = 0;
- static size_t pvpb1_size = 0;
- static char **pvpb1 = NULL;
- char pvpbuf[PSBUFSIZE];
-
- if (tTd(21, 2))
- printf("rewrite: RHS $&%s => \"%s\"\n",
- macname(rp[1]),
- mval == NULL ? "(NULL)" : mval);
- if (mval == NULL || *mval == '\0')
- continue;
-
- /* save the remainder of the input */
- for (xpvp = pvp; *xpvp != NULL; xpvp++)
- trsize += sizeof *xpvp;
- if (trsize > pvpb1_size)
- {
- if (pvpb1 != NULL)
- free(pvpb1);
- pvpb1 = (char **)xalloc(trsize);
- pvpb1_size = trsize;
- }
-
- bcopy((char *) pvp, (char *) pvpb1, trsize);
-
- /* scan the new replacement */
- xpvp = prescan(mval, '\0', pvpbuf,
- sizeof pvpbuf, NULL, NULL);
- if (xpvp == NULL)
- {
- /* prescan pre-printed error */
- return EX_DATAERR;
- }
-
- /* insert it into the output stream */
- while (*xpvp != NULL)
- {
- if (tTd(21, 19))
- printf(" ... %s\n", *xpvp);
- *avp++ = newstr(*xpvp);
- if (avp >= &npvp[MAXATOM])
- goto toolong;
- xpvp++;
- }
- if (tTd(21, 19))
- printf(" ... DONE\n");
-
- /* restore the old trailing input */
- bcopy((char *) pvpb1, (char *) pvp, trsize);
- }
- }
- }
- *avp++ = NULL;
-
- /*
- ** Check for any hostname/keyword lookups.
- */
-
- for (rvp = npvp; *rvp != NULL; rvp++)
- {
- char **hbrvp;
- char **xpvp;
- int trsize;
- char *replac;
- int endtoken;
- STAB *map;
- char *mapname;
- char **key_rvp;
- char **arg_rvp;
- char **default_rvp;
- char buf[MAXNAME + 1];
- char *pvpb1[MAXATOM + 1];
- char *argvect[10];
- char pvpbuf[PSBUFSIZE];
- char *nullpvp[1];
- extern char *map_lookup __P((STAB *, char *, char **, int *, ENVELOPE *));
-
- if ((**rvp & 0377) != HOSTBEGIN &&
- (**rvp & 0377) != LOOKUPBEGIN)
- continue;
-
- /*
- ** Got a hostname/keyword lookup.
- **
- ** This could be optimized fairly easily.
- */
-
- hbrvp = rvp;
- if ((**rvp & 0377) == HOSTBEGIN)
- {
- endtoken = HOSTEND;
- mapname = "host";
- }
- else
- {
- endtoken = LOOKUPEND;
- mapname = *++rvp;
- }
- map = stab(mapname, ST_MAP, ST_FIND);
- if (map == NULL)
- syserr("554 rewrite: map %s not found", mapname);
-
- /* extract the match part */
- key_rvp = ++rvp;
- default_rvp = NULL;
- arg_rvp = argvect;
- xpvp = NULL;
- replac = pvpbuf;
- while (*rvp != NULL && (**rvp & 0377) != endtoken)
- {
- int nodetype = **rvp & 0377;
-
- if (nodetype != CANONHOST && nodetype != CANONUSER)
- {
- rvp++;
- continue;
- }
-
- *rvp++ = NULL;
-
- if (xpvp != NULL)
- {
- cataddr(xpvp, NULL, replac,
- &pvpbuf[sizeof pvpbuf] - replac,
- '\0');
- *++arg_rvp = replac;
- replac += strlen(replac) + 1;
- xpvp = NULL;
- }
- switch (nodetype)
- {
- case CANONHOST:
- xpvp = rvp;
- break;
-
- case CANONUSER:
- default_rvp = rvp;
- break;
- }
- }
- if (*rvp != NULL)
- *rvp++ = NULL;
- if (xpvp != NULL)
- {
- cataddr(xpvp, NULL, replac,
- &pvpbuf[sizeof pvpbuf] - replac,
- '\0');
- *++arg_rvp = replac;
- }
- *++arg_rvp = NULL;
-
- /* save the remainder of the input string */
- trsize = (int) (avp - rvp + 1) * sizeof *rvp;
- bcopy((char *) rvp, (char *) pvpb1, trsize);
-
- /* look it up */
- cataddr(key_rvp, NULL, buf, sizeof buf, '\0');
- argvect[0] = buf;
- replac = map_lookup(map, buf, argvect, &rstat, e);
-
- /* if no replacement, use default */
- if (replac == NULL && default_rvp != NULL)
- {
- /* create the default */
- cataddr(default_rvp, NULL, buf, sizeof buf, '\0');
- replac = buf;
- }
-
- if (replac == NULL)
- {
- xpvp = key_rvp;
- }
- else if (*replac == '\0')
- {
- /* null replacement */
- nullpvp[0] = NULL;
- xpvp = nullpvp;
- }
- else
- {
- /* scan the new replacement */
- xpvp = prescan(replac, '\0', pvpbuf,
- sizeof pvpbuf, NULL, NULL);
- if (xpvp == NULL)
- {
- /* prescan already printed error */
- return EX_DATAERR;
- }
- }
-
- /* append it to the token list */
- for (avp = hbrvp; *xpvp != NULL; xpvp++)
- {
- *avp++ = newstr(*xpvp);
- if (avp >= &npvp[MAXATOM])
- goto toolong;
- }
-
- /* restore the old trailing information */
- rvp = avp - 1;
- for (xpvp = pvpb1; (*avp++ = *xpvp++) != NULL; )
- if (avp >= &npvp[MAXATOM])
- goto toolong;
- }
-
- /*
- ** Check for subroutine calls.
- */
-
- stat = callsubr(npvp, reclevel, e);
- if (rstat == EX_OK || stat == EX_TEMPFAIL)
- rstat = stat;
-
- /* copy vector back into original space. */
- for (avp = npvp; *avp++ != NULL;)
- continue;
- bcopy((char *) npvp, (char *) pvp,
- (int) (avp - npvp) * sizeof *avp);
-
- if (tTd(21, 4))
- {
- printf("rewritten as:");
- printav(pvp);
- }
- }
-
- if (OpMode == MD_TEST || tTd(21, 1))
- {
- printf("rewrite: ruleset %3d returns:", ruleset);
- printav(pvp);
- }
-
- return rstat;
-}
-\f/*
-** CALLSUBR -- call subroutines in rewrite vector
-**
-** Parameters:
-** pvp -- pointer to token vector.
-** reclevel -- the current recursion level.
-** e -- the current envelope.
-**
-** Returns:
-** The status from the subroutine call.
-**
-** Side Effects:
-** pvp is modified.
-*/
-
-int
-callsubr(pvp, reclevel, e)
- char **pvp;
- int reclevel;
- ENVELOPE *e;
-{
- char **avp;
- char **rvp;
- register int i;
- int subr;
- int stat;
- int rstat = EX_OK;
- char *tpvp[MAXATOM + 1];
-
- for (avp = pvp; *avp != NULL; avp++)
- {
- if ((**avp & 0377) == CALLSUBR && avp[1] != NULL)
- {
- stripquotes(avp[1]);
- subr = strtorwset(avp[1], NULL, ST_FIND);
- if (subr < 0)
- {
- syserr("Unknown ruleset %s", avp[1]);
- return EX_CONFIG;
- }
-
- if (tTd(21, 3))
- printf("-----callsubr %s (%d)\n", avp[1], subr);
-
- /*
- ** Take care of possible inner calls first.
- ** use a full size temporary buffer to avoid
- ** overflows in rewrite, but strip off the
- ** subroutine call.
- */
-
- for (i = 2; avp[i] != NULL; i++)
- tpvp[i - 2] = avp[i];
- tpvp[i - 2] = NULL;
-
- stat = callsubr(tpvp, reclevel, e);
- if (rstat == EX_OK || stat == EX_TEMPFAIL)
- rstat = stat;
-
- /*
- ** Now we need to call the ruleset specified for
- ** the subroutine. we can do this with the
- ** temporary buffer that we set up earlier,
- ** since it has all the data we want to rewrite.
- */
-
- stat = rewrite(tpvp, subr, reclevel, e);
- if (rstat == EX_OK || stat == EX_TEMPFAIL)
- rstat = stat;
-
- /*
- ** Find length of tpvp and current offset into
- ** pvp, if the total is greater than MAXATOM,
- ** then it would overflow the buffer if we copied
- ** it back in to pvp, in which case we throw a
- ** fit.
- */
-
- for (rvp = tpvp; *rvp != NULL; rvp++)
- continue;
- if (((rvp - tpvp) + (avp - pvp)) > MAXATOM)
- {
- syserr("554 callsubr: expansion too long");
- return EX_DATAERR;
- }
-
- /*
- ** Now we can copy the rewritten code over
- ** the initial subroutine call in the buffer.
- */
-
- for (i = 0; tpvp[i] != NULL; i++)
- avp[i] = tpvp[i];
- avp[i] = NULL;
-
- /*
- ** If we got this far, we've processed the left
- ** most subroutine, and recursively called ourselves
- ** to handle any other subroutines. We're done.
- */
-
- break;
- }
- }
- return rstat;
-}
-\f/*
-** MAP_LOOKUP -- do lookup in map
-**
-** Parameters:
-** map -- the map to use for the lookup.
-** key -- the key to look up.
-** argvect -- arguments to pass to the map lookup.
-** pstat -- a pointer to an integer in which to store the
-** status from the lookup.
-** e -- the current envelope.
-**
-** Returns:
-** The result of the lookup.
-** NULL -- if there was no data for the given key.
-*/
-
-char *
-map_lookup(map, key, argvect, pstat, e)
- STAB *map;
- char key[];
- char **argvect;
- int *pstat;
- ENVELOPE *e;
-{
- auto int stat = EX_OK;
- char *replac;
-
- if (e->e_sendmode == SM_DEFER)
- {
- /* don't do any map lookups */
- if (tTd(60, 1))
- printf("map_lookup(%s, %s) => DEFERRED\n",
- map->s_name, key);
- *pstat = EX_TEMPFAIL;
- return NULL;
- }
- if (map == NULL || !bitset(MF_OPEN, map->s_map.map_mflags))
- return NULL;
-
- if (!bitset(MF_KEEPQUOTES, map->s_map.map_mflags))
- stripquotes(key);
-
- /* XXX should try to auto-open the map here */
-
- if (tTd(60, 1))
- {
- printf("map_lookup(%s, %s", map->s_name, key);
- if (tTd(60, 5))
- {
- int i;
-
- for (i = 0; argvect[i] != NULL; i++)
- printf(", %%%d=%s", i, argvect[i]);
- }
- printf(") => ");
- }
- replac = (*map->s_map.map_class->map_lookup)(&map->s_map,
- key, argvect, &stat);
- if (tTd(60, 1))
- printf("%s (%d)\n",
- replac != NULL ? replac : "NOT FOUND",
- stat);
-
- /* should recover if stat == EX_TEMPFAIL */
- if (stat == EX_TEMPFAIL && !bitset(MF_NODEFER, map->s_map.map_mflags))
- {
- *pstat = EX_TEMPFAIL;
- if (tTd(60, 1))
- printf("map_lookup(%s, %s) tempfail: errno=%d\n",
- map->s_name, key, errno);
- if (e->e_message == NULL)
- {
- char mbuf[320];
-
- snprintf(mbuf, sizeof mbuf,
- "%.80s map: lookup (%s): deferred",
- map->s_name,
- shortenstring(key, MAXSHORTSTR));
- e->e_message = newstr(mbuf);
- }
- }
- if (stat == EX_TEMPFAIL && map->s_map.map_tapp != NULL)
- {
- size_t i = strlen(key) + strlen(map->s_map.map_tapp) + 1;
- static char *rwbuf = NULL;
- static size_t rwbuflen = 0;
-
- if (i > rwbuflen)
- {
- if (rwbuf != NULL)
- free(rwbuf);
- rwbuflen = i;
- rwbuf = (char *) xalloc(rwbuflen);
- }
- snprintf(rwbuf, rwbuflen, "%s%s", key, map->s_map.map_tapp);
- if (tTd(60, 4))
- printf("map_lookup tempfail: returning \"%s\"\n",
- rwbuf);
- return rwbuf;
- }
- return replac;
-}
-\f/*
-** BUILDADDR -- build address from token vector.
-**
-** Parameters:
-** tv -- token vector.
-** a -- pointer to address descriptor to fill.
-** If NULL, one will be allocated.
-** flags -- info regarding whether this is a sender or
-** a recipient.
-** e -- the current envelope.
-**
-** Returns:
-** NULL if there was an error.
-** 'a' otherwise.
-**
-** Side Effects:
-** fills in 'a'
-*/
-
-struct errcodes
-{
- char *ec_name; /* name of error code */
- int ec_code; /* numeric code */
-} ErrorCodes[] =
-{
- { "usage", EX_USAGE },
- { "nouser", EX_NOUSER },
- { "nohost", EX_NOHOST },
- { "unavailable", EX_UNAVAILABLE },
- { "software", EX_SOFTWARE },
- { "tempfail", EX_TEMPFAIL },
- { "protocol", EX_PROTOCOL },
-#ifdef EX_CONFIG
- { "config", EX_CONFIG },
-#endif
- { NULL, EX_UNAVAILABLE }
-};
-
-ADDRESS *
-buildaddr(tv, a, flags, e)
- register char **tv;
- register ADDRESS *a;
- int flags;
- register ENVELOPE *e;
-{
- struct mailer **mp;
- register struct mailer *m;
- register char *p;
- char *mname;
- char **hostp;
- char hbuf[MAXNAME + 1];
- static MAILER discardmailer;
- static MAILER errormailer;
- static char *discardargv[] = { "DISCARD", NULL };
- static char *errorargv[] = { "ERROR", NULL };
- static char ubuf[MAXNAME + 2];
-
- if (tTd(24, 5))
- {
- printf("buildaddr, flags=%x, tv=", flags);
- printav(tv);
- }
-
- if (a == NULL)
- a = (ADDRESS *) xalloc(sizeof *a);
- bzero((char *) a, sizeof *a);
-
- /* set up default error return flags */
- a->q_flags |= DefaultNotify;
-
- if (discardmailer.m_name == NULL)
- {
- /* initialize the discard mailer */
- discardmailer.m_name = "*discard*";
- discardmailer.m_mailer = "DISCARD";
- discardmailer.m_argv = discardargv;
- }
-
- /* figure out what net/mailer to use */
- if (*tv == NULL || (**tv & 0377) != CANONNET)
- {
- syserr("554 buildaddr: no mailer in parsed address");
-badaddr:
- a->q_flags |= QBADADDR;
- a->q_mailer = &errormailer;
- if (errormailer.m_name == NULL)
- {
- /* initialize the bogus mailer */
- errormailer.m_name = "*error*";
- errormailer.m_mailer = "ERROR";
- errormailer.m_argv = errorargv;
- }
- return a;
- }
- mname = *++tv;
-
- /* extract host and user portions */
- if (*++tv != NULL && (**tv & 0377) == CANONHOST)
- hostp = ++tv;
- else
- hostp = NULL;
- while (*tv != NULL && (**tv & 0377) != CANONUSER)
- tv++;
- if (*tv == NULL)
- {
- syserr("554 buildaddr: no user");
- goto badaddr;
- }
- if (tv == hostp)
- hostp = NULL;
- else if (hostp != NULL)
- cataddr(hostp, tv - 1, hbuf, sizeof hbuf, '\0');
- cataddr(++tv, NULL, ubuf, sizeof ubuf, ' ');
-
- /* save away the host name */
- if (strcasecmp(mname, "error") == 0)
- {
- if (hostp != NULL)
- {
- register struct errcodes *ep;
-
- if (strchr(hbuf, '.') != NULL)
- {
- extern int dsntoexitstat __P((char *));
-
- a->q_status = newstr(hbuf);
- setstat(dsntoexitstat(hbuf));
- }
- else if (isascii(hbuf[0]) && isdigit(hbuf[0]))
- {
- setstat(atoi(hbuf));
- }
- else
- {
- for (ep = ErrorCodes; ep->ec_name != NULL; ep++)
- if (strcasecmp(ep->ec_name, hbuf) == 0)
- break;
- setstat(ep->ec_code);
- }
- }
- else
- setstat(EX_UNAVAILABLE);
- stripquotes(ubuf);
- if (isascii(ubuf[0]) && isdigit(ubuf[0]) &&
- isascii(ubuf[1]) && isdigit(ubuf[1]) &&
- isascii(ubuf[2]) && isdigit(ubuf[2]) &&
- ubuf[3] == ' ')
- {
- char fmt[10];
-
- strncpy(fmt, ubuf, 3);
- strcpy(&fmt[3], " %s");
- usrerr(fmt, ubuf + 4);
-
- /*
- ** If this is a 4xx code and we aren't running
- ** SMTP on our input, bounce this message;
- ** otherwise it disappears without a trace.
- */
-
- if (fmt[0] == '4' && OpMode != MD_SMTP &&
- OpMode != MD_DAEMON)
- {
- e->e_flags |= EF_FATALERRS;
- }
- }
- else
- {
- usrerr("553 %s", ubuf);
- }
- goto badaddr;
- }
-
- for (mp = Mailer; (m = *mp++) != NULL; )
- {
- if (strcasecmp(m->m_name, mname) == 0)
- break;
- }
- if (m == NULL)
- {
- syserr("554 buildaddr: unknown mailer %s", mname);
- goto badaddr;
- }
- a->q_mailer = m;
-
- /* figure out what host (if any) */
- if (hostp == NULL)
- {
- if (!bitnset(M_LOCALMAILER, m->m_flags))
- {
- syserr("554 buildaddr: no host");
- goto badaddr;
- }
- a->q_host = NULL;
- }
- else
- a->q_host = newstr(hbuf);
-
- /* figure out the user */
- p = ubuf;
- if (bitnset(M_CHECKUDB, m->m_flags) && *p == '@')
- {
- p++;
- tv++;
- a->q_flags |= QNOTREMOTE;
- }
-
- /* do special mapping for local mailer */
- if (*p == '"')
- p++;
- if (*p == '|' && bitnset(M_CHECKPROG, m->m_flags))
- a->q_mailer = m = ProgMailer;
- else if (*p == '/' && bitnset(M_CHECKFILE, m->m_flags))
- a->q_mailer = m = FileMailer;
- else if (*p == ':' && bitnset(M_CHECKINCLUDE, m->m_flags))
- {
- /* may be :include: */
- stripquotes(ubuf);
- if (strncasecmp(ubuf, ":include:", 9) == 0)
- {
- /* if :include:, don't need further rewriting */
- a->q_mailer = m = InclMailer;
- a->q_user = newstr(&ubuf[9]);
- return a;
- }
- }
-
- /* rewrite according recipient mailer rewriting rules */
- define('h', a->q_host, e);
- if (!bitset(RF_SENDERADDR|RF_HEADERADDR, flags))
- {
- /* sender addresses done later */
- (void) rewrite(tv, 2, 0, e);
- if (m->m_re_rwset > 0)
- (void) rewrite(tv, m->m_re_rwset, 0, e);
- }
- (void) rewrite(tv, 4, 0, e);
-
- /* save the result for the command line/RCPT argument */
- cataddr(tv, NULL, ubuf, sizeof ubuf, '\0');
- a->q_user = ubuf;
-
- /*
- ** Do mapping to lower case as requested by mailer
- */
-
- if (a->q_host != NULL && !bitnset(M_HST_UPPER, m->m_flags))
- makelower(a->q_host);
- if (!bitnset(M_USR_UPPER, m->m_flags))
- makelower(a->q_user);
-
- if (tTd(24, 6))
- {
- printf("buildaddr => ");
- printaddr(a, FALSE);
- }
- return a;
-}
-\f/*
-** CATADDR -- concatenate pieces of addresses (putting in <LWSP> subs)
-**
-** Parameters:
-** pvp -- parameter vector to rebuild.
-** evp -- last parameter to include. Can be NULL to
-** use entire pvp.
-** buf -- buffer to build the string into.
-** sz -- size of buf.
-** spacesub -- the space separator character; if null,
-** use SpaceSub.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Destroys buf.
-*/
-
-void
-cataddr(pvp, evp, buf, sz, spacesub)
- char **pvp;
- char **evp;
- char *buf;
- register int sz;
- int spacesub;
-{
- bool oatomtok = FALSE;
- bool natomtok = FALSE;
- register int i;
- register char *p;
-
- if (spacesub == '\0')
- spacesub = SpaceSub;
-
- if (pvp == NULL)
- {
- (void) strcpy(buf, "");
- return;
- }
- p = buf;
- sz -= 2;
- while (*pvp != NULL && (i = strlen(*pvp)) < sz)
- {
- natomtok = (TokTypeTab[**pvp & 0xff] == ATM);
- if (oatomtok && natomtok)
- *p++ = spacesub;
- (void) strcpy(p, *pvp);
- oatomtok = natomtok;
- p += i;
- sz -= i + 1;
- if (pvp++ == evp)
- break;
- }
- *p = '\0';
-}
-\f/*
-** SAMEADDR -- Determine if two addresses are the same
-**
-** This is not just a straight comparison -- if the mailer doesn't
-** care about the host we just ignore it, etc.
-**
-** Parameters:
-** a, b -- pointers to the internal forms to compare.
-**
-** Returns:
-** TRUE -- they represent the same mailbox.
-** FALSE -- they don't.
-**
-** Side Effects:
-** none.
-*/
-
-bool
-sameaddr(a, b)
- register ADDRESS *a;
- register ADDRESS *b;
-{
- register ADDRESS *ca, *cb;
-
- /* if they don't have the same mailer, forget it */
- if (a->q_mailer != b->q_mailer)
- return (FALSE);
-
- /* if the user isn't the same, we can drop out */
- if (strcmp(a->q_user, b->q_user) != 0)
- return (FALSE);
-
- /* if we have good uids for both but they differ, these are different */
- if (a->q_mailer == ProgMailer)
- {
- ca = getctladdr(a);
- cb = getctladdr(b);
- if (ca != NULL && cb != NULL &&
- bitset(QGOODUID, ca->q_flags & cb->q_flags) &&
- ca->q_uid != cb->q_uid)
- return (FALSE);
- }
-
- /* otherwise compare hosts (but be careful for NULL ptrs) */
- if (a->q_host == b->q_host)
- {
- /* probably both null pointers */
- return (TRUE);
- }
- if (a->q_host == NULL || b->q_host == NULL)
- {
- /* only one is a null pointer */
- return (FALSE);
- }
- if (strcmp(a->q_host, b->q_host) != 0)
- return (FALSE);
-
- return (TRUE);
-}
-\f/*
-** PRINTADDR -- print address (for debugging)
-**
-** Parameters:
-** a -- the address to print
-** follow -- follow the q_next chain.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** none.
-*/
-
-struct qflags
-{
- char *qf_name;
- u_long qf_bit;
-};
-
-struct qflags AddressFlags[] =
-{
- { "QDONTSEND", QDONTSEND },
- { "QBADADDR", QBADADDR },
- { "QGOODUID", QGOODUID },
- { "QPRIMARY", QPRIMARY },
- { "QQUEUEUP", QQUEUEUP },
- { "QSENT", QSENT },
- { "QNOTREMOTE", QNOTREMOTE },
- { "QSELFREF", QSELFREF },
- { "QVERIFIED", QVERIFIED },
- { "QBOGUSSHELL", QBOGUSSHELL },
- { "QUNSAFEADDR", QUNSAFEADDR },
- { "QPINGONSUCCESS", QPINGONSUCCESS },
- { "QPINGONFAILURE", QPINGONFAILURE },
- { "QPINGONDELAY", QPINGONDELAY },
- { "QHASNOTIFY", QHASNOTIFY },
- { "QRELAYED", QRELAYED },
- { "QEXPANDED", QEXPANDED },
- { "QDELIVERED", QDELIVERED },
- { "QDELAYED", QDELAYED },
- { "QTHISPASS", QTHISPASS },
- { "QRCPTOK", QRCPTOK },
- { NULL }
-};
-
-void
-printaddr(a, follow)
- register ADDRESS *a;
- bool follow;
-{
- register MAILER *m;
- MAILER pseudomailer;
- register struct qflags *qfp;
- bool firstone;
-
- if (a == NULL)
- {
- printf("[NULL]\n");
- return;
- }
-
- while (a != NULL)
- {
- printf("%lx=", (u_long) a);
- (void) fflush(stdout);
-
- /* find the mailer -- carefully */
- m = a->q_mailer;
- if (m == NULL)
- {
- m = &pseudomailer;
- m->m_mno = -1;
- m->m_name = "NULL";
- }
-
- printf("%s:\n\tmailer %d (%s), host `%s'\n",
- a->q_paddr == NULL ? "<null>" : a->q_paddr,
- m->m_mno, m->m_name,
- a->q_host == NULL ? "<null>" : a->q_host);
- printf("\tuser `%s', ruser `%s'\n",
- a->q_user,
- a->q_ruser == NULL ? "<null>" : a->q_ruser);
- printf("\tnext=%lx, alias %lx, uid %d, gid %d\n",
- (u_long) a->q_next, (u_long) a->q_alias,
- (int) a->q_uid, (int) a->q_gid);
- printf("\tflags=%lx<", a->q_flags);
- firstone = TRUE;
- for (qfp = AddressFlags; qfp->qf_name != NULL; qfp++)
- {
- if (!bitset(qfp->qf_bit, a->q_flags))
- continue;
- if (!firstone)
- printf(",");
- firstone = FALSE;
- printf("%s", qfp->qf_name);
- }
- printf(">\n");
- printf("\towner=%s, home=\"%s\", fullname=\"%s\"\n",
- a->q_owner == NULL ? "(none)" : a->q_owner,
- a->q_home == NULL ? "(none)" : a->q_home,
- a->q_fullname == NULL ? "(none)" : a->q_fullname);
- printf("\torcpt=\"%s\", statmta=%s, status=%s\n",
- a->q_orcpt == NULL ? "(none)" : a->q_orcpt,
- a->q_statmta == NULL ? "(none)" : a->q_statmta,
- a->q_status == NULL ? "(none)" : a->q_status);
- printf("\trstatus=\"%s\"\n",
- a->q_rstatus == NULL ? "(none)" : a->q_rstatus);
- printf("\tspecificity=%d, statdate=%s\n",
- a->q_specificity, ctime(&a->q_statdate));
-
- if (!follow)
- return;
- a = a->q_next;
- }
-}
-\f/*
-** EMPTYADDR -- return TRUE if this address is empty (``<>'')
-**
-** Parameters:
-** a -- pointer to the address
-**
-** Returns:
-** TRUE -- if this address is "empty" (i.e., no one should
-** ever generate replies to it.
-** FALSE -- if it is a "regular" (read: replyable) address.
-*/
-
-bool
-emptyaddr(a)
- register ADDRESS *a;
-{
- return a->q_paddr == NULL || strcmp(a->q_paddr, "<>") == 0 ||
- a->q_user == NULL || strcmp(a->q_user, "<>") == 0;
-}
-\f/*
-** REMOTENAME -- return the name relative to the current mailer
-**
-** Parameters:
-** name -- the name to translate.
-** m -- the mailer that we want to do rewriting relative
-** to.
-** flags -- fine tune operations.
-** pstat -- pointer to status word.
-** e -- the current envelope.
-**
-** Returns:
-** the text string representing this address relative to
-** the receiving mailer.
-**
-** Side Effects:
-** none.
-**
-** Warnings:
-** The text string returned is tucked away locally;
-** copy it if you intend to save it.
-*/
-
-char *
-remotename(name, m, flags, pstat, e)
- char *name;
- struct mailer *m;
- int flags;
- int *pstat;
- register ENVELOPE *e;
-{
- register char **pvp;
- char *fancy;
- char *oldg = macvalue('g', e);
- int rwset;
- static char buf[MAXNAME + 1];
- char lbuf[MAXNAME + 1];
- char pvpbuf[PSBUFSIZE];
- extern char *crackaddr __P((char *));
-
- if (tTd(12, 1))
- printf("remotename(%s)\n", name);
-
- /* don't do anything if we are tagging it as special */
- if (bitset(RF_SENDERADDR, flags))
- rwset = bitset(RF_HEADERADDR, flags) ? m->m_sh_rwset
- : m->m_se_rwset;
- else
- rwset = bitset(RF_HEADERADDR, flags) ? m->m_rh_rwset
- : m->m_re_rwset;
- if (rwset < 0)
- return (name);
-
- /*
- ** Do a heuristic crack of this name to extract any comment info.
- ** This will leave the name as a comment and a $g macro.
- */
-
- if (bitset(RF_CANONICAL, flags) || bitnset(M_NOCOMMENT, m->m_flags))
- fancy = "\201g";
- else
- fancy = crackaddr(name);
-
- /*
- ** Turn the name into canonical form.
- ** Normally this will be RFC 822 style, i.e., "user@domain".
- ** If this only resolves to "user", and the "C" flag is
- ** specified in the sending mailer, then the sender's
- ** domain will be appended.
- */
-
- pvp = prescan(name, '\0', pvpbuf, sizeof pvpbuf, NULL, NULL);
- if (pvp == NULL)
- return (name);
- if (rewrite(pvp, 3, 0, e) == EX_TEMPFAIL)
- *pstat = EX_TEMPFAIL;
- if (bitset(RF_ADDDOMAIN, flags) && e->e_fromdomain != NULL)
- {
- /* append from domain to this address */
- register char **pxp = pvp;
-
- /* see if there is an "@domain" in the current name */
- while (*pxp != NULL && strcmp(*pxp, "@") != 0)
- pxp++;
- if (*pxp == NULL)
- {
- /* no.... append the "@domain" from the sender */
- register char **qxq = e->e_fromdomain;
-
- while ((*pxp++ = *qxq++) != NULL)
- continue;
- if (rewrite(pvp, 3, 0, e) == EX_TEMPFAIL)
- *pstat = EX_TEMPFAIL;
- }
- }
-
- /*
- ** Do more specific rewriting.
- ** Rewrite using ruleset 1 or 2 depending on whether this is
- ** a sender address or not.
- ** Then run it through any receiving-mailer-specific rulesets.
- */
-
- if (bitset(RF_SENDERADDR, flags))
- {
- if (rewrite(pvp, 1, 0, e) == EX_TEMPFAIL)
- *pstat = EX_TEMPFAIL;
- }
- else
- {
- if (rewrite(pvp, 2, 0, e) == EX_TEMPFAIL)
- *pstat = EX_TEMPFAIL;
- }
- if (rwset > 0)
- {
- if (rewrite(pvp, rwset, 0, e) == EX_TEMPFAIL)
- *pstat = EX_TEMPFAIL;
- }
-
- /*
- ** Do any final sanitation the address may require.
- ** This will normally be used to turn internal forms
- ** (e.g., user@host.LOCAL) into external form. This
- ** may be used as a default to the above rules.
- */
-
- if (rewrite(pvp, 4, 0, e) == EX_TEMPFAIL)
- *pstat = EX_TEMPFAIL;
-
- /*
- ** Now restore the comment information we had at the beginning.
- */
-
- cataddr(pvp, NULL, lbuf, sizeof lbuf, '\0');
- define('g', lbuf, e);
-
- /* need to make sure route-addrs have <angle brackets> */
- if (bitset(RF_CANONICAL, flags) && lbuf[0] == '@')
- expand("<\201g>", buf, sizeof buf, e);
- else
- expand(fancy, buf, sizeof buf, e);
-
- define('g', oldg, e);
-
- if (tTd(12, 1))
- printf("remotename => `%s'\n", buf);
- return (buf);
-}
-\f/*
-** MAPLOCALUSER -- run local username through ruleset 5 for final redirection
-**
-** Parameters:
-** a -- the address to map (but just the user name part).
-** sendq -- the sendq in which to install any replacement
-** addresses.
-** aliaslevel -- the alias nesting depth.
-** e -- the envelope.
-**
-** Returns:
-** none.
-*/
-
-#define Q_COPYFLAGS (QPRIMARY|QBOGUSSHELL|QUNSAFEADDR|\
- Q_PINGFLAGS|QHASNOTIFY|\
- QRELAYED|QEXPANDED|QDELIVERED|QDELAYED)
-
-void
-maplocaluser(a, sendq, aliaslevel, e)
- register ADDRESS *a;
- ADDRESS **sendq;
- int aliaslevel;
- ENVELOPE *e;
-{
- register char **pvp;
- register ADDRESS *a1 = NULL;
- auto char *delimptr;
- char pvpbuf[PSBUFSIZE];
-
- if (tTd(29, 1))
- {
- printf("maplocaluser: ");
- printaddr(a, FALSE);
- }
- pvp = prescan(a->q_user, '\0', pvpbuf, sizeof pvpbuf, &delimptr, NULL);
- if (pvp == NULL)
- {
- if (tTd(29, 9))
- printf("maplocaluser: cannot prescan %s\n", a->q_user);
- return;
- }
-
- define('h', a->q_host, e);
- define('u', a->q_user, e);
- define('z', a->q_home, e);
-
- if (rewrite(pvp, 5, 0, e) == EX_TEMPFAIL)
- {
- if (tTd(29, 9))
- printf("maplocaluser: rewrite tempfail\n");
- a->q_flags |= QQUEUEUP;
- a->q_status = "4.4.3";
- return;
- }
- if (pvp[0] == NULL || (pvp[0][0] & 0377) != CANONNET)
- {
- if (tTd(29, 9))
- printf("maplocaluser: doesn't resolve\n");
- return;
- }
-
- /* if non-null, mailer destination specified -- has it changed? */
- a1 = buildaddr(pvp, NULL, 0, e);
- if (a1 == NULL || sameaddr(a, a1))
- {
- if (tTd(29, 9))
- printf("maplocaluser: address unchanged\n");
- if (a1 != NULL)
- free(a1);
- return;
- }
-
- /* make new address take on flags and print attributes of old */
- a1->q_flags &= ~Q_COPYFLAGS;
- a1->q_flags |= a->q_flags & Q_COPYFLAGS;
- a1->q_paddr = a->q_paddr;
-
- /* mark old address as dead; insert new address */
- a->q_flags |= QDONTSEND;
- if (tTd(29, 5))
- {
- printf("maplocaluser: QDONTSEND ");
- printaddr(a, FALSE);
- }
- a1->q_alias = a;
- allocaddr(a1, RF_COPYALL, a->q_paddr);
- (void) recipient(a1, sendq, aliaslevel, e);
-}
-\f/*
-** DEQUOTE_INIT -- initialize dequote map
-**
-** This is a no-op.
-**
-** Parameters:
-** map -- the internal map structure.
-** args -- arguments.
-**
-** Returns:
-** TRUE.
-*/
-
-bool
-dequote_init(map, args)
- MAP *map;
- char *args;
-{
- register char *p = args;
-
- map->map_mflags |= MF_KEEPQUOTES;
- for (;;)
- {
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p != '-')
- break;
- switch (*++p)
- {
- case 'a':
- map->map_app = ++p;
- break;
-
- case 's':
- map->map_coldelim = *++p;
- break;
- }
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- if (*p != '\0')
- *p = '\0';
- }
- if (map->map_app != NULL)
- map->map_app = newstr(map->map_app);
-
- return TRUE;
-}
-\f/*
-** DEQUOTE_MAP -- unquote an address
-**
-** Parameters:
-** map -- the internal map structure (ignored).
-** name -- the name to dequote.
-** av -- arguments (ignored).
-** statp -- pointer to status out-parameter.
-**
-** Returns:
-** NULL -- if there were no quotes, or if the resulting
-** unquoted buffer would not be acceptable to prescan.
-** else -- The dequoted buffer.
-*/
-
-/* ARGSUSED2 */
-char *
-dequote_map(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- register char *p;
- register char *q;
- register char c;
- int anglecnt = 0;
- int cmntcnt = 0;
- int quotecnt = 0;
- int spacecnt = 0;
- bool quotemode = FALSE;
- bool bslashmode = FALSE;
- char spacesub = map->map_coldelim;
-
- for (p = q = name; (c = *p++) != '\0'; )
- {
- if (bslashmode)
- {
- bslashmode = FALSE;
- *q++ = c;
- continue;
- }
-
- if (c == ' ' && spacesub != '\0')
- c = spacesub;
-
- switch (c)
- {
- case '\\':
- bslashmode = TRUE;
- break;
-
- case '(':
- cmntcnt++;
- break;
-
- case ')':
- if (cmntcnt-- <= 0)
- return NULL;
- break;
-
- case ' ':
- spacecnt++;
- break;
- }
-
- if (cmntcnt > 0)
- {
- *q++ = c;
- continue;
- }
-
- switch (c)
- {
- case '"':
- quotemode = !quotemode;
- quotecnt++;
- continue;
-
- case '<':
- anglecnt++;
- break;
-
- case '>':
- if (anglecnt-- <= 0)
- return NULL;
- break;
- }
- *q++ = c;
- }
-
- if (anglecnt != 0 || cmntcnt != 0 || bslashmode ||
- quotemode || quotecnt <= 0 || spacecnt != 0)
- return NULL;
- *q++ = '\0';
- return map_rewrite(map, name, strlen(name), NULL);
-}
-\f/*
-** RSCHECK -- check string(s) for validity using rewriting sets
-**
-** Parameters:
-** rwset -- the rewriting set to use.
-** p1 -- the first string to check.
-** p2 -- the second string to check -- may be null.
-** e -- the current envelope.
-**
-** Returns:
-** EX_OK -- if the rwset doesn't resolve to $#error
-** else -- the failure status (message printed)
-*/
-
-int
-rscheck(rwset, p1, p2, e)
- char *rwset;
- char *p1;
- char *p2;
- ENVELOPE *e;
-{
- char *buf;
- int bufsize;
- int saveexitstat;
- int rstat = EX_OK;
- char **pvp;
- int rsno;
- bool discard = FALSE;
- auto ADDRESS a1;
- bool saveQuickAbort = QuickAbort;
- bool saveSuprErrs = SuprErrs;
- char buf0[MAXLINE];
- char pvpbuf[PSBUFSIZE];
- extern char MsgBuf[];
-
- if (tTd(48, 2))
- printf("rscheck(%s, %s, %s)\n", rwset, p1,
- p2 == NULL ? "(NULL)" : p2);
-
- rsno = strtorwset(rwset, NULL, ST_FIND);
- if (rsno < 0)
- return EX_OK;
-
- if (p2 != NULL)
- {
- bufsize = strlen(p1) + strlen(p2) + 2;
- if (bufsize > sizeof buf0)
- buf = xalloc(bufsize);
- else
- {
- buf = buf0;
- bufsize = sizeof buf0;
- }
- (void) snprintf(buf, bufsize, "%s%c%s", p1, CONDELSE, p2);
- }
- else
- {
- bufsize = strlen(p1) + 1;
- if (bufsize > sizeof buf0)
- buf = xalloc(bufsize);
- else
- {
- buf = buf0;
- bufsize = sizeof buf0;
- }
- (void) snprintf(buf, bufsize, "%s", p1);
- }
- SuprErrs = TRUE;
- QuickAbort = FALSE;
- pvp = prescan(buf, '\0', pvpbuf, sizeof pvpbuf, NULL, NULL);
- SuprErrs = saveSuprErrs;
- if (pvp == NULL)
- {
- if (tTd(48, 2))
- printf("rscheck: cannot prescan input\n");
-/*
- syserr("rscheck: cannot prescan input: \"%s\"",
- shortenstring(buf, MAXSHORTSTR));
- rstat = EX_DATAERR;
-*/
- goto finis;
- }
- (void) rewrite(pvp, rsno, 0, e);
- if (pvp[0] == NULL || (pvp[0][0] & 0377) != CANONNET ||
- pvp[1] == NULL || (strcmp(pvp[1], "error") != 0 &&
- strcmp(pvp[1], "discard") != 0))
- {
- goto finis;
- }
-
- if (strcmp(pvp[1], "discard") == 0)
- {
- if (tTd(48, 2))
- printf("rscheck: discard mailer selected\n");
- e->e_flags |= EF_DISCARD;
- discard = TRUE;
- }
- else
- {
- int savelogusrerrs = LogUsrErrs;
- static bool logged = FALSE;
-
- /* got an error -- process it */
- saveexitstat = ExitStat;
- LogUsrErrs = FALSE;
- (void) buildaddr(pvp, &a1, 0, e);
- LogUsrErrs = savelogusrerrs;
- rstat = ExitStat;
- ExitStat = saveexitstat;
- if (!logged)
- {
- markstats(e, &a1, TRUE);
- logged = TRUE;
- }
- }
-
- if (LogLevel >= 4)
- {
- char *relay;
- char *p;
- char lbuf[MAXLINE];
-
- p = lbuf;
- if (p2 != NULL)
- {
- snprintf(p, SPACELEFT(lbuf, p),
- ", arg2=%s",
- p2);
- p += strlen(p);
- }
- if ((relay = macvalue('_', e)) != NULL)
- {
- snprintf(p, SPACELEFT(lbuf, p),
- ", relay=%s", relay);
- p += strlen(p);
- }
- *p = '\0';
- if (discard)
- sm_syslog(LOG_NOTICE, e->e_id,
- "ruleset=%s, arg1=%s%s, discard",
- rwset, p1, lbuf);
- else
- sm_syslog(LOG_NOTICE, e->e_id,
- "ruleset=%s, arg1=%s%s, reject=%s",
- rwset, p1, lbuf, MsgBuf);
- }
-
- finis:
- /* clean up */
- QuickAbort = saveQuickAbort;
- setstat(rstat);
- if (buf != buf0)
- free(buf);
-
- if (rstat != EX_OK && QuickAbort)
- longjmp(TopFrame, 2);
- return rstat;
-}
+++ /dev/null
-/*-
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1990, 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.
- *
- *
- * @(#)pathnames.h 8.8 (Berkeley) 5/19/1998
- */
-
-#ifndef _PATH_SENDMAILCF
-# if defined(USE_VENDOR_CF_PATH) && defined(_PATH_VENDOR_CF)
-# define _PATH_SENDMAILCF _PATH_VENDOR_CF
-# else
-# define _PATH_SENDMAILCF "/etc/sendmail.cf"
-# endif
-#endif
-
-#ifndef _PATH_SENDMAILPID
-# ifdef BSD4_4
-# define _PATH_SENDMAILPID "/var/run/sendmail.pid"
-# else
-# define _PATH_SENDMAILPID "/etc/sendmail.pid"
-# endif
-#endif
-
-#ifndef _PATH_HOSTS
-# define _PATH_HOSTS "/etc/hosts"
-#endif
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-# include "sendmail.h"
-
-#ifndef lint
-#if QUEUE
-static char sccsid[] = "@(#)queue.c 8.211 (Berkeley) 1/25/1999 (with queueing)";
-#else
-static char sccsid[] = "@(#)queue.c 8.211 (Berkeley) 1/25/1999 (without queueing)";
-#endif
-#endif /* not lint */
-
-# include <errno.h>
-# include <dirent.h>
-
-# if QUEUE
-
-/*
-** Work queue.
-*/
-
-struct work
-{
- char *w_name; /* name of control file */
- char *w_host; /* name of recipient host */
- bool w_lock; /* is message locked? */
- bool w_tooyoung; /* is it too young to run? */
- long w_pri; /* priority of message, see below */
- time_t w_ctime; /* creation time of message */
- struct work *w_next; /* next in queue */
-};
-
-typedef struct work WORK;
-
-WORK *WorkQ; /* queue of things to be done */
-
-#define QF_VERSION 2 /* version number of this queue format */
-
-extern int orderq __P((bool));
-\f/*
-** QUEUEUP -- queue a message up for future transmission.
-**
-** Parameters:
-** e -- the envelope to queue up.
-** announce -- if TRUE, tell when you are queueing up.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** The current request are saved in a control file.
-** The queue file is left locked.
-*/
-
-void
-queueup(e, announce)
- register ENVELOPE *e;
- bool announce;
-{
- char *qf;
- register FILE *tfp;
- register HDR *h;
- register ADDRESS *q;
- int fd;
- int i;
- bool newid;
- register char *p;
- MAILER nullmailer;
- MCI mcibuf;
- char tf[MAXQFNAME];
- char buf[MAXLINE];
- extern void printctladdr __P((ADDRESS *, FILE *));
-
- /*
- ** Create control file.
- */
-
- newid = (e->e_id == NULL) || !bitset(EF_INQUEUE, e->e_flags);
-
- /* if newid, queuename will create a locked qf file in e->lockfp */
- strcpy(tf, queuename(e, 't'));
- tfp = e->e_lockfp;
- if (tfp == NULL)
- newid = FALSE;
-
- /* if newid, just write the qf file directly (instead of tf file) */
- if (!newid)
- {
- /* get a locked tf file */
- for (i = 0; i < 128; i++)
- {
- fd = open(tf, O_CREAT|O_WRONLY|O_EXCL, FileMode);
- if (fd < 0)
- {
- if (errno != EEXIST)
- break;
- if (LogLevel > 0 && (i % 32) == 0)
- sm_syslog(LOG_ALERT, e->e_id,
- "queueup: cannot create %s, uid=%d: %s",
- tf, geteuid(), errstring(errno));
- }
- else
- {
- if (lockfile(fd, tf, NULL, LOCK_EX|LOCK_NB))
- break;
- else if (LogLevel > 0 && (i % 32) == 0)
- sm_syslog(LOG_ALERT, e->e_id,
- "queueup: cannot lock %s: %s",
- tf, errstring(errno));
- close(fd);
- }
-
- if ((i % 32) == 31)
- {
- /* save the old temp file away */
- (void) rename(tf, queuename(e, 'T'));
- }
- else
- sleep(i % 32);
- }
- if (fd < 0 || (tfp = fdopen(fd, "w")) == NULL)
- {
- printopenfds(TRUE);
- syserr("!queueup: cannot create queue temp file %s, uid=%d",
- tf, geteuid());
- }
- }
-
- if (tTd(40, 1))
- printf("\n>>>>> queueing %s%s >>>>>\n", e->e_id,
- newid ? " (new id)" : "");
- if (tTd(40, 3))
- {
- extern void printenvflags __P((ENVELOPE *));
-
- printf(" e_flags=");
- printenvflags(e);
- }
- if (tTd(40, 32))
- {
- printf(" sendq=");
- printaddr(e->e_sendqueue, TRUE);
- }
- if (tTd(40, 9))
- {
- printf(" tfp=");
- dumpfd(fileno(tfp), TRUE, FALSE);
- printf(" lockfp=");
- if (e->e_lockfp == NULL)
- printf("NULL\n");
- else
- dumpfd(fileno(e->e_lockfp), TRUE, FALSE);
- }
-
- /*
- ** If there is no data file yet, create one.
- */
-
- if (!bitset(EF_HAS_DF, e->e_flags))
- {
- register FILE *dfp = NULL;
- char dfname[MAXQFNAME];
- struct stat stbuf;
-
- strcpy(dfname, queuename(e, 'd'));
- fd = open(dfname, O_WRONLY|O_CREAT|O_TRUNC, FileMode);
- if (fd < 0 || (dfp = fdopen(fd, "w")) == NULL)
- syserr("!queueup: cannot create data temp file %s, uid=%d",
- dfname, geteuid());
- if (fstat(fd, &stbuf) < 0)
- e->e_dfino = -1;
- else
- {
- e->e_dfdev = stbuf.st_dev;
- e->e_dfino = stbuf.st_ino;
- }
- e->e_flags |= EF_HAS_DF;
- bzero(&mcibuf, sizeof mcibuf);
- mcibuf.mci_out = dfp;
- mcibuf.mci_mailer = FileMailer;
- (*e->e_putbody)(&mcibuf, e, NULL);
- (void) xfclose(dfp, "queueup dfp", e->e_id);
- e->e_putbody = putbody;
- }
-
- /*
- ** Output future work requests.
- ** Priority and creation time should be first, since
- ** they are required by orderq.
- */
-
- /* output queue version number (must be first!) */
- fprintf(tfp, "V%d\n", QF_VERSION);
-
- /* output creation time */
- fprintf(tfp, "T%ld\n", (long) e->e_ctime);
-
- /* output last delivery time */
- fprintf(tfp, "K%ld\n", (long) e->e_dtime);
-
- /* output number of delivery attempts */
- fprintf(tfp, "N%d\n", e->e_ntries);
-
- /* output message priority */
- fprintf(tfp, "P%ld\n", e->e_msgpriority);
-
- /* output inode number of data file */
- /* XXX should probably include device major/minor too */
- if (e->e_dfino != -1)
- {
- if (sizeof e->e_dfino > sizeof(long))
- fprintf(tfp, "I%d/%d/%s\n",
- major(e->e_dfdev), minor(e->e_dfdev),
- quad_to_string(e->e_dfino));
- else
- fprintf(tfp, "I%d/%d/%lu\n",
- major(e->e_dfdev), minor(e->e_dfdev),
- (unsigned long) e->e_dfino);
- }
-
- /* output body type */
- if (e->e_bodytype != NULL)
- fprintf(tfp, "B%s\n", denlstring(e->e_bodytype, TRUE, FALSE));
-
-#if _FFR_SAVE_CHARSET
- if (e->e_charset != NULL)
- fprintf(tfp, "X%s\n", denlstring(e->e_charset, TRUE, FALSE));
-#endif
-
- /* message from envelope, if it exists */
- if (e->e_message != NULL)
- fprintf(tfp, "M%s\n", denlstring(e->e_message, TRUE, FALSE));
-
- /* send various flag bits through */
- p = buf;
- if (bitset(EF_WARNING, e->e_flags))
- *p++ = 'w';
- if (bitset(EF_RESPONSE, e->e_flags))
- *p++ = 'r';
- if (bitset(EF_HAS8BIT, e->e_flags))
- *p++ = '8';
- if (bitset(EF_DELETE_BCC, e->e_flags))
- *p++ = 'b';
- if (bitset(EF_RET_PARAM, e->e_flags))
- *p++ = 'd';
- if (bitset(EF_NO_BODY_RETN, e->e_flags))
- *p++ = 'n';
- *p++ = '\0';
- if (buf[0] != '\0')
- fprintf(tfp, "F%s\n", buf);
-
- /* $r and $s and $_ macro values */
- if ((p = macvalue('r', e)) != NULL)
- fprintf(tfp, "$r%s\n", denlstring(p, TRUE, FALSE));
- if ((p = macvalue('s', e)) != NULL)
- fprintf(tfp, "$s%s\n", denlstring(p, TRUE, FALSE));
- if ((p = macvalue('_', e)) != NULL)
- fprintf(tfp, "$_%s\n", denlstring(p, TRUE, FALSE));
-
- /* output name of sender */
- if (bitnset(M_UDBENVELOPE, e->e_from.q_mailer->m_flags))
- p = e->e_sender;
- else
- p = e->e_from.q_paddr;
- fprintf(tfp, "S%s\n", denlstring(p, TRUE, FALSE));
-
- /* output ESMTP-supplied "original" information */
- if (e->e_envid != NULL)
- fprintf(tfp, "Z%s\n", denlstring(e->e_envid, TRUE, FALSE));
-
- /* output list of recipient addresses */
- printctladdr(NULL, NULL);
- for (q = e->e_sendqueue; q != NULL; q = q->q_next)
- {
- if (bitset(QDONTSEND|QBADADDR|QSENT, q->q_flags))
- {
-#if XDEBUG
- if (bitset(QQUEUEUP, q->q_flags))
- sm_syslog(LOG_DEBUG, e->e_id,
- "dropenvelope: q_flags = %x, paddr = %s",
- q->q_flags, q->q_paddr);
-#endif
- continue;
- }
- printctladdr(q, tfp);
- if (q->q_orcpt != NULL)
- fprintf(tfp, "Q%s\n",
- denlstring(q->q_orcpt, TRUE, FALSE));
- putc('R', tfp);
- if (bitset(QPRIMARY, q->q_flags))
- putc('P', tfp);
- if (bitset(QHASNOTIFY, q->q_flags))
- putc('N', tfp);
- if (bitset(QPINGONSUCCESS, q->q_flags))
- putc('S', tfp);
- if (bitset(QPINGONFAILURE, q->q_flags))
- putc('F', tfp);
- if (bitset(QPINGONDELAY, q->q_flags))
- putc('D', tfp);
- putc(':', tfp);
- fprintf(tfp, "%s\n", denlstring(q->q_paddr, TRUE, FALSE));
- if (announce)
- {
- e->e_to = q->q_paddr;
- message("queued");
- if (LogLevel > 8)
- logdelivery(q->q_mailer, NULL, "queued",
- NULL, (time_t) 0, e);
- e->e_to = NULL;
- }
- if (tTd(40, 1))
- {
- printf("queueing ");
- printaddr(q, FALSE);
- }
- }
-
- /*
- ** Output headers for this message.
- ** Expand macros completely here. Queue run will deal with
- ** everything as absolute headers.
- ** All headers that must be relative to the recipient
- ** can be cracked later.
- ** We set up a "null mailer" -- i.e., a mailer that will have
- ** no effect on the addresses as they are output.
- */
-
- bzero((char *) &nullmailer, sizeof nullmailer);
- nullmailer.m_re_rwset = nullmailer.m_rh_rwset =
- nullmailer.m_se_rwset = nullmailer.m_sh_rwset = -1;
- nullmailer.m_eol = "\n";
- bzero(&mcibuf, sizeof mcibuf);
- mcibuf.mci_mailer = &nullmailer;
- mcibuf.mci_out = tfp;
-
- define('g', "\201f", e);
- for (h = e->e_header; h != NULL; h = h->h_link)
- {
- extern bool bitzerop __P((BITMAP));
-
- if (h->h_value == NULL)
- continue;
-
- /* don't output resent headers on non-resent messages */
- if (bitset(H_RESENT, h->h_flags) && !bitset(EF_RESENT, e->e_flags))
- continue;
-
- /* expand macros; if null, don't output header at all */
- if (bitset(H_DEFAULT, h->h_flags))
- {
- (void) expand(h->h_value, buf, sizeof buf, e);
- if (buf[0] == '\0')
- continue;
- }
-
- /* output this header */
- fprintf(tfp, "H");
-
- /* if conditional, output the set of conditions */
- if (!bitzerop(h->h_mflags) && bitset(H_CHECK|H_ACHECK, h->h_flags))
- {
- int j;
-
- (void) putc('?', tfp);
- for (j = '\0'; j <= '\177'; j++)
- if (bitnset(j, h->h_mflags))
- (void) putc(j, tfp);
- (void) putc('?', tfp);
- }
-
- /* output the header: expand macros, convert addresses */
- if (bitset(H_DEFAULT, h->h_flags))
- {
- fprintf(tfp, "%s: %s\n",
- h->h_field,
- denlstring(buf, FALSE, TRUE));
- }
- else if (bitset(H_FROM|H_RCPT, h->h_flags))
- {
- bool oldstyle = bitset(EF_OLDSTYLE, e->e_flags);
- FILE *savetrace = TrafficLogFile;
-
- TrafficLogFile = NULL;
-
- if (bitset(H_FROM, h->h_flags))
- oldstyle = FALSE;
-
- commaize(h, h->h_value, oldstyle, &mcibuf, e);
-
- TrafficLogFile = savetrace;
- }
- else
- {
- fprintf(tfp, "%s: %s\n",
- h->h_field,
- denlstring(h->h_value, FALSE, TRUE));
- }
- }
-
- /*
- ** Clean up.
- **
- ** Write a terminator record -- this is to prevent
- ** scurrilous crackers from appending any data.
- */
-
- fprintf(tfp, ".\n");
-
- if (fflush(tfp) < 0 ||
- (SuperSafe && fsync(fileno(tfp)) < 0) ||
- ferror(tfp))
- {
- if (newid)
- syserr("!552 Error writing control file %s", tf);
- else
- syserr("!452 Error writing control file %s", tf);
- }
-
- if (!newid)
- {
- /* rename (locked) tf to be (locked) qf */
- qf = queuename(e, 'q');
- if (rename(tf, qf) < 0)
- syserr("cannot rename(%s, %s), uid=%d",
- tf, qf, geteuid());
-
- /* close and unlock old (locked) qf */
- if (e->e_lockfp != NULL)
- (void) xfclose(e->e_lockfp, "queueup lockfp", e->e_id);
- e->e_lockfp = tfp;
- }
- else
- qf = tf;
- errno = 0;
- e->e_flags |= EF_INQUEUE;
-
- /* save log info */
- if (LogLevel > 79)
- sm_syslog(LOG_DEBUG, e->e_id, "queueup, qf=%s", qf);
-
- if (tTd(40, 1))
- printf("<<<<< done queueing %s <<<<<\n\n", e->e_id);
- return;
-}
-
-void
-printctladdr(a, tfp)
- register ADDRESS *a;
- FILE *tfp;
-{
- char *uname;
- register ADDRESS *q;
- uid_t uid;
- gid_t gid;
- static ADDRESS *lastctladdr = NULL;
- static uid_t lastuid;
-
- /* initialization */
- if (a == NULL || a->q_alias == NULL || tfp == NULL)
- {
- if (lastctladdr != NULL && tfp != NULL)
- fprintf(tfp, "C\n");
- lastctladdr = NULL;
- lastuid = 0;
- return;
- }
-
- /* find the active uid */
- q = getctladdr(a);
- if (q == NULL)
- {
- uname = NULL;
- uid = 0;
- gid = 0;
- }
- else
- {
- uname = q->q_ruser != NULL ? q->q_ruser : q->q_user;
- uid = q->q_uid;
- gid = q->q_gid;
- }
- a = a->q_alias;
-
- /* check to see if this is the same as last time */
- if (lastctladdr != NULL && uid == lastuid &&
- strcmp(lastctladdr->q_paddr, a->q_paddr) == 0)
- return;
- lastuid = uid;
- lastctladdr = a;
-
- if (uid == 0 || uname == NULL || uname[0] == '\0')
- fprintf(tfp, "C");
- else
- fprintf(tfp, "C%s:%ld:%ld",
- denlstring(uname, TRUE, FALSE), (long) uid, (long) gid);
- fprintf(tfp, ":%s\n", denlstring(a->q_paddr, TRUE, FALSE));
-}
-\f/*
-** RUNQUEUE -- run the jobs in the queue.
-**
-** Gets the stuff out of the queue in some presumably logical
-** order and processes them.
-**
-** Parameters:
-** forkflag -- TRUE if the queue scanning should be done in
-** a child process. We double-fork so it is not our
-** child and we don't have to clean up after it.
-** verbose -- if TRUE, print out status information.
-**
-** Returns:
-** TRUE if the queue run successfully began.
-**
-** Side Effects:
-** runs things in the mail queue.
-*/
-
-ENVELOPE QueueEnvelope; /* the queue run envelope */
-extern int get_num_procs_online __P((void));
-
-bool
-runqueue(forkflag, verbose)
- bool forkflag;
- bool verbose;
-{
- register ENVELOPE *e;
- int njobs;
- int sequenceno = 0;
- time_t current_la_time;
- extern ENVELOPE BlankEnvelope;
- extern void clrdaemon __P((void));
- extern void runqueueevent __P((void));
-
- DoQueueRun = FALSE;
-
- /*
- ** If no work will ever be selected, don't even bother reading
- ** the queue.
- */
-
- CurrentLA = getla(); /* get load average */
- current_la_time = curtime();
-
- if (shouldqueue(WkRecipFact, current_la_time))
- {
- char *msg = "Skipping queue run -- load average too high";
-
- if (verbose)
- message("458 %s\n", msg);
- if (LogLevel > 8)
- sm_syslog(LOG_INFO, NOQID,
- "runqueue: %s",
- msg);
- if (forkflag && QueueIntvl != 0)
- (void) setevent(QueueIntvl, runqueueevent, 0);
- return FALSE;
- }
-
- /*
- ** See if we already have too many children.
- */
-
- if (forkflag && QueueIntvl != 0 &&
- MaxChildren > 0 && CurChildren >= MaxChildren)
- {
- (void) setevent(QueueIntvl, runqueueevent, 0);
- return FALSE;
- }
-
- /*
- ** See if we want to go off and do other useful work.
- */
-
- if (forkflag)
- {
- pid_t pid;
- extern SIGFUNC_DECL intsig __P((int));
- extern SIGFUNC_DECL reapchild __P((int));
-
- blocksignal(SIGCHLD);
- (void) setsignal(SIGCHLD, reapchild);
-
- pid = dofork();
- if (pid == -1)
- {
- const char *msg = "Skipping queue run -- fork() failed";
- const char *err = errstring(errno);
-
- if (verbose)
- message("458 %s: %s\n", msg, err);
- if (LogLevel > 8)
- sm_syslog(LOG_INFO, NOQID,
- "runqueue: %s: %s",
- msg, err);
- if (QueueIntvl != 0)
- (void) setevent(QueueIntvl, runqueueevent, 0);
- (void) releasesignal(SIGCHLD);
- return FALSE;
- }
- if (pid != 0)
- {
- /* parent -- pick up intermediate zombie */
- (void) blocksignal(SIGALRM);
- proc_list_add(pid, "Queue runner");
- (void) releasesignal(SIGALRM);
- releasesignal(SIGCHLD);
- if (QueueIntvl != 0)
- (void) setevent(QueueIntvl, runqueueevent, 0);
- return TRUE;
- }
- /* child -- double fork and clean up signals */
- clrcontrol();
- proc_list_clear();
-
- /* Add parent process as first child item */
- proc_list_add(getpid(), "Queue runner child process");
- releasesignal(SIGCHLD);
- (void) setsignal(SIGCHLD, SIG_DFL);
- (void) setsignal(SIGHUP, intsig);
- }
-
- sm_setproctitle(TRUE, "running queue: %s", QueueDir);
-
- if (LogLevel > 69)
- sm_syslog(LOG_DEBUG, NOQID,
- "runqueue %s, pid=%d, forkflag=%d",
- QueueDir, getpid(), forkflag);
-
- /*
- ** Release any resources used by the daemon code.
- */
-
-# if DAEMON
- clrdaemon();
-# endif /* DAEMON */
-
- /* force it to run expensive jobs */
- NoConnect = FALSE;
-
- /* drop privileges */
- if (geteuid() == (uid_t) 0)
- (void) drop_privileges(FALSE);
-
- /*
- ** Create ourselves an envelope
- */
-
- CurEnv = &QueueEnvelope;
- e = newenvelope(&QueueEnvelope, CurEnv);
- e->e_flags = BlankEnvelope.e_flags;
-
- /* make sure we have disconnected from parent */
- if (forkflag)
- {
- disconnect(1, e);
- QuickAbort = FALSE;
- }
-
- /*
- ** Make sure the alias database is open.
- */
-
- initmaps(FALSE, e);
-
- /*
- ** If we are running part of the queue, always ignore stored
- ** host status.
- */
-
- if (QueueLimitId != NULL || QueueLimitSender != NULL ||
- QueueLimitRecipient != NULL)
- {
- IgnoreHostStatus = TRUE;
- MinQueueAge = 0;
- }
-
- /*
- ** Start making passes through the queue.
- ** First, read and sort the entire queue.
- ** Then, process the work in that order.
- ** But if you take too long, start over.
- */
-
- /* order the existing work requests */
- njobs = orderq(FALSE);
-
- /* process them once at a time */
- while (WorkQ != NULL)
- {
- WORK *w = WorkQ;
-
- WorkQ = WorkQ->w_next;
- e->e_to = NULL;
-
- /*
- ** Ignore jobs that are too expensive for the moment.
- **
- ** Get new load average every 30 seconds.
- */
-
- if (current_la_time < curtime() - 30)
- {
- CurrentLA = getla();
- current_la_time = curtime();
- }
- if (shouldqueue(WkRecipFact, current_la_time))
- {
- char *msg = "Aborting queue run: load average too high";
-
- if (Verbose)
- message("%s", msg);
- if (LogLevel > 8)
- sm_syslog(LOG_INFO, NOQID,
- "runqueue: %s",
- msg);
- break;
- }
- sequenceno++;
- if (shouldqueue(w->w_pri, w->w_ctime))
- {
- if (Verbose)
- message("");
- if (QueueSortOrder == QS_BYPRIORITY)
- {
- if (Verbose)
- message("Skipping %s (sequence %d of %d) and flushing rest of queue",
- w->w_name + 2,
- sequenceno,
- njobs);
- if (LogLevel > 8)
- sm_syslog(LOG_INFO, NOQID,
- "runqueue: Flushing queue from %s (pri %ld, LA %d, %d of %d)",
- w->w_name + 2,
- w->w_pri,
- CurrentLA,
- sequenceno,
- njobs);
- break;
- }
- else if (Verbose)
- message("Skipping %s (sequence %d of %d)",
- w->w_name + 2, sequenceno, njobs);
- }
- else
- {
- pid_t pid;
-
- if (Verbose)
- {
- message("");
- message("Running %s (sequence %d of %d)",
- w->w_name + 2, sequenceno, njobs);
- }
- pid = dowork(w->w_name + 2, ForkQueueRuns, FALSE, e);
- errno = 0;
- if (pid != 0)
- (void) waitfor(pid);
- }
- free(w->w_name);
- if (w->w_host)
- free(w->w_host);
- free((char *) w);
- }
-
- /* exit without the usual cleanup */
- e->e_id = NULL;
- finis(TRUE, ExitStat);
- /*NOTREACHED*/
- return TRUE;
-}
-
-
-/*
-** RUNQUEUEEVENT -- stub for use in setevent
-*/
-
-void
-runqueueevent()
-{
- DoQueueRun = TRUE;
-}
-\f/*
-** ORDERQ -- order the work queue.
-**
-** Parameters:
-** doall -- if set, include everything in the queue (even
-** the jobs that cannot be run because the load
-** average is too high). Otherwise, exclude those
-** jobs.
-**
-** Returns:
-** The number of request in the queue (not necessarily
-** the number of requests in WorkQ however).
-**
-** Side Effects:
-** Sets WorkQ to the queue of available work, in order.
-*/
-
-# define NEED_P 001
-# define NEED_T 002
-# define NEED_R 004
-# define NEED_S 010
-
-static WORK *WorkList = NULL;
-static int WorkListSize = 0;
-
-int
-orderq(doall)
- bool doall;
-{
- register struct dirent *d;
- register WORK *w;
- register char *p;
- DIR *f;
- register int i;
- int wn = -1;
- int wc;
- QUEUE_CHAR *check;
-
- if (tTd(41, 1))
- {
- printf("orderq:\n");
-
- check = QueueLimitId;
- while (check != NULL)
- {
- printf("\tQueueLimitId = %s\n",
- check->queue_match);
- check = check->queue_next;
- }
-
- check = QueueLimitSender;
- while (check != NULL)
- {
- printf("\tQueueLimitSender = %s\n",
- check->queue_match);
- check = check->queue_next;
- }
-
- check = QueueLimitRecipient;
- while (check != NULL)
- {
- printf("\tQueueLimitRecipient = %s\n",
- check->queue_match);
- check = check->queue_next;
- }
- }
-
- /* clear out old WorkQ */
- for (w = WorkQ; w != NULL; )
- {
- register WORK *nw = w->w_next;
-
- WorkQ = nw;
- free(w->w_name);
- if (w->w_host)
- free(w->w_host);
- free((char *) w);
- w = nw;
- }
-
- /* open the queue directory */
- f = opendir(".");
- if (f == NULL)
- {
- syserr("orderq: cannot open \"%s\" as \".\"", QueueDir);
- return (0);
- }
-
- /*
- ** Read the work directory.
- */
-
- while ((d = readdir(f)) != NULL)
- {
- FILE *cf;
- int qfver = 0;
- char lbuf[MAXNAME + 1];
- extern bool strcontainedin __P((char *, char *));
-
- if (tTd(41, 50))
- printf("orderq: checking %s\n", d->d_name);
-
- /* is this an interesting entry? */
- if (d->d_name[0] != 'q' || d->d_name[1] != 'f')
- continue;
-
- if (strlen(d->d_name) > MAXQFNAME)
- {
- if (Verbose)
- printf("orderq: %s too long, %d max characters\n",
- d->d_name, MAXQFNAME);
- if (LogLevel > 0)
- sm_syslog(LOG_ALERT, NOQID,
- "orderq: %s too long, %d max characters",
- d->d_name, MAXQFNAME);
- continue;
- }
-
- check = QueueLimitId;
- while (check != NULL)
- {
- if (strcontainedin(check->queue_match, d->d_name))
- break;
- else
- check = check->queue_next;
- }
- if (QueueLimitId != NULL && check == NULL)
- continue;
-
-#ifdef PICKY_QF_NAME_CHECK
- /*
- ** Check queue name for plausibility. This handles
- ** both old and new type ids.
- */
-
- p = d->d_name + 2;
- if (isupper(p[0]) && isupper(p[2]))
- p += 3;
- else if (isupper(p[1]))
- p += 2;
- else
- p = d->d_name;
- for (i = 0; isdigit(*p); p++)
- i++;
- if (i < 5 || *p != '\0')
- {
- if (Verbose)
- printf("orderq: bogus qf name %s\n", d->d_name);
- if (LogLevel > 0)
- sm_syslog(LOG_ALERT, NOQID,
- "orderq: bogus qf name %s",
- d->d_name);
- if (strlen(d->d_name) > (SIZE_T) MAXNAME)
- d->d_name[MAXNAME] = '\0';
- strcpy(lbuf, d->d_name);
- lbuf[0] = 'Q';
- (void) rename(d->d_name, lbuf);
- continue;
- }
-#endif
-
- /* open control file (if not too many files) */
- if (++wn >= MaxQueueRun && MaxQueueRun > 0)
- {
- if (wn == MaxQueueRun && LogLevel > 0)
- sm_syslog(LOG_ALERT, NOQID,
- "WorkList for %s maxed out at %d",
- QueueDir, MaxQueueRun);
- continue;
- }
- if (wn >= WorkListSize)
- {
- extern void grow_wlist __P((void));
-
- grow_wlist();
- if (wn >= WorkListSize)
- continue;
- }
-
- cf = fopen(d->d_name, "r");
- if (cf == NULL)
- {
- /* this may be some random person sending hir msgs */
- /* syserr("orderq: cannot open %s", cbuf); */
- if (tTd(41, 2))
- printf("orderq: cannot open %s: %s\n",
- d->d_name, errstring(errno));
- errno = 0;
- wn--;
- continue;
- }
- w = &WorkList[wn];
- w->w_name = newstr(d->d_name);
- w->w_host = NULL;
- w->w_lock = !lockfile(fileno(cf), w->w_name, NULL, LOCK_SH|LOCK_NB);
- w->w_tooyoung = FALSE;
-
- /* make sure jobs in creation don't clog queue */
- w->w_pri = 0x7fffffff;
- w->w_ctime = 0;
-
- /* extract useful information */
- i = NEED_P | NEED_T;
- if (QueueLimitSender != NULL)
- i |= NEED_S;
- if (QueueSortOrder == QS_BYHOST || QueueLimitRecipient != NULL)
- i |= NEED_R;
- while (i != 0 && fgets(lbuf, sizeof lbuf, cf) != NULL)
- {
- int c;
- time_t age;
- extern bool strcontainedin __P((char *, char *));
-
- p = strchr(lbuf, '\n');
- if (p != NULL)
- *p = '\0';
- else
- {
- /* flush rest of overly long line */
- while ((c = getc(cf)) != EOF && c != '\n')
- continue;
- }
-
- switch (lbuf[0])
- {
- case 'V':
- qfver = atoi(&lbuf[1]);
- break;
-
- case 'P':
- w->w_pri = atol(&lbuf[1]);
- i &= ~NEED_P;
- break;
-
- case 'T':
- w->w_ctime = atol(&lbuf[1]);
- i &= ~NEED_T;
- break;
-
- case 'R':
- if (w->w_host == NULL &&
- (p = strrchr(&lbuf[1], '@')) != NULL)
- w->w_host = newstr(&p[1]);
- if (QueueLimitRecipient == NULL)
- {
- i &= ~NEED_R;
- break;
- }
- if (qfver > 0)
- {
- p = strchr(&lbuf[1], ':');
- if (p == NULL)
- p = &lbuf[1];
- }
- else
- p = &lbuf[1];
- check = QueueLimitRecipient;
- while (check != NULL)
- {
- if (strcontainedin(check->queue_match,
- p))
- break;
- else
- check = check->queue_next;
- }
- if (check != NULL)
- i &= ~NEED_R;
- break;
-
- case 'S':
- check = QueueLimitSender;
- while (check != NULL)
- {
- if (strcontainedin(check->queue_match,
- &lbuf[1]))
- break;
- else
- check = check->queue_next;
- }
- if (check != NULL)
- i &= ~NEED_S;
- break;
-
- case 'K':
- age = curtime() - (time_t) atol(&lbuf[1]);
- if (age >= 0 && MinQueueAge > 0 &&
- age < MinQueueAge)
- w->w_tooyoung = TRUE;
- break;
-
- case 'N':
- if (atol(&lbuf[1]) == 0)
- w->w_tooyoung = FALSE;
- break;
- }
- }
- (void) fclose(cf);
-
- if ((!doall && shouldqueue(w->w_pri, w->w_ctime)) ||
- bitset(NEED_R|NEED_S, i))
- {
- /* don't even bother sorting this job in */
- if (tTd(41, 49))
- printf("skipping %s (%x)\n", w->w_name, i);
- free(w->w_name);
- if (w->w_host)
- free(w->w_host);
- wn--;
- }
- }
- (void) closedir(f);
- wn++;
-
- wc = min(wn, WorkListSize);
- if (wc > MaxQueueRun && MaxQueueRun > 0)
- wc = MaxQueueRun;
-
- if (QueueSortOrder == QS_BYHOST)
- {
- extern int workcmpf1();
- extern int workcmpf2();
-
- /*
- ** Sort the work directory for the first time,
- ** based on host name, lock status, and priority.
- */
-
- qsort((char *) WorkList, wc, sizeof *WorkList, workcmpf1);
-
- /*
- ** If one message to host is locked, "lock" all messages
- ** to that host.
- */
-
- i = 0;
- while (i < wc)
- {
- if (!WorkList[i].w_lock)
- {
- i++;
- continue;
- }
- w = &WorkList[i];
- while (++i < wc)
- {
- extern int sm_strcasecmp __P((char *, char *));
-
- if (WorkList[i].w_host == NULL &&
- w->w_host == NULL)
- WorkList[i].w_lock = TRUE;
- else if (WorkList[i].w_host != NULL &&
- w->w_host != NULL &&
- sm_strcasecmp(WorkList[i].w_host, w->w_host) == 0)
- WorkList[i].w_lock = TRUE;
- else
- break;
- }
- }
-
- /*
- ** Sort the work directory for the second time,
- ** based on lock status, host name, and priority.
- */
-
- qsort((char *) WorkList, wc, sizeof *WorkList, workcmpf2);
- }
- else if (QueueSortOrder == QS_BYTIME)
- {
- extern int workcmpf3();
-
- /*
- ** Simple sort based on submission time only.
- */
-
- qsort((char *) WorkList, wc, sizeof *WorkList, workcmpf3);
- }
- else
- {
- extern int workcmpf0();
-
- /*
- ** Simple sort based on queue priority only.
- */
-
- qsort((char *) WorkList, wc, sizeof *WorkList, workcmpf0);
- }
-
- /*
- ** Convert the work list into canonical form.
- ** Should be turning it into a list of envelopes here perhaps.
- */
-
- WorkQ = NULL;
- for (i = wc; --i >= 0; )
- {
- w = (WORK *) xalloc(sizeof *w);
- w->w_name = WorkList[i].w_name;
- w->w_host = WorkList[i].w_host;
- w->w_lock = WorkList[i].w_lock;
- w->w_tooyoung = WorkList[i].w_tooyoung;
- w->w_pri = WorkList[i].w_pri;
- w->w_ctime = WorkList[i].w_ctime;
- w->w_next = WorkQ;
- WorkQ = w;
- }
- if (WorkList != NULL)
- free(WorkList);
- WorkList = NULL;
- WorkListSize = 0;
-
- if (tTd(40, 1))
- {
- for (w = WorkQ; w != NULL; w = w->w_next)
- printf("%32s: pri=%ld\n", w->w_name, w->w_pri);
- }
-
- return (wn);
-}
-\f/*
-** GROW_WLIST -- make the work list larger
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Adds another QUEUESEGSIZE entries to WorkList if possible.
-** It can fail if there isn't enough memory, so WorkListSize
-** should be checked again upon return.
-*/
-
-void
-grow_wlist()
-{
- if (tTd(41, 1))
- printf("grow_wlist: WorkListSize=%d\n", WorkListSize);
- if (WorkList == NULL)
- {
- WorkList = (WORK *) xalloc(sizeof(WORK) * (QUEUESEGSIZE + 1));
- WorkListSize = QUEUESEGSIZE;
- }
- else
- {
- int newsize = WorkListSize + QUEUESEGSIZE;
- WORK *newlist = (WORK *) realloc((char *)WorkList,
- (unsigned)sizeof(WORK) * (newsize + 1));
-
- if (newlist != NULL)
- {
- WorkListSize = newsize;
- WorkList = newlist;
- if (LogLevel > 1)
- {
- sm_syslog(LOG_NOTICE, NOQID,
- "grew WorkList for %s to %d",
- QueueDir, WorkListSize);
- }
- }
- else if (LogLevel > 0)
- {
- sm_syslog(LOG_ALERT, NOQID,
- "FAILED to grow WorkList for %s to %d",
- QueueDir, newsize);
- }
- }
- if (tTd(41, 1))
- printf("grow_wlist: WorkListSize now %d\n", WorkListSize);
-}
-\f/*
-** WORKCMPF0 -- simple priority-only compare function.
-**
-** Parameters:
-** a -- the first argument.
-** b -- the second argument.
-**
-** Returns:
-** -1 if a < b
-** 0 if a == b
-** +1 if a > b
-**
-** Side Effects:
-** none.
-*/
-
-int
-workcmpf0(a, b)
- register WORK *a;
- register WORK *b;
-{
- long pa = a->w_pri;
- long pb = b->w_pri;
-
- if (pa == pb)
- return 0;
- else if (pa > pb)
- return 1;
- else
- return -1;
-}
-\f/*
-** WORKCMPF1 -- first compare function for ordering work based on host name.
-**
-** Sorts on host name, lock status, and priority in that order.
-**
-** Parameters:
-** a -- the first argument.
-** b -- the second argument.
-**
-** Returns:
-** <0 if a < b
-** 0 if a == b
-** >0 if a > b
-**
-** Side Effects:
-** none.
-*/
-
-int
-workcmpf1(a, b)
- register WORK *a;
- register WORK *b;
-{
- int i;
- extern int sm_strcasecmp __P((char *, char *));
-
- /* host name */
- if (a->w_host != NULL && b->w_host == NULL)
- return 1;
- else if (a->w_host == NULL && b->w_host != NULL)
- return -1;
- if (a->w_host != NULL && b->w_host != NULL &&
- (i = sm_strcasecmp(a->w_host, b->w_host)) != 0)
- return i;
-
- /* lock status */
- if (a->w_lock != b->w_lock)
- return b->w_lock - a->w_lock;
-
- /* job priority */
- return a->w_pri - b->w_pri;
-}
-\f/*
-** WORKCMPF2 -- second compare function for ordering work based on host name.
-**
-** Sorts on lock status, host name, and priority in that order.
-**
-** Parameters:
-** a -- the first argument.
-** b -- the second argument.
-**
-** Returns:
-** <0 if a < b
-** 0 if a == b
-** >0 if a > b
-**
-** Side Effects:
-** none.
-*/
-
-int
-workcmpf2(a, b)
- register WORK *a;
- register WORK *b;
-{
- int i;
- extern int sm_strcasecmp __P((char *, char *));
-
- /* lock status */
- if (a->w_lock != b->w_lock)
- return a->w_lock - b->w_lock;
-
- /* host name */
- if (a->w_host != NULL && b->w_host == NULL)
- return 1;
- else if (a->w_host == NULL && b->w_host != NULL)
- return -1;
- if (a->w_host != NULL && b->w_host != NULL &&
- (i = sm_strcasecmp(a->w_host, b->w_host)) != 0)
- return i;
-
- /* job priority */
- return a->w_pri - b->w_pri;
-}
-\f/*
-** WORKCMPF3 -- simple submission-time-only compare function.
-**
-** Parameters:
-** a -- the first argument.
-** b -- the second argument.
-**
-** Returns:
-** -1 if a < b
-** 0 if a == b
-** +1 if a > b
-**
-** Side Effects:
-** none.
-*/
-
-int
-workcmpf3(a, b)
- register WORK *a;
- register WORK *b;
-{
- if (a->w_ctime > b->w_ctime)
- return 1;
- else if (a->w_ctime < b->w_ctime)
- return -1;
- else
- return 0;
-}
-\f/*
-** DOWORK -- do a work request.
-**
-** Parameters:
-** id -- the ID of the job to run.
-** forkflag -- if set, run this in background.
-** requeueflag -- if set, reinstantiate the queue quickly.
-** This is used when expanding aliases in the queue.
-** If forkflag is also set, it doesn't wait for the
-** child.
-** e - the envelope in which to run it.
-**
-** Returns:
-** process id of process that is running the queue job.
-**
-** Side Effects:
-** The work request is satisfied if possible.
-*/
-
-pid_t
-dowork(id, forkflag, requeueflag, e)
- char *id;
- bool forkflag;
- bool requeueflag;
- register ENVELOPE *e;
-{
- register pid_t pid;
- extern bool readqf __P((ENVELOPE *));
-
- if (tTd(40, 1))
- printf("dowork(%s)\n", id);
-
- /*
- ** Fork for work.
- */
-
- if (forkflag)
- {
- pid = fork();
- if (pid < 0)
- {
- syserr("dowork: cannot fork");
- return 0;
- }
- else if (pid > 0)
- {
- /* parent -- clean out connection cache */
- mci_flush(FALSE, NULL);
- }
- else
- {
- /* child -- error messages to the transcript */
- QuickAbort = OnlyOneError = FALSE;
-
- /*
- ** Since the delivery may happen in a child and the
- ** parent does not wait, the parent may close the
- ** maps thereby removing any shared memory used by
- ** the map. Therefore, open a copy of the maps for
- ** the delivery process.
- */
-
- initmaps(FALSE, e);
- }
- }
- else
- {
- pid = 0;
- }
-
- if (pid == 0)
- {
- /*
- ** CHILD
- ** Lock the control file to avoid duplicate deliveries.
- ** Then run the file as though we had just read it.
- ** We save an idea of the temporary name so we
- ** can recover on interrupt.
- */
-
- /* set basic modes, etc. */
- (void) alarm(0);
- clearenvelope(e, FALSE);
- e->e_flags |= EF_QUEUERUN|EF_GLOBALERRS;
- e->e_sendmode = SM_DELIVER;
- e->e_errormode = EM_MAIL;
- e->e_id = id;
- GrabTo = UseErrorsTo = FALSE;
- ExitStat = EX_OK;
- if (forkflag)
- {
- disconnect(1, e);
- OpMode = MD_DELIVER;
- }
- sm_setproctitle(TRUE, "%s: from queue", id);
- if (LogLevel > 76)
- sm_syslog(LOG_DEBUG, e->e_id,
- "dowork, pid=%d",
- getpid());
-
- /* don't use the headers from sendmail.cf... */
- e->e_header = NULL;
-
- /* read the queue control file -- return if locked */
- if (!readqf(e))
- {
- if (tTd(40, 4) && e->e_id != NULL)
- printf("readqf(%s) failed\n", e->e_id);
- e->e_id = NULL;
- if (forkflag)
- finis(FALSE, EX_OK);
- else
- return 0;
- }
-
- e->e_flags |= EF_INQUEUE;
- eatheader(e, requeueflag);
-
- if (requeueflag)
- queueup(e, FALSE);
-
- /* do the delivery */
- sendall(e, SM_DELIVER);
-
- /* finish up and exit */
- if (forkflag)
- finis(TRUE, ExitStat);
- else
- dropenvelope(e, TRUE);
- }
- e->e_id = NULL;
- return pid;
-}
-\f/*
-** READQF -- read queue file and set up environment.
-**
-** Parameters:
-** e -- the envelope of the job to run.
-**
-** Returns:
-** TRUE if it successfully read the queue file.
-** FALSE otherwise.
-**
-** Side Effects:
-** The queue file is returned locked.
-*/
-
-bool
-readqf(e)
- register ENVELOPE *e;
-{
- register FILE *qfp;
- ADDRESS *ctladdr;
- struct stat st;
- char *bp;
- int qfver = 0;
- long hdrsize = 0;
- register char *p;
- char *orcpt = NULL;
- bool nomore = FALSE;
- char qf[MAXQFNAME];
- char buf[MAXLINE];
- extern ADDRESS *setctluser __P((char *, int));
-
- /*
- ** Read and process the file.
- */
-
- strcpy(qf, queuename(e, 'q'));
- qfp = fopen(qf, "r+");
- if (qfp == NULL)
- {
- if (tTd(40, 8))
- printf("readqf(%s): fopen failure (%s)\n",
- qf, errstring(errno));
- if (errno != ENOENT)
- syserr("readqf: no control file %s", qf);
- return FALSE;
- }
-
- if (!lockfile(fileno(qfp), qf, NULL, LOCK_EX|LOCK_NB))
- {
- /* being processed by another queuer */
- if (Verbose || tTd(40, 8))
- printf("%s: locked\n", e->e_id);
- if (LogLevel > 19)
- sm_syslog(LOG_DEBUG, e->e_id, "locked");
- (void) fclose(qfp);
- return FALSE;
- }
-
- /*
- ** Check the queue file for plausibility to avoid attacks.
- */
-
- if (fstat(fileno(qfp), &st) < 0)
- {
- /* must have been being processed by someone else */
- if (tTd(40, 8))
- printf("readqf(%s): fstat failure (%s)\n",
- qf, errstring(errno));
- fclose(qfp);
- return FALSE;
- }
-
- if ((st.st_uid != geteuid() && geteuid() != RealUid) ||
- bitset(S_IWOTH|S_IWGRP, st.st_mode))
- {
- if (LogLevel > 0)
- {
- sm_syslog(LOG_ALERT, e->e_id,
- "bogus queue file, uid=%d, mode=%o",
- st.st_uid, st.st_mode);
- }
- if (tTd(40, 8))
- printf("readqf(%s): bogus file\n", qf);
- loseqfile(e, "bogus file uid in mqueue");
- fclose(qfp);
- return FALSE;
- }
-
- if (st.st_size == 0)
- {
- /* must be a bogus file -- if also old, just remove it */
- if (st.st_ctime + 10 * 60 < curtime())
- {
- qf[0] = 'd';
- (void) unlink(qf);
- qf[0] = 'q';
- (void) unlink(qf);
- }
- fclose(qfp);
- return FALSE;
- }
-
- if (st.st_nlink == 0)
- {
- /*
- ** Race condition -- we got a file just as it was being
- ** unlinked. Just assume it is zero length.
- */
-
- fclose(qfp);
- return FALSE;
- }
-
- /* good file -- save this lock */
- e->e_lockfp = qfp;
-
- /* do basic system initialization */
- initsys(e);
- define('i', e->e_id, e);
-
- LineNumber = 0;
- e->e_flags |= EF_GLOBALERRS;
- OpMode = MD_DELIVER;
- ctladdr = NULL;
- e->e_dfino = -1;
- e->e_msgsize = -1;
- while ((bp = fgetfolded(buf, sizeof buf, qfp)) != NULL)
- {
- register char *p;
- u_long qflags;
- ADDRESS *q;
- int mid;
- auto char *ep;
-
- if (tTd(40, 4))
- printf("+++++ %s\n", bp);
- if (nomore)
- {
- /* hack attack */
- syserr("SECURITY ALERT: extra data in qf: %s", bp);
- fclose(qfp);
- loseqfile(e, "bogus queue line");
- return FALSE;
- }
- switch (bp[0])
- {
- case 'V': /* queue file version number */
- qfver = atoi(&bp[1]);
- if (qfver <= QF_VERSION)
- break;
- syserr("Version number in qf (%d) greater than max (%d)",
- qfver, QF_VERSION);
- fclose(qfp);
- loseqfile(e, "unsupported qf file version");
- return FALSE;
-
- case 'C': /* specify controlling user */
- ctladdr = setctluser(&bp[1], qfver);
- break;
-
- case 'Q': /* original recipient */
- orcpt = newstr(&bp[1]);
- break;
-
- case 'R': /* specify recipient */
- p = bp;
- qflags = 0;
- if (qfver >= 1)
- {
- /* get flag bits */
- while (*++p != '\0' && *p != ':')
- {
- switch (*p)
- {
- case 'N':
- qflags |= QHASNOTIFY;
- break;
-
- case 'S':
- qflags |= QPINGONSUCCESS;
- break;
-
- case 'F':
- qflags |= QPINGONFAILURE;
- break;
-
- case 'D':
- qflags |= QPINGONDELAY;
- break;
-
- case 'P':
- qflags |= QPRIMARY;
- break;
- }
- }
- }
- else
- qflags |= QPRIMARY;
- q = parseaddr(++p, NULLADDR, RF_COPYALL, '\0', NULL, e);
- if (q != NULL)
- {
- q->q_alias = ctladdr;
- if (qfver >= 1)
- q->q_flags &= ~Q_PINGFLAGS;
- q->q_flags |= qflags;
- q->q_orcpt = orcpt;
- (void) recipient(q, &e->e_sendqueue, 0, e);
- }
- orcpt = NULL;
- break;
-
- case 'E': /* specify error recipient */
- /* no longer used */
- break;
-
- case 'H': /* header */
- (void) chompheader(&bp[1], FALSE, NULL, e);
- hdrsize += strlen(&bp[1]);
- break;
-
- case 'L': /* Solaris Content-Length: */
- case 'M': /* message */
- /* ignore this; we want a new message next time */
- break;
-
- case 'S': /* sender */
- setsender(newstr(&bp[1]), e, NULL, '\0', TRUE);
- break;
-
- case 'B': /* body type */
- e->e_bodytype = newstr(&bp[1]);
- break;
-
-#if _FFR_SAVE_CHARSET
- case 'X': /* character set */
- e->e_charset = newstr(&bp[1]);
- break;
-#endif
-
- case 'D': /* data file name */
- /* obsolete -- ignore */
- break;
-
- case 'T': /* init time */
- e->e_ctime = atol(&bp[1]);
- break;
-
- case 'I': /* data file's inode number */
- /* regenerated below */
- break;
-
- case 'K': /* time of last deliver attempt */
- e->e_dtime = atol(&buf[1]);
- break;
-
- case 'N': /* number of delivery attempts */
- e->e_ntries = atoi(&buf[1]);
-
- /* if this has been tried recently, let it be */
- if (e->e_ntries > 0 &&
- MinQueueAge > 0 && e->e_dtime <= curtime() &&
- curtime() < e->e_dtime + MinQueueAge)
- {
- char *howlong = pintvl(curtime() - e->e_dtime, TRUE);
-
- if (Verbose || tTd(40, 8))
- printf("%s: too young (%s)\n",
- e->e_id, howlong);
- if (LogLevel > 19)
- sm_syslog(LOG_DEBUG, e->e_id,
- "too young (%s)",
- howlong);
- e->e_id = NULL;
- unlockqueue(e);
- return FALSE;
- }
- break;
-
- case 'P': /* message priority */
- e->e_msgpriority = atol(&bp[1]) + WkTimeFact;
- break;
-
- case 'F': /* flag bits */
- if (strncmp(bp, "From ", 5) == 0)
- {
- /* we are being spoofed! */
- syserr("SECURITY ALERT: bogus qf line %s", bp);
- fclose(qfp);
- loseqfile(e, "bogus queue line");
- return FALSE;
- }
- for (p = &bp[1]; *p != '\0'; p++)
- {
- switch (*p)
- {
- case 'w': /* warning sent */
- e->e_flags |= EF_WARNING;
- break;
-
- case 'r': /* response */
- e->e_flags |= EF_RESPONSE;
- break;
-
- case '8': /* has 8 bit data */
- e->e_flags |= EF_HAS8BIT;
- break;
-
- case 'b': /* delete Bcc: header */
- e->e_flags |= EF_DELETE_BCC;
- break;
-
- case 'd': /* envelope has DSN RET= */
- e->e_flags |= EF_RET_PARAM;
- break;
-
- case 'n': /* don't return body */
- e->e_flags |= EF_NO_BODY_RETN;
- break;
- }
- }
- break;
-
- case 'Z': /* original envelope id from ESMTP */
- e->e_envid = newstr(&bp[1]);
- break;
-
- case '$': /* define macro */
- mid = macid(&bp[1], &ep);
- define(mid, newstr(ep), e);
- break;
-
- case '.': /* terminate file */
- nomore = TRUE;
- break;
-
- default:
- syserr("readqf: %s: line %d: bad line \"%s\"",
- qf, LineNumber, shortenstring(bp, MAXSHORTSTR));
- fclose(qfp);
- loseqfile(e, "unrecognized line");
- return FALSE;
- }
-
- if (bp != buf)
- free(bp);
- }
-
- /*
- ** If we haven't read any lines, this queue file is empty.
- ** Arrange to remove it without referencing any null pointers.
- */
-
- if (LineNumber == 0)
- {
- errno = 0;
- e->e_flags |= EF_CLRQUEUE | EF_FATALERRS | EF_RESPONSE;
- return TRUE;
- }
-
- /*
- ** Arrange to read the data file.
- */
-
- p = queuename(e, 'd');
- e->e_dfp = fopen(p, "r");
- if (e->e_dfp == NULL)
- {
- syserr("readqf: cannot open %s", p);
- }
- else
- {
- e->e_flags |= EF_HAS_DF;
- if (fstat(fileno(e->e_dfp), &st) >= 0)
- {
- e->e_msgsize = st.st_size + hdrsize;
- e->e_dfdev = st.st_dev;
- e->e_dfino = st.st_ino;
- }
- }
-
- return TRUE;
-}
-\f/*
-** PRINTQUEUE -- print out a representation of the mail queue
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Prints a listing of the mail queue on the standard output.
-*/
-
-void
-printqueue()
-{
- register WORK *w;
- FILE *f;
- int nrequests;
- char buf[MAXLINE];
-
- /*
- ** Check for permission to print the queue
- */
-
- if (bitset(PRIV_RESTRICTMAILQ, PrivacyFlags) && RealUid != 0)
- {
- struct stat st;
-# ifdef NGROUPS_MAX
- int n;
- extern GIDSET_T InitialGidSet[NGROUPS_MAX];
-# endif
-
- if (stat(QueueDir, &st) < 0)
- {
- syserr("Cannot stat %s", QueueDir);
- return;
- }
-# ifdef NGROUPS_MAX
- n = NGROUPS_MAX;
- while (--n >= 0)
- {
- if (InitialGidSet[n] == st.st_gid)
- break;
- }
- if (n < 0 && RealGid != st.st_gid)
-# else
- if (RealGid != st.st_gid)
-# endif
- {
- usrerr("510 You are not permitted to see the queue");
- setstat(EX_NOPERM);
- return;
- }
- }
-
- /*
- ** Read and order the queue.
- */
-
- nrequests = orderq(TRUE);
-
- /*
- ** Print the work list that we have read.
- */
-
- /* first see if there is anything */
- if (nrequests <= 0)
- {
- printf("Mail queue is empty\n");
- return;
- }
-
- CurrentLA = getla(); /* get load average */
-
- printf("\t\tMail Queue (%d request%s", nrequests, nrequests == 1 ? "" : "s");
- if (MaxQueueRun > 0 && nrequests > MaxQueueRun)
- printf(", only %d printed", MaxQueueRun);
- if (Verbose)
- printf(")\n--Q-ID-- --Size-- -Priority- ---Q-Time--- -----------Sender/Recipient-----------\n");
- else
- printf(")\n--Q-ID-- --Size-- -----Q-Time----- ------------Sender/Recipient------------\n");
- for (w = WorkQ; w != NULL; w = w->w_next)
- {
- struct stat st;
- auto time_t submittime = 0;
- long dfsize;
- int flags = 0;
- int qfver;
- char statmsg[MAXLINE];
- char bodytype[MAXNAME + 1];
-
- printf("%8s", w->w_name + 2);
- f = fopen(w->w_name, "r");
- if (f == NULL)
- {
- printf(" (job completed)\n");
- errno = 0;
- continue;
- }
- w->w_name[0] = 'd';
- if (stat(w->w_name, &st) >= 0)
- dfsize = st.st_size;
- else
- dfsize = -1;
- if (w->w_lock)
- printf("*");
- else if (w->w_tooyoung)
- printf("-");
- else if (shouldqueue(w->w_pri, w->w_ctime))
- printf("X");
- else
- printf(" ");
- errno = 0;
-
- statmsg[0] = bodytype[0] = '\0';
- qfver = 0;
- while (fgets(buf, sizeof buf, f) != NULL)
- {
- register int i;
- register char *p;
-
- fixcrlf(buf, TRUE);
- switch (buf[0])
- {
- case 'V': /* queue file version */
- qfver = atoi(&buf[1]);
- break;
-
- case 'M': /* error message */
- if ((i = strlen(&buf[1])) >= sizeof statmsg)
- i = sizeof statmsg - 1;
- bcopy(&buf[1], statmsg, i);
- statmsg[i] = '\0';
- break;
-
- case 'B': /* body type */
- if ((i = strlen(&buf[1])) >= sizeof bodytype)
- i = sizeof bodytype - 1;
- bcopy(&buf[1], bodytype, i);
- bodytype[i] = '\0';
- break;
-
- case 'S': /* sender name */
- if (Verbose)
- printf("%8ld %10ld%c%.12s %.78s",
- dfsize,
- w->w_pri,
- bitset(EF_WARNING, flags) ? '+' : ' ',
- ctime(&submittime) + 4,
- &buf[1]);
- else
- printf("%8ld %.16s %.45s", dfsize,
- ctime(&submittime), &buf[1]);
- if (statmsg[0] != '\0' || bodytype[0] != '\0')
- {
- printf("\n %10.10s", bodytype);
- if (statmsg[0] != '\0')
- printf(" (%.*s)",
- Verbose ? 100 : 60,
- statmsg);
- }
- break;
-
- case 'C': /* controlling user */
- if (Verbose)
- printf("\n\t\t\t\t (---%.74s---)",
- &buf[1]);
- break;
-
- case 'R': /* recipient name */
- p = &buf[1];
- if (qfver >= 1)
- {
- p = strchr(p, ':');
- if (p == NULL)
- break;
- p++;
- }
- if (Verbose)
- printf("\n\t\t\t\t\t %.78s", p);
- else
- printf("\n\t\t\t\t %.45s", p);
- break;
-
- case 'T': /* creation time */
- submittime = atol(&buf[1]);
- break;
-
- case 'F': /* flag bits */
- for (p = &buf[1]; *p != '\0'; p++)
- {
- switch (*p)
- {
- case 'w':
- flags |= EF_WARNING;
- break;
- }
- }
- }
- }
- if (submittime == (time_t) 0)
- printf(" (no control file)");
- printf("\n");
- (void) fclose(f);
- }
-}
-
-# endif /* QUEUE */
-\f/*
-** QUEUENAME -- build a file name in the queue directory for this envelope.
-**
-** Assigns an id code if one does not already exist.
-** This code is very careful to avoid trashing existing files
-** under any circumstances.
-**
-** Parameters:
-** e -- envelope to build it in/from.
-** type -- the file type, used as the first character
-** of the file name.
-**
-** Returns:
-** a pointer to the new file name (in a static buffer).
-**
-** Side Effects:
-** If no id code is already assigned, queuename will
-** assign an id code, create a qf file, and leave a
-** locked, open-for-write file pointer in the envelope.
-*/
-
-#ifndef ENOLCK
-# define ENOLCK -1
-#endif
-#ifndef ENOSPC
-# define ENOSPC -1
-#endif
-
-char *
-queuename(e, type)
- register ENVELOPE *e;
- int type;
-{
- static pid_t pid = -1;
- static char c0;
- static char c1;
- static char c2;
- time_t now;
- struct tm *tm;
- static char buf[MAXNAME + 1];
-
- if (e->e_id == NULL)
- {
- char qf[MAXQFNAME];
-
- /* find a unique id */
- if (pid != getpid())
- {
- /* new process -- start back at "AA" */
- pid = getpid();
- now = curtime();
- tm = localtime(&now);
- c0 = 'A' + tm->tm_hour;
- c1 = 'A';
- c2 = 'A' - 1;
- }
- (void) snprintf(qf, sizeof qf, "qf%cAA%05d", c0, pid);
-
- while (c1 < '~' || c2 < 'Z')
- {
- int i;
- int attempts = 0;
-
- if (c2 >= 'Z')
- {
- c1++;
- c2 = 'A' - 1;
- }
- qf[3] = c1;
- qf[4] = ++c2;
- if (tTd(7, 20))
- printf("queuename: trying \"%s\"\n", qf);
-
- i = open(qf, O_WRONLY|O_CREAT|O_EXCL, FileMode);
- if (i < 0)
- {
- if (errno == EEXIST)
- continue;
- syserr("queuename: Cannot create \"%s\" in \"%s\" (euid=%d)",
- qf, QueueDir, geteuid());
- finis(FALSE, EX_UNAVAILABLE);
- }
- do
- {
- if (attempts > 0)
- sleep(attempts);
- e->e_lockfp = 0;
- if (lockfile(i, qf, NULL, LOCK_EX|LOCK_NB))
- {
- e->e_lockfp = fdopen(i, "w");
- break;
- }
- } while ((errno == ENOLCK || errno == ENOSPC) &&
- attempts++ < 4);
-
- /* Successful lock */
- if (e->e_lockfp != 0)
- break;
-
-#if !HASFLOCK
- if (errno != EAGAIN && errno != EACCES)
-#else
- if (errno != EWOULDBLOCK)
-#endif
- {
- syserr("queuename: Cannot lock \"%s\" in \"%s\" (euid=%d)",
- qf, QueueDir, geteuid());
- finis(FALSE, EX_OSERR);
- }
-
- /* a reader got the file; abandon it and try again */
- (void) close(i);
- }
- if (c1 >= '~' && c2 >= 'Z')
- {
- syserr("queuename: Cannot create \"%s\" in \"%s\" (euid=%d)",
- qf, QueueDir, geteuid());
- finis(FALSE, EX_OSERR);
- }
- e->e_id = newstr(&qf[2]);
- define('i', e->e_id, e);
- if (tTd(7, 1))
- printf("queuename: assigned id %s, env=%lx\n",
- e->e_id, (u_long) e);
- if (tTd(7, 9))
- {
- printf(" lockfd=");
- dumpfd(fileno(e->e_lockfp), TRUE, FALSE);
- }
- if (LogLevel > 93)
- sm_syslog(LOG_DEBUG, e->e_id, "assigned id");
- }
-
- if (type == '\0')
- return (NULL);
- (void) snprintf(buf, sizeof buf, "%cf%s", type, e->e_id);
- if (tTd(7, 2))
- printf("queuename: %s\n", buf);
- return (buf);
-}
-\f/*
-** UNLOCKQUEUE -- unlock the queue entry for a specified envelope
-**
-** Parameters:
-** e -- the envelope to unlock.
-**
-** Returns:
-** none
-**
-** Side Effects:
-** unlocks the queue for `e'.
-*/
-
-void
-unlockqueue(e)
- ENVELOPE *e;
-{
- if (tTd(51, 4))
- printf("unlockqueue(%s)\n",
- e->e_id == NULL ? "NOQUEUE" : e->e_id);
-
- /* if there is a lock file in the envelope, close it */
- if (e->e_lockfp != NULL)
- xfclose(e->e_lockfp, "unlockqueue", e->e_id);
- e->e_lockfp = NULL;
-
- /* don't create a queue id if we don't already have one */
- if (e->e_id == NULL)
- return;
-
- /* remove the transcript */
- if (LogLevel > 87)
- sm_syslog(LOG_DEBUG, e->e_id, "unlock");
- if (!tTd(51, 104))
- xunlink(queuename(e, 'x'));
-
-}
-\f/*
-** SETCTLUSER -- create a controlling address
-**
-** Create a fake "address" given only a local login name; this is
-** used as a "controlling user" for future recipient addresses.
-**
-** Parameters:
-** user -- the user name of the controlling user.
-** qfver -- the version stamp of this qf file.
-**
-** Returns:
-** An address descriptor for the controlling user.
-**
-** Side Effects:
-** none.
-*/
-
-ADDRESS *
-setctluser(user, qfver)
- char *user;
- int qfver;
-{
- register ADDRESS *a;
- struct passwd *pw;
- char *p;
-
- /*
- ** See if this clears our concept of controlling user.
- */
-
- if (user == NULL || *user == '\0')
- return NULL;
-
- /*
- ** Set up addr fields for controlling user.
- */
-
- a = (ADDRESS *) xalloc(sizeof *a);
- bzero((char *) a, sizeof *a);
-
- if (*user == '\0')
- {
- p = NULL;
- a->q_user = newstr(DefUser);
- }
- else if (*user == ':')
- {
- p = &user[1];
- a->q_user = newstr(p);
- }
- else
- {
- p = strtok(user, ":");
- a->q_user = newstr(user);
- if (qfver >= 2)
- {
- if ((p = strtok(NULL, ":")) != NULL)
- a->q_uid = atoi(p);
- if ((p = strtok(NULL, ":")) != NULL)
- a->q_gid = atoi(p);
- if ((p = strtok(NULL, ":")) != NULL)
- a->q_flags |= QGOODUID;
- }
- else if ((pw = sm_getpwnam(user)) != NULL)
- {
- if (strcmp(pw->pw_dir, "/") == 0)
- a->q_home = "";
- else
- a->q_home = newstr(pw->pw_dir);
- a->q_uid = pw->pw_uid;
- a->q_gid = pw->pw_gid;
- a->q_flags |= QGOODUID;
- }
- }
-
- a->q_flags |= QPRIMARY; /* flag as a "ctladdr" */
- a->q_mailer = LocalMailer;
- if (p == NULL)
- a->q_paddr = a->q_user;
- else
- a->q_paddr = newstr(p);
- return a;
-}
-\f/*
-** LOSEQFILE -- save the qf as Qf and try to let someone know
-**
-** Parameters:
-** e -- the envelope (e->e_id will be used).
-** why -- reported to whomever can hear.
-**
-** Returns:
-** none.
-*/
-
-void
-loseqfile(e, why)
- register ENVELOPE *e;
- char *why;
-{
- char *p;
- char buf[MAXQFNAME + 1];
-
- if (e == NULL || e->e_id == NULL)
- return;
- p = queuename(e, 'q');
- if (strlen(p) > MAXQFNAME)
- {
- syserr("loseqfile: queuename (%s) too long", p);
- return;
- }
- strcpy(buf, p);
- p = queuename(e, 'Q');
- if (rename(buf, p) < 0)
- syserr("cannot rename(%s, %s), uid=%d", buf, p, geteuid());
- else if (LogLevel > 0)
- sm_syslog(LOG_ALERT, e->e_id,
- "Losing %s: %s", buf, why);
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)readcf.c 8.238 (Berkeley) 1/28/1999";
-#endif /* not lint */
-
-# include "sendmail.h"
-# include <grp.h>
-#if NAMED_BIND
-# include <resolv.h>
-#endif
-
-/*
-** READCF -- read configuration file.
-**
-** This routine reads the configuration file and builds the internal
-** form.
-**
-** The file is formatted as a sequence of lines, each taken
-** atomically. The first character of each line describes how
-** the line is to be interpreted. The lines are:
-** Dxval Define macro x to have value val.
-** Cxword Put word into class x.
-** Fxfile [fmt] Read file for lines to put into
-** class x. Use scanf string 'fmt'
-** or "%s" if not present. Fmt should
-** only produce one string-valued result.
-** Hname: value Define header with field-name 'name'
-** and value as specified; this will be
-** macro expanded immediately before
-** use.
-** Sn Use rewriting set n.
-** Rlhs rhs Rewrite addresses that match lhs to
-** be rhs.
-** Mn arg=val... Define mailer. n is the internal name.
-** Args specify mailer parameters.
-** Oxvalue Set option x to value.
-** Pname=value Set precedence name to value.
-** Vversioncode[/vendorcode]
-** Version level/vendor name of
-** configuration syntax.
-** Kmapname mapclass arguments....
-** Define keyed lookup of a given class.
-** Arguments are class dependent.
-** Eenvar=value Set the environment value to the given value.
-**
-** Parameters:
-** cfname -- configuration file name.
-** safe -- TRUE if this is the system config file;
-** FALSE otherwise.
-** e -- the main envelope.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Builds several internal tables.
-*/
-
-void
-readcf(cfname, safe, e)
- char *cfname;
- bool safe;
- register ENVELOPE *e;
-{
- FILE *cf;
- int ruleset = 0;
- char *q;
- struct rewrite *rwp = NULL;
- char *bp;
- auto char *ep;
- int nfuzzy;
- char *file;
- bool optional;
- int mid;
- register char *p;
- int sff = SFF_OPENASROOT;
- struct stat statb;
- char buf[MAXLINE];
- char exbuf[MAXLINE];
- char pvpbuf[MAXLINE + MAXATOM];
- static char *null_list[1] = { NULL };
- extern char **copyplist __P((char **, bool));
- extern char *munchstring __P((char *, char **, int));
- extern void fileclass __P((int, char *, char *, bool, bool));
- extern void toomany __P((int, int));
- extern void translate_dollars __P((char *));
- extern void inithostmaps __P((void));
-
- FileName = cfname;
- LineNumber = 0;
-
- if (DontLockReadFiles)
- sff |= SFF_NOLOCK;
- cf = safefopen(cfname, O_RDONLY, 0444, sff);
- if (cf == NULL)
- {
- syserr("cannot open");
- finis(FALSE, EX_OSFILE);
- }
-
- if (fstat(fileno(cf), &statb) < 0)
- {
- syserr("cannot fstat");
- finis(FALSE, EX_OSFILE);
- }
-
- if (!S_ISREG(statb.st_mode))
- {
- syserr("not a plain file");
- finis(FALSE, EX_OSFILE);
- }
-
- if (OpMode != MD_TEST && bitset(S_IWGRP|S_IWOTH, statb.st_mode))
- {
- if (OpMode == MD_DAEMON || OpMode == MD_INITALIAS)
- fprintf(stderr, "%s: WARNING: dangerous write permissions\n",
- FileName);
- if (LogLevel > 0)
- sm_syslog(LOG_CRIT, NOQID,
- "%s: WARNING: dangerous write permissions",
- FileName);
- }
-
-#ifdef XLA
- xla_zero();
-#endif
-
- while ((bp = fgetfolded(buf, sizeof buf, cf)) != NULL)
- {
- if (bp[0] == '#')
- {
- if (bp != buf)
- free(bp);
- continue;
- }
-
- /* do macro expansion mappings */
- translate_dollars(bp);
-
- /* interpret this line */
- errno = 0;
- switch (bp[0])
- {
- case '\0':
- case '#': /* comment */
- break;
-
- case 'R': /* rewriting rule */
- for (p = &bp[1]; *p != '\0' && *p != '\t'; p++)
- continue;
-
- if (*p == '\0')
- {
- syserr("invalid rewrite line \"%s\" (tab expected)", bp);
- break;
- }
-
- /* allocate space for the rule header */
- if (rwp == NULL)
- {
- RewriteRules[ruleset] = rwp =
- (struct rewrite *) xalloc(sizeof *rwp);
- }
- else
- {
- rwp->r_next = (struct rewrite *) xalloc(sizeof *rwp);
- rwp = rwp->r_next;
- }
- rwp->r_next = NULL;
-
- /* expand and save the LHS */
- *p = '\0';
- expand(&bp[1], exbuf, sizeof exbuf, e);
- rwp->r_lhs = prescan(exbuf, '\t', pvpbuf,
- sizeof pvpbuf, NULL, NULL);
- nfuzzy = 0;
- if (rwp->r_lhs != NULL)
- {
- register char **ap;
-
- rwp->r_lhs = copyplist(rwp->r_lhs, TRUE);
-
- /* count the number of fuzzy matches in LHS */
- for (ap = rwp->r_lhs; *ap != NULL; ap++)
- {
- char *botch;
-
- botch = NULL;
- switch (**ap & 0377)
- {
- case MATCHZANY:
- case MATCHANY:
- case MATCHONE:
- case MATCHCLASS:
- case MATCHNCLASS:
- nfuzzy++;
- break;
-
- case MATCHREPL:
- botch = "$0-$9";
- break;
-
- case CANONUSER:
- botch = "$:";
- break;
-
- case CALLSUBR:
- botch = "$>";
- break;
-
- case CONDIF:
- botch = "$?";
- break;
-
- case CONDFI:
- botch = "$.";
- break;
-
- case HOSTBEGIN:
- botch = "$[";
- break;
-
- case HOSTEND:
- botch = "$]";
- break;
-
- case LOOKUPBEGIN:
- botch = "$(";
- break;
-
- case LOOKUPEND:
- botch = "$)";
- break;
- }
- if (botch != NULL)
- syserr("Inappropriate use of %s on LHS",
- botch);
- }
- }
- else
- {
- syserr("R line: null LHS");
- rwp->r_lhs = null_list;
- }
-
- /* expand and save the RHS */
- while (*++p == '\t')
- continue;
- q = p;
- while (*p != '\0' && *p != '\t')
- p++;
- *p = '\0';
- expand(q, exbuf, sizeof exbuf, e);
- rwp->r_rhs = prescan(exbuf, '\t', pvpbuf,
- sizeof pvpbuf, NULL, NULL);
- if (rwp->r_rhs != NULL)
- {
- register char **ap;
-
- rwp->r_rhs = copyplist(rwp->r_rhs, TRUE);
-
- /* check no out-of-bounds replacements */
- nfuzzy += '0';
- for (ap = rwp->r_rhs; *ap != NULL; ap++)
- {
- char *botch;
-
- botch = NULL;
- switch (**ap & 0377)
- {
- case MATCHREPL:
- if ((*ap)[1] <= '0' || (*ap)[1] > nfuzzy)
- {
- syserr("replacement $%c out of bounds",
- (*ap)[1]);
- }
- break;
-
- case MATCHZANY:
- botch = "$*";
- break;
-
- case MATCHANY:
- botch = "$+";
- break;
-
- case MATCHONE:
- botch = "$-";
- break;
-
- case MATCHCLASS:
- botch = "$=";
- break;
-
- case MATCHNCLASS:
- botch = "$~";
- break;
- }
- if (botch != NULL)
- syserr("Inappropriate use of %s on RHS",
- botch);
- }
- }
- else
- {
- syserr("R line: null RHS");
- rwp->r_rhs = null_list;
- }
- break;
-
- case 'S': /* select rewriting set */
- expand(&bp[1], exbuf, sizeof exbuf, e);
- ruleset = strtorwset(exbuf, NULL, ST_ENTER);
- if (ruleset < 0)
- break;
- rwp = RewriteRules[ruleset];
- if (rwp != NULL)
- {
- if (OpMode == MD_TEST || tTd(37, 1))
- printf("WARNING: Ruleset %s has multiple definitions\n",
- &bp[1]);
- while (rwp->r_next != NULL)
- rwp = rwp->r_next;
- }
- break;
-
- case 'D': /* macro definition */
- mid = macid(&bp[1], &ep);
- p = munchstring(ep, NULL, '\0');
- define(mid, newstr(p), e);
- break;
-
- case 'H': /* required header line */
- (void) chompheader(&bp[1], TRUE, NULL, e);
- break;
-
- case 'C': /* word class */
- case 'T': /* trusted user (set class `t') */
- if (bp[0] == 'C')
- {
- mid = macid(&bp[1], &ep);
- expand(ep, exbuf, sizeof exbuf, e);
- p = exbuf;
- }
- else
- {
- mid = 't';
- p = &bp[1];
- }
- while (*p != '\0')
- {
- register char *wd;
- char delim;
-
- while (*p != '\0' && isascii(*p) && isspace(*p))
- p++;
- wd = p;
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- delim = *p;
- *p = '\0';
- if (wd[0] != '\0')
- setclass(mid, wd);
- *p = delim;
- }
- break;
-
- case 'F': /* word class from file */
- mid = macid(&bp[1], &ep);
- for (p = ep; isascii(*p) && isspace(*p); )
- p++;
- if (p[0] == '-' && p[1] == 'o')
- {
- optional = TRUE;
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- while (isascii(*p) && isspace(*p))
- p++;
- }
- else
- optional = FALSE;
- file = p;
- if (*file == '|')
- p = "%s";
- else
- {
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- if (*p == '\0')
- p = "%s";
- else
- {
- *p = '\0';
- while (isascii(*++p) && isspace(*p))
- continue;
- }
- }
- fileclass(mid, file, p, safe, optional);
- break;
-
-#ifdef XLA
- case 'L': /* extended load average description */
- xla_init(&bp[1]);
- break;
-#endif
-
-#if defined(SUN_EXTENSIONS) && defined(SUN_LOOKUP_MACRO)
- case 'L': /* lookup macro */
- case 'G': /* lookup class */
- /* reserved for Sun -- NIS+ database lookup */
- if (VendorCode != VENDOR_SUN)
- goto badline;
- sun_lg_config_line(bp, e);
- break;
-#endif
-
- case 'M': /* define mailer */
- makemailer(&bp[1]);
- break;
-
- case 'O': /* set option */
- setoption(bp[1], &bp[2], safe, FALSE, e);
- break;
-
- case 'P': /* set precedence */
- if (NumPriorities >= MAXPRIORITIES)
- {
- toomany('P', MAXPRIORITIES);
- break;
- }
- for (p = &bp[1]; *p != '\0' && *p != '='; p++)
- continue;
- if (*p == '\0')
- goto badline;
- *p = '\0';
- Priorities[NumPriorities].pri_name = newstr(&bp[1]);
- Priorities[NumPriorities].pri_val = atoi(++p);
- NumPriorities++;
- break;
-
- case 'V': /* configuration syntax version */
- for (p = &bp[1]; isascii(*p) && isspace(*p); p++)
- continue;
- if (!isascii(*p) || !isdigit(*p))
- {
- syserr("invalid argument to V line: \"%.20s\"",
- &bp[1]);
- break;
- }
- ConfigLevel = strtol(p, &ep, 10);
-
- /*
- ** Do heuristic tweaking for back compatibility.
- */
-
- if (ConfigLevel >= 5)
- {
- /* level 5 configs have short name in $w */
- p = macvalue('w', e);
- if (p != NULL && (p = strchr(p, '.')) != NULL)
- *p = '\0';
- define('w', macvalue('w', e), e);
- }
- if (ConfigLevel >= 6)
- {
- ColonOkInAddr = FALSE;
- }
-
- /*
- ** Look for vendor code.
- */
-
- if (*ep++ == '/')
- {
- extern bool setvendor __P((char *));
-
- /* extract vendor code */
- for (p = ep; isascii(*p) && isalpha(*p); )
- p++;
- *p = '\0';
-
- if (!setvendor(ep))
- syserr("invalid V line vendor code: \"%s\"",
- ep);
- }
- break;
-
- case 'K':
- expand(&bp[1], exbuf, sizeof exbuf, e);
- (void) makemapentry(exbuf);
- break;
-
- case 'E':
- p = strchr(bp, '=');
- if (p != NULL)
- *p++ = '\0';
- setuserenv(&bp[1], p);
- break;
-
- default:
- badline:
- syserr("unknown configuration line \"%s\"", bp);
- }
- if (bp != buf)
- free(bp);
- }
- if (ferror(cf))
- {
- syserr("I/O read error");
- finis(FALSE, EX_OSFILE);
- }
- fclose(cf);
- FileName = NULL;
-
- /* initialize host maps from local service tables */
- inithostmaps();
-
- /* determine if we need to do special name-server frotz */
- {
- int nmaps;
- char *maptype[MAXMAPSTACK];
- short mapreturn[MAXMAPACTIONS];
-
- nmaps = switch_map_find("hosts", maptype, mapreturn);
- UseNameServer = FALSE;
- if (nmaps > 0 && nmaps <= MAXMAPSTACK)
- {
- register int mapno;
-
- for (mapno = 0; mapno < nmaps && !UseNameServer; mapno++)
- {
- if (strcmp(maptype[mapno], "dns") == 0)
- UseNameServer = TRUE;
- }
- }
-
-#ifdef HESIOD
- nmaps = switch_map_find("passwd", maptype, mapreturn);
- UseHesiod = FALSE;
- if (nmaps > 0 && nmaps <= MAXMAPSTACK)
- {
- register int mapno;
-
- for (mapno = 0; mapno < nmaps && !UseHesiod; mapno++)
- {
- if (strcmp(maptype[mapno], "hesiod") == 0)
- UseHesiod = TRUE;
- }
- }
-#endif
- }
-}
-\f/*
-** TRANSLATE_DOLLARS -- convert $x into internal form
-**
-** Actually does all appropriate pre-processing of a config line
-** to turn it into internal form.
-**
-** Parameters:
-** bp -- the buffer to translate.
-**
-** Returns:
-** None. The buffer is translated in place. Since the
-** translations always make the buffer shorter, this is
-** safe without a size parameter.
-*/
-
-void
-translate_dollars(bp)
- char *bp;
-{
- register char *p;
- auto char *ep;
-
- for (p = bp; *p != '\0'; p++)
- {
- if (*p == '#' && p > bp && ConfigLevel >= 3)
- {
- /* this is an on-line comment */
- register char *e;
-
- switch (*--p & 0377)
- {
- case MACROEXPAND:
- /* it's from $# -- let it go through */
- p++;
- break;
-
- case '\\':
- /* it's backslash escaped */
- (void) strcpy(p, p + 1);
- break;
-
- default:
- /* delete preceeding white space */
- while (isascii(*p) && isspace(*p) &&
- *p != '\n' && p > bp)
- p--;
- if ((e = strchr(++p, '\n')) != NULL)
- (void) strcpy(p, e);
- else
- *p-- = '\0';
- break;
- }
- continue;
- }
-
- if (*p != '$' || p[1] == '\0')
- continue;
-
- if (p[1] == '$')
- {
- /* actual dollar sign.... */
- (void) strcpy(p, p + 1);
- continue;
- }
-
- /* convert to macro expansion character */
- *p++ = MACROEXPAND;
-
- /* special handling for $=, $~, $&, and $? */
- if (*p == '=' || *p == '~' || *p == '&' || *p == '?')
- p++;
-
- /* convert macro name to code */
- *p = macid(p, &ep);
- if (ep != p)
- strcpy(p + 1, ep);
- }
-
- /* strip trailing white space from the line */
- while (--p > bp && isascii(*p) && isspace(*p))
- *p = '\0';
-}
-\f/*
-** TOOMANY -- signal too many of some option
-**
-** Parameters:
-** id -- the id of the error line
-** maxcnt -- the maximum possible values
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** gives a syserr.
-*/
-
-void
-toomany(id, maxcnt)
- int id;
- int maxcnt;
-{
- syserr("too many %c lines, %d max", id, maxcnt);
-}
-\f/*
-** FILECLASS -- read members of a class from a file
-**
-** Parameters:
-** class -- class to define.
-** filename -- name of file to read.
-** fmt -- scanf string to use for match.
-** safe -- if set, this is a safe read.
-** optional -- if set, it is not an error for the file to
-** not exist.
-**
-** Returns:
-** none
-**
-** Side Effects:
-**
-** puts all lines in filename that match a scanf into
-** the named class.
-*/
-
-void
-fileclass(class, filename, fmt, safe, optional)
- int class;
- char *filename;
- char *fmt;
- bool safe;
- bool optional;
-{
- FILE *f;
- int sff;
- pid_t pid;
- register char *p;
- char buf[MAXLINE];
-
- if (tTd(37, 2))
- printf("fileclass(%s, fmt=%s)\n", filename, fmt);
-
- if (filename[0] == '|')
- {
- auto int fd;
- int i;
- char *argv[MAXPV + 1];
-
- i = 0;
- for (p = strtok(&filename[1], " \t"); p != NULL; p = strtok(NULL, " \t"))
- {
- if (i >= MAXPV)
- break;
- argv[i++] = p;
- }
- argv[i] = NULL;
- pid = prog_open(argv, &fd, CurEnv);
- if (pid < 0)
- f = NULL;
- else
- f = fdopen(fd, "r");
- }
- else
- {
- pid = -1;
- sff = SFF_REGONLY;
- if (!bitset(DBS_CLASSFILEINUNSAFEDIRPATH, DontBlameSendmail))
- sff |= SFF_SAFEDIRPATH;
- if (!bitset(DBS_LINKEDCLASSFILEINWRITABLEDIR, DontBlameSendmail))
- sff |= SFF_NOWLINK;
- if (safe)
- sff |= SFF_OPENASROOT;
- if (DontLockReadFiles)
- sff |= SFF_NOLOCK;
- f = safefopen(filename, O_RDONLY, 0, sff);
- }
- if (f == NULL)
- {
- if (!optional)
- syserr("fileclass: cannot open %s", filename);
- return;
- }
-
- while (fgets(buf, sizeof buf, f) != NULL)
- {
- register char *p;
-# if SCANF
- char wordbuf[MAXLINE + 1];
-# endif
-
- if (buf[0] == '#')
- continue;
-# if SCANF
- if (sscanf(buf, fmt, wordbuf) != 1)
- continue;
- p = wordbuf;
-# else /* SCANF */
- p = buf;
-# endif /* SCANF */
-
- /*
- ** Break up the match into words.
- */
-
- while (*p != '\0')
- {
- register char *q;
-
- /* strip leading spaces */
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p == '\0')
- break;
-
- /* find the end of the word */
- q = p;
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- if (*p != '\0')
- *p++ = '\0';
-
- /* enter the word in the symbol table */
- setclass(class, q);
- }
- }
-
- (void) fclose(f);
- if (pid > 0)
- (void) waitfor(pid);
-}
-\f/*
-** MAKEMAILER -- define a new mailer.
-**
-** Parameters:
-** line -- description of mailer. This is in labeled
-** fields. The fields are:
-** A -- the argv for this mailer
-** C -- the character set for MIME conversions
-** D -- the directory to run in
-** E -- the eol string
-** F -- the flags associated with the mailer
-** L -- the maximum line length
-** M -- the maximum message size
-** N -- the niceness at which to run
-** P -- the path to the mailer
-** R -- the recipient rewriting set
-** S -- the sender rewriting set
-** T -- the mailer type (for DSNs)
-** U -- the uid to run as
-** The first word is the canonical name of the mailer.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** enters the mailer into the mailer table.
-*/
-
-void
-makemailer(line)
- char *line;
-{
- register char *p;
- register struct mailer *m;
- register STAB *s;
- int i;
- char fcode;
- auto char *endp;
- extern int NextMailer;
- extern char **makeargv __P((char *));
- extern char *munchstring __P((char *, char **, int));
-
- /* allocate a mailer and set up defaults */
- m = (struct mailer *) xalloc(sizeof *m);
- bzero((char *) m, sizeof *m);
-
- /* collect the mailer name */
- for (p = line; *p != '\0' && *p != ',' && !(isascii(*p) && isspace(*p)); p++)
- continue;
- if (*p != '\0')
- *p++ = '\0';
- if (line[0] == '\0')
- syserr("name required for mailer");
- m->m_name = newstr(line);
-
- /* now scan through and assign info from the fields */
- while (*p != '\0')
- {
- auto char *delimptr;
-
- while (*p != '\0' && (*p == ',' || (isascii(*p) && isspace(*p))))
- p++;
-
- /* p now points to field code */
- fcode = *p;
- while (*p != '\0' && *p != '=' && *p != ',')
- p++;
- if (*p++ != '=')
- {
- syserr("mailer %s: `=' expected", m->m_name);
- return;
- }
- while (isascii(*p) && isspace(*p))
- p++;
-
- /* p now points to the field body */
- p = munchstring(p, &delimptr, ',');
-
- /* install the field into the mailer struct */
- switch (fcode)
- {
- case 'P': /* pathname */
- if (*p == '\0')
- syserr("mailer %s: empty path name", m->m_name);
- m->m_mailer = newstr(p);
- break;
-
- case 'F': /* flags */
- for (; *p != '\0'; p++)
- if (!(isascii(*p) && isspace(*p)))
- setbitn(*p, m->m_flags);
- break;
-
- case 'S': /* sender rewriting ruleset */
- case 'R': /* recipient rewriting ruleset */
- i = strtorwset(p, &endp, ST_ENTER);
- if (i < 0)
- return;
- if (fcode == 'S')
- m->m_sh_rwset = m->m_se_rwset = i;
- else
- m->m_rh_rwset = m->m_re_rwset = i;
-
- p = endp;
- if (*p++ == '/')
- {
- i = strtorwset(p, NULL, ST_ENTER);
- if (i < 0)
- return;
- if (fcode == 'S')
- m->m_sh_rwset = i;
- else
- m->m_rh_rwset = i;
- }
- break;
-
- case 'E': /* end of line string */
- if (*p == '\0')
- syserr("mailer %s: null end-of-line string",
- m->m_name);
- m->m_eol = newstr(p);
- break;
-
- case 'A': /* argument vector */
- if (*p == '\0')
- syserr("mailer %s: null argument vector",
- m->m_name);
- m->m_argv = makeargv(p);
- break;
-
- case 'M': /* maximum message size */
- m->m_maxsize = atol(p);
- break;
-
- case 'L': /* maximum line length */
- m->m_linelimit = atoi(p);
- if (m->m_linelimit < 0)
- m->m_linelimit = 0;
- break;
-
- case 'N': /* run niceness */
- m->m_nice = atoi(p);
- break;
-
- case 'D': /* working directory */
- if (*p == '\0')
- syserr("mailer %s: null working directory",
- m->m_name);
- m->m_execdir = newstr(p);
- break;
-
- case 'C': /* default charset */
- if (*p == '\0')
- syserr("mailer %s: null charset", m->m_name);
- m->m_defcharset = newstr(p);
- break;
-
- case 'T': /* MTA-Name/Address/Diagnostic types */
- /* extract MTA name type; default to "dns" */
- m->m_mtatype = newstr(p);
- p = strchr(m->m_mtatype, '/');
- if (p != NULL)
- {
- *p++ = '\0';
- if (*p == '\0')
- p = NULL;
- }
- if (*m->m_mtatype == '\0')
- m->m_mtatype = "dns";
-
- /* extract address type; default to "rfc822" */
- m->m_addrtype = p;
- if (p != NULL)
- p = strchr(p, '/');
- if (p != NULL)
- {
- *p++ = '\0';
- if (*p == '\0')
- p = NULL;
- }
- if (m->m_addrtype == NULL || *m->m_addrtype == '\0')
- m->m_addrtype = "rfc822";
-
- /* extract diagnostic type; default to "smtp" */
- m->m_diagtype = p;
- if (m->m_diagtype == NULL || *m->m_diagtype == '\0')
- m->m_diagtype = "smtp";
- break;
-
- case 'U': /* user id */
- if (isascii(*p) && !isdigit(*p))
- {
- char *q = p;
- struct passwd *pw;
-
- while (*p != '\0' && isascii(*p) &&
- (isalnum(*p) || strchr("-_", *p) != NULL))
- p++;
- while (isascii(*p) && isspace(*p))
- *p++ = '\0';
- if (*p != '\0')
- *p++ = '\0';
- if (*q == '\0')
- syserr("mailer %s: null user name",
- m->m_name);
- pw = sm_getpwnam(q);
- if (pw == NULL)
- syserr("readcf: mailer U= flag: unknown user %s", q);
- else
- {
- m->m_uid = pw->pw_uid;
- m->m_gid = pw->pw_gid;
- }
- }
- else
- {
- auto char *q;
-
- m->m_uid = strtol(p, &q, 0);
- p = q;
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p != '\0')
- p++;
- }
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p == '\0')
- break;
- if (isascii(*p) && !isdigit(*p))
- {
- char *q = p;
- struct group *gr;
-
- while (isascii(*p) && isalnum(*p))
- p++;
- *p++ = '\0';
- if (*q == '\0')
- syserr("mailer %s: null group name",
- m->m_name);
- gr = getgrnam(q);
- if (gr == NULL)
- syserr("readcf: mailer U= flag: unknown group %s", q);
- else
- m->m_gid = gr->gr_gid;
- }
- else
- {
- m->m_gid = strtol(p, NULL, 0);
- }
- break;
- }
-
- p = delimptr;
- }
-
- /* do some rationality checking */
- if (m->m_argv == NULL)
- {
- syserr("M%s: A= argument required", m->m_name);
- return;
- }
- if (m->m_mailer == NULL)
- {
- syserr("M%s: P= argument required", m->m_name);
- return;
- }
-
- if (NextMailer >= MAXMAILERS)
- {
- syserr("too many mailers defined (%d max)", MAXMAILERS);
- return;
- }
-
- /* do some heuristic cleanup for back compatibility */
- if (bitnset(M_LIMITS, m->m_flags))
- {
- if (m->m_linelimit == 0)
- m->m_linelimit = SMTPLINELIM;
- if (ConfigLevel < 2)
- setbitn(M_7BITS, m->m_flags);
- }
-
- if (strcmp(m->m_mailer, "[IPC]") == 0 ||
- strcmp(m->m_mailer, "[TCP]") == 0)
- {
- if (m->m_mtatype == NULL)
- m->m_mtatype = "dns";
- if (m->m_addrtype == NULL)
- m->m_addrtype = "rfc822";
- if (m->m_diagtype == NULL)
- m->m_diagtype = "smtp";
- }
-
- if (strcmp(m->m_mailer, "[FILE]") == 0)
- {
- /* Use the second argument for filename */
- if (m->m_argv[0] == NULL || m->m_argv[1] == NULL ||
- m->m_argv[2] != NULL)
- {
- syserr("M%s: too %s parameters for [FILE] mailer",
- m->m_name,
- (m->m_argv[0] == NULL ||
- m->m_argv[1] == NULL) ? "few" : "many");
- }
- else if (strcmp(m->m_argv[0], "FILE") != 0)
- {
- syserr("M%s: first argument in [FILE] mailer must be FILE",
- m->m_name);
- }
- }
-
- if (m->m_eol == NULL)
- {
- char **pp;
-
- /* default for SMTP is \r\n; use \n for local delivery */
- for (pp = m->m_argv; *pp != NULL; pp++)
- {
- char *p;
-
- for (p = *pp; *p != '\0'; )
- {
- if ((*p++ & 0377) == MACROEXPAND && *p == 'u')
- break;
- }
- if (*p != '\0')
- break;
- }
- if (*pp == NULL)
- m->m_eol = "\r\n";
- else
- m->m_eol = "\n";
- }
-
- /* enter the mailer into the symbol table */
- s = stab(m->m_name, ST_MAILER, ST_ENTER);
- if (s->s_mailer != NULL)
- {
- i = s->s_mailer->m_mno;
- free(s->s_mailer);
- }
- else
- {
- i = NextMailer++;
- }
- Mailer[i] = s->s_mailer = m;
- m->m_mno = i;
-}
-\f/*
-** MUNCHSTRING -- translate a string into internal form.
-**
-** Parameters:
-** p -- the string to munch.
-** delimptr -- if non-NULL, set to the pointer of the
-** field delimiter character.
-** delim -- the delimiter for the field.
-**
-** Returns:
-** the munched string.
-*/
-
-char *
-munchstring(p, delimptr, delim)
- register char *p;
- char **delimptr;
- int delim;
-{
- register char *q;
- bool backslash = FALSE;
- bool quotemode = FALSE;
- static char buf[MAXLINE];
-
- for (q = buf; *p != '\0' && q < &buf[sizeof buf - 1]; p++)
- {
- if (backslash)
- {
- /* everything is roughly literal */
- backslash = FALSE;
- switch (*p)
- {
- case 'r': /* carriage return */
- *q++ = '\r';
- continue;
-
- case 'n': /* newline */
- *q++ = '\n';
- continue;
-
- case 'f': /* form feed */
- *q++ = '\f';
- continue;
-
- case 'b': /* backspace */
- *q++ = '\b';
- continue;
- }
- *q++ = *p;
- }
- else
- {
- if (*p == '\\')
- backslash = TRUE;
- else if (*p == '"')
- quotemode = !quotemode;
- else if (quotemode || *p != delim)
- *q++ = *p;
- else
- break;
- }
- }
-
- if (delimptr != NULL)
- *delimptr = p;
- *q++ = '\0';
- return (buf);
-}
-\f/*
-** MAKEARGV -- break up a string into words
-**
-** Parameters:
-** p -- the string to break up.
-**
-** Returns:
-** a char **argv (dynamically allocated)
-**
-** Side Effects:
-** munges p.
-*/
-
-char **
-makeargv(p)
- register char *p;
-{
- char *q;
- int i;
- char **avp;
- char *argv[MAXPV + 1];
-
- /* take apart the words */
- i = 0;
- while (*p != '\0' && i < MAXPV)
- {
- q = p;
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- while (isascii(*p) && isspace(*p))
- *p++ = '\0';
- argv[i++] = newstr(q);
- }
- argv[i++] = NULL;
-
- /* now make a copy of the argv */
- avp = (char **) xalloc(sizeof *avp * i);
- bcopy((char *) argv, (char *) avp, sizeof *avp * i);
-
- return (avp);
-}
-\f/*
-** PRINTRULES -- print rewrite rules (for debugging)
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** prints rewrite rules.
-*/
-
-void
-printrules()
-{
- register struct rewrite *rwp;
- register int ruleset;
-
- for (ruleset = 0; ruleset < 10; ruleset++)
- {
- if (RewriteRules[ruleset] == NULL)
- continue;
- printf("\n----Rule Set %d:", ruleset);
-
- for (rwp = RewriteRules[ruleset]; rwp != NULL; rwp = rwp->r_next)
- {
- printf("\nLHS:");
- printav(rwp->r_lhs);
- printf("RHS:");
- printav(rwp->r_rhs);
- }
- }
-}
-\f/*
-** PRINTMAILER -- print mailer structure (for debugging)
-**
-** Parameters:
-** m -- the mailer to print
-**
-** Returns:
-** none.
-*/
-
-void
-printmailer(m)
- register MAILER *m;
-{
- int j;
-
- printf("mailer %d (%s): P=%s S=%d/%d R=%d/%d M=%ld U=%d:%d F=",
- m->m_mno, m->m_name,
- m->m_mailer, m->m_se_rwset, m->m_sh_rwset,
- m->m_re_rwset, m->m_rh_rwset, m->m_maxsize,
- (int) m->m_uid, (int) m->m_gid);
- for (j = '\0'; j <= '\177'; j++)
- if (bitnset(j, m->m_flags))
- (void) putchar(j);
- printf(" L=%d E=", m->m_linelimit);
- xputs(m->m_eol);
- if (m->m_defcharset != NULL)
- printf(" C=%s", m->m_defcharset);
- printf(" T=%s/%s/%s",
- m->m_mtatype == NULL ? "<undefined>" : m->m_mtatype,
- m->m_addrtype == NULL ? "<undefined>" : m->m_addrtype,
- m->m_diagtype == NULL ? "<undefined>" : m->m_diagtype);
- if (m->m_argv != NULL)
- {
- char **a = m->m_argv;
-
- printf(" A=");
- while (*a != NULL)
- {
- if (a != m->m_argv)
- printf(" ");
- xputs(*a++);
- }
- }
- printf("\n");
-}
-\f/*
-** SETOPTION -- set global processing option
-**
-** Parameters:
-** opt -- option name.
-** val -- option value (as a text string).
-** safe -- set if this came from a configuration file.
-** Some options (if set from the command line) will
-** reset the user id to avoid security problems.
-** sticky -- if set, don't let other setoptions override
-** this value.
-** e -- the main envelope.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Sets options as implied by the arguments.
-*/
-
-static BITMAP StickyOpt; /* set if option is stuck */
-extern void settimeout __P((char *, char *));
-
-
-#if NAMED_BIND
-
-struct resolverflags
-{
- char *rf_name; /* name of the flag */
- long rf_bits; /* bits to set/clear */
-} ResolverFlags[] =
-{
- { "debug", RES_DEBUG },
- { "aaonly", RES_AAONLY },
- { "usevc", RES_USEVC },
- { "primary", RES_PRIMARY },
- { "igntc", RES_IGNTC },
- { "recurse", RES_RECURSE },
- { "defnames", RES_DEFNAMES },
- { "stayopen", RES_STAYOPEN },
- { "dnsrch", RES_DNSRCH },
- { "true", 0 }, /* avoid error on old syntax */
- { NULL, 0 }
-};
-
-#endif
-
-struct optioninfo
-{
- char *o_name; /* long name of option */
- u_char o_code; /* short name of option */
- bool o_safe; /* safe for random people to use */
-} OptionTab[] =
-{
- { "SevenBitInput", '7', TRUE },
-#if MIME8TO7
- { "EightBitMode", '8', TRUE },
-#endif
- { "AliasFile", 'A', FALSE },
- { "AliasWait", 'a', FALSE },
- { "BlankSub", 'B', FALSE },
- { "MinFreeBlocks", 'b', TRUE },
- { "CheckpointInterval", 'C', TRUE },
- { "HoldExpensive", 'c', FALSE },
- { "AutoRebuildAliases", 'D', FALSE },
- { "DeliveryMode", 'd', TRUE },
- { "ErrorHeader", 'E', FALSE },
- { "ErrorMode", 'e', TRUE },
- { "TempFileMode", 'F', FALSE },
- { "SaveFromLine", 'f', FALSE },
- { "MatchGECOS", 'G', FALSE },
- { "HelpFile", 'H', FALSE },
- { "MaxHopCount", 'h', FALSE },
- { "ResolverOptions", 'I', FALSE },
- { "IgnoreDots", 'i', TRUE },
- { "ForwardPath", 'J', FALSE },
- { "SendMimeErrors", 'j', TRUE },
- { "ConnectionCacheSize", 'k', FALSE },
- { "ConnectionCacheTimeout", 'K', FALSE },
- { "UseErrorsTo", 'l', FALSE },
- { "LogLevel", 'L', TRUE },
- { "MeToo", 'm', TRUE },
- { "CheckAliases", 'n', FALSE },
- { "OldStyleHeaders", 'o', TRUE },
- { "DaemonPortOptions", 'O', FALSE },
- { "PrivacyOptions", 'p', TRUE },
- { "PostmasterCopy", 'P', FALSE },
- { "QueueFactor", 'q', FALSE },
- { "QueueDirectory", 'Q', FALSE },
- { "DontPruneRoutes", 'R', FALSE },
- { "Timeout", 'r', FALSE },
- { "StatusFile", 'S', FALSE },
- { "SuperSafe", 's', TRUE },
- { "QueueTimeout", 'T', FALSE },
- { "TimeZoneSpec", 't', FALSE },
- { "UserDatabaseSpec", 'U', FALSE },
- { "DefaultUser", 'u', FALSE },
- { "FallbackMXhost", 'V', FALSE },
- { "Verbose", 'v', TRUE },
- { "TryNullMXList", 'w', FALSE },
- { "QueueLA", 'x', FALSE },
- { "RefuseLA", 'X', FALSE },
- { "RecipientFactor", 'y', FALSE },
- { "ForkEachJob", 'Y', FALSE },
- { "ClassFactor", 'z', FALSE },
- { "RetryFactor", 'Z', FALSE },
-#define O_QUEUESORTORD 0x81
- { "QueueSortOrder", O_QUEUESORTORD, TRUE },
-#define O_HOSTSFILE 0x82
- { "HostsFile", O_HOSTSFILE, FALSE },
-#define O_MQA 0x83
- { "MinQueueAge", O_MQA, TRUE },
-#define O_DEFCHARSET 0x85
- { "DefaultCharSet", O_DEFCHARSET, TRUE },
-#define O_SSFILE 0x86
- { "ServiceSwitchFile", O_SSFILE, FALSE },
-#define O_DIALDELAY 0x87
- { "DialDelay", O_DIALDELAY, TRUE },
-#define O_NORCPTACTION 0x88
- { "NoRecipientAction", O_NORCPTACTION, TRUE },
-#define O_SAFEFILEENV 0x89
- { "SafeFileEnvironment", O_SAFEFILEENV, FALSE },
-#define O_MAXMSGSIZE 0x8a
- { "MaxMessageSize", O_MAXMSGSIZE, FALSE },
-#define O_COLONOKINADDR 0x8b
- { "ColonOkInAddr", O_COLONOKINADDR, TRUE },
-#define O_MAXQUEUERUN 0x8c
- { "MaxQueueRunSize", O_MAXQUEUERUN, TRUE },
-#define O_MAXCHILDREN 0x8d
- { "MaxDaemonChildren", O_MAXCHILDREN, FALSE },
-#define O_KEEPCNAMES 0x8e
- { "DontExpandCnames", O_KEEPCNAMES, FALSE },
-#define O_MUSTQUOTE 0x8f
- { "MustQuoteChars", O_MUSTQUOTE, FALSE },
-#define O_SMTPGREETING 0x90
- { "SmtpGreetingMessage", O_SMTPGREETING, FALSE },
-#define O_UNIXFROM 0x91
- { "UnixFromLine", O_UNIXFROM, FALSE },
-#define O_OPCHARS 0x92
- { "OperatorChars", O_OPCHARS, FALSE },
-#define O_DONTINITGRPS 0x93
- { "DontInitGroups", O_DONTINITGRPS, FALSE },
-#define O_SLFH 0x94
- { "SingleLineFromHeader", O_SLFH, TRUE },
-#define O_ABH 0x95
- { "AllowBogusHELO", O_ABH, TRUE },
-#define O_CONNTHROT 0x97
- { "ConnectionRateThrottle", O_CONNTHROT, FALSE },
-#define O_UGW 0x99
- { "UnsafeGroupWrites", O_UGW, FALSE },
-#define O_DBLBOUNCE 0x9a
- { "DoubleBounceAddress", O_DBLBOUNCE, FALSE },
-#define O_HSDIR 0x9b
- { "HostStatusDirectory", O_HSDIR, FALSE },
-#define O_SINGTHREAD 0x9c
- { "SingleThreadDelivery", O_SINGTHREAD, FALSE },
-#define O_RUNASUSER 0x9d
- { "RunAsUser", O_RUNASUSER, FALSE },
-#if _FFR_DSN_RRT_OPTION
-#define O_DSN_RRT 0x9e
- { "RrtImpliesDsn", O_DSN_RRT, FALSE },
-#endif
-#if _FFR_PIDFILE_OPTION
-#define O_PIDFILE 0x9f
- { "PidFile", O_PIDFILE, FALSE },
-#endif
-#define O_DONTBLAMESENDMAIL 0xa0
- { "DontBlameSendmail", O_DONTBLAMESENDMAIL, FALSE },
-#define O_DPI 0xa1
- { "DontProbeInterfaces", O_DPI, FALSE },
-#define O_MAXRCPT 0xa2
- { "MaxRecipientsPerMessage", O_MAXRCPT, FALSE },
-#if _FFR_DEADLETTERDROP_OPTION
-#define O_DEADLETTER 0xa3
- { "DeadLetterDrop", O_DEADLETTER, FALSE },
-#endif
-#if _FFR_DONTLOCKFILESFORREAD_OPTION
-#define O_DONTLOCK 0xa4
- { "DontLockFilesForRead", O_DONTLOCK, FALSE },
-#endif
-#if _FFR_MAXALIASRECURSION_OPTION
-#define O_MAXALIASRCSN 0xa5
- { "MaxAliasRecursion", O_MAXALIASRCSN, FALSE },
-#endif
-#if _FFR_CONNECTONLYTO_OPTION
-#define O_CNCTONLYTO 0xa6
- { "ConnectOnlyTo", O_CNCTONLYTO, FALSE },
-#endif
-#if _FFR_TRUSTED_USER
-#define O_TRUSTUSER 0xa7
- { "TrustedUser", O_TRUSTUSER, FALSE },
-#endif
-#if _FFR_MAX_MIME_HEADER_LENGTH
-#define O_MAXMIMEHDRLEN 0xa8
- { "MaxMimeHeaderLength", O_MAXMIMEHDRLEN, FALSE },
-#endif
-#if _FFR_CONTROL_SOCKET
-#define O_CONTROLSOCKET 0xa9
- { "ControlSocketName", O_CONTROLSOCKET, FALSE },
-#endif
-#if _FFR_MAX_HEADERS_LENGTH
-#define O_MAXHDRSLEN 0xaa
- { "MaxHeadersLength", O_MAXHDRSLEN, FALSE },
-#endif
- { NULL, '\0', FALSE }
-};
-
-
-
-void
-setoption(opt, val, safe, sticky, e)
- int opt;
- char *val;
- bool safe;
- bool sticky;
- register ENVELOPE *e;
-{
- register char *p;
- register struct optioninfo *o;
- char *subopt;
- int mid;
- bool can_setuid = RunAsUid == 0;
- auto char *ep;
- char buf[50];
- extern bool atobool __P((char *));
- extern time_t convtime __P((char *, char));
- extern int QueueLA;
- extern int RefuseLA;
- extern bool Warn_Q_option;
- extern void setalias __P((char *));
- extern int atooct __P((char *));
- extern void setdefuser __P((void));
- extern void setdaemonoptions __P((char *));
-
- errno = 0;
- if (opt == ' ')
- {
- /* full word options */
- struct optioninfo *sel;
-
- p = strchr(val, '=');
- if (p == NULL)
- p = &val[strlen(val)];
- while (*--p == ' ')
- continue;
- while (*++p == ' ')
- *p = '\0';
- if (p == val)
- {
- syserr("readcf: null option name");
- return;
- }
- if (*p == '=')
- *p++ = '\0';
- while (*p == ' ')
- p++;
- subopt = strchr(val, '.');
- if (subopt != NULL)
- *subopt++ = '\0';
- sel = NULL;
- for (o = OptionTab; o->o_name != NULL; o++)
- {
- if (strncasecmp(o->o_name, val, strlen(val)) != 0)
- continue;
- if (strlen(o->o_name) == strlen(val))
- {
- /* completely specified -- this must be it */
- sel = NULL;
- break;
- }
- if (sel != NULL)
- break;
- sel = o;
- }
- if (sel != NULL && o->o_name == NULL)
- o = sel;
- else if (o->o_name == NULL)
- {
- syserr("readcf: unknown option name %s", val);
- return;
- }
- else if (sel != NULL)
- {
- syserr("readcf: ambiguous option name %s (matches %s and %s)",
- val, sel->o_name, o->o_name);
- return;
- }
- if (strlen(val) != strlen(o->o_name))
- {
- int oldVerbose = Verbose;
-
- Verbose = 1;
- message("Option %s used as abbreviation for %s",
- val, o->o_name);
- Verbose = oldVerbose;
- }
- opt = o->o_code;
- val = p;
- }
- else
- {
- for (o = OptionTab; o->o_name != NULL; o++)
- {
- if (o->o_code == opt)
- break;
- }
- subopt = NULL;
- }
-
- if (tTd(37, 1))
- {
- printf(isascii(opt) && isprint(opt) ?
- "setoption %s (%c).%s=" :
- "setoption %s (0x%x).%s=",
- o->o_name == NULL ? "<unknown>" : o->o_name,
- opt,
- subopt == NULL ? "" : subopt);
- xputs(val);
- }
-
- /*
- ** See if this option is preset for us.
- */
-
- if (!sticky && bitnset(opt, StickyOpt))
- {
- if (tTd(37, 1))
- printf(" (ignored)\n");
- return;
- }
-
- /*
- ** Check to see if this option can be specified by this user.
- */
-
- if (!safe && RealUid == 0)
- safe = TRUE;
- if (!safe && !o->o_safe)
- {
- if (opt != 'M' || (val[0] != 'r' && val[0] != 's'))
- {
- if (tTd(37, 1))
- printf(" (unsafe)");
- (void) drop_privileges(TRUE);
- }
- }
- if (tTd(37, 1))
- printf("\n");
-
- switch (opt & 0xff)
- {
- case '7': /* force seven-bit input */
- SevenBitInput = atobool(val);
- break;
-
-#if MIME8TO7
- case '8': /* handling of 8-bit input */
- switch (*val)
- {
- case 'm': /* convert 8-bit, convert MIME */
- MimeMode = MM_CVTMIME|MM_MIME8BIT;
- break;
-
- case 'p': /* pass 8 bit, convert MIME */
- MimeMode = MM_CVTMIME|MM_PASS8BIT;
- break;
-
- case 's': /* strict adherence */
- MimeMode = MM_CVTMIME;
- break;
-
-#if 0
- case 'r': /* reject 8-bit, don't convert MIME */
- MimeMode = 0;
- break;
-
- case 'j': /* "just send 8" */
- MimeMode = MM_PASS8BIT;
- break;
-
- case 'a': /* encode 8 bit if available */
- MimeMode = MM_MIME8BIT|MM_PASS8BIT|MM_CVTMIME;
- break;
-
- case 'c': /* convert 8 bit to MIME, never 7 bit */
- MimeMode = MM_MIME8BIT;
- break;
-#endif
-
- default:
- syserr("Unknown 8-bit mode %c", *val);
- finis(FALSE, EX_USAGE);
- }
- break;
-#endif
-
- case 'A': /* set default alias file */
- if (val[0] == '\0')
- setalias("aliases");
- else
- setalias(val);
- break;
-
- case 'a': /* look N minutes for "@:@" in alias file */
- if (val[0] == '\0')
- SafeAlias = 5 * 60; /* five minutes */
- else
- SafeAlias = convtime(val, 'm');
- break;
-
- case 'B': /* substitution for blank character */
- SpaceSub = val[0];
- if (SpaceSub == '\0')
- SpaceSub = ' ';
- break;
-
- case 'b': /* min blocks free on queue fs/max msg size */
- p = strchr(val, '/');
- if (p != NULL)
- {
- *p++ = '\0';
- MaxMessageSize = atol(p);
- }
- MinBlocksFree = atol(val);
- break;
-
- case 'c': /* don't connect to "expensive" mailers */
- NoConnect = atobool(val);
- break;
-
- case 'C': /* checkpoint every N addresses */
- CheckpointInterval = atoi(val);
- break;
-
- case 'd': /* delivery mode */
- switch (*val)
- {
- case '\0':
- e->e_sendmode = SM_DELIVER;
- break;
-
- case SM_QUEUE: /* queue only */
- case SM_DEFER: /* queue only and defer map lookups */
-#if !QUEUE
- syserr("need QUEUE to set -odqueue or -oddefer");
-#endif /* QUEUE */
- /* fall through..... */
-
- case SM_DELIVER: /* do everything */
- case SM_FORK: /* fork after verification */
- e->e_sendmode = *val;
- break;
-
- default:
- syserr("Unknown delivery mode %c", *val);
- finis(FALSE, EX_USAGE);
- }
- buf[0] = (char)e->e_sendmode;
- buf[1] = '\0';
- define(macid("{deliveryMode}", NULL), newstr(buf), e);
- break;
-
- case 'D': /* rebuild alias database as needed */
- AutoRebuild = atobool(val);
- break;
-
- case 'E': /* error message header/header file */
- if (*val != '\0')
- ErrMsgFile = newstr(val);
- break;
-
- case 'e': /* set error processing mode */
- switch (*val)
- {
- case EM_QUIET: /* be silent about it */
- case EM_MAIL: /* mail back */
- case EM_BERKNET: /* do berknet error processing */
- case EM_WRITE: /* write back (or mail) */
- case EM_PRINT: /* print errors normally (default) */
- e->e_errormode = *val;
- break;
- }
- break;
-
- case 'F': /* file mode */
- FileMode = atooct(val) & 0777;
- break;
-
- case 'f': /* save Unix-style From lines on front */
- SaveFrom = atobool(val);
- break;
-
- case 'G': /* match recipients against GECOS field */
- MatchGecos = atobool(val);
- break;
-
- case 'g': /* default gid */
- g_opt:
- if (isascii(*val) && isdigit(*val))
- DefGid = atoi(val);
- else
- {
- register struct group *gr;
-
- DefGid = -1;
- gr = getgrnam(val);
- if (gr == NULL)
- syserr("readcf: option %c: unknown group %s",
- opt, val);
- else
- DefGid = gr->gr_gid;
- }
- break;
-
- case 'H': /* help file */
- if (val[0] == '\0')
- HelpFile = "sendmail.hf";
- else
- HelpFile = newstr(val);
- break;
-
- case 'h': /* maximum hop count */
- MaxHopCount = atoi(val);
- break;
-
- case 'I': /* use internet domain name server */
-#if NAMED_BIND
- for (p = val; *p != 0; )
- {
- bool clearmode;
- char *q;
- struct resolverflags *rfp;
-
- while (*p == ' ')
- p++;
- if (*p == '\0')
- break;
- clearmode = FALSE;
- if (*p == '-')
- clearmode = TRUE;
- else if (*p != '+')
- p--;
- p++;
- q = p;
- while (*p != '\0' && !(isascii(*p) && isspace(*p)))
- p++;
- if (*p != '\0')
- *p++ = '\0';
- if (strcasecmp(q, "HasWildcardMX") == 0)
- {
- HasWildcardMX = !clearmode;
- continue;
- }
- for (rfp = ResolverFlags; rfp->rf_name != NULL; rfp++)
- {
- if (strcasecmp(q, rfp->rf_name) == 0)
- break;
- }
- if (rfp->rf_name == NULL)
- syserr("readcf: I option value %s unrecognized", q);
- else if (clearmode)
- _res.options &= ~rfp->rf_bits;
- else
- _res.options |= rfp->rf_bits;
- }
- if (tTd(8, 2))
- printf("_res.options = %x, HasWildcardMX = %d\n",
- (u_int) _res.options, HasWildcardMX);
-#else
- usrerr("name server (I option) specified but BIND not compiled in");
-#endif
- break;
-
- case 'i': /* ignore dot lines in message */
- IgnrDot = atobool(val);
- break;
-
- case 'j': /* send errors in MIME (RFC 1341) format */
- SendMIMEErrors = atobool(val);
- break;
-
- case 'J': /* .forward search path */
- ForwardPath = newstr(val);
- break;
-
- case 'k': /* connection cache size */
- MaxMciCache = atoi(val);
- if (MaxMciCache < 0)
- MaxMciCache = 0;
- break;
-
- case 'K': /* connection cache timeout */
- MciCacheTimeout = convtime(val, 'm');
- break;
-
- case 'l': /* use Errors-To: header */
- UseErrorsTo = atobool(val);
- break;
-
- case 'L': /* log level */
- if (safe || LogLevel < atoi(val))
- LogLevel = atoi(val);
- break;
-
- case 'M': /* define macro */
- mid = macid(val, &ep);
- p = newstr(ep);
- if (!safe)
- cleanstrcpy(p, p, MAXNAME);
- define(mid, p, CurEnv);
- sticky = FALSE;
- break;
-
- case 'm': /* send to me too */
- MeToo = atobool(val);
- break;
-
- case 'n': /* validate RHS in newaliases */
- CheckAliases = atobool(val);
- break;
-
- /* 'N' available -- was "net name" */
-
- case 'O': /* daemon options */
-#if DAEMON
- setdaemonoptions(val);
-#else
- syserr("DaemonPortOptions (O option) set but DAEMON not compiled in");
-#endif
- break;
-
- case 'o': /* assume old style headers */
- if (atobool(val))
- CurEnv->e_flags |= EF_OLDSTYLE;
- else
- CurEnv->e_flags &= ~EF_OLDSTYLE;
- break;
-
- case 'p': /* select privacy level */
- p = val;
- for (;;)
- {
- register struct prival *pv;
- extern struct prival PrivacyValues[];
-
- while (isascii(*p) && (isspace(*p) || ispunct(*p)))
- p++;
- if (*p == '\0')
- break;
- val = p;
- while (isascii(*p) && isalnum(*p))
- p++;
- if (*p != '\0')
- *p++ = '\0';
-
- for (pv = PrivacyValues; pv->pv_name != NULL; pv++)
- {
- if (strcasecmp(val, pv->pv_name) == 0)
- break;
- }
- if (pv->pv_name == NULL)
- syserr("readcf: Op line: %s unrecognized", val);
- PrivacyFlags |= pv->pv_flag;
- }
- sticky = FALSE;
- break;
-
- case 'P': /* postmaster copy address for returned mail */
- PostMasterCopy = newstr(val);
- break;
-
- case 'q': /* slope of queue only function */
- QueueFactor = atoi(val);
- break;
-
- case 'Q': /* queue directory */
- if (val[0] == '\0')
- QueueDir = "mqueue";
- else
- QueueDir = newstr(val);
- if (RealUid != 0 && !safe)
- Warn_Q_option = TRUE;
- break;
-
- case 'R': /* don't prune routes */
- DontPruneRoutes = atobool(val);
- break;
-
- case 'r': /* read timeout */
- if (subopt == NULL)
- inittimeouts(val);
- else
- settimeout(subopt, val);
- break;
-
- case 'S': /* status file */
- if (val[0] == '\0')
- StatFile = "sendmail.st";
- else
- StatFile = newstr(val);
- break;
-
- case 's': /* be super safe, even if expensive */
- SuperSafe = atobool(val);
- break;
-
- case 'T': /* queue timeout */
- p = strchr(val, '/');
- if (p != NULL)
- {
- *p++ = '\0';
- settimeout("queuewarn", p);
- }
- settimeout("queuereturn", val);
- break;
-
- case 't': /* time zone name */
- TimeZoneSpec = newstr(val);
- break;
-
- case 'U': /* location of user database */
- UdbSpec = newstr(val);
- break;
-
- case 'u': /* set default uid */
- for (p = val; *p != '\0'; p++)
- {
- if (*p == '.' || *p == '/' || *p == ':')
- {
- *p++ = '\0';
- break;
- }
- }
- if (isascii(*val) && isdigit(*val))
- {
- DefUid = atoi(val);
- setdefuser();
- }
- else
- {
- register struct passwd *pw;
-
- DefUid = -1;
- pw = sm_getpwnam(val);
- if (pw == NULL)
- syserr("readcf: option u: unknown user %s", val);
- else
- {
- DefUid = pw->pw_uid;
- DefGid = pw->pw_gid;
- DefUser = newstr(pw->pw_name);
- }
- }
-
-#ifdef UID_MAX
- if (DefUid > UID_MAX)
- {
- syserr("readcf: option u: uid value (%ld) > UID_MAX (%ld); ignored",
- DefUid, UID_MAX);
- }
-#endif
-
- /* handle the group if it is there */
- if (*p == '\0')
- break;
- val = p;
- goto g_opt;
-
- case 'V': /* fallback MX host */
- if (val[0] != '\0')
- FallBackMX = newstr(val);
- break;
-
- case 'v': /* run in verbose mode */
- Verbose = atobool(val) ? 1 : 0;
- break;
-
- case 'w': /* if we are best MX, try host directly */
- TryNullMXList = atobool(val);
- break;
-
- /* 'W' available -- was wizard password */
-
- case 'x': /* load avg at which to auto-queue msgs */
- QueueLA = atoi(val);
- break;
-
- case 'X': /* load avg at which to auto-reject connections */
- RefuseLA = atoi(val);
- break;
-
- case 'y': /* work recipient factor */
- WkRecipFact = atoi(val);
- break;
-
- case 'Y': /* fork jobs during queue runs */
- ForkQueueRuns = atobool(val);
- break;
-
- case 'z': /* work message class factor */
- WkClassFact = atoi(val);
- break;
-
- case 'Z': /* work time factor */
- WkTimeFact = atoi(val);
- break;
-
- case O_QUEUESORTORD: /* queue sorting order */
- switch (*val)
- {
- case 'h': /* Host first */
- case 'H':
- QueueSortOrder = QS_BYHOST;
- break;
-
- case 'p': /* Priority order */
- case 'P':
- QueueSortOrder = QS_BYPRIORITY;
- break;
-
- case 't': /* Submission time */
- case 'T':
- QueueSortOrder = QS_BYTIME;
- break;
-
- default:
- syserr("Invalid queue sort order \"%s\"", val);
- }
- break;
-
- case O_HOSTSFILE: /* pathname of /etc/hosts file */
- HostsFile = newstr(val);
- break;
-
- case O_MQA: /* minimum queue age between deliveries */
- MinQueueAge = convtime(val, 'm');
- break;
-
- case O_DEFCHARSET: /* default character set for mimefying */
- DefaultCharSet = newstr(denlstring(val, TRUE, TRUE));
- break;
-
- case O_SSFILE: /* service switch file */
- ServiceSwitchFile = newstr(val);
- break;
-
- case O_DIALDELAY: /* delay for dial-on-demand operation */
- DialDelay = convtime(val, 's');
- break;
-
- case O_NORCPTACTION: /* what to do if no recipient */
- if (strcasecmp(val, "none") == 0)
- NoRecipientAction = NRA_NO_ACTION;
- else if (strcasecmp(val, "add-to") == 0)
- NoRecipientAction = NRA_ADD_TO;
- else if (strcasecmp(val, "add-apparently-to") == 0)
- NoRecipientAction = NRA_ADD_APPARENTLY_TO;
- else if (strcasecmp(val, "add-bcc") == 0)
- NoRecipientAction = NRA_ADD_BCC;
- else if (strcasecmp(val, "add-to-undisclosed") == 0)
- NoRecipientAction = NRA_ADD_TO_UNDISCLOSED;
- else
- syserr("Invalid NoRecipientAction: %s", val);
- break;
-
- case O_SAFEFILEENV: /* chroot() environ for writing to files */
- SafeFileEnv = newstr(val);
- break;
-
- case O_MAXMSGSIZE: /* maximum message size */
- MaxMessageSize = atol(val);
- break;
-
- case O_COLONOKINADDR: /* old style handling of colon addresses */
- ColonOkInAddr = atobool(val);
- break;
-
- case O_MAXQUEUERUN: /* max # of jobs in a single queue run */
- MaxQueueRun = atol(val);
- break;
-
- case O_MAXCHILDREN: /* max # of children of daemon */
- MaxChildren = atoi(val);
- break;
-
- case O_KEEPCNAMES: /* don't expand CNAME records */
- DontExpandCnames = atobool(val);
- break;
-
- case O_MUSTQUOTE: /* must quote these characters in phrases */
- strcpy(buf, "@,;:\\()[]");
- if (strlen(val) < (SIZE_T) sizeof buf - 10)
- strcat(buf, val);
- MustQuoteChars = newstr(buf);
- break;
-
- case O_SMTPGREETING: /* SMTP greeting message (old $e macro) */
- SmtpGreeting = newstr(munchstring(val, NULL, '\0'));
- break;
-
- case O_UNIXFROM: /* UNIX From_ line (old $l macro) */
- UnixFromLine = newstr(munchstring(val, NULL, '\0'));
- break;
-
- case O_OPCHARS: /* operator characters (old $o macro) */
- OperatorChars = newstr(munchstring(val, NULL, '\0'));
- break;
-
- case O_DONTINITGRPS: /* don't call initgroups(3) */
- DontInitGroups = atobool(val);
- break;
-
- case O_SLFH: /* make sure from fits on one line */
- SingleLineFromHeader = atobool(val);
- break;
-
- case O_ABH: /* allow HELO commands with syntax errors */
- AllowBogusHELO = atobool(val);
- break;
-
- case O_CONNTHROT: /* connection rate throttle */
- ConnRateThrottle = atoi(val);
- break;
-
- case O_UGW: /* group writable files are unsafe */
- if (!atobool(val))
- DontBlameSendmail |= DBS_GROUPWRITABLEFORWARDFILESAFE|DBS_GROUPWRITABLEINCLUDEFILESAFE;
- break;
-
- case O_DBLBOUNCE: /* address to which to send double bounces */
- if (val[0] != '\0')
- DoubleBounceAddr = newstr(val);
- else
- syserr("readcf: option DoubleBounceAddress: value required");
- break;
-
- case O_HSDIR: /* persistent host status directory */
- if (val[0] != '\0')
- HostStatDir = newstr(val);
- break;
-
- case O_SINGTHREAD: /* single thread deliveries (requires hsdir) */
- SingleThreadDelivery = atobool(val);
- break;
-
- case O_RUNASUSER: /* run bulk of code as this user */
- for (p = val; *p != '\0'; p++)
- {
- if (*p == '.' || *p == '/' || *p == ':')
- {
- *p++ = '\0';
- break;
- }
- }
- if (isascii(*val) && isdigit(*val))
- {
- if (can_setuid)
- RunAsUid = atoi(val);
- }
- else
- {
- register struct passwd *pw;
-
- pw = sm_getpwnam(val);
- if (pw == NULL)
- syserr("readcf: option RunAsUser: unknown user %s", val);
- else if (can_setuid)
- {
- if (*p == '\0')
- RunAsUserName = newstr(val);
- RunAsUid = pw->pw_uid;
- RunAsGid = pw->pw_gid;
- }
- }
-#ifdef UID_MAX
- if (RunAsUid > UID_MAX)
- {
- syserr("readcf: option RunAsUser: uid value (%ld) > UID_MAX (%ld); ignored",
- RunAsUid, UID_MAX);
- }
-#endif
- if (*p != '\0')
- {
- if (isascii(*p) && isdigit(*p))
- {
- if (can_setuid)
- RunAsGid = atoi(p);
- }
- else
- {
- register struct group *gr;
-
- gr = getgrnam(p);
- if (gr == NULL)
- syserr("readcf: option RunAsUser: unknown group %s",
- p);
- else if (can_setuid)
- RunAsGid = gr->gr_gid;
- }
- }
- if (tTd(47, 5))
- printf("readcf: RunAsUser = %d:%d\n", (int)RunAsUid, (int)RunAsGid);
- break;
-
-#if _FFR_DSN_RRT_OPTION
- case O_DSN_RRT:
- RrtImpliesDsn = atobool(val);
- break;
-#endif
-
-#if _FFR_PIDFILE_OPTION
- case O_PIDFILE:
- free(PidFile);
- PidFile = newstr(val);
- break;
-#endif
-
- case O_DONTBLAMESENDMAIL:
- p = val;
- for (;;)
- {
- register struct dbsval *dbs;
- extern struct dbsval DontBlameSendmailValues[];
-
- while (isascii(*p) && (isspace(*p) || ispunct(*p)))
- p++;
- if (*p == '\0')
- break;
- val = p;
- while (isascii(*p) && isalnum(*p))
- p++;
- if (*p != '\0')
- *p++ = '\0';
-
- for (dbs = DontBlameSendmailValues;
- dbs->dbs_name != NULL; dbs++)
- {
- if (strcasecmp(val, dbs->dbs_name) == 0)
- break;
- }
- if (dbs->dbs_name == NULL)
- syserr("readcf: DontBlameSendmail option: %s unrecognized", val);
- else if (dbs->dbs_flag == DBS_SAFE)
- DontBlameSendmail = DBS_SAFE;
- else
- DontBlameSendmail |= dbs->dbs_flag;
- }
- sticky = FALSE;
- break;
-
- case O_DPI:
- DontProbeInterfaces = atobool(val);
- break;
-
- case O_MAXRCPT:
- MaxRcptPerMsg = atoi(val);
- break;
-
-#if _FFR_DEADLETTERDROP_OPTION
- case O_DEADLETTER:
- if (DeadLetterDrop != NULL)
- free(DeadLetterDrop);
- DeadLetterDrop = newstr(val);
- break;
-#endif
-
-#if _FFR_DONTLOCKFILESFORREAD_OPTION
- case O_DONTLOCK:
- DontLockReadFiles = atobool(val);
- break;
-#endif
-
-#if _FFR_MAXALIASRECURSION_OPTION
- case O_MAXALIASRCSN:
- MaxAliasRecursion = atoi(val);
- break;
-#endif
-
-#if _FFR_CONNECTONLYTO_OPTION
- case O_CNCTONLYTO:
- /* XXX should probably use gethostbyname */
- ConnectOnlyTo = inet_addr(val);
- break;
-#endif
-
-#if _FFR_TRUSTED_USER
- case O_TRUSTUSER:
- if (isascii(*val) && isdigit(*val))
- TrustedUid = atoi(val);
- else
- {
- register struct passwd *pw;
-
- TrustedUid = 0;
- pw = sm_getpwnam(val);
- if (pw == NULL)
- syserr("readcf: option TrustedUser: unknown user %s", val);
- else
- TrustedUid = pw->pw_uid;
- }
-
-#ifdef UID_MAX
- if (TrustedUid > UID_MAX)
- {
- syserr("readcf: option TrustedUser: uid value (%ld) > UID_MAX (%ld)",
- TrustedUid, UID_MAX);
- TrustedUid = 0;
- }
-#endif
- break;
-#endif
-
-#if _FFR_MAX_MIME_HEADER_LENGTH
- case O_MAXMIMEHDRLEN:
- p = strchr(val, '/');
- if (p != NULL)
- *p++ = '\0';
- MaxMimeHeaderLength = atoi(val);
- if (p != NULL && *p != '\0')
- MaxMimeFieldLength = atoi(p);
- else
- MaxMimeFieldLength = MaxMimeHeaderLength / 2;
-
- if (MaxMimeHeaderLength < 0)
- MaxMimeHeaderLength = 0;
- else if (MaxMimeHeaderLength < 128)
- printf("Warning: MaxMimeHeaderLength: header length limit set lower than 128\n");
-
- if (MaxMimeFieldLength < 0)
- MaxMimeFieldLength = 0;
- else if (MaxMimeFieldLength < 40)
- printf("Warning: MaxMimeHeaderLength: field length limit set lower than 40\n");
- break;
-#endif
-
-#if _FFR_CONTROL_SOCKET
- case O_CONTROLSOCKET:
- if (ControlSocketName != NULL)
- free(ControlSocketName);
- ControlSocketName = newstr(val);
- break;
-#endif
-
-#if _FFR_MAX_HEADERS_LENGTH
- case O_MAXHDRSLEN:
- MaxHeadersLength = atoi(val);
-
- if (MaxHeadersLength > 0 &&
- MaxHeadersLength < (MAXHDRSLEN / 2))
- printf("Warning: MaxHeadersLength: headers length limit set lower than %d\n", MAXHDRSLEN);
- break;
-#endif
-
- default:
- if (tTd(37, 1))
- {
- if (isascii(opt) && isprint(opt))
- printf("Warning: option %c unknown\n", opt);
- else
- printf("Warning: option 0x%x unknown\n", opt);
- }
- break;
- }
- if (sticky)
- setbitn(opt, StickyOpt);
-}
-\f/*
-** SETCLASS -- set a string into a class
-**
-** Parameters:
-** class -- the class to put the string in.
-** str -- the string to enter
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** puts the word into the symbol table.
-*/
-
-void
-setclass(class, str)
- int class;
- char *str;
-{
- register STAB *s;
-
- if (tTd(37, 8))
- printf("setclass(%s, %s)\n", macname(class), str);
- s = stab(str, ST_CLASS, ST_ENTER);
- setbitn(class, s->s_class);
-}
-\f/*
-** MAKEMAPENTRY -- create a map entry
-**
-** Parameters:
-** line -- the config file line
-**
-** Returns:
-** A pointer to the map that has been created.
-** NULL if there was a syntax error.
-**
-** Side Effects:
-** Enters the map into the dictionary.
-*/
-
-MAP *
-makemapentry(line)
- char *line;
-{
- register char *p;
- char *mapname;
- char *classname;
- register STAB *s;
- STAB *class;
-
- for (p = line; isascii(*p) && isspace(*p); p++)
- continue;
- if (!(isascii(*p) && isalnum(*p)))
- {
- syserr("readcf: config K line: no map name");
- return NULL;
- }
-
- mapname = p;
- while ((isascii(*++p) && isalnum(*p)) || *p == '_' || *p == '.')
- continue;
- if (*p != '\0')
- *p++ = '\0';
- while (isascii(*p) && isspace(*p))
- p++;
- if (!(isascii(*p) && isalnum(*p)))
- {
- syserr("readcf: config K line, map %s: no map class", mapname);
- return NULL;
- }
- classname = p;
- while (isascii(*++p) && isalnum(*p))
- continue;
- if (*p != '\0')
- *p++ = '\0';
- while (isascii(*p) && isspace(*p))
- p++;
-
- /* look up the class */
- class = stab(classname, ST_MAPCLASS, ST_FIND);
- if (class == NULL)
- {
- syserr("readcf: map %s: class %s not available", mapname, classname);
- return NULL;
- }
-
- /* enter the map */
- s = stab(mapname, ST_MAP, ST_ENTER);
- s->s_map.map_class = &class->s_mapclass;
- s->s_map.map_mname = newstr(mapname);
-
- if (class->s_mapclass.map_parse(&s->s_map, p))
- s->s_map.map_mflags |= MF_VALID;
-
- if (tTd(37, 5))
- {
- printf("map %s, class %s, flags %lx, file %s,\n",
- s->s_map.map_mname, s->s_map.map_class->map_cname,
- s->s_map.map_mflags,
- s->s_map.map_file == NULL ? "(null)" : s->s_map.map_file);
- printf("\tapp %s, domain %s, rebuild %s\n",
- s->s_map.map_app == NULL ? "(null)" : s->s_map.map_app,
- s->s_map.map_domain == NULL ? "(null)" : s->s_map.map_domain,
- s->s_map.map_rebuild == NULL ? "(null)" : s->s_map.map_rebuild);
- }
-
- return &s->s_map;
-}
-\f/*
-** STRTORWSET -- convert string to rewriting set number
-**
-** Parameters:
-** p -- the pointer to the string to decode.
-** endp -- if set, store the trailing delimiter here.
-** stabmode -- ST_ENTER to create this entry, ST_FIND if
-** it must already exist.
-**
-** Returns:
-** The appropriate ruleset number.
-** -1 if it is not valid (error already printed)
-*/
-
-int
-strtorwset(p, endp, stabmode)
- char *p;
- char **endp;
- int stabmode;
-{
- int ruleset;
- static int nextruleset = MAXRWSETS;
-
- while (isascii(*p) && isspace(*p))
- p++;
- if (!isascii(*p))
- {
- syserr("invalid ruleset name: \"%.20s\"", p);
- return -1;
- }
- if (isdigit(*p))
- {
- ruleset = strtol(p, endp, 10);
- if (ruleset >= MAXRWSETS / 2 || ruleset < 0)
- {
- syserr("bad ruleset %d (%d max)",
- ruleset, MAXRWSETS / 2);
- ruleset = -1;
- }
- }
- else
- {
- STAB *s;
- char delim;
- char *q;
-
- q = p;
- while (*p != '\0' && isascii(*p) &&
- (isalnum(*p) || *p == '_'))
- p++;
- if (q == p || !(isascii(*q) && isalpha(*q)))
- {
- /* no valid characters */
- syserr("invalid ruleset name: \"%.20s\"", q);
- return -1;
- }
- while (isascii(*p) && isspace(*p))
- *p++ = '\0';
- delim = *p;
- if (delim != '\0')
- *p = '\0';
- s = stab(q, ST_RULESET, stabmode);
- if (delim != '\0')
- *p = delim;
-
- if (s == NULL)
- return -1;
-
- if (stabmode == ST_ENTER && delim == '=')
- {
- while (isascii(*++p) && isspace(*p))
- continue;
- if (!(isascii(*p) && isdigit(*p)))
- {
- syserr("bad ruleset definition \"%s\" (number required after `=')", q);
- ruleset = -1;
- }
- else
- {
- ruleset = strtol(p, endp, 10);
- if (ruleset >= MAXRWSETS / 2 || ruleset < 0)
- {
- syserr("bad ruleset number %d in \"%s\" (%d max)",
- ruleset, q, MAXRWSETS / 2);
- ruleset = -1;
- }
- }
- }
- else
- {
- if (endp != NULL)
- *endp = p;
- if (s->s_ruleset > 0)
- ruleset = s->s_ruleset;
- else if ((ruleset = --nextruleset) < MAXRWSETS / 2)
- {
- syserr("%s: too many named rulesets (%d max)",
- q, MAXRWSETS / 2);
- ruleset = -1;
- }
- }
- if (s->s_ruleset > 0 && ruleset >= 0 && ruleset != s->s_ruleset)
- {
- syserr("%s: ruleset changed value (old %d, new %d)",
- q, s->s_ruleset, ruleset);
- ruleset = s->s_ruleset;
- }
- else if (ruleset > 0)
- {
- s->s_ruleset = ruleset;
- }
- }
- return ruleset;
-}
-\f/*
-** INITTIMEOUTS -- parse and set timeout values
-**
-** Parameters:
-** val -- a pointer to the values. If NULL, do initial
-** settings.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Initializes the TimeOuts structure
-*/
-
-#define SECONDS
-#define MINUTES * 60
-#define HOUR * 3600
-
-void
-inittimeouts(val)
- register char *val;
-{
- register char *p;
- extern time_t convtime __P((char *, char));
-
- if (tTd(37, 2))
- printf("inittimeouts(%s)\n", val == NULL ? "<NULL>" : val);
- if (val == NULL)
- {
- TimeOuts.to_connect = (time_t) 0 SECONDS;
- TimeOuts.to_initial = (time_t) 5 MINUTES;
- TimeOuts.to_helo = (time_t) 5 MINUTES;
- TimeOuts.to_mail = (time_t) 10 MINUTES;
- TimeOuts.to_rcpt = (time_t) 1 HOUR;
- TimeOuts.to_datainit = (time_t) 5 MINUTES;
- TimeOuts.to_datablock = (time_t) 1 HOUR;
- TimeOuts.to_datafinal = (time_t) 1 HOUR;
- TimeOuts.to_rset = (time_t) 5 MINUTES;
- TimeOuts.to_quit = (time_t) 2 MINUTES;
- TimeOuts.to_nextcommand = (time_t) 1 HOUR;
- TimeOuts.to_miscshort = (time_t) 2 MINUTES;
-#if IDENTPROTO
- TimeOuts.to_ident = (time_t) 30 SECONDS;
-#else
- TimeOuts.to_ident = (time_t) 0 SECONDS;
-#endif
- TimeOuts.to_fileopen = (time_t) 60 SECONDS;
- if (tTd(37, 5))
- {
- printf("Timeouts:\n");
- printf(" connect = %ld\n", (long)TimeOuts.to_connect);
- printf(" initial = %ld\n", (long)TimeOuts.to_initial);
- printf(" helo = %ld\n", (long)TimeOuts.to_helo);
- printf(" mail = %ld\n", (long)TimeOuts.to_mail);
- printf(" rcpt = %ld\n", (long)TimeOuts.to_rcpt);
- printf(" datainit = %ld\n", (long)TimeOuts.to_datainit);
- printf(" datablock = %ld\n", (long)TimeOuts.to_datablock);
- printf(" datafinal = %ld\n", (long)TimeOuts.to_datafinal);
- printf(" rset = %ld\n", (long)TimeOuts.to_rset);
- printf(" quit = %ld\n", (long)TimeOuts.to_quit);
- printf(" nextcommand = %ld\n", (long)TimeOuts.to_nextcommand);
- printf(" miscshort = %ld\n", (long)TimeOuts.to_miscshort);
- printf(" ident = %ld\n", (long)TimeOuts.to_ident);
- printf(" fileopen = %ld\n", (long)TimeOuts.to_fileopen);
- }
- return;
- }
-
- for (;; val = p)
- {
- while (isascii(*val) && isspace(*val))
- val++;
- if (*val == '\0')
- break;
- for (p = val; *p != '\0' && *p != ','; p++)
- continue;
- if (*p != '\0')
- *p++ = '\0';
-
- if (isascii(*val) && isdigit(*val))
- {
- /* old syntax -- set everything */
- TimeOuts.to_mail = convtime(val, 'm');
- TimeOuts.to_rcpt = TimeOuts.to_mail;
- TimeOuts.to_datainit = TimeOuts.to_mail;
- TimeOuts.to_datablock = TimeOuts.to_mail;
- TimeOuts.to_datafinal = TimeOuts.to_mail;
- TimeOuts.to_nextcommand = TimeOuts.to_mail;
- continue;
- }
- else
- {
- register char *q = strchr(val, ':');
-
- if (q == NULL && (q = strchr(val, '=')) == NULL)
- {
- /* syntax error */
- continue;
- }
- *q++ = '\0';
- settimeout(val, q);
- }
- }
-}
-\f/*
-** SETTIMEOUT -- set an individual timeout
-**
-** Parameters:
-** name -- the name of the timeout.
-** val -- the value of the timeout.
-**
-** Returns:
-** none.
-*/
-
-void
-settimeout(name, val)
- char *name;
- char *val;
-{
- register char *p;
- time_t to;
- extern time_t convtime __P((char *, char));
-
- if (tTd(37, 2))
- printf("settimeout(%s = %s)\n", name, val);
-
- to = convtime(val, 'm');
- p = strchr(name, '.');
- if (p != NULL)
- *p++ = '\0';
-
- if (strcasecmp(name, "initial") == 0)
- TimeOuts.to_initial = to;
- else if (strcasecmp(name, "mail") == 0)
- TimeOuts.to_mail = to;
- else if (strcasecmp(name, "rcpt") == 0)
- TimeOuts.to_rcpt = to;
- else if (strcasecmp(name, "datainit") == 0)
- TimeOuts.to_datainit = to;
- else if (strcasecmp(name, "datablock") == 0)
- TimeOuts.to_datablock = to;
- else if (strcasecmp(name, "datafinal") == 0)
- TimeOuts.to_datafinal = to;
- else if (strcasecmp(name, "command") == 0)
- TimeOuts.to_nextcommand = to;
- else if (strcasecmp(name, "rset") == 0)
- TimeOuts.to_rset = to;
- else if (strcasecmp(name, "helo") == 0)
- TimeOuts.to_helo = to;
- else if (strcasecmp(name, "quit") == 0)
- TimeOuts.to_quit = to;
- else if (strcasecmp(name, "misc") == 0)
- TimeOuts.to_miscshort = to;
- else if (strcasecmp(name, "ident") == 0)
- TimeOuts.to_ident = to;
- else if (strcasecmp(name, "fileopen") == 0)
- TimeOuts.to_fileopen = to;
- else if (strcasecmp(name, "connect") == 0)
- TimeOuts.to_connect = to;
- else if (strcasecmp(name, "iconnect") == 0)
- TimeOuts.to_iconnect = to;
- else if (strcasecmp(name, "queuewarn") == 0)
- {
- to = convtime(val, 'h');
- if (p == NULL || strcmp(p, "*") == 0)
- {
- TimeOuts.to_q_warning[TOC_NORMAL] = to;
- TimeOuts.to_q_warning[TOC_URGENT] = to;
- TimeOuts.to_q_warning[TOC_NONURGENT] = to;
- }
- else if (strcasecmp(p, "normal") == 0)
- TimeOuts.to_q_warning[TOC_NORMAL] = to;
- else if (strcasecmp(p, "urgent") == 0)
- TimeOuts.to_q_warning[TOC_URGENT] = to;
- else if (strcasecmp(p, "non-urgent") == 0)
- TimeOuts.to_q_warning[TOC_NONURGENT] = to;
- else
- syserr("settimeout: invalid queuewarn subtimeout %s", p);
- }
- else if (strcasecmp(name, "queuereturn") == 0)
- {
- to = convtime(val, 'd');
- if (p == NULL || strcmp(p, "*") == 0)
- {
- TimeOuts.to_q_return[TOC_NORMAL] = to;
- TimeOuts.to_q_return[TOC_URGENT] = to;
- TimeOuts.to_q_return[TOC_NONURGENT] = to;
- }
- else if (strcasecmp(p, "normal") == 0)
- TimeOuts.to_q_return[TOC_NORMAL] = to;
- else if (strcasecmp(p, "urgent") == 0)
- TimeOuts.to_q_return[TOC_URGENT] = to;
- else if (strcasecmp(p, "non-urgent") == 0)
- TimeOuts.to_q_return[TOC_NONURGENT] = to;
- else
- syserr("settimeout: invalid queuereturn subtimeout %s", p);
- }
- else if (strcasecmp(name, "hoststatus") == 0)
- MciInfoTimeout = convtime(val, 'm');
- else
- syserr("settimeout: invalid timeout %s", name);
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)recipient.c 8.163 (Berkeley) 1/23/1999";
-#endif /* not lint */
-
-# include "sendmail.h"
-# include <grp.h>
-
-/*
-** SENDTOLIST -- Designate a send list.
-**
-** The parameter is a comma-separated list of people to send to.
-** This routine arranges to send to all of them.
-**
-** Parameters:
-** list -- the send list.
-** ctladdr -- the address template for the person to
-** send to -- effective uid/gid are important.
-** This is typically the alias that caused this
-** expansion.
-** sendq -- a pointer to the head of a queue to put
-** these people into.
-** aliaslevel -- the current alias nesting depth -- to
-** diagnose loops.
-** e -- the envelope in which to add these recipients.
-**
-** Returns:
-** The number of addresses actually on the list.
-**
-** Side Effects:
-** none.
-*/
-
-/* q_flags bits inherited from ctladdr */
-#define QINHERITEDBITS (QPINGONSUCCESS|QPINGONFAILURE|QPINGONDELAY|QHASNOTIFY)
-
-int
-sendtolist(list, ctladdr, sendq, aliaslevel, e)
- char *list;
- ADDRESS *ctladdr;
- ADDRESS **sendq;
- int aliaslevel;
- register ENVELOPE *e;
-{
- register char *p;
- register ADDRESS *al; /* list of addresses to send to */
- char delimiter; /* the address delimiter */
- int naddrs;
- int i;
- char *oldto = e->e_to;
- char *bufp;
- char buf[MAXNAME + 1];
-
- if (list == NULL)
- {
- syserr("sendtolist: null list");
- return 0;
- }
-
- if (tTd(25, 1))
- {
- printf("sendto: %s\n ctladdr=", list);
- printaddr(ctladdr, FALSE);
- }
-
- /* heuristic to determine old versus new style addresses */
- if (ctladdr == NULL &&
- (strchr(list, ',') != NULL || strchr(list, ';') != NULL ||
- strchr(list, '<') != NULL || strchr(list, '(') != NULL))
- e->e_flags &= ~EF_OLDSTYLE;
- delimiter = ' ';
- if (!bitset(EF_OLDSTYLE, e->e_flags) || ctladdr != NULL)
- delimiter = ',';
-
- al = NULL;
- naddrs = 0;
-
- /* make sure we have enough space to copy the string */
- i = strlen(list) + 1;
- if (i <= sizeof buf)
- bufp = buf;
- else
- bufp = xalloc(i);
- strcpy(bufp, denlstring(list, FALSE, TRUE));
-
- for (p = bufp; *p != '\0'; )
- {
- auto char *delimptr;
- register ADDRESS *a;
-
- /* parse the address */
- while ((isascii(*p) && isspace(*p)) || *p == ',')
- p++;
- a = parseaddr(p, NULLADDR, RF_COPYALL, delimiter, &delimptr, e);
- p = delimptr;
- if (a == NULL)
- continue;
- a->q_next = al;
- a->q_alias = ctladdr;
-
- /* arrange to inherit attributes from parent */
- if (ctladdr != NULL)
- {
- ADDRESS *b;
- extern ADDRESS *self_reference __P((ADDRESS *, ENVELOPE *));
-
- /* self reference test */
- if (sameaddr(ctladdr, a))
- {
- if (tTd(27, 5))
- {
- printf("sendtolist: QSELFREF ");
- printaddr(ctladdr, FALSE);
- }
- ctladdr->q_flags |= QSELFREF;
- }
-
- /* check for address loops */
- b = self_reference(a, e);
- if (b != NULL)
- {
- b->q_flags |= QSELFREF;
- if (tTd(27, 5))
- {
- printf("sendtolist: QSELFREF ");
- printaddr(b, FALSE);
- }
- if (a != b)
- {
- if (tTd(27, 5))
- {
- printf("sendtolist: QDONTSEND ");
- printaddr(a, FALSE);
- }
- a->q_flags |= QDONTSEND;
- b->q_flags |= a->q_flags & QNOTREMOTE;
- continue;
- }
- }
-
- /* full name */
- if (a->q_fullname == NULL)
- a->q_fullname = ctladdr->q_fullname;
-
- /* various flag bits */
- a->q_flags &= ~QINHERITEDBITS;
- a->q_flags |= ctladdr->q_flags & QINHERITEDBITS;
-
- /* original recipient information */
- a->q_orcpt = ctladdr->q_orcpt;
- }
-
- al = a;
- }
-
- /* arrange to send to everyone on the local send list */
- while (al != NULL)
- {
- register ADDRESS *a = al;
-
- al = a->q_next;
- a = recipient(a, sendq, aliaslevel, e);
- naddrs++;
- }
-
- e->e_to = oldto;
- if (bufp != buf)
- free(bufp);
- return (naddrs);
-}
-\f/*
-** RECIPIENT -- Designate a message recipient
-**
-** Saves the named person for future mailing.
-**
-** Parameters:
-** a -- the (preparsed) address header for the recipient.
-** sendq -- a pointer to the head of a queue to put the
-** recipient in. Duplicate supression is done
-** in this queue.
-** aliaslevel -- the current alias nesting depth.
-** e -- the current envelope.
-**
-** Returns:
-** The actual address in the queue. This will be "a" if
-** the address is not a duplicate, else the original address.
-**
-** Side Effects:
-** none.
-*/
-
-ADDRESS *
-recipient(a, sendq, aliaslevel, e)
- register ADDRESS *a;
- register ADDRESS **sendq;
- int aliaslevel;
- register ENVELOPE *e;
-{
- register ADDRESS *q;
- ADDRESS **pq;
- register struct mailer *m;
- register char *p;
- bool quoted = FALSE; /* set if the addr has a quote bit */
- int findusercount = 0;
- bool initialdontsend = bitset(QDONTSEND, a->q_flags);
- int i;
- char *buf;
- char buf0[MAXNAME + 1]; /* unquoted image of the user name */
- extern void alias __P((ADDRESS *, ADDRESS **, int, ENVELOPE *));
-
- e->e_to = a->q_paddr;
- m = a->q_mailer;
- errno = 0;
- if (aliaslevel == 0)
- a->q_flags |= QPRIMARY;
- if (tTd(26, 1))
- {
- printf("\nrecipient (%d): ", aliaslevel);
- printaddr(a, FALSE);
- }
-
- /* if this is primary, add it to the original recipient list */
- if (a->q_alias == NULL)
- {
- if (e->e_origrcpt == NULL)
- e->e_origrcpt = a->q_paddr;
- else if (e->e_origrcpt != a->q_paddr)
- e->e_origrcpt = "";
- }
-
- /* break aliasing loops */
- if (aliaslevel > MaxAliasRecursion)
- {
- a->q_flags |= QBADADDR;
- a->q_status = "5.4.6";
- usrerr("554 aliasing/forwarding loop broken (%d aliases deep; %d max)",
- aliaslevel, MaxAliasRecursion);
- return (a);
- }
-
- /*
- ** Finish setting up address structure.
- */
-
- /* get unquoted user for file, program or user.name check */
- i = strlen(a->q_user);
- if (i >= sizeof buf0)
- buf = xalloc(i + 1);
- else
- buf = buf0;
- (void) strcpy(buf, a->q_user);
- for (p = buf; *p != '\0' && !quoted; p++)
- {
- if (*p == '\\')
- quoted = TRUE;
- }
- stripquotes(buf);
-
- /* check for direct mailing to restricted mailers */
- if (m == ProgMailer)
- {
- if (a->q_alias == NULL)
- {
- a->q_flags |= QBADADDR;
- a->q_status = "5.7.1";
- usrerr("550 Cannot mail directly to programs");
- }
- else if (bitset(QBOGUSSHELL, a->q_alias->q_flags))
- {
- a->q_flags |= QBADADDR;
- a->q_status = "5.7.1";
- if (a->q_alias->q_ruser == NULL)
- usrerr("550 UID %d is an unknown user: cannot mail to programs",
- a->q_alias->q_uid);
- else
- usrerr("550 User %s@%s doesn't have a valid shell for mailing to programs",
- a->q_alias->q_ruser, MyHostName);
- }
- else if (bitset(QUNSAFEADDR, a->q_alias->q_flags))
- {
- a->q_flags |= QBADADDR;
- a->q_status = "5.7.1";
- a->q_rstatus = newstr("Unsafe for mailing to programs");
- usrerr("550 Address %s is unsafe for mailing to programs",
- a->q_alias->q_paddr);
- }
- }
-
- /*
- ** Look up this person in the recipient list.
- ** If they are there already, return, otherwise continue.
- ** If the list is empty, just add it. Notice the cute
- ** hack to make from addresses suppress things correctly:
- ** the QDONTSEND bit will be set in the send list.
- ** [Please note: the emphasis is on "hack."]
- */
-
- for (pq = sendq; (q = *pq) != NULL; pq = &q->q_next)
- {
- if (sameaddr(q, a) &&
- (bitset(QRCPTOK, q->q_flags) ||
- !bitset(QPRIMARY, q->q_flags)))
- {
- if (tTd(26, 1))
- {
- printf("%s in sendq: ", a->q_paddr);
- printaddr(q, FALSE);
- }
- if (!bitset(QPRIMARY, q->q_flags))
- {
- if (!bitset(QDONTSEND, a->q_flags))
- message("duplicate suppressed");
- q->q_flags |= a->q_flags;
- }
- else if (bitset(QSELFREF, q->q_flags))
- q->q_flags |= a->q_flags & ~QDONTSEND;
- a = q;
- goto done;
- }
- }
-
- /* add address on list */
- if (pq != NULL)
- {
- *pq = a;
- a->q_next = NULL;
- }
-
- /*
- ** Alias the name and handle special mailer types.
- */
-
- trylocaluser:
- if (tTd(29, 7))
- {
- printf("at trylocaluser: ");
- printaddr(a, FALSE);
- }
-
- if (bitset(QDONTSEND|QBADADDR|QVERIFIED, a->q_flags))
- goto testselfdestruct;
-
- if (m == InclMailer)
- {
- a->q_flags |= QDONTSEND;
- if (a->q_alias == NULL)
- {
- a->q_flags |= QBADADDR;
- a->q_status = "5.7.1";
- usrerr("550 Cannot mail directly to :include:s");
- }
- else
- {
- int ret;
-
- message("including file %s", a->q_user);
- ret = include(a->q_user, FALSE, a, sendq, aliaslevel, e);
- if (transienterror(ret))
- {
- if (LogLevel > 2)
- sm_syslog(LOG_ERR, e->e_id,
- "include %s: transient error: %s",
- shortenstring(a->q_user, MAXSHORTSTR),
- errstring(ret));
- a->q_flags |= QQUEUEUP;
- a->q_flags &= ~QDONTSEND;
- usrerr("451 Cannot open %s: %s",
- shortenstring(a->q_user, MAXSHORTSTR),
- errstring(ret));
- }
- else if (ret != 0)
- {
- a->q_flags |= QBADADDR;
- a->q_status = "5.2.4";
- usrerr("550 Cannot open %s: %s",
- shortenstring(a->q_user, MAXSHORTSTR),
- errstring(ret));
- }
- }
- }
- else if (m == FileMailer)
- {
- extern bool writable __P((char *, ADDRESS *, int));
-
- /* check if writable or creatable */
- if (a->q_alias == NULL)
- {
- a->q_flags |= QBADADDR;
- a->q_status = "5.7.1";
- usrerr("550 Cannot mail directly to files");
- }
- else if (bitset(QBOGUSSHELL, a->q_alias->q_flags))
- {
- a->q_flags |= QBADADDR;
- a->q_status = "5.7.1";
- if (a->q_alias->q_ruser == NULL)
- usrerr("550 UID %d is an unknown user: cannot mail to files",
- a->q_alias->q_uid);
- else
- usrerr("550 User %s@%s doesn't have a valid shell for mailing to files",
- a->q_alias->q_ruser, MyHostName);
- }
- else if (bitset(QUNSAFEADDR, a->q_alias->q_flags))
- {
- a->q_flags |= QBADADDR;
- a->q_status = "5.7.1";
- a->q_rstatus = newstr("Unsafe for mailing to files");
- usrerr("550 Address %s is unsafe for mailing to files",
- a->q_alias->q_paddr);
- }
- else if (strcmp(buf, "/dev/null") == 0)
- {
- /* /dev/null is always accepted */
- }
- else if (!writable(buf, a->q_alias, SFF_CREAT))
- {
- a->q_flags |= QBADADDR;
- giveresponse(EX_CANTCREAT, m, NULL, a->q_alias,
- (time_t) 0, e);
- }
- }
-
- /* try aliasing */
- if (!quoted && !bitset(QDONTSEND, a->q_flags) &&
- bitnset(M_ALIASABLE, m->m_flags))
- alias(a, sendq, aliaslevel, e);
-
-# if USERDB
- /* if not aliased, look it up in the user database */
- if (!bitset(QDONTSEND|QNOTREMOTE|QVERIFIED, a->q_flags) &&
- bitnset(M_CHECKUDB, m->m_flags))
- {
- extern int udbexpand __P((ADDRESS *, ADDRESS **, int, ENVELOPE *));
-
- if (udbexpand(a, sendq, aliaslevel, e) == EX_TEMPFAIL)
- {
- a->q_flags |= QQUEUEUP;
- if (e->e_message == NULL)
- e->e_message = newstr("Deferred: user database error");
- if (LogLevel > 8)
- sm_syslog(LOG_INFO, e->e_id,
- "deferred: udbexpand: %s",
- errstring(errno));
- message("queued (user database error): %s",
- errstring(errno));
- e->e_nrcpts++;
- goto testselfdestruct;
- }
- }
-# endif
-
- /*
- ** If we have a level two config file, then pass the name through
- ** Ruleset 5 before sending it off. Ruleset 5 has the right
- ** to send rewrite it to another mailer. This gives us a hook
- ** after local aliasing has been done.
- */
-
- if (tTd(29, 5))
- {
- printf("recipient: testing local? cl=%d, rr5=%lx\n\t",
- ConfigLevel, (u_long) RewriteRules[5]);
- printaddr(a, FALSE);
- }
- if (!bitset(QNOTREMOTE|QDONTSEND|QQUEUEUP|QVERIFIED, a->q_flags) &&
- ConfigLevel >= 2 && RewriteRules[5] != NULL &&
- bitnset(M_TRYRULESET5, m->m_flags))
- {
- extern void maplocaluser __P((ADDRESS *, ADDRESS **, int, ENVELOPE *));
-
- maplocaluser(a, sendq, aliaslevel + 1, e);
- }
-
- /*
- ** If it didn't get rewritten to another mailer, go ahead
- ** and deliver it.
- */
-
- if (!bitset(QDONTSEND|QQUEUEUP|QVERIFIED, a->q_flags) &&
- bitnset(M_HASPWENT, m->m_flags))
- {
- auto bool fuzzy;
- register struct passwd *pw;
- extern void forward __P((ADDRESS *, ADDRESS **, int, ENVELOPE *));
-
- /* warning -- finduser may trash buf */
- pw = finduser(buf, &fuzzy);
- if (pw == NULL || strlen(pw->pw_name) > MAXNAME)
- {
- a->q_flags |= QBADADDR;
- a->q_status = "5.1.1";
- giveresponse(EX_NOUSER, m, NULL, a->q_alias,
- (time_t) 0, e);
- }
- else
- {
- char nbuf[MAXNAME + 1];
-
- if (fuzzy)
- {
- /* name was a fuzzy match */
- a->q_user = newstr(pw->pw_name);
- if (findusercount++ > 3)
- {
- a->q_flags |= QBADADDR;
- a->q_status = "5.4.6";
- usrerr("554 aliasing/forwarding loop for %s broken",
- pw->pw_name);
- goto done;
- }
-
- /* see if it aliases */
- (void) strcpy(buf, pw->pw_name);
- goto trylocaluser;
- }
- if (strcmp(pw->pw_dir, "/") == 0)
- a->q_home = "";
- else
- a->q_home = newstr(pw->pw_dir);
- a->q_uid = pw->pw_uid;
- a->q_gid = pw->pw_gid;
- a->q_ruser = newstr(pw->pw_name);
- a->q_flags |= QGOODUID;
- buildfname(pw->pw_gecos, pw->pw_name, nbuf, sizeof nbuf);
- if (nbuf[0] != '\0')
- a->q_fullname = newstr(nbuf);
- if (!usershellok(pw->pw_name, pw->pw_shell))
- {
- a->q_flags |= QBOGUSSHELL;
- }
- if (bitset(EF_VRFYONLY, e->e_flags))
- {
- /* don't do any more now */
- a->q_flags |= QVERIFIED;
- }
- else if (!quoted)
- forward(a, sendq, aliaslevel, e);
- }
- }
- if (!bitset(QDONTSEND, a->q_flags))
- e->e_nrcpts++;
-
- testselfdestruct:
- a->q_flags |= QTHISPASS;
- if (tTd(26, 8))
- {
- printf("testselfdestruct: ");
- printaddr(a, FALSE);
- if (tTd(26, 10))
- {
- printf("SENDQ:\n");
- printaddr(*sendq, TRUE);
- printf("----\n");
- }
- }
- if (a->q_alias == NULL && a != &e->e_from &&
- bitset(QDONTSEND, a->q_flags))
- {
- for (q = *sendq; q != NULL; q = q->q_next)
- {
- if (!bitset(QDONTSEND, q->q_flags))
- break;
- }
- if (q == NULL)
- {
- a->q_flags |= QBADADDR;
- a->q_status = "5.4.6";
- usrerr("554 aliasing/forwarding loop broken");
- }
- }
-
- done:
- a->q_flags |= QTHISPASS;
- if (buf != buf0)
- free(buf);
-
- /*
- ** If we are at the top level, check to see if this has
- ** expanded to exactly one address. If so, it can inherit
- ** the primaryness of the address.
- **
- ** While we're at it, clear the QTHISPASS bits.
- */
-
- if (aliaslevel == 0)
- {
- int nrcpts = 0;
- ADDRESS *only = NULL;
-
- for (q = *sendq; q != NULL; q = q->q_next)
- {
- if (bitset(QTHISPASS, q->q_flags) &&
- !bitset(QDONTSEND|QBADADDR, q->q_flags))
- {
- nrcpts++;
- only = q;
- }
- q->q_flags &= ~QTHISPASS;
- }
- if (nrcpts == 1)
- {
- /* check to see if this actually got a new owner */
- q = only;
- while ((q = q->q_alias) != NULL)
- {
- if (q->q_owner != NULL)
- break;
- }
- if (q == NULL)
- only->q_flags |= QPRIMARY;
- }
- else if (!initialdontsend && nrcpts > 0)
- {
- /* arrange for return receipt */
- e->e_flags |= EF_SENDRECEIPT;
- a->q_flags |= QEXPANDED;
- if (e->e_xfp != NULL && bitset(QPINGONSUCCESS, a->q_flags))
- fprintf(e->e_xfp,
- "%s... expanded to multiple addresses\n",
- a->q_paddr);
- }
- }
- a->q_flags |= QRCPTOK;
- return (a);
-}
-\f/*
-** FINDUSER -- find the password entry for a user.
-**
-** This looks a lot like getpwnam, except that it may want to
-** do some fancier pattern matching in /etc/passwd.
-**
-** This routine contains most of the time of many sendmail runs.
-** It deserves to be optimized.
-**
-** Parameters:
-** name -- the name to match against.
-** fuzzyp -- an outarg that is set to TRUE if this entry
-** was found using the fuzzy matching algorithm;
-** set to FALSE otherwise.
-**
-** Returns:
-** A pointer to a pw struct.
-** NULL if name is unknown or ambiguous.
-**
-** Side Effects:
-** may modify name.
-*/
-
-struct passwd *
-finduser(name, fuzzyp)
- char *name;
- bool *fuzzyp;
-{
- register struct passwd *pw;
- register char *p;
- bool tryagain;
-
- if (tTd(29, 4))
- printf("finduser(%s): ", name);
-
- *fuzzyp = FALSE;
-
-#ifdef HESIOD
- /* DEC Hesiod getpwnam accepts numeric strings -- short circuit it */
- for (p = name; *p != '\0'; p++)
- if (!isascii(*p) || !isdigit(*p))
- break;
- if (*p == '\0')
- {
- if (tTd(29, 4))
- printf("failed (numeric input)\n");
- return NULL;
- }
-#endif
-
- /* look up this login name using fast path */
- if ((pw = sm_getpwnam(name)) != NULL)
- {
- if (tTd(29, 4))
- printf("found (non-fuzzy)\n");
- return (pw);
- }
-
- /* try mapping it to lower case */
- tryagain = FALSE;
- for (p = name; *p != '\0'; p++)
- {
- if (isascii(*p) && isupper(*p))
- {
- *p = tolower(*p);
- tryagain = TRUE;
- }
- }
- if (tryagain && (pw = sm_getpwnam(name)) != NULL)
- {
- if (tTd(29, 4))
- printf("found (lower case)\n");
- *fuzzyp = TRUE;
- return pw;
- }
-
-#if MATCHGECOS
- /* see if fuzzy matching allowed */
- if (!MatchGecos)
- {
- if (tTd(29, 4))
- printf("not found (fuzzy disabled)\n");
- return NULL;
- }
-
- /* search for a matching full name instead */
- for (p = name; *p != '\0'; p++)
- {
- if (*p == (SpaceSub & 0177) || *p == '_')
- *p = ' ';
- }
- (void) setpwent();
- while ((pw = getpwent()) != NULL)
- {
- char buf[MAXNAME + 1];
-
-# if 0
- if (strcasecmp(pw->pw_name, name) == 0)
- {
- if (tTd(29, 4))
- printf("found (case wrapped)\n");
- break;
- }
-# endif
-
- buildfname(pw->pw_gecos, pw->pw_name, buf, sizeof buf);
- if (strchr(buf, ' ') != NULL && !strcasecmp(buf, name))
- {
- if (tTd(29, 4))
- printf("fuzzy matches %s\n", pw->pw_name);
- message("sending to login name %s", pw->pw_name);
- break;
- }
- }
- if (pw != NULL)
- *fuzzyp = TRUE;
- else if (tTd(29, 4))
- printf("no fuzzy match found\n");
-# if DEC_OSF_BROKEN_GETPWENT /* DEC OSF/1 3.2 or earlier */
- endpwent();
-# endif
- return pw;
-#else
- if (tTd(29, 4))
- printf("not found (fuzzy disabled)\n");
- return NULL;
-#endif
-}
-\f/*
-** WRITABLE -- predicate returning if the file is writable.
-**
-** This routine must duplicate the algorithm in sys/fio.c.
-** Unfortunately, we cannot use the access call since we
-** won't necessarily be the real uid when we try to
-** actually open the file.
-**
-** Notice that ANY file with ANY execute bit is automatically
-** not writable. This is also enforced by mailfile.
-**
-** Parameters:
-** filename -- the file name to check.
-** ctladdr -- the controlling address for this file.
-** flags -- SFF_* flags to control the function.
-**
-** Returns:
-** TRUE -- if we will be able to write this file.
-** FALSE -- if we cannot write this file.
-**
-** Side Effects:
-** none.
-*/
-
-bool
-writable(filename, ctladdr, flags)
- char *filename;
- ADDRESS *ctladdr;
- int flags;
-{
- uid_t euid;
- gid_t egid;
- char *uname;
-
- if (tTd(44, 5))
- printf("writable(%s, 0x%x)\n", filename, flags);
-
- /*
- ** File does exist -- check that it is writable.
- */
-
- if (geteuid() != 0)
- {
- euid = geteuid();
- egid = getegid();
- uname = NULL;
- }
- else if (ctladdr != NULL)
- {
- euid = ctladdr->q_uid;
- egid = ctladdr->q_gid;
- uname = ctladdr->q_user;
- }
- else if (bitset(SFF_RUNASREALUID, flags))
- {
- euid = RealUid;
- egid = RealGid;
- uname = RealUserName;
- }
- else if (FileMailer != NULL && !bitset(SFF_ROOTOK, flags))
- {
- euid = FileMailer->m_uid;
- egid = FileMailer->m_gid;
- uname = NULL;
- }
- else
- {
- euid = egid = 0;
- uname = NULL;
- }
- if (!bitset(SFF_ROOTOK, flags))
- {
- if (euid == 0)
- {
- euid = DefUid;
- uname = DefUser;
- }
- if (egid == 0)
- egid = DefGid;
- }
- if (geteuid() == 0 &&
- (ctladdr == NULL || !bitset(QGOODUID, ctladdr->q_flags)))
- flags |= SFF_SETUIDOK;
-
- if (!bitset(DBS_FILEDELIVERYTOSYMLINK, DontBlameSendmail))
- flags |= SFF_NOSLINK;
- if (!bitset(DBS_FILEDELIVERYTOHARDLINK, DontBlameSendmail))
- flags |= SFF_NOHLINK;
-
- errno = safefile(filename, euid, egid, uname, flags, S_IWRITE, NULL);
- return errno == 0;
-}
-\f/*
-** INCLUDE -- handle :include: specification.
-**
-** Parameters:
-** fname -- filename to include.
-** forwarding -- if TRUE, we are reading a .forward file.
-** if FALSE, it's a :include: file.
-** ctladdr -- address template to use to fill in these
-** addresses -- effective user/group id are
-** the important things.
-** sendq -- a pointer to the head of the send queue
-** to put these addresses in.
-** aliaslevel -- the alias nesting depth.
-** e -- the current envelope.
-**
-** Returns:
-** open error status
-**
-** Side Effects:
-** reads the :include: file and sends to everyone
-** listed in that file.
-**
-** Security Note:
-** If you have restricted chown (that is, you can't
-** give a file away), it is reasonable to allow programs
-** and files called from this :include: file to be to be
-** run as the owner of the :include: file. This is bogus
-** if there is any chance of someone giving away a file.
-** We assume that pre-POSIX systems can give away files.
-**
-** There is an additional restriction that if you
-** forward to a :include: file, it will not take on
-** the ownership of the :include: file. This may not
-** be necessary, but shouldn't hurt.
-*/
-
-static jmp_buf CtxIncludeTimeout;
-static void includetimeout __P((void));
-
-int
-include(fname, forwarding, ctladdr, sendq, aliaslevel, e)
- char *fname;
- bool forwarding;
- ADDRESS *ctladdr;
- ADDRESS **sendq;
- int aliaslevel;
- ENVELOPE *e;
-{
- FILE *volatile fp = NULL;
- char *oldto = e->e_to;
- char *oldfilename = FileName;
- int oldlinenumber = LineNumber;
- register EVENT *ev = NULL;
- int nincludes;
- int mode;
- register ADDRESS *ca;
- volatile uid_t saveduid, uid;
- volatile gid_t savedgid, gid;
- char *volatile uname;
- int rval = 0;
- volatile int sfflags = SFF_REGONLY;
- register char *p;
- bool safechown = FALSE;
- volatile bool safedir = FALSE;
- struct stat st;
- char buf[MAXLINE];
- extern bool chownsafe __P((int, bool));
-
- if (tTd(27, 2))
- printf("include(%s)\n", fname);
- if (tTd(27, 4))
- printf(" ruid=%d euid=%d\n", (int) getuid(), (int) geteuid());
- if (tTd(27, 14))
- {
- printf("ctladdr ");
- printaddr(ctladdr, FALSE);
- }
-
- if (tTd(27, 9))
- printf("include: old uid = %d/%d\n",
- (int) getuid(), (int) geteuid());
-
- if (forwarding)
- sfflags |= SFF_MUSTOWN|SFF_ROOTOK|SFF_NOWLINK;
-
- ca = getctladdr(ctladdr);
- if (ca == NULL)
- {
- uid = DefUid;
- gid = DefGid;
- uname = DefUser;
- }
- else
- {
- uid = ca->q_uid;
- gid = ca->q_gid;
- uname = ca->q_user;
- }
-#if HASSETREUID || USESETEUID
- saveduid = geteuid();
- savedgid = getegid();
- if (saveduid == 0)
- {
- if (!DontInitGroups)
- {
- if (initgroups(uname, gid) == -1)
- syserr("include: initgroups(%s, %d) failed",
- uname, gid);
- }
- else
- {
- GIDSET_T gidset[1];
-
- gidset[0] = gid;
- if (setgroups(1, gidset) == -1)
- syserr("include: setgroups() failed");
- }
-
- if (gid != 0 && setgid(gid) < -1)
- syserr("setgid(%d) failure", gid);
- if (uid != 0)
- {
-# if USESETEUID
- if (seteuid(uid) < 0)
- syserr("seteuid(%d) failure (real=%d, eff=%d)",
- uid, getuid(), geteuid());
-# else
- if (setreuid(0, uid) < 0)
- syserr("setreuid(0, %d) failure (real=%d, eff=%d)",
- uid, getuid(), geteuid());
-# endif
- }
- }
-#endif
-
- if (tTd(27, 9))
- printf("include: new uid = %d/%d\n",
- (int) getuid(), (int) geteuid());
-
- /*
- ** If home directory is remote mounted but server is down,
- ** this can hang or give errors; use a timeout to avoid this
- */
-
- if (setjmp(CtxIncludeTimeout) != 0)
- {
- ctladdr->q_flags |= QQUEUEUP;
- errno = 0;
-
- /* return pseudo-error code */
- rval = E_SM_OPENTIMEOUT;
- goto resetuid;
- }
- if (TimeOuts.to_fileopen > 0)
- ev = setevent(TimeOuts.to_fileopen, includetimeout, 0);
- else
- ev = NULL;
-
- /* check for writable parent directory */
- p = strrchr(fname, '/');
- if (p != NULL)
- {
- int ret;
-
- *p = '\0';
- ret = safedirpath(fname, uid, gid, uname, sfflags|SFF_SAFEDIRPATH);
- if (ret == 0)
- {
- /* in safe directory: relax chown & link rules */
- safedir = TRUE;
- sfflags |= SFF_NOPATHCHECK;
- }
- else
- {
- if (bitset((forwarding ?
- DBS_FORWARDFILEINUNSAFEDIRPATH :
- DBS_INCLUDEFILEINUNSAFEDIRPATH),
- DontBlameSendmail))
- sfflags |= SFF_NOPATHCHECK;
- else if (bitset((forwarding ?
- DBS_FORWARDFILEINGROUPWRITABLEDIRPATH :
- DBS_INCLUDEFILEINGROUPWRITABLEDIRPATH),
- DontBlameSendmail) &&
- ret == E_SM_GWDIR)
- {
- DontBlameSendmail |= DBS_GROUPWRITABLEDIRPATHSAFE;
- ret = safedirpath(fname, uid,
- gid, uname,
- sfflags|SFF_SAFEDIRPATH);
- DontBlameSendmail &= ~DBS_GROUPWRITABLEDIRPATHSAFE;
- if (ret == 0)
- sfflags |= SFF_NOPATHCHECK;
- else
- sfflags |= SFF_SAFEDIRPATH;
- }
- else
- sfflags |= SFF_SAFEDIRPATH;
- if (ret > E_PSEUDOBASE &&
- !bitset((forwarding ?
- DBS_FORWARDFILEINUNSAFEDIRPATHSAFE :
- DBS_INCLUDEFILEINUNSAFEDIRPATHSAFE),
- DontBlameSendmail))
- {
- if (LogLevel >= 12)
- sm_syslog(LOG_INFO, e->e_id,
- "%s: unsafe directory path, marked unsafe",
- shortenstring(fname, MAXSHORTSTR));
- ctladdr->q_flags |= QUNSAFEADDR;
- }
- }
- *p = '/';
- }
-
- /* allow links only in unwritable directories */
- if (!safedir &&
- !bitset((forwarding ?
- DBS_LINKEDFORWARDFILEINWRITABLEDIR :
- DBS_LINKEDINCLUDEFILEINWRITABLEDIR),
- DontBlameSendmail))
- sfflags |= SFF_NOLINK;
-
- rval = safefile(fname, uid, gid, uname, sfflags, S_IREAD, &st);
- if (rval != 0)
- {
- /* don't use this :include: file */
- if (tTd(27, 4))
- printf("include: not safe (uid=%d): %s\n",
- (int) uid, errstring(rval));
- }
- else if ((fp = fopen(fname, "r")) == NULL)
- {
- rval = errno;
- if (tTd(27, 4))
- printf("include: open: %s\n", errstring(rval));
- }
- else if (filechanged(fname, fileno(fp), &st))
- {
- rval = E_SM_FILECHANGE;
- if (tTd(27, 4))
- printf("include: file changed after open\n");
- }
- if (ev != NULL)
- clrevent(ev);
-
-resetuid:
-
-#if HASSETREUID || USESETEUID
- if (saveduid == 0)
- {
- if (uid != 0)
- {
-# if USESETEUID
- if (seteuid(0) < 0)
- syserr("seteuid(0) failure (real=%d, eff=%d)",
- getuid(), geteuid());
-# else
- if (setreuid(-1, 0) < 0)
- syserr("setreuid(-1, 0) failure (real=%d, eff=%d)",
- getuid(), geteuid());
- if (setreuid(RealUid, 0) < 0)
- syserr("setreuid(%d, 0) failure (real=%d, eff=%d)",
- RealUid, getuid(), geteuid());
-# endif
- }
- setgid(savedgid);
- }
-#endif
-
- if (tTd(27, 9))
- printf("include: reset uid = %d/%d\n",
- (int) getuid(), (int) geteuid());
-
- if (rval == E_SM_OPENTIMEOUT)
- usrerr("451 open timeout on %s", fname);
-
- if (fp == NULL)
- return rval;
-
- if (fstat(fileno(fp), &st) < 0)
- {
- rval = errno;
- syserr("Cannot fstat %s!", fname);
- return rval;
- }
-
- /* if path was writable, check to avoid file giveaway tricks */
- safechown = chownsafe(fileno(fp), safedir);
- if (tTd(27, 6))
- printf("include: parent of %s is %s, chown is %ssafe\n",
- fname,
- safedir ? "safe" : "dangerous",
- safechown ? "" : "un");
-
- if (ca == NULL && safechown)
- {
- ctladdr->q_uid = st.st_uid;
- ctladdr->q_gid = st.st_gid;
- ctladdr->q_flags |= QGOODUID;
- }
- if (ca != NULL && ca->q_uid == st.st_uid)
- {
- /* optimization -- avoid getpwuid if we already have info */
- ctladdr->q_flags |= ca->q_flags & QBOGUSSHELL;
- ctladdr->q_ruser = ca->q_ruser;
- }
- else if (!forwarding)
- {
- register struct passwd *pw;
-
- pw = sm_getpwuid(st.st_uid);
- if (pw == NULL)
- ctladdr->q_flags |= QBOGUSSHELL;
- else
- {
- char *sh;
-
- ctladdr->q_ruser = newstr(pw->pw_name);
- if (safechown)
- sh = pw->pw_shell;
- else
- sh = "/SENDMAIL/ANY/SHELL/";
- if (!usershellok(pw->pw_name, sh))
- {
- if (LogLevel >= 12)
- sm_syslog(LOG_INFO, e->e_id,
- "%s: user %s has bad shell %s, marked %s",
- shortenstring(fname, MAXSHORTSTR),
- pw->pw_name, sh,
- safechown ? "bogus" : "unsafe");
- if (safechown)
- ctladdr->q_flags |= QBOGUSSHELL;
- else
- ctladdr->q_flags |= QUNSAFEADDR;
- }
- }
- }
-
- if (bitset(EF_VRFYONLY, e->e_flags))
- {
- /* don't do any more now */
- ctladdr->q_flags |= QVERIFIED;
- ctladdr->q_flags &= ~QDONTSEND;
- e->e_nrcpts++;
- xfclose(fp, "include", fname);
- return rval;
- }
-
- /*
- ** Check to see if some bad guy can write this file
- **
- ** Group write checking could be more clever, e.g.,
- ** guessing as to which groups are actually safe ("sys"
- ** may be; "user" probably is not).
- */
-
- mode = S_IWOTH;
- if (!bitset((forwarding ?
- DBS_GROUPWRITABLEFORWARDFILESAFE :
- DBS_GROUPWRITABLEINCLUDEFILESAFE),
- DontBlameSendmail))
- mode |= S_IWGRP;
-
- if (bitset(mode, st.st_mode))
- {
- if (tTd(27, 6))
- printf("include: %s is %s writable, marked unsafe\n",
- shortenstring(fname, MAXSHORTSTR),
- bitset(S_IWOTH, st.st_mode) ? "world" : "group");
- if (LogLevel >= 12)
- sm_syslog(LOG_INFO, e->e_id,
- "%s: %s writable %s file, marked unsafe",
- shortenstring(fname, MAXSHORTSTR),
- bitset(S_IWOTH, st.st_mode) ? "world" : "group",
- forwarding ? "forward" : ":include:");
- ctladdr->q_flags |= QUNSAFEADDR;
- }
-
- /* read the file -- each line is a comma-separated list. */
- FileName = fname;
- LineNumber = 0;
- ctladdr->q_flags &= ~QSELFREF;
- nincludes = 0;
- while (fgets(buf, sizeof buf, fp) != NULL)
- {
- register char *p = strchr(buf, '\n');
-
- LineNumber++;
- if (p != NULL)
- *p = '\0';
- if (buf[0] == '#' || buf[0] == '\0')
- continue;
-
- /* <sp>#@# introduces a comment anywhere */
- /* for Japanese character sets */
- for (p = buf; (p = strchr(++p, '#')) != NULL; )
- {
- if (p[1] == '@' && p[2] == '#' &&
- isascii(p[-1]) && isspace(p[-1]) &&
- (p[3] == '\0' || (isascii(p[3]) && isspace(p[3]))))
- {
- p[-1] = '\0';
- break;
- }
- }
- if (buf[0] == '\0')
- continue;
-
- e->e_to = NULL;
- message("%s to %s",
- forwarding ? "forwarding" : "sending", buf);
- if (forwarding && LogLevel > 9)
- sm_syslog(LOG_INFO, e->e_id,
- "forward %.200s => %s",
- oldto, shortenstring(buf, MAXSHORTSTR));
-
- nincludes += sendtolist(buf, ctladdr, sendq, aliaslevel + 1, e);
- }
-
- if (ferror(fp) && tTd(27, 3))
- printf("include: read error: %s\n", errstring(errno));
- if (nincludes > 0 && !bitset(QSELFREF, ctladdr->q_flags))
- {
- if (tTd(27, 5))
- {
- printf("include: QDONTSEND ");
- printaddr(ctladdr, FALSE);
- }
- ctladdr->q_flags |= QDONTSEND;
- }
-
- (void) xfclose(fp, "include", fname);
- FileName = oldfilename;
- LineNumber = oldlinenumber;
- e->e_to = oldto;
- return rval;
-}
-
-static void
-includetimeout()
-{
- longjmp(CtxIncludeTimeout, 1);
-}
-\f/*
-** SENDTOARGV -- send to an argument vector.
-**
-** Parameters:
-** argv -- argument vector to send to.
-** e -- the current envelope.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** puts all addresses on the argument vector onto the
-** send queue.
-*/
-
-void
-sendtoargv(argv, e)
- register char **argv;
- register ENVELOPE *e;
-{
- register char *p;
-
- while ((p = *argv++) != NULL)
- {
- (void) sendtolist(p, NULLADDR, &e->e_sendqueue, 0, e);
- }
-}
-\f/*
-** GETCTLADDR -- get controlling address from an address header.
-**
-** If none, get one corresponding to the effective userid.
-**
-** Parameters:
-** a -- the address to find the controller of.
-**
-** Returns:
-** the controlling address.
-**
-** Side Effects:
-** none.
-*/
-
-ADDRESS *
-getctladdr(a)
- register ADDRESS *a;
-{
- while (a != NULL && !bitset(QGOODUID, a->q_flags))
- a = a->q_alias;
- return (a);
-}
-\f/*
-** SELF_REFERENCE -- check to see if an address references itself
-**
-** The check is done through a chain of aliases. If it is part of
-** a loop, break the loop at the "best" address, that is, the one
-** that exists as a real user.
-**
-** This is to handle the case of:
-** awc: Andrew.Chang
-** Andrew.Chang: awc@mail.server
-** which is a problem only on mail.server.
-**
-** Parameters:
-** a -- the address to check.
-** e -- the current envelope.
-**
-** Returns:
-** The address that should be retained.
-*/
-
-ADDRESS *
-self_reference(a, e)
- ADDRESS *a;
- ENVELOPE *e;
-{
- ADDRESS *b; /* top entry in self ref loop */
- ADDRESS *c; /* entry that point to a real mail box */
-
- if (tTd(27, 1))
- printf("self_reference(%s)\n", a->q_paddr);
-
- for (b = a->q_alias; b != NULL; b = b->q_alias)
- {
- if (sameaddr(a, b))
- break;
- }
-
- if (b == NULL)
- {
- if (tTd(27, 1))
- printf("\t... no self ref\n");
- return NULL;
- }
-
- /*
- ** Pick the first address that resolved to a real mail box
- ** i.e has a pw entry. The returned value will be marked
- ** QSELFREF in recipient(), which in turn will disable alias()
- ** from marking it QDONTSEND, which mean it will be used
- ** as a deliverable address.
- **
- ** The 2 key thing to note here are:
- ** 1) we are in a recursive call sequence:
- ** alias->sentolist->recipient->alias
- ** 2) normally, when we return back to alias(), the address
- ** will be marked QDONTSEND, since alias() assumes the
- ** expanded form will be used instead of the current address.
- ** This behaviour is turned off if the address is marked
- ** QSELFREF We set QSELFREF when we return to recipient().
- */
-
- c = a;
- while (c != NULL)
- {
- if (tTd(27, 10))
- printf(" %s", c->q_user);
- if (bitnset(M_HASPWENT, c->q_mailer->m_flags))
- {
- if (tTd(27, 2))
- printf("\t... getpwnam(%s)... ", c->q_user);
- if (sm_getpwnam(c->q_user) != NULL)
- {
- if (tTd(27, 2))
- printf("found\n");
-
- /* ought to cache results here */
- if (sameaddr(b, c))
- return b;
- else
- return c;
- }
- if (tTd(27, 2))
- printf("failed\n");
- }
- else
- {
- /* if local delivery, compare usernames */
- if (bitnset(M_LOCALMAILER, c->q_mailer->m_flags) &&
- b->q_mailer == c->q_mailer)
- {
- if (tTd(27, 2))
- printf("\t... local match (%s)\n", c->q_user);
- if (sameaddr(b, c))
- return b;
- else
- return c;
- }
- }
- if (tTd(27, 10))
- printf("\n");
- c = c->q_alias;
- }
-
- if (tTd(27, 1))
- printf("\t... cannot break loop for \"%s\"\n", a->q_paddr);
-
- return NULL;
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)safefile.c 8.43 (Berkeley) 10/13/1998";
-#endif /* not lint */
-
-# include "sendmail.h"
-\f/*
-** SAFEFILE -- return true if a file exists and is safe for a user.
-**
-** Parameters:
-** fn -- filename to check.
-** uid -- user id to compare against.
-** gid -- group id to compare against.
-** uname -- user name to compare against (used for group
-** sets).
-** flags -- modifiers:
-** SFF_MUSTOWN -- "uid" must own this file.
-** SFF_NOSLINK -- file cannot be a symbolic link.
-** mode -- mode bits that must match.
-** st -- if set, points to a stat structure that will
-** get the stat info for the file.
-**
-** Returns:
-** 0 if fn exists, is owned by uid, and matches mode.
-** An errno otherwise. The actual errno is cleared.
-**
-** Side Effects:
-** none.
-*/
-
-#include <grp.h>
-
-int
-safefile(fn, uid, gid, uname, flags, mode, st)
- char *fn;
- UID_T uid;
- GID_T gid;
- char *uname;
- int flags;
- int mode;
- struct stat *st;
-{
- register char *p;
- register struct group *gr = NULL;
- int file_errno = 0;
- bool checkpath;
- struct stat stbuf;
- struct stat fstbuf;
- char fbuf[MAXPATHLEN + 1];
-
- if (tTd(44, 4))
- printf("safefile(%s, uid=%d, gid=%d, flags=%x, mode=%o):\n",
- fn, (int) uid, (int) gid, flags, mode);
- errno = 0;
- if (st == NULL)
- st = &fstbuf;
- if (strlen(fn) > sizeof fbuf - 1)
- {
- if (tTd(44, 4))
- printf("\tpathname too long\n");
- return ENAMETOOLONG;
- }
- strcpy(fbuf, fn);
- fn = fbuf;
-
- /* ignore SFF_SAFEDIRPATH if we are debugging */
- if (RealUid != 0 && RunAsUid == RealUid)
- flags &= ~SFF_SAFEDIRPATH;
-
- /* first check to see if the file exists at all */
-#ifdef HASLSTAT
- if ((bitset(SFF_NOSLINK, flags) ? lstat(fn, st)
- : stat(fn, st)) < 0)
-#else
- if (stat(fn, st) < 0)
-#endif
- {
- file_errno = errno;
- }
- else if (bitset(SFF_SETUIDOK, flags) &&
- !bitset(S_IXUSR|S_IXGRP|S_IXOTH, st->st_mode) &&
- S_ISREG(st->st_mode))
- {
- /*
- ** If final file is setuid, run as the owner of that
- ** file. Gotta be careful not to reveal anything too
- ** soon here!
- */
-
-#ifdef SUID_ROOT_FILES_OK
- if (bitset(S_ISUID, st->st_mode))
-#else
- if (bitset(S_ISUID, st->st_mode) && st->st_uid != 0 &&
- st->st_uid != TrustedUid)
-#endif
- {
- uid = st->st_uid;
- uname = NULL;
- }
-#ifdef SUID_ROOT_FILES_OK
- if (bitset(S_ISGID, st->st_mode))
-#else
- if (bitset(S_ISGID, st->st_mode) && st->st_gid != 0)
-#endif
- gid = st->st_gid;
- }
-
- checkpath = !bitset(SFF_NOPATHCHECK, flags) ||
- (uid == 0 && !bitset(SFF_ROOTOK|SFF_OPENASROOT, flags));
- if (bitset(SFF_NOWLINK, flags) && !bitset(SFF_SAFEDIRPATH, flags))
- {
- int ret;
-
- /* check the directory */
- p = strrchr(fn, '/');
- if (p == NULL)
- {
- ret = safedirpath(".", uid, gid, uname, flags|SFF_SAFEDIRPATH);
- }
- else
- {
- *p = '\0';
- ret = safedirpath(fn, uid, gid, uname, flags|SFF_SAFEDIRPATH);
- *p = '/';
- }
- if (ret == 0)
- {
- /* directory is safe */
- checkpath = FALSE;
- }
- else
- {
-#ifdef HASLSTAT
- /* Need lstat() information if called stat() before */
- if (!bitset(SFF_NOSLINK, flags) && lstat(fn, st) < 0)
- {
- ret = errno;
- if (tTd(44, 4))
- printf("\t%s\n", errstring(ret));
- return ret;
- }
-#endif
- /* directory is writable: disallow links */
- flags |= SFF_NOLINK;
- }
- }
-
- if (checkpath)
- {
- int ret;
-
- p = strrchr(fn, '/');
- if (p == NULL)
- {
- ret = safedirpath(".", uid, gid, uname, flags);
- }
- else
- {
- *p = '\0';
- ret = safedirpath(fn, uid, gid, uname, flags);
- *p = '/';
- }
- if (ret != 0)
- return ret;
- }
-
- /*
- ** If the target file doesn't exist, check the directory to
- ** ensure that it is writable by this user.
- */
-
- if (file_errno != 0)
- {
- int ret = file_errno;
- char *dir = fn;
-
- if (tTd(44, 4))
- printf("\t%s\n", errstring(ret));
-
- errno = 0;
- if (!bitset(SFF_CREAT, flags) || file_errno != ENOENT)
- return ret;
-
- /* check to see if legal to create the file */
- p = strrchr(dir, '/');
- if (p == NULL)
- dir = ".";
- else if (p == dir)
- dir = "/";
- else
- *p = '\0';
- if (stat(dir, &stbuf) >= 0)
- {
- int md = S_IWRITE|S_IEXEC;
-
- if (stbuf.st_uid == uid)
- ;
- else if (uid == 0 && stbuf.st_uid == TrustedUid)
- ;
- else
- {
- md >>= 3;
- if (stbuf.st_gid == gid)
- ;
-#ifndef NO_GROUP_SET
- else if (uname != NULL && !DontInitGroups &&
- ((gr != NULL &&
- gr->gr_gid == stbuf.st_gid) ||
- (gr = getgrgid(stbuf.st_gid)) != NULL))
- {
- register char **gp;
-
- for (gp = gr->gr_mem; *gp != NULL; gp++)
- if (strcmp(*gp, uname) == 0)
- break;
- if (*gp == NULL)
- md >>= 3;
- }
-#endif
- else
- md >>= 3;
- }
- if ((stbuf.st_mode & md) != md)
- errno = EACCES;
- }
- ret = errno;
- if (tTd(44, 4))
- printf("\t[final dir %s uid %d mode %lo] %s\n",
- dir, (int) stbuf.st_uid, (u_long) stbuf.st_mode,
- errstring(ret));
- if (p != NULL)
- *p = '/';
- st->st_mode = ST_MODE_NOFILE;
- return ret;
- }
-
-#ifdef S_ISLNK
- if (bitset(SFF_NOSLINK, flags) && S_ISLNK(st->st_mode))
- {
- if (tTd(44, 4))
- printf("\t[slink mode %lo]\tE_SM_NOSLINK\n",
- (u_long) st->st_mode);
- return E_SM_NOSLINK;
- }
-#endif
- if (bitset(SFF_REGONLY, flags) && !S_ISREG(st->st_mode))
- {
- if (tTd(44, 4))
- printf("\t[non-reg mode %lo]\tE_SM_REGONLY\n",
- (u_long) st->st_mode);
- return E_SM_REGONLY;
- }
- if (bitset(SFF_NOGWFILES, flags) &&
- bitset(S_IWGRP, st->st_mode))
- {
- if (tTd(44, 4))
- printf("\t[write bits %lo]\tE_SM_GWFILE\n",
- (u_long) st->st_mode);
- return E_SM_GWFILE;
- }
- if (bitset(SFF_NOWWFILES, flags) &&
- bitset(S_IWOTH, st->st_mode))
- {
- if (tTd(44, 4))
- printf("\t[write bits %lo]\tE_SM_WWFILE\n",
- (u_long) st->st_mode);
- return E_SM_WWFILE;
- }
- if (bitset(S_IWUSR|S_IWGRP|S_IWOTH, mode) &&
- bitset(S_IXUSR|S_IXGRP|S_IXOTH, st->st_mode))
- {
- if (tTd(44, 4))
- printf("\t[exec bits %lo]\tE_SM_ISEXEC]\n",
- (u_long) st->st_mode);
- return E_SM_ISEXEC;
- }
- if (bitset(SFF_NOHLINK, flags) && st->st_nlink != 1)
- {
- if (tTd(44, 4))
- printf("\t[link count %d]\tE_SM_NOHLINK\n",
- (int) st->st_nlink);
- return E_SM_NOHLINK;
- }
-
- if (uid == 0 && bitset(SFF_OPENASROOT, flags))
- ;
- else if (uid == 0 && !bitset(SFF_ROOTOK, flags))
- mode >>= 6;
- else if (st->st_uid == uid)
- ;
- else if (uid == 0 && st->st_uid == TrustedUid)
- ;
- else
- {
- mode >>= 3;
- if (st->st_gid == gid)
- ;
-#ifndef NO_GROUP_SET
- else if (uname != NULL && !DontInitGroups &&
- ((gr != NULL && gr->gr_gid == st->st_gid) ||
- (gr = getgrgid(st->st_gid)) != NULL))
- {
- register char **gp;
-
- for (gp = gr->gr_mem; *gp != NULL; gp++)
- if (strcmp(*gp, uname) == 0)
- break;
- if (*gp == NULL)
- mode >>= 3;
- }
-#endif
- else
- mode >>= 3;
- }
- if (tTd(44, 4))
- printf("\t[uid %d, nlink %d, stat %lo, mode %lo] ",
- (int) st->st_uid, (int) st->st_nlink,
- (u_long) st->st_mode, (u_long) mode);
- if ((st->st_uid == uid || st->st_uid == 0 ||
- st->st_uid == TrustedUid ||
- !bitset(SFF_MUSTOWN, flags)) &&
- (st->st_mode & mode) == mode)
- {
- if (tTd(44, 4))
- printf("\tOK\n");
- return 0;
- }
- if (tTd(44, 4))
- printf("\tEACCES\n");
- return EACCES;
-}
-\f/*
-** SAFEDIRPATH -- check to make sure a path to a directory is safe
-**
-** Safe means not writable and owned by the right folks.
-**
-** Parameters:
-** fn -- filename to check.
-** uid -- user id to compare against.
-** gid -- group id to compare against.
-** uname -- user name to compare against (used for group
-** sets).
-** flags -- modifiers:
-** SFF_ROOTOK -- ok to use root permissions to open.
-** SFF_SAFEDIRPATH -- writable directories are considered
-** to be fatal errors.
-**
-** Returns:
-** 0 -- if the directory path is "safe".
-** else -- an error number associated with the path.
-*/
-
-int
-safedirpath(fn, uid, gid, uname, flags)
- char *fn;
- UID_T uid;
- GID_T gid;
- char *uname;
- int flags;
-{
- char *p;
- register struct group *gr = NULL;
- int ret = 0;
- int mode = S_IWOTH;
- struct stat stbuf;
-
- /* special case root directory */
- if (*fn == '\0')
- fn = "/";
-
- if (tTd(44, 4))
- printf("safedirpath(%s, uid=%ld, gid=%ld, flags=%x):\n",
- fn, (long) uid, (long) gid, flags);
-
- if (!bitset(DBS_GROUPWRITABLEDIRPATHSAFE, DontBlameSendmail))
- mode |= S_IWGRP;
-
- p = fn;
- do
- {
- if (*p == '\0')
- *p = '/';
- p = strchr(++p, '/');
- if (p != NULL)
- *p = '\0';
- if (stat(fn, &stbuf) < 0)
- {
- ret = errno;
- break;
- }
- if ((uid == 0 || bitset(SFF_SAFEDIRPATH, flags)) &&
- bitset(mode, stbuf.st_mode))
- {
- if (tTd(44, 4))
- printf("\t[dir %s] mode %lo\n",
- fn, (u_long) stbuf.st_mode);
- if (bitset(SFF_SAFEDIRPATH, flags))
- {
- if (bitset(S_IWOTH, stbuf.st_mode))
- ret = E_SM_WWDIR;
- else
- ret = E_SM_GWDIR;
- break;
- }
- if (Verbose > 1)
- message("051 WARNING: %s writable directory %s",
- bitset(S_IWOTH, stbuf.st_mode)
- ? "World"
- : "Group",
- fn);
- }
- if (uid == 0 && !bitset(SFF_ROOTOK|SFF_OPENASROOT, flags))
- {
- if (bitset(S_IXOTH, stbuf.st_mode))
- continue;
- ret = EACCES;
- break;
- }
-
- /*
- ** Let OS determine access to file if we are not
- ** running as a privileged user. This allows ACLs
- ** to work.
- */
- if (geteuid() != 0)
- continue;
-
- if (stbuf.st_uid == uid &&
- bitset(S_IXUSR, stbuf.st_mode))
- continue;
- if (stbuf.st_gid == gid &&
- bitset(S_IXGRP, stbuf.st_mode))
- continue;
-#ifndef NO_GROUP_SET
- if (uname != NULL && !DontInitGroups &&
- ((gr != NULL && gr->gr_gid == stbuf.st_gid) ||
- (gr = getgrgid(stbuf.st_gid)) != NULL))
- {
- register char **gp;
-
- for (gp = gr->gr_mem; gp != NULL && *gp != NULL; gp++)
- if (strcmp(*gp, uname) == 0)
- break;
- if (gp != NULL && *gp != NULL &&
- bitset(S_IXGRP, stbuf.st_mode))
- continue;
- }
-#endif
- if (!bitset(S_IXOTH, stbuf.st_mode))
- {
- ret = EACCES;
- break;
- }
- } while (p != NULL);
- if (ret != 0 && tTd(44, 4))
- printf("\t[dir %s] %s\n", fn, errstring(ret));
- if (p != NULL)
- *p = '/';
- return ret;
-}
-\f/*
-** SAFEOPEN -- do a file open with extra checking
-**
-** Parameters:
-** fn -- the file name to open.
-** omode -- the open-style mode flags.
-** cmode -- the create-style mode flags.
-** sff -- safefile flags.
-**
-** Returns:
-** Same as open.
-*/
-
-#ifndef O_ACCMODE
-# define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
-#endif
-
-int
-safeopen(fn, omode, cmode, sff)
- char *fn;
- int omode;
- int cmode;
- int sff;
-{
- int rval;
- int fd;
- int smode;
- struct stat stb;
-
- if (bitset(O_CREAT, omode))
- sff |= SFF_CREAT;
- omode &= ~O_CREAT;
- smode = 0;
- switch (omode & O_ACCMODE)
- {
- case O_RDONLY:
- smode = S_IREAD;
- break;
-
- case O_WRONLY:
- smode = S_IWRITE;
- break;
-
- case O_RDWR:
- smode = S_IREAD|S_IWRITE;
- break;
-
- default:
- smode = 0;
- break;
- }
- if (bitset(SFF_OPENASROOT, sff))
- rval = safefile(fn, RunAsUid, RunAsGid, RunAsUserName,
- sff, smode, &stb);
- else
- rval = safefile(fn, RealUid, RealGid, RealUserName,
- sff, smode, &stb);
- if (rval != 0)
- {
- errno = rval;
- return -1;
- }
- if (stb.st_mode == ST_MODE_NOFILE && bitset(SFF_CREAT, sff))
- omode |= O_EXCL|O_CREAT;
-
- fd = dfopen(fn, omode, cmode, sff);
- if (fd < 0)
- return fd;
- if (filechanged(fn, fd, &stb))
- {
- syserr("554 cannot open: file %s changed after open", fn);
- close(fd);
- errno = E_SM_FILECHANGE;
- return -1;
- }
- return fd;
-}
-\f/*
-** SAFEFOPEN -- do a file open with extra checking
-**
-** Parameters:
-** fn -- the file name to open.
-** omode -- the open-style mode flags.
-** cmode -- the create-style mode flags.
-** sff -- safefile flags.
-**
-** Returns:
-** Same as fopen.
-*/
-
-FILE *
-safefopen(fn, omode, cmode, sff)
- char *fn;
- int omode;
- int cmode;
- int sff;
-{
- int fd;
- FILE *fp;
- char *fmode;
-
- switch (omode & O_ACCMODE)
- {
- case O_RDONLY:
- fmode = "r";
- break;
-
- case O_WRONLY:
- if (bitset(O_APPEND, omode))
- fmode = "a";
- else
- fmode = "w";
- break;
-
- case O_RDWR:
- if (bitset(O_TRUNC, omode))
- fmode = "w+";
- else if (bitset(O_APPEND, omode))
- fmode = "a+";
- else
- fmode = "r+";
- break;
-
- default:
- syserr("safefopen: unknown omode %o", omode);
- fmode = "x";
- }
- fd = safeopen(fn, omode, cmode, sff);
- if (fd < 0)
- {
- if (tTd(44, 10))
- printf("safefopen: safeopen failed: %s\n",
- errstring(errno));
- return NULL;
- }
- fp = fdopen(fd, fmode);
- if (fp != NULL)
- return fp;
-
- if (tTd(44, 10))
- {
- printf("safefopen: fdopen(%s, %s) failed: omode=%x, sff=%x, err=%s\n",
- fn, fmode, omode, sff, errstring(errno));
-#ifndef NOT_SENDMAIL
- dumpfd(fd, TRUE, FALSE);
-#endif
- }
- (void) close(fd);
- return NULL;
-}
-\f/*
-** FILECHANGED -- check to see if file changed after being opened
-**
-** Parameters:
-** fn -- pathname of file to check.
-** fd -- file descriptor to check.
-** stb -- stat structure from before open.
-**
-** Returns:
-** TRUE -- if a problem was detected.
-** FALSE -- if this file is still the same.
-*/
-
-bool
-filechanged(fn, fd, stb)
- char *fn;
- int fd;
- struct stat *stb;
-{
- struct stat sta;
-
- if (stb->st_mode == ST_MODE_NOFILE)
- {
-#if HASLSTAT && BOGUS_O_EXCL
- /* only necessary if exclusive open follows symbolic links */
- if (lstat(fn, stb) < 0 || stb->st_nlink != 1)
- return TRUE;
-#else
- return FALSE;
-#endif
- }
- if (fstat(fd, &sta) < 0)
- return TRUE;
-
- if (sta.st_nlink != stb->st_nlink ||
- sta.st_dev != stb->st_dev ||
- sta.st_ino != stb->st_ino ||
-#if HAS_ST_GEN && 0 /* AFS returns garbage in st_gen */
- sta.st_gen != stb->st_gen ||
-#endif
- sta.st_uid != stb->st_uid ||
- sta.st_gid != stb->st_gid)
- {
- if (tTd(44, 8))
- {
- printf("File changed after opening:\n");
- printf(" nlink = %ld/%ld\n",
- (long) stb->st_nlink, (long) sta.st_nlink);
- printf(" dev = %ld/%ld\n",
- (long) stb->st_dev, (long) sta.st_dev);
- if (sizeof sta.st_ino > sizeof (long))
- {
- printf(" ino = %s/",
- quad_to_string(stb->st_ino));
- printf("%s\n",
- quad_to_string(sta.st_ino));
- }
- else
- printf(" ino = %lu/%lu\n",
- (unsigned long) stb->st_ino,
- (unsigned long) sta.st_ino);
-#if HAS_ST_GEN
- printf(" gen = %ld/%ld\n",
- (long) stb->st_gen, (long) sta.st_gen);
-#endif
- printf(" uid = %ld/%ld\n",
- (long) stb->st_uid, (long) sta.st_uid);
- printf(" gid = %ld/%ld\n",
- (long) stb->st_gid, (long) sta.st_gid);
- }
- return TRUE;
- }
-
- return FALSE;
-}
-\f/*
-** DFOPEN -- determined file open
-**
-** This routine has the semantics of open, except that it will
-** keep trying a few times to make this happen. The idea is that
-** on very loaded systems, we may run out of resources (inodes,
-** whatever), so this tries to get around it.
-*/
-
-int
-dfopen(filename, omode, cmode, sff)
- char *filename;
- int omode;
- int cmode;
- int sff;
-{
- register int tries;
- int fd;
- struct stat st;
-
- for (tries = 0; tries < 10; tries++)
- {
- sleep((unsigned) (10 * tries));
- errno = 0;
- fd = open(filename, omode, cmode);
- if (fd >= 0)
- break;
- switch (errno)
- {
- case ENFILE: /* system file table full */
- case EINTR: /* interrupted syscall */
-#ifdef ETXTBSY
- case ETXTBSY: /* Apollo: net file locked */
-#endif
- continue;
- }
- break;
- }
- if (!bitset(SFF_NOLOCK, sff) &&
- fd >= 0 &&
- fstat(fd, &st) >= 0 &&
- S_ISREG(st.st_mode))
- {
- int locktype;
-
- /* lock the file to avoid accidental conflicts */
- if ((omode & O_ACCMODE) != O_RDONLY)
- locktype = LOCK_EX;
- else
- locktype = LOCK_SH;
- (void) lockfile(fd, filename, NULL, locktype);
- errno = 0;
- }
- return fd;
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)savemail.c 8.140 (Berkeley) 1/18/1999";
-#endif /* not lint */
-
-# include "sendmail.h"
-
-/*
-** SAVEMAIL -- Save mail on error
-**
-** If mailing back errors, mail it back to the originator
-** together with an error message; otherwise, just put it in
-** dead.letter in the user's home directory (if he exists on
-** this machine).
-**
-** Parameters:
-** e -- the envelope containing the message in error.
-** sendbody -- if TRUE, also send back the body of the
-** message; otherwise just send the header.
-**
-** Returns:
-** none
-**
-** Side Effects:
-** Saves the letter, by writing or mailing it back to the
-** sender, or by putting it in dead.letter in her home
-** directory.
-*/
-
-/* defines for state machine */
-# define ESM_REPORT 0 /* report to sender's terminal */
-# define ESM_MAIL 1 /* mail back to sender */
-# define ESM_QUIET 2 /* messages have already been returned */
-# define ESM_DEADLETTER 3 /* save in ~/dead.letter */
-# define ESM_POSTMASTER 4 /* return to postmaster */
-# define ESM_USRTMP 5 /* save in /usr/tmp/dead.letter */
-# define ESM_PANIC 6 /* leave the locked queue/transcript files */
-# define ESM_DONE 7 /* the message is successfully delivered */
-
-
-void
-savemail(e, sendbody)
- register ENVELOPE *e;
- bool sendbody;
-{
- register struct passwd *pw;
- register FILE *fp;
- int state;
- auto ADDRESS *q = NULL;
- register char *p;
- MCI mcibuf;
- int flags;
- char buf[MAXLINE+1];
- extern char *ttypath __P((void));
- extern bool writable __P((char *, ADDRESS *, int));
-
- if (tTd(6, 1))
- {
- printf("\nsavemail, errormode = %c, id = %s, ExitStat = %d\n e_from=",
- e->e_errormode, e->e_id == NULL ? "NONE" : e->e_id,
- ExitStat);
- printaddr(&e->e_from, FALSE);
- }
-
- if (e->e_id == NULL)
- {
- /* can't return a message with no id */
- return;
- }
-
- /*
- ** In the unhappy event we don't know who to return the mail
- ** to, make someone up.
- */
-
- if (e->e_from.q_paddr == NULL)
- {
- e->e_sender = "Postmaster";
- if (parseaddr(e->e_sender, &e->e_from,
- RF_COPYPARSE|RF_SENDERADDR, '\0', NULL, e) == NULL)
- {
- syserr("553 Cannot parse Postmaster!");
- finis(TRUE, EX_SOFTWARE);
- }
- }
- e->e_to = NULL;
-
- /*
- ** Basic state machine.
- **
- ** This machine runs through the following states:
- **
- ** ESM_QUIET Errors have already been printed iff the
- ** sender is local.
- ** ESM_REPORT Report directly to the sender's terminal.
- ** ESM_MAIL Mail response to the sender.
- ** ESM_DEADLETTER Save response in ~/dead.letter.
- ** ESM_POSTMASTER Mail response to the postmaster.
- ** ESM_PANIC Save response anywhere possible.
- */
-
- /* determine starting state */
- switch (e->e_errormode)
- {
- case EM_WRITE:
- state = ESM_REPORT;
- break;
-
- case EM_BERKNET:
- case EM_MAIL:
- state = ESM_MAIL;
- break;
-
- case EM_PRINT:
- case '\0':
- state = ESM_QUIET;
- break;
-
- case EM_QUIET:
- /* no need to return anything at all */
- return;
-
- default:
- syserr("554 savemail: bogus errormode x%x\n", e->e_errormode);
- state = ESM_MAIL;
- break;
- }
-
- /* if this is already an error response, send to postmaster */
- if (bitset(EF_RESPONSE, e->e_flags))
- {
- if (e->e_parent != NULL &&
- bitset(EF_RESPONSE, e->e_parent->e_flags))
- {
- /* got an error sending a response -- can it */
- return;
- }
- state = ESM_POSTMASTER;
- }
-
- while (state != ESM_DONE)
- {
- if (tTd(6, 5))
- printf(" state %d\n", state);
-
- switch (state)
- {
- case ESM_QUIET:
- if (bitnset(M_LOCALMAILER, e->e_from.q_mailer->m_flags))
- state = ESM_DEADLETTER;
- else
- state = ESM_MAIL;
- break;
-
- case ESM_REPORT:
-
- /*
- ** If the user is still logged in on the same terminal,
- ** then write the error messages back to hir (sic).
- */
-
- p = ttypath();
- if (p == NULL || freopen(p, "w", stdout) == NULL)
- {
- state = ESM_MAIL;
- break;
- }
-
- expand("\201n", buf, sizeof buf, e);
- printf("\r\nMessage from %s...\r\n", buf);
- printf("Errors occurred while sending mail.\r\n");
- if (e->e_xfp != NULL)
- {
- (void) fflush(e->e_xfp);
- fp = fopen(queuename(e, 'x'), "r");
- }
- else
- fp = NULL;
- if (fp == NULL)
- {
- syserr("Cannot open %s", queuename(e, 'x'));
- printf("Transcript of session is unavailable.\r\n");
- }
- else
- {
- printf("Transcript follows:\r\n");
- while (fgets(buf, sizeof buf, fp) != NULL &&
- !ferror(stdout))
- fputs(buf, stdout);
- (void) xfclose(fp, "savemail transcript", e->e_id);
- }
- printf("Original message will be saved in dead.letter.\r\n");
- state = ESM_DEADLETTER;
- break;
-
- case ESM_MAIL:
- /*
- ** If mailing back, do it.
- ** Throw away all further output. Don't alias,
- ** since this could cause loops, e.g., if joe
- ** mails to joe@x, and for some reason the network
- ** for @x is down, then the response gets sent to
- ** joe@x, which gives a response, etc. Also force
- ** the mail to be delivered even if a version of
- ** it has already been sent to the sender.
- **
- ** If this is a configuration or local software
- ** error, send to the local postmaster as well,
- ** since the originator can't do anything
- ** about it anyway. Note that this is a full
- ** copy of the message (intentionally) so that
- ** the Postmaster can forward things along.
- */
-
- if (ExitStat == EX_CONFIG || ExitStat == EX_SOFTWARE)
- {
- (void) sendtolist("postmaster",
- NULLADDR, &e->e_errorqueue, 0, e);
- }
- if (!emptyaddr(&e->e_from))
- {
- char from[TOBUFSIZE];
- extern bool pruneroute __P((char *));
-
- if (strlen(e->e_from.q_paddr) + 1 > sizeof from)
- {
- state = ESM_POSTMASTER;
- break;
- }
- strcpy(from, e->e_from.q_paddr);
-
- if (!DontPruneRoutes && pruneroute(from))
- {
- ADDRESS *a;
-
- for (a = e->e_errorqueue; a != NULL;
- a = a->q_next)
- {
- if (sameaddr(a, &e->e_from))
- a->q_flags |= QDONTSEND;
- }
- }
- (void) sendtolist(from, NULLADDR,
- &e->e_errorqueue, 0, e);
- }
-
- /*
- ** Deliver a non-delivery report to the
- ** Postmaster-designate (not necessarily
- ** Postmaster). This does not include the
- ** body of the message, for privacy reasons.
- ** You really shouldn't need this.
- */
-
- e->e_flags |= EF_PM_NOTIFY;
-
- /* check to see if there are any good addresses */
- for (q = e->e_errorqueue; q != NULL; q = q->q_next)
- if (!bitset(QBADADDR|QDONTSEND, q->q_flags))
- break;
- if (q == NULL)
- {
- /* this is an error-error */
- state = ESM_POSTMASTER;
- break;
- }
- if (returntosender(e->e_message, e->e_errorqueue,
- sendbody ? RTSF_SEND_BODY
- : RTSF_NO_BODY,
- e) == 0)
- {
- state = ESM_DONE;
- break;
- }
-
- /* didn't work -- return to postmaster */
- state = ESM_POSTMASTER;
- break;
-
- case ESM_POSTMASTER:
- /*
- ** Similar to previous case, but to system postmaster.
- */
-
- q = NULL;
- if (sendtolist(DoubleBounceAddr,
- NULLADDR, &q, 0, e) <= 0)
- {
- syserr("553 cannot parse %s!", DoubleBounceAddr);
- ExitStat = EX_SOFTWARE;
- state = ESM_USRTMP;
- break;
- }
- flags = RTSF_PM_BOUNCE;
- if (sendbody)
- flags |= RTSF_SEND_BODY;
- if (returntosender(e->e_message, q, flags, e) == 0)
- {
- state = ESM_DONE;
- break;
- }
-
- /* didn't work -- last resort */
- state = ESM_USRTMP;
- break;
-
- case ESM_DEADLETTER:
- /*
- ** Save the message in dead.letter.
- ** If we weren't mailing back, and the user is
- ** local, we should save the message in
- ** ~/dead.letter so that the poor person doesn't
- ** have to type it over again -- and we all know
- ** what poor typists UNIX users are.
- */
-
- p = NULL;
- if (bitnset(M_HASPWENT, e->e_from.q_mailer->m_flags))
- {
- if (e->e_from.q_home != NULL)
- p = e->e_from.q_home;
- else if ((pw = sm_getpwnam(e->e_from.q_user)) != NULL)
- p = pw->pw_dir;
- }
- if (p == NULL || e->e_dfp == NULL)
- {
- /* no local directory or no data file */
- state = ESM_MAIL;
- break;
- }
-
- /* we have a home directory; write dead.letter */
- define('z', p, e);
- expand("\201z/dead.letter", buf, sizeof buf, e);
- flags = SFF_CREAT|SFF_REGONLY|SFF_RUNASREALUID;
- if (RealUid == 0)
- flags |= SFF_ROOTOK;
- e->e_to = buf;
- if (mailfile(buf, FileMailer, NULL, flags, e) == EX_OK)
- {
- int oldverb = Verbose;
-
- Verbose = 1;
- message("Saved message in %s", buf);
- Verbose = oldverb;
- state = ESM_DONE;
- break;
- }
- state = ESM_MAIL;
- break;
-
- case ESM_USRTMP:
- /*
- ** Log the mail in /usr/tmp/dead.letter.
- */
-
- if (e->e_class < 0)
- {
- state = ESM_DONE;
- break;
- }
-
- if ((SafeFileEnv != NULL && SafeFileEnv[0] != '\0') ||
- DeadLetterDrop == NULL || DeadLetterDrop[0] == '\0')
- {
- state = ESM_PANIC;
- break;
- }
-
- flags = SFF_CREAT|SFF_REGONLY|SFF_ROOTOK|SFF_OPENASROOT|SFF_MUSTOWN;
- if (!writable(DeadLetterDrop, NULL, flags) ||
- (fp = safefopen(DeadLetterDrop, O_WRONLY|O_APPEND,
- FileMode, flags)) == NULL)
- {
- state = ESM_PANIC;
- break;
- }
-
- bzero(&mcibuf, sizeof mcibuf);
- mcibuf.mci_out = fp;
- mcibuf.mci_mailer = FileMailer;
- if (bitnset(M_7BITS, FileMailer->m_flags))
- mcibuf.mci_flags |= MCIF_7BIT;
- mcibuf.mci_contentlen = 0;
-
- putfromline(&mcibuf, e);
- (*e->e_puthdr)(&mcibuf, e->e_header, e, M87F_OUTER);
- (*e->e_putbody)(&mcibuf, e, NULL);
- putline("\n", &mcibuf);
- (void) fflush(fp);
- if (ferror(fp))
- state = ESM_PANIC;
- else
- {
- int oldverb = Verbose;
-
- Verbose = 1;
- message("Saved message in %s", DeadLetterDrop);
- Verbose = oldverb;
- if (LogLevel > 3)
- sm_syslog(LOG_NOTICE, e->e_id,
- "Saved message in %s",
- DeadLetterDrop);
- state = ESM_DONE;
- }
- (void) xfclose(fp, "savemail", DeadLetterDrop);
- break;
-
- default:
- syserr("554 savemail: unknown state %d", state);
-
- /* fall through ... */
-
- case ESM_PANIC:
- /* leave the locked queue & transcript files around */
- loseqfile(e, "savemail panic");
- syserr("!554 savemail: cannot save rejected email anywhere");
- }
- }
-}
-\f/*
-** RETURNTOSENDER -- return a message to the sender with an error.
-**
-** Parameters:
-** msg -- the explanatory message.
-** returnq -- the queue of people to send the message to.
-** flags -- flags tweaking the operation:
-** RTSF_SENDBODY -- include body of message (otherwise
-** just send the header).
-** RTSF_PMBOUNCE -- this is a postmaster bounce.
-** e -- the current envelope.
-**
-** Returns:
-** zero -- if everything went ok.
-** else -- some error.
-**
-** Side Effects:
-** Returns the current message to the sender via
-** mail.
-*/
-
-#define MAXRETURNS 6 /* max depth of returning messages */
-#define ERRORFUDGE 100 /* nominal size of error message text */
-
-int
-returntosender(msg, returnq, flags, e)
- char *msg;
- ADDRESS *returnq;
- int flags;
- register ENVELOPE *e;
-{
- register ENVELOPE *ee;
- ENVELOPE *oldcur = CurEnv;
- ENVELOPE errenvelope;
- static int returndepth = 0;
- register ADDRESS *q;
- char *p;
- char buf[MAXNAME + 1];
- extern void errbody __P((MCI *, ENVELOPE *, char *));
-
- if (returnq == NULL)
- return (-1);
-
- if (msg == NULL)
- msg = "Unable to deliver mail";
-
- if (tTd(6, 1))
- {
- printf("\n*** Return To Sender: msg=\"%s\", depth=%d, e=%lx, returnq=",
- msg, returndepth, (u_long) e);
- printaddr(returnq, TRUE);
- if (tTd(6, 20))
- {
- printf("Sendq=");
- printaddr(e->e_sendqueue, TRUE);
- }
- }
-
- if (++returndepth >= MAXRETURNS)
- {
- if (returndepth != MAXRETURNS)
- syserr("554 returntosender: infinite recursion on %s", returnq->q_paddr);
- /* don't "unrecurse" and fake a clean exit */
- /* returndepth--; */
- return (0);
- }
-
- define('g', e->e_from.q_paddr, e);
- define('u', NULL, e);
-
- /* initialize error envelope */
- ee = newenvelope(&errenvelope, e);
- define('a', "\201b", ee);
- define('r', "internal", ee);
- define('s', "localhost", ee);
- define('_', "localhost", ee);
- ee->e_puthdr = putheader;
- ee->e_putbody = errbody;
- ee->e_flags |= EF_RESPONSE|EF_METOO;
- if (!bitset(EF_OLDSTYLE, e->e_flags))
- ee->e_flags &= ~EF_OLDSTYLE;
- ee->e_sendqueue = returnq;
- ee->e_msgsize = ERRORFUDGE;
- if (bitset(RTSF_SEND_BODY, flags))
- ee->e_msgsize += e->e_msgsize;
- else
- ee->e_flags |= EF_NO_BODY_RETN;
- initsys(ee);
- for (q = returnq; q != NULL; q = q->q_next)
- {
- if (bitset(QBADADDR, q->q_flags))
- continue;
-
- q->q_flags &= ~(QHASNOTIFY|Q_PINGFLAGS);
- q->q_flags |= QPINGONFAILURE;
-
- if (!bitset(QDONTSEND, q->q_flags))
- ee->e_nrcpts++;
-
- if (q->q_alias == NULL)
- addheader("To", q->q_paddr, &ee->e_header);
- }
-
- if (LogLevel > 5)
- {
- if (bitset(EF_RESPONSE|EF_WARNING, e->e_flags))
- p = "return to sender";
- else if (bitset(RTSF_PM_BOUNCE, flags))
- p = "postmaster notify";
- else
- p = "DSN";
- sm_syslog(LOG_INFO, e->e_id,
- "%s: %s: %s",
- ee->e_id, p, shortenstring(msg, MAXSHORTSTR));
- }
-
- if (SendMIMEErrors)
- {
- addheader("MIME-Version", "1.0", &ee->e_header);
-
- (void) snprintf(buf, sizeof buf, "%s.%ld/%.100s",
- ee->e_id, curtime(), MyHostName);
- ee->e_msgboundary = newstr(buf);
- (void) snprintf(buf, sizeof buf,
-#if DSN
- "multipart/report; report-type=delivery-status;\n\tboundary=\"%s\"",
-#else
- "multipart/mixed; boundary=\"%s\"",
-#endif
- ee->e_msgboundary);
- addheader("Content-Type", buf, &ee->e_header);
-
- p = hvalue("Content-Transfer-Encoding", e->e_header);
- if (p != NULL && strcasecmp(p, "binary") != 0)
- p = NULL;
- if (p == NULL && bitset(EF_HAS8BIT, e->e_flags))
- p = "8bit";
- if (p != NULL)
- addheader("Content-Transfer-Encoding", p, &ee->e_header);
- }
- if (strncmp(msg, "Warning:", 8) == 0)
- {
- addheader("Subject", msg, &ee->e_header);
- p = "warning-timeout";
- }
- else if (strncmp(msg, "Postmaster warning:", 19) == 0)
- {
- addheader("Subject", msg, &ee->e_header);
- p = "postmaster-warning";
- }
- else if (strcmp(msg, "Return receipt") == 0)
- {
- addheader("Subject", msg, &ee->e_header);
- p = "return-receipt";
- }
- else if (bitset(RTSF_PM_BOUNCE, flags))
- {
- snprintf(buf, sizeof buf, "Postmaster notify: %.*s",
- sizeof buf - 20, msg);
- addheader("Subject", buf, &ee->e_header);
- p = "postmaster-notification";
- }
- else
- {
- snprintf(buf, sizeof buf, "Returned mail: %.*s",
- sizeof buf - 20, msg);
- addheader("Subject", buf, &ee->e_header);
- p = "failure";
- }
- (void) snprintf(buf, sizeof buf, "auto-generated (%s)", p);
- addheader("Auto-Submitted", buf, &ee->e_header);
-
- /* fake up an address header for the from person */
- expand("\201n", buf, sizeof buf, e);
- if (parseaddr(buf, &ee->e_from, RF_COPYALL|RF_SENDERADDR, '\0', NULL, e) == NULL)
- {
- syserr("553 Can't parse myself!");
- ExitStat = EX_SOFTWARE;
- returndepth--;
- return (-1);
- }
- ee->e_from.q_flags &= ~(QHASNOTIFY|Q_PINGFLAGS);
- ee->e_from.q_flags |= QPINGONFAILURE;
- ee->e_sender = ee->e_from.q_paddr;
-
- /* push state into submessage */
- CurEnv = ee;
- define('f', "\201n", ee);
- define('x', "Mail Delivery Subsystem", ee);
- eatheader(ee, TRUE);
-
- /* mark statistics */
- markstats(ee, NULLADDR, FALSE);
-
- /* actually deliver the error message */
- sendall(ee, SM_DELIVER);
-
- /* restore state */
- dropenvelope(ee, TRUE);
- CurEnv = oldcur;
- returndepth--;
-
- /* check for delivery errors */
- if (ee->e_parent == NULL || !bitset(EF_RESPONSE, ee->e_parent->e_flags))
- return 0;
- for (q = ee->e_sendqueue; q != NULL; q = q->q_next)
- {
- if (bitset(QQUEUEUP|QSENT, q->q_flags))
- return 0;
- }
- return -1;
-}
-\f/*
-** ERRBODY -- output the body of an error message.
-**
-** Typically this is a copy of the transcript plus a copy of the
-** original offending message.
-**
-** Parameters:
-** mci -- the mailer connection information.
-** e -- the envelope we are working in.
-** separator -- any possible MIME separator.
-**
-** Returns:
-** none
-**
-** Side Effects:
-** Outputs the body of an error message.
-*/
-
-void
-errbody(mci, e, separator)
- register MCI *mci;
- register ENVELOPE *e;
- char *separator;
-{
- register FILE *xfile;
- char *p;
- register ADDRESS *q = NULL;
- bool printheader;
- bool sendbody;
- bool pm_notify;
- char buf[MAXLINE];
-
- if (bitset(MCIF_INHEADER, mci->mci_flags))
- {
- putline("", mci);
- mci->mci_flags &= ~MCIF_INHEADER;
- }
- if (e->e_parent == NULL)
- {
- syserr("errbody: null parent");
- putline(" ----- Original message lost -----\n", mci);
- return;
- }
-
- /*
- ** Output MIME header.
- */
-
- if (e->e_msgboundary != NULL)
- {
- putline("This is a MIME-encapsulated message", mci);
- putline("", mci);
- (void) snprintf(buf, sizeof buf, "--%s", e->e_msgboundary);
- putline(buf, mci);
- putline("", mci);
- }
-
- /*
- ** Output introductory information.
- */
-
- pm_notify = FALSE;
- p = hvalue("subject", e->e_header);
- if (p != NULL && strncmp(p, "Postmaster ", 11) == 0)
- pm_notify = TRUE;
- else
- {
- for (q = e->e_parent->e_sendqueue; q != NULL; q = q->q_next)
- if (bitset(QBADADDR, q->q_flags))
- break;
- }
- if (!pm_notify && q == NULL &&
- !bitset(EF_FATALERRS|EF_SENDRECEIPT, e->e_parent->e_flags))
- {
- putline(" **********************************************",
- mci);
- putline(" ** THIS IS A WARNING MESSAGE ONLY **",
- mci);
- putline(" ** YOU DO NOT NEED TO RESEND YOUR MESSAGE **",
- mci);
- putline(" **********************************************",
- mci);
- putline("", mci);
- }
- snprintf(buf, sizeof buf, "The original message was received at %s",
- arpadate(ctime(&e->e_parent->e_ctime)));
- putline(buf, mci);
- expand("from \201_", buf, sizeof buf, e->e_parent);
- putline(buf, mci);
- putline("", mci);
-
- /*
- ** Output error message header (if specified and available).
- */
-
- if (ErrMsgFile != NULL && !bitset(EF_SENDRECEIPT, e->e_parent->e_flags))
- {
- if (*ErrMsgFile == '/')
- {
- int sff = SFF_ROOTOK|SFF_REGONLY;
-
- if (DontLockReadFiles)
- sff |= SFF_NOLOCK;
- if (!bitset(DBS_ERRORHEADERINUNSAFEDIRPATH, DontBlameSendmail))
- sff |= SFF_SAFEDIRPATH;
- xfile = safefopen(ErrMsgFile, O_RDONLY, 0444, sff);
- if (xfile != NULL)
- {
- while (fgets(buf, sizeof buf, xfile) != NULL)
- {
- extern void translate_dollars __P((char *));
-
- translate_dollars(buf);
- expand(buf, buf, sizeof buf, e);
- putline(buf, mci);
- }
- (void) fclose(xfile);
- putline("\n", mci);
- }
- }
- else
- {
- expand(ErrMsgFile, buf, sizeof buf, e);
- putline(buf, mci);
- putline("", mci);
- }
- }
-
- /*
- ** Output message introduction
- */
-
- printheader = TRUE;
- for (q = e->e_parent->e_sendqueue; q != NULL; q = q->q_next)
- {
- if (!bitset(QBADADDR, q->q_flags) ||
- !bitset(QPINGONFAILURE, q->q_flags))
- continue;
-
- if (printheader)
- {
- putline(" ----- The following addresses had permanent fatal errors -----",
- mci);
- printheader = FALSE;
- }
-
- snprintf(buf, sizeof buf, "%s",
- shortenstring(q->q_paddr, MAXSHORTSTR));
- putline(buf, mci);
- if (q->q_alias != NULL)
- {
- snprintf(buf, sizeof buf, " (expanded from: %s)",
- shortenstring(q->q_alias->q_paddr, MAXSHORTSTR));
- putline(buf, mci);
- }
- }
- if (!printheader)
- putline("", mci);
-
- printheader = TRUE;
- for (q = e->e_parent->e_sendqueue; q != NULL; q = q->q_next)
- {
- if (bitset(QBADADDR, q->q_flags) ||
- !bitset(QPRIMARY, q->q_flags) ||
- !bitset(QDELAYED, q->q_flags))
- continue;
-
- if (printheader)
- {
- putline(" ----- The following addresses had transient non-fatal errors -----",
- mci);
- printheader = FALSE;
- }
-
- snprintf(buf, sizeof buf, "%s",
- shortenstring(q->q_paddr, MAXSHORTSTR));
- putline(buf, mci);
- if (q->q_alias != NULL)
- {
- snprintf(buf, sizeof buf, " (expanded from: %s)",
- shortenstring(q->q_alias->q_paddr, MAXSHORTSTR));
- putline(buf, mci);
- }
- }
- if (!printheader)
- putline("", mci);
-
- printheader = TRUE;
- for (q = e->e_parent->e_sendqueue; q != NULL; q = q->q_next)
- {
- if (bitset(QBADADDR, q->q_flags) ||
- !bitset(QPRIMARY, q->q_flags) ||
- bitset(QDELAYED, q->q_flags))
- continue;
- else if (!bitset(QPINGONSUCCESS, q->q_flags))
- continue;
- else if (bitset(QRELAYED, q->q_flags))
- p = "relayed to non-DSN-aware mailer";
- else if (bitset(QDELIVERED, q->q_flags))
- {
- if (bitset(QEXPANDED, q->q_flags))
- p = "successfully delivered to mailing list";
- else
- p = "successfully delivered to mailbox";
- }
- else if (bitset(QEXPANDED, q->q_flags))
- p = "expanded by alias";
- else
- continue;
-
- if (printheader)
- {
- putline(" ----- The following addresses had successful delivery notifications -----",
- mci);
- printheader = FALSE;
- }
-
- snprintf(buf, sizeof buf, "%s (%s)",
- shortenstring(q->q_paddr, MAXSHORTSTR), p);
- putline(buf, mci);
- if (q->q_alias != NULL)
- {
- snprintf(buf, sizeof buf, " (expanded from: %s)",
- shortenstring(q->q_alias->q_paddr, MAXSHORTSTR));
- putline(buf, mci);
- }
- }
- if (!printheader)
- putline("", mci);
-
- /*
- ** Output transcript of errors
- */
-
- (void) fflush(stdout);
- p = queuename(e->e_parent, 'x');
- if ((xfile = fopen(p, "r")) == NULL)
- {
- syserr("Cannot open %s", p);
- putline(" ----- Transcript of session is unavailable -----\n", mci);
- }
- else
- {
- printheader = TRUE;
- if (e->e_xfp != NULL)
- (void) fflush(e->e_xfp);
- while (fgets(buf, sizeof buf, xfile) != NULL)
- {
- if (printheader)
- putline(" ----- Transcript of session follows -----\n", mci);
- printheader = FALSE;
- putline(buf, mci);
- }
- (void) xfclose(xfile, "errbody xscript", p);
- }
- errno = 0;
-
-#if DSN
- /*
- ** Output machine-readable version.
- */
-
- if (e->e_msgboundary != NULL)
- {
- putline("", mci);
- (void) snprintf(buf, sizeof buf, "--%s", e->e_msgboundary);
- putline(buf, mci);
- putline("Content-Type: message/delivery-status", mci);
- putline("", mci);
-
- /*
- ** Output per-message information.
- */
-
- /* original envelope id from MAIL FROM: line */
- if (e->e_parent->e_envid != NULL)
- {
- (void) snprintf(buf, sizeof buf, "Original-Envelope-Id: %.800s",
- xuntextify(e->e_parent->e_envid));
- putline(buf, mci);
- }
-
- /* Reporting-MTA: is us (required) */
- (void) snprintf(buf, sizeof buf, "Reporting-MTA: dns; %.800s", MyHostName);
- putline(buf, mci);
-
- /* DSN-Gateway: not relevant since we are not translating */
-
- /* Received-From-MTA: shows where we got this message from */
- if (RealHostName != NULL)
- {
- /* XXX use $s for type? */
- if (e->e_parent->e_from.q_mailer == NULL ||
- (p = e->e_parent->e_from.q_mailer->m_mtatype) == NULL)
- p = "dns";
- (void) snprintf(buf, sizeof buf, "Received-From-MTA: %s; %.800s",
- p, RealHostName);
- putline(buf, mci);
- }
-
- /* Arrival-Date: -- when it arrived here */
- (void) snprintf(buf, sizeof buf, "Arrival-Date: %s",
- arpadate(ctime(&e->e_parent->e_ctime)));
- putline(buf, mci);
-
- /*
- ** Output per-address information.
- */
-
- for (q = e->e_parent->e_sendqueue; q != NULL; q = q->q_next)
- {
- register ADDRESS *r;
- char *action;
-
- if (bitset(QBADADDR, q->q_flags))
- action = "failed";
- else if (!bitset(QPRIMARY, q->q_flags))
- continue;
- else if (bitset(QDELIVERED, q->q_flags))
- {
- if (bitset(QEXPANDED, q->q_flags))
- action = "delivered (to mailing list)";
- else
- action = "delivered (to mailbox)";
- }
- else if (bitset(QRELAYED, q->q_flags))
- action = "relayed (to non-DSN-aware mailer)";
- else if (bitset(QEXPANDED, q->q_flags))
- action = "expanded (to multi-recipient alias)";
- else if (bitset(QDELAYED, q->q_flags))
- action = "delayed";
- else
- continue;
-
- putline("", mci);
-
- /* Original-Recipient: -- passed from on high */
- if (q->q_orcpt != NULL)
- {
- (void) snprintf(buf, sizeof buf, "Original-Recipient: %.800s",
- q->q_orcpt);
- putline(buf, mci);
- }
-
- /* Final-Recipient: -- the name from the RCPT command */
- p = e->e_parent->e_from.q_mailer->m_addrtype;
- if (p == NULL)
- p = "rfc822";
- for (r = q; r->q_alias != NULL; r = r->q_alias)
- continue;
- if (strchr(r->q_user, '@') != NULL)
- {
- (void) snprintf(buf, sizeof buf,
- "Final-Recipient: %s; %.800s",
- p, r->q_user);
- }
- else if (strchr(r->q_paddr, '@') != NULL)
- {
- (void) snprintf(buf, sizeof buf,
- "Final-Recipient: %s; %.800s",
- p, r->q_paddr);
- }
- else
- {
- (void) snprintf(buf, sizeof buf,
- "Final-Recipient: %s; %.700s@%.100s",
- p, r->q_user, MyHostName);
- }
- putline(buf, mci);
-
- /* X-Actual-Recipient: -- the real problem address */
- if (r != q && q->q_user[0] != '\0')
- {
- if (strchr(q->q_user, '@') == NULL)
- {
- (void) snprintf(buf, sizeof buf,
- "X-Actual-Recipient: %s; %.700s@%.100s",
- p, q->q_user, MyHostName);
- }
- else
- {
- (void) snprintf(buf, sizeof buf,
- "X-Actual-Recipient: %s; %.800s",
- p, q->q_user);
- }
- putline(buf, mci);
- }
-
- /* Action: -- what happened? */
- snprintf(buf, sizeof buf, "Action: %s", action);
- putline(buf, mci);
-
- /* Status: -- what _really_ happened? */
- if (q->q_status != NULL)
- p = q->q_status;
- else if (bitset(QBADADDR, q->q_flags))
- p = "5.0.0";
- else if (bitset(QQUEUEUP, q->q_flags))
- p = "4.0.0";
- else
- p = "2.0.0";
- snprintf(buf, sizeof buf, "Status: %s", p);
- putline(buf, mci);
-
- /* Remote-MTA: -- who was I talking to? */
- if (q->q_statmta != NULL)
- {
- if (q->q_mailer == NULL ||
- (p = q->q_mailer->m_mtatype) == NULL)
- p = "dns";
- (void) snprintf(buf, sizeof buf,
- "Remote-MTA: %s; %.800s",
- p, q->q_statmta);
- p = &buf[strlen(buf) - 1];
- if (*p == '.')
- *p = '\0';
- putline(buf, mci);
- }
-
- /* Diagnostic-Code: -- actual result from other end */
- if (q->q_rstatus != NULL)
- {
- p = q->q_mailer->m_diagtype;
- if (p == NULL)
- p = "smtp";
- (void) snprintf(buf, sizeof buf,
- "Diagnostic-Code: %s; %.800s",
- p, q->q_rstatus);
- putline(buf, mci);
- }
-
- /* Last-Attempt-Date: -- fine granularity */
- if (q->q_statdate == (time_t) 0L)
- q->q_statdate = curtime();
- (void) snprintf(buf, sizeof buf,
- "Last-Attempt-Date: %s",
- arpadate(ctime(&q->q_statdate)));
- putline(buf, mci);
-
- /* Will-Retry-Until: -- for delayed messages only */
- if (bitset(QQUEUEUP, q->q_flags) &&
- !bitset(QBADADDR, q->q_flags))
- {
- time_t xdate;
-
- xdate = e->e_parent->e_ctime +
- TimeOuts.to_q_return[e->e_parent->e_timeoutclass];
- snprintf(buf, sizeof buf,
- "Will-Retry-Until: %s",
- arpadate(ctime(&xdate)));
- putline(buf, mci);
- }
- }
- }
-#endif
-
- /*
- ** Output text of original message
- */
-
- putline("", mci);
- if (bitset(EF_HAS_DF, e->e_parent->e_flags))
- {
- sendbody = !bitset(EF_NO_BODY_RETN, e->e_parent->e_flags) &&
- !bitset(EF_NO_BODY_RETN, e->e_flags);
-
- if (e->e_msgboundary == NULL)
- {
- if (sendbody)
- putline(" ----- Original message follows -----\n", mci);
- else
- putline(" ----- Message header follows -----\n", mci);
- (void) fflush(mci->mci_out);
- }
- else
- {
- (void) snprintf(buf, sizeof buf, "--%s",
- e->e_msgboundary);
-
- putline(buf, mci);
- (void) snprintf(buf, sizeof buf, "Content-Type: %s",
- sendbody ? "message/rfc822"
- : "text/rfc822-headers");
- putline(buf, mci);
-
- p = hvalue("Content-Transfer-Encoding", e->e_parent->e_header);
- if (p != NULL && strcasecmp(p, "binary") != 0)
- p = NULL;
- if (p == NULL && bitset(EF_HAS8BIT, e->e_parent->e_flags))
- p = "8bit";
- if (p != NULL)
- {
- (void) snprintf(buf, sizeof buf, "Content-Transfer-Encoding: %s",
- p);
- putline(buf, mci);
- }
- }
- putline("", mci);
- putheader(mci, e->e_parent->e_header, e->e_parent, M87F_OUTER);
- if (sendbody)
- putbody(mci, e->e_parent, e->e_msgboundary);
- else if (e->e_msgboundary == NULL)
- {
- putline("", mci);
- putline(" ----- Message body suppressed -----", mci);
- }
- }
- else if (e->e_msgboundary == NULL)
- {
- putline(" ----- No message was collected -----\n", mci);
- }
-
- if (e->e_msgboundary != NULL)
- {
- putline("", mci);
- (void) snprintf(buf, sizeof buf, "--%s--", e->e_msgboundary);
- putline(buf, mci);
- }
- putline("", mci);
-
- /*
- ** Cleanup and exit
- */
-
- if (errno != 0)
- syserr("errbody: I/O error");
-}
-\f/*
-** SMTPTODSN -- convert SMTP to DSN status code
-**
-** Parameters:
-** smtpstat -- the smtp status code (e.g., 550).
-**
-** Returns:
-** The DSN version of the status code.
-*/
-
-char *
-smtptodsn(smtpstat)
- int smtpstat;
-{
- if (smtpstat < 0)
- return "4.4.2";
-
- switch (smtpstat)
- {
- case 450: /* Req mail action not taken: mailbox unavailable */
- return "4.2.0";
-
- case 451: /* Req action aborted: local error in processing */
- return "4.3.0";
-
- case 452: /* Req action not taken: insufficient sys storage */
- return "4.3.1";
-
- case 500: /* Syntax error, command unrecognized */
- return "5.5.2";
-
- case 501: /* Syntax error in parameters or arguments */
- return "5.5.4";
-
- case 502: /* Command not implemented */
- return "5.5.1";
-
- case 503: /* Bad sequence of commands */
- return "5.5.1";
-
- case 504: /* Command parameter not implemented */
- return "5.5.4";
-
- case 550: /* Req mail action not taken: mailbox unavailable */
- return "5.2.0";
-
- case 551: /* User not local; please try <...> */
- return "5.1.6";
-
- case 552: /* Req mail action aborted: exceeded storage alloc */
- return "5.2.2";
-
- case 553: /* Req action not taken: mailbox name not allowed */
- return "5.1.0";
-
- case 554: /* Transaction failed */
- return "5.0.0";
- }
-
- if ((smtpstat / 100) == 2)
- return "2.0.0";
- if ((smtpstat / 100) == 4)
- return "4.0.0";
- return "5.0.0";
-}
-\f/*
-** XTEXTIFY -- take regular text and turn it into DSN-style xtext
-**
-** Parameters:
-** t -- the text to convert.
-** taboo -- additional characters that must be encoded.
-**
-** Returns:
-** The xtext-ified version of the same string.
-*/
-
-char *
-xtextify(t, taboo)
- register char *t;
- char *taboo;
-{
- register char *p;
- int l;
- int nbogus;
- static char *bp = NULL;
- static int bplen = 0;
-
- if (taboo == NULL)
- taboo = "";
-
- /* figure out how long this xtext will have to be */
- nbogus = l = 0;
- for (p = t; *p != '\0'; p++)
- {
- register int c = (*p & 0xff);
-
- /* ASCII dependence here -- this is the way the spec words it */
- if (c < '!' || c > '~' || c == '+' || c == '\\' || c == '(' ||
- strchr(taboo, c) != NULL)
- nbogus++;
- l++;
- }
- if (nbogus == 0)
- return t;
- l += nbogus * 2 + 1;
-
- /* now allocate space if necessary for the new string */
- if (l > bplen)
- {
- if (bp != NULL)
- free(bp);
- bp = xalloc(l);
- bplen = l;
- }
-
- /* ok, copy the text with byte expansion */
- for (p = bp; *t != '\0'; )
- {
- register int c = (*t++ & 0xff);
-
- /* ASCII dependence here -- this is the way the spec words it */
- if (c < '!' || c > '~' || c == '+' || c == '\\' || c == '(' ||
- strchr(taboo, c) != NULL)
- {
- *p++ = '+';
- *p++ = "0123456789abcdef"[c >> 4];
- *p++ = "0123456789abcdef"[c & 0xf];
- }
- else
- *p++ = c;
- }
- *p = '\0';
- return bp;
-}
-\f/*
-** XUNTEXTIFY -- take xtext and turn it into plain text
-**
-** Parameters:
-** t -- the xtextified text.
-**
-** Returns:
-** The decoded text. No attempt is made to deal with
-** null strings in the resulting text.
-*/
-
-char *
-xuntextify(t)
- register char *t;
-{
- register char *p;
- int l;
- static char *bp = NULL;
- static int bplen = 0;
-
- /* heuristic -- if no plus sign, just return the input */
- if (strchr(t, '+') == NULL)
- return t;
-
- /* xtext is always longer than decoded text */
- l = strlen(t);
- if (l > bplen)
- {
- if (bp != NULL)
- free(bp);
- bp = xalloc(l);
- bplen = l;
- }
-
- /* ok, copy the text with byte compression */
- for (p = bp; *t != '\0'; t++)
- {
- register int c = *t & 0xff;
-
- if (c != '+')
- {
- *p++ = c;
- continue;
- }
-
- c = *++t & 0xff;
- if (!isascii(c) || !isxdigit(c))
- {
- /* error -- first digit is not hex */
- usrerr("bogus xtext: +%c", c);
- t--;
- continue;
- }
- if (isdigit(c))
- c -= '0';
- else if (isupper(c))
- c -= 'A' - 10;
- else
- c -= 'a' - 10;
- *p = c << 4;
-
- c = *++t & 0xff;
- if (!isascii(c) || !isxdigit(c))
- {
- /* error -- second digit is not hex */
- usrerr("bogus xtext: +%x%c", *p >> 4, c);
- t--;
- continue;
- }
- if (isdigit(c))
- c -= '0';
- else if (isupper(c))
- c -= 'A' - 10;
- else
- c -= 'a' - 10;
- *p++ |= c;
- }
- *p = '\0';
- return bp;
-}
-\f/*
-** XTEXTOK -- check if a string is legal xtext
-**
-** Xtext is used in Delivery Status Notifications. The spec was
-** taken from RFC 1891, ``SMTP Service Extension for Delivery
-** Status Notifications''.
-**
-** Parameters:
-** s -- the string to check.
-**
-** Returns:
-** TRUE -- if 's' is legal xtext.
-** FALSE -- if it has any illegal characters in it.
-*/
-
-bool
-xtextok(s)
- char *s;
-{
- int c;
-
- while ((c = *s++) != '\0')
- {
- if (c == '+')
- {
- c = *s++;
- if (!isascii(c) || !isxdigit(c))
- return FALSE;
- c = *s++;
- if (!isascii(c) || !isxdigit(c))
- return FALSE;
- }
- else if (c < '!' || c > '~' || c == '=')
- return FALSE;
- }
- return TRUE;
-}
-\f/*
-** PRUNEROUTE -- prune an RFC-822 source route
-**
-** Trims down a source route to the last internet-registered hop.
-** This is encouraged by RFC 1123 section 5.3.3.
-**
-** Parameters:
-** addr -- the address
-**
-** Returns:
-** TRUE -- address was modified
-** FALSE -- address could not be pruned
-**
-** Side Effects:
-** modifies addr in-place
-*/
-
-bool
-pruneroute(addr)
- char *addr;
-{
-#if NAMED_BIND
- char *start, *at, *comma;
- char c;
- int rcode;
- int i;
- char hostbuf[BUFSIZ];
- char *mxhosts[MAXMXHOSTS + 1];
-
- /* check to see if this is really a route-addr */
- if (*addr != '<' || addr[1] != '@' || addr[strlen(addr) - 1] != '>')
- return FALSE;
- start = strchr(addr, ':');
- at = strrchr(addr, '@');
- if (start == NULL || at == NULL || at < start)
- return FALSE;
-
- /* slice off the angle brackets */
- i = strlen(at + 1);
- if (i >= (SIZE_T) sizeof hostbuf)
- return FALSE;
- strcpy(hostbuf, at + 1);
- hostbuf[i - 1] = '\0';
-
- while (start)
- {
- if (getmxrr(hostbuf, mxhosts, FALSE, &rcode) > 0)
- {
- strcpy(addr + 1, start + 1);
- return TRUE;
- }
- c = *start;
- *start = '\0';
- comma = strrchr(addr, ',');
- if (comma != NULL && comma[1] == '@' &&
- strlen(comma + 2) < (SIZE_T) sizeof hostbuf)
- strcpy(hostbuf, comma + 2);
- else
- comma = NULL;
- *start = c;
- start = comma;
- }
-#endif
- return FALSE;
-}
+++ /dev/null
-.\" Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-.\" Copyright (c) 1983, 1997 Eric P. Allman. All rights reserved.
-.\" Copyright (c) 1988, 1991, 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.
-.\"
-.\"
-.\" @(#)sendmail.8 8.20 (Berkeley) 8/2/1998
-.\"
-.Dd August 2, 1998
-.Dt SENDMAIL 8
-.Os
-.Sh NAME
-.Nm sendmail
-.Nd an electronic mail transport agent
-.Sh SYNOPSIS
-.Nm sendmail
-.Op Ar flags
-.Op Ar address ...
-.Nm newaliases
-.Nm mailq
-.Op Fl v
-.Sh DESCRIPTION
-.Nm Sendmail
-sends a message to one or more
-.Em recipients ,
-routing the message over whatever networks
-are necessary.
-.Nm Sendmail
-does internetwork forwarding as necessary
-to deliver the message to the correct place.
-.Pp
-.Nm Sendmail
-is not intended as a user interface routine;
-other programs provide user-friendly
-front ends;
-.Nm sendmail
-is used only to deliver pre-formatted messages.
-.Pp
-With no flags,
-.Nm sendmail
-reads its standard input
-up to an end-of-file
-or a line consisting only of a single dot
-and sends a copy of the message found there
-to all of the addresses listed.
-It determines the network(s) to use
-based on the syntax and contents of the addresses.
-.Pp
-Local addresses are looked up in a file
-and aliased appropriately.
-Aliasing can be prevented by preceding the address
-with a backslash.
-Normally the sender is not included in any alias
-expansions, e.g.,
-if `john' sends to `group',
-and `group' includes `john' in the expansion,
-then the letter will not be delivered to `john'.
-.Ss Parameters
-.Bl -tag -width Fl
-.It Fl B Ns Ar type
-Set the body type to
-.Ar type .
-Current legal values
-.Li 7BIT
-or
-.Li 8BITMIME .
-.It Fl ba
-Go into
-.Tn ARPANET
-mode.
-All input lines must end with a CR-LF,
-and all messages will be generated with a CR-LF at the end.
-Also,
-the ``From:'' and ``Sender:''
-fields are examined for the name of the sender.
-.It Fl bd
-Run as a daemon. This requires Berkeley
-.Tn IPC .
-.Nm Sendmail
-will fork and run in background
-listening on socket 25 for incoming
-.Tn SMTP
-connections.
-This is normally run from
-.Pa /etc/rc .
-.It Fl bD
-Same as
-.Fl bd
-except runs in foreground.
-.It Fl bh
-Print the persistent host status database.
-.It Fl bH
-Purge the persistent host status database.
-.It Fl bi
-Initialize the alias database.
-.It Fl bm
-Deliver mail in the usual way (default).
-.It Fl bp
-Print a listing of the queue.
-.It Fl bs
-Use the
-.Tn SMTP
-protocol as described in
-.Tn RFC821
-on standard input and output.
-This flag implies all the operations of the
-.Fl ba
-flag that are compatible with
-.Tn SMTP .
-.It Fl bt
-Run in address test mode.
-This mode reads addresses and shows the steps in parsing;
-it is used for debugging configuration tables.
-.It Fl bv
-Verify names only \- do not try to collect or deliver a message.
-Verify mode is normally used for validating
-users or mailing lists.
-.It Fl C Ns Ar file
-Use alternate configuration file.
-.Nm Sendmail
-refuses to run as root if an alternate configuration file is specified.
-.It Fl d Ns Ar X
-Set debugging value to
-.Ar X .
-.ne 1i
-.It Fl F Ns Ar fullname
-Set the full name of the sender.
-.It Fl f Ns Ar name
-Sets the name of the ``from'' person
-(i.e., the sender of the mail).
-.Fl f
-can only be used
-by ``trusted'' users
-(normally
-.Em root ,
-.Em daemon ,
-and
-.Em network )
-or if the person you are trying to become
-is the same as the person you are.
-.It Fl h Ns Ar N
-Set the hop count to
-.Ar N .
-The hop count is incremented every time the mail is
-processed.
-When it reaches a limit,
-the mail is returned with an error message,
-the victim of an aliasing loop.
-If not specified,
-``Received:'' lines in the message are counted.
-.It Fl i
-Ignore dots alone on lines by themselves in incoming messages.
-This should be set if you are reading data from a file.
-.It Fl N Ar dsn
-Set delivery status notification conditions to
-.Ar dsn ,
-which can be
-.Ql never
-for no notifications
-or a comma separated list of the values
-.Ql failure
-to be notified if delivery failed,
-.Ql delay
-to be notified if delivery is delayed, and
-.Ql success
-to be notified when the message is successfully delivered.
-.It Fl n
-Don't do aliasing.
-.It Fl O Ar option Ns = Ns Em value
-Set option
-.Ar option
-to the specified
-.Em value .
-This form uses long names.
-See below for more details.
-.It Fl o Ns Ar x Em value
-Set option
-.Ar x
-to the specified
-.Em value .
-This form uses single character names only.
-The short names are not described in this manual page;
-see the
-.%T "Sendmail Installation and Operation Guide"
-for details.
-.It Fl p Ns Ar protocol
-Set the name of the protocol used to receive the message.
-This can be a simple protocol name such as ``UUCP''
-or a protocol and hostname, such as ``UUCP:ucbvax''.
-.It Fl q Ns Bq Ar time
-Processed saved messages in the queue at given intervals.
-If
-.Ar time
-is omitted,
-process the queue once.
-.Xr Time
-is given as a tagged number,
-with
-.Ql s
-being seconds,
-.Ql m
-being minutes,
-.Ql h
-being hours,
-.Ql d
-being days,
-and
-.Ql w
-being weeks.
-For example,
-.Ql \-q1h30m
-or
-.Ql \-q90m
-would both set the timeout to one hour thirty minutes.
-If
-.Ar time
-is specified,
-.Nm sendmail
-will run in background.
-This option can be used safely with
-.Fl bd .
-.It Fl qI Ns Ar substr
-Limit processed jobs to those containing
-.Ar substr
-as a substring of the queue id.
-.It Fl qR Ns Ar substr
-Limit processed jobs to those containing
-.Ar substr
-as a substring of one of the recipients.
-.It Fl qS Ns Ar substr
-Limit processed jobs to those containing
-.Ar substr
-as a substring of the sender.
-.It Fl R Ar return
-Set the amount of the message to be returned
-if the message bounces.
-The
-.Ar return
-parameter can be
-.Ql full
-to return the entire message or
-.Ql hdrs
-to return only the headers.
-.It Fl r Ns Ar name
-An alternate and obsolete form of the
-.Fl f
-flag.
-.It Fl t
-Read message for recipients.
-To:, Cc:, and Bcc: lines will be scanned for recipient addresses.
-The Bcc: line will be deleted before transmission.
-.It Fl U
-Initial (user) submission.
-This should
-.Em always
-be set when called from a user agent such as
-.Nm Mail
-or
-.Nm exmh
-and
-.Em never
-be set when called by a network delivery agent such as
-.Nm rmail .
-.It Fl V Ar envid
-Set the original envelope id.
-This is propagated across SMTP to servers that support DSNs
-and is returned in DSN-compliant error messages.
-.It Fl v
-Go into verbose mode.
-Alias expansions will be announced, etc.
-.It Fl X Ar logfile
-Log all traffic in and out of mailers in the indicated log file.
-This should only be used as a last resort
-for debugging mailer bugs.
-It will log a lot of data very quickly.
-.It Fl -
-Stop processing command flags and use the rest of the arguments
-as addresses.
-.El
-.Ss Options
-There are also a number of processing options that may be set.
-Normally these will only be used by a system administrator.
-Options may be set either on the command line
-using the
-.Fl o
-flag (for short names),
-the
-.Fl O
-flag (for long names),
-or in the configuration file.
-This is a partial list limited to those options that are likely to be useful
-on the command line
-and only shows the long names;
-for a complete list (and details), consult the
-.%T "Sendmail Installation and Operation Guide" .
-The options are:
-.Bl -tag -width Fl
-.It Li AliasFile= Ns Ar file
-Use alternate alias file.
-.It Li HoldExpensive
-On mailers that are considered ``expensive'' to connect to,
-don't initiate immediate connection.
-This requires queueing.
-.It Li CheckpointInterval= Ns Ar N
-Checkpoint the queue file after every
-.Ar N
-successful deliveries (default 10).
-This avoids excessive duplicate deliveries
-when sending to long mailing lists
-interrupted by system crashes.
-.ne 1i
-.It Li DeliveryMode= Ns Ar x
-Set the delivery mode to
-.Ar x .
-Delivery modes are
-.Ql i
-for interactive (synchronous) delivery,
-.Ql b
-for background (asynchronous) delivery,
-.Ql q
-for queue only \- i.e.,
-actual delivery is done the next time the queue is run, and
-.Ql d
-for deferred \- the same as
-.Ql q
-except that database lookups (notably DNS and NIS lookups) are avoided.
-.It Li ErrorMode= Ns Ar x
-Set error processing to mode
-.Ar x .
-Valid modes are
-.Ql m
-to mail back the error message,
-.Ql w
-to ``write'' back the error message
-(or mail it back if the sender is not logged in),
-.Ql p
-to print the errors on the terminal
-(default),
-.Ql q
-to throw away error messages
-(only exit status is returned),
-and
-.Ql e
-to do special processing for the BerkNet.
-If the text of the message is not mailed back
-by
-modes
-.Ql m
-or
-.Ql w
-and if the sender is local to this machine,
-a copy of the message is appended to the file
-.Pa dead.letter
-in the sender's home directory.
-.It Li SaveFromLine
-Save
-.Tn UNIX Ns \-style
-From lines at the front of messages.
-.It Li MaxHopCount= Ar N
-The maximum number of times a message is allowed to ``hop''
-before we decide it is in a loop.
-.It Li IgnoreDots
-Do not take dots on a line by themselves
-as a message terminator.
-.It Li SendMimeErrors
-Send error messages in MIME format.
-If not set, the DSN (Delivery Status Notification) SMTP extension
-is disabled.
-.It Li ConnectionCacheTimeout= Ns Ar timeout
-Set connection cache timeout.
-.It Li ConnectionCacheSize= Ns Ar N
-Set connection cache size.
-.It Li LogLevel= Ns Ar n
-The log level.
-.It Li MeToo
-Send to ``me'' (the sender) also if I am in an alias expansion.
-.It Li CheckAliases
-Validate the right hand side of aliases during a
-.Xr newaliases 1
-command.
-.It Li OldStyleHeaders
-If set, this message may have
-old style headers.
-If not set,
-this message is guaranteed to have new style headers
-(i.e., commas instead of spaces between addresses).
-If set, an adaptive algorithm is used that will correctly
-determine the header format in most cases.
-.It Li QueueDirectory= Ns Ar queuedir
-Select the directory in which to queue messages.
-.It Li StatusFile= Ns Ar file
-Save statistics in the named file.
-.It Li Timeout.queuereturn= Ns Ar time
-Set the timeout on undelivered messages in the queue to the specified time.
-After delivery has failed
-(e.g., because of a host being down)
-for this amount of time,
-failed messages will be returned to the sender.
-The default is five days.
-.It Li UserDatabaseSpec= Ns Ar userdatabase
-If set, a user database is consulted to get forwarding information.
-You can consider this an adjunct to the aliasing mechanism,
-except that the database is intended to be distributed;
-aliases are local to a particular host.
-This may not be available if your sendmail does not have the
-.Dv USERDB
-option compiled in.
-.It Li ForkEachJob
-Fork each job during queue runs.
-May be convenient on memory-poor machines.
-.It Li SevenBitInput
-Strip incoming messages to seven bits.
-.It Li EightBitMode= Ns Ar mode
-Set the handling of eight bit input to seven bit destinations to
-.Ar mode :
-.Li m
-(mimefy) will convert to seven-bit MIME format,
-.Li p
-(pass) will pass it as eight bits (but violates protocols),
-and
-.Li s
-(strict) will bounce the message.
-.It Li MinQueueAge= Ns Ar timeout
-Sets how long a job must ferment in the queue between attempts to send it.
-.It Li DefaultCharSet= Ns Ar charset
-Sets the default character set used to label 8-bit data
-that is not otherwise labelled.
-.It Li DialDelay= Ns Ar sleeptime
-If opening a connection fails,
-sleep for
-.Ar sleeptime
-seconds and try again.
-Useful on dial-on-demand sites.
-.It Li NoRecipientAction= Ns Ar action
-Set the behaviour when there are no recipient headers (To:, Cc: or Bcc:)
-in the message to
-.Ar action :
-.Li none
-leaves the message unchanged,
-.Li add-to
-adds a To: header with the envelope recipients,
-.Li add-apparently-to
-adds an Apparently-To: header with the envelope recipients,
-.Li add-bcc
-adds an empty Bcc: header, and
-.Li add-to-undisclosed
-adds a header reading
-.Ql "To: undisclosed-recipients:;" .
-.It Li MaxDaemonChildren= Ns Ar N
-Sets the maximum number of children that an incoming SMTP daemon
-will allow to spawn at any time to
-.Ar N .
-.It Li ConnectionRateThrottle= Ns Ar N
-Sets the maximum number of connections per second to the SMTP port to
-.Ar N .
-.El
-.Pp
-In aliases,
-the first character of a name may be
-a vertical bar to cause interpretation of
-the rest of the name as a command
-to pipe the mail to.
-It may be necessary to quote the name
-to keep
-.Nm sendmail
-from suppressing the blanks from between arguments.
-For example, a common alias is:
-.Pp
-.Bd -literal -offset indent -compact
-msgs: "|/usr/bin/msgs -s"
-.Ed
-.Pp
-Aliases may also have the syntax
-.Dq :include: Ns Ar filename
-to ask
-.Xr sendmail
-to read the named file for a list of recipients.
-For example, an alias such as:
-.Pp
-.Bd -literal -offset indent -compact
-poets: ":include:/usr/local/lib/poets.list"
-.Ed
-.Pp
-would read
-.Pa /usr/local/lib/poets.list
-for the list of addresses making up the group.
-.Pp
-.Nm Sendmail
-returns an exit status
-describing what it did.
-The codes are defined in
-.Aq Pa sysexits.h :
-.Bl -tag -width EX_UNAVAILABLE -compact -offset indent
-.It Dv EX_OK
-Successful completion on all addresses.
-.It Dv EX_NOUSER
-User name not recognized.
-.It Dv EX_UNAVAILABLE
-Catchall meaning necessary resources
-were not available.
-.It Dv EX_SYNTAX
-Syntax error in address.
-.It Dv EX_SOFTWARE
-Internal software error,
-including bad arguments.
-.It Dv EX_OSERR
-Temporary operating system error,
-such as
-.Dq cannot fork .
-.It Dv EX_NOHOST
-Host name not recognized.
-.It Dv EX_TEMPFAIL
-Message could not be sent immediately,
-but was queued.
-.El
-.Pp
-If invoked as
-.Nm newaliases ,
-.Nm sendmail
-will rebuild the alias database.
-If invoked as
-.Nm mailq ,
-.Nm sendmail
-will print the contents of the mail queue.
-.Sh FILES
-Except for the file
-.Pa /etc/sendmail.cf
-itself and the daemon process ID file,
-the following pathnames are all specified in
-.Pa /etc/sendmail.cf .
-Thus, these values are only approximations.
-.Pp
-.Bl -tag -width /usr/lib/sendmail.fc -compact
-.It Pa /etc/aliases
-raw data for alias names
-.It Pa /etc/aliases.db
-data base of alias names
-.It Pa /etc/sendmail.cf
-configuration file
-.It Pa /etc/sendmail.hf
-help file
-.It Pa /var/log/sendmail.st
-collected statistics
-.It Pa /var/spool/mqueue/*
-temp files
-.El
-.Sh SEE ALSO
-.Xr mail 1 ,
-.Xr syslog 3 ,
-.Xr aliases 5 ,
-.Xr mailer.conf 5 ,
-.Xr mailaddr 7 ,
-.Xr rc 8 ,
-.Xr rmail 8
-.Pp
-DARPA
-Internet Request For Comments
-.%T RFC819 ,
-.%T RFC821 ,
-.%T RFC822 .
-.Rs
-.%T "Sendmail \- An Internetwork Mail Router"
-.%V SMM
-.%N \&No. 9
-.Re
-.Rs
-.%T "Sendmail Installation and Operation Guide"
-.%V SMM
-.%N \&No. 8
-.Re
-.Sh HISTORY
-The
-.Nm
-command appeared in
-.Bx 4.2 .
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- *
- * @(#)sendmail.h 8.295 (Berkeley) 1/26/1999
- */
-
-/*
-** SENDMAIL.H -- Global definitions for sendmail.
-*/
-
-# ifdef _DEFINE
-# define EXTERN
-# ifndef lint
-static char SmailSccsId[] = "@(#)sendmail.h 8.295 1/26/1999";
-# endif
-# else /* _DEFINE */
-# define EXTERN extern
-# endif /* _DEFINE */
-
-# include <unistd.h>
-# include <stddef.h>
-# include <stdlib.h>
-# include <stdio.h>
-# include <ctype.h>
-# include <setjmp.h>
-# include <string.h>
-# include <time.h>
-# include <errno.h>
-# ifdef EX_OK
-# undef EX_OK /* for SVr4.2 SMP */
-# endif
-# include <sysexits.h>
-
-# include "conf.h"
-# include "useful.h"
-
-# ifdef LOG
-# include <syslog.h>
-# endif /* LOG */
-
-# if NETINET || NETUNIX || NETISO || NETNS || NETX25
-# include <sys/socket.h>
-# endif
-# if NETUNIX
-# include <sys/un.h>
-# endif
-# if NETINET
-# include <netinet/in.h>
-# endif
-# if NETISO
-# include <netiso/iso.h>
-# endif
-# if NETNS
-# include <netns/ns.h>
-# endif
-# if NETX25
-# include <netccitt/x25.h>
-# endif
-
-#if NAMED_BIND
-# include <arpa/nameser.h>
-# ifdef NOERROR
-# undef NOERROR /* avoid <sys/streams.h> conflict */
-# endif
-#endif
-
-#ifdef HESIOD
-# include <hesiod.h>
-# if !defined(HES_ER_OK) || defined(HESIOD_INTERFACES)
-# define HESIOD_INIT /* support for the new interface */
-EXTERN void *HesiodContext;
-# endif
-#endif
-
-/*
-** Following are "sort of" configuration constants, but they should
-** be pretty solid on most architectures today. They have to be
-** defined after <arpa/nameser.h> because some versions of that
-** file also define them. In all cases, we can't use sizeof because
-** some systems (e.g., Crays) always treat everything as being at
-** least 64 bits.
-*/
-
-#ifndef INADDRSZ
-# define INADDRSZ 4 /* size of an IPv4 address in bytes */
-#endif
-#ifndef INT16SZ
-# define INT16SZ 2 /* size of a 16 bit integer in bytes */
-#endif
-#ifndef INT32SZ
-# define INT32SZ 4 /* size of a 32 bit integer in bytes */
-#endif
-
-
-
-/* forward references for prototypes */
-typedef struct envelope ENVELOPE;
-typedef struct mailer MAILER;
-
-
-/*
-** Data structure for bit maps.
-**
-** Each bit in this map can be referenced by an ascii character.
-** This is 256 possible bits, or 32 8-bit bytes.
-*/
-
-#define BITMAPBYTES 32 /* number of bytes in a bit map */
-#define BYTEBITS 8 /* number of bits in a byte */
-
-/* internal macros */
-#define _BITWORD(bit) ((bit) / (BYTEBITS * sizeof (int)))
-#define _BITBIT(bit) (1 << ((bit) % (BYTEBITS * sizeof (int))))
-
-typedef int BITMAP[BITMAPBYTES / sizeof (int)];
-
-/* test bit number N */
-#define bitnset(bit, map) ((map)[_BITWORD(bit)] & _BITBIT(bit))
-
-/* set bit number N */
-#define setbitn(bit, map) (map)[_BITWORD(bit)] |= _BITBIT(bit)
-
-/* clear bit number N */
-#define clrbitn(bit, map) (map)[_BITWORD(bit)] &= ~_BITBIT(bit)
-
-/* clear an entire bit map */
-#define clrbitmap(map) bzero((char *) map, BITMAPBYTES)
-
-
-/*
-** Utility macros
-*/
-
-/* return number of bytes left in a buffer */
-#define SPACELEFT(buf, ptr) (sizeof buf - ((ptr) - buf))
-\f/*
-** Address structure.
-** Addresses are stored internally in this structure.
-*/
-
-struct address
-{
- char *q_paddr; /* the printname for the address */
- char *q_user; /* user name */
- char *q_ruser; /* real user name, or NULL if q_user */
- char *q_host; /* host name */
- struct mailer *q_mailer; /* mailer to use */
- u_long q_flags; /* status flags, see below */
- uid_t q_uid; /* user-id of receiver (if known) */
- gid_t q_gid; /* group-id of receiver (if known) */
- char *q_home; /* home dir (local mailer only) */
- char *q_fullname; /* full name if known */
- struct address *q_next; /* chain */
- struct address *q_alias; /* address this results from */
- char *q_owner; /* owner of q_alias */
- struct address *q_tchain; /* temporary use chain */
- char *q_orcpt; /* ORCPT parameter from RCPT TO: line */
- char *q_status; /* status code for DSNs */
- char *q_rstatus; /* remote status message for DSNs */
- time_t q_statdate; /* date of status messages */
- char *q_statmta; /* MTA generating q_rstatus */
- short q_specificity; /* how "specific" this address is */
-};
-
-typedef struct address ADDRESS;
-
-# define QDONTSEND 0x00000001 /* don't send to this address */
-# define QBADADDR 0x00000002 /* this address is verified bad */
-# define QGOODUID 0x00000004 /* the q_uid q_gid fields are good */
-# define QPRIMARY 0x00000008 /* set from RCPT or argv */
-# define QQUEUEUP 0x00000010 /* queue for later transmission */
-# define QSENT 0x00000020 /* has been successfully delivered */
-# define QNOTREMOTE 0x00000040 /* address not for remote forwarding */
-# define QSELFREF 0x00000080 /* this address references itself */
-# define QVERIFIED 0x00000100 /* verified, but not expanded */
-# define QBOGUSSHELL 0x00000400 /* user has no valid shell listed */
-# define QUNSAFEADDR 0x00000800 /* address aquired via unsafe path */
-# define QPINGONSUCCESS 0x00001000 /* give return on successful delivery */
-# define QPINGONFAILURE 0x00002000 /* give return on failure */
-# define QPINGONDELAY 0x00004000 /* give return on message delay */
-# define QHASNOTIFY 0x00008000 /* propogate notify parameter */
-# define QRELAYED 0x00010000 /* DSN: relayed to non-DSN aware sys */
-# define QEXPANDED 0x00020000 /* DSN: undergone list expansion */
-# define QDELIVERED 0x00040000 /* DSN: successful final delivery */
-# define QDELAYED 0x00080000 /* DSN: message delayed */
-# define QTHISPASS 0x40000000 /* temp: address set this pass */
-# define QRCPTOK 0x80000000 /* recipient() processed address */
-
-# define Q_PINGFLAGS (QPINGONSUCCESS|QPINGONFAILURE|QPINGONDELAY)
-
-# define NULLADDR ((ADDRESS *) NULL)
-
-/* functions */
-extern ADDRESS *parseaddr __P((char *, ADDRESS *, int, int, char **, ENVELOPE *));
-extern ADDRESS *buildaddr __P((char **, ADDRESS *, int, ENVELOPE *));
-extern ADDRESS *recipient __P((ADDRESS *, ADDRESS **, int, ENVELOPE *));
-extern char **prescan __P((char *, int, char[], int, char **, u_char *));
-extern int rewrite __P((char **, int, int, ENVELOPE *));
-extern char *remotename __P((char *, MAILER *, int, int *, ENVELOPE *));
-extern ADDRESS *getctladdr __P((ADDRESS *));
-extern bool sameaddr __P((ADDRESS *, ADDRESS *));
-extern bool emptyaddr __P((ADDRESS *));
-extern void printaddr __P((ADDRESS *, bool));
-extern void cataddr __P((char **, char **, char *, int, int));
-extern int sendtolist __P((char *, ADDRESS *, ADDRESS **, int, ENVELOPE *));
-\f/*
-** Mailer definition structure.
-** Every mailer known to the system is declared in this
-** structure. It defines the pathname of the mailer, some
-** flags associated with it, and the argument vector to
-** pass to it. The flags are defined in conf.c
-**
-** The argument vector is expanded before actual use. All
-** words except the first are passed through the macro
-** processor.
-*/
-
-struct mailer
-{
- char *m_name; /* symbolic name of this mailer */
- char *m_mailer; /* pathname of the mailer to use */
- char *m_mtatype; /* type of this MTA */
- char *m_addrtype; /* type for addresses */
- char *m_diagtype; /* type for diagnostics */
- BITMAP m_flags; /* status flags, see below */
- short m_mno; /* mailer number internally */
- short m_nice; /* niceness to run at (mostly for prog) */
- char **m_argv; /* template argument vector */
- short m_sh_rwset; /* rewrite set: sender header addresses */
- short m_se_rwset; /* rewrite set: sender envelope addresses */
- short m_rh_rwset; /* rewrite set: recipient header addresses */
- short m_re_rwset; /* rewrite set: recipient envelope addresses */
- char *m_eol; /* end of line string */
- long m_maxsize; /* size limit on message to this mailer */
- int m_linelimit; /* max # characters per line */
- char *m_execdir; /* directory to chdir to before execv */
- uid_t m_uid; /* UID to run as */
- gid_t m_gid; /* GID to run as */
- char *m_defcharset; /* default character set */
-};
-
-/* bits for m_flags */
-# define M_ESMTP 'a' /* run Extended SMTP protocol */
-# define M_ALIASABLE 'A' /* user can be LHS of an alias */
-# define M_BLANKEND 'b' /* ensure blank line at end of message */
-# define M_NOCOMMENT 'c' /* don't include comment part of address */
-# define M_CANONICAL 'C' /* make addresses canonical "u@dom" */
-# define M_NOBRACKET 'd' /* never angle bracket envelope route-addrs */
- /* 'D' CF: include Date: */
-# define M_EXPENSIVE 'e' /* it costs to use this mailer.... */
-# define M_ESCFROM 'E' /* escape From lines to >From */
-# define M_FOPT 'f' /* mailer takes picky -f flag */
- /* 'F' CF: include From: or Resent-From: */
-# define M_NO_NULL_FROM 'g' /* sender of errors should be $g */
-# define M_HST_UPPER 'h' /* preserve host case distinction */
-# define M_PREHEAD 'H' /* MAIL11V3: preview headers */
-# define M_UDBENVELOPE 'i' /* do udbsender rewriting on envelope */
-# define M_INTERNAL 'I' /* SMTP to another sendmail site */
-# define M_UDBRECIPIENT 'j' /* do udbsender rewriting on recipient lines */
-# define M_NOLOOPCHECK 'k' /* don't check for loops in HELO command */
-# define M_CHUNKING 'K' /* CHUNKING: reserved for future use */
-# define M_LOCALMAILER 'l' /* delivery is to this host */
-# define M_LIMITS 'L' /* must enforce SMTP line limits */
-# define M_MUSER 'm' /* can handle multiple users at once */
- /* 'M' CF: include Message-Id: */
-# define M_NHDR 'n' /* don't insert From line */
-# define M_MANYSTATUS 'N' /* MAIL11V3: DATA returns multi-status */
-# define M_RUNASRCPT 'o' /* always run mailer as recipient */
-# define M_FROMPATH 'p' /* use reverse-path in MAIL FROM: */
- /* 'P' CF: include Return-Path: */
-# define M_VRFY250 'q' /* VRFY command returns 250 instead of 252 */
-# define M_ROPT 'r' /* mailer takes picky -r flag */
-# define M_SECURE_PORT 'R' /* try to send on a reserved TCP port */
-# define M_STRIPQ 's' /* strip quote chars from user/host */
-# define M_SPECIFIC_UID 'S' /* run as specific uid/gid */
-# define M_USR_UPPER 'u' /* preserve user case distinction */
-# define M_UGLYUUCP 'U' /* this wants an ugly UUCP from line */
-# define M_CONTENT_LEN 'v' /* add Content-Length: header (SVr4) */
- /* 'V' UIUC: !-relativize all addresses */
-# define M_HASPWENT 'w' /* check for /etc/passwd entry */
- /* 'x' CF: include Full-Name: */
-# define M_XDOT 'X' /* use hidden-dot algorithm */
-# define M_LMTP 'z' /* run Local Mail Transport Protocol */
-# define M_NOMX '0' /* turn off MX lookups */
-# define M_NONULLS '1' /* don't send null bytes */
-# define M_EBCDIC '3' /* extend Q-P encoding for EBCDIC */
-# define M_TRYRULESET5 '5' /* use ruleset 5 after local aliasing */
-# define M_7BITHDRS '6' /* strip headers to 7 bits even in 8 bit path */
-# define M_7BITS '7' /* use 7-bit path */
-# define M_8BITS '8' /* force "just send 8" behaviour */
-# define M_MAKE8BIT '9' /* convert 7 -> 8 bit if appropriate */
-# define M_CHECKINCLUDE ':' /* check for :include: files */
-# define M_CHECKPROG '|' /* check for |program addresses */
-# define M_CHECKFILE '/' /* check for /file addresses */
-# define M_CHECKUDB '@' /* user can be user database key */
-# define M_CHECKHDIR '~' /* SGI: check for valid home directory */
-
-EXTERN MAILER *Mailer[MAXMAILERS+1];
-
-EXTERN MAILER *LocalMailer; /* ptr to local mailer */
-EXTERN MAILER *ProgMailer; /* ptr to program mailer */
-EXTERN MAILER *FileMailer; /* ptr to *file* mailer */
-EXTERN MAILER *InclMailer; /* ptr to *include* mailer */
-\f/*
-** Information about currently open connections to mailers, or to
-** hosts that we have looked up recently.
-*/
-
-# define MCI struct mailer_con_info
-
-MCI
-{
- short mci_flags; /* flag bits, see below */
- short mci_errno; /* error number on last connection */
- short mci_herrno; /* h_errno from last DNS lookup */
- short mci_exitstat; /* exit status from last connection */
- short mci_state; /* SMTP state */
- off_t mci_contentlen; /* body length for Content-Length: */
- long mci_maxsize; /* max size this server will accept */
- FILE *mci_in; /* input side of connection */
- FILE *mci_out; /* output side of connection */
- pid_t mci_pid; /* process id of subordinate proc */
- char *mci_phase; /* SMTP phase string */
- struct mailer *mci_mailer; /* ptr to the mailer for this conn */
- char *mci_host; /* host name */
- char *mci_status; /* DSN status to be copied to addrs */
- char *mci_rstatus; /* SMTP status to be copied to addrs */
- time_t mci_lastuse; /* last usage time */
- FILE *mci_statfile; /* long term status file */
-};
-
-
-/* flag bits */
-#define MCIF_VALID 0x0001 /* this entry is valid */
-#define MCIF_TEMP 0x0002 /* don't cache this connection */
-#define MCIF_CACHED 0x0004 /* currently in open cache */
-#define MCIF_ESMTP 0x0008 /* this host speaks ESMTP */
-#define MCIF_EXPN 0x0010 /* EXPN command supported */
-#define MCIF_SIZE 0x0020 /* SIZE option supported */
-#define MCIF_8BITMIME 0x0040 /* BODY=8BITMIME supported */
-#define MCIF_7BIT 0x0080 /* strip this message to 7 bits */
-#define MCIF_MULTSTAT 0x0100 /* MAIL11V3: handles MULT status */
-#define MCIF_INHEADER 0x0200 /* currently outputing header */
-#define MCIF_CVT8TO7 0x0400 /* convert from 8 to 7 bits */
-#define MCIF_DSN 0x0800 /* DSN extension supported */
-#define MCIF_8BITOK 0x1000 /* OK to send 8 bit characters */
-#define MCIF_CVT7TO8 0x2000 /* convert from 7 to 8 bits */
-#define MCIF_INMIME 0x4000 /* currently reading MIME header */
-
-/* states */
-#define MCIS_CLOSED 0 /* no traffic on this connection */
-#define MCIS_OPENING 1 /* sending initial protocol */
-#define MCIS_OPEN 2 /* open, initial protocol sent */
-#define MCIS_ACTIVE 3 /* message being sent */
-#define MCIS_QUITING 4 /* running quit protocol */
-#define MCIS_SSD 5 /* service shutting down */
-#define MCIS_ERROR 6 /* I/O error on connection */
-
-/* functions */
-extern MCI *mci_get __P((char *, MAILER *));
-extern void mci_cache __P((MCI *));
-extern void mci_flush __P((bool, MCI *));
-extern void mci_dump __P((MCI *, bool));
-extern void mci_dump_all __P((bool));
-extern MCI **mci_scan __P((MCI *));
-extern int mci_traverse_persistent __P((int (*)(), char *));
-extern int mci_print_persistent __P((char *, char *));
-extern int mci_purge_persistent __P((char *, char *));
-extern int mci_lock_host __P((MCI *));
-extern void mci_unlock_host __P((MCI *));
-extern int mci_lock_host_statfile __P((MCI *));
-extern void mci_store_persistent __P((MCI *));
-extern int mci_read_persistent __P((FILE *, MCI *));
-\f/*
-** Header structure.
-** This structure is used internally to store header items.
-*/
-
-struct header
-{
- char *h_field; /* the name of the field */
- char *h_value; /* the value of that field */
- struct header *h_link; /* the next header */
- u_short h_flags; /* status bits, see below */
- BITMAP h_mflags; /* m_flags bits needed */
-};
-
-typedef struct header HDR;
-
-/*
-** Header information structure.
-** Defined in conf.c, this struct declares the header fields
-** that have some magic meaning.
-*/
-
-struct hdrinfo
-{
- char *hi_field; /* the name of the field */
- u_short hi_flags; /* status bits, see below */
- char *hi_ruleset; /* validity check ruleset */
-};
-
-extern struct hdrinfo HdrInfo[];
-
-/* bits for h_flags and hi_flags */
-# define H_EOH 0x0001 /* this field terminates header */
-# define H_RCPT 0x0002 /* contains recipient addresses */
-# define H_DEFAULT 0x0004 /* if another value is found, drop this */
-# define H_RESENT 0x0008 /* this address is a "Resent-..." address */
-# define H_CHECK 0x0010 /* check h_mflags against m_flags */
-# define H_ACHECK 0x0020 /* ditto, but always (not just default) */
-# define H_FORCE 0x0040 /* force this field, even if default */
-# define H_TRACE 0x0080 /* this field contains trace information */
-# define H_FROM 0x0100 /* this is a from-type field */
-# define H_VALID 0x0200 /* this field has a validated value */
-# define H_RECEIPTTO 0x0400 /* this field has return receipt info */
-# define H_ERRORSTO 0x0800 /* this field has error address info */
-# define H_CTE 0x1000 /* this field is a content-transfer-encoding */
-# define H_CTYPE 0x2000 /* this is a content-type field */
-# define H_BCC 0x4000 /* Bcc: header: strip value or delete */
-# define H_ENCODABLE 0x8000 /* field can be RFC 1522 encoded */
-
-/* functions */
-extern void addheader __P((char *, char *, HDR **));
-extern char *hvalue __P((char *, HDR *));
-extern void commaize __P((HDR *, char *, bool, MCI *, ENVELOPE *));
-extern void put_vanilla_header __P((HDR *, char *, MCI *));
-extern void eatheader __P((ENVELOPE *, bool));
-extern int chompheader __P((char *, bool, HDR **, ENVELOPE *));
-\f/*
-** Envelope structure.
-** This structure defines the message itself. There is usually
-** only one of these -- for the message that we originally read
-** and which is our primary interest -- but other envelopes can
-** be generated during processing. For example, error messages
-** will have their own envelope.
-*/
-
-struct envelope
-{
- HDR *e_header; /* head of header list */
- long e_msgpriority; /* adjusted priority of this message */
- time_t e_ctime; /* time message appeared in the queue */
- char *e_to; /* the target person */
- 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 */
- ADDRESS *e_sendqueue; /* list of message recipients */
- ADDRESS *e_errorqueue; /* the queue for error responses */
- long e_msgsize; /* size of the message in bytes */
- long e_flags; /* flags, see below */
- int e_nrcpts; /* number of recipients */
- short e_class; /* msg class (priority, junk, etc.) */
- short e_hopcount; /* number of times processed */
- short e_nsent; /* number of sends since checkpoint */
- short e_sendmode; /* message send mode */
- short e_errormode; /* error return mode */
- short e_timeoutclass; /* message timeout class */
- void (*e_puthdr)__P((MCI *, HDR *, ENVELOPE *, int));
- /* function to put header of message */
- void (*e_putbody)__P((MCI *, ENVELOPE *, char *));
- /* function to put body of message */
- struct envelope *e_parent; /* the message this one encloses */
- struct envelope *e_sibling; /* the next envelope of interest */
- char *e_bodytype; /* type of message body */
- FILE *e_dfp; /* temporary file */
- char *e_id; /* code for this entry in queue */
- FILE *e_xfp; /* transcript file */
- FILE *e_lockfp; /* the lock file for this message */
- char *e_message; /* error message */
- char *e_statmsg; /* stat msg (changes per delivery) */
- char *e_msgboundary; /* MIME-style message part boundary */
- char *e_origrcpt; /* original recipient (one only) */
- char *e_envid; /* envelope id from MAIL FROM: line */
- char *e_status; /* DSN status for this message */
- time_t e_dtime; /* time of last delivery attempt */
- int e_ntries; /* number of delivery attempts */
- dev_t e_dfdev; /* df file's device, for crash recov */
- ino_t e_dfino; /* df file's ino, for crash recovery */
- char *e_macro[256]; /* macro definitions */
-};
-
-/* values for e_flags */
-#define EF_OLDSTYLE 0x0000001 /* use spaces (not commas) in hdrs */
-#define EF_INQUEUE 0x0000002 /* this message is fully queued */
-#define EF_NO_BODY_RETN 0x0000004 /* omit message body on error */
-#define EF_CLRQUEUE 0x0000008 /* disk copy is no longer needed */
-#define EF_SENDRECEIPT 0x0000010 /* send a return receipt */
-#define EF_FATALERRS 0x0000020 /* fatal errors occured */
-#define EF_DELETE_BCC 0x0000040 /* delete Bcc: headers entirely */
-#define EF_RESPONSE 0x0000080 /* this is an error or return receipt */
-#define EF_RESENT 0x0000100 /* this message is being forwarded */
-#define EF_VRFYONLY 0x0000200 /* verify only (don't expand aliases) */
-#define EF_WARNING 0x0000400 /* warning message has been sent */
-#define EF_QUEUERUN 0x0000800 /* this envelope is from queue */
-#define EF_GLOBALERRS 0x0001000 /* treat errors as global */
-#define EF_PM_NOTIFY 0x0002000 /* send return mail to postmaster */
-#define EF_METOO 0x0004000 /* send to me too */
-#define EF_LOGSENDER 0x0008000 /* need to log the sender */
-#define EF_NORECEIPT 0x0010000 /* suppress all return-receipts */
-#define EF_HAS8BIT 0x0020000 /* at least one 8-bit char in body */
-#define EF_NL_NOT_EOL 0x0040000 /* don't accept raw NL as EOLine */
-#define EF_CRLF_NOT_EOL 0x0080000 /* don't accept CR-LF as EOLine */
-#define EF_RET_PARAM 0x0100000 /* RCPT command had RET argument */
-#define EF_HAS_DF 0x0200000 /* set when df file is instantiated */
-#define EF_IS_MIME 0x0400000 /* really is a MIME message */
-#define EF_DONT_MIME 0x0800000 /* never MIME this message */
-#define EF_DISCARD 0x1000000 /* discard the message */
-
-EXTERN ENVELOPE *CurEnv; /* envelope currently being processed */
-
-/* functions */
-extern ENVELOPE *newenvelope __P((ENVELOPE *, ENVELOPE *));
-extern void dropenvelope __P((ENVELOPE *, bool));
-extern void clearenvelope __P((ENVELOPE *, bool));
-
-extern void putheader __P((MCI *, HDR *, ENVELOPE *, int));
-extern void putbody __P((MCI *, ENVELOPE *, char *));
-\f/*
-** Message priority classes.
-**
-** The message class is read directly from the Priority: header
-** field in the message.
-**
-** CurEnv->e_msgpriority is the number of bytes in the message plus
-** the creation time (so that jobs ``tend'' to be ordered correctly),
-** adjusted by the message class, the number of recipients, and the
-** amount of time the message has been sitting around. This number
-** is used to order the queue. Higher values mean LOWER priority.
-**
-** Each priority class point is worth WkClassFact priority points;
-** each recipient is worth WkRecipFact priority points. Each time
-** we reprocess a message the priority is adjusted by WkTimeFact.
-** WkTimeFact should normally decrease the priority so that jobs
-** that have historically failed will be run later; thanks go to
-** Jay Lepreau at Utah for pointing out the error in my thinking.
-**
-** The "class" is this number, unadjusted by the age or size of
-** this message. Classes with negative representations will have
-** error messages thrown away if they are not local.
-*/
-
-struct priority
-{
- char *pri_name; /* external name of priority */
- int pri_val; /* internal value for same */
-};
-
-EXTERN struct priority Priorities[MAXPRIORITIES];
-EXTERN int NumPriorities; /* pointer into Priorities */
-\f/*
-** Rewrite rules.
-*/
-
-struct rewrite
-{
- char **r_lhs; /* pattern match */
- char **r_rhs; /* substitution value */
- struct rewrite *r_next;/* next in chain */
-};
-
-EXTERN struct rewrite *RewriteRules[MAXRWSETS];
-
-/*
-** Special characters in rewriting rules.
-** These are used internally only.
-** The COND* rules are actually used in macros rather than in
-** rewriting rules, but are given here because they
-** cannot conflict.
-*/
-
-/* left hand side items */
-# define MATCHZANY ((u_char)0220) /* match zero or more tokens */
-# define MATCHANY ((u_char)0221) /* match one or more tokens */
-# define MATCHONE ((u_char)0222) /* match exactly one token */
-# define MATCHCLASS ((u_char)0223) /* match one token in a class */
-# define MATCHNCLASS ((u_char)0224) /* match anything not in class */
-# define MATCHREPL ((u_char)0225) /* replacement on RHS for above */
-
-/* right hand side items */
-# define CANONNET ((u_char)0226) /* canonical net, next token */
-# define CANONHOST ((u_char)0227) /* canonical host, next token */
-# define CANONUSER ((u_char)0230) /* canonical user, next N tokens */
-# define CALLSUBR ((u_char)0231) /* call another rewriting set */
-
-/* conditionals in macros */
-# define CONDIF ((u_char)0232) /* conditional if-then */
-# define CONDELSE ((u_char)0233) /* conditional else */
-# define CONDFI ((u_char)0234) /* conditional fi */
-
-/* bracket characters for host name lookup */
-# define HOSTBEGIN ((u_char)0235) /* hostname lookup begin */
-# define HOSTEND ((u_char)0236) /* hostname lookup end */
-
-/* bracket characters for generalized lookup */
-# define LOOKUPBEGIN ((u_char)0205) /* generalized lookup begin */
-# define LOOKUPEND ((u_char)0206) /* generalized lookup end */
-
-/* macro substitution character */
-# define MACROEXPAND ((u_char)0201) /* macro expansion */
-# define MACRODEXPAND ((u_char)0202) /* deferred macro expansion */
-
-/* to make the code clearer */
-# define MATCHZERO CANONHOST
-
-/* external <==> internal mapping table */
-struct metamac
-{
- char metaname; /* external code (after $) */
- u_char metaval; /* internal code (as above) */
-};
-
-/* values for macros with external names only */
-# define MID_OPMODE 0202 /* operation mode */
-
-/* functions */
-extern void expand __P((char *, char *, size_t, ENVELOPE *));
-extern void define __P((int, char *, ENVELOPE *));
-extern char *macvalue __P((int, ENVELOPE *));
-extern char *macname __P((int));
-extern int macid __P((char *, char **));
-\f/*
-** Name canonification short circuit.
-**
-** If the name server for a host is down, the process of trying to
-** canonify the name can hang. This is similar to (but alas, not
-** identical to) looking up the name for delivery. This stab type
-** caches the result of the name server lookup so we don't hang
-** multiple times.
-*/
-
-#define NAMECANON struct _namecanon
-
-NAMECANON
-{
- short nc_errno; /* cached errno */
- short nc_herrno; /* cached h_errno */
- short nc_stat; /* cached exit status code */
- short nc_flags; /* flag bits */
- char *nc_cname; /* the canonical name */
-};
-
-/* values for nc_flags */
-#define NCF_VALID 0x0001 /* entry valid */
-\f/*
-** Mapping functions
-**
-** These allow arbitrary mappings in the config file. The idea
-** (albeit not the implementation) comes from IDA sendmail.
-*/
-
-# define MAPCLASS struct _mapclass
-# define MAP struct _map
-# define MAXMAPACTIONS 3 /* size of map_actions array */
-
-
-/*
-** An actual map.
-*/
-
-MAP
-{
- MAPCLASS *map_class; /* the class of this map */
- char *map_mname; /* name of this map */
- long map_mflags; /* flags, see below */
- char *map_file; /* the (nominal) filename */
- ARBPTR_T map_db1; /* the open database ptr */
- ARBPTR_T map_db2; /* an "extra" database pointer */
- char *map_keycolnm; /* key column name */
- char *map_valcolnm; /* value column name */
- u_char map_keycolno; /* key column number */
- u_char map_valcolno; /* value column number */
- char map_coldelim; /* column delimiter */
- char *map_app; /* to append to successful matches */
- char *map_tapp; /* to append to "tempfail" matches */
- char *map_domain; /* the (nominal) NIS domain */
- char *map_rebuild; /* program to run to do auto-rebuild */
- time_t map_mtime; /* last database modification time */
- pid_t map_pid; /* PID of process which opened map */
- int map_lockfd; /* auxiliary lock file descriptor */
- short map_specificity; /* specificity of aliases */
- MAP *map_stack[MAXMAPSTACK]; /* list for stacked maps */
- short map_return[MAXMAPACTIONS]; /* return bitmaps for stacked maps */
-};
-
-/* bit values for map_mflags */
-# define MF_VALID 0x00000001 /* this entry is valid */
-# define MF_INCLNULL 0x00000002 /* include null byte in key */
-# define MF_OPTIONAL 0x00000004 /* don't complain if map not found */
-# define MF_NOFOLDCASE 0x00000008 /* don't fold case in keys */
-# define MF_MATCHONLY 0x00000010 /* don't use the map value */
-# define MF_OPEN 0x00000020 /* this entry is open */
-# define MF_WRITABLE 0x00000040 /* open for writing */
-# define MF_ALIAS 0x00000080 /* this is an alias file */
-# define MF_TRY0NULL 0x00000100 /* try with no null byte */
-# define MF_TRY1NULL 0x00000200 /* try with the null byte */
-# define MF_LOCKED 0x00000400 /* this map is currently locked */
-# define MF_ALIASWAIT 0x00000800 /* alias map in aliaswait state */
-# define MF_IMPL_HASH 0x00001000 /* implicit: underlying hash database */
-# define MF_IMPL_NDBM 0x00002000 /* implicit: underlying NDBM database */
-# define MF_UNSAFEDB 0x00004000 /* this map is world writable */
-# define MF_APPEND 0x00008000 /* append new entry on rebuiled */
-# define MF_KEEPQUOTES 0x00010000 /* don't dequote key before lookup */
-# define MF_NODEFER 0x00020000 /* don't defer if map lookup fails */
-# define MF_REGEX_NOT 0x00040000 /* regular expression negation */
-
-/* indices for map_actions */
-# define MA_NOTFOUND 0 /* member map returned "not found" */
-# define MA_UNAVAIL 1 /* member map is not available */
-# define MA_TRYAGAIN 2 /* member map returns temp failure */
-
-/*
-** The class of a map -- essentially the functions to call
-*/
-
-MAPCLASS
-{
- char *map_cname; /* name of this map class */
- char *map_ext; /* extension for database file */
- short map_cflags; /* flag bits, see below */
- bool (*map_parse)__P((MAP *, char *));
- /* argument parsing function */
- char *(*map_lookup)__P((MAP *, char *, char **, int *));
- /* lookup function */
- void (*map_store)__P((MAP *, char *, char *));
- /* store function */
- bool (*map_open)__P((MAP *, int));
- /* open function */
- void (*map_close)__P((MAP *));
- /* close function */
-};
-
-/* bit values for map_cflags */
-#define MCF_ALIASOK 0x0001 /* can be used for aliases */
-#define MCF_ALIASONLY 0x0002 /* usable only for aliases */
-#define MCF_REBUILDABLE 0x0004 /* can rebuild alias files */
-#define MCF_OPTFILE 0x0008 /* file name is optional */
-
-/* functions */
-extern char *map_rewrite __P((MAP *, const char *, size_t, char **));
-extern MAP *makemapentry __P((char *));
-extern void initmaps __P((bool, ENVELOPE *));
-\f/*
-** Symbol table definitions
-*/
-
-struct symtab
-{
- char *s_name; /* name to be entered */
- short s_type; /* general type (see below) */
- short s_len; /* length of this entry */
- struct symtab *s_next; /* pointer to next in chain */
- union
- {
- BITMAP sv_class; /* bit-map of word classes */
- ADDRESS *sv_addr; /* pointer to address header */
- MAILER *sv_mailer; /* pointer to mailer */
- char *sv_alias; /* alias */
- MAPCLASS sv_mapclass; /* mapping function class */
- MAP sv_map; /* mapping function */
- char *sv_hostsig; /* host signature */
- MCI sv_mci; /* mailer connection info */
- NAMECANON sv_namecanon; /* canonical name cache */
- int sv_macro; /* macro name => id mapping */
- int sv_ruleset; /* ruleset index */
- struct hdrinfo sv_header; /* header metainfo */
- char *sv_service[MAXMAPSTACK]; /* service switch */
- } s_value;
-};
-
-typedef struct symtab STAB;
-
-/* symbol types */
-# define ST_UNDEF 0 /* undefined type */
-# define ST_CLASS 1 /* class map */
-# define ST_ADDRESS 2 /* an address in parsed format */
-# define ST_MAILER 3 /* a mailer header */
-# define ST_ALIAS 4 /* an alias */
-# define ST_MAPCLASS 5 /* mapping function class */
-# define ST_MAP 6 /* mapping function */
-# define ST_HOSTSIG 7 /* host signature */
-# define ST_NAMECANON 8 /* cached canonical name */
-# define ST_MACRO 9 /* macro name to id mapping */
-# define ST_RULESET 10 /* ruleset index */
-# define ST_SERVICE 11 /* service switch entry */
-# define ST_HEADER 12 /* special header flags */
-# define ST_MCI 16 /* mailer connection info (offset) */
-
-# define s_class s_value.sv_class
-# define s_address s_value.sv_addr
-# define s_mailer s_value.sv_mailer
-# define s_alias s_value.sv_alias
-# define s_mci s_value.sv_mci
-# define s_mapclass s_value.sv_mapclass
-# define s_hostsig s_value.sv_hostsig
-# define s_map s_value.sv_map
-# define s_namecanon s_value.sv_namecanon
-# define s_macro s_value.sv_macro
-# define s_ruleset s_value.sv_ruleset
-# define s_service s_value.sv_service
-# define s_header s_value.sv_header
-
-extern STAB *stab __P((char *, int, int));
-extern void stabapply __P((void (*)(STAB *, int), int));
-
-/* opcodes to stab */
-# define ST_FIND 0 /* find entry */
-# define ST_ENTER 1 /* enter if not there */
-\f/*
-** STRUCT EVENT -- event queue.
-**
-** Maintained in sorted order.
-**
-** We store the pid of the process that set this event to insure
-** that when we fork we will not take events intended for the parent.
-*/
-
-struct event
-{
- time_t ev_time; /* time of the function call */
- void (*ev_func)__P((int));
- /* function to call */
- int ev_arg; /* argument to ev_func */
- int ev_pid; /* pid that set this event */
- struct event *ev_link; /* link to next item */
-};
-
-typedef struct event EVENT;
-
-EXTERN EVENT *EventQueue; /* head of event queue */
-
-/* functions */
-extern EVENT *setevent __P((time_t, void(*)(), int));
-extern void clrevent __P((EVENT *));
-\f/*
-** Operation, send, error, and MIME modes
-**
-** The operation mode describes the basic operation of sendmail.
-** This can be set from the command line, and is "send mail" by
-** default.
-**
-** The send mode tells how to send mail. It can be set in the
-** configuration file. It's setting determines how quickly the
-** mail will be delivered versus the load on your system. If the
-** -v (verbose) flag is given, it will be forced to SM_DELIVER
-** mode.
-**
-** The error mode tells how to return errors.
-*/
-
-EXTERN char OpMode; /* operation mode, see below */
-
-#define MD_DELIVER 'm' /* be a mail sender */
-#define MD_SMTP 's' /* run SMTP on standard input */
-#define MD_ARPAFTP 'a' /* obsolete ARPANET mode (Grey Book) */
-#define MD_DAEMON 'd' /* run as a daemon */
-#define MD_FGDAEMON 'D' /* run daemon in foreground */
-#define MD_VERIFY 'v' /* verify: don't collect or deliver */
-#define MD_TEST 't' /* test mode: resolve addrs only */
-#define MD_INITALIAS 'i' /* initialize alias database */
-#define MD_PRINT 'p' /* print the queue */
-#define MD_FREEZE 'z' /* freeze the configuration file */
-#define MD_HOSTSTAT 'h' /* print persistent host stat info */
-#define MD_PURGESTAT 'H' /* purge persistent host stat info */
-
-/* values for e_sendmode -- send modes */
-#define SM_DELIVER 'i' /* interactive delivery */
-#define SM_FORK 'b' /* deliver in background */
-#define SM_QUEUE 'q' /* queue, don't deliver */
-#define SM_DEFER 'd' /* defer map lookups as well as queue */
-#define SM_VERIFY 'v' /* verify only (used internally) */
-
-/* used only as a parameter to sendall */
-#define SM_DEFAULT '\0' /* unspecified, use SendMode */
-
-
-/* values for e_errormode -- error handling modes */
-#define EM_PRINT 'p' /* print errors */
-#define EM_MAIL 'm' /* mail back errors */
-#define EM_WRITE 'w' /* write back errors */
-#define EM_BERKNET 'e' /* special berknet processing */
-#define EM_QUIET 'q' /* don't print messages (stat only) */
-
-
-/* MIME processing mode */
-EXTERN int MimeMode;
-
-/* bit values for MimeMode */
-#define MM_CVTMIME 0x0001 /* convert 8 to 7 bit MIME */
-#define MM_PASS8BIT 0x0002 /* just send 8 bit data blind */
-#define MM_MIME8BIT 0x0004 /* convert 8-bit data to MIME */
-
-/* queue sorting order algorithm */
-EXTERN int QueueSortOrder;
-
-#define QS_BYPRIORITY 0 /* sort by message priority */
-#define QS_BYHOST 1 /* sort by first host name */
-#define QS_BYTIME 2 /* sort by submission time */
-
-
-/* how to handle messages without any recipient addresses */
-EXTERN int NoRecipientAction;
-
-#define NRA_NO_ACTION 0 /* just leave it as is */
-#define NRA_ADD_TO 1 /* add To: header */
-#define NRA_ADD_APPARENTLY_TO 2 /* add Apparently-To: header */
-#define NRA_ADD_BCC 3 /* add empty Bcc: header */
-#define NRA_ADD_TO_UNDISCLOSED 4 /* add To: undisclosed:; header */
-
-
-/* flags to putxline */
-#define PXLF_NOTHINGSPECIAL 0 /* no special mapping */
-#define PXLF_MAPFROM 0x0001 /* map From_ to >From_ */
-#define PXLF_STRIP8BIT 0x0002 /* strip 8th bit */
-#define PXLF_HEADER 0x0004 /* map newlines in headers */
-\f/*
-** Additional definitions
-*/
-
-
-/*
-** Privacy flags
-** These are bit values for the PrivacyFlags word.
-*/
-
-#define PRIV_PUBLIC 0 /* what have I got to hide? */
-#define PRIV_NEEDMAILHELO 0x0001 /* insist on HELO for MAIL, at least */
-#define PRIV_NEEDEXPNHELO 0x0002 /* insist on HELO for EXPN */
-#define PRIV_NEEDVRFYHELO 0x0004 /* insist on HELO for VRFY */
-#define PRIV_NOEXPN 0x0008 /* disallow EXPN command entirely */
-#define PRIV_NOVRFY 0x0010 /* disallow VRFY command entirely */
-#define PRIV_AUTHWARNINGS 0x0020 /* flag possible authorization probs */
-#define PRIV_NORECEIPTS 0x0040 /* disallow return receipts */
-#define PRIV_NOETRN 0x0080 /* disallow ETRN command entirely */
-#define PRIV_NOVERB 0x0100 /* disallow VERB command entirely */
-#define PRIV_RESTRICTMAILQ 0x1000 /* restrict mailq command */
-#define PRIV_RESTRICTQRUN 0x2000 /* restrict queue run */
-#define PRIV_GOAWAY 0x0fff /* don't give no info, anyway, anyhow */
-
-/* struct defining such things */
-struct prival
-{
- char *pv_name; /* name of privacy flag */
- int pv_flag; /* numeric level */
-};
-
-
-/*
-** Flags passed to remotename, parseaddr, allocaddr, and buildaddr.
-*/
-
-#define RF_SENDERADDR 0x001 /* this is a sender address */
-#define RF_HEADERADDR 0x002 /* this is a header address */
-#define RF_CANONICAL 0x004 /* strip comment information */
-#define RF_ADDDOMAIN 0x008 /* OK to do domain extension */
-#define RF_COPYPARSE 0x010 /* copy parsed user & host */
-#define RF_COPYPADDR 0x020 /* copy print address */
-#define RF_COPYALL (RF_COPYPARSE|RF_COPYPADDR)
-#define RF_COPYNONE 0
-
-
-/*
-** Flags passed to safefile/safedirpath.
-*/
-
-#define SFF_ANYFILE 0 /* no special restrictions */
-#define SFF_MUSTOWN 0x0001 /* user must own this file */
-#define SFF_NOSLINK 0x0002 /* file cannot be a symbolic link */
-#define SFF_ROOTOK 0x0004 /* ok for root to own this file */
-#define SFF_RUNASREALUID 0x0008 /* if no ctladdr, run as real uid */
-#define SFF_NOPATHCHECK 0x0010 /* don't bother checking dir path */
-#define SFF_SETUIDOK 0x0020 /* setuid files are ok */
-#define SFF_CREAT 0x0040 /* ok to create file if necessary */
-#define SFF_REGONLY 0x0080 /* regular files only */
-#define SFF_SAFEDIRPATH 0x0100 /* no writable directories allowed */
-#define SFF_NOHLINK 0x0200 /* file cannot have hard links */
-#define SFF_NOWLINK 0x0400 /* links only in non-writable dirs */
-#define SFF_NOGWFILES 0x0800 /* disallow world writable files */
-#define SFF_NOWWFILES 0x1000 /* disallow group writable files */
-
-/* flags that are actually specific to safeopen/safefopen/dfopen */
-#define SFF_OPENASROOT 0x2000 /* open as root instead of real user */
-#define SFF_NOLOCK 0x4000 /* don't lock the file */
-
-/* pseudo-flags */
-#define SFF_NOLINK (SFF_NOHLINK|SFF_NOSLINK)
-
-/* functions */
-extern int safefile __P((char *, UID_T, GID_T, char *, int, int, struct stat *));
-extern int safedirpath __P((char *, UID_T, GID_T, char *, int));
-extern int safeopen __P((char *, int, int, int));
-extern FILE *safefopen __P((char *, int, int, int));
-extern int dfopen __P((char *, int, int, int));
-extern bool filechanged __P((char *, int, struct stat *));
-
-
-/*
-** Flags passed to mime8to7.
-*/
-
-#define M87F_OUTER 0 /* outer context */
-#define M87F_NO8BIT 0x0001 /* can't have 8-bit in this section */
-#define M87F_DIGEST 0x0002 /* processing multipart/digest */
-#define M87F_NO8TO7 0x0004 /* don't do 8->7 bit conversions */
-
-
-/*
-** Flags passed to returntosender.
-*/
-
-#define RTSF_NO_BODY 0 /* send headers only */
-#define RTSF_SEND_BODY 0x0001 /* include body of message in return */
-#define RTSF_PM_BOUNCE 0x0002 /* this is a postmaster bounce */
-
-
-/*
-** Regular UNIX sockaddrs are too small to handle ISO addresses, so
-** we are forced to declare a supertype here.
-*/
-
-# if NETINET || NETUNIX || NETISO || NETNS || NETX25
-union bigsockaddr
-{
- struct sockaddr sa; /* general version */
-#if NETUNIX
- struct sockaddr_un sunix; /* UNIX family */
-#endif
-#if NETINET
- struct sockaddr_in sin; /* INET family */
-#endif
-#if NETISO
- struct sockaddr_iso siso; /* ISO family */
-#endif
-#if NETNS
- struct sockaddr_ns sns; /* XNS family */
-#endif
-#if NETX25
- struct sockaddr_x25 sx25; /* X.25 family */
-#endif
-};
-
-#define SOCKADDR union bigsockaddr
-
-EXTERN SOCKADDR RealHostAddr; /* address of host we are talking to */
-
-extern char *hostnamebyanyaddr __P((SOCKADDR *));
-extern char *anynet_ntoa __P((SOCKADDR *));
-# if DAEMON
-extern char *validate_connection __P((SOCKADDR *, char *, ENVELOPE *));
-# endif
-
-#endif
-
-
-/*
-** Vendor codes
-**
-** Vendors can customize sendmail to add special behaviour,
-** generally for back compatibility. Ideally, this should
-** be set up in the .cf file using the "V" command. However,
-** it's quite reasonable for some vendors to want the default
-** be their old version; this can be set using
-** -DVENDOR_DEFAULT=VENDOR_xxx
-** in the Makefile.
-**
-** Vendors should apply to sendmail@CS.Berkeley.EDU for
-** unique vendor codes.
-*/
-
-#define VENDOR_BERKELEY 1 /* Berkeley-native configuration file */
-#define VENDOR_SUN 2 /* Sun-native configuration file */
-#define VENDOR_HP 3 /* Hewlett-Packard specific config syntax */
-#define VENDOR_IBM 4 /* IBM specific config syntax */
-#define VENDOR_SENDMAIL 5 /* Sendmail, Inc. specific config syntax */
-
-EXTERN int VendorCode; /* vendor-specific operation enhancements */
-
-/* prototypes for vendor-specific hook routines */
-extern void vendor_set_uid __P((UID_T));
-extern void vendor_daemon_setup __P((ENVELOPE *));
-
-/*
-** DontBlameSendmail options
-**
-** Hopefully nobody uses these.
-*/
-#define DBS_SAFE 0
-#define DBS_ASSUMESAFECHOWN 0x00000001
-#define DBS_GROUPWRITABLEDIRPATHSAFE 0x00000002
-#define DBS_GROUPWRITABLEFORWARDFILESAFE 0x00000004
-#define DBS_GROUPWRITABLEINCLUDEFILESAFE 0x00000008
-#define DBS_GROUPWRITABLEALIASFILE 0x00000010
-#define DBS_WORLDWRITABLEALIASFILE 0x00000020
-#define DBS_FORWARDFILEINUNSAFEDIRPATH 0x00000040
-#define DBS_MAPINUNSAFEDIRPATH 0x00000080
-#define DBS_LINKEDALIASFILEINWRITABLEDIR 0x00000100
-#define DBS_LINKEDCLASSFILEINWRITABLEDIR 0x00000200
-#define DBS_LINKEDFORWARDFILEINWRITABLEDIR 0x00000400
-#define DBS_LINKEDINCLUDEFILEINWRITABLEDIR 0x00000800
-#define DBS_LINKEDMAPINWRITABLEDIR 0x00001000
-#define DBS_LINKEDSERVICESWITCHFILEINWRITABLEDIR 0x00002000
-#define DBS_FILEDELIVERYTOHARDLINK 0x00004000
-#define DBS_FILEDELIVERYTOSYMLINK 0x00008000
-#define DBS_WRITEMAPTOHARDLINK 0x00010000
-#define DBS_WRITEMAPTOSYMLINK 0x00020000
-#define DBS_WRITESTATSTOHARDLINK 0x00040000
-#define DBS_WRITESTATSTOSYMLINK 0x00080000
-#define DBS_FORWARDFILEINGROUPWRITABLEDIRPATH 0x00100000
-#define DBS_INCLUDEFILEINGROUPWRITABLEDIRPATH 0x00200000
-#define DBS_CLASSFILEINUNSAFEDIRPATH 0x00400000
-#define DBS_ERRORHEADERINUNSAFEDIRPATH 0x00800000
-#define DBS_HELPFILEINUNSAFEDIRPATH 0x01000000
-#define DBS_FORWARDFILEINUNSAFEDIRPATHSAFE 0x02000000
-#define DBS_INCLUDEFILEINUNSAFEDIRPATHSAFE 0x04000000
-#define DBS_RUNPROGRAMINUNSAFEDIRPATH 0x08000000
-#define DBS_RUNWRITABLEPROGRAM 0x10000000
-#define DBS_INCLUDEFILEINUNSAFEDIRPATH 0x20000000
-
-/* struct defining such things */
-struct dbsval
-{
- char *dbs_name; /* name of DontBlameSendmail flag */
- long dbs_flag; /* numeric level */
-};
-
-EXTERN long DontBlameSendmail; /* DontBlameSendmail option bits */
-
-/*
-** Terminal escape codes.
-**
-** To make debugging output clearer.
-*/
-
-struct termescape
-{
- char *te_rv_on; /* turn reverse-video on */
- char *te_rv_off; /* turn reverse-video off */
-};
-
-EXTERN struct termescape TermEscape;
-
-
-/*
-** Error return from inet_addr(3), in case not defined in /usr/include.
-*/
-
-#ifndef INADDR_NONE
-# define INADDR_NONE 0xffffffff
-#endif
-\f/*
-** Global variables.
-*/
-
-EXTERN bool FromFlag; /* if set, "From" person is explicit */
-EXTERN bool MeToo; /* send to the sender also */
-EXTERN bool IgnrDot; /* don't let dot end messages */
-EXTERN bool SaveFrom; /* save leading "From" lines */
-EXTERN bool GrabTo; /* if set, get recipients from msg */
-EXTERN bool SuprErrs; /* set if we are suppressing errors */
-EXTERN bool HoldErrs; /* only output errors to transcript */
-EXTERN bool NoConnect; /* don't connect to non-local mailers */
-EXTERN bool SuperSafe; /* be extra careful, even if expensive */
-EXTERN bool ForkQueueRuns; /* fork for each job when running the queue */
-EXTERN bool AutoRebuild; /* auto-rebuild the alias database as needed */
-EXTERN bool CheckAliases; /* parse addresses during newaliases */
-EXTERN bool NoAlias; /* suppress aliasing */
-EXTERN bool UseNameServer; /* using DNS -- interpret h_errno & MX RRs */
-EXTERN bool UseHesiod; /* using Hesiod -- interpret Hesiod errors */
-EXTERN bool SevenBitInput; /* force 7-bit data on input */
-EXTERN bool HasEightBits; /* has at least one eight bit input byte */
-EXTERN bool ConfigFileRead; /* configuration file has been read */
-EXTERN time_t SafeAlias; /* interval to wait until @:@ in alias file */
-EXTERN FILE *InChannel; /* input connection */
-EXTERN FILE *OutChannel; /* output connection */
-EXTERN char *RealUserName; /* real user name of caller */
-EXTERN uid_t RealUid; /* real uid of caller */
-EXTERN gid_t RealGid; /* real gid of caller */
-EXTERN uid_t DefUid; /* default uid to run as */
-EXTERN gid_t DefGid; /* default gid to run as */
-EXTERN char *DefUser; /* default user to run as (from DefUid) */
-EXTERN uid_t TrustedUid; /* uid of trusted user for files and startup */
-EXTERN MODE_T OldUmask; /* umask when sendmail starts up */
-EXTERN int Verbose; /* set if blow-by-blow desired */
-EXTERN int Errors; /* set if errors (local to single pass) */
-EXTERN int ExitStat; /* exit status code */
-EXTERN int LineNumber; /* line number in current input */
-EXTERN int LogLevel; /* level of logging to perform */
-EXTERN int FileMode; /* mode on files */
-EXTERN int QueueLA; /* load average starting forced queueing */
-EXTERN int RefuseLA; /* load average refusing connections are */
-EXTERN int CurrentLA; /* current load average */
-EXTERN long QueueFactor; /* slope of queue function */
-EXTERN time_t QueueIntvl; /* intervals between running the queue */
-EXTERN char *HelpFile; /* location of SMTP help file */
-EXTERN char *ErrMsgFile; /* file to prepend to all error messages */
-EXTERN char *StatFile; /* location of statistics summary */
-EXTERN char *QueueDir; /* location of queue directory */
-EXTERN char *FileName; /* name to print on error messages */
-EXTERN char *SmtpPhase; /* current phase in SMTP processing */
-EXTERN char *MyHostName; /* name of this host for SMTP messages */
-EXTERN char *RealHostName; /* name of host we are talking to */
-EXTERN char *CurHostName; /* current host we are dealing with */
-EXTERN jmp_buf TopFrame; /* branch-to-top-of-loop-on-error frame */
-EXTERN bool QuickAbort; /* .... but only if we want a quick abort */
-EXTERN bool OnlyOneError; /* .... or only want to give one SMTP reply */
-EXTERN bool LogUsrErrs; /* syslog user errors (e.g., SMTP RCPT cmd) */
-EXTERN bool SendMIMEErrors; /* send error messages in MIME format */
-EXTERN bool MatchGecos; /* look for user names in gecos field */
-EXTERN bool UseErrorsTo; /* use Errors-To: header (back compat) */
-EXTERN bool TryNullMXList; /* if we are the best MX, try host directly */
-EXTERN bool InChild; /* true if running in an SMTP subprocess */
-EXTERN bool DisConnected; /* running with OutChannel redirected to xf */
-EXTERN bool ColonOkInAddr; /* single colon legal in address */
-EXTERN bool HasWildcardMX; /* don't use MX records when canonifying */
-EXTERN char SpaceSub; /* substitution for <lwsp> */
-EXTERN int PrivacyFlags; /* privacy flags */
-EXTERN char *ConfFile; /* location of configuration file [conf.c] */
-EXTERN char *PidFile; /* location of proc id file [conf.c] */
-EXTERN char *ControlSocketName; /* control socket filename [control.c] */
-extern ADDRESS NullAddress; /* a null (template) address [main.c] */
-EXTERN long WkClassFact; /* multiplier for message class -> priority */
-EXTERN long WkRecipFact; /* multiplier for # of recipients -> priority */
-EXTERN long WkTimeFact; /* priority offset each time this job is run */
-EXTERN char *UdbSpec; /* user database source spec */
-EXTERN int MaxHopCount; /* max # of hops until bounce */
-EXTERN int ConfigLevel; /* config file level */
-EXTERN char *TimeZoneSpec; /* override time zone specification */
-EXTERN char *ForwardPath; /* path to search for .forward files */
-EXTERN long MinBlocksFree; /* min # of blocks free on queue fs */
-EXTERN char *FallBackMX; /* fall back MX host */
-EXTERN long MaxMessageSize; /* advertised max size we will accept */
-EXTERN time_t MinQueueAge; /* min delivery interval */
-EXTERN time_t DialDelay; /* delay between dial-on-demand tries */
-EXTERN char *SafeFileEnv; /* chroot location for file delivery */
-EXTERN char *HostsFile; /* path to /etc/hosts file */
-EXTERN char *HostStatDir; /* location of host status information */
-EXTERN int MaxQueueRun; /* maximum number of jobs in one queue run */
-EXTERN int MaxChildren; /* maximum number of daemonic children */
-EXTERN int CurChildren; /* current number of daemonic children */
-EXTERN char *SmtpGreeting; /* SMTP greeting message (old $e macro) */
-EXTERN char *UnixFromLine; /* UNIX From_ line (old $l macro) */
-EXTERN char *OperatorChars; /* operators (old $o macro) */
-EXTERN bool DontInitGroups; /* avoid initgroups() because of NIS cost */
-EXTERN int DefaultNotify; /* default DSN notification flags */
-EXTERN bool AllowBogusHELO; /* allow syntax errors on HELO command */
-EXTERN bool UserSubmission; /* initial (user) mail submission */
-EXTERN char *RunAsUserName; /* user to become for bulk of run */
-EXTERN uid_t RunAsUid; /* UID to become for bulk of run */
-EXTERN gid_t RunAsGid; /* GID to become for bulk of run */
-EXTERN int MaxRcptPerMsg; /* max recipients per SMTP message */
-EXTERN bool DoQueueRun; /* non-interrupt time queue run needed */
-EXTERN u_long ConnectOnlyTo; /* override connection address (for testing) */
-EXTERN int MaxHeadersLength; /* max length of headers */
-#if _FFR_DSN_RRT_OPTION
-EXTERN bool RrtImpliesDsn; /* turn Return-Receipt-To: into DSN */
-#endif
-EXTERN char *DeadLetterDrop; /* path to dead letter office */
-EXTERN bool DontProbeInterfaces; /* don't probe interfaces for names */
-EXTERN bool ChownAlwaysSafe; /* treat chown(2) as safe */
-EXTERN bool IgnoreHostStatus; /* ignore long term host status files */
-EXTERN bool SingleThreadDelivery; /* single thread hosts on delivery */
-EXTERN bool SingleLineFromHeader; /* force From: header to be one line */
-EXTERN bool DontLockReadFiles; /* don't read lock support files */
-EXTERN int ConnRateThrottle; /* throttle for SMTP connection rate */
-EXTERN int MaxAliasRecursion; /* maximum depth of alias recursion */
-EXTERN int MaxMacroRecursion; /* maximum depth of macro recursion */
-EXTERN int MaxRuleRecursion; /* maximum depth of ruleset recursion */
-EXTERN char *MustQuoteChars; /* quote these characters in phrases */
-EXTERN char *ServiceSwitchFile; /* backup service switch */
-EXTERN char *DefaultCharSet; /* default character set for MIME */
-EXTERN char *PostMasterCopy; /* address to get errs cc's */
-EXTERN int CheckpointInterval; /* queue file checkpoint interval */
-EXTERN bool DontPruneRoutes; /* don't prune source routes */
-EXTERN bool DontExpandCnames; /* do not $[...$] expand CNAMEs */
-EXTERN int MaxMciCache; /* maximum entries in MCI cache */
-EXTERN time_t ServiceCacheTime; /* time service switch was cached */
-EXTERN time_t ServiceCacheMaxAge; /* refresh interval for cache */
-EXTERN time_t MciCacheTimeout; /* maximum idle time on connections */
-EXTERN time_t MciInfoTimeout; /* how long 'til we retry down hosts */
-EXTERN FILE *TrafficLogFile; /* file in which to log all traffic */
-EXTERN char *DoubleBounceAddr; /* where to send double bounces */
-EXTERN char **ExternalEnviron; /* input environment */
-EXTERN char *UserEnviron[MAXUSERENVIRON + 1];
- /* saved user environment */
-EXTERN int MaxMimeHeaderLength; /* maximum MIME header length */
-EXTERN int MaxMimeFieldLength; /* maximum MIME field length */
-
-extern int errno;
-
-/*
-** Queue Run Limitations
-*/
-struct queue_char
-{
- char *queue_match; /* string to match */
- struct queue_char *queue_next;
-};
-
-typedef struct queue_char QUEUE_CHAR;
-
-EXTERN QUEUE_CHAR *QueueLimitRecipient; /* limit queue runs to this recipient */
-EXTERN QUEUE_CHAR *QueueLimitSender; /* limit queue runs to this sender */
-EXTERN QUEUE_CHAR *QueueLimitId; /* limit queue runs to this id */
-
-/*
-** Timeouts
-**
-** Indicated values are the MINIMUM per RFC 1123 section 5.3.2.
-*/
-
-EXTERN struct
-{
- /* RFC 1123-specified timeouts [minimum value] */
- time_t to_initial; /* initial greeting timeout [5m] */
- time_t to_mail; /* MAIL command [5m] */
- time_t to_rcpt; /* RCPT command [5m] */
- time_t to_datainit; /* DATA initiation [2m] */
- time_t to_datablock; /* DATA block [3m] */
- time_t to_datafinal; /* DATA completion [10m] */
- time_t to_nextcommand; /* next command [5m] */
- /* following timeouts are not mentioned in RFC 1123 */
- time_t to_iconnect; /* initial connection timeout (first try) */
- time_t to_connect; /* initial connection timeout (later tries) */
- time_t to_rset; /* RSET command */
- time_t to_helo; /* HELO command */
- time_t to_quit; /* QUIT command */
- time_t to_miscshort; /* misc short commands (NOOP, VERB, etc) */
- time_t to_ident; /* IDENT protocol requests */
- time_t to_fileopen; /* opening :include: and .forward files */
- /* following are per message */
- time_t to_q_return[MAXTOCLASS]; /* queue return timeouts */
- time_t to_q_warning[MAXTOCLASS]; /* queue warning timeouts */
-} TimeOuts;
-
-/* timeout classes for return and warning timeouts */
-# define TOC_NORMAL 0 /* normal delivery */
-# define TOC_URGENT 1 /* urgent delivery */
-# define TOC_NONURGENT 2 /* non-urgent delivery */
-
-
-/*
-** Trace information
-*/
-
-/* trace vector and macros for debugging flags */
-EXTERN u_char tTdvect[100];
-# define tTd(flag, level) (tTdvect[flag] >= level)
-# define tTdlevel(flag) (tTdvect[flag])
-\f/*
-** Miscellaneous information.
-*/
-
-
-/*
-** The "no queue id" queue id for sm_syslog
-*/
-
-#define NOQID "*~*"
-
-
-/*
-** Some in-line functions
-*/
-
-/* set exit status */
-#define setstat(s) { \
- if (ExitStat == EX_OK || ExitStat == EX_TEMPFAIL) \
- ExitStat = s; \
- }
-
-/* make a copy of a string */
-#define newstr(s) strcpy(xalloc(strlen(s) + 1), s)
-
-#define STRUCTCOPY(s, d) d = s
-
-
-
-/*
-** Declarations of useful functions
-*/
-
-extern char *xalloc __P((int));
-extern char *sfgets __P((char *, int, FILE *, time_t, char *));
-extern char *queuename __P((ENVELOPE *, int));
-extern time_t curtime __P((void));
-extern bool transienterror __P((int));
-extern char *fgetfolded __P((char *, int, FILE *));
-extern char *username __P((void));
-extern char *pintvl __P((time_t, bool));
-extern bool shouldqueue __P((long, time_t));
-extern bool lockfile __P((int, char *, char *, int));
-extern char *hostsignature __P((MAILER *, char *, ENVELOPE *));
-extern void openxscript __P((ENVELOPE *));
-extern void closexscript __P((ENVELOPE *));
-extern char *shortenstring __P((const char *, int));
-extern bool usershellok __P((char *, char *));
-extern char *defcharset __P((ENVELOPE *));
-extern bool wordinclass __P((char *, int));
-extern char *denlstring __P((char *, bool, bool));
-extern void makelower __P((char *));
-extern bool rebuildaliases __P((MAP *, bool));
-extern void readaliases __P((MAP *, FILE *, bool, bool));
-extern void finis __P((bool, volatile int));
-extern void setsender __P((char *, ENVELOPE *, char **, int, bool));
-extern void xputs __P((const char *));
-extern void logsender __P((ENVELOPE *, char *));
-extern void smtprset __P((MAILER *, MCI *, ENVELOPE *));
-extern void smtpquit __P((MAILER *, MCI *, ENVELOPE *));
-extern void setuserenv __P((const char *, const char *));
-extern char *getextenv __P((const char *));
-extern void disconnect __P((int, ENVELOPE *));
-extern void putxline __P((char *, size_t, MCI *, int));
-extern void dumpfd __P((int, bool, bool));
-extern void makemailer __P((char *));
-extern void putfromline __P((MCI *, ENVELOPE *));
-extern void setoption __P((int, char *, bool, bool, ENVELOPE *));
-extern void setclass __P((int, char *));
-extern void inittimeouts __P((char *));
-extern void logdelivery __P((MAILER *, MCI *, const char *, ADDRESS *, time_t, ENVELOPE *));
-extern void giveresponse __P((int, MAILER *, MCI *, ADDRESS *, time_t, ENVELOPE *));
-extern void buildfname __P((char *, char *, char *, int));
-extern void mci_setstat __P((MCI *, int, char *, char *));
-extern char *smtptodsn __P((int));
-extern int rscheck __P((char *, char *, char *, ENVELOPE *e));
-extern void mime7to8 __P((MCI *, HDR *, ENVELOPE *));
-extern int mime8to7 __P((MCI *, HDR *, ENVELOPE *, char **, int));
-extern void xfclose __P((FILE *, char *, char *));
-extern int switch_map_find __P((char *, char *[], short []));
-extern void shorten_hostname __P((char []));
-extern int waitfor __P((pid_t));
-extern void proc_list_add __P((pid_t, char *));
-extern void proc_list_set __P((pid_t, char *));
-extern void proc_list_drop __P((pid_t));
-extern void proc_list_clear __P((void));
-extern void proc_list_display __P((FILE *));
-extern void proc_list_probe __P((void));
-extern void buffer_errors __P((void));
-extern void flush_errors __P((bool));
-extern void putline __P((char *, MCI *));
-extern bool xtextok __P((char *));
-extern char *xtextify __P((char *, char *));
-extern char *xuntextify __P((char *));
-extern void cleanstrcpy __P((char *, char *, int));
-extern int getmxrr __P((char *, char **, bool, int *));
-extern int strtorwset __P((char *, char **, int));
-extern void printav __P((char **));
-extern void printopenfds __P((bool));
-extern int endmailer __P((MCI *, ENVELOPE *, char **));
-extern void fixcrlf __P((char *, bool));
-extern int dofork __P((void));
-extern void initsys __P((ENVELOPE *));
-extern void collect __P((FILE *, bool, HDR **, ENVELOPE *));
-extern void stripquotes __P((char *));
-extern int include __P((char *, bool, ADDRESS *, ADDRESS **, int, ENVELOPE *));
-extern void unlockqueue __P((ENVELOPE *));
-extern void xunlink __P((char *));
-extern bool runqueue __P((bool, bool));
-extern int getla __P((void));
-extern void sendall __P((ENVELOPE *, int));
-extern void queueup __P((ENVELOPE *, bool));
-extern void checkfds __P((char *));
-extern int returntosender __P((char *, ADDRESS *, int, ENVELOPE *));
-extern void markstats __P((ENVELOPE *, ADDRESS *, bool));
-extern void poststats __P((char *));
-extern char *arpadate __P((char *));
-extern int mailfile __P((char *volatile, MAILER *volatile, ADDRESS *, volatile int, ENVELOPE *));
-extern void loseqfile __P((ENVELOPE *, char *));
-extern int prog_open __P((char **, int *, ENVELOPE *));
-extern bool getcanonname __P((char *, int, bool));
-extern bool path_is_dir __P((char *, bool));
-extern pid_t dowork __P((char *, bool, bool, ENVELOPE *));
-extern int drop_privileges __P((bool));
-extern void fill_fd __P((int, char *));
-extern void closecontrolsocket __P((bool));
-extern void clrcontrol __P((void));
-
-extern const char *errstring __P((int));
-extern sigfunc_t setsignal __P((int, sigfunc_t));
-extern int blocksignal __P((int));
-extern int releasesignal __P((int));
-extern struct hostent *sm_gethostbyname __P((char *));
-extern struct hostent *sm_gethostbyaddr __P((char *, int, int));
-extern struct passwd *sm_getpwnam __P((char *));
-extern struct passwd *sm_getpwuid __P((UID_T));
-extern struct passwd *finduser __P((char *, bool *));
-
-#ifdef XDEBUG
-extern void checkfdopen __P((int, char *));
-extern void checkfd012 __P((char *));
-#endif
-
-/* ellipsis is a different case though */
-extern void auth_warning __P((ENVELOPE *, const char *, ...));
-extern void syserr __P((const char *, ...));
-extern void usrerr __P((const char *, ...));
-extern void message __P((const char *, ...));
-extern void nmessage __P((const char *, ...));
-extern void setproctitle __P((const char *, ...));
-extern void sm_setproctitle __P((bool, const char *, ...));
-extern void sm_syslog __P((int, const char *, const char *, ...));
-
-#if !HASSNPRINTF
-extern int snprintf __P((char *, size_t, const char *, ...));
-extern int vsnprintf __P((char *, size_t, const char *, va_list));
-#endif
-extern char *quad_to_string __P((QUAD_T));
+++ /dev/null
-cpyr
-cpyr Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-cpyr Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
-cpyr Copyright (c) 1988, 1993
-cpyr The Regents of the University of California. All rights reserved.
-cpyr
-cpyr
-cpyr By using this file, you agree to the terms and conditions set
-cpyr forth in the LICENSE file which can be found at the top level of
-cpyr the sendmail distribution.
-cpyr
-cpyr @(#)sendmail.hf 8.18 (Berkeley) 11/19/1998
-cpyr
-smtp Topics:
-smtp HELO EHLO MAIL RCPT DATA
-smtp RSET NOOP QUIT HELP VRFY
-smtp EXPN VERB ETRN DSN
-smtp For more info use "HELP <topic>".
-smtp To report bugs in the implementation send email to
-smtp sendmail-bugs@sendmail.org.
-smtp For local information send email to Postmaster at your site.
-help HELP [ <topic> ]
-help The HELP command gives help info.
-helo HELO <hostname>
-helo Introduce yourself.
-ehlo EHLO <hostname>
-ehlo Introduce yourself, and request extended SMTP mode.
-ehlo Possible replies include:
-ehlo SEND Send as mail [RFC821]
-ehlo SOML Send as mail or terminal [RFC821]
-ehlo SAML Send as mail and terminal [RFC821]
-ehlo EXPN Expand the mailing list [RFC821]
-ehlo HELP Supply helpful information [RFC821]
-ehlo TURN Turn the operation around [RFC821]
-ehlo 8BITMIME Use 8-bit data [RFC1652]
-ehlo SIZE Message size declaration [RFC1870]
-ehlo VERB Verbose [Allman]
-ehlo ONEX One message transaction only [Allman]
-ehlo CHUNKING Chunking [RFC1830]
-ehlo BINARYMIME Binary MIME [RFC1830]
-ehlo PIPELINING Command Pipelining [RFC1854]
-ehlo DSN Delivery Status Notification [RFC1891]
-ehlo ETRN Remote Message Queue Starting [RFC1985]
-ehlo XUSR Initial (user) submission [Allman]
-mail MAIL FROM: <sender> [ <parameters> ]
-mail Specifies the sender. Parameters are ESMTP extensions.
-mail See "HELP DSN" for details.
-rcpt RCPT TO: <recipient> [ <parameters> ]
-rcpt Specifies the recipient. Can be used any number of times.
-rcpt Parameters are ESMTP extensions. See "HELP DSN" for details.
-data DATA
-data Following text is collected as the message.
-data End with a single dot.
-rset RSET
-rset Resets the system.
-quit QUIT
-quit Exit sendmail (SMTP).
-verb VERB
-verb Go into verbose mode. This sends 0xy responses that are
-verb not RFC821 standard (but should be) They are recognized
-verb by humans and other sendmail implementations.
-vrfy VRFY <recipient>
-vrfy Verify an address. If you want to see what it aliases
-vrfy to, use EXPN instead.
-expn EXPN <recipient>
-expn Expand an address. If the address indicates a mailing
-expn list, return the contents of that list.
-noop NOOP
-noop Do nothing.
-send SEND FROM: <sender>
-send replaces the MAIL command, and can be used to send
-send directly to a users terminal. Not supported in this
-send implementation.
-soml SOML FROM: <sender>
-soml Send or mail. If the user is logged in, send directly,
-soml otherwise mail. Not supported in this implementation.
-saml SAML FROM: <sender>
-saml Send and mail. Send directly to the user's terminal,
-saml and also mail a letter. Not supported in this
-saml implementation.
-turn TURN
-turn Reverses the direction of the connection. Not currently
-turn implemented.
-etrn ETRN [ <hostname> | @<domain> | #<queuename> ]
-etrn Run the queue for the specified <hostname>, or
-etrn all hosts within a given <domain>, or a specially-named
-etrn <queuename> (implementation-specific).
-dsn MAIL FROM: <sender> [ RET={ FULL | HDRS} ] [ ENVID=<envid> ]
-dsn RCPT TO: <recipient> [ NOTIFY={NEVER,SUCCESS,FAILURE,DELAY} ]
-dsn [ ORCPT=<recipient> ]
-dsn SMTP Delivery Status Notifications.
-dsn Descriptions:
-dsn RET Return either the full message or only headers.
-dsn ENVID Sender's "envelope identifier" for tracking.
-dsn NOTIFY When to send a DSN. Multiple options are OK, comma-
-dsn delimited. NEVER must appear by itself.
-dsn ORCPT Original recipient.
--bt Help for test mode:
--bt ? :this help message.
--bt .Dmvalue :define macro `m' to `value'.
--bt .Ccvalue :add `value' to class `c'.
--bt =Sruleset :dump the contents of the indicated ruleset.
--bt =M :display the known mailers.
--bt -ddebug-spec :equivalent to the command-line -d debug flag.
--bt $m :print the value of macro $m.
--bt $=c :print the contents of class $=c.
--bt /mx host :returns the MX records for `host'.
--bt /parse address :parse address, returning the value of crackaddr, and
--bt the parsed address (same as -bv).
--bt /try mailer addr :rewrite address into the form it will have when
--bt presented to the indicated mailer.
--bt /tryflags flags :set flags used by parsing. The flags can be `H' for
--bt Header or `E' for Envelope, and `S' for Sender or `R'
--bt for Recipient. These can be combined, `HR' sets
--bt flags for header recipients.
--bt /canon hostname :try to canonify hostname.
--bt /map mapname key :look up `key' in the indicated `mapname'.
--bt rules addr :run the indicated address through the named rules.
--bt Rules can be a comma separated list of rules.
-control Help for smcontrol:
-control help This message.
-control restart Restart sendmail.
-control shutdown Shutdown sendmail.
-control status Show sendmail status.
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)snprintf.c 8.12 (Berkeley) 10/13/1998";
-#endif /* not lint */
-
-#include "sendmail.h"
-
-\f/*
-** SNPRINTF, VSNPRINT -- counted versions of printf
-**
-** These versions have been grabbed off the net. They have been
-** cleaned up to compile properly and support for .precision and
-** %lx has been added.
-*/
-
-/**************************************************************
- * Original:
- * Patrick Powell Tue Apr 11 09:48:21 PDT 1995
- * A bombproof version of doprnt (sm_dopr) included.
- * Sigh. This sort of thing is always nasty do deal with. Note that
- * the version here does not include floating point...
- *
- * snprintf() is used instead of sprintf() as it does limit checks
- * for string length. This covers a nasty loophole.
- *
- * The other functions are there to prevent NULL pointers from
- * causing nast effects.
- **************************************************************/
-
-/*static char _id[] = "$Id: snprintf.c,v 1.3 1999/01/01 20:34:02 millert Exp $";*/
-void sm_dopr();
-char *DoprEnd;
-int SnprfOverflow;
-
-#if !HASSNPRINTF
-
-/* VARARGS3 */
-int
-# ifdef __STDC__
-snprintf(char *str, size_t count, const char *fmt, ...)
-# else
-snprintf(str, count, fmt, va_alist)
- char *str;
- size_t count;
- const char *fmt;
- va_dcl
-#endif
-{
- int len;
- VA_LOCAL_DECL
-
- VA_START(fmt);
- len = vsnprintf(str, count, fmt, ap);
- VA_END;
- return len;
-}
-
-
-# ifndef luna2
-int
-vsnprintf(str, count, fmt, args)
- char *str;
- size_t count;
- const char *fmt;
- va_list args;
-{
- str[0] = 0;
- DoprEnd = str + count - 1;
- SnprfOverflow = 0;
- sm_dopr( str, fmt, args );
- if (count > 0)
- DoprEnd[0] = 0;
- if (SnprfOverflow && tTd(57, 2))
- printf("\nvsnprintf overflow, len = %ld, str = %s",
- (long) count, shortenstring(str, MAXSHORTSTR));
- return strlen(str);
-}
-
-# endif /* !luna2 */
-#endif /* !HASSNPRINTF */
-
-/*
- * sm_dopr(): poor man's version of doprintf
- */
-
-void fmtstr __P((char *value, int ljust, int len, int zpad, int maxwidth));
-void fmtnum __P((long value, int base, int dosign, int ljust, int len, int zpad));
-void dostr __P(( char * , int ));
-char *output;
-void dopr_outch __P(( int c ));
-int SyslogErrno;
-
-void
-sm_dopr( buffer, format, args )
- char *buffer;
- const char *format;
- va_list args;
-{
- int ch;
- long value;
- int longflag = 0;
- int pointflag = 0;
- int maxwidth = 0;
- char *strvalue;
- int ljust;
- int len;
- int zpad;
-# if !HASSTRERROR && !defined(ERRLIST_PREDEFINED)
- extern char *sys_errlist[];
- extern int sys_nerr;
-# endif
-
-
- output = buffer;
- while( (ch = *format++) != '\0' ){
- switch( ch ){
- case '%':
- ljust = len = zpad = maxwidth = 0;
- longflag = pointflag = 0;
- nextch:
- ch = *format++;
- switch( ch ){
- case 0:
- dostr( "**end of format**" , 0);
- return;
- case '-': ljust = 1; goto nextch;
- case '0': /* set zero padding if len not set */
- if(len==0 && !pointflag) zpad = '0';
- case '1': case '2': case '3':
- case '4': case '5': case '6':
- case '7': case '8': case '9':
- if (pointflag)
- maxwidth = maxwidth*10 + ch - '0';
- else
- len = len*10 + ch - '0';
- goto nextch;
- case '*':
- if (pointflag)
- maxwidth = va_arg( args, int );
- else
- len = va_arg( args, int );
- goto nextch;
- case '.': pointflag = 1; goto nextch;
- case 'l': longflag = 1; goto nextch;
- case 'u': case 'U':
- /*fmtnum(value,base,dosign,ljust,len,zpad) */
- if( longflag ){
- value = va_arg( args, long );
- } else {
- value = va_arg( args, int );
- }
- fmtnum( value, 10,0, ljust, len, zpad ); break;
- case 'o': case 'O':
- /*fmtnum(value,base,dosign,ljust,len,zpad) */
- if( longflag ){
- value = va_arg( args, long );
- } else {
- value = va_arg( args, int );
- }
- fmtnum( value, 8,0, ljust, len, zpad ); break;
- case 'd': case 'D':
- if( longflag ){
- value = va_arg( args, long );
- } else {
- value = va_arg( args, int );
- }
- fmtnum( value, 10,1, ljust, len, zpad ); break;
- case 'x':
- if( longflag ){
- value = va_arg( args, long );
- } else {
- value = va_arg( args, int );
- }
- fmtnum( value, 16,0, ljust, len, zpad ); break;
- case 'X':
- if( longflag ){
- value = va_arg( args, long );
- } else {
- value = va_arg( args, int );
- }
- fmtnum( value,-16,0, ljust, len, zpad ); break;
- case 's':
- strvalue = va_arg( args, char *);
- if (maxwidth > 0 || !pointflag) {
- if (pointflag && len > maxwidth)
- len = maxwidth; /* Adjust padding */
- fmtstr( strvalue,ljust,len,zpad, maxwidth);
- }
- break;
- case 'c':
- ch = va_arg( args, int );
- dopr_outch( ch ); break;
- case 'm':
-#if HASSTRERROR
- dostr(strerror(SyslogErrno), 0);
-#else
- if (SyslogErrno < 0 || SyslogErrno >= sys_nerr)
- {
- dostr("Error ", 0);
- fmtnum(SyslogErrno, 10, 0, 0, 0, 0);
- }
- else
- dostr((char *)sys_errlist[SyslogErrno], 0);
-#endif
- break;
-
- case '%': dopr_outch( ch ); continue;
- default:
- dostr( "???????" , 0);
- }
- break;
- default:
- dopr_outch( ch );
- break;
- }
- }
- *output = 0;
-}
-
-void
-fmtstr( value, ljust, len, zpad, maxwidth )
- char *value;
- int ljust, len, zpad, maxwidth;
-{
- int padlen, strlen; /* amount to pad */
-
- if( value == 0 ){
- value = "<NULL>";
- }
- for( strlen = 0; value[strlen]; ++ strlen ); /* strlen */
- if (strlen > maxwidth && maxwidth)
- strlen = maxwidth;
- padlen = len - strlen;
- if( padlen < 0 ) padlen = 0;
- if( ljust ) padlen = -padlen;
- while( padlen > 0 ) {
- dopr_outch( ' ' );
- --padlen;
- }
- dostr( value, maxwidth );
- while( padlen < 0 ) {
- dopr_outch( ' ' );
- ++padlen;
- }
-}
-
-void
-fmtnum( value, base, dosign, ljust, len, zpad )
- long value;
- int base, dosign, ljust, len, zpad;
-{
- int signvalue = 0;
- unsigned long uvalue;
- char convert[20];
- int place = 0;
- int padlen = 0; /* amount to pad */
- int caps = 0;
-
- /* DEBUGP(("value 0x%x, base %d, dosign %d, ljust %d, len %d, zpad %d\n",
- value, base, dosign, ljust, len, zpad )); */
- uvalue = value;
- if( dosign ){
- if( value < 0 ) {
- signvalue = '-';
- uvalue = -value;
- }
- }
- if( base < 0 ){
- caps = 1;
- base = -base;
- }
- do{
- convert[place++] =
- (caps? "0123456789ABCDEF":"0123456789abcdef")
- [uvalue % (unsigned)base ];
- uvalue = (uvalue / (unsigned)base );
- }while(uvalue);
- convert[place] = 0;
- padlen = len - place;
- if( padlen < 0 ) padlen = 0;
- if( ljust ) padlen = -padlen;
- /* DEBUGP(( "str '%s', place %d, sign %c, padlen %d\n",
- convert,place,signvalue,padlen)); */
- if( zpad && padlen > 0 ){
- if( signvalue ){
- dopr_outch( signvalue );
- --padlen;
- signvalue = 0;
- }
- while( padlen > 0 ){
- dopr_outch( zpad );
- --padlen;
- }
- }
- while( padlen > 0 ) {
- dopr_outch( ' ' );
- --padlen;
- }
- if( signvalue ) dopr_outch( signvalue );
- while( place > 0 ) dopr_outch( convert[--place] );
- while( padlen < 0 ){
- dopr_outch( ' ' );
- ++padlen;
- }
-}
-
-void
-dostr( str , cut)
- char *str;
- int cut;
-{
- if (cut) {
- while(*str && cut-- > 0) dopr_outch(*str++);
- } else {
- while(*str) dopr_outch(*str++);
- }
-}
-
-void
-dopr_outch( c )
- int c;
-{
-#if 0
- if( iscntrl(c) && c != '\n' && c != '\t' ){
- c = '@' + (c & 0x1F);
- if( DoprEnd == 0 || output < DoprEnd )
- *output++ = '^';
- }
-#endif
- if( DoprEnd == 0 || output < DoprEnd )
- *output++ = c;
- else
- SnprfOverflow++;
-}
-
-\f/*
-** QUAD_TO_STRING -- Convert a quad type to a string.
-**
-** Convert a quad type to a string. This must be done
-** separately as %lld/%qd are not supported by snprint()
-** and adding support would slow down systems which only
-** emulate the data type.
-**
-** Parameters:
-** value -- number to convert to a string.
-**
-** Returns:
-** pointer to a string.
-*/
-
-char *
-quad_to_string(value)
- QUAD_T value;
-{
- char *fmtstr;
- static char buf[64];
-
- /*
- ** Use sprintf() instead of snprintf() since snprintf()
- ** does not support %qu or %llu. The buffer is large enough
- ** to hold the string so there is no danger of buffer
- ** overflow.
- */
-
-#if NEED_PERCENTQ
- fmtstr = "%qu";
-#else
- fmtstr = "%llu";
-#endif
- sprintf(buf, fmtstr, value);
- return buf;
-}
-\f/*
-** SHORTENSTRING -- return short version of a string
-**
-** If the string is already short, just return it. If it is too
-** long, return the head and tail of the string.
-**
-** Parameters:
-** s -- the string to shorten.
-** m -- the max length of the string.
-**
-** Returns:
-** Either s or a short version of s.
-*/
-
-char *
-shortenstring(s, m)
- register const char *s;
- int m;
-{
- int l;
- static char buf[MAXSHORTSTR + 1];
-
- l = strlen(s);
- if (l < m)
- return (char *) s;
- if (m > MAXSHORTSTR)
- m = MAXSHORTSTR;
- else if (m < 10)
- {
- if (m < 5)
- {
- strncpy(buf, s, m);
- buf[m] = '\0';
- return buf;
- }
- strncpy(buf, s, m - 3);
- strcpy(buf + m - 3, "...");
- return buf;
- }
- m = (m - 3) / 2;
- strncpy(buf, s, m);
- strcpy(buf + m, "...");
- strcpy(buf + m + 3, s + l - m);
- return buf;
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-# include "sendmail.h"
-
-#ifndef lint
-#if SMTP
-static char sccsid[] = "@(#)srvrsmtp.c 8.187 (Berkeley) 10/23/1998 (with SMTP)";
-#else
-static char sccsid[] = "@(#)srvrsmtp.c 8.187 (Berkeley) 10/23/1998 (without SMTP)";
-#endif
-#endif /* not lint */
-
-# include <errno.h>
-
-# if SMTP
-
-/*
-** SMTP -- run the SMTP protocol.
-**
-** Parameters:
-** nullserver -- if non-NULL, rejection message for
-** all SMTP commands.
-** e -- the envelope.
-**
-** Returns:
-** never.
-**
-** Side Effects:
-** Reads commands from the input channel and processes
-** them.
-*/
-
-struct cmd
-{
- char *cmdname; /* command name */
- int cmdcode; /* internal code, see below */
-};
-
-/* values for cmdcode */
-# define CMDERROR 0 /* bad command */
-# define CMDMAIL 1 /* mail -- designate sender */
-# define CMDRCPT 2 /* rcpt -- designate recipient */
-# define CMDDATA 3 /* data -- send message text */
-# define CMDRSET 4 /* rset -- reset state */
-# define CMDVRFY 5 /* vrfy -- verify address */
-# define CMDEXPN 6 /* expn -- expand address */
-# define CMDNOOP 7 /* noop -- do nothing */
-# define CMDQUIT 8 /* quit -- close connection and die */
-# define CMDHELO 9 /* helo -- be polite */
-# define CMDHELP 10 /* help -- give usage info */
-# define CMDEHLO 11 /* ehlo -- extended helo (RFC 1425) */
-# define CMDETRN 12 /* etrn -- flush queue */
-/* non-standard commands */
-# define CMDONEX 16 /* onex -- sending one transaction only */
-# define CMDVERB 17 /* verb -- go into verbose mode */
-# define CMDXUSR 18 /* xusr -- initial (user) submission */
-/* use this to catch and log "door handle" attempts on your system */
-# define CMDLOGBOGUS 23 /* bogus command that should be logged */
-/* debugging-only commands, only enabled if SMTPDEBUG is defined */
-# define CMDDBGQSHOW 24 /* showq -- show send queue */
-# define CMDDBGDEBUG 25 /* debug -- set debug mode */
-
-static struct cmd CmdTab[] =
-{
- { "mail", CMDMAIL },
- { "rcpt", CMDRCPT },
- { "data", CMDDATA },
- { "rset", CMDRSET },
- { "vrfy", CMDVRFY },
- { "expn", CMDEXPN },
- { "help", CMDHELP },
- { "noop", CMDNOOP },
- { "quit", CMDQUIT },
- { "helo", CMDHELO },
- { "ehlo", CMDEHLO },
- { "etrn", CMDETRN },
- { "verb", CMDVERB },
- { "onex", CMDONEX },
- { "xusr", CMDXUSR },
- /* remaining commands are here only to trap and log attempts to use them */
- { "showq", CMDDBGQSHOW },
- { "debug", CMDDBGDEBUG },
- { "wiz", CMDLOGBOGUS },
-
- { NULL, CMDERROR }
-};
-
-bool OneXact = FALSE; /* one xaction only this run */
-char *CurSmtpClient; /* who's at the other end of channel */
-
-static char *skipword __P((char *volatile, char *));
-
-
-#define MAXBADCOMMANDS 25 /* maximum number of bad commands */
-#define MAXNOOPCOMMANDS 20 /* max "noise" commands before slowdown */
-#define MAXHELOCOMMANDS 3 /* max HELO/EHLO commands before slowdown */
-#define MAXVRFYCOMMANDS 6 /* max VRFY/EXPN commands before slowdown */
-#define MAXETRNCOMMANDS 8 /* max ETRN commands before slowdown */
-
-void
-smtp(nullserver, e)
- char *nullserver;
- register ENVELOPE *volatile e;
-{
- register char *volatile p;
- register struct cmd *c;
- char *cmd;
- auto ADDRESS *vrfyqueue;
- ADDRESS *a;
- volatile bool gotmail; /* mail command received */
- volatile bool gothello; /* helo command received */
- bool vrfy; /* set if this is a vrfy command */
- char *volatile protocol; /* sending protocol */
- char *volatile sendinghost; /* sending hostname */
- char *volatile peerhostname; /* name of SMTP peer or "localhost" */
- auto char *delimptr;
- char *id;
- volatile int nrcpts = 0; /* number of RCPT commands */
- bool doublequeue;
- volatile bool discard;
- volatile int badcommands = 0; /* count of bad commands */
- volatile int nverifies = 0; /* count of VRFY/EXPN commands */
- volatile int n_etrn = 0; /* count of ETRN commands */
- volatile int n_noop = 0; /* count of NOOP/VERB/ONEX etc cmds */
- volatile int n_helo = 0; /* count of HELO/EHLO commands */
- bool ok;
- volatile int lognullconnection = TRUE;
- register char *q;
- QUEUE_CHAR *new;
- char inp[MAXLINE];
- char cmdbuf[MAXLINE];
- extern ENVELOPE BlankEnvelope;
- extern void help __P((char *));
- extern void settime __P((ENVELOPE *));
- extern bool enoughdiskspace __P((long));
- extern int runinchild __P((char *, ENVELOPE *));
- extern void checksmtpattack __P((volatile int *, int, char *, ENVELOPE *));
-
- if (fileno(OutChannel) != fileno(stdout))
- {
- /* arrange for debugging output to go to remote host */
- (void) dup2(fileno(OutChannel), fileno(stdout));
- }
- settime(e);
- peerhostname = RealHostName;
- if (peerhostname == NULL)
- peerhostname = "localhost";
- CurHostName = peerhostname;
- CurSmtpClient = macvalue('_', e);
- if (CurSmtpClient == NULL)
- CurSmtpClient = CurHostName;
-
- /* check_relay may have set discard bit, save for later */
- discard = bitset(EF_DISCARD, e->e_flags);
-
- sm_setproctitle(TRUE, "server %s startup", CurSmtpClient);
-#if DAEMON
- if (LogLevel > 11)
- {
- /* log connection information */
- sm_syslog(LOG_INFO, NOQID,
- "SMTP connect from %.100s (%.100s)",
- CurSmtpClient, anynet_ntoa(&RealHostAddr));
- }
-#endif
-
- /* output the first line, inserting "ESMTP" as second word */
- expand(SmtpGreeting, inp, sizeof inp, e);
- p = strchr(inp, '\n');
- if (p != NULL)
- *p++ = '\0';
- id = strchr(inp, ' ');
- if (id == NULL)
- id = &inp[strlen(inp)];
- cmd = p == NULL ? "220 %.*s ESMTP%s" : "220-%.*s ESMTP%s";
- message(cmd, id - inp, inp, id);
-
- /* output remaining lines */
- while ((id = p) != NULL && (p = strchr(id, '\n')) != NULL)
- {
- *p++ = '\0';
- if (isascii(*id) && isspace(*id))
- id++;
- message("220-%s", id);
- }
- if (id != NULL)
- {
- if (isascii(*id) && isspace(*id))
- id++;
- message("220 %s", id);
- }
-
- protocol = NULL;
- sendinghost = macvalue('s', e);
- gothello = FALSE;
- gotmail = FALSE;
- for (;;)
- {
- /* arrange for backout */
- (void) setjmp(TopFrame);
- QuickAbort = FALSE;
- HoldErrs = FALSE;
- SuprErrs = FALSE;
- LogUsrErrs = FALSE;
- OnlyOneError = TRUE;
- e->e_flags &= ~(EF_VRFYONLY|EF_GLOBALERRS);
-
- /* setup for the read */
- e->e_to = NULL;
- Errors = 0;
- (void) fflush(stdout);
-
- /* read the input line */
- SmtpPhase = "server cmd read";
- sm_setproctitle(TRUE, "server %s cmd read", CurSmtpClient);
- p = sfgets(inp, sizeof inp, InChannel, TimeOuts.to_nextcommand,
- SmtpPhase);
-
- /* handle errors */
- if (p == NULL)
- {
- /* end of file, just die */
- disconnect(1, e);
- message("421 %s Lost input channel from %s",
- MyHostName, CurSmtpClient);
- if (LogLevel > (gotmail ? 1 : 19))
- sm_syslog(LOG_NOTICE, e->e_id,
- "lost input channel from %.100s",
- CurSmtpClient);
- if (lognullconnection && LogLevel > 5)
- sm_syslog(LOG_INFO, NULL,
- "Null connection from %.100s",
- CurSmtpClient);
-
- /*
- ** If have not accepted mail (DATA), do not bounce
- ** bad addresses back to sender.
- */
- if (bitset(EF_CLRQUEUE, e->e_flags))
- e->e_sendqueue = NULL;
-
- if (InChild)
- ExitStat = EX_QUIT;
- finis(TRUE, ExitStat);
- }
-
- /* clean up end of line */
- fixcrlf(inp, TRUE);
-
- /* echo command to transcript */
- if (e->e_xfp != NULL)
- fprintf(e->e_xfp, "<<< %s\n", inp);
-
- if (LogLevel >= 15)
- sm_syslog(LOG_INFO, e->e_id,
- "<-- %s",
- inp);
-
- if (e->e_id == NULL)
- sm_setproctitle(TRUE, "%s: %.80s", CurSmtpClient, inp);
- else
- sm_setproctitle(TRUE, "%s %s: %.80s", e->e_id, CurSmtpClient, inp);
-
- /* break off command */
- for (p = inp; isascii(*p) && isspace(*p); p++)
- continue;
- cmd = cmdbuf;
- while (*p != '\0' &&
- !(isascii(*p) && isspace(*p)) &&
- cmd < &cmdbuf[sizeof cmdbuf - 2])
- *cmd++ = *p++;
- *cmd = '\0';
-
- /* throw away leading whitespace */
- while (isascii(*p) && isspace(*p))
- p++;
-
- /* decode command */
- for (c = CmdTab; c->cmdname != NULL; c++)
- {
- if (!strcasecmp(c->cmdname, cmdbuf))
- break;
- }
-
- /* reset errors */
- errno = 0;
-
- /*
- ** Process command.
- **
- ** If we are running as a null server, return 550
- ** to everything.
- */
-
- if (nullserver != NULL)
- {
- switch (c->cmdcode)
- {
- case CMDQUIT:
- case CMDHELO:
- case CMDEHLO:
- case CMDNOOP:
- /* process normally */
- break;
-
- default:
- if (++badcommands > MAXBADCOMMANDS)
- sleep(1);
- usrerr("550 %s", nullserver);
- continue;
- }
- }
-
- /* non-null server */
- switch (c->cmdcode)
- {
- case CMDMAIL:
- case CMDEXPN:
- case CMDVRFY:
- case CMDETRN:
- lognullconnection = FALSE;
- }
-
- switch (c->cmdcode)
- {
- case CMDHELO: /* hello -- introduce yourself */
- case CMDEHLO: /* extended hello */
- if (c->cmdcode == CMDEHLO)
- {
- protocol = "ESMTP";
- SmtpPhase = "server EHLO";
- }
- else
- {
- protocol = "SMTP";
- SmtpPhase = "server HELO";
- }
-
- /* avoid denial-of-service */
- checksmtpattack(&n_helo, MAXHELOCOMMANDS, "HELO/EHLO", e);
-
- /* check for duplicate HELO/EHLO per RFC 1651 4.2 */
- if (gothello)
- {
- usrerr("503 %s Duplicate HELO/EHLO",
- MyHostName);
- break;
- }
-
- /* check for valid domain name (re 1123 5.2.5) */
- if (*p == '\0' && !AllowBogusHELO)
- {
- usrerr("501 %s requires domain address",
- cmdbuf);
- break;
- }
-
- /* check for long domain name (hides Received: info) */
- if (strlen(p) > MAXNAME)
- {
- usrerr("501 Invalid domain name");
- break;
- }
-
- for (q = p; *q != '\0'; q++)
- {
- if (!isascii(*q))
- break;
- if (isalnum(*q))
- continue;
- if (isspace(*q))
- {
- *q = '\0';
- break;
- }
- if (strchr("[].-_#", *q) == NULL)
- break;
- }
- if (*q == '\0')
- {
- q = "pleased to meet you";
- sendinghost = newstr(p);
- }
- else if (!AllowBogusHELO)
- {
- usrerr("501 Invalid domain name");
- break;
- }
- else
- {
- q = "accepting invalid domain name";
- }
-
- gothello = TRUE;
-
- /* print HELO response message */
- if (c->cmdcode != CMDEHLO || nullserver != NULL)
- {
- message("250 %s Hello %s, %s",
- MyHostName, CurSmtpClient, q);
- break;
- }
-
- message("250-%s Hello %s, %s",
- MyHostName, CurSmtpClient, q);
-
- /* print EHLO features list */
- if (!bitset(PRIV_NOEXPN, PrivacyFlags))
- {
- message("250-EXPN");
- if (!bitset(PRIV_NOVERB, PrivacyFlags))
- message("250-VERB");
- }
-#if MIME8TO7
- message("250-8BITMIME");
-#endif
- if (MaxMessageSize > 0)
- message("250-SIZE %ld", MaxMessageSize);
- else
- message("250-SIZE");
-#if DSN
- if (SendMIMEErrors)
- message("250-DSN");
-#endif
- message("250-ONEX");
- if (!bitset(PRIV_NOETRN, PrivacyFlags))
- message("250-ETRN");
- message("250-XUSR");
- message("250 HELP");
- break;
-
- case CMDMAIL: /* mail -- designate sender */
- SmtpPhase = "server MAIL";
-
- /* check for validity of this command */
- if (!gothello && bitset(PRIV_NEEDMAILHELO, PrivacyFlags))
- {
- usrerr("503 Polite people say HELO first");
- break;
- }
- if (gotmail)
- {
- usrerr("503 Sender already specified");
- break;
- }
- if (InChild)
- {
- errno = 0;
- syserr("503 Nested MAIL command: MAIL %s", p);
- finis(TRUE, ExitStat);
- }
-
- /* make sure we know who the sending host is */
- if (sendinghost == NULL)
- sendinghost = peerhostname;
-
- p = skipword(p, "from");
- if (p == NULL)
- break;
-
- /* fork a subprocess to process this command */
- if (runinchild("SMTP-MAIL", e) > 0)
- break;
- if (Errors > 0)
- goto undo_subproc_no_pm;
- if (!gothello)
- {
- auth_warning(e,
- "%s didn't use HELO protocol",
- CurSmtpClient);
- }
-#ifdef PICKY_HELO_CHECK
- if (strcasecmp(sendinghost, peerhostname) != 0 &&
- (strcasecmp(peerhostname, "localhost") != 0 ||
- strcasecmp(sendinghost, MyHostName) != 0))
- {
- auth_warning(e, "Host %s claimed to be %s",
- CurSmtpClient, sendinghost);
- }
-#endif
-
- if (protocol == NULL)
- protocol = "SMTP";
- define('r', protocol, e);
- define('s', sendinghost, e);
- initsys(e);
- if (Errors > 0)
- goto undo_subproc_no_pm;
- nrcpts = 0;
- e->e_flags |= EF_LOGSENDER|EF_CLRQUEUE;
- sm_setproctitle(TRUE, "%s %s: %.80s", e->e_id, CurSmtpClient, inp);
-
- /* child -- go do the processing */
- if (setjmp(TopFrame) > 0)
- {
- /* this failed -- undo work */
- undo_subproc_no_pm:
- e->e_flags &= ~EF_PM_NOTIFY;
- undo_subproc:
- if (InChild)
- {
- QuickAbort = FALSE;
- SuprErrs = TRUE;
- e->e_flags &= ~EF_FATALERRS;
- finis(TRUE, ExitStat);
- }
- break;
- }
- QuickAbort = TRUE;
-
- /* must parse sender first */
- delimptr = NULL;
- setsender(p, e, &delimptr, ' ', FALSE);
- if (delimptr != NULL && *delimptr != '\0')
- *delimptr++ = '\0';
- if (Errors > 0)
- goto undo_subproc_no_pm;
-
- /* do config file checking of the sender */
- if (rscheck("check_mail", p, NULL, e) != EX_OK ||
- Errors > 0)
- goto undo_subproc_no_pm;
-
- /* check for possible spoofing */
- if (RealUid != 0 && OpMode == MD_SMTP &&
- !wordinclass(RealUserName, 't') &&
- !bitnset(M_LOCALMAILER, e->e_from.q_mailer->m_flags) &&
- strcmp(e->e_from.q_user, RealUserName) != 0)
- {
- auth_warning(e, "%s owned process doing -bs",
- RealUserName);
- }
-
- /* now parse ESMTP arguments */
- e->e_msgsize = 0;
- p = delimptr;
- while (p != NULL && *p != '\0')
- {
- char *kp;
- char *vp = NULL;
- extern void mail_esmtp_args __P((char *, char *, ENVELOPE *));
-
- /* locate the beginning of the keyword */
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p == '\0')
- break;
- kp = p;
-
- /* skip to the value portion */
- while ((isascii(*p) && isalnum(*p)) || *p == '-')
- p++;
- if (*p == '=')
- {
- *p++ = '\0';
- vp = p;
-
- /* skip to the end of the value */
- while (*p != '\0' && *p != ' ' &&
- !(isascii(*p) && iscntrl(*p)) &&
- *p != '=')
- p++;
- }
-
- if (*p != '\0')
- *p++ = '\0';
-
- if (tTd(19, 1))
- printf("MAIL: got arg %s=\"%s\"\n", kp,
- vp == NULL ? "<null>" : vp);
-
- mail_esmtp_args(kp, vp, e);
- if (Errors > 0)
- goto undo_subproc_no_pm;
- }
- if (Errors > 0)
- goto undo_subproc_no_pm;
-
- if (MaxMessageSize > 0 && e->e_msgsize > MaxMessageSize)
- {
- usrerr("552 Message size exceeds fixed maximum message size (%ld)",
- MaxMessageSize);
- goto undo_subproc_no_pm;
- }
-
- if (!enoughdiskspace(e->e_msgsize))
- {
- usrerr("452 Insufficient disk space; try again later");
- goto undo_subproc_no_pm;
- }
- if (Errors > 0)
- goto undo_subproc_no_pm;
- message("250 Sender ok");
- gotmail = TRUE;
- break;
-
- case CMDRCPT: /* rcpt -- designate recipient */
- if (!gotmail)
- {
- usrerr("503 Need MAIL before RCPT");
- break;
- }
- SmtpPhase = "server RCPT";
- if (setjmp(TopFrame) > 0)
- {
- e->e_flags &= ~EF_FATALERRS;
- break;
- }
- QuickAbort = TRUE;
- LogUsrErrs = TRUE;
-
- /* limit flooding of our machine */
- if (MaxRcptPerMsg > 0 && nrcpts >= MaxRcptPerMsg)
- {
- usrerr("452 Too many recipients");
- break;
- }
-
- if (e->e_sendmode != SM_DELIVER)
- e->e_flags |= EF_VRFYONLY;
-
- p = skipword(p, "to");
- if (p == NULL)
- break;
- a = parseaddr(p, NULLADDR, RF_COPYALL, ' ', &delimptr, e);
- if (Errors > 0)
- break;
- if (a == NULL)
- {
- usrerr("501 Missing recipient");
- break;
- }
-
- if (delimptr != NULL && *delimptr != '\0')
- *delimptr++ = '\0';
-
- /* do config file checking of the recipient */
- if (rscheck("check_rcpt", p, NULL, e) != EX_OK ||
- Errors > 0)
- break;
-
- /* now parse ESMTP arguments */
- p = delimptr;
- while (p != NULL && *p != '\0')
- {
- char *kp;
- char *vp = NULL;
- extern void rcpt_esmtp_args __P((ADDRESS *, char *, char *, ENVELOPE *));
-
- /* locate the beginning of the keyword */
- while (isascii(*p) && isspace(*p))
- p++;
- if (*p == '\0')
- break;
- kp = p;
-
- /* skip to the value portion */
- while ((isascii(*p) && isalnum(*p)) || *p == '-')
- p++;
- if (*p == '=')
- {
- *p++ = '\0';
- vp = p;
-
- /* skip to the end of the value */
- while (*p != '\0' && *p != ' ' &&
- !(isascii(*p) && iscntrl(*p)) &&
- *p != '=')
- p++;
- }
-
- if (*p != '\0')
- *p++ = '\0';
-
- if (tTd(19, 1))
- printf("RCPT: got arg %s=\"%s\"\n", kp,
- vp == NULL ? "<null>" : vp);
-
- rcpt_esmtp_args(a, kp, vp, e);
- if (Errors > 0)
- break;
- }
- if (Errors > 0)
- break;
-
- /* save in recipient list after ESMTP mods */
- a = recipient(a, &e->e_sendqueue, 0, e);
- if (Errors > 0)
- break;
-
- /* no errors during parsing, but might be a duplicate */
- e->e_to = a->q_paddr;
- if (!bitset(QBADADDR, a->q_flags))
- {
- message("250 Recipient ok%s",
- bitset(QQUEUEUP, a->q_flags) ?
- " (will queue)" : "");
- nrcpts++;
- }
- else
- {
- /* punt -- should keep message in ADDRESS.... */
- usrerr("550 Addressee unknown");
- }
- break;
-
- case CMDDATA: /* data -- text of mail */
- SmtpPhase = "server DATA";
- if (!gotmail)
- {
- usrerr("503 Need MAIL command");
- break;
- }
- else if (nrcpts <= 0)
- {
- usrerr("503 Need RCPT (recipient)");
- break;
- }
-
- /* put back discard bit */
- if (discard)
- e->e_flags |= EF_DISCARD;
-
- /* check to see if we need to re-expand aliases */
- /* also reset QBADADDR on already-diagnosted addrs */
- doublequeue = FALSE;
- for (a = e->e_sendqueue; a != NULL; a = a->q_next)
- {
- if (bitset(QVERIFIED, a->q_flags) &&
- !bitset(EF_DISCARD, e->e_flags))
- {
- /* need to re-expand aliases */
- doublequeue = TRUE;
- }
- if (bitset(QBADADDR, a->q_flags))
- {
- /* make this "go away" */
- a->q_flags |= QDONTSEND;
- a->q_flags &= ~QBADADDR;
- }
- }
-
- /* collect the text of the message */
- SmtpPhase = "collect";
- buffer_errors();
- collect(InChannel, TRUE, NULL, e);
- if (Errors > 0)
- {
- flush_errors(TRUE);
- buffer_errors();
- goto abortmessage;
- }
-
- /* make sure we actually do delivery */
- e->e_flags &= ~EF_CLRQUEUE;
-
- /* from now on, we have to operate silently */
- buffer_errors();
- e->e_errormode = EM_MAIL;
-
- /*
- ** Arrange to send to everyone.
- ** If sending to multiple people, mail back
- ** errors rather than reporting directly.
- ** In any case, don't mail back errors for
- ** anything that has happened up to
- ** now (the other end will do this).
- ** Truncate our transcript -- the mail has gotten
- ** to us successfully, and if we have
- ** to mail this back, it will be easier
- ** on the reader.
- ** Then send to everyone.
- ** Finally give a reply code. If an error has
- ** already been given, don't mail a
- ** message back.
- ** We goose error returns by clearing error bit.
- */
-
- SmtpPhase = "delivery";
- e->e_xfp = freopen(queuename(e, 'x'), "w", e->e_xfp);
- id = e->e_id;
-
- if (doublequeue)
- {
- /* make sure it is in the queue */
- queueup(e, FALSE);
- }
- else
- {
- /* send to all recipients */
- sendall(e, SM_DEFAULT);
- }
- e->e_to = NULL;
-
- /* issue success message */
- message("250 %s Message accepted for delivery", id);
-
- /* if we just queued, poke it */
- if (doublequeue &&
- e->e_sendmode != SM_QUEUE &&
- e->e_sendmode != SM_DEFER)
- {
- CurrentLA = getla();
-
- if (!shouldqueue(e->e_msgpriority, e->e_ctime))
- {
- unlockqueue(e);
- (void) dowork(id, TRUE, TRUE, e);
- }
- }
-
- abortmessage:
- /* if in a child, pop back to our parent */
- if (InChild)
- finis(TRUE, ExitStat);
-
- /* clean up a bit */
- gotmail = FALSE;
- dropenvelope(e, TRUE);
- CurEnv = e = newenvelope(e, CurEnv);
- e->e_flags = BlankEnvelope.e_flags;
- break;
-
- case CMDRSET: /* rset -- reset state */
- if (tTd(94, 100))
- message("451 Test failure");
- else
- message("250 Reset state");
-
- /* arrange to ignore any current send list */
- e->e_sendqueue = NULL;
- e->e_flags |= EF_CLRQUEUE;
- if (InChild)
- finis(TRUE, ExitStat);
-
- /* clean up a bit */
- gotmail = FALSE;
- SuprErrs = TRUE;
- dropenvelope(e, TRUE);
- CurEnv = e = newenvelope(e, CurEnv);
- break;
-
- case CMDVRFY: /* vrfy -- verify address */
- case CMDEXPN: /* expn -- expand address */
- checksmtpattack(&nverifies, MAXVRFYCOMMANDS,
- c->cmdcode == CMDVRFY ? "VRFY" : "EXPN", e);
- vrfy = c->cmdcode == CMDVRFY;
- if (bitset(vrfy ? PRIV_NOVRFY : PRIV_NOEXPN,
- PrivacyFlags))
- {
- if (vrfy)
- message("252 Cannot VRFY user; try RCPT to attempt delivery (or try finger)");
- else
- message("502 Sorry, we do not allow this operation");
- if (LogLevel > 5)
- sm_syslog(LOG_INFO, e->e_id,
- "%.100s: %s [rejected]",
- CurSmtpClient,
- shortenstring(inp, MAXSHORTSTR));
- break;
- }
- else if (!gothello &&
- bitset(vrfy ? PRIV_NEEDVRFYHELO : PRIV_NEEDEXPNHELO,
- PrivacyFlags))
- {
- usrerr("503 I demand that you introduce yourself first");
- break;
- }
- if (runinchild(vrfy ? "SMTP-VRFY" : "SMTP-EXPN", e) > 0)
- break;
- if (Errors > 0)
- goto undo_subproc;
- if (LogLevel > 5)
- sm_syslog(LOG_INFO, e->e_id,
- "%.100s: %s",
- CurSmtpClient,
- shortenstring(inp, MAXSHORTSTR));
- if (setjmp(TopFrame) > 0)
- goto undo_subproc;
- QuickAbort = TRUE;
- vrfyqueue = NULL;
- if (vrfy)
- e->e_flags |= EF_VRFYONLY;
- while (*p != '\0' && isascii(*p) && isspace(*p))
- p++;
- if (*p == '\0')
- {
- usrerr("501 Argument required");
- }
- else
- {
- (void) sendtolist(p, NULLADDR, &vrfyqueue, 0, e);
- }
- if (Errors > 0)
- goto undo_subproc;
- if (vrfyqueue == NULL)
- {
- usrerr("554 Nothing to %s", vrfy ? "VRFY" : "EXPN");
- }
- while (vrfyqueue != NULL)
- {
- extern void printvrfyaddr __P((ADDRESS *, bool, bool));
-
- a = vrfyqueue;
- while ((a = a->q_next) != NULL &&
- bitset(QDONTSEND|QBADADDR, a->q_flags))
- continue;
- if (!bitset(QDONTSEND|QBADADDR, vrfyqueue->q_flags))
- printvrfyaddr(vrfyqueue, a == NULL, vrfy);
- vrfyqueue = vrfyqueue->q_next;
- }
- if (InChild)
- finis(TRUE, ExitStat);
- break;
-
- case CMDETRN: /* etrn -- force queue flush */
- if (bitset(PRIV_NOETRN, PrivacyFlags))
- {
- message("502 Sorry, we do not allow this operation");
- if (LogLevel > 5)
- sm_syslog(LOG_INFO, e->e_id,
- "%.100s: %s [rejected]",
- CurSmtpClient,
- shortenstring(inp, MAXSHORTSTR));
- break;
- }
-
- if (strlen(p) <= 0)
- {
- usrerr("500 Parameter required");
- break;
- }
-
- /* crude way to avoid denial-of-service attacks */
- checksmtpattack(&n_etrn, MAXETRNCOMMANDS, "ETRN", e);
-
- if (LogLevel > 5)
- sm_syslog(LOG_INFO, e->e_id,
- "%.100s: ETRN %s",
- CurSmtpClient,
- shortenstring(p, MAXSHORTSTR));
-
- id = p;
- if (*id == '@')
- id++;
- else
- *--id = '@';
-
- if ((new = (QUEUE_CHAR *)malloc(sizeof(QUEUE_CHAR))) == NULL)
- {
- syserr("500 ETRN out of memory");
- break;
- }
- new->queue_match = id;
- new->queue_next = NULL;
- QueueLimitRecipient = new;
- ok = runqueue(TRUE, TRUE);
- free(QueueLimitRecipient);
- QueueLimitRecipient = NULL;
- if (ok && Errors == 0)
- message("250 Queuing for node %s started", p);
- break;
-
- case CMDHELP: /* help -- give user info */
- help(p);
- break;
-
- case CMDNOOP: /* noop -- do nothing */
- checksmtpattack(&n_noop, MAXNOOPCOMMANDS, "NOOP", e);
- message("250 OK");
- break;
-
- case CMDQUIT: /* quit -- leave mail */
- message("221 %s closing connection", MyHostName);
-
-doquit:
- /* arrange to ignore any current send list */
- e->e_sendqueue = NULL;
-
- /* avoid future 050 messages */
- disconnect(1, e);
-
- if (InChild)
- ExitStat = EX_QUIT;
- if (lognullconnection && LogLevel > 5)
- sm_syslog(LOG_INFO, NULL,
- "Null connection from %.100s",
- CurSmtpClient);
- finis(TRUE, ExitStat);
-
- case CMDVERB: /* set verbose mode */
- if (bitset(PRIV_NOEXPN, PrivacyFlags) ||
- bitset(PRIV_NOVERB, PrivacyFlags))
- {
- /* this would give out the same info */
- message("502 Verbose unavailable");
- break;
- }
- checksmtpattack(&n_noop, MAXNOOPCOMMANDS, "VERB", e);
- Verbose = 1;
- e->e_sendmode = SM_DELIVER;
- message("250 Verbose mode");
- break;
-
- case CMDONEX: /* doing one transaction only */
- checksmtpattack(&n_noop, MAXNOOPCOMMANDS, "ONEX", e);
- OneXact = TRUE;
- message("250 Only one transaction");
- break;
-
- case CMDXUSR: /* initial (user) submission */
- checksmtpattack(&n_noop, MAXNOOPCOMMANDS, "XUSR", e);
- UserSubmission = TRUE;
- message("250 Initial submission");
- break;
-
-# if SMTPDEBUG
- case CMDDBGQSHOW: /* show queues */
- printf("Send Queue=");
- printaddr(e->e_sendqueue, TRUE);
- break;
-
- case CMDDBGDEBUG: /* set debug mode */
- tTsetup(tTdvect, sizeof tTdvect, "0-99.1");
- tTflag(p);
- message("200 Debug set");
- break;
-
-# else /* not SMTPDEBUG */
- case CMDDBGQSHOW: /* show queues */
- case CMDDBGDEBUG: /* set debug mode */
-# endif /* SMTPDEBUG */
- case CMDLOGBOGUS: /* bogus command */
- if (LogLevel > 0)
- sm_syslog(LOG_CRIT, e->e_id,
- "\"%s\" command from %.100s (%.100s)",
- c->cmdname, CurSmtpClient,
- anynet_ntoa(&RealHostAddr));
- /* FALL THROUGH */
-
- case CMDERROR: /* unknown command */
- if (++badcommands > MAXBADCOMMANDS)
- {
- message("421 %s Too many bad commands; closing connection",
- MyHostName);
- goto doquit;
- }
-
- usrerr("500 Command unrecognized: \"%s\"",
- shortenstring(inp, MAXSHORTSTR));
- break;
-
- default:
- errno = 0;
- syserr("500 smtp: unknown code %d", c->cmdcode);
- break;
- }
- }
-}
-\f/*
-** CHECKSMTPATTACK -- check for denial-of-service attack by repetition
-**
-** Parameters:
-** pcounter -- pointer to a counter for this command.
-** maxcount -- maximum value for this counter before we
-** slow down.
-** cname -- command name for logging.
-** e -- the current envelope.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Slows down if we seem to be under attack.
-*/
-
-void
-checksmtpattack(pcounter, maxcount, cname, e)
- volatile int *pcounter;
- int maxcount;
- char *cname;
- ENVELOPE *e;
-{
- if (++(*pcounter) >= maxcount)
- {
- if (*pcounter == maxcount && LogLevel > 5)
- {
- sm_syslog(LOG_INFO, e->e_id,
- "%.100s: %.40s attack?",
- CurSmtpClient, cname);
- }
- sleep(*pcounter / maxcount);
- }
-}
-\f/*
-** SKIPWORD -- skip a fixed word.
-**
-** Parameters:
-** p -- place to start looking.
-** w -- word to skip.
-**
-** Returns:
-** p following w.
-** NULL on error.
-**
-** Side Effects:
-** clobbers the p data area.
-*/
-
-static char *
-skipword(p, w)
- register char *volatile p;
- char *w;
-{
- register char *q;
- char *firstp = p;
-
- /* find beginning of word */
- while (isascii(*p) && isspace(*p))
- p++;
- q = p;
-
- /* find end of word */
- while (*p != '\0' && *p != ':' && !(isascii(*p) && isspace(*p)))
- p++;
- while (isascii(*p) && isspace(*p))
- *p++ = '\0';
- if (*p != ':')
- {
- syntax:
- usrerr("501 Syntax error in parameters scanning \"%s\"",
- shortenstring(firstp, MAXSHORTSTR));
- return (NULL);
- }
- *p++ = '\0';
- while (isascii(*p) && isspace(*p))
- p++;
-
- if (*p == '\0')
- goto syntax;
-
- /* see if the input word matches desired word */
- if (strcasecmp(q, w))
- goto syntax;
-
- return (p);
-}
-\f/*
-** MAIL_ESMTP_ARGS -- process ESMTP arguments from MAIL line
-**
-** Parameters:
-** kp -- the parameter key.
-** vp -- the value of that parameter.
-** e -- the envelope.
-**
-** Returns:
-** none.
-*/
-
-void
-mail_esmtp_args(kp, vp, e)
- char *kp;
- char *vp;
- ENVELOPE *e;
-{
- if (strcasecmp(kp, "size") == 0)
- {
- if (vp == NULL)
- {
- usrerr("501 SIZE requires a value");
- /* NOTREACHED */
- }
-# if defined(__STDC__) && !defined(BROKEN_ANSI_LIBRARY)
- e->e_msgsize = strtoul(vp, (char **) NULL, 10);
-# else
- e->e_msgsize = strtol(vp, (char **) NULL, 10);
-# endif
- }
- else if (strcasecmp(kp, "body") == 0)
- {
- if (vp == NULL)
- {
- usrerr("501 BODY requires a value");
- /* NOTREACHED */
- }
- else if (strcasecmp(vp, "8bitmime") == 0)
- {
- SevenBitInput = FALSE;
- }
- else if (strcasecmp(vp, "7bit") == 0)
- {
- SevenBitInput = TRUE;
- }
- else
- {
- usrerr("501 Unknown BODY type %s",
- vp);
- /* NOTREACHED */
- }
- e->e_bodytype = newstr(vp);
- }
- else if (strcasecmp(kp, "envid") == 0)
- {
- if (vp == NULL)
- {
- usrerr("501 ENVID requires a value");
- /* NOTREACHED */
- }
- if (!xtextok(vp))
- {
- usrerr("501 Syntax error in ENVID parameter value");
- /* NOTREACHED */
- }
- if (e->e_envid != NULL)
- {
- usrerr("501 Duplicate ENVID parameter");
- /* NOTREACHED */
- }
- e->e_envid = newstr(vp);
- }
- else if (strcasecmp(kp, "ret") == 0)
- {
- if (vp == NULL)
- {
- usrerr("501 RET requires a value");
- /* NOTREACHED */
- }
- if (bitset(EF_RET_PARAM, e->e_flags))
- {
- usrerr("501 Duplicate RET parameter");
- /* NOTREACHED */
- }
- e->e_flags |= EF_RET_PARAM;
- if (strcasecmp(vp, "hdrs") == 0)
- e->e_flags |= EF_NO_BODY_RETN;
- else if (strcasecmp(vp, "full") != 0)
- {
- usrerr("501 Bad argument \"%s\" to RET", vp);
- /* NOTREACHED */
- }
- }
- else
- {
- usrerr("501 %s parameter unrecognized", kp);
- /* NOTREACHED */
- }
-}
-\f/*
-** RCPT_ESMTP_ARGS -- process ESMTP arguments from RCPT line
-**
-** Parameters:
-** a -- the address corresponding to the To: parameter.
-** kp -- the parameter key.
-** vp -- the value of that parameter.
-** e -- the envelope.
-**
-** Returns:
-** none.
-*/
-
-void
-rcpt_esmtp_args(a, kp, vp, e)
- ADDRESS *a;
- char *kp;
- char *vp;
- ENVELOPE *e;
-{
- if (strcasecmp(kp, "notify") == 0)
- {
- char *p;
-
- if (vp == NULL)
- {
- usrerr("501 NOTIFY requires a value");
- /* NOTREACHED */
- }
- a->q_flags &= ~(QPINGONSUCCESS|QPINGONFAILURE|QPINGONDELAY);
- a->q_flags |= QHASNOTIFY;
- if (strcasecmp(vp, "never") == 0)
- return;
- for (p = vp; p != NULL; vp = p)
- {
- p = strchr(p, ',');
- if (p != NULL)
- *p++ = '\0';
- if (strcasecmp(vp, "success") == 0)
- a->q_flags |= QPINGONSUCCESS;
- else if (strcasecmp(vp, "failure") == 0)
- a->q_flags |= QPINGONFAILURE;
- else if (strcasecmp(vp, "delay") == 0)
- a->q_flags |= QPINGONDELAY;
- else
- {
- usrerr("501 Bad argument \"%s\" to NOTIFY",
- vp);
- /* NOTREACHED */
- }
- }
- }
- else if (strcasecmp(kp, "orcpt") == 0)
- {
- if (vp == NULL)
- {
- usrerr("501 ORCPT requires a value");
- /* NOTREACHED */
- }
- if (strchr(vp, ';') == NULL || !xtextok(vp))
- {
- usrerr("501 Syntax error in ORCPT parameter value");
- /* NOTREACHED */
- }
- if (a->q_orcpt != NULL)
- {
- usrerr("501 Duplicate ORCPT parameter");
- /* NOTREACHED */
- }
- a->q_orcpt = newstr(vp);
- }
- else
- {
- usrerr("501 %s parameter unrecognized", kp);
- /* NOTREACHED */
- }
-}
-\f/*
-** PRINTVRFYADDR -- print an entry in the verify queue
-**
-** Parameters:
-** a -- the address to print
-** last -- set if this is the last one.
-** vrfy -- set if this is a VRFY command.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** Prints the appropriate 250 codes.
-*/
-
-void
-printvrfyaddr(a, last, vrfy)
- register ADDRESS *a;
- bool last;
- bool vrfy;
-{
- char fmtbuf[20];
-
- if (vrfy && a->q_mailer != NULL &&
- !bitnset(M_VRFY250, a->q_mailer->m_flags))
- strcpy(fmtbuf, "252");
- else
- strcpy(fmtbuf, "250");
- fmtbuf[3] = last ? ' ' : '-';
-
- if (a->q_fullname == NULL)
- {
- if (strchr(a->q_user, '@') == NULL)
- strcpy(&fmtbuf[4], "<%s@%s>");
- else
- strcpy(&fmtbuf[4], "<%s>");
- message(fmtbuf, a->q_user, MyHostName);
- }
- else
- {
- if (strchr(a->q_user, '@') == NULL)
- strcpy(&fmtbuf[4], "%s <%s@%s>");
- else
- strcpy(&fmtbuf[4], "%s <%s>");
- message(fmtbuf, a->q_fullname, a->q_user, MyHostName);
- }
-}
-\f/*
-** RUNINCHILD -- return twice -- once in the child, then in the parent again
-**
-** Parameters:
-** label -- a string used in error messages
-**
-** Returns:
-** zero in the child
-** one in the parent
-**
-** Side Effects:
-** none.
-*/
-
-int
-runinchild(label, e)
- char *label;
- register ENVELOPE *e;
-{
- pid_t childpid;
-
- if (!OneXact)
- {
- /*
- ** Disable child process reaping, in case ETRN has preceeded
- ** MAIL command, and then fork.
- */
-
- (void) blocksignal(SIGCHLD);
-
- childpid = dofork();
- if (childpid < 0)
- {
- syserr("451 %s: cannot fork", label);
- (void) releasesignal(SIGCHLD);
- return (1);
- }
- if (childpid > 0)
- {
- auto int st;
-
- /* parent -- wait for child to complete */
- sm_setproctitle(TRUE, "server %s child wait", CurSmtpClient);
- st = waitfor(childpid);
- if (st == -1)
- syserr("451 %s: lost child", label);
- else if (!WIFEXITED(st))
- syserr("451 %s: died on signal %d",
- label, st & 0177);
-
- /* if we exited on a QUIT command, complete the process */
- if (WEXITSTATUS(st) == EX_QUIT)
- {
- disconnect(1, e);
- finis(TRUE, ExitStat);
- }
-
- /* restore the child signal */
- (void) releasesignal(SIGCHLD);
-
- return (1);
- }
- else
- {
- /* child */
- InChild = TRUE;
- QuickAbort = FALSE;
- clearenvelope(e, FALSE);
- (void) setsignal(SIGCHLD, SIG_DFL);
- (void) releasesignal(SIGCHLD);
- }
- }
- return (0);
-}
-
-# endif /* SMTP */
-\f/*
-** HELP -- implement the HELP command.
-**
-** Parameters:
-** topic -- the topic we want help for.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** outputs the help file to message output.
-*/
-
-void
-help(topic)
- char *topic;
-{
- register FILE *hf;
- int len;
- bool noinfo;
- int sff = SFF_OPENASROOT|SFF_REGONLY;
- char buf[MAXLINE];
- extern char Version[];
-
- if (DontLockReadFiles)
- sff |= SFF_NOLOCK;
- if (!bitset(DBS_HELPFILEINUNSAFEDIRPATH, DontBlameSendmail))
- sff |= SFF_SAFEDIRPATH;
-
- if (HelpFile == NULL ||
- (hf = safefopen(HelpFile, O_RDONLY, 0444, sff)) == NULL)
- {
- /* no help */
- errno = 0;
- message("502 Sendmail %s -- HELP not implemented", Version);
- return;
- }
-
- if (topic == NULL || *topic == '\0')
- {
- topic = "smtp";
- message("214-This is Sendmail version %s", Version);
- noinfo = FALSE;
- }
- else
- {
- makelower(topic);
- noinfo = TRUE;
- }
-
- len = strlen(topic);
-
- while (fgets(buf, sizeof buf, hf) != NULL)
- {
- if (strncmp(buf, topic, len) == 0)
- {
- register char *p;
-
- p = strchr(buf, '\t');
- if (p == NULL)
- p = buf;
- else
- p++;
- fixcrlf(p, TRUE);
- message("214-%s", p);
- noinfo = FALSE;
- }
- }
-
- if (noinfo)
- message("504 HELP topic \"%.10s\" unknown", topic);
- else
- message("214 End of HELP info");
- (void) fclose(hf);
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)stab.c 8.19 (Berkeley) 5/19/1998";
-#endif /* not lint */
-
-# include "sendmail.h"
-
-/*
-** STAB -- manage the symbol table
-**
-** Parameters:
-** name -- the name to be looked up or inserted.
-** type -- the type of symbol.
-** op -- what to do:
-** ST_ENTER -- enter the name if not
-** already present.
-** ST_FIND -- find it only.
-**
-** Returns:
-** pointer to a STAB entry for this name.
-** NULL if not found and not entered.
-**
-** Side Effects:
-** can update the symbol table.
-*/
-
-# define STABSIZE 2003
-
-static STAB *SymTab[STABSIZE];
-
-STAB *
-stab(name, type, op)
- char *name;
- int type;
- int op;
-{
- register STAB *s;
- register STAB **ps;
- register int hfunc;
- register char *p;
- int len;
- extern char lower __P((char));
-
- if (tTd(36, 5))
- printf("STAB: %s %d ", name, type);
-
- /*
- ** Compute the hashing function
- */
-
- hfunc = type;
- for (p = name; *p != '\0'; p++)
- hfunc = ((hfunc << 1) ^ (lower(*p) & 0377)) % STABSIZE;
-
- if (tTd(36, 9))
- printf("(hfunc=%d) ", hfunc);
-
- ps = &SymTab[hfunc];
- if (type == ST_MACRO || type == ST_RULESET)
- {
- while ((s = *ps) != NULL &&
- (s->s_type != type || strcmp(name, s->s_name)))
- ps = &s->s_next;
- }
- else
- {
- while ((s = *ps) != NULL &&
- (s->s_type != type || strcasecmp(name, s->s_name)))
- ps = &s->s_next;
- }
-
- /*
- ** Dispose of the entry.
- */
-
- if (s != NULL || op == ST_FIND)
- {
- if (tTd(36, 5))
- {
- if (s == NULL)
- printf("not found\n");
- else
- {
- long *lp = (long *) s->s_class;
-
- printf("type %d val %lx %lx %lx %lx\n",
- s->s_type, lp[0], lp[1], lp[2], lp[3]);
- }
- }
- return (s);
- }
-
- /*
- ** Make a new entry and link it in.
- */
-
- if (tTd(36, 5))
- printf("entered\n");
-
- /* determine size of new entry */
-#if _FFR_MEMORY_MISER
- switch (type)
- {
- case ST_CLASS:
- len = sizeof s->s_class;
- break;
-
- case ST_ADDRESS:
- len = sizeof s->s_address;
- break;
-
- case ST_MAILER:
- len = sizeof s->s_mailer;
-
- case ST_ALIAS:
- len = sizeof s->s_alias;
- break;
-
- case ST_MAPCLASS:
- len = sizeof s->s_mapclass;
- break;
-
- case ST_MAP:
- len = sizeof s->s_map;
- break;
-
- case ST_HOSTSIG:
- len = sizeof s->s_hostsig;
- break;
-
- case ST_NAMECANON:
- len = sizeof s->s_namecanon;
- break;
-
- case ST_MACRO:
- len = sizeof s->s_macro;
- break;
-
- case ST_RULESET:
- len = sizeof s->s_ruleset;
- break;
-
- case ST_SERVICE:
- len = sizeof s->s_service;
- break;
-
- case ST_HEADER:
- len = sizeof s->s_header;
- break;
-
- default:
- if (type >= ST_MCI)
- len = sizeof s->s_mci;
- else
- {
- syserr("stab: unknown symbol type %d", type);
- len = sizeof s->s_value;
- }
- break;
- }
- len += sizeof *s - sizeof s->s_value;
-#else
- len = sizeof *s;
-#endif
-
- /* make new entry */
- s = (STAB *) xalloc(len);
- bzero((char *) s, len);
- s->s_name = newstr(name);
- s->s_type = type;
- s->s_len = len;
-
- /* link it in */
- *ps = s;
-
- return (s);
-}
-\f/*
-** STABAPPLY -- apply function to all stab entries
-**
-** Parameters:
-** func -- the function to apply. It will be given one
-** parameter (the stab entry).
-** arg -- an arbitrary argument, passed to func.
-**
-** Returns:
-** none.
-*/
-
-void
-stabapply(func, arg)
- void (*func)__P((STAB *, int));
- int arg;
-{
- register STAB **shead;
- register STAB *s;
-
- for (shead = SymTab; shead < &SymTab[STABSIZE]; shead++)
- {
- for (s = *shead; s != NULL; s = s->s_next)
- {
- if (tTd(36, 90))
- printf("stabapply: trying %d/%s\n",
- s->s_type, s->s_name);
- func(s, arg);
- }
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)stats.c 8.22 (Berkeley) 5/19/1998";
-#endif /* not lint */
-
-# include "sendmail.h"
-# include "mailstats.h"
-
-struct statistics Stat;
-
-bool GotStats = FALSE; /* set when we have stats to merge */
-
-#define ONE_K 1000 /* one thousand (twenty-four?) */
-#define KBYTES(x) (((x) + (ONE_K - 1)) / ONE_K)
-\f/*
-** MARKSTATS -- mark statistics
-*/
-
-void
-markstats(e, to, reject)
- register ENVELOPE *e;
- register ADDRESS *to;
- bool reject;
-{
- if (reject == TRUE)
- {
- if (e->e_from.q_mailer != NULL)
- {
- if (bitset(EF_DISCARD, e->e_flags))
- Stat.stat_nd[e->e_from.q_mailer->m_mno]++;
- else
- Stat.stat_nr[e->e_from.q_mailer->m_mno]++;
- }
- }
- else if (to == NULL)
- {
- if (e->e_from.q_mailer != NULL)
- {
- Stat.stat_nf[e->e_from.q_mailer->m_mno]++;
- Stat.stat_bf[e->e_from.q_mailer->m_mno] +=
- KBYTES(e->e_msgsize);
- }
- }
- else
- {
- Stat.stat_nt[to->q_mailer->m_mno]++;
- Stat.stat_bt[to->q_mailer->m_mno] += KBYTES(e->e_msgsize);
- }
- GotStats = TRUE;
-}
-\f/*
-** POSTSTATS -- post statistics in the statistics file
-**
-** Parameters:
-** sfile -- the name of the statistics file.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** merges the Stat structure with the sfile file.
-*/
-
-void
-poststats(sfile)
- char *sfile;
-{
- register int fd;
- int sff = SFF_REGONLY|SFF_OPENASROOT;
- struct statistics stat;
- extern off_t lseek();
-
- if (sfile == NULL || !GotStats)
- return;
-
- (void) time(&Stat.stat_itime);
- Stat.stat_size = sizeof Stat;
- Stat.stat_magic = STAT_MAGIC;
- Stat.stat_version = STAT_VERSION;
-
- if (!bitset(DBS_WRITESTATSTOSYMLINK, DontBlameSendmail))
- sff |= SFF_NOSLINK;
- if (!bitset(DBS_WRITESTATSTOHARDLINK, DontBlameSendmail))
- sff |= SFF_NOHLINK;
-
- fd = safeopen(sfile, O_RDWR, 0644, sff);
- if (fd < 0)
- {
- if (LogLevel > 12)
- sm_syslog(LOG_INFO, NOQID, "poststats: %s: %s",
- sfile, errstring(errno));
- errno = 0;
- return;
- }
- if (read(fd, (char *) &stat, sizeof stat) == sizeof stat &&
- stat.stat_size == sizeof stat &&
- stat.stat_magic == Stat.stat_magic &&
- stat.stat_version == Stat.stat_version)
- {
- /* merge current statistics into statfile */
- register int i;
-
- for (i = 0; i < MAXMAILERS; i++)
- {
- stat.stat_nf[i] += Stat.stat_nf[i];
- stat.stat_bf[i] += Stat.stat_bf[i];
- stat.stat_nt[i] += Stat.stat_nt[i];
- stat.stat_bt[i] += Stat.stat_bt[i];
- stat.stat_nr[i] += Stat.stat_nr[i];
- stat.stat_nd[i] += Stat.stat_nd[i];
- }
- }
- else
- bcopy((char *) &Stat, (char *) &stat, sizeof stat);
-
- /* write out results */
- (void) lseek(fd, (off_t) 0, 0);
- (void) write(fd, (char *) &stat, sizeof stat);
- (void) close(fd);
-
- /* clear the structure to avoid future disappointment */
- bzero(&Stat, sizeof stat);
- GotStats = FALSE;
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)sysexits.c 8.13 (Berkeley) 5/24/1998";
-#endif /* not lint */
-
-#include "sendmail.h"
-
-/*
-** SYSEXITS.C -- error messages corresponding to sysexits.h
-**
-** If the first character of the string is a colon, interpolate
-** the current errno after the rest of the string.
-*/
-
-char *SysExMsg[] =
-{
- /* 64 USAGE */ " 500 Bad usage",
- /* 65 DATAERR */ " 501 Data format error",
- /* 66 NOINPUT */ ":550 Cannot open input",
- /* 67 NOUSER */ " 550 User unknown",
- /* 68 NOHOST */ " 550 Host unknown",
- /* 69 UNAVAILABLE */ " 554 Service unavailable",
- /* 70 SOFTWARE */ ":554 Internal error",
- /* 71 OSERR */ ":451 Operating system error",
- /* 72 OSFILE */ ":554 System file missing",
- /* 73 CANTCREAT */ ":550 Can't create output",
- /* 74 IOERR */ ":451 I/O error",
- /* 75 TEMPFAIL */ " 250 Deferred",
- /* 76 PROTOCOL */ " 554 Remote protocol error",
- /* 77 NOPERM */ ":550 Insufficient permission",
- /* 78 CONFIG */ " 554 Local configuration error",
-};
-
-int N_SysEx = sizeof(SysExMsg) / sizeof(SysExMsg[0]);
-\f/*
-** DSNTOEXITSTAT -- convert DSN-style error code to EX_ style.
-**
-** Parameters:
-** dsncode -- the text of the DSN-style code.
-**
-** Returns:
-** The corresponding exit status.
-*/
-
-int
-dsntoexitstat(dsncode)
- char *dsncode;
-{
- int code2, code3;
-
- /* first the easy cases.... */
- if (*dsncode == '2')
- return EX_OK;
- if (*dsncode == '4')
- return EX_TEMPFAIL;
-
- /* now decode the other two field parts */
- if (*++dsncode == '.')
- dsncode++;
- code2 = atoi(dsncode);
- while (*dsncode != '\0' && *dsncode != '.')
- dsncode++;
- if (*dsncode != '\0')
- dsncode++;
- code3 = atoi(dsncode);
-
- /* and do a nested switch to work them out */
- switch (code2)
- {
- case 0: /* Other or Undefined status */
- return EX_UNAVAILABLE;
-
- case 1: /* Address Status */
- switch (code3)
- {
- case 0: /* Other Address Status */
- return EX_DATAERR;
-
- case 1: /* Bad destination mailbox address */
- case 6: /* Mailbox has moved, No forwarding address */
- return EX_NOUSER;
-
- case 2: /* Bad destination system address */
- case 8: /* Bad senders system address */
- return EX_NOHOST;
-
- case 3: /* Bad destination mailbox address syntax */
- case 7: /* Bad senders mailbox address syntax */
- return EX_USAGE;
-
- case 4: /* Destination mailbox address ambiguous */
- return EX_UNAVAILABLE;
-
- case 5: /* Destination address valid */
- return EX_OK;
- }
- break;
-
- case 2: /* Mailbox Status */
- switch (code3)
- {
- case 0: /* Other or Undefined mailbox status */
- case 1: /* Mailbox disabled, not acccepting messages */
- case 2: /* Mailbox full */
- case 4: /* Mailing list expansion problem */
- return EX_UNAVAILABLE;
-
- case 3: /* Message length exceeds administrative lim */
- return EX_DATAERR;
- }
- break;
-
- case 3: /* System Status */
- return EX_OSERR;
-
- case 4: /* Network and Routing Status */
- switch (code3)
- {
- case 0: /* Other or undefined network or routing stat */
- return EX_IOERR;
-
- case 1: /* No answer from host */
- case 3: /* Routing server failure */
- case 5: /* Network congestion */
- return EX_TEMPFAIL;
-
- case 2: /* Bad connection */
- return EX_IOERR;
-
- case 4: /* Unable to route */
- return EX_PROTOCOL;
-
- case 6: /* Routing loop detected */
- return EX_CONFIG;
-
- case 7: /* Delivery time expired */
- return EX_UNAVAILABLE;
- }
- break;
-
- case 5: /* Protocol Status */
- return EX_PROTOCOL;
-
- case 6: /* Message Content or Media Status */
- return EX_UNAVAILABLE;
-
- case 7: /* Security Status */
- return EX_DATAERR;
- }
- return EX_CONFIG;
-}
+++ /dev/null
-/*
- * Copyright (c) 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- *
- * @(#)sysexits.h 8.1 (Berkeley) 6/2/93
- */
-
-#ifndef _SYSEXITS_H_
-#define _SYSEXITS_H_
-
-/*
- * SYSEXITS.H -- Exit status codes for system programs.
- *
- * This include file attempts to categorize possible error
- * exit statuses for system programs, notably delivermail
- * and the Berkeley network.
- *
- * Error numbers begin at EX__BASE to reduce the possibility of
- * clashing with other exit statuses that random programs may
- * already return. The meaning of the codes is approximately
- * as follows:
- *
- * EX_USAGE -- The command was used incorrectly, e.g., with
- * the wrong number of arguments, a bad flag, a bad
- * syntax in a parameter, or whatever.
- * EX_DATAERR -- The input data was incorrect in some way.
- * This should only be used for user's data & not
- * system files.
- * EX_NOINPUT -- An input file (not a system file) did not
- * exist or was not readable. This could also include
- * errors like "No message" to a mailer (if it cared
- * to catch it).
- * EX_NOUSER -- The user specified did not exist. This might
- * be used for mail addresses or remote logins.
- * EX_NOHOST -- The host specified did not exist. This is used
- * in mail addresses or network requests.
- * EX_UNAVAILABLE -- A service is unavailable. This can occur
- * if a support program or file does not exist. This
- * can also be used as a catchall message when something
- * you wanted to do doesn't work, but you don't know
- * why.
- * EX_SOFTWARE -- An internal software error has been detected.
- * This should be limited to non-operating system related
- * errors as possible.
- * EX_OSERR -- An operating system error has been detected.
- * This is intended to be used for such things as "cannot
- * fork", "cannot create pipe", or the like. It includes
- * things like getuid returning a user that does not
- * exist in the passwd file.
- * EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
- * etc.) does not exist, cannot be opened, or has some
- * sort of error (e.g., syntax error).
- * EX_CANTCREAT -- A (user specified) output file cannot be
- * created.
- * EX_IOERR -- An error occurred while doing I/O on some file.
- * EX_TEMPFAIL -- temporary failure, indicating something that
- * is not really an error. In sendmail, this means
- * that a mailer (e.g.) could not create a connection,
- * and the request should be reattempted later.
- * EX_PROTOCOL -- the remote system returned something that
- * was "not possible" during a protocol exchange.
- * EX_NOPERM -- You did not have sufficient permission to
- * perform the operation. This is not intended for
- * file system problems, which should use NOINPUT or
- * CANTCREAT, but rather for higher level permissions.
- */
-
-#define EX_OK 0 /* successful termination */
-
-#define EX__BASE 64 /* base value for error messages */
-
-#define EX_USAGE 64 /* command line usage error */
-#define EX_DATAERR 65 /* data format error */
-#define EX_NOINPUT 66 /* cannot open input */
-#define EX_NOUSER 67 /* addressee unknown */
-#define EX_NOHOST 68 /* host name unknown */
-#define EX_UNAVAILABLE 69 /* service unavailable */
-#define EX_SOFTWARE 70 /* internal software error */
-#define EX_OSERR 71 /* system error (e.g., can't fork) */
-#define EX_OSFILE 72 /* critical OS file missing */
-#define EX_CANTCREAT 73 /* can't create (user) output file */
-#define EX_IOERR 74 /* input/output error */
-#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
-#define EX_PROTOCOL 76 /* remote error in protocol */
-#define EX_NOPERM 77 /* permission denied */
-#define EX_CONFIG 78 /* configuration error */
-
-#define EX__MAX 78 /* maximum listed value */
-
-#endif /* !_SYSEXITS_H_ */
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)trace.c 8.12 (Berkeley) 5/19/1998";
-#endif /* not lint */
-
-# include "sendmail.h"
-
-/*
-** TtSETUP -- set up for trace package.
-**
-** Parameters:
-** vect -- pointer to trace vector.
-** size -- number of flags in trace vector.
-** defflags -- flags to set if no value given.
-**
-** Returns:
-** none
-**
-** Side Effects:
-** environment is set up.
-*/
-
-u_char *tTvect;
-int tTsize;
-static char *DefFlags;
-
-void
-tTsetup(vect, size, defflags)
- u_char *vect;
- int size;
- char *defflags;
-{
- tTvect = vect;
- tTsize = size;
- DefFlags = defflags;
-}
-\f/*
-** TtFLAG -- process an external trace flag description.
-**
-** Parameters:
-** s -- the trace flag.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** sets/clears trace flags.
-*/
-
-void
-tTflag(s)
- register char *s;
-{
- unsigned int first, last;
- register unsigned int i;
-
- if (*s == '\0')
- s = DefFlags;
-
- for (;;)
- {
- /* find first flag to set */
- i = 0;
- while (isascii(*s) && isdigit(*s))
- i = i * 10 + (*s++ - '0');
- first = i;
-
- /* find last flag to set */
- if (*s == '-')
- {
- i = 0;
- while (isascii(*++s) && isdigit(*s))
- i = i * 10 + (*s - '0');
- }
- last = i;
-
- /* find the level to set it to */
- i = 1;
- if (*s == '.')
- {
- i = 0;
- while (isascii(*++s) && isdigit(*s))
- i = i * 10 + (*s - '0');
- }
-
- /* clean up args */
- if (first >= tTsize)
- first = tTsize - 1;
- if (last >= tTsize)
- last = tTsize - 1;
-
- /* set the flags */
- while (first <= last)
- tTvect[first++] = i;
-
- /* more arguments? */
- if (*s++ == '\0')
- return;
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#include "sendmail.h"
-
-#ifndef lint
-#if USERDB
-static char sccsid [] = "@(#)udb.c 8.71 (Berkeley) 1/17/1999 (with USERDB)";
-#else
-static char sccsid [] = "@(#)udb.c 8.71 (Berkeley) 1/17/1999 (without USERDB)";
-#endif
-#endif
-
-#if USERDB
-
-#include <errno.h>
-
-#ifdef NEWDB
-# include <db.h>
-# ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-# endif
-#else
-# define DBT struct _data_base_thang_
-DBT
-{
- void *data; /* pointer to data */
- size_t size; /* length of data */
-};
-#endif
-
-/*
-** UDB.C -- interface between sendmail and Berkeley User Data Base.
-**
-** This depends on the 4.4BSD db package.
-*/
-
-
-struct udbent
-{
- char *udb_spec; /* string version of spec */
- int udb_type; /* type of entry */
- pid_t udb_pid; /* PID of process which opened db */
- char *udb_default; /* default host for outgoing mail */
- union
- {
- /* type UE_REMOTE -- do remote call for lookup */
- struct
- {
- struct sockaddr_in _udb_addr; /* address */
- int _udb_timeout; /* timeout */
- } udb_remote;
-#define udb_addr udb_u.udb_remote._udb_addr
-#define udb_timeout udb_u.udb_remote._udb_timeout
-
- /* type UE_FORWARD -- forward message to remote */
- struct
- {
- char *_udb_fwdhost; /* name of forward host */
- } udb_forward;
-#define udb_fwdhost udb_u.udb_forward._udb_fwdhost
-
-#ifdef NEWDB
- /* type UE_FETCH -- lookup in local database */
- struct
- {
- char *_udb_dbname; /* pathname of database */
- DB *_udb_dbp; /* open database ptr */
- } udb_lookup;
-#define udb_dbname udb_u.udb_lookup._udb_dbname
-#define udb_dbp udb_u.udb_lookup._udb_dbp
-#endif
- } udb_u;
-};
-
-#define UDB_EOLIST 0 /* end of list */
-#define UDB_SKIP 1 /* skip this entry */
-#define UDB_REMOTE 2 /* look up in remote database */
-#define UDB_DBFETCH 3 /* look up in local database */
-#define UDB_FORWARD 4 /* forward to remote host */
-#define UDB_HESIOD 5 /* look up via hesiod */
-
-#define MAXUDBENT 10 /* maximum number of UDB entries */
-
-
-struct udb_option
-{
- char *name;
- char *val;
-};
-
-#ifdef HESIOD
-extern int hes_udb_get __P((DBT *, DBT *));
-#endif
-extern int _udbx_init __P((ENVELOPE *));
-\f/*
-** UDBEXPAND -- look up user in database and expand
-**
-** Parameters:
-** a -- address to expand.
-** sendq -- pointer to head of sendq to put the expansions in.
-** aliaslevel -- the current alias nesting depth.
-** e -- the current envelope.
-**
-** Returns:
-** EX_TEMPFAIL -- if something "odd" happened -- probably due
-** to accessing a file on an NFS server that is down.
-** EX_OK -- otherwise.
-**
-** Side Effects:
-** Modifies sendq.
-*/
-
-int UdbPort = 1616;
-int UdbTimeout = 10;
-
-struct udbent UdbEnts[MAXUDBENT + 1];
-int UdbSock = -1;
-bool UdbInitialized = FALSE;
-
-int
-udbexpand(a, sendq, aliaslevel, e)
- register ADDRESS *a;
- ADDRESS **sendq;
- int aliaslevel;
- register ENVELOPE *e;
-{
- int i;
- DBT key;
- DBT info;
- bool breakout;
- register struct udbent *up;
- int keylen;
- int naddrs;
- char *user;
- char keybuf[MAXKEY];
-
- bzero(&key, sizeof key);
- bzero(&info, sizeof info);
-
- if (tTd(28, 1))
- printf("udbexpand(%s)\n", a->q_paddr);
-
- /* make certain we are supposed to send to this address */
- if (bitset(QDONTSEND|QVERIFIED, a->q_flags))
- return EX_OK;
- e->e_to = a->q_paddr;
-
- /* on first call, locate the database */
- if (!UdbInitialized)
- {
- if (_udbx_init(e) == EX_TEMPFAIL)
- return EX_TEMPFAIL;
- }
-
- /* short circuit the process if no chance of a match */
- if (UdbSpec == NULL || UdbSpec[0] == '\0')
- return EX_OK;
-
- /* extract user to do userdb matching on */
- user = a->q_user;
-
- /* short circuit name begins with '\\' since it can't possibly match */
- /* (might want to treat this as unquoted instead) */
- if (user[0] == '\\')
- return EX_OK;
-
- /* if name is too long, assume it won't match */
- if (strlen(user) > (SIZE_T) sizeof keybuf - 12)
- return EX_OK;
-
- /* if name begins with a colon, it indicates our metadata */
- if (user[0] == ':')
- return EX_OK;
-
- /* build actual database key */
- (void) strcpy(keybuf, user);
- (void) strcat(keybuf, ":maildrop");
- keylen = strlen(keybuf);
-
- breakout = FALSE;
- for (up = UdbEnts; !breakout; up++)
- {
- char *user;
- int usersize;
- int userleft;
- char userbuf[MEMCHUNKSIZE];
-#if defined(HESIOD) && defined(HES_GETMAILHOST)
- char pobuf[MAXNAME];
-#endif
-#if defined(NEWDB) && DB_VERSION_MAJOR > 1
- DBC *dbc = NULL;
-#endif
-
- user = userbuf;
- userbuf[0] = '\0';
- usersize = sizeof userbuf;
- userleft = sizeof userbuf - 1;
-
- /*
- ** Select action based on entry type.
- **
- ** On dropping out of this switch, "class" should
- ** explain the type of the data, and "user" should
- ** contain the user information.
- */
-
- switch (up->udb_type)
- {
-#ifdef NEWDB
- case UDB_DBFETCH:
- key.data = keybuf;
- key.size = keylen;
- if (tTd(28, 80))
- printf("udbexpand: trying %s (%d) via db\n",
- keybuf, keylen);
-#if DB_VERSION_MAJOR < 2
- i = (*up->udb_dbp->seq)(up->udb_dbp, &key, &info, R_CURSOR);
-#else
- i = 0;
- if (dbc == NULL &&
-# if DB_VERSION_MAJOR > 2 || DB_VERSION_MINOR >=6
- (errno = (*up->udb_dbp->cursor)(up->udb_dbp,
- NULL, &dbc, 0)) != 0)
-# else
- (errno = (*up->udb_dbp->cursor)(up->udb_dbp,
- NULL, &dbc)) != 0)
-# endif
- i = -1;
- if (i != 0 || dbc == NULL ||
- (errno = dbc->c_get(dbc, &key,
- &info, DB_SET)) != 0)
- i = 1;
-#endif
- if (i > 0 || info.size <= 0)
- {
- if (tTd(28, 2))
- printf("udbexpand: no match on %s (%d)\n",
- keybuf, keylen);
-#if DB_VERSION_MAJOR > 1
- if (dbc != NULL)
- {
- (void) dbc->c_close(dbc);
- dbc = NULL;
- }
-#endif
- break;
- }
- if (tTd(28, 80))
- printf("udbexpand: match %.*s: %.*s\n",
- (int) key.size, (char *) key.data,
- (int) info.size, (char *) info.data);
-
- a->q_flags &= ~QSELFREF;
- while (i == 0 && key.size == keylen &&
- bcmp(key.data, keybuf, keylen) == 0)
- {
- char *p;
-
- if (bitset(EF_VRFYONLY, e->e_flags))
- {
- a->q_flags |= QVERIFIED;
-#if DB_VERSION_MAJOR > 1
- if (dbc != NULL)
- {
- (void) dbc->c_close(dbc);
- dbc = NULL;
- }
-#endif
- return EX_OK;
- }
-
- breakout = TRUE;
- if (info.size >= userleft - 1)
- {
- char *nuser;
- int size = MEMCHUNKSIZE;
-
- if (info.size > MEMCHUNKSIZE)
- size = info.size;
- nuser = xalloc(usersize + size);
-
- bcopy(user, nuser, usersize);
- if (user != userbuf)
- free(user);
- user = nuser;
- usersize += size;
- userleft += size;
- }
- p = &user[strlen(user)];
- if (p != user)
- {
- *p++ = ',';
- userleft--;
- }
- bcopy(info.data, p, info.size);
- p[info.size] = '\0';
- userleft -= info.size;
-
- /* get the next record */
-#if DB_VERSION_MAJOR < 2
- i = (*up->udb_dbp->seq)(up->udb_dbp, &key, &info, R_NEXT);
-#else
- i = 0;
- if ((errno = dbc->c_get(dbc, &key,
- &info, DB_NEXT)) != 0)
- i = 1;
-#endif
- }
-
-#if DB_VERSION_MAJOR > 1
- if (dbc != NULL)
- {
- (void) dbc->c_close(dbc);
- dbc = NULL;
- }
-#endif
-
- /* if nothing ever matched, try next database */
- if (!breakout)
- break;
-
- message("expanded to %s", user);
- if (LogLevel >= 10)
- sm_syslog(LOG_INFO, e->e_id,
- "expand %.100s => %s",
- e->e_to,
- shortenstring(user, MAXSHORTSTR));
- naddrs = sendtolist(user, a, sendq, aliaslevel + 1, e);
- if (naddrs > 0 && !bitset(QSELFREF, a->q_flags))
- {
- if (tTd(28, 5))
- {
- printf("udbexpand: QDONTSEND ");
- printaddr(a, FALSE);
- }
- a->q_flags |= QDONTSEND;
- }
- if (i < 0)
- {
- syserr("udbexpand: db-get %.*s stat %d",
- (int) key.size, (char *) key.data, i);
- return EX_TEMPFAIL;
- }
-
- /*
- ** If this address has a -request address, reflect
- ** it into the envelope.
- */
-
- bzero(&key, sizeof key);
- bzero(&info, sizeof info);
- (void) strcpy(keybuf, a->q_user);
- (void) strcat(keybuf, ":mailsender");
- keylen = strlen(keybuf);
- key.data = keybuf;
- key.size = keylen;
-
-#if DB_VERSION_MAJOR < 2
- i = (*up->udb_dbp->get)(up->udb_dbp, &key, &info, 0);
-#else
- i = errno = (*up->udb_dbp->get)(up->udb_dbp, NULL,
- &key, &info, 0);
-#endif
- if (i != 0 || info.size <= 0)
- break;
- a->q_owner = xalloc(info.size + 1);
- bcopy(info.data, a->q_owner, info.size);
- a->q_owner[info.size] = '\0';
-
- /* announce delivery; NORECEIPT bit set later */
- if (e->e_xfp != NULL)
- {
- fprintf(e->e_xfp,
- "Message delivered to mailing list %s\n",
- a->q_paddr);
- }
- e->e_flags |= EF_SENDRECEIPT;
- a->q_flags |= QDELIVERED|QEXPANDED;
- break;
-#endif
-
-#ifdef HESIOD
- case UDB_HESIOD:
- key.data = keybuf;
- key.size = keylen;
- if (tTd(28, 80))
- printf("udbexpand: trying %s (%d) via hesiod\n",
- keybuf, keylen);
- /* look up the key via hesiod */
- i = hes_udb_get(&key, &info);
- if (i < 0)
- {
- syserr("udbexpand: hesiod-get %.*s stat %d",
- (int) key.size, (char *) key.data, i);
- return EX_TEMPFAIL;
- }
- else if (i > 0 || info.size <= 0)
- {
-#if HES_GETMAILHOST
- struct hes_postoffice *hp;
-#endif
-
- if (tTd(28, 2))
- printf("udbexpand: no match on %s (%d)\n",
- (char *) keybuf, (int) keylen);
-#if HES_GETMAILHOST
- if (tTd(28, 8))
- printf(" ... trying hes_getmailhost(%s)\n",
- a->q_user);
- hp = hes_getmailhost(a->q_user);
- if (hp == NULL)
- {
- if (hes_error() == HES_ER_NET)
- {
- syserr("udbexpand: hesiod-getmail %s stat %d",
- a->q_user, hes_error());
- return EX_TEMPFAIL;
- }
- if (tTd(28, 2))
- printf("hes_getmailhost(%s): %d\n",
- a->q_user, hes_error());
- break;
- }
- if (strlen(hp->po_name) + strlen(hp->po_host) >
- sizeof pobuf - 2)
- {
- if (tTd(28, 2))
- printf("hes_getmailhost(%s): expansion too long: %.30s@%.30s\n",
- a->q_user,
- hp->po_name,
- hp->po_host);
- break;
- }
- info.data = pobuf;
- snprintf(pobuf, sizeof pobuf, "%s@%s",
- hp->po_name, hp->po_host);
- info.size = strlen(info.data);
-#else
- break;
-#endif
- }
- if (tTd(28, 80))
- printf("udbexpand: match %.*s: %.*s\n",
- (int) key.size, (char *) key.data,
- (int) info.size, (char *) info.data);
- a->q_flags &= ~QSELFREF;
-
- if (bitset(EF_VRFYONLY, e->e_flags))
- {
- a->q_flags |= QVERIFIED;
- return EX_OK;
- }
-
- breakout = TRUE;
- if (info.size >= usersize)
- user = xalloc(info.size + 1);
- bcopy(info.data, user, info.size);
- user[info.size] = '\0';
-
- message("hesioded to %s", user);
- if (LogLevel >= 10)
- sm_syslog(LOG_INFO, e->e_id,
- "hesiod %.100s => %s",
- e->e_to,
- shortenstring(user, MAXSHORTSTR));
- naddrs = sendtolist(user, a, sendq, aliaslevel + 1, e);
-
- if (naddrs > 0 && !bitset(QSELFREF, a->q_flags))
- {
- if (tTd(28, 5))
- {
- printf("udbexpand: QDONTSEND ");
- printaddr(a, FALSE);
- }
- a->q_flags |= QDONTSEND;
- }
-
- /*
- ** If this address has a -request address, reflect
- ** it into the envelope.
- */
-
- (void) strcpy(keybuf, a->q_user);
- (void) strcat(keybuf, ":mailsender");
- keylen = strlen(keybuf);
- key.data = keybuf;
- key.size = keylen;
- i = hes_udb_get(&key, &info);
- if (i != 0 || info.size <= 0)
- break;
- a->q_owner = xalloc(info.size + 1);
- bcopy(info.data, a->q_owner, info.size);
- a->q_owner[info.size] = '\0';
- break;
-#endif /* HESIOD */
-
- case UDB_REMOTE:
- /* not yet implemented */
- break;
-
- case UDB_FORWARD:
- if (bitset(EF_VRFYONLY, e->e_flags))
- return EX_OK;
- i = strlen(up->udb_fwdhost) + strlen(a->q_user) + 1;
- if (i >= usersize)
- {
- usersize = i + 1;
- user = xalloc(usersize);
- }
- (void) snprintf(user, usersize, "%s@%s",
- a->q_user, up->udb_fwdhost);
- message("expanded to %s", user);
- a->q_flags &= ~QSELFREF;
- naddrs = sendtolist(user, a, sendq, aliaslevel + 1, e);
- if (naddrs > 0 && !bitset(QSELFREF, a->q_flags))
- {
- if (tTd(28, 5))
- {
- printf("udbexpand: QDONTSEND ");
- printaddr(a, FALSE);
- }
- a->q_flags |= QDONTSEND;
- }
- breakout = TRUE;
- break;
-
- case UDB_EOLIST:
- breakout = TRUE;
- break;
-
- default:
- /* unknown entry type */
- break;
- }
- if (user != userbuf)
- free(user);
- }
- return EX_OK;
-}
-\f/*
-** UDBSENDER -- return canonical external name of sender, given local name
-**
-** Parameters:
-** sender -- the name of the sender on the local machine.
-**
-** Returns:
-** The external name for this sender, if derivable from the
-** database.
-** NULL -- if nothing is changed from the database.
-**
-** Side Effects:
-** none.
-*/
-
-char *
-udbsender(sender)
- char *sender;
-{
- extern char *udbmatch __P((char *, char *));
-
- return udbmatch(sender, "mailname");
-}
-
-
-char *
-udbmatch(user, field)
- char *user;
- char *field;
-{
- register char *p;
- register struct udbent *up;
- int i;
- int keylen;
- DBT key, info;
- char keybuf[MAXKEY];
-
- if (tTd(28, 1))
- printf("udbmatch(%s, %s)\n", user, field);
-
- if (!UdbInitialized)
- {
- if (_udbx_init(CurEnv) == EX_TEMPFAIL)
- return NULL;
- }
-
- /* short circuit if no spec */
- if (UdbSpec == NULL || UdbSpec[0] == '\0')
- return NULL;
-
- /* short circuit name begins with '\\' since it can't possibly match */
- if (user[0] == '\\')
- return NULL;
-
- /* long names can never match and are a pain to deal with */
- i = strlen(field);
- if (i < sizeof "maildrop")
- i = sizeof "maildrop";
- if ((strlen(user) + i) > sizeof keybuf - 4)
- return NULL;
-
- /* names beginning with colons indicate metadata */
- if (user[0] == ':')
- return NULL;
-
- /* build database key */
- (void) strcpy(keybuf, user);
- (void) strcat(keybuf, ":");
- (void) strcat(keybuf, field);
- keylen = strlen(keybuf);
-
- for (up = UdbEnts; up->udb_type != UDB_EOLIST; up++)
- {
- /*
- ** Select action based on entry type.
- */
-
- switch (up->udb_type)
- {
-#ifdef NEWDB
- case UDB_DBFETCH:
- bzero(&key, sizeof key);
- bzero(&info, sizeof info);
- key.data = keybuf;
- key.size = keylen;
-#if DB_VERSION_MAJOR < 2
- i = (*up->udb_dbp->get)(up->udb_dbp, &key, &info, 0);
-#else
- i = errno = (*up->udb_dbp->get)(up->udb_dbp, NULL,
- &key, &info, 0);
-#endif
- if (i != 0 || info.size <= 0)
- {
- if (tTd(28, 2))
- printf("udbmatch: no match on %s (%d) via db\n",
- keybuf, keylen);
- continue;
- }
-
- p = xalloc(info.size + 1);
- bcopy(info.data, p, info.size);
- p[info.size] = '\0';
- if (tTd(28, 1))
- printf("udbmatch ==> %s\n", p);
- return p;
-#endif
-
-#ifdef HESIOD
- case UDB_HESIOD:
- key.data = keybuf;
- key.size = keylen;
- i = hes_udb_get(&key, &info);
- if (i != 0 || info.size <= 0)
- {
- if (tTd(28, 2))
- printf("udbmatch: no match on %s (%d) via hesiod\n",
- keybuf, keylen);
- continue;
- }
-
- p = xalloc(info.size + 1);
- bcopy(info.data, p, info.size);
- p[info.size] = '\0';
- if (tTd(28, 1))
- printf("udbmatch ==> %s\n", p);
- return p;
-#endif /* HESIOD */
- }
- }
-
- if (strcmp(field, "mailname") != 0)
- return NULL;
-
- /*
- ** Nothing yet. Search again for a default case. But only
- ** use it if we also have a forward (:maildrop) pointer already
- ** in the database.
- */
-
- /* build database key */
- (void) strcpy(keybuf, user);
- (void) strcat(keybuf, ":maildrop");
- keylen = strlen(keybuf);
-
- for (up = UdbEnts; up->udb_type != UDB_EOLIST; up++)
- {
- switch (up->udb_type)
- {
-#ifdef NEWDB
- case UDB_DBFETCH:
- /* get the default case for this database */
- if (up->udb_default == NULL)
- {
- bzero(&key, sizeof key);
- bzero(&info, sizeof info);
- key.data = ":default:mailname";
- key.size = strlen(key.data);
-#if DB_VERSION_MAJOR < 2
- i = (*up->udb_dbp->get)(up->udb_dbp,
- &key, &info, 0);
-#else
- i = errno = (*up->udb_dbp->get)(up->udb_dbp,
- NULL, &key,
- &info, 0);
-#endif
- if (i != 0 || info.size <= 0)
- {
- /* no default case */
- up->udb_default = "";
- continue;
- }
-
- /* save the default case */
- up->udb_default = xalloc(info.size + 1);
- bcopy(info.data, up->udb_default, info.size);
- up->udb_default[info.size] = '\0';
- }
- else if (up->udb_default[0] == '\0')
- continue;
-
- /* we have a default case -- verify user:maildrop */
- bzero(&key, sizeof key);
- bzero(&info, sizeof info);
- key.data = keybuf;
- key.size = keylen;
-#if DB_VERSION_MAJOR < 2
- i = (*up->udb_dbp->get)(up->udb_dbp, &key, &info, 0);
-#else
- i = errno = (*up->udb_dbp->get)(up->udb_dbp, NULL,
- &key, &info, 0);
-#endif
- if (i != 0 || info.size <= 0)
- {
- /* nope -- no aliasing for this user */
- continue;
- }
-
- /* they exist -- build the actual address */
- p = xalloc(strlen(user) + strlen(up->udb_default) + 2);
- (void) strcpy(p, user);
- (void) strcat(p, "@");
- (void) strcat(p, up->udb_default);
- if (tTd(28, 1))
- printf("udbmatch ==> %s\n", p);
- return p;
-#endif
-
-#ifdef HESIOD
- case UDB_HESIOD:
- /* get the default case for this database */
- if (up->udb_default == NULL)
- {
- key.data = ":default:mailname";
- key.size = strlen(key.data);
- i = hes_udb_get(&key, &info);
-
- if (i != 0 || info.size <= 0)
- {
- /* no default case */
- up->udb_default = "";
- continue;
- }
-
- /* save the default case */
- up->udb_default = xalloc(info.size + 1);
- bcopy(info.data, up->udb_default, info.size);
- up->udb_default[info.size] = '\0';
- }
- else if (up->udb_default[0] == '\0')
- continue;
-
- /* we have a default case -- verify user:maildrop */
- key.data = keybuf;
- key.size = keylen;
- i = hes_udb_get(&key, &info);
- if (i != 0 || info.size <= 0)
- {
- /* nope -- no aliasing for this user */
- continue;
- }
-
- /* they exist -- build the actual address */
- p = xalloc(strlen(user) + strlen(up->udb_default) + 2);
- (void) strcpy(p, user);
- (void) strcat(p, "@");
- (void) strcat(p, up->udb_default);
- if (tTd(28, 1))
- printf("udbmatch ==> %s\n", p);
- return p;
- break;
-#endif /* HESIOD */
- }
- }
-
- /* still nothing.... too bad */
- return NULL;
-}
-\f/*
-** UDB_MAP_LOOKUP -- look up arbitrary entry in user database map
-**
-** Parameters:
-** map -- the map being queried.
-** name -- the name to look up.
-** av -- arguments to the map lookup.
-** statp -- to get any error status.
-**
-** Returns:
-** NULL if name not found in map.
-** The rewritten name otherwise.
-*/
-
-/* ARGSUSED3 */
-char *
-udb_map_lookup(map, name, av, statp)
- MAP *map;
- char *name;
- char **av;
- int *statp;
-{
- char *val;
- char *key;
- char keybuf[MAXNAME + 1];
-
- if (tTd(28, 20) || tTd(38, 20))
- printf("udb_map_lookup(%s, %s)\n", map->map_mname, name);
-
- if (bitset(MF_NOFOLDCASE, map->map_mflags))
- {
- key = name;
- }
- else
- {
- int keysize = strlen(name);
-
- if (keysize > sizeof keybuf - 1)
- keysize = sizeof keybuf - 1;
- bcopy(name, keybuf, keysize);
- keybuf[keysize] = '\0';
- makelower(keybuf);
- key = keybuf;
- }
- val = udbmatch(key, map->map_file);
- if (val == NULL)
- return NULL;
- if (bitset(MF_MATCHONLY, map->map_mflags))
- return map_rewrite(map, name, strlen(name), NULL);
- else
- return map_rewrite(map, val, strlen(val), av);
-}
-\f/*
-** _UDBX_INIT -- parse the UDB specification, opening any valid entries.
-**
-** Parameters:
-** e -- the current envelope.
-**
-** Returns:
-** EX_TEMPFAIL -- if it appeared it couldn't get hold of a
-** database due to a host being down or some similar
-** (recoverable) situation.
-** EX_OK -- otherwise.
-**
-** Side Effects:
-** Fills in the UdbEnts structure from UdbSpec.
-*/
-
-#define MAXUDBOPTS 27
-
-int
-_udbx_init(e)
- ENVELOPE *e;
-{
- int ents = 0;
- register char *p;
- register struct udbent *up;
-
- if (UdbInitialized)
- return EX_OK;
-
-# ifdef UDB_DEFAULT_SPEC
- if (UdbSpec == NULL)
- UdbSpec = UDB_DEFAULT_SPEC;
-# endif
-
- p = UdbSpec;
- up = UdbEnts;
- while (p != NULL)
- {
- char *spec;
- int l;
-# if 0
- auto int rcode;
- int nmx;
- int i;
- register struct hostent *h;
- char *mxhosts[MAXMXHOSTS + 1];
-# endif
- struct udb_option opts[MAXUDBOPTS + 1];
- extern int _udb_parsespec __P((char *, struct udb_option [], int));
-
- while (*p == ' ' || *p == '\t' || *p == ',')
- p++;
- if (*p == '\0')
- break;
- spec = p;
- p = strchr(p, ',');
- if (p != NULL)
- *p++ = '\0';
-
- if (ents >= MAXUDBENT)
- {
- syserr("Maximum number of UDB entries exceeded");
- break;
- }
-
- /* extract options */
- (void) _udb_parsespec(spec, opts, MAXUDBOPTS);
-
- /*
- ** Decode database specification.
- **
- ** In the sendmail tradition, the leading character
- ** defines the semantics of the rest of the entry.
- **
- ** +hostname -- send a datagram to the udb server
- ** on host "hostname" asking for the
- ** home mail server for this user.
- ** *hostname -- similar to +hostname, except that the
- ** hostname is searched as an MX record;
- ** resulting hosts are searched as for
- ** +mxhostname. If no MX host is found,
- ** this is the same as +hostname.
- ** @hostname -- forward email to the indicated host.
- ** This should be the last in the list,
- ** since it always matches the input.
- ** /dbname -- search the named database on the local
- ** host using the Berkeley db package.
- ** Hesiod -- search the named database with BIND
- ** using the MIT Hesiod package.
- */
-
- switch (*spec)
- {
-#if 0
- case '+': /* search remote database */
- case '*': /* search remote database (expand MX) */
- if (*spec == '*')
- {
-#if NAMED_BIND
- nmx = getmxrr(spec + 1, mxhosts, FALSE, &rcode);
-#else
- mxhosts[0] = spec + 1;
- nmx = 1;
- rcode = 0;
-#endif
- if (tTd(28, 16))
- {
- int i;
-
- printf("getmxrr(%s): %d", spec + 1, nmx);
- for (i = 0; i <= nmx; i++)
- printf(" %s", mxhosts[i]);
- printf("\n");
- }
- }
- else
- {
- nmx = 1;
- mxhosts[0] = spec + 1;
- }
-
- for (i = 0; i < nmx; i++)
- {
- h = sm_gethostbyname(mxhosts[i]);
- if (h == NULL)
- continue;
- up->udb_type = UDB_REMOTE;
- up->udb_pid = getpid();
- up->udb_addr.sin_family = h->h_addrtype;
- bcopy(h->h_addr_list[0],
- (char *) &up->udb_addr.sin_addr,
- INADDRSZ);
- up->udb_addr.sin_port = UdbPort;
- up->udb_timeout = UdbTimeout;
- ents++;
- up++;
- }
-
- /* set up a datagram socket */
- if (UdbSock < 0)
- {
- UdbSock = socket(AF_INET, SOCK_DGRAM, 0);
- (void) fcntl(UdbSock, F_SETFD, 1);
- }
- break;
-#endif
-
- case '@': /* forward to remote host */
- up->udb_type = UDB_FORWARD;
- up->udb_pid = getpid();
- up->udb_fwdhost = spec + 1;
- ents++;
- up++;
- break;
-
-#ifdef HESIOD
- case 'h': /* use hesiod */
- case 'H':
- if (strcasecmp(spec, "hesiod") != 0)
- goto badspec;
- up->udb_type = UDB_HESIOD;
- up->udb_pid = getpid();
- ents++;
- up++;
- break;
-#endif /* HESIOD */
-
-#ifdef NEWDB
- case '/': /* look up remote name */
- l = strlen(spec);
- if (l > 3 && strcmp(&spec[l - 3], ".db") == 0)
- {
- up->udb_dbname = spec;
- }
- else
- {
- up->udb_dbname = xalloc(l + 4);
- strcpy(up->udb_dbname, spec);
- strcat(up->udb_dbname, ".db");
- }
- errno = 0;
-#if DB_VERSION_MAJOR < 2
- up->udb_dbp = dbopen(up->udb_dbname, O_RDONLY,
- 0644, DB_BTREE, NULL);
-#else
- up->udb_dbp = NULL;
- errno = db_open(up->udb_dbname, DB_BTREE, DB_RDONLY,
- 0644, NULL, NULL, &up->udb_dbp);
-#endif
- if (up->udb_dbp == NULL)
- {
- if (tTd(28, 1))
- {
- int saveerrno = errno;
-
-#if DB_VERSION_MAJOR < 2
- printf("dbopen(%s): %s\n",
-#else
- printf("db_open(%s): %s\n",
-#endif
- up->udb_dbname,
- errstring(errno));
- errno = saveerrno;
- }
- if (errno != ENOENT && errno != EACCES)
- {
- if (LogLevel > 2)
- sm_syslog(LOG_ERR, e->e_id,
-#if DB_VERSION_MAJOR < 2
- "dbopen(%s): %s",
-#else
- "db_open(%s): %s",
-#endif
- up->udb_dbname,
- errstring(errno));
- up->udb_type = UDB_EOLIST;
- if (up->udb_dbname != spec)
- free(up->udb_dbname);
- goto tempfail;
- }
- if (up->udb_dbname != spec)
- free(up->udb_dbname);
- break;
- }
- if (tTd(28, 1))
- {
-#if DB_VERSION_MAJOR < 2
- printf("_udbx_init: dbopen(%s)\n",
-#else
- printf("_udbx_init: db_open(%s)\n",
-#endif
- up->udb_dbname);
- }
- up->udb_type = UDB_DBFETCH;
- up->udb_pid = getpid();
- ents++;
- up++;
- break;
-#endif
-
- default:
-badspec:
- syserr("Unknown UDB spec %s", spec);
- break;
- }
- }
- up->udb_type = UDB_EOLIST;
-
- if (tTd(28, 4))
- {
- for (up = UdbEnts; up->udb_type != UDB_EOLIST; up++)
- {
- switch (up->udb_type)
- {
-#if DAEMON
- case UDB_REMOTE:
- printf("REMOTE: addr %s, timeo %d\n",
- anynet_ntoa((SOCKADDR *) &up->udb_addr),
- up->udb_timeout);
- break;
-#endif
-
- case UDB_DBFETCH:
-#ifdef NEWDB
- printf("FETCH: file %s\n",
- up->udb_dbname);
-#else
- printf("FETCH\n");
-#endif
- break;
-
- case UDB_FORWARD:
- printf("FORWARD: host %s\n",
- up->udb_fwdhost);
- break;
-
- case UDB_HESIOD:
- printf("HESIOD\n");
- break;
-
- default:
- printf("UNKNOWN\n");
- break;
- }
- }
- }
-
- UdbInitialized = TRUE;
- errno = 0;
- return EX_OK;
-
- /*
- ** On temporary failure, back out anything we've already done
- */
-
- tempfail:
-#ifdef NEWDB
- for (up = UdbEnts; up->udb_type != UDB_EOLIST; up++)
- {
- if (up->udb_type == UDB_DBFETCH)
- {
-#if DB_VERSION_MAJOR < 2
- (*up->udb_dbp->close)(up->udb_dbp);
-#else
- errno = (*up->udb_dbp->close)(up->udb_dbp, 0);
-#endif
- if (tTd(28, 1))
- {
- printf("_udbx_init: db->close(%s)\n",
- up->udb_dbname);
- }
- }
- }
-#endif
- return EX_TEMPFAIL;
-}
-
-int
-_udb_parsespec(udbspec, opt, maxopts)
- char *udbspec;
- struct udb_option opt[];
- int maxopts;
-{
- register char *spec;
- register char *spec_end;
- register int optnum;
-
- spec_end = strchr(udbspec, ':');
- for (optnum = 0; optnum < maxopts && (spec = spec_end) != NULL; optnum++)
- {
- register char *p;
-
- while (isascii(*spec) && isspace(*spec))
- spec++;
- spec_end = strchr(spec, ':');
- if (spec_end != NULL)
- *spec_end++ = '\0';
-
- opt[optnum].name = spec;
- opt[optnum].val = NULL;
- p = strchr(spec, '=');
- if (p != NULL)
- opt[optnum].val = ++p;
- }
- return optnum;
-}
-\f/*
-** _UDBX_CLOSE -- close all file based UDB entries.
-**
-** Parameters:
-** none
-**
-** Returns:
-** none
-*/
-void
-_udbx_close()
-{
- pid_t pid;
- struct udbent *up;
-
- if (!UdbInitialized)
- return;
-
- pid = getpid();
-
- for (up = UdbEnts; up->udb_type != UDB_EOLIST; up++)
- {
- if (up->udb_pid != pid)
- continue;
-
-#ifdef NEWDB
- if (up->udb_type == UDB_DBFETCH)
- {
-#if DB_VERSION_MAJOR < 2
- (*up->udb_dbp->close)(up->udb_dbp);
-#else
- errno = (*up->udb_dbp->close)(up->udb_dbp, 0);
-#endif
- }
- if (tTd(28, 1))
- {
- printf("_udbx_init: db->close(%s)\n",
- up->udb_dbname);
- }
-#endif
- }
-}
-
-#ifdef HESIOD
-
-int
-hes_udb_get(key, info)
- DBT *key;
- DBT *info;
-{
- char *name, *type;
- char **hp;
- char kbuf[MAXKEY + 1];
-
- if (strlen(key->data) >= (SIZE_T) sizeof kbuf)
- return 0;
- strcpy(kbuf, key->data);
- name = kbuf;
- type = strrchr(name, ':');
- if (type == NULL)
- return 1;
- *type++ = '\0';
- if (strchr(name, '@') != NULL)
- return 1;
-
- if (tTd(28, 1))
- printf("hes_udb_get(%s, %s)\n", name, type);
-
- /* make the hesiod query */
-#ifdef HESIOD_INIT
- if (HesiodContext == NULL && hesiod_init(&HesiodContext) != 0)
- return -1;
- hp = hesiod_resolve(HesiodContext, name, type);
-#else
- hp = hes_resolve(name, type);
-#endif /* HESIOD_INIT */
- *--type = ':';
-#ifdef HESIOD_INIT
- if (hp == NULL)
- return 1;
- if (*hp == NULL)
- {
- hesiod_free_list(HesiodContext, hp);
- if (errno == ECONNREFUSED || errno == EMSGSIZE)
- return -1;
- return 1;
- }
-#else
- if (hp == NULL || hp[0] == NULL)
- {
- /* network problem or timeout */
- if (hes_error() == HES_ER_NET)
- return -1;
-
- return 1;
- }
-#endif /* HESIOD_INIT */
- else
- {
- /*
- ** If there are multiple matches, just return the
- ** first one.
- **
- ** XXX These should really be returned; for example,
- ** XXX it is legal for :maildrop to be multi-valued.
- */
-
- info->data = hp[0];
- info->size = (size_t) strlen(info->data);
- }
-
- if (tTd(28, 80))
- printf("hes_udb_get => %s\n", *hp);
-
- return 0;
-}
-#endif /* HESIOD */
-
-#else /* not USERDB */
-
-int
-udbexpand(a, sendq, aliaslevel, e)
- ADDRESS *a;
- ADDRESS **sendq;
- int aliaslevel;
- ENVELOPE *e;
-{
- return EX_OK;
-}
-
-#endif /* USERDB */
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- *
- * @(#)useful.h 8.12 (Berkeley) 5/19/1998
- */
-
-# include <sys/types.h>
-
-/* support for bool type */
-typedef int bool;
-#ifndef TRUE
-# define TRUE 1
-# define FALSE 0
-#endif
-
-# ifndef NULL
-# define NULL 0
-# endif /* NULL */
-
-/* bit hacking */
-# define bitset(bit, word) (((word) & (bit)) != 0)
-
-/* some simple functions */
-# ifndef max
-# define max(a, b) ((a) > (b) ? (a) : (b))
-# define min(a, b) ((a) < (b) ? (a) : (b))
-# endif
-
-/* assertions */
-# ifndef NASSERT
-# define ASSERT(expr, msg, parm)\
- if (!(expr))\
- {\
- fprintf(stderr, "assertion botch: %s:%d: ", __FILE__, __LINE__);\
- fprintf(stderr, msg, parm);\
- }
-# else /* NASSERT */
-# define ASSERT(expr, msg, parm)
-# endif /* NASSERT */
-
-/* sccs id's */
-# ifndef lint
-# ifdef __STDC__
-# define SCCSID(arg) static char SccsId[] = #arg;
-# else
-# define SCCSID(arg) static char SccsId[] = "arg";
-# endif
-# else
-# define SCCSID(arg)
-# endif
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-# include "sendmail.h"
-
-#ifndef lint
-#if SMTP
-static char sccsid[] = "@(#)usersmtp.c 8.111 (Berkeley) 2/3/1999 (with SMTP)";
-#else
-static char sccsid[] = "@(#)usersmtp.c 8.111 (Berkeley) 2/3/1999 (without SMTP)";
-#endif
-#endif /* not lint */
-
-# include <sysexits.h>
-# include <errno.h>
-
-# if SMTP
-
-/*
-** USERSMTP -- run SMTP protocol from the user end.
-**
-** This protocol is described in RFC821.
-*/
-
-#define REPLYTYPE(r) ((r) / 100) /* first digit of reply code */
-#define REPLYCLASS(r) (((r) / 10) % 10) /* second digit of reply code */
-#define SMTPCLOSING 421 /* "Service Shutting Down" */
-
-char SmtpMsgBuffer[MAXLINE]; /* buffer for commands */
-char SmtpReplyBuffer[MAXLINE]; /* buffer for replies */
-char SmtpError[MAXLINE] = ""; /* save failure error messages */
-bool SmtpNeedIntro; /* need "while talking" in transcript */
-
-extern void smtpmessage __P((char *f, MAILER *m, MCI *mci, ...));
-extern int reply __P((MAILER *, MCI *, ENVELOPE *, time_t, void (*)()));
-\f/*
-** SMTPINIT -- initialize SMTP.
-**
-** Opens the connection and sends the initial protocol.
-**
-** Parameters:
-** m -- mailer to create connection to.
-** pvp -- pointer to parameter vector to pass to
-** the mailer.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** creates connection and sends initial protocol.
-*/
-
-void
-smtpinit(m, mci, e)
- MAILER *m;
- register MCI *mci;
- ENVELOPE *e;
-{
- register int r;
- register char *p;
- extern void esmtp_check __P((char *, bool, MAILER *, MCI *, ENVELOPE *));
- extern void helo_options __P((char *, bool, MAILER *, MCI *, ENVELOPE *));
-
- if (tTd(18, 1))
- {
- printf("smtpinit ");
- mci_dump(mci, FALSE);
- }
-
- /*
- ** Open the connection to the mailer.
- */
-
- SmtpError[0] = '\0';
- CurHostName = mci->mci_host; /* XXX UGLY XXX */
- if (CurHostName == NULL)
- CurHostName = MyHostName;
- SmtpNeedIntro = TRUE;
- switch (mci->mci_state)
- {
- case MCIS_ACTIVE:
- /* need to clear old information */
- smtprset(m, mci, e);
- /* fall through */
-
- case MCIS_OPEN:
- return;
-
- case MCIS_ERROR:
- case MCIS_SSD:
- /* shouldn't happen */
- smtpquit(m, mci, e);
- /* fall through */
-
- case MCIS_CLOSED:
- syserr("451 smtpinit: state CLOSED");
- return;
-
- case MCIS_OPENING:
- break;
- }
-
- mci->mci_state = MCIS_OPENING;
-
- /*
- ** Get the greeting message.
- ** This should appear spontaneously. Give it five minutes to
- ** happen.
- */
-
- SmtpPhase = mci->mci_phase = "client greeting";
- sm_setproctitle(TRUE, "%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
- r = reply(m, mci, e, TimeOuts.to_initial, esmtp_check);
- if (r < 0)
- goto tempfail1;
- if (REPLYTYPE(r) == 4)
- goto tempfail2;
- if (REPLYTYPE(r) != 2)
- goto unavailable;
-
- /*
- ** Send the HELO command.
- ** My mother taught me to always introduce myself.
- */
-
- if (bitnset(M_ESMTP, m->m_flags) || bitnset(M_LMTP, m->m_flags))
- mci->mci_flags |= MCIF_ESMTP;
-
-tryhelo:
- if (bitnset(M_LMTP, m->m_flags))
- {
- smtpmessage("LHLO %s", m, mci, MyHostName);
- SmtpPhase = mci->mci_phase = "client LHLO";
- }
- else if (bitset(MCIF_ESMTP, mci->mci_flags))
- {
- smtpmessage("EHLO %s", m, mci, MyHostName);
- SmtpPhase = mci->mci_phase = "client EHLO";
- }
- else
- {
- smtpmessage("HELO %s", m, mci, MyHostName);
- SmtpPhase = mci->mci_phase = "client HELO";
- }
- sm_setproctitle(TRUE, "%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
- r = reply(m, mci, e, TimeOuts.to_helo, helo_options);
- if (r < 0)
- goto tempfail1;
- else if (REPLYTYPE(r) == 5)
- {
- if (bitset(MCIF_ESMTP, mci->mci_flags) &&
- !bitnset(M_LMTP, m->m_flags))
- {
- /* try old SMTP instead */
- mci->mci_flags &= ~MCIF_ESMTP;
- goto tryhelo;
- }
- goto unavailable;
- }
- else if (REPLYTYPE(r) != 2)
- goto tempfail2;
-
- /*
- ** Check to see if we actually ended up talking to ourself.
- ** This means we didn't know about an alias or MX, or we managed
- ** to connect to an echo server.
- */
-
- p = strchr(&SmtpReplyBuffer[4], ' ');
- if (p != NULL)
- *p = '\0';
- if (!bitnset(M_NOLOOPCHECK, m->m_flags) &&
- !bitnset(M_LMTP, m->m_flags) &&
- strcasecmp(&SmtpReplyBuffer[4], MyHostName) == 0)
- {
- syserr("553 %s config error: mail loops back to me (MX problem?)",
- CurHostName);
- mci_setstat(mci, EX_CONFIG, NULL, NULL);
- mci->mci_errno = 0;
- smtpquit(m, mci, e);
- return;
- }
-
- /*
- ** If this is expected to be another sendmail, send some internal
- ** commands.
- */
-
- if (bitnset(M_INTERNAL, m->m_flags))
- {
- /* tell it to be verbose */
- smtpmessage("VERB", m, mci);
- r = reply(m, mci, e, TimeOuts.to_miscshort, NULL);
- if (r < 0)
- goto tempfail1;
- }
-
- if (mci->mci_state != MCIS_CLOSED)
- {
- mci->mci_state = MCIS_OPEN;
- return;
- }
-
- /* got a 421 error code during startup */
-
- tempfail1:
- if (mci->mci_errno == 0)
- mci->mci_errno = errno;
- mci_setstat(mci, EX_TEMPFAIL, "4.4.2", NULL);
- if (mci->mci_state != MCIS_CLOSED)
- smtpquit(m, mci, e);
- return;
-
- tempfail2:
- if (mci->mci_errno == 0)
- mci->mci_errno = errno;
- /* XXX should use code from other end iff ENHANCEDSTATUSCODES */
- mci_setstat(mci, EX_TEMPFAIL, "4.5.0", SmtpReplyBuffer);
- if (mci->mci_state != MCIS_CLOSED)
- smtpquit(m, mci, e);
- return;
-
- unavailable:
- mci->mci_errno = errno;
- mci_setstat(mci, EX_UNAVAILABLE, "5.5.0", SmtpReplyBuffer);
- smtpquit(m, mci, e);
- return;
-}
-\f/*
-** ESMTP_CHECK -- check to see if this implementation likes ESMTP protocol
-**
-** Parameters:
-** line -- the response line.
-** firstline -- set if this is the first line of the reply.
-** m -- the mailer.
-** mci -- the mailer connection info.
-** e -- the envelope.
-**
-** Returns:
-** none.
-*/
-
-void
-esmtp_check(line, firstline, m, mci, e)
- char *line;
- bool firstline;
- MAILER *m;
- register MCI *mci;
- ENVELOPE *e;
-{
- if (strstr(line, "ESMTP") != NULL)
- mci->mci_flags |= MCIF_ESMTP;
- if (strstr(line, "8BIT-OK") != NULL)
- mci->mci_flags |= MCIF_8BITOK;
-}
-\f/*
-** HELO_OPTIONS -- process the options on a HELO line.
-**
-** Parameters:
-** line -- the response line.
-** firstline -- set if this is the first line of the reply.
-** m -- the mailer.
-** mci -- the mailer connection info.
-** e -- the envelope.
-**
-** Returns:
-** none.
-*/
-
-void
-helo_options(line, firstline, m, mci, e)
- char *line;
- bool firstline;
- MAILER *m;
- register MCI *mci;
- ENVELOPE *e;
-{
- register char *p;
-
- if (firstline)
- return;
-
- if (strlen(line) < (SIZE_T) 5)
- return;
- line += 4;
- p = strchr(line, ' ');
- if (p != NULL)
- *p++ = '\0';
- if (strcasecmp(line, "size") == 0)
- {
- mci->mci_flags |= MCIF_SIZE;
- if (p != NULL)
- mci->mci_maxsize = atol(p);
- }
- else if (strcasecmp(line, "8bitmime") == 0)
- {
- mci->mci_flags |= MCIF_8BITMIME;
- mci->mci_flags &= ~MCIF_7BIT;
- }
- else if (strcasecmp(line, "expn") == 0)
- mci->mci_flags |= MCIF_EXPN;
- else if (strcasecmp(line, "dsn") == 0)
- mci->mci_flags |= MCIF_DSN;
-}
-\f/*
-** SMTPMAILFROM -- send MAIL command
-**
-** Parameters:
-** m -- the mailer.
-** mci -- the mailer connection structure.
-** e -- the envelope (including the sender to specify).
-*/
-
-int
-smtpmailfrom(m, mci, e)
- MAILER *m;
- MCI *mci;
- ENVELOPE *e;
-{
- int r;
- char *bufp;
- char *bodytype;
- char buf[MAXNAME + 1];
- char optbuf[MAXLINE];
-
- if (tTd(18, 2))
- printf("smtpmailfrom: CurHost=%s\n", CurHostName);
-
- /* set up appropriate options to include */
- bufp = optbuf;
- if (bitset(MCIF_SIZE, mci->mci_flags) && e->e_msgsize > 0)
- snprintf(optbuf, sizeof optbuf, " SIZE=%ld", e->e_msgsize);
- else
- strcpy(optbuf, "");
- bufp = &optbuf[strlen(optbuf)];
-
- bodytype = e->e_bodytype;
- if (bitset(MCIF_8BITMIME, mci->mci_flags))
- {
- if (bodytype == NULL &&
- bitset(MM_MIME8BIT, MimeMode) &&
- bitset(EF_HAS8BIT, e->e_flags) &&
- !bitset(EF_DONT_MIME, e->e_flags) &&
- !bitnset(M_8BITS, m->m_flags))
- bodytype = "8BITMIME";
- if (bodytype != NULL &&
- SPACELEFT(optbuf, bufp) > strlen(bodytype) + 7)
- {
- snprintf(bufp, SPACELEFT(optbuf, bufp),
- " BODY=%s", bodytype);
- bufp += strlen(bufp);
- }
- }
- else if (bitnset(M_8BITS, m->m_flags) ||
- !bitset(EF_HAS8BIT, e->e_flags) ||
- bitset(MCIF_8BITOK, mci->mci_flags))
- {
- /* just pass it through */
- }
-#if MIME8TO7
- else if (bitset(MM_CVTMIME, MimeMode) &&
- !bitset(EF_DONT_MIME, e->e_flags) &&
- (!bitset(MM_PASS8BIT, MimeMode) ||
- bitset(EF_IS_MIME, e->e_flags)))
- {
- /* must convert from 8bit MIME format to 7bit encoded */
- mci->mci_flags |= MCIF_CVT8TO7;
- }
-#endif
- else if (!bitset(MM_PASS8BIT, MimeMode))
- {
- /* cannot just send a 8-bit version */
- extern char MsgBuf[];
-
- usrerr("%s does not support 8BITMIME", CurHostName);
- mci_setstat(mci, EX_NOTSTICKY, "5.6.3", MsgBuf);
- return EX_DATAERR;
- }
-
- if (bitset(MCIF_DSN, mci->mci_flags))
- {
- if (e->e_envid != NULL &&
- SPACELEFT(optbuf, bufp) > strlen(e->e_envid) + 7)
- {
- snprintf(bufp, SPACELEFT(optbuf, bufp),
- " ENVID=%s", e->e_envid);
- bufp += strlen(bufp);
- }
-
- /* RET= parameter */
- if (bitset(EF_RET_PARAM, e->e_flags) &&
- SPACELEFT(optbuf, bufp) > 9)
- {
- snprintf(bufp, SPACELEFT(optbuf, bufp),
- " RET=%s",
- bitset(EF_NO_BODY_RETN, e->e_flags) ?
- "HDRS" : "FULL");
- bufp += strlen(bufp);
- }
- }
-
- /*
- ** Send the MAIL command.
- ** Designates the sender.
- */
-
- mci->mci_state = MCIS_ACTIVE;
-
- if (bitset(EF_RESPONSE, e->e_flags) &&
- !bitnset(M_NO_NULL_FROM, m->m_flags))
- (void) strcpy(buf, "");
- else
- expand("\201g", buf, sizeof buf, e);
- if (buf[0] == '<')
- {
- /* strip off <angle brackets> (put back on below) */
- bufp = &buf[strlen(buf) - 1];
- if (*bufp == '>')
- *bufp = '\0';
- bufp = &buf[1];
- }
- else
- bufp = buf;
- if (bitnset(M_LOCALMAILER, e->e_from.q_mailer->m_flags) ||
- !bitnset(M_FROMPATH, m->m_flags))
- {
- smtpmessage("MAIL From:<%s>%s", m, mci, bufp, optbuf);
- }
- else
- {
- smtpmessage("MAIL From:<@%s%c%s>%s", m, mci, MyHostName,
- *bufp == '@' ? ',' : ':', bufp, optbuf);
- }
- SmtpPhase = mci->mci_phase = "client MAIL";
- sm_setproctitle(TRUE, "%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
- r = reply(m, mci, e, TimeOuts.to_mail, NULL);
- if (r < 0)
- {
- /* communications failure */
- mci->mci_errno = errno;
- mci_setstat(mci, EX_TEMPFAIL, "4.4.2", NULL);
- smtpquit(m, mci, e);
- return EX_TEMPFAIL;
- }
- else if (r == 421)
- {
- /* service shutting down */
- mci_setstat(mci, EX_TEMPFAIL, "4.5.0", SmtpReplyBuffer);
- smtpquit(m, mci, e);
- return EX_TEMPFAIL;
- }
- else if (REPLYTYPE(r) == 4)
- {
- mci_setstat(mci, EX_NOTSTICKY, smtptodsn(r), SmtpReplyBuffer);
- return EX_TEMPFAIL;
- }
- else if (REPLYTYPE(r) == 2)
- {
- return EX_OK;
- }
- else if (r == 501)
- {
- /* syntax error in arguments */
- mci_setstat(mci, EX_NOTSTICKY, "5.5.2", SmtpReplyBuffer);
- return EX_DATAERR;
- }
- else if (r == 553)
- {
- /* mailbox name not allowed */
- mci_setstat(mci, EX_NOTSTICKY, "5.1.3", SmtpReplyBuffer);
- return EX_DATAERR;
- }
- else if (r == 552)
- {
- /* exceeded storage allocation */
- mci_setstat(mci, EX_NOTSTICKY, "5.3.4", SmtpReplyBuffer);
- if (bitset(MCIF_SIZE, mci->mci_flags))
- e->e_flags |= EF_NO_BODY_RETN;
- return EX_UNAVAILABLE;
- }
- else if (REPLYTYPE(r) == 5)
- {
- /* unknown error */
- mci_setstat(mci, EX_NOTSTICKY, "5.0.0", SmtpReplyBuffer);
- return EX_UNAVAILABLE;
- }
-
- if (LogLevel > 1)
- {
- sm_syslog(LOG_CRIT, e->e_id,
- "%.100s: SMTP MAIL protocol error: %s",
- CurHostName,
- shortenstring(SmtpReplyBuffer, 403));
- }
-
- /* protocol error -- close up */
- mci_setstat(mci, EX_PROTOCOL, "5.5.1", SmtpReplyBuffer);
- smtpquit(m, mci, e);
- return EX_PROTOCOL;
-}
-\f/*
-** SMTPRCPT -- designate recipient.
-**
-** Parameters:
-** to -- address of recipient.
-** m -- the mailer we are sending to.
-** mci -- the connection info for this transaction.
-** e -- the envelope for this transaction.
-**
-** Returns:
-** exit status corresponding to recipient status.
-**
-** Side Effects:
-** Sends the mail via SMTP.
-*/
-
-int
-smtprcpt(to, m, mci, e)
- ADDRESS *to;
- register MAILER *m;
- MCI *mci;
- ENVELOPE *e;
-{
- register int r;
- char *bufp;
- char optbuf[MAXLINE];
-
- strcpy(optbuf, "");
- bufp = &optbuf[strlen(optbuf)];
- if (bitset(MCIF_DSN, mci->mci_flags))
- {
- /* NOTIFY= parameter */
- if (bitset(QHASNOTIFY, to->q_flags) &&
- bitset(QPRIMARY, to->q_flags) &&
- !bitnset(M_LOCALMAILER, m->m_flags))
- {
- bool firstone = TRUE;
-
- strcat(bufp, " NOTIFY=");
- if (bitset(QPINGONSUCCESS, to->q_flags))
- {
- strcat(bufp, "SUCCESS");
- firstone = FALSE;
- }
- if (bitset(QPINGONFAILURE, to->q_flags))
- {
- if (!firstone)
- strcat(bufp, ",");
- strcat(bufp, "FAILURE");
- firstone = FALSE;
- }
- if (bitset(QPINGONDELAY, to->q_flags))
- {
- if (!firstone)
- strcat(bufp, ",");
- strcat(bufp, "DELAY");
- firstone = FALSE;
- }
- if (firstone)
- strcat(bufp, "NEVER");
- bufp += strlen(bufp);
- }
-
- /* ORCPT= parameter */
- if (to->q_orcpt != NULL &&
- SPACELEFT(optbuf, bufp) > strlen(to->q_orcpt) + 7)
- {
- snprintf(bufp, SPACELEFT(optbuf, bufp),
- " ORCPT=%s", to->q_orcpt);
- bufp += strlen(bufp);
- }
- }
-
- smtpmessage("RCPT To:<%s>%s", m, mci, to->q_user, optbuf);
-
- SmtpPhase = mci->mci_phase = "client RCPT";
- sm_setproctitle(TRUE, "%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
- r = reply(m, mci, e, TimeOuts.to_rcpt, NULL);
- to->q_rstatus = newstr(SmtpReplyBuffer);
- to->q_status = smtptodsn(r);
- to->q_statmta = mci->mci_host;
- if (r < 0 || REPLYTYPE(r) == 4)
- return EX_TEMPFAIL;
- else if (REPLYTYPE(r) == 2)
- return EX_OK;
- else if (r == 550)
- {
- to->q_status = "5.1.1";
- return EX_NOUSER;
- }
- else if (r == 551)
- {
- to->q_status = "5.1.6";
- return EX_NOUSER;
- }
- else if (r == 553)
- {
- to->q_status = "5.1.3";
- return EX_NOUSER;
- }
- else if (REPLYTYPE(r) == 5)
- {
- return EX_UNAVAILABLE;
- }
-
- if (LogLevel > 1)
- {
- sm_syslog(LOG_CRIT, e->e_id,
- "%.100s: SMTP RCPT protocol error: %s",
- CurHostName,
- shortenstring(SmtpReplyBuffer, 403));
- }
-
- mci_setstat(mci, EX_PROTOCOL, "5.5.1", SmtpReplyBuffer);
- return EX_PROTOCOL;
-}
-\f/*
-** SMTPDATA -- send the data and clean up the transaction.
-**
-** Parameters:
-** m -- mailer being sent to.
-** mci -- the mailer connection information.
-** e -- the envelope for this message.
-**
-** Returns:
-** exit status corresponding to DATA command.
-**
-** Side Effects:
-** none.
-*/
-
-static jmp_buf CtxDataTimeout;
-static void datatimeout __P((void));
-
-int
-smtpdata(m, mci, e)
- MAILER *m;
- register MCI *mci;
- register ENVELOPE *e;
-{
- register int r;
- register EVENT *ev;
- int rstat;
- int xstat;
- time_t timeout;
-
- /*
- ** Send the data.
- ** First send the command and check that it is ok.
- ** Then send the data.
- ** Follow it up with a dot to terminate.
- ** Finally get the results of the transaction.
- */
-
- /* send the command and check ok to proceed */
- smtpmessage("DATA", m, mci);
- SmtpPhase = mci->mci_phase = "client DATA 354";
- sm_setproctitle(TRUE, "%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
- r = reply(m, mci, e, TimeOuts.to_datainit, NULL);
- if (r < 0 || REPLYTYPE(r) == 4)
- {
- smtpquit(m, mci, e);
- return EX_TEMPFAIL;
- }
- else if (REPLYTYPE(r) == 5)
- {
- smtprset(m, mci, e);
- return EX_UNAVAILABLE;
- }
- else if (REPLYTYPE(r) != 3)
- {
- if (LogLevel > 1)
- {
- sm_syslog(LOG_CRIT, e->e_id,
- "%.100s: SMTP DATA-1 protocol error: %s",
- CurHostName,
- shortenstring(SmtpReplyBuffer, 403));
- }
- smtprset(m, mci, e);
- mci_setstat(mci, EX_PROTOCOL, "5.5.1", SmtpReplyBuffer);
- return (EX_PROTOCOL);
- }
-
- /*
- ** Set timeout around data writes. Make it at least large
- ** enough for DNS timeouts on all recipients plus some fudge
- ** factor. The main thing is that it should not be infinite.
- */
-
- if (setjmp(CtxDataTimeout) != 0)
- {
- mci->mci_errno = errno;
- mci->mci_state = MCIS_ERROR;
- mci_setstat(mci, EX_TEMPFAIL, "4.4.2", NULL);
- syserr("451 timeout writing message to %s", CurHostName);
- smtpquit(m, mci, e);
- return EX_TEMPFAIL;
- }
-
- timeout = e->e_msgsize / 16;
- if (timeout < (time_t) 600)
- timeout = (time_t) 600;
- timeout += e->e_nrcpts * 300;
- ev = setevent(timeout, datatimeout, 0);
-
- /*
- ** Output the actual message.
- */
-
- (*e->e_puthdr)(mci, e->e_header, e, M87F_OUTER);
- (*e->e_putbody)(mci, e, NULL);
-
- /*
- ** Cleanup after sending message.
- */
-
- clrevent(ev);
-
- if (ferror(mci->mci_out))
- {
- /* error during processing -- don't send the dot */
- mci->mci_errno = EIO;
- mci->mci_state = MCIS_ERROR;
- mci_setstat(mci, EX_IOERR, "4.4.2", NULL);
- smtpquit(m, mci, e);
- return EX_IOERR;
- }
-
- /* terminate the message */
- fprintf(mci->mci_out, ".%s", m->m_eol);
- if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d >>> .\n", (int) getpid());
- if (Verbose)
- nmessage(">>> .");
-
- /* check for the results of the transaction */
- SmtpPhase = mci->mci_phase = "client DATA status";
- sm_setproctitle(TRUE, "%s %s: %s", e->e_id, CurHostName, mci->mci_phase);
- if (bitnset(M_LMTP, m->m_flags))
- return EX_OK;
- r = reply(m, mci, e, TimeOuts.to_datafinal, NULL);
- if (r < 0)
- {
- smtpquit(m, mci, e);
- return EX_TEMPFAIL;
- }
- mci->mci_state = MCIS_OPEN;
- xstat = EX_NOTSTICKY;
- if (r == 452)
- rstat = EX_TEMPFAIL;
- else if (REPLYTYPE(r) == 4)
- rstat = xstat = EX_TEMPFAIL;
- else if (REPLYCLASS(r) != 5)
- rstat = xstat = EX_PROTOCOL;
- else if (REPLYTYPE(r) == 2)
- rstat = xstat = EX_OK;
- else if (REPLYTYPE(r) == 5)
- rstat = EX_UNAVAILABLE;
- else
- rstat = EX_PROTOCOL;
- mci_setstat(mci, xstat, smtptodsn(r), SmtpReplyBuffer);
- if (e->e_statmsg != NULL)
- free(e->e_statmsg);
- e->e_statmsg = newstr(&SmtpReplyBuffer[4]);
- if (rstat != EX_PROTOCOL)
- return rstat;
- if (LogLevel > 1)
- {
- sm_syslog(LOG_CRIT, e->e_id,
- "%.100s: SMTP DATA-2 protocol error: %s",
- CurHostName,
- shortenstring(SmtpReplyBuffer, 403));
- }
- return rstat;
-}
-
-
-static void
-datatimeout()
-{
- longjmp(CtxDataTimeout, 1);
-}
-\f/*
-** SMTPGETSTAT -- get status code from DATA in LMTP
-**
-** Parameters:
-** m -- the mailer to which we are sending the message.
-** mci -- the mailer connection structure.
-** e -- the current envelope.
-**
-** Returns:
-** The exit status corresponding to the reply code.
-*/
-
-int
-smtpgetstat(m, mci, e)
- MAILER *m;
- MCI *mci;
- ENVELOPE *e;
-{
- int r;
- int stat;
-
- /* check for the results of the transaction */
- r = reply(m, mci, e, TimeOuts.to_datafinal, NULL);
- if (r < 0)
- {
- smtpquit(m, mci, e);
- return EX_TEMPFAIL;
- }
- if (e->e_statmsg != NULL)
- free(e->e_statmsg);
- e->e_statmsg = newstr(&SmtpReplyBuffer[4]);
- if (REPLYTYPE(r) == 4)
- stat = EX_TEMPFAIL;
- else if (REPLYCLASS(r) != 5)
- stat = EX_PROTOCOL;
- else if (REPLYTYPE(r) == 2)
- stat = EX_OK;
- else if (REPLYTYPE(r) == 5)
- stat = EX_UNAVAILABLE;
- else
- stat = EX_PROTOCOL;
- mci_setstat(mci, stat, smtptodsn(r), SmtpReplyBuffer);
- if (LogLevel > 1 && stat == EX_PROTOCOL)
- {
- sm_syslog(LOG_CRIT, e->e_id,
- "%.100s: SMTP DATA-3 protocol error: %s",
- CurHostName,
- shortenstring(SmtpReplyBuffer, 403));
- }
- return stat;
-}
-\f/*
-** SMTPQUIT -- close the SMTP connection.
-**
-** Parameters:
-** m -- a pointer to the mailer.
-** mci -- the mailer connection information.
-** e -- the current envelope.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** sends the final protocol and closes the connection.
-*/
-
-void
-smtpquit(m, mci, e)
- register MAILER *m;
- register MCI *mci;
- ENVELOPE *e;
-{
- bool oldSuprErrs = SuprErrs;
-
- /*
- ** Suppress errors here -- we may be processing a different
- ** job when we do the quit connection, and we don't want the
- ** new job to be penalized for something that isn't it's
- ** problem.
- */
-
- SuprErrs = TRUE;
-
- /* send the quit message if we haven't gotten I/O error */
- if (mci->mci_state != MCIS_ERROR)
- {
- SmtpPhase = "client QUIT";
- smtpmessage("QUIT", m, mci);
- (void) reply(m, mci, e, TimeOuts.to_quit, NULL);
- SuprErrs = oldSuprErrs;
- if (mci->mci_state == MCIS_CLOSED)
- return;
- }
-
- /* now actually close the connection and pick up the zombie */
- (void) endmailer(mci, e, NULL);
-
- SuprErrs = oldSuprErrs;
-}
-\f/*
-** SMTPRSET -- send a RSET (reset) command
-*/
-
-void
-smtprset(m, mci, e)
- register MAILER *m;
- register MCI *mci;
- ENVELOPE *e;
-{
- int r;
-
- SmtpPhase = "client RSET";
- smtpmessage("RSET", m, mci);
- r = reply(m, mci, e, TimeOuts.to_rset, NULL);
- if (r < 0)
- mci->mci_state = MCIS_ERROR;
- else if (REPLYTYPE(r) == 2)
- {
- mci->mci_state = MCIS_OPEN;
- return;
- }
- smtpquit(m, mci, e);
-}
-\f/*
-** SMTPPROBE -- check the connection state
-*/
-
-int
-smtpprobe(mci)
- register MCI *mci;
-{
- int r;
- MAILER *m = mci->mci_mailer;
- extern ENVELOPE BlankEnvelope;
- ENVELOPE *e = &BlankEnvelope;
-
- SmtpPhase = "client probe";
- smtpmessage("RSET", m, mci);
- r = reply(m, mci, e, TimeOuts.to_miscshort, NULL);
- if (r < 0 || REPLYTYPE(r) != 2)
- smtpquit(m, mci, e);
- return r;
-}
-\f/*
-** REPLY -- read arpanet reply
-**
-** Parameters:
-** m -- the mailer we are reading the reply from.
-** mci -- the mailer connection info structure.
-** e -- the current envelope.
-** timeout -- the timeout for reads.
-** pfunc -- processing function called on each line of response.
-** If null, no special processing is done.
-**
-** Returns:
-** reply code it reads.
-**
-** Side Effects:
-** flushes the mail file.
-*/
-
-int
-reply(m, mci, e, timeout, pfunc)
- MAILER *m;
- MCI *mci;
- ENVELOPE *e;
- time_t timeout;
- void (*pfunc)();
-{
- register char *bufp;
- register int r;
- bool firstline = TRUE;
- char junkbuf[MAXLINE];
-
- if (mci->mci_out != NULL)
- (void) fflush(mci->mci_out);
-
- if (tTd(18, 1))
- printf("reply\n");
-
- /*
- ** Read the input line, being careful not to hang.
- */
-
- bufp = SmtpReplyBuffer;
- for (;;)
- {
- register char *p;
-
- /* actually do the read */
- if (e->e_xfp != NULL)
- (void) fflush(e->e_xfp); /* for debugging */
-
- /* if we are in the process of closing just give the code */
- if (mci->mci_state == MCIS_CLOSED)
- return (SMTPCLOSING);
-
- if (mci->mci_out != NULL)
- fflush(mci->mci_out);
-
- /* get the line from the other side */
- p = sfgets(bufp, MAXLINE, mci->mci_in, timeout, SmtpPhase);
- mci->mci_lastuse = curtime();
-
- if (p == NULL)
- {
- bool oldholderrs;
- extern char MsgBuf[];
-
- /* if the remote end closed early, fake an error */
- if (errno == 0)
-# ifdef ECONNRESET
- errno = ECONNRESET;
-# else /* ECONNRESET */
- errno = EPIPE;
-# endif /* ECONNRESET */
-
- mci->mci_errno = errno;
- oldholderrs = HoldErrs;
- HoldErrs = TRUE;
- usrerr("451 reply: read error from %s", CurHostName);
-
- /* errors on QUIT should not be persistent */
- if (strncmp(SmtpMsgBuffer, "QUIT", 4) != 0)
- mci_setstat(mci, EX_TEMPFAIL, "4.4.2", MsgBuf);
-
- /* if debugging, pause so we can see state */
- if (tTd(18, 100))
- pause();
- mci->mci_state = MCIS_ERROR;
- smtpquit(m, mci, e);
-#if XDEBUG
- {
- char wbuf[MAXLINE];
- char *p = wbuf;
- int wbufleft = sizeof wbuf;
-
- if (e->e_to != NULL)
- {
- int plen;
-
- snprintf(p, wbufleft, "%s... ",
- shortenstring(e->e_to, MAXSHORTSTR));
- plen = strlen(p);
- p += plen;
- wbufleft -= plen;
- }
- snprintf(p, wbufleft, "reply(%.100s) during %s",
- CurHostName == NULL ? "NO_HOST" : CurHostName,
- SmtpPhase);
- checkfd012(wbuf);
- }
-#endif
- HoldErrs = oldholderrs;
- return (-1);
- }
- fixcrlf(bufp, TRUE);
-
- /* EHLO failure is not a real error */
- if (e->e_xfp != NULL && (bufp[0] == '4' ||
- (bufp[0] == '5' && strncmp(SmtpMsgBuffer, "EHLO", 4) != 0)))
- {
- /* serious error -- log the previous command */
- if (SmtpNeedIntro)
- {
- /* inform user who we are chatting with */
- fprintf(CurEnv->e_xfp,
- "... while talking to %s:\n",
- CurHostName);
- SmtpNeedIntro = FALSE;
- }
- if (SmtpMsgBuffer[0] != '\0')
- fprintf(e->e_xfp, ">>> %s\n", SmtpMsgBuffer);
- SmtpMsgBuffer[0] = '\0';
-
- /* now log the message as from the other side */
- fprintf(e->e_xfp, "<<< %s\n", bufp);
- }
-
- /* display the input for verbose mode */
- if (Verbose)
- nmessage("050 %s", bufp);
-
- /* ignore improperly formated input */
- if (!(isascii(bufp[0]) && isdigit(bufp[0])) ||
- !(isascii(bufp[1]) && isdigit(bufp[1])) ||
- !(isascii(bufp[2]) && isdigit(bufp[2])) ||
- !(bufp[3] == ' ' || bufp[3] == '-' || bufp[3] == '\0'))
- continue;
-
- /* process the line */
- if (pfunc != NULL)
- (*pfunc)(bufp, firstline, m, mci, e);
-
- firstline = FALSE;
-
- /* decode the reply code */
- r = atoi(bufp);
-
- /* extra semantics: 0xx codes are "informational" */
- if (r < 100)
- continue;
-
- /* if no continuation lines, return this line */
- if (bufp[3] != '-')
- break;
-
- /* first line of real reply -- ignore rest */
- bufp = junkbuf;
- }
-
- /*
- ** Now look at SmtpReplyBuffer -- only care about the first
- ** line of the response from here on out.
- */
-
- /* save temporary failure messages for posterity */
- if (SmtpReplyBuffer[0] == '4' &&
- (bitnset(M_LMTP, m->m_flags) || SmtpError[0] == '\0'))
- snprintf(SmtpError, sizeof SmtpError, "%s", SmtpReplyBuffer);
-
- /* reply code 421 is "Service Shutting Down" */
- if (r == SMTPCLOSING && mci->mci_state != MCIS_SSD)
- {
- /* send the quit protocol */
- mci->mci_state = MCIS_SSD;
- smtpquit(m, mci, e);
- }
-
- return (r);
-}
-\f/*
-** SMTPMESSAGE -- send message to server
-**
-** Parameters:
-** f -- format
-** m -- the mailer to control formatting.
-** a, b, c -- parameters
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** writes message to mci->mci_out.
-*/
-
-/*VARARGS1*/
-void
-#ifdef __STDC__
-smtpmessage(char *f, MAILER *m, MCI *mci, ...)
-#else
-smtpmessage(f, m, mci, va_alist)
- char *f;
- MAILER *m;
- MCI *mci;
- va_dcl
-#endif
-{
- VA_LOCAL_DECL
-
- VA_START(mci);
- (void) vsnprintf(SmtpMsgBuffer, sizeof SmtpMsgBuffer, f, ap);
- VA_END;
-
- if (tTd(18, 1) || Verbose)
- nmessage(">>> %s", SmtpMsgBuffer);
- if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d >>> %s\n",
- (int) getpid(), SmtpMsgBuffer);
- if (mci->mci_out != NULL)
- {
- fprintf(mci->mci_out, "%s%s", SmtpMsgBuffer,
- m == NULL ? "\r\n" : m->m_eol);
- }
- else if (tTd(18, 1))
- {
- printf("smtpmessage: NULL mci_out\n");
- }
-}
-
-# endif /* SMTP */
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983, 1995-1997 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)util.c 8.168 (Berkeley) 1/21/1999";
-#endif /* not lint */
-
-# include "sendmail.h"
-# include <sysexits.h>
-\f/*
-** STRIPQUOTES -- Strip quotes & quote bits from a string.
-**
-** Runs through a string and strips off unquoted quote
-** characters and quote bits. This is done in place.
-**
-** Parameters:
-** s -- the string to strip.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** none.
-**
-** Called By:
-** deliver
-*/
-
-void
-stripquotes(s)
- char *s;
-{
- register char *p;
- register char *q;
- register char c;
-
- if (s == NULL)
- return;
-
- p = q = s;
- do
- {
- c = *p++;
- if (c == '\\')
- c = *p++;
- else if (c == '"')
- continue;
- *q++ = c;
- } while (c != '\0');
-}
-\f/*
-** ADDQUOTES -- Adds quotes & quote bits to a string.
-**
-** Runs through a string and adds characters and quote bits.
-**
-** Parameters:
-** s -- the string to modify.
-**
-** Returns:
-** pointer to quoted string.
-**
-** Side Effects:
-** none.
-**
-*/
-
-char *
-addquotes(s)
- char *s;
-{
- int len = 0;
- char c;
- char *p = s, *q, *r;
-
- if (s == NULL)
- return NULL;
-
- /* Find length of quoted string */
- while ((c = *p++) != '\0')
- {
- len++;
- if (c == '\\' || c == '"')
- len++;
- }
-
- q = r = xalloc(len + 3);
- p = s;
-
- /* add leading quote */
- *q++ = '"';
- while ((c = *p++) != '\0')
- {
- /* quote \ or " */
- if (c == '\\' || c == '"')
- *q++ = '\\';
- *q++ = c;
- }
- *q++ = '"';
- *q = '\0';
- return r;
-}
-\f/*
-** RFC822_STRING -- Checks string for proper RFC822 string quoting.
-**
-** Runs through a string and verifies RFC822 special characters
-** are only found inside comments, quoted strings, or backslash
-** escaped. Also verified balanced quotes and parenthesis.
-**
-** Parameters:
-** s -- the string to modify.
-**
-** Returns:
-** TRUE -- if the string is RFC822 compliant.
-** FALSE -- if the string is not RFC822 compliant.
-**
-** Side Effects:
-** none.
-**
-*/
-
-bool
-rfc822_string(s)
- char *s;
-{
- bool quoted = FALSE;
- int commentlev = 0;
- char *c = s;
-
- if (s == NULL)
- return FALSE;
-
- while (*c != '\0')
- {
- /* escaped character */
- if (*c == '\\')
- {
- c++;
- if (*c == '\0')
- return FALSE;
- }
- else if (commentlev == 0 && *c == '"')
- quoted = !quoted;
- else if (!quoted)
- {
- if (*c == ')')
- {
- /* unbalanced ')' */
- if (commentlev == 0)
- return FALSE;
- else
- commentlev--;
- }
- else if (*c == '(')
- commentlev++;
- else if (commentlev == 0 &&
- strchr(MustQuoteChars, *c) != NULL)
- return FALSE;
- }
- c++;
- }
- /* unbalanced '"' or '(' */
- if (quoted || commentlev != 0)
- return FALSE;
- else
- return TRUE;
-}
-\f/*
-** SHORTEN_RFC822_STRING -- Truncate and rebalance an RFC822 string
-**
-** Arbitratily shorten (in place) an RFC822 string and rebalance
-** comments and quotes.
-**
-** Parameters:
-** string -- the string to shorten
-** length -- the maximum size, 0 if no maximum
-**
-** Returns:
-** TRUE if string is changed, FALSE otherwise
-**
-** Side Effects:
-** Changes string in place, possibly resulting
-** in a shorter string.
-*/
-
-bool
-shorten_rfc822_string(string, length)
- char *string;
- size_t length;
-{
- bool backslash = FALSE;
- bool modified = FALSE;
- bool quoted = FALSE;
- size_t slen;
- int parencount = 0;
- char *ptr = string;
-
- /*
- ** If have to rebalance an already short enough string,
- ** need to do it within allocated space.
- */
- slen = strlen(string);
- if (length == 0 || slen < length)
- length = slen;
-
- while (*ptr != '\0')
- {
- if (backslash)
- {
- backslash = FALSE;
- goto increment;
- }
-
- if (*ptr == '\\')
- backslash = TRUE;
- else if (*ptr == '(')
- {
- if (!quoted)
- parencount++;
- }
- else if (*ptr == ')')
- {
- if (--parencount < 0)
- parencount = 0;
- }
-
- /* Inside a comment, quotes don't matter */
- if (parencount <= 0 && *ptr == '"')
- quoted = !quoted;
-
-increment:
- /* Check for sufficient space for next character */
- if (length - (ptr - string) <= ((backslash ? 1 : 0) +
- parencount +
- (quoted ? 1 : 0)))
- {
- /* Not enough, backtrack */
- if (*ptr == '\\')
- backslash = FALSE;
- else if (*ptr == '(' && !quoted)
- parencount--;
- else if (*ptr == '"' && parencount == 0)
- quoted = FALSE;
- break;
- }
- ptr++;
- }
-
- /* Rebalance */
- while (parencount-- > 0)
- {
- if (*ptr != ')')
- {
- modified = TRUE;
- *ptr = ')';
- }
- ptr++;
- }
- if (quoted)
- {
- if (*ptr != '"')
- {
- modified = TRUE;
- *ptr = '"';
- }
- ptr++;
- }
- if (*ptr != '\0')
- {
- modified = TRUE;
- *ptr = '\0';
- }
- return modified;
-}
-\f/*
-** FIND_CHARACTER -- find an unquoted character in an RFC822 string
-**
-** Find an unquoted, non-commented character in an RFC822
-** string and return a pointer to its location in the
-** string.
-**
-** Parameters:
-** string -- the string to search
-** character -- the character to find
-**
-** Returns:
-** pointer to the character, or
-** a pointer to the end of the line if character is not found
-*/
-
-char *
-find_character(string, character)
- char *string;
- char character;
-{
- bool backslash = FALSE;
- bool quoted = FALSE;
- int parencount = 0;
-
- while (string != NULL && *string != '\0')
- {
- if (backslash)
- {
- backslash = FALSE;
- if (!quoted && character == '\\' && *string == '\\')
- break;
- string++;
- continue;
- }
- switch (*string)
- {
- case '\\':
- backslash = TRUE;
- break;
-
- case '(':
- if (!quoted)
- parencount++;
- break;
-
- case ')':
- if (--parencount < 0)
- parencount = 0;
- break;
- }
-
- /* Inside a comment, nothing matters */
- if (parencount > 0)
- {
- string++;
- continue;
- }
-
- if (*string == '"')
- quoted = !quoted;
- else if (*string == character && !quoted)
- break;
- string++;
- }
-
- /* Return pointer to the character */
- return string;
-}
-\f/*
-** XALLOC -- Allocate memory and bitch wildly on failure.
-**
-** THIS IS A CLUDGE. This should be made to give a proper
-** error -- but after all, what can we do?
-**
-** Parameters:
-** sz -- size of area to allocate.
-**
-** Returns:
-** pointer to data region.
-**
-** Side Effects:
-** Memory is allocated.
-*/
-
-char *
-xalloc(sz)
- register int sz;
-{
- register char *p;
-
- /* some systems can't handle size zero mallocs */
- if (sz <= 0)
- sz = 1;
-
- p = malloc((unsigned) sz);
- if (p == NULL)
- {
- syserr("!Out of memory!!");
- /* exit(EX_UNAVAILABLE); */
- }
- return (p);
-}
-\f/*
-** COPYPLIST -- copy list of pointers.
-**
-** This routine is the equivalent of newstr for lists of
-** pointers.
-**
-** Parameters:
-** list -- list of pointers to copy.
-** Must be NULL terminated.
-** copycont -- if TRUE, copy the contents of the vector
-** (which must be a string) also.
-**
-** Returns:
-** a copy of 'list'.
-**
-** Side Effects:
-** none.
-*/
-
-char **
-copyplist(list, copycont)
- char **list;
- bool copycont;
-{
- register char **vp;
- register char **newvp;
-
- for (vp = list; *vp != NULL; vp++)
- continue;
-
- vp++;
-
- newvp = (char **) xalloc((int) (vp - list) * sizeof *vp);
- bcopy((char *) list, (char *) newvp, (int) (vp - list) * sizeof *vp);
-
- if (copycont)
- {
- for (vp = newvp; *vp != NULL; vp++)
- *vp = newstr(*vp);
- }
-
- return (newvp);
-}
-\f/*
-** COPYQUEUE -- copy address queue.
-**
-** This routine is the equivalent of newstr for address queues
-** addresses marked with QDONTSEND aren't copied
-**
-** Parameters:
-** addr -- list of address structures to copy.
-**
-** Returns:
-** a copy of 'addr'.
-**
-** Side Effects:
-** none.
-*/
-
-ADDRESS *
-copyqueue(addr)
- ADDRESS *addr;
-{
- register ADDRESS *newaddr;
- ADDRESS *ret;
- register ADDRESS **tail = &ret;
-
- while (addr != NULL)
- {
- if (!bitset(QDONTSEND, addr->q_flags))
- {
- newaddr = (ADDRESS *) xalloc(sizeof(ADDRESS));
- STRUCTCOPY(*addr, *newaddr);
- *tail = newaddr;
- tail = &newaddr->q_next;
- }
- addr = addr->q_next;
- }
- *tail = NULL;
-
- return ret;
-}
-\f/*
-** PRINTAV -- print argument vector.
-**
-** Parameters:
-** av -- argument vector.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** prints av.
-*/
-
-void
-printav(av)
- register char **av;
-{
- while (*av != NULL)
- {
- if (tTd(0, 44))
- printf("\n\t%08lx=", (u_long) *av);
- else
- (void) putchar(' ');
- xputs(*av++);
- }
- (void) putchar('\n');
-}
-\f/*
-** LOWER -- turn letter into lower case.
-**
-** Parameters:
-** c -- character to turn into lower case.
-**
-** Returns:
-** c, in lower case.
-**
-** Side Effects:
-** none.
-*/
-
-char
-lower(c)
- register char c;
-{
- return((isascii(c) && isupper(c)) ? tolower(c) : c);
-}
-\f/*
-** XPUTS -- put string doing control escapes.
-**
-** Parameters:
-** s -- string to put.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** output to stdout
-*/
-
-void
-xputs(s)
- register const char *s;
-{
- register int c;
- register struct metamac *mp;
- bool shiftout = FALSE;
- extern struct metamac MetaMacros[];
-
- if (s == NULL)
- {
- printf("%s<null>%s", TermEscape.te_rv_on, TermEscape.te_rv_off);
- return;
- }
- while ((c = (*s++ & 0377)) != '\0')
- {
- if (shiftout)
- {
- printf("%s", TermEscape.te_rv_off);
- shiftout = FALSE;
- }
- if (!isascii(c))
- {
- if (c == MATCHREPL)
- {
- printf("%s$", TermEscape.te_rv_on);
- shiftout = TRUE;
- if (*s == '\0')
- continue;
- c = *s++ & 0377;
- goto printchar;
- }
- if (c == MACROEXPAND || c == MACRODEXPAND)
- {
- printf("%s$", TermEscape.te_rv_on);
- if (c == MACRODEXPAND)
- putchar('&');
- shiftout = TRUE;
- if (*s == '\0')
- continue;
- if (strchr("=~&?", *s) != NULL)
- putchar(*s++);
- if (bitset(0200, *s))
- printf("{%s}", macname(*s++ & 0377));
- else
- printf("%c", *s++);
- continue;
- }
- for (mp = MetaMacros; mp->metaname != '\0'; mp++)
- {
- if ((mp->metaval & 0377) == c)
- {
- printf("%s$%c",
- TermEscape.te_rv_on,
- mp->metaname);
- shiftout = TRUE;
- break;
- }
- }
- if (c == MATCHCLASS || c == MATCHNCLASS)
- {
- if (bitset(0200, *s))
- printf("{%s}", macname(*s++ & 0377));
- else if (*s != '\0')
- printf("%c", *s++);
- }
- if (mp->metaname != '\0')
- continue;
-
- /* unrecognized meta character */
- printf("%sM-", TermEscape.te_rv_on);
- shiftout = TRUE;
- c &= 0177;
- }
- printchar:
- if (isprint(c))
- {
- putchar(c);
- continue;
- }
-
- /* wasn't a meta-macro -- find another way to print it */
- switch (c)
- {
- case '\n':
- c = 'n';
- break;
-
- case '\r':
- c = 'r';
- break;
-
- case '\t':
- c = 't';
- break;
- }
- if (!shiftout)
- {
- printf("%s", TermEscape.te_rv_on);
- shiftout = TRUE;
- }
- if (isprint(c))
- {
- (void) putchar('\\');
- (void) putchar(c);
- }
- else
- {
- (void) putchar('^');
- (void) putchar(c ^ 0100);
- }
- }
- if (shiftout)
- printf("%s", TermEscape.te_rv_off);
- (void) fflush(stdout);
-}
-\f/*
-** MAKELOWER -- Translate a line into lower case
-**
-** Parameters:
-** p -- the string to translate. If NULL, return is
-** immediate.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** String pointed to by p is translated to lower case.
-**
-** Called By:
-** parse
-*/
-
-void
-makelower(p)
- register char *p;
-{
- register char c;
-
- if (p == NULL)
- return;
- for (; (c = *p) != '\0'; p++)
- if (isascii(c) && isupper(c))
- *p = tolower(c);
-}
-\f/*
-** BUILDFNAME -- build full name from gecos style entry.
-**
-** This routine interprets the strange entry that would appear
-** in the GECOS field of the password file.
-**
-** Parameters:
-** p -- name to build.
-** login -- the login name of this user (for &).
-** buf -- place to put the result.
-** buflen -- length of buf.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** none.
-*/
-
-void
-buildfname(gecos, login, buf, buflen)
- register char *gecos;
- char *login;
- char *buf;
- int buflen;
-{
- register char *p;
- register char *bp = buf;
-
- if (*gecos == '*')
- gecos++;
-
- /* copy gecos, interpolating & to be full name */
- for (p = gecos; *p != '\0' && *p != ',' && *p != ';' && *p != '%'; p++)
- {
- if (bp >= &buf[buflen - 1])
- {
- /* buffer overflow -- just use login name */
- snprintf(buf, buflen, "%s", login);
- return;
- }
- if (*p == '&')
- {
- /* interpolate full name */
- snprintf(bp, buflen - (bp - buf), "%s", login);
- *bp = toupper(*bp);
- bp += strlen(bp);
- }
- else
- *bp++ = *p;
- }
- *bp = '\0';
-}
-\f/*
-** FIXCRLF -- fix <CR><LF> in line.
-**
-** Looks for the <CR><LF> combination and turns it into the
-** UNIX canonical <NL> character. It only takes one line,
-** i.e., it is assumed that the first <NL> found is the end
-** of the line.
-**
-** Parameters:
-** line -- the line to fix.
-** stripnl -- if true, strip the newline also.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** line is changed in place.
-*/
-
-void
-fixcrlf(line, stripnl)
- char *line;
- bool stripnl;
-{
- register char *p;
-
- p = strchr(line, '\n');
- if (p == NULL)
- return;
- if (p > line && p[-1] == '\r')
- p--;
- if (!stripnl)
- *p++ = '\n';
- *p = '\0';
-}
-\f/*
-** PUTLINE -- put a line like fputs obeying SMTP conventions
-**
-** This routine always guarantees outputing a newline (or CRLF,
-** as appropriate) at the end of the string.
-**
-** Parameters:
-** l -- line to put.
-** mci -- the mailer connection information.
-**
-** Returns:
-** none
-**
-** Side Effects:
-** output of l to fp.
-*/
-
-void
-putline(l, mci)
- register char *l;
- register MCI *mci;
-{
- putxline(l, strlen(l), mci, PXLF_MAPFROM);
-}
-\f/*
-** PUTXLINE -- putline with flags bits.
-**
-** This routine always guarantees outputing a newline (or CRLF,
-** as appropriate) at the end of the string.
-**
-** Parameters:
-** l -- line to put.
-** len -- the length of the line.
-** mci -- the mailer connection information.
-** pxflags -- flag bits:
-** PXLF_MAPFROM -- map From_ to >From_.
-** PXLF_STRIP8BIT -- strip 8th bit.
-** PXLF_HEADER -- map bare newline in header to newline space.
-**
-** Returns:
-** none
-**
-** Side Effects:
-** output of l to fp.
-*/
-
-void
-putxline(l, len, mci, pxflags)
- register char *l;
- size_t len;
- register MCI *mci;
- int pxflags;
-{
- register char *p, *end;
- int slop = 0;
- size_t eol_len = strlen(mci->mci_mailer->m_eol);
-
- /* strip out 0200 bits -- these can look like TELNET protocol */
- if (bitset(MCIF_7BIT, mci->mci_flags) ||
- bitset(PXLF_STRIP8BIT, pxflags))
- {
- register char svchar;
-
- for (p = l; (svchar = *p) != '\0'; ++p)
- if (bitset(0200, svchar))
- *p = svchar &~ 0200;
- }
-
- end = l + len;
- do
- {
- /* find the end of the line */
- p = memchr(l, '\n', end - l);
- if (p == NULL)
- p = end;
-
- if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d >>> ", (int) getpid());
-
- /* check for line overflow */
- while (mci->mci_mailer->m_linelimit > 0 &&
- (p - l + slop) > mci->mci_mailer->m_linelimit)
- {
- char *l_base = l;
- register char *q = &l[mci->mci_mailer->m_linelimit - slop - 1];
-
- if (l[0] == '.' && slop == 0 &&
- bitnset(M_XDOT, mci->mci_mailer->m_flags))
- {
- (void) putc('.', mci->mci_out);
- if (!bitset(MCIF_INHEADER, mci->mci_flags))
- mci->mci_contentlen++;
- if (TrafficLogFile != NULL)
- (void) putc('.', TrafficLogFile);
- }
- else if (l[0] == 'F' && slop == 0 &&
- bitset(PXLF_MAPFROM, pxflags) &&
- strncmp(l, "From ", 5) == 0 &&
- bitnset(M_ESCFROM, mci->mci_mailer->m_flags))
- {
- (void) putc('>', mci->mci_out);
- if (!bitset(MCIF_INHEADER, mci->mci_flags))
- mci->mci_contentlen++;
- if (TrafficLogFile != NULL)
- (void) putc('>', TrafficLogFile);
- }
- while (l < q)
- {
- (void) putc(*l++, mci->mci_out);
- if (!bitset(MCIF_INHEADER, mci->mci_flags))
- mci->mci_contentlen++;
- }
- (void) putc('!', mci->mci_out);
- if (!bitset(MCIF_INHEADER, mci->mci_flags))
- mci->mci_contentlen++;
- fputs(mci->mci_mailer->m_eol, mci->mci_out);
- if (!bitset(MCIF_INHEADER, mci->mci_flags))
- mci->mci_contentlen += eol_len;
- (void) putc(' ', mci->mci_out);
- if (!bitset(MCIF_INHEADER, mci->mci_flags))
- mci->mci_contentlen++;
- if (TrafficLogFile != NULL)
- {
- for (l = l_base; l < q; l++)
- (void) putc(*l, TrafficLogFile);
- fprintf(TrafficLogFile, "!\n%05d >>> ",
- (int) getpid());
- }
- slop = 1;
- }
-
- /* output last part */
- if (l[0] == '.' && slop == 0 &&
- bitnset(M_XDOT, mci->mci_mailer->m_flags))
- {
- (void) putc('.', mci->mci_out);
- if (!bitset(MCIF_INHEADER, mci->mci_flags))
- mci->mci_contentlen++;
- if (TrafficLogFile != NULL)
- (void) putc('.', TrafficLogFile);
- }
- else if (l[0] == 'F' && slop == 0 &&
- bitset(PXLF_MAPFROM, pxflags) &&
- strncmp(l, "From ", 5) == 0 &&
- bitnset(M_ESCFROM, mci->mci_mailer->m_flags))
- {
- (void) putc('>', mci->mci_out);
- if (!bitset(MCIF_INHEADER, mci->mci_flags))
- mci->mci_contentlen++;
- if (TrafficLogFile != NULL)
- (void) putc('>', TrafficLogFile);
- }
- for ( ; l < p; ++l)
- {
- if (TrafficLogFile != NULL)
- (void) putc(*l, TrafficLogFile);
- (void) putc(*l, mci->mci_out);
- if (!bitset(MCIF_INHEADER, mci->mci_flags))
- mci->mci_contentlen++;
- }
- if (TrafficLogFile != NULL)
- (void) putc('\n', TrafficLogFile);
- fputs(mci->mci_mailer->m_eol, mci->mci_out);
- if (!bitset(MCIF_INHEADER, mci->mci_flags))
- mci->mci_contentlen += eol_len;
- if (l < end && *l == '\n')
- {
- if (*++l != ' ' && *l != '\t' && *l != '\0' &&
- bitset(PXLF_HEADER, pxflags))
- {
- (void) putc(' ', mci->mci_out);
- if (!bitset(MCIF_INHEADER, mci->mci_flags))
- mci->mci_contentlen++;
- if (TrafficLogFile != NULL)
- (void) putc(' ', TrafficLogFile);
- }
- }
- } while (l < end);
-}
-\f/*
-** XUNLINK -- unlink a file, doing logging as appropriate.
-**
-** Parameters:
-** f -- name of file to unlink.
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** f is unlinked.
-*/
-
-void
-xunlink(f)
- char *f;
-{
- register int i;
-
- if (LogLevel > 98)
- sm_syslog(LOG_DEBUG, CurEnv->e_id,
- "unlink %s",
- f);
-
- i = unlink(f);
- if (i < 0 && LogLevel > 97)
- sm_syslog(LOG_DEBUG, CurEnv->e_id,
- "%s: unlink-fail %d",
- f, errno);
-}
-\f/*
-** XFCLOSE -- close a file, doing logging as appropriate.
-**
-** Parameters:
-** fp -- file pointer for the file to close
-** a, b -- miscellaneous crud to print for debugging
-**
-** Returns:
-** none.
-**
-** Side Effects:
-** fp is closed.
-*/
-
-void
-xfclose(fp, a, b)
- FILE *fp;
- char *a, *b;
-{
- if (tTd(53, 99))
- printf("xfclose(%lx) %s %s\n", (u_long) fp, a, b);
-#if XDEBUG
- if (fileno(fp) == 1)
- syserr("xfclose(%s %s): fd = 1", a, b);
-#endif
- if (fclose(fp) < 0 && tTd(53, 99))
- printf("xfclose FAILURE: %s\n", errstring(errno));
-}
-\f/*
-** SFGETS -- "safe" fgets -- times out and ignores random interrupts.
-**
-** Parameters:
-** buf -- place to put the input line.
-** siz -- size of buf.
-** fp -- file to read from.
-** timeout -- the timeout before error occurs.
-** during -- what we are trying to read (for error messages).
-**
-** Returns:
-** NULL on error (including timeout). This will also leave
-** buf containing a null string.
-** buf otherwise.
-**
-** Side Effects:
-** none.
-*/
-
-static jmp_buf CtxReadTimeout;
-static void readtimeout __P((time_t));
-
-char *
-sfgets(buf, siz, fp, timeout, during)
- char *buf;
- int siz;
- FILE *fp;
- time_t timeout;
- char *during;
-{
- register EVENT *ev = NULL;
- register char *p;
- int save_errno;
-
- if (fp == NULL)
- {
- buf[0] = '\0';
- return NULL;
- }
-
- /* set the timeout */
- if (timeout != 0)
- {
- if (setjmp(CtxReadTimeout) != 0)
- {
- if (LogLevel > 1)
- sm_syslog(LOG_NOTICE, CurEnv->e_id,
- "timeout waiting for input from %.100s during %s",
- CurHostName ? CurHostName : "local",
- during);
- buf[0] = '\0';
-#if XDEBUG
- checkfd012(during);
-#endif
- if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d <<< [TIMEOUT]\n",
- (int) getpid());
- errno = 0;
- return (NULL);
- }
- ev = setevent(timeout, readtimeout, 0);
- }
-
- /* try to read */
- p = NULL;
- errno = 0;
- while (!feof(fp) && !ferror(fp))
- {
- errno = 0;
- p = fgets(buf, siz, fp);
- if (p != NULL || errno != EINTR)
- break;
- clearerr(fp);
- }
- save_errno = errno;
-
- /* clear the event if it has not sprung */
- clrevent(ev);
-
- /* clean up the books and exit */
- LineNumber++;
- if (p == NULL)
- {
- buf[0] = '\0';
- if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d <<< [EOF]\n", (int) getpid());
- errno = save_errno;
- return (NULL);
- }
- if (TrafficLogFile != NULL)
- fprintf(TrafficLogFile, "%05d <<< %s", (int) getpid(), buf);
- if (SevenBitInput)
- {
- for (p = buf; *p != '\0'; p++)
- *p &= ~0200;
- }
- else if (!HasEightBits)
- {
- for (p = buf; *p != '\0'; p++)
- {
- if (bitset(0200, *p))
- {
- HasEightBits = TRUE;
- break;
- }
- }
- }
- return (buf);
-}
-
-/* ARGSUSED */
-static void
-readtimeout(timeout)
- time_t timeout;
-{
- longjmp(CtxReadTimeout, 1);
-}
-\f/*
-** FGETFOLDED -- like fgets, but know about folded lines.
-**
-** Parameters:
-** buf -- place to put result.
-** n -- bytes available.
-** f -- file to read from.
-**
-** Returns:
-** input line(s) on success, NULL on error or EOF.
-** This will normally be buf -- unless the line is too
-** long, when it will be xalloc()ed.
-**
-** Side Effects:
-** buf gets lines from f, with continuation lines (lines
-** with leading white space) appended. CRLF's are mapped
-** into single newlines. Any trailing NL is stripped.
-*/
-
-char *
-fgetfolded(buf, n, f)
- char *buf;
- register int n;
- FILE *f;
-{
- register char *p = buf;
- char *bp = buf;
- register int i;
-
- n--;
- while ((i = getc(f)) != EOF)
- {
- if (i == '\r')
- {
- i = getc(f);
- if (i != '\n')
- {
- if (i != EOF)
- (void) ungetc(i, f);
- i = '\r';
- }
- }
- if (--n <= 0)
- {
- /* allocate new space */
- char *nbp;
- int nn;
-
- nn = (p - bp);
- if (nn < MEMCHUNKSIZE)
- nn *= 2;
- else
- nn += MEMCHUNKSIZE;
- nbp = xalloc(nn);
- bcopy(bp, nbp, p - bp);
- p = &nbp[p - bp];
- if (bp != buf)
- free(bp);
- bp = nbp;
- n = nn - (p - bp);
- }
- *p++ = i;
- if (i == '\n')
- {
- LineNumber++;
- i = getc(f);
- if (i != EOF)
- (void) ungetc(i, f);
- if (i != ' ' && i != '\t')
- break;
- }
- }
- if (p == bp)
- return (NULL);
- if (p[-1] == '\n')
- p--;
- *p = '\0';
- return (bp);
-}
-\f/*
-** CURTIME -- return current time.
-**
-** Parameters:
-** none.
-**
-** Returns:
-** the current time.
-**
-** Side Effects:
-** none.
-*/
-
-time_t
-curtime()
-{
- auto time_t t;
-
- (void) time(&t);
- return (t);
-}
-\f/*
-** ATOBOOL -- convert a string representation to boolean.
-**
-** Defaults to "TRUE"
-**
-** Parameters:
-** s -- string to convert. Takes "tTyY" as true,
-** others as false.
-**
-** Returns:
-** A boolean representation of the string.
-**
-** Side Effects:
-** none.
-*/
-
-bool
-atobool(s)
- register char *s;
-{
- if (s == NULL || *s == '\0' || strchr("tTyY", *s) != NULL)
- return (TRUE);
- return (FALSE);
-}
-\f/*
-** ATOOCT -- convert a string representation to octal.
-**
-** Parameters:
-** s -- string to convert.
-**
-** Returns:
-** An integer representing the string interpreted as an
-** octal number.
-**
-** Side Effects:
-** none.
-*/
-
-int
-atooct(s)
- register char *s;
-{
- register int i = 0;
-
- while (*s >= '0' && *s <= '7')
- i = (i << 3) | (*s++ - '0');
- return (i);
-}
-\f/*
-** BITINTERSECT -- tell if two bitmaps intersect
-**
-** Parameters:
-** a, b -- the bitmaps in question
-**
-** Returns:
-** TRUE if they have a non-null intersection
-** FALSE otherwise
-**
-** Side Effects:
-** none.
-*/
-
-bool
-bitintersect(a, b)
- BITMAP a;
- BITMAP b;
-{
- int i;
-
- for (i = BITMAPBYTES / sizeof (int); --i >= 0; )
- if ((a[i] & b[i]) != 0)
- return (TRUE);
- return (FALSE);
-}
-\f/*
-** BITZEROP -- tell if a bitmap is all zero
-**
-** Parameters:
-** map -- the bit map to check
-**
-** Returns:
-** TRUE if map is all zero.
-** FALSE if there are any bits set in map.
-**
-** Side Effects:
-** none.
-*/
-
-bool
-bitzerop(map)
- BITMAP map;
-{
- int i;
-
- for (i = BITMAPBYTES / sizeof (int); --i >= 0; )
- if (map[i] != 0)
- return (FALSE);
- return (TRUE);
-}
-\f/*
-** STRCONTAINEDIN -- tell if one string is contained in another
-**
-** Parameters:
-** a -- possible substring.
-** b -- possible superstring.
-**
-** Returns:
-** TRUE if a is contained in b.
-** FALSE otherwise.
-*/
-
-bool
-strcontainedin(a, b)
- register char *a;
- register char *b;
-{
- int la;
- int lb;
- int c;
-
- la = strlen(a);
- lb = strlen(b);
- c = *a;
- if (isascii(c) && isupper(c))
- c = tolower(c);
- for (; lb-- >= la; b++)
- {
- if (*b != c && isascii(*b) && isupper(*b) && tolower(*b) != c)
- continue;
- if (strncasecmp(a, b, la) == 0)
- return TRUE;
- }
- return FALSE;
-}
-\f/*
-** CHECKFD012 -- check low numbered file descriptors
-**
-** File descriptors 0, 1, and 2 should be open at all times.
-** This routine verifies that, and fixes it if not true.
-**
-** Parameters:
-** where -- a tag printed if the assertion failed
-**
-** Returns:
-** none
-*/
-
-void
-checkfd012(where)
- char *where;
-{
-#if XDEBUG
- register int i;
-
- for (i = 0; i < 3; i++)
- fill_fd(i, where);
-#endif /* XDEBUG */
-}
-\f/*
-** CHECKFDOPEN -- make sure file descriptor is open -- for extended debugging
-**
-** Parameters:
-** fd -- file descriptor to check.
-** where -- tag to print on failure.
-**
-** Returns:
-** none.
-*/
-
-void
-checkfdopen(fd, where)
- int fd;
- char *where;
-{
-#if XDEBUG
- struct stat st;
-
- if (fstat(fd, &st) < 0 && errno == EBADF)
- {
- syserr("checkfdopen(%d): %s not open as expected!", fd, where);
- printopenfds(TRUE);
- }
-#endif
-}
-\f/*
-** CHECKFDS -- check for new or missing file descriptors
-**
-** Parameters:
-** where -- tag for printing. If null, take a base line.
-**
-** Returns:
-** none
-**
-** Side Effects:
-** If where is set, shows changes since the last call.
-*/
-
-void
-checkfds(where)
- char *where;
-{
- int maxfd;
- register int fd;
- bool printhdr = TRUE;
- int save_errno = errno;
- static BITMAP baseline;
- extern int DtableSize;
-
- if (DtableSize > 256)
- maxfd = 256;
- else
- maxfd = DtableSize;
- if (where == NULL)
- clrbitmap(baseline);
-
- for (fd = 0; fd < maxfd; fd++)
- {
- struct stat stbuf;
-
- if (fstat(fd, &stbuf) < 0 && errno != EOPNOTSUPP)
- {
- if (!bitnset(fd, baseline))
- continue;
- clrbitn(fd, baseline);
- }
- else if (!bitnset(fd, baseline))
- setbitn(fd, baseline);
- else
- continue;
-
- /* file state has changed */
- if (where == NULL)
- continue;
- if (printhdr)
- {
- sm_syslog(LOG_DEBUG, CurEnv->e_id,
- "%s: changed fds:",
- where);
- printhdr = FALSE;
- }
- dumpfd(fd, TRUE, TRUE);
- }
- errno = save_errno;
-}
-\f/*
-** PRINTOPENFDS -- print the open file descriptors (for debugging)
-**
-** Parameters:
-** logit -- if set, send output to syslog; otherwise
-** print for debugging.
-**
-** Returns:
-** none.
-*/
-
-#include <arpa/inet.h>
-
-void
-printopenfds(logit)
- bool logit;
-{
- register int fd;
- extern int DtableSize;
-
- for (fd = 0; fd < DtableSize; fd++)
- dumpfd(fd, FALSE, logit);
-}
-\f/*
-** DUMPFD -- dump a file descriptor
-**
-** Parameters:
-** fd -- the file descriptor to dump.
-** printclosed -- if set, print a notification even if
-** it is closed; otherwise print nothing.
-** logit -- if set, send output to syslog instead of stdout.
-*/
-
-void
-dumpfd(fd, printclosed, logit)
- int fd;
- bool printclosed;
- bool logit;
-{
- register char *p;
- char *hp;
-#ifdef S_IFSOCK
- SOCKADDR sa;
-#endif
- auto SOCKADDR_LEN_T slen;
- int i;
-#if STAT64 > 0
- struct stat64 st;
-#else
- struct stat st;
-#endif
- char buf[200];
-
- p = buf;
- snprintf(p, SPACELEFT(buf, p), "%3d: ", fd);
- p += strlen(p);
-
- if (
-#if STAT64 > 0
- fstat64(fd, &st)
-#else
- fstat(fd, &st)
-#endif
- < 0)
- {
- if (errno != EBADF)
- {
- snprintf(p, SPACELEFT(buf, p), "CANNOT STAT (%s)",
- errstring(errno));
- goto printit;
- }
- else if (printclosed)
- {
- snprintf(p, SPACELEFT(buf, p), "CLOSED");
- goto printit;
- }
- return;
- }
-
- i = fcntl(fd, F_GETFL, NULL);
- if (i != -1)
- {
- snprintf(p, SPACELEFT(buf, p), "fl=0x%x, ", i);
- p += strlen(p);
- }
-
- snprintf(p, SPACELEFT(buf, p), "mode=%o: ", st.st_mode);
- p += strlen(p);
- switch (st.st_mode & S_IFMT)
- {
-#ifdef S_IFSOCK
- case S_IFSOCK:
- snprintf(p, SPACELEFT(buf, p), "SOCK ");
- p += strlen(p);
- slen = sizeof sa;
- if (getsockname(fd, &sa.sa, &slen) < 0)
- snprintf(p, SPACELEFT(buf, p), "(%s)", errstring(errno));
- else
- {
- hp = hostnamebyanyaddr(&sa);
- if (sa.sa.sa_family == AF_INET)
- snprintf(p, SPACELEFT(buf, p), "%s/%d",
- hp, ntohs(sa.sin.sin_port));
- else
- snprintf(p, SPACELEFT(buf, p), "%s", hp);
- }
- p += strlen(p);
- snprintf(p, SPACELEFT(buf, p), "->");
- p += strlen(p);
- slen = sizeof sa;
- if (getpeername(fd, &sa.sa, &slen) < 0)
- snprintf(p, SPACELEFT(buf, p), "(%s)", errstring(errno));
- else
- {
- hp = hostnamebyanyaddr(&sa);
- if (sa.sa.sa_family == AF_INET)
- snprintf(p, SPACELEFT(buf, p), "%s/%d",
- hp, ntohs(sa.sin.sin_port));
- else
- snprintf(p, SPACELEFT(buf, p), "%s", hp);
- }
- break;
-#endif
-
- case S_IFCHR:
- snprintf(p, SPACELEFT(buf, p), "CHR: ");
- p += strlen(p);
- goto defprint;
-
- case S_IFBLK:
- snprintf(p, SPACELEFT(buf, p), "BLK: ");
- p += strlen(p);
- goto defprint;
-
-#if defined(S_IFIFO) && (!defined(S_IFSOCK) || S_IFIFO != S_IFSOCK)
- case S_IFIFO:
- snprintf(p, SPACELEFT(buf, p), "FIFO: ");
- p += strlen(p);
- goto defprint;
-#endif
-
-#ifdef S_IFDIR
- case S_IFDIR:
- snprintf(p, SPACELEFT(buf, p), "DIR: ");
- p += strlen(p);
- goto defprint;
-#endif
-
-#ifdef S_IFLNK
- case S_IFLNK:
- snprintf(p, SPACELEFT(buf, p), "LNK: ");
- p += strlen(p);
- goto defprint;
-#endif
-
- default:
-defprint:
- if (sizeof st.st_ino > sizeof (long))
- snprintf(p, SPACELEFT(buf, p),
- "dev=%d/%d, ino=%s, nlink=%d, u/gid=%d/%d, ",
- major(st.st_dev), minor(st.st_dev),
- quad_to_string(st.st_ino),
- st.st_nlink, st.st_uid, st.st_gid);
- else
- snprintf(p, SPACELEFT(buf, p),
- "dev=%d/%d, ino=%lu, nlink=%d, u/gid=%d/%d, ",
- major(st.st_dev), minor(st.st_dev),
- (unsigned long) st.st_ino,
- st.st_nlink, st.st_uid, st.st_gid);
- if (sizeof st.st_size > sizeof (long))
- snprintf(p, SPACELEFT(buf, p), "size=%s",
- quad_to_string(st.st_size));
- else
- snprintf(p, SPACELEFT(buf, p), "size=%lu",
- (unsigned long) st.st_size);
- break;
- }
-
-printit:
- if (logit)
- sm_syslog(LOG_DEBUG, CurEnv ? CurEnv->e_id : NULL,
- "%.800s", buf);
- else
- printf("%s\n", buf);
-}
-\f/*
-** SHORTEN_HOSTNAME -- strip local domain information off of hostname.
-**
-** Parameters:
-** host -- the host to shorten (stripped in place).
-**
-** Returns:
-** none.
-*/
-
-void
-shorten_hostname(host)
- char host[];
-{
- register char *p;
- char *mydom;
- int i;
- bool canon = FALSE;
-
- /* strip off final dot */
- p = &host[strlen(host) - 1];
- if (*p == '.')
- {
- *p = '\0';
- canon = TRUE;
- }
-
- /* see if there is any domain at all -- if not, we are done */
- p = strchr(host, '.');
- if (p == NULL)
- return;
-
- /* yes, we have a domain -- see if it looks like us */
- mydom = macvalue('m', CurEnv);
- if (mydom == NULL)
- mydom = "";
- i = strlen(++p);
- if ((canon ? strcasecmp(p, mydom) : strncasecmp(p, mydom, i)) == 0 &&
- (mydom[i] == '.' || mydom[i] == '\0'))
- *--p = '\0';
-}
-\f/*
-** PROG_OPEN -- open a program for reading
-**
-** Parameters:
-** argv -- the argument list.
-** pfd -- pointer to a place to store the file descriptor.
-** e -- the current envelope.
-**
-** Returns:
-** pid of the process -- -1 if it failed.
-*/
-
-int
-prog_open(argv, pfd, e)
- char **argv;
- int *pfd;
- ENVELOPE *e;
-{
- int pid;
- int i;
- int saveerrno;
- int fdv[2];
- char *p, *q;
- char buf[MAXLINE + 1];
- extern int DtableSize;
-
- if (pipe(fdv) < 0)
- {
- syserr("%s: cannot create pipe for stdout", argv[0]);
- return -1;
- }
- pid = fork();
- if (pid < 0)
- {
- syserr("%s: cannot fork", argv[0]);
- close(fdv[0]);
- close(fdv[1]);
- return -1;
- }
- if (pid > 0)
- {
- /* parent */
- close(fdv[1]);
- *pfd = fdv[0];
- return pid;
- }
-
- /* child -- close stdin */
- close(0);
-
- /* stdout goes back to parent */
- close(fdv[0]);
- if (dup2(fdv[1], 1) < 0)
- {
- syserr("%s: cannot dup2 for stdout", argv[0]);
- _exit(EX_OSERR);
- }
- close(fdv[1]);
-
- /* stderr goes to transcript if available */
- if (e->e_xfp != NULL)
- {
- if (dup2(fileno(e->e_xfp), 2) < 0)
- {
- syserr("%s: cannot dup2 for stderr", argv[0]);
- _exit(EX_OSERR);
- }
- }
-
- /* this process has no right to the queue file */
- if (e->e_lockfp != NULL)
- close(fileno(e->e_lockfp));
-
- /* run as default user */
- endpwent();
- if (setgid(DefGid) < 0 && geteuid() == 0)
- syserr("prog_open: setgid(%ld) failed", (long) DefGid);
- if (setuid(DefUid) < 0 && geteuid() == 0)
- syserr("prog_open: setuid(%ld) failed", (long) DefUid);
-
- /* run in some directory */
- if (ProgMailer != NULL)
- p = ProgMailer->m_execdir;
- else
- p = NULL;
- for (; p != NULL; p = q)
- {
- q = strchr(p, ':');
- if (q != NULL)
- *q = '\0';
- expand(p, buf, sizeof buf, e);
- if (q != NULL)
- *q++ = ':';
- if (buf[0] != '\0' && chdir(buf) >= 0)
- break;
- }
- if (p == NULL)
- {
- /* backup directories */
- if (chdir("/tmp") < 0)
- (void) chdir("/");
- }
-
- /* arrange for all the files to be closed */
- for (i = 3; i < DtableSize; i++)
- {
- register int j;
-
- if ((j = fcntl(i, F_GETFD, 0)) != -1)
- (void) fcntl(i, F_SETFD, j | 1);
- }
-
- /* now exec the process */
- execve(argv[0], (ARGV_T) argv, (ARGV_T) UserEnviron);
-
- /* woops! failed */
- saveerrno = errno;
- syserr("%s: cannot exec", argv[0]);
- if (transienterror(saveerrno))
- _exit(EX_OSERR);
- _exit(EX_CONFIG);
- return -1; /* avoid compiler warning on IRIX */
-}
-\f/*
-** GET_COLUMN -- look up a Column in a line buffer
-**
-** Parameters:
-** line -- the raw text line to search.
-** col -- the column number to fetch.
-** delim -- the delimiter between columns. If null,
-** use white space.
-** buf -- the output buffer.
-** buflen -- the length of buf.
-**
-** Returns:
-** buf if successful.
-** NULL otherwise.
-*/
-
-char *
-get_column(line, col, delim, buf, buflen)
- char line[];
- int col;
- char delim;
- char buf[];
- int buflen;
-{
- char *p;
- char *begin, *end;
- int i;
- char delimbuf[4];
-
- if (delim == '\0')
- strcpy(delimbuf, "\n\t ");
- else
- {
- delimbuf[0] = delim;
- delimbuf[1] = '\0';
- }
-
- p = line;
- if (*p == '\0')
- return NULL; /* line empty */
- if (*p == delim && col == 0)
- return NULL; /* first column empty */
-
- begin = line;
-
- if (col == 0 && delim == '\0')
- {
- while (*begin != '\0' && isascii(*begin) && isspace(*begin))
- begin++;
- }
-
- for (i = 0; i < col; i++)
- {
- if ((begin = strpbrk(begin, delimbuf)) == NULL)
- return NULL; /* no such column */
- begin++;
- if (delim == '\0')
- {
- while (*begin != '\0' && isascii(*begin) && isspace(*begin))
- begin++;
- }
- }
-
- end = strpbrk(begin, delimbuf);
- if (end == NULL)
- i = strlen(begin);
- else
- i = end - begin;
- if (i >= buflen)
- i = buflen - 1;
- strncpy(buf, begin, i);
- buf[i] = '\0';
- return buf;
-}
-\f/*
-** CLEANSTRCPY -- copy string keeping out bogus characters
-**
-** Parameters:
-** t -- "to" string.
-** f -- "from" string.
-** l -- length of space available in "to" string.
-**
-** Returns:
-** none.
-*/
-
-void
-cleanstrcpy(t, f, l)
- register char *t;
- register char *f;
- int l;
-{
- /* check for newlines and log if necessary */
- (void) denlstring(f, TRUE, TRUE);
-
- l--;
- while (l > 0 && *f != '\0')
- {
- if (isascii(*f) &&
- (isalnum(*f) || strchr("!#$%&'*+-./^_`{|}~", *f) != NULL))
- {
- l--;
- *t++ = *f;
- }
- f++;
- }
- *t = '\0';
-}
-\f/*
-** DENLSTRING -- convert newlines in a string to spaces
-**
-** Parameters:
-** s -- the input string
-** strict -- if set, don't permit continuation lines.
-** logattacks -- if set, log attempted attacks.
-**
-** Returns:
-** A pointer to a version of the string with newlines
-** mapped to spaces. This should be copied.
-*/
-
-char *
-denlstring(s, strict, logattacks)
- char *s;
- bool strict;
- bool logattacks;
-{
- register char *p;
- int l;
- static char *bp = NULL;
- static int bl = 0;
-
- p = s;
- while ((p = strchr(p, '\n')) != NULL)
- if (strict || (*++p != ' ' && *p != '\t'))
- break;
- if (p == NULL)
- return s;
-
- l = strlen(s) + 1;
- if (bl < l)
- {
- /* allocate more space */
- if (bp != NULL)
- free(bp);
- bp = xalloc(l);
- bl = l;
- }
- strcpy(bp, s);
- for (p = bp; (p = strchr(p, '\n')) != NULL; )
- *p++ = ' ';
-
- if (logattacks)
- {
- sm_syslog(LOG_NOTICE, CurEnv->e_id,
- "POSSIBLE ATTACK from %.100s: newline in string \"%s\"",
- RealHostName == NULL ? "[UNKNOWN]" : RealHostName,
- shortenstring(bp, MAXSHORTSTR));
- }
-
- return bp;
-}
-\f/*
-** PATH_IS_DIR -- check to see if file exists and is a directory.
-**
-** There are some additional checks for security violations in
-** here. This routine is intended to be used for the host status
-** support.
-**
-** Parameters:
-** pathname -- pathname to check for directory-ness.
-** createflag -- if set, create directory if needed.
-**
-** Returns:
-** TRUE -- if the indicated pathname is a directory
-** FALSE -- otherwise
-*/
-
-int
-path_is_dir(pathname, createflag)
- char *pathname;
- bool createflag;
-{
- struct stat statbuf;
-
-#if HASLSTAT
- if (lstat(pathname, &statbuf) < 0)
-#else
- if (stat(pathname, &statbuf) < 0)
-#endif
- {
- if (errno != ENOENT || !createflag)
- return FALSE;
- if (mkdir(pathname, 0755) < 0)
- return FALSE;
- return TRUE;
- }
- if (!S_ISDIR(statbuf.st_mode))
- {
- errno = ENOTDIR;
- return FALSE;
- }
-
- /* security: don't allow writable directories */
- if (bitset(S_IWGRP|S_IWOTH, statbuf.st_mode))
- {
- errno = EACCES;
- return FALSE;
- }
-
- return TRUE;
-}
-\f/*
-** PROC_LIST_ADD -- add process id to list of our children
-**
-** Parameters:
-** pid -- pid to add to list.
-**
-** Returns:
-** none
-*/
-
-struct procs
-{
- pid_t proc_pid;
- char *proc_task;
-};
-
-static struct procs *ProcListVec = NULL;
-static int ProcListSize = 0;
-
-#define NO_PID ((pid_t) 0)
-#ifndef PROC_LIST_SEG
-# define PROC_LIST_SEG 32 /* number of pids to alloc at a time */
-#endif
-
-void
-proc_list_add(pid, task)
- pid_t pid;
- char *task;
-{
- int i;
-
- for (i = 0; i < ProcListSize; i++)
- {
- if (ProcListVec[i].proc_pid == NO_PID)
- break;
- }
- if (i >= ProcListSize)
- {
- /* probe the existing vector to avoid growing infinitely */
- proc_list_probe();
-
- /* now scan again */
- for (i = 0; i < ProcListSize; i++)
- {
- if (ProcListVec[i].proc_pid == NO_PID)
- break;
- }
- }
- if (i >= ProcListSize)
- {
- /* grow process list */
- struct procs *npv;
-
- npv = (struct procs *) xalloc(sizeof (struct procs) * (ProcListSize + PROC_LIST_SEG));
- if (ProcListSize > 0)
- {
- bcopy(ProcListVec, npv, ProcListSize *
- sizeof (struct procs));
- free(ProcListVec);
- }
- for (i = ProcListSize; i < ProcListSize + PROC_LIST_SEG; i++)
- {
- npv[i].proc_pid = NO_PID;
- npv[i].proc_task = NULL;
- }
- i = ProcListSize;
- ProcListSize += PROC_LIST_SEG;
- ProcListVec = npv;
- }
- ProcListVec[i].proc_pid = pid;
- ProcListVec[i].proc_task = newstr(task);
-
- /* if process adding itself, it's not a child */
- if (pid != getpid())
- CurChildren++;
-}
-\f/*
-** PROC_LIST_SET -- set pid task in process list
-**
-** Parameters:
-** pid -- pid to set
-** task -- task of pid
-**
-** Returns:
-** none.
-*/
-
-void
-proc_list_set(pid, task)
- pid_t pid;
- char *task;
-{
- int i;
-
- for (i = 0; i < ProcListSize; i++)
- {
- if (ProcListVec[i].proc_pid == pid)
- {
- if (ProcListVec[i].proc_task != NULL)
- free(ProcListVec[i].proc_task);
- ProcListVec[i].proc_task = newstr(task);
- break;
- }
- }
-}
-\f/*
-** PROC_LIST_DROP -- drop pid from process list
-**
-** Parameters:
-** pid -- pid to drop
-**
-** Returns:
-** none.
-*/
-
-void
-proc_list_drop(pid)
- pid_t pid;
-{
- int i;
-
- for (i = 0; i < ProcListSize; i++)
- {
- if (ProcListVec[i].proc_pid == pid)
- {
- ProcListVec[i].proc_pid = NO_PID;
- if (ProcListVec[i].proc_task != NULL)
- {
- free(ProcListVec[i].proc_task);
- ProcListVec[i].proc_task = NULL;
- }
- break;
- }
- }
- if (CurChildren > 0)
- CurChildren--;
-}
-\f/*
-** PROC_LIST_CLEAR -- clear the process list
-**
-** Parameters:
-** none.
-**
-** Returns:
-** none.
-*/
-
-void
-proc_list_clear()
-{
- int i;
-
- /* start from 1 since 0 is the daemon itself */
- for (i = 1; i < ProcListSize; i++)
- {
- ProcListVec[i].proc_pid = NO_PID;
- if (ProcListVec[i].proc_task != NULL)
- {
- free(ProcListVec[i].proc_task);
- ProcListVec[i].proc_task = NULL;
- }
- }
- CurChildren = 0;
-}
-\f/*
-** PROC_LIST_PROBE -- probe processes in the list to see if they still exist
-**
-** Parameters:
-** none
-**
-** Returns:
-** none
-*/
-
-void
-proc_list_probe()
-{
- int i;
-
- /* start from 1 since 0 is the daemon itself */
- for (i = 1; i < ProcListSize; i++)
- {
- if (ProcListVec[i].proc_pid == NO_PID)
- continue;
- if (kill(ProcListVec[i].proc_pid, 0) < 0)
- {
- if (LogLevel > 3)
- sm_syslog(LOG_DEBUG, CurEnv->e_id,
- "proc_list_probe: lost pid %d",
- (int) ProcListVec[i].proc_pid);
- ProcListVec[i].proc_pid = NO_PID;
- if (ProcListVec[i].proc_task != NULL)
- {
- free(ProcListVec[i].proc_task);
- ProcListVec[i].proc_task = NULL;
- }
- CurChildren--;
- }
- }
- if (CurChildren < 0)
- CurChildren = 0;
-}
-\f/*
-** PROC_LIST_DISPLAY -- display the process list
-**
-** Parameters:
-** out -- output file pointer
-**
-** Returns:
-** none.
-*/
-
-void
-proc_list_display(out)
- FILE *out;
-{
- int i;
-
- for (i = 0; i < ProcListSize; i++)
- {
- if (ProcListVec[i].proc_pid == NO_PID)
- continue;
-
- fprintf(out, "%d %s%s\n", (int) ProcListVec[i].proc_pid,
- ProcListVec[i].proc_task != NULL ?
- ProcListVec[i].proc_task : "(unknown)",
- (OpMode == MD_SMTP ||
- OpMode == MD_DAEMON ||
- OpMode == MD_ARPAFTP) ? "\r" : "");
- }
-}
-\f/*
-** SM_STRCASECMP -- 8-bit clean version of strcasecmp
-**
-** Thank you, vendors, for making this all necessary.
-*/
-
-/*
- * Copyright (c) 1987, 1993
- * The Regents of the University of California. All rights reserved.
- *
- * 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.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
- */
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcasecmp.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-
-/*
- * This array is designed for mapping upper and lower case letter
- * together for a case independent comparison. The mappings are
- * based upon ascii character sequences.
- */
-static const u_char charmap[] = {
- 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007,
- 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017,
- 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027,
- 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037,
- 0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047,
- 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057,
- 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067,
- 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077,
- 0100, 0141, 0142, 0143, 0144, 0145, 0146, 0147,
- 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157,
- 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167,
- 0170, 0171, 0172, 0133, 0134, 0135, 0136, 0137,
- 0140, 0141, 0142, 0143, 0144, 0145, 0146, 0147,
- 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157,
- 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167,
- 0170, 0171, 0172, 0173, 0174, 0175, 0176, 0177,
- 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207,
- 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217,
- 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227,
- 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237,
- 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247,
- 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257,
- 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267,
- 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277,
- 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
- 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
- 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327,
- 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337,
- 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347,
- 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357,
- 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367,
- 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377,
-};
-
-int
-sm_strcasecmp(s1, s2)
- const char *s1, *s2;
-{
- register const u_char *cm = charmap,
- *us1 = (const u_char *)s1,
- *us2 = (const u_char *)s2;
-
- while (cm[*us1] == cm[*us2++])
- if (*us1++ == '\0')
- return (0);
- return (cm[*us1] - cm[*--us2]);
-}
-
-int
-sm_strncasecmp(s1, s2, n)
- const char *s1, *s2;
- register size_t n;
-{
- if (n != 0) {
- register const u_char *cm = charmap,
- *us1 = (const u_char *)s1,
- *us2 = (const u_char *)s2;
-
- do {
- if (cm[*us1] != cm[*us2++])
- return (cm[*us1] - cm[*--us2]);
- if (*us1++ == '\0')
- break;
- } while (--n != 0);
- }
- return (0);
-}
+++ /dev/null
-/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
- * Copyright (c) 1983 Eric P. Allman. All rights reserved.
- * Copyright (c) 1988, 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.
- *
- */
-
-#ifndef lint
-static char sccsid[] = "@(#)version.c 8.9.3.1 (Berkeley) 2/4/1999";
-#endif /* not lint */
-
-char Version[] = "8.9.3";
+++ /dev/null
-The following are results of running t_setreuid on various architectures.
-
-OPSYS VERSION STATUS DATE TESTER/NOTES
-===== ======= ====== ==== ============
-
-SunOS 4.1 OK 93.07.19 eric
-SunOS 4.1.2 OK 93.07.19 eric
-SunOS 4.1.3 OK 93.09.25 Robert Elz
-
-BSD 4.4 OK 93.07.19 eric (wierd results, but functional)
-BSD 4.3Utah OK 93.07.19 eric
-
-FreeBSD 2.1-sta OK 96.04.14 Jaye Mathisen <mrcpu@cdsnet.net>
-
-Ultrix 4.2A OK 93.07.19 eric
-Ultrix 4.3A OK 93.07.19 Allan Johannesen
-Ultrix 4.5 OK 96.09.18 Gregory Neil Shapiro <gshapiro@wpi.edu>
-
-HP-UX 8.07 OK 93.07.19 eric (on 7xx series)
-HP-UX 8.02 OK 93.07.19 Michael Corrigan (on 8xx series)
-HP-UX 8.00 OK 93.07.21 Michael Corrigan (on 3xx/4xx series)
-HP-UX 9.01 OK 93.11.19 Cassidy (on 7xx series)
-
-Solaris 2.1
-Solaris 2.2 FAIL 93.07.19 Bill Wisner
-Solaris 2.3 FAIL 95.11.22 Scott J. Kramer <sjk@lux.com>
-Solaris 2.5 OK 96.02.29 Carson Gaspar <carson@lehman.com>
-Solaris 2.5.1 OK 96.11.29 Gregory Neil Shapiro <gshapiro@wpi.edu>
-
-OSF/1 T1.3-4 OK 93.07.19 eric (on DEC Alpha)
-OSF/1 1.3 OK 94.12.10 Jeff A. Earickson (on Intel Paragon)
-OSF/1 3.2D OK 96.09.18 Gregory Neil Shapiro <gshapiro@wpi.edu>
-OSF/1 4.0 OK 96.09.18 Gregory Neil Shapiro <gshapiro@wpi.edu>
-
-CxOS 11.5 OK 96.07.08 Eric Schnoebelen <eric@cirr.com>
-CxOS 11.0 OK 93.01.21 Eric Schnoebelen (CxOS 11.0 beta 1)
-CxOS 10.x OK 93.01.21 Eric Schnoebelen
-
-AIX 3.1.5 FAIL 93.08.07 David J. N. Begley
-AIX 3.2.3e FAIL 93.07.26 Steve Bauer <sbauer@silver.sdsmt.edu>
-AIX 3.2.4 FAIL 93.10.07 David J. N. Begley
-AIX 3.2.5 FAIL 94.05.17 Steve Bauer <sbauer@hpcmmib.hpc.sdsmt.edu>
-AIX 4.1 FAIL 96.10.21 Hakan Lindholm <hakan@af.lu.se>
-AIX 4.2 OK 96.10.16 Steve Bauer <sbauer@krypton.hpc.sdsmt.edu>
-
-IRIX 4.0.4 OK 93.09.25 Robert Elz
-IRIX 5.2 OK 94.12.06 Mark Andrews <mandrews@alias.com>
-IRIX 5.3 OK 94.12.06 Mark Andrews <mandrews@alias.com>
-IRIX 6.2 OK 96.09.16 Kari E. Hurtta <Kari.Hurtta@ozone.FMI.FI>
-IRIX 6.3 OK 97.02.10 Mark Andrews <mandrews@aw.sgi.com>
-
-SCO 3.2v4.0 OK 93.10.02 Peter Wemm (with -lsocket from 3.2v4 devsys)
-
-NeXT 2.1 OK 93.07.28 eric
-NeXT 3.0 OK 34.05.05 Kevin John Wang <kwang@lore.acs.calpoly.edu>
-
-Linux 0.99p10 OK 93.08.08 Karl London
-Linux 0.99p13 OK 93.09.27 Christian Kuhtz
-Linux 0.99p14 OK 93.11.30 Christian Kuhtz <chk@data-hh.Hanse.DE>
-Linux 1.0 OK 94.03.19 Shayne Smith <snsmith@rastus.brisnet.org.au>
-Linux 1.2.13 OK 95.11.02 Sven Neuhaus <sven@ping.de>
-Linux 2.0.17 OK 96.09.03 Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
-Linux 2.1.109 OK 98.07.21 John Kennedy <jk@csuchico.edu>
-
-BSD/386 1.0 OK 93.11.13 Tony Sanders
-
-DELL 2.2 OK 93.11.15 Peter Wemm (using -DSETEUID)
-
-Pyramid 5.0d OK 95.01.14 David Miller <davem@nadzieja.rutgers.edu>
-
-
-
-The following are results of running t_seteuid on various architectures.
-
-OPSYS VERSION STATUS DATE TESTER/NOTES
-===== ======= ====== ==== ============
-
-Solaris 2.3 OK 95.11.22 Scott J. Kramer <sjk@lux.com>
-Solaris 2.4 OK 95.09.22 Thomas 'Mike' Michlmayr <mike@cosy.sbg.ac.at>
-Solaris 2.5 OK 96.02.29 Carson Gaspar <carson@lehman.com>
-Solaris 2.5.1 OK 96.11.29 Gregory Neil Shapiro <gshapiro@wpi.edu>
-
-Linux 1.2.13 FAIL 95.11.02 Sven Neuhaus <sven@ping.de>
-Linux 2.0.17 FAIL 96.09.03 Horst von Brand <vonbrand@sleipnir.valparaiso.cl>
-Linux 2.1.109 FAIL 98.07.21 John Kennedy <jk@csuchico.edu>
-
-AIX 4.1 OK 96.10.21 Hakan Lindholm <hakan@af.lu.se>
-
-IRIX 5.2 OK 95.12.01 Mark Andrews <mandrews@aw.sgi.com>
-IRIX 5.3 OK 95.12.01 Mark Andrews <mandrews@aw.sgi.com>
-IRIX 6.2 OK 96.09.16 Kari E. Hurtta <Kari.Hurtta@ozone.FMI.FI>
-IRIX 6.3 OK 97.02.10 Mark Andrews <mandrews@aw.sgi.com>
-
-FreeBSD 2.1-sta OK 96.04.14 Jaye Mathisen <mrcpu@cdsnet.net>
-
-Ultrix 4.5 FAIL 96.09.18 Gregory Neil Shapiro <gshapiro@wpi.edu>
-
-OSF/1 3.2D OK 96.09.18 Gregory Neil Shapiro <gshapiro@wpi.edu>
-OSF/1 4.0 OK 96.09.18 Gregory Neil Shapiro <gshapiro@wpi.edu>
-
-CxOS 11.5 FAIL 96.07.08 Eric Schnoebelen <eric@cirr.com>
-
-
-The following are the results of running t_pathconf.c. Safe means that
-the underlying filesystem (in NFS, the filesystem on the server) does not
-permit regular (non-root) users to chown their files to another user.
-Unsafe means that they can. Typically, BSD-based systems do not permit
-giveaway and System V-based systems do. However, some systems (e.g.,
-Solaris) can set this on a per-system or per-filesystem basis. Entries
-are the return value of pathconf, the errno value, and a * if chown
-disagreed with the result of the pathconf call, and a ? if the test has
-not been run. A mark of [R] means that the local filesystem has
-chown set to be restricted, [U] means that it is set to be unrestricted.
-
- Safe Filesystem Unsafe Filesystem
-SYSTEM LOCAL NFS-V2 NFS-V3 NFS-V2 NFS-V3
-
-SunOS 4.1.3_U1 1/0 -1/EINVAL* n/a -1/EINVAL? n/a
-SunOS 4.1.4 1/0 -1/EINVAL* n/a -1/EINVAL n/a
-
-AIX 3.2 0/0 0/0
-
-Solaris 2.4 1/0 -1/EINVAL*
-Solaris 2.5 1/0 -1/EINVAL* 1/0 0/0?
-Solaris 2.5.1 1/0 -1/EINVAL* 0/0
-
-DEC OSF1 3.0 0/0 0/0
-DEC OSF1 3.2D-2 0/0 0/0 0/0
-DEC OSF1 4.0A 0/0 0/0 0/0
-DEC OSF 4.0B 0/0 0/0 0/0
-
-Ultrix 4.3 0/0 0/0 n/a n/a
-Ultrix 4.5 1/0 1/0
-
-HP-UX 9.05 -1/0 -1/EOPNOTSUPP* -1/EOPNOTSUPP
-HP-UX 9.05[R] 1/0 -1/EOPNOTSUPP* -1/EOPNOTSUPP*
-HP-UX 10.10 -1/0 -1/EOPNOTSUPP* -1/EOPNOTSUPP
-HP-UX 10.20 -1/EOPNOTSUPP? -1/EOPNOTSUPP?
-HP-UX 10.30 -1/0 -1/EOPNOTSUPP -1/EOPNOTSUPP
-
-BSD/OS 2.1 1/0
-
-FreeBSD 2.1.7 1/0 -1/EINVAL* -1/EINVAL
-
-Irix 5.3 -1/0* -1/0
-Irix 6.2 1/0 -1/0 0/0*
-Irix 6.2 -1/0 -1/0
-Irix 6.3 R10000 -1/0 -1/0 0/0*
-
-A/UX 3.1.1 1/0
-
-DomainOS [R] -1/0*
-DomainOS [U] -1/0
-
-NCR MP-RAS 2 -1/0
-NCR MP-RAS 3 -1/0
-
-Linux 2.0.27 1/0 1/0
+++ /dev/null
-/*
-** This program tests your system to see if you have the lovely
-** security-defeating semantics that an open with O_CREAT|O_EXCL
-** set will successfully open a file named by a symbolic link that
-** points to a non-existent file. Sadly, Posix is mute on what
-** should happen in this situation.
-**
-** Results to date:
-** AIX 3.2 OK
-** BSD family OK
-** BSD/OS 2.1 OK
-** FreeBSD 2.1 OK
-** DEC OSF/1 3.0 OK
-** HP-UX 9.04 FAIL
-** HP-UX 9.05 FAIL
-** HP-UX 9.07 OK
-** HP-UX 10.01 OK
-** HP-UX 10.10 OK
-** HP-UX 10.20 OK
-** Irix 5.3 OK
-** Irix 6.2 OK
-** Irix 6.3 OK
-** Irix 6.4 OK
-** Linux OK
-** NeXT 2.1 OK
-** Solaris 2.x OK
-** SunOS 4.x OK
-** Ultrix 4.3 OK
-*/
-
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
-char Attacker[128];
-char Attackee[128];
-
-main(argc, argv)
- int argc;
- char **argv;
-{
- struct stat st;
-
- sprintf(Attacker, "/tmp/attacker.%d.%ld", getpid(), time(NULL));
- sprintf(Attackee, "/tmp/attackee.%d.%ld", getpid(), time(NULL));
-
- if (symlink(Attackee, Attacker) < 0)
- {
- printf("Could not create %s->%s symlink: %d\n",
- Attacker, Attackee, errno);
- bail(1);
- }
- (void) unlink(Attackee);
- if (stat(Attackee, &st) >= 0)
- {
- printf("%s already exists -- remove and try again.\n",
- Attackee);
- bail(1);
- }
- if (open(Attacker, O_WRONLY|O_CREAT|O_EXCL, 0644) < 0)
- {
- int saveerr = errno;
-
- if (stat(Attackee, &st) >= 0)
- {
- printf("Weird. Open failed but %s was created anyhow (errno = %d)\n",
- Attackee, saveerr);
- bail(1);
- }
- printf("Good show! Exclusive open works properly with symbolic links (errno = %d).\n",
- saveerr);
- bail(0);
- }
- if (stat(Attackee, &st) < 0)
- {
- printf("Weird. Open succeeded but %s was not created\n",
- Attackee);
- bail(2);
- }
- printf("Bad news: you can do an exclusive open through a symbolic link\n");
- printf("\tBe sure you #define BOGUS_O_EXCL in conf.h\n");
- bail(1);
-}
-
-bail(stat)
- int stat;
-{
- (void) unlink(Attacker);
- (void) unlink(Attackee);
- exit(stat);
-}
+++ /dev/null
-/*
-** The following test program tries the pathconf(2) routine. It should
-** be run in a non-NFS-mounted directory (e.g., /tmp) and on remote (NFS)
-** mounted directories running both NFS-v2 and NFS-v3 from systems that
-** both do and do not permit file giveaway.
-*/
-
-#include <unistd.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <sysexits.h>
-
-main()
-{
- int fd;
- int i;
- char tbuf[100];
- extern int errno;
-
- if (geteuid() == 0)
- {
- printf("*** Run me as a non-root user! ***\n");
- exit(EX_USAGE);
- }
-
- strcpy(tbuf, "TXXXXXX");
- fd = mkstemp(tbuf);
- if (fd < 0)
- {
- printf("*** Could not create test file %s\n", tbuf);
- exit(EX_CANTCREAT);
- }
- errno = 0;
- i = pathconf(".", _PC_CHOWN_RESTRICTED);
- printf("pathconf(.) returns %2d, errno = %d\n", i, errno);
- errno = 0;
- i = pathconf(tbuf, _PC_CHOWN_RESTRICTED);
- printf("pathconf(%s) returns %2d, errno = %d\n", tbuf, i, errno);
- errno = 0;
- i = fpathconf(fd, _PC_CHOWN_RESTRICTED);
- printf("fpathconf(%s) returns %2d, errno = %d\n", tbuf, i, errno);
- if (errno == 0 && i >= 0)
- {
- /* so it claims that it doesn't work -- try anyhow */
- printf(" fpathconf claims that chown is safe ");
- if (fchown(fd, 1, 1) >= 0)
- printf("*** but fchown works anyhow! ***\n");
- else
- printf("and fchown agrees\n");
- }
- else
- {
- /* well, let's see what really happens */
- printf(" fpathconf claims that chown is not safe ");
- if (fchown(fd, 1, 1) >= 0)
- printf("as indeed it is not\n");
- else
- printf("*** but in fact it is safe ***\n");
- }
- unlink(tbuf);
- exit(EX_OK);
-}
+++ /dev/null
-/*
-** This program checks to see if your version of seteuid works.
-** Compile it, make it setuid root, and run it as yourself (NOT as
-** root). If it won't compile or outputs any MAYDAY messages, don't
-** define USESETEUID in conf.h.
-**
-** NOTE: It is not sufficient to have seteuid in your library.
-** You must also have saved uids that function properly.
-**
-** Compilation is trivial -- just "cc t_seteuid.c". Make it setuid,
-** root and then execute it as a non-root user.
-*/
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#ifdef __hpux
-#define seteuid(e) setresuid(-1, e, -1)
-#endif
-
-main()
-{
- int fail = 0;
- uid_t realuid = getuid();
-
- printuids("initial uids", realuid, 0);
-
- if (geteuid() != 0)
- {
- printf("SETUP ERROR: re-run setuid root\n");
- exit(1);
- }
-
- if (getuid() == 0)
- {
- printf("SETUP ERROR: must be run by a non-root user\n");
- exit(1);
- }
-
- if (seteuid(1) < 0)
- printf("seteuid(1) failure\n");
- printuids("after seteuid(1)", realuid, 1);
-
- if (geteuid() != 1)
- {
- fail++;
- printf("MAYDAY! Wrong effective uid\n");
- }
-
- /* do activity here */
-
- if (seteuid(0) < 0)
- {
- fail++;
- printf("seteuid(0) failure\n");
- }
- printuids("after seteuid(0)", realuid, 0);
-
- if (geteuid() != 0)
- {
- fail++;
- printf("MAYDAY! Wrong effective uid\n");
- }
- if (getuid() != realuid)
- {
- fail++;
- printf("MAYDAY! Wrong real uid\n");
- }
- printf("\n");
-
- if (seteuid(2) < 0)
- {
- fail++;
- printf("seteuid(2) failure\n");
- }
- printuids("after seteuid(2)", realuid, 2);
-
- if (geteuid() != 2)
- {
- fail++;
- printf("MAYDAY! Wrong effective uid\n");
- }
-
- /* do activity here */
-
- if (seteuid(0) < 0)
- {
- fail++;
- printf("seteuid(0) failure\n");
- }
- printuids("after seteuid(0)", realuid, 0);
-
- if (geteuid() != 0)
- {
- fail++;
- printf("MAYDAY! Wrong effective uid\n");
- }
- if (getuid() != realuid)
- {
- fail++;
- printf("MAYDAY! Wrong real uid\n");
- }
-
- if (fail)
- {
- printf("\nThis system cannot use seteuid\n");
- exit(1);
- }
-
- printf("\nIt is safe to define USESETEUID on this system\n");
- exit(0);
-}
-
-printuids(str, r, e)
- char *str;
- int r, e;
-{
- printf("%s (should be %d/%d): r/euid=%d/%d\n", str, r, e,
- getuid(), geteuid());
-}
+++ /dev/null
-/*
-** This program checks to see if your version of setreuid works.
-** Compile it, make it setuid root, and run it as yourself (NOT as
-** root). If it won't compile or outputs any MAYDAY messages, don't
-** define HASSETREUID in conf.h.
-**
-** Compilation is trivial -- just "cc t_setreuid.c". Make it setuid,
-** root and then execute it as a non-root user.
-*/
-
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdio.h>
-
-#ifdef __hpux
-#define setreuid(r, e) setresuid(r, e, -1)
-#endif
-
-main()
-{
- int fail = 0;
- uid_t realuid = getuid();
-
- printuids("initial uids", realuid, 0);
-
- if (geteuid() != 0)
- {
- printf("SETUP ERROR: re-run setuid root\n");
- exit(1);
- }
-
- if (getuid() == 0)
- {
- printf("SETUP ERROR: must be run by a non-root user\n");
- exit(1);
- }
-
- if (setreuid(0, 1) < 0)
- {
- fail++;
- printf("setreuid(0, 1) failure\n");
- }
- printuids("after setreuid(0, 1)", 0, 1);
-
- if (geteuid() != 1)
- {
- fail++;
- printf("MAYDAY! Wrong effective uid\n");
- }
-
- /* do activity here */
-
- if (setreuid(-1, 0) < 0)
- {
- fail++;
- printf("setreuid(-1, 0) failure\n");
- }
- printuids("after setreuid(-1, 0)", 0, 0);
- if (setreuid(realuid, 0) < 0)
- {
- fail++;
- printf("setreuid(%d, 0) failure\n", realuid);
- }
- printuids("after setreuid(realuid, 0)", realuid, 0);
-
- if (geteuid() != 0)
- {
- fail++;
- printf("MAYDAY! Wrong effective uid\n");
- }
- if (getuid() != realuid)
- {
- fail++;
- printf("MAYDAY! Wrong real uid\n");
- }
- printf("\n");
-
- if (setreuid(0, 2) < 0)
- {
- fail++;
- printf("setreuid(0, 2) failure\n");
- }
- printuids("after setreuid(0, 2)", 0, 2);
-
- if (geteuid() != 2)
- {
- fail++;
- printf("MAYDAY! Wrong effective uid\n");
- }
-
- /* do activity here */
-
- if (setreuid(-1, 0) < 0)
- {
- fail++;
- printf("setreuid(-1, 0) failure\n");
- }
- printuids("after setreuid(-1, 0)", 0, 0);
- if (setreuid(realuid, 0) < 0)
- {
- fail++;
- printf("setreuid(%d, 0) failure\n", realuid);
- }
- printuids("after setreuid(realuid, 0)", realuid, 0);
-
- if (geteuid() != 0)
- {
- fail++;
- printf("MAYDAY! Wrong effective uid\n");
- }
- if (getuid() != realuid)
- {
- fail++;
- printf("MAYDAY! Wrong real uid\n");
- }
-
- if (fail)
- {
- printf("\nThis system cannot use setreuid\n");
- exit(1);
- }
-
- printf("\nIt is safe to define HASSETREUID on this system\n");
- exit(0);
-}
-
-printuids(str, r, e)
- char *str;
- int r, e;
-{
- printf("%s (should be %d/%d): r/euid=%d/%d\n", str, r, e,
- getuid(), geteuid());
-}