proc: Remove syscommon_proc_get_attr_current() and syscommon_proc_is_app() sandbox/y0.cho/tizen_10.0-nosmack tizen-next
authorYoungjae Cho <y0.cho@samsung.com>
Thu, 16 Jan 2025 07:20:23 +0000 (16:20 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Thu, 16 Jan 2025 07:38:51 +0000 (16:38 +0900)
The syscommon_proc_is_app() was changed to use security-manager instaed
of access directly to a smack node. However, the newly added dependency
to security-manager generated dependency cycle:
 • libsyscommon → security-manager → pkgmgr → rpc-port → libstorage
   → libsyscommon

Removed the newly added dependency libsyscommon → security-manager, and
moved related function to where it had been used. Currently only the
deviced and resourced are using it.

Likewise, removed cynara-creds-pid and related function as well that
has been added recently. This is currently not a problem like
security-manager, but we realized that this libsyscommon is used by
a number of system packages so it is likely to generate unintended
cycle dependency when it gains external dependency. Therefore,
proactively removed dependency to cynara-creds-pid.

Change-Id: Ife78fee3601bcd3d9b0532b9935350c408891b32
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
CMakeLists.txt
include/libsyscommon/proc.h
packaging/libsyscommon.spec
src/libcommon/proc.c
tests/CMakeLists.txt

index bea15c69e12fe8abf46163e6e4bf29d94867cec9..5412f1cce5ed49dcde3a718c1766353a43cc2e1e 100644 (file)
@@ -38,9 +38,7 @@ pkg_check_modules(syscommon REQUIRED
        gio-unix-2.0
        dlog
        json-c
-       capi-system-info
-       cynara-creds-pid
-       security-manager)
+       capi-system-info)
 
 FOREACH(flag ${syscommon_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
index e6d2f3a678eff9780f0a61b61d1cc71a4e78e968..04ca2488ca00f4cce723b32ef5073ce4395bc3cc 100644 (file)
@@ -27,7 +27,5 @@
 
 int syscommon_proc_get_comm(pid_t pid, char *buf, int len);
 int syscommon_proc_get_cmdline(pid_t pid, char *buf, int len);
-int syscommon_proc_get_attr_current(pid_t pid, char *buf, int len);
-int syscommon_proc_is_app(pid_t pid);
 
 #endif /*__SYSCOMMON_PROC_H__ */
index 95439b2d69b2f29c77cb08b134a8461ff40b0a2c..561bf64163a1db802d7a05bbd81b40259ff79670 100644 (file)
@@ -22,8 +22,6 @@ BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(json-c)
 BuildRequires:  pkgconfig(capi-system-info)
 BuildRequires:  pkgconfig(capi-system-resource)
-BuildRequires:  pkgconfig(cynara-creds-pid)
-BuildRequires:  pkgconfig(security-manager)
 
 Requires:         /bin/cp
 Requires(post):   /sbin/ldconfig
index c2296320bd7fd7c11b34a00ffdea803c9d21b8b8..2e7239db352ee4d5faf66878f5aaebab16ee9a8b 100644 (file)
@@ -5,9 +5,6 @@
 #include <stdarg.h>
 #include <stdlib.h>
 
-#include <cynara-creds-pid.h>
-#include <security-manager/app-runtime.h>
-
 #include "shared/log.h"
 #include "libsyscommon/proc.h"
 
@@ -74,41 +71,3 @@ int syscommon_proc_get_cmdline(pid_t pid, char *buf, int len)
 {
        return proc_get_string(buf, len, "/proc/%d/cmdline", pid);
 }
-
-int syscommon_proc_get_attr_current(pid_t pid, char *buf, int len)
-{
-       char *client = NULL;
-       int ret;
-
-       if (!buf)
-               return -EINVAL;
-
-       ret = cynara_creds_pid_get_client(pid, CLIENT_METHOD_DEFAULT, &client);
-       if (ret != CYNARA_API_SUCCESS)
-               return -EINVAL;
-
-       ret = snprintf(buf, len, "%s", client);
-
-       free(client);
-       client = NULL;
-
-       if (ret < 0)
-               return -EIO;
-
-       if (ret >= len)
-               return -EOVERFLOW;
-
-       return 0;
-}
-
-int syscommon_proc_is_app(pid_t pid)
-{
-       bool is_app = false;
-       int ret;
-
-       ret = security_manager_is_app_from_pid(pid, &is_app);
-       if (ret != SECURITY_MANAGER_SUCCESS)
-               return -1;
-
-       return is_app;
-}
index a8064bcdc06bbd86afae5c3a793c5f07751c47ed..e53ee04e18738739c686c88d23a2324334cf10a8 100644 (file)
@@ -36,9 +36,7 @@ PKG_CHECK_MODULES(REQUIRED_PKGS REQUIRED
        glib-2.0
        json-c
        capi-system-info
-       cmocka
-       cynara-creds-pid
-       security-manager)
+       cmocka)
 
 ADD_EXECUTABLE(${TEST_DRIVER} ${SRCS})
 TARGET_LINK_LIBRARIES(${TEST_DRIVER} "${REQUIRED_PKGS_LDFLAGS} -ldl")