return EPERM from ufs_setattr() if an attempt is made by non-superuser

to change superuser-only file flags; fixes PR kern/3491.
This commit is contained in:
mikel 1997-04-23 05:47:54 +00:00
parent d4aff75405
commit 55f53d7fdb
1 changed files with 4 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ufs_vnops.c,v 1.23 1997/03/27 07:30:25 mikel Exp $ */
/* $NetBSD: ufs_vnops.c,v 1.24 1997/04/23 05:47:54 mikel Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@ -341,6 +341,9 @@ ufs_setattr(v)
} else {
if (ip->i_flags & (SF_IMMUTABLE | SF_APPEND))
return (EPERM);
if ((ip->i_flags & SF_SETTABLE) !=
(vap->va_flags & SF_SETTABLE))
return (EPERM);
ip->i_flags &= SF_SETTABLE;
ip->i_flags |= (vap->va_flags & UF_SETTABLE);
}