diff options
Diffstat (limited to 'libc/inet/rpc/rpc_callmsg.c')
-rw-r--r-- | libc/inet/rpc/rpc_callmsg.c | 74 |
1 files changed, 36 insertions, 38 deletions
diff --git a/libc/inet/rpc/rpc_callmsg.c b/libc/inet/rpc/rpc_callmsg.c index d9d815a6f..1bd6bb6d6 100644 --- a/libc/inet/rpc/rpc_callmsg.c +++ b/libc/inet/rpc/rpc_callmsg.c @@ -28,7 +28,9 @@ * Mountain View, California 94043 */ #if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro"; +static char sccsid[] = + + "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro"; #endif /* @@ -45,10 +47,9 @@ static char sccsid[] = "@(#)rpc_callmsg.c 1.4 87/08/11 Copyr 1984 Sun Micro"; /* * XDR a call message */ -bool_t -xdr_callmsg(xdrs, cmsg) - register XDR *xdrs; - register struct rpc_msg *cmsg; +bool_t xdr_callmsg(xdrs, cmsg) +register XDR *xdrs; +register struct rpc_msg *cmsg; { register long *buf; register struct opaque_auth *oa; @@ -61,9 +62,9 @@ xdr_callmsg(xdrs, cmsg) return (FALSE); } buf = XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT - + RNDUP(cmsg->rm_call.cb_cred.oa_length) - + 2 * BYTES_PER_XDR_UNIT - + RNDUP(cmsg->rm_call.cb_verf.oa_length)); + + RNDUP(cmsg->rm_call.cb_cred.oa_length) + + 2 * BYTES_PER_XDR_UNIT + + RNDUP(cmsg->rm_call.cb_verf.oa_length)); if (buf != NULL) { IXDR_PUT_LONG(buf, cmsg->rm_xid); IXDR_PUT_ENUM(buf, cmsg->rm_direction); @@ -81,17 +82,17 @@ xdr_callmsg(xdrs, cmsg) IXDR_PUT_ENUM(buf, oa->oa_flavor); IXDR_PUT_LONG(buf, oa->oa_length); if (oa->oa_length) { - bcopy(oa->oa_base, (caddr_t)buf, oa->oa_length); - buf += RNDUP(oa->oa_length) / sizeof (long); + bcopy(oa->oa_base, (caddr_t) buf, oa->oa_length); + buf += RNDUP(oa->oa_length) / sizeof(long); } oa = &cmsg->rm_call.cb_verf; IXDR_PUT_ENUM(buf, oa->oa_flavor); IXDR_PUT_LONG(buf, oa->oa_length); if (oa->oa_length) { - bcopy(oa->oa_base, (caddr_t)buf, oa->oa_length); + bcopy(oa->oa_base, (caddr_t) buf, oa->oa_length); /* no real need.... - buf += RNDUP(oa->oa_length) / sizeof (long); - */ + buf += RNDUP(oa->oa_length) / sizeof (long); + */ } return (TRUE); } @@ -101,6 +102,7 @@ xdr_callmsg(xdrs, cmsg) if (buf != NULL) { cmsg->rm_xid = IXDR_GET_LONG(buf); cmsg->rm_direction = IXDR_GET_ENUM(buf, enum msg_type); + if (cmsg->rm_direction != CALL) { return (FALSE); } @@ -125,23 +127,22 @@ xdr_callmsg(xdrs, cmsg) buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length)); if (buf == NULL) { if (xdr_opaque(xdrs, oa->oa_base, - oa->oa_length) == FALSE) { + oa->oa_length) == FALSE) { return (FALSE); } } else { - bcopy((caddr_t)buf, oa->oa_base, - oa->oa_length); + bcopy((caddr_t) buf, oa->oa_base, oa->oa_length); /* no real need.... - buf += RNDUP(oa->oa_length) / - sizeof (long); - */ + buf += RNDUP(oa->oa_length) / + sizeof (long); + */ } } oa = &cmsg->rm_call.cb_verf; buf = XDR_INLINE(xdrs, 2 * BYTES_PER_XDR_UNIT); if (buf == NULL) { if (xdr_enum(xdrs, &oa->oa_flavor) == FALSE || - xdr_u_int(xdrs, &oa->oa_length) == FALSE) { + xdr_u_int(xdrs, &oa->oa_length) == FALSE) { return (FALSE); } } else { @@ -159,32 +160,29 @@ xdr_callmsg(xdrs, cmsg) buf = XDR_INLINE(xdrs, RNDUP(oa->oa_length)); if (buf == NULL) { if (xdr_opaque(xdrs, oa->oa_base, - oa->oa_length) == FALSE) { + oa->oa_length) == FALSE) { return (FALSE); } } else { - bcopy((caddr_t)buf, oa->oa_base, - oa->oa_length); + bcopy((caddr_t) buf, oa->oa_base, oa->oa_length); /* no real need... - buf += RNDUP(oa->oa_length) / - sizeof (long); - */ + buf += RNDUP(oa->oa_length) / + sizeof (long); + */ } } return (TRUE); } } - if ( - xdr_u_long(xdrs, &(cmsg->rm_xid)) && - xdr_enum(xdrs, (enum_t *)&(cmsg->rm_direction)) && - (cmsg->rm_direction == CALL) && - xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) && - (cmsg->rm_call.cb_rpcvers == RPC_MSG_VERSION) && - xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog)) && - xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers)) && - xdr_u_long(xdrs, &(cmsg->rm_call.cb_proc)) && - xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_cred)) ) - return (xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_verf))); + if (xdr_u_long(xdrs, &(cmsg->rm_xid)) && + xdr_enum(xdrs, (enum_t *) & (cmsg->rm_direction)) && + (cmsg->rm_direction == CALL) && + xdr_u_long(xdrs, &(cmsg->rm_call.cb_rpcvers)) && + (cmsg->rm_call.cb_rpcvers == RPC_MSG_VERSION) && + xdr_u_long(xdrs, &(cmsg->rm_call.cb_prog)) && + xdr_u_long(xdrs, &(cmsg->rm_call.cb_vers)) && + xdr_u_long(xdrs, &(cmsg->rm_call.cb_proc)) && + xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_cred))) + return (xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_verf))); return (FALSE); } - |