summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/sshd.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2017-11-14 00:45:30 +0000
committerDamien Miller <djm@cvs.openbsd.org>2017-11-14 00:45:30 +0000
commitd9df466280f91005c30f78b55ff4b39cba7c8aac (patch)
treefb2f477b80d912b402a81b9f184e6b034556bbb5 /usr.bin/ssh/sshd.c
parentc10b1ad4bf17ea00a1d41fde6cf2f3b9d2ce6eb9 (diff)
fix problem in configuration parsing when in config dump mode (sshd -T)
without providing a full connection specification (sshd -T -C ...) spotted by bluhm@
Diffstat (limited to 'usr.bin/ssh/sshd.c')
-rw-r--r--usr.bin/ssh/sshd.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/usr.bin/ssh/sshd.c b/usr.bin/ssh/sshd.c
index b00c9ccb090..a8c4e5dd761 100644
--- a/usr.bin/ssh/sshd.c
+++ b/usr.bin/ssh/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.498 2017/11/03 03:18:53 dtucker Exp $ */
+/* $OpenBSD: sshd.c,v 1.499 2017/11/14 00:45:29 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -126,7 +126,12 @@ char *config_file_name = _PATH_SERVER_CONFIG_FILE;
*/
int debug_flag = 0;
-/* Flag indicating that the daemon should only test the configuration and keys. */
+/*
+ * Indicating that the daemon should only test the configuration and keys.
+ * If test_flag > 1 ("-T" flag), then sshd will also dump the effective
+ * configuration, optionally using connection information provided by the
+ * "-C" flag.
+ */
int test_flag = 0;
/* Flag indicating that the daemon is being started from inetd. */
@@ -1679,6 +1684,12 @@ main(int ac, char **av)
}
if (test_flag > 1) {
+ /*
+ * If no connection info was provided by -C then use
+ * use a blank one that will cause no predicate to match.
+ */
+ if (connection_info == NULL)
+ connection_info = get_connection_info(0, 0);
parse_server_match_config(&options, connection_info);
dump_config(&options);
}