summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/nfs/nfs_socket.c6
-rw-r--r--sys/nfs/nfs_vfsops.c49
-rw-r--r--sys/sys/mount.h14
3 files changed, 44 insertions, 25 deletions
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index 2ecd99658d2..c88356871a8 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_socket.c,v 1.7 1996/07/03 07:10:33 deraadt Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.8 1996/12/24 20:14:29 dm Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
@@ -165,8 +165,10 @@ nfs_connect(nmp, rep)
/*
* Some servers require that the client port be a reserved port number.
+ * We always allocate a reserved port, as this prevents filehandle
+ * disclosure through UDP port capture.
*/
- if (saddr->sa_family == AF_INET && (nmp->nm_flag & NFSMNT_RESVPORT)) {
+ if (saddr->sa_family == AF_INET) {
MGET(m, M_WAIT, MT_SONAME);
sin = mtod(m, struct sockaddr_in *);
sin->sin_len = m->m_len = sizeof (struct sockaddr_in);
diff --git a/sys/nfs/nfs_vfsops.c b/sys/nfs/nfs_vfsops.c
index 1b09ef1789a..9a1a94f8bf9 100644
--- a/sys/nfs/nfs_vfsops.c
+++ b/sys/nfs/nfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_vfsops.c,v 1.14 1996/12/17 03:46:39 dm Exp $ */
+/* $OpenBSD: nfs_vfsops.c,v 1.15 1996/12/24 20:14:32 dm Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.46.4.1 1996/05/25 22:40:35 fvdl Exp $ */
/*
@@ -418,7 +418,6 @@ nfs_mount_diskless(ndmntp, mntname, mntflag, vpp)
args.fh = ndmntp->ndm_fh;
args.fhsize = NFSX_V2FH;
args.hostname = ndmntp->ndm_host;
- args.flags = NFSMNT_RESVPORT;
#ifdef NFS_BOOT_OPTIONS
args.flags |= NFS_BOOT_OPTIONS;
@@ -459,9 +458,11 @@ nfs_decode_args(nmp, argp)
s = splsoftnet();
+#if 0
/* Re-bind if rsrvd port requested and wasn't on one */
adjsock = !(nmp->nm_flag & NFSMNT_RESVPORT)
&& (argp->flags & NFSMNT_RESVPORT);
+#endif
/* Update flags atomically. Don't change the lock bits. */
nmp->nm_flag =
@@ -543,28 +544,35 @@ nfs_decode_args(nmp, argp)
argp->deadthresh <= NQ_NEVERDEAD)
nmp->nm_deadthresh = argp->deadthresh;
- if (argp->flags & NFSMNT_ACTIMES) {
+ if (argp->flags & NFSMNT_ACREGMIN && argp->acregmin >= 0) {
+ if (argp->acregmin > 0xffff)
+ nmp->nm_acregmin = 0xffff;
+ else
+ nmp->nm_acregmin = argp->acregmin;
+ }
+ if (argp->flags & NFSMNT_ACREGMAX && argp->acregmax >= 0) {
if (argp->acregmax > 0xffff)
nmp->nm_acregmax = 0xffff;
- else if (argp->acregmax >= 0)
+ else
nmp->nm_acregmax = argp->acregmax;
- if (argp->acregmin >= 0) {
- if (argp->acregmin > nmp->nm_acregmax)
- nmp->nm_acregmin = nmp->nm_acregmax;
- else
- nmp->nm_acregmin = argp->acregmin;
- }
+ }
+ if (nmp->nm_acregmin > nmp->nm_acregmax)
+ nmp->nm_acregmin = nmp->nm_acregmax;
+
+ if (argp->flags & NFSMNT_ACDIRMIN && argp->acdirmin >= 0) {
+ if (argp->acdirmin > 0xffff)
+ nmp->nm_acdirmin = 0xffff;
+ else
+ nmp->nm_acdirmin = argp->acdirmin;
+ }
+ if (argp->flags & NFSMNT_ACDIRMAX && argp->acdirmax >= 0) {
if (argp->acdirmax > 0xffff)
nmp->nm_acdirmax = 0xffff;
- else if (argp->acdirmax >= 0)
+ else
nmp->nm_acdirmax = argp->acdirmax;
- if (argp->acdirmin >= 0) {
- if (argp->acdirmin > nmp->nm_acdirmax)
- nmp->nm_acdirmin = nmp->nm_acdirmax;
- else
- nmp->nm_acdirmin = argp->acdirmin;
- }
}
+ if (nmp->nm_acdirmin > nmp->nm_acdirmax)
+ nmp->nm_acdirmin = nmp->nm_acdirmax;
if (nmp->nm_so && adjsock) {
nfs_disconnect(nmp);
@@ -609,15 +617,16 @@ nfs_mount(mp, path, data, ndp, p)
if (args.version == 3) {
error = copyin (data, (caddr_t)&args,
sizeof (struct nfs_args3));
- args.flags &= ~NFSMNT_INTERNAL;
+ args.flags &= ~(NFSMNT_INTERNAL|NFSMNT_NOAC);
}
- else if (args.version == NFS_ARGSVERSION)
+ else if (args.version == NFS_ARGSVERSION) {
error = copyin(data, (caddr_t)&args, sizeof (struct nfs_args));
+ args.flags &= ~NFSMNT_NOAC; /* XXX - compatibility */
+ }
else
return (EPROGMISMATCH);
if (error)
return (error);
- args.flags |= NFSMNT_RESVPORT; /* ALWAYS allocate one */
if (mp->mnt_flag & MNT_UPDATE) {
register struct nfsmount *nmp = VFSTONFS(mp);
diff --git a/sys/sys/mount.h b/sys/sys/mount.h
index ca540840089..6a1d52a1023 100644
--- a/sys/sys/mount.h
+++ b/sys/sys/mount.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mount.h,v 1.11 1996/12/17 03:46:36 dm Exp $ */
+/* $OpenBSD: mount.h,v 1.12 1996/12/24 20:14:35 dm Exp $ */
/* $NetBSD: mount.h,v 1.48 1996/02/18 11:55:47 fvdl Exp $ */
/*
@@ -356,6 +356,9 @@ struct nfs_args3 {
/*
* NFS mount option flags
*/
+#ifndef _KERNEL
+#define NFSMNT_RESVPORT 0x00000000 /* always use reserved ports */
+#endif /* !_KERNEL */
#define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */
#define NFSMNT_WSIZE 0x00000002 /* set write size */
#define NFSMNT_RSIZE 0x00000004 /* set read size */
@@ -371,12 +374,17 @@ struct nfs_args3 {
#define NFSMNT_LEASETERM 0x00001000 /* set lease term (nqnfs) */
#define NFSMNT_READAHEAD 0x00002000 /* set read ahead */
#define NFSMNT_DEADTHRESH 0x00004000 /* set dead server retry thresh */
-#define NFSMNT_RESVPORT 0x00008000 /* Allocate a reserved port */
+#ifdef _KERNEL /* Coming soon to a system call near you! */
+#define NFSMNT_NOAC 0x00008000 /* disable attribute cache */
+#endif /* _KERNEL */
#define NFSMNT_RDIRPLUS 0x00010000 /* Use Readdirplus for V3 */
#define NFSMNT_READDIRSIZE 0x00020000 /* Set readdir size */
/* Flags valid only in mount syscall arguments */
-#define NFSMNT_ACTIMES 0x00040000 /* Args contain attr cache times*/
+#define NFSMNT_ACREGMIN 0x00040000 /* acregmin field valid */
+#define NFSMNT_ACREGMAX 0x00080000 /* acregmax field valid */
+#define NFSMNT_ACDIRMIN 0x00100000 /* acdirmin field valid */
+#define NFSMNT_ACDIRMAX 0x00200000 /* acdirmax field valid */
/* Flags valid only in kernel */
#define NFSMNT_INTERNAL 0xfffc0000 /* Bits set internally */