summaryrefslogtreecommitdiffstats
path: root/libmount/src/context_mount.c
Commit message (Collapse)AuthorAgeFilesLines
* libmount: improve remount logicKarel Zak2015-02-161-1/+0Star
| | | | | | | * fix fs type detection for remount * parse mtab only for remount and umount Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix mem leak in do_mount_by_types() [coverity scan]Karel Zak2015-01-291-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use -t for type.subtype in helpers APIKarel Zak2014-08-211-1/+3
| | | | | References: https://github.com/karelzak/util-linux/issues/116 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't use /{proc,ext}/filesystems when more fs types specifiedKarel Zak2014-07-251-43/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | # mkfs.ext4 /dev/sda1 # mount -t foo,bar /dev/sda1 /mnt successfully mount the device, this is unexpected as extN is no between wanted (by -t specified) filesystems. Summary about -t: * "mount -t foo" mount(2) with "foo" type * "mount -t foo,bar" try mount(2) with "foo" or "bar" * "mount -t foo,auto" try mount(2) with "foo" or ask libblkid for the type * "mount -t nofoo,bar" try types from /{etc,proc}/filesystems, but exclude "foo" and "bar" Note that more filesystems may be specified in fstab (as comma delimited list). The stuff from fstab is always interpreted as list and never as a pattern ("no" prefix makes no sense in fstab). Reported-by: Benno Schulenberg <bensberg@justemail.net> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: special treatment for auto in fstype patternKarel Zak2014-06-231-3/+21
| | | | | | | | | | Let's support mount -t ext2,auto /dev/sde /media/stick Reported-by: Andreas Henriksson <andreas@fatal.se> Addresses: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=506695 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use new debug functionsKarel Zak2014-03-211-32/+30Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup fix_optstr() regards to selinux and smackKarel Zak2013-11-121-19/+47
| | | | | | | It's better (more robust) to make the code based on datetypes rather than on if(strcmp(...)). Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix typo in smack pathKarel Zak2013-11-121-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: remove smackfs* option when SMACK not enabledKarel Zak2013-11-121-0/+22
| | | | | | | | | | If there is no /sys/fs/smackfs then libmount removes smackfs*= mount options when compiled --with-smack. Note that we do the same for SELinux. References: http://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg13740.html Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: allow to use -s (sloppy) for all external helpersKarel Zak2013-11-041-6/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: small cleanup in umount codeKarel Zak2013-09-271-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: Remove stale comment on mnt_context_mount()Namhyung Kim2013-09-261-5/+0Star
| | | | | | | The commit f9906424 ("libmount: add post-mount checks to detect ro/rw") added necessary check so the comment is not valid anymore. Signed-off-by: Namhyung Kim <namhyung@gmail.com>
* lib/strutils: move *swith() functions to private librarySami Kerola2013-08-291-0/+1
| | | | | | | | Avoid code dublication in libmount and time-util. Proposed-by: Karel Zak <kzak@redhat.com> Reference: http://markmail.org/message/h7zexvqsieqngtmx Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libmount: fix typosOndrej Oprala2013-08-051-25/+25
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* libmount: use MS_SILENT for /{proc,etc}/filesystemsKarel Zak2013-05-091-1/+3
| | | | | | | | mount(8) needs to be doing silent mounts when doing this brute forcing or when the filesystem is not explicitly specified. Reported-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* Spelling fixes.Ville Skyttä2013-04-081-2/+2
| | | | Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
* libmount: fix user-mount by root for mount.<type> helpersKarel Zak2013-03-261-0/+22
| | | | | | | | Append options like "exec" "suid" and "dev" to mount.<type> helpers command line if the options are in fstab. This is relevant for root user who calls mount(8) for fstab entries with "user,exec" etc. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: allow to use propagation flags in fstabKarel Zak2013-01-151-13/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux kernel does not allow to change more than one propagation flag by one mount(2) syscall. The flags also cannot be mixed with another mount options. It means that the propagation flags cannot be stored in /etc/fstab, manual "mount --make-* <mountpoint>" is always necessary after successful mount. Painful... This patch implements additional mount(2) after previous successful mount(2) (or exec /sbin/mount.<type>). For example: mount /dev/sda1 /A -o private,unbindable,ro or fstab entry: /dev/sda1 /A auto ro,private,unbindable is implemented by three mount(2) calls: - 1st mounts /dev/sda1 with MS_RDONLY - 2nd sets MS_PRIVATE flag - 3rd sets MS_UNBINDABLE flag. It's the same as as to manually call: mount /dev/sda1 /A -o ro mount --make-private /A mount --make-unbindable /A This solution is not atomic, and umount(2) is not called if propagation flags are not successfully applied, only error is returned. This change does not affect libmount API, so one beautiful day when mount(2) syscall will be improved we can drop this nasty patch. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: correctly interpret '*' from /etc/filesystemsKarel Zak2012-11-261-1/+2
| | | | | | | | | | | - single line with '*' in /etc/filesystems means that libmount has to read /proc/filesystems, otherwise /proc/filesystems has to be ignored - mount(2) ENODEV is no reason to break the do_mount_by_pattern() loop when trying to mount by /{etc,proc}/filesystems Reported-by: NeilBrown <neilb@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix support of comma-separated fs types listsGleb Fotengauer-Malinovskiy2012-11-161-3/+7
| | | | | | | | | | | | | | | | # grep cdrom /etc/fstab /dev/sr0 /media/cdrom udf,iso9660 ro,noauto,user,utf8 0 0 # mount /media/cdrom mount: unknown filesystem type 'udf,iso9660' # mount -t udf,iso9660 /dev/sr0 /media/cdrom mount: /dev/sr0 is write-protected, mounting read-only [kzak@redhat.com: - add some comments - don't try to found external helpers for the types] Signed-off-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: typo fixesGilles Espinasse2012-10-021-1/+1
| | | | Signed-off-by: Gilles Espinasse <g.esp@free.fr>
* libmount: don't remove user= when executed by rootKarel Zak2012-09-121-8/+4Star
| | | | | | | | | | | | | | The original mount(8) allows to store arbitrary user= option to mtab file if called by root user. For example: # mount -f foo /bar -t xxx -o rw,user=kzak the new mount removes the 'user=' and 'users' options at all for root user. This is regression. The original functionality is necessary by 'sshfs' where fuse writes to mtab file by mount(8). Reported-by: Juergen Daubert <jue@jue.li> (and 'horrorStruck' on IRC) Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: segfaults if neither /etc/filesystems nor/proc/filesystems existsKarel Zak2012-09-121-0/+3
| | | | | Reported-by: Juergen Daubert <jue@jue.li> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: deduplicate SELinux mount optionsKarel Zak2012-08-011-0/+9
| | | | | | | | | | We already have a clue about SELinux specific mount options in libmount, so it makes sense to deduplicate the options as Linux kernel does not support duplicate SELinux options. (SELinux kernel stuff somehow ignores standard Linux mount conventions...) Requested-by: Niels de Vos <ndevos@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix trivial typosPetr Uzel2012-06-151-2/+2
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libmount: plug a memory leak in exec_helper()Petr Uzel2012-06-151-0/+1
| | | | | | | | | | | | | | | valgrind --leak-check=full ./sys-utils/mount -t cifs //127.0.0.1/users /mnt/smb -o user=root,password=linux .... ==21359== 28 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==21359== at 0x4C298B2: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==21359== by 0x415780: __mnt_optstr_append_option (optstr.c:188) ==21359== by 0x415CB5: mnt_optstr_set_option (optstr.c:387) ==21359== by 0x40D778: do_mount (context_mount.c:192) ==21359== by 0x40E6A9: mnt_context_do_mount (context_mount.c:685) ==21359== by 0x40EB7B: mnt_context_mount (context_mount.c:786) ==21359== by 0x4058B0: main (mount.c:918) Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libmount: don't use nosuid,noexec,nodev for cifs user=fooKarel Zak2012-06-141-2/+27
| | | | | | | | | | | | | | | | mount -t cifs //127.0.0.1/users /mnt/smb -o user=root,password=linux is incorrectly translated to mount.cifs -o noexec,nosuid,nodev,user=root,password=linux ... The command mount(8) should be sensitive to "user" (without "=<name>") only. The correct cifs command line is: mount.cifs -o user=root,password=linux Addresses: https://bugzilla.novell.com/show_bug.cgi?id=766157 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't generate empty option stringsKarel Zak2012-06-141-0/+11
| | | | | | | | | | | | mount -t foo something /mnt/test -o user=root,password=linux generates "rw,noexec,nosuid,nodev,password=linux,,user=root" options string for /sbin/mount.foo, the ",," is incorrect. Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix typos in comments and wall's man pageBernhard Voelker2012-06-051-1/+1
| | | | | | | | | | | Culprits identified again by (newer) misspellings: $ git ls-files | misspellings -f - | grep -v '^po/' * wall: Fix typo in man page. * Fix typos in source code comments. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* libmount: add MNT_ERR_MOUNTOPTKarel Zak2012-05-281-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix mount by patternKarel Zak2012-04-241-1/+4
| | | | | | | | | | | mount /foo /bar without entry in /etc/fstab the mount command tries all filesystems from /{etc,proc}/filesystems. We should NOT call mount(2) more then once if the syscall returns for example ENOENT, acceptable is only EINVAL. Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix typos found by misspellingsBernhard Voelker2012-04-231-2/+2
| | | | | | | | | | | | | | | The tool misspellings (https://github.com/lyda/misspell-check) detected several typos. Command used: $ git ls-files | grep -v ^po/ | misspellings -f - * isosize: Fix typo in usage string. * configure.ac: Fix typo in help string of --enable-most-builds option. * fdisk: Fix typo in man page. * libblkid, blkid, mount: Likewise. * Fix various typos in docs and in source code comments. Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* mount: fix recursively propagation mountingDong Hao2012-03-211-2/+3
| | | | | | | | | | | Provide the recursive flag of propagation mounting. Recursive flag could be used together with propagation flag. [kzak@redhat.com: - add MS_SILENT to acceptable propagation flags, - fix new code in libmount too] Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Dong Hao <haodong@linux.vnet.ibm.com>
* libmount: cleanup flags usageKarel Zak2012-03-071-5/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cosmetic changes around "none"Karel Zak2012-03-021-2/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: allow empty source for mount(2) syscallKarel Zak2012-02-281-1/+3
| | | | | Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=797438 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use mount.<type> -s for NFS onlyKarel Zak2012-02-271-1/+6
| | | | | | | Unfortunately, it seems that for example mount.cifs don't care about the API, so we need exception like the original mount(8). Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: cleanup docsKarel Zak2012-02-221-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: use #ifdef fr selinux specific variablesKarel Zak2012-02-031-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: remove dead assigmentKarel Zak2012-02-021-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't pass comments=/x-* to mount.<type> helpersKarel Zak2012-01-251-4/+28
| | | | | | | This patch add a new flag MNT_NOHLPS for mount options map, options with this flag will not be passed to /sbin/mount.<type> helpers. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix bugs detected by [smatch scan]Karel Zak2012-01-171-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add post-mount checks to detect ro/rwKarel Zak2012-01-161-6/+34
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: allow to toggle ro/rw and mount againKarel Zak2012-01-131-1/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: allow to use UUID and LABEL for owner/group mount options in fstabKarel Zak2012-01-131-5/+19
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add functions to export syscall/helpers statusKarel Zak2012-01-131-0/+12
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: consolidate MNT_FS_* codeKarel Zak2012-01-021-3/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add support for mount -a --forkKarel Zak2011-12-021-5/+23
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: fix trivial typos in debugging outputPetr Uzel2011-11-091-2/+2
| | | | Signed-off-by: Petr Uzel <petr.uzel@suse.cz>
* libmount: fix use of logical '&&' with constant operandFrancesco Cosoleto2011-09-271-1/+1
| | | | | | Found by clang. Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>