diff options
author | alfred <alfred@FreeBSD.org> | 2004-01-10 02:59:54 +0000 |
---|---|---|
committer | alfred <alfred@FreeBSD.org> | 2004-01-10 02:59:54 +0000 |
commit | 0447b5115d7482927c10c5b243307370dc557165 (patch) | |
tree | d209a1f871a3c82b16e8a2720757730d22e0a6cd /sys/rpc | |
parent | cbae8dbd9738cadd0e6e9684351f175568f7dd1a (diff) | |
download | FreeBSD-src-0447b5115d7482927c10c5b243307370dc557165.zip FreeBSD-src-0447b5115d7482927c10c5b243307370dc557165.tar.gz |
Fix a panic when attempting a v4 op against a v3/v2-only server.
It happens because rpcclnt_request is incorrectly returning 0 in the case
of an rpc mismatch or auth error.
Submitted by: Jim Rees <rees@umich.edu>
Diffstat (limited to 'sys/rpc')
-rw-r--r-- | sys/rpc/rpcclnt.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sys/rpc/rpcclnt.c b/sys/rpc/rpcclnt.c index 70b5adc..af5c001 100644 --- a/sys/rpc/rpcclnt.c +++ b/sys/rpc/rpcclnt.c @@ -1212,7 +1212,8 @@ rpcclnt_request(rpc, mrest, procnum, td, cred, reply) if (rpc->rc_soflags & PR_CONNREQUIRED) error = rpcclnt_sndlock(&rpc->rc_flag, task); if (!error) { - error = rpcclnt_send(rpc->rc_so, rpc->rc_name, m_copym(m, 0, M_COPYALL, M_TRYWAIT), + error = rpcclnt_send(rpc->rc_so, rpc->rc_name, + m_copym(m, 0, M_COPYALL, M_TRYWAIT), task); if (rpc->rc_soflags & PR_CONNREQUIRED) rpcclnt_sndunlock(&rpc->rc_flag); @@ -1292,19 +1293,24 @@ rpcclnt_request(rpc, mrest, procnum, td, cred, reply) case RPC_MISMATCH: rpcm_dissect(tl, u_int32_t *, 2 * RPCX_UNSIGNED); reply->stat.mismatch_info.low = fxdr_unsigned(u_int32_t, *tl++); - reply->stat.mismatch_info.low = fxdr_unsigned(u_int32_t, *tl); + reply->stat.mismatch_info.high = fxdr_unsigned(u_int32_t, *tl); + error = EOPNOTSUPP; break; case RPC_AUTHERR: rpcm_dissect(tl, u_int32_t *, RPCX_UNSIGNED); reply->stat.autherr = fxdr_unsigned(u_int32_t, *tl); + error = EACCES; break; default: error = EBADRPC; - goto rpcmout; break; } - RPC_RETURN(0); - } else if (reply->stat.type == RPC_MSGACCEPTED) { + goto rpcmout; + } else if (reply->stat.type != RPC_MSGACCEPTED) { + error = EBADRPC; + goto rpcmout; + } + rpcm_dissect(tl, u_int32_t *, 2 * RPCX_UNSIGNED); reply->verf_md = md; @@ -1342,13 +1348,9 @@ rpcclnt_request(rpc, mrest, procnum, td, cred, reply) error = EBADRPC; goto rpcmout; } - RPC_RETURN(0); - } else { - error = EBADRPC; - } + error = 0; rpcmout: - RPCDEBUG("request returning error %d", error); RPC_RETURN(error); } |