summaryrefslogtreecommitdiffstats
path: root/sys/nfs/nfs_serv.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1998-05-31 17:54:18 +0000
committerpeter <peter@FreeBSD.org>1998-05-31 17:54:18 +0000
commit2b239be950449c9cd769dd8faa805693f440b806 (patch)
treecfc8701d8862f5be4e47da6b7108bcc0a4e723b4 /sys/nfs/nfs_serv.c
parentcbeeaf83f285b6b7ce0aa7026de037ac83a9ea73 (diff)
downloadFreeBSD-src-2b239be950449c9cd769dd8faa805693f440b806.zip
FreeBSD-src-2b239be950449c9cd769dd8faa805693f440b806.tar.gz
Refuse READDIR / READDIRPLUS rpc's for non-directories
Obtained from: NetBSD
Diffstat (limited to 'sys/nfs/nfs_serv.c')
-rw-r--r--sys/nfs/nfs_serv.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index de7084e..4298c3c 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95
- * $Id: nfs_serv.c,v 1.62 1998/05/30 16:33:56 peter Exp $
+ * $Id: nfs_serv.c,v 1.63 1998/05/31 17:27:47 peter Exp $
*/
/*
@@ -2545,6 +2545,10 @@ nfsrv_readdir(nfsd, slp, procp, mrq)
fullsiz = siz;
error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam,
&rdonly, (nfsd->nd_flag & ND_KERBAUTH), TRUE);
+ if (!error && vp->v_type != VDIR) {
+ error = ENOTDIR;
+ vput(vp);
+ }
if (error) {
nfsm_reply(NFSX_UNSIGNED);
nfsm_srvpostop_attr(getret, &at);
@@ -2801,6 +2805,10 @@ nfsrv_readdirplus(nfsd, slp, procp, mrq)
fullsiz = siz;
error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam,
&rdonly, (nfsd->nd_flag & ND_KERBAUTH), TRUE);
+ if (!error && vp->v_type != VDIR) {
+ error = ENOTDIR;
+ vput(vp);
+ }
if (error) {
nfsm_reply(NFSX_UNSIGNED);
nfsm_srvpostop_attr(getret, &at);
OpenPOWER on IntegriCloud