summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/sd-bus.c
AgeCommit message (Collapse)Author
2015-07-03sd-bus: introduce new sd_bus_flush_close_unref() callLennart Poettering
sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush() (which writes all unwritten messages out) + sd_bus_close() (which terminates the connection, releasing all unread messages) + sd_bus_unref() (which frees the connection). The combination of this call is used pretty frequently in systemd tools right before exiting, and should also be relevant for most external clients, and is hence useful to cover in a call of its own. Previously the combination of the three calls was already done in the _cleanup_bus_close_unref_ macro, but this was only available internally. Also see #327
2015-06-17bus: fix installing DRIVER matches on kdbusDavid Herrmann
In kdbus we still have to support org.freedesktop.DBus matches even though there is no real bus driver. The reason is that bus-control.c turns NameOwnerChanged matches into proper kdbus matches. If we drop DRIVER matches early, we will never match on name-changes for kdbus. Two ways to fix this: 1) Install DRIVER matches on kdbus (which is the simple way our and which is what this patch does). 2) Properly fix the scope-detection to let NameOwnerChanged matches through (or better: block anything with Member!=NameOwnerChanged).
2015-06-17turn kdbus support into a runtime optionKay Sievers
./configure --enable/disable-kdbus can be used to set the default behavior regarding kdbus. If no kdbus kernel support is available, dbus-dameon will be used. With --enable-kdbus, the kernel command line option "kdbus=0" can be used to disable kdbus. With --disable-kdbus, the kernel command line option "kdbus=1" is required to enable kdbus support.
2015-06-17sd-bus: suppress installing local bus matches server sideLennart Poettering
Matches that can only match against messages from the org.freedesktop.DBus.Local service (or the local interfaces or path) should never be installed server side, suppress them hence. Similar, on kdbus matches that can only match driver messages shouldn't be passed to the kernel.
2015-06-10Merge pull request #85 from keszybz/selinux-contextZbigniew Jędrzejewski-Szmek
2015-06-10bus-message: remove shadow warning with log_debug_bus_message()Lennart Poettering
2015-06-10sd-bus: store selinux context at connection timeZbigniew Jędrzejewski-Szmek
This appears to be the right time to do it for SOCK_STREAM unix sockets. Also: condition bus_get_owner_creds_dbus1 was reversed. Split it out to a separate variable for clarity and fix. https://bugzilla.redhat.com/show_bug.cgi?id=1224211
2015-06-10sd-bus: Correct typoTorstein Husebø
2015-06-10sd-bus: dump sync messages in debug modeUmut Tezduyar Lindskog
2015-05-22sd-bus,sd-event: make public APIsLennart Poettering
With the v221 release these APIs should be public, stable APIs, hence let's install their headers by default now, and add their symbols to the .sym file.
2015-04-29sd-bus: allow passing NULL as bus parameter to sd_bus_send()Lennart Poettering
If NULL is specified for the bus it is now automatically derived from the passed in message. This commit also changes a number of invocations of sd_bus_send() to make use of this.
2015-04-29sd-bus: drop bus parameter from message callback prototypeLennart Poettering
This should simplify the prototype a bit. The bus parameter is redundant in most cases, and in the few where it matters it can be derived from the message via sd_bus_message_get_bus().
2015-03-13tree-wide: there is no ENOTSUP on linuxDavid Herrmann
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
2015-03-11bus: remarshal kdbus messages received from the kernelDavid Herrmann
If we receive an sd_bus_message from the kernel, m->kdbus will contain additional items that cannot be used when sending a message. Therefore, always remarshal the message if it is used again.
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
2015-02-18sd-bus: allow setting a per-connection default value for the ↵Lennart Poettering
"allow-interactive-authentication" message flag Most of our client tools want to set this bit for all their method calls, even though it defaults to off in sd-bus, and rightfully so. Hence, to simplify thing, introduce a per sd_bus-object flag that sets the default value for all messages created on the connection.
2015-02-12include <poll.h> instead of <sys/poll.h>Thomas Hindoe Paaboel Andersen
include-what-you-use automatically does this and it makes finding unnecessary harder to spot. The only content of poll.h is a include of sys/poll.h so should be harmless.
2015-02-03util: rework strappenda(), and rename it strjoina()Lennart Poettering
After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
2015-01-09sd-bus: even if we need a cookie when sending a message there's no need to ↵Lennart Poettering
needlessly send it if we don't actually need it
2015-01-07sd-bus: when we synthesize messages, initialize timestamps ourselvesLennart Poettering
2015-01-07sd-bus: unify how we set the sender of synthetic messagesLennart Poettering
2015-01-05machined,bus-proxy: fix connecting to containersLennart Poettering
2014-12-24sd-bus: rename sd_bus_open_system_container() to sd_bus_open_system_machine()Lennart Poettering
Pretty much everywhere else we use the generic term "machine" when referring to containers in API, so let's do though in sd-bus too. In particular, since the concept of a "container" exists in sd-bus too, but as part of the marshalling system.
2014-12-23sd-bus: teach x-container-unix: bus protoocol to connect to the namespace of ↵Lennart Poettering
a PID instead of a container name
2014-12-11sd-bus: correct spacing near eol in code commentsTorstein Husebø
2014-12-04sd-bus: avoid a null dereferenceThomas Hindoe Paaboel Andersen
2014-11-28sd-bus: make more connection properties readableLennart Poettering
2014-11-28sd-bus: add new sd_bus_get_address() for querying the current bus addressLennart Poettering
Also, update "busctl" to show this in its output.
2014-11-28sd-bus: rename sd_bus_get_owner_id() → sd_bus_get_bus_id()Lennart Poettering
The ID returned really doesn't identify the owner, but the bus instance, hence fix this misnaming. Also, update "busctl status" to show the ID in its output.
2014-11-28sd-bus: rename default bus address constants, they aren't "paths" but ↵Lennart Poettering
"addresses"
2014-11-28sd-bus: add new call sd_bus_get_scope() for querying whether one is ↵Lennart Poettering
connected to a system or a user bus
2014-11-27sd-bus: set creds info for "org.freedesktop.DBus.Local" generated messages, tooLennart Poettering
2014-11-26sd-bus: make sure that when we connect to the system bus we have enough ↵Lennart Poettering
creds to make security decisions
2014-11-26sd-bus: add suppot for renegotiating message credential attach flagsLennart Poettering
2014-11-25sd-bus: update to current kernel version, by splitting off the extended ↵Lennart Poettering
KDBUS_ITEM_PIDS structure from KDBUS_ITEM_CREDS Also: - adds support for euid, suid, fsuid, egid, sgid, fsgid fields. - makes augmentation of creds with data from /proc explicitly controllable to give apps better control over this, given that this is racy. - enables augmentation for kdbus connections (previously we only did it for dbus1). This is useful since with recent kdbus versions it is possible for clients to control the metadata they want to send. - changes sd_bus_query_sender_privilege() to take the euid of the client into consideration, if known - when we don't have permissions to read augmentation data from /proc, don't fail, just don't add the data in
2014-11-13sd-bus: sync with kdbus upstream (ABI break)Daniel Mack
kdbus has seen a larger update than expected lately, most notably with kdbusfs, a file system to expose the kdbus control files: * Each time a file system of this type is mounted, a new kdbus domain is created. * The layout inside each mount point is the same as before, except that domains are not hierarchically nested anymore. * Domains are therefore also unnamed now. * Unmounting a kdbusfs will automatically also detroy the associated domain. * Hence, the action of creating a kdbus domain is now as privileged as mounting a filesystem. * This way, we can get around creating dev nodes for everything, which is last but not least something that is not limited by 20-bit minor numbers. The kdbus specific bits in nspawn have all been dropped now, as nspawn can rely on the container OS to set up its own kdbus domain, simply by mounting a new instance. A new set of mounts has been added to mount things *after* the kernel modules have been loaded. For now, only kdbus is in this set, which is invoked with mount_setup_late().
2014-11-04sd-bus: rename sd_bus_get_server_id() to sd_bus_get_owner_id()Lennart Poettering
In kdbus a "server id" is mostly a misnomer, as there isn't any "server" involved anymore. Let's rename this to "owner" id hence, since it is an ID that is picked by the owner of a bus or direct connection. This matches nicely the sd_bus_get_owner_creds() call we already have.
2014-11-04sd-bus,sd-event: unify error handling of object descriptionsLennart Poettering
a) When getting the description return ENXIO if none is set b) Allow setting a description to NULL c) return ECHILD on fork() like for other calls
2014-11-04sd-bus: make use of free_and_strdup() where it makes senseLennart Poettering
2014-11-04sd-event: rename sd_event_source_set_name() to sd_event_source_get_name()Lennart Poettering
To mirror the recent name change of the concept for sd_bus objects, follow the same logic for sd_event_source objects, too.
2014-11-04sd-bus: rename "connection name" to "description" for the sd-bus API tooLennart Poettering
kdbus recently renamed this concept, and so should we in what we expose in userspace.
2014-10-27sd-bus: explicitly cast asprintf() return value away we are not interested inLennart Poettering
Let's give coverity a hint what's going on here.
2014-10-27Revert "sd-bus: check return value of asprintf()"Lennart Poettering
This reverts commit b1543c4c93855b61b40118e9f14a0423dac2e078. We check b->address anyway, no need to check the return value, especially given that the other #ifdef branch don't get the same treatment.
2014-10-23sd-bus: make sd_bus::reply_callbacks a OrderedHashmapMichal Schmidt
The way process_closing() picks the first entry from reply_callbacks and works with it makes it likely that it cares about the order.
2014-10-22machine: validate machine names using machine_name_is_valid() instead of ↵Lennart Poettering
string_is_safe() After all, we know have this as generic validator, so let's be correct and use it wherver applicable.
2014-10-22sd-bus: implement sd_bus_get_owner_creds() for kdbusDaniel Mack
kdbus learned a new ioctl to tell userspace about a bus creator's credentials, which is what we need to implement sd_bus_get_owner_creds() for kdbus. Move the function from sd-bus.c to bus-control.c to be able to reuse the bus_populate_creds_from_items() helper.
2014-10-22sd-bus: rename sd_bus_get_owner_uid(), sd_bus_get_owner_machine_id() and ↵Daniel Mack
sd_bus_get_peer_creds() Clean up the function namespace by renaming the following: sd_bus_get_owner_uid() → sd_bus_get_name_creds_uid() sd_bus_get_owner_machine_id() → sd_bus_get_name_machine_id() sd_bus_get_peer_creds() → sd_bus_get_owner_creds()
2014-10-17Revert "sd-bus: sync kdbus.h (ABI break)"Kay Sievers
This reverts commit 1a2409e262da65a4b0ca8ab18fcf5eabd2d404ca. Support from the kdbus interface was removed. We require memfds to be supported by all clients.
2014-10-14sd-bus: sync kdbus.h (ABI break)Daniel Mack
kdbus learned KDBUS_HELLO_ACCEPT_MEMFD as new connection negotiation flag. Set it by default in systemd for now.
2014-10-09sd-bus: check return value of asprintf()Daniel Mack
Check for OOM conditions of asprintf() in bus_set_address_user().