summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2002-04-01 21:31:13 +0000
committerjhb <jhb@FreeBSD.org>2002-04-01 21:31:13 +0000
commitdc2e474f79c1287592679cd5e0c4c2307feccd60 (patch)
tree79021f0d43a5858be317d5cd33eac8cd4962b336 /sys/fs
parent34c7d606c9818987384d404948ecdc98521462bd (diff)
downloadFreeBSD-src-dc2e474f79c1287592679cd5e0c4c2307feccd60.zip
FreeBSD-src-dc2e474f79c1287592679cd5e0c4c2307feccd60.tar.gz
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@
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c2
-rw-r--r--sys/fs/devfs/devfs_vnops.c11
-rw-r--r--sys/fs/hpfs/hpfs_vnops.c2
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c4
-rw-r--r--sys/fs/msdosfs/msdosfs_vnops.c10
-rw-r--r--sys/fs/procfs/procfs_ioctl.c2
-rw-r--r--sys/fs/umapfs/umap_vfsops.c2
7 files changed, 16 insertions, 17 deletions
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index 1d9e073..70ecb01 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -238,7 +238,7 @@ cd9660_mount(mp, path, data, ndp, td)
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td);
if (error)
- error = suser_td(td);
+ error = suser(td);
if (error) {
vput(devvp);
return (error);
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);
diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c
index af836cb..69dff53 100644
--- a/sys/fs/hpfs/hpfs_vnops.c
+++ b/sys/fs/hpfs/hpfs_vnops.c
@@ -529,7 +529,7 @@ hpfs_setattr(ap)
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
if (cred->cr_uid != hp->h_uid &&
- (error = suser_xxx(cred, td->td_proc, PRISON_ROOT)) &&
+ (error = suser_cred(cred, PRISON_ROOT)) &&
((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
(error = VOP_ACCESS(vp, VWRITE, cred, td))))
return (error);
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index ff4c418..f62b0c7 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -194,7 +194,7 @@ msdosfs_mount(mp, path, data, ndp, td)
* If upgrade to read-write by non-root, then verify
* that user has necessary permissions on the device.
*/
- if (suser_td(td)) {
+ if (suser(td)) {
devvp = pmp->pm_devvp;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
error = VOP_ACCESS(devvp, VREAD | VWRITE,
@@ -241,7 +241,7 @@ msdosfs_mount(mp, path, data, ndp, td)
* If mount by non-root, then verify that user has necessary
* permissions on the device.
*/
- if (suser_td(td)) {
+ if (suser(td)) {
accessmode = VREAD;
if ((mp->mnt_flag & MNT_RDONLY) == 0)
accessmode |= VWRITE;
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 5118409..f8e3742 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -376,7 +376,7 @@ msdosfs_setattr(ap)
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
if (cred->cr_uid != pmp->pm_uid &&
- (error = suser_xxx(cred, ap->a_td->td_proc, PRISON_ROOT)))
+ (error = suser_cred(cred, PRISON_ROOT)))
return (error);
/*
* We are very inconsistent about handling unsupported
@@ -390,7 +390,7 @@ msdosfs_setattr(ap)
* set ATTR_ARCHIVE for directories `cp -pr' from a more
* sensible file system attempts it a lot.
*/
- if (suser_xxx(cred, ap->a_td->td_proc, PRISON_ROOT)) {
+ if (suser_cred(cred, PRISON_ROOT)) {
if (vap->va_flags & SF_SETTABLE)
return EPERM;
}
@@ -417,7 +417,7 @@ msdosfs_setattr(ap)
gid = pmp->pm_gid;
if ((cred->cr_uid != pmp->pm_uid || uid != pmp->pm_uid ||
(gid != pmp->pm_gid && !groupmember(gid, cred))) &&
- (error = suser_xxx(cred, ap->a_td->td_proc, PRISON_ROOT)))
+ (error = suser_cred(cred, PRISON_ROOT)))
return error;
if (uid != pmp->pm_uid || gid != pmp->pm_gid)
return EINVAL;
@@ -449,7 +449,7 @@ msdosfs_setattr(ap)
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
if (cred->cr_uid != pmp->pm_uid &&
- (error = suser_xxx(cred, ap->a_td->td_proc, PRISON_ROOT)) &&
+ (error = suser_cred(cred, PRISON_ROOT)) &&
((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
(error = VOP_ACCESS(ap->a_vp, VWRITE, cred, ap->a_td))))
return (error);
@@ -472,7 +472,7 @@ msdosfs_setattr(ap)
if (vp->v_mount->mnt_flag & MNT_RDONLY)
return (EROFS);
if (cred->cr_uid != pmp->pm_uid &&
- (error = suser_xxx(cred, ap->a_td->td_proc, PRISON_ROOT)))
+ (error = suser_cred(cred, PRISON_ROOT)))
return (error);
if (vp->v_type != VDIR) {
/* We ignore the read and execute bits. */
diff --git a/sys/fs/procfs/procfs_ioctl.c b/sys/fs/procfs/procfs_ioctl.c
index 1d1124c..09aef86 100644
--- a/sys/fs/procfs/procfs_ioctl.c
+++ b/sys/fs/procfs/procfs_ioctl.c
@@ -59,7 +59,7 @@ procfs_ioctl(PFS_IOCTL_ARGS)
break;
case PIOCSFL:
flags = *(unsigned int *)data;
- if (flags & PF_ISUGID && (error = suser(td->td_proc)) != 0)
+ if (flags & PF_ISUGID && (error = suser(td)) != 0)
break;
p->p_pfsflags = flags;
break;
diff --git a/sys/fs/umapfs/umap_vfsops.c b/sys/fs/umapfs/umap_vfsops.c
index ebdcf85..9e5f0fc 100644
--- a/sys/fs/umapfs/umap_vfsops.c
+++ b/sys/fs/umapfs/umap_vfsops.c
@@ -105,7 +105,7 @@ umapfs_mount(mp, path, data, ndp, td)
/*
* Only for root
*/
- if ((error = suser_td(td)) != 0)
+ if ((error = suser(td)) != 0)
return (error);
#ifdef DEBUG
OpenPOWER on IntegriCloud