~ubuntu-branches/ubuntu/oneiric/dbus/oneiric-security

« back to all changes in this revision

Viewing changes to doc/dbus-specification.html

  • Committer: Bazaar Package Importer
  • Author(s): Scott James Remnant
  • Date: 2010-12-21 13:43:26 UTC
  • mfrom: (1.1.24 upstream)
  • Revision ID: james.westby@ubuntu.com-20101221134326-tphabew59n072ej1
Tags: 1.4.1-0ubuntu1
* New upstream release:
  - Fix for CVE-2010-4352: sending messages with excessively-nested
    variants can crash the bus. The existing restriction to 64-levels
    of nesting previously only applied to the static type signature;
    now it also applies to dynamic nesting using variants.
  - Various bug fixes.

* Dropped patch from 1.4.0-0ubuntu2 since it's now included upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
������������<code class="email">&lt;<a class="email" href="mailto:andersca@codefactory.se">andersca@codefactory.se</a>&gt;</code><br>
5
5
����������</p></div></div></div><div class="author"><h3 class="author"><span class="firstname">Alexander</span> <span class="surname">Larsson</span></h3><div class="affiliation"><span class="orgname">Red Hat, Inc.<br></span><div class="address"><p><br>
6
6
������������<code class="email">&lt;<a class="email" href="mailto:alexl@redhat.com">alexl@redhat.com</a>&gt;</code><br>
7
 
����������</p></div></div></div></div></div><div><p class="releaseinfo">Version 0.14</p></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#introduction">Introduction</a></span></dt><dd><dl><dt><span class="sect2"><a href="#stability">Protocol and Specification Stability</a></span></dt></dl></dd><dt><span class="sect1"><a href="#message-protocol">Message Protocol</a></span></dt><dd><dl><dt><span class="sect2"><a href="#message-protocol-signatures">Type Signatures</a></span></dt><dt><span class="sect2"><a href="#message-protocol-marshaling">Marshaling (Wire Format)</a></span></dt><dt><span class="sect2"><a href="#message-protocol-messages">Message Format</a></span></dt><dt><span class="sect2"><a href="#message-protocol-names">Valid Names</a></span></dt><dt><span class="sect2"><a href="#message-protocol-types">Message Types</a></span></dt><dt><span class="sect2"><a href="#message-protocol-handling-invalid">Invalid Protocol and Spec Extensions</a></span></dt></dl></dd><dt><span class="sect1"><a href="#auth-protocol">Authentication Protocol</a></span></dt><dd><dl><dt><span class="sect2"><a href="#auth-protocol-overview">Protocol Overview</a></span></dt><dt><span class="sect2"><a href="#auth-nul-byte">Special credentials-passing nul byte</a></span></dt><dt><span class="sect2"><a href="#auth-command-auth">AUTH command</a></span></dt><dt><span class="sect2"><a href="#auth-command-cancel">CANCEL Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-data">DATA Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-begin">BEGIN Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-rejected">REJECTED Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-ok">OK Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-error">ERROR Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-negotiate-unix-fd">NEGOTIATE_UNIX_FD Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-agree-unix-fd">AGREE_UNIX_FD Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-future">Future Extensions</a></span></dt><dt><span class="sect2"><a href="#auth-examples">Authentication examples</a></span></dt><dt><span class="sect2"><a href="#auth-states">Authentication state diagrams</a></span></dt><dt><span class="sect2"><a href="#auth-mechanisms">Authentication mechanisms</a></span></dt></dl></dd><dt><span class="sect1"><a href="#addresses">Server Addresses</a></span></dt><dt><span class="sect1"><a href="#transports">Transports</a></span></dt><dd><dl><dt><span class="sect2"><a href="#transports-unix-domain-sockets">Unix Domain Sockets</a></span></dt><dt><span class="sect2"><a href="#transports-tcp-sockets">TCP Sockets</a></span></dt><dt><span class="sect2"><a href="#transports-nonce-tcp-sockets">Nonce-secured TCP Sockets</a></span></dt></dl></dd><dt><span class="sect1"><a href="#naming-conventions">Naming Conventions</a></span></dt><dt><span class="sect1"><a href="#uuids">UUIDs</a></span></dt><dt><span class="sect1"><a href="#standard-interfaces">Standard Interfaces</a></span></dt><dd><dl><dt><span class="sect2"><a href="#standard-interfaces-peer"><code class="literal">org.freedesktop.DBus.Peer</code></a></span></dt><dt><span class="sect2"><a href="#standard-interfaces-introspectable"><code class="literal">org.freedesktop.DBus.Introspectable</code></a></span></dt><dt><span class="sect2"><a href="#standard-interfaces-properties"><code class="literal">org.freedesktop.DBus.Properties</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="#introspection-format">Introspection Data Format</a></span></dt><dt><span class="sect1"><a href="#message-bus">Message Bus Specification</a></span></dt><dd><dl><dt><span class="sect2"><a href="#message-bus-overview">Message Bus Overview</a></span></dt><dt><span class="sect2"><a href="#message-bus-names">Message Bus Names</a></span></dt><dt><span class="sect2"><a href="#message-bus-routing">Message Bus Message Routing</a></span></dt><dt><span class="sect2"><a href="#message-bus-starting-services">Message Bus Starting Services</a></span></dt><dt><span class="sect2"><a href="#message-bus-types">Well-known Message Bus Instances</a></span></dt><dt><span class="sect2"><a href="#message-bus-messages">Message Bus Messages</a></span></dt></dl></dd><dt><span class="glossary"><a href="#id426787">Glossary</a></span></dt></dl></div><div class="sect1" title="Introduction"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="introduction"></a>Introduction</h2></div></div></div><p>
 
