diff options
author | Alex Hermann <alex@hexla.nl> | 2018-08-22 16:15:22 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-08-28 15:44:37 +0200 |
commit | 23f60a56f368f7c743013655699b475fbe29ff67 (patch) | |
tree | aa36b5e8dabc84462df679c0297132a12b03380f | |
parent | 648f5cf400daf522ce486ad6670f866c2344b7e9 (diff) | |
download | libssh-23f60a56f368f7c743013655699b475fbe29ff67.tar.gz libssh-23f60a56f368f7c743013655699b475fbe29ff67.tar.xz libssh-23f60a56f368f7c743013655699b475fbe29ff67.zip |
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>
-rw-r--r-- | src/misc.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; |