Package: wwwconfig-common
Version: 0.0.48
Severity: normal
Tags: patch

Hi,

from postgres 8.X, the client (psql) use getpwuid_r to find the
.dbpass-file, not the environment variable HOME as it used to in
postgres 7.4. This breaks the part of pgsql.get in wwwconfig-common
that creates a temporary HOME where a .dbpass is created (and
removed).

IMO it would be more elegant to use the PGPASSFILE environment
variable than changing HOME anyway, so I have written and tested a
patch that does this.


- Werner


diff -ruN wwwconfig-common-0.0.48.orig/pgsql.get 
wwwconfig-common-0.0.48/pgsql.get
--- wwwconfig-common-0.0.48.orig/pgsql.get      2004-08-06 14:04:41.000000000 
+0200
+++ wwwconfig-common-0.0.48/pgsql.get   2008-03-27 09:46:51.000000000 +0100
@@ -60,24 +60,23 @@
     if [ -z "$hostopt" -a \( "$MYUID" = root -o "$UID" = "$user" \) ] && grep 
-q ^"$user": /etc/passwd ; then
        su -s /bin/sh $user -c "psql $hostopt $_psql_args"
     else
-       OLDHOME=$HOME
-       HOME=`mktemp -d`
+       PGPASSDIR=`mktemp -d`
        if [ $? -ne 0 ]; then
            exit 1
        fi
-       export HOME
+       PGPASSFILE=$PGPASSDIR/.pgpass
+       export PGPASSFILE
 
        if [ ! -z "$pass" ] ; then
            OLDUMASK=`umask`
            umask 077
-           echo "*:*:*:$user:$pass" > $HOME/.pgpass
+           echo "*:*:*:$user:$pass" > $PGPASSFILE
            umask $OLDUMASK
        fi
 
        eval psql -U "$user" $hostopt $_psql_args
 
-       rm -rf "$HOME"
-       HOME=$OLDHOME
+       rm -rf "$PGPASSDIR"
     fi
 }
 



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to