Reduce number of error logs in ckm. 33/41433/7
authorBartlomiej Grzelewski <b.grzelewski@samsung.com>
Wed, 1 Jul 2015 13:47:27 +0000 (15:47 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Fri, 3 Jul 2015 10:12:55 +0000 (03:12 -0700)
Change-Id: Ibdf054bfa39723910dafd2eea64173b8e34f13e0

src/manager/common/exception.h
src/manager/common/stringify.h
src/manager/service/ckm-logic.cpp
src/manager/service/file-system.cpp

index 611cad1..c174085 100644 (file)
@@ -111,13 +111,13 @@ public:
 typedef DefineException<CKM_API_ERROR_SERVER_ERROR,
         Stringify, PrintError> InternalError;
 typedef DefineException<CKM_API_ERROR_INPUT_PARAM,
-        Stringify, PrintError> InputParam;
+        StringifyDebug, PrintDebug> InputParam;
 typedef DefineException<CKM_API_ERROR_DB_LOCKED,
         Stringify, PrintError> DatabaseLocked;
 typedef DefineException<CKM_API_ERROR_FILE_SYSTEM,
         Stringify, PrintError> FileSystemFailed;
 typedef DefineException<CKM_API_ERROR_AUTHENTICATION_FAILED,
-        Stringify, PrintError> AuthenticationFailed;
+        StringifyDebug, PrintDebug> AuthenticationFailed;
 
 } // namespace Exc
 } // namespace CKM
index 49a9a46..d989f44 100644 (file)
@@ -37,7 +37,7 @@ public:
     }
 
     template <typename... Args>
-    std::string operator()(const Args&... args){
+    std::string operator()(const Args&...){
         return std::string();
     }
 };
index 0a6893f..8197fb9 100644 (file)
@@ -372,7 +372,7 @@ int CKMLogic::checkSaveConditions(
 {
     // verify name and label are correct
     if (!isNameValid(name) || !isLabelValid(ownerLabel)) {
-        LogWarning("Invalid parameter passed to key-manager");
+        LogDebug("Invalid parameter passed to key-manager");
         return CKM_API_ERROR_INPUT_PARAM;
     }
 
@@ -380,7 +380,7 @@ int CKMLogic::checkSaveConditions(
     int access_ec = m_accessControl.canSave(cred, ownerLabel);
     if( access_ec != CKM_API_SUCCESS)
     {
-        LogWarning("label " << cred.smackLabel << " can not save rows using label " << ownerLabel);
+        LogDebug("label " << cred.smackLabel << " can not save rows using label " << ownerLabel);
         return access_ec;
     }
 
@@ -449,7 +449,7 @@ int CKMLogic::toBinaryData(DataType dataType,
             output_key = CKM::Key::create(input_data);
         if(output_key.get() == NULL)
         {
-            LogError("provided binary data is not valid key data");
+            LogDebug("provided binary data is not valid key data");
             return CKM_API_ERROR_INPUT_PARAM;
         }
         output_data = output_key->getDER();
@@ -459,7 +459,7 @@ int CKMLogic::toBinaryData(DataType dataType,
         CertificateShPtr cert = CKM::Certificate::create(input_data, DataFormat::FORM_DER);
         if(cert.get() == NULL)
         {
-            LogError("provided binary data is not valid certificate data");
+            LogDebug("provided binary data is not valid certificate data");
             return CKM_API_ERROR_INPUT_PARAM;
         }
         output_data = cert->getDER();
@@ -632,7 +632,7 @@ int CKMLogic::removeDataHelper(
     // use client label if not explicitly provided
     const Label &ownerLabel = label.empty() ? cred.smackLabel : label;
     if (!isNameValid(name) || !isLabelValid(ownerLabel)) {
-        LogError("Invalid label or name format");
+        LogDebug("Invalid label or name format");
         return CKM_API_ERROR_INPUT_PARAM;
     }
 
@@ -654,7 +654,7 @@ int CKMLogic::removeDataHelper(
     if(erased)
         transaction.commit();
     else {
-        LogError("No row for given name and label");
+        LogDebug("No row for given name and label");
         return CKM_API_ERROR_DB_ALIAS_UNKNOWN;
     }
 
@@ -711,7 +711,7 @@ int CKMLogic::readSingleRow(const Name &name,
     }
 
     if(!row_optional) {
-        LogError("No row for given name, label and type");
+        LogDebug("No row for given name, label and type");
         return CKM_API_ERROR_DB_ALIAS_UNKNOWN;
     } else {
         row = *row_optional;
@@ -755,7 +755,7 @@ int CKMLogic::readMultiRow(const Name &name,
     }
 
     if(!output.size()) {
-        LogError("No row for given name, label and type");
+        LogDebug("No row for given name, label and type");
         return CKM_API_ERROR_DB_ALIAS_UNKNOWN;
     }
 
index 96446c1..376d78d 100644 (file)
@@ -209,10 +209,10 @@ UidVector FileSystem::getUIDsFromDBFile() {
         try {
             uids.push_back(static_cast<uid_t>(std::stoi((pDirEntry->d_name)+CKM_KEY_PREFIX.size())));
         } catch (const std::invalid_argument) {
-            LogError("Error in extracting uid from db file. Error=std::invalid_argument."
+            LogDebug("Error in extracting uid from db file. Error=std::invalid_argument."
                 "This will be ignored.File=" << pDirEntry->d_name << "");
         } catch(const std::out_of_range) {
-            LogError("Error in extracting uid from db file. Error=std::out_of_range."
+            LogDebug("Error in extracting uid from db file. Error=std::out_of_range."
                 "This will be ignored. File="<< pDirEntry->d_name << "");
         }
     }
@@ -226,28 +226,28 @@ int FileSystem::removeUserData() const {
     if (unlink(getDBPath().c_str())) {
         retCode = -1;
         err = errno;
-        LogError("Error in unlink user database: " << getDBPath()
+        LogDebug("Error in unlink user database: " << getDBPath()
             << "Errno: " << errno << " " << GetErrnoString(err));
     }
 
     if (unlink(getDKEKPath().c_str())) {
         retCode = -1;
         err = errno;
-        LogError("Error in unlink user DKEK: " << getDKEKPath()
+        LogDebug("Error in unlink user DKEK: " << getDKEKPath()
             << "Errno: " << errno << " " << GetErrnoString(err));
     }
 
     if (unlink(getDBDEKPath().c_str())) {
         retCode = -1;
         err = errno;
-        LogError("Error in unlink user DBDEK: " << getDBDEKPath()
+        LogDebug("Error in unlink user DBDEK: " << getDBDEKPath()
             << "Errno: " << errno << " " << GetErrnoString(err));
     }
 
     if (unlink(getRemovedAppsPath().c_str())) {
         retCode = -1;
         err = errno;
-        LogError("Error in unlink user's Removed Apps File: " << getRemovedAppsPath()
+        LogDebug("Error in unlink user's Removed Apps File: " << getRemovedAppsPath()
             << "Errno: " << errno << " " << GetErrnoString(err));
     }