summaryrefslogtreecommitdiffstats
path: root/sbin/mount_nfs
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>2001-09-18 23:34:44 +0000
committerpeter <peter@FreeBSD.org>2001-09-18 23:34:44 +0000
commit68a5e33921ddffccaf8bda03691dd342cec460e6 (patch)
tree2ab6686939b8d439aa2343714aacd0c5b54a86c4 /sbin/mount_nfs
parent240c3fa09f43a615601f2ffcf4c2cab063df8096 (diff)
downloadFreeBSD-src-68a5e33921ddffccaf8bda03691dd342cec460e6.zip
FreeBSD-src-68a5e33921ddffccaf8bda03691dd342cec460e6.tar.gz
Userland part of nfs client/server split and cleanup.
Diffstat (limited to 'sbin/mount_nfs')
-rw-r--r--sbin/mount_nfs/Makefile8
-rw-r--r--sbin/mount_nfs/mount_nfs.851
-rw-r--r--sbin/mount_nfs/mount_nfs.c206
3 files changed, 15 insertions, 250 deletions
diff --git a/sbin/mount_nfs/Makefile b/sbin/mount_nfs/Makefile
index d392a1d..f96f276 100644
--- a/sbin/mount_nfs/Makefile
+++ b/sbin/mount_nfs/Makefile
@@ -11,12 +11,4 @@ UMNTALL= ${.CURDIR}/../../usr.sbin/rpc.umntall
CFLAGS+= -DNFS -I${MOUNT} -I${UMNTALL}
.PATH: ${MOUNT} ${UMNTALL}
-.if exists(${DESTDIR}/usr/lib/libkrb.a) && (defined(MAKE_KERBEROS) \
- || defined(MAKE_EBONES))
-CFLAGS+=-DKERBEROS
-DPADD= ${LIBKRB} ${LIBCRYPTO}
-LDADD= -lkrb -lcrypto
-DISTRIBUTION= krb
-.endif
-
.include <bsd.prog.mk>
diff --git a/sbin/mount_nfs/mount_nfs.8 b/sbin/mount_nfs/mount_nfs.8
index cafd2a3..88110bf 100644
--- a/sbin/mount_nfs/mount_nfs.8
+++ b/sbin/mount_nfs/mount_nfs.8
@@ -41,14 +41,12 @@
.Nd mount nfs file systems
.Sh SYNOPSIS
.Nm
-.Op Fl 23KNPTUbcdilqs
+.Op Fl 23NPTUbcdils
.Op Fl D Ar deadthresh
.Op Fl I Ar readdirsize
-.Op Fl L Ar leaseterm
.Op Fl R Ar retrycnt
.Op Fl a Ar maxreadahead
.Op Fl g Ar maxgroups
-.Op Fl m Ar realm
.Op Fl o Ar options
.Op Fl r Ar readsize
.Op Fl t Ar timeout
@@ -102,36 +100,15 @@ gigabytes.
.It Fl 3
Use the NFS Version 3 protocol.
.It Fl D
-Used with NQNFS to set the
+Set the
.Dq "dead server threshold"
-to the specified number of round trip timeout intervals.
-After a
-.Dq "dead server threshold"
-of retransmit timeouts,
-cached data for the unresponsive server is assumed to still be valid.
-Values may be set in the range of 1 - 9, with 9 referring to an
-.Dq "infinite dead threshold"
-(i.e. never assume cached data still valid).
-This option is not generally recommended and is really an experimental
-feature.
+to the specified number of round trip timeout intervals before a
+.Dq "server not responding"
+message is displayed.
.It Fl I
Set the readdir read size to the specified value.
The value should normally
be a multiple of DIRBLKSIZ that is <= the read size for the mount.
-.It Fl K
-Pass Kerberos authenticators to the server for client-to-server
-user-credential mapping.
-This requires that the kernel be built with the NFSKERB option.
-The use of this option will prevent the kernel from compiling
-unless calls to the appropriate Kerberos encryption routines
-are provided in the NFS source.
-(Refer to the INTERNET-DRAFT titled
-.%T "Authentication Mechanisms for ONC RPC" ,
-for more information.)
-.It Fl L
-Used with NQNFS to set the lease term to the specified number of seconds.
-Only use this argument for mounts with a large round trip delay.
-Values are normally in the 10-30 second range.
.It Fl N
Do
.Em not
@@ -206,11 +183,6 @@ Try this option and see whether performance improves or degrades.
Probably
most useful for client to server network interconnects with a large bandwidth
times delay product.
-.It Fl m
-Set the Kerberos realm to the string argument.
-Used with the
-.Fl K
-option for mounts to other realms.
.It Fl o
Options are specified with a
.Fl o
@@ -254,9 +226,6 @@ Same as
.It intr
Same as
.Fl i .
-.It kerb
-Same as
-.Fl K .
.It nfsv2
Same as
.Fl 2 .
@@ -275,9 +244,6 @@ Same as
.It seqpacket
Same as
.Fl p .
-.It nqnfs
-Same as
-.Fl q .
.It soft
Same as
.Fl s .
@@ -285,13 +251,6 @@ Same as
Same as
.Fl T .
.El
-.It Fl q
-Use the Not Quite NFS (NQNFS) protocol.
-This experimental protocol is NFS Version 2 with leasing extensions
-similar to those found in NFS Version 3.
-The interoperability of this protocol with other systems is
-very limited and its implementation is not widely used.
-Do not use this option unless you know exactly what you are doing!
.It Fl r
Set the read data size to the specified value.
It should normally be a power of 2 greater than or equal to 1024.
diff --git a/sbin/mount_nfs/mount_nfs.c b/sbin/mount_nfs/mount_nfs.c
index 4b88a51..778bdd9 100644
--- a/sbin/mount_nfs/mount_nfs.c
+++ b/sbin/mount_nfs/mount_nfs.c
@@ -58,15 +58,10 @@ static const char rcsid[] =
#include <rpc/pmap_clnt.h>
#include <rpc/pmap_prot.h>
-#ifdef NFSKERB
-#include <kerberosIV/des.h>
-#include <kerberosIV/krb.h>
-#endif
-
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
-#include <nfs/nfs.h>
-#include <nfs/nqnfs.h>
+#include <nfsclient/nfs.h>
+#include <nfsclient/nfsargs.h>
#include <arpa/inet.h>
@@ -88,13 +83,11 @@ static const char rcsid[] =
#define ALTF_NOCONN 0x2
#define ALTF_DUMBTIMR 0x4
#define ALTF_INTR 0x8
-#define ALTF_KERB 0x10
#define ALTF_NFSV3 0x20
#define ALTF_RDIRPLUS 0x40
-#define ALTF_MNTUDP 0x80
+#define ALTF_MNTUDP 0x80
#define ALTF_RESVPORT 0x100
#define ALTF_SEQPACKET 0x200
-#define ALTF_NQNFS 0x400
#define ALTF_SOFT 0x800
#define ALTF_TCP 0x1000
#define ALTF_PORT 0x2000
@@ -113,14 +106,10 @@ struct mntopt mopts[] = {
{ "conn", 1, ALTF_NOCONN, 1 },
{ "dumbtimer", 0, ALTF_DUMBTIMR, 1 },
{ "intr", 0, ALTF_INTR, 1 },
-#ifdef NFSKERB
- { "kerb", 0, ALTF_KERB, 1 },
-#endif
{ "nfsv3", 0, ALTF_NFSV3, 1 },
{ "rdirplus", 0, ALTF_RDIRPLUS, 1 },
{ "mntudp", 0, ALTF_MNTUDP, 1 },
{ "resvport", 0, ALTF_RESVPORT, 1 },
- { "nqnfs", 0, ALTF_NQNFS, 1 },
{ "soft", 0, ALTF_SOFT, 1 },
{ "tcp", 0, ALTF_TCP, 1 },
{ "port=", 0, ALTF_PORT, 1 },
@@ -148,8 +137,8 @@ struct nfs_args nfsdefargs = {
NFS_RETRANS,
NFS_MAXGRPS,
NFS_DEFRAHEAD,
- NQ_DEFLEASE,
- NQ_DEADTHRESH,
+ 0, /* was: NQ_DEFLEASE */
+ NFS_MAXDEADTHRESH, /* was: NQ_DEADTHRESH */
(char *)0,
/* args version 4 */
NFS_MINATTRTIMO,
@@ -191,21 +180,6 @@ enum mountmode {
V3
} mountmode = ANY;
-#ifdef NFSKERB
-char inst[INST_SZ];
-char realm[REALM_SZ];
-struct {
- u_long kind;
- KTEXT_ST kt;
-} ktick;
-struct nfsrpc_nickverf kverf;
-struct nfsrpc_fullblock kin, kout;
-NFSKERBKEY_T kivec;
-CREDENTIALS kcr;
-struct timeval ktv;
-NFSKERBKEYSCHED_T kerb_keysched;
-#endif
-
/* Return codes for nfs_tryproto. */
enum tryret {
TRYRET_SUCCESS,
@@ -251,12 +225,8 @@ set_flags(int* altflags, int* nfsflags, int dir)
F(NOCONN);
F(DUMBTIMR);
F2(INTR, INT);
-#ifdef NFSKERB
- F(KERB);
-#endif
F(RDIRPLUS);
F(RESVPORT);
- F(NQNFS);
F(SOFT);
#undef F
@@ -271,30 +241,18 @@ main(argc, argv)
register int c;
register struct nfs_args *nfsargsp;
struct nfs_args nfsargs;
- struct nfsd_cargs ncd;
int mntflags, altflags, nfssvc_flag, num;
char *name, *p, *spec;
char mntpath[MAXPATHLEN];
struct vfsconf vfc;
int error = 0;
-#ifdef NFSKERB
- uid_t last_ruid;
-
- last_ruid = -1;
- (void)strcpy(realm, KRB_REALM);
- if (sizeof (struct nfsrpc_nickverf) != RPCX_NICKVERF ||
- sizeof (struct nfsrpc_fullblock) != RPCX_FULLBLOCK ||
- ((char *)&ktick.kt) - ((char *)&ktick) != NFSX_UNSIGNED ||
- ((char *)ktick.kt.dat) - ((char *)&ktick) != 2 * NFSX_UNSIGNED)
- fprintf(stderr, "Yikes! NFSKERB structs not packed!!\n");
-#endif /* NFSKERB */
mntflags = 0;
altflags = 0;
nfsargs = nfsdefargs;
nfsargsp = &nfsargs;
while ((c = getopt(argc, argv,
- "23a:bcdD:g:I:iKL:lm:No:PpqR:r:sTt:w:x:U")) != -1)
+ "23a:bcdD:g:I:il:No:PpR:r:sTt:w:x:U")) != -1)
switch (c) {
case '2':
mountmode = V2;
@@ -345,27 +303,9 @@ main(argc, argv)
case 'i':
nfsargsp->flags |= NFSMNT_INT;
break;
-#ifdef NFSKERB
- case 'K':
- nfsargsp->flags |= NFSMNT_KERB;
- break;
-#endif
- case 'L':
- num = strtol(optarg, &p, 10);
- if (*p || num < 2)
- errx(1, "illegal -L value -- %s", optarg);
- nfsargsp->leaseterm = num;
- nfsargsp->flags |= NFSMNT_LEASETERM;
- break;
case 'l':
nfsargsp->flags |= NFSMNT_RDIRPLUS;
break;
-#ifdef NFSKERB
- case 'm':
- (void)strncpy(realm, optarg, REALM_SZ - 1);
- realm[REALM_SZ - 1] = '\0';
- break;
-#endif
case 'N':
nfsargsp->flags &= ~NFSMNT_RESVPORT;
break;
@@ -422,10 +362,6 @@ main(argc, argv)
case 'P':
/* obsolete for NFSMNT_RESVPORT, now default */
break;
- case 'q':
- mountmode = V3;
- nfsargsp->flags |= NFSMNT_NQNFS;
- break;
case 'R':
num = strtol(optarg, &p, 10);
if (*p || num < 0)
@@ -506,99 +442,7 @@ main(argc, argv)
if (mount(vfc.vfc_name, mntpath, mntflags, nfsargsp))
err(1, "%s", mntpath);
- if (nfsargsp->flags & (NFSMNT_NQNFS | NFSMNT_KERB)) {
- if ((opflags & ISBGRND) == 0) {
- if (daemon(0, 0) != 0)
- err(1, "daemon");
- }
- openlog("mount_nfs", LOG_PID, LOG_DAEMON);
- nfssvc_flag = NFSSVC_MNTD;
- ncd.ncd_dirp = mntpath;
- while (nfssvc(nfssvc_flag, (caddr_t)&ncd) < 0) {
- if (errno != ENEEDAUTH) {
- syslog(LOG_ERR, "nfssvc err %m");
- continue;
- }
- nfssvc_flag =
- NFSSVC_MNTD | NFSSVC_GOTAUTH | NFSSVC_AUTHINFAIL;
-#ifdef NFSKERB
- /*
- * Set up as ncd_authuid for the kerberos call.
- * Must set ruid to ncd_authuid and reset the
- * ticket name iff ncd_authuid is not the same
- * as last time, so that the right ticket file
- * is found.
- * Get the Kerberos credential structure so that
- * we have the session key and get a ticket for
- * this uid.
- * For more info see the IETF Draft "Authentication
- * in ONC RPC".
- */
- if (ncd.ncd_authuid != last_ruid) {
- char buf[512];
- (void)sprintf(buf, "%s%d",
- TKT_ROOT, ncd.ncd_authuid);
- krb_set_tkt_string(buf);
- last_ruid = ncd.ncd_authuid;
- }
- setreuid(ncd.ncd_authuid, 0);
- kret = krb_get_cred(NFS_KERBSRV, inst, realm, &kcr);
- if (kret == RET_NOTKT) {
- kret = get_ad_tkt(NFS_KERBSRV, inst, realm,
- DEFAULT_TKT_LIFE);
- if (kret == KSUCCESS)
- kret = krb_get_cred(NFS_KERBSRV, inst, realm,
- &kcr);
- }
- if (kret == KSUCCESS)
- kret = krb_mk_req(&ktick.kt, NFS_KERBSRV, inst,
- realm, 0);
-
- /*
- * Fill in the AKN_FULLNAME authenticator and verifier.
- * Along with the Kerberos ticket, we need to build
- * the timestamp verifier and encrypt it in CBC mode.
- */
- if (kret == KSUCCESS &&
- ktick.kt.length <= (RPCAUTH_MAXSIZ-3*NFSX_UNSIGNED)
- && gettimeofday(&ktv, (struct timezone *)0) == 0) {
- ncd.ncd_authtype = RPCAUTH_KERB4;
- ncd.ncd_authstr = (u_char *)&ktick;
- ncd.ncd_authlen = nfsm_rndup(ktick.kt.length) +
- 3 * NFSX_UNSIGNED;
- ncd.ncd_verfstr = (u_char *)&kverf;
- ncd.ncd_verflen = sizeof (kverf);
- memmove(ncd.ncd_key, kcr.session,
- sizeof (kcr.session));
- kin.t1 = htonl(ktv.tv_sec);
- kin.t2 = htonl(ktv.tv_usec);
- kin.w1 = htonl(NFS_KERBTTL);
- kin.w2 = htonl(NFS_KERBTTL - 1);
- bzero((caddr_t)kivec, sizeof (kivec));
-
- /*
- * Encrypt kin in CBC mode using the session
- * key in kcr.
- */
- XXX
- /*
- * Finally, fill the timestamp verifier into the
- * authenticator and verifier.
- */
- ktick.kind = htonl(RPCAKN_FULLNAME);
- kverf.kind = htonl(RPCAKN_FULLNAME);
- NFS_KERBW1(ktick.kt) = kout.w1;
- ktick.kt.length = htonl(ktick.kt.length);
- kverf.verf.t1 = kout.t1;
- kverf.verf.t2 = kout.t2;
- kverf.verf.w2 = kout.w2;
- nfssvc_flag = NFSSVC_MNTD | NFSSVC_GOTAUTH;
- }
- setreuid(0, 0);
-#endif /* NFSKERB */
- }
- }
exit(0);
}
@@ -608,15 +452,9 @@ getnfsargs(spec, nfsargsp)
struct nfs_args *nfsargsp;
{
struct addrinfo hints, *ai_nfs, *ai;
-#ifdef NFSKERB
- char host[NI_MAXHOST], serv[NI_MAXSERV];
-#endif
enum tryret ret;
int ecode, speclen, remoteerr;
char *hostp, *delimp, *errstr;
-#ifdef NFSKERB
- char *cp;
-#endif
size_t len;
static char nam[MNAMELEN + 1];
@@ -655,25 +493,12 @@ getnfsargs(spec, nfsargsp)
}
/*
- * Handle an internet host address and reverse resolve it if
- * doing Kerberos.
+ * Handle an internet host address.
*/
memset(&hints, 0, sizeof hints);
hints.ai_flags = AI_NUMERICHOST;
hints.ai_socktype = nfsargsp->sotype;
- if (getaddrinfo(hostp, portspec, &hints, &ai_nfs) == 0) {
-#ifdef NFSKERB
- if ((nfsargsp->flags & NFSMNT_KERB)) {
- hints.ai_flags = 0;
- if (getnameinfo(ai_nfs->ai_addr, ai_nfs->ai_addrlen,
- host, sizeof host, serv, sizeof serv, 0) != 0) {
- warnx("can't reverse resolve net address");
- return (0);
- }
- hostp = host;
- }
-#endif /* NFSKERB */
- } else {
+ if (getaddrinfo(hostp, portspec, &hints, &ai_nfs) != 0) {
hints.ai_flags = 0;
if ((ecode = getaddrinfo(hostp, portspec, &hints, &ai_nfs))
!= 0) {
@@ -685,14 +510,6 @@ getnfsargs(spec, nfsargsp)
return (0);
}
}
-#ifdef NFSKERB
- if (nfsargsp->flags & NFSMNT_KERB) {
- strncpy(inst, hp->h_name, INST_SZ);
- inst[INST_SZ - 1] = '\0';
- if (cp = strchr(inst, '.'))
- *cp = '\0';
- }
-#endif /* NFSKERB */
ret = TRYRET_LOCALERR;
for (;;) {
@@ -890,10 +707,7 @@ tryagain:
&rpc_createerr.cf_error));
}
clp->cl_auth = authsys_create_default();
- if (nfsargsp->flags & NFSMNT_KERB)
- nfhret.auth = RPCAUTH_KERB4;
- else
- nfhret.auth = RPCAUTH_UNIX;
+ nfhret.auth = RPCAUTH_UNIX;
nfhret.vers = mntvers;
stat = clnt_call(clp, RPCMNT_MOUNT, xdr_dir, spec, xdr_fh, &nfhret,
try);
@@ -1080,7 +894,7 @@ usage()
{
(void)fprintf(stderr, "%s\n%s\n%s\n%s\n",
"usage: mount_nfs [-23KNPTUbcdilqs] [-D deadthresh] [-I readdirsize]",
-" [-L leaseterm] [-R retrycnt] [-a maxreadahead]",
+" [-R retrycnt] [-a maxreadahead]",
" [-g maxgroups] [-m realm] [-o options] [-r readsize]",
" [-t timeout] [-w writesize] [-x retrans] rhost:path node");
exit(1);
OpenPOWER on IntegriCloud