Commit Graph

57 Commits

Author SHA1 Message Date
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
Ian Dowse
69d6557226 Fix a long-standing bug relating to the handling of SIGHUP: mountd
would call malloc, stdio and other library functions from the signal
handler which is not safe due to reentrancy problems.

Instead, add a simple handler that just sets a flag, and call the
more complex function from main() when necessary. Unfortunately to
be able to check this flag, we must expand the svc_run() call, but
the RPC library makes that relatively easy to do.
2001-04-21 00:55:17 +00:00
Ian Dowse
6d359f31fc A few more mountd cleanups:
- Remove some horrible code that faked a "struct addrinfo" to be
  later passed to freeaddrinfo(). Instead, add a new group type
  "GT_DEFAULT" used to denote that the filesystem is exported to the
  world, and treat this case separately.
- Don't clear the AI_CANONNAME flag in a struct addrinfo returned
  by getaddrinfo. There's still a bit more struct addrinfo abuse
  left in here.
- Simplify do_mount() slightly by using an addrinfo pointer to keep
  track of the current address.
2001-04-18 00:28:37 +00:00
Ian Dowse
01709abf63 Various bugfixes and cleanups, mainly from Martin Blapp:
- Revert del_mlist() to its pre-tirpc prototype. Unlike NetBSD's version,
  ours lets the caller generate any syslog() messages, so that it
  can include the service name in the message.
- Initialise a few local variables to clarify the logic and avoid some
  compiler warnings.
- Remove a few unused functions and local variables, and fix some
  whitespace issues.
- Reinstate the logic for avoiding duplicate host entries that got
  removed accidentally in revision 1.41 (added in r1.5). This bit
  was submitted in a slightly different form by Thomas Quinot.

Submitted by:	Martin Blapp <mb@imp.ch>,
		Thomas Quinot <quinot@inf.enst.fr>
PR:		bin/26148
2001-04-17 22:25:48 +00:00
Alfred Perlstein
8f15078110 give the "netgrent" functions a home in netdb.h 2001-03-27 09:49:03 +00:00
Alfred Perlstein
7b98a1d680 Replace pmap_unset() with rpcb_unset() which fixes the unregistering.
Submitted by: Martin Blapp <mb@imp.ch>
2001-03-25 19:59:07 +00:00
Alfred Perlstein
95b9973991 Deal with lack of IPv6 support gracefully.
Submitted by: Martin Blapp <mb@imp.ch>
2001-03-25 19:57:58 +00:00
Alfred Perlstein
8360efbd6c Bring in a hybrid of SunSoft's transport-independent RPC (TI-RPC) and
associated changes that had to happen to make this possible as well as
bugs fixed along the way.

  Bring in required TLI library routines to support this.

  Since we don't support TLI we've essentially copied what NetBSD
  has done, adding a thin layer to emulate direct the TLI calls
  into BSD socket calls.

  This is mostly from Sun's tirpc release that was made in 1994,
  however some fixes were backported from the 1999 release (supposedly
  only made available after this porting effort was underway).

  The submitter has agreed to continue on and bring us up to the
  1999 release.

  Several key features are introduced with this update:
    Client calls are thread safe. (1999 code has server side thread
    safe)
    Updated, a more modern interface.

  Many userland updates were done to bring the code up to par with
  the recent RPC API.

  There is an update to the pthreads library, a function
  pthread_main_np() was added to emulate a function of Sun's threads
  library.

  While we're at it, bring in NetBSD's lockd, it's been far too
  long of a wait.

  New rpcbind(8) replaces portmap(8) (supporting communication over
  an authenticated Unix-domain socket, and by default only allowing
  set and unset requests over that channel). It's much more secure
  than the old portmapper.

  Umount(8), mountd(8), mount_nfs(8), nfsd(8) have also been upgraded
  to support TI-RPC and to support IPV6.

  Umount(8) is also fixed to unmount pathnames longer than 80 chars,
  which are currently truncated by the Kernel statfs structure.

