summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2020-10-14 11:57:38 +0100
committerSimon McVittie <smcv@collabora.com>2020-10-15 09:24:14 +0100
commit1a58a866765f5cd777a46363059cf728139db597 (patch)
tree56ba87baf6e4578edfd635738b319ac55e7cc1fc
parent6c79a571146cc645e03a2262800505748e00fa10 (diff)
downloadflatpak-1a58a866765f5cd777a46363059cf728139db597.tar.gz
Skip parental controls checks on ServiceUnknown or NameHasNoOwner
If accountsservice isn't available on the system bus, then we can't ask it for the user's parental controls settings, and we also can't ask it whether it even has the malcontent extension. Since this is not a real security boundary, fail open. This can be dropped if we depend on a version of libmalcontent that maps these errors to MCT_APP_FILTER_ERROR_DISABLED. Resolves: https://github.com/flatpak/flatpak/issues/3902 Bug-Debian: https://bugs.debian.org/972138 Signed-off-by: Simon McVittie <smcv@collabora.com>
-rw-r--r--common/flatpak-dir.c7
-rw-r--r--common/flatpak-run.c7
2 files changed, 14 insertions, 0 deletions
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c
index ee06c9e7..0c80c0e1 100644
--- a/common/flatpak-dir.c
+++ b/common/flatpak-dir.c
@@ -7658,6 +7658,13 @@ flatpak_dir_check_parental_controls (FlatpakDir *self,
"controls are disabled globally", ref);
return TRUE;
}
+ else if (g_error_matches (local_error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN) ||
+ g_error_matches (local_error, G_DBUS_ERROR, G_DBUS_ERROR_NAME_HAS_NO_OWNER))
+ {
+ g_debug ("Skipping parental controls check for %s since a required "
+ "service was not found", ref);
+ return TRUE;
+ }
else if (local_error != NULL)
{
g_propagate_error (error, g_steal_pointer (&local_error));
diff --git a/common/flatpak-run.c b/common/flatpak-run.c
index 8e4046da..d45c32cd 100644
--- a/common/flatpak-run.c
+++ b/common/flatpak-run.c
@@ -3432,6 +3432,13 @@ check_parental_controls (const char *app_ref,
"controls are disabled globally", app_ref);
return TRUE;
}
+ else if (g_error_matches (local_error, G_DBUS_ERROR, G_DBUS_ERROR_SERVICE_UNKNOWN) ||
+ g_error_matches (local_error, G_DBUS_ERROR, G_DBUS_ERROR_NAME_HAS_NO_OWNER))
+ {
+ g_debug ("Skipping parental controls check for %s since a required "
+ "service was not found", app_ref);
+ return TRUE;
+ }
else if (local_error != NULL)
{
g_propagate_error (error, g_steal_pointer (&local_error));