pgman wrote: > Christopher Kings-Lynne wrote: > > >> if [ "$USER" = 'root' -o "$LOGNAME" = 'root' ] > > >> > > >> Always fails because even tho $USER is set to 'pgsql' when su'ed, > > >> $LOGNAME is still root. > > >> > > >> This is on FreeBSD 4.9 > > > > > > It seems to work on Linux; apparently there are different behaviors of > > > su. Do > > > you have a suggestion for resolving this? > > > > Well all I did to fix it on FreeBSD was to remove the '-o "$LOGNAME" = > > 'root'' bit... > > I applied the attached patch to CVS HEAD and 8.1.X. It looks at LOGNAME > only if USER is not set.
OK, updated patch that tries to use 'id' first. Applied. Backpatch to 8.1.X. -- Bruce Momjian http://candle.pha.pa.us SRA OSS, Inc. http://www.sraoss.com + If your life is a hard drive, Christ can be your backup. +
Index: src/bin/ipcclean/ipcclean.sh =================================================================== RCS file: /cvsroot/pgsql/src/bin/ipcclean/ipcclean.sh,v retrieving revision 1.17 diff -c -c -r1.17 ipcclean.sh *** src/bin/ipcclean/ipcclean.sh 3 Mar 2006 16:49:21 -0000 1.17 --- src/bin/ipcclean/ipcclean.sh 3 Mar 2006 21:49:05 -0000 *************** *** 19,26 **** exit 0 fi ! # only check $LOGNAME if $USER is not set ! if [ "$USER" = 'root' -o \( ! "$USER" -a "$LOGNAME" = 'root' \) ] then ( echo "$CMDNAME: cannot be run as root" 1>&2 --- 19,37 ---- exit 0 fi ! # test for running as root ! ! ISROOT="N" ! if id -u >/dev/null 2>&1 ! then if [ `id -u` -eq 0 ] ! then ISROOT="Y" ! fi ! elif # only check $LOGNAME if $USER is not set ! [ "$USER" = 'root' -o \( ! "$USER" -a "$LOGNAME" = 'root' \) ] ! then ISROOT="Y" ! fi ! ! if [ "$ISROOT" = "Y" ] then ( echo "$CMDNAME: cannot be run as root" 1>&2
---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings