Updated log level of log messages in SRM module
authorSachin Agrawal <sachin.agrawal@intel.com>
Tue, 22 Sep 2015 21:48:43 +0000 (14:48 -0700)
committerSachin Agrawal <sachin.agrawal@intel.com>
Thu, 24 Sep 2015 03:56:05 +0000 (03:56 +0000)
Many of the log messages had in-correct level of INFO, whereas they
were actually DEBUG messages.

Change-Id: I0e47e1b19b20a15f7d4b539e55995137270c75fa
Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2951
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Woochul Shim <woochul.shim@samsung.com>
Reviewed-by: Shilpa Sodani <shilpa.a.sodani@intel.com>
Reviewed-by: Patrick Lankswert <patrick.lankswert@intel.com>
resource/csdk/security/src/aclresource.c
resource/csdk/security/src/amaclresource.c
resource/csdk/security/src/credresource.c
resource/csdk/security/src/doxmresource.c
resource/csdk/security/src/policyengine.c
resource/csdk/security/src/psinterface.c
resource/csdk/security/src/resourcemanager.c
resource/csdk/security/src/secureresourcemanager.c
resource/csdk/security/src/svcresource.c

index 55058c7..5ed446b 100644 (file)
@@ -54,7 +54,7 @@ static void FreeACE(OicSecAcl_t *ace)
     size_t i;
     if(NULL == ace)
     {
-        OC_LOG (INFO, TAG, "Invalid Parameter");
+        OC_LOG (ERROR, TAG, "Invalid Parameter");
         return;
     }
 
@@ -424,7 +424,7 @@ static bool UpdatePersistentStorage(const OicSecAcl_t *acl)
 static OCStackResult RemoveACE(const OicUuid_t * subject,
                                const char * resource)
 {
-    OC_LOG(INFO, TAG, "IN RemoveACE");
+    OC_LOG(DEBUG, TAG, "IN RemoveACE");
 
     OicSecAcl_t *acl = NULL;
     OicSecAcl_t *tempAcl = NULL;
@@ -433,7 +433,7 @@ static OCStackResult RemoveACE(const OicUuid_t * subject,
 
     if(memcmp(subject->id, &WILDCARD_SUBJECT_ID, sizeof(subject->id)) == 0)
     {
-        OC_LOG_V (INFO, TAG, "%s received invalid parameter", __func__ );
+        OC_LOG_V (ERROR, TAG, "%s received invalid parameter", __func__ );
         return  OC_STACK_INVALID_PARAM;
     }
 
@@ -584,7 +584,7 @@ static OCEntityHandlerResult HandleACLGetRequest (const OCEntityHandlerRequest *
     // Process the REST querystring parameters
     if(ehRequest->query)
     {
-        OC_LOG (INFO, TAG, "HandleACLGetRequest processing query");
+        OC_LOG (DEBUG, TAG, "HandleACLGetRequest processing query");
 
         OicUuid_t subject = {.id={0}};
         char resource[MAX_URI_LENGTH] = {0};
@@ -646,7 +646,7 @@ exit:
 
     OICFree(jsonStr);
 
-    OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ehRet);
+    OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet);
     return ehRet;
 }
 
@@ -671,13 +671,13 @@ static OCEntityHandlerResult HandleACLPostRequest (const OCEntityHandlerRequest
     // Send payload to request originator
     SendSRMResponse(ehRequest, ehRet, NULL);
 
-    OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ehRet);
+    OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet);
     return ehRet;
 }
 
 static OCEntityHandlerResult HandleACLDeleteRequest(const OCEntityHandlerRequest *ehRequest)
 {
-    OC_LOG (INFO, TAG, "Processing ACLDeleteRequest");
+    OC_LOG (DEBUG, TAG, "Processing ACLDeleteRequest");
     OCEntityHandlerResult ehRet = OC_EH_ERROR;
     OicUuid_t subject = {.id={0}};
     char resource[MAX_URI_LENGTH] = {0};
@@ -711,7 +711,7 @@ OCEntityHandlerResult ACLEntityHandler (OCEntityHandlerFlag flag,
                                         OCEntityHandlerRequest * ehRequest,
                                         void* callbackParameter)
 {
-    OC_LOG(INFO, TAG, "Received request ACLEntityHandler");
+    OC_LOG(DEBUG, TAG, "Received request ACLEntityHandler");
     (void)callbackParameter;
     OCEntityHandlerResult ehRet = OC_EH_ERROR;
 
@@ -723,7 +723,7 @@ OCEntityHandlerResult ACLEntityHandler (OCEntityHandlerFlag flag,
     if (flag & OC_REQUEST_FLAG)
     {
         // TODO :  Handle PUT method
-        OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG");
+        OC_LOG (DEBUG, TAG, "Flag includes OC_REQUEST_FLAG");
         switch (ehRequest->method)
         {
             case OC_REST_GET:
index ff7bdb4..9d1d668 100644 (file)
@@ -259,7 +259,7 @@ static OCEntityHandlerResult HandleAmaclGetRequest (const OCEntityHandlerRequest
 
     OICFree(jsonStr);
 
-    OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ehRet);
+    OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet);
     return ehRet;
 }
 
@@ -294,7 +294,7 @@ static OCEntityHandlerResult HandleAmaclPostRequest (const OCEntityHandlerReques
     // Send payload to request originator
     SendSRMResponse(ehRequest, ehRet, NULL);
 
-    OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ehRet);
+    OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet);
     return ehRet;
 }
 
@@ -316,7 +316,7 @@ OCEntityHandlerResult AmaclEntityHandler (OCEntityHandlerFlag flag,
 
     if (flag & OC_REQUEST_FLAG)
     {
-        OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG");
+        OC_LOG (DEBUG, TAG, "Flag includes OC_REQUEST_FLAG");
         switch (ehRequest->method)
         {
             case OC_REST_GET:
index 71dd94a..2e5fced 100644 (file)
@@ -55,7 +55,7 @@ static void FreeCred(OicSecCred_t *cred)
 {
     if(NULL == cred)
     {
-        OC_LOG (INFO, TAG, "Invalid Parameter");
+        OC_LOG (ERROR, TAG, "Invalid Parameter");
         return;
     }
     //Note: Need further clarification on roleID data type
@@ -650,7 +650,7 @@ static OCEntityHandlerResult HandlePostRequest(const OCEntityHandlerRequest * eh
 
 static OCEntityHandlerResult HandleDeleteRequest(const OCEntityHandlerRequest *ehRequest)
 {
-    OC_LOG(INFO, TAG, "Processing CredDeleteRequest");
+    OC_LOG(DEBUG, TAG, "Processing CredDeleteRequest");
 
     OCEntityHandlerResult ehRet = OC_EH_ERROR;
 
@@ -707,7 +707,7 @@ OCEntityHandlerResult CredEntityHandler (OCEntityHandlerFlag flag,
     }
     if (flag & OC_REQUEST_FLAG)
     {
-        OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG");
+        OC_LOG (DEBUG, TAG, "Flag includes OC_REQUEST_FLAG");
         //TODO :  Handle PUT/DEL methods
         switch(ehRequest->method)
         {
index a285831..cb2bd37 100644 (file)
@@ -367,7 +367,7 @@ static bool ValidateQuery(const char * query)
     // access rules. Eventually, the PE and PM code will
     // not send a request to the /doxm Entity Handler at all
     // if it should not respond.
-    OC_LOG (INFO, TAG, "In ValidateQuery");
+    OC_LOG (DEBUG, TAG, "In ValidateQuery");
     if(NULL == gDoxm)
     {
         return false;
@@ -428,12 +428,12 @@ static OCEntityHandlerResult HandleDoxmGetRequest (const OCEntityHandlerRequest
     char* jsonStr = NULL;
     OCEntityHandlerResult ehRet = OC_EH_OK;
 
-    OC_LOG (INFO, TAG, "Doxm EntityHandle processing GET request");
+    OC_LOG (DEBUG, TAG, "Doxm EntityHandle processing GET request");
 
     //Checking if Get request is a query.
     if(ehRequest->query)
     {
-        OC_LOG (INFO, TAG, "HandleDoxmGetRequest processing query");
+        OC_LOG (DEBUG, TAG, "HandleDoxmGetRequest processing query");
         if(!ValidateQuery(ehRequest->query))
         {
             ehRet = OC_EH_ERROR;
@@ -488,7 +488,7 @@ static OCEntityHandlerResult AddOwnerPSK(const CAEndpoint_t* endpoint,
                     sizeof(base64Buff), &outLen);
     VERIFY_SUCCESS(TAG, b64Ret == B64_OK, ERROR);
 
-    OC_LOG (INFO, TAG, "Doxm EntityHandle  generating Credential");
+    OC_LOG (DEBUG, TAG, "Doxm EntityHandle  generating Credential");
     cred = GenerateCredential(&ptDoxm->owner, SYMMETRIC_PAIR_WISE_KEY,
                               NULL, base64Buff, ownLen, &ptDoxm->owner);
     VERIFY_NON_NULL(TAG, cred, ERROR);
@@ -509,7 +509,7 @@ exit:
 
 static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest * ehRequest)
 {
-    OC_LOG (INFO, TAG, "Doxm EntityHandle  processing PUT request");
+    OC_LOG (DEBUG, TAG, "Doxm EntityHandle  processing PUT request");
     OCEntityHandlerResult ehRet = OC_EH_ERROR;
     OicUuid_t emptyOwner = {.id = {0}};
 
@@ -604,7 +604,7 @@ static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest
             {
 #ifdef __WITH_DTLS__
                 CAEnableAnonECDHCipherSuite(false);
-                OC_LOG(DEBUG, TAG, "ECDH_ANON CipherSuite is DISABLED");
+                OC_LOG(INFO, TAG, "ECDH_ANON CipherSuite is DISABLED");
                 CASelectCipherSuite(TLS_ECDHE_PSK_WITH_AES_128_CBC_SHA_256);
 
                 char ranPin[OXM_RANDOM_PIN_SIZE + 1] = {0,};
@@ -612,7 +612,7 @@ static OCEntityHandlerResult HandleDoxmPutRequest (const OCEntityHandlerRequest
                 {
                     if(tmpCredGenFlag)
                     {
-                       OC_LOG(DEBUG, TAG, "Corrupted PSK is detected!!!");
+                       OC_LOG(INFO, TAG, "Corrupted PSK is detected!!!");
                        VERIFY_SUCCESS(TAG,
                                       OC_STACK_RESOURCE_DELETED == RemoveCredential(&tmpCredId),
                                       ERROR);
@@ -710,7 +710,7 @@ OCEntityHandlerResult DoxmEntityHandler (OCEntityHandlerFlag flag,
 
     if (flag & OC_REQUEST_FLAG)
     {
-        OC_LOG (INFO, TAG, "Flag includes OC_REQUEST_FLAG");
+        OC_LOG (DEBUG, TAG, "Flag includes OC_REQUEST_FLAG");
         switch (ehRequest->method)
         {
             case OC_REST_GET:
@@ -801,7 +801,7 @@ static OCStackResult CheckDeviceID()
  */
 static OicSecDoxm_t* GetDoxmDefault()
 {
-    OC_LOG (INFO, TAG, "GetDoxmToDefault");
+    OC_LOG (DEBUG, TAG, "GetDoxmToDefault");
     return &gDefaultDoxm;
 }
 
index 196a778..d77a21f 100644 (file)
@@ -211,7 +211,7 @@ static bool IsAccessWithinValidTime(const OicSecAcl_t *acl)
             return true;
         }
     }
-    OC_LOG(INFO, TAG, "Access request is in invalid time period");
+    OC_LOG(ERROR, TAG, "Access request is in invalid time period");
     return false;
 
 #else
@@ -252,7 +252,7 @@ static bool IsAccessWithinValidTime(const OicSecAcl_t *acl)
  */
 void ProcessAccessRequest(PEContext_t *context)
 {
-    OC_LOG(INFO, TAG, "Entering ProcessAccessRequest()");
+    OC_LOG(DEBUG, TAG, "Entering ProcessAccessRequest()");
     if(NULL != context)
     {
         const OicSecAcl_t *currentAcl = NULL;
@@ -265,17 +265,17 @@ void ProcessAccessRequest(PEContext_t *context)
         // ACL for this request.
         do
         {
-            OC_LOG_V(INFO, TAG, "%s: getting ACL..." ,__func__);
+            OC_LOG_V(DEBUG, TAG, "%s: getting ACL..." ,__func__);
             currentAcl = GetACLResourceData(&context->subject, &savePtr);
 
             if(NULL != currentAcl)
             {
                 // Found the subject, so how about resource?
-                OC_LOG_V(INFO, TAG, "%s:found ACL matching subject" ,__func__);
+                OC_LOG_V(DEBUG, TAG, "%s:found ACL matching subject" ,__func__);
 
                 // Subject was found, so err changes to Rsrc not found for now.
                 context->retVal = ACCESS_DENIED_RESOURCE_NOT_FOUND;
-                OC_LOG_V(INFO, TAG, "%s:Searching for resource..." ,__func__);
+                OC_LOG_V(DEBUG, TAG, "%s:Searching for resource..." ,__func__);
                 if(IsResourceInAcl(context->resource, currentAcl))
                 {
                     OC_LOG_V(INFO, TAG, "%s:found matching resource in ACL" ,__func__);
@@ -311,7 +311,7 @@ void ProcessAccessRequest(PEContext_t *context)
     }
     else
     {
-        OC_LOG_V(INFO, TAG, "%s:Leaving ProcessAccessRequest(context is NULL)", __func__);
+        OC_LOG_V(ERROR, TAG, "%s:Leaving ProcessAccessRequest(context is NULL)", __func__);
     }
 }
 
index 8235ace..992fe70 100644 (file)
@@ -96,7 +96,7 @@ char * GetSVRDatabase()
             size_t bytesRead = ps->read(jsonStr, 1, size, fp);
             jsonStr[bytesRead] = '\0';
 
-            OC_LOG_V(INFO, TAG, "Read %d bytes from SVR database file", bytesRead);
+            OC_LOG_V(DEBUG, TAG, "Read %d bytes from SVR database file", bytesRead);
             ps->close(fp);
             fp = NULL;
         }
@@ -159,7 +159,7 @@ OCStackResult UpdateSVRDatabase(const char* rsrcName, cJSON* jsonObj)
          ACL, PStat & Doxm resources at least have default entries in the database but
          Cred resource may have no entries. The first cred resource entry (for provisioning tool)
          is created when the device is owned by provisioning tool and it's ownerpsk is generated.*/
-        if((strcmp(rsrcName, OIC_JSON_CRED_NAME) == 0 || strcmp(rsrcName, OIC_JSON_CRL_NAME) == 0) 
+        if((strcmp(rsrcName, OIC_JSON_CRED_NAME) == 0 || strcmp(rsrcName, OIC_JSON_CRL_NAME) == 0)
                                                                                     && (!jsonObj))
         {
             // Add the fist cred object in existing SVR database json
@@ -190,7 +190,7 @@ OCStackResult UpdateSVRDatabase(const char* rsrcName, cJSON* jsonObj)
             {
                 ret = OC_STACK_OK;
             }
-            OC_LOG_V(INFO, TAG, "Written %d bytes into SVR database file", bytesWritten);
+            OC_LOG_V(DEBUG, TAG, "Written %d bytes into SVR database file", bytesWritten);
             ps->close(fp);
             fp = NULL;
         }
index 15ab30e..f37a0be 100644 (file)
@@ -50,7 +50,7 @@
 OCStackResult SendSRMResponse(const OCEntityHandlerRequest *ehRequest,
         OCEntityHandlerResult ehRet, const char *rspPayload)
 {
-    OC_LOG (INFO, TAG, "SRM sending SRM response");
+    OC_LOG (DEBUG, TAG, "SRM sending SRM response");
     OCEntityHandlerResponse response = {.requestHandle = NULL};
     if (ehRequest)
     {
index e96baaa..8654f3a 100644 (file)
@@ -86,7 +86,7 @@ static void SRMSendUnAuthorizedAccessresponse(PEContext_t *context)
 
 void SRMSendResponse(SRMAccessResponse_t responseVal)
 {
-    OC_LOG(INFO, TAG, "Sending response to remote device");
+    OC_LOG(DEBUG, TAG, "Sending response to remote device");
 
     if (IsAccessGranted(responseVal) && gRequestHandler)
     {
@@ -121,7 +121,7 @@ exit:
  */
 void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requestInfo)
 {
-    OC_LOG(INFO, TAG, "Received request from remote device");
+    OC_LOG(DEBUG, TAG, "Received request from remote device");
 
     if (!endPoint || !requestInfo)
     {
@@ -157,7 +157,7 @@ void SRMRequestHandler(const CAEndpoint_t *endPoint, const CARequestInfo_t *requ
     //New request are only processed if the policy engine state is AWAITING_REQUEST.
     if(AWAITING_REQUEST == g_policyEngineContext.state)
     {
-        OC_LOG_V(INFO, TAG, "Processing request with uri, %s for method, %d",
+        OC_LOG_V(DEBUG, TAG, "Processing request with uri, %s for method, %d",
                 requestInfo->info.resourceUri, requestInfo->method);
         response = CheckPermission(&g_policyEngineContext, &subjectId, newUri,
                 GetPermissionFromCAMethod_t(requestInfo->method));
@@ -220,7 +220,7 @@ exit:
  */
 void SRMResponseHandler(const CAEndpoint_t *endPoint, const CAResponseInfo_t *responseInfo)
 {
-    OC_LOG(INFO, TAG, "Received response from remote device");
+    OC_LOG(DEBUG, TAG, "Received response from remote device");
 
     // isProvResponse flag is to check whether response is catered by provisioning APIs or not.
     // When token sent by CA response matches with token generated by provisioning request,
@@ -270,7 +270,7 @@ OCStackResult SRMRegisterHandler(CARequestCallback reqHandler,
                                  CAResponseCallback respHandler,
                                  CAErrorCallback errHandler)
 {
-    OC_LOG(INFO, TAG, "SRMRegisterHandler !!");
+    OC_LOG(DEBUG, TAG, "SRMRegisterHandler !!");
     if( !reqHandler || !respHandler || !errHandler)
     {
         OC_LOG(ERROR, TAG, "Callback handlers are invalid");
@@ -298,7 +298,7 @@ OCStackResult SRMRegisterHandler(CARequestCallback reqHandler,
  */
 OCStackResult SRMRegisterPersistentStorageHandler(OCPersistentStorage* persistentStorageHandler)
 {
-    OC_LOG(INFO, TAG, "SRMRegisterPersistentStorageHandler !!");
+    OC_LOG(DEBUG, TAG, "SRMRegisterPersistentStorageHandler !!");
     if(!persistentStorageHandler)
     {
         OC_LOG(ERROR, TAG, "The persistent storage handler is invalid");
index 29bbec1..28a8c59 100644 (file)
@@ -239,7 +239,7 @@ static OCEntityHandlerResult HandleSVCGetRequest (const OCEntityHandlerRequest *
 
     OICFree(jsonStr);
 
-    OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ehRet);
+    OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet);
     return ehRet;
 }
 
@@ -274,7 +274,7 @@ static OCEntityHandlerResult HandleSVCPostRequest (const OCEntityHandlerRequest
     // Send payload to request originator
     SendSRMResponse(ehRequest, ehRet, NULL);
 
-    OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ehRet);
+    OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ehRet);
     return ehRet;
 }
 
@@ -343,7 +343,7 @@ OCStackResult InitSVCResource()
 {
     OCStackResult ret = OC_STACK_ERROR;
 
-    OC_LOG_V (INFO, TAG, "Begin %s ", __func__ );
+    OC_LOG_V (DEBUG, TAG, "Begin %s ", __func__ );
 
     // Read SVC resource from PS
     char* jsonSVRDatabase = GetSVRDatabase();
@@ -363,7 +363,7 @@ OCStackResult InitSVCResource()
         DeInitSVCResource();
     }
 
-    OC_LOG_V (INFO, TAG, "%s RetVal %d", __func__ , ret);
+    OC_LOG_V (DEBUG, TAG, "%s RetVal %d", __func__ , ret);
     return ret;
 }