unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* password-cache for smtpmail.el
@ 2008-02-13 10:04 Justus-bulk
  2008-02-13 21:53 ` Bastien Guerry
  2008-02-14 14:21 ` Simon Josefsson
  0 siblings, 2 replies; 13+ messages in thread
From: Justus-bulk @ 2008-02-13 10:04 UTC (permalink / raw)
  To: emacs-devel

[-- 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)

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2008-02-14 15:01 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-13 10:04 password-cache for smtpmail.el Justus-bulk
2008-02-13 21:53 ` 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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).