diff options
author | alfred <alfred@FreeBSD.org> | 2004-07-06 09:37:43 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2004-07-06 09:37:43 +0000 |
commit | e0a5f530c25100eec4a2a3dfa0ac270bdff214b7 (patch) | |
tree | e93dde14927121ca1d0c3f76398b80469bde2cfd /sys/kern/vfs_subr.c | |
parent | 8fd8b8c57fb214d5cdc0aeaed49ca85a702f1507 (diff) | |
download | FreeBSD-src-e0a5f530c25100eec4a2a3dfa0ac270bdff214b7.zip FreeBSD-src-e0a5f530c25100eec4a2a3dfa0ac270bdff214b7.tar.gz |
Introduce vfs_suser(), used to test if a user should have special privs
for a mount.
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 1c7a7fb..40b564c 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -358,6 +358,22 @@ vfs_getvfs(fsid) } /* + * Check if a user can access priveledged mount options. + */ +int +vfs_suser(struct mount *mp, struct thread *td) +{ + int error; + + if ((mp->mnt_flag & MNT_USER) == 0 || + mp->mnt_cred->cr_uid != td->td_ucred->cr_uid) { + if ((error = suser(td)) != 0) + return (error); + } + return (0); +} + +/* * Get a new unique fsid. Try to make its val[0] unique, since this value * will be used to create fake device numbers for stat(). Also try (but * not so hard) make its val[0] unique mod 2^16, since some emulators only |