From a62e76b12d841171e9d3664a48a9b8f77b4fd155 Mon Sep 17 00:00:00 2001 From: Soyoung Kim Date: Fri, 30 Nov 2012 17:38:21 +0900 Subject: [PATCH] Revert "Pkgname (tizen id) - not null" This reverts commit 90edb1a841aa952ddbb842dfe7fbcd13999e6b2b. --- .../WidgetConfigurationManager.cpp | 95 ++++++++++++---------- src/jobs/widget_install/job_widget_install.cpp | 47 ++++++----- src/jobs/widget_install/task_certificates.cpp | 4 +- src/jobs/widget_install/task_encrypt_resource.cpp | 4 +- src/jobs/widget_install/task_file_manipulation.cpp | 10 ++- src/jobs/widget_install/task_manifest_file.cpp | 32 +++++--- src/jobs/widget_install/task_private_storage.cpp | 9 +- src/jobs/widget_install/task_smack.cpp | 5 +- src/jobs/widget_install/task_widget_config.cpp | 10 ++- src/jobs/widget_uninstall/task_smack.cpp | 5 +- src/pkg-manager/backendlib.cpp | 4 +- src/wrt-installer/wrt_installer_api.cpp | 2 +- 12 files changed, 136 insertions(+), 91 deletions(-) diff --git a/src/configuration_parser/WidgetConfigurationManager.cpp b/src/configuration_parser/WidgetConfigurationManager.cpp index 30b47bc..54b458c 100644 --- a/src/configuration_parser/WidgetConfigurationManager.cpp +++ b/src/configuration_parser/WidgetConfigurationManager.cpp @@ -36,20 +36,21 @@ IMPLEMENT_SINGLETON(WidgetConfigurationManager) //TODO Rewrite this as steps/tasks namespace // anonymous { -const char * const DEFAULT_LANGUAGE = "default"; +const char *const DEFAULT_LANGUAGE = "default"; const size_t MAX_WIDGET_PATH_SIZE = 1024; //#define WRT_WIDGET_DEFAULT_ICON_WIDTH 80 //#define WRT_WIDGET_DEFAULT_ICON_HEIGHT 80 //#define WRT_WIDGET_CONFIG_BASE_LOCALE "locales" -const char * const WRT_WIDGET_CONFIG_FILE_NAME = "config.xml"; +const char *const WRT_WIDGET_CONFIG_FILE_NAME = "config.xml"; } bool WidgetConfigurationManager::locateAndParseConfigurationFile( const std::string& _currentPath, WrtDB::WidgetRegisterInfo& pWidgetConfigInfo, - const std::string& baseFolder, int* pErrCode) + const std::string& baseFolder, + int* pErrCode) { using namespace WrtDB; @@ -62,7 +63,7 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile( // check if this installation from browser, or not. size_t pos = _currentPath.rfind("/"); std::ostringstream infoPath; - infoPath << _currentPath.substr(pos + 1); + infoPath << _currentPath.substr(pos+1); ParserRunner parser; std::string language = ""; @@ -94,35 +95,39 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile( while ((ptr = readdir(dir)) != NULL) { //Find configuration file, based on its name if (ptr->d_type == DT_REG) { if (!strcmp(ptr->d_name, WRT_WIDGET_CONFIG_FILE_NAME)) { - _WrtUtilSetAbsolutePath(cfgAbsPath, _currentPath.c_str(), - ptr->d_name); + _WrtUtilSetAbsolutePath(cfgAbsPath, + _currentPath.c_str(), ptr->d_name); //Parse widget configuration file LogDebug("Found config: " << cfgAbsPath); Try { - parser.Parse(cfgAbsPath, - ElementParserPtr( - new RootParser(configInfo, - DPL::FromUTF32String( - L"widget")))); + parser.Parse(cfgAbsPath, ElementParserPtr(new + RootParser< + WidgetParser>( + configInfo, + DPL + :: + FromUTF32String( + L"widget")))); + } + Catch(ElementParser::Exception::Base) + { + LogDebug("Invalid widget configuration file!"); + // _rethrown_exception.Dump(); + *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; + closedir(dir); + return false; } - Catch(ElementParser::Exception::Base){ - LogDebug("Invalid widget configuration file!"); - // _rethrown_exception.Dump(); - *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; - closedir(dir); - return false; - } - // - // WidgetConfigurationParser & parser = WidgetConfigurationParserSingleton::Instance(); - // if (!parser.parseConfigurationFile(cfgAbsPath, configInfo, baseFolder.c_str(), pWidgetConfigInfo.signature_type)) { - // LogDebug("Invalid widget configuration file!"); - // *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; - // closedir(dir); - // return false; - // } + // + // WidgetConfigurationParser & parser = WidgetConfigurationParserSingleton::Instance(); + // if (!parser.parseConfigurationFile(cfgAbsPath, configInfo, baseFolder.c_str(), pWidgetConfigInfo.signature_type)) { + // LogDebug("Invalid widget configuration file!"); + // *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; + // closedir(dir); + // return false; + // } has_config_xml = true; break; @@ -141,18 +146,22 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile( // in case of browser installation Try { - parser.Parse(_currentPath, - ElementParserPtr( - new RootParser(configInfo, - DPL::FromUTF32String(L"widget")))); + parser.Parse(_currentPath, ElementParserPtr(new + RootParser< + WidgetParser>( + configInfo, + DPL::FromUTF32String( + L"widget")))); + } + Catch(ElementParser::Exception::Base) + { + LogDebug("Invalid widget configuration file!"); + // _rethrown_exception.Dump(); + *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; + return false; } - Catch(ElementParser::Exception::Base){ - LogDebug("Invalid widget configuration file!"); - // _rethrown_exception.Dump(); - *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; - return false; } -} + char *tmp_language; if (!_WrtUtilStringToLower(baseFolder.c_str(), &tmp_language)) { @@ -180,10 +189,14 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile( } if (!!configInfo.tizenId) { - if (pWidgetConfigInfo.pkgname_NOTNULL != *configInfo.tizenId) { - *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; - LogDebug("Invalid archive - Tizen ID not same error"); - return false; + if (!pWidgetConfigInfo.pkgname) { + pWidgetConfigInfo.pkgname = configInfo.tizenId; + } else { + if (pWidgetConfigInfo.pkgname != configInfo.tizenId) { + *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE; + LogDebug("Invalid archive - Tizen ID not same error"); + return false; + } } } @@ -214,7 +227,7 @@ void WidgetConfigurationManager::processFile(const std::string& path, int pErrCode; if (!locateAndParseConfigurationFile(path, widgetConfiguration, - DEFAULT_LANGUAGE, &pErrCode)) { + DEFAULT_LANGUAGE, &pErrCode)) { LogWarning("Widget archive: Failed while parsing config file"); ThrowMsg(Exception::ProcessFailed, path); } diff --git a/src/jobs/widget_install/job_widget_install.cpp b/src/jobs/widget_install/job_widget_install.cpp index 6c11b64..96aa5bb 100644 --- a/src/jobs/widget_install/job_widget_install.cpp +++ b/src/jobs/widget_install/job_widget_install.cpp @@ -312,7 +312,7 @@ bool JobWidgetInstall::setTizenId( regfree(®); return false; } - m_installerContext.widgetConfig.pkgname_NOTNULL = *configInfo.tizenId; + m_installerContext.widgetConfig.pkgname = configInfo.tizenId; } else { WidgetPkgName tizenId = WidgetDAOReadOnly::generateTizenId(); @@ -338,13 +338,13 @@ bool JobWidgetInstall::setTizenId( break; } - m_installerContext.widgetConfig.pkgname_NOTNULL = tizenId; + m_installerContext.widgetConfig.pkgname = tizenId; } LogInfo("tizen_id name was generated by WRT: " << tizenId); } regfree(®); - LogInfo("Tizen Id : " << m_installerContext.widgetConfig.pkgname_NOTNULL); + LogInfo("Tizen Id : " << m_installerContext.widgetConfig.pkgname); LogInfo("W3C Widget GUID : " << m_installerContext.widgetConfig.guid); return true; } @@ -353,7 +353,7 @@ void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath, const std::string& tempPath) { m_installerContext.locations = - WidgetLocation(DPL::ToUTF8String(m_installerContext.widgetConfig.pkgname_NOTNULL), + WidgetLocation(DPL::ToUTF8String(*m_installerContext.widgetConfig.pkgname), widgetPath, tempPath, m_installerContext.widgetConfig.packagingType); @@ -384,14 +384,19 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation( LogInfo("Widget info exists. PkgName: " << update.existingWidgetInfo.pkgname); - DPL::String pkgname = update.existingWidgetInfo.pkgname; + DPL::OptionalString pkgname = update.existingWidgetInfo.pkgname; + + if(pkgname.IsNull()) { + LogInfo("But package name doesn't exist"); + return ConfigureResult::Failed; + } LogInfo("Widget model exists. package name: " << pkgname); // Check running state int retval = APP_MANAGER_ERROR_NONE; bool isRunning = false; - retval = app_manager_is_running(DPL::ToUTF8String(pkgname).c_str(), &isRunning); + retval = app_manager_is_running(DPL::ToUTF8String(*pkgname).c_str(), &isRunning); if (APP_MANAGER_ERROR_NONE != retval) { LogError("Fail to get running state"); return ConfigureResult::Failed; @@ -413,7 +418,7 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation( } } - m_installerContext.widgetConfig.pkgname_NOTNULL = pkgname; + m_installerContext.widgetConfig.pkgname = pkgname; OptionalWidgetVersion existingVersion; existingVersion = update.existingWidgetInfo.existingVersion; OptionalWidgetVersion incomingVersion = update.incomingVersion; @@ -436,15 +441,17 @@ JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation( return ConfigureResult::Failed; } else { using namespace PackageManager; - LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgname_NOTNULL); + LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgname); configureWidgetLocation(widgetSource, tempPath); // send start signal of pkgmgr PkgmgrSignalSingleton::Instance().setPkgname( - DPL::ToUTF8String(m_installerContext.widgetConfig.pkgname_NOTNULL)); - PkgmgrSignalSingleton::Instance().sendSignal(PKGMGR_START_KEY, - PKGMGR_START_INSTALL); + DPL::ToUTF8String( + *m_installerContext.widgetConfig.pkgname)); + PkgmgrSignalSingleton::Instance().sendSignal( + PKGMGR_START_KEY, + PKGMGR_START_INSTALL); } // Init installer context @@ -617,7 +624,7 @@ WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate( widgetGUID, widgetVersion, WidgetUpdateInfo::ExistingWidgetInfo( - dao.getPkgname_NOTNULL(), dao.getVersion())); + *dao.getPkgname(), dao.getVersion())); } Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) { @@ -660,7 +667,7 @@ void JobWidgetInstall::SendFinishedSuccess() //inform widget info JobWidgetInstall::displayWidgetInfo(); - DPL::String & tizenId = m_installerContext.widgetConfig.pkgname_NOTNULL; + DPL::OptionalString & tizenId = m_installerContext.widgetConfig.pkgname; // send signal of pkgmgr PkgmgrSignalSingleton::Instance().sendSignal( @@ -669,7 +676,7 @@ void JobWidgetInstall::SendFinishedSuccess() LogDebug("Call widget install successfinishedCallback"); getInstallerStruct().finishedCallback(getInstallerStruct().userParam, - DPL::ToUTF8String(tizenId), Exceptions::Success); + tizenId.IsNull() ? "" : DPL::ToUTF8String(*tizenId), Exceptions::Success); } void JobWidgetInstall::SendFinishedFailure() @@ -680,7 +687,7 @@ void JobWidgetInstall::SendFinishedFailure() LogError("Error in installation step: " << m_exceptionCaught); LogError("Message: " << m_exceptionMessage); - DPL::String & tizenId = m_installerContext.widgetConfig.pkgname_NOTNULL; + DPL::OptionalString & tizenId = m_installerContext.widgetConfig.pkgname; LogDebug("Call widget install failure finishedCallback"); @@ -690,7 +697,7 @@ void JobWidgetInstall::SendFinishedFailure() PKGMGR_END_FAILURE); getInstallerStruct().finishedCallback(getInstallerStruct().userParam, - DPL::ToUTF8String(tizenId), m_exceptionCaught); + tizenId.IsNull() ? "" : DPL::ToUTF8String(*tizenId), m_exceptionCaught); } void JobWidgetInstall::SaveExceptionData(const Jobs::JobExceptionBase &e) @@ -705,18 +712,18 @@ void JobWidgetInstall::displayWidgetInfo() std::ostringstream out; WidgetLocalizedInfo localizedInfo = - W3CFileLocalization::getLocalizedInfo(dao.getPkgname_NOTNULL()); + W3CFileLocalization::getLocalizedInfo(*dao.getPkgname()); out << std::endl << "===================================== INSTALLED WIDGET INFO ========="\ "============================"; out << std::endl << "Name: " << localizedInfo.name; - out << std::endl << "PkgName: " << dao.getPkgname_NOTNULL(); + out << std::endl << "PkgName: " << dao.getPkgname(); WidgetSize size = dao.getPreferredSize(); out << std::endl << "Width: " << size.width; out << std::endl << "Height: " << size.height; out << std::endl << "Start File: " << - W3CFileLocalization::getStartFile(dao.getPkgname_NOTNULL()); + W3CFileLocalization::getStartFile(*dao.getPkgname()); out << std::endl << "Version: " << dao.getVersion(); out << std::endl << "Licence: " << localizedInfo.license; @@ -731,7 +738,7 @@ void JobWidgetInstall::displayWidgetInfo() dao.isDistributorSigned(); out << std::endl << "Widget trusted: " << dao.isTrusted(); - OptionalWidgetIcon icon = W3CFileLocalization::getIcon(dao.getPkgname_NOTNULL()); + OptionalWidgetIcon icon = W3CFileLocalization::getIcon(*dao.getPkgname()); DPL::OptionalString iconSrc = !!icon ? icon->src : DPL::OptionalString::Null; out << std::endl << "Icon: " << iconSrc; diff --git a/src/jobs/widget_install/task_certificates.cpp b/src/jobs/widget_install/task_certificates.cpp index 99b613d..644419e 100755 --- a/src/jobs/widget_install/task_certificates.cpp +++ b/src/jobs/widget_install/task_certificates.cpp @@ -61,7 +61,7 @@ void TaskCertificates::StepSetCertiInfo() if ((pkgmgr_installer_save_certinfo( const_cast(DPL::ToUTF8String( - m_context.widgetConfig.pkgname_NOTNULL).c_str()), + *m_context.widgetConfig.pkgname).c_str()), m_pkgHandle)) < 0) { LogError("pkgmgrInstallerSaveCertinfo fail"); ThrowMsg(Exceptions::SetCertificateInfoFailed, @@ -163,7 +163,7 @@ void TaskCertificates::StepAbortCertiInfo() { if ((pkgmgr_installer_delete_certinfo( const_cast(DPL::ToUTF8String( - m_context.widgetConfig.pkgname_NOTNULL).c_str()))) < 0) { + *m_context.widgetConfig.pkgname).c_str()))) < 0) { LogError("pkgmgr_installer_delete_certinfo fail"); } } diff --git a/src/jobs/widget_install/task_encrypt_resource.cpp b/src/jobs/widget_install/task_encrypt_resource.cpp index bee8e00..2ea97ee 100644 --- a/src/jobs/widget_install/task_encrypt_resource.cpp +++ b/src/jobs/widget_install/task_encrypt_resource.cpp @@ -78,8 +78,8 @@ void TaskEncryptResource::StepEncryptResource() { LogDebug("Step Encrypt resource"); m_resEnc = new ResourceEncryptor; - m_resEnc->CreateEncryptionKey(DPL::ToUTF8String(m_context. - widgetConfig.pkgname_NOTNULL)); + m_resEnc->CreateEncryptionKey(DPL::ToUTF8String(*m_context. + widgetConfig.pkgname)); EncryptDirectory(m_context.locations->getTemporaryRootDir()); } diff --git a/src/jobs/widget_install/task_file_manipulation.cpp b/src/jobs/widget_install/task_file_manipulation.cpp index e8fccb4..759510e 100644 --- a/src/jobs/widget_install/task_file_manipulation.cpp +++ b/src/jobs/widget_install/task_file_manipulation.cpp @@ -47,7 +47,10 @@ TaskFileManipulation::TaskFileManipulation(InstallerContext& context) : void TaskFileManipulation::StepCreateDirs() { std::string widgetPath; - DPL::String pkgname = m_context.widgetConfig.pkgname_NOTNULL; + DPL::OptionalString pkgname = m_context.widgetConfig.pkgname; + if (pkgname.IsNull()) { + ThrowMsg(Exceptions::InternalError, "No Package name exists."); + } widgetPath = m_context.locations->getPackageInstallationDir(); @@ -74,7 +77,10 @@ void TaskFileManipulation::StepCreateDirs() void TaskFileManipulation::StepRenamePath() { std::string instDir; - DPL::String pkgname = m_context.widgetConfig.pkgname_NOTNULL; + DPL::OptionalString pkgname = m_context.widgetConfig.pkgname; + if (pkgname.IsNull()) { + ThrowMsg(Exceptions::InternalError, "No Package name exists."); + } if (m_context.widgetConfig.packagingType == PKG_TYPE_HYBRID_WEB_APP) { instDir = m_context.locations->getPackageInstallationDir(); diff --git a/src/jobs/widget_install/task_manifest_file.cpp b/src/jobs/widget_install/task_manifest_file.cpp index 6c583dc..3acb023 100644 --- a/src/jobs/widget_install/task_manifest_file.cpp +++ b/src/jobs/widget_install/task_manifest_file.cpp @@ -307,9 +307,12 @@ DPL::String TaskManifestFile::getIconTargetFilename( const DPL::String& languageTag) const { DPL::OStringStream filename; - DPL::String pkgname = m_context.widgetConfig.pkgname_NOTNULL; + DPL::Optional pkgname = m_context.widgetConfig.pkgname; + if (pkgname.IsNull()) { + ThrowMsg(Exceptions::InternalError, "No Package name exists."); + } - filename << DPL::ToUTF8String(pkgname).c_str(); + filename << DPL::ToUTF8String(*pkgname).c_str(); if (!languageTag.empty()) { DPL::OptionalString tag = getLangTag(languageTag); // translate en -> en_US etc @@ -353,7 +356,7 @@ void TaskManifestFile::updateAilInfo() { // Update ail for desktop std::string cfgPkgname = - DPL::ToUTF8String(m_context.widgetConfig.pkgname_NOTNULL); + DPL::ToUTF8String(*m_context.widgetConfig.pkgname); const char* pkgname = cfgPkgname.c_str(); LogDebug("Update ail desktop : " << pkgname ); @@ -388,7 +391,7 @@ void TaskManifestFile::backupIconFiles() std::list fileList; getFileList(GlobalConfig::GetUserWidgetDesktopIconPath(), fileList); - std::string pkgname = DPL::ToUTF8String(m_context.widgetConfig.pkgname_NOTNULL); + std::string pkgname = DPL::ToUTF8String(*m_context.widgetConfig.pkgname); FOREACH(it, fileList) { @@ -457,7 +460,7 @@ void TaskManifestFile::getFileList(const char* path, void TaskManifestFile::stepGenerateManifest() { - DPL::String pkgname = m_context.widgetConfig.pkgname_NOTNULL; + DPL::String pkgname = *m_context.widgetConfig.pkgname; manifest_name = pkgname + L".xml"; manifest_file += L"/tmp/" + manifest_name; @@ -585,9 +588,11 @@ void TaskManifestFile::setWidgetName(Manifest & manifest, UiApplication & uiApp) } //appid DPL::String pkgname; - - pkgname = m_context.widgetConfig.pkgname_NOTNULL; - uiApp.setAppid(pkgname); + if(!!m_context.widgetConfig.pkgname) + { + pkgname = *m_context.widgetConfig.pkgname; + uiApp.setAppid(pkgname); + } //extraid if(!!m_context.widgetConfig.guid) { @@ -632,7 +637,10 @@ void TaskManifestFile::generateWidgetName(Manifest & manifest, UiApplication &ui void TaskManifestFile::setWidgetIcons(UiApplication & uiApp) { - DPL::String pkgname = m_context.widgetConfig.pkgname_NOTNULL; + DPL::OptionalString pkgname = m_context.widgetConfig.pkgname; + if (pkgname.IsNull()) { + ThrowMsg(Exceptions::InternalError, "No Package name exists."); + } //TODO this file will need to be updated when user locale preferences //changes. @@ -700,8 +708,10 @@ void TaskManifestFile::generateWidgetIcon(UiApplication & uiApp, const DPL::Opti void TaskManifestFile::setWidgetManifest(Manifest & manifest) { - manifest.setPackage(m_context.widgetConfig.pkgname_NOTNULL); - + if(!!m_context.widgetConfig.pkgname) + { + manifest.setPackage(*m_context.widgetConfig.pkgname); + } if(!!m_context.widgetConfig.version) { manifest.setVersion(*m_context.widgetConfig.version); diff --git a/src/jobs/widget_install/task_private_storage.cpp b/src/jobs/widget_install/task_private_storage.cpp index 4dae81e..8d9934f 100644 --- a/src/jobs/widget_install/task_private_storage.cpp +++ b/src/jobs/widget_install/task_private_storage.cpp @@ -64,9 +64,12 @@ void TaskPrivateStorage::StepCreateDirectory() InstallerContext::INSTALL_CREATE_PRIVATE_STORAGE; std::ostringstream widgetPath; - DPL::String pkgname = m_context.widgetConfig.pkgname_NOTNULL; - - widgetPath << m_context.locations->getPackageInstallationDir() << "/"; + DPL::OptionalString pkgname = m_context.widgetConfig.pkgname; + if(!pkgname.IsNull()) { + widgetPath << m_context.locations->getPackageInstallationDir() << "/"; + } else { + ThrowMsg(Exceptions::InternalError, "No Package name exists."); + } if (euidaccess(widgetPath.str().c_str(), W_OK | X_OK) != 0) { ThrowMsg(Exceptions::InternalError, DPL::GetErrnoString()); diff --git a/src/jobs/widget_install/task_smack.cpp b/src/jobs/widget_install/task_smack.cpp index 98b55a4..7c36c65 100644 --- a/src/jobs/widget_install/task_smack.cpp +++ b/src/jobs/widget_install/task_smack.cpp @@ -53,9 +53,10 @@ void TaskSmack::Step() devcaps << utf8; } } - DPL::String pkgName = m_context.widgetConfig.pkgname; + DPL::OptionalString pkgName = m_context.widgetConfig.Pkgname; + Assert(!pkgName.IsNull() && "widget doesn't have a pkg name"); int result = handle_access_control_conf_forWAC( - DPL::ToUTF8String(pkgName).c_str(), + DPL::ToUTF8String(*pkgName).c_str(), devcaps.str().c_str(), OPERATION_INSTALL); Assert(result==PC_OPERATION_SUCCESS && "access control setup failed"); diff --git a/src/jobs/widget_install/task_widget_config.cpp b/src/jobs/widget_install/task_widget_config.cpp index 5deefb4..1d7f093 100644 --- a/src/jobs/widget_install/task_widget_config.cpp +++ b/src/jobs/widget_install/task_widget_config.cpp @@ -813,9 +813,13 @@ bool TaskWidgetConfig::fillWidgetConfig(WrtDB::WidgetRegisterInfo& pWidgetConfig } } if (!!configInfo.tizenId) { - if (pWidgetConfigInfo.pkgname_NOTNULL != *configInfo.tizenId) { - LogError("Invalid archive - Tizen ID not same error"); - return false; + if (!pWidgetConfigInfo.pkgname) { + pWidgetConfigInfo.pkgname = configInfo.tizenId; + } else { + if (pWidgetConfigInfo.pkgname != configInfo.tizenId) { + LogError("Invalid archive - Tizen ID not same error"); + return false; + } } } if (!!configInfo.version) { diff --git a/src/jobs/widget_uninstall/task_smack.cpp b/src/jobs/widget_uninstall/task_smack.cpp index 0dcf75a..c6c1a57 100644 --- a/src/jobs/widget_uninstall/task_smack.cpp +++ b/src/jobs/widget_uninstall/task_smack.cpp @@ -43,10 +43,11 @@ void TaskSmack::Step() #ifdef WRT_SMACK_ENABLED try { WrtDB::WidgetDAOReadOnly dao(m_context.locations->getPkgname()); - DPL::String pkgName = dao.getPkgname_NOTNULL(); + DPL::OptionalString pkgName = dao.getPkgname(); + Assert(!pkgName.IsNull() && "widget doesn't have a pkg name"); const char *devCap = ""; int result = handle_access_control_conf_forWAC( - DPL::ToUTF8String(pkgName).c_str(), + DPL::ToUTF8String(*pkgName).c_str(), NULL, OPERATION_UNINSTALL); Assert(result==PC_OPERATION_SUCCESS && "access control setup failed"); diff --git a/src/pkg-manager/backendlib.cpp b/src/pkg-manager/backendlib.cpp index 1861b94..27af8cb 100644 --- a/src/pkg-manager/backendlib.cpp +++ b/src/pkg-manager/backendlib.cpp @@ -91,7 +91,7 @@ static int pkg_plugin_get_installed_apps_list(const char * /*category*/, WrtDB::WrtDatabase::attachToThreadRO(); - WidgetPkgNameList_NOTNULL pkgnameslList = WidgetDAOReadOnly::getPkgnameList_NOTNULL(); + WidgetPkgNameList pkgnameslList = WidgetDAOReadOnly::getPkgnameList(); *count = 0; FOREACH(iterator, pkgnameslList) { @@ -106,7 +106,7 @@ static int pkg_plugin_get_installed_apps_list(const char * /*category*/, pkg_last->next = pkg_info; } - WidgetPkgName pkgname = *iterator; + WidgetPkgName pkgname = **iterator; WidgetDAOReadOnly widget(pkgname); strncpy(pkg_info->pkg_type, "wgt", PKG_TYPE_STRING_LEN_MAX); snprintf(pkg_info->pkg_name, PKG_NAME_STRING_LEN_MAX, "%s", diff --git a/src/wrt-installer/wrt_installer_api.cpp b/src/wrt-installer/wrt_installer_api.cpp index 259ca7d..95d59ab 100755 --- a/src/wrt-installer/wrt_installer_api.cpp +++ b/src/wrt-installer/wrt_installer_api.cpp @@ -582,7 +582,7 @@ extern "C" WidgetGUID widget_guid = DPL::FromUTF8String(guid); WrtDB::WidgetDAOReadOnly dao(widget_guid); - pkgname = DPL::ToUTF8String(dao.getPkgname_NOTNULL()); + pkgname = DPL::ToUTF8String(*dao.getPkgname()); return WRT_SUCCESS; } catch (WidgetDAOReadOnly::Exception::WidgetNotExist) -- 2.7.4