Commit Graph

97 Commits

Author SHA1 Message Date
Craig Rodrigues
55dd132740 Remove hacks which filter out MNT_ROOTFS.
They are no longer needed now that we filter out MNT_ROOTFS
inside the nmount() call in revision 1.267 of vfs_mount.c.

Reviewed by:	rink
2008-03-05 07:55:07 +00:00
Simon L. B. Nielsen
89ca9145fb Use the correct variable to check for a malloc failing. This fixes a
case where mountd would fail to start with "out of memory" logged to
syslog.
2007-10-27 12:24:47 +00:00
Matteo Riondato
d11e36457b Add the -h <bindip> option to mountd, similar to the one in nfsd(8)
-h bindip
Specify specific IP addresses to bind to for TCP and UDP requests.
This option may be specified multiple times.  If no -h option is
specified, mountd will bind to INADDR_ANY.  Note that when specifying
IP addresses with -h, mountd will automatically add 127.0.0.1 and if
IPv6 is enabled, ::1 to the list.

PR:		bin/114097
Reviewed by:	pjd (an eariler version of the patch)
MFC after:	1 week
2007-10-20 11:25:34 +00:00
Pawel Jakub Dawidek
6c90092b5a Fatal error is only when cannot open any of the given exports files. 2007-04-13 10:25:49 +00:00
Pawel Jakub Dawidek
96968c223b Add support for multiple exports files. This will be useful for example for
ZFS, where we have automatically generated /etc/zfs/exports file, which
should not be edited directly.

Discussed with:	rwatson
2007-02-03 00:12:18 +00:00
Craig Rodrigues
37518a88fb If nmount() fails to export a directory, in the syslog() error message,
add the errmsg string returned by nmount().
2007-01-26 13:26:43 +00:00
Craig Rodrigues
09fc9dc689 Ignore SIGPIPE, instead of terminating process.
PR:		81230
Submitted by:	Dmitrij Tejblum <tejblum yandex-team ru>
MFC after:	1 month
2006-11-18 22:43:20 +00:00
Rink Springer
300a6ee829 My previous commit made it impossible to export / over NFS; this small
change fixes this.

Reported by:	Lin Jui-Nan Eric < ericlin dot jnlin at gmail dot com >
Submitted by:	Erik Trulsson < ertr1013 at student dot uu dot se > (commit is inspired by a patch from Erik)
Pointyhat to:	me
Reviewed by:	stable@
Approved by:	imp (mentor)
MFC after:	3 days
2006-10-19 19:46:49 +00:00
Rink Springer
6a5a80bd0f Prevent mountd(8) from resetting mount options when exporting a filesystem.
Approved by:		imp (mentor)
Sponsored by:		Quality Service Provider BV
MFC after:		3 days
2006-10-09 17:38:18 +00:00
Craig Rodrigues
46f8d30f5a In get_exportlist(), properly loop over mounted filesystems.
PR:	bin/99873
Submitted by:	Danny Braniss <danny at cs dot huji dot ac dot il>
2006-07-08 13:49:24 +00:00
Craig Rodrigues
a84ee0d367 For network filesystems (NFS, samba, etc.), do not pass "export" nmount()
parameter to try to delete an NFS export.  It won't work, and will log
a spurious warning to syslog.

Tested by:	Arno J. Klaassen <arno at heho dot snv dot jussieu dot fr>
MFC after:	3 days
2006-06-06 21:56:49 +00:00
Craig Rodrigues
8f716f89cf Do not log "can't delete export" messages if nmount() returns ENOTSUP.
This eliminates spurious log entries for trying to delete exports
for filesystems like devfs and procfs.
2006-05-28 18:59:28 +00:00
Craig Rodrigues
9857865b55 Convert to nmount() and remove hardcoded checks for ufs, msdosfs, ntfs,
and cd9660.

PR:	bin/97642
2006-05-24 11:49:39 +00:00
Craig Rodrigues
6a09faf2cb Convert mountd to nmount(). Remove some hardcoded dependencies
on ufs, cd9660, msdosfs, and ntfs, but not all dependencies.
2006-05-23 17:10:17 +00:00
Pawel Jakub Dawidek
8b28aef238 Pidfiles should be created with permission preventing users from opening
them for reading. When user can open file for reading, he can also
flock(2) it, which can lead to confusions.

