1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
#!/bin/sh
#
# tiger - A UN*X security checking system
# Copyright (C) 1993 Douglas Lee Schales, David K. Hess, David R. Safford
#
# Please see the file `COPYING' for the complete copyright notice.
#
# util/getpermit - 04/22/93
#
# 04/28/93 dls Added '-L' to 'ls' to get permissions from file instead of
# symbolic link.
#
#-----------------------------------------------------------------------------
#
LS=/bin/ls
AWK=/bin/awk
LSLINK=-L
lgetpermit()
{
file="$1"
saveifs=$IFS
IFS=/
set $file
IFS=$saveifs
path=
for comp
do
[ -n "$comp" ] && {
path="$path/$comp"
$LS $LSLINK -ld "$path"
}
done |
$AWK '
BEGIN {
split("0 0 0 0 0 0 0 0 0", perm, " ");
}
{
for(i=2;i<11;i++){
c = substr($1, i, 1);
if(c != "-" && c != "S" && c != "T"){
perm[i-2] = "1";
}
}
}
END {
for(i=0;i<9;i++)
printf("%s ", perm[i]);
printf("\n");
}
'
}
lgetpermit $1
#
exit 0
#
exit 0
#
exit 0
|