summaryrefslogtreecommitdiffstats
path: root/contrib/sendmail/praliases
diff options
context:
space:
mode:
authorgshapiro <gshapiro@FreeBSD.org>2000-08-12 21:55:49 +0000
committergshapiro <gshapiro@FreeBSD.org>2000-08-12 21:55:49 +0000
commit4332139a9a11f773ffe5109bed871561e3c290a1 (patch)
tree6d207932926718f38869bd08959330c09f4f3e0d /contrib/sendmail/praliases
parenta392fe0bdb7081117c445f5dcc98d5ed4013dc17 (diff)
downloadFreeBSD-src-4332139a9a11f773ffe5109bed871561e3c290a1.zip
FreeBSD-src-4332139a9a11f773ffe5109bed871561e3c290a1.tar.gz
Import of sendmail version 8.11.0 into vendor branch SENDMAIL with
release tag v8_11_0. Obtained from: ftp://ftp.sendmail.org/pub/sendmail/
Diffstat (limited to 'contrib/sendmail/praliases')
-rwxr-xr-xcontrib/sendmail/praliases/Build508
-rw-r--r--contrib/sendmail/praliases/Makefile17
-rw-r--r--contrib/sendmail/praliases/Makefile.m4115
-rw-r--r--contrib/sendmail/praliases/praliases.880
-rw-r--r--contrib/sendmail/praliases/praliases.c483
5 files changed, 345 insertions, 858 deletions
diff --git a/contrib/sendmail/praliases/Build b/contrib/sendmail/praliases/Build
index ab8a49d..543779c 100755
--- a/contrib/sendmail/praliases/Build
+++ b/contrib/sendmail/praliases/Build
@@ -1,513 +1,13 @@
#!/bin/sh
-# Copyright (c) 1998 Sendmail, Inc. All rights reserved.
-# Copyright (c) 1993, 1996-1997 Eric P. Allman. All rights reserved.
-# Copyright (c) 1993
-# The Regents of the University of California. All rights reserved.
+# Copyright (c) 1999 Sendmail, Inc. and its suppliers.
+# All rights reserved.
#
# By using this file, you agree to the terms and conditions set
# forth in the LICENSE file which can be found at the top level of
# the sendmail distribution.
#
#
-# @(#)Build 8.93 (Berkeley) 6/24/98
-#
-
-#
-# A quick-and-dirty script to compile sendmail and related programs
-# in the presence of multiple architectures. To use, just use
-# "sh Build".
-#
-
-trap "rm -f $obj/.settings$$; exit" 1 2 3 15
-
-cflag=""
-mflag=""
-sflag=""
-makeargs=""
-libdirs=""
-incdirs=""
-libsrch=""
-siteconfig=""
-EX_USAGE=64
-EX_NOINPUT=66
-EX_UNAVAILABLE=69
-
-while [ ! -z "$1" ]
-do
- case $1
- in
- -c) # clean out existing $obj tree
- cflag=1
- shift
- ;;
-
- -m) # show Makefile name only
- mflag=1
- shift
- ;;
-
- -E*) # environment variables to pass into Build
- arg=`echo $1 | sed 's/^-E//'`
- if [ -z "$arg" ]
- then
- shift # move to argument
- arg=$1
- fi
- if [ -z "$arg" ]
- then
- echo "Empty -E flag" >&2
- exit $EX_USAGE
- else
- case $arg
- in
- *=*) # check format
- eval $arg
- export `echo $arg | sed 's;=.*;;'`
- ;;
- *) # bad format
- echo "Bad format for -E argument ($arg)" >&2
- exit $EX_USAGE
- ;;
- esac
- shift
- fi
- ;;
-
- -L*) # set up LIBDIRS
- libdirs="$libdirs $1"
- shift
- ;;
-
- -I*) # set up INCDIRS
- incdirs="$incdirs $1"
- shift
- ;;
-
- -f*) # select site config file
- arg=`echo $1 | sed 's/^-f//'`
- if [ -z "$arg" ]
- then
- shift # move to argument
- arg=$1
- fi
- if [ "$siteconfig" ]
- then
- echo "Only one -f flag allowed" >&2
- exit $EX_USAGE
- else
- siteconfig=$arg
- if [ -z "$siteconfig" ]
- then
- echo "Missing argument for -f flag" >&2
- exit $EX_USAGE
- elif [ ! -f "$siteconfig" ]
- then
- echo "${siteconfig}: File not found"
- exit $EX_NOINPUT
- else
- shift # move past argument
- fi
- fi
- ;;
-
- -S) # skip auto-configure
- sflag="-s"
- shift
- ;;
-
- *) # pass argument to make
- makeargs="$makeargs \"$1\""
- shift
- ;;
- esac
-done
-
-#
-# Do heuristic guesses !ONLY! for machines that do not have uname
-#
-if [ -d /NextApps -a ! -f /bin/uname -a ! -f /usr/bin/uname ]
-then
- # probably a NeXT box
- arch=`hostinfo | sed -n 's/.*Processor type: \([^ ]*\).*/\1/p'`
- os=NeXT
- rel=`hostinfo | sed -n 's/.*NeXT Mach \([0-9\.]*\).*/\1/p'`
-elif [ -f /usr/sony/bin/machine -a -f /etc/osversion ]
-then
- # probably a Sony NEWS 4.x
- os=NEWS-OS
- rel=`awk '{ print $3}' /etc/osversion`
- arch=`/usr/sony/bin/machine`
-elif [ -d /usr/omron -a -f /bin/luna ]
-then
- # probably a Omron LUNA
- os=LUNA
- if [ -f /bin/luna1 ] && /bin/luna1
- then
- rel=unios-b
- arch=luna1
- elif [ -f /bin/luna2 ] && /bin/luna2
- then
- rel=Mach
- arch=luna2
- elif [ -f /bin/luna88k ] && /bin/luna88k
- then
- rel=Mach
- arch=luna88k
- fi
-elif [ -d /usr/apollo -a -d \`node_data ]
-then
- # probably a Apollo/DOMAIN
- os=DomainOS
- arch=$ISP
- rel=`/usr/apollo/bin/bldt | grep Domain | awk '{ print $4 }' | sed -e 's/,//g'`
-fi
-
-if [ ! "$arch" -a ! "$os" -a ! "$rel" ]
-then
- arch=`uname -m | sed -e 's/ //g'`
- os=`uname -s | sed -e 's/\//-/g' -e 's/ //g'`
- rel=`uname -r | sed -e 's/(/-/g' -e 's/)//g'`
-fi
-
-#
-# Tweak the values we have already got. PLEASE LIMIT THESE to
-# tweaks that are absolutely necessary because your system uname
-# routine doesn't return something sufficiently unique. Don't do
-# it just because you don't like the name that is returned. You
-# can combine the architecture name with the os name to create a
-# unique Makefile name.
-#
-
-# tweak machine architecture
-case $arch
-in
- sun4*) arch=sun4;;
-
- 9000/*) arch=`echo $arch | sed -e 's/9000.//' -e 's/..$/xx/'`;;
-
- DS/907000) arch=ds90;;
-
- NILE*) arch=NILE
- os=`uname -v`;;
-esac
-
-# tweak operating system type and release
-node=`uname -n | sed -e 's/\//-/g' -e 's/ //g'`
-if [ "$os" = "$node" -a "$arch" = "i386" -a "$rel" = 3.2 -a "`uname -v`" = 2 ]
-then
- # old versions of SCO UNIX set uname -s the same as uname -n
- os=SCO_SV
-fi
-if [ "$rel" = 4.0 ]
-then
- case $arch in
- 3[34]??|3[34]??,*)
- if [ -d /usr/sadm/sysadm/add-ons/WIN-TCP ]
- then
- os=NCR.MP-RAS.2.x
- elif [ -d /usr/sadm/sysadm/add-ons/inet ]
- then
- os=NCR.MP-RAS.3.x
- fi
- ;;
- esac
-fi
-
-case $os
-in
- DYNIX-ptx) os=PTX;;
- Paragon*) os=Paragon;;
- HP-UX) rel=`echo $rel | sed -e 's/^[^.]*\.0*//'`;;
- AIX) rela=$rel
- rel=`uname -v`
- case $rel in
- 2) arch=""
- ;;
- 4) if [ "$rela" = "3" ]
- then
- arch=$rela
- fi
- ;;
- esac
- rel=$rel.$rela
- ;;
- BSD-386) os=BSD-OS;;
- SCO_SV) os=SCO; rel=`uname -X | sed -n 's/Release = 3.2v//p'`;;
- UNIX_System_V) if [ "$arch" = "ds90" ]
- then
- os="UXPDS"
- rel=`uname -v | sed -e 's/\(V.*\)L.*/\1/'`
- fi;;
- SINIX-?) os=SINIX;;
- DomainOS) case $rel in
- 10.4*) rel=10.4;;
- esac
- ;;
-esac
-
-# get "base part" of operating system release
-rroot=`echo $rel | sed -e 's/\.[^.]*$//'`
-rbase=`echo $rel | sed -e 's/\..*//'`
-if [ "$rroot" = "$rbase" ]
-then
- rroot=$rel
-fi
-
-# heuristic tweaks to clean up names -- PLEASE LIMIT THESE!
-if [ "$os" = "unix" ]
-then
- # might be Altos System V
- case $rel
- in
- 5.3*) os=Altos;;
- esac
-elif [ -r /unix -a -r /usr/lib/libseq.a -a -r /lib/cpp ]
-then
- # might be a DYNIX/ptx 2.x system, which has a broken uname
- if strings /lib/cpp | grep _SEQUENT_ > /dev/null
- then
- os=PTX
- fi
-elif [ -d /usr/nec ]
-then
- # NEC machine -- what is it running?
- if [ "$os" = "UNIX_System_V" ]
- then
- os=EWS-UX_V
- elif [ "$os" = "UNIX_SV" ]
- then
- os=UX4800
- fi
-elif [ "$arch" = "mips" ]
-then
- case $rel
- in
- 4_*)
- if [ `uname -v` = "UMIPS" ]
- then
- os=RISCos
- fi;;
- esac
-fi
-
-# see if there is a "user suffix" specified
-if [ "${SENDMAIL_SUFFIX-}x" = "x" ]
-then
- sfx=""
-else
- sfx=".${SENDMAIL_SUFFIX}"
-fi
-
-echo "Configuration: os=$os, rel=$rel, rbase=$rbase, rroot=$rroot, arch=$arch, sfx=$sfx"
-
-
-SMROOT=${SMROOT-..}
-BUILDTOOLS=${BUILDTOOLS-$SMROOT/BuildTools}
-export SMROOT BUILDTOOLS
-
-# see if we are in a Build-able directory
-if [ ! -f Makefile.m4 ]; then
- echo "Makefile.m4 not found. Build can only be run from a source directory."
- exit $EX_UNAVAILABLE
-fi
-
-# now try to find a reasonable object directory
-if [ -r obj.$os.$rel.$arch$sfx ]; then
- obj=obj.$os.$rel.$arch$sfx
-elif [ -r obj.$os.$rroot.$arch$sfx ]; then
- obj=obj.$os.$rroot.$arch$sfx
-elif [ -r obj.$os.$rbase.x.$arch$sfx ]; then
- obj=obj.$os.$rbase.x.$arch$sfx
-elif [ -r obj.$os.$rel$sfx ]; then
- obj=obj.$os.$rel$sfx
-elif [ -r obj.$os.$rbase.x$sfx ]; then
- obj=obj.$os.$rbase.x$sfx
-elif [ -r obj.$os.$arch$sfx ]; then
- obj=obj.$os.$arch$sfx
-elif [ -r obj.$rel.$arch$sfx ]; then
- obj=obj.$rel.$arch$sfx
-elif [ -r obj.$rbase.x.$arch$sfx ]; then
- obj=obj.$rbase.x.$arch$sfx
-elif [ -r obj.$os$sfx ]; then
- obj=obj.$os$sfx
-elif [ -r obj.$arch$sfx ]; then
- obj=obj.$arch$sfx
-elif [ -r obj.$rel$sfx ]; then
- obj=obj.$rel$sfx
-elif [ -r obj$sfx ]; then
- obj=obj$sfx
-fi
-if [ -z "$obj" -o "$cflag" ]
-then
- if [ -n "$obj" ]
- then
- echo "Clearing out existing $obj tree"
- rm -rf $obj
- else
- # no existing obj directory -- try to create one if Makefile found
- obj=obj.$os.$rel.$arch$sfx
- fi
- if [ -r $BUILDTOOLS/OS/$os.$rel.$arch$sfx ]; then
- oscf=$os.$rel.$arch$sfx
- elif [ -r $BUILDTOOLS/OS/$os.$rel.$arch ]; then
- oscf=$os.$rel.$arch
- elif [ -r $BUILDTOOLS/OS/$os.$rroot.$arch$sfx ]; then
- oscf=$os.$rroot.$arch$sfx
- elif [ -r $BUILDTOOLS/OS/$os.$rroot.$arch ]; then
- oscf=$os.$rroot.$arch
- elif [ -r $BUILDTOOLS/OS/$os.$rbase.x.$arch$sfx ]; then
- oscf=$os.$rbase.x.$arch$sfx
- elif [ -r $BUILDTOOLS/OS/$os.$rbase.x.$arch ]; then
- oscf=$os.$rbase.x.$arch
- elif [ -r $BUILDTOOLS/OS/$os.$rel$sfx ]; then
- oscf=$os.$rel$sfx
- elif [ -r $BUILDTOOLS/OS/$os.$rel ]; then
- oscf=$os.$rel
- elif [ -r $BUILDTOOLS/OS/$os.$rroot$sfx ]; then
- oscf=$os.$rroot$sfx
- elif [ -r $BUILDTOOLS/OS/$os.$rroot ]; then
- oscf=$os.$rroot
- elif [ -r $BUILDTOOLS/OS/$os.$rbase.x$sfx ]; then
- oscf=$os.$rbase.x$sfx
- elif [ -r $BUILDTOOLS/OS/$os.$rbase.x ]; then
- oscf=$os.$rbase.x
- elif [ -r $BUILDTOOLS/OS/$os.$arch$sfx ]; then
- oscf=$os.$arch$sfx
- elif [ -r $BUILDTOOLS/OS/$os.$arch ]; then
- oscf=$os.$arch
- elif [ -r $BUILDTOOLS/OS/$rel.$arch$sfx ]; then
- oscf=$rel.$arch$sfx
- elif [ -r $BUILDTOOLS/OS/$rel.$arch ]; then
- oscf=$rel.$arch
- elif [ -r $BUILDTOOLS/OS/$rroot.$arch$sfx ]; then
- oscf=$rroot.$arch$sfx
- elif [ -r $BUILDTOOLS/OS/$rroot.$arch ]; then
- oscf=$rroot.$arch
- elif [ -r $BUILDTOOLS/OS/$rbase.x.$arch$sfx ]; then
- oscf=$rbase.x.$arch$sfx
- elif [ -r $BUILDTOOLS/OS/$rbase.x.$arch ]; then
- oscf=$rbase.x.$arch
- elif [ -r $BUILDTOOLS/OS/$os$sfx ]; then
- oscf=$os$sfx
- elif [ -r $BUILDTOOLS/OS/$os ]; then
- oscf=$os
- elif [ -r $BUILDTOOLS/OS/$arch$sfx ]; then
- oscf=$arch$sfx
- elif [ -r $BUILDTOOLS/OS/$arch ]; then
- oscf=$arch
- elif [ -r $BUILDTOOLS/OS/$rel$sfx ]; then
- oscf=$rel$sfx
- elif [ -r $BUILDTOOLS/OS/$rel ]; then
- oscf=$rel
- elif [ -r $BUILDTOOLS/OS/$rel$sfx ]; then
- oscf=$rel$sfx
- else
- echo "Cannot determine how to support $arch.$os.$rel" >&2
- exit $EX_UNAVAILABLE
- fi
- M4=`sh $BUILDTOOLS/bin/find_m4.sh`
- ret=$?
- if [ $ret -ne 0 ]
- then
- exit $ret
- fi
- echo "Using M4=$M4"
- export M4
- if [ "$mflag" ]
- then
- echo "Will run in virgin $obj using $BUILDTOOLS/OS/$oscf"
- exit 0
- fi
- if [ "$ABI" ]
- then
- echo "Using ABI $ABI"
- fi
- echo "Creating $obj using $BUILDTOOLS/OS/$oscf"
- mkdir $obj
- (cd $obj; ln -s ../*.[ch158] .)
- if [ -f sendmail.hf ]
- then
- (cd $obj; ln -s ../sendmail.hf .)
- fi
-
- rm -f $obj/.settings$$
- echo 'divert(-1)' > $obj/.settings$$
- cat $BUILDTOOLS/M4/header.m4 >> $obj/.settings$$
- if [ "$ABI" ]
- then
- echo "define(\`confABI', \`$ABI')" >> $obj/.settings$$
- fi
- cat $BUILDTOOLS/OS/$oscf >> $obj/.settings$$
-
- if [ -z "$siteconfig" ]
- then
- # none specified, use defaults
- if [ -f $BUILDTOOLS/Site/site.$oscf$sfx.m4 ]
- then
- siteconfig=$BUILDTOOLS/Site/site.$oscf$sfx.m4
- elif [ -f $BUILDTOOLS/Site/site.$oscf.m4 ]
- then
- siteconfig=$BUILDTOOLS/Site/site.$oscf.m4
- fi
- if [ -f $BUILDTOOLS/Site/site.config.m4 ]
- then
- siteconfig="$BUILDTOOLS/Site/site.config.m4 $siteconfig"
- fi
- fi
- if [ ! -z "$siteconfig" ]
- then
- echo "Including $siteconfig"
- cat $siteconfig >> $obj/.settings$$
- fi
- if [ "$libdirs" ]
- then
- echo "define(\`confLIBDIRS', confLIBDIRS \`\`$libdirs'')" >> $obj/.settings$$
- fi
- if [ "$incdirs" ]
- then
- echo "define(\`confINCDIRS', confINCDIRS \`\`$incdirs'')" >> $obj/.settings$$
- fi
- echo 'divert(0)dnl' >> $obj/.settings$$
- libdirs=`(cat $obj/.settings$$; echo "_SRIDBIL_= confLIBDIRS" ) | \
- sed -e 's/\(.\)include/\1_include_/g' -e 's/#define/#_define_/g' | \
- ${M4} -DconfBUILDTOOLSDIR=$BUILDTOOLS - | \
- grep "^_SRIDBIL_=" | \
- sed -e 's/#_define_/#define/g' -e 's/_include_/include/g' -e "s/^_SRIDBIL_=//"`
- libsrch=`(cat $obj/.settings$$; echo "_HCRSBIL_= confLIBSEARCH" ) | \
- sed -e 's/\(.\)include/\1_include_/g' -e 's/#define/#_define_/g' | \
- ${M4} -DconfBUILDTOOLSDIR=$BUILDTOOLS - | \
- grep "^_HCRSBIL_=" | \
- sed -e 's/#_define_/#define/g' -e 's/_include_/include/g' -e "s/^_HCRSBIL_=//"`
- echo 'divert(-1)' >> $obj/.settings$$
- LIBDIRS="$libdirs" LIBSRCH="$libsrch" SITECONFIG="$siteconfig" sh $BUILDTOOLS/bin/configure.sh $sflag $oscf >> $obj/.settings$$
- echo 'divert(0)dnl' >> $obj/.settings$$
- sed -e 's/\(.\)include/\1_include_/g' -e 's/#define/#_define_/g' $obj/.settings$$ | \
- ${M4} -DconfBUILDTOOLSDIR=$BUILDTOOLS - Makefile.m4 | \
- sed -e 's/#_define_/#define/g' -e 's/_include_/include/g' > $obj/Makefile
- if [ $? -ne 0 -o ! -s $obj/Makefile ]
- then
- echo "ERROR: ${M4} failed; You may need a newer version of M4, at least as new as System V or GNU" 1>&2
- rm -rf $obj
- exit $EX_UNAVAILABLE
- fi
- rm -f $obj/.settings$$
- echo "Making dependencies in $obj"
- (cd $obj; ${MAKE-make} depend)
-fi
-
-if [ "$mflag" ]
-then
- makefile=`ls -l $obj/Makefile | sed 's/.* //'`
- if [ -z "$makefile" ]
- then
- echo "ERROR: $obj exists but has no Makefile" >&2
- exit $EX_NOINPUT
- fi
- echo "Will run in existing $obj using $makefile"
- exit 0
-fi
+# $Id: Build,v 8.4 1999/03/02 02:34:32 peterh Exp $
-echo "Making in $obj"
-cd $obj
-eval exec ${MAKE-make} $makeargs
+exec ../devtools/bin/Build $*
diff --git a/contrib/sendmail/praliases/Makefile b/contrib/sendmail/praliases/Makefile
new file mode 100644
index 0000000..6b6db70
--- /dev/null
+++ b/contrib/sendmail/praliases/Makefile
@@ -0,0 +1,17 @@
+# $Id: Makefile,v 8.5 1999/09/23 22:36:39 ca Exp $
+
+SHELL= /bin/sh
+BUILD= ./Build
+OPTIONS= $(CONFIG) $(FLAGS)
+
+all: FRC
+ $(SHELL) $(BUILD) $(OPTIONS) $@
+clean: FRC
+ $(SHELL) $(BUILD) $(OPTIONS) $@
+install: FRC
+ $(SHELL) $(BUILD) $(OPTIONS) $@
+
+fresh: FRC
+ $(SHELL) $(BUILD) $(OPTIONS) -c
+
+FRC:
diff --git a/contrib/sendmail/praliases/Makefile.m4 b/contrib/sendmail/praliases/Makefile.m4
index 7e78412..670c2cc 100644
--- a/contrib/sendmail/praliases/Makefile.m4
+++ b/contrib/sendmail/praliases/Makefile.m4
@@ -1,104 +1,21 @@
-#
-# This Makefile is designed to work on the old "make" program.
-#
-# @(#)Makefile.m4 8.16 (Berkeley) 7/12/1998
-#
+include(confBUILDTOOLSDIR`/M4/switch.m4')
-# C compiler
-CC= confCC
+# sendmail dir
+SMSRCDIR= ifdef(`confSMSRCDIR', `confSMSRCDIR', `${SRCDIR}/sendmail')
+PREPENDDEF(`confENVDEF', `confMAPDEF')
+PREPENDDEF(`confINCDIRS', `-I${SMSRCDIR} ')
-# Shell
-SHELL= confSHELL
+bldPRODUCT_START(`executable', `praliases')
+define(`bldINSTALL_DIR', `S')
+define(`bldSOURCES', `praliases.c ')
+bldPUSH_SMLIB(`smutil')
+bldPUSH_SMLIB(`smdb')
+APPENDDEF(`confENVDEF', `-DNOT_SENDMAIL')
+bldPRODUCT_END
-# use O=-O (usual) or O=-g (debugging)
-O= ifdef(`confOPTIMIZE', `confOPTIMIZE', `-O')
+bldPRODUCT_START(`manpage', `praliases')
+define(`bldSOURCES', `praliases.8')
+bldPRODUCT_END
-# location of sendmail source directory
-SRCDIR= ifdef(`confSRCDIR', `confSRCDIR', `../../src')
+bldFINISH
-# define the database mechanisms available for map & alias lookups:
-# -DNDBM -- use new DBM
-# -DNEWDB -- use new Berkeley DB
-# The really old (V7) DBM library is no longer supported.
-#
-MAPDEF= ifdef(`confMAPDEF', `confMAPDEF')
-
-# environment definitions (e.g., -D_AIX3)
-ENVDEF= ifdef(`confENVDEF', `confENVDEF')
-
-# see also conf.h for additional compilation flags
-
-# include directories
-INCDIRS=-I${SRCDIR} confINCDIRS
-
-# loader options
-LDOPTS= ifdef(`confLDOPTS', `confLDOPTS')
-
-# library directories
-LIBDIRS=confLIBDIRS
-
-# libraries required on your system
-LIBS= ifdef(`confLIBS', `confLIBS')
-
-# location of praliases binary (usually /usr/sbin or /usr/etc)
-SBINDIR=${DESTDIR}ifdef(`confSBINDIR', `confSBINDIR', `/usr/sbin')
-
-# additional .o files needed
-OBJADD= ifdef(`confOBJADD', `confOBJADD')
-
-undivert(1)
-
-################### end of user configuration flags ######################
-
-BUILDBIN=confBUILDBIN
-COPTS= -I. ${INCDIRS} ${MAPDEF} ${ENVDEF}
-CFLAGS= $O ${COPTS}
-
-BEFORE= confBEFORE
-OBJS= praliases.o ${OBJADD}
-
-NROFF= ifdef(`confNROFF', `confNROFF', `groff -Tascii')
-MANDOC= ifdef(`confMANDOC', `confMANDOC', `-mandoc')
-
-INSTALL=ifdef(`confINSTALL', `confINSTALL', `install')
-BINOWN= ifdef(`confUBINOWN', `confUBINOWN', `bin')
-BINGRP= ifdef(`confUBINGRP', `confUBINGRP', `bin')
-BINMODE=ifdef(`confUBINMODE', `confUBINMODE', `555')
-
-MANOWN= ifdef(`confMANOWN', `confMANOWN', `bin')
-MANGRP= ifdef(`confMANGRP', `confMANGRP', `bin')
-MANMODE=ifdef(`confMANMODE', `confMANMODE', `444')
-
-MANROOT=${DESTDIR}ifdef(`confMANROOT', `confMANROOT', `/usr/share/man/cat')
-MAN8= ${MANROOT}ifdef(`confMAN8', `confMAN8', `8')
-MAN8EXT=ifdef(`confMAN8EXT', `confMAN8EXT', `8')
-MAN8SRC=ifdef(`confMAN8SRC', `confMAN8SRC', `0')
-
-ALL= praliases praliases.${MAN8SRC}
-
-all: ${ALL}
-
-praliases: ${BEFORE} ${OBJS}
- ${CC} -o praliases ${LDOPTS} ${OBJS} ${LIBDIRS} ${LIBS}
-
-undivert(3)
-
-praliases.${MAN8SRC}: praliases.8
- ${NROFF} ${MANDOC} praliases.8 > praliases.${MAN8SRC}
-
-install: install-praliases install-docs
-
-install-praliases: praliases
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} praliases ${SBINDIR}
-
-install-docs: praliases.${MAN8SRC}
-ifdef(`confNO_MAN_INSTALL', `dnl',
-` ${INSTALL} -c -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} praliases.${MAN8SRC} ${MAN8}/praliases.${MAN8EXT}')
-
-clean:
- rm -f ${OBJS} praliases praliases.${MAN8SRC}
-
-################ Dependency scripts
-include(confBUILDTOOLSDIR/M4/depend/ifdef(`confDEPEND_TYPE', `confDEPEND_TYPE',
-`generic').m4)dnl
-################ End of dependency scripts
diff --git a/contrib/sendmail/praliases/praliases.8 b/contrib/sendmail/praliases/praliases.8
index 0833701..0a63a79 100644
--- a/contrib/sendmail/praliases/praliases.8
+++ b/contrib/sendmail/praliases/praliases.8
@@ -1,49 +1,57 @@
-.\" Copyright (c) 1998 Sendmail, Inc. All rights reserved.
+.\" Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+.\" All rights reserved.
.\"
.\" By using this file, you agree to the terms and conditions set
.\" forth in the LICENSE file which can be found at the top level of
.\" the sendmail distribution.
.\"
.\"
-.\" @(#)praliases.8 8.5 (Berkeley) 5/19/1998
+.\" $Id: praliases.8,v 8.15 2000/04/06 16:47:24 ca Exp $
.\"
-.Dd April 25, 1996
-.Dt PRALIASES 1
-.Os BSD 3
-.Sh NAME
-.Nm praliases
-.Nd display system mail aliases
-.Sh SYNOPSIS
-.Nm praliases
-.Op Fl f Ar file
-.Sh DESCRIPTION
+.TH PRALIASES 8 "April 25, 1996"
+.SH NAME
+.B praliases
+\- display system mail aliases
+.SH SYNOPSIS
+.B praliases
+.RB [ \-C
+.IR file ]
+.RB [ \-f
+.IR file ]
+.RB [\c
+.IR key
+.IR ... ]
+.SH DESCRIPTION
The
-.Nm praliases
-utility displays the current system aliases,
+.B praliases
+utility displays the current system aliases,
one per line, in no particular order.
-.Pp
+The special internal @:@ alias will be displayed if present.
+.PP
The options are as follows:
-.Bl -tag -width Ds
-.It Fl f
-Read the specified file instead of the default
-.Nm sendmail
-system aliases file.
-.El
-.Pp
+.TP
+.B \-C
+Read the specified sendmail configuration file instead of the default
+.B sendmail
+configuration file.
+.TP
+.B \-f
+Read the specified file instead of the configured
+.B sendmail
+system aliases file(s).
+.PP
+If one or more keys are specified on the command line,
+only entries which match those keys are displayed.
+.PP
The
-.Nm praliases
+.B praliases
utility exits 0 on success, and >0 if an error occurs.
-.Sh FILES
-.Bl -tag -width /var/log/sendmail.stXX -compact
-.It Pa /etc/aliases
+.SH FILES
+.TP 2.5i
+/etc/mail/sendmail.cf
The default
-.Nm sendmail
-system aliases file.
-.It Pa /etc/aliases.db
-The database version of the
-.Pa /etc/aliases
-file.
-.El
-.Sh SEE ALSO
-.Xr mailq 1 ,
-.Xr sendmail 8
+.B sendmail
+configuration file.
+.SH SEE ALSO
+mailq(1),
+sendmail(8)
diff --git a/contrib/sendmail/praliases/praliases.c b/contrib/sendmail/praliases/praliases.c
index 3935191..4c6c4d6 100644
--- a/contrib/sendmail/praliases/praliases.c
+++ b/contrib/sendmail/praliases/praliases.c
@@ -1,5 +1,6 @@
/*
- * Copyright (c) 1998 Sendmail, Inc. All rights reserved.
+ * Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.
+ * 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.
@@ -12,74 +13,84 @@
#ifndef lint
static char copyright[] =
-"@(#) Copyright (c) 1988, 1993\n\
+"@(#) Copyright (c) 1998-2000 Sendmail, Inc. and its suppliers.\n\
+ All rights reserved.\n\
+ Copyright (c) 1983 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 */
+#endif /* ! lint */
#ifndef lint
-static char sccsid[] = "@(#)praliases.c 8.21 (Berkeley) 12/27/1998";
-#endif /* not lint */
+static char id[] = "@(#)$Id: praliases.c,v 8.59.4.10 2000/07/18 05:41:39 gshapiro Exp $";
+#endif /* ! lint */
+
+#include <sys/types.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <unistd.h>
+#ifdef EX_OK
+# undef EX_OK /* unistd.h may have another use for this */
+#endif /* EX_OK */
+#include <sysexits.h>
-#if !defined(NDBM) && !defined(NEWDB)
- ERROR README: You must define one of NDBM or NEWDB in order to compile
- ERROR README: praliases.
-#endif
-#ifdef NDBM
-# include <ndbm.h>
-#endif
#ifndef NOT_SENDMAIL
# define NOT_SENDMAIL
-#endif
-#include <sendmail.h>
-#include <pathnames.h>
-#ifdef NEWDB
-# include <db.h>
-# ifndef DB_VERSION_MAJOR
-# define DB_VERSION_MAJOR 1
-# endif
-#endif
-
-#if defined(IRIX64) || defined(IRIX5) || defined(IRIX6) || \
- defined(BSD4_4) || defined(__osf__) || defined(__GNU_LIBRARY__)
-# ifndef HASSTRERROR
-# define HASSTRERROR 1 /* has strerror(3) */
-# endif
-#endif
-
-#if !HASSTRERROR
-extern char *strerror __P((int));
-#endif
+#endif /* ! NOT_SENDMAIL */
+#include <sendmail/sendmail.h>
+#include <sendmail/pathnames.h>
+#include <libsmdb/smdb.h>
static void praliases __P((char *, int, char **));
-#ifdef NDBM
-static void praliases_dbm __P((char *, int, char **));
-#endif
+
+uid_t RealUid;
+gid_t RealGid;
+char *RealUserName;
+uid_t RunAsUid;
+uid_t RunAsGid;
+char *RunAsUserName;
+int Verbose = 2;
+bool DontInitGroups = FALSE;
+uid_t TrustedUid = 0;
+BITMAP256 DontBlameSendmail;
+
+extern void syserr __P((const char *, ...));
+
int
main(argc, argv)
int argc;
char **argv;
{
- extern char *optarg;
- extern int optind;
char *cfile;
-#if _FFR_GRAB_ALIASFILE_OPTION
char *filename = NULL;
-#else
- char *filename = "/etc/aliases";
-#endif
FILE *cfp;
int ch;
char afilebuf[MAXLINE];
char buf[MAXLINE];
+ struct passwd *pw;
+ static char rnamebuf[MAXNAME];
+ extern char *optarg;
+ extern int optind;
+
+
+ clrbitmap(DontBlameSendmail);
+ RunAsUid = RealUid = getuid();
+ RunAsGid = RealGid = getgid();
+ pw = getpwuid(RealUid);
+ if (pw != NULL)
+ {
+ if (strlen(pw->pw_name) > MAXNAME - 1)
+ pw->pw_name[MAXNAME] = 0;
+ snprintf(rnamebuf, sizeof rnamebuf, "%s", pw->pw_name);
+ }
+ else
+ (void) snprintf(rnamebuf, sizeof rnamebuf, "Unknown UID %d",
+ (int) RealUid);
+ RunAsUserName = RealUserName = rnamebuf;
cfile = _PATH_SENDMAILCF;
-#if _FFR_GRAB_ALIASFILE_OPTION
- while ((ch = getopt(argc, argv, "C:f:")) != EOF)
-#else
- while ((ch = getopt(argc, argv, "f:")) != EOF)
-#endif
+ while ((ch = getopt(argc, argv, "C:f:")) != -1)
{
switch ((char)ch) {
case 'C':
@@ -91,11 +102,7 @@ main(argc, argv)
case '?':
default:
(void)fprintf(stderr,
-#if _FFR_GRAB_ALIASFILE_OPTION
- "usage: praliases [-C cffile] [-f aliasfile]\n");
-#else
- "usage: praliases [-f aliasfile]\n");
-#endif
+ "usage: praliases [-C cffile] [-f aliasfile]\n");
exit(EX_USAGE);
}
}
@@ -110,8 +117,8 @@ main(argc, argv)
if ((cfp = fopen(cfile, "r")) == NULL)
{
- fprintf(stderr, "praliases: ");
- perror(cfile);
+ fprintf(stderr, "praliases: %s: %s\n",
+ cfile, errstring(errno));
exit(EX_NOINPUT);
}
@@ -119,6 +126,10 @@ main(argc, argv)
{
register char *b, *p;
+ b = strchr(buf, '\n');
+ if (b != NULL)
+ *b = '\0';
+
b = buf;
switch (*b++)
{
@@ -140,15 +151,15 @@ main(argc, argv)
}
/* this is the A or AliasFile option -- save it */
- if (strlen(b) >= sizeof afilebuf)
+ if (strlcpy(afilebuf, b, sizeof afilebuf) >=
+ sizeof afilebuf)
{
fprintf(stderr,
- "AliasFile filename too long: %.30s...\n",
+ "praliases: AliasFile filename too long: %.30s\n",
b);
(void) fclose(cfp);
exit(EX_CONFIG);
}
- strcpy(afilebuf, b);
b = afilebuf;
for (p = b; p != NULL; )
@@ -160,12 +171,50 @@ main(argc, argv)
b = p;
p = strpbrk(p, " ,/");
+
/* find end of spec */
if (p != NULL)
- p = strpbrk(p, ",\n");
+ {
+ bool quoted = FALSE;
+
+ for (; *p != '\0'; p++)
+ {
+ /*
+ ** Don't break into a quoted
+ ** string.
+ */
+
+ if (*p == '"')
+ quoted = !quoted;
+ else if (*p == ',' && !quoted)
+ break;
+ }
+
+ /* No more alias specs follow */
+ if (*p == '\0')
+ {
+ /* chop trailing whitespace */
+ while (isascii(*p) &&
+ isspace(*p) &&
+ p > b)
+ p--;
+ *p = '\0';
+ p = NULL;
+ }
+ }
+
if (p != NULL)
- *p++ = '\0';
+ {
+ char *e = p - 1;
+ /* chop trailing whitespace */
+ while (isascii(*e) &&
+ isspace(*e) &&
+ e > b)
+ e--;
+ *++e = '\0';
+ *p++ = '\0';
+ }
praliases(b, argc, argv);
}
@@ -175,196 +224,192 @@ main(argc, argv)
}
(void) fclose(cfp);
exit(EX_OK);
+ /* NOTREACHED */
+ return EX_OK;
}
static void
praliases(filename, argc, argv)
char *filename;
- int argc;
+ int argc;
char **argv;
{
-#ifdef NEWDB
- DB *db;
- DBT newdbkey, newdbcontent;
- char buf[MAXNAME];
-#endif
- char *class;
-
- class = strchr(filename, ':');
- if (class != NULL)
+ int result;
+ char *colon;
+ char *db_name;
+ char *db_type;
+ SMDB_DATABASE *database = NULL;
+ SMDB_CURSOR *cursor = NULL;
+ SMDB_DBENT db_key, db_value;
+ SMDB_DBPARAMS params;
+ SMDB_USER_INFO user_info;
+
+ colon = strchr(filename, ':');
+ if (colon == NULL)
{
- if (strncasecmp(filename, "dbm:", 4) == 0)
- {
-#ifdef NDBM
- praliases_dbm(class + 1, argc, argv);
- return;
-#else
- fprintf(stderr, "class dbm not available\n");
- exit(EX_DATAERR);
-#endif
- }
- filename = class + 1;
+ db_name = filename;
+ db_type = SMDB_TYPE_DEFAULT;
}
-#ifdef NEWDB
- if (strlen(filename) + 4 >= sizeof buf)
+ else
{
- fprintf(stderr, "Alias filename too long: %.30s...\n", filename);
- exit(EX_USAGE);
+ *colon = '\0';
+ db_name = colon + 1;
+ db_type = filename;
}
- (void) strcpy(buf, filename);
- (void) strcat(buf, ".db");
-# if DB_VERSION_MAJOR < 2
- db = dbopen(buf, O_RDONLY, 0444, DB_HASH, NULL);
-# else
- db = NULL;
- errno = db_open(buf, DB_HASH, DB_RDONLY, 0444, NULL, NULL, &db);
-# endif
- if (db != NULL)
+
+ /* clean off arguments */
+ for (;;)
{
- if (!argc)
- {
-# if DB_VERSION_MAJOR > 1
- DBC *dbc;
-# endif
- bzero(&newdbkey, sizeof newdbkey);
- bzero(&newdbcontent, sizeof newdbcontent);
-
-# if DB_VERSION_MAJOR < 2
- while(!db->seq(db, &newdbkey, &newdbcontent, R_NEXT))
-# else
-# if DB_VERSION_MAJOR > 2 || DB_VERSION_MINOR >=6
- if ((errno = db->cursor(db, NULL, &dbc, 0)) == 0)
-# else
- if ((errno = db->cursor(db, NULL, &dbc)) == 0)
-# endif
- {
- while ((errno = dbc->c_get(dbc, &newdbkey,
- &newdbcontent,
- DB_NEXT)) == 0)
-# endif
- printf("%.*s:%.*s\n",
- (int) newdbkey.size,
- (char *) newdbkey.data,
- (int) newdbcontent.size,
- (char *) newdbcontent.data);
-# if DB_VERSION_MAJOR > 1
- (void) dbc->c_close(dbc);
- }
- else
- {
- fprintf(stderr,
- "praliases: %s: Could not set cursor: %s\n",
- buf, strerror(errno));
- errno = db->close(db, 0);
- exit(EX_DATAERR);
- }
-# endif
- }
- else for (; *argv; ++argv)
- {
- bzero(&newdbkey, sizeof newdbkey);
- bzero(&newdbcontent, sizeof newdbcontent);
- newdbkey.data = *argv;
- newdbkey.size = strlen(*argv) + 1;
-# if DB_VERSION_MAJOR < 2
- if (!db->get(db, &newdbkey, &newdbcontent, 0))
-# else
- if ((errno = db->get(db, NULL, &newdbkey,
- &newdbcontent, 0)) == 0)
-# endif
- printf("%s:%.*s\n", (char *) newdbkey.data,
- (int) newdbcontent.size,
- (char *) newdbcontent.data);
- else
- printf("%s: No such key\n",
- (char *) newdbkey.data);
- }
-# if DB_VERSION_MAJOR < 2
- (void)db->close(db);
-# else
- errno = db->close(db, 0);
-# endif
+ while (isascii(*db_name) && isspace(*db_name))
+ db_name++;
+ if (*db_name != '-')
+ break;
+ while (*db_name != '\0' &&
+ !(isascii(*db_name) && isspace(*db_name)))
+ db_name++;
}
- else
+
+ if (*db_name == '\0' || (db_type != NULL && *db_type == '\0'))
{
-#endif
-#ifdef NDBM
- praliases_dbm(filename, argc, argv);
-#endif
-#ifdef NEWDB
+ if (colon != NULL)
+ *colon = ':';
+ fprintf(stderr, "praliases: illegal alias specification: %s\n",
+ filename);
+ goto fatal;
}
-#endif
-}
-#ifdef NDBM
-static void
-praliases_dbm(filename, argc, argv)
- char *filename;
- int argc;
- char **argv;
-{
- DBM *dbp;
- datum content, key;
+ memset(&params, '\0', sizeof params);
+ params.smdbp_cache_size = 1024 * 1024;
- if ((dbp = dbm_open(filename, O_RDONLY, 0)) == NULL)
+ user_info.smdbu_id = RunAsUid;
+ user_info.smdbu_group_id = RunAsGid;
+ strlcpy(user_info.smdbu_name, RunAsUserName, SMDB_MAX_USER_NAME_LEN);
+
+ result = smdb_open_database(&database, db_name, O_RDONLY, 0,
+ SFF_ROOTOK, db_type, &user_info, &params);
+ if (result != SMDBE_OK)
{
- (void)fprintf(stderr,
- "praliases: %s: %s\n", filename, strerror(errno));
- exit(EX_OSFILE);
+ fprintf(stderr, "praliases: %s: open: %s\n",
+ db_name, errstring(result));
+ goto fatal;
}
- if (!argc)
+
+ if (argc == 0)
{
- for (key = dbm_firstkey(dbp);
- key.dptr != NULL; key = dbm_nextkey(dbp))
+ memset(&db_key, '\0', sizeof db_key);
+ memset(&db_value, '\0', sizeof db_value);
+
+ result = database->smdb_cursor(database, &cursor, 0);
+ if (result != SMDBE_OK)
+ {
+ fprintf(stderr, "praliases: %s: set cursor: %s\n",
+ db_name, errstring(result));
+ goto fatal;
+ }
+
+ while ((result = cursor->smdbc_get(cursor, &db_key, &db_value,
+ SMDB_CURSOR_GET_NEXT)) ==
+ SMDBE_OK)
+ {
+#if 0
+ /* skip magic @:@ entry */
+ if (db_key.data.size == 2 &&
+ db_key.data.data[0] == '@' &&
+ db_key.data.data[1] == '\0' &&
+ db_value.data.size == 2 &&
+ db_value.data.data[0] == '@' &&
+ db_value.data.data[1] == '\0')
+ continue;
+#endif /* 0 */
+
+ printf("%.*s:%.*s\n",
+ (int) db_key.data.size,
+ (char *) db_key.data.data,
+ (int) db_value.data.size,
+ (char *) db_value.data.data);
+ }
+
+ if (result != SMDBE_OK && result != SMDBE_LAST_ENTRY)
{
- content = dbm_fetch(dbp, key);
- (void)printf("%.*s:%.*s\n",
- (int) key.dsize, key.dptr,
- (int) content.dsize, content.dptr);
+ fprintf(stderr,
+ "praliases: %s: get value at cursor: %s\n",
+ db_name, errstring(result));
+ goto fatal;
}
}
- else
+ else for (; *argv != NULL; ++argv)
{
- for (; *argv; ++argv)
+ memset(&db_key, '\0', sizeof db_key);
+ memset(&db_value, '\0', sizeof db_value);
+ db_key.data.data = *argv;
+ db_key.data.size = strlen(*argv) + 1;
+ if (database->smdb_get(database, &db_key,
+ &db_value, 0) == SMDBE_OK)
{
- /*
- ** Use the sendmail adaptive algorithm of trying
- ** the key first without, then if needed with,
- ** the terminating NULL byte.
- */
- key.dptr = *argv;
- key.dsize = strlen(*argv);
- content = dbm_fetch(dbp, key);
- if (content.dptr == NULL)
- {
- key.dsize++;
- content = dbm_fetch(dbp, key);
- }
- if (content.dptr != NULL)
- (void)printf("%s:%.*s\n", key.dptr,
- (int) content.dsize, content.dptr);
- else
- (void)printf("%s: No such key\n", key.dptr);
+ printf("%.*s:%.*s\n",
+ (int) db_key.data.size,
+ (char *) db_key.data.data,
+ (int) db_value.data.size,
+ (char *) db_value.data.data);
}
+ else
+ printf("%s: No such key\n", (char *) db_key.data.data);
}
- dbm_close(dbp);
-}
-#endif
-#if !HASSTRERROR
+ fatal:
+ if (cursor != NULL)
+ (void) cursor->smdbc_close(cursor);
+ if (database != NULL)
+ (void) database->smdb_close(database);
+ if (colon != NULL)
+ *colon = ':';
+ return;
+}
-char *
-strerror(eno)
- int eno;
+/*VARARGS1*/
+void
+#ifdef __STDC__
+message(const char *msg, ...)
+#else /* __STDC__ */
+message(msg, va_alist)
+ const char *msg;
+ va_dcl
+#endif /* __STDC__ */
{
- extern int sys_nerr;
- extern char *sys_errlist[];
- static char ebuf[60];
-
- if (eno >= 0 && eno < sys_nerr)
- return sys_errlist[eno];
- (void) sprintf(ebuf, "Error %d", eno);
- return ebuf;
+ const char *m;
+ VA_LOCAL_DECL
+
+ m = msg;
+ if (isascii(m[0]) && isdigit(m[0]) &&
+ isascii(m[1]) && isdigit(m[1]) &&
+ isascii(m[2]) && isdigit(m[2]) && m[3] == ' ')
+ m += 4;
+ VA_START(msg);
+ (void) vfprintf(stderr, m, ap);
+ VA_END;
+ (void) fprintf(stderr, "\n");
}
-#endif /* !HASSTRERROR */
+/*VARARGS1*/
+void
+#ifdef __STDC__
+syserr(const char *msg, ...)
+#else /* __STDC__ */
+syserr(msg, va_alist)
+ const char *msg;
+ va_dcl
+#endif /* __STDC__ */
+{
+ const char *m;
+ VA_LOCAL_DECL
+
+ m = msg;
+ if (isascii(m[0]) && isdigit(m[0]) &&
+ isascii(m[1]) && isdigit(m[1]) &&
+ isascii(m[2]) && isdigit(m[2]) && m[3] == ' ')
+ m += 4;
+ VA_START(msg);
+ (void) vfprintf(stderr, m, ap);
+ VA_END;
+ (void) fprintf(stderr, "\n");
+}
OpenPOWER on IntegriCloud