RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS,
"Failed to reset passwd of user: " << getuid() << " with ret: " << ret);
+
+ auth_passwd_disable_policy(getuid());
}
RUNNER_TEST(T00111_check)
RUNNER_TEST(T00114_set)
{
- sleep_for_retry_timeout();
-
const char *new_pass = "new_pass_temp";
- int ret = auth_passwd_set_passwd(
- AUTH_PWD_NORMAL,
- default_pass,
- new_pass);
-
- RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS,
- "Failed to auth_passwd_set_passwd. ret: " << ret);
-
sleep_for_retry_timeout();
+ int ret = auth_passwd_set_passwd(AUTH_PWD_NORMAL, default_pass, new_pass);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set passwd. ret: " << ret);
- /* roll back passwd to default pass */
- ret = auth_passwd_set_passwd(
- AUTH_PWD_NORMAL,
- new_pass,
- default_pass);
+ /* remove passwd */
+ sleep_for_retry_timeout();
+ ret = auth_passwd_set_passwd(AUTH_PWD_NORMAL, new_pass, NULL);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set passwd. ret: " << ret);
- RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS,
- "Failed to auth_passwd_set_passwd for rollback. ret: " << ret);
+ /* rollback passwd to default pass */
+ sleep_for_retry_timeout();
+ ret = auth_passwd_set_passwd(AUTH_PWD_NORMAL, NULL, default_pass);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set passwd. ret: " << ret);
}
RUNNER_TEST(T00115_check_passwd_available)
{
- policy_h *policy = nullptr;
+ policy_h *policy = nullptr;
const char* not_usable_passwd = "123456";
const char* usable_passwd = "tizen";
auth_passwd_free_policy(policy);
}
+
+RUNNER_TEST(T00116_remove_password_with_empty_policy)
+{
+ /* precondition : set empty policy */
+ policy_h *policy = nullptr;
+ int ret = auth_passwd_new_policy(&policy);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to make new policy. ret: " << ret);
+
+ ret = auth_passwd_set_user(policy, getuid());
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set user. ret: " << ret);
+
+ ret = auth_passwd_set_policy(policy);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set policy. ret: " << ret);
+
+ /* test : remove passwd with empty policy */
+ sleep_for_retry_timeout();
+ ret = auth_passwd_set_passwd(AUTH_PWD_NORMAL, default_pass, NULL);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set passwd. ret: " << ret);
+
+ /* restore */
+ ret = auth_passwd_disable_policy(getuid());
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to disable policy. ret: " << ret);
+ auth_passwd_free_policy(policy);
+
+ sleep_for_retry_timeout();
+ ret = auth_passwd_set_passwd(AUTH_PWD_NORMAL, NULL, default_pass);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set passwd. ret: " << ret);
+}
+
+RUNNER_TEST(T00117_remove_password_with_min_length_policy)
+{
+ /* precondition : set min-length policy */
+ policy_h *policy = nullptr;
+ int ret = auth_passwd_new_policy(&policy);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to make new policy. ret: " << ret);
+
+ ret = auth_passwd_set_user(policy, getuid());
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set user. ret: " << ret);
+
+ ret = auth_passwd_set_min_length(policy, 4);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set min length. ret: " << ret);
+
+ ret = auth_passwd_set_policy(policy);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set policy. ret: " << ret);
+
+ /* test : remove passwd with min-length policy */
+ sleep_for_retry_timeout();
+ ret = auth_passwd_set_passwd(AUTH_PWD_NORMAL, default_pass, NULL);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set passwd. ret: " << ret);
+
+ /* restore */
+ ret = auth_passwd_disable_policy(getuid());
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to disable policy. ret: " << ret);
+ auth_passwd_free_policy(policy);
+
+ sleep_for_retry_timeout();
+ ret = auth_passwd_set_passwd(AUTH_PWD_NORMAL, NULL, default_pass);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set passwd. ret: " << ret);
+}
+
+RUNNER_TEST(T00118_remove_password_with_min_complex_char_policy)
+{
+ /* precondition : set min-complex-char policy */
+ policy_h *policy = nullptr;
+ int ret = auth_passwd_new_policy(&policy);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to make new policy. ret: " << ret);
+
+ ret = auth_passwd_set_user(policy, getuid());
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set user. ret: " << ret);
+
+ ret = auth_passwd_set_min_complex_char_num(policy, AUTH_PWD_COMPLEX_CHAR_GROUP_1);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set min complex. ret: " << ret);
+
+ ret = auth_passwd_set_policy(policy);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set policy. ret: " << ret);
+
+ /* test : remove passwd with min-complex-char policy */
+ sleep_for_retry_timeout();
+ ret = auth_passwd_set_passwd(AUTH_PWD_NORMAL, default_pass, NULL);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set passwd. ret: " << ret);
+
+ /* restore */
+ ret = auth_passwd_disable_policy(getuid());
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to disable policy. ret: " << ret);
+ auth_passwd_free_policy(policy);
+
+ sleep_for_retry_timeout();
+ ret = auth_passwd_set_passwd(AUTH_PWD_NORMAL, NULL, default_pass);
+ RUNNER_ASSERT_MSG(ret == AUTH_PASSWD_API_SUCCESS, "Failed to set passwd. ret: " << ret);
+}