Permalink
Browse files

drop old and unused crypt auth (#1026)

  • Loading branch information...
jorsol authored and davecramer committed Nov 30, 2017
1 parent 1fd6c4f commit 405f14eefc9d7e01bfaa1b526f1a6a0bac50d3c4
@@ -27,7 +27,6 @@
import org.postgresql.util.PSQLException;
import org.postgresql.util.PSQLState;
import org.postgresql.util.ServerErrorMessage;
import org.postgresql.util.UnixCrypt;

import java.io.IOException;
import java.net.ConnectException;
@@ -456,35 +455,6 @@ private void doAuthentication(PGStream pgStream, String host, String user, Prope

// Process the request.
switch (areq) {
case AUTH_REQ_CRYPT: {
byte[] salt = pgStream.receive(2);

if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.log(Level.FINEST, " <=BE AuthenticationReqCrypt(salt=''{0}'')", new String(salt, "US-ASCII"));
}

if (password == null) {
throw new PSQLException(
GT.tr(
"The server requested password-based authentication, but no password was provided."),
PSQLState.CONNECTION_REJECTED);
}

byte[] encodedResult = UnixCrypt.crypt(salt, password.getBytes("UTF-8"));

if (LOGGER.isLoggable(Level.FINEST)) {
LOGGER.log(Level.FINEST, " FE=> Password(crypt=''{0}'')", new String(encodedResult, "US-ASCII"));
}

pgStream.sendChar('p');
pgStream.sendInteger4(4 + encodedResult.length + 1);
pgStream.send(encodedResult);
pgStream.sendChar(0);
pgStream.flush();

break;
}

case AUTH_REQ_MD5: {
byte[] md5Salt = pgStream.receive(4);
if (LOGGER.isLoggable(Level.FINEST)) {
Oops, something went wrong.

0 comments on commit 405f14e

Please sign in to comment.