From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/76418 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.gnus.general Subject: Re: tzz-auth-source-rewrite branch Date: Sun, 06 Feb 2011 19:38:45 +0100 Message-ID: <87bp2p3t56.fsf@gmx.de> References: <87ei7nivte.fsf@lifelogs.com> <87zkq9tdi7.fsf_-_@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1297017572 7143 80.91.229.12 (6 Feb 2011 18:39:32 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 6 Feb 2011 18:39:32 +0000 (UTC) Cc: ding@gnus.org To: Ted Zlatanov Original-X-From: ding-owner+M24766@lists.math.uh.edu Sun Feb 06 19:39:28 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Pm9WA-0001Nq-Ko for ding-account@gmane.org; Sun, 06 Feb 2011 19:39:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1Pm9Vk-0007yK-05; Sun, 06 Feb 2011 12:39:00 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1Pm9Vg-0007y4-SQ for ding@lists.math.uh.edu; Sun, 06 Feb 2011 12:38:56 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1Pm9Ve-0004pF-I5 for ding@lists.math.uh.edu; Sun, 06 Feb 2011 12:38:56 -0600 Original-Received: from mailout-de.gmx.net ([213.165.64.22]) by quimby.gnus.org with smtp (Exim 4.72) (envelope-from ) id 1Pm9Vd-00077g-4Y for ding@gnus.org; Sun, 06 Feb 2011 19:38:53 +0100 Original-Received: (qmail invoked by alias); 06 Feb 2011 18:38:47 -0000 Original-Received: from p57BBD44E.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.212.78] by mail.gmx.net (mp060) with SMTP; 06 Feb 2011 19:38:47 +0100 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1+J63BqQn+JX9tMnIXaZ/6c08zStLt0ClHRwCCwdh rUQwapbcC0Vbe7 In-Reply-To: <87zkq9tdi7.fsf_-_@lifelogs.com> (Ted Zlatanov's message of "Sun, 06 Feb 2011 08:59:44 -0600") User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) X-Y-GMX-Trusted: 0 X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:76418 Archived-At: --=-=-= Content-Type: text/plain Ted Zlatanov writes: > I added Secrets API support (search only, no create or delete) and > `auth-source-user-or-password' compatibility, plus I rebased the > branch. I think the Secrets API should use the :max parameter if > possible so we don't get too many results at the top level. Also it > seems quite slow to get the results one by one so maybe we can optimize > `secrets-search-items'. `secrets-search-items' returns already a list of results. It is slow to get all attributes and secret strings of the items sequentially; unfortunately there is no D-Bus method to get them in a bunch (for several items at once). I've changed `auth-source-secrets-search' such a way that it does not call `secrets-get-secret', this call is moved to the returned function. This should reduce the number of D-Bus calls in `auth-source-secrets-search'. > Finally, Google Chrome stores passwords in there but with a different > scheme. I wonder if it's useful to add specific support for mapping > those to the auth-source tokens (host, protocol, user) or if I should > put that special code in url.el only. This is a disadvantage of the Secret Service API (IMO): it defines access methods for the storage, but it does not define default keys/attributes. Every application is free to use its own attributes. For reuse of existing, we must either do some assumptions, or we must inspect which attributes are already used, and apply them. > The `auth-source-user-or-password' wrapper tries to create an entry > currently, which is not OK. So it's not ready for use. When I think > it's OK, I'll update the manual and merge the branch back into the > master branch. I haven't tested this function (yet). My patch is enclosed. > Ted Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d7cc274..f7f4803 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2011-02-06 Michael Albinus + + * auth-source.el (top): Require 'eieio unconditionally. Autoload + `secrets-get-attributes' instead of `secrets-get-attribute'. + (auth-source-secrets-search): Limit search when `max' is greater than + number of results. The function returned calls `secrets-get-secret', + in order to improve performance of the search function. + 2011-02-06 Julien Danjou * message.el (message-setup-1): Handle message-generate-headers-first diff --git a/lisp/auth-source.el b/lisp/auth-source.el index f7b5591..e959102 100644 --- a/lisp/auth-source.el +++ b/lisp/auth-source.el @@ -43,12 +43,12 @@ (require 'netrc) (require 'assoc) (eval-when-compile (require 'cl)) -(eval-when-compile (require 'eieio)) +(require 'eieio) (autoload 'secrets-create-item "secrets") (autoload 'secrets-delete-item "secrets") (autoload 'secrets-get-alias "secrets") -(autoload 'secrets-get-attribute "secrets") +(autoload 'secrets-get-attributes "secrets") (autoload 'secrets-get-secret "secrets") (autoload 'secrets-list-collections "secrets") (autoload 'secrets-search-items "secrets") @@ -305,8 +305,8 @@ If the value is not a list, symmetric encryption will be used." ((and (not (null (plist-get entry :source))) ; the source must not be nil (listp (plist-get entry :source)) ; and it must be a list - (require 'secrets nil t) ; and we must load the Secrets API - secrets-enabled) ; and that API must be enabled + (require 'secrets nil t) ; and we must load the Secrets API + secrets-enabled) ; and that API must be enabled ;; the source is either the :secrets key in ENTRY or ;; if that's missing or nil, it's "session" @@ -861,6 +861,7 @@ See `auth-source-search' for details on SPEC." ;;; (let ((auth-sources '(default))) (auth-source-search :max 1 :create t)) ;;; (let ((auth-sources '(default))) (auth-source-search :max 1 :delete t)) ;;; (let ((auth-sources '(default))) (auth-source-search :max 1)) +;;; (let ((auth-sources '(default))) (auth-source-search)) ;;; (let ((auth-sources '("secrets:login"))) (auth-source-search :max 1)) (defun* auth-source-secrets-search (&rest @@ -911,15 +912,16 @@ TODO: Example." (not (string-match label item))) collect item)) ;; TODO: respect max in `secrets-search-items', not after the fact - (items (subseq items 0 max)) + (items (subseq items 0 (min (length items) max))) ;; convert the item name to a full plist (items (mapcar (lambda (item) (nconc ;; make an entry for the secret (password) element (list :secret - (lexical-let ((v (secrets-get-secret coll item))) - (lambda () v))) + (lexical-let ((coll coll) + (item item)) + (lambda () (secrets-get-secret coll item)))) ;; rewrite the entry from ((k1 v1) (k2 v2)) to plist (mapcan (lambda (entry) (list (car entry) (cdr entry))) --=-=-=--