Fix to check app agreed 39/160739/1
authorsooyeon.kim <sooyeon.kim@samsung.com>
Fri, 17 Nov 2017 08:44:22 +0000 (17:44 +0900)
committerSooyeon Kim <sooyeon.kim@samsung.com>
Mon, 20 Nov 2017 00:47:27 +0000 (00:47 +0000)
Change-Id: I72df22b181aa994bcad6d8dfdb0657e528370fbf
Signed-off-by: sooyeon.kim <sooyeon.kim@samsung.com>
(cherry picked from commit 8d91d61c662eaf39e4d419e4a7012e576c98329a)

server/ttsd_server.c

index f494287..5f027e9 100644 (file)
@@ -528,23 +528,25 @@ int ttsd_server_initialize(int pid, int uid, bool* credential_needed)
                return TTSD_ERROR_OPERATION_FAILED;
        }
 
-       char* appid = NULL;
-       if (0 != app_manager_get_app_id(pid, &appid)) {
-               SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get app id, pid(%d)", pid);
-       }
-       bool is_agreed = false;
-       if (0 != ttsd_engine_check_app_agreed(appid, &is_agreed)) {
-               SLOG(LOG_ERROR, tts_tag(), "Server ERROR] Fail to check app agreed");
+       if (true == *credential_needed) {
+               char* appid = NULL;
+               if (0 != app_manager_get_app_id(pid, &appid)) {
+                       SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] Fail to get app id, pid(%d)", pid);
+               }
+               bool is_agreed = false;
+               if (0 != ttsd_engine_check_app_agreed(appid, &is_agreed)) {
+                       SLOG(LOG_ERROR, tts_tag(), "Server ERROR] Fail to check app agreed");
+                       if (!appid)
+                               free(appid);
+                       return TTSD_ERROR_OPERATION_FAILED;
+               }
                if (!appid)
                        free(appid);
-               return TTSD_ERROR_OPERATION_FAILED;
-       }
-       if (!appid)
-               free(appid);
 
-       if (false == is_agreed) {
-               SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] App is not agreed");
-               return TTSD_ERROR_PERMISSION_DENIED;
+               if (false == is_agreed) {
+                       SLOG(LOG_ERROR, tts_tag(), "[Server ERROR] App is not agreed");
+                       return TTSD_ERROR_PERMISSION_DENIED;
+               }
        }
 
        if (0 != ttsd_data_new_client(pid, uid)) {