File: pgsql-8.x.patch

package info (click to toggle)
wwwconfig-common 0.3.0
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 488 kB
  • sloc: sh: 952; makefile: 5
file content (57 lines) | stat: -rw-r--r-- 1,550 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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
 }