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.
--
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.16
diff -c -c -r1.16 ipcclean.sh
*** src/bin/ipcclean/ipcclean.sh 5 Jan 2006 01:56:29 -0000 1.16
--- src/bin/ipcclean/ipcclean.sh 3 Mar 2006 16:48:43 -0000
***************
*** 19,25 ****
exit 0
fi
! if [ "$USER" = 'root' -o "$LOGNAME" = 'root' ]
then
(
echo "$CMDNAME: cannot be run as root" 1>&2
--- 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