;;; Support for encrypted password transmission
#-scl
-(eval-when (compile eval load)
+(eval-when (:compile-toplevel :load-toplevel :execute)
(defvar *crypt-library-loaded* nil)
(unless *crypt-library-loaded*
(defun encrypt-md5 (plaintext salt)
(string-downcase
(format nil "~{~2,'0X~}"
- (coerce (md5:md5sum-sequence (concatenate 'string plaintext salt)) 'list))))
+ (coerce (md5sum-sequence (concatenate 'string plaintext salt)) 'list))))
(defun reopen-postgresql-connection (connection)
"Reopen the given PostgreSQL connection. Closes any existing
(3
(send-unencrypted-password-message
socket
- (postgresql-connection-password connection)))
+ (postgresql-connection-password connection))
+ (force-output socket))
(4
(let ((salt (make-string 2)))
(read-socket-sequence salt socket)
(send-encrypted-password-message
socket
(crypt-password
- (postgresql-connection-password connection) salt))))
+ (postgresql-connection-password connection) salt)))
+ (force-output socket))
(5
(let ((salt (make-string 4)))
(read-socket-sequence salt socket)
(pwd (encrypt-md5 pwd2 salt)))
(send-encrypted-password-message
socket
- (concatenate 'string "md5" pwd)))))
+ (concatenate 'string "md5" pwd))))
+ (force-output socket))
(t
(error 'postgresql-login-error
:connection connection