From: Youngjae Cho Date: Thu, 16 Jan 2025 07:20:23 +0000 (+0900) Subject: libcommon: Remove syscommon_proc_get_attr_current() and syscommon_proc_is_app() X-Git-Tag: accepted/tizen/unified/20250122.093021^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2b6fe2f51f044fd5328b8511109d2a0aace88ecd;p=platform%2Fcore%2Fsystem%2Flibsyscommon.git libcommon: Remove syscommon_proc_get_attr_current() and syscommon_proc_is_app() 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 has 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 as well. Change-Id: Ife78fee3601bcd3d9b0532b9935350c408891b32 Signed-off-by: Youngjae Cho --- diff --git a/CMakeLists.txt b/CMakeLists.txt index bea15c6..5412f1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}") diff --git a/include/libsyscommon/proc.h b/include/libsyscommon/proc.h index e6d2f3a..04ca248 100644 --- a/include/libsyscommon/proc.h +++ b/include/libsyscommon/proc.h @@ -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__ */ diff --git a/packaging/libsyscommon.spec b/packaging/libsyscommon.spec index 95439b2..561bf64 100644 --- a/packaging/libsyscommon.spec +++ b/packaging/libsyscommon.spec @@ -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 diff --git a/src/libcommon/proc.c b/src/libcommon/proc.c index c229632..2e7239d 100644 --- a/src/libcommon/proc.c +++ b/src/libcommon/proc.c @@ -5,9 +5,6 @@ #include #include -#include -#include - #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; -} diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index a8064bc..e53ee04 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -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")