#define AUTH_PRIVATE(auth) ((struct audata *)auth->ah_private)
-static bool_t marshal_new_auth();
+static void marshal_new_auth();
/*
* Marshals (pre-serializes) an auth struct.
* sets private data, au_marshed and au_mpos
*/
-static bool_t marshal_new_auth(auth)
+static void marshal_new_auth(auth)
register AUTH *auth;
{
XDR xdr_stream;
&& xdr_int(xdrs, &(p->aup_uid))
&& xdr_int(xdrs, &(p->aup_gid))
&& xdr_array(xdrs, (caddr_t *) & (p->aup_gids),
- &(p->aup_len), NGRPS, sizeof(int), xdr_int)) {
+ &(p->aup_len), NGRPS, sizeof(int), (xdrproc_t) xdr_int)) {
return (TRUE);
}
return (FALSE);
#include <netdb.h>
#include <errno.h>
#include <rpc/pmap_clnt.h>
+#include <unistd.h>
#define MCALL_MSG_SIZE 24
struct timeval now;
struct rpc_msg call_msg;
+ ct = NULL; /* in case of fooy */
h = (CLIENT *) mem_alloc(sizeof(*h));
if (h == NULL) {
(void) fprintf(stderr, "clnttcp_create: out of memory\n");
while (TRUE) {
reply_msg.acpted_rply.ar_verf = _null_auth;
reply_msg.acpted_rply.ar_results.where = NULL;
- reply_msg.acpted_rply.ar_results.proc = xdr_void;
+ reply_msg.acpted_rply.ar_results.proc = (xdrproc_t) xdr_void;
if (!xdrrec_skiprecord(xdrs))
return (ct->ct_error.re_status);
/* now decode and validate the response header */
while (TRUE) {
readfds = mask;
switch (select
- (_rpc_dtablesize(), &readfds, (int *) NULL, (int *) NULL,
+ (_rpc_dtablesize(), &readfds, NULL, NULL,
&(ct->ct_wait))) {
case 0:
ct->ct_error.re_status = RPC_TIMEDOUT;
#include <netdb.h>
#include <errno.h>
#include <rpc/pmap_clnt.h>
+#include <unistd.h>
extern int errno;
struct timeval now;
struct rpc_msg call_msg;
+ cu = NULL; /* in case of fooy */
cl = (CLIENT *) mem_alloc(sizeof(CLIENT));
if (cl == NULL) {
(void) fprintf(stderr, "clntudp_create: out of memory\n");
#endif /* def FD_SETSIZE */
for (;;) {
readfds = mask;
- switch (select(_rpc_dtablesize(), &readfds, (int *) NULL,
- (int *) NULL, &(cu->cu_wait))) {
+ switch (select(_rpc_dtablesize(), &readfds, NULL,
+ NULL, &(cu->cu_wait))) {
case 0:
time_waited.tv_sec += cu->cu_wait.tv_sec;
#include <sys/ioctl.h>
#include <arpa/inet.h>
#include <netinet/in.h>
+#include <rpc/clnt.h>
+#include <unistd.h>
#ifdef __linux__
/* DO use gethostbyname because it's portable */
#include <netdb.h>
-get_myaddress(addr)
+void get_myaddress(addr)
struct sockaddr_in *addr;
{
char localhost[256 + 1];
struct rpcent rpc;
char line[BUFSIZ + 1];
char *domain;
-} *rpcdata, *_rpcdata();
+} *rpcdata;
-static struct rpcent *interpret();
+static struct rpcent *interpret(const char *val, int len);
struct hostent *gethostent();
char *inet_ntoa();
{
register struct rpcdata *d = _rpcdata();
register struct rpcent *p;
- int reason;
- char adrstr[16], *val = NULL;
- int vallen;
if (d == 0)
return (0);
setrpcent(0);
- while (p = getrpcent()) {
+ while ((p = getrpcent())) {
if (p->r_number == number)
break;
}
char **rp;
setrpcent(0);
- while (rpc = getrpcent()) {
+ while ((rpc = getrpcent())) {
if (strcmp(rpc->r_name, name) == 0)
return (rpc);
for (rp = rpc->r_aliases; *rp != NULL; rp++) {
struct rpcent *getrpcent()
{
- struct rpcent *hp;
- int reason;
- char *key = NULL, *val = NULL;
- int keylen, vallen;
register struct rpcdata *d = _rpcdata();
if (d == 0)
}
#endif
-static struct rpcent *interpret(val, len)
+static struct rpcent *interpret(const char *val, int len)
{
register struct rpcdata *d = _rpcdata();
char *p;
register char *cp, **q;
if (d == 0)
- return;
+ return NULL;
strncpy(d->line, val, len);
p = d->line;
d->line[len] = '\n';
#include <rpc/rpc.h>
#include <netdb.h>
#include <sys/socket.h>
+#include <rpc/pmap_clnt.h>
extern int getrpcport (const char * host, u_long prognum,
u_long versnum, u_int proto)
#include <rpc/rpc.h>
#include <rpc/pmap_prot.h>
#include <rpc/pmap_clnt.h>
+#include <unistd.h>
static struct timeval timeout = { 5, 0 };
static struct timeval tottimeout = { 60, 0 };
parms.pm_vers = version;
parms.pm_prot = protocol;
parms.pm_port = port;
- if (CLNT_CALL(client, PMAPPROC_SET, xdr_pmap, &parms, xdr_bool, &rslt,
+ if (CLNT_CALL(client, PMAPPROC_SET, (xdrproc_t) xdr_pmap, (caddr_t) &parms,
+ (xdrproc_t) xdr_bool, (caddr_t) &rslt,
tottimeout) != RPC_SUCCESS) {
clnt_perror(client, "Cannot register service");
return (FALSE);
parms.pm_prog = program;
parms.pm_vers = version;
parms.pm_port = parms.pm_prot = 0;
- CLNT_CALL(client, PMAPPROC_UNSET, xdr_pmap, &parms, xdr_bool, &rslt,
- tottimeout);
+ CLNT_CALL(client, PMAPPROC_UNSET, (xdrproc_t) xdr_pmap, (caddr_t) &parms,
+ (xdrproc_t) xdr_bool, (caddr_t) &rslt, tottimeout);
CLNT_DESTROY(client);
(void) close(socket);
return (rslt);
#include <errno.h>
//#include <net/if.h>
#include <sys/ioctl.h>
+#include <unistd.h>
#define NAMELEN 255
#define MAX_BROADCAST_SIZE 1400
address->sin_port = htons(PMAPPORT);
client = clnttcp_create(address, PMAPPROG, PMAPVERS, &socket, 50, 500);
if (client != (CLIENT *) NULL) {
- if (CLNT_CALL(client, PMAPPROC_DUMP, xdr_void, NULL, xdr_pmaplist,
- &head, minutetimeout) != RPC_SUCCESS) {
+ if (CLNT_CALL(client, PMAPPROC_DUMP, (xdrproc_t) xdr_void, NULL,
+ (xdrproc_t) xdr_pmaplist, (caddr_t) &head,
+ minutetimeout) != RPC_SUCCESS) {
clnt_perror(client, "pmap_getmaps rpc problem");
}
CLNT_DESTROY(client);
#include <rpc/pmap_prot.h>
#include <rpc/pmap_clnt.h>
#include <sys/socket.h>
+#include <unistd.h>
//#include <net/if.h>
static struct timeval timeout = { 5, 0 };
parms.pm_vers = version;
parms.pm_prot = protocol;
parms.pm_port = 0; /* not needed or used */
- if (CLNT_CALL(client, PMAPPROC_GETPORT, xdr_pmap, &parms,
- xdr_u_short, &port, tottimeout) != RPC_SUCCESS) {
+ if (CLNT_CALL(client, PMAPPROC_GETPORT,
+ (xdrproc_t) xdr_pmap, (caddr_t) &parms,
+ (xdrproc_t) xdr_u_short, (caddr_t) &port,
+ tottimeout) != RPC_SUCCESS) {
rpc_createerr.cf_stat = RPC_PMAPFAILURE;
clnt_geterr(client, &rpc_createerr.cf_error);
} else if (port == 0) {
bool_t more_elements;
register int freeing = (xdrs->x_op == XDR_FREE);
register struct pmaplist **next;
+#warning expect "next" might be unitialized
while (TRUE) {
more_elements = (bool_t) (*rp != NULL);
if (freeing)
next = &((*rp)->pml_next);
if (!xdr_reference(xdrs, (caddr_t *) rp,
- (u_int) sizeof(struct pmaplist), xdr_pmap))
+ (u_int) sizeof(struct pmaplist), (xdrproc_t) xdr_pmap))
return (FALSE);
rp = (freeing) ? next : &((*rp)->pml_next);
r.port_ptr = port_ptr;
r.results_ptr = resp;
r.xdr_results = xdrres;
- stat = CLNT_CALL(client, PMAPPROC_CALLIT, xdr_rmtcall_args, &a,
- xdr_rmtcallres, &r, tout);
+ stat = CLNT_CALL(client, PMAPPROC_CALLIT,
+ (xdrproc_t) xdr_rmtcall_args, (caddr_t) &a,
+ (xdrproc_t) xdr_rmtcallres, (caddr_t) &r, tout);
CLNT_DESTROY(client);
} else {
stat = RPC_FAILED;
port_ptr = (caddr_t) crp->port_ptr;
if (xdr_reference(xdrs, &port_ptr, sizeof(u_long),
- xdr_u_long) && xdr_u_long(xdrs, &crp->resultslen)) {
+ (xdrproc_t) xdr_u_long) && xdr_u_long(xdrs, &crp->resultslen)) {
crp->port_ptr = (u_long *) port_ptr;
return ((*(crp->xdr_results)) (xdrs, crp->results_ptr));
}
recv_again:
msg.acpted_rply.ar_verf = _null_auth;
msg.acpted_rply.ar_results.where = (caddr_t) & r;
- msg.acpted_rply.ar_results.proc = xdr_rmtcallres;
+ msg.acpted_rply.ar_results.proc = (xdrproc_t) xdr_rmtcallres;
readfds = mask;
- switch (select(_rpc_dtablesize(), &readfds, (int *) NULL,
- (int *) NULL, &t)) {
+ switch (select(_rpc_dtablesize(), &readfds, NULL, NULL, &t)) {
case 0: /* timed out */
stat = RPC_TIMEDOUT;
#endif
}
xdrs->x_op = XDR_FREE;
- msg.acpted_rply.ar_results.proc = xdr_void;
+ msg.acpted_rply.ar_results.proc = (xdrproc_t) xdr_void;
(void) xdr_replymsg(xdrs, &msg);
(void) (*xresults) (xdrs, resultsp);
xdr_destroy(xdrs);
register XDR *xdrs;
register struct rpc_msg *cmsg;
{
- register long *buf;
+ register void *buf;
register struct opaque_auth *oa;
if (xdrs->x_op == XDR_ENCODE) {
#define __FORCE_GLIBC__
#include <features.h>
+#include <rpc/clnt.h>
+#include <unistd.h>
/*
* Cache the result of getdtablesize(), so we don't have to do an
* expensive system call every time.
*/
-_rpc_dtablesize()
+int _rpc_dtablesize(void)
{
static int size;
if (!xdr_u_long(xdrs, &(ar->ar_vers.low)))
return (FALSE);
return (xdr_u_long(xdrs, &(ar->ar_vers.high)));
+ default: /* silence the warnings */
}
return (TRUE); /* TRUE => open ended set of problems */
}
case AUTH_ERROR:
return (xdr_enum(xdrs, (enum_t *) & (rr->rj_why)));
+ default: /* silence the warnings */
}
return (FALSE);
}
static struct xdr_discrim reply_dscrm[3] = {
- {(int) MSG_ACCEPTED, xdr_accepted_reply},
- {(int) MSG_DENIED, xdr_rejected_reply},
+ {(int) MSG_ACCEPTED, (xdrproc_t) xdr_accepted_reply},
+ {(int) MSG_DENIED, (xdrproc_t) xdr_rejected_reply},
{__dontcare__, NULL_xdrproc_t}
};
case SUCCESS:
error->re_status = RPC_SUCCESS;
return;
+
+ default: /* silence the warnings */
}
/* something's wrong, but we don't know what ... */
error->re_status = RPC_FAILED;
case AUTH_ERROR:
error->re_status = RPC_AUTHERROR;
return;
+
+ default: /* silence the warnings */
}
/* something's wrong, but we don't know what ... */
error->re_status = RPC_FAILED;
error->re_vers.low = msg->acpted_rply.ar_vers.low;
error->re_vers.high = msg->acpted_rply.ar_vers.high;
break;
+
+ default: /* silence the warnings */
}
}
maskp = (u_long *) readfds->fds_bits;
#endif
for (sock = 0; sock < setsize; sock += NFDBITS) {
- for (mask = *maskp++; bit = ffs(mask); mask ^= (1 << (bit - 1))) {
+ for (mask = *maskp++; (bit = ffs(mask)); mask ^= (1 << (bit - 1))) {
/* sock has input waiting */
xprt = xports[sock + bit - 1];
#else
static struct {
enum auth_stat (*authenticator) ();
} svcauthsw[] = {
- _svcauth_null, /* AUTH_NULL */
- _svcauth_unix, /* AUTH_UNIX */
- _svcauth_short, /* AUTH_SHORT */
+ {_svcauth_null}, /* AUTH_NULL */
+ {_svcauth_unix}, /* AUTH_UNIX */
+ {_svcauth_short}, /* AUTH_SHORT */
};
#define AUTH_MAX 2 /* HIGHEST AUTH NUMBER */
auth_len = (u_int) msg->rm_call.cb_cred.oa_length;
xdrmem_create(&xdrs, msg->rm_call.cb_cred.oa_base, auth_len,
XDR_DECODE);
- buf = XDR_INLINE(&xdrs, auth_len);
+ buf = (long *)XDR_INLINE(&xdrs, auth_len);
if (buf != NULL) {
aup->aup_time = IXDR_GET_LONG(buf);
str_len = IXDR_GET_U_LONG(buf);
#else
readfds = svc_fds;
#endif /* def FD_SETSIZE */
- switch (select(_rpc_dtablesize(), &readfds, (int *) 0, (int *) 0,
+ switch (select(_rpc_dtablesize(), &readfds, NULL, NULL,
(struct timeval *) 0)) {
case -1:
if (errno == EINTR) {
static SVCXPRT *transp;
struct proglst *pl;
-registerrpc(prognum, versnum, procnum, progname, inproc, outproc)
+extern bool_t pmap_unset(u_long program, u_long version);
+
+int registerrpc(prognum, versnum, procnum, progname, inproc, outproc)
char *(*progname) ();
xdrproc_t inproc, outproc;
{
if (procnum == NULLPROC) {
(void) fprintf(stderr,
- "can't reassign procedure number %d\n", NULLPROC);
+ "can't reassign procedure number %lu\n", NULLPROC);
return (-1);
}
if (transp == 0) {
* enforce "procnum 0 is echo" convention
*/
if (rqstp->rq_proc == NULLPROC) {
- if (svc_sendreply(transp, xdr_void, (char *) NULL) == FALSE) {
+ if (svc_sendreply(transp, (xdrproc_t) xdr_void, (char *) NULL) == FALSE) {
(void) fprintf(stderr, "xxx\n");
exit(1);
}
return;
}
outdata = (*(pl->p_progname)) (xdrbuf);
- if (outdata == NULL && pl->p_outproc != xdr_void)
+ if (outdata == NULL && pl->p_outproc != (xdrproc_t) xdr_void)
/* there was an error */
return;
if (!svc_sendreply(transp, pl->p_outproc, outdata)) {
#include <rpc/rpc.h>
#include <sys/socket.h>
#include <errno.h>
-extern errno;
+#include <unistd.h>
/*
* Ops vector for TCP/IP based rpc service handle
static bool_t rendezvous_request();
static enum xprt_stat rendezvous_stat();
+#warning Expect 3 warnings for initialization from incompatible pointer type
static struct xp_ops svctcp_rendezvous_op = {
rendezvous_request,
rendezvous_stat,
#endif /* def FD_SETSIZE */
do {
readfds = mask;
- if (select(_rpc_dtablesize(), &readfds, (int *) NULL, (int *) NULL,
+ if (select(_rpc_dtablesize(), &readfds, NULL, NULL,
&wait_per_try) <= 0) {
if (errno == EINTR) {
continue;
#include <rpc/rpc.h>
#include <sys/socket.h>
#include <errno.h>
+#include <unistd.h>
#define rpc_buffer(xprt) ((xprt)->xp_p1)
+#ifndef MAX
#define MAX(a, b) ((a > b) ? a : b)
+#endif
static bool_t svcudp_recv();
static bool_t svcudp_reply();
static bool_t svcudp_freeargs();
static void svcudp_destroy();
+static void cache_set(SVCXPRT *xprt, u_long replylen);
+static int cache_get(SVCXPRT *xprt, struct rpc_msg *msg,
+ char **replyp, u_long *replylenp);
+
static struct xp_ops svcudp_op = {
svcudp_recv,
svcudp_stat,
svcudp_destroy
};
-extern int errno;
-
/*
* kept in xprt->xp_p2
*/
* Enable use of the cache.
* Note: there is no disable.
*/
-svcudp_enablecache(transp, size)
+int svcudp_enablecache(transp, size)
SVCXPRT *transp;
u_long size;
{
/*
* Set an entry in the cache
*/
-static cache_set(xprt, replylen)
+static void cache_set(xprt, replylen)
SVCXPRT *xprt;
u_long replylen;
{
* Try to get an entry from the cache
* return 1 if found, 0 if not found
*/
-static cache_get(xprt, msg, replyp, replylenp)
+static int cache_get(xprt, msg, replyp, replylenp)
SVCXPRT *xprt;
struct rpc_msg *msg;
char **replyp;
}
if (rndup == 0)
return (TRUE);
- return (XDR_GETBYTES(xdrs, crud, rndup));
+ return (XDR_GETBYTES(xdrs, (caddr_t) crud, rndup));
}
if (xdrs->x_op == XDR_ENCODE) {
case XDR_ENCODE:
size = strlen(sp);
break;
+ default: /* silence the warnings */
}
if (!xdr_u_int(xdrs, &size)) {
return (FALSE);
*/
#include <stdio.h>
+#include <string.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
case XDR_FREE:
return (TRUE);
+ default: /* silence the warnings */
}
/*
*
*/
-
+#include <string.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <netinet/in.h>
static bool_t xdrmem_putbytes();
static u_int xdrmem_getpos();
static bool_t xdrmem_setpos();
-static long *xdrmem_inline();
+static int32_t *xdrmem_inline();
static void xdrmem_destroy();
static struct xdr_ops xdrmem_ops = {
return (TRUE);
}
-static long *xdrmem_inline(xdrs, len)
+static int32_t *xdrmem_inline(xdrs, len)
register XDR *xdrs;
int len;
{
- long *buf = 0;
+ int32_t *buf = 0;
if (xdrs->x_handy >= len) {
xdrs->x_handy -= len;
- buf = (long *) xdrs->x_private;
+ buf = (int32_t *) xdrs->x_private;
xdrs->x_private += len;
}
return (buf);
*/
#include <stdio.h>
+#include <string.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
#include <netinet/in.h>
static bool_t xdrrec_putbytes();
static u_int xdrrec_getpos();
static bool_t xdrrec_setpos();
-static long *xdrrec_inline();
+static int32_t *xdrrec_inline();
static void xdrrec_destroy();
static struct xdr_ops xdrrec_ops = {
u_int recvsize;
} RECSTREAM;
+static bool_t flush_out(register RECSTREAM *rstrm, bool_t eor);
+static bool_t set_input_fragment(register RECSTREAM *rstrm);
+static bool_t get_input_bytes(register RECSTREAM *rstrm,
+ register caddr_t addr, register int len);
+static bool_t skip_input_bytes(register RECSTREAM *rstrm, long cnt);
/*
* Create an xdr handle for xdrrec
return (TRUE);
}
break;
+ default: /* silence the warnings */
}
return (FALSE);
}
-static long *xdrrec_inline(xdrs, len)
+static int32_t *xdrrec_inline(xdrs, len)
register XDR *xdrs;
int len;
{
register RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
- long *buf = NULL;
+ int32_t *buf = NULL;
switch (xdrs->x_op) {
case XDR_ENCODE:
if ((rstrm->out_finger + len) <= rstrm->out_boundry) {
- buf = (long *) rstrm->out_finger;
+ buf = (int32_t *) rstrm->out_finger;
rstrm->out_finger += len;
}
break;
case XDR_DECODE:
if ((len <= rstrm->fbtbc) &&
((rstrm->in_finger + len) <= rstrm->in_boundry)) {
- buf = (long *) rstrm->in_finger;
+ buf = (int32_t *) rstrm->in_finger;
rstrm->fbtbc -= len;
rstrm->in_finger += len;
}
break;
+ default: /* silence the warnings */
}
return (buf);
}
*/
#include <stdio.h>
+#include <string.h>
#include <rpc/types.h>
#include <rpc/xdr.h>
}
bzero(loc, (int) size);
break;
+ default: /* silence the warnings */
}
stat = (*proc) (xdrs, loc, LASTUNSIGNED);
static bool_t xdrstdio_putbytes();
static u_int xdrstdio_getpos();
static bool_t xdrstdio_setpos();
-static long *xdrstdio_inline();
+static int32_t *xdrstdio_inline();
static void xdrstdio_destroy();
/*
FALSE : TRUE);
}
-static long *xdrstdio_inline(xdrs, len)
+static int32_t *xdrstdio_inline(xdrs, len)
XDR *xdrs;
u_int len;
{