1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-07-29 13:01:13 +03:00

channels: Add originator to ssh_channel_accept

Added API function ssh_channel_open_forward_port that is the same as
ssh_channel_accept_forward with the addition to determine the
originator address and port

Signed-off-by: Tomas Holmqvist <tomhol@gmail.com>
Reviewed-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Tomas Holmqvist
2021-03-12 17:52:56 +01:00
committed by Jakub Jelen
parent fef0b3208a
commit dd318aa1a1
4 changed files with 52 additions and 9 deletions

View File

@ -82,6 +82,8 @@ static void torture_ssh_forward(void **state)
ssh_channel c;
int dport;
int bound_port;
char *originator_host = NULL;
int originator_port;
int rc;
int verbosity = SSH_LOG_TRACE;
@ -90,7 +92,7 @@ static void torture_ssh_forward(void **state)
rc = ssh_channel_listen_forward(session, "127.0.0.21", 8080, &bound_port);
assert_ssh_return_code(session, rc);
c = ssh_channel_accept_forward(session, 10, &dport);
c = ssh_channel_open_forward_port(session, 10, &dport, &originator_host, &originator_port);
/* We do not get a listener and run into the timeout here */
assert_null(c);