* [PATCH] mount: Fix -t in listing mode when run as non-root
@ 2013-01-03 6:05 Richard Tollerton
2013-01-09 13:51 ` Karel Zak
0 siblings, 1 reply; 2+ messages in thread
From: Richard Tollerton @ 2013-01-03 6:05 UTC (permalink / raw)
To: util-linux; +Cc: Richard Tollerton
Presently, libmount-mount completely prohibits the use of -t by non-root
users. This breaks using -t in listing mode as a user, which represents
a regression against mount-deprecated, macosx and presumably *BSD.
This commit fixes the issue by deferring the mnt_context_is_restricted
check for -t until we know we're not in listing mode.
Signed-off-by: Rich Tollerton <rich.tollerton@ni.com>
---
sys-utils/mount.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/sys-utils/mount.c b/sys-utils/mount.c
index e29e34c..fed96eb 100644
--- a/sys-utils/mount.c
+++ b/sys-utils/mount.c
@@ -800,7 +800,7 @@ int main(int argc, char **argv)
/* only few options are allowed for non-root users */
if (mnt_context_is_restricted(cxt) &&
- !strchr("hlLUVvpris", c) &&
+ !strchr("hlLUVvprist", c) &&
c != MOUNT_OPT_TARGET &&
c != MOUNT_OPT_SOURCE)
exit_non_root(option_to_longopt(c, longopts));
@@ -950,6 +950,11 @@ int main(int argc, char **argv)
goto done;
}
+ /* Non-root users are allowed to use -t to print_all(),
+ but not to mount */
+ if (mnt_context_is_restricted(cxt) && types)
+ exit_non_root("types");
+
if (oper && (types || all || mnt_context_get_source(cxt)))
usage(stderr);
--
1.8.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] mount: Fix -t in listing mode when run as non-root
2013-01-03 6:05 [PATCH] mount: Fix -t in listing mode when run as non-root Richard Tollerton
@ 2013-01-09 13:51 ` Karel Zak
0 siblings, 0 replies; 2+ messages in thread
From: Karel Zak @ 2013-01-09 13:51 UTC (permalink / raw)
To: Richard Tollerton; +Cc: util-linux
On Thu, Jan 03, 2013 at 12:05:34AM -0600, Richard Tollerton wrote:
> Presently, libmount-mount completely prohibits the use of -t by non-root
> users. This breaks using -t in listing mode as a user, which represents
> a regression against mount-deprecated, macosx and presumably *BSD.
Applied, thanks.
Note that suggested way is to use findmnt(8), mount(8) output is
maintained only for backward compatibility.
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-09 13:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-03 6:05 [PATCH] mount: Fix -t in listing mode when run as non-root Richard Tollerton
2013-01-09 13:51 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox