diff options
author | bde <bde@FreeBSD.org> | 1995-05-09 16:30:45 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1995-05-09 16:30:45 +0000 |
commit | 5171ec5bb1284a22c6ff0dde4de2d65fa8e6fccb (patch) | |
tree | 588557f423315c2c48f7f598298f7e2d641c24b3 /sys/fs/msdosfs/msdosfs_lookup.c | |
parent | 0b1bcecfed64c266c15c293303655e7f8fc374b9 (diff) | |
download | FreeBSD-src-5171ec5bb1284a22c6ff0dde4de2d65fa8e6fccb.zip FreeBSD-src-5171ec5bb1284a22c6ff0dde4de2d65fa8e6fccb.tar.gz |
Submitted by: Mike Pritchard <pritc003@maroon.tc.umn.edu>
msdosfs_lookup() did no validation to see if the caller was validated
to delete/rename/create files. msdosfs_setattr() did no validation
to see if the caller was allowed to change the file permissions (turn
on/off the write bit) or update the file modification time (utimes).
The routines were fixed to validate the calls just like ufs does.
Diffstat (limited to 'sys/fs/msdosfs/msdosfs_lookup.c')
-rw-r--r-- | sys/fs/msdosfs/msdosfs_lookup.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/fs/msdosfs/msdosfs_lookup.c b/sys/fs/msdosfs/msdosfs_lookup.c index 2691842..5e9cbca 100644 --- a/sys/fs/msdosfs/msdosfs_lookup.c +++ b/sys/fs/msdosfs/msdosfs_lookup.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_lookup.c,v 1.1 1994/09/19 15:41:44 dfr Exp $ */ +/* $Id: msdosfs_lookup.c,v 1.2 1994/09/27 20:42:51 phk Exp $ */ /* $NetBSD: msdosfs_lookup.c,v 1.14 1994/08/21 18:44:07 ws Exp $ */ /*- @@ -109,6 +109,7 @@ msdosfs_lookup(ap) struct msdosfsmount *pmp; struct buf *bp = 0; struct direntry *dep = NULL; + struct ucred *cred = cnp->cn_cred; u_char dosfilename[12]; int flags = cnp->cn_flags; int nameiop = cnp->cn_nameiop; @@ -318,6 +319,9 @@ notfound:; #endif if ((nameiop == CREATE || nameiop == RENAME) && (flags & ISLASTCN) && dp->de_refcnt != 0) { + error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc); + if (error) + return error; if (slotstatus == NONE) { dp->de_fndoffset = (u_long)-1; dp->de_fndclust = (u_long)-1; @@ -363,6 +367,12 @@ foundroot:; * deget() the directory entry. */ if (nameiop == DELETE && (flags & ISLASTCN)) { + error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc); + if (error) { + if (bp) + brelse(bp); + return error; + } if (dp->de_StartCluster == scn && isadir) { /* "." */ VREF(vdp); *vpp = vdp; @@ -388,6 +398,12 @@ foundroot:; * If renaming. */ if (nameiop == RENAME && wantparent && (flags & ISLASTCN)) { + error = VOP_ACCESS(vdp, VWRITE, cred, cnp->cn_proc); + if (error) { + if (bp) + brelse(bp); + return error; + } if (dp->de_StartCluster == scn && isadir) { if (bp) brelse(bp); |