Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit369e2b6

Browse files
author
Dave Cramer
committed
Applied patch for MD5 bug submitted by Jun Kawai
1 parent875364e commit369e2b6

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

‎src/interfaces/jdbc/org/postgresql/jdbc1/AbstractJdbc1Connection.java‎

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
importorg.postgresql.util.*;
1414

1515

16-
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.3 2002/07/26 05:29:34 barry Exp $
16+
/* $Header: /cvsroot/pgsql/src/interfaces/jdbc/org/postgresql/jdbc1/Attic/AbstractJdbc1Connection.java,v 1.4 2002/08/16 19:34:57 davec Exp $
1717
* This class defines methods of the jdbc1 specification. This class is
1818
* extended by org.postgresql.jdbc2.AbstractJdbc2Connection which adds the jdbc2
1919
* methods. The real Connection class (for jdbc1) is org.postgresql.jdbc1.Jdbc1Connection
@@ -125,7 +125,7 @@ public void openConnection(String host, int port, Properties info, String databa
125125
}
126126

127127
//Read loglevel arg and set the loglevel based on this value
128-
//in addition to setting the log level enable output to
128+
//in addition to setting the log level enable output to
129129
//standard out if no other printwriter is set
130130
Stringl_logLevelProp =info.getProperty("loglevel","0");
131131
intl_logLevel =0;
@@ -180,6 +180,7 @@ public void openConnection(String host, int port, Properties info, String databa
180180
{
181181
intberesp =pg_stream.ReceiveChar();
182182
Stringsalt =null;
183+
byte []md5Salt =newbyte[4];
183184
switch (beresp)
184185
{
185186
case'E':
@@ -207,12 +208,12 @@ public void openConnection(String host, int port, Properties info, String databa
207208
// Or get the md5 password salt if there is one
208209
if (areq ==AUTH_REQ_MD5)
209210
{
210-
byte[]rst =newbyte[4];
211-
rst[0] = (byte)pg_stream.ReceiveChar();
212-
rst[1] = (byte)pg_stream.ReceiveChar();
213-
rst[2] = (byte)pg_stream.ReceiveChar();
214-
rst[3] = (byte)pg_stream.ReceiveChar();
215-
salt =newString(rst,0,4);
211+
212+
md5Salt[0] = (byte)pg_stream.ReceiveChar();
213+
md5Salt[1] = (byte)pg_stream.ReceiveChar();
214+
md5Salt[2] = (byte)pg_stream.ReceiveChar();
215+
md5Salt[3] = (byte)pg_stream.ReceiveChar();
216+
salt =newString(md5Salt,0,4);
216217
if (org.postgresql.Driver.logDebug)org.postgresql.Driver.debug("MD5 salt=" +salt);
217218
}
218219

@@ -249,7 +250,7 @@ public void openConnection(String host, int port, Properties info, String databa
249250

250251
caseAUTH_REQ_MD5:
251252
if (org.postgresql.Driver.logDebug)org.postgresql.Driver.debug("postgresql: MD5");
252-
byte[]digest =MD5Digest.encode(PG_USER,password,salt);
253+
byte[]digest =MD5Digest.encode(PG_USER,password,md5Salt);
253254
pg_stream.SendInteger(5 +digest.length,4);
254255
pg_stream.Send(digest);
255256
pg_stream.SendInteger(0,1);
@@ -1217,7 +1218,7 @@ public boolean isClosed() throws SQLException
12171218
return (pg_stream ==null);
12181219
}
12191220

1220-
/*
1221+
/*
12211222
* This implemetation uses the jdbc1Types array to support the jdbc1
12221223
* datatypes. Basically jdbc1 and jdbc2 are the same, except that
12231224
* jdbc2 adds the Array types.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp