diff options
| author | Teodor Zlatanov | 2011-02-16 00:00:21 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2011-02-16 00:00:21 +0000 |
| commit | ca6ddb88b58e06b872912a8941ce96dad66da54f (patch) | |
| tree | cb632bc5164cd09aef41ea654d930d406fd4feba | |
| parent | 5415d0766d91aa8ab4dcedc6f7dd0b85edc915a3 (diff) | |
| download | emacs-ca6ddb88b58e06b872912a8941ce96dad66da54f.tar.gz emacs-ca6ddb88b58e06b872912a8941ce96dad66da54f.zip | |
auth-source.el (auth-source-debug): Enable by default and don't mention the obsolete `auth-source-hide-passwords'.
(auth-source-do-warn): New function to debug unconditionally.
(auth-source-do-debug): Use it.
(auth-source-backend-parse): Use it for invalid `auth-sources' entries and for Secrets API entries when the secrets.el library is not available.
| -rw-r--r-- | lisp/gnus/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/gnus/auth-source.el | 56 |
2 files changed, 44 insertions, 22 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 71034376133..91ba9e5a359 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2011-02-15 Teodor Zlatanov <tzz@lifelogs.com> | ||
| 2 | |||
| 3 | * auth-source.el (auth-source-debug): Enable by default and don't | ||
| 4 | mention the obsolete `auth-source-hide-passwords'. | ||
| 5 | (auth-source-do-warn): New function to debug unconditionally. | ||
| 6 | (auth-source-do-debug): Use it. | ||
| 7 | (auth-source-backend-parse): Use it for invalid `auth-sources' entries | ||
| 8 | and for Secrets API entries when the secrets.el library is not | ||
| 9 | available. | ||
| 10 | |||
| 1 | 2011-02-14 Lars Ingebrigtsen <larsi@gnus.org> | 11 | 2011-02-14 Lars Ingebrigtsen <larsi@gnus.org> |
| 2 | 12 | ||
| 3 | * gnus-sum.el (gnus-propagate-marks): Default to nil. | 13 | * gnus-sum.el (gnus-propagate-marks): Default to nil. |
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 0692dbb538b..a259c5c2f0b 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el | |||
| @@ -135,14 +135,15 @@ | |||
| 135 | :version "23.2" ;; No Gnus | 135 | :version "23.2" ;; No Gnus |
| 136 | :type `boolean) | 136 | :type `boolean) |
| 137 | 137 | ||
| 138 | (defcustom auth-source-debug nil | 138 | (defcustom auth-source-debug t |
| 139 | "Whether auth-source should log debug messages. | 139 | "Whether auth-source should log debug messages. |
| 140 | Also see `auth-source-hide-passwords'. | ||
| 141 | 140 | ||
| 142 | If the value is nil, debug messages are not logged. | 141 | If the value is nil, debug messages are not logged. |
| 143 | If the value is t, debug messages are logged with `message'. | 142 | |
| 144 | In that case, your authentication data will be in the | 143 | If the value is t, debug messages are logged with `message'. In |
| 145 | clear (except for passwords, which are always stripped out). | 144 | that case, your authentication data will be in the clear (except |
| 145 | for passwords). | ||
| 146 | |||
| 146 | If the value is a function, debug messages are logged by calling | 147 | If the value is a function, debug messages are logged by calling |
| 147 | that function using the same arguments as `message'." | 148 | that function using the same arguments as `message'." |
| 148 | :group 'auth-source | 149 | :group 'auth-source |
| @@ -235,18 +236,22 @@ If the value is not a list, symmetric encryption will be used." | |||
| 235 | ;; (auth-source-user-or-password-imap "password" "imap.myhost.com") | 236 | ;; (auth-source-user-or-password-imap "password" "imap.myhost.com") |
| 236 | ;; (auth-source-protocol-defaults 'imap) | 237 | ;; (auth-source-protocol-defaults 'imap) |
| 237 | 238 | ||
| 238 | ;; (let ((auth-source-debug 'debug)) (auth-source-debug "hello")) | 239 | ;; (let ((auth-source-debug 'debug)) (auth-source-do-debug "hello")) |
| 239 | ;; (let ((auth-source-debug t)) (auth-source-debug "hello")) | 240 | ;; (let ((auth-source-debug t)) (auth-source-do-debug "hello")) |
| 240 | ;; (let ((auth-source-debug nil)) (auth-source-debug "hello")) | 241 | ;; (let ((auth-source-debug nil)) (auth-source-do-debug "hello")) |
| 241 | (defun auth-source-do-debug (&rest msg) | 242 | (defun auth-source-do-debug (&rest msg) |
| 242 | ;; set logger to either the function in auth-source-debug or 'message | ||
| 243 | ;; note that it will be 'message if auth-source-debug is nil, so | ||
| 244 | ;; we also check the value | ||
| 245 | (when auth-source-debug | 243 | (when auth-source-debug |
| 246 | (let ((logger (if (functionp auth-source-debug) | 244 | (apply 'auth-source-do-warn msg))) |
| 247 | auth-source-debug | 245 | |
| 248 | 'message))) | 246 | (defun auth-source-do-warn (&rest msg) |
| 249 | (apply logger msg)))) | 247 | (apply |
| 248 | ;; set logger to either the function in auth-source-debug or 'message | ||
| 249 | ;; note that it will be 'message if auth-source-debug is nil | ||
| 250 | (if (functionp auth-source-debug) | ||
| 251 | auth-source-debug | ||
| 252 | 'message) | ||
| 253 | msg)) | ||
| 254 | |||
| 250 | 255 | ||
| 251 | ;; (auth-source-pick nil :host "any" :protocol 'imap :user "joe") | 256 | ;; (auth-source-pick nil :host "any" :protocol 'imap :user "joe") |
| 252 | ;; (auth-source-pick t :host "any" :protocol 'imap :user "joe") | 257 | ;; (auth-source-pick t :host "any" :protocol 'imap :user "joe") |
| @@ -312,16 +317,23 @@ If the value is not a list, symmetric encryption will be used." | |||
| 312 | (setq source (or (secrets-get-alias (symbol-name source)) | 317 | (setq source (or (secrets-get-alias (symbol-name source)) |
| 313 | "Login"))) | 318 | "Login"))) |
| 314 | 319 | ||
| 315 | (auth-source-backend | 320 | (if (featurep 'secrets) |
| 316 | (format "Secrets API (%s)" source) | 321 | (auth-source-backend |
| 317 | :source source | 322 | (format "Secrets API (%s)" source) |
| 318 | :type 'secrets | 323 | :source source |
| 319 | :search-function 'auth-source-secrets-search | 324 | :type 'secrets |
| 320 | :create-function 'auth-source-secrets-create))) | 325 | :search-function 'auth-source-secrets-search |
| 326 | :create-function 'auth-source-secrets-create) | ||
| 327 | (auth-source-do-warn | ||
| 328 | "auth-source-backend-parse: no Secrets API, ignoring spec: %S" entry) | ||
| 329 | (auth-source-backend | ||
| 330 | (format "Ignored Secrets API (%s)" source) | ||
| 331 | :source "" | ||
| 332 | :type 'ignore)))) | ||
| 321 | 333 | ||
| 322 | ;; none of them | 334 | ;; none of them |
| 323 | (t | 335 | (t |
| 324 | (auth-source-do-debug | 336 | (auth-source-do-warn |
| 325 | "auth-source-backend-parse: invalid backend spec: %S" entry) | 337 | "auth-source-backend-parse: invalid backend spec: %S" entry) |
| 326 | (auth-source-backend | 338 | (auth-source-backend |
| 327 | "Empty" | 339 | "Empty" |