[gvfs/wip/oholy/admin-fixes: 8/9] admin: Fail when peer credentials are not available
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/wip/oholy/admin-fixes: 8/9] admin: Fail when peer credentials are not available
- Date: Thu, 15 Apr 2021 07:12:33 +0000 (UTC)
commit 117d5318ac01858a0ee922c1e8a5d83fde9b3670
Author: Ondrej Holy <oholy redhat com>
Date: Tue Mar 30 11:03:51 2021 +0200
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
daemon/gvfsbackendadmin.c | 9 +++++++++
1 file changed, 9 insertions(+)
---
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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]