From 23f60a56f368f7c743013655699b475fbe29ff67 Mon Sep 17 00:00:00 2001 From: Alex Hermann Date: Wed, 22 Aug 2018 16:15:22 +0200 Subject: misc: Set default port to 22 in ssh_path_expand_escape() Fixes, among others, ProxyCommand with %p when no port is used on commandline or config file, thus using the default port. Fixes T94 Signed-off-by: Alex Hermann Reviewed-by: Andreas Schneider --- src/misc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/misc.c') diff --git a/src/misc.c b/src/misc.c index 76d96217..5f606044 100644 --- a/src/misc.c +++ b/src/misc.c @@ -778,7 +778,10 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) { if (session->opts.port < 65536) { char tmp[6]; - snprintf(tmp, sizeof(tmp), "%u", session->opts.port); + snprintf(tmp, + sizeof(tmp), + "%u", + session->opts.port > 0 ? session->opts.port : 22); x = strdup(tmp); } break; -- cgit v1.2.3