void TaskCertify::getSignatureFiles(std::string path, SignatureFileInfoSet& file)
{
+ LogDebug("path : " << path);
SignatureFileInfoSet signatureFiles;
SignatureFinder signatureFinder(path);
if (SignatureFinder::NO_ERROR != signatureFinder.find(file)) {
std::string widgetPath;
widgetPath = m_contextData.locations->getTemporaryPackageDir() + "/";
+ if (m_contextData.mode.command ==
+ InstallMode::Command::REINSTALL)
+ {
+ widgetPath = m_contextData.locations->getPackageInstallationDir() + "/";
+ }
+
SignatureFileInfoSet signatureFiles;
Try {
getSignatureFiles(widgetPath, signatureFiles);
if (signatureFiles.size() <= 0) {
- widgetPath = m_contextData.locations->getTemporaryPackageDir() +
- WrtDB::GlobalConfig::GetWidgetSrcPath() + "/";
+ widgetPath += std::string(WrtDB::GlobalConfig::GetWidgetSrcPath())
+ + "/";
if (0 == access(widgetPath.c_str(), F_OK)) {
getSignatureFiles(widgetPath, signatureFiles);
}
Jobs::WidgetInstall::TaskSmack::SmackFolderLabelingStep()");
#ifdef WRT_SMACK_ENABLED
/* /opt/usr/apps/[pkgid] directory's label is "_" */
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
- m_context.locations->getPackageInstallationDir().c_str(),
- APP_PATH_ANY_LABEL, "_")) {
+ if (PC_OPERATION_SUCCESS != app_label_dir("_",
+ m_context.locations->getPackageInstallationDir().c_str())) {
LogWarning("Add label to " <<
m_context.locations->getPackageInstallationDir());
}
/* res directory */
std::string resDir = m_context.locations->getPackageInstallationDir() +
"/res";
-
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId, resDir.c_str(),
- APP_PATH_PRIVATE)) {
+ if (PC_OPERATION_SUCCESS != app_label_dir(m_pkgId,
+ resDir.c_str())) {
LogWarning("Add label to " << resDir);
}
- /* data directory */
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
- m_context.locations->getPrivateStorageDir().c_str(),
- APP_PATH_PRIVATE)) {
- LogWarning("Add label to " << m_context.locations->getPrivateStorageDir());
- }
-
/* for prealod */
if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD &&
m_context.mode.extension != InstallMode::ExtensionType::DIR)
{
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
- m_context.locations->getUserDataRootDir().c_str(),
- APP_PATH_GROUP_RW, "_")) {
+ if (PC_OPERATION_SUCCESS != app_label_dir("_",
+ m_context.locations->getUserDataRootDir().c_str())) {
+ LogWarning("Add label to " << m_context.locations->getUserDataRootDir());
}
}
+ /* data directory */
+ if (PC_OPERATION_SUCCESS !=
+ app_label_dir(m_pkgId,
+ m_context.locations->getPrivateStorageDir().c_str()))
+ {
+ LogWarning("Add label to " << m_context.locations->getPrivateStorageDir());
+ }
+
/* tmp directory */
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
- m_context.locations->getPrivateTempStorageDir().c_str(),
- APP_PATH_PRIVATE))
+ if (PC_OPERATION_SUCCESS !=
+ app_label_dir(m_pkgId,
+ m_context.locations->getPrivateTempStorageDir().c_str()))
{
LogWarning("Add label to " << m_context.locations->getPrivateTempStorageDir());
}
/* bin directory */
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
- m_context.locations->getBinaryDir().c_str(),
- APP_PATH_PRIVATE)) {
+ if (PC_OPERATION_SUCCESS != app_label_dir(m_pkgId,
+ m_context.locations->getBinaryDir().c_str())) {
LogWarning("Add label to " << m_context.locations->getBinaryDir());
}
#ifdef WRT_SMACK_ENABLED
/* TODO :
std::string id = DPL::ToUTF8String(m_context.widgetConfig.tzAppid);
+ std::string id = DPL::ToUTF8String(m_context.widgetConfig.tzPkgid);
char* appId = NULL;
appId = (char*)calloc(1, id.length() + 1);
snprintf(appId, id.length() + 1, "%s", id.c_str());
bool TaskSmack::setLabelForSharedDir(const char* pkgId)
{
+ /* shared directory */
+ if (PC_OPERATION_SUCCESS != app_label_dir("*",
+ m_context.locations->getSharedRootDir().c_str())) {
+ return false;
+ }
+
/* shared/res directory */
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
- m_context.locations->getSharedResourceDir().c_str(),
- APP_PATH_ANY_LABEL, "_")) {
- LogWarning("Add label to " << m_context.locations->getSharedResourceDir());
+ if (PC_OPERATION_SUCCESS != app_label_dir("_",
+ m_context.locations->getSharedResourceDir().c_str())) {
+ return false;
}
/* shared/trusted directory */
LogDebug("sha1 label string : " << sha1String);
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
- m_context.locations->getSharedTrustedDir().c_str(),
- APP_PATH_GROUP_RW, sha1String.c_str())) {
- LogWarning("Add label to " << m_context.locations->getBinaryDir());
+ if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId,
+ sha1String.c_str(),
+ m_context.locations->getSharedTrustedDir().c_str())) {
+ return false;
}
}
/* shared/data directory */
- if (PC_OPERATION_SUCCESS != app_setup_path(m_pkgId,
- m_context.locations->getSharedDataDir().c_str(),
- APP_PATH_PUBLIC_RO)) {
- LogWarning("Add label to " << m_context.locations->getSharedDataDir());
+ std::string dataLabel = std::string(pkgId) + "_shareddata";
+ TizenPkgIdList pkgList = WidgetDAOReadOnly::getTizenPkgidList();
+ const char** pList = new (std::nothrow) const char*[pkgList.size() + 1];
+
+ int index = 0;
+ FOREACH(app, pkgList) {
+ std::string id = DPL::ToUTF8String(*app);
+ char *pId = new char[id.size() + 1];
+ snprintf(pId, id.length() + 1, "%s", id.c_str());
+ pList[index++] = pId;
}
+ pList[index] = NULL;
+ if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId,
+ dataLabel.c_str(),
+ m_context.locations->getSharedDataDir().c_str())) {
+ freeList(pList);
+ return false;
+ }
+ if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId,
+ "*",
+ m_context.locations->getSharedDataDir().c_str())) {
+ freeList(pList);
+ return false;
+ }
+ freeList(pList);
return true;
}
} //namespace WidgetInstall
bool isSecurityModelV1 = false;
bool isSecurityModelV2 = false;
- std::string securityModelV2supportedVersion = "2.2";
WrtDB::ConfigParserData &data = m_installContext.widgetConfig.configInfo;
- // Parse required version
- long majorWidget = 0, minorWidget = 0, microWidget = 0;
- if (!parseVersionString(DPL::ToUTF8String(*data.tizenMinVersionRequired),
- majorWidget,
- minorWidget,
- microWidget))
- {
- ThrowMsg(Exceptions::NotAllowed, "Wrong version string");
- }
-
- // Parse since version (CSP & allow-navigation start to support since 2.2)
- long majorSupported = 0, minorSupported = 0, microSupported = 0;
- if (!parseVersionString(securityModelV2supportedVersion,
- majorSupported,
- minorSupported,
- microSupported))
- {
- ThrowMsg(Exceptions::NotAllowed, "Wrong version string");
- }
-
- if (majorWidget < majorSupported ||
- (majorWidget == majorSupported && minorWidget < minorSupported) ||
- (majorWidget == majorSupported && minorWidget == minorSupported
- && microWidget < microSupported))
+ if (!data.cspPolicy.IsNull() ||
+ !data.cspPolicyReportOnly.IsNull() ||
+ !data.allowNavigationInfoList.empty())
{
- // Under 2.2, clear v2 data
- data.cspPolicy = DPL::OptionalString::Null;
- data.cspPolicyReportOnly = DPL::OptionalString::Null;
- data.allowNavigationInfoList.clear();
- } else {
- // More than 2.2, if v2 is defined, clear v1 data
- if (!data.cspPolicy.IsNull() ||
- !data.cspPolicyReportOnly.IsNull() ||
- !data.allowNavigationInfoList.empty())
- {
- data.accessInfoSet.clear();
- }
+ data.accessInfoSet.clear();
}
// WARP is V1