[cl-plus-ssl-cvs] CVS cl+ssl

hhubner hhubner at common-lisp.net
Thu Apr 17 19:41:08 UTC 2008


Update of /project/cl-plus-ssl/cvsroot/cl+ssl
In directory clnet:/tmp/cvs-serv17977

Modified Files:
	conditions.lisp streams.lisp 
Log Message:
Fix error reporting


--- /project/cl-plus-ssl/cvsroot/cl+ssl/conditions.lisp	2005/12/13 21:16:36	1.2
+++ /project/cl-plus-ssl/cvsroot/cl+ssl/conditions.lisp	2008/04/17 19:41:08	1.3
@@ -19,6 +19,12 @@
 
 ;;; Condition hierarchy
 ;;;
+
+(defun write-queued-errors (condition stream)
+  (let ((queue (ssl-error-queue condition)))
+    (when queue
+      (write-sequence queue stream))))
+
 (define-condition ssl-error (error)
   ((queue :initform nil :initarg :queue :reader ssl-error-queue)))
 
@@ -39,7 +45,7 @@
   (:report (lambda (condition stream)
              (format stream "SSL initialization error: ~A"
                      (ssl-error-reason condition))
-	     (write-sequence (ssl-error-queue condition) stream))))
+	     (write-queued-errors condition stream))))
 
 
 (define-condition ssl-error-want-something (ssl-error/handle)
@@ -55,7 +61,7 @@
              (format stream "The TLS/SSL operation on handle ~A completed. (return code:  ~A)"
                      (ssl-error-handle condition)
                      (ssl-error-ret condition))
-	     (write-sequence (ssl-error-queue condition) stream))))
+	     (write-queued-errors condition stream))))
 
 ;; SSL_ERROR_ZERO_RETURN
 (define-condition ssl-error-zero-return (ssl-error/handle)
@@ -71,7 +77,7 @@
              (format stream "The TLS/SSL connection on handle ~A has been closed. (return code:  ~A)"
                      (ssl-error-handle condition)
                      (ssl-error-ret condition))
-	     (write-sequence (ssl-error-queue condition) stream))))
+	     (write-queued-errors condition stream))))
 
 ;; SSL_ERROR_WANT_READ
 (define-condition ssl-error-want-read (ssl-error-want-something)
@@ -90,7 +96,7 @@
              (format stream "The TLS/SSL operation on handle ~A did not complete: It wants a READ. (return code:  ~A)"
                      (ssl-error-handle condition)
                      (ssl-error-ret condition))
-	     (write-sequence (ssl-error-queue condition) stream))))
+	     (write-queued-errors condition stream))))
 
 ;; SSL_ERROR_WANT_WRITE
 (define-condition ssl-error-want-write (ssl-error-want-something)
@@ -109,7 +115,7 @@
              (format stream "The TLS/SSL operation on handle ~A did not complete: It wants a WRITE. (return code:  ~A)"
                      (ssl-error-handle condition)
                      (ssl-error-ret condition))
-	     (write-sequence (ssl-error-queue condition) stream))))
+	     (write-queued-errors condition stream))))
 
 ;; SSL_ERROR_WANT_CONNECT
 (define-condition ssl-error-want-connect (ssl-error-want-something)
@@ -128,7 +134,7 @@
             (format stream "The TLS/SSL operation on handle ~A did not complete: It wants a connect first. (return code:  ~A)"
                      (ssl-error-handle condition)
                      (ssl-error-ret condition))
-	    (write-sequence (ssl-error-queue condition) stream))))
+	    (write-queued-errors condition stream))))
 
 ;; SSL_ERROR_WANT_X509_LOOKUP
 (define-condition ssl-error-want-x509-lookup (ssl-error-want-something)
@@ -142,7 +148,7 @@
              (format stream "The TLS/SSL operation on handle ~A did not complete: An application callback wants to be called again. (return code:  ~A)"
                      (ssl-error-handle condition)
                      (ssl-error-ret condition))
-	     (write-sequence (ssl-error-queue condition) stream))))
+	     (write-queued-errors condition stream))))
 
 ;; SSL_ERROR_SYSCALL
 (define-condition ssl-error-syscall (ssl-error/handle)
@@ -165,7 +171,7 @@
                                       (ssl-error-ret condition))))
                  (format stream "An UNKNOWN I/O error occurred in the underlying BIO. (return code:  ~A)"
                          (ssl-error-ret condition)))
-	     (write-sequence (ssl-error-queue condition) stream))))
+	     (write-queued-errors condition stream))))
 
 ;; SSL_ERROR_SSL
 (define-condition ssl-error-ssl (ssl-error/handle)
@@ -178,7 +184,7 @@
 		     "A failure in the SSL library occurred on handle ~A. (Return code: ~A)"
                      (ssl-error-handle condition)
                      (ssl-error-ret condition))
-	     (write-sequence (ssl-error-queue condition) stream))))
+	     (write-queued-errors condition stream))))
 
 (defun write-ssl-error-queue (stream)
   (format stream "SSL error queue: ~%")
--- /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp	2008/03/07 21:26:48	1.10
+++ /project/cl-plus-ssl/cvsroot/cl+ssl/streams.lisp	2008/04/17 19:41:08	1.11
@@ -204,13 +204,13 @@
     (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")))
+      (error 'ssl-error-initialize :reason (format nil "Can't load RSA private key file ~A" key))))
   (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))))
+	     :reason (format nil "Can't load certificate ~A" certificate)))))
 
 (defun handle-external-format (stream ef)
   (if ef




More information about the cl-plus-ssl-cvs mailing list