[AC_HELP_STRING([--enable-mount],
[Create mount.nfs and don't use the util-linux mount(8) functionality. @<:@default=no@:>@])],
enable_mount=$enableval,
- enable_mount=no)
+ enable_mount=yes)
AM_CONDITIONAL(CONFIG_MOUNT, [test "$enable_mount" = "yes"])
# Check whether user wants TCP wrappers support
(cd $(DESTDIR)$(sbindir) && \
ln -sf mount.nfs mount.nfs4 && \
ln -sf mount.nfs umount.nfs && \
- ln -sf mount.nfs umount.nfs4)
+ ln -sf mount.nfs umount.nfs4 && \
+ chmod 4511 mount.nfs )
uninstall-hook:
(cd $(DESTDIR)$(sbindir) && \
rm -f mount.nfs4 umount.nfs umount.nfs4)
if ((mc = getfsfile(mount_point)) == NULL ||
strcmp(mc->m.mnt_fsname, spec) != 0 ||
- strcmp(mc->m.mnt_type, (nfs_mount_vers == 4 ? "nfs4":"nfs")) != 0 ||
- strcmp(mc->m.mnt_opts, mount_opts) != 0) {
+ strcmp(mc->m.mnt_type, (nfs_mount_vers == 4 ? "nfs4":"nfs")) != 0
+ ) {
fprintf(stderr, "%s: permission died - no match for fstab\n",
progname);
exit(1);
}
+ /* 'mount' munges the options from fstab before passing them
+ * to us, so it is non-trivial to test that we have the correct
+ * set of options and we don't want to trust what the user
+ * gave us, so just take whatever is in fstab
+ */
+ mount_opts = strdup(mc->m.mnt_opts);
mounttype = 0;
}
if (!fake) {
mnt_err = do_mount_syscall(spec, mount_point,
nfs_mount_vers == 4 ? "nfs4" : "nfs",
- flags, mount_opts);
+ flags & ~(MS_USER|MS_USERS) ,
+ mount_opts);
if (mnt_err) {
mount_error(mount_point);
if (getuid() != 0) {
/* only permitted if "user=" or "users" is in mount options */
if (!mc) {
+ /* umount might call us twice. The second time there will
+ * be no entry in mtab and we should just exit quietly
+ */
+ return 0;
+
only_root:
fprintf(stderr,"%s: You are not permitted to unmount %s\n",
progname, spec);
int len;
if (!opt)
goto only_root;
- if (opt[5] != '=')
+ if (opt[4] != '=')
goto only_root;
comma = strchr(opt, ',');
if (comma)