7
����������</p></div></div></div></div></div><div><p class="releaseinfo">Version 0.15</p></div><div><div class="revhistory"><table border="1" width="100%" summary="Revision history"><tr><th align="left" valign="top" colspan="3"><b>Revision History</b></th></tr><tr><td align="left">Revision current</td><td align="left"><a class="ulink" href="http://cgit.freedesktop.org/dbus/dbus/log/doc/dbus-specification.xml" target="_top">commit log</a></td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.15</td><td align="left">3 November 2010</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.14</td><td align="left">12 May 2010</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.13</td><td align="left">23 Dezember 2009</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.12</td><td align="left">7 November, 2006</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.11</td><td align="left">6 February 2005</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.10</td><td align="left">28 January 2005</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.9</td><td align="left">7 Januar 2005</td><td align="left"></td></tr><tr><td align="left" colspan="3"></td></tr><tr><td align="left">Revision 0.8</td><td align="left">06 September 2003</td><td align="left"></td></tr><tr><td align="left" colspan="3">First released document.</td></tr></table></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="sect1"><a href="#introduction">Introduction</a></span></dt><dd><dl><dt><span class="sect2"><a href="#stability">Protocol and Specification Stability</a></span></dt></dl></dd><dt><span class="sect1"><a href="#message-protocol">Message Protocol</a></span></dt><dd><dl><dt><span class="sect2"><a href="#message-protocol-signatures">Type Signatures</a></span></dt><dt><span class="sect2"><a href="#message-protocol-marshaling">Marshaling (Wire Format)</a></span></dt><dt><span class="sect2"><a href="#message-protocol-messages">Message Format</a></span></dt><dt><span class="sect2"><a href="#message-protocol-names">Valid Names</a></span></dt><dt><span class="sect2"><a href="#message-protocol-types">Message Types</a></span></dt><dt><span class="sect2"><a href="#message-protocol-handling-invalid">Invalid Protocol and Spec Extensions</a></span></dt></dl></dd><dt><span class="sect1"><a href="#auth-protocol">Authentication Protocol</a></span></dt><dd><dl><dt><span class="sect2"><a href="#auth-protocol-overview">Protocol Overview</a></span></dt><dt><span class="sect2"><a href="#auth-nul-byte">Special credentials-passing nul byte</a></span></dt><dt><span class="sect2"><a href="#auth-command-auth">AUTH command</a></span></dt><dt><span class="sect2"><a href="#auth-command-cancel">CANCEL Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-data">DATA Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-begin">BEGIN Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-rejected">REJECTED Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-ok">OK Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-error">ERROR Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-negotiate-unix-fd">NEGOTIATE_UNIX_FD Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-agree-unix-fd">AGREE_UNIX_FD Command</a></span></dt><dt><span class="sect2"><a href="#auth-command-future">Future Extensions</a></span></dt><dt><span class="sect2"><a href="#auth-examples">Authentication examples</a></span></dt><dt><span class="sect2"><a href="#auth-states">Authentication state diagrams</a></span></dt><dt><span class="sect2"><a href="#auth-mechanisms">Authentication mechanisms</a></span></dt></dl></dd><dt><span class="sect1"><a href="#addresses">Server Addresses</a></span></dt><dt><span class="sect1"><a href="#transports">Transports</a></span></dt><dd><dl><dt><span class="sect2"><a href="#transports-unix-domain-sockets">Unix Domain Sockets</a></span></dt><dt><span class="sect2"><a href="#transports-launchd">launchd</a></span></dt><dt><span class="sect2"><a href="#transports-tcp-sockets">TCP Sockets</a></span></dt><dt><span class="sect2"><a href="#transports-nonce-tcp-sockets">Nonce-secured TCP Sockets</a></span></dt></dl></dd><dt><span class="sect1"><a href="#meta-transports">Meta Transports</a></span></dt><dd><dl><dt><span class="sect2"><a href="#meta-transports-autolaunch">Autolaunch</a></span></dt></dl></dd><dt><span class="sect1"><a href="#naming-conventions">Naming Conventions</a></span></dt><dt><span class="sect1"><a href="#uuids">UUIDs</a></span></dt><dt><span class="sect1"><a href="#standard-interfaces">Standard Interfaces</a></span></dt><dd><dl><dt><span class="sect2"><a href="#standard-interfaces-peer"><code class="literal">org.freedesktop.DBus.Peer</code></a></span></dt><dt><span class="sect2"><a href="#standard-interfaces-introspectable"><code class="literal">org.freedesktop.DBus.Introspectable</code></a></span></dt><dt><span class="sect2"><a href="#standard-interfaces-properties"><code class="literal">org.freedesktop.DBus.Properties</code></a></span></dt></dl></dd><dt><span class="sect1"><a href="#introspection-format">Introspection Data Format</a></span></dt><dt><span class="sect1"><a href="#message-bus">Message Bus Specification</a></span></dt><dd><dl><dt><span class="sect2"><a href="#message-bus-overview">Message Bus Overview</a></span></dt><dt><span class="sect2"><a href="#message-bus-names">Message Bus Names</a></span></dt><dt><span class="sect2"><a href="#message-bus-routing">Message Bus Message Routing</a></span></dt><dt><span class="sect2"><a href="#message-bus-starting-services">Message Bus Starting Services</a></span></dt><dt><span class="sect2"><a href="#message-bus-types">Well-known Message Bus Instances</a></span></dt><dt><span class="sect2"><a href="#message-bus-messages">Message Bus Messages</a></span></dt></dl></dd><dt><span class="glossary"><a href="#id367478">Glossary</a></span></dt></dl></div><div class="sect1" title="Introduction"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="introduction"></a>Introduction</h2></div></div></div><p>
8
8
      D-Bus is a system for low-latency, low-overhead, easy to use
