Section: sd_bus_query_sender_creds (3)
sd_bus_query_sender_creds, sd_bus_query_sender_privilege - Query bus message sender credentials/privileges
int sd_bus_query_sender_creds(sd_bus_message *m, uint64_t mask, sd_bus_creds **creds);
sd_bus_error* sd_bus_query_sender_privilege(sd_bus_message *m, int capability);
returns the credentials of the message
parameter is a combo of
flags that indicate which credential info the caller is interested in. See
for a list of possible flags. First, this message checks if the requested credentials are attached to the message itself. If not, but the message contains the pid of the sender and the caller specified the
flag, this function tries to figure out the missing credentials via other means (starting from the pid). If the pid isn't available but the message has a sender, this function calls
to get the requested credentials. If the message has no sender (when a direct connection is used), this function calls
to get the requested credentials. On success, the requested credentials are stored in
creds. Ownership of the credentials object in
is transferred to the caller and should be freed by calling
checks if the message
has the requested privileges. If
is a non-negative integer, this function checks if the message has the capability with the same value. See
for a list of capabilities. If
is a negative integer, this function returns whether the sender of the message runs as the same user as the receiver of the message, or if the sender of the message runs as root and the receiver of the message does not run as root. On success and if the message has the requested privileges, this function returns a positive integer. If the message does not have the requested privileges, this function returns zero.
On success, these functions return a non-negative integer. On failure, they return a negative errno-style error code.
Returned errors may indicate the following problems:
or an output parameter is
The bus of
is not connected.
The bus of
was created in a different process.
is not sealed.
These APIs are implemented as a shared library, which can be compiled and linked to with the