From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Justus-bulk@Piater.name Newsgroups: gmane.emacs.devel Subject: password-cache for smtpmail.el Date: Wed, 13 Feb 2008 11:04:37 +0100 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1202897226 7402 80.91.229.12 (13 Feb 2008 10:07:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 13 Feb 2008 10:07:06 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 13 11:07:29 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JPEW7-0005ba-5R for ged-emacs-devel@m.gmane.org; Wed, 13 Feb 2008 11:07:03 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JPEVd-0002XA-Ft for ged-emacs-devel@m.gmane.org; Wed, 13 Feb 2008 05:06:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JPETw-0000SV-Bu for emacs-devel@gnu.org; Wed, 13 Feb 2008 05:04:48 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JPETr-0000Kc-4W for emacs-devel@gnu.org; Wed, 13 Feb 2008 05:04:44 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JPETq-0000Jx-Sy for emacs-devel@gnu.org; Wed, 13 Feb 2008 05:04:43 -0500 Original-Received: from serv108.segi.ulg.ac.be ([139.165.32.111]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JPETr-000101-0p for emacs-devel@gnu.org; Wed, 13 Feb 2008 05:04:43 -0500 Original-Received: (qmail 22114 invoked from network); 13 Feb 2008 11:04:38 +0100 Original-Received: from unknown (HELO tool.montefiore.ulg.ac.be) (u193113@[139.165.11.16]) (envelope-sender ) by serv108.segi.ulg.ac.be (qmail-ldap-1.03) with SMTP for ; 13 Feb 2008 11:04:38 +0100 User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:88938 Archived-At: --=-=-= Content-Type: text/plain 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 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=smtpmail-password-cache.diff *** /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) --=-=-=--