bool distributor_signatures = std::any_of(
signature_files.begin(), signature_files.end(), CheckDistSignature);
- if (!is_preload && (!author_signatures || !distributor_signatures)) {
+ /* For platform update from 2.4. signature1.xml of user app has deleted */
+ if (getuid() != 0 && (!author_signatures || !distributor_signatures)) {
LOG(ERROR) << "Author or distribuor signature is missing.";
return false;
}
#include "common/request.h"
#include "common/utils/file_util.h"
+#include "common/utils/user_util.h"
namespace bf = boost::filesystem;
namespace configuration {
const char kStrEmpty[] = "";
+const char kAppFWUser[] = "app_fw";
StepConfigure::StepConfigure(InstallerContext* context, PkgMgrPtr pkgmgr)
: Step(context),
context_->uid.set(pkgmgr_->GetUid());
if (getuid() == 0) {
if (pkgmgr_->GetRequestType() == RequestType::ManifestDirectInstall ||
- pkgmgr_->GetRequestType() == RequestType::ManifestDirectUpdate) {
- LOG(INFO) << "Allowing installation from root user for "
- "manifest direct mode.";
+ pkgmgr_->GetRequestType() == RequestType::ManifestDirectUpdate ||
+ pkgmgr_->GetRequestType() == RequestType::DisablePkg ||
+ pkgmgr_->GetRequestType() == RequestType::EnablePkg) {
+ LOG(INFO) << "Allowing operation for root user";
} else if (context_->is_preload_request.get()) {
- LOG(INFO) << "Allowing installation from root user for "
- "preload request mode.";
+ LOG(INFO) << "Allowing preload request mode for root user";
} else {
LOG(ERROR) << "App-installer should not run with superuser!";
return Status::OPERATION_NOT_ALLOWED;
}
- } else {
- if (pkgmgr_->GetRequestType() == RequestType::ManifestDirectInstall ||
- pkgmgr_->GetRequestType() == RequestType::ManifestDirectUpdate) {
- if (context_->is_preload_request.get()) {
- LOG(ERROR) << "Direct manifest installation/update that is run from "
- "non-root user cannot be a preload request";
- return Status::OPERATION_NOT_ALLOWED;
- }
- } else if (context_->is_preload_request.get()) {
- LOG(ERROR) << "Non-root user cannot request preload request mode.";
- return Status::OPERATION_NOT_ALLOWED;
- }
}
+
+ boost::optional<uid_t> appfw_uid= GetUidByUserName(kAppFWUser);
+ if (!appfw_uid)
+ return Status::ERROR;
+
+ if (getuid() != *appfw_uid) {
+ LOG(ERROR) << "App-installer should not run with normal user!";
+ return Status::OPERATION_NOT_ALLOWED;
+ }
+
return Status::OK;
}
xml_path += ".xml";
context_->xml_path.set(xml_path);
manifest = context_->xml_path.get();
+ if (!boost::filesystem::exists(manifest)) {
+ /* This routine has added for platform update */
+ manifest = context_->unpacked_dir_path.get();
+ manifest /= kManifestFileName;
+ }
break;
}
case ManifestLocation::PACKAGE: {
if (pkg_info->type().empty()) {
common_installer::RequestType req_type = context_->request_type.get();
- if (req_type == RequestType::ManifestDirectInstall ||
- req_type == RequestType::ManifestDirectUpdate) {
+ if ((req_type == RequestType::ManifestDirectInstall ||
+ req_type == RequestType::ManifestDirectUpdate) &&
+ context_->is_preload_request.get())
manifest->type = strdup("rpm");
- if (!context_->is_preload_request.get()) {
- LOG(ERROR) << "Non-preload rpm installation not allowed";
- return false;
- }
- } else {
+ else
manifest->type = strdup("tpk");
- }
} else {
manifest->type = strdup(pkg_info->type().c_str());
}