home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
c
/
cops_104.zip
/
cops_104
/
docs
/
readme.C2
/
passwd.chk
< prev
next >
Wrap
Text File
|
1992-03-10
|
2KB
|
85 lines
#!/bin/sh
#
# passwd.chk
#
# Check passsword file -- /etc/passswd -- for incorrect number of fields,
# duplicate uid's, non-alphanumeric uids, and non-numeric group id's.
#
#
ECHO=/bin/echo
RM=/bin/rm
TEST=/bin/test
YPCAT=/usr/bin/ypcat
#
# Enhanced Security Features added by Pete Troxell:
#
# Used for Sun C2 security password adjunct file. FALSE (default) will flag
# valid SUN C2 passwd syntax as an error, TRUE attempts to validate it. When
# using this option, the script must be executed as root or su since the file
# /etc/security/passwd.adjunct is read protected from everybody except root.
#
SUN_SECURITY=FALSE
#
# Enable/Disable testing of the Yellow Pages password file(s)
#
TEST_YP=FALSE
#
# Important files:
#
etc_passwd=/etc/passwd
etc_secure_passwd=/etc/security/passwd.adjunct
yp_passwd=./pwd$$
yp_secure_passwd=./spwd$$
yp=false
yp_secure=false
#
# Testing $yp_passwd for potential problems....
#
if $TEST -f $YPCAT -a $TEST_YP = "TRUE"
then
if $TEST -s $YPCAT
then
$YPCAT passwd > $yp_passwd 2>/dev/null
if $TEST $? -eq 0
then
yp=true
fi
if $TEST $yp = "true" -a $SUN_SECURITY = "TRUE"
then
$YPCAT -t passwd.adjunct.byname > $yp_secure_passwd 2>/dev/null
if $TEST $? -eq 0
then
yp_secure=true
fi
fi
fi
fi
#
# Test the system password file
#
passwd.file.chk $etc_passwd $etc_secure_passwd $SUN_SECURITY
#
# Test yellow pages password file
#
if $TEST "$yp" = "true"
then
$ECHO
$ECHO "***** Testing the Yellow Pages password file(s) *****"
$ECHO
passwd.file.chk $yp_passwd $yp_secure_passwd $SUN_SECURITY
fi
#
# Clean up after ourselfs
#
$RM -f $yp_passwd
$RM -f $yp_secure_passwd
# end