diff options
author | rwatson <rwatson@FreeBSD.org> | 2001-11-02 21:11:41 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2001-11-02 21:11:41 +0000 |
commit | 339957cbbd95270e5a2265bc41a67225c4969cb1 (patch) | |
tree | 3cdd62d460d9e8b93d8e3a1cd59a6d29ff345b81 | |
parent | 9e6ad518d0daf77ed5c325b453bd913fc3428fe9 (diff) | |
download | FreeBSD-src-339957cbbd95270e5a2265bc41a67225c4969cb1.zip FreeBSD-src-339957cbbd95270e5a2265bc41a67225c4969cb1.tar.gz |
o Remove the local temporary variable "struct proc *p" from vfs_mount()
in vfs_syscalls.c. Although it did save some indirection, many of
those savings will be obscured with the impending commit of suser()
changes, and the result is increased code complexity. Also, once
p->p_ucred and td->td_ucred are distinguished, this will make
vfs_mount() use the correct thread credential, rather than the
process credential.
-rw-r--r-- | sys/kern/vfs_extattr.c | 14 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 14 |
2 files changed, 14 insertions, 14 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 7663827..530ad15 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -187,7 +187,6 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata) int error, flag = 0, flag2 = 0; struct vattr va; struct nameidata nd; - struct proc *p = td->td_proc; /* * Be ultra-paranoid about making sure the type and fspath @@ -214,7 +213,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata) /* * Silently enforce MNT_NOSUID and MNT_NODEV for non-root users */ - if (suser_xxx(p->p_ucred, 0, 0)) + if (suser_xxx(td->td_proc->p_ucred, 0, 0)) fsflags |= MNT_NOSUID | MNT_NODEV; /* * Get vnode to be covered @@ -245,7 +244,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata) * Only root, or the user that did the original mount is * permitted to update it. */ - if (mp->mnt_stat.f_owner != p->p_ucred->cr_uid) { + if (mp->mnt_stat.f_owner != td->td_proc->p_ucred->cr_uid) { error = suser_td(td); if (error) { vput(vp); @@ -275,19 +274,20 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata) * If the user is not root, ensure that they own the directory * onto which we are attempting to mount. */ - error = VOP_GETATTR(vp, &va, p->p_ucred, td); + error = VOP_GETATTR(vp, &va, td->td_proc->p_ucred, td); if (error) { vput(vp); return (error); } - if (va.va_uid != p->p_ucred->cr_uid) { + if (va.va_uid != td->td_proc->p_ucred->cr_uid) { error = suser_td(td); if (error) { vput(vp); return (error); } } - if ((error = vinvalbuf(vp, V_SAVE, p->p_ucred, td, 0, 0)) != 0) { + if ((error = vinvalbuf(vp, V_SAVE, td->td_proc->p_ucred, td, 0, 0)) + != 0) { vput(vp); return (error); } @@ -351,7 +351,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata) strncpy(mp->mnt_stat.f_fstypename, fstype, MFSNAMELEN); mp->mnt_stat.f_fstypename[MFSNAMELEN - 1] = '\0'; mp->mnt_vnodecovered = vp; - mp->mnt_stat.f_owner = p->p_ucred->cr_uid; + mp->mnt_stat.f_owner = td->td_proc->p_ucred->cr_uid; strncpy(mp->mnt_stat.f_mntonname, fspath, MNAMELEN); mp->mnt_stat.f_mntonname[MNAMELEN - 1] = '\0'; mp->mnt_iosize_max = DFLTPHYS; diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 7663827..530ad15 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -187,7 +187,6 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata) int error, flag = 0, flag2 = 0; struct vattr va; struct nameidata nd; - struct proc *p = td->td_proc; /* * Be ultra-paranoid about making sure the type and fspath @@ -214,7 +213,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata) /* * Silently enforce MNT_NOSUID and MNT_NODEV for non-root users */ - if (suser_xxx(p->p_ucred, 0, 0)) + if (suser_xxx(td->td_proc->p_ucred, 0, 0)) fsflags |= MNT_NOSUID | MNT_NODEV; /* * Get vnode to be covered @@ -245,7 +244,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata) * Only root, or the user that did the original mount is * permitted to update it. */ - if (mp->mnt_stat.f_owner != p->p_ucred->cr_uid) { + if (mp->mnt_stat.f_owner != td->td_proc->p_ucred->cr_uid) { error = suser_td(td); if (error) { vput(vp); @@ -275,19 +274,20 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata) * If the user is not root, ensure that they own the directory * onto which we are attempting to mount. */ - error = VOP_GETATTR(vp, &va, p->p_ucred, td); + error = VOP_GETATTR(vp, &va, td->td_proc->p_ucred, td); if (error) { vput(vp); return (error); } - if (va.va_uid != p->p_ucred->cr_uid) { + if (va.va_uid != td->td_proc->p_ucred->cr_uid) { error = suser_td(td); if (error) { vput(vp); return (error); } } - if ((error = vinvalbuf(vp, V_SAVE, p->p_ucred, td, 0, 0)) != 0) { + if ((error = vinvalbuf(vp, V_SAVE, td->td_proc->p_ucred, td, 0, 0)) + != 0) { vput(vp); return (error); } @@ -351,7 +351,7 @@ vfs_mount(td, fstype, fspath, fsflags, fsdata) strncpy(mp->mnt_stat.f_fstypename, fstype, MFSNAMELEN); mp->mnt_stat.f_fstypename[MFSNAMELEN - 1] = '\0'; mp->mnt_vnodecovered = vp; - mp->mnt_stat.f_owner = p->p_ucred->cr_uid; + mp->mnt_stat.f_owner = td->td_proc->p_ucred->cr_uid; strncpy(mp->mnt_stat.f_mntonname, fspath, MNAMELEN); mp->mnt_stat.f_mntonname[MNAMELEN - 1] = '\0'; mp->mnt_iosize_max = DFLTPHYS; |