MCPcopy Create free account
hub / github.com/F-Stack/f-stack / vfs_suser

Function vfs_suser

freebsd/kern/vfs_subr.c:912–946  ·  view source on GitHub ↗

* Check if a user can access privileged mount options. */

Source from the content-addressed store, hash-verified

910 * Check if a user can access privileged mount options.
911 */
912int
913vfs_suser(struct mount *mp, struct thread *td)
914{
915 int error;
916
917 if (jailed(td->td_ucred)) {
918 /*
919 * If the jail of the calling thread lacks permission for
920 * this type of file system, deny immediately.
921 */
922 if (!prison_allow(td->td_ucred, mp->mnt_vfc->vfc_prison_flag))
923 return (EPERM);
924
925 /*
926 * If the file system was mounted outside the jail of the
927 * calling thread, deny immediately.
928 */
929 if (prison_check(td->td_ucred, mp->mnt_cred) != 0)
930 return (EPERM);
931 }
932
933 /*
934 * If file system supports delegated administration, we don't check
935 * for the PRIV_VFS_MOUNT_OWNER privilege - it will be better verified
936 * by the file system itself.
937 * If this is not the user that did original mount, we check for
938 * the PRIV_VFS_MOUNT_OWNER privilege.
939 */
940 if (!(mp->mnt_vfc->vfc_flags & VFCF_DELEGADMIN) &&
941 mp->mnt_cred->cr_uid != td->td_ucred->cr_uid) {
942 if ((error = priv_check(td, PRIV_VFS_MOUNT_OWNER)) != 0)
943 return (error);
944 }
945 return (0);
946}
947
948/*
949 * Get a new unique fsid. Try to make its val[0] unique, since this value

Callers 2

vfs_domount_updateFunction · 0.85
dounmountFunction · 0.85

Calls 4

jailedFunction · 0.85
prison_allowFunction · 0.85
prison_checkFunction · 0.85
priv_checkFunction · 0.70

Tested by

no test coverage detected