libssh/SOURCES/libssh-0.8.5-ensure-ssh-session-fd-writable.patch
2021-09-09 21:01:10 +00:00

48 lines
1.6 KiB
Diff

From 7f1d30de47d67c03cf895f0d4d4e68daf9d396c5 Mon Sep 17 00:00:00 2001
From: Sanne Raymaekers <sraymaek@redhat.com>
Date: Fri, 26 Oct 2018 14:58:34 +0200
Subject: [PATCH] tests: Ensure the ssh session fd is read-/writeable in
torture_proxycommand
Signed-off-by: Sanne Raymaekers <sraymaek@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit 03c30e9c8ad34b3fa659a70e474a9b8cb248f85b)
(cherry picked from commit 3de34944ad11bf4e22fc981562f32cb4b3b90ba9)
---
tests/client/torture_proxycommand.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tests/client/torture_proxycommand.c b/tests/client/torture_proxycommand.c
index ea1e1838..9608e663 100644
--- a/tests/client/torture_proxycommand.c
+++ b/tests/client/torture_proxycommand.c
@@ -9,6 +9,7 @@
#include <sys/types.h>
#include <pwd.h>
#include <errno.h>
+#include <fcntl.h>
static int sshd_setup(void **state)
{
@@ -61,11 +62,16 @@ static void torture_options_set_proxycommand(void **state) {
struct torture_state *s = *state;
ssh_session session = s->ssh.session;
int rc;
+ socket_t fd;
rc = ssh_options_set(session, SSH_OPTIONS_PROXYCOMMAND, "nc 127.0.0.10 22");
assert_int_equal(rc, 0);
rc = ssh_connect(session);
assert_ssh_return_code(session, rc);
+ fd = ssh_get_fd(session);
+ assert_true(fd != SSH_INVALID_SOCKET);
+ rc = fcntl(fd, F_GETFL);
+ assert_int_equal(rc & O_RDWR, O_RDWR);
}
static void torture_options_set_proxycommand_notexist(void **state) {
--
2.19.1