Re: OnLine 7.20.UC3 bug?
Posted in 1997
Mario Estrada wrote: > Have you checked the permission of the Informix products?, > you can download an utility at http://iiug.org , which checks > and make the corrections, I don't remember who wrote it, > but it is useful. I think it was by Jack Parker. I had made a similar script, it checked out ok. Here's that script, it prints permissions, or (if root), it optionally changes permissions of informix files to the settings listd in the $INFORMIXDIR/etc/*files. chk_infx_files (caveat emptor) -- # chk_infx_files CMcG 04/01/96 # read the # $INFORMIXDIR/etc/*files (which list the files in the installed # informix products) and compares the owner and group and mode to the values # listed (if -f flag is used, also fixes settings) usage() { echo "chk_infx_files (checks the owner, group and mode of " echo " Informix files against the recomended settings)" echo "chk_infx_files -f (changes the owner, group and permissions of" echo " Informix files to the recomended settings)" echo " You must be root to use the -f flag." } fix="F" # default: fix = FALSE while getopts f c do case $c { f) fix="T";; # fix = TRUE \\?) usage exit 2;; } done if [ $fix = "T" ] ### Careful! Changing owner/mode of files then if [ -x /bin/whoami ] then NAME=`/bin/whoami|sed "s/ .*$//;s/^.*!//p"` elif [ -x /usr/bin/whoami ] then NAME=`/usr/bin/whoami|sed "s/ .*$//;s/^.*!//p"` elif [ -x /usr/ucb/whoami ] then NAME=`/usr/ucb/whoami|sed "s/ .*$//;s/^.*!//p"` else NAME=`who am i|sed "s/ .*$//;s/^.*!//p"` fi NAME="${NAME:=notroot}" if [ $NAME != "root" ] then usage exit 2 fi cd $INFORMIXDIR # brute force fix of all file's owner, group & permissions for i in etc/*files do # delete junk sed -e '1,/^PRODUCT/d' -e '/^$/d' -e '/^#/d' -e '/REMOVE$/d' $i done | sort -u | while read FName Owner Group Mode Garbage do if [ ! -s $FName ] then echo echo "$FName in file list, but not found" else echo chown $Owner.$Group $FName echo chmod $Mode $FName fi done | ksh else # just compare settings in directories to settings in list cd $INFORMIXDIR for i in etc/*files do # delete junk sed -e '1,/^PRODUCT/d' -e '/^$/d' -e '/^#/d' -e '/REMOVE$/d' $i done | sort -u | while read FName Owner Group Mode Garbage # get recommended settings do if [ ! -s $FName ] then echo "$FName in file list, but not found" else ls -ld $FName | read tMode junk tOwner tGroup Garbage # get current settings tMode=`expr $tMode : '.\\(.*\\)'` # drop 1st character (d, -, etc) #### # convert recommended mode (numeric) to its symbolic representation #### if [ `expr $Mode : '.*'` -eq 4 ] # setid bit set ! then setid=`expr $Mode : '\\(.\\)'` Mode=`expr $Mode : '.\\(.*\\)'` else setid=0 fi Mode=`echo $Mode | sed -e 's/0/---/g' \\ -e 's/1/--x/g' \\ -e 's/2/-w-/g' \\ -e 's/3/-wx/g' \\ -e 's/4/r--/g' \\ -e 's/5/r-x/g' \\ -e 's/6/rw-/g' \\ -e 's/7/rwx/g' ` if [ $setid -eq 2 -o $setid -eq 6 ] # process setgid then head=`expr $Mode : '\\(.....\\)'` tail=`expr $Mode : '......\\(...\\)'` if [ `expr $Mode : '.....\\(.\\)'` = "x" ] then Mode=${head}s$tail else Mode=${head}S$tail fi fi if [ $setid -eq 4 -o $setid -eq 6 ] # process setuid then head=`expr $Mode : '\\(..\\)'` tail=`expr $Mode : '...\\(......\\)'` if [ `expr $Mode : '..\\(.\\)'` = "x" ] then Mode=${head}s$tail else Mode=${head}S$tail fi fi # (finally: perform the comparison) if [ $tMode != $Mode -o $tOwner != $Owner -o $tGroup != $Group ] then echo $FName is $tMode $tOwner.$tGroup echo " It should be $Mode $Owner.$Group" fi fi done fi -- _____________________________________________________________________ | Colin McGrath cmm@trac3000.ueci.com | | Raytheon Engineers & Constructors, Inc. (215) 422-4144 | | Phila, PA, USA Standard Disclaimers Apply | |___________________________________________________________________| "...Abrecht Durer didn't waste his time doing woodcuts of the Four Button-Pressers of the Apocalypse, I do know that." -From "Good Omens" by Neil Gaiman and Terry Pratchett