Move privilege check code from recorder_create_* to recorder_start 27/129027/1 accepted/tizen/unified/20170515.074600 submit/tizen/20170515.041223 tizen_4.0.m1_release
authorJeongmo Yang <jm80.yang@samsung.com>
Fri, 12 May 2017 11:35:06 +0000 (20:35 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Fri, 12 May 2017 11:35:06 +0000 (20:35 +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: Ib93079866da4e3940bdd3c5a872be55e722595bf
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
muse/src/muse_recorder_dispatcher.c
packaging/mmsvc-recorder.spec

index 4d514c3..9305dbc 100644 (file)
@@ -552,7 +552,6 @@ int recorder_dispatcher_create(muse_module_h module)
 {
        int ret = RECORDER_ERROR_NONE;
        int recorder_type = MUSE_RECORDER_TYPE_AUDIO;
-       int client_fd = -1;
        int pid = 0;
        bool microphone_feature_supported = false;
        void *gdbus_connection = NULL;
@@ -567,15 +566,6 @@ int recorder_dispatcher_create(muse_module_h module)
 
        LOGD("Enter - type %d", recorder_type);
 
-       /* privilege check */
-       client_fd = muse_core_client_get_msg_fd(module);
-       if (!muse_core_security_check_cynara(client_fd, RECORDER_PRIVILEGE_NAME)) {
-               LOGE("security check failed");
-               ret = RECORDER_ERROR_PERMISSION_DENIED;
-               muse_recorder_msg_return(api, class, ret, module);
-               return MUSE_RECORDER_ERROR_INVALID;
-       }
-
        /* init handle */
        muse_recorder = (muse_recorder_handle_s *)malloc(sizeof(muse_recorder_handle_s));
        if (muse_recorder == NULL) {
@@ -776,6 +766,7 @@ int recorder_dispatcher_unprepare(muse_module_h module)
 int recorder_dispatcher_start(muse_module_h module)
 {
        int ret = RECORDER_ERROR_NONE;
+       int client_fd = -1;
        muse_recorder_api_e api = MUSE_RECORDER_API_START;
        muse_recorder_api_class_e class = MUSE_RECORDER_API_CLASS_IMMEDIATE;
        muse_recorder_handle_s *muse_recorder = NULL;
@@ -788,6 +779,15 @@ int recorder_dispatcher_start(muse_module_h module)
                return MUSE_RECORDER_ERROR_NONE;
        }
 
+       /* privilege check */
+       client_fd = muse_core_client_get_msg_fd(module);
+       if (!muse_core_security_check_cynara(client_fd, RECORDER_PRIVILEGE_NAME)) {
+               LOGE("security check failed");
+               ret = RECORDER_ERROR_PERMISSION_DENIED;
+               muse_recorder_msg_return(api, class, ret, module);
+               return MUSE_RECORDER_ERROR_INVALID;
+       }
+
        ret = legacy_recorder_start(muse_recorder->recorder_handle);
 
        muse_recorder_msg_return(api, class, ret, module);
index f86821f..d62f9d8 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mmsvc-recorder
 Summary:    A Recorder module for muse server
-Version:    0.2.41
+Version:    0.3.0
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0