Skip to content

Commit

Permalink
Fix session timeout issue
Browse files Browse the repository at this point in the history
*  The data type of timeout is expected by ssh_options_set
   is of type long int. Since char was passed for longer timeout
   values it failed setting the right timeout value
*  Explicitly define long int variable for timeout
  • Loading branch information
ganeshrn committed May 7, 2020
1 parent 06a250a commit a2502ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/pylibsshext/session.pyx
Expand Up @@ -89,6 +89,7 @@ cdef class Session:

def set_ssh_options(self, key, value):
cdef unsigned int port_i
cdef long timeout_i

key_m = None
if key in OPTS_DIR_MAP:
Expand All @@ -100,6 +101,9 @@ cdef class Session:
if key == "port":
port_i = value
libssh.ssh_options_set(self._libssh_session, OPTS_MAP["port"], &port_i)
elif key == "timeout":
timeout_i = value
libssh.ssh_options_set(self._libssh_session, OPTS_MAP["timeout"], &timeout_i)
else:
if isinstance(value, basestring):
value = value.encode("utf-8")
Expand Down

0 comments on commit a2502ef

Please sign in to comment.