diff options
author | Karel Zak | 2011-03-15 10:31:06 +0100 |
---|---|---|
committer | Karel Zak | 2011-03-15 10:31:06 +0100 |
commit | c56226697342ddd663492f77768e7a7cb8e579a1 (patch) | |
tree | b31b230075b6f0f8b8fb80ca5a9cf4f1e5ead7f4 /mount | |
parent | libmount: cleanup *_do_[u]mount() return codes and docs (diff) | |
download | kernel-qcow2-util-linux-c56226697342ddd663492f77768e7a7cb8e579a1.tar.gz kernel-qcow2-util-linux-c56226697342ddd663492f77768e7a7cb8e579a1.tar.xz kernel-qcow2-util-linux-c56226697342ddd663492f77768e7a7cb8e579a1.zip |
umount: call /sbin/umount.<uhelper> for root user too
Originally the "uhelper=" was ignored for root, now the umount command
calls /sbin/umount.<uhelper> always.
This change is necessary for things like pam_mount where a device has
to be uninitialized by uhelper rather than directly umounted by
umount(2).
Note that all uhelpers has to be linked with libmount or execute
umount -fake -i /mountpoint
to remove mountpoint entry from /etc/mtab or /dev/.mount/utab.
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'mount')
-rw-r--r-- | mount/umount.8 | 4 | ||||
-rw-r--r-- | mount/umount.c | 33 |
2 files changed, 16 insertions, 21 deletions
diff --git a/mount/umount.8 b/mount/umount.8 index 3606caae9..b2d8c8569 100644 --- a/mount/umount.8 +++ b/mount/umount.8 @@ -155,10 +155,6 @@ where the <suffix> is filesystem type or a value from "uhelper=" mtab option. The \-t option is used for filesystems with subtypes support (for example /sbin/mount.fuse -t fuse.sshfs). -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 42671f465..3e4dc337b 100644 --- a/mount/umount.c +++ b/mount/umount.c @@ -559,6 +559,22 @@ umount_file (char *arg) { if (!mc && verbose) printf(_("Could not find %s in mtab\n"), file); + /* + * uhelper - umount helper + * -- external umount (for example HAL mounts) + */ + if (external_allowed && mc) { + char *uhelper = NULL; + + if (mc->m.mnt_opts) + uhelper = get_option_value(mc->m.mnt_opts, "uhelper="); + if (uhelper) { + int status = 0; + if (check_special_umountprog(arg, arg, uhelper, &status)) + return status; + } + } + if (restricted) { char *mtab_user = NULL; @@ -566,23 +582,6 @@ 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_option_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. |