core: rearrange code so that libsystemd/sd-bus/ does not include header files from core Stuff in src/shared or src/libsystemd should *never* include code from src/core or any of the tools, so don't do that here either. It's not OK!
treewide: introduce UID_INVALID (and friends) as macro for (uid_t) -1
treewide: more log_*_errno + return simplifications
treewide: no need to negate errno for log_*_errno() It corrrectly handles both positive and negative errno values.
treewide: auto-convert the simple cases to log_*_errno() As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
bus-proxy: beef up policy enforcement - actually return permission errors to clients - use the right ucreds field - fix error paths when we cannot keep track of locally acquired names due to OOM - avoid unnecessary global variables - log when the policy denies access - enforce correct policy rule order - always request all the metadata its we need to make decisions
bus-policy: actually test messages against the newly added test.conf
bus-policy: steal a test case for prefix ownership from dbus1, and make sure it passes with the bus proxy enforcement
bus-proxy: properly check for bus name prefixes when enforcing policy
bus-policy: move name list iteration to policy users We need to figure out which of the possible names satisfied the policy, so we cannot do the iteration in check_policy_item() but have to leave it to the users. Test cases amended accordingly.
bus-proxyd: assorted cleanups and fixes Just some cleanups around policy checks that came up during review. The code is still not productive.
bus-proxy: drop one wrong assert()
bus-proxyd: add some asserts Both as documentation, and to make Coverity happy. Fixes CID #1241495 and #1241496.
bus-policy: split API for bus-proxyd Instead of operating on an sd_bus_message object, expose an API that has 4 functions: policy_check_own() policy_check_hello() policy_check_recv() policy_check_send() This also allows dropping extra code to parse message contents - the bus proxy already has dedicated code paths for that, and we can hook into those later. Tests amended accordingly.
bus-policy: add policy check function Add policy_check() to actually check whether an incoming message is allowed by the policy. The code is not yet used from the proxy daemon, though.
bus-policy: print numeric [gu]id in dump_items()
bus-policy: do not exit() from policy_dump() This function is quite useful for debugging. Exiting from it seems unnecessary.
bus-policy: implement dump_items() with LIST_FOREACH Instead of making the function call itself recursively.
bus-policy: resolve [ug]id of POLICY_ITEM_{USER,GROUP} Do the lookup during parsing already, and set i->uid, or i->gid to the numerical values.
bus_policy: set i->[ug]id_valid