9
9
      interprocess communication (IPC). In more detail:
10
10
      </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
277
277
                </td><td>
278
278
                  8
279
279
                </td></tr><tr><td><code class="literal">VARIANT</code></td><td>
280
 
                  A variant type has a marshaled <code class="literal">SIGNATURE</code>
281
 
                  followed by a marshaled value with the type
282
 
                  given in the signature.
283
 
                  Unlike a message signature, the variant signature 
284
 
                  can contain only a single complete type.
285
 
                  So "i", "ai" or "(ii)" is OK, but "ii" is not.
 
280
                  A variant type has a marshaled
 
281
                  <code class="literal">SIGNATURE</code> followed by a marshaled
 
282
                  value with the type given in the signature.  Unlike
 
283
                  a message signature, the variant signature can
 
284
                  contain only a single complete type.  So "i", "ai"
 
285
                  or "(ii)" is OK, but "ii" is not.  Use of variants may not
 
286
                  cause a total message depth to be larger than 64, including
 
287
                  other container types such as structures.
286
288
                </td><td>
287
289
                  1 (alignment of the signature)
288
290
                </td></tr><tr><td><code class="literal">DICT_ENTRY</code></td><td>
895
897
        commands may be introduced both before, and after
896
898
        authentication, i.e. both before and after the OK command.
897
899
      </p></div><div class="sect2" title="Authentication examples"><div class="titlepage"><div><div><h3 class="title"><a name="auth-examples"></a>Authentication examples</h3></div></div></div><p>
898
 
        </p><div class="figure"><a name="id422013"></a><p class="title"><b>Figure�1.�Example of successful magic cookie authentication</b></p><div class="figure-contents"><pre class="programlisting">
 
900
        </p><div class="figure"><a name="id362126"></a><p class="title"><b>Figure�1.�Example of successful magic cookie authentication</b></p><div class="figure-contents"><pre class="programlisting">
899
901
            (MAGIC_COOKIE is a made up mechanism)
900
902
 
901
903
            C: AUTH MAGIC_COOKIE 3138363935333137393635383634
902
904
            S: OK 1234deadbeef
903
905
            C: BEGIN
904
906
          </pre></div></div><p><br class="figure-break">
905
 
        </p><div class="figure"><a name="id422028"></a><p class="title"><b>Figure�2.�Example of finding out mechanisms then picking one</b></p><div class="figure-contents"><pre class="programlisting">
 
907
        </p><div class="figure"><a name="id362141"></a><p class="title"><b>Figure�2.�Example of finding out mechanisms then picking one</b></p><div class="figure-contents"><pre class="programlisting">
906
908
            C: AUTH
907
909
            S: REJECTED KERBEROS_V4 SKEY
908
910
            C: AUTH SKEY 7ab83f32ee
911
913
            S: OK 1234deadbeef
912
914
            C: BEGIN
913
915
          </pre></div></div><p><br class="figure-break">
914
 
        </p><div class="figure"><a name="id422044"></a><p class="title"><b>Figure�3.�Example of client sends unknown command then falls back to regular auth</b></p><div class="figure-contents"><pre class="programlisting">
 
916
        </p><div class="figure"><a name="id362157"></a><p class="title"><b>Figure�3.�Example of client sends unknown command then falls back to regular auth</b></p><div class="figure-contents"><pre class="programlisting">
915
917
            C: FOOBAR
916
918
            S: ERROR
917
919
            C: AUTH MAGIC_COOKIE 3736343435313230333039
918
920
            S: OK 1234deadbeef
919
921
            C: BEGIN
920
922
          </pre></div></div><p><br class="figure-break">
921
 
        </p><div class="figure"><a name="id422060"></a><p class="title"><b>Figure�4.�Example of server doesn't support initial auth mechanism</b></p><div class="figure-contents"><pre class="programlisting">
 
923
        </p><div class="figure"><a name="id362173"></a><p class="title"><b>Figure�4.�Example of server doesn't support initial auth mechanism</b></p><div class="figure-contents"><pre class="programlisting">
