From 8653422b6abde97def967856354e11c3e3c826a2 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 23 Apr 2020 21:31:45 +0200 Subject: [PATCH] sd-bus: Add sd_bus_get_creds_mask docs --- man/rules/meson.build | 4 +- man/sd-bus.xml | 1 + man/sd_bus_negotiate_fds.xml | 105 +++++++++++++++++++++-------------- 3 files changed, 66 insertions(+), 44 deletions(-) diff --git a/man/rules/meson.build b/man/rules/meson.build index 695cdf3516..a59b004ebe 100644 --- a/man/rules/meson.build +++ b/man/rules/meson.build @@ -359,7 +359,9 @@ manpages = [ ['sd_bus_message_verify_type', '3', [], ''], ['sd_bus_negotiate_fds', '3', - ['sd_bus_negotiate_creds', 'sd_bus_negotiate_timestamp'], + ['sd_bus_get_creds_mask', + 'sd_bus_negotiate_creds', + 'sd_bus_negotiate_timestamp'], ''], ['sd_bus_new', '3', diff --git a/man/sd-bus.xml b/man/sd-bus.xml index 9fdfe16b80..b6be54fa96 100644 --- a/man/sd-bus.xml +++ b/man/sd-bus.xml @@ -74,6 +74,7 @@ sd_bus_get_address3, sd_bus_get_allow_interactive_authorization3, sd_bus_get_bus_id3, +sd_bus_get_creds_mask3, sd_bus_get_current_handler3, sd_bus_get_current_message3, sd_bus_get_current_slot3, diff --git a/man/sd_bus_negotiate_fds.xml b/man/sd_bus_negotiate_fds.xml index c12b65c983..f17a54f269 100644 --- a/man/sd_bus_negotiate_fds.xml +++ b/man/sd_bus_negotiate_fds.xml @@ -19,6 +19,7 @@ sd_bus_negotiate_fds sd_bus_negotiate_timestamp sd_bus_negotiate_creds + sd_bus_get_creds_mask Control feature negotiation on bus connections @@ -45,69 +46,69 @@ int b uint64_t mask + + + int sd_bus_get_creds_mask + sd_bus *bus + uint64_t *mask + Description - sd_bus_negotiate_fds() controls whether - file descriptor passing shall be negotiated for the specified bus - connection. It takes a bus object and a boolean, which, when true, - enables file descriptor passing, and, when false, disables - it. Note that not all transports and servers support file - descriptor passing. In particular, networked transports generally - do not support file descriptor passing. To find out whether file - descriptor passing is available after negotiation, use + sd_bus_negotiate_fds() controls whether file descriptor passing shall be + negotiated for the specified bus connection. It takes a bus object and a boolean, which, when true, + enables file descriptor passing, and, when false, disables it. Note that not all transports and servers + support file descriptor passing. In particular, networked transports generally do not support file + descriptor passing. To find out whether file descriptor passing is available after negotiation, use sd_bus_can_send3 - and pass SD_BUS_TYPE_UNIX_FD. Note that file - descriptor passing is always enabled for both sending and - receiving or for neither, but never only in one direction. By - default, file descriptor passing is negotiated for all - connections. + and pass SD_BUS_TYPE_UNIX_FD. Note that file descriptor passing is always enabled + for both sending and receiving or for neither, but never only in one direction. By default, file + descriptor passing is negotiated for all connections. - sd_bus_negotiate_timestamp() controls whether implicit sender - timestamps shall be attached automatically to all incoming messages. Takes a bus object and a - boolean, which, when true, enables timestamping, and, when false, disables it. Use + sd_bus_negotiate_timestamp() controls whether implicit sender timestamps shall + be attached automatically to all incoming messages. Takes a bus object and a boolean, which, when true, + enables timestamping, and, when false, disables it. Use sd_bus_message_get_monotonic_usec3, sd_bus_message_get_realtime_usec3, sd_bus_message_get_seqnum3 - to query the timestamps of incoming messages. If negotiation is disabled or not supported, these - calls will fail with -ENODATA. Note that currently no transports support - timestamping of messages. By default, message timestamping is not negotiated for - connections. + to query the timestamps of incoming messages. If negotiation is disabled or not supported, these calls + will fail with -ENODATA. Note that currently no transports support timestamping of + messages. By default, message timestamping is not negotiated for connections. sd_bus_negotiate_creds() controls whether and which implicit sender - credentials shall be attached automatically to all incoming messages. Takes a bus object and a - boolean indicating whether to enable or disable the credential parts encoded in the bit mask - value argument. Note that not all transports support attaching sender credentials to messages, - or do not support all types of sender credential parameters, or might suppress them under - certain circumstances for individual messages. Specifically, dbus1 only supports - SD_BUS_CREDS_UNIQUE_NAME. The sender credentials are suitable for - authorization decisions. By default, only SD_BUS_CREDS_WELL_KNOWN_NAMES and - SD_BUS_CREDS_UNIQUE_NAME are enabled. In fact, these two credential fields - are always sent along and cannot be turned off. + credentials shall be attached automatically to all incoming messages. Takes a bus object and a boolean + indicating whether to enable or disable the credential parts encoded in the bit mask value argument. Note + that not all transports support attaching sender credentials to messages, or do not support all types of + sender credential parameters, or might suppress them under certain circumstances for individual messages. + Specifically, dbus1 only supports SD_BUS_CREDS_UNIQUE_NAME. The sender credentials + are suitable for authorization decisions. By default, only + SD_BUS_CREDS_WELL_KNOWN_NAMES and SD_BUS_CREDS_UNIQUE_NAME are + enabled. In fact, these two credential fields are always sent along and cannot be turned off. - The sd_bus_negotiate_fds() function may - be called only before the connection has been started with + sd_bus_get_creds_mask() returns the set of sender credentials that was + negotiated to be attached to all incoming messages in mask. This value is an + upper boundary only. Hence, always make sure to explicitly check which credentials are attached to a + specific message before using it. + + The sd_bus_negotiate_fds() function may be called only before the connection + has been started with sd_bus_start3. Both - sd_bus_negotiate_timestamp() and - sd_bus_negotiate_creds() may also be called - after a connection has been set up. Note that, when operating on a - connection that is shared between multiple components of the same - program (for example via - sd_bus_default3), - it is highly recommended to only enable additional per message - metadata fields, but never disable them again, in order not to - disable functionality needed by other components. + sd_bus_negotiate_timestamp() and sd_bus_negotiate_creds() may + also be called after a connection has been set up. Note that, when operating on a connection that is + shared between multiple components of the same program (for example via + sd_bus_default3), it + is highly recommended to only enable additional per message metadata fields, but never disable them + again, in order not to disable functionality needed by other components. Return Value - On success, these functions return 0 or a - positive integer. On failure, they return a negative errno-style - error code. + On success, these functions return a non-negative integer. On failure, they return a negative + errno-style error code. Errors @@ -120,6 +121,24 @@ The bus connection has already been started. + + + -EINVAL + + An argument is invalid. + + + + -ENOPKG + + The bus cannot be resolved. + + + + -ECHILD + + The bus was created in a different process. +