Use suser_td() instead of explicitly checking cr_uid against 0.
PR: kern/21809 Submitted by: <mbendiks@eunet.no> Reviewed by: rwatson
This commit is contained in:
parent
e75fedcfd5
commit
5a7f3ebb94
@ -195,7 +195,7 @@ msdosfs_mount(mp, path, data, ndp, td)
|
||||
* If upgrade to read-write by non-root, then verify
|
||||
* that user has necessary permissions on the device.
|
||||
*/
|
||||
if (td->td_proc->p_ucred->cr_uid != 0) {
|
||||
if (suser_td(td)) {
|
||||
devvp = pmp->pm_devvp;
|
||||
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
|
||||
error = VOP_ACCESS(devvp, VREAD | VWRITE,
|
||||
@ -242,7 +242,7 @@ msdosfs_mount(mp, path, data, ndp, td)
|
||||
* If mount by non-root, then verify that user has necessary
|
||||
* permissions on the device.
|
||||
*/
|
||||
if (td->td_proc->p_ucred->cr_uid != 0) {
|
||||
if (suser_td(td)) {
|
||||
accessmode = VREAD;
|
||||
if ((mp->mnt_flag & MNT_RDONLY) == 0)
|
||||
accessmode |= VWRITE;
|
||||
|
@ -390,7 +390,7 @@ msdosfs_setattr(ap)
|
||||
* set ATTR_ARCHIVE for directories `cp -pr' from a more
|
||||
* sensible file system attempts it a lot.
|
||||
*/
|
||||
if (cred->cr_uid != 0) {
|
||||
if (suser_xxx(cred, ap->a_td->td_proc, PRISON_ROOT)) {
|
||||
if (vap->va_flags & SF_SETTABLE)
|
||||
return EPERM;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user