Gnus development mailing list
 help / color / mirror / Atom feed
From: Reiner Steib <reinersteib+gmane@imap.cc>
Cc: ding@gnus.org
Subject: pgg-gpg-process-region (was: pgg-output-buffer gets created as a unibyte buffer)
Date: Sat, 06 May 2006 14:37:48 +0200	[thread overview]
Message-ID: <v9iroj49cz.fsf@marauder.physik.uni-ulm.de> (raw)
In-Reply-To: <87fyjz2gaj.fsf@pacem.orebokech.com>

On Thu, Apr 27 2006, Romain Francoise wrote:

> Daiki Ueno <ueno@unixuser.org> writes:
>
>> For example, the original PGG does not use `call-process-region' for
>> security reason -- this function writes data to a temporary file.

Did you check which versions of Emacs or XEmacs do this?  (I don't
have the C sources here ATM, so I can't check myself.)

>> About three years ago, Gnus decided to use `call-process-region' in
>> PGG to avoid display blinking.
>
> The current version of PGG in the trunk doesn't do that anymore.
> That sounds like a good enough reason to sync that version in v5-10!

Maybe we should rather revert the change introducing
`call-process-region' [1]?  Have all the problems that led us to
revert pgg-gpg.el before the 5.10.8 release been fixed in the trunk
version (or in Daiki's version)?

Bye, Reiner.

[1]
,----[ ChangeLog.2 ]
| 2003-02-08  Simon Josefsson  <jas@extundo.com>
| 
| 	* gnus-sum.el (gnus-summary-select-article): Remove blink removal
| 	code that only worked under Emacs.
| 
| 	* pgg-gpg.el (pgg-gpg-process-region): Don't blink.  From Satyaki
| 	Das <satyaki@chicory.stanford.edu>.
`----

--8<---------------cut here---------------start------------->8---
--- pgg-gpg.el	2 Nov 2002 04:27:00 -0000	6.8
+++ pgg-gpg.el	8 Feb 2003 18:58:23 -0000	6.9
@@ -59,27 +59,22 @@
 	 (errors-buffer pgg-errors-buffer)
 	 (orig-mode (default-file-modes))
 	 (process-connection-type nil)
-	 process status exit-status)
+	 exit-status)
     (with-current-buffer (get-buffer-create errors-buffer)
       (buffer-disable-undo)
       (erase-buffer))
     (unwind-protect
 	(progn
 	  (set-default-file-modes 448)
-	  (let ((coding-system-for-write 'binary))
-	    (setq process
-		  (apply #'start-process "*GnuPG*" errors-buffer
-			 program args)))
-	  (set-process-sentinel process #'ignore)
-	  (when passphrase
-	    (process-send-string process (concat passphrase "\n")))
-	  (process-send-region process start end)
-	  (process-send-eof process)
-	  (while (eq 'run (process-status process))
-	    (accept-process-output process 5))
-	  (setq status (process-status process)
-		exit-status (process-exit-status process))
-	  (delete-process process)
+          (let* ((coding-system-for-write 'binary)
+                 (input (buffer-substring-no-properties start end)))
+            (with-temp-buffer
+              (when passphrase
+                (insert passphrase "\n"))
+              (insert input)
+              (setq exit-status
+                    (apply #'call-process-region (point-min) (point-max) program
+                           nil errors-buffer nil args))))
 	  (with-current-buffer (get-buffer-create output-buffer)
 	    (buffer-disable-undo)
 	    (erase-buffer)
@@ -87,12 +82,8 @@
 		(let ((coding-system-for-read 'raw-text-dos))
 		  (insert-file-contents output-file-name)))
 	    (set-buffer errors-buffer)
-	    (if (memq status '(stop signal))
-		(error "%s exited abnormally: '%s'" program exit-status))
-	    (if (= 127 exit-status)
-		(error "%s could not be found" program))))
-      (if (and process (eq 'run (process-status process)))
-	  (interrupt-process process))
+	    (if (not (equal exit-status 0))
+		(error "%s exited abnormally: '%s'" program exit-status))))
       (if (file-exists-p output-file-name)
 	  (delete-file output-file-name))
       (set-default-file-modes orig-mode))))
--8<---------------cut here---------------end--------------->8---
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/



  reply	other threads:[~2006-05-06 12:37 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-26 12:41 pgg-output-buffer gets created as a unibyte buffer Katsumi Yamaoka
2006-04-26 13:22 ` Daiki Ueno
2006-04-26 22:27   ` Katsumi Yamaoka
2006-04-27  7:01     ` Katsumi Yamaoka
2006-04-27  9:36       ` Daiki Ueno
2006-04-27 10:19         ` Katsumi Yamaoka
2006-04-27 10:48           ` Katsumi Yamaoka
2006-04-27 14:45             ` Daiki Ueno
2006-04-27 15:23               ` Romain Francoise
2006-05-06 12:37                 ` Reiner Steib [this message]
2006-09-02 11:16                   ` Security flaw in pgg-gpg-process-region? (was: pgg-gpg-process-region) Reiner Steib
2006-09-02 13:16                     ` Security flaw in pgg-gpg-process-region? Daiki Ueno
2006-09-02 13:49                       ` Daiki Ueno
2006-09-03 15:16                         ` Richard Stallman
2006-09-04  1:36                           ` Daiki Ueno
2006-09-04 17:18                             ` Richard Stallman
2006-09-04 17:45                               ` Daiki Ueno
2006-09-04 17:48                                 ` David Kastrup
2006-09-05  5:06                                   ` Daiki Ueno
2006-09-05 15:10                                     ` Chong Yidong
2006-09-06  8:49                                     ` Richard Stallman
2006-09-06  9:25                                       ` Daiki Ueno
2006-09-07  6:54                                         ` Richard Stallman
2006-09-06  8:49                                 ` Richard Stallman
2006-09-03 15:16                     ` Security flaw in pgg-gpg-process-region? (was: pgg-gpg-process-region) Richard Stallman
2006-09-03 16:28                     ` Security flaw in pgg-gpg-process-region? Florian Weimer
2006-09-04  2:04                       ` Daiki Ueno
2006-09-04  2:25                         ` Miles Bader
2006-09-05  9:43                         ` Richard Stallman
2006-09-05 11:57                           ` Daiki Ueno
2006-09-06 19:05                             ` Richard Stallman
2006-09-06 19:33                               ` gdt
2006-09-06 21:33                                 ` Miles Bader
2006-09-07 21:13                                 ` Richard Stallman
2006-09-19 10:02                                   ` Sascha Wilde
2006-09-19 22:56                                     ` Richard Stallman
2006-11-11 22:00                                       ` Sascha Wilde
2006-11-12 21:12                                         ` Richard Stallman
2006-11-12 21:38                                           ` Sascha Wilde
2006-11-13 20:15                                             ` Richard Stallman
2006-11-14 11:11                                             ` Sascha Wilde
2006-09-06 22:44                               ` Daiki Ueno
2006-09-07 21:14                                 ` Richard Stallman
2006-09-06 20:11                           ` Florian Weimer
2006-09-07 14:12                             ` Chong Yidong
2006-09-07 21:13                             ` Richard Stallman
2006-04-27 16:08               ` pgg-output-buffer gets created as a unibyte buffer Katsumi Yamaoka
2006-04-28  5:18                 ` Katsumi Yamaoka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=v9iroj49cz.fsf@marauder.physik.uni-ulm.de \
    --to=reinersteib+gmane@imap.cc \
    --cc=Reiner.Steib@gmx.de \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).