summaryrefslogtreecommitdiff
path: root/regress/unittests/hostkeys/test_iterate.c
diff options
context:
space:
mode:
Diffstat (limited to 'regress/unittests/hostkeys/test_iterate.c')
-rw-r--r--regress/unittests/hostkeys/test_iterate.c249
1 files changed, 47 insertions, 202 deletions
diff --git a/regress/unittests/hostkeys/test_iterate.c b/regress/unittests/hostkeys/test_iterate.c
index 2eaaf063..751825dd 100644
--- a/regress/unittests/hostkeys/test_iterate.c
+++ b/regress/unittests/hostkeys/test_iterate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: test_iterate.c,v 1.4 2015/03/31 22:59:01 djm Exp $ */
+/* $OpenBSD: test_iterate.c,v 1.5 2017/04/30 23:33:48 djm Exp $ */
/*
* Regress test for hostfile.h hostkeys_foreach()
*
@@ -90,14 +90,6 @@ check(struct hostkey_foreach_line *l, void *_ctx)
expected_keytype = (parse_key || expected->no_parse_keytype < 0) ?
expected->l.keytype : expected->no_parse_keytype;
-#ifndef WITH_SSH1
- if (parse_key && (expected->l.keytype == KEY_RSA1 ||
- expected->no_parse_keytype == KEY_RSA1)) {
- expected_status = HKF_STATUS_INVALID;
- expected_keytype = KEY_UNSPEC;
- parse_key = 0;
- }
-#endif
#ifndef OPENSSL_HAS_ECC
if (expected->l.keytype == KEY_ECDSA ||
expected->no_parse_keytype == KEY_ECDSA) {
@@ -150,10 +142,6 @@ prepare_expected(struct expected *expected, size_t n)
for (i = 0; i < n; i++) {
if (expected[i].key_file == NULL)
continue;
-#ifndef WITH_SSH1
- if (expected[i].l.keytype == KEY_RSA1)
- continue;
-#endif
#ifndef OPENSSL_HAS_ECC
if (expected[i].l.keytype == KEY_ECDSA)
continue;
@@ -217,22 +205,9 @@ struct expected expected_full[] = {
NULL, /* filled at runtime */
"ED25519 #1",
} },
- { "rsa1_1.pub" , -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
- NULL,
- 5,
- HKF_STATUS_OK,
- 0,
- NULL,
- MRK_NONE,
- "sisyphus.example.com",
- NULL,
- KEY_RSA1,
- NULL, /* filled at runtime */
- "RSA1 #1",
- } },
{ "rsa_1.pub" , -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
NULL,
- 6,
+ 5,
HKF_STATUS_OK,
0,
NULL,
@@ -245,7 +220,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, 0, 0, 0, -1, {
NULL,
- 7,
+ 6,
HKF_STATUS_COMMENT,
0,
"",
@@ -258,7 +233,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, 0, 0, 0, -1, {
NULL,
- 8,
+ 7,
HKF_STATUS_COMMENT,
0,
"# Plain host keys, hostnames + addresses",
@@ -271,7 +246,7 @@ struct expected expected_full[] = {
} },
{ "dsa_2.pub" , -1, -1, HKF_MATCH_HOST, 0, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
NULL,
- 9,
+ 8,
HKF_STATUS_OK,
0,
NULL,
@@ -284,7 +259,7 @@ struct expected expected_full[] = {
} },
{ "ecdsa_2.pub" , -1, -1, HKF_MATCH_HOST, 0, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
NULL,
- 10,
+ 9,
HKF_STATUS_OK,
0,
NULL,
@@ -297,7 +272,7 @@ struct expected expected_full[] = {
} },
{ "ed25519_2.pub" , -1, -1, HKF_MATCH_HOST, 0, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
NULL,
- 11,
+ 10,
HKF_STATUS_OK,
0,
NULL,
@@ -308,22 +283,9 @@ struct expected expected_full[] = {
NULL, /* filled at runtime */
"ED25519 #2",
} },
- { "rsa1_2.pub" , -1, -1, HKF_MATCH_HOST, 0, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
- NULL,
- 12,
- HKF_STATUS_OK,
- 0,
- NULL,
- MRK_NONE,
- "prometheus.example.com,192.0.2.1,2001:db8::1",
- NULL,
- KEY_RSA1,
- NULL, /* filled at runtime */
- "RSA1 #2",
- } },
{ "rsa_2.pub" , -1, -1, HKF_MATCH_HOST, 0, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
NULL,
- 13,
+ 11,
HKF_STATUS_OK,
0,
NULL,
@@ -336,7 +298,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, 0, 0, 0, -1, {
NULL,
- 14,
+ 12,
HKF_STATUS_COMMENT,
0,
"",
@@ -349,7 +311,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, 0, 0, 0, -1, {
NULL,
- 15,
+ 13,
HKF_STATUS_COMMENT,
0,
"# Some hosts with wildcard names / IPs",
@@ -362,7 +324,7 @@ struct expected expected_full[] = {
} },
{ "dsa_3.pub" , -1, -1, HKF_MATCH_HOST, HKF_MATCH_HOST, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
NULL,
- 16,
+ 14,
HKF_STATUS_OK,
0,
NULL,
@@ -375,7 +337,7 @@ struct expected expected_full[] = {
} },
{ "ecdsa_3.pub" , -1, -1, HKF_MATCH_HOST, HKF_MATCH_HOST, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
NULL,
- 17,
+ 15,
HKF_STATUS_OK,
0,
NULL,
@@ -388,7 +350,7 @@ struct expected expected_full[] = {
} },
{ "ed25519_3.pub" , -1, -1, HKF_MATCH_HOST, HKF_MATCH_HOST, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
NULL,
- 18,
+ 16,
HKF_STATUS_OK,
0,
NULL,
@@ -399,22 +361,9 @@ struct expected expected_full[] = {
NULL, /* filled at runtime */
"ED25519 #3",
} },
- { "rsa1_3.pub" , -1, -1, HKF_MATCH_HOST, HKF_MATCH_HOST, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
- NULL,
- 19,
- HKF_STATUS_OK,
- 0,
- NULL,
- MRK_NONE,
- "*.example.com,192.0.2.*,2001:*",
- NULL,
- KEY_RSA1,
- NULL, /* filled at runtime */
- "RSA1 #3",
- } },
{ "rsa_3.pub" , -1, -1, HKF_MATCH_HOST, HKF_MATCH_HOST, HKF_MATCH_IP, HKF_MATCH_IP, -1, {
NULL,
- 20,
+ 17,
HKF_STATUS_OK,
0,
NULL,
@@ -427,7 +376,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, 0, 0, 0, -1, {
NULL,
- 21,
+ 18,
HKF_STATUS_COMMENT,
0,
"",
@@ -440,7 +389,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, 0, 0, 0, -1, {
NULL,
- 22,
+ 19,
HKF_STATUS_COMMENT,
0,
"# Hashed hostname and address entries",
@@ -453,7 +402,7 @@ struct expected expected_full[] = {
} },
{ "dsa_5.pub" , -1, -1, 0, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, -1, {
NULL,
- 23,
+ 20,
HKF_STATUS_OK,
0,
NULL,
@@ -466,7 +415,7 @@ struct expected expected_full[] = {
} },
{ "ecdsa_5.pub" , -1, -1, 0, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, -1, {
NULL,
- 24,
+ 21,
HKF_STATUS_OK,
0,
NULL,
@@ -479,7 +428,7 @@ struct expected expected_full[] = {
} },
{ "ed25519_5.pub" , -1, -1, 0, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, -1, {
NULL,
- 25,
+ 22,
HKF_STATUS_OK,
0,
NULL,
@@ -490,22 +439,9 @@ struct expected expected_full[] = {
NULL, /* filled at runtime */
"ED25519 #5",
} },
- { "rsa1_5.pub" , -1, -1, 0, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, -1, {
- NULL,
- 26,
- HKF_STATUS_OK,
- 0,
- NULL,
- MRK_NONE,
- NULL,
- NULL,
- KEY_RSA1,
- NULL, /* filled at runtime */
- "RSA1 #5",
- } },
{ "rsa_5.pub" , -1, -1, 0, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, -1, {
NULL,
- 27,
+ 23,
HKF_STATUS_OK,
0,
NULL,
@@ -518,7 +454,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, 0, 0, 0, -1, {
NULL,
- 28,
+ 24,
HKF_STATUS_COMMENT,
0,
"",
@@ -536,7 +472,7 @@ struct expected expected_full[] = {
*/
{ "dsa_6.pub" , -1, -1, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, 0, -1, {
NULL,
- 29,
+ 25,
HKF_STATUS_OK,
0,
NULL,
@@ -549,7 +485,7 @@ struct expected expected_full[] = {
} },
{ "dsa_6.pub" , -1, -1, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, 0, -1, {
NULL,
- 30,
+ 26,
HKF_STATUS_OK,
0,
NULL,
@@ -562,7 +498,7 @@ struct expected expected_full[] = {
} },
{ "dsa_6.pub" , -1, -1, 0, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, -1, {
NULL,
- 31,
+ 27,
HKF_STATUS_OK,
0,
NULL,
@@ -575,7 +511,7 @@ struct expected expected_full[] = {
} },
{ "ecdsa_6.pub" , -1, -1, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, 0, -1, {
NULL,
- 32,
+ 28,
HKF_STATUS_OK,
0,
NULL,
@@ -588,7 +524,7 @@ struct expected expected_full[] = {
} },
{ "ecdsa_6.pub" , -1, -1, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, 0, -1, {
NULL,
- 33,
+ 29,
HKF_STATUS_OK,
0,
NULL,
@@ -601,7 +537,7 @@ struct expected expected_full[] = {
} },
{ "ecdsa_6.pub" , -1, -1, 0, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, -1, {
NULL,
- 34,
+ 30,
HKF_STATUS_OK,
0,
NULL,
@@ -614,7 +550,7 @@ struct expected expected_full[] = {
} },
{ "ed25519_6.pub" , -1, -1, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, 0, -1, {
NULL,
- 35,
+ 31,
HKF_STATUS_OK,
0,
NULL,
@@ -627,7 +563,7 @@ struct expected expected_full[] = {
} },
{ "ed25519_6.pub" , -1, -1, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, 0, -1, {
NULL,
- 36,
+ 32,
HKF_STATUS_OK,
0,
NULL,
@@ -640,7 +576,7 @@ struct expected expected_full[] = {
} },
{ "ed25519_6.pub" , -1, -1, 0, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, -1, {
NULL,
- 37,
+ 33,
HKF_STATUS_OK,
0,
NULL,
@@ -651,48 +587,9 @@ struct expected expected_full[] = {
NULL, /* filled at runtime */
"ED25519 #6",
} },
- { "rsa1_6.pub" , -1, -1, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, 0, -1, {
- NULL,
- 38,
- HKF_STATUS_OK,
- 0,
- NULL,
- MRK_NONE,
- NULL,
- NULL,
- KEY_RSA1,
- NULL, /* filled at runtime */
- "RSA1 #6",
- } },
- { "rsa1_6.pub" , -1, -1, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, 0, -1, {
- NULL,
- 39,
- HKF_STATUS_OK,
- 0,
- NULL,
- MRK_NONE,
- NULL,
- NULL,
- KEY_RSA1,
- NULL, /* filled at runtime */
- "RSA1 #6",
- } },
- { "rsa1_6.pub" , -1, -1, 0, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, -1, {
- NULL,
- 40,
- HKF_STATUS_OK,
- 0,
- NULL,
- MRK_NONE,
- NULL,
- NULL,
- KEY_RSA1,
- NULL, /* filled at runtime */
- "RSA1 #6",
- } },
{ "rsa_6.pub" , -1, -1, HKF_MATCH_HOST|HKF_MATCH_HOST_HASHED, 0, 0, 0, -1, {
NULL,
- 41,
+ 34,
HKF_STATUS_OK,
0,
NULL,
@@ -705,7 +602,7 @@ struct expected expected_full[] = {
} },
{ "rsa_6.pub" , -1, -1, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, 0, -1, {
NULL,
- 42,
+ 35,
HKF_STATUS_OK,
0,
NULL,
@@ -718,7 +615,7 @@ struct expected expected_full[] = {
} },
{ "rsa_6.pub" , -1, -1, 0, 0, 0, HKF_MATCH_IP|HKF_MATCH_IP_HASHED, -1, {
NULL,
- 43,
+ 36,
HKF_STATUS_OK,
0,
NULL,
@@ -731,7 +628,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, 0, 0, 0, -1, {
NULL,
- 44,
+ 37,
HKF_STATUS_COMMENT,
0,
"",
@@ -744,7 +641,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, 0, 0, 0, -1, {
NULL,
- 45,
+ 38,
HKF_STATUS_COMMENT,
0,
"",
@@ -757,7 +654,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, 0, 0, 0, -1, {
NULL,
- 46,
+ 39,
HKF_STATUS_COMMENT,
0,
"# Revoked and CA keys",
@@ -768,22 +665,9 @@ struct expected expected_full[] = {
NULL,
NULL,
} },
- { "rsa1_4.pub" , -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
- NULL,
- 47,
- HKF_STATUS_OK,
- 0,
- NULL,
- MRK_REVOKE,
- "sisyphus.example.com",
- NULL,
- KEY_RSA1,
- NULL, /* filled at runtime */
- "RSA1 #4",
- } },
{ "ed25519_4.pub" , -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
NULL,
- 48,
+ 40,
HKF_STATUS_OK,
0,
NULL,
@@ -796,7 +680,7 @@ struct expected expected_full[] = {
} },
{ "ecdsa_4.pub" , -1, -1, HKF_MATCH_HOST, 0, 0, 0, -1, {
NULL,
- 49,
+ 41,
HKF_STATUS_OK,
0,
NULL,
@@ -809,7 +693,7 @@ struct expected expected_full[] = {
} },
{ "dsa_4.pub" , -1, -1, HKF_MATCH_HOST, HKF_MATCH_HOST, 0, 0, -1, {
NULL,
- 50,
+ 42,
HKF_STATUS_OK,
0,
NULL,
@@ -822,7 +706,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, 0, 0, 0, -1, {
NULL,
- 51,
+ 43,
HKF_STATUS_COMMENT,
0,
"",
@@ -835,7 +719,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, 0, 0, 0, -1, {
NULL,
- 52,
+ 44,
HKF_STATUS_COMMENT,
0,
"# Some invalid lines",
@@ -848,7 +732,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, 0, 0, 0, -1, {
NULL,
- 53,
+ 45,
HKF_STATUS_INVALID,
0,
NULL,
@@ -861,7 +745,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
NULL,
- 54,
+ 46,
HKF_STATUS_INVALID,
0,
NULL,
@@ -874,7 +758,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, HKF_MATCH_HOST, 0, 0, 0, -1, {
NULL,
- 55,
+ 47,
HKF_STATUS_INVALID,
0,
NULL,
@@ -887,33 +771,7 @@ struct expected expected_full[] = {
} },
{ NULL, -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
NULL,
- 56,
- HKF_STATUS_INVALID, /* Would be ok if key not parsed */
- 0,
- NULL,
- MRK_NONE,
- "sisyphus.example.com",
- NULL,
- KEY_UNSPEC,
- NULL,
- NULL,
- } },
- { NULL, -1, -1, HKF_MATCH_HOST, 0, 0, 0, -1, {
- NULL,
- 57,
- HKF_STATUS_INVALID, /* Would be ok if key not parsed */
- 0,
- NULL,
- MRK_NONE,
- "prometheus.example.com",
- NULL,
- KEY_UNSPEC,
- NULL,
- NULL,
- } },
- { NULL, HKF_STATUS_OK, KEY_RSA1, 0, HKF_MATCH_HOST, 0, 0, -1, {
- NULL,
- 58,
+ 48,
HKF_STATUS_INVALID, /* Would be ok if key not parsed */
0,
NULL,
@@ -924,22 +782,9 @@ struct expected expected_full[] = {
NULL,
NULL,
} },
- { NULL, HKF_STATUS_OK, KEY_RSA1, HKF_MATCH_HOST, 0, 0, 0, -1, {
- NULL,
- 59,
- HKF_STATUS_INVALID, /* Would be ok if key not parsed */
- 0,
- NULL,
- MRK_NONE,
- "prometheus.example.com",
- NULL,
- KEY_UNSPEC,
- NULL, /* filled at runtime */
- NULL,
- } },
{ NULL, -1, -1, 0, HKF_MATCH_HOST, 0, 0, -1, {
NULL,
- 60,
+ 49,
HKF_STATUS_INVALID,
0,
NULL,
@@ -952,7 +797,7 @@ struct expected expected_full[] = {
} },
{ NULL, HKF_STATUS_OK, KEY_RSA, HKF_MATCH_HOST, 0, 0, 0, -1, {
NULL,
- 61,
+ 50,
HKF_STATUS_INVALID, /* Would be ok if key not parsed */
0,
NULL,