clsql/db-postgresql-socket postgresql-socket-api.lisp,1.2,1.3

"Kevin M. Rosenberg" <[email protected]> Sun, 2 Mar 2003 13:02:04 -0700
Newsgroups gmane.lisp.clsql.cvs
Message-ID <[email protected]>
Update of /pubcvs/clsql/db-postgresql-socket
In directory boa.b9.com:/tmp/cvs-serv27949/db-postgresql-socket

Modified Files:
	postgresql-socket-api.lisp 
Log Message:
Auto commit for Debian build

Index: postgresql-socket-api.lisp
===================================================================
RCS file: /pubcvs/clsql/db-postgresql-socket/postgresql-socket-api.lisp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** postgresql-socket-api.lisp	21 Oct 2002 07:45:50 -0000	1.2
--- postgresql-socket-api.lisp	2 Mar 2003 20:02:02 -0000	1.3
***************
*** 392,395 ****
--- 392,400 ----
  			       :password (or password ""))))
  
+ (defun encrypt-md5 (plaintext salt)
+   (string-downcase
+    (format nil "~{~2,'0X~}"
+ 	   (coerce (md5:md5sum-sequence (concatenate 'string plaintext salt)) 'list))))
+ 
  (defun reopen-postgresql-connection (connection)
    "Reopen the given PostgreSQL connection.  Closes any existing
***************
*** 430,433 ****
--- 435,447 ----
  			(crypt-password
  			 (postgresql-connection-password connection) salt))))
+ 		    (5
+ 		     (let ((salt (make-string 4)))
+ 		       (read-socket-sequence salt socket)
+ 		       (let* ((pwd2 (encrypt-md5 (postgresql-connection-password connection)
+ 						 (postgresql-connection-user connection)))
+ 			      (pwd (encrypt-md5 pwd2 salt)))
+ 			 (send-encrypted-password-message
+ 			  socket
+ 			  (concatenate 'string "md5" pwd)))))
  		    (t
  		     (error 'postgresql-login-error