Commit Graph

103 Commits

Author SHA1 Message Date
David E. O'Brien
a86de99566 Explicitly check each mount argv building assignment for buffer over flowing.
Reviewed by:	imp (earlier version of patch)
2009-01-10 20:54:47 +00:00
David E. O'Brien
c9c6feb62c style(9) 2008-12-26 22:55:38 +00:00
David E. O'Brien
76c4621653 Make the sub-'argc' static to make it harder to overwrite thru a buffer
overflow.
2008-12-26 22:54:53 +00:00
David E. O'Brien
fce5f960ba Be a little bit more pestimistic in argument handling - check if we've
overflown our internal buffer (though after the fact), and s/strncpy/strlcpy/

Reviewed by:	rodrigc
Obtained from:	Juniper Networks
2008-12-18 18:44:46 +00:00
Matteo Riondato
bbe9d7da79 Don't return always 0. Return what we get from exec_mountprog or
mount_fs.

PR:		bin/125154
MFC after:	1 day
2008-08-31 20:08:05 +00:00
Matteo Riondato
b42024b241 Fix mount -p and mount -u -ocurrent on gjournaled FS
PR:		bin/120162
Submitted by:	Niki Denev
MFC after:	1 week
2008-02-04 07:37:56 +00:00
Matteo Riondato
031ea52f84 Fix printing of unionfs mounts when using the -p option
PR:		 bin/75585
MFC after:	1 week
2008-02-03 17:23:58 +00:00
Rong-En Fan
534046e301 - Remove UMAP filesystem. It was disconnected from build three years ago,
and it is seriously broken.

Discussed on:   freebsd-arch@
Approved by:	re (mux)
2007-06-25 05:06:57 +00:00
Poul-Henning Kamp
306d73d61e Align -p output in TAB built columns suitable for /etc/fstab. 2007-04-13 21:30:47 +00:00
Craig Rodrigues
5b54856414 Print warning that "-t msdos" is deprecated and being converted to
"-t msdosfs".  The conversion has been happening since 1.43, but
no equivalent conversion happens in "umount -t", which led to some
confusion with some users.

PR:		79296
Submitted by:	Nobuhiro Yasutomi <nobuhiro yasutomi nifty ne jp>
2007-02-06 05:57:40 +00:00
Pawel Jakub Dawidek
e9988ceda3 Use pidfile(3) API to restart mountd(8) on success mount.
This why we won't kill random process if there is a stale PID in
/var/run/mountd.pid.
2007-02-02 23:58:10 +00:00
Craig Rodrigues
c195c7f618 Fix debugging output of '-d', to more accurately reflect if
we exec an external mount program, or just call nmount()
to mount a filesystem.

Noticed by:	kris
2006-11-14 01:07:42 +00:00
Pawel Jakub Dawidek
ac88569c5a Teach mount(8) about MNT_GJOURNAL flag.
MNT_GJOURNAL flag is not a mount-time flag, but it is needed to show
'gjournal' option in mount(8) output.

Sponsored by:	home.pl
2006-10-31 21:54:51 +00:00
Ruslan Ermilov
49a41c4f52 Two tiny style fixes. 2006-10-24 22:16:51 +00:00
Ruslan Ermilov
3cbf527e8d Revert rev. 1.86 by jmallett@ as it breaks "ro" mounts specified
in /etc/fstab.

This has been happening due to the priority inversion; options
specified on the command line should take precedence over options
from fstab over default "noro" option, but since both the default
"noro" and options specified on the command line (-w, -r, -o ...)
were put into the same "options" variable, "noro" took precedence
over fstab "ro" (this is easily visible with "mount -d").

PR:		bin/100164
2006-10-24 22:02:29 +00:00
Dag-Erling Smørgrav
4b4f91707c Teach mount(8) about a 'late' keyword, which means the file system should
not be mounted unless the -l flag was specified.

Add an rc script, mountlate, which basically runs 'mount -a -l'.  It runs
after DAEMON but before LOGIN.

This is useful for things like loopback mounts, because mountcritremote
runs before mountd  / nfsd (since /usr might be a remote file system), so
an attempt to mount a loopback network file system in mountcritremote will
fail.

Also add a progress message to mountcritlocal, for the sake of symmetry
with similar messages in mountcritremote and mountlate.

