Commit Graph

49 Commits

Author SHA1 Message Date
Karel Zak fcc0413a12 mount: improve --move error message on shared trees
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-03-25 15:29:30 +01:00
Karel Zak 82a2c1600d libmount: correctly propagate ambivalent blkid probing results
libmount ignores "ambivalent probing result" from libblkid and tries
filesystems /etc/filesystems. This is incorrect behavior.

Reported-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-02-13 12:36:10 +01:00
Bernhard Voelker 9b4257c8b3 mount: fix bind mount success message
* sys-utils/mount.c (success_message): s/binded/bound/.

Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
2013-02-06 11:12:46 +01:00
Karel Zak b4ec4573df mount: make --verbose more verbose about propagation
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-15 16:09:07 +01:00
Karel Zak f5ae1d706e mount: write success messages to stdout
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-15 15:53:46 +01:00
Karel Zak be6904b92f mount: support multiple MS_PROPAGATION flags in one mount(8) exec
Signed-off-by: Karel Zak <kzak@redhat.com>
2013-01-15 14:23:54 +01:00
Richard Tollerton 1707b9b104 mount: Fix -t in listing mode when run as non-root
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>
2013-01-09 14:47:25 +01:00
Karel Zak 5ebbc3865d mount: sanitize paths from non-root users
$ mount /root/.ssh/../../dev/sda2
 mount: only root can mount UUID=17bc65ec-4125-4e7c-8a7d-e2795064c736 on /boot

this is too promiscuous. It seems better to ignore on command line
specified paths which are not resolve-able for non-root users.

Fixed version:

  $ mount /root/.ssh/../../dev/sda2
  mount: /root/.ssh/../../dev/sda2: Permission denied

  $ mount /dev/sda2
  mount: only root can mount UUID=17bc65ec-4125-4e7c-8a7d-e2795064c736 on /boot

Note that this bug has no relation to mount(2) permissions evaluation
in suid mode. The way how non-root user specifies paths on command
line is completely irrelevant for comparison with fstab entries.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-11-26 16:24:54 +01:00
Karel Zak 59414c6b4a mount: supports paths canonicalization for alternative fstabs
# mount --fstab /path/my.fstab

has to support standard operations with paths.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-24 23:59:04 +02:00
Karel Zak 84600ddc6d mount: add verbose messages
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=864227
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-10-09 11:56:35 +02:00
Ludwig Nussel 5cf05c7147 mount: losetup: remove obsolete encryption support
kernel cryptoloop is deprecated since ages and support for cryptoloop
in util-linux is incomplete/broken.
- no password hashing
- last 8 bit of key are always set to zero
- no binary keys possible (stops reading key at \n and \0)

In the past some Distros added the above features with patches. So
remove cryptoloop support from util-linux completely to make sure
people won't try using it.

Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-09-11 10:46:11 +02:00
Karel Zak 5f7c18902f mount: replace control chars in mountpoint name
For compatibility with coreutils and to avoid complex solutions in
mount output mount replaces control characters with '?'.

Note that the listing mode in mount(8) is in maintenance mode --
findmnt(8) provides more robust and better solutions.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-08-06 12:49:41 +02:00
Karel Zak 48afe4ddd5 mount: remove unnecessary free()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-26 19:04:30 +02:00
Karel Zak 51a37c1906 mount: use err_exclusive_options()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-26 09:26:21 +02:00
Karel Zak aedeaa40d1 mount: (new) add --source and --target
In some cases (for example if only one mount argument is given) may be
mount request ambivalent:

	# mount /foo

and fstab:

	/dev/sda5	/foo	rw	0	0
	/foo		/bar	bind	0	0

the new options allows to be more explicit

        # mount --target /foo		(mounts /dev/sda5)

	# mount --source /foo		(binds /foo to /bar)

It's possible to use the options together

	# mount --source /dev/sda2 --target /home

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-07-17 22:02:35 +02:00
Sami Kerola 38483b86e3 mount: (new) use exclusive_option()
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-06-17 17:59:59 +02:00
Karel Zak e26de525e2 mount: (new) allow sloppy for non-root
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=825836
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-06-14 14:43:21 +02:00
Karel Zak b0d3657def mount: (new) fix MS_REC usage
# mount -R /mnt/test /mnt/test
 mount: propagation flags (--make-* or --bind options) are mutually exclusive

