summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen W. Taylor <otaylor@fishsoup.net>2021-01-13 08:34:21 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-02-02 17:17:19 +0100
commitc26931cf325b8bb883912794b0d238071000faf2 (patch)
treeb7a7cd5def1f1849144757abf22b155df271e41b
parentdef3ea14df31ad827c7ef2af3b6ce96ca2e0ebcf (diff)
downloadsystemd-c26931cf325b8bb883912794b0d238071000faf2.tar.gz
Fix nss-resolve to properly fallback in a Flatpak sandbox
For unknown reasons, sd-bus has trouble connecting to the filtered D-Bus system proxy exported by Flatpak and the connection to the bus is closed during authentication. Don't mistake this for a remote error - that was causing a hard "not found" failure rather than a fallback. See: https://bugzilla.redhat.com/show_bug.cgi?id=1912131 for background.
-rw-r--r--src/nss-resolve/nss-resolve.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/nss-resolve/nss-resolve.c b/src/nss-resolve/nss-resolve.c
index a096ac0d99..3b014a5ae9 100644
--- a/src/nss-resolve/nss-resolve.c
+++ b/src/nss-resolve/nss-resolve.c
@@ -23,7 +23,8 @@ NSS_GETHOSTBYNAME_PROTOTYPES(resolve);
NSS_GETHOSTBYADDR_PROTOTYPES(resolve);
static bool bus_error_shall_fallback(sd_bus_error *e) {
- return sd_bus_error_has_name(e, SD_BUS_ERROR_SERVICE_UNKNOWN) ||
+ return sd_bus_error_get_errno(e) == ENOTCONN ||
+ sd_bus_error_has_name(e, SD_BUS_ERROR_SERVICE_UNKNOWN) ||
sd_bus_error_has_name(e, SD_BUS_ERROR_NAME_HAS_NO_OWNER) ||
sd_bus_error_has_name(e, SD_BUS_ERROR_NO_REPLY) ||
sd_bus_error_has_name(e, SD_BUS_ERROR_ACCESS_DENIED) ||