diff options
author | assar <assar@cvs.openbsd.org> | 2000-02-07 04:57:20 +0000 |
---|---|---|
committer | assar <assar@cvs.openbsd.org> | 2000-02-07 04:57:20 +0000 |
commit | 6f7e6bffc9d5d686eb1bdf9b027266f64db28754 (patch) | |
tree | 1b456f9a4be5902545c6b6f0805e173ab4dc3195 /sys | |
parent | 3510e94919e26ce8c81fffcb220fc932c7d4aeb3 (diff) |
update to use new checkexp vfs operation
Diffstat (limited to 'sys')
31 files changed, 298 insertions, 228 deletions
diff --git a/sys/adosfs/advfsops.c b/sys/adosfs/advfsops.c index b5dcf3fbe24..097a1c1b3df 100644 --- a/sys/adosfs/advfsops.c +++ b/sys/adosfs/advfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: advfsops.c,v 1.15 1999/05/31 17:34:44 millert Exp $ */ +/* $OpenBSD: advfsops.c,v 1.16 2000/02/07 04:57:15 assar Exp $ */ /* $NetBSD: advfsops.c,v 1.24 1996/12/22 10:10:12 cgd Exp $ */ /* @@ -61,8 +61,8 @@ int adosfs_quotactl __P((struct mount *, int, uid_t, caddr_t, int adosfs_statfs __P((struct mount *, struct statfs *, struct proc *)); int adosfs_sync __P((struct mount *, int, struct ucred *, struct proc *)); int adosfs_vget __P((struct mount *, ino_t, struct vnode **)); -int adosfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, - struct vnode **, int *, struct ucred **)); +int adosfs_fhtovp __P((struct mount *, struct fid *, struct vnode **)); + int adosfs_vptofh __P((struct vnode *, struct fid *)); int adosfs_mountfs __P((struct vnode *, struct mount *, struct proc *)); @@ -659,13 +659,10 @@ struct ifid { }; int -adosfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) +adosfs_fhtovp(mp, fhp, vpp) struct mount *mp; struct fid *fhp; - struct mbuf *nam; struct vnode **vpp; - int *exflagsp; - struct ucred **credanonp; { struct ifid *ifhp = (struct ifid *)fhp; struct adosfsmount *amp = VFSTOADOSFS(mp); @@ -680,13 +677,6 @@ adosfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) printf("adfhtovp(%x, %x, %x)\n", mp, fhp, vpp); #endif - /* - * Get the export permission structure for this <mp, client> tuple. - */ - np = vfs_export_lookup(mp, &->export, nam); - if (np == NULL) - return (EACCES); - if ((error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) != 0) { *vpp = NULLVP; return (error); diff --git a/sys/isofs/cd9660/cd9660_extern.h b/sys/isofs/cd9660/cd9660_extern.h index ebca4414354..ff96ee67040 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.3 1999/07/01 02:20:20 d Exp $ */ +/* $OpenBSD: cd9660_extern.h,v 1.4 2000/02/07 04:57:15 assar Exp $ */ /* $NetBSD: cd9660_extern.h,v 1.1 1997/01/24 00:24:53 cgd Exp $ */ /*- @@ -93,8 +93,7 @@ int cd9660_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *)); int cd9660_statfs __P((struct mount *, struct statfs *, struct proc *)); int cd9660_sync __P((struct mount *, int, struct ucred *, struct proc *)); int cd9660_vget __P((struct mount *, ino_t, struct vnode **)); -int cd9660_fhtovp __P((struct mount *, struct fid *, struct mbuf *, - struct vnode **, int *, struct ucred **)); +int cd9660_fhtovp __P((struct mount *, struct fid *, struct vnode **)); int cd9660_vptofh __P((struct vnode *, struct fid *)); int cd9660_init __P((struct vfsconf *)); #define cd9660_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c index 1d93a38e72c..d2512ec82b6 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.18 1999/08/17 10:56:07 art Exp $ */ +/* $OpenBSD: cd9660_vfsops.c,v 1.19 2000/02/07 04:57:15 assar Exp $ */ /* $NetBSD: cd9660_vfsops.c,v 1.26 1997/06/13 15:38:58 pk Exp $ */ /*- @@ -670,18 +670,13 @@ struct ifid { /* ARGSUSED */ int -cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) +cd9660_fhtovp(mp, fhp, vpp) register struct mount *mp; struct fid *fhp; - struct mbuf *nam; struct vnode **vpp; - int *exflagsp; - struct ucred **credanonp; { struct ifid *ifhp = (struct ifid *)fhp; register struct iso_node *ip; - register struct netcred *np; - register struct iso_mnt *imp = VFSTOISOFS(mp); struct vnode *nvp; int error; @@ -690,13 +685,6 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) ifhp->ifid_start); #endif - /* - * Get the export permission structure for this <mp, client> tuple. - */ - np = vfs_export_lookup(mp, &imp->im_export, nam); - if (np == NULL) - return (EACCES); - if ((error = VFS_VGET(mp, ifhp->ifid_ino, &nvp)) != 0) { *vpp = NULLVP; return (error); @@ -708,8 +696,6 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) return (ESTALE); } *vpp = nvp; - *exflagsp = np->netc_exflags; - *credanonp = &np->netc_anon; return (0); } diff --git a/sys/miscfs/fdesc/fdesc_vfsops.c b/sys/miscfs/fdesc/fdesc_vfsops.c index 7a171afddee..a919fe2cb4a 100644 --- a/sys/miscfs/fdesc/fdesc_vfsops.c +++ b/sys/miscfs/fdesc/fdesc_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdesc_vfsops.c,v 1.7 1999/05/31 17:34:49 millert Exp $ */ +/* $OpenBSD: fdesc_vfsops.c,v 1.8 2000/02/07 04:57:16 assar Exp $ */ /* $NetBSD: fdesc_vfsops.c,v 1.21 1996/02/09 22:40:07 christos Exp $ */ /* @@ -68,8 +68,7 @@ int fdesc_quotactl __P((struct mount *, int, uid_t, caddr_t, int fdesc_statfs __P((struct mount *, struct statfs *, struct proc *)); int fdesc_sync __P((struct mount *, int, struct ucred *, struct proc *)); int fdesc_vget __P((struct mount *, ino_t, struct vnode **)); -int fdesc_fhtovp __P((struct mount *, struct fid *, struct mbuf *, - struct vnode **, int *, struct ucred **)); +int fdesc_fhtovp __P((struct mount *, struct fid *, struct vnode **)); int fdesc_vptofh __P((struct vnode *, struct fid *)); /* @@ -242,7 +241,7 @@ fdesc_sync(mp, waitfor, uc, p) } #define fdesc_fhtovp ((int (*) __P((struct mount *, struct fid *, \ - struct mbuf *, struct vnode **, int *, struct ucred **)))eopnotsupp) + struct vnode **)))eopnotsupp) #define fdesc_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \ struct proc *)))eopnotsupp) #define fdesc_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ @@ -251,6 +250,9 @@ fdesc_sync(mp, waitfor, uc, p) eopnotsupp) #define fdesc_vptofh ((int (*) __P((struct vnode *, struct fid *)))eopnotsupp) +#define fdesc_checkexp ((int (*) __P((struct mount *, struct mbuf *, \ + int *, struct ucred **)))eopnotsupp) + struct vfsops fdesc_vfsops = { fdesc_mount, fdesc_start, @@ -263,6 +265,6 @@ struct vfsops fdesc_vfsops = { fdesc_fhtovp, fdesc_vptofh, fdesc_init, - fdesc_sysctl + fdesc_sysctl, + fdesc_checkexp }; - diff --git a/sys/miscfs/kernfs/kernfs.h b/sys/miscfs/kernfs/kernfs.h index e75573e12d5..9b720db8aee 100644 --- a/sys/miscfs/kernfs/kernfs.h +++ b/sys/miscfs/kernfs/kernfs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: kernfs.h,v 1.7 1998/12/28 05:51:38 millert Exp $ */ +/* $OpenBSD: kernfs.h,v 1.8 2000/02/07 04:57:16 assar Exp $ */ /* $NetBSD: kernfs.h,v 1.10 1996/02/09 22:40:21 christos Exp $ */ /* @@ -78,7 +78,7 @@ struct kernfs_node { #define VTOKERN(vp) ((struct kernfs_node *)(vp)->v_data) #define kernfs_fhtovp ((int (*) __P((struct mount *, struct fid *, \ - struct mbuf *, struct vnode **, int *, struct ucred **)))eopnotsupp) + struct vnode **)))eopnotsupp) #define kernfs_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \ struct proc *)))eopnotsupp) #define kernfs_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ @@ -88,6 +88,8 @@ struct kernfs_node { #define kernfs_vptofh ((int (*) __P((struct vnode *, struct fid *)))eopnotsupp) #define kernfs_sync ((int (*) __P((struct mount *, int, struct ucred *, \ struct proc *)))nullop) +#define kernfs_checkexp ((int (*) __P((struct mount *, struct mbuf *, \ + int *, struct ucred **)))eopnotsupp) extern int (**kernfs_vnodeop_p) __P((void *)); extern struct vfsops kernfs_vfsops; diff --git a/sys/miscfs/kernfs/kernfs_vfsops.c b/sys/miscfs/kernfs/kernfs_vfsops.c index 87d26d9813f..6693d43f09b 100644 --- a/sys/miscfs/kernfs/kernfs_vfsops.c +++ b/sys/miscfs/kernfs/kernfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kernfs_vfsops.c,v 1.12 1999/05/31 17:34:49 millert Exp $ */ +/* $OpenBSD: kernfs_vfsops.c,v 1.13 2000/02/07 04:57:16 assar Exp $ */ /* $NetBSD: kernfs_vfsops.c,v 1.26 1996/04/22 01:42:27 christos Exp $ */ /* @@ -285,5 +285,6 @@ struct vfsops kernfs_vfsops = { kernfs_fhtovp, kernfs_vptofh, kernfs_init, - kernfs_sysctl + kernfs_sysctl, + kernfs_checkexp }; diff --git a/sys/miscfs/nullfs/null_vfsops.c b/sys/miscfs/nullfs/null_vfsops.c index f59d83c1d37..4c51b51a4b0 100644 --- a/sys/miscfs/nullfs/null_vfsops.c +++ b/sys/miscfs/nullfs/null_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: null_vfsops.c,v 1.10 1999/05/31 17:34:49 millert Exp $ */ +/* $OpenBSD: null_vfsops.c,v 1.11 2000/02/07 04:57:16 assar Exp $ */ /* $NetBSD: null_vfsops.c,v 1.11 1996/05/10 22:50:56 jtk Exp $ */ /* @@ -67,8 +67,7 @@ int nullfs_quotactl __P((struct mount *, int, uid_t, caddr_t, int nullfs_statfs __P((struct mount *, struct statfs *, struct proc *)); int nullfs_sync __P((struct mount *, int, struct ucred *, struct proc *)); int nullfs_vget __P((struct mount *, ino_t, struct vnode **)); -int nullfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, - struct vnode **, int *, struct ucred **)); +int nullfs_fhtovp __P((struct mount *, struct fid *, struct vnode **)); int nullfs_vptofh __P((struct vnode *, struct fid *)); /* * Mount null layer @@ -351,13 +350,10 @@ nullfs_vget(mp, ino, vpp) } int -nullfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp) +nullfs_fhtovp(mp, fidp, vpp) struct mount *mp; struct fid *fidp; - struct mbuf *nam; struct vnode **vpp; - int *exflagsp; - struct ucred**credanonp; { return (EOPNOTSUPP); @@ -375,6 +371,9 @@ nullfs_vptofh(vp, fhp) #define nullfs_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ size_t, struct proc *)))eopnotsupp) +#define nullfs_checkexp ((int (*) __P((struct mount *, struct mbuf *, \ + int *, struct ucred **)))eopnotsupp) + struct vfsops null_vfsops = { nullfs_mount, nullfs_start, @@ -387,5 +386,6 @@ struct vfsops null_vfsops = { nullfs_fhtovp, nullfs_vptofh, nullfs_init, - nullfs_sysctl + nullfs_sysctl, + nullfs_checkexp }; diff --git a/sys/miscfs/portal/portal_vfsops.c b/sys/miscfs/portal/portal_vfsops.c index b2eb51f50dd..2211aa0e903 100644 --- a/sys/miscfs/portal/portal_vfsops.c +++ b/sys/miscfs/portal/portal_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: portal_vfsops.c,v 1.7 1999/05/31 17:34:50 millert Exp $ */ +/* $OpenBSD: portal_vfsops.c,v 1.8 2000/02/07 04:57:16 assar Exp $ */ /* $NetBSD: portal_vfsops.c,v 1.14 1996/02/09 22:40:41 christos Exp $ */ /* @@ -247,7 +247,7 @@ portal_statfs(mp, sbp, p) struct proc *)))nullop) #define portal_fhtovp ((int (*) __P((struct mount *, struct fid *, \ - struct mbuf *, struct vnode **, int *, struct ucred **)))eopnotsupp) + struct vnode **)))eopnotsupp) #define portal_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \ struct proc *)))eopnotsupp) #define portal_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ @@ -255,6 +255,8 @@ portal_statfs(mp, sbp, p) #define portal_vget ((int (*) __P((struct mount *, ino_t, struct vnode **))) \ eopnotsupp) #define portal_vptofh ((int (*) __P((struct vnode *, struct fid *)))eopnotsupp) +#define portal_checkexp ((int (*) __P((struct mount *, struct mbuf *, \ + int *, struct ucred **)))eopnotsupp) struct vfsops portal_vfsops = { portal_mount, @@ -268,5 +270,6 @@ struct vfsops portal_vfsops = { portal_fhtovp, portal_vptofh, portal_init, - portal_sysctl + portal_sysctl, + portal_checkexp }; diff --git a/sys/miscfs/procfs/procfs_vfsops.c b/sys/miscfs/procfs/procfs_vfsops.c index 618007642f6..5e997b87abf 100644 --- a/sys/miscfs/procfs/procfs_vfsops.c +++ b/sys/miscfs/procfs/procfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: procfs_vfsops.c,v 1.10 1999/05/31 17:34:50 millert Exp $ */ +/* $OpenBSD: procfs_vfsops.c,v 1.11 2000/02/07 04:57:16 assar Exp $ */ /* $NetBSD: procfs_vfsops.c,v 1.25 1996/02/09 22:40:53 christos Exp $ */ /* @@ -184,7 +184,7 @@ procfs_statfs(mp, sbp, p) struct proc *)))nullop) #define procfs_fhtovp ((int (*) __P((struct mount *, struct fid *, \ - struct mbuf *, struct vnode **, int *, struct ucred **)))eopnotsupp) + struct vnode **)))eopnotsupp) #define procfs_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \ struct proc *)))eopnotsupp) #define procfs_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ @@ -192,6 +192,8 @@ procfs_statfs(mp, sbp, p) #define procfs_vget ((int (*) __P((struct mount *, ino_t, struct vnode **))) \ eopnotsupp) #define procfs_vptofh ((int (*) __P((struct vnode *, struct fid *)))eopnotsupp) +#define procfs_checkexp ((int (*) __P((struct mount *, struct mbuf *, \ + int *, struct ucred **)))eopnotsupp) struct vfsops procfs_vfsops = { procfs_mount, @@ -205,5 +207,6 @@ struct vfsops procfs_vfsops = { procfs_fhtovp, procfs_vptofh, procfs_init, - procfs_sysctl + procfs_sysctl, + procfs_checkexp }; diff --git a/sys/miscfs/umapfs/umap_vfsops.c b/sys/miscfs/umapfs/umap_vfsops.c index d2409287f88..bcbeed4a249 100644 --- a/sys/miscfs/umapfs/umap_vfsops.c +++ b/sys/miscfs/umapfs/umap_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: umap_vfsops.c,v 1.14 1999/05/31 17:34:50 millert Exp $ */ +/* $OpenBSD: umap_vfsops.c,v 1.15 2000/02/07 04:57:17 assar Exp $ */ /* $NetBSD: umap_vfsops.c,v 1.9 1996/02/09 22:41:05 christos Exp $ */ /* @@ -66,8 +66,7 @@ int umapfs_quotactl __P((struct mount *, int, uid_t, caddr_t, int umapfs_statfs __P((struct mount *, struct statfs *, struct proc *)); int umapfs_sync __P((struct mount *, int, struct ucred *, struct proc *)); int umapfs_vget __P((struct mount *, ino_t, struct vnode **)); -int umapfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, - struct vnode **, int *, struct ucred **)); +int umapfs_fhtovp __P((struct mount *, struct fid *, struct vnode **)); int umapfs_vptofh __P((struct vnode *, struct fid *)); /* @@ -391,15 +390,12 @@ umapfs_vget(mp, ino, vpp) } int -umapfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp) +umapfs_fhtovp(mp, fidp, vpp) struct mount *mp; struct fid *fidp; - struct mbuf *nam; struct vnode **vpp; - int *exflagsp; - struct ucred**credanonp; { - return VFS_FHTOVP(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, fidp, nam, vpp, exflagsp, credanonp); + return VFS_FHTOVP(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, fidp, vpp); } int @@ -412,7 +408,8 @@ umapfs_vptofh(vp, fhp) #define umapfs_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ size_t, struct proc *)))eopnotsupp) - +#define umapfs_checkexp ((int (*) __P((struct mount *, struct mbuf *, \ + int *, struct ucred **)))eopnotsupp) struct vfsops umap_vfsops = { umapfs_mount, @@ -426,5 +423,6 @@ struct vfsops umap_vfsops = { umapfs_fhtovp, umapfs_vptofh, umapfs_init, - umapfs_sysctl + umapfs_sysctl, + umapfs_checkexp }; diff --git a/sys/miscfs/union/union_vfsops.c b/sys/miscfs/union/union_vfsops.c index 3b0743343d8..fd155de5eb7 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.9 1999/05/31 17:34:50 millert Exp $ */ +/* $OpenBSD: union_vfsops.c,v 1.10 2000/02/07 04:57:17 assar Exp $ */ /* $NetBSD: union_vfsops.c,v 1.10 1995/06/18 14:47:47 cgd Exp $ */ /* @@ -480,7 +480,7 @@ union_statfs(mp, sbp, p) struct proc *)))nullop) #define union_fhtovp ((int (*) __P((struct mount *, struct fid *, \ - struct mbuf *, struct vnode **, int *, struct ucred **)))eopnotsupp) + struct vnode **)))eopnotsupp) #define union_quotactl ((int (*) __P((struct mount *, int, uid_t, caddr_t, \ struct proc *)))eopnotsupp) #define union_sysctl ((int (*) __P((int *, u_int, void *, size_t *, void *, \ @@ -488,6 +488,8 @@ union_statfs(mp, sbp, p) #define union_vget ((int (*) __P((struct mount *, ino_t, struct vnode **))) \ eopnotsupp) #define union_vptofh ((int (*) __P((struct vnode *, struct fid *)))eopnotsupp) +#define union_checkexp ((int (*) __P((struct mount *, struct mbuf *, \ + int *, struct ucred **)))eopnotsupp) struct vfsops union_vfsops = { union_mount, @@ -501,5 +503,6 @@ struct vfsops union_vfsops = { union_fhtovp, union_vptofh, union_init, - union_sysctl + union_sysctl, + union_checkexp }; diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c index fdc71dc7f12..efcf50c6c1b 100644 --- a/sys/msdosfs/msdosfs_vfsops.c +++ b/sys/msdosfs/msdosfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfs_vfsops.c,v 1.18 1999/05/31 17:34:51 millert Exp $ */ +/* $OpenBSD: msdosfs_vfsops.c,v 1.19 2000/02/07 04:57:17 assar Exp $ */ /* $NetBSD: msdosfs_vfsops.c,v 1.48 1997/10/18 02:54:57 briggs Exp $ */ /*- @@ -77,9 +77,10 @@ int msdosfs_unmount __P((struct mount *, int, struct proc *)); int msdosfs_root __P((struct mount *, struct vnode **)); int msdosfs_statfs __P((struct mount *, struct statfs *, struct proc *)); int msdosfs_sync __P((struct mount *, int, struct ucred *, struct proc *)); -int msdosfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, - struct vnode **, int *, struct ucred **)); +int msdosfs_fhtovp __P((struct mount *, struct fid *, struct vnode **)); int msdosfs_vptofh __P((struct vnode *, struct fid *)); +int msdosfs_check_export __P((struct mount *mp, struct mbuf *nam, + int *extflagsp, struct ucred **credanonp)); int msdosfs_mountfs __P((struct vnode *, struct mount *, struct proc *, struct msdosfs_args *)); @@ -776,31 +777,22 @@ loop: } int -msdosfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) +msdosfs_fhtovp(mp, fhp, vpp) struct mount *mp; struct fid *fhp; - struct mbuf *nam; struct vnode **vpp; - int *exflagsp; - struct ucred **credanonp; { struct msdosfsmount *pmp = VFSTOMSDOSFS(mp); struct defid *defhp = (struct defid *) fhp; struct denode *dep; - struct netcred *np; int error; - np = vfs_export_lookup(mp, &pmp->pm_export, nam); - if (np == NULL) - return (EACCES); error = deget(pmp, defhp->defid_dirclust, defhp->defid_dirofs, &dep); if (error) { *vpp = NULLVP; return (error); } *vpp = DETOV(dep); - *exflagsp = np->netc_exflags; - *credanonp = &np->netc_anon; return (0); } @@ -821,6 +813,28 @@ msdosfs_vptofh(vp, fhp) return (0); } +int +msdosfs_check_export(mp, nam, exflagsp, credanonp) + register struct mount *mp; + struct mbuf *nam; + int *exflagsp; + struct ucred **credanonp; +{ + register struct netcred *np; + register struct msdosfsmount *pmp = VFSTOMSDOSFS(mp); + + /* + * Get the export permission structure for this <mp, client> tuple. + */ + np = vfs_export_lookup(mp, &pmp->pm_export, nam); + if (np == NULL) + return (EACCES); + + *exflagsp = np->netc_exflags; + *credanonp = &np->netc_anon; + return (0); +} + #define msdosfs_vget ((int (*) __P((struct mount *, ino_t, struct vnode **))) \ eopnotsupp) @@ -842,5 +856,6 @@ struct vfsops msdosfs_vfsops = { msdosfs_fhtovp, msdosfs_vptofh, msdosfs_init, - msdosfs_sysctl + msdosfs_sysctl, + msdosfs_check_export }; diff --git a/sys/msdosfs/msdosfsmount.h b/sys/msdosfs/msdosfsmount.h index 949e972b199..c4fc6c08c3e 100644 --- a/sys/msdosfs/msdosfsmount.h +++ b/sys/msdosfs/msdosfsmount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: msdosfsmount.h,v 1.10 1998/02/08 22:41:44 tholo Exp $ */ +/* $OpenBSD: msdosfsmount.h,v 1.11 2000/02/07 04:57:17 assar Exp $ */ /* $NetBSD: msdosfsmount.h,v 1.16 1997/10/17 11:24:24 ws Exp $ */ /*- @@ -205,6 +205,6 @@ int msdosfs_root __P((struct mount *, struct vnode **)); int msdosfs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *)); int msdosfs_statfs __P((struct mount *, struct statfs *, struct proc *)); int msdosfs_sync __P((struct mount *, int, struct ucred *, struct proc *)); -int msdosfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **)); +int msdosfs_fhtovp __P((struct mount *, struct fid *, struct vnode **)); int msdosfs_vptofh __P((struct vnode *, struct fid *)); int msdosfs_init __P((struct vfsconf *)); diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c index f4c6a736892..2c54e7632a6 100644 --- a/sys/nfs/nfs_subs.c +++ b/sys/nfs/nfs_subs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_subs.c,v 1.27 1999/04/28 09:28:17 art Exp $ */ +/* $OpenBSD: nfs_subs.c,v 1.28 2000/02/07 04:57:17 assar Exp $ */ /* $NetBSD: nfs_subs.c,v 1.27.4.3 1996/07/08 20:34:24 jtc Exp $ */ /* @@ -1690,7 +1690,7 @@ nfsm_srvfattr(nfsd, vap, fp) /* * nfsrv_fhtovp() - convert a fh to a vnode ptr (optionally locked) * - look up fsid in mount list (if not found ret error) - * - get vp and export rights by calling VFS_FHTOVP() + * - get vp and export rights by calling VFS_FHTOVP() and VFS_CHECKEXP() * - if cred->cr_uid == 0 or MNT_EXPORTANON set it to credanon * - if not lockflag unlock it with VOP_UNLOCK() */ @@ -1717,7 +1717,10 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag) if (!mp) return (ESTALE); - error = VFS_FHTOVP(mp, &fhp->fh_fid, nam, vpp, &exflags, &credanon); + error = VFS_CHECKEXP(mp, nam, &exflags, &credanon); + if (error) + return (error); + error = VFS_FHTOVP(mp, &fhp->fh_fid, vpp); if (error) return (error); diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c index f2761453f5a..4b24082186e 100644 --- a/sys/nfs/nfs_vfsops.c +++ b/sys/nfs/nfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_vfsops.c,v 1.29 2000/01/06 03:35:37 smurph Exp $ */ +/* $OpenBSD: nfs_vfsops.c,v 1.30 2000/02/07 04:57:17 assar Exp $ */ /* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */ /* @@ -74,6 +74,9 @@ extern int nfs_ticks; int nfs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t, struct proc *)); +int nfs_checkexp + __P((struct mount *mp, struct mbuf *nam, + int *extflagsp, struct ucred **credanonp)); /* * nfs vfs operations. @@ -90,7 +93,8 @@ struct vfsops nfs_vfsops = { nfs_fhtovp, nfs_vptofh, nfs_vfs_init, - nfs_sysctl + nfs_sysctl, + nfs_checkexp }; extern u_int32_t nfs_procids[NFS_NPROCS]; @@ -967,13 +971,10 @@ nfs_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, */ /* ARGSUSED */ int -nfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) +nfs_fhtovp(mp, fhp, vpp) register struct mount *mp; struct fid *fhp; - struct mbuf *nam; struct vnode **vpp; - int *exflagsp; - struct ucred **credanonp; { return (EINVAL); @@ -1021,3 +1022,17 @@ nfs_quotactl(mp, cmd, uid, arg, p) return (EOPNOTSUPP); } + +/* + * check export permission, not supported + */ +/* ARGUSED */ +int +nfs_checkexp(mp, nam, exflagsp, credanonp) + register struct mount *mp; + struct mbuf *nam; + int *exflagsp; + struct ucred **credanonp; +{ + return (EOPNOTSUPP); +} diff --git a/sys/nfs/nfsmount.h b/sys/nfs/nfsmount.h index 3a76ef3123a..847aa753f1a 100644 --- a/sys/nfs/nfsmount.h +++ b/sys/nfs/nfsmount.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfsmount.h,v 1.6 1999/06/10 05:55:15 millert Exp $ */ +/* $OpenBSD: nfsmount.h,v 1.7 2000/02/07 04:57:17 assar Exp $ */ /* $NetBSD: nfsmount.h,v 1.10 1996/02/18 11:54:03 fvdl Exp $ */ /* @@ -116,8 +116,7 @@ int nfs_statfs __P((struct mount *mp, struct statfs *sbp, struct proc *p)); int nfs_sync __P((struct mount *mp, int waitfor, struct ucred *cred, struct proc *p)); int nfs_vget __P((struct mount *, ino_t, struct vnode **)); -int nfs_fhtovp __P((struct mount *mp, struct fid *fhp, struct mbuf *nam, - struct vnode **vpp, int *exflagsp, struct ucred **credanonp)); +int nfs_fhtovp __P((struct mount *mp, struct fid *fhp, struct vnode **vpp)); int nfs_vptofh __P((struct vnode *vp, struct fid *fhp)); int nfs_fsinfo __P((struct nfsmount *, struct vnode *, struct ucred *, struct proc *)); diff --git a/sys/sys/syscall.h b/sys/sys/syscall.h index d4ba38b65bf..1c9ca181206 100644 --- a/sys/sys/syscall.h +++ b/sys/sys/syscall.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscall.h,v 1.40 1999/08/08 00:32:21 niklas Exp $ */ +/* $OpenBSD: syscall.h,v 1.41 2000/02/07 04:57:18 assar Exp $ */ /* * System call numbers. @@ -614,4 +614,13 @@ /* syscall: "pipe" ret: "int" args: "int *" */ #define SYS_pipe 263 -#define SYS_MAXSYSCALL 264 +/* syscall: "fhopen" ret: "int" args: "const fhandle_t *" "int" */ +#define SYS_fhopen 264 + +/* syscall: "fhstat" ret: "int" args: "const fhandle_t *" "struct stat *" */ +#define SYS_fhstat 265 + +/* syscall: "fhstatfs" ret: "int" args: "const fhandle_t *" "struct statfs *" */ +#define SYS_fhstatfs 266 + +#define SYS_MAXSYSCALL 267 diff --git a/sys/sys/syscallargs.h b/sys/sys/syscallargs.h index bd53a39458d..a22da2f4cf8 100644 --- a/sys/sys/syscallargs.h +++ b/sys/sys/syscallargs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: syscallargs.h,v 1.41 1999/08/08 00:32:22 niklas Exp $ */ +/* $OpenBSD: syscallargs.h,v 1.42 2000/02/07 04:57:18 assar Exp $ */ /* * System call argument lists. @@ -1064,6 +1064,21 @@ struct sys_pipe_args { syscallarg(int *) fdp; }; +struct sys_fhopen_args { + syscallarg(const fhandle_t *) fhp; + syscallarg(int) flags; +}; + +struct sys_fhstat_args { + syscallarg(const fhandle_t *) fhp; + syscallarg(struct stat *) sb; +}; + +struct sys_fhstatfs_args { + syscallarg(const fhandle_t *) fhp; + syscallarg(struct statfs *) buf; +}; + /* * System call prototypes. */ @@ -1221,10 +1236,7 @@ int sys_nfssvc __P((struct proc *, void *, register_t *)); int compat_43_sys_getdirentries __P((struct proc *, void *, register_t *)); int sys_ostatfs __P((struct proc *, void *, register_t *)); int sys_ofstatfs __P((struct proc *, void *, register_t *)); -#if defined(NFSCLIENT) || defined(NFSSERVER) int sys_getfh __P((struct proc *, void *, register_t *)); -#else -#endif int compat_09_sys_getdomainname __P((struct proc *, void *, register_t *)); int compat_09_sys_setdomainname __P((struct proc *, void *, register_t *)); int compat_09_sys_uname __P((struct proc *, void *, register_t *)); @@ -1337,3 +1349,6 @@ int sys_getfsstat __P((struct proc *, void *, register_t *)); int sys_statfs __P((struct proc *, void *, register_t *)); int sys_fstatfs __P((struct proc *, void *, register_t *)); int sys_pipe __P((struct proc *, void *, register_t *)); +int sys_fhopen __P((struct proc *, void *, register_t *)); +int sys_fhstat __P((struct proc *, void *, register_t *)); +int sys_fhstatfs __P((struct proc *, void *, register_t *)); diff --git a/sys/ufs/ext2fs/ext2fs_extern.h b/sys/ufs/ext2fs/ext2fs_extern.h index 2d56d80ceb0..7310611b52b 100644 --- a/sys/ufs/ext2fs/ext2fs_extern.h +++ b/sys/ufs/ext2fs/ext2fs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_extern.h,v 1.5 1998/02/08 22:41:48 tholo Exp $ */ +/* $OpenBSD: ext2fs_extern.h,v 1.6 2000/02/07 04:57:18 assar Exp $ */ /* $NetBSD: ext2fs_extern.h,v 1.1 1997/06/11 09:33:55 bouyer Exp $ */ /*- @@ -110,11 +110,12 @@ int ext2fs_flushfiles __P((struct mount *, int, struct proc *)); int ext2fs_statfs __P((struct mount *, struct statfs *, struct proc *)); int ext2fs_sync __P((struct mount *, int, struct ucred *, struct proc *)); int ext2fs_vget __P((struct mount *, ino_t, struct vnode **)); -int ext2fs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, - struct vnode **, int *, struct ucred **)); +int ext2fs_fhtovp __P((struct mount *, struct fid *, struct vnode **)); int ext2fs_vptofh __P((struct vnode *, struct fid *)); int ext2fs_sbupdate __P((struct ufsmount *, int)); int ext2fs_cgupdate __P((struct ufsmount *, int)); +int ext2fs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t, + struct proc *)); /* ext2fs_readwrite.c */ int ext2fs_read __P((void *)); diff --git a/sys/ufs/ext2fs/ext2fs_vfsops.c b/sys/ufs/ext2fs/ext2fs_vfsops.c index 0f3c9ec8484..2b6ba93d951 100644 --- a/sys/ufs/ext2fs/ext2fs_vfsops.c +++ b/sys/ufs/ext2fs/ext2fs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ext2fs_vfsops.c,v 1.10 1999/05/31 17:34:53 millert Exp $ */ +/* $OpenBSD: ext2fs_vfsops.c,v 1.11 2000/02/07 04:57:18 assar Exp $ */ /* $NetBSD: ext2fs_vfsops.c,v 1.1 1997/06/11 09:34:07 bouyer Exp $ */ /* @@ -67,8 +67,6 @@ #include <ufs/ext2fs/ext2fs_extern.h> int ext2fs_sbupdate __P((struct ufsmount *, int)); -int ext2fs_check_export __P((struct mount *, struct ufid *, struct mbuf *, - struct vnode **, int *, struct ucred **)); struct vfsops ext2fs_vfsops = { ext2fs_mount, @@ -82,58 +80,13 @@ struct vfsops ext2fs_vfsops = { ext2fs_fhtovp, ext2fs_vptofh, ext2fs_init, + ext2fs_sysctl, + ufs_check_export }; extern u_long ext2gennumber; /* - * This is the generic part of fhtovp called after the underlying - * filesystem has validated the file handle. - * - * Verify that a host should have access to a filesystem, and if so - * return a vnode for the presented file handle. - */ -int -ext2fs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp) - register struct mount *mp; - struct ufid *ufhp; - struct mbuf *nam; - struct vnode **vpp; - int *exflagsp; - struct ucred **credanonp; -{ - register struct inode *ip; - register struct netcred *np; - register struct ufsmount *ump = VFSTOUFS(mp); - struct vnode *nvp; - int error; - - /* - * Get the export permission structure for this <mp, client> tuple. - */ - np = vfs_export_lookup(mp, &ump->um_export, nam); - if (np == NULL) - return (EACCES); - - if ((error = VFS_VGET(mp, ufhp->ufid_ino, &nvp)) != 0) { - *vpp = NULLVP; - return (error); - } - ip = VTOI(nvp); - if (ip->i_e2fs_mode == 0 || ip->i_e2fs_dtime != 0 || - ip->i_e2fs_gen != ufhp->ufid_gen) { - vput(nvp); - *vpp = NULLVP; - return (ESTALE); - } - *vpp = nvp; - *exflagsp = np->netc_exflags; - *credanonp = &np->netc_anon; - return (0); -} - - -/* * Called by main() when ext2fs is going to be mounted as root. * * Name is updated by mount(8) after booting. @@ -947,14 +900,14 @@ ext2fs_vget(mp, ino, vpp) * those rights via. exflagsp and credanonp */ int -ext2fs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) +ext2fs_fhtovp(mp, fhp, vpp) register struct mount *mp; struct fid *fhp; - struct mbuf *nam; struct vnode **vpp; - int *exflagsp; - struct ucred **credanonp; { + register struct inode *ip; + struct vnode *nvp; + int error; register struct ufid *ufhp; struct m_ext2fs *fs; @@ -963,7 +916,20 @@ ext2fs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) if ((ufhp->ufid_ino < EXT2_FIRSTINO && ufhp->ufid_ino != EXT2_ROOTINO) || ufhp->ufid_ino >= fs->e2fs_ncg * fs->e2fs.e2fs_ipg) return (ESTALE); - return (ext2fs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp)); + + if ((error = VFS_VGET(mp, ufhp->ufid_ino, &nvp)) != 0) { + *vpp = NULLVP; + return (error); + } + ip = VTOI(nvp); + if (ip->i_e2fs_mode == 0 || ip->i_e2fs_dtime != 0 || + ip->i_e2fs_gen != ufhp->ufid_gen) { + vput(nvp); + *vpp = NULLVP; + return (ESTALE); + } + *vpp = nvp; + return (0); } /* @@ -987,6 +953,23 @@ ext2fs_vptofh(vp, fhp) } /* + * no sysctl for ext2fs + */ + +int +ext2fs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) + int *name; + u_int namelen; + void *oldp; + size_t *oldlenp; + void *newp; + size_t newlen; + struct proc *p; +{ + return (EOPNOTSUPP); +} + +/* * Write a superblock and associated information back to disk. */ int diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index a9fdfd5846d..eaac2f7c0ab 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_extern.h,v 1.8 1999/12/05 08:30:38 art Exp $ */ +/* $OpenBSD: ffs_extern.h,v 1.9 2000/02/07 04:57:18 assar Exp $ */ /* $NetBSD: ffs_extern.h,v 1.4 1996/02/09 22:22:22 christos Exp $ */ /*- @@ -115,8 +115,7 @@ int ffs_flushfiles __P((struct mount *, int, struct proc *)); int ffs_statfs __P((struct mount *, struct statfs *, struct proc *)); int ffs_sync __P((struct mount *, int, struct ucred *, struct proc *)); int ffs_vget __P((struct mount *, ino_t, struct vnode **)); -int ffs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, - struct vnode **, int *, struct ucred **)); +int ffs_fhtovp __P((struct mount *, struct fid *, struct vnode **)); int ffs_vptofh __P((struct vnode *, struct fid *)); int ffs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t, struct proc *)); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index a64f13c6856..59c93f6e4c2 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ffs_vfsops.c,v 1.27 2000/01/14 19:17:56 art Exp $ */ +/* $OpenBSD: ffs_vfsops.c,v 1.28 2000/02/07 04:57:18 assar Exp $ */ /* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */ /* @@ -80,7 +80,8 @@ struct vfsops ffs_vfsops = { ffs_fhtovp, ffs_vptofh, ffs_init, - ffs_sysctl + ffs_sysctl, + ufs_check_export }; extern u_long nextgennumber; @@ -1083,17 +1084,12 @@ retry: * - check that the inode number is valid * - call ffs_vget() to get the locked inode * - check for an unallocated inode (i_mode == 0) - * - check that the given client host has export rights and return - * those rights via. exflagsp and credanonp */ int -ffs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) +ffs_fhtovp(mp, fhp, vpp) register struct mount *mp; struct fid *fhp; - struct mbuf *nam; struct vnode **vpp; - int *exflagsp; - struct ucred **credanonp; { register struct ufid *ufhp; struct fs *fs; @@ -1103,7 +1099,7 @@ ffs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) if (ufhp->ufid_ino < ROOTINO || ufhp->ufid_ino >= fs->fs_ncg * fs->fs_ipg) return (ESTALE); - return (ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp)); + return (ufs_fhtovp(mp, ufhp, vpp)); } /* diff --git a/sys/ufs/lfs/lfs_extern.h b/sys/ufs/lfs/lfs_extern.h index 2c03f07c3eb..91ccf8dfe8a 100644 --- a/sys/ufs/lfs/lfs_extern.h +++ b/sys/ufs/lfs/lfs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lfs_extern.h,v 1.4 1998/02/08 22:41:51 tholo Exp $ */ +/* $OpenBSD: lfs_extern.h,v 1.5 2000/02/07 04:57:18 assar Exp $ */ /* $NetBSD: lfs_extern.h,v 1.5 1996/02/12 15:20:12 christos Exp $ */ /*- @@ -119,9 +119,10 @@ int lfs_unmount __P((struct mount *, int, struct proc *)); int lfs_statfs __P((struct mount *, struct statfs *, struct proc *)); int lfs_sync __P((struct mount *, int, struct ucred *, struct proc *)); int lfs_vget __P((struct mount *, ino_t, struct vnode **)); -int lfs_fhtovp __P((struct mount *, struct fid *, struct mbuf *, struct vnode **, int *, struct ucred **)); +int lfs_fhtovp __P((struct mount *, struct fid *, struct vnode **)); int lfs_vptofh __P((struct vnode *, struct fid *)); - +int lfs_sysctl __P((int *, u_int, void *, size_t *, void *, size_t, + struct proc *)); int lfs_valloc __P((void *)); int lfs_vfree __P((void *)); diff --git a/sys/ufs/lfs/lfs_vfsops.c b/sys/ufs/lfs/lfs_vfsops.c index e7b0a450204..148b9cb9502 100644 --- a/sys/ufs/lfs/lfs_vfsops.c +++ b/sys/ufs/lfs/lfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lfs_vfsops.c,v 1.11 1999/05/31 17:34:55 millert Exp $ */ +/* $OpenBSD: lfs_vfsops.c,v 1.12 2000/02/07 04:57:18 assar Exp $ */ /* $NetBSD: lfs_vfsops.c,v 1.11 1996/03/25 12:53:35 pk Exp $ */ /* @@ -76,6 +76,8 @@ struct vfsops lfs_vfsops = { lfs_fhtovp, lfs_vptofh, lfs_init, + lfs_sysctl, + ufs_check_export }; int @@ -567,8 +569,6 @@ lfs_vget(mp, ino, vpp) * - check that the inode number is valid * - call lfs_vget() to get the locked inode * - check for an unallocated inode (i_mode == 0) - * - check that the given client host has export rights and return - * those rights via. exflagsp and credanonp * * XXX * use ifile to see if inode is allocated instead of reading off disk @@ -576,20 +576,17 @@ lfs_vget(mp, ino, vpp) * generational number. */ int -lfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) +lfs_fhtovp(mp, fhp, vpp) register struct mount *mp; struct fid *fhp; - struct mbuf *nam; struct vnode **vpp; - int *exflagsp; - struct ucred **credanonp; { register struct ufid *ufhp; ufhp = (struct ufid *)fhp; if (ufhp->ufid_ino < ROOTINO) return (ESTALE); - return (ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp)); + return (ufs_fhtovp(mp, ufhp, nam, vpp, exflagsp, credanonp)); } /* @@ -620,3 +617,20 @@ lfs_init() { ufs_init(); } + +/* + * no sysctl for lfs + */ + +int +lfs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) + int *name; + u_int namelen; + void *oldp; + size_t *oldlenp; + void *newp; + size_t newlen; + struct proc *p; +{ + return (EOPNOTSUPP); +} diff --git a/sys/ufs/mfs/mfs_extern.h b/sys/ufs/mfs/mfs_extern.h index 6adbf5a77f8..071779b2be7 100644 --- a/sys/ufs/mfs/mfs_extern.h +++ b/sys/ufs/mfs/mfs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mfs_extern.h,v 1.7 1998/08/06 19:35:09 csapuntz Exp $ */ +/* $OpenBSD: mfs_extern.h,v 1.8 2000/02/07 04:57:18 assar Exp $ */ /* $NetBSD: mfs_extern.h,v 1.4 1996/02/09 22:31:27 christos Exp $ */ /*- @@ -44,6 +44,7 @@ struct statfs; struct ucred; struct vnode; struct vfsconf; +struct mbuf; __BEGIN_DECLS /* mfs_vfsops.c */ @@ -55,6 +56,8 @@ int mfs_start __P((struct mount *, int, struct proc *)); int mfs_statfs __P((struct mount *, struct statfs *, struct proc *)); int mfs_init __P((struct vfsconf *)); +int mfs_checkexp __P((struct mount *mp, struct mbuf *nam, + int *extflagsp, struct ucred **credanonp)); /* mfs_vnops.c */ int mfs_open __P((void *)); diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c index 9f784417eb0..2be4916d8f3 100644 --- a/sys/ufs/mfs/mfs_vfsops.c +++ b/sys/ufs/mfs/mfs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfs_vfsops.c,v 1.11 1999/12/06 07:28:06 art Exp $ */ +/* $OpenBSD: mfs_vfsops.c,v 1.12 2000/02/07 04:57:18 assar Exp $ */ /* $NetBSD: mfs_vfsops.c,v 1.10 1996/02/09 22:31:28 christos Exp $ */ /* @@ -81,7 +81,8 @@ struct vfsops mfs_vfsops = { ffs_fhtovp, ffs_vptofh, mfs_init, - ffs_sysctl + ffs_sysctl, + mfs_checkexp }; /* @@ -299,3 +300,17 @@ mfs_statfs(mp, sbp, p) &sbp->mount_info.mfs_args, sizeof(struct mfs_args)); return (error); } + +/* + * check export permission, not supported + */ +/* ARGUSED */ +int +mfs_checkexp(mp, nam, exflagsp, credanonp) + register struct mount *mp; + struct mbuf *nam; + int *exflagsp; + struct ucred **credanonp; +{ + return (EOPNOTSUPP); +} diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h index ee97c01a7c8..66d5cac00c2 100644 --- a/sys/ufs/ufs/ufs_extern.h +++ b/sys/ufs/ufs/ufs_extern.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_extern.h,v 1.8 1998/08/06 19:35:13 csapuntz Exp $ */ +/* $OpenBSD: ufs_extern.h,v 1.9 2000/02/07 04:57:19 assar Exp $ */ /* $NetBSD: ufs_extern.h,v 1.5 1996/02/09 22:36:03 christos Exp $ */ /*- @@ -158,8 +158,9 @@ void dqflush __P((struct vnode *)); int ufs_start __P((struct mount *, int, struct proc *)); int ufs_root __P((struct mount *, struct vnode **)); int ufs_quotactl __P((struct mount *, int, uid_t, caddr_t, struct proc *)); -int ufs_check_export __P((struct mount *, struct ufid *, struct mbuf *, - struct vnode **, int *, struct ucred **)); +int ufs_fhtovp __P((struct mount *, struct ufid *, struct vnode **)); +int ufs_check_export __P((struct mount *, struct mbuf *, int *, + struct ucred **)); /* ufs_vnops.c */ int ufs_vinit __P((struct mount *, int (**) __P((void *)), diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c index 979987734a6..26e977735ad 100644 --- a/sys/ufs/ufs/ufs_vfsops.c +++ b/sys/ufs/ufs/ufs_vfsops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs_vfsops.c,v 1.6 1997/11/06 05:59:28 csapuntz Exp $ */ +/* $OpenBSD: ufs_vfsops.c,v 1.7 2000/02/07 04:57:19 assar Exp $ */ /* $NetBSD: ufs_vfsops.c,v 1.4 1996/02/09 22:36:12 christos Exp $ */ /* @@ -167,6 +167,32 @@ ufs_quotactl(mp, cmds, uid, arg, p) /* + * Verify a remote client has export rights and return these rights via. + * exflagsp and credanonp. + */ +int +ufs_check_export(mp, nam, exflagsp, credanonp) + register struct mount *mp; + struct mbuf *nam; + int *exflagsp; + struct ucred **credanonp; +{ + register struct netcred *np; + register struct ufsmount *ump = VFSTOUFS(mp); + + /* + * Get the export permission structure for this <mp, client> tuple. + */ + np = vfs_export_lookup(mp, &ump->um_export, nam); + if (np == NULL) + return (EACCES); + + *exflagsp = np->netc_exflags; + *credanonp = &np->netc_anon; + return (0); +} + +/* * Initial UFS filesystems, done only once. */ int @@ -188,32 +214,17 @@ ufs_init(vfsp) /* * This is the generic part of fhtovp called after the underlying * filesystem has validated the file handle. - * - * Verify that a host should have access to a filesystem, and if so - * return a vnode for the presented file handle. */ int -ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp) +ufs_fhtovp(mp, ufhp, vpp) register struct mount *mp; struct ufid *ufhp; - struct mbuf *nam; struct vnode **vpp; - int *exflagsp; - struct ucred **credanonp; { register struct inode *ip; - register struct netcred *np; - register struct ufsmount *ump = VFSTOUFS(mp); struct vnode *nvp; int error; - /* - * Get the export permission structure for this <mp, client> tuple. - */ - np = vfs_export_lookup(mp, &ump->um_export, nam); - if (np == NULL) - return (EACCES); - if ((error = VFS_VGET(mp, ufhp->ufid_ino, &nvp)) != 0) { *vpp = NULLVP; return (error); @@ -225,7 +236,5 @@ ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp) return (ESTALE); } *vpp = nvp; - *exflagsp = np->netc_exflags; - *credanonp = &np->netc_anon; return (0); } diff --git a/sys/xfs/xfs_vfsops-bsd.c b/sys/xfs/xfs_vfsops-bsd.c index 9724ff57ee4..745eea9d4c2 100644 --- a/sys/xfs/xfs_vfsops-bsd.c +++ b/sys/xfs/xfs_vfsops-bsd.c @@ -38,7 +38,7 @@ #include <xfs/xfs_locl.h> -RCSID("$Id: xfs_vfsops-bsd.c,v 1.2 2000/02/01 04:12:19 assar Exp $"); +RCSID("$Id: xfs_vfsops-bsd.c,v 1.3 2000/02/07 04:57:19 assar Exp $"); /* * XFS vfs operations. @@ -126,10 +126,7 @@ xfs_vget(struct mount * mp, int xfs_fhtovp(struct mount * mp, struct fid * fhp, - struct mbuf * nam, - struct vnode ** vpp, - int *exflagsp, - struct ucred ** credanonp) + struct vnode ** vpp) { #ifdef ARLA_KNFS static struct ucred fhtovpcred; @@ -187,12 +184,6 @@ xfs_fhtovp(struct mount * mp, fhtovpcred.cr_ngroups = 0; *vpp = vp; -#ifdef MNT_EXPUBLIC - *exflagsp = MNT_EXPUBLIC; -#else - *exflagsp = 0; -#endif - *credanonp = &fhtovpcred; XFSDEB(XDEBVFOPS, ("xfs_fhtovp done\n")); diff --git a/sys/xfs/xfs_vfsops-bsd.h b/sys/xfs/xfs_vfsops-bsd.h index 5cb767f8eb0..e2582d34364 100644 --- a/sys/xfs/xfs_vfsops-bsd.h +++ b/sys/xfs/xfs_vfsops-bsd.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. */ -/* $Id: xfs_vfsops-bsd.h,v 1.1 1999/04/30 01:59:01 art Exp $ */ +/* $Id: xfs_vfsops-bsd.h,v 1.2 2000/02/07 04:57:19 assar Exp $ */ #ifndef _xfs_vfsops_bsd_h #define _xfs_vfsops_bsd_h @@ -74,10 +74,7 @@ xfs_vget(struct mount * mp, int xfs_fhtovp(struct mount * mp, struct fid * fhp, - struct mbuf * nam, - struct vnode ** vpp, - int *exflagsp, - struct ucred ** credanonp); + struct vnode ** vpp); int xfs_vptofh(struct vnode * vp, diff --git a/sys/xfs/xfs_vfsops-openbsd.c b/sys/xfs/xfs_vfsops-openbsd.c index c4c8f770bbe..8c4ddc58e28 100644 --- a/sys/xfs/xfs_vfsops-openbsd.c +++ b/sys/xfs/xfs_vfsops-openbsd.c @@ -38,7 +38,7 @@ #include <xfs/xfs_locl.h> -RCSID("$Id: xfs_vfsops-openbsd.c,v 1.1 1999/04/30 01:59:01 art Exp $"); +RCSID("$Id: xfs_vfsops-openbsd.c,v 1.2 2000/02/07 04:57:19 assar Exp $"); #include <xfs/xfs_common.h> #include <xfs/xfs_message.h> @@ -81,6 +81,22 @@ xfs_init(struct vfsconf *vfs) return 0; } +static int +xfs_sysctl (int *name, u_int namelen, void *oldp, size_t *oldlenp, + void *newp, size_t newlen, struct proc *p) +{ + XFSDEB(XDEBVFOPS, ("xfs_sysctl\n")); + return EOPNOTSUPP; +} + +static int +xfs_checkexp(struct mount *mp, struct mbuf *nam, int *exflagsp, + struct ucred **credanonp) +{ + XFSDEB(XDEBVFOPS, ("xfs_checkexp\n")); + return (EOPNOTSUPP); +} + struct vfsops xfs_vfsops = { xfs_mount, xfs_start, @@ -93,7 +109,8 @@ struct vfsops xfs_vfsops = { xfs_fhtovp, xfs_vptofh, xfs_init, - NULL, + xfs_sysctl, + xfs_checkexp }; static struct vfsconf xfs_vfc = { |