Commit 1ba05409 authored by Per Cederqvist's avatar Per Cederqvist

New file that is intended to check aux-item 31, 32 and 10100-10104.

Tests for aux-item 31 are written now.
parent 78d2fc5a
# Test suite for lyskomd.
# Copyright (C) 2001 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 aux-items added in lyskomd 2.0.5 (31, 32, 10100-10104).
# 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 "*-*-*"
if {$errorcode == 48} {
pass "$test"
} else {
fail "$test"
}
unset test
}
read_versions
lyskomd_start
client_start 0
talk_to client 0
send "A3Hfoo\n"
simple_expect "LysKOM" "connected"
send "1000 62 5 [holl "gazonk"] 1\n"
simple_expect "=1000"
send "1001 94\n"
simple_expect "=1001 $server_compat_version 1 2 3 4 0 0 \\*"
#
# Test canonical-name (31).
#
# We cannot modify the system info unless we enable our privileges.
send "1002 95 0 { } 1 { 31 00000000 1 [holl "foo.bar.gazonk"] }\n"
simple_expect "%1002 12 0"
send "1003 42 255\n"
simple_expect "=1003"
# Set the canonical-name.
send "1004 95 0 { } 1 { 31 00000000 1 [holl "foo.bar.gazonk"] }\n"
simple_expect "=1004"
send "1005 94\n"
simple_expect "=1005 $server_compat_version 1 2 3 4 0 1 { 1 31 5 $any_time 00000000 1 [holl "foo.bar.gazonk"] }"
# Check that we cannot have more than one canonical-name.
send "1006 95 0 { } 1 { 31 00000000 1 [holl "foo.bar.se"] }\n"
extracting_expect "%1006 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for duplicate canonical-name"
send "1007 94\n"
simple_expect "=1007 $server_compat_version 1 2 3 4 0 1 { 1 31 5 $any_time 00000000 1 [holl "foo.bar.gazonk"] }"
send "1008 95 1 { 1 } 1 { 31 00000000 1 [holl "foo.bar.gazonk:942"] }\n"
simple_expect "=1008"
send "1009 94\n"
simple_expect "=1009 $server_compat_version 1 2 3 4 0 1 { 2 31 5 $any_time 00000000 1 [holl "foo.bar.gazonk:942"] }"
# Attempt to set a few malformed canonical names, and make sure that
# the name set above remains in effect.
proc set_bad_canonical_name {tag} {
global server_compat_version
global any_time
send "998 95 1 { 2 } 1 { 31 00000000 1 [holl "$tag"] }\n"
simple_expect "%998 48 0"
send "999 94\n"
simple_expect "=999 $server_compat_version 1 2 3 4 0 1 { 2 31 5 $any_time 00000000 1 [holl "foo.bar.gazonk:942"] }"
}
set_bad_canonical_name "foo.bar.gazonk:942:18"
set_bad_canonical_name "foo.bar:4711z"
set_bad_canonical_name "foo_bar.ingate.se:4711"
set_bad_canonical_name "foo_bar.ingate.se"
set_bad_canonical_name ""
set_bad_canonical_name ":4711"
# Check that certain bits are cleared.
send "1010 95 1 { 2 } 1 { 31 01111111 8 [holl "kom.lysator.liu.se"] }\n"
simple_expect "=1010"
send "1011 94\n"
simple_expect "=1011 $server_compat_version 1 2 3 4 0 1 { 3 31 5 $any_time 01001111 8 [holl "kom.lysator.liu.se"] }"
# Check that we cannot use canonical-name on texts or persons.
send "1012 86 [holl "foo"] 0 { } 1 { 31 00000000 1 [holl "kom.liu.se"] }\n"
extracting_expect "%1012 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for canonical-name on text"
send "1013 89 [holl "person foo"] [holl "password"] 00000000 1 { 31 00000000 1 [holl "kom.liu.se"] }\n"
extracting_expect "%1013 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for canonical-name on person"
send "1013 88 [holl "conference foo"] 00000000 1 { 31 00000000 1 [holl "kom.liu.se"] }\n"
extracting_expect "%1013 (48|49) 0" errorcode 1
want_illegal_aux_item "Correct error code for canonical-name on conference"
send "1014 44 0\n"
simple_expect "=1014"
client_death 0
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