]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
umount: use helper= for all UIDs
authorKarel Zak <kzak@redhat.com>
Fri, 1 Apr 2011 07:03:39 +0000 (09:03 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 1 Apr 2011 07:03:39 +0000 (09:03 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
mount/mount.c
mount/umount.8
mount/umount.c
shlibs/mount/src/context_umount.c
shlibs/mount/src/libmount.h.in
shlibs/mount/src/optmap.c

index dc357a09859acfe1ab5b65e5fede23fe60af092c..b508de674d1f9bdd2afcf70b51975badde4a17fd 100644 (file)
@@ -209,7 +209,7 @@ static const struct opt_map opt_map[] = {
 static int opt_nofail = 0;
 
 static const char *opt_loopdev, *opt_vfstype, *opt_offset, *opt_sizelimit,
-        *opt_encryption, *opt_speed, *opt_comment, *opt_uhelper, *opt_phelper;
+        *opt_encryption, *opt_speed, *opt_comment, *opt_uhelper, *opt_helper;
 
 static int is_readonly(const char *node);
 static int mounted (const char *spec0, const char *node0);
@@ -229,7 +229,7 @@ static struct string_opt_map {
   { "speed=", 0, &opt_speed },
   { "comment=", 1, &opt_comment },
   { "uhelper=", 0, &opt_uhelper },
-  { "phelper=", 0, &opt_phelper },
+  { "helper=", 0, &opt_helper },
   { NULL, 0, NULL }
 };
 
index 69196e539edcf7e948a369b3f97ef1ac85048476..4bce485c29d8a1a5970349bab276925d8c962718 100644 (file)
@@ -151,17 +151,16 @@ The syntax of external umount helpers is:
 .IR type.subtype ]
 .br
 
-where the <suffix> is filesystem type or a value from "uhelper=" or "phelper="
+where the <suffix> is filesystem type or a value from "uhelper=" or "helper="
 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
+The uhelper= (unprivileged umount helper) is possible to use when non-root user
 wants to umount a mountpoint which is not defined in the /etc/fstab file (e.g
 devices mounted by udisk).
 
-The phelper (privileged umount helper) is possible to used when root user wants
-to umount a mountpoint which should not be directly umounted by umount(8) (e.g.
-devices mounted by pam_mount).
+The helper= mount option redirects all umount requests to the
+/sbin/umount.<helper> independently on UID.
 
 .SH FILES
 .I /etc/mtab
index f69e5bf33835f6989a518133694d4f390f4350cf..2e7bd31cef4bb6505b72a7f8588c8bf84b343c62 100644 (file)
@@ -654,6 +654,15 @@ umount_file (char *arg) {
        if (!mc && verbose)
                printf(_("Could not find %s in mtab\n"), file);
 
+       if (mc) {
+               /*
+                * helper - umount helper (e.g. pam_mount)
+                */
+                if (check_helper_umountprog(arg, arg, mc->m.mnt_opts,
+                                           "helper=", &status))
+                       return status;
+       }
+
        if (restricted) {
                char *mtab_user = NULL;
 
@@ -738,13 +747,6 @@ umount_file (char *arg) {
                             mtab_user ? mtab_user : "root",
                             fs->m.mnt_fsname, fs->m.mnt_dir);
 
-       } else if (mc) {
-               /*
-                * phelper - privileged umount helper (e.g. pam_mount)
-                */
-                if (check_helper_umountprog(arg, arg, mc->m.mnt_opts,
-                                           "phelper=", &status))
-                       return status;
        }
 
        if (mc)
index 08b0fd46c55614a4229cd95aeba095c5217012cd..e10af52f2cf9d26c0265a639c1b6007a0617f49e 100644 (file)
@@ -584,9 +584,9 @@ int mnt_context_prepare_umount(struct libmnt_context *cxt)
 
        if (!rc && !cxt->helper) {
 
-               if (!cxt->restricted && (cxt->user_mountflags & MNT_MS_PHELPER))
-                       /* on phelper= mount option based helper */
-                       rc = prepare_helper_from_options(cxt, "phelper");
+               if (cxt->user_mountflags & MNT_MS_HELPER)
+                       /* on helper= mount option based helper */
+                       rc = prepare_helper_from_options(cxt, "helper");
 
                if (!rc && !cxt->helper)
                        /* on fstype based helper */
index 1738726992b262d22e9acb54357c786444c480be..4eba4c748dfcb83f44a61de9deba370b9c2d7192 100644 (file)
@@ -439,7 +439,7 @@ extern int mnt_context_do_umount(struct libmnt_context *cxt);
 #define MNT_MS_LOOP     (1 << 9)
 #define MNT_MS_NOFAIL   (1 << 10)
 #define MNT_MS_UHELPER  (1 << 11)
-#define MNT_MS_PHELPER  (1 << 12)
+#define MNT_MS_HELPER   (1 << 12)
 
 /*
  * mount(2) MS_* masks (MNT_MAP_LINUX map)
index 4924e9ae326c9ed9430398b58ea014d7cc8cbe65..acd76173fde9ed60f4e49726bbe4bf97420f465f 100644 (file)
@@ -155,7 +155,7 @@ static const struct libmnt_optmap userspace_opts_map[] =
 
    { "uhelper=", MNT_MS_UHELPER },                        /* /sbin/umount.<helper> */
 
-   { "phelper=", MNT_MS_PHELPER },                        /* /sbin/umount.<helper> */
+   { "helper=", MNT_MS_HELPER },                          /* /sbin/umount.<helper> */
 
    { NULL, 0, 0 }
 };