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

Commitcd68681

Browse files
committed
Remove protocol version change. Try MD5 first, then crypt() on all clients.
1 parent368e87e commitcd68681

File tree

4 files changed

+16
-20
lines changed

4 files changed

+16
-20
lines changed

‎src/backend/libpq/auth.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.57 2001/08/15 18:42:14 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.58 2001/08/16 04:27:18 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -501,13 +501,16 @@ ClientAuthentication(Port *port)
501501
status=recv_and_check_password_packet(port);
502502
break;
503503

504-
caseuaCrypt:
505-
sendAuthRequest(port,AUTH_REQ_CRYPT);
506-
status=recv_and_check_password_packet(port);
507-
break;
508-
509504
caseuaMD5:
510505
sendAuthRequest(port,AUTH_REQ_MD5);
506+
if ((status=recv_and_check_password_packet(port))==STATUS_OK)
507+
break;
508+
port->auth_method=uaCrypt;
509+
/* Try crypt() for old client */
510+
/* FALL THROUGH */
511+
512+
caseuaCrypt:
513+
sendAuthRequest(port,AUTH_REQ_CRYPT);
511514
status=recv_and_check_password_packet(port);
512515
break;
513516

‎src/backend/libpq/hba.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.62 2001/08/15 18:42:15 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.63 2001/08/16 04:27:18 momjian Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -227,15 +227,8 @@ parse_hba_auth(List *line, ProtocolVersion proto, UserAuth *userauth_p,
227227
elseif (strcmp(token,"reject")==0)
228228
*userauth_p=uaReject;
229229
elseif (strcmp(token,"crypt")==0)
230-
{
231-
/* if the client supports it, use MD5 */
232-
if (PG_PROTOCOL_MAJOR(proto)>2||
233-
(PG_PROTOCOL_MAJOR(proto)==2&&
234-
PG_PROTOCOL_MINOR(proto) >=1))
235-
*userauth_p=uaMD5;
236-
else
237-
*userauth_p=uaCrypt;
238-
}
230+
/* Try MD5 first; on failure, switch to crypt() */
231+
*userauth_p=uaMD5;
239232
else
240233
*error_p= true;
241234
line=lnext(line);

‎src/include/libpq/pqcomm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
1010
* Portions Copyright (c) 1994, Regents of the University of California
1111
*
12-
* $Id: pqcomm.h,v 1.56 2001/08/15 18:42:15 momjian Exp $
12+
* $Id: pqcomm.h,v 1.57 2001/08/16 04:27:18 momjian Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -90,7 +90,7 @@ typedef union SockAddr
9090
/* The earliest and latest frontend/backend protocol version supported. */
9191

9292
#definePG_PROTOCOL_EARLIESTPG_PROTOCOL(0,0)
93-
#definePG_PROTOCOL_LATESTPG_PROTOCOL(2,1)
93+
#definePG_PROTOCOL_LATESTPG_PROTOCOL(2,0)
9494

9595
/*
9696
* All packets sent to the postmaster start with the length. This is omitted

‎src/interfaces/libpq/libpq-int.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $Id: libpq-int.h,v 1.37 2001/08/15 18:42:16 momjian Exp $
15+
* $Id: libpq-int.h,v 1.38 2001/08/16 04:27:18 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -45,7 +45,7 @@
4545
* pqcomm.h describe what the backend knows, not what libpq knows.
4646
*/
4747

48-
#definePG_PROTOCOL_LIBPQPG_PROTOCOL(2,1)
48+
#definePG_PROTOCOL_LIBPQPG_PROTOCOL(2,0)
4949

5050
/*
5151
* POSTGRES backend dependent Constants.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp