diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-09-06 20:31:32 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-09-06 20:31:32 +0000 |
commit | b224066e4d677e6eb97225a356f813c8f7fa5c81 (patch) | |
tree | 98580400edc57e129ed5e0e70d1c9bc225d9ef2d /sys/isofs/cd9660 | |
parent | 00893131b950300a9f191da6eb40843f50747233 (diff) |
If mount by non-root, then verify that user has necessary permissions on
the device. NetBSD (mycroft) made a similar change yesterday but there
are vfs differences. Thanks to Hubert Feyrer for bringing this to our
attention.
Diffstat (limited to 'sys/isofs/cd9660')
-rw-r--r-- | sys/isofs/cd9660/cd9660_vfsops.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index c71e5a47505..c647aa70370 100644 --- a/sys/isofs/cd9660/cd9660_vfsops.c +++ b/sys/isofs/cd9660/cd9660_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_vfsops.c,v 1.14 1998/08/21 23:31:35 csapuntz Exp $ */ +/* $OpenBSD: cd9660_vfsops.c,v 1.15 1998/09/06 20:31:31 millert Exp $ */ /* $NetBSD: cd9660_vfsops.c,v 1.26 1997/06/13 15:38:58 pk Exp $ */ /*- @@ -175,6 +175,19 @@ cd9660_mount(mp, path, data, ndp, p) vrele(devvp); return (ENXIO); } + /* + * If mount by non-root, then verify that user has necessary + * permissions on the device. + */ + if (p->p_ucred->cr_uid != 0) { + vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); + error = VOP_ACCESS(devvp, VREAD, p->p_ucred, p); + if (error) { + vput(devvp); + return (error); + } + VOP_UNLOCK(devvp, 0, p); + } if ((mp->mnt_flag & MNT_UPDATE) == 0) error = iso_mountfs(devvp, mp, p, &args); else { |