From a6bde6da85086f08d0ee2f36010aa9c2a5d354e4 Mon Sep 17 00:00:00 2001 From: dfr Date: Tue, 22 Apr 1997 10:37:27 +0000 Subject: Add a -2 flag to mountd to allow an admin to disable NFSv3 services. This is handy for testing and possibly to work around busted v3 clients. --- usr.sbin/mountd/mountd.8 | 9 +++++++-- usr.sbin/mountd/mountd.c | 18 +++++++++++++----- 2 files changed, 20 insertions(+), 7 deletions(-) (limited to 'usr.sbin/mountd') diff --git a/usr.sbin/mountd/mountd.8 b/usr.sbin/mountd/mountd.8 index e4074fb..487dacb 100644 --- a/usr.sbin/mountd/mountd.8 +++ b/usr.sbin/mountd/mountd.8 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)mountd.8 8.4 (Berkeley) 4/28/95 -.\" $Id: mountd.8,v 1.8 1997/03/11 12:43:44 peter Exp $ +.\" $Id: mountd.8,v 1.9 1997/04/09 20:25:43 guido Exp $ .\" .Dd April 28, 1995 .Dt MOUNTD 8 @@ -42,7 +42,7 @@ mount requests .Sh SYNOPSIS .Nm /sbin/mountd -.Op Fl nr +.Op Fl 2nr .Op Ar exportsfile .Sh DESCRIPTION .Xr Mountd @@ -61,6 +61,11 @@ Appendix I. Options and operands available for .Nm mountd : .Bl -tag -width Ds +.It Fl 2 +The +.Fl 2 +option allows the administrator to force clients to use only the +version 2 NFS protocol to mount filesystems from this server. .It Fl n The .Fl n diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index 1ca38ec..3a45237 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -43,7 +43,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "@(#)mountd.c 8.15 (Berkeley) 5/1/95"; */ static const char rcsid[] = - "$Id: mountd.c,v 1.17 1997/04/01 14:15:30 bde Exp $"; + "$Id: mountd.c,v 1.18 1997/04/09 20:17:15 guido Exp $"; #endif /*not lint*/ #include @@ -220,6 +220,7 @@ struct ucred def_anon = { 1, { (gid_t) -2 } }; +int force_v2 = 0; int resvport_only = 1; int dir_only = 1; int opt_flags; @@ -270,8 +271,11 @@ main(argc, argv) errx(1, "NFS support is not available in the running kernel"); #endif /* __FreeBSD__ */ - while ((c = getopt(argc, argv, "dnr")) != -1) + while ((c = getopt(argc, argv, "2dnr")) != -1) switch (c) { + case '2': + force_v2 = 1; + break; case 'n': resvport_only = 0; break; @@ -336,10 +340,14 @@ main(argc, argv) } pmap_unset(RPCPROG_MNT, 1); pmap_unset(RPCPROG_MNT, 3); + if (!force_v2) + if (!svc_register(udptransp, RPCPROG_MNT, 3, mntsrv, IPPROTO_UDP) || + !svc_register(tcptransp, RPCPROG_MNT, 3, mntsrv, IPPROTO_TCP)) { + syslog(LOG_ERR, "Can't register mount"); + exit(1); + } if (!svc_register(udptransp, RPCPROG_MNT, 1, mntsrv, IPPROTO_UDP) || - !svc_register(udptransp, RPCPROG_MNT, 3, mntsrv, IPPROTO_UDP) || - !svc_register(tcptransp, RPCPROG_MNT, 1, mntsrv, IPPROTO_TCP) || - !svc_register(tcptransp, RPCPROG_MNT, 3, mntsrv, IPPROTO_TCP)) { + !svc_register(tcptransp, RPCPROG_MNT, 1, mntsrv, IPPROTO_TCP)) { syslog(LOG_ERR, "Can't register mount"); exit(1); } -- cgit v1.1