fix the preloaded app smack rule.
authorDongeup Ham <dongeup.ham@samsung.com>
Tue, 14 May 2013 06:27:07 +0000 (15:27 +0900)
committerDongeup Ham <dongeup.ham@samsung.com>
Tue, 14 May 2013 06:27:07 +0000 (15:27 +0900)
Change-Id: I2c6a94d47409195e9cf2b2c021724d2e2dc451d2
Signed-off-by: Dongeup Ham <dongeup.ham@samsung.com>
inc/InstallerDefs.h
src/Manager/InstallerManager.cpp
src/Manager/SignatureManager.cpp
src/Manager/SmackManager.cpp
src/Util/InstallerUtil.cpp

index 21aadab..b19576b 100755 (executable)
@@ -23,7 +23,7 @@
 
 #include "InstallerUtil.h"
 
-#define OSP_INSTALLER_VERSION "version=[20130510.2]"
+#define OSP_INSTALLER_VERSION "version=[20130514.1]"
 
 #define DIR_BIN                                L"/bin"
 #define DIR_INFO                       L"/info"
index 5192a11..7176a2d 100755 (executable)
@@ -922,7 +922,7 @@ InstallerManager::SendEvent(InstallationContext* pContext, const PackageId& pack
        TryReturn(pVal, false, "pVal is null.");
 
        pkgmgr_installer_send_signal((pkgmgr_installer*) pContext->__pPkgmgrInstaller, "tpk", pPackageId.get(), pKey.get(), pVal.get());
-       AppLog("\n    >> pkgmgr_installer_send_signal(tpk, %s, %s, %s)", pPackageId.get(), pKey.get(), pVal.get());
+       AppLog("pkgmgr_installer_send_signal(tpk, %s, %s, %s)", pPackageId.get(), pKey.get(), pVal.get());
 
        return true;
 }
index c9e18ce..46c5c2e 100755 (executable)
@@ -636,8 +636,8 @@ SignatureManager::CompareReferences(HashMap* pDistributorRefMap, HashMap* pAutho
                String* pDistValue = static_cast< String* >(pDistributorRefMap->GetValue(*pAuthorKey));
                TryReturn(pDistValue, false, "pDistValue is null, failed to compare.");
 
-               AppLog("\n  >> pAuthorValue=[%ls]", pAuthorValue->GetPointer());
-               AppLog("\n  >> pDistValue=[%ls]", pDistValue->GetPointer());
+               AppLog("pAuthorValue=[%ls]", pAuthorValue->GetPointer());
+               AppLog("pDistValue=[%ls]", pDistValue->GetPointer());
                if (*pAuthorValue != *pDistValue)
                {
                        TryReturn(0, false, "Digest value does not be matched.");
@@ -646,11 +646,11 @@ SignatureManager::CompareReferences(HashMap* pDistributorRefMap, HashMap* pAutho
                String filePath = __pContext->__rootPath + L"/" + *pAuthorKey;
                String fileDigest;
 
-               AppLog("\n  >> filePath=[%ls]", filePath.GetPointer());
+               AppLog("filePath=[%ls]", filePath.GetPointer());
                res = InstallerUtil::GetFileDigest(filePath, fileDigest);
                TryReturn(res == true, false, "GetFileDigest() is failed.");
 
-               AppLog("\n  >> fileDigest=[%ls]", fileDigest.GetPointer());
+               AppLog("fileDigest=[%ls]", fileDigest.GetPointer());
                if (*pAuthorValue != fileDigest)
                {
                        TryReturn(0, false, "Digest value does not be matched.");
index ad7de45..da8dea1 100755 (executable)
@@ -164,11 +164,11 @@ SmackManager::AddLabelSharedDir(const PackageId& packageId, const String& dirPat
 
        TryReturn(__pContext, false, "__pContext is null");
 
-       if (__pContext->__isVerificationMode == false)
-       {
-               AppLog("VerificationMode is off.");
-               return true;
-       }
+//     if (__pContext->__isVerificationMode == false)
+//     {
+//             AppLog("VerificationMode is off.");
+//             return true;
+//     }
 
        int res = 0;
        String label = packageId;
@@ -188,36 +188,44 @@ SmackManager::AddLabelSharedDir(const PackageId& packageId, const String& dirPat
        }
        else if (dirPath.Contains(L"shared/trusted") == true)
        {
-               Sha1Hash hash;
-               String base64Value;
-               result r = E_SUCCESS;
+               if (__pContext->__isVerificationMode == true)
+               {
+                       Sha1Hash hash;
+                       String base64Value;
+                       result r = E_SUCCESS;
 
-               IListT<String *>* pAuthorCertList = __pContext->__pAuthorCertList;
-               TryReturn(pAuthorCertList, false, "pAuthorCertList is null.");
+                       IListT<String *>* pAuthorCertList = __pContext->__pAuthorCertList;
+                       TryReturn(pAuthorCertList, false, "pAuthorCertList is null.");
 
-               String *pEntity = null;
-               r = pAuthorCertList->GetAt(0, pEntity);
-               TryReturn(!IsFailed(r), false, "pAuthorCertList->GetAt() is failed.");
-               TryReturn(pEntity, false, "pEntity is null.");
+                       String *pEntity = null;
+                       r = pAuthorCertList->GetAt(0, pEntity);
+                       TryReturn(!IsFailed(r), false, "pAuthorCertList->GetAt() is failed.");
+                       TryReturn(pEntity, false, "pEntity is null.");
 
-               std::unique_ptr<ByteBuffer> pEncodedData(StringUtil::DecodeBase64StringN(*pEntity));
-               TryReturn(pEncodedData, false, "pEncodedData is null.");
+                       std::unique_ptr<ByteBuffer> pEncodedData(StringUtil::DecodeBase64StringN(*pEntity));
+                       TryReturn(pEncodedData, false, "pEncodedData is null.");
 
-               std::unique_ptr<ByteBuffer> pHashValue(hash.GetHashN(*pEncodedData.get()));
-               TryReturn(pHashValue, false, "pHashValue is null.");
+                       std::unique_ptr<ByteBuffer> pHashValue(hash.GetHashN(*pEncodedData.get()));
+                       TryReturn(pHashValue, false, "pHashValue is null.");
 
-               r = StringUtil::EncodeToBase64String(*pHashValue, base64Value);
-               TryReturn(!IsFailed(r), false, "EncodeToBase64String() is failed.");
+                       r = StringUtil::EncodeToBase64String(*pHashValue, base64Value);
+                       TryReturn(!IsFailed(r), false, "EncodeToBase64String() is failed.");
 
-               // in smack, '/' is not allowed for label.
-               r = base64Value.Replace(L"/", L"#");
-               TryReturn(!IsFailed(r), false, "base64Value.Replace() is failed.");
+                       // in smack, '/' is not allowed for label.
+                       r = base64Value.Replace(L"/", L"#");
+                       TryReturn(!IsFailed(r), false, "base64Value.Replace() is failed.");
 
-               std::unique_ptr<char[]> pHashEncodedValue(_StringConverter::CopyToCharArrayN(base64Value));
-               TryReturn(pHashEncodedValue, false, "pHashEncodedValue is null.");
+                       std::unique_ptr<char[]> pHashEncodedValue(_StringConverter::CopyToCharArrayN(base64Value));
+                       TryReturn(pHashEncodedValue, false, "pHashEncodedValue is null.");
 
-               label = pHashEncodedValue.get();
-               AppLog("pHashEncodedValue = [%s]", pHashEncodedValue.get());
+                       label = pHashEncodedValue.get();
+                       AppLog("pHashEncodedValue = [%s]", pHashEncodedValue.get());
+               }
+               else
+               {
+                       AddLabelDir(pPackageId.get(), pPath.get());
+                       return true;
+               }
        }
        else
        {
index 4c3f340..d1a067f 100755 (executable)
@@ -253,7 +253,7 @@ InstallerUtil::CreateSymlink(const String& oldPath, const String& newPath)
        String label("_");
        smackManager.AddLabelDir(label, newPath);
 
-       AppLog("\n  >> CreateSymlink(): [%ls] -> [%ls]", newPath.GetPointer(), oldPath.GetPointer());
+       AppLog("CreateSymlink(): [%ls] -> [%ls]", newPath.GetPointer(), oldPath.GetPointer());
 
        return true;
 }
@@ -355,7 +355,7 @@ InstallerUtil::ChangeDirectoryPermission(const String& filePath, int mode, bool
                }
        }
 
-       AppLog("\n  >> path=[%ls], mode=[%04o], appOwner=[%s]",
+       AppLog("path=[%ls], mode=[%04o], appOwner=[%s]",
                        filePath.GetPointer(), mode, appOwner?"true":"false");
 
        return true;