Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a3f98d5

Browse files
committed
Adjust lookup of client-side profile files (.pgpass and so on) as per
discussion on pgsql-hackers-win32 list. Documentation still needs to be tweaked --- I'm not sure how to refer to the APPDATA folder in user documentation.
1 parent b8139ea commit a3f98d5

File tree

11 files changed

+156
-126
lines changed

11 files changed

+156
-126
lines changed

doc/src/sgml/libpq.sgml

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.174 2004/12/28 23:17:18 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.175 2005/01/06 18:29:07 tgl Exp $
33
-->
44

55
<chapter id="libpq">
@@ -147,8 +147,8 @@ PGconn *PQconnectdb(const char *conninfo);
147147
likely to fail if <application>libpq</application> is passed a host name
148148
that is not the name of the machine at <literal>hostaddr</>.) Also,
149149
<literal>host</> rather than <literal>hostaddr</> is used to identify
150-
the connection in <filename>$HOME/.pgpass</> (or
151-
<filename>%USERPROFILE%\.pgpass</> on Microsoft Windows).
150+
the connection in <filename>~/.pgpass</> (see
151+
<xref linkend="libpq-pgpass">).
152152
</para>
153153
<para>
154154
Without either a host name or host address,
@@ -3691,7 +3691,7 @@ sets the user name used to connect to the database.
36913691
<envar>PGPASSWORD</envar>
36923692
sets the password used if the server demands password
36933693
authentication. This environment variable is deprecated for security
3694-
reasons; instead consider using the <filename>$HOME/.pgpass</>
3694+
reasons; instead consider using the <filename>~/.pgpass</>
36953695
file (see <xref linkend="libpq-pgpass">).
36963696
</para>
36973697
</listitem>
@@ -3881,7 +3881,12 @@ internationalization.
38813881
The file <filename>.pgpass</filename> in a user's home directory is a file
38823882
that can contain passwords to be used if the connection requires a
38833883
password (and no password has been specified otherwise).
3884-
This file should have lines of the following format:
3884+
On Microsoft Windows the file is named
3885+
<filename>APPDATA/postgresql/pgpass.txt</>.
3886+
</para>
3887+
3888+
<para>
3889+
This file should contain lines of the following format:
38853890
<synopsis>
38863891
<replaceable>hostname</replaceable>:<replaceable>port</replaceable>:<replaceable>database</replaceable>:<replaceable>username</replaceable>:<replaceable>password</replaceable>
38873892
</synopsis>
@@ -3893,11 +3898,14 @@ entries first when you are using wildcards.)
38933898
If an entry needs to contain <literal>:</literal> or
38943899
<literal>\</literal>, escape this character with <literal>\</literal>.
38953900
</para>
3901+
38963902
<para>
38973903
The permissions on <filename>.pgpass</filename> must disallow any
38983904
access to world or group; achieve this by the command
38993905
<command>chmod 0600 ~/.pgpass</command>.
39003906
If the permissions are less strict than this, the file will be ignored.
3907+
(The file permissions are not currently checked on Microsoft Windows,
3908+
however.)
39013909
</para>
39023910
</sect1>
39033911

@@ -3920,16 +3928,22 @@ If the permissions are less strict than this, the file will be ignored.
39203928
If the server demands a client certificate,
39213929
<application>libpq</application>
39223930
will send the certificate stored in file
3923-
<filename>.postgresql/postgresql.crt</> within the user's home directory.
3924-
A matching private key file <filename>.postgresql/postgresql.key</>
3931+
<filename>~/.postgresql/postgresql.crt</> within the user's home directory.
3932+
A matching private key file <filename>~/.postgresql/postgresql.key</>
39253933
must also be present, and must not be world-readable.
3934+
(On Microsoft Windows these files are named
3935+
<filename>APPDATA/postgresql/postgresql.crt</filename> and
3936+
<filename>APPDATA/postgresql/postgresql.key</filename>.)
39263937
</para>
39273938

39283939
<para>
3929-
If the file <filename>.postgresql/root.crt</> is present in the user's
3940+
If the file <filename>~/.postgresql/root.crt</> is present in the user's
39303941
home directory,
39313942
<application>libpq</application> will use the certificate list stored
3932-
therein to verify the server's certificate. The SSL connection will
3943+
therein to verify the server's certificate.
3944+
(On Microsoft Windows the file is named
3945+
<filename>APPDATA/postgresql/root.crt</filename>.)
3946+
The SSL connection will
39333947
fail if the server does not present a certificate; therefore, to
39343948
use this feature the server must also have a <filename>root.crt</> file.
39353949
</para>

