summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-06-30 01:19:10 (GMT)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>2013-07-01 12:16:41 (GMT)
commit4a25d9bf38f72a387ab08002739d4ae267ddfd78 (patch)
treef59ca1ebe47131c9d65894e116aecd38c724e255
parent4886579a45917100ee89bced541dcb2ef246386a (diff)
downloaddata-provider-master-4a25d9bf38f72a387ab08002739d4ae267ddfd78.zip
data-provider-master-4a25d9bf38f72a387ab08002739d4ae267ddfd78.tar.gz
data-provider-master-4a25d9bf38f72a387ab08002739d4ae267ddfd78.tar.bz2
Validate the user level smack rule for shortcut
Change-Id: I8f01b121415b0b1537df2dcd4b93de22292c7ae3
-rw-r--r--CMakeLists.txt1
-rw-r--r--packaging/data-provider-master.spec3
-rw-r--r--src/shortcut_service.c22
3 files changed, 25 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4264e32..d5c7722 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -31,6 +31,7 @@ pkg_check_modules(pkg REQUIRED
notification
badge
libsmack
+ shortcut
)
SET(PACKAGE "${PROJECT_NAME}")
diff --git a/packaging/data-provider-master.spec b/packaging/data-provider-master.spec
index 0f03aaf..fd1283f 100644
--- a/packaging/data-provider-master.spec
+++ b/packaging/data-provider-master.spec
@@ -1,6 +1,6 @@
Name: data-provider-master
Summary: Master service provider for liveboxes.
-Version: 0.24.14
+Version: 0.24.15
Release: 1
Group: HomeTF/Livebox
License: Flora License
@@ -35,6 +35,7 @@ BuildRequires: pkgconfig(pkgmgr)
BuildRequires: pkgconfig(livebox-service)
BuildRequires: pkgconfig(notification)
BuildRequires: pkgconfig(badge)
+BuildRequires: pkgconfig(shortcut)
BuildRequires: pkgconfig(security-server)
Requires(post): sys-assert
Requires(post): dbus
diff --git a/src/shortcut_service.c b/src/shortcut_service.c
index 14f840c..82408a3 100644
--- a/src/shortcut_service.c
+++ b/src/shortcut_service.c
@@ -25,6 +25,7 @@
#include <sys/smack.h>
#include <security-server.h>
+#include <shortcut.h>
#include "service_common.h"
#include "debug.h"
@@ -88,6 +89,22 @@ static inline struct tcb *get_reply_context(double seq)
return tcb;
}
+static inline void send_reply_packet(struct tcb *tcb, struct packet *packet, int ret)
+{
+ struct packet *reply_packet;
+
+ reply_packet = packet_create_reply(packet, "i", ret);
+ if (!reply_packet) {
+ ErrPrint("Failed to create a packet\n");
+ return;
+ }
+
+ if (service_common_unicast_packet(tcb, reply_packet) < 0)
+ ErrPrint("Unable to send reply packet\n");
+
+ packet_destroy(reply_packet);
+}
+
/*!
* SERVICE THREAD
*/
@@ -116,11 +133,16 @@ static int service_thread_main(struct tcb *tcb, struct packet *packet, void *dat
ret = security_server_check_privilege_by_sockfd(tcb_fd(tcb), "data-provider-master::shortcut.livebox", "w");
if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
ErrPrint("SMACK:Access denied\n");
+ send_reply_packet(tcb, packet, SHORTCUT_ERROR_PERMISSION);
+ break;
}
+
} else if (!strcmp(command, "add_shortcut") || !strcmp(command, "rm_shortcut")) {
ret = security_server_check_privilege_by_sockfd(tcb_fd(tcb), "data-provider-master::shortcut.shortcut", "w");
if (ret == SECURITY_SERVER_API_ERROR_ACCESS_DENIED) {
ErrPrint("SMACK:Access denied\n");
+ send_reply_packet(tcb, packet, SHORTCUT_ERROR_PERMISSION);
+ break;
}
}