Synch with Gnus.
authoryamaoka <yamaoka>
Sun, 3 Dec 2000 22:38:16 +0000 (22:38 +0000)
committeryamaoka <yamaoka>
Sun, 3 Dec 2000 22:38:16 +0000 (22:38 +0000)
lisp/ChangeLog
lisp/gnus-sum.el
lisp/mml-smime.el
lisp/mml2015.el
lisp/smime.el
lisp/starttls.el

index cf72c33..3b3c495 100644 (file)
@@ -1,3 +1,25 @@
+2000-12-03 12:00:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
+
+       * mml2015.el (mml2015-fix-micalg): Alg might be nil.
+
+2000-12-01  Christopher Splinter <chris@splinter.inka.de>
+
+       * gnus-sum.el (gnus-summary-limit-to-age): Fix typo.
+
+2000-12-01  Simon Josefsson  <sj@extundo.com>
+
+       * mml-smime.el (mml-smime-verify): Fix address parsing.
+
+2000-12-01  Simon Josefsson  <sj@extundo.com>
+
+       * mml-smime.el (mml-smime-verify): Don't modify MM buffer.  Handle
+       more than one certificate inside PKCS#7 blob.  Better security
+       information (clamed / actual sender, openssl output, certificates
+       inside message).
+
+       * smime.el (smime-verify-region): Output to /dev/null.
+       (smime-buffer-as-string-region): Don't parse empty lines.
+
 2000-11-30 23:00:00  ShengHuo ZHU  <zsh@cs.rochester.edu>
 
        * gnus-art.el (gnus-mime-security-button-line-format-alist): Add
