summaryrefslogtreecommitdiffstats
path: root/sys/ufs/ufs
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>1999-09-11 00:46:08 +0000
committeralfred <alfred@FreeBSD.org>1999-09-11 00:46:08 +0000
commitb9136a6115cbac97ab114f16b1aacf4eb20ad2c1 (patch)
tree783daf81f8570ef14570d4a5a6fc45f15ec1cbf5 /sys/ufs/ufs
parenta9f7b5ee698afe56d1167bfa395f23b1fff1730c (diff)
downloadFreeBSD-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/ufs')
-rw-r--r--sys/ufs/ufs/ufs_extern.h6
-rw-r--r--sys/ufs/ufs/ufs_vfsops.c45
2 files changed, 33 insertions, 18 deletions
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);
OpenPOWER on IntegriCloud