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:
John Baldwin 2001-11-28 18:25:39 +00:00
parent e75fedcfd5
commit 5a7f3ebb94
2 changed files with 3 additions and 3 deletions

View File

@ -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;

View File

@ -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;
}