summaryrefslogtreecommitdiff
path: root/src/libelogind/sd-bus/sd-bus.c
Commit message (Collapse)AuthorAge
...
* Prep v232.6: Make all supportable API functions visibleSven Eden2017-12-12
| | | | (v232 addition).
* Prep 229.9: Make all supportable API functions visible.Sven Eden2017-12-12
| | | | | | | | | | The process of cleaning up elogind, meaning to mask all bits that are unneeded by elogind, has been finished a while ago. It is therefore time to re-enable all previously masked API functions that elogind can support. This will make it easier for future developers to integrate elogind into their software where they already support systemd-login.
* build-sys: use #if Y instead of #ifdef Y everywhereZbigniew Jędrzejewski-Szmek2017-11-23
| | | | | | | | | | | | | | | The advantage is that is the name is mispellt, cpp will warn us. $ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/" $ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;' $ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g' $ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g' + manual changes to meson.build squash! build-sys: use #if Y instead of #ifdef Y everywhere v2: - fix incorrect setting of HAVE_LIBIDN2
* sd-bus: drop match cookie conceptLennart Poettering2017-09-29
| | | | | | THe match cookie was used by kdbus to identify matches we install uniquely. But given that kdbus is gone, the cookie serves no process anymore, let's kill it.
* sd-bus: when showing brief message info show error name in debug out put tooLennart Poettering2017-09-29
| | | | | | | When debug logging is enabled we show brief information about every bus message we send or receieve. Pretty much all information is shown, except for the error name if a message is an error (interestingly we do print the error text however). Fix that, and add the error name as well.
* libelogind: use IN_SET macroYu Watanabe2017-11-22
|
* cgroup, unit, fragment parser: make use of new firewall functionsDaniel Mack2017-11-21
|
* Add abstraction model for BPF programsDaniel Mack2017-11-20
| | | | | This object takes a number of bpf_insn members and wraps them together with the in-kernel reference id. Will be needed by the firewall code.
* v235: Added missing updatesSven Eden2017-11-19
|
* sd-bus: use -- when passing arguments to ssh (#6706)Evgeny Vereshchagin2017-09-25
| | | | | | | | This prevents `systemctl` from runnning /bin/touch when the following command is used: ``` systemctl -H '-oProxyCommand=/bin/touch i-shouldnt-be-here' show-environment ```
* Prep v235: Add missing includes and dependencies.Sven Eden2017-08-14
|
* Prep v235: Apply upstream fixes (5/10) [src/libelogind]Sven Eden2017-08-14
|
* sd-bus: free everything when bus_set_address_user fails (#6552)Evgeny Vereshchagin2017-08-10
| | | | | | | | | | | | | | | | | | Fixes: ``` $ env -i valgrind --leak-check=full ./build/test-bus-chat ... ==7763== 1,888 (1,824 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 2 of 2 ==7763== at 0x4C2FA50: calloc (vg_replace_malloc.c:711) ==7763== by 0x4F8FF9A: sd_bus_new (sd-bus.c:175) ==7763== by 0x4F938BF: sd_bus_open_user (sd-bus.c:1138) ==7763== by 0x109ACD: server_init (test-bus-chat.c:70) ==7763== by 0x10BCF8: main (test-bus-chat.c:526) ==7763== ``` Closes #6481
* sd-bus: never augment creds when we are operating on remote connections (#6217)Lennart Poettering2017-07-25
| | | | | | | It's not always clear when something is a remote connection, hence only flag the obvious cases as local. Fixes: #6207
* Prep v233.3: Unmask various functions for future coverage tests.Sven Eden2017-07-19
| | | | | These functions, although not used by elogind itself, are mostly tiny and crucial for important tests to work.
* tree-wide: drop NULL sentinel from strjoinZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | | | This makes strjoin and strjoina more similar and avoids the useless final argument. spatch -I . -I ./src -I ./src/basic -I ./src/basic -I ./src/shared -I ./src/shared -I ./src/network -I ./src/locale -I ./src/login -I ./src/journal -I ./src/journal -I ./src/timedate -I ./src/timesync -I ./src/nspawn -I ./src/resolve -I ./src/resolve -I ./src/elogind -I ./src/core -I ./src/core -I ./src/libudev -I ./src/udev -I ./src/udev/net -I ./src/udev -I ./src/libelogind/sd-bus -I ./src/libelogind/sd-event -I ./src/libelogind/sd-login -I ./src/libelogind/sd-netlink -I ./src/libelogind/sd-network -I ./src/libelogind/sd-hwdb -I ./src/libelogind/sd-device -I ./src/libelogind/sd-id128 -I ./src/libelogind-network --sp-file coccinelle/strjoin.cocci --in-place $(git ls-files src/*.c) git grep -e '\bstrjoin\b.*NULL' -l|xargs sed -i -r 's/strjoin\((.*), NULL\)/strjoin(\1)/' This might have missed a few cases (spatch has a really hard time dealing with _cleanup_ macros), but that's no big issue, they can always be fixed later.
* Prep v232: Add libelogind.sym entries for version 232.Sven Eden2017-07-05
|
* sd-bus: optionally, exit process or event loop on disconnectLennart Poettering2017-07-05
| | | | | | | | | | | | Old libdbus has a feature that the process is terminated whenever the the bus connection receives a disconnect. This is pretty useful on desktop apps (where a disconnect indicates session termination), as well as on command line apps (where we really shouldn't stay hanging in most cases if dbus daemon goes down). Add a similar feature to sd-bus, but make it opt-in rather than opt-out, like it is on libdbus. Also, if the bus is attached to an event loop just exit the event loop rather than the the whole process.
* sd-bus: when the server-side disconnects, make sure to dispatch all tracking ↵Lennart Poettering2017-07-05
| | | | | | | objects immediately If the server side kicks us from the bus, from our view no names are on the bus anymore, hence let's make sure to dispatch all tracking objects immediately.
* sd-bus: split out handling of reply callbacks on close into its own functionLennart Poettering2017-07-05
| | | | | | | When a bus connection is closed we dispatch all reply callbacks. Do so in a new function if its own. No behaviour changes.
* Prep v230: Apply missing upstream fixes and updates (5/8) src/libelogind.Sven Eden2017-06-16
|
* tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhereLennart Poettering2017-06-16
| | | | | | | | | | The macro determines the right length of a AF_UNIX "struct sockaddr_un" to pass to connect() or bind(). It automatically figures out if the socket refers to an abstract namespace socket, or a socket in the file system, and properly handles the full length of the path field. This macro is not only safer, but also simpler to use, than the usual offsetof() + strlen() logic.
* sd-bus: use IN_SETZbigniew Jędrzejewski-Szmek2017-06-16
|
* tree-wide: use SET_FLAG() macro to make code more clearAlexander Kuleshov2017-06-16
|
* tree-wide: make ++/-- usage consistent WRT spacingVito Caputo2017-06-16
| | | | | | Throughout the tree there's spurious use of spaces separating ++ and -- operators from their respective operands. Make ++ and -- operator consistent with the majority of existing uses; discard the spaces.
* Prep v229: Remove remaining emacs settings [3/6] src/libelogindSven Eden2017-05-17
|
* tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering2017-05-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Prep v228: Condense elogind source masks (5/5)Sven Eden2017-04-26
|
* Prep v228: Condense elogind source masks (4/5)Sven Eden2017-04-26
|
* Prep v228: Substitute declaration masks (4/4)Sven Eden2017-04-26
|
* Prep v228: Add remaining updates from upstream (3/3)Sven Eden2017-04-26
| | | | | Apply remaining fixes and the performed move of utility functions into their own foo-util.[hc] files on the rest of elogind.
* Prep v227: Clean up some headers in src/systemdSven Eden2017-04-09
| | | | | | - src/systemd/sd-bus.h - src/systemd/sd-daemon.h - src/systemd/sd-event.h
* [3/5] Apply missing fixes from upstreamSven Eden2017-03-29
|
* sd-bus: drop weird empty linesDavid Herrmann2017-03-29
| | | | | We should never put empty lines between `if` and `else if`, unless we use braces.
* Unifiy free() usageSven Eden2017-03-14
| | | | | | | | This commit substitutes all occurrences of free(foo); foo = NULL; with foo = mfree(foo);
* Classify processes from sessions into cgroupsSven Eden2017-03-14
| | | | | | | Create a private cgroup tree associated with no controllers, and use it to map PIDs to sessions. Since we use our own path structure, remove internal cgroup-related helpers that interpret the cgroup path structure to pull out users, slices, and scopes.
* sd-bus: derive uid from cgroup if possibleDavid Herrmann2017-03-14
| | | | | | | | | | | | | | | | | | | | | | 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_elogind 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.
* sd-bus: when connecting to a container, don't fall back to host busLennart Poettering2017-03-14
| | | | | | 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.
* Prep v225: Added needed udev support and re-enabled some masked cgroup ↵Sven Eden2017-03-14
| | | | functions.
* Prep v225: Applying various fixes and changes to src/libelogind/sd-bus that ↵Sven Eden2017-03-14
| | | | got lost during git am transfer.
* sd-bus: cleanup bus_reset_parsed_address()Namhyung Kim2017-03-14
| | | | Both strv_free() and mfree() return NULL pointer after free.
* sd-bus: use mfree() in bus_reset_queues()Namhyung Kim2017-03-14
| | | | | Recently mfree() was introduced to reduce work of tedious free + reset pointers. Use it in bus_reset_queues() too.
* sd-bus: cleanup bus_close_fds()Namhyung Kim2017-03-14
| | | | The safe_close() already checks the fd and returns -1.
* Prep v221: Update and clean up build system to sync with upstreamSven Eden2017-03-14
| | | | | | | | | | | | | | This commit replays the moving around of source files that have been done between systemd-219 and systemd-221. Further the Makefile.am is synchronized with the upstream version and then "re-cleaned". A lot of functions, that are not used anywhere in elogind have been coated into #if 0/#endif directives to further shorten the list of dependencies. All unneeded files have been removed.
* sd-bus: introduce new sd_bus_flush_close_unref() callLennart Poettering2017-03-14
| | | | | | | | | | | | | | | | 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
* bus: fix installing DRIVER matches on kdbusDavid Herrmann2017-03-14
| | | | | | | | | | | | | | | 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).
* turn kdbus support into a runtime optionKay Sievers2017-03-14
| | | | | | | | | | | | | ./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.
* sd-bus: suppress installing local bus matches server sideLennart Poettering2017-03-14
| | | | | | | | | 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.
* bus-message: remove shadow warning with log_debug_bus_message()Lennart Poettering2017-03-14
|
* sd-bus: Correct typoTorstein Husebø2017-03-14
|