auto reset_passwd_function = [] () -> int {
return auth_passwd_reset_passwd(AUTH_PWD_NORMAL, test::get_test_uid(false), default_pass);
};
- if(access(org_tizen_setting_main,F_OK) == 0){
- TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_setting_main,
- AUTH_PASSWD_API_ERROR_ACCESS_DENIED, reset_passwd_function));
- }else{
- std::cout << "reset_passwd_function in reset_passwd_privileg() skipped" << ", appId=" << org_tizen_setting_main << std::endl;
- }
-
- if(access(org_tizen_apps,F_OK) == 0){
- TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_apps,
- AUTH_PASSWD_API_SUCCESS, reset_passwd_function));
- }else{
- std::cout << "reset_passwd_function in reset_passwd_privileg() skipped" << ", appId=" << org_tizen_apps << std::endl;
- }
+
+ TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_setting_main,
+ AUTH_PASSWD_API_ERROR_ACCESS_DENIED, reset_passwd_function));
+
+ TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_apps,
+ AUTH_PASSWD_API_SUCCESS, reset_passwd_function));
TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_SYSTEM, "",
AUTH_PASSWD_API_SUCCESS, reset_passwd_function));
return auth_passwd_set_policy(policy);;
};
- if(access(org_tizen_setting_main,F_OK) == 0){
- TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_setting_main,
- AUTH_PASSWD_API_ERROR_ACCESS_DENIED, set_policy_function));
- }else{
- std::cout << "set_policy_function in set_policy_privilege() skipped" << ", appId=" << org_tizen_setting_main << std::endl;
- }
-
- if(access(org_tizen_apps,F_OK) == 0){
- TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_apps,
- AUTH_PASSWD_API_SUCCESS, set_policy_function));
- }else{
- std::cout << "set_policy_function in set_policy_privilege() skipped" << ", appId=" << org_tizen_apps << std::endl;
- }
+
+ TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_setting_main,
+ AUTH_PASSWD_API_ERROR_ACCESS_DENIED, set_policy_function));
+
+ TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_apps,
+ AUTH_PASSWD_API_SUCCESS, set_policy_function));
+
TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_SYSTEM, "",
AUTH_PASSWD_API_SUCCESS, set_policy_function));
TEST_EXPECT(AUTH_PASSWD_API_SUCCESS, ret);
ret = auth_passwd_disable_policy(AUTH_PWD_NORMAL, test::get_test_uid(true));
TEST_EXPECT(AUTH_PASSWD_API_SUCCESS, ret);
- if(access(org_tizen_setting_main,F_OK) == 0){
- TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_setting_main,
- AUTH_PASSWD_API_ERROR_ACCESS_DENIED, check_passwd_function));
- }else{
- std::cout << "check_passwd_function in check_passwd_privilege() skipped" << ", appId=" << org_tizen_setting_main << std::endl;
- }
- if(access(org_tizen_apps,F_OK) == 0){
- TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_apps,
- AUTH_PASSWD_API_SUCCESS, check_passwd_function));
- }else{
- std::cout << "check_passwd_function in check_passwd_privilege() skipped" << ", appId=" << org_tizen_apps << std::endl;
- }
+
+ TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_setting_main,
+ AUTH_PASSWD_API_ERROR_ACCESS_DENIED, check_passwd_function));
+
+ TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_apps,
+ AUTH_PASSWD_API_SUCCESS, check_passwd_function));
+
TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_SYSTEM, "",
AUTH_PASSWD_API_SUCCESS, check_passwd_function));
return auth_passwd_set_passwd(AUTH_PWD_NORMAL, default_pass, AUTH_PWD_NORMAL, NULL);
};
- if(access(org_tizen_setting_main,F_OK) == 0){
- int ret = auth_passwd_reset_passwd(AUTH_PWD_NORMAL, test::get_test_uid(true), default_pass);
- TEST_EXPECT(AUTH_PASSWD_API_SUCCESS, ret);
- TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_setting_main,
- AUTH_PASSWD_API_ERROR_ACCESS_DENIED, set_passwd_function));
- }else{
- std::cout << "set_passwd_function in set_passwd_privilege() skipped" << ", appId=" << org_tizen_setting_main << std::endl;
- }
-
- if(access(org_tizen_apps,F_OK) == 0){
- int ret = auth_passwd_reset_passwd(AUTH_PWD_NORMAL, test::get_test_uid(true), default_pass);
- TEST_EXPECT(AUTH_PASSWD_API_SUCCESS, ret);
- TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_apps,
- AUTH_PASSWD_API_SUCCESS, set_passwd_function));
- }else{
- std::cout << "set_passwd_function in set_passwd_privilege() skipped" << ", appId=" << org_tizen_apps << std::endl;
- }
- int ret = auth_passwd_reset_passwd(AUTH_PWD_NORMAL, test::get_test_uid(false), default_pass);
+ int ret = auth_passwd_reset_passwd(AUTH_PWD_NORMAL, test::get_test_uid(true), default_pass);
+ TEST_EXPECT(AUTH_PASSWD_API_SUCCESS, ret);
+ TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_setting_main,
+ AUTH_PASSWD_API_ERROR_ACCESS_DENIED, set_passwd_function));
+
+ ret = auth_passwd_reset_passwd(AUTH_PWD_NORMAL, test::get_test_uid(true), default_pass);
+ TEST_EXPECT(AUTH_PASSWD_API_SUCCESS, ret);
+ TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_APP, org_tizen_apps,
+ AUTH_PASSWD_API_SUCCESS, set_passwd_function));
+
+ ret = auth_passwd_reset_passwd(AUTH_PWD_NORMAL, test::get_test_uid(false), default_pass);
TEST_EXPECT(AUTH_PASSWD_API_SUCCESS, ret);
TEST_EXPECT(true, test::run_in_process(SM_PROCESS_TYPE_SYSTEM, "",
AUTH_PASSWD_API_SUCCESS, set_passwd_function));
#include <app-runtime.h>
+#include <unistd.h>
+#include <sys/types.h>
+
namespace test {
policy_h *create_policy_h();
using ScopedPolicy = std::unique_ptr<policy_h, decltype(&auth_passwd_free_policy)>;
+constexpr int APP_UID = 5001;
+
template<typename Functor>
bool run_in_process(process_type ptype, const std::string& appId, int expected, Functor functor)
{
if(ret != SECURITY_MANAGER_SUCCESS) {
std::cout << "security_manager_set_identity() failed... ret=" << ret
- << ", appId=" << appId << std::endl;
- exit(2); // error case
+ << ", appId=" << appId << ",... Not Supported TC. Skipping..." << std::endl;
+ exit(0); // Skipping
}
+
+ if (ptype == SM_PROCESS_TYPE_APP) {
+ setuid(APP_UID); // Do not check the return code
+ }
+
ret = functor();
if(ret != expected) {
std::cout << "The test in separated process failed..."