summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-07-03 17:49:54 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-07-03 17:49:54 +0000
commitc60204b5e10d8e419fc74f36b370db40b157062f (patch)
tree0f5c1e56a09140f1746fe7f635dc5da4822e0981 /sys
parent779957a2496d5893ae6746142b215f342aef8bfb (diff)
rm of dir returns EPERM; more careful about ..; netbsd
Diffstat (limited to 'sys')
-rw-r--r--sys/msdosfs/msdosfs_vnops.c11
-rw-r--r--sys/ufs/ext2fs/ext2fs_vnops.c15
-rw-r--r--sys/ufs/ufs/ufs_vnops.c12
3 files changed, 20 insertions, 18 deletions
diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c
index 2bf40531c8c..98d32d4f043 100644
--- a/sys/msdosfs/msdosfs_vnops.c
+++ b/sys/msdosfs/msdosfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_vnops.c,v 1.8 1997/03/02 18:02:01 millert Exp $ */
+/* $OpenBSD: msdosfs_vnops.c,v 1.9 1997/07/03 17:49:53 deraadt Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.48 1996/03/20 00:45:43 thorpej Exp $ */
/*-
@@ -836,7 +836,10 @@ msdosfs_remove(v)
struct denode *ddep = VTODE(ap->a_dvp);
int error;
- error = removede(ddep, dep);
+ if (ap->a_vp->v_type == VDIR)
+ error = EPERM;
+ else
+ error = removede(ddep, dep);
#ifdef MSDOSFS_DEBUG
printf("msdosfs_remove(), dep %08x, v_usecount %d\n", dep, ap->a_vp->v_usecount);
#endif
@@ -996,7 +999,9 @@ abortit:
* Avoid ".", "..", and aliases of "." for obvious reasons.
*/
if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') ||
- dp == ip || (fcnp->cn_flags & ISDOTDOT) ||
+ dp == ip ||
+ (fcnp->cn_flags & ISDOTDOT) ||
+ (tcnp->cn_flags & ISDOTDOT) ||
(ip->de_flag & DE_RENAME)) {
VOP_UNLOCK(fvp);
error = EINVAL;
diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c
index 48fd436ae1e..04aa04d39f1 100644
--- a/sys/ufs/ext2fs/ext2fs_vnops.c
+++ b/sys/ufs/ext2fs/ext2fs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ext2fs_vnops.c,v 1.4 1997/06/12 21:27:47 downsj Exp $ */
+/* $OpenBSD: ext2fs_vnops.c,v 1.5 1997/07/03 17:49:45 deraadt Exp $ */
/* $NetBSD: ext2fs_vnops.c,v 1.1 1997/06/11 09:34:09 bouyer Exp $ */
/*
@@ -448,13 +448,10 @@ ext2fs_remove(v)
register struct vnode *dvp = ap->a_dvp;
int error;
- if (vp->v_type == VDIR) {
- error = EISDIR;
- goto out;
- }
ip = VTOI(vp);
- if ((ip->i_e2fs_flags & (EXT2_IMMUTABLE | EXT2_APPEND)) ||
- (VTOI(dvp)->i_e2fs_flags & EXT2_APPEND)) {
+ if (vp->v_type == VDIR ||
+ (ip->i_e2fs_flags & (EXT2_IMMUTABLE | EXT2_APPEND)) ||
+ (VTOI(dvp)->i_e2fs_flags & EXT2_APPEND)) {
error = EPERM;
goto out;
}
@@ -666,7 +663,9 @@ abortit:
* Avoid ".", "..", and aliases of "." for obvious reasons.
*/
if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') ||
- dp == ip || (fcnp->cn_flags&ISDOTDOT) ||
+ dp == ip ||
+ (fcnp->cn_flags&ISDOTDOT) ||
+ (tcnp->cn_flags & ISDOTDOT) ||
(ip->i_flag & IN_RENAME)) {
VOP_UNLOCK(fvp);
error = EINVAL;
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 9f130937708..fe58d6e899e 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_vnops.c,v 1.9 1997/05/30 08:35:18 downsj Exp $ */
+/* $OpenBSD: ufs_vnops.c,v 1.10 1997/07/03 17:49:49 deraadt Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.18 1996/05/11 18:28:04 mycroft Exp $ */
/*
@@ -619,12 +619,8 @@ ufs_remove(v)
register struct vnode *dvp = ap->a_dvp;
int error;
- if (vp->v_type == VDIR) {
- error = EISDIR;
- goto out;
- }
ip = VTOI(vp);
- if ((ip->i_ffs_flags & (IMMUTABLE | APPEND)) ||
+ if (vp->v_type == VDIR || (ip->i_ffs_flags & (IMMUTABLE | APPEND)) ||
(VTOI(dvp)->i_ffs_flags & APPEND)) {
error = EPERM;
goto out;
@@ -895,7 +891,9 @@ abortit:
* Avoid ".", "..", and aliases of "." for obvious reasons.
*/
if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') ||
- dp == ip || (fcnp->cn_flags&ISDOTDOT) ||
+ dp == ip ||
+ (fcnp->cn_flags & ISDOTDOT) ||
+ (tcnp->cn_flags & ISDOTDOT) ||
(ip->i_flag & IN_RENAME)) {
VOP_UNLOCK(fvp);
error = EINVAL;