From: Ted Zlatanov <tzz@lifelogs.com>
To: ding@gnus.org, Emacs developers <emacs-devel@gnu.org>
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 [thread overview]
Message-ID: <861w4bb2gg.fsf@jumptrading.com> (raw)
In-Reply-To: 867ie3mf90.fsf_-_@lifelogs.com
[-- Attachment #1: Type: text/plain, Size: 808 bytes --]
On Fri, 09 May 2008 14:47:23 -0500 Ted Zlatanov <tzz@lifelogs.com> 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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: smtpmail.auth-source.patch --]
[-- Type: text/x-diff, Size: 3443 bytes --]
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 <tzz@lifelogs.com>
+
+ * mail/smtpmail.el: Add autoload for
+ `auth-source-user-or-password'.
+ (smtpmail-try-auth-methods): Use it.
+
2008-05-09 Eric S. Raymond <esr@snark.thyrsus.com>
* 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))))
next prev parent reply other threads:[~2008-05-09 21:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <ytqp8wzovjlc.fsf@ul000173.eu.tieto.com>
[not found] ` <86hce9wmgs.fsf@lifelogs.com>
2008-05-09 19:47 ` auth-source glue in url-auth.el (was: nnrss and password handling) Ted Zlatanov
2008-05-09 21:19 ` Ted Zlatanov [this message]
2008-05-12 12:50 ` auth-source glue added to smtpmail.el Ted Zlatanov
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=861w4bb2gg.fsf@jumptrading.com \
--to=tzz@lifelogs.com \
--cc=ding@gnus.org \
--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.