922
924
            C: AUTH MAGIC_COOKIE 3736343435313230333039
923
925
            S: REJECTED KERBEROS_V4 SKEY
924
926
            C: AUTH SKEY 7ab83f32ee
927
929
            S: OK 1234deadbeef
928
930
            C: BEGIN
929
931
          </pre></div></div><p><br class="figure-break">
930
 
        </p><div class="figure"><a name="id422076"></a><p class="title"><b>Figure�5.�Example of wrong password or the like followed by successful retry</b></p><div class="figure-contents"><pre class="programlisting">
 
932
        </p><div class="figure"><a name="id362190"></a><p class="title"><b>Figure�5.�Example of wrong password or the like followed by successful retry</b></p><div class="figure-contents"><pre class="programlisting">
931
933
            C: AUTH MAGIC_COOKIE 3736343435313230333039
932
934
            S: REJECTED KERBEROS_V4 SKEY
933
935
            C: AUTH SKEY 7ab83f32ee
940
942
            S: OK 1234deadbeef
941
943
            C: BEGIN
942
944
          </pre></div></div><p><br class="figure-break">
943
 
        </p><div class="figure"><a name="id422094"></a><p class="title"><b>Figure�6.�Example of skey cancelled and restarted</b></p><div class="figure-contents"><pre class="programlisting">
 
945
        </p><div class="figure"><a name="id362208"></a><p class="title"><b>Figure�6.�Example of skey cancelled and restarted</b></p><div class="figure-contents"><pre class="programlisting">
944
946
            C: AUTH MAGIC_COOKIE 3736343435313230333039
945
947
            S: REJECTED KERBEROS_V4 SKEY
946
948
            C: AUTH SKEY 7ab83f32ee
953
955
            S: OK 1234deadbeef
954
956
            C: BEGIN
955
957
          </pre></div></div><p><br class="figure-break">
956
 
        </p><div class="figure"><a name="id422112"></a><p class="title"><b>Figure�7.�Example of successful magic cookie authentication with successful negotiation of Unix FD passing</b></p><div class="figure-contents"><pre class="programlisting">
 
958
        </p><div class="figure"><a name="id362225"></a><p class="title"><b>Figure�7.�Example of successful magic cookie authentication with successful negotiation of Unix FD passing</b></p><div class="figure-contents"><pre class="programlisting">
957
959
            (MAGIC_COOKIE is a made up mechanism)
958
960
 
959
961
            C: AUTH MAGIC_COOKIE 3138363935333137393635383634
962
964
            S: AGREE_UNIX_FD
963
965
            C: BEGIN
964
966
          </pre></div></div><p><br class="figure-break">
965
 
        </p><div class="figure"><a name="id422128"></a><p class="title"><b>Figure�8.�Example of successful magic cookie authentication with unsuccessful negotiation of Unix FD passing</b></p><div class="figure-contents"><pre class="programlisting">
 
967
        </p><div class="figure"><a name="id362242"></a><p class="title"><b>Figure�8.�Example of successful magic cookie authentication with unsuccessful negotiation of Unix FD passing</b></p><div class="figure-contents"><pre class="programlisting">
966
968
            (MAGIC_COOKIE is a made up mechanism)
967
969
 
968
970
            C: AUTH MAGIC_COOKIE 3138363935333137393635383634
1240
1242
                fails, the lock fails. Servers should retry for a reasonable
1241
1243
                period of time, then they may choose to delete an existing lock
1242
1244
                to keep users from having to manually delete a stale
1243
 
                lock. <sup>[<a name="id422845" href="#ftn.id422845" class="footnote">1</a>]</sup>
 
1245
                lock. <sup>[<a name="id362953" href="#ftn.id362953" class="footnote">1</a>]</sup>
1244
1246
              </p></li><li class="listitem"><p>
1245
1247
                Once the lockfile has been created, the server loads the cookie
1246
1248
                file. It should then delete any cookies that are old (the
1319
1321
      [FIXME we need to specify in detail each transport and its possible arguments]
1320
1322
    
1321
1323
      Current transports include: unix domain sockets (including 
1322
 
      abstract namespace on linux), TCP/IP, and a debug/testing transport using 
1323
 
      in-process pipes. Future possible transports include one that 
 
1324
      abstract namespace on linux), launchd, TCP/IP, and a debug/testing transport
 
1325
      using in-process pipes. Future possible transports include one that
1324
1326
      tunnels over X11 protocol.
1325
1327
    </p><div class="sect2" title="Unix Domain Sockets"><div class="titlepage"><div><div><h3 class="title"><a name="transports-unix-domain-sockets"></a>Unix Domain Sockets</h3></div></div></div><p>
1326
1328
        Unix domain sockets can be either paths in the file system or on Linux 
1338
1340
      </p><div class="sect3" title="Server Address Format"><div class="titlepage"><div><div><h4 class="title"><a name="transports-unix-domain-sockets-addresses"></a>Server Address Format</h4></div></div></div><p> 
1339
1341
          Unix domain socket addresses are identified by the "unix:" prefix 
1340
1342
          and support the following key/value pairs:
