bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#20449: secrets-search-items is broken


From: Krzysztof Jurewicz
Subject: bug#20449: secrets-search-items is broken
Date: Tue, 28 Apr 2015 16:16:30 +0200

When one wants to store smtpmail passwords in GNOME keyring, he cannot
retrieve them because secrets-search-items raises an error. A patch
below.

>From dc4c463194d6a944057de1254f59440a65558e37 Mon Sep 17 00:00:00 2001
From: Krzysztof Jurewicz <krzysztof.jurewicz@gmail.com>
Date: Tue, 28 Apr 2015 13:54:48 +0200
Subject: [PATCH] * lisp/net/secrets.el (secrets-search-items):
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix DBUS query result parsing.  The function assumed that return value
of the SearchItems method called on a collection is a list of two
lists, however this is true only when no collection is specified:
http://standards.freedesktop.org/secret-service/re01.html#org.freedesktop.Secret.Service.SearchItems
.  If a collection is present, a direct list is returned:
http://standards.freedesktop.org/secret-service/re02.html#org.freedesktop.Secret.Collection.SearchItems
.  Therefore the squashing performed in secrets-search-items has been
unnecessary, causing an error.

GNOME had used to incorrectly return a list of two lists in both
cases, but this was already fixed:
https://bugzilla.gnome.org/show_bug.cgi?id=695115 .

Also fix an incorrect information in the secrets-search-items’
docstring.

Copyright-paperwork-exempt: yes
---
 lisp/net/secrets.el | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el
index 6f4e173..1a827b1 100644
--- a/lisp/net/secrets.el
+++ b/lisp/net/secrets.el
@@ -601,7 +601,7 @@ starting with a colon.  Example:
   \(secrets-create-item \"Tramp collection\" \"item\" \"geheim\"
    :method \"sudo\" :user \"joe\" :host \"remote-host\"\)

-The object paths of the found items are returned as list."
+The object labels of the found items are returned as list."
   (let ((collection-path (secrets-unlock-collection collection))
        result props)
     (unless (secrets-empty-path collection-path)
@@ -618,8 +618,7 @@ The object paths of the found items are returned as list."
                           (cadr attributes))
                     'append)
              attributes (cddr attributes)))
-      ;; Search.  The result is a list of two lists, the object paths
-      ;; of the unlocked and the locked items.
+      ;; Search.  The result is a list of object paths.
       (setq result
            (dbus-call-method
             :session secrets-service collection-path
@@ -630,7 +629,7 @@ The object paths of the found items are returned as list."
       ;; Return the found items.
       (mapcar
        (lambda (item-path) (secrets-get-item-property item-path "Label"))
-       (append (car result) (cadr result))))))
+       result))))

 (defun secrets-create-item (collection item password &rest attributes)
   "Create a new item in COLLECTION with label ITEM and password PASSWORD.
--
2.3.6





reply via email to

[Prev in Thread] Current Thread [Next in Thread]