Commit graph

19 commits

Author SHA1 Message Date
Lennart Poettering 5b12334d35 bus: add new sd_bus_creds object to encapsulate process credentials
This way we can unify handling of credentials that are attached to
messages, or can be queried for bus name owners or connection peers.

This also adds the ability to extend incomplete credential information
with data from /proc,

Also, provide a convenience call that will automatically determine the
most appropriate credential object for an incoming message, by using the
the attached information if possible, the sending name information if
available and otherwise the peer's credentials.
2013-11-28 18:42:18 +01:00
David Herrmann 5fd38859b3 bus: add bus_name_has_owner() helper
Small helper to run a synchronous "NameHasOwner" request on the
dbus-daemon.
2013-11-28 15:16:49 +01:00
Lennart Poettering edb5dd1875 bus: protected dual timestamp property macro for misusage 2013-11-22 20:19:54 +01:00
Lennart Poettering ebcf1f97de bus: rework message handlers to always take an error argument
Message handler callbacks can be simplified drastically if the
dispatcher automatically replies to method calls if errors are returned.

Thus: add an sd_bus_error argument to all message handlers. When we
dispatch a message handler and it returns negative or a set sd_bus_error
we send this as message error back to the client. This means errors
returned by handlers by default are given back to clients instead of
rippling all the way up to the event loop, which is desirable to make
things robust.

As a side-effect we can now easily turn the SELinux checks into normal
function calls, since the method call dispatcher will generate the right
error replies automatically now.

Also, make sure we always pass the error structure to all property and
method handlers as last argument to follow the usual style of passing
variables for return values as last argument.
2013-11-21 21:12:36 +01:00
Lennart Poettering 718db96199 core: convert PID 1 to libsystemd-bus
This patch converts PID 1 to libsystemd-bus and thus drops the
dependency on libdbus. The only remaining code using libdbus is a test
case that validates our bus marshalling against libdbus' marshalling,
and this dependency can be turned off.

This patch also adds a couple of things to libsystem-bus, that are
necessary to make the port work:

- Synthesizing of "Disconnected" messages when bus connections are
  severed.

- Support for attaching multiple vtables for the same interface on the
  same path.

This patch also fixes the SetDefaultTarget() and GetDefaultTarget() bus
calls which used an inappropriate signature.

As a side effect we will now generate PropertiesChanged messages which
carry property contents, rather than just invalidation information.
2013-11-20 20:52:36 +01:00
Lennart Poettering 41dd15e474 systemctl: restore ability to directly connect to PID1 from systemctl 2013-11-08 17:07:42 +01:00
Marc-Antoine Perennou f459b6025f systemctl: port to libsystemd-bus 2013-11-08 14:07:27 +01:00
Lennart Poettering 5b30bef856 bus: log message parsing errors everywhere with a generalized bus_log_parse_error() 2013-11-07 21:26:31 +01:00
Simon Peeters 27e72d6b22 bus: make bus_print_all_properties work for non machinectl cases
add a destination parameter and skip properties we can't read
2013-11-07 14:18:35 +01:00
Kay Sievers 9f6eb1cd58 bus: update bus_map_all_properties() 2013-11-05 02:57:49 +01:00
Lennart Poettering cc37738108 logind: port logind to libsystemd-bus 2013-11-05 01:13:05 +01:00
Lennart Poettering e650403069 bus: make it easy to serialize C99 bools and uids/gids/pids via vtable properties 2013-11-05 01:13:05 +01:00
Kay Sievers ffc06c3513 bus: use internal helper to read org.freedesktop.DBus.Properties::GetAll variables 2013-11-02 01:48:22 +01:00
Lennart Poettering d21ed1ead1 run: add support for executing commands remotely via SSH or in a container
Also, unify the transport logic a bit, since we reuse the same scheme in
many of our client tools.
2013-10-30 16:44:55 +01:00
Lennart Poettering 0f8bd8debb bus: move ssh support into public API of libsystem-bus 2013-10-30 15:35:49 +01:00
Tom Gundersen a1da85830b machinectl: port to sd-bus 2013-10-30 03:40:23 +01:00
Lennart Poettering c335068380 machined: port over to libsystemd-bus 2013-10-30 02:08:57 +01:00
Tom Gundersen 0c842e0ac0 fsck: port to sd-bus 2013-10-18 00:55:24 +02:00
Lennart Poettering 40ca29a137 timedated: use libsystemd-bus instead of libdbus for bus communication
Among other things this also adds a few things necessary for the change:

- Considerably more powerful error returning APIs in libsystemd-bus

- Adapter for connecting an sd_bus to an sd_event

- As I reworked the PolicyKit logic to the new library I also made it
  asynchronous, so that PolicyKit requests of one user cannot block out
  another user anymore.

- We always use the macro names for common bus error. That way it is
  harder to mistype them since the compiler will notice
2013-10-16 06:15:02 +02:00