Hi Morten

Thanks for the patch.

Do this work with old pgsql or do it only work with the new one?
If the answer is no, do you know if the old version will be supported in
lenny?

Best regards,

// Ola

On Thu, Mar 27, 2008 at 11:01:19AM +0100, Morten Werner Forsbring wrote:
> 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
>  }
>  
> 
> 
> 

-- 
 --------------------- Ola Lundqvist ---------------------------
/  [EMAIL PROTECTED]                     Annebergsslingan 37      \
|  [EMAIL PROTECTED]                     654 65 KARLSTAD          |
|  http://opalsys.net/                 +46 (0)70-332 1551       |
\  gpg/f.p.: 7090 A92B 18FE 7994 0C36  4FE4 18A1 B1CF 0FE5 3DD9 /
 ---------------------------------------------------------------



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

Reply via email to