From 6c0b743a141fbb7574c8c0d5fa26a5ccef154300 Mon Sep 17 00:00:00 2001 From: Mandeep Shetty Date: Thu, 9 Jul 2015 10:15:11 -0700 Subject: [PATCH] Fix failure to respond when SRM says Access Denied. The enum types for forbidden request and unauthorized request in CAResponseResult_t added as part of security where misisng in a sanity check switch case. This caused the forbidden and unauthorized response codes to be classified as invalid. Change-Id: Idc53a50422e3d5e43a847395a2389da351ea6baf Signed-off-by: Mandeep Shetty Reviewed-on: https://gerrit.iotivity.org/gerrit/1610 Reviewed-by: Erich Keane Reviewed-by: Sachin Agrawal Tested-by: Sachin Agrawal --- resource/csdk/connectivity/common/src/caremotehandler.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resource/csdk/connectivity/common/src/caremotehandler.c b/resource/csdk/connectivity/common/src/caremotehandler.c index 2886f5a..eaa9ff0 100644 --- a/resource/csdk/connectivity/common/src/caremotehandler.c +++ b/resource/csdk/connectivity/common/src/caremotehandler.c @@ -158,6 +158,7 @@ CAResponseInfo_t *CACloneResponseInfo(const CAResponseInfo_t *rep) } // check the result value of response info. + // Keep this check in sync with CAResponseResult_t switch (rep->result) { case CA_EMPTY: @@ -168,14 +169,16 @@ CAResponseInfo_t *CACloneResponseInfo(const CAResponseInfo_t *rep) case CA_CHANGED: case CA_CONTENT: case CA_BAD_REQ: + case CA_UNAUTHORIZED_REQ: case CA_BAD_OPT: + case CA_FORBIDDEN_REQ: case CA_NOT_FOUND: case CA_INTERNAL_SERVER_ERROR: case CA_RETRANSMIT_TIMEOUT: break; default: - OIC_LOG(ERROR, TAG, "Response status code is invalid number"); + OIC_LOG_V(ERROR, TAG, "Response code %u is invalid", rep->result); return NULL; } -- 2.7.4