summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
AgeCommit message (Collapse)Author
2015-04-10shared: add formats-util.hRonny Chevalier
2015-04-10bus-util: be more verbose if dbus job failsMichal Sekletar
Users might have hard time figuring out why exactly their systemctl request failed. If dbus job fails try to figure out more details about failure by examining Result property of the service. https://bugzilla.redhat.com/show_bug.cgi?id=1016680
2015-04-09bus: simplify bus_message_read_strv_extend()David Herrmann
Avoid unbound for(;;) loop and use the established coding-style: while ((r = sd_bus_message_read*(...)) > 0) { } if (r < 0) return r; This is much easier to read and used all over the code base.
2015-04-09bus: use free_and_strdup()David Herrmann
Save some LOCs by replacing strdup()+error-handling+free+assign with free_and_strdup().
2015-04-09util: add shell_maybe_quote() call for preparing a string for shell cmdline ↵Lennart Poettering
inclusion If necessary the passed string is enclosed in "", and all special characters escapes. This also ports over usage in bus-util.c and job.c to use this, instead of a incorrect local implementation that forgets to properly escape.
2015-04-07polkit: rename bus_verify_polkit() to bus_test_polkit() and make it strictly ↵Lennart Poettering
non-interactive Interactive authorization should only happen asynchronously, hence disallow it in synchronous bus_verify_polkit(), and rename it to bus_test_polkit(). This way even if the bus message header asks for interactive authorization, we'll ask for non-interactive authorization which is actually the desired behaviour if CanSuspend, CanHibernate and friends, which call this function.
2015-03-13bus: explicitly ignore failure during error handlingZbigniew Jędrzejewski-Szmek
CID #1237548.
2015-03-13Use space after a silencing (void)Zbigniew Jędrzejewski-Szmek
We were using a space more often than not, and this way is codified in CODING_STYLE.
2015-03-13tree-wide: there is no ENOTSUP on linuxDavid Herrmann
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses.
2015-03-13bus: stop using EDEADLOCKDavid Herrmann
The error code is called EDEADLK, stop using legacy names like EDEADLOCK. Note that _some_ weird architectures define them differently (namely, mips and sparc), but on all sane architectures they're exactly the same. So stay with the widely used code, which is EDEADLK.
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-03-11bus: drop redundant assignmentDavid Herrmann
This assignment is already done in the parent context, no need to do it again.
2015-03-07bus: fix leak in error pathZbigniew Jędrzejewski-Szmek
CID #1271349.
2015-03-07bus-util: remove stray errno assignmentZbigniew Jędrzejewski-Szmek
2015-03-02sd-bus: sync kdbus.h (ABI break)Daniel Mack
After some reconsideration, we decided to move the binary protocol back to 64-bit wide UIDs and GIDs. After all, it should be possible to redefine [gu]id_t to uint64_t and things should continue to work. As we want to avoid such data types in kdbus.h, let's move back to 64-bit values and be safe. In sd-bus, we have to do a translation between uint64_t and gid_t now for supplementary gids. Some inline comments have also been updated in kdbus upstream.
2015-02-24sd-bus: test-bus-kernel-benchmark: don't rely on fixed unique namesDaniel Mack
The kernel part of kdbus does not allow userspace to make any assumption on which unique address the first user on the bus will get. Instead, use sd_bus_get_unique_name() to get the server's address.
2015-02-24sd-bus: sync kdbus.hDaniel Mack
Follow two small changes in the kdbus API: * Flags are now returned in cmd->return_flags by KDBUS_CMD_NAME_ACQUIRE * struct kdbus_item_list has been dropped. The information stored in this struct was redundant since awhile already, as all commands report their returned slice size anyway.
2015-02-24sd-bus, shared: fix includesDaniel Mack
Include <sys/socket.h> from util.h and bus-message.h in order to build errors like the ones below on kdbus enabled systems. ./src/shared/util.h:976:32: warning: its scope is only this definition or declaration, which is probably not what you want In file included from src/libsystemd/sd-bus/bus-kernel.c:37:0: ./src/shared/util.h:1081:28: warning: 'struct msghdr' declared inside parameter list void cmsg_close_all(struct msghdr *mh); ^ CC src/libsystemd/sd-bus/libsystemd_la-bus-creds.lo In file included from src/libsystemd/sd-bus/bus-creds.c:25:0: ./src/shared/util.h:976:32: warning: 'struct ucred' declared inside parameter list int getpeercred(int fd, struct ucred *ucred); ^
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-19bus: sync with kdbus.git (ABI break)David Herrmann
This syncs up the new KDBUS_CMD_CONN_INFO behavior: - attach-flags are passed in .attach_flags, instead of directly merged with the command flags.
2015-02-18logind: open up most bus calls for unpriviliged processes, using PolicyKitLennart Poettering
Also, allow clients to alter their own objects without any further priviliges. i.e. this allows clients to kill and lock their own sessions without involving PK.
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-17bus: sync with kdbusDavid Herrmann
Pull in new kdbus changes, namely: - EOVERFLOW is replaces by KDBUS_RECV_RETURN_DROPPED_MSGS - ENOMSG is merged with EAGAIN for consistency
2015-02-17bus: don't rely on static IDs in testsDavid Herrmann
We should never put any constraints on the IDs returned by the kernel. Use sd_bus_get_unique_name() to retrieve the ID of a peer.
2015-02-16sd-bus: make sure we always serialize the reply cookie as 64bit on dbus2, ↵Lennart Poettering
and 32bit on dbus1
2015-02-16Revert "Revert "sd-bus: change serialization of kdbus messages to qualify in ↵Lennart Poettering
their entirety as gvariant objects"" This reverts commit 954871d8ba15911d014f76ed2c7a9492953cf39d.
2015-02-13sd-bus: initialize a few structs at time or declarationLennart Poettering
2015-02-13exit-on-idle: only exit if actually idleTom Gundersen
sd_event_wait() returning 0 usually means that it timed out, which means it must have been idle. However, sd_event_wait() may return 0 in case an event was triggered but it turned out there was nothing to do. Make the check for idle explicit to avoid this edge-case.
2015-02-13sd-bus: export sd_bus_error_set_errnofv()Lennart Poettering
2015-02-13sd-bus: sync kdbus.h (ABI break)Daniel Mack
Another slice logic rework in kdbus made KDBUS_ITEM_PAYLOAD_OFF items relative to the message header again. Catch up with that in sd-bus.
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-12Add missing includes in header filesThomas Hindoe Paaboel Andersen
This fixes various issues found by globally reordering the include sections of all .c files.
2015-02-11tree-wide: whenever we include libgen.h, immediately undefine basename()Lennart Poettering
Also, document in adjacent comments and in CODING_STYLE why we do that.
2015-02-05bus: sync with kdbus (ABI break)David Herrmann
2015-02-03core: open up DefaultDependencies= property for transient unitsLennart Poettering
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-02-01Add a snprinf wrapper which checks that the buffer was big enoughZbigniew Jędrzejewski-Szmek
If we scale our buffer to be wide enough for the format string, we should expect that the calculation was correct. char_array_0() invocations are removed, since snprintf nul-terminates the output in any case. A similar wrapper is used for strftime calls, but only in timedatectl.c.
2015-01-30Revert "sd-bus: change serialization of kdbus messages to qualify in their ↵Kay Sievers
entirety as gvariant objects" This breaks booting with kdbus. This reverts commit b381de4197157748ed96e469fcc372c23f842ae1.
2015-01-26sd-bus: change serialization of kdbus messages to qualify in their entirety ↵Lennart Poettering
as gvariant objects Previously, we only minimally altered the dbus1 framing for kdbus, and while the header and its fields where compliant Gvariant objects, and so was the body, the entire message together was not. As result of discussions with Ryan Lortie this is now changed, so that the messages in there entirely are fully compliant GVariants. This follows the framing description described here: https://wiki.gnome.org/Projects/GLib/GDBus/Version2 Note that this change changes the framing of *all* messages sent via kdbus, this means you have to reboot your kdbus system, after compiling and installing this new version.
2015-01-26bus-dump: fix two minor memory leaksLennart Poettering
2015-01-26sd-bus: reuse the KDBUS_CMD_FREE wrapper wherever appropriateLennart Poettering
2015-01-23sd-bus: fix typoLennart Poettering
2015-01-23sd-bus: fix handling of double parameters in sd_bus_message_append()Lennart Poettering
We really need to use va_arg() with the right type here as uint64_t and double might have the same size, but are passed differently as arguments.
2015-01-22tests: use assert_se instead of assertRonny Chevalier
Otherwise they can be optimized away with -DNDEBUG
2015-01-22Assorted format fixesZbigniew Jędrzejewski-Szmek
Types used for pids and uids in various interfaces are unpredictable. Too bad.
2015-01-22Fix some format strings for enums, they are signedZbigniew Jędrzejewski-Szmek
2015-01-22import: introduce new mini-daemon systemd-importd, and make machinectl a ↵Lennart Poettering
client to it The old "systemd-import" binary is now an internal tool. We still use it as asynchronous backend for systemd-importd. Since the import tool might require some IO and CPU resources (due to qcow2 explosion, and decompression), and because we might want to run it with more minimal priviliges we still keep it around as the worker binary to execute as child process of importd. machinectl now has verbs for pulling down images, cancelling them and listing them.
2015-01-18bus: drop systemd.kdbus_attach_flags_mask= cmdlineDavid Herrmann
There is no reason to provide our own attach_flags_mask. We can simply rely on kdbus.attach_flags_mask= which is read by the kernel *and* kmod. If it's set, we assume the user wants to override our setting, so we simply skip setting it.
2015-01-18bus: fix SD_BUS_CREDS_AUGMENT on kdbus queriesDavid Herrmann
If we set SD_BUS_CREDS_AUGMENT, we *need* the PID from the kernel so we can lookup further information from /proc. However, we *must* set SD_BUS_CREDS_PIDS in "mask", otherwise, our creds-collector will never actually copy the pid into "sd_bus_creds". Fix this, so SD_BUS_CREDS_AUGMENT works even if SD_BUS_CREDS_PID is not specified by the caller.
2015-01-18bus: fix typoDavid Herrmann
Fix comment typo and clarify that this is not about privileges but can have rather arbitrary reasons.