Move privilege check code from camera_create to camera_start_preview 48/128548/1 accepted/tizen/unified/20170515.074601 submit/tizen/20170515.041223 tizen_4.0.m1_release
authorJeongmo Yang <jm80.yang@samsung.com>
Wed, 10 May 2017 10:00:43 +0000 (19:00 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Wed, 10 May 2017 10:00:43 +0000 (19:00 +0900)
[Version] 0.3.0
[Profile] Common
[Issue Type] Update
[Dependency module] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-unified_20170502.4]

Change-Id: I29fe63336af66d198319758ae803b0f144375cf3
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
muse/src/muse_camera_dispatcher.c
packaging/mmsvc-camera.spec

index 51c280e..81f72e3 100644 (file)
@@ -1449,7 +1449,6 @@ int camera_dispatcher_create(muse_module_h module)
 {
        int ret = CAMERA_ERROR_NONE;
        int device_type;
-       int client_fd = -1;
        int pid = 0;
        bool camera_feature_supported = false;
        void *gdbus_connection = NULL;
@@ -1462,15 +1461,6 @@ int camera_dispatcher_create(muse_module_h module)
 
        LOGD("device type : %d, client pid : %d", device_type, pid);
 
-       /* privilege check */
-       client_fd = muse_core_client_get_msg_fd(module);
-       if (!muse_core_security_check_cynara(client_fd, CAMERA_PRIVILEGE_NAME)) {
-               ret = CAMERA_ERROR_PERMISSION_DENIED;
-               LOGE("security check failed 0x%x", ret);
-               muse_camera_msg_return(api, class, ret, module);
-               return MUSE_CAMERA_ERROR_INVALID;
-       }
-
        /* init handle */
        muse_camera = (muse_camera_handle_s *)malloc(sizeof(muse_camera_handle_s));
        if (muse_camera == NULL) {
@@ -1637,6 +1627,7 @@ int camera_dispatcher_destroy(muse_module_h module)
 int camera_dispatcher_start_preview(muse_module_h module)
 {
        int ret = CAMERA_ERROR_NONE;
+       int client_fd = -1;
        muse_camera_handle_s *muse_camera = NULL;
        muse_camera_api_e api = MUSE_CAMERA_API_START_PREVIEW;
        muse_camera_api_class_e class = MUSE_CAMERA_API_CLASS_IMMEDIATE;
@@ -1645,6 +1636,15 @@ int camera_dispatcher_start_preview(muse_module_h module)
 
        LOGD("handle : %p", muse_camera);
 
+       /* privilege check */
+       client_fd = muse_core_client_get_msg_fd(module);
+       if (!muse_core_security_check_cynara(client_fd, CAMERA_PRIVILEGE_NAME)) {
+               ret = CAMERA_ERROR_PERMISSION_DENIED;
+               LOGE("security check failed 0x%x", ret);
+               muse_camera_msg_return(api, class, ret, module);
+               return MUSE_CAMERA_ERROR_INVALID;
+       }
+
        ret = legacy_camera_start_preview(muse_camera->camera_handle);
 
        muse_camera_msg_return(api, class, ret, module);
index c2f5ee4..bca30f6 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-camera
 Summary:    A Camera module for muse server
-Version:    0.2.77
+Version:    0.3.0
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0