Reviewed by:	freebsd-rc
MFC after:	3 weeks
2006-07-12 16:05:51 +00:00
Juli Mallett
4796c6cc6e Minor style tweaks while nearby. Namely ANSIfy and parens on return values. 2006-06-10 01:44:57 +00:00
Juli Mallett
5256cc2152 Rather than using specified_ro to parse the options list an extra time, and
keeping a flag to check whether we actually wanted to mount the filesystem
readonly, setup the options list so that we start off by assuming rw is what's
desired and let later flags change that.
2006-06-10 01:37:00 +00:00
Craig Rodrigues
19996233cc Fix "mount -u -o ro".
Requested by:	maxim
2006-06-02 17:53:46 +00:00
Maxim Konovalov
6e74fb9dff o Extend rev. 1.75 and restore an ability to specify a non-default
quota files location.

Submitted by:	Kostik Belousov
2006-05-10 14:40:40 +00:00
Giorgos Keramidas
3ae7ea6834 When there are no mount options, an implicit "rw" should be printed in
the output of ``mount -p''.

Approved by:	rodrigc
2006-03-03 02:46:15 +00:00
Craig Rodrigues
88e2c33564 If we specify: mount -u (update), without specifying an
additional -r (read-only) flag or or -w (read-write) flag,
then assume we want, mount -u -w.

When doing a mount update, this will implicitly pass a "noro" mount
option down to the VFS layer.
vfs_mergeopts() in vfs_mount.c will then remove the "ro" mount option
if it exists in the mount options for a mounted file system.
This means that "mount -u" works the same as "mount -u -w"
and will convert a read-only mount to read-write.
2006-02-25 05:09:47 +00:00
Pawel Jakub Dawidek
093a8c9e1b s/<space><tab>/<tab>/ 2006-01-24 15:26:36 +00:00
Pawel Jakub Dawidek
90742659d7 Resolve the mount point's path with realpath(2) before checking if file
system is mounted. This prevevents duplicated mounts.

The change I made against the original patch is to fall back to the given
path on realpath(2) failure instead of exiting with an error.

Submitted by:	Andreas Kohn <andreas@syndrom23.de>
PR:		bin/89782
MFC after:	3 days
2006-01-18 11:00:34 +00:00
Craig Rodrigues
cf9e56b04e For reiserfs, pass mount parameters directly to nmount() instead
of forking an external mount_reiserfs program.

Reviewed by:	dumbbell
2005-12-12 19:51:37 +00:00
Craig Rodrigues
f6db44904f Remove workaround for old GCC bugs.
Submitted by:	ru
2005-12-03 19:59:35 +00:00
Craig Rodrigues
748e259bc4 Simplify parsing of mount options by passing
"rw" option down to kernel, since vfs_donmount() can now parse it.
2005-12-03 01:57:58 +00:00
Tai-hwa Liang
6973ce04c4 Fixing a regression introduced in rev1.72 by connecting cd9660 to the
external mounting program list as well; otherwise, entry like the following
in /etc/fstab wouldn't work:

	/dev/acd0	/mnt/cdrom	cd9660	ro,-C=big5	0	0

Reviewed by:	rodrigc
2005-11-24 17:35:05 +00:00
Craig Rodrigues
35d6c7f50e Do not pass userquota and groupquota mount options to nmount().
These options are read from fstab by quotacheck(8), but are not
valid mount options that need to be passed down the the filesystem.

Noticed by:	maxim
2005-11-23 20:17:27 +00:00
Craig Rodrigues
b1e6b7123d For mounting a UFS filesystem, call nmount() directly, instead of having
special logic which called mount() in a separate mount_ufs() function.
2005-11-21 22:07:54 +00:00
Craig Rodrigues
d9fa6ce711 Do not pass noauto to nmount() or external mount program.
Noticed by:	maxim
2005-11-16 02:13:27 +00:00
Craig Rodrigues
6f5f1a6b3e - Minor fixes to raise WARNS level to 6.
- Teach the mount program to call the nmount() syscall directly
- Preserve existing method of calling mount() for UFS, until we clean things
  up.
- Preserve existing method of forking and calling external mount programs for
  mfs, msdosfs, nfs, nfs4, ntfs, nwfs, nullfs, portalfs, reiserfs, smbfs,
  udf, umapfs, unionfs
- devfs, linprocfs, procfs, ext2fs call nmount() syscall directly, since
  that is all those external mount programs were doing

Reviewed by:	phk
Discussed on:	arch
2005-11-12 20:12:56 +00:00
Craig Rodrigues
aedf10aca9 In prmount(), use an unsigned int variable to eliminate
'comparison between signed and unsigned' compiler warning.
2005-10-07 02:22:04 +00:00
Craig Rodrigues
e24dc56a22 Switch from K&R-style C prototypes to ISO/ANSI-style C prototypes.
Make prototype in extern.h match prototype in mount_ufs.c
2005-10-07 02:18:20 +00:00
Colin Percival
6e34b4796d When executing mount_foo, pass "mount_foo" as argv[0] instead of "foo".
This unbreaks "/rescue/mount -t foo" -- previously it was necessary to
explicitly call "/rescue/mount_foo".

