[hotssh/wip/libssh] Start porting to libssh



commit 1eeca6e2abb8fe03e9a2cfaa1c887a9e585fba91
Author: Colin Walters <walters verbum org>
Date:   Sat Oct 19 10:52:39 2013 -0400

    Start porting to libssh
    
    It handles GSSAPI and is already used by KDE, so it's a better choice
    for us.

 configure.ac                         |    2 +-
 libgssh/gssh-channel-input-stream.h  |    2 +-
 libgssh/gssh-channel-output-stream.h |    2 +-
 libgssh/gssh-connection-private.h    |    4 ++--
 libgssh/gssh-connection.c            |   14 +++++++-------
 5 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ca77593..51be55f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,7 +34,7 @@ GLIB_GSETTINGS
 
 PKG_CHECK_MODULES(BUILDDEP_GIO_UNIX, [gio-unix-2.0 >= 2.34])
 PKG_CHECK_MODULES(BUILDDEP_HOTSSHAPP, [gio-unix-2.0 >= 2.34 gtk+-3.0 >= 3.10.0 vte-2.90])
-PKG_CHECK_MODULES(BUILDDEP_LIBGSSH, [gio-unix-2.0 libssh2])
+PKG_CHECK_MODULES(BUILDDEP_LIBGSSH, [gio-unix-2.0 libssh])
 
 AC_CONFIG_FILES([
 Makefile
diff --git a/libgssh/gssh-channel-input-stream.h b/libgssh/gssh-channel-input-stream.h
index a6618d6..0256699 100644
--- a/libgssh/gssh-channel-input-stream.h
+++ b/libgssh/gssh-channel-input-stream.h
@@ -21,7 +21,7 @@
 #pragma once
 
 #include "gssh-channel.h"
-#include <libssh2.h>
+#include <libssh/libssh.h>
 
 #define GSSH_TYPE_CHANNEL_INPUT_STREAM (_gssh_channel_input_stream_get_type ())
 #define GSSH_CHANNEL_INPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSSH_TYPE_CHANNEL_INPUT_STREAM, 
GSshChannelInputStream))
diff --git a/libgssh/gssh-channel-output-stream.h b/libgssh/gssh-channel-output-stream.h
index eafd6fe..035a2b3 100644
--- a/libgssh/gssh-channel-output-stream.h
+++ b/libgssh/gssh-channel-output-stream.h
@@ -21,7 +21,7 @@
 #pragma once
 
 #include "gssh-channel.h"
-#include <libssh2.h>
+#include <libssh/libssh.h>
 
 #define GSSH_TYPE_CHANNEL_OUTPUT_STREAM (_gssh_channel_output_stream_get_type ())
 #define GSSH_CHANNEL_OUTPUT_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSSH_TYPE_CHANNEL_OUTPUT_STREAM, 
GSshChannelOutputStream))
diff --git a/libgssh/gssh-connection-private.h b/libgssh/gssh-connection-private.h
index 0e7bf22..a3ab916 100644
--- a/libgssh/gssh-connection-private.h
+++ b/libgssh/gssh-connection-private.h
@@ -21,7 +21,7 @@
 #pragma once
 
 #include "gssh-connection.h"
-#include <libssh2.h>
+#include <libssh/libssh.h.h>
 
 struct _GSshConnection
 {
@@ -38,7 +38,7 @@ struct _GSshConnection
 
   char **authschemes;
 
-  LIBSSH2_SESSION *session;
+  ssh_session session;
   GHashTable *channels;
 
   GError *cached_error;
diff --git a/libgssh/gssh-connection.c b/libgssh/gssh-connection.c
index 9f90fbf..1490feb 100644
--- a/libgssh/gssh-connection.c
+++ b/libgssh/gssh-connection.c
@@ -43,7 +43,7 @@ typedef enum {
 typedef struct {
   char *exec_command; /* If NULL, then shell */
   GSshConnectionChannelCreationState state;
-  LIBSSH2_CHANNEL *libssh2channel;
+  ssh_channel libssh2channel;
 } GSshConnectionChannelCreationData;
 
 G_DEFINE_TYPE(GSshConnection, gssh_connection, G_TYPE_OBJECT);
@@ -485,7 +485,7 @@ on_socket_client_connected (GObject         *src,
   GSshConnection *self = user_data;
   GError *local_error = NULL;
   GError **error = &local_error;
-  gs_free char *version_str = NULL;
+  int fd;
 
   g_assert (src == (GObject*)self->socket_client);
 
@@ -496,18 +496,18 @@ on_socket_client_connected (GObject         *src,
 
   self->socket = g_socket_connection_get_socket (self->socketconn);
 
-  self->session = libssh2_session_init ();
+  self->session = ssh_new ();
   if (!self->session)
     {
       g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
                            "Failed to initialize SSH2 session");
       goto out;
     }
+  
+  fd = g_socket_get_fd (self->socket);
 
-  libssh2_session_set_blocking (self->session, 0);
-  version_str = g_strdup_printf ("SSH-2.0-libgssh_%s_libssh2_%s",
-                                 PACKAGE_VERSION, libssh2_version (0));
-  libssh2_session_banner_set (self->session, version_str);
+  ssh_set_blocking (self->session, 0);
+  ssh_options_set (self->session, SSH_OPTIONS_FD, &fd);
 
   state_transition (self, GSSH_CONNECTION_STATE_HANDSHAKING);
 


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