From 78c914251efae3c9a34ba81251756b4090387221 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Mon, 30 Dec 2019 14:12:03 +0900 Subject: [PATCH 01/16] Update codes for gcc 9.2 compiler Change-Id: Ibc0e249fe887830978f3b001d70a84a0b794c032 (cherry picked from commit fe2387cfc75548de1aedc15bf5015fa35fee4610) --- client/vc_mgr_dbus.c | 2 +- common/vc_cmd_db.c | 10 +++++----- server/vcd_server.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index 1750069..a95852c 100644 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -294,7 +294,7 @@ static Eina_Bool vc_mgr_listener_event_callback(void* data, Ecore_Fd_Handler *fd if (NULL != err_msg && strcmp("#NULL", err_msg)) { temp_msg = strdup(err_msg); } - SLOG(LOG_ERROR, TAG_VCM, "@@ vc mgr Get Error message : reason(%d), daemon_pid(%d), msg(%s)", reason, daemon_pid, temp_msg); + SLOG(LOG_ERROR, TAG_VCM, "@@ vc mgr Get Error message : reason(%d), daemon_pid(%d), msg(%s)", reason, daemon_pid, (temp_msg) ? temp_msg : "NULL"); __vc_mgr_cb_error(reason, daemon_pid, temp_msg); if (NULL != temp_msg) { free(temp_msg); diff --git a/common/vc_cmd_db.c b/common/vc_cmd_db.c index ad72839..62edb6c 100644 --- a/common/vc_cmd_db.c +++ b/common/vc_cmd_db.c @@ -789,11 +789,10 @@ static int __vc_db_remove_invocation_name(char* org_cmd, const char* invocation_ SLOG(LOG_WARN, vc_db_tag(), "[WARNING] No need to remove invocation name, org_cmd(%s) invocation(%s)", org_cmd, invocation_name); return VC_DB_ERROR_INVALID_PARAMETER; } - if (0 == strncasecmp(org_cmd, invocation_name, strlen(invocation_name))) { *new_cmd = strdup(org_cmd + strlen(invocation_name) + 1); } - SLOG(LOG_DEBUG, vc_db_tag(), "Original cmd[%s], New cmd[%s], Invocation name[%s]", org_cmd, *new_cmd, invocation_name); + SLOG(LOG_INFO, vc_db_tag(), "Original cmd[%s], New cmd[%s], Invocation name[%s]", org_cmd, (*new_cmd) ? *new_cmd : "NULL", invocation_name); return VC_DB_ERROR_NONE; } @@ -822,8 +821,9 @@ static int __vc_db_extract_unfixed_command(char* command, char* fixed, char** te if (0 == strncasecmp(command, fixed, strlen(fixed))) { strncpy(temp, command + strlen(fixed) + 1, strlen(command) - strlen(fixed) - 1); SLOG(LOG_WARN, vc_db_tag(), "@@@"); - } else if (0 == strncasecmp(command + strlen(command) - strlen(fixed), fixed, strlen(fixed))) { - strncpy(temp, command, strlen(command) - strlen(fixed) - 1); + } else if (0 == strncasecmp(command + strlen(command) - strlen(fixed), fixed, strlen(fixed))) { + command[strlen(command) - strlen(fixed) - 1] = '\0'; + snprintf(temp, 256, "%s", command); SLOG(LOG_WARN, vc_db_tag(), "@@@"); } @@ -1553,7 +1553,7 @@ int __vc_db_open_db_for_daemon(char** path, sqlite3** db_handle) if (*db_handle) { char* err_msg = NULL; - static const const char* sql = "PRAGMA journal_mode = WAL"; + static const char* sql = "PRAGMA journal_mode = WAL"; int ret = sqlite3_exec(*db_handle, sql, NULL, NULL, &err_msg); if (ret != SQLITE_OK) { SLOG(LOG_ERROR, vc_db_tag(), "sqlite3_exec returned %d: %s", ret, err_msg); diff --git a/server/vcd_server.c b/server/vcd_server.c index 77e0ff8..5a54f55 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -1191,14 +1191,14 @@ static void __vcd_file_clean_up() return; } - char remove_path[256] = {0, }; + char remove_path[257] = {0, }; do { dirp = readdir(dp); if (NULL != dirp) { if (!strncmp("vc_", dirp->d_name, strlen("vc_"))) { - memset(remove_path, 0, 256); - snprintf(remove_path, 256, "%s/%s", VC_RUNTIME_INFO_ROOT, dirp->d_name); + memset(remove_path, 0, 257); + snprintf(remove_path, 257, "%s/%s", VC_RUNTIME_INFO_ROOT, dirp->d_name); /* Clean up code */ if (0 != remove(remove_path)) { -- 2.7.4 From 247e3f3fe3b2ec90c58bfeff8b4a50c6d0b3a7c3 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Mon, 16 Dec 2019 17:19:46 +0900 Subject: [PATCH 02/16] Change mgr dbus by sending disabled cmd types when vc_mgr_start is requested Change-Id: I9818af52c1fcfea901443fc75b7e9a362e751587 Signed-off-by: sooyeon.kim (cherry picked from commit 0a6b707b5c99d96d26e768c1159e466d58fa8071) --- client/vc_mgr.c | 57 ++++++---------- client/vc_mgr_client.c | 50 ++++++++++++++ client/vc_mgr_client.h | 6 ++ client/vc_mgr_dbus.c | 173 ++--------------------------------------------- client/vc_mgr_dbus.h | 6 +- server/vcd_config.c | 32 ++------- server/vcd_config.h | 4 +- server/vcd_dbus.c | 6 -- server/vcd_dbus_server.c | 120 ++++---------------------------- server/vcd_dbus_server.h | 4 -- server/vcd_server.c | 33 ++------- server/vcd_server.h | 4 +- 12 files changed, 107 insertions(+), 388 deletions(-) diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 9f397e7..f8a4b78 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -944,24 +944,13 @@ int vc_mgr_enable_command_type(int cmd_type) } int ret; - int count = 0; - do { - ret = vc_mgr_dbus_request_enable_command_type(g_vc_m->handle, cmd_type); - if (0 != ret) { - if (VC_ERROR_TIMED_OUT != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request enable command type : %s", __vc_mgr_get_error_code(ret)); - break; - } else { - SLOG(LOG_WARN, TAG_VCM, "[WARNING] retry request enable command type : %s", __vc_mgr_get_error_code(ret)); - usleep(10000); - count++; - if (VC_RETRY_COUNT == count) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request"); - break; - } - } - } - } while (0 != ret); + + ret = vc_mgr_client_enable_command_type(g_vc_m, (vc_cmd_type_e)cmd_type); // enable the cmd type + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to enable the command type(%d). ret(%d)", cmd_type, ret); + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[DEBUG] Success to enable the command type(%d)", cmd_type); + } SLOG(LOG_ERROR, TAG_VCM, "@@@, ret(%d)", ret); @@ -1010,24 +999,13 @@ int vc_mgr_disable_command_type(int cmd_type) } int ret; - int count = 0; - do { - ret = vc_mgr_dbus_request_disable_command_type(g_vc_m->handle, cmd_type); - if (0 != ret) { - if (VC_ERROR_TIMED_OUT != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request disable command type : %s", __vc_mgr_get_error_code(ret)); - break; - } else { - SLOG(LOG_WARN, TAG_VCM, "[WARNING] retry request disable command type : %s", __vc_mgr_get_error_code(ret)); - usleep(10000); - count++; - if (VC_RETRY_COUNT == count) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to request"); - break; - } - } - } - } while (0 != ret); + + ret = vc_mgr_client_disable_command_type(g_vc_m, (vc_cmd_type_e)cmd_type); // enable the cmd type + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to disable the command type(%d). ret(%d)", cmd_type, ret); + } else { + SLOG(LOG_DEBUG, TAG_VCM, "[DEBUG] Success to disable the command type(%d)", cmd_type); + } SLOG(LOG_ERROR, TAG_VCM, "@@@, ret(%d)", ret); @@ -2120,6 +2098,11 @@ int vc_mgr_start(bool exclusive_command_option) SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to get start by client"); } + int disabled_cmd_type = 0; + if (0 != vc_mgr_client_get_disabled_command_type(g_vc_m, &disabled_cmd_type)) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to get disabled command type"); + } + int ret; int count = 0; vc_recognition_mode_e recognition_mode = VC_RECOGNITION_MODE_STOP_BY_SILENCE; @@ -2132,7 +2115,7 @@ int vc_mgr_start(bool exclusive_command_option) count = 0; while (0 != ret) { vc_mgr_client_set_internal_state(g_vc_m, VC_INTERNAL_STATE_STARTING); - ret = vc_mgr_dbus_request_start(g_vc_m->handle, (int)recognition_mode, exclusive_command_option, start_by_client); + ret = vc_mgr_dbus_request_start(g_vc_m->handle, (int)recognition_mode, exclusive_command_option, start_by_client, disabled_cmd_type); if (0 != ret) { if (VC_ERROR_TIMED_OUT != ret) { SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to start request start : %s", __vc_mgr_get_error_code(ret)); diff --git a/client/vc_mgr_client.c b/client/vc_mgr_client.c index 2317c43..4ccb0c3 100644 --- a/client/vc_mgr_client.c +++ b/client/vc_mgr_client.c @@ -85,6 +85,9 @@ typedef struct { /* audio type */ char* audio_id; + /* disabled command type */ + int disabled_cmd_type; + /* recognition mode */ vc_recognition_mode_e recognition_mode; @@ -223,6 +226,8 @@ int vc_mgr_client_create(vc_h* vc) client->cb_ref_count = 0; + client->disabled_cmd_type = 0x00; + /* Authority */ client->authorized_client_list = NULL; client->valid_authorized_pid = -1; @@ -935,6 +940,51 @@ int vc_mgr_client_get_error_message(vc_h vc, char** err_msg) return 0; } +int vc_mgr_client_enable_command_type(vc_h vc, vc_cmd_type_e cmd_type) +{ + SLOG(LOG_INFO, TAG_VCM, "[Manager INFO] enable command type (%d)", cmd_type); + + vc_mgr_client_s* client = __mgr_client_get(vc); + + /* check handle */ + if (NULL == client) + return VC_ERROR_INVALID_PARAMETER; + + client->disabled_cmd_type &= ~(1 << cmd_type); + + return 0; +} + +int vc_mgr_client_disable_command_type(vc_h vc, vc_cmd_type_e cmd_type) +{ + SLOG(LOG_INFO, TAG_VCM, "[Manager INFO] disable command type (%d)", cmd_type); + + vc_mgr_client_s* client = __mgr_client_get(vc); + + /* check handle */ + if (NULL == client) + return VC_ERROR_INVALID_PARAMETER; + + client->disabled_cmd_type |= (1 << cmd_type); + + return 0; +} + +int vc_mgr_client_get_disabled_command_type(vc_h vc, int* disabled_cmd_type) +{ + SLOG(LOG_INFO, TAG_VCM, "[Manager INFO] get disabled command type"); + + vc_mgr_client_s* client = __mgr_client_get(vc); + + /* check handle */ + if (NULL == client) + return VC_ERROR_INVALID_PARAMETER; + + *disabled_cmd_type = client->disabled_cmd_type; + + return 0; +} + int vc_mgr_client_set_exclusive_command(vc_h vc, bool value) { vc_mgr_client_s* client = __mgr_client_get(vc); diff --git a/client/vc_mgr_client.h b/client/vc_mgr_client.h index 3ee6512..800ba0f 100644 --- a/client/vc_mgr_client.h +++ b/client/vc_mgr_client.h @@ -139,6 +139,12 @@ int vc_mgr_client_set_error_message(vc_h vc, const char* err_msg); int vc_mgr_client_get_error_message(vc_h vc, char** err_msg); +int vc_mgr_client_enable_command_type(vc_h vc, vc_cmd_type_e cmd_type); + +int vc_mgr_client_disable_command_type(vc_h vc, vc_cmd_type_e cmd_type); + +int vc_mgr_client_get_disabled_command_type(vc_h vc, int* disabled_cmd_type); + int vc_mgr_client_set_exclusive_command(vc_h vc, bool value); bool vc_mgr_client_get_exclusive_command(vc_h vc); diff --git a/client/vc_mgr_dbus.c b/client/vc_mgr_dbus.c index a95852c..be34e3f 100644 --- a/client/vc_mgr_dbus.c +++ b/client/vc_mgr_dbus.c @@ -1846,7 +1846,7 @@ int vc_mgr_dbus_request_do_action(int pid, vc_send_event_type_e type, char* send return 0; } -int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client) +int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client, int disabled_cmd_type) { if (0 != __dbus_check()) { return VC_ERROR_OPERATION_FAILED; @@ -1884,8 +1884,8 @@ int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_comm SLOG(LOG_ERROR, TAG_VCM, "@@ vc mgr start : Fail to make message "); return VC_ERROR_OPERATION_FAILED; } else { - SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr start : pid(%d), recognition_mode(%d) exclusive(%d) start by client(%d)", - pid, recognition_mode, exclusive_command_option, start_by_client); + SLOG(LOG_INFO, TAG_VCM, "@@ vc mgr start : pid(%d), recognition_mode(%d) exclusive(%d) start by client(%d) disabled cmd type(%d)", + pid, recognition_mode, exclusive_command_option, start_by_client, disabled_cmd_type); } int exclusive = (int)exclusive_command_option; @@ -1896,6 +1896,7 @@ int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_comm DBUS_TYPE_INT32, &(recognition_mode), DBUS_TYPE_INT32, &(exclusive), DBUS_TYPE_INT32, &(by), + DBUS_TYPE_INT32, &(disabled_cmd_type), DBUS_TYPE_INVALID); DBusMessage* result_msg; @@ -2099,172 +2100,6 @@ int vc_mgr_dbus_request_cancel(int pid) return result; } -int vc_mgr_dbus_request_enable_command_type(int pid, int cmd_type) -{ - if (0 != __dbus_check()) { - return VC_ERROR_OPERATION_FAILED; - } - - DBusError err; - dbus_error_init(&err); - - bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err); - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); - dbus_error_free(&err); - } - - int ret; - if (false == exist) { - ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - - DBusMessage* msg; - - /* create a signal & check for errors */ - msg = dbus_message_new_method_call( - VC_SERVER_SERVICE_NAME, - VC_SERVER_SERVICE_OBJECT_PATH, /* object name of the signal */ - VC_SERVER_SERVICE_INTERFACE, /* interface name of the signal */ - VC_MANAGER_METHOD_ENABLE_COMMAND_TYPE); /* name of the signal */ - - if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCM, "@@ vc enable command type : Fail to make message "); - return VC_ERROR_OPERATION_FAILED; - } else { - SLOG(LOG_INFO, TAG_VCM, "@@ vc enable command type : pid(%d) type(%d)", pid, cmd_type); - } - - dbus_message_append_args(msg, - DBUS_TYPE_INT32, &pid, - DBUS_TYPE_INT32, &cmd_type, - DBUS_TYPE_INVALID); - - DBusMessage* result_msg; - int result = VC_ERROR_OPERATION_FAILED; - - result_msg = dbus_connection_send_with_reply_and_block(g_m_conn_sender, msg, g_m_waiting_time, &err); - dbus_message_unref(msg); - - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); - dbus_error_free(&err); - } - - if (NULL != result_msg) { - dbus_message_get_args(result_msg, &err, - DBUS_TYPE_INT32, &result, - DBUS_TYPE_INVALID); - - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCM, "@@ Get arguments error (%s)", err.message); - dbus_error_free(&err); - result = VC_ERROR_OPERATION_FAILED; - } - dbus_message_unref(result_msg); - - if (0 == result) { - SLOG(LOG_INFO, TAG_VCM, "@@ vc enable command type : result = %d", result); - } else { - SLOG(LOG_ERROR, TAG_VCM, "@@ vc enable command type : result = %d", result); - } - } else { - SLOG(LOG_ERROR, TAG_VCM, "@@ Result Message is NULL"); - vc_mgr_dbus_reconnect(); - result = VC_ERROR_TIMED_OUT; - } - - return result; -} - -int vc_mgr_dbus_request_disable_command_type(int pid, int cmd_type) -{ - if (0 != __dbus_check()) { - return VC_ERROR_OPERATION_FAILED; - } - - DBusError err; - dbus_error_init(&err); - - bool exist = dbus_bus_name_has_owner(g_m_conn_sender, VC_SERVER_SERVICE_NAME, &err); - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); - dbus_error_free(&err); - } - - int ret; - if (false == exist) { - ret = __dbus_restore_daemon(); - if (VC_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Fail to restore daemon"); - return VC_ERROR_TIMED_OUT; - } - return VC_ERROR_OPERATION_FAILED; - } - - DBusMessage* msg; - - /* create a signal & check for errors */ - msg = dbus_message_new_method_call( - VC_SERVER_SERVICE_NAME, - VC_SERVER_SERVICE_OBJECT_PATH, /* object name of the signal */ - VC_SERVER_SERVICE_INTERFACE, /* interface name of the signal */ - VC_MANAGER_METHOD_DISABLE_COMMAND_TYPE); /* name of the signal */ - - if (NULL == msg) { - SLOG(LOG_ERROR, TAG_VCM, "@@ vc disable command type : Fail to make message "); - return VC_ERROR_OPERATION_FAILED; - } else { - SLOG(LOG_INFO, TAG_VCM, "@@ vc disable command type : pid(%d) type(%d)", pid, cmd_type); - } - - dbus_message_append_args(msg, - DBUS_TYPE_INT32, &pid, - DBUS_TYPE_INT32, &cmd_type, - DBUS_TYPE_INVALID); - - DBusMessage* result_msg; - int result = VC_ERROR_OPERATION_FAILED; - - result_msg = dbus_connection_send_with_reply_and_block(g_m_conn_sender, msg, g_m_waiting_time, &err); - dbus_message_unref(msg); - - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Dbus Error (%s)", err.message); - dbus_error_free(&err); - } - - if (NULL != result_msg) { - dbus_message_get_args(result_msg, &err, - DBUS_TYPE_INT32, &result, - DBUS_TYPE_INVALID); - - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCM, "@@ Get arguments error (%s)", err.message); - dbus_error_free(&err); - result = VC_ERROR_OPERATION_FAILED; - } - dbus_message_unref(result_msg); - - if (0 == result) { - SLOG(LOG_INFO, TAG_VCM, "@@ vc disable command type : result = %d", result); - } else { - SLOG(LOG_ERROR, TAG_VCM, "@@ vc disable command type : result = %d", result); - } - } else { - SLOG(LOG_ERROR, TAG_VCM, "@@ Result Message is NULL"); - vc_mgr_dbus_reconnect(); - result = VC_ERROR_TIMED_OUT; - } - - return result; -} - static DBusMessage* __get_message(int pid, const char* method, int type) { char service_name[64]; diff --git a/client/vc_mgr_dbus.h b/client/vc_mgr_dbus.h index a6202ea..e0f5942 100644 --- a/client/vc_mgr_dbus.h +++ b/client/vc_mgr_dbus.h @@ -56,7 +56,7 @@ int vc_mgr_dbus_request_set_domain(int pid, const char* domain); int vc_mgr_dbus_request_do_action(int pid, vc_send_event_type_e type, char* send_event); -int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client); +int vc_mgr_dbus_request_start(int pid, int recognition_mode, bool exclusive_command_option, bool start_by_client, int disabled_cmd_type); int vc_mgr_dbus_request_stop(int pid); @@ -68,10 +68,6 @@ int vc_mgr_dbus_send_result_selection(int pid); int vc_mgr_dbus_send_specific_engine_request(int pid, const char* engine_app_id, const char* event, const char* request); -int vc_mgr_dbus_request_enable_command_type(int pid, int cmd_type); - -int vc_mgr_dbus_request_disable_command_type(int pid, int cmd_type); - int vc_mgr_dbus_request_start_feedback(int pid); int vc_mgr_dbus_request_stop_feedback(int pid); diff --git a/server/vcd_config.c b/server/vcd_config.c index ce97815..b7108b3 100644 --- a/server/vcd_config.c +++ b/server/vcd_config.c @@ -30,15 +30,8 @@ static int g_foreground_pid; static int g_audio_streaming_mode; #define COMMAND_TYPE_MAX 7 -static int g_enabled_command_type[COMMAND_TYPE_MAX] = { - 0, /* NONE */ - 1, /* FOREGROUND */ - 1, /* BACKGROUND */ - 1, /* WIDGET */ - 1, /* SYSTEM */ - 1, /* SYSTEM_BACKGROUND */ - 1 /* EXCLUSIVE */ -}; + +static int g_disabled_command_type = 0x00; void __vcd_config_lang_changed_cb(const char* before_lang, const char* current_lang) { @@ -145,25 +138,12 @@ int vcd_config_set_foreground(int pid, bool value) return 0; } -int vcd_config_enable_command_type(int cmd_type) +int vcd_config_set_disabled_command_type(int disabled_cmd_type) { - if (cmd_type <= 0 || cmd_type >= COMMAND_TYPE_MAX) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid command type"); - return -1; - } + SLOG(LOG_INFO, TAG_VCD, "[INFO] Set disabled command type"); - g_enabled_command_type[cmd_type] = 1; - return 0; -} - -int vcd_config_disable_command_type(int cmd_type) -{ - if (cmd_type <= 0 || cmd_type >= COMMAND_TYPE_MAX) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Invalid command type"); - return -1; - } + g_disabled_command_type = disabled_cmd_type; - g_enabled_command_type[cmd_type] = 0; return 0; } @@ -174,7 +154,7 @@ int vcd_config_get_command_type_enabled(int cmd_type) return 0; } - return g_enabled_command_type[cmd_type]; + return ~(g_disabled_command_type) & (1 << cmd_type); } int vcd_config_get_audio_streaming_mode(vcd_audio_streaming_mode_e* streaming_mode) diff --git a/server/vcd_config.h b/server/vcd_config.h index 68db934..404b636 100644 --- a/server/vcd_config.h +++ b/server/vcd_config.h @@ -45,9 +45,7 @@ int vcd_config_get_foreground(int* pid); int vcd_config_set_foreground(int pid, bool value); -int vcd_config_enable_command_type(int cmd_type); - -int vcd_config_disable_command_type(int cmd_type); +int vcd_config_set_disabled_command_type(int disabled_cmd_type); int vcd_config_get_command_type_enabled(int cmd_type); diff --git a/server/vcd_dbus.c b/server/vcd_dbus.c index 834c951..1ca143e 100644 --- a/server/vcd_dbus.c +++ b/server/vcd_dbus.c @@ -1139,12 +1139,6 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_SPECIFIC_ENGINE_REQUEST)) vcd_dbus_server_mgr_send_specific_engine_request(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_ENABLE_COMMAND_TYPE)) - vcd_dbus_server_mgr_enable_command_type(g_conn_listener, msg); - - else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_DISABLE_COMMAND_TYPE)) - vcd_dbus_server_mgr_disable_command_type(g_conn_listener, msg); - else if (dbus_message_is_method_call(msg, VC_SERVER_SERVICE_INTERFACE, VC_MANAGER_METHOD_START_FEEDBACK)) vcd_dbus_server_mgr_start_feedback(g_conn_listener, msg); diff --git a/server/vcd_dbus_server.c b/server/vcd_dbus_server.c index 77a666f..46bacac 100644 --- a/server/vcd_dbus_server.c +++ b/server/vcd_dbus_server.c @@ -22,6 +22,15 @@ #include "vcd_server.h" #include "vcd_config.h" +vc_cmd_type_e vc_command_types[7] = {VC_COMMAND_TYPE_NONE, + VC_COMMAND_TYPE_FOREGROUND, + VC_COMMAND_TYPE_BACKGROUND, + VC_COMMAND_TYPE_WIDGET, + VC_COMMAND_TYPE_SYSTEM, + VC_COMMAND_TYPE_SYSTEM_BACKGROUND, + VC_COMMAND_TYPE_EXCLUSIVE}; + + int __dbus_error_return(DBusConnection* conn, DBusMessage* msg, int ret) { DBusMessage* reply; @@ -741,112 +750,6 @@ int vcd_dbus_server_mgr_do_action(DBusConnection* conn, DBusMessage* msg) return 0; } -int vcd_dbus_server_mgr_enable_command_type(DBusConnection* conn, DBusMessage* msg) -{ - DBusError err; - dbus_error_init(&err); - - int pid = 0; - int cmd_type = 0; - - int ret = VCD_ERROR_OPERATION_FAILED; - - SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager enable command type"); - - dbus_message_get_args(msg, &err, - DBUS_TYPE_INT32, &pid, - DBUS_TYPE_INT32, &cmd_type, - DBUS_TYPE_INVALID); - - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCD, "[IN ERROR] vcd mgr enable command type : get arguments error (%s)", err.message); - dbus_error_free(&err); - ret = VCD_ERROR_OPERATION_FAILED; - } else { - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr enable command type : pid(%d), cmd_type(%d)", pid, cmd_type); - ret = vcd_server_mgr_enable_command_type(pid, cmd_type); - } - - DBusMessage* reply; - reply = dbus_message_new_method_return(msg); - - if (NULL != reply) { - dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID); - - if (0 == ret) { - SLOG(LOG_INFO, TAG_VCD, "[OUT SUCCESS] Result(%d)", ret); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret); - } - - if (!dbus_connection_send(conn, reply, NULL)) { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Out Of Memory!"); - } - - dbus_connection_flush(conn); - dbus_message_unref(reply); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Fail to create reply message!!"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "@@@"); - - return 0; -} - -int vcd_dbus_server_mgr_disable_command_type(DBusConnection* conn, DBusMessage* msg) -{ - DBusError err; - dbus_error_init(&err); - - int pid = 0; - int cmd_type = 0; - - int ret = VCD_ERROR_OPERATION_FAILED; - - SLOG(LOG_DEBUG, TAG_VCD, "@@@ VCD Manager disable command type"); - - dbus_message_get_args(msg, &err, - DBUS_TYPE_INT32, &pid, - DBUS_TYPE_INT32, &cmd_type, - DBUS_TYPE_INVALID); - - if (dbus_error_is_set(&err)) { - SLOG(LOG_ERROR, TAG_VCD, "[IN ERROR] vcd mgr disable command type : get arguments error (%s)", err.message); - dbus_error_free(&err); - ret = VCD_ERROR_OPERATION_FAILED; - } else { - SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr disable command type : pid(%d), cmd_type(%d)", pid, cmd_type); - ret = vcd_server_mgr_disable_command_type(pid, cmd_type); - } - - DBusMessage* reply; - reply = dbus_message_new_method_return(msg); - - if (NULL != reply) { - dbus_message_append_args(reply, DBUS_TYPE_INT32, &ret, DBUS_TYPE_INVALID); - - if (0 == ret) { - SLOG(LOG_INFO, TAG_VCD, "[OUT SUCCESS] Result(%d)", ret); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Result(%d)", ret); - } - - if (!dbus_connection_send(conn, reply, NULL)) { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Out Of Memory!"); - } - - dbus_connection_flush(conn); - dbus_message_unref(reply); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[OUT ERROR] Fail to create reply message!!"); - } - - SLOG(LOG_DEBUG, TAG_VCD, "@@@"); - - return 0; -} - int vcd_dbus_server_mgr_start(DBusConnection* conn, DBusMessage* msg) { DBusError err; @@ -856,6 +759,7 @@ int vcd_dbus_server_mgr_start(DBusConnection* conn, DBusMessage* msg) int recognition_mode = 0; int exclusive = 0; int start_by_client = 0; + int disabled_cmd_type = 0; int ret = VCD_ERROR_OPERATION_FAILED; @@ -866,6 +770,7 @@ int vcd_dbus_server_mgr_start(DBusConnection* conn, DBusMessage* msg) DBUS_TYPE_INT32, &recognition_mode, DBUS_TYPE_INT32, &exclusive, DBUS_TYPE_INT32, &start_by_client, + DBUS_TYPE_INT32, &disabled_cmd_type, DBUS_TYPE_INVALID); if (dbus_error_is_set(&err)) { @@ -873,6 +778,9 @@ int vcd_dbus_server_mgr_start(DBusConnection* conn, DBusMessage* msg) dbus_error_free(&err); ret = VCD_ERROR_OPERATION_FAILED; } else { + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd check enabled or disabled command types. disabled cmd type(%d)", disabled_cmd_type); + vcd_server_mgr_set_disabled_command_type(pid, disabled_cmd_type); + SLOG(LOG_INFO, TAG_VCD, "[IN] vcd mgr start : pid(%d) recognition_mode(%d) exclusive(%d) start by client(%d)", pid, recognition_mode, exclusive, start_by_client); ret = vcd_server_mgr_start((vcd_recognition_mode_e)recognition_mode, (bool)exclusive, (bool)start_by_client); } diff --git a/server/vcd_dbus_server.h b/server/vcd_dbus_server.h index 6182697..7890502 100644 --- a/server/vcd_dbus_server.h +++ b/server/vcd_dbus_server.h @@ -63,10 +63,6 @@ int vcd_dbus_server_mgr_cancel(DBusConnection* conn, DBusMessage* msg); int vcd_dbus_server_mgr_result_selection(DBusConnection* conn, DBusMessage* msg); -int vcd_dbus_server_mgr_enable_command_type(DBusConnection* conn, DBusMessage* msg); - -int vcd_dbus_server_mgr_disable_command_type(DBusConnection* conn, DBusMessage* msg); - int vcd_dbus_server_mgr_send_specific_engine_request(DBusConnection* conn, DBusMessage* msg); int vcd_dbus_server_mgr_change_system_volume(DBusConnection* conn, DBusMessage* msg); diff --git a/server/vcd_server.c b/server/vcd_server.c index 5a54f55..7385ffb 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -2198,7 +2198,7 @@ int vcd_server_mgr_do_action(int pid, int type, const char* action) return ret; } -int vcd_server_mgr_enable_command_type(int pid, int cmd_type) +int vcd_server_mgr_set_disabled_command_type(int pid, int disabled_cmd_type) { int ret = -1; @@ -2214,41 +2214,16 @@ int vcd_server_mgr_enable_command_type(int pid, int cmd_type) return VCD_ERROR_INVALID_STATE; } - ret = vcd_config_enable_command_type(cmd_type); + ret = vcd_config_set_disabled_command_type(disabled_cmd_type); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to enable command type"); + SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to set command type"); } else { - SLOG(LOG_ERROR, TAG_VCD, "[Server] Enable command type(%d)", cmd_type); + SLOG(LOG_ERROR, TAG_VCD, "[Server] Set command type(%d)", disabled_cmd_type); } return ret; } -int vcd_server_mgr_disable_command_type(int pid, int cmd_type) -{ - int ret = -1; - - /* check if pid is valid */ - if (false == vcd_client_manager_is_valid(pid)) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] The manager pid(%d) is NOT valid", pid); - return VCD_ERROR_INVALID_PARAMETER; - } - - vcd_state_e state = vcd_config_get_service_state(); - if (VCD_STATE_READY != state) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Current state is not ready"); - return VCD_ERROR_INVALID_STATE; - } - - ret = vcd_config_disable_command_type(cmd_type); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[Server ERROR] Fail to disable command type"); - } else { - SLOG(LOG_ERROR, TAG_VCD, "[Server] Disable command type(%d)", cmd_type); - } - - return ret; -} /* for TTS feedback */ int vcd_server_mgr_start_feedback(void) diff --git a/server/vcd_server.h b/server/vcd_server.h index 7979e4a..23ec32a 100644 --- a/server/vcd_server.h +++ b/server/vcd_server.h @@ -77,9 +77,7 @@ int vcd_server_mgr_get_private_data(int pid, const char* key, char** data); int vcd_server_mgr_do_action(int pid, int type, const char* action); -int vcd_server_mgr_enable_command_type(int pid, int cmd_type); - -int vcd_server_mgr_disable_command_type(int pid, int cmd_type); +int vcd_server_mgr_set_disabled_command_type(int pid, int disabled_cmd_type); int vcd_server_mgr_change_system_volume(int pid, vcd_system_volume_event_e system_volume_event); -- 2.7.4 From 73b75f09c26fd9c428bb487679d4c454ad3ba568 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Fri, 13 Dec 2019 07:54:48 +0900 Subject: [PATCH 03/16] Fix unsafety issue on config_mgr Change-Id: I7e2cc810d0fbddbbf874e7469699ef903dfdfb4b (cherry picked from commit 8c484a46c8f27348ac92aec42afdd61cb89e6c30) --- common/vc_config_mgr.c | 176 ++++++++++++++++++++++++++++++++++++++++------ common/vc_config_parser.c | 15 +++- 2 files changed, 166 insertions(+), 25 deletions(-) diff --git a/common/vc_config_mgr.c b/common/vc_config_mgr.c index 4edf45b..ca4895e 100644 --- a/common/vc_config_mgr.c +++ b/common/vc_config_mgr.c @@ -336,10 +336,14 @@ int __vc_config_mgr_get_engine_info() int filesize; vc_engine_info_s* info = NULL; + SLOG(LOG_DEBUG, vc_config_tag(), "[CONFIG] Release engine and Unregister engine config"); + __vc_config_release_engine(); g_engine_list = NULL; __vc_config_mgr_unregister_engine_config_updated_event(); + SLOG(LOG_DEBUG, vc_config_tag(), "[CONFIG] default directory : %s", VC_DEFAULT_ENGINE_INFO); + /* Copy default info directory to download directory */ dp = opendir(VC_DEFAULT_ENGINE_INFO); if (NULL == dp) { @@ -425,6 +429,8 @@ int __vc_config_mgr_get_engine_info() static Eina_Bool __vc_config_mgr_engine_config_inotify_event_callback(void* data, Ecore_Fd_Handler *fd_handler) { SLOG(LOG_DEBUG, vc_config_tag(), "@@@ Engine config updated callback event"); + ecore_thread_main_loop_begin(); + pthread_mutex_lock(&vc_config_mgr_mutex); vc_engine_inotify_s *ino = (vc_engine_inotify_s *)data; int dir_fd = ino->dir_fd; @@ -437,6 +443,8 @@ static Eina_Bool __vc_config_mgr_engine_config_inotify_event_callback(void* data if (0 > length) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Empty Inotify event"); SLOG(LOG_DEBUG, vc_config_tag(), "@@@"); + pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return ECORE_CALLBACK_DONE; } @@ -472,6 +480,8 @@ static Eina_Bool __vc_config_mgr_engine_config_inotify_event_callback(void* data SLOG(LOG_DEBUG, vc_config_tag(), "@@@"); + pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return ECORE_CALLBACK_PASS_ON; } @@ -557,10 +567,6 @@ static int __vc_config_mgr_unregister_engine_config_updated_event() return 0; } - - - - Eina_Bool vc_config_mgr_inotify_event_cb(void* data, Ecore_Fd_Handler *fd_handler) { SLOG(LOG_DEBUG, vc_config_tag(), "@@@ Config changed callback event"); @@ -802,11 +808,13 @@ int __vc_config_set_auto_language() void __vc_config_language_changed_cb(keynode_t *key, void *data) { - if (true == g_config_info->auto_lang) { + pthread_mutex_lock(&vc_config_mgr_mutex); + if (g_config_info && true == g_config_info->auto_lang) { /* Get voice input vconf key */ __vc_config_set_auto_language(); } + pthread_mutex_unlock(&vc_config_mgr_mutex); return; } @@ -816,11 +824,8 @@ int vc_config_mgr_initialize(int uid) int* get_uid; vc_config_client_s* temp_client = NULL; - if (0 != pthread_mutex_init(&vc_config_mgr_mutex, NULL)) { - SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to initialize vc_config_mgr_mutex."); - } - SLOG(LOG_INFO, vc_config_tag(), "[WARNING] Enter critical section"); + ecore_thread_main_loop_begin(); pthread_mutex_lock(&vc_config_mgr_mutex); if (0 < g_slist_length(g_config_client_list)) { @@ -833,6 +838,7 @@ int vc_config_mgr_initialize(int uid) if (uid == *get_uid) { SLOG(LOG_WARN, vc_config_tag(), "[CONFIG] uid(%d) has already registered", uid); pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); SLOG(LOG_DEBUG, vc_config_tag(), "[WARNING] Leave critical section"); return 0; } @@ -844,6 +850,7 @@ int vc_config_mgr_initialize(int uid) if (NULL == temp_client) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to allocate memory"); pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return VC_ERROR_OUT_OF_MEMORY; } @@ -859,6 +866,7 @@ int vc_config_mgr_initialize(int uid) __vc_config_mgr_print_client_info(); pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); SLOG(LOG_DEBUG, vc_config_tag(), "[WARNING] Leave critical section"); return 0; } @@ -871,6 +879,7 @@ int vc_config_mgr_initialize(int uid) SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory : %s", VC_CONFIG_BASE); __vc_config_release_client(uid); pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return -1; } else { SLOG(LOG_DEBUG, vc_config_tag(), "Success to make directory : %s", VC_CONFIG_BASE); @@ -881,6 +890,7 @@ int vc_config_mgr_initialize(int uid) SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory : %s", VC_RUNTIME_INFO_ROOT); __vc_config_release_client(uid); pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return -1; } else { SLOG(LOG_DEBUG, vc_config_tag(), "Success to make directory : %s", VC_RUNTIME_INFO_ROOT); @@ -892,6 +902,7 @@ int vc_config_mgr_initialize(int uid) SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory : %s", VC_DOWNLOAD_BASE); __vc_config_release_client(uid); pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return -1; } else { SLOG(LOG_DEBUG, vc_config_tag(), "Success to make directory : %s", VC_DOWNLOAD_BASE); @@ -902,6 +913,7 @@ int vc_config_mgr_initialize(int uid) SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to make directory : %s", VC_DOWNLOAD_ENGINE_INFO); __vc_config_release_client(uid); pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return -1; } else { SLOG(LOG_DEBUG, vc_config_tag(), "Success to make directory : %s", VC_DOWNLOAD_ENGINE_INFO); @@ -913,6 +925,7 @@ int vc_config_mgr_initialize(int uid) __vc_config_release_client(uid); __vc_config_release_engine(); pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return VC_CONFIG_ERROR_ENGINE_NOT_FOUND; } @@ -923,6 +936,7 @@ int vc_config_mgr_initialize(int uid) __vc_config_release_client(uid); __vc_config_release_engine(); pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return -1; } @@ -931,7 +945,9 @@ int vc_config_mgr_initialize(int uid) __vc_config_release_client(uid); __vc_config_release_engine(); vc_parser_unload_config(g_config_info); + g_config_info = NULL; pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return VC_CONFIG_ERROR_ENGINE_NOT_FOUND; } @@ -947,7 +963,9 @@ int vc_config_mgr_initialize(int uid) __vc_config_release_client(uid); __vc_config_release_engine(); vc_parser_unload_config(g_config_info); + g_config_info = NULL; pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return -1; } @@ -963,7 +981,9 @@ int vc_config_mgr_initialize(int uid) __vc_config_release_client(uid); __vc_config_release_engine(); vc_parser_unload_config(g_config_info); + g_config_info = NULL; pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return -1; } @@ -990,7 +1010,9 @@ int vc_config_mgr_initialize(int uid) __vc_config_release_client(uid); __vc_config_release_engine(); vc_parser_unload_config(g_config_info); + g_config_info = NULL; pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return VC_ERROR_OUT_OF_MEMORY; } @@ -1007,6 +1029,7 @@ int vc_config_mgr_initialize(int uid) __vc_config_mgr_print_client_info(); pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); SLOG(LOG_DEBUG, vc_config_tag(), "[WARNING] Leave critical section"); return 0; } @@ -1020,28 +1043,21 @@ int vc_config_mgr_finalize(int uid) if (0 < __vc_config_release_client(uid)) { pthread_mutex_unlock(&vc_config_mgr_mutex); SLOG(LOG_DEBUG, vc_config_tag(), "[WARNING] Leave critical section"); - - if (0 != pthread_mutex_destroy(&vc_config_mgr_mutex)) { - SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to destroy vc_config_mgr_mutex."); - } + return 0; } __vc_config_release_engine(); - + vconf_ignore_key_changed(VCONFKEY_LANGSET, __vc_config_language_changed_cb); vc_parser_unload_config(g_config_info); + g_config_info = NULL; pthread_mutex_unlock(&vc_config_mgr_mutex); SLOG(LOG_DEBUG, vc_config_tag(), "[WARNING] Leave critical section"); - if (0 != pthread_mutex_destroy(&vc_config_mgr_mutex)) { - SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to destroy vc_config_mgr_mutex."); - } - SLOG(LOG_DEBUG, vc_config_tag(), "[Success] Finalize config"); - return 0; } @@ -1108,6 +1124,9 @@ int vc_config_mgr_set_engine_cb(int uid, vc_config_engine_changed_cb engine_cb) GSList *iter = NULL; vc_config_client_s* temp_client = NULL; + ecore_thread_main_loop_begin(); + pthread_mutex_lock(&vc_config_mgr_mutex); + /* Call all callbacks of client*/ iter = g_slist_nth(g_config_client_list, 0); @@ -1119,6 +1138,7 @@ int vc_config_mgr_set_engine_cb(int uid, vc_config_engine_changed_cb engine_cb) temp_client->engine_cb = engine_cb; if (0 != __vc_config_mgr_register_lang_event()) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to register config event"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_OPERATION_FAILED; } } @@ -1126,6 +1146,8 @@ int vc_config_mgr_set_engine_cb(int uid, vc_config_engine_changed_cb engine_cb) iter = g_slist_next(iter); } + pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return 0; } @@ -1134,6 +1156,9 @@ int vc_config_mgr_unset_engine_cb(int uid) GSList *iter = NULL; vc_config_client_s* temp_client = NULL; + ecore_thread_main_loop_begin(); + pthread_mutex_lock(&vc_config_mgr_mutex); + /* Call all callbacks of client*/ iter = g_slist_nth(g_config_client_list, 0); @@ -1149,6 +1174,8 @@ int vc_config_mgr_unset_engine_cb(int uid) iter = g_slist_next(iter); } + pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return 0; } @@ -1158,6 +1185,9 @@ int vc_config_mgr_set_lang_cb(int uid, vc_config_lang_changed_cb lang_cb) GSList *iter = NULL; vc_config_client_s* temp_client = NULL; + ecore_thread_main_loop_begin(); + pthread_mutex_lock(&vc_config_mgr_mutex); + /* Call all callbacks of client*/ iter = g_slist_nth(g_config_client_list, 0); @@ -1169,6 +1199,7 @@ int vc_config_mgr_set_lang_cb(int uid, vc_config_lang_changed_cb lang_cb) temp_client->lang_cb = lang_cb; if (0 != __vc_config_mgr_register_lang_event()) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to register config event"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_OPERATION_FAILED; } } @@ -1176,6 +1207,8 @@ int vc_config_mgr_set_lang_cb(int uid, vc_config_lang_changed_cb lang_cb) iter = g_slist_next(iter); } + pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return 0; } @@ -1184,6 +1217,9 @@ int vc_config_mgr_unset_lang_cb(int uid) GSList *iter = NULL; vc_config_client_s* temp_client = NULL; + ecore_thread_main_loop_begin(); + pthread_mutex_lock(&vc_config_mgr_mutex); + /* Call all callbacks of client*/ iter = g_slist_nth(g_config_client_list, 0); @@ -1199,6 +1235,8 @@ int vc_config_mgr_unset_lang_cb(int uid) iter = g_slist_next(iter); } + pthread_mutex_unlock(&vc_config_mgr_mutex); + ecore_thread_main_loop_end(); return 0; } @@ -1212,6 +1250,8 @@ int vc_config_mgr_set_enabled_cb(int uid, vc_config_enabled_cb enabled_cb) GSList *iter = NULL; vc_config_client_s* temp_client = NULL; + pthread_mutex_lock(&vc_config_mgr_mutex); + /* Call all callbacks of client*/ iter = g_slist_nth(g_config_client_list, 0); @@ -1221,12 +1261,14 @@ int vc_config_mgr_set_enabled_cb(int uid, vc_config_enabled_cb enabled_cb) if (NULL != temp_client) { if (uid == temp_client->uid) { temp_client->enabled_cb = enabled_cb; + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_NONE; } } iter = g_slist_next(iter); } + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_INVALID_PARAMETER; } @@ -1235,6 +1277,8 @@ int vc_config_mgr_unset_enabled_cb(int uid) GSList *iter = NULL; vc_config_client_s* temp_client = NULL; + pthread_mutex_lock(&vc_config_mgr_mutex); + /* Call all callbacks of client*/ iter = g_slist_nth(g_config_client_list, 0); @@ -1244,35 +1288,45 @@ int vc_config_mgr_unset_enabled_cb(int uid) if (NULL != temp_client) { if (uid == temp_client->uid) { temp_client->enabled_cb = NULL; + pthread_mutex_unlock(&vc_config_mgr_mutex); return 0; } } iter = g_slist_next(iter); } + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_INVALID_PARAMETER; } int vc_config_mgr_get_auto_language(bool* value) { + pthread_mutex_lock(&vc_config_mgr_mutex); + if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } if (NULL == value) { + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } *value = g_config_info->auto_lang; + pthread_mutex_unlock(&vc_config_mgr_mutex); return 0; } int vc_config_mgr_set_auto_language(bool value) { + pthread_mutex_lock(&vc_config_mgr_mutex); + if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } @@ -1280,8 +1334,10 @@ int vc_config_mgr_set_auto_language(bool value) /* Check language is valid */ if (0 != vc_parser_set_auto_lang(value)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to save engine id"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } + g_config_info->auto_lang = value; if (true == g_config_info->auto_lang) { @@ -1289,17 +1345,23 @@ int vc_config_mgr_set_auto_language(bool value) } } + pthread_mutex_unlock(&vc_config_mgr_mutex); return 0; } int vc_config_mgr_get_engine_list(vc_config_supported_engine_cb callback, void* user_data) { + pthread_mutex_lock(&vc_config_mgr_mutex); + if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_INVALID_STATE; } if (NULL == callback) { + SLOG(LOG_ERROR, vc_config_tag(), " callback is NULL"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_INVALID_PARAMETER; } @@ -1308,6 +1370,7 @@ int vc_config_mgr_get_engine_list(vc_config_supported_engine_cb callback, void* if (0 >= g_slist_length(g_engine_list)) { SLOG(LOG_WARN, vc_config_tag(), "[ERROR] Engine list is NULL"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_ENGINE_NOT_FOUND; } @@ -1319,6 +1382,7 @@ int vc_config_mgr_get_engine_list(vc_config_supported_engine_cb callback, void* if (NULL == engine_info) { SLOG(LOG_ERROR, vc_config_tag(), " Engine info is NULL"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_OPERATION_FAILED; } @@ -1328,18 +1392,23 @@ int vc_config_mgr_get_engine_list(vc_config_supported_engine_cb callback, void* iter = g_slist_next(iter); } + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_NONE; } int vc_config_mgr_get_engine(char** engine) { + pthread_mutex_lock(&vc_config_mgr_mutex); if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "Not initialized"); //LCOV_EXCL_LINE + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_INVALID_STATE; } if (NULL == engine) { + SLOG(LOG_ERROR, vc_config_tag(), "Parameter is NULL"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_INVALID_PARAMETER; } @@ -1347,9 +1416,11 @@ int vc_config_mgr_get_engine(char** engine) *engine = strdup(g_config_info->engine_id); } else { SLOG(LOG_ERROR, vc_config_tag(), " Engine id is NULL"); //LCOV_EXCL_LINE + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_ENGINE_NOT_FOUND; } + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_NONE; } @@ -1411,21 +1482,26 @@ int __vc_config_set_buxtonkey(const char* engine) int vc_config_mgr_set_engine(const char* engine) { + pthread_mutex_lock(&vc_config_mgr_mutex); if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_INVALID_STATE; } if (NULL == g_config_info) { + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_OPERATION_FAILED; } if (NULL == engine || NULL == g_config_info->engine_id) { + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_INVALID_PARAMETER; } /* Check current engine id with new engine id */ if (0 == strncmp(g_config_info->engine_id, engine, strlen(g_config_info->engine_id))) { + pthread_mutex_unlock(&vc_config_mgr_mutex); return 0; } @@ -1434,6 +1510,7 @@ int vc_config_mgr_set_engine(const char* engine) int ret = __vc_config_set_buxtonkey(engine); if (0 != ret) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] set buxtonkey Failed!!!"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return ret; } @@ -1521,25 +1598,31 @@ int vc_config_mgr_set_engine(const char* engine) if (0 != vc_parser_set_engine(g_config_info->engine_id)) { SLOG(LOG_ERROR, vc_config_tag(), " Fail to save config"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_OPERATION_FAILED; } } else { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Engine id is not valid"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_INVALID_PARAMETER; } + pthread_mutex_unlock(&vc_config_mgr_mutex); return VC_CONFIG_ERROR_NONE; } int vc_config_mgr_get_language_list(vc_supported_language_cb callback, void* user_data) { + pthread_mutex_lock(&vc_config_mgr_mutex); if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } if (0 >= g_slist_length(g_engine_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] There is no engine"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } @@ -1554,6 +1637,7 @@ int vc_config_mgr_get_language_list(vc_supported_language_cb callback, void* use if (NULL == engine_info) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] engine info is NULL"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } @@ -1584,17 +1668,21 @@ int vc_config_mgr_get_language_list(vc_supported_language_cb callback, void* use break; } + pthread_mutex_unlock(&vc_config_mgr_mutex); return 0; } int vc_config_mgr_get_default_language(char** language) { + pthread_mutex_lock(&vc_config_mgr_mutex); if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } if (NULL == language) { + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } @@ -1602,20 +1690,25 @@ int vc_config_mgr_get_default_language(char** language) *language = strdup(g_config_info->language); } else { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] language is NULL"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } + pthread_mutex_unlock(&vc_config_mgr_mutex); return 0; } int vc_config_mgr_set_default_language(const char* language) { + pthread_mutex_lock(&vc_config_mgr_mutex); if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } if (NULL == language) { + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } @@ -1623,65 +1716,80 @@ int vc_config_mgr_set_default_language(const char* language) if (NULL != g_config_info->language) { if (0 != vc_parser_set_language(language)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to save engine id"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } free(g_config_info->language); g_config_info->language = strdup(language); } else { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] language is NULL"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } + pthread_mutex_unlock(&vc_config_mgr_mutex); return 0; } int vc_config_mgr_get_enabled(bool* value) { + pthread_mutex_lock(&vc_config_mgr_mutex); if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } if (NULL == value) { + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } *value = g_config_info->enabled; + pthread_mutex_unlock(&vc_config_mgr_mutex); return 0; } int vc_config_mgr_set_enabled(bool value) { + pthread_mutex_lock(&vc_config_mgr_mutex); if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } if (0 != vc_parser_set_enabled(value)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Fail to set enabled"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } g_config_info->enabled = value; + pthread_mutex_unlock(&vc_config_mgr_mutex); return 0; } int vc_config_mgr_get_nonfixed_support(bool* value) { + pthread_mutex_lock(&vc_config_mgr_mutex); if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } if (NULL == value) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Input parameter is NULL"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } if (0 >= g_slist_length(g_engine_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] There is no engine"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } @@ -1696,6 +1804,7 @@ int vc_config_mgr_get_nonfixed_support(bool* value) if (NULL == engine_info) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] engine info is NULL"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } @@ -1709,22 +1818,28 @@ int vc_config_mgr_get_nonfixed_support(bool* value) break; } + pthread_mutex_unlock(&vc_config_mgr_mutex); return 0; } bool vc_config_check_default_engine_is_valid(const char* engine) { + pthread_mutex_lock(&vc_config_mgr_mutex); if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } if (NULL == engine) { + pthread_mutex_unlock(&vc_config_mgr_mutex); return false; } - if (0 >= g_slist_length(g_engine_list)) + if (0 >= g_slist_length(g_engine_list)) { + pthread_mutex_unlock(&vc_config_mgr_mutex); return false; + } GSList *iter = NULL; vc_engine_info_s *engine_info = NULL; @@ -1737,33 +1852,41 @@ bool vc_config_check_default_engine_is_valid(const char* engine) if (NULL != engine_info) { if (0 == strcmp(engine, engine_info->uuid)) { + pthread_mutex_unlock(&vc_config_mgr_mutex); return true; } } iter = g_slist_next(iter); } + pthread_mutex_unlock(&vc_config_mgr_mutex); return false; } bool vc_config_check_default_language_is_valid(const char* language) { + pthread_mutex_lock(&vc_config_mgr_mutex); if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } if (NULL == language) { + pthread_mutex_unlock(&vc_config_mgr_mutex); return false; } if (NULL == g_config_info->engine_id) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Default engine id is NULL"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return false; } - if (0 >= g_slist_length(g_engine_list)) + if (0 >= g_slist_length(g_engine_list)) { + pthread_mutex_unlock(&vc_config_mgr_mutex); return false; + } GSList *iter = NULL; vc_engine_info_s *engine_info = NULL; @@ -1794,8 +1917,10 @@ bool vc_config_check_default_language_is_valid(const char* language) while (NULL != iter_lang) { lang = iter_lang->data; - if (0 == strcmp(language, lang)) + if (0 == strcmp(language, lang)) { + pthread_mutex_unlock(&vc_config_mgr_mutex); return true; + } /*Get next item*/ iter_lang = g_slist_next(iter_lang); @@ -1803,26 +1928,33 @@ bool vc_config_check_default_language_is_valid(const char* language) break; } + pthread_mutex_unlock(&vc_config_mgr_mutex); return false; } int vc_config_mgr_set_foreground(int pid, bool value) { + pthread_mutex_lock(&vc_config_mgr_mutex); if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } + pthread_mutex_unlock(&vc_config_mgr_mutex); return vc_parser_set_foreground(pid, value); } int vc_config_mgr_get_foreground(int* pid) { + pthread_mutex_lock(&vc_config_mgr_mutex); if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized"); + pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } + pthread_mutex_unlock(&vc_config_mgr_mutex); return vc_parser_get_foreground(pid); } diff --git a/common/vc_config_parser.c b/common/vc_config_parser.c index c2149a5..e2be6d8 100644 --- a/common/vc_config_parser.c +++ b/common/vc_config_parser.c @@ -474,11 +474,20 @@ int vc_parser_load_config(vc_config_s** config_info) int vc_parser_unload_config(vc_config_s* config_info) { - if (NULL != g_config_doc) xmlFreeDoc(g_config_doc); + if (NULL != g_config_doc) { + xmlFreeDoc(g_config_doc); + g_config_doc = NULL; + } if (NULL != config_info) { - if (NULL != config_info->engine_id) free(config_info->engine_id); - if (NULL != config_info->language) free(config_info->language); + if (NULL != config_info->engine_id) { + free(config_info->engine_id); + config_info->engine_id = NULL; + } + if (NULL != config_info->language) { + free(config_info->language); + config_info->language = NULL; + } free(config_info); } -- 2.7.4 From bcd77dc707d084430b34d4b043d6b8b7fe13346f Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Thu, 26 Dec 2019 16:35:59 +0900 Subject: [PATCH 04/16] Add get_volume_decibel in vc_mgr_send_audio_streaming Change-Id: I733e21ae281f230ab790bfe227a29cb3c7f07906 Signed-off-by: sooyeon.kim (cherry picked from commit c88dd1938805c7bedb3c97d56ad48fac628cac7b) --- client/vc_mgr.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 9f397e7..5112750 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "vc_cmd_db.h" #include "vc_config_mgr.h" @@ -2326,7 +2327,7 @@ int vc_mgr_cancel(void) } static int g_cnt = 0; -static Eina_Bool __vc_mgr_set_volume(void* data) +static Eina_Bool __vc_mgr_set_volume_timer_cb(void* data) { g_cnt++; g_volume_db = g_prev_volume_db + (g_cur_volume_db - g_prev_volume_db) / 5 * g_cnt; @@ -2341,6 +2342,7 @@ static Eina_Bool __vc_mgr_set_volume(void* data) int __vc_mgr_cb_set_volume(float volume) { + // called in vc_mgr_dbus g_prev_volume_db = g_volume_db; g_cur_volume_db = volume; @@ -2351,7 +2353,15 @@ int __vc_mgr_cb_set_volume(float volume) } g_cnt = 1; - g_m_set_volume_timer = ecore_timer_add(0.05, __vc_mgr_set_volume, NULL); + g_m_set_volume_timer = ecore_timer_add(0.05, __vc_mgr_set_volume_timer_cb, NULL); + + return 0; +} + +int __vc_mgr_set_volume(float volume) +{ + // called by app directly + g_volume_db = volume; return 0; } @@ -4367,6 +4377,38 @@ int vc_mgr_send_utterance_status(int pid, int utt_id, int utt_status) return 0; } +static float __get_volume_decibel(char* data, int size) +{ +#define MAX_AMPLITUDE_MEAN_16 32768 + + int i, depthByte; + int count = 0; + + float db = 0.0; + float rms = 0.0; + unsigned long long square_sum = 0; + short pcm16 = 0; + + depthByte = 2; + + for (i = 0; i < size; i += (depthByte<<1)) { + pcm16 = 0; + memcpy(&pcm16, data + i, sizeof(short)); + square_sum += pcm16 * pcm16; + count++; + } + + if (0 == count || 0 == square_sum) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] No data"); + rms = 1.0; + } else { + rms = sqrt((float)square_sum/count); + } + + db = 20 * log10(rms/MAX_AMPLITUDE_MEAN_16); + return db; +} + int vc_mgr_send_audio_streaming(vc_audio_streaming_event_e event, unsigned char* buffer, unsigned int len) { SLOG(LOG_INFO, TAG_VCM, "[Manager] Send audio streaming to the engine service"); @@ -4410,6 +4452,10 @@ int vc_mgr_send_audio_streaming(vc_audio_streaming_event_e event, unsigned char* return VC_ERROR_INVALID_STATE; } + /* set volume */ + float volume = __get_volume_decibel((char*)buffer, len); + __vc_mgr_set_volume(volume); + /* send audio streaming */ int ret = vc_mgr_dbus_send_audio_streaming(g_vc_m->handle, event, buffer, len); if (0 != ret) { -- 2.7.4 From 9524bb2370870b7c44933a78ddcbb004b27dbc41 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Mon, 11 Feb 2019 10:00:17 +0900 Subject: [PATCH 05/16] Add service state changing in vcd_send_result Change-Id: I727f963f043bc4f518bad07bc1d0b7f0f6e03ec6 Signed-off-by: sooyeon.kim --- server/vcd_server.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/vcd_server.c b/server/vcd_server.c index 7385ffb..b1d5717 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -762,6 +762,10 @@ int vcd_send_result(vce_result_event_e event, int* result_id, int count, const c } } + /* set service state ready */ + vcd_config_set_service_state(VCD_STATE_READY); + vcdc_send_service_state(VCD_STATE_READY); + vcd_client_manager_set_exclusive(false); vc_cmd_list_destroy(vc_cmd_list, true); vc_cmd_list = NULL; -- 2.7.4 From 9cc407ba4339335f1dd452e84281d5b63b372da6 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Fri, 17 Jan 2020 16:17:40 +0900 Subject: [PATCH 06/16] Unregister fd event handler for vc_config.xml Change-Id: Ie92239f2c535100ac8c32ff21849c224735289c4 --- common/vc_config_mgr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/common/vc_config_mgr.c b/common/vc_config_mgr.c index ca4895e..44ea696 100644 --- a/common/vc_config_mgr.c +++ b/common/vc_config_mgr.c @@ -69,6 +69,7 @@ static int g_wd_lang; static GList* g_ino_list = NULL; static pthread_mutex_t vc_config_mgr_mutex = PTHREAD_MUTEX_INITIALIZER; +static pthread_mutex_t vc_config_engine_mutex = PTHREAD_MUTEX_INITIALIZER; static int __vc_config_mgr_register_engine_config_updated_event(const char* path); static int __vc_config_mgr_unregister_engine_config_updated_event(); @@ -534,13 +535,17 @@ static int __vc_config_mgr_register_engine_config_updated_event(const char* path SLOG(LOG_WARN, vc_config_tag(), "[WARNING] Fail to set non-block mode"); } + pthread_mutex_lock(&vc_config_mgr_mutex); g_ino_list = g_list_append(g_ino_list, ino); + pthread_mutex_unlock(&vc_config_mgr_mutex); return 0; } static int __vc_config_mgr_unregister_engine_config_updated_event() { + pthread_mutex_lock(&vc_config_mgr_mutex); + /* delete all inotify variable */ if (0 < g_list_length(g_ino_list)) { GList *iter = NULL; @@ -563,7 +568,7 @@ static int __vc_config_mgr_unregister_engine_config_updated_event() iter = g_list_first(g_ino_list); } } - + pthread_mutex_unlock(&vc_config_mgr_mutex); return 0; } @@ -1049,6 +1054,8 @@ int vc_config_mgr_finalize(int uid) __vc_config_release_engine(); + __vc_config_mgr_unregister_engine_config_updated_event(); + vconf_ignore_key_changed(VCONFKEY_LANGSET, __vc_config_language_changed_cb); vc_parser_unload_config(g_config_info); -- 2.7.4 From c934521fbf9c9b9c84a2b3565099fdbae6f754b1 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Wed, 22 Jan 2020 22:30:24 +0900 Subject: [PATCH 07/16] Fix logic to get enabled command type Change-Id: Ia293cfe78ba595d15410ac4322b13eb1204d5407 --- server/vcd_config.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/vcd_config.c b/server/vcd_config.c index b7108b3..0f61317 100644 --- a/server/vcd_config.c +++ b/server/vcd_config.c @@ -140,7 +140,7 @@ int vcd_config_set_foreground(int pid, bool value) int vcd_config_set_disabled_command_type(int disabled_cmd_type) { - SLOG(LOG_INFO, TAG_VCD, "[INFO] Set disabled command type"); + SLOG(LOG_INFO, TAG_VCD, "[INFO] Set disabled command type (%d)", disabled_cmd_type); g_disabled_command_type = disabled_cmd_type; @@ -154,7 +154,10 @@ int vcd_config_get_command_type_enabled(int cmd_type) return 0; } - return ~(g_disabled_command_type) & (1 << cmd_type); + if (~(g_disabled_command_type) & (1 << cmd_type)) + return 1; + else + return 0; } int vcd_config_get_audio_streaming_mode(vcd_audio_streaming_mode_e* streaming_mode) -- 2.7.4 From 147ff8bd11911711041d4531ab66454453920d59 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Mon, 20 Jan 2020 10:35:16 +0900 Subject: [PATCH 08/16] Fix mutex name Change-Id: I56b715c53d7c8c525347a7dfc85f18c3514a977d Signed-off-by: sooyeon.kim (cherry picked from commit bc220259cd31cee10b1f71941078517df793ff8d) --- common/vc_config_mgr.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/vc_config_mgr.c b/common/vc_config_mgr.c index 44ea696..8dda6b7 100644 --- a/common/vc_config_mgr.c +++ b/common/vc_config_mgr.c @@ -535,16 +535,16 @@ static int __vc_config_mgr_register_engine_config_updated_event(const char* path SLOG(LOG_WARN, vc_config_tag(), "[WARNING] Fail to set non-block mode"); } - pthread_mutex_lock(&vc_config_mgr_mutex); + pthread_mutex_lock(&vc_config_engine_mutex); g_ino_list = g_list_append(g_ino_list, ino); - pthread_mutex_unlock(&vc_config_mgr_mutex); + pthread_mutex_unlock(&vc_config_engine_mutex); return 0; } static int __vc_config_mgr_unregister_engine_config_updated_event() { - pthread_mutex_lock(&vc_config_mgr_mutex); + pthread_mutex_lock(&vc_config_engine_mutex); /* delete all inotify variable */ if (0 < g_list_length(g_ino_list)) { @@ -568,7 +568,7 @@ static int __vc_config_mgr_unregister_engine_config_updated_event() iter = g_list_first(g_ino_list); } } - pthread_mutex_unlock(&vc_config_mgr_mutex); + pthread_mutex_unlock(&vc_config_engine_mutex); return 0; } -- 2.7.4 From f0f2ed42957eb1af18f8e42a28852974c01dffd9 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Fri, 31 Jan 2020 15:04:16 +0900 Subject: [PATCH 09/16] Fix svace issues Change-Id: Id253e0b2ce5892ef268c4f7465e3f60a06131d66 Signed-off-by: sooyeon.kim --- common/vc_cmd_db.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/vc_cmd_db.c b/common/vc_cmd_db.c index 62edb6c..310c57e 100644 --- a/common/vc_cmd_db.c +++ b/common/vc_cmd_db.c @@ -2236,6 +2236,11 @@ static int __vc_db_insert_command(sqlite3* db_handle, int pid, vc_cmd_type_e typ g_slist_free(cmd_list); SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] Fail to insert command, %d", ret); + if (NULL != fixed_cmd) { + free(fixed_cmd); + fixed_cmd = NULL; + } + return ret; } cmd_list = NULL; @@ -2245,7 +2250,11 @@ static int __vc_db_insert_command(sqlite3* db_handle, int pid, vc_cmd_type_e typ free(fixed_cmd); fixed_cmd = NULL; } - __vc_db_command_destroy((vc_cmd_h)tmp_cmd); + + if (NULL != tmp_cmd) { + SLOG(LOG_DEBUG, vc_db_tag(), "[DEBUG] command destroy"); + __vc_db_command_destroy((vc_cmd_h)tmp_cmd); + } return VC_DB_ERROR_NONE; } -- 2.7.4 From a6d1397aae9f70716b90736f9f80fdcdb58f8d35 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Thu, 26 Dec 2019 14:58:36 +0900 Subject: [PATCH 10/16] Remove unnecessary mutex to avoid race condition Change-Id: I7613e04283bd9a4fae40b96130a9e5b8a520a76b (cherry picked from commit a4993d8f5fa24d130de788ef5cb4ee3ccc67db9a) --- common/vc_config_mgr.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/common/vc_config_mgr.c b/common/vc_config_mgr.c index 8dda6b7..76a3bca 100644 --- a/common/vc_config_mgr.c +++ b/common/vc_config_mgr.c @@ -1872,26 +1872,21 @@ bool vc_config_check_default_engine_is_valid(const char* engine) bool vc_config_check_default_language_is_valid(const char* language) { - pthread_mutex_lock(&vc_config_mgr_mutex); if (0 >= g_slist_length(g_config_client_list)) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Not initialized"); - pthread_mutex_unlock(&vc_config_mgr_mutex); return -1; } if (NULL == language) { - pthread_mutex_unlock(&vc_config_mgr_mutex); return false; } if (NULL == g_config_info->engine_id) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Default engine id is NULL"); - pthread_mutex_unlock(&vc_config_mgr_mutex); return false; } if (0 >= g_slist_length(g_engine_list)) { - pthread_mutex_unlock(&vc_config_mgr_mutex); return false; } @@ -1925,7 +1920,7 @@ bool vc_config_check_default_language_is_valid(const char* language) lang = iter_lang->data; if (0 == strcmp(language, lang)) { - pthread_mutex_unlock(&vc_config_mgr_mutex); + SLOG(LOG_INFO, vc_config_tag(), "[INFO] Default language(%s) is valid", language); return true; } @@ -1935,7 +1930,6 @@ bool vc_config_check_default_language_is_valid(const char* language) break; } - pthread_mutex_unlock(&vc_config_mgr_mutex); return false; } -- 2.7.4 From d2656b5a2447215deb20083781aef33e4bbbb036 Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Tue, 4 Feb 2020 16:00:05 +0900 Subject: [PATCH 11/16] Fixed coverity issues Change-Id: Iffa03a06750ce6c229d784b928d6910809e43c2c Signed-off-by: sungrae jo --- common/vc_cmd_db.c | 4 ++++ common/vc_command.c | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/common/vc_cmd_db.c b/common/vc_cmd_db.c index 310c57e..c32971a 100644 --- a/common/vc_cmd_db.c +++ b/common/vc_cmd_db.c @@ -130,6 +130,7 @@ static int __vc_db_exec_query(sqlite3* db_handle, const char* sql) if (ret != SQLITE_OK) { SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] sqlite3_exec return fail, ret(%d), err(%s)", ret, err_msg); sqlite3_free(err_msg); + err_msg = NULL; return VC_DB_ERROR_OPERATION_FAILED; } return VC_DB_ERROR_NONE; @@ -160,6 +161,7 @@ static int __vc_db_check_table(sqlite3* db_handle, const char* table, bool *is_e if (ret != SQLITE_OK) { SLOG(LOG_ERROR, vc_db_tag(), "[ERROR] sqlite3_get_table return fail, ret(%d), err(%s)", ret, err_msg); sqlite3_free(err_msg); + err_msg = NULL; return VC_DB_ERROR_OPERATION_FAILED; } @@ -1557,6 +1559,8 @@ int __vc_db_open_db_for_daemon(char** path, sqlite3** db_handle) int ret = sqlite3_exec(*db_handle, sql, NULL, NULL, &err_msg); if (ret != SQLITE_OK) { SLOG(LOG_ERROR, vc_db_tag(), "sqlite3_exec returned %d: %s", ret, err_msg); + sqlite3_free(err_msg); + err_msg = NULL; return VC_DB_ERROR_OPERATION_FAILED; } } diff --git a/common/vc_command.c b/common/vc_command.c index 93ff07d..ebd9b8a 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -1986,6 +1986,8 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist) if (0 > hour || 24 <= hour || (0 == flag && 12 < hour)) { SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird"); + free(tempstr); + tempstr = NULL; return VC_ERROR_NONE; } @@ -2017,6 +2019,8 @@ static int __vc_cmd_tabsolute_check(const char *str, struct tm *td, int *exist) if (0 > min || 60 <= min) { SLOG(LOG_DEBUG, TAG_VCCMD, "[REGEX] Incoming sentence is weird"); + free(tempstr); + tempstr = NULL; return VC_ERROR_NONE; } -- 2.7.4 From ba9c4d8c2a3205286bb56b0ccdc952212d95f2e2 Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Thu, 6 Feb 2020 14:14:02 +0900 Subject: [PATCH 12/16] Fixed coverity issues for tts request Change-Id: I5f9a8425e8f07f2d0b29c9b8d6d20a46cda3ac01 Signed-off-by: sungrae jo --- client/vc.c | 4 +-- client/vc_data.cpp | 74 +++++++++++++++++++++++++--------------------- client/vc_data.h | 2 +- server/vcd_server_data.cpp | 9 ++++-- 4 files changed, 50 insertions(+), 39 deletions(-) diff --git a/client/vc.c b/client/vc.c index 467120a..3b21cb0 100644 --- a/client/vc.c +++ b/client/vc.c @@ -2877,7 +2877,6 @@ static void __start_tts_streaming_thread(void* data, Ecore_Thread* thread) { SLOG(LOG_DEBUG, TAG_VCC, "[SUCCESS] Start tts streaming thread"); - vc_tts_data_s* tts_data = NULL; vc_tts_streaming_cb callback = NULL; void* user_data = NULL; @@ -2892,7 +2891,8 @@ static void __start_tts_streaming_thread(void* data, Ecore_Thread* thread) int cnt = 0; /* get tts data */ - ret = vc_data_get_tts_data(&tts_data); + vc_tts_data_s *tts_data = NULL; + ret = vc_data_get_first_tts_data(&tts_data); if (0 != ret || NULL == tts_data) { /* empty queue */ SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] No tts data. Waiting mode"); diff --git a/client/vc_data.cpp b/client/vc_data.cpp index 850d2e1..afc475d 100644 --- a/client/vc_data.cpp +++ b/client/vc_data.cpp @@ -38,10 +38,8 @@ int vc_data_add_tts_data(vc_tts_data_s* data) pthread_mutex_lock(&g_tts_data_mutex); - std::list::iterator iter; - try { - iter = g_tts_data.insert(g_tts_data.end(), data); + g_tts_data.push_back(data); } catch (const std::bad_alloc&) { SLOG(LOG_ERROR, TAG_VCC, "[DATA ERROR] Fail to insert tts data (bad alloc)"); pthread_mutex_unlock(&g_tts_data_mutex); @@ -54,27 +52,25 @@ int vc_data_add_tts_data(vc_tts_data_s* data) return VC_ERROR_NONE; } -int vc_data_get_tts_data(vc_tts_data_s** data) +int vc_data_get_first_tts_data(vc_tts_data_s** data) { + if (NULL == data) { + SLOG(LOG_ERROR, TAG_VCC, "[DATA ERROR] tts data is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + SLOG(LOG_DEBUG, TAG_VCC, "[DATA] tts_data : %p", *data); pthread_mutex_lock(&g_tts_data_mutex); - - if (0 == g_tts_data.size()) { + if (g_tts_data.empty()) { SLOG(LOG_DEBUG, TAG_VCC, "[DATA] There is no tts data"); *data = NULL; pthread_mutex_unlock(&g_tts_data_mutex); - - return -1; + return VC_ERROR_OPERATION_FAILED; } - std::list::iterator iter; - - if (!g_tts_data.empty()) { - iter = g_tts_data.begin(); - *data = *iter; - g_tts_data.pop_front(); - } + *data = g_tts_data.front(); + g_tts_data.pop_front(); pthread_mutex_unlock(&g_tts_data_mutex); @@ -97,19 +93,25 @@ int vc_data_clear_tts_data(vc_tts_data_s** data) { SLOG(LOG_DEBUG, TAG_VCC, "[DATA] clear tts data"); + if (NULL == *data) { + SLOG(LOG_ERROR, TAG_VCC, "[DATA ERROR] tts data is NULL"); + return VC_ERROR_INVALID_PARAMETER; + } + pthread_mutex_lock(&g_tts_data_mutex); - if (NULL != *data) { - SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] event(%d) data(%p) size(%d)", (*data)->event, (*data)->data, (*data)->data_size); + vc_tts_data_s *temp = *data; + SLOG(LOG_DEBUG, TAG_VCC, "[DEBUG] event(%d) data(%p) size(%d)", temp->event, temp->data, temp->data_size); - if (NULL != (*data)->data) { - free((*data)->data); - (*data)->data = NULL; - } + if (temp->data) + free(temp->data); + temp->data = NULL; - free(*data); - *data = NULL; - } + if (temp) + free(temp); + temp = NULL; + + *data = NULL; pthread_mutex_unlock(&g_tts_data_mutex); @@ -122,21 +124,27 @@ int vc_data_clear_tts_data_by_uttid(int utt_id) pthread_mutex_lock(&g_tts_data_mutex); - if (g_tts_data.empty()) { + if (g_tts_data.empty()) { SLOG(LOG_ERROR, TAG_VCC, "[DATA ERROR] There is no tts data"); pthread_mutex_unlock(&g_tts_data_mutex); return -1; } std::list::iterator iter; - for (iter = g_tts_data.begin(); (NULL != *iter && iter != g_tts_data.end()); ++iter) { - if (utt_id == (*iter)->utt_id) { - if (NULL != (*iter)->data) { - free((*iter)->data); - (*iter)->data = NULL; - } - g_tts_data.erase(iter); - free(*iter); + iter = g_tts_data.begin(); + while (iter != g_tts_data.end()) { + vc_tts_data_s *temp = nullptr; + temp = *iter; + if (nullptr != temp && utt_id == temp->utt_id) { + iter = g_tts_data.erase(iter); + + if (temp->data) + free(temp->data); + temp->data = nullptr; + free(temp); + temp = nullptr; + } else { + iter++; } } diff --git a/client/vc_data.h b/client/vc_data.h index 9ca9668..2056023 100644 --- a/client/vc_data.h +++ b/client/vc_data.h @@ -39,7 +39,7 @@ typedef struct { int vc_data_add_tts_data(vc_tts_data_s* data); -int vc_data_get_tts_data(vc_tts_data_s** data); +int vc_data_get_first_tts_data(vc_tts_data_s** data); int vc_data_get_tts_data_size(); diff --git a/server/vcd_server_data.cpp b/server/vcd_server_data.cpp index 8100709..6f5906e 100644 --- a/server/vcd_server_data.cpp +++ b/server/vcd_server_data.cpp @@ -124,11 +124,14 @@ int vcd_data_get_tts_text_data(int uid, vc_tts_text_data_s** data) return -1; } - std::list::iterator iter; - for (iter = g_tts_text_data.begin(); (NULL != *iter && iter != g_tts_text_data.end()); ++iter) { + std::list::iterator iter; + iter = g_tts_text_data.begin(); + while (iter != g_tts_text_data.end()) { if (uid == (*iter)->uid) { *data = *iter; - g_tts_text_data.erase(iter); + iter = g_tts_text_data.erase(iter); + } else { + iter++; } } -- 2.7.4 From 7b8772ee82e99e17edba05684b26efd004439b80 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Sat, 8 Feb 2020 21:54:39 +0900 Subject: [PATCH 13/16] Fix cynara checking logic Change-Id: Ie02989902a5f5f0ae74c6d14886191d6198df3a6 --- client/vc_mgr.c | 57 +++++++++++++++++++++++++++++++---------------------- common/vc_command.c | 38 ++++++++++++++++++++--------------- 2 files changed, 55 insertions(+), 40 deletions(-) diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 22a145a..7a18e56 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -64,6 +64,8 @@ static int g_daemon_pid = 0; static int g_feature_enabled = -1; +static bool g_privilege_allowed = false; + static cynara *p_cynara = NULL; static pthread_mutex_t g_cynara_mutex = PTHREAD_MUTEX_INITIALIZER; @@ -210,35 +212,42 @@ static int __vc_mgr_check_privilege() { pthread_mutex_lock(&g_cynara_mutex); - bool ret = true; - ret = __check_privilege_initialize(); - if (false == ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] privilege initialize is failed"); - pthread_mutex_unlock(&g_cynara_mutex); - return VC_ERROR_PERMISSION_DENIED; - } + if (false == g_privilege_allowed) { + bool ret = true; + ret = __check_privilege_initialize(); + if (false == ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] privilege initialize is failed"); + g_privilege_allowed = false; + pthread_mutex_unlock(&g_cynara_mutex); + return VC_ERROR_PERMISSION_DENIED; + } - char uid[16]; - snprintf(uid, 16, "%d", getuid()); - ret = true; - ret = __check_privilege(uid, VC_PRIVILEGE); - if (false == ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Permission is denied(%s)(%s)", VC_PRIVILEGE, uid); - __check_privilege_deinitialize(); - pthread_mutex_unlock(&g_cynara_mutex); - return VC_ERROR_PERMISSION_DENIED; - } + char uid[16]; + snprintf(uid, 16, "%d", getuid()); + ret = true; + ret = __check_privilege(uid, VC_PRIVILEGE); + if (false == ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Permission is denied(%s)(%s)", VC_PRIVILEGE, uid); + __check_privilege_deinitialize(); + g_privilege_allowed = false; + pthread_mutex_unlock(&g_cynara_mutex); + return VC_ERROR_PERMISSION_DENIED; + } + + ret = true; + ret = __check_privilege(uid, VC_MGR_PRIVILEGE); + if (false == ret) { + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Permission is denied(%s)(%s)", VC_MGR_PRIVILEGE, uid); + __check_privilege_deinitialize(); + g_privilege_allowed = false; + pthread_mutex_unlock(&g_cynara_mutex); + return VC_ERROR_PERMISSION_DENIED; + } - ret = true; - ret = __check_privilege(uid, VC_MGR_PRIVILEGE); - if (false == ret) { - SLOG(LOG_ERROR, TAG_VCM, "[ERROR] Permission is denied(%s)(%s)", VC_MGR_PRIVILEGE, uid); __check_privilege_deinitialize(); - pthread_mutex_unlock(&g_cynara_mutex); - return VC_ERROR_PERMISSION_DENIED; } - __check_privilege_deinitialize(); + g_privilege_allowed = true; pthread_mutex_unlock(&g_cynara_mutex); return VC_ERROR_NONE; } diff --git a/common/vc_command.c b/common/vc_command.c index ebd9b8a..6319427 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -34,6 +34,7 @@ #include "voice_control_key_defines.h" static int g_feature_enabled = -1; +static bool g_privilege_allowed = false; static pthread_mutex_t g_cynara_mutex = PTHREAD_MUTEX_INITIALIZER; static cynara *p_cynara = NULL; @@ -132,25 +133,30 @@ static int __vc_cmd_check_privilege() { pthread_mutex_lock(&g_cynara_mutex); - bool ret = true; - ret = __check_privilege_initialize(); - if (false == ret) { - SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] privilege initialize is failed"); - pthread_mutex_unlock(&g_cynara_mutex); - return VC_ERROR_PERMISSION_DENIED; - } + if (false == g_privilege_allowed) { + bool ret = true; + ret = __check_privilege_initialize(); + if (false == ret) { + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] privilege initialize is failed"); + g_privilege_allowed = false; + pthread_mutex_unlock(&g_cynara_mutex); + return VC_ERROR_PERMISSION_DENIED; + } - char uid[16]; - snprintf(uid, 16, "%d", getuid()); - ret = true; - ret = __check_privilege(uid, VC_PRIVILEGE); - __check_privilege_deinitialize(); - if (false == ret) { - SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Permission is denied"); - pthread_mutex_unlock(&g_cynara_mutex); - return VC_ERROR_PERMISSION_DENIED; + char uid[16]; + snprintf(uid, 16, "%d", getuid()); + ret = true; + ret = __check_privilege(uid, VC_PRIVILEGE); + __check_privilege_deinitialize(); + if (false == ret) { + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] Permission is denied"); + g_privilege_allowed = false; + pthread_mutex_unlock(&g_cynara_mutex); + return VC_ERROR_PERMISSION_DENIED; + } } + g_privilege_allowed = true; pthread_mutex_unlock(&g_cynara_mutex); return VC_ERROR_NONE; } -- 2.7.4 From d44bc76eb0bef223f03d039912d4724797078422 Mon Sep 17 00:00:00 2001 From: "sooyeon.kim" Date: Wed, 13 Nov 2019 14:35:39 +0900 Subject: [PATCH 14/16] Add secure option to vc_getengine Change-Id: Ie876da315ef1e32715bb15baaf983a77502fd3a1 Signed-off-by: sooyeon.kim (cherry picked from commit b9190b43567d57ba7085ea403a81d4e5ebe5a793) --- bin/aarch64/vc_getengine | Bin 12464 -> 14632 bytes bin/armv7l/vc_getengine | Bin 8776 -> 9884 bytes bin/i586/vc_getengine | Bin 13852 -> 13856 bytes bin/x86_64/vc_getengine | Bin 14672 -> 14680 bytes 4 files changed, 0 insertions(+), 0 deletions(-) diff --git a/bin/aarch64/vc_getengine b/bin/aarch64/vc_getengine index 126ccd9184615bc3e1151e8c3dee309863fab7be..476a546d897af5cb3d6940ad640b26b9676a5999 100755 GIT binary patch literal 14632 zcmeHOeRNdEb)Vgpg!mFG5Fa+!ycJ-u9IZeg47M9qD}joQ9W0C3jpM9VtCh57*%iAh zEKpi6AH{BxCcJ}eD2?qEq%KlVQn{9EIBkQBb8>L(6BFXtPW@3K$1UeHN%0{uY;1Y^ zyYuFXVbNmFY5!^&o!LA0&b@c;z3}Fb{Qw-6CYe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$=%Vrzs3h-$TPIL2GvqI(%g5*t2A!Y7C_j__ zH<8)6GLW>FU$3NSX#SWTkNEDQvW+@}L6}!ILZ{lrl?cj^{~ys5uHV*)_XsKcDGKxW40`Anz+-hV z1@P(R|CLb-!~*g~B?>x2zJ&0(FF6R|&>*-X@8fsUM^LLIlRIT_N9kon!(6UP2S2$* zMDGlYI!zaql7E@a9kz66(ZXd*n^!DrEGj7;SL`kEtXep4$)e^(OP4e(UBv!6?AIL~ zIk$=8LT1Tb&RTM_S$pnN*^RhAUcu2mfPN0$3_KKl3VI{EJ#TV#0GY(yC9J*>k8cDm z>y5`_gi+S@pfBR|^%90e2@3Er&>GMrJe^xW>p>5)<9UUqq$|vnUp)KR`FMOg7KBvC zEvXr|+6O+A)FM=5O&&eIAP=+rGei|=)5Umv91e@%Pjx(Ey3>|0bHjkBdA%i+Fkq`W zIVCa4k7qC16!d2F?dHF5_^*sNRo-^u14D70xSFjg&Jjnl zXNoJtCU(3yC#^*1!1cvjC9`@eM1f8By?^lR=*aN8P2#<*e0+u2!q$xUq^+jN&{L=5^UE1&2|`>!uxYz<~N=4!kKeX65#Vo($n iR$k_@DkW~ds<7o{6()Sd*- Date: Mon, 25 Nov 2019 10:38:27 +0900 Subject: [PATCH 15/16] Fix memory leak issue using g_slist Change-Id: Ib37e5f748ef821eafb53b08e1a4093928ed39311 (cherry picked from commit f75ef72ecd870c338c8e6a1dce2deab589bd55dc) --- server/vcd_server.c | 89 +++++++++++++++++++++++++++++------------------------ 1 file changed, 48 insertions(+), 41 deletions(-) diff --git a/server/vcd_server.c b/server/vcd_server.c index b1d5717..d632034 100644 --- a/server/vcd_server.c +++ b/server/vcd_server.c @@ -303,6 +303,21 @@ static bool __vcd_is_package_installed(const char* appid) return true; } +void __vc_free_deactivated_app(void* data) +{ + vc_deactivated_app_s* d_app = (vc_deactivated_app_s*)data; + + if (NULL != d_app) { + if (NULL != d_app->appid) { + free(d_app->appid); + d_app->appid = NULL; + } + + free(d_app); + d_app = NULL; + } +} + static bool __vcd_launch_app(const char* result) { if (NULL == result) { @@ -325,54 +340,43 @@ static bool __vcd_launch_app(const char* result) while (NULL != iter) { temp_app = iter->data; - if (NULL != temp_app) { - if (NULL != temp_app->appid) { - int ret = -1; - bool running = false; - ret = app_manager_is_running(temp_app->appid, &running); - if (APP_MANAGER_ERROR_NONE != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to check running with appid(%s)", temp_app->appid); - free(temp_app->appid); - temp_app->appid = NULL; - free(temp_app); - temp_app = NULL; - return VCD_ERROR_OPERATION_FAILED; - } - if (false == running) { - int tmp_ret = __vcd_is_package_installed(temp_app->appid); - if (false == tmp_ret) { - SLOG(LOG_WARN, TAG_VCD, "[WARNING] app is not installed, appid(%s)", temp_app->appid); - } else { - ret = __vcd_activate_app_by_appcontrol(temp_app->appid); - if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to activate app"); - free(temp_app->appid); - temp_app->appid = NULL; - free(temp_app); - temp_app = NULL; - return ret; - } - SLOG(LOG_ERROR, TAG_VCD, "Launch app: appid(%s) result(%s)", temp_app->appid, result); - } + if (NULL != temp_app && NULL != temp_app->appid) { + int ret = -1; + bool running = false; + ret = app_manager_is_running(temp_app->appid, &running); + if (APP_MANAGER_ERROR_NONE != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to check running with appid(%s)", temp_app->appid); + g_slist_free_full(iter, __vc_free_deactivated_app); + return VCD_ERROR_OPERATION_FAILED; + } + if (false == running) { + int tmp_ret = __vcd_is_package_installed(temp_app->appid); + if (false == tmp_ret) { + SLOG(LOG_WARN, TAG_VCD, "[WARNING] app is not installed, appid(%s)", temp_app->appid); } else { - ret = __vcd_resume_app(temp_app->appid); + ret = __vcd_activate_app_by_appcontrol(temp_app->appid); if (0 != ret) { - SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to resume app"); - free(temp_app->appid); - temp_app->appid = NULL; - free(temp_app); - temp_app = NULL; + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to activate app"); + g_slist_free_full(iter, __vc_free_deactivated_app); return ret; } - SLOG(LOG_ERROR, TAG_VCD, "Resume app: appid(%s) result(%s)", temp_app->appid, result); + SLOG(LOG_ERROR, TAG_VCD, "Launch app: appid(%s) result(%s)", temp_app->appid, result); } - free(temp_app->appid); - temp_app->appid = NULL; + } else { + ret = __vcd_resume_app(temp_app->appid); + if (0 != ret) { + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] Fail to resume app"); + g_slist_free_full(iter, __vc_free_deactivated_app); + return ret; + } + SLOG(LOG_ERROR, TAG_VCD, "Resume app: appid(%s) result(%s)", temp_app->appid, result); } - free(temp_app); + __vc_free_deactivated_app((void*)temp_app); temp_app = NULL; } - iter = g_slist_next(iter); + app_list = g_slist_remove_link(app_list, iter); + g_slist_free(iter); + iter = g_slist_nth(app_list, 0); } app_list = NULL; } @@ -409,6 +413,8 @@ static Eina_Bool __vcd_send_selected_result(void *data) ret = vcdc_send_result(temp_cmd->pid, vcd_client_manager_get_pid(), temp_cmd->type); if (0 != ret) { SLOG(LOG_WARN, TAG_VCD, "[Server WARNING] Fail to send result, ret(%d)", ret); + g_slist_free_full(pid_list, free); + pid_list = NULL; break; } else { SLOG(LOG_ERROR, TAG_VCD, "[Server] Send result : pid(%d) type(%d)", temp_cmd->pid, temp_cmd->type); @@ -420,6 +426,7 @@ static Eina_Bool __vcd_send_selected_result(void *data) temp_cmd = NULL; } pid_list = g_slist_remove_link(pid_list, iter); + g_slist_free(iter); iter = g_slist_nth(pid_list, 0); } } @@ -3268,4 +3275,4 @@ int vcd_set_tts_audio_format_request_cb(vce_tts_audio_format_request_cb callback } return ret; -} +} \ No newline at end of file -- 2.7.4 From c9e5a54f9aefa689372df3a452189d5a6d1087bc Mon Sep 17 00:00:00 2001 From: sungrae jo Date: Wed, 12 Feb 2020 18:51:22 +0900 Subject: [PATCH 16/16] Fixed cynara log Change-Id: I5bae4742308bcfd1039bd28a5e87efaf3dc17d14 Signed-off-by: sungrae jo --- client/vc.c | 6 +++++- client/vc_mgr.c | 5 +++-- common/vc_command.c | 6 +++++- server/vce.c | 6 +++++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/client/vc.c b/client/vc.c index 3b21cb0..7ee1667 100644 --- a/client/vc.c +++ b/client/vc.c @@ -136,7 +136,11 @@ static int __check_privilege(const char* uid, const char * privilege) static void __check_privilege_deinitialize() { if (p_cynara) - cynara_finish(p_cynara); + { + int ret = cynara_finish(p_cynara); + if (ret != CYNARA_API_SUCCESS) + SLOG(LOG_ERROR, TAG_VCC, "[ERROR] cynara finish %d", ret); + } p_cynara = NULL; } diff --git a/client/vc_mgr.c b/client/vc_mgr.c index 7a18e56..b20079e 100644 --- a/client/vc_mgr.c +++ b/client/vc_mgr.c @@ -202,8 +202,9 @@ static int __check_privilege(const char* uid, const char * privilege) static void __check_privilege_deinitialize() { if (p_cynara) { - SLOG(LOG_ERROR, TAG_VCM, "[DEBUG] cynara finish"); - cynara_finish(p_cynara); + int ret = cynara_finish(p_cynara); + if (ret != CYNARA_API_SUCCESS) + SLOG(LOG_ERROR, TAG_VCM, "[ERROR] cynara finish %d", ret); } p_cynara = NULL; } diff --git a/common/vc_command.c b/common/vc_command.c index 6319427..c0dc496 100644 --- a/common/vc_command.c +++ b/common/vc_command.c @@ -125,7 +125,11 @@ static int __check_privilege(const char* uid, const char * privilege) static void __check_privilege_deinitialize() { if (p_cynara) - cynara_finish(p_cynara); + { + int ret = cynara_finish(p_cynara); + if (ret != CYNARA_API_SUCCESS) + SLOG(LOG_ERROR, TAG_VCCMD, "[ERROR] cynara finish %d", ret); + } p_cynara = NULL; } diff --git a/server/vce.c b/server/vce.c index 7825c9a..e9302f3 100644 --- a/server/vce.c +++ b/server/vce.c @@ -101,7 +101,11 @@ static int __check_privilege(const char* uid, const char * privilege) static void __check_privilege_deinitialize() { if (p_cynara) - cynara_finish(p_cynara); + { + int ret = cynara_finish(p_cynara); + if (ret != CYNARA_API_SUCCESS) + SLOG(LOG_ERROR, TAG_VCD, "[ERROR] cynara finish %d", ret); + } p_cynara = NULL; } -- 2.7.4