]> git.proxmox.com Git - systemd.git/blob - man/sd_bus_creds_has_permitted_cap.html
Imported Upstream version 220
[systemd.git] / man / sd_bus_creds_has_permitted_cap.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>sd_bus_creds_get_pid</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
2 a.headerlink {
3 color: #c60f0f;
4 font-size: 0.8em;
5 padding: 0 4px 0 4px;
6 text-decoration: none;
7 visibility: hidden;
8 }
9
10 a.headerlink:hover {
11 background-color: #c60f0f;
12 color: white;
13 }
14
15 h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
16 visibility: visible;
17 }
18 </style><a href="index.html">Index </a>·
19 <a href="systemd.directives.html">Directives </a>·
20 <a href="../python-systemd/index.html">Python </a>·
21 <a href="../libudev/index.html">libudev </a>·
22 <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 220</span><hr><div class="refentry"><a name="sd_bus_creds_get_pid"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>sd_bus_creds_get_pid, sd_bus_creds_get_ppid, sd_bus_creds_get_tid, sd_bus_creds_get_uid, sd_bus_creds_get_euid, sd_bus_creds_get_suid, sd_bus_creds_get_fsuid, sd_bus_creds_get_gid, sd_bus_creds_get_egid, sd_bus_creds_get_sgid, sd_bus_creds_get_fsgid, sd_bus_creds_get_supplementary_gids, sd_bus_creds_get_comm, sd_bus_creds_get_tid_comm, sd_bus_creds_get_exe, sd_bus_creds_get_cmdline, sd_bus_creds_get_cgroup, sd_bus_creds_get_unit, sd_bus_creds_get_user_unit, sd_bus_creds_get_slice, sd_bus_creds_get_session, sd_bus_creds_get_owner_uid, sd_bus_creds_has_effective_cap, sd_bus_creds_has_permitted_cap, sd_bus_creds_has_inheritable_cap, sd_bus_creds_has_bounding_cap, sd_bus_creds_get_selinux_context, sd_bus_creds_get_audit_session_id, sd_bus_creds_get_audit_login_uid, sd_bus_creds_get_tty, sd_bus_creds_get_unique_name, sd_bus_creds_get_well_known_names, sd_bus_creds_get_description — Retrieve fields from a credentials object</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><pre class="funcsynopsisinfo">#include &lt;systemd/sd-bus.h&gt;</pre><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_pid</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>pid_t *<var class="pdparam">pid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_ppid</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>pid_t *<var class="pdparam">ppid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_tid</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>pid_t *<var class="pdparam">tid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_uid</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>uid_t *<var class="pdparam">uid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_euid</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>uid_t *<var class="pdparam">uid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_suid</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>uid_t *<var class="pdparam">uid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_fsuid</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>uid_t *<var class="pdparam">uid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_gid</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>gid_t *<var class="pdparam">gid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_egid</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>gid_t *<var class="pdparam">gid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_sgid</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>gid_t *<var class="pdparam">gid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_fsgid</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>gid_t *<var class="pdparam">gid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_supplementary_gids</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>const gid_t **<var class="pdparam">gids</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_comm</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>const char **<var class="pdparam">comm</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_tid_comm</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>const char **<var class="pdparam">comm</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_exe</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>const char **<var class="pdparam">exe</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_cmdline</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>char ***<var class="pdparam">cmdline</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_cgroup</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>const char **<var class="pdparam">cgroup</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_unit</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>const char **<var class="pdparam">unit</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_user_unit</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>const char **<var class="pdparam">unit</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_slice</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>const char **<var class="pdparam">slice</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_session</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>const char **<var class="pdparam">slice</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_owner_uid</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>uid_t *<var class="pdparam">uid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_has_effective_cap</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">capability</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_has_permitted_cap</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">capability</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_has_inheritable_cap</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">capability</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_has_bounding_cap</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">capability</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_selinux_context</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>const char **<var class="pdparam">context</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_audit_session_id</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>uint32_t *<var class="pdparam">sessionid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_audit_login_uid</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>uid_t *<var class="pdparam">loginuid</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_tty</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>const char **<var class="pdparam">tty</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_unique_name</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>const char **<var class="pdparam">name</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_well_known_names</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>char ***<var class="pdparam">name</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">sd_bus_creds_get_description</b>(</code></td><td>sd_bus_creds *<var class="pdparam">c</var>, </td></tr><tr><td> </td><td>const char **<var class="pdparam">name</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idm140680959593040"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description"></a></h2><p>These functions return information from an
23 <em class="parameter"><code>sd_bus_creds</code></em> credential object. Credential
24 objects may be created with
25 <a href="sd_bus_creds_new_from_pid.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_creds_new_from_pid</span>(3)</span></a>,
26 in which case they describe the credentials of the process
27 identified by the specified PID, with
28 <a href="sd_bus_get_name_creds.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_get_name_creds</span>(3)</span></a>,
29 in which case they describe the credentials of a bus peer
30 identified by the specified bus name, or with
31 <a href="sd_bus_get_owner_creds.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_get_owner_creds</span>(3)</span></a>,
32 in which case they describe the credentials of the creator of a
33 bus.</p><p><code class="function">sd_bus_creds_get_pid()</code> will retrieve
34 the PID (process identifier). Similar,
35 <code class="function">sd_bus_creds_get_ppid()</code> will retrieve the
36 parent PID. Note that PID 1 has no parent process, in which case
37 -ENXIO is returned.</p><p><code class="function">sd_bus_creds_get_tid()</code> will retrieve the
38 TID (thread identifier).</p><p><code class="function">sd_bus_creds_get_uid()</code> will retrieve
39 the numeric UID (user identifier). Similar,
40 <code class="function">sd_bus_creds_get_euid()</code> returns the effective
41 UID, <code class="function">sd_bus_creds_get_suid()</code> the saved UID
42 and <code class="function">sd_bus_creds_get_fsuid()</code> the file system
43 UID.</p><p><code class="function">sd_bus_creds_get_gid()</code> will retrieve the
44 numeric GID (group identifier). Similar,
45 <code class="function">sd_bus_creds_get_egid()</code> returns the effective
46 GID, <code class="function">sd_bus_creds_get_sgid()</code> the saved GID
47 and <code class="function">sd_bus_creds_get_fsgid()</code> the file system
48 GID.</p><p><code class="function">sd_bus_creds_get_supplementary_gids()</code>
49 will retrieve the supplementary GIDs list.</p><p><code class="function">sd_bus_creds_get_comm()</code> will retrieve the
50 comm field (truncated name of the executable, as stored in
51 <code class="filename">/proc/<em class="replaceable"><code>pid</code></em>/comm</code>).
52 </p><p><code class="function">sd_bus_creds_get_tid_comm()</code> will retrieve
53 the comm field of the thread (as stored in
54 <code class="filename">/proc/<em class="replaceable"><code>pid</code></em>/task/<em class="replaceable"><code>tid</code></em>/comm</code>).
55 </p><p><code class="function">sd_bus_creds_get_exe()</code> will retrieve
56 the path to the program executable (as stored in the
57 <code class="filename">/proc/<em class="replaceable"><code>pid</code></em>/exe</code>
58 link, but with "<code class="literal"> (deleted)</code>" suffix removed). Note
59 that kernel threads do not have an executable path, in which case
60 -ENXIO is returned.</p><p><code class="function">sd_bus_creds_get_cmdline()</code> will
61 retrieve an array of command line arguments (as stored in
62 <code class="filename">/proc/<em class="replaceable"><code>pid</code></em>/cmdline</code>). Note
63 that kernel threads do not have a command line, in which case
64 -ENXIO is returned.</p><p><code class="function">sd_bus_creds_get_cgroup()</code> will retrieve
65 the cgroup path. See <a class="ulink" href="https://www.kernel.org/doc/Documentation/cgroups/cgroups.txt" target="_top">cgroups.txt</a>.
66 </p><p><code class="function">sd_bus_creds_get_unit()</code> will retrieve
67 the systemd unit name (in the system instance of systemd) that the
68 process is part of. See
69 <a href="systemd.unit.html"><span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span></a>. For
70 processes that are not part of a unit returns -ENXIO.
71 </p><p><code class="function">sd_bus_creds_get_user_unit()</code> will
72 retrieve the systemd unit name (in the user instance of systemd)
73 that the process is part of. See
74 <a href="systemd.unit.html"><span class="citerefentry"><span class="refentrytitle">systemd.unit</span>(5)</span></a>. For
75 processes that are not part of a user unit returns -ENXIO.
76 </p><p><code class="function">sd_bus_creds_get_slice()</code> will retrieve
77 the systemd slice (a unit in the system instance of systemd) that
78 the process is part of. See
79 <a href="systemd.slice.html"><span class="citerefentry"><span class="refentrytitle">systemd.slice</span>(5)</span></a>.
80 </p><p><code class="function">sd_bus_creds_get_session()</code> will
81 retrieve the logind session that the process is part of. See
82 <a href="systemd-logind.service.html"><span class="citerefentry"><span class="refentrytitle">systemd-logind.service</span>(8)</span></a>. For
83 processes that are not part of a session returns -ENXIO.
84 </p><p><code class="function">sd_bus_creds_get_owner_uid()</code> will
85 retrieve the numeric UID (user identifier) of the user who owns
86 the session that the process is part of. See
87 <a href="systemd.slice.html"><span class="citerefentry"><span class="refentrytitle">systemd.slice</span>(5)</span></a>
88 For processes that are not part of a session returns -ENXIO.
89 </p><p><code class="function">sd_bus_creds_has_effective_cap()</code> will
90 check whether the capability specified by
91 <em class="parameter"><code>capability</code></em> was set in the effective
92 capabilities mask. A positive return value means that is was
93 set, zero means that it was not set, and a negative return
94 value signifies an error. See
95 <a href="http://man7.org/linux/man-pages/man7/capabilities.7.html"><span class="citerefentry"><span class="refentrytitle">capabilities</span>(7)</span></a>
96 and <code class="varname">Capabilities=</code> and
97 <code class="varname">CapabilityBoundingSet=</code> settings in
98 <a href="systemd.exec.html"><span class="citerefentry"><span class="refentrytitle">systemd.exec</span>(5)</span></a>.
99 </p><p><code class="function">sd_bus_creds_has_permitted_cap()</code> is
100 similar to <code class="function">sd_bus_creds_has_effective_cap()</code>,
101 but will check the permitted capabilities mask.</p><p><code class="function">sd_bus_creds_has_inheritable_cap()</code> is
102 similar to <code class="function">sd_bus_creds_has_effective_cap()</code>,
103 but will check the inheritable capabilities mask.</p><p><code class="function">sd_bus_creds_has_bounding_cap()</code> is
104 similar to <code class="function">sd_bus_creds_has_effective_cap()</code>,
105 but will check the bounding capabilities mask.</p><p><code class="function">sd_bus_creds_get_selinux_context()</code> will
106 retrieve the SELinux security context (label) of the process.</p><p><code class="function">sd_bus_creds_get_audit_session_id()</code>
107 will retrieve the audit session identifier of the process. Returns
108 -ENXIO for processes that are not part of an audit session.</p><p><code class="function">sd_bus_creds_get_audit_login_uid()</code> will
109 retrieve the audit user login identifier (the identifier of the
110 user who is "responsible" for the session). Returns -ENXIO for
111 processes that are not part of an audit session.</p><p><code class="function">sd_bus_creds_get_tty()</code> will retrieve
112 the controlling TTY. Returns -ENXIO for processes that have no
113 controlling TTY.</p><p><code class="function">sd_bus_creds_get_unique_name()</code> will
114 retrieve the D-Bus unique name. See <a class="ulink" href="http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus" target="_top">The
115 D-Bus specification</a>.</p><p><code class="function">sd_bus_creds_get_well_known_names()</code> will
116 retrieve the set of D-Bus well-known names. See <a class="ulink" href="http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-names-bus" target="_top">The
117 D-Bus specification</a>.</p><p><code class="function">sd_bus_creds_get_description()</code> will
118 retrieve a descriptive name of the bus connection of the
119 peer. This name is useful to discern multiple bus connections by
120 the same peer, and may be altered by the peer with the
121 <a href="sd_bus_set_description.html"><span class="citerefentry"><span class="refentrytitle">sd_bus_set_description</span>(3)</span></a>
122 call.</p><p>All functions that take a <em class="parameter"><code>const
123 char**</code></em> parameter will store the answer there as an
124 address of a NUL-terminated string. It will be valid as long as
125 <em class="parameter"><code>c</code></em> remains valid, and should not be freed or
126 modified by the caller.</p><p>All functions that take a <em class="parameter"><code>char***</code></em>
127 parameter will store the answer there as an address of a an array
128 of strings. Each individual string is NUL-terminated, and the
129 array is NULL-terminated as a whole. It will be valid as long as
130 <em class="parameter"><code>c</code></em> remains valid, and should not be freed or
131 modified by the caller.</p></div><div class="refsect1"><a name="idm140680959538576"></a><h2 id="Return Value">Return Value<a class="headerlink" title="Permalink to this headline" href="#Return%20Value"></a></h2><p>On success, these calls return 0 or a positive integer. On
132 failure, these calls return a negative errno-style error code.
133 </p></div><div class="refsect1"><a name="idm140680959537280"></a><h2 id="Errors">Errors<a class="headerlink" title="Permalink to this headline" href="#Errors"></a></h2><p>Returned errors may indicate the following problems:</p><div class="variablelist"><dl class="variablelist"><dt id="-ENODATA"><span class="term"><code class="constant">-ENODATA</code></span><a class="headerlink" title="Permalink to this term" href="#-ENODATA"></a></dt><dd><p>Given field is not available in the
134 credentials object <em class="parameter"><code>c</code></em>.</p></dd><dt id="-ENXIO"><span class="term"><code class="constant">-ENXIO</code></span><a class="headerlink" title="Permalink to this term" href="#-ENXIO"></a></dt><dd><p>Given field is not specified for the described
135 process or peer. This will be returned by
136 <code class="function">sd_bus_get_unit()</code>,
137 <code class="function">sd_bus_get_user_unit()</code>,
138 <code class="function">sd_bus_get_slice()</code>,
139 <code class="function">sd_bus_get_session()</code>, and
140 <code class="function">sd_bus_get_owner_uid()</code> if the process is
141 not part of a systemd system unit, systemd user unit, systemd
142 slice, or logind session. It will also be returned by
143 <code class="function">sd_bus_creds_get_exe()</code> and
144 <code class="function">sd_bus_creds_get_cmdline()</code> for kernel
145 threads (since these aren't started from an executable binary
146 or have a command line),
147 <code class="function">sd_bus_creds_get_audit_session_id()</code> and
148 <code class="function">sd_bus_creds_get_audit_login_uid()</code> when
149 the process is not part of an audit session, and
150 <code class="function">sd_bus_creds_get_tty()</code> if the process has
151 no controlling TTY.
152 </p></dd><dt id="-EINVAL"><span class="term"><code class="constant">-EINVAL</code></span><a class="headerlink" title="Permalink to this term" href="#-EINVAL"></a></dt><dd><p>Specified pointer parameter is <code class="constant">NULL</code>.
153 </p></dd><dt id="-ENOMEM"><span class="term"><code class="constant">-ENOMEM</code></span><a class="headerlink" title="Permalink to this term" href="#-ENOMEM"></a></dt><dd><p>Memory allocation failed.</p></dd></dl></div></div><div class="refsect1"><a name="idm140680959521920"></a><h2 id="Notes">Notes<a class="headerlink" title="Permalink to this headline" href="#Notes"></a></h2><p><code class="function">sd_bus_open_user()</code> and other functions
154 described here are available as a shared library, which can be
155 compiled and linked to with the
156 <code class="constant">libsystemd</code> <a href="http://linux.die.net/man/1/pkg-config"><span class="citerefentry"><span class="refentrytitle">pkg-config</span>(1)</span></a>
157 file.</p></div><div class="refsect1"><a name="idm140680959518736"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also"></a></h2><p>
158 <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
159 <a href="sd-bus.html"><span class="citerefentry"><span class="refentrytitle">sd-bus</span>(3)</span></a>,
160 <a href="http://man7.org/linux/man-pages/man2/fork.2.html"><span class="citerefentry"><span class="refentrytitle">fork</span>(2)</span></a>,
161 <a href="http://man7.org/linux/man-pages/man2/execve.2.html"><span class="citerefentry"><span class="refentrytitle">execve</span>(2)</span></a>,
162 <a href="http://man7.org/linux/man-pages/man7/credentials.7.html"><span class="citerefentry"><span class="refentrytitle">credentials</span>(7)</span></a>,
163 <a href="http://man7.org/linux/man-pages/man3/free.3.html"><span class="citerefentry"><span class="refentrytitle">free</span>(3)</span></a>,
164 <a href="http://man7.org/linux/man-pages/man5/proc.5.html"><span class="citerefentry"><span class="refentrytitle">proc</span>(5)</span></a>,
165 <a href="systemd.journal-fields.html"><span class="citerefentry"><span class="refentrytitle">systemd.journal-fields</span>(7)</span></a>
166 </p></div></div></body></html>