summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2021-03-30 11:03:51 +0200
committerOndrej Holy <oholy@redhat.com>2021-03-31 15:56:59 +0200
commit09733ddc402fe3999ac323d8d4cbddd938659016 (patch)
tree20ec586dece24f9c296592e8d4a487e4eade5e27
parente5761b3315bcd0f786cb7901b07343606ca19acb (diff)
downloadgvfs-09733ddc402fe3999ac323d8d4cbddd938659016.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)