Don't use sys/nfs/rpcv2.h - it is part of the old kernel RPC implementation

and will be removed.
This commit is contained in:
Doug Rabson 2009-06-24 18:42:21 +00:00
parent 7083246d7c
commit 0775314b63
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=194880
12 changed files with 109 additions and 114 deletions

View File

@ -56,9 +56,9 @@ __FBSDID("$FreeBSD$");
#include <rpc/rpc.h>
#include <rpc/pmap_clnt.h>
#include <rpc/pmap_prot.h>
#include <rpcsvc/nfs_prot.h>
#include <rpcsvc/mount.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
#include <nfsclient/nfs.h>
#include <arpa/inet.h>
@ -96,7 +96,7 @@ struct nfhret {
long vers;
long auth;
long fhsize;
u_char nfh[NFSX_V3FHMAX];
u_char nfh[NFS3_FHSIZE];
};
#define BGRND 1
#define ISBGRND 2
@ -914,7 +914,7 @@ nfs_tryproto(struct addrinfo *ai, char *hostp, char *spec, char **errstr,
nfs_nb.buf = &nfs_ss;
nfs_nb.len = nfs_nb.maxlen = sizeof nfs_ss;
if (!rpcb_getaddr(RPCPROG_NFS, nfsvers, nconf, &nfs_nb,
if (!rpcb_getaddr(NFS_PROGRAM, nfsvers, nconf, &nfs_nb,
hostp)) {
if (rpc_createerr.cf_stat == RPC_PROGVERSMISMATCH &&
trymntmode == ANY) {
@ -930,7 +930,7 @@ nfs_tryproto(struct addrinfo *ai, char *hostp, char *spec, char **errstr,
}
/* Check that the server (nfsd) responds on the port we have chosen. */
clp = clnt_tli_create(RPC_ANYFD, nconf, &nfs_nb, RPCPROG_NFS, nfsvers,
clp = clnt_tli_create(RPC_ANYFD, nconf, &nfs_nb, NFS_PROGRAM, nfsvers,
0, 0);
if (clp == NULL) {
snprintf(errbuf, sizeof errbuf, "[%s] %s:%s: %s", netid,
@ -996,10 +996,10 @@ nfs_tryproto(struct addrinfo *ai, char *hostp, char *spec, char **errstr,
return (TRYRET_SUCCESS);
}
/* Send the RPCMNT_MOUNT RPC to get the root filehandle. */
/* Send the MOUNTPROC_MNT RPC to get the root filehandle. */
try.tv_sec = 10;
try.tv_usec = 0;
clp = clnt_tp_create(hostp, RPCPROG_MNT, mntvers, nconf_mnt);
clp = clnt_tp_create(hostp, MOUNTPROG, mntvers, nconf_mnt);
if (clp == NULL) {
snprintf(errbuf, sizeof errbuf, "[%s] %s:%s: %s", netid_mnt,
hostp, spec, clnt_spcreateerror("RPCMNT: clnt_create"));
@ -1009,7 +1009,7 @@ nfs_tryproto(struct addrinfo *ai, char *hostp, char *spec, char **errstr,
clp->cl_auth = authsys_create_default();
nfhret.auth = secflavor;
nfhret.vers = mntvers;
stat = clnt_call(clp, RPCMNT_MOUNT, (xdrproc_t)xdr_dir, spec,
stat = clnt_call(clp, MOUNTPROC_MNT, (xdrproc_t)xdr_dir, spec,
(xdrproc_t)xdr_fh, &nfhret,
try);
auth_destroy(clp->cl_auth);
@ -1147,7 +1147,7 @@ getnetconf_cached(const char *netid)
int
xdr_dir(XDR *xdrsp, char *dirp)
{
return (xdr_string(xdrsp, &dirp, RPCMNT_PATHLEN));
return (xdr_string(xdrsp, &dirp, MNTPATHLEN));
}
int
@ -1162,12 +1162,12 @@ xdr_fh(XDR *xdrsp, struct nfhret *np)
return (1);
switch (np->vers) {
case 1:
np->fhsize = NFSX_V2FH;
return (xdr_opaque(xdrsp, (caddr_t)np->nfh, NFSX_V2FH));
np->fhsize = NFS_FHSIZE;
return (xdr_opaque(xdrsp, (caddr_t)np->nfh, NFS_FHSIZE));
case 3:
if (!xdr_long(xdrsp, &np->fhsize))
return (0);
if (np->fhsize <= 0 || np->fhsize > NFSX_V3FHMAX)
if (np->fhsize <= 0 || np->fhsize > NFS3_FHSIZE)
return (0);
if (!xdr_opaque(xdrsp, (caddr_t)np->nfh, np->fhsize))
return (0);

View File

@ -48,7 +48,7 @@ static const char rcsid[] =
#include <netdb.h>
#include <rpc/rpc.h>
#include <nfs/rpcv2.h>
#include <rpcsvc/mount.h>
#include <ctype.h>
#include <err.h>
@ -379,16 +379,16 @@ umountfs(struct statfs *sfs)
* has been unmounted.
*/
if (ai != NULL && !(fflag & MNT_FORCE) && do_rpc) {
clp = clnt_create(hostp, RPCPROG_MNT, RPCMNT_VER1, "udp");
clp = clnt_create(hostp, MOUNTPROG, MOUNTVERS, "udp");
if (clp == NULL) {
warnx("%s: %s", hostp,
clnt_spcreateerror("RPCPROG_MNT"));
clnt_spcreateerror("MOUNTPROG"));
return (1);
}
clp->cl_auth = authsys_create_default();
try.tv_sec = 20;
try.tv_usec = 0;
clnt_stat = clnt_call(clp, RPCMNT_UMOUNT, (xdrproc_t)xdr_dir,
clnt_stat = clnt_call(clp, MOUNTPROC_UMNT, (xdrproc_t)xdr_dir,
nfsdirname, (xdrproc_t)xdr_void, (caddr_t)0, try);
if (clnt_stat != RPC_SUCCESS) {
warnx("%s: %s", hostp,
@ -583,7 +583,7 @@ int
xdr_dir(XDR *xdrsp, char *dirp)
{
return (xdr_string(xdrsp, &dirp, RPCMNT_PATHLEN));
return (xdr_string(xdrsp, &dirp, MNTPATHLEN));
}
void

View File

@ -73,7 +73,6 @@ __FBSDID("$FreeBSD$");
#include <fs/devfs/devfs_int.h>
#undef _KERNEL
#include <nfs/nfsproto.h>
#include <nfs/rpcv2.h>
#include <nfsclient/nfs.h>
#include <nfsclient/nfsnode.h>

View File

@ -53,7 +53,6 @@ static const char rcsid[] =
#include <sys/mount.h>
#include <sys/time.h>
#include <sys/sysctl.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
#include <nfsclient/nfs.h>
#include <nfsserver/nfs.h>

View File

@ -59,7 +59,7 @@ static const char rcsid[] =
#include <rpc/rpc.h>
#include <rpc/pmap_clnt.h>
#include <rpc/pmap_prot.h>
#include <nfs/rpcv2.h>
#include <rpcsvc/mount.h>
#include <stdio.h>
#include <stdlib.h>
@ -76,29 +76,29 @@ static const char rcsid[] =
struct mountlist {
struct mountlist *ml_left;
struct mountlist *ml_right;
char ml_host[RPCMNT_NAMELEN+1];
char ml_dirp[RPCMNT_PATHLEN+1];
char ml_host[MNTNAMLEN+1];
char ml_dirp[MNTPATHLEN+1];
};
struct grouplist {
struct grouplist *gr_next;
char gr_name[RPCMNT_NAMELEN+1];
char gr_name[MNTNAMLEN+1];
};
struct exportslist {
struct exportslist *ex_next;
struct grouplist *ex_groups;
char ex_dirp[RPCMNT_PATHLEN+1];
char ex_dirp[MNTPATHLEN+1];
};
static struct mountlist *mntdump;
static struct exportslist *exports;
static struct exportslist *exportslist;
static int type = 0;
void print_dump(struct mountlist *);
static void usage(void);
int xdr_mntdump(XDR *, struct mountlist **);
int xdr_exports(XDR *, struct exportslist **);
int xdr_exportslist(XDR *, struct exportslist **);
int tcp_callrpc(const char *host, int prognum, int versnum, int procnum,
xdrproc_t inproc, char *in, xdrproc_t outproc, char *out);
@ -158,16 +158,16 @@ main(argc, argv)
rpcs = DODUMP;
if (rpcs & DODUMP)
if ((estat = tcp_callrpc(host, RPCPROG_MNT, mntvers,
RPCMNT_DUMP, (xdrproc_t)xdr_void, (char *)0,
if ((estat = tcp_callrpc(host, MOUNTPROG, mntvers,
MOUNTPROC_DUMP, (xdrproc_t)xdr_void, (char *)0,
(xdrproc_t)xdr_mntdump, (char *)&mntdump)) != 0) {
clnt_perrno(estat);
errx(1, "can't do mountdump rpc");
}
if (rpcs & DOEXPORTS)
if ((estat = tcp_callrpc(host, RPCPROG_MNT, mntvers,
RPCMNT_EXPORT, (xdrproc_t)xdr_void, (char *)0,
(xdrproc_t)xdr_exports, (char *)&exports)) != 0) {
if ((estat = tcp_callrpc(host, MOUNTPROG, mntvers,
MOUNTPROC_EXPORT, (xdrproc_t)xdr_void, (char *)0,
(xdrproc_t)xdr_exportslist, (char *)&exportslist)) != 0) {
clnt_perrno(estat);
errx(1, "can't do exports rpc");
}
@ -189,7 +189,7 @@ main(argc, argv)
}
if (rpcs & DOEXPORTS) {
printf("Exports list on %s:\n", host);
exp = exports;
exp = exportslist;
while (exp) {
printf("%-35s", exp->ex_dirp);
grp = exp->ex_groups;
@ -265,10 +265,10 @@ xdr_mntdump(xdrsp, mlp)
return (0);
mp->ml_left = mp->ml_right = (struct mountlist *)0;
strp = mp->ml_host;
if (!xdr_string(xdrsp, &strp, RPCMNT_NAMELEN))
if (!xdr_string(xdrsp, &strp, MNTNAMLEN))
return (0);
strp = mp->ml_dirp;
if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN))
if (!xdr_string(xdrsp, &strp, MNTPATHLEN))
return (0);
/*
@ -327,7 +327,7 @@ xdr_mntdump(xdrsp, mlp)
* Xdr routine to retrieve exports list
*/
int
xdr_exports(xdrsp, exp)
xdr_exportslist(xdrsp, exp)
XDR *xdrsp;
struct exportslist **exp;
{
@ -345,7 +345,7 @@ xdr_exports(xdrsp, exp)
return (0);
ep->ex_groups = (struct grouplist *)0;
strp = ep->ex_dirp;
if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN))
if (!xdr_string(xdrsp, &strp, MNTPATHLEN))
return (0);
if (!xdr_bool(xdrsp, &grpbool))
return (0);
@ -354,7 +354,7 @@ xdr_exports(xdrsp, exp)
if (gp == NULL)
return (0);
strp = gp->gr_name;
if (!xdr_string(xdrsp, &strp, RPCMNT_NAMELEN))
if (!xdr_string(xdrsp, &strp, MNTNAMLEN))
return (0);
gp->gr_next = ep->ex_groups;
ep->ex_groups = gp;

View File

@ -753,7 +753,7 @@
/* #undef HAVE_NFS_PROT_HEADERS */
/* Define to 1 if you have the <nfs/rpcv2.h> header file. */
#define HAVE_NFS_RPCV2_H 1
/* #define HAVE_NFS_RPCV2_H 1 */
/* Define to 1 if you have the `nis_domain_of' function. */
/* #undef HAVE_NIS_DOMAIN_OF */

View File

@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$");
#include <rpc/pmap_clnt.h>
#include <rpc/pmap_prot.h>
#include <rpcsvc/mount.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
#include <nfs/nfssvc.h>
#include <nfsserver/nfs.h>
@ -93,8 +92,8 @@ __FBSDID("$FreeBSD$");
*/
struct mountlist {
struct mountlist *ml_next;
char ml_host[RPCMNT_NAMELEN+1];
char ml_dirp[RPCMNT_PATHLEN+1];
char ml_host[MNTNAMLEN+1];
char ml_dirp[MNTPATHLEN+1];
};
struct dirlist {
@ -398,8 +397,8 @@ main(argc, argv)
pidfile_write(pfh);
rpcb_unset(RPCPROG_MNT, RPCMNT_VER1, NULL);
rpcb_unset(RPCPROG_MNT, RPCMNT_VER3, NULL);
rpcb_unset(MOUNTPROG, MOUNTVERS, NULL);
rpcb_unset(MOUNTPROG, MOUNTVERS3, NULL);
rpc_control(RPC_SVC_CONNMAXREC_SET, &maxrec);
if (!resvport_only) {
@ -673,16 +672,16 @@ create_service(struct netconfig *nconf)
RPC_MAXDATASIZE);
if (transp != (SVCXPRT *) NULL) {
if (!svc_reg(transp, RPCPROG_MNT, RPCMNT_VER1, mntsrv,
if (!svc_reg(transp, MOUNTPROG, MOUNTVERS, mntsrv,
NULL))
syslog(LOG_ERR,
"can't register %s RPCMNT_VER1 service",
"can't register %s MOUNTVERS service",
nconf->nc_netid);
if (!force_v2) {
if (!svc_reg(transp, RPCPROG_MNT, RPCMNT_VER3,
if (!svc_reg(transp, MOUNTPROG, MOUNTVERS3,
mntsrv, NULL))
syslog(LOG_ERR,
"can't register %s RPCMNT_VER3 service",
"can't register %s MOUNTVERS3 service",
nconf->nc_netid);
}
} else
@ -720,8 +719,8 @@ create_service(struct netconfig *nconf)
memcpy(servaddr.buf, res->ai_addr, res->ai_addrlen);
servaddr.len = res->ai_addrlen;
rpcb_set(RPCPROG_MNT, RPCMNT_VER1, nconf, &servaddr);
rpcb_set(RPCPROG_MNT, RPCMNT_VER3, nconf, &servaddr);
rpcb_set(MOUNTPROG, MOUNTVERS, nconf, &servaddr);
rpcb_set(MOUNTPROG, MOUNTVERS3, nconf, &servaddr);
xcreated++;
freeaddrinfo(res);
@ -755,7 +754,7 @@ mntsrv(rqstp, transp)
int lookup_failed = 1;
struct sockaddr *saddr;
u_short sport;
char rpcpath[RPCMNT_PATHLEN + 1], dirpath[MAXPATHLEN];
char rpcpath[MNTPATHLEN + 1], dirpath[MAXPATHLEN];
int bad = 0, defset, hostset;
sigset_t sighup_mask;
@ -782,7 +781,7 @@ mntsrv(rqstp, transp)
if (!svc_sendreply(transp, (xdrproc_t)xdr_void, NULL))
syslog(LOG_ERR, "can't send reply");
return;
case RPCMNT_MOUNT:
case MOUNTPROC_MNT:
if (sport >= IPPORT_RESERVED && resvport_only) {
syslog(LOG_NOTICE,
"mount request from %s from unprivileged port",
@ -875,7 +874,7 @@ mntsrv(rqstp, transp)
syslog(LOG_ERR, "can't send reply");
sigprocmask(SIG_UNBLOCK, &sighup_mask, NULL);
return;
case RPCMNT_DUMP:
case MOUNTPROC_DUMP:
if (!svc_sendreply(transp, (xdrproc_t)xdr_mlist, (caddr_t)NULL))
syslog(LOG_ERR, "can't send reply");
else if (dolog)
@ -883,7 +882,7 @@ mntsrv(rqstp, transp)
"dump request succeeded from %s",
numerichost);
return;
case RPCMNT_UMOUNT:
case MOUNTPROC_UMNT:
if (sport >= IPPORT_RESERVED && resvport_only) {
syslog(LOG_NOTICE,
"umount request from %s from unprivileged port",
@ -912,7 +911,7 @@ mntsrv(rqstp, transp)
"umount request succeeded from %s for %s",
numerichost, dirpath);
return;
case RPCMNT_UMNTALL:
case MOUNTPROC_UMNTALL:
if (sport >= IPPORT_RESERVED && resvport_only) {
syslog(LOG_NOTICE,
"umountall request from %s from unprivileged port",
@ -930,7 +929,7 @@ mntsrv(rqstp, transp)
"umountall request succeeded from %s",
numerichost);
return;
case RPCMNT_EXPORT:
case MOUNTPROC_EXPORT:
if (!svc_sendreply(transp, (xdrproc_t)xdr_explist, (caddr_t)NULL))
if (!svc_sendreply(transp, (xdrproc_t)xdr_explist_brief,
(caddr_t)NULL))
@ -954,7 +953,7 @@ xdr_dir(xdrsp, dirp)
XDR *xdrsp;
char *dirp;
{
return (xdr_string(xdrsp, &dirp, RPCMNT_PATHLEN));
return (xdr_string(xdrsp, &dirp, MNTPATHLEN));
}
/*
@ -1013,10 +1012,10 @@ xdr_mlist(xdrsp, cp)
if (!xdr_bool(xdrsp, &true))
return (0);
strp = &mlp->ml_host[0];
if (!xdr_string(xdrsp, &strp, RPCMNT_NAMELEN))
if (!xdr_string(xdrsp, &strp, MNTNAMLEN))
return (0);
strp = &mlp->ml_dirp[0];
if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN))
if (!xdr_string(xdrsp, &strp, MNTPATHLEN))
return (0);
mlp = mlp->ml_next;
}
@ -1088,7 +1087,7 @@ put_exlist(dp, xdrsp, adp, putdefp, brief)
if (!xdr_bool(xdrsp, &true))
return (1);
strp = dp->dp_dirp;
if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN))
if (!xdr_string(xdrsp, &strp, MNTPATHLEN))
return (1);
if (adp && !strcmp(dp->dp_dirp, adp->dp_dirp)) {
gotalldir = 1;
@ -1098,7 +1097,7 @@ put_exlist(dp, xdrsp, adp, putdefp, brief)
if (!xdr_bool(xdrsp, &true))
return (1);
strp = "(...)";
if (!xdr_string(xdrsp, &strp, RPCMNT_PATHLEN))
if (!xdr_string(xdrsp, &strp, MNTPATHLEN))
return (1);
} else if ((dp->dp_flag & DP_DEFSET) == 0 &&
(gotalldir == 0 || (adp->dp_flag & DP_DEFSET) == 0)) {
@ -1110,14 +1109,14 @@ put_exlist(dp, xdrsp, adp, putdefp, brief)
return (1);
strp = grp->gr_ptr.gt_addrinfo->ai_canonname;
if (!xdr_string(xdrsp, &strp,
RPCMNT_NAMELEN))
MNTNAMLEN))
return (1);
} else if (grp->gr_type == GT_NET) {
if (!xdr_bool(xdrsp, &true))
return (1);
strp = grp->gr_ptr.gt_net.nt_name;
if (!xdr_string(xdrsp, &strp,
RPCMNT_NAMELEN))
MNTNAMLEN))
return (1);
}
hp = hp->ht_next;
@ -1216,7 +1215,7 @@ get_exportlist_one()
len = endcp-cp;
tgrp = grp = get_grp();
while (len > 0) {
if (len > RPCMNT_NAMELEN) {
if (len > MNTNAMLEN) {
getexp_err(ep, tgrp);
goto nextline;
}
@ -2718,7 +2717,7 @@ parsecred(namelist, cr)
syslog(LOG_ERR, "too many groups");
}
#define STRSIZ (RPCMNT_NAMELEN+RPCMNT_PATHLEN+50)
#define STRSIZ (MNTNAMLEN+MNTPATHLEN+50)
/*
* Routines that maintain the remote mounttab
*/
@ -2748,10 +2747,10 @@ get_mountlist()
mlp = (struct mountlist *)malloc(sizeof (*mlp));
if (mlp == (struct mountlist *)NULL)
out_of_mem();
strncpy(mlp->ml_host, host, RPCMNT_NAMELEN);
mlp->ml_host[RPCMNT_NAMELEN] = '\0';
strncpy(mlp->ml_dirp, dirp, RPCMNT_PATHLEN);
mlp->ml_dirp[RPCMNT_PATHLEN] = '\0';
strncpy(mlp->ml_host, host, MNTNAMLEN);
mlp->ml_host[MNTNAMLEN] = '\0';
strncpy(mlp->ml_dirp, dirp, MNTPATHLEN);
mlp->ml_dirp[MNTPATHLEN] = '\0';
mlp->ml_next = (struct mountlist *)NULL;
*mlpp = mlp;
mlpp = &mlp->ml_next;
@ -2813,10 +2812,10 @@ add_mlist(hostp, dirp)
mlp = (struct mountlist *)malloc(sizeof (*mlp));
if (mlp == (struct mountlist *)NULL)
out_of_mem();
strncpy(mlp->ml_host, hostp, RPCMNT_NAMELEN);
mlp->ml_host[RPCMNT_NAMELEN] = '\0';
strncpy(mlp->ml_dirp, dirp, RPCMNT_PATHLEN);
mlp->ml_dirp[RPCMNT_PATHLEN] = '\0';
strncpy(mlp->ml_host, hostp, MNTNAMLEN);
mlp->ml_host[MNTNAMLEN] = '\0';
strncpy(mlp->ml_dirp, dirp, MNTPATHLEN);
mlp->ml_dirp[MNTPATHLEN] = '\0';
mlp->ml_next = (struct mountlist *)NULL;
*mlpp = mlp;
if ((mlfile = fopen(_PATH_RMOUNTLIST, "a")) == NULL) {
@ -3049,8 +3048,8 @@ void terminate(sig)
int sig;
{
pidfile_remove(pfh);
rpcb_unset(RPCPROG_MNT, RPCMNT_VER1, NULL);
rpcb_unset(RPCPROG_MNT, RPCMNT_VER3, NULL);
rpcb_unset(MOUNTPROG, MOUNTVERS, NULL);
rpcb_unset(MOUNTPROG, MOUNTVERS3, NULL);
exit (0);
}

View File

@ -54,11 +54,10 @@ static const char rcsid[] =
#include <rpc/rpc.h>
#include <rpc/pmap_clnt.h>
#include <rpcsvc/nfs_prot.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
#include <nfsserver/nfs.h>
#include <nfs/nfssvc.h>
@ -268,8 +267,8 @@ main(int argc, char **argv)
err(1, "getnetconfigent udp failed");
nb_udp.buf = ai_udp->ai_addr;
nb_udp.len = nb_udp.maxlen = ai_udp->ai_addrlen;
if ((!rpcb_set(RPCPROG_NFS, 2, nconf_udp, &nb_udp)) ||
(!rpcb_set(RPCPROG_NFS, 3, nconf_udp, &nb_udp)))
if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp, &nb_udp)) ||
(!rpcb_set(NFS_PROGRAM, 3, nconf_udp, &nb_udp)))
err(1, "rpcb_set udp failed");
freeaddrinfo(ai_udp);
}
@ -287,8 +286,8 @@ main(int argc, char **argv)
err(1, "getnetconfigent udp6 failed");
nb_udp6.buf = ai_udp6->ai_addr;
nb_udp6.len = nb_udp6.maxlen = ai_udp6->ai_addrlen;
if ((!rpcb_set(RPCPROG_NFS, 2, nconf_udp6, &nb_udp6)) ||
(!rpcb_set(RPCPROG_NFS, 3, nconf_udp6, &nb_udp6)))
if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp6, &nb_udp6)) ||
(!rpcb_set(NFS_PROGRAM, 3, nconf_udp6, &nb_udp6)))
err(1, "rpcb_set udp6 failed");
freeaddrinfo(ai_udp6);
}
@ -306,8 +305,8 @@ main(int argc, char **argv)
err(1, "getnetconfigent tcp failed");
nb_tcp.buf = ai_tcp->ai_addr;
nb_tcp.len = nb_tcp.maxlen = ai_tcp->ai_addrlen;
if ((!rpcb_set(RPCPROG_NFS, 2, nconf_tcp, &nb_tcp)) ||
(!rpcb_set(RPCPROG_NFS, 3, nconf_tcp, &nb_tcp)))
if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp, &nb_tcp)) ||
(!rpcb_set(NFS_PROGRAM, 3, nconf_tcp, &nb_tcp)))
err(1, "rpcb_set tcp failed");
freeaddrinfo(ai_tcp);
}
@ -325,8 +324,8 @@ main(int argc, char **argv)
err(1, "getnetconfigent tcp6 failed");
nb_tcp6.buf = ai_tcp6->ai_addr;
nb_tcp6.len = nb_tcp6.maxlen = ai_tcp6->ai_addrlen;
if ((!rpcb_set(RPCPROG_NFS, 2, nconf_tcp6, &nb_tcp6)) ||
(!rpcb_set(RPCPROG_NFS, 3, nconf_tcp6, &nb_tcp6)))
if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp6, &nb_tcp6)) ||
(!rpcb_set(NFS_PROGRAM, 3, nconf_tcp6, &nb_tcp6)))
err(1, "rpcb_set tcp6 failed");
freeaddrinfo(ai_tcp6);
}
@ -492,8 +491,8 @@ main(int argc, char **argv)
err(1, "getnetconfigent udp failed");
nb_udp.buf = ai_udp->ai_addr;
nb_udp.len = nb_udp.maxlen = ai_udp->ai_addrlen;
if ((!rpcb_set(RPCPROG_NFS, 2, nconf_udp, &nb_udp)) ||
(!rpcb_set(RPCPROG_NFS, 3, nconf_udp, &nb_udp)))
if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp, &nb_udp)) ||
(!rpcb_set(NFS_PROGRAM, 3, nconf_udp, &nb_udp)))
err(1, "rpcb_set udp failed");
freeaddrinfo(ai_udp);
}
@ -561,8 +560,8 @@ main(int argc, char **argv)
err(1, "getnetconfigent udp6 failed");
nb_udp6.buf = ai_udp6->ai_addr;
nb_udp6.len = nb_udp6.maxlen = ai_udp6->ai_addrlen;
if ((!rpcb_set(RPCPROG_NFS, 2, nconf_udp6, &nb_udp6)) ||
(!rpcb_set(RPCPROG_NFS, 3, nconf_udp6, &nb_udp6)))
if ((!rpcb_set(NFS_PROGRAM, 2, nconf_udp6, &nb_udp6)) ||
(!rpcb_set(NFS_PROGRAM, 3, nconf_udp6, &nb_udp6)))
err(1, "rpcb_set udp6 failed");
freeaddrinfo(ai_udp6);
}
@ -627,8 +626,8 @@ main(int argc, char **argv)
err(1, "getnetconfigent tcp failed");
nb_tcp.buf = ai_tcp->ai_addr;
nb_tcp.len = nb_tcp.maxlen = ai_tcp->ai_addrlen;
if ((!rpcb_set(RPCPROG_NFS, 2, nconf_tcp,
&nb_tcp)) || (!rpcb_set(RPCPROG_NFS, 3,
if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp,
&nb_tcp)) || (!rpcb_set(NFS_PROGRAM, 3,
nconf_tcp, &nb_tcp)))
err(1, "rpcb_set tcp failed");
freeaddrinfo(ai_tcp);
@ -702,8 +701,8 @@ main(int argc, char **argv)
err(1, "getnetconfigent tcp6 failed");
nb_tcp6.buf = ai_tcp6->ai_addr;
nb_tcp6.len = nb_tcp6.maxlen = ai_tcp6->ai_addrlen;
if ((!rpcb_set(RPCPROG_NFS, 2, nconf_tcp6, &nb_tcp6)) ||
(!rpcb_set(RPCPROG_NFS, 3, nconf_tcp6, &nb_tcp6)))
if ((!rpcb_set(NFS_PROGRAM, 2, nconf_tcp6, &nb_tcp6)) ||
(!rpcb_set(NFS_PROGRAM, 3, nconf_tcp6, &nb_tcp6)))
err(1, "rpcb_set tcp6 failed");
freeaddrinfo(ai_tcp6);
}
@ -871,8 +870,8 @@ reapchild(__unused int signo)
void
unregistration()
{
if ((!rpcb_unset(RPCPROG_NFS, 2, NULL)) ||
(!rpcb_unset(RPCPROG_NFS, 3, NULL)))
if ((!rpcb_unset(NFS_PROGRAM, 2, NULL)) ||
(!rpcb_unset(NFS_PROGRAM, 3, NULL)))
syslog(LOG_ERR, "rpcb_unset failed");
}

View File

@ -53,7 +53,6 @@ __FBSDID("$FreeBSD$");
#include <netdb.h>
#include "nlm_prot.h"
#include <nfs/rpcv2.h>
#include <nfs/nfsproto.h>
#include <nfsclient/nfs_lock.h>

View File

@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$");
#include <sys/syslog.h>
#include <rpc/rpc.h>
#include <nfs/rpcv2.h>
#include <rpcsvc/mount.h>
#include <err.h>
#include <errno.h>
@ -120,10 +120,10 @@ read_mtab() {
return (0);
}
mtabp->mtab_time = time;
memmove(mtabp->mtab_host, hostp, RPCMNT_NAMELEN);
mtabp->mtab_host[RPCMNT_NAMELEN - 1] = '\0';
memmove(mtabp->mtab_dirp, dirp, RPCMNT_PATHLEN);
mtabp->mtab_dirp[RPCMNT_PATHLEN - 1] = '\0';
memmove(mtabp->mtab_host, hostp, MNTNAMLEN);
mtabp->mtab_host[MNTNAMLEN - 1] = '\0';
memmove(mtabp->mtab_dirp, dirp, MNTPATHLEN);
mtabp->mtab_dirp[MNTPATHLEN - 1] = '\0';
mtabp->mtab_next = (struct mtablist *)NULL;
*mtabpp = mtabp;
mtabpp = &mtabp->mtab_next;
@ -196,7 +196,7 @@ clean_mtab(char *hostp, char *dirp, int verbose) {
warnx("delete mounttab entry%s %s:%s",
(dirp == NULL) ? " by host" : "",
mtabp->mtab_host, mtabp->mtab_dirp);
bzero(mtabp->mtab_host, RPCMNT_NAMELEN);
bzero(mtabp->mtab_host, MNTNAMLEN);
}
free(host);
}

View File

@ -26,14 +26,14 @@
* $FreeBSD$
*/
#define STRSIZ (RPCMNT_NAMELEN+RPCMNT_PATHLEN+100)
#define STRSIZ (MNTNAMLEN+MNTPATHLEN+100)
#define PATH_MOUNTTAB "/var/db/mounttab"
/* Structure for /var/db/mounttab */
struct mtablist {
time_t mtab_time;
char mtab_host[RPCMNT_NAMELEN];
char mtab_dirp[RPCMNT_PATHLEN];
char mtab_host[MNTNAMLEN];
char mtab_dirp[MNTPATHLEN];
struct mtablist *mtab_next;
};

View File

@ -35,7 +35,7 @@ static const char rcsid[] =
#include <sys/mount.h>
#include <rpc/rpc.h>
#include <nfs/rpcv2.h>
#include <rpcsvc/mount.h>
#include <err.h>
#include <netdb.h>
@ -176,18 +176,18 @@ do_umntall(char *hostname) {
try.tv_sec = 3;
try.tv_usec = 0;
clp = clnt_create_timed(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp",
clp = clnt_create_timed(hostname, MOUNTPROG, MOUNTVERS, "udp",
&try);
if (clp == NULL) {
warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT"));
warnx("%s: %s", hostname, clnt_spcreateerror("MOUNTPROG"));
return (0);
}
clp->cl_auth = authunix_create_default();
clnt_stat = clnt_call(clp, RPCMNT_UMNTALL,
clnt_stat = clnt_call(clp, MOUNTPROC_UMNTALL,
(xdrproc_t)xdr_void, (caddr_t)0,
(xdrproc_t)xdr_void, (caddr_t)0, try);
if (clnt_stat != RPC_SUCCESS)
warnx("%s: %s", hostname, clnt_sperror(clp, "RPCMNT_UMNTALL"));
warnx("%s: %s", hostname, clnt_sperror(clp, "MOUNTPROC_UMNTALL"));
auth_destroy(clp->cl_auth);
clnt_destroy(clp);
return (clnt_stat == RPC_SUCCESS);
@ -204,17 +204,17 @@ do_umount(char *hostname, char *dirp) {
try.tv_sec = 3;
try.tv_usec = 0;
clp = clnt_create_timed(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp",
clp = clnt_create_timed(hostname, MOUNTPROG, MOUNTVERS, "udp",
&try);
if (clp == NULL) {
warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT"));
warnx("%s: %s", hostname, clnt_spcreateerror("MOUNTPROG"));
return (0);
}
clp->cl_auth = authsys_create_default();
clnt_stat = clnt_call(clp, RPCMNT_UMOUNT, (xdrproc_t)xdr_dir, dirp,
clnt_stat = clnt_call(clp, MOUNTPROC_UMNT, (xdrproc_t)xdr_dir, dirp,
(xdrproc_t)xdr_void, (caddr_t)0, try);
if (clnt_stat != RPC_SUCCESS)
warnx("%s: %s", hostname, clnt_sperror(clp, "RPCMNT_UMOUNT"));
warnx("%s: %s", hostname, clnt_sperror(clp, "MOUNTPROC_UMNT"));
auth_destroy(clp->cl_auth);
clnt_destroy(clp);
return (clnt_stat == RPC_SUCCESS);
@ -255,7 +255,7 @@ is_mounted(char *hostname, char *dirp) {
*/
int
xdr_dir(XDR *xdrsp, char *dirp) {
return (xdr_string(xdrsp, &dirp, RPCMNT_PATHLEN));
return (xdr_string(xdrsp, &dirp, MNTPATHLEN));
}
static void