summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
AgeCommit message (Collapse)Author
2015-06-10Merge pull request #85 from keszybz/selinux-contextZbigniew Jędrzejewski-Szmek
2015-06-10sd-bus: remove ucred parameter from bus_message_from_header() since we don't ↵Lennart Poettering
use it anymore
2015-06-10sd-bus: fix early exit when we lack all data in bus_get_owner_creds_dbus1()Lennart Poettering
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: do not use per-datagram auxiliary informationZbigniew Jędrzejewski-Szmek
SELinux information cannot be retrieved this way, since we are using stream unix sockets and SCM_SECURITY does not work for them. SCM_CREDENTIALS use dropped to be consistent. We also should get this information at connection time. https://bugzilla.redhat.com/show_bug.cgi?id=1224211 "SCM_SECURITY was only added for datagram sockets."
2015-06-10sd-bus: Correct typoTorstein Husebø
2015-06-10Merge pull request #117 from ↵Lennart Poettering
utezduyar/feat/dump-sync-dbus-message-with-logging-on sd-bus: dump sync messages in debug mode
2015-06-10sd-bus: dump sync messages in debug modeUmut Tezduyar Lindskog
2015-06-10tree-wide: whenever we fork off a foreign child process reset signal ↵Lennart Poettering
mask/handlers Also, when the child is potentially long-running make sure to set a death signal. Also, ignore the result of the reset operations explicitly by casting them to (void).
2015-06-09bus-creds: always set SD_BUS_CREDS_PID when we set pid in the maskZbigniew Jędrzejewski-Szmek
Also reorder the code a bit to be easier to parse.
2015-06-09sd-bus: add async convenience method call APIUmut Tezduyar Lindskog
2015-06-05bus: don't force send-masks on kdbus busesDavid Herrmann
Right now we always pass KDBUS_ITEM_ATTACH_FLAGS_RECV to KDBUS_CMD_BUS_MAKE, effectively forcing every bus connection to do the same during KDBUS_CMD_HELLO. This used to be a workaround to make sure all metadata is always present. However, we refrained from that approach and intend to make all metadata collection solely rely on /proc access restrictions. Therefore, there is no need to force the send-flags mask on newly created buses.
2015-06-04bus: update kdbus.hDavid Herrmann
Sync with upstream.
2015-06-03kdbus: remove attach_flags_mask module parameter settingKay Sievers
2015-05-29util: split out signal-util.[ch] from util.[ch]Lennart Poettering
No functional changes.
2015-05-26treewide: fix typosTorstein Husebø
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-05-19bus-socket: simplify initalization of struct msghdrZbigniew Jędrzejewski-Szmek
2015-05-15systemctl: introduce --now for enable, disable and maskJan Synacek
https://bugs.freedesktop.org/show_bug.cgi?id=42940
2015-05-14test-bus-chat: various modernizationsLennart Poettering
2015-05-14sd-bus: fix memory leak in test-bus-chatCristian Rodríguez
Building with address sanitizer enabled on GCC 5.1.x a memory leak is reported because we never close the bus, fix it by using cleanup variable attribute.
2015-05-14util: introduce memmem_safe() and make use of itLennart Poettering
GNU memmem() requires a nonnull first parameter. Let's introduce memmem_safe() that removes this restriction for zero-length parameters, and make use of it where appropriate. http://lists.freedesktop.org/archives/systemd-devel/2015-May/031705.html
2015-05-11treewide: Correct typos and spell plural of bus consistentTorstein Husebø
2015-05-06bus: don't switch to kdbus if not requestedDavid Herrmann
Whenever systemd is re-executed, it tries to create a system bus via kdbus. If the system did not have kdbus loaded during bootup, but the module is loaded later on manually, this will cause two system buses running (kdbus and dbus-daemon in parallel). This patch makes sure we never try to create kdbus buses if it wasn't explicitly requested on the command-line.
2015-04-30sd-bus,sd-login: add api for querying the slice within the the user systemd ↵Lennart Poettering
instance of a process units are organized in slice trees, not only for the system instance, but also for user systemd instances, expose this properly.
2015-04-30sd-bus: when we get ENOTTY on the HELLO ioctl assume incompatible API versionLennart Poettering
As perparation for future incompatible kdbus kernel API changes.
2015-04-29sd-bus: properly handle creds that are known but undefined for a processLennart Poettering
A number of fields do not apply to all processes, including: there a processes without a controlling tty, without parent process, without service, user services or session. To distuingish these cases from the case where we simply don't have the data, always return ENXIO for them, while returning ENODATA for the case where we really lack the information. Also update the credentials dumping code to show this properly. Fields that are known but do not apply are now shown as "n/a". Note that this also changes some of the calls in process-util.c and cgroup-util.c to return ENXIO for these cases.
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-04-29test: rename test-bus-kernel-benchmark to test-bus-benchmarkTom Gundersen
This can now benchmark more than just kdbus.
2015-04-29sd-bus: benchmark - also support testing non-kdbus transportsTom Gundersen
We introduce two news types of benchmarks in chart-mode: - 'legacy' connects using the session bus - 'direct' connects using a peer-to-peer socket We should probably also introduce a mode for testing the dbus1-kdbus proxy.
2015-04-28bus-util: drop redundant bus argument from bus_message_map_all_properties() ↵Lennart Poettering
and related calls
2015-04-28run: synchronously wait until the scope unit we create is startedLennart Poettering
Otherwise it might happen that by the time PID 1 adds our process to the scope unit the process might already have died, if the process is short-running (such as an invocation to /bin/true). https://bugs.freedesktop.org/show_bug.cgi?id=86520
2015-04-28bus-util: print correct warnings for units that fail but for which we have a ↵Lennart Poettering
NULL result only
2015-04-24sd-bus: teach bus_print_property() how to print SD_BUS_TYPE_INT64Daniel Mack
2015-04-23sd-bus: add controlling tty field to sd_creds objectLennart Poettering
This is useful to print wall messages from logind with the right client tty. (to be added in a later patch)
2015-04-23sd-bus: when bus operations are to be executed on direct connections always failLennart Poettering
Also, don't consider this an loggable event, so that code that tries to read creds from a direct connection, doesn't generate logs.
2015-04-23sd-bus: don't inherit connection creds into message creds when we have a ↵Lennart Poettering
direct connection It's never a good idea, let's just not do it, not even on dierct connections.
2015-04-23core: explicitly specify credentials for direct connections, tooLennart Poettering
So far we authenticate direct connections primarily at connection time, but let's also do this for each method individually, by attaching the creds we need for that right away.
2015-04-22sd-bus: handle ppid=0 more gracefully (which happens for pid=1)Lennart Poettering
2015-04-21sd-bus: expose ppid fieldLennart Poettering
kdbus has been passing us the ppid file for a while, actually make use of it.
2015-04-21sd-bus: when augmenting creds, remember which ones were augmentedLennart Poettering
Also, when we do permissions checks using creds, verify that we don't do so based on augmented creds, as extra safety check.
2015-04-21sd-bus: augmenting cgroups-based creds when we have the cgroup path already ↵Lennart Poettering
is free
2015-04-21sd-bus: when augmenting creds, don't override any creds in any caseLennart Poettering
Let's better be safe than sorry.
2015-04-21sd-bus: when copying creds objects, make sure we copy even the implicit well ↵Lennart Poettering
known names
2015-04-16sd-bus: add more comments to the credential decision logicLennart Poettering
2015-04-12bus-util: add articles to explanation messagesZbigniew Jędrzejewski-Szmek
We are talking about one member of a group of things (resource limits, signals, timeouts), without specifying which one. An indenfinite article is in order. When we are talking about the control process, it's a specific one, so the definite article is used.
2015-04-11bus: implement bus_path_{en,de}code_unique()David Herrmann
Whenever we provide a bus API that allows clients to create and manage server-side objects, we need to provide a unique name for these objects. There are two ways to provide them: 1) Let the server choose a name and return it as method reply. 2) Let the client pass its name of choice in the method arguments. The first method is the easiest one to implement. However, it suffers from a race condition: If a client creates an object asynchronously, it cannot destroy that object until it received the method reply. It cannot know the name of the new object, thus, it cannot destroy it. Furthermore, this method enforces a round-trip. If the client _depends_ on the method call to succeed (eg., it would close() the connection if it failed), the client usually has no reason to wait for the method reply. Instead, the client can immediately schedule further method calls on the newly created object (in case the API guarantees in-order method-call handling). The second method fixes both problems: The client passes an object name with the method-call. The server uses it to create the object. Therefore, the client can schedule object destruction even if the object-creation hasn't finished, yet (again, requiring in-order method-call handling). Furthermore, the client can schedule further method calls on the newly created object, before the constructor returned. There're two problems to solve, though: 1) Object names are usually defined via dbus object paths, which are usually globally namespaced. Therefore, multiple clients must be able to choose unique object names without interference. 2) If multiple libraries share the same bus connection, they must be able to choose unique object names without interference. The first problem is solved easily by prefixing a name with the unique-bus-name of a connection. The server side must enforce this and reject any other name. The second problem is solved by providing unique suffixes from within sd-bus. As long as sd-bus always returns a fresh new ID, if requested, multiple libraries will never interfere. This implementation re-uses bus->cookie as ID generator, which already provides unique IDs for each bus connection. This patch introduces two new helpers: bus_path_encode_unique(sd_bus *bus, const char *prefix, const char *sender_id, const char *external_id, char **ret_path); This creates a new object-path via the template '/prefix/sender_id/external_id'. That is, it appends two new labels to the given prefix. If 'sender_id' is NULL, it will use bus->unique_name, if 'external_id' is NULL, it will allocate a fresh, unique cookie from bus->cookie. bus_path_decode_unique(const char *path, const char *prefix, char **ret_sender, char **ret_external); This reverses what bus_path_encode_unique() did. It parses 'path' from the template '/prefix/sender/external' and returns both suffix-labels in 'ret_sender' and 'ret_external'. In case the template does not match, 0 is returned and both output arguments are set to NULL. Otherwise, 1 is returned and the output arguments contain the decoded labels. Note: Client-side allocated IDs are inspired by the Wayland protocol (which itself was inspired by X11). Wayland uses those IDs heavily to avoid round-trips. Clients can create server-side objects and send method calls without any round-trip and waiting for any object IDs to be returned. But unlike Wayland, DBus uses gobally namespaced object names. Therefore, we have to add the extra step by adding the unique-name of the bus connection.
2015-04-11shared: add terminal-util.[ch]Ronny Chevalier