1341
 
        </p><div class="informaltable"><table border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Name</th><th>Values</th><th>Description</th></tr></thead><tbody><tr><td>path</td><td>(path)</td><td>path of the unix domain socket. If set, the "tmpdir" and "abstract" key must not be set.</td></tr><tr><td>tmpdir</td><td>(path)</td><td>temporary directory in which a socket file with a random file name starting with 'dbus-' will be created by the server. This key can only be used in server addresses, not in client addresses. If set, the "path" and "abstract" key must not be set.</td></tr><tr><td>abstract</td><td>(string)</td><td>unique string (path) in the abstract namespace. If set, the "path" or "tempdir" key must not be set.</td></tr></tbody></table></div></div></div><div class="sect2" title="TCP Sockets"><div class="titlepage"><div><div><h3 class="title"><a name="transports-tcp-sockets"></a>TCP Sockets</h3></div></div></div><p>
 
1343
        </p><div class="informaltable"><table border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Name</th><th>Values</th><th>Description</th></tr></thead><tbody><tr><td>path</td><td>(path)</td><td>path of the unix domain socket. If set, the "tmpdir" and "abstract" key must not be set.</td></tr><tr><td>tmpdir</td><td>(path)</td><td>temporary directory in which a socket file with a random file name starting with 'dbus-' will be created by the server. This key can only be used in server addresses, not in client addresses. If set, the "path" and "abstract" key must not be set.</td></tr><tr><td>abstract</td><td>(string)</td><td>unique string (path) in the abstract namespace. If set, the "path" or "tempdir" key must not be set.</td></tr></tbody></table></div></div></div><div class="sect2" title="launchd"><div class="titlepage"><div><div><h3 class="title"><a name="transports-launchd"></a>launchd</h3></div></div></div><p>
 
1344
        launchd is a open-source server management system that replaces init, inetd
 
1345
        and cron on Apple Mac OS X versions 10.4 and above. It provides a common session
 
1346
        bus address for each user and deprecates the X11-enabled D-Bus launcher on OSX.
 
1347
      </p><p>
 
1348
        launchd allocates a socket and provides it with the unix path through the
 
1349
        DBUS_LAUNCHD_SESSION_BUS_SOCKET variable in launchd's environment. Every process
 
1350
        spawned by launchd (or dbus-daemon, if it was started by launchd) can access
 
1351
        it through its environment.
 
1352
        Other processes can query for the launchd socket by executing:
 
1353
        $ launchctl getenv DBUS_LAUNCHD_SESSION_BUS_SOCKET
 
1354
        This is normally done by the D-Bus client library so doesn't have to be done
 
1355
        manually.
 
1356
      </p><p>
 
1357
        launchd is not available on Microsoft Windows.
 
1358
      </p><div class="sect3" title="Server Address Format"><div class="titlepage"><div><div><h4 class="title"><a name="transports-launchd-addresses"></a>Server Address Format</h4></div></div></div><p>
 
1359
          launchd addresses are identified by the "launchd:" prefix
 
1360
          and support the following key/value pairs:
 
1361
        </p><div class="informaltable"><table border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Name</th><th>Values</th><th>Description</th></tr></thead><tbody><tr><td>env</td><td>(environment variable)</td><td>path of the unix domain socket for the launchd created dbus-daemon.</td></tr></tbody></table></div></div></div><div class="sect2" title="TCP Sockets"><div class="titlepage"><div><div><h3 class="title"><a name="transports-tcp-sockets"></a>TCP Sockets</h3></div></div></div><p>
1342
1362
        The tcp transport provides TCP/IP based connections between clients
1343
1363
        located on the same or different hosts. 
1344
1364
      </p><p>
1385
1405
        </p><div class="informaltable"><table border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Name</th><th>Values</th><th>Description</th></tr></thead><tbody><tr><td>host</td><td>(string)</td><td>dns name or ip address</td></tr><tr><td>port</td><td>(number)</td><td>The tcp port the server will open. A zero value let the server 
1386
1406
            choose a free port provided from the underlaying operating system. 
1387
1407
            libdbus is able to retrieve the real used port from the server.  
1388
 
           </td></tr><tr><td>family</td><td>(string)</td><td>If set, provide the type of socket family either "ipv4" or "ipv6". If unset, the family is unspecified.</td></tr><tr><td>noncefile</td><td>(path)</td><td>file location containing the secret</td></tr></tbody></table></div></div></div></div><div class="sect1" title="Naming Conventions"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="naming-conventions"></a>Naming Conventions</h2></div></div></div><p>
 
1408
           </td></tr><tr><td>family</td><td>(string)</td><td>If set, provide the type of socket family either "ipv4" or "ipv6". If unset, the family is unspecified.</td></tr><tr><td>noncefile</td><td>(path)</td><td>file location containing the secret</td></tr></tbody></table></div></div></div></div><div class="sect1" title="Meta Transports"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="meta-transports"></a>Meta Transports</h2></div></div></div><p>
 
1409
      Meta transports are a kind of transport with special enhancements or
 
1410
      behavior. Currently available meta transports include: autolaunch
 
