2000-05-06 Florian Weimer <fw@deneb.cygnus.argh.org>
authorFlorian Weimer <fw@deneb.enyo.de>
Sat, 6 May 2000 19:10:04 +0000 (19:10 +0000)
committerFlorian Weimer <fw@deneb.enyo.de>
Sat, 6 May 2000 19:10:04 +0000 (19:10 +0000)
* gnus-uu.el (gnus-uu-unshar-warning): New variable.
(gnus-uu-unshar-article): Use it.

* mailcap.el (mailcap-maybe-eval-warning): New variable.
(mailcap-maybe-eval): Use it.

* gnus-msg.el (gnus-group-posting-charset-alist): Speling mistake
in docstring.

* mml.el (mml-generate-mime-1): Small comment.

lisp/ChangeLog
lisp/gnus-msg.el
lisp/gnus-uu.el
lisp/mailcap.el
lisp/mml.el

index f04d660..bfbe2b0 100644 (file)
@@ -1,3 +1,16 @@
+2000-05-06  Florian Weimer  <fw@deneb.cygnus.argh.org>
+
+       * gnus-uu.el (gnus-uu-unshar-warning): New variable.
+       (gnus-uu-unshar-article): Use it.
+
+       * mailcap.el (mailcap-maybe-eval-warning): New variable.
+       (mailcap-maybe-eval): Use it.
+
+       * gnus-msg.el (gnus-group-posting-charset-alist): Speling mistake
+       in docstring.
+
+       * mml.el (mml-generate-mime-1): Small comment.
+
 2000-05-05 12:27:53  Shenghuo ZHU  <zsh@cs.rochester.edu>
 
        * gnus-art.el (article-de-base64-unreadable): New function.
index dadd9bc..b8430ed 100644 (file)
@@ -116,7 +116,7 @@ BODY-LIST is a list of charsets which may be encoded using 8bit
 content-transfer encoding in the body, or one of the special values
 nil (always encode using quoted-printable) or t (always use 8bit).
 
-Note that any value other tha nil for HEADER infringes some RFCs, so
+Note that any value other than nil for HEADER infringes some RFCs, so
 use this option with care."
   :type '(repeat (list :tag "Permitted unencoded charsets"
                  (choice :tag "Where"
index 56c6812..3a60f7d 100644 (file)
@@ -1481,6 +1481,21 @@ When called interactively, prompt for REGEXP."
          (cons (if (= (length files) 1) (car files) files) state)
        state))))
 
+(defvar gnus-uu-unshar-warning
+  "*** WARNING ***
+
+Shell archives are an archaic method of bundling files for distribution
+across computer networks.  During the unpacking process, arbitrary commands
+are executed on your system, and all kinds of nasty things can happen.
+Please examine the archive very carefully before you instruct Emacs to
+unpack it.  You can browse the archive buffer using \\[scroll-other-window].
+
+If you are unsure what to do, please answer \"no\"."
+  "Text of warning message displayed by `gnus-uu-unshar-article'.
+Make sure that this text consists only of few text lines.  Otherwise,
+Gnus might fail to display all of it.")
+
+
 ;; This function is used by `gnus-uu-grab-articles' to treat
 ;; a shared article.
 (defun gnus-uu-unshar-article (process-buffer in-state)
@@ -1491,14 +1506,31 @@ When called interactively, prompt for REGEXP."
       (goto-char (point-min))
       (if (not (re-search-forward gnus-uu-shar-begin-string nil t))
          (setq state (list 'wrong-type))
-       (beginning-of-line)
-       (setq start-char (point))
-       (call-process-region
-        start-char (point-max) shell-file-name nil
-        (gnus-get-buffer-create gnus-uu-output-buffer-name) nil
-        shell-command-switch
-        (concat "cd " gnus-uu-work-dir " "
-                gnus-shell-command-separator  " sh"))))
+       (save-window-excursion
+         (save-excursion
+           (switch-to-buffer (current-buffer))
+           (delete-other-windows)
+           (let ((buffer (get-buffer-create (generate-new-buffer-name
+                                             "*Warning*"))))
+             (unless
+                 (unwind-protect
+                     (with-current-buffer buffer
+                       (insert (substitute-command-keys 
+                                gnus-uu-unshar-warning))
+                       (goto-char (point-min))
+                       (display-buffer buffer)
+                       (yes-or-no-p "This is a shell archive, unshar it? "))
+                   (kill-buffer buffer))
+               (setq state (list 'error))))))
+       (unless (memq 'error state)
+         (beginning-of-line)
+         (setq start-char (point))
+         (call-process-region
+          start-char (point-max) shell-file-name nil
+          (gnus-get-buffer-create gnus-uu-output-buffer-name) nil
+          shell-command-switch
+          (concat "cd " gnus-uu-work-dir " "
+                  gnus-shell-command-separator  " sh")))))
     state))
 
 ;; Returns the name of what the shar file is going to unpack.
index 3450905..565b555 100644 (file)
@@ -286,11 +286,42 @@ not.")
        (write-region (point-min) (point-max) file))
     (kill-buffer (current-buffer))))
 
+(defvar mailcap-maybe-eval-warning
+  "*** WARNING ***
+
+This MIME part contains untrusted and possibly harmful content.  
+If you evaluate the Emacs Lisp code contained in it, a lot of nasty
+things can happen.  Please examine the code very carefully before you
+instruct Emacs to evaluate it.  You can browse the buffer containing
+the code using \\[scroll-other-window].
+
+If you are unsure what to do, please answer \"no\"."
+  "Text of warning message displayed by `mailcap-maybe-eval'.
+Make sure that this text consists only of few text lines.  Otherwise,
+Gnus might fail to display all of it.")
+  
 (defun mailcap-maybe-eval ()
   "Maybe evaluate a buffer of emacs lisp code."
-  (if (yes-or-no-p "This is emacs-lisp code, evaluate it? ")
-      (eval-buffer (current-buffer))
-    (emacs-lisp-mode)))
+  (let ((lisp-buffer (current-buffer)))
+    (when
+       (goto-char (point-min))
+       (save-window-excursion
+         (delete-other-windows)
+         (let ((buffer (get-buffer-create (generate-new-buffer-name
+                                           "*Warning*"))))
+           (unwind-protect
+               (with-current-buffer buffer
+                 (insert (substitute-command-keys 
+                          mailcap-maybe-eval-warning))
+                 (goto-char (point-min))
+                 (display-buffer buffer)
+                 (yes-or-no-p "This is emacs-lisp code, evaluate it? "))
+             (kill-buffer buffer))))
+      (eval-buffer (current-buffer)))
+    (when (buffer-live-p lisp-buffer)
+      (with-current-buffer lisp-buffer
+       (emacs-lisp-mode)))))
+
 
 ;;;
 ;;; The mailcap parser
index f667ba2..2963f44 100644 (file)
@@ -355,6 +355,7 @@ If MML is non-nil, return the buffer up till the correspondent mml tag."
         (let ((mml-boundary (mml-compute-boundary cont)))
           (insert (format "Content-Type: multipart/%s; boundary=\"%s\"\n"
                           type mml-boundary))
+         ;; Skip `multipart' and `type' elements.
           (setq cont (cddr cont))
           (while cont
             (insert "\n--" mml-boundary "\n")