From 7f6316b7df32f79bffeb760adc2834fe27365366 Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Wed, 26 Oct 2016 13:01:16 +1030 Subject: [PATCH] Remove dependence on keyring list order --- tests/keyringjava | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/tests/keyringjava b/tests/keyringjava index e073ae8e..5527e920 100755 --- a/tests/keyringjava +++ b/tests/keyringjava @@ -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 }