diff options
| author | Michael Albinus | 2013-06-19 08:24:12 +0200 |
|---|---|---|
| committer | Michael Albinus | 2013-06-19 08:24:12 +0200 |
| commit | e59dfb0ecdd4dde493de284d092be55136c58501 (patch) | |
| tree | 208d9e7a8d6e9fcaa70376831fbc95e28ff6f604 | |
| parent | 178ba3e6f51c48ab196e44f82fc7abb3c7cd3d46 (diff) | |
| download | emacs-e59dfb0ecdd4dde493de284d092be55136c58501.tar.gz emacs-e59dfb0ecdd4dde493de284d092be55136c58501.zip | |
* net/secrets.el (secrets-struct-secret-content-type): Replace
check of introspection data by a test call of "CreateItem". Some
servers do not offer introspection.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/net/secrets.el | 41 |
2 files changed, 41 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8508ef44b34..2e5ca2019ce 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-06-19 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * net/secrets.el (secrets-struct-secret-content-type): Replace | ||
| 4 | check of introspection data by a test call of "CreateItem". Some | ||
| 5 | servers do not offer introspection. | ||
| 6 | |||
| 1 | 2013-06-19 Stefan Monnier <monnier@iro.umontreal.ca> | 7 | 2013-06-19 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 8 | ||
| 3 | * electric.el (electric-pair-mode): Improve interaction with | 9 | * electric.el (electric-pair-mode): Improve interaction with |
diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el index 1951b195886..b4e51348dde 100644 --- a/lisp/net/secrets.el +++ b/lisp/net/secrets.el | |||
| @@ -310,13 +310,42 @@ It returns t if not." | |||
| 310 | (defconst secrets-interface-item-type-generic "org.freedesktop.Secret.Generic" | 310 | (defconst secrets-interface-item-type-generic "org.freedesktop.Secret.Generic" |
| 311 | "The default item type we are using.") | 311 | "The default item type we are using.") |
| 312 | 312 | ||
| 313 | ;; We cannot use introspection, because some servers, like | ||
| 314 | ;; mate-keyring-daemon, don't provide relevant data. Once the dust | ||
| 315 | ;; has settled, we shall assume the new interface, and get rid of the test. | ||
| 313 | (defconst secrets-struct-secret-content-type | 316 | (defconst secrets-struct-secret-content-type |
| 314 | (when (string-equal | 317 | (ignore-errors |
| 315 | (dbus-introspect-get-signature | 318 | (let ((content-type "text/plain") |
| 316 | :session secrets-service secrets-path secrets-interface-service | 319 | (path (cadr |
| 317 | "GetSecrets" "out") | 320 | (dbus-call-method |
| 318 | "a{o(oayays)}") | 321 | :session secrets-service secrets-path |
| 319 | '("text/plain")) | 322 | secrets-interface-service |
| 323 | "OpenSession" "plain" '(:variant "")))) | ||
| 324 | result) | ||
| 325 | ;; Create a dummy item. | ||
| 326 | (setq result | ||
| 327 | (dbus-call-method | ||
| 328 | :session secrets-service secrets-session-collection-path | ||
| 329 | secrets-interface-collection "CreateItem" | ||
| 330 | ;; Properties. | ||
| 331 | `(:array | ||
| 332 | (:dict-entry ,(concat secrets-interface-item ".Label") | ||
| 333 | (:variant "dummy")) | ||
| 334 | (:dict-entry ,(concat secrets-interface-item ".Type") | ||
| 335 | (:variant ,secrets-interface-item-type-generic))) | ||
| 336 | ;; Secret. | ||
| 337 | `(:struct :object-path ,path | ||
| 338 | (:array :signature "y") | ||
| 339 | ,(dbus-string-to-byte-array " ") | ||
| 340 | :string ,content-type) | ||
| 341 | ;; Don't replace. | ||
| 342 | nil)) | ||
| 343 | ;; Remove it. | ||
| 344 | (dbus-call-method | ||
| 345 | :session secrets-service (car result) | ||
| 346 | secrets-interface-item "Delete") | ||
| 347 | ;; Result. | ||
| 348 | `(,content-type))) | ||
| 320 | "The content_type of a secret struct. | 349 | "The content_type of a secret struct. |
| 321 | It must be wrapped as list, because we add it via `append'. This | 350 | It must be wrapped as list, because we add it via `append'. This |
| 322 | is an interface introduced in 2011.") | 351 | is an interface introduced in 2011.") |