diff options
author | djm@openbsd.org <djm@openbsd.org> | 2015-03-04 23:22:35 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2015-03-05 10:27:22 +1100 |
commit | ac5e8acefa253eb5e5ba186e34236c0e8007afdc (patch) | |
tree | 94ce27024ed839d1f236d6a416215c91250c04be /regress/unittests/hostkeys | |
parent | 2f04af92f036b0c87a23efb259c37da98cd81fe6 (diff) |
upstream commit
make these work with !SSH1; ok markus@ deraadt@
Diffstat (limited to 'regress/unittests/hostkeys')
-rw-r--r-- | regress/unittests/hostkeys/test_iterate.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/regress/unittests/hostkeys/test_iterate.c b/regress/unittests/hostkeys/test_iterate.c index 68a70610e..fc095ea49 100644 --- a/regress/unittests/hostkeys/test_iterate.c +++ b/regress/unittests/hostkeys/test_iterate.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: test_iterate.c,v 1.1 2015/02/16 22:18:34 djm Exp $ */ | 1 | /* $OpenBSD: test_iterate.c,v 1.2 2015/03/04 23:22:35 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Regress test for hostfile.h hostkeys_foreach() | 3 | * Regress test for hostfile.h hostkeys_foreach() |
4 | * | 4 | * |
@@ -54,7 +54,7 @@ check(struct hostkey_foreach_line *l, void *_ctx) | |||
54 | { | 54 | { |
55 | struct cbctx *ctx = (struct cbctx *)_ctx; | 55 | struct cbctx *ctx = (struct cbctx *)_ctx; |
56 | const struct expected *expected; | 56 | const struct expected *expected; |
57 | const int parse_key = (ctx->flags & HKF_WANT_PARSE_KEY) != 0; | 57 | int parse_key = (ctx->flags & HKF_WANT_PARSE_KEY) != 0; |
58 | const int matching = (ctx->flags & HKF_WANT_MATCH) != 0; | 58 | const int matching = (ctx->flags & HKF_WANT_MATCH) != 0; |
59 | u_int expected_status, expected_match; | 59 | u_int expected_status, expected_match; |
60 | int expected_keytype; | 60 | int expected_keytype; |
@@ -87,12 +87,21 @@ check(struct hostkey_foreach_line *l, void *_ctx) | |||
87 | expected_status = HKF_STATUS_MATCHED; \ | 87 | expected_status = HKF_STATUS_MATCHED; \ |
88 | } \ | 88 | } \ |
89 | } while (0) | 89 | } while (0) |
90 | expected_keytype = (parse_key || expected->no_parse_keytype < 0) ? | ||
91 | expected->l.keytype : expected->no_parse_keytype; | ||
92 | |||
93 | #ifndef WITH_SSH1 | ||
94 | if (expected->l.keytype == KEY_RSA1 || | ||
95 | expected->no_parse_keytype == KEY_RSA1) { | ||
96 | expected_status = HKF_STATUS_INVALID; | ||
97 | expected_keytype = KEY_UNSPEC; | ||
98 | parse_key = 0; | ||
99 | } | ||
100 | #endif | ||
90 | UPDATE_MATCH_STATUS(match_host_p); | 101 | UPDATE_MATCH_STATUS(match_host_p); |
91 | UPDATE_MATCH_STATUS(match_host_s); | 102 | UPDATE_MATCH_STATUS(match_host_s); |
92 | UPDATE_MATCH_STATUS(match_ipv4); | 103 | UPDATE_MATCH_STATUS(match_ipv4); |
93 | UPDATE_MATCH_STATUS(match_ipv6); | 104 | UPDATE_MATCH_STATUS(match_ipv6); |
94 | expected_keytype = (parse_key || expected->no_parse_keytype < 0) ? | ||
95 | expected->l.keytype : expected->no_parse_keytype; | ||
96 | 105 | ||
97 | ASSERT_PTR_NE(l->path, NULL); /* Don't care about path */ | 106 | ASSERT_PTR_NE(l->path, NULL); /* Don't care about path */ |
98 | ASSERT_LONG_LONG_EQ(l->linenum, expected->l.linenum); | 107 | ASSERT_LONG_LONG_EQ(l->linenum, expected->l.linenum); |
@@ -132,6 +141,8 @@ prepare_expected(struct expected *expected, size_t n) | |||
132 | for (i = 0; i < n; i++) { | 141 | for (i = 0; i < n; i++) { |
133 | if (expected[i].key_file == NULL) | 142 | if (expected[i].key_file == NULL) |
134 | continue; | 143 | continue; |
144 | if (expected[i].l.keytype == KEY_RSA1) | ||
145 | continue; | ||
135 | ASSERT_INT_EQ(sshkey_load_public( | 146 | ASSERT_INT_EQ(sshkey_load_public( |
136 | test_data_file(expected[i].key_file), &expected[i].l.key, | 147 | test_data_file(expected[i].key_file), &expected[i].l.key, |
137 | NULL), 0); | 148 | NULL), 0); |