Hints from:	gordon
X-MFC after:	3 days (if approved by re@)
2005-03-26 04:45:53 +00:00
Ruslan Ermilov
8d646af581 Sync program's usage() with manpage's SYNOPSIS. 2005-02-10 09:19:34 +00:00
Ruslan Ermilov
5f04702815 Fix the mount(8) status reporting, now that MNT_NODEV is a no-op (zero).
Asked to commit by:	phk
2004-11-29 09:35:01 +00:00
Bosko Milekic
2aebb586db The previous change to mount(8) to report ufs or ufs2 used
libufs, which only works for Charlie root.

This change reverts the introduction of libufs and moves the
check into the kernel.  Since the f_fstypename is the same
for both ufs and ufs2, we check fs_magic for presence of
ufs2 and copy "ufs2" explicitly instead.

Submitted by: Christian S.J. Peron <maneo@bsdpro.com>
2004-04-26 15:13:46 +00:00
Mark Murray
4c723140a4 Remove advertising clause from University of California Regent's license,
per letter dated July 22, 1999.

Approved by: core, imp
2004-04-09 19:58:40 +00:00
Greg Lehey
c6d1415d6a Report the difference between ufs and ufs2.
Submitted by:	"Christian S.J. Peron" <maneo@bsdpro.com>
2004-02-17 08:43:05 +00:00
Jacques Vidrine
ddb842ccb6 Correct a typo and unbreak the build.
Pointy hat to:	pjd
2004-02-03 04:03:19 +00:00
Pawel Jakub Dawidek
dc9c6194b5 Made use of MNT_USER flag and inform about user responsible for mount
in those cases:
1. File system was mounted by an unprivileged user.
2. File system was mounted by an unprivileged root user.
3. File system was mounted by a privileged non-root user.

Point 1 is when file system was mounted by unprivileged user
(sysctl vfs.usermount was equal to 1 then).

Point 2 is when file system was mounted by root, while sysctl
security.bsd.suser_enabled is set to 0 and sysctl vfs.usermount
is set to 1.

Point 3 is because we want to be ready for capabilities.

Reviewed by:	rwatson
Approved by:	scottl (mentor)
2004-02-02 18:37:30 +00:00
Guido van Rooij
c14d21f6cf Style(9) option sorting
Submitted by:	Ruslan Ermilov <ru@FreeBSD.org>
2004-01-29 15:14:03 +00:00
Guido van Rooij
6f7cdc55f1 Fix manpage and usage() to reflect that -a can be used in combination
with -o

Submitted by:	Ruslan Ermilov <ru@FreeBSD.org>
Pointed out by: Ceri Davies <ceri@submonkey.net
2004-01-29 14:42:26 +00:00
Guido van Rooij
13cbdf24e5 Unbreak -o fstab and -o current in combination with -a
MFC after:	2 weeks
2004-01-29 13:16:51 +00:00
Eric Anholt
01a9bce5ee Allow trailing slashes for MNT_UPDATE case (mount -u), too.
PR:		bin/59144
Submitted by:	Stefan Farfeleder <stefan@fafoe.narf.at>
2004-01-07 05:37:56 +00:00
Tom Rhodes
adfdbe2253 Style change 2003-12-07 23:02:16 +00:00
Ian Dowse
96c65ccb2f Print out the file system access statistics using uintmax_t types
instead of casting the unsigned 64-bit values to longs.

Suggested by:	bde
2003-12-07 17:00:14 +00:00
Ian Dowse
05779418cd Don't include the file system ID in the output of `mount -v' if it
is all zeros. The kernel now consistently zeroes FSIDs for non-root
users, so there's no point in printing these.

Also fix a number of compiler warnings, including two real bugs:
- a bracket placement bug caused `mount -t ufs localhost:/foo /mnt'
  to override the `-t ufs' specification and use mount_nfs.
- an unitialised variable was used instead of _PATH_SYSPATH when
  warning that the mount_* program cound not be found.

Submitted by:	Rudolf Cejka <cejkar@fit.vutbr.cz> (FSID part)
Approved by:	re (scottl)
2003-12-05 09:36:56 +00:00
Warner Losh
68dd1ff405 Prefer PATH_MAX to MAXPATHLEN. PATH_MAX has the trailing NUL. 2003-08-07 04:51:41 +00:00