114062Swpaul#!/bin/sh
214062Swpaul#
314062Swpaul# This script is invoked by rpc.yppasswdd to update the password
414062Swpaul# maps after the master password file has been modified. It expects
514062Swpaul# to be passed two arguments: the name of the master.passwd template
614062Swpaul# file that was modified by the server, and the name of the domain to
714062Swpaul# update. These are passed to /var/yp/Makefile.
814062Swpaul#
914062Swpaul# Comment out the LOG=yes line to disable logging.
1014062Swpaul#
1150479Speter# $FreeBSD$
1214062Swpaul#
1314062Swpaul
1419412SwoschPATH=/bin:/usr/bin; export PATH
1514062SwpaulLOG=yes
1614062SwpaulLOGFILE=/var/yp/ypupdate.log
1714062Swpaul
1814062Swpaulumask 077
1914062Swpaul
2014062Swpaulif [ ! -f $LOGFILE ];
2114062Swpaulthen
2219412Swosch	touch $LOGFILE
2314062Swpaul	echo "# Edit /usr/libexec/yppwupdate to disable" >> $LOGFILE
2414062Swpaul	echo "# logging to this file from yppasswdd." >> $LOGFILE
2514062Swpaul	echo -n "# Log started on: " >> $LOGFILE
2619412Swosch	date >> $LOGFILE
2714062Swpaulfi
2814062Swpaul
2914062Swpaulif [ ! $LOG ];
3014062Swpaulthen
3119412Swosch	cd /var/yp && make MASTER_PASSWD=$1 UPDATE_DOMAIN=$2 $3 2>&1
3214062Swpaulelse
3319412Swosch	cd /var/yp && make MASTER_PASSWD=$1 UPDATE_DOMAIN=$2 $3 >> $LOGFILE 2>&1
3414062Swpaulfi
35