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.
This commit is contained in:
Doug Rabson 1997-04-22 10:37:27 +00:00
parent a7c99c34e6
commit 2a66cfc532
4 changed files with 40 additions and 14 deletions

View file

@ -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

View file

@ -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 <sys/param.h>
@ -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);
}

View file

@ -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

View file

@ -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 <sys/param.h>
@ -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);
}