index 525e41d..b3a79a3 100644 (file)
@@ -6412,7 +6412,7 @@ articles that are younger than AGE days."
      (while (not days-got)
        (setq days (if younger
                      (read-string "Limit to articles within (in days): ")
-                   (read-string "Limit to articles old than (in days): ")))
+                   (read-string "Limit to articles older than (in days): ")))
        (when (> (length days) 0)
         (setq days (read days)))
        (if (numberp days)
index 16eff67..835516a 100644 (file)
     certs))
 
 (defun mml-smime-verify (handle ctl)
-  (with-current-buffer (mm-handle-multipart-original-buffer ctl)
-    ;; xxx modifies buffer -- noone else uses the buffer, so what the heck
+  (with-temp-buffer
+    (insert-buffer (mm-handle-multipart-original-buffer ctl))
     (goto-char (point-min))
     (insert (format "Content-Type: %s; " (mm-handle-media-type ctl)))
     (insert (format "protocol=\"%s\"; " 
                    (mm-handle-multipart-ctl-parameter ctl 'boundary)))
     (when (get-buffer smime-details-buffer)
       (kill-buffer smime-details-buffer))
-    (if (smime-verify-buffer)
+    (let ((buf (current-buffer))
+         (good-signature (smime-verify-buffer))
+         addresses openssl-output)
+      (setq openssl-output (with-current-buffer smime-details-buffer
+                            (buffer-string)))
+      (if (not good-signature)
+         (progn
+           ;; we couldn't verify message, fail with openssl output as message
+           (mm-set-handle-multipart-parameter 
+            mm-security-handle 'gnus-info "Failed")
+           (mm-set-handle-multipart-parameter
+            mm-security-handle 'gnus-details 
+            (concat "OpenSSL failed to verify message:\n" 
+                    "---------------------------------\n" 
+                    openssl-output)))
        ;; verify mail addresses in mail against those in certificate
        (when (and (smime-pkcs7-region (point-min) (point-max))
                   (smime-pkcs7-certificates-region (point-min) (point-max)))
          (with-temp-buffer
-           (insert-buffer-substring (mm-handle-multipart-original-buffer ctl))
-           (if (not (member mm-security-from
-                            (and (smime-pkcs7-email-region
-                                  (point-min) (point-max))
-                                 (smime-buffer-as-string-region
-                                  (point-min) (point-max)))))
-               (progn
-                 (mm-set-handle-multipart-parameter 
-                  mm-security-handle 'gnus-info "Sender forged")
-                 (mm-set-handle-multipart-parameter
-                  mm-security-handle 'gnus-details 
-                  (with-current-buffer
-                      (mm-handle-multipart-original-buffer ctl)
-                    (buffer-string))))
-             (mm-set-handle-multipart-parameter 
-              mm-security-handle 'gnus-info "OK")
-             (kill-buffer smime-details-buffer))))
-      (mm-set-handle-multipart-parameter 
-       mm-security-handle 'gnus-info "Failed")
-      (mm-set-handle-multipart-parameter
-       mm-security-handle 'gnus-details 
-       (with-current-buffer smime-details-buffer 
-        (buffer-string))))
-    handle))
+           (insert-buffer-substring buf)
+           (goto-char (point-min))
+           (while (re-search-forward "-----END CERTIFICATE-----" nil t)
+             (smime-pkcs7-email-region (point-min) (point))
+             (setq addresses (append (smime-buffer-as-string-region
+                                      (point-min) (point)) addresses))
+             (delete-region (point-min) (point)))))
+       (if (not (member mm-security-from addresses))
+           (mm-set-handle-multipart-parameter 
+            mm-security-handle 'gnus-info "Sender forged")
+         (mm-set-handle-multipart-parameter 
+          mm-security-handle 'gnus-info "OK"))
+       (mm-set-handle-multipart-parameter
+        mm-security-handle 'gnus-details 
+        (concat "Sender clamed to be: " mm-security-from "\n"
+                (if addresses
+                    (concat "Addresses in certificate: " 
+                            (mapconcat 'identity addresses ", "))
+                  "No addresses found in certificate.")
+                "\n" "\n" 
+                "OpenSSL output:\n" 
+                "---------------\n" openssl-output "\n"
+                "Certificate(s) inside S/MIME signature:\n"
+                "---------------------------------------\n"
+                (buffer-string) "\n")))))
+  handle)
 
 (defun mml-smime-verify-test (handle ctl)
   smime-openssl-program)
index b682d89..126f647 100644 (file)
        mm-security-handle 'gnus-info "Failed"))))
 
 (defun mml2015-fix-micalg (alg)
-  (upcase
-   (if (and alg (string-match "^pgp-" alg))
-       (substring alg (match-end 0))
-     alg)))
+  (and alg
+       (upcase (if (string-match "^pgp-" alg)
+                  (substring alg (match-end 0))
+                alg))))
 
 (defun mml2015-mailcrypt-verify (handle ctl)
   (catch 'error
index 2f40b62..0653b56 100644 (file)
@@ -254,7 +254,8 @@ nil."
                    (error "No CA configured.")))))
     (with-current-buffer buffer
       (erase-buffer))
-    (if (apply 'smime-call-openssl-region b e buffer "smime" "-verify" CAs)
+    (if (apply 'smime-call-openssl-region b e buffer "smime" "-verify" 
+              "-out" "/dev/null" CAs)
        (message "S/MIME message verified succesfully.")
       (message "S/MIME message NOT verified successfully.")
       nil)))
@@ -338,7 +339,9 @@ A string or a list of strings is returned."
     (goto-char b)
     (let (res)
       (while (< (point) e)
-       (push (buffer-substring (point) (smime-point-at-eol)) res)
+       (let ((str (buffer-substring (point) (smime-point-at-eol))))
+         (unless (string= "" str)
+           (push str res)))
        (forward-line))
       res)))
 
index 529dea5..cf6530d 100644 (file)
@@ -1,8 +1,8 @@
-;;; starttls.el --- TLSv1 functions
+;;; starttls.el --- STARTTLS functions
 
-;; Copyright (C) 1999 Daiki Ueno
+;; Copyright (C) 1999, 2000 Free Software Foundation, Inc.
 
-;; Author: Daiki Ueno <ueno@ueda.info.waseda.ac.jp>
+;; Author: Daiki Ueno <ueno@unixuser.org>
 ;; Created: 1999/11/20
 ;; Keywords: TLS, SSL, OpenSSL
 
 
 ;;; Commentary:
 
-;; This module defines some utility functions for TLSv1 functions.
-
-;; [RFC 2246] "The TLS Protocol Version 1.0"
-;;     by Christopher Allen <callen@certicom.com> and 
-;;     Tim Dierks <tdierks@certicom.com> (1999/01)
+;; This module defines some utility functions for STARTTLS profiles.
 
 ;; [RFC 2595] "Using TLS with IMAP, POP3 and ACAP"
 ;;     by Chris Newman <chris.newman@innosoft.com> (1999/06)
@@ -65,9 +61,8 @@ BUFFER is the buffer (or `buffer-name') to associate with the process.
 Third arg is name of the host to connect to, or its IP address.
 Fourth arg SERVICE is name of the service desired, or an integer
 specifying a port number to connect to."
-
   (let* ((process-connection-type nil)
-        (process (apply #'start-process 
+        (process (apply #'start-process
                         name buffer starttls-program
                         host (format "%s" service)
                         starttls-extra-args)))