From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/43892 Path: main.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: pop3.el broken Date: Fri, 15 Mar 2002 22:18:39 +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: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1016213050 4664 127.0.0.1 (15 Mar 2002 17:24:10 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 15 Mar 2002 17:24:10 +0000 (UTC) Cc: mule-ja@m17n.org Original-Received: from hermes.netfonds.no ([195.204.10.138]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 16lvPy-0000PZ-05 for ; Fri, 15 Mar 2002 18:23:03 +0100 Original-Received: from malifon.math.uh.edu (malifon.math.uh.edu [129.7.128.13]) by hermes.netfonds.no (8.10.1/8.9.3) with ESMTP id g2FDQfM03815 for ; Fri, 15 Mar 2002 14:26:41 +0100 (CET) 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 16lrby-00020a-00; Fri, 15 Mar 2002 07:19:10 -0600 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Fri, 15 Mar 2002 07:19:15 -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 HAA22199 for ; Fri, 15 Mar 2002 07:19:04 -0600 (CST) Original-Received: (qmail 25027 invoked by alias); 15 Mar 2002 13:18:52 -0000 Original-Received: (qmail 25022 invoked from network); 15 Mar 2002 13:18:51 -0000 Original-Received: from groundpoundrecords.com (HELO mars.web-hosting.com) (207.228.244.150) by gnus.org with SMTP; 15 Mar 2002 13:18:51 -0000 Original-Received: (from yamaoka@localhost) by mars.web-hosting.com (8.11.1/8.11.1) id g2FDIoo19228; Fri, 15 Mar 2002 08:18:50 -0500 (EST) Original-To: ding@gnus.org 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&( User-Agent: Gnus/5.090006 (Oort Gnus v0.06) Emacs/21.2.50 (sparc-sun-solaris2.6) Cancel-Lock: sha1:b4dzxsTuZK3wb1WDtNQvkz2vIkM= Original-Lines: 83 Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:43892 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:43892 --=-=-= The problem that the return value of `md5' for a multibyte string and a unibyte string differ under Emacs 21 is caused by Mule-UCS. However, it is not a bug of Mule-UCS. What we should do is to improve pop3.el after all. I will attach a new patch. The built-in function `md5' will encode a given string if it is a multibyte string. The coding-system for encoding is decided by the following way: (symbol-value (car coding-category-list)) You can find those procedures in fns.c. Mule-UCS will put the coding category `coding-category-utf-16-le' in the forefront of `coding-category-list' by default. The default value of `coding-category-utf-16-le' is `utf-16-le'. And a string extracted from a multibyte buffer will be a multibyte string even if it does not contain non-ascii characters. Thus the code (md5 (concat pop3-timestamp pass)) and (md5 (encode-coding-string (concat pop3-timestamp pass) 'utf-16-le)) are equivalent and a string will be altered to 16-bit characters as follows: (encode-coding-string "dingnusdingnus" 'utf-16-le) => "\377\376d^@i^@n^@g^@n^@u^@s^@d^@i^@n^@g^@n^@u^@s^@" Even if Mule-UCS is not used, a string as the first argument of `md5' is always encoded by some coding-system, but almost all coding-systems will not alter an ascii text. Exceptionally, it is a very rare case but it is possible that if a person has set the value of `coding-category-iso-7' with the coding-system `iso-2022-jp-1978-irv' (which is known as "old JIS") and push `coding-category-iso-7' into `coding-category-list', she or he would not be able to use the apop authentication with pop3.el. In my opinion that it should never be her or his fault. 2002-03-15 Katsumi Yamaoka * pop3.el (pop3-string-as-unibyte): New macro. (pop3-apop): Use it. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=pop3.el.diff --- pop3.el~ 2002-03-13 21:56:17.780672000 +0000 +++ pop3.el 2002-03-15 12:58:08.964942000 +0000 @@ -307,6 +307,13 @@ (if (not (and response (string-match "+OK" response))) (pop3-quit process)))) +(eval-when-compile + (defmacro pop3-string-as-unibyte (string) + "Return a unibyte string with the same individual bytes as STRING." + (if (fboundp 'string-as-unibyte) + (list 'string-as-unibyte string) + string))) + (defun pop3-apop (process user) "Send alternate authentication information to the server." (let ((pass pop3-password)) @@ -314,7 +321,8 @@ (setq pass (pop3-read-passwd (format "Password for %s: " pop3-maildrop)))) (if pass - (let ((hash (pop3-md5 (concat pop3-timestamp pass)))) + (let ((hash (pop3-md5 (pop3-string-as-unibyte + (concat pop3-timestamp pass))))) (pop3-send-command process (format "APOP %s %s" user hash)) (let ((response (pop3-read-response process t))) (if (not (and response (string-match "+OK" response))) --=-=-=--