Submitted by: Martin Blapp <mb@imp.ch>
Manpage review: ru
Secure RPC implemented by: wpaul
2001-03-19 12:50:13 +00:00
Brian Feldman
c0511d3b58 Switch to using a struct xucred instead of a struct xucred when not
actually in the kernel.  This structure is a different size than
what is currently in -CURRENT, but should hopefully be the last time
any application breakage is caused there.  As soon as any major
inconveniences are removed, the definition of the in-kernel struct
ucred should be conditionalized upon defined(_KERNEL).

This also changes struct export_args to remove dependency on the
constantly-changing struct ucred, as well as limiting the bounds
of the size fields to the correct size.  This means: a) mountd and
friends won't break all the time, b) mountd and friends won't crash
the kernel all the time if they don't know what they're doing wrt
actual struct export_args layout.

Reviewed by:	bde
2001-02-18 13:30:20 +00:00
Semen Ustimenko
9300c69625 Added ntfs filesystem to be exported. 1999-12-03 20:23:53 +00:00
Bill Fumerola
395399162f (1) Remove ISO support, it's dead in the kernel anyway.
(2) Check for ENOENT when checking for /var/db/mountdtab
(3) Remove a signal handler that called broken functions.
(4) Remove the broken functions.

Submitted by:	Martin Blapp <mb@imp.ch>
Reviewed by:	bde (1), billf ([234])
1999-11-12 21:52:10 +00:00
Alfred Perlstein
cb479b1136 Put the umount request through the same translation as the mount
request.
Fix some uninitialized warnings and a style bug while we are here.
Problem still exists where a failed umount can be misreported as
success.

Submitted by: Martin Blapp <mb@imp.ch>
1999-10-06 18:20:44 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Alexander Langer
6436fcb9f0 Typo fix in diagnostic: -alldir --> -alldirs
PR:		11049
Submitted by:	Gerhard Gonter <gonter@whisky.wu-wien.ac.at>
1999-04-21 22:42:36 +00:00
Doug Rabson
f863ed7f6f Here is a patch to make mountd work.
It just replace u_long with u_int32_t and shouldn't affect on i386.
Without this patch,
- unaligned accesses occur
- permission denied randomly

Submitted by: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
1998-12-29 09:38:49 +00:00
Bruce Evans
ab84534772 Fixed printf format errors. 1998-08-02 16:06:35 +00:00
Philippe Charnier
7485340223 Correct improper use of .Sm. Document -d flag. Correct use of .Nm. Remove
unused #includes. Add usage(). Use warnx(). Correct spelling. Abort when
malloc() fails.
1998-07-15 06:21:41 +00:00
Bill Paul
021e3d59aa A long time ago I hacked mountd so that it would deal intelligently
with export lines where the same hostname was specified more than once
(this happens a lot with netgroups sometimes). Recently I discovered
that it needs to be hacked to deal with multiple instances of the
same IP address too.

I've been using this modification locally for several months with no
hassles.
1998-06-25 21:26:06 +00:00
Joerg Wunsch
01d48801bc Oops, the previous commit missed one line of code. 1998-06-15 15:43:13 +00:00
Joerg Wunsch
9d70a1569c Watch out for null hostnames in netgroup entries, to avoid dumping core.
This happens if someone tries to export to a netgroup like:

mygroup		(,,mynisdomain)
1998-06-15 15:41:41 +00:00
Bruce Evans
a798ce2eac Converted to Lite2 mount interface - use vfc_typenum from the
already looked up vfsconf struct for nfs instead of MOUNT_NFS.
Removed related FreeBSD ifdefs.
1998-01-20 15:22:27 +00:00
Guido van Rooij
f2c90b9538 Oops..The default behaviour should be *not* to log all succeeded
requests. If you want this extra loggin, add the -l option.
1997-12-13 19:50:14 +00:00
Guido van Rooij
690c488d0a Fix some style bugs.
Submitted by:	bruce
1997-12-10 20:33:59 +00:00
Guido van Rooij
f51631d732 Log all failed mount attempts.
Also add a flag (-l) so mountd will also log all succeeded requests
to mountd.
1997-12-09 18:43:44 +00:00
Jonathan Lemon
a968cfd87c If a host in an export line in /etc/exports (or within a netgroup on
an export line) is unresolvable, make a note of it via syslog and skip
that individual host instead of skipping the entire line.

