Don't try to turn the random bytes from a md5 salt into a String
authorKris Jurka <[email protected]>
Tue, 10 Feb 2004 01:58:48 +0000 (01:58 +0000)
committerKris Jurka <[email protected]>
Tue, 10 Feb 2004 01:58:48 +0000 (01:58 +0000)
because it may not be a valid String depending on the encoding.

Per report from Nadeem Bitar.

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

index 33cab33cef4b5c9ec2218c39309e81a5d2d20d32..ddee229d6e618e4d7bdfebb1ce4d46a20534d08a 100644 (file)
@@ -349,9 +349,13 @@ public abstract class AbstractJdbc1Connection implements BaseConnection
                                                        md5Salt[1] = (byte)pgStream.ReceiveChar();
                                                        md5Salt[2] = (byte)pgStream.ReceiveChar();
                                                        md5Salt[3] = (byte)pgStream.ReceiveChar();
-                                                       salt = new String(md5Salt, 0, 4);
-                                                       if (Driver.logDebug)
-                                                               Driver.debug("MD5 salt=" + salt);
+                                                       if (Driver.logDebug) {
+                                                               String md5SaltString = "";
+                                                               for (int i=0; i<md5Salt.length; i++) {
+                                                                       md5SaltString += " " + md5Salt[i];
+                                                               }
+                                                               Driver.debug("MD5 salt=" + md5SaltString);
+                                                       }
                                                }
 
                                                // now send the auth packet
@@ -631,9 +635,13 @@ public abstract class AbstractJdbc1Connection implements BaseConnection
                                                        md5Salt[1] = (byte)pgStream.ReceiveChar();
                                                        md5Salt[2] = (byte)pgStream.ReceiveChar();
                                                        md5Salt[3] = (byte)pgStream.ReceiveChar();
-                                                       salt = new String(md5Salt, 0, 4);
-                                                       if (Driver.logDebug)
-                                                               Driver.debug("MD5 salt=" + salt);
+                                                       if (Driver.logDebug) {
+                                                               String md5SaltString = "";
+                                                               for (int i=0; i<md5Salt.length; i++) {
+                                                                       md5SaltString += " " + md5Salt[i];
+                                                               }
+                                                               Driver.debug("MD5 salt=" + md5SaltString);
+                                                       }
                                                }
 
                                                // now send the auth packet