From: Katsumi Yamaoka <yamaoka@jpl.org>
Subject: Re: pop3.el broken
Date: Mon, 18 Mar 2002 22:03:58 +0900 [thread overview]
Message-ID: <yosuk7sa9ge8.fsf@jpl.org> (raw)
In-Reply-To: <m3u1rgo7zq.fsf@peorth.gweep.net>
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 <yamaoka@jpl.org>
next prev parent reply other threads:[~2002-03-18 13:03 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-03-13 10:58 Pavel Janík
2002-03-13 15:50 ` Stainless Steel Rat
2002-03-13 16:20 ` Bill White
2002-03-13 16:31 ` Bill White
2002-03-13 17:46 ` Bill White
2002-03-13 17:53 ` Paul Jarc
2002-03-13 20:21 ` Karl Kleinpaste
2002-03-13 19:58 ` Simon Josefsson
2002-03-13 22:39 ` Katsumi Yamaoka
2002-03-14 4:52 ` Stainless Steel Rat
2002-03-14 7:01 ` Katsumi Yamaoka
2002-03-14 9:35 ` Simon Josefsson
2002-03-14 22:11 ` Stainless Steel Rat
2002-03-15 13:18 ` Katsumi Yamaoka
2002-03-15 18:03 ` Simon Josefsson
2002-03-16 4:03 ` Stainless Steel Rat
2002-03-16 9:59 ` Simon Josefsson
2002-03-16 10:24 ` Simon Josefsson
2002-03-16 15:19 ` Stainless Steel Rat
2002-03-18 13:03 ` Katsumi Yamaoka [this message]
2002-03-18 15:53 ` Stainless Steel Rat
2002-03-18 17:12 ` Simon Josefsson
2002-03-18 18:04 ` Stainless Steel Rat
2002-03-18 17:30 ` Simon Josefsson
2002-03-18 23:43 ` Katsumi Yamaoka
2002-03-19 1:13 ` Stainless Steel Rat
2002-03-19 9:54 ` Simon Josefsson
2002-03-16 3:57 ` Stainless Steel Rat
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=yosuk7sa9ge8.fsf@jpl.org \
--to=yamaoka@jpl.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).