From 463db8859785479b3fd67640f287b8f71edf4494 Mon Sep 17 00:00:00 2001 From: Dohyun Pyun Date: Wed, 5 Feb 2025 11:47:42 +0900 Subject: [PATCH] Remove direct access to /proc/xxx/attr/current Direct access to /proc/xxx/attr/current file is no longer permitted, so the relevant code has been removed. The function containing the code is now unused Change-Id: I57bae2d9ce17ea8d991138c110f066aaef2a0a4c Signed-off-by: Dohyun Pyun --- src/ic-utils.c | 55 -------------------------------------------------- 1 file changed, 55 deletions(-) diff --git a/src/ic-utils.c b/src/ic-utils.c index fdaef06..10c8db5 100644 --- a/src/ic-utils.c +++ b/src/ic-utils.c @@ -62,61 +62,6 @@ char* ic_utils_strdup(const char *src) bool ic_utils_check_permission(int permssion) { - static int has_network_permission = -1; - static int has_internet_permission = -1; - - if (-1 == has_internet_permission) { - int ret; - char smack_label[SMACK_LABEL_LEN + 1] = {0}; - char uid[10]; - FILE *fd; - cynara *cynara_h = NULL; - - ret = cynara_initialize(&cynara_h, NULL); - if (CYNARA_API_SUCCESS != ret) { - ERR("cynara_initialize() Fail(%d)", ret); - return false; - } - - fd = fopen("/proc/self/attr/current", "r"); - if (NULL == fd) { - ERR("fopen() Fail(%d)", errno); - return false; - } - - ret = fread(smack_label, sizeof(smack_label), 1, fd); - fclose(fd); - if (ret < 0) { - ERR("fread() Fail(%d)", ret); - return 0; - } - - snprintf(uid, sizeof(uid), "%d", getuid()); - - ret = cynara_check(cynara_h, smack_label, "", uid, IC_PRIVILEGE_INTERNET); - if (CYNARA_API_ACCESS_ALLOWED == ret) - has_internet_permission = 1; - else - has_internet_permission = 0; - - ret = cynara_check(cynara_h, smack_label, "", uid, IC_PRIVILEGE_NETWORK_GET); - if (CYNARA_API_ACCESS_ALLOWED == ret) - has_network_permission = 1; - else - has_network_permission = 0; - - cynara_finish(cynara_h); - } - - if ((IC_PERMISSION_NETWORK_GET & permssion) && (1 != has_network_permission)) { - ERR("Don't have http://tizen.org/privilege/network.get"); - return false; - } - if ((IC_PERMISSION_INTERNET & permssion) && (1 != has_internet_permission)) { - ERR("Don't have http://tizen.org/privilege/internet"); - return false; - } - return true; } -- 2.34.1