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 <alex@hexla.nl>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 23f60a56f3)
This commit is contained in:
Alex Hermann
2018-08-22 16:15:22 +02:00
committed by Andreas Schneider
parent 8e4491a532
commit 6dc3f666c5

View File

@@ -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;