diff options
author | dtucker@openbsd.org@openbsd.org <dtucker@openbsd.org@openbsd.org> | 2017-11-03 03:18:53 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2017-11-03 16:20:41 +1100 |
commit | 0208a48517b5e8e8b091f32fa4addcd67c31ca9e (patch) | |
tree | 46491aae590608502d7a3ef3a1510b361093c07d /sshd.c | |
parent | c357eed5a52cd2f4ff358b17e30e3f9a800644da (diff) |
upstream commit
When doing a config test with sshd -T, only require the
attributes that are actually used in Match criteria rather than (an
incomplete list of) all criteria. ok djm@, man page help jmc@
OpenBSD-Commit-ID: b4e773c4212d3dea486d0259ae977551aab2c1fc
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 18 |
1 files changed, 7 insertions, 11 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshd.c,v 1.497 2017/10/27 00:18:41 djm Exp $ */ | 1 | /* $OpenBSD: sshd.c,v 1.498 2017/11/03 03:18:53 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -1429,7 +1429,7 @@ main(int ac, char **av) | |||
1429 | struct sshkey *pubkey; | 1429 | struct sshkey *pubkey; |
1430 | int keytype; | 1430 | int keytype; |
1431 | Authctxt *authctxt; | 1431 | Authctxt *authctxt; |
1432 | struct connection_info *connection_info = get_connection_info(0, 0); | 1432 | struct connection_info *connection_info = NULL; |
1433 | 1433 | ||
1434 | ssh_malloc_init(); /* must be called before any mallocs */ | 1434 | ssh_malloc_init(); /* must be called before any mallocs */ |
1435 | 1435 | ||
@@ -1545,6 +1545,7 @@ main(int ac, char **av) | |||
1545 | test_flag = 2; | 1545 | test_flag = 2; |
1546 | break; | 1546 | break; |
1547 | case 'C': | 1547 | case 'C': |
1548 | connection_info = get_connection_info(0, 0); | ||
1548 | if (parse_server_match_testspec(connection_info, | 1549 | if (parse_server_match_testspec(connection_info, |
1549 | optarg) == -1) | 1550 | optarg) == -1) |
1550 | exit(1); | 1551 | exit(1); |
@@ -1613,14 +1614,10 @@ main(int ac, char **av) | |||
1613 | sensitive_data.have_ssh2_key = 0; | 1614 | sensitive_data.have_ssh2_key = 0; |
1614 | 1615 | ||
1615 | /* | 1616 | /* |
1616 | * If we're doing an extended config test, make sure we have all of | 1617 | * If we're not doing an extended test do not silently ignore connection |
1617 | * the parameters we need. If we're not doing an extended test, | 1618 | * test params. |
1618 | * do not silently ignore connection test params. | ||
1619 | */ | 1619 | */ |
1620 | if (test_flag >= 2 && server_match_spec_complete(connection_info) == 0) | 1620 | if (test_flag < 2 && connection_info != NULL) |
1621 | fatal("user, host and addr are all required when testing " | ||
1622 | "Match configs"); | ||
1623 | if (test_flag < 2 && server_match_spec_complete(connection_info) >= 0) | ||
1624 | fatal("Config test connection parameter (-C) provided without " | 1621 | fatal("Config test connection parameter (-C) provided without " |
1625 | "test mode (-T)"); | 1622 | "test mode (-T)"); |
1626 | 1623 | ||
@@ -1827,8 +1824,7 @@ main(int ac, char **av) | |||
1827 | } | 1824 | } |
1828 | 1825 | ||
1829 | if (test_flag > 1) { | 1826 | if (test_flag > 1) { |
1830 | if (server_match_spec_complete(connection_info) == 1) | 1827 | parse_server_match_config(&options, connection_info); |
1831 | parse_server_match_config(&options, connection_info); | ||
1832 | dump_config(&options); | 1828 | dump_config(&options); |
1833 | } | 1829 | } |
1834 | 1830 | ||