Skip to content

Commit 239f74d

Browse files
committed
psql forgot to close connection before re-issuing password prompt.
([BUGS] psql can crash the backend on login, 2000-09-03)
1 parent b5d609a commit 239f74d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/bin/psql/command.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.35 2000/07/17 18:24:32 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.36 2000/09/17 20:33:45 petere Exp $
77
*/
88
#include "postgres.h"
99
#include "command.h"
@@ -1237,6 +1237,7 @@ do_connect(const char *new_dbname, const char *new_user)
12371237
if (PQstatus(pset.db) == CONNECTION_BAD &&
12381238
strcmp(PQerrorMessage(pset.db), "fe_sendauth: no password supplied\n") == 0)
12391239
{
1240+
PQfinish(pset.db);
12401241
need_pass = true;
12411242
free(prompted_password);
12421243
prompted_password = NULL;

src/bin/psql/startup.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.36 2000/09/06 19:54:48 petere Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/startup.c,v 1.37 2000/09/17 20:33:45 petere Exp $
77
*/
88
#include "postgres.h"
99

@@ -168,6 +168,7 @@ main(int argc, char *argv[])
168168
if (PQstatus(pset.db) == CONNECTION_BAD &&
169169
strcmp(PQerrorMessage(pset.db), "fe_sendauth: no password supplied\n") == 0)
170170
{
171+
PQfinish(pset.db);
171172
need_pass = true;
172173
free(password);
173174
password = NULL;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy