summaryrefslogtreecommitdiffstats
path: root/sys/nfs
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/nfs
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/nfs')
-rw-r--r--sys/nfs/nfs_common.c5
-rw-r--r--sys/nfs/nfs_subs.c5
-rw-r--r--sys/nfs/nfs_syscalls.c41
-rw-r--r--sys/nfs/nfs_vfsops.c1
4 files changed, 9 insertions, 43 deletions
diff --git a/sys/nfs/nfs_common.c b/sys/nfs/nfs_common.c
index 0ed9e22..7fd9d9d 100644
--- a/sys/nfs/nfs_common.c
+++ b/sys/nfs/nfs_common.c
@@ -1960,7 +1960,10 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
mp = vfs_getvfs(&fhp->fh_fsid);
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);
#ifdef MNT_EXNORESPORT
diff --git a/sys/nfs/nfs_subs.c b/sys/nfs/nfs_subs.c
index 0ed9e22..7fd9d9d 100644
--- a/sys/nfs/nfs_subs.c
+++ b/sys/nfs/nfs_subs.c
@@ -1960,7 +1960,10 @@ nfsrv_fhtovp(fhp, lockflag, vpp, cred, slp, nam, rdonlyp, kerbflag, pubflag)
mp = vfs_getvfs(&fhp->fh_fsid);
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);
#ifdef MNT_EXNORESPORT
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c
index 210dde6..054950b 100644
--- a/sys/nfs/nfs_syscalls.c
+++ b/sys/nfs/nfs_syscalls.c
@@ -120,49 +120,8 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, gatherdelay_v3, CTLFLAG_RW, &nfsrvw_procrastinate
/*
* NFS server system calls
- * getfh() lives here too, but maybe should move to kern/vfs_syscalls.c
*/
-/*
- * Get file handle system call
- */
-#ifndef _SYS_SYSPROTO_H_
-struct getfh_args {
- char *fname;
- fhandle_t *fhp;
-};
-#endif
-int
-getfh(p, uap)
- struct proc *p;
- register struct getfh_args *uap;
-{
- register struct vnode *vp;
- fhandle_t fh;
- int error;
- struct nameidata nd;
-
- /*
- * Must be super user
- */
- error = suser(p);
- if(error)
- return (error);
- NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->fname, p);
- error = namei(&nd);
- if (error)
- return (error);
- vp = nd.ni_vp;
- bzero((caddr_t)&fh, sizeof(fh));
- fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid;
- error = VFS_VPTOFH(vp, &fh.fh_fid);
- vput(vp);
- if (error)
- return (error);
- error = copyout((caddr_t)&fh, (caddr_t)uap->fhp, sizeof (fh));
- return (error);
-}
-
#endif /* NFS_NOSERVER */
/*
* Nfs server psuedo system call for the nfsd's
diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c
index 33085c4..d63f38d 100644
--- a/sys/nfs/nfs_vfsops.c
+++ b/sys/nfs/nfs_vfsops.c
@@ -120,6 +120,7 @@ static struct vfsops nfs_vfsops = {
nfs_sync,
vfs_stdvget,
vfs_stdfhtovp, /* shouldn't happen */
+ vfs_stdcheckexp,
vfs_stdvptofh, /* shouldn't happen */
nfs_init,
nfs_uninit,
OpenPOWER on IntegriCloud