mirror of
https://github.com/postgres/postgres.git
synced 2025-04-22 23:02:54 +03:00
Remove protocol version change. Try MD5 first, then crypt() on all clients.
This commit is contained in:
parent
368e87e6ae
commit
cd6868176e
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.57 2001/08/15 18:42:14 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.58 2001/08/16 04:27:18 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -501,13 +501,16 @@ ClientAuthentication(Port *port)
|
|||||||
status = recv_and_check_password_packet(port);
|
status = recv_and_check_password_packet(port);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case uaCrypt:
|
|
||||||
sendAuthRequest(port, AUTH_REQ_CRYPT);
|
|
||||||
status = recv_and_check_password_packet(port);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case uaMD5:
|
case uaMD5:
|
||||||
sendAuthRequest(port, AUTH_REQ_MD5);
|
sendAuthRequest(port, AUTH_REQ_MD5);
|
||||||
|
if ((status = recv_and_check_password_packet(port)) == STATUS_OK)
|
||||||
|
break;
|
||||||
|
port->auth_method = uaCrypt;
|
||||||
|
/* Try crypt() for old client */
|
||||||
|
/* FALL THROUGH */
|
||||||
|
|
||||||
|
case uaCrypt:
|
||||||
|
sendAuthRequest(port, AUTH_REQ_CRYPT);
|
||||||
status = recv_and_check_password_packet(port);
|
status = recv_and_check_password_packet(port);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.62 2001/08/15 18:42:15 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/libpq/hba.c,v 1.63 2001/08/16 04:27:18 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -227,15 +227,8 @@ parse_hba_auth(List *line, ProtocolVersion proto, UserAuth *userauth_p,
|
|||||||
else if (strcmp(token, "reject") == 0)
|
else if (strcmp(token, "reject") == 0)
|
||||||
*userauth_p = uaReject;
|
*userauth_p = uaReject;
|
||||||
else if (strcmp(token, "crypt") == 0)
|
else if (strcmp(token, "crypt") == 0)
|
||||||
{
|
/* Try MD5 first; on failure, switch to crypt() */
|
||||||
/* if the client supports it, use MD5 */
|
|
||||||
if (PG_PROTOCOL_MAJOR(proto) > 2 ||
|
|
||||||
(PG_PROTOCOL_MAJOR(proto) == 2 &&
|
|
||||||
PG_PROTOCOL_MINOR(proto) >= 1))
|
|
||||||
*userauth_p = uaMD5;
|
*userauth_p = uaMD5;
|
||||||
else
|
|
||||||
*userauth_p = uaCrypt;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
*error_p = true;
|
*error_p = true;
|
||||||
line = lnext(line);
|
line = lnext(line);
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: pqcomm.h,v 1.56 2001/08/15 18:42:15 momjian Exp $
|
* $Id: pqcomm.h,v 1.57 2001/08/16 04:27:18 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -90,7 +90,7 @@ typedef union SockAddr
|
|||||||
/* The earliest and latest frontend/backend protocol version supported. */
|
/* The earliest and latest frontend/backend protocol version supported. */
|
||||||
|
|
||||||
#define PG_PROTOCOL_EARLIEST PG_PROTOCOL(0,0)
|
#define PG_PROTOCOL_EARLIEST PG_PROTOCOL(0,0)
|
||||||
#define PG_PROTOCOL_LATEST PG_PROTOCOL(2,1)
|
#define PG_PROTOCOL_LATEST PG_PROTOCOL(2,0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* All packets sent to the postmaster start with the length. This is omitted
|
* All packets sent to the postmaster start with the length. This is omitted
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Id: libpq-int.h,v 1.37 2001/08/15 18:42:16 momjian Exp $
|
* $Id: libpq-int.h,v 1.38 2001/08/16 04:27:18 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -45,7 +45,7 @@
|
|||||||
* pqcomm.h describe what the backend knows, not what libpq knows.
|
* pqcomm.h describe what the backend knows, not what libpq knows.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define PG_PROTOCOL_LIBPQ PG_PROTOCOL(2,1)
|
#define PG_PROTOCOL_LIBPQ PG_PROTOCOL(2,0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* POSTGRES backend dependent Constants.
|
* POSTGRES backend dependent Constants.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user