doc/src/sgml/ref/pg_dumpall.sgml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.47 2005/01/04 03:58:16 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.48 2005/01/06 18:29:08 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -71,7 +71,8 @@ PostgreSQL documentation
7171
times to the <productname>PostgreSQL</productname> server (once per
7272
database). If you use password authentication it is likely to ask for
7373
a password each time. It is convenient to have a
74-
<filename>$HOME/.pgpass</> file in such cases.
74+
<filename>~/.pgpass</> file in such cases. See <xref
75+
linkend="libpq-pgpass"> for more information.
7576
</para>
7677

7778
</refsect1>

doc/src/sgml/ref/psql-ref.sgml

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.127 2005/01/04 03:58:16 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/psql-ref.sgml,v 1.128 2005/01/06 18:29:08 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -440,8 +440,9 @@ PostgreSQL documentation
440440
<term><option>--no-psqlrc</></term>
441441
<listitem>
442442
<para>
443-
Do not read the start-up file <filename>/psqlrc</filename> or
444-
<filename>~/.psqlrc</filename>.
443+
Do not read the start-up file (neither the system-wide
444+
<filename>psqlrc</filename> file nor the user's
445+
<filename>~/.psqlrc</filename> file).
445446
</para>
446447
</listitem>
447448
</varlistentry>
@@ -1109,7 +1110,7 @@ testdb=>
11091110
=> <userinput>\echo `date`</userinput>
11101111
Tue Oct 26 21:40:57 CEST 1999
11111112
</programlisting>
1112-
If the first argument is an unquoted <literal>-n</literal> the the trailing
1113+
If the first argument is an unquoted <literal>-n</literal> the trailing
11131114
newline is not written.
11141115
</para>
11151116

@@ -1901,8 +1902,8 @@ bar
19011902
The autocommit-on mode is <productname>PostgreSQL</>'s traditional
19021903
behavior, but autocommit-off is closer to the SQL spec. If you
19031904
prefer autocommit-off, you may wish to set it in the system-wide
1904-
<filename>psqlrc</filename> or your
1905-
<filename>.psqlrc</filename> file.
1905+
<filename>psqlrc</filename> file or your
1906+
<filename>~/.psqlrc</filename> file.
19061907
</para>
19071908
</note>
19081909
</listitem>
@@ -2415,8 +2416,8 @@ testdb=> \set PROMPT1 '%[%033[1;33;40m%]%n@%/%R%[%033[0m%#%] '
24152416
<para>
24162417
<application>psql</application> supports the <application>Readline</application>
24172418
library for convenient line editing and retrieval. The command
2418-
history is stored in a file named <filename>.psql_history</filename>
2419-
in your home directory and is reloaded when
2419+
history is automatically saved when <application>psql</application>
2420+
exits and is reloaded when
24202421
<application>psql</application> starts up. Tab-completion is also
24212422
supported, although the completion logic makes no claim to be an
24222423
<acronym>SQL</acronym> parser. If for some reason you do not like the tab completion, you
@@ -2440,17 +2441,6 @@ $endif
24402441
<title>Environment</title>
24412442

24422443
<variablelist>
2443-
<varlistentry>
2444-
<term><envar>HOME</envar></term>
2445-
2446-
<listitem>
2447-
<para>
2448-
Directory for initialization file (<filename>.psqlrc</filename>)
2449-
and command history file (<filename>.psql_history</filename>).
2450-
</para>
2451-
</listitem>
2452-
</varlistentry>
2453-
24542444
<varlistentry>
24552445
<term><envar>PAGER</envar></term>
24562446

@@ -2531,20 +2521,34 @@ $endif
25312521
<listitem>
25322522
<para>
25332523
Before starting up, <application>psql</application> attempts to
2534-
read and execute commands from the the system-wide
2535-
<filename>psqlrc</filename> file and the
2536-
<filename>$HOME/.psqlrc</filename> file in the user's home
2537-
directory. See <filename><replaceable>PREFIX</>/share/psqlrc.sample</>
2524+
read and execute commands from the system-wide
2525+
<filename>psqlrc</filename> file and the user's
2526+
<filename>~/.psqlrc</filename> file.
2527+
(On Windows, the user's startup file is named
2528+
<filename>APPDATA/postgresql/psqlrc.txt</filename>.)
2529+
See <filename><replaceable>PREFIX</>/share/psqlrc.sample</>
25382530
for information on setting up the system-wide file. It could be used
25392531
to set up the client or the server to taste (using the <command>\set
25402532
</command> and <command>SET</command> commands).
25412533
</para>
25422534
</listitem>
25432535

2536+
<listitem>
2537+
<para>
2538+
Both the system-wide <filename>psqlrc</filename> file and the user's
2539+
<filename>~/.psqlrc</filename> file can be made version-specific
2540+
by appending a dash and the <productname>PostgreSQL</productname>
2541+
release number, for example <filename>~/.psqlrc-&version;</filename>.
2542+
A matching version-specific file will be read in preference to a
2543+
non-version-specific file.
2544+
</para>
2545+
</listitem>
2546+
25442547
<listitem>
25452548
<para>
25462549
The command-line history is stored in the file
2547-
<filename>$HOME/.psql_history</filename>.
2550+
<filename>~/.psql_history</filename>, or
2551+
<filename>APPDATA/postgresql/psql_history</filename> on Windows.
25482552
</para>
25492553
</listitem>
25502554
</itemizedlist>

doc/src/sgml/ref/vacuumdb.sgml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.34 2003/11/29 19:51:39 pgsql Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/vacuumdb.sgml,v 1.35 2005/01/06 18:29:08 tgl Exp $
33
PostgreSQL documentation
44
-->
55

@@ -73,7 +73,7 @@ PostgreSQL documentation
7373
<term><option>--all</option></term>
7474
<listitem>
7575
<para>
76-
Vacuum all databases.
76+
Vacuum all databases.
7777
</para>
7878
</listitem>
7979
</varlistentry>
@@ -83,12 +83,12 @@ PostgreSQL documentation
8383
<term><option><optional>--dbname</> <replaceable class="parameter">dbname</replaceable></option></term>
8484
<listitem>
8585
<para>
86-
Specifies the name of the database to be cleaned or analyzed.
87-
If this is not specified and <option>-a</option> (or
88-
<option>--all</option>) is not used, the database name is read
89-
from the environment variable <envar>PGDATABASE</envar>. If
90-
that is not set, the user name specified for the connection is
91-
used.
86+
Specifies the name of the database to be cleaned or analyzed.
87+
If this is not specified and <option>-a</option> (or
88+
<option>--all</option>) is not used, the database name is read
89+
from the environment variable <envar>PGDATABASE</envar>. If
90+
that is not set, the user name specified for the connection is
91+
used.
9292
</para>
9393
</listitem>
9494
</varlistentry>
@@ -99,7 +99,7 @@ PostgreSQL documentation
9999
<listitem>
100100
<para>
101101
Echo the commands that <application>vacuumdb</application> generates
102-
and sends to the server.
102+
and sends to the server.
103103
</para>
104104
</listitem>
105105
</varlistentry>
@@ -129,9 +129,9 @@ PostgreSQL documentation
129129
<term><option>--table <replaceable class="parameter">table</replaceable> [ (<replaceable class="parameter">column</replaceable> [,...]) ]</option></term>
130130
<listitem>
131131
<para>
132-
Clean or analyze <replaceable class="parameter">table</replaceable> only.
133-
Column names may be specified only in conjunction with
134-
the <option>--analyze</option> option.
132+
Clean or analyze <replaceable class="parameter">table</replaceable> only.
133+
Column names may be specified only in conjunction with
134+
the <option>--analyze</option> option.
135135
</para>
136136
<tip>
137137
<para>
@@ -147,7 +147,7 @@ PostgreSQL documentation
147147
<term><option>--verbose</option></term>
148148
<listitem>
149149
<para>
150-
Print detailed information during processing.
150+
Print detailed information during processing.
151151
</para>
152152
</listitem>
153153
</varlistentry>
@@ -157,7 +157,7 @@ PostgreSQL documentation
157157
<term><option>--analyze</option></term>
158158
<listitem>
159159
<para>
160-
Calculate statistics for use by the optimizer.
160+
Calculate statistics for use by the optimizer.
161161
</para>
162162
</listitem>
163163
</varlistentry>
@@ -174,10 +174,10 @@ PostgreSQL documentation
174174
<term><option>--host <replaceable class="parameter">host</replaceable></></term>
175175
<listitem>
176176
<para>
177-
Specifies the host name of the machine on which the
178-
server
179-
is running. If the value begins with a slash, it is used
180-
as the directory for the Unix domain socket.
177+
Specifies the host name of the machine on which the
178+
server
179+
is running. If the value begins with a slash, it is used
180+
as the directory for the Unix domain socket.
181181
</para>
182182
</listitem>
183183
</varlistentry>
@@ -187,9 +187,9 @@ PostgreSQL documentation
187187
<term><option>--port <replaceable class="parameter">port</replaceable></></term>
188188
<listitem>
189189
<para>
190-
Specifies the TCP port or local Unix domain socket file
191-
extension on which the server
192-
is listening for connections.
190+
Specifies the TCP port or local Unix domain socket file
191+
extension on which the server
192+
is listening for connections.
193193
</para>
194194
</listitem>
195195
</varlistentry>
@@ -261,7 +261,7 @@ PostgreSQL documentation
261261
<application>vacuumdb</application> might need to connect several
262262
times to the <productname>PostgreSQL</productname> server, asking
263263
for a password each time. It is convenient to have a
264-
<filename>$HOME/.pgpass</> file in such cases. See <xref
264+
<filename>~/.pgpass</> file in such cases. See <xref
265265
linkend="libpq-pgpass"> for more information.
266266
</para>
267267
</refsect1>

