Commit 3f4d4059 authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Like bug-37.exp, but with all memberships being secret. Found bug

597.
parent 7415a677
# Test suite for lyskomd.
# Copyright (C) 2002 Lysator Academic Computer Association.
#
# This file is part of the LysKOM server.
#
# LysKOM is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 1, or (at your option)
# any later version.
#
# LysKOM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with LysKOM; see the file COPYING. If not, write to
# Lysator, c/o ISY, Linkoping University, S-581 83 Linkoping, SWEDEN,
# or the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
# MA 02139, USA.
#
# Please mail bug reports to bug-lyskom@lysator.liu.se.
# Test bug 37 get_unread_confs does not check that the caller is
# allowed to see the person, and returns the correct result even for
# secret persons, including secret confs!
#
# Variant two: test with all memberships being secret.
#
# We also check get-membership, get-membership-old, query-read-texts,
# and query-read-texts-old.
#
# While we are at it, we also test the unread-is-secret personal flag.
#
# FIXME (bug 590): If the request requested in bug 590 is implemented,
# it should also be checked here.
#
# Startup and create the players
#
# Start the server.
lyskomd_start
# Create and log in as foo (person 6).
client_start 0
send "A3Hfoo\n"
simple_expect "LysKOM"
send "1000 80 0 { }\n"
simple_expect "=1000"
send "1001 89 [holl "foo"] [holl "p6"] 00000000 0 { }\n"
simple_expect "=1001 6"
send "1002 62 6 [holl "p6"] 0\n"
simple_expect "=1002"
# Create and log in as bar (person 7; secret).
client_start 1
send "A3Hbar\n"
simple_expect "LysKOM"
send "1003 80 0 { }\n"
simple_expect "=1003"
send "1004 89 [holl "bar"] [holl "p7"] 00000000 0 { }\n"
simple_expect "=1004 7"
send "1005 62 7 [holl "p7"] 0\n"
simple_expect "=1005"
send "1006 21 7 10111000\n"
simple_expect "=1006"
# Create and log in as citrus (person 8; has unread-is-secret set).
client_start 2
send "A6Hcitrus\n"
simple_expect "LysKOM"
send "1007 80 0 { }\n"
simple_expect "=1007"
send "1008 89 [holl "citrus"] [holl "p8"] 10100000 0 { }\n"
simple_expect "=1008 8"
send "1009 62 8 [holl "p8"] 0\n"
simple_expect "=1009"
# Create and log in as gazonk (person 9). This is the observer.
client_start 3
send "A6Hgazonk\n"
simple_expect "LysKOM"
send "1010 80 0 { }\n"
simple_expect "=1010"
send "1011 89 [holl "gazonk"] [holl "p9"] 00000000 0 { }\n"
simple_expect "=1011 9"
send "1012 62 9 [holl "p9"] 0\n"
simple_expect "=1012"
#
# Create conferences.
#
# As bar, create secret (conf 10; secret).
talk_to client 1
send "1013 88 [holl "secret"] 10101000 0 { }\n"
simple_expect "=1013 10"
# As bar, create rd-prot (conf 11; rd-prot).
send "1014 88 [holl "rd-prot"] 10001000 0 { }\n"
simple_expect "=1014 11"
# As bar, create public (conf 12).
send "1015 88 [holl "public"] 00001000 0 { }\n"
simple_expect "=1015 12"
#
# Join conferences
#
# bar joins secret, rd-prot and public.
send "1016 100 10 7 200 1 00100000\n"
simple_expect "=1016"
send "1017 100 11 7 200 2 00100000\n"
simple_expect "=1017"
send "1018 100 12 7 200 3 00100000\n"
simple_expect "=1018"
# bar invites foo to secret, rd-prot and public.
send "1019 100 10 6 200 1 00100000\n"
simple_expect "=1019"
send "1020 100 11 6 200 2 00100000\n"
simple_expect "=1020"
send "1021 100 12 6 200 3 00100000\n"
simple_expect "=1021"
# bar invites citrus to secret, rd-prot and public.
send "1022 100 10 8 200 1 00100000\n"
simple_expect "=1022"
send "1023 100 11 8 200 2 00100000\n"
simple_expect "=1023"
send "1024 100 12 8 200 3 00100000\n"
simple_expect "=1024"
#
# foo examines foo.
#
talk_to client 0
# foo does get-unread-confs of foo. Should return the empty list.
send "1025 52 6\n"
simple_expect "=1025 0 \\*"
# foo does get-membership of foo. Should return 4 { 6 10 11 12 }.
send "1026 99 6 0 100 1\n"
simple_expect "=1026 4 { 0 $any_time 6 255 0 0 \\* 6 $any_time 00000000 1 $any_time 10 200 0 0 \\* 7 $any_time 10100000 2 $any_time 11 200 0 0 \\* 7 $any_time 10100000 3 $any_time 12 200 0 0 \\* 7 $any_time 10100000 }"
# foo does get-membership-old of foo. Should return 4 { 6 10 11 12 }.
send "1027 46 6 0 100 1\n"
simple_expect "=1027 4 { $any_time 6 255 0 0 \\* $any_time 10 200 0 0 \\* $any_time 11 200 0 0 \\* $any_time 12 200 0 0 \\* }"
# foo does query-read-texts on foo and 10, 11 and 12. Should get results.
send "1028 98 6 10\n"
simple_expect "=1028 1 $any_time 10 200 0 0 \\* 7 $any_time 10100000"
send "1029 98 6 11\n"
simple_expect "=1029 2 $any_time 11 200 0 0 \\* 7 $any_time 10100000"
send "1030 98 6 12\n"
simple_expect "=1030 3 $any_time 12 200 0 0 \\* 7 $any_time 10100000"
# foo does query-read-texts-old on foo and 10, 11 and 12. Should get results.
send "1031 9 6 10\n"
simple_expect "=1031 $any_time 10 200 0 0 \\*"
send "1032 9 6 11\n"
simple_expect "=1032 $any_time 11 200 0 0 \\*"
send "1033 9 6 12\n"
simple_expect "=1033 $any_time 12 200 0 0 \\*"
# foo does <FIXME (bug 590)> on foo and 10, 11 and 12. Should get results.
#
# gazonk examines foo.
#
talk_to client 3
# gazonk does get-unread-confs of foo. Should return the empty list.
send "1034 52 6\n"
simple_expect "=1034 0 \\*"
# gazonk does get-membership of foo. Should return 1 { 6 }.
send "1035 99 6 0 100 1\n"
simple_expect "=1035 1 { 0 $any_time 6 255 0 0 \\* 6 $any_time 00000000 }"
# (Just a quick check: does the renumber work properly even if we don't
# start from the beginning of the list?)
send "1036 99 6 2 100 1\n"
simple_expect "%1036 19 2"
send "1037 99 6 1 100 1\n"
simple_expect "%1037 19 1"
# gazonk does get-membership-old of foo. Should return 1 { 6 }.
send "1038 46 6 0 100 1\n"
simple_expect "=1038 1 { $any_time 6 255 0 0 \\* }"
# gazonk does query-read-texts on foo and 10, 11 and 12. All should fail.
send "1039 98 6 10\n"
simple_expect "%1039 9 10"
send "1040 98 6 11\n"
simple_expect "%1040 13 11"
send "1041 98 6 12\n"
simple_expect "%1041 13 12"
# gazonk does query-read-texts-old on foo and 10, 11 and 12. 10 should fail.
send "1042 9 6 10\n"
simple_expect "%1042 9 10"
send "1043 9 6 11\n"
simple_expect "%1043 13 11"
send "1044 9 6 12\n"
simple_expect "%1044 13 12"
# gazonk does <FIXME (bug 590)> on foo and 10, 11 and 12. 10 should fail.
#
# gazonk examines bar.
#
# gazonk does get-unread-confs of bar. Should return undefined-person.
send "1045 52 7\n"
good_bad_expect "%1045 10 7" "=0 \\*" "Bug 37"
# gazonk does get-membership of bar. Should return undefined-person.
send "1046 99 7 0 100 1\n"
simple_expect "%1046 10 7"
# gazonk does get-membership-old of bar. Should return undefined-person.
send "1047 46 7 0 100 1\n"
simple_expect "%1047 10 7"
# gazonk does query-read-texts on bar and 10, 11 and 12. undefined-person.
send "1048 98 7 10\n"
simple_expect "%1048 10 7"
send "1049 98 7 11\n"
simple_expect "%1049 10 7"
send "1050 98 7 12\n"
simple_expect "%1050 10 7"
# gazonk does query-read-texts-old on bar and 10, 11 and 12. undefined-person.
send "1051 9 7 10\n"
simple_expect "%1051 10 7"
send "1052 9 7 11\n"
simple_expect "%1052 10 7"
send "1053 9 7 12\n"
simple_expect "%1053 10 7"
# gazonk does <FIXME (bug 590)> on bar and 10, 11 and 12. undefined-person.
#
# gazonk examines citrus.
#
# gazonk does get-unread-confs of citrus. Should return the empty list.
send "1054 52 8\n"
simple_expect "=1054 0 \\*"
# gazonk does get-membership of citrus. Should return 1 { 6 }.
send "1055 99 8 0 100 1\n"
simple_expect "=1055 1 { 0 $any_time 8 255 0 0 \\* 8 $any_time 00000000 }"
# gazonk does get-membership-old of citrus. Should return 1 { 6 }.
send "1056 46 8 0 100 1\n"
simple_expect "=1056 1 { $any_time 8 255 0 0 \\* }"
# gazonk does query-read-texts on citrus and 10, 11 and 12. All should fail.
send "1057 98 8 10\n"
simple_expect "%1057 9 10"
send "1058 98 8 11\n"
simple_expect "%1058 13 11"
send "1059 98 8 12\n"
simple_expect "%1059 13 12"
# gazonk does query-read-texts-old on citrus and 10, 11 and 12. All fails.
send "1060 9 8 10\n"
simple_expect "%1060 9 10"
send "1061 9 8 11\n"
simple_expect "%1061 13 11"
send "1062 9 8 12\n"
simple_expect "%1062 13 12"
# gazonk does <FIXME (bug 590)> on citrus and 10, 11 and 12. All should fail.
#
# foo writes a text with secret, rd-prot and public as recipients.
#
talk_to client 0
send "1063 86 [holl "foo"] 3 { 0 10 0 11 0 12 } 0 { }\n"
simple_expect "=1063 1"
#
# foo examines foo
#
# foo does get-unread-confs of foo. Should return 3 { 10 11 12 }.
send "1064 52 6\n"
simple_expect "=1064 3 { 10 11 12 }"
# foo does get-membership of foo. Should return 4 { 6 10 11 12 }.
send "1065 99 6 0 100 1\n"
simple_expect "=1065 4 { 0 $any_time 6 255 0 0 \\* 6 $any_time 00000000 1 $any_time 10 200 0 0 \\* 7 $any_time 10100000 2 $any_time 11 200 0 0 \\* 7 $any_time 10100000 3 $any_time 12 200 0 0 \\* 7 $any_time 10100000 }"
# foo does get-membership-old of foo. Should return 4 { 6 10 11 12 }.
send "1066 46 6 0 100 1\n"
simple_expect "=1066 4 { $any_time 6 255 0 0 \\* $any_time 10 200 0 0 \\* $any_time 11 200 0 0 \\* $any_time 12 200 0 0 \\* }"
# foo does query-read-texts on foo and 10, 11 and 12. Should get results.
send "1067 98 6 10\n"
simple_expect "=1067 1 $any_time 10 200 0 0 \\* 7 $any_time 10100000"
send "1068 98 6 11\n"
simple_expect "=1068 2 $any_time 11 200 0 0 \\* 7 $any_time 10100000"
send "1069 98 6 12\n"
simple_expect "=1069 3 $any_time 12 200 0 0 \\* 7 $any_time 10100000"
# foo does query-read-texts-old on foo and 10, 11 and 12. Should get results.
send "1070 9 6 10\n"
simple_expect "=1070 $any_time 10 200 0 0 \\*"
send "1071 9 6 11\n"
simple_expect "=1071 $any_time 11 200 0 0 \\*"
send "1072 9 6 12\n"
simple_expect "=1072 $any_time 12 200 0 0 \\*"
# foo does <FIXME (bug 590)> on foo and 10, 11 and 12. Should get results.
#
# gazonk examines foo.
#
talk_to client 3
# gazonk does get-unread-confs of foo. Should return the empty list.
send "1073 52 6\n"
good_bad_expect "=1073 0 \\ *" "=1 { 12 }" "Bug 597"
# gazonk does get-membership of foo. Should return 1 { 6 }.
send "1074 99 6 0 100 1\n"
simple_expect "=1074 1 { 0 $any_time 6 255 0 0 \\* 6 $any_time 00000000 }"
# gazonk does get-membership-old of foo. Should return 1 { 6 }.
send "1075 46 6 0 100 1\n"
simple_expect "=1075 1 { $any_time 6 255 0 0 \\* }"
# gazonk does query-read-texts on foo and 10, 11 and 12. All should fail.
send "1076 98 6 10\n"
simple_expect "%1076 9 10"
send "1077 98 6 11\n"
simple_expect "%1077 13 11"
send "1078 98 6 12\n"
simple_expect "%1078 13 12"
# gazonk does query-read-texts-old on foo and 10, 11 and 12. All should fail.
send "1079 9 6 10\n"
simple_expect "%1079 9 10"
send "1080 9 6 11\n"
simple_expect "%1080 13 11"
send "1081 9 6 12\n"
simple_expect "%1081 13 12"
# gazonk does <FIXME (bug 590)> on foo and 10, 11 and 12. All should fail.
#
# gazonk examines bar
#
# gazonk does get-unread-confs of bar. Should return undefined-person.
send "1082 52 7\n"
good_bad_expect "%1082 10 7" "=1 { 12 }" "Bug 37"
# gazonk does get-membership of bar. Should return undefined-person.
send "1083 99 7 0 100 1\n"
simple_expect "%1083 10 7"
# gazonk does get-membership-old of bar. Should return undefined-person.
send "1084 46 7 0 100 1\n"
simple_expect "%1084 10 7"
# gazonk does query-read-texts on bar and 10, 11 and 12. undefined-person.
send "1085 98 7 10\n"
simple_expect "%1085 10 7"
send "1086 98 7 11\n"
simple_expect "%1086 10 7"
send "1087 98 7 12\n"
simple_expect "%1087 10 7"
# gazonk does query-read-texts-old on bar and 10, 11 and 12. undefined-person.
send "1088 9 7 10\n"
simple_expect "%1088 10 7"
send "1089 9 7 11\n"
simple_expect "%1089 10 7"
send "1090 9 7 12\n"
simple_expect "%1090 10 7"
# gazonk does <FIXME (bug 590)> on bar and 10, 11 and 12. undefined-person.
#
# gazonk examines citrus.
#
# gazonk does get-unread-confs of citrus. Should return the empty list.
send "1091 52 8\n"
good_bad_expect "=1091 0 \\*" "=1 { 12 }" "Bug 595 and Bug 597"
# gazonk does get-membership of citrus. Should return 1 { 6 }.
send "1092 99 8 0 100 1\n"
simple_expect "=1092 1 { 0 $any_time 8 255 0 0 \\* 8 $any_time 00000000 }"
# gazonk does get-membership-old of citrus. Should return 1 { 6 }.
send "1093 46 8 0 100 1\n"
simple_expect "=1093 1 { $any_time 8 255 0 0 \\* }"
# gazonk does query-read-texts on citrus and 10, 11 and 12. All should fail.
send "1094 98 8 10\n"
simple_expect "%1094 9 10"
send "1095 98 8 11\n"
simple_expect "%1095 13 11"
send "1096 98 8 12\n"
simple_expect "%1096 13 12"
# gazonk does query-read-texts-old on citrus and 10, 11 and 12. All fails.
send "1097 9 8 10\n"
simple_expect "%1097 9 10"
send "1098 9 8 11\n"
simple_expect "%1098 13 11"
send "1099 9 8 12\n"
simple_expect "%1099 13 12"
# gazonk does <FIXME (bug 590)> on citrus and 10, 11 and 12. All should fail.
#
# mark as read
#
# foo marks the text as read
talk_to client 0
send "1100 27 10 1 { 1 }\n"
simple_expect "=1100"
send "1101 27 11 1 { 1 }\n"
simple_expect "=1101"
send "1102 27 12 1 { 1 }\n"
simple_expect "=1102"
# bar marks the text as read
talk_to client 1
send "1103 27 10 1 { 1 }\n"
simple_expect "=1103"
send "1104 27 11 1 { 1 }\n"
simple_expect "=1104"
send "1105 27 12 1 { 1 }\n"
simple_expect "=1105"
# citrus marks the text as read
talk_to client 2
send "1106 27 10 1 { 1 }\n"
simple_expect "=1106"
send "1107 27 11 1 { 1 }\n"
simple_expect "=1107"
send "1108 27 12 1 { 1 }\n"
simple_expect "=1108"
#
# foo examines foo.
#
talk_to client 0
# foo does get-unread-confs of foo. Should return the empty list.
send "1109 52 6\n"
simple_expect "=1109 0 \\*"
# foo does get-membership of foo. Should return 4 { 6 10 11 12 }.
send "1110 99 6 0 100 1\n"
simple_expect "=1110 4 { 0 $any_time 6 255 0 0 \\* 6 $any_time 00000000 1 $any_time 10 200 1 0 \\* 7 $any_time 10100000 2 $any_time 11 200 1 0 \\* 7 $any_time 10100000 3 $any_time 12 200 1 0 \\* 7 $any_time 10100000 }"
# foo does get-membership-old of foo. Should return 4 { 6 10 11 12 }.
send "1111 46 6 0 100 1\n"
simple_expect "=1111 4 { $any_time 6 255 0 0 \\* $any_time 10 200 1 0 \\* $any_time 11 200 1 0 \\* $any_time 12 200 1 0 \\* }"
# foo does query-read-texts on foo and 10, 11 and 12. Should get results.
send "1112 98 6 10\n"
simple_expect "=1112 1 $any_time 10 200 1 0 \\* 7 $any_time 10100000"
send "1113 98 6 11\n"
simple_expect "=1113 2 $any_time 11 200 1 0 \\* 7 $any_time 10100000"
send "1114 98 6 12\n"
simple_expect "=1114 3 $any_time 12 200 1 0 \\* 7 $any_time 10100000"
# foo does query-read-texts-old on foo and 10, 11 and 12. Should get results.
send "1115 9 6 10\n"
simple_expect "=1115 $any_time 10 200 1 0 \\*"
send "1116 9 6 11\n"
simple_expect "=1116 $any_time 11 200 1 0 \\*"
send "1117 9 6 12\n"
simple_expect "=1117 $any_time 12 200 1 0 \\*"
# foo does <FIXME (bug 590)> on foo and 10, 11 and 12. Should get results.
#
# gazonk examines foo.
#
talk_to client 3
# gazonk does get-unread-confs of foo. Should return the empty list.
send "1118 52 6\n"
simple_expect "=1118 0 \\*"
# gazonk does get-membership of foo. Should return 1 { 6 }.
send "1119 99 6 0 100 1\n"
simple_expect "=1119 1 { 0 $any_time 6 255 0 0 \\* 6 $any_time 00000000 }"
# gazonk does get-membership-old of foo. Should return 1 { 6 11 12 }.
send "1120 46 6 0 100 1\n"
simple_expect "=1120 1 { $any_time 6 255 0 0 \\* }"
# gazonk does query-read-texts on foo and 10, 11 and 12. All should fail.
send "1121 98 6 10\n"
simple_expect "%1121 9 10"
send "1122 98 6 11\n"
simple_expect "%1122 13 11"
send "1123 98 6 12\n"
simple_expect "%1123 13 12"
# gazonk does query-read-texts-old on foo and 10, 11 and 12. All should fail.
send "1124 9 6 10\n"
simple_expect "%1124 9 10"
send "1125 9 6 11\n"
simple_expect "%1125 13 11"
send "1126 9 6 12\n"
simple_expect "%1126 13 12"
# gazonk does <FIXME (bug 590)> on foo and 10, 11 and 12. All should fail.
#
# gazonk examines bar.
#
# gazonk does get-unread-confs of bar. Should return undefined-person.
send "1127 52 7\n"
good_bad_expect "%1127 10 7" "=0 \\*" "Bug 37"
# gazonk does get-membership of bar. Should return undefined-person.
send "1128 99 7 0 100 1\n"
simple_expect "%1128 10 7"
# gazonk does get-membership-old of bar. Should return undefined-person.
send "1129 46 7 0 100 1\n"
simple_expect "%1129 10 7"
# gazonk does query-read-texts on bar and 10, 11 and 12. undefined-person.
send "1130 98 7 10\n"
simple_expect "%1130 10 7"
send "1131 98 7 11\n"
simple_expect "%1131 10 7"
send "1132 98 7 12\n"
simple_expect "%1132 10 7"
# gazonk does query-read-texts-old on bar and 10, 11 and 12. undefined-person.
send "1133 9 7 10\n"
simple_expect "%1133 10 7"
send "1134 9 7 11\n"
simple_expect "%1134 10 7"
send "1135 9 7 12\n"
simple_expect "%1135 10 7"
# gazonk does <FIXME (bug 590)> on bar and 10, 11 and 12. undefined-person.
#
# gazonk examines citrus.
#
# gazonk does get-unread-confs of citrus. Should return the empty list.
send "1136 52 8\n"
simple_expect "=1136 0 \\*"
# gazonk does get-membership of citrus. Should return 1 { 6 }.
send "1137 99 8 0 100 1\n"
simple_expect "=1137 1 { 0 $any_time 8 255 0 0 \\* 8 $any_time 00000000 }"
# gazonk does get-membership-old of citrus. Should return 1 { 6 }.
send "1138 46 8 0 100 1\n"
simple_expect "=1138 1 { $any_time 8 255 0 0 \\* }"
# gazonk does query-read-texts on citrus and 10, 11 and 12. All should fail.
send "1139 98 8 10\n"
simple_expect "%1139 9 10"
send "1140 98 8 11\n"
simple_expect "%1140 13 11"
send "1141 98 8 12\n"
simple_expect "%1141 13 12"
# gazonk does query-read-texts-old on citrus and 10, 11 and 12. All fails.
send "1142 9 8 10\n"
simple_expect "%1142 9 10"
send "1143 9 8 11\n"
simple_expect "%1143 13 11"
send "1144 9 8 12\n"
simple_expect "%1144 13 12"
# gazonk does <FIXME (bug 590)> on citrus and 10, 11 and 12. All should fail.
# Shut down.
talk_to client 3
send "1145 0 5 [holl "gazonk"]\n"
simple_expect "=1145"
send "1146 42 255\n"
simple_expect "=1146"
send "1147 44 0\n"
simple_expect "=1147"
client_death 3
client_death 2
client_death 1
client_death 0
lyskomd_death
Supports Markdown
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