#!/bin/sh
#
#  Usage: findsuid
#
# Adapted for Apollo SR10.1 6/15/90
# By Mark C. DiVecchio
#    Silogic Systems
#    619-549-9841
#
# This script searches all files on a node looking for files with
# the suid bit on. The long ls listing is saved in a file named
# stop.nodeid.
#
# This stop file is then used as input to suid.chk program.
#
# This script should be run once. It should be run as root to make sure
# that all directories can be searched.
#
######################<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#  Change these lines!
######################
SECURE_USERS="mcd"
SECURE=/usr/mcd/cops
######################<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
#
#
SEARCH=/
#
TEST=/bin/test
ECHO=/bin/echo
SH=/bin/sh
LS=/bin/ls
CAT=/bin/cat
MAIL=/usr/ucb/mail
CHMOD=/bin/chmod
SORT=/usr/bin/sort
COMM=/bin/comm
FIND=/usr/bin/find
RM=/bin/rm

# where am I?	(Thanks to arbitron for this idea...)
NODE=`/bin/sh -c "/bin/uname -n || /usr/bin/uuname -l || /bin/hostname" 2>&-`

STOP=./stop.$NODE

umask 077
OLDCWD=`pwd`

if $TEST ! -d "$SECURE"
	then
	$ECHO "Error -- Security directory $SECURE doesn't exist"
	exit 1
fi

$CHMOD 700 $SECURE
cd $SECURE

$ECHO Output to $STOP

# find the setuid programs and sort
$FIND $SEARCH \( -perm -4000 -o -perm -2000 \) -exec $LS -lga {} \; | \
	$SORT > $STOP

$MAIL $SECURE_USERS <$STOP
$CHMOD 600 $STOP
