Don't allow non-owner to set SUID bit on a file. It doesn't make
any difference now, but in NFSv4 ACLs, there is write_acl permission, which also affects mode changes. Reviewed by: pjd
This commit is contained in:
parent
c1edc4480e
commit
4076aa37dc
@ -302,6 +302,14 @@ secpolicy_setid_setsticky_clear(struct vnode *vp, struct vattr *vap,
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
/*
|
||||
* Deny setting setuid if we are not the file owner.
|
||||
*/
|
||||
if ((vap->va_mode & S_ISUID) && ovap->va_uid != cred->cr_uid) {
|
||||
error = priv_check_cred(cred, PRIV_VFS_ADMIN, 0);
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user