Update secure logs
authorHyunbin Lee <hyunbin.lee@samsung.com>
Fri, 14 Jun 2013 10:44:45 +0000 (19:44 +0900)
committerHyunbin Lee <hyunbin.lee@samsung.com>
Fri, 14 Jun 2013 11:06:06 +0000 (20:06 +0900)
Change-Id: I0faa83d051d7ece64c31f7a910ff770447c3ebdb
Signed-off-by: Hyunbin Lee <hyunbin.lee@samsung.com>
osp-env-config.c

index 3f94d6e..7447766 100644 (file)
 #define _MAX_PACKAGEID_LENGTH 10
 #define _MAX_APIVERSION_LENGTH 3
 
+#ifdef _SECURE_LOG
+#define _SECURE_LOGI LOGI
+#define _SECURE_LOGE LOGE
+#else
+#define _SECURE_LOGI(...)
+#define _SECURE_LOGE(...)
+#endif
+
 static const char* _OSP_HOME_PATH = "/opt/osp/\0"; // /opt/apps/com.samsung.osp
 static const char* _OSP_COMPAT_SHARED_PATH = "/opt/usr/share/.osp-compat/\0";
 static const char* _EXT_OSP_HOME_PATH = "/opt/storage/sdcard/osp/\0";
@@ -76,9 +84,7 @@ get_app_rootpath_from_path(const char* bin_path)
        memset(app_rootpath, '\0', length + 1);
        strncpy(app_rootpath, bin_path, length);
 
-#ifdef _SECURE_LOG
-       LOGI("input bin_path: %s", app_rootpath);
-#endif
+       _SECURE_LOGI("input bin_path: %s", app_rootpath);
 
        delimiter = strrchr(app_rootpath, '/');
        *delimiter = '\0';
@@ -103,9 +109,8 @@ get_package_id_from_app_rootpath(const char* app_rootpath, char* package_id)
        }
        strncpy(package_id, p, _MAX_PACKAGEID_LENGTH);
     package_id[_MAX_PACKAGEID_LENGTH] = '\0';
-#ifdef _SECURE_LOG
-    LOGI("package id: %s", package_id);
-#endif
+
+       _SECURE_LOGI("package id: %s", package_id);
 }
 
 static void
@@ -148,9 +153,8 @@ get_package_id_from_package_name(const char* package_name, char* package_id)
     }
 
     package_id[_MAX_PACKAGEID_LENGTH] = '\0';
-#ifdef _SECURE_LOG
-    LOGI("package_id: %s", package_id);
-#endif
+
+       _SECURE_LOGI("package_id: %s", package_id);
 }
 
 static int
@@ -550,8 +554,8 @@ do_pre_exe(const char* package_name, const char* bin_path, const char* package_i
        /* e.g., app_rootdir is "/opt/apps/com.samsung.basicapp or /opt/osp/applications/[appId] */
        app_rootpath = get_app_rootpath_from_path(bin_path);
 
-       LOGI("[data_caging] do_pre_exe() was called, package: %s (%s), binary: %s, app root: %s",
-            package_name, package_id, bin_path, app_rootpath);
+       _SECURE_LOGI("[data_caging] do_pre_exe() was called, package name: %s, package id: %s, binary: %s, app root: %s",
+                       package_name, package_id, bin_path, app_rootpath);
 
        umask(0000);
 
@@ -647,9 +651,7 @@ do_pre_exec(const char* package_name, const char* bin_path)
     char osp_app_data_path[PATH_MAX] = { 0, };
     int osp_compat = 0;
 
-#ifdef _SECURE_LOG
-       LOGI("do_pre_exec() is called, package name: %s, binary path: %s", package_name, bin_path);
-#endif
+       _SECURE_LOGI("do_pre_exec() is called, package name: %s, binary path: %s", package_name, bin_path);
 
        app_rootpath = get_app_rootpath_from_path(bin_path);
 
@@ -674,7 +676,7 @@ do_pre_exec(const char* package_name, const char* bin_path)
 #endif
     // XXX-end
 
-       LOGI("package: %s (%s), binary: %s, OSP compat: %d", package_name, package_id, bin_path, osp_compat);
+       _SECURE_LOGI("package: %s (%s), binary: %s, OSP compat: %d", package_name, package_id, bin_path, osp_compat);
 
        // FIXME: Temporary code with security risk
        prctl(PR_SET_KEEPCAPS, 1);