Reported-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-28 19:54:16 +02:00
Karel Zak 61f5ff6cb4 libmount: add MNT_ERR_MOUNTOPT
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-28 12:49:55 +02:00
Karel Zak 10389b1e45 mount: (new) add loopdev specific error message
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-28 12:26:41 +02:00
Karel Zak 20a3998222 sys-utils: cleanup strtoxx_or_err()
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-05-15 17:45:17 +02:00
Karel Zak ba24923e97 mount: (new) use MNT_ERR_ for error messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-24 11:59:18 +02:00
Karel Zak eb0eb262cb mount: (new) add support for PARTUUID= and PARTLABEL=
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-19 14:40:06 +02:00
Karel Zak d789077846 mount: (new) be more pedantic about --make-*
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-18 10:09:49 +02:00
Karel Zak 58f108ef2b mount: (new) improve error messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-04-17 11:39:49 +02:00
Sami Kerola efb8854f4c sys-utils: verify writing to streams was successful
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-04-04 19:49:40 +02:00
Karel Zak a5ebeca527 mount: (new) add missing xalloc.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-20 09:06:09 +01:00
Sami Kerola 6f312c8957 xalloc: use xasprintf in all files
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-03-18 14:28:05 +01:00
Karel Zak 6699e742f2 libmount: add mnt_fs_streq_target() and export all mnt_fs_streq_*
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-02 15:53:55 +01:00
Karel Zak ab8c6e0569 libmount: add mnt_fs_streq_srcpath()
We have to be careful with "none" or another dummy sources for pseudo
filesystems. These strings should be canonicalized or compared as a
paths.

The function is not exported by library API.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-03-02 13:29:39 +01:00
Raghavendra D Prabhu 50d0ad9875 mount: (new) add 'internal-only(i)' to non-root allowed options
Commit ce433404 introduced the change, which causes something like mount -i
<user-mount-path> to break which worked well before util-linux-2.21, now it
gives message 'mount: only root can use "--internal-only" option' when that
shouldn't be the case when it is already in fstab.

Signed-off-by: Raghavendra D Prabhu <rprabhu@wnohang.net>
2012-02-28 15:37:29 +01:00
Karel Zak 772cce373f libmount: allow empty source for mount(2) syscall
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=797438
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-28 00:02:30 +01:00
Karel Zak 16b73aae8c mount: (new) cleanup mount -a return codes
New return codes:

  0 : all mounted (or all ignored)
 64 : some mounted, some failed
 32 : all failed

Note that already mounted or ignored (filtered out by -t or -O)
filesystems don't affect the final return code.

The original mount(8) returns 0 instead of 64, so the situation
"some mounted, some failed" cannot be detected.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-02-24 23:17:06 +01:00
Sami Kerola 7cebf0bb4f docs: corrections to FSF license files, and postal address
The COPYING and Documentation/licenses/COPYING* files are being
replaced by files from GNU web site.

http://www.gnu.org/licenses/gpl-2.0.txt
http://www.gnu.org/licenses/lgpl-2.1.txt

Postal addresses to FSF in other files are updated to match with the
address in license files.

Reference: http://lists.gnu.org/archive/html/freefont-announce/2005-04/msg00001.html
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2012-02-24 14:13:35 +01:00
Karel Zak 25609ee1be mount: (new) fix resource leak [coverity scan]
well, this is free-before-exit, but let's use mount(8) as test
application for libmount and keep it without leaks.

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-30 23:49:15 +01:00
Dave Reisner b8c0f4fba3 mount: define fallback selinux_warning macro with 2 params
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-30 12:32:00 +01:00
Karel Zak 64b6bc4ff0 mount: (new) add --fstab <path> option
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-23 20:31:23 +01:00
Karel Zak ac8ecab4be mount: add info about libmount features to --version output
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-23 12:28:05 +01:00
Karel Zak 497d2ce7ea mount: (new) share exit codes by include/exitcodes.h
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-23 10:55:35 +01:00
Karel Zak 2e86597f83 mount: (new) add source/target to error messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-20 14:17:08 +01:00
Karel Zak d946359a5b mount: (new) improve mount -a exist codes and erroer messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-20 13:47:08 +01:00
Karel Zak 4e45dfb9a6 mount: (new) add selinux warning
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-20 13:14:26 +01:00
Karel Zak 56dec8b7f4 mount: fix compiler warnings [-Wunused-parameter -Wunused-variable]
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-17 16:40:37 +01:00
Karel Zak 01663a53f1 mount: remove duplicate includes
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-17 16:22:11 +01:00
Dave Reisner aa397ce5e8 mount: avoid canonicalizing pseudofs paths
This fixes a display bug in the new mount wherein a psuedofs existing in
$PWD by name will be resolved and shown as a real mount point.

  $ cd /tmp; mkdir nfsd; mount | grep nfsd
  /tmp/nfsd on /proc/fs/nfsd type nfsd (rw,relatime)

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-17 11:11:20 +01:00
Karel Zak 374fd21add libmount: add MNT_OMODE_NOTAB
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-16 14:35:10 +01:00
Karel Zak 8b470b20d7 libmount: avoid duplicate loopdevs
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-16 11:28:05 +01:00
Karel Zak ce43340461 mount: (new) print error messages
Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-13 16:29:21 +01:00
Karel Zak ecdba5ddfc build-sys: add --enable-new-mount
Now we have three versions of the mount(8) utility

 * old mount(8)
   --enable-mount [default]

 * old mount(8) linked with libmount
   This is this is necessary for systems without mtab file.
   --enable-libmount-mount

 - new mount(8)
   This is completely new pure-libmount based mount(8).
   --enable-new-mount

Signed-off-by: Karel Zak <kzak@redhat.com>
2012-01-11 17:05:08 +01:00