1411
    </p><div class="sect2" title="Autolaunch"><div class="titlepage"><div><div><h3 class="title"><a name="meta-transports-autolaunch"></a>Autolaunch</h3></div></div></div><p>The autolaunch transport provides a way for dbus clients to autodetect
 
1412
       a running dbus session bus and to autolaunch a session bus if not present.
 
1413
     </p><div class="sect3" title="Server Address Format"><div class="titlepage"><div><div><h4 class="title"><a name="meta-transports-autolaunch-addresses"></a>Server Address Format</h4></div></div></div><p>
 
1414
         Autolaunch addresses uses the "autolaunch:" prefix and support the
 
1415
         following key/value pairs:
 
1416
       </p><div class="informaltable"><table border="1"><colgroup><col><col><col></colgroup><thead><tr><th>Name</th><th>Values</th><th>Description</th></tr></thead><tbody><tr><td>scope</td><td>(string)</td><td>scope of autolaunch (Windows only)
 
1417
            <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>
 
1418
               "*install-path" - limit session bus to dbus installation path.
 
1419
               The dbus installation path is determined from the location of
 
1420
               the shared dbus library. If the library is located in a 'bin'
 
1421
               subdirectory the installation root is the directory above,
 
1422
               otherwise the directory where the library lives is taken as
 
1423
               installation root.
 
1424
               </p><pre class="programlisting">
 
1425
                   &lt;install-root&gt;/bin/[lib]dbus-1.dll
 
1426
                   &lt;install-root&gt;/[lib]dbus-1.dll
 
1427
               </pre><p>
 
1428
              </p></li><li class="listitem"><p>
 
1429
               "*user" - limit session bus to the recent user.
 
1430
              </p></li><li class="listitem"><p>
 
1431
               other values - specify dedicated session bus like "release",
 
1432
               "debug" or other
 
1433
              </p></li></ul></div>
 
1434
           </td></tr></tbody></table></div></div><div class="sect3" title="Windows implementation"><div class="titlepage"><div><div><h4 class="title"><a name="meta-transports-autolaunch-windows-implementation"></a>Windows implementation</h4></div></div></div><p>
 
1435
        On start, the server opens a platform specific transport, creates a mutex
 
1436
        and a shared memory section containing the related session bus address.
 
1437
        This mutex will be inspected by the dbus client library to detect a
 
1438
        running dbus session bus. The access to the mutex and the shared memory
 
1439
        section are protected by global locks.
 
1440
      </p><p>
 
1441
       In the recent implementation the autolaunch transport uses a tcp transport
 
1442
       on localhost with a port choosen from the operating system. This detail may
 
1443
       change in the future.
 
1444
      </p><p>
 
1445
        Disclaimer: The recent implementation is in an early state and may not
 
1446
        work in all cirumstances and/or may have security issues. Because of this
 
1447
        the implementation is not documentated yet.
 
1448
      </p></div></div></div><div class="sect1" title="Naming Conventions"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="naming-conventions"></a>Naming Conventions</h2></div></div></div><p>
1389
1449
      D-Bus namespaces are all lowercase and correspond to reversed domain
1390
1450
      names, as with Java. e.g. "org.freedesktop"
1391
1451
    </p><p>
1655
1715
        Messages may have a <code class="literal">DESTINATION</code> field (see <a class="xref" href="#message-protocol-header-fields" title="Header Fields">the section called &#8220;Header Fields&#8221;</a>).  If the
1656
1716
        <code class="literal">DESTINATION</code> field is present, it specifies a message
1657
1717
        recipient by name. Method calls and replies normally specify this field.
 
1718
        The message bus must send messages (of any type) with the
 
1719
        <code class="literal">DESTINATION</code> field set to the specified recipient,
 
1720
        regardless of whether the recipient has set up a match rule matching
 
1721
        the message.
1658
1722
      </p><p>
1659
1723
        Signals normally do not specify a destination; they are sent to all
1660
1724
        applications with <em class="firstterm">message matching rules</em> that
1933
1997
        badly-specified. ;-)] Service description files have the ".service" file
1934
1998
        extension. The message bus will only load service description files
1935
1999
        ending with .service; all other files will be ignored.  The file format
1936
 
        is similar to that of <a class="ulink" href="http://www.freedesktop.org/standards/desktop-entry-spec/desktop-entry-spec.html" target="_top">desktop
 
2000
        is similar to that of <a class="ulink" href="http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html" target="_top">desktop
1937
2001
        entries</a>. All service description files must be in UTF-8
1938
2002
        encoding. To ensure that there will be no name collisions, service files
1939
2003
        must be namespaced using the same mechanism as messages and service
1940
2004
        names.
1941
2005
 
1942
 
        </p><div class="figure"><a name="id425209"></a><p class="title"><b>Figure�9.�Example service description file</b></p><div class="figure-contents"><pre class="programlisting">
 
2006
        </p><div class="figure"><a name="id365470"></a><p class="title"><b>Figure�9.�Example service description file</b></p><div class="figure-contents"><pre class="programlisting">
1943
2007
            # Sample service description file
1944
2008
            [D-BUS Service]
1945
2009
            Names=org.freedesktop.ConfigurationDatabase;org.gnome.GConf;
2007
2071
          The root window property must have type <code class="literal">STRING</code>.
2008
2072
          The environment variable should have precedence over the 
2009
2073
          root window property.
2010
 
        </p><p>
2011
 
          [FIXME specify location of .service files, probably using 
2012
 
          DESKTOP_DIRS etc. from basedir specification, though login session 
2013
 
          bus is not really desktop-specific]
2014
 
        </p></div><div class="sect3" title="System message bus"><div class="titlepage"><div><div><h4 class="title"><a name="message-bus-types-system"></a>System message bus</h4></div></div></div><p>
 
2074
        </p><p>The address of the login session message bus is given in the
 
2075
        <code class="literal">DBUS_SESSION_BUS_ADDRESS</code> environment variable. If
 
2076
        DBUS_SESSION_BUS_ADDRESS is not set, or if it's set to the string
 
2077
        "autolaunch:", the system should use platform-specific methods of
 
2078
        locating a running D-Bus session server, or starting one if a running
 
2079
        instance cannot be found. Note that this mechanism is not recommended
 
2080
        for attempting to determine if a daemon is running. It is inherently
 
2081
        racy to attempt to make this determination, since the bus daemon may
 
2082
        be started just before or just after the determination is made.
 
2083
        Therefore, it is recommended that applications do not try to make this
 
2084
        determination for their functionality purposes, and instead they
 
2085
        should attempt to start the server.</p><div class="sect4" title="X Windowing System"><div class="titlepage"><div><div><h5 class="title"><a name="message-bus-types-login-x-windows"></a>X Windowing System</h5></div></div></div><p>
 
2086
            For the X Windowing System, the application must locate the
 
2087
            window owner of the selection represented by the atom formed by
 
2088
            concatenating:
 
2089
            </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>the literal string "_DBUS_SESSION_BUS_SELECTION_"</p></li><li class="listitem"><p>the current user's username</p></li><li class="listitem"><p>the literal character '_' (underscore)</p></li><li class="listitem"><p>the machine's ID</p></li></ul></div><p>
 
2090
          </p><p>
 
2091
            The following properties are defined for the window that owns
 
2092
            this X selection:
 
2093
            </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td>
 
2094
                      <p>Atom</p>
 
2095
                    </td><td>
 
2096
                      <p>meaning</p>
 
2097
                    </td></tr><tr><td>
 
2098
                      <p>_DBUS_SESSION_BUS_ADDRESS</p>
 
2099
                    </td><td>
 
2100
                      <p>the actual address of the server socket</p>
 
2101
                    </td></tr><tr><td>
 
2102
                      <p>_DBUS_SESSION_BUS_PID</p>
 
2103
                    </td><td>
 
2104
                      <p>the PID of the server process</p>
 
2105
                    </td></tr></tbody></table></div><p>
 
2106
          </p><p>
 
2107
            At least the _DBUS_SESSION_BUS_ADDRESS property MUST be
 
2108
            present in this window.
 
2109
          </p><p>
 
2110
            If the X selection cannot be located or if reading the
 
2111
            properties from the window fails, the implementation MUST conclude
 
2112
            that there is no D-Bus server running and proceed to start a new
 
2113
            server. (See below on concurrency issues)
 
2114
          </p><p>
 
2115
            Failure to connect to the D-Bus server address thus obtained
 
2116
            MUST be treated as a fatal connection error and should be reported
 
2117
            to the application.
 
2118
          </p><p>
 
2119
            As an alternative, an implementation MAY find the information
 
2120
            in the following file located in the current user's home directory,
 
2121
            in subdirectory .dbus/session-bus/:
 
2122
            </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>the machine's ID</p></li><li class="listitem"><p>the literal character '-' (dash)</p></li><li class="listitem"><p>the X display without the screen number, with the
 
2123
                following prefixes removed, if present: ":", "localhost:"
 
2124
                ."localhost.localdomain:". That is, a display of
 
2125
                "localhost:10.0" produces just the number "10"</p></li></ul></div><p>
 
2126
          </p><p>
 
2127
            The contents of this file NAME=value assignment pairs and
 
2128
            lines starting with # are comments (no comments are allowed
 
2129
            otherwise). The following variable names are defined:
 
2130
            </p><div class="informaltable"><table border="1"><colgroup><col><col></colgroup><tbody><tr><td>
 
2131
                      <p>Variable</p>
 
2132
                    </td><td>
 
2133
                      <p>meaning</p>
 
2134
                    </td></tr><tr><td>
 
2135
                      <p>DBUS_SESSION_BUS_ADDRESS</p>
 
2136
                    </td><td>
 
2137
                      <p>the actual address of the server socket</p>
 
2138
                    </td></tr><tr><td>
 
2139
                      <p>DBUS_SESSION_BUS_PID</p>
 
2140
                    </td><td>
 
2141
                      <p>the PID of the server process</p>
 
2142
                    </td></tr><tr><td>
 
2143
                      <p>DBUS_SESSION_BUS_WINDOWID</p>
 
2144
                    </td><td>
 
2145
                      <p>the window ID</p>
 
2146
                    </td></tr></tbody></table></div><p>
 
2147
          </p><p>
 
