[Common] Replace access to /proc/xxx/attr/current with cynara API 49/318049/1 accepted/tizen/unified/20250113.133509 accepted/tizen/unified/x/20250114.041828
authorPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Fri, 10 Jan 2025 16:03:08 +0000 (17:03 +0100)
committerPiotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics <p.kosko@samsung.com>
Fri, 10 Jan 2025 16:03:11 +0000 (17:03 +0100)
[Verification] Code compiles without errors.
TCT passrate on RPI4 auto tests - 100% for Tizen Web Device API.

Change-Id: Ifc41d55a310bd3f8f393d23ea189ef10f6c3d630

src/common/tools.cc

index bc29a1be45d20607f1c04664894804382840c00c..0f9fdd5063f74cd872e12c8880c7ff6fabd0e2f7 100644 (file)
@@ -31,6 +31,7 @@
 #include <unistd.h>
 
 #include <cynara/cynara-client.h>
+#include <cynara/cynara-creds-pid.h>
 #include <sys/smack.h>
 #endif
 
@@ -224,11 +225,7 @@ class AccessControlImpl {
       free(smack_label);
     };
 
-    char path[1024] = {
-        0,
-    };
-    snprintf(path, sizeof(path), "/proc/%lu/attr/current", static_cast<unsigned long>(gettid()));
-    int ret = smack_getlabel(path, &smack_label, SMACK_LABEL_ACCESS);
+    int ret = cynara_creds_pid_get_client(gettid(), CLIENT_METHOD_DEFAULT, &smack_label);
 
     if (0 == ret && nullptr != smack_label && 0 < strlen(smack_label)) {
       auto uid = getuid();