From db3e0a600a6ec4930a384a8809c20a09915afb08 Mon Sep 17 00:00:00 2001 From: Daehyeon Jung Date: Thu, 26 May 2016 12:42:55 +0900 Subject: [PATCH] Add privilege check Change-Id: Ib0ffbae1653aecabb329a3457ee00536debe249d Signed-off-by: Daehyeon Jung --- src/widget_service.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/widget_service.c b/src/widget_service.c index 77be756..126a884 100644 --- a/src/widget_service.c +++ b/src/widget_service.c @@ -1262,6 +1262,11 @@ EAPI char *widget_service_get_widget_id(const char *appid) return NULL; } + if (check_privilege("http://tizen.org/privilege/widget.viewer") < 0) { + set_last_result(WIDGET_ERROR_PERMISSION_DENIED); + return NULL; + } + classid = _get_widget_id(appid, getuid()); if (classid == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST) classid = _get_widget_id(appid, GLOBALAPP_USER); @@ -1331,6 +1336,11 @@ EAPI char *widget_service_get_package_id(const char *widget_id) return NULL; } + if (check_privilege("http://tizen.org/privilege/widget.viewer") < 0) { + set_last_result(WIDGET_ERROR_PERMISSION_DENIED); + return NULL; + } + pkgid = _get_package_id(widget_id, getuid()); if (pkgid == NULL && get_last_result() == WIDGET_ERROR_NOT_EXIST) pkgid = _get_package_id(widget_id, GLOBALAPP_USER); -- 2.34.1