2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id=
"sd_bus_get_name_creds" xmlns:
xi=
"http://www.w3.org/2001/XInclude">
9 <title>sd_bus_get_name_creds
</title>
10 <productname>systemd
</productname>
14 <refentrytitle>sd_bus_get_name_creds
</refentrytitle>
15 <manvolnum>3</manvolnum>
19 <refname>sd_bus_get_name_creds
</refname>
20 <refname>sd_bus_get_owner_creds
</refname>
22 <refpurpose>Query bus client credentials
</refpurpose>
27 <funcsynopsisinfo>#include
<systemd/sd-bus.h
></funcsynopsisinfo>
30 <funcdef>int
<function>sd_bus_get_name_creds
</function></funcdef>
31 <paramdef>sd_bus *
<parameter>bus
</parameter></paramdef>
32 <paramdef>const char *
<parameter>name
</parameter></paramdef>
33 <paramdef>uint64_t
<parameter>mask
</parameter></paramdef>
34 <paramdef>sd_bus_creds **
<parameter>creds
</parameter></paramdef>
38 <funcdef>int
<function>sd_bus_get_owner_creds
</function></funcdef>
39 <paramdef>sd_bus *
<parameter>bus
</parameter></paramdef>
40 <paramdef>uint64_t
<parameter>mask
</parameter></paramdef>
41 <paramdef>sd_bus_creds **
<parameter>creds
</parameter></paramdef>
47 <title>Description
</title>
49 <para><function>sd_bus_get_name_creds()
</function> queries the credentials of the bus client
50 identified by
<parameter>name
</parameter>. The
<parameter>mask
</parameter> parameter is a combo of
51 <constant index='false'
>SD_BUS_CREDS_*
</constant> flags that indicate which credential info the caller is
53 <citerefentry><refentrytitle>sd_bus_creds_new_from_pid
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
54 for a list of possible flags. On success,
<parameter>creds
</parameter> contains a new
55 <structname>sd_bus_creds
</structname> instance with the requested information. Ownership of this instance
56 belongs to the caller and it should be freed once no longer needed by calling
57 <citerefentry><refentrytitle>sd_bus_creds_unref
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
60 <para><function>sd_bus_get_owner_creds()
</function> queries the credentials of the creator of the given
61 bus. The
<parameter>mask
</parameter> and
<parameter>creds
</parameter> parameters behave the same as in
62 <function>sd_bus_get_name_creds()
</function>.
</para>
66 <title>Return Value
</title>
68 <para>On success, these functions return a non-negative integer. On failure, they return a negative
69 errno-style error code.
</para>
74 <para>Returned errors may indicate the following problems:
</para>
78 <term><constant>-EINVAL
</constant></term>
80 <listitem><para>An argument is invalid.
</para></listitem>
84 <term><constant>-ENOPKG
</constant></term>
86 <listitem><para>The bus cannot be resolved.
</para></listitem>
90 <term><constant>-EPERM
</constant></term>
92 <listitem><para>The bus has already been started.
</para></listitem>
96 <term><constant>-ECHILD
</constant></term>
98 <listitem><para>The bus was created in a different process, library or module instance.
</para></listitem>
102 <term><constant>-ENOMEM
</constant></term>
104 <listitem><para>Memory allocation failed.
</para></listitem>
110 <xi:include href=
"libsystemd-pkgconfig.xml" />
113 <title>History
</title>
114 <para><function>sd_bus_get_name_creds()
</function> and
115 <function>sd_bus_get_owner_creds()
</function> were added in version
221.
</para>
119 <title>See Also
</title>
121 <para><simplelist type=
"inline">
122 <member><citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
123 <member><citerefentry><refentrytitle>sd-bus
</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
124 <member><citerefentry><refentrytitle>sd_bus_creds_unref
</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>