2148
            At least the DBUS_SESSION_BUS_ADDRESS variable MUST be present
 
2149
            in this file.
 
2150
          </p><p>
 
2151
            Failure to open this file MUST be interpreted as absence of a
 
2152
            running server. Therefore, the implementation MUST proceed to
 
2153
            attempting to launch a new bus server if the file cannot be
 
2154
            opened.
 
2155
          </p><p>
 
2156
            However, success in opening this file MUST NOT lead to the
 
2157
            conclusion that the server is running. Thus, a failure to connect to
 
2158
            the bus address obtained by the alternative method MUST NOT be
 
2159
            considered a fatal error. If the connection cannot be established,
 
2160
            the implementation MUST proceed to check the X selection settings or
 
2161
            to start the server on its own.
 
2162
          </p><p>
 
2163
            If the implementation concludes that the D-Bus server is not
 
2164
            running it MUST attempt to start a new server and it MUST also
 
2165
            ensure that the daemon started as an effect of the "autolaunch"
 
2166
            mechanism provides the lookup mechanisms described above, so
 
2167
            subsequent calls can locate the newly started server. The
 
2168
            implementation MUST also ensure that if two or more concurrent
 
2169
            initiations happen, only one server remains running and all other
 
2170
            initiations are able to obtain the address of this server and
 
2171
            connect to it. In other words, the implementation MUST ensure that
 
2172
            the X selection is not present when it attempts to set it, without
 
2173
            allowing another process to set the selection between the
 
2174
            verification and the setting (e.g., by using XGrabServer /
 
2175
            XungrabServer).
 
2176
          </p></div><div class="sect4"><div class="titlepage"><div><div><h5 class="title"><a name="id366057"></a></h5></div></div></div><p>
 
2177
            [FIXME specify location of .service files, probably using
 
2178
            DESKTOP_DIRS etc. from basedir specification, though login session
 
2179
            bus is not really desktop-specific]
 
2180
          </p></div></div><div class="sect3" title="System message bus"><div class="titlepage"><div><div><h4 class="title"><a name="message-bus-types-system"></a>System message bus</h4></div></div></div><p>
2015
2181
          A computer may have a <em class="firstterm">system message bus</em>,
2016
2182
          accessible to all applications on the system. This message bus may be
2017
2183
          used to broadcast system events, such as adding new hardware devices, 
2022
2188
          variable. If that variable is not set, applications should try 
2023
2189
          to connect to the well-known address
2024
2190
          <code class="literal">unix:path=/var/run/dbus/system_bus_socket</code>.
2025
 
          <sup>[<a name="id425407" href="#ftn.id425407" class="footnote">2</a>]</sup>
 
2191
          <sup>[<a name="id366098" href="#ftn.id366098" class="footnote">2</a>]</sup>
2026
2192
        </p><p>
2027
2193
          [FIXME specify location of system bus .service files]
2028
2194
        </p></div></div><div class="sect2" title="Message Bus Messages"><div class="titlepage"><div><div><h3 class="title"><a name="message-bus-messages"></a>Message Bus Messages</h3></div></div></div><p>
2207
2373
        There is also a per-machine ID, described in <a class="xref" href="#standard-interfaces-peer" title="org.freedesktop.DBus.Peer">the section called &#8220;<code class="literal">org.freedesktop.DBus.Peer</code>&#8221;</a> and returned
2208
2374
        by org.freedesktop.DBus.Peer.GetMachineId().
2209
2375
        For a desktop session bus, the bus ID can be used as a way to uniquely identify a user's session.
2210
 
        </p></div></div></div><div class="glossary" title="Glossary"><div class="titlepage"><div><div><h2 class="title"><a name="id426787"></a>Glossary</h2></div></div></div><p>
 
2376
        </p></div></div></div><div class="glossary" title="Glossary"><div class="titlepage"><div><div><h2 class="title"><a name="id367478"></a>Glossary</h2></div></div></div><p>
2211
2377
      This glossary defines some of the terms used in this specification.
2212
2378
    </p><dl><dt><a name="term-bus-name"></a>Bus Name</dt><dd><p>
2213
2379
          The message bus maintains an association between names and
2281
2447
          message bus. This name will never change owner, and will be unique
2282
2448
          (never reused during the lifetime of the message bus).
2283
2449
          It will begin with a ':' character.
2284
 
        </p></dd></dl></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id422845" href="#id422845" class="para">1</a>] </sup>Lockfiles are used instead of real file
 
2450
        </p></dd></dl></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id362953" href="#id362953" class="para">1</a>] </sup>Lockfiles are used instead of real file
2285
2451
                locking <code class="literal">fcntl()</code> because real locking
2286
2452
                implementations are still flaky on network
2287
 
                filesystems.</p></div><div class="footnote"><p><sup>[<a name="ftn.id425407" href="#id425407" class="para">2</a>] </sup>
 
2453
                filesystems.</p></div><div class="footnote"><p><sup>[<a name="ftn.id366098" href="#id366098" class="para">2</a>] </sup>
2288
2454
              The D-Bus reference implementation actually honors the 
2289
2455
              <code class="literal">$(localstatedir)</code> configure option 
2290
2456
              for this address, on both client and server side.