Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9de59fd

Browse files
committed
Add a -w/--no-password option that prevents all password prompts to all
programs that have a -W/--password option.In passing, remove the ancient PSQL_ALWAYS_GET_PASSWORDS compile option.
1 parenteea4976 commit9de59fd

38 files changed

+478
-170
lines changed

‎contrib/vacuumlo/vacuumlo.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/contrib/vacuumlo/vacuumlo.c,v 1.39 2009/02/25 13:34:32 petere Exp $
11+
* $PostgreSQL: pgsql/contrib/vacuumlo/vacuumlo.c,v 1.40 2009/02/26 16:02:37 petere Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -33,10 +33,17 @@ extern intoptind,
3333
opterr,
3434
optopt;
3535

36+
enumtrivalue
37+
{
38+
TRI_DEFAULT,
39+
TRI_NO,
40+
TRI_YES
41+
};
42+
3643
struct_param
3744
{
3845
char*pg_user;
39-
intpg_prompt;
46+
enumtrivaluepg_prompt;
4047
char*pg_port;
4148
char*pg_host;
4249
intverbose;
@@ -64,7 +71,7 @@ vacuumlo(char *database, struct _param * param)
6471
staticchar*password=NULL;
6572
boolnew_pass;
6673

67-
if (param->pg_prompt&&password==NULL)
74+
if (param->pg_prompt==TRI_YES&&password==NULL)
6875
password=simple_prompt("Password: ",100, false);
6976

7077
/*
@@ -91,7 +98,8 @@ vacuumlo(char *database, struct _param * param)
9198

9299
if (PQstatus(conn)==CONNECTION_BAD&&
93100
PQconnectionNeedsPassword(conn)&&
94-
password==NULL)
101+
password==NULL&&
102+
param->pg_prompt!=TRI_NO)
95103
{
96104
PQfinish(conn);
97105
password=simple_prompt("Password: ",100, false);
@@ -308,6 +316,7 @@ usage(void)
308316
printf(" -n don't remove large objects, just show what would be done\n");
309317
printf(" -p PORT database server port\n");
310318
printf(" -U USERNAME user name to connect as\n");
319+
printf(" -w never prompt for password\n");
311320
printf(" -W force password prompt\n");
312321
printf(" -v write a lot of progress messages\n");
313322
printf("\n");
@@ -324,15 +333,15 @@ main(int argc, char **argv)
324333

325334
/* Parameter handling */
326335
param.pg_user=NULL;
327-
param.pg_prompt=0;
336+
param.pg_prompt=TRI_DEFAULT;
328337
param.pg_host=NULL;
329338
param.pg_port=NULL;
330339
param.verbose=0;
331340
param.dry_run=0;
332341

333342
while (1)
334343
{
335-
c=getopt(argc,argv,"?h:U:p:vnW");
344+
c=getopt(argc,argv,"?h:U:p:vnwW");
336345
if (c==-1)
337346
break;
338347

@@ -357,8 +366,11 @@ main(int argc, char **argv)
357366
case'U':
358367
param.pg_user=strdup(optarg);
359368
break;
369+
case'w':
370+
param.pg_prompt=TRI_NO;
371+
break;
360372
case'W':
361-
param.pg_prompt=1;
373+
param.pg_prompt=TRI_YES;
362374
break;
363375
case'p':
364376
port=strtol(optarg,NULL,10);

‎doc/src/sgml/ref/clusterdb.sgml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/clusterdb.sgml,v 1.24 2008/11/24 08:46:03 petere Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/clusterdb.sgml,v 1.25 2009/02/26 16:02:37 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -171,6 +171,21 @@ PostgreSQL documentation
171171
</listitem>
172172
</varlistentry>
173173

174+
<varlistentry>
175+
<term><option>-w</></term>
176+
<term><option>--no-password</></term>
177+
<listitem>
178+
<para>
179+
Never issue a password prompt. If the server requires
180+
password authentication and a password is not available by
181+
other means such as a <filename>.pgpass</filename> file, the
182+
connection attempt will fail. This option can be useful in
183+
batch jobs and scripts where no user is present to enter a
184+
password.
185+
</para>
186+
</listitem>
187+
</varlistentry>
188+
174189
<varlistentry>
175190
<term><option>-W</></term>
176191
<term><option>--password</></term>

‎doc/src/sgml/ref/createdb.sgml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/createdb.sgml,v 1.48 2008/11/10 16:25:41 alvherre Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/createdb.sgml,v 1.49 2009/02/26 16:02:37 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -217,6 +217,21 @@ PostgreSQL documentation
217217
</listitem>
218218
</varlistentry>
219219

220+
<varlistentry>
221+
<term><option>-w</></term>
222+
<term><option>--no-password</></term>
223+
<listitem>
224+
<para>
225+
Never issue a password prompt. If the server requires
226+
password authentication and a password is not available by
227+
other means such as a <filename>.pgpass</filename> file, the
228+
connection attempt will fail. This option can be useful in
229+
batch jobs and scripts where no user is present to enter a
230+
password.
231+
</para>
232+
</listitem>
233+
</varlistentry>
234+
220235
<varlistentry>
221236
<term><option>-W</></term>
222237
<term><option>--password</></term>

‎doc/src/sgml/ref/createlang.sgml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/createlang.sgml,v 1.42 2007/12/11 19:57:32 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/createlang.sgml,v 1.43 2009/02/26 16:02:37 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -139,6 +139,21 @@ PostgreSQL documentation
139139
</listitem>
140140
</varlistentry>
141141

142+
<varlistentry>
143+
<term><option>-w</></term>
144+
<term><option>--no-password</></term>
145+
<listitem>
146+
<para>
147+
Never issue a password prompt. If the server requires
148+
password authentication and a password is not available by
149+
other means such as a <filename>.pgpass</filename> file, the
150+
connection attempt will fail. This option can be useful in
151+
batch jobs and scripts where no user is present to enter a
152+
password.
153+
</para>
154+
</listitem>
155+
</varlistentry>
156+
142157
<varlistentry>
143158
<term><option>-W</></term>
144159
<term><option>--password</></term>

‎doc/src/sgml/ref/createuser.sgml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/createuser.sgml,v 1.51 2007/12/11 19:57:32 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/createuser.sgml,v 1.52 2009/02/26 16:02:37 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -290,6 +290,21 @@ PostgreSQL documentation
290290
</listitem>
291291
</varlistentry>
292292

293+
<varlistentry>
294+
<term><option>-w</></term>
295+
<term><option>--no-password</></term>
296+
<listitem>
297+
<para>
298+
Never issue a password prompt. If the server requires
299+
password authentication and a password is not available by
300+
other means such as a <filename>.pgpass</filename> file, the
301+
connection attempt will fail. This option can be useful in
302+
batch jobs and scripts where no user is present to enter a
303+
password.
304+
</para>
305+
</listitem>
306+
</varlistentry>
307+
293308
<varlistentry>
294309
<term><option>-W</></term>
295310
<term><option>--password</></term>

‎doc/src/sgml/ref/dropdb.sgml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/dropdb.sgml,v 1.34 2007/12/11 19:57:32 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/dropdb.sgml,v 1.35 2009/02/26 16:02:37 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -128,6 +128,21 @@ PostgreSQL documentation
128128
</listitem>
129129
</varlistentry>
130130

131+
<varlistentry>
132+
<term><option>-w</></term>
133+
<term><option>--no-password</></term>
134+
<listitem>
135+
<para>
136+
Never issue a password prompt. If the server requires
137+
password authentication and a password is not available by
138+
other means such as a <filename>.pgpass</filename> file, the
139+
connection attempt will fail. This option can be useful in
140+
batch jobs and scripts where no user is present to enter a
141+
password.
142+
</para>
143+
</listitem>
144+
</varlistentry>
145+
131146
<varlistentry>
132147
<term><option>-W</></term>
133148
<term><option>--password</></term>

‎doc/src/sgml/ref/droplang.sgml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/droplang.sgml,v 1.31 2007/12/11 19:57:32 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/droplang.sgml,v 1.32 2009/02/26 16:02:37 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -147,6 +147,21 @@ PostgreSQL documentation
147147
</listitem>
148148
</varlistentry>
149149

150+
<varlistentry>
151+
<term><option>-w</></term>
152+
<term><option>--no-password</></term>
153+
<listitem>
154+
<para>
155+
Never issue a password prompt. If the server requires
156+
password authentication and a password is not available by
157+
other means such as a <filename>.pgpass</filename> file, the
158+
connection attempt will fail. This option can be useful in
159+
batch jobs and scripts where no user is present to enter a
160+
password.
161+
</para>
162+
</listitem>
163+
</varlistentry>
164+
150165
<varlistentry>
151166
<term><option>-W</></term>
152167
<term><option>--password</></term>

‎doc/src/sgml/ref/dropuser.sgml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/dropuser.sgml,v 1.39 2007/12/11 19:57:32 tgl Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/dropuser.sgml,v 1.40 2009/02/26 16:02:37 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -130,6 +130,21 @@ PostgreSQL documentation
130130
</listitem>
131131
</varlistentry>
132132

133+
<varlistentry>
134+
<term><option>-w</></term>
135+
<term><option>--no-password</></term>
136+
<listitem>
137+
<para>
138+
Never issue a password prompt. If the server requires
139+
password authentication and a password is not available by
140+
other means such as a <filename>.pgpass</filename> file, the
141+
connection attempt will fail. This option can be useful in
142+
batch jobs and scripts where no user is present to enter a
143+
password.
144+
</para>
145+
</listitem>
146+
</varlistentry>
147+
133148
<varlistentry>
134149
<term><option>-W</></term>
135150
<term><option>--password</></term>

‎doc/src/sgml/ref/pg_dump.sgml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.110 2009/02/17 15:41:50 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dump.sgml,v 1.111 2009/02/26 16:02:37 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -678,6 +678,21 @@ PostgreSQL documentation
678678
</listitem>
679679
</varlistentry>
680680

681+
<varlistentry>
682+
<term><option>-w</></term>
683+
<term><option>--no-password</></term>
684+
<listitem>
685+
<para>
686+
Never issue a password prompt. If the server requires
687+
password authentication and a password is not available by
688+
other means such as a <filename>.pgpass</filename> file, the
689+
connection attempt will fail. This option can be useful in
690+
batch jobs and scripts where no user is present to enter a
691+
password.
692+
</para>
693+
</listitem>
694+
</varlistentry>
695+
681696
<varlistentry>
682697
<term><option>-W</option></term>
683698
<term><option>--password</option></term>

‎doc/src/sgml/ref/pg_dumpall.sgml

Lines changed: 16 additions & 1 deletion
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.76 2009/02/17 15:41:50 momjian Exp $
2+
$PostgreSQL: pgsql/doc/src/sgml/ref/pg_dumpall.sgml,v 1.77 2009/02/26 16:02:37 petere Exp $
33
PostgreSQL documentation
44
-->
55

@@ -391,6 +391,21 @@ PostgreSQL documentation
391391
</listitem>
392392
</varlistentry>
393393

394+
<varlistentry>
395+
<term><option>-w</></term>
396+
<term><option>--no-password</></term>
397+
<listitem>
398+
<para>
399+
Never issue a password prompt. If the server requires
400+
password authentication and a password is not available by
401+
other means such as a <filename>.pgpass</filename> file, the
402+
connection attempt will fail. This option can be useful in
403+
batch jobs and scripts where no user is present to enter a
404+
password.
405+
</para>
406+
</listitem>
407+
</varlistentry>
408+
394409
<varlistentry>
395410
<term><option>-W</option></term>
396411
<term><option>--password</option></term>

‎doc/src/sgml/ref/pg_restore.sgml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.79 2009/02/07 14:31:30 momjian Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/pg_restore.sgml,v 1.80 2009/02/26 16:02:37 petere Exp $ -->
22

33
<refentry id="APP-PGRESTORE">
44
<refmeta>
@@ -510,6 +510,21 @@
510510
</listitem>
511511
</varlistentry>
512512

513+
<varlistentry>
514+
<term><option>-w</></term>
515+
<term><option>--no-password</></term>
516+
<listitem>
517+
<para>
518+
Never issue a password prompt. If the server requires
519+
password authentication and a password is not available by
520+
other means such as a <filename>.pgpass</filename> file, the
521+
connection attempt will fail. This option can be useful in
522+
batch jobs and scripts where no user is present to enter a
523+
password.
524+
</para>
525+
</listitem>
526+
</varlistentry>
527+
513528
<varlistentry>
514529
<term><option>-W</option></term>
515530
<term><option>--password</option></term>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp