Delete cynara code in scan folder API 83/109883/2
authorMinje Ahn <minje.ahn@samsung.com>
Thu, 12 Jan 2017 06:32:55 +0000 (15:32 +0900)
committerMinje Ahn <minje.ahn@samsung.com>
Thu, 12 Jan 2017 06:35:49 +0000 (15:35 +0900)
Delete the temporary code for the privilege check

Change-Id: I953c8040c91d90cabe5d7ca49e9fc8711b0a8d61
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
CMakeLists.txt
packaging/capi-content-media-content.spec
src/media_content.c

index 9a9a847..79a548e 100755 (executable)
@@ -12,7 +12,7 @@ ELSE()
 ENDIF(TIZEN_PRODUCT_TV)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
-SET(dependents "dlog libmedia-service media-thumbnail libmedia-utils capi-base-common capi-system-info vconf cynara-client cynara-creds-socket cynara-session storage")
+SET(dependents "dlog libmedia-service media-thumbnail libmedia-utils capi-base-common capi-system-info vconf storage")
 SET(pc_dependents "dlog capi-base-common")
 
 INCLUDE(FindPkgConfig)
index c9e611a..82eb315 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-content-media-content
 Summary:    A Media content library in Tizen Native API
-Version:    0.3.0
+Version:    0.3.1
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
@@ -15,8 +15,6 @@ BuildRequires:  pkgconfig(media-thumbnail)
 BuildRequires:  pkgconfig(libmedia-utils)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(libtzplatform-config)
-BuildRequires:  pkgconfig(cynara-client)
-BuildRequires:  pkgconfig(cynara-session)
 BuildRequires:  pkgconfig(storage)
 
 %description
index a699b01..efbe581 100755 (executable)
 #include <sys/stat.h>
 #include <dirent.h>
 #include <fcntl.h>
-#include <grp.h>
-#include <pwd.h>
-
-#include <cynara-client.h>
-#include <cynara-session.h>
-#include <cynara-error.h>
-#include <cynara-creds-socket.h>
 #ifdef _USE_TV_PROFILE
 #include <media_pvr.h>
 #include <media_uhd.h>
@@ -47,13 +40,6 @@ static attribute_h g_alias_attr_handle = NULL;
 static MediaSvcHandle *db_handle = NULL;
 static int ref_count = 0;
 static GMutex db_mutex;
-#ifndef SCM_SECURITY
-#define SCM_SECURITY 0x03
-#endif
-
-static cynara *_cynara = NULL;
-G_LOCK_DEFINE_STATIC(cynara_mutex);
-
 static __thread media_noti_cb_s *g_noti_info = NULL;
 
 static int __media_content_create_attr_handle(void);
@@ -768,59 +754,6 @@ static int __media_content_destroy_attribute_handle(void)
        return ret;
 }
 
-/* Temporary Code [remove after inserted gid patch by security part] */
-int __media_content_cynara_check(const char *privilege)
-{
-       int ret = MEDIA_CONTENT_ERROR_NONE;
-       int result;
-       char *session = NULL;
-       pid_t pid;
-       char c_uid[20] = {0, };
-       char *smack = NULL;
-       FILE *pFile = NULL;
-       char buf[255] = {0, };
-
-       ret = cynara_initialize(&_cynara, NULL);
-       if (ret != CYNARA_API_SUCCESS) {
-               media_content_error("cynara_initialize", ret);
-               return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
-       }
-
-       snprintf(c_uid, sizeof(c_uid), "%d", tzplatform_getuid(TZ_USER_NAME));
-
-       pid = getpid();
-
-       session = cynara_session_from_pid(pid);
-       if (session == NULL) {
-               media_content_error("cynara_session_from_pid failed");
-               return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
-       }
-
-       pFile = fopen("/proc/self/attr/current", "r");
-       if (pFile != NULL) {
-               smack = fgets(buf, sizeof(buf), pFile);
-               fclose(pFile);
-       } else {
-               SAFE_FREE(session);
-               media_content_error("current info read failed");
-               return MEDIA_CONTENT_ERROR_INVALID_OPERATION;
-       }
-
-       G_LOCK(cynara_mutex);
-       result = cynara_check(_cynara, smack, session, c_uid, privilege);
-       G_UNLOCK(cynara_mutex);
-
-       if (result != CYNARA_API_ACCESS_ALLOWED)
-               media_content_error("cynara_check", result);
-
-       SAFE_FREE(session);
-
-       cynara_finish(_cynara);
-       _cynara = NULL;
-
-       return result == CYNARA_API_ACCESS_ALLOWED ? MEDIA_CONTENT_ERROR_NONE : MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
-}
-
 attribute_h _content_get_attirbute_handle(void)
 {
        return g_attr_handle;
@@ -1258,15 +1191,6 @@ int media_content_scan_folder(const char *path, bool is_recursive, media_scan_co
        ret = _media_content_replace_path(path, repl_path);
        media_content_retvm_if(!STRING_VALID(repl_path), MEDIA_CONTENT_ERROR_INVALID_OPERATION, "path replacement failed");
 
-       /* Temporary Code [remove after inserted gid patch by security part] */
-       if (strncmp(repl_path, "/opt/media", strlen("/opt/media")) == 0) {
-               ret = __media_content_cynara_check("http://tizen.org/privilege/externalstorage");
-               media_content_retvm_if(ret == MEDIA_CONTENT_ERROR_PERMISSION_DENIED, ret, "Permission Denied");
-       } else {
-               ret = __media_content_cynara_check("http://tizen.org/privilege/mediastorage");
-               media_content_retvm_if(ret == MEDIA_CONTENT_ERROR_PERMISSION_DENIED, ret, "Permission Denied");
-       }
-
        memset(storage_id, 0x00, sizeof(storage_id));
 
        ret = __media_content_check_dir(repl_path);