:
#	@(#) authckrc.sh 23.6 92/01/16 
#
#	Copyright (C) 1989-1992 The Santa Cruz Operation, Inc.
#		All Rights Reserved.
#	The information in this file is provided for the exclusive use of
#	the licensees of The Santa Cruz Operation, Inc.  Such users have the
#	right to use, modify, and incorporate this code into other products
#	for purposes authorized by the license agreement provided they include
#	this notice and the associated copyright notice with any such product.
#	The information in this file is provided "AS IS" without warranty.
#
# Begin SCO_C2TCB

# check if tcb files are required
if /bin/grep "^TCBFILES=OFF" /etc/default/security >/dev/null 2>&1
then
 	exit 0
fi

echo "Checking tcb ..."
/etc/tcbck || {
	echo "$0: Login on the OVERRIDE tty and restore
	the missing files from a backup or the distribution disks."
}

AUTHCKLOG=/tcb/files/authcklog

/bin/cp /dev/null "$AUTHCKLOG"
/bin/chmod 640 "$AUTHCKLOG"
/bin/chgrp auth "$AUTHCKLOG"

if /bin/grep "u_integrity@" /etc/auth/system/default >/dev/null 2>&1
then
	AUTHCKFLG="-y"
	AUTHCKOUT=">> $AUTHCKLOG 2>&1"
elif [ "X$1" = "X-a" ]
then	AUTHCKFLG="-y"
	AUTHCKOUT="2>&1 | /bin/tee -a $AUTHCKLOG"
else	AUTHCKFLG=""
	AUTHCKOUT=""
fi

# check for users in /etc/passwd who do not have protected password entries

echo "Checking auth database ..."
/bin/su root -c "/tcb/bin/authck -p $AUTHCKFLG $AUTHCKOUT"

# check subsystem database integrity

echo "Checking protected subsystem database ..."
/bin/su root -c "/tcb/bin/authck -s $AUTHCKFLG $AUTHCKOUT"

# check for ttys in /etc/inittab which do not appear in the 
# terminal control database

echo "Checking ttys database ..."
/bin/su root -c "/tcb/bin/ttyupd $AUTHCKOUT"

# End SCO_C2TCB

