summaryrefslogtreecommitdiffstats
path: root/usr.sbin
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 /usr.sbin
parent240c3fa09f43a615601f2ffcf4c2cab063df8096 (diff)
downloadFreeBSD-src-68a5e33921ddffccaf8bda03691dd342cec460e6.zip
FreeBSD-src-68a5e33921ddffccaf8bda03691dd342cec460e6.tar.gz
Userland part of nfs client/server split and cleanup.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/mountd/mountd.c27
-rw-r--r--usr.sbin/nfsd/Makefile8
-rw-r--r--usr.sbin/nfsd/nfsd.c154
-rw-r--r--usr.sbin/pstat/pstat.86
-rw-r--r--usr.sbin/pstat/pstat.c10
-rw-r--r--usr.sbin/rpc.lockd/kern.c10
6 files changed, 17 insertions, 198 deletions
diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c
index aab4479..6c9fa0e 100644
--- a/usr.sbin/mountd/mountd.c
+++ b/usr.sbin/mountd/mountd.c
@@ -61,7 +61,7 @@ static const char rcsid[] =
#include <rpcsvc/mount.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
-#include <nfs/nfs.h>
+#include <nfsserver/nfs.h>
#include <ufs/ufs/ufsmount.h>
#include <fs/msdosfs/msdosfsmount.h>
#include <fs/ntfs/ntfsmount.h>
@@ -109,7 +109,6 @@ struct dirlist {
/* dp_flag bits */
#define DP_DEFSET 0x1
#define DP_HOSTSET 0x2
-#define DP_KERB 0x4
struct exportlist {
struct exportlist *ex_next;
@@ -236,7 +235,7 @@ int mountdlockfd;
/* Bits for opt_flags above */
#define OP_MAPROOT 0x01
#define OP_MAPALL 0x02
-#define OP_KERB 0x04
+/* 0x4 free */
#define OP_MASK 0x08
#define OP_NET 0x10
#define OP_ALLDIRS 0x40
@@ -745,10 +744,7 @@ xdr_fhs(xdrsp, cp)
return (0);
if (!xdr_opaque(xdrsp, (caddr_t)&fhrp->fhr_fh, len))
return (0);
- if (fhrp->fhr_flag & DP_KERB)
- auth = RPCAUTH_KERB4;
- else
- auth = RPCAUTH_UNIX;
+ auth = RPCAUTH_UNIX;
len = 1;
if (!xdr_long(xdrsp, &len))
return (0);
@@ -1298,12 +1294,8 @@ hang_dirp(dp, grp, ep, flags)
ep->ex_defdir = dp;
if (grp == (struct grouplist *)NULL) {
ep->ex_defdir->dp_flag |= DP_DEFSET;
- if (flags & OP_KERB)
- ep->ex_defdir->dp_flag |= DP_KERB;
} else while (grp) {
hp = get_ht();
- if (flags & OP_KERB)
- hp->ht_flag |= DP_KERB;
hp->ht_grp = grp;
hp->ht_next = ep->ex_defdir->dp_hosts;
ep->ex_defdir->dp_hosts = hp;
@@ -1360,8 +1352,6 @@ add_dlist(dpp, newdp, grp, flags)
*/
do {
hp = get_ht();
- if (flags & OP_KERB)
- hp->ht_flag |= DP_KERB;
hp->ht_grp = grp;
hp->ht_next = dp->dp_hosts;
dp->dp_hosts = hp;
@@ -1369,8 +1359,6 @@ add_dlist(dpp, newdp, grp, flags)
} while (grp);
} else {
dp->dp_flag |= DP_DEFSET;
- if (flags & OP_KERB)
- dp->dp_flag |= DP_KERB;
}
}
@@ -1538,9 +1526,6 @@ do_opt(cpp, endcpp, ep, grp, has_hostp, exflagsp, cr)
opt_flags |= OP_MAPALL;
} else
opt_flags |= OP_MAPROOT;
- } else if (!strcmp(cpopt, "kerb") || !strcmp(cpopt, "k")) {
- *exflagsp |= MNT_EXKERB;
- opt_flags |= OP_KERB;
} else if (cpoptarg && (!strcmp(cpopt, "mask") ||
!strcmp(cpopt, "m"))) {
if (get_net(cpoptarg, &grp->gr_ptr.gt_net, 1)) {
@@ -2285,10 +2270,8 @@ check_options(dp)
if (dp == (struct dirlist *)NULL)
return (1);
- if ((opt_flags & (OP_MAPROOT | OP_MAPALL)) == (OP_MAPROOT | OP_MAPALL) ||
- (opt_flags & (OP_MAPROOT | OP_KERB)) == (OP_MAPROOT | OP_KERB) ||
- (opt_flags & (OP_MAPALL | OP_KERB)) == (OP_MAPALL | OP_KERB)) {
- syslog(LOG_ERR, "-mapall, -maproot and -kerb mutually exclusive");
+ if ((opt_flags & (OP_MAPROOT | OP_MAPALL)) == (OP_MAPROOT | OP_MAPALL)) {
+ syslog(LOG_ERR, "-mapall and -maproot mutually exclusive");
return (1);
}
if ((opt_flags & OP_MASK) && (opt_flags & OP_NET) == 0) {
diff --git a/usr.sbin/nfsd/Makefile b/usr.sbin/nfsd/Makefile
index 5a89c6e..c03b8f5 100644
--- a/usr.sbin/nfsd/Makefile
+++ b/usr.sbin/nfsd/Makefile
@@ -2,14 +2,6 @@
# $FreeBSD$
PROG= nfsd
-CFLAGS+=-DNFS
MAN= nfsd.8
-.if exists(${DESTDIR}/usr/lib/libkrb.a) && defined(MAKE_KERBEROS4)
-CFLAGS+=-DKERBEROS
-DPADD+= ${LIBKRB} ${LIBCRYPTO}
-LDADD+= -lkrb -lcrypto
-DISTRIBUTION= krb4
-.endif
-
.include <bsd.prog.mk>
diff --git a/usr.sbin/nfsd/nfsd.c b/usr.sbin/nfsd/nfsd.c
index 8937977..eadaf8d 100644
--- a/usr.sbin/nfsd/nfsd.c
+++ b/usr.sbin/nfsd/nfsd.c
@@ -60,12 +60,7 @@ static const char rcsid[] =
#include <arpa/inet.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
-#include <nfs/nfs.h>
-
-#ifdef NFSKERB
-#include <kerberosIV/des.h>
-#include <kerberosIV/krb.h>
-#endif
+#include <nfsserver/nfs.h>
#include <err.h>
#include <errno.h>
@@ -84,22 +79,6 @@ int debug = 0;
#endif
struct nfsd_srvargs nsd;
-#ifdef OLD_SETPROCTITLE
-char **Argv = NULL; /* pointer to argument vector */
-char *LastArg = NULL; /* end of argv */
-#endif
-
-#ifdef NFSKERB
-char lnam[ANAME_SZ];
-KTEXT_ST kt;
-AUTH_DAT kauth;
-char inst[INST_SZ];
-struct nfsrpc_fullblock kin, kout;
-struct nfsrpc_fullverf kverf;
-NFSKERBKEY_T kivec;
-struct timeval ktv;
-NFSKERBKEYSCHED_T kerb_keysched;
-#endif
#define MAXNFSDCNT 20
#define DEFNFSDCNT 4
@@ -111,11 +90,6 @@ void killchildren(void);
void nonfs (int);
void reapchild (int);
int setbindhost (struct addrinfo **ia, const char *bindhost, struct addrinfo hints);
-#ifdef OLD_SETPROCTITLE
-#ifdef __FreeBSD__
-void setproctitle (char *);
-#endif
-#endif
void unregistration (void);
void usage (void);
@@ -132,7 +106,6 @@ void usage (void);
* For connection based sockets, loop doing accepts. When you get a new
* socket from accept, pass the msgsock into the kernel via. nfssvc().
* The arguments are:
- * -c - support iso cltp clients
* -r - reregister with rpcbind
* -d - unregister with rpcbind
* -t - support tcp nfs clients
@@ -152,21 +125,13 @@ main(argc, argv, envp)
struct sockaddr_in6 inet6peer;
fd_set ready, sockbits;
fd_set v4bits, v6bits;
- int ch, cltpflag, connect_type_cnt, i, len, maxsock, msgsock;
+ int ch, connect_type_cnt, i, len, maxsock, msgsock;
int nfssvc_flag, on = 1, unregister, reregister, sock;
int tcp6sock, ip6flag, tcpflag, tcpsock;
int udpflag, ecode, s;
int bindhostc = 0, bindanyflag, rpcbreg, rpcbregcnt;
char **bindhost = NULL;
pid_t pid;
-#ifdef NFSKERB
- struct group *grp;
- struct passwd *pwd;
- struct ucred *cr;
- struct timeval ktv;
- char **cpp;
-#endif
-#ifdef __FreeBSD__
struct vfsconf vfc;
int error;
@@ -179,20 +144,9 @@ main(argc, argv, envp)
}
if (error)
errx(1, "NFS is not available in the running kernel");
-#endif
-
-#ifdef OLD_SETPROCTITLE
- /* Save start and extent of argv for setproctitle. */
- Argv = argv;
- if (envp == 0 || *envp == 0)
- envp = argv;
- while (*envp)
- envp++;
- LastArg = envp[-1] + strlen(envp[-1]);
-#endif
nfsdcnt = DEFNFSDCNT;
- cltpflag = unregister = reregister = tcpflag = 0;
+ unregister = reregister = tcpflag = 0;
bindanyflag = udpflag;
#define GETOPT "ah:n:rdtu"
#define USAGE "[-ardtu] [-n num_servers] [-h bindip]"
@@ -395,90 +349,12 @@ main(argc, argv, envp)
setproctitle("server");
nfssvc_flag = NFSSVC_NFSD;
nsd.nsd_nfsd = NULL;
-#ifdef NFSKERB
- if (sizeof (struct nfsrpc_fullverf) != RPCX_FULLVERF ||
- sizeof (struct nfsrpc_fullblock) != RPCX_FULLBLOCK)
- syslog(LOG_ERR, "Yikes NFSKERB structs not packed!");
- nsd.nsd_authstr = (u_char *)&kt;
- nsd.nsd_authlen = sizeof (kt);
- nsd.nsd_verfstr = (u_char *)&kverf;
- nsd.nsd_verflen = sizeof (kverf);
-#endif
while (nfssvc(nfssvc_flag, &nsd) < 0) {
- if (errno != ENEEDAUTH) {
+ if (errno) {
syslog(LOG_ERR, "nfssvc: %m");
exit(1);
}
- nfssvc_flag = NFSSVC_NFSD | NFSSVC_AUTHINFAIL;
-#ifdef NFSKERB
- /*
- * Get the Kerberos ticket out of the authenticator
- * verify it and convert the principal name to a user
- * name. The user name is then converted to a set of
- * user credentials via the password and group file.
- * Finally, decrypt the timestamp and validate it.
- * For more info see the IETF Draft "Authentication
- * in ONC RPC".
- */
- kt.length = ntohl(kt.length);
- if (gettimeofday(&ktv, (struct timezone *)0) == 0 &&
- kt.length > 0 && kt.length <=
- (RPCAUTH_MAXSIZ - 3 * NFSX_UNSIGNED)) {
- kin.w1 = NFS_KERBW1(kt);
- kt.mbz = 0;
- (void)strcpy(inst, "*");
- if (krb_rd_req(&kt, NFS_KERBSRV,
- inst, nsd.nsd_haddr, &kauth, "") == RD_AP_OK &&
- krb_kntoln(&kauth, lnam) == KSUCCESS &&
- (pwd = getpwnam(lnam)) != NULL) {
- cr = &nsd.nsd_cr;
- cr->cr_uid = pwd->pw_uid;
- cr->cr_groups[0] = pwd->pw_gid;
- cr->cr_ngroups = 1;
- setgrent();
- while ((grp = getgrent()) != NULL) {
- if (grp->gr_gid == cr->cr_groups[0])
- continue;
- for (cpp = grp->gr_mem;
- *cpp != NULL; ++cpp)
- if (!strcmp(*cpp, lnam))
- break;
- if (*cpp == NULL)
- continue;
- cr->cr_groups[cr->cr_ngroups++]
- = grp->gr_gid;
- if (cr->cr_ngroups == NGROUPS)
- break;
- }
- endgrent();
-
- /*
- * Get the timestamp verifier out of the
- * authenticator and verifier strings.
- */
- kin.t1 = kverf.t1;
- kin.t2 = kverf.t2;
- kin.w2 = kverf.w2;
- bzero((caddr_t)kivec, sizeof (kivec));
- bcopy((caddr_t)kauth.session,
- (caddr_t)nsd.nsd_key,sizeof(kauth.session));
-
- /*
- * Decrypt the timestamp verifier in CBC mode.
- */
- XXX
-
- /*
- * Validate the timestamp verifier, to
- * check that the session key is ok.
- */
- nsd.nsd_timestamp.tv_sec = ntohl(kout.t1);
- nsd.nsd_timestamp.tv_usec = ntohl(kout.t2);
- nsd.nsd_ttl = ntohl(kout.w1);
- if ((nsd.nsd_ttl - 1) == ntohl(kout.w2))
- nfssvc_flag = NFSSVC_NFSD | NFSSVC_AUTHIN;
- }
-#endif /* NFSKERB */
+ nfssvc_flag = NFSSVC_NFSD;
}
exit(0);
}
@@ -941,23 +817,3 @@ cleanup(signo)
killchildren();
exit (0);
}
-
-#ifdef OLD_SETPROCTITLE
-#ifdef __FreeBSD__
-void
-setproctitle(a)
- char *a;
-{
- register char *cp;
- char buf[80];
-
- cp = Argv[0];
- (void)snprintf(buf, sizeof(buf), "nfsd-%s", a);
- (void)strncpy(cp, buf, LastArg - cp);
- cp += strlen(cp);
- while (cp < LastArg)
- *cp++ = '\0';
- Argv[1] = NULL;
-}
-#endif /* __FreeBSD__ */
-#endif
diff --git a/usr.sbin/pstat/pstat.8 b/usr.sbin/pstat/pstat.8
index f005b2c..b38ea8d 100644
--- a/usr.sbin/pstat/pstat.8
+++ b/usr.sbin/pstat/pstat.8
@@ -342,12 +342,6 @@ I/O buffers being flushed
locally modified data exists
.It E
an earlier write failed
-.It X
-non-cacheable lease (nqnfs)
-.It O
-write lease (nqnfs)
-.It G
-lease was evicted (nqnfs)
.It A
special file accessed
.It U
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c
index a635842..cb7e404 100644
--- a/usr.sbin/pstat/pstat.c
+++ b/usr.sbin/pstat/pstat.c
@@ -61,8 +61,8 @@ static const char rcsid[] =
#include <sys/stat.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
-#include <nfs/nfs.h>
-#include <nfs/nfsnode.h>
+#include <nfsclient/nfs.h>
+#include <nfsclient/nfsnode.h>
#include <sys/ioctl.h>
#include <sys/ioctl_compat.h> /* XXX NTTYDISC is too well hidden */
#include <sys/tty.h>
@@ -537,12 +537,6 @@ nfs_print(vp)
*flags++ = 'M';
if (flag & NWRITEERR)
*flags++ = 'E';
- if (flag & NQNFSNONCACHE)
- *flags++ = 'X';
- if (flag & NQNFSWRITE)
- *flags++ = 'O';
- if (flag & NQNFSEVICTED)
- *flags++ = 'G';
if (flag & NACC)
*flags++ = 'A';
if (flag & NUPD)
diff --git a/usr.sbin/rpc.lockd/kern.c b/usr.sbin/rpc.lockd/kern.c
index b7788fd..36235f2 100644
--- a/usr.sbin/rpc.lockd/kern.c
+++ b/usr.sbin/rpc.lockd/kern.c
@@ -45,17 +45,17 @@
#include <unistd.h>
#include "nlm_prot.h"
-#include "nfs/nfs_lock.h"
+#include <nfs/rpcv2.h>
+#include <nfs/nfsproto.h>
+#include <nfsclient/nfs_lock.h>
#include "lockd.h"
#include "lockd_lock.h"
-#include <nfs/rpcv2.h>
-#include <nfs/nfsproto.h>
-#include <nfs/nfs.h>
+#include <nfsclient/nfs.h>
#define nfslockdans(_v, _ansp) \
((_ansp)->la_vers = _v, \
- nfssvc(NFSSVC_LOCKDANS, _ansp))
+ nfsclnt(NFSCLNT_LOCKDANS, _ansp))
/* Lock request owner. */
typedef struct __owner {
OpenPOWER on IntegriCloud