Pointed out by:	green
2005-09-16 11:24:28 +00:00
Pawel Jakub Dawidek
a032b226c8 Use pidfile(3) in mountd(8). There is no need to use /var/run/mountd.lock
anymore.
2005-08-24 19:17:06 +00:00
Hajimu UMEMOTO
4f10131848 NI_WITHSCOPEID cleanup. Neither RFC 2553 nor RFC 3493 defines
NI_WITHSCOPEID, and our getaddrinfo(3) does nothing special
for it, now.
2005-05-13 16:31:11 +00:00
Stefan Farfeleder
18b51f792f Remove unused variables. 2005-04-09 14:59:10 +00:00
Poul-Henning Kamp
e71171f31b Also do not send junk mount arguments when removing exports. 2004-12-11 12:51:20 +00:00
Stefan Farfeleder
950cc39559 Pass an array of gid_t rather than an array of int to getgroups().
PR:	56646
2004-10-02 11:40:48 +00:00
Warner Losh
486c8cc4c6 Per letter dated July 22, 1999 remove 3rd clause of Berkeley derived software
(with permission of addtional copyright holders where appropriate)
2004-08-07 04:28:56 +00:00
Mark Murray
16fc3635f7 Make NULL a (void*)0 whereever possible, and fix the warnings(-Werror)
that this provokes. "Wherever possible" means "In the kernel OR NOT
C++" (implying C).

There are places where (void *) pointers are not valid, such as for
function pointers, but in the special case of (void *)0, agreement
settles on it being OK.

Most of the fixes were NULL where an integer zero was needed; many
of the fixes were NULL where ascii <nul> ('\0') was needed, and a
few were just "other".

Tested on: i386 sparc64
2004-03-05 08:10:19 +00:00
Bruce M Simpson
c203da27d5 Add a new option to mountd(8), -p <port>. This allows the user to specify
a known port for use in firewall rulesets; otherwise the port is chosen
at run-time by bindresvport().

MFC after:	1 week
2004-03-04 04:42:52 +00:00
Peter Wemm
c903443a2c Rename the 'log' variable rather than -fno-builtin-log 2003-10-30 22:57:43 +00:00
Peter Wemm
389b844652 Use -fno-builtin-log. Fix svc_sendreply() missing required casts.
It is now WARNS=2 clean again.
2003-10-26 05:58:21 +00:00
Robert Watson
7c615cf053 When reporting errors binding IPv6 TCP sockets, don't call them UDP
sockets in the printf.

Fix two minor co-located whitespace glitches.

Product of:	France
2003-07-17 10:11:26 +00:00
Martin Blapp
bcb53b1606 Implement nonblocking tpc-connections. rpcgen -m does still
produce backcompatible code.

Reviewed by:	rwatson
Obtained from:	NetBSD
MFC after:	1 day
2003-01-16 07:27:30 +00:00
Philippe Charnier
75201fa43d s/rpc.mountd/mountd/
Add FBSDID
Reorder #if/#endif around sccsid to conform style(9)
2002-10-16 16:04:50 +00:00
Mike Barcroft
89fdc4e117 Use the standardized CHAR_BIT constant instead of NBBY in userland. 2002-09-25 04:06:37 +00:00
Hajimu UMEMOTO
fc99a00c7f use IPV6_V6ONLY instead of non standard IPV6_BINDV6ONLY.
MFC after:	1 week
2002-07-22 15:22:53 +00:00
Joerg Wunsch
288fa14ac4 Try to give a more descriptive error message for the pilot error of
attempting to export the non-root of a filesystem with -alldirs.  This
pilot error seems to be very common, and the "could not remount" error
message doesn't give much hints about the real reason.  See the old PR
below for an example.

While i was at it, make it possible to entirely omit the often
annoying error message in that case by specifying the "quiet" exports
flag.  This allows to specify something like

/cdrom	-alldirs,ro,quiet	<where to export to>

which will silently fail if nothing is mounted under /cdrom, but do
the rigth thing as soon as you mount something.

While doing this, i've put the embedded example in the exports(5) man
page into a subsection of its own as it ought to be.

Thanks for Paul Southworth for reminding me about this problem.

PR:		bin/4448
MFC after:	1 month
2002-07-18 20:52:17 +00:00
Alfred Perlstein
91acb349c9 If an RPC fails, try a shorter reply in case the fault lies with the
size of the response.

PR: misc/26320
MFC After: 2 weeks
2002-07-15 18:34:27 +00:00
Alfred Perlstein
7b9136e8ea Remove old pre-TIRPC code for getting transport handles. The code that
follows spams over the contents of them making the removed code useless.
2002-06-25 22:55:53 +00:00
Tom Rhodes
3468b317cb more file system > filesystem 2002-05-16 04:10:46 +00:00
Ian Dowse
91ca1a918f Use fgetln to remove the static limit on the length of lines in
/etc/exports. Oversized lines were unlikely due to the large 10k
limit, but any found would cause mountd to exit with an error. Also
fix one or two compiler warnings.
2002-05-14 23:24:28 +00:00
Warner Losh
854299908c o __P removed
o main prototype removed
2002-03-21 13:14:21 +00:00
David E. O'Brien
3d438ad61f Remove 'register' keyword.
It does not help modern compilers, and some may take some hit from it.
(I also found several functions that listed *every* of its 10 local vars with
 "register" -- just how many free registers do people think machines have?)
