comparison lisp/gnus/auth-source.el @ 110586:867180d035b0

auth-source.el (auth-source-create): Query the user for whether to store the credentials. auth-source.el: Require netrc. nnml.el (nnml-open-nov): Don't return dead buffers. gnus-picon.el (gnus-picon-xbm): Removed obsolete face. gnus-picon.el (gnus-picon-insert-glyph): Make the background white. gnus-art.el (gnus-treatment-function-alist): Insert picons after doing the header highlightling.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sun, 26 Sep 2010 13:25:35 +0000
parents 677b6dea1d61
children d2b45bb936b6
comparison
equal deleted inserted replaced
110585:677b6dea1d61 110586:867180d035b0
30 ;; See the auth.info Info documentation for details. 30 ;; See the auth.info Info documentation for details.
31 31
32 ;;; Code: 32 ;;; Code:
33 33
34 (require 'gnus-util) 34 (require 'gnus-util)
35 (require 'netrc)
35 36
36 (eval-when-compile (require 'cl)) 37 (eval-when-compile (require 'cl))
37 (autoload 'netrc-machine-user-or-password "netrc")
38 (autoload 'secrets-create-item "secrets") 38 (autoload 'secrets-create-item "secrets")
39 (autoload 'secrets-delete-item "secrets") 39 (autoload 'secrets-delete-item "secrets")
40 (autoload 'secrets-get-alias "secrets") 40 (autoload 'secrets-get-alias "secrets")
41 (autoload 'secrets-get-attribute "secrets") 41 (autoload 'secrets-get-attribute "secrets")
42 (autoload 'secrets-get-secret "secrets") 42 (autoload 'secrets-get-secret "secrets")
310 (if prot (format ":%s" prot)))) 310 (if prot (format ":%s" prot))))
311 result) 311 result)
312 (setq result 312 (setq result
313 (mapcar 313 (mapcar
314 (lambda (m) 314 (lambda (m)
315 (cond 315 (cons
316 ((equal "password" m) 316 m
317 (let ((passwd (read-passwd 317 (cond
318 (format "Password for %s on %s: " prot host)))) 318 ((equal "password" m)
319 (cond 319 (let ((passwd (read-passwd
320 ;; Secret Service API. 320 (format "Password for %s on %s: " prot host))))
321 ((consp source) 321 (cond
322 (apply 322 ;; Secret Service API.
323 'secrets-create-item 323 ((consp source)
324 (auth-get-source entry) name passwd spec)) 324 (apply
325 (t)) ;; netrc not implemented yes. 325 'secrets-create-item
326 passwd)) 326 (auth-get-source entry) name passwd spec))
327 ((equal "login" m) 327 (t)) ;; netrc not implemented yes.
328 (or user 328 passwd))
329 (read-string (format "User name for %s on %s: " prot host)))) 329 ((equal "login" m)
330 (t 330 (or user
331 "unknownuser"))) 331 (read-string (format "User name for %s on %s: " prot host))))
332 (t
333 "unknownuser"))))
332 (if (consp mode) mode (list mode)))) 334 (if (consp mode) mode (list mode))))
333 (if (consp mode) result (car result)))) 335 ;; Allow the source to save the data.
336 (cond
337 ((consp source)
338 ;; Secret Service API -- not implemented.
339 )
340 (t
341 ;; netrc interface.
342 (when (y-or-n-p (format "Do you want to save this password in %s? "
343 source))
344 (netrc-store-data source host prot
345 (or user (cdr (assoc "login" result)))
346 (cdr (assoc "password" result))))))
347 (if (consp mode)
348 (mapcar #'cdr result)
349 (cdar result))))
334 350
335 (defun auth-source-delete (entry &rest spec) 351 (defun auth-source-delete (entry &rest spec)
336 "Delete credentials according to SPEC in ENTRY." 352 "Delete credentials according to SPEC in ENTRY."
337 (let ((host (plist-get spec :host)) 353 (let ((host (plist-get spec :host))
338 (user (plist-get spec :user)) 354 (user (plist-get spec :user))