[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] add ssh1 support for ssh_send_ignore & ssh_send_debug


On Monday, 13 March 2017 16:19:43 CEST Yanis Kurganov wrote:
> It's a really bad news.
> About 5% our clients still use ssh-1 on old telecom hardware (e.q. Arbor,
> Checkpoint, some Cisco, etc.) in private networks.

I was not able to apply your patch, so I applied them manually.


Are you fine if I add the attached patchset?


	Andreas


-- 
Andreas Schneider                   GPG-ID: CC014E3D
www.cryptomilk.org                asn@xxxxxxxxxxxxxx
From 531e0e24c788fbd64e5771127c6a8a1e89caa88b Mon Sep 17 00:00:00 2001
From: Yanis Kurganov <ykurganov@xxxxxxxxxxxxxx>
Date: Tue, 11 Apr 2017 09:49:55 +0200
Subject: [PATCH 1/2] session: Add SSH1 support in ssh_send_ignore()

Signed-off-by: Yanis Kurganov <ykurganov@xxxxxxxxxxxxxx>
---
 src/session.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/session.c b/src/session.c
index 31bb2a79..1ef8717a 100644
--- a/src/session.c
+++ b/src/session.c
@@ -31,6 +31,9 @@
 #include "libssh/crypto.h"
 #include "libssh/server.h"
 #include "libssh/socket.h"
+#ifdef WITH_SSH1
+#include "libssh/ssh1.h"
+#endif /* WITH_SSH1 */
 #include "libssh/ssh2.h"
 #include "libssh/agent.h"
 #include "libssh/packet.h"
@@ -830,13 +833,17 @@ void ssh_socket_exception_callback(int code, int errno_code, void *user){
  * @return              SSH_OK on success, SSH_ERROR otherwise.
  */
 int ssh_send_ignore (ssh_session session, const char *data) {
+#ifdef WITH_SSH1
+    const int type = session->version == 1 ? SSH_MSG_IGNORE : SSH2_MSG_IGNORE;
+#else /* WITH_SSH1 */
+    const int type = SSH2_MSG_IGNORE;
+#endif /* WITH_SSH1 */
     int rc;
 
     if (ssh_socket_is_open(session->socket)) {
-
         rc = ssh_buffer_pack(session->out_buffer,
                              "bs",
-                             SSH2_MSG_IGNORE,
+                             type,
                              data);
         if (rc != SSH_OK){
             ssh_set_error_oom(session);
-- 
2.12.2


From cfecb264f5e268489043ec0e25fa8d58a74f7bdd Mon Sep 17 00:00:00 2001
From: Yanis Kurganov <ykurganov@xxxxxxxxxxxxxx>
Date: Tue, 11 Apr 2017 09:50:22 +0200
Subject: [PATCH 2/2] session: Add SSH1 support in ssh_send_debug()

Signed-off-by: Yanis Kurganov <ykurganov@xxxxxxxxxxxxxx>
---
 src/session.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/session.c b/src/session.c
index 1ef8717a..e057cfbe 100644
--- a/src/session.c
+++ b/src/session.c
@@ -875,12 +875,22 @@ int ssh_send_debug (ssh_session session, const char *message, int always_display
     int rc;
 
     if (ssh_socket_is_open(session->socket)) {
-        rc = ssh_buffer_pack(session->out_buffer,
-                             "bbsd",
-                             SSH2_MSG_DEBUG,
-                             always_display != 0 ? 1 : 0,
-                             message,
-                             0); /* empty language tag */
+#ifdef WITH_SSH1
+        if (session->version == 1) {
+            rc = ssh_buffer_pack(session->out_buffer,
+                                 "bs",
+                                 SSH_MSG_DEBUG,
+                                 message);
+        } else
+#endif /* WITH_SSH1 */
+        {
+            rc = ssh_buffer_pack(session->out_buffer,
+                                 "bbsd",
+                                 SSH2_MSG_DEBUG,
+                                 always_display != 0 ? 1 : 0,
+                                 message,
+                                 0); /* empty language tag */
+        }
         if (rc != SSH_OK) {
             ssh_set_error_oom(session);
             goto error;
-- 
2.12.2


Follow-Ups:
Re: [PATCH] add ssh1 support for ssh_send_ignore & ssh_send_debugYanis Kurganov <yanis.kurganov@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org