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-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>
82 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
86 <term><constant>-ENOPKG</constant></term>
88 <listitem><para>The bus cannot be resolved.</para>
90 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
94 <term><constant>-EPERM</constant></term>
96 <listitem><para>The bus has already been started.</para>
98 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
102 <term><constant>-ECHILD</constant></term>
104 <listitem><para>The bus was created in a different process, library or module instance.</para>
106 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
110 <term><constant>-ENOMEM</constant></term>
112 <listitem><para>Memory allocation failed.</para>
114 <xi:include href="version-info.xml" xpointer="v246"/></listitem>
120 <xi:include href="libsystemd-pkgconfig.xml" />
123 <title>History</title>
124 <para><function>sd_bus_get_name_creds()</function> and
125 <function>sd_bus_get_owner_creds()</function> were added in version 246.</para>
129 <title>See Also</title>
132 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
133 <citerefentry><refentrytitle>sd-bus</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
134 <citerefentry><refentrytitle>sd_bus_creds_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry>