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/ufs | |
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/ufs')
-rw-r--r-- | sys/ufs/ffs/ffs_extern.h | 5 | ||||
-rw-r--r-- | sys/ufs/ffs/ffs_vfsops.c | 8 | ||||
-rw-r--r-- | sys/ufs/mfs/mfs_vfsops.c | 1 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_extern.h | 6 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vfsops.c | 45 |
5 files changed, 40 insertions, 25 deletions
diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h index 177a820..12beae3 100644 --- a/sys/ufs/ffs/ffs_extern.h +++ b/sys/ufs/ffs/ffs_extern.h @@ -76,8 +76,9 @@ void ffs_blkfree __P((struct inode *, ufs_daddr_t, long)); ufs_daddr_t ffs_blkpref __P((struct inode *, ufs_daddr_t, int, ufs_daddr_t *)); int ffs_bmap __P((struct vop_bmap_args *)); void ffs_clrblock __P((struct fs *, u_char *, ufs_daddr_t)); -int ffs_fhtovp __P((struct mount *, struct fid *, struct sockaddr *, - struct vnode **, int *, struct ucred **)); +int ffs_fhtovp __P((struct mount *, struct fid *, struct vnode **)); +int ffs_checkexp __P((struct mount *, struct sockaddr *, int *, + struct ucred **)); int ffs_flushfiles __P((struct mount *, int, struct proc *)); void ffs_fragacct __P((struct fs *, int, int32_t [], int)); int ffs_freefile __P(( struct vnode *, ino_t, int )); diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 3efbdeb..9af1c90 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -80,6 +80,7 @@ static struct vfsops ufs_vfsops = { ffs_sync, ffs_vget, ffs_fhtovp, + ufs_check_export, ffs_vptofh, ffs_init, }; @@ -1177,13 +1178,10 @@ restart: * 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 sockaddr *nam; struct vnode **vpp; - int *exflagsp; - struct ucred **credanonp; { register struct ufid *ufhp; struct fs *fs; @@ -1193,7 +1191,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/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c index 1ac1dc8..22ca0b6 100644 --- a/sys/ufs/mfs/mfs_vfsops.c +++ b/sys/ufs/mfs/mfs_vfsops.c @@ -114,6 +114,7 @@ static struct vfsops mfs_vfsops = { ffs_sync, ffs_vget, ffs_fhtovp, + ufs_check_export, ffs_vptofh, mfs_init, }; diff --git a/sys/ufs/ufs/ufs_extern.h b/sys/ufs/ufs/ufs_extern.h index ee2779d..feec939 100644 --- a/sys/ufs/ufs/ufs_extern.h +++ b/sys/ufs/ufs/ufs_extern.h @@ -61,9 +61,9 @@ int ufs_vnoperatespec __P((struct vop_generic_args *)); int ufs_bmap __P((struct vop_bmap_args *)); int ufs_bmaparray __P((struct vnode *, daddr_t, daddr_t *, struct indir *, int *, int *, int *)); -int ufs_check_export __P((struct mount *, struct ufid *, - struct sockaddr *, struct vnode **, - int *exflagsp, struct ucred **)); +int ufs_check_export __P((struct mount *, struct sockaddr *, + int *, struct ucred **)); +int ufs_fhtovp(register struct mount *, struct ufid *, struct vnode **); int ufs_checkpath __P((struct inode *, struct inode *, struct ucred *)); void ufs_dirbad __P((struct inode *, doff_t, char *)); int ufs_dirbadentry __P((struct vnode *, struct direct *, int)); diff --git a/sys/ufs/ufs/ufs_vfsops.c b/sys/ufs/ufs/ufs_vfsops.c index f128400..22cc9cc 100644 --- a/sys/ufs/ufs/ufs_vfsops.c +++ b/sys/ufs/ufs/ufs_vfsops.c @@ -183,31 +183,18 @@ 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. + * Call the VFS_CHECKEXP beforehand to verify access. */ int -ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp) +ufs_fhtovp(mp, ufhp, vpp) register struct mount *mp; struct ufid *ufhp; - struct sockaddr *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); - error = VFS_VGET(mp, ufhp->ufid_ino, &nvp); if (error) { *vpp = NULLVP; @@ -220,6 +207,34 @@ ufs_check_export(mp, ufhp, nam, vpp, exflagsp, credanonp) return (ESTALE); } *vpp = nvp; + return (0); +} + + +/* + * 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. + */ +int +ufs_check_export(mp, nam, exflagsp, credanonp) + register struct mount *mp; + struct sockaddr *nam; + int *exflagsp; + struct ucred **credanonp; +{ + register struct netcred *np; + register struct ufsmount *ump;; + + 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); |