From: Justus-bulk@Piater.name
To: emacs-devel@gnu.org
Subject: password-cache for smtpmail.el
Date: Wed, 13 Feb 2008 11:04:37 +0100 [thread overview]
Message-ID: <x8tk5l9matm.fsf@tool.montefiore.ulg.ac.be> (raw)
[-- Attachment #1: Type: text/plain, Size: 834 bytes --]
Hi -
Following up to an exchange I had almost two years ago:
Simon Josefsson wrote on Tue, 04 Apr 2006 15:34:24 +0200:
> ... The proper fix is for smtpmail.el to use password.el.
I attach a simple patch that does this. I tested it with emacs 22.1.
The patch also applies against the latest CVS (MAIN/HEAD) version
1.97, except that "password-cache" should be autoloaded instead of
"password" for recent development emacsen.
As a password key I simply reuse the prompt, as it appears to contain
just the right information.
The current version of smtpmail.el does not remember the password if
.authinfo is used. I removed this condition because it prevents
password caching for people who do not store passwords in .authinfo,
and I do not see any harm caused by removing it.
Could you test and apply the patch?
Thanks,
Justus
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: smtpmail-password-cache.diff --]
[-- Type: text/x-diff, Size: 1960 bytes --]
*** /home/piater/share/emacs/lisp/smtpmail-e22.1.el 2008-02-13 10:29:28.911165917 +0100
--- /home/piater/share/emacs/lisp/smtpmail.el 2008-02-13 09:46:37.914414498 +0100
***************
*** 78,83 ****
--- 78,84 ----
(autoload 'netrc-parse "netrc")
(autoload 'netrc-machine "netrc")
(autoload 'netrc-get "netrc")
+ (autoload 'password-read "password") ; for new emacsen: "password-cache"
;;;
(defgroup smtpmail nil
***************
*** 546,557 ****
(netrc-get hostentry "password"))))
(smtpmail-find-credentials
smtpmail-auth-credentials host port)))
(passwd (when cred
(or (smtpmail-cred-passwd cred)
! (read-passwd
! (format "SMTP password for %s:%s: "
! (smtpmail-cred-server cred)
! (smtpmail-cred-port cred))))))
ret)
(when (and cred mech)
(cond
--- 547,558 ----
(netrc-get hostentry "password"))))
(smtpmail-find-credentials
smtpmail-auth-credentials host port)))
+ (prompt (when cred (format "SMTP password for %s:%s: "
+ (smtpmail-cred-server cred)
+ (smtpmail-cred-port cred))))
(passwd (when cred
(or (smtpmail-cred-passwd cred)
! (password-read prompt prompt))))
ret)
(when (and cred mech)
(cond
***************
*** 621,629 ****
(t
(error "Mechanism %s not implemented" mech)))
;; Remember the password.
! (when (and (not (stringp smtpmail-auth-credentials))
! (null (smtpmail-cred-passwd cred)))
! (setcar (cdr (cdr (cdr cred))) passwd)))))
(defun smtpmail-via-smtp (recipient smtpmail-text-buffer)
(let ((process nil)
--- 622,629 ----
(t
(error "Mechanism %s not implemented" mech)))
;; Remember the password.
! (when (null (smtpmail-cred-passwd cred))
! (password-cache-add prompt passwd)))))
(defun smtpmail-via-smtp (recipient smtpmail-text-buffer)
(let ((process nil)
next reply other threads:[~2008-02-13 10:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-13 10:04 Justus-bulk [this message]
2008-02-13 21:53 ` password-cache for smtpmail.el Bastien Guerry
2008-02-13 22:23 ` Glenn Morris
2008-02-13 23:56 ` Juanma Barranquero
2008-02-14 1:58 ` Glenn Morris
2008-02-14 1:59 ` Juanma Barranquero
2008-02-14 2:08 ` Glenn Morris
2008-02-14 2:00 ` Bastien
2008-02-14 2:10 ` Glenn Morris
2008-02-14 1:58 ` Bastien
2008-02-14 8:55 ` Justus-bulk
2008-02-14 15:01 ` Bastien
2008-02-14 14:21 ` Simon Josefsson
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=x8tk5l9matm.fsf@tool.montefiore.ulg.ac.be \
--to=justus-bulk@piater.name \
--cc=emacs-devel@gnu.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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.