Fix failure to respond when SRM says Access Denied.
authorMandeep Shetty <mandeep.shetty@intel.com>
Thu, 9 Jul 2015 17:15:11 +0000 (10:15 -0700)
committerSachin Agrawal <sachin.agrawal@intel.com>
Thu, 9 Jul 2015 17:51:17 +0000 (17:51 +0000)
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 <mandeep.shetty@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1610
Reviewed-by: Erich Keane <erich.keane@intel.com>
Reviewed-by: Sachin Agrawal <sachin.agrawal@intel.com>
Tested-by: Sachin Agrawal <sachin.agrawal@intel.com>
resource/csdk/connectivity/common/src/caremotehandler.c

index 2886f5a..eaa9ff0 100644 (file)
@@ -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;
     }