Modify wrong operation related to smack disable 76/321776/1
authorChanggyu Choi <changyu.choi@samsung.com>
Fri, 28 Mar 2025 05:13:45 +0000 (14:13 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Fri, 28 Mar 2025 05:13:45 +0000 (14:13 +0900)
Change-Id: I21432446e363b82ef613ce840a46c70fd7861088
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
src/aul/app_info/directory_info.cc
src/aul/app_manager/app_event.cc
src/aul/status.cc

index f7314d282ba8f6fe14644612e8e671009ee6a66d..ebffbc95408b86364ac3c976888a286eb6d9069c 100644 (file)
@@ -42,8 +42,16 @@ constexpr const char kLightUserSwitchModeDefault[] = "default";
 constexpr const char kResControlAllowedDir[] = "res/mount/allowed/";
 constexpr const char kResControlGlobalDir[] = "res/mount/global/";
 
+uid_t ConvertUID(uid_t uid) {
+  constexpr uid_t REGULAR_APP_UID_MIN = 10000;
+  const static uid_t defaultuser_uid = tzplatform_getuid(TZ_SYS_DEFAULT_USER);
+  if (uid >= REGULAR_APP_UID_MIN) return defaultuser_uid;
+
+  return uid;
+}
+
 std::string GetRWPath(const std::string& pkg_id, uid_t uid) {
-  tzplatform_set_user(uid);
+  tzplatform_set_user(ConvertUID(uid));
   std::string path = std::string(tzplatform_getenv(TZ_USER_APP)) + "/" + pkg_id;
   tzplatform_reset_user();
   return path;
index a475188116f348116c4033fb9a5f54e22c6a3d30..fad6b45383daa277e3b46488e0c41a44c61ca922 100644 (file)
@@ -31,14 +31,10 @@ namespace aul {
 AppEvent::AppEvent(std::string app_id, AppEvent::IEvent* ev)
   : app_id_(std::move(app_id)), ev_(ev) {
   endpoint_ = "app_status_event:" + app_id_;
-  if (getuid() >= REGULAR_UID_MIN)
-    endpoint_ += ":" + std::to_string(getuid());
 }
 
 AppEvent::AppEvent(AppEvent::IEvent* ev) : ev_(ev) {
   endpoint_ = "app_status_event";
-  if (getuid() >= REGULAR_UID_MIN)
-    endpoint_ += ":" + std::to_string(getuid());
 }
 
 AppEvent::~AppEvent() {
index 88983b30ce93d0d2f40c965f5e24e6ed31c51392..c374a66499e5e57da9bff362880dfd394a7bd97f 100644 (file)
@@ -51,8 +51,6 @@ class AppStatusEvent {
         cb_(cb),
         user_data_(user_data) {
     std::string endpoint = "app_status_event:" + appid_;
-    if (uid_ < REGULAR_UID_MIN)
-      endpoint += ":" + std::to_string(uid_);
 
     int ret = aul_app_com_create(endpoint.c_str(), nullptr, OnAppComCb, this,
         &connection_);