Blame SOURCES/0015-libssh2-1.4.3-debug-msgs.patch

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