aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeodor Zlatanov2012-01-10 22:04:51 +0000
committerKatsumi Yamaoka2012-01-10 22:04:51 +0000
commitfb7e9e0539eabe1b5135fd793cbba20d87ebc1d2 (patch)
tree73c7e2bbe140212f7b0a01e50d84da6269a31dfb
parent1e2c5d95f66eac88b52135f27a532fab8600a4ba (diff)
downloademacs-fb7e9e0539eabe1b5135fd793cbba20d87ebc1d2.tar.gz
emacs-fb7e9e0539eabe1b5135fd793cbba20d87ebc1d2.zip
nntp.el (nntp-send-authinfo): Query `auth-source-search' with the logical server name in addition to the actual machine address.
auth-source.el (auth-source-user-and-password): Add convenience wrapper to search by just host and optionally user.
-rw-r--r--lisp/gnus/ChangeLog8
-rw-r--r--lisp/gnus/auth-source.el20
-rw-r--r--lisp/gnus/nntp.el4
3 files changed, 30 insertions, 2 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 9a4d8abe3e8..c7358779818 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,11 @@
12012-01-10 Teodor Zlatanov <tzz@lifelogs.com>
2
3 * nntp.el (nntp-send-authinfo): Query `auth-source-search' with the
4 logical server name in addition to the actual machine address.
5
6 * auth-source.el (auth-source-user-and-password): Add convenience
7 wrapper to search by just host and optionally user.
8
12012-01-07 Lars Magne Ingebrigtsen <larsi@gnus.org> 92012-01-07 Lars Magne Ingebrigtsen <larsi@gnus.org>
2 10
3 * shr.el (shr-visit-file): Move point to the beginning of the buffer 11 * shr.el (shr-visit-file): Move point to the beginning of the buffer
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el
index acbc541512f..5e946372d04 100644
--- a/lisp/gnus/auth-source.el
+++ b/lisp/gnus/auth-source.el
@@ -1781,6 +1781,26 @@ MODE can be \"login\" or \"password\"."
1781 1781
1782 found)) 1782 found))
1783 1783
1784(defun auth-source-user-and-password (host &optional user)
1785 (let* ((auth-info (car
1786 (if user
1787 (auth-source-search
1788 :host host
1789 :user "yourusername"
1790 :max 1
1791 :require '(:user :secret)
1792 :create nil)
1793 (auth-source-search
1794 :host host
1795 :max 1
1796 :require '(:user :secret)
1797 :create nil))))
1798 (user (plist-get auth-info :user))
1799 (password (plist-get auth-info :secret)))
1800 (when (functionp password)
1801 (setq password (funcall password)))
1802 (list user password auth-info)))
1803
1784(provide 'auth-source) 1804(provide 'auth-source)
1785 1805
1786;;; auth-source.el ends here 1806;;; auth-source.el ends here
diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el
index db9d9e252be..c740f614356 100644
--- a/lisp/gnus/nntp.el
+++ b/lisp/gnus/nntp.el
@@ -1249,8 +1249,8 @@ If SEND-IF-FORCE, only send authinfo to the server if the
1249 (alist (netrc-machine list nntp-address "nntp")) 1249 (alist (netrc-machine list nntp-address "nntp"))
1250 (auth-info 1250 (auth-info
1251 (nth 0 (auth-source-search :max 1 1251 (nth 0 (auth-source-search :max 1
1252 ;; TODO: allow the virtual server name too 1252 :host (list nntp-address
1253 :host nntp-address 1253 (nnoo-current-server 'nntp))
1254 :port '("119" "nntp")))) 1254 :port '("119" "nntp"))))
1255 (auth-user (plist-get auth-info :user)) 1255 (auth-user (plist-get auth-info :user))
1256 (auth-force (plist-get auth-info :force)) 1256 (auth-force (plist-get auth-info :force))