X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=db-postgresql-socket%2Fpostgresql-socket-api.lisp;h=8e8cb3d495bcd2b2e638db10e834b27d53a04971;hb=e2c86e8c664d8b3ecfd215843a9a1fbf5fa83693;hp=4dffc99241aea6007e3f12af83c43a4e63f3ba30;hpb=fa071351835a2c754895cb917db9c63303e7b5c1;p=clsql.git diff --git a/db-postgresql-socket/postgresql-socket-api.lisp b/db-postgresql-socket/postgresql-socket-api.lisp index 4dffc99..8e8cb3d 100644 --- a/db-postgresql-socket/postgresql-socket-api.lisp +++ b/db-postgresql-socket/postgresql-socket-api.lisp @@ -9,7 +9,7 @@ ;;;; ;;;; Date Started: Feb 2002 ;;;; -;;;; $Id: postgresql-socket-api.lisp,v 1.2 2002/10/21 07:45:50 kevin Exp $ +;;;; $Id$ ;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai @@ -40,12 +40,15 @@ (:float4 700) (:float8 701))) -(defmethod database-type-library-loaded ((database-type +(defmethod clsql-base-sys:database-type-library-loaded ((database-type (eql :postgresql-socket))) "T if foreign library was able to be loaded successfully. Always true for socket interface" t) - + +(defmethod clsql-base-sys:database-type-load-foreign ((database-type (eql :postgresql-socket))) + t) + ;;; Message I/O stuff @@ -391,6 +394,11 @@ troubles." :database database :user user :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 connection, if it is still open." @@ -429,6 +437,15 @@ connection, if it is still open." socket (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 :connection connection