String destPath;
String appRootPath;
SmackManager smackManager;
+ smackManager.Construct(pContext);
appRootPath = pContext->__rootPath;
PackageId packageId = pContext->__packageId;
InstallerUtil::CreateSymlink(iconPath, destPath);
}
InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, false);
- smackManager.AddLabelSharedDir(packageId, destPath, pContext);
+ smackManager.AddLabelSharedDir(packageId, destPath);
// appRoot/shared/data
destPath = appRootPath + DIR_SHARED_DATA;
InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, true);
- smackManager.AddLabelSharedDir(packageId, destPath, pContext);
+ smackManager.AddLabelSharedDir(packageId, destPath);
// appRoot/shared/trusted
destPath = appRootPath + DIR_SHARED_TRUSTED;
InstallerUtil::ChangeDirectoryPermission(destPath, PERM_BASE, true);
- smackManager.AddLabelSharedDir(packageId, destPath, pContext);
+ smackManager.AddLabelSharedDir(packageId, destPath);
// appRoot/contents
destPath = appRootPath + DIR_CONTENTS;
using namespace Tizen::Io;
SmackManager::SmackManager(void)
-:__isSmackEnable(false)
+:__pContext(null)
+,__isSmackEnable(false)
{
if (IsSmackEnable() == true)
{
}
bool
+SmackManager::Construct(InstallationContext* pContext)
+{
+ __pContext = pContext;
+
+ return true;
+}
+
+bool
SmackManager::AddLabelDir(const String& label, const String& dirPath, bool rootDirectory)
{
if (__isSmackEnable == false)
}
bool
-SmackManager::AddLabelSharedDir(const PackageId& packageId, const String& dirPath, InstallationContext* pContext)
+SmackManager::AddLabelSharedDir(const PackageId& packageId, const String& dirPath)
{
if (__isSmackEnable == false)
{
return true;
}
- if (pContext->__isVerificationMode == false)
+ TryReturn(__pContext, false, "__pContext is null");
+
+ if (__pContext->__isVerificationMode == false)
{
AppLog("VerificationMode is off.");
return true;
Sha1Hash hash;
String base64Value;
- X509CertificatePath* pAuthorCertPath = pContext->GetAuthorCertPath();
+ X509CertificatePath* pAuthorCertPath = __pContext->GetAuthorCertPath();
TryReturn(pAuthorCertPath, false, "pAuthorCertPath is null.");
std::unique_ptr<ICertificate> pEntity(pAuthorCertPath->GetCertificateN(0));
return true;
}
+ TryReturn(__pContext, false, "__pContext is null");
+
int res = 0;
- const char* pList[] = {"OSP", null};
String script("/usr/bin/smackload-app.sh");
bool exist = File::IsFileExist(script);
std::unique_ptr<char[]> pScript(_StringConverter::CopyToCharArrayN(script));
TryReturn(pScript, false, "pScript is null.");
+ int count = __pContext->__pPrivilegeList->GetCount();
+
+ const char** pList = new (std::nothrow) const char*[count+1];
+ TryReturn(pList, false, "pList is null.");
+
+ for (int i = 0; i < count; i++)
+ {
+ String* pPrivilege = dynamic_cast < String* >(__pContext->__pPrivilegeList->GetAt(i));
+ if (pPrivilege)
+ {
+ char* pPrivilegeString = _StringConverter::CopyToCharArrayN(*pPrivilege);
+ TryReturn(pPrivilegeString, false, "pPrivilegeString is null.");
+
+ pList[i] = pPrivilegeString;
+ }
+ }
+
+ pList[count] = null;
+
res = AddPermissions(pPackageId.get(), pList);
if (exist == true)
AppLog("[%ls] not found", script.GetPointer());
}
+ for (int i = 0; pList[i] != null; i++)
+ {
+ AppLog("delete Privilege - [%s]", pList[i]);
+ delete[] pList[i];
+ }
+ delete[] pList;
+
return true;
}
return -1;
}
+ for (int i = 0; ppPermissions[i] != null; i++)
+ {
+ AppLog("Privilege - [%s]", ppPermissions[i]);
+ }
+
ret = app_add_permissions(pPackageId, ppPermissions);
AppLog("[smack] app_add_permissions(%s), result = [%d]", pPackageId, ret);
public:
SmackManager(void);
virtual ~SmackManager(void);
+ bool Construct(InstallationContext* pContext);
bool AddLabelDir(const Tizen::Base::String& label, const Tizen::Base::String& dirPath, bool rootDirectory = false);
- bool AddLabelSharedDir(const Tizen::App::PackageId& packageId, const Tizen::Base::String& dirPath, InstallationContext* pContext);
+ bool AddLabelSharedDir(const Tizen::App::PackageId& packageId, const Tizen::Base::String& dirPath);
bool AddPermissions(const Tizen::App::PackageId& packageId);
bool RevokePermissions(const Tizen::App::PackageId& packageId);
int RevokePermissions(const char* pPackageId);
private:
+ InstallationContext* __pContext;
bool __isSmackEnable;