changeset 62960:31ebc6690b8b

Revision: miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-348 Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 79) - Update from CVS 2005-06-02 Katsumi Yamaoka <yamaoka@jpl.org> * lisp/gnus/pop3.el (pop3-md5): Run md5 in the binary mode. (pop3-md5-program-args): New variable. * lisp/gnus/starttls.el (starttls-set-process-query-on-exit-flag): Use eval-and-compile.
author Miles Bader <miles@gnu.org>
date Thu, 02 Jun 2005 11:34:00 +0000
parents 90329069eb0f
children 2945f8ec464e
files lisp/gnus/ChangeLog lisp/gnus/pop3.el lisp/gnus/starttls.el
diffstat 3 files changed, 42 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Thu Jun 02 10:06:14 2005 +0000
+++ b/lisp/gnus/ChangeLog	Thu Jun 02 11:34:00 2005 +0000
@@ -1,3 +1,11 @@
+2005-06-02  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+	* pop3.el (pop3-md5): Run md5 in the binary mode.
+	(pop3-md5-program-args): New variable.
+
+	* starttls.el (starttls-set-process-query-on-exit-flag): Use
+	eval-and-compile.
+
 2005-05-31  Katsumi Yamaoka  <yamaoka@jpl.org>
 
 	* gnus-art.el (article-display-x-face): Replace
--- a/lisp/gnus/pop3.el	Thu Jun 02 10:06:14 2005 +0000
+++ b/lisp/gnus/pop3.el	Thu Jun 02 11:34:00 2005 +0000
@@ -1,6 +1,7 @@
 ;;; pop3.el --- Post Office Protocol (RFC 1460) interface
 
-;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+;; Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+;; 2005
 ;;        Free Software Foundation, Inc.
 
 ;; Author: Richard L. Pieri <ratinox@peorth.gweep.net>
@@ -348,21 +349,36 @@
 
 ;; AUTHORIZATION STATE
 
+(eval-when-compile
+  (if (not (fboundp 'md5)) ;; Emacs 20
+      (defalias 'md5 'ignore)))
+
 (eval-and-compile
-  (if (fboundp 'md5)
-      (defalias 'pop3-md5 'md5)
+  (if (and (fboundp 'md5)
+	   ;; There might be an incompatible implementation.
+	   (condition-case nil
+	       (md5 "Check whether the 4th argument is allowed"
+		    nil nil 'binary)
+	     (error nil)))
+      (defun pop3-md5 (string)
+	(md5 string nil nil 'binary))
     (defvar pop3-md5-program "md5"
-      "*Program to encode its input in MD5.")
-
+      "*Program to encode its input in MD5.
+\"openssl\" is a popular alternative; set `pop3-md5-program-args' to
+'(\"md5\") if you use it.")
+    (defvar pop3-md5-program-args nil
+      "*List of arguments passed to `pop3-md5-program'.")
     (defun pop3-md5 (string)
-      (with-temp-buffer
-	(insert string)
-	(call-process-region (point-min) (point-max)
-			     pop3-md5-program
-			     t (current-buffer) nil)
-	;; The meaningful output is the first 32 characters.
-	;; Don't return the newline that follows them!
-	(buffer-substring (point-min) (+ 32 (point-min)))))))
+      (let ((default-enable-multibyte-characters t)
+	    (coding-system-for-write 'binary))
+	(with-temp-buffer
+	  (insert string)
+	  (apply 'call-process-region (point-min) (point-max)
+		 pop3-md5-program t (current-buffer) nil
+		 pop3-md5-program-args)
+	  ;; The meaningful output is the first 32 characters.
+	  ;; Don't return the newline that follows them!
+	  (buffer-substring (point-min) (+ 32 (point-min))))))))
 
 (defun pop3-user (process user)
   "Send USER information to POP3 server."
--- a/lisp/gnus/starttls.el	Thu Jun 02 10:06:14 2005 +0000
+++ b/lisp/gnus/starttls.el	Thu Jun 02 11:34:00 2005 +0000
@@ -236,11 +236,12 @@
       (starttls-negotiate-gnutls process)
     (signal-process (process-id process) 'SIGALRM)))
 
-(if (fboundp 'set-process-query-on-exit-flag)
+(eval-and-compile
+  (if (fboundp 'set-process-query-on-exit-flag)
+      (defalias 'starttls-set-process-query-on-exit-flag
+	'set-process-query-on-exit-flag)
     (defalias 'starttls-set-process-query-on-exit-flag
-      'set-process-query-on-exit-flag)
-  (defalias 'starttls-set-process-query-on-exit-flag
-    'process-kill-without-query))
+      'process-kill-without-query)))
 
 (defun starttls-open-stream-gnutls (name buffer host service)
   (message "Opening STARTTLS connection to `%s'..." host)