ms_comm_msg_s recv_msg;
int client_sock = GPOINTER_TO_INT(data);
int send_msg = MS_MEDIA_ERR_NONE;
+ ms_peer_credentials creds;
while (1) {
if (power_off == TRUE) {
break;
}
memset((void *)&recv_msg, 0, sizeof(ms_comm_msg_s));
+ memset(&creds, 0, sizeof(creds));
- ret = ms_ipc_receive_message_tcp(client_sock, &recv_msg);
+ ret = ms_cynara_receive_untrusted_message(client_sock, &recv_msg, &creds);
if (ret != MS_MEDIA_ERR_NONE) {
media_db_request_update_db_batch_clear();
MS_DBG_ERR("ms_ipc_receive_message_tcp failed [%d]", ret);
goto ERROR;
}
+ if (ms_cynara_check(&creds, CONTENT_WRITE_PRIVILEGE) != MS_MEDIA_ERR_NONE) {
+ media_db_request_update_db_batch_clear();
+ MS_SAFE_FREE(creds.smack);
+ MS_SAFE_FREE(creds.uid);
+ MS_DBG_ERR("Permission denied");
+ send_msg = MS_MEDIA_ERR_PERMISSION_DENIED;
+ goto ERROR;
+ }
+
+ MS_SAFE_FREE(creds.smack);
+ MS_SAFE_FREE(creds.uid);
+
if (!MS_STRING_VALID(recv_msg.msg)) {
send_msg = MS_MEDIA_ERR_INVALID_PARAMETER;
goto ERROR;