Merge WebNFS support from NetBSD.

Obtained from:	NetBSD
This commit is contained in:
Doug Rabson 1997-07-16 09:27:53 +00:00
parent e775608178
commit cb3923e0ee
4 changed files with 94 additions and 4 deletions

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)exports.5 8.3 (Berkeley) 3/29/95
.\" $Id$
.\" $Id: exports.5,v 1.5 1997/03/12 15:08:06 mpp Exp $
.\"
.Dd March 29, 1995
.Dt EXPORTS 5
@ -158,6 +158,40 @@ is a synonym for
.Fl ro
in an effort to be backward compatible with older export file formats.
.Pp
WebNFS exports strictly according to the spec (RFC 2054 and RFC 2055) can
be done with the
.Fl public
flag. However, this flag in itself allows r/w access to all files in
the filesystem, not requiring reserved ports and not remapping uids. It
is only provided to conform to the spec, and should normally not be used.
For a WebNFS export,
use the
.Fl webnfs
flag, which implies
.Fl public ,
.Sm off
.Fl mapall No = Sy nobody
.Sm on
and
.Fl ro .
.Pp
A
.Sm off
.Fl index No = Sy file
.Sm off
option can be used to specify a file whose handle will be returned if
a directory is looked up using the public filehandle (WebNFS). This
is to mimic the behavior of URLs. If no
.Fl index
option is specified, a directory filehandle will be returned as usual.
The
.Fl index
option only makes sense in combination with the
.Fl public
or
.Fl webnfs
flags.
.Pp
The third component of a line specifies the host set to which the line applies.
The set may be specified in three ways.
The first way is to list the host name(s) separated by white space.

View File

@ -43,7 +43,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95"; */
static const char rcsid[] =
"$Id: mountd.c,v 1.20 1997/04/23 11:03:10 msmith Exp $";
"$Id: mountd.c,v 1.21 1997/04/30 18:40:12 pst Exp $";
#endif /*not lint*/
#include <sys/param.h>
@ -115,6 +115,7 @@ struct exportlist {
int ex_flag;
fsid_t ex_fs;
char *ex_fsdir;
char *ex_indexfile;
};
/* ex_flag bits */
#define EX_LINKED 0x1
@ -1339,6 +1340,13 @@ do_opt(cpp, endcpp, ep, grp, has_hostp, exflagsp, cr)
opt_flags |= OP_NET;
} else if (!strcmp(cpopt, "alldirs")) {
opt_flags |= OP_ALLDIRS;
} else if (!strcmp(cpopt, "public")) {
*exflagsp |= MNT_EXPUBLIC;
} else if (!strcmp(cpopt, "webnfs")) {
*exflagsp |= (MNT_EXPUBLIC|MNT_EXRDONLY|MNT_EXPORTANON);
opt_flags |= OP_MAPALL;
} else if (cpoptarg && !strcmp(cpopt, "index")) {
ep->ex_indexfile = strdup(cpoptarg);
#ifdef ISO
} else if (cpoptarg && !strcmp(cpopt, "iso")) {
if (get_isoaddr(cpoptarg, grp)) {
@ -1474,6 +1482,8 @@ free_exp(ep)
}
if (ep->ex_fsdir)
free(ep->ex_fsdir);
if (ep->ex_indexfile)
free(ep->ex_indexfile);
free_dir(ep->ex_dirl);
free((caddr_t)ep);
}
@ -1582,6 +1592,7 @@ do_mount(ep, grp, exflags, anoncrp, dirp, dirplen, fsb)
args.ua.fspec = 0;
args.ua.export.ex_flags = exflags;
args.ua.export.ex_anon = *anoncrp;
args.ua.export.ex_indexfile = ep->ex_indexfile;
memset(&sin, 0, sizeof(sin));
memset(&imask, 0, sizeof(imask));
sin.sin_family = AF_INET;

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)exports.5 8.3 (Berkeley) 3/29/95
.\" $Id$
.\" $Id: exports.5,v 1.5 1997/03/12 15:08:06 mpp Exp $
.\"
.Dd March 29, 1995
.Dt EXPORTS 5
@ -158,6 +158,40 @@ is a synonym for
.Fl ro
in an effort to be backward compatible with older export file formats.
.Pp
WebNFS exports strictly according to the spec (RFC 2054 and RFC 2055) can
be done with the
.Fl public
flag. However, this flag in itself allows r/w access to all files in
the filesystem, not requiring reserved ports and not remapping uids. It
is only provided to conform to the spec, and should normally not be used.
For a WebNFS export,
use the
.Fl webnfs
flag, which implies
.Fl public ,
.Sm off
.Fl mapall No = Sy nobody
.Sm on
and
.Fl ro .
.Pp
A
.Sm off
.Fl index No = Sy file
.Sm off
option can be used to specify a file whose handle will be returned if
a directory is looked up using the public filehandle (WebNFS). This
is to mimic the behavior of URLs. If no
.Fl index
option is specified, a directory filehandle will be returned as usual.
The
.Fl index
option only makes sense in combination with the
.Fl public
or
.Fl webnfs
flags.
.Pp
The third component of a line specifies the host set to which the line applies.
The set may be specified in three ways.
The first way is to list the host name(s) separated by white space.

View File

@ -43,7 +43,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95"; */
static const char rcsid[] =
"$Id: mountd.c,v 1.20 1997/04/23 11:03:10 msmith Exp $";
"$Id: mountd.c,v 1.21 1997/04/30 18:40:12 pst Exp $";
#endif /*not lint*/
#include <sys/param.h>
@ -115,6 +115,7 @@ struct exportlist {
int ex_flag;
fsid_t ex_fs;
char *ex_fsdir;
char *ex_indexfile;
};
/* ex_flag bits */
#define EX_LINKED 0x1
@ -1339,6 +1340,13 @@ do_opt(cpp, endcpp, ep, grp, has_hostp, exflagsp, cr)
opt_flags |= OP_NET;
} else if (!strcmp(cpopt, "alldirs")) {
opt_flags |= OP_ALLDIRS;
} else if (!strcmp(cpopt, "public")) {
*exflagsp |= MNT_EXPUBLIC;
} else if (!strcmp(cpopt, "webnfs")) {
*exflagsp |= (MNT_EXPUBLIC|MNT_EXRDONLY|MNT_EXPORTANON);
opt_flags |= OP_MAPALL;
} else if (cpoptarg && !strcmp(cpopt, "index")) {
ep->ex_indexfile = strdup(cpoptarg);
#ifdef ISO
} else if (cpoptarg && !strcmp(cpopt, "iso")) {
if (get_isoaddr(cpoptarg, grp)) {
@ -1474,6 +1482,8 @@ free_exp(ep)
}
if (ep->ex_fsdir)
free(ep->ex_fsdir);
if (ep->ex_indexfile)
free(ep->ex_indexfile);
free_dir(ep->ex_dirl);
free((caddr_t)ep);
}
@ -1582,6 +1592,7 @@ do_mount(ep, grp, exflags, anoncrp, dirp, dirplen, fsb)
args.ua.fspec = 0;
args.ua.export.ex_flags = exflags;
args.ua.export.ex_anon = *anoncrp;
args.ua.export.ex_indexfile = ep->ex_indexfile;
memset(&sin, 0, sizeof(sin));
memset(&imask, 0, sizeof(imask));
sin.sin_family = AF_INET;