1
1

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>
Этот коммит содержится в:
Alex Hermann 2018-08-22 16:15:22 +02:00 коммит произвёл Andreas Schneider
родитель 648f5cf400
Коммит 23f60a56f3

Просмотреть файл

@ -778,7 +778,10 @@ char *ssh_path_expand_escape(ssh_session session, const char *s) {
if (session->opts.port < 65536) { if (session->opts.port < 65536) {
char tmp[6]; 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); x = strdup(tmp);
} }
break; break;