diff options
author | Ondrej Holy <oholy@redhat.com> | 2021-03-30 10:44:06 +0200 |
---|---|---|
committer | Ondrej Holy <oholy@redhat.com> | 2021-04-15 07:12:32 +0000 |
commit | 034ca8bd921919e4543481cd22c420258c0a54cd (patch) | |
tree | fe4f6f5862e4612f8af86554fc1f6b41659f87b4 | |
parent | 5f9cffd11dc69a9422726a059c7c31bae4b46338 (diff) | |
download | gvfs-034ca8bd921919e4543481cd22c420258c0a54cd.tar.gz |
admin: Pass also XDG_RUNTIME_DIR to pkexec environment
Recently, GVfs switched from abstract sockets to named sockets. The
sockets are created in the `XDG_RUNTIME_DIR` directory. This directory
is not unfortunatelly set for `gvfsd-admin` and thus the root's cache
dir is used instead, which is wrong. Let's pass the `XDG_RUNTIME_DIR`
environment variable to the `pkexec` environment similarly to
`DBUS_SESSION_BUS_ADDRESS`.
Fixes: https://gitlab.gnome.org/GNOME/gvfs/-/issues/552
-rw-r--r-- | daemon/admin.mount.in | 2 | ||||
-rw-r--r-- | daemon/gvfsbackendadmin.c | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/daemon/admin.mount.in b/daemon/admin.mount.in index 4fb97701..09f3b6f8 100644 --- a/daemon/admin.mount.in +++ b/daemon/admin.mount.in @@ -1,7 +1,7 @@ [Mount] Type=admin # Add a dummy argument after pkexec, or '/bin/sh -c' will eat the first argument in '$@' -Exec=/bin/sh -c 'pkexec @libexecdir@/gvfsd-admin "$@" --address $DBUS_SESSION_BUS_ADDRESS' gvfsd-admin +Exec=/bin/sh -c 'pkexec @libexecdir@/gvfsd-admin "$@" --address $DBUS_SESSION_BUS_ADDRESS --dir $XDG_RUNTIME_DIR' gvfsd-admin AutoMount=false DBusName=org.gtk.vfs.mountpoint_admin MountPerClient=true diff --git a/daemon/gvfsbackendadmin.c b/daemon/gvfsbackendadmin.c index a56e2bd3..d6168520 100644 --- a/daemon/gvfsbackendadmin.c +++ b/daemon/gvfsbackendadmin.c @@ -1094,8 +1094,10 @@ acquire_caps (uid_t uid) } static char *session_address = NULL; +static char *runtime_dir = NULL; static GOptionEntry entries[] = { { "address", 0, 0, G_OPTION_ARG_STRING, &session_address, "DBus session address", NULL }, + { "dir", 0, 0, G_OPTION_ARG_STRING, &runtime_dir, "Runtime dir", NULL }, { NULL } }; @@ -1134,4 +1136,7 @@ g_vfs_backend_admin_pre_setup (int *argc, acquire_caps (uid); g_setenv ("DBUS_SESSION_BUS_ADDRESS", session_address, TRUE); + + if (runtime_dir) + g_setenv ("XDG_RUNTIME_DIR", runtime_dir, TRUE); } |