summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus
Commit message (Collapse)AuthorAgeFilesLines
* busctl: use Monitoring interface (#3245)Lars Uebernickel2016-05-141-15/+30
| | | | | This is now the recommended way to do monitoring by upstream D-Bus. It's also allowed in the default policy, whereas eavesdrop is not anymore, which effectively broke busctl on many systems.
* tree-wide: rename draw_special_char to special_glyphZbigniew Jędrzejewski-Szmek2016-05-092-4/+4
| | | | | | | | | That function doesn't draw anything on it's own, just returns a string, which sometimes is more than one character. Also remove "DRAW_" prefix from character names, TREE_* and ARROW and BLACK_CIRCLE are unambigous on their own, don't draw anything, and are always used as an argument to special_glyph(). Rename "DASH" to "MDASH", as there's more than one type of dash.
* tree-wide: introduce new SOCKADDR_UN_LEN() macro, and use it everywhereLennart Poettering2016-05-051-1/+1
| | | | | | | | | | 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-Szmek2016-04-161-7/+7
|
* sd-bus: query pid also when searching for supplementary gidsIsmo Puustinen2016-04-131-0/+3
| | | | | | | If the SD_BUS_CREDS_SUPPLEMENTARY_GIDS value is requested, the pid is queried to find out the supplementary gids value from /proc/pid/status. Otherwise sd_bus_creds_get_supplementary_gids() won't work unless some other value in mask triggered fetching the pid information.
* core: make sure we generate a nicer error when a linked unit is attempted to ↵Lennart Poettering2016-04-122-0/+2
| | | | | | | | | be enabled We don't allow using config symlinks to enable units, but the error message we printed was awful. Fix that, and generate a more readable error. Fixes #3010.
* core: when enabling a generated unit file, return a clean errorLennart Poettering2016-04-122-0/+2
| | | | | Let's be precise when the user tries to invoke an "enable" operation on a generated unit file.
* tree-wide: use SET_FLAG() macro to make code more clearAlexander Kuleshov2016-03-052-16/+4
|
* Merge pull request #2671 from 0xAX/move-pager-open-to-one-placeZbigniew Jędrzejewski-Szmek2016-02-251-17/+8
|\ | | | | tree-wide: merge pager_open_if_enabled() to the pager_open()
| * tree-wide: merge pager_open_if_enabled() to the pager_open()Alexander Kuleshov2016-02-261-17/+8
| | | | | | | | | | | | | | | | | | Many subsystems define own pager_open_if_enabled() function which checks '--no-pager' command line argument and open pager depends on its value. All implementations of pager_open_if_enabled() are the same. Let's merger this function with pager_open() from the shared/pager.c and remove pager_open_if_enabled() from all subsytems to prevent code duplication.
* | tree-wide: minor formatting inconsistency cleanupsVito Caputo2016-02-231-1/+1
| |
* | tree-wide: make ++/-- usage consistent WRT spacingVito Caputo2016-02-228-19/+19
|/ | | | | | 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.
* Merge pull request #2618 from zonque/busproxy-removalLennart Poettering2016-02-151-117/+0
|\ | | | | remove bus-proxyd
| * remove bus-proxydDaniel Mack2016-02-121-117/+0
| | | | | | | | | | | | | | | | | | | | As kdbus won't land in the anticipated way, the bus-proxy is not needed in its current form. It can be resurrected at any time thanks to the history, but for now, let's remove it from the sources. If we'll have a similar tool in the future, it will look quite differently anyway. Note that stdio-bridge is still available. It was restored from a version prior to f252ff17, and refactored to make use of the current APIs.
* | busctl: when formatting message contents, make sure to print all whitespacesLennart Poettering2016-02-131-2/+9
| | | | | | | | | | Previously we'd miss a necessary whitespace at the end of arrays, if more data was following.
* | resolved: drop references to two bus error codes no longer usedLennart Poettering2016-02-132-4/+0
| |
* | Merge pull request #2589 from keszybz/resolve-tool-2Lennart Poettering2016-02-133-7/+5
|\ \ | |/ |/| Better support of OPENPGPKEY, CAA, TLSA packets and tests
| * Add memcpy_safeZbigniew Jędrzejewski-Szmek2016-02-113-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ISO/IEC 9899:1999 §7.21.1/2 says: Where an argument declared as size_t n specifies the length of the array for a function, n can have the value zero on a call to that function. Unless explicitly stated otherwise in the description of a particular function in this subclause, pointer arguments on such a call shall still have valid values, as described in 7.1.4. In base64_append_width memcpy was called as memcpy(x, NULL, 0). GCC 4.9 started making use of this and assumes This worked fine under -O0, but does something strange under -O3. This patch fixes a bug in base64_append_width(), fixes a possible bug in journal_file_append_entry_internal(), and makes use of the new function to simplify the code in other places.
* | Remove kdbus custom endpoint supportDaniel Mack2016-02-111-44/+0
| | | | | | | | | | | | This feature will not be used anytime soon, so remove a bit of cruft. The BusPolicy= config directive will stay around as compat noop.
* | tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-1060-120/+0
| | | | | | | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* | core: change internal error code for masked units from EBADR to ESHUTDOWNLennart Poettering2016-02-091-1/+1
|/ | | | | | | | | | | | | | | | | This commit changes the mapping of the BUS_ERROR_UNIT_MASKED error to ESHUTDOWN. This error is used whenever the transaction engine is asked to operate on a masked unit. ESHUTDOWN is what is used for the similar case when the unit file enable/disable logic hits a masked unit file, hence is a natural candidate to be used here too. Background: before this patch both "job type not applicable" and "unit masked" where mapped to EBADR, which transaction_add_job_and_dependencies() then checked for. It actually wanted to check exclusively for the former error condition, not the latter but due to the same mapping this failed to work. This patch semi-undoes an accidental change made in caffa4ef700fdd0eadd6c0b2ef9925611672a1bc, however restores the error number to ESHUTDOWN instead of the original ENOSYS (for the reasons indicated above). To make this easier to grok for the future, I added comments to explaining which error conditions are checked for. Fixes: #2315
* resolve: generate a nice clean error when clients try to resolve a name when ↵Lennart Poettering2016-01-252-0/+2
| | | | the network is down
* resolved: add bus API for configuring per-link DNS settingsLennart Poettering2016-01-192-0/+4
| | | | | | | | This is useful for alternative network management solutions (such as NetworkManager) to push DNS configuration data into resolved. The calls will fail should networkd already have taken possesion of a link, so that the bus API is only available if we don't get the data from networkd.
* resolved: add a couple of errors to the error mapping tablesLennart Poettering2016-01-191-0/+3
| | | | These were previously forgotten, add them now.
* bus-kernel: reword assignment of dst_id in bus_message_setup_kmsgZbigniew Jędrzejewski-Szmek2016-01-181-15/+15
| | | | | | | | Setting of dst_id was based on interplay of two booleans, making the logic hard to follow (for humans and compilers alike). gcc was confused and emmitted a warning about an uninitialized variable. Rework the code to make it obvious that dst_id is set properly.
* test-bus-error: add tests for setting error == 0Zbigniew Jędrzejewski-Szmek2016-01-181-0/+18
|
* bus-error: verify additional error maps during installationZbigniew Jędrzejewski-Szmek2016-01-182-8/+23
| | | | | | | Go over the entries in the map and check that they make sense. Tests are added. In the future we might want to do additional checks, e.g. verifying that the error names are in the expected format.
* basic,bus-error: return negative error from errno_from_nameZbigniew Jędrzejewski-Szmek2016-01-181-20/+17
| | | | | | | | | | errno_from_name used an unusual return convention where 0 meant "not found". This tripped up config_parse_syscall_errno(), which would treat that as success. Return -EINVAL instead, and adjust bus_error_name_to_errno() for the new convention. Also remove a goto which was used as a simple if and clean up surroudning code a bit.
* tree-wide: use xsprintf() where applicableDaniel Mack2016-01-121-2/+5
| | | | Also add a coccinelle receipt to help with such transitions.
* resolved: don't attempt to send queries for DNSSEC RR types to servers not ↵Lennart Poettering2016-01-111-0/+1
| | | | | | | | | | | supporting them If we already degraded the feature level below DO don't bother with sending requests for DS, DNSKEY, RRSIG, NSEC, NSEC3 or NSEC3PARAM RRs. After all, we cannot do DNSSEC validation then anyway, and we better not press a legacy server like this with such modern concepts. This also has the benefit that when we try to validate a response we received using DNSSEC, and we detect a limited server support level while doing so, all further auxiliary DNSSEC queries will fail right-away.
* tests: use sd_bus_flush_close_unref instead of sd_bus_unref in test-bus-cleanupEvgeny Vereshchagin2016-01-051-5/+5
| | | | | | | | | | | | | | | | | | | | | | Fixes: $ make valgrind-tests TESTS=test-bus-cleanup ==6363== 9 bytes in 1 blocks are possibly lost in loss record 1 of 28 ==6363== at 0x4C2BBCF: malloc (vg_replace_malloc.c:299) ==6363== by 0x197D12: hexmem (hexdecoct.c:79) ==6363== by 0x183083: bus_socket_start_auth_client (bus-socket.c:639) ==6363== by 0x1832A0: bus_socket_start_auth (bus-socket.c:678) ==6363== by 0x183438: bus_socket_connect (bus-socket.c:705) ==6363== by 0x14B0F2: bus_start_address (sd-bus.c:1053) ==6363== by 0x14B592: sd_bus_start (sd-bus.c:1134) ==6363== by 0x14B95E: sd_bus_open_system (sd-bus.c:1235) ==6363== by 0x1127E2: test_bus_open (test-bus-cleanup.c:42) ==6363== by 0x112AAE: main (test-bus-cleanup.c:87) ==6363== ... $ ./libtool --mode=execute valgrind ./test-bus-cleanup ==6584== LEAK SUMMARY: ... ==6584== possibly lost: 10,566 bytes in 27 blocks
* resolved: explicitly handle case when the trust anchor is emptyLennart Poettering2016-01-041-0/+1
| | | | | | | | | | | | | | | | | | Since we honour RFC5011 revoked keys it might happen we end up with an empty trust anchor, or one where there's no entry for the root left. With this patch the logic is changed what to do in this case. Before this patch we'd end up requesting the root DS, which returns with NODATA but a signed NSEC we cannot verify, since the trust anchor is empty after all. Thus we'd return a DNSSEC result of "missing-key", as we lack a verified version of the key. With this patch in place, look-ups for the root DS are explicitly recognized, and not passed on to the DNS servers. Instead, if downgrade-ok mode is on an unsigned NODATA response is synthesized, so that the validator code continues under the assumption the root zone was unsigned. If downgrade-ok mode is off a new transaction failure is generated, that makes this case recognizable.
* resolved: introduce a proper bus error for DNSSEC validation errorsLennart Poettering2016-01-041-0/+1
|
* Merge pull request #2241 from poettering/dnssec9Tom Gundersen2016-01-012-1/+4
|\ | | | | Ninth DNSSEC patch set
| * resolved: properly handle SRV RRs with the DNS root as hostnameLennart Poettering2015-12-292-0/+2
| |
| * resolved: add errno mapping for BUS_ERROR_CONNECTION_FAILURELennart Poettering2015-12-291-0/+1
| | | | | | | | | | This was missing when the error type was added in ac720200b7e5b80cc4985087e38f3452e5b3b080.
| * resolved: change mapping of BUS_ERROR_NO_NAME_SERVERS to ESRCHLennart Poettering2015-12-291-1/+1
| | | | | | | | EIO is really too generic, and indicates transmission problems.
* | tests: fix memory leak in test-bus-marshalEvgeny Vereshchagin2015-12-291-0/+2
|/ | | | | | | | | | | | | | | | | | | Fixes: ``` $ ./configure ... --enable-dbus $ make $ make valgrind-tests TESTS=test-bus-marshal ... ==25301== 51 bytes in 1 blocks are definitely lost in loss record 7 of 18 ==25301== at 0x4C2DD9F: realloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==25301== by 0x5496B8C: ??? (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.3) ==25301== by 0x54973E3: _dbus_string_append_printf_valist (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.3) ==25301== by 0x547E5C2: _dbus_set_error_valist (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.3) ==25301== by 0x547E73E: dbus_set_error (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.3) ==25301== by 0x548969A: dbus_message_demarshal (in /lib/x86_64-linux-gnu/libdbus-1.so.3.14.3) ==25301== by 0x115C1A: main (test-bus-marshal.c:244) ==25301== ```
* resolved: generate an explicit transaction error when we cannot reach server ↵Lennart Poettering2015-12-261-0/+1
| | | | | | | | | | via TCP Previously, if we couldn't reach a server via UDP we'd generate an MAX_ATTEMPTS transaction result, but if we couldn't reach it via TCP we'd generate a RESOURCES transaction result. While it is OK to generate two different errors I think, "RESOURCES" is certainly a misnomer. Introduce a new transaction result "CONNECTION_FAILURE" instead.
* tests: turn check if manager cannot be intialized into macroZbigniew Jędrzejewski-Szmek2015-12-021-1/+1
| | | | | | | | | | We need to check the same thing in multiple tests. Use a shared macro to make it easier to update the list of errnos. Change the errno code for "unitialized cgroup fs" for ENOMEDIUM. Exec format error looks like something more serious. This fixes test-execute invocation in mock.
* selinux: split up mac_selinux_have() from mac_selinux_use()Lennart Poettering2015-11-271-1/+1
| | | | | | | | | | | | | Let's distuingish the cases where our code takes an active role in selinux management, or just passively reports whatever selinux properties are set. mac_selinux_have() now checks whether selinux is around for the passive stuff, and mac_selinux_use() for the active stuff. The latter checks the former, plus also checks UID == 0, under the assumption that only when we run priviliged selinux management really makes sense. Fixes: #1941
* tree-wide: expose "p"-suffix unref calls in public APIs to make gcc cleanup easyLennart Poettering2015-11-2725-123/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* tree-wide: sort includes in *.hThomas Hindoe Paaboel Andersen2015-11-185-1/+5
| | | | | This is a continuation of the previous include sort patch, which only sorted for .c files.
* Merge pull request #1923 from zonque/siphashLennart Poettering2015-11-171-1/+1
|\ | | | | siphash24: let siphash24_finalize() and siphash24() return the result…
| * siphash24: let siphash24_finalize() and siphash24() return the result directlyDaniel Mack2015-11-161-1/+1
| | | | | | | | | | | | | | | | | | | | Rather than passing a pointer to return the result, return it directly from the function calls. Also, return the result in native endianess, and let the callers care about the conversion. For hash tables and bloom filters, we don't care, but in order to keep MAC addresses and DHCP client IDs stable, we explicitly convert to LE.
* | tree-wide: sort includesThomas Hindoe Paaboel Andersen2015-11-1618-29/+31
| | | | | | | | Sort the includes accoding to the new coding style.
* | tree-wide: add missing includesThomas Hindoe Paaboel Andersen2015-11-161-0/+1
|/ | | | Add a few includes that we rely on to be include already.
* siphash24: change result argument to uint64_tMartin Pitt2015-11-161-3/+3
| | | | | | | | | | | | Change the "out" parameter from uint8_t[8] to uint64_t. On architectures which enforce pointer alignment this fixes crashes when we previously cast an unaligned array to uint64_t*, and on others this should at least improve performance as the compiler now aligns these properly. This also simplifies the code in most cases by getting rid of typecasts. The only place which we can't change is struct duid's en.id, as that is _packed_ and public API, so we can't enforce alignment of the "id" field and have to use memcpy instead.
* sd-bus: don't try to acquire connection selinux label unless selinux is ↵Lennart Poettering2015-11-112-4/+11
| | | | | | | | | | actually enabled Otherwise we might end up mistaking a SMACK label for an selinux label. Also, fixes unexpect debug messages: http://lists.freedesktop.org/archives/systemd-devel/2015-November/034913.html
* doc: correct punctuation and improve typography in documentationJan Engelhardt2015-11-061-1/+1
|