PR:	1981, 815
Perused by:	joerg
1997-09-12 16:25:24 +00:00
Guido van Rooij
e90cdb54db Plug info agthering attack as pointed out on Bugtraq recently.
Obtained from: OpenBSD
1997-08-29 19:22:28 +00:00
Doug Rabson
cb3923e0ee Merge WebNFS support from NetBSD.
Obtained from:	NetBSD
1997-07-16 09:27:53 +00:00
Paul Traina
0f4b7baa2d Back out msmith's recent commit which breaks using symbolic names for netmasks.
Instead, reverse the order of the testing, so if a symbolic name starts with
a digit, we'll see if we can make a network address out of it first.  If
that fails, then we'll call getnet...
1997-04-30 18:40:12 +00:00
Mike Smith
590ef650e0 Don't call getnetbyname() on a netmask. On a system with a slow net
connection, a large set of network exports could take many minutes to
time out, giving the appearance of a total hang during boot.
1997-04-23 11:03:10 +00:00
Doug Rabson
2a66cfc532 Add a -2 flag to mountd to allow an admin to disable NFSv3 services.
This is handy for testing and possibly to work around busted v3 clients.
1997-04-22 10:37:27 +00:00
Guido van Rooij
c6e5e15858 Make a sysconfig variable controlling if teh kernel should accept
nfs requests from non-privileged ports.

Change mountd such that it does never set this variable, but only clears
it when run with -n. Also document this in the man page.
1997-04-09 20:17:15 +00:00
Bruce Evans
1f45d4d4eb Don't fail when the vfs.nfs.nfs_privport sysctl doesn't exist
(presumably because the kernel is old).  Moved the declaration of a
variable realated to this sysctl outside of an unrelated ifdef.

Not fixed:
- this sysctl is badly named (nfs occurs twice).
- it's silly to have for FreeBSD in FreeBSD code, especially when
  only half of the FreeBSD-dependent code is ifdefed.
1997-04-01 14:15:30 +00:00
Warner Losh
8d64695c7c compare return value from getopt against -1 rather than EOF, per the final
posix standard on the topic.
1997-03-29 03:33:12 +00:00
Guido van Rooij
394da4c167 Add code that will reject nfs requests in teh kernel from nonprivileged
ports. This option will be automatically set/cleraed when mount is run
without/with the -n option.
Reviewed by:	Doug Rabson
1997-03-27 20:01:07 +00:00
Peter Wemm
87564113d7 Merge from Lite2 (use new getvfsbyname() and mount(2) interface, cleanup) 1997-03-11 12:43:45 +00:00
Peter Wemm
c0ec1f37ef Revert $FreeBSD$ to $Id$ 1997-02-22 14:40:44 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Bill Paul
273804e22c Add one line fix to stop my old 'don't barf if you see the same
hostname/IP twice on same line in /etc/exports' fix from dumping core
due to bogus /etc/exports entries.

Submitted by: Toshihiro Kanda <candy@fct.kgc.co.jp>
1996-08-29 14:20:57 +00:00
Joerg Wunsch
1cc09ccecf Avoid bogus free() of a junk pointer.
Detected by: phkmalloc
Submitted by:	grog@lemis.de (Greg Lehey)
1995-11-17 23:22:34 +00:00
Doug Rabson
a62dc40654 Changes to support version 3 of the NFS protocol.
The version 2 support has been tested (client+server) against FreeBSD-2.0,
IRIX 5.3 and FreeBSD-current (using a loopback mount).  The version 2 support
is stable AFAIK.
The version 3 support has been tested with a loopback mount and minimally
against an IRIX 5.3 server.  It needs more testing and may have problems.
I have patched amd to support the new variable length filehandles although
it will still only use version 2 of the protocol.

Before booting a kernel with these changes, nfs clients will need to at least
build and install /usr/sbin/mount_nfs.  Servers will need to build and
install /usr/sbin/mountd.

NFS diskless support is untested.

Obtained from: Rick Macklem <rick@snowhite.cis.uoguelph.ca>
1995-06-27 11:07:30 +00:00
Rodney W. Grimes
d3628763db Merge RELENG_2_0_5 into HEAD 1995-06-11 19:33:05 +00:00