summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_mount.c
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2004-07-06 09:39:32 +0000
committeralfred <alfred@FreeBSD.org>2004-07-06 09:39:32 +0000
commit131eae0f4c08d0be9821cca4889db8dc9055bfd7 (patch)
tree1296377f642ff5badf66f24f2bbde6888b943f90 /sys/kern/vfs_mount.c
parente0a5f530c25100eec4a2a3dfa0ac270bdff214b7 (diff)
downloadFreeBSD-src-131eae0f4c08d0be9821cca4889db8dc9055bfd7.zip
FreeBSD-src-131eae0f4c08d0be9821cca4889db8dc9055bfd7.tar.gz
Use vfs_suser() where appropriate.
Diffstat (limited to 'sys/kern/vfs_mount.c')
-rw-r--r--sys/kern/vfs_mount.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 69a434e..22048f4 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -734,12 +734,10 @@ vfs_domount(
* Only privileged root, or (if MNT_USER is set) the user that
* did the original mount is permitted to update it.
*/
- if ((mp->mnt_flag & MNT_USER) == 0 ||
- mp->mnt_cred->cr_uid != td->td_ucred->cr_uid) {
- if ((error = suser(td)) != 0) {
- vput(vp);
- return (error);
- }
+ error = vfs_suser(mp, td);
+ if (error) {
+ vput(vp);
+ return (error);
}
if (vfs_busy(mp, LK_NOWAIT, 0, td)) {
vput(vp);
@@ -1072,11 +1070,9 @@ unmount(td, uap)
* Only privileged root, or (if MNT_USER is set) the user that did the
* original mount is permitted to unmount this filesystem.
*/
- if ((mp->mnt_flag & MNT_USER) == 0 ||
- mp->mnt_cred->cr_uid != td->td_ucred->cr_uid) {
- if ((error = suser(td)) != 0)
- return (error);
- }
+ error = vfs_suser(mp, td);
+ if (error)
+ return (error);
/*
* Don't allow unmounting the root filesystem.
OpenPOWER on IntegriCloud