[Linux-ha-dev] Re: pgsql and quotes

Serge Dubrouski sergeyfd at gmail.com
Mon Dec 10 09:22:18 MST 2007


Here it is:

--- resources/OCF/pgsql.old     2007-12-10 11:16:48.000000000 -0500
+++ resources/OCF/pgsql 2007-12-10 11:18:45.000000000 -0500
@@ -354,14 +354,6 @@
     exit 1
 fi

-US=`id -u -n`
-
-if [ $US != root ]
-then
-    ocf_log err "$0 must be run as root"
-    exit 1
-fi
-
 : ${OCF_RESKEY_pgctl=/usr/bin/pg_ctl}
 : ${OCF_RESKEY_psql=/usr/bin/psql}
 : ${OCF_RESKEY_pgdata=/var/lib/pgsql/data}
@@ -384,6 +376,14 @@
                 exit $?;;
 esac

+US=`id -u -n`
+
+if [ $US != root ]
+then
+    ocf_log err "$0 must be run as root"
+    exit 1
+fi
+
 if ! pgsql_validate_all
 then
     exit $OCF_ERR_CONFIGURED


On Dec 10, 2007 9:07 AM, Serge Dubrouski <sergeyfd at gmail.com> wrote:
> It will not. Why do you want to make this change?
>
> I'll create a patch for moving that check for root down the code today.
>
>
> On Dec 10, 2007 7:26 AM, Dejan Muhamedagic <dejanmm at fastmail.fm> wrote:
> > Hi Serge,
> >
> > Is this thing going to work:
> >
> > 197     if runasowner "$OCF_RESKEY_pgctl $OCF_RESKEY_ctl_opt -D $OCF_RESKEY_pgdata -l $OCF_RESKEY_logfile -o "\'$OCF_RESKEY_start_opt\'" start > /dev/null 2 >&1"
> >
> > Should it be:
> >
> > 197     if runasowner "$OCF_RESKEY_pgctl $OCF_RESKEY_ctl_opt -D $OCF_RESKEY_pgdata -l $OCF_RESKEY_logfile -o \"\'$OCF_RESKEY_start_opt\'\" start > /dev/null 2 >&1"
> >
> > Also, the test for root is too early, i.e. at least one should be
> > able to run meta-data as any user.
> >
> > Thanks,
> >
> > Dejan
> >
>
>
>
> --
> Serge Dubrouski.
>



-- 
Serge Dubrouski.


More information about the Linux-HA-Dev mailing list