|
@@ -326,7 +326,7 @@ SCENARIO("Check login command with privileged user") {
|
|
|
|
|
|
TEST_SHELLMATTA_AUTH_SETUP;
|
|
TEST_SHELLMATTA_AUTH_SETUP;
|
|
|
|
|
|
- WHEN("The user shellmatta logges in interactively using the correct credentials") {
|
|
|
|
|
|
+ WHEN("The user shellmatta logs in interactively using the correct credentials") {
|
|
|
|
|
|
ret = shellmatta_processData(handle, (char*)"login\r\n"
|
|
ret = shellmatta_processData(handle, (char*)"login\r\n"
|
|
"shimatta\r\n"
|
|
"shimatta\r\n"
|
|
@@ -351,7 +351,7 @@ SCENARIO("Check login command with privileged user") {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- WHEN("The user shellmatta logges in interactively using wrong credentials") {
|
|
|
|
|
|
+ WHEN("The user shellmatta logs in interactively using wrong credentials") {
|
|
|
|
|
|
ret = shellmatta_processData(handle, (char*)"login\r\n"
|
|
ret = shellmatta_processData(handle, (char*)"login\r\n"
|
|
"shimatta\r\n"
|
|
"shimatta\r\n"
|
|
@@ -376,7 +376,7 @@ SCENARIO("Check login command with privileged user") {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- WHEN("The user shellmatta logges in interactively manipulating the input") {
|
|
|
|
|
|
+ WHEN("The user shellmatta logs in interactively manipulating the input") {
|
|
|
|
|
|
ret = shellmatta_processData(handle, (char*)"login\r"
|
|
ret = shellmatta_processData(handle, (char*)"login\r"
|
|
"shimg\batta\r"
|
|
"shimg\batta\r"
|
|
@@ -401,7 +401,7 @@ SCENARIO("Check login command with privileged user") {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- WHEN("The user shellmatta logges in passing the credentials none interactive") {
|
|
|
|
|
|
+ WHEN("The user shellmatta logs in passing the credentials none interactive") {
|
|
|
|
|
|
ret = shellmatta_processData(handle, (char*)"login -u shimatta -p 12345678\r", 30);
|
|
ret = shellmatta_processData(handle, (char*)"login -u shimatta -p 12345678\r", 30);
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
@@ -420,7 +420,7 @@ SCENARIO("Check login command with privileged user") {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- WHEN("The user shellmatta logges in passing the credentials half interactive") {
|
|
|
|
|
|
+ WHEN("The user shellmatta logs in passing the credentials half interactive") {
|
|
|
|
|
|
ret = shellmatta_processData(handle, (char*)"login -u shimatta\r12345678\r", 27);
|
|
ret = shellmatta_processData(handle, (char*)"login -u shimatta\r12345678\r", 27);
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
@@ -488,7 +488,7 @@ SCENARIO("Check login command with unprivileged user") {
|
|
|
|
|
|
TEST_SHELLMATTA_AUTH_SETUP;
|
|
TEST_SHELLMATTA_AUTH_SETUP;
|
|
|
|
|
|
- WHEN("The user not_shimatta logges in interactively using the correct credentials") {
|
|
|
|
|
|
+ WHEN("The user not_shimatta logs in interactively using the correct credentials") {
|
|
|
|
|
|
ret = shellmatta_processData(handle, (char*)"login\r"
|
|
ret = shellmatta_processData(handle, (char*)"login\r"
|
|
"not_shimatta\r"
|
|
"not_shimatta\r"
|
|
@@ -613,7 +613,7 @@ SCENARIO("Check custom login") {
|
|
|
|
|
|
shellmatta_auth_init(handle, userList, 2, permList, 1, false, customLogin, logFct);
|
|
shellmatta_auth_init(handle, userList, 2, permList, 1, false, customLogin, logFct);
|
|
|
|
|
|
- WHEN("The user not_shimatta logges in interactively using the correct credentials") {
|
|
|
|
|
|
+ WHEN("The user shimatta logs in interactively using the correct credentials") {
|
|
|
|
|
|
ret = shellmatta_processData(handle, (char*)"login\r"
|
|
ret = shellmatta_processData(handle, (char*)"login\r"
|
|
"shimatta\r"
|
|
"shimatta\r"
|
|
@@ -643,6 +643,37 @@ SCENARIO("Check custom login") {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ WHEN("The user not_shimatta logs in interactively using the wrong credentials") {
|
|
|
|
+
|
|
|
|
+ ret = shellmatta_processData(handle, (char*)"login\r"
|
|
|
|
+ "shimatta\r"
|
|
|
|
+ "12345679\r", 24);
|
|
|
|
+ CHECK(ret == SHELLMATTA_OK);
|
|
|
|
+
|
|
|
|
+ THEN("Login error message is printed") {
|
|
|
|
+ char *dummyData = (char*) "login\r\n"
|
|
|
|
+ "enter username:\r\n"
|
|
|
|
+ "shimatta\r\n"
|
|
|
|
+ "enter password:\r\n"
|
|
|
|
+ "\r\n"
|
|
|
|
+ "username or password is wrong\r\n"
|
|
|
|
+ "\r\n"
|
|
|
|
+ "shellmatta->";
|
|
|
|
+
|
|
|
|
+ CHECK(write_length == strlen(dummyData));
|
|
|
|
+ REQUIRE_THAT(write_data, Catch::Matchers::Equals(dummyData));
|
|
|
|
+
|
|
|
|
+ AND_THEN("The shimatta user is not logged in") {
|
|
|
|
+ REQUIRE(0 == shellmatta_auth_getLoggedInUserId(handle));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ AND_THEN("The failed login event is logged") {
|
|
|
|
+ CHECK(1 == userIdTemp);
|
|
|
|
+ REQUIRE(false == successTemp);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -695,7 +726,7 @@ SCENARIO("Check if passwords can be changed") {
|
|
ret = shellmatta_auth_chpasswd(handle, "shimatta", "new_password");
|
|
ret = shellmatta_auth_chpasswd(handle, "shimatta", "new_password");
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
|
|
|
|
- AND_WHEN("The user shellmatta logges in passing the new credentials") {
|
|
|
|
|
|
+ AND_WHEN("The user shellmatta logs in passing the new credentials") {
|
|
|
|
|
|
ret = shellmatta_processData(handle, (char*)"login -u shimatta -p new_password\r", 34);
|
|
ret = shellmatta_processData(handle, (char*)"login -u shimatta -p new_password\r", 34);
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
@@ -706,7 +737,7 @@ SCENARIO("Check if passwords can be changed") {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- AND_WHEN("The user shellmatta logges in passing the old credentials") {
|
|
|
|
|
|
+ AND_WHEN("The user shellmatta logs in passing the old credentials") {
|
|
|
|
|
|
ret = shellmatta_processData(handle, (char*)"login -u shimatta -p 12345678\r", 30);
|
|
ret = shellmatta_processData(handle, (char*)"login -u shimatta -p 12345678\r", 30);
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
CHECK(ret == SHELLMATTA_OK);
|
|
@@ -717,4 +748,25 @@ SCENARIO("Check if passwords can be changed") {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+SCENARIO("User functions with wrong parameters") {
|
|
|
|
+ GIVEN("An initialized shellmatta instance with initialized auth") {
|
|
|
|
+
|
|
|
|
+ TEST_SHELLMATTA_SETUP;
|
|
|
|
+
|
|
|
|
+ TEST_SHELLMATTA_AUTH_SETUP;
|
|
|
|
+
|
|
|
|
+ WHEN("Trying to log in user 0") {
|
|
|
|
+
|
|
|
|
+ ret = shellmatta_auth_login(handle, 0);
|
|
|
|
+
|
|
|
|
+ THEN("Shellmatta returns SHELLMATTA_ERROR") {
|
|
|
|
+ CHECK(ret == SHELLMATTA_ERROR);
|
|
|
|
+ AND_THEN("No user is logged in") {
|
|
|
|
+ REQUIRE(0 == shellmatta_auth_getLoggedInUserId(handle));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|