From: Krzysztof Malysa Date: Fri, 14 Feb 2025 16:59:07 +0000 (+0100) Subject: Ensure apps in the package have unique names X-Git-Tag: accepted/tizen/unified/20250313.164542~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e67eaae44ba3dd06ab60ea46e7faf361bc727a66;p=platform%2Fcore%2Fsecurity%2Fsecurity-manager.git Ensure apps in the package have unique names Change-Id: I6bf4af9657ddd37f3970148c1a3e660b510aa414 --- diff --git a/src/common/service_impl.cpp b/src/common/service_impl.cpp index 6fca0902..cb53a1bd 100644 --- a/src/common/service_impl.cpp +++ b/src/common/service_impl.cpp @@ -46,6 +46,8 @@ #include #include #include +#include +#include #include #include @@ -516,6 +518,18 @@ int ServiceImpl::appInstallInitialChecks(const Credentials &creds, app_inst_req return SECURITY_MANAGER_ERROR_AUTHENTICATION_FAILED; } + // Check that all apps have unique names + { + std::unordered_set appNames; + for (const auto& app : req.apps) { + if (!appNames.emplace(app.appName).second) { + LogError("Found two applications with name: " << app.appName + << ". Returning error."); + return SECURITY_MANAGER_ERROR_INPUT_PARAM; + } + } + } + return SECURITY_MANAGER_SUCCESS; }