aboutsummaryrefslogtreecommitdiff
path: root/src/options.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2014-10-28 10:33:20 +0100
committerAndreas Schneider <asn@cryptomilk.org>2014-12-25 12:32:16 +0100
commitbb18442fe8f58a483713eb2b988b3da9869ddf86 (patch)
tree1469c0d6289a313d73907ab95c5985e838c9a23b /src/options.c
parentc2aed4ca78030d9014a890cb4370e6dc8264823f (diff)
downloadlibssh-bb18442fe8f58a483713eb2b988b3da9869ddf86.tar.gz
libssh-bb18442fe8f58a483713eb2b988b3da9869ddf86.tar.xz
libssh-bb18442fe8f58a483713eb2b988b3da9869ddf86.zip
options: Fix setting the port.
Make sure we correctly read the port from the config file. Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src/options.c')
-rw-r--r--src/options.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/options.c b/src/options.c
index bf4e680b..2b8abb48 100644
--- a/src/options.c
+++ b/src/options.c
@@ -891,11 +891,14 @@ int ssh_options_get_port(ssh_session session, unsigned int* port_target) {
if (session == NULL) {
return -1;
}
- if (!session->opts.port) {
- ssh_set_error_invalid(session);
- return -1;
+
+ if (session->opts.port == 0) {
+ *port_target = 22;
+ return 0;
}
+
*port_target = session->opts.port;
+
return 0;
}