Commit 26dcf6e
session BUGFIX do not close SSH socket twice
Since libssh 0.10, ssh_disconnect() only closes the socket only if it
is not passed via options.
For session server, the SSH socket is not passed to libssh via options.
It is then closed twice in nc_session_free_transport(): once by libssh
in ssh_disconnect() and again by us. This leads to undefined behaviour
in multi-threaded programs.
Currently, we can not distinguish between a socket passed via options
and a socket owned by libssh for cleanup. There is no API in libssh
that can retrieve the socket FD passed via options.
Ensure to pass all sockets via options and handle ssh_disconnect()
behavior before libssh 0.10 (libnetconf2 requires libssh >= 0.9.5)
to prevent double close.
Fixes: 70e9062 ("session BUGFIX close SSH socket")
Signed-off-by: Ilyes Ben Hamouda <[email protected]>1 parent 147b9a1 commit 26dcf6e
2 files changed
+26
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
816 | 816 | | |
817 | 817 | | |
818 | 818 | | |
819 | | - | |
820 | | - | |
821 | 819 | | |
822 | | - | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
823 | 824 | | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
824 | 828 | | |
| 829 | + | |
| 830 | + | |
825 | 831 | | |
826 | 832 | | |
827 | 833 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2020 | 2020 | | |
2021 | 2021 | | |
2022 | 2022 | | |
| 2023 | + | |
| 2024 | + | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
| 2028 | + | |
| 2029 | + | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
2023 | 2037 | | |
2024 | 2038 | | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
2025 | 2042 | | |
2026 | 2043 | | |
2027 | 2044 | | |
| |||
0 commit comments