]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/sd_bus_query_sender_creds.xml
man: fix incorrectly placed full stop
[thirdparty/systemd.git] / man / sd_bus_query_sender_creds.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
5
6 <refentry id="sd_bus_query_sender_creds" xmlns:xi="http://www.w3.org/2001/XInclude">
7
8 <refentryinfo>
9 <title>sd_bus_query_sender_creds</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>sd_bus_query_sender_creds</refentrytitle>
15 <manvolnum>3</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>sd_bus_query_sender_creds</refname>
20 <refname>sd_bus_query_sender_privilege</refname>
21
22 <refpurpose>Query bus message sender credentials/privileges</refpurpose>
23 </refnamediv>
24
25 <refsynopsisdiv>
26 <funcsynopsis>
27 <funcsynopsisinfo>#include &lt;systemd/sd-bus.h&gt;</funcsynopsisinfo>
28
29 <funcprototype>
30 <funcdef>int <function>sd_bus_query_sender_creds</function></funcdef>
31 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
32 <paramdef>uint64_t <parameter>mask</parameter></paramdef>
33 <paramdef>sd_bus_creds **<parameter>creds</parameter></paramdef>
34 </funcprototype>
35
36 <funcprototype>
37 <funcdef>sd_bus_error* <function>sd_bus_query_sender_privilege</function></funcdef>
38 <paramdef>sd_bus_message *<parameter>m</parameter></paramdef>
39 <paramdef>int <parameter>capability</parameter></paramdef>
40 </funcprototype>
41 </funcsynopsis>
42 </refsynopsisdiv>
43
44 <refsect1>
45 <title>Description</title>
46
47 <para><function>sd_bus_query_sender_creds()</function> returns the credentials of the message
48 <parameter>m</parameter>. The <parameter>mask</parameter> parameter is a combo of
49 <constant index='false'>SD_BUS_CREDS_*</constant> flags that indicate which credential info the caller is
50 interested in. See
51 <citerefentry><refentrytitle>sd_bus_creds_new_from_pid</refentrytitle><manvolnum>3</manvolnum></citerefentry>
52 for a list of possible flags. First, this message checks if the requested credentials are attached to the
53 message itself. If not but the message contains the pid of the sender, this function tries to figure out
54 the missing credentials via other means (starting from the pid). If the pid isn't available but the
55 message has a sender, this function calls
56 <citerefentry><refentrytitle>sd_bus_get_name_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>
57 to get the requested credentials. If the message has no sender (when a direct connection is used), this
58 function calls
59 <citerefentry><refentrytitle>sd_bus_get_owner_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>
60 to get the requested credentials. On success, the requested credentials are stored in
61 <parameter>creds</parameter>. Ownership of the credentials object in <parameter>creds</parameter> is
62 transferred to the caller and should be freed by calling
63 <citerefentry><refentrytitle>sd_bus_creds_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
64 </para>
65
66 <para><function>sd_bus_query_sender_privilege()</function> checks if the message <parameter>m</parameter>
67 has the requested privileges. If <parameter>capability</parameter> is a non-negative integer, this
68 function checks if the message has the capability with the same value. See
69 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
70 for a list of capabilities. If <parameter>capability</parameter> is a negative integer, this function
71 returns whether the sender of the message runs as the same user as the receiver of the message, or if the
72 sender of the message runs as root and the receiver of the message does not run as root. On success and
73 if the message has the requested privileges, this function returns a positive integer. If the message
74 does not have the requested privileges, this function returns zero.</para>
75 </refsect1>
76
77 <refsect1>
78 <title>Return Value</title>
79
80 <para>On success, these functions return a non-negative integer. On failure, they return a negative
81 errno-style error code.</para>
82
83 <refsect2>
84 <title>Errors</title>
85
86 <para>Returned errors may indicate the following problems:</para>
87
88 <variablelist>
89 <varlistentry>
90 <term><constant>-EINVAL</constant></term>
91
92 <listitem><para>The message <parameter>m</parameter> or an output parameter is
93 <constant>NULL</constant>.</para></listitem>
94 </varlistentry>
95
96 <varlistentry>
97 <term><constant>-ENOTCONN</constant></term>
98
99 <listitem><para>The bus of <parameter>m</parameter> is not connected.</para></listitem>
100 </varlistentry>
101
102 <varlistentry>
103 <term><constant>-ECHILD</constant></term>
104
105 <listitem><para>The bus of <parameter>m</parameter> was created in a different process.
106 </para></listitem>
107 </varlistentry>
108
109 <varlistentry>
110 <term><constant>-EPERM</constant></term>
111
112 <listitem><para>The message <parameter>m</parameter> is not sealed.</para></listitem>
113 </varlistentry>
114 </variablelist>
115 </refsect2>
116 </refsect1>
117
118 <xi:include href="libsystemd-pkgconfig.xml" />
119
120 <refsect1>
121 <title>See Also</title>
122
123 <para>
124 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
125 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
126 <citerefentry><refentrytitle>sd_bus_creds_new_from_pid</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
127 <citerefentry><refentrytitle>sd_bus_get_name_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
128 <citerefentry><refentrytitle>sd_bus_get_owner_creds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
129 <citerefentry><refentrytitle>sd_bus_creds_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
130 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
131 </para>
132 </refsect1>
133 </refentry>