doc/src/sgml/release.sgml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.317 2005/01/06 01:49:24 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/release.sgml,v 1.318 2005/01/06 18:29:07 tgl Exp $
33
-->
44

55
<appendix id="release">
@@ -5615,7 +5615,7 @@ operations on bytea columns (Joe)</para></listitem>
56155615
<sect3>
56165616
<title>libpq</title>
56175617
<itemizedlist>
5618-
<listitem><para>Add $HOME/.pgpass to store host/user password combinations (Alvaro Herrera)</para></listitem>
5618+
<listitem><para>Add ~/.pgpass to store host/user password combinations (Alvaro Herrera)</para></listitem>
56195619
<listitem><para>Add PQunescapeBytea() function to libpq (Patrick Welche)</para></listitem>
56205620
<listitem><para>Fix for sending large queries over non-blocking connections (Bernhard Herzog)</para></listitem>
56215621
<listitem><para>Fix for libpq using timers on Win9X (David Ford)</para></listitem>

src/backend/libpq/README.SSL

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ user should be set up on the database server. It is acceptable
177177
for the shell program to be bogus (e.g., /bin/false), if the
178178
tunnel is set up in to avoid launching a remote shell.
179179

180-
On each client system the $HOME/.ssh/config file should contain
180+
On each client system the ~/.ssh/config file should contain
181181
an additional line similiar to
182182

183183
LocalForward 5555 psql.example.com:5432
@@ -192,7 +192,7 @@ that establishes an SSH tunnel when the program is launched:
192192

193193
#!/bin/sh
194194
HOST=psql.example.com
195-
IDENTITY=$HOME/.ssh/identity.psql
195+
IDENTITY=~/.ssh/identity.psql
196196
/usr/bin/ssh -1 -i $IDENTITY -n $HOST 'sleep 60' & \
197197
/usr/bin/psql -h $HOST -p 5555 $1
198198

@@ -335,20 +335,20 @@ PostgreSQL can generate client certificates via a four-step process.
335335

336336
The client.conf file is normally installed in /etc/postgresql/root.crt.
337337
The client should also copy the server's root.crt file to
338-
$HOME/.postgresql/root.crt.
338+
~/.postgresql/root.crt.
339339

340340
2. If the user has the OpenSSL applications installed, they can
341341
run pgkeygen.sh. (An equivalent compiled program will be available
342342
in the future.) They should provide a copy of the
343-
$HOME/.postgresql/postgresql.pem file to their DBA.
343+
~/.postgresql/postgresql.pem file to their DBA.
344344

345345
3. The DBA should sign this file the OpenSSL applications:
346346

347347
$ openssl ca -config root.conf -ss_cert ....
348348

349349
and return the signed cert (postgresql.crt) to the user.
350350

351-
4. The user should install this file in $HOME/.postgresql/postgresql.crt.
351+
4. The user should install this file in ~/.postgresql/postgresql.crt.
352352

353353
The server will log every time a client certificate has been
354354
used, but there is not yet a mechanism provided for using client
@@ -429,7 +429,7 @@ until later.
429429
> for the shell program to be bogus (e.g., /bin/false), if the
430430
> tunnel is set up in to avoid launching a remote shell.
431431
>
432-
> On each client system the $HOME/.ssh/config file should contain
432+
> On each client system the ~/.ssh/config file should contain
433433
> an additional line similiar to
434434
>
435435
> LocalForward 5555 psql.example.com:5432

0 commit comments

Comments
 (0)