diff options
-rw-r--r-- | sys/isofs/cd9660/cd9660_node.c | 27 | ||||
-rw-r--r-- | sys/miscfs/fdesc/fdesc_vnops.c | 4 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_subr.c | 42 | ||||
-rw-r--r-- | sys/miscfs/procfs/procfs_vnops.c | 21 | ||||
-rw-r--r-- | sys/miscfs/union/union.h | 8 | ||||
-rw-r--r-- | sys/miscfs/union/union_vfsops.c | 4 |
6 files changed, 52 insertions, 54 deletions
diff --git a/sys/isofs/cd9660/cd9660_node.c b/sys/isofs/cd9660/cd9660_node.c index 9ad3690f5ba..62c5ba2a66e 100644 --- a/sys/isofs/cd9660/cd9660_node.c +++ b/sys/isofs/cd9660/cd9660_node.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_node.c,v 1.2 1996/02/29 10:12:19 niklas Exp $ */ +/* $OpenBSD: cd9660_node.c,v 1.3 1997/08/01 05:58:55 millert Exp $ */ /* $NetBSD: cd9660_node.c,v 1.15 1996/02/09 21:31:58 christos Exp $ */ /*- @@ -312,25 +312,26 @@ cd9660_defattr(isodir, inop, bp) ap = (struct iso_extended_attributes *)bp->b_data; if (isonum_711(ap->version) == 1) { - if (!(ap->perm[0]&0x40)) - inop->inode.iso_mode |= VEXEC >> 6; - if (!(ap->perm[0]&0x10)) - inop->inode.iso_mode |= VREAD >> 6; - if (!(ap->perm[0]&4)) - inop->inode.iso_mode |= VEXEC >> 3; - if (!(ap->perm[0]&1)) - inop->inode.iso_mode |= VREAD >> 3; - if (!(ap->perm[1]&0x40)) - inop->inode.iso_mode |= VEXEC; if (!(ap->perm[1]&0x10)) - inop->inode.iso_mode |= VREAD; + inop->inode.iso_mode |= S_IRUSR; + if (!(ap->perm[1]&0x40)) + inop->inode.iso_mode |= S_IXUSR; + if (!(ap->perm[0]&0x01)) + inop->inode.iso_mode |= S_IRGRP; + if (!(ap->perm[0]&0x04)) + inop->inode.iso_mode |= S_IXGRP; + if (!(ap->perm[0]&0x10)) + inop->inode.iso_mode |= S_IROTH; + if (!(ap->perm[0]&0x40)) + inop->inode.iso_mode |= S_IXOTH; inop->inode.iso_uid = isonum_723(ap->owner); /* what about 0? */ inop->inode.iso_gid = isonum_723(ap->group); /* what about 0? */ } else ap = NULL; } if (!ap) { - inop->inode.iso_mode |= VREAD|VEXEC|(VREAD|VEXEC)>>3|(VREAD|VEXEC)>>6; + inop->inode.iso_mode |= + S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; inop->inode.iso_uid = (uid_t)0; inop->inode.iso_gid = (gid_t)0; } diff --git a/sys/miscfs/fdesc/fdesc_vnops.c b/sys/miscfs/fdesc/fdesc_vnops.c index 0943cec0029..af5ddbd05bf 100644 --- a/sys/miscfs/fdesc/fdesc_vnops.c +++ b/sys/miscfs/fdesc/fdesc_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdesc_vnops.c,v 1.6 1996/09/26 11:52:35 deraadt Exp $ */ +/* $OpenBSD: fdesc_vnops.c,v 1.7 1997/08/01 05:58:55 millert Exp $ */ /* $NetBSD: fdesc_vnops.c,v 1.32 1996/04/11 11:24:29 mrg Exp $ */ /* @@ -456,7 +456,7 @@ fdesc_attr(fd, vap, cred, p) * directories can cause loops in the namespace, * so turn off the 'x' bits to avoid trouble. */ - vap->va_mode &= ~((VEXEC)|(VEXEC>>3)|(VEXEC>>6)); + vap->va_mode &= ~(S_IXUSR|S_IXGRP|S_IXOTH); } break; diff --git a/sys/miscfs/procfs/procfs_subr.c b/sys/miscfs/procfs/procfs_subr.c index 85b8e2ac4c3..42f527a97d3 100644 --- a/sys/miscfs/procfs/procfs_subr.c +++ b/sys/miscfs/procfs/procfs_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_subr.c,v 1.6 1997/06/21 12:19:45 deraadt Exp $ */ +/* $OpenBSD: procfs_subr.c,v 1.7 1997/08/01 05:58:56 millert Exp $ */ /* $NetBSD: procfs_subr.c,v 1.15 1996/02/12 15:01:42 christos Exp $ */ /* @@ -47,6 +47,8 @@ #include <sys/proc.h> #include <sys/vnode.h> #include <sys/malloc.h> +#include <sys/stat.h> + #include <miscfs/procfs/procfs.h> static TAILQ_HEAD(, pfsnode) pfshead; @@ -134,46 +136,38 @@ loop: switch (pfs_type) { case Proot: /* /proc = dr-xr-xr-x */ - pfs->pfs_mode = (VREAD|VEXEC) | - (VREAD|VEXEC) >> 3 | - (VREAD|VEXEC) >> 6; + pfs->pfs_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; vp->v_type = VDIR; vp->v_flag = VROOT; break; case Pcurproc: /* /proc/curproc = lr--r--r-- */ - pfs->pfs_mode = (VREAD) | - (VREAD >> 3) | - (VREAD >> 6); + pfs->pfs_mode = S_IRUSR|S_IRGRP|S_IROTH; vp->v_type = VLNK; break; - case Pproc: - pfs->pfs_mode = (VREAD|VEXEC) | - (VREAD|VEXEC) >> 3 | - (VREAD|VEXEC) >> 6; + case Pproc: /* /proc/N = dr-xr-xr-x */ + pfs->pfs_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; vp->v_type = VDIR; break; - case Pfile: - case Pmem: - case Pregs: - case Pfpregs: - pfs->pfs_mode = (VREAD|VWRITE); + case Pfile: /* /proc/N/file = -rw------- */ + case Pmem: /* /proc/N/mem = -rw------- */ + case Pregs: /* /proc/N/regs = -rw------- */ + case Pfpregs: /* /proc/N/fpregs = -rw------- */ + pfs->pfs_mode = S_IRUSR|S_IWUSR; vp->v_type = VREG; break; - case Pctl: - case Pnote: - case Pnotepg: - pfs->pfs_mode = (VWRITE); + case Pctl: /* /proc/N/ctl = --w------ */ + case Pnote: /* /proc/N/note = --w------ */ + case Pnotepg: /* /proc/N/notepg = --w------ */ + pfs->pfs_mode = S_IWUSR; vp->v_type = VREG; break; - case Pstatus: - pfs->pfs_mode = (VREAD) | - (VREAD >> 3) | - (VREAD >> 6); + case Pstatus: /* /proc/N/status = -r--r--r-- */ + pfs->pfs_mode = S_IRUSR|S_IRGRP|S_IROTH; vp->v_type = VREG; break; diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c index 4cf80b45c1d..2d9d840aebe 100644 --- a/sys/miscfs/procfs/procfs_vnops.c +++ b/sys/miscfs/procfs/procfs_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_vnops.c,v 1.3 1996/04/21 22:28:19 deraadt Exp $ */ +/* $OpenBSD: procfs_vnops.c,v 1.4 1997/08/01 05:58:57 millert Exp $ */ /* $NetBSD: procfs_vnops.c,v 1.40 1996/03/16 23:52:55 christos Exp $ */ /* @@ -56,8 +56,12 @@ #include <sys/dirent.h> #include <sys/resourcevar.h> #include <sys/ptrace.h> +#include <sys/stat.h> + #include <vm/vm.h> /* for PAGE_SIZE */ + #include <machine/reg.h> + #include <miscfs/procfs/procfs.h> /* @@ -549,19 +553,18 @@ procfs_getattr(v) TIMEVAL_TO_TIMESPEC(&tv, &vap->va_ctime); vap->va_atime = vap->va_mtime = vap->va_ctime; - /* - * If the process has exercised some setuid or setgid - * privilege, then rip away read/write permission so - * that only root can gain access. - */ switch (pfs->pfs_type) { case Pmem: case Pregs: case Pfpregs: + /* + * If the process has exercised some setuid or setgid + * privilege, then rip away read/write permission so + * that only root can gain access. + */ if (procp->p_flag & P_SUGID) - vap->va_mode &= ~((VREAD|VWRITE)| - ((VREAD|VWRITE)>>3)| - ((VREAD|VWRITE)>>6)); + vap->va_mode &= ~(S_IRUSR|S_IWUSR); + /* FALLTHROUGH */ case Pctl: case Pstatus: case Pnote: diff --git a/sys/miscfs/union/union.h b/sys/miscfs/union/union.h index e7485705181..94052ea28be 100644 --- a/sys/miscfs/union/union.h +++ b/sys/miscfs/union/union.h @@ -1,4 +1,4 @@ -/* $OpenBSD: union.h,v 1.2 1996/02/27 08:08:59 niklas Exp $ */ +/* $OpenBSD: union.h,v 1.3 1997/08/01 05:58:57 millert Exp $ */ /* $NetBSD: union.h,v 1.9 1996/02/09 22:41:08 christos Exp $ */ /* @@ -63,10 +63,8 @@ struct union_mount { /* * DEFDIRMODE is the mode bits used to create a shadow directory. */ -#define VRWXMODE (VREAD|VWRITE|VEXEC) -#define VRWMODE (VREAD|VWRITE) -#define UN_DIRMODE ((VRWXMODE)|(VRWXMODE>>3)|(VRWXMODE>>6)) -#define UN_FILEMODE ((VRWMODE)|(VRWMODE>>3)|(VRWMODE>>6)) +#define UN_DIRMODE (S_IRWXU|S_IRWXG|S_IRWXO) +#define UN_FILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH) /* * A cache of vnode references diff --git a/sys/miscfs/union/union_vfsops.c b/sys/miscfs/union/union_vfsops.c index 654d6ba0acc..12873edf1cd 100644 --- a/sys/miscfs/union/union_vfsops.c +++ b/sys/miscfs/union/union_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: union_vfsops.c,v 1.2 1996/02/27 08:09:02 niklas Exp $ */ +/* $OpenBSD: union_vfsops.c,v 1.3 1997/08/01 05:58:58 millert Exp $ */ /* $NetBSD: union_vfsops.c,v 1.10 1995/06/18 14:47:47 cgd Exp $ */ /* @@ -55,6 +55,8 @@ #include <sys/malloc.h> #include <sys/filedesc.h> #include <sys/queue.h> +#include <sys/stat.h> + #include <miscfs/union/union.h> int union_mount __P((struct mount *, char *, caddr_t, struct nameidata *, |