Subject: ptyfs and immutable/append-only flags
To: None <tech-kern@NetBSD.org>
From: Elad Efrat <elad@NetBSD.org>
List: tech-kern
Date: 12/28/2006 14:02:36
This is a multi-part message in MIME format.
--------------080805000807080008000603
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
hi,
I think it doesn't make sense to support immutable and/or append-only
flags in ptyfs. attached diff removes this support.
if no one objects I'll commit this.
-e.
--------------080805000807080008000603
Content-Type: text/plain;
name="ptyfs.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="ptyfs.diff"
Index: ptyfs_vnops.c
===================================================================
RCS file: /usr/cvs/src/sys/fs/ptyfs/ptyfs_vnops.c,v
retrieving revision 1.19
diff -u -p -r1.19 ptyfs_vnops.c
--- ptyfs_vnops.c 9 Dec 2006 16:11:51 -0000 1.19
+++ ptyfs_vnops.c 27 Dec 2006 10:37:52 -0000
@@ -383,19 +383,16 @@ ptyfs_setattr(void *v)
(error = kauth_authorize_generic(cred, KAUTH_GENERIC_ISSUSER,
&l->l_acflag)) != 0)
return error;
+ /* Immutable and append-only flags are not supported on ptyfs. */
+ if (vap->va_flags & (IMMUTABLE | APPEND))
+ return EINVAL;
if (kauth_authorize_generic(cred, KAUTH_GENERIC_ISSUSER, NULL) == 0) {
- if ((ptyfs->ptyfs_flags & (SF_IMMUTABLE | SF_APPEND)) &&
- securelevel > 0)
- return EPERM;
/* Snapshot flag cannot be set or cleared */
if ((vap->va_flags & SF_SNAPSHOT) !=
(ptyfs->ptyfs_flags & SF_SNAPSHOT))
return EPERM;
ptyfs->ptyfs_flags = vap->va_flags;
} else {
- if ((ptyfs->ptyfs_flags & (SF_IMMUTABLE | SF_APPEND)) ||
- (vap->va_flags & UF_SETTABLE) != vap->va_flags)
- return EPERM;
if ((ptyfs->ptyfs_flags & SF_SETTABLE) !=
(vap->va_flags & SF_SETTABLE))
return EPERM;
@@ -403,11 +400,8 @@ ptyfs_setattr(void *v)
ptyfs->ptyfs_flags |= (vap->va_flags & UF_SETTABLE);
}
ptyfs->ptyfs_flag |= PTYFS_CHANGE;
- if (vap->va_flags & (IMMUTABLE | APPEND))
- return 0;
}
- if (ptyfs->ptyfs_flags & (IMMUTABLE | APPEND))
- return EPERM;
+
/*
* Go through the fields and update iff not VNOVAL.
*/
--------------080805000807080008000603--