Browse code
adds validate token function
Showing 3 changed files
... | ... |
@@ -1,5 +1,5 @@ |
1 | 1 |
MODULEFLAGS = -fPIC -fno-stack-protector |
2 |
-MODULEOBJS = dual_control.o logging.o token.o |
|
2 |
+MODULEOBJS = dual_control.o logging.o token.o conversation.o |
|
3 | 3 |
TESTOBJS = $(patsubst %.o, t_%.o, $(MODULEOBJS)) |
4 | 4 |
HEADERS = logging.h test_support.h token.h |
5 | 5 |
MODULELIB = pam_dual_control.so |
... | ... |
@@ -1,13 +1,36 @@ |
1 | 1 |
#include "token.h" |
2 | 2 |
#include "test_util.h" |
3 | 3 |
|
4 |
-int validate_compares_to_user_token() { |
|
5 |
- fail(); |
|
6 |
-} |
|
4 |
+const char *fake_user = ""; |
|
5 |
+const char *fake_user_token = ""; |
|
6 |
+ |
|
7 |
+ |
|
8 |
+// all the fake system calls |
|
9 |
+ |
|
7 | 10 |
|
8 | 11 |
RESET_VARS_START |
12 |
+fake_user = ""; |
|
13 |
+fake_user_token = ""; |
|
9 | 14 |
RESET_VARS_END |
10 | 15 |
|
16 |
+ |
|
17 |
+int validate_compares_to_user_token() { |
|
18 |
+ |
|
19 |
+ // given |
|
20 |
+ fake_user = "msmith"; |
|
21 |
+ fake_user_token = "123456"; |
|
22 |
+ |
|
23 |
+ // when |
|
24 |
+ int valid = validate_token("msmith:123456"); |
|
25 |
+ |
|
26 |
+ // then |
|
27 |
+ check(valid, "expected result to be valid"); |
|
28 |
+ |
|
29 |
+ succeed(); |
|
30 |
+ |
|
31 |
+} |
|
32 |
+ |
|
33 |
+ |
|
11 | 34 |
int runtests() { |
12 | 35 |
test(validate_compares_to_user_token); |
13 | 36 |
succeed(); |