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

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