[cl-plus-ssl-devel] fix for bad error syntax (in streams.lisp)
Mark David
mdavid at itasoftware.com
Thu Aug 16 19:20:35 UTC 2007
I fixed two instances of a bad call to error in the file streams.lisp.
Below is my local context diff: (diff -c15)
Hope this helps, and can go in.
-- Mark
*** streams.lisp.orig 2007-07-07 12:47:57.000000000 -0400
--- streams.lisp 2007-08-16 15:19:42.000000000 -0400
***************
*** 171,201 ****
(setf (ssl-stream-handle stream) handle)
(etypecase socket
(integer (ssl-set-fd handle socket))
(stream (ssl-set-bio handle (bio-new-lisp) (bio-new-lisp))))
(ssl-set-connect-state handle)
(when key
(unless (eql 1 (ssl-use-rsa-privatekey-file handle
key
+ssl-filetype-pem+))
(error 'ssl-error-initialize :reason "Can't load RSA private
key ~A")))
(when certificate
(unless (eql 1 (ssl-use-certificate-file handle
certificate
+ssl-filetype-pem+))
(error 'ssl-error-initialize
! :reason "Can't load certificate ~A" certificate)))
(ensure-ssl-funcall socket handle #'ssl-connect 0.25 handle)
(if external-format
(flexi-streams:make-flexi-stream stream
:external-format external-format)
stream)))
(defun make-ssl-server-stream
(socket &key certificate key (method 'ssl-v23-method) external-format
close-callback)
"Returns an SSL stream for the server socket descriptor SOCKET.
CERTIFICATE is the path to a file containing the PEM-encoded
certificate for
your server. KEY is the path to the PEM-encoded key for the server, which
must not be associated with a passphrase."
(ensure-initialized method)
(let ((stream (make-instance 'ssl-server-stream
--- 171,201 ----
(setf (ssl-stream-handle stream) handle)
(etypecase socket
(integer (ssl-set-fd handle socket))
(stream (ssl-set-bio handle (bio-new-lisp) (bio-new-lisp))))
(ssl-set-connect-state handle)
(when key
(unless (eql 1 (ssl-use-rsa-privatekey-file handle
key
+ssl-filetype-pem+))
(error 'ssl-error-initialize :reason "Can't load RSA private
key ~A")))
(when certificate
(unless (eql 1 (ssl-use-certificate-file handle
certificate
+ssl-filetype-pem+))
(error 'ssl-error-initialize
! :reason (format nil "Can't load certificate ~A"
certificate))))
(ensure-ssl-funcall socket handle #'ssl-connect 0.25 handle)
(if external-format
(flexi-streams:make-flexi-stream stream
:external-format external-format)
stream)))
(defun make-ssl-server-stream
(socket &key certificate key (method 'ssl-v23-method) external-format
close-callback)
"Returns an SSL stream for the server socket descriptor SOCKET.
CERTIFICATE is the path to a file containing the PEM-encoded
certificate for
your server. KEY is the path to the PEM-encoded key for the server, which
must not be associated with a passphrase."
(ensure-initialized method)
(let ((stream (make-instance 'ssl-server-stream
***************
*** 212,242 ****
(let ((bio (bio-new-lisp)))
(ssl-set-bio handle bio bio))))
(ssl-set-accept-state handle)
(when (zerop (ssl-set-cipher-list handle "ALL"))
(error 'ssl-error-initialize :reason "Can't set SSL cipher list"))
(when key
(unless (eql 1 (ssl-use-rsa-privatekey-file handle
key
+ssl-filetype-pem+))
(error 'ssl-error-initialize :reason "Can't load RSA private
key ~A")))
(when certificate
(unless (eql 1 (ssl-use-certificate-file handle
certificate
+ssl-filetype-pem+))
(error 'ssl-error-initialize
! :reason "Can't load certificate ~A" certificate)))
(ensure-ssl-funcall socket handle #'ssl-accept 0.25 handle)
(if external-format
(flexi-streams:make-flexi-stream stream
:external-format external-format)
stream)))
(defgeneric stream-fd (stream))
(defmethod stream-fd (stream) stream)
#+sbcl
(defmethod stream-fd ((stream sb-sys:fd-stream))
(sb-sys:fd-stream-fd stream))
#+cmu
(defmethod stream-fd ((stream system:fd-stream))
--- 212,242 ----
(let ((bio (bio-new-lisp)))
(ssl-set-bio handle bio bio))))
(ssl-set-accept-state handle)
(when (zerop (ssl-set-cipher-list handle "ALL"))
(error 'ssl-error-initialize :reason "Can't set SSL cipher list"))
(when key
(unless (eql 1 (ssl-use-rsa-privatekey-file handle
key
+ssl-filetype-pem+))
(error 'ssl-error-initialize :reason "Can't load RSA private
key ~A")))
(when certificate
(unless (eql 1 (ssl-use-certificate-file handle
certificate
+ssl-filetype-pem+))
(error 'ssl-error-initialize
! :reason (format nil "Can't load certificate ~A" certificate))))
(ensure-ssl-funcall socket handle #'ssl-accept 0.25 handle)
(if external-format
(flexi-streams:make-flexi-stream stream
:external-format external-format)
stream)))
(defgeneric stream-fd (stream))
(defmethod stream-fd (stream) stream)
#+sbcl
(defmethod stream-fd ((stream sb-sys:fd-stream))
(sb-sys:fd-stream-fd stream))
#+cmu
(defmethod stream-fd ((stream system:fd-stream))
More information about the cl-plus-ssl-devel
mailing list