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

Commit78f7ba1

Browse files
committed
Tatsuo Ishii <t-ishii@sra.co.jp> writes:
> As you can see, psql reconnect as any user if the password is same as> foo. Of course this is due to the careless password setting, but I> think it's better to prompt ANY TIME the user tries to switch to> another user. Comments?Yeah, I agree. Looks like a simple change in dbconnect(): /* * Use old password if no new one given (if you didn't have an old * one, fine) */ if (!pwparam && oldconn) pwparam = PQpass(oldconn);to /* * Use old password (if any) if no new one given and we are * reconnecting as same user */ if (!pwparam && oldconn && PQuser(oldconn) && userparam && strcmp(PQuser(oldconn), userparam) == 0) pwparam = PQpass(oldconn); regards, tom lane
1 parentb0c4598 commit78f7ba1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

‎src/bin/psql/command.c

Lines changed: 3 additions & 2 deletions
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.59 2001/10/05 19:01:13 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/command.c,v 1.60 2001/10/11 16:54:18 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"command.h"
@@ -1287,7 +1287,8 @@ do_connect(const char *new_dbname, const char *new_user)
12871287
* Use old password if no new one given (if you didn't have an old
12881288
* one, fine)
12891289
*/
1290-
if (!pwparam&&oldconn)
1290+
if (!pwparam&&oldconn&&PQuser(oldconn)&&userparam&&
1291+
strcmp(PQuser(oldconn),userparam)==0)
12911292
pwparam=PQpass(oldconn);
12921293

12931294
do

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp