summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortaeyoung <ty317.kim@samsung.com>2017-01-23 17:39:13 +0900
committerTaeyoung Kim <ty317.kim@samsung.com>2017-02-15 17:35:46 -0800
commit67bb6ca1b0ad8ed65240879eb558045dfee6ae31 (patch)
treec882ecb827812ee4f2a2ced7630d04c683ff7202
parent726aa99a5c47bef5624aea044d03b55167f9a137 (diff)
downloaddeviced-67bb6ca1b0ad8ed65240879eb558045dfee6ae31.tar.gz
deviced-67bb6ca1b0ad8ed65240879eb558045dfee6ae31.tar.bz2
deviced-67bb6ca1b0ad8ed65240879eb558045dfee6ae31.zip
power: fix the privilege of the reboot operation
Previously, the privilege of the reboot operation was "http://tizen.org/privilege/power" since the method is registered on the "org.tizen.system.deviced.power" interface. But the device_power_reboot() document of capi-system-device noticed that the operation requires "http://tizen.org/privilege/reboot" privilege. Now, the privilege of the reboot operation is changed to "http://tizen.org/privilege/reboot" according to the device_power_reboot(). For the change, the dbus method interface is changed to "org.tizen.system.deviced.reboot". Change-Id: I928fc35710f8713c74b84d0aa434fc60e084fc2c Signed-off-by: taeyoung <ty317.kim@samsung.com>
-rw-r--r--scripts/deviced.conf5
-rw-r--r--src/core/edbus-handler.c1
-rw-r--r--src/devicectl/devicectl.c3
-rwxr-xr-xsrc/deviced/dd-deviced.h20
-rw-r--r--src/libdeviced/deviced-noti.c12
-rw-r--r--src/power/power-handler.c2
-rwxr-xr-xsrc/shared/dbus.h3
7 files changed, 13 insertions, 33 deletions
diff --git a/scripts/deviced.conf b/scripts/deviced.conf
index c580132f..31bd840b 100644
--- a/scripts/deviced.conf
+++ b/scripts/deviced.conf
@@ -14,6 +14,8 @@
<deny send_destination="org.tizen.system.deviced"
send_interface="org.tizen.system.deviced.power"/>
<deny send_destination="org.tizen.system.deviced"
+ send_interface="org.tizen.system.deviced.reboot"/>
+ <deny send_destination="org.tizen.system.deviced"
send_interface="org.tizen.system.deviced.storage"/>
<deny send_destination="org.tizen.system.deviced"
send_interface="org.tizen.system.deviced.Led"/>
@@ -27,6 +29,9 @@
send_interface="org.tizen.system.deviced.power"
privilege="http://tizen.org/privilege/power"/>
<check send_destination="org.tizen.system.deviced"
+ send_interface="org.tizen.system.deviced.reboot"
+ privilege="http://tizen.org/privilege/reboot"/>
+ <check send_destination="org.tizen.system.deviced"
send_interface="org.tizen.system.deviced.storage"
privilege="http://tizen.org/privilege/externalstorage"/>
<check send_destination="org.tizen.system.deviced"
diff --git a/src/core/edbus-handler.c b/src/core/edbus-handler.c
index 94a590a6..dfd5d31e 100644
--- a/src/core/edbus-handler.c
+++ b/src/core/edbus-handler.c
@@ -50,6 +50,7 @@ static struct edbus_object {
{ DEVICED_PATH_CORE , DEVICED_INTERFACE_CORE , NULL, NULL },
{ DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, NULL, NULL },
{ DEVICED_PATH_POWER , DEVICED_INTERFACE_POWER , NULL, NULL },
+ { DEVICED_PATH_REBOOT , DEVICED_INTERFACE_REBOOT , NULL, NULL },
{ DEVICED_PATH_STORAGE, DEVICED_INTERFACE_STORAGE, NULL, NULL },
{ DEVICED_PATH_PROCESS, DEVICED_INTERFACE_PROCESS, NULL, NULL },
{ DEVICED_PATH_KEY , DEVICED_INTERFACE_KEY , NULL, NULL },
diff --git a/src/devicectl/devicectl.c b/src/devicectl/devicectl.c
index 8ede6587..4a8423a9 100644
--- a/src/devicectl/devicectl.c
+++ b/src/devicectl/devicectl.c
@@ -58,7 +58,7 @@ static const struct device {
{ DEVICE_PASS, "pass", DEVICED_PATH_PASS, DEVICED_INTERFACE_PASS },
{ DEVICE_USB, "usb", DEVICED_PATH_USB, DEVICED_INTERFACE_USB },
{ DEVICE_EXTCON, "extcon", DEVICED_PATH_EXTCON, DEVICED_INTERFACE_EXTCON },
- { DEVICE_POWER, "power", DEVICED_PATH_POWER, DEVICED_INTERFACE_POWER },
+ { DEVICE_POWER, "power", DEVICED_PATH_REBOOT, DEVICED_INTERFACE_REBOOT },
{ DEVICE_USB_HOST_TEST, "usb-host-test", DEVICED_PATH_USB_HOST_TEST, DEVICED_INTERFACE_USB_HOST_TEST},
};
@@ -314,6 +314,7 @@ static int power_operation(char **args, char *type)
return 0;
}
+
static int power_off(char **args)
{
return power_operation(args, "poweroff");
diff --git a/src/deviced/dd-deviced.h b/src/deviced/dd-deviced.h
index fd3f7e83..56531e36 100755
--- a/src/deviced/dd-deviced.h
+++ b/src/deviced/dd-deviced.h
@@ -285,26 +285,6 @@ int deviced_inform_inactive(pid_t pid);
int deviced_request_poweroff(void);
/**
- * @fn deviced_request_entersleep(void)
- * @brief This API call requests deviced daemon to enter system into sleep mode.
- * @return 0 or positive value on success and negative value if failed.
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_request_entersleep(void);
-
-/**
- * @fn int deviced_request_leavesleep(void)
- * @brief This API calls requests deviced daemon to leave by system "sleep" mode and enter into "normal" mode.
- * @return 0 or positive value on success and negative value if failed.
- * @retval -EBADMSG dbus error (in case of any error on the bus)
- * @retval -EINVAL no mandatory parameters
- * @retval -ESRCH incorrect sender process id
- */
-int deviced_request_leavesleep(void);
-
-/**
* @fn int deviced_request_reboot(void)
* @brief This API call requests deviced daemon to initiate system reboot.
* @return 0 on success and negative value if failed.
diff --git a/src/libdeviced/deviced-noti.c b/src/libdeviced/deviced-noti.c
index 45548ab0..3152bc60 100644
--- a/src/libdeviced/deviced-noti.c
+++ b/src/libdeviced/deviced-noti.c
@@ -255,7 +255,7 @@ static int dbus_power_handler(char* type)
pa[1] = "0";
msg = dbus_method_sync_with_reply(DEVICED_BUS_NAME,
- DEVICED_PATH_POWER, DEVICED_INTERFACE_POWER,
+ DEVICED_PATH_REBOOT, DEVICED_INTERFACE_REBOOT,
pa[0], "si", pa);
if (!msg)
return -EBADMSG;
@@ -280,16 +280,6 @@ API int deviced_request_poweroff(void)
return dbus_power_handler(PREDEF_PWROFF_POPUP);
}
-API int deviced_request_entersleep(void)
-{
- return dbus_power_handler(PREDEF_ENTERSLEEP);
-}
-
-API int deviced_request_leavesleep(void)
-{
- return dbus_power_handler(PREDEF_LEAVESLEEP);
-}
-
API int deviced_request_reboot(void)
{
return dbus_power_handler(PREDEF_REBOOT);
diff --git a/src/power/power-handler.c b/src/power/power-handler.c
index 4911a6bc..6e63f521 100644
--- a/src/power/power-handler.c
+++ b/src/power/power-handler.c
@@ -729,7 +729,7 @@ static void power_init(void *data)
int ret;
/* init dbus interface */
- ret = register_edbus_method(DEVICED_PATH_POWER,
+ ret = register_edbus_method(DEVICED_PATH_REBOOT,
edbus_methods, ARRAY_SIZE(edbus_methods));
if (ret < 0)
_E("fail to init edbus method(%d)", ret);
diff --git a/src/shared/dbus.h b/src/shared/dbus.h
index 74c44a0a..83d1e41a 100755
--- a/src/shared/dbus.h
+++ b/src/shared/dbus.h
@@ -60,6 +60,9 @@
/* Power service: set resetkey disable operations about power */
#define DEVICED_PATH_POWER DEVICED_OBJECT_PATH"/Power"
#define DEVICED_INTERFACE_POWER DEVICED_INTERFACE_NAME".power"
+/* Reboot service: request reboot operation */
+#define DEVICED_PATH_REBOOT DEVICED_OBJECT_PATH"/Reboot"
+#define DEVICED_INTERFACE_REBOOT DEVICED_INTERFACE_NAME".reboot"
/* Storage service: get storage size operatioins about storage */
#define DEVICED_PATH_STORAGE DEVICED_OBJECT_PATH"/Storage"
#define DEVICED_INTERFACE_STORAGE DEVICED_INTERFACE_NAME".storage"