Index: src/backend/libpq/auth.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/libpq/auth.c,v retrieving revision 1.57 diff -c -r1.57 auth.c *** src/backend/libpq/auth.c 2001/08/15 18:42:14 1.57 --- src/backend/libpq/auth.c 2001/08/16 04:22:50 *************** *** 501,513 **** status = recv_and_check_password_packet(port); break; - case uaCrypt: - sendAuthRequest(port, AUTH_REQ_CRYPT); - status = recv_and_check_password_packet(port); - break; - case uaMD5: sendAuthRequest(port, AUTH_REQ_MD5); status = recv_and_check_password_packet(port); break; --- 501,516 ---- status = recv_and_check_password_packet(port); break; case uaMD5: 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); break; Index: src/backend/libpq/hba.c =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/libpq/hba.c,v retrieving revision 1.62 diff -c -r1.62 hba.c *** src/backend/libpq/hba.c 2001/08/15 18:42:15 1.62 --- src/backend/libpq/hba.c 2001/08/16 04:22:51 *************** *** 227,241 **** else if (strcmp(token, "reject") == 0) *userauth_p = uaReject; else if (strcmp(token, "crypt") == 0) ! { ! /* 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; ! else ! *userauth_p = uaCrypt; ! } else *error_p = true; line = lnext(line); --- 227,234 ---- else if (strcmp(token, "reject") == 0) *userauth_p = uaReject; else if (strcmp(token, "crypt") == 0) ! /* Try MD5 first; on failure, switch to crypt() */ ! *userauth_p = uaMD5; else *error_p = true; line = lnext(line); Index: src/include/libpq/pqcomm.h =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/libpq/pqcomm.h,v retrieving revision 1.56 diff -c -r1.56 pqcomm.h *** src/include/libpq/pqcomm.h 2001/08/15 18:42:15 1.56 --- src/include/libpq/pqcomm.h 2001/08/16 04:23:00 *************** *** 90,96 **** /* The earliest and latest frontend/backend protocol version supported. */ #define PG_PROTOCOL_EARLIEST PG_PROTOCOL(0,0) ! #define PG_PROTOCOL_LATEST PG_PROTOCOL(2,1) /* * All packets sent to the postmaster start with the length. This is omitted --- 90,96 ---- /* The earliest and latest frontend/backend protocol version supported. */ #define PG_PROTOCOL_EARLIEST PG_PROTOCOL(0,0) ! #define PG_PROTOCOL_LATEST PG_PROTOCOL(2,0) /* * All packets sent to the postmaster start with the length. This is omitted Index: src/interfaces/libpq/libpq-int.h =================================================================== RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/libpq/libpq-int.h,v retrieving revision 1.37 diff -c -r1.37 libpq-int.h *** src/interfaces/libpq/libpq-int.h 2001/08/15 18:42:16 1.37 --- src/interfaces/libpq/libpq-int.h 2001/08/16 04:23:01 *************** *** 45,51 **** * pqcomm.h describe what the backend knows, not what libpq knows. */ ! #define PG_PROTOCOL_LIBPQ PG_PROTOCOL(2,1) /* * POSTGRES backend dependent Constants. --- 45,51 ---- * pqcomm.h describe what the backend knows, not what libpq knows. */ ! #define PG_PROTOCOL_LIBPQ PG_PROTOCOL(2,0) /* * POSTGRES backend dependent Constants.