From dc2e474f79c1287592679cd5e0c4c2307feccd60 Mon Sep 17 00:00:00 2001 From: jhb Date: Mon, 1 Apr 2002 21:31:13 +0000 Subject: Change the suser() API to take advantage of td_ucred as well as do a general cleanup of the API. The entire API now consists of two functions similar to the pre-KSE API. The suser() function takes a thread pointer as its only argument. The td_ucred member of this thread must be valid so the only valid thread pointers are curthread and a few kernel threads such as thread0. The suser_cred() function takes a pointer to a struct ucred as its first argument and an integer flag as its second argument. The flag is currently only used for the PRISON_ROOT flag. Discussed on: smp@ --- sys/fs/devfs/devfs_vnops.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'sys/fs/devfs') diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 7310001..c0a8098 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -718,8 +718,7 @@ devfs_setattr(ap) if (uid != de->de_uid || gid != de->de_gid) { if (((ap->a_cred->cr_uid != de->de_uid) || uid != de->de_uid || (gid != de->de_gid && !groupmember(gid, ap->a_cred))) && - (error = suser_xxx(NULL, ap->a_td->td_proc, - PRISON_ROOT)) != 0) + (error = suser_cred(ap->a_td->td_ucred, PRISON_ROOT)) != 0) return (error); de->de_uid = uid; de->de_gid = gid; @@ -736,21 +735,21 @@ devfs_setattr(ap) if (vap->va_mode != (mode_t)VNOVAL) { if ((ap->a_cred->cr_uid != de->de_uid) && - (error = suser_xxx(NULL, ap->a_td->td_proc, PRISON_ROOT))) + (error = suser_cred(ap->a_td->td_ucred, PRISON_ROOT))) return (error); de->de_mode = vap->va_mode; c = 1; } if (vap->va_atime.tv_sec != VNOVAL) { if ((ap->a_cred->cr_uid != de->de_uid) && - (error = suser_xxx(NULL, ap->a_td->td_proc, PRISON_ROOT))) + (error = suser_cred(ap->a_td->td_ucred, PRISON_ROOT))) return (error); de->de_atime = vap->va_atime; c = 1; } if (vap->va_mtime.tv_sec != VNOVAL) { if ((ap->a_cred->cr_uid != de->de_uid) && - (error = suser_xxx(NULL, ap->a_td->td_proc, PRISON_ROOT))) + (error = suser_cred(ap->a_td->td_ucred, PRISON_ROOT))) return (error); de->de_mtime = vap->va_mtime; c = 1; @@ -776,7 +775,7 @@ devfs_symlink(ap) struct devfs_dirent *de; struct devfs_mount *dmp; - error = suser(ap->a_cnp->cn_thread->td_proc); + error = suser(ap->a_cnp->cn_thread); if (error) return(error); dmp = VFSTODEVFS(ap->a_dvp->v_mount); -- cgit v1.1