diff --git a/sbin/mountd/exports.5 b/sbin/mountd/exports.5 index 12f26558af27..d5121149da6f 100644 --- a/sbin/mountd/exports.5 +++ b/sbin/mountd/exports.5 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)exports.5 5.2 (Berkeley) 5/10/91 -.\" $Id: exports.5,v 1.5 1993/09/09 16:34:33 ws Exp $ +.\" $Id: exports.5,v 1.6 1994/01/06 13:51:55 deraadt Exp $ .\" .Dd May 10, 1991 .Dt EXPORTS 5 @@ -54,7 +54,7 @@ server specification; see .%T "Network File System Protocol Specification \\*(tNRFC\\*(sP 1094" . .Pp Each line in the file specifies one remote mount point. -The first field is the mount point directory path followed +The first field is the mount point path (a directory or regular file) followed optionally by export options and specific hosts separated by white space. Only the first entry for a given local file system may specify the export options, since these are handled on a diff --git a/sbin/mountd/mountd.c b/sbin/mountd/mountd.c index 9b17051e9cd7..376e89ff8286 100644 --- a/sbin/mountd/mountd.c +++ b/sbin/mountd/mountd.c @@ -42,7 +42,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)mountd.c 5.14 (Berkeley) 2/26/91";*/ -static char rcsid[] = "$Id: mountd.c,v 1.9 1993/09/09 16:34:34 ws Exp $"; +static char rcsid[] = "$Id: mountd.c,v 1.10 1994/01/06 13:52:00 deraadt Exp $"; #endif not lint #include @@ -241,8 +241,8 @@ mntsrv(rqstp, transp) } /* Check to see if it's a valid dirpath */ - if (stat(dirpath, &stb) < 0 || (stb.st_mode&S_IFMT) != - S_IFDIR) { + if (stat(dirpath, &stb) < 0 || + (!S_ISDIR(stb.st_mode) && !S_ISREG(stb.st_mode))) { if (!svc_sendreply(transp, xdr_long, (caddr_t)&bad)) syslog(LOG_ERR, "Can't send reply"); return; @@ -516,10 +516,11 @@ get_exportlist() */ savedc = *endcp; *endcp = '\0'; - if (stat(cp, &sb) < 0 || (sb.st_mode & S_IFMT) != S_IFDIR) { + if (stat(cp, &sb) < 0 || + (!S_ISDIR(sb.st_mode) && !S_ISREG(sb.st_mode))) { syslog(LOG_ERR, "Bad Exports File, %s: %s, mountd Failed", - cp, "Not a directory"); + cp, "Not a directory or regular file"); exit(2); } fep = (struct exportlist *)0; diff --git a/usr.sbin/mountd/exports.5 b/usr.sbin/mountd/exports.5 index 12f26558af27..d5121149da6f 100644 --- a/usr.sbin/mountd/exports.5 +++ b/usr.sbin/mountd/exports.5 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" from: @(#)exports.5 5.2 (Berkeley) 5/10/91 -.\" $Id: exports.5,v 1.5 1993/09/09 16:34:33 ws Exp $ +.\" $Id: exports.5,v 1.6 1994/01/06 13:51:55 deraadt Exp $ .\" .Dd May 10, 1991 .Dt EXPORTS 5 @@ -54,7 +54,7 @@ server specification; see .%T "Network File System Protocol Specification \\*(tNRFC\\*(sP 1094" . .Pp Each line in the file specifies one remote mount point. -The first field is the mount point directory path followed +The first field is the mount point path (a directory or regular file) followed optionally by export options and specific hosts separated by white space. Only the first entry for a given local file system may specify the export options, since these are handled on a diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 9b17051e9cd7..376e89ff8286 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -42,7 +42,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)mountd.c 5.14 (Berkeley) 2/26/91";*/ -static char rcsid[] = "$Id: mountd.c,v 1.9 1993/09/09 16:34:34 ws Exp $"; +static char rcsid[] = "$Id: mountd.c,v 1.10 1994/01/06 13:52:00 deraadt Exp $"; #endif not lint #include @@ -241,8 +241,8 @@ mntsrv(rqstp, transp) } /* Check to see if it's a valid dirpath */ - if (stat(dirpath, &stb) < 0 || (stb.st_mode&S_IFMT) != - S_IFDIR) { + if (stat(dirpath, &stb) < 0 || + (!S_ISDIR(stb.st_mode) && !S_ISREG(stb.st_mode))) { if (!svc_sendreply(transp, xdr_long, (caddr_t)&bad)) syslog(LOG_ERR, "Can't send reply"); return; @@ -516,10 +516,11 @@ get_exportlist() */ savedc = *endcp; *endcp = '\0'; - if (stat(cp, &sb) < 0 || (sb.st_mode & S_IFMT) != S_IFDIR) { + if (stat(cp, &sb) < 0 || + (!S_ISDIR(sb.st_mode) && !S_ISREG(sb.st_mode))) { syslog(LOG_ERR, "Bad Exports File, %s: %s, mountd Failed", - cp, "Not a directory"); + cp, "Not a directory or regular file"); exit(2); } fep = (struct exportlist *)0;