The local fs interface does not allow link()/unlink() of directories,

do not allow a remote nfs client to cause local fs corruption either.
This commit is contained in:
peter 1997-03-25 05:08:28 +00:00
parent 91b3ba195c
commit 6c63b328f9
2 changed files with 14 additions and 8 deletions

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
* $Id$
* $Id: nfs_serv.c,v 1.37 1997/02/22 09:42:38 peter Exp $
*/
/*
@ -1711,9 +1711,10 @@ nfsrv_remove(nfsd, slp, procp, mrq)
}
if (!error) {
vp = nd.ni_vp;
if (vp->v_type == VDIR &&
(error = suser(cred, (u_short *)0)))
if (vp->v_type == VDIR) {
error = EPERM; /* POSIX */
goto out;
}
/*
* The root of a mounted filesystem cannot be deleted.
*/
@ -1997,8 +1998,10 @@ nfsrv_link(nfsd, slp, procp, mrq)
nfsm_srvwcc_data(dirfor_ret, &dirfor, diraft_ret, &diraft);
return (0);
}
if (vp->v_type == VDIR && (error = suser(cred, (u_short *)0)))
if (vp->v_type == VDIR) {
error = EPERM; /* POSIX */
goto out1;
}
nd.ni_cnd.cn_cred = cred;
nd.ni_cnd.cn_nameiop = CREATE;
nd.ni_cnd.cn_flags = LOCKPARENT;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_serv.c 8.3 (Berkeley) 1/12/94
* $Id$
* $Id: nfs_serv.c,v 1.37 1997/02/22 09:42:38 peter Exp $
*/
/*
@ -1711,9 +1711,10 @@ nfsrv_remove(nfsd, slp, procp, mrq)
}
if (!error) {
vp = nd.ni_vp;
if (vp->v_type == VDIR &&
(error = suser(cred, (u_short *)0)))
if (vp->v_type == VDIR) {
error = EPERM; /* POSIX */
goto out;
}
/*
* The root of a mounted filesystem cannot be deleted.
*/
@ -1997,8 +1998,10 @@ nfsrv_link(nfsd, slp, procp, mrq)
nfsm_srvwcc_data(dirfor_ret, &dirfor, diraft_ret, &diraft);
return (0);
}
if (vp->v_type == VDIR && (error = suser(cred, (u_short *)0)))
if (vp->v_type == VDIR) {
error = EPERM; /* POSIX */
goto out1;
}
nd.ni_cnd.cn_cred = cred;
nd.ni_cnd.cn_nameiop = CREATE;
nd.ni_cnd.cn_flags = LOCKPARENT;