Commit c3c40865 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Added tests for get-text-stat and get-text-stat-old. Check that a

text wiht one public and one secret recipient is properly filtered.
parent d7cb1e17
# Check that get-text-stat doesn't leak information to clients
# that are not logged in.
# Check that get-text, get-text-stat-old and get-text-stat don't leak
# information to clients that are not logged in.
lyskomd_start
......@@ -9,6 +9,8 @@ send "A\n"
send "[holl "DejaGnu test suite"]\n"
simple_expect "LysKOM" "connected"
# Log in as the administrator and create a few texts.
send "1000 0 5 [holl gazonk]\n"
simple_expect ":2 9 5 1"
simple_expect "=1000"
......@@ -43,99 +45,205 @@ simple_expect "=1011"
send "1012 41 5\n"
simple_expect "%1012 12 0"
send "1013 25 0 0 999\n"
simple_expect "%1013 15 0"
send "1014 25 1 0 999\n"
simple_expect "=1014 [holl "Text in Secret Conf"]"
send "1015 25 2 1 10\n"
simple_expect "=1015 [holl "ext in new"]"
send "1016 25 3 0 999\n"
simple_expect "%1016 14 3"
send "1017 25 4 5 11\n"
simple_expect "=1017 [holl "sist Na"]"
send "1018 25 5 0 17\n"
simple_expect "=1018 [holl "Message of the day"]"
send "1019 25 5 0 16\n"
simple_expect "=1019 [holl "Message of the da"]"
send "1020 25 5 1 16\n"
simple_expect "=1020 [holl "essage of the da"]"
send "1021 25 5 3 15\n"
simple_expect "=1021 [holl "sage of the d"]"
send "1022 25 5 3 1540\n"
simple_expect "=1022 [holl "sage of the day"]"
send "1013 86 [holl "Mixed-mode text"] 2 { 0 4 0 6 } 1 { 15 00000000 0 [holl "DejaGnu"] }\n"
simple_expect "=1013 6"
# Check that the administrator can retrieve the texts.
send "1014 25 0 0 999\n"
simple_expect "%1014 15 0"
send "1015 26 0\n"
simple_expect "%1015 15 0"
send "1016 90 0\n"
simple_expect "%1016 15 0"
send "1017 25 1 0 999\n"
simple_expect "=1017 [holl "Text in Secret Conf"]"
send "1018 26 1\n"
simple_expect "=1018 $any_time 5 0 19 0 2 { 0 6 6 1 }"
send "1019 90 1\n"
simple_expect "=1019 $any_time 5 0 19 0 2 { 0 6 6 1 } 0 \\*"
send "1020 25 2 1 10\n"
simple_expect "=1020 [holl "ext in new"]"
send "1021 26 2\n"
simple_expect "=1021 $any_time 5 0 23 0 2 { 0 4 6 1 }"
send "1022 90 2\n"
simple_expect "=1022 $any_time 5 0 23 0 2 { 0 4 6 1 } 0 \\*"
send "1023 25 3 0 999\n"
simple_expect "%1023 14 3"
send "1024 26 3\n"
simple_expect "%1024 14 3"
send "1025 90 3\n"
simple_expect "%1025 14 3"
send "1026 25 4 5 11\n"
simple_expect "=1026 [holl "sist Na"]"
send "1027 26 4\n"
simple_expect "=1027 $any_time 5 0 16 0 0 \\*"
send "1028 90 4\n"
simple_expect "=1028 $any_time 5 0 16 0 0 \\* 0 \\*"
send "1029 25 5 0 17\n"
simple_expect "=1029 [holl "Message of the day"]"
send "1030 26 5\n"
# Implementation detail: the text is marked since it is the message of the day.
simple_expect "=1030 $any_time 5 0 18 1 2 { 0 4 6 3 }"
send "1031 90 5\n"
# Implementation detail: the text is marked since it is the message of the day.
simple_expect "=1031 $any_time 5 0 18 1 2 { 0 4 6 3 } 0 \\*"
send "1032 25 5 0 16\n"
simple_expect "=1032 [holl "Message of the da"]"
send "1033 25 5 1 16\n"
simple_expect "=1033 [holl "essage of the da"]"
send "1034 25 5 3 15\n"
simple_expect "=1034 [holl "sage of the d"]"
send "1035 25 5 3 1540\n"
simple_expect "=1035 [holl "sage of the day"]"
send "1036 25 6 0 110\n"
simple_expect "=1036 [holl "Mixed-mode text"]"
send "1037 26 6\n"
simple_expect "=1037 $any_time 5 0 15 0 4 { 0 4 6 4 0 6 6 2 }"
send "1038 90 6\n"
simple_expect "=1038 $any_time 5 0 15 0 4 { 0 4 6 4 0 6 6 2 } 1 { 1 15 5 $any_time 00000000 0 [holl "DejaGnu"] }"
# Check what a session that isn't logged in can retrieve.
client_start 1
talk_to client 1
send "A3Hfoo\n"
simple_expect "LysKOM" "connected"
send "1023 25 0 0 999\n"
simple_expect "%1023 15 0"
send "1024 25 1 0 999\n"
simple_expect "%1024 14 1"
send "1025 25 2 1 10\n"
simple_expect "%1025 14 2"
send "1026 25 3 0 999\n"
simple_expect "%1026 14 3"
send "1027 25 4 5 11\n"
simple_expect "%1027 14 4"
send "1028 25 5 0 17\n"
simple_expect "=1028 [holl "Message of the day"]"
send "1039 25 0 0 999\n"
simple_expect "%1039 15 0"
send "1040 26 0\n"
simple_expect "%1040 15 0"
send "1041 90 0\n"
simple_expect "%1041 15 0"
send "1042 25 1 0 999\n"
simple_expect "%1042 14 1"
send "1043 26 1\n"
simple_expect "%1043 14 1"
send "1044 90 1\n"
simple_expect "%1044 14 1"
send "1045 25 2 1 10\n"
simple_expect "%1045 14 2"
send "1046 26 2\n"
simple_expect "%1046 14 2"
send "1047 90 2\n"
simple_expect "%1047 14 2"
send "1048 25 3 0 999\n"
simple_expect "%1048 14 3"
send "1049 26 3\n"
simple_expect "%1049 14 3"
send "1050 90 3\n"
simple_expect "%1050 14 3"
send "1051 25 4 5 11\n"
simple_expect "%1051 14 4"
send "1052 26 4\n"
simple_expect "%1052 14 4"
send "1053 90 4\n"
simple_expect "%1053 14 4"
send "1054 25 5 0 17\n"
simple_expect "=1054 [holl "Message of the day"]"
send "1055 26 5\n"
# Implementation detail: the text is marked since it is the message of the day.
simple_expect "=1055 $any_time 5 0 18 1 2 { 0 4 6 3 }"
send "1056 90 5\n"
# Implementation detail: the text is marked since it is the message of the day.
simple_expect "=1056 $any_time 5 0 18 1 2 { 0 4 6 3 } 0 \\*"
send "1057 25 6 0 110\n"
simple_expect "%1057 14 6"
send "1058 26 6\n"
simple_expect "%1058 14 6"
send "1059 90 6\n"
simple_expect "%1059 14 6"
# Create an unprivileged person, and try to re-fetch all texts
send "1029 56\n"
simple_expect "=1029 2"
send "1030 83 1 1 0\n"
simple_expect "=1030 2 { 2 0 0 $any_num 10000000 0H 1 5 0 $any_num 00000000 0H }"
send "1031 89 [holl "John Doe"] [holl "letmein"] 0 { }\n"
send "1060 56\n"
simple_expect "=1060 2"
send "1061 83 1 1 0\n"
simple_expect "=1061 2 { 2 0 0 $any_num 10000000 0H 1 5 0 $any_num 00000000 0H }"
send "1062 89 [holl "John Doe"] [holl "letmein"] 0 { }\n"
simple_expect ":2 9 7 2"
simple_expect "=1031 7"
simple_expect "=1062 7"
talk_to client 0
simple_expect ":2 9 7 2" "client 0 also got :2 9 7 2 message"
talk_to client 1
send "1032 83 1 1 0\n"
simple_expect "=1032 2 { 2 7 0 $any_num 00000000 0H 1 5 0 $any_num 00000000 0H }"
send "1033 25 0 0 999\n"
simple_expect "%1033 15 0"
send "1034 25 1 0 999\n"
simple_expect "%1034 14 1"
send "1035 25 2 1 10\n"
simple_expect "=1035 [holl "ext in new"]"
send "1036 25 3 0 999\n"
simple_expect "%1036 14 3"
send "1037 25 4 5 11\n"
simple_expect "%1037 14 4"
send "1038 25 5 0 17\n"
simple_expect "=1038 [holl "Message of the day"]"
send "1063 83 1 1 0\n"
simple_expect "=1063 2 { 2 7 0 $any_num 00000000 0H 1 5 0 $any_num 00000000 0H }"
send "1064 25 0 0 999\n"
simple_expect "%1064 15 0"
send "1065 26 0\n"
simple_expect "%1065 15 0"
send "1066 90 0\n"
simple_expect "%1066 15 0"
send "1067 25 1 0 999\n"
simple_expect "%1067 14 1"
send "1068 26 1\n"
simple_expect "%1068 14 1"
send "1069 90 1\n"
simple_expect "%1069 14 1"
send "1070 25 2 1 10\n"
simple_expect "=1070 [holl "ext in new"]"
send "1071 26 2\n"
simple_expect "=1071 $any_time 5 0 23 0 2 { 0 4 6 1 }"
send "1072 90 2\n"
simple_expect "=1072 $any_time 5 0 23 0 2 { 0 4 6 1 } 0 \\*"
send "1073 25 3 0 999\n"
simple_expect "%1073 14 3"
send "1074 26 3\n"
simple_expect "%1074 14 3"
send "1075 90 3\n"
simple_expect "%1075 14 3"
send "1076 25 4 5 11\n"
simple_expect "%1076 14 4"
send "1077 26 4\n"
simple_expect "%1077 14 4"
send "1078 90 4\n"
simple_expect "%1078 14 4"
send "1079 25 5 0 17\n"
simple_expect "=1079 [holl "Message of the day"]"
send "1080 26 5\n"
# Implementation detail: the text is marked since it is the message of the day.
simple_expect "=1080 $any_time 5 0 18 1 2 { 0 4 6 3 }"
send "1081 90 5\n"
# Implementation detail: the text is marked since it is the message of the day.
simple_expect "=1081 $any_time 5 0 18 1 2 { 0 4 6 3 } 0 \\*"
send "1082 25 6 0 110\n"
simple_expect "=1082 [holl "Mixed-mode text"]"
send "1083 26 6\n"
simple_expect "=1083 $any_time 5 0 15 0 2 { 0 4 6 4 }"
send "1084 90 6\n"
simple_expect "=1084 $any_time 5 0 15 0 2 { 0 4 6 4 } 1 { 1 15 5 $any_time 00000000 0 [holl "DejaGnu"] }"
talk_to client 0
send "1039 42 255\n"
simple_expect "=1039" "42=enable succeeded"
send "1040 44 0\n"
simple_expect "=1040" "44=shutdown-kom succeeded"
send "1085 42 255\n"
simple_expect "=1085" "42=enable succeeded"
send "1086 44 0\n"
simple_expect "=1086" "44=shutdown-kom succeeded"
simple_expect ":2 13 7 2"
simple_expect ":2 13 5 1"
client_death 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment