Fix DBUS query result parsing for secrets-search-items

* lisp/net/secrets.el (secrets-search-items): 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.  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.
(Bug#20449)

Copyright-paperwork-exempt: yes
This commit is contained in:
Krzysztof Jurewicz 2015-04-29 11:18:08 +02:00 committed by Michael Albinus
parent 4594f894e6
commit 7fbdb57f80

View file

@ -598,10 +598,9 @@ If successful, return the object path of the collection."
ATTRIBUTES are key-value pairs. The keys are keyword symbols,
starting with a colon. Example:
\(secrets-create-item \"Tramp collection\" \"item\" \"geheim\"
:method \"sudo\" :user \"joe\" :host \"remote-host\"\)
\(secrets-search-items \"Tramp collection\" :user \"joe\")
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 +617,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 +628,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.