mirror of
https://github.com/Yubico/yubico-pam.git
synced 2025-02-20 21:54:16 +01:00
add a test for a user showing up twice in the file
This commit is contained in:
parent
ab25973d1e
commit
15cab00173
@ -62,7 +62,10 @@ static void test_check_user_token(void) {
|
||||
fprintf(handle, "foobar:hhhvhvhdhbid:hnhbhnhbhnhb:\n");
|
||||
fprintf(handle, "# This is a comment in the middle\n");
|
||||
fprintf(handle, "kaka:hdhrhbhjhvhu:hihbhdhrhbhj\n");
|
||||
fprintf(handle, "# foo2 is a user showing up twice in the file\n");
|
||||
fprintf(handle, "foo2:vvvvvvvvvvvv\n");
|
||||
fprintf(handle, "bar:hnhbhnhbhnhb\n");
|
||||
fprintf(handle, "foo2:cccccccccccc\n");
|
||||
fclose(handle);
|
||||
|
||||
ret = check_user_token(file, "foobar", "hhhvhvhdhbid", 1);
|
||||
@ -77,6 +80,12 @@ static void test_check_user_token(void) {
|
||||
assert(ret == 1);
|
||||
ret = check_user_token(file, "foo", "hdhrhbhjhvhu", 1);
|
||||
assert(ret == -2);
|
||||
ret = check_user_token(file, "foo2", "cccccccccccc", 1);
|
||||
assert(ret == 1);
|
||||
ret = check_user_token(file, "foo2", "vvvvvvvvvvvv", 1);
|
||||
assert(ret == 1);
|
||||
ret = check_user_token(file, "foo2", "vvvvvvvvvvcc", 1);
|
||||
assert(ret == -1);
|
||||
remove(file);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user