mirror of
https://github.com/postgres/postgres.git
synced 2025-04-24 10:47:04 +03:00
Reorder MD5/crypt so MD5 comes first in the code.
This commit is contained in:
parent
2637f887e7
commit
0a3094b6f3
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.60 2001/08/17 02:59:19 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/backend/libpq/auth.c,v 1.61 2001/08/17 15:40:07 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -420,8 +420,8 @@ auth_failed(Port *port)
|
|||||||
authmethod = "IDENT";
|
authmethod = "IDENT";
|
||||||
break;
|
break;
|
||||||
case uaPassword:
|
case uaPassword:
|
||||||
case uaCrypt:
|
|
||||||
case uaMD5:
|
case uaMD5:
|
||||||
|
case uaCrypt:
|
||||||
authmethod = "Password";
|
authmethod = "Password";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -501,13 +501,13 @@ ClientAuthentication(Port *port)
|
|||||||
status = recv_and_check_password_packet(port);
|
status = recv_and_check_password_packet(port);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case uaCrypt:
|
case uaMD5:
|
||||||
sendAuthRequest(port, AUTH_REQ_CRYPT);
|
sendAuthRequest(port, AUTH_REQ_MD5);
|
||||||
status = recv_and_check_password_packet(port);
|
status = recv_and_check_password_packet(port);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case uaMD5:
|
case uaCrypt:
|
||||||
sendAuthRequest(port, AUTH_REQ_MD5);
|
sendAuthRequest(port, AUTH_REQ_CRYPT);
|
||||||
status = recv_and_check_password_packet(port);
|
status = recv_and_check_password_packet(port);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -643,8 +643,8 @@ map_old_to_new(Port *port, UserAuth old, int status)
|
|||||||
{
|
{
|
||||||
switch (port->auth_method)
|
switch (port->auth_method)
|
||||||
{
|
{
|
||||||
case uaCrypt:
|
|
||||||
case uaMD5:
|
case uaMD5:
|
||||||
|
case uaCrypt:
|
||||||
case uaReject:
|
case uaReject:
|
||||||
status = STATUS_ERROR;
|
status = STATUS_ERROR;
|
||||||
break;
|
break;
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
* Dec 17, 1997 - Todd A. Brandys
|
* Dec 17, 1997 - Todd A. Brandys
|
||||||
* Orignal Version Completed.
|
* Orignal Version Completed.
|
||||||
*
|
*
|
||||||
* $Id: crypt.c,v 1.36 2001/08/17 03:09:31 momjian Exp $
|
* $Id: crypt.c,v 1.37 2001/08/17 15:40:07 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -294,13 +294,6 @@ md5_crypt_verify(const Port *port, const char *user, const char *pgpass)
|
|||||||
*/
|
*/
|
||||||
switch (port->auth_method)
|
switch (port->auth_method)
|
||||||
{
|
{
|
||||||
case uaCrypt:
|
|
||||||
{
|
|
||||||
char salt[3];
|
|
||||||
StrNCpy(salt, port->cryptSalt,3);
|
|
||||||
crypt_pwd = crypt(passwd, salt);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case uaMD5:
|
case uaMD5:
|
||||||
crypt_pwd = palloc(MD5_PASSWD_LEN+1);
|
crypt_pwd = palloc(MD5_PASSWD_LEN+1);
|
||||||
if (isMD5(passwd))
|
if (isMD5(passwd))
|
||||||
@ -334,6 +327,13 @@ md5_crypt_verify(const Port *port, const char *user, const char *pgpass)
|
|||||||
pfree(crypt_pwd2);
|
pfree(crypt_pwd2);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case uaCrypt:
|
||||||
|
{
|
||||||
|
char salt[3];
|
||||||
|
StrNCpy(salt, port->cryptSalt,3);
|
||||||
|
crypt_pwd = crypt(passwd, salt);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
crypt_pwd = passwd;
|
crypt_pwd = passwd;
|
||||||
break;
|
break;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
|
* exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes).
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.54 2001/08/17 15:11:15 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.55 2001/08/17 15:40:07 momjian Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -438,14 +438,6 @@ pg_password_sendauth(PGconn *conn, const char *password, AuthRequest areq)
|
|||||||
|
|
||||||
switch (areq)
|
switch (areq)
|
||||||
{
|
{
|
||||||
case AUTH_REQ_CRYPT:
|
|
||||||
{
|
|
||||||
char salt[3];
|
|
||||||
|
|
||||||
StrNCpy(salt, conn->cryptSalt,3);
|
|
||||||
crypt_pwd = crypt(password, salt);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case AUTH_REQ_MD5:
|
case AUTH_REQ_MD5:
|
||||||
{
|
{
|
||||||
char *crypt_pwd2;
|
char *crypt_pwd2;
|
||||||
@ -473,6 +465,14 @@ pg_password_sendauth(PGconn *conn, const char *password, AuthRequest areq)
|
|||||||
free(crypt_pwd2);
|
free(crypt_pwd2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AUTH_REQ_CRYPT:
|
||||||
|
{
|
||||||
|
char salt[3];
|
||||||
|
|
||||||
|
StrNCpy(salt, conn->cryptSalt,3);
|
||||||
|
crypt_pwd = crypt(password, salt);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
/* discard const so we can assign it */
|
/* discard const so we can assign it */
|
||||||
crypt_pwd = (char *)password;
|
crypt_pwd = (char *)password;
|
||||||
@ -535,9 +535,9 @@ fe_sendauth(AuthRequest areq, PGconn *conn, const char *hostname,
|
|||||||
return STATUS_ERROR;
|
return STATUS_ERROR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case AUTH_REQ_PASSWORD:
|
|
||||||
case AUTH_REQ_CRYPT:
|
|
||||||
case AUTH_REQ_MD5:
|
case AUTH_REQ_MD5:
|
||||||
|
case AUTH_REQ_CRYPT:
|
||||||
|
case AUTH_REQ_PASSWORD:
|
||||||
if (password == NULL || *password == '\0')
|
if (password == NULL || *password == '\0')
|
||||||
{
|
{
|
||||||
(void) sprintf(PQerrormsg,
|
(void) sprintf(PQerrormsg,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user