INCLUDE_DIRECTORIES(${INC_DIR})
SET(dependents "dlog glib-2.0 mm-common capi-media-tool iniparser bundle libtbm gstreamer-1.0 gstreamer-plugins-base-1.0\
- gstreamer-app-1.0 gstreamer-video-1.0 gstreamer-sdp-1.0 gstreamer-webrtc-1.0 cynara-client capi-system-info ecore-evas\
- evas ecore-wl2 mm-resource-manager dpm capi-content-mime-type json-glib-1.0 libsoup-2.4")
+ gstreamer-app-1.0 gstreamer-video-1.0 gstreamer-sdp-1.0 gstreamer-webrtc-1.0 cynara-client libsmack\
+ capi-system-info ecore-evas evas ecore-wl2 mm-resource-manager dpm capi-content-mime-type json-glib-1.0 libsoup-2.4")
SET(pc_dependents "capi-base-common capi-media-tool bundle")
INCLUDE(FindPkgConfig)
#include <cynara-client.h>
#include <system_info.h>
+#include <sys/smack.h>
#include <Evas.h>
#include <gst/video/videooverlay.h>
#include "media_streamer_node.h"
int ret = MEDIA_STREAMER_ERROR_NONE;
int ret_val = 0;
char *privilege = NULL;
- FILE* opened_file;
- char smackLabel[SMACK_LABEL_LEN + 1];
char uid[10];
cynara *cynara_h = NULL;
-
- ms_debug_fenter();
+ char *smack_label;
ms_retvm_if(node == NULL, MEDIA_STREAMER_ERROR_INVALID_PARAMETER, "node is NULL");
if (privilege == NULL)
return ret;
- if (CYNARA_API_SUCCESS != cynara_initialize(&cynara_h, NULL)) {
- ms_error("Failed to initialize cynara structure\n");
- return MEDIA_STREAMER_ERROR_INVALID_OPERATION;
- }
-
- bzero(smackLabel, SMACK_LABEL_LEN + 1);
+ ms_retvm_if(cynara_initialize(&cynara_h, NULL) != CYNARA_API_SUCCESS, MEDIA_STREAMER_ERROR_INVALID_OPERATION,
+ "failed to cynara_initialize()");
- /* Getting smack label */
- opened_file = fopen("/proc/self/attr/current", "r");
- if (opened_file == NULL) {
- ms_error("Failed to open /proc/self/attr/current\n");
- return MEDIA_STREAMER_ERROR_INVALID_OPERATION;
- }
- ret_val = fread(smackLabel, sizeof(smackLabel), 1, opened_file);
- fclose(opened_file);
- if (ret_val < 0) {
- ms_error("Failed to read /proc/self/attr/current\n");
- return MEDIA_STREAMER_ERROR_INVALID_OPERATION;
- }
+ ms_retvm_if(smack_new_label_from_self(&smack_label) == -1, MEDIA_STREAMER_ERROR_INVALID_OPERATION,
+ "failed to smack_new_label_from_self()");
- /* Getting uid */
snprintf(uid, sizeof(uid), "%d", getuid());
- ms_info("%s %s %s\n", smackLabel, uid, privilege);
+ ms_debug("smack_label[%s] uid[%s] privilege[%s]", smack_label, uid, privilege);
/* Checking with cynara for current session */
- ret_val = cynara_check(cynara_h, smackLabel, "", uid, privilege);
+ ret_val = cynara_check(cynara_h, smack_label, "", uid, privilege);
ms_info("Cynara_check [%d] ", ret_val);
switch (ret_val) {
cynara_finish(cynara_h);
- ms_debug_fleave();
+ free(smack_label);
return ret;
}