#!/bin/sh
#
#  NeXT module for bug/vulnerability checking
#
ECHO=/bin/echo
TEST=test
LS=/bin/ls
LS_OPTS="-slagL"
ARCH=/bin/arch
GREP=/bin/grep
AWK=/bin/awk
BUG="$AWK -f ./bug_cmp"
word_smithing="could have a hole/bug"

if $TEST ! -f ./bug_cmp ; then
	$ECHO "Must have bug compare module, ./bug_cmp, to run..."
	exit 2
	fi
# what is the date?  We just need the month and year...
# Format: Fri Feb  7 14:16:55 PST 1992
if $TEST $# -eq "2" ; then
        real_date="$1 $2"
else
        real_date=`$DATE | $AWK '{print $2, $NF}'`
        fi

# /usr/etc/restore0.9
#
restore=/usr/etc/restore0.9
(./is_able $restore s s | $GREP SUID )> /dev/null 2>/dev/null
if $TEST $? -eq "0" ; then
	$ECHO "Warning!  $restore $word_smithing!  (CA-90:06a)"
	fi

# npd (printer problem)
#
# NeXT machines running 1.0 and 1.0a
npd="/usr/lib/NextPrinter/npd"
fix_date="3 Oct 1990"
cert_advis="CA-90:06a"
if $TEST -f "$npd" ; then
	cur_date=`$LS $LS_OPTS $npd | $AWK '{print $8, $7, $9}'`
	$ECHO $npd $fix_date $cur_date $cert_advis $real_date | $BUG
	fi

# /NextApps/BuildDisk
#
# NeXT machines running 1.0 and 1.0a
#
# FIX -- "chmod 4700 /NextApps/BuildDisk"
#
build_disk="/NextApps/BuildDisk"
fix_date="3 Oct 1990"
cert_advis="CA-90:06a"
#
# Can anyone execute it?
($LS $LS_OPTS $build_disk | $GREP ...x..x..x ) > /dev/null 2>/dev/null

# if so, check date, etc...
if $TEST $? -eq "0" ; then
	cur_date=`$LS $LS_OPTS $build_disk | $AWK '{print $8, $7, $9}'`
        $ECHO "Warning!  $build_dist $word_smithing! ($cert_advis)"
        fi

# /private/etc
#
# NeXT machines running 2.0 and 2.1
#
# FIX -- chmod g-w /private/etc
#
private="/private/etc"
fix_date="14 May 1991"
cert_advis="CA-91:06"
#
# Can group write to it?
($LS $LS_OPTS $private | $GREP drwx..w... ) > /dev/null 2>/dev/null

# if so, check date, etc...
if $TEST $? -eq "0" ; then
        $ECHO "Warning!  $private $word_smithing! ($cert_advis)"
	fi

# finis
