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

Re: Sending arbitrary messages between key exchange and user authentication


On 5.1.2012 10:45, Andreas Schneider wrote:
sorry we just forgot about it. Your patch is fine!

no problem :-)

Could you just fix some absolutely minor things :)

* remove enter_function() and leave_function(), we want to get rid of it.
* use buffer_add_u32(buf, 0) for the language tag which is the same as an
empty string.

Fixed. I hope you do not mind it is in form of a second patch. I have recently moved from one disk to another and the libssh repo that I used to have did not survive the process...

Martin
From 43acf196ae99e01834452da5a489221252fa4bc9 Mon Sep 17 00:00:00 2001
From: Martin Drasar <drasar@xxxxxxxxxxx>
Date: Thu, 5 Jan 2012 10:54:48 +0100
Subject: [PATCH] Minor correction of previous patch that added functionality
 for sending debug and ignore messages

---
 src/session.c |   17 +----------------
 1 files changed, 1 insertions(+), 16 deletions(-)

diff --git a/src/session.c b/src/session.c
index d464601..9a18405 100644
--- a/src/session.c
+++ b/src/session.c
@@ -625,8 +625,6 @@ void ssh_socket_exception_callback(int code, int errno_code, void *user){
 int ssh_send_ignore (ssh_session session, const char *data) {
     ssh_string str = NULL;
 
-    enter_function();
-
     if (ssh_socket_is_open(session->socket)) {
       if (buffer_add_u8(session->out_buffer, SSH2_MSG_IGNORE) < 0) {
         goto error;
@@ -648,12 +646,10 @@ int ssh_send_ignore (ssh_session session, const char *data) {
       ssh_string_free(str);
     }
 
-    leave_function();
     return SSH_OK;
 
 error:
     buffer_reinit(session->out_buffer);
-    leave_function();
     return SSH_ERROR;
 }
 
@@ -671,8 +667,6 @@ error:
 int ssh_send_debug (ssh_session session, const char *message, int always_display) {
     ssh_string str = NULL;
 
-    enter_function();
-
     if (ssh_socket_is_open(session->socket)) {
       if (buffer_add_u8(session->out_buffer, SSH2_MSG_DEBUG) < 0) {
         goto error;
@@ -693,14 +687,7 @@ int ssh_send_debug (ssh_session session, const char *message, int always_display
       }
 
       /* Empty language tag */
-      ssh_string_free(str);
-      str = ssh_string_from_char("");
-      if (str == NULL) {
-        goto error;
-      }
-
-      if (buffer_add_ssh_string(session->out_buffer, str) < 0) {
-        ssh_string_free(str);
+      if (buffer_add_u32(session->out_buffer, 0) < 0) {
         goto error;
       }
 
@@ -710,12 +697,10 @@ int ssh_send_debug (ssh_session session, const char *message, int always_display
       ssh_string_free(str);
     }
 
-    leave_function();
     return SSH_OK;
 
 error:
     buffer_reinit(session->out_buffer);
-    leave_function();
     return SSH_ERROR;
 }
 
-- 
1.7.7.1.msysgit.0


Follow-Ups:
Re: Sending arbitrary messages between key exchange and user authenticationAndreas Schneider <asn@xxxxxxxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org