Remove dependence on keyring list order

This commit is contained in:
Jeremy Lakeman 2016-10-26 13:01:16 +10:30
parent 26e38e79cb
commit 7f6316b7df

View File

@ -71,20 +71,11 @@ test_keyringList() {
executeJavaOk org.servalproject.test.Keyring list-identities
tfw_cat --stdout --stderr
assertStdoutLineCount == $IDENTITY_COUNT
# TODO: these tests only work because the listed order of identities is the
# order of creation, which makes locked identities easy to attack. When the
# random search TODO in keyring.c:find_free_slot() is done, then these tests
# should fail.
for ((n = 1; n != IDENTITY_COUNT + 1; ++n)); do
line="$(sed -n -e ${n}p "$TFWSTDOUT")"
unset_vars_with_prefix XX_
unpack_vars XX_ "$line"
local sidvar=SIDA$n
local didvar=DIDA$n
local namevar=NAMEA$n
assert [ "$XX_sid" = "${!sidvar}" ]
assert [ "$XX_did" = "${!didvar-null}" ]
assert [ "$XX_name" = "${!namevar-null}" ]
assertStdoutGrep --matches=1 "^sid=${!sidvar}, did=${!didvar-null}, name=${!namevar-null}$"
done
}