/usr/lib/yp/pwupdate is in nis 3.17-32ubuntu6.
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 | #!/bin/bash
# pwupdate - update NIS passwd maps.
# Copyright (C) 1997, 1998 Thorsten Kukuk
# (C) 1994 Olaf Kirch, <okir@monad.swb.de>
# This software is covered by the GNU GPL.
#
# This script is invoked by rpc.yppasswdd after changing the password in
# /etc/shadow or /etc/passwd and it should update the passwd.* and shadow.*
# maps for all domains served by this host.
# We make a feeble attempt at locking, so as to avoid concurrent builds on
# the databases. However, this locking does _not_ guard us against the
# NIS maintainer running make while we build our maps.
### variables
YPMAPDIR=/var/yp
# Use lock in YPMAPDIR, for security (guessable temp file name).
# We should use the system lock directory (eg /var/lock) and a safer
# locking method instead.
tmp=$YPMAPDIR/ypwd.upd.$$
lock=$YPMAPDIR/yppasswd.lock
mailinfo ()
{
if [ -x /bin/mailx -o /usr/bin/mailx ]; then
mailx -s "$1" $2
else
(echo "Subject: $1"; echo; cat) | /usr/sbin/sendmail $2
fi
}
echo $$ > $tmp
i=0;
while ! ln $tmp $lock; do
sleep 10;
i=`expr $i + 1`;
if [ $i -gt 60 ]; then
echo "NIS passwd maps seem permanently locked" |
mailinfo "Could not remake NIS passwd.* maps" root
rm -f $tmp
exit 2
fi
done
# Use temp files in YPMAPDIR, for security (guessable temp file name)
mtemp=$YPMAPDIR/ypw.tmp.$$
merr=$YPMAPDIR/ypw.err.$$
domain=`domainname`
cd $YPMAPDIR
for dir in *; do
if [ -d $dir -a "$dir" != "binding" ]; then
(
# Find out where the Makefile is.
# If this directory does not have its own Makefile, and
# it is not our default domain directory, skip it.
if [ -f $dir/Makefile ]; then
makefile=Makefile
else
[ "$dir" != "$domain" ] && continue
makefile=../Makefile
fi
cd $dir &&
if ! /usr/bin/make -f $makefile -k passwd > $mtemp 2>&1; then
echo "Errors in `pwd`:"
cat $mtemp
echo
fi >> $merr
if [ $1x = "shadow"x ]; then
if ! /usr/bin/make -f $makefile -k shadow > $mtemp 2>&1; then
echo "Errors in `pwd`:"
cat $mtemp
echo
fi >> $merr
fi
)
fi
done
if [ -s $merr ]; then
(
echo "The following errors occurred while remaking the NIS passwd maps"
echo
cat $merr
) | mailinfo "Errors while remaking NIS passwd.* maps" root
fi
rm -f $mtemp $merr
rm -f $tmp $lock
|