#! /bin/ksh
#
# Check all local filesystems for setuid/setgid permissions.
#
# Version: 1994/08/02.
#
#
# Load the system-dependent parameters.
#
if [ -f /usr/local/bin/Getsystemoptions ]; then
   . /usr/local/bin/Getsystemoptions
else
   echo "*** $0 can't find /usr/local/bin/Getsystemoptions ***"
   exit 1
fi
#
# Get the list of local file systems.
#
if [ -x /usr/local/bin/Getlocalfs ]; then
   srchpaths="`/usr/local/bin/Getlocalfs $dirlist | sort`"
else
   echo "*** $0 can't find /usr/local/bin/Getlocalfs ***"
   exit 1
fi
#
# Check that all NFS file systems are available, if possible.
#
if [ -x /usr/local/bin/Getnfsdownlist ]; then
   nfsdownlist="`/usr/local/bin/Getnfsdownlist`"
   if [ "$nfsdownlist" != "" ]; then
      echo "*** $0 finds NFS servers are down ***"
      for n in $nfsdownlist
      do
	 echo $n
      done
      $mail -s "$basecommand on $host found NFS servers down" $admin <<EOF1
$basecommand on $host found the following NFS servers are down:

`echo $nfsdownlist`

The $basecommand command was not run - run it manually when all
NFS servers are up.
EOF1
      exit 1
   fi
fi
#
# Loop over the directories, making a file list.
#
for d in $srchpaths
do
   find $d \( -perm -4000 -o -perm -2000 \) ! -type d $findopts \
    -exec ls ${lsopts}d {} \;
done
#
exit 0
