diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2000-06-07 23:25:09 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2000-06-07 23:25:09 +0000 |
commit | f55d48243d2493efd55b431f0ddbc27f6461473d (patch) | |
tree | 8f2f66a53f80e389eff155fc7ba4789613faa6b8 /sys | |
parent | b8d351fb1ce4b090ef475fcc64c6bf280365de96 (diff) |
Add cd9660_check_export() (from ufs_check_export() with trivial modifications).
Fixes the "NFS mounting of exported cd-rom causes panic" bug. Apparently
when the checkexp vfs support was added cd9660 was left out.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/isofs/cd9660/cd9660_extern.h | 8 | ||||
-rw-r--r-- | sys/isofs/cd9660/cd9660_vfsops.c | 31 |
2 files changed, 34 insertions, 5 deletions
diff --git a/sys/isofs/cd9660/cd9660_extern.h b/sys/isofs/cd9660/cd9660_extern.h index ff96ee67040..546e24e43e2 100644 --- a/sys/isofs/cd9660/cd9660_extern.h +++ b/sys/isofs/cd9660/cd9660_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660_extern.h,v 1.4 2000/02/07 04:57:15 assar Exp $ */ +/* $OpenBSD: cd9660_extern.h,v 1.5 2000/06/07 23:25:08 millert Exp $ */ /* $NetBSD: cd9660_extern.h,v 1.1 1997/01/24 00:24:53 cgd Exp $ */ /*- @@ -84,8 +84,8 @@ struct iso_mnt { #define lblkno(imp, loc) ((loc) >> (imp)->im_bshift) #define blksize(imp, ip, lbn) ((imp)->logical_block_size) -int cd9660_mount __P((struct mount *, - const char *, caddr_t, struct nameidata *, struct proc *)); +int cd9660_mount __P((struct mount *, const char *, caddr_t, + struct nameidata *, struct proc *)); int cd9660_start __P((struct mount *, int, struct proc *)); int cd9660_unmount __P((struct mount *, int, struct proc *)); int cd9660_root __P((struct mount *, struct vnode **)); @@ -96,6 +96,8 @@ int cd9660_vget __P((struct mount *, ino_t, struct vnode **)); int cd9660_fhtovp __P((struct mount *, struct fid *, struct vnode **)); int cd9660_vptofh __P((struct vnode *, struct fid *)); int cd9660_init __P((struct vfsconf *)); +int cd9660_check_export __P((struct mount *, struct mbuf *, int *, + struct ucred **)); #define cd9660_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ size_t, struct proc *)))eopnotsupp) diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index d2512ec82b6..ac08b189ca2 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.19 2000/02/07 04:57:15 assar Exp $ */ +/* $OpenBSD: cd9660_vfsops.c,v 1.20 2000/06/07 23:25:08 millert Exp $ */ /* $NetBSD: cd9660_vfsops.c,v 1.26 1997/06/13 15:38:58 pk Exp $ */ /*- @@ -77,7 +77,8 @@ struct vfsops cd9660_vfsops = { cd9660_fhtovp, cd9660_vptofh, cd9660_init, - cd9660_sysctl + cd9660_sysctl, + cd9660_check_export }; /* @@ -964,3 +965,29 @@ cd9660_vptofh(vp, fhp) #endif return (0); } + +/* + * Verify a remote client has export rights and return these rights via + * exflagsp and credanonp. + */ +int +cd9660_check_export(mp, nam, exflagsp, credanonp) + register struct mount *mp; + struct mbuf *nam; + int *exflagsp; + struct ucred **credanonp; +{ + register struct netcred *np; + register struct iso_mnt *imp = VFSTOISOFS(mp); + + /* + * Get the export permission structure for this <mp, client> tuple. + */ + np = vfs_export_lookup(mp, &imp->im_export, nam); + if (np == NULL) + return (EACCES); + + *exflagsp = np->netc_exflags; + *credanonp = &np->netc_anon; + return (0); +} |