X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=db-postgresql-socket%2Fpostgresql-socket-api.lisp;fp=db-postgresql-socket%2Fpostgresql-socket-api.lisp;h=3ca868a2645469e8b44457cf92121aad5dc1a243;hp=e9d23f3fb33617a375ea7e0d7965ebc7a6a8a55a;hb=60a8040e3115f3fac5eabc4b3cebfda4dec654bf;hpb=e841e2d77488962c426e6d404cae8f9c07c6c0bd diff --git a/db-postgresql-socket/postgresql-socket-api.lisp b/db-postgresql-socket/postgresql-socket-api.lisp index e9d23f3..3ca868a 100644 --- a/db-postgresql-socket/postgresql-socket-api.lisp +++ b/db-postgresql-socket/postgresql-socket-api.lisp @@ -213,8 +213,7 @@ socket interface" (int32 key)) -(defun read-socket-sequence (stream length) - "KMR -- Added to support reading from binary stream into a string" +(defun read-socket-sequence (stream length &optional (allow-wide t)) (declare (stream stream) (optimize (speed 3) (safety 0))) #-sb-unicode @@ -226,8 +225,9 @@ socket interface" (let ((bytes (make-array length :element-type '(unsigned-byte 8)))) (declare (type (simple-array (unsigned-byte 8) (*)) bytes)) (read-sequence bytes stream) - (sb-ext:octets-to-string bytes))) - + (if allow-wide + (sb-ext:octets-to-string bytes) + (map 'string #'code-char bytes)))) ;;; Support for encrypted password transmission @@ -496,14 +496,14 @@ connection, if it is still open." (postgresql-connection-password connection)) (force-output socket)) (4 - (let ((salt (read-socket-sequence socket 2))) + (let ((salt (read-socket-sequence socket 2 nil))) (send-encrypted-password-message socket (crypt-password (postgresql-connection-password connection) salt))) (force-output socket)) (5 - (let ((salt (read-socket-sequence socket 4))) + (let ((salt (read-socket-sequence socket 4 nil))) (let* ((pwd2 (encrypt-md5 (postgresql-connection-password connection) (postgresql-connection-user connection))) (pwd (encrypt-md5 pwd2 salt)))