static int g_feature_enabled = -1;
static int g_privilege_allowed = -1;
+static int g_privilege_applaunch_allowed = -1;
+
static cynara *p_cynara = NULL;
static bool g_err_callback_status = false;
return ret == CYNARA_API_SUCCESS;
}
-static int __check_privilege(const char* uid, const char * privilege)
+static bool __check_privilege(const char* uid, const char * privilege)
{
FILE *fp = NULL;
char label_path[1024] = "/proc/self/attr/current";
return STT_ERROR_PERMISSION_DENIED;
}
snprintf(uid, 16, "%d", getuid());
- if (false == __check_privilege(uid, STT_PRIVILEGE)) {
+ if (false == __check_privilege(uid, STT_PRIVILEGE_RECORDER)) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Permission is denied");
g_privilege_allowed = 0;
__check_privilege_deinitialize();
return STT_ERROR_NONE;
}
+static int __stt_check_privilege_for_applaunch()
+{
+ char uid[16];
+
+ if (0 == g_privilege_applaunch_allowed) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Permission for applaunch is denied");
+ return STT_ERROR_PERMISSION_DENIED;
+ } else if (-1 == g_privilege_applaunch_allowed) {
+ if (false == __check_privilege_initialize()) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] privilege initialize is failed (applaunch)");
+ return STT_ERROR_PERMISSION_DENIED;
+ }
+ snprintf(uid, 16, "%d", getuid());
+ if (false == __check_privilege(uid, STT_PRIVILEGE_APPLAUNCH)) {
+ SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Permission is denied : appmanager.launch");
+ g_privilege_applaunch_allowed = 0;
+ __check_privilege_deinitialize();
+ return STT_ERROR_PERMISSION_DENIED;
+ }
+ __check_privilege_deinitialize();
+ }
+
+ g_privilege_applaunch_allowed = 1;
+ return STT_ERROR_NONE;
+}
+
static const char* __stt_get_error_code(stt_error_e err)
{
switch (err) {
if (0 != __stt_check_privilege()) {
return STT_ERROR_PERMISSION_DENIED;
}
+ if (0 != __stt_check_privilege_for_applaunch()) {
+ return STT_ERROR_PERMISSION_DENIED;
+ }
if (0 != __stt_check_handle(stt, &client)) {
return STT_ERROR_INVALID_PARAMETER;
}
static Eina_Bool __stt_connect_daemon(void *data)
{
stt_client_s* client = (stt_client_s*)data;
+ int ret = -1;
if (NULL == client) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] A handle is not available");
return EINA_FALSE;
}
+ /* Check and Set vconfkey of custom engine before sending hello */
+ if (1 == g_privilege_applaunch_allowed && NULL != client->current_engine_id) {
+ /* Set vconfkey */
+ ret = __stt_set_buxtonkey(client->current_engine_id);
+ if (0 != ret) {
+ SLOG(LOG_DEBUG, TAG_STTC, "[DEBUG] set buxtonkey Failed!!! (inside __stt_connect_daemon)");
+ return EINA_TRUE;
+ }
+ }
+
/* Send hello */
- int ret = -1;
ret = stt_dbus_request_hello(client->uid);
if (0 != ret) {