diff options
author | alfred <alfred@FreeBSD.org> | 1999-09-11 00:46:08 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 1999-09-11 00:46:08 +0000 |
commit | b9136a6115cbac97ab114f16b1aacf4eb20ad2c1 (patch) | |
tree | 783daf81f8570ef14570d4a5a6fc45f15ec1cbf5 /sys/fs | |
parent | a9f7b5ee698afe56d1167bfa395f23b1fff1730c (diff) | |
download | FreeBSD-src-b9136a6115cbac97ab114f16b1aacf4eb20ad2c1.zip FreeBSD-src-b9136a6115cbac97ab114f16b1aacf4eb20ad2c1.tar.gz |
Seperate the export check in VFS_FHTOVP, exports are now checked via
VFS_CHECKEXP.
Add fh(open|stat|stafs) syscalls to allow userland to query filesystems
based on (network) filehandle.
Obtained from: NetBSD
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/cd9660/cd9660_vfsops.c | 42 | ||||
-rw-r--r-- | sys/fs/coda/coda_vfsops.c | 1 | ||||
-rw-r--r-- | sys/fs/fdescfs/fdesc_vfsops.c | 1 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vfsops.c | 31 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_vfsops.c | 8 | ||||
-rw-r--r-- | sys/fs/nullfs/null_vfsops.c | 26 | ||||
-rw-r--r-- | sys/fs/portalfs/portal_vfsops.c | 1 | ||||
-rw-r--r-- | sys/fs/procfs/procfs_vfsops.c | 1 | ||||
-rw-r--r-- | sys/fs/umapfs/umap_vfsops.c | 23 | ||||
-rw-r--r-- | sys/fs/unionfs/union_vfsops.c | 3 |
10 files changed, 94 insertions, 43 deletions
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index f81cb14..050e99e 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/cd9660/cd9660_vfsops.c @@ -68,8 +68,9 @@ static int cd9660_unmount __P((struct mount *, int, struct proc *)); static int cd9660_root __P((struct mount *, struct vnode **)); static int cd9660_statfs __P((struct mount *, struct statfs *, struct proc *)); static int cd9660_vget __P((struct mount *, ino_t, struct vnode **)); -static int cd9660_fhtovp __P((struct mount *, struct fid *, struct sockaddr *, - struct vnode **, int *, struct ucred **)); +static int cd9660_fhtovp __P((struct mount *, struct fid *, struct vnode **)); +static int cd9660_checkexp __P((struct mount *, struct sockaddr *, + int *, struct ucred **)); static int cd9660_vptofh __P((struct vnode *, struct fid *)); static struct vfsops cd9660_vfsops = { @@ -82,6 +83,7 @@ static struct vfsops cd9660_vfsops = { vfs_stdsync, cd9660_vget, cd9660_fhtovp, + cd9660_checkexp, cd9660_vptofh, cd9660_init, }; @@ -620,18 +622,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 sockaddr *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; @@ -640,13 +637,6 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) ifhp->ifid_ino, 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); @@ -658,6 +648,28 @@ cd9660_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) return (ESTALE); } *vpp = nvp; + return (0); +} + +int +cd9660_checkexp(mp, nam, exflagsp, credanonp) + struct mount *mp; + struct sockaddr *nam; + int *exflagsp; + struct ucred **credanonp; +{ + register struct netcred *np; + register struct iso_mnt *imp; + + 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); diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c index 489ce06..22808ed 100644 --- a/sys/fs/coda/coda_vfsops.c +++ b/sys/fs/coda/coda_vfsops.c @@ -530,6 +530,7 @@ struct vfsops coda_vfsops = { coda_sync, vfs_stdvget, vfs_stdfhtovp, + vfs_stdcheckexp, vfs_stdvptofh, vfs_stdinit }; diff --git a/sys/fs/fdescfs/fdesc_vfsops.c b/sys/fs/fdescfs/fdesc_vfsops.c index 97231a4..a451c18 100644 --- a/sys/fs/fdescfs/fdesc_vfsops.c +++ b/sys/fs/fdescfs/fdesc_vfsops.c @@ -224,6 +224,7 @@ static struct vfsops fdesc_vfsops = { vfs_stdsync, vfs_stdvget, vfs_stdfhtovp, + vfs_stdcheckexp, vfs_stdvptofh, fdesc_init, }; diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index e8695b8..625690d 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -75,8 +75,9 @@ static int update_mp __P((struct mount *mp, struct msdosfs_args *argp)); static int mountmsdosfs __P((struct vnode *devvp, struct mount *mp, struct proc *p, struct msdosfs_args *argp)); static int msdosfs_fhtovp __P((struct mount *, struct fid *, - struct sockaddr *, struct vnode **, int *, - struct ucred **)); + struct vnode **)); +static int msdosfs_checkexp __P((struct mount *, struct sockaddr *, + int *, struct ucred **)); static int msdosfs_mount __P((struct mount *, char *, caddr_t, struct nameidata *, struct proc *)); static int msdosfs_root __P((struct mount *, struct vnode **)); @@ -915,29 +916,38 @@ loop: } static int -msdosfs_fhtovp(mp, fhp, nam, vpp, exflagsp, credanonp) +msdosfs_fhtovp(mp, fhp, vpp) struct mount *mp; struct fid *fhp; - struct sockaddr *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); + return (0); +} + +static int +msdosfs_checkexp(mp, nam, exflagsp, credanonp) + struct mount *mp; + struct sockaddr *nam; + int *exflagsp; + struct ucred **credanonp; +{ + struct msdosfsmount *pmp = VFSTOMSDOSFS(mp); + struct netcred *np; + + np = vfs_export_lookup(mp, &pmp->pm_export, nam); + if (np == NULL) + return (EACCES); *exflagsp = np->netc_exflags; *credanonp = &np->netc_anon; return (0); @@ -970,6 +980,7 @@ static struct vfsops msdosfs_vfsops = { msdosfs_sync, vfs_stdvget, msdosfs_fhtovp, + msdosfs_checkexp, msdosfs_vptofh, msdosfs_init }; diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 4106fc3..a77647e 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -93,9 +93,10 @@ static int ntfs_vptofh __P((struct vnode *, struct fid *)); static int ntfs_init __P((struct vfsconf *)); #if 0 /* may be implemented at a later date */ static int ntfs_fhtovp __P((struct mount *, struct fid *, - struct sockaddr *, struct vnode **, - int *, struct ucred **)); -#endif + struct vnode **)); +static int ntfs_checkexp __P((struct vnode *, struct mbuf *, + int *, struct ucred **)); +#endif /* 0, default ops in FreeBSD */ #elif defined(__NetBSD__) static void ntfs_init __P((void)); static int ntfs_fhtovp __P((struct mount *, struct fid *, @@ -952,6 +953,7 @@ static struct vfsops ntfs_vfsops = { vfs_stdsync, ntfs_vget, vfs_stdfhtovp, + vfs_stdcheckexp, vfs_stdvptofh, ntfs_init, NULL diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 730eb80..06e1be0 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -57,8 +57,9 @@ static MALLOC_DEFINE(M_NULLFSMNT, "NULLFS mount", "NULLFS mount structure"); static int nullfs_fhtovp __P((struct mount *mp, struct fid *fidp, - struct sockaddr *nam, struct vnode **vpp, - int *exflagsp, struct ucred **credanonp)); + struct vnode **vpp)); +static int nullfs_checkexp __P((struct mount *mp, struct sockaddr *nam, + int *extflagsp, struct ucred **credanonp)); static int nullfs_mount __P((struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, struct proc *p)); static int nullfs_quotactl __P((struct mount *mp, int cmd, uid_t uid, @@ -385,17 +386,25 @@ nullfs_vget(mp, ino, vpp) } static int -nullfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp) +nullfs_fhtovp(mp, fidp, vpp) struct mount *mp; struct fid *fidp; - struct sockaddr *nam; struct vnode **vpp; - int *exflagsp; - struct ucred**credanonp; { - return VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, nam, - vpp, exflagsp, credanonp); + return VFS_FHTOVP(MOUNTTONULLMOUNT(mp)->nullm_vfs, fidp, vpp); +} + +static int +nullfs_checkexp(mp, nam, extflagsp, credanonp) + struct mount *mp; + struct sockaddr *nam; + int *extflagsp; + struct ucred **credanonp; +{ + + return VFS_CHECKEXP(MOUNTTONULLMOUNT(mp)->nullm_vfs, nam, + extflagsp, credanonp); } static int @@ -416,6 +425,7 @@ static struct vfsops null_vfsops = { nullfs_sync, nullfs_vget, nullfs_fhtovp, + nullfs_checkexp, nullfs_vptofh, nullfs_init, }; diff --git a/sys/fs/portalfs/portal_vfsops.c b/sys/fs/portalfs/portal_vfsops.c index bdb172b..d750b53 100644 --- a/sys/fs/portalfs/portal_vfsops.c +++ b/sys/fs/portalfs/portal_vfsops.c @@ -253,6 +253,7 @@ static struct vfsops portal_vfsops = { vfs_stdsync, vfs_stdvget, vfs_stdfhtovp, + vfs_stdcheckexp, vfs_stdvptofh, vfs_stdinit, }; diff --git a/sys/fs/procfs/procfs_vfsops.c b/sys/fs/procfs/procfs_vfsops.c index 92245b8..9f51a3c 100644 --- a/sys/fs/procfs/procfs_vfsops.c +++ b/sys/fs/procfs/procfs_vfsops.c @@ -170,6 +170,7 @@ static struct vfsops procfs_vfsops = { vfs_stdsync, vfs_stdvget, vfs_stdfhtovp, + vfs_stdcheckexp, vfs_stdvptofh, vfs_stdinit, }; diff --git a/sys/fs/umapfs/umap_vfsops.c b/sys/fs/umapfs/umap_vfsops.c index 005862a..afa44f0 100644 --- a/sys/fs/umapfs/umap_vfsops.c +++ b/sys/fs/umapfs/umap_vfsops.c @@ -56,8 +56,9 @@ static MALLOC_DEFINE(M_UMAPFSMNT, "UMAP mount", "UMAP mount structure"); static int umapfs_fhtovp __P((struct mount *mp, struct fid *fidp, - struct sockaddr *nam, struct vnode **vpp, - int *exflagsp, struct ucred **credanonp)); + struct vnode **vpp)); +static int umapfs_checkexp __P((struct mount *mp, struct sockaddr *nam, + int *extflagsp, struct ucred **credanonp)); static int umapfs_mount __P((struct mount *mp, char *path, caddr_t data, struct nameidata *ndp, struct proc *p)); static int umapfs_quotactl __P((struct mount *mp, int cmd, uid_t uid, @@ -398,16 +399,25 @@ umapfs_vget(mp, ino, vpp) } static int -umapfs_fhtovp(mp, fidp, nam, vpp, exflagsp, credanonp) +umapfs_fhtovp(mp, fidp, vpp) struct mount *mp; struct fid *fidp; - struct sockaddr *nam; struct vnode **vpp; +{ + + return (VFS_FHTOVP(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, fidp, vpp)); +} + +static int +umapfs_checkexp(mp, nam, exflagsp, credanonp) + struct mount *mp; + struct sockaddr *nam; int *exflagsp; - struct ucred**credanonp; + struct ucred **credanonp; { - return (VFS_FHTOVP(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, fidp, nam, vpp, exflagsp,credanonp)); + return (VFS_CHECKEXP(MOUNTTOUMAPMOUNT(mp)->umapm_vfs, nam, + exflagsp, credanonp)); } static int @@ -428,6 +438,7 @@ static struct vfsops umap_vfsops = { umapfs_sync, umapfs_vget, umapfs_fhtovp, + umapfs_checkexp, umapfs_vptofh, umapfs_init, }; diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c index def8416..af828ac 100644 --- a/sys/fs/unionfs/union_vfsops.c +++ b/sys/fs/unionfs/union_vfsops.c @@ -496,7 +496,7 @@ union_statfs(mp, sbp, p) static struct vfsops union_vfsops = { union_mount, - vfs_stdstart, + vfs_stdstart, /* underlying start already done */ union_unmount, union_root, vfs_stdquotactl, @@ -504,6 +504,7 @@ static struct vfsops union_vfsops = { vfs_stdsync, /* XXX assumes no cached data on union level */ vfs_stdvget, vfs_stdfhtovp, + vfs_stdcheckexp, vfs_stdvptofh, union_init, }; |