int ret = cynara_initialize(&p_cynara, NULL);
if (CYNARA_API_SUCCESS != ret)
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] fail to initialize");
-
+
return ret == CYNARA_API_SUCCESS;
}
static int __check_privilege(const char* uid, const char * privilege)
{
FILE *fp = NULL;
- char smack_label[1024] = "/proc/self/attr/current";
+ char label_path[1024] = "/proc/self/attr/current";
+ char smack_label[1024] = {'\0',};
if (!p_cynara) {
return false;
}
- fp = fopen(smack_label, "r");
+ fp = fopen(label_path, "r");
if (fp != NULL) {
if (fread(smack_label, 1, sizeof(smack_label), fp) <= 0)
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] fail to fread");
char *session = cynara_session_from_pid(pid);
int ret = cynara_check(p_cynara, smack_label, session, uid, privilege);
SLOG(LOG_DEBUG, TAG_STTC, "[Client]cynara_check returned %d(%s)", ret, (CYNARA_API_ACCESS_ALLOWED == ret) ? "Allowed" : "Denied");
- if (session)
- free(session);
+ if (session) {
+ free(session);
+ session = NULL;
+ }
if (ret != CYNARA_API_ACCESS_ALLOWED)
return false;
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] Permission is denied");
return STT_ERROR_PERMISSION_DENIED;
} else if (-1 == g_privilege_allowed) {
- if (false == __check_privilege_initialize()){
+ if (false == __check_privilege_initialize()) {
SLOG(LOG_ERROR, TAG_STTC, "[ERROR] privilege initialize is failed");
return STT_ERROR_PERMISSION_DENIED;
}
}
g_privilege_allowed = 1;
- return STT_ERROR_NONE;
+ return STT_ERROR_NONE;
}
static const char* __stt_get_error_code(stt_error_e err)
if (NULL != client->engine_changed_cb) {
client->engine_changed_cb(stt, engine_id, language, support_silence, need_credential, client->engine_changed_user_data);
} else {
- SLOG(LOG_WARN, TAG_STTC, "No registered callback function of supported languages");
+ SLOG(LOG_WARN, TAG_STTC, "No registered callback function for engine change");
}
return;
}
if (NULL != client->current_engine_id) {
free(client->current_engine_id);
+ client->current_engine_id = NULL;
}
+ SLOG(LOG_DEBUG, TAG_STTC, "===== engined_id(%s)", engine_id);
+
client->current_engine_id = strdup(engine_id);
SLOG(LOG_DEBUG, TAG_STTC, "=====");
return STT_ERROR_INVALID_STATE;
}
+ if (NULL != client->credential) {
+ free(client->credential);
+ client->credential = NULL;
+ }
client->credential = strdup(credential);
SLOG(LOG_DEBUG, TAG_STTC, "=====");
}
}
+ if (0 == strncmp(*data, "NULL", strlen(*data))) {
+ free(*data);
+ *data = NULL;
+ }
+
SLOG(LOG_DEBUG, TAG_STTC, "=====");
SLOG(LOG_DEBUG, TAG_STTC, "");
}
g_connect_timer = NULL;
- SLOG(LOG_DEBUG, TAG_STTC, "===== Connect daemon");
+ SLOG(LOG_DEBUG, TAG_STTC, "===== Connect stt-service");
/* request initialization */
bool silence_supported = false;
SLOG(LOG_ERROR, TAG_STTC, "[WARNING] Fail to connection. Retry to connect");
return EINA_TRUE;
} else {
- /* success to connect stt-daemon */
+ /* success to connect stt-service */
client->silence_supported = silence_supported;
client->credential_needed = credential_needed;
SLOG(LOG_DEBUG, TAG_STTC, "Supported options : silence(%s), credential(%s)", silence_supported ? "support" : "no support", credential_needed ? "need" : "no need");
}
+#ifdef __UNUSED_CODES__
if (NULL != client->current_engine_id) {
ret = -1;
int count = 0;
silence_supported = false;
credential_needed = false;
+ SLOG(LOG_DEBUG, TAG_STTC, "[WARNING] current_engine_id(%s)", client->current_engine_id);
+
while (0 != ret) {
ret = stt_dbus_request_set_current_engine(client->uid, client->current_engine_id, &silence_supported, &credential_needed);
if (0 != ret) {
}
}
}
-
+#endif
SLOG(LOG_DEBUG, TAG_STTC, "[SUCCESS] uid(%d)", client->uid);
client->before_state = client->current_state;
if (NULL != current_engine_id) {
free(current_engine_id);
+ current_engine_id = NULL;
}
client->supported_lang_cb = NULL;