Log appId in case of errors in security_manager_prepare_app 68/108068/3
authorRafal Krypa <r.krypa@samsung.com>
Mon, 2 Jan 2017 15:12:35 +0000 (16:12 +0100)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Tue, 24 Jan 2017 14:35:26 +0000 (06:35 -0800)
When security_manager_prepare_app fails, the launcher that called this
function is supposed to treat it as serious error and stop further
application launching. Security-manager logs error description, but it
didn't include appId in the logs.

Change-Id: Iefdd398ba32c9f16bde2c011abea31949da41b6b
Signed-off-by: Rafal Krypa <r.krypa@samsung.com>
src/client/client-security-manager.cpp

index e0f49d7c0b474cce598d69e95a49952b50a452d4..ff1b378b6f85e3bd9491305c2f6dbec82cca3743 100644 (file)
@@ -748,17 +748,23 @@ int security_manager_prepare_app(const char *app_name)
 {
     return try_catch([&] {
         LogDebug("security_manager_prepare_app() called");
+
+        if (app_name == nullptr) {
+            LogError("app_name is NULL");
+            return SECURITY_MANAGER_ERROR_INPUT_PARAM;
+        }
+
         int ret;
 
         ret = security_manager_set_process_groups_from_appid(app_name);
         if (ret != SECURITY_MANAGER_SUCCESS) {
-            LogError("Unable to setup process groups for application.");
+            LogError("Unable to setup process groups for application " << app_name);
             return ret;
         }
 
         ret = security_manager_sync_threads_internal(app_name);
         if (ret != SECURITY_MANAGER_SUCCESS) {
-            LogError("Can't properly setup application threads (Smack label & capabilities)");
+            LogError("Can't properly setup application threads (Smack label & capabilities) for application " << app_name);
             return ret;
         }
 
@@ -766,11 +772,11 @@ int security_manager_prepare_app(const char *app_name)
             CheckProperDrop cpd;
             cpd.getThreads();
             if (!cpd.checkThreads()) {
-                LogError("Privileges haven't been properly dropped for the whole process");
+                LogError("Privileges haven't been properly dropped for the whole process of application " << app_name);
                 return ret;
             }
         } catch (const SecurityManager::Exception &e) {
-            LogError("Error while checking privileges of the process: " << e.DumpToString());
+            LogError("Error while checking privileges of the process for application " << app_name << ": " << e.DumpToString());
             return ret;
         }