]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
kasp test: Fix key id 0000 lookup
authorMatthijs Mekking <matthijs@isc.org>
Tue, 28 Jan 2020 14:52:08 +0000 (15:52 +0100)
committerMatthijs Mekking <matthijs@isc.org>
Fri, 7 Feb 2020 14:42:31 +0000 (15:42 +0100)
When checking keys we search for keys by key id. The kasp test used key id
0 as an indicator that a key was not yet found. Use "no" instead.

bin/tests/system/kasp/tests.sh

index a40c5375f27f0db5a143bafcf8326ccac0e41f88..7a7b4d9eb0e856b8abe50c041592fafc4d19be44 100644 (file)
@@ -507,6 +507,7 @@ for id in $ids; do
        test "$ret" -eq 0 && continue
 
        ret=0 && check_key "KEY3" "$id"
+
        # If ret is still non-zero, non of the files matched.
        test "$ret" -eq 0 || echo_i "failed"
        status=$((status+ret))
@@ -767,9 +768,9 @@ check_keys()
        _log=0
 
        # Clear key ids.
-       key_set KEY1 ID 0
-       key_set KEY2 ID 0
-       key_set KEY3 ID 0
+       key_set KEY1 ID "no"
+       key_set KEY2 ID "no"
+       key_set KEY3 ID "no"
 
        # Check key files.
        _ids=$(get_keyids "$DIR" "$ZONE" "$_key_algnum")
@@ -778,17 +779,17 @@ check_keys()
                # Check them until a match is found.
                echo_i "check key $_id"
 
-               if [ "0" = "$(key_get KEY1 ID)" ] && [ "$(key_get KEY1 EXPECT)" = "yes" ]; then
+               if [ "no" = "$(key_get KEY1 ID)" ] && [ "$(key_get KEY1 EXPECT)" = "yes" ]; then
                        ret=0
                        check_key "KEY1" "$_id"
                        test "$ret" -eq 0 && key_set KEY1 "ID" "$KEY_ID" && continue
                fi
-               if [ "0" = "$(key_get KEY2 ID)" ] && [ "$(key_get KEY2 EXPECT)" = "yes" ]; then
+               if [ "no" = "$(key_get KEY2 ID)" ] && [ "$(key_get KEY2 EXPECT)" = "yes" ]; then
                        ret=0
                        check_key "KEY2" "$_id"
                        test "$ret" -eq 0 && key_set KEY2 "ID" "$KEY_ID" && continue
                fi
-               if [ "0" = "$(key_get KEY3 ID)" ] && [ "$(key_get KEY3 EXPECT)" = "yes"  ]; then
+               if [ "no" = "$(key_get KEY3 ID)" ] && [ "$(key_get KEY3 EXPECT)" = "yes"  ]; then
                        ret=0
                        check_key "KEY3" "$_id"
                        test "$ret" -eq 0 && key_set KEY3 ID "$KEY_ID" && continue
@@ -808,13 +809,13 @@ check_keys()
 
        ret=0
        if [ "$(key_get KEY1 EXPECT)" = "yes" ]; then
-               test "0" = "$(key_get KEY1 ID)" && log_error "No KEY1 found for zone ${ZONE}"
+               test "no" = "$(key_get KEY1 ID)" && log_error "No KEY1 found for zone ${ZONE}"
        fi
        if [ "$(key_get KEY2 EXPECT)" = "yes" ]; then
-               test "0" = "$(key_get KEY2 ID)" && log_error "No KEY2 found for zone ${ZONE}"
+               test "no" = "$(key_get KEY2 ID)" && log_error "No KEY2 found for zone ${ZONE}"
        fi
        if [ "$(key_get KEY3 EXPECT)" = "yes" ]; then
-               test "0" = "$(key_get KEY3 ID)" && log_error "No KEY3 found for zone ${ZONE}"
+               test "no" = "$(key_get KEY3 ID)" && log_error "No KEY3 found for zone ${ZONE}"
        fi
        test "$ret" -eq 0 || echo_i "failed"
        status=$((status+ret))