-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheggdrop_tcl_passwdok.bats
57 lines (50 loc) · 2.08 KB
/
eggdrop_tcl_passwdok.bats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@test "Eggdrop setup" {
run cp $WORK_DIR/tests/eggdrop_tcl_passwdok* $HOME/eggdrop/
[ $status -eq 0 ]
run cp $WORK_DIR/tests/cmd_accept.tcl $HOME/eggdrop/scripts/
[ $status -eq 0 ]
cd $HOME/eggdrop
run ./eggdrop -m eggdrop_tcl_passwdok.conf
[ $status -eq 0 ]
run bash -c 'echo "{adduser foo}" |nc localhost 45678'
}
@test "passwdok returns 1 if the password given matches the password of a user" {
run bash -c 'echo "{setuser foo PASS asdf}" |nc localhost 45678'
[[ "${output}" == *"0 {}"* ]]
run bash -c 'echo "{passwdok foo asdf}" |nc localhost 45678'
echo "# ${output}" >&3
[[ "${output}" == *"0 {1}"* ]]
}
@test "passwdok returns 0 if the password given does not match the password of a user" {
run bash -c 'echo "{setuser foo PASS asdf}" |nc localhost 45678'
[[ "${output}" == *"0 {}"* ]]
run bash -c 'echo "{passwdok foo notasdf}" |nc localhost 45678'
[[ "${output}" == *"0 {0}"* ]]
}
@test "passwdok returns 1 if the password given is "-" and the user has no password" {
run bash -c 'echo "{setuser foo PASS }" |nc localhost 45678'
[[ "${output}" == *"0 {}"* ]]
run bash -c 'echo "{passwdok foo -}" |nc localhost 45678'
[[ "${output}" == *"0 {1}"* ]]
}
@test "passwdok returns 0 if the password given is "-" and the user has a password set" {
run bash -c 'echo "{setuser foo PASS asdf}" |nc localhost 45678'
[[ "${output}" == *"0 {}"* ]]
run bash -c 'echo "{passwdok foo -}" |nc localhost 45678'
[[ "${output}" == *"0 {0}"* ]]
}
@test "passwdok returns 0 if the password given is \"\" and the user has no password set" {
run bash -c 'echo "{setuser foo PASS}" |nc localhost 45678'
[[ "${output}" == *"0 {}"* ]]
run bash -c 'echo "{passwdok foo \"\"}" |nc localhost 45678'
[[ "${output}" == *"0 {0}"* ]]
}
@test "passwdok returns 0 if the password given is \"\" and the user has a password set" {
run bash -c 'echo "{setuser foo PASS asdf}" |nc localhost 45678'
[[ "${output}" == *"0 {}"* ]]
run bash -c 'echo "{passwdok foo \"\"}" |nc localhost 45678'
[[ "${output}" == *"0 {0}"* ]]
}
@test "Kill eggdrop" {
echo "{die}" |nc localhost 45678
}