Check duplicated privilege in manifest.xml
authorDuyoung Jang <duyoung.jang@samsung.com>
Mon, 26 Aug 2013 08:47:03 +0000 (17:47 +0900)
committerDuyoung Jang <duyoung.jang@samsung.com>
Mon, 26 Aug 2013 08:47:03 +0000 (17:47 +0900)
Change-Id: I710d80a0a8688436e5ab43b283f6669ac3a2c551
Signed-off-by: Duyoung Jang <duyoung.jang@samsung.com>
inc/InstallerDefs.h
src/Manager/ConfigurationManager.cpp
src/XmlHandler/ManifestHandler.cpp

index ace4fd3..8ef969e 100755 (executable)
@@ -23,7 +23,7 @@
 
 #include "InstallerUtil.h"
 
-#define OSP_INSTALLER_VERSION "version=[20130826.2]"
+#define OSP_INSTALLER_VERSION "version=[20130826.3]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
index 1dd068a..65c51f9 100755 (executable)
@@ -286,6 +286,7 @@ ConfigurationManager::RemoveFile(InstallationContext* pContext)
 bool
 ConfigurationManager::PostInstall(InstallationContext* pContext, bool error) const
 {
+       bool res = true;
        PackageId packageId = pContext->__packageId;
        std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
        TryReturn(pPackageId, false, "pPackageId is null.");
@@ -296,7 +297,8 @@ ConfigurationManager::PostInstall(InstallationContext* pContext, bool error) con
                smackManager.Construct(pContext);
                smackManager.EnablePermissions(packageId);
 
-               RegisterCoreXmlFile(pContext);
+               res = RegisterCoreXmlFile(pContext);
+               TryReturn(res, false, "RegisterCoreXmlFile() failed.");
 
                if ((pContext->__isUpdated == true) && (pContext->__isPreloaded == false))
                {
index 69692dd..c81a981 100755 (executable)
@@ -1009,7 +1009,16 @@ ManifestHandler::OnApiVersionValue(const char* pCharacters)
 bool
 ManifestHandler::OnPrivilegeValue(const char* pCharacters)
 {
-       __pPrivilegeList->Add(*new (std::nothrow) String(pCharacters));
+       std::unique_ptr<String> pPrivilege(new (std::nothrow) String(pCharacters));
+       TryReturn(pPrivilege, false, "pPrivilege is null.");
+
+       if (__pPrivilegeList->Contains(*pPrivilege.get()) == true)
+       {
+               AppLog("Privilege(%ls) is duplicated.", pPrivilege->GetPointer());
+               return false;
+       }
+
+       __pPrivilegeList->Add(pPrivilege.release());
        AppLog("<Privilege>%s</Privilege>", pCharacters);
 
        return true;