From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/43915 Path: main.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: pop3.el broken Date: Mon, 18 Mar 2002 22:03:58 +0900 Organization: Emacsen advocacy group Sender: owner-ding@hpc.uh.edu Message-ID: References: NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1016456741 5794 127.0.0.1 (18 Mar 2002 13:05:41 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 18 Mar 2002 13:05:41 +0000 (UTC) Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16mwpY-0001VM-00 for ; Mon, 18 Mar 2002 14:05:41 +0100 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 16mwoP-0006Tm-00; Mon, 18 Mar 2002 07:04:29 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Mon, 18 Mar 2002 07:04:35 -0600 (CST) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id HAA06326 for ; Mon, 18 Mar 2002 07:04:22 -0600 (CST) Original-Received: (qmail 7503 invoked by alias); 18 Mar 2002 13:04:10 -0000 Original-Received: (qmail 7493 invoked from network); 18 Mar 2002 13:04:09 -0000 Original-Received: from groundpoundrecords.com (HELO mars.web-hosting.com) (207.228.244.150) by gnus.org with SMTP; 18 Mar 2002 13:04:09 -0000 Original-Received: (from yamaoka@localhost) by mars.web-hosting.com (8.11.1/8.11.1) id g2ID48x10602; Mon, 18 Mar 2002 08:04:08 -0500 (EST) Original-To: ding@gnus.org User-Agent: Gnus/5.090006 (Oort Gnus v0.06) XEmacs/21.5 (beets, sparc-sun-solaris2.6) Mule-UCS/0.84 =?iso-2022-jp?b?KEtPVUdFVFNVREFJOhskQjh+N24bKEI=?= =?iso-2022-jp?b?GyRCQmYbKEIp?= X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( Cancel-Lock: sha1:/5Y9MRwG9HFnjxCgfI4ozlNcdCw= Original-Lines: 97 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:43915 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:43915 Let's assume that the following premises are correct. 1. A POP3 server will use only ascii characters to generate a timestamp string in its banner greeting, which is described in RFC1460. There is no problem that pop3.el uses the coding-system binary and a multibyte buffer to transfer such a string from a server. 2. A password string may be either an ascii-only string or a string which includes non-ascii characters. The latter should be encoded with a reasonable coding-system before passing it to md5bin (which is mentioned below). I don't know how to set a non-ascii password using the popauth command, and I think the use of a non-ascii password is not popular, though. 3. Both a timestamp string and a password string do not contain newlines. 4. There is the imaginary function md5bin which will not encode a given string. It can be provided with one of the built-in md5, the lisp function md5 and the external process md5 which is called with the coding-system binary. Do you have any doubts? If none, pop3.el can be modified something like follows. It can be simplified if we don't have to handle to encode a password string. (defvar pop3-apop-passwd-coding-system nil "*Coding system used to encode a non-ascii password for APOP.") (defvar pop3-md5-binary nil) (defmacro pop3-make-apop-auth (password) "Return a string for the apop authentication corresponding to the value of `pop3-timestamp' and PASSWORD." (if (and nil;(fboundp 'md5) (subrp (symbol-function 'md5))) (if (and (featurep 'xemacs) (< (function-max-args 'md5) 4)) (if (featurep 'mule) ;; XEmacs 20 with MULE `(let ((pass ,password)) (md5 (concat pop3-timestamp (if pop3-apop-passwd-coding-system (encode-coding-string pass pop3-apop-passwd-coding-system) pass)))) ;; XEmacs 20 without MULE `(md5 (concat pop3-timestamp ,password))) (if (featurep 'mule) ;; Emacs 21 or XEmacs 21 with MULE `(let ((pass ,password)) (md5 (concat pop3-timestamp (if pop3-apop-passwd-coding-system (encode-coding-string pass pop3-apop-passwd-coding-system) pass)) nil nil 'binary)) ;; XEmacs 21 without MULE `(md5 (concat pop3-timestamp ,password) nil nil 'binary))) (let ((fn '(if (not pop3-md5-binary) (setq pop3-md5-binary (if (condition-case nil (require 'md5) (error nil)) 'md5 (lambda (string) (with-temp-buffer (insert string) (let ((coding-system-for-write 'binary)) (call-process-region (point-min) (point-max) pop3-md5-program t (current-buffer)) (buffer-substring 1 33))))))))) (if (featurep 'mule) `(let ((pass ,password)) ,fn (funcall pop3-md5-binary (concat pop3-timestamp (if pop3-apop-passwd-coding-system (encode-coding-string pass pop3-apop-passwd-coding-system) pass)))) `(progn ,fn (funcall pop3-md5-binary (concat pop3-timestamp ,password))))))) (defun pop3-apop (process user) [...] ;;(let ((hash (pop3-md5 (concat pop3-timestamp pass)))) (let ((hash (pop3-make-apop-auth pass))) -- Katsumi Yamaoka