diff options
author | Andreas Beckmann <debian@abeckmann.de> | 2012-10-01 19:58:38 +0200 |
---|---|---|
committer | Andreas Beckmann <debian@abeckmann.de> | 2012-10-01 19:58:38 +0200 |
commit | 7b9056b97dd10ee7b6b02f88a239f9f99cfa38f8 (patch) | |
tree | dd00fc6784f7bef19fb8e5aa0572dbe13563ba29 /src | |
parent | 6202a816311c5e56f71ecd358850b1e6d8cd7065 (diff) | |
parent | 6b71060b84a2d9111ec847e66cc5160aab8a45e8 (diff) | |
download | sendmail-7b9056b97dd10ee7b6b02f88a239f9f99cfa38f8.tar.gz |
Merged Upstream version 8.9.3
Diffstat (limited to 'src')
127 files changed, 6377 insertions, 11931 deletions
diff --git a/src/Build b/src/Build new file mode 120000 index 0000000..6308dba --- /dev/null +++ b/src/Build @@ -0,0 +1 @@ +../BuildTools/bin/Build
\ No newline at end of file diff --git a/src/Makefile b/src/Makefile deleted file mode 100644 index 0be76ad..0000000 --- a/src/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -# @(#)Makefile 8.8 (Berkeley) 3/28/97 - -######################################################################### -# This Makefile is for 4.4BSD only!!! For all other systems, use # -# the "makesendmail" script. # -######################################################################### - -PROG= sendmail - -# define the database format to use for aliases et al. Can be -DNEWDB (for -# the new BSD database package -- this is preferred) or -DNDBM for the NDBM -# database package. The old putrescent V7 DBM package is no longer -# supported. -# You can define both NEWDB and NDBM during a transition period; old -# databases are read, but the new format will be used on any rebuilds. On -# really gnarly systems, you can set this to null; it will crawl like a high -# spiral snail, but it will work. -DBMDEF= -DNEWDB - -CFLAGS+=-I${.CURDIR} ${DBMDEF} -DNETISO - -SRCS= alias.c arpadate.c clock.c collect.c conf.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 srvrsmtp.c stab.c stats.c sysexits.c trace.c udb.c \ - usersmtp.c util.c version.c -DPADD= -LDADD= -MAN1= mailq.0 newaliases.0 -MAN5= aliases.0 -MAN8= sendmail.0 -LINKS= /usr/sbin/sendmail /usr/bin/newaliases \ - /usr/sbin/sendmail /usr/bin/mailq -BINDIR= /usr/sbin -BINOWN= root -BINGRP= kmem -BINMODE=6555 - -beforeinstall: -# install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ -# ${DESTDIR}/etc/sendmail.fc - install -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ - ${DESTDIR}/var/log/sendmail.st - install -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \ - ${DESTDIR}/usr/share/misc - -.include <bsd.prog.mk> diff --git a/src/Makefile.m4 b/src/Makefile.m4 new file mode 100644 index 0000000..d88d35b --- /dev/null +++ b/src/Makefile.m4 @@ -0,0 +1,152 @@ +# +# 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 diff --git a/src/Makefiles/Makefile.386BSD b/src/Makefiles/Makefile.386BSD deleted file mode 100644 index 4eb18ff..0000000 --- a/src/Makefiles/Makefile.386BSD +++ /dev/null @@ -1,45 +0,0 @@ -# @(#)Makefile.386BSD 8.6 (Berkeley) 8/7/97 - -PROG= sendmail - -# define the database format to use for aliases et al. Can be -DNEWDB (for -# the new BSD database package -- this is preferred) or -DNDBM for the NDBM -# database package. The old putrescent V7 DBM package is no longer -# supported. -# You can define both NEWDB and NDBM during a transition period; old -# databases are read, but the new format will be used on any rebuilds. On -# really gnarly systems, you can set this to null; it will crawl like a high -# spiral snail, but it will work. -DBMDEF= -DNEWDB - -CFLAGS+=-I${.CURDIR} ${DBMDEF} -DMIME - -SRCS= alias.c arpadate.c clock.c collect.c conf.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 srvrsmtp.c stab.c stats.c sysexits.c trace.c udb.c \ - usersmtp.c util.c version.c -DPADD= -LDADD= $(LIBUTIL) -MAN1= newaliases.0 mailq.0 -MAN5= aliases.0 -MAN8= sendmail.0 -LINKS= /usr/sbin/sendmail /usr/bin/newaliases \ - /usr/sbin/sendmail /usr/bin/mailq \ - /usr/sbin/sendmail /usr/bin/hoststat \ - /usr/sbin/sendmail /usr/bin/purgestat -INSTALL=install -BINDIR= /usr/sbin -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -beforeinstall: -# ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ -# ${DESTDIR}/etc/sendmail.fc - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ - ${DESTDIR}/var/log/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \ - ${DESTDIR}/usr/share/misc - -.include <bsd.prog.mk> diff --git a/src/Makefiles/Makefile.A-UX b/src/Makefiles/Makefile.A-UX deleted file mode 100644 index 69f75e7..0000000 --- a/src/Makefiles/Makefile.A-UX +++ /dev/null @@ -1,115 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# @(#)Makefile.A-UX 8.16 (Berkeley) 8/7/97 -# -# Tested on A/UX 3.1.1. -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# If you are running A/UX prior to 3.1, delete -DNEWDB -DBMDEF= -DNDBM -DNEWDB - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -D_POSIX_SOURCE - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# loader options -LDOPTS= - -# library directories -LIBDIRS= - -# libraries required on your system -# If you are running A/UX prior to 3.1, delete -ldb -# It may be necessary to change -lUTIL to -lmalloc on older versions -LIBS= -ldbm -ldb -lposix -lUTIL - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.AIX b/src/Makefiles/Makefile.AIX deleted file mode 100644 index b5fabce..0000000 --- a/src/Makefiles/Makefile.AIX +++ /dev/null @@ -1,117 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on AIX 3.1.5 and 3.2.3e. -# -# @(#)Makefile.AIX 8.13 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -# you can use -O3 on AIX 3.2.4 or greater ONLY! -O= -g - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNEWDB -DNIS -# -# If you did not install the NEWDB on your AIX platform, use: -#DBMDEF=-DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -D_AIX3 - -# see also conf.h for additional compilation flags - -# include directories -#INCDIRS=-I/usr/sww/include - -# library directories -#LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -- add -ls if you define USEGETCONFATTR -LIBS= -ldbm -ldb -# -# If you did not install the NEWDB on your AIX platform, use: -#LIBS= -ldbm - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/sbin - -# 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 - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/sbin/newaliases ${DESTDIR}/usr/sbin/mailq \ - ${DESTDIR}/usr/sbin/hoststat ${DESTDIR}/usr/sbin/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= system -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.AIX.2 b/src/Makefiles/Makefile.AIX.2 deleted file mode 100644 index 047ebb1..0000000 --- a/src/Makefiles/Makefile.AIX.2 +++ /dev/null @@ -1,122 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on AIX/RT V2.2.1 OPSYS level 1773 -# -# @(#)Makefile.AIX.2 8.5 (Berkeley) 8/7/97 -# - -SMROOT= /usr/local/newmail - -# use O=-O (usual) or O=-g (debugging) -O= -g - -# define the database mechanism used for alias lookups: -# -DNDBM -- use new DBM (or GNU dbm) -# -DNEWDB -- use new Berkeley DB (recommended) -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNEWDB -DNIS -# -# If you did not install the NEWDB on your AIX/RT V2 platform, get the latest -# GNU dbm, and use: -#DBMDEF=-DNDBM - -# environment definitions (drag in BSD compatibility) -ENVDEF= -DBSD -DBSD_INCLUDES -DBSD_REMAP_SIGNAL_TO_SIGVEC \ - -D_PATH_SENDMAILCF=\"${SMROOT}/sendmail.cf\" \ - -D_PATH_SENDMAILPID=\"${SMROOT}/sendmail.pid\" - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-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 - -# library directories -#LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -- -# This port uses the AIX/RT BSD compatibility library -lbsd, -# Add to this the location of either the NEWDB package library, or -# the GNU DBM library. the system supplied DBM utilities are ANCIENT. -# -LIBS= -lbsd /u/markw/src/db.1.85/PORT/aixrt/libdb.a /usr/local/lib/libgldavg.a /fs/work/src/bind/res/libresolv.a - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${SMROOT}/bin - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${SMROOT} - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${SMROOT} - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= newaliases mailq hoststat purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= system -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -NROFF= nroff -Tlp -#NROFF= nroff -h -#NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.AIX.4 b/src/Makefiles/Makefile.AIX.4 deleted file mode 100644 index be3cfa4..0000000 --- a/src/Makefiles/Makefile.AIX.4 +++ /dev/null @@ -1,117 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on AIX 3.1.5 and 3.2.3e. -# -# @(#)Makefile.AIX 8.11 (Berkeley) 9/20/96 -# - -# use O=-O (usual) or O=-g (debugging) -# you can use -O3 on AIX 3.2.4 or greater ONLY! -O= -O3 - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNEWDB -DNIS -# -# If you did not install the NEWDB on your AIX platform, use: -#DBMDEF=-DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -D_AIX4 - -# see also conf.h for additional compilation flags - -# include directories -#INCDIRS=-I/usr/sww/include - -# library directories -#LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -- add -ls if you define USEGETCONFATTR -LIBS= -ldbm -ldb -# -# If you did not install the NEWDB on your AIX platform, use: -#LIBS= -ldbm - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/sbin - -# 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 - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/sbin/newaliases ${DESTDIR}/usr/sbin/mailq \ - ${DESTDIR}/usr/sbin/hoststat ${DESTDIR}/usr/sbin/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= system -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.Altos b/src/Makefiles/Makefile.Altos deleted file mode 100644 index 04a344c..0000000 --- a/src/Makefiles/Makefile.Altos +++ /dev/null @@ -1,122 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on Altos System V. -# -# @(#)Makefile.Altos 8.8 (Berkeley) 3/28/97 -# - -# The Altos System V compiler does not understand ANSI -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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DALTOS_SYSTEM_V - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -lsocket -lrpc - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq \ - ${DESTDIR}/usr/bin/hoststat ${DESTDIR}/usr/bin/purgestat -INSTALL=cp -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - -mv ${BINDIR}/sendmail ${BINDIR}/sendmail.old - ${INSTALL} sendmail ${BINDIR} - chown ${BINOWN} ${BINDIR}/sendmail - chgrp ${BINGRP} ${BINDIR}/sendmail - chmod ${BINMODE} ${BINDIR}/sendmail - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - ${INSTALL} /dev/null ${STDIR}/sendmail.st - chown ${BINOWN} ${STDIR}/sendmail.st - chgrp ${BINGRP} ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - ${INSTALL} sendmail.hf ${HFDIR} - chown ${BINOWN} ${HFDIR}/sendmail.hf - chgrp ${BINGRP} ${HFDIR}/sendmail.hf - chmod 444 ${HFDIR}/sendmail.hf - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.BSD-OS b/src/Makefiles/Makefile.BSD-OS deleted file mode 100644 index deb9a1b..0000000 --- a/src/Makefiles/Makefile.BSD-OS +++ /dev/null @@ -1,39 +0,0 @@ -# -# This Makefile is for BSDI boxes running BSD-OS (formerly BSD-386). -# -# @(#)Makefile.BSD-OS 8.7 (Berkeley) 8/7/97 -# - -PROG= sendmail -DBMDEF= -DNEWDB -CFLAGS+=-I${.CURDIR} ${DBMDEF} -DNETISO - -SRCS= alias.c arpadate.c clock.c collect.c conf.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 srvrsmtp.c stab.c stats.c sysexits.c trace.c udb.c \ - usersmtp.c util.c version.c -DPADD= ${LIBUTIL} ${LIBKVM} -LDADD= -lutil -lkvm -MAN1= mailq.0 newaliases.0 -MAN5= aliases.0 -MAN8= sendmail.0 -LINKS= /usr/sbin/sendmail /usr/bin/newaliases \ - /usr/sbin/sendmail /usr/bin/mailq \ - /usr/sbin/sendmail /usr/bin/hoststat \ - /usr/sbin/sendmail /usr/bin/purgestat -INSTALL=install -BINDIR= /usr/sbin -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -beforeinstall: -# ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ -# ${DESTDIR}/etc/sendmail.fc - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ - ${DESTDIR}/var/log/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \ - ${DESTDIR}/usr/share/misc - -.include <bsd.prog.mk> diff --git a/src/Makefiles/Makefile.BSD43 b/src/Makefiles/Makefile.BSD43 deleted file mode 100644 index 9cb506f..0000000 --- a/src/Makefiles/Makefile.BSD43 +++ /dev/null @@ -1,129 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This is based on work from Jim Oldroyd -- I believe he was -# using a fairly old Mt Xinu port. -# -# It should also work on UMIPS-BSD from MIPS, if you still have -# any lying around. -# -# @(#)Makefile.BSD43 8.11 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -O - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DoldBSD43 - -# see also conf.h for additional compilation flags - -# include directories -#INCDIRS=-I/usr/sww/include - -# library directories -#LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -LIBS= -ldbm -lresolv -ll - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -# additional pseudo-sources needed -BEFORE= unistd.h stddef.h stdlib.h dirent.h sys/time.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -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 - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.CLIX b/src/Makefiles/Makefile.CLIX deleted file mode 100644 index 521490f..0000000 --- a/src/Makefiles/Makefile.CLIX +++ /dev/null @@ -1,120 +0,0 @@ -# -# This makefile is for clipper-based Intergraph systems running CLIX. -# It and the defines supporting it in the source tree should be considered -# alpha-quality and used at own risk. -# -# Porting done for CICNet, Inc., on behalf the Michigan State Department -# of Natural Resources. -# -# --Paul Southworth <pauls@cic.net> -# -# @(#)Makefile.CLIX 8.9 (Berkeley) 8/7/97 -# - -# make sure the shell constructs below use the right shell -SHELL= /bin/sh - -# use O=-O (usual) or O=-g (debugging) -O= -O - -CC= gcc - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DCLIX - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= -I/usr/include - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -lnsl -lbsd - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq \ - ${DESTDIR}/usr/bin/hoststat ${DESTDIR}/usr/bin/purgestat -INSTALL=cp -BINOWN= root -BINGRP= mail -BINMODE=4555 - -ALL= sendmail # aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail #install-docs - -install-sendmail: sendmail - #${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR} - ${INSTALL} sendmail ${BINDIR} - chmod ${BINMODE} ${BINDIR}/sendmail - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - #${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ - # ${STDIR}/sendmail.st - ${INSTALL} /dev/null ${STDIR}/sendmail.st - #${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - ${INSTALL} sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail #aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.CSOS b/src/Makefiles/Makefile.CSOS deleted file mode 100644 index 6d6baf4..0000000 --- a/src/Makefiles/Makefile.CSOS +++ /dev/null @@ -1,115 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- which is fine since there is no nroff under CSOS. -# -# Contributed by Scott Bolte <scott@craycos.com>. -# -# @(#)Makefile.CSOS 8.9 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -# Contact CCC for new db support. If all goes well, it should be -# available soon. -# -DBMDEF= - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -#INCDIRS=-I/usr/sww/include - -# loader options -LDOPTS= - -# library directories -#LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -#LIBS= -ldb -ldbm -LIBS= -lnet - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=cpset -BINOWN= root -BINGRP= kmem -BINMODE=4555 -SHELL= /bin/sh - -ALL= sendmail - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail - -install-sendmail: sendmail - ${INSTALL} sendmail ${BINDIR} ${BINMODE} ${BINOWN} ${BINGRP} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - ${INSTALL} /dev/null ${STDIR}/sendmail.st 644 ${BINOWN} ${BINGRP} - ${INSTALL} sendmail.hf ${HFDIR} 444 ${BINOWN} ${BINGRP} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.ConvexOS b/src/Makefiles/Makefile.ConvexOS deleted file mode 100644 index f4a814f..0000000 --- a/src/Makefiles/Makefile.ConvexOS +++ /dev/null @@ -1,116 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on CxOS 11.0 beta 1 and 10.x. -# -# @(#)Makefile.ConvexOS 8.14 (Berkeley) 8/7/97 -# - - -# use O=-O (usual) or O=-g (debugging) -O= -g -D__STDC__ -d non_int_bit_field - -# 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DYPCOMPAT -DNIS - -# environment definitions (e.g., -D_AIX3) -# -D_ACL and -D_AUDIT are needed for SecureWare/SecureOS on ConvexOS -#ENVDEF=-D_ACL -D_AUDIT -DSECUREWARE -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -#INCDIRS=-I/usr/sww/include - -# library directories -#LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -# -lshare is for the Fair Share Scheduler -# -lprot is for the SecureWare hooks -#LIBS= -lshare -lprot -LIBS= -lshare - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -NROFF= nroff -h -#NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.Dell b/src/Makefiles/Makefile.Dell deleted file mode 100644 index 06f31e3..0000000 --- a/src/Makefiles/Makefile.Dell +++ /dev/null @@ -1,118 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# Based on a Makefile for Dell SVR4 Issue 2.2 from Kimmo Suominen -# <kim@grendel.lut.fi> -- I haven't tested this myself. It may -# work on other SVR4 ports. -# -# @(#)Makefile.Dell 8.10 (Berkeley) 8/7/97 -# - -# make sure the shell constructs below use the right shell -SHELL= /bin/sh - -# use O=-O (usual) or O=-g (debugging) -O= -O2 - -CC= gcc -#DESTDIR=/usr/local/sendmail - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNEWDB -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -D__svr4__ - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -ldb -ldbm -lresolv -lsocket -lnsl -lelf - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/ucblib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= mail -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.DomainOS b/src/Makefiles/Makefile.DomainOS deleted file mode 100644 index f46682c..0000000 --- a/src/Makefiles/Makefile.DomainOS +++ /dev/null @@ -1,129 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on DomainOS 10.3.5 -# -# @(#)Makefile.DomainOS 8.13 (Berkeley) 8/7/97 -# -# - -# 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. -# If YPCOMPAT is defined and /var/yp/Makefile exists, sendmail will build -# both the NEWDB and DBM libraries (the DBM just for YP). -# - -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# loader options -LDOPTS= - -# library directories -LIBDIRS= - -# libraries required on your system -# You might want to use the BIND 4.9 resolver library here -#LIBS= -ldb -LIBS= -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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -# additional pseudo-sources needed -BEFORE= unistd.h dirent.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. -A nansi $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -unistd.h: - cp /dev/null unistd.h - -dirent.h: - echo "#include <sys/dir.h>" > dirent.h - echo "#define dirent direct" >> dirent.h - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.Dynix b/src/Makefiles/Makefile.Dynix deleted file mode 100644 index 63c454a..0000000 --- a/src/Makefiles/Makefile.Dynix +++ /dev/null @@ -1,119 +0,0 @@ -# -# Tested on Dynix 3.2.0. -# -# From Jim Davis <jdavis@cs.arizona.edu>. -# -# ``There is no strtol in libc (well there is in the 'att universe' -# libc, but I couldn't figure out how to link that in), so I -# got the Chris Torek strtol.c from bsd-sources on uunet and -# compiled that. There is no native ndbm either; I couldn't -# get db 1.72 to pass it's regression test, so I used gdbm-1.7 -# instead. I compiled it with gcc 1.40a. The -lseq is to pick -# up getopt.'' -# -# @(#)Makefile.Dynix 8.10 (Berkeley) 7/6/97 -# - -CC= gcc - -# use O=-O (usual) or O=-g (debugging) -O= -O -g - -# 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 READ_ME for a description of how these flags interact. -# -DBMDEF= - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# loader options -LDOPTS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -lseq - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD=strtol.o - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= staff # no kmem group, -BINMODE=4555 # so not setgid - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.EWS-UX_V b/src/Makefiles/Makefile.EWS-UX_V deleted file mode 100644 index e97d2be..0000000 --- a/src/Makefiles/Makefile.EWS-UX_V +++ /dev/null @@ -1,133 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on NEC EWS-UX/V 4.2 -# -# @(#)Makefile.EWS-UX_V 8.8 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -O - -# make sure that /usr/abiccs/bin/cc is used (do not use /usr/ucb/cc). -#CC= /bin/cc -KOlimit=900 -CC= /usr/abiccs/bin/cc -KOlimit=900 - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -Dnec_ews_svr4 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -# delete -l44bsd if you are not running BIND 4.9.x -LIBS= ndbm.o -lsocket -lnsl -lelf -lresolv # -l44bsd # with NDBM -#LIBS= -lsocket -lnsl -lelf -ldb -lresolv # -l44bsd # with NEWDB - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/var/ucblib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/var/ucblib - -# additional .o files needed -OBJADD= - -# things to be made before compilation begins -BEFORE= sysexits.h ndbm.h ndbm.o - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -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 - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.FreeBSD b/src/Makefiles/Makefile.FreeBSD deleted file mode 100644 index f3ae29a..0000000 --- a/src/Makefiles/Makefile.FreeBSD +++ /dev/null @@ -1,52 +0,0 @@ -# -# Makefile for FreeBSD -# -# @(#)Makefile.FreeBSD 8.8 (Berkeley) 8/7/97 - -PROG= sendmail - -# define the database format to use for aliases et al. Can be -DNEWDB (for -# the new BSD database package -- this is preferred) or -DNDBM for the NDBM -# database package. The old putrescent V7 DBM package is no longer -# supported. -# You can define both NEWDB and NDBM during a transition period; old -# databases are read, but the new format will be used on any rebuilds. On -# really gnarly systems, you can set this to null; it will crawl like a high -# spiral snail, but it will work. -DBMDEF= -DNEWDB -DNIS - -CFLAGS+=-I${.CURDIR} ${DBMDEF} - -SRCS= alias.c arpadate.c clock.c collect.c conf.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 srvrsmtp.c stab.c stats.c sysexits.c trace.c udb.c \ - usersmtp.c util.c version.c -DPADD= ${LIBUTIL} -LDADD= -lutil -# -# FreeBSD 1.0 RELEASE has GNU man and doesn't need preformatted man pages anymore -# (assuming you consider a slower "man" command a feature) -# -MAN1= mailq.1 newaliases.1 -MAN5= aliases.5 -MAN8= sendmail.8 -LINKS= /usr/sbin/sendmail /usr/bin/newaliases \ - /usr/sbin/sendmail /usr/bin/mailq \ - /usr/sbin/sendmail /usr/bin/hoststat \ - /usr/sbin/sendmail /usr/bin/purgestat -INSTALL=install -BINDIR= /usr/sbin -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -beforeinstall: -# ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ -# ${DESTDIR}/etc/sendmail.fc - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ - ${DESTDIR}/var/log/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \ - ${DESTDIR}/usr/share/misc - -.include <bsd.prog.mk> diff --git a/src/Makefiles/Makefile.HP-UX b/src/Makefiles/Makefile.HP-UX deleted file mode 100644 index 5745386..0000000 --- a/src/Makefiles/Makefile.HP-UX +++ /dev/null @@ -1,115 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on HP-UX 9.05 on 7xx series and HP-UX 9.04 -# on 8xx series. -# -# @(#)Makefile.HP-UX 8.17 (Berkeley) 8/7/97 -# - -CC= cc -Aa -D_HPUX_SOURCE - -# use O=-O (usual) or O=-g (debugging) -# +O is OK on 7xx, and 300xx at 9.0 -O= +O1 - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNEWDB -DNIS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -# delete -lresolv if you are not running BIND 4.9.x -LIBS= -ldb -lndbm -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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq \ - ${DESTDIR}/usr/bin/hoststat ${DESTDIR}/usr/bin/purgestat -INSTALL=install -BINOWN= root -BINGRP= mail -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - cpset sendmail ${BINDIR} ${BINMODE} ${BINOWN} ${BINGRP} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cpset /dev/null ${STDIR}/sendmail.st 644 ${BINOWN} ${BINGRP} - cpset sendmail.hf ${HFDIR} 444 ${BINOWN} ${BINGRP} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.HP-UX.10.x b/src/Makefiles/Makefile.HP-UX.10.x deleted file mode 100644 index 87b8f3a..0000000 --- a/src/Makefiles/Makefile.HP-UX.10.x +++ /dev/null @@ -1,115 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on HP-UX 10.x. Changes for 10.0 contributed -# by John Beck of Hewlett-Packard. -# -# @(#)Makefile.HP-UX.10.x 8.11 (Berkeley) 8/7/97 -# - -CC= cc -Aa -D_HPUX_SOURCE - -# use O=-O (usual) or O=-g (debugging) -# +O is OK on 7xx, and 300xx at 9.0 -O= +O3 - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNEWDB -DNIS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DV4FS - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -# delete -lresolv if you are not running BIND 4.9.x -LIBS= -ldb -lndbm -lresolv - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/sbin - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/etc/mail - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/share/lib - -# additional .o files needed -OBJADD= - - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq \ - ${DESTDIR}/usr/bin/hoststat ${DESTDIR}/usr/bin/purgestat -INSTALL=install -BINOWN= root -BINGRP= mail -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - cpset sendmail ${BINDIR} ${BINMODE} ${BINOWN} ${BINGRP} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cpset /dev/null ${STDIR}/sendmail.st 644 ${BINOWN} ${BINGRP} - cpset sendmail.hf ${HFDIR} 444 ${BINOWN} ${BINGRP} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.IRIX b/src/Makefiles/Makefile.IRIX deleted file mode 100644 index 4235f02..0000000 --- a/src/Makefiles/Makefile.IRIX +++ /dev/null @@ -1,114 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on IRIX 4.0.4. -# -# @(#)Makefile.IRIX 8.15 (Berkeley) 8/7/97 -# -SHELL= /bin/sh - -# 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 (requires -ldb) -# -DNIS -- include NIS support (requires -lsun) -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DIRIX - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -# If running bind-4.9.5, you may need to remove -lsun -LIBS= -lmld -lmalloc -lsun - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bsd/newaliases ${DESTDIR}/usr/bsd/mailq \ - ${DESTDIR}/usr/bsd/hoststat ${DESTDIR}/usr/bsd/purgestat -INSTALL=install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -u ${BINOWN} -g ${BINGRP} -m ${BINMODE} -f ${BINDIR} sendmail - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - chown ${BINOWN} ${STDIR}/sendmail.st - chgrp ${BINGRP} ${STDIR}/sendmail.st - ${INSTALL} -u ${BINOWN} -g ${BINGRP} -m 444 -f ${HFDIR} sendmail.hf - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.IRIX.5.x b/src/Makefiles/Makefile.IRIX.5.x deleted file mode 100644 index 76b25b6..0000000 --- a/src/Makefiles/Makefile.IRIX.5.x +++ /dev/null @@ -1,112 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. -# -# Tested on IRIX 5.3 by Kari E. Hurtta <Kari.Hurtta@fmi.fi>. -# -# @(#)Makefile.IRIX.5.x 8.11 (Berkeley) 3/28/97 -# -SHELL= /bin/sh - -# 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 (requires -ldb) -# -DNIS -- include NIS support (requires -lsun) -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -# N.B.: Include -D__BIT_TYPES_DEFINED__ if you use -DNEWDB! -# -DBMDEF= -DNDBM -DNIS -#DBMDEF= -DNDBM -DNIS -DNEWDB -D__BIT_TYPES_DEFINED__ - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DIRIX5 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -lmld -lmalloc - -# 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}/var - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/etc - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bsd/newaliases ${DESTDIR}/usr/bsd/mailq \ - ${DESTDIR}/usr/bsd/hoststat ${DESTDIR}/usr/bsd/purgestat -INSTALL=install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -u ${BINOWN} -g ${BINGRP} -m ${BINMODE} -f ${BINDIR} sendmail - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - chown ${BINOWN} ${STDIR}/sendmail.st - chgrp ${BINGRP} ${STDIR}/sendmail.st - ${INSTALL} -u ${BINOWN} -g ${BINGRP} -m 444 -f ${HFDIR} sendmail.hf - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.IRIX.6.x b/src/Makefiles/Makefile.IRIX.6.x deleted file mode 100644 index ed09ab0..0000000 --- a/src/Makefiles/Makefile.IRIX.6.x +++ /dev/null @@ -1,134 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# IRIX 6.2 is successor of IRIX 5.3. It combines 64bit IRIX 6.[01] and -# 32bit IRIX 5.x. -# -# IRIX 6.2 support provided by Kari Hurtta <Kari.Hurtta@dionysos.fmi.fi>. -# -# @(#)Makefile.IRIX.6.x 8.5 (Berkeley) 4/7/97 -# -SHELL= /bin/sh - -# use O=-O (usual) or O=-g (debugging) -O= -O - -# 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 -ABI= -n32 - -# define the database mechanisms available for map & alias lookups: -# -DNDBM -- use new DBM -# -DNEWDB -- use new Berkeley DB (requires -ldb) -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -# N.B.: Include -D__BIT_TYPES_DEFINED__ if you use -DNEWDB! -# -DBMDEF= -DNDBM -DNIS -#DBMDEF= -DNDBM -DNIS -DNEWDB -D__BIT_TYPES_DEFINED__ - -# environment definitions (e.g., -D_AIX3) -# -DIRIX6 is needed, if you use ABI=-32 -# (or conf.h can't make difference between IRIX 5.3 and IRIX 6.2) -ENVDEF= -DIRIX6 ${ABI} - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -lelf - -# loader options -LDOPTS= ${ABI} - -# 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}/var - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/etc - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bsd/newaliases ${DESTDIR}/usr/bsd/mailq \ - ${DESTDIR}/usr/bsd/hoststat ${DESTDIR}/usr/bsd/purgestat -INSTALL=install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -u ${BINOWN} -g ${BINGRP} -m ${BINMODE} -f ${BINDIR} sendmail - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - chown ${BINOWN} ${STDIR}/sendmail.st - chgrp ${BINGRP} ${STDIR}/sendmail.st - ${INSTALL} -u ${BINOWN} -g ${BINGRP} -m 444 -f ${HFDIR} sendmail.hf - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.IRIX64.6.0 b/src/Makefiles/Makefile.IRIX64.6.0 deleted file mode 100644 index 4d405ab..0000000 --- a/src/Makefiles/Makefile.IRIX64.6.0 +++ /dev/null @@ -1,114 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on IRIX64 6.0. -# Changes from Mark R. Levinson <ml@cvdev.rochester.edu>. -# -# @(#)Makefile.IRIX64.6.0 8.8 (Berkeley) 8/7/97 -# -SHELL= /bin/sh - -# 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 (requires -ldb) -# -DNIS -- include NIS support (requires -lsun) -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DIRIX64 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -lelf -lmalloc - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bsd/newaliases ${DESTDIR}/usr/bsd/mailq \ - ${DESTDIR}/usr/bsd/hoststat ${DESTDIR}/usr/bsd/purgestat -INSTALL=install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -u ${BINOWN} -g ${BINGRP} -m ${BINMODE} -f ${BINDIR} sendmail - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - chown ${BINOWN} ${STDIR}/sendmail.st - chgrp ${BINGRP} ${STDIR}/sendmail.st - ${INSTALL} -u ${BINOWN} -g ${BINGRP} -m 444 -f ${HFDIR} sendmail.hf - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.IRIX64.6.1 b/src/Makefiles/Makefile.IRIX64.6.1 deleted file mode 100644 index 4d405ab..0000000 --- a/src/Makefiles/Makefile.IRIX64.6.1 +++ /dev/null @@ -1,114 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on IRIX64 6.0. -# Changes from Mark R. Levinson <ml@cvdev.rochester.edu>. -# -# @(#)Makefile.IRIX64.6.0 8.8 (Berkeley) 8/7/97 -# -SHELL= /bin/sh - -# 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 (requires -ldb) -# -DNIS -- include NIS support (requires -lsun) -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DIRIX64 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -lelf -lmalloc - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bsd/newaliases ${DESTDIR}/usr/bsd/mailq \ - ${DESTDIR}/usr/bsd/hoststat ${DESTDIR}/usr/bsd/purgestat -INSTALL=install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -u ${BINOWN} -g ${BINGRP} -m ${BINMODE} -f ${BINDIR} sendmail - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - chown ${BINOWN} ${STDIR}/sendmail.st - chgrp ${BINGRP} ${STDIR}/sendmail.st - ${INSTALL} -u ${BINOWN} -g ${BINGRP} -m 444 -f ${HFDIR} sendmail.hf - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.IRIX64.6.x b/src/Makefiles/Makefile.IRIX64.6.x deleted file mode 100644 index ed09ab0..0000000 --- a/src/Makefiles/Makefile.IRIX64.6.x +++ /dev/null @@ -1,134 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# IRIX 6.2 is successor of IRIX 5.3. It combines 64bit IRIX 6.[01] and -# 32bit IRIX 5.x. -# -# IRIX 6.2 support provided by Kari Hurtta <Kari.Hurtta@dionysos.fmi.fi>. -# -# @(#)Makefile.IRIX.6.x 8.5 (Berkeley) 4/7/97 -# -SHELL= /bin/sh - -# use O=-O (usual) or O=-g (debugging) -O= -O - -# 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 -ABI= -n32 - -# define the database mechanisms available for map & alias lookups: -# -DNDBM -- use new DBM -# -DNEWDB -- use new Berkeley DB (requires -ldb) -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -# N.B.: Include -D__BIT_TYPES_DEFINED__ if you use -DNEWDB! -# -DBMDEF= -DNDBM -DNIS -#DBMDEF= -DNDBM -DNIS -DNEWDB -D__BIT_TYPES_DEFINED__ - -# environment definitions (e.g., -D_AIX3) -# -DIRIX6 is needed, if you use ABI=-32 -# (or conf.h can't make difference between IRIX 5.3 and IRIX 6.2) -ENVDEF= -DIRIX6 ${ABI} - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -lelf - -# loader options -LDOPTS= ${ABI} - -# 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}/var - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/etc - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bsd/newaliases ${DESTDIR}/usr/bsd/mailq \ - ${DESTDIR}/usr/bsd/hoststat ${DESTDIR}/usr/bsd/purgestat -INSTALL=install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -u ${BINOWN} -g ${BINGRP} -m ${BINMODE} -f ${BINDIR} sendmail - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - chown ${BINOWN} ${STDIR}/sendmail.st - chgrp ${BINGRP} ${STDIR}/sendmail.st - ${INSTALL} -u ${BINOWN} -g ${BINGRP} -m 444 -f ${HFDIR} sendmail.hf - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.ISC b/src/Makefiles/Makefile.ISC deleted file mode 100644 index 04f8bf4..0000000 --- a/src/Makefiles/Makefile.ISC +++ /dev/null @@ -1,109 +0,0 @@ -# -# Makefile for ISC (SunSoft) UNIX. -# -# Contributed by J.J. Bailey <jjb@jagware.bcc.com> -# -# @(#)Makefile.ISC 8.11 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DISC_UNIX -D_POSIX_SOURCE -D_SYSV3 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/local/include - -# loader options -LDOPTS= - -# library directories -LIBDIRS=-L/usr/local/lib - -# libraries required on your system -LIBS= -lyp -lrpc -lndbm -linet -lcposix - -# 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}/usr/spool/log - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.KSR b/src/Makefiles/Makefile.KSR deleted file mode 100644 index 291b19c..0000000 --- a/src/Makefiles/Makefile.KSR +++ /dev/null @@ -1,113 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on KSR OS 1.2.2. Contributed by Todd C. Miller -# <Todd.Miller@cs.colorado.edu> -# -# @(#)Makefile.KSR 8.5 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -O - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNEWDB -DNIS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# library directories -LIBDIRS=-L/usr/sww/lib -L/usr/shlib -L/usr/lib - -# libraries required on your system -# delete -lresolv if you are not running BIND 4.9.x -LIBS= -ldbm -ldb -lresolv - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/sbin - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/var/adm/sendmail - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/share/lib - -# additional .o files needed -OBJADD= - - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${BINDIR}/newaliases ${BINDIR}/mailq \ - ${BINDIR}/hoststat ${BINDIR}/purgestat -INSTALL=installbsd -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDADD} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - chown ${BINOWN}.${BINGRP} ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - rm -f /usr/sbin/smtpd - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h diff --git a/src/Makefiles/Makefile.LUNA b/src/Makefiles/Makefile.LUNA deleted file mode 100644 index 9fdc842..0000000 --- a/src/Makefiles/Makefile.LUNA +++ /dev/null @@ -1,148 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# @(#)Makefile.LUNA 8.8 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# loader options -LDOPTS= - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -LIBS= - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -# additional pseudo-sources needed -BEFORE= dirent.h stddef.h stdlib.h unistd.h limits.h time.h sys/time.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -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 - -NROFF= nroff -h - -aliases.0: aliases.5 - ${NROFF} -mandoc aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} -mandoc mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} -mandoc newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} -mandoc sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.Linux b/src/Makefiles/Makefile.Linux deleted file mode 100644 index 0b91323..0000000 --- a/src/Makefiles/Makefile.Linux +++ /dev/null @@ -1,137 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on Linux 0.99p10. -# -# Linux doesn't really have standard places to install things, so this -# Makefile is likely to require a lot of customization. Read it over -# carefully before proceeding. -# -# If you don't want to install the Berkeley db package, remove -DNEWDB -# from DBMDEF and -ldb from LIBS (but please consider installing it; see -# the READ_ME file for details). -# -# This assumes libc 4.7.0 or later. If you have an earlier version of -# the library, you may need to add -lbsd to LIBS *or* add -DHASSNPRINTF=0 -# to ENVDEF. If you are running libc < 4.4.4, you must use -DHASSNPRINTF=0 -# (or upgrade your libc -- an even better idea!). -# -# @(#)Makefile.Linux 8.20 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNEWDB - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/local/include - -# library directories -LIBDIRS=-L/usr/local/lib - -# libraries required on your system -# you may need to add -lresolv if you've installed BIND on -# your system (see the BIND section for linux in src/READ_ME) -LIBS= -ldb - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/sbin - -# 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 - -# additional .o files needed -OBJADD= - -# additional pseudo-sources needed -BEFORE= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq \ - ${DESTDIR}/usr/bin/hoststat ${DESTDIR}/usr/bin/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -unistd.h: - cp /dev/null unistd.h - -dirent.h: - echo "#include <sys/dir.h>" > dirent.h - echo "#define dirent direct" >> dirent.h - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - chown ${BINOWN} ${STDIR}/sendmail.st - chgrp ${BINGRP} ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.Linux.ppc b/src/Makefiles/Makefile.Linux.ppc deleted file mode 100644 index e518f71..0000000 --- a/src/Makefiles/Makefile.Linux.ppc +++ /dev/null @@ -1,139 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on Linux 0.99p10. -# -# Linux doesn't really have standard places to install things, so this -# Makefile is likely to require a lot of customization. Read it over -# carefully before proceeding. -# -# If you don't want to install the Berkeley db package, remove -DNEWDB -# from DBMDEF and -ldb from LIBS (but please consider installing it; see -# the READ_ME file for details). -# -# This assumes libc 4.7.0 or later. If you have an earlier version of -# the library, you may need to add -lbsd to LIBS *or* add -DHASSNPRINTF=0 -# to ENVDEF. If you are running libc < 4.4.4, you must use -DHASSNPRINTF=0 -# (or upgrade your libc -- an even better idea!). -# -# This Makefile contributed by Paul DuBois <dubois@primate.wisc.edu>. -# -# @(#)Makefile.Linux.ppc 8.4 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNEWDB - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/local/include - -# library directories -LIBDIRS=-L/usr/local/lib - -# libraries required on your system -# you may need to add -lresolv if you've installed BIND on -# your system (see the BIND section for linux in src/READ_ME) -LIBS= -ldb - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/sbin - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/var/log - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -# additional pseudo-sources needed -BEFORE= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq \ - ${DESTDIR}/usr/bin/hoststat ${DESTDIR}/usr/bin/purgestat -INSTALL=install -BINOWN= root -BINGRP= mail -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -unistd.h: - cp /dev/null unistd.h - -dirent.h: - echo "#include <sys/dir.h>" > dirent.h - echo "#define dirent direct" >> dirent.h - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - chown ${BINOWN} ${STDIR}/sendmail.st - chgrp ${BINGRP} ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.Mach386 b/src/Makefiles/Makefile.Mach386 deleted file mode 100644 index c1c4335..0000000 --- a/src/Makefiles/Makefile.Mach386 +++ /dev/null @@ -1,113 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# @(#)Makefile.Mach386 8.10 (Berkeley) 8/7/97 -# - -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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# loader options -LDOPTS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -ldbm - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.NCR.MP-RAS.2.x b/src/Makefiles/Makefile.NCR.MP-RAS.2.x deleted file mode 100644 index 65ba6ac..0000000 --- a/src/Makefiles/Makefile.NCR.MP-RAS.2.x +++ /dev/null @@ -1,114 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# NCR 3000 support from Kevin Darcy <kevin@tech.mis.cfc.com> -# and Tom Moore <tmoore@fievel.DaytonOH.NCR.COM>. -# -# @(#)Makefile.NCR.MP-RAS.2.x 8.17 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -O2 - -# 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DNCR_MP_RAS2 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/include -I/usr/ucbinclude - -# loader options -LDOPTS= - -# library directories -LIBDIRS=-L/usr/ucblib - -# libraries required on your system -LIBS= -lnsl -lnet -lsocket -lelf -lc -lucb - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/var/ucblib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/ucblib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -NROFF= /usr/ucb/nroff -h -#NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.NCR.MP-RAS.3.x b/src/Makefiles/Makefile.NCR.MP-RAS.3.x deleted file mode 100644 index aa63826..0000000 --- a/src/Makefiles/Makefile.NCR.MP-RAS.3.x +++ /dev/null @@ -1,114 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# NCR SVR4 MP-RAS 3.x support from -# Tom Moore <tmoore@fievel.DaytonOH.NCR.COM>. -# -# @(#)Makefile.NCR.MP-RAS.3.x 8.7 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -O2 - -# 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DNCR_MP_RAS3 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/include -I/usr/ucbinclude - -# loader options -LDOPTS= - -# library directories -LIBDIRS=-L/usr/ucblib - -# libraries required on your system -LIBS= -lsocket -lnsl -lresolv -lelf -lc -lucb - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/var/ucblib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/ucblib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -NROFF= /usr/ucb/nroff -h -#NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.NEWS-OS.4.x b/src/Makefiles/Makefile.NEWS-OS.4.x deleted file mode 100644 index 0a76a1f..0000000 --- a/src/Makefiles/Makefile.NEWS-OS.4.x +++ /dev/null @@ -1,120 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# @(#)Makefile.NEWS-OS.4.x 8.9 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -O - -# native compiler on RISC OS requires -Olimit to optimize properly -#CC= cc -Olimit 1100 - -# 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# loader options -LDOPTS= - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -LIBS= -lmld - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -# things to be made before compilation begins -BEFORE= limits.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -limits.h: - touch limits.h - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.NEWS-OS.6.x b/src/Makefiles/Makefile.NEWS-OS.6.x deleted file mode 100644 index 9f257af..0000000 --- a/src/Makefiles/Makefile.NEWS-OS.6.x +++ /dev/null @@ -1,134 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on NEWS-OS 6.0.3 -# -# @(#)Makefile.NEWS-OS.6.x 8.8 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= - -# make sure that /bin/cc is used (do not use /usr/ucb/cc). -CC= /bin/cc - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS - -# environment definitions (e.g., -D_AIX3) -# define SYSLOG_BUFSIZE=256 if you have a problem on syslog buffer size -# define SPT_TYPE=SPT_NONE if you are using NEWS-OS 6.0.1 -ENVDEF= -DSYSLOG_BUFSIZE=256 # -DSPT_TYPE=SPT_NONE - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -# delete -l44bsd if you are not running BIND 4.9.x -# -lndbm can be used instead of ndbm.o with NEWS-OS 6.1 or later -LIBS= ndbm.o -lelf -lsocket -lnsl -lresolv # -l44bsd # with NDBM -#LIBS= -lelf -lsocket -lnsl -ldb -lresolv # -l44bsd # with NEWDB - -# 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 - -# additional .o files needed -OBJADD= - -# things to be made before compilation begins -BEFORE= sysexits.h ndbm.o - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -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; - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.NeXT.2.x b/src/Makefiles/Makefile.NeXT.2.x deleted file mode 100644 index 85c3e2e..0000000 --- a/src/Makefiles/Makefile.NeXT.2.x +++ /dev/null @@ -1,123 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on NeXT 2.1. -# -# @(#)Makefile.NeXT.2.x 8.13 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS -DNETINFO -#DBMDEF= -DNDBM -DNEWDB -DNIS -DNETINFO - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DNeXT - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/local/include - -# library directories -LIBDIRS=-L/usr/local/lib - -# libraries required on your system -LIBS= -ldbm -#LIBS= -ldbm -ldb - -# 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/sendmail - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -# additional pseudo-sources needed -BEFORE= unistd.h dirent.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} ${COPTS} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -unistd.h: - cp /dev/null unistd.h - -dirent.h: - echo "#include <sys/dir.h>" > dirent.h - echo "#define dirent direct" >> dirent.h - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -s -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chown ${BINOWN}.${BINGRP} ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.NeXT.3.x b/src/Makefiles/Makefile.NeXT.3.x deleted file mode 100644 index 3f976e8..0000000 --- a/src/Makefiles/Makefile.NeXT.3.x +++ /dev/null @@ -1,131 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on NEXTSTEP 3.3. -# -# @(#)Makefile.NeXT.3.x 8.8 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -O - -# 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} - -COPTS= -Wno-precomp -pipe - -# define the database mechanisms available for map & alias lookups: -# -DNDBM -- use new DBM -# -DNEWDB -- use new Berkeley DB -# -DNIS -- include NIS support -# -DNETINFO -- include NETINFO support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS -DNETINFO -#DBMDEF= -DNDBM -DNEWDB -DNIS -DNETINFO - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DNeXT - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/local/include - -# library directories -LIBDIRS=-L/usr/local/lib - -# libraries required on your system -LIBS= -ldbm -#LIBS= -ldbm -ldb - -# 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/sendmail - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -# additional pseudo-sources needed -BEFORE= unistd.h dirent.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} ${COPTS} ${ARCH} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} ${ARCH} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -unistd.h: - cp /dev/null unistd.h - -dirent.h: - echo "#include <sys/dir.h>" > dirent.h - echo "#define dirent direct" >> dirent.h - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -s -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chown ${BINOWN}.${BINGRP} ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${BEFORE} ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.NetBSD b/src/Makefiles/Makefile.NetBSD deleted file mode 100644 index 9635243..0000000 --- a/src/Makefiles/Makefile.NetBSD +++ /dev/null @@ -1,49 +0,0 @@ -# -# NetBSD Makefile -# -# @(#)Makefile.NetBSD 8.7 (Berkeley) 8/7/97 -# @Id: Makefile.NetBSD,v 1.3 1994/02/01 05:33:44 glass Exp $ -# - -PROG= sendmail - -# define the database format to use for aliases et al. Can be -DNEWDB (for -# the new BSD database package -- this is preferred) or -DNDBM for the NDBM -# database package. The old putrescent V7 DBM package is no longer -# supported. -# You can define both NEWDB and NDBM during a transition period; old -# databases are read, but the new format will be used on any rebuilds. On -# really gnarly systems, you can set this to null; it will crawl like a high -# spiral snail, but it will work. -DBMDEF= -DNEWDB -DNIS - -CFLAGS+=-I${.CURDIR} ${DBMDEF} -DNETISO - -SRCS= alias.c arpadate.c clock.c collect.c conf.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 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 -#MAN1= mailq.0 newaliases.0 -#MAN5= aliases.0 -#MAN8= sendmail.0 -LINKS= /usr/sbin/sendmail /usr/bin/newaliases \ - /usr/sbin/sendmail /usr/bin/mailq \ - /usr/sbin/sendmail /usr/bin/hoststat \ - /usr/sbin/sendmail /usr/bin/purgestat -INSTALL=install -BINDIR= /usr/sbin -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -beforeinstall: -# ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ -# ${DESTDIR}/etc/sendmail.fc - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ - ${DESTDIR}/var/log/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \ - ${DESTDIR}/usr/share/misc - -.include <bsd.prog.mk> diff --git a/src/Makefiles/Makefile.NonStop-UX b/src/Makefiles/Makefile.NonStop-UX deleted file mode 100644 index 56f3f18..0000000 --- a/src/Makefiles/Makefile.NonStop-UX +++ /dev/null @@ -1,117 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# Tandem Support from Rick McCarty <mccarty@mpd.tandem.com>. -# (I don't think this actually compiles cleanly -- I had trouble -# integrating Rick's changes. EPA 6/94) -# -# @(#)Makefile.NonStop-UX 8.9 (Berkeley) 8/7/97 -# - -# make sure the shell constructs below use the right shell -SHELL= /bin/sh - -# use O=-O (usual) or O=-g (debugging) -O= -O - -CC= gcc - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DNonStop_UX_BXX -D_SVID - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/include -I/usr/ucbinclude - -# library directories -LIBDIRS=-L/usr/ucblib - -# libraries required on your system -LIBS= -lresolv -lsocket -lnsl -lelf -lucb - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/ucblib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= mail -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.OSF1 b/src/Makefiles/Makefile.OSF1 deleted file mode 100644 index 848d084..0000000 --- a/src/Makefiles/Makefile.OSF1 +++ /dev/null @@ -1,119 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on OSF/1 1.3 -# -# @(#)Makefile.OSF1 8.12 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -O - -# native compiler requires -Olimit to optimize properly -CC= cc -Olimit 1000 - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNEWDB -DNIS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# library directories -LIBDIRS=-L/usr/sww/lib -L/usr/shlib -L/usr/lib - -# libraries required on your system -# delete -lresolv if you are not running BIND 4.9.x -LIBS= -ldbm -ldb -lresolv - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/sbin - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/var/adm/sendmail - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/share/lib - -# additional .o files needed -OBJADD= - -# additional link flags -#LDADD= -non_shared - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${BINDIR}/newaliases ${BINDIR}/mailq \ - ${BINDIR}/hoststat ${BINDIR}/purgestat -INSTALL=installbsd -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDADD} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - chown ${BINOWN}.${BINGRP} ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - rm -f /usr/sbin/smtpd - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.OpenBSD b/src/Makefiles/Makefile.OpenBSD deleted file mode 100644 index 22b80da..0000000 --- a/src/Makefiles/Makefile.OpenBSD +++ /dev/null @@ -1,48 +0,0 @@ -# -# OpenBSD Makefile -# -# @(#)Makefile.OpenBSD 8.2 (Berkeley) 8/7/97 -# - -PROG= sendmail - -# define the database format to use for aliases et al. Can be -DNEWDB (for -# the new BSD database package -- this is preferred) or -DNDBM for the NDBM -# database package. The old putrescent V7 DBM package is no longer -# supported. -# You can define both NEWDB and NDBM during a transition period; old -# databases are read, but the new format will be used on any rebuilds. On -# really gnarly systems, you can set this to null; it will crawl like a high -# spiral snail, but it will work. -DBMDEF= -DNEWDB -DNIS - -CFLAGS+=-I${.CURDIR} ${DBMDEF} -DNETISO - -SRCS= alias.c arpadate.c clock.c collect.c conf.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 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 -#MAN1= mailq.0 newaliases.0 -#MAN5= aliases.0 -#MAN8= sendmail.0 -LINKS= /usr/sbin/sendmail /usr/bin/newaliases \ - /usr/sbin/sendmail /usr/bin/mailq \ - /usr/sbin/sendmail /usr/bin/hoststat \ - /usr/sbin/sendmail /usr/bin/purgestat -INSTALL=install -BINDIR= /usr/sbin -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -beforeinstall: -# ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ -# ${DESTDIR}/etc/sendmail.fc - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ - ${DESTDIR}/var/log/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \ - ${DESTDIR}/usr/share/misc - -.include <bsd.prog.mk> diff --git a/src/Makefiles/Makefile.PTX b/src/Makefiles/Makefile.PTX deleted file mode 100644 index a833582..0000000 --- a/src/Makefiles/Makefile.PTX +++ /dev/null @@ -1,118 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# For Sequent DYNIX/ptx. -# -# From Tim "Pinball Wizard" Wright <timw@sequent.com>. -# -# @(#)Makefile.PTX 8.12 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -g - -# 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -#INCDIRS=-I/usr/sww/include -INCDIRS= - -# loader options -LDOPTS= - -# library directories -#LIBDIRS=-L/usr/sww/lib -LIBDIRS= - -# libraries required on your system -#LIBS= -ldb -ldbm -LIBS= -lsocket -linet -lelf -lnsl -lseq - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq \ - ${DESTDIR}/usr/bin/hoststat ${DESTDIR}/usr/bin/purgestat -INSTALL=install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: $& ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.Paragon b/src/Makefiles/Makefile.Paragon deleted file mode 100644 index 4eafb43..0000000 --- a/src/Makefiles/Makefile.Paragon +++ /dev/null @@ -1,116 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on OSF/1 1.3 -# -# @(#)Makefile.Paragon 8.9 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -O - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# library directories -LIBDIRS=-L/usr/sww/lib -L/usr/shlib -L/usr/lib - -# libraries required on your system -LIBS= -ldbm - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/sbin - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/var/adm/sendmail - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/share/lib - -# additional .o files needed -OBJADD= - -# additional link flags -#LDADD= -non_shared - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${BINDIR}/newaliases ${BINDIR}/mailq \ - ${BINDIR}/hoststat ${BINDIR}/purgestat -INSTALL=installbsd -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDADD} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} sendmail ${BINDIR} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - chown ${BINOWN} ${STDIR}/sendmail.st - chgrp ${BINGRP} ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - rm -f /usr/sbin/smtpd - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.PowerUX b/src/Makefiles/Makefile.PowerUX deleted file mode 100644 index 1ccb2d3..0000000 --- a/src/Makefiles/Makefile.PowerUX +++ /dev/null @@ -1,126 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# @(#)Makefile.PowerUX 8.3 (Berkeley) 8/7/97 -# -# Harris Nighthawk 6000 series (nh6000) PowerUX Makefile -# Bob Miorelli, Pratt & Whitney <miorelli@pweh.com> -# - -# make sure the shell constructs below use the right shell -SHELL= /bin/sh - -# use O=-O (usual) or O=-g (debugging) -O= -O - -CC= cc -DESTDIR=/etc/mail - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNEWDB - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -D__svr4__ - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/local/include - -# library directories -LIBDIRS=-L/usr/local/lib - -# libraries required on your system -LIBS= -Bstatic -ldb -lresolv -lsocket -lnsl -lelf -lgen - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= /usr/local/bin - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR} - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR} - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${BINDIR}/newaliases ${BINDIR}/mailq -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= mail -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -NROFF= nroff -h -MANDOC= -man - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - - -install: install-sendmail install-docs - -install-sendmail: sendmail - cp sendmail ${DESTDIR} - chown ${BINOWN} ${DESTDIR}/sendmail - chgrp ${BINGRP} ${DESTDIR}/sendmail - chmod ${BINMODE} ${DESTDIR}/sendmail - - for i in ${LINKS}; do rm -f $$i; ln -s ${DESTDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chown ${BINOWN} ${STDIR}/sendmail.st - chgrp ${BINGRP} ${STDIR}/sendmail.st - chmod 0644 ${STDIR}/sendmail.st - - cp sendmail.hf ${STDIR}/sendmail.hf - chown ${BINOWN} ${STDIR}/sendmail.hf - chgrp ${BINGRP} ${STDIR}/sendmail.hf - chmod 0444 ${STDIR}/sendmail.hf - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.RISCos b/src/Makefiles/Makefile.RISCos deleted file mode 100644 index 5d803bb..0000000 --- a/src/Makefiles/Makefile.RISCos +++ /dev/null @@ -1,126 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# For Mips RISC/os 4.52. -# -# @(#)Makefile.RISCos 8.15 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -O - -# be sure we are compiling in BSD mode -CC= cc -systype bsd43 -Olimit 900 - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DRISCOS - -# see also conf.h for additional compilation flags - -# include directories -#INCDIRS=-I/usr/sww/include - -# library directories -#LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -LIBS= -lmld - -# 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 - -# additional .o files needed -OBJADD= - -# additional pseudo-sources needed -BEFORE= stdlib.h dirent.h unistd.h stddef.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/bsd43/bin/install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -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 - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.RISCos.4_0 b/src/Makefiles/Makefile.RISCos.4_0 deleted file mode 100644 index d0b28b2..0000000 --- a/src/Makefiles/Makefile.RISCos.4_0 +++ /dev/null @@ -1,132 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# For Mips RISC/os 4.0, 4.01. Contributed by Paul DuBois -# <dubois@primate.wisc.edu>, based on Makefile for RISC/os 4.50 -# by Harlan Stenn. I have also found it necessary to set TimeZoneSpec -# in the *.mc file, or sendmail doesn't get the right offset from GMT. -# -# @(#)Makefile.RISCos.4_0 8.2 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -O - -# be sure we are compiling in BSD mode -CC= cc -systype bsd43 -Olimit 900 - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DRISCOS -DRISCOS_4_0 - -# see also conf.h for additional compilation flags - -# include directories -#INCDIRS=-I/usr/sww/include - -# library directories -#LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -LIBS= -lmld - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -# additional pseudo-sources needed -BEFORE= stdlib.h dirent.h unistd.h stddef.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/etc/mipsinstall -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -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 - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} -f sendmail ${BINDIR} - for i in ${LINKS}; do rm -f $$i; ln -s ${BINDIR}/sendmail $$i; done - cp /dev/null ${STDIR}/sendmail.st - chmod 644 ${STDIR}/sendmail.st - chown ${BINOWN} ${STDIR}/sendmail.st - chgrp ${BINGRP} ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 -f sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: - diff --git a/src/Makefiles/Makefile.SCO b/src/Makefiles/Makefile.SCO deleted file mode 100644 index f84fe2f..0000000 --- a/src/Makefiles/Makefile.SCO +++ /dev/null @@ -1,110 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on SCO. -# -# @(#)Makefile.SCO 8.12 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -D_SCO_unix_ - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -lsocket -lprot_s -lx -lc_s - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.SCO.4.2 b/src/Makefiles/Makefile.SCO.4.2 deleted file mode 100644 index 5a868e9..0000000 --- a/src/Makefiles/Makefile.SCO.4.2 +++ /dev/null @@ -1,110 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# Tested on SCO rel 4.2 by Marian Durkovic <marian@svf.stuba.sk>. -# -# @(#)Makefile.SCO.4.2 8.6 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF=-DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -D_SCO_unix_4_2 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -lsocket -lndbm -lprot_s -lx -lc_s - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.SCO.5.x b/src/Makefiles/Makefile.SCO.5.x deleted file mode 100644 index 8c19e3e..0000000 --- a/src/Makefiles/Makefile.SCO.5.x +++ /dev/null @@ -1,111 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# Tested on SCO OpenServer 5 by Keith Reynolds <keithr@sco.COM>. -# -# @(#)Makefile.SCO.5.x 8.6 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF=-DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -lsocket -lndbm -lprot -lcurses -lm -lx - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CC= cc -b elf -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.SINIX b/src/Makefiles/Makefile.SINIX deleted file mode 100644 index 99e6ab8..0000000 --- a/src/Makefiles/Makefile.SINIX +++ /dev/null @@ -1,115 +0,0 @@ -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# Contributed by Gerald Rinske <Gerald.Rinske@mch.sni.de>. -# -# @(#)Makefile.SINIX 8.4 (Berkeley) 9/13/97 -# - -# make sure the shell constructs below use the right shell -SHELL= /bin/sh - -# use O=-O (usual) or O=-g (debugging) -O= -O - -CC= /usr/bin/cc -#DESTDIR=/usr/local/sendmail - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNEWDB - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -D__svr4__ - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/local/include - -# library directories -LIBDIRS=-L/usr/local/lib - -# libraries required on your system -LIBS= -ldb -lsocket -lnsl -lresolv -lelf - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/ucblib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= mail -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -NROFF= nroff -h -#NROFF= groff -Tascii -#MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.SMP_DC.OSx.NILE b/src/Makefiles/Makefile.SMP_DC.OSx.NILE deleted file mode 100644 index d301bde..0000000 --- a/src/Makefiles/Makefile.SMP_DC.OSx.NILE +++ /dev/null @@ -1,118 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# For Pyramid NILE running DC/OSx. -# -# Contributed by Earle F. Ake <akee@wpdis03.wpafb.af.mil>. -# -# @(#)Makefile.SMP_DC.OSx.NILE 8.3 (Berkeley) 3/28/97 -# - -# make sure the shell constructs below use the right shell -SHELL= /bin/sh - -# use O=-O (usual) or O=-g (debugging) -O= -O - -CC= cc -#DESTDIR=/usr/local/sendmail - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNEWDB - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -D__svr4__ -DDCOSx - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -ldb -lresolv -lsocket -lnsl -lelf - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/sbin - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/var/log - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/share/lib/mail - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq \ - ${DESTDIR}/usr/bin/hoststat ${DESTDIR}/usr/bin/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= sys -BINMODE=4511 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -NROFF= nroff -h -#NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.SVR4 b/src/Makefiles/Makefile.SVR4 deleted file mode 100644 index bf485d1..0000000 --- a/src/Makefiles/Makefile.SVR4 +++ /dev/null @@ -1,118 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# Based on a Makefile for Dell SVR4 Issue 2.2 from Kimmo Suominen -# <kim@grendel.lut.fi> -- I haven't tested this myself. It may -# work on other SVR4 ports. -# -# @(#)Makefile.SVR4 8.10 (Berkeley) 8/7/97 -# - -# make sure the shell constructs below use the right shell -SHELL= /bin/sh - -# use O=-O (usual) or O=-g (debugging) -O= -O - -CC= gcc -#DESTDIR=/usr/local/sendmail - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNEWDB -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -D__svr4__ - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -ldb -ldbm -lresolv -lsocket -lnsl -lelf - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/ucblib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= mail -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.SunOS b/src/Makefiles/Makefile.SunOS deleted file mode 100644 index 01cff7f..0000000 --- a/src/Makefiles/Makefile.SunOS +++ /dev/null @@ -1,117 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on SunOS 4.1.[12]. -# For SunOS 4.0.3, add -DSUNOS403 to the ENVDEF macro, and -# create empty files stdlib.h and stddef.h in your -# compile directory. -# -# @(#)Makefile.SunOS 8.12 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNEWDB -DNIS - -# environment definitions (e.g., -D_AIX3) -# need to add -DSUNOS403 if you are on a SunOS 4.0.3 system -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# loader options -LDOPTS= -Bstatic - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -LIBS= -ldb -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 - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.SunOS.4.0 b/src/Makefiles/Makefile.SunOS.4.0 deleted file mode 100644 index f001e8d..0000000 --- a/src/Makefiles/Makefile.SunOS.4.0 +++ /dev/null @@ -1,119 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any significant work on sendmail). -# -# You may find you need to find versions of some routines -# such as strcasecmp in order to link this on SunOS 4.0.3. -# -# @(#)Makefile.SunOS.4.0 8.14 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNEWDB -DNIS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DSUNOS403 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# loader options -LDOPTS= -Bstatic - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -LIBS= -ldb -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 - -# additional .o files needed -OBJADD= - -BEFORE= stdlib.h stddef.h limits.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -stddef.h stdlib.h limits.h: - cp /dev/null $@ - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.SunOS.5.1 b/src/Makefiles/Makefile.SunOS.5.1 deleted file mode 100644 index 57122af..0000000 --- a/src/Makefiles/Makefile.SunOS.5.1 +++ /dev/null @@ -1,124 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any significant work on sendmail). -# -# This has been tested on Solaris 2.1 and 2.2. It DOES NOT WORK on -# versions of Solaris after 2.2. -# -# @(#)Makefile.SunOS.5.1 8.21 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -# warning: do not use -O with versions of gcc prior to 2.6 -O= -O - -CC= gcc - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DSOLARIS=20100 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -# delete -l44bsd if you are not running BIND 4.9.x -LIBS= -lresolv -l44bsd -lsocket -lnsl -lelf - -# 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/mail - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/etc/mail - -# additional .o files needed -OBJADD= - -# things to be made before compilation begins -BEFORE= sysexits.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -sysexits.h: - if [ -r /usr/ucbinclude/sysexits.h ]; \ - then \ - ln -s /usr/ucbinclude/sysexits.h; \ - fi - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.SunOS.5.2 b/src/Makefiles/Makefile.SunOS.5.2 deleted file mode 100644 index 57122af..0000000 --- a/src/Makefiles/Makefile.SunOS.5.2 +++ /dev/null @@ -1,124 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any significant work on sendmail). -# -# This has been tested on Solaris 2.1 and 2.2. It DOES NOT WORK on -# versions of Solaris after 2.2. -# -# @(#)Makefile.SunOS.5.1 8.21 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -# warning: do not use -O with versions of gcc prior to 2.6 -O= -O - -CC= gcc - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DSOLARIS=20100 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -# delete -l44bsd if you are not running BIND 4.9.x -LIBS= -lresolv -l44bsd -lsocket -lnsl -lelf - -# 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/mail - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/etc/mail - -# additional .o files needed -OBJADD= - -# things to be made before compilation begins -BEFORE= sysexits.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -sysexits.h: - if [ -r /usr/ucbinclude/sysexits.h ]; \ - then \ - ln -s /usr/ucbinclude/sysexits.h; \ - fi - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.SunOS.5.3 b/src/Makefiles/Makefile.SunOS.5.3 deleted file mode 100644 index 6628c7f..0000000 --- a/src/Makefiles/Makefile.SunOS.5.3 +++ /dev/null @@ -1,123 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on Solaris 2.3. -# -# @(#)Makefile.SunOS.5.3 8.21 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -# warning: do not use -O with versions of gcc prior to 2.6 -O= -O - -CC= gcc - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS -DNISPLUS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DSOLARIS=20300 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -# delete -l44bsd if you are not running BIND 4.9.x -LIBS= -lresolv -l44bsd -lsocket -lnsl -lelf - -# 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/mail - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/etc/mail - -# additional .o files needed -OBJADD= - -# things to be made before compilation begins -BEFORE= sysexits.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq \ - ${DESTDIR}/usr/bin/hoststat ${DESTDIR}/usr/bin/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -sysexits.h: - if [ -r /usr/ucbinclude/sysexits.h ]; \ - then \ - ln -s /usr/ucbinclude/sysexits.h; \ - fi - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.SunOS.5.4 b/src/Makefiles/Makefile.SunOS.5.4 deleted file mode 100644 index 32c8558..0000000 --- a/src/Makefiles/Makefile.SunOS.5.4 +++ /dev/null @@ -1,126 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on Solaris 2.4. -# -# @(#)Makefile.SunOS.5.4 8.23 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -# warning: do not use -O with versions of gcc prior to 2.6 -O= -O - -CC= gcc - -# define the database mechanism used for alias lookups: -# -DNDBM -- use new DBM -# -DNEWDB -- use new Berkeley DB -# -DNIS -- include NIS support -# -DLDAPMAP -- include LDAP support (requires Umich ldap & lber libraries) -# -DSUNET_ID -- include Stanford LDAP tweaks -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS -DNISPLUS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DSOLARIS=20400 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -# delete -l44bsd if you are not running BIND 4.9.x -# add -lldap -llber -lkrb -ldes for LDAP support -LIBS= -lresolv -l44bsd -lsocket -lnsl -lelf - -# 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/mail - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/etc/mail - -# additional .o files needed -OBJADD= - -# things to be made before compilation begins -BEFORE= sysexits.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq \ - ${DESTDIR}/usr/bin/hoststat ${DESTDIR}/usr/bin/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -sysexits.h: - if [ -r /usr/include/sysexits.h ]; \ - then \ - ln -s /usr/include/sysexits.h; \ - fi - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.SunOS.5.5 b/src/Makefiles/Makefile.SunOS.5.5 deleted file mode 100644 index 9322440..0000000 --- a/src/Makefiles/Makefile.SunOS.5.5 +++ /dev/null @@ -1,124 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on Solaris 2.5. -# -# @(#)Makefile.SunOS.5.5 8.12 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -# warning: do not use -O with versions of gcc prior to 2.6 -O= -O - -CC= gcc - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS -DNISPLUS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DSOLARIS=20500 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -# delete -l44bsd if you are not running BIND 4.9.x -# add -ldb if you add -DNEWDB above (in DBMDEF) -LIBS= -lresolv -l44bsd -lsocket -lnsl -lkstat - -# 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/mail - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/etc/mail - -# additional .o files needed -OBJADD= - -# things to be made before compilation begins -BEFORE= sysexits.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq \ - ${DESTDIR}/usr/bin/hoststat ${DESTDIR}/usr/bin/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -sysexits.h: - if [ -r /usr/include/sysexits.h ]; \ - then \ - ln -s /usr/include/sysexits.h; \ - fi - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.SunOS.5.6 b/src/Makefiles/Makefile.SunOS.5.6 deleted file mode 100644 index 872a207..0000000 --- a/src/Makefiles/Makefile.SunOS.5.6 +++ /dev/null @@ -1,123 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on Solaris 2.6. -# -# @(#)Makefile.SunOS.5.6 8.4 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -# warning: do not use -O with versions of gcc prior to 2.6 -O= -O - -CC= gcc - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS -DNISPLUS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DSOLARIS=20600 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -# delete -l44bsd if you are not running BIND 4.9.x -LIBS= -lresolv -l44bsd -lsocket -lnsl -lkstat - -# 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/mail - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/etc/mail - -# additional .o files needed -OBJADD= - -# things to be made before compilation begins -BEFORE= sysexits.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/bin/newaliases ${DESTDIR}/usr/bin/mailq \ - ${DESTDIR}/usr/bin/hoststat ${DESTDIR}/usr/bin/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -sysexits.h: - if [ -r /usr/include/sysexits.h ]; \ - then \ - ln -s /usr/include/sysexits.h; \ - fi - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.Titan b/src/Makefiles/Makefile.Titan deleted file mode 100644 index e46307d..0000000 --- a/src/Makefiles/Makefile.Titan +++ /dev/null @@ -1,120 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# @(#)Makefile.Titan 8.10 (Berkeley) 8/7/97 -# - -# put the compiler in BSD mode -CC= cc -43 - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# loader options -LDOPTS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -ldbm - -# 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}/var/log - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/share/misc - -# additional .o files needed -OBJADD= - -# additional pseudo-sources needed -BEFORE= stddef.h stdlib.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -stddef.h stdlib.h: - cp /dev/null $@ - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.ULTRIX b/src/Makefiles/Makefile.ULTRIX deleted file mode 100644 index c44e75e..0000000 --- a/src/Makefiles/Makefile.ULTRIX +++ /dev/null @@ -1,118 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on Ultrix 4.2A and 4.3A. -# -# @(#)Makefile.ULTRIX 8.15 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -O - -# native compiler requires -Olimit to optimize properly -CC= cc -Olimit 950 - -# 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNEWDB -DNIS - -# environment definitions (e.g., -D_AIX3) -# On Ultrix 4.4 and later, you can set IDENTPROTO=1. -ENVDEF= -DIDENTPROTO=0 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# loader options -LDOPTS= - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -# delete -lresolv and -l44bsd if you are not running BIND 4.9.x -LIBS= -ldb -lresolv -l44bsd - -# 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}/var/log - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.UMAX b/src/Makefiles/Makefile.UMAX deleted file mode 100644 index b74b4ea..0000000 --- a/src/Makefiles/Makefile.UMAX +++ /dev/null @@ -1,120 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on Encore UMAX V -# -# @(#)Makefile.UMAX 8.10 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNIS - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DUMAXV - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# loader options -LDOPTS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -lyp -lrpc - -# 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}/var/log - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -# things to do before compilation -BEFORE= stddef.h - -stddef.h: - echo "#define _STDDEF_H" > stddef.h - chmod 444 stddef.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.UNICOS b/src/Makefiles/Makefile.UNICOS deleted file mode 100644 index f3b273c..0000000 --- a/src/Makefiles/Makefile.UNICOS +++ /dev/null @@ -1,118 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# Should work with UNICOS 8.0. Note that you must also acquire -# gdbm, as UNICOS does not have ndbm, and I had no luck at all -# getting the Berkeley DB package to compile. -# Douglas K. Rand, University of North Dakota -# rand@aero.und.nodak.edu -# -# @(#)Makefile.UNICOS 8.8 (Berkeley) 8/7/97 -# - -# make sure the shell constructs below use the right shell -SHELL= /bin/sh - -# use O=-O (usual) or O=-g (debugging) -O= -O - - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DUNICOS - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/local/include - -# library directories -LIBDIRS=-L/usr/local/lib - -# libraries required on your system -LIBS= - -# 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/mail - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/etc/mail - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.UNIX_SV.4.x.i386 b/src/Makefiles/Makefile.UNIX_SV.4.x.i386 deleted file mode 100644 index 9a0b50b..0000000 --- a/src/Makefiles/Makefile.UNIX_SV.4.x.i386 +++ /dev/null @@ -1,119 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# UnixWare 1.1 Makefile from John Warburton <jwarb@SACBH.com.au>. -# -# For UnixWare 2.x, use -DUNIXWARE2 in ENVDEF in place of -DUNIXWARE. -# -# @(#)Makefile.UNIX_SV.4.x.i386 8.9 (Berkeley) 8/7/97 -# - -# make sure the shell constructs below use the right shell -SHELL= /bin/sh - -# use O=-O (usual) or O=-g (debugging) -O= -O - -CC= gcc -#DESTDIR=/usr/local/sendmail - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNEWDB -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -D__svr4__ -DUNIXWARE -#ENVDEF= -D__svr4__ -DUNIXWARE2 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= -lc -ldbm -lresolv -lsocket -lnsl -lgen -lelf - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/ucblib - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= mail -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.UX4800 b/src/Makefiles/Makefile.UX4800 deleted file mode 100644 index be1e748..0000000 --- a/src/Makefiles/Makefile.UX4800 +++ /dev/null @@ -1,130 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# This has been tested on NEC UX4800. -# Contributed by Kazuhisa Shimizu <shimizu@lang.csd.nes.nec.co.jp>. -# -# @(#)Makefile.UX4800 8.6 (Berkeley) 8/7/97 -# - -# use O=-O (usual) or O=-g (debugging) -O= -O - -# make sure that /usr/abiccs/bin/cc is used (do not use /usr/ucb/cc). -#CC= /bin/cc -KOlimit=900 -CC= /usr/abiccs/bin/cc -KOlimit=900 - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS # without NEWDB -#DBMDEF= -DNEWDB -DNDBM -DNIS # with NEWDB - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -DHASSNPRINTF=1 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/local/include - -# library directories -LIBDIRS=-L/usr/local/lib - -# libraries required on your system -# delete -l44bsd if you are not running BIND 4.9.x -LIBS= -lsocket -lnsl -lelf -lresolv # -l44bsd # without NEWDB -#LIBS= -lsocket -lnsl -lelf -ldb -lresolv # -l44bsd # with NEWDB - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/var/ucblib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/var/ucblib - -# additional .o files needed -OBJADD= - -# things to be made before compilation begins -BEFORE= sysexits.h ndbm.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/ucb/install -BINOWN= root -BINGRP= sys -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -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 - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.UXPDS.V10 b/src/Makefiles/Makefile.UXPDS.V10 deleted file mode 100644 index b2cdf53..0000000 --- a/src/Makefiles/Makefile.UXPDS.V10 +++ /dev/null @@ -1,142 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# Contributed by Diego R. Lopez <drlopez@cica.es>. Based on -# Makefile.SVR4. I haven't tested this myself. -# -# Additional changes for UXP/DS V20L10 (SVR4.2) from Fumio Moriya -# and Toshiaki Nomura of the Fujitsu FreeSoftware Group -# <dsfrsoft@oai6.yk.fujitsu.co.jp>. -# -# @(#)Makefile.UXPDS.V10 8.9 (Berkeley) 8/7/97 -# - -# make sure the shell constructs below use the right shell -SHELL= /bin/sh - -CC= /usr/ccs/bin/cc - -# use O=-O (usual) or O=-g (debugging) -O= -O - -#DESTDIR=/usr/local/sendmail - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS - -# environment definitions (e.g., -D_AIX3) -# -ENVDEF= -DUXPDS=10 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/include -I/usr/ucbinclude - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= /usr/ucblib/libdbm.a /usr/ucblib/libucb.a -lresolv -lsocket -lnsl -lelf - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/ucblib - -# location and mode for man pages -MAN1= /usr/local/man/man1 -MAN4= /usr/local/man/man4 -MANMODE=444 - -# additional .o files needed -OBJADD= - -# things to be made before compilation begins -BEFORE= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -BINOWN= root -BINGRP= mail -BINMODE=4555 -INSTALL=/usr/ucb/install - -ALL= sendmail man-pages - -all: ${ALL} - -man-pages: aliases.0 mailq.0 newaliases.0 sendmail.0 - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -NROFF= groff -Tascii - -aliases.0: aliases.5 - ${NROFF} -mandoc aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} -mandoc mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} -mandoc newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} -mandoc sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: ${MAN1} ${MAN4} aliases.0 mailq.0 newaliases.0 sendmail.0 - cp aliases.0 ${MAN4}/aliases.4 - chmod ${MANMODE} ${MAN4}/aliases.4 - cp mailq.0 ${MAN1}/mailq.1m - chmod ${MANMODE} ${MAN1}/mailq.1m - cp newaliases.0 ${MAN1}/newaliases.1m - chmod ${MANMODE} ${MAN1}/newaliases.1m - cp sendmail.0 ${MAN1}/sendmail.1m - chmod ${MANMODE} ${MAN1}/sendmail.1m - -${MAN1} ${MAN4}: - mkdir -p $@ - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.UXPDS.V20 b/src/Makefiles/Makefile.UXPDS.V20 deleted file mode 100644 index 51ce445..0000000 --- a/src/Makefiles/Makefile.UXPDS.V20 +++ /dev/null @@ -1,148 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# Contributed by Diego R. Lopez <drlopez@cica.es>. Based on -# Makefile.SVR4. I haven't tested this myself. -# -# Additional changes for UXP/DS V20L10 (SVR4.2) from Fumio Moriya -# and Toshiaki Nomura of the Fujitsu FreeSoftware Group -# <dsfrsoft@oai6.yk.fujitsu.co.jp>. -# -# @(#)Makefile.UXPDS.V20 8.9 (Berkeley) 8/7/97 -# - -# make sure the shell constructs below use the right shell -SHELL= /bin/sh - -CC= /usr/ccs/bin/cc - -# use O=-O (usual) or O=-g (debugging) -O= -O - -#DESTDIR=/usr/local/sendmail - -# define the database mechanism used for 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 READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS - -# environment definitions (e.g., -D_AIX3) -# -ENVDEF= -DUXPDS=20 - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS= - -# library directories -LIBDIRS= - -# libraries required on your system -LIBS= /usr/ucblib/libdbm.a -lresolv -lsocket -lnsl -lelf - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/ucblib - -# location and mode for man pages -MAN1= /usr/local/man/man1 -MAN4= /usr/local/man/man4 -MANMODE=444 - -# additional .o files needed -OBJADD= - -# things to be made before compilation begins -BEFORE= netinet/ip_var.h - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -BINOWN= root -BINGRP= mail -BINMODE=4555 -INSTALL=/usr/ucb/install - -ALL= sendmail man-pages - -all: ${ALL} - -man-pages: aliases.0 mailq.0 newaliases.0 sendmail.0 - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${OBJS} ${LIBDIRS} ${LIBS} - -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 - -NROFF= groff -Tascii - -aliases.0: aliases.5 - ${NROFF} -mandoc aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} -mandoc mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} -mandoc newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} -mandoc sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: ${MAN1} ${MAN4} aliases.0 mailq.0 newaliases.0 sendmail.0 - cp aliases.0 ${MAN4}/aliases.4 - chmod ${MANMODE} ${MAN4}/aliases.4 - cp mailq.0 ${MAN1}/mailq.1m - chmod ${MANMODE} ${MAN1}/mailq.1m - cp newaliases.0 ${MAN1}/newaliases.1m - chmod ${MANMODE} ${MAN1}/newaliases.1m - cp sendmail.0 ${MAN1}/sendmail.1m - chmod ${MANMODE} ${MAN1}/sendmail.1m - -${MAN1} ${MAN4}: - mkdir -p $@ - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.Utah b/src/Makefiles/Makefile.Utah deleted file mode 100644 index f5e8965..0000000 --- a/src/Makefiles/Makefile.Utah +++ /dev/null @@ -1,43 +0,0 @@ -# @(#)Makefile.Utah 8.6 (Berkeley) 8/7/97 - -PROG= sendmail - -# define the database format to use for aliases et al. Can be -DNEWDB (for -# the new BSD database package -- this is preferred) or -DNDBM for the NDBM -# database package. The old putrescent V7 DBM package is no longer -# supported. -# You can define both NEWDB and NDBM during a transition period; old -# databases are read, but the new format will be used on any rebuilds. On -# really gnarly systems, you can set this to null; it will crawl like a high -# spiral snail, but it will work. -DBMDEF= -DNEWDB -DNDBM -DOLD_NEWDB - -CFLAGS+=-I${.CURDIR} ${DBMDEF} -Dsetpgid=setpgrp - -SRCS= alias.c arpadate.c clock.c collect.c conf.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 srvrsmtp.c stab.c stats.c sysexits.c trace.c udb.c \ - usersmtp.c util.c version.c -DPADD= ${LIBDBM} ${LIBCOMPAT} -LDADD= -MAN1= mailq.0 newaliases.0 -MAN5= aliases.0 -MAN8= sendmail.0 -LINKS= ${DESTDIR}/usr/sbin/sendmail ${DESTDIR}/usr/bin/newaliases \ - ${DESTDIR}/usr/sbin/sendmail ${DESTDIR}/usr/bin/mailq \ - ${DESTDIR}/usr/sbin/sendmail ${DESTDIR}/usr/bin/hoststat \ - ${DESTDIR}/usr/sbin/sendmail ${DESTDIR}/usr/bin/purgestat -INSTALL=install -BINDIR= /usr/sbin -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -beforeinstall: - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 /dev/null \ - ${DESTDIR}/var/log/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/sendmail.hf \ - ${DESTDIR}/usr/share/misc - -.include <bsd.prog.mk> diff --git a/src/Makefiles/Makefile.dgux b/src/Makefiles/Makefile.dgux deleted file mode 100644 index 0ff26ff..0000000 --- a/src/Makefiles/Makefile.dgux +++ /dev/null @@ -1,109 +0,0 @@ -# -# Tested on DG/UX 5.4.2 by A. Bryan Curnutt <bryan@Stoner.COM>. -# Updated for DG/UX 5.4.3 by Mark T. Robinson <mtr@ornl.gov>. -# -# @(#)Makefile.dgux 8.12 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS - -# environment definitions (e.g., -D_AIX3) -# use DGUX_5_4_2 for versions prior to 5.4.3. -ENVDEF=-DDGUX - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# loader options -LDOPTS= - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -LIBS= -ldbm - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/bin - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/etc - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= bin -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.dist b/src/Makefiles/Makefile.dist deleted file mode 100644 index 44d9d9d..0000000 --- a/src/Makefiles/Makefile.dist +++ /dev/null @@ -1,112 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# @(#)Makefile.dist 8.20 (Berkeley) 8/7/97 -# - -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNEWDB - -# environment definitions (e.g., -D_AIX3) -ENVDEF= - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I/usr/sww/include - -# loader options -LDOPTS= - -# library directories -LIBDIRS=-L/usr/sww/lib - -# libraries required on your system -# delete -lresolv if you are not running BIND 4.9.x -LIBS= -ldb -ldbm -lresolv - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/sbin - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/var/log - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/share/misc - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=install -BINOWN= root -BINGRP= kmem -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.maxion b/src/Makefiles/Makefile.maxion deleted file mode 100644 index 1047a66..0000000 --- a/src/Makefiles/Makefile.maxion +++ /dev/null @@ -1,116 +0,0 @@ -# -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# @(#)Makefile.maxion 8.5 (Berkeley) 8/7/97 -# -# Concurrent Computer Corporation Maxion support contributed by -# Donald R. Laster Jr. <laster@access.digex.net>. -# -CC=/usr/ucb/cc -# -# 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 -# -DNIS -- include NIS support -# The really old (V7) DBM library is no longer supported. -# See READ_ME for a description of how these flags interact. -# -DBMDEF= -DNDBM -DNIS - -# environment definitions (e.g., -D_AIX3) -ENVDEF=-D__MAXION__ - -# see also conf.h for additional compilation flags - -# include directories -INCDIRS=-I ../ - -# loader options -LDOPTS= - -# library directories -LIBDIRS=-L/usr/ucblib -L/usr/local/lib - -# libraries required on your system -# delete -lresolv if you are not running BIND 4.9.x -LIBS= -ldbm -lresolv -lgen -lucb - -# location of sendmail binary (usually /usr/sbin or /usr/lib) -BINDIR= ${DESTDIR}/usr/ucblib - -# location of sendmail.st file (usually /var/log or /usr/lib) -STDIR= ${DESTDIR}/var/adm/log - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/etc/ucbmail - -# additional .o files needed -OBJADD= - -################### end of user configuration flags ###################### - -CFLAGS= -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/ucb/newaliases ${DESTDIR}/usr/ucb/mailq \ - ${DESTDIR}/usr/ucb/hoststat ${DESTDIR}/usr/ucb/purgestat -INSTALL=/usr/ucb/install -BINOWN= smtp -BINGRP= mail -BINMODE=4555 - -ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -NROFF= nroff -h -#NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -install: install-sendmail install-docs - -install-sendmail: sendmail - ${INSTALL} -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 644 /dev/null \ - ${STDIR}/sendmail.st - ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 444 sendmail.hf ${HFDIR} - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: diff --git a/src/Makefiles/Makefile.uts.systemV b/src/Makefiles/Makefile.uts.systemV deleted file mode 100644 index 503d3a7..0000000 --- a/src/Makefiles/Makefile.uts.systemV +++ /dev/null @@ -1,190 +0,0 @@ -# This Makefile is designed to work on the old "make" program. It does -# not use the obj subdirectory. It also does not install documentation -# automatically -- think of it as a quick start for sites that have the -# old make program (I recommend that you get and port the new make if you -# are going to be doing any signficant work on sendmail). -# -# Makefile for an Amdahl 5890 running UTS System V 2.1.5 (SVr3) -# By Janet Jackson <janet@dialix.oz.au> 1994-11-24 -# This has been tested on (uname -a output) uts bsuts systemV 2.1.5 5890 -# -# @(#)Makefile.uts.systemV 8.7 (Berkeley) 8/7/97 -# - -# 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 - -# use O=-O (usual) or O=-g (debugging) -O= -g - -# 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 READ_ME for a description of how these flags interact. -# -# Getting NIS working on UTS is possible (I did it!) but awkward. -# And forget it unless you're behind some sort of a firewall. -# -DBMDEF= -DNIS -DNDBM - -# environment definitions (e.g., -D_AIX3) -ENVDEF= -D_UTS - -# see also conf.h for additional compilation flags - -# include directories -# To find new BIND header files. This path assumes we are using "makesendmail". -INCDIRS=-I${BINDPATH}/include -I${BINDPATH}/compat/include - -# loader options -LDOPTS= - -# library directories -# To find new libresolv.a. This path assumes we are using "makesendmail". -LIBDIRS=-L${BINDPATH}/res -L${BINDPATH}/compat/lib - -# libraries required on your system -LIBS= -lyp -lrpc -lresolv -l44bsd -lbsd -lsocket -la - -# 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}/usr/lib - -# location of sendmail.hf file (usually /usr/share/misc or /usr/lib) -HFDIR= ${DESTDIR}/usr/lib - -# additional .o files needed -OBJADD= - -# things to do before compilation -BEFORE= stddef.h - -################### end of user configuration flags ###################### - -CFLAGS= -eft -I. $O ${INCDIRS} ${DBMDEF} ${ENVDEF} - -OBJS= alias.o arpadate.o clock.o collect.o conf.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 srvrsmtp.o stab.o stats.o sysexits.o \ - trace.o udb.o usersmtp.o util.o version.o ${OBJADD} - -LINKS= ${DESTDIR}/usr/lib/newaliases ${DESTDIR}/usr/lib/mailq \ - ${DESTDIR}/usr/lib/hoststat ${DESTDIR}/usr/lib/purgestat -BINOWN= root -BINGRP= mail -BINMODE=4555 - -#ALL= sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 -ALL= sendmail - -all: ${ALL} - -sendmail: ${BEFORE} ${OBJS} - ${CC} -o sendmail ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS} - -stddef.h: - echo "#include <sys/types.h>" > stddef.h - -#NROFF= nroff -h -NROFF= groff -Tascii -MANDOC= -mandoc - -aliases.0: aliases.5 - ${NROFF} ${MANDOC} aliases.5 > aliases.0 - -mailq.0: mailq.1 - ${NROFF} ${MANDOC} mailq.1 > mailq.0 - -newaliases.0: newaliases.1 - ${NROFF} ${MANDOC} newaliases.1 > newaliases.0 - -sendmail.0: sendmail.8 - ${NROFF} ${MANDOC} sendmail.8 > sendmail.0 - -# new target to save original sendmail files before installation -save-orig: - if [ -f ${BINDIR}/sendmail.orig ]; then \ - echo "Error: original already saved" 1>&2; \ - exit 1; \ - else \ - /bin/mv ${BINDIR}/sendmail ${BINDIR}/sendmail.orig; \ - for i in ${LINKS}; do \ - if [ -h $$i ]; then \ - /bin/mv $$i $$i.orig; \ - fi; \ - done; \ - if [ -f ${STDIR}/sendmail.st ]; then \ - /bin/mv ${STDIR}/sendmail.st ${STDIR}/sendmail.st.orig; \ - fi; \ - if [ -f ${HFDIR}/sendmail.hf ]; then \ - /bin/mv ${HFDIR}/sendmail.hf ${HFDIR}/sendmail.hf.orig; \ - fi; \ - echo "Now run 'make install'." 1>&2; \ - echo "(To back out, run 'make backout'.)" 1>&2; \ - fi - -# new target to back out, ie, put back original files -backout: - if [ ! -f ${BINDIR}/sendmail.orig ]; then \ - echo "Error: original was not saved" 1>&2; \ - exit 1; \ - else \ - /bin/mv ${BINDIR}/sendmail.orig ${BINDIR}/sendmail; \ - for i in ${LINKS}; do \ - if [ -h $$i.orig ]; then \ - /bin/mv $$i.orig $$i; \ - else \ - rm -f $$i; \ - fi; \ - done; \ - if [ -f ${STDIR}/sendmail.st.orig ]; then \ - /bin/mv ${STDIR}/sendmail.st.orig ${STDIR}/sendmail.st; \ - else \ - rm -f ${STDIR}/sendmail.st; \ - fi; \ - if [ -f ${HFDIR}/sendmail.hf.orig ]; then \ - /bin/mv ${HFDIR}/sendmail.hf.orig ${HFDIR}/sendmail.hf; \ - else \ - rm -f ${HFDIR}/sendmail.hf; \ - fi; \ - echo "Now back out config file change if necessary." 1>&2; \ - fi - -#install: install-sendmail install-docs -install: install-sendmail - -install-sendmail: sendmail - if [ ! -f ${BINDIR}/sendmail.orig ]; then \ - echo "Error: Original not saved yet \ - (no ${BINDIR}/sendmail.orig)" 1>&2; \ - exit 1; \ - else \ - cpset -o sendmail ${BINDIR} ${BINMODE} ${BINOWN} ${BINGRP}; \ - for i in ${LINKS}; do \ - rm -f $$i; \ - ln ${BINDIR}/sendmail $$i; \ - done; \ - cpset -o /dev/null ${STDIR}/sendmail.st 644 ${BINOWN} ${BINGRP}; \ - cpset -o sendmail.hf ${HFDIR} 444 ${BINOWN} ${BINGRP}; \ - echo "Now install the new config file: \ - go to ../../cf/cf and run ./Install-dcd-config" 1>&2; \ - fi - -# doesn't actually install them -- you may want to install pre-nroff versions -install-docs: aliases.0 mailq.0 newaliases.0 sendmail.0 - -clean: - rm -f ${OBJS} sendmail aliases.0 mailq.0 newaliases.0 sendmail.0 - -# dependencies -# gross overkill, and yet still not quite enough.... -${OBJS}: sendmail.h conf.h - -depend: @@ -1,139 +1,85 @@ -# Copyright (c) 1983, 1995-1997 Eric P. Allman -# Copyright (c) 1988 The Regents of the University of California. -# All rights reserved. +# 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. # -# 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. +# 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 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. # -# @(#)READ_ME 8.156 (Berkeley) 10/23/97 +# @(#)README 8.211 (Berkeley) 2/2/1999 # -This directory contains the source files for sendmail. +This directory contains the source files for sendmail(TM). ********************* -!! DO NOT USE MAKE !! to compile sendmail -- instead, use the -********************* "makesendmail" script located in the src -directory. It will find an appropriate Makefile, and create an -appropriate obj.* subdirectory so that multiplatform support -works easily. +!! 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. -The Makefile is for the new (4.4BSD) Berkeley make and uses syntax -that is not recognized by older makes. It also has assumptions -about the 4.4 file system layout built in. See below for details -about other Makefiles. - -If you are porting to a new architecture for which there is no existing -Makefile, you might start with Makefile.dist. This works on the old -traditional make, but isn't customized for any particular architecture. - - ************************************************** - ** Read below for more details of Makefiles. ** - ************************************************** - -************************************************************************** -** 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. + ********************************************************** + ** 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.me: +For detailed instructions, please read the document ../doc/op/op.me: + + eqn ../doc/op/op.me | pic | ditroff -me - eqn ../doc/op.me | pic | ditroff -me +Sendmail is a trademark of Sendmail, Inc. -+-----------+ -| MAKEFILES | -+-----------+ ++-------------------+ +| BUILDING SENDMAIL | ++-------------------+ -By far, the easiest way to compile sendmail is to use the "makesendmail" +By far, the easiest way to compile sendmail is to use the "Build" script: - sh makesendmail + sh Build This uses the "uname" command to figure out what architecture you are -on and selects a proper Makefile accordingly. It also creates a +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. However, if for some -reason this doesn't work (e.g., NeXT systems don't have the "uname" -command) you may have to set up your compile environment by hand. - -The "Makefile"s in these directories are from 4.4 BSD, and hence -really only work properly if you are on a 4.4 system. In particular, -they use new syntax that will not be recognized on old make programs, -and some of them do things like ``.include ../../Makefile.inc'' to -pick up some system defines. If you are getting sendmail separately, -these files won't be included in the distribution, as they are -outside of the sendmail tree. - -Instead, you should use one of the other Makefiles, such as -Makefile.SunOS for a SunOS system, and so forth. These should -work with the version of make that is appropriate for that -system. All other Makefiles are in the "src/Makefiles" subdirectory. -They use the version of make that is native for that system. These -are the Makefiles that I use, and they have "Berkeley quirks" in them. -I can't guarantee that they will work unmodified in your environment. -In particular, Many of them include -I/usr/sww/include/db and --L/usr/sww/lib -- these are Berkeley's locations in the ``Software -Warehouse'' for the new database libraries, described below. You don't -have to remove these definitions if you don't have these directories, -but you may have to remove -DNEWDB from the DBMDEF definition. - -Please look for an appropriate Makefile before you start trying to -compile with Makefile or Makefile.dist. - -If you want to port the new Berkeley make, you can get it from -ftp.uu.net in the directory /systems/unix/bsd-sources/usr.bin/make. -Diffs and instructions for building this version of make under -SunOS 4.1.x are available on ftp.css.itd.umich.edu in -/pub/systems/sun/Net2-make-sun4.diff.Z. Diffs and instructions -for building this version of make under IBM AIX 3.2.4 are available -on ftp.uni-stuttgart.de in /sw/src/patches/bsd-make-rus-patches. -For Ultrix, try ftp.vix.com:~ftp/pub/patches/pmake-for-ultrix.Z. -Paul Southworth <pauls@umich.edu> published a description of porting -this make in comp.unix.bsd. - -The complete text of the Makefile.inc that is in the parent of the -sendmail directory is: - - # @(#)Makefile.inc 8.1 (Berkeley) 6/6/93 - - BINDIR?= /usr/sbin +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. + +----------------------+ @@ -142,18 +88,22 @@ sendmail directory is: 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 back compatible. +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 this package pre-installed. If your - system does not have NEWDB installed, get version 1.85 - from http://www.sleepycat.com/packages/db.1.85.tar.gz. - DO NOT use Berkeley DB version 2.X with sendmail. DO NOT - use the version from the Net2 distribution. If you are - still running BSD/386 1.x, you will also need to define - OLD_NEWDB. + 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 @@ -165,17 +115,25 @@ HESIOD Support for Hesiod (from the DEC/Athena distribution). You 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 ldap and lber libraries to use - this flag. - ->>> NOTE WELL for NEWDB support: it is CRITICAL that you remove ndbm.o ->>> from libdb.a before you install it and DO NOT install ndbm.h if ->>> you want to get ndbm support. 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. + 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 @@ -202,7 +160,7 @@ 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" +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. @@ -210,17 +168,21 @@ 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 | +---------------+ -Whereever possible, I try to make sendmail pull in the correct +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 Makefiles subdirectory for the supported +the Makefile; see the Buildtools/OS subdirectory for the supported architectures. If you are a system to which sendmail has already been ported you @@ -474,6 +436,9 @@ 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. @@ -489,12 +454,12 @@ 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) +NEWDB Include support for Berkeley DB package (hash & btree) for aliases and maps. Normally defined in the Makefile. -OLD_NEWDB If non-zero, 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. If you - use -DOLD_NEWDB=0 it forces you to use the new interface. + 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. @@ -609,57 +574,42 @@ YOU HEADACHES! | OPERATING SYSTEM AND COMPILE QUIRKS | +-------------------------------------+ -GCC 2.5.x problems *** IMPORTANT *** - Date: Mon, 29 Nov 93 19:08:44 PST - From: wilson@cygnus.com (Jim Wilson) - Message-Id: <9311300308.AA04608@cygnus.com> - To: kenner@vlsi1.ultra.nyu.edu - Subject: [cattelan@thebarn.com: gcc 2.5.4-2.5.5 -O bug] - Cc: cattelan@thebarn.com, rms@gnu.ai.mit.edu, sendmail@cs.berkeley.edu - - This fixes a problem that occurs when gcc 2.5.5 is used to compile - sendmail 8.6.4 with optimization on a sparc. - - Mon Nov 29 19:00:14 1993 Jim Wilson (wilson@sphagnum.cygnus.com) - - * reload.c (find_reloads_toplev): Replace obsolete reference to - BYTE_LOADS_*_EXTEND with LOAD_EXTEND_OP. - - *** clean-ss-931128/reload.c Sun Nov 14 16:20:01 1993 - --- ss-931128/reload.c Mon Nov 29 18:52:55 1993 - *************** find_reloads_toplev (x, opnum, type, ind - *** 3888,3894 **** - force a reload in that case. So we should not do anything here. */ - - else if (regno >= FIRST_PSEUDO_REGISTER - ! #if defined(BYTE_LOADS_ZERO_EXTEND) || defined(BYTE_LOADS_SIGN_EXTEND) - && (GET_MODE_SIZE (GET_MODE (x)) - <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))) - #endif - --- 3888,3894 ---- - force a reload in that case. So we should not do anything here. */ - - else if (regno >= FIRST_PSEUDO_REGISTER - ! #ifdef LOAD_EXTEND_OP - && (GET_MODE_SIZE (GET_MODE (x)) - <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))) - #endif - -GCC 2.7.x problems +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. We expect this to be fixed in 8.9, but - probably at the cost of a new command line compile flag. + 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 @@ -667,13 +617,6 @@ Configuration file location vendor location rather than changing the location in the sendmail binary. -ld: fatal: library -l44bsd: not found - Most of the Makefiles include -l44bsd in the LIBS= definition; - this is because several versions of BIND (4.9.0, 4.9.1, 4.9.2) - require this library. If you are running one of these versions, - install this library. Otherwise, just delete "-l44bsd" from the - LIBS= line in the Makefile. - 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 @@ -712,8 +655,8 @@ SunOS 4.0.2 (Sun 386i) 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 the - Makefile.SunOS.4.0, which is selected via the "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. @@ -728,11 +671,16 @@ SunOS 4.1.3, 4.1.3_U1 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 is fixed in patch - 101790-01 (SunOS 4.1.3_U1: TCP socket and reset problems). + 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 chosen by makesendmail must + 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 @@ -853,7 +801,7 @@ Solaris 2.5.1 (SunOS 5.5.1) and 2.6 (SunOS 5.6) #include "/usr/include/resolv.h" Sun is aware of the problem (Sun bug ID 4081053) and it will be fixed - in a to-be-released patch. + in Solaris 2.7. Ultrix By default, the IDENT protocol is turned off on Ultrix. If you @@ -875,7 +823,15 @@ Digital UNIX (formerly DEC OSF/1) 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. - On Digital UNIX 4.0 and later, Berkeley DB is included with the + 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: @@ -888,6 +844,12 @@ Digital UNIX (formerly DEC OSF/1) 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 @@ -920,13 +882,21 @@ IRIX 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/db-1.85-irix.tar.Z . + 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. You will - need to acquire the new Berkeley DB from ftp.cs.berkeley.edu. - Install it in /usr/local/{lib,include}. + 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: @@ -934,7 +904,7 @@ NeXT or NEXTSTEP #include <sys/dir.h> #define dirent direct - (The Makefile.NeXT should try to do both of these for you.) + (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 @@ -958,20 +928,16 @@ BSDI (BSD/386) 1.0, NetBSD 0.9, FreeBSD 1.0 CHANGES). FreeBSD 1.0 RELEASE has uname(2) now. Use -DUSEUNAME in order to - use it (look into Makefile.FreeBSD). NetBSD-current may have + use it (look into BuildTools/OS/FreeBSD). NetBSD-current may have it too but it has not been verified. - You cannot port the latest version of the Berkeley db library - and use it with sendmail without recompiling the world. This - is because C library routines use the older version which have - incompatible header files -- the result is that it can't read - other system files, such as /etc/passwd, unless you use the - new db format throughout your system. You should normally just - use the version of db supplied in your release. You may need - to use -DOLD_NEWDB=1 to make this work -- this turns off some - new interface calls (for file locking) that are not in older - versions of db. You'll get compile errors if you need this - flag and don't have it set. + 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 @@ -1007,11 +973,14 @@ A/UX things behave properly. [NOTE: see comment above about GDBM] - I suppose porting the New Berkeley db package is another route, + 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. @@ -1025,6 +994,9 @@ SCO Unix /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. @@ -1038,12 +1010,13 @@ DG/UX Apollo DomainOS If you are compiling on Apollo, you will have to create an empty - file "unistd.h" and create a file "dirent.h" containing: + file "unistd.h" (for DomainOS 10.3 and earlier) and create a file + "dirent.h" containing: #include <sys/dir.h> #define dirent direct - (The Makefile.DomainOS will attempt to do both of these for you.) + (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 @@ -1071,7 +1044,7 @@ 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 + 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 @@ -1089,20 +1062,34 @@ Linux 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 Makefiles for linux include - 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. + 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 @@ -1136,6 +1123,7 @@ AIX 2.2.1 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 @@ -1152,10 +1140,10 @@ AIX 2.2.1 that will return that information. The 'LA_SUBR' define will handle this for AIX V2 on the RT. - Note: You will have to change the Makefile.AIX.2 to correctly + 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 the Makefile.AIX.2 to know + 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. @@ -1169,11 +1157,12 @@ RISC/os on many files. You can ignore these. System V Release 4 Based Systems - There is a single Makefile that is intended for all SVR4-based - systems (called Makefile.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 - Makefile. + 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. @@ -1237,36 +1226,25 @@ Amdahl UTS 2.1.5 See sendmail/contrib/AmdahlUTS.patch for the patches necessary to get BIND 4.9 compiled for UTS. -UnixWare 2.0 +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>. -Non-DNS based sites - This version of sendmail always tries to connect to the Domain - Name System (DNS) to resolve names, regardless of the setting - of the `I' option. On most systems that are not running DNS, - this will fail quickly and sendmail will continue, but on some - systems it has a long timeout. If you have this problem, you - will have to recompile without NAMED_BIND. Some people have - claimed that they have successfully used "OI+USEVC" to force - sendmail to use a virtual circuit -- this will always time out - quickly, but also tells sendmail that a failed connection - should requeue the message (probably not what you intended). - A future release of sendmail will correct this problem. - -Both NEWDB and NDBM - If you use both -DNDBM and -DNEWDB, you must delete the module - ndbm.o from libdb.a and delete the file "ndbm.h" from the files - that get installed (that is, use the OLD ndbm.h, not the new - ndbm.h). This compatibility module maps ndbm calls into DB - calls, and breaks things rather badly. - 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. @@ -1313,13 +1291,13 @@ Listproc 6.0c as well. :) LDAP - LDAP was provided by Booker Bense <bbense@networking.stanford.edu> of + 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. This project is discussed at - http://www-leland.stanford.edu/group/networking/project/sunetid.html + email addressing. More information can be found at + http://www.stanford.edu/~bbense/Inst.html. - Currently we are using the ldap map as follows: @@ -1340,15 +1318,18 @@ LDAP It requires the ldap and lber libraries from the Umich Ldap3.2 release. - I've tested the software on Solaris.2.4 with gcc and on NeXTStep3.2 - and it runs without problems. If you have any questions, please - send them along. + 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 the 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). + 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 @@ -1359,6 +1340,24 @@ TCP Wrappers 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 | @@ -1366,8 +1365,9 @@ TCP Wrappers 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 directory -/systems/unix/bsd-sources/share/tmac. +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. +-----------------+ @@ -1402,11 +1402,9 @@ A typical formulation of ruleset 89 would be: The following list describes the files in this directory: -Makefile The makefile used here; this version only works with - the new Berkeley make. -Makefile.dist A trimmed down version of the makefile that works with - the old make. -READ_ME This file. +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. @@ -1446,6 +1444,7 @@ 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. @@ -1462,4 +1461,4 @@ version.c The version number and information about this Eric Allman -(Version 8.156, last update 10/23/97 12:53:12) +(Version 8.211, last update 2/2/1999 15:28:18) diff --git a/src/TRACEFLAGS b/src/TRACEFLAGS index db461db..04b9b3c 100644 --- a/src/TRACEFLAGS +++ b/src/TRACEFLAGS @@ -1,7 +1,9 @@ +# @(#)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 diff --git a/src/alias.c b/src/alias.c index cebd805..a7149f2 100644 --- a/src/alias.c +++ b/src/alias.c @@ -1,41 +1,19 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. + * Copyright (c) 1998 Sendmail, Inc. All rights reserved. + * Copyright (c) 1983, 1995-1997 Eric P. Allman. 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. + * 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 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. + * 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.73 (Berkeley) 5/8/97"; +static char sccsid[] = "@(#)alias.c 8.96 (Berkeley) 12/18/1998"; #endif /* not lint */ @@ -77,7 +55,7 @@ alias(a, sendq, aliaslevel, e) char *owner; auto int stat = EX_OK; char obuf[MAXNAME + 7]; - extern char *aliaslookup(); + extern char *aliaslookup __P((char *, int *, ENVELOPE *)); if (tTd(27, 1)) printf("alias(%s)\n", a->q_user); @@ -104,7 +82,7 @@ alias(a, sendq, aliaslevel, e) { a->q_flags |= QQUEUEUP; if (e->e_message == NULL) - e->e_message = "alias database unavailable"; + e->e_message = newstr("alias database unavailable"); return; } if (p == NULL) @@ -123,11 +101,11 @@ alias(a, sendq, aliaslevel, e) a->q_flags |= QVERIFIED; return; } - message("aliased to %s", shortenstring(p, 203)); + 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, 203)); + a->q_paddr, shortenstring(p, MAXSHORTSTR)); a->q_flags &= ~QSELFREF; if (tTd(27, 5)) { @@ -237,7 +215,7 @@ setalias(spec) { char buf[50]; - while (isspace(*p)) + while (isascii(*p) && isspace(*p)) p++; if (*p == '\0') break; @@ -402,7 +380,9 @@ aliaswait(map, ext, isopen) 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()) + if (AutoRebuild && stb.st_ino != 0 && + (stb.st_uid == geteuid() || + (geteuid() == 0 && stb.st_uid == TrustedUid))) { bool oldSuprErrs; @@ -414,7 +394,7 @@ aliaswait(map, ext, isopen) map->map_class->map_close(map); map->map_mflags &= ~(MF_OPEN|MF_WRITABLE); } - rebuildaliases(map, TRUE); + (void) rebuildaliases(map, TRUE); isopen = map->map_class->map_open(map, O_RDONLY); SuprErrs = oldSuprErrs; } @@ -438,28 +418,36 @@ aliaswait(map, ext, isopen) ** automatic -- set if this was automatically generated. ** ** Returns: -** none. +** TRUE if successful; FALSE otherwise. ** ** Side Effects: ** Reads the text version of the database, builds the ** DBM or DB version. */ -void +bool rebuildaliases(map, automatic) register MAP *map; bool automatic; { FILE *af; bool nolock = FALSE; - int sff = SFF_OPENASROOT|SFF_REGONLY|SFF_NOLOCK|SFF_NOWLINK|SFF_NOWFILES; + 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; + 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) @@ -478,7 +466,7 @@ rebuildaliases(map, automatic) message("newaliases: cannot open %s: %s", map->map_file, errstring(saveerr)); errno = 0; - return; + return FALSE; } nolock = TRUE; if (tTd(27, 1) || @@ -503,7 +491,7 @@ rebuildaliases(map, automatic) } (void) xfclose(af, "rebuildaliases1", map->map_file); errno = 0; - return; + return FALSE; } oldsigint = setsignal(SIGINT, SIG_IGN); @@ -522,7 +510,9 @@ rebuildaliases(map, automatic) username()); } map->map_mflags |= MF_OPEN|MF_WRITABLE; + map->map_pid = getpid(); readaliases(map, af, !automatic, TRUE); + success = TRUE; } else { @@ -550,6 +540,7 @@ rebuildaliases(map, automatic) #ifdef SIGTSTP (void) setsignal(SIGTSTP, oldsigtstp); #endif + return success; } /* ** READALIASES -- read and process the alias file. @@ -607,6 +598,7 @@ readaliases(map, af, announcestats, logstats) p--; if (fgets(p, SPACELEFT(line, p), af) == NULL) break; + LineNumber++; p = strchr(p, '\n'); } #endif @@ -855,6 +847,38 @@ forward(user, sendq, aliaslevel, e) "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) { diff --git a/src/aliases.0 b/src/aliases.0 index aa88a57..1163f42 100644 --- a/src/aliases.0 +++ b/src/aliases.0 @@ -45,4 +45,4 @@ BBUUGGSS HHIISSTTOORRYY The aalliiaasseess file format appeared in 4.0BSD. -4th Berkeley Distribution December 11, 1993 1 +4th Berkeley Distribution May 19, 1998 1 diff --git a/src/aliases.5 b/src/aliases.5 index 3519467..bf45838 100644 --- a/src/aliases.5 +++ b/src/aliases.5 @@ -1,38 +1,16 @@ -.\" Copyright (c) 1983, 1997 Eric P. Allman +.\" 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. .\" -.\" 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. +.\" 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 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. .\" -.\" @(#)aliases.5 8.3 (Berkeley) 2/1/97 +.\" @(#)aliases.5 8.8 (Berkeley) 5/19/1998 .\" -.Dd February 1, 1997 +.Dd May 19, 1998 .Dt ALIASES 5 .Os BSD 4 .Sh NAME diff --git a/src/arpadate.c b/src/arpadate.c index f289020..c02decd 100644 --- a/src/arpadate.c +++ b/src/arpadate.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)arpadate.c 8.7 (Berkeley) 2/1/97"; +static char sccsid[] = "@(#)arpadate.c 8.14 (Berkeley) 2/2/1999"; #endif /* not lint */ # include "sendmail.h" @@ -95,7 +73,7 @@ arpadate(ud) ** to resolve the timezone. */ - (void) time(&t); + t = curtime(); if (ud == NULL) ud = ctime(&t); @@ -178,7 +156,12 @@ arpadate(ud) { extern char *tzname[]; - tz = tzname[lt->tm_isdst]; + 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 diff --git a/src/clock.c b/src/clock.c index 6940b29..e6466e6 100644 --- a/src/clock.c +++ b/src/clock.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)clock.c 8.24 (Berkeley) 4/19/97"; +static char sccsid[] = "@(#)clock.c 8.35 (Berkeley) 2/2/1999"; #endif /* not lint */ # include "sendmail.h" @@ -82,7 +60,7 @@ setevent(intvl, func, arg) } wasblocked = blocksignal(SIGALRM); - (void) time(&now); + now = curtime(); /* search event queue for correct position */ for (evp = &EventQueue; (ev = *evp) != NULL; evp = &ev->ev_link) @@ -106,7 +84,8 @@ setevent(intvl, func, arg) if (tTd(5, 5)) printf("setevent: intvl=%ld, for=%ld, func=%lx, arg=%d, ev=%lx\n", - intvl, now + intvl, (u_long) func, arg, (u_long) ev); + (long) intvl, (long)(now + intvl), (u_long) func, + arg, (u_long) ev); setsignal(SIGALRM, tick); intvl = EventQueue->ev_time - now; @@ -179,9 +158,10 @@ clrevent(ev) ** calls the next function in EventQueue. */ +/* ARGSUSED */ static SIGFUNC_DECL -tick(arg) - int arg; +tick(sig) + int sig; { register time_t now; register EVENT *ev; @@ -192,7 +172,7 @@ tick(arg) now = curtime(); if (tTd(5, 4)) - printf("tick: now=%ld\n", now); + printf("tick: now=%ld\n", (long) now); /* reset signal in case System V semantics */ (void) setsignal(SIGALRM, tick); @@ -256,7 +236,7 @@ tick(arg) */ static bool SleepDone; -static void endsleep(); +static void endsleep __P((void)); #ifndef SLEEP_T # define SLEEP_T unsigned int diff --git a/src/collect.c b/src/collect.c index d3a1f18..a8916b1 100644 --- a/src/collect.c +++ b/src/collect.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)collect.c 8.72 (Berkeley) 10/6/97"; +static char sccsid[] = "@(#)collect.c 8.93 (Berkeley) 1/26/1999"; #endif /* not lint */ # include <errno.h> @@ -64,7 +42,7 @@ static char sccsid[] = "@(#)collect.c 8.72 (Berkeley) 10/6/97"; */ static jmp_buf CtxCollectTimeout; -static void collecttimeout(); +static void collecttimeout __P((time_t)); static bool CollectProgress; static EVENT *CollectTimeout; @@ -79,6 +57,7 @@ static EVENT *CollectTimeout; #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) @@ -99,12 +78,12 @@ collect(fp, smtpmode, hdrp, e) 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(); - extern void eatheader(); - extern void tferror(); + extern bool isheader __P((char *)); + extern void tferror __P((FILE *volatile, ENVELOPE *)); headeronly = hdrp != NULL; @@ -123,7 +102,7 @@ collect(fp, smtpmode, hdrp, e) { syserr("Cannot create %s", dfname); e->e_flags |= EF_NO_BODY_RETN; - finis(); + finis(TRUE, ExitStat); } if (fstat(fileno(tf), &stbuf) < 0) e->e_dfino = -1; @@ -285,12 +264,17 @@ collect(fp, smtpmode, hdrp, e) bufferchar: if (!headeronly) e->e_msgsize++; - if (mstate == MS_BODY) + 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; } @@ -321,7 +305,23 @@ bufferchar: #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; } @@ -333,14 +333,12 @@ nextstate: istate, mstate, buf); switch (mstate) { - extern int chompheader(); - case MS_UFROM: mstate = MS_HEADER; #ifndef NOTUNIX if (strncmp(buf, "From ", 5) == 0) { - extern void eatfrom(); + extern void eatfrom __P((char *volatile, ENVELOPE *)); bp = buf; eatfrom(buf, e); @@ -375,11 +373,11 @@ nextstate: if (*--bp != '\n' || *--bp != '\r') bp++; *bp = '\0'; - if (bitset(H_EOH, chompheader(buf, FALSE, hdrp, e))) { - mstate = MS_BODY; - if (tTd(30, 35)) - printf("H_EOH, istate=%d, mstate=%d\n", istate, mstate); - goto nextstate; + + if (bitset(H_EOH, chompheader(buf, FALSE, hdrp, e))) + { + mstate = MS_BODY; + goto nextstate; } break; @@ -437,7 +435,7 @@ readerr: { tferror(tf, e); flush_errors(TRUE); - finis(); + finis(TRUE, ExitStat); } /* An EOF when running SMTP is an error */ @@ -460,16 +458,16 @@ readerr: sm_syslog(LOG_NOTICE, e->e_id, "collect: %s on connection from %.100s, sender=%s: %s", problem, host, - shortenstring(e->e_from.q_paddr, 203), + 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, 203)); + 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, 203)); + shortenstring(e->e_from.q_paddr, MAXSHORTSTR)); /* don't return an error indication */ e->e_to = NULL; @@ -479,7 +477,7 @@ readerr: /* and don't try to deliver the partial message either */ if (InChild) ExitStat = EX_QUIT; - finis(); + finis(TRUE, ExitStat); } /* @@ -494,11 +492,7 @@ readerr: /* collect statistics */ if (OpMode != MD_VERIFY) - { - extern void markstats(); - - markstats(e, (ADDRESS *) NULL); - } + markstats(e, (ADDRESS *) NULL, FALSE); #if _FFR_DSN_RRT_OPTION /* @@ -531,7 +525,6 @@ readerr: /* no valid recipient headers */ register ADDRESS *q; char *hdr = NULL; - extern void addheader(); /* create an Apparently-To: field */ /* that or reject the message.... */ @@ -604,7 +597,7 @@ readerr: { /* we haven't acked receipt yet, so just chuck this */ syserr("Cannot reopen %s", dfname); - finis(); + finis(TRUE, ExitStat); } } @@ -638,29 +631,40 @@ collecttimeout(timeout) void tferror(tf, e) - FILE *tf; + 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 (fstat(fileno(tf), &st) < 0) - st.st_size = 0; + + 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 %qd bytes could not be accepted\n", - st.st_size); + 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 %ld bytes could not be accepted\n", - (long) st.st_size); + 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); @@ -678,7 +682,10 @@ tferror(tf, e) } else syserr("collect: Cannot write tf%s", e->e_id); - (void) freopen("/dev/null", "w", tf); + if (freopen("/dev/null", "w", tf) == NULL) + sm_syslog(LOG_ERR, e->e_id, + "tferror: freopen(\"/dev/null\") failed: %s", + errstring(errno)); } /* ** EATFROM -- chew up a UNIX style from line and process @@ -713,7 +720,7 @@ char *MonthList[] = void eatfrom(fm, e) - char *fm; + char *volatile fm; register ENVELOPE *e; { register char *p; @@ -1,45 +1,24 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)conf.c 8.379 (Berkeley) 10/20/97"; +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. @@ -63,8 +42,6 @@ static char sccsid[] = "@(#)conf.c 8.379 (Berkeley) 10/20/97"; */ - - /* ** Header info table ** Final (null) entry contains the flags used for any other field. @@ -140,15 +117,63 @@ struct prival PrivacyValues[] = { "novrfy", PRIV_NOVRFY }, { "restrictmailq", PRIV_RESTRICTMAILQ }, { "restrictqrun", PRIV_RESTRICTQRUN }, -#if _FFR_PRIVACY_NOETRN { "noetrn", PRIV_NOETRN }, -#endif + { "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 } +}; /* @@ -190,12 +215,12 @@ setdefaults(e) register ENVELOPE *e; { int i; + struct passwd *pw; char buf[MAXNAME]; - extern void inittimeouts(); - extern void setdefuser(); - extern void setupmaps(); - extern void setupmailers(); - extern void setupheaders(); + 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 */ @@ -206,8 +231,26 @@ setdefaults(e) QueueFactor = WkRecipFact * 20; /* option q */ FileMode = (RealUid != geteuid()) ? 0644 : 0600; /* option F */ - DefUid = 1; /* option u */ - DefGid = 1; /* option g */ + + 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 */ @@ -217,7 +260,8 @@ setdefaults(e) MciCacheTimeout = 5 MINUTES; /* option K */ LogLevel = 9; /* option L */ inittimeouts(NULL); /* option r */ - PrivacyFlags = 0; /* option p */ + PrivacyFlags = PRIV_PUBLIC; /* option p */ + DontBlameSendmail = DBS_SAFE; /* DontBlameSendmail option */ #if MIME8TO7 MimeMode = MM_CVTMIME|MM_PASS8BIT; /* option 8 */ #else @@ -240,11 +284,15 @@ setdefaults(e) 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); - setdefuser(); +#ifdef HESIOD_INIT + HesiodContext = NULL; +#endif + ControlSocketName = NULL; setupmaps(); setupmailers(); setupheaders(); @@ -265,6 +313,9 @@ setdefuser() 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); } /* ** SETUPMAILERS -- initialize default mailers @@ -274,7 +325,6 @@ void setupmailers() { char buf[100]; - extern void makemailer(); strcpy(buf, "prog, P=/bin/sh, F=lsoDq9, T=DNS/RFC822/X-Unix, A=sh -c \201u"); makemailer(buf); @@ -399,6 +449,12 @@ setupmaps() 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, @@ -426,7 +482,7 @@ setupmaps() map_parseargs, null_map_open, null_map_close, null_map_lookup, null_map_store); -#if _FFR_SYSLOG_MAP +#if _FFR_MAP_SYSLOG /* syslog map -- logs information to syslog */ MAPDEF("syslog", NULL, 0, syslog_map_parseargs, null_map_open, null_map_close, @@ -761,10 +817,14 @@ switch_map_find(service, maptype, mapreturn) { /* (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 = fopen(ServiceSwitchFile, "r"); + fp = safefopen(ServiceSwitchFile, O_RDONLY, 0, sff); if (fp != NULL) { char buf[MAXLINE]; @@ -781,6 +841,14 @@ switch_map_find(service, maptype, mapreturn) *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') @@ -833,38 +901,42 @@ switch_map_find(service, maptype, mapreturn) } #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 +# ifdef AUTO_NIS_ALIASES +# ifdef NISPLUS maptype[svcno++] = "nisplus"; -# endif -# ifdef NIS +# endif +# ifdef NIS maptype[svcno++] = "nis"; +# endif # endif -#endif return svcno; } if (strcmp(service, "hosts") == 0) { -# if NAMED_BIND +# if NAMED_BIND maptype[svcno++] = "dns"; -# else -# if defined(sun) && !defined(BSD) && !defined(_USE_SUN_NSSWITCH_) +# else +# if defined(sun) && !defined(BSD) /* SunOS */ maptype[svcno++] = "nis"; +# endif # endif -# endif maptype[svcno++] = "files"; return svcno; } return -1; +#endif } /* ** USERNAME -- return the user id of the logged in user. @@ -962,7 +1034,7 @@ ttypath() } /* see if we have write permission */ - if (stat(pathn, &stbuf) < 0 || !bitset(02, stbuf.st_mode)) + if (stat(pathn, &stbuf) < 0 || !bitset(S_IWOTH, stbuf.st_mode)) { errno = 0; return (NULL); @@ -1217,6 +1289,15 @@ init_md(argc, argv) /* 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); @@ -1330,10 +1411,6 @@ init_vendor_macros(e) #include <nlist.h> -#ifdef IRIX64 -# define nlist nlist64 -#endif - /* _PATH_UNIX should be defined in <paths.h> */ #ifndef _PATH_UNIX # if defined(SYSTEM5) @@ -1664,95 +1741,12 @@ getla() #endif /* LA_TYPE == LA_PROCSTR */ #if LA_TYPE == LA_IRIX6 - -#include <nlist.h> -#include <sys/types.h> -#include <unistd.h> - -#define X_AVENRUN 0 -struct nlist Nl32[] = -{ - { LA_AVENRUN }, - { 0 }, -}; -struct nlist64 Nl64[] = -{ - { LA_AVENRUN }, - { 0 }, -}; +#include <sys/sysmp.h> int getla(void) { static int kmem = -1; - static enum { getla_none, getla_32, getla_64 } kernel_type = - getla_none; - uint32_t avenrun[3]; - - if (kernel_type == getla_none) - { - /* Try 32 bit kernel ... */ - errno = 0; - if (nlist(_PATH_UNIX, Nl32) == 0) - { - if (tTd(3, 20)) - printf("getla: Kernel is 32bit\n"); - - if (Nl32[X_AVENRUN].n_value == 0) - { - if (tTd(3, 1)) - printf("getla: nlist(%s, %s) ==> 0\n", - _PATH_UNIX, LA_AVENRUN); - } - else - kernel_type = getla_32; - } - else if (errno != 0) - { - if (tTd(3, 1)) - printf("getla: nlist(%s): %s\n", - _PATH_UNIX, errstring(errno)); - } - else - { - if (tTd(3, 20)) - printf("getla: Kernel is not 32bit\n"); - } - - /* Try 64 bit kernel ... */ - errno = 0; - if (nlist64(_PATH_UNIX, Nl64) == 0) - { - if (tTd(3, 20)) - printf("getla: Kernel is 64bit\n"); - - if (Nl64[X_AVENRUN].n_value == 0) - { - if (tTd(3, 1)) - printf("getla: nlist(%s, %s) ==> 0\n", - _PATH_UNIX, LA_AVENRUN); - } - else - kernel_type = getla_64; - } - else if (errno != 0) - { - if (tTd(3, 1)) - printf("getla: nlist64(%s): %s\n", - _PATH_UNIX, errstring(errno)); - } - else - { - if (tTd(3, 20)) - printf("getla: Kernel is not 64bit\n"); - } - } - - if (kernel_type == getla_none) - { - if (tTd(3, 1)) - printf("getla: Failed to determine kernel type\n"); - return -1; - } + int avenrun[3]; if (kmem < 0) { @@ -1760,56 +1754,34 @@ int getla(void) if (kmem < 0) { if (tTd(3, 1)) - printf("getla: open(/dev/kmem): %s\n", + printf("getla: open(%s): %s\n", _PATH_KMEM, errstring(errno)); return -1; } (void) fcntl(kmem, F_SETFD, 1); } - switch (kernel_type) + if (lseek(kmem, (sysmp(MP_KERNADDR, MPKA_AVENRUN) & 0x7fffffff), SEEK_SET) == -1 || + read(kmem, (char *)avenrun, sizeof(avenrun)) < sizeof(avenrun)) { - case getla_none: + if (tTd(3, 1)) + printf("getla: lseek or read: %s\n", + errstring(errno)); return -1; - - case getla_32: - if (lseek(kmem, (off_t) Nl32[X_AVENRUN].n_value, 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; - } - break; - - case getla_64: - /* Using of lseek64 is perhaps overkill ... */ - if (lseek64(kmem, (off64_t) Nl64[X_AVENRUN].n_value, SEEK_SET) == -1 || - read(kmem, (char *) avenrun, sizeof(avenrun)) < - sizeof(avenrun)) - { - if (tTd(3, 1)) - printf("getla: lseek64 or read: %s\n", - errstring(errno)); - return -1; - } - break; } if (tTd(3, 5)) { - printf("getla: avenrun = %ld", - (long int) avenrun[0]); + printf("getla: avenrun = %ld", (long int) avenrun[0]); if (tTd(3, 15)) printf(", %ld, %ld", - (long int)avenrun[1], - (long int)avenrun[2]); + (long int) avenrun[1], (long int) avenrun[2]); printf("\n"); } + if (tTd(3, 1)) - printf("getla: %d\n", - (int) (avenrun[0] + FSCALE/2) >> FSHIFT); + printf("getla: %d\n", (int) (avenrun[0] + FSCALE/2) >> FSHIFT); return ((int) (avenrun[0] + FSCALE/2) >> FSHIFT); + } #endif @@ -1909,6 +1881,8 @@ getla() #endif /* LA_TYPE == LA_DEVSHORT */ #if LA_TYPE == LA_ALPHAOSF +struct rtentry; +struct mbuf; # include <sys/table.h> int getla() @@ -2068,7 +2042,7 @@ refuseconnections(port) time_t now; static time_t lastconn = (time_t) 0; static int conncnt = 0; - extern bool enoughdiskspace(); + extern bool enoughdiskspace __P((long)); #ifdef XLA if (!xla_smtp_ok()) @@ -2084,7 +2058,7 @@ refuseconnections(port) else if (conncnt++ > ConnRateThrottle && ConnRateThrottle > 0) { /* sleep to flatten out connection load */ - setproctitle("deferring connections on port %d: %d per second", + sm_setproctitle(TRUE, "deferring connections on port %d: %d per second", port, ConnRateThrottle); if (LogLevel >= 14) sm_syslog(LOG_INFO, NOQID, @@ -2096,7 +2070,7 @@ refuseconnections(port) CurrentLA = getla(); if (CurrentLA >= refusela) { - setproctitle("rejecting connections on port %d: load average: %d", + sm_setproctitle(TRUE, "rejecting connections on port %d: load average: %d", port, CurrentLA); if (LogLevel >= 14) sm_syslog(LOG_INFO, NOQID, @@ -2107,7 +2081,7 @@ refuseconnections(port) if (!enoughdiskspace(MinBlocksFree + 1)) { - setproctitle("rejecting connections on port %d: min free: %d", + sm_setproctitle(TRUE, "rejecting connections on port %d: min free: %d", port, MinBlocksFree); if (LogLevel >= 14) sm_syslog(LOG_INFO, NOQID, @@ -2118,12 +2092,10 @@ refuseconnections(port) if (MaxChildren > 0 && CurChildren >= MaxChildren) { - extern void proc_list_probe __P((void)); - proc_list_probe(); if (CurChildren >= MaxChildren) { - setproctitle("rejecting connections on port %d: %d children, max %d", + sm_setproctitle(TRUE, "rejecting connections on port %d: %d children, max %d", port, CurChildren, MaxChildren); if (LogLevel >= 14) sm_syslog(LOG_INFO, NOQID, @@ -2207,12 +2179,12 @@ typedef unsigned int *pt_entry_t; # define SPT_PADCHAR ' ' # endif +#endif /* SPT_TYPE != SPT_NONE && SPT_TYPE != SPT_BUILTIN */ + # ifndef SPT_BUFSIZE # define SPT_BUFSIZE MAXLINE # endif -#endif /* SPT_TYPE != SPT_NONE && SPT_TYPE != SPT_BUILTIN */ - /* ** Pointers for setproctitle. ** This allows "ps" listings to give more useful information. @@ -2249,18 +2221,23 @@ initsetproctitle(argc, argv, envp) Argv = argv; /* - ** Find the last environment variable within sendmail's - ** process memory area. - */ - while (i > 0 && (envp[i - 1] < argv[0] || - envp[i - 1] > (argv[argc - 1] + - strlen(argv[argc - 1]) + 1 + envpsize))) - i--; - - if (i > 0) - LastArgv = envp[i - 1] + strlen(envp[i - 1]); - else - LastArgv = argv[argc - 1] + strlen(argv[argc - 1]); + ** 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 @@ -2352,6 +2329,44 @@ setproctitle(fmt, va_alist) #endif /* SPT_TYPE != SPT_BUILTIN */ /* +** 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); +} +/* ** WAITFOR -- wait for a particular process id. ** ** Parameters: @@ -2723,6 +2738,23 @@ initgroups(name, basegid) #endif /* +** 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 +/* ** SETSID -- set session id (for non-POSIX systems) */ @@ -2804,8 +2836,8 @@ dgux_inet_addr(host) /* -** 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 +** 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) @@ -2921,333 +2953,6 @@ vsprintf(s, fmt, ap) #endif /* -** 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.2 1995/10/09 11:19:47 roberto Exp $";*/ -static void sm_dopr(); -static char *DoprEnd; -static 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 = %d, str = %s", - count, shortenstring(str, 203)); - return strlen(str); -} - -# endif /* !luna2 */ -#endif /* !HASSNPRINTF */ - -/* - * sm_dopr(): poor man's version of doprintf - */ - -static void fmtstr __P((char *value, int ljust, int len, int zpad, int maxwidth)); -static void fmtnum __P((long value, int base, int dosign, int ljust, int len, int zpad)); -static void dostr __P(( char * , int )); -static char *output; -static void dopr_outch __P(( int c )); -static int SyslogErrno; - -static 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++) ){ - 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(sys_errlist[SyslogErrno], 0); -#endif - break; - - case '%': dopr_outch( ch ); continue; - default: - dostr( "???????" , 0); - } - break; - default: - dopr_outch( ch ); - break; - } - } - *output = 0; -} - -static 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; - } -} - -static 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; - } -} - -static void -dostr( str , cut) - char *str; - int cut; -{ - if (cut) { - while(*str && cut-- > 0) dopr_outch(*str++); - } else { - while(*str) dopr_outch(*str++); - } -} - -static 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++; -} -/* ** USERSHELLOK -- tell if a user's shell is ok for unrestricted use ** ** Parameters: @@ -3267,6 +2972,9 @@ dopr_outch( c ) # if defined(_AIX3) || defined(_AIX4) # include <userconf.h> +# if _AIX4 >= 40200 +# include <userpw.h> +# endif # include <usersec.h> # endif @@ -3301,9 +3009,18 @@ char *DefaultUserShells[] = "/bin/bsh", /* Bourne shell */ "/usr/bin/bsh", #endif -#ifdef __svr4__ +#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 }; @@ -3338,7 +3055,8 @@ usershellok(user, shell) register FILE *shellf; char buf[MAXLINE]; - if (shell == NULL || shell[0] == '\0' || wordinclass(user, 't')) + if (shell == NULL || shell[0] == '\0' || wordinclass(user, 't') || + ConfigLevel <= 1) return TRUE; # if USEGETCONFATTR @@ -3372,6 +3090,11 @@ usershellok(user, shell) { /* 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++) { @@ -3391,7 +3114,7 @@ usershellok(user, shell) if (*p == '#' || *p == '\0') continue; q = p; - while (*p != '\0' && *p != '#' && !isspace(*p)) + while (*p != '\0' && *p != '#' && !(isascii(*p) && isspace(*p))) p++; *p = '\0'; if (strcmp(shell, q) == 0 || strcmp(WILDCARD_SHELL, q) == 0) @@ -3503,8 +3226,10 @@ freediskspace(dir, bsize) *bsize = FSBLOCKSIZE; if (fs.SFS_BAVAIL <= 0) return 0; + else if (fs.SFS_BAVAIL > LONG_MAX) + return LONG_MAX; else - return fs.SFS_BAVAIL; + return (long) fs.SFS_BAVAIL; } #endif return (-1); @@ -3692,6 +3417,7 @@ lockfile(fd, filename, ext, type) int type; { int i; + int save_errno; # if !HASFLOCK int action; struct flock lfd; @@ -3724,9 +3450,10 @@ lockfile(fd, filename, ext, type) printf("SUCCESS\n"); return TRUE; } + save_errno = errno; if (tTd(55, 60)) - printf("(%s) ", errstring(errno)); + printf("(%s) ", errstring(save_errno)); /* ** On SunOS, if you are testing using -oQ/tmp/mqueue or @@ -3737,21 +3464,19 @@ lockfile(fd, filename, ext, type) ** that this indicates that the lock is successfully grabbed. */ - if (errno == EINVAL) + if (save_errno == EINVAL) { if (tTd(55, 60)) printf("SUCCESS\n"); return TRUE; } - if (!bitset(LOCK_NB, type) || (errno != EACCES && errno != EAGAIN)) + if (!bitset(LOCK_NB, type) || (save_errno != EACCES && save_errno != EAGAIN)) { int omode = -1; # ifdef F_GETFL - int oerrno = errno; - (void) fcntl(fd, F_GETFL, &omode); - errno = oerrno; + errno = save_errno; # endif syserr("cannot lockf(%s%s, fd=%d, type=%o, omode=%o, euid=%d)", filename, ext, fd, type, omode, geteuid()); @@ -3772,18 +3497,17 @@ lockfile(fd, filename, ext, type) printf("SUCCESS\n"); return TRUE; } + save_errno = errno; if (tTd(55, 60)) - printf("(%s) ", errstring(errno)); + printf("(%s) ", errstring(save_errno)); - if (!bitset(LOCK_NB, type) || errno != EWOULDBLOCK) + if (!bitset(LOCK_NB, type) || save_errno != EWOULDBLOCK) { int omode = -1; # ifdef F_GETFL - int oerrno = errno; - (void) fcntl(fd, F_GETFL, &omode); - errno = oerrno; + errno = save_errno; # endif syserr("cannot flock(%s%s, fd=%d, type=%o, omode=%o, euid=%d)", filename, ext, fd, type, omode, geteuid()); @@ -3792,6 +3516,7 @@ lockfile(fd, filename, ext, type) # endif if (tTd(55, 60)) printf("FAIL\n"); + errno = save_errno; return FALSE; } /* @@ -3861,7 +3586,7 @@ chownsafe(fd, safedir) int rval; /* give the system administrator a chance to override */ - if (ChownAlwaysSafe) + if (bitset(DBS_ASSUMESAFECHOWN, DontBlameSendmail)) return TRUE; /* @@ -3878,7 +3603,7 @@ chownsafe(fd, safedir) return safedir && errno == 0 && rval IS_SAFE_CHOWN; # endif #else - return ChownAlwaysSafe; + return bitset(DBS_ASSUMESAFECHOWN, DontBlameSendmail); #endif } /* @@ -3938,7 +3663,7 @@ getcfname() return ConfFile; #if NETINFO { - extern char *ni_propval(); + extern char *ni_propval __P((char *, char *, char *, char *, int)); char *cflocation; cflocation = ni_propval("/locations", NULL, "sendmail", @@ -3987,9 +3712,63 @@ setvendor(vendor) } #endif +#if defined(VENDOR_NAME) && defined(VENDOR_CODE) + if (strcasecmp(vendor, VENDOR_NAME) == 0) + { + VendorCode = VENDOR_CODE; + return TRUE; + } +#endif + return FALSE; } /* +** 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"; + } +} +/* ** VENDOR_PRE_DEFAULTS, VENDOR_POST_DEFAULTS -- set vendor-specific defaults ** ** Vendor_pre_defaults is called before reading the configuration @@ -4029,6 +3808,13 @@ 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 @@ -4045,7 +3831,7 @@ vendor_daemon_setup(e) if (getluid() != -1) { usrerr("Daemon cannot have LUID"); - exit(EX_USAGE); + finis(FALSE, EX_USAGE); } #endif /* SECUREWARE */ } @@ -4090,8 +3876,8 @@ vendor_set_uid(uid) ** e -- the current envelope. ** ** Returns: -** TRUE -- if the connection should be accepted. -** FALSE -- if it should be rejected. +** error message from rejection. +** NULL if not rejected. */ #if TCPWRAPPERS @@ -4103,39 +3889,62 @@ int deny_severity = LOG_NOTICE; #endif #if DAEMON -bool +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"); - return FALSE; + + 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 (TcpWrappers && - !hosts_ctl("sendmail", hostname, anynet_ntoa(sap), STRING_UNKNOWN)) + 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", - hostname, anynet_ntoa(sap)); - return FALSE; + host, anynet_ntoa(sap)); + return "Access denied"; } #endif if (tTd(48, 4)) printf(" ... validate_connection: OK\n"); - return TRUE; + return NULL; } #endif @@ -4153,8 +3962,6 @@ validate_connection(sap, hostname, e) static char sccsid[] = "@(#)strtol.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ -#include <limits.h> - /* * Convert a string to a long integer. * @@ -4467,11 +4274,88 @@ secureware_setup_secure(uid) rc, uid); break; } - exit(EX_NOPERM); + finis(FALSE, EX_NOPERM); } } #endif /* SECUREWARE */ /* +** 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; +} +/* ** LOAD_IF_NAMES -- load interface-specific names into $=w ** ** Parameters: @@ -4491,6 +4375,9 @@ struct mbuf; # ifndef SUNOS403 # include <sys/time.h> # endif +# if _AIX4 >= 40300 +# undef __P +# endif # include <net/if.h> #endif @@ -4545,9 +4432,8 @@ load_if_names() for (i = 0; i < ifc.ifc_len; ) { struct ifreq *ifr = (struct ifreq *) &ifc.ifc_buf[i]; - struct sockaddr *sa = &ifr->ifr_addr; + SOCKADDR *sa = (SOCKADDR *) &ifr->ifr_addr; struct in_addr ia; - struct hostent *hp; #ifdef SIOCGIFFLAGS struct ifreq ifrf; #endif @@ -4555,14 +4441,14 @@ load_if_names() extern char *inet_ntoa(); #ifdef BSD4_4_SOCKADDR - if (sa->sa_len > sizeof ifr->ifr_addr) - i += sizeof ifr->ifr_name + sa->sa_len; + 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((SOCKADDR *) sa)); + printf("%s\n", anynet_ntoa(sa)); if (ifr->ifr_addr.sa_family != AF_INET) continue; @@ -4581,7 +4467,7 @@ load_if_names() continue; /* extract IP address from the list*/ - ia = (((struct sockaddr_in *) sa)->sin_addr); + 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", @@ -4604,41 +4490,7 @@ load_if_names() if (bitset(IFF_LOOPBACK, IFRFREF.ifr_flags)) continue; - /* lookup name with IP address */ - hp = sm_gethostbyaddr((char *) &ia, sizeof(ia), AF_INET); - if (hp == NULL) - { - if (LogLevel > 3) - sm_syslog(LOG_WARNING, NOQID, - "gethostbyaddr(%.100s) failed: %d\n", - inet_ntoa(ia), -#if NAMED_BIND - h_errno); -#else - -1); -#endif - continue; - } - - /* 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++; - } + (void) add_hostnames(sa); } free(ifc.ifc_buf); close(s); @@ -4700,7 +4552,10 @@ sm_syslog(level, id, fmt, va_alist) 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) @@ -4809,7 +4664,7 @@ bufalloc: ** syslog succeeds during interrupt handlers. */ -#ifdef __hpux +#if defined(__hpux) && !defined(HPUX11) # define MAXSYSLOGTRIES 100 # undef syslog @@ -4883,15 +4738,18 @@ local_hostname_length(hostname) char *CompileOptions[] = { -#if HESIOD +#ifdef HESIOD "HESIOD", #endif #if HES_GETMAILHOST "HES_GETMAILHOST", #endif -#if LDAPMAP +#ifdef LDAPMAP "LDAPMAP", #endif +#ifdef MAP_REGEX + "MAP_REGEX", +#endif #if LOG "LOG", #endif @@ -4907,7 +4765,7 @@ char *CompileOptions[] = #if NAMED_BIND "NAMED_BIND", #endif -#if NDBM +#ifdef NDBM "NDBM", #endif #if NETINET @@ -4928,13 +4786,13 @@ char *CompileOptions[] = #if NETX25 "NETX25", #endif -#if NEWDB +#ifdef NEWDB "NEWDB", #endif -#if NIS +#ifdef NIS "NIS", #endif -#if NISPLUS +#ifdef NISPLUS "NISPLUS", #endif #if QUEUE @@ -4949,7 +4807,7 @@ char *CompileOptions[] = #if SMTPDEBUG "SMTPDEBUG", #endif -#if SUID_ROOT_FILES_OK +#ifdef SUID_ROOT_FILES_OK "SUID_ROOT_FILES_OK", #endif #if TCPWRAPPERS @@ -4961,7 +4819,7 @@ char *CompileOptions[] = #if XDEBUG "XDEBUG", #endif -#if XLA +#ifdef XLA "XLA", #endif NULL @@ -1,37 +1,15 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. * - * @(#)conf.h 8.335 (Berkeley) 10/24/97 + * @(#)conf.h 8.385 (Berkeley) 1/28/1999 */ /* @@ -48,7 +26,10 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ # 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> @@ -80,6 +61,17 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ # 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. @@ -167,11 +159,12 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ ** 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 db.h & sys/sysmacros.h on HP 300 */ +# 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 */ @@ -186,7 +179,9 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ # ifndef HASGETUSERSHELL # define HASGETUSERSHELL 0 /* getusershell(3) causes core dumps */ # endif -# define syslog hard_syslog +# ifndef HPUX11 +# define syslog hard_syslog +# endif # define SAFENFSPATHCONF 1 /* pathconf(2) pessimizes on NFS filesystems */ # ifdef V4FS @@ -213,6 +208,8 @@ struct rusage; /* forward declaration to get gcc to shut up in wait.h */ # 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 @@ -228,10 +225,18 @@ extern void hard_syslog(int, char *, ...); # define _AIX3 1 /* pull in AIX3 stuff */ # define USESETEUID 1 /* seteuid(2) works */ # define TZ_TYPE TZ_NAME /* use tzname[] vector */ -# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */ # 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 @@ -347,25 +352,31 @@ typedef int pid_t; # 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 */ -# define SYSLOG_BUFSIZE 512 # 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) +# 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 */ @@ -427,15 +438,23 @@ typedef int pid_t; # endif # if SOLARIS >= 20500 || (SOLARIS < 10000 && SOLARIS >= 205) # define HASSETREUID 1 /* setreuid works as of 2.5 */ -# ifndef LA_TYPE -# define LA_TYPE LA_KSTAT /* use kstat(3k) -- may work in < 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 */ +# define HASGETUSERSHELL 0 /* getusershell(3) causes core dumps pre-2.7 */ # endif # else @@ -449,6 +468,9 @@ typedef int pid_t; # 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 */ @@ -603,13 +625,16 @@ extern long dgux_inet_addr(); # define HASFLOCK 1 /* has flock(2) call */ # endif # define LA_TYPE LA_ALPHAOSF -# define SFS_TYPE SFS_MOUNT /* use <sys/mount.h> statfs() impl */ +# 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 @@ -657,6 +682,41 @@ typedef int pid_t; #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 @@ -675,6 +735,7 @@ typedef int pid_t; # 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 @@ -708,20 +769,56 @@ typedef int pid_t; # 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 */ -# ifndef OLD_NEWDB -# define OLD_NEWDB 1 /* old version of newdb library */ -# endif # 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) @@ -742,12 +839,14 @@ typedef int pid_t; # 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 @@ -758,12 +857,15 @@ typedef int pid_t; # endif # if defined(__FreeBSD__) # undef SPT_TYPE -# if __FreeBSD__ == 2 -# include <osreldate.h> /* and this works */ -# if __FreeBSD_version >= 199512 /* 2.2-current right now */ +# 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 @@ -905,7 +1007,6 @@ extern int errno; /* SCO OpenServer 5 */ #if _SCO_DS >= 1 # include <paths.h> -# define _SCO_unix_4_2 # define SIOCGIFNUM_IS_BROKEN 1 /* SIOCGIFNUM returns bogus value */ # define HASSNPRINTF 1 /* has snprintf(3) call */ # define HASFCHMOD 1 /* has fchmod(2) call */ @@ -918,8 +1019,12 @@ extern int errno; # define LA_TYPE LA_DEVSHORT # endif # define _PATH_AVENRUN "/dev/table/avenrun" -# define SOCKADDR_LEN_T size_t /* e.g., arg#3 to accept, getsockname */ -# define SOCKOPT_LEN_T size_t /* arg#5 to getsockopt */ +# 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 */ @@ -1157,9 +1262,9 @@ extern void *malloc(); ** Florian La Roche <rzsfl@rz.uni-sb.de> ** Karl London <karl@borg.demon.co.uk> ** -** Last compiled against: [06/10/96 @ 09:21:40 PM (Monday)] -** sendmail 8.8-a4 named bind-4.9.4-T4B db-1.85 -** gcc 2.7.2 libc-5.3.12 linux 2.0.0 +** 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 @@ -1169,6 +1274,7 @@ extern void *malloc(); #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 */ @@ -1193,10 +1299,12 @@ extern void *malloc(); # 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 -# define TZ_TYPE TZ_TNAME # include <sys/sysmacros.h> # undef atol /* wounded in <stdlib.h> */ #endif @@ -1425,6 +1533,37 @@ typedef int pid_t; # 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 @@ -1457,7 +1596,9 @@ typedef int pid_t; # define LA_TYPE LA_ZERO # undef WIFEXITED # undef WEXITSTATUS -# define _PATH_UNIX "/unix" +# ifndef _PATH_UNIX +# define _PATH_UNIX "/unix" +# endif # ifndef _PATH_VENDOR_CF # define _PATH_VENDOR_CF "/usr/ucblib/sendmail.cf" # endif @@ -1557,11 +1698,16 @@ typedef int pid_t; # define HASGETUSERSHELL 0 /* getusershell(3) causes core dumps */ # endif -/* avoid m_flags conflict between db.h & sys/sysmacros.h on HIUX 3050 */ +/* +** 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 @@ -1775,7 +1921,7 @@ extern int errno; /* ** Pyramid DC/OSx ** -** From Earle Ake <akee@wpdis01.wpafb.af.mil>. +** From Earle Ake <akee@wpdiss1.wpafb.af.mil>. */ #ifdef DCOSx @@ -1848,10 +1994,20 @@ typedef struct msgb mblk_t; ** Contributed by Gerald Rinske <Gerald.Rinske@mch.sni.de> ** of Siemens Business Services VAS. */ -#ifdef _sinix_ +#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 **********************************************************************/ @@ -1947,6 +2103,11 @@ typedef struct msgb mblk_t; # 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 /* ** Tweaking for systems that (for example) claim to be BSD or POSIX @@ -1971,6 +2132,10 @@ typedef struct msgb mblk_t; # 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 @@ -2023,10 +2188,6 @@ typedef struct msgb mblk_t; # define HASULIMIT 0 /* assume no ulimit(2) support */ #endif -#ifndef OLD_NEWDB -# define OLD_NEWDB 0 /* assume newer version of newdb */ -#endif - #ifndef SECUREWARE # define SECUREWARE 0 /* assume no SecureWare C2 auditing hooks */ #endif @@ -2076,6 +2237,10 @@ typedef struct msgb mblk_t; #ifndef SOCKOPT_LEN_T # define SOCKOPT_LEN_T int #endif + +#ifndef QUAD_T +# define QUAD_T unsigned long +#endif /********************************************************************** ** Remaining definitions should never have to be changed. They are ** primarily to provide back compatibility for older systems -- for @@ -2165,7 +2330,11 @@ typedef struct msgb mblk_t; # include "cdefs.h" #endif -#if NAMED_BIND && !defined(__ksr__) +#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 @@ -2248,6 +2417,18 @@ struct utsname # 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 @@ -2281,26 +2462,6 @@ typedef void (*sigfunc_t) __P((int)); #endif /* -** Size of tobuf (deliver.c) -** Tweak this to match your syslog implementation. It will have to -** allow for the extra information printed. -*/ - -#ifndef TOBUFSIZE -# if (SYSLOG_BUFSIZE) > 768 -# define TOBUFSIZE (SYSLOG_BUFSIZE - 512) -# else -# define TOBUFSIZE (SYSLOG_BUFSIZE / 2) -# endif -#endif - -/* TOBUFSIZE must never be permitted to exceed MAXLINE - 128 */ -#if TOBUFSIZE > (MAXLINE - 128) -# undef TOBUFSIZE -# define TOBUFSIZE (MAXLINE - 128) -#endif - -/* ** Size of prescan buffer. ** Despite comments in the _sendmail_ book, this probably should ** not be changed; there are some hard-to-define dependencies. diff --git a/src/control.c b/src/control.c new file mode 100644 index 0000000..415818c --- /dev/null +++ b/src/control.c @@ -0,0 +1,356 @@ +/* + * 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; + +/* +** 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; +} +/* +** 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; +} +/* +** 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 + +/* +** 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 diff --git a/src/convtime.c b/src/convtime.c index 5ca1b39..ab8591d 100644 --- a/src/convtime.c +++ b/src/convtime.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)convtime.c 8.9 (Berkeley) 2/1/97"; +static char sccsid[] = "@(#)convtime.c 8.14 (Berkeley) 5/19/1998"; #endif /* not lint */ # include "sendmail.h" diff --git a/src/daemon.c b/src/daemon.c index e62aaf1..ae6b004 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -1,35 +1,13 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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 <errno.h> @@ -37,9 +15,9 @@ #ifndef lint #ifdef DAEMON -static char sccsid[] = "@(#)daemon.c 8.195 (Berkeley) 10/23/97 (with daemon mode)"; +static char sccsid[] = "@(#)daemon.c 8.236 (Berkeley) 1/25/1999 (with daemon mode)"; #else -static char sccsid[] = "@(#)daemon.c 8.195 (Berkeley) 10/23/97 (without daemon mode)"; +static char sccsid[] = "@(#)daemon.c 8.236 (Berkeley) 1/25/1999 (without daemon mode)"; #endif #endif /* not lint */ @@ -125,15 +103,22 @@ getrequests(e) ENVELOPE *e; { int t; - bool refusingconnections = TRUE; + 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 - extern void reapchild(); + 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. @@ -191,11 +176,18 @@ getrequests(e) /* 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 */ - pidf = safefopen(PidFile, O_WRONLY|O_TRUNC, 0644, - SFF_NOLINK|SFF_ROOTOK|SFF_REGONLY|SFF_CREAT); + 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); @@ -223,6 +215,9 @@ getrequests(e) } #endif + /* Add parent process as first item */ + proc_list_add(getpid(), "Sendmail daemon"); + if (tTd(15, 1)) printf("getrequests: %d\n", DaemonSocket); @@ -230,30 +225,34 @@ getrequests(e) { register pid_t pid; auto SOCKADDR_LEN_T lotherend; + bool timedout = FALSE; + bool control = FALSE; int savederrno; int pipefd[2]; - extern bool refuseconnections(); + extern bool refuseconnections __P((int)); /* see if we are rejecting connections */ (void) blocksignal(SIGALRM); - if (refuseconnections(ntohs(port))) + if (curtime() >= refuse_connections_until) { - if (DaemonSocket >= 0) + if (refuseconnections(ntohs(port))) { - /* close socket so peer will fail quickly */ - (void) close(DaemonSocket); - DaemonSocket = -1; - } - refusingconnections = TRUE; - sleep(15); - continue; - } + if (DaemonSocket >= 0) + { + /* close socket so peer fails quickly */ + (void) close(DaemonSocket); + DaemonSocket = -1; + } - /* arrange to (re)open the socket if necessary */ - if (refusingconnections) - { - (void) opendaemonsocket(FALSE); - refusingconnections = FALSE; + /* 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 @@ -280,9 +279,6 @@ getrequests(e) } #endif - /* wait for a connection */ - setproctitle("accepting connections on port %d", - ntohs(port)); #if 0 /* ** Andrew Sun <asun@ieps-sun.ml.com> claims that this will @@ -290,34 +286,97 @@ getrequests(e) ** so is it worth doing this? */ - if (SetNonBlocking(DaemonSocket, FALSE) < 0) + 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); - FD_SET(DaemonSocket, &readfds); - timeout.tv_sec = 60; + + /* 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(DaemonSocket + 1, FDSET_CAST &readfds, - NULL, NULL, &timeout); + t = select(highest + 1, FDSET_CAST &readfds, + NULL, NULL, &timeout); + if (DoQueueRun) (void) runqueue(TRUE, FALSE); - if (t <= 0 || !FD_ISSET(DaemonSocket, &readfds)) - continue; + if (t <= 0) + { + timedout = TRUE; + break; + } + control = FALSE; errno = 0; - lotherend = socksize; - t = accept(DaemonSocket, - (struct sockaddr *)&RealHostAddr, &lotherend); + 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) @@ -328,8 +387,6 @@ getrequests(e) /* arrange to re-open the socket next time around */ (void) close(DaemonSocket); DaemonSocket = -1; - refusingconnections = TRUE; - sleep(5); continue; } @@ -382,12 +439,16 @@ getrequests(e) (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; - setproctitle("startup with %s", + sm_setproctitle(TRUE, "startup with %s", anynet_ntoa(&RealHostAddr)); if (pipefd[0] != -1) @@ -417,36 +478,34 @@ getrequests(e) if (strlen(p) > (SIZE_T) MAXNAME) p[MAXNAME] = '\0'; RealHostName = newstr(p); - setproctitle("startup with %s", 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); - exit(0); + finis(FALSE, EX_OK); } InChannel = inchannel; OutChannel = outchannel; DisConnected = FALSE; - /* open maps for check_relay ruleset */ - initmaps(FALSE, e); - #ifdef XLA if (!xla_host_ok(RealHostName)) { message("421 Too many SMTP sessions for this host"); - exit(0); + finis(FALSE, EX_OK); } #endif - break; } /* parent -- keep track of children */ - proc_list_add(pid); + 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 */ @@ -574,7 +633,7 @@ opendaemonsocket(firsttime) return socksize; } while (ntries++ < MAXOPENTRIES && transienterror(saveerrno)); syserr("!opendaemonsocket: server SMTP socket wedged: exiting"); - finis(); + /*NOTREACHED*/ return -1; /* avoid compiler warning on IRIX */ } /* @@ -814,7 +873,9 @@ makeconnection(host, port, mci, e) if (host[0] == '[') { - long hid; +#if NETINET + unsigned long hid = INADDR_NONE; +#endif register char *p = strchr(host, ']'); if (p != NULL) @@ -908,6 +969,13 @@ gothostent: #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); @@ -1038,6 +1106,12 @@ gothostent: 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) @@ -1061,7 +1135,14 @@ gothostent: /* couldn't connect.... figure out why */ (void) close(s); - if (hp != NULL && hp->h_addr_list[addrno]) + + 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", @@ -1225,6 +1306,9 @@ addrcmp(hp, ha, sa) ** ** 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. @@ -1239,8 +1323,9 @@ authtimeout() } char * -getauthinfo(fd) +getauthinfo(fd, may_be_forged) int fd; + bool *may_be_forged; { SOCKADDR_LEN_T falen; register char *volatile p = NULL; @@ -1248,19 +1333,22 @@ getauthinfo(fd) SOCKADDR_LEN_T lalen; register struct servent *sp; volatile int s; - int i; + int i = 0; EVENT *ev; int nleft; struct hostent *hp; + char *ostype = NULL; char **ha; - volatile bool may_be_forged; char ibuf[MAXNAME + 1]; - static char hbuf[MAXNAME * 2 + 2]; + static char hbuf[MAXNAME * 2 + 11]; + *may_be_forged = FALSE; falen = sizeof RealHostAddr; - if (isatty(fd) || getpeername(fd, &RealHostAddr.sa, &falen) < 0 || + 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)) @@ -1273,19 +1361,18 @@ getauthinfo(fd) /* translate that to a host name */ RealHostName = newstr(hostnamebyanyaddr(&RealHostAddr)); if (strlen(RealHostName) > MAXNAME) - RealHostName[MAXNAME - 1] = '\0'; + RealHostName[MAXNAME] = '\0'; } /* cross check RealHostName with forward DNS lookup */ - if (anynet_ntoa(&RealHostAddr)[0] == '[') + if (anynet_ntoa(&RealHostAddr)[0] == '[' || + RealHostName[0] == '[') { - /* address is not a socket */ - may_be_forged = FALSE; - } - else if (RealHostName[0] == '[') - { - /* have IP address with no forward lookup */ - may_be_forged = FALSE; + /* + ** address is not a socket or have an + ** IP address with no forward lookup + */ + *may_be_forged = FALSE; } else { @@ -1293,13 +1380,13 @@ getauthinfo(fd) hp = sm_gethostbyname(RealHostName); if (hp == NULL) - may_be_forged = TRUE; + *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; + *may_be_forged = *ha == NULL; } } @@ -1407,22 +1494,41 @@ getauthinfo(fd) } /* 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 */ - cleanstrcpy(hbuf, p, MAXNAME); + 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); + RealHostName == NULL ? "localhost" : RealHostName); goto postident; closeident: @@ -1538,22 +1644,24 @@ postident: snprintf(p, SPACELEFT(hbuf, p), "]"); goto postipsr; } -#endif 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) + 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; @@ -1781,6 +1889,9 @@ myhostname(hostbuf, size) ** ** 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 @@ -1792,9 +1903,11 @@ myhostname(hostbuf, size) */ char * -getauthinfo(fd) +getauthinfo(fd, may_be_forged) int fd; + bool *may_be_forged; { + *may_be_forged = FALSE; return NULL; } /* @@ -1837,7 +1950,7 @@ host_map_lookup(map, name, avp, statp) 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); + cp = map_rewrite(map, hp->h_name, strlen(hp->h_name), avp); return cp; } @@ -1865,6 +1978,10 @@ host_map_init(map, args) map->map_app = ++p; break; + case 'T': + map->map_tapp = ++p; + break; + case 'm': map->map_mflags |= MF_MATCHONLY; break; @@ -1880,6 +1997,8 @@ host_map_init(map, args) } 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; } /* @@ -2015,10 +2134,13 @@ hostnamebyanyaddr(sap) _res.retry = saveretry; #endif /* NAMED_BIND */ - if (hp != NULL && hp->h_name[0] != '[') + 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 */ diff --git a/src/deliver.c b/src/deliver.c index 9575515..ed03328 100644 --- a/src/deliver.c +++ b/src/deliver.c @@ -1,47 +1,24 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)deliver.c 8.296 (Berkeley) 10/22/97"; +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> - -extern int h_errno; #endif #if HASSETUSERCONTEXT @@ -83,7 +60,23 @@ sendall(e, mode) int oldverbose = Verbose; bool somedeliveries = FALSE, expensive = FALSE; pid_t pid; - extern void sendenvelope(); + 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 @@ -110,7 +103,7 @@ sendall(e, mode) if (tTd(13, 1)) { - extern void printenvflags(); + extern void printenvflags __P((ENVELOPE *)); printf("\n===== SENDALL: mode %c, id %s, e_from ", mode, e->e_id); @@ -297,8 +290,8 @@ sendall(e, mode) if (owner != NULL && otherowners > 0) { - extern HDR *copyheader(); - extern ADDRESS *copyqueue(); + extern HDR *copyheader __P((HDR *)); + extern ADDRESS *copyqueue __P((ADDRESS *)); extern void dup_queue_file __P((ENVELOPE *, ENVELOPE *, int)); /* @@ -367,7 +360,7 @@ sendall(e, mode) if (mode != SM_VERIFY && bitset(EF_HAS_DF, e->e_flags)) dup_queue_file(e, ee, 'd'); openxscript(ee); - if (LogLevel > 4) + if (mode != SM_VERIFY && LogLevel > 4) sm_syslog(LOG_INFO, ee->e_id, "clone %s, owner=%s", e->e_id, owner); @@ -453,10 +446,12 @@ sendall(e, mode) case SM_QUEUE: case SM_DEFER: +# if HASFLOCK queueonly: +# endif if (e->e_nrcpts > 0) e->e_flags |= EF_INQUEUE; - dropenvelope(e, FALSE); + dropenvelope(e, splitenv != NULL); for (ee = splitenv; ee != NULL; ee = ee->e_sibling) { if (ee->e_nrcpts > 0) @@ -473,36 +468,64 @@ sendall(e, mode) /* ** Since fcntl locking has the interesting semantic that ** the lock is owned by a process, not by an open file - ** descriptor, we have to unlock this envelope, and + ** descriptor, we have to flush this to the queue, and ** then restart from scratch in the child. */ - unlockqueue(e); + { + /* 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) - unlockqueue(ee); + { + /* 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 */ - /* 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; - /* 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 */ @@ -524,8 +547,12 @@ sendall(e, mode) /* prevent parent from waiting if there was an error */ if (pid < 0) { +# if HASFLOCK e->e_flags |= EF_INQUEUE; - finis(); +# else + e->e_id = NULL; +# endif /* HASFLOCK */ + finis(TRUE, ExitStat); } /* be sure to give error messages in child */ @@ -543,6 +570,15 @@ sendall(e, mode) 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 @@ -551,10 +587,15 @@ sendall(e, mode) ** Now reacquire and run the various queue files. */ - for (ee = splitenv; ee != NULL; ee = e->e_sibling) + 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(); + finis(TRUE, ExitStat); # endif /* !HASFLOCK */ } @@ -572,13 +613,13 @@ sendall(e, mode) Verbose = oldverbose; if (mode == SM_FORK) - finis(); + finis(TRUE, ExitStat); } void sendenvelope(e, mode) register ENVELOPE *e; - char mode; + int mode; { register ADDRESS *q; bool didany; @@ -830,10 +871,11 @@ deliver(e, 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 volatile u_short port = 0; + register u_short port = 0; time_t xstart; bool suidwarn; bool anyok; /* at least one address was OK */ @@ -844,7 +886,7 @@ deliver(e, firstto) char tobuf[TOBUFSIZE]; /* text line of to people */ char buf[MAXNAME + 1]; char rpathbuf[MAXNAME + 1]; /* translated return path */ - extern int checkcompat(); + extern int checkcompat __P((ADDRESS *, ENVELOPE *)); extern void markfailure __P((ENVELOPE *, ADDRESS *, MCI *, int)); errno = 0; @@ -878,6 +920,18 @@ deliver(e, firstto) 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 @@ -897,7 +951,7 @@ deliver(e, firstto) p = remotename(p, m, RF_SENDERADDR|RF_CANONICAL, &rcode, e); if (strlen(p) >= (SIZE_T) sizeof rpathbuf) { - p = shortenstring(p, 203); + p = shortenstring(p, MAXSHORTSTR); syserr("remotename: huge return %s", p); } snprintf(rpathbuf, sizeof rpathbuf, "%s", p); @@ -1028,7 +1082,10 @@ deliver(e, firstto) if (m->m_maxsize != 0 && e->e_msgsize > m->m_maxsize) { e->e_flags |= EF_NO_BODY_RETN; - to->q_status = "5.2.3"; + 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); @@ -1043,8 +1100,9 @@ deliver(e, firstto) e->e_from.q_paddr, to->q_paddr, e); if (rcode == EX_OK) { - /* do in-code checking */ - rcode = checkcompat(to, e); + /* do in-code checking if not discarding */ + if (!bitset(EF_DISCARD, e->e_flags)) + rcode = checkcompat(to, e); } if (rcode != EX_OK) { @@ -1052,6 +1110,22 @@ deliver(e, firstto) 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 @@ -1090,13 +1164,26 @@ deliver(e, firstto) if (strcmp(m->m_mailer, "[FILE]") == 0) { - rcode = mailfile(user, ctladdr, SFF_CREAT, e); + 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; - markstats(e, to); if (bitnset(M_LOCALMAILER, m->m_flags) && bitset(QPINGONSUCCESS, to->q_flags)) { @@ -1107,6 +1194,7 @@ deliver(e, firstto) } } to->q_statdate = curtime(); + markstats(e, to, FALSE); continue; } @@ -1216,7 +1304,7 @@ deliver(e, firstto) /* make absolutely certain 0, 1, and 2 are in use */ snprintf(wbuf, sizeof wbuf, "%s... openmailer(%s)", - shortenstring(e->e_to, 203), m->m_name); + shortenstring(e->e_to, MAXSHORTSTR), m->m_name); checkfd012(wbuf); } #endif @@ -1293,7 +1381,6 @@ deliver(e, firstto) tryhost: while (*curhost != '\0') { - register char *p; static char hostbuf[MAXNAME + 1]; extern int makeconnection __P((char *, u_short, MCI *, ENVELOPE *)); @@ -1348,7 +1435,7 @@ tryhost: } /* try the connection */ - setproctitle("%s %s: %s", e->e_id, hostbuf, "user open"); + 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); @@ -1406,6 +1493,24 @@ tryhost: { /* 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') @@ -1430,7 +1535,7 @@ tryhost: if (pipe(mpvect) < 0) { syserr("%s... openmailer(%s): pipe (to mailer)", - shortenstring(e->e_to, 203), m->m_name); + shortenstring(e->e_to, MAXSHORTSTR), m->m_name); if (tTd(11, 1)) printf("openmailer: NULL\n"); rcode = EX_OSERR; @@ -1442,7 +1547,7 @@ tryhost: if (mpvect[0] < 3 || mpvect[1] < 3) { syserr("%s... openmailer(%s): bogus mpvect %d %d", - shortenstring(e->e_to, 203), m->m_name, + shortenstring(e->e_to, MAXSHORTSTR), m->m_name, mpvect[0], mpvect[1]); printopenfds(TRUE); if (tTd(11, 1)) @@ -1461,12 +1566,13 @@ tryhost: { if (e->e_lockfp == NULL) syserr("%s... openmailer(%s): overlapping mpvect %d %d", - shortenstring(e->e_to, 203), m->m_name, - mpvect[0], mpvect[1]); + 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, 203), m->m_name, - mpvect[0], mpvect[1], fileno(e->e_lockfp)); + shortenstring(e->e_to, MAXSHORTSTR), + m->m_name, mpvect[0], mpvect[1], + fileno(e->e_lockfp)); } #endif @@ -1477,7 +1583,8 @@ tryhost: if (pipe(rpvect) < 0) { syserr("%s... openmailer(%s): pipe (from mailer)", - shortenstring(e->e_to, 203), m->m_name); + shortenstring(e->e_to, MAXSHORTSTR), + m->m_name); (void) close(mpvect[0]); (void) close(mpvect[1]); if (tTd(11, 1)) @@ -1503,16 +1610,14 @@ tryhost: if (e->e_xfp != NULL) (void) fflush(e->e_xfp); /* for debugging */ (void) fflush(stdout); -# ifdef SIGCHLD (void) setsignal(SIGCHLD, SIG_DFL); -# endif /* SIGCHLD */ DOFORK(FORK); /* pid is set by DOFORK */ if (pid < 0) { /* failure */ syserr("%s... openmailer(%s): cannot fork", - shortenstring(e->e_to, 203), m->m_name); + shortenstring(e->e_to, MAXSHORTSTR), m->m_name); (void) close(mpvect[0]); (void) close(mpvect[1]); #if SMTP @@ -1580,15 +1685,42 @@ tryhost: else if (ctladdr != NULL && ctladdr->q_gid != 0) { if (!DontInitGroups) - (void) initgroups(ctladdr->q_ruser != NULL ? - ctladdr->q_ruser : ctladdr->q_user, - ctladdr->q_gid); + { + 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) - (void) initgroups(DefUser, DefGid); + { + 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 @@ -1602,13 +1734,13 @@ tryhost: endpwent(); if (bitnset(M_SPECIFIC_UID, m->m_flags)) new_euid = m->m_uid; - if (bitset(S_ISUID, stb.st_mode)) + 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 if (!bitnset(M_SPECIFIC_UID, m->m_flags)) + else new_ruid = DefUid; if (new_euid != NO_UID) { @@ -1644,7 +1776,7 @@ tryhost: /* move into some "safe" directory */ if (m->m_execdir != NULL) { - char *p, *q; + char *q; char buf[MAXLINE + 1]; for (p = m->m_execdir; p != NULL; p = q) @@ -1671,20 +1803,19 @@ tryhost: if (dup2(rpvect[1], STDOUT_FILENO) < 0) { syserr("%s... openmailer(%s): cannot dup pipe %d for stdout", - shortenstring(e->e_to, 203), + shortenstring(e->e_to, MAXSHORTSTR), m->m_name, rpvect[1]); _exit(EX_OSERR); } (void) close(rpvect[1]); } - else if (OpMode == MD_SMTP || OpMode == MD_DAEMON || - HoldErrs || DisConnected) + 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, 203), + shortenstring(e->e_to, MAXSHORTSTR), m->m_name, fileno(e->e_xfp)); _exit(EX_OSERR); } @@ -1693,7 +1824,8 @@ tryhost: if (dup2(STDOUT_FILENO, STDERR_FILENO) < 0) { syserr("%s... openmailer(%s): cannot dup stdout for stderr", - shortenstring(e->e_to, 203), m->m_name); + shortenstring(e->e_to, MAXSHORTSTR), + m->m_name); _exit(EX_OSERR); } @@ -1702,7 +1834,7 @@ tryhost: if (dup2(mpvect[0], STDIN_FILENO) < 0) { syserr("%s... openmailer(%s): cannot dup pipe %d for stdin", - shortenstring(e->e_to, 203), + shortenstring(e->e_to, MAXSHORTSTR), m->m_name, mpvect[0]); _exit(EX_OSERR); } @@ -1734,10 +1866,21 @@ tryhost: ** Set up return value. */ - mci = (MCI *) xalloc(sizeof *mci); - bzero((char *) mci, sizeof *mci); + if (mci == NULL) + { + mci = (MCI *) xalloc(sizeof *mci); + bzero((char *) mci, sizeof *mci); + } mci->mci_mailer = m; - mci->mci_state = clever ? MCIS_OPENING : MCIS_OPEN; + 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"); @@ -1796,6 +1939,7 @@ tryhost: } #endif +do_transfer: /* clear out per-message flags from connection structure */ mci->mci_flags &= ~(MCIF_CVT7TO8|MCIF_CVT8TO7); @@ -1857,8 +2001,9 @@ tryhost: ** Format and send message. */ + mci->mci_contentlen = 0; putfromline(mci, e); - (*e->e_puthdr)(mci, e->e_header, e); + (*e->e_puthdr)(mci, e->e_header, e, M87F_OUTER); (*e->e_putbody)(mci, e, NULL); /* get the exit status */ @@ -1870,7 +2015,6 @@ tryhost: extern int smtpmailfrom __P((MAILER *, MCI *, ENVELOPE *)); extern int smtprcpt __P((ADDRESS *, MAILER *, MCI *, ENVELOPE *)); extern int smtpdata __P((MAILER *, MCI *, ENVELOPE *)); - extern int smtpgetstat __P((MAILER *, MCI *, ENVELOPE *)); /* ** Send the MAIL FROM: protocol @@ -1952,14 +2096,13 @@ tryhost: give_up: #if SMTP -# if _FFR_LMTP if (bitnset(M_LMTP, m->m_flags)) { + lmtp_rcode = rcode; tobuf[0] = '\0'; anyok = FALSE; } else -# endif #endif anyok = rcode == EX_OK; @@ -1970,14 +2113,16 @@ tryhost: continue; #if SMTP -# if _FFR_LMTP /* if running LMTP, get the status for each address */ if (bitnset(M_LMTP, m->m_flags)) { - rcode = smtpgetstat(m, mci, e); + 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) + if (strlen(to->q_paddr) + strlen(tobuf) + 2 > sizeof tobuf) { syserr("LMTP tobuf overflow"); } @@ -1998,7 +2143,6 @@ tryhost: } } else -# endif #endif { /* mark bad addresses */ @@ -2034,7 +2178,6 @@ tryhost: } #if SMTP -# if _FFR_LMTP if (bitnset(M_LMTP, m->m_flags)) { /* @@ -2049,13 +2192,12 @@ tryhost: if (mci != NULL && mci->mci_state == MCIS_ACTIVE) mci->mci_state = MCIS_OPEN; } -# endif #endif if (tobuf[0] != '\0') giveresponse(rcode, m, mci, ctladdr, xstart, e); if (anyok) - markstats(e, tochain); + markstats(e, tochain, FALSE); mci_store_persistent(mci); #if SMTP @@ -2076,7 +2218,7 @@ tryhost: /* 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, 203), + : shortenstring(e->e_to, MAXSHORTSTR), m->m_name); checkfd012(wbuf); } @@ -2134,7 +2276,10 @@ markfailure(e, q, mci, rcode) if (mci != NULL && mci->mci_status != NULL) { q->q_status = mci->mci_status; - q->q_rstatus = mci->mci_rstatus; + if (mci->mci_rstatus != NULL) + q->q_rstatus = newstr(mci->mci_rstatus); + else + q->q_rstatus = NULL; } else if (e->e_status != NULL) { @@ -2337,7 +2482,7 @@ giveresponse(stat, m, mci, ctladdr, xstart, e) statmsg = buf; } } - else if (i < 0 || i > N_SysEx) + else if (i < 0 || i >= N_SysEx) { (void) snprintf(buf, sizeof buf, "554 unknown mailer error %d", stat); @@ -2383,7 +2528,7 @@ giveresponse(stat, m, mci, ctladdr, xstart, e) else { statmsg = SysExMsg[i]; - if (*statmsg++ == ':') + if (*statmsg++ == ':' && errno != 0) { (void) snprintf(buf, sizeof buf, "%s: %s", statmsg, errstring(errno)); @@ -2534,8 +2679,7 @@ logdelivery(m, mci, stat, ctladdr, xstart, e) } else if (strcmp(stat, "queued") != 0) { - char *p = macvalue('h', e); - + p = macvalue('h', e); if (p != NULL && p[0] != '\0') { snprintf(bp, SPACELEFT(buf, bp), ", relay=%s", @@ -2652,8 +2796,7 @@ logdelivery(m, mci, stat, ctladdr, xstart, e) } else if (strcmp(stat, "queued") != 0) { - char *p = macvalue('h', e); - + p = macvalue('h', e); if (p != NULL && p[0] != '\0') snprintf(buf, sizeof buf, "relay=%.100s", p); } @@ -2696,6 +2839,8 @@ putfromline(mci, e) 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; @@ -2708,7 +2853,7 @@ putfromline(mci, e) char hname[MAXNAME]; /* - ** If we can construct a UUCP path, do so + ** If we can construct a UUCP path, do so */ at = strrchr(buf, '@'); @@ -2763,6 +2908,7 @@ putbody(mci, e, separator) char *separator; { char buf[MAXLINE]; + char *boundaries[MAXMIMENESTING + 1]; /* ** Output the body of the message @@ -2804,8 +2950,6 @@ putbody(mci, e, separator) #if MIME8TO7 if (bitset(MCIF_CVT8TO7, mci->mci_flags)) { - char *boundaries[MAXMIMENESTING + 1]; - /* ** Do 8 to 7 bit MIME conversion. */ @@ -2824,6 +2968,7 @@ putbody(mci, e, separator) /* now do the hard work */ boundaries[0] = NULL; + mci->mci_flags |= MCIF_INHEADER; mime8to7(mci, e->e_header, e, boundaries, M87F_OUTER); } # if MIME7TO8 @@ -2832,6 +2977,13 @@ putbody(mci, e, separator) 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 { @@ -2843,9 +2995,9 @@ putbody(mci, e, separator) int padc; char *buflim; int pos = 0; + size_t eol_len; char peekbuf[10]; - /* we can pass it through unmodified */ if (bitset(MCIF_INHEADER, mci->mci_flags)) { putline("", mci); @@ -2857,6 +3009,7 @@ putbody(mci, e, separator) 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; @@ -2925,14 +3078,19 @@ putbody(mci, e, separator) 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 @@ -2957,6 +3115,7 @@ putbody(mci, e, separator) { /* 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, @@ -2989,7 +3148,9 @@ putch: 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", @@ -3005,6 +3166,7 @@ putch: 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; } @@ -3013,6 +3175,7 @@ putch: if (TrafficLogFile != NULL) putc(c, TrafficLogFile); putc(c, mci->mci_out); + mci->mci_contentlen++; pos++; ostate = OS_INLINE; } @@ -3029,7 +3192,10 @@ putch: putc(*xp, TrafficLogFile); } for (xp = buf; xp < bp; xp++) + { putc(*xp, mci->mci_out); + mci->mci_contentlen++; + } pos += bp - buf; } if (pos > 0) @@ -3037,6 +3203,7 @@ putch: if (TrafficLogFile != NULL) fputs(mci->mci_mailer->m_eol, TrafficLogFile); fputs(mci->mci_mailer->m_eol, mci->mci_out); + mci->mci_contentlen += eol_len; } } @@ -3076,6 +3243,8 @@ endofmessage: ** ** 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. @@ -3089,11 +3258,12 @@ endofmessage: */ static jmp_buf CtxMailfileTimeout; -static void mailfiletimeout(); +static void mailfiletimeout __P((void)); int -mailfile(filename, ctladdr, sfflags, e) +mailfile(filename, mailer, ctladdr, sfflags, e) char *volatile filename; + MAILER *volatile mailer; ADDRESS *ctladdr; volatile int sfflags; register ENVELOPE *e; @@ -3102,6 +3272,7 @@ mailfile(filename, ctladdr, sfflags, e) register pid_t pid = -1; volatile int mode = ST_MODE_NOFILE; bool suidwarn = geteuid() == 0; + char *p; EVENT *ev; if (tTd(11, 1)) @@ -3110,6 +3281,9 @@ mailfile(filename, ctladdr, sfflags, e) printaddr(ctladdr, FALSE); } + if (mailer == NULL) + mailer = FileMailer; + if (e->e_xfp != NULL) fflush(e->e_xfp); @@ -3121,6 +3295,19 @@ mailfile(filename, ctladdr, sfflags, e) 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 @@ -3136,6 +3323,7 @@ mailfile(filename, ctladdr, sfflags, e) /* child -- actually write to file */ struct stat stb; MCI mcibuf; + int err; volatile int oflags = O_WRONLY|O_APPEND; if (e->e_lockfp != NULL) @@ -3159,7 +3347,11 @@ mailfile(filename, ctladdr, sfflags, e) ev = NULL; #ifdef HASLSTAT - if (lstat(filename, &stb) < 0) + if (bitset(DBS_FILEDELIVERYTOSYMLINK, DontBlameSendmail)) + err = stat(filename, &stb); + else + err = lstat(filename, &stb); + if (err < 0) #else if (stat(filename, &stb) < 0) #endif @@ -3168,7 +3360,9 @@ mailfile(filename, ctladdr, sfflags, e) mode = FileMode; oflags |= O_CREAT|O_EXCL; } - else if (bitset(0111, stb.st_mode) || stb.st_nlink != 1 || + 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) @@ -3200,7 +3394,12 @@ mailfile(filename, ctladdr, sfflags, e) /* select a new user to run as */ if (!bitset(SFF_RUNASREALUID, sfflags)) { - if (bitset(S_ISUID, mode)) + 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; @@ -3213,10 +3412,10 @@ mailfile(filename, ctladdr, sfflags, e) RealUserName = ctladdr->q_user; RealUid = ctladdr->q_uid; } - else if (FileMailer != NULL && FileMailer->m_uid != 0) + else if (mailer != NULL && mailer->m_uid != 0) { RealUserName = DefUser; - RealUid = FileMailer->m_uid; + RealUid = mailer->m_uid; } else { @@ -3225,12 +3424,14 @@ mailfile(filename, ctladdr, sfflags, e) } /* select a new group to run as */ - if (bitset(S_ISGID, mode)) + 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 (FileMailer != NULL && FileMailer->m_gid != 0) - RealGid = FileMailer->m_gid; + else if (mailer != NULL && mailer->m_gid != 0) + RealGid = mailer->m_gid; else RealGid = DefGid; } @@ -3246,7 +3447,19 @@ mailfile(filename, ctladdr, sfflags, e) /* set group id list (needs /etc/group access) */ if (RealUserName != NULL && !DontInitGroups) - (void) initgroups(RealUserName, RealGid); + { + 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') @@ -3274,15 +3487,43 @@ mailfile(filename, ctladdr, sfflags, e) if (setuid(RealUid) < 0 && suidwarn) syserr("mailfile: setuid(%ld) failed", (long) RealUid); - sfflags |= SFF_NOPATHCHECK|SFF_NOLINK; + /* 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", errstring(errno)); + message("554 cannot open %s: %s", + shortenstring(filename, MAXSHORTSTR), + errstring(errno)); exit(EX_CANTCREAT); } - if (filechanged(filename, fileno(f), &stb, sfflags)) + if (filechanged(filename, fileno(f), &stb)) { message("554 file changed after open"); exit(EX_CANTCREAT); @@ -3297,13 +3538,38 @@ mailfile(filename, ctladdr, sfflags, e) clrevent(ev); bzero(&mcibuf, sizeof mcibuf); - mcibuf.mci_mailer = FileMailer; + mcibuf.mci_mailer = mailer; mcibuf.mci_out = f; - if (bitnset(M_7BITS, FileMailer->m_flags)) + 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); + (*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)) @@ -3330,11 +3596,17 @@ mailfile(filename, ctladdr, sfflags, e) 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("child died on signal %d", st); + syserr("mailfile: %s: child died on signal %d", + mailer->m_name, st); return (EX_UNAVAILABLE); } /*NOTREACHED*/ diff --git a/src/domain.c b/src/domain.c index 13e4afa..b7bed93 100644 --- a/src/domain.c +++ b/src/domain.c @@ -1,44 +1,22 @@ /* - * Copyright (c) 1986, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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 "sendmail.h" #ifndef lint #if NAMED_BIND -static char sccsid[] = "@(#)domain.c 8.68 (Berkeley) 8/2/97 (with name server)"; +static char sccsid[] = "@(#)domain.c 8.81 (Berkeley) 1/21/1999 (with name server)"; #else -static char sccsid[] = "@(#)domain.c 8.68 (Berkeley) 8/2/97 (without name server)"; +static char sccsid[] = "@(#)domain.c 8.81 (Berkeley) 1/21/1999 (without name server)"; #endif #endif /* not lint */ @@ -354,7 +332,8 @@ punt: if (strlen(host) >= (SIZE_T) sizeof MXHostBuf) { *rcode = EX_CONFIG; - syserr("Host name %s too long", shortenstring(host, 203)); + syserr("Host name %s too long", + shortenstring(host, MAXSHORTSTR)); return -1; } snprintf(MXHostBuf, sizeof MXHostBuf, "%s", host); @@ -458,6 +437,7 @@ mxrand(host) ** to generalize it at the moment. */ +/* ARGSUSED3 */ char * bestmx_map_lookup(map, name, av, statp) MAP *map; @@ -466,19 +446,50 @@ bestmx_map_lookup(map, name, av, statp) int *statp; { int nmx; - auto int rcode; 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, &rcode); + 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); - else + 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); } /* ** ISMX -- find if we are the MX for a certain host. @@ -581,7 +592,7 @@ dns_getcanonname(host, hbsize, trymx, statp) char *xp; char nbuf[MAX(MAXPACKET, MAXDNAME*2+2)]; char *searchlist[MAXDNSRCH+2]; - extern char *gethostalias(); + extern char *gethostalias __P((char *)); if (tTd(8, 2)) printf("dns_getcanonname(%s, trymx=%d)\n", host, trymx); @@ -697,7 +708,7 @@ cnameloop: qtype = T_A; continue; } - else if (qtype == T_A && !gotmx && trymx) + else if (qtype == T_A && !gotmx && (trymx || **dp == '\0')) { qtype = T_MX; continue; @@ -858,7 +869,7 @@ cnameloop: if (qtype == T_ANY) qtype = T_A; - else if (qtype == T_A && !gotmx && trymx) + else if (qtype == T_A && !gotmx && (trymx || **dp == '\0')) qtype = T_MX; else { diff --git a/src/envelope.c b/src/envelope.c index 3e0fc20..2cc90d6 100644 --- a/src/envelope.c +++ b/src/envelope.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)envelope.c 8.105 (Berkeley) 6/24/97"; +static char sccsid[] = "@(#)envelope.c 8.122 (Berkeley) 1/25/1999"; #endif /* not lint */ #include "sendmail.h" @@ -108,7 +86,7 @@ dropenvelope(e, fulldrop) if (tTd(50, 1)) { - extern void printenvflags(); + extern void printenvflags __P((ENVELOPE *)); printf("dropenvelope %lx: id=", (u_long) e); xputs(e->e_id); @@ -344,7 +322,7 @@ simpledrop: { if (tTd(50, 1)) { - extern void printenvflags(); + extern void printenvflags __P((ENVELOPE *)); printf("\n===== Dropping [dq]f%s... queueit=%d, e_flags=", e->e_id, queueit); @@ -419,6 +397,7 @@ clearenvelope(e, fullclear) /* now clear out the data */ STRUCTCOPY(BlankEnvelope, *e); + e->e_message = NULL; if (Verbose) e->e_sendmode = SM_DELIVER; bh = BlankEnvelope.e_header; @@ -457,9 +436,9 @@ initsys(e) #ifdef TTYNAME static char ybuf[60]; /* holds tty id */ register char *p; -#endif /* TTYNAME */ extern char *ttyname(); - extern void settime(); +#endif /* TTYNAME */ + extern void settime __P((ENVELOPE *)); /* ** Give this envelope a reality. @@ -766,7 +745,7 @@ setsender(from, e, delimptr, delimchar, internal) if (bitnset(M_CHECKUDB, e->e_from.q_mailer->m_flags)) { register char *p; - extern char *udbsender(); + extern char *udbsender __P((char *)); p = udbsender(e->e_from.q_user); if (p != NULL) @@ -821,7 +800,7 @@ setsender(from, e, delimptr, delimchar, internal) if (FullName != NULL && !internal) define('x', FullName, e); } - else if (!internal && OpMode != MD_DAEMON) + else if (!internal && OpMode != MD_DAEMON && OpMode != MD_SMTP) { if (e->e_from.q_home == NULL) { @@ -847,8 +826,8 @@ setsender(from, e, delimptr, delimchar, internal) if (LogLevel > 2) sm_syslog(LOG_NOTICE, e->e_id, "cannot prescan from (%s)", - shortenstring(from, 203)); - finis(); + shortenstring(from, MAXSHORTSTR)); + finis(TRUE, ExitStat); } (void) rewrite(pvp, 3, 0, e); (void) rewrite(pvp, 1, 0, e); @@ -869,7 +848,7 @@ setsender(from, e, delimptr, delimchar, internal) bitnset(M_CANONICAL, e->e_from.q_mailer->m_flags)) { char **lastat; - extern char **copyplist(); + extern char **copyplist __P((char **, bool)); /* get rid of any pesky angle brackets */ (void) rewrite(pvp, 3, 0, e); @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)err.c 8.65 (Berkeley) 10/18/97"; +static char sccsid[] = "@(#)err.c 8.74 (Berkeley) 6/4/1998"; #endif /* not lint */ # include "sendmail.h" @@ -273,7 +251,7 @@ usrerr(fmt, va_alist) ** none. */ -/*VARARGS2*/ +/*VARARGS1*/ void #ifdef __STDC__ message(const char *msg, ...) @@ -325,7 +303,7 @@ message(msg, va_alist) ** none. */ -/*VARARGS2*/ +/*VARARGS1*/ void #ifdef __STDC__ nmessage(const char *msg, ...) @@ -456,7 +434,7 @@ putoutmsg(msg, holdmsg, heldmsg) sm_syslog(LOG_CRIT, CurEnv->e_id, "SYSERR: putoutmsg (%s): error on output channel sending \"%s\": %s", CurHostName == NULL ? "NO-HOST" : CurHostName, - shortenstring(msg, 203), errstring(errno)); + shortenstring(msg, MAXSHORTSTR), errstring(errno)); } /* ** PUTERRMSG -- like putoutmsg, but does special processing for error messages @@ -533,7 +511,9 @@ fmtmsg(eb, to, num, eno, fmt, ap) int spaceleft = sizeof MsgBuf; /* output the reply code */ - if (isdigit(fmt[0]) && isdigit(fmt[1]) && isdigit(fmt[2])) + if (isascii(fmt[0]) && isdigit(fmt[0]) && + isascii(fmt[1]) && isdigit(fmt[1]) && + isascii(fmt[2]) && isdigit(fmt[2])) { num = fmt; fmt += 4; @@ -561,7 +541,7 @@ fmtmsg(eb, to, num, eno, fmt, ap) strncmp(num, "251", 3) != 0) { (void) snprintf(eb, spaceleft, "%s... ", - shortenstring(to, 203)); + shortenstring(to, MAXSHORTSTR)); spaceleft -= strlen(eb); while (*eb != '\0') *eb++ &= 0177; @@ -657,7 +637,10 @@ errstring(errnum) #if HASSTRERROR snprintf(bp, SPACELEFT(buf, bp), "%s", strerror(errnum)); #else - snprintf(bp, SPACELEFT(buf, bp), "%s", sys_errlist[errnum]); + 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) @@ -675,7 +658,7 @@ errstring(errnum) bp += strlen(bp); } snprintf(bp, SPACELEFT(buf, bp), "%s", - shortenstring(CurHostName, 203)); + shortenstring(CurHostName, MAXSHORTSTR)); bp += strlen(buf); } if (SmtpPhase != NULL) @@ -689,14 +672,14 @@ errstring(errnum) if (CurHostName == NULL) break; (void) snprintf(buf, sizeof buf, "Host %s is down", - shortenstring(CurHostName, 203)); + shortenstring(CurHostName, MAXSHORTSTR)); return (buf); case ECONNREFUSED: if (CurHostName == NULL) break; (void) snprintf(buf, sizeof buf, "Connection refused by %s", - shortenstring(CurHostName, 203)); + shortenstring(CurHostName, MAXSHORTSTR)); return (buf); # endif @@ -765,7 +748,7 @@ errstring(errnum) if (CurHostName != NULL) { snprintf(bp, SPACELEFT(buf, bp), "%s: ", - shortenstring(CurHostName, 203)); + shortenstring(CurHostName, MAXSHORTSTR)); bp += strlen(bp); } snprintf(bp, SPACELEFT(buf, bp), "%s", dnsmsg); diff --git a/src/headers.c b/src/headers.c index 857e9c3..6c43dcb 100644 --- a/src/headers.c +++ b/src/headers.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)headers.c 8.115 (Berkeley) 10/22/97"; +static char sccsid[] = "@(#)headers.c 8.136 (Berkeley) 1/26/1999"; #endif /* not lint */ # include <errno.h> @@ -99,6 +77,7 @@ chompheader(line, def, hdrp, e) bool headeronly; STAB *s; struct hdrinfo *hi; + bool nullheader = FALSE; BITMAP mopts; if (tTd(31, 6)) @@ -145,17 +124,22 @@ chompheader(line, def, hdrp, e) return 0; } *fvalue = '\0'; - fvalue = p; /* strip field value on front */ - if (*fvalue == ' ') - fvalue++; + 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; -#if _FFR_HEADER_RSCHECK /* check to see if it represents a ruleset call */ if (def) { @@ -177,7 +161,6 @@ chompheader(line, def, hdrp, e) return 0; } } -#endif /* see if it is a known type */ s = stab(fname, ST_HEADER, ST_FIND); @@ -206,7 +189,7 @@ chompheader(line, def, hdrp, e) (void) sendtolist(fvalue, NULLADDR, &e->e_errorqueue, 0, e); /* if this means "end of header" quit now */ - if (bitset(H_EOH, hi->hi_flags)) + if (!headeronly && bitset(H_EOH, hi->hi_flags)) return hi->hi_flags; /* @@ -260,6 +243,11 @@ chompheader(line, def, hdrp, e) 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) { @@ -278,6 +266,10 @@ chompheader(line, def, hdrp, e) 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) @@ -463,7 +455,22 @@ eatheader(e, full) /* 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"); @@ -493,7 +500,7 @@ eatheader(e, full) { if (bitset(H_FROM, h->h_flags)) { - extern char *crackaddr(); + extern char *crackaddr __P((char *)); expand(crackaddr(buf), buf, sizeof buf, e); } @@ -517,15 +524,17 @@ eatheader(e, full) !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. + ** Change functionality so a fatal error on an + ** address doesn't affect the entire envelope. */ /* delete fatal errors generated by this address */ @@ -1152,6 +1161,7 @@ crackaddr(addr) ** mci -- the connection information. ** h -- the header to put. ** e -- envelope to use. +** flags -- MIME conversion flags. ** ** Returns: ** none. @@ -1168,10 +1178,11 @@ crackaddr(addr) #endif void -putheader(mci, hdr, e) +putheader(mci, hdr, e, flags) register MCI *mci; HDR *hdr; register ENVELOPE *e; + int flags; { register HDR *h; char buf[MAX(MAXLINE,BUFSIZ)]; @@ -1181,11 +1192,19 @@ putheader(mci, hdr, e) printf("--- putheader, mailer = %s ---\n", mci->mci_mailer->m_name); - mci->mci_flags |= MCIF_INHEADER; + /* + ** 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(); + extern bool bitintersect __P((BITMAP, BITMAP)); if (tTd(34, 11)) { @@ -1193,9 +1212,69 @@ putheader(mci, hdr, e) xputs(p); } - /* suppress Content-Transfer-Encoding: if we are MIMEing */ +#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(MCIF_CVT8TO7|MCIF_CVT7TO8|MCIF_INMIME, + mci->mci_flags) && + !bitset(M87F_NO8TO7, flags)) { if (tTd(34, 11)) printf(" (skipped (content-transfer-encoding))\n"); @@ -1483,7 +1562,7 @@ commaize(h, p, oldstyle, mci, e) else if (e->e_from.q_mailer != NULL && bitnset(M_UDBRECIPIENT, e->e_from.q_mailer->m_flags)) { - extern char *udbsender(); + extern char *udbsender __P((char *)); char *q; q = udbsender(name); @@ -1563,3 +1642,69 @@ copyheader(header) return ret; } +/* +** 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; +} diff --git a/src/ldap_map.h b/src/ldap_map.h index dd85da3..7d40329 100644 --- a/src/ldap_map.h +++ b/src/ldap_map.h @@ -1,11 +1,20 @@ /* + * 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@networking.stanford.edu>. +** 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.4 (Berkeley) 6/3/97 +** @(#)ldap_map.h 8.12 (Berkeley) 2/2/1999 */ #ifndef _LDAP_MAP_H @@ -52,11 +61,31 @@ typedef struct ldap_map_struct LDAP_MAP_STRUCT; #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 256 +#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 */ diff --git a/src/macro.c b/src/macro.c index 0f31d11..d45a0c7 100644 --- a/src/macro.c +++ b/src/macro.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)macro.c 8.18 (Berkeley) 2/1/97"; +static char sccsid[] = "@(#)macro.c 8.26 (Berkeley) 11/8/1998"; #endif /* not lint */ # include "sendmail.h" @@ -72,7 +50,7 @@ expand(s, buf, bufsize, e) int i; int skiplev; /* skipping nesting level */ int iflev; /* if nesting level */ - char xbuf[BUFSIZ]; + char xbuf[MACBUFSIZE]; static int explevel = 0; if (tTd(35, 24)) @@ -229,6 +207,8 @@ expand(s, buf, bufsize, e) ** $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. @@ -353,7 +333,7 @@ macid(p, ep) { int mid; register char *bp; - char mbuf[21]; + char mbuf[MAXMACNAMELEN + 1]; if (tTd(35, 14)) { @@ -381,7 +361,7 @@ macid(p, ep) return *p; } bp = mbuf; - while (*++p != '\0' && *p != '}' && bp < &mbuf[sizeof mbuf]) + while (*++p != '\0' && *p != '}' && bp < &mbuf[sizeof mbuf - 1]) { if (isascii(*p) && (isalnum(*p) || *p == '_')) *bp++ = *p; diff --git a/src/mailq.0 b/src/mailq.0 index f1a996f..0f6c376 100644 --- a/src/mailq.0 +++ b/src/mailq.0 @@ -38,4 +38,4 @@ SSEEEE AALLSSOO HHIISSTTOORRYY The mmaaiillqq command appeared in 4.0BSD. -4th Berkeley Distribution February 22, 1994 1 +4th Berkeley Distribution May 19, 1998 1 diff --git a/src/mailq.1 b/src/mailq.1 index b489f31..8b6e63a 100644 --- a/src/mailq.1 +++ b/src/mailq.1 @@ -1,38 +1,16 @@ -.\" Copyright (c) 1983, 1997 Eric P. Allman +.\" 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. .\" -.\" 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. +.\" 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 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. .\" -.\" @(#)mailq.1 8.5 (Berkeley) 2/1/97 +.\" @(#)mailq.1 8.10 (Berkeley) 5/19/1998 .\" -.Dd February 1, 1997 +.Dd May 19, 1998 .Dt MAILQ 1 .Os BSD 4 .Sh NAME diff --git a/src/mailstats.h b/src/mailstats.h index 0164d91..86390b3 100644 --- a/src/mailstats.h +++ b/src/mailstats.h @@ -1,49 +1,34 @@ /* - * Copyright (c) 1983 Eric P. Allman + * 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. * - * 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. + * 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 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. * - * @(#)mailstats.h 8.1 (Berkeley) 6/7/93 + * @(#)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 */ }; @@ -1,51 +1,32 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint static char copyright[] = -"@(#) Copyright (c) 1988, 1993\n\ +"@(#) 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.258 (Berkeley) 10/20/97"; +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 @@ -74,6 +55,7 @@ static char sccsid[] = "@(#)main.c 8.258 (Berkeley) 10/20/97"; ** (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. @@ -95,7 +77,7 @@ int MissingFds = 0; /* bit map of fds missing on startup */ GIDSET_T InitialGidSet[NGROUPS_MAX]; #endif -static void obsolete(); +static void obsolete __P((char **)); extern void printmailer __P((MAILER *)); extern void tTflag __P((char *)); @@ -106,7 +88,7 @@ ERROR %%%% Cannot have DAEMON mode without SMTP %%%% ERROR ERROR %%%% Cannot have SMTP mode without QUEUE %%%% ERROR #endif /* DAEMON && !SMTP */ -#define MAXCONFIGLEVEL 7 /* highest config version level known */ +#define MAXCONFIGLEVEL 8 /* highest config version level known */ int main(argc, argv, envp) @@ -129,22 +111,25 @@ main(argc, argv, envp) static bool reenter = FALSE; struct passwd *pw; struct hostent *hp; - bool nullserver = FALSE; + 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(); + extern time_t convtime __P((char *, char)); extern SIGFUNC_DECL intsig __P((int)); - extern struct hostent *myhostname(); - extern char *getauthinfo(); - extern char *getcfname(); + 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)); @@ -159,6 +144,9 @@ main(argc, argv, envp) 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. @@ -250,6 +238,9 @@ main(argc, argv, envp) setsignal(SIGUSR1, sigusr1); #endif + /* initialize for setproctitle */ + initsetproctitle(argc, argv, envp); + /* Handle any non-getoptable constructions. */ obsolete(argv); @@ -311,17 +302,36 @@ main(argc, argv, envp) (void) snprintf(rnamebuf, sizeof rnamebuf, "Unknown UID %d", RealUid); RealUserName = rnamebuf; - /* if running non-setuid binary, pretend we are the RunAsUid */ - if (geteuid() == RealUid) + 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", - RealUid); + (int)RealUid); RunAsUid = RealUid; } - if (getegid() == RealGid) + 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; ) @@ -402,14 +412,26 @@ main(argc, argv, envp) InChannel = stdin; OutChannel = stdout; - /* initialize for setproctitle */ - initsetproctitle(argc, argv, envp); - /* 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"); @@ -504,8 +526,6 @@ main(argc, argv, envp) #if NETINET if (hp->h_addrtype == AF_INET && hp->h_length == INADDRSZ) { - register int i; - for (i = 0; hp->h_addr_list[i] != NULL; i++) { char ipbuf[103]; @@ -523,8 +543,12 @@ main(argc, argv, envp) /* current time */ define('b', arpadate((char *) NULL), CurEnv); + QueueLimitRecipient = (QUEUE_CHAR *) NULL; + QueueLimitSender = (QUEUE_CHAR *) NULL; + QueueLimitId = (QUEUE_CHAR *) NULL; + /* - ** Crack argv. + ** Crack argv. */ av = argv; @@ -690,15 +714,27 @@ main(argc, argv, envp) switch (optarg[0]) { case 'I': - QueueLimitId = newstr(&optarg[1]); + 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': - QueueLimitRecipient = newstr(&optarg[1]); + 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': - QueueLimitSender = newstr(&optarg[1]); + 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: @@ -798,8 +834,7 @@ main(argc, argv, envp) # endif default: - ExitStat = EX_USAGE; - finis(); + finis(TRUE, EX_USAGE); break; } } @@ -850,7 +885,7 @@ main(argc, argv, envp) ** Find our real host name for future logging. */ - p = getauthinfo(STDIN_FILENO); + p = getauthinfo(STDIN_FILENO, &forged); define('_', p, CurEnv); /* suppress error printing if errors mailed back or whatever */ @@ -934,16 +969,20 @@ main(argc, argv, envp) } /* check for permissions */ - if ((OpMode == MD_DAEMON || OpMode == MD_PURGESTAT) && RealUid != 0) + 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_DAEMON ? "run daemon" - : "purge host status"); + OpMode != MD_PURGESTAT ? "run daemon" + : "purge host status"); usrerr("Permission denied"); - exit(EX_USAGE); + finis(FALSE, EX_USAGE); } if (MeToo) @@ -954,8 +993,18 @@ main(argc, argv, envp) case MD_TEST: /* don't have persistent host status in test mode */ HostStatDir = NULL; - Verbose = 2; + 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: @@ -983,6 +1032,7 @@ main(argc, argv, envp) case MD_INITALIAS: Verbose = 2; CurEnv->e_errormode = EM_PRINT; + HoldErrs = FALSE; /* fall through... */ case MD_PRINT: @@ -997,9 +1047,32 @@ main(argc, argv, envp) break; } - /* full names can't have newlines */ - if (FullName != NULL && strchr(FullName, '\n') != NULL) - FullName = newstr(denlstring(FullName, TRUE, TRUE)); + /* 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) @@ -1011,6 +1084,24 @@ main(argc, argv, envp) 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; @@ -1120,6 +1211,22 @@ main(argc, argv, envp) 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) { @@ -1162,18 +1269,14 @@ main(argc, argv, envp) { /* nope, really a botch */ usrerr("You do not have permission to process the queue"); - exit (EX_NOPERM); + finis(FALSE, EX_NOPERM); } } # endif /* QUEUE */ /* if we've had errors so far, exit now */ if (ExitStat != EX_OK && OpMode != MD_TEST) - { - endpwent(); - setuid(RealUid); - exit(ExitStat); - } + finis(FALSE, ExitStat); #if XDEBUG checkfd012("before main() initmaps"); @@ -1189,47 +1292,44 @@ main(argc, argv, envp) /* print the queue */ #if QUEUE dropenvelope(CurEnv, TRUE); + signal(SIGPIPE, quiesce); printqueue(); - endpwent(); - setuid(RealUid); - exit(EX_OK); + finis(FALSE, EX_OK); #else /* QUEUE */ usrerr("No queue to print"); - finis(); + finis(FALSE, ExitStat); #endif /* QUEUE */ + break; case MD_HOSTSTAT: + signal(SIGPIPE, quiesce); mci_traverse_persistent(mci_print_persistent, NULL); - exit(EX_OK); + finis(FALSE, EX_OK); break; case MD_PURGESTAT: mci_traverse_persistent(mci_purge_persistent, NULL); - exit(EX_OK); + finis(FALSE, EX_OK); break; case MD_INITALIAS: - /* initialize alias database */ + /* initialize maps */ initmaps(TRUE, CurEnv); - endpwent(); - setuid(RealUid); - exit(ExitStat); + finis(FALSE, ExitStat); + break; case MD_SMTP: - nullserver = FALSE; - /* fall through... */ - 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 alias database -- done in srvrsmtp */ + /* don't open maps for daemon -- done below in child */ break; default: - /* open the alias database */ + /* open the maps */ initmaps(FALSE, CurEnv); break; } @@ -1279,15 +1379,15 @@ main(argc, argv, envp) { extern void testmodeline __P((char *, ENVELOPE *)); - if (Verbose) + if (Verbose == 2) printf("> "); (void) fflush(stdout); if (fgets(buf, sizeof buf, stdin) == NULL) - finis(); + finis(TRUE, ExitStat); p = strchr(buf, '\n'); if (p != NULL) *p = '\0'; - if (!Verbose) + if (Verbose < 2) printf("> %s\n", buf); testmodeline(buf, CurEnv); } @@ -1301,7 +1401,7 @@ main(argc, argv, envp) if (queuemode && OpMode != MD_DAEMON && QueueIntvl == 0) { (void) runqueue(FALSE, Verbose); - finis(); + finis(TRUE, ExitStat); } # endif /* QUEUE */ @@ -1326,7 +1426,7 @@ main(argc, argv, envp) if (i < 0) syserr("daemon: cannot fork"); if (i != 0) - exit(0); + finis(FALSE, EX_OK); /* disconnect from our controlling tty */ disconnect(2, CurEnv); @@ -1379,13 +1479,8 @@ main(argc, argv, envp) ** Get authentication data */ - p = getauthinfo(fileno(InChannel)); + p = getauthinfo(fileno(InChannel), &forged); define('_', p, &BlankEnvelope); - - /* validate the connection */ - HoldErrs = TRUE; - nullserver = !validate_connection(&RealHostAddr, RealHostName, CurEnv); - HoldErrs = FALSE; #endif /* DAEMON */ } @@ -1398,13 +1493,24 @@ main(argc, argv, envp) if (OpMode == MD_SMTP || OpMode == MD_DAEMON) { char pbuf[20]; - extern void smtp __P((bool, ENVELOPE *)); + extern void smtp __P((char *, ENVELOPE *)); /* ** Save some macros for check_* rulesets. */ - define(macid("{client_name}", NULL), RealHostName, &BlankEnvelope); + 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) @@ -1413,6 +1519,17 @@ main(argc, argv, envp) 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 */ @@ -1421,9 +1538,7 @@ main(argc, argv, envp) if (OpMode == MD_VERIFY) { CurEnv->e_sendmode = SM_VERIFY; - CurEnv->e_errormode = EM_PRINT; PostMasterCopy = NULL; - HoldErrs = FALSE; } else { @@ -1451,7 +1566,7 @@ main(argc, argv, envp) /* collect body for UUCP return */ if (OpMode != MD_VERIFY) collect(InChannel, FALSE, NULL, CurEnv); - finis(); + finis(TRUE, ExitStat); } /* @@ -1464,6 +1579,21 @@ main(argc, argv, envp) 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. */ @@ -1480,7 +1610,7 @@ main(argc, argv, envp) /* bail out if message too large */ if (bitset(EF_CLRQUEUE, CurEnv->e_flags)) { - finis(); + finis(TRUE, ExitStat); /*NOTREACHED*/ return -1; } @@ -1504,6 +1634,7 @@ main(argc, argv, envp) } CurEnv->e_to = NULL; CurrentLA = getla(); + GrabTo = FALSE; sendall(CurEnv, SM_DEFAULT); /* @@ -1511,12 +1642,20 @@ main(argc, argv, envp) ** Don't send return error message if in VERIFY mode. */ - finis(); + finis(TRUE, ExitStat); /*NOTREACHED*/ return -1; } +/* ARGSUSED */ +SIGFUNC_DECL +quiesce(sig) + int sig; +{ + finis(FALSE, EX_OK); +} +/* ARGSUSED */ SIGFUNC_DECL intindebug(sig) int sig; @@ -1530,7 +1669,8 @@ intindebug(sig) ** FINIS -- Clean up and exit. ** ** Parameters: -** none +** drop -- whether or not to drop CurEnv envelope +** exitstat -- exit status to use for exit() call ** ** Returns: ** never @@ -1540,14 +1680,21 @@ intindebug(sig) */ void -finis() +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(); + extern void printenvflags __P((ENVELOPE *)); printf("\n====finis: stat %d e_id=%s e_flags=", - ExitStat, + exitstat, CurEnv->e_id == NULL ? "NOQUEUE" : CurEnv->e_id); printenvflags(CurEnv); } @@ -1563,12 +1710,20 @@ finis() /* clean up temp files */ CurEnv->e_to = NULL; - if (CurEnv->e_id != 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(); @@ -1580,14 +1735,14 @@ finis() sm_syslog(LOG_DEBUG, CurEnv->e_id, "finis, pid=%d", getpid()); - if (ExitStat == EX_TEMPFAIL || CurEnv->e_errormode == EM_BERKNET) - ExitStat = EX_OK; + if (exitstat == EX_TEMPFAIL || CurEnv->e_errormode == EM_BERKNET) + exitstat = EX_OK; /* reset uid for process accounting */ endpwent(); setuid(RealUid); - exit(ExitStat); + exit(exitstat); } /* ** INTSIG -- clean up on interrupt @@ -1605,6 +1760,7 @@ finis() ** Unlocks the current job. */ +/* ARGSUSED */ SIGFUNC_DECL intsig(sig) int sig; @@ -1613,15 +1769,11 @@ intsig(sig) sm_syslog(LOG_DEBUG, CurEnv->e_id, "interrupt"); FileName = NULL; unlockqueue(CurEnv); + closecontrolsocket(TRUE); #ifdef XLA xla_all_end(); #endif - - /* reset uid for process accounting */ - endpwent(); - setuid(RealUid); - - exit(EX_OK); + finis(FALSE, EX_OK); } /* ** INITMACROS -- initialize the macro system @@ -1752,7 +1904,10 @@ disconnect(droplev, e) (void) fclose(InChannel); InChannel = stdin; } - (void) freopen("/dev/null", "r", 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) @@ -1763,9 +1918,21 @@ disconnect(droplev, e) 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); @@ -1876,7 +2043,7 @@ auth_warning(e, msg, va_alist) { register char *p; static char hostbuf[48]; - extern struct hostent *myhostname(); + extern struct hostent *myhostname __P((char *, int)); if (hostbuf[0] == '\0') (void) myhostname(hostbuf, sizeof hostbuf); @@ -2017,6 +2184,7 @@ dumpstate(when) } +/* ARGSUSED */ SIGFUNC_DECL sigusr1(sig) int sig; @@ -2026,6 +2194,7 @@ sigusr1(sig) } +/* ARGSUSED */ SIGFUNC_DECL sighup(sig) int sig; @@ -2034,23 +2203,24 @@ sighup(sig) { if (LogLevel > 3) sm_syslog(LOG_INFO, NOQID, "could not restart: need full path"); - exit(EX_OSFILE); + 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); - exit(EX_OSERR); + 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]); - exit(EX_OSFILE); + finis(FALSE, EX_OSFILE); } /* ** DROP_PRIVILEGES -- reduce privileges to those of the RunAsUser option @@ -2069,13 +2239,11 @@ drop_privileges(to_real_uid) bool to_real_uid; { int rval = EX_OK; -#ifdef NGROUPS_MAX - GIDSET_T emptygidset[NGROUPS_MAX]; -#endif + GIDSET_T emptygidset[1]; if (tTd(47, 1)) printf("drop_privileges(%d): Real[UG]id=%d:%d, RunAs[UG]id=%d:%d\n", - to_real_uid, RealUid, RealGid, RunAsUid, RunAsGid); + (int)to_real_uid, (int)RealUid, (int)RealGid, (int)RunAsUid, (int)RunAsGid); if (to_real_uid) { @@ -2087,17 +2255,22 @@ drop_privileges(to_real_uid) /* make sure no one can grab open descriptors for secret files */ endpwent(); -#ifdef NGROUPS_MAX /* reset group permissions; these can be set later */ emptygidset[0] = (to_real_uid || RunAsGid != 0) ? RunAsGid : getegid(); - (void) setgroups(1, emptygidset); -#endif + 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; } /* @@ -2387,13 +2560,14 @@ testmodeline(line, e) 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' && !isspace(*q); q++) + for (q = p; *q != '\0' && !(isascii(*q) && isspace(*q)); q++) continue; if (*q == '\0') { @@ -2413,8 +2587,10 @@ testmodeline(line, e) 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, NULL, &rcode); + (&map->s_map, q, av, &rcode); if (p == NULL) printf("no match (%d)\n", rcode); else @@ -2542,8 +2718,8 @@ testmodeline(line, e) while (*p != '\0') { int stat; - int rs = strtorwset(p, NULL, ST_FIND); + rs = strtorwset(p, NULL, ST_FIND); if (rs < 0) { printf("Undefined ruleset %s\n", p); diff --git a/src/makesendmail b/src/makesendmail index a28e2f4..6308dba 100755..120000 --- a/src/makesendmail +++ b/src/makesendmail @@ -1,331 +1 @@ -#!/bin/sh - -# Copyright (c) 1993, 1996-1997 Eric P. Allman -# Copyright (c) 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. -# -# @(#)makesendmail 8.45 (Berkeley) 4/12/97 -# - -# -# A quick-and-dirty script to compile sendmail in the presence of -# multiple architectures and Makefiles. -# - -if [ "x${1-""}" = "x-m" ] -then - # show Makefile name only - mflag=1 -else - mflag="" -fi - -# -# 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 -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;; -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 [ "$os" = "$node" -a "$rel" = 4.0 -a "$arch" = "3360,3430-R" ] -then - # AT&T/NCR Machines also set uname -s == uname -n - if [ -d /usr/sadm/sysadm/add-ons/WIN-TCP ] - then - os=NCR.MP-RAS.2.x - else - os=NCR.MP-RAS.3.x - fi -fi - -case $os -in - DYNIX-ptx) os=PTX;; - Paragon*) os=Paragon;; - HP-UX) rel=`echo $rel | sed -e 's/^[^.]*\.0*//'`;; - AIX) rel=`uname -v` - if [ "$rel" = "2" ] - then - arch="" - fi;; - 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;; -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" - -# 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 -else - # no existing obj directory -- try to create one if Makefile found - obj=obj.$os.$rel.$arch$sfx - if [ -r Makefiles/Makefile.$os.$rel.$arch$sfx ]; then - makefile=Makefile.$os.$rel.$arch$sfx - elif [ -r Makefiles/Makefile.$os.$rel.$arch ]; then - makefile=Makefile.$os.$rel.$arch - elif [ -r Makefiles/Makefile.$os.$rroot.$arch$sfx ]; then - makefile=Makefile.$os.$rroot.$arch$sfx - elif [ -r Makefiles/Makefile.$os.$rroot.$arch ]; then - makefile=Makefile.$os.$rroot.$arch - elif [ -r Makefiles/Makefile.$os.$rbase.x.$arch$sfx ]; then - makefile=Makefile.$os.$rbase.x.$arch$sfx - elif [ -r Makefiles/Makefile.$os.$rbase.x.$arch ]; then - makefile=Makefile.$os.$rbase.x.$arch - elif [ -r Makefiles/Makefile.$os.$rel$sfx ]; then - makefile=Makefile.$os.$rel$sfx - elif [ -r Makefiles/Makefile.$os.$rel ]; then - makefile=Makefile.$os.$rel - elif [ -r Makefiles/Makefile.$os.$rroot$sfx ]; then - makefile=Makefile.$os.$rroot$sfx - elif [ -r Makefiles/Makefile.$os.$rroot ]; then - makefile=Makefile.$os.$rroot - elif [ -r Makefiles/Makefile.$os.$rbase.x$sfx ]; then - makefile=Makefile.$os.$rbase.x$sfx - elif [ -r Makefiles/Makefile.$os.$rbase.x ]; then - makefile=Makefile.$os.$rbase.x - elif [ -r Makefiles/Makefile.$os.$arch$sfx ]; then - makefile=Makefile.$os.$arch$sfx - elif [ -r Makefiles/Makefile.$os.$arch ]; then - makefile=Makefile.$os.$arch - elif [ -r Makefiles/Makefile.$rel.$arch$sfx ]; then - makefile=Makefile.$rel.$arch$sfx - elif [ -r Makefiles/Makefile.$rel.$arch ]; then - makefile=Makefile.$rel.$arch - elif [ -r Makefiles/Makefile.$rroot.$arch$sfx ]; then - makefile=Makefile.$rroot.$arch$sfx - elif [ -r Makefiles/Makefile.$rroot.$arch ]; then - makefile=Makefile.$rroot.$arch - elif [ -r Makefiles/Makefile.$rbase.x.$arch$sfx ]; then - makefile=Makefile.$rbase.x.$arch$sfx - elif [ -r Makefiles/Makefile.$rbase.x.$arch ]; then - makefile=Makefile.$rbase.x.$arch - elif [ -r Makefiles/Makefile.$os$sfx ]; then - makefile=Makefile.$os$sfx - elif [ -r Makefiles/Makefile.$os ]; then - makefile=Makefile.$os - elif [ -r Makefiles/Makefile.$arch$sfx ]; then - makefile=Makefile.$arch$sfx - elif [ -r Makefiles/Makefile.$arch ]; then - makefile=Makefile.$arch - elif [ -r Makefiles/Makefile.$rel$sfx ]; then - makefile=Makefile.$rel$sfx - elif [ -r Makefiles/Makefile.$rel ]; then - makefile=Makefile.$rel - elif [ -r Makefiles/Makefile.$rel$sfx ]; then - makefile=Makefile.$rel$sfx - else - echo "Cannot determine how to support $arch.$os.$rel" - exit 1 - fi - if [ "$mflag" ] - then - echo "Will run in virgin $obj using $makefile" - exit 0 - fi - echo "Creating $obj using $makefile" - mkdir $obj - (cd $obj; ln -s ../*.[ch158] ../sendmail.hf .; ln -s ../Makefiles/$makefile Makefile) - 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" - exit 1 - fi - case $makefile - in - ../Makefiles/*) - makefile=`echo $makefile | sed 's/...Makefiles.//'` - echo "Will run in existing $obj using $makefile" - ;; - - *) - echo "Will run in existing $obj using custom $makefile" - ;; - esac - exit 0 -fi - -echo "Making in $obj" -cd $obj -if [ $# = 0 ] -then - exec ${MAKE-make} -else - exec ${MAKE-make} "$@" -fi +../BuildTools/bin/Build
\ No newline at end of file @@ -1,39 +1,17 @@ /* - * Copyright (c) 1992, 1995-1997 Eric P. Allman. + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)map.c 8.186 (Berkeley) 10/21/97"; +static char sccsid[] = "@(#)map.c 8.261 (Berkeley) 2/2/1999"; #endif /* not lint */ #include "sendmail.h" @@ -42,13 +20,16 @@ static char sccsid[] = "@(#)map.c 8.186 (Berkeley) 10/21/97"; # include <ndbm.h> # ifdef R_FIRST ERROR README: You are running the Berkeley DB version of ndbm.h. See - ERROR README: the READ_ME file about tweaking Berkeley DB so it can + 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 */ @@ -182,6 +163,10 @@ map_parseargs(map, ap) map->map_app = ++p; break; + case 'T': + map->map_tapp = ++p; + break; + case 'k': while (isascii(*++p) && isspace(*p)) continue; @@ -236,6 +221,8 @@ map_parseargs(map, ap) } 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) @@ -289,21 +276,21 @@ char * map_rewrite(map, s, slen, av) register MAP *map; register const char *s; - int slen; + size_t slen; char **av; { register char *bp; register char c; char **avp; register char *ap; - int i; - int len; - static int buflen = -1; + size_t l; + size_t len; + static size_t buflen = 0; static char *buf = NULL; if (tTd(39, 1)) { - printf("map_rewrite(%.*s), av =", slen, s); + printf("map_rewrite(%.*s), av =", (int)slen, s); if (av == NULL) printf(" (nullv)"); else @@ -315,16 +302,16 @@ map_rewrite(map, s, slen, av) } /* count expected size of output (can safely overestimate) */ - i = len = slen; + l = len = slen; if (av != NULL) { const char *sp = s; - for (i = slen; --i >= 0 && (c = *sp++) != 0; ) + while (l-- > 0 && (c = *sp++) != '\0') { if (c != '%') continue; - if (--i < 0) + if (l-- <= 0) break; c = *sp++; if (!(isascii(c) && isdigit(c))) @@ -355,7 +342,7 @@ map_rewrite(map, s, slen, av) } else { - while (--slen >= 0 && (c = *s++) != '\0') + while (slen-- > 0 && (c = *s++) != '\0') { if (c != '%') { @@ -363,7 +350,7 @@ map_rewrite(map, s, slen, av) *bp++ = c; continue; } - if (--slen < 0 || (c = *s++) == '\0') + if (slen-- <= 0 || (c = *s++) == '\0') c = '%'; if (c == '%') goto pushc; @@ -411,7 +398,7 @@ initmaps(rebuild, e) bool rebuild; register ENVELOPE *e; { - extern void map_init(); + extern void map_init __P((STAB *, int)); #if XDEBUG checkfd012("entering initmaps"); @@ -450,9 +437,9 @@ map_init(s, pass) pass); /* - ** Pass 0 opens all non-rebuildable maps. - ** Pass 1 opens all rebuildable maps for read. - ** Pass 2 rebuilds all rebuildable maps. + ** 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) && @@ -473,10 +460,10 @@ map_init(s, pass) map->map_class->map_close(map); map->map_mflags &= ~(MF_OPEN|MF_WRITABLE); } - + if (pass == 2) { - rebuildaliases(map, FALSE); + (void) rebuildaliases(map, FALSE); return; } @@ -491,6 +478,7 @@ map_init(s, pass) map->map_file == NULL ? "NULL" : map->map_file); map->map_mflags |= MF_OPEN; + map->map_pid = getpid(); } else { @@ -509,10 +497,55 @@ map_init(s, pass) map->map_class = &BogusMapClass; map->map_mflags |= MF_OPEN; + map->map_pid = getpid(); } } } /* +** 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); +} +/* ** GETCANONNAME -- look up name using service switch ** ** Parameters: @@ -760,26 +793,55 @@ ndbm_map_open(map, mode) sff = SFF_ROOTOK|SFF_REGONLY; if (mode == O_RDWR) { - sff |= SFF_NOLINK|SFF_CREAT; + sff |= SFF_CREAT; + if (!bitset(DBS_WRITEMAPTOSYMLINK, DontBlameSendmail)) + sff |= SFF_NOSLINK; + if (!bitset(DBS_WRITEMAPTOHARDLINK, DontBlameSendmail)) + sff |= SFF_NOHLINK; smode = S_IWRITE; } else { - sff |= SFF_NOWLINK; + if (!bitset(DBS_LINKEDMAPINWRITABLEDIR, DontBlameSendmail)) + sff |= SFF_NOWLINK; } - if (FatalWritableDirs) + if (!bitset(DBS_MAPINUNSAFEDIRPATH, DontBlameSendmail)) sff |= SFF_SAFEDIRPATH; - if ((ret = safefile(dirfile, RunAsUid, RunAsGid, RunAsUserName, - sff, smode, &std)) != 0 || - (ret = safefile(pagfile, RunAsUid, RunAsGid, RunAsUserName, - sff, smode, &stp)) != 0) + 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("\tunsafe map file: %d\n", ret); + printf("\t%s map file: %d\n", prob, ret); if (!bitset(MF_OPTIONAL, map->map_mflags)) - syserr("dbm map \"%s\": unsafe map file %s", - map->map_mname, map->map_file); + syserr("dbm map \"%s\": %s map file %s", + map->map_mname, prob, map->map_file); return FALSE; } if (std.st_mode == ST_MODE_NOFILE) @@ -811,11 +873,15 @@ ndbm_map_open(map, mode) int dirfd; int pagfd; + int sff = SFF_CREAT|SFF_OPENASROOT; - dirfd = safeopen(dirfile, mode, DBMMODE, - SFF_NOLINK|SFF_CREAT|SFF_OPENASROOT); - pagfd = safeopen(pagfile, mode, DBMMODE, - SFF_NOLINK|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) { @@ -901,8 +967,8 @@ ndbm_map_open(map, mode) return FALSE; } - if (filechanged(dirfile, dfd, &std, sff) || - filechanged(pagfile, pfd, &stp, sff)) + if (filechanged(dirfile, dfd, &std) || + filechanged(pagfile, pfd, &stp)) { int save_errno = errno; @@ -933,6 +999,22 @@ ndbm_map_open(map, mode) 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; @@ -975,7 +1057,7 @@ 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) + 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 @@ -983,22 +1065,24 @@ lockdbm: map->map_class->map_close(map); map->map_mflags &= ~(MF_OPEN|MF_WRITABLE); - if (map->map_class->map_open(map, omode)) + 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)) + 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); } @@ -1082,7 +1166,8 @@ ndbm_map_store(map, lhs, rhs) auto int xstat; datum old; - old.dptr = ndbm_map_lookup(map, key.dptr, NULL, &xstat); + old.dptr = ndbm_map_lookup(map, key.dptr, + (char **)NULL, &xstat); if (old.dptr != NULL && *(char *) old.dptr != '\0') { old.dsize = strlen(old.dptr); @@ -1117,14 +1202,14 @@ ndbm_map_close(map) register MAP *map; { if (tTd(38, 9)) - printf("ndbm_map_close(%s, %s, %x)\n", + 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[200]; + char buf[MAXHOSTNAMELEN]; inclnull = bitset(MF_INCLNULL, map->map_mflags); map->map_mflags &= ~MF_INCLNULL; @@ -1179,14 +1264,22 @@ ndbm_map_close(map) ** 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 */ -#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 */ +#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 @@ -1194,14 +1287,20 @@ 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); - btinfo.cachesize = DB_CACHE_SIZE; +#ifdef DB_CACHE_SIZE + btinfo.db_cachesize = DB_CACHE_SIZE; +#endif return db_map_open(map, mode, "btree", DB_BTREE, &btinfo); } @@ -1210,15 +1309,23 @@ 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); - hinfo.nelem = DB_HASH_NELEM; - hinfo.cachesize = DB_CACHE_SIZE; +#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); } @@ -1228,9 +1335,13 @@ db_map_open(map, mode, mapclassname, dbtype, openinfo) int mode; char *mapclassname; DBTYPE dbtype; +#if DB_VERSION_MAJOR < 2 const void *openinfo; +#else + DB_INFO *openinfo; +#endif { - DB *db; + DB *db = NULL; int i; int omode; int smode = S_IREAD; @@ -1252,25 +1363,54 @@ db_map_open(map, mode, mapclassname, dbtype, openinfo) sff = SFF_ROOTOK|SFF_REGONLY; if (mode == O_RDWR) { - sff |= SFF_NOLINK|SFF_CREAT; + sff |= SFF_CREAT; + if (!bitset(DBS_WRITEMAPTOSYMLINK, DontBlameSendmail)) + sff |= SFF_NOSLINK; + if (!bitset(DBS_WRITEMAPTOHARDLINK, DontBlameSendmail)) + sff |= SFF_NOHLINK; smode = S_IWRITE; } else { - sff |= SFF_NOWLINK; + if (!bitset(DBS_LINKEDMAPINWRITABLEDIR, DontBlameSendmail)) + sff |= SFF_NOWLINK; } - if (FatalWritableDirs) + if (!bitset(DBS_MAPINUNSAFEDIRPATH, DontBlameSendmail)) sff |= SFF_SAFEDIRPATH; - if ((i = safefile(buf, RunAsUid, RunAsGid, RunAsUserName, - sff, smode, &st)) != 0) + 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("\tunsafe map file: %s\n", errstring(i)); + printf("\t%s map file: %s\n", prob, errstring(i)); errno = i; if (!bitset(MF_OPTIONAL, map->map_mflags)) - syserr("%s map \"%s\": unsafe map file %s", - mapclassname, map->map_mname, map->map_file); + syserr("%s map \"%s\": %s map file %s", + mapclassname, map->map_mname, prob, buf); return FALSE; } if (st.st_mode == ST_MODE_NOFILE) @@ -1281,10 +1421,8 @@ db_map_open(map, mode, mapclassname, dbtype, openinfo) #if LOCK_ON_OPEN if (mode == O_RDWR) omode |= O_TRUNC|O_EXLOCK; -# if !OLD_NEWDB else omode |= O_SHLOCK; -# endif #else /* ** Pre-lock the file to avoid race conditions. In particular, @@ -1301,7 +1439,7 @@ db_map_open(map, mode, mapclassname, dbtype, openinfo) } /* make sure no baddies slipped in just before the open... */ - if (filechanged(buf, fd, &st, sff)) + if (filechanged(buf, fd, &st)) { int save_errno = errno; @@ -1333,7 +1471,23 @@ db_map_open(map, mode, mapclassname, dbtype, openinfo) 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 @@ -1355,15 +1509,25 @@ db_map_open(map, mode, mapclassname, dbtype, openinfo) errno = saveerrno; if (!bitset(MF_OPTIONAL, map->map_mflags)) syserr("Cannot open %s database %s", - mapclassname, map->map_file); + mapclassname, buf); return FALSE; } - if (filechanged(buf, db->fd(db), &st, sff)) +#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); @@ -1375,26 +1539,36 @@ db_map_open(map, mode, mapclassname, dbtype, openinfo) if (mode == O_RDWR) map->map_mflags |= MF_LOCKED; -#if !OLD_NEWDB - fd = db->fd(db); -# if LOCK_ON_OPEN +#if LOCK_ON_OPEN if (fd >= 0 && mode == O_RDONLY) { (void) lockfile(fd, buf, NULL, LOCK_UN); } -# endif #endif /* try to make sure that at least the database header is on disk */ if (mode == O_RDWR) -#if OLD_NEWDB - (void) db->sync(db); -#else + { (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; -#endif map->map_db2 = (ARBPTR_T) db; if (mode == O_RDONLY && bitset(MF_ALIAS, map->map_mflags) && @@ -1425,6 +1599,9 @@ db_map_lookup(map, name, av, statp) 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); @@ -1445,12 +1622,16 @@ db_map_lookup(map, name, av, statp) keybuf[key.size] = '\0'; if (!bitset(MF_NOFOLDCASE, map->map_mflags)) makelower(keybuf); -#if !OLD_NEWDB 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) + 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 @@ -1458,9 +1639,10 @@ db_map_lookup(map, name, av, statp) map->map_class->map_close(map); map->map_mflags &= ~(MF_OPEN|MF_WRITABLE); - if (map->map_class->map_open(map, omode)) + 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; @@ -1468,40 +1650,76 @@ db_map_lookup(map, name, av, statp) } else { - if (!bitset(MF_OPTIONAL, map->map_mflags)) + 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; } } -#endif - + 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 !OLD_NEWDB if (fd >= 0 && !bitset(MF_LOCKED, map->map_mflags)) (void) lockfile(fd, buf, ".db", LOCK_UN); -#endif if (st != 0) { errno = saveerrno; @@ -1532,6 +1750,9 @@ db_map_store(map, lhs, rhs) 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); @@ -1557,7 +1778,25 @@ db_map_store(map, lhs, rhs) 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)) @@ -1568,7 +1807,10 @@ db_map_store(map, lhs, rhs) static int bufsiz = 0; DBT old; - old.data = db_map_lookup(map, key.data, NULL, &stat); + bzero(&old, sizeof old); + + old.data = db_map_lookup(map, key.data, + (char **)NULL, &stat); if (old.data != NULL) { old.size = strlen(old.data); @@ -1580,7 +1822,7 @@ db_map_store(map, lhs, rhs) buf = xalloc(bufsiz); } snprintf(buf, bufsiz, "%s,%s", - data.data, old.data); + (char *) data.data, (char *) old.data); data.size = data.size + old.size + 1; data.data = buf; if (tTd(38, 9)) @@ -1588,7 +1830,11 @@ db_map_store(map, lhs, rhs) (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); @@ -1615,19 +1861,43 @@ db_map_close(map) db_map_store(map, "@", "@"); } -#if OLD_NEWDB - (void) db->sync(db); -#else (void) db->sync(db, 0); -#endif #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) - syserr("readaliases: db close failure"); +#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 @@ -1734,6 +2004,7 @@ nis_map_open(map, mode) ** NIS_MAP_LOOKUP -- look up a datum in a NIS map */ +/* ARGSUSED3 */ char * nis_map_lookup(map, name, av, statp) MAP *map; @@ -1910,7 +2181,7 @@ nisplus_map_open(map, mode) mode &= O_ACCMODE; if (mode != O_RDONLY) { - errno = ENODEV; + errno = EPERM; return FALSE; } @@ -1920,7 +2191,7 @@ nisplus_map_open(map, mode) if (PARTIAL_NAME(map->map_file) && map->map_domain == NULL) { /* set default NISPLUS Domain to $m */ - extern char *nisplus_default_domain(); + extern char *nisplus_default_domain __P((void)); map->map_domain = newstr(nisplus_default_domain()); if (tTd(38, 2)) @@ -1953,7 +2224,7 @@ nisplus_map_open(map, mode) case NIS_NAMEUNREACHABLE: if (retry_cnt++ > 4) { - errno = EBADR; + errno = EAGAIN; return FALSE; } /* try not to overwhelm hosed server */ @@ -1967,7 +2238,7 @@ nisplus_map_open(map, mode) map->map_file, map->map_domain, nis_sperrno(res->status)); #endif - errno = EBADR; + errno = EAGAIN; return FALSE; } } @@ -1983,7 +2254,7 @@ nisplus_map_open(map, mode) map->map_file, map->map_domain, nis_sperrno(res->status)); #endif - errno = EBADR; + errno = EBADF; return FALSE; } /* default key column is column 0 */ @@ -1991,7 +2262,7 @@ nisplus_map_open(map, mode) 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++) { @@ -2003,7 +2274,7 @@ nisplus_map_open(map, mode) if (tTd(38, 2)) printf("nisplus_map_open(%s): can not find key column %s\n", map->map_file, map->map_keycolnm); - errno = EBADR; + errno = ENOENT; return FALSE; } @@ -2026,7 +2297,7 @@ nisplus_map_open(map, mode) if (tTd(38, 2)) printf("nisplus_map_open(%s): can not find column %s\n", map->map_file, map->map_keycolnm); - errno = EBADR; + errno = ENOENT; return FALSE; } @@ -2057,14 +2328,17 @@ nisplus_map_lookup(map, name, av, statp) 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 @@ -2295,7 +2569,7 @@ nisplus_default_domain() if (default_domain[0] != '\0') return(default_domain); - + p = nis_local_directory(); snprintf(default_domain, sizeof default_domain, "%s", p); return default_domain; @@ -2357,12 +2631,22 @@ ldap_map_open(map, mode) ** 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); @@ -2372,21 +2656,63 @@ ldap_map_start(map) if (tTd(38,9)) printf("ldap_open(%s, %d)\n", lmap->ldaphost, lmap->ldapport); - if ((ld = ldap_open(lmap->ldaphost,lmap->ldapport)) == NULL) + /* 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("ldapopen failed to %s in map %s", + 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)) @@ -2403,28 +2729,43 @@ ldap_map_start(map) } return FALSE; +#endif } /* -** LDAP_MAP_CLOSE -- close ldap map +** LDAP_MAP_STOP -- close the ldap connection */ void -ldap_map_close(map) +ldap_map_stop(map) MAP *map; { - LDAP_MAP_STRUCT *lmap ; + 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. +** SUNET_ID_HASH -- Convert a string to it's Sunet_id canonical form +** This only makes sense at Stanford University. */ char * @@ -2458,7 +2799,7 @@ sunet_id_hash(str) #endif /* SUNET_ID */ /* -** LDAP_MAP_LOOKUP -- look up a datum in a LDAP map +** LDAP_MAP_LOOKUP -- look up a datum in a LDAP map */ char * @@ -2477,6 +2818,7 @@ ldap_map_lookup(map, name, av, statp) 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); @@ -2505,15 +2847,35 @@ ldap_map_lookup(map, name, av, statp) makelower(keybuf); #endif /*SUNET_ID */ - /* sprintf keybuf into filter */ - snprintf(filter, sizeof filter, lmap->filter, keybuf); + /* 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 close/opening map */ - ldap_map_close(map); + /* try stopping/starting map */ + ldap_map_stop(map); if (!ldap_map_start(map)) { result = NULL; @@ -2527,7 +2889,8 @@ ldap_map_lookup(map, name, av, statp) { if (!bitset(MF_OPTIONAL, map->map_mflags)) { - syserr("Error in ldap_search_st using %s in map %s", + syserr("%sError in ldap_search_st using %s in map %s", + bitset(MF_NODEFER, map->map_mflags) ? "" : "421 ", filter, map->map_mname); } result = NULL; @@ -2574,13 +2937,13 @@ ldap_map_lookup(map, name, av, statp) ldap_value_free(attr_values); if (lmap != NULL) ldap_msgfree(lmap->res); - ldap_map_close(map); + ldap_map_stop(map); return result ; } /* -** LDAP_MAP_DEQUOTE - helper routine for ldap_map_parseargs +** LDAP_MAP_DEQUOTE - helper routine for ldap_map_parseargs */ char * @@ -2610,7 +2973,7 @@ ldap_map_dequote(str) } /* -** LDAP_MAP_PARSEARGS -- parse ldap map definition args. +** LDAP_MAP_PARSEARGS -- parse ldap map definition args. */ bool @@ -2642,6 +3005,11 @@ ldap_map_parseargs(map,args) 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 (;;) { @@ -2688,6 +3056,10 @@ ldap_map_parseargs(map,args) 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)) @@ -2716,7 +3088,7 @@ ldap_map_parseargs(map,args) break; case 's': /* search scope */ - if (strncasecmp(p, "base", 4) == 0) + if (strncasecmp(++p, "base", 4) == 0) { lmap->scope = LDAP_SCOPE_BASE; } @@ -2732,8 +3104,14 @@ ldap_map_parseargs(map,args) { /* 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; } } @@ -2762,6 +3140,7 @@ ldap_map_parseargs(map,args) while (isascii(*++p) && isspace(*p)) continue; lmap->timelimit = atoi(p); + lmap->timeout.tv_sec = lmap->timelimit; break; } @@ -2792,13 +3171,14 @@ ldap_map_parseargs(map,args) 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 + ** We need to swallow up all the stuff into a struct + ** and dump it into map->map_dbptr1 */ if (lmap->ldaphost != NULL) @@ -2856,15 +3236,15 @@ ldap_map_parseargs(map,args) #endif /* LDAP Modules */ /* -** syslog map +** syslog map */ -#if _FFR_SYSLOG_MAP +#if _FFR_MAP_SYSLOG #define map_prio map_lockfd /* overload field */ /* -** SYSLOG_MAP_PARSEARGS -- check for priority level to syslog messages. +** SYSLOG_MAP_PARSEARGS -- check for priority level to syslog messages. */ bool @@ -2895,7 +3275,7 @@ syslog_map_parseargs(map, args) { if (strncasecmp("LOG_", priority, 4) == 0) priority += 4; - + #ifdef LOG_EMERG if (strcasecmp("EMERG", priority) == 0) map->map_prio = LOG_EMERG; @@ -2946,7 +3326,7 @@ syslog_map_parseargs(map, args) } /* -** SYSLOG_MAP_LOOKUP -- rewrite and syslog message. Always return empty string +** SYSLOG_MAP_LOOKUP -- rewrite and syslog message. Always return empty string */ char * @@ -2966,20 +3346,18 @@ syslog_map_lookup(map, string, args, statp) sm_syslog(map->map_prio, CurEnv->e_id, "%s", ptr); } - + *statp = EX_OK; return ""; } -#endif /* _FFR_SYSLOG_MAP */ +#endif /* _FFR_MAP_SYSLOG */ /* ** HESIOD Modules */ #ifdef HESIOD -#include <hesiod.h> - bool hes_map_open(map, mode) MAP *map; @@ -3004,6 +3382,15 @@ hes_map_open(map, mode) 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()) @@ -3017,6 +3404,7 @@ hes_map_open(map, mode) syserr("421 cannot initialize Hesiod map (%d)", hes_error()); return FALSE; +#endif /* HESIOD_INIT */ } char * @@ -3044,14 +3432,45 @@ hes_map_lookup(map, name, av, statp) 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()) @@ -3074,7 +3493,8 @@ hes_map_lookup(map, name, av, statp) } return NULL; } - +#endif /* HESIOD_INIT */ + if (bitset(MF_MATCHONLY, map->map_mflags)) return map_rewrite(map, name, strlen(name), NULL); else @@ -3103,8 +3523,6 @@ ni_map_open(map, mode) MAP *map; int mode; { - char *p; - if (tTd(38, 2)) printf("ni_map_open(%s, %s, %d)\n", map->map_mname, map->map_file, mode); @@ -3162,6 +3580,7 @@ ni_getcanonname(name, hbsize, statp) int *statp; { char *vptr; + char *ptr; char nbuf[MAXNAME + 1]; if (tTd(38, 20)) @@ -3183,7 +3602,7 @@ ni_getcanonname(name, hbsize, statp) } /* Do the search */ - vptr = ni_propval("/machines", NULL, nbuf, "name", '\0'); + vptr = ni_propval("/machines", NULL, nbuf, "name", '\n'); if (vptr == NULL) { @@ -3191,6 +3610,10 @@ ni_getcanonname(name, hbsize, statp) return FALSE; } + /* Only want the first machine name */ + if ((ptr = strchr(vptr, '\n')) != NULL) + *ptr = '\0'; + if (hbsize >= strlen(vptr)) { strcpy(name, vptr); @@ -3382,7 +3805,7 @@ ni_propval(keydir, keyprop, keyval, valprop, sepchar) return propval; } -#endif +#endif /* NETINFO */ /* ** TEXT (unindexed text file) Modules ** @@ -3411,7 +3834,7 @@ text_map_open(map, mode) mode &= O_ACCMODE; if (mode != O_RDONLY) { - errno = ENODEV; + errno = EPERM; return FALSE; } @@ -3429,8 +3852,10 @@ text_map_open(map, mode) return FALSE; } - sff = SFF_ROOTOK|SFF_REGONLY|SFF_NOWLINK; - if (FatalWritableDirs) + 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) @@ -3448,7 +3873,7 @@ text_map_open(map, mode) map->map_keycolno = 0; else { - if (!isdigit(*map->map_keycolnm)) + 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, @@ -3462,7 +3887,7 @@ text_map_open(map, mode) map->map_valcolno = 0; else { - if (!isdigit(*map->map_valcolnm)) + 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, @@ -3556,6 +3981,11 @@ text_map_lookup(map, name, av, statp) 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)) @@ -3633,6 +4063,7 @@ text_getcanonname(name, hbsize, statp) ** STAB_MAP_LOOKUP -- look up alias in symbol table */ +/* ARGSUSED2 */ char * stab_map_lookup(map, name, av, pstat) register MAP *map; @@ -3695,12 +4126,14 @@ stab_map_open(map, mode) mode &= O_ACCMODE; if (mode != O_RDONLY) { - errno = ENODEV; + errno = EPERM; return FALSE; } - sff = SFF_ROOTOK|SFF_REGONLY|SFF_NOWLINK; - if (FatalWritableDirs) + 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) @@ -3808,13 +4241,18 @@ impl_map_open(map, mode) #if defined(NEWDB) || defined(NDBM) if (Verbose) - message("WARNING: cannot open alias database %s", map->map_file); + 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 - return stab_map_open(map, mode); + if (mode == O_RDONLY) + return stab_map_open(map, mode); + else + return FALSE; } @@ -3911,6 +4349,7 @@ user_map_open(map, mode) ** USER_MAP_LOOKUP -- look up a user in the passwd file. */ +/* ARGSUSED3 */ char * user_map_lookup(map, key, av, statp) MAP *map; @@ -4340,6 +4779,7 @@ seq_map_store(map, key, val) ** NULL stubs */ +/* ARGSUSED */ bool null_map_open(map, mode) MAP *map; @@ -4348,6 +4788,7 @@ null_map_open(map, mode) return TRUE; } +/* ARGSUSED */ void null_map_close(map) MAP *map; @@ -4366,6 +4807,7 @@ null_map_lookup(map, key, args, pstat) return NULL; } +/* ARGSUSED */ void null_map_store(map, key, val) MAP *map; @@ -4397,3 +4839,371 @@ MAPCLASS BogusMapClass = NULL, bogus_map_lookup, null_map_store, null_map_open, null_map_close, }; +/* +** 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 */ @@ -1,42 +1,21 @@ /* - * Copyright (c) 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)mci.c 8.66 (Berkeley) 8/2/97"; +static char sccsid[] = "@(#)mci.c 8.83 (Berkeley) 10/13/1998"; #endif /* not lint */ #include "sendmail.h" +#include <arpa/inet.h> #include <dirent.h> /* @@ -73,7 +52,7 @@ static char sccsid[] = "@(#)mci.c 8.66 (Berkeley) 8/2/97"; MCI **MciCache; /* the open connection cache */ extern int mci_generate_persistent_path __P((const char *, char *, int, bool)); -extern void mci_load_persistent __P((MCI *)); +extern bool mci_load_persistent __P((MCI *)); extern void mci_uncache __P((MCI **, bool)); /* ** MCI_CACHE -- enter a connection structure into the open connection cache @@ -105,6 +84,9 @@ mci_cache(mci) return; } + if (mci->mci_host == NULL) + return; + /* if this is already cached, we are done */ if (bitset(MCIF_CACHED, mci->mci_flags)) return; @@ -115,7 +97,7 @@ mci_cache(mci) if (tTd(42, 5)) printf("mci_cache: caching %lx (%s) in slot %d\n", - (u_long) mci, mci->mci_host, mcislot - MciCache); + (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", @@ -208,12 +190,15 @@ mci_uncache(mcislot, doquit) 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, mcislot - MciCache, doquit); + (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)", @@ -301,7 +286,15 @@ mci_get(host, m) mci = &s->s_mci; mci->mci_host = s->s_name; - mci_load_persistent(mci); + 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)) { @@ -510,7 +503,7 @@ mci_dump_all(logit) mci_dump(MciCache[i], logit); } /* -** MCI_LOCK_HOST -- Lock host while sending. +** 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 @@ -572,7 +565,7 @@ mci_lock_host_statfile(mci) } mci->mci_statfile = safefopen(fname, O_RDWR, FileMode, - SFF_NOLOCK|SFF_NOLINK|SFF_OPENASROOT|SFF_REGONLY|SFF_CREAT); + SFF_NOLOCK|SFF_NOLINK|SFF_OPENASROOT|SFF_REGONLY|SFF_SAFEDIRPATH|SFF_CREAT); if (mci->mci_statfile == NULL) { @@ -650,7 +643,7 @@ mci_unlock_host(mci) errno = saveErrno; } /* -** MCI_LOAD_PERSISTENT -- load persistent host info +** MCI_LOAD_PERSISTENT -- load persistent host info ** ** Load information about host that is kept ** in common for all running sendmails. @@ -660,14 +653,16 @@ mci_unlock_host(mci) ** for. ** ** Returns: -** none. +** TRUE -- lock was successful +** FALSE -- lock failed */ -void +bool mci_load_persistent(mci) MCI *mci; { int saveErrno = errno; + bool locked = TRUE; FILE *fp; char fname[MAXPATHLEN+1]; @@ -675,12 +670,16 @@ mci_load_persistent(mci) { if (tTd(56, 1)) printf("mci_load_persistent: NULL mci\n"); - return; + return TRUE; } if (IgnoreHostStatus || HostStatDir == NULL || mci->mci_host == NULL) - return; + 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); @@ -694,7 +693,7 @@ mci_load_persistent(mci) } fp = safefopen(fname, O_RDONLY, FileMode, - SFF_NOLINK|SFF_OPENASROOT|SFF_REGONLY); + SFF_NOLOCK|SFF_NOLINK|SFF_OPENASROOT|SFF_REGONLY|SFF_SAFEDIRPATH); if (fp == NULL) { /* I can't think of any reason this should ever happen */ @@ -705,13 +704,16 @@ mci_load_persistent(mci) } 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; + return locked; } /* ** MCI_READ_PERSISTENT -- read persistent host status file @@ -803,7 +805,10 @@ mci_read_persistent(fp, mci) return 0; default: - syserr("Unknown host status line \"%s\"", buf); + 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; } @@ -868,7 +873,7 @@ mci_store_persistent(mci) 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", mci->mci_lastuse); + fprintf(mci->mci_statfile, "U%ld\n", (long)(mci->mci_lastuse)); fprintf(mci->mci_statfile, ".\n"); fflush(mci->mci_statfile); @@ -1011,8 +1016,8 @@ mci_traverse_persistent(action, pathname) *hostptr = '\0'; /* - ** Do something with the file containing the persistent - ** information. + ** Do something with the file containing the persistent + ** information. */ ret = (*action)(pathname, host); } @@ -1054,7 +1059,7 @@ mci_print_persistent(pathname, hostname) } fp = safefopen(pathname, O_RDWR, FileMode, - SFF_NOLOCK|SFF_NOLINK|SFF_OPENASROOT|SFF_REGONLY); + SFF_NOLOCK|SFF_NOLINK|SFF_OPENASROOT|SFF_REGONLY|SFF_SAFEDIRPATH); if (fp == NULL) { @@ -1091,7 +1096,7 @@ mci_print_persistent(pathname, hostname) extern int N_SysEx; extern char *SysExMsg[]; - if (i < 0 || i > N_SysEx) + if (i < 0 || i >= N_SysEx) { char buf[80]; @@ -1162,7 +1167,7 @@ mci_purge_persistent(pathname, hostname) return 0; } /* -** MCI_GENERATE_PERSISTENT_PATH -- generate path from hostname +** 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 @@ -1210,7 +1215,7 @@ mci_generate_persistent_path(host, path, pathlen, createflag) if (tTd(56, 80)) printf("mci_generate_persistent_path(%s): ", host); - if (*host == '\0') + if (*host == '\0' || *host == '.') return -1; /* make certain this is not a bracketed host number */ @@ -1231,17 +1236,21 @@ mci_generate_persistent_path(host, path, pathlen, createflag) (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 *) host; *p != '\0'; p++) + for (p = (char *) t_host; *p != '\0'; p++) { - if (*p == '|' || *p == '.') + if (*p == '.') len++; len++; if (p[0] == '.' && p[1] == '.') return -1; } - if (len > pathlen) + if (len > pathlen || len < 1) return -1; strcpy(path, HostStatDir); @@ -1261,12 +1270,10 @@ mci_generate_persistent_path(host, path, pathlen, createflag) x = elem + 1; while ((ch = *x++) != '\0' && ch != '.') { - if (isupper(ch)) + if (isascii(ch) && isupper(ch)) ch = tolower(ch); - if (ch == '|') - *p++ = '|'; /* | -> || */ - else if (ch == '/') - ch = '|'; /* / -> | */ + if (ch == '/') + ch = ':'; /* / -> : */ *p++ = ch; } if (elem >= t_host) @@ -1,42 +1,20 @@ /* - * Copyright (c) 1994, 1996-1997 Eric P. Allman + * 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. * - * 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. + * 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 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 "sendmail.h" # include <string.h> #ifndef lint -static char sccsid[] = "@(#)mime.c 8.59 (Berkeley) 5/6/97"; +static char sccsid[] = "@(#)mime.c 8.71 (Berkeley) 1/18/1999"; #endif /* not lint */ /* @@ -247,7 +225,8 @@ mime8to7(mci, header, e, boundaries, flags) ** Do a recursive descent into the message. */ - if (strcasecmp(type, "multipart") == 0 && !bitset(M87F_NO8BIT, flags)) + if (strcasecmp(type, "multipart") == 0 && + (!bitset(M87F_NO8BIT, flags) || bitset(M87F_NO8TO7, flags))) { int blen; @@ -306,6 +285,7 @@ mime8to7(mci, header, e, boundaries, flags) /* 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); @@ -328,7 +308,7 @@ mime8to7(mci, header, e, boundaries, flags) collect(e->e_dfp, FALSE, &hdr, e); if (tTd(43, 101)) putline("+++after collect", mci); - putheader(mci, hdr, e); + putheader(mci, hdr, e, flags); if (tTd(43, 101)) putline("+++after putheader", mci); bt = mime8to7(mci, hdr, e, boundaries, flags); @@ -380,7 +360,7 @@ mime8to7(mci, header, e, boundaries, flags) collect(e->e_dfp, FALSE, &hdr, e); if (tTd(43, 101)) putline("+++after collect", mci); - putheader(mci, hdr, e); + putheader(mci, hdr, e, flags); if (tTd(43, 101)) putline("+++after putheader", mci); if (hvalue("MIME-Version", hdr) == NULL) @@ -400,7 +380,7 @@ mime8to7(mci, header, e, boundaries, flags) */ sectionsize = sectionhighbits = 0; - if (!bitset(M87F_NO8BIT, flags)) + if (!bitset(M87F_NO8BIT|M87F_NO8TO7, flags)) { /* remember where we were */ offset = ftell(e->e_dfp); @@ -462,8 +442,18 @@ mime8to7(mci, header, e, boundaries, flags) if (sectionhighbits == 0) { /* no encoding necessary */ - if (cte != NULL) + 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); @@ -683,15 +673,22 @@ mime_getchar(fp, boundaries, btp) 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 > 0) + 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; - c = getc(fp); if (c == '\n') { /* might be part of a MIME boundary */ @@ -703,6 +700,7 @@ mime_getchar(fp, boundaries, btp) ungetc(c, fp); return c; } + start = 1; } if (c != EOF) *bp++ = c; @@ -731,7 +729,7 @@ mime_getchar(fp, boundaries, btp) *bp++ = c; } *bp = '\0'; - bt = mimeboundary((char *) &buf[1], boundaries); + bt = mimeboundary((char *) &buf[start], boundaries); switch (bt) { case MBT_FINAL: @@ -992,6 +990,7 @@ mime7to8(mci, header, e) 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", @@ -1146,20 +1145,24 @@ mime_fromqp(infile, outfile, state, maxlen) if ((c1 = *infile++) == 0) break; - if (c1 == '\n') /* ignore it */ + if (c1 == '\n' || (c1 = HEXCHAR(c1)) == -1) { + /* ignore it */ if (state == 0) return 0; } else { - if ((c2 = *infile++) == '\0') - break; - - c1 = HEXCHAR(c1); - c2 = HEXCHAR(c2); - - if (++nchar > maxlen) + do + { + if ((c2 = *infile++) == '\0') + { + c2 = -1; + break; + } + } while ((c2 = HEXCHAR(c2)) == -1); + + if (c2 == -1 || ++nchar > maxlen) break; *(*outfile)++ = c1 << 4 | c2; diff --git a/src/newaliases.0 b/src/newaliases.0 index 648bab7..25b0285 100644 --- a/src/newaliases.0 +++ b/src/newaliases.0 @@ -24,4 +24,4 @@ SSEEEE AALLSSOO HHIISSTTOORRYY The nneewwaalliiaasseess command appeared in 4.0BSD. -4th Berkeley Distribution February 22, 1994 1 +4th Berkeley Distribution May 19, 1998 1 diff --git a/src/newaliases.1 b/src/newaliases.1 index 7168c13..b9673cd 100644 --- a/src/newaliases.1 +++ b/src/newaliases.1 @@ -1,38 +1,16 @@ -.\" Copyright (c) 1983, 1997 Eric P. Allman +.\" 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. .\" -.\" 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. +.\" 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 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. .\" -.\" @(#)newaliases.1 8.5 (Berkeley) 2/1/97 +.\" @(#)newaliases.1 8.10 (Berkeley) 5/19/1998 .\" -.Dd February 1, 1997 +.Dd May 19, 1998 .Dt NEWALIASES 1 .Os BSD 4 .Sh NAME diff --git a/src/parseaddr.c b/src/parseaddr.c index 7831834..86762fd 100644 --- a/src/parseaddr.c +++ b/src/parseaddr.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)parseaddr.c 8.132 (Berkeley) 10/20/97"; +static char sccsid[] = "@(#)parseaddr.c 8.156 (Berkeley) 10/27/1998"; #endif /* not lint */ # include "sendmail.h" @@ -89,8 +67,7 @@ parseaddr(addr, a, flags, delim, delimptr, e) auto char *delimptrbuf; bool queueup; char pvpbuf[PSBUFSIZE]; - extern ADDRESS *buildaddr(); - extern bool invalidaddr(); + extern bool invalidaddr __P((char *, char *)); extern void allocaddr __P((ADDRESS *, int, char *)); /* @@ -668,12 +645,12 @@ prescan(addr, delim, pvpbuf, pvpbsize, delimptr, toktab) } if (avp >= &av[MAXATOM]) { - syserr("553 prescan: too many tokens"); + usrerr("553 prescan: too many tokens"); goto returnnull; } if (q - tok > MAXNAME) { - syserr("553 prescan: token too long"); + usrerr("553 prescan: token too long"); goto returnnull; } *avp++ = tok; @@ -761,6 +738,7 @@ rewrite(pvp, ruleset, reclevel, e) 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 *)); @@ -845,8 +823,6 @@ rewrite(pvp, ruleset, reclevel, e) switch (*rp & 0377) { - char buf[MAXLINE]; - case MATCHCLASS: /* match any phrase in a class */ mlp->pattern = rvp; @@ -1071,7 +1047,7 @@ rewrite(pvp, ruleset, reclevel, e) } else { - /* vanilla replacement */ + /* some sort of replacement */ if (avp >= &npvp[MAXATOM]) { toolong: @@ -1079,16 +1055,64 @@ rewrite(pvp, ruleset, reclevel, e) return EX_DATAERR; } if ((*rp & 0377) != MACRODEXPAND) + { + /* vanilla replacement */ *avp++ = rp; + } else { - *avp = macvalue(rp[1], e); + /* $&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]), - *avp == NULL ? "(NULL)" : *avp); - if (*avp != NULL) - avp++; + 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); } } } @@ -1239,11 +1263,10 @@ rewrite(pvp, ruleset, reclevel, e) } /* restore the old trailing information */ + rvp = avp - 1; for (xpvp = pvpb1; (*avp++ = *xpvp++) != NULL; ) if (avp >= &npvp[MAXATOM]) goto toolong; - - break; } /* @@ -1308,6 +1331,7 @@ callsubr(pvp, reclevel, e) { if ((**avp & 0377) == CALLSUBR && avp[1] != NULL) { + stripquotes(avp[1]); subr = strtorwset(avp[1], NULL, ST_FIND); if (subr < 0) { @@ -1425,8 +1449,17 @@ map_lookup(map, key, argvect, pstat, e) /* XXX should try to auto-open the map here */ if (tTd(60, 1)) - printf("map_lookup(%s, %s) => ", - map->s_name, key); + { + 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)) @@ -1448,10 +1481,29 @@ map_lookup(map, key, argvect, pstat, e) snprintf(mbuf, sizeof mbuf, "%.80s map: lookup (%s): deferred", map->s_name, - shortenstring(key, 203)); + 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; } /* @@ -1505,9 +1557,11 @@ buildaddr(tv, a, flags, e) 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 + 1]; + static char ubuf[MAXNAME + 2]; if (tTd(24, 5)) { @@ -1522,6 +1576,14 @@ buildaddr(tv, a, flags, e) /* 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) { @@ -1990,7 +2052,7 @@ remotename(name, m, flags, pstat, e) static char buf[MAXNAME + 1]; char lbuf[MAXNAME + 1]; char pvpbuf[PSBUFSIZE]; - extern char *crackaddr(); + extern char *crackaddr __P((char *)); if (tTd(12, 1)) printf("remotename(%s)\n", name); @@ -2251,6 +2313,7 @@ dequote_init(map, args) ** else -- The dequoted buffer. */ +/* ARGSUSED2 */ char * dequote_map(map, name, av, statp) MAP *map; @@ -2356,9 +2419,10 @@ rscheck(rwset, p1, p2, e) char *buf; int bufsize; int saveexitstat; - int rstat; + int rstat = EX_OK; char **pvp; int rsno; + bool discard = FALSE; auto ADDRESS a1; bool saveQuickAbort = QuickAbort; bool saveSuprErrs = SuprErrs; @@ -2404,25 +2468,49 @@ rscheck(rwset, p1, p2, e) SuprErrs = saveSuprErrs; if (pvp == NULL) { + if (tTd(48, 2)) + printf("rscheck: cannot prescan input\n"); +/* syserr("rscheck: cannot prescan input: \"%s\"", - shortenstring(buf, 203)); + 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) + pvp[1] == NULL || (strcmp(pvp[1], "error") != 0 && + strcmp(pvp[1], "discard") != 0)) { - rstat = EX_OK; goto finis; } - /* got an error -- process it */ - saveexitstat = ExitStat; - (void) buildaddr(pvp, &a1, 0, e); - rstat = ExitStat; - ExitStat = saveexitstat; - + 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; @@ -2444,9 +2532,14 @@ rscheck(rwset, p1, p2, e) p += strlen(p); } *p = '\0'; - sm_syslog(LOG_NOTICE, e->e_id, - "ruleset=%s, arg1=%s%s, reject=%s", - rwset, p1, lbuf, MsgBuf); + 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: diff --git a/src/pathnames.h b/src/pathnames.h index a364fba..7a06b12 100644 --- a/src/pathnames.h +++ b/src/pathnames.h @@ -1,36 +1,14 @@ /*- + * Copyright (c) 1998 Sendmail, Inc. All rights reserved. * Copyright (c) 1990, 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. + * 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 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. * - * @(#)pathnames.h 8.4 (Berkeley) 6/19/95 + * @(#)pathnames.h 8.8 (Berkeley) 5/19/1998 */ #ifndef _PATH_SENDMAILCF diff --git a/src/queue.c b/src/queue.c index d48efb1..b02fc08 100644 --- a/src/queue.c +++ b/src/queue.c @@ -1,44 +1,22 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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 "sendmail.h" #ifndef lint #if QUEUE -static char sccsid[] = "@(#)queue.c 8.175 (Berkeley) 10/4/97 (with queueing)"; +static char sccsid[] = "@(#)queue.c 8.211 (Berkeley) 1/25/1999 (with queueing)"; #else -static char sccsid[] = "@(#)queue.c 8.175 (Berkeley) 10/4/97 (without queueing)"; +static char sccsid[] = "@(#)queue.c 8.211 (Berkeley) 1/25/1999 (without queueing)"; #endif #endif /* not lint */ @@ -163,7 +141,7 @@ queueup(e, announce) newid ? " (new id)" : ""); if (tTd(40, 3)) { - extern void printenvflags(); + extern void printenvflags __P((ENVELOPE *)); printf(" e_flags="); printenvflags(e); @@ -225,10 +203,10 @@ queueup(e, announce) fprintf(tfp, "V%d\n", QF_VERSION); /* output creation time */ - fprintf(tfp, "T%ld\n", e->e_ctime); + fprintf(tfp, "T%ld\n", (long) e->e_ctime); /* output last delivery time */ - fprintf(tfp, "K%ld\n", e->e_dtime); + fprintf(tfp, "K%ld\n", (long) e->e_dtime); /* output number of delivery attempts */ fprintf(tfp, "N%d\n", e->e_ntries); @@ -239,8 +217,16 @@ queueup(e, announce) /* output inode number of data file */ /* XXX should probably include device major/minor too */ if (e->e_dfino != -1) - fprintf(tfp, "I%d/%d/%ld\n", - major(e->e_dfdev), minor(e->e_dfdev), e->e_dfino); + { + 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) @@ -360,10 +346,9 @@ queueup(e, announce) define('g', "\201f", e); for (h = e->e_header; h != NULL; h = h->h_link) { - extern bool bitzerop(); + extern bool bitzerop __P((BITMAP)); - /* don't output null headers */ - if (h->h_value == NULL || h->h_value[0] == '\0') + if (h->h_value == NULL) continue; /* don't output resent headers on non-resent messages */ @@ -477,7 +462,7 @@ printctladdr(a, tfp) register ADDRESS *q; uid_t uid; gid_t gid; - static ADDRESS *lastctladdr; + static ADDRESS *lastctladdr = NULL; static uid_t lastuid; /* initialization */ @@ -599,12 +584,10 @@ runqueue(forkflag, verbose) { pid_t pid; extern SIGFUNC_DECL intsig __P((int)); -#ifdef SIGCHLD extern SIGFUNC_DECL reapchild __P((int)); blocksignal(SIGCHLD); (void) setsignal(SIGCHLD, reapchild); -#endif pid = dofork(); if (pid == -1) @@ -626,31 +609,26 @@ runqueue(forkflag, verbose) if (pid != 0) { /* parent -- pick up intermediate zombie */ -#ifndef SIGCHLD - (void) waitfor(pid); -#else (void) blocksignal(SIGALRM); - proc_list_add(pid); + proc_list_add(pid, "Queue runner"); (void) releasesignal(SIGALRM); releasesignal(SIGCHLD); -#endif /* SIGCHLD */ if (QueueIntvl != 0) (void) setevent(QueueIntvl, runqueueevent, 0); return TRUE; } /* child -- double fork and clean up signals */ + clrcontrol(); proc_list_clear(); -#ifndef SIGCHLD - if (fork() != 0) - exit(EX_OK); -#else /* SIGCHLD */ + + /* Add parent process as first child item */ + proc_list_add(getpid(), "Queue runner child process"); releasesignal(SIGCHLD); (void) setsignal(SIGCHLD, SIG_DFL); -#endif /* SIGCHLD */ (void) setsignal(SIGHUP, intsig); } - setproctitle("running queue: %s", QueueDir); + sm_setproctitle(TRUE, "running queue: %s", QueueDir); if (LogLevel > 69) sm_syslog(LOG_DEBUG, NOQID, @@ -775,7 +753,6 @@ runqueue(forkflag, verbose) else { pid_t pid; - extern pid_t dowork(); if (Verbose) { @@ -796,7 +773,7 @@ runqueue(forkflag, verbose) /* exit without the usual cleanup */ e->e_id = NULL; - finis(); + finis(TRUE, ExitStat); /*NOTREACHED*/ return TRUE; } @@ -842,20 +819,40 @@ orderq(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"); - if (QueueLimitId != NULL) - printf("\tQueueLimitId = %s\n", QueueLimitId); - if (QueueLimitSender != NULL) - printf("\tQueueLimitSender = %s\n", QueueLimitSender); - if (QueueLimitRecipient != NULL) - printf("\tQueueLimitRecipient = %s\n", QueueLimitRecipient); + + 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 */ @@ -886,9 +883,9 @@ orderq(doall) while ((d = readdir(f)) != NULL) { FILE *cf; - register char *p; + int qfver = 0; char lbuf[MAXNAME + 1]; - extern bool strcontainedin(); + extern bool strcontainedin __P((char *, char *)); if (tTd(41, 50)) printf("orderq: checking %s\n", d->d_name); @@ -898,10 +895,26 @@ orderq(doall) 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; + } - if (QueueLimitId != NULL && - !strcontainedin(QueueLimitId, d->d_name)) + 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 @@ -984,10 +997,9 @@ orderq(doall) i |= NEED_R; while (i != 0 && fgets(lbuf, sizeof lbuf, cf) != NULL) { - int qfver = 0; - char *p; int c; - extern bool strcontainedin(); + time_t age; + extern bool strcontainedin __P((char *, char *)); p = strchr(lbuf, '\n'); if (p != NULL) @@ -1032,18 +1044,37 @@ orderq(doall) } else p = &lbuf[1]; - if (strcontainedin(QueueLimitRecipient, p)) + 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': - if (QueueLimitSender != NULL && - strcontainedin(QueueLimitSender, &lbuf[1])) - i &= ~NEED_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': - if ((curtime() - (time_t) atol(&lbuf[1])) < MinQueueAge) + age = curtime() - (time_t) atol(&lbuf[1]); + if (age >= 0 && MinQueueAge > 0 && + age < MinQueueAge) w->w_tooyoung = TRUE; break; @@ -1076,8 +1107,8 @@ orderq(doall) if (QueueSortOrder == QS_BYHOST) { - extern workcmpf1(); - extern workcmpf2(); + extern int workcmpf1(); + extern int workcmpf2(); /* ** Sort the work directory for the first time, @@ -1102,12 +1133,14 @@ orderq(doall) 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 && - strcmp(WorkList[i].w_host, w->w_host) == 0) + sm_strcasecmp(WorkList[i].w_host, w->w_host) == 0) WorkList[i].w_lock = TRUE; else break; @@ -1123,7 +1156,7 @@ orderq(doall) } else if (QueueSortOrder == QS_BYTIME) { - extern workcmpf3(); + extern int workcmpf3(); /* ** Simple sort based on submission time only. @@ -1133,7 +1166,7 @@ orderq(doall) } else { - extern workcmpf0(); + extern int workcmpf0(); /* ** Simple sort based on queue priority only. @@ -1163,6 +1196,7 @@ orderq(doall) if (WorkList != NULL) free(WorkList); WorkList = NULL; + WorkListSize = 0; if (tTd(40, 1)) { @@ -1279,6 +1313,7 @@ workcmpf1(a, b) register WORK *b; { int i; + extern int sm_strcasecmp __P((char *, char *)); /* host name */ if (a->w_host != NULL && b->w_host == NULL) @@ -1286,7 +1321,7 @@ workcmpf1(a, b) else if (a->w_host == NULL && b->w_host != NULL) return -1; if (a->w_host != NULL && b->w_host != NULL && - (i = strcmp(a->w_host, b->w_host))) + (i = sm_strcasecmp(a->w_host, b->w_host)) != 0) return i; /* lock status */ @@ -1320,6 +1355,7 @@ workcmpf2(a, b) register WORK *b; { int i; + extern int sm_strcasecmp __P((char *, char *)); /* lock status */ if (a->w_lock != b->w_lock) @@ -1331,7 +1367,7 @@ workcmpf2(a, b) else if (a->w_host == NULL && b->w_host != NULL) return -1; if (a->w_host != NULL && b->w_host != NULL && - (i = strcmp(a->w_host, b->w_host))) + (i = sm_strcasecmp(a->w_host, b->w_host)) != 0) return i; /* job priority */ @@ -1392,7 +1428,7 @@ dowork(id, forkflag, requeueflag, e) register ENVELOPE *e; { register pid_t pid; - extern bool readqf(); + extern bool readqf __P((ENVELOPE *)); if (tTd(40, 1)) printf("dowork(%s)\n", id); @@ -1418,6 +1454,16 @@ dowork(id, forkflag, requeueflag, e) { /* 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 @@ -1449,7 +1495,7 @@ dowork(id, forkflag, requeueflag, e) disconnect(1, e); OpMode = MD_DELIVER; } - setproctitle("%s: from queue", id); + sm_setproctitle(TRUE, "%s: from queue", id); if (LogLevel > 76) sm_syslog(LOG_DEBUG, e->e_id, "dowork, pid=%d", @@ -1461,11 +1507,11 @@ dowork(id, forkflag, requeueflag, e) /* read the queue control file -- return if locked */ if (!readqf(e)) { - if (tTd(40, 4)) + if (tTd(40, 4) && e->e_id != NULL) printf("readqf(%s) failed\n", e->e_id); e->e_id = NULL; if (forkflag) - exit(EX_OK); + finis(FALSE, EX_OK); else return 0; } @@ -1481,7 +1527,7 @@ dowork(id, forkflag, requeueflag, e) /* finish up and exit */ if (forkflag) - finis(); + finis(TRUE, ExitStat); else dropenvelope(e, TRUE); } @@ -1748,10 +1794,10 @@ readqf(e) /* 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); - extern void unlockqueue(); if (Verbose || tTd(40, 8)) printf("%s: too young (%s)\n", @@ -1825,7 +1871,7 @@ readqf(e) default: syserr("readqf: %s: line %d: bad line \"%s\"", - qf, LineNumber, shortenstring(bp, 203)); + qf, LineNumber, shortenstring(bp, MAXSHORTSTR)); fclose(qfp); loseqfile(e, "unrecognized line"); return FALSE; @@ -2100,6 +2146,13 @@ printqueue() ** 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; @@ -2133,6 +2186,7 @@ queuename(e, type) while (c1 < '~' || c2 < 'Z') { int i; + int attempts = 0; if (c2 >= 'Z') { @@ -2151,12 +2205,34 @@ queuename(e, type) continue; syserr("queuename: Cannot create \"%s\" in \"%s\" (euid=%d)", qf, QueueDir, geteuid()); - exit(EX_UNAVAILABLE); + finis(FALSE, EX_UNAVAILABLE); } - if (lockfile(i, qf, NULL, LOCK_EX|LOCK_NB)) + do { - e->e_lockfp = fdopen(i, "w"); + 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 */ @@ -2166,7 +2242,7 @@ queuename(e, type) { syserr("queuename: Cannot create \"%s\" in \"%s\" (euid=%d)", qf, QueueDir, geteuid()); - exit(EX_OSERR); + finis(FALSE, EX_OSERR); } e->e_id = newstr(&qf[2]); define('i', e->e_id, e); diff --git a/src/readcf.c b/src/readcf.c index 04f70f9..89c980e 100644 --- a/src/readcf.c +++ b/src/readcf.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)readcf.c 8.201 (Berkeley) 10/1/97"; +static char sccsid[] = "@(#)readcf.c 8.238 (Berkeley) 1/28/1999"; #endif /* not lint */ # include "sendmail.h" @@ -43,9 +21,9 @@ static char sccsid[] = "@(#)readcf.c 8.201 (Berkeley) 10/1/97"; #endif /* -** READCF -- read control file. +** READCF -- read configuration file. ** -** This routine reads the control file and builds the internal +** This routine reads the configuration file and builds the internal ** form. ** ** The file is formatted as a sequence of lines, each taken @@ -77,7 +55,7 @@ static char sccsid[] = "@(#)readcf.c 8.201 (Berkeley) 10/1/97"; ** Eenvar=value Set the environment value to the given value. ** ** Parameters: -** cfname -- control file name. +** cfname -- configuration file name. ** safe -- TRUE if this is the system config file; ** FALSE otherwise. ** e -- the main envelope. @@ -128,19 +106,19 @@ readcf(cfname, safe, e) if (cf == NULL) { syserr("cannot open"); - exit(EX_OSFILE); + finis(FALSE, EX_OSFILE); } if (fstat(fileno(cf), &statb) < 0) { syserr("cannot fstat"); - exit(EX_OSFILE); + finis(FALSE, EX_OSFILE); } if (!S_ISREG(statb.st_mode)) { syserr("not a plain file"); - exit(EX_OSFILE); + finis(FALSE, EX_OSFILE); } if (OpMode != MD_TEST && bitset(S_IWGRP|S_IWOTH, statb.st_mode)) @@ -233,10 +211,6 @@ readcf(cfname, safe, e) botch = "$0-$9"; break; - case CANONNET: - botch = "$#"; - break; - case CANONUSER: botch = "$:"; break; @@ -536,7 +510,7 @@ readcf(cfname, safe, e) default: badline: - syserr("unknown control line \"%s\"", bp); + syserr("unknown configuration line \"%s\"", bp); } if (bp != buf) free(bp); @@ -544,7 +518,7 @@ readcf(cfname, safe, e) if (ferror(cf)) { syserr("I/O read error"); - exit(EX_OSFILE); + finis(FALSE, EX_OSFILE); } fclose(cf); FileName = NULL; @@ -750,7 +724,11 @@ fileclass(class, filename, fmt, safe, optional) else { pid = -1; - sff = SFF_REGONLY|SFF_NOWLINK; + 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) @@ -850,7 +828,7 @@ makemailer(line) char fcode; auto char *endp; extern int NextMailer; - extern char **makeargv(); + extern char **makeargv __P((char *)); extern char *munchstring __P((char *, char **, int)); /* allocate a mailer and set up defaults */ @@ -1105,6 +1083,24 @@ makemailer(line) 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; @@ -1500,35 +1496,44 @@ struct optioninfo #define O_PIDFILE 0x9f { "PidFile", O_PIDFILE, FALSE }, #endif -#if _FFR_WRITABLE_DIRECTORIES_ARE_FATAL_OPTION -#define O_WDAF 0xa0 - { "WritableDirectoriesAreFatal", O_WDAF, FALSE }, -#endif -#if _FFR_CHOWN_IS_ALWAYS_SAFE_OPTION -#define O_CIAS 0xa1 - { "ChownIsAlwaysSafe", O_CIAS, FALSE }, -#endif -#if _FFR_DONT_PROBE_INTERFACES_OPTION -#define O_DPI 0xa2 +#define O_DONTBLAMESENDMAIL 0xa0 + { "DontBlameSendmail", O_DONTBLAMESENDMAIL, FALSE }, +#define O_DPI 0xa1 { "DontProbeInterfaces", O_DPI, FALSE }, -#endif -#if _FFR_MAXRCPT_OPTION -#define O_MAXRCPT 0xa3 - { "MaxRecipientPerMessage", O_MAXRCPT, FALSE }, -#endif +#define O_MAXRCPT 0xa2 + { "MaxRecipientsPerMessage", O_MAXRCPT, FALSE }, #if _FFR_DEADLETTERDROP_OPTION -#define O_DEADLETTER 0xa4 +#define O_DEADLETTER 0xa3 { "DeadLetterDrop", O_DEADLETTER, FALSE }, #endif #if _FFR_DONTLOCKFILESFORREAD_OPTION -#define O_DONTLOCK 0xa5 +#define O_DONTLOCK 0xa4 { "DontLockFilesForRead", O_DONTLOCK, FALSE }, #endif #if _FFR_MAXALIASRECURSION_OPTION -#define O_MAXALIASRCSN 0xa6 +#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 } }; @@ -1546,10 +1551,11 @@ setoption(opt, val, safe, sticky, e) register struct optioninfo *o; char *subopt; int mid; + bool can_setuid = RunAsUid == 0; auto char *ep; char buf[50]; - extern bool atobool(); - extern time_t convtime(); + extern bool atobool __P((char *)); + extern time_t convtime __P((char *, char)); extern int QueueLA; extern int RefuseLA; extern bool Warn_Q_option; @@ -1715,7 +1721,7 @@ setoption(opt, val, safe, sticky, e) default: syserr("Unknown 8-bit mode %c", *val); - exit(EX_USAGE); + finis(FALSE, EX_USAGE); } break; #endif @@ -1779,8 +1785,11 @@ setoption(opt, val, safe, sticky, e) default: syserr("Unknown delivery mode %c", *val); - exit(EX_USAGE); + 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 */ @@ -2055,7 +2064,10 @@ setoption(opt, val, safe, sticky, e) } } if (isascii(*val) && isdigit(*val)) + { DefUid = atoi(val); + setdefuser(); + } else { register struct passwd *pw; @@ -2068,6 +2080,7 @@ setoption(opt, val, safe, sticky, e) { DefUid = pw->pw_uid; DefGid = pw->pw_gid; + DefUser = newstr(pw->pw_name); } } @@ -2078,7 +2091,6 @@ setoption(opt, val, safe, sticky, e) DefUid, UID_MAX); } #endif - setdefuser(); /* handle the group if it is there */ if (*p == '\0') @@ -2248,7 +2260,8 @@ setoption(opt, val, safe, sticky, e) break; case O_UGW: /* group writable files are unsafe */ - UnsafeGroupWrites = atobool(val); + if (!atobool(val)) + DontBlameSendmail |= DBS_GROUPWRITABLEFORWARDFILESAFE|DBS_GROUPWRITABLEINCLUDEFILESAFE; break; case O_DBLBOUNCE: /* address to which to send double bounces */ @@ -2278,7 +2291,7 @@ setoption(opt, val, safe, sticky, e) } if (isascii(*val) && isdigit(*val)) { - if (RunAsUid == 0) + if (can_setuid) RunAsUid = atoi(val); } else @@ -2288,7 +2301,7 @@ setoption(opt, val, safe, sticky, e) pw = sm_getpwnam(val); if (pw == NULL) syserr("readcf: option RunAsUser: unknown user %s", val); - else if (RunAsUid == 0) + else if (can_setuid) { if (*p == '\0') RunAsUserName = newstr(val); @@ -2296,24 +2309,34 @@ setoption(opt, val, safe, sticky, e) RunAsGid = pw->pw_gid; } } - if (*p == '\0') - break; - if (isascii(*p) && isdigit(*p)) +#ifdef UID_MAX + if (RunAsUid > UID_MAX) { - if (RunAsGid == 0) - RunAsGid = atoi(p); + syserr("readcf: option RunAsUser: uid value (%ld) > UID_MAX (%ld); ignored", + RunAsUid, UID_MAX); } - else +#endif + if (*p != '\0') { - register struct group *gr; - - gr = getgrnam(p); - if (gr == NULL) - syserr("readcf: option RunAsUser: unknown group %s", - p); - else if (RunAsGid == 0) - RunAsGid = gr->gr_gid; + 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 @@ -2329,29 +2352,46 @@ setoption(opt, val, safe, sticky, e) break; #endif -#if _FFR_WRITABLE_DIRECTORIES_ARE_FATAL_OPTION - case O_WDAF: - FatalWritableDirs = atobool(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'; -#if _FFR_CHOWN_IS_ALWAYS_SAFE_OPTION - case O_CIAS: - ChownIsAlwaysSafe = atobool(val); + 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; -#endif -#if _FFR_DONT_PROBE_INTERFACES_OPTION case O_DPI: DontProbeInterfaces = atobool(val); break; -#endif -#if _FFR_MAXRCPT_OPTION case O_MAXRCPT: MaxRcptPerMsg = atoi(val); break; -#endif #if _FFR_DEADLETTERDROP_OPTION case O_DEADLETTER: @@ -2373,6 +2413,81 @@ setoption(opt, val, safe, sticky, e) 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)) { @@ -2544,7 +2659,7 @@ strtorwset(p, endp, stabmode) while (*p != '\0' && isascii(*p) && (isalnum(*p) || *p == '_')) p++; - if (q == p || !isalpha(*q)) + if (q == p || !(isascii(*q) && isalpha(*q))) { /* no valid characters */ syserr("invalid ruleset name: \"%.20s\"", q); @@ -2566,7 +2681,7 @@ strtorwset(p, endp, stabmode) { while (isascii(*++p) && isspace(*p)) continue; - if (!isdigit(*p)) + if (!(isascii(*p) && isdigit(*p))) { syserr("bad ruleset definition \"%s\" (number required after `=')", q); ruleset = -1; @@ -2631,7 +2746,7 @@ inittimeouts(val) register char *val; { register char *p; - extern time_t convtime(); + extern time_t convtime __P((char *, char)); if (tTd(37, 2)) printf("inittimeouts(%s)\n", val == NULL ? "<NULL>" : val); @@ -2658,20 +2773,20 @@ inittimeouts(val) if (tTd(37, 5)) { printf("Timeouts:\n"); - printf(" connect = %ld\n", TimeOuts.to_connect); - printf(" initial = %ld\n", TimeOuts.to_initial); - printf(" helo = %ld\n", TimeOuts.to_helo); - printf(" mail = %ld\n", TimeOuts.to_mail); - printf(" rcpt = %ld\n", TimeOuts.to_rcpt); - printf(" datainit = %ld\n", TimeOuts.to_datainit); - printf(" datablock = %ld\n", TimeOuts.to_datablock); - printf(" datafinal = %ld\n", TimeOuts.to_datafinal); - printf(" rset = %ld\n", TimeOuts.to_rset); - printf(" quit = %ld\n", TimeOuts.to_quit); - printf(" nextcommand = %ld\n", TimeOuts.to_nextcommand); - printf(" miscshort = %ld\n", TimeOuts.to_miscshort); - printf(" ident = %ld\n", TimeOuts.to_ident); - printf(" fileopen = %ld\n", TimeOuts.to_fileopen); + 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; } @@ -2730,7 +2845,7 @@ settimeout(name, val) { register char *p; time_t to; - extern time_t convtime(); + extern time_t convtime __P((char *, char)); if (tTd(37, 2)) printf("settimeout(%s = %s)\n", name, val); diff --git a/src/recipient.c b/src/recipient.c index adcce7a..f7e221f 100644 --- a/src/recipient.c +++ b/src/recipient.c @@ -1,42 +1,21 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)recipient.c 8.133 (Berkeley) 10/19/97"; +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. @@ -134,7 +113,7 @@ sendtolist(list, ctladdr, sendq, aliaslevel, e) if (ctladdr != NULL) { ADDRESS *b; - extern ADDRESS *self_reference(); + extern ADDRESS *self_reference __P((ADDRESS *, ENVELOPE *)); /* self reference test */ if (sameaddr(ctladdr, a)) @@ -312,6 +291,7 @@ recipient(a, sendq, aliaslevel, e) { 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); } @@ -328,7 +308,9 @@ recipient(a, sendq, aliaslevel, e) for (pq = sendq; (q = *pq) != NULL; pq = &q->q_next) { - if (sameaddr(q, a) && bitset(QRCPTOK, q->q_flags)) + if (sameaddr(q, a) && + (bitset(QRCPTOK, q->q_flags) || + !bitset(QPRIMARY, q->q_flags))) { if (tTd(26, 1)) { @@ -349,8 +331,11 @@ recipient(a, sendq, aliaslevel, e) } /* add address on list */ - *pq = a; - a->q_next = NULL; + if (pq != NULL) + { + *pq = a; + a->q_next = NULL; + } /* ** Alias the name and handle special mailer types. @@ -358,7 +343,10 @@ recipient(a, sendq, aliaslevel, e) trylocaluser: if (tTd(29, 7)) - printf("at trylocaluser %s\n", a->q_user); + { + printf("at trylocaluser: "); + printaddr(a, FALSE); + } if (bitset(QDONTSEND|QBADADDR|QVERIFIED, a->q_flags)) goto testselfdestruct; @@ -383,12 +371,12 @@ recipient(a, sendq, aliaslevel, e) if (LogLevel > 2) sm_syslog(LOG_ERR, e->e_id, "include %s: transient error: %s", - shortenstring(a->q_user, 203), + 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, 203), + shortenstring(a->q_user, MAXSHORTSTR), errstring(ret)); } else if (ret != 0) @@ -396,14 +384,14 @@ recipient(a, sendq, aliaslevel, e) a->q_flags |= QBADADDR; a->q_status = "5.2.4"; usrerr("550 Cannot open %s: %s", - shortenstring(a->q_user, 203), + shortenstring(a->q_user, MAXSHORTSTR), errstring(ret)); } } } else if (m == FileMailer) { - extern bool writable(); + extern bool writable __P((char *, ADDRESS *, int)); /* check if writable or creatable */ if (a->q_alias == NULL) @@ -427,6 +415,7 @@ recipient(a, sendq, aliaslevel, e) { 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); } @@ -452,7 +441,7 @@ recipient(a, sendq, aliaslevel, e) if (!bitset(QDONTSEND|QNOTREMOTE|QVERIFIED, a->q_flags) && bitnset(M_CHECKUDB, m->m_flags)) { - extern int udbexpand(); + extern int udbexpand __P((ADDRESS *, ADDRESS **, int, ENVELOPE *)); if (udbexpand(a, sendq, aliaslevel, e) == EX_TEMPFAIL) { @@ -856,7 +845,11 @@ writable(filename, ctladdr, flags) if (geteuid() == 0 && (ctladdr == NULL || !bitset(QGOODUID, ctladdr->q_flags))) flags |= SFF_SETUIDOK; - flags |= SFF_NOLINK; + + 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; @@ -898,7 +891,7 @@ writable(filename, ctladdr, flags) */ static jmp_buf CtxIncludeTimeout; -static void includetimeout(); +static void includetimeout __P((void)); int include(fname, forwarding, ctladdr, sendq, aliaslevel, e) @@ -915,6 +908,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e) int oldlinenumber = LineNumber; register EVENT *ev = NULL; int nincludes; + int mode; register ADDRESS *ca; volatile uid_t saveduid, uid; volatile gid_t savedgid, gid; @@ -926,7 +920,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e) volatile bool safedir = FALSE; struct stat st; char buf[MAXLINE]; - extern bool chownsafe(); + extern bool chownsafe __P((int, bool)); if (tTd(27, 2)) printf("include(%s)\n", fname); @@ -943,7 +937,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e) (int) getuid(), (int) geteuid()); if (forwarding) - sfflags |= SFF_MUSTOWN|SFF_ROOTOK|SFF_NOSLINK; + sfflags |= SFF_MUSTOWN|SFF_ROOTOK|SFF_NOWLINK; ca = getctladdr(ctladdr); if (ca == NULL) @@ -964,9 +958,22 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e) if (saveduid == 0) { if (!DontInitGroups) - initgroups(uname, gid); - if (gid != 0) - (void) setgid(gid); + { + 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 @@ -978,8 +985,6 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e) syserr("setreuid(0, %d) failure (real=%d, eff=%d)", uid, getuid(), geteuid()); # endif - else - sfflags |= SFF_NOPATHCHECK; } } #endif @@ -1011,18 +1016,63 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e) p = strrchr(fname, '/'); if (p != NULL) { + int ret; + *p = '\0'; - if (safedirpath(fname, uid, gid, uname, sfflags|SFF_SAFEDIRPATH) == 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) + if (!safedir && + !bitset((forwarding ? + DBS_LINKEDFORWARDFILEINWRITABLEDIR : + DBS_LINKEDINCLUDEFILEINWRITABLEDIR), + DontBlameSendmail)) sfflags |= SFF_NOLINK; rval = safefile(fname, uid, gid, uname, sfflags, S_IREAD, &st); @@ -1039,7 +1089,7 @@ include(fname, forwarding, ctladdr, sendq, aliaslevel, e) if (tTd(27, 4)) printf("include: open: %s\n", errstring(rval)); } - else if (filechanged(fname, fileno(fp), &st, sfflags)) + else if (filechanged(fname, fileno(fp), &st)) { rval = E_SM_FILECHANGE; if (tTd(27, 4)) @@ -1130,7 +1180,7 @@ resetuid: if (LogLevel >= 12) sm_syslog(LOG_INFO, e->e_id, "%s: user %s has bad shell %s, marked %s", - shortenstring(fname, 203), + shortenstring(fname, MAXSHORTSTR), pw->pw_name, sh, safechown ? "bogus" : "unsafe"); if (safechown) @@ -1145,28 +1195,37 @@ resetuid: { /* 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 + ** 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). - ** Also, we don't check for writable - ** directories in the path. We've got to leave - ** something for the local sysad to do. */ - if (bitset(S_IWOTH | (UnsafeGroupWrites ? S_IWGRP : 0), st.st_mode)) + 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, 203), + shortenstring(fname, MAXSHORTSTR), bitset(S_IWOTH, st.st_mode) ? "world" : "group", forwarding ? "forward" : ":include:"); ctladdr->q_flags |= QUNSAFEADDR; @@ -1208,7 +1267,7 @@ resetuid: if (forwarding && LogLevel > 9) sm_syslog(LOG_INFO, e->e_id, "forward %.200s => %s", - oldto, shortenstring(buf, 203)); + oldto, shortenstring(buf, MAXSHORTSTR)); nincludes += sendtolist(buf, ctladdr, sendq, aliaslevel + 1, e); } @@ -1351,6 +1410,8 @@ self_reference(a, e) 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)) @@ -1369,6 +1430,22 @@ self_reference(a, e) 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; } diff --git a/src/safefile.c b/src/safefile.c index 842a09f..ff94b3d 100644 --- a/src/safefile.c +++ b/src/safefile.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)safefile.c 8.18 (Berkeley) 8/1/97"; +static char sccsid[] = "@(#)safefile.c 8.43 (Berkeley) 10/13/1998"; #endif /* not lint */ # include "sendmail.h" @@ -63,18 +41,6 @@ static char sccsid[] = "@(#)safefile.c 8.18 (Berkeley) 8/1/97"; #include <grp.h> -#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 - int safefile(fn, uid, gid, uname, flags, mode, st) char *fn; @@ -135,7 +101,8 @@ safefile(fn, uid, gid, uname, flags, mode, st) #ifdef SUID_ROOT_FILES_OK if (bitset(S_ISUID, st->st_mode)) #else - if (bitset(S_ISUID, st->st_mode) && st->st_uid != 0) + if (bitset(S_ISUID, st->st_mode) && st->st_uid != 0 && + st->st_uid != TrustedUid) #endif { uid = st->st_uid; @@ -174,6 +141,16 @@ safefile(fn, uid, gid, uname, flags, mode, st) } 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; } @@ -226,8 +203,34 @@ safefile(fn, uid, gid, uname, flags, mode, st) if (stat(dir, &stbuf) >= 0) { int md = S_IWRITE|S_IEXEC; - if (stbuf.st_uid != uid) - md >>= 6; + + 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; } @@ -246,40 +249,47 @@ safefile(fn, uid, gid, uname, flags, mode, st) if (bitset(SFF_NOSLINK, flags) && S_ISLNK(st->st_mode)) { if (tTd(44, 4)) - printf("\t[slink mode %o]\tE_SM_NOSLINK\n", - st->st_mode); + 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 %o]\tE_SM_REGONLY\n", - st->st_mode); + printf("\t[non-reg mode %lo]\tE_SM_REGONLY\n", + (u_long) st->st_mode); return E_SM_REGONLY; } - if (bitset(SFF_NOWFILES, flags) && - bitset(S_IWOTH | (UnsafeGroupWrites ? S_IWGRP : 0), st->st_mode)) + if (bitset(SFF_NOGWFILES, flags) && + bitset(S_IWGRP, st->st_mode)) { if (tTd(44, 4)) - printf("\t[write bits %o]\tE_SM_%cWFILE\n", - st->st_mode, - bitset(S_IWOTH, st->st_mode) ? 'W' : 'G'); - return bitset(S_IWOTH, st->st_mode) ? E_SM_WWFILE : E_SM_GWFILE; + 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 %o]\tE_SM_ISEXEC]\n", - st->st_mode); + 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", - st->st_nlink); + (int) st->st_nlink); return E_SM_NOHLINK; } @@ -287,7 +297,11 @@ safefile(fn, uid, gid, uname, flags, mode, st) ; else if (uid == 0 && !bitset(SFF_ROOTOK, flags)) mode >>= 6; - else if (st->st_uid != uid) + else if (st->st_uid == uid) + ; + else if (uid == 0 && st->st_uid == TrustedUid) + ; + else { mode >>= 3; if (st->st_gid == gid) @@ -314,6 +328,7 @@ safefile(fn, uid, gid, uname, flags, mode, st) (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) { @@ -357,6 +372,7 @@ safedirpath(fn, uid, gid, uname, flags) char *p; register struct group *gr = NULL; int ret = 0; + int mode = S_IWOTH; struct stat stbuf; /* special case root directory */ @@ -367,6 +383,9 @@ safedirpath(fn, uid, gid, uname, flags) 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 { @@ -381,11 +400,11 @@ safedirpath(fn, uid, gid, uname, flags) break; } if ((uid == 0 || bitset(SFF_SAFEDIRPATH, flags)) && - bitset(S_IWGRP|S_IWOTH, stbuf.st_mode)) + bitset(mode, stbuf.st_mode)) { if (tTd(44, 4)) - printf("\t[dir %s] mode %o\n", - fn, stbuf.st_mode); + 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)) @@ -395,7 +414,11 @@ safedirpath(fn, uid, gid, uname, flags) break; } if (Verbose > 1) - message("051 WARNING: writable directory %s", fn); + 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)) { @@ -404,6 +427,15 @@ safedirpath(fn, uid, gid, uname, flags) 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; @@ -505,7 +537,7 @@ safeopen(fn, omode, cmode, sff) fd = dfopen(fn, omode, cmode, sff); if (fd < 0) return fd; - if (filechanged(fn, fd, &stb, sff)) + if (filechanged(fn, fd, &stb)) { syserr("554 cannot open: file %s changed after open", fn); close(fd); @@ -594,7 +626,6 @@ safefopen(fn, omode, cmode, sff) ** fn -- pathname of file to check. ** fd -- file descriptor to check. ** stb -- stat structure from before open. -** sff -- safe file flags. ** ** Returns: ** TRUE -- if a problem was detected. @@ -602,11 +633,10 @@ safefopen(fn, omode, cmode, sff) */ bool -filechanged(fn, fd, stb, sff) +filechanged(fn, fd, stb) char *fn; int fd; struct stat *stb; - int sff; { struct stat sta; @@ -639,8 +669,17 @@ filechanged(fn, fd, stb, sff) (long) stb->st_nlink, (long) sta.st_nlink); printf(" dev = %ld/%ld\n", (long) stb->st_dev, (long) sta.st_dev); - printf(" ino = %ld/%ld\n", - (long) stb->st_ino, (long) sta.st_ino); + 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); diff --git a/src/savemail.c b/src/savemail.c index 76209dc..6a18ee6 100644 --- a/src/savemail.c +++ b/src/savemail.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)savemail.c 8.121 (Berkeley) 10/22/97"; +static char sccsid[] = "@(#)savemail.c 8.140 (Berkeley) 1/18/1999"; #endif /* not lint */ # include "sendmail.h" @@ -84,8 +62,8 @@ savemail(e, sendbody) MCI mcibuf; int flags; char buf[MAXLINE+1]; - extern char *ttypath(); - extern bool writable(); + extern char *ttypath __P((void)); + extern bool writable __P((char *, ADDRESS *, int)); if (tTd(6, 1)) { @@ -113,8 +91,7 @@ savemail(e, sendbody) RF_COPYPARSE|RF_SENDERADDR, '\0', NULL, e) == NULL) { syserr("553 Cannot parse Postmaster!"); - ExitStat = EX_SOFTWARE; - finis(); + finis(TRUE, EX_SOFTWARE); } } e->e_to = NULL; @@ -366,9 +343,11 @@ savemail(e, sendbody) /* we have a home directory; write dead.letter */ define('z', p, e); expand("\201z/dead.letter", buf, sizeof buf, e); - flags = SFF_NOLINK|SFF_CREAT|SFF_REGONLY|SFF_RUNASREALUID; + flags = SFF_CREAT|SFF_REGONLY|SFF_RUNASREALUID; + if (RealUid == 0) + flags |= SFF_ROOTOK; e->e_to = buf; - if (mailfile(buf, NULL, flags, e) == EX_OK) + if (mailfile(buf, FileMailer, NULL, flags, e) == EX_OK) { int oldverb = Verbose; @@ -399,7 +378,7 @@ savemail(e, sendbody) break; } - flags = SFF_NOLINK|SFF_CREAT|SFF_REGONLY|SFF_ROOTOK|SFF_OPENASROOT|SFF_MUSTOWN; + 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) @@ -413,9 +392,10 @@ savemail(e, sendbody) 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); + (*e->e_puthdr)(&mcibuf, e->e_header, e, M87F_OUTER); (*e->e_putbody)(&mcibuf, e, NULL); putline("\n", &mcibuf); (void) fflush(fp); @@ -483,7 +463,7 @@ returntosender(msg, returnq, flags, e) register ENVELOPE *ee; ENVELOPE *oldcur = CurEnv; ENVELOPE errenvelope; - static int returndepth; + static int returndepth = 0; register ADDRESS *q; char *p; char buf[MAXNAME + 1]; @@ -562,7 +542,7 @@ returntosender(msg, returnq, flags, e) p = "DSN"; sm_syslog(LOG_INFO, e->e_id, "%s: %s: %s", - ee->e_id, p, shortenstring(msg, 203)); + ee->e_id, p, shortenstring(msg, MAXSHORTSTR)); } if (SendMIMEErrors) @@ -641,7 +621,7 @@ returntosender(msg, returnq, flags, e) eatheader(ee, TRUE); /* mark statistics */ - markstats(ee, NULLADDR); + markstats(ee, NULLADDR, FALSE); /* actually deliver the error message */ sendall(ee, SM_DELIVER); @@ -764,14 +744,16 @@ errbody(mci, e, separator) 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) { -#if _FFR_BUG_FIX + extern void translate_dollars __P((char *)); + translate_dollars(buf); -#endif expand(buf, buf, sizeof buf, e); putline(buf, mci); } @@ -805,12 +787,13 @@ errbody(mci, e, separator) printheader = FALSE; } - snprintf(buf, sizeof buf, "%s", shortenstring(q->q_paddr, 203)); + 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, 203)); + shortenstring(q->q_alias->q_paddr, MAXSHORTSTR)); putline(buf, mci); } } @@ -832,12 +815,13 @@ errbody(mci, e, separator) printheader = FALSE; } - snprintf(buf, sizeof buf, "%s", shortenstring(q->q_paddr, 203)); + 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, 203)); + shortenstring(q->q_alias->q_paddr, MAXSHORTSTR)); putline(buf, mci); } } @@ -875,12 +859,12 @@ errbody(mci, e, separator) } snprintf(buf, sizeof buf, "%s (%s)", - shortenstring(q->q_paddr, 203), p); + 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, 203)); + shortenstring(q->q_alias->q_paddr, MAXSHORTSTR)); putline(buf, mci); } } @@ -1155,7 +1139,7 @@ errbody(mci, e, separator) } } putline("", mci); - putheader(mci, e->e_parent->e_header, e->e_parent); + 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) diff --git a/src/sendmail.0 b/src/sendmail.0 index d4472e8..0046bd3 100644 --- a/src/sendmail.0 +++ b/src/sendmail.0 @@ -14,8 +14,8 @@ DDEESSCCRRIIPPTTIIOONN warding as necessary to deliver the message to the correct place. SSeennddmmaaiill is not intended as a user interface routine; other programs pro- - vide user-friendly front ends; sseennddmmaaiill is used only to deliver pre- - formatted messages. + vide user-friendly front ends; sseennddmmaaiill is used only to deliver pre-for- + matted messages. With no flags, sseennddmmaaiill 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 @@ -135,15 +135,13 @@ DDEESSCCRRIIPPTTIIOONN --tt Read message for recipients. To:, Cc:, and Bcc: lines will be scanned for recipient addresses. The Bcc: line will be - deleted before transmission. Any addresses in the argument - list will be suppressed, that is, they will _n_o_t receive - copies even if listed in the message header. + deleted before transmission. --UU Initial (user) submission. This should _a_l_w_a_y_s be set when called from a user agent such as MMaaiill or eexxmmhh and _n_e_v_e_r be set when called by a network delivery agent such as rrmmaaiill. - --VV _e_n_v_i_d Set the original envelope id. This is propogated across SMTP + --VV _e_n_v_i_d Set the original envelope id. This is propagated across SMTP to servers that support DSNs and is returned in DSN-compliant error messages. @@ -154,6 +152,9 @@ DDEESSCCRRIIPPTTIIOONN file. This should only be used as a last resort for debug- ging mailer bugs. It will log a lot of data very quickly. + ---- Stop processing command flags and use the rest of the argu- + ments as addresses. + OOppttiioonnss 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 @@ -194,7 +195,6 @@ DDEESSCCRRIIPPTTIIOONN sage is not mailed back by modes `m' or `w' and if the sender is local to this machine, a copy of the message is appended - to the file _d_e_a_d_._l_e_t_t_e_r in the sender's home directory. SaveFromLine @@ -329,9 +329,9 @@ DDEESSCCRRIIPPTTIIOONN invoked as mmaaiillqq, sseennddmmaaiill will print the contents of the mail queue. FFIILLEESS - Except for the file _/_e_t_c_/_s_e_n_d_m_a_i_l_._c_f itself, the following pathnames are - all specified in _/_e_t_c_/_s_e_n_d_m_a_i_l_._c_f_. Thus, these values are only approxima- - tions. + Except for the file _/_e_t_c_/_s_e_n_d_m_a_i_l_._c_f itself and the daemon process ID + file, the following pathnames are all specified in _/_e_t_c_/_s_e_n_d_m_a_i_l_._c_f_. + Thus, these values are only approximations. /etc/aliases raw data for alias names /etc/aliases.db data base of alias names @@ -339,8 +339,6 @@ FFIILLEESS /etc/sendmail.hf help file /var/log/sendmail.st collected statistics /var/spool/mqueue/* temp files - /var/run/sendmail.pid - The process id of the daemon SSEEEE AALLSSOO binmail(1), mail(1), rmail(1), syslog(3), aliases(5), mailaddr(7), @@ -355,4 +353,4 @@ SSEEEE AALLSSOO HHIISSTTOORRYY The sseennddmmaaiill command appeared in 4.2BSD. -4th Berkeley Distribution September 20, 1996 6 +4th Berkeley Distribution August 2, 1998 6 diff --git a/src/sendmail.8 b/src/sendmail.8 index 5c11545..89c0f55 100644 --- a/src/sendmail.8 +++ b/src/sendmail.8 @@ -1,38 +1,16 @@ -.\" Copyright (c) 1983, 1997 Eric P. Allman +.\" 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. .\" -.\" 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. +.\" 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 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. .\" -.\" @(#)sendmail.8 8.12 (Berkeley) 2/1/97 +.\" @(#)sendmail.8 8.20 (Berkeley) 8/2/1998 .\" -.Dd February 1, 1997 +.Dd August 2, 1998 .Dt SENDMAIL 8 .Os BSD 4 .Sh NAME @@ -275,11 +253,6 @@ flag. Read message for recipients. To:, Cc:, and Bcc: lines will be scanned for recipient addresses. The Bcc: line will be deleted before transmission. -Any addresses in the argument list will be suppressed, -that is, -they will -.Em not -receive copies even if listed in the message header. .It Fl U Initial (user) submission. This should @@ -304,6 +277,9 @@ 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. @@ -562,7 +538,7 @@ will print the contents of the mail queue. .Sh FILES Except for the file .Pa /etc/sendmail.cf -itself, +itself and the daemon process ID file, the following pathnames are all specified in .Pa /etc/sendmail.cf. Thus, @@ -581,8 +557,6 @@ help file collected statistics .It Pa /var/spool/mqueue/* temp files -.It Pa /var/run/sendmail.pid -The process id of the daemon .El .Sh SEE ALSO .Xr binmail 1 , diff --git a/src/sendmail.h b/src/sendmail.h index 7524d7b..e6f216c 100644 --- a/src/sendmail.h +++ b/src/sendmail.h @@ -1,37 +1,15 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. * - * @(#)sendmail.h 8.245 (Berkeley) 10/22/97 + * @(#)sendmail.h 8.295 (Berkeley) 1/26/1999 */ /* @@ -41,7 +19,7 @@ # ifdef _DEFINE # define EXTERN # ifndef lint -static char SmailSccsId[] = "@(#)sendmail.h 8.245 10/22/97"; +static char SmailSccsId[] = "@(#)sendmail.h 8.295 1/26/1999"; # endif # else /* _DEFINE */ # define EXTERN extern @@ -94,6 +72,14 @@ static char SmailSccsId[] = "@(#)sendmail.h 8.245 10/22/97"; # 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 @@ -337,6 +323,7 @@ MCI 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 */ @@ -384,7 +371,7 @@ 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_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 *)); @@ -477,7 +464,7 @@ struct envelope 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 *)); + 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 */ @@ -526,6 +513,7 @@ struct envelope #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 */ @@ -534,7 +522,7 @@ 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 *)); +extern void putheader __P((MCI *, HDR *, ENVELOPE *, int)); extern void putbody __P((MCI *, ENVELOPE *, char *)); /* ** Message priority classes. @@ -692,9 +680,11 @@ MAP 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 */ @@ -720,6 +710,7 @@ MAP # 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" */ @@ -754,7 +745,7 @@ MAPCLASS #define MCF_OPTFILE 0x0008 /* file name is optional */ /* functions */ -extern char *map_rewrite __P((MAP *, const char *, int, char **)); +extern char *map_rewrite __P((MAP *, const char *, size_t, char **)); extern MAP *makemapentry __P((char *)); extern void initmaps __P((bool, ENVELOPE *)); /* @@ -949,6 +940,7 @@ EXTERN int NoRecipientAction; #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 */ @@ -991,11 +983,12 @@ struct prival #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_NOWFILES 0x0800 /* disallow world writable files */ +#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 0x1000 /* open as root instead of real user */ -#define SFF_NOLOCK 0x2000 /* don't lock the file */ +#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) @@ -1006,7 +999,7 @@ 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 *, int)); +extern bool filechanged __P((char *, int, struct stat *)); /* @@ -1016,6 +1009,7 @@ extern bool filechanged __P((char *, int, struct stat *, int)); #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 */ /* @@ -1060,7 +1054,7 @@ EXTERN SOCKADDR RealHostAddr; /* address of host we are talking to */ extern char *hostnamebyanyaddr __P((SOCKADDR *)); extern char *anynet_ntoa __P((SOCKADDR *)); # if DAEMON -extern bool validate_connection __P((SOCKADDR *, char *, ENVELOPE *)); +extern char *validate_connection __P((SOCKADDR *, char *, ENVELOPE *)); # endif #endif @@ -1085,6 +1079,7 @@ extern bool validate_connection __P((SOCKADDR *, char *, ENVELOPE *)); #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 */ @@ -1092,6 +1087,51 @@ EXTERN int VendorCode; /* vendor-specific operation enhancements */ 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. @@ -1146,6 +1186,7 @@ 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) */ @@ -1183,6 +1224,7 @@ 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 */ @@ -1215,6 +1257,8 @@ 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 @@ -1226,7 +1270,6 @@ 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 UnsafeGroupWrites; /* group-writable files are unsafe */ 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 */ @@ -1245,17 +1288,30 @@ 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 char *QueueLimitRecipient; /* limit queue runs to this recipient */ -EXTERN char *QueueLimitSender; /* limit queue runs to this sender */ -EXTERN char *QueueLimitId; /* limit queue runs to this id */ EXTERN FILE *TrafficLogFile; /* file in which to log all traffic */ EXTERN char *DoubleBounceAddr; /* where to send double bounces */ -EXTERN bool FatalWritableDirs; /* no writable dirs in map paths */ 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 @@ -1337,10 +1393,10 @@ EXTERN u_char tTdvect[100]; 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(()); +extern time_t curtime __P((void)); extern bool transienterror __P((int)); extern char *fgetfolded __P((char *, int, FILE *)); -extern char *username __P(()); +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)); @@ -1353,9 +1409,9 @@ extern char *defcharset __P((ENVELOPE *)); extern bool wordinclass __P((char *, int)); extern char *denlstring __P((char *, bool, bool)); extern void makelower __P((char *)); -extern void rebuildaliases __P((MAP *, bool)); +extern bool rebuildaliases __P((MAP *, bool)); extern void readaliases __P((MAP *, FILE *, bool, bool)); -extern void finis __P(()); +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 *)); @@ -1383,9 +1439,12 @@ 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)); +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 *)); @@ -1412,10 +1471,10 @@ 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 *)); +extern void markstats __P((ENVELOPE *, ADDRESS *, bool)); extern void poststats __P((char *)); extern char *arpadate __P((char *)); -extern int mailfile __P((char *, ADDRESS *, int, ENVELOPE *)); +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)); @@ -1423,6 +1482,8 @@ 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)); @@ -1440,30 +1501,17 @@ extern void checkfd012 __P((char *)); #endif /* ellipsis is a different case though */ -#ifdef __STDC__ -extern void auth_warning(ENVELOPE *, const char *, ...); -extern void syserr(const char *, ...); -extern void usrerr(const char *, ...); -extern void message(const char *, ...); -extern void nmessage(const char *, ...); -extern void setproctitle(const char *, ...); -extern void sm_syslog(int, const char *, const char *, ...); -#else -extern void auth_warning(); -extern void syserr(); -extern void usrerr(); -extern void message(); -extern void nmessage(); -extern void setproctitle(); -extern void sm_syslog(); -#endif +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 -# ifdef __STDC__ -extern int snprintf(char *, size_t, const char *, ...); -extern int vsnprintf(char *, size_t, const char *, va_list); -# else -extern int snprintf(); -extern int vsnprintf(); -# endif +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)); diff --git a/src/sendmail.hf b/src/sendmail.hf index 7ab6d61..0952963 100644 --- a/src/sendmail.hf +++ b/src/sendmail.hf @@ -1,9 +1,15 @@ cpyr -cpyr Copyright (c) 1983, 1995-1997 Eric P. Allman +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 @(#)sendmail.hf 8.12 (Berkeley) 2/1/97 +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 @@ -111,3 +117,8 @@ dsn ORCPT Original recipient. -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. diff --git a/src/snprintf.c b/src/snprintf.c new file mode 100644 index 0000000..3e07e1b --- /dev/null +++ b/src/snprintf.c @@ -0,0 +1,428 @@ +/* + * 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" + +/* +** 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.2 1995/10/09 11:19:47 roberto 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++; +} + +/* +** 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; +} +/* +** 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; +} diff --git a/src/srvrsmtp.c b/src/srvrsmtp.c index cd47d5d..f4ffe8c 100644 --- a/src/srvrsmtp.c +++ b/src/srvrsmtp.c @@ -1,44 +1,22 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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 "sendmail.h" #ifndef lint #if SMTP -static char sccsid[] = "@(#)srvrsmtp.c 8.159 (Berkeley) 10/19/97 (with SMTP)"; +static char sccsid[] = "@(#)srvrsmtp.c 8.187 (Berkeley) 10/23/1998 (with SMTP)"; #else -static char sccsid[] = "@(#)srvrsmtp.c 8.159 (Berkeley) 10/19/97 (without SMTP)"; +static char sccsid[] = "@(#)srvrsmtp.c 8.187 (Berkeley) 10/23/1998 (without SMTP)"; #endif #endif /* not lint */ @@ -50,7 +28,9 @@ static char sccsid[] = "@(#)srvrsmtp.c 8.159 (Berkeley) 10/19/97 (without SMTP)" ** SMTP -- run the SMTP protocol. ** ** Parameters: -** none. +** nullserver -- if non-NULL, rejection message for +** all SMTP commands. +** e -- the envelope. ** ** Returns: ** never. @@ -118,7 +98,7 @@ static struct cmd CmdTab[] = bool OneXact = FALSE; /* one xaction only this run */ char *CurSmtpClient; /* who's at the other end of channel */ -static char *skipword(); +static char *skipword __P((char *volatile, char *)); #define MAXBADCOMMANDS 25 /* maximum number of bad commands */ @@ -129,7 +109,7 @@ static char *skipword(); void smtp(nullserver, e) - bool nullserver; + char *nullserver; register ENVELOPE *volatile e; { register char *volatile p; @@ -147,6 +127,7 @@ smtp(nullserver, e) 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 */ @@ -155,6 +136,7 @@ smtp(nullserver, e) bool ok; volatile int lognullconnection = TRUE; register char *q; + QUEUE_CHAR *new; char inp[MAXLINE]; char cmdbuf[MAXLINE]; extern ENVELOPE BlankEnvelope; @@ -178,7 +160,10 @@ smtp(nullserver, e) if (CurSmtpClient == NULL) CurSmtpClient = CurHostName; - setproctitle("server %s startup", CurSmtpClient); + /* 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) { @@ -237,7 +222,7 @@ smtp(nullserver, e) /* read the input line */ SmtpPhase = "server cmd read"; - setproctitle("server %s cmd read", CurSmtpClient); + sm_setproctitle(TRUE, "server %s cmd read", CurSmtpClient); p = sfgets(inp, sizeof inp, InChannel, TimeOuts.to_nextcommand, SmtpPhase); @@ -258,15 +243,15 @@ smtp(nullserver, e) CurSmtpClient); /* - ** If have not accepted mail (DATA), do not bounce - ** bad addresses back to sender. + ** 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(); + finis(TRUE, ExitStat); } /* clean up end of line */ @@ -282,9 +267,9 @@ smtp(nullserver, e) inp); if (e->e_id == NULL) - setproctitle("%s: %.80s", CurSmtpClient, inp); + sm_setproctitle(TRUE, "%s: %.80s", CurSmtpClient, inp); else - setproctitle("%s %s: %.80s", e->e_id, CurSmtpClient, inp); + sm_setproctitle(TRUE, "%s %s: %.80s", e->e_id, CurSmtpClient, inp); /* break off command */ for (p = inp; isascii(*p) && isspace(*p); p++) @@ -317,7 +302,7 @@ smtp(nullserver, e) ** to everything. */ - if (nullserver) + if (nullserver != NULL) { switch (c->cmdcode) { @@ -331,7 +316,7 @@ smtp(nullserver, e) default: if (++badcommands > MAXBADCOMMANDS) sleep(1); - usrerr("550 Access denied"); + usrerr("550 %s", nullserver); continue; } } @@ -380,6 +365,13 @@ smtp(nullserver, e) 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)) @@ -412,7 +404,7 @@ smtp(nullserver, e) gothello = TRUE; /* print HELO response message */ - if (c->cmdcode != CMDEHLO) + if (c->cmdcode != CMDEHLO || nullserver != NULL) { message("250 %s Hello %s, %s", MyHostName, CurSmtpClient, q); @@ -426,7 +418,8 @@ smtp(nullserver, e) if (!bitset(PRIV_NOEXPN, PrivacyFlags)) { message("250-EXPN"); - message("250-VERB"); + if (!bitset(PRIV_NOVERB, PrivacyFlags)) + message("250-VERB"); } #if MIME8TO7 message("250-8BITMIME"); @@ -440,7 +433,8 @@ smtp(nullserver, e) message("250-DSN"); #endif message("250-ONEX"); - message("250-ETRN"); + if (!bitset(PRIV_NOETRN, PrivacyFlags)) + message("250-ETRN"); message("250-XUSR"); message("250 HELP"); break; @@ -463,7 +457,7 @@ smtp(nullserver, e) { errno = 0; syserr("503 Nested MAIL command: MAIL %s", p); - finis(); + finis(TRUE, ExitStat); } /* make sure we know who the sending host is */ @@ -504,7 +498,7 @@ smtp(nullserver, e) goto undo_subproc_no_pm; nrcpts = 0; e->e_flags |= EF_LOGSENDER|EF_CLRQUEUE; - setproctitle("%s %s: %.80s", e->e_id, CurSmtpClient, inp); + sm_setproctitle(TRUE, "%s %s: %.80s", e->e_id, CurSmtpClient, inp); /* child -- go do the processing */ if (setjmp(TopFrame) > 0) @@ -518,7 +512,7 @@ smtp(nullserver, e) QuickAbort = FALSE; SuprErrs = TRUE; e->e_flags &= ~EF_FATALERRS; - finis(); + finis(TRUE, ExitStat); } break; } @@ -639,8 +633,14 @@ smtp(nullserver, e) if (p == NULL) break; a = parseaddr(p, NULLADDR, RF_COPYALL, ' ', &delimptr, e); - if (a == NULL || Errors > 0) + if (Errors > 0) + break; + if (a == NULL) + { + usrerr("501 Missing recipient"); break; + } + if (delimptr != NULL && *delimptr != '\0') *delimptr++ = '\0'; @@ -727,12 +727,17 @@ smtp(nullserver, e) 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)) + if (bitset(QVERIFIED, a->q_flags) && + !bitset(EF_DISCARD, e->e_flags)) { /* need to re-expand aliases */ doublequeue = TRUE; @@ -809,8 +814,6 @@ smtp(nullserver, e) if (!shouldqueue(e->e_msgpriority, e->e_ctime)) { - extern pid_t dowork(); - unlockqueue(e); (void) dowork(id, TRUE, TRUE, e); } @@ -819,7 +822,7 @@ smtp(nullserver, e) abortmessage: /* if in a child, pop back to our parent */ if (InChild) - finis(); + finis(TRUE, ExitStat); /* clean up a bit */ gotmail = FALSE; @@ -838,7 +841,7 @@ smtp(nullserver, e) e->e_sendqueue = NULL; e->e_flags |= EF_CLRQUEUE; if (InChild) - finis(); + finis(TRUE, ExitStat); /* clean up a bit */ gotmail = FALSE; @@ -863,7 +866,7 @@ smtp(nullserver, e) sm_syslog(LOG_INFO, e->e_id, "%.100s: %s [rejected]", CurSmtpClient, - shortenstring(inp, 203)); + shortenstring(inp, MAXSHORTSTR)); break; } else if (!gothello && @@ -881,7 +884,7 @@ smtp(nullserver, e) sm_syslog(LOG_INFO, e->e_id, "%.100s: %s", CurSmtpClient, - shortenstring(inp, 203)); + shortenstring(inp, MAXSHORTSTR)); if (setjmp(TopFrame) > 0) goto undo_subproc; QuickAbort = TRUE; @@ -917,10 +920,21 @@ smtp(nullserver, e) vrfyqueue = vrfyqueue->q_next; } if (InChild) - finis(); + 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"); @@ -934,15 +948,24 @@ smtp(nullserver, e) sm_syslog(LOG_INFO, e->e_id, "%.100s: ETRN %s", CurSmtpClient, - shortenstring(p, 203)); + shortenstring(p, MAXSHORTSTR)); id = p; if (*id == '@') id++; else *--id = '@'; - QueueLimitRecipient = 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); @@ -973,10 +996,11 @@ doquit: sm_syslog(LOG_INFO, NULL, "Null connection from %.100s", CurSmtpClient); - finis(); + finis(TRUE, ExitStat); case CMDVERB: /* set verbose mode */ - if (bitset(PRIV_NOEXPN, PrivacyFlags)) + if (bitset(PRIV_NOEXPN, PrivacyFlags) || + bitset(PRIV_NOVERB, PrivacyFlags)) { /* this would give out the same info */ message("502 Verbose unavailable"); @@ -1033,7 +1057,7 @@ doquit: } usrerr("500 Command unrecognized: \"%s\"", - shortenstring(inp, 203)); + shortenstring(inp, MAXSHORTSTR)); break; default: @@ -1095,7 +1119,7 @@ checksmtpattack(pcounter, maxcount, cname, e) static char * skipword(p, w) - register char *p; + register char *volatile p; char *w; { register char *q; @@ -1115,7 +1139,7 @@ skipword(p, w) { syntax: usrerr("501 Syntax error in parameters scanning \"%s\"", - shortenstring(firstp, 203)); + shortenstring(firstp, MAXSHORTSTR)); return (NULL); } *p++ = '\0'; @@ -1397,7 +1421,7 @@ runinchild(label, e) auto int st; /* parent -- wait for child to complete */ - setproctitle("server %s child wait", CurSmtpClient); + sm_setproctitle(TRUE, "server %s child wait", CurSmtpClient); st = waitfor(childpid); if (st == -1) syserr("451 %s: lost child", label); @@ -1409,7 +1433,7 @@ runinchild(label, e) if (WEXITSTATUS(st) == EX_QUIT) { disconnect(1, e); - finis(); + finis(TRUE, ExitStat); } /* restore the child signal */ @@ -1427,10 +1451,6 @@ runinchild(label, e) (void) releasesignal(SIGCHLD); } } - - /* open alias database */ - initmaps(FALSE, e); - return (0); } @@ -1461,6 +1481,8 @@ help(topic) if (DontLockReadFiles) sff |= SFF_NOLOCK; + if (!bitset(DBS_HELPFILEINUNSAFEDIRPATH, DontBlameSendmail)) + sff |= SFF_SAFEDIRPATH; if (HelpFile == NULL || (hf = safefopen(HelpFile, O_RDONLY, 0444, sff)) == NULL) @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)stab.c 8.13 (Berkeley) 4/19/97"; +static char sccsid[] = "@(#)stab.c 8.19 (Berkeley) 5/19/1998"; #endif /* not lint */ # include "sendmail.h" @@ -72,7 +50,7 @@ stab(name, type, op) register int hfunc; register char *p; int len; - extern char lower(); + extern char lower __P((char)); if (tTd(36, 5)) printf("STAB: %s %d ", name, type); diff --git a/src/stats.c b/src/stats.c index cb0f9dd..b1162ff 100644 --- a/src/stats.c +++ b/src/stats.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)stats.c 8.11 (Berkeley) 4/9/97"; +static char sccsid[] = "@(#)stats.c 8.22 (Berkeley) 5/19/1998"; #endif /* not lint */ # include "sendmail.h" @@ -50,11 +28,22 @@ bool GotStats = FALSE; /* set when we have stats to merge */ */ void -markstats(e, to) +markstats(e, to, reject) register ENVELOPE *e; register ADDRESS *to; + bool reject; { - if (to == NULL) + 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) { @@ -88,6 +77,7 @@ poststats(sfile) char *sfile; { register int fd; + int sff = SFF_REGONLY|SFF_OPENASROOT; struct statistics stat; extern off_t lseek(); @@ -96,15 +86,27 @@ poststats(sfile) (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_REGONLY|SFF_NOLINK|SFF_OPENASROOT); + 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_size == sizeof stat && + stat.stat_magic == Stat.stat_magic && + stat.stat_version == Stat.stat_version) { /* merge current statistics into statfile */ register int i; @@ -115,6 +117,8 @@ poststats(sfile) 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 diff --git a/src/sysexits.c b/src/sysexits.c index 3695536..c7934c7 100644 --- a/src/sysexits.c +++ b/src/sysexits.c @@ -1,42 +1,20 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)sysexits.c 8.7 (Berkeley) 2/1/97"; +static char sccsid[] = "@(#)sysexits.c 8.13 (Berkeley) 5/24/1998"; #endif /* not lint */ -#include <sendmail.h> +#include "sendmail.h" /* ** SYSEXITS.C -- error messages corresponding to sysexits.h diff --git a/src/trace.c b/src/trace.c index 49a1ae0..5ab6032 100644 --- a/src/trace.c +++ b/src/trace.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)trace.c 8.6 (Berkeley) 2/1/97"; +static char sccsid[] = "@(#)trace.c 8.12 (Berkeley) 5/19/1998"; #endif /* not lint */ # include "sendmail.h" @@ -94,7 +72,7 @@ tTflag(s) { /* find first flag to set */ i = 0; - while (isdigit(*s)) + while (isascii(*s) && isdigit(*s)) i = i * 10 + (*s++ - '0'); first = i; @@ -102,7 +80,7 @@ tTflag(s) if (*s == '-') { i = 0; - while (isdigit(*++s)) + while (isascii(*++s) && isdigit(*s)) i = i * 10 + (*s - '0'); } last = i; @@ -112,7 +90,7 @@ tTflag(s) if (*s == '.') { i = 0; - while (isdigit(*++s)) + while (isascii(*++s) && isdigit(*s)) i = i * 10 + (*s - '0'); } @@ -1,44 +1,22 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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 "sendmail.h" #ifndef lint #if USERDB -static char sccsid [] = "@(#)udb.c 8.51 (Berkeley) 5/29/97 (with USERDB)"; +static char sccsid [] = "@(#)udb.c 8.71 (Berkeley) 1/17/1999 (with USERDB)"; #else -static char sccsid [] = "@(#)udb.c 8.51 (Berkeley) 5/29/97 (without USERDB)"; +static char sccsid [] = "@(#)udb.c 8.71 (Berkeley) 1/17/1999 (without USERDB)"; #endif #endif @@ -48,6 +26,9 @@ static char sccsid [] = "@(#)udb.c 8.51 (Berkeley) 5/29/97 (without USERDB)"; #ifdef NEWDB # include <db.h> +# ifndef DB_VERSION_MAJOR +# define DB_VERSION_MAJOR 1 +# endif #else # define DBT struct _data_base_thang_ DBT @@ -57,10 +38,6 @@ DBT }; #endif -#ifdef HESIOD -# include <hesiod.h> -#endif /* HESIOD */ - /* ** UDB.C -- interface between sendmail and Berkeley User Data Base. ** @@ -72,6 +49,7 @@ 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 { @@ -114,12 +92,15 @@ struct udbent #define MAXUDBENT 10 /* maximum number of UDB entries */ -struct option +struct udb_option { char *name; char *val; }; +#ifdef HESIOD +extern int hes_udb_get __P((DBT *, DBT *)); +#endif extern int _udbx_init __P((ENVELOPE *)); /* ** UDBEXPAND -- look up user in database and expand @@ -160,8 +141,12 @@ udbexpand(a, sendq, aliaslevel, e) 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); @@ -181,20 +166,24 @@ udbexpand(a, sendq, aliaslevel, e) 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 */ - if (a->q_user[0] == '\\') + /* (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(a->q_user) > (SIZE_T) sizeof keybuf - 12) + if (strlen(user) > (SIZE_T) sizeof keybuf - 12) return EX_OK; /* if name begins with a colon, it indicates our metadata */ - if (a->q_user[0] == ':') + if (user[0] == ':') return EX_OK; /* build actual database key */ - (void) strcpy(keybuf, a->q_user); + (void) strcpy(keybuf, user); (void) strcat(keybuf, ":maildrop"); keylen = strlen(keybuf); @@ -208,6 +197,9 @@ udbexpand(a, sendq, aliaslevel, e) #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'; @@ -231,12 +223,36 @@ udbexpand(a, sendq, aliaslevel, e) 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)) @@ -253,6 +269,13 @@ udbexpand(a, sendq, aliaslevel, e) 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; } @@ -284,9 +307,24 @@ udbexpand(a, sendq, aliaslevel, e) 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; @@ -296,7 +334,7 @@ udbexpand(a, sendq, aliaslevel, e) sm_syslog(LOG_INFO, e->e_id, "expand %.100s => %s", e->e_to, - shortenstring(user, 203)); + shortenstring(user, MAXSHORTSTR)); naddrs = sendtolist(user, a, sendq, aliaslevel + 1, e); if (naddrs > 0 && !bitset(QSELFREF, a->q_flags)) { @@ -310,7 +348,7 @@ udbexpand(a, sendq, aliaslevel, e) if (i < 0) { syserr("udbexpand: db-get %.*s stat %d", - key.size, key.data, i); + (int) key.size, (char *) key.data, i); return EX_TEMPFAIL; } @@ -319,12 +357,20 @@ udbexpand(a, sendq, aliaslevel, e) ** 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); @@ -355,7 +401,7 @@ udbexpand(a, sendq, aliaslevel, e) if (i < 0) { syserr("udbexpand: hesiod-get %.*s stat %d", - key.size, key.data, i); + (int) key.size, (char *) key.data, i); return EX_TEMPFAIL; } else if (i > 0 || info.size <= 0) @@ -366,7 +412,7 @@ udbexpand(a, sendq, aliaslevel, e) if (tTd(28, 2)) printf("udbexpand: no match on %s (%d)\n", - keybuf, keylen); + (char *) keybuf, (int) keylen); #if HES_GETMAILHOST if (tTd(28, 8)) printf(" ... trying hes_getmailhost(%s)\n", @@ -405,7 +451,8 @@ udbexpand(a, sendq, aliaslevel, e) } if (tTd(28, 80)) printf("udbexpand: match %.*s: %.*s\n", - key.size, key.data, info.size, info.data); + (int) key.size, (char *) key.data, + (int) info.size, (char *) info.data); a->q_flags &= ~QSELFREF; if (bitset(EF_VRFYONLY, e->e_flags)) @@ -425,7 +472,7 @@ udbexpand(a, sendq, aliaslevel, e) sm_syslog(LOG_INFO, e->e_id, "hesiod %.100s => %s", e->e_to, - shortenstring(user, 203)); + shortenstring(user, MAXSHORTSTR)); naddrs = sendtolist(user, a, sendq, aliaslevel + 1, e); if (naddrs > 0 && !bitset(QSELFREF, a->q_flags)) @@ -519,7 +566,7 @@ char * udbsender(sender) char *sender; { - extern char *udbmatch(); + extern char *udbmatch __P((char *, char *)); return udbmatch(sender, "mailname"); } @@ -581,9 +628,16 @@ udbmatch(user, field) { #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)) @@ -598,7 +652,6 @@ udbmatch(user, field) if (tTd(28, 1)) printf("udbmatch ==> %s\n", p); return p; - break; #endif #ifdef HESIOD @@ -647,9 +700,18 @@ udbmatch(user, field) /* 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); - i = (*up->udb_dbp->get)(up->udb_dbp, &key, &info, 0); +#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 */ @@ -666,9 +728,16 @@ udbmatch(user, field) 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 */ @@ -683,7 +752,6 @@ udbmatch(user, field) if (tTd(28, 1)) printf("udbmatch ==> %s\n", p); return p; - break; #endif #ifdef HESIOD @@ -750,6 +818,7 @@ udbmatch(user, field) ** The rewritten name otherwise. */ +/* ARGSUSED3 */ char * udb_map_lookup(map, name, av, statp) MAP *map; @@ -809,6 +878,7 @@ int _udbx_init(e) ENVELOPE *e; { + int ents = 0; register char *p; register struct udbent *up; @@ -825,7 +895,6 @@ _udbx_init(e) while (p != NULL) { char *spec; - int nopts; int l; # if 0 auto int rcode; @@ -834,8 +903,8 @@ _udbx_init(e) register struct hostent *h; char *mxhosts[MAXMXHOSTS + 1]; # endif - struct option opts[MAXUDBOPTS + 1]; - extern int _udb_parsespec __P((char *, struct option [], int)); + struct udb_option opts[MAXUDBOPTS + 1]; + extern int _udb_parsespec __P((char *, struct udb_option [], int)); while (*p == ' ' || *p == '\t' || *p == ',') p++; @@ -846,8 +915,14 @@ _udbx_init(e) if (p != NULL) *p++ = '\0'; + if (ents >= MAXUDBENT) + { + syserr("Maximum number of UDB entries exceeded"); + break; + } + /* extract options */ - nopts = _udb_parsespec(spec, opts, MAXUDBOPTS); + (void) _udb_parsespec(spec, opts, MAXUDBOPTS); /* ** Decode database specification. @@ -908,12 +983,14 @@ _udbx_init(e) 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++; } @@ -928,7 +1005,9 @@ _udbx_init(e) case '@': /* forward to remote host */ up->udb_type = UDB_FORWARD; + up->udb_pid = getpid(); up->udb_fwdhost = spec + 1; + ents++; up++; break; @@ -938,6 +1017,8 @@ _udbx_init(e) if (strcasecmp(spec, "hesiod") != 0) goto badspec; up->udb_type = UDB_HESIOD; + up->udb_pid = getpid(); + ents++; up++; break; #endif /* HESIOD */ @@ -956,15 +1037,25 @@ _udbx_init(e) 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; @@ -973,7 +1064,11 @@ _udbx_init(e) { 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; @@ -985,7 +1080,18 @@ _udbx_init(e) 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 @@ -1051,7 +1157,16 @@ badspec: { 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 @@ -1061,7 +1176,7 @@ badspec: int _udb_parsespec(udbspec, opt, maxopts) char *udbspec; - struct option opt[]; + struct udb_option opt[]; int maxopts; { register char *spec; @@ -1087,6 +1202,48 @@ _udb_parsespec(udbspec, opt, maxopts) } return optnum; } +/* +** _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 @@ -1096,7 +1253,7 @@ hes_udb_get(key, info) DBT *info; { char *name, *type; - char *p, **hp; + char **hp; char kbuf[MAXKEY + 1]; if (strlen(key->data) >= (SIZE_T) sizeof kbuf) @@ -1114,8 +1271,25 @@ hes_udb_get(key, info) 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 */ @@ -1124,6 +1298,7 @@ hes_udb_get(key, info) return 1; } +#endif /* HESIOD_INIT */ else { /* diff --git a/src/useful.h b/src/useful.h index 59182fe..a19dd9e 100644 --- a/src/useful.h +++ b/src/useful.h @@ -1,37 +1,15 @@ /* - * Copyright (c) 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. * - * @(#)useful.h 8.7 (Berkeley) 5/29/97 + * @(#)useful.h 8.12 (Berkeley) 5/19/1998 */ # include <sys/types.h> diff --git a/src/usersmtp.c b/src/usersmtp.c index b088d60..c82942b 100644 --- a/src/usersmtp.c +++ b/src/usersmtp.c @@ -1,44 +1,22 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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 "sendmail.h" #ifndef lint #if SMTP -static char sccsid[] = "@(#)usersmtp.c 8.88 (Berkeley) 10/20/97 (with SMTP)"; +static char sccsid[] = "@(#)usersmtp.c 8.111 (Berkeley) 2/3/1999 (with SMTP)"; #else -static char sccsid[] = "@(#)usersmtp.c 8.88 (Berkeley) 10/20/97 (without SMTP)"; +static char sccsid[] = "@(#)usersmtp.c 8.111 (Berkeley) 2/3/1999 (without SMTP)"; #endif #endif /* not lint */ @@ -89,8 +67,8 @@ smtpinit(m, mci, e) { register int r; register char *p; - extern void esmtp_check(); - extern void helo_options(); + extern void esmtp_check __P((char *, bool, MAILER *, MCI *, ENVELOPE *)); + extern void helo_options __P((char *, bool, MAILER *, MCI *, ENVELOPE *)); if (tTd(18, 1)) { @@ -140,7 +118,7 @@ smtpinit(m, mci, e) */ SmtpPhase = mci->mci_phase = "client greeting"; - setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase); + 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; @@ -154,24 +132,16 @@ smtpinit(m, mci, e) ** My mother taught me to always introduce myself. */ -#if _FFR_LMTP if (bitnset(M_ESMTP, m->m_flags) || bitnset(M_LMTP, m->m_flags)) -#else - if (bitnset(M_ESMTP, m->m_flags)) -#endif mci->mci_flags |= MCIF_ESMTP; tryhelo: -#if _FFR_LMTP 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)) -#else - if (bitset(MCIF_ESMTP, mci->mci_flags)) -#endif { smtpmessage("EHLO %s", m, mci, MyHostName); SmtpPhase = mci->mci_phase = "client EHLO"; @@ -181,18 +151,14 @@ tryhelo: smtpmessage("HELO %s", m, mci, MyHostName); SmtpPhase = mci->mci_phase = "client HELO"; } - setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase); + 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 _FFR_LMTP if (bitset(MCIF_ESMTP, mci->mci_flags) && !bitnset(M_LMTP, m->m_flags)) -#else - if (bitset(MCIF_ESMTP, mci->mci_flags)) -#endif { /* try old SMTP instead */ mci->mci_flags &= ~MCIF_ESMTP; @@ -213,13 +179,11 @@ tryhelo: if (p != NULL) *p = '\0'; if (!bitnset(M_NOLOOPCHECK, m->m_flags) && -#if _FFR_LMTP !bitnset(M_LMTP, m->m_flags) && -#endif strcasecmp(&SmtpReplyBuffer[4], MyHostName) == 0) { syserr("553 %s config error: mail loops back to me (MX problem?)", - mci->mci_host); + CurHostName); mci_setstat(mci, EX_CONFIG, NULL, NULL); mci->mci_errno = 0; smtpquit(m, mci, e); @@ -363,7 +327,6 @@ smtpmailfrom(m, mci, e) ENVELOPE *e; { int r; - int l; char *bufp; char *bodytype; char buf[MAXNAME + 1]; @@ -373,11 +336,12 @@ smtpmailfrom(m, mci, e) 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, ""); - l = sizeof optbuf - strlen(optbuf) - 1; + bufp = &optbuf[strlen(optbuf)]; bodytype = e->e_bodytype; if (bitset(MCIF_8BITMIME, mci->mci_flags)) @@ -388,11 +352,12 @@ smtpmailfrom(m, mci, e) !bitset(EF_DONT_MIME, e->e_flags) && !bitnset(M_8BITS, m->m_flags)) bodytype = "8BITMIME"; - if (bodytype != NULL && strlen(bodytype) + 7 < l) + if (bodytype != NULL && + SPACELEFT(optbuf, bufp) > strlen(bodytype) + 7) { - strcat(optbuf, " BODY="); - strcat(optbuf, bodytype); - l -= strlen(optbuf); + snprintf(bufp, SPACELEFT(optbuf, bufp), + " BODY=%s", bodytype); + bufp += strlen(bufp); } } else if (bitnset(M_8BITS, m->m_flags) || @@ -416,29 +381,30 @@ smtpmailfrom(m, mci, e) /* cannot just send a 8-bit version */ extern char MsgBuf[]; - usrerr("%s does not support 8BITMIME", mci->mci_host); + 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 && strlen(e->e_envid) < (SIZE_T) (l - 7)) + if (e->e_envid != NULL && + SPACELEFT(optbuf, bufp) > strlen(e->e_envid) + 7) { - strcat(optbuf, " ENVID="); - strcat(optbuf, e->e_envid); - l -= strlen(optbuf); + snprintf(bufp, SPACELEFT(optbuf, bufp), + " ENVID=%s", e->e_envid); + bufp += strlen(bufp); } /* RET= parameter */ - if (bitset(EF_RET_PARAM, e->e_flags) && l >= 9) + if (bitset(EF_RET_PARAM, e->e_flags) && + SPACELEFT(optbuf, bufp) > 9) { - strcat(optbuf, " RET="); - if (bitset(EF_NO_BODY_RETN, e->e_flags)) - strcat(optbuf, "HDRS"); - else - strcat(optbuf, "FULL"); - l -= 9; + snprintf(bufp, SPACELEFT(optbuf, bufp), + " RET=%s", + bitset(EF_NO_BODY_RETN, e->e_flags) ? + "HDRS" : "FULL"); + bufp += strlen(bufp); } } @@ -475,7 +441,7 @@ smtpmailfrom(m, mci, e) *bufp == '@' ? ',' : ':', bufp, optbuf); } SmtpPhase = mci->mci_phase = "client MAIL"; - setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase); + 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) { @@ -492,15 +458,9 @@ smtpmailfrom(m, mci, e) smtpquit(m, mci, e); return EX_TEMPFAIL; } - else if (r == 452 && bitset(MCIF_SIZE, mci->mci_flags) && - e->e_msgsize > 0) - { - mci_setstat(mci, EX_NOTSTICKY, smtptodsn(r), SmtpReplyBuffer); - return EX_TEMPFAIL; - } else if (REPLYTYPE(r) == 4) { - mci_setstat(mci, EX_TEMPFAIL, smtptodsn(r), SmtpReplyBuffer); + mci_setstat(mci, EX_NOTSTICKY, smtptodsn(r), SmtpReplyBuffer); return EX_TEMPFAIL; } else if (REPLYTYPE(r) == 2) @@ -522,7 +482,7 @@ smtpmailfrom(m, mci, e) else if (r == 552) { /* exceeded storage allocation */ - mci_setstat(mci, EX_NOTSTICKY, "5.2.2", SmtpReplyBuffer); + 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; @@ -538,7 +498,7 @@ smtpmailfrom(m, mci, e) { sm_syslog(LOG_CRIT, e->e_id, "%.100s: SMTP MAIL protocol error: %s", - mci->mci_host, + CurHostName, shortenstring(SmtpReplyBuffer, 403)); } @@ -571,11 +531,11 @@ smtprcpt(to, m, mci, e) ENVELOPE *e; { register int r; - int l; + char *bufp; char optbuf[MAXLINE]; strcpy(optbuf, ""); - l = sizeof optbuf - 1; + bufp = &optbuf[strlen(optbuf)]; if (bitset(MCIF_DSN, mci->mci_flags)) { /* NOTIFY= parameter */ @@ -585,44 +545,45 @@ smtprcpt(to, m, mci, e) { bool firstone = TRUE; - strcat(optbuf, " NOTIFY="); + strcat(bufp, " NOTIFY="); if (bitset(QPINGONSUCCESS, to->q_flags)) { - strcat(optbuf, "SUCCESS"); + strcat(bufp, "SUCCESS"); firstone = FALSE; } if (bitset(QPINGONFAILURE, to->q_flags)) { if (!firstone) - strcat(optbuf, ","); - strcat(optbuf, "FAILURE"); + strcat(bufp, ","); + strcat(bufp, "FAILURE"); firstone = FALSE; } if (bitset(QPINGONDELAY, to->q_flags)) { if (!firstone) - strcat(optbuf, ","); - strcat(optbuf, "DELAY"); + strcat(bufp, ","); + strcat(bufp, "DELAY"); firstone = FALSE; } if (firstone) - strcat(optbuf, "NEVER"); - l -= strlen(optbuf); + strcat(bufp, "NEVER"); + bufp += strlen(bufp); } /* ORCPT= parameter */ - if (to->q_orcpt != NULL && strlen(to->q_orcpt) + 7 < l) + if (to->q_orcpt != NULL && + SPACELEFT(optbuf, bufp) > strlen(to->q_orcpt) + 7) { - strcat(optbuf, " ORCPT="); - strcat(optbuf, to->q_orcpt); - l -= strlen(optbuf); + 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"; - setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase); + 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); @@ -655,7 +616,7 @@ smtprcpt(to, m, mci, e) { sm_syslog(LOG_CRIT, e->e_id, "%.100s: SMTP RCPT protocol error: %s", - mci->mci_host, + CurHostName, shortenstring(SmtpReplyBuffer, 403)); } @@ -678,7 +639,7 @@ smtprcpt(to, m, mci, e) */ static jmp_buf CtxDataTimeout; -static void datatimeout(); +static void datatimeout __P((void)); int smtpdata(m, mci, e) @@ -703,7 +664,7 @@ smtpdata(m, mci, e) /* send the command and check ok to proceed */ smtpmessage("DATA", m, mci); SmtpPhase = mci->mci_phase = "client DATA 354"; - setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase); + 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) { @@ -715,13 +676,13 @@ smtpdata(m, mci, e) smtprset(m, mci, e); return EX_UNAVAILABLE; } - else if (r != 354) + else if (REPLYTYPE(r) != 3) { if (LogLevel > 1) { sm_syslog(LOG_CRIT, e->e_id, "%.100s: SMTP DATA-1 protocol error: %s", - mci->mci_host, + CurHostName, shortenstring(SmtpReplyBuffer, 403)); } smtprset(m, mci, e); @@ -740,7 +701,7 @@ smtpdata(m, mci, e) 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", mci->mci_host); + syserr("451 timeout writing message to %s", CurHostName); smtpquit(m, mci, e); return EX_TEMPFAIL; } @@ -755,7 +716,7 @@ smtpdata(m, mci, e) ** Output the actual message. */ - (*e->e_puthdr)(mci, e->e_header, e); + (*e->e_puthdr)(mci, e->e_header, e, M87F_OUTER); (*e->e_putbody)(mci, e, NULL); /* @@ -783,11 +744,9 @@ smtpdata(m, mci, e) /* check for the results of the transaction */ SmtpPhase = mci->mci_phase = "client DATA status"; - setproctitle("%s %s: %s", e->e_id, CurHostName, mci->mci_phase); -#if _FFR_LMTP + sm_setproctitle(TRUE, "%s %s: %s", e->e_id, CurHostName, mci->mci_phase); if (bitnset(M_LMTP, m->m_flags)) return EX_OK; -#endif r = reply(m, mci, e, TimeOuts.to_datafinal, NULL); if (r < 0) { @@ -818,7 +777,7 @@ smtpdata(m, mci, e) { sm_syslog(LOG_CRIT, e->e_id, "%.100s: SMTP DATA-2 protocol error: %s", - mci->mci_host, + CurHostName, shortenstring(SmtpReplyBuffer, 403)); } return rstat; @@ -842,8 +801,6 @@ datatimeout() ** The exit status corresponding to the reply code. */ -#if _FFR_LMTP - int smtpgetstat(m, mci, e) MAILER *m; @@ -871,18 +828,18 @@ smtpgetstat(m, mci, e) 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", - mci->mci_host, + CurHostName, shortenstring(SmtpReplyBuffer, 403)); } return stat; } - -#endif /* ** SMTPQUIT -- close the SMTP connection. ** @@ -1020,7 +977,6 @@ reply(m, mci, e, timeout, pfunc) for (;;) { register char *p; - extern time_t curtime(); /* actually do the read */ if (e->e_xfp != NULL) @@ -1053,8 +1009,11 @@ reply(m, mci, e, timeout, pfunc) mci->mci_errno = errno; oldholderrs = HoldErrs; HoldErrs = TRUE; - usrerr("451 reply: read error from %s", mci->mci_host); - mci_setstat(mci, EX_TEMPFAIL, "4.4.2", MsgBuf); + 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)) @@ -1072,13 +1031,14 @@ reply(m, mci, e, timeout, pfunc) int plen; snprintf(p, wbufleft, "%s... ", - shortenstring(e->e_to, 203)); + shortenstring(e->e_to, MAXSHORTSTR)); plen = strlen(p); p += plen; wbufleft -= plen; } snprintf(p, wbufleft, "reply(%.100s) during %s", - mci->mci_host, SmtpPhase); + CurHostName == NULL ? "NO_HOST" : CurHostName, + SmtpPhase); checkfd012(wbuf); } #endif @@ -1116,7 +1076,7 @@ reply(m, mci, e, timeout, pfunc) 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] == ' ' || bufp[3] == '-' || bufp[3] == '\0')) continue; /* process the line */ @@ -1146,7 +1106,8 @@ reply(m, mci, e, timeout, pfunc) */ /* save temporary failure messages for posterity */ - if (SmtpReplyBuffer[0] == '4' && SmtpError[0] == '\0') + 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" */ @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983, 1995-1997 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)util.c 8.137 (Berkeley) 10/22/97"; +static char sccsid[] = "@(#)util.c 8.168 (Berkeley) 1/21/1999"; #endif /* not lint */ # include "sendmail.h" @@ -80,6 +58,298 @@ stripquotes(s) } while (c != '\0'); } /* +** 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; +} +/* +** 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; +} +/* +** 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; +} +/* +** 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; +} +/* ** XALLOC -- Allocate memory and bitch wildly on failure. ** ** THIS IS A CLUDGE. This should be made to give a proper @@ -286,10 +556,14 @@ xputs(s) c = *s++ & 0377; goto printchar; } - if (c == MACROEXPAND) + 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)) @@ -538,6 +812,7 @@ putxline(l, len, mci, 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) || @@ -572,6 +847,8 @@ putxline(l, len, mci, pxflags) 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); } @@ -581,14 +858,26 @@ putxline(l, len, mci, pxflags) 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++) @@ -604,6 +893,8 @@ putxline(l, len, mci, pxflags) 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); } @@ -613,6 +904,8 @@ putxline(l, len, mci, pxflags) 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); } @@ -621,16 +914,22 @@ putxline(l, len, mci, pxflags) 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); } @@ -715,7 +1014,7 @@ xfclose(fp, a, b) */ static jmp_buf CtxReadTimeout; -static void readtimeout(); +static void readtimeout __P((time_t)); char * sfgets(buf, siz, fp, timeout, during) @@ -727,6 +1026,7 @@ sfgets(buf, siz, fp, timeout, during) { register EVENT *ev = NULL; register char *p; + int save_errno; if (fp == NULL) { @@ -744,7 +1044,6 @@ sfgets(buf, siz, fp, timeout, during) "timeout waiting for input from %.100s during %s", CurHostName ? CurHostName : "local", during); - errno = 0; buf[0] = '\0'; #if XDEBUG checkfd012(during); @@ -752,6 +1051,7 @@ sfgets(buf, siz, fp, timeout, during) if (TrafficLogFile != NULL) fprintf(TrafficLogFile, "%05d <<< [TIMEOUT]\n", (int) getpid()); + errno = 0; return (NULL); } ev = setevent(timeout, readtimeout, 0); @@ -759,6 +1059,7 @@ sfgets(buf, siz, fp, timeout, during) /* try to read */ p = NULL; + errno = 0; while (!feof(fp) && !ferror(fp)) { errno = 0; @@ -767,6 +1068,7 @@ sfgets(buf, siz, fp, timeout, during) break; clearerr(fp); } + save_errno = errno; /* clear the event if it has not sprung */ clrevent(ev); @@ -778,6 +1080,7 @@ sfgets(buf, siz, fp, timeout, during) buf[0] = '\0'; if (TrafficLogFile != NULL) fprintf(TrafficLogFile, "%05d <<< [EOF]\n", (int) getpid()); + errno = save_errno; return (NULL); } if (TrafficLogFile != NULL) @@ -801,6 +1104,7 @@ sfgets(buf, siz, fp, timeout, during) return (buf); } +/* ARGSUSED */ static void readtimeout(timeout) time_t timeout; @@ -1192,20 +1496,29 @@ dumpfd(fd, printclosed, logit) { register char *p; char *hp; - char *fmtstr; #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 (fstat(fd, &st) < 0) + if ( +#if STAT64 > 0 + fstat64(fd, &st) +#else + fstat(fd, &st) +#endif + < 0) { if (errno != EBADF) { @@ -1299,13 +1612,24 @@ dumpfd(fd, printclosed, logit) 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)) - fmtstr = "dev=%d/%d, ino=%d, nlink=%d, u/gid=%d/%d, size=%qd"; + snprintf(p, SPACELEFT(buf, p), "size=%s", + quad_to_string(st.st_size)); else - fmtstr = "dev=%d/%d, ino=%d, nlink=%d, u/gid=%d/%d, size=%ld"; - snprintf(p, SPACELEFT(buf, p), fmtstr, - major(st.st_dev), minor(st.st_dev), st.st_ino, - st.st_nlink, st.st_uid, st.st_gid, st.st_size); + snprintf(p, SPACELEFT(buf, p), "size=%lu", + (unsigned long) st.st_size); break; } @@ -1317,55 +1641,6 @@ printit: printf("%s\n", buf); } /* -** 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. -*/ - -#ifndef MAXSHORTSTR -# define MAXSHORTSTR 203 -#endif - -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; -} -/* ** SHORTEN_HOSTNAME -- strip local domain information off of hostname. ** ** Parameters: @@ -1481,9 +1756,9 @@ prog_open(argv, pfd, e) /* run as default user */ endpwent(); - if (setgid(DefGid) < 0) + if (setgid(DefGid) < 0 && geteuid() == 0) syserr("prog_open: setgid(%ld) failed", (long) DefGid); - if (setuid(DefUid) < 0) + if (setuid(DefUid) < 0 && geteuid() == 0) syserr("prog_open: setuid(%ld) failed", (long) DefUid); /* run in some directory */ @@ -1686,7 +1961,7 @@ denlstring(s, strict, logattacks) sm_syslog(LOG_NOTICE, CurEnv->e_id, "POSSIBLE ATTACK from %.100s: newline in string \"%s\"", RealHostName == NULL ? "[UNKNOWN]" : RealHostName, - shortenstring(bp, 203)); + shortenstring(bp, MAXSHORTSTR)); } return bp; @@ -1751,7 +2026,13 @@ path_is_dir(pathname, createflag) ** none */ -static pid_t *ProcListVec = NULL; +struct procs +{ + pid_t proc_pid; + char *proc_task; +}; + +static struct procs *ProcListVec = NULL; static int ProcListSize = 0; #define NO_PID ((pid_t) 0) @@ -1760,15 +2041,15 @@ static int ProcListSize = 0; #endif void -proc_list_add(pid) +proc_list_add(pid, task) pid_t pid; + char *task; { int i; - extern void proc_list_probe __P((void)); for (i = 0; i < ProcListSize; i++) { - if (ProcListVec[i] == NO_PID) + if (ProcListVec[i].proc_pid == NO_PID) break; } if (i >= ProcListSize) @@ -1779,29 +2060,66 @@ proc_list_add(pid) /* now scan again */ for (i = 0; i < ProcListSize; i++) { - if (ProcListVec[i] == NO_PID) + if (ProcListVec[i].proc_pid == NO_PID) break; } } if (i >= ProcListSize) { /* grow process list */ - pid_t *npv; + struct procs *npv; - npv = (pid_t *) xalloc(sizeof (pid_t) * (ProcListSize + PROC_LIST_SEG)); + npv = (struct procs *) xalloc(sizeof (struct procs) * (ProcListSize + PROC_LIST_SEG)); if (ProcListSize > 0) { - bcopy(ProcListVec, npv, ProcListSize * sizeof (pid_t)); + bcopy(ProcListVec, npv, ProcListSize * + sizeof (struct procs)); free(ProcListVec); } for (i = ProcListSize; i < ProcListSize + PROC_LIST_SEG; i++) - npv[i] = NO_PID; + { + npv[i].proc_pid = NO_PID; + npv[i].proc_task = NULL; + } i = ProcListSize; ProcListSize += PROC_LIST_SEG; ProcListVec = npv; } - ProcListVec[i] = pid; - CurChildren++; + ProcListVec[i].proc_pid = pid; + ProcListVec[i].proc_task = newstr(task); + + /* if process adding itself, it's not a child */ + if (pid != getpid()) + CurChildren++; +} +/* +** 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; + } + } } /* ** PROC_LIST_DROP -- drop pid from process list @@ -1821,9 +2139,14 @@ proc_list_drop(pid) for (i = 0; i < ProcListSize; i++) { - if (ProcListVec[i] == pid) + if (ProcListVec[i].proc_pid == pid) { - ProcListVec[i] = NO_PID; + ProcListVec[i].proc_pid = NO_PID; + if (ProcListVec[i].proc_task != NULL) + { + free(ProcListVec[i].proc_task); + ProcListVec[i].proc_task = NULL; + } break; } } @@ -1845,8 +2168,16 @@ proc_list_clear() { int i; - for (i = 0; i < ProcListSize; i++) - ProcListVec[i] = NO_PID; + /* 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; } /* @@ -1864,17 +2195,23 @@ proc_list_probe() { int i; - for (i = 0; i < ProcListSize; i++) + /* start from 1 since 0 is the daemon itself */ + for (i = 1; i < ProcListSize; i++) { - if (ProcListVec[i] == NO_PID) + if (ProcListVec[i].proc_pid == NO_PID) continue; - if (kill(ProcListVec[i], 0) < 0) + if (kill(ProcListVec[i].proc_pid, 0) < 0) { if (LogLevel > 3) sm_syslog(LOG_DEBUG, CurEnv->e_id, "proc_list_probe: lost pid %d", - ProcListVec[i]); - ProcListVec[i] = NO_PID; + (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--; } } @@ -1882,6 +2219,35 @@ proc_list_probe() CurChildren = 0; } /* +** 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" : ""); + } +} +/* ** SM_STRCASECMP -- 8-bit clean version of strcasecmp ** ** Thank you, vendors, for making this all necessary. diff --git a/src/version.c b/src/version.c index dc041ba..6f9d05e 100644 --- a/src/version.c +++ b/src/version.c @@ -1,39 +1,17 @@ /* - * Copyright (c) 1983 Eric P. Allman + * 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. * - * 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. + * 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 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. */ #ifndef lint -static char sccsid[] = "@(#)version.c 8.8.8.1 (Berkeley) 10/24/97"; +static char sccsid[] = "@(#)version.c 8.9.3.1 (Berkeley) 2/4/1999"; #endif /* not lint */ -char Version[] = "8.8.8"; +char Version[] = "8.9.3"; |