File tree Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Expand file tree Collapse file tree 3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change
1
+ Fixed crash when more operations were called after ``session.close() `` -- by :user: `Jakuje `.
Original file line number Diff line number Diff line change @@ -539,8 +539,6 @@ cdef class Session(object):
539
539
if self ._libssh_session is not NULL :
540
540
if libssh.ssh_is_connected(self ._libssh_session):
541
541
libssh.ssh_disconnect(self ._libssh_session)
542
- libssh.ssh_free(self ._libssh_session)
543
- self ._libssh_session = NULL
544
542
545
543
def set_missing_host_key_policy (self , policy ):
546
544
""" The policy to use if the know host key is missing.
Original file line number Diff line number Diff line change @@ -13,6 +13,15 @@ def test_make_session():
13
13
assert Session ()
14
14
15
15
16
+ def test_make_session_close_connect ():
17
+ """Make sure the session is usable after call to close()."""
18
+ session = Session ()
19
+ session .close ()
20
+ error_msg = '^ssh connect failed: Hostname required$'
21
+ with pytest .raises (LibsshSessionException , match = error_msg ):
22
+ session .connect ()
23
+
24
+
16
25
def test_session_connection_refused (free_port_num ):
17
26
"""Test that connecting to a missing service raises an error."""
18
27
error_msg = '^ssh connect failed: Connection refused$'
You can’t perform that action at this time.
0 commit comments