|
|
096905 |
From c1bbc2d6b0708dcb1fd014554585296b0ba25a43 Mon Sep 17 00:00:00 2001
|
|
|
096905 |
From: Kamil Dudka <kdudka@redhat.com>
|
|
|
096905 |
Date: Mon, 9 Oct 2017 17:35:51 +0200
|
|
|
096905 |
Subject: [PATCH] session: avoid printing misleading debug messages
|
|
|
096905 |
|
|
|
096905 |
... while throwing LIBSSH2_ERROR_EAGAIN out of session_startup()
|
|
|
096905 |
|
|
|
096905 |
If the session runs in blocking mode, LIBSSH2_ERROR_EAGAIN never reaches
|
|
|
096905 |
the libssh2 API boundary and, in non-blocking mode, these messages are
|
|
|
096905 |
suppressed by the condition in _libssh2_error_flags() anyway.
|
|
|
096905 |
|
|
|
096905 |
Closes #211
|
|
|
096905 |
|
|
|
096905 |
Upstream-commit: 712c6cbdd2f1b509f586aea5889a5c1deb7c9bda
|
|
|
096905 |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
096905 |
---
|
|
|
096905 |
src/session.c | 16 ++++++++++++----
|
|
|
096905 |
1 file changed, 12 insertions(+), 4 deletions(-)
|
|
|
096905 |
|
|
|
096905 |
diff --git a/src/session.c b/src/session.c
|
|
|
096905 |
index 9838d2b..62ef70d 100644
|
|
|
096905 |
--- a/src/session.c
|
|
|
096905 |
+++ b/src/session.c
|
|
|
d780b0 |
@@ -703,7 +703,9 @@ session_startup(LIBSSH2_SESSION *session, libssh2_socket_t sock)
|
|
|
096905 |
|
|
|
096905 |
if (session->startup_state == libssh2_NB_state_created) {
|
|
|
096905 |
rc = banner_send(session);
|
|
|
096905 |
- if (rc) {
|
|
|
096905 |
+ if (rc == LIBSSH2_ERROR_EAGAIN)
|
|
|
096905 |
+ return rc;
|
|
|
096905 |
+ else if (rc) {
|
|
|
096905 |
return _libssh2_error(session, rc,
|
|
|
096905 |
"Failed sending banner");
|
|
|
096905 |
}
|
|
|
d780b0 |
@@ -714,7 +716,9 @@ session_startup(LIBSSH2_SESSION *session, libssh2_socket_t sock)
|
|
|
096905 |
if (session->startup_state == libssh2_NB_state_sent) {
|
|
|
096905 |
do {
|
|
|
096905 |
rc = banner_receive(session);
|
|
|
096905 |
- if (rc)
|
|
|
096905 |
+ if (rc == LIBSSH2_ERROR_EAGAIN)
|
|
|
096905 |
+ return rc;
|
|
|
096905 |
+ else if (rc)
|
|
|
096905 |
return _libssh2_error(session, rc,
|
|
|
096905 |
"Failed getting banner");
|
|
|
096905 |
} while(strncmp("SSH-", (char *)session->remote.banner, 4));
|
|
|
d780b0 |
@@ -724,7 +728,9 @@ session_startup(LIBSSH2_SESSION *session, libssh2_socket_t sock)
|
|
|
096905 |
|
|
|
096905 |
if (session->startup_state == libssh2_NB_state_sent1) {
|
|
|
096905 |
rc = _libssh2_kex_exchange(session, 0, &session->startup_key_state);
|
|
|
096905 |
- if (rc)
|
|
|
096905 |
+ if (rc == LIBSSH2_ERROR_EAGAIN)
|
|
|
096905 |
+ return rc;
|
|
|
096905 |
+ else if (rc)
|
|
|
096905 |
return _libssh2_error(session, rc,
|
|
|
096905 |
"Unable to exchange encryption keys");
|
|
|
096905 |
|
|
|
d780b0 |
@@ -749,7 +755,9 @@ session_startup(LIBSSH2_SESSION *session, libssh2_socket_t sock)
|
|
|
096905 |
rc = _libssh2_transport_send(session, session->startup_service,
|
|
|
096905 |
sizeof("ssh-userauth") + 5 - 1,
|
|
|
096905 |
NULL, 0);
|
|
|
096905 |
- if (rc) {
|
|
|
096905 |
+ if (rc == LIBSSH2_ERROR_EAGAIN)
|
|
|
096905 |
+ return rc;
|
|
|
096905 |
+ else if (rc) {
|
|
|
096905 |
return _libssh2_error(session, rc,
|
|
|
096905 |
"Unable to ask for ssh-userauth service");
|
|
|
096905 |
}
|
|
|
096905 |
--
|
|
|
096905 |
2.13.6
|
|
|
096905 |
|