diff options
author | Karel Zak | 2007-04-12 14:35:46 +0200 |
---|---|---|
committer | Karel Zak | 2007-04-25 00:20:40 +0200 |
commit | dd9f213ab6efd352f67bc18071c16239d1002b94 (patch) | |
tree | e390f57c96ff0c348fce7edf6eef311fe7d7b077 | |
parent | mount: update mtab correctly when mount --move (diff) | |
download | kernel-qcow2-util-linux-dd9f213ab6efd352f67bc18071c16239d1002b94.tar.gz kernel-qcow2-util-linux-dd9f213ab6efd352f67bc18071c16239d1002b94.tar.xz kernel-qcow2-util-linux-dd9f213ab6efd352f67bc18071c16239d1002b94.zip |
mount: add support for mtab "uhelper" option
The helper is an external /sbin/umount.<suffix> program where the
suffix is a value from the uhelper= option from /etc/mtab.
The uhelper (unprivileged umount helper) is possible to used when
non-root user wants to umount a mountpoint which is not defined in the
/etc/fstab file (e.g devices mounted by HAL).
This option is already supported by HAL upstream.
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | mount/mount.c | 3 | ||||
-rw-r--r-- | mount/umount.8 | 13 | ||||
-rw-r--r-- | mount/umount.c | 17 |
3 files changed, 32 insertions, 1 deletions
diff --git a/mount/mount.c b/mount/mount.c index 1360d235d..7c1f1bdc6 100644 --- a/mount/mount.c +++ b/mount/mount.c @@ -188,7 +188,7 @@ static const struct opt_map opt_map[] = { }; static const char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_encryption, - *opt_speed, *opt_comment; + *opt_speed, *opt_comment, *opt_uhelper; static struct string_opt_map { char *tag; @@ -201,6 +201,7 @@ static struct string_opt_map { { "encryption=", 0, &opt_encryption }, { "speed=", 0, &opt_speed }, { "comment=", 1, &opt_comment }, + { "uhelper=", 0, &opt_uhelper }, { NULL, 0, NULL } }; diff --git a/mount/umount.8 b/mount/umount.8 index fafbff269..5d38ac8d3 100644 --- a/mount/umount.8 +++ b/mount/umount.8 @@ -122,6 +122,19 @@ or when the \-d option was given. Any pending loop devices can be freed using `losetup -d', see .BR losetup (8). +.SH NOTES +The syntax of external umount helpers is: + +.br +.BI "/sbin/umount.<suffix> [\-nlfvr] " "dir " | " device " +.br + +where the <suffix> is filesystem type or a value from "uhelper=" mtab option. + +The uhelper (unprivileged umount helper) is possible to used when non-root user +wants to umount a mountpoint which is not defined in the /etc/fstab file (e.g +devices mounted by HAL). + .SH FILES .I /etc/mtab table of mounted file systems diff --git a/mount/umount.c b/mount/umount.c index 676ed8cc2..8a59f120e 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -565,6 +565,23 @@ umount_file (char *arg) { die(2, _("umount: %s is not mounted (according to mtab)"), file); + /* + * uhelper - unprivileged umount helper + * -- external umount (for example HAL mounts) + */ + if (external_allowed) { + char *uhelper = NULL; + + if (mc->m.mnt_opts) + uhelper = get_value(mc->m.mnt_opts, "uhelper="); + if (uhelper) { + int status = 0; + if (check_special_umountprog(arg, arg, + uhelper, &status)) + return status; + } + } + /* The 2.4 kernel will generally refuse to mount the same filesystem on the same mount point, but will accept NFS. So, unmounting must be possible. */ |