2002-03-20 17:55:10 +00:00
Dima Dorfman
76183f3453 Introduce a version field to `struct xucred' in place of one of the
spares (the size of the field was changed from u_short to u_int to
reflect what it really ends up being).  Accordingly, change users of
xucred to set and check this field as appropriate.  In the kernel,
this is being done inside the new cru2x() routine which takes a
`struct ucred' and fills out a `struct xucred' according to the
former.  This also has the pleasant sideaffect of removing some
duplicate code.

Reviewed by:	rwatson
2002-02-27 04:45:37 +00:00
Peter Wemm
4a0785aaff Deal with module name changes and autoloading. 2001-09-20 02:15:17 +00:00
Peter Wemm
9119623471 Userland part of nfs client/server split and cleanup. 2001-09-18 23:34:44 +00:00
Kris Kennaway
5979df34a6 Silence non-constant format string warnings by marking functions
as __printflike()/__printf0like(), adding const, or adding missing "%s"
format strings, as appropriate.

MFC after:	2 weeks
2001-08-19 08:19:37 +00:00
Dima Dorfman
376f839026 Correct handling of continuation lines. Instead of treating the
backslash as nothing, treat it like a space so that adjacent lines
aren't glued together.

PR:		8479
Submitted by:	Adrian Filipi-Martin <adrian@ubergeeks.com>
2001-07-02 23:56:01 +00:00
Ruslan Ermilov
4ccd754686 - VFS_SET(msdos) -> VFS_SET(msdosfs)
- msdos.ko -> msdosfs.ko
- mount_msdos(8) -> mount_msdosfs(8)
- "msdos" -> "msdosfs" compatibility glue in mount(8)
2001-06-01 10:57:26 +00:00
Poul-Henning Kamp
753d49786e Remove MFS 2001-05-29 20:39:47 +00:00
Ian Dowse
5f558fa42f Since the netexport struct was centralised to 'struct mount',
attempting to remove nonexistant exports with MNT_DELEXPORT returns
an error; before this change it always succeeded. This caused
mountd(8) to log "can't delete exports for /whatever" warnings.

Change the error code from EINVAL to a more specific ENOENT, and
make mountd ignore this error when deleting the export list. I
could have just restored the previous behaviour of returning success,
but I think an error return is a useful diagnostic.

Reviewed by:	phk
2001-05-29 17:46:52 +00:00
Ruslan Ermilov
8a8402d3a5 - sys/n[tw]fs moved to sys/fs/n[tw]fs
- /usr/include/n[tw]fs moved to /usr/include/fs/n[tw]fs
2001-05-26 11:57:45 +00:00
Ruslan Ermilov
1166fb516b - sys/msdosfs moved to sys/fs/msdosfs
- msdos.ko renamed to msdosfs.ko
- /usr/include/msdosfs moved to /usr/include/fs/msdosfs
2001-05-25 08:14:14 +00:00
Ian Dowse
931c04f1a8 Reinstate one more old bugfix that got lost in the tirpc commit:
always look up -network and -mask addresses numerically before
trying getnetbyname(). Without this, we may end up attempting DNS
queries on silly names such as "127.0.0.0.my-domain.com". See the
commit log from revisions 1.21 and 1.20 for further details.
2001-04-23 10:12:31 +00:00
Ian Dowse
f93caef239 When exporting a directory that is not a mountpoint, mountd repeatedly
removes the last path component until the mount() succeeds. However,
the code never checks if it has passed the mountpoint, so in some
cases where the mount() never succeeds, it can end up applying the
flags from a mounted filesystem to the underlying one.

Add a sanity check to the code which removes the last path component:
test that the fsid associated with the new path is the same as that
of the old one.

PR:		bin/7872
2001-04-22 21:50:30 +00:00
Ian Dowse
60caaee242 The introduction of IPv6 support from NetBSD's mountd invalidated
a number of assumptions related to the parsing of options in
/etc/exports, and missed a few necessary new error checks.

The main problems related to netmasks: an IPv6 network address
missing a netmask would result in the filesystem being exported to
the whole IPv6 world, non-continuous netmasks would be made continuous
without any warnings, and nothing prevented you specifying an IPv4
mask with an IPv6 address.

This change addresses these issues. As a side-effect we now store
netmasks in sockaddr structs (this matches the kernel interface,
and is closer to the way it used to be). Add a flag OP_HAVEMASK to
keep track of whether or not we have successfully got a mask from
any source. Replace some mask-related helper functions with versions
that use the sockaddr-based masks.

Also tidy up get_net() and fix the code that interprets IPv4 partial
networks such as "127.1" as network rather than host addresses.
Properly zero out some structures that were ending up partially
containing junk from the stack, fix a few formatting issues, and
add a comment noting some assumptions about export arguments.
2001-04-21 20:06:18 +00:00