Commit 5b13507a authored by Per Cederqvist's avatar Per Cederqvist

Test the world-readable aux item.

parent 34c133ce
# 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.
# Check the world-readable (33) aux-items.
# We currently get aux-item-permission (49) instead of illegal-aux-item (48)
# in several places.
proc want_illegal_aux_item {tst} {
global test
global errorcode
set test "$tst"
setup_xfail "*-*-*" "Bug 192"
if {$errorcode == 48} {
pass "$test"
} else {
fail "$test"
}
unset test
}
lyskomd_start
# Client 0, person 5, logged in as admin.
client_start 0
talk_to client 0
send "A3Hfoo\n"
simple_expect "LysKOM" "connected"
send "1000 80 0 { }\n"
simple_expect "=1000"
send "1001 62 5 [holl "gazonk"] 1\n"
simple_expect "=1001"
# Client 1, person 6, logged in, creates several texts.
client_start 1
talk_to client 1
send "A3Hfoo\n"
simple_expect "LysKOM" "client 1 connected"
send "1002 80 0 { }\n"
simple_expect "=1002"
send "1003 89 [holl "Opriviligerad"] [holl "hemligt"] 10000000 0 { }\n"
simple_expect "=1003 6"
send "1004 62 6 [holl "hemligt"] 0\n"
simple_expect "=1004"
send "1005 86 [holl "text 1"] 1 { 0 1 } 0 { }\n"
simple_expect "=1005 1"
send "1006 86 [holl "text 2"] 1 { 0 1 } 1 { 34 01111000 20 [holl ""] }\n"
simple_expect "=1006 2"
send "1007 86 [holl "failed"] 1 { 0 1 } 1 { 34 01111000 20 [holl " "] }\n"
simple_expect "%1007 48 0"
send "1008 86 [holl "failed"] 1 { 0 1 } 1 { 34 01111000 20 [holl "^$"] }\n"
simple_expect "%1008 48 0"
send "1009 86 [holl "failed"] 1 { 0 1 } 1 { 34 01111000 20 [holl "^"] }\n"
simple_expect "%1009 48 0"
send "1010 86 [holl "failed"] 1 { 0 1 } 1 { 34 01111000 20 [holl "$"] }\n"
simple_expect "%1010 48 0"
send "1011 86 [holl "failed"] 1 { 0 1 } 1 { 34 01111000 20 [holl "@"] }\n"
simple_expect "%1011 48 0"
send "1012 86 [holl "failed"] 1 { 0 1 } 1 { 34 01111000 20 [holl "."] }\n"
simple_expect "%1012 48 0"
send "1013 86 [holl "failed"] 1 { 0 1 } 1 { 34 01111000 20 [holl ".*"] }\n"
simple_expect "%1013 48 0"
send "1014 86 [holl "failed"] 1 { 0 1 } 1 { 34 01111000 20 [holl "1"] }\n"
simple_expect "%1014 48 0"
send "1015 86 [holl "failed"] 1 { 0 1 } 1 { 34 01111000 20 [holl "xyzzy"] }\n"
simple_expect "%1015 48 0"
send "1016 86 [holl "text 3"] 0 { } 1 { 34 00000000 1 [holl ""] }\n"
simple_expect "=1016 3"
send "1017 86 [holl "text 4"] 1 { 0 1 } 0 { }\n"
simple_expect "=1017 4"
send "1018 86 [holl "text 5"] 0 { } 0 { }\n"
simple_expect "=1018 5"
# Client 2, not logged in, attempts to read all texts.
client_start 2
talk_to client 2
send "A3Hfoo\n"
simple_expect "LysKOM" "client 2 connected"
send "1019 80 0 { }\n"
simple_expect "=1019"
send "1020 25 1 0 20\n"
simple_expect "%1020 14 1"
send "1021 26 1\n"
simple_expect "%1021 14 1"
send "1022 90 1\n"
simple_expect "%1022 14 1"
send "1023 25 2 0 20\n"
simple_expect "=1023 [holl "text 2"]"
send "1024 26 2\n"
simple_expect "=1024 $any_time 6 0 6 0 2 { 0 1 6 2 }"
send "1025 90 2\n"
simple_expect "=1025 $any_time 6 0 6 0 2 { 0 1 6 2 } 1 { 1 34 6 $any_time 00000000 1 [holl ""] }"
send "1026 25 3 0 20\n"
simple_expect "=1026 [holl "text 3"]"
send "1027 26 3\n"
simple_expect "=1027 $any_time 6 0 6 0 0 \\*"
send "1028 90 3\n"
simple_expect "=1028 $any_time 6 0 6 0 0 \\* 1 { 1 34 6 $any_time 00000000 1 [holl ""] }"
send "1029 25 4 0 20\n"
simple_expect "%1029 14 4"
send "1030 26 4\n"
simple_expect "%1030 14 4"
send "1031 90 4\n"
simple_expect "%1031 14 4"
send "1032 25 5 0 20\n"
simple_expect "%1032 14 5"
send "1033 26 5\n"
simple_expect "%1033 14 5"
send "1034 90 5\n"
simple_expect "%1034 14 5"
# Attempt by person 5 to add the world-readable aux item.
talk_to client 0
send "1035 92 3 0 { } 1 { 34 00000000 1 [holl ""] }\n"
simple_expect "%1035 49 0"
send "1036 92 3 0 { } 1 { 34 00000000 1 [holl "1"] }\n"
simple_expect "%1036 49 0"
send "1037 92 4 0 { } 1 { 34 00000000 1 [holl ""] }\n"
simple_expect "%1037 49 0"
send "1038 92 4 0 { } 1 { 34 00000000 1 [holl "1"] }\n"
simple_expect "%1038 49 0"
send "1039 92 5 0 { } 1 { 34 00000000 1 [holl ""] }\n"
simple_expect "%1039 14 5"
send "1040 92 5 0 { } 1 { 34 00000000 1 [holl "1"] }\n"
simple_expect "%1040 14 5"
# Make sure the above didn't affect what client 2 can access.
talk_to client 2
send "1041 25 1 0 20\n"
simple_expect "%1041 14 1"
send "1042 26 1\n"
simple_expect "%1042 14 1"
send "1043 90 1\n"
simple_expect "%1043 14 1"
send "1044 25 2 0 20\n"
simple_expect "=1044 [holl "text 2"]"
send "1045 26 2\n"
simple_expect "=1045 $any_time 6 0 6 0 2 { 0 1 6 2 }"
send "1046 90 2\n"
simple_expect "=1046 $any_time 6 0 6 0 2 { 0 1 6 2 } 1 { 1 34 6 $any_time 00000000 1 [holl ""] }"
send "1047 25 3 0 20\n"
simple_expect "=1047 [holl "text 3"]"
send "1048 26 3\n"
simple_expect "=1048 $any_time 6 0 6 0 0 \\*"
send "1049 90 3\n"
simple_expect "=1049 $any_time 6 0 6 0 0 \\* 1 { 1 34 6 $any_time 00000000 1 [holl ""] }"
send "1050 25 4 0 20\n"
simple_expect "%1050 14 4"
send "1051 26 4\n"
simple_expect "%1051 14 4"
send "1052 90 4\n"
simple_expect "%1052 14 4"
send "1053 25 5 0 20\n"
simple_expect "%1053 14 5"
send "1054 26 5\n"
simple_expect "%1054 14 5"
send "1055 90 5\n"
simple_expect "%1055 14 5"
# Add world-readable to a few texts
talk_to client 1
# world-readable is already set, and unique, so this fails.
send "1056 92 3 0 { } 1 { 34 00000000 1 [holl ""] }\n"
extracting_expect "%1056 (48|49) 0" errorcode 1
want_illegal_aux_item "Attempt to add duplicate world-readable, wich is unique"
send "1057 92 4 0 { } 1 { 34 00000000 1 [holl ""] }\n"
simple_expect "=1057"
send "1058 92 5 0 { } 1 { 34 00000000 1 [holl ""] }\n"
simple_expect "=1058"
# Make sure the above affects what client 2 can access.
talk_to client 2
send "1059 25 1 0 20\n"
simple_expect "%1059 14 1"
send "1060 26 1\n"
simple_expect "%1060 14 1"
send "1061 90 1\n"
simple_expect "%1061 14 1"
send "1062 25 2 0 20\n"
simple_expect "=1062 [holl "text 2"]"
send "1063 26 2\n"
simple_expect "=1063 $any_time 6 0 6 0 2 { 0 1 6 2 }"
send "1064 90 2\n"
simple_expect "=1064 $any_time 6 0 6 0 2 { 0 1 6 2 } 1 { 1 34 6 $any_time 00000000 1 [holl ""] }"
send "1065 25 3 0 20\n"
simple_expect "=1065 [holl "text 3"]"
send "1066 26 3\n"
simple_expect "=1066 $any_time 6 0 6 0 0 \\*"
send "1067 90 3\n"
simple_expect "=1067 $any_time 6 0 6 0 0 \\* 1 { 1 34 6 $any_time 00000000 1 [holl ""] }"
send "1068 25 4 0 20\n"
simple_expect "=1068 [holl "text 4"]"
send "1069 26 4\n"
simple_expect "=1069 $any_time 6 0 6 0 2 { 0 1 6 3 }"
send "1070 90 4\n"
simple_expect "=1070 $any_time 6 0 6 0 2 { 0 1 6 3 } 1 { 1 34 6 $any_time 00000000 1 [holl ""] }"
send ""
send "1071 25 5 0 20\n"
simple_expect "=1071 [holl "text 5"]"
send "1072 26 5\n"
simple_expect "=1072 $any_time 6 0 6 0 0 \\*"
send "1073 90 5\n"
simple_expect "=1073 $any_time 6 0 6 0 0 \\* 1 { 1 34 6 $any_time 00000000 1 [holl ""] }"
# Check that world-readable really isn't inherited.
talk_to client 1
send "1074 86 [holl "text 6"] 2 { 0 1 2 2 } 0 { }\n"
simple_expect "=1074 6"
send "1075 90 6\n"
simple_expect "=1075 $any_time 6 0 6 0 3 { 0 1 6 4 2 2 } 0 \\*"
talk_to client 2
send "1076 25 6 0 20\n"
simple_expect "%1076 14 6"
send "1077 26 6\n"
simple_expect "%1077 14 6"
send "1078 90 6\n"
simple_expect "%1078 14 6"
# Shut down.
talk_to client 0
send "1079 42 255\n"
simple_expect "=1079"
send "1080 44 0\n"
simple_expect "=1080"
client_death 0
client_death 1
client_death 2
lyskomd_death
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