* @file security_server_tests_password.cpp
* @author Bumjin Im (bj.im@samsung.com)
* @author Pawel Polawski (p.polawski@partner.samsung.com)
+ * @author Radoslaw Bartosiak (r.bartosiak@samsung.com)
* @version 2.0
* @brief Test cases for security server
*
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
+#include <string.h>
+#include <limits.h>
#include <sys/types.h>
#include <sys/param.h>
#include <fcntl.h>
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(expire_sec == 0);
- RUNNER_ASSERT(max_attempt == 0);
- RUNNER_ASSERT(attempt == 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD);
+ RUNNER_ASSERT_MSG(expire_sec == 0, "expire_sec = " << expire_sec);
+ RUNNER_ASSERT_MSG(max_attempt == 0, "max_attempt = " << max_attempt);
+ RUNNER_ASSERT_MSG(attempt == 0, "attempt = " << attempt);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
}
else
{
int ret;
ret = security_server_set_pwd_validity(10);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
ret = security_server_set_pwd_validity(11);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
}
RUNNER_TEST(tc03_security_server_set_pwd_max_challenge)
int ret;
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(6);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
}
RUNNER_TEST(tc04_security_server_chk_pwd_too_long_password_case)
unsigned int attempt, max_attempt, expire_sec;
ret = security_server_chk_pwd("abcdefghijklmnopqrstuvwxyz0123456", &attempt, &max_attempt, &expire_sec); /* 33 chars */
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
RUNNER_TEST(tc05_security_server_chk_pwd_null_input_case)
unsigned int attempt, max_attempt, expire_sec;
ret = security_server_chk_pwd(NULL, &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_chk_pwd("password", NULL, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_chk_pwd("password", &attempt, NULL, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
ret = security_server_chk_pwd("password", &attempt, &max_attempt, NULL);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
RUNNER_TEST(tc06_security_server_chk_pwd_no_password_case)
sleep(1);
ret = security_server_chk_pwd("isthisempty", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(expire_sec == 0);
- RUNNER_ASSERT(max_attempt == 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD);
+ RUNNER_ASSERT_MSG(expire_sec == 0, expire_sec);
+ RUNNER_ASSERT_MSG(max_attempt == 0, max_attempt);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_NO_PASSWORD, "ret = " << ret);
}
RUNNER_TEST(tc07_security_server_set_pwd_null_input_case)
int ret;
ret = security_server_set_pwd(NULL, NULL, 0, 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
RUNNER_TEST(tc08_security_server_set_pwd_too_long_input_param)
int ret;
ret = security_server_set_pwd("abcdefghijklmnopqrstuvwxyz0123456", "abcdefghijklmnopqrstuvwxyz0123456", 0, 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
}
RUNNER_TEST(tc09_security_server_set_pwd_current_pwd_empty)
{
int ret;
-
sleep(1);
ret = security_server_set_pwd(NULL, "12345", 0, 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+}
+
+RUNNER_TEST(tc10_security_server_set_pwd_current_pwd_max_valid_period_in_days)
+{
+ int ret;
+ sleep(1);
+ ret = security_server_set_pwd("12345", "12345", 0, UINT_MAX);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+}
+
+RUNNER_TEST(tc11_security_server_set_pwd_current_pwd_max_max_challenge)
+{
+ int ret;
+ sleep(1);
+ ret = security_server_set_pwd("12345", "12345", UINT_MAX, 0);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+}
+
+RUNNER_TEST(tc12_security_server_set_pwd_current_pwd_nonempty2zero)
+{
+ int ret;
+ sleep(1);
+ ret = security_server_set_pwd("12345", "", 0, 0);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+}
+
+RUNNER_TEST(tc13_security_server_set_pwd_current_pwd_zero2nonempty)
+{
+ int ret;
+ sleep(1);
+ ret = security_server_set_pwd("", "1234", 0, 0);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
-RUNNER_TEST(tc10_security_server_set_pwd_validity)
+RUNNER_TEST(tc14_security_server_set_pwd_current_pwd_too_long_input_param)
{
int ret;
+ sleep(1);
+ /*long password*/
+ char* long_password = (char*) malloc(5001);
+ long_password[5000] = '\0';
+ memset(long_password, 'A', 5000);
+ ret = security_server_set_pwd("12345",long_password, 0, 0);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+}
+
+RUNNER_TEST(tc15_security_server_chk_pwd_shortest_password)
+{
+ int ret;
+ unsigned int attempt, max_attempt, expire_sec;
+ ret = security_server_chk_pwd("", &attempt, &max_attempt, &expire_sec);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+}
+
+RUNNER_TEST(tc16_security_server_set_pwd_validity)
+{
+ int ret;
+
+ ret = security_server_set_pwd_validity(0);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_validity(1);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+
+ ret = security_server_set_pwd_validity(UINT_MAX);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_validity(2);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+
}
-RUNNER_TEST(tc11_security_server_is_pwd_valid)
+RUNNER_TEST(tc17_security_server_is_pwd_valid)
{
int ret;
unsigned int attempt, max_attempt, expire_sec;
sleep(1);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST);
- RUNNER_ASSERT((expire_sec > 172795) && (expire_sec < 172805));
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG((expire_sec > 172795) && (expire_sec < 172805), "expire_sec = " << expire_sec);
}
-RUNNER_TEST(tc12_security_server_set_pwd_max_challenge)
+RUNNER_TEST(tc18_security_server_set_pwd_max_challenge)
{
int ret;
+ ret = security_server_set_pwd_max_challenge(0);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+
+ ret = security_server_set_pwd_max_challenge(UINT_MAX);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+
ret = security_server_set_pwd_max_challenge(5);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = security_server_set_pwd_max_challenge(6);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+
+
}
-RUNNER_TEST(tc13_security_server_is_pwd_valid)
+RUNNER_TEST(tc19_security_server_is_pwd_valid)
{
int ret;
unsigned int attempt, max_attempt, expire_sec;
sleep(1);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- //printf("RET: %d\r\n", ret);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST);
- RUNNER_ASSERT(max_attempt == 6);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG(max_attempt == 6, "max_attempt = " << max_attempt);
}
-RUNNER_TEST(tc14_security_server_chk_pwd)
+RUNNER_TEST(tc20_security_server_chk_pwd)
{
int ret;
unsigned int attempt, max_attempt, expire_sec;
sleep(1);
- //password bellow must be the same as in tc09
+ //password bellow must be the same as in tc13
ret = security_server_chk_pwd("12345", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, ret);
sleep(1);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
//printf("RET: %d\r\n", ret);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
}
-RUNNER_TEST(tc15_security_server_chk_incorrect_pwd)
+RUNNER_TEST(tc21_security_server_chk_incorrect_pwd)
{
int ret;
unsigned int attempt, max_attempt, expire_sec;
sleep(1);
- //password here should not match the one from tc14 and tc09
+ //password here should not match the one from tc20 and tc13
ret = security_server_chk_pwd("02345", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
}
-RUNNER_TEST(tc16_security_server_set_pwd_incorrect_current)
+RUNNER_TEST(tc22_security_server_set_pwd_incorrect_current)
{
int ret;
sleep(1);
- //1st password here should not match the one from tc14 and tc09
+ //1st password here should not match the one from tc20 and tc13
ret = security_server_set_pwd("02345", "abcde", 0, 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
}
-RUNNER_TEST(tc17_security_server_set_pwd_correct_current)
+RUNNER_TEST(tc23_security_server_set_pwd_correct_current)
{
int ret;
sleep(1);
- //1st password here should match the one from tc14 and tc09
+ //1st password here should match the one from tc20 and tc13
ret = security_server_set_pwd("12345", "abcde", 0, 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
-RUNNER_TEST(tc18_security_server_attempt_exceeding)
+RUNNER_TEST(tc24_security_server_attempt_exceeding)
{
int ret;
int i;
sleep(1);
ret = security_server_set_pwd("abcde", "12345", 10, 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
printf("5 subtests started...");
for (i = 0; i < 5; i++) {
sleep(1);
ret = security_server_chk_pwd("abcde", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH);
- RUNNER_ASSERT(attempt == i + 1);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG(attempt == i + 1, attempt);
}
printf("DONE\n");
sleep(1);
ret = security_server_chk_pwd("12345", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST);
- RUNNER_ASSERT(attempt == 0);
- RUNNER_ASSERT(max_attempt == 10);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG(attempt == 0, "ret = " << ret);
+ RUNNER_ASSERT_MSG(max_attempt == 10, "ret = " << ret);
}
-RUNNER_TEST(tc19_security_server_attempt_exceeding)
+RUNNER_TEST(tc25_security_server_attempt_exceeding)
{
int ret;
int i;
sleep(1);
ret = security_server_chk_pwd("abcde", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH);
- RUNNER_ASSERT(attempt == i + 1);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
+ RUNNER_ASSERT_MSG(attempt == i + 1, "attempt = " << attempt);
}
printf("DONE\n");
sleep(1);
ret = security_server_chk_pwd("12345", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MAX_ATTEMPTS_EXCEEDED);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MAX_ATTEMPTS_EXCEEDED, "ret = " << ret);
}
-RUNNER_TEST(tc20_security_server_reset_pwd)
+RUNNER_TEST(tc26_security_server_reset_pwd)
{
int ret;
sleep(1);
- ret = security_server_reset_pwd("12345",0, 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ ret = security_server_reset_pwd("12345", 0, 0);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
-RUNNER_TEST(tc21_security_server_check_expiration)
+RUNNER_TEST(tc27_security_server_chk_pwd_too_long_password)
+{
+ int ret;
+ unsigned int attempt, max_attempt, expire_sec;
+ sleep(1);
+ /*long password*/
+ char* long_password = (char*) malloc(5001);
+ long_password[5000] = '\0';
+ memset(long_password, 'A', 5000);
+ //1st password here should not match the one from tc20 and tc13
+ ret = security_server_chk_pwd(long_password, &attempt, &max_attempt, &expire_sec);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+}
+
+RUNNER_TEST(tc28_security_server_check_expiration)
{
int ret;
unsigned int attempt, max_attempt, expire_sec;
sleep(1);
ret = security_server_set_pwd("12345", "abcde", 10, 1);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_is_pwd_valid(&attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST);
- RUNNER_ASSERT((expire_sec < 86402) && (expire_sec > 86396));
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXIST, "ret = " << ret);
+ RUNNER_ASSERT_MSG((expire_sec < 86402) && (expire_sec > 86396), "expire_sec = " << ret);
}
-RUNNER_TEST(tc23_security_server_set_pwd_history)
+RUNNER_TEST(tc29_security_server_set_pwd_history)
{
int ret;
sleep(1);
ret = security_server_set_pwd_history(100);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+
+ sleep(1);
+ ret = security_server_set_pwd_history(51);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+
sleep(1);
ret = security_server_set_pwd_history(-5);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_INPUT_PARAM, "ret = " << ret);
+
+
+ sleep(1);
+ ret = security_server_set_pwd_history(50);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
+
+ sleep(1);
+ ret = security_server_set_pwd_history(0);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd_history(10);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
int dir_filter(const struct dirent *entry)
free(mydirent);
}
-RUNNER_TEST(tc24_security_server_check_history)
+RUNNER_TEST(tc30_security_server_check_history)
{
int ret;
int i;
sleep(1);
ret = security_server_reset_pwd("history0", 0, 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
printf("11 subtests started...");
for (i = 0; i < 11; i++) {
sleep(1);
ret = security_server_set_pwd(buf1, buf2, 0, 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
printf("DONE\n");
sleep(1);
ret = security_server_set_pwd("history11", "history1", 0, 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd("history1", "history8", 0, 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_REUSED, "ret = " << ret);
sleep(1);
ret = security_server_set_pwd("history1", "history12", 0, 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
printf("48 subtests started...");
for (i = 12; i < 60; i++) {
sprintf(buf2, "history%d", i + 1);
ret = security_server_set_pwd(buf1, buf2, 0, 0);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
}
printf("DONE\n");
clean_password_dir();
}
-RUNNER_TEST(tc25_security_server_replay_attack)
+RUNNER_TEST(tc31_security_server_replay_attack)
{
int ret;
int i = 0;
usleep(i);
}
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
}
-RUNNER_TEST(tc26_security_server_challenge_on_expired_password)
+RUNNER_TEST(tc32_security_server_challenge_on_expired_password)
{
int ret;
unsigned int attempt, max_attempt, expire_sec;
sleep(1);
ret = security_server_set_pwd("history60", "newpwd23", 4, 1);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
sleep(1);
ret = security_server_chk_pwd("newpwd23", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_SUCCESS);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_SUCCESS, "ret = " << ret);
ret = gettimeofday(&cur_time, NULL);
- RUNNER_ASSERT(ret > -1);
+ RUNNER_ASSERT_MSG(ret > -1, ret);
cur_time.tv_sec += (expire_sec + 1);
ret = settimeofday(&cur_time, NULL);
- RUNNER_ASSERT(ret > -1);
+ RUNNER_ASSERT_MSG(ret > -1, ret);
sleep(1);
ret = security_server_chk_pwd("newpwd23", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXPIRED);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_EXPIRED, "ret = " << ret);
sleep(1);
ret = security_server_chk_pwd("newpwd23_invalid", &attempt, &max_attempt, &expire_sec);
- RUNNER_ASSERT(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH);
+ RUNNER_ASSERT_MSG(ret == SECURITY_SERVER_API_ERROR_PASSWORD_MISMATCH, "ret = " << ret);
}
+
int main(int argc, char *argv[])
{
int status = DPL::Test::TestRunnerSingleton::Instance().ExecTestRunner(argc, argv);