summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-10-20 16:27:17 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-10-20 16:27:17 +0000
commit5896df0eec8b2814e62190951bfdd3d11ef7d2e3 (patch)
tree4f1052e40897b6fd49a8f6892c3d134a05b40c67
parentb74faca34f3414d1210c4465253660312744b53c (diff)
Since sh's bulitin echo(1) supports /t and /n there is no reason to
use printf(1) here. This way there is no possibility of format string problems and we use a shell builtin instead of an external command.
-rw-r--r--etc/security104
1 files changed, 52 insertions, 52 deletions
diff --git a/etc/security b/etc/security
index 86a7943b61f..c15a2c6c41d 100644
--- a/etc/security
+++ b/etc/security
@@ -1,6 +1,6 @@
#!/bin/sh -
#
-# $OpenBSD: security,v 1.40 2000/10/18 16:45:27 hugh Exp $
+# $OpenBSD: security,v 1.41 2000/10/20 16:27:16 millert Exp $
# from: @(#)security 8.1 (Berkeley) 6/9/93
#
@@ -17,7 +17,7 @@ LIST=$DIR/_secure5
OUTPUT=$DIR/_secure6
if ! mkdir $DIR ; then
- printf "tmp directory %s already exists, looks like:\n" $DIR
+ echo "tmp directory ${DIR} already exists, looks like:"
ls -alqF $DIR
exit 1
fi
@@ -60,20 +60,20 @@ awk -F: '{
printf("Login %s has a negative group ID.\n", $1);
}' < $MP > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "\nChecking the %s file:\n" "$MP"
+ echo "\nChecking the ${MP} file:"
cat $OUTPUT
fi
awk -F: '{ print $1 }' $MP | sort | uniq -d > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "\n%s has duplicate user names.\n" "$MP"
+ echo "\n${MP} has duplicate user names."
column $OUTPUT
fi
awk -F: '{ print $1 " " $3 }' $MP | sort -n +1 | tee $TMP1 |
uniq -d -f 1 | awk '{ print $2 }' > $TMP2
if [ -s $TMP2 ] ; then
- printf "\n%s has duplicate user ID's.\n" "$MP"
+ echo "\n${MP} has duplicate user ID's."
while read uid; do
grep -w $uid $TMP1
done < $TMP2 | column
@@ -120,13 +120,13 @@ awk -F: '{
printf("Login %s has a negative group ID.\n", $1);
}' < $GRP > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "\nChecking the %s file:\n" "$GRP"
+ echo "\nChecking the ${GRP} file:"
cat $OUTPUT
fi
awk -F: '{ print $1 }' $GRP | sort | uniq -d > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "\n%s has duplicate group names.\n" "$GRP"
+ echo "\n${GRP} has duplicate group names."
column $OUTPUT
fi
@@ -173,12 +173,12 @@ end-of-csh
fi
done
if [ $umaskset = "no" -o -s $OUTPUT ] ; then
- printf "\nChecking root csh paths, umask values:\n%s\n" "$list"
+ echo "\nChecking root csh paths, umask values:\n${list}"
if [ -s $OUTPUT ] ; then
cat $OUTPUT
fi
if [ $umaskset = "no" ] ; then
- printf "\nRoot csh startup files do not set the umask.\n"
+ echo "\nRoot csh startup files do not set the umask."
fi
fi
@@ -227,12 +227,12 @@ end-of-sh
fi
done
if [ $umaskset = "no" -o -s $OUTPUT ] ; then
- printf "\nChecking root sh paths, umask values:\n%s\n" "$list"
+ echo "\nChecking root sh paths, umask values:\n${list}"
if [ -s $OUTPUT ] ; then
cat $OUTPUT
fi
if [ $umaskset = "no" ] ; then
- printf "\nRoot sh startup files do not set the umask.\n"
+ echo "\nRoot sh startup files do not set the umask."
fi
fi
@@ -279,7 +279,7 @@ end-of-sh
done
)
if [ -s $OUTPUT ] ; then
- printf "\nChecking root ksh paths, umask values:\n%s\n" "$list"
+ echo "\nChecking root ksh paths, umask values:\n${list}"
cat $OUTPUT
fi
@@ -287,17 +287,17 @@ fi
if egrep root /etc/ftpusers > /dev/null ; then
:
else
- printf "\nRoot not listed in /etc/ftpusers file.\n"
+ echo "\nRoot not listed in /etc/ftpusers file."
fi
if egrep uucp /etc/ftpusers > /dev/null ; then
:
else
- printf "\nUucp not listed in /etc/ftpusers file.\n"
+ echo "\nUucp not listed in /etc/ftpusers file."
fi
# Uudecode should not be in the /etc/mail/aliases file.
if egrep 'uudecode|decode' /etc/mail/aliases; then
- printf "\nThere is an entry for uudecode in the /etc/mail/aliases file.\n"
+ echo "\nThere is an entry for uudecode in the /etc/mail/aliases file."
fi
# Files that should not have + signs.
@@ -324,12 +324,12 @@ while read uid homedir; do
# Root owned .rhosts/.shosts files are ok.
if [ -s ${homedir}/$j -a ! -O ${homedir}/$j ] ; then
rhost=`ls -ldgT ${homedir}/$j`
- printf "%s: %s\n" "$uid" "$rhost"
+ echo "${uid}: ${rhost}"
fi
done
done > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "\nChecking for special users with .rhosts/.shosts files.\n"
+ echo "\nChecking for special users with .rhosts/.shosts files."
cat $OUTPUT
fi
@@ -348,7 +348,7 @@ while read uid homedir; do
done
done > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "\nChecking .rhosts/.shosts files syntax.\n"
+ echo "\nChecking .rhosts/.shosts files syntax."
cat $OUTPUT
fi
@@ -358,7 +358,7 @@ awk -F: '/^[^+-]/ { print $1 " " $6 }' /etc/passwd | \
while read uid homedir; do
if [ -d ${homedir}/ ] ; then
file=`ls -ldgT ${homedir}`
- printf "%s %s\n" "$uid" "$file"
+ echo "${uid} ${file}"
fi
done |
awk '$1 != $4 && $4 != "root" \
@@ -368,7 +368,7 @@ awk '$1 != $4 && $4 != "root" \
$2 ~ /^-.......w/ \
{ print "user " $1 " home directory is other writeable" }' > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "\nChecking home directories.\n"
+ echo "\nChecking home directories."
cat $OUTPUT
fi
@@ -379,7 +379,7 @@ while read uid homedir; do
for f in $list ; do
file=${homedir}/${f}
if [ -f $file ] ; then
- printf "%s %s %s\n" "$uid" "$f" "`ls -ldgT $file`"
+ echo "${uid} ${f} `ls -ldgT ${file}`"
fi
done
done |
@@ -405,7 +405,7 @@ while read uid homedir; do
for f in $list ; do
file=${homedir}/${f}
if [ -f $file ] ; then
- printf "%s %s %s\n" "$uid" "$f" "`ls -ldgT $file`"
+ echo "${uid} ${f} `ls -ldgT ${file}`"
fi
done
done |
@@ -416,7 +416,7 @@ awk '$1 != $5 && $5 != "root" \
$3 ~ /^-.......w/ \
{ print "user " $1 " " $2 " file is other writeable" }' >> $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "\nChecking dot files.\n"
+ echo "\nChecking dot files."
cat $OUTPUT
fi
@@ -427,7 +427,7 @@ awk '$3 != $9 \
$1 != "-rw-------" \
{ print "user " $9 " mailbox is " $1 ", group " $4 }' > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "\nChecking mailbox ownership.\n"
+ echo "\nChecking mailbox ownership."
cat $OUTPUT
fi
@@ -449,7 +449,7 @@ if [ -s /etc/exports ] ; then
print "File system " $1 " globally exported, read-write."
}' < /etc/exports > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "\nChecking for globally exported file systems.\n"
+ echo "\nChecking for globally exported file systems."
cat $OUTPUT
fi
fi
@@ -464,10 +464,10 @@ pending="\nChecking setuid/setgid files and devices:\n"
# Display any errors that occurred during system file walk.
if [ -s $OUTPUT ] ; then
- printf "%sSetuid/device find errors:\n" "$pending"
+ echo "${pending}Setuid/device find errors:"
pending=
cat $OUTPUT
- printf "\n"
+ echo ""
fi
# Display any changes in the setuid/setgid file list.
@@ -475,7 +475,7 @@ egrep -v '^[bc]' $LIST > $TMP1
if [ -s $TMP1 ] ; then
# Check to make sure uudecode isn't setuid.
if grep -w uudecode $TMP1 > /dev/null ; then
- printf "%s\nUudecode is setuid.\n" "$pending"
+ echo "${pending}\nUudecode is setuid."
pending=
fi
@@ -489,37 +489,37 @@ if [ -s $TMP1 ] ; then
> $TMP2
join -110 -210 -v2 $CUR $TMP1 > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "%sSetuid additions:\n" "$pending"
+ echo "${pending}Setuid additions:"
pending=
tee -a $TMP2 < $OUTPUT
- printf "\n"
+ echo ""
fi
join -110 -210 -v1 $CUR $TMP1 > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "%sSetuid deletions:\n" "$pending"
+ echo "${pending}Setuid deletions:"
pending=
tee -a $TMP2 < $OUTPUT
- printf "\n"
+ echo ""
fi
sort +9 $TMP2 $CUR $TMP1 | \
sed -e 's/[ ][ ]*/ /g' | uniq -u > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "%sSetuid changes:\n" "$pending"
+ echo "${pending}Setuid changes:"
pending=
column -t $OUTPUT
- printf "\n"
+ echo ""
fi
cp $CUR $BACK
cp $TMP1 $CUR
fi
else
- printf "%sSetuid additions:\n" "$pending"
+ echo "${pending}Setuid additions:"
pending=
column -t $TMP1
- printf "\n"
+ echo ""
cp $TMP1 $CUR
fi
fi
@@ -537,9 +537,9 @@ awk '$3 != "root" || $4 != "operator" || $1 !~ /.rw-r-----/ \
{ printf("Disk %s is user %s, group %s, permissions %s.\n", \
$11, $3, $4, $1); }' < $TMP1 > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "\nChecking disk ownership and permissions.\n"
+ echo "\nChecking disk ownership and permissions."
cat $OUTPUT
- printf "\n"
+ echo ""
fi
# Display any changes in the device file list.
@@ -555,16 +555,16 @@ if [ -s $TMP1 ] ; then
> $TMP2
join -111 -211 -v2 $CUR $TMP1 > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "Device additions:\n"
+ echo "Device additions:"
tee -a $TMP2 < $OUTPUT
- printf "\n"
+ echo ""
fi
join -111 -211 -v1 $CUR $TMP1 > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "Device deletions:\n"
+ echo "Device deletions:"
tee -a $TMP2 < $OUTPUT
- printf "\n"
+ echo ""
fi
# Report any block device change. Ignore character
@@ -575,18 +575,18 @@ if [ -s $TMP1 ] ; then
sed -e 's/[ ][ ]*/ /g' | \
uniq -u > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "Block device changes:\n"
+ echo "Block device changes:"
column -t $OUTPUT
- printf "\n"
+ echo ""
fi
cp $CUR $BACK
cp $TMP1 $CUR
fi
else
- printf "Device additions:\n"
+ echo "Device additions:"
column -t $TMP1
- printf "\n"
+ echo ""
cp $TMP1 $CUR
fi
fi
@@ -608,9 +608,9 @@ if [ -d /etc/mtree ] ; then
cd /etc/mtree
mtree -e -p / -f /etc/mtree/special > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "\nChecking special files and directories.\n"
- printf "Output format is:\n\tfilename:\n"
- printf "\t\tcriteria (shouldbe, reallyis)\n"
+ echo "\nChecking special files and directories."
+ echo "Output format is:\n\tfilename:"
+ echo "\t\tcriteria (shouldbe, reallyis)"
cat $OUTPUT
fi
@@ -620,12 +620,12 @@ if [ -d /etc/mtree ] ; then
tree=`sed -n -e '3s/.* //p' -e 3q $file`
mtree -f $file -p $tree > $TMP1
if [ -s $TMP1 ] ; then
- printf "\nChecking %s:\n" "$tree" >> $OUTPUT
+ echo "\nChecking ${tree}:" >> $OUTPUT
cat $TMP1 >> $OUTPUT
fi
done
if [ -s $OUTPUT ] ; then
- printf "\nChecking system binaries:\n"
+ echo "\nChecking system binaries:"
cat $OUTPUT
fi
else
@@ -646,7 +646,7 @@ if [ -s /etc/changelist ] ; then
if [ -s $CUR ] ; then
diff $CUR $file > $OUTPUT
if [ -s $OUTPUT ] ; then
- printf "\n======\n%s diffs (OLD < > NEW)\n======\n" $file
+ echo "\n======\n${file} diffs (OLD < > NEW)\n======"
cat $OUTPUT
cp -p $CUR $BACK
cp -p $file $CUR