示例#1
0
void
nfsreply_noaddr_print(netdissect_options *ndo,
                      const u_char *bp, u_int length,
                      const u_char *bp2)
{
	const struct sunrpc_msg *rp;
	uint32_t proc, vers, reply_stat;
	enum sunrpc_reject_stat rstat;
	uint32_t rlow;
	uint32_t rhigh;
	enum sunrpc_auth_stat rwhy;

	nfserr = 0;		/* assume no error */
	rp = (const struct sunrpc_msg *)bp;

	ND_TCHECK(rp->rm_reply.rp_stat);
	reply_stat = EXTRACT_BE_U_4(&rp->rm_reply.rp_stat);
	switch (reply_stat) {

	case SUNRPC_MSG_ACCEPTED:
		ND_PRINT("reply ok %u", length);
		if (xid_map_find(rp, bp2, &proc, &vers) >= 0)
			interp_reply(ndo, rp, proc, vers, length);
		break;

	case SUNRPC_MSG_DENIED:
		ND_PRINT("reply ERR %u: ", length);
		ND_TCHECK(rp->rm_reply.rp_reject.rj_stat);
		rstat = EXTRACT_BE_U_4(&rp->rm_reply.rp_reject.rj_stat);
		switch (rstat) {

		case SUNRPC_RPC_MISMATCH:
			ND_TCHECK(rp->rm_reply.rp_reject.rj_vers.high);
			rlow = EXTRACT_BE_U_4(&rp->rm_reply.rp_reject.rj_vers.low);
			rhigh = EXTRACT_BE_U_4(&rp->rm_reply.rp_reject.rj_vers.high);
			ND_PRINT("RPC Version mismatch (%u-%u)", rlow, rhigh);
			break;

		case SUNRPC_AUTH_ERROR:
			ND_TCHECK(rp->rm_reply.rp_reject.rj_why);
			rwhy = EXTRACT_BE_U_4(&rp->rm_reply.rp_reject.rj_why);
			ND_PRINT("Auth %s", tok2str(sunrpc_auth_str, "Invalid failure code %u", rwhy));
			break;

		default:
			ND_PRINT("Unknown reason for rejecting rpc message %u", (unsigned int)rstat);
			break;
		}
		break;

	default:
		ND_PRINT("reply Unknown rpc response code=%u %u", reply_stat, length);
		break;
	}
	return;

trunc:
	if (!nfserr)
		ND_PRINT("%s", tstr);
}
示例#2
0
void
nfsreply_print_noaddr(register const u_char *bp, u_int length,
	       register const u_char *bp2)
{
	register const struct sunrpc_msg *rp;
	u_int32_t proc, vers, reply_stat;
	enum sunrpc_reject_stat rstat;
	u_int32_t rlow;
	u_int32_t rhigh;
	enum sunrpc_auth_stat rwhy;

	nfserr = 0;		/* assume no error */
	rp = (const struct sunrpc_msg *)bp;

	TCHECK(rp->rm_reply.rp_stat);
	reply_stat = EXTRACT_32BITS(&rp->rm_reply.rp_stat);
	switch (reply_stat) {

	case SUNRPC_MSG_ACCEPTED:
		(void)printf("reply ok %u", length);
		if (xid_map_find(rp, bp2, &proc, &vers) >= 0)
			interp_reply(rp, proc, vers, length);
		break;

	case SUNRPC_MSG_DENIED:
		(void)printf("reply ERR %u: ", length);
		TCHECK(rp->rm_reply.rp_reject.rj_stat);
		rstat = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_stat);
		switch (rstat) {

		case SUNRPC_RPC_MISMATCH:
			TCHECK(rp->rm_reply.rp_reject.rj_vers.high);
			rlow = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_vers.low);
			rhigh = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_vers.high);
			(void)printf("RPC Version mismatch (%u-%u)",
			    rlow, rhigh);
			break;

		case SUNRPC_AUTH_ERROR:
			TCHECK(rp->rm_reply.rp_reject.rj_why);
			rwhy = EXTRACT_32BITS(&rp->rm_reply.rp_reject.rj_why);
			(void)printf("Auth ");
			switch (rwhy) {

			case SUNRPC_AUTH_OK:
				(void)printf("OK");
				break;

			case SUNRPC_AUTH_BADCRED:
				(void)printf("Bogus Credentials (seal broken)");
				break;

			case SUNRPC_AUTH_REJECTEDCRED:
				(void)printf("Rejected Credentials (client should begin new session)");
				break;

			case SUNRPC_AUTH_BADVERF:
				(void)printf("Bogus Verifier (seal broken)");
				break;

			case SUNRPC_AUTH_REJECTEDVERF:
				(void)printf("Verifier expired or was replayed");
				break;

			case SUNRPC_AUTH_TOOWEAK:
				(void)printf("Credentials are too weak");
				break;

			case SUNRPC_AUTH_INVALIDRESP:
				(void)printf("Bogus response verifier");
				break;

			case SUNRPC_AUTH_FAILED:
				(void)printf("Unknown failure");
				break;

			default:
				(void)printf("Invalid failure code %u",
				    (unsigned int)rwhy);
				break;
			}
			break;

		default:
			(void)printf("Unknown reason for rejecting rpc message %u",
			    (unsigned int)rstat);
			break;
		}
		break;

	default:
		(void)printf("reply Unknown rpc response code=%u %u",
		    reply_stat, length);
		break;
	}
	return;

trunc:
	if (!nfserr)
		printf("%s", tstr);
}