diff options
| author | Richard M. Stallman | 1997-08-31 07:58:03 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-08-31 07:58:03 +0000 |
| commit | 838bf4737fb66e6fdc44276500564a336ba9e79a (patch) | |
| tree | a58f8630e4d9ee30a00b912313caad24e6ac3611 | |
| parent | 095fb03edbc52f5d5047832cb4c798be7750bd13 (diff) | |
| download | emacs-838bf4737fb66e6fdc44276500564a336ba9e79a.tar.gz emacs-838bf4737fb66e6fdc44276500564a336ba9e79a.zip | |
(pop3-md5): New function.
(pop3-apop): Use pop3-md5, not md5.
(pop3-md5-program): New variable.
| -rw-r--r-- | lisp/gnus/pop3.el | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lisp/gnus/pop3.el b/lisp/gnus/pop3.el index 95bd64ccaa4..7e6338b8ca3 100644 --- a/lisp/gnus/pop3.el +++ b/lisp/gnus/pop3.el | |||
| @@ -265,15 +265,28 @@ Return the response string if optional second argument is non-nil." | |||
| 265 | (pop3-quit process))))) | 265 | (pop3-quit process))))) |
| 266 | )) | 266 | )) |
| 267 | 267 | ||
| 268 | (defvar pop3-md5-program "md5" | ||
| 269 | "*Program to encode its input in MD5.") | ||
| 270 | |||
| 271 | (defun pop3-md5 (string) | ||
| 272 | (with-temp-buffer | ||
| 273 | (insert string) | ||
| 274 | (call-process-region (point-min) (point-max) | ||
| 275 | (or shell-file-name "/bin/sh") | ||
| 276 | t (current-buffer) nil | ||
| 277 | "-c" pop3-md5-program) | ||
| 278 | ;; The meaningful output is the first 32 characters. | ||
| 279 | ;; Don't return the newline that follows them! | ||
| 280 | (buffer-substring (point-min) (+ (point-min) 32)))) | ||
| 281 | |||
| 268 | (defun pop3-apop (process user) | 282 | (defun pop3-apop (process user) |
| 269 | "Send alternate authentication information to the server." | 283 | "Send alternate authentication information to the server." |
| 270 | (if (not (fboundp 'md5)) (autoload 'md5 "md5")) | ||
| 271 | (let ((pass pop3-password)) | 284 | (let ((pass pop3-password)) |
| 272 | (if (and pop3-password-required (not pass)) | 285 | (if (and pop3-password-required (not pass)) |
| 273 | (setq pass | 286 | (setq pass |
| 274 | (pop3-read-passwd (format "Password for %s: " pop3-maildrop)))) | 287 | (pop3-read-passwd (format "Password for %s: " pop3-maildrop)))) |
| 275 | (if pass | 288 | (if pass |
| 276 | (let ((hash (md5 (concat pop3-timestamp pass)))) | 289 | (let ((hash (pop3-md5 (concat pop3-timestamp pass)))) |
| 277 | (pop3-send-command process (format "APOP %s %s" user hash)) | 290 | (pop3-send-command process (format "APOP %s %s" user hash)) |
| 278 | (let ((response (pop3-read-response process t))) | 291 | (let ((response (pop3-read-response process t))) |
| 279 | (if (not (and response (string-match "+OK" response))) | 292 | (if (not (and response (string-match "+OK" response))) |