add __RPC_GETXID macro
don't const castway __rpc_getconf and __rpc_getconfig. It might try to write const strings fix non-portable casts remove duplicated prototypes cast things to proper types remove extraneous casts to NULL fix variable cast mismatches remove register var declarations
This commit is contained in:
parent
b056680b9b
commit
deb154d2bc
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clnt_generic.c,v 1.17 2000/06/07 18:27:39 fvdl Exp $ */
|
||||
/* $NetBSD: clnt_generic.c,v 1.18 2000/07/06 03:10:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -49,6 +49,7 @@ static char sccsid[] = "@(#)clnt_generic.c 1.32 89/03/16 Copyr 1988 Sun Micro";
|
|||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/nettype.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
@ -100,13 +101,13 @@ clnt_create_vers(hostname, prog, vers_out, vers_low, vers_high, nettype)
|
|||
minvers = rpcerr.re_vers.low;
|
||||
maxvers = rpcerr.re_vers.high;
|
||||
if (maxvers < vers_high)
|
||||
vers_high = maxvers;
|
||||
vers_high = (rpcvers_t)maxvers;
|
||||
if (minvers > vers_low)
|
||||
vers_low = minvers;
|
||||
vers_low = (rpcvers_t)minvers;
|
||||
if (vers_low > vers_high) {
|
||||
goto error;
|
||||
}
|
||||
CLNT_CONTROL(clnt, CLSET_VERS, (char *)&vers_high);
|
||||
CLNT_CONTROL(clnt, CLSET_VERS, (char *)(void *)&vers_high);
|
||||
rpc_stat = clnt_call(clnt, NULLPROC, (xdrproc_t) xdr_void,
|
||||
(char *) NULL, (xdrproc_t) xdr_void,
|
||||
(char *) NULL, to);
|
||||
|
@ -151,12 +152,12 @@ clnt_create(hostname, prog, vers, nettype)
|
|||
struct rpc_err save_cf_error;
|
||||
|
||||
|
||||
if ((handle = __rpc_setconf((char *) nettype)) == NULL) {
|
||||
if ((handle = __rpc_setconf(nettype)) == NULL) {
|
||||
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
|
||||
return ((CLIENT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
rpc_createerr.cf_stat = RPC_SUCCESS;
|
||||
while (clnt == (CLIENT *)NULL) {
|
||||
while (clnt == NULL) {
|
||||
if ((nconf = __rpc_getconf(handle)) == NULL) {
|
||||
if (rpc_createerr.cf_stat == RPC_SUCCESS)
|
||||
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
|
||||
|
@ -210,17 +211,17 @@ clnt_create(hostname, prog, vers, nettype)
|
|||
*/
|
||||
CLIENT *
|
||||
clnt_tp_create(hostname, prog, vers, nconf)
|
||||
const char *hostname; /* server name */
|
||||
const char *hostname; /* server name */
|
||||
rpcprog_t prog; /* program number */
|
||||
rpcvers_t vers; /* version number */
|
||||
const register struct netconfig *nconf; /* net config struct */
|
||||
const struct netconfig *nconf; /* net config struct */
|
||||
{
|
||||
struct netbuf *svcaddr; /* servers address */
|
||||
CLIENT *cl = NULL; /* client handle */
|
||||
|
||||
if (nconf == (struct netconfig *)NULL) {
|
||||
if (nconf == NULL) {
|
||||
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
|
||||
return ((CLIENT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -229,9 +230,9 @@ clnt_tp_create(hostname, prog, vers, nconf)
|
|||
if ((svcaddr = __rpcb_findaddr(prog, vers, nconf, hostname,
|
||||
&cl)) == NULL) {
|
||||
/* appropriate error number is set by rpcbind libraries */
|
||||
return ((CLIENT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
if (cl == (CLIENT *)NULL) {
|
||||
if (cl == NULL) {
|
||||
cl = clnt_tli_create(RPC_ANYFD, nconf, svcaddr,
|
||||
prog, vers, 0, 0);
|
||||
} else {
|
||||
|
@ -264,9 +265,9 @@ clnt_tp_create(hostname, prog, vers, nconf)
|
|||
*/
|
||||
CLIENT *
|
||||
clnt_tli_create(fd, nconf, svcaddr, prog, vers, sendsz, recvsz)
|
||||
register int fd; /* fd */
|
||||
int fd; /* fd */
|
||||
const struct netconfig *nconf; /* netconfig structure */
|
||||
const struct netbuf *svcaddr; /* servers address */
|
||||
const struct netbuf *svcaddr; /* servers address */
|
||||
rpcprog_t prog; /* program number */
|
||||
rpcvers_t vers; /* version number */
|
||||
u_int sendsz; /* send size */
|
||||
|
@ -279,9 +280,9 @@ clnt_tli_create(fd, nconf, svcaddr, prog, vers, sendsz, recvsz)
|
|||
struct __rpc_sockinfo si;
|
||||
|
||||
if (fd == RPC_ANYFD) {
|
||||
if (nconf == (struct netconfig *)NULL) {
|
||||
if (nconf == NULL) {
|
||||
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
|
||||
return ((CLIENT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
fd = __rpc_nconf2fd(nconf);
|
||||
|
@ -328,7 +329,7 @@ clnt_tli_create(fd, nconf, svcaddr, prog, vers, sendsz, recvsz)
|
|||
goto err;
|
||||
}
|
||||
|
||||
if (cl == (CLIENT *)NULL)
|
||||
if (cl == NULL)
|
||||
goto err1; /* borrow errors from clnt_dg/vc creates */
|
||||
if (nconf) {
|
||||
cl->cl_netid = strdup(nconf->nc_netid);
|
||||
|
@ -338,7 +339,7 @@ clnt_tli_create(fd, nconf, svcaddr, prog, vers, sendsz, recvsz)
|
|||
cl->cl_tp = "";
|
||||
}
|
||||
if (madefd) {
|
||||
(void) CLNT_CONTROL(cl, CLSET_FD_CLOSE, (char *)NULL);
|
||||
(void) CLNT_CONTROL(cl, CLSET_FD_CLOSE, NULL);
|
||||
/* (void) CLNT_CONTROL(cl, CLSET_POP_TIMOD, (char *) NULL); */
|
||||
};
|
||||
|
||||
|
@ -349,5 +350,5 @@ err:
|
|||
rpc_createerr.cf_error.re_errno = errno;
|
||||
err1: if (madefd)
|
||||
(void) close(fd);
|
||||
return ((CLIENT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clnt_raw.c,v 1.17 2000/06/02 23:11:08 fvdl Exp $ */
|
||||
/* $NetBSD: clnt_raw.c,v 1.18 2000/07/06 03:10:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)clnt_raw.c 1.22 87/08/11 Copyr 1984 Sun Micro";
|
||||
static char *sccsid = "@(#)clnt_raw.c 2.2 88/08/01 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: clnt_raw.c,v 1.17 2000/06/02 23:11:08 fvdl Exp $");
|
||||
__RCSID("$NetBSD: clnt_raw.c,v 1.18 2000/07/06 03:10:34 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -185,7 +185,7 @@ call_again:
|
|||
XDR_SETPOS(xdrs, 0);
|
||||
clp->u.mashl_rpcmsg.rm_xid ++ ;
|
||||
if ((! XDR_PUTBYTES(xdrs, clp->u.mashl_callmsg, clp->mcnt)) ||
|
||||
(! XDR_PUTLONG(xdrs, (long *)&proc)) ||
|
||||
(! XDR_PUTLONG(xdrs, (long *)(void *)&proc)) ||
|
||||
(! AUTH_MARSHALL(h->cl_auth, xdrs)) ||
|
||||
(! (*xargs)(xdrs, argsp))) {
|
||||
return (RPC_CANTENCODEARGS);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clnt_simple.c,v 1.20 2000/06/02 23:11:08 fvdl Exp $ */
|
||||
/* $NetBSD: clnt_simple.c,v 1.21 2000/07/06 03:10:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -86,7 +86,7 @@ static void rpc_call_destroy __P((void *));
|
|||
static void
|
||||
rpc_call_destroy(void *vp)
|
||||
{
|
||||
register struct rpc_call_private *rcp = (struct rpc_call_private *)vp;
|
||||
struct rpc_call_private *rcp = (struct rpc_call_private *)vp;
|
||||
|
||||
if (rcp) {
|
||||
if (rcp->client)
|
||||
|
@ -138,9 +138,9 @@ rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
|
|||
#else
|
||||
rcp = rpc_call_private_main;
|
||||
#endif
|
||||
if (rcp == (struct rpc_call_private *)NULL) {
|
||||
rcp = (struct rpc_call_private *)malloc(sizeof (*rcp));
|
||||
if (rcp == (struct rpc_call_private *)NULL) {
|
||||
if (rcp == NULL) {
|
||||
rcp = malloc(sizeof (*rcp));
|
||||
if (rcp == NULL) {
|
||||
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
|
||||
rpc_createerr.cf_error.re_errno = errno;
|
||||
return (rpc_createerr.cf_stat);
|
||||
|
@ -169,7 +169,7 @@ rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
|
|||
*/
|
||||
rcp->client = clnt_create(host, prognum, versnum, nettype);
|
||||
rcp->pid = getpid();
|
||||
if (rcp->client == (CLIENT *)NULL) {
|
||||
if (rcp->client == NULL) {
|
||||
return (rpc_createerr.cf_stat);
|
||||
}
|
||||
/*
|
||||
|
@ -180,8 +180,8 @@ rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
|
|||
timeout.tv_usec = 0;
|
||||
timeout.tv_sec = 5;
|
||||
(void) CLNT_CONTROL(rcp->client,
|
||||
CLSET_RETRY_TIMEOUT, (char *) &timeout);
|
||||
if (CLNT_CONTROL(rcp->client, CLGET_FD, (char *)&fd))
|
||||
CLSET_RETRY_TIMEOUT, (char *)(void *)&timeout);
|
||||
if (CLNT_CONTROL(rcp->client, CLGET_FD, (char *)(void *)&fd))
|
||||
fcntl(fd, F_SETFD, 1); /* make it "close on exec" */
|
||||
rcp->prognum = prognum;
|
||||
rcp->versnum = versnum;
|
||||
|
@ -196,8 +196,9 @@ rpc_call(host, prognum, versnum, procnum, inproc, in, outproc, out, nettype)
|
|||
} /* else reuse old client */
|
||||
tottimeout.tv_sec = 25;
|
||||
tottimeout.tv_usec = 0;
|
||||
clnt_stat = CLNT_CALL(rcp->client, procnum, inproc, (char *) in, outproc,
|
||||
out, tottimeout);
|
||||
/*LINTED const castaway*/
|
||||
clnt_stat = CLNT_CALL(rcp->client, procnum, inproc, (char *) in,
|
||||
outproc, out, tottimeout);
|
||||
/*
|
||||
* if call failed, empty cache
|
||||
*/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clnt_vc.c,v 1.2 2000/06/04 03:55:20 thorpej Exp $ */
|
||||
/* $NetBSD: clnt_vc.c,v 1.3 2000/07/06 03:10:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -36,7 +36,7 @@ static char *sccsid = "@(#)clnt_tcp.c 1.37 87/10/05 Copyr 1984 Sun Micro";
|
|||
static char *sccsid = "@(#)clnt_tcp.c 2.2 88/08/01 4.0 RPCSRC";
|
||||
static char sccsid[] = "@(#)clnt_vc.c 1.19 89/03/16 Copyr 1988 Sun Micro";
|
||||
#else
|
||||
__RCSID("$NetBSD: clnt_vc.c,v 1.2 2000/06/04 03:55:20 thorpej Exp $");
|
||||
__RCSID("$NetBSD: clnt_vc.c,v 1.3 2000/07/06 03:10:34 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -178,14 +178,14 @@ clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
|
|||
if (disrupt == 0)
|
||||
disrupt = (u_int32_t)(long)raddr;
|
||||
|
||||
h = (CLIENT *)mem_alloc(sizeof(*h));
|
||||
h = mem_alloc(sizeof(*h));
|
||||
if (h == NULL) {
|
||||
warnx("clnt_vc_create: out of memory");
|
||||
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
|
||||
rpc_createerr.cf_error.re_errno = errno;
|
||||
goto fooy;
|
||||
}
|
||||
ct = (struct ct_data *)mem_alloc(sizeof(*ct));
|
||||
ct = mem_alloc(sizeof(*ct));
|
||||
if (ct == NULL) {
|
||||
warnx("clnt_vc_create: out of memory");
|
||||
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
|
||||
|
@ -233,7 +233,7 @@ clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
|
|||
* XXX - fvdl connecting while holding a mutex?
|
||||
*/
|
||||
slen = sizeof ss;
|
||||
if (getpeername(fd, (struct sockaddr *)&ss, &slen) < 0) {
|
||||
if (getpeername(fd, (struct sockaddr *)(void *)&ss, &slen) < 0) {
|
||||
if (errno != ENOTCONN) {
|
||||
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
|
||||
rpc_createerr.cf_error.re_errno = errno;
|
||||
|
@ -270,9 +270,8 @@ clnt_vc_create(fd, raddr, prog, vers, sendsz, recvsz)
|
|||
/*
|
||||
* Initialize call message
|
||||
*/
|
||||
(void)gettimeofday(&now, (struct timezone *)0);
|
||||
call_msg.rm_xid =
|
||||
(u_int32_t)((++disrupt) ^ getpid() ^ now.tv_sec ^ now.tv_usec);
|
||||
(void)gettimeofday(&now, NULL);
|
||||
call_msg.rm_xid = ((u_int32_t)++disrupt) ^ __RPC_GETXID(&now);
|
||||
call_msg.rm_direction = CALL;
|
||||
call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
|
||||
call_msg.rm_call.cb_prog = (u_int32_t)prog;
|
||||
|
@ -313,7 +312,7 @@ fooy:
|
|||
mem_free(ct, sizeof(struct ct_data));
|
||||
if (h)
|
||||
mem_free(h, sizeof(CLIENT));
|
||||
return ((CLIENT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
static enum clnt_stat
|
||||
|
@ -359,7 +358,7 @@ clnt_vc_call(h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout)
|
|||
}
|
||||
|
||||
shipnow =
|
||||
(xdr_results == (xdrproc_t)0 && timeout.tv_sec == 0
|
||||
(xdr_results == NULL && timeout.tv_sec == 0
|
||||
&& timeout.tv_usec == 0) ? FALSE : TRUE;
|
||||
|
||||
call_again:
|
||||
|
@ -367,7 +366,7 @@ call_again:
|
|||
ct->ct_error.re_status = RPC_SUCCESS;
|
||||
x_id = ntohl(--(*msg_x_id));
|
||||
if ((! XDR_PUTBYTES(xdrs, ct->ct_u.ct_mcallc, ct->ct_mpos)) ||
|
||||
(! XDR_PUTLONG(xdrs, (long *)&proc)) ||
|
||||
(! XDR_PUTLONG(xdrs, (long *)(void *)&proc)) ||
|
||||
(! AUTH_MARSHALL(h->cl_auth, xdrs)) ||
|
||||
(! (*xdr_args)(xdrs, args_ptr))) {
|
||||
if (ct->ct_error.re_status == RPC_SUCCESS)
|
||||
|
@ -549,7 +548,7 @@ clnt_vc_control(cl, request, info)
|
|||
}
|
||||
switch (request) {
|
||||
case CLSET_TIMEOUT:
|
||||
if (time_not_ok((struct timeval *)info)) {
|
||||
if (time_not_ok((struct timeval *)(void *)info)) {
|
||||
release_fd_lock(ct->ct_fd, mask);
|
||||
return (FALSE);
|
||||
}
|
||||
|
@ -560,14 +559,14 @@ clnt_vc_control(cl, request, info)
|
|||
*(struct timeval *)infop = ct->ct_wait;
|
||||
break;
|
||||
case CLGET_SERVER_ADDR:
|
||||
(void) memcpy(info, ct->ct_addr.buf, (int)ct->ct_addr.len);
|
||||
(void) memcpy(info, ct->ct_addr.buf, (size_t)ct->ct_addr.len);
|
||||
break;
|
||||
case CLGET_FD:
|
||||
*(int *)info = ct->ct_fd;
|
||||
*(int *)(void *)info = ct->ct_fd;
|
||||
break;
|
||||
case CLGET_SVC_ADDR:
|
||||
/* The caller should not free this memory area */
|
||||
*(struct netbuf *)info = ct->ct_addr;
|
||||
*(struct netbuf *)(void *)info = ct->ct_addr;
|
||||
break;
|
||||
case CLSET_SVC_ADDR: /* set to new address */
|
||||
release_fd_lock(ct->ct_fd, mask);
|
||||
|
@ -578,12 +577,13 @@ clnt_vc_control(cl, request, info)
|
|||
* first element in the call structure
|
||||
* This will get the xid of the PREVIOUS call
|
||||
*/
|
||||
*(u_int32_t *)info = ntohl(*(u_int32_t *)&ct->ct_u.ct_mcalli);
|
||||
*(u_int32_t *)(void *)info =
|
||||
ntohl(*(u_int32_t *)(void *)&ct->ct_u.ct_mcalli);
|
||||
break;
|
||||
case CLSET_XID:
|
||||
/* This will set the xid of the NEXT call */
|
||||
*(u_int32_t *)&ct->ct_u.ct_mcalli =
|
||||
htonl(*(u_int32_t *)info + 1);
|
||||
*(u_int32_t *)(void *)&ct->ct_u.ct_mcalli =
|
||||
htonl(*((u_int32_t *)(void *)info) + 1);
|
||||
/* increment by 1 as clnt_vc_call() decrements once */
|
||||
break;
|
||||
case CLGET_VERS:
|
||||
|
@ -593,13 +593,15 @@ clnt_vc_control(cl, request, info)
|
|||
* begining of the RPC header. MUST be changed if the
|
||||
* call_struct is changed
|
||||
*/
|
||||
*(u_int32_t *)info = ntohl(*(u_int32_t *)(ct->ct_u.ct_mcallc +
|
||||
4 * BYTES_PER_XDR_UNIT));
|
||||
*(u_int32_t *)(void *)info =
|
||||
ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
|
||||
4 * BYTES_PER_XDR_UNIT));
|
||||
break;
|
||||
|
||||
case CLSET_VERS:
|
||||
*(u_int32_t *)(ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT) =
|
||||
htonl(*(u_int32_t *)info);
|
||||
*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
|
||||
4 * BYTES_PER_XDR_UNIT) =
|
||||
htonl(*(u_int32_t *)(void *)info);
|
||||
break;
|
||||
|
||||
case CLGET_PROG:
|
||||
|
@ -609,13 +611,15 @@ clnt_vc_control(cl, request, info)
|
|||
* begining of the RPC header. MUST be changed if the
|
||||
* call_struct is changed
|
||||
*/
|
||||
*(u_int32_t *)info = ntohl(*(u_int32_t *)(ct->ct_u.ct_mcallc +
|
||||
3 * BYTES_PER_XDR_UNIT));
|
||||
*(u_int32_t *)(void *)info =
|
||||
ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
|
||||
3 * BYTES_PER_XDR_UNIT));
|
||||
break;
|
||||
|
||||
case CLSET_PROG:
|
||||
*(u_int32_t *)(ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT) =
|
||||
htonl(*(u_int32_t *)info);
|
||||
*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc +
|
||||
3 * BYTES_PER_XDR_UNIT) =
|
||||
htonl(*(u_int32_t *)(void *)info);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: getnetconfig.c,v 1.2 2000/07/03 12:08:13 christos Exp $ */
|
||||
/* $NetBSD: getnetconfig.c,v 1.3 2000/07/06 03:10:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -46,6 +46,8 @@ static char sccsid[] = "@(#)getnetconfig.c 1.12 91/12/19 SMI";
|
|||
#include <netconfig.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include "rpc_com.h"
|
||||
|
||||
#ifdef __weak_alias
|
||||
__weak_alias(getnetconfig,_getnetconfig)
|
||||
|
@ -126,7 +128,6 @@ struct netconfig_vars {
|
|||
#define NC_INVALID 0
|
||||
|
||||
|
||||
extern char *_get_next_token __P((char *, char)); /* getnetpath.c */
|
||||
static int *__nc_error __P((void));
|
||||
static int parse_ncp __P((char *, struct netconfig *));
|
||||
static struct netconfig *dup_ncp __P((struct netconfig *));
|
||||
|
@ -463,7 +464,7 @@ getnetconfigent(netid)
|
|||
break;
|
||||
}
|
||||
if (strlen(netid) == (len = tmpp - stringp) && /* a match */
|
||||
strncmp(stringp, netid, len) == 0) {
|
||||
strncmp(stringp, netid, (size_t)len) == 0) {
|
||||
if ((ncp = (struct netconfig *)
|
||||
malloc(sizeof (struct netconfig))) == NULL) {
|
||||
break;
|
||||
|
@ -590,9 +591,9 @@ struct netconfig *ncp; /* where to put results */
|
|||
ncp->nc_nlookups = 0;
|
||||
while ((cp = tokenp) != NULL) {
|
||||
tokenp = _get_next_token(cp, ',');
|
||||
ncp->nc_lookups[ncp->nc_nlookups++] = cp;
|
||||
ncp->nc_lookups[(size_t)ncp->nc_nlookups++] = cp;
|
||||
ncp->nc_lookups = (char **)realloc(ncp->nc_lookups,
|
||||
(ncp->nc_nlookups+1) *sizeof(char *)); /* for next loop */
|
||||
(size_t)(ncp->nc_nlookups+1) *sizeof(char *)); /* for next loop */
|
||||
}
|
||||
}
|
||||
return (0);
|
||||
|
@ -670,7 +671,7 @@ struct netconfig *ncp;
|
|||
p->nc_proto = (char *)strcpy(tmp,ncp->nc_proto);
|
||||
tmp = strchr(tmp, NULL) + 1;
|
||||
p->nc_device = (char *)strcpy(tmp,ncp->nc_device);
|
||||
p->nc_lookups = (char **)malloc((p->nc_nlookups+1) * sizeof(char *));
|
||||
p->nc_lookups = (char **)malloc((size_t)(p->nc_nlookups+1) * sizeof(char *));
|
||||
if (p->nc_lookups == NULL) {
|
||||
free(p->nc_netid);
|
||||
return(NULL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: getnetpath.c,v 1.2 2000/06/11 16:26:53 assar Exp $ */
|
||||
/* $NetBSD: getnetpath.c,v 1.3 2000/07/06 03:10:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -73,7 +73,7 @@ struct netpath_vars {
|
|||
#define NP_VALID 0xf00d
|
||||
#define NP_INVALID 0
|
||||
|
||||
char *_get_next_token __P((char *, char));
|
||||
char *_get_next_token __P((char *, int));
|
||||
|
||||
|
||||
/*
|
||||
|
@ -108,7 +108,7 @@ setnetpath()
|
|||
}
|
||||
np_sessionp->valid = NP_VALID;
|
||||
np_sessionp->ncp_list = NULL;
|
||||
if ((npp = getenv(NETPATH)) == (char *)NULL) {
|
||||
if ((npp = getenv(NETPATH)) == NULL) {
|
||||
np_sessionp->netpath = NULL;
|
||||
} else {
|
||||
(void) endnetconfig(np_sessionp->nc_handlep);/* won't need nc session*/
|
||||
|
@ -239,7 +239,7 @@ endnetpath(handlep)
|
|||
char *
|
||||
_get_next_token(npp, token)
|
||||
char *npp; /* string */
|
||||
char token; /* char to parse string for */
|
||||
int token; /* char to parse string for */
|
||||
{
|
||||
char *cp; /* char pointer */
|
||||
char *np; /* netpath pointer */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap_clnt.c,v 1.15 2000/06/02 23:11:12 fvdl Exp $ */
|
||||
/* $NetBSD: pmap_clnt.c,v 1.16 2000/07/06 03:10:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)pmap_clnt.c 1.37 87/08/11 Copyr 1984 Sun Micro";
|
||||
static char *sccsid = "@(#)pmap_clnt.c 2.2 88/08/01 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: pmap_clnt.c,v 1.15 2000/06/02 23:11:12 fvdl Exp $");
|
||||
__RCSID("$NetBSD: pmap_clnt.c,v 1.16 2000/07/06 03:10:34 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -53,6 +53,7 @@ __RCSID("$NetBSD: pmap_clnt.c,v 1.15 2000/06/02 23:11:12 fvdl Exp $");
|
|||
#include <rpc/rpc.h>
|
||||
#include <rpc/pmap_prot.h>
|
||||
#include <rpc/pmap_clnt.h>
|
||||
#include <rpc/nettype.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -64,8 +65,6 @@ __weak_alias(pmap_set,_pmap_set)
|
|||
__weak_alias(pmap_unset,_pmap_unset)
|
||||
#endif
|
||||
|
||||
static const struct timeval tottimeout = { 60, 0 };
|
||||
|
||||
bool_t
|
||||
pmap_set(u_long program, u_long version, int protocol, int port)
|
||||
{
|
||||
|
@ -81,14 +80,14 @@ pmap_set(u_long program, u_long version, int protocol, int port)
|
|||
if (nconf == NULL) {
|
||||
return (FALSE);
|
||||
}
|
||||
snprintf(buf, sizeof buf, "0.0.0.0.%d.%d", port >> 8 & 0xff,
|
||||
port & 0xff);
|
||||
snprintf(buf, sizeof buf, "0.0.0.0.%d.%d",
|
||||
(((u_int32_t)port) >> 8) & 0xff, port & 0xff);
|
||||
na = uaddr2taddr(nconf, buf);
|
||||
if (na == NULL) {
|
||||
freenetconfigent(nconf);
|
||||
return (FALSE);
|
||||
}
|
||||
rslt = rpcb_set(program, version, nconf, na);
|
||||
rslt = rpcb_set((rpcprog_t)program, (rpcvers_t)version, nconf, na);
|
||||
free(na);
|
||||
freenetconfigent(nconf);
|
||||
return (rslt);
|
||||
|
@ -107,12 +106,14 @@ pmap_unset(u_long program, u_long version)
|
|||
|
||||
nconf = __rpc_getconfip("udp");
|
||||
if (nconf != NULL) {
|
||||
udp_rslt = rpcb_unset(program, version, nconf);
|
||||
udp_rslt = rpcb_unset((rpcprog_t)program, (rpcvers_t)version,
|
||||
nconf);
|
||||
freenetconfigent(nconf);
|
||||
}
|
||||
nconf = __rpc_getconfip("tcp");
|
||||
if (nconf != NULL) {
|
||||
tcp_rslt = rpcb_unset(program, version, nconf);
|
||||
tcp_rslt = rpcb_unset((rpcprog_t)program, (rpcvers_t)version,
|
||||
nconf);
|
||||
freenetconfigent(nconf);
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap_getmaps.c,v 1.15 2000/01/22 22:19:18 mycroft Exp $ */
|
||||
/* $NetBSD: pmap_getmaps.c,v 1.16 2000/07/06 03:10:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)pmap_getmaps.c 1.10 87/08/11 Copyr 1984 Sun Micro";
|
||||
static char *sccsid = "@(#)pmap_getmaps.c 2.2 88/08/01 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: pmap_getmaps.c,v 1.15 2000/01/22 22:19:18 mycroft Exp $");
|
||||
__RCSID("$NetBSD: pmap_getmaps.c,v 1.16 2000/07/06 03:10:34 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -80,7 +80,7 @@ struct pmaplist *
|
|||
pmap_getmaps(address)
|
||||
struct sockaddr_in *address;
|
||||
{
|
||||
struct pmaplist *head = (struct pmaplist *)NULL;
|
||||
struct pmaplist *head = NULL;
|
||||
int sock = -1;
|
||||
struct timeval minutetimeout;
|
||||
CLIENT *client;
|
||||
|
@ -92,8 +92,9 @@ pmap_getmaps(address)
|
|||
address->sin_port = htons(PMAPPORT);
|
||||
client = clnttcp_create(address, PMAPPROG,
|
||||
PMAPVERS, &sock, 50, 500);
|
||||
if (client != (CLIENT *)NULL) {
|
||||
if (CLNT_CALL(client, PMAPPROC_DUMP, (xdrproc_t)xdr_void, NULL,
|
||||
if (client != NULL) {
|
||||
if (CLNT_CALL(client, (rpcproc_t)PMAPPROC_DUMP,
|
||||
(xdrproc_t)xdr_void, NULL,
|
||||
(xdrproc_t)xdr_pmaplist, &head, minutetimeout) !=
|
||||
RPC_SUCCESS) {
|
||||
clnt_perror(client, "pmap_getmaps rpc problem");
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap_getport.c,v 1.15 2000/01/22 22:19:18 mycroft Exp $ */
|
||||
/* $NetBSD: pmap_getport.c,v 1.16 2000/07/06 03:10:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)pmap_getport.c 1.9 87/08/11 Copyr 1984 Sun Micro";
|
||||
static char *sccsid = "@(#)pmap_getport.c 2.2 88/08/01 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: pmap_getport.c,v 1.15 2000/01/22 22:19:18 mycroft Exp $");
|
||||
__RCSID("$NetBSD: pmap_getport.c,v 1.16 2000/07/06 03:10:34 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -89,12 +89,13 @@ pmap_getport(address, program, version, protocol)
|
|||
address->sin_port = htons(PMAPPORT);
|
||||
client = clntudp_bufcreate(address, PMAPPROG,
|
||||
PMAPVERS, timeout, &sock, RPCSMALLMSGSIZE, RPCSMALLMSGSIZE);
|
||||
if (client != (CLIENT *)NULL) {
|
||||
if (client != NULL) {
|
||||
parms.pm_prog = program;
|
||||
parms.pm_vers = version;
|
||||
parms.pm_prot = protocol;
|
||||
parms.pm_port = 0; /* not needed or used */
|
||||
if (CLNT_CALL(client, PMAPPROC_GETPORT, (xdrproc_t)xdr_pmap,
|
||||
if (CLNT_CALL(client, (rpcproc_t)PMAPPROC_GETPORT,
|
||||
(xdrproc_t)xdr_pmap,
|
||||
&parms, (xdrproc_t)xdr_u_short, &port, tottimeout) !=
|
||||
RPC_SUCCESS){
|
||||
rpc_createerr.cf_stat = RPC_PMAPFAILURE;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap_prot2.c,v 1.13 2000/06/02 23:11:12 fvdl Exp $ */
|
||||
/* $NetBSD: pmap_prot2.c,v 1.14 2000/07/06 03:10:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)pmap_prot2.c 1.3 87/08/11 Copyr 1984 Sun Micro";
|
||||
static char *sccsid = "@(#)pmap_prot2.c 2.1 88/07/29 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: pmap_prot2.c,v 1.13 2000/06/02 23:11:12 fvdl Exp $");
|
||||
__RCSID("$NetBSD: pmap_prot2.c,v 1.14 2000/07/06 03:10:34 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -145,5 +145,5 @@ xdr_pmaplist_ptr(xdrs, rp)
|
|||
XDR *xdrs;
|
||||
struct pmaplist *rp;
|
||||
{
|
||||
return xdr_pmaplist(xdrs, (struct pmaplist **)rp);
|
||||
return xdr_pmaplist(xdrs, (struct pmaplist **)(void *)rp);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap_rmt.c,v 1.28 2000/06/02 23:11:12 fvdl Exp $ */
|
||||
/* $NetBSD: pmap_rmt.c,v 1.29 2000/07/06 03:10:34 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)pmap_rmt.c 1.21 87/08/27 Copyr 1984 Sun Micro";
|
||||
static char *sccsid = "@(#)pmap_rmt.c 2.2 88/08/01 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: pmap_rmt.c,v 1.28 2000/06/02 23:11:12 fvdl Exp $");
|
||||
__RCSID("$NetBSD: pmap_rmt.c,v 1.29 2000/07/06 03:10:34 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -106,7 +106,7 @@ pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout,
|
|||
|
||||
addr->sin_port = htons(PMAPPORT);
|
||||
client = clntudp_create(addr, PMAPPROG, PMAPVERS, timeout, &sock);
|
||||
if (client != (CLIENT *)NULL) {
|
||||
if (client != NULL) {
|
||||
a.prog = prog;
|
||||
a.vers = vers;
|
||||
a.proc = proc;
|
||||
|
@ -115,7 +115,7 @@ pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout,
|
|||
r.port_ptr = port_ptr;
|
||||
r.results_ptr = resp;
|
||||
r.xdr_results = xdrres;
|
||||
stat = CLNT_CALL(client, PMAPPROC_CALLIT,
|
||||
stat = CLNT_CALL(client, (rpcproc_t)PMAPPROC_CALLIT,
|
||||
(xdrproc_t)xdr_rmtcall_args, &a, (xdrproc_t)xdr_rmtcallres,
|
||||
&r, tout);
|
||||
CLNT_DESTROY(client);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rpc_com.h,v 1.1 2000/06/02 23:11:12 fvdl Exp $ */
|
||||
/* $NetBSD: rpc_com.h,v 1.2 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -54,15 +54,14 @@
|
|||
#define RPC_MAXDATASIZE 9000
|
||||
#define RPC_MAXADDRSIZE 1024
|
||||
|
||||
#define __RPC_GETXID(now) ((u_int32_t)getpid() ^ (u_int32_t)(now)->tv_sec ^ \
|
||||
(u_int32_t)(now)->tv_usec)
|
||||
|
||||
__BEGIN_DECLS
|
||||
extern u_int __rpc_get_a_size __P((int));
|
||||
extern int __rpc_dtbsize __P((void));
|
||||
extern struct netconfig * __rpcgettp __P((int));
|
||||
extern int __rpc_get_default_domain __P((char **));
|
||||
void *__rpc_setconf __P((char *));
|
||||
struct netconfig *__rpc_getconf __P((void *));
|
||||
struct netconfig * __rpc_getconfip __P((char *));
|
||||
void __rpc_endconf __P((void *));
|
||||
|
||||
char *__rpc_taddr2uaddr_af __P((int, const struct netbuf *));
|
||||
struct netbuf *__rpc_uaddr2taddr_af __P((int, const char *));
|
||||
|
@ -79,6 +78,9 @@ struct netbuf *__rpcb_findaddr __P((rpcprog_t, rpcvers_t,
|
|||
const struct netconfig *,
|
||||
const char *, CLIENT **));
|
||||
bool_t __rpc_control __P((int,void *));
|
||||
|
||||
char *_get_next_token __P((char *, int));
|
||||
|
||||
__END_DECLS
|
||||
|
||||
#endif /* _RPC_RPCCOM_H */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rpc_generic.c,v 1.2 2000/06/11 16:26:53 assar Exp $ */
|
||||
/* $NetBSD: rpc_generic.c,v 1.3 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -94,8 +94,10 @@ static struct netid_af na_cvt[] = {
|
|||
{ "local", AF_LOCAL, 0 }
|
||||
};
|
||||
|
||||
#if 0
|
||||
static char *strlocase __P((char *));
|
||||
static int getnettype __P((char *));
|
||||
#endif
|
||||
static int getnettype __P((const char *));
|
||||
|
||||
/*
|
||||
* Cache the result of getrlimit(), so we don't have to do an
|
||||
|
@ -111,7 +113,7 @@ __rpc_dtbsize()
|
|||
return (tbsize);
|
||||
}
|
||||
if (getrlimit(RLIMIT_NOFILE, &rl) == 0) {
|
||||
return (tbsize = rl.rlim_max);
|
||||
return (tbsize = (int)rl.rlim_max);
|
||||
}
|
||||
/*
|
||||
* Something wrong. I'll try to save face by returning a
|
||||
|
@ -125,6 +127,7 @@ __rpc_dtbsize()
|
|||
* Find the appropriate buffer size
|
||||
*/
|
||||
u_int
|
||||
/*ARGSUSED*/
|
||||
__rpc_get_t_size(af, proto, size)
|
||||
int af, proto;
|
||||
int size; /* Size requested */
|
||||
|
@ -171,6 +174,7 @@ __rpc_get_a_size(af)
|
|||
return ((u_int)RPC_MAXADDRSIZE);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static char *
|
||||
strlocase(p)
|
||||
char *p;
|
||||
|
@ -182,6 +186,7 @@ strlocase(p)
|
|||
*p = tolower(*p);
|
||||
return (t);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Returns the type of the network as defined in <rpc/nettype.h>
|
||||
|
@ -189,7 +194,7 @@ strlocase(p)
|
|||
*/
|
||||
static int
|
||||
getnettype(nettype)
|
||||
char *nettype;
|
||||
const char *nettype;
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -197,9 +202,11 @@ getnettype(nettype)
|
|||
return (_RPC_NETPATH); /* Default */
|
||||
}
|
||||
|
||||
#if 0
|
||||
nettype = strlocase(nettype);
|
||||
#endif
|
||||
for (i = 0; _rpctypelist[i].name; i++)
|
||||
if (strcmp(nettype, _rpctypelist[i].name) == 0) {
|
||||
if (strcasecmp(nettype, _rpctypelist[i].name) == 0) {
|
||||
return (_rpctypelist[i].type);
|
||||
}
|
||||
return (_rpctypelist[i].type);
|
||||
|
@ -211,7 +218,7 @@ getnettype(nettype)
|
|||
*/
|
||||
struct netconfig *
|
||||
__rpc_getconfip(nettype)
|
||||
char *nettype;
|
||||
const char *nettype;
|
||||
{
|
||||
char *netid;
|
||||
char *netid_tcp = (char *) NULL;
|
||||
|
@ -255,7 +262,7 @@ __rpc_getconfip(nettype)
|
|||
syslog (LOG_ERR, "rpc: failed to open " NETCONFIG);
|
||||
return (NULL);
|
||||
}
|
||||
while ((nconf = getnetconfig(confighandle))) {
|
||||
while ((nconf = getnetconfig(confighandle)) != NULL) {
|
||||
if (strcmp(nconf->nc_protofmly, NC_INET) == 0) {
|
||||
if (strcmp(nconf->nc_proto, NC_TCP) == 0) {
|
||||
netid_tcp = strdup(nconf->nc_netid);
|
||||
|
@ -290,10 +297,10 @@ __rpc_getconfip(nettype)
|
|||
else if (strcmp(nettype, "tcp") == 0)
|
||||
netid = netid_tcp;
|
||||
else {
|
||||
return ((struct netconfig *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
if ((netid == NULL) || (netid[0] == NULL)) {
|
||||
return ((struct netconfig *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
dummy = getnetconfigent(netid);
|
||||
return (dummy);
|
||||
|
@ -305,7 +312,7 @@ __rpc_getconfip(nettype)
|
|||
*/
|
||||
void *
|
||||
__rpc_setconf(nettype)
|
||||
char *nettype;
|
||||
const char *nettype;
|
||||
{
|
||||
struct handle *handle;
|
||||
|
||||
|
@ -357,12 +364,12 @@ __rpc_getconf(vhandle)
|
|||
if (handle == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
while (1) {
|
||||
for (;;) {
|
||||
if (handle->nflag)
|
||||
nconf = getnetpath(handle->nhandle);
|
||||
else
|
||||
nconf = getnetconfig(handle->nhandle);
|
||||
if (nconf == (struct netconfig *)NULL)
|
||||
if (nconf == NULL)
|
||||
break;
|
||||
if ((nconf->nc_semantics != NC_TPI_CLTS) &&
|
||||
(nconf->nc_semantics != NC_TPI_COTS) &&
|
||||
|
@ -451,9 +458,9 @@ rpc_nullproc(clnt)
|
|||
{
|
||||
struct timeval TIMEOUT = {25, 0};
|
||||
|
||||
if (clnt_call(clnt, NULLPROC, (xdrproc_t) xdr_void, (char *)NULL,
|
||||
(xdrproc_t) xdr_void, (char *)NULL, TIMEOUT) != RPC_SUCCESS) {
|
||||
return ((void *) NULL);
|
||||
if (clnt_call(clnt, NULLPROC, (xdrproc_t) xdr_void, NULL,
|
||||
(xdrproc_t) xdr_void, NULL, TIMEOUT) != RPC_SUCCESS) {
|
||||
return (NULL);
|
||||
}
|
||||
return ((void *) clnt);
|
||||
}
|
||||
|
@ -475,6 +482,7 @@ __rpcgettp(fd)
|
|||
if (!__rpc_sockinfo2netid(&si, &netid))
|
||||
return NULL;
|
||||
|
||||
/*LINTED const castaway*/
|
||||
return getnetconfigent((char *)netid);
|
||||
}
|
||||
|
||||
|
@ -486,7 +494,7 @@ __rpc_fd2sockinfo(int fd, struct __rpc_sockinfo *sip)
|
|||
struct sockaddr_storage ss;
|
||||
|
||||
len = sizeof ss;
|
||||
if (getsockname(fd, (struct sockaddr *)&ss, &len) < 0)
|
||||
if (getsockname(fd, (struct sockaddr *)(void *)&ss, &len) < 0)
|
||||
return 0;
|
||||
sip->si_alen = len;
|
||||
|
||||
|
@ -525,7 +533,7 @@ __rpc_nconf2sockinfo(const struct netconfig *nconf, struct __rpc_sockinfo *sip)
|
|||
sip->si_af = na_cvt[i].af;
|
||||
sip->si_proto = na_cvt[i].protocol;
|
||||
sip->si_socktype =
|
||||
__rpc_seman2socktype(nconf->nc_semantics);
|
||||
__rpc_seman2socktype((int)nconf->nc_semantics);
|
||||
if (sip->si_socktype == -1)
|
||||
return 0;
|
||||
sip->si_alen = __rpc_get_a_size(sip->si_af);
|
||||
|
@ -602,8 +610,8 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
|
|||
== NULL)
|
||||
return NULL;
|
||||
port = ntohs(sin->sin_port);
|
||||
if (asprintf(&ret, "%s.%u.%u", namebuf, port >> 8, port & 0xff)
|
||||
< 0)
|
||||
if (asprintf(&ret, "%s.%u.%u", namebuf, ((u_int32_t)port) >> 8,
|
||||
port & 0xff) < 0)
|
||||
return NULL;
|
||||
break;
|
||||
#ifdef INET6
|
||||
|
@ -613,8 +621,8 @@ __rpc_taddr2uaddr_af(int af, const struct netbuf *nbuf)
|
|||
== NULL)
|
||||
return NULL;
|
||||
port = ntohs(sin6->sin6_port);
|
||||
if (asprintf(&ret, "%s.%u.%u", namebuf6, port >> 8, port & 0xff)
|
||||
< 0)
|
||||
if (asprintf(&ret, "%s.%u.%u", namebuf6, ((u_int32_t)port) >> 8,
|
||||
port & 0xff) < 0)
|
||||
return NULL;
|
||||
break;
|
||||
#endif
|
||||
|
@ -709,6 +717,7 @@ __rpc_uaddr2taddr_af(int af, const char *uaddr)
|
|||
memset(sun, 0, sizeof *sun);
|
||||
sun->sun_family = AF_LOCAL;
|
||||
strncpy(sun->sun_path, addrstr, sizeof(sun->sun_path) - 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -791,20 +800,22 @@ __rpc_sockisbound(int fd)
|
|||
socklen_t slen;
|
||||
|
||||
slen = sizeof (struct sockaddr_storage);
|
||||
if (getsockname(fd, (struct sockaddr *)&ss, &slen) < 0)
|
||||
if (getsockname(fd, (struct sockaddr *)(void *)&ss, &slen) < 0)
|
||||
return 0;
|
||||
|
||||
switch (ss.ss_family) {
|
||||
case AF_INET:
|
||||
return (((struct sockaddr_in *)&ss)->sin_port != 0);
|
||||
return (((struct sockaddr_in *)
|
||||
(void *)&ss)->sin_port != 0);
|
||||
#ifdef INET6
|
||||
case AF_INET6:
|
||||
return (((struct sockaddr_in6 *)&ss)->sin6_port != 0);
|
||||
return (((struct sockaddr_in6 *)
|
||||
(void *)&ss)->sin6_port != 0);
|
||||
#endif
|
||||
case AF_LOCAL:
|
||||
/* XXX check this */
|
||||
return
|
||||
(((struct sockaddr_un *)&ss)->sun_path[0] != '\0');
|
||||
return (((struct sockaddr_un *)
|
||||
(void *)&ss)->sun_path[0] != '\0');
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rpc_soc.c,v 1.5 2000/06/07 01:45:25 fvdl Exp $ */
|
||||
/* $NetBSD: rpc_soc.c,v 1.6 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -62,6 +62,7 @@ static char sccsid[] = "@(#)rpc_soc.c 1.41 89/05/02 Copyr 1988 Sun Micro";
|
|||
#include <rpc/rpc.h>
|
||||
#include <rpc/pmap_clnt.h>
|
||||
#include <rpc/pmap_prot.h>
|
||||
#include <rpc/nettype.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#include <errno.h>
|
||||
|
@ -120,7 +121,7 @@ clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, tp)
|
|||
if ((nconf = __rpc_getconfip(tp)) == NULL) {
|
||||
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
|
||||
mutex_unlock(&rpcsoc_lock);
|
||||
return ((CLIENT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
if (fd == RPC_ANYSOCK) {
|
||||
fd = __rpc_nconf2fd(nconf);
|
||||
|
@ -135,7 +136,8 @@ clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, tp)
|
|||
|
||||
mutex_unlock(&rpcsoc_lock); /* pmap_getport is recursive */
|
||||
proto = strcmp(tp, "udp") == 0 ? IPPROTO_UDP : IPPROTO_TCP;
|
||||
sport = pmap_getport(raddr, prog, vers, proto);
|
||||
sport = pmap_getport(raddr, (u_long)prog, (u_long)vers,
|
||||
proto);
|
||||
if (sport == 0) {
|
||||
goto err;
|
||||
}
|
||||
|
@ -155,7 +157,7 @@ clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, tp)
|
|||
/*
|
||||
* The fd should be closed while destroying the handle.
|
||||
*/
|
||||
(void) CLNT_CONTROL(cl, CLSET_FD_CLOSE, (char *)NULL);
|
||||
(void) CLNT_CONTROL(cl, CLSET_FD_CLOSE, NULL);
|
||||
*sockp = fd;
|
||||
}
|
||||
(void) freenetconfigent(nconf);
|
||||
|
@ -172,12 +174,12 @@ err: if (madefd == TRUE)
|
|||
(void) close(fd);
|
||||
(void) freenetconfigent(nconf);
|
||||
mutex_unlock(&rpcsoc_lock);
|
||||
return ((CLIENT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
CLIENT *
|
||||
clntudp_bufcreate(raddr, prog, vers, wait, sockp, sendsz, recvsz)
|
||||
register struct sockaddr_in *raddr;
|
||||
struct sockaddr_in *raddr;
|
||||
u_long prog;
|
||||
u_long vers;
|
||||
struct timeval wait;
|
||||
|
@ -187,11 +189,12 @@ clntudp_bufcreate(raddr, prog, vers, wait, sockp, sendsz, recvsz)
|
|||
{
|
||||
CLIENT *cl;
|
||||
|
||||
cl = clnt_com_create(raddr, prog, vers, sockp, sendsz, recvsz, "udp");
|
||||
if (cl == (CLIENT *)NULL) {
|
||||
return ((CLIENT *)NULL);
|
||||
cl = clnt_com_create(raddr, (rpcprog_t)prog, (rpcvers_t)vers, sockp,
|
||||
sendsz, recvsz, "udp");
|
||||
if (cl == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
(void) CLNT_CONTROL(cl, CLSET_RETRY_TIMEOUT, (char *)&wait);
|
||||
(void) CLNT_CONTROL(cl, CLSET_RETRY_TIMEOUT, (char *)(void *)&wait);
|
||||
return (cl);
|
||||
}
|
||||
|
||||
|
@ -212,12 +215,12 @@ clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
|
|||
struct sockaddr_in *raddr;
|
||||
u_long prog;
|
||||
u_long vers;
|
||||
register int *sockp;
|
||||
int *sockp;
|
||||
u_int sendsz;
|
||||
u_int recvsz;
|
||||
{
|
||||
return clnt_com_create(raddr, prog, vers, sockp, sendsz,
|
||||
recvsz, "tcp");
|
||||
return clnt_com_create(raddr, (rpcprog_t)prog, (rpcvers_t)vers, sockp,
|
||||
sendsz, recvsz, "tcp");
|
||||
}
|
||||
|
||||
CLIENT *
|
||||
|
@ -225,7 +228,7 @@ clntraw_create(prog, vers)
|
|||
u_long prog;
|
||||
u_long vers;
|
||||
{
|
||||
return clnt_raw_create(prog, vers);
|
||||
return clnt_raw_create((rpcprog_t)prog, (rpcvers_t)vers);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -233,7 +236,7 @@ clntraw_create(prog, vers)
|
|||
*/
|
||||
static SVCXPRT *
|
||||
svc_com_create(fd, sendsize, recvsize, netid)
|
||||
register int fd;
|
||||
int fd;
|
||||
u_int sendsize;
|
||||
u_int recvsize;
|
||||
char *netid;
|
||||
|
@ -246,7 +249,7 @@ svc_com_create(fd, sendsize, recvsize, netid)
|
|||
|
||||
if ((nconf = __rpc_getconfip(netid)) == NULL) {
|
||||
(void) syslog(LOG_ERR, "Could not get %s transport", netid);
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
if (fd == RPC_ANYSOCK) {
|
||||
fd = __rpc_nconf2fd(nconf);
|
||||
|
@ -254,7 +257,7 @@ svc_com_create(fd, sendsize, recvsize, netid)
|
|||
(void) freenetconfigent(nconf);
|
||||
(void) syslog(LOG_ERR,
|
||||
"svc%s_create: could not open connection", netid);
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
madefd = TRUE;
|
||||
}
|
||||
|
@ -263,13 +266,12 @@ svc_com_create(fd, sendsize, recvsize, netid)
|
|||
sin.sin_family = AF_INET;
|
||||
bindresvport(fd, &sin);
|
||||
listen(fd, SOMAXCONN);
|
||||
svc = svc_tli_create(fd, nconf, (struct t_bind *)NULL,
|
||||
sendsize, recvsize);
|
||||
svc = svc_tli_create(fd, nconf, NULL, sendsize, recvsize);
|
||||
(void) freenetconfigent(nconf);
|
||||
if (svc == (SVCXPRT *)NULL) {
|
||||
if (svc == NULL) {
|
||||
if (madefd)
|
||||
(void) close(fd);
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
port = (((struct sockaddr_in *)svc->xp_ltaddr.buf)->sin_port);
|
||||
svc->xp_port = ntohs(port);
|
||||
|
@ -278,7 +280,7 @@ svc_com_create(fd, sendsize, recvsize, netid)
|
|||
|
||||
SVCXPRT *
|
||||
svctcp_create(fd, sendsize, recvsize)
|
||||
register int fd;
|
||||
int fd;
|
||||
u_int sendsize;
|
||||
u_int recvsize;
|
||||
{
|
||||
|
@ -287,7 +289,7 @@ svctcp_create(fd, sendsize, recvsize)
|
|||
|
||||
SVCXPRT *
|
||||
svcudp_bufcreate(fd, sendsz, recvsz)
|
||||
register int fd;
|
||||
int fd;
|
||||
u_int sendsz, recvsz;
|
||||
{
|
||||
return svc_com_create(fd, sendsz, recvsz, "udp");
|
||||
|
@ -305,7 +307,7 @@ svcfd_create(fd, sendsize, recvsize)
|
|||
|
||||
SVCXPRT *
|
||||
svcudp_create(fd)
|
||||
register int fd;
|
||||
int fd;
|
||||
{
|
||||
return svc_com_create(fd, UDPMSGSIZE, UDPMSGSIZE, "udp");
|
||||
}
|
||||
|
@ -337,8 +339,8 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
|
|||
xdrproc_t inproc, outproc;
|
||||
char *in, *out;
|
||||
{
|
||||
return (int)rpc_call(host, (u_long)prognum, (u_long)versnum,
|
||||
(u_long)procnum, inproc, in, outproc, out, "udp");
|
||||
return (int)rpc_call(host, (rpcprog_t)prognum, (rpcvers_t)versnum,
|
||||
(rpcproc_t)procnum, inproc, in, outproc, out, "udp");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -350,8 +352,8 @@ registerrpc(prognum, versnum, procnum, progname, inproc, outproc)
|
|||
char *(*progname) __P((char [UDPMSGSIZE]));
|
||||
xdrproc_t inproc, outproc;
|
||||
{
|
||||
return rpc_reg((u_long)prognum, (u_long)versnum, (u_long)procnum,
|
||||
progname, inproc, outproc, "udp");
|
||||
return rpc_reg((rpcprog_t)prognum, (rpcvers_t)versnum,
|
||||
(rpcproc_t)procnum, progname, inproc, outproc, "udp");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -424,8 +426,9 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
|
|||
#else
|
||||
clnt_broadcast_result_main = eachresult;
|
||||
#endif
|
||||
return rpc_broadcast(prog, vers, proc, xargs, argsp, xresults,
|
||||
resultsp, (resultproc_t) rpc_wrap_bcast, "udp");
|
||||
return rpc_broadcast((rpcprog_t)prog, (rpcvers_t)vers,
|
||||
(rpcproc_t)proc, xargs, argsp, xresults, resultsp,
|
||||
(resultproc_t) rpc_wrap_bcast, "udp");
|
||||
}
|
||||
|
||||
#endif /* PORTMAP */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rpcb_clnt.c,v 1.3 2000/06/11 16:26:53 assar Exp $ */
|
||||
/* $NetBSD: rpcb_clnt.c,v 1.4 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -56,6 +56,7 @@ static char sccsid[] = "@(#)rpcb_clnt.c 1.30 89/06/21 Copyr 1988 Sun Micro";
|
|||
#include <sys/utsname.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/rpcb_prot.h>
|
||||
#include <rpc/nettype.h>
|
||||
#include <netconfig.h>
|
||||
#ifdef PORTMAP
|
||||
#include <netinet/in.h> /* FOR IPPROTO_TCP/UDP definitions */
|
||||
|
@ -296,7 +297,7 @@ getclnthandle(host, nconf, targaddr)
|
|||
const struct netconfig *nconf;
|
||||
char **targaddr;
|
||||
{
|
||||
register CLIENT *client;
|
||||
CLIENT *client;
|
||||
struct netbuf *addr, taddr;
|
||||
struct netbuf addr_to_delete;
|
||||
struct __rpc_sockinfo si;
|
||||
|
@ -312,8 +313,8 @@ getclnthandle(host, nconf, targaddr)
|
|||
ad_cache = check_cache(host, nconf->nc_netid);
|
||||
if (ad_cache != NULL) {
|
||||
addr = ad_cache->ac_taddr;
|
||||
client = clnt_tli_create(RPC_ANYFD, nconf, addr, RPCBPROG,
|
||||
RPCBVERS4, 0, 0);
|
||||
client = clnt_tli_create(RPC_ANYFD, nconf, addr,
|
||||
(rpcprog_t)RPCBPROG, (rpcvers_t)RPCBVERS4, 0, 0);
|
||||
if (client != NULL) {
|
||||
if (targaddr)
|
||||
*targaddr = ad_cache->ac_uaddr;
|
||||
|
@ -385,8 +386,8 @@ getclnthandle(host, nconf, targaddr)
|
|||
fprintf(stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
client = clnt_tli_create(RPC_ANYFD, nconf, &taddr, RPCBPROG,
|
||||
RPCBVERS4, 0, 0);
|
||||
client = clnt_tli_create(RPC_ANYFD, nconf, &taddr,
|
||||
(rpcprog_t)RPCBPROG, (rpcvers_t)RPCBVERS4, 0, 0);
|
||||
#ifdef ND_DEBUG
|
||||
if (! client) {
|
||||
clnt_pcreateerror("rpcbind clnt interface");
|
||||
|
@ -422,7 +423,8 @@ local_rpcb()
|
|||
#ifdef __REENT
|
||||
extern mutex_t loopnconf_lock;
|
||||
#endif
|
||||
int sock, tsize;
|
||||
int sock;
|
||||
size_t tsize;
|
||||
struct netbuf nbuf;
|
||||
struct sockaddr_un sun;
|
||||
|
||||
|
@ -442,7 +444,8 @@ local_rpcb()
|
|||
nbuf.buf = &sun;
|
||||
|
||||
tsize = __rpc_get_t_size(AF_LOCAL, 0, 0);
|
||||
client = clnt_vc_create(sock, &nbuf, RPCBPROG, RPCBVERS, tsize, tsize);
|
||||
client = clnt_vc_create(sock, &nbuf, (rpcprog_t)RPCBPROG,
|
||||
(rpcvers_t)RPCBVERS, tsize, tsize);
|
||||
|
||||
if (client != NULL)
|
||||
return client;
|
||||
|
@ -464,7 +467,7 @@ try_nconf:
|
|||
mutex_unlock(&loopnconf_lock);
|
||||
return (NULL);
|
||||
}
|
||||
while ((nconf = getnetconfig(nc_handle))) {
|
||||
while ((nconf = getnetconfig(nc_handle)) != NULL) {
|
||||
#ifdef INET6
|
||||
if ((strcmp(nconf->nc_protofmly, NC_INET6) == 0 ||
|
||||
#else
|
||||
|
@ -498,7 +501,7 @@ try_nconf:
|
|||
endnetconfig(nc_handle);
|
||||
}
|
||||
mutex_unlock(&loopnconf_lock);
|
||||
client = getclnthandle(hostname, loopnconf, (char **)NULL);
|
||||
client = getclnthandle(hostname, loopnconf, NULL);
|
||||
return (client);
|
||||
}
|
||||
|
||||
|
@ -513,13 +516,13 @@ rpcb_set(program, version, nconf, address)
|
|||
const struct netconfig *nconf; /* Network structure of transport */
|
||||
const struct netbuf *address; /* Services netconfig address */
|
||||
{
|
||||
register CLIENT *client;
|
||||
CLIENT *client;
|
||||
bool_t rslt = FALSE;
|
||||
RPCB parms;
|
||||
char uidbuf[32];
|
||||
|
||||
/* parameter checking */
|
||||
if (nconf == (struct netconfig *)NULL) {
|
||||
if (nconf == NULL) {
|
||||
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
|
||||
return (FALSE);
|
||||
}
|
||||
|
@ -533,6 +536,7 @@ rpcb_set(program, version, nconf, address)
|
|||
}
|
||||
|
||||
/* convert to universal */
|
||||
/*LINTED const castaway*/
|
||||
parms.r_addr = taddr2uaddr((struct netconfig *) nconf,
|
||||
(struct netbuf *)address);
|
||||
if (!parms.r_addr) {
|
||||
|
@ -550,8 +554,9 @@ rpcb_set(program, version, nconf, address)
|
|||
(void) snprintf(uidbuf, sizeof uidbuf, "%d", geteuid());
|
||||
parms.r_owner = uidbuf;
|
||||
|
||||
CLNT_CALL(client, RPCBPROC_SET, (xdrproc_t) xdr_rpcb, (char *)&parms,
|
||||
(xdrproc_t) xdr_bool, (char *)&rslt, tottimeout);
|
||||
CLNT_CALL(client, (rpcproc_t)RPCBPROC_SET, (xdrproc_t) xdr_rpcb,
|
||||
(char *)(void *)&parms, (xdrproc_t) xdr_bool,
|
||||
(char *)(void *)&rslt, tottimeout);
|
||||
|
||||
CLNT_DESTROY(client);
|
||||
free(parms.r_addr);
|
||||
|
@ -570,7 +575,7 @@ rpcb_unset(program, version, nconf)
|
|||
rpcvers_t version;
|
||||
const struct netconfig *nconf;
|
||||
{
|
||||
register CLIENT *client;
|
||||
CLIENT *client;
|
||||
bool_t rslt = FALSE;
|
||||
RPCB parms;
|
||||
char uidbuf[32];
|
||||
|
@ -584,14 +589,18 @@ rpcb_unset(program, version, nconf)
|
|||
parms.r_vers = version;
|
||||
if (nconf)
|
||||
parms.r_netid = nconf->nc_netid;
|
||||
else
|
||||
else {
|
||||
/*LINTED const castaway*/
|
||||
parms.r_netid = (char *) &nullstring[0]; /* unsets all */
|
||||
}
|
||||
/*LINTED const castaway*/
|
||||
parms.r_addr = (char *) &nullstring[0];
|
||||
(void) snprintf(uidbuf, sizeof uidbuf, "%d", geteuid());
|
||||
parms.r_owner = uidbuf;
|
||||
|
||||
CLNT_CALL(client, RPCBPROC_UNSET, (xdrproc_t) xdr_rpcb, (char *)&parms,
|
||||
(xdrproc_t) xdr_bool, (char *)&rslt, tottimeout);
|
||||
CLNT_CALL(client, (rpcproc_t)RPCBPROC_UNSET, (xdrproc_t) xdr_rpcb,
|
||||
(char *)(void *)&parms, (xdrproc_t) xdr_bool,
|
||||
(char *)(void *)&rslt, tottimeout);
|
||||
|
||||
CLNT_DESTROY(client);
|
||||
return (rslt);
|
||||
|
@ -655,7 +664,7 @@ __rpcb_findaddr(program, version, nconf, host, clpp)
|
|||
const char *host;
|
||||
CLIENT **clpp;
|
||||
{
|
||||
register CLIENT *client = NULL;
|
||||
CLIENT *client = NULL;
|
||||
RPCB parms;
|
||||
enum clnt_stat clnt_st;
|
||||
char *ua = NULL;
|
||||
|
@ -665,7 +674,7 @@ __rpcb_findaddr(program, version, nconf, host, clpp)
|
|||
struct netbuf servaddr;
|
||||
|
||||
/* parameter checking */
|
||||
if (nconf == (struct netconfig *)NULL) {
|
||||
if (nconf == NULL) {
|
||||
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -696,21 +705,21 @@ __rpcb_findaddr(program, version, nconf, host, clpp)
|
|||
} else {
|
||||
client = getclnthandle(host, nconf, &parms.r_addr);
|
||||
}
|
||||
if (client == (CLIENT *)NULL) {
|
||||
if (client == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/* Set the version */
|
||||
CLNT_CONTROL(client, CLSET_VERS, (char *)&pmapvers);
|
||||
CLNT_CONTROL(client, CLSET_VERS, (char *)(void *)&pmapvers);
|
||||
pmapparms.pm_prog = program;
|
||||
pmapparms.pm_vers = version;
|
||||
pmapparms.pm_prot = strcmp(nconf->nc_proto, NC_TCP) ?
|
||||
IPPROTO_UDP : IPPROTO_TCP;
|
||||
pmapparms.pm_port = 0; /* not needed */
|
||||
clnt_st = CLNT_CALL(client, PMAPPROC_GETPORT,
|
||||
(xdrproc_t) xdr_pmap, (caddr_t) &pmapparms,
|
||||
(xdrproc_t) xdr_u_short, (caddr_t) &port,
|
||||
tottimeout);
|
||||
clnt_st = CLNT_CALL(client, (rpcproc_t)PMAPPROC_GETPORT,
|
||||
(xdrproc_t) xdr_pmap, (caddr_t)(void *)&pmapparms,
|
||||
(xdrproc_t) xdr_u_short, (caddr_t)(void *)&port,
|
||||
tottimeout);
|
||||
if (clnt_st != RPC_SUCCESS) {
|
||||
if ((clnt_st == RPC_PROGVERSMISMATCH) ||
|
||||
(clnt_st == RPC_PROGUNAVAIL))
|
||||
|
@ -724,7 +733,7 @@ __rpcb_findaddr(program, version, nconf, host, clpp)
|
|||
goto error;
|
||||
}
|
||||
port = htons(port);
|
||||
CLNT_CONTROL(client, CLGET_SVC_ADDR, (char *)&remote);
|
||||
CLNT_CONTROL(client, CLGET_SVC_ADDR, (char *)(void *)&remote);
|
||||
if (((address = (struct netbuf *)
|
||||
malloc(sizeof (struct netbuf))) == NULL) ||
|
||||
((address->buf = (char *)
|
||||
|
@ -739,7 +748,7 @@ __rpcb_findaddr(program, version, nconf, host, clpp)
|
|||
}
|
||||
memcpy(address->buf, remote.buf, remote.len);
|
||||
memcpy(&((char *)address->buf)[sizeof (short)],
|
||||
(char *)&port, sizeof (short));
|
||||
(char *)(void *)&port, sizeof (short));
|
||||
address->len = address->maxlen = remote.len;
|
||||
goto done;
|
||||
}
|
||||
|
@ -753,6 +762,7 @@ try_rpcbind:
|
|||
*/
|
||||
parms.r_prog = program;
|
||||
parms.r_vers = version;
|
||||
/*LINTED const castaway*/
|
||||
parms.r_owner = (char *) &nullstring[0]; /* not needed; */
|
||||
/* just for xdring */
|
||||
parms.r_netid = nconf->nc_netid; /* not really needed */
|
||||
|
@ -799,32 +809,34 @@ try_rpcbind:
|
|||
}
|
||||
__rpc_endconf(handle);
|
||||
}
|
||||
if (client == (CLIENT *)NULL)
|
||||
if (client == NULL)
|
||||
goto regular_rpcbind; /* Go the regular way */
|
||||
} else {
|
||||
/* This is a UDP PORTMAP handle. Change to version 4 */
|
||||
vers = RPCBVERS4;
|
||||
CLNT_CONTROL(client, CLSET_VERS, (char *)&vers);
|
||||
CLNT_CONTROL(client, CLSET_VERS, (char *)(void *)&vers);
|
||||
}
|
||||
/*
|
||||
* We also send the remote system the address we used to
|
||||
* contact it in case it can help it connect back with us
|
||||
*/
|
||||
if (parms.r_addr == NULL)
|
||||
if (parms.r_addr == NULL) {
|
||||
/*LINTED const castaway*/
|
||||
parms.r_addr = (char *) &nullstring[0]; /* for XDRing */
|
||||
clnt_st = CLNT_CALL(client, RPCBPROC_GETADDRLIST,
|
||||
(xdrproc_t) xdr_rpcb, (char *) &parms,
|
||||
(xdrproc_t) xdr_rpcb_entry_list_ptr,
|
||||
(char *) &relp, tottimeout);
|
||||
}
|
||||
clnt_st = CLNT_CALL(client, (rpcproc_t)RPCBPROC_GETADDRLIST,
|
||||
(xdrproc_t) xdr_rpcb, (char *)(void *)&parms,
|
||||
(xdrproc_t) xdr_rpcb_entry_list_ptr,
|
||||
(char *)(void *)&relp, tottimeout);
|
||||
if (clnt_st == RPC_SUCCESS) {
|
||||
if ((address = got_entry(relp, nconf))) {
|
||||
if ((address = got_entry(relp, nconf)) != NULL) {
|
||||
xdr_free((xdrproc_t) xdr_rpcb_entry_list_ptr,
|
||||
(char *)&relp);
|
||||
(char *)(void *)&relp);
|
||||
goto done;
|
||||
}
|
||||
/* Entry not found for this transport */
|
||||
xdr_free((xdrproc_t) xdr_rpcb_entry_list_ptr,
|
||||
(char *)&relp);
|
||||
(char *)(void *)&relp);
|
||||
/*
|
||||
* XXX: should have perhaps returned with error but
|
||||
* since the remote machine might not always be able
|
||||
|
@ -863,17 +875,18 @@ regular_rpcbind:
|
|||
goto error;
|
||||
}
|
||||
}
|
||||
if (parms.r_addr == NULL)
|
||||
if (parms.r_addr == NULL) {
|
||||
/*LINTED const castaway*/
|
||||
parms.r_addr = (char *) &nullstring[0];
|
||||
}
|
||||
|
||||
/* First try from start_vers and then version 3 (RPCBVERS) */
|
||||
for (vers = start_vers; vers >= RPCBVERS; vers--) {
|
||||
/* Set the version */
|
||||
CLNT_CONTROL(client, CLSET_VERS, (char *)&vers);
|
||||
clnt_st = CLNT_CALL(client, RPCBPROC_GETADDR,
|
||||
(xdrproc_t) xdr_rpcb, (char *) &parms,
|
||||
(xdrproc_t) xdr_wrapstring,
|
||||
(char *) &ua, tottimeout);
|
||||
CLNT_CONTROL(client, CLSET_VERS, (char *)(void *)&vers);
|
||||
clnt_st = CLNT_CALL(client, (rpcproc_t)RPCBPROC_GETADDR,
|
||||
(xdrproc_t) xdr_rpcb, (char *)(void *)&parms,
|
||||
(xdrproc_t) xdr_wrapstring, (char *)(void *) ua, tottimeout);
|
||||
if (clnt_st == RPC_SUCCESS) {
|
||||
if ((ua == NULL) || (ua[0] == NULL)) {
|
||||
/* address unknown */
|
||||
|
@ -887,14 +900,16 @@ regular_rpcbind:
|
|||
fprintf(stderr,
|
||||
"\tCouldn't resolve remote address!\n");
|
||||
#endif
|
||||
xdr_free((xdrproc_t)xdr_wrapstring, (char *)&ua);
|
||||
xdr_free((xdrproc_t)xdr_wrapstring,
|
||||
(char *)(void *)&ua);
|
||||
|
||||
if (! address) {
|
||||
/* We don't know about your universal address */
|
||||
rpc_createerr.cf_stat = RPC_N2AXLATEFAILURE;
|
||||
goto error;
|
||||
}
|
||||
CLNT_CONTROL(client, CLGET_SVC_ADDR, (char *)&servaddr);
|
||||
CLNT_CONTROL(client, CLGET_SVC_ADDR,
|
||||
(char *)(void *)&servaddr);
|
||||
__rpc_fixup_addr(address, &servaddr);
|
||||
goto done;
|
||||
} else if (clnt_st == RPC_PROGVERSMISMATCH) {
|
||||
|
@ -967,7 +982,7 @@ rpcb_getaddr(program, version, nconf, address, host)
|
|||
rpc_createerr.cf_stat = RPC_FAILED;
|
||||
return (FALSE);
|
||||
}
|
||||
memcpy(address->buf, na->buf, (int)na->len);
|
||||
memcpy(address->buf, na->buf, (size_t)na->len);
|
||||
address->len = na->len;
|
||||
free(na->buf);
|
||||
free(na);
|
||||
|
@ -986,39 +1001,37 @@ rpcb_getmaps(nconf, host)
|
|||
const struct netconfig *nconf;
|
||||
const char *host;
|
||||
{
|
||||
rpcblist_ptr head = (rpcblist_ptr)NULL;
|
||||
register CLIENT *client;
|
||||
rpcblist_ptr head = NULL;
|
||||
CLIENT *client;
|
||||
enum clnt_stat clnt_st;
|
||||
long vers = 0;
|
||||
|
||||
client = getclnthandle(host, nconf, (char **)NULL);
|
||||
if (client == (CLIENT *)NULL) {
|
||||
client = getclnthandle(host, nconf, NULL);
|
||||
if (client == NULL) {
|
||||
return (head);
|
||||
}
|
||||
clnt_st = CLNT_CALL(client, RPCBPROC_DUMP,
|
||||
(xdrproc_t) xdr_void, NULL,
|
||||
(xdrproc_t) xdr_rpcblist_ptr,
|
||||
(char *)&head, tottimeout);
|
||||
clnt_st = CLNT_CALL(client, (rpcproc_t)RPCBPROC_DUMP,
|
||||
(xdrproc_t) xdr_void, NULL, (xdrproc_t) xdr_rpcblist_ptr,
|
||||
(char *)(void *)&head, tottimeout);
|
||||
if (clnt_st == RPC_SUCCESS)
|
||||
goto done;
|
||||
|
||||
if ((clnt_st != RPC_PROGVERSMISMATCH) &&
|
||||
(clnt_st != RPC_PROGUNAVAIL)) {
|
||||
(clnt_st != RPC_PROGUNAVAIL)) {
|
||||
rpc_createerr.cf_stat = RPC_RPCBFAILURE;
|
||||
clnt_geterr(client, &rpc_createerr.cf_error);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* fall back to earlier version */
|
||||
CLNT_CONTROL(client, CLGET_VERS, (char *)&vers);
|
||||
CLNT_CONTROL(client, CLGET_VERS, (char *)(void *)&vers);
|
||||
if (vers == RPCBVERS4) {
|
||||
vers = RPCBVERS;
|
||||
CLNT_CONTROL(client, CLSET_VERS, (char *)&vers);
|
||||
if (CLNT_CALL(client, RPCBPROC_DUMP,
|
||||
(xdrproc_t) xdr_void,
|
||||
(char *) NULL, (xdrproc_t) xdr_rpcblist_ptr,
|
||||
(char *)&head, tottimeout) == RPC_SUCCESS)
|
||||
goto done;
|
||||
CLNT_CONTROL(client, CLSET_VERS, (char *)(void *)&vers);
|
||||
if (CLNT_CALL(client, (rpcproc_t)RPCBPROC_DUMP,
|
||||
(xdrproc_t) xdr_void, NULL, (xdrproc_t) xdr_rpcblist_ptr,
|
||||
(char *)(void *)&head, tottimeout) == RPC_SUCCESS)
|
||||
goto done;
|
||||
}
|
||||
rpc_createerr.cf_stat = RPC_RPCBFAILURE;
|
||||
clnt_geterr(client, &rpc_createerr.cf_error);
|
||||
|
@ -1048,18 +1061,19 @@ rpcb_rmtcall(nconf, host, prog, vers, proc, xdrargs, argsp,
|
|||
struct timeval tout; /* Timeout value for this call */
|
||||
const struct netbuf *addr_ptr; /* Preallocated netbuf address */
|
||||
{
|
||||
register CLIENT *client;
|
||||
CLIENT *client;
|
||||
enum clnt_stat stat;
|
||||
struct r_rpcb_rmtcallargs a;
|
||||
struct r_rpcb_rmtcallres r;
|
||||
long rpcb_vers;
|
||||
|
||||
|
||||
client = getclnthandle(host, nconf, (char **)NULL);
|
||||
if (client == (CLIENT *)NULL) {
|
||||
client = getclnthandle(host, nconf, NULL);
|
||||
if (client == NULL) {
|
||||
return (RPC_FAILED);
|
||||
}
|
||||
CLNT_CONTROL(client, CLSET_RETRY_TIMEOUT, (char *)&rmttimeout);
|
||||
/*LINTED const castaway*/
|
||||
CLNT_CONTROL(client, CLSET_RETRY_TIMEOUT, (char *)(void *)&rmttimeout);
|
||||
a.prog = prog;
|
||||
a.vers = vers;
|
||||
a.proc = proc;
|
||||
|
@ -1070,16 +1084,17 @@ rpcb_rmtcall(nconf, host, prog, vers, proc, xdrargs, argsp,
|
|||
r.xdr_res = xdrres;
|
||||
|
||||
for (rpcb_vers = RPCBVERS4; rpcb_vers >= RPCBVERS; rpcb_vers--) {
|
||||
CLNT_CONTROL(client, CLSET_VERS, (char *)&rpcb_vers);
|
||||
stat = CLNT_CALL(client, RPCBPROC_CALLIT,
|
||||
(xdrproc_t) xdr_rpcb_rmtcallargs, (char *)&a,
|
||||
(xdrproc_t) xdr_rpcb_rmtcallres, (char *)&r, tout);
|
||||
CLNT_CONTROL(client, CLSET_VERS, (char *)(void *)&rpcb_vers);
|
||||
stat = CLNT_CALL(client, (rpcproc_t)RPCBPROC_CALLIT,
|
||||
(xdrproc_t) xdr_rpcb_rmtcallargs, (char *)(void *)&a,
|
||||
(xdrproc_t) xdr_rpcb_rmtcallres, (char *)(void *)&r, tout);
|
||||
if ((stat == RPC_SUCCESS) && (addr_ptr != NULL)) {
|
||||
struct netbuf *na;
|
||||
|
||||
/*LINTED const castaway*/
|
||||
na = uaddr2taddr((struct netconfig *) nconf, r.addr);
|
||||
if (! na) {
|
||||
if (!na) {
|
||||
stat = RPC_N2AXLATEFAILURE;
|
||||
/*LINTED const castaway*/
|
||||
((struct netbuf *) addr_ptr)->len = 0;
|
||||
goto error;
|
||||
}
|
||||
|
@ -1088,10 +1103,12 @@ rpcb_rmtcall(nconf, host, prog, vers, proc, xdrargs, argsp,
|
|||
stat = RPC_FAILED; /* XXX A better error no */
|
||||
free(na->buf);
|
||||
free(na);
|
||||
/*LINTED const castaway*/
|
||||
((struct netbuf *) addr_ptr)->len = 0;
|
||||
goto error;
|
||||
}
|
||||
memcpy(addr_ptr->buf, na->buf, (int)na->len);
|
||||
memcpy(addr_ptr->buf, na->buf, (size_t)na->len);
|
||||
/*LINTED const castaway*/
|
||||
((struct netbuf *)addr_ptr)->len = na->len;
|
||||
free(na->buf);
|
||||
free(na);
|
||||
|
@ -1104,7 +1121,7 @@ rpcb_rmtcall(nconf, host, prog, vers, proc, xdrargs, argsp,
|
|||
error:
|
||||
CLNT_DESTROY(client);
|
||||
if (r.addr)
|
||||
xdr_free((xdrproc_t) xdr_wrapstring, (char *)&r.addr);
|
||||
xdr_free((xdrproc_t) xdr_wrapstring, (char *)(void *)&r.addr);
|
||||
return (stat);
|
||||
}
|
||||
|
||||
|
@ -1134,13 +1151,13 @@ rpcb_gettime(host, timep)
|
|||
return (FALSE);
|
||||
}
|
||||
rpc_createerr.cf_stat = RPC_SUCCESS;
|
||||
while (client == (CLIENT *)NULL) {
|
||||
while (client == NULL) {
|
||||
if ((nconf = __rpc_getconf(handle)) == NULL) {
|
||||
if (rpc_createerr.cf_stat == RPC_SUCCESS)
|
||||
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
|
||||
break;
|
||||
}
|
||||
client = getclnthandle(host, nconf, (char **)NULL);
|
||||
client = getclnthandle(host, nconf, NULL);
|
||||
if (client)
|
||||
break;
|
||||
}
|
||||
|
@ -1149,19 +1166,19 @@ rpcb_gettime(host, timep)
|
|||
return (FALSE);
|
||||
}
|
||||
|
||||
st = CLNT_CALL(client, RPCBPROC_GETTIME,
|
||||
(xdrproc_t) xdr_void, (char *)NULL,
|
||||
(xdrproc_t) xdr_int, (char *)timep, tottimeout);
|
||||
st = CLNT_CALL(client, (rpcproc_t)RPCBPROC_GETTIME,
|
||||
(xdrproc_t) xdr_void, NULL,
|
||||
(xdrproc_t) xdr_int, (char *)(void *)timep, tottimeout);
|
||||
|
||||
if ((st == RPC_PROGVERSMISMATCH) || (st == RPC_PROGUNAVAIL)) {
|
||||
CLNT_CONTROL(client, CLGET_VERS, (char *)&vers);
|
||||
CLNT_CONTROL(client, CLGET_VERS, (char *)(void *)&vers);
|
||||
if (vers == RPCBVERS4) {
|
||||
/* fall back to earlier version */
|
||||
vers = RPCBVERS;
|
||||
CLNT_CONTROL(client, CLSET_VERS, (char *)&vers);
|
||||
st = CLNT_CALL(client, RPCBPROC_GETTIME,
|
||||
(xdrproc_t) xdr_void, (char *)NULL,
|
||||
(xdrproc_t) xdr_int, (char *) timep,
|
||||
CLNT_CONTROL(client, CLSET_VERS, (char *)(void *)&vers);
|
||||
st = CLNT_CALL(client, (rpcproc_t)RPCBPROC_GETTIME,
|
||||
(xdrproc_t) xdr_void, NULL,
|
||||
(xdrproc_t) xdr_int, (char *)(void *)timep,
|
||||
tottimeout);
|
||||
}
|
||||
}
|
||||
|
@ -1183,7 +1200,7 @@ rpcb_taddr2uaddr(nconf, taddr)
|
|||
|
||||
|
||||
/* parameter checking */
|
||||
if (nconf == (struct netconfig *)NULL) {
|
||||
if (nconf == NULL) {
|
||||
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -1196,9 +1213,9 @@ rpcb_taddr2uaddr(nconf, taddr)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
CLNT_CALL(client, RPCBPROC_TADDR2UADDR, (xdrproc_t) xdr_netbuf,
|
||||
(char *)taddr, (xdrproc_t) xdr_wrapstring, (char *)&uaddr,
|
||||
tottimeout);
|
||||
CLNT_CALL(client, (rpcproc_t)RPCBPROC_TADDR2UADDR,
|
||||
(xdrproc_t) xdr_netbuf, (char *)(void *)taddr,
|
||||
(xdrproc_t) xdr_wrapstring, (char *)(void *)&uaddr, tottimeout);
|
||||
CLNT_DESTROY(client);
|
||||
return (uaddr);
|
||||
}
|
||||
|
@ -1217,7 +1234,7 @@ rpcb_uaddr2taddr(nconf, uaddr)
|
|||
|
||||
|
||||
/* parameter checking */
|
||||
if (nconf == (struct netconfig *)NULL) {
|
||||
if (nconf == NULL) {
|
||||
rpc_createerr.cf_stat = RPC_UNKNOWNPROTO;
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -1235,9 +1252,10 @@ rpcb_uaddr2taddr(nconf, uaddr)
|
|||
CLNT_DESTROY(client);
|
||||
return (NULL);
|
||||
}
|
||||
if (CLNT_CALL(client, RPCBPROC_UADDR2TADDR, (xdrproc_t) xdr_wrapstring,
|
||||
(char *) &uaddr, (xdrproc_t) xdr_netbuf, (char *)taddr,
|
||||
tottimeout) != RPC_SUCCESS) {
|
||||
if (CLNT_CALL(client, (rpcproc_t)RPCBPROC_UADDR2TADDR,
|
||||
(xdrproc_t) xdr_wrapstring, (char *)(void *)&uaddr,
|
||||
(xdrproc_t) xdr_netbuf, (char *)(void *)taddr,
|
||||
tottimeout) != RPC_SUCCESS) {
|
||||
free(taddr);
|
||||
taddr = NULL;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rpcb_prot.c,v 1.1 2000/06/02 23:11:15 fvdl Exp $ */
|
||||
/* $NetBSD: rpcb_prot.c,v 1.2 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -77,13 +77,13 @@ xdr_rpcb(xdrs, objp)
|
|||
if (!xdr_u_int32_t(xdrs, &objp->r_vers)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_string(xdrs, &objp->r_netid, ~0)) {
|
||||
if (!xdr_string(xdrs, &objp->r_netid, (u_int)~0)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_string(xdrs, &objp->r_addr, ~0)) {
|
||||
if (!xdr_string(xdrs, &objp->r_addr, (u_int)~0)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_string(xdrs, &objp->r_owner, ~0)) {
|
||||
if (!xdr_string(xdrs, &objp->r_owner, (u_int)~0)) {
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
|
@ -114,8 +114,8 @@ xdr_rpcb(xdrs, objp)
|
|||
|
||||
bool_t
|
||||
xdr_rpcblist_ptr(xdrs, rp)
|
||||
register XDR *xdrs;
|
||||
register rpcblist_ptr *rp;
|
||||
XDR *xdrs;
|
||||
rpcblist_ptr *rp;
|
||||
{
|
||||
/*
|
||||
* more_elements is pre-computed in case the direction is
|
||||
|
@ -123,11 +123,11 @@ xdr_rpcblist_ptr(xdrs, rp)
|
|||
* xdr_bool when the direction is XDR_DECODE.
|
||||
*/
|
||||
bool_t more_elements;
|
||||
register int freeing = (xdrs->x_op == XDR_FREE);
|
||||
int freeing = (xdrs->x_op == XDR_FREE);
|
||||
rpcblist_ptr next;
|
||||
rpcblist_ptr next_copy;
|
||||
|
||||
while (TRUE) {
|
||||
for (;;) {
|
||||
more_elements = (bool_t)(*rp != NULL);
|
||||
if (! xdr_bool(xdrs, &more_elements)) {
|
||||
return (FALSE);
|
||||
|
@ -167,8 +167,8 @@ xdr_rpcblist_ptr(xdrs, rp)
|
|||
*/
|
||||
bool_t
|
||||
xdr_rpcblist(xdrs, rp)
|
||||
register XDR *xdrs;
|
||||
register RPCBLIST **rp;
|
||||
XDR *xdrs;
|
||||
RPCBLIST **rp;
|
||||
{
|
||||
bool_t dummy;
|
||||
|
||||
|
@ -182,19 +182,19 @@ xdr_rpcb_entry(xdrs, objp)
|
|||
XDR *xdrs;
|
||||
rpcb_entry *objp;
|
||||
{
|
||||
if (!xdr_string(xdrs, &objp->r_maddr, ~0)) {
|
||||
if (!xdr_string(xdrs, &objp->r_maddr, (u_int)~0)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_string(xdrs, &objp->r_nc_netid, ~0)) {
|
||||
if (!xdr_string(xdrs, &objp->r_nc_netid, (u_int)~0)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_u_int32_t(xdrs, &objp->r_nc_semantics)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_string(xdrs, &objp->r_nc_protofmly, ~0)) {
|
||||
if (!xdr_string(xdrs, &objp->r_nc_protofmly, (u_int)~0)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_string(xdrs, &objp->r_nc_proto, ~0)) {
|
||||
if (!xdr_string(xdrs, &objp->r_nc_proto, (u_int)~0)) {
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
|
@ -202,8 +202,8 @@ xdr_rpcb_entry(xdrs, objp)
|
|||
|
||||
bool_t
|
||||
xdr_rpcb_entry_list_ptr(xdrs, rp)
|
||||
register XDR *xdrs;
|
||||
register rpcb_entry_list_ptr *rp;
|
||||
XDR *xdrs;
|
||||
rpcb_entry_list_ptr *rp;
|
||||
{
|
||||
/*
|
||||
* more_elements is pre-computed in case the direction is
|
||||
|
@ -211,11 +211,11 @@ xdr_rpcb_entry_list_ptr(xdrs, rp)
|
|||
* xdr_bool when the direction is XDR_DECODE.
|
||||
*/
|
||||
bool_t more_elements;
|
||||
register int freeing = (xdrs->x_op == XDR_FREE);
|
||||
int freeing = (xdrs->x_op == XDR_FREE);
|
||||
rpcb_entry_list_ptr next;
|
||||
rpcb_entry_list_ptr next_copy;
|
||||
|
||||
while (TRUE) {
|
||||
for (;;) {
|
||||
more_elements = (bool_t)(*rp != NULL);
|
||||
if (! xdr_bool(xdrs, &more_elements)) {
|
||||
return (FALSE);
|
||||
|
@ -259,7 +259,8 @@ xdr_rpcb_rmtcallargs(xdrs, p)
|
|||
XDR *xdrs;
|
||||
struct rpcb_rmtcallargs *p;
|
||||
{
|
||||
struct r_rpcb_rmtcallargs *objp = (struct r_rpcb_rmtcallargs *)p;
|
||||
struct r_rpcb_rmtcallargs *objp =
|
||||
(struct r_rpcb_rmtcallargs *)(void *)p;
|
||||
u_int lenposition, argposition, position;
|
||||
int32_t *buf;
|
||||
|
||||
|
@ -292,7 +293,7 @@ xdr_rpcb_rmtcallargs(xdrs, p)
|
|||
return (FALSE);
|
||||
}
|
||||
position = XDR_GETPOS(xdrs);
|
||||
objp->args.args_len = (u_long)position - (u_long)argposition;
|
||||
objp->args.args_len = (u_int)((u_long)position - (u_long)argposition);
|
||||
XDR_SETPOS(xdrs, lenposition);
|
||||
if (! xdr_u_int(xdrs, &(objp->args.args_len))) {
|
||||
return (FALSE);
|
||||
|
@ -311,9 +312,9 @@ xdr_rpcb_rmtcallres(xdrs, p)
|
|||
struct rpcb_rmtcallres *p;
|
||||
{
|
||||
bool_t dummy;
|
||||
struct r_rpcb_rmtcallres *objp = (struct r_rpcb_rmtcallres *)p;
|
||||
struct r_rpcb_rmtcallres *objp = (struct r_rpcb_rmtcallres *)(void *)p;
|
||||
|
||||
if (!xdr_string(xdrs, &objp->addr, ~0)) {
|
||||
if (!xdr_string(xdrs, &objp->addr, (u_int)~0)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_u_int(xdrs, &objp->results.results_len)) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rpcb_st_xdr.c,v 1.1 2000/06/02 23:11:15 fvdl Exp $ */
|
||||
/* $NetBSD: rpcb_st_xdr.c,v 1.2 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -71,7 +71,7 @@ xdr_rpcbs_addrlist(xdrs, objp)
|
|||
if (!xdr_int(xdrs, &objp->failure)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_string(xdrs, &objp->netid, ~0)) {
|
||||
if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
|
|||
XDR *xdrs;
|
||||
rpcbs_rmtcalllist *objp;
|
||||
{
|
||||
register int32_t *buf;
|
||||
int32_t *buf;
|
||||
|
||||
if (xdrs->x_op == XDR_ENCODE) {
|
||||
buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
|
||||
|
@ -122,7 +122,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
|
|||
IXDR_PUT_LONG(buf, objp->failure);
|
||||
IXDR_PUT_LONG(buf, objp->indirect);
|
||||
}
|
||||
if (!xdr_string(xdrs, &objp->netid, ~0)) {
|
||||
if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_pointer(xdrs, (char **)&objp->next,
|
||||
|
@ -153,14 +153,14 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
|
|||
return (FALSE);
|
||||
}
|
||||
} else {
|
||||
objp->prog = IXDR_GET_U_LONG(buf);
|
||||
objp->vers = IXDR_GET_U_LONG(buf);
|
||||
objp->proc = IXDR_GET_U_LONG(buf);
|
||||
objp->success = IXDR_GET_LONG(buf);
|
||||
objp->failure = IXDR_GET_LONG(buf);
|
||||
objp->indirect = IXDR_GET_LONG(buf);
|
||||
objp->prog = (rpcprog_t)IXDR_GET_U_LONG(buf);
|
||||
objp->vers = (rpcvers_t)IXDR_GET_U_LONG(buf);
|
||||
objp->proc = (rpcproc_t)IXDR_GET_U_LONG(buf);
|
||||
objp->success = (int)IXDR_GET_LONG(buf);
|
||||
objp->failure = (int)IXDR_GET_LONG(buf);
|
||||
objp->indirect = (int)IXDR_GET_LONG(buf);
|
||||
}
|
||||
if (!xdr_string(xdrs, &objp->netid, ~0)) {
|
||||
if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_pointer(xdrs, (char **)&objp->next,
|
||||
|
@ -188,7 +188,7 @@ xdr_rpcbs_rmtcalllist(xdrs, objp)
|
|||
if (!xdr_int(xdrs, &objp->indirect)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_string(xdrs, &objp->netid, ~0)) {
|
||||
if (!xdr_string(xdrs, &objp->netid, (u_int)~0)) {
|
||||
return (FALSE);
|
||||
}
|
||||
if (!xdr_pointer(xdrs, (char **)&objp->next,
|
||||
|
@ -204,8 +204,8 @@ xdr_rpcbs_proc(xdrs, objp)
|
|||
XDR *xdrs;
|
||||
rpcbs_proc objp;
|
||||
{
|
||||
if (!xdr_vector(xdrs, (char *)objp, RPCBSTAT_HIGHPROC, sizeof (int),
|
||||
(xdrproc_t)xdr_int)) {
|
||||
if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBSTAT_HIGHPROC,
|
||||
sizeof (int), (xdrproc_t)xdr_int)) {
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
|
@ -265,8 +265,8 @@ xdr_rpcb_stat_byvers(xdrs, objp)
|
|||
XDR *xdrs;
|
||||
rpcb_stat_byvers objp;
|
||||
{
|
||||
if (!xdr_vector(xdrs, (char *)objp, RPCBVERS_STAT, sizeof (rpcb_stat),
|
||||
(xdrproc_t)xdr_rpcb_stat)) {
|
||||
if (!xdr_vector(xdrs, (char *)(void *)objp, RPCBVERS_STAT,
|
||||
sizeof (rpcb_stat), (xdrproc_t)xdr_rpcb_stat)) {
|
||||
return (FALSE);
|
||||
}
|
||||
return (TRUE);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svc.c,v 1.20 2000/06/02 23:11:16 fvdl Exp $ */
|
||||
/* $NetBSD: svc.c,v 1.21 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)svc.c 1.44 88/02/08 Copyr 1984 Sun Micro";
|
||||
static char *sccsid = "@(#)svc.c 2.4 88/08/11 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: svc.c,v 1.20 2000/06/02 23:11:16 fvdl Exp $");
|
||||
__RCSID("$NetBSD: svc.c,v 1.21 2000/07/06 03:10:35 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -87,7 +87,6 @@ __weak_alias(xprt_unregister,_xprt_unregister)
|
|||
|
||||
static SVCXPRT **xports;
|
||||
|
||||
#define NULL_SVC ((struct svc_callout *)0)
|
||||
#define RQCRED_SIZE 400 /* this size is excessive */
|
||||
|
||||
#define SVC_VERSQUIET 0x0001 /* keep quiet about vers mismatch */
|
||||
|
@ -163,7 +162,7 @@ xprt_unregister(xprt)
|
|||
|
||||
rwlock_wrlock(&svc_fd_lock);
|
||||
if ((sock < FD_SETSIZE) && (xports[sock] == xprt)) {
|
||||
xports[sock] = (SVCXPRT *)0;
|
||||
xports[sock] = NULL;
|
||||
FD_CLR(sock, &svc_fdset);
|
||||
if (sock >= svc_maxfd) {
|
||||
for (svc_maxfd--; svc_maxfd>=0; svc_maxfd--)
|
||||
|
@ -189,9 +188,9 @@ svc_reg(xprt, prog, vers, dispatch, nconf)
|
|||
{
|
||||
bool_t dummy;
|
||||
struct svc_callout *prev;
|
||||
register struct svc_callout *s;
|
||||
struct svc_callout *s;
|
||||
struct netconfig *tnconf;
|
||||
register char *netid = NULL;
|
||||
char *netid = NULL;
|
||||
int flag = 0;
|
||||
|
||||
/* VARIABLES PROTECTED BY svc_lock: s, prev, svc_head */
|
||||
|
@ -212,7 +211,7 @@ svc_reg(xprt, prog, vers, dispatch, nconf)
|
|||
}
|
||||
|
||||
rwlock_wrlock(&svc_lock);
|
||||
if ((s = svc_find(prog, vers, &prev, netid)) != NULL_SVC) {
|
||||
if ((s = svc_find(prog, vers, &prev, netid)) != NULL) {
|
||||
if (netid)
|
||||
free(netid);
|
||||
if (s->sc_dispatch == dispatch)
|
||||
|
@ -220,8 +219,8 @@ svc_reg(xprt, prog, vers, dispatch, nconf)
|
|||
rwlock_unlock(&svc_lock);
|
||||
return (FALSE);
|
||||
}
|
||||
s = (struct svc_callout *)mem_alloc(sizeof (struct svc_callout));
|
||||
if (s == (struct svc_callout *)NULL) {
|
||||
s = mem_alloc(sizeof (struct svc_callout));
|
||||
if (s == NULL) {
|
||||
if (netid)
|
||||
free(netid);
|
||||
rwlock_unlock(&svc_lock);
|
||||
|
@ -242,6 +241,7 @@ rpcb_it:
|
|||
rwlock_unlock(&svc_lock);
|
||||
/* now register the information with the local binder service */
|
||||
if (nconf) {
|
||||
/*LINTED const castaway*/
|
||||
dummy = rpcb_set(prog, vers, (struct netconfig *) nconf,
|
||||
&((SVCXPRT *) xprt)->xp_ltaddr);
|
||||
return (dummy);
|
||||
|
@ -258,22 +258,21 @@ svc_unreg(prog, vers)
|
|||
const rpcvers_t vers;
|
||||
{
|
||||
struct svc_callout *prev;
|
||||
register struct svc_callout *s;
|
||||
struct svc_callout *s;
|
||||
|
||||
/* unregister the information anyway */
|
||||
(void) rpcb_unset(prog, vers, NULL);
|
||||
rwlock_wrlock(&svc_lock);
|
||||
while ((s = svc_find(prog, vers, &prev, NULL)) != NULL_SVC) {
|
||||
if (prev == NULL_SVC) {
|
||||
while ((s = svc_find(prog, vers, &prev, NULL)) != NULL) {
|
||||
if (prev == NULL) {
|
||||
svc_head = s->sc_next;
|
||||
} else {
|
||||
prev->sc_next = s->sc_next;
|
||||
}
|
||||
s->sc_next = NULL_SVC;
|
||||
s->sc_next = NULL;
|
||||
if (s->sc_netid)
|
||||
mem_free((char *)s->sc_netid,
|
||||
(u_int)sizeof (s->sc_netid) + 1);
|
||||
mem_free((char *)s, (u_int) sizeof (struct svc_callout));
|
||||
mem_free(s->sc_netid, sizeof (s->sc_netid) + 1);
|
||||
mem_free(s, sizeof (struct svc_callout));
|
||||
}
|
||||
rwlock_unlock(&svc_lock);
|
||||
}
|
||||
|
@ -300,17 +299,18 @@ svc_register(xprt, prog, vers, dispatch, protocol)
|
|||
_DIAGASSERT(xprt != NULL);
|
||||
_DIAGASSERT(dispatch != NULL);
|
||||
|
||||
if ((s = svc_find(prog, vers, &prev, NULL)) != NULL_SVC) {
|
||||
if ((s = svc_find((rpcprog_t)prog, (rpcvers_t)vers, &prev, NULL)) !=
|
||||
NULL) {
|
||||
if (s->sc_dispatch == dispatch)
|
||||
goto pmap_it; /* he is registering another xptr */
|
||||
return (FALSE);
|
||||
}
|
||||
s = (struct svc_callout *)mem_alloc(sizeof(struct svc_callout));
|
||||
if (s == (struct svc_callout *)0) {
|
||||
s = mem_alloc(sizeof(struct svc_callout));
|
||||
if (s == NULL) {
|
||||
return (FALSE);
|
||||
}
|
||||
s->sc_prog = prog;
|
||||
s->sc_vers = vers;
|
||||
s->sc_prog = (rpcprog_t)prog;
|
||||
s->sc_vers = (rpcvers_t)vers;
|
||||
s->sc_dispatch = dispatch;
|
||||
s->sc_next = svc_head;
|
||||
svc_head = s;
|
||||
|
@ -333,14 +333,15 @@ svc_unregister(prog, vers)
|
|||
struct svc_callout *prev;
|
||||
struct svc_callout *s;
|
||||
|
||||
if ((s = svc_find(prog, vers, &prev, NULL)) == NULL_SVC)
|
||||
if ((s = svc_find((rpcprog_t)prog, (rpcvers_t)vers, &prev, NULL)) ==
|
||||
NULL)
|
||||
return;
|
||||
if (prev == NULL_SVC) {
|
||||
if (prev == NULL) {
|
||||
svc_head = s->sc_next;
|
||||
} else {
|
||||
prev->sc_next = s->sc_next;
|
||||
}
|
||||
s->sc_next = NULL_SVC;
|
||||
s->sc_next = NULL;
|
||||
mem_free(s, sizeof(struct svc_callout));
|
||||
/* now unregister the information with the local binder service */
|
||||
(void)pmap_unset(prog, vers);
|
||||
|
@ -362,8 +363,8 @@ svc_find(prog, vers, prev, netid)
|
|||
|
||||
_DIAGASSERT(prev != NULL);
|
||||
|
||||
p = NULL_SVC;
|
||||
for (s = svc_head; s != NULL_SVC; s = s->sc_next) {
|
||||
p = NULL;
|
||||
for (s = svc_head; s != NULL; s = s->sc_next) {
|
||||
if (((s->sc_prog == prog) && (s->sc_vers == vers)) &&
|
||||
((netid == NULL) || (s->sc_netid == NULL) ||
|
||||
(strcmp(netid, s->sc_netid) == 0)))
|
||||
|
@ -461,7 +462,7 @@ svcerr_systemerr(xprt)
|
|||
*/
|
||||
void
|
||||
__svc_versquiet_on(xprt)
|
||||
register SVCXPRT *xprt;
|
||||
SVCXPRT *xprt;
|
||||
{
|
||||
u_long tmp;
|
||||
|
||||
|
@ -471,7 +472,7 @@ __svc_versquiet_on(xprt)
|
|||
|
||||
void
|
||||
__svc_versquiet_off(xprt)
|
||||
register SVCXPRT *xprt;
|
||||
SVCXPRT *xprt;
|
||||
{
|
||||
u_long tmp;
|
||||
|
||||
|
@ -481,14 +482,14 @@ __svc_versquiet_off(xprt)
|
|||
|
||||
void
|
||||
svc_versquiet(xprt)
|
||||
register SVCXPRT *xprt;
|
||||
SVCXPRT *xprt;
|
||||
{
|
||||
__svc_versquiet_on(xprt);
|
||||
}
|
||||
|
||||
int
|
||||
__svc_versquiet_get(xprt)
|
||||
register SVCXPRT *xprt;
|
||||
SVCXPRT *xprt;
|
||||
{
|
||||
return ((int) xprt->xp_p3) & SVC_VERSQUIET;
|
||||
}
|
||||
|
@ -661,7 +662,7 @@ svc_getreq_common(fd)
|
|||
prog_found = FALSE;
|
||||
low_vers = (rpcvers_t) -1L;
|
||||
high_vers = (rpcvers_t) 0L;
|
||||
for (s = svc_head; s != NULL_SVC; s = s->sc_next) {
|
||||
for (s = svc_head; s != NULL; s = s->sc_next) {
|
||||
if (s->sc_prog == r.rq_prog) {
|
||||
if (s->sc_vers == r.rq_vers) {
|
||||
(*s->sc_dispatch)(&r, xprt);
|
||||
|
@ -713,7 +714,7 @@ svc_getreq_poll(pfdp, pollretval)
|
|||
int fds_found;
|
||||
|
||||
for (i = fds_found = 0; fds_found < pollretval; i++) {
|
||||
register struct pollfd *p = &pfdp[i];
|
||||
struct pollfd *p = &pfdp[i];
|
||||
|
||||
if (p->revents) {
|
||||
/* fd has input waiting */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svc_auth.c,v 1.11 2000/06/02 23:11:16 fvdl Exp $ */
|
||||
/* $NetBSD: svc_auth.c,v 1.12 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -65,8 +65,8 @@ __weak_alias(svc_auth_reg,_svc_auth_reg)
|
|||
*
|
||||
* enum auth_stat
|
||||
* flavorx_auth(rqst, msg)
|
||||
* register struct svc_req *rqst;
|
||||
* register struct rpc_msg *msg;
|
||||
* struct svc_req *rqst;
|
||||
* struct rpc_msg *msg;
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -98,11 +98,11 @@ static struct authsvc *Auths = NULL;
|
|||
*/
|
||||
enum auth_stat
|
||||
_authenticate(rqst, msg)
|
||||
register struct svc_req *rqst;
|
||||
struct svc_req *rqst;
|
||||
struct rpc_msg *msg;
|
||||
{
|
||||
register int cred_flavor;
|
||||
register struct authsvc *asp;
|
||||
int cred_flavor;
|
||||
struct authsvc *asp;
|
||||
enum auth_stat dummy;
|
||||
#ifdef __REENT
|
||||
extern mutex_t authsvc_lock;
|
||||
|
@ -174,10 +174,10 @@ _svcauth_null(rqst, msg)
|
|||
|
||||
int
|
||||
svc_auth_reg(cred_flavor, handler)
|
||||
register int cred_flavor;
|
||||
int cred_flavor;
|
||||
enum auth_stat (*handler) __P((struct svc_req *, struct rpc_msg *));
|
||||
{
|
||||
register struct authsvc *asp;
|
||||
struct authsvc *asp;
|
||||
#ifdef __REENT
|
||||
extern mutex_t authsvc_lock;
|
||||
#endif
|
||||
|
@ -203,7 +203,7 @@ svc_auth_reg(cred_flavor, handler)
|
|||
}
|
||||
|
||||
/* this is a new one, so go ahead and register it */
|
||||
asp = (struct authsvc *)mem_alloc(sizeof (*asp));
|
||||
asp = mem_alloc(sizeof (*asp));
|
||||
if (asp == NULL) {
|
||||
mutex_unlock(&authsvc_lock);
|
||||
return (-1);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svc_dg.c,v 1.3 2000/06/22 11:06:23 fvdl Exp $ */
|
||||
/* $NetBSD: svc_dg.c,v 1.4 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -112,7 +112,7 @@ svc_dg_create(fd, sendsize, recvsize)
|
|||
|
||||
if (!__rpc_fd2sockinfo(fd, &si)) {
|
||||
warnx(svc_dg_str, svc_dg_err1);
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
/*
|
||||
* Find the receive and the send size
|
||||
|
@ -121,31 +121,31 @@ svc_dg_create(fd, sendsize, recvsize)
|
|||
recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize);
|
||||
if ((sendsize == 0) || (recvsize == 0)) {
|
||||
warnx(svc_dg_str, svc_dg_err2);
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
xprt = (SVCXPRT *)mem_alloc(sizeof (SVCXPRT));
|
||||
xprt = mem_alloc(sizeof (SVCXPRT));
|
||||
if (xprt == NULL)
|
||||
goto freedata;
|
||||
memset((char *)xprt, 0, sizeof (SVCXPRT));
|
||||
memset(xprt, 0, sizeof (SVCXPRT));
|
||||
|
||||
su = (struct svc_dg_data *)mem_alloc(sizeof (*su));
|
||||
su = mem_alloc(sizeof (*su));
|
||||
if (su == NULL)
|
||||
goto freedata;
|
||||
su->su_iosz = ((MAX(sendsize, recvsize) + 3) / 4) * 4;
|
||||
if ((rpc_buffer(xprt) = (char *)mem_alloc(su->su_iosz)) == NULL)
|
||||
if ((rpc_buffer(xprt) = mem_alloc(su->su_iosz)) == NULL)
|
||||
goto freedata;
|
||||
xdrmem_create(&(su->su_xdrs), rpc_buffer(xprt), su->su_iosz,
|
||||
XDR_DECODE);
|
||||
su->su_cache = NULL;
|
||||
xprt->xp_fd = fd;
|
||||
xprt->xp_p2 = (caddr_t)su;
|
||||
xprt->xp_p2 = (caddr_t)(void *)su;
|
||||
xprt->xp_verf.oa_base = su->su_verfbody;
|
||||
svc_dg_ops(xprt);
|
||||
xprt->xp_rtaddr.maxlen = sizeof (struct sockaddr_storage);
|
||||
|
||||
slen = sizeof ss;
|
||||
if (getsockname(fd, (struct sockaddr *)&ss, &slen) < 0)
|
||||
if (getsockname(fd, (struct sockaddr *)(void *)&ss, &slen) < 0)
|
||||
goto freedata;
|
||||
xprt->xp_ltaddr.buf = mem_alloc(sizeof (struct sockaddr_storage));
|
||||
xprt->xp_ltaddr.maxlen = sizeof (struct sockaddr_storage);
|
||||
|
@ -158,12 +158,13 @@ freedata:
|
|||
(void) warnx(svc_dg_str, __no_mem_str);
|
||||
if (xprt) {
|
||||
if (su)
|
||||
(void) mem_free((char *) su, sizeof (*su));
|
||||
(void) mem_free((char *)xprt, sizeof (SVCXPRT));
|
||||
(void) mem_free(su, sizeof (*su));
|
||||
(void) mem_free(xprt, sizeof (SVCXPRT));
|
||||
}
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static enum xprt_stat
|
||||
svc_dg_stat(xprt)
|
||||
SVCXPRT *xprt;
|
||||
|
@ -173,7 +174,7 @@ svc_dg_stat(xprt)
|
|||
|
||||
static bool_t
|
||||
svc_dg_recv(xprt, msg)
|
||||
register SVCXPRT *xprt;
|
||||
SVCXPRT *xprt;
|
||||
struct rpc_msg *msg;
|
||||
{
|
||||
struct svc_dg_data *su = su_data(xprt);
|
||||
|
@ -187,7 +188,7 @@ svc_dg_recv(xprt, msg)
|
|||
again:
|
||||
alen = sizeof (struct sockaddr_storage);
|
||||
rlen = recvfrom(xprt->xp_fd, rpc_buffer(xprt), su->su_iosz, 0,
|
||||
(struct sockaddr *)&ss, &alen);
|
||||
(struct sockaddr *)(void *)&ss, &alen);
|
||||
if (rlen == -1 && errno == EINTR)
|
||||
goto again;
|
||||
if (rlen == -1 || (rlen < 4 * sizeof (u_int32_t)))
|
||||
|
@ -214,7 +215,7 @@ again:
|
|||
if (su->su_cache != NULL) {
|
||||
if (cache_get(xprt, msg, &reply, &replylen)) {
|
||||
(void)sendto(xprt->xp_fd, reply, replylen, 0,
|
||||
(struct sockaddr *)&ss, alen);
|
||||
(struct sockaddr *)(void *)&ss, alen);
|
||||
return (FALSE);
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +224,7 @@ again:
|
|||
|
||||
static bool_t
|
||||
svc_dg_reply(xprt, msg)
|
||||
register SVCXPRT *xprt;
|
||||
SVCXPRT *xprt;
|
||||
struct rpc_msg *msg;
|
||||
{
|
||||
struct svc_dg_data *su = su_data(xprt);
|
||||
|
@ -240,7 +241,7 @@ svc_dg_reply(xprt, msg)
|
|||
(struct sockaddr *)xprt->xp_rtaddr.buf,
|
||||
(socklen_t)xprt->xp_rtaddr.len) == slen) {
|
||||
stat = TRUE;
|
||||
if (su->su_cache && slen >= 0)
|
||||
if (su->su_cache)
|
||||
cache_set(xprt, slen);
|
||||
}
|
||||
}
|
||||
|
@ -262,7 +263,7 @@ svc_dg_freeargs(xprt, xdr_args, args_ptr)
|
|||
xdrproc_t xdr_args;
|
||||
caddr_t args_ptr;
|
||||
{
|
||||
register XDR *xdrs = &(su_data(xprt)->su_xdrs);
|
||||
XDR *xdrs = &(su_data(xprt)->su_xdrs);
|
||||
|
||||
xdrs->x_op = XDR_FREE;
|
||||
return (*xdr_args)(xdrs, args_ptr);
|
||||
|
@ -270,26 +271,27 @@ svc_dg_freeargs(xprt, xdr_args, args_ptr)
|
|||
|
||||
static void
|
||||
svc_dg_destroy(xprt)
|
||||
register SVCXPRT *xprt;
|
||||
SVCXPRT *xprt;
|
||||
{
|
||||
register struct svc_dg_data *su = su_data(xprt);
|
||||
struct svc_dg_data *su = su_data(xprt);
|
||||
|
||||
xprt_unregister(xprt);
|
||||
if (xprt->xp_fd != -1)
|
||||
(void)close(xprt->xp_fd);
|
||||
XDR_DESTROY(&(su->su_xdrs));
|
||||
(void) mem_free(rpc_buffer(xprt), su->su_iosz);
|
||||
(void) mem_free((caddr_t)su, sizeof (*su));
|
||||
(void) mem_free(su, sizeof (*su));
|
||||
if (xprt->xp_rtaddr.buf)
|
||||
(void) mem_free(xprt->xp_rtaddr.buf, xprt->xp_rtaddr.maxlen);
|
||||
if (xprt->xp_ltaddr.buf)
|
||||
(void) mem_free(xprt->xp_ltaddr.buf, xprt->xp_ltaddr.maxlen);
|
||||
if (xprt->xp_tp)
|
||||
(void) free(xprt->xp_tp);
|
||||
(void) mem_free((caddr_t)xprt, sizeof (SVCXPRT));
|
||||
(void) mem_free(xprt, sizeof (SVCXPRT));
|
||||
}
|
||||
|
||||
static bool_t
|
||||
/*ARGSUSED*/
|
||||
svc_dg_control(xprt, rq, in)
|
||||
SVCXPRT *xprt;
|
||||
const u_int rq;
|
||||
|
@ -339,13 +341,13 @@ svc_dg_ops(xprt)
|
|||
#define SPARSENESS 4 /* 75% sparse */
|
||||
|
||||
#define ALLOC(type, size) \
|
||||
(type *) mem_alloc((unsigned) (sizeof (type) * (size)))
|
||||
(type *) mem_alloc((sizeof (type) * (size)))
|
||||
|
||||
#define MEMZERO(addr, type, size) \
|
||||
(void) memset((char *) (addr), 0, sizeof (type) * (int) (size))
|
||||
(void) memset((void *) (addr), 0, sizeof (type) * (int) (size))
|
||||
|
||||
#define FREE(addr, type, size) \
|
||||
mem_free((char *) (addr), (sizeof (type) * (size)))
|
||||
mem_free((addr), (sizeof (type) * (size)))
|
||||
|
||||
/*
|
||||
* An entry in the cache
|
||||
|
@ -443,7 +445,7 @@ svc_dg_enablecache(transp, size)
|
|||
return (0);
|
||||
}
|
||||
MEMZERO(uc->uc_fifo, cache_ptr, size);
|
||||
su->su_cache = (char *) uc;
|
||||
su->su_cache = (char *)(void *)uc;
|
||||
mutex_unlock(&dupreq_lock);
|
||||
return (1);
|
||||
}
|
||||
|
@ -466,9 +468,9 @@ cache_set(xprt, replylen)
|
|||
SVCXPRT *xprt;
|
||||
size_t replylen;
|
||||
{
|
||||
register cache_ptr victim;
|
||||
register cache_ptr *vicp;
|
||||
register struct svc_dg_data *su = su_data(xprt);
|
||||
cache_ptr victim;
|
||||
cache_ptr *vicp;
|
||||
struct svc_dg_data *su = su_data(xprt);
|
||||
struct cl_cache *uc = (struct cl_cache *) su->su_cache;
|
||||
u_int loc;
|
||||
char *newbuf;
|
||||
|
@ -503,7 +505,7 @@ cache_set(xprt, replylen)
|
|||
mutex_unlock(&dupreq_lock);
|
||||
return;
|
||||
}
|
||||
newbuf = (char *)mem_alloc(su->su_iosz);
|
||||
newbuf = mem_alloc(su->su_iosz);
|
||||
if (newbuf == NULL) {
|
||||
warnx(cache_set_str, cache_set_err3);
|
||||
FREE(victim, struct cache_node, 1);
|
||||
|
@ -538,7 +540,7 @@ cache_set(xprt, replylen)
|
|||
victim->cache_addr = xprt->xp_rtaddr;
|
||||
victim->cache_addr.buf = ALLOC(char, xprt->xp_rtaddr.len);
|
||||
(void) memcpy(victim->cache_addr.buf, xprt->xp_rtaddr.buf,
|
||||
(int)xprt->xp_rtaddr.len);
|
||||
(size_t)xprt->xp_rtaddr.len);
|
||||
loc = CACHE_LOC(xprt, victim->cache_xid);
|
||||
victim->cache_next = uc->uc_entries[loc];
|
||||
uc->uc_entries[loc] = victim;
|
||||
|
@ -559,9 +561,9 @@ cache_get(xprt, msg, replyp, replylenp)
|
|||
size_t *replylenp;
|
||||
{
|
||||
u_int loc;
|
||||
register cache_ptr ent;
|
||||
register struct svc_dg_data *su = su_data(xprt);
|
||||
register struct cl_cache *uc = (struct cl_cache *) su->su_cache;
|
||||
cache_ptr ent;
|
||||
struct svc_dg_data *su = su_data(xprt);
|
||||
struct cl_cache *uc = (struct cl_cache *) su->su_cache;
|
||||
#ifdef RPC_CACHE_DEBUG
|
||||
struct netconfig *nconf;
|
||||
char *uaddr;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svc_generic.c,v 1.2 2000/06/07 18:27:40 fvdl Exp $ */
|
||||
/* $NetBSD: svc_generic.c,v 1.3 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -52,6 +52,7 @@ static char sccsid[] = "@(#)svc_generic.c 1.21 89/02/28 Copyr 1988 Sun Micro";
|
|||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/nettype.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <malloc.h>
|
||||
|
@ -100,11 +101,11 @@ svc_create(dispatch, prognum, versnum, nettype)
|
|||
|
||||
/* VARIABLES PROTECTED BY xprtlist_lock: xprtlist */
|
||||
|
||||
if ((handle = __rpc_setconf((char *)nettype)) == NULL) {
|
||||
if ((handle = __rpc_setconf(nettype)) == NULL) {
|
||||
warnx("svc_create: unknown protocol");
|
||||
return (0);
|
||||
}
|
||||
while ((nconf = __rpc_getconf(handle))) {
|
||||
while ((nconf = __rpc_getconf(handle)) != NULL) {
|
||||
mutex_lock(&xprtlist_lock);
|
||||
for (l = xprtlist; l; l = l->next) {
|
||||
if (strcmp(l->xprt->xp_netid, nconf->nc_netid) == 0) {
|
||||
|
@ -121,12 +122,12 @@ svc_create(dispatch, prognum, versnum, nettype)
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (l == (struct xlist *)NULL) {
|
||||
if (l == NULL) {
|
||||
/* It was not found. Now create a new one */
|
||||
xprt = svc_tp_create(dispatch, prognum, versnum, nconf);
|
||||
if (xprt) {
|
||||
l = (struct xlist *)malloc(sizeof (*l));
|
||||
if (l == (struct xlist *)NULL) {
|
||||
if (l == NULL) {
|
||||
warnx("svc_create: no memory");
|
||||
mutex_unlock(&xprtlist_lock);
|
||||
return (0);
|
||||
|
@ -161,16 +162,17 @@ svc_tp_create(dispatch, prognum, versnum, nconf)
|
|||
{
|
||||
SVCXPRT *xprt;
|
||||
|
||||
if (nconf == (struct netconfig *)NULL) {
|
||||
if (nconf == NULL) {
|
||||
warnx(
|
||||
"svc_tp_create: invalid netconfig structure for prog %u vers %u",
|
||||
(unsigned)prognum, (unsigned)versnum);
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
xprt = svc_tli_create(RPC_ANYFD, nconf, (struct t_bind *)NULL, 0, 0);
|
||||
if (xprt == (SVCXPRT *)NULL) {
|
||||
return ((SVCXPRT *)NULL);
|
||||
xprt = svc_tli_create(RPC_ANYFD, nconf, NULL, 0, 0);
|
||||
if (xprt == NULL) {
|
||||
return (NULL);
|
||||
}
|
||||
/*LINTED const castaway*/
|
||||
(void) rpcb_unset(prognum, versnum, (struct netconfig *) nconf);
|
||||
if (svc_reg(xprt, prognum, versnum, dispatch, nconf) == FALSE) {
|
||||
warnx(
|
||||
|
@ -178,7 +180,7 @@ svc_tp_create(dispatch, prognum, versnum, nconf)
|
|||
(unsigned)prognum, (unsigned)versnum,
|
||||
nconf->nc_netid);
|
||||
SVC_DESTROY(xprt);
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
return (xprt);
|
||||
}
|
||||
|
@ -200,24 +202,23 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
|
|||
u_int sendsz; /* Max sendsize */
|
||||
u_int recvsz; /* Max recvsize */
|
||||
{
|
||||
register SVCXPRT *xprt = NULL; /* service handle */
|
||||
SVCXPRT *xprt = NULL; /* service handle */
|
||||
bool_t madefd = FALSE; /* whether fd opened here */
|
||||
struct __rpc_sockinfo si;
|
||||
struct sockaddr_storage ss;
|
||||
int active = 0;
|
||||
socklen_t slen;
|
||||
|
||||
if (fd == RPC_ANYFD) {
|
||||
if (nconf == (struct netconfig *)NULL) {
|
||||
if (nconf == NULL) {
|
||||
warnx("svc_tli_create: invalid netconfig");
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
fd = __rpc_nconf2fd(nconf);
|
||||
if (fd == -1) {
|
||||
warnx(
|
||||
"svc_tli_create: could not open connection for %s",
|
||||
nconf->nc_netid);
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
__rpc_nconf2sockinfo(nconf, &si);
|
||||
madefd = TRUE;
|
||||
|
@ -228,7 +229,7 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
|
|||
if (!__rpc_fd2sockinfo(fd, &si)) {
|
||||
warnx(
|
||||
"svc_tli_create: could not get transport information");
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,7 +243,7 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
|
|||
ss.ss_family = si.si_af;
|
||||
ss.ss_len = si.si_alen;
|
||||
if (bind(fd, (struct sockaddr *)(void *)&ss,
|
||||
si.si_alen) < 0) {
|
||||
(socklen_t)si.si_alen) < 0) {
|
||||
warnx(
|
||||
"svc_tli_create: could not bind to anonymous port");
|
||||
goto freedata;
|
||||
|
@ -250,13 +251,14 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
|
|||
}
|
||||
listen(fd, SOMAXCONN);
|
||||
} else {
|
||||
if (bind(fd, (struct sockaddr *)&bindaddr->addr.buf,
|
||||
si.si_alen) < 0) {
|
||||
if (bind(fd,
|
||||
(struct sockaddr *)(void *)&bindaddr->addr.buf,
|
||||
(socklen_t)si.si_alen) < 0) {
|
||||
warnx(
|
||||
"svc_tli_create: could not bind to requested address");
|
||||
goto freedata;
|
||||
}
|
||||
listen(fd, bindaddr->qlen);
|
||||
listen(fd, (int)bindaddr->qlen);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -266,9 +268,8 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
|
|||
switch (si.si_socktype) {
|
||||
case SOCK_STREAM:
|
||||
slen = sizeof ss;
|
||||
if (getpeername(fd, (struct sockaddr *)&ss, &slen)
|
||||
if (getpeername(fd, (struct sockaddr *)(void *)&ss, &slen)
|
||||
== 0) {
|
||||
active = 1;
|
||||
/* accepted socket */
|
||||
xprt = svc_fd_create(fd, sendsz, recvsz);
|
||||
} else
|
||||
|
@ -290,7 +291,7 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
|
|||
goto freedata;
|
||||
}
|
||||
|
||||
if (xprt == (SVCXPRT *)NULL)
|
||||
if (xprt == NULL)
|
||||
/*
|
||||
* The error messages here are spitted out by the lower layers:
|
||||
* svc_vc_create(), svc_fd_create() and svc_dg_create().
|
||||
|
@ -314,5 +315,5 @@ freedata:
|
|||
xprt->xp_fd = RPC_ANYFD;
|
||||
SVC_DESTROY(xprt);
|
||||
}
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svc_raw.c,v 1.13 2000/06/02 23:11:16 fvdl Exp $ */
|
||||
/* $NetBSD: svc_raw.c,v 1.14 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -100,11 +100,10 @@ svc_raw_create()
|
|||
srp = (struct svc_raw_private *)calloc(1, sizeof (*srp));
|
||||
if (srp == NULL) {
|
||||
mutex_unlock(&svcraw_lock);
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
if (__rpc_rawcombuf == NULL)
|
||||
__rpc_rawcombuf =
|
||||
(char *)calloc(UDPMSGSIZE, sizeof (char));
|
||||
__rpc_rawcombuf = calloc(UDPMSGSIZE, sizeof (char));
|
||||
srp->raw_buf = __rpc_rawcombuf; /* Share it with the client */
|
||||
svc_raw_private = srp;
|
||||
}
|
||||
|
@ -119,6 +118,7 @@ svc_raw_create()
|
|||
return (&srp->server);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static enum xprt_stat
|
||||
svc_raw_stat(xprt)
|
||||
SVCXPRT *xprt; /* args needed to satisfy ANSI-C typechecking */
|
||||
|
@ -126,6 +126,7 @@ SVCXPRT *xprt; /* args needed to satisfy ANSI-C typechecking */
|
|||
return (XPRT_IDLE);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static bool_t
|
||||
svc_raw_recv(xprt, msg)
|
||||
SVCXPRT *xprt;
|
||||
|
@ -151,6 +152,7 @@ svc_raw_recv(xprt, msg)
|
|||
return (TRUE);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static bool_t
|
||||
svc_raw_reply(xprt, msg)
|
||||
SVCXPRT *xprt;
|
||||
|
@ -177,13 +179,14 @@ svc_raw_reply(xprt, msg)
|
|||
return (TRUE);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static bool_t
|
||||
svc_raw_getargs(xprt, xdr_args, args_ptr)
|
||||
SVCXPRT *xprt;
|
||||
xdrproc_t xdr_args;
|
||||
caddr_t args_ptr;
|
||||
{
|
||||
register struct svc_raw_private *srp;
|
||||
struct svc_raw_private *srp;
|
||||
|
||||
mutex_lock(&svcraw_lock);
|
||||
srp = svc_raw_private;
|
||||
|
@ -195,6 +198,7 @@ svc_raw_getargs(xprt, xdr_args, args_ptr)
|
|||
return (*xdr_args)(&srp->xdr_stream, args_ptr);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static bool_t
|
||||
svc_raw_freeargs(xprt, xdr_args, args_ptr)
|
||||
SVCXPRT *xprt;
|
||||
|
@ -217,12 +221,14 @@ svc_raw_freeargs(xprt, xdr_args, args_ptr)
|
|||
return (*xdr_args)(xdrs, args_ptr);
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
svc_raw_destroy(xprt)
|
||||
SVCXPRT *xprt;
|
||||
{
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static bool_t
|
||||
svc_raw_control(xprt, rq, in)
|
||||
SVCXPRT *xprt;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svc_run.c,v 1.16 2000/06/04 04:35:14 thorpej Exp $ */
|
||||
/* $NetBSD: svc_run.c,v 1.17 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)svc_run.c 1.1 87/10/13 Copyr 1984 Sun Micro";
|
||||
static char *sccsid = "@(#)svc_run.c 2.1 88/07/29 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: svc_run.c,v 1.16 2000/06/04 04:35:14 thorpej Exp $");
|
||||
__RCSID("$NetBSD: svc_run.c,v 1.17 2000/07/06 03:10:35 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -70,8 +70,7 @@ svc_run()
|
|||
rwlock_rdlock(&svc_fd_lock);
|
||||
readfds = svc_fdset;
|
||||
rwlock_unlock(&svc_fd_lock);
|
||||
switch (select(svc_maxfd+1, &readfds, (fd_set *)0, (fd_set *)0,
|
||||
(struct timeval *)0)) {
|
||||
switch (select(svc_maxfd+1, &readfds, NULL, NULL, NULL)) {
|
||||
case -1:
|
||||
if (errno == EINTR) {
|
||||
continue;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svc_simple.c,v 1.19 2000/06/02 23:11:17 fvdl Exp $ */
|
||||
/* $NetBSD: svc_simple.c,v 1.20 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -50,6 +50,7 @@
|
|||
#include "reentrant.h"
|
||||
#include <sys/types.h>
|
||||
#include <rpc/rpc.h>
|
||||
#include <rpc/nettype.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
@ -126,7 +127,7 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
|
|||
}
|
||||
/* VARIABLES PROTECTED BY proglst_lock: proglst */
|
||||
mutex_lock(&proglst_lock);
|
||||
while ((nconf = __rpc_getconf(handle))) {
|
||||
while ((nconf = __rpc_getconf(handle)) != NULL) {
|
||||
struct proglst *pl;
|
||||
SVCXPRT *svcxprt;
|
||||
int madenow;
|
||||
|
@ -135,7 +136,7 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
|
|||
char *netid;
|
||||
|
||||
madenow = FALSE;
|
||||
svcxprt = (SVCXPRT *)NULL;
|
||||
svcxprt = NULL;
|
||||
for (pl = proglst; pl; pl = pl->p_nxt)
|
||||
if (strcmp(pl->p_netid, nconf->nc_netid) == 0) {
|
||||
svcxprt = pl->p_transp;
|
||||
|
@ -145,12 +146,11 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
|
|||
break;
|
||||
}
|
||||
|
||||
if (svcxprt == (SVCXPRT *)NULL) {
|
||||
if (svcxprt == NULL) {
|
||||
struct __rpc_sockinfo si;
|
||||
|
||||
svcxprt = svc_tli_create(RPC_ANYFD, nconf,
|
||||
(struct t_bind *)NULL, 0, 0);
|
||||
if (svcxprt == (SVCXPRT *)NULL)
|
||||
svcxprt = svc_tli_create(RPC_ANYFD, nconf, NULL, 0, 0);
|
||||
if (svcxprt == NULL)
|
||||
continue;
|
||||
if (!__rpc_fd2sockinfo(svcxprt->xp_fd, &si)) {
|
||||
warnx(rpc_reg_err, rpc_reg_msg, __reg_err2);
|
||||
|
@ -199,8 +199,8 @@ rpc_reg(prognum, versnum, procnum, progname, inproc, outproc, nettype)
|
|||
continue;
|
||||
}
|
||||
|
||||
pl = (struct proglst *)malloc(sizeof (struct proglst));
|
||||
if (pl == (struct proglst *)NULL) {
|
||||
pl = malloc(sizeof (struct proglst));
|
||||
if (pl == NULL) {
|
||||
warnx(rpc_reg_err, rpc_reg_msg, __no_mem_str);
|
||||
if (madenow) {
|
||||
SVC_DESTROY(svcxprt);
|
||||
|
@ -258,8 +258,8 @@ universal(rqstp, transp)
|
|||
* enforce "procnum 0 is echo" convention
|
||||
*/
|
||||
if (rqstp->rq_proc == NULLPROC) {
|
||||
if (svc_sendreply(transp, (xdrproc_t) xdr_void,
|
||||
(char *)NULL) == FALSE) {
|
||||
if (svc_sendreply(transp, (xdrproc_t) xdr_void, NULL) ==
|
||||
FALSE) {
|
||||
warnx("svc_sendreply failed");
|
||||
}
|
||||
return;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: svc_vc.c,v 1.4 2000/06/06 14:44:45 fvdl Exp $ */
|
||||
/* $NetBSD: svc_vc.c,v 1.5 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
|
||||
static char *sccsid = "@(#)svc_tcp.c 2.2 88/08/01 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: svc_vc.c,v 1.4 2000/06/06 14:44:45 fvdl Exp $");
|
||||
__RCSID("$NetBSD: svc_vc.c,v 1.5 2000/07/06 03:10:35 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -75,8 +75,10 @@ __weak_alias(svc_vc_create,_svc_vc_create)
|
|||
#endif
|
||||
|
||||
static SVCXPRT *makefd_xprt __P((int, u_int, u_int));
|
||||
#if 0
|
||||
static bool_t rendezvous_request __P((SVCXPRT *, struct rpc_msg *));
|
||||
static enum xprt_stat rendezvous_stat __P((SVCXPRT *));
|
||||
#endif
|
||||
static void svc_vc_destroy __P((SVCXPRT *));
|
||||
static int read_vc __P((caddr_t, caddr_t, int));
|
||||
static int write_vc __P((caddr_t, caddr_t, int));
|
||||
|
@ -85,7 +87,9 @@ static bool_t svc_vc_recv __P((SVCXPRT *, struct rpc_msg *));
|
|||
static bool_t svc_vc_getargs __P((SVCXPRT *, xdrproc_t, caddr_t));
|
||||
static bool_t svc_vc_freeargs __P((SVCXPRT *, xdrproc_t, caddr_t));
|
||||
static bool_t svc_vc_reply __P((SVCXPRT *, struct rpc_msg *));
|
||||
#if 0
|
||||
static void svc_vc_rendezvous_ops __P((SVCXPRT *));
|
||||
#endif
|
||||
static void svc_vc_ops __P((SVCXPRT *));
|
||||
static bool_t svc_vc_control __P((SVCXPRT *xprt, const u_int rq, void *in));
|
||||
|
||||
|
@ -130,16 +134,16 @@ svc_vc_create(fd, sendsize, recvsize)
|
|||
socklen_t slen;
|
||||
int one = 1;
|
||||
|
||||
r = (struct cf_rendezvous *)mem_alloc(sizeof(*r));
|
||||
r = mem_alloc(sizeof(*r));
|
||||
if (r == NULL) {
|
||||
warnx("svc_vc_create: out of memory");
|
||||
goto cleanup_svc_vc_create;
|
||||
}
|
||||
if (!__rpc_fd2sockinfo(fd, &si))
|
||||
return NULL;
|
||||
r->sendsize = __rpc_get_t_size(si.si_af, si.si_proto, sendsize);
|
||||
r->recvsize = __rpc_get_t_size(si.si_af, si.si_proto, recvsize);
|
||||
xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT));
|
||||
r->sendsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsize);
|
||||
r->recvsize = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsize);
|
||||
xprt = mem_alloc(sizeof(SVCXPRT));
|
||||
if (xprt == NULL) {
|
||||
warnx("svc_vc_create: out of memory");
|
||||
goto cleanup_svc_vc_create;
|
||||
|
@ -149,12 +153,11 @@ svc_vc_create(fd, sendsize, recvsize)
|
|||
xprt->xp_p2 = NULL;
|
||||
xprt->xp_p3 = NULL;
|
||||
xprt->xp_verf = _null_auth;
|
||||
svc_vc_rendezvous_ops(xprt);
|
||||
xprt->xp_port = -1; /* It is the rendezvouser */
|
||||
xprt->xp_port = (u_short)-1; /* It is the rendezvouser */
|
||||
xprt->xp_fd = fd;
|
||||
|
||||
slen = sizeof (struct sockaddr_storage);
|
||||
if (getsockname(fd, (struct sockaddr *)&sslocal, &slen) < 0) {
|
||||
if (getsockname(fd, (struct sockaddr *)(void *)&sslocal, &slen) < 0) {
|
||||
warnx("svc_vc_create: could not retrieve local addr");
|
||||
goto cleanup_svc_vc_create;
|
||||
}
|
||||
|
@ -167,12 +170,12 @@ svc_vc_create(fd, sendsize, recvsize)
|
|||
goto cleanup_svc_vc_create;
|
||||
|
||||
xprt->xp_ltaddr.maxlen = xprt->xp_ltaddr.len = sslocal.ss_len;
|
||||
xprt->xp_ltaddr.buf = mem_alloc(sslocal.ss_len);
|
||||
xprt->xp_ltaddr.buf = mem_alloc((size_t)sslocal.ss_len);
|
||||
if (xprt->xp_ltaddr.buf == NULL) {
|
||||
warnx("svc_vc_create: no mem for local addr");
|
||||
goto cleanup_svc_vc_create;
|
||||
}
|
||||
memcpy(xprt->xp_ltaddr.buf, &sslocal, sslocal.ss_len);
|
||||
memcpy(xprt->xp_ltaddr.buf, &sslocal, (size_t)sslocal.ss_len);
|
||||
|
||||
xprt->xp_rtaddr.maxlen = sizeof (struct sockaddr_storage);
|
||||
xprt_register(xprt);
|
||||
|
@ -180,7 +183,7 @@ svc_vc_create(fd, sendsize, recvsize)
|
|||
cleanup_svc_vc_create:
|
||||
if (r != NULL)
|
||||
mem_free(r, sizeof(*r));
|
||||
return ((SVCXPRT *)NULL);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -204,30 +207,30 @@ svc_fd_create(fd, sendsize, recvsize)
|
|||
return NULL;
|
||||
|
||||
slen = sizeof (struct sockaddr_storage);
|
||||
if (getsockname(fd, (struct sockaddr *)&ss, &slen) < 0) {
|
||||
if (getsockname(fd, (struct sockaddr *)(void *)&ss, &slen) < 0) {
|
||||
warnx("svc_fd_create: could not retrieve local addr");
|
||||
goto freedata;
|
||||
}
|
||||
ret->xp_ltaddr.maxlen = ret->xp_ltaddr.len = ss.ss_len;
|
||||
ret->xp_ltaddr.buf = mem_alloc(ss.ss_len);
|
||||
ret->xp_ltaddr.buf = mem_alloc((size_t)ss.ss_len);
|
||||
if (ret->xp_ltaddr.buf == NULL) {
|
||||
warnx("svc_fd_create: no mem for local addr");
|
||||
goto freedata;
|
||||
}
|
||||
memcpy(ret->xp_ltaddr.buf, &ss, ss.ss_len);
|
||||
memcpy(ret->xp_ltaddr.buf, &ss, (size_t)ss.ss_len);
|
||||
|
||||
slen = sizeof (struct sockaddr_storage);
|
||||
if (getpeername(fd, (struct sockaddr *)&ss, &slen) < 0) {
|
||||
if (getpeername(fd, (struct sockaddr *)(void *)&ss, &slen) < 0) {
|
||||
warnx("svc_fd_create: could not retrieve remote addr");
|
||||
goto freedata;
|
||||
}
|
||||
ret->xp_rtaddr.maxlen = ret->xp_rtaddr.len = ss.ss_len;
|
||||
ret->xp_rtaddr.buf = mem_alloc(ss.ss_len);
|
||||
ret->xp_rtaddr.buf = mem_alloc((size_t)ss.ss_len);
|
||||
if (ret->xp_rtaddr.buf == NULL) {
|
||||
warnx("svc_fd_create: no mem for local addr");
|
||||
goto freedata;
|
||||
}
|
||||
memcpy(ret->xp_rtaddr.buf, &ss, ss.ss_len);
|
||||
memcpy(ret->xp_rtaddr.buf, &ss, (size_t)ss.ss_len);
|
||||
#ifdef PORTMAP
|
||||
if (ss.ss_family == AF_INET) {
|
||||
ret->xp_raddr = *(struct sockaddr_in *)ret->xp_rtaddr.buf;
|
||||
|
@ -255,17 +258,17 @@ makefd_xprt(fd, sendsize, recvsize)
|
|||
|
||||
_DIAGASSERT(fd != -1);
|
||||
|
||||
xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT));
|
||||
if (xprt == (SVCXPRT *)NULL) {
|
||||
xprt = mem_alloc(sizeof(SVCXPRT));
|
||||
if (xprt == NULL) {
|
||||
warnx("svc_tcp: makefd_xprt: out of memory");
|
||||
goto done;
|
||||
}
|
||||
memset(xprt, 0, sizeof *xprt);
|
||||
cd = (struct cf_conn *)mem_alloc(sizeof(struct cf_conn));
|
||||
if (cd == (struct cf_conn *)NULL) {
|
||||
cd = mem_alloc(sizeof(struct cf_conn));
|
||||
if (cd == NULL) {
|
||||
warnx("svc_tcp: makefd_xprt: out of memory");
|
||||
mem_free(xprt, sizeof(SVCXPRT));
|
||||
xprt = (SVCXPRT *)NULL;
|
||||
xprt = NULL;
|
||||
goto done;
|
||||
}
|
||||
cd->strm_stat = XPRT_IDLE;
|
||||
|
@ -281,6 +284,7 @@ done:
|
|||
return (xprt);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/*ARGSUSED*/
|
||||
static bool_t
|
||||
rendezvous_request(xprt, msg)
|
||||
|
@ -299,7 +303,8 @@ rendezvous_request(xprt, msg)
|
|||
r = (struct cf_rendezvous *)xprt->xp_p1;
|
||||
again:
|
||||
len = sizeof addr;
|
||||
if ((sock = accept(xprt->xp_fd, (struct sockaddr *)&addr, &len)) < 0) {
|
||||
if ((sock = accept(xprt->xp_fd, (struct sockaddr *)(void *)&addr,
|
||||
&len)) < 0) {
|
||||
if (errno == EINTR)
|
||||
goto again;
|
||||
return (FALSE);
|
||||
|
@ -335,6 +340,7 @@ rendezvous_stat(xprt)
|
|||
|
||||
return (XPRT_IDLE);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
svc_vc_destroy(xprt)
|
||||
|
@ -371,6 +377,7 @@ svc_vc_destroy(xprt)
|
|||
mem_free(xprt, sizeof(SVCXPRT));
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
static bool_t
|
||||
svc_vc_control(xprt, rq, in)
|
||||
SVCXPRT *xprt;
|
||||
|
@ -433,7 +440,7 @@ read_vc(xprtp, buf, len)
|
|||
cmp->cmsg_type != SCM_CREDS)
|
||||
goto fatal_err;
|
||||
|
||||
sc = (struct sockcred *)CMSG_DATA(cmp);
|
||||
sc = (struct sockcred *)(void *)CMSG_DATA(cmp);
|
||||
|
||||
xprt->xp_p2 = mem_alloc(SOCKCREDSIZE(sc->sc_ngroups));
|
||||
if (xprt->xp_p2 == NULL)
|
||||
|
@ -618,6 +625,7 @@ svc_vc_ops(xprt)
|
|||
mutex_unlock(&ops_lock);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
svc_vc_rendezvous_ops(xprt)
|
||||
SVCXPRT *xprt;
|
||||
|
@ -645,3 +653,4 @@ svc_vc_rendezvous_ops(xprt)
|
|||
xprt->xp_ops2 = &ops2;
|
||||
mutex_unlock(&ops_lock);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: xdr.c,v 1.21 2000/01/22 22:53:59 mycroft Exp $ */
|
||||
/* $NetBSD: xdr.c,v 1.22 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)xdr.c 1.35 87/08/12";
|
||||
static char *sccsid = "@(#)xdr.c 2.1 88/07/29 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: xdr.c,v 1.21 2000/01/22 22:53:59 mycroft Exp $");
|
||||
__RCSID("$NetBSD: xdr.c,v 1.22 2000/07/06 03:10:35 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -597,7 +597,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize)
|
|||
return (TRUE);
|
||||
}
|
||||
if (sp == NULL) {
|
||||
*cpp = sp = (char *)mem_alloc(nodesize);
|
||||
*cpp = sp = mem_alloc(nodesize);
|
||||
}
|
||||
if (sp == NULL) {
|
||||
warnx("xdr_bytes: out of memory");
|
||||
|
@ -734,7 +734,7 @@ xdr_string(xdrs, cpp, maxsize)
|
|||
return (TRUE);
|
||||
}
|
||||
if (sp == NULL)
|
||||
*cpp = sp = (char *)mem_alloc(nodesize);
|
||||
*cpp = sp = mem_alloc(nodesize);
|
||||
if (sp == NULL) {
|
||||
warnx("xdr_string: out of memory");
|
||||
return (FALSE);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: xdr_rec.c,v 1.17 2000/01/22 22:19:18 mycroft Exp $ */
|
||||
/* $NetBSD: xdr_rec.c,v 1.18 2000/07/06 03:10:35 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||
|
@ -35,7 +35,7 @@
|
|||
static char *sccsid = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
|
||||
static char *sccsid = "@(#)xdr_rec.c 2.2 88/08/01 4.0 RPCSRC";
|
||||
#else
|
||||
__RCSID("$NetBSD: xdr_rec.c,v 1.17 2000/01/22 22:19:18 mycroft Exp $");
|
||||
__RCSID("$NetBSD: xdr_rec.c,v 1.18 2000/07/06 03:10:35 christos Exp $");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -167,8 +167,7 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
|
|||
/* like write, but pass it a tcp_handle, not sock */
|
||||
int (*writeit) __P((char *, char *, int));
|
||||
{
|
||||
RECSTREAM *rstrm =
|
||||
(RECSTREAM *)mem_alloc(sizeof(RECSTREAM));
|
||||
RECSTREAM *rstrm = mem_alloc(sizeof(RECSTREAM));
|
||||
|
||||
if (rstrm == NULL) {
|
||||
warnx("xdrrec_create: out of memory");
|
||||
|
|
Loading…
Reference in New Issue