From ae24405030d6759f209a19d2eedaf5060715701a Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Wed, 8 Mar 2023 18:00:34 +0100 Subject: [PATCH] Extend Filesystem.Mount() to allow mounting on behalf of another user Filesystems are mounted for the user who makes the D-Bus API call. This has an effect on a few things, notably who has permissions to unmount it later and also the path of the mount point, usually in the form of /run/media/USER/LABEL This patch adds a new parameter to the Filesystem.Mount() method that allows mounting a filesystem on behalf of a different user. Fixes #1065 (cherry picked from commit 2fddf2b951b993303fe07813ad2398ab91937911) --- data/org.freedesktop.UDisks2.policy.in | 11 +++ data/org.freedesktop.UDisks2.xml | 8 ++- src/tests/dbus-tests/test_80_filesystem.py | 80 ++++++++++++++++++++++ src/udisksdaemonutil.c | 53 ++++++++++++++ src/udisksdaemonutil.h | 6 ++ src/udiskslinuxfilesystem.c | 60 ++++++++++++---- 6 files changed, 202 insertions(+), 16 deletions(-) diff --git a/data/org.freedesktop.UDisks2.policy.in b/data/org.freedesktop.UDisks2.policy.in index 4b02f46f..816620d7 100644 --- a/data/org.freedesktop.UDisks2.policy.in +++ b/data/org.freedesktop.UDisks2.policy.in @@ -44,6 +44,17 @@ + + + Mount a filesystem on behalf of another user + Authentication is required to mount the filesystem + + auth_admin + auth_admin + auth_admin_keep + + + Mount/unmount filesystems defined in the fstab file with the x-udisks-auth option diff --git a/data/org.freedesktop.UDisks2.xml b/data/org.freedesktop.UDisks2.xml index a3ea4901..2a1704ee 100644 --- a/data/org.freedesktop.UDisks2.xml +++ b/data/org.freedesktop.UDisks2.xml @@ -1853,7 +1853,7 @@