2001-01-20 Simon Josefsson <sj@extundo.com>
authorSimon Josefsson <jas@extundo.com>
Sat, 20 Jan 2001 00:02:13 +0000 (00:02 +0000)
committerSimon Josefsson <jas@extundo.com>
Sat, 20 Jan 2001 00:02:13 +0000 (00:02 +0000)
* mm-decode.el (mm-handle-multipart-from): Add.
(mm-dissect-buffer): Save From: header value.
(mm-security-from): Remove.
(mm-possibly-verify-or-decrypt): Don't set mm-security-from.

* mml-smime.el (mml-smime-verify): Use `mm-handle-multipart-from'
instead of `mml-security-from'.  Protect null from value.

lisp/ChangeLog
lisp/mm-decode.el
lisp/mml-smime.el

index 68f26f5..cb3e147 100644 (file)
@@ -1,3 +1,13 @@
+2001-01-20  Simon Josefsson  <sj@extundo.com>
+
+       * mm-decode.el (mm-handle-multipart-from): Add.
+       (mm-dissect-buffer): Save From: header value.
+       (mm-security-from): Remove.
+       (mm-possibly-verify-or-decrypt): Don't set mm-security-from.
+
+       * mml-smime.el (mml-smime-verify): Use `mm-handle-multipart-from'
+       instead of `mml-security-from'.  Protect null from value.
+
 2001-01-20  Simon Josefsson  <sj@extundo.com>
 
        * mailcap.el (mailcap-mime-data): Run `gnumeric' on
index 186b1c8..dbe9c2e 100644 (file)
@@ -81,6 +81,8 @@
   `(nth 7 ,handle))
 (defmacro mm-handle-multipart-original-buffer (handle)
   `(get-text-property 0 'buffer (car ,handle)))
+(defmacro mm-handle-multipart-from (handle)
+  `(get-text-property 0 'from (car ,handle)))
 (defmacro mm-handle-multipart-ctl-parameter (handle parameter)
   `(get-text-property 0 ,parameter (car ,handle)))
 
@@ -325,7 +327,7 @@ The original alist is not modified.  See also `destructive-alist-to-plist'."
 (defun mm-dissect-buffer (&optional no-strict-mime)
   "Dissect the current buffer and return a list of MIME handles."
   (save-excursion
-    (let (ct ctl type subtype cte cd description id result)
+    (let (ct ctl type subtype cte cd description id result from)
       (save-restriction
        (mail-narrow-to-head)
        (when (or no-strict-mime
@@ -335,6 +337,8 @@ The original alist is not modified.  See also `destructive-alist-to-plist'."
                cte (mail-fetch-field "content-transfer-encoding")
                cd (mail-fetch-field "content-disposition")
                description (mail-fetch-field "content-description")
+               from (cadr (mail-extract-address-components 
+                           (or (mail-fetch-field "from") "")))
                id (mail-fetch-field "content-id"))))
       (when cte
        (setq cte (mail-header-strip cte)))
@@ -369,6 +373,9 @@ The original alist is not modified.  See also `destructive-alist-to-plist'."
              (add-text-properties 0 (length (car ctl))
                                  (list 'buffer (mm-copy-to-buffer))
                                   (car ctl))
+             (add-text-properties 0 (length (car ctl))
+                                 (list 'from from)
+                                  (car ctl))
             (cons (car ctl) (mm-dissect-multipart ctl))))
          (t
           (mm-dissect-singlepart
@@ -1025,7 +1032,6 @@ If RECURSIVE, search recursively."
     result))
 
 (defvar mm-security-handle nil)
-(defvar mm-security-from nil)
 
 (defsubst mm-set-handle-multipart-parameter (handle parameter value)
   ;; HANDLE could be a CTL.
@@ -1036,11 +1042,6 @@ If RECURSIVE, search recursively."
 (defun mm-possibly-verify-or-decrypt (parts ctl)
   (let ((subtype (cadr (split-string (car ctl) "/")))
        (mm-security-handle ctl) ;; (car CTL) is the type.
-       (mm-security-from
-        (save-restriction
-          (mail-narrow-to-head)
-          (cadr (mail-extract-address-components 
-                 (or (mail-fetch-field "from") "")))))
        protocol func functest)
     (cond 
      ((equal subtype "signed")
index 7ebc439..c7207e4 100644 (file)
                                         (point-min) (point)) addresses)))
              (delete-region (point-min) (point)))
            (setq addresses (mapcar 'downcase addresses))))
-       (if (not (member (downcase mm-security-from) addresses))
+       (if (not (member (downcase (or (mm-handle-multipart-from ctl) "")) addresses))
            (mm-set-handle-multipart-parameter 
             mm-security-handle 'gnus-info "Sender address forged")
          (if good-certificate
             mm-security-handle 'gnus-info "Integrity OK (sender unknown)")))
        (mm-set-handle-multipart-parameter
         mm-security-handle 'gnus-details 
-        (concat "Sender clamed to be: " mm-security-from "\n"
+        (concat "Sender clamed to be: " (mm-handle-multipart-from ctl) "\n"
                 (if addresses
                     (concat "Addresses in certificate: " 
                             (mapconcat 'identity addresses ", "))