diff options
| author | Miles Bader | 2008-05-10 05:34:55 +0000 |
|---|---|---|
| committer | Miles Bader | 2008-05-10 05:34:55 +0000 |
| commit | e952b7113684d3097c074df8d78111af489268e1 (patch) | |
| tree | c5d6196a0253050144c754c0af43e2cab40ca125 | |
| parent | 8234f5be56ab0ee66e2035cbe9a0e0bbbc8a48ac (diff) | |
| download | emacs-e952b7113684d3097c074df8d78111af489268e1.tar.gz emacs-e952b7113684d3097c074df8d78111af489268e1.zip | |
Merge from gnus--devo--0
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-1153
| -rw-r--r-- | lisp/gnus/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/gnus/auth-source.el | 19 | ||||
| -rw-r--r-- | lisp/gnus/nnimap.el | 39 | ||||
| -rw-r--r-- | lisp/gnus/nntp.el | 14 |
4 files changed, 66 insertions, 18 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 7de606761c7..7ce34cd043a 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2008-05-09 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * nntp.el: Autoload `auth-source-user-or-password'. | ||
| 4 | (nntp-send-authinfo): Use it. | ||
| 5 | |||
| 6 | * nnimap.el: Autoload `auth-source-user-or-password'. | ||
| 7 | (nnimap-open-connection): Use it. | ||
| 8 | |||
| 9 | * auth-source.el: Added docs on using with url-auth. Import gnus-util | ||
| 10 | for the gnus-message function. | ||
| 11 | (auth-source-user-or-password): Use it. | ||
| 12 | |||
| 1 | 2008-05-08 Stefan Monnier <monnier@iro.umontreal.ca> | 13 | 2008-05-08 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 14 | ||
| 3 | * rfc2104.el (rfc2104-hexstring-to-bitstring): Rename it back from | 15 | * rfc2104.el (rfc2104-hexstring-to-bitstring): Rename it back from |
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 3fa4b445403..2bf2bf0ad62 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el | |||
| @@ -39,8 +39,18 @@ | |||
| 39 | 39 | ||
| 40 | ;; before you put some data in ~/.authinfo.gpg (the default place) | 40 | ;; before you put some data in ~/.authinfo.gpg (the default place) |
| 41 | 41 | ||
| 42 | ;;; For url-auth authentication (HTTP/HTTPS), you need to use: | ||
| 43 | |||
| 44 | ;;; machine yourmachine.com:80 port http login testuser password testpass | ||
| 45 | |||
| 46 | ;;; This will match any realm and authentication method (basic or | ||
| 47 | ;;; digest). If you want finer controls, explore the url-auth source | ||
| 48 | ;;; code and variables. | ||
| 49 | |||
| 42 | ;;; Code: | 50 | ;;; Code: |
| 43 | 51 | ||
| 52 | (require 'gnus-util) | ||
| 53 | |||
| 44 | (eval-when-compile (require 'cl)) | 54 | (eval-when-compile (require 'cl)) |
| 45 | (eval-when-compile (require 'netrc)) | 55 | (eval-when-compile (require 'netrc)) |
| 46 | 56 | ||
| @@ -135,6 +145,9 @@ Returns fallback choices (where PROTOCOL or HOST are nil) with FALLBACK t." | |||
| 135 | 145 | ||
| 136 | (defun auth-source-user-or-password (mode host protocol) | 146 | (defun auth-source-user-or-password (mode host protocol) |
| 137 | "Find user or password (from the string MODE) matching HOST and PROTOCOL." | 147 | "Find user or password (from the string MODE) matching HOST and PROTOCOL." |
| 148 | (gnus-message 9 | ||
| 149 | "auth-source-user-or-password: get %s for %s (%s)" | ||
| 150 | mode host protocol) | ||
| 138 | (let (found) | 151 | (let (found) |
| 139 | (dolist (choice (auth-source-pick host protocol)) | 152 | (dolist (choice (auth-source-pick host protocol)) |
| 140 | (setq found (netrc-machine-user-or-password | 153 | (setq found (netrc-machine-user-or-password |
| @@ -144,6 +157,12 @@ Returns fallback choices (where PROTOCOL or HOST are nil) with FALLBACK t." | |||
| 144 | (list (format "%s" protocol)) | 157 | (list (format "%s" protocol)) |
| 145 | (auth-source-protocol-defaults protocol))) | 158 | (auth-source-protocol-defaults protocol))) |
| 146 | (when found | 159 | (when found |
| 160 | (gnus-message 9 | ||
| 161 | "auth-source-user-or-password: found %s=%s for %s (%s)" | ||
| 162 | mode | ||
| 163 | ;; don't show the password | ||
| 164 | (if (equal mode "password") "SECRET" found) | ||
| 165 | host protocol) | ||
| 147 | (return found))))) | 166 | (return found))))) |
| 148 | 167 | ||
| 149 | (defun auth-source-protocol-defaults (protocol) | 168 | (defun auth-source-protocol-defaults (protocol) |
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index d6b414fdabe..11396fcec78 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el | |||
| @@ -71,6 +71,9 @@ | |||
| 71 | 71 | ||
| 72 | (eval-when-compile (require 'cl)) | 72 | (eval-when-compile (require 'cl)) |
| 73 | 73 | ||
| 74 | (eval-and-compile | ||
| 75 | (autoload 'auth-source-user-or-password "auth-source")) | ||
| 76 | |||
| 74 | (nnoo-declare nnimap) | 77 | (nnoo-declare nnimap) |
| 75 | 78 | ||
| 76 | (defconst nnimap-version "nnimap 1.0") | 79 | (defconst nnimap-version "nnimap 1.0") |
| @@ -796,22 +799,26 @@ If EXAMINE is non-nil the group is selected read-only." | |||
| 796 | (port (if nnimap-server-port | 799 | (port (if nnimap-server-port |
| 797 | (int-to-string nnimap-server-port) | 800 | (int-to-string nnimap-server-port) |
| 798 | "imap")) | 801 | "imap")) |
| 799 | (user (netrc-machine-user-or-password | 802 | (user (or |
| 800 | "login" | 803 | (auth-source-user-or-password "login" server port) ; this is preferred to netrc-* |
| 801 | list | 804 | (netrc-machine-user-or-password |
| 802 | (list server | 805 | "login" |
| 803 | (or nnimap-server-address | 806 | list |
| 804 | nnimap-address)) | 807 | (list server |
| 805 | (list port) | 808 | (or nnimap-server-address |
| 806 | (list "imap" "imaps" "143" "993"))) | 809 | nnimap-address)) |
| 807 | (passwd (netrc-machine-user-or-password | 810 | (list port) |
| 808 | "password" | 811 | (list "imap" "imaps" "143" "993")))) |
| 809 | list | 812 | (passwd (or |
| 810 | (list server | 813 | (auth-source-user-or-password "login" server port) ; this is preferred to netrc-* |
| 811 | (or nnimap-server-address | 814 | (netrc-machine-user-or-password |
| 812 | nnimap-address)) | 815 | "password" |
| 813 | (list port) | 816 | list |
| 814 | (list "imap" "imaps" "143" "993")))) | 817 | (list server |
| 818 | (or nnimap-server-address | ||
| 819 | nnimap-address)) | ||
| 820 | (list port) | ||
| 821 | (list "imap" "imaps" "143" "993"))))) | ||
| 815 | (if (imap-authenticate user passwd nnimap-server-buffer) | 822 | (if (imap-authenticate user passwd nnimap-server-buffer) |
| 816 | (prog2 | 823 | (prog2 |
| 817 | (setq nnimap-server-buffer-alist | 824 | (setq nnimap-server-buffer-alist |
diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el index 02b2f6f713c..ea053531b9a 100644 --- a/lisp/gnus/nntp.el +++ b/lisp/gnus/nntp.el | |||
| @@ -36,6 +36,9 @@ | |||
| 36 | 36 | ||
| 37 | (eval-when-compile (require 'cl)) | 37 | (eval-when-compile (require 'cl)) |
| 38 | 38 | ||
| 39 | (eval-and-compile | ||
| 40 | (autoload 'auth-source-user-or-password "auth-source")) | ||
| 41 | |||
| 39 | (defgroup nntp nil | 42 | (defgroup nntp nil |
| 40 | "NNTP access for Gnus." | 43 | "NNTP access for Gnus." |
| 41 | :group 'gnus) | 44 | :group 'gnus) |
| @@ -1177,8 +1180,15 @@ If SEND-IF-FORCE, only send authinfo to the server if the | |||
| 1177 | (let* ((list (netrc-parse nntp-authinfo-file)) | 1180 | (let* ((list (netrc-parse nntp-authinfo-file)) |
| 1178 | (alist (netrc-machine list nntp-address "nntp")) | 1181 | (alist (netrc-machine list nntp-address "nntp")) |
| 1179 | (force (or (netrc-get alist "force") nntp-authinfo-force)) | 1182 | (force (or (netrc-get alist "force") nntp-authinfo-force)) |
| 1180 | (user (or (netrc-get alist "login") nntp-authinfo-user)) | 1183 | (user (or |
| 1181 | (passwd (netrc-get alist "password"))) | 1184 | ;; this is preferred to netrc-* |
| 1185 | (auth-source-user-or-password "login" nntp-address "nntp") | ||
| 1186 | (netrc-get alist "login") | ||
| 1187 | nntp-authinfo-user)) | ||
| 1188 | (passwd (or | ||
| 1189 | ;; this is preferred to netrc-* | ||
| 1190 | (auth-source-user-or-password "password" nntp-address "nntp") | ||
| 1191 | (netrc-get alist "password")))) | ||
| 1182 | (when (or (not send-if-force) | 1192 | (when (or (not send-if-force) |
| 1183 | force) | 1193 | force) |
| 1184 | (unless user | 1194 | (unless user |