|
|
3525d4 |
diff --git a/src/rpcb_svc_com.c b/src/rpcb_svc_com.c
|
|
|
3525d4 |
index 0c34632..0f104a6 100644
|
|
|
3525d4 |
--- a/src/rpcb_svc_com.c
|
|
|
3525d4 |
+++ b/src/rpcb_svc_com.c
|
|
|
3525d4 |
@@ -616,9 +616,7 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp,
|
|
|
3525d4 |
struct netconfig *nconf;
|
|
|
3525d4 |
struct netbuf *caller;
|
|
|
3525d4 |
struct r_rmtcall_args a;
|
|
|
3525d4 |
- char *buf_alloc = NULL, *outbufp;
|
|
|
3525d4 |
- char *outbuf_alloc = NULL;
|
|
|
3525d4 |
- char buf[RPC_BUF_MAX], outbuf[RPC_BUF_MAX];
|
|
|
3525d4 |
+ char outbuf[RPC_BUF_MAX];
|
|
|
3525d4 |
struct netbuf *na = (struct netbuf *) NULL;
|
|
|
3525d4 |
struct rpc_msg call_msg;
|
|
|
3525d4 |
int outlen;
|
|
|
3525d4 |
@@ -639,36 +637,10 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp,
|
|
|
3525d4 |
}
|
|
|
3525d4 |
if (si.si_socktype != SOCK_DGRAM)
|
|
|
3525d4 |
return; /* Only datagram type accepted */
|
|
|
3525d4 |
- sendsz = __rpc_get_t_size(si.si_af, si.si_proto, UDPMSGSIZE);
|
|
|
3525d4 |
- if (sendsz == 0) { /* data transfer not supported */
|
|
|
3525d4 |
- if (reply_type == RPCBPROC_INDIRECT)
|
|
|
3525d4 |
- svcerr_systemerr(transp);
|
|
|
3525d4 |
- return;
|
|
|
3525d4 |
- }
|
|
|
3525d4 |
- /*
|
|
|
3525d4 |
- * Should be multiple of 4 for XDR.
|
|
|
3525d4 |
- */
|
|
|
3525d4 |
- sendsz = ((sendsz + 3) / 4) * 4;
|
|
|
3525d4 |
- if (sendsz > RPC_BUF_MAX) {
|
|
|
3525d4 |
-#ifdef notyet
|
|
|
3525d4 |
- buf_alloc = alloca(sendsz); /* not in IDR2? */
|
|
|
3525d4 |
-#else
|
|
|
3525d4 |
- buf_alloc = malloc(sendsz);
|
|
|
3525d4 |
-#endif /* notyet */
|
|
|
3525d4 |
- if (buf_alloc == NULL) {
|
|
|
3525d4 |
- if (debugging)
|
|
|
3525d4 |
- xlog(LOG_DEBUG,
|
|
|
3525d4 |
- "rpcbproc_callit_com: No Memory!\n");
|
|
|
3525d4 |
- if (reply_type == RPCBPROC_INDIRECT)
|
|
|
3525d4 |
- svcerr_systemerr(transp);
|
|
|
3525d4 |
- return;
|
|
|
3525d4 |
- }
|
|
|
3525d4 |
- a.rmt_args.args = buf_alloc;
|
|
|
3525d4 |
- } else {
|
|
|
3525d4 |
- a.rmt_args.args = buf;
|
|
|
3525d4 |
- }
|
|
|
3525d4 |
+ sendsz = UDPMSGSIZE;
|
|
|
3525d4 |
|
|
|
3525d4 |
call_msg.rm_xid = 0; /* For error checking purposes */
|
|
|
3525d4 |
+ memset(&a, 0, sizeof(a)); /* Zero out the input buffer */
|
|
|
3525d4 |
if (!svc_getargs(transp, (xdrproc_t) xdr_rmtcall_args, (char *) &a)) {
|
|
|
3525d4 |
if (reply_type == RPCBPROC_INDIRECT)
|
|
|
3525d4 |
svcerr_decode(transp);
|
|
|
3525d4 |
@@ -704,11 +676,11 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp,
|
|
|
3525d4 |
|
|
|
3525d4 |
rpcbs_rmtcall(versnum - 2, reply_type, a.rmt_prog, a.rmt_vers,
|
|
|
3525d4 |
a.rmt_proc, transp->xp_netid, rbl);
|
|
|
3525d4 |
-
|
|
|
3525d4 |
if (rbl == (rpcblist_ptr)NULL) {
|
|
|
3525d4 |
#ifdef RPCBIND_DEBUG
|
|
|
3525d4 |
if (debugging)
|
|
|
3525d4 |
- xlog(LOG_DEBUG, "not found\n");
|
|
|
3525d4 |
+ xlog(LOG_DEBUG, "prog %lu vers %lu: not found\n",
|
|
|
3525d4 |
+ a.rmt_prog, a.rmt_vers);
|
|
|
3525d4 |
#endif
|
|
|
3525d4 |
if (reply_type == RPCBPROC_INDIRECT)
|
|
|
3525d4 |
svcerr_noprog(transp);
|
|
|
3525d4 |
@@ -822,24 +794,10 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp,
|
|
|
3525d4 |
call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
|
|
|
3525d4 |
call_msg.rm_call.cb_prog = a.rmt_prog;
|
|
|
3525d4 |
call_msg.rm_call.cb_vers = a.rmt_vers;
|
|
|
3525d4 |
- if (sendsz > RPC_BUF_MAX) {
|
|
|
3525d4 |
-#ifdef notyet
|
|
|
3525d4 |
- outbuf_alloc = alloca(sendsz); /* not in IDR2? */
|
|
|
3525d4 |
-#else
|
|
|
3525d4 |
- outbuf_alloc = malloc(sendsz);
|
|
|
3525d4 |
-#endif /* notyet */
|
|
|
3525d4 |
- if (outbuf_alloc == NULL) {
|
|
|
3525d4 |
- if (reply_type == RPCBPROC_INDIRECT)
|
|
|
3525d4 |
- svcerr_systemerr(transp);
|
|
|
3525d4 |
- if (debugging)
|
|
|
3525d4 |
- xlog(LOG_DEBUG,
|
|
|
3525d4 |
- "rpcbproc_callit_com: No memory!\n");
|
|
|
3525d4 |
- goto error;
|
|
|
3525d4 |
- }
|
|
|
3525d4 |
- xdrmem_create(&outxdr, outbuf_alloc, sendsz, XDR_ENCODE);
|
|
|
3525d4 |
- } else {
|
|
|
3525d4 |
- xdrmem_create(&outxdr, outbuf, sendsz, XDR_ENCODE);
|
|
|
3525d4 |
- }
|
|
|
3525d4 |
+
|
|
|
3525d4 |
+ memset(outbuf, '\0', sendsz); /* Zero out the output buffer */
|
|
|
3525d4 |
+ xdrmem_create(&outxdr, outbuf, sendsz, XDR_ENCODE);
|
|
|
3525d4 |
+
|
|
|
3525d4 |
if (!xdr_callhdr(&outxdr, &call_msg)) {
|
|
|
3525d4 |
if (reply_type == RPCBPROC_INDIRECT)
|
|
|
3525d4 |
svcerr_systemerr(transp);
|
|
|
3525d4 |
@@ -904,10 +862,6 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp,
|
|
|
3525d4 |
goto error;
|
|
|
3525d4 |
}
|
|
|
3525d4 |
outlen = (int) XDR_GETPOS(&outxdr);
|
|
|
3525d4 |
- if (outbuf_alloc)
|
|
|
3525d4 |
- outbufp = outbuf_alloc;
|
|
|
3525d4 |
- else
|
|
|
3525d4 |
- outbufp = outbuf;
|
|
|
3525d4 |
|
|
|
3525d4 |
na = uaddr2taddr(nconf, local_uaddr);
|
|
|
3525d4 |
if (!na) {
|
|
|
3525d4 |
@@ -916,7 +870,7 @@ rpcbproc_callit_com(struct svc_req *rqstp, SVCXPRT *transp,
|
|
|
3525d4 |
goto error;
|
|
|
3525d4 |
}
|
|
|
3525d4 |
|
|
|
3525d4 |
- if (sendto(fd, outbufp, outlen, 0, (struct sockaddr *)na->buf, na->len)
|
|
|
3525d4 |
+ if (sendto(fd, outbuf, outlen, 0, (struct sockaddr *)na->buf, na->len)
|
|
|
3525d4 |
!= outlen) {
|
|
|
3525d4 |
if (debugging)
|
|
|
3525d4 |
xlog(LOG_DEBUG,
|
|
|
3525d4 |
@@ -941,10 +895,6 @@ out:
|
|
|
3525d4 |
}
|
|
|
3525d4 |
if (local_uaddr)
|
|
|
3525d4 |
free(local_uaddr);
|
|
|
3525d4 |
- if (buf_alloc)
|
|
|
3525d4 |
- free(buf_alloc);
|
|
|
3525d4 |
- if (outbuf_alloc)
|
|
|
3525d4 |
- free(outbuf_alloc);
|
|
|
3525d4 |
if (na) {
|
|
|
3525d4 |
free(na->buf);
|
|
|
3525d4 |
free(na);
|