From 05ebafb02b3d614bc1ebf86675b03b22b78da274 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 17 Nov 2017 17:44:22 +0900 Subject: [PATCH] Fix to check app agreed Change-Id: I72df22b181aa994bcad6d8dfdb0657e528370fbf Signed-off-by: sooyeon.kim (cherry picked from commit 8d91d61c662eaf39e4d419e4a7012e576c98329a) --- server/ttsd_server.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/server/ttsd_server.c b/server/ttsd_server.c index f494287..5f027e9 100644 --- a/server/ttsd_server.c +++ b/server/ttsd_server.c @@ -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)) { -- 2.7.4