| 1 |
<?xml version='1.0'?> |
| 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 --> |
| 5 |
|
| 6 |
<refentry id="sd_bus_get_name_creds" xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 7 |
|
| 8 |
<refentryinfo> |
| 9 |
<title>sd_bus_get_name_creds</title> |
| 10 |
<productname>systemd</productname> |
| 11 |
</refentryinfo> |
| 12 |
|
| 13 |
<refmeta> |
| 14 |
<refentrytitle>sd_bus_get_name_creds</refentrytitle> |
| 15 |
<manvolnum>3</manvolnum> |
| 16 |
</refmeta> |
| 17 |
|
| 18 |
<refnamediv> |
| 19 |
<refname>sd_bus_get_name_creds</refname> |
| 20 |
<refname>sd_bus_get_owner_creds</refname> |
| 21 |
|
| 22 |
<refpurpose>Query bus client credentials</refpurpose> |
| 23 |
</refnamediv> |
| 24 |
|
| 25 |
<refsynopsisdiv> |
| 26 |
<funcsynopsis> |
| 27 |
<funcsynopsisinfo>#include <systemd/sd-bus.h></funcsynopsisinfo> |
| 28 |
|
| 29 |
<funcprototype> |
| 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> |
| 35 |
</funcprototype> |
| 36 |
|
| 37 |
<funcprototype> |
| 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> |
| 42 |
</funcprototype> |
| 43 |
</funcsynopsis> |
| 44 |
</refsynopsisdiv> |
| 45 |
|
| 46 |
<refsect1> |
| 47 |
<title>Description</title> |
| 48 |
|
| 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 |
| 52 |
interested in. See |
| 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>. |
| 58 |
</para> |
| 59 |
|
| 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> |
| 63 |
</refsect1> |
| 64 |
|
| 65 |
<refsect1> |
| 66 |
<title>Return Value</title> |
| 67 |
|
| 68 |
<para>On success, these functions return a non-negative integer. On failure, they return a negative |
| 69 |
errno-style error code.</para> |
| 70 |
|
| 71 |
<refsect2> |
| 72 |
<title>Errors</title> |
| 73 |
|
| 74 |
<para>Returned errors may indicate the following problems:</para> |
| 75 |
|
| 76 |
<variablelist> |
| 77 |
<varlistentry> |
| 78 |
<term><constant>-EINVAL</constant></term> |
| 79 |
|
| 80 |
<listitem><para>An argument is invalid.</para></listitem> |
| 81 |
</varlistentry> |
| 82 |
|
| 83 |
<varlistentry> |
| 84 |
<term><constant>-ENOPKG</constant></term> |
| 85 |
|
| 86 |
<listitem><para>The bus cannot be resolved.</para></listitem> |
| 87 |
</varlistentry> |
| 88 |
|
| 89 |
<varlistentry> |
| 90 |
<term><constant>-EPERM</constant></term> |
| 91 |
|
| 92 |
<listitem><para>The bus has already been started.</para></listitem> |
| 93 |
</varlistentry> |
| 94 |
|
| 95 |
<varlistentry> |
| 96 |
<term><constant>-ECHILD</constant></term> |
| 97 |
|
| 98 |
<listitem><para>The bus was created in a different process, library or module instance.</para></listitem> |
| 99 |
</varlistentry> |
| 100 |
|
| 101 |
<varlistentry> |
| 102 |
<term><constant>-ENOMEM</constant></term> |
| 103 |
|
| 104 |
<listitem><para>Memory allocation failed.</para></listitem> |
| 105 |
</varlistentry> |
| 106 |
</variablelist> |
| 107 |
</refsect2> |
| 108 |
</refsect1> |
| 109 |
|
| 110 |
<xi:include href="libsystemd-pkgconfig.xml" /> |
| 111 |
|
| 112 |
<refsect1> |
| 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> |
| 116 |
</refsect1> |
| 117 |
|
| 118 |
<refsect1> |
| 119 |
<title>See Also</title> |
| 120 |
|
| 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> |
| 125 |
</simplelist></para> |
| 126 |
</refsect1> |
| 127 |
</refentry> |