/*
- * Copyright (c) 2014-2019 Samsung Electronics Co., Ltd. All rights reserved
+ * Copyright (c) 2014-2020 Samsung Electronics Co., Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
void install(const InstallRequest &request, lib_retcode expectedResult)
{
- uid_t uid = getuid();
- std::string dbPath = uid == 0 ? "/opt/dbspace/" : "/opt/dbspace/user/" + std::to_string(uid) + "/";
-
- std::ostringstream command;
- command << "/usr/bin/sqlite3 "
- << dbPath << ".pkgmgr_parser.db "
- << " \"insert into package_info (package, package_type, package_api_version,"
- << " install_location, mainapp_id, root_path, installed_storage)"
- << " values ('" << request.getPkgId() << "', 'tpk', '" << request.getAppTizenVersion()
- << "', 'auto', '" << request.getPkgId() << "', '/opt/usr/globallapps/"
- << request.getPkgId() << "', 'installed_internal')\"";
- int pkgmgrResult = system(command.str().c_str());
- RUNNER_ASSERT_MSG(pkgmgrResult == 0, "failed to set package_info: " << pkgmgrResult);
-
int result = security_manager_app_install(request.get());
- command = std::ostringstream();
- command << "/usr/bin/sqlite3 "
- << dbPath << ".pkgmgr_parser.db "
- << " \"delete from package_info where package='" << request.getPkgId() << "'\"";
- pkgmgrResult = system(command.str().c_str());
-
RUNNER_ASSERT_MSG((lib_retcode)result == expectedResult,
"installing app returned wrong value."
<< " InstallRequest: [ " << request << "];"
<< " Result: " << result << ";"
<< " Expected result: " << expectedResult);
-
- RUNNER_ASSERT_MSG(pkgmgrResult == 0, "failed to unset package_info: " << pkgmgrResult);
}
void update(const InstallRequest &request, lib_retcode expectedResult)
/*
- * Copyright (c) 2014-2019 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2014-2020 Samsung Electronics Co., Ltd All Rights Reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
"creation of new request failed. Result: " << result);
RUNNER_ASSERT_MSG(m_req != nullptr, "creation of new request did not allocate memory");
+ // platform level has the widest possible privilege spectrum available, hence using it for all apps
+ result = security_manager_app_inst_req_set_pkg_privilege_level(m_req, SM_PKG_PRIVILEGE_LEVEL_PLATFORM);
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ "setting privilege level failed. Result: " << result);
+ // core seems to map to TPK, which is what we're mimicking
+ result = security_manager_app_inst_req_set_pkg_type(m_req, SM_PKG_TYPE_CORE);
+ RUNNER_ASSERT_MSG((lib_retcode)result == SECURITY_MANAGER_SUCCESS,
+ "setting package type. Result: " << result);
}
InstallRequest::~InstallRequest()