Remove direct access to /proc/xxx/attr/current 73/319173/1 tizen
authorDohyun Pyun <dh79.pyun@samsung.com>
Wed, 5 Feb 2025 02:47:42 +0000 (11:47 +0900)
committerDohyun Pyun <dh79.pyun@samsung.com>
Wed, 5 Feb 2025 02:47:42 +0000 (11:47 +0900)
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 <dh79.pyun@samsung.com>
src/ic-utils.c

index fdaef06fa400d3ef5300b2c8295675e4c1ebb28b..10c8db549aeefe21f28757bc08c9edb278ca882c 100644 (file)
@@ -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;
 }