b26fa1a2fbcfee7d03b0c8fd15ec3aa64ae70b9f |
|
10-Feb-2016 |
Daniel Mack <daniel@zonque.org> |
tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file. |
4afd3348c7506dd1d36305b7bcb9feb8952b9d6b |
|
27-Nov-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easy
GLIB has recently started to officially support the gcc cleanup
attribute in its public API, hence let's do the same for our APIs.
With this patch we'll define an xyz_unrefp() call for each public
xyz_unref() call, to make it easy to use inside a
__attribute__((cleanup())) expression. Then, all code is ported over to
make use of this.
The new calls are also documented in the man pages, with examples how to
use them (well, I only added docs where the _unref() call itself already
had docs, and the examples, only cover sd_bus_unrefp() and
sd_event_unrefp()).
This also renames sd_lldp_free() to sd_lldp_unref(), since that's how we
tend to call our destructors these days.
Note that this defines no public macro that wraps gcc's attribute and
makes it easier to use. While I think it's our duty in the library to
make our stuff easy to use, I figure it's not our duty to make gcc's own
features easy to use on its own. Most likely, client code which wants to
make use of this should define its own:
#define _cleanup_(function) __attribute__((cleanup(function)))
Or similar, to make the gcc feature easier to use.
Making this logic public has the benefit that we can remove three header
files whose only purpose was to define these functions internally.
See #2008. |
cf0fbc49e67b55f8d346fc94de28c90113505297 |
|
16-Nov-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
tree-wide: sort includes
Sort the includes accoding to the new coding style. |
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ce |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out allocation calls into alloc-util.[ch] |
e4e73a632524c382139034d4271f53b6089ab4cb |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out hex/dec/oct encoding/decoding into its own file |
6bedfcbb2970e06a4d3280c8fb62083d252ede73 |
|
27-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split string parsing related calls from util.[ch] into parse-util.[ch] |
3ffd4af22052963e7a29431721ee204e634bea75 |
|
25-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over. |
07630cea1f3a845c09309f197ac7c4f11edd3b62 |
|
24-Oct-2015 |
Lennart Poettering <lennart@poettering.net> |
util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.
This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.
Also touches a few unrelated include files. |
19932084d0177f482e04ab3b08ab836ccf93cc40 |
|
27-Sep-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
sd-bus: va_start should use the last named parameter |
dfb815c36df6e5f2089672b1d986d38b44c7ad17 |
|
26-Sep-2015 |
David Herrmann <dh.herrmann@gmail.com> |
sd-bus: add sd_bus_path_{encode,decode}_many()
This introduces two new helpers alongside sd_bus_path_{encode,decode}(),
which work similarly to their counterparts, but accept a format-string as
input. This allows encoding and decoding multiple labels of a format
string at the same time. |
fa2f8973adf9cfb6cc2a69bcfe209b125ee3a3ce |
|
22-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: introduce new sd_bus_default_flush_close() call
If code enqueues a message on one of the default busses, but doesn't
sync on it, and immediately drops the reference to the bus again, it
will stay queued and consume memory. Intrdouce a new call
sd_bus_default_flush_close() that can be invoked at the end of programs
(or threads) and flushes out all unsent messages on any of the default
busses. |
02736a9abce02eb53b0d504f96fc7b3e4f077020 |
|
09-Sep-2015 |
David Herrmann <dh.herrmann@gmail.com> |
sd-bus: drop weird empty lines
We should never put empty lines between `if` and `else if`, unless we use
braces. |
a1e58e8ee1c84b633d6d6d651d5328d4dd4eba5b |
|
09-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: use coccinelle to patch a lot of code to use mfree()
This replaces this:
free(p);
p = NULL;
by this:
p = mfree(p);
Change generated using coccinelle. Semantic patch is added to the
sources. |
64ce4ad758f43029ea020afdacddad55fffa174d |
|
05-Sep-2015 |
David Herrmann <dh.herrmann@gmail.com> |
sd-bus: derive uid from cgroup if possible
Whenever we run in a user context, sd_bus_{default_user,open_user}() and
friends should always connect to the user-bus of the current context,
instead of deriving the uid from getuid(). This allows us running
programs via sudo/su, without the nasty side-effect of accidentally
connecting to the root user-bus.
This patch enforces the idea of making su/sudo *not* opening sessions by
default. That is, all they do is raising privileges, but keeping
everything set as before. You can still use su/sudo to open real sessions
by requesting a login-session (or loading pam_systemd otherwise).
However, in this case XDG_RUNTIME_DIR= will not be set (as usual in these
cases), hence, you will not be able to connect to *any* user-bus.
Long story short: With this patch applied, both:
- ./busctl --user
- sudo ./busctl --user
..will successfully connect to the user-bus of the local user.
Fixes #390. |
751090cc8ae09787402d60b7080d479b3afe3b13 |
|
01-Sep-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: when connecting to a container, don't fall back to host bus
We should never connect to the host bus as fallback if connecting to a
container failed via one method. Otherwise connecting to a dbus1
container will always result in a connection to the host. |
154429127cb400bf010d41d7dd3ba4ec41b9ffb3 |
|
27-Aug-2015 |
David Herrmann <dh.herrmann@gmail.com> |
sd-bus: do not connect to dbus-1 socket when kdbus is available
We should not fall back to dbus-1 and connect to the proxy when kdbus
returns an error that indicates that kdbus is running but just does not
accept new connections because of quota limits or something similar.
Based on a patch by Kay. |
057171efc103ac76c60a2a0d277d8bbf25415c21 |
|
27-Aug-2015 |
David Herrmann <dh.herrmann@gmail.com> |
Revert "sd-bus: do not connect to dbus-1 socket when kdbus is available"
This reverts commit d4d00020d6ad855d65d31020fefa5003e1bb477f. The idea of
the commit is broken and needs to be reworked. We really cannot reduce
the bus-addresses to a single address. We always will have systemd with
native clients and legacy clients at the same time, so we also need both
addresses at the same time. |
25300b5a1fcf54674a69d0f4ab08925be00b0227 |
|
24-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
util: make machine_name_is_valid() a macro and move it to hostname-util.h
As it turns out machine_name_is_valid() does the exact same thing as
hostname_is_valid() these days, as it just invoked that and checked the
name length was < 64. However, hostname_is_valid() checks the length
against HOST_NAME_MAX anyway (which is 64 on Linux), hence any
additional check is redundant.
We hence replace machine_name_is_valid() by a macro that simply maps it
to hostname_is_valid() but sets the allow_trailing_dot parameter to
false. We also move this this call to hostname-util.h, to the same place
as the hostname_is_valid() declaration. |
759e02e79dd5e02becff6f34247aac9605ab410e |
|
16-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: always fill in sd_bus_error paramters, on error
Whenever one of our calls is invoked with a non-NULL, writable
sd_bus_error parameter, let's fill in some valid error on failure. We
previously only filled in remote errors, but never local errors, which is
hard to handle by users. Hence, let's clean this up to always fill in
the error.
This introduces a new bus_assert_return() macro that works like
assert_return() but optionally also initializes a bus_error struct.
Fixes #224.
Based on a patch by Umut Tezduyar. |
8ac43fee1a2890d62edfe29282f66780bc1b634f |
|
14-Aug-2015 |
Lennart Poettering <lennart@poettering.net> |
tree-wide: generate EBADF when we get invalid fds
This is a follow-up to #907, and makes the same change for all our other
public APIs. |
d4d00020d6ad855d65d31020fefa5003e1bb477f |
|
11-Aug-2015 |
Kay Sievers <kay@vrfy.org> |
sd-bus: do not connect to dbus-1 socket when kdbus is available
We should not fall back to dbus-1 and connect to the proxy when kdbus
returns an error that indicates that kdbus is running but just does not
accept new connections because of quota limits or something similar.
Using is_kdbus_available() in libsystemd/ requires it to move from
shared/ to libsystemd/.
Based on a patch from David Herrmann:
https://github.com/systemd/systemd/pull/886 |
ba243e5155fd824dcd5235992e691017bd328b3f |
|
02-Aug-2015 |
Namhyung Kim <namhyung@gmail.com> |
sd-bus: cleanup bus_reset_parsed_address()
Both strv_free() and mfree() return NULL pointer after free. |
253f96e53eb98dd811d380ffe108c53f48765ad2 |
|
02-Aug-2015 |
Namhyung Kim <namhyung@gmail.com> |
sd-bus: use mfree() in bus_reset_queues()
Recently mfree() was introduced to reduce work of tedious free + reset
pointers. Use it in bus_reset_queues() too. |
0fd8d506f4c41cb5b43649adde154353198d1ea8 |
|
02-Aug-2015 |
Namhyung Kim <namhyung@gmail.com> |
sd-bus: cleanup bus_close_fds()
The safe_close() already checks the fd and returns -1. |
2fc09a9cdd1ad25bc7c53a23d5301eb952e1ce3d |
|
30-Jul-2015 |
Daniel Mack <daniel@zonque.org> |
tree-wide: use free_and_strdup()
Use free_and_strdup() where appropriate and replace equivalent,
open-coded versions. |
03976f7b4a84b8b1492a549a3470b2bba8f37008 |
|
03-Jul-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: introduce new sd_bus_flush_close_unref() call
sd_bus_flush_close_unref() is a call that simply combines sd_bus_flush()
(which writes all unwritten messages out) + sd_bus_close() (which
terminates the connection, releasing all unread messages) +
sd_bus_unref() (which frees the connection).
The combination of this call is used pretty frequently in systemd tools
right before exiting, and should also be relevant for most external
clients, and is hence useful to cover in a call of its own.
Previously the combination of the three calls was already done in the
_cleanup_bus_close_unref_ macro, but this was only available internally.
Also see #327 |
9ee7a50c0bab0d8df324399aa7d43bbdceaf0318 |
|
17-Jun-2015 |
David Herrmann <dh.herrmann@gmail.com> |
bus: fix installing DRIVER matches on kdbus
In kdbus we still have to support org.freedesktop.DBus matches even though
there is no real bus driver. The reason is that bus-control.c turns
NameOwnerChanged matches into proper kdbus matches. If we drop DRIVER
matches early, we will never match on name-changes for kdbus.
Two ways to fix this:
1) Install DRIVER matches on kdbus (which is the simple way our and which
is what this patch does).
2) Properly fix the scope-detection to let NameOwnerChanged matches
through (or better: block anything with Member!=NameOwnerChanged). |
1b09f548c7f303b486b5b1321c06336bff72ada4 |
|
17-Jun-2015 |
Kay Sievers <kay@vrfy.org> |
turn kdbus support into a runtime option
./configure --enable/disable-kdbus can be used to set the default
behavior regarding kdbus.
If no kdbus kernel support is available, dbus-dameon will be used.
With --enable-kdbus, the kernel command line option "kdbus=0" can
be used to disable kdbus.
With --disable-kdbus, the kernel command line option "kdbus=1" is
required to enable kdbus support. |
cc65fe5e14770d0116e0f475c5dc2ef57113bc98 |
|
17-Jun-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: suppress installing local bus matches server side
Matches that can only match against messages from the
org.freedesktop.DBus.Local service (or the local interfaces or path)
should never be installed server side, suppress them hence.
Similar, on kdbus matches that can only match driver messages shouldn't
be passed to the kernel. |
b56c4604faf486e897f836ac2293dd147e980352 |
|
10-Jun-2015 |
Lennart Poettering <lennart@poettering.net> |
bus-message: remove shadow warning with log_debug_bus_message() |
c4e6556c46cea1b7195cfb81c8cfab8342ebd852 |
|
10-Jun-2015 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
sd-bus: store selinux context at connection time
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 |
348d8cc8d7e47d877505f90c5135f101f13f2711 |
|
10-Jun-2015 |
Torstein Husebø <torstein@huseboe.net> |
sd-bus: Correct typo |
f9f97ca6927af3a23d9c27e4edf65532ebf23e1e |
|
10-Jun-2015 |
Umut Tezduyar Lindskog <umut.tezduyar@axis.com> |
sd-bus: dump sync messages in debug mode |
882897afeeb0eabb3eae04a6e54beff8cb206514 |
|
22-May-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus,sd-event: make public APIs
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. |
9030ca462bd13cd6536299814e4a71d5c5e85be9 |
|
29-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: allow passing NULL as bus parameter to sd_bus_send()
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. |
190700621f95160d364f8ec1d3e360246c41ce75 |
|
29-Apr-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: drop bus parameter from message callback prototype
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(). |
15411c0cb1192799b37ec8f25d6f30e8d7292fc6 |
|
13-Mar-2015 |
David Herrmann <dh.herrmann@gmail.com> |
tree-wide: there is no ENOTSUP on linux
Replace ENOTSUP by EOPNOTSUPP as this is what linux actually uses. |
908b8a42e645887f1ab0616c1fc018ecc8ece91f |
|
11-Mar-2015 |
David Herrmann <dh.herrmann@gmail.com> |
bus: remarshal kdbus messages received from the kernel
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. |
2eec67acbb00593e414549a7e5b35eb7dd776b1b |
|
23-Feb-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
remove unused includes
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. |
c0765ddb74f20046c406a3ac99f34719d767f151 |
|
18-Feb-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: allow setting a per-connection default value for the "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. |
0a6f50c0afdfc434b492493bd9efab20cbee8623 |
|
12-Feb-2015 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
include <poll.h> instead of <sys/poll.h>
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. |
63c372cb9df3bee01e3bf8cd7f96f336bddda846 |
|
03-Feb-2015 |
Lennart Poettering <lennart@poettering.net> |
util: rework strappenda(), and rename it strjoina()
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. |
997eadb5534cbd3d1de3d93f6489a3b4d03405e1 |
|
09-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: even if we need a cookie when sending a message there's no need to needlessly send it if we don't actually need it |
52cd587789b9452e6e7d5f2f9b2ea652f9ad036e |
|
07-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: when we synthesize messages, initialize timestamps ourselves |
d29ae2914e1146f45ff4104faafef5331837bed7 |
|
07-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: unify how we set the sender of synthetic messages |
146d47736780e06f618379a6c9f46edcf46803a7 |
|
05-Jan-2015 |
Lennart Poettering <lennart@poettering.net> |
machined,bus-proxy: fix connecting to containers |
de33fc625725d199629ed074d6278504deb23deb |
|
24-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: rename sd_bus_open_system_container() to sd_bus_open_system_machine()
Pretty much everywhere else we use the generic term "machine" when
referring to containers in API, so let's do though in sd-bus too. In
particular, since the concept of a "container" exists in sd-bus too, but
as part of the marshalling system. |
ee502e0c28a611470a4e10b0c90bade6ff7fa389 |
|
23-Dec-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: teach x-container-unix: bus protoocol to connect to the namespace of a PID instead of a container name |
ad67ef274e43ee841fb9d60e3cd2370e57418371 |
|
11-Dec-2014 |
Torstein Husebø <torstein@huseboe.net> |
sd-bus: correct spacing near eol in code comments |
d2df88ffbac8858214adb9daaf7a93122fe26a50 |
|
04-Dec-2014 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
sd-bus: avoid a null dereference |
224b3787679a7dc57732d29c5b0cbec7b14e0c10 |
|
28-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: make more connection properties readable |
5b820358cf2a5cb6d67cc0b1faaaca3b0171f1ac |
|
28-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: add new sd_bus_get_address() for querying the current bus address
Also, update "busctl" to show this in its output. |
5c3026927de9dfa60ad6ae8326fef5d7824e723e |
|
28-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: rename sd_bus_get_owner_id() → sd_bus_get_bus_id()
The ID returned really doesn't identify the owner, but the bus instance,
hence fix this misnaming.
Also, update "busctl status" to show the ID in its output. |
e3afaf6b8e540d4c0dc5a7f0d5178ce29c1ac2a5 |
|
28-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: rename default bus address constants, they aren't "paths" but "addresses" |
3acc1dafd14420872f7f13319260eeb5d62c2533 |
|
28-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: add new call sd_bus_get_scope() for querying whether one is connected to a system or a user bus |
fb6d9b77a71a5f007392b754bf7d8e06a6bed69a |
|
27-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: set creds info for "org.freedesktop.DBus.Local" generated messages, too |
cf226cfc24fec9d47a0c822188737656150356bb |
|
26-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: make sure that when we connect to the system bus we have enough creds to make security decisions |
b5dae4c7f77f7c87b91e0afb60a31c690dda4a1f |
|
26-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: add suppot for renegotiating message credential attach flags |
705a415f684f8e9ee19983e5859de00bbb1477cb |
|
25-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: update to current kernel version, by splitting off the extended KDBUS_ITEM_PIDS structure from KDBUS_ITEM_CREDS
Also:
- adds support for euid, suid, fsuid, egid, sgid, fsgid fields.
- makes augmentation of creds with data from /proc explicitly
controllable to give apps better control over this, given that this is
racy.
- enables augmentation for kdbus connections (previously we only did it
for dbus1). This is useful since with recent kdbus versions it is
possible for clients to control the metadata they want to send.
- changes sd_bus_query_sender_privilege() to take the euid of the client
into consideration, if known
- when we don't have permissions to read augmentation data from /proc,
don't fail, just don't add the data in |
63cc4c3138fd0ce9cc97884373a2dd8959a13ee9 |
|
13-Nov-2014 |
Daniel Mack <daniel@zonque.org> |
sd-bus: sync with kdbus upstream (ABI break)
kdbus has seen a larger update than expected lately, most notably with
kdbusfs, a file system to expose the kdbus control files:
* Each time a file system of this type is mounted, a new kdbus
domain is created.
* The layout inside each mount point is the same as before, except
that domains are not hierarchically nested anymore.
* Domains are therefore also unnamed now.
* Unmounting a kdbusfs will automatically also detroy the
associated domain.
* Hence, the action of creating a kdbus domain is now as
privileged as mounting a filesystem.
* This way, we can get around creating dev nodes for everything,
which is last but not least something that is not limited by
20-bit minor numbers.
The kdbus specific bits in nspawn have all been dropped now, as nspawn
can rely on the container OS to set up its own kdbus domain, simply by
mounting a new instance.
A new set of mounts has been added to mount things *after* the kernel
modules have been loaded. For now, only kdbus is in this set, which is
invoked with mount_setup_late(). |
f7fce3454c221fd1fff51528d028576d1cb1c7b6 |
|
04-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: rename sd_bus_get_server_id() to sd_bus_get_owner_id()
In kdbus a "server id" is mostly a misnomer, as there isn't any "server"
involved anymore. Let's rename this to "owner" id hence, since it is an
ID that is picked by the owner of a bus or direct connection. This
matches nicely the sd_bus_get_owner_creds() call we already have. |
f4b2933ee7890e5d414ab266d8586f19027a2bd9 |
|
04-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus,sd-event: unify error handling of object descriptions
a) When getting the description return ENXIO if none is set
b) Allow setting a description to NULL
c) return ECHILD on fork() like for other calls |
d1b91c99d9241f7f79756a42f845cf35992888cd |
|
04-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: make use of free_and_strdup() where it makes sense |
356779df90a2ecab5da2cb310ad0f8ebc9ca9f46 |
|
04-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-event: rename sd_event_source_set_name() to sd_event_source_get_name()
To mirror the recent name change of the concept for sd_bus objects,
follow the same logic for sd_event_source objects, too. |
455971c1493fc6dc3125d235cf4ea6102cac626d |
|
04-Nov-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: rename "connection name" to "description" for the sd-bus API too
kdbus recently renamed this concept, and so should we in what we expose
in userspace. |
24f6fc22c10fe4fbb3c24fd90ff09085dc402bbf |
|
27-Oct-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: explicitly cast asprintf() return value away we are not interested in
Let's give coverity a hint what's going on here. |
54ad51e3e92c92240205aab2f9479c041cdaaf8f |
|
27-Oct-2014 |
Lennart Poettering <lennart@poettering.net> |
Revert "sd-bus: check return value of asprintf()"
This reverts commit b1543c4c93855b61b40118e9f14a0423dac2e078.
We check b->address anyway, no need to check the return value,
especially given that the other #ifdef branch don't get the same
treatment. |
c9fe4af70d2c884c1f95714a81ad6d1de31d5186 |
|
23-Oct-2014 |
Michal Schmidt <mschmidt@redhat.com> |
sd-bus: make sd_bus::reply_callbacks a OrderedHashmap
The way process_closing() picks the first entry from reply_callbacks
and works with it makes it likely that it cares about the order. |
affcf189153714f0de4d0986d18e2bc1b35c1b20 |
|
22-Oct-2014 |
Lennart Poettering <lennart@poettering.net> |
machine: validate machine names using machine_name_is_valid() instead of string_is_safe()
After all, we know have this as generic validator, so let's be correct
and use it wherver applicable. |
8f44e3ea3e0821625e584938e54623e7fb381bb8 |
|
22-Oct-2014 |
Daniel Mack <daniel@zonque.org> |
sd-bus: implement sd_bus_get_owner_creds() for kdbus
kdbus learned a new ioctl to tell userspace about a bus creator's
credentials, which is what we need to implement sd_bus_get_owner_creds() for
kdbus.
Move the function from sd-bus.c to bus-control.c to be able to reuse
the bus_populate_creds_from_items() helper. |
056f95d0a70413e10e4a4ea9966baabb5a1450ed |
|
22-Oct-2014 |
Daniel Mack <daniel@zonque.org> |
sd-bus: rename sd_bus_get_owner_uid(), sd_bus_get_owner_machine_id() and sd_bus_get_peer_creds()
Clean up the function namespace by renaming the following:
sd_bus_get_owner_uid() → sd_bus_get_name_creds_uid()
sd_bus_get_owner_machine_id() → sd_bus_get_name_machine_id()
sd_bus_get_peer_creds() → sd_bus_get_owner_creds() |
c32195e057e5bf903c2645e273ba82f32c0106d3 |
|
17-Oct-2014 |
Kay Sievers <kay@vrfy.org> |
Revert "sd-bus: sync kdbus.h (ABI break)"
This reverts commit 1a2409e262da65a4b0ca8ab18fcf5eabd2d404ca.
Support from the kdbus interface was removed. We require
memfds to be supported by all clients. |
1a2409e262da65a4b0ca8ab18fcf5eabd2d404ca |
|
14-Oct-2014 |
Daniel Mack <daniel@zonque.org> |
sd-bus: sync kdbus.h (ABI break)
kdbus learned KDBUS_HELLO_ACCEPT_MEMFD as new connection negotiation
flag. Set it by default in systemd for now. |
b1543c4c93855b61b40118e9f14a0423dac2e078 |
|
09-Oct-2014 |
Daniel Mack <daniel@zonque.org> |
sd-bus: check return value of asprintf()
Check for OOM conditions of asprintf() in bus_set_address_user(). |
75a0da952f603006d6b3535ecaf8ebe2bded30e7 |
|
05-Oct-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
bus: add assert to check that we're not freeing a static structure
CID #996315. |
b49ffb29ed902f173852707652b3e3c9c303cebb |
|
16-Sep-2014 |
Thomas Hindoe Paaboel Andersen <phomes@gmail.com> |
sd-bus: sd_bus_message_get_errno should only return positive errno
sd_bus_message_get_errno can currently return either a number of
different poitive errno values (from bus-error-mapping), or a negative
EINVAL if passed null as parameter.
The check for null parameter was introduced in 40ca29a1370379d43e44c0ed425eecc7218dcbca
at the same as the function was renamed from bus_message_to_errno and
made public API. Before becoming public the function used to return
only negative values.
It is weird to have a function return both positive and negative errno
and it generally looks like a mistake. The function is guarded by the
--enable-kdbus flags so I wonder if we still have time to fix it up?
It does not have any documentation yet. However, except for a few details
it is just a convenient way to call sd_bus_error_get_errno which is documented
to return only positive errno.
This patch makes it return only positive errno and fixes up the two
calls to the function that tried to cope with both positive and negative
values. |
d5099efc47d4e6ac60816b5381a5f607ab03f06e |
|
15-Sep-2014 |
Michal Schmidt <mschmidt@redhat.com> |
hashmap: introduce hash_ops to make struct Hashmap smaller
It is redundant to store 'hash' and 'compare' function pointers in
struct Hashmap separately. The functions always comprise a pair.
Store a single pointer to struct hash_ops instead.
systemd keeps hundreds of hashmaps, so this saves a little bit of
memory. |
2b347169b9046ff2d735ef23e62a8c74f5151600 |
|
11-Sep-2014 |
Philippe De Swert <philippedeswert@gmail.com> |
bus: unref buscreds on failure
Actually unref the buscreds when we are not going to return a
pointer to them. As when bus_creds_add_more fails we immediately
return the error code otherwise and leak the new buscreds.
Found with coverity. Fixes: CID#1237761 |
9021bb9f935c93b516b10c88db2a212a9e3a8140 |
|
28-Aug-2014 |
Tom Gundersen <teg@jklm.no> |
sd-event: name event sources used in libraries
This should help in debugging failing event sources. |
d974ad0524942882f489914013d08ab16d147170 |
|
28-Aug-2014 |
David Herrmann <dh.herrmann@gmail.com> |
bus: fix use-after-free in slot-release
We must not access slot->floating after we possible dropped the last
reference to it. Fix all callback-invocations to first check
slot->floating and possible disconnect the slot, then release the last
reference. |
fe3f22d116f6f0cac3bdfa512ac54c0faf8bb7cd |
|
18-Aug-2014 |
Denis Kenzior <denkenz@gmail.com> |
bus-control: Fix cgroup handling
On systems without properly setup systemd, cg_get_root_path returns
-ENOENT. This means that busctl doesn't display much information.
busctl monitor also fails whenever it intercepts messages.
This fix fakes creates a fake "/" root cgroup which lets busctl work
on such systems. |
caa829849d6ac9f6e173f585f732054358311ae1 |
|
18-Aug-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: add API to query which handler/callback is currently being dispatched |
3a43da2832dc5360a638d043f469a6dcbe025582 |
|
29-Jul-2014 |
Kay Sievers <kay@vrfy.org> |
time-util: add and use USEC/NSEC_INFINIY |
db9bb83fa5ec72da38eb5bd0c259ef8c76a71858 |
|
03-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
bus: close a bus that failed to connect |
7f0d207d2c816e0a8cb2742b0a789911f7c99356 |
|
03-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: support connecting to remote hosts, directly into containers
systemctl -H root@foobar:waldi
will now show a list of services running on container "waldi" on host
"foobar", using "root" for authenticating at "foobar".
Since entereing a container requires priviliges, this will only work
correctly for root logins. |
7bb4d371af5ec6b8c50b71d2a80c2866d8134d9a |
|
02-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: when an event loop terminates, explicitly close the bus
This makes sure we actually release the bus and all the messages it
references. |
b5eca3a2059f9399d1dc52cbcf9698674c4b1cf0 |
|
02-Jul-2014 |
Lennart Poettering <lennart@poettering.net> |
bus: drop bus/message GC logic
When a caller drops all references to a bus and its messages while the
messages where still queue, this causes the bus to reference the
messages, and the messages to reference the bus, without anybody else
keeping a reference, which is something we so far considered a leak, and
tried to fix with a GC logic that would recognize cases like this, and
drop the reference.
This GC logic has been broken sofar, and remained unfixed. This commit
removes it altogther, replacing it with nothing. The rationale is that
simply because all refs to the bus have been dropped its queued messages
should *still* be written to the bus, even if the caller doesn't retain
any reference to either bus nor message. This means it was actually
wrong to attempt to clean up the bus in this case.
The proper way how applications should handle this is by explicitly
invoking sd_bus_close(), when they want busses to go away. This is
probably want they want to do anyway to avoid getting spurious
callbacks after they stopped using a bus. |
2915234da0c9f2f8727d91f04857e7b72d6721a9 |
|
17-May-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
bus: fix unitialized variable access in error path |
1b64f8382956cdd9a2afc50a7ab638529acb912e |
|
15-May-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: always keep slot reference while dispatching callback
Also, make sure we automatically destroy reply callbacks that are
floating. |
de0671ee7fe465e108f62dcbbbe9366f81dd9e9a |
|
15-May-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Remove unnecessary casts in printfs
No functional change expected :) |
19befb2d5fc087f96e40ddc432b2cc9385666209 |
|
15-May-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: introduce sd_bus_slot objects encapsulating callbacks or vtables attached to a bus connection
This makes callback behaviour more like sd-event or sd-resolve, and
creates proper object for unregistering callbacks.
Taking the refernce to the slot is optional. If not taken life time of
the slot will be bound to the underlying bus object (or in the case of
an async call until the reply has been recieved). |
93f1bcf40030a9e98bf2b71c177cbea36c64d5c9 |
|
29-Apr-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-resolve: rework sd-resolve to be callback based, similar in style to sd-bus and sd-event |
e955c45881eec5895fa10bf107bee3fafed38645 |
|
24-Mar-2014 |
Daniel Mack <zonque@gmail.com> |
sd-bus: invert bus->is_kernel check in sd_bus_get_peer_creds()
The bug was introducted in a3d59cd1 ("sd-bus: don't use assert_return()
to check for disconnected bus connections") |
6a0f1f6d5af7c7300d3db7a0ba2b068f8abd222b |
|
24-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-event: rework API to support CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM, too |
374c356979ba7222fa7e09005824fe6996b0e91e |
|
22-Mar-2014 |
David Herrmann <dh.herrmann@gmail.com> |
sd-bus: mark sd_bus_unref() as broken regarding self-refs
If you allocate a message with bus==NULL and then unref the main bus,
it will free your message underneath and your program will go boom!
To fix that, we really need to figure out what the semantics for
self-references (m->bus) should be and when/where/what accesses are
actually allowed.
Same is true for the pseudo-thread-safety we employ.. |
eb33a6f858c2cd39dcf9c2f39514c9f83ed040fe |
|
22-Mar-2014 |
David Herrmann <dh.herrmann@gmail.com> |
sd-bus: add note about sd_bus_unref() recursion
In sd_bus_unref() we check for self-reference loops and destruct our
queues in case we're the only reference holders. However, we do _not_
modify our own ref-count, thus effectively causing the
message-destructions to enter with the same reference count as we did.
The only reason this doesn't cause an endless recursion (or trigger
assert(m->n_ref > 0) in sd_bus_message_unref()) is the fact that we
decrease queue-counters _before_ calling _unref(). That's not obvious at
all, so add a big fat note in bus_reset_queues() to everyone touching that
code. |
a3d59cd1b0a2738d06893948492113f2c35be0af |
|
19-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: don't use assert_return() to check for disconnected bus connections
A terminated connection is a runtime error and not a developer mistake,
hence don't use assert_return() to check for it. |
ae439c9f9b8a9cbb320d66290e3f9ad0e2f37378 |
|
19-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: properly translate high-level attach flags into kdbus attach flags |
09365592341b4ba4ceca677bb551dcde811e0333 |
|
19-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: add proper monitoring API |
2ce97e2b04c9f9ee51529488f3114693d5204ff1 |
|
18-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: if we got a message with fds attached even though we didn't negotiate it, refuse to take it
This makes sure we don't mishandle if developers specificy a different
AcceptFileDescriptors= setting in .busname units then they set for the
bus connection in the activated program. |
03e334a1c7dc8c20c38902aa039440763acc9b17 |
|
18-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
util: replace close_nointr_nofail() by a more useful safe_close()
safe_close() automatically becomes a NOP when a negative fd is passed,
and returns -1 unconditionally. This makes it easy to write lines like
this:
fd = safe_close(fd);
Which will close an fd if it is open, and reset the fd variable
correctly.
By making use of this new scheme we can drop a > 200 lines of code that
was required to test for non-negative fds or to reset the closed fd
variable afterwards. |
6f285378aa6e4b5b23c939d1fea16f9ab0a57efb |
|
17-Mar-2014 |
Miklos Vajna <vmiklos@vmiklos.hu> |
core, libsystemd, systemd, timedate, udev: spelling fixes |
42c4ebcbd4cbd7b27667eb8081ee4dc46f9ece17 |
|
13-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
sd-bus: don't look for a 64bit value when we only have 32bit value on reply cookie hash table access
This broke hashtable lookups for the message cookies on s390x, which is
a 64bit BE machine where accessing 32bit values as 64bit and vice versa
will explode.
Also, while we are at it, be a bit more careful when dealing with the
64bit cookies we expose and the 32bit serial numbers dbus uses in its
payload.
Problem identified by Fridrich Strba. |
82923adfe5c4fa09cc91fd2a2e374c936cd4a186 |
|
13-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
bus: fix memory leak when kdbus is not enabled |
a6278b88305b237b02eabff0d870b57fe851822d |
|
11-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
bus: replace sd_bus_label_{escape,unescape}() by new sd_bus_path_{encode,decode}()
The new calls work similarly, but enforce a that a common, fixed bus
path prefix is used.
This follows discussions with Simon McVittie on IRC that it should be a
good idea to make sure that people don't use the escaping applied here
too wildly as anything other than the last label of a bus path. |
8f8f05a919355095518911135c3d630f4620a9b0 |
|
03-Mar-2014 |
Lennart Poettering <lennart@poettering.net> |
bus: add sd_bus_track object for tracking peers, and port core over to it
This is primarily useful for services that need to track clients which
reference certain objects they maintain, or which explicitly want to
subscribe to certain events. Something like this is done in a large
number of services, and not trivial to do. Hence, let's unify this at
one place.
This also ports over PID 1 to use this to ensure that subscriptions to
job and manager events are correctly tracked. As a side-effect this
makes sure we properly serialize and restore the track list across
daemon reexec/reload, which didn't work correctly before.
This also simplifies how we distribute messages to broadcast to the
direct busses: we only track subscriptions for the API bus and
implicitly assume that all direct busses are subscribed. This should be
a pretty OK simplification since clients connected via direct bus
connections are shortlived anyway. |
df1e02046144f41176c32ed011369fd8dba36b76 |
|
26-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
Revert back to /var/run at a couple of problems
This partially reverts 41a55c46ab8fb4ef6727434227071321fc762cce
Some specifications we want to stay compatibility actually document
/var/run, not /run, and we should stay compatible with that. In order to
make sure our D-Bus implementation works on any system, regardless if
running systemd or not, we should always use /var/run which is the
only path mandated by the D-Bus spec.
Similar, glibc hardcodes the utmp location to /var/run, and this is
exposed in _UTMP_PATH in limits.h, hence let's stay in sync with this
public API, too.
We simply do not support systems where /var/run is not a symlink → /run.
Hence both are equivalent. Staying compatible with upstream
specifications hence weighs more than cleaning up superficial
appearance. |
41a55c46ab8fb4ef6727434227071321fc762cce |
|
26-Feb-2014 |
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> |
Replace /var/run with /run in remaining places
/run was already used almost everywhere, fix the remaining places
for consistency. |
f01de9656d0969633ac89eb57a0ba4658a100568 |
|
23-Feb-2014 |
Kay Sievers <kay@vrfy.org> |
src/shared/ cannot reference symbols from libraries
../src/shared/unit-name.c:462: error: undefined reference to 'sd_bus_label_escape'
../src/shared/unit-name.c:477: error: undefined reference to 'sd_bus_label_unescape'
collect2: error: ld returned 1 exit status |
151b9b9662a90455262ce575a8a8ae74bf4ff336 |
|
20-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
api: in constructor function calls, always put the returned object pointer first (or second)
Previously the returned object of constructor functions where sometimes
returned as last, sometimes as first and sometimes as second parameter.
Let's clean this up a bit. Here are the new rules:
1. The object the new object is derived from is put first, if there is any
2. The object we are creating will be returned in the next arguments
3. This is followed by any additional arguments
Rationale:
For functions that operate on an object we always put that object first.
Constructors should probably not be too different in this regard. Also,
if the additional parameters might want to use varargs which suggests to
put them last.
Note that this new scheme only applies to constructor functions, not to
all other functions. We do give a lot of freedom for those.
Note that this commit only changes the order of the new functions we
added, for old ones we accept the wrong order and leave it like that. |
3db729cb8e6822114e9323f4041dcdc080f2fb3c |
|
20-Feb-2014 |
Jason A. Donenfeld <Jason@zx2c4.com> |
sd-bus: the bus returned should be the first arg
This matches the API of previous headers, such as sd-journal.h. |
23abf5d5820ed9f24e8fe92fad32a207fe75398c |
|
19-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
bus: fix unreffing logic |
f4d140e9a60ca76d36d4539059e463a5db6a3a9d |
|
05-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
bus: properly unset default bus pointer when destroying last reference |
f389bf15d0b732027669690ed9606a96c0568bbd |
|
03-Feb-2014 |
Lennart Poettering <lennart@poettering.net> |
bus: when closing the bus don't end up in a recursive destruction deadlock |
af08d2f9cde8f46d9d3e731dbd1f06ffb3b08942 |
|
27-Jan-2014 |
Lennart Poettering <lennart@poettering.net> |
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. |
766c580959336be16f7c724b158f8e8fbaba2e9a |
|
22-Jan-2014 |
Lennart Poettering <lennart@poettering.net> |
bus: add sd_bus_process_priority() to support prioq mode of kdbus |
5972fe953ec56c77936a1e612ca87d8a0e6c0c64 |
|
22-Jan-2014 |
Lennart Poettering <lennart@poettering.net> |
bus: add support for attaching name to bus connections for debugging purposes |
4fc319887efb4c68ec5a308d583a94510382f686 |
|
22-Jan-2014 |
Lennart Poettering <lennart@poettering.net> |
bus: simplify naming of feature negotation calls
Two verbs in a function name suck, so let's simplify this a bit. |
069f5e61eb128aa08b6fdff12fc6ac71c3897b48 |
|
21-Jan-2014 |
Lennart Poettering <lennart@poettering.net> |
bus: implement synchronous message calls via kernel ioctl |
607553f9306286fdccf0b356bc3d1087adfe21c4 |
|
21-Jan-2014 |
Tom Gundersen <teg@jklm.no> |
libsystemd: split up into subdirs
We still only produce on .so, but let's keep the sources separate to make things a bit
less messy. |