diff options
| -rw-r--r-- | libguile-ssh/channel-func.c | 9 | ||||
| -rw-r--r-- | tests/tunnel.scm | 15 |
2 files changed, 23 insertions, 1 deletions
diff --git a/libguile-ssh/channel-func.c b/libguile-ssh/channel-func.c index 4e2980f..ea5715b 100644 --- a/libguile-ssh/channel-func.c +++ b/libguile-ssh/channel-func.c @@ -275,8 +275,15 @@ SCM_GSSH_DEFINE (guile_ssh_channel_open_forward, c_remote_host, scm_to_int32 (remote_port), c_source_host, scm_to_int32 (local_port)); - if (res == SSH_OK) + if (res == SSH_OK) { SCM_SET_CELL_TYPE (channel, SCM_CELL_TYPE (channel) | SCM_OPN); + } else { + _gssh_log_warning (FUNC_NAME, + "Could not open forwarding channel", + scm_list_n (channel, remote_host, + remote_port, source_host, + local_port, SCM_UNDEFINED)); + } scm_dynwind_end (); diff --git a/tests/tunnel.scm b/tests/tunnel.scm index a5ce933..4a7045a 100644 --- a/tests/tunnel.scm +++ b/tests/tunnel.scm @@ -79,6 +79,21 @@ (write-line %test-string channel) (poll channel read-line)))))))) +(test-error-with-log "port forwarding, direct, disconnected session" + (run-client-test + ;; server + (lambda (server) + (start-server/dt-test server + (lambda (channel) + (write-line (read-line channel) channel)))) + ;; client + (lambda () + (call-with-connected-session/tunnel + (lambda (session) + (disconnect! session) + (call-with-forward-channel session + (const #f))))))) + ;; Create a tunnel, check the result. (test-assert-with-log "make-tunnel" (run-client-test |
