Commit graph

12 commits

Author SHA1 Message Date
Lennart Poettering df98a87ba3 bus: introduce concept of "const" properties
This way we have four kinds of properties:

a) those which are constant as long as an object exists
b) those which can change and PropertiesChange messages with contents are generated
c) those which can change and where the PropertesChange merely includes invalidation
d) those which can change but for which no events are generated

Clients (through code generators run on the introspection XML) can thus
aggressively cache a, b, c, with only d excluded.
2013-12-22 03:50:52 +01:00
Lennart Poettering 7fb411f035 bus: when introspecting, turn unprivileged flag into inverse annoation of "privileged"
Internally, it makes sense to have a default of "privileged" for
methods, and a flag to open it up. However, externally in the bus
introspection turn this around since negative options actually suck.
2013-12-21 18:08:39 +01:00
Lennart Poettering 6e8df5f00a bus: introduce new SD_BUS_VTABLE_HIDDEN flag for vtable members
When this flag is set then its member will not be shown in the
introspection data. Also, properties with this flag set will not be
included in GetAll() responses.
2013-12-10 16:52:49 +00: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 0461f8cdc1 bus: internalize a lot of protocol definitions
We shouldn export what isn't necessary or useful to clients, so let's
add the protocol definitions we only need internally into a private
header.
2013-12-03 18:14:50 +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 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 dd8243a3ba bus: don't include the introspected object in list of subobjects 2013-10-30 02:08:57 +01:00
Lennart Poettering 6014597dd6 bus: fix generate introspection XML 2013-10-16 06:15:01 +02:00
Lennart Poettering f11ca85a89 bus: make sure introspection can be generated correctly with NULL method signatures 2013-10-11 23:01:35 +02:00
Lennart Poettering 77a874a3fb bus: don't rely on gccisms/c11 in public header files.
One day sd-bus.h should become a public header file. We generally try to
be conservative in language features we use in public headers (much
unlike in private code), hence don't make use of anonymous unions in
structs for the vtable definitions.
2013-10-11 20:32:16 +02:00
Lennart Poettering 29ddb38fea libsystemd-bus: add lightweight object vtable implementation for exposing objects on the bus
This adds a lightweight scheme how to define interfaces in static fixed
arrays which then can be easily registered on a bus connection. This
makes it much easier to write bus services.

This automatically handles implementation of the Properties,
ObjectManager, and Introspection bus interfaces.
2013-10-09 02:40:07 +02:00