From 9de59fd191dc86e7a49a5d7726ef09041549fc88 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Thu, 26 Feb 2009 16:02:39 +0000 Subject: [PATCH] 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. --- contrib/vacuumlo/vacuumlo.c | 26 ++++++++++++----- doc/src/sgml/ref/clusterdb.sgml | 17 ++++++++++- doc/src/sgml/ref/createdb.sgml | 17 ++++++++++- doc/src/sgml/ref/createlang.sgml | 17 ++++++++++- doc/src/sgml/ref/createuser.sgml | 17 ++++++++++- doc/src/sgml/ref/dropdb.sgml | 17 ++++++++++- doc/src/sgml/ref/droplang.sgml | 17 ++++++++++- doc/src/sgml/ref/dropuser.sgml | 17 ++++++++++- doc/src/sgml/ref/pg_dump.sgml | 17 ++++++++++- doc/src/sgml/ref/pg_dumpall.sgml | 17 ++++++++++- doc/src/sgml/ref/pg_restore.sgml | 17 ++++++++++- doc/src/sgml/ref/psql-ref.sgml | 22 +++++++++++++- doc/src/sgml/ref/reindexdb.sgml | 15 ++++++++++ doc/src/sgml/ref/vacuumdb.sgml | 17 ++++++++++- doc/src/sgml/vacuumlo.sgml | 16 ++++++++++- src/bin/pg_dump/pg_backup.h | 13 +++++++-- src/bin/pg_dump/pg_backup_archiver.c | 11 ++++--- src/bin/pg_dump/pg_backup_archiver.h | 4 +-- src/bin/pg_dump/pg_backup_db.c | 20 ++++++++----- src/bin/pg_dump/pg_dump.c | 15 ++++++---- src/bin/pg_dump/pg_dumpall.c | 30 ++++++++++++------- src/bin/pg_dump/pg_restore.c | 12 ++++++-- src/bin/psql/command.c | 6 ++-- src/bin/psql/help.c | 3 +- src/bin/psql/settings.h | 10 +++++-- src/bin/psql/startup.c | 22 +++++++------- src/bin/scripts/clusterdb.c | 31 +++++++++++--------- src/bin/scripts/common.c | 9 +++--- src/bin/scripts/common.h | 11 +++++-- src/bin/scripts/createdb.c | 17 +++++++---- src/bin/scripts/createlang.c | 17 +++++++---- src/bin/scripts/createuser.c | 22 +++++++------- src/bin/scripts/dropdb.c | 15 ++++++---- src/bin/scripts/droplang.c | 17 +++++++---- src/bin/scripts/dropuser.c | 15 ++++++---- src/bin/scripts/reindexdb.c | 43 ++++++++++++++++------------ src/bin/scripts/vacuumdb.c | 31 +++++++++++--------- src/include/pg_config_manual.h | 8 +----- 38 files changed, 478 insertions(+), 170 deletions(-) diff --git a/contrib/vacuumlo/vacuumlo.c b/contrib/vacuumlo/vacuumlo.c index fa85890fe6..37a6c229ac 100644 --- a/contrib/vacuumlo/vacuumlo.c +++ b/contrib/vacuumlo/vacuumlo.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/contrib/vacuumlo/vacuumlo.c,v 1.39 2009/02/25 13:34:32 petere Exp $ + * $PostgreSQL: pgsql/contrib/vacuumlo/vacuumlo.c,v 1.40 2009/02/26 16:02:37 petere Exp $ * *------------------------------------------------------------------------- */ @@ -33,10 +33,17 @@ extern int optind, opterr, optopt; +enum trivalue +{ + TRI_DEFAULT, + TRI_NO, + TRI_YES +}; + struct _param { char *pg_user; - int pg_prompt; + enum trivalue pg_prompt; char *pg_port; char *pg_host; int verbose; @@ -64,7 +71,7 @@ vacuumlo(char *database, struct _param * param) static char *password = NULL; bool new_pass; - if (param->pg_prompt && password == NULL) + if (param->pg_prompt == TRI_YES && password == NULL) password = simple_prompt("Password: ", 100, false); /* @@ -91,7 +98,8 @@ vacuumlo(char *database, struct _param * param) if (PQstatus(conn) == CONNECTION_BAD && PQconnectionNeedsPassword(conn) && - password == NULL) + password == NULL && + param->pg_prompt != TRI_NO) { PQfinish(conn); password = simple_prompt("Password: ", 100, false); @@ -308,6 +316,7 @@ usage(void) printf(" -n don't remove large objects, just show what would be done\n"); printf(" -p PORT database server port\n"); printf(" -U USERNAME user name to connect as\n"); + printf(" -w never prompt for password\n"); printf(" -W force password prompt\n"); printf(" -v write a lot of progress messages\n"); printf("\n"); @@ -324,7 +333,7 @@ main(int argc, char **argv) /* Parameter handling */ param.pg_user = NULL; - param.pg_prompt = 0; + param.pg_prompt = TRI_DEFAULT; param.pg_host = NULL; param.pg_port = NULL; param.verbose = 0; @@ -332,7 +341,7 @@ main(int argc, char **argv) while (1) { - c = getopt(argc, argv, "?h:U:p:vnW"); + c = getopt(argc, argv, "?h:U:p:vnwW"); if (c == -1) break; @@ -357,8 +366,11 @@ main(int argc, char **argv) case 'U': param.pg_user = strdup(optarg); break; + case 'w': + param.pg_prompt = TRI_NO; + break; case 'W': - param.pg_prompt = 1; + param.pg_prompt = TRI_YES; break; case 'p': port = strtol(optarg, NULL, 10); diff --git a/doc/src/sgml/ref/clusterdb.sgml b/doc/src/sgml/ref/clusterdb.sgml index 45bfbe2f64..6dd448dca5 100644 --- a/doc/src/sgml/ref/clusterdb.sgml +++ b/doc/src/sgml/ref/clusterdb.sgml @@ -1,5 +1,5 @@ @@ -171,6 +171,21 @@ PostgreSQL documentation + + + + + + Never issue a password prompt. If the server requires + password authentication and a password is not available by + other means such as a .pgpass file, the + connection attempt will fail. This option can be useful in + batch jobs and scripts where no user is present to enter a + password. + + + + diff --git a/doc/src/sgml/ref/createdb.sgml b/doc/src/sgml/ref/createdb.sgml index c8c12e8b06..59f108c4cd 100644 --- a/doc/src/sgml/ref/createdb.sgml +++ b/doc/src/sgml/ref/createdb.sgml @@ -1,5 +1,5 @@ @@ -217,6 +217,21 @@ PostgreSQL documentation + + + + + + Never issue a password prompt. If the server requires + password authentication and a password is not available by + other means such as a .pgpass file, the + connection attempt will fail. This option can be useful in + batch jobs and scripts where no user is present to enter a + password. + + + + diff --git a/doc/src/sgml/ref/createlang.sgml b/doc/src/sgml/ref/createlang.sgml index 8383c66a8f..afe380dc13 100644 --- a/doc/src/sgml/ref/createlang.sgml +++ b/doc/src/sgml/ref/createlang.sgml @@ -1,5 +1,5 @@ @@ -139,6 +139,21 @@ PostgreSQL documentation + + + + + + Never issue a password prompt. If the server requires + password authentication and a password is not available by + other means such as a .pgpass file, the + connection attempt will fail. This option can be useful in + batch jobs and scripts where no user is present to enter a + password. + + + + diff --git a/doc/src/sgml/ref/createuser.sgml b/doc/src/sgml/ref/createuser.sgml index 95283e6775..1e8a1fc3fb 100644 --- a/doc/src/sgml/ref/createuser.sgml +++ b/doc/src/sgml/ref/createuser.sgml @@ -1,5 +1,5 @@ @@ -290,6 +290,21 @@ PostgreSQL documentation + + + + + + Never issue a password prompt. If the server requires + password authentication and a password is not available by + other means such as a .pgpass file, the + connection attempt will fail. This option can be useful in + batch jobs and scripts where no user is present to enter a + password. + + + + diff --git a/doc/src/sgml/ref/dropdb.sgml b/doc/src/sgml/ref/dropdb.sgml index daf01287fb..260241058c 100644 --- a/doc/src/sgml/ref/dropdb.sgml +++ b/doc/src/sgml/ref/dropdb.sgml @@ -1,5 +1,5 @@ @@ -128,6 +128,21 @@ PostgreSQL documentation + + + + + + Never issue a password prompt. If the server requires + password authentication and a password is not available by + other means such as a .pgpass file, the + connection attempt will fail. This option can be useful in + batch jobs and scripts where no user is present to enter a + password. + + + + diff --git a/doc/src/sgml/ref/droplang.sgml b/doc/src/sgml/ref/droplang.sgml index ee334e13e5..107a28b8aa 100644 --- a/doc/src/sgml/ref/droplang.sgml +++ b/doc/src/sgml/ref/droplang.sgml @@ -1,5 +1,5 @@ @@ -147,6 +147,21 @@ PostgreSQL documentation + + + + + + Never issue a password prompt. If the server requires + password authentication and a password is not available by + other means such as a .pgpass file, the + connection attempt will fail. This option can be useful in + batch jobs and scripts where no user is present to enter a + password. + + + + diff --git a/doc/src/sgml/ref/dropuser.sgml b/doc/src/sgml/ref/dropuser.sgml index af57135f12..b66a76f956 100644 --- a/doc/src/sgml/ref/dropuser.sgml +++ b/doc/src/sgml/ref/dropuser.sgml @@ -1,5 +1,5 @@ @@ -130,6 +130,21 @@ PostgreSQL documentation + + + + + + Never issue a password prompt. If the server requires + password authentication and a password is not available by + other means such as a .pgpass file, the + connection attempt will fail. This option can be useful in + batch jobs and scripts where no user is present to enter a + password. + + + + diff --git a/doc/src/sgml/ref/pg_dump.sgml b/doc/src/sgml/ref/pg_dump.sgml index 0a9d0dc26e..8633875006 100644 --- a/doc/src/sgml/ref/pg_dump.sgml +++ b/doc/src/sgml/ref/pg_dump.sgml @@ -1,5 +1,5 @@ @@ -678,6 +678,21 @@ PostgreSQL documentation + + + + + + Never issue a password prompt. If the server requires + password authentication and a password is not available by + other means such as a .pgpass file, the + connection attempt will fail. This option can be useful in + batch jobs and scripts where no user is present to enter a + password. + + + + diff --git a/doc/src/sgml/ref/pg_dumpall.sgml b/doc/src/sgml/ref/pg_dumpall.sgml index 6e6ef46c67..0a8e7ef8c4 100644 --- a/doc/src/sgml/ref/pg_dumpall.sgml +++ b/doc/src/sgml/ref/pg_dumpall.sgml @@ -1,5 +1,5 @@ @@ -391,6 +391,21 @@ PostgreSQL documentation + + + + + + Never issue a password prompt. If the server requires + password authentication and a password is not available by + other means such as a .pgpass file, the + connection attempt will fail. This option can be useful in + batch jobs and scripts where no user is present to enter a + password. + + + + diff --git a/doc/src/sgml/ref/pg_restore.sgml b/doc/src/sgml/ref/pg_restore.sgml index 787db5e884..4971836bab 100644 --- a/doc/src/sgml/ref/pg_restore.sgml +++ b/doc/src/sgml/ref/pg_restore.sgml @@ -1,4 +1,4 @@ - + @@ -510,6 +510,21 @@ + + + + + + Never issue a password prompt. If the server requires + password authentication and a password is not available by + other means such as a .pgpass file, the + connection attempt will fail. This option can be useful in + batch jobs and scripts where no user is present to enter a + password. + + + + diff --git a/doc/src/sgml/ref/psql-ref.sgml b/doc/src/sgml/ref/psql-ref.sgml index cab7b970ac..0f633e9160 100644 --- a/doc/src/sgml/ref/psql-ref.sgml +++ b/doc/src/sgml/ref/psql-ref.sgml @@ -1,5 +1,5 @@ @@ -401,6 +401,26 @@ PostgreSQL documentation + + + + + + Never issue a password prompt. If the server requires password + authentication and a password is not available by other means + such as a .pgpass file, the connection + attempt will fail. This option can be useful in batch jobs and + scripts where no user is present to enter a password. + + + + Note that this option will remain set for the entire session, + and so it affects uses of the meta-command + \connect as well as the initial connection attempt. + + + + diff --git a/doc/src/sgml/ref/reindexdb.sgml b/doc/src/sgml/ref/reindexdb.sgml index 259b170860..936edb9c3d 100644 --- a/doc/src/sgml/ref/reindexdb.sgml +++ b/doc/src/sgml/ref/reindexdb.sgml @@ -181,6 +181,21 @@ PostgreSQL documentation + + + + + + Never issue a password prompt. If the server requires + password authentication and a password is not available by + other means such as a .pgpass file, the + connection attempt will fail. This option can be useful in + batch jobs and scripts where no user is present to enter a + password. + + + + diff --git a/doc/src/sgml/ref/vacuumdb.sgml b/doc/src/sgml/ref/vacuumdb.sgml index 50d73b2465..75616ee46c 100644 --- a/doc/src/sgml/ref/vacuumdb.sgml +++ b/doc/src/sgml/ref/vacuumdb.sgml @@ -1,5 +1,5 @@ @@ -216,6 +216,21 @@ PostgreSQL documentation + + + + + + Never issue a password prompt. If the server requires + password authentication and a password is not available by + other means such as a .pgpass file, the + connection attempt will fail. This option can be useful in + batch jobs and scripts where no user is present to enter a + password. + + + + diff --git a/doc/src/sgml/vacuumlo.sgml b/doc/src/sgml/vacuumlo.sgml index 4152d3f59a..5a1a69a1ea 100644 --- a/doc/src/sgml/vacuumlo.sgml +++ b/doc/src/sgml/vacuumlo.sgml @@ -1,4 +1,4 @@ - + vacuumlo @@ -56,6 +56,20 @@ vacuumlo [options] database [database2 ... databaseN] + + + + + + Never issue a password prompt. If the server requires password + authentication and a password is not available by other means + such as a .pgpass file, the connection + attempt will fail. This option can be useful in batch jobs and + scripts where no user is present to enter a password. + + + + diff --git a/src/bin/pg_dump/pg_backup.h b/src/bin/pg_dump/pg_backup.h index 72bc066853..3e50b6b39a 100644 --- a/src/bin/pg_dump/pg_backup.h +++ b/src/bin/pg_dump/pg_backup.h @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup.h,v 1.49 2009/02/02 20:07:36 adunstan Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup.h,v 1.50 2009/02/26 16:02:37 petere Exp $ * *------------------------------------------------------------------------- */ @@ -37,6 +37,13 @@ #define oidge(x,y) ( (x) >= (y) ) #define oidzero(x) ( (x) == 0 ) +enum trivalue +{ + TRI_DEFAULT, + TRI_NO, + TRI_YES +}; + typedef enum _archiveFormat { archUnknown = 0, @@ -126,7 +133,7 @@ typedef struct _restoreOptions char *pghost; char *username; int noDataForFailedTables; - int requirePassword; + enum trivalue promptPassword; int exit_on_error; int compression; int suppressDumpWarnings; /* Suppress output of WARNING entries @@ -153,7 +160,7 @@ PGconn *ConnectDatabase(Archive *AH, const char *pghost, const char *pgport, const char *username, - int reqPwd); + enum trivalue prompt_password); /* Called to add a TOC entry */ extern void ArchiveEntry(Archive *AHX, diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index 0b46e1097b..b768f5c286 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -15,7 +15,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.163 2009/02/20 02:57:21 adunstan Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.c,v 1.164 2009/02/26 16:02:37 petere Exp $ * *------------------------------------------------------------------------- */ @@ -246,7 +246,7 @@ RestoreArchive(Archive *AHX, RestoreOptions *ropt) ConnectDatabase(AHX, ropt->dbname, ropt->pghost, ropt->pgport, ropt->username, - ropt->requirePassword); + ropt->promptPassword); /* * If we're talking to the DB directly, don't send comments since they @@ -609,6 +609,7 @@ NewRestoreOptions(void) /* set any fields that shouldn't default to zeroes */ opts->format = archUnknown; + opts->promptPassword = TRI_DEFAULT; return opts; } @@ -1886,6 +1887,8 @@ _allocAH(const char *FileSpec, const ArchiveFormat fmt, else AH->format = fmt; + AH->promptPassword = TRI_DEFAULT; + switch (AH->format) { case archCustom: @@ -3206,7 +3209,7 @@ restore_toc_entries_parallel(ArchiveHandle *AH) */ ConnectDatabase((Archive *) AH, ropt->dbname, ropt->pghost, ropt->pgport, ropt->username, - ropt->requirePassword); + ropt->promptPassword); _doSetFixedOutputState(AH); @@ -3476,7 +3479,7 @@ parallel_restore(RestoreArgs *args) */ ConnectDatabase((Archive *) AH, ropt->dbname, ropt->pghost, ropt->pgport, ropt->username, - ropt->requirePassword); + ropt->promptPassword); _doSetFixedOutputState(AH); diff --git a/src/bin/pg_dump/pg_backup_archiver.h b/src/bin/pg_dump/pg_backup_archiver.h index 43756eba4d..11c6a83dcb 100644 --- a/src/bin/pg_dump/pg_backup_archiver.h +++ b/src/bin/pg_dump/pg_backup_archiver.h @@ -17,7 +17,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.77 2009/02/02 20:07:37 adunstan Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_archiver.h,v 1.78 2009/02/26 16:02:38 petere Exp $ * *------------------------------------------------------------------------- */ @@ -238,7 +238,7 @@ typedef struct _archiveHandle /* Stuff for direct DB connection */ char *archdbname; /* DB name *read* from archive */ - bool requirePassword; + enum trivalue promptPassword; char *savedPassword; /* password for ropt->username, if known */ PGconn *connection; int connectToDB; /* Flag to indicate if direct DB connection is diff --git a/src/bin/pg_dump/pg_backup_db.c b/src/bin/pg_dump/pg_backup_db.c index f1b755b33b..52e0d82b15 100644 --- a/src/bin/pg_dump/pg_backup_db.c +++ b/src/bin/pg_dump/pg_backup_db.c @@ -5,7 +5,7 @@ * Implements the basic DB functions used by the archiver. * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.82 2009/02/25 13:24:40 petere Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.83 2009/02/26 16:02:38 petere Exp $ * *------------------------------------------------------------------------- */ @@ -145,7 +145,7 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, const char *requser) ahlog(AH, 1, "connecting to database \"%s\" as user \"%s\"\n", newdb, newuser); - if (AH->requirePassword && password == NULL) + if (AH->promptPassword == TRI_YES && password == NULL) { password = simple_prompt("Password: ", 100, false); if (password == NULL) @@ -176,7 +176,12 @@ _connectDB(ArchiveHandle *AH, const char *reqdb, const char *requser) if (password) free(password); - password = simple_prompt("Password: ", 100, false); + + if (AH->promptPassword != TRI_NO) + password = simple_prompt("Password: ", 100, false); + else + die_horribly(AH, modulename, "connection needs password\n"); + if (password == NULL) die_horribly(AH, modulename, "out of memory\n"); new_pass = true; @@ -209,7 +214,7 @@ ConnectDatabase(Archive *AHX, const char *pghost, const char *pgport, const char *username, - int reqPwd) + enum trivalue prompt_password) { ArchiveHandle *AH = (ArchiveHandle *) AHX; char *password = AH->savedPassword; @@ -218,13 +223,13 @@ ConnectDatabase(Archive *AHX, if (AH->connection) die_horribly(AH, modulename, "already connected to a database\n"); - if (reqPwd && password == NULL) + if (prompt_password == TRI_YES && password == NULL) { password = simple_prompt("Password: ", 100, false); if (password == NULL) die_horribly(AH, modulename, "out of memory\n"); } - AH->requirePassword = reqPwd; + AH->promptPassword = prompt_password; /* * Start the connection. Loop until we have a password if requested by @@ -241,7 +246,8 @@ ConnectDatabase(Archive *AHX, if (PQstatus(AH->connection) == CONNECTION_BAD && PQconnectionNeedsPassword(AH->connection) && - password == NULL) + password == NULL && + prompt_password != TRI_NO) { PQfinish(AH->connection); password = simple_prompt("Password: ", 100, false); diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 7de9f4ec6a..26e1c044cb 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -12,7 +12,7 @@ * by PostgreSQL * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.526 2009/02/25 13:03:06 petere Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dump.c,v 1.527 2009/02/26 16:02:38 petere Exp $ * *------------------------------------------------------------------------- */ @@ -221,7 +221,7 @@ main(int argc, char **argv) DumpableObject **dobjs; int numObjs; int i; - bool force_password = false; + enum trivalue prompt_password = TRI_DEFAULT; int compressLevel = -1; int plainText = 0; int outputClean = 0; @@ -261,6 +261,7 @@ main(int argc, char **argv) {"superuser", required_argument, NULL, 'S'}, {"table", required_argument, NULL, 't'}, {"exclude-table", required_argument, NULL, 'T'}, + {"no-password", no_argument, NULL, 'w'}, {"password", no_argument, NULL, 'W'}, {"username", required_argument, NULL, 'U'}, {"verbose", no_argument, NULL, 'v'}, @@ -315,7 +316,7 @@ main(int argc, char **argv) } } - while ((c = getopt_long(argc, argv, "abcCdDE:f:F:h:in:N:oOp:RsS:t:T:U:vWxX:Z:", + while ((c = getopt_long(argc, argv, "abcCdDE:f:F:h:in:N:oOp:RsS:t:T:U:vwWxX:Z:", long_options, &optindex)) != -1) { switch (c) @@ -416,8 +417,12 @@ main(int argc, char **argv) g_verbose = true; break; + case 'w': + prompt_password = TRI_NO; + break; + case 'W': - force_password = true; + prompt_password = TRI_YES; break; case 'x': /* skip ACL dump */ @@ -556,7 +561,7 @@ main(int argc, char **argv) * death. */ g_conn = ConnectDatabase(g_fout, dbname, pghost, pgport, - username, force_password); + username, prompt_password); /* Set the client encoding if requested */ if (dumpencoding) diff --git a/src/bin/pg_dump/pg_dumpall.c b/src/bin/pg_dump/pg_dumpall.c index 6d0add1eb6..2ddc03873e 100644 --- a/src/bin/pg_dump/pg_dumpall.c +++ b/src/bin/pg_dump/pg_dumpall.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.117 2009/02/25 13:24:40 petere Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.118 2009/02/26 16:02:38 petere Exp $ * *------------------------------------------------------------------------- */ @@ -52,7 +52,7 @@ static void doShellQuoting(PQExpBuffer buf, const char *str); static int runPgDump(const char *dbname); static PGconn *connectDatabase(const char *dbname, const char *pghost, const char *pgport, - const char *pguser, bool require_password, bool fail_on_error); + const char *pguser, enum trivalue prompt_password, bool fail_on_error); static PGresult *executeQuery(PGconn *conn, const char *query); static void executeCommand(PGconn *conn, const char *query); @@ -81,7 +81,7 @@ main(int argc, char *argv[]) char *pguser = NULL; char *pgdb = NULL; char *use_role = NULL; - bool force_password = false; + enum trivalue prompt_password = TRI_DEFAULT; bool data_only = false; bool globals_only = false; bool roles_only = false; @@ -114,6 +114,7 @@ main(int argc, char *argv[]) {"tablespaces-only", no_argument, NULL, 't'}, {"username", required_argument, NULL, 'U'}, {"verbose", no_argument, NULL, 'v'}, + {"no-password", no_argument, NULL, 'w'}, {"password", no_argument, NULL, 'W'}, {"no-privileges", no_argument, NULL, 'x'}, {"no-acl", no_argument, NULL, 'x'}, @@ -177,7 +178,7 @@ main(int argc, char *argv[]) pgdumpopts = createPQExpBuffer(); - while ((c = getopt_long(argc, argv, "acdDf:gh:il:oOp:rsS:tU:vWxX:", long_options, &optindex)) != -1) + while ((c = getopt_long(argc, argv, "acdDf:gh:il:oOp:rsS:tU:vwWxX:", long_options, &optindex)) != -1) { switch (c) { @@ -262,8 +263,13 @@ main(int argc, char *argv[]) appendPQExpBuffer(pgdumpopts, " -v"); break; + case 'w': + prompt_password = TRI_NO; + appendPQExpBuffer(pgdumpopts, " -w"); + break; + case 'W': - force_password = true; + prompt_password = TRI_YES; appendPQExpBuffer(pgdumpopts, " -W"); break; @@ -370,7 +376,7 @@ main(int argc, char *argv[]) if (pgdb) { conn = connectDatabase(pgdb, pghost, pgport, pguser, - force_password, false); + prompt_password, false); if (!conn) { @@ -382,10 +388,10 @@ main(int argc, char *argv[]) else { conn = connectDatabase("postgres", pghost, pgport, pguser, - force_password, false); + prompt_password, false); if (!conn) conn = connectDatabase("template1", pghost, pgport, pguser, - force_password, true); + prompt_password, true); if (!conn) { @@ -528,6 +534,7 @@ help(void) printf(_(" -l, --database=DBNAME alternative default database\n")); printf(_(" -p, --port=PORT database server port number\n")); printf(_(" -U, --username=NAME connect as specified database user\n")); + printf(_(" -w, --no-password never prompt for password\n")); printf(_(" -W, --password force password prompt (should happen automatically)\n")); printf(_("\nIf -f/--file is not used, then the SQL script will be written to the standard\n" @@ -1329,7 +1336,7 @@ runPgDump(const char *dbname) */ static PGconn * connectDatabase(const char *dbname, const char *pghost, const char *pgport, - const char *pguser, bool require_password, bool fail_on_error) + const char *pguser, enum trivalue prompt_password, bool fail_on_error) { PGconn *conn; bool new_pass; @@ -1337,7 +1344,7 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport, int my_version; static char *password = NULL; - if (require_password && !password) + if (prompt_password == TRI_YES && !password) password = simple_prompt("Password: ", 100, false); /* @@ -1358,7 +1365,8 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport, if (PQstatus(conn) == CONNECTION_BAD && PQconnectionNeedsPassword(conn) && - password == NULL) + password == NULL && + prompt_password != TRI_NO) { PQfinish(conn); password = simple_prompt("Password: ", 100, false); diff --git a/src/bin/pg_dump/pg_restore.c b/src/bin/pg_dump/pg_restore.c index a0ab3efecf..02b81b8e8a 100644 --- a/src/bin/pg_dump/pg_restore.c +++ b/src/bin/pg_dump/pg_restore.c @@ -34,7 +34,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.93 2009/02/25 13:03:06 petere Exp $ + * $PostgreSQL: pgsql/src/bin/pg_dump/pg_restore.c,v 1.94 2009/02/26 16:02:38 petere Exp $ * *------------------------------------------------------------------------- */ @@ -99,6 +99,7 @@ main(int argc, char **argv) {"no-owner", 0, NULL, 'O'}, {"no-reconnect", 0, NULL, 'R'}, {"port", 1, NULL, 'p'}, + {"no-password", 0, NULL, 'w'}, {"password", 0, NULL, 'W'}, {"schema", 1, NULL, 'n'}, {"schema-only", 0, NULL, 's'}, @@ -142,7 +143,7 @@ main(int argc, char **argv) } } - while ((c = getopt_long(argc, argv, "acCd:ef:F:h:iI:lL:m:n:Op:P:RsS:t:T:U:vWxX:1", + while ((c = getopt_long(argc, argv, "acCd:ef:F:h:iI:lL:m:n:Op:P:RsS:t:T:U:vwWxX:1", cmdopts, NULL)) != -1) { switch (c) @@ -240,8 +241,12 @@ main(int argc, char **argv) opts->verbose = 1; break; + case 'w': + opts->promptPassword = TRI_NO; + break; + case 'W': - opts->requirePassword = true; + opts->promptPassword = TRI_YES; break; case 'x': /* skip ACL dump */ @@ -437,6 +442,7 @@ usage(const char *progname) printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port number\n")); printf(_(" -U, --username=NAME connect as specified database user\n")); + printf(_(" -w, --no-password never prompt for password\n")); printf(_(" -W, --password force password prompt (should happen automatically)\n")); printf(_("\nIf no input file name is supplied, then standard input is used.\n\n")); diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 41888666de..24c5b4d53c 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.202 2009/01/20 02:13:42 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.203 2009/02/26 16:02:38 petere Exp $ */ #include "postgres_fe.h" #include "command.h" @@ -1212,7 +1212,7 @@ do_connect(char *dbname, char *user, char *host, char *port) * the postmaster's log. But libpq offers no API that would let us obtain * a password and then continue with the first connection attempt. */ - if (pset.getPassword) + if (pset.getPassword == TRI_YES) { password = prompt_for_password(user); } @@ -1237,7 +1237,7 @@ do_connect(char *dbname, char *user, char *host, char *port) * Connection attempt failed; either retry the connection attempt with * a new password, or give up. */ - if (!password && PQconnectionNeedsPassword(n_conn)) + if (!password && PQconnectionNeedsPassword(n_conn) && pset.getPassword != TRI_NO) { PQfinish(n_conn); password = prompt_for_password(user); diff --git a/src/bin/psql/help.c b/src/bin/psql/help.c index 25d023ff07..36c89d516e 100644 --- a/src/bin/psql/help.c +++ b/src/bin/psql/help.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.139 2009/02/25 13:03:07 petere Exp $ + * $PostgreSQL: pgsql/src/bin/psql/help.c,v 1.140 2009/02/26 16:02:38 petere Exp $ */ #include "postgres_fe.h" @@ -140,6 +140,7 @@ usage(void) if (!env) env = user; printf(_(" -U NAME database user name (default: \"%s\")\n"), env); + puts(_(" -w never prompt for password")); puts(_(" -W force password prompt (should happen automatically)")); puts(_( diff --git a/src/bin/psql/settings.h b/src/bin/psql/settings.h index fbf5ebe931..31b76e112d 100644 --- a/src/bin/psql/settings.h +++ b/src/bin/psql/settings.h @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/settings.h,v 1.34 2009/01/01 17:23:55 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/psql/settings.h,v 1.35 2009/02/26 16:02:38 petere Exp $ */ #ifndef SETTINGS_H #define SETTINGS_H @@ -55,6 +55,12 @@ typedef enum hctl_ignoreboth = hctl_ignorespace | hctl_ignoredups } HistControl; +enum trivalue +{ + TRI_DEFAULT, + TRI_NO, + TRI_YES +}; typedef struct _psqlSettings { @@ -69,7 +75,7 @@ typedef struct _psqlSettings bool notty; /* stdin or stdout is not a tty (as determined * on startup) */ - bool getPassword; /* prompt the user for a username and password */ + enum trivalue getPassword; /* prompt the user for a username and password */ FILE *cur_cmd_source; /* describe the status of the current main * loop */ bool cur_cmd_interactive; diff --git a/src/bin/psql/startup.c b/src/bin/psql/startup.c index ba4871f88e..bea174c068 100644 --- a/src/bin/psql/startup.c +++ b/src/bin/psql/startup.c @@ -3,7 +3,7 @@ * * Copyright (c) 2000-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.154 2009/02/25 13:24:40 petere Exp $ + * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.155 2009/02/26 16:02:38 petere Exp $ */ #include "postgres_fe.h" @@ -140,12 +140,7 @@ main(int argc, char *argv[]) pset.notty = (!isatty(fileno(stdin)) || !isatty(fileno(stdout))); - /* This is obsolete and should be removed sometime. */ -#ifdef PSQL_ALWAYS_GET_PASSWORDS - pset.getPassword = true; -#else - pset.getPassword = false; -#endif + pset.getPassword = TRI_DEFAULT; EstablishVariableSpace(); @@ -175,7 +170,7 @@ main(int argc, char *argv[]) options.username); } - if (pset.getPassword) + if (pset.getPassword == TRI_YES) password = simple_prompt(password_prompt, 100, false); /* loop until we have a password if requested by backend */ @@ -189,7 +184,8 @@ main(int argc, char *argv[]) if (PQstatus(pset.db) == CONNECTION_BAD && PQconnectionNeedsPassword(pset.db) && - password == NULL) + password == NULL && + pset.getPassword != TRI_NO) { PQfinish(pset.db); password = simple_prompt(password_prompt, 100, false); @@ -340,6 +336,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options) {"set", required_argument, NULL, 'v'}, {"variable", required_argument, NULL, 'v'}, {"version", no_argument, NULL, 'V'}, + {"no-password", no_argument, NULL, 'w'}, {"password", no_argument, NULL, 'W'}, {"expanded", no_argument, NULL, 'x'}, {"no-psqlrc", no_argument, NULL, 'X'}, @@ -354,7 +351,7 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options) memset(options, 0, sizeof *options); - while ((c = getopt_long(argc, argv, "aAc:d:eEf:F:h:HlL:no:p:P:qR:sStT:U:v:VWxX?1", + while ((c = getopt_long(argc, argv, "aAc:d:eEf:F:h:HlL:no:p:P:qR:sStT:U:v:VwWxX?1", long_options, &optindex)) != -1) { switch (c) @@ -491,8 +488,11 @@ parse_psql_options(int argc, char *argv[], struct adhoc_opts * options) case 'V': showVersion(); exit(EXIT_SUCCESS); + case 'w': + pset.getPassword = TRI_NO; + break; case 'W': - pset.getPassword = true; + pset.getPassword = TRI_YES; break; case 'x': pset.popt.topt.expanded = true; diff --git a/src/bin/scripts/clusterdb.c b/src/bin/scripts/clusterdb.c index e2755c5be6..c690de36cc 100644 --- a/src/bin/scripts/clusterdb.c +++ b/src/bin/scripts/clusterdb.c @@ -4,7 +4,7 @@ * * Portions Copyright (c) 2002-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.24 2009/02/25 13:03:07 petere Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/clusterdb.c,v 1.25 2009/02/26 16:02:38 petere Exp $ * *------------------------------------------------------------------------- */ @@ -16,10 +16,10 @@ static void cluster_one_database(const char *dbname, bool verbose, const char *table, const char *host, const char *port, - const char *username, bool password, + const char *username, enum trivalue prompt_password, const char *progname, bool echo); static void cluster_all_databases(bool verbose, const char *host, const char *port, - const char *username, bool password, + const char *username, enum trivalue prompt_password, const char *progname, bool echo, bool quiet); static void help(const char *progname); @@ -32,6 +32,7 @@ main(int argc, char *argv[]) {"host", required_argument, NULL, 'h'}, {"port", required_argument, NULL, 'p'}, {"username", required_argument, NULL, 'U'}, + {"no-password", no_argument, NULL, 'w'}, {"password", no_argument, NULL, 'W'}, {"echo", no_argument, NULL, 'e'}, {"quiet", no_argument, NULL, 'q'}, @@ -50,7 +51,7 @@ main(int argc, char *argv[]) char *host = NULL; char *port = NULL; char *username = NULL; - bool password = false; + enum trivalue prompt_password = TRI_DEFAULT; bool echo = false; bool quiet = false; bool alldb = false; @@ -62,7 +63,7 @@ main(int argc, char *argv[]) handle_help_version_opts(argc, argv, "clusterdb", help); - while ((c = getopt_long(argc, argv, "h:p:U:Weqd:at:v", long_options, &optindex)) != -1) + while ((c = getopt_long(argc, argv, "h:p:U:wWeqd:at:v", long_options, &optindex)) != -1) { switch (c) { @@ -75,8 +76,11 @@ main(int argc, char *argv[]) case 'U': username = optarg; break; + case 'w': + prompt_password = TRI_NO; + break; case 'W': - password = true; + prompt_password = TRI_YES; break; case 'e': echo = true; @@ -133,7 +137,7 @@ main(int argc, char *argv[]) exit(1); } - cluster_all_databases(verbose, host, port, username, password, + cluster_all_databases(verbose, host, port, username, prompt_password, progname, echo, quiet); } else @@ -149,7 +153,7 @@ main(int argc, char *argv[]) } cluster_one_database(dbname, verbose, table, - host, port, username, password, + host, port, username, prompt_password, progname, echo); } @@ -160,7 +164,7 @@ main(int argc, char *argv[]) static void cluster_one_database(const char *dbname, bool verbose, const char *table, const char *host, const char *port, - const char *username, bool password, + const char *username, enum trivalue prompt_password, const char *progname, bool echo) { PQExpBufferData sql; @@ -176,7 +180,7 @@ cluster_one_database(const char *dbname, bool verbose, const char *table, appendPQExpBuffer(&sql, " %s", fmtId(table)); appendPQExpBuffer(&sql, ";\n"); - conn = connectDatabase(dbname, host, port, username, password, progname); + conn = connectDatabase(dbname, host, port, username, prompt_password, progname); if (!executeMaintenanceCommand(conn, sql.data, echo)) { if (table) @@ -195,14 +199,14 @@ cluster_one_database(const char *dbname, bool verbose, const char *table, static void cluster_all_databases(bool verbose, const char *host, const char *port, - const char *username, bool password, + const char *username, enum trivalue prompt_password, const char *progname, bool echo, bool quiet) { PGconn *conn; PGresult *result; int i; - conn = connectDatabase("postgres", host, port, username, password, progname); + conn = connectDatabase("postgres", host, port, username, prompt_password, progname); result = executeQuery(conn, "SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;", progname, echo); PQfinish(conn); @@ -217,7 +221,7 @@ cluster_all_databases(bool verbose, const char *host, const char *port, } cluster_one_database(dbname, verbose, NULL, - host, port, username, password, + host, port, username, prompt_password, progname, echo); } @@ -244,6 +248,7 @@ help(const char *progname) printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port\n")); printf(_(" -U, --username=USERNAME user name to connect as\n")); + printf(_(" -w, --no-password never prompt for password\n")); printf(_(" -W, --password force password prompt\n")); printf(_("\nRead the description of the SQL command CLUSTER for details.\n")); printf(_("\nReport bugs to .\n")); diff --git a/src/bin/scripts/common.c b/src/bin/scripts/common.c index 2587f1a99d..c34115a1ba 100644 --- a/src/bin/scripts/common.c +++ b/src/bin/scripts/common.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.34 2009/02/25 13:24:40 petere Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.35 2009/02/26 16:02:38 petere Exp $ * *------------------------------------------------------------------------- */ @@ -96,14 +96,14 @@ handle_help_version_opts(int argc, char *argv[], */ PGconn * connectDatabase(const char *dbname, const char *pghost, const char *pgport, - const char *pguser, bool require_password, + const char *pguser, enum trivalue prompt_password, const char *progname) { PGconn *conn; char *password = NULL; bool new_pass; - if (require_password) + if (prompt_password == TRI_YES) password = simple_prompt("Password: ", 100, false); /* @@ -124,7 +124,8 @@ connectDatabase(const char *dbname, const char *pghost, const char *pgport, if (PQstatus(conn) == CONNECTION_BAD && PQconnectionNeedsPassword(conn) && - password == NULL) + password == NULL && + prompt_password != TRI_NO) { PQfinish(conn); password = simple_prompt("Password: ", 100, false); diff --git a/src/bin/scripts/common.h b/src/bin/scripts/common.h index 5123920be4..5c94d46add 100644 --- a/src/bin/scripts/common.h +++ b/src/bin/scripts/common.h @@ -4,7 +4,7 @@ * * Copyright (c) 2003-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/scripts/common.h,v 1.21 2009/01/01 17:23:55 momjian Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/common.h,v 1.22 2009/02/26 16:02:39 petere Exp $ */ #ifndef COMMON_H #define COMMON_H @@ -17,6 +17,13 @@ extern int optreset; #endif +enum trivalue +{ + TRI_DEFAULT, + TRI_NO, + TRI_YES +}; + typedef void (*help_handler) (const char *progname); extern const char *get_user_name(const char *progname); @@ -27,7 +34,7 @@ extern void handle_help_version_opts(int argc, char *argv[], extern PGconn *connectDatabase(const char *dbname, const char *pghost, const char *pgport, const char *pguser, - bool require_password, const char *progname); + enum trivalue prompt_password, const char *progname); extern PGresult *executeQuery(PGconn *conn, const char *query, const char *progname, bool echo); diff --git a/src/bin/scripts/createdb.c b/src/bin/scripts/createdb.c index a587771f23..f7cb9cf3de 100644 --- a/src/bin/scripts/createdb.c +++ b/src/bin/scripts/createdb.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.31 2009/02/25 13:03:07 petere Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/createdb.c,v 1.32 2009/02/26 16:02:39 petere Exp $ * *------------------------------------------------------------------------- */ @@ -25,6 +25,7 @@ main(int argc, char *argv[]) {"host", required_argument, NULL, 'h'}, {"port", required_argument, NULL, 'p'}, {"username", required_argument, NULL, 'U'}, + {"no-password", no_argument, NULL, 'w'}, {"password", no_argument, NULL, 'W'}, {"echo", no_argument, NULL, 'e'}, {"quiet", no_argument, NULL, 'q'}, @@ -47,7 +48,7 @@ main(int argc, char *argv[]) char *host = NULL; char *port = NULL; char *username = NULL; - bool password = false; + enum trivalue prompt_password = TRI_DEFAULT; bool echo = false; char *owner = NULL; char *tablespace = NULL; @@ -67,7 +68,7 @@ main(int argc, char *argv[]) handle_help_version_opts(argc, argv, "createdb", help); - while ((c = getopt_long(argc, argv, "h:p:U:WeqO:D:T:E:l:", long_options, &optindex)) != -1) + while ((c = getopt_long(argc, argv, "h:p:U:wWeqO:D:T:E:l:", long_options, &optindex)) != -1) { switch (c) { @@ -80,8 +81,11 @@ main(int argc, char *argv[]) case 'U': username = optarg; break; + case 'w': + prompt_password = TRI_NO; + break; case 'W': - password = true; + prompt_password = TRI_YES; break; case 'e': echo = true; @@ -193,7 +197,7 @@ main(int argc, char *argv[]) appendPQExpBuffer(&sql, ";\n"); conn = connectDatabase(strcmp(dbname, "postgres") == 0 ? "template1" : "postgres", - host, port, username, password, progname); + host, port, username, prompt_password, progname); if (echo) printf("%s", sql.data); @@ -212,7 +216,7 @@ main(int argc, char *argv[]) if (comment) { - conn = connectDatabase(dbname, host, port, username, password, progname); + conn = connectDatabase(dbname, host, port, username, prompt_password, progname); printfPQExpBuffer(&sql, "COMMENT ON DATABASE %s IS ", fmtId(dbname)); appendStringLiteralConn(&sql, comment, conn); @@ -259,6 +263,7 @@ help(const char *progname) printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port\n")); printf(_(" -U, --username=USERNAME user name to connect as\n")); + printf(_(" -w, --no-password never prompt for password\n")); printf(_(" -W, --password force password prompt\n")); printf(_("\nBy default, a database with the same name as the current user is created.\n")); printf(_("\nReport bugs to .\n")); diff --git a/src/bin/scripts/createlang.c b/src/bin/scripts/createlang.c index dcfef2b608..d00cb63a8b 100644 --- a/src/bin/scripts/createlang.c +++ b/src/bin/scripts/createlang.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/scripts/createlang.c,v 1.33 2009/02/25 13:03:07 petere Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/createlang.c,v 1.34 2009/02/26 16:02:39 petere Exp $ * *------------------------------------------------------------------------- */ @@ -25,6 +25,7 @@ main(int argc, char *argv[]) {"host", required_argument, NULL, 'h'}, {"port", required_argument, NULL, 'p'}, {"username", required_argument, NULL, 'U'}, + {"no-password", no_argument, NULL, 'w'}, {"password", no_argument, NULL, 'W'}, {"dbname", required_argument, NULL, 'd'}, {"echo", no_argument, NULL, 'e'}, @@ -40,7 +41,7 @@ main(int argc, char *argv[]) char *host = NULL; char *port = NULL; char *username = NULL; - bool password = false; + enum trivalue prompt_password = TRI_DEFAULT; bool echo = false; char *langname = NULL; @@ -56,7 +57,7 @@ main(int argc, char *argv[]) handle_help_version_opts(argc, argv, "createlang", help); - while ((c = getopt_long(argc, argv, "lh:p:U:Wd:e", long_options, &optindex)) != -1) + while ((c = getopt_long(argc, argv, "lh:p:U:wWd:e", long_options, &optindex)) != -1) { switch (c) { @@ -72,8 +73,11 @@ main(int argc, char *argv[]) case 'U': username = optarg; break; + case 'w': + prompt_password = TRI_NO; + break; case 'W': - password = true; + prompt_password = TRI_YES; break; case 'd': dbname = optarg; @@ -127,7 +131,7 @@ main(int argc, char *argv[]) printQueryOpt popt; static const bool translate_columns[] = {false, true}; - conn = connectDatabase(dbname, host, port, username, password, + conn = connectDatabase(dbname, host, port, username, prompt_password, progname); printfPQExpBuffer(&sql, "SELECT lanname as \"%s\", " @@ -164,7 +168,7 @@ main(int argc, char *argv[]) if (*p >= 'A' && *p <= 'Z') *p += ('a' - 'A'); - conn = connectDatabase(dbname, host, port, username, password, progname); + conn = connectDatabase(dbname, host, port, username, prompt_password, progname); /* * Make sure the language isn't already installed @@ -220,6 +224,7 @@ help(const char *progname) printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port\n")); printf(_(" -U, --username=USERNAME user name to connect as\n")); + printf(_(" -w, --no-password never prompt for password\n")); printf(_(" -W, --password force password prompt\n")); printf(_("\nReport bugs to .\n")); } diff --git a/src/bin/scripts/createuser.c b/src/bin/scripts/createuser.c index 852cafd648..88b9bd30d5 100644 --- a/src/bin/scripts/createuser.c +++ b/src/bin/scripts/createuser.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.41 2009/02/25 13:03:07 petere Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/createuser.c,v 1.42 2009/02/26 16:02:39 petere Exp $ * *------------------------------------------------------------------------- */ @@ -17,13 +17,6 @@ static void help(const char *progname); -enum trivalue -{ - TRI_DEFAULT, - TRI_NO, - TRI_YES -}; - int main(int argc, char *argv[]) { @@ -31,6 +24,7 @@ main(int argc, char *argv[]) {"host", required_argument, NULL, 'h'}, {"port", required_argument, NULL, 'p'}, {"username", required_argument, NULL, 'U'}, + {"no-password", no_argument, NULL, 'w'}, {"password", no_argument, NULL, 'W'}, {"echo", no_argument, NULL, 'e'}, {"quiet", no_argument, NULL, 'q'}, @@ -61,7 +55,7 @@ main(int argc, char *argv[]) char *host = NULL; char *port = NULL; char *username = NULL; - bool password = false; + enum trivalue prompt_password = TRI_DEFAULT; bool echo = false; char *conn_limit = NULL; bool pwprompt = false; @@ -85,7 +79,7 @@ main(int argc, char *argv[]) handle_help_version_opts(argc, argv, "createuser", help); - while ((c = getopt_long(argc, argv, "h:p:U:WeqdDsSaArRiIlLc:PEN", + while ((c = getopt_long(argc, argv, "h:p:U:wWeqdDsSaArRiIlLc:PEN", long_options, &optindex)) != -1) { switch (c) @@ -99,8 +93,11 @@ main(int argc, char *argv[]) case 'U': username = optarg; break; + case 'w': + prompt_password = TRI_NO; + break; case 'W': - password = true; + prompt_password = TRI_YES; break; case 'e': echo = true; @@ -228,7 +225,7 @@ main(int argc, char *argv[]) if (login == 0) login = TRI_YES; - conn = connectDatabase("postgres", host, port, username, password, progname); + conn = connectDatabase("postgres", host, port, username, prompt_password, progname); initPQExpBuffer(&sql); @@ -329,6 +326,7 @@ help(const char *progname) printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port\n")); printf(_(" -U, --username=USERNAME user name to connect as (not the one to create)\n")); + printf(_(" -w, --no-password never prompt for password\n")); printf(_(" -W, --password force password prompt\n")); printf(_("\nIf one of -d, -D, -r, -R, -s, -S, and ROLENAME is not specified, you will\n" "be prompted interactively.\n")); diff --git a/src/bin/scripts/dropdb.c b/src/bin/scripts/dropdb.c index 2874718078..086e1c1517 100644 --- a/src/bin/scripts/dropdb.c +++ b/src/bin/scripts/dropdb.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.25 2009/02/25 13:03:07 petere Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/dropdb.c,v 1.26 2009/02/26 16:02:39 petere Exp $ * *------------------------------------------------------------------------- */ @@ -25,6 +25,7 @@ main(int argc, char *argv[]) {"host", required_argument, NULL, 'h'}, {"port", required_argument, NULL, 'p'}, {"username", required_argument, NULL, 'U'}, + {"no-password", no_argument, NULL, 'w'}, {"password", no_argument, NULL, 'W'}, {"echo", no_argument, NULL, 'e'}, {"quiet", no_argument, NULL, 'q'}, @@ -40,7 +41,7 @@ main(int argc, char *argv[]) char *host = NULL; char *port = NULL; char *username = NULL; - bool password = false; + enum trivalue prompt_password = TRI_DEFAULT; bool echo = false; bool interactive = false; @@ -54,7 +55,7 @@ main(int argc, char *argv[]) handle_help_version_opts(argc, argv, "dropdb", help); - while ((c = getopt_long(argc, argv, "h:p:U:Weqi", long_options, &optindex)) != -1) + while ((c = getopt_long(argc, argv, "h:p:U:wWeqi", long_options, &optindex)) != -1) { switch (c) { @@ -67,8 +68,11 @@ main(int argc, char *argv[]) case 'U': username = optarg; break; + case 'w': + prompt_password = TRI_NO; + break; case 'W': - password = true; + prompt_password = TRI_YES; break; case 'e': echo = true; @@ -114,7 +118,7 @@ main(int argc, char *argv[]) fmtId(dbname)); conn = connectDatabase(strcmp(dbname, "postgres") == 0 ? "template1" : "postgres", - host, port, username, password, progname); + host, port, username, prompt_password, progname); if (echo) printf("%s", sql.data); @@ -148,6 +152,7 @@ help(const char *progname) printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port\n")); printf(_(" -U, --username=USERNAME user name to connect as\n")); + printf(_(" -w, --no-password never prompt for password\n")); printf(_(" -W, --password force password prompt\n")); printf(_("\nReport bugs to .\n")); } diff --git a/src/bin/scripts/droplang.c b/src/bin/scripts/droplang.c index 13f8e325bb..7038e08b8a 100644 --- a/src/bin/scripts/droplang.c +++ b/src/bin/scripts/droplang.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/scripts/droplang.c,v 1.30 2009/02/25 13:03:07 petere Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/droplang.c,v 1.31 2009/02/26 16:02:39 petere Exp $ * *------------------------------------------------------------------------- */ @@ -28,6 +28,7 @@ main(int argc, char *argv[]) {"host", required_argument, NULL, 'h'}, {"port", required_argument, NULL, 'p'}, {"username", required_argument, NULL, 'U'}, + {"no-password", no_argument, NULL, 'w'}, {"password", no_argument, NULL, 'W'}, {"dbname", required_argument, NULL, 'd'}, {"echo", no_argument, NULL, 'e'}, @@ -43,7 +44,7 @@ main(int argc, char *argv[]) char *host = NULL; char *port = NULL; char *username = NULL; - bool password = false; + enum trivalue prompt_password = TRI_DEFAULT; bool echo = false; char *langname = NULL; @@ -67,7 +68,7 @@ main(int argc, char *argv[]) handle_help_version_opts(argc, argv, "droplang", help); - while ((c = getopt_long(argc, argv, "lh:p:U:Wd:e", long_options, &optindex)) != -1) + while ((c = getopt_long(argc, argv, "lh:p:U:wWd:e", long_options, &optindex)) != -1) { switch (c) { @@ -83,8 +84,11 @@ main(int argc, char *argv[]) case 'U': username = optarg; break; + case 'w': + prompt_password = TRI_NO; + break; case 'W': - password = true; + prompt_password = TRI_YES; break; case 'd': dbname = optarg; @@ -138,7 +142,7 @@ main(int argc, char *argv[]) printQueryOpt popt; static const bool translate_columns[] = {false, true}; - conn = connectDatabase(dbname, host, port, username, password, + conn = connectDatabase(dbname, host, port, username, prompt_password, progname); printfPQExpBuffer(&sql, "SELECT lanname as \"%s\", " @@ -177,7 +181,7 @@ main(int argc, char *argv[]) if (*p >= 'A' && *p <= 'Z') *p += ('a' - 'A'); - conn = connectDatabase(dbname, host, port, username, password, progname); + conn = connectDatabase(dbname, host, port, username, prompt_password, progname); /* * Force schema search path to be just pg_catalog, so that we don't have @@ -337,6 +341,7 @@ help(const char *progname) printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port\n")); printf(_(" -U, --username=USERNAME user name to connect as\n")); + printf(_(" -w, --no-password never prompt for password\n")); printf(_(" -W, --password force password prompt\n")); printf(_("\nReport bugs to .\n")); } diff --git a/src/bin/scripts/dropuser.c b/src/bin/scripts/dropuser.c index a5087afcf0..be2e2ceda6 100644 --- a/src/bin/scripts/dropuser.c +++ b/src/bin/scripts/dropuser.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.26 2009/02/25 13:03:07 petere Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/dropuser.c,v 1.27 2009/02/26 16:02:39 petere Exp $ * *------------------------------------------------------------------------- */ @@ -25,6 +25,7 @@ main(int argc, char *argv[]) {"host", required_argument, NULL, 'h'}, {"port", required_argument, NULL, 'p'}, {"username", required_argument, NULL, 'U'}, + {"no-password", no_argument, NULL, 'w'}, {"password", no_argument, NULL, 'W'}, {"echo", no_argument, NULL, 'e'}, {"quiet", no_argument, NULL, 'q'}, @@ -40,7 +41,7 @@ main(int argc, char *argv[]) char *host = NULL; char *port = NULL; char *username = NULL; - bool password = false; + enum trivalue prompt_password = TRI_DEFAULT; bool echo = false; bool interactive = false; @@ -54,7 +55,7 @@ main(int argc, char *argv[]) handle_help_version_opts(argc, argv, "dropuser", help); - while ((c = getopt_long(argc, argv, "h:p:U:Weqi", long_options, &optindex)) != -1) + while ((c = getopt_long(argc, argv, "h:p:U:wWeqi", long_options, &optindex)) != -1) { switch (c) { @@ -67,8 +68,11 @@ main(int argc, char *argv[]) case 'U': username = optarg; break; + case 'w': + prompt_password = TRI_NO; + break; case 'W': - password = true; + prompt_password = TRI_YES; break; case 'e': echo = true; @@ -112,7 +116,7 @@ main(int argc, char *argv[]) initPQExpBuffer(&sql); appendPQExpBuffer(&sql, "DROP ROLE %s;\n", fmtId(dropuser)); - conn = connectDatabase("postgres", host, port, username, password, progname); + conn = connectDatabase("postgres", host, port, username, prompt_password, progname); if (echo) printf("%s", sql.data); @@ -147,6 +151,7 @@ help(const char *progname) printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port\n")); printf(_(" -U, --username=USERNAME user name to connect as (not the one to drop)\n")); + printf(_(" -w, --no-password never prompt for password\n")); printf(_(" -W, --password force password prompt\n")); printf(_("\nReport bugs to .\n")); } diff --git a/src/bin/scripts/reindexdb.c b/src/bin/scripts/reindexdb.c index ebccd04f5e..3bfa55249a 100644 --- a/src/bin/scripts/reindexdb.c +++ b/src/bin/scripts/reindexdb.c @@ -4,7 +4,7 @@ * * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/bin/scripts/reindexdb.c,v 1.16 2009/02/25 13:03:07 petere Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/reindexdb.c,v 1.17 2009/02/26 16:02:39 petere Exp $ * *------------------------------------------------------------------------- */ @@ -17,15 +17,15 @@ static void reindex_one_database(const char *name, const char *dbname, const char *type, const char *host, const char *port, const char *username, - bool password, const char *progname, + enum trivalue prompt_password, const char *progname, bool echo); static void reindex_all_databases(const char *host, const char *port, - const char *username, bool password, + const char *username, enum trivalue prompt_password, const char *progname, bool echo, bool quiet); static void reindex_system_catalogs(const char *dbname, const char *host, const char *port, - const char *username, bool password, + const char *username, enum trivalue prompt_password, const char *progname, bool echo); static void help(const char *progname); @@ -36,6 +36,7 @@ main(int argc, char *argv[]) {"host", required_argument, NULL, 'h'}, {"port", required_argument, NULL, 'p'}, {"username", required_argument, NULL, 'U'}, + {"no-password", no_argument, NULL, 'w'}, {"password", no_argument, NULL, 'W'}, {"echo", no_argument, NULL, 'e'}, {"quiet", no_argument, NULL, 'q'}, @@ -55,7 +56,7 @@ main(int argc, char *argv[]) const char *host = NULL; const char *port = NULL; const char *username = NULL; - bool password = false; + enum trivalue prompt_password = TRI_DEFAULT; bool syscatalog = false; bool alldb = false; bool echo = false; @@ -69,7 +70,7 @@ main(int argc, char *argv[]) handle_help_version_opts(argc, argv, "reindexdb", help); /* process command-line options */ - while ((c = getopt_long(argc, argv, "h:p:U:Weqd:ast:i:", long_options, &optindex)) != -1) + while ((c = getopt_long(argc, argv, "h:p:U:wWeqd:ast:i:", long_options, &optindex)) != -1) { switch (c) { @@ -82,8 +83,11 @@ main(int argc, char *argv[]) case 'U': username = optarg; break; + case 'w': + prompt_password = TRI_NO; + break; case 'W': - password = true; + prompt_password = TRI_YES; break; case 'e': echo = true; @@ -150,7 +154,7 @@ main(int argc, char *argv[]) exit(1); } - reindex_all_databases(host, port, username, password, + reindex_all_databases(host, port, username, prompt_password, progname, echo, quiet); } else if (syscatalog) @@ -176,7 +180,7 @@ main(int argc, char *argv[]) dbname = get_user_name(progname); } - reindex_system_catalogs(dbname, host, port, username, password, + reindex_system_catalogs(dbname, host, port, username, prompt_password, progname, echo); } else @@ -193,14 +197,14 @@ main(int argc, char *argv[]) if (index) reindex_one_database(index, dbname, "INDEX", host, port, - username, password, progname, echo); + username, prompt_password, progname, echo); if (table) reindex_one_database(table, dbname, "TABLE", host, port, - username, password, progname, echo); + username, prompt_password, progname, echo); /* reindex database only if index or table is not specified */ if (index == NULL && table == NULL) reindex_one_database(dbname, dbname, "DATABASE", host, port, - username, password, progname, echo); + username, prompt_password, progname, echo); } exit(0); @@ -209,7 +213,7 @@ main(int argc, char *argv[]) static void reindex_one_database(const char *name, const char *dbname, const char *type, const char *host, const char *port, const char *username, - bool password, const char *progname, bool echo) + enum trivalue prompt_password, const char *progname, bool echo) { PQExpBufferData sql; @@ -226,7 +230,7 @@ reindex_one_database(const char *name, const char *dbname, const char *type, appendPQExpBuffer(&sql, " DATABASE %s", fmtId(name)); appendPQExpBuffer(&sql, ";\n"); - conn = connectDatabase(dbname, host, port, username, password, progname); + conn = connectDatabase(dbname, host, port, username, prompt_password, progname); if (!executeMaintenanceCommand(conn, sql.data, echo)) { @@ -249,14 +253,14 @@ reindex_one_database(const char *name, const char *dbname, const char *type, static void reindex_all_databases(const char *host, const char *port, - const char *username, bool password, + const char *username, enum trivalue prompt_password, const char *progname, bool echo, bool quiet) { PGconn *conn; PGresult *result; int i; - conn = connectDatabase("postgres", host, port, username, password, progname); + conn = connectDatabase("postgres", host, port, username, prompt_password, progname); result = executeQuery(conn, "SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;", progname, echo); PQfinish(conn); @@ -271,7 +275,7 @@ reindex_all_databases(const char *host, const char *port, } reindex_one_database(dbname, dbname, "DATABASE", host, port, username, - password, progname, echo); + prompt_password, progname, echo); } PQclear(result); @@ -279,7 +283,7 @@ reindex_all_databases(const char *host, const char *port, static void reindex_system_catalogs(const char *dbname, const char *host, const char *port, - const char *username, bool password, + const char *username, enum trivalue prompt_password, const char *progname, bool echo) { PQExpBufferData sql; @@ -290,7 +294,7 @@ reindex_system_catalogs(const char *dbname, const char *host, const char *port, appendPQExpBuffer(&sql, "REINDEX SYSTEM %s;\n", dbname); - conn = connectDatabase(dbname, host, port, username, password, progname); + conn = connectDatabase(dbname, host, port, username, prompt_password, progname); if (!executeMaintenanceCommand(conn, sql.data, echo)) { fprintf(stderr, _("%s: reindexing of system catalogs failed: %s"), @@ -322,6 +326,7 @@ help(const char *progname) printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port\n")); printf(_(" -U, --username=USERNAME user name to connect as\n")); + printf(_(" -w, --no-password never prompt for password\n")); printf(_(" -W, --password force password prompt\n")); printf(_("\nRead the description of the SQL command REINDEX for details.\n")); printf(_("\nReport bugs to .\n")); diff --git a/src/bin/scripts/vacuumdb.c b/src/bin/scripts/vacuumdb.c index 204ec7b7f2..ada55735be 100644 --- a/src/bin/scripts/vacuumdb.c +++ b/src/bin/scripts/vacuumdb.c @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.24 2009/02/25 13:03:07 petere Exp $ + * $PostgreSQL: pgsql/src/bin/scripts/vacuumdb.c,v 1.25 2009/02/26 16:02:39 petere Exp $ * *------------------------------------------------------------------------- */ @@ -17,11 +17,11 @@ static void vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze, bool freeze, const char *table, const char *host, const char *port, - const char *username, bool password, + const char *username, enum trivalue prompt_password, const char *progname, bool echo); static void vacuum_all_databases(bool full, bool verbose, bool analyze, bool freeze, const char *host, const char *port, - const char *username, bool password, + const char *username, enum trivalue prompt_password, const char *progname, bool echo, bool quiet); static void help(const char *progname); @@ -34,6 +34,7 @@ main(int argc, char *argv[]) {"host", required_argument, NULL, 'h'}, {"port", required_argument, NULL, 'p'}, {"username", required_argument, NULL, 'U'}, + {"no-password", no_argument, NULL, 'w'}, {"password", no_argument, NULL, 'W'}, {"echo", no_argument, NULL, 'e'}, {"quiet", no_argument, NULL, 'q'}, @@ -55,7 +56,7 @@ main(int argc, char *argv[]) char *host = NULL; char *port = NULL; char *username = NULL; - bool password = false; + enum trivalue prompt_password = TRI_DEFAULT; bool echo = false; bool quiet = false; bool analyze = false; @@ -70,7 +71,7 @@ main(int argc, char *argv[]) handle_help_version_opts(argc, argv, "vacuumdb", help); - while ((c = getopt_long(argc, argv, "h:p:U:Weqd:zaFt:fv", long_options, &optindex)) != -1) + while ((c = getopt_long(argc, argv, "h:p:U:wWeqd:zaFt:fv", long_options, &optindex)) != -1) { switch (c) { @@ -83,8 +84,11 @@ main(int argc, char *argv[]) case 'U': username = optarg; break; + case 'w': + prompt_password = TRI_NO; + break; case 'W': - password = true; + prompt_password = TRI_YES; break; case 'e': echo = true; @@ -151,7 +155,7 @@ main(int argc, char *argv[]) } vacuum_all_databases(full, verbose, analyze, freeze, - host, port, username, password, + host, port, username, prompt_password, progname, echo, quiet); } else @@ -167,7 +171,7 @@ main(int argc, char *argv[]) } vacuum_one_database(dbname, full, verbose, analyze, freeze, table, - host, port, username, password, + host, port, username, prompt_password, progname, echo); } @@ -179,7 +183,7 @@ static void vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze, bool freeze, const char *table, const char *host, const char *port, - const char *username, bool password, + const char *username, enum trivalue prompt_password, const char *progname, bool echo) { PQExpBufferData sql; @@ -201,7 +205,7 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze, appendPQExpBuffer(&sql, " %s", table); appendPQExpBuffer(&sql, ";\n"); - conn = connectDatabase(dbname, host, port, username, password, progname); + conn = connectDatabase(dbname, host, port, username, prompt_password, progname); if (!executeMaintenanceCommand(conn, sql.data, echo)) { if (table) @@ -221,14 +225,14 @@ vacuum_one_database(const char *dbname, bool full, bool verbose, bool analyze, static void vacuum_all_databases(bool full, bool verbose, bool analyze, bool freeze, const char *host, const char *port, - const char *username, bool password, + const char *username, enum trivalue prompt_password, const char *progname, bool echo, bool quiet) { PGconn *conn; PGresult *result; int i; - conn = connectDatabase("postgres", host, port, username, password, progname); + conn = connectDatabase("postgres", host, port, username, prompt_password, progname); result = executeQuery(conn, "SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;", progname, echo); PQfinish(conn); @@ -243,7 +247,7 @@ vacuum_all_databases(bool full, bool verbose, bool analyze, bool freeze, } vacuum_one_database(dbname, full, verbose, analyze, freeze, NULL, - host, port, username, password, + host, port, username, prompt_password, progname, echo); } @@ -273,6 +277,7 @@ help(const char *progname) printf(_(" -h, --host=HOSTNAME database server host or socket directory\n")); printf(_(" -p, --port=PORT database server port\n")); printf(_(" -U, --username=USERNAME user name to connect as\n")); + printf(_(" -w, --no-password never prompt for password\n")); printf(_(" -W, --password force password prompt\n")); printf(_("\nRead the description of the SQL command VACUUM for details.\n")); printf(_("\nReport bugs to .\n")); diff --git a/src/include/pg_config_manual.h b/src/include/pg_config_manual.h index bc66df2eb3..57bcec768f 100644 --- a/src/include/pg_config_manual.h +++ b/src/include/pg_config_manual.h @@ -6,7 +6,7 @@ * for developers. If you edit any of these, be sure to do a *full* * rebuild (and an initdb if noted). * - * $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.37 2009/01/12 05:10:45 tgl Exp $ + * $PostgreSQL: pgsql/src/include/pg_config_manual.h,v 1.38 2009/02/26 16:02:39 petere Exp $ *------------------------------------------------------------------------ */ @@ -58,12 +58,6 @@ */ #define NUM_USER_DEFINED_LWLOCKS 4 -/* - * Define this if you want psql to _always_ ask for a username and a - * password for password authentication. - */ -/* #define PSQL_ALWAYS_GET_PASSWORDS */ - /* * Define this if you want to allow the lo_import and lo_export SQL * functions to be executed by ordinary users. By default these