Sendmail source for the 3B1/7300 (part 1/8)
David H. Brierley
dave at galaxia.Newport.RI.US
Sat Feb 25 12:24:52 AEST 1989
Here is the source for the sendmail program. See the related article
in unix-pc.general for background information.
----- cut here and feed to /bin/sh -----
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of archive 1 (of 8)."
# Contents: MANIFEST Makefile README READ_ME include
# include/sysexits.h include/useful.h include/userdbm.h lib
# lib/Makefile lib/aliases lib/sendmail.hf md md/c.nvmunix.m4
# md/c.v6.m4 md/c.v7.m4 md/c.vmunix.m4 md/config.dst md/config.m4
# md/config.m4.mone src src/Makefile src/README src/Version.c
# src/arpadate.c src/bcopy.c src/clock.c src/conf.h src/convtime.c
# src/mailstats.h src/rename.c src/stab.c src/stats.c src/sysexits.c
# src/trace.c src/trace.h src/version.c
# Wrapped by dave at galaxia on Fri Feb 24 20:23:32 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'MANIFEST' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(1881 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
X File Name Archive # Description
X-----------------------------------------------------------
X MANIFEST 1 This shipping list
X Makefile 1
X README 1
X READ_ME 1
X include 1
X include/sysexits.h 1
X include/useful.h 1
X include/userdbm.h 1
X lib 1
X lib/Makefile 1
X lib/aliases 1
X lib/sendmail.hf 1
X md 1
X md/c.nvmunix.m4 1
X md/c.v6.m4 1
X md/c.v7.m4 1
X md/c.vmunix.m4 1
X md/config.dst 1
X md/config.m4 1
X md/config.m4.mone 1
X src 1
X src/Makefile 1
X src/README 1
X src/Version.c 1
X src/alias.c 2
X src/arpadate.c 1
X src/bcopy.c 1
X src/clock.c 1
X src/collect.c 2
X src/conf.c 3
X src/conf.h 1
X src/convtime.c 1
X src/daemon.c 4
X src/deliver.c 8
X src/domain.c 2
X src/envelope.c 3
X src/err.c 2
X src/headers.c 5
X src/macro.c 2
X src/mailstats.h 1
X src/main.c 7
X src/parseaddr.c 7
X src/queue.c 6
X src/readcf.c 5
X src/recipient.c 3
X src/rename.c 1
X src/savemail.c 3
X src/sendmail.h 6
X src/srvrsmtp.c 4
X src/stab.c 1
X src/stats.c 1
X src/sysexits.c 1
X src/trace.c 1
X src/trace.h 1
X src/usersmtp.c 2
X src/util.c 4
X src/version.c 1
END_OF_FILE
if test 1881 -ne `wc -c <'MANIFEST'`; then
echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Makefile'\"
else
echo shar: Extracting \"'Makefile'\" \(964 characters\)
sed "s/^X//" >'Makefile' <<'END_OF_FILE'
X#
X# Copyright (c) 1988 Regents of the University of California.
X# All rights reserved.
X#
X# Redistribution and use in source and binary forms are permitted
X# provided that this notice is preserved and that due credit is given
X# to the University of California at Berkeley. The name of the University
X# may not be used to endorse or promote products derived from this
X# software without specific prior written permission. This software
X# is provided ``as is'' without express or implied warranty.
X#
X# @(#)Makefile 4.13 (Berkeley) 5/1/88
X#
XSUBDIR= lib src aux
X
Xall: ${SUBDIR}
X
X${SUBDIR}: FRC
X cd $@; make ${MFLAGS}
X
Xclean: FRC
X for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} clean); done
X
Xdepend: FRC
X for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} depend); done
X
Xinstall: FRC
X -mkdir ${DESTDIR}/usr/spool/mqueue
X chown root.wheel ${DESTDIR}/usr/spool/mqueue
X chmod 775 ${DESTDIR}/usr/spool/mqueue
X for i in ${SUBDIR}; do (cd $$i; make ${MFLAGS} install); done
X
XFRC:
END_OF_FILE
if test 964 -ne `wc -c <'Makefile'`; then
echo shar: \"'Makefile'\" unpacked with wrong size!
fi
# end of 'Makefile'
fi
if test -f 'README' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(968 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XThis is the sendmail 5.58 distribution for System V Release 3.1.
XIt may run on earlier releases of System V. (I haven't tried it).
XOnly the src and include directories are included. The other
Xdirectories should be available in the normal Berkeley sendmail
Xdistribution.
X
XAs configured, this software has the following software requirements:
X
X WIN/3B TCP/IP (or equivalent Berkeley networking emulation)
X dbm library
X
XI wish I could distribute the dbm library (it is not part of System V),
Xbut it came originally from AT&T and thus contains AT&T licensed code.
XThings may work without the dbm library (undefine DBM and NDBM in src/conf.h),
Xbut I have not tried it.
X
XOther configurations may work, but the networking configuration is
Xthe only one I have tried.
X
XThere may be minor changes to include files needed to make all of this work.
XI can't quite remember exactly what I changed.
X
XThis software is unsupported.
X
XAllyn Fratkin
XU.C. San Diego
Xallyn at cs.ucsd.edu
END_OF_FILE
if test 968 -ne `wc -c <'README'`; then
echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'READ_ME' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'READ_ME'\"
else
echo shar: Extracting \"'READ_ME'\" \(2609 characters\)
sed "s/^X//" >'READ_ME' <<'END_OF_FILE'
X
X S E N D M A I L
X
XPresumably by the time you get to this READ_ME file, you will have
Xalready read the tape in, or will have received this distribution as
Xpart of 4.2bsd. If you do not yet have the distribution online, read
Xthe tape in now -- you will need about one megabyte to hold the tape.
X
XThe first thing you should look at is the documentation. The two
Xcritical documents are "doc/intro.me" and "doc/op.me". Read both
Xof these before proceeding with your installation. If you have read
Xthese before, you should still read through the second one again
Xanyhow, since the installation procedures change occasionally.
X
XA brief tour:
X FILES A list of the files on the tape.
X Makefile A Makefile that will do a vanilla install for you.
X adb A set of adb(1) scripts for printing out certain
X sendmail data structures.
X adm Administrativia.
X aux Files that represent programs that are not really
X "part" of sendmail, or old versions of some files
X in src for use by people on other system types.
X cf The configuration files for Berkeley, plus a few
X prototype configurations for basic installation
X types.
X doc The documentation.
X include The include files used by more than just the sendmail
X program itself.
X lib Library routines used by sendmail, but not really
X "part" of sendmail itself; these might be candidates
X for libc.a.
X md Some m4 files used to isolate machine dependencies.
X src The source for the sendmail program itself.
X test Some files used for testing -- mostly these are
X shell files intended as the targets for aliasing.
X
XThe following are the known major problems and their Problem Report
Xnumber:
X
X012, 043 Names of files and programs cannot have upper case letters
X in them -- these get mapped to lower case due to the
X case mapping feature.
X178 Because of the different syntaxes used in envelopes versus
X headers, we will occasionally allow syntactically incorrect
X headers go out.
X226 Quote interpretation may be incorrect -- this is not well
X defined in the protocols.
X
XDue to my present circumstances, I am unable to provide a formal
Xlevel of support for this system. However, I will make whatever
Xattempt I can to answer a reasonable number of questions. Since
Xthe company I am working for is not working in this area, and has
Xindulged me tremendously in letting me work on this at all, I regret
Xthat I am unable to accept phone calls. I can be contacted as:
X
X OLD NEW
X Arpanet: eric at Berkeley eric at Berkeley.ARPA
X UUCP: ucbvax!eric eric at ucbvax.UUCP
X
XEric Allman
XBritton-Lee, Inc.
X
X@(#)READ_ME 4.1 7/25/83
END_OF_FILE
if test 2609 -ne `wc -c <'READ_ME'`; then
echo shar: \"'READ_ME'\" unpacked with wrong size!
fi
# end of 'READ_ME'
fi
if test ! -d 'include' ; then
echo shar: Creating directory \"'include'\"
mkdir 'include'
fi
if test -f 'include/sysexits.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/sysexits.h'\"
else
echo shar: Extracting \"'include/sysexits.h'\" \(3656 characters\)
sed "s/^X//" >'include/sysexits.h' <<'END_OF_FILE'
X/*
X** SYSEXITS.H -- Exit status codes for system programs.
X**
X** This include file attempts to categorize possible error
X** exit statuses for system programs, notably delivermail
X** and the Berkeley network.
X**
X** Error numbers begin at EX__BASE to reduce the possibility of
X** clashing with other exit statuses that random programs may
X** already return. The meaning of the codes is approximately
X** as follows:
X**
X** EX_USAGE -- The command was used incorrectly, e.g., with
X** the wrong number of arguments, a bad flag, a bad
X** syntax in a parameter, or whatever.
X** EX_DATAERR -- The input data was incorrect in some way.
X** This should only be used for user's data & not
X** system files.
X** EX_NOINPUT -- An input file (not a system file) did not
X** exist or was not readable. This could also include
X** errors like "No message" to a mailer (if it cared
X** to catch it).
X** EX_NOUSER -- The user specified did not exist. This might
X** be used for mail addresses or remote logins.
X** EX_NOHOST -- The host specified did not exist. This is used
X** in mail addresses or network requests.
X** EX_UNAVAILABLE -- A service is unavailable. This can occur
X** if a support program or file does not exist. This
X** can also be used as a catchall message when something
X** you wanted to do doesn't work, but you don't know
X** why.
X** EX_SOFTWARE -- An internal software error has been detected.
X** This should be limited to non-operating system related
X** errors as possible.
X** EX_OSERR -- An operating system error has been detected.
X** This is intended to be used for such things as "cannot
X** fork", "cannot create pipe", or the like. It includes
X** things like getuid returning a user that does not
X** exist in the passwd file.
X** EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
X** etc.) does not exist, cannot be opened, or has some
X** sort of error (e.g., syntax error).
X** EX_CANTCREAT -- A (user specified) output file cannot be
X** created.
X** EX_IOERR -- An error occurred while doing I/O on some file.
X** EX_TEMPFAIL -- temporary failure, indicating something that
X** is not really an error. In sendmail, this means
X** that a mailer (e.g.) could not create a connection,
X** and the request should be reattempted later.
X** EX_PROTOCOL -- the remote system returned something that
X** was "not possible" during a protocol exchange.
X** EX_NOPERM -- You did not have sufficient permission to
X** perform the operation. This is not intended for
X** file system problems, which should use NOINPUT or
X** CANTCREAT, but rather for higher level permissions.
X** For example, kre uses this to restrict who students
X** can send mail to.
X**
X** Maintained by Eric Allman (eric at berkeley, ucbvax!eric) --
X** please mail changes to me.
X**
X** @(#)sysexits.h 4.2 7/31/83
X*/
X
X# define EX_OK 0 /* successful termination */
X
X# define EX__BASE 64 /* base value for error messages */
X
X# define EX_USAGE 64 /* command line usage error */
X# define EX_DATAERR 65 /* data format error */
X# define EX_NOINPUT 66 /* cannot open input */
X# define EX_NOUSER 67 /* addressee unknown */
X# define EX_NOHOST 68 /* host name unknown */
X# define EX_UNAVAILABLE 69 /* service unavailable */
X# define EX_SOFTWARE 70 /* internal software error */
X# define EX_OSERR 71 /* system error (e.g., can't fork) */
X# define EX_OSFILE 72 /* critical OS file missing */
X# define EX_CANTCREAT 73 /* can't create (user) output file */
X# define EX_IOERR 74 /* input/output error */
X# define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
X# define EX_PROTOCOL 76 /* remote error in protocol */
X# define EX_NOPERM 77 /* permission denied */
END_OF_FILE
if test 3656 -ne `wc -c <'include/sysexits.h'`; then
echo shar: \"'include/sysexits.h'\" unpacked with wrong size!
fi
# end of 'include/sysexits.h'
fi
if test -f 'include/useful.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/useful.h'\"
else
echo shar: Extracting \"'include/useful.h'\" \(1548 characters\)
sed "s/^X//" >'include/useful.h' <<'END_OF_FILE'
X/*
X** USEFUL.H -- Some useful stuff.
X**
X** @(#)useful.h 4.2 10/22/87
X*/
X
X# ifndef makedev
X# include <sys/types.h>
X# endif
X
X/* support for bool type */
Xtypedef char bool;
X# define TRUE 1
X# define FALSE 0
X
X# ifndef NULL
X# define NULL 0
X# endif NULL
X
X/* bit hacking */
X# define bitset(bit, word) (((word) & (bit)) != 0)
X
X/* some simple functions */
X# ifndef max
X# define max(a, b) ((a) > (b) ? (a) : (b))
X# define min(a, b) ((a) < (b) ? (a) : (b))
X# endif max
X
X/* assertions */
X# ifndef NASSERT
X# define ASSERT(expr, msg, parm)\
X if (!(expr))\
X {\
X fprintf(stderr, "assertion botch: %s:%d: ", __FILE__, __LINE__);\
X fprintf(stderr, msg, parm);\
X }
X# else NASSERT
X# define ASSERT(expr, msg, parm)
X# endif NASSERT
X
X/* sccs id's */
X# ifndef lint
X# define SCCSID(arg) static char SccsId[] = "arg";
X# else lint
X# define SCCSID(arg)
X# endif lint
X
X#ifdef UNIXPC
Xtypedef unsigned short u_short;
Xtypedef unsigned long u_long;
Xtypedef unsigned char u_char;
X#define rindex strrchr
X#define index strchr
X#define bcopy(s,d,l) memcpy(d,s,l)
X#define bzero(p,l) memset(p,'\0',l)
X#define sleep zsleep
X#define message zmessage
X#endif
X
X/* define the types of some common functions */
Xextern char *strcpy(), *strncpy();
Xextern char *strcat(), *strncat();
Xextern char *malloc();
Xextern char *index(), *rindex();
Xextern int errno;
Xextern time_t time();
Xextern char *ctime();
X# ifndef V6
Xextern char *getenv();
X# endif V6
X# ifndef VMUNIX
X#ifndef USG
Xtypedef unsigned short u_short;
Xtypedef long u_long;
Xtypedef char u_char;
Xtypedef int void;
X#endif
X# endif VMUNIX
END_OF_FILE
if test 1548 -ne `wc -c <'include/useful.h'`; then
echo shar: \"'include/useful.h'\" unpacked with wrong size!
fi
# end of 'include/useful.h'
fi
if test -f 'include/userdbm.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'include/userdbm.h'\"
else
echo shar: Extracting \"'include/userdbm.h'\" \(187 characters\)
sed "s/^X//" >'include/userdbm.h' <<'END_OF_FILE'
X/*
X** USERDBM.H -- user-level definitions for the DBM library
X**
X** Version:
X** @(#)userdbm.h 4.1 7/25/83
X*/
X
Xtypedef struct
X{
X char *dptr;
X int dsize;
X} DATUM;
X
Xextern DATUM fetch();
END_OF_FILE
if test 187 -ne `wc -c <'include/userdbm.h'`; then
echo shar: \"'include/userdbm.h'\" unpacked with wrong size!
fi
# end of 'include/userdbm.h'
fi
if test ! -d 'lib' ; then
echo shar: Creating directory \"'lib'\"
mkdir 'lib'
fi
if test -f 'lib/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lib/Makefile'\"
else
echo shar: Extracting \"'lib/Makefile'\" \(701 characters\)
sed "s/^X//" >'lib/Makefile' <<'END_OF_FILE'
X#
X# Copyright (c) 1988 Regents of the University of California.
X# All rights reserved.
X#
X# Redistribution and use in source and binary forms are permitted
X# provided that this notice is preserved and that due credit is given
X# to the University of California at Berkeley. The name of the University
X# may not be used to endorse or promote products derived from this
X# software without specific prior written permission. This software
X# is provided ``as is'' without express or implied warranty.
X#
X# @(#)Makefile 5.1 (Berkeley) 5/8/88
X#
XALL= sendmail.hf
XSRCS= sendmail.hf
X
Xall: FRC
Xclean: FRC
Xdepend: FRC
X
Xinstall: FRC
X install -c -o bin -g bin -m 444 sendmail.hf ${DESTDIR}/usr/lib/sendmail.hf
X
XFRC:
X
END_OF_FILE
if test 701 -ne `wc -c <'lib/Makefile'`; then
echo shar: \"'lib/Makefile'\" unpacked with wrong size!
fi
# end of 'lib/Makefile'
fi
if test -f 'lib/aliases' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lib/aliases'\"
else
echo shar: Extracting \"'lib/aliases'\" \(434 characters\)
sed "s/^X//" >'lib/aliases' <<'END_OF_FILE'
X#
X# Aliases in this file will NOT be expanded in the header from
X# Mail, but WILL be visible over networks or from /bin/mail.
X#
X# >>>>>>>>>> The program "newaliases" must be run after
X# >> NOTE >> this file is updated for any changes to
X# >>>>>>>>>> show through to sendmail.
X#
X
X# Basic system aliases -- these MUST be present
XMAILER-DAEMON: postmaster
Xpostmaster: root
X
X# Misc aliases for various things...
Xfortune: fortune at ucbvax
END_OF_FILE
if test 434 -ne `wc -c <'lib/aliases'`; then
echo shar: \"'lib/aliases'\" unpacked with wrong size!
fi
# end of 'lib/aliases'
fi
if test -f 'lib/sendmail.hf' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lib/sendmail.hf'\"
else
echo shar: Extracting \"'lib/sendmail.hf'\" \(1858 characters\)
sed "s/^X//" >'lib/sendmail.hf' <<'END_OF_FILE'
X@(#) sendmail.hf 4.2 6/7/85
Xcpyr
Xcpyr Sendmail
Xcpyr Copyright (c) 1983 Eric P. Allman
Xcpyr Berkeley, California
Xcpyr
Xcpyr Copyright (c) 1983 Regents of the University of California.
Xcpyr All rights reserved. The Berkeley software License Agreement
Xcpyr specifies the terms and conditions for redistribution.
Xcpyr
Xcpyr @(#)sendmail.hf 4.2 (Berkeley) 6/7/85
Xcpyr
Xsmtp Commands:
Xsmtp HELO MAIL RCPT DATA RSET
Xsmtp NOOP QUIT HELP VRFY EXPN
Xsmtp For more info use "HELP <topic>".
Xsmtp To report bugs in the implementation contact eric at Berkeley.ARPA
Xsmtp or eric at UCB-ARPA.ARPA.
Xsmtp For local information contact postmaster at this site.
Xhelp HELP [ <topic> ]
Xhelp The HELP command gives help info.
Xhelo HELO <hostname>
Xhelo Introduce yourself. I am a boor, so I really don't
Xhelo care if you do.
Xmail MAIL FROM: <sender>
Xmail Specifies the sender.
Xrcpt RCPT TO: <recipient>
Xrcpt Specifies the recipient. Can be used any number of times.
Xdata DATA
Xdata Following text is collected as the message.
Xdata End with a single dot.
Xrset RSET
Xrset Resets the system.
Xquit QUIT
Xquit Exit sendmail (SMTP).
Xvrfy VRFY <recipient>
Xvrfy Not implemented to protocol. Gives some sexy
Xvrfy information.
Xexpn EXPN <recipient>
Xexpn Same as VRFY in this implementation.
Xnoop NOOP
Xnoop Do nothing.
Xsend SEND FROM: <sender>
Xsend replaces the MAIL command, and can be used to send
Xsend directly to a users terminal. Not supported in this
Xsend implementation.
Xsoml SOML FROM: <sender>
Xsoml Send or mail. If the user is logged in, send directly,
Xsoml otherwise mail. Not supported in this implementation.
Xsaml SAML FROM: <sender>
Xsaml Send and mail. Send directly to the user's terminal,
Xsaml and also mail a letter. Not supported in this
Xsaml implementation.
Xturn TURN
Xturn Reverses the direction of the connection. Not currently
Xturn implemented.
END_OF_FILE
if test 1858 -ne `wc -c <'lib/sendmail.hf'`; then
echo shar: \"'lib/sendmail.hf'\" unpacked with wrong size!
fi
# end of 'lib/sendmail.hf'
fi
if test ! -d 'md' ; then
echo shar: Creating directory \"'md'\"
mkdir 'md'
fi
if test -f 'md/c.nvmunix.m4' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'md/c.nvmunix.m4'\"
else
echo shar: Extracting \"'md/c.nvmunix.m4'\" \(106 characters\)
sed "s/^X//" >'md/c.nvmunix.m4' <<'END_OF_FILE'
Xdnl @(#)c.nvmunix.m4 4.2 7/27/83
Xdefine(m4CONFIG, -DVMUNIX -DNVMUNIX)dnl
Xdefine(m4LIBS, -ldbm -ljobs)dnl
END_OF_FILE
if test 106 -ne `wc -c <'md/c.nvmunix.m4'`; then
echo shar: \"'md/c.nvmunix.m4'\" unpacked with wrong size!
fi
# end of 'md/c.nvmunix.m4'
fi
if test -f 'md/c.v6.m4' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'md/c.v6.m4'\"
else
echo shar: Extracting \"'md/c.v6.m4'\" \(73 characters\)
sed "s/^X//" >'md/c.v6.m4' <<'END_OF_FILE'
Xdnl @(#)c.v6.m4 4.1 7/25/83
Xdefine(m4CONFIG, -DV6)dnl
Xdefine(m4LIBS)dnl
END_OF_FILE
if test 73 -ne `wc -c <'md/c.v6.m4'`; then
echo shar: \"'md/c.v6.m4'\" unpacked with wrong size!
fi
# end of 'md/c.v6.m4'
fi
if test -f 'md/c.v7.m4' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'md/c.v7.m4'\"
else
echo shar: Extracting \"'md/c.v7.m4'\" \(80 characters\)
sed "s/^X//" >'md/c.v7.m4' <<'END_OF_FILE'
Xdnl @(#)c.v7.m4 4.1 7/25/83
Xdefine(m4CONFIG, -DV7)dnl
Xdefine(m4LIBS, -ldbm)dnl
END_OF_FILE
if test 80 -ne `wc -c <'md/c.v7.m4'`; then
echo shar: \"'md/c.v7.m4'\" unpacked with wrong size!
fi
# end of 'md/c.v7.m4'
fi
if test -f 'md/c.vmunix.m4' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'md/c.vmunix.m4'\"
else
echo shar: Extracting \"'md/c.vmunix.m4'\" \(117 characters\)
sed "s/^X//" >'md/c.vmunix.m4' <<'END_OF_FILE'
Xdnl @(#)c.vmunix.m4 4.4 7/21/86
Xdefine(m4CONFIG, -DVMUNIX -DMXDOMAIN)dnl
Xdefine(m4LIBS, -ldbm)dnl
Xdefine(m4SCCS)dnl
END_OF_FILE
if test 117 -ne `wc -c <'md/c.vmunix.m4'`; then
echo shar: \"'md/c.vmunix.m4'\" unpacked with wrong size!
fi
# end of 'md/c.vmunix.m4'
fi
if test -f 'md/config.dst' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'md/config.dst'\"
else
echo shar: Extracting \"'md/config.dst'\" \(88 characters\)
sed "s/^X//" >'md/config.dst' <<'END_OF_FILE'
Xdnl @(#)c.vmunix.m4 4.2 7/27/83
Xdefine(m4CONFIG, -DVMUNIX)dnl
Xdefine(m4LIBS, -ldbm)dnl
END_OF_FILE
if test 88 -ne `wc -c <'md/config.dst'`; then
echo shar: \"'md/config.dst'\" unpacked with wrong size!
fi
# end of 'md/config.dst'
fi
if test -f 'md/config.m4' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'md/config.m4'\"
else
echo shar: Extracting \"'md/config.m4'\" \(117 characters\)
sed "s/^X//" >'md/config.m4' <<'END_OF_FILE'
Xdnl @(#)c.vmunix.m4 4.4 7/21/86
Xdefine(m4CONFIG, -DVMUNIX -DMXDOMAIN)dnl
Xdefine(m4LIBS, -ldbm)dnl
Xdefine(m4SCCS)dnl
END_OF_FILE
if test 117 -ne `wc -c <'md/config.m4'`; then
echo shar: \"'md/config.m4'\" unpacked with wrong size!
fi
# end of 'md/config.m4'
fi
if test -f 'md/config.m4.mone' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'md/config.m4.mone'\"
else
echo shar: Extracting \"'md/config.m4.mone'\" \(89 characters\)
sed "s/^X//" >'md/config.m4.mone' <<'END_OF_FILE'
Xdnl %W% %Y% %G%
Xdefine(m4CONFIG, -DVMUNIX)dnl
Xdefine(m4LIBS, -ldbm)dnl
Xdefine(m4SCCS)dnl
END_OF_FILE
if test 89 -ne `wc -c <'md/config.m4.mone'`; then
echo shar: \"'md/config.m4.mone'\" unpacked with wrong size!
fi
# end of 'md/config.m4.mone'
fi
if test ! -d 'src' ; then
echo shar: Creating directory \"'src'\"
mkdir 'src'
fi
if test -f 'src/Makefile' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/Makefile'\"
else
echo shar: Extracting \"'src/Makefile'\" \(2952 characters\)
sed "s/^X//" >'src/Makefile' <<'END_OF_FILE'
X#
X# Sendmail
X# Copyright (c) 1983 Eric P. Allman
X# Berkeley, California
X#
X# Copyright (c) 1983 Regents of the University of California.
X# All rights reserved. The Berkeley software License Agreement
X# specifies the terms and conditions for redistribution.
X#
X# @(#)Makefile.m4 5.11 (Berkeley) 7/21/86
X#
X#
X# SENDMAIL Makefile.
X#
X#
X
XLIBS= -ldir
XDESTDIR=
X
XOBJS1= conf.o main.o collect.o parseaddr.o alias.o deliver.o \
X savemail.o err.o readcf.o stab.o headers.o recipient.o \
X stats.o daemon.o usersmtp.o srvrsmtp.o queue.o \
X macro.o util.o clock.o trace.o envelope.o domain.o
XOBJS2= sysexits.o arpadate.o convtime.o rename.o
XOBJS= $(OBJS1) $(OBJS2)
XSRCS1= conf.h sendmail.h \
X conf.c deliver.c main.c parseaddr.c err.c alias.c savemail.c \
X sysexits.c util.c arpadate.c version.c collect.c \
X macro.c headers.c readcf.c stab.c recipient.c stats.c daemon.c \
X usersmtp.c srvrsmtp.c queue.c clock.c trace.c envelope.c domain.c
XSRCS2= TODO convtime.c
XSRCS= Version.c $(SRCS1) $(SRCS2)
XALL= sendmail
X
XCHOWN= -echo chown
XCHMOD= chmod
XO= -O
XCOPTS=
XCCONFIG=-I../include -I/usr/netinclude
XCFLAGS= $O $(COPTS) $(CCONFIG)
XASMSED= ../include/asm.sed
XAR= -ar
XARFLAGS=rvu
XLINT= lint
XXREF= ctags -x
XCP= cp
XMV= mv
XINSTALL=install -c -s -o root
XM4= m4
XTOUCH= touch
XABORT= false
X
XGET= sccs get
XDELTA= sccs delta
XWHAT= what
XPRT= sccs prt
XREL=
X
XROOT= root
XGROUP= kmem
XOBJMODE=755
X
X# .c.o:
X# cc -S ${CFLAGS} $*.c
X# sed -f $(ASMSED) $*.s | as -o $*.o
X# rm -f $*.s
X
Xsendmail: $(OBJS1) $(OBJS2) Version.o
X $(CC) $(COPTS) -o sendmail Version.o $(OBJS1) $(OBJS2) $(LIBS)
X $(CHMOD) $(OBJMODE) sendmail
X size sendmail; ls -l sendmail; $(WHAT) < Version.o
X
Xinstall: all
X $(INSTALL) -m 6755 -g $(GROUP) sendmail $(DESTDIR)/usr/lib
X $(CP) /dev/null $(DESTDIR)/usr/lib/sendmail.fc
X
Xversion: newversion $(OBJS) Version.c
X
Xnewversion:
X @rm -f SCCS/p.version.c version.c
X @$(GET) $(REL) -e SCCS/s.version.c
X @$(DELTA) -s SCCS/s.version.c
X @$(GET) -t -s SCCS/s.version.c
X
Xfullversion: $(OBJS) dumpVersion Version.o
X
XdumpVersion:
X rm -f Version.c
X
XVersion.c: version.c
X @echo generating Version.c from version.c
X @cp version.c Version.c
X @chmod 644 Version.c
X @echo "" >> Version.c
X @echo "# ifdef COMMENT" >> Version.c
X @$(PRT) SCCS/s.version.c >> Version.c
X @echo "" >> Version.c
X @echo "code versions:" >> Version.c
X @echo "" >> Version.c
X @$(WHAT) $(OBJS) >> Version.c
X @echo "" >> Version.c
X @echo "# endif COMMENT" >> Version.c
X
X$(OBJS1): sendmail.h
X$(OBJS): conf.h
Xstats.o: mailstats.h
X
Xsendmail.h util.o: ../include/useful.h
X
Xall: $(ALL)
X
X#
X# Auxiliary support entries
X#
X
Xclean:
X rm -f core sendmail rmail usersmtp uucp a.out XREF sendmail.cf
X rm -f *.o
X
Xsources: $(SRCS)
X
X$(SRCS1) $(SRCS2):
X if test -d SCCS; then $(GET) $(REL) SCCS/s.$@; else $(TOUCH) $@; fi
X
Xprint: $(SRCS)
X @ls -l | pr -h "sendmail directory"
X @$(XREF) *.c | pr -h "cross reference listing"
X @size *.o | pr -h "object code sizes"
X @pr Makefile *.m4 *.h *.[cs]
X
Xlint:
X $(LINT) $(CCONFIG) $(SRCS1)
END_OF_FILE
if test 2952 -ne `wc -c <'src/Makefile'`; then
echo shar: \"'src/Makefile'\" unpacked with wrong size!
fi
# end of 'src/Makefile'
fi
if test -f 'src/README' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/README'\"
else
echo shar: Extracting \"'src/README'\" \(968 characters\)
sed "s/^X//" >'src/README' <<'END_OF_FILE'
XThis is the sendmail 5.58 distribution for System V Release 3.1.
XIt may run on earlier releases of System V. (I haven't tried it).
XOnly the src and include directories are included. The other
Xdirectories should be available in the normal Berkeley sendmail
Xdistribution.
X
XAs configured, this software has the following software requirements:
X
X WIN/3B TCP/IP (or equivalent Berkeley networking emulation)
X dbm library
X
XI wish I could distribute the dbm library (it is not part of System V),
Xbut it came originally from AT&T and thus contains AT&T licensed code.
XThings may work without the dbm library (undefine DBM and NDBM in src/conf.h),
Xbut I have not tried it.
X
XOther configurations may work, but the networking configuration is
Xthe only one I have tried.
X
XThere may be minor changes to include files needed to make all of this work.
XI can't quite remember exactly what I changed.
X
XThis software is unsupported.
X
XAllyn Fratkin
XU.C. San Diego
Xallyn at cs.ucsd.edu
END_OF_FILE
if test 968 -ne `wc -c <'src/README'`; then
echo shar: \"'src/README'\" unpacked with wrong size!
fi
# end of 'src/README'
fi
if test -f 'src/Version.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/Version.c'\"
else
echo shar: Extracting \"'src/Version.c'\" \(411 characters\)
sed "s/^X//" >'src/Version.c' <<'END_OF_FILE'
X/*
X** Sendmail
X** Copyright (c) 1983 Eric P. Allman
X** Berkeley, California
X**
X** Copyright (c) 1983 Regents of the University of California.
X** All rights reserved. The Berkeley software License Agreement
X** specifies the terms and conditions for redistribution.
X*/
X
X#ifndef lint
Xstatic char SccsId[] = "@(#)version.c 5.58 (Berkeley) 2/3/87";
X#endif not lint
X
Xchar Version[] = "5.58";
X
X# ifdef COMMENT
END_OF_FILE
if test 411 -ne `wc -c <'src/Version.c'`; then
echo shar: \"'src/Version.c'\" unpacked with wrong size!
fi
# end of 'src/Version.c'
fi
if test -f 'src/arpadate.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/arpadate.c'\"
else
echo shar: Extracting \"'src/arpadate.c'\" \(4198 characters\)
sed "s/^X//" >'src/arpadate.c' <<'END_OF_FILE'
X/*
X** Sendmail
X** Copyright (c) 1983 Eric P. Allman
X** Berkeley, California
X**
X** Copyright (c) 1983 Regents of the University of California.
X** All rights reserved. The Berkeley software License Agreement
X** specifies the terms and conditions for redistribution.
X*/
X
X#ifndef lint
Xstatic char SccsId[] = "@(#)arpadate.c 5.5 (Berkeley) 3/18/87";
X#endif not lint
X
X# include "conf.h"
X# ifdef USG
X# include <time.h>
X# else
X# include <sys/time.h>
X# ifndef V6
X# include <sys/types.h>
X# include <sys/timeb.h>
X# endif V6
X# endif USG
X# include "useful.h"
X
X# ifdef V6
X# define OLDTIME
X# endif V6
X# ifdef USG
X# define OLDTIME
X# endif USG
X
X/*
X** ARPADATE -- Create date in ARPANET format
X**
X** Parameters:
X** ud -- unix style date string. if NULL, one is created.
X**
X** Returns:
X** pointer to an ARPANET date field
X**
X** Side Effects:
X** none
X**
X** WARNING:
X** date is stored in a local buffer -- subsequent
X** calls will overwrite.
X**
X** Bugs:
X** Timezone is computed from local time, rather than
X** from whereever (and whenever) the message was sent.
X** To do better is very hard.
X**
X** Some sites are now inserting the timezone into the
X** local date. This routine should figure out what
X** the format is and work appropriately.
X*/
X
Xchar *
Xarpadate(ud)
X register char *ud;
X{
X register char *p;
X register char *q;
X static char b[40];
X extern char *ctime();
X register int i;
X extern struct tm *localtime();
X extern bool fconvert();
X# ifdef OLDTIME
X long t;
X extern long time();
X# else OLDTIME
X struct timeb t;
X extern struct timeb *ftime();
X# endif OLDTIME
X# ifdef V6
X extern char *StdTimezone, *DstTimezone;
X# endif V6
X# ifdef USG
X extern char *tzname[2];
X# endif USG
X
X /*
X ** Get current time.
X ** This will be used if a null argument is passed and
X ** to resolve the timezone.
X */
X
X# ifdef OLDTIME
X (void) time(&t);
X if (ud == NULL)
X ud = ctime(&t);
X# else
X ftime(&t);
X if (ud == NULL)
X ud = ctime(&t.time);
X# endif OLDTIME
X
X /*
X ** Crack the UNIX date line in a singularly unoriginal way.
X */
X
X q = b;
X
X p = &ud[0]; /* Mon */
X *q++ = *p++;
X *q++ = *p++;
X *q++ = *p++;
X *q++ = ',';
X *q++ = ' ';
X
X p = &ud[8]; /* 16 */
X if (*p == ' ')
X p++;
X else
X *q++ = *p++;
X *q++ = *p++;
X *q++ = ' ';
X
X p = &ud[4]; /* Sep */
X *q++ = *p++;
X *q++ = *p++;
X *q++ = *p++;
X *q++ = ' ';
X
X p = &ud[22]; /* 79 */
X *q++ = *p++;
X *q++ = *p++;
X *q++ = ' ';
X
X p = &ud[11]; /* 01:03:52 */
X for (i = 8; i > 0; i--)
X *q++ = *p++;
X
X /* -PST or -PDT */
X# ifdef V6
X if (localtime(&t)->tm_isdst)
X p = DstTimezone;
X else
X p = StdTimezone;
X# else
X# ifdef USG
X if (localtime(&t)->tm_isdst)
X p = tzname[1];
X else
X p = tzname[0];
X# else
X p = localtime(&t.time)->tm_zone;
X# endif USG
X# endif V6
X if ((strncmp(p, "GMT", 3) == 0 || strncmp(p, "gmt", 3) == 0) &&
X p[3] != '\0')
X {
X /* hours from GMT */
X p += 3;
X *q++ = *p++;
X if (p[1] == ':')
X *q++ = '0';
X else
X *q++ = *p++;
X *q++ = *p++;
X p++; /* skip ``:'' */
X *q++ = *p++;
X *q++ = *p++;
X *q = '\0';
X }
X else if (!fconvert(p, q))
X {
X *q++ = ' ';
X *q++ = *p++;
X *q++ = *p++;
X *q++ = *p++;
X *q = '\0';
X }
X
X return (b);
X}
X/*
X** FCONVERT -- convert foreign timezones to ARPA timezones
X**
X** This routine is essentially from Teus Hagen.
X**
X** Parameters:
X** a -- timezone as returned from UNIX.
X** b -- place to put ARPA-style timezone.
X**
X** Returns:
X** TRUE -- if a conversion was made (and b was filled in).
X** FALSE -- if this is not a recognized local time.
X**
X** Side Effects:
X** none.
X*/
X
X/* UNIX to arpa conversion table */
Xstruct foreign
X{
X char *f_from;
X char *f_to;
X};
X
Xstatic struct foreign Foreign[] =
X{
X { "EET", "+0200" }, /* eastern europe */
X { "MET", "+0100" }, /* middle europe */
X { "WET", "GMT" }, /* western europe */
X { "EET DST", "+0300" }, /* daylight saving times */
X { "MET DST", "+0200" },
X { "WET DST", "+0100" },
X { NULL, NULL }
X};
X
Xbool
Xfconvert(a, b)
X register char *a;
X char *b;
X{
X register struct foreign *euptr;
X register char *p;
X
X for (euptr = Foreign; euptr->f_from != NULL; euptr++)
X {
X extern bool sameword();
X
X if (sameword(euptr->f_from, a))
X {
X p = euptr->f_to;
X *b++ = ' ';
X while (*p != '\0')
X *b++ = *p++;
X *b = '\0';
X return (TRUE);
X }
X }
X return (FALSE);
X}
END_OF_FILE
if test 4198 -ne `wc -c <'src/arpadate.c'`; then
echo shar: \"'src/arpadate.c'\" unpacked with wrong size!
fi
# end of 'src/arpadate.c'
fi
if test -f 'src/bcopy.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/bcopy.c'\"
else
echo shar: Extracting \"'src/bcopy.c'\" \(1094 characters\)
sed "s/^X//" >'src/bcopy.c' <<'END_OF_FILE'
X/*
X** Sendmail
X** Copyright (c) 1983 Eric P. Allman
X** Berkeley, California
X**
X** Copyright (c) 1983 Regents of the University of California.
X** All rights reserved. The Berkeley software License Agreement
X** specifies the terms and conditions for redistribution.
X*/
X
X#ifndef lint
Xstatic char SccsId[] = "@(#)bcopy.c 5.1 (Berkeley) 6/7/85";
X#endif not lint
X
X# include "useful.h"
X
X/*
X** BCOPY -- block copy.
X**
X** Parameters:
X** s -- source of bytes.
X** d -- destination of bytes.
X** l -- length of block to move.
X**
X** Returns:
X** none.
X**
X** Side Effects:
X** copies 's' to 'd' for 'l' bytes.
X**
X** Notes:
X** This can be easily written in assembly language on
X** machines like VAXes if performance is needed.
X*/
X
X/*VARARGS0*/
Xbcopy(s, d, l)
X register char *s, *d;
X register int l;
X{
X while (l-- > 0)
X *d++ = *s++;
X}
X/*
X** BZERO -- zero a block of memory
X**
X** Parameters:
X** p -- location to clear.
X** l -- number of bytes to clear.
X**
X** Returns:
X** none.
X**
X** Side Effects:
X** none.
X*/
X
Xbzero(p, l)
X register char *p;
X register int l;
X{
X while (l-- > 0)
X *p++ = 0;
X}
END_OF_FILE
if test 1094 -ne `wc -c <'src/bcopy.c'`; then
echo shar: \"'src/bcopy.c'\" unpacked with wrong size!
fi
# end of 'src/bcopy.c'
fi
if test -f 'src/clock.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/clock.c'\"
else
echo shar: Extracting \"'src/clock.c'\" \(4366 characters\)
sed "s/^X//" >'src/clock.c' <<'END_OF_FILE'
X/*
X** Sendmail
X** Copyright (c) 1983 Eric P. Allman
X** Berkeley, California
X**
X** Copyright (c) 1983 Regents of the University of California.
X** All rights reserved. The Berkeley software License Agreement
X** specifies the terms and conditions for redistribution.
X*/
X
X#ifndef lint
Xstatic char SccsId[] = "@(#)clock.c 5.4 (Berkeley) 12/17/85";
X#endif not lint
X
X# include "sendmail.h"
X# include <signal.h>
X
X/*
X** SETEVENT -- set an event to happen at a specific time.
X**
X** Events are stored in a sorted list for fast processing.
X** An event only applies to the process that set it.
X**
X** Parameters:
X** intvl -- intvl until next event occurs.
X** func -- function to call on event.
X** arg -- argument to func on event.
X**
X** Returns:
X** none.
X**
X** Side Effects:
X** none.
X*/
X
XEVENT *
Xsetevent(intvl, func, arg)
X time_t intvl;
X int (*func)();
X int arg;
X{
X register EVENT **evp;
X register EVENT *ev;
X auto time_t now;
X extern tick();
X
X# ifdef DEBUG
X if (intvl <= 0)
X {
X syserr("setevent: intvl=%ld\n", intvl);
X return (NULL);
X }
X# endif DEBUG
X
X (void) time(&now);
X
X /* search event queue for correct position */
X for (evp = &EventQueue; (ev = *evp) != NULL; evp = &ev->ev_link)
X {
X if (ev->ev_time >= now + intvl)
X break;
X }
X
X /* insert new event */
X ev = (EVENT *) xalloc(sizeof *ev);
X ev->ev_time = now + intvl;
X ev->ev_func = func;
X ev->ev_arg = arg;
X ev->ev_pid = getpid();
X ev->ev_link = *evp;
X *evp = ev;
X
X# ifdef DEBUG
X if (tTd(5, 5))
X printf("setevent: intvl=%ld, for=%ld, func=%x, arg=%d, ev=%x\n",
X intvl, now + intvl, func, arg, ev);
X# endif DEBUG
X
X tick();
X return (ev);
X}
X/*
X** CLREVENT -- remove an event from the event queue.
X**
X** Parameters:
X** ev -- pointer to event to remove.
X**
X** Returns:
X** none.
X**
X** Side Effects:
X** arranges for event ev to not happen.
X*/
X
Xclrevent(ev)
X register EVENT *ev;
X{
X register EVENT **evp;
X
X# ifdef DEBUG
X if (tTd(5, 5))
X printf("clrevent: ev=%x\n", ev);
X# endif DEBUG
X if (ev == NULL)
X return;
X
X /* find the parent event */
X (void) signal(SIGALRM, SIG_IGN);
X for (evp = &EventQueue; *evp != NULL; evp = &(*evp)->ev_link)
X {
X if (*evp == ev)
X break;
X }
X
X /* now remove it */
X if (*evp != NULL)
X {
X *evp = ev->ev_link;
X free((char *) ev);
X }
X
X /* restore clocks and pick up anything spare */
X tick();
X}
X/*
X** TICK -- take a clock tick
X**
X** Called by the alarm clock. This routine runs events as needed.
X**
X** Parameters:
X** none.
X**
X** Returns:
X** none.
X**
X** Side Effects:
X** calls the next function in EventQueue.
X*/
X
Xtick()
X{
X register time_t now;
X register EVENT *ev;
X int mypid = getpid();
X
X (void) signal(SIGALRM, SIG_IGN);
X (void) alarm(0);
X now = curtime();
X
X# ifdef DEBUG
X if (tTd(5, 4))
X printf("tick: now=%ld\n", now);
X# endif DEBUG
X
X while ((ev = EventQueue) != NULL &&
X (ev->ev_time <= now || ev->ev_pid != mypid))
X {
X int (*f)();
X int arg;
X int pid;
X
X /* process the event on the top of the queue */
X ev = EventQueue;
X EventQueue = EventQueue->ev_link;
X# ifdef DEBUG
X if (tTd(5, 6))
X printf("tick: ev=%x, func=%x, arg=%d, pid=%d\n", ev,
X ev->ev_func, ev->ev_arg, ev->ev_pid);
X# endif DEBUG
X
X /* we must be careful in here because ev_func may not return */
X (void) signal(SIGALRM, tick);
X#ifdef SIGVTALRM
X /* reset 4.2bsd signal mask to allow future alarms */
X (void) sigsetmask(sigblock(0) & ~sigmask(SIGALRM));
X#endif SIGVTALRM
X
X f = ev->ev_func;
X arg = ev->ev_arg;
X pid = ev->ev_pid;
X free((char *) ev);
X if (pid != getpid())
X continue;
X if (EventQueue != NULL)
X {
X if (EventQueue->ev_time > now)
X (void) alarm((unsigned) (EventQueue->ev_time - now));
X else
X (void) alarm(3);
X }
X (*f)(arg);
X (void) alarm(0);
X now = curtime();
X }
X (void) signal(SIGALRM, tick);
X if (EventQueue != NULL)
X (void) alarm((unsigned) (EventQueue->ev_time - now));
X}
X/*
X** SLEEP -- a version of sleep that works with this stuff
X**
X** Because sleep uses the alarm facility, I must reimplement
X** it here.
X**
X** Parameters:
X** intvl -- time to sleep.
X**
X** Returns:
X** none.
X**
X** Side Effects:
X** waits for intvl time. However, other events can
X** be run during that interval.
X*/
X
Xstatic bool SleepDone;
X
Xsleep(intvl)
X unsigned int intvl;
X{
X extern endsleep();
X
X if (intvl == 0)
X return;
X SleepDone = FALSE;
X (void) setevent((time_t) intvl, endsleep, 0);
X while (!SleepDone)
X pause();
X}
X
Xstatic
Xendsleep()
X{
X SleepDone = TRUE;
X}
END_OF_FILE
if test 4366 -ne `wc -c <'src/clock.c'`; then
echo shar: \"'src/clock.c'\" unpacked with wrong size!
fi
# end of 'src/clock.c'
fi
if test -f 'src/conf.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/conf.h'\"
else
echo shar: Extracting \"'src/conf.h'\" \(1955 characters\)
sed "s/^X//" >'src/conf.h' <<'END_OF_FILE'
X/*
X** Sendmail
X** Copyright (c) 1983 Eric P. Allman
X** Berkeley, California
X**
X** Copyright (c) 1983 Regents of the University of California.
X** All rights reserved. The Berkeley software License Agreement
X** specifies the terms and conditions for redistribution.
X**
X** @(#)conf.h 5.8 (Berkeley) 7/21/86
X*/
X
X/*
X** CONF.H -- All user-configurable parameters for sendmail
X*/
X
X/*
X** Table sizes, etc....
X** There shouldn't be much need to change these....
X*/
X
X# define MAXLINE 1024 /* max line length */
X# define MAXNAME 256 /* max length of a name */
X# define MAXFIELD 2500 /* max total length of a hdr field */
X# define MAXPV 40 /* max # of parms to mailers */
X# define MAXHOP 17 /* max value of HopCount */
X# define MAXATOM 100 /* max atoms per address */
X# define MAXMAILERS 25 /* maximum mailers known to system */
X# define MAXRWSETS 30 /* max # of sets of rewriting rules */
X# define MAXPRIORITIES 25 /* max values for Precedence: field */
X# define MAXTRUST 30 /* maximum number of trusted users */
X# define MAXUSERENVIRON 40 /* max # of items in user environ */
X# define QUEUESIZE 600 /* max # of jobs per queue run */
X# define MAXMXHOSTS 10 /* max # of MX records */
X
X/*
X** Compilation options.
X**
X** #define these if they are available; comment them out otherwise.
X*/
X
X/*define DBM 1 /* use DBM library (requires -ldbm) */
X/*define NDBM 1 /* new DBM library available (requires DBM) */
X/*define DEBUG 1 /* enable debugging */
X/* # define LOG 1 /* enable logging */
X/*define SMTP 1 /* enable user and server SMTP */
X# define QUEUE 1 /* enable queueing */
X# define UGLYUUCP 1 /* output ugly UUCP From lines */
X/*define DAEMON 1 /* include the daemon (requires IPC & SMTP) */
X/* # define FLOCK 1 /* use flock file locking */
X# define SETPROCTITLE 1 /* munge argv to display current status */
X/* # define WIZ 1 /* allow wizard mode */
X#define USG 1 /* this is a usg system */
X#define UNIXPC 1 /* att unix-pc/3b1 */
END_OF_FILE
if test 1955 -ne `wc -c <'src/conf.h'`; then
echo shar: \"'src/conf.h'\" unpacked with wrong size!
fi
# end of 'src/conf.h'
fi
if test -f 'src/convtime.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/convtime.c'\"
else
echo shar: Extracting \"'src/convtime.c'\" \(2851 characters\)
sed "s/^X//" >'src/convtime.c' <<'END_OF_FILE'
X/*
X** Sendmail
X** Copyright (c) 1983 Eric P. Allman
X** Berkeley, California
X**
X** Copyright (c) 1983 Regents of the University of California.
X** All rights reserved. The Berkeley software License Agreement
X** specifies the terms and conditions for redistribution.
X*/
X
X#ifndef lint
Xstatic char SccsId[] = "@(#)convtime.c 5.1 (Berkeley) 6/7/85";
X#endif not lint
X
X# include <ctype.h>
X# include "conf.h"
X# include "useful.h"
X
X/*
X** CONVTIME -- convert time
X**
X** Takes a time as an ascii string with a trailing character
X** giving units:
X** s -- seconds
X** m -- minutes
X** h -- hours
X** d -- days (default)
X** w -- weeks
X** For example, "3d12h" is three and a half days.
X**
X** Parameters:
X** p -- pointer to ascii time.
X**
X** Returns:
X** time in seconds.
X**
X** Side Effects:
X** none.
X*/
X
Xtime_t
Xconvtime(p)
X char *p;
X{
X register time_t t, r;
X register char c;
X
X r = 0;
X while (*p != '\0')
X {
X t = 0;
X while (isdigit(c = *p++))
X t = t * 10 + (c - '0');
X if (c == '\0')
X p--;
X switch (c)
X {
X case 'w': /* weeks */
X t *= 7;
X
X case 'd': /* days */
X default:
X t *= 24;
X
X case 'h': /* hours */
X t *= 60;
X
X case 'm': /* minutes */
X t *= 60;
X
X case 's': /* seconds */
X break;
X }
X r += t;
X }
X
X return (r);
X}
X/*
X** PINTVL -- produce printable version of a time interval
X**
X** Parameters:
X** intvl -- the interval to be converted
X** brief -- if TRUE, print this in an extremely compact form
X** (basically used for logging).
X**
X** Returns:
X** A pointer to a string version of intvl suitable for
X** printing or framing.
X**
X** Side Effects:
X** none.
X**
X** Warning:
X** The string returned is in a static buffer.
X*/
X
X# define PLURAL(n) ((n) == 1 ? "" : "s")
X
Xchar *
Xpintvl(intvl, brief)
X time_t intvl;
X bool brief;
X{
X static char buf[256];
X register char *p;
X int wk, dy, hr, mi, se;
X
X if (intvl == 0 && !brief)
X return ("zero seconds");
X
X /* decode the interval into weeks, days, hours, minutes, seconds */
X se = intvl % 60;
X intvl /= 60;
X mi = intvl % 60;
X intvl /= 60;
X hr = intvl % 24;
X intvl /= 24;
X if (brief)
X dy = intvl;
X else
X {
X dy = intvl % 7;
X intvl /= 7;
X wk = intvl;
X }
X
X /* now turn it into a sexy form */
X p = buf;
X if (brief)
X {
X if (dy > 0)
X {
X (void) sprintf(p, "%d+", dy);
X p += strlen(p);
X }
X (void) sprintf(p, "%02d:%02d:%02d", hr, mi, se);
X return (buf);
X }
X
X /* use the verbose form */
X if (wk > 0)
X {
X (void) sprintf(p, ", %d week%s", wk, PLURAL(wk));
X p += strlen(p);
X }
X if (dy > 0)
X {
X (void) sprintf(p, ", %d day%s", dy, PLURAL(dy));
X p += strlen(p);
X }
X if (hr > 0)
X {
X (void) sprintf(p, ", %d hour%s", hr, PLURAL(hr));
X p += strlen(p);
X }
X if (mi > 0)
X {
X (void) sprintf(p, ", %d minute%s", mi, PLURAL(mi));
X p += strlen(p);
X }
X if (se > 0)
X {
X (void) sprintf(p, ", %d second%s", se, PLURAL(se));
X p += strlen(p);
X }
X
X return (buf + 2);
X}
END_OF_FILE
if test 2851 -ne `wc -c <'src/convtime.c'`; then
echo shar: \"'src/convtime.c'\" unpacked with wrong size!
fi
# end of 'src/convtime.c'
fi
if test -f 'src/mailstats.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/mailstats.h'\"
else
echo shar: Extracting \"'src/mailstats.h'\" \(706 characters\)
sed "s/^X//" >'src/mailstats.h' <<'END_OF_FILE'
X/*
X** Sendmail
X** Copyright (c) 1983 Eric P. Allman
X** Berkeley, California
X**
X** Copyright (c) 1983 Regents of the University of California.
X** All rights reserved. The Berkeley software License Agreement
X** specifies the terms and conditions for redistribution.
X**
X** "@(#)mailstats.h 5.1 (Berkeley) 5/2/86";
X**
X*/
X
X/*
X** Statistics structure.
X*/
X
Xstruct statistics
X{
X time_t stat_itime; /* file initialization time */
X short stat_size; /* size of this structure */
X long stat_nf[MAXMAILERS]; /* # msgs from each mailer */
X long stat_bf[MAXMAILERS]; /* kbytes from each mailer */
X long stat_nt[MAXMAILERS]; /* # msgs to each mailer */
X long stat_bt[MAXMAILERS]; /* kbytes to each mailer */
X};
END_OF_FILE
if test 706 -ne `wc -c <'src/mailstats.h'`; then
echo shar: \"'src/mailstats.h'\" unpacked with wrong size!
fi
# end of 'src/mailstats.h'
fi
if test -f 'src/rename.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/rename.c'\"
else
echo shar: Extracting \"'src/rename.c'\" \(281 characters\)
sed "s/^X//" >'src/rename.c' <<'END_OF_FILE'
X/*
X * substitute for BSD/SVR3 rename() system call, from
X * Janet Walz, walz at mimsy.umd.edu & Rich Salz, rsalz at pineapple.bbn.com
X */
X
Xint rename(oldname,newname)
Xchar *oldname,*newname;
X{
X (void)unlink(newname);
X if(link(oldname,newname))
X return(-1);
X return(unlink(oldname));
X}
XEND_OF_FILE
if test 281 -ne `wc -c <'src/rename.c'`; then
echo shar: \"'src/rename.c'\" unpacked with wrong size!
fi
# end of 'src/rename.c'
fi
if test -f 'src/stab.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/stab.c'\"
else
echo shar: Extracting \"'src/stab.c'\" \(2239 characters\)
sed "s/^X//" >'src/stab.c' <<'END_OF_FILE'
X/*
X** Sendmail
X** Copyright (c) 1983 Eric P. Allman
X** Berkeley, California
X**
X** Copyright (c) 1983 Regents of the University of California.
X** All rights reserved. The Berkeley software License Agreement
X** specifies the terms and conditions for redistribution.
X*/
X
X#ifndef lint
Xstatic char SccsId[] = "@(#)stab.c 5.2 (Berkeley) 6/7/85";
X#endif not lint
X
X# include "sendmail.h"
X
X/*
X** STAB -- manage the symbol table
X**
X** Parameters:
X** name -- the name to be looked up or inserted.
X** type -- the type of symbol.
X** op -- what to do:
X** ST_ENTER -- enter the name if not
X** already present.
X** ST_FIND -- find it only.
X**
X** Returns:
X** pointer to a STAB entry for this name.
X** NULL if not found and not entered.
X**
X** Side Effects:
X** can update the symbol table.
X*/
X
X# define STABSIZE 400
X
X/* SymTab should be not be static on USG systems */
X#ifndef USG
Xstatic
X#endif
XSTAB *SymTab[STABSIZE];
X
XSTAB *
Xstab(name, type, op)
X char *name;
X int type;
X int op;
X{
X register STAB *s;
X register STAB **ps;
X extern bool sameword();
X register int hfunc;
X register char *p;
X extern char lower();
X
X# ifdef DEBUG
X if (tTd(36, 5))
X printf("STAB: %s %d ", name, type);
X# endif DEBUG
X
X /*
X ** Compute the hashing function
X **
X ** We could probably do better....
X */
X
X hfunc = type;
X for (p = name; *p != '\0'; p++)
X hfunc = (((hfunc << 7) | lower(*p)) & 077777) % STABSIZE;
X
X# ifdef DEBUG
X if (tTd(36, 9))
X printf("(hfunc=%d) ", hfunc);
X# endif DEBUG
X
X ps = &SymTab[hfunc];
X while ((s = *ps) != NULL && (!sameword(name, s->s_name) || s->s_type != type))
X ps = &s->s_next;
X
X /*
X ** Dispose of the entry.
X */
X
X if (s != NULL || op == ST_FIND)
X {
X# ifdef DEBUG
X if (tTd(36, 5))
X {
X if (s == NULL)
X printf("not found\n");
X else
X {
X long *lp = (long *) s->s_class;
X
X printf("type %d val %lx %lx %lx %lx\n",
X s->s_type, lp[0], lp[1], lp[2], lp[3]);
X }
X }
X# endif DEBUG
X return (s);
X }
X
X /*
X ** Make a new entry and link it in.
X */
X
X# ifdef DEBUG
X if (tTd(36, 5))
X printf("entered\n");
X# endif DEBUG
X
X /* make new entry */
X s = (STAB *) xalloc(sizeof *s);
X bzero((char *) s, sizeof *s);
X s->s_name = newstr(name);
X makelower(s->s_name);
X s->s_type = type;
X
X /* link it in */
X *ps = s;
X
X return (s);
X}
END_OF_FILE
if test 2239 -ne `wc -c <'src/stab.c'`; then
echo shar: \"'src/stab.c'\" unpacked with wrong size!
fi
# end of 'src/stab.c'
fi
if test -f 'src/stats.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/stats.c'\"
else
echo shar: Extracting \"'src/stats.c'\" \(1994 characters\)
sed "s/^X//" >'src/stats.c' <<'END_OF_FILE'
X/*
X** Sendmail
X** Copyright (c) 1983 Eric P. Allman
X** Berkeley, California
X**
X** Copyright (c) 1983 Regents of the University of California.
X** All rights reserved. The Berkeley software License Agreement
X** specifies the terms and conditions for redistribution.
X*/
X
X#ifndef lint
Xstatic char SccsId[] = "@(#)stats.c 5.8 (Berkeley) 5/2/86";
X#endif not lint
X
X# include "sendmail.h"
X# include "mailstats.h"
X
Xstruct statistics Stat;
X
X#define ONE_K 1000 /* one thousand (twenty-four?) */
X#define KBYTES(x) (((x) + (ONE_K - 1)) / ONE_K)
X/*
X** MARKSTATS -- mark statistics
X*/
X
Xmarkstats(e, to)
X register ENVELOPE *e;
X register ADDRESS *to;
X{
X if (to == NULL)
X {
X if (e->e_from.q_mailer != NULL)
X {
X Stat.stat_nf[e->e_from.q_mailer->m_mno]++;
X Stat.stat_bf[e->e_from.q_mailer->m_mno] +=
X KBYTES(CurEnv->e_msgsize);
X }
X }
X else
X {
X Stat.stat_nt[to->q_mailer->m_mno]++;
X Stat.stat_bt[to->q_mailer->m_mno] += KBYTES(CurEnv->e_msgsize);
X }
X}
X/*
X** POSTSTATS -- post statistics in the statistics file
X**
X** Parameters:
X** sfile -- the name of the statistics file.
X**
X** Returns:
X** none.
X**
X** Side Effects:
X** merges the Stat structure with the sfile file.
X*/
X
Xpoststats(sfile)
X char *sfile;
X{
X register int fd;
X struct statistics stat;
X extern off_t lseek();
X
X if (sfile == NULL)
X return;
X
X (void) time(&Stat.stat_itime);
X Stat.stat_size = sizeof Stat;
X
X fd = open(sfile, 2);
X if (fd < 0)
X {
X errno = 0;
X return;
X }
X if (read(fd, (char *) &stat, sizeof stat) == sizeof stat &&
X stat.stat_size == sizeof stat)
X {
X /* merge current statistics into statfile */
X register int i;
X
X for (i = 0; i < MAXMAILERS; i++)
X {
X stat.stat_nf[i] += Stat.stat_nf[i];
X stat.stat_bf[i] += Stat.stat_bf[i];
X stat.stat_nt[i] += Stat.stat_nt[i];
X stat.stat_bt[i] += Stat.stat_bt[i];
X }
X }
X else
X bcopy((char *) &Stat, (char *) &stat, sizeof stat);
X
X /* write out results */
X (void) lseek(fd, (off_t) 0, 0);
X (void) write(fd, (char *) &stat, sizeof stat);
X (void) close(fd);
X}
END_OF_FILE
if test 1994 -ne `wc -c <'src/stats.c'`; then
echo shar: \"'src/stats.c'\" unpacked with wrong size!
fi
# end of 'src/stats.c'
fi
if test -f 'src/sysexits.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/sysexits.c'\"
else
echo shar: Extracting \"'src/sysexits.c'\" \(1616 characters\)
sed "s/^X//" >'src/sysexits.c' <<'END_OF_FILE'
X/*
X** Sendmail
X** Copyright (c) 1983 Eric P. Allman
X** Berkeley, California
X**
X** Copyright (c) 1983 Regents of the University of California.
X** All rights reserved. The Berkeley software License Agreement
X** specifies the terms and conditions for redistribution.
X*/
X
X#ifndef lint
Xstatic char SccsId[] = "@(#)sysexits.c 5.2 (Berkeley) 6/7/85";
X#endif not lint
X
X# include <sysexits.h>
X# include "conf.h"
X# include "useful.h"
X
X/*
X** SYSEXITS.C -- error messages corresponding to sysexits.h
X*/
X
Xchar *SysExMsg[] =
X{
X /* 64 USAGE */ "500 Bad usage",
X /* 65 DATAERR */ "501 Data format error",
X /* 66 NOINPUT */ "550 Cannot open input",
X /* 67 NOUSER */ "550 User unknown",
X /* 68 NOHOST */ "550 Host unknown",
X /* 69 UNAVAILABLE */ "554 Service unavailable",
X /* 70 SOFTWARE */ "554 Internal error",
X /* 71 OSERR */ "451 Operating system error",
X /* 72 OSFILE */ "554 System file missing",
X /* 73 CANTCREAT */ "550 Can't create output",
X /* 74 IOERR */ "451 I/O error",
X /* 75 TEMPFAIL */ "250 Deferred",
X /* 76 PROTOCOL */ "554 Remote protocol error",
X /* 77 NOPERM */ "550 Insufficient permission",
X};
X
Xint N_SysEx = sizeof SysExMsg / sizeof SysExMsg[0];
X/*
X** STATSTRING -- return string corresponding to an error status
X**
X** Parameters:
X** stat -- the status to decode.
X**
X** Returns:
X** The string corresponding to that status
X**
X** Side Effects:
X** none.
X*/
X
Xchar *
Xstatstring(stat)
X int stat;
X{
X static char ebuf[100];
X
X stat -= EX__BASE;
X if (stat < 0 || stat >= N_SysEx)
X {
X (void) sprintf(ebuf, "554 Unknown status %d", stat + EX__BASE);
X return (ebuf);
X }
X
X return (SysExMsg[stat]);
X}
END_OF_FILE
if test 1616 -ne `wc -c <'src/sysexits.c'`; then
echo shar: \"'src/sysexits.c'\" unpacked with wrong size!
fi
# end of 'src/sysexits.c'
fi
if test -f 'src/trace.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/trace.c'\"
else
echo shar: Extracting \"'src/trace.c'\" \(1758 characters\)
sed "s/^X//" >'src/trace.c' <<'END_OF_FILE'
X/*
X** Sendmail
X** Copyright (c) 1983 Eric P. Allman
X** Berkeley, California
X**
X** Copyright (c) 1983 Regents of the University of California.
X** All rights reserved. The Berkeley software License Agreement
X** specifies the terms and conditions for redistribution.
X*/
X
X#ifndef lint
Xstatic char SccsId[] = "@(#)trace.c 5.3 (Berkeley) 12/17/86";
X#endif not lint
X
X# include "sendmail.h"
X
X/*
X** TtSETUP -- set up for trace package.
X**
X** Parameters:
X** vect -- pointer to trace vector.
X** size -- number of flags in trace vector.
X** defflags -- flags to set if no value given.
X**
X** Returns:
X** none
X**
X** Side Effects:
X** environment is set up.
X*/
X
Xu_char *tTvect;
Xint tTsize;
Xstatic char *DefFlags;
X
XtTsetup(vect, size, defflags)
X u_char *vect;
X int size;
X char *defflags;
X{
X tTvect = vect;
X tTsize = size;
X DefFlags = defflags;
X}
X/*
X** TtFLAG -- process an external trace flag description.
X**
X** Parameters:
X** s -- the trace flag.
X**
X** Returns:
X** none.
X**
X** Side Effects:
X** sets/clears trace flags.
X*/
X
XtTflag(s)
X register char *s;
X{
X int first, last;
X register int i;
X
X if (*s == '\0')
X s = DefFlags;
X
X for (;;)
X {
X /* find first flag to set */
X i = 0;
X while (isdigit(*s))
X i = i * 10 + (*s++ - '0');
X first = i;
X
X /* find last flag to set */
X if (*s == '-')
X {
X i = 0;
X while (isdigit(*++s))
X i = i * 10 + (*s - '0');
X }
X last = i;
X
X /* find the level to set it to */
X i = 1;
X if (*s == '.')
X {
X i = 0;
X while (isdigit(*++s))
X i = i * 10 + (*s - '0');
X }
X
X /* clean up args */
X if (first >= tTsize)
X first = tTsize - 1;
X if (last >= tTsize)
X last = tTsize - 1;
X
X /* set the flags */
X while (first <= last)
X tTvect[first++] = i;
X
X /* more arguments? */
X if (*s++ == '\0')
X return;
X }
X}
END_OF_FILE
if test 1758 -ne `wc -c <'src/trace.c'`; then
echo shar: \"'src/trace.c'\" unpacked with wrong size!
fi
# end of 'src/trace.c'
fi
if test -f 'src/trace.h' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/trace.h'\"
else
echo shar: Extracting \"'src/trace.h'\" \(565 characters\)
sed "s/^X//" >'src/trace.h' <<'END_OF_FILE'
X/*
X** Sendmail
X** Copyright (c) 1983 Eric P. Allman
X** Berkeley, California
X**
X** Copyright (c) 1983 Regents of the University of California.
X** All rights reserved. The Berkeley software License Agreement
X** specifies the terms and conditions for redistribution.
X**
X** @(#)trace.h 5.1 (Berkeley) 7/14/85
X*/
X
X/*
X** Trace Package.
X*/
X
Xtypedef u_char *TRACEV;
X
Xextern TRACEV tTvect; /* current trace vector */
X
X# ifndef tTVECT
X# define tTVECT tTvect
X# endif tTVECT
X
X# define tTf(flag, level) (tTVECT[flag] >= level)
X# define tTlevel(flag) (tTVECT[flag])
END_OF_FILE
if test 565 -ne `wc -c <'src/trace.h'`; then
echo shar: \"'src/trace.h'\" unpacked with wrong size!
fi
# end of 'src/trace.h'
fi
if test -f 'src/version.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'src/version.c'\"
else
echo shar: Extracting \"'src/version.c'\" \(394 characters\)
sed "s/^X//" >'src/version.c' <<'END_OF_FILE'
X/*
X** Sendmail
X** Copyright (c) 1983 Eric P. Allman
X** Berkeley, California
X**
X** Copyright (c) 1983 Regents of the University of California.
X** All rights reserved. The Berkeley software License Agreement
X** specifies the terms and conditions for redistribution.
X*/
X
X#ifndef lint
Xstatic char SccsId[] = "@(#)version.c 5.58 (Berkeley) 2/3/87";
X#endif not lint
X
Xchar Version[] = "5.58";
END_OF_FILE
if test 394 -ne `wc -c <'src/version.c'`; then
echo shar: \"'src/version.c'\" unpacked with wrong size!
fi
# end of 'src/version.c'
fi
echo shar: End of archive 1 \(of 8\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 3 4 5 6 7 8 ; do
if test ! -f ark${I}isdone ; then
MISSING="${MISSING} ${I}"
fi
done
if test "${MISSING}" = "" ; then
echo You have unpacked all 8 archives.
rm -f ark[1-9]isdone
else
echo You still need to unpack the following archives:
echo " " ${MISSING}
fi
## End of shell archive.
exit 0
--
David H. Brierley
Home: dave at galaxia.Newport.RI.US {rayssd,xanth,lazlo,jclyde}!galaxia!dave
Work: dhb at rayssd.ray.com {sun,decuac,gatech,necntc,ukma}!rayssd!dhb
More information about the Unix-pc.sources
mailing list