/usr/lib/courier/makealiases is in courier-mta 0.68.2-1ubuntu7.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | #! /bin/bash
#
#
# Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
# distribution information.
#
# Script to create the alias database
# (usually ${sysconfdir}/aliases.dat)
#
# The alias database text is usually
# ${sysconfdir}/aliases
#
# This can be either a file, or a directory. If it's a directory, all files
# in the directory are concatenated together, and the database is created
# as the result.
#
# Use -alias=foo to use "foo" instead of
# ${sysconfdir}/aliases.dat
#
# Use -src=bar to use "bar" instead of
# ${sysconfdir}/aliases
#
# Use -dump to print the raw database, without creating anything.
#
# A temporary file is used, usually
# /var/lib/courier/tmp/aliases.tmp.
# It must be on the same filesystem as aliases.dat. If -alias is used to
# point to another filesystem, specify -tmp=filename.
# Since /var/lib/courier/tmp is not globally writeable,
# -tmp must be used if a non-root runs makealiases (with other options,
# for testing purposes, perhaps).
#
# Use -chk AFTER aliases.dat has been created, with the same arguments,
# to check if the aliases include any bad addresses.
umask 002
prefix="/usr"
exec_prefix="/usr"
sysconfdir="/etc/courier"
libexecdir="${prefix}/lib/courier"
localstatedir="/var/lib/courier"
aliassrc=""
aliastmp=""
aliasdump=""
aliasalias=""
module=""
protocol=""
xaliasdir=""
xaliastmpdir=""
aliasdir="aliasdir"
usage() {
echo "Usage: $0 [ options ] module" >&2
exit 1
}
while test $# -gt 0
do
case $1 in
-src=*)
aliassrc="$1"
shift
;;
-tmp=*)
aliastmp="$1"
shift
;;
-dump)
aliasdump="$1"
shift
;;
-alias=*)
aliasalias="$1"
shift
;;
-xaliasdir=*)
aliasdir="$1"
shift
;;
-xaliastmpdir=*)
xaliastmpdir="$1"
shift
;;
-protocol=*)
protocol="$1"
shift
;;
-chk)
dochk=1
shift
;;
-*)
usage
;;
*)
module="$1"
break
;;
esac
done
xaliaspfix="-xaliaspfix=.xalias/"
if test "$protocol" != ""
then
protocol="`echo $protocol | sed 's/^..........//'`"
if test ! -d "${libexecdir}/courier/modules/$protocol"
then
echo "$protocol is not a valid protocol."
exit 1
fi
if test "$aliastmp" = ""
then
aliastmp="-tmp=${sysconfdir}/aliases-$protocol.tmp"
fi
if test "$aliassrc" = ""
then
aliassrc="-src=${sysconfdir}/aliases-$protocol"
fi
if test "$aliasdump$aliasalias" = ""
then
aliasalias="-alias=${sysconfdir}/aliases-$protocol.dat"
fi
if test "$xaliasdir" = ""
then
xaliasdir="-xaliasdir=${sysconfdir}/$aliasdir/.courier-:xalias-$protocol"
fi
if test "$xaliastmpdir" = ""
then
xaliastmpdir="-xaliastmpdir=${sysconfdir}/$aliasdir/courier-:xalias-$protocol.tmp"
fi
xaliaspfix="-xaliaspfix=.xalias-$protocol/"
fi
if test "$module" = ""
then
module='local'
fi
if test "$aliastmp" = ""
then
aliastmp="-tmp=${sysconfdir}/aliases.tmp"
fi
if test "$aliassrc" = ""
then
aliassrc="-src=${sysconfdir}/aliases"
fi
if test "$aliasdump$aliasalias" = ""
then
aliasalias="-alias=${sysconfdir}/aliases.dat"
fi
if test "$xaliasdir" = ""
then
xaliasdir="-xaliasdir=${sysconfdir}/$aliasdir/.courier-:xalias"
fi
if test "$xaliastmpdir" = ""
then
xaliastmpdir="-xaliastmpdir=${sysconfdir}/$aliasdir/courier-:xalias.tmp"
fi
get_aliases() {
aliasdir="$aliassrc"
aliasdir="`echo $aliasdir | sed 's/^.....//'`"
if test -d "$aliasdir"
then
for f in $aliasdir/*
do
if test -f $f
then
echo "##MaKeAlIaSeS##$f"
# Hack, hack, hack...
cat $f
fi
done | ${prefix}/lib/courier/courier/aliasexp $xaliaspfix $xaliastmpdir $module
else
${prefix}/lib/courier/courier/aliasexp $xaliaspfix $xaliastmpdir $aliassrc $module
fi
}
if test "$dochk" = 1
then
rm -f ${localstatedir}/tmp/aliaschk.tmp
xaliasdir=""
xaliastmpdir=""
get_aliases | ${prefix}/lib/courier/courier/aliascombine | \
${prefix}/lib/courier/courier/aliascreate \
-tmp=${localstatedir}/tmp/aliaschk.tmp -dump=1 | \
sed 's/.*: / /' | sort | uniq |
while read ADDR
do
test "$ADDR" = "" && continue
ERR=""`${prefix}/lib/courier/courier/submit -vrfy="$ADDR" \
$module 'unknown; unknown' `
if test $? != 0
then
echo "<$ADDR>: $ERR"
>${localstatedir}/tmp/aliaschk.tmp
fi
done
test -f ${localstatedir}/tmp/aliaschk.tmp || exit 0
rm -f ${localstatedir}/tmp/aliaschk.tmp
exit 1
else
tmpdir="`echo \"$xaliastmpdir\" | sed 's/^..............//'`"
dir="`echo \"$xaliasdir\" | sed 's/^...........//'`"
rm -rf $tmpdir
get_aliases | ${prefix}/lib/courier/courier/aliascombine | \
${prefix}/lib/courier/courier/aliascreate $aliastmp $aliasdump $aliasalias
rc=$?
if test "$rc" != 0
then
rm -rf $tmpdir
exit $rc
fi
# Now carefully update the extended alias entries
for f in $dir/*
do
test -f "$f" || continue
f=`basename "$f"`
test -f "$tmpdir/$f" || rm -f "$dir/$f" || exit 1
done
for f in $tmpdir/*
do
test -d "$dir" || mkdir "$dir" || exit 1
test ! -f "$f" || mv -f "$f" "$dir" || exit 1
done
test ! -d "$tmpdir" || rmdir "$tmpdir" || exit 1
rmdir $dir 2>/dev/null
fi
exit 0
|