diff options
author | peter <peter@FreeBSD.org> | 1998-05-31 18:28:45 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1998-05-31 18:28:45 +0000 |
commit | f61450c5b001db5241d839c8b1ba5da34cd132ad (patch) | |
tree | a6c02245d94a2d89a9d728648d3b1801cb29c8e8 /sys | |
parent | c45767477f32c6f11172fc84c4de6a65b44b764a (diff) | |
download | FreeBSD-src-f61450c5b001db5241d839c8b1ba5da34cd132ad.zip FreeBSD-src-f61450c5b001db5241d839c8b1ba5da34cd132ad.tar.gz |
Don't let the user try and unlink() a directory on a NFS server.
Obtained from: NetBSD
Diffstat (limited to 'sys')
-rw-r--r-- | sys/nfs/nfs_vnops.c | 6 | ||||
-rw-r--r-- | sys/nfsclient/nfs_vnops.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c index ec621a3..c7edc3c 100644 --- a/sys/nfs/nfs_vnops.c +++ b/sys/nfs/nfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 - * $Id: nfs_vnops.c,v 1.95 1998/05/31 18:25:32 peter Exp $ + * $Id: nfs_vnops.c,v 1.96 1998/05/31 18:27:07 peter Exp $ */ @@ -1450,7 +1450,9 @@ nfs_remove(ap) if (vp->v_usecount < 1) panic("nfs_remove: bad v_usecount"); #endif - if (vp->v_usecount == 1 || (np->n_sillyrename && + if (vp->v_type == VDIR) + error = EPERM; + else if (vp->v_usecount == 1 || (np->n_sillyrename && VOP_GETATTR(vp, &vattr, cnp->cn_cred, cnp->cn_proc) == 0 && vattr.va_nlink > 1)) { /* diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c index ec621a3..c7edc3c 100644 --- a/sys/nfsclient/nfs_vnops.c +++ b/sys/nfsclient/nfs_vnops.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95 - * $Id: nfs_vnops.c,v 1.95 1998/05/31 18:25:32 peter Exp $ + * $Id: nfs_vnops.c,v 1.96 1998/05/31 18:27:07 peter Exp $ */ @@ -1450,7 +1450,9 @@ nfs_remove(ap) if (vp->v_usecount < 1) panic("nfs_remove: bad v_usecount"); #endif - if (vp->v_usecount == 1 || (np->n_sillyrename && + if (vp->v_type == VDIR) + error = EPERM; + else if (vp->v_usecount == 1 || (np->n_sillyrename && VOP_GETATTR(vp, &vattr, cnp->cn_cred, cnp->cn_proc) == 0 && vattr.va_nlink > 1)) { /* |