diff options
| author | Michael Albinus | 2013-06-13 12:12:34 +0200 |
|---|---|---|
| committer | Michael Albinus | 2013-06-13 12:12:34 +0200 |
| commit | 9abefce4368c03aa693bc082890e5f70bd9dab1d (patch) | |
| tree | 46850767cc2776a2101af720294b44dcdd295814 | |
| parent | bb102690defe51c3ac9c1a89298a7407da572ad3 (diff) | |
| download | emacs-9abefce4368c03aa693bc082890e5f70bd9dab1d.tar.gz emacs-9abefce4368c03aa693bc082890e5f70bd9dab1d.zip | |
Implement changes in Secret Service API. Make it backward compatible.
* net/secrets.el (secrets-struct-secret-content-type): New defonst.
(secrets-create-item): Use it. Prefix properties with interface.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/net/secrets.el | 57 |
2 files changed, 43 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b19601a7b52..2d9fd3f28b4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-06-13 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | Implement changes in Secret Service API. Make it backward compatible. | ||
| 4 | * net/secrets.el (secrets-struct-secret-content-type): New defonst. | ||
| 5 | (secrets-create-item): Use it. Prefix properties with interface. | ||
| 6 | |||
| 1 | 2013-06-13 Michael Hoffman <9qobl2n02@sneakemail.com> (tiny change) | 7 | 2013-06-13 Michael Hoffman <9qobl2n02@sneakemail.com> (tiny change) |
| 2 | 8 | ||
| 3 | * term.el (term-suppress-hard-newline): New option. (Bug#12017) | 9 | * term.el (term-suppress-hard-newline): New option. (Bug#12017) |
diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el index 9555cb41cfe..1951b195886 100644 --- a/lisp/net/secrets.el +++ b/lisp/net/secrets.el | |||
| @@ -208,9 +208,9 @@ It returns t if not." | |||
| 208 | ;; <arg name="Prompt" type="o" direction="out"/> | 208 | ;; <arg name="Prompt" type="o" direction="out"/> |
| 209 | ;; </method> | 209 | ;; </method> |
| 210 | ;; <method name="GetSecrets"> | 210 | ;; <method name="GetSecrets"> |
| 211 | ;; <arg name="items" type="ao" direction="in"/> | 211 | ;; <arg name="items" type="ao" direction="in"/> |
| 212 | ;; <arg name="session" type="o" direction="in"/> | 212 | ;; <arg name="session" type="o" direction="in"/> |
| 213 | ;; <arg name="secrets" type="a{o(oayay)}" direction="out"/> | 213 | ;; <arg name="secrets" type="a{o(oayays)}" direction="out"/> |
| 214 | ;; </method> | 214 | ;; </method> |
| 215 | ;; <method name="ReadAlias"> | 215 | ;; <method name="ReadAlias"> |
| 216 | ;; <arg name="name" type="s" direction="in"/> | 216 | ;; <arg name="name" type="s" direction="in"/> |
| @@ -234,7 +234,7 @@ It returns t if not." | |||
| 234 | ;; <interface name="org.freedesktop.Secret.Collection"> | 234 | ;; <interface name="org.freedesktop.Secret.Collection"> |
| 235 | ;; <property name="Items" type="ao" access="read"/> | 235 | ;; <property name="Items" type="ao" access="read"/> |
| 236 | ;; <property name="Label" type="s" access="readwrite"/> | 236 | ;; <property name="Label" type="s" access="readwrite"/> |
| 237 | ;; <property name="Locked" type="s" access="read"/> | 237 | ;; <property name="Locked" type="b" access="read"/> |
| 238 | ;; <property name="Created" type="t" access="read"/> | 238 | ;; <property name="Created" type="t" access="read"/> |
| 239 | ;; <property name="Modified" type="t" access="read"/> | 239 | ;; <property name="Modified" type="t" access="read"/> |
| 240 | ;; <method name="Delete"> | 240 | ;; <method name="Delete"> |
| @@ -245,11 +245,11 @@ It returns t if not." | |||
| 245 | ;; <arg name="results" type="ao" direction="out"/> | 245 | ;; <arg name="results" type="ao" direction="out"/> |
| 246 | ;; </method> | 246 | ;; </method> |
| 247 | ;; <method name="CreateItem"> | 247 | ;; <method name="CreateItem"> |
| 248 | ;; <arg name="props" type="a{sv}" direction="in"/> | 248 | ;; <arg name="props" type="a{sv}" direction="in"/> |
| 249 | ;; <arg name="secret" type="(oayay)" direction="in"/> | 249 | ;; <arg name="secret" type="(oayays)" direction="in"/> |
| 250 | ;; <arg name="replace" type="b" direction="in"/> | 250 | ;; <arg name="replace" type="b" direction="in"/> |
| 251 | ;; <arg name="item" type="o" direction="out"/> | 251 | ;; <arg name="item" type="o" direction="out"/> |
| 252 | ;; <arg name="prompt" type="o" direction="out"/> | 252 | ;; <arg name="prompt" type="o" direction="out"/> |
| 253 | ;; </method> | 253 | ;; </method> |
| 254 | ;; <signal name="ItemCreated"> | 254 | ;; <signal name="ItemCreated"> |
| 255 | ;; <arg name="item" type="o"/> | 255 | ;; <arg name="item" type="o"/> |
| @@ -293,11 +293,11 @@ It returns t if not." | |||
| 293 | ;; <arg name="prompt" type="o" direction="out"/> | 293 | ;; <arg name="prompt" type="o" direction="out"/> |
| 294 | ;; </method> | 294 | ;; </method> |
| 295 | ;; <method name="GetSecret"> | 295 | ;; <method name="GetSecret"> |
| 296 | ;; <arg name="session" type="o" direction="in"/> | 296 | ;; <arg name="session" type="o" direction="in"/> |
| 297 | ;; <arg name="secret" type="(oayay)" direction="out"/> | 297 | ;; <arg name="secret" type="(oayays)" direction="out"/> |
| 298 | ;; </method> | 298 | ;; </method> |
| 299 | ;; <method name="SetSecret"> | 299 | ;; <method name="SetSecret"> |
| 300 | ;; <arg name="secret" type="(oayay)" direction="in"/> | 300 | ;; <arg name="secret" type="(oayays)" direction="in"/> |
| 301 | ;; </method> | 301 | ;; </method> |
| 302 | ;; </interface> | 302 | ;; </interface> |
| 303 | ;; | 303 | ;; |
| @@ -305,10 +305,22 @@ It returns t if not." | |||
| 305 | ;; OBJECT PATH session | 305 | ;; OBJECT PATH session |
| 306 | ;; ARRAY BYTE parameters | 306 | ;; ARRAY BYTE parameters |
| 307 | ;; ARRAY BYTE value | 307 | ;; ARRAY BYTE value |
| 308 | ;; STRING content_type ;; Added 2011/2/9 | ||
| 308 | 309 | ||
| 309 | (defconst secrets-interface-item-type-generic "org.freedesktop.Secret.Generic" | 310 | (defconst secrets-interface-item-type-generic "org.freedesktop.Secret.Generic" |
| 310 | "The default item type we are using.") | 311 | "The default item type we are using.") |
| 311 | 312 | ||
| 313 | (defconst secrets-struct-secret-content-type | ||
| 314 | (when (string-equal | ||
| 315 | (dbus-introspect-get-signature | ||
| 316 | :session secrets-service secrets-path secrets-interface-service | ||
| 317 | "GetSecrets" "out") | ||
| 318 | "a{o(oayays)}") | ||
| 319 | '("text/plain")) | ||
| 320 | "The content_type of a secret struct. | ||
| 321 | It must be wrapped as list, because we add it via `append'. This | ||
| 322 | is an interface introduced in 2011.") | ||
| 323 | |||
| 312 | (defconst secrets-interface-session "org.freedesktop.Secret.Session" | 324 | (defconst secrets-interface-session "org.freedesktop.Secret.Session" |
| 313 | "A session tracks state between the service and a client application.") | 325 | "A session tracks state between the service and a client application.") |
| 314 | 326 | ||
| @@ -616,16 +628,21 @@ The object path of the created item is returned." | |||
| 616 | ;; Properties. | 628 | ;; Properties. |
| 617 | (append | 629 | (append |
| 618 | `(:array | 630 | `(:array |
| 619 | (:dict-entry "Label" (:variant ,item)) | 631 | (:dict-entry ,(concat secrets-interface-item ".Label") |
| 620 | (:dict-entry | 632 | (:variant ,item)) |
| 621 | "Type" (:variant ,secrets-interface-item-type-generic))) | 633 | (:dict-entry ,(concat secrets-interface-item ".Type") |
| 634 | (:variant ,secrets-interface-item-type-generic))) | ||
| 622 | (when props | 635 | (when props |
| 623 | `((:dict-entry | 636 | `((:dict-entry ,(concat secrets-interface-item ".Attributes") |
| 624 | "Attributes" (:variant ,(append '(:array) props)))))) | 637 | (:variant ,(append '(:array) props)))))) |
| 625 | ;; Secret. | 638 | ;; Secret. |
| 626 | `(:struct :object-path ,secrets-session-path | 639 | (append |
| 627 | (:array :signature "y") ;; no parameters. | 640 | `(:struct :object-path ,secrets-session-path |
| 628 | ,(dbus-string-to-byte-array password)) | 641 | (:array :signature "y") ;; No parameters. |
| 642 | ,(dbus-string-to-byte-array password)) | ||
| 643 | ;; We add the content_type. In backward compatibility | ||
| 644 | ;; mode, nil is appended, which means nothing. | ||
| 645 | secrets-struct-secret-content-type) | ||
| 629 | ;; Do not replace. Replace does not seem to work. | 646 | ;; Do not replace. Replace does not seem to work. |
| 630 | nil)) | 647 | nil)) |
| 631 | (secrets-prompt (cadr result)) | 648 | (secrets-prompt (cadr result)) |