File permissions on tbconfig file
Posted in 1995
>
> Does anybody know what the standard file permissions should be on the
> $INFORMIXDIR/etc/tbconfig file. We have Informix On-Line V5.02 and HP-UX
> 9.04.
>
> Thanks in advance,
>
>
> Jitinder
>
> Disclaimer : These are my views and not necessarily those of my employer,
> Logica UK Ltd.
>
Ah yes, time for another utility.
--- cut here ---
##############################################################################
# Check the informix file distribution list against actual files to verify
# that all have the correct ownerships and permissions.
# Syntax is: ckfls $filename
# where $filename is the filelist to check (e.g. onlinefiles, netfiles,
# sqlfiles)
# Jack Parker 4/93
#
##############################################################################
##############################################################################
# modify the -rwxr-x--- string into a 4 digit permission figure.
##############################################################################
ck_pm()
{
act_pm=`echo $af | awk '{
b1=substr($1,1,1)
b2=substr($1,2,1)
b3=substr($1,3,1)
b4=substr($1,4,1)
b5=substr($1,5,1)
b6=substr($1,6,1)
b7=substr($1,7,1)
b8=substr($1,8,1)
b9=substr($1,9,1)
b0=substr($1,10,1)
op=0
gp=0
xp=0
sp=0
if (b2=="r") {op+=4}
if (b3=="w") {op+=2}
if (b4=="x") {op+=1}
if (b4=="s" || b4=="S") {sp+=4
op+=1}
if (b5=="r") {gp+=4}
if (b6=="w") {gp+=2}
if (b7=="x") {gp+=1}
if (b7=="s"|| b7=="S") {sp+=2
gp+=1}
if (b8=="r") {xp+=4}
if (b9=="w") {xp+=2}
if (b0=="x") {xp+=1}
if (b0=="t"||b0=="T") {sp+=1
xp+=1}
printf("%1d%1d%1d%1d\\n", sp, op, gp, xp) }'`
}
##############################################################################
# main loop
##############################################################################
# lose the comments
grep -v "^#" /usr/informix/etc/$1 |
while read line
do
# don't process null lines
if [ -n "$line" ]
then
# get the file name
fnm=`echo $line | cut -d" " -f1`
# we still will get a line called 'PRODUCT' lose it
if [ $fnm != "PRODUCT" ]
then
# get owners, group, and permission number
own=`echo $line | cut -d" " -f2`
grp=`echo $line | cut -d" " -f3`
mod=`echo $line | cut -d" " -f4`
# ls -l the file
af=`ls -l -d $INFORMIXDIR/$fnm`
# don't check it if the file is missing
if [ $? -eq 0 ]
then
# develop a 4 digit permission to compare
ck_pm
# get actual owner and group
act_own=`echo $af | cut -d" " -f3`
act_grp=`echo $af | cut -d" " -f4`
# are they the same?
if [ $act_own != $own -o $act_grp != $grp -o $act_pm -ne $mod ]
then echo "\\nMismatch - Actual :\\n$af\\nCorrect :\\n$INFORMIXDIR/$line\\n"
fi
fi
fi
fi
done
--- and here ------
cheers
j.
_____________________________________________________________________________
Jack Parker - Hewlett Packard, BSMC Boise, Idaho, USA
jparker@hpbs3645.boi.hp.com
_____________________________________________________________________________
Discover America, get lost on a rally.
_____________________________________________________________________________
Any opinions expressed herein are my own and not those of my employers.
_____________________________________________________________________________