From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/66930 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel,gmane.emacs.gnus.general Subject: auth-source glue added to smtpmail.el (was: auth-source glue in url-auth.el) Date: Fri, 09 May 2008 16:19:11 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <861w4bb2gg.fsf@jumptrading.com> References: <86hce9wmgs.fsf@lifelogs.com> <867ie3mf90.fsf_-_@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1210367776 4132 80.91.229.12 (9 May 2008 21:16:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 9 May 2008 21:16:16 +0000 (UTC) To: ding@gnus.org, Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 09 23:16:51 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 1JuZxQ-0003PU-MN for ged-emacs-devel@m.gmane.org; Fri, 09 May 2008 23:16:49 +0200 Original-Received: from localhost ([127.0.0.1]:48732 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JuZwi-0004Ob-7C for ged-emacs-devel@m.gmane.org; Fri, 09 May 2008 17:16:04 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JuZwe-0004O9-0f for emacs-devel@gnu.org; Fri, 09 May 2008 17:16:00 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JuZwb-0004LS-0b for emacs-devel@gnu.org; Fri, 09 May 2008 17:15:59 -0400 Original-Received: from [199.232.76.173] (port=44495 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JuZwa-0004LO-TG for emacs-devel@gnu.org; Fri, 09 May 2008 17:15:56 -0400 Original-Received: from mail.blockstar.com ([170.224.69.95]:48561) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JuZwa-0007F7-Jm for emacs-devel@gnu.org; Fri, 09 May 2008 17:15:56 -0400 Original-Received: from tzlatanov-ubuntu-desktop.jumptrading.com (unknown [38.98.147.130]) by mail.blockstar.com (Postfix) with ESMTP id EC6407D912E; Fri, 9 May 2008 14:28:04 -0700 (PDT) X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" X-Hashcash: 1:20:080509:ding@gnus.org::eiGqeXbI0wrG7mlL:00000a/z X-Hashcash: 1:20:080509:christian.lynbech@tietoenator.com::hhqodFQil9XDBfBM:00000000000000000000000000001Qij X-Hashcash: 1:20:080509:emacs-devel@gnu.org::LU3PDnM0qMacZGSj:0000000000000000000000000000000000000000003wMK User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) 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:96902 gmane.emacs.gnus.general:66930 Archived-At: --=-=-= On Fri, 09 May 2008 14:47:23 -0500 Ted Zlatanov wrote: TZ> The [url-auth] patch will match any realm when looking for a TZ> host/login/password combination. I decided to go with a less TZ> flexible approach for simplicity; I think it's rare to need more TZ> than one realm per host and whoever does can always customize the TZ> underlying url-auth-* variables. TZ> Emacs developers, please let me know if there's any problems with the TZ> patch before I commit it into CVS. I'm being cautious because TZ> url-auth.el is used by so many other libraries indirectly. If it's OK, TZ> I'll commit it after the weekend. Similarly to the above, I've made a patch against smtpmail.el to support auth-source.el, and will commit it after the weekend unless it's bad in some way. Thanks Ted --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=smtpmail.auth-source.patch Index: ChangeLog =================================================================== RCS file: /sources/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.13703 diff -c -r1.13703 ChangeLog *** ChangeLog 9 May 2008 20:17:48 -0000 1.13703 --- ChangeLog 9 May 2008 21:11:59 -0000 *************** *** 1,3 **** --- 1,9 ---- + 2008-05-09 Teodor Zlatanov + + * mail/smtpmail.el: Add autoload for + `auth-source-user-or-password'. + (smtpmail-try-auth-methods): Use it. + 2008-05-09 Eric S. Raymond * vc.el (vc-dir), vc-hooks.el: Tweak the VC directory bindings. Index: mail/smtpmail.el =================================================================== RCS file: /sources/emacs/emacs/lisp/mail/smtpmail.el,v retrieving revision 1.103 diff -c -r1.103 smtpmail.el *** mail/smtpmail.el 6 May 2008 07:22:29 -0000 1.103 --- mail/smtpmail.el 9 May 2008 21:11:59 -0000 *************** *** 78,83 **** --- 78,86 ---- (autoload 'netrc-get "netrc") (autoload 'password-read "password-cache") + (eval-and-compile + (autoload 'auth-source-user-or-password "auth-source")) + ;;; (defgroup smtpmail nil "SMTP protocol for sending mail." *************** *** 539,555 **** (defun smtpmail-try-auth-methods (process supported-extensions host port) (let* ((mechs (cdr-safe (assoc 'auth supported-extensions))) (mech (car (smtpmail-intersection smtpmail-auth-supported mechs))) ! (cred (if (stringp smtpmail-auth-credentials) ! (let* ((netrc (netrc-parse smtpmail-auth-credentials)) ! (port-name (format "%s" (or port "smtp"))) ! (hostentry (netrc-machine netrc host port-name ! port-name))) ! (when hostentry ! (list host port ! (netrc-get hostentry "login") ! (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)))) --- 542,567 ---- (defun smtpmail-try-auth-methods (process supported-extensions host port) (let* ((mechs (cdr-safe (assoc 'auth supported-extensions))) (mech (car (smtpmail-intersection smtpmail-auth-supported mechs))) ! (auth-user (auth-source-user-or-password ! "login" host (or port "smtp"))) ! (auth-pass (auth-source-user-or-password ! "password" host (or port "smtp"))) ! (cred (if (and auth-user auth-pass) ; try user-auth-* before netrc-* ! (list host port auth-user auth-pass) ! ;; else, if auth-source didn't return them... ! (if (stringp smtpmail-auth-credentials) ! (let* ((netrc (netrc-parse smtpmail-auth-credentials)) ! (port-name (format "%s" (or port "smtp"))) ! (hostentry (netrc-machine netrc host port-name ! port-name))) ! (when hostentry ! (list host port ! (netrc-get hostentry "login") ! (netrc-get hostentry "password")))) ! ;; else, try smtpmail-find-credentials since ! ;; smtpmail-auth-credentials is not a string ! (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)))) --=-=-=--