diff options
author | Bruce Momjian <bruce@momjian.us> | 2001-08-17 02:59:20 +0000 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2001-08-17 02:59:20 +0000 |
commit | da45a0bdb7580b7b9cec62f6999605083dcec162 (patch) | |
tree | fd40d31c441933caf2051c68886be65ac60f0e38 /src/interfaces/libpq/fe-auth.c | |
parent | a61e15a5664536896f9d3a7454962d91a13d83bd (diff) | |
download | postgresql-da45a0bdb7580b7b9cec62f6999605083dcec162.tar.gz postgresql-da45a0bdb7580b7b9cec62f6999605083dcec162.zip |
Add 4-byte MD5 salt.
Diffstat (limited to 'src/interfaces/libpq/fe-auth.c')
-rw-r--r-- | src/interfaces/libpq/fe-auth.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/interfaces/libpq/fe-auth.c b/src/interfaces/libpq/fe-auth.c index d4cb0ffc317..4e4a8f6d936 100644 --- a/src/interfaces/libpq/fe-auth.c +++ b/src/interfaces/libpq/fe-auth.c @@ -10,7 +10,7 @@ * exceed INITIAL_EXPBUFFER_SIZE (currently 256 bytes). * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.50 2001/08/15 21:08:21 momjian Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-auth.c,v 1.51 2001/08/17 02:59:19 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -443,7 +443,7 @@ pg_password_sendauth(PGconn *conn, const char *password, AuthRequest areq) switch (areq) { case AUTH_REQ_CRYPT: - crypt_pwd = crypt(password, conn->salt); + crypt_pwd = crypt(password, conn->cryptSalt); break; case AUTH_REQ_MD5: { @@ -455,14 +455,15 @@ pg_password_sendauth(PGconn *conn, const char *password, AuthRequest areq) perror("malloc"); return STATUS_ERROR; } - if (!EncryptMD5(password, conn->pguser, crypt_pwd2)) + if (!EncryptMD5(password, conn->pguser, + strlen(conn->pguser), crypt_pwd2)) { free(crypt_pwd); free(crypt_pwd2); return STATUS_ERROR; } - if (!EncryptMD5(crypt_pwd2 + strlen("md5"), conn->salt, - crypt_pwd)) + if (!EncryptMD5(crypt_pwd2 + strlen("md5"), conn->md5Salt, + sizeof(conn->md5Salt), crypt_pwd)) { free(crypt_pwd); free(crypt_pwd2); |