password.
Make password error message a #define and use it consistently.
Sean Chittenden
*
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.38 2004/10/15 04:54:33 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_ctl/pg_ctl.c,v 1.39 2004/10/16 03:10:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
char portstr[32];
char *p;
-
*portstr = '\0';
/* post_opts */
{
if ((conn = PQsetdbLogin(NULL, portstr, NULL, NULL,
"template1", NULL, NULL)) != NULL &&
- PQstatus(conn) == CONNECTION_OK)
+ (PQstatus(conn) == CONNECTION_OK ||
+ (strcmp(PQerrorMessage(conn),
+ PQnoPasswordSupplied) == 0)))
{
PQfinish(conn);
success = true;
* Implements the basic DB functions used by the archiver.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.59 2004/10/01 17:25:55 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_backup_db.c,v 1.60 2004/10/16 03:10:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (PQstatus(newConn) == CONNECTION_BAD)
{
noPwd = (strcmp(PQerrorMessage(newConn),
- "fe_sendauth: no password supplied\n") == 0);
+ PQnoPasswordSupplied) == 0);
badPwd = (strncmp(PQerrorMessage(newConn),
"Password authentication failed for user", 39) == 0);
die_horribly(AH, modulename, "failed to connect to database\n");
if (PQstatus(AH->connection) == CONNECTION_BAD &&
- strcmp(PQerrorMessage(AH->connection), "fe_sendauth: no password supplied\n") == 0 &&
+ strcmp(PQerrorMessage(AH->connection), PQnoPasswordSupplied) == 0 &&
!feof(stdin))
{
PQfinish(AH->connection);
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.53 2004/10/15 04:32:28 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_dump/pg_dumpall.c,v 1.54 2004/10/16 03:10:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
}
if (PQstatus(conn) == CONNECTION_BAD &&
- strcmp(PQerrorMessage(conn), "fe_sendauth: no password supplied\n") == 0 &&
+ strcmp(PQerrorMessage(conn), PQnoPasswordSupplied) == 0 &&
!feof(stdin))
{
PQfinish(conn);
*
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.128 2004/10/14 20:23:46 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.129 2004/10/16 03:10:16 momjian Exp $
*/
#include "postgres_fe.h"
#include "command.h"
NULL, NULL, dbparam, userparam, pwparam);
if (PQstatus(pset.db) == CONNECTION_BAD &&
- strcmp(PQerrorMessage(pset.db), "fe_sendauth: no password supplied\n") == 0 &&
+ strcmp(PQerrorMessage(pset.db), PQnoPasswordSupplied) == 0 &&
!feof(stdin))
{
PQfinish(pset.db);
*
* Copyright (c) 2000-2004, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.103 2004/10/08 11:24:19 neilc Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/startup.c,v 1.104 2004/10/16 03:10:16 momjian Exp $
*/
#include "postgres_fe.h"
username, password);
if (PQstatus(pset.db) == CONNECTION_BAD &&
- strcmp(PQerrorMessage(pset.db), "fe_sendauth: no password supplied\n") == 0 &&
+ strcmp(PQerrorMessage(pset.db), PQnoPasswordSupplied) == 0 &&
!feof(stdin))
{
PQfinish(pset.db);
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.11 2004/08/29 05:06:54 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/scripts/common.c,v 1.12 2004/10/16 03:10:16 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres_fe.h"
#include "common.h"
+#include "libpq-fe.h"
#include <pwd.h>
#include <unistd.h>
}
if (PQstatus(conn) == CONNECTION_BAD &&
- strcmp(PQerrorMessage(conn), "fe_sendauth: no password supplied\n") == 0 &&
+ strcmp(PQerrorMessage(conn), PQnoPasswordSupplied) == 0 &&
!feof(stdin))
{
PQfinish(conn);
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.93 2004/09/28 00:06:02 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/fe-auth.c,v 1.94 2004/10/16 03:10:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
if (password == NULL || *password == '\0')
{
(void) snprintf(PQerrormsg, PQERRORMSG_LENGTH,
- "fe_sendauth: no password supplied\n");
+ PQnoPasswordSupplied);
return STATUS_ERROR;
}
if (pg_password_sendauth(conn, password, areq) != STATUS_OK)
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.108 2004/08/29 05:07:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/interfaces/libpq/libpq-fe.h,v 1.109 2004/10/16 03:10:17 momjian Exp $
*
*-------------------------------------------------------------------------
*/
/* Exists for backward compatibility. bjm 2003-03-24 */
#define PQfreeNotify(ptr) PQfreemem(ptr)
+/* Define the string so all uses are consistent. */
+#define PQnoPasswordSupplied "fe_sendauth: no password supplied\n"
+
/*
* Make an empty PGresult with given status (some apps find this
* useful). If conn is not NULL and status indicates an error, the