aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKatsumi Yamaoka2009-07-17 10:15:54 +0000
committerKatsumi Yamaoka2009-07-17 10:15:54 +0000
commit554a69b81ce6259a58f9ad2134825c8c9d4ac1fd (patch)
treeee373ee1a0e8fbfd5efa02a83e21f3d6c66f1d19
parent0dd44f7e2cb3a6071cc1ce6e6df903df63fd8cd0 (diff)
downloademacs-554a69b81ce6259a58f9ad2134825c8c9d4ac1fd.tar.gz
emacs-554a69b81ce6259a58f9ad2134825c8c9d4ac1fd.zip
Synch with Gnus trunk:
2009-07-16 Katsumi Yamaoka <yamaoka@jpl.org> * nnrss.el (nnrss-request-article): Allow mml-to-mime to generate MIME article without making inquiry to a user for unknown encoding. * nnmaildir.el (nnmaildir--group-maxnum, nnmaildir--new-number) (nnmaildir--scan): Assume i-node and device number that file-attributes returns might be cons-cell. 2009-07-16 Teodor Zlatanov <tzz@lifelogs.com> * auth-source.el: Remove docs now in auth.texi. Don't use `gnus-message' for logging. Add new variables `auth-source-debug' and `auth-source-hide-passwords' and use them.
-rw-r--r--lisp/gnus/ChangeLog15
-rw-r--r--lisp/gnus/auth-source.el96
-rw-r--r--lisp/gnus/nnmaildir.el12
-rw-r--r--lisp/gnus/nnrss.el6
4 files changed, 80 insertions, 49 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 77298b3ad97..a4a52db32ab 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,18 @@
12009-07-16 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * nnrss.el (nnrss-request-article): Allow mml-to-mime to generate MIME
4 article without making inquiry to a user for unknown encoding.
5
6 * nnmaildir.el (nnmaildir--group-maxnum, nnmaildir--new-number)
7 (nnmaildir--scan): Assume i-node and device number that file-attributes
8 returns might be cons-cell.
9
102009-07-16 Teodor Zlatanov <tzz@lifelogs.com>
11
12 * auth-source.el: Remove docs now in auth.texi. Don't use
13 `gnus-message' for logging. Add new variables `auth-source-debug' and
14 `auth-source-hide-passwords' and use them.
15
12009-07-15 Glenn Morris <rgm@gnu.org> 162009-07-15 Glenn Morris <rgm@gnu.org>
2 17
3 * gnus-spec.el (gnus-make-format-preserve-properties): Doc fix. 18 * gnus-spec.el (gnus-make-format-preserve-properties): Doc fix.
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el
index 1bec08f076f..53b0efb79bb 100644
--- a/lisp/gnus/auth-source.el
+++ b/lisp/gnus/auth-source.el
@@ -27,33 +27,7 @@
27;; of providing 5000 options, we'll stick to simple, easy to 27;; of providing 5000 options, we'll stick to simple, easy to
28;; understand options. 28;; understand options.
29 29
30;; Easy setup: 30;; See the auth.info Info documentation for details.
31;; (require 'auth-source)
32;; (customize-variable 'auth-sources) ;; optional
33
34;; now, whatever sources you've defined for password have to be available
35
36;; if you want encrypted sources, which is strongly recommended, do
37;; (require 'epa-file)
38;; (epa-file-enable)
39;; (setq epa-file-cache-passphrase-for-symmetric-encryption t) ; VERY important
40
41;; before you put some data in ~/.authinfo.gpg (the default place)
42
43;;; For url-auth authentication (HTTP/HTTPS), you need to use:
44
45;;; machine yourmachine.com:80 port http login testuser password testpass
46
47;;; This will match any realm and authentication method (basic or
48;;; digest). If you want finer controls, explore the url-auth source
49;;; code and variables.
50
51;;; For tramp authentication, use:
52
53;;; machine yourmachine.com port scp login testuser password testpass
54
55;;; Note that the port denotes the Tramp connection method. When you
56;;; don't use a port entry, you match any Tramp method.
57 31
58;;; Code: 32;;; Code:
59 33
@@ -100,6 +74,31 @@
100 :version "23.1" ;; No Gnus 74 :version "23.1" ;; No Gnus
101 :type `boolean) 75 :type `boolean)
102 76
77(defcustom auth-source-debug nil
78 "Whether auth-source should log debug messages.
79Also see `auth-source-hide-passwords'.
80
81If the value is nil, debug messages are not logged.
82If the value is t, debug messages are logged with `message'.
83 In that case, your authentication data will be in the
84 clear (except for passwords, which are always stripped out).
85If the value is a function, debug messages are logged by calling
86 that function using the same arguments as `message'."
87 :group 'auth-source
88 :version "23.1" ;; No Gnus
89 :type `(choice
90 :tag "auth-source debugging mode"
91 (const :tag "Log using `message' to the *Messages* buffer" t)
92 (function :tag "Function that takes arguments like `message'")
93 (const :tag "Don't log anything" nil)))
94
95(defcustom auth-source-hide-passwords t
96 "Whether auth-source should hide passwords in log messages.
97Only relevant if `auth-source-debug' is not nil."
98 :group 'auth-source
99 :version "23.1" ;; No Gnus
100 :type `boolean)
101
103(defcustom auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t)) 102(defcustom auth-sources '((:source "~/.authinfo.gpg" :host t :protocol t))
104 "List of authentication sources. 103 "List of authentication sources.
105 104
@@ -137,6 +136,19 @@ Each entry is the authentication type with optional properties."
137;; (auth-source-user-or-password-imap "password" "imap.myhost.com") 136;; (auth-source-user-or-password-imap "password" "imap.myhost.com")
138;; (auth-source-protocol-defaults 'imap) 137;; (auth-source-protocol-defaults 'imap)
139 138
139;; (let ((auth-source-debug 'debug)) (auth-source-debug "hello"))
140;; (let ((auth-source-debug t)) (auth-source-debug "hello"))
141;; (let ((auth-source-debug nil)) (auth-source-debug "hello"))
142(defun auth-source-do-debug (&rest msg)
143 ;; set logger to either the function in auth-source-debug or 'message
144 ;; note that it will be 'message if auth-source-debug is nil, so
145 ;; we also check the value
146 (when auth-source-debug
147 (let ((logger (if (functionp auth-source-debug)
148 auth-source-debug
149 'message)))
150 (apply logger msg))))
151
140(defun auth-source-pick (host protocol &optional fallback) 152(defun auth-source-pick (host protocol &optional fallback)
141 "Parse `auth-sources' for HOST, and PROTOCOL matches. 153 "Parse `auth-sources' for HOST, and PROTOCOL matches.
142 154
@@ -171,21 +183,21 @@ Returns fallback choices (where PROTOCOL or HOST are nil) with FALLBACK t."
171(defun auth-source-user-or-password (mode host protocol) 183(defun auth-source-user-or-password (mode host protocol)
172 "Find MODE (string or list of strings) matching HOST and PROTOCOL. 184 "Find MODE (string or list of strings) matching HOST and PROTOCOL.
173MODE can be \"login\" or \"password\" for example." 185MODE can be \"login\" or \"password\" for example."
174 (gnus-message 9 186 (auth-source-do-debug
175 "auth-source-user-or-password: get %s for %s (%s)" 187 "auth-source-user-or-password: get %s for %s (%s)"
176 mode host protocol) 188 mode host protocol)
177 (let* ((listy (listp mode)) 189 (let* ((listy (listp mode))
178 (mode (if listy mode (list mode))) 190 (mode (if listy mode (list mode)))
179 (cname (format "%s %s:%s" mode host protocol)) 191 (cname (format "%s %s:%s" mode host protocol))
180 (found (gethash cname auth-source-cache))) 192 (found (gethash cname auth-source-cache)))
181 (if found 193 (if found
182 (progn 194 (progn
183 (gnus-message 9 195 (auth-source-do-debug
184 "auth-source-user-or-password: cached %s=%s for %s (%s)" 196 "auth-source-user-or-password: cached %s=%s for %s (%s)"
185 mode 197 mode
186 ;; don't show the password 198 ;; don't show the password
187 (if (member "password" mode) "SECRET" found) 199 (if (and (member "password" mode) auth-source-hide-passwords) "SECRET" found)
188 host protocol) 200 host protocol)
189 found) 201 found)
190 (dolist (choice (auth-source-pick host protocol)) 202 (dolist (choice (auth-source-pick host protocol))
191 (setq found (netrc-machine-user-or-password 203 (setq found (netrc-machine-user-or-password
@@ -195,12 +207,12 @@ MODE can be \"login\" or \"password\" for example."
195 (list (format "%s" protocol)) 207 (list (format "%s" protocol))
196 (auth-source-protocol-defaults protocol))) 208 (auth-source-protocol-defaults protocol)))
197 (when found 209 (when found
198 (gnus-message 9 210 (auth-source-do-debug
199 "auth-source-user-or-password: found %s=%s for %s (%s)" 211 "auth-source-user-or-password: found %s=%s for %s (%s)"
200 mode 212 mode
201 ;; don't show the password 213 ;; don't show the password
202 (if (member "password" mode) "SECRET" found) 214 (if (and (member "password" mode) auth-source-hide-passwords) "SECRET" found)
203 host protocol) 215 host protocol)
204 (setq found (if listy found (car-safe found))) 216 (setq found (if listy found (car-safe found)))
205 (when auth-source-do-cache 217 (when auth-source-do-cache
206 (puthash cname found auth-source-cache))) 218 (puthash cname found auth-source-cache)))
diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el
index 65f93f8e06d..628b4c5d2a2 100644
--- a/lisp/gnus/nnmaildir.el
+++ b/lisp/gnus/nnmaildir.el
@@ -270,8 +270,8 @@ by nnmaildir-request-article.")
270 (setq attr (file-attributes 270 (setq attr (file-attributes
271 (concat dir (number-to-string number-linked)))) 271 (concat dir (number-to-string number-linked))))
272 (or attr (throw 'return (1- number-linked))) 272 (or attr (throw 'return (1- number-linked)))
273 (if (/= ino-opened (nth 10 attr)) 273 (unless (equal ino-opened (nth 10 attr))
274 (setq number-opened number-linked)))))) 274 (setq number-opened number-linked))))))
275 275
276;; Make the given server, if non-nil, be the current server. Then make the 276;; Make the given server, if non-nil, be the current server. Then make the
277;; given group, if non-nil, be the current group of the current server. Then 277;; given group, if non-nil, be the current group of the current server. Then
@@ -361,9 +361,9 @@ by nnmaildir-request-article.")
361 number-open number-link)) 361 number-open number-link))
362 ((nnmaildir--eexist-p err) 362 ((nnmaildir--eexist-p err)
363 (let ((attr (file-attributes path-link))) 363 (let ((attr (file-attributes path-link)))
364 (if (/= (nth 10 attr) ino-open) 364 (unless (equal (nth 10 attr) ino-open)
365 (setq number-open number-link 365 (setq number-open number-link
366 number-link 0)))) 366 number-link 0))))
367 (t (signal (car err) (cdr err))))))))) 367 (t (signal (car err) (cdr err)))))))))
368 368
369(defun nnmaildir--update-nov (server group article) 369(defun nnmaildir--update-nov (server group article)
@@ -744,7 +744,7 @@ by nnmaildir-request-article.")
744 ls (or (nnmaildir--param pgname 'directory-files) srv-ls)) 744 ls (or (nnmaildir--param pgname 'directory-files) srv-ls))
745 (unless read-only 745 (unless read-only
746 (setq x (nth 11 (file-attributes tdir))) 746 (setq x (nth 11 (file-attributes tdir)))
747 (unless (and (= x (nth 11 nattr)) (= x (nth 11 cattr))) 747 (unless (and (equal x (nth 11 nattr)) (equal x (nth 11 cattr)))
748 (setf (nnmaildir--srv-error nnmaildir--cur-server) 748 (setf (nnmaildir--srv-error nnmaildir--cur-server)
749 (concat "Maildir spans filesystems: " absdir)) 749 (concat "Maildir spans filesystems: " absdir))
750 (throw 'return nil)) 750 (throw 'return nil))
diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el
index 051723d9d94..cf59c81a796 100644
--- a/lisp/gnus/nnrss.el
+++ b/lisp/gnus/nnrss.el
@@ -310,7 +310,11 @@ used to render text. If it is nil, text will simply be folded.")
310 "<#/part>\n" 310 "<#/part>\n"
311 "<#/multipart>\n")) 311 "<#/multipart>\n"))
312 (condition-case nil 312 (condition-case nil
313 (mml-to-mime) 313 ;; Allow `mml-to-mime' to generate MIME article without
314 ;; making inquiry to a user for unknown encoding.
315 (let ((mml-confirmation-set
316 (cons 'unknown-encoding mml-confirmation-set)))
317 (mml-to-mime))
314 (error 318 (error
315 (erase-buffer) 319 (erase-buffer)
316 (insert header 320 (insert header