Apply tizen 3.0 security infrastructure. 34/37634/6 accepted/tizen/common/20150414.100143 accepted/tizen/mobile/20150415.015122 accepted/tizen/tv/20150415.012644 accepted/tizen/wearable/20150415.013854 submit/tizen/20150414.040541
authorJiwoong Im <jiwoong.im@samsung.com>
Wed, 1 Apr 2015 11:47:06 +0000 (20:47 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Mon, 6 Apr 2015 08:51:39 +0000 (17:51 +0900)
- Remove security-server dependency.
- Modify dbus service configuration file to check privilege in D-bus daemon.
- Add missing privilege checks.

Change-Id: I9d08cc2a7233b2215fc273c320521ef288bc9a9c
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
alarm-lib-stub.c
alarm-manager.c
alarm_mgr.xml
configure.ac
packaging/alarm-manager.spec
packaging/alarm-service.conf

index b5bfdf9..19616dd 100755 (executable)
@@ -33,7 +33,6 @@
 #include "alarm.h"
 #include "alarm-internal.h"
 #include "alarm-stub.h"
-#include "security-server.h"
 
 #define ALARM_SERVICE_NAME     "appframework.alarm"
 #define ALARM_OBJECT_PATH      "/appframework/alarm"
@@ -70,47 +69,15 @@ bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info
        GError *error = NULL;
        int return_code = 0;
 
-       char cookie[256] = {0,};
-       char *e_cookie = NULL;
-       int size = 0;
-       int retval = 0;
-
        bundle_raw *b_data = NULL;
        int datalen = 0;
 
-       size = security_server_get_cookie_size();
-       retval = security_server_request_cookie(cookie, size);
-
-       if (retval < 0) {
-               ALARM_MGR_EXCEPTION_PRINT(
-                       "security_server_request_cookie failed\n");
-               if (error_code)
-                       *error_code = -1;       /* TODO: Need to redefine error codes */
-               return false;
-       }
-
-       e_cookie = g_base64_encode((const guchar *)cookie, size);
-
-       if (NULL == e_cookie)
-       {
-               ALARM_MGR_EXCEPTION_PRINT(
-                       "g_base64_encode failed\n");
-               if (error_code)
-                       *error_code = -1;       /* TODO: Need to redefine error codes */
-               return false;
-       }
-
        if (bundle_encode(b, &b_data, &datalen))
        {
                ALARM_MGR_EXCEPTION_PRINT("Unable to encode the bundle data\n");
                if (error_code){
                        *error_code = -1;       /* TODO: Need to redefine error codes*/
                }
-               if (e_cookie)
-               {
-                       g_free(e_cookie);
-                       e_cookie = NULL;
-               }
                return false;
        }
 
@@ -128,7 +95,7 @@ bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info
                                                    alarm_info->mode.repeat,
                                                    alarm_info->alarm_type,
                                                    alarm_info->reserved_info,
-                                                   (char *)b_data, e_cookie,
+                                                   (char *)b_data,
                                                    alarm_id, &return_code,
                                                    &error)) {
                /* dbus-glib error */
@@ -140,12 +107,6 @@ bool _send_alarm_create_appsvc(alarm_context_t context, alarm_info_t *alarm_info
                                          error->message);
        }
 
-       if (e_cookie)
-       {
-               g_free(e_cookie);
-               e_cookie = NULL;
-       }
-
        if (b_data)
        {
                free(b_data);
@@ -170,11 +131,6 @@ bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
        GError *error = NULL;
        int return_code = 0;
 
-       char cookie[256];
-       char *e_cookie;
-       int size;
-       int retval;
-
        /*TODO: Dbus bus name validation is must & will be added to avoid alarm-server crash*/
        if (g_quark_to_string(context.quark_app_service_name) == NULL
                && strlen(dst_service_name) == 4
@@ -185,17 +141,6 @@ bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
                return false;
        }
 
-       size = security_server_get_cookie_size();
-       retval = security_server_request_cookie(cookie, size);
-
-       if (retval < 0) {
-               ALARM_MGR_EXCEPTION_PRINT(
-                       "security_server_request_cookie failed\n");
-               return false;
-       }
-
-       e_cookie = g_base64_encode((const guchar *)cookie, size);
-
        if (!org_tizen_alarm_manager_alarm_create(context.proxy, context.pid,
                        g_quark_to_string(context.quark_app_service_name),
                        g_quark_to_string(context.quark_app_service_name_mod),
@@ -212,7 +157,7 @@ bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
                                                    alarm_info->mode.repeat,
                                                    alarm_info->alarm_type,
                                                    alarm_info->reserved_info,
-                                                   dst_service_name, dst_service_name_mod, e_cookie,
+                                                   dst_service_name, dst_service_name_mod,
                                                    alarm_id, &return_code,
                                                    &error)) {
                /* dbus-glib error */
@@ -228,8 +173,6 @@ bool _send_alarm_create(alarm_context_t context, alarm_info_t *alarm_info,
                return false;
        }
 
-       g_free(e_cookie);
-
        if (return_code != 0) {
                if (error_code)
                        *error_code = return_code;
@@ -245,39 +188,11 @@ bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id
 
        bundle *b = NULL;
 
-       char cookie[256] = {0,};
-       char *e_cookie = NULL;
-       int size = 0;
-       int retval = 0;
-
        gchar *b_data = NULL;
        int len = 0;
 
-       size = security_server_get_cookie_size();
-       retval = security_server_request_cookie(cookie, size);
-
-       if (retval < 0) {
-               ALARM_MGR_EXCEPTION_PRINT(
-                       "security_server_request_cookie failed\n");
-               if (error_code)
-                       *error_code = -1; /*TODO: define error*/
-               return NULL;
-       }
-
-       e_cookie = g_base64_encode((const guchar *)cookie, size);
-
-       if (NULL == e_cookie)
-       {
-               ALARM_MGR_EXCEPTION_PRINT(
-                       "g_base64_encode failed\n");
-               if (error_code)
-                       *error_code = -1; /*TODO: define error*/
-               return NULL;
-       }
-
-
        if (!org_tizen_alarm_manager_alarm_get_appsvc_info
-           (context.proxy, context.pid, alarm_id, e_cookie, &b_data, &return_code, &error)) {
+           (context.proxy, context.pid, alarm_id, &b_data, &return_code, &error)) {
                /* dbus-glib error */
                /*error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT(
@@ -286,8 +201,6 @@ bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id
                if (error_code)
                        *error_code = ERR_ALARM_SYSTEM_FAIL; /*-1 means that system
                                                                failed internally.*/
-               if (e_cookie)
-                       g_free(e_cookie);
                if (b_data)
                        g_free(b_data);
 
@@ -301,8 +214,6 @@ bundle *_send_alarm_get_appsvc_info(alarm_context_t context, alarm_id_t alarm_id
                b = bundle_decode((bundle_raw *)b_data, len);
        }
 
-       if (e_cookie)
-               g_free(e_cookie);
        if (b_data)
                g_free(b_data);
 
@@ -315,56 +226,21 @@ bool _send_alarm_set_rtc_time(alarm_context_t context, alarm_date_t *time, int *
        GError *error = NULL;
        int return_code = 0;
 
-       char cookie[256] = {0,};
-       char *e_cookie = NULL;
-       int size = 0;
-       int retval = 0;
-
-       size = security_server_get_cookie_size();
-       retval = security_server_request_cookie(cookie, size);
-
-       if (retval < 0) {
-               ALARM_MGR_EXCEPTION_PRINT(
-                       "security_server_request_cookie failed\n");
-               if (error_code)
-                       *error_code = -1; /*TODO: define error*/
-               return false;
-       }
-
-       e_cookie = g_base64_encode((const guchar *)cookie, size);
-
-       if (NULL == e_cookie)
-       {
-               ALARM_MGR_EXCEPTION_PRINT(
-                       "g_base64_encode failed\n");
-               if (error_code)
-                       *error_code = -1; /*TODO: define error*/
-               return false;
-       }
-
        if (!org_tizen_alarm_manager_alarm_set_rtc_time
-           (context.proxy, context.pid,
-               time->year, time->month, time->day,
-                time->hour, time->min, time->sec,
-                 e_cookie, &return_code, &error)) {
+                       (context.proxy, context.pid,
+                        time->year, time->month, time->day,
+                        time->hour, time->min, time->sec,
+                        &return_code, &error)) {
                /* dbus-glib error */
                /*error_code should be set */
                ALARM_MGR_EXCEPTION_PRINT(
-               "org_tizen_alarm_manager_alarm_set_rtc_time() failed. "
-                    "return_code[%d]\n", return_code);
+                               "org_tizen_alarm_manager_alarm_set_rtc_time() failed. "
+                               "return_code[%d]\n", return_code);
                if (error_code)
                        *error_code = ERR_ALARM_SYSTEM_FAIL; /*-1 means that system
-                                                               failed internally.*/
-               if (e_cookie)
-                       g_free(e_cookie);
-
+                                                                                   failed internally.*/
                return false;
        }
-       if (e_cookie)
-       {
-               g_free(e_cookie);
-               e_cookie = NULL;
-       }
 
        if (return_code != 0) {
                if (error_code)
@@ -382,24 +258,8 @@ bool _send_alarm_delete(alarm_context_t context, alarm_id_t alarm_id,
        GError *error = NULL;
        int return_code = 0;
 
-       char cookie[256];
-       char *e_cookie;
-       int size;
-       int retval;
-
-       size = security_server_get_cookie_size();
-       retval = security_server_request_cookie(cookie, size);
-
-       if (retval < 0) {
-               ALARM_MGR_EXCEPTION_PRINT(
-                       "security_server_request_cookie failed\n");
-               return false;
-       }
-
-       e_cookie = g_base64_encode((const guchar *)cookie, size);
-
        if (!org_tizen_alarm_manager_alarm_delete
-           (context.proxy, context.pid, alarm_id, e_cookie, &return_code,
+           (context.proxy, context.pid, alarm_id, &return_code,
             &error)) {
                /* dbus-glib error */
                /*error_code should be set */
@@ -413,8 +273,6 @@ bool _send_alarm_delete(alarm_context_t context, alarm_id_t alarm_id,
                return false;
        }
 
-       g_free(e_cookie);
-
        if (return_code != 0) {
                if (error_code)
                        *error_code = return_code;
index 17fc3a6..56a519a 100644 (file)
@@ -50,7 +50,6 @@
 #include <aul.h>
 #include <bundle.h>
 #include <heynoti.h>
-#include <security-server.h>
 #include <db-util.h>
 #include <vconf.h>
 #include <vconf-keys.h>
@@ -1821,10 +1820,8 @@ this value to 0(zero)
 
 gboolean alarm_manager_alarm_set_rtc_time(void *pObject, int pid,
                                int year, int mon, int day,
-                               int hour, int min, int sec, char *e_cookie,
+                               int hour, int min, int sec,
                                int *return_code){
-       guchar *cookie = NULL;
-       gsize size;
        int retval = 0;
        gboolean result = true;
 
@@ -1840,108 +1837,76 @@ gboolean alarm_manager_alarm_set_rtc_time(void *pObject, int pid,
                *return_code = ALARMMGR_RESULT_SUCCESS;
        }
 
-       cookie = g_base64_decode(e_cookie, &size);
-       if (NULL == cookie)
-       {
+       /*extract day of the week, day in the year &
+         daylight saving time from system*/
+       time_t ctime;
+       ctime = time(NULL);
+       alarm_tm = localtime(&ctime);
+
+       alarm_tm->tm_year = year;
+       alarm_tm->tm_mon = mon;
+       alarm_tm->tm_mday = day;
+       alarm_tm->tm_hour = hour;
+       alarm_tm->tm_min = min;
+       alarm_tm->tm_sec = sec;
+
+       /*convert to calendar time representation*/
+       time_t rtc_time = mktime(alarm_tm);
+
+       /*convert to Coordinated Universal Time (UTC)*/
+       gmtime_r(&rtc_time, &due_tm);
+
+       fd = open(rtc, O_RDONLY);
+       if (fd == -1) {
+               ALARM_MGR_EXCEPTION_PRINT("RTC open failed.\n");
                if (return_code)
-                       *return_code = ERR_ALARM_NO_PERMISSION;
-               ALARM_MGR_EXCEPTION_PRINT("Unable to decode cookie!!!\n");
-               return true;
+                       *return_code = ERR_ALARM_SYSTEM_FAIL;
+               return result;
        }
 
-       retval = security_server_check_privilege_by_cookie((const char *)cookie, "alarm-manager::alarm", "w");
-       if (retval < 0) {
-               if (retval == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
-                       ALARM_MGR_EXCEPTION_PRINT(
-                               "%s", "Write access has been denied by smack\n");
-               }
-#ifdef __ALLOW_NO_PRIVILEGE
-               ALARM_MGR_EXCEPTION_PRINT("Error has occurred in security_server_check_privilege()\n");
+       /* Read the RTC time/date */
+       retval = ioctl(fd, RTC_RD_TIME, &rtc_tm);
+       if (retval == -1) {
+               ALARM_MGR_EXCEPTION_PRINT("RTC_RD_TIME ioctl failed");
+               close(fd);
                if (return_code)
-                       *return_code = ERR_ALARM_NO_PERMISSION;
-#endif
+                       *return_code = ERR_ALARM_SYSTEM_FAIL;
+               return result;
        }
-#ifdef __ALLOW_NO_PRIVILEGE
-       else
-#endif
-       {
-
-               /*extract day of the week, day in the year &
-               daylight saving time from system*/
-               time_t ctime;
-               ctime = time(NULL);
-               alarm_tm = localtime(&ctime);
 
-               alarm_tm->tm_year = year;
-               alarm_tm->tm_mon = mon;
-               alarm_tm->tm_mday = day;
-               alarm_tm->tm_hour = hour;
-               alarm_tm->tm_min = min;
-               alarm_tm->tm_sec = sec;
+       rtc_tm.tm_mday = due_tm.tm_mday;
+       rtc_tm.tm_mon = due_tm.tm_mon;
+       rtc_tm.tm_year = due_tm.tm_year;
+       rtc_tm.tm_hour = due_tm.tm_hour;
+       rtc_tm.tm_min = due_tm.tm_min;
+       rtc_tm.tm_sec = due_tm.tm_sec;
 
-               /*convert to calendar time representation*/
-               time_t rtc_time = mktime(alarm_tm);
+       memcpy(&rtc_wk.time, &rtc_tm, sizeof(rtc_tm));
 
-               /*convert to Coordinated Universal Time (UTC)*/
-               gmtime_r(&rtc_time, &due_tm);
+       rtc_wk.enabled = 1;
+       rtc_wk.pending = 0;
 
-               fd = open(rtc, O_RDONLY);
-               if (fd == -1) {
-                       ALARM_MGR_EXCEPTION_PRINT("RTC open failed.\n");
-                       if (return_code)
-                               *return_code = ERR_ALARM_SYSTEM_FAIL;
-                       return result;
-               }
-
-               /* Read the RTC time/date */
-               retval = ioctl(fd, RTC_RD_TIME, &rtc_tm);
-               if (retval == -1) {
-                       ALARM_MGR_EXCEPTION_PRINT("RTC_RD_TIME ioctl failed");
-                       close(fd);
-                       if (return_code)
-                               *return_code = ERR_ALARM_SYSTEM_FAIL;
-                       return result;
+       retval = ioctl(fd, RTC_WKALM_BOOT_SET, &rtc_wk);
+       if (retval == -1) {
+               if (errno == ENOTTY) {
+                       ALARM_MGR_EXCEPTION_PRINT("\nAlarm IRQs not"
+                                       "supported.\n");
                }
-
-               rtc_tm.tm_mday = due_tm.tm_mday;
-               rtc_tm.tm_mon = due_tm.tm_mon;
-               rtc_tm.tm_year = due_tm.tm_year;
-               rtc_tm.tm_hour = due_tm.tm_hour;
-               rtc_tm.tm_min = due_tm.tm_min;
-               rtc_tm.tm_sec = due_tm.tm_sec;
-
-               memcpy(&rtc_wk.time, &rtc_tm, sizeof(rtc_tm));
-
-               rtc_wk.enabled = 1;
-               rtc_wk.pending = 0;
-
-               retval = ioctl(fd, RTC_WKALM_BOOT_SET, &rtc_wk);
+               ALARM_MGR_EXCEPTION_PRINT("RTC_ALM_SET ioctl");
+               close(fd);
+               if (return_code)
+                       *return_code = ERR_ALARM_SYSTEM_FAIL;
+       }
+       else{
+               ALARM_MGR_LOG_PRINT("[alarm-server]RTC alarm is setted");
+               /* Enable alarm interrupts */
+               retval = ioctl(fd, RTC_AIE_ON, 0);
                if (retval == -1) {
-                       if (errno == ENOTTY) {
-                               ALARM_MGR_EXCEPTION_PRINT("\nAlarm IRQs not"
-                                                         "supported.\n");
-                       }
-                       ALARM_MGR_EXCEPTION_PRINT("RTC_ALM_SET ioctl");
-                       close(fd);
+                       ALARM_MGR_EXCEPTION_PRINT("RTC_AIE_ON ioctl failed");
                        if (return_code)
                                *return_code = ERR_ALARM_SYSTEM_FAIL;
                }
-               else{
-                       ALARM_MGR_LOG_PRINT("[alarm-server]RTC alarm is setted");
-                       /* Enable alarm interrupts */
-                       retval = ioctl(fd, RTC_AIE_ON, 0);
-                       if (retval == -1) {
-                               ALARM_MGR_EXCEPTION_PRINT("RTC_AIE_ON ioctl failed");
-                               if (return_code)
-                                       *return_code = ERR_ALARM_SYSTEM_FAIL;
-                       }
-                       close(fd);
-               }
-       }
-
-       if (cookie){
-               g_free(cookie);
-               cookie = NULL;
+               close(fd);
        }
 
        return result;
@@ -1956,13 +1921,9 @@ gboolean alarm_manager_alarm_create_appsvc(void *pObject, int pid,
                                    int end_day, int mode_day_of_week,
                                    int mode_repeat, int alarm_type,
                                    int reserved_info,
-                                   char *bundle_data, char *e_cookie,
-                                   int *alarm_id, int *return_code)
+                                   char *bundle_data, int *alarm_id, int *return_code)
 {
        alarm_info_t alarm_info;
-       guchar *cookie = NULL;
-       gsize size;
-       int retval = 0;
        gboolean result = true;
 
        alarm_info.start.year = start_year;
@@ -1984,41 +1945,11 @@ gboolean alarm_manager_alarm_create_appsvc(void *pObject, int pid,
 
        *return_code = 0;
 
-       cookie = g_base64_decode(e_cookie, &size);
-       if (NULL == cookie)
+       result = __alarm_create_appsvc(&alarm_info, alarm_id, pid,
+                       bundle_data, return_code);
+       if (false == result)
        {
-               *return_code = -1;
-               ALARM_MGR_EXCEPTION_PRINT("Unable to decode cookie!!!\n");
-               return false;
-       }
-
-       retval = security_server_check_privilege_by_cookie((const char *)cookie, "alarm-manager::alarm", "w");
-       if (retval < 0) {
-               if (retval == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
-                       ALARM_MGR_EXCEPTION_PRINT(
-                               "%s", "Write access has been denied by smack\n");
-               }
-#ifdef __ALLOW_NO_PRIVILEGE
-               ALARM_MGR_EXCEPTION_PRINT("Error has occurred in security_server_check_privilege()\n");
-               *return_code = -1;
-               result = false;
-#endif
-       }
-#ifdef __ALLOW_NO_PRIVILEGE
-       else
-#endif
-       {
-               result = __alarm_create_appsvc(&alarm_info, alarm_id, pid,
-                              bundle_data, return_code);
-               if (false == result)
-               {
-                       ALARM_MGR_EXCEPTION_PRINT("Unable to create alarm!\n");
-               }
-       }
-
-       if (cookie){
-               g_free(cookie);
-               cookie = NULL;
+               ALARM_MGR_EXCEPTION_PRINT("Unable to create alarm!\n");
        }
 
        return result;
@@ -2032,13 +1963,10 @@ gboolean alarm_manager_alarm_create(void *pObject, int pid,
                                    int end_day, int mode_day_of_week,
                                    int mode_repeat, int alarm_type,
                                    int reserved_info,
-                                   char *reserved_service_name, char *reserved_service_name_mod, char *e_cookie,
+                                   char *reserved_service_name, char *reserved_service_name_mod,
                                    int *alarm_id, int *return_code)
 {
        alarm_info_t alarm_info;
-       guchar *cookie;
-       gsize size;
-       int retval;
 
        alarm_info.start.year = start_year;
        alarm_info.start.month = start_month;
@@ -2059,63 +1987,17 @@ gboolean alarm_manager_alarm_create(void *pObject, int pid,
 
        *return_code = 0;
 
-       cookie = g_base64_decode(e_cookie, &size);
-
-       retval = security_server_check_privilege_by_cookie((const char *)cookie, "alarm-manager::alarm", "w");
-       if (retval < 0) {
-               if (retval == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
-                       ALARM_MGR_EXCEPTION_PRINT(
-                               "%s", "Write access has been denied by smack\n");
-               }
-#ifdef __ALLOW_NO_PRIVILEGE
-               ALARM_MGR_EXCEPTION_PRINT("%s", "Error has occurred\n");
-
-               *return_code = -1;
-#endif
-       }
-#ifdef __ALLOW_NO_PRIVILEGE
-       else
-#endif
-       {
-               /* return valule and return_code should be checked */
-               __alarm_create(&alarm_info, alarm_id, pid, app_service_name,app_service_name_mod,
-                              reserved_service_name, reserved_service_name_mod, return_code);
-       }
-
-       g_free(cookie);
+       /* return valule and return_code should be checked */
+       __alarm_create(&alarm_info, alarm_id, pid, app_service_name,app_service_name_mod,
+                       reserved_service_name, reserved_service_name_mod, return_code);
 
        return true;
 }
 
 gboolean alarm_manager_alarm_delete(void *pObject, int pid, alarm_id_t alarm_id,
-                                   char *e_cookie, int *return_code)
+                                   int *return_code)
 {
-       guchar *cookie;
-       gsize size;
-       int retval;
-
-       cookie = g_base64_decode(e_cookie, &size);
-
-       retval = security_server_check_privilege_by_cookie((const char *)cookie, "alarm-manager::alarm", "w");
-       if (retval < 0) {
-               if (retval == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
-                       ALARM_MGR_EXCEPTION_PRINT(
-                               "%s", "Write access has been denied by smack\n");
-               }
-#ifdef __ALLOW_NO_PRIVILEGE
-               ALARM_MGR_EXCEPTION_PRINT("%s", "Error has occurred\n");
-
-               *return_code = -1;
-#endif
-       }
-#ifdef __ALLOW_NO_PRIVILEGE
-       else
-#endif
-       {
-               __alarm_delete(pid, alarm_id, return_code);
-       }
-
-       g_free(cookie);
+       __alarm_delete(pid, alarm_id, return_code);
 
        return true;
 }
@@ -2366,48 +2248,16 @@ gboolean alarm_manager_alarm_get_list_of_ids(void *pObject, int pid,
 }
 
 gboolean alarm_manager_alarm_get_appsvc_info(void *pObject, int pid, alarm_id_t alarm_id,
-                               char *e_cookie, gchar **b_data, int *return_code)
+                               gchar **b_data, int *return_code)
 {
        bool found = false;
 
        GSList *gs_iter = NULL;
        __alarm_info_t *entry = NULL;
 
-       guchar *cookie = NULL;
-       gsize size;
-       int retval = 0;
-
        ALARM_MGR_LOG_PRINT("called for  pid(%d) and alarm_id(%d)\n", pid,
                            alarm_id);
 
-       cookie = g_base64_decode(e_cookie, &size);
-       if (NULL == cookie)
-       {
-               if (return_code)
-                       *return_code = ERR_ALARM_SYSTEM_FAIL;
-               ALARM_MGR_EXCEPTION_PRINT("Unable to decode cookie!!!\n");
-               return true;
-       }
-
-       retval = security_server_check_privilege_by_cookie((const char *)cookie, "alarm-manager::alarm", "r");
-       if (retval < 0) {
-               if (retval == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
-                       ALARM_MGR_EXCEPTION_PRINT(
-                               "%s", "Read access has been denied by smack\n");
-               }
-#ifdef __ALLOW_NO_PRIVILEGE
-               ALARM_MGR_EXCEPTION_PRINT("%s", "Error has occurred\n");
-
-               if (return_code)
-                       *return_code = ERR_ALARM_NO_PERMISSION;
-
-               if (cookie)
-                       g_free(cookie);
-
-               return true;
-#endif
-       }
-
        if (return_code)
                *return_code = 0;
 
@@ -2432,9 +2282,6 @@ gboolean alarm_manager_alarm_get_appsvc_info(void *pObject, int pid, alarm_id_t
                        *return_code = ERR_ALARM_INVALID_ID;
        }
 
-       if (cookie)
-               g_free(cookie);
-
        return true;
 }
 
index 6641ac0..fd12e72 100755 (executable)
@@ -20,7 +20,6 @@
       <arg type="i" name="alarm_info_reserved_info" direction="in" />
       <arg type="s" name="alarm_info_reserved_service_name" direction="in" />
       <arg type="s" name="alarm_info_reserved_service_name_mod" direction="in" />
-      <arg type="s" name="cookie" direction="in" />
       <arg type="i" name="alarm_id" direction="out" />
       <arg type="i" name="return_code" direction="out" />
     </method>
       <arg type="i" name="alarm_info_alarm_type" direction="in" />
       <arg type="i" name="alarm_info_reserved_info" direction="in" />
       <arg type="s" name="alarm_info_bundle_data" direction="in" />
-      <arg type="s" name="cookie" direction="in" />
       <arg type="i" name="alarm_id" direction="out" />
       <arg type="i" name="return_code" direction="out" />
     </method>
        <method name="alarm_delete">
       <arg type="i" name="pid" direction="in" />
       <arg type="i" name="alarm_id" direction="in" />
-      <arg type="s" name="cookie" direction="in" />
       <arg type="i" name="alarm_info_return_code" direction="out" />
     </method>
        <method name="alarm_power_on">
@@ -97,7 +94,6 @@
        <method name="alarm_get_appsvc_info">
          <arg type="i" name="pid" direction="in" />
          <arg type="i" name="alarm_id" direction="in" />
-         <arg type="s" name="cookie" direction="in" />
          <arg type="s" name="b_data" direction="out" />
          <arg type="i" name="return_code" direction="out" />
     </method>
       <arg type="i" name="alarm_info_hour" direction="in" />
       <arg type="i" name="alarm_info_min" direction="in" />
       <arg type="i" name="alarm_info_sec" direction="in" />
-      <arg type="s" name="cookie" direction="in" />
       <arg type="i" name="return_code" direction="out" />
     </method>
        <method name="alarm_get_next_duetime">
index 7d11b8e..f43f876 100644 (file)
@@ -35,11 +35,11 @@ AC_SUBST(ALARM_CFLAGS)
 
 dnl AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
 # Checks for libraries.
-PKG_CHECK_MODULES(ALARM_MANAGER, dbus-1 glib-2.0 dbus-glib-1 gobject-2.0 dlog security-server bundle appsvc libtzplatform-config)
+PKG_CHECK_MODULES(ALARM_MANAGER, dbus-1 glib-2.0 dbus-glib-1 gobject-2.0 dlog bundle appsvc libtzplatform-config)
 AC_SUBST(ALARM_MANAGER_CFLAGS)
 AC_SUBST(ALARM_MANAGER_LIBS)
 
-PKG_CHECK_MODULES(ALARM_MANAGER_SERVER, dbus-1 glib-2.0 dbus-glib-1 pmapi dlog heynoti aul bundle security-server db-util appsvc libtzplatform-config)
+PKG_CHECK_MODULES(ALARM_MANAGER_SERVER, dbus-1 glib-2.0 dbus-glib-1 pmapi dlog heynoti aul bundle db-util appsvc libtzplatform-config)
 AC_SUBST(ALARM_MANAGER_SERVER_CFLAGS)
 AC_SUBST(ALARM_MANAGER_SERVER_LIBS)
 
index 4713f6d..c670c8d 100644 (file)
@@ -20,7 +20,6 @@ BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(heynoti)
 BuildRequires:  pkgconfig(pmapi)
-BuildRequires:  pkgconfig(security-server)
 BuildRequires:  pkgconfig(tapi)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(libtzplatform-config)
index 7be10c6..be9bc5a 100644 (file)
@@ -6,7 +6,47 @@
         <allow send_destination="org.tizen.alarm.manager"/>
         <allow send_interface="org.tizen.alarm.manager"/>
     </policy>
-    <policy at_console="true">
-        <allow send_destination="org.tizen.alarm.manager"/>
+    <policy context="default">
+        <allow send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager"/>
+        <check send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager" send_member="alarm_set_rtc_time"
+         privilege="http://tizen.org/privilege/alarm.set"/>
+        <check send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager" send_member="alarm_create"
+         privilege="http://tizen.org/privilege/alarm.set"/>
+        <check send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager" send_member="alarm_create_appsvc"
+         privilege="http://tizen.org/privilege/alarm.set"/>
+        <check send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager" send_member="alarm_delete"
+         privilege="http://tizen.org/privilege/alarm.set"/>
+        <check send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager" send_member="alarm_power_on"
+         privilege="http://tizen.org/privilege/alarm.set"/>
+        <check send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager" send_member="alarm_power_off"
+         privilege="http://tizen.org/privilege/alarm.set"/>
+        <check send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager" send_member="alarm_update"
+         privilege="http://tizen.org/privilege/alarm.set"/>
+        <check send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager" send_member="alarm_get_number_of_ids"
+         privilege="http://tizen.org/privilege/alarm.get"/>
+        <check send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager" send_member="alarm_get_list_of_ids"
+         privilege="http://tizen.org/privilege/alarm.get"/>
+        <check send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager" send_member="alarm_check_next_duetime"
+         privilege="http://tizen.org/privilege/alarm.get"/>
+        <check send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager" send_member="alarm_get_appsvc_info"
+         privilege="http://tizen.org/privilege/alarm.get"/>
+        <check send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager" send_member="alarm_get_info"
+         privilege="http://tizen.org/privilege/alarm.get"/>
+        <check send_destination="org.tizen.alarm.manager"
+         send_interface="org.tizen.alarm.manager" send_member="alarm_get_next_duetime"
+         privilege="http://tizen.org/privilege/alarm.get"/>
     </policy>
 </busconfig>