|
13 | 13 | importorg.postgresql.util.*; |
14 | 14 |
|
15 | 15 |
|
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 $ |
17 | 17 | * This class defines methods of the jdbc1 specification. This class is |
18 | 18 | * extended by org.postgresql.jdbc2.AbstractJdbc2Connection which adds the jdbc2 |
19 | 19 | * 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 |
125 | 125 | } |
126 | 126 |
|
127 | 127 | //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 |
129 | 129 | //standard out if no other printwriter is set |
130 | 130 | Stringl_logLevelProp =info.getProperty("loglevel","0"); |
131 | 131 | intl_logLevel =0; |
@@ -180,6 +180,7 @@ public void openConnection(String host, int port, Properties info, String databa |
180 | 180 | { |
181 | 181 | intberesp =pg_stream.ReceiveChar(); |
182 | 182 | Stringsalt =null; |
| 183 | +byte []md5Salt =newbyte[4]; |
183 | 184 | switch (beresp) |
184 | 185 | { |
185 | 186 | case'E': |
@@ -207,12 +208,12 @@ public void openConnection(String host, int port, Properties info, String databa |
207 | 208 | // Or get the md5 password salt if there is one |
208 | 209 | if (areq ==AUTH_REQ_MD5) |
209 | 210 | { |
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); |
216 | 217 | if (org.postgresql.Driver.logDebug)org.postgresql.Driver.debug("MD5 salt=" +salt); |
217 | 218 | } |
218 | 219 |
|
@@ -249,7 +250,7 @@ public void openConnection(String host, int port, Properties info, String databa |
249 | 250 |
|
250 | 251 | caseAUTH_REQ_MD5: |
251 | 252 | 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); |
253 | 254 | pg_stream.SendInteger(5 +digest.length,4); |
254 | 255 | pg_stream.Send(digest); |
255 | 256 | pg_stream.SendInteger(0,1); |
@@ -1217,7 +1218,7 @@ public boolean isClosed() throws SQLException |
1217 | 1218 | return (pg_stream ==null); |
1218 | 1219 | } |
1219 | 1220 |
|
1220 | | -/* |
| 1221 | +/* |
1221 | 1222 | * This implemetation uses the jdbc1Types array to support the jdbc1 |
1222 | 1223 | * datatypes. Basically jdbc1 and jdbc2 are the same, except that |
1223 | 1224 | * jdbc2 adds the Array types. |
|