summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2021-03-30 11:03:51 +0200
committerOndrej Holy <oholy@redhat.com>2021-04-15 07:12:32 +0000
commit117d5318ac01858a0ee922c1e8a5d83fde9b3670 (patch)
treef2945acd349acdc35c82aaadba5581b930e508b0
parent034ca8bd921919e4543481cd22c420258c0a54cd (diff)
downloadgvfs-117d5318ac01858a0ee922c1e8a5d83fde9b3670.tar.gz
admin: Fail when peer credentials are not available
Currently, critical errors are printed when peer credentials aren't available (i.e. session bus fallback is used). Let's return an error immediately to prevent the criticals. Also add warning with suggestion to allow `--filesystem=xdg-run/gvfsd` access. https://gitlab.gnome.org/GNOME/gvfs/-/issues/305
-rw-r--r--daemon/gvfsbackendadmin.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/daemon/gvfsbackendadmin.c b/daemon/gvfsbackendadmin.c
index d6168520..dd5eb3dc 100644
--- a/daemon/gvfsbackendadmin.c
+++ b/daemon/gvfsbackendadmin.c
@@ -95,6 +95,15 @@ check_permission (GVfsBackendAdmin *self,
invocation = dbus_job->invocation;
connection = g_dbus_method_invocation_get_connection (invocation);
credentials = g_dbus_connection_get_peer_credentials (connection);
+ if (!credentials)
+ {
+ g_warning ("The admin backend doesn't work with the session bus "
+ "fallback. Your application is probably missing "
+ "--filesystem=xdg-run/gvfsd privileges.");
+ g_vfs_job_failed_literal (job, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+ _("Operation not supported"));
+ return FALSE;
+ }
pid = g_credentials_get_unix_pid (credentials, &error);
if (error != NULL)