all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#15520: 24.3; secrets.el secrets-create-item has wrong dbus arguments (fix included)
@ 2013-10-02 17:20 Nicolas Petton
  2013-10-04 10:26 ` Michael Albinus
  0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Petton @ 2013-10-02 17:20 UTC (permalink / raw
  To: 15520


In secrets.el, secrets-create-item has the wrong label property for the
created item, and the secret struct is not built correctly.

Here's a new version that fixes the issue.


(defun secrets-create-item (collection item password &rest attributes)
  "Create a new item in COLLECTION with label ITEM and password
PASSWORD.
ATTRIBUTES are key-value pairs set for the created item.  The
keys are keyword symbols, starting with a colon.  Example:

  \(secrets-create-item \"Tramp collection\" \"item\" \"geheim\"
   :method \"sudo\" :user \"joe\" :host \"remote-host\"\)

The object path of the created item is returned."
  (unless (member item (secrets-list-items collection))
    (let ((collection-path (secrets-unlock-collection collection))
	  result props)
      (unless (secrets-empty-path collection-path)
	;; Create attributes list.
	(while (consp (cdr attributes))
	  (unless (keywordp (car attributes))
	    (error 'wrong-type-argument (car attributes)))
	  (setq props (add-to-list
		       'props
		       (list :dict-entry
			     (substring (symbol-name (car attributes)) 1)
			     (cadr attributes))
		       'append)
		attributes (cddr attributes)))
	;; Create the item.
	(setq result
	      (dbus-call-method
	       :session secrets-service collection-path
	       secrets-interface-collection "CreateItem"
	       ;; Properties.
	       (append
		`(:array
		  (:dict-entry "org.freedesktop.Secret.Item.Label" (:variant ,item)))
		(when props
		  `((:dict-entry
		     "org.freedesktop.Secret.Item.Attributes" (:variant ,(append
'(:array) props))))))
	       ;; Secret.
	       `(:struct :object-path ,secrets-session-path
			 ,(dbus-string-to-byte-array "")
			 ,(dbus-string-to-byte-array password)
			 "text/plain")
	       ;; Do not replace. Replace does not seem to work.
	       nil))
	(secrets-prompt (cadr result))
	;; Return the object path.
	(car result)))))






^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#15520: 24.3; secrets.el secrets-create-item has wrong dbus arguments (fix included)
  2013-10-02 17:20 bug#15520: 24.3; secrets.el secrets-create-item has wrong dbus arguments (fix included) Nicolas Petton
@ 2013-10-04 10:26 ` Michael Albinus
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Albinus @ 2013-10-04 10:26 UTC (permalink / raw
  To: Nicolas Petton; +Cc: 15520

Nicolas Petton <petton.nicolas@gmail.com> writes:

Hi Nicolas,

> In secrets.el, secrets-create-item has the wrong label property for the
> created item, and the secret struct is not built correctly.
>
> Here's a new version that fixes the issue.

Thanks for the report.

This problem was solved back in June already. That solution ought to be
backwards compatible, because it was due to an interface change of
"org.freedesktop.Secret.Item.CreateItem".

Please check, whether
<http://bzr.savannah.gnu.org/lh/emacs/trunk/download/head:/secrets.el-20100313201810-6s62gy70hbdnhfs1-1/secrets.el>
works for you.

Best regards, Michael.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-04 10:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-02 17:20 bug#15520: 24.3; secrets.el secrets-create-item has wrong dbus arguments (fix included) Nicolas Petton
2013-10-04 10:26 ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.