* 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-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.
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"
(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)
(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.
(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
(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")