Commit Graph

87 Commits

Author SHA1 Message Date
Lennart Poettering 69727e6dc6 bus: reorder a few things 2014-01-28 12:33:40 +01:00
Lennart Poettering af08d2f9cd bus: add API calls for connecting to starter bus
Add new calls sd_bus_open() and sd_bus_default() for connecting to the
starter bus a service was invoked for, or -- if the process is not a
bus-activated service -- the appropriate bus for the scope the process
has been started in.
2014-01-27 21:34:54 +01:00
Lennart Poettering eee9ec0e28 bus: change API to expose "inverted" no_reply and no_auto_start message flags non-inverted 2014-01-22 20:45:05 +01:00
Lennart Poettering 766c580959 bus: add sd_bus_process_priority() to support prioq mode of kdbus 2014-01-22 20:26:58 +01:00
Lennart Poettering ca7b42c816 bus: expose priority field of messages, in preparation for prioq support 2014-01-22 20:01:23 +01:00
Lennart Poettering cccb0b2cdb bus: include connection name in credentials structure 2014-01-22 16:40:40 +01:00
Lennart Poettering 5972fe953e bus: add support for attaching name to bus connections for debugging purposes 2014-01-22 16:09:59 +01:00
Lennart Poettering 1fedcf59e0 bus: rename sd_bus_get_realtime_timestamp() to sd_bus_get_realtime_usec()
This brings the calls into similar style as the respective functions in
libsystemd-journal, and also is a bi shorter and more descriptive since
it clarifies the time unit used.
2014-01-22 11:25:39 +01:00
Lennart Poettering 4fc319887e bus: simplify naming of feature negotation calls
Two verbs in a function name suck, so let's simplify this a bit.
2014-01-22 11:21:51 +01:00
Lennart Poettering 6a0e376c1c bus: add API for querying the kdbus message sequence number 2014-01-22 11:19:26 +01:00
Zbigniew Jędrzejewski-Szmek 4cf8496d0a man: document some more bus functions 2014-01-05 00:43:22 -05:00
Zbigniew Jędrzejewski-Szmek cd6d5e1c76 man: document a batch of bus functions 2014-01-04 00:15:01 -05:00
Lennart Poettering 62ae757009 bus: correct a number of gcc format string attribute usages 2013-12-28 15:09:26 +01:00
Lennart Poettering 442e2def79 journalctl: make sure -b --foobar cannot be misunderstood as --boot=--foobar 2013-12-26 01:53:07 +01:00
Lennart Poettering 693eb9a2d4 bus: rename message "serial" to "cookie"
Even if the lower-leveld dbus1 protocol calls it "serial", let's expose
the word "cookie" for this instead, as this is what kdbus uses and since
it doesn't imply monotonicity the same way "serial" does.
2013-12-25 18:04:04 +01:00
Lennart Poettering ae095f8605 bus: wrap KDBUS_CMD_BYEBYE with a high-level call sd_bus_try_close() 2013-12-20 23:26:11 +01:00
Lennart Poettering 29a07cdb4a bus: instead of exposing the dbus1 flags when acquiring a name use our own that are closer to kdbus
This turns around DO_NOT_QUEUE into QUEUE which implies a more useful
default. (And negative options are awful anyway.)
2013-12-12 05:55:58 +01:00
Lennart Poettering adacb9575a bus: introduce "trusted" bus concept and encode access control in object vtables
Introduces a new concept of "trusted" vs. "untrusted" busses. For the
latter libsystemd-bus will automatically do per-method access control,
for the former all access is automatically granted. Per-method access
control is encoded in the vtables: by default all methods are only
accessible to privileged clients. If the SD_BUS_VTABLE_UNPRIVILEGED flag
is set for a method it is accessible to unprivileged clients too. By
default whether a client is privileged is determined via checking for
its CAP_SYS_ADMIN capability, but this can be altered via the
SD_BUS_VTABLE_CAPABILITY() macro that can be ORed into the flags field
of the method.

Writable properties are also subject to SD_BUS_VTABLE_UNPRIVILEGED and
SD_BUS_VTABLE_CAPABILITY() for controlling write access to them. Note
however that read access is unrestricted, as PropertiesChanged messages
might send out the values anyway as an unrestricted broadcast.

By default the system bus is set to "untrusted" and the user bus is
"trusted" since per-method access control on the latter is unnecessary.

On dbus1 busses we check the UID of the caller rather than the
configured capability since the capability cannot be determined without
race. On kdbus the capability is checked if possible from the attached
meta-data of a message and otherwise queried from the sending peer.

This also decorates the vtables of the various daemons we ship with
these flags.
2013-12-10 16:52:49 +00:00
Lennart Poettering 71f2ab468d bus: rework sd_bus_list_names() to return two lists for acquired and activatable names 2013-12-03 18:42:51 +01:00
Lennart Poettering e7176abbe8 bus: make sd_bus_request_name() and sd_bus_release_name() behave more like other calls
Instead of returning an enum of return codes, make them return error
codes like kdbus does internally.

Also, document this behaviour so that clients can stick to it.

(Also rework bus-control.c to always have to functions for dbus1 vs.
kernel implementation of the various calls.)
2013-12-03 18:02:46 +01:00
Lennart Poettering 95c4fe8271 busctl: add command to dump creds of a peer or pid
(also, rename _SD_BUS_CREDS_MAX to _SD_BUX_CRED_ALL, since "MAX" so far
was used to indicate one higher than the highest valid value, and this
is not correct here.)
2013-12-02 18:40:43 +01:00
Lennart Poettering 79f8d3d2ce bus: support temporarily const errors that don't need to be freed but require deep copies
This should fix issues with incorrectly copying bus error messages out
of sd_bus_message objects.

Original bug found by: Djalal Harouni
2013-11-30 19:47:46 +01:00
Lennart Poettering 49b832c5b8 bus: include unique and well known names in credentials object 2013-11-30 14:46:14 +01:00
Lennart Poettering a4297f08ed bus: merge sd_bus_get_owner() and sd_bus_get_owner_creds() into one call
Since the backing ioctl for this on kdbus is the same we retain
atomicity this way.
2013-11-28 20:44:26 +01:00
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
Lennart Poettering 2be441769f bus: add calls to query attached objects 2013-11-22 01:42:15 +01:00
Lennart Poettering f00c31213a bus: also add error parameter to object find and enumerator callbacks
Just in order to bring things inline with the method and property
callbacks.
2013-11-22 01:42:15 +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 14c24659cd bus: rename SD_BUS_ERROR_MAKE to SD_BUS_ERROR_MAKE_CONST to indicate it only works for const strings 2013-11-21 02:11:06 +01:00
Lennart Poettering df2d202e6e bus: let's simplify things by getting rid of unnecessary bus parameters 2013-11-21 02:07:35 +01:00
Lennart Poettering 28383ba189 bus: add API calls to escape string components of objects paths 2013-11-21 01:03:26 +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 911121a7c8 bus: add sd_bus_send_to() API call 2013-11-20 19:37:02 +01:00
Kay Sievers f21326e604 bus: TIMESTAMP is optional kdbus metadata now, NAMES are always added 2013-11-18 01:30:57 +01:00
Kay Sievers 16be43684f bus: CREDS and NAMES are optional kdbus metadata now 2013-11-17 22:35:58 +01:00
Lennart Poettering 1fee9de509 bus: add api to control auto start message flag 2013-11-12 00:12:44 +01:00
Lennart Poettering 76b543756e bus: introduce concept of a default bus for each thread and make use of it everywhere
We want to emphasize bus connections as per-thread communication
primitives, hence introduce a concept of a per-thread default bus, and
make use of it everywhere.
2013-11-12 00:12:43 +01:00
Lennart Poettering c49b30a235 bus: rename sd_bus_send_with_reply_and_block() to sd_bus_call()
The call is one of the most important ones we expose, where we place
major emphasis on. We should make sure to give it a short, memorable
name.
2013-11-12 00:12:43 +01:00
Lennart Poettering 938bcbab12 bus: add APIs for adding iovecs to messages as string or arrays 2013-11-11 16:26:12 +01:00
Lennart Poettering 63be1989c7 bus: add APIs to easily query string and strv properties 2013-11-07 19:28:54 +01:00
Lennart Poettering 0095c45415 api: replace manual C++ guards by macros 2013-11-07 16:53:26 +01:00
Lennart Poettering affff0b6f2 bus: add sd_bus_get_current() bus call to determine message that is currently being dispatched 2013-11-05 20:51:49 +01:00
Lennart Poettering 7b05894275 bus: add new bus API call sd_bus_message_at_end()
This may be used to determine whether we are at the end of a container
ot the entire message.
2013-11-05 19:36:05 +01:00
Marc-Antoine Perennou 4686d1b6ee bus: add sd_bus_message_read_strv()
It will be useful to have that in the public API.
2013-11-05 18:12:18 +01:00
Lennart Poettering 9b07511d65 bus: add sd_bus_message_skip() to skip over multiple fields 2013-11-05 02:26:48 +01:00
Lennart Poettering e5609878d8 timedatectl: assorted simplifications 2013-10-31 03:02:49 +01:00
Lennart Poettering a7893c6b28 bus: add API call to create bus connection to the system bus of local containers
Also, add support for this to machinectl, so that we can enumerate the
machines that run inside a container. We must go deeper!
2013-10-30 15:37:02 +01:00
Lennart Poettering 0f8bd8debb bus: move ssh support into public API of libsystem-bus 2013-10-30 15:35:49 +01:00
Lennart Poettering 29f8d1f21a bus: add a macro to simplify reading of UUIDs 2013-10-29 19:34:59 +01:00
Lennart Poettering c430fee6ff bus: add new sd_bus_message_verify_type() and sd_bus_message_copy() API calls 2013-10-29 19:34:59 +01:00