[X2Go-Commits] [x2goclient-contrib] 01/01: Add libssh 0.7.4-x2go1 (2 patches applied):
git-admin at x2go.org
git-admin at x2go.org
Sat Mar 11 17:13:46 CET 2017
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2goclient-contrib.
commit 593beafb0e8f1d2de870bf105c53fd1467879fb0
Author: Mike DePaulo <mikedep333 at gmail.com>
Date: Sat Mar 11 11:12:10 2017 -0500
Add libssh 0.7.4-x2go1 (2 patches applied):
1. Pageant patch (refreshed)
2. Patch for libssh bug#251 (not sure if it affects us or not, but it is a Windows-specific bugfix)
---
current-timestamp-scripts.sh | 2 +-
.../CMake-Show-My-Changes.txt | 13 +
.../CMake/libssh/libssh-config-version.cmake | 11 +
.../CMake/libssh/libssh-config.cmake | 13 +
libssh/0.7.4-x2go1-mingw482_bin/bin/libssh.dll | Bin 0 -> 627156 bytes
.../bin/libssh_threads.dll | Bin 0 -> 41391 bytes
.../include/libssh/callbacks.h | 855 +++++++++++++++++
.../include/libssh/legacy.h | 120 +++
.../include/libssh/libssh.h | 677 +++++++++++++
.../include/libssh/libsshpp.hpp | 614 ++++++++++++
.../include/libssh/server.h | 336 +++++++
.../0.7.4-x2go1-mingw482_bin/include/libssh/sftp.h | 1000 ++++++++++++++++++++
.../0.7.4-x2go1-mingw482_bin/include/libssh/ssh2.h | 80 ++
libssh/0.7.4-x2go1-mingw482_bin/lib/libssh.dll.a | Bin 0 -> 242682 bytes
.../lib/libssh_threads.dll.a | Bin 0 -> 1538 bytes
libssh/0.7.4-x2go1-mingw482_bin_set-timestamps.sh | 14 +
.../0001-pki-Use-byte-mode-for-fopen.patch | 38 +
...r-WIndows-s-Pageant-patch-0001-implement-.patch | 530 +++++++++++
.../CMake-Show-My-Changes.txt | 13 +
.../0.7.4-x2go1-mingw482_src/libssh-0.7.4.tar.xz | Bin 0 -> 351892 bytes
20 files changed, 4315 insertions(+), 1 deletion(-)
diff --git a/current-timestamp-scripts.sh b/current-timestamp-scripts.sh
index b652ced..b54a7b1 100755
--- a/current-timestamp-scripts.sh
+++ b/current-timestamp-scripts.sh
@@ -8,8 +8,8 @@ cd cygwin
cd ..
cd libssh
-./0.6.5-x2go1-mingw482_bin_set-timestamps.sh
./0.7.0-x2go1-mingw482_bin_set-timestamps.sh
+./0.7.4-x2go1-mingw482_bin_set-timestamps.sh
cd..
cd libzip
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/CMake-Show-My-Changes.txt b/libssh/0.7.4-x2go1-mingw482_bin/CMake-Show-My-Changes.txt
new file mode 100755
index 0000000..ef43695
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_bin/CMake-Show-My-Changes.txt
@@ -0,0 +1,13 @@
+Commandline options:
+-DCMAKE_C_COMPILER:FILEPATH="C:/i686-4.8.2-release-posix-dwarf-rt_v3-rev3/bin/gcc.exe" -DZLIB_LIBRARY_RELEASE:FILEPATH="C:/x2gobuilds/libssh_depends/zlib128-dll/zlib1.dll" -DWITH_GSSAPI:BOOL="0" -DWITH_NACL:BOOL="0" -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_MAKE_PROGRAM:FILEPATH="C:/i686-4.8.2-release-posix-dwarf-rt_v3-rev3/mingw32/bin/mingw32-make.exe" -DWITH_EXAMPLES:BOOL="0" -DZLIB_INCLUDE_DIR:PATH="C:/x2gobuilds/depends/zlib128-dll/include"
+
+
+Cache file:
+CMAKE_C_COMPILER:FILEPATH=C:/i686-4.8.2-release-posix-dwarf-rt_v3-rev3/bin/gcc.exe
+ZLIB_LIBRARY_RELEASE:FILEPATH=C:/x2gobuilds/libssh_depends/zlib128-dll/zlib1.dll
+WITH_GSSAPI:BOOL=0
+WITH_NACL:BOOL=0
+CMAKE_BUILD_TYPE:STRING=Release
+CMAKE_MAKE_PROGRAM:FILEPATH=C:/i686-4.8.2-release-posix-dwarf-rt_v3-rev3/mingw32/bin/mingw32-make.exe
+WITH_EXAMPLES:BOOL=0
+ZLIB_INCLUDE_DIR:PATH=C:/x2gobuilds/depends/zlib128-dll/include
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/CMake/libssh/libssh-config-version.cmake b/libssh/0.7.4-x2go1-mingw482_bin/CMake/libssh/libssh-config-version.cmake
new file mode 100755
index 0000000..51034a5
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_bin/CMake/libssh/libssh-config-version.cmake
@@ -0,0 +1,11 @@
+set(PACKAGE_VERSION 0.7.4)
+
+# Check whether the requested PACKAGE_FIND_VERSION is compatible
+if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
+ set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+ set(PACKAGE_VERSION_COMPATIBLE TRUE)
+ if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
+ set(PACKAGE_VERSION_EXACT TRUE)
+ endif()
+endif()
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/CMake/libssh/libssh-config.cmake b/libssh/0.7.4-x2go1-mingw482_bin/CMake/libssh/libssh-config.cmake
new file mode 100755
index 0000000..37a636b
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_bin/CMake/libssh/libssh-config.cmake
@@ -0,0 +1,13 @@
+get_filename_component(LIBSSH_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+if (EXISTS "${LIBSSH_CMAKE_DIR}/CMakeCache.txt")
+ # In build tree
+ include(${LIBSSH_CMAKE_DIR}/libssh-build-tree-settings.cmake)
+else()
+ set(LIBSSH_INCLUDE_DIR include)
+endif()
+
+set(LIBSSH_LIBRARY lib/libssh.dll)
+set(LIBSSH_LIBRARIES lib/libssh.dll)
+
+set(LIBSSH_THREADS_LIBRARY lib/libssh.dll)
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/bin/libssh.dll b/libssh/0.7.4-x2go1-mingw482_bin/bin/libssh.dll
new file mode 100755
index 0000000..09caa8b
Binary files /dev/null and b/libssh/0.7.4-x2go1-mingw482_bin/bin/libssh.dll differ
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/bin/libssh_threads.dll b/libssh/0.7.4-x2go1-mingw482_bin/bin/libssh_threads.dll
new file mode 100755
index 0000000..f409cc5
Binary files /dev/null and b/libssh/0.7.4-x2go1-mingw482_bin/bin/libssh_threads.dll differ
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/callbacks.h b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/callbacks.h
new file mode 100755
index 0000000..6bd8c57
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/callbacks.h
@@ -0,0 +1,855 @@
+/*
+ * This file is part of the SSH Library
+ *
+ * Copyright (c) 2009 Aris Adamantiadis <aris at 0xbadc0de.be>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* callback.h
+ * This file includes the public declarations for the libssh callback mechanism
+ */
+
+#ifndef _SSH_CALLBACK_H
+#define _SSH_CALLBACK_H
+
+#include <libssh/libssh.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @defgroup libssh_callbacks The libssh callbacks
+ * @ingroup libssh
+ *
+ * Callback which can be replaced in libssh.
+ *
+ * @{
+ */
+
+/** @internal
+ * @brief callback to process simple codes
+ * @param code value to transmit
+ * @param user Userdata to pass in callback
+ */
+typedef void (*ssh_callback_int) (int code, void *user);
+
+/** @internal
+ * @brief callback for data received messages.
+ * @param data data retrieved from the socket or stream
+ * @param len number of bytes available from this stream
+ * @param user user-supplied pointer sent along with all callback messages
+ * @returns number of bytes processed by the callee. The remaining bytes will
+ * be sent in the next callback message, when more data is available.
+ */
+typedef int (*ssh_callback_data) (const void *data, size_t len, void *user);
+
+typedef void (*ssh_callback_int_int) (int code, int errno_code, void *user);
+
+typedef int (*ssh_message_callback) (ssh_session, ssh_message message, void *user);
+typedef int (*ssh_channel_callback_int) (ssh_channel channel, int code, void *user);
+typedef int (*ssh_channel_callback_data) (ssh_channel channel, int code, void *data, size_t len, void *user);
+
+/**
+ * @brief SSH log callback. All logging messages will go through this callback
+ * @param session Current session handler
+ * @param priority Priority of the log, the smaller being the more important
+ * @param message the actual message
+ * @param userdata Userdata to be passed to the callback function.
+ */
+typedef void (*ssh_log_callback) (ssh_session session, int priority,
+ const char *message, void *userdata);
+
+/**
+ * @brief SSH log callback.
+ *
+ * All logging messages will go through this callback.
+ *
+ * @param priority Priority of the log, the smaller being the more important.
+ *
+ * @param function The function name calling the the logging fucntions.
+ *
+ * @param message The actual message
+ *
+ * @param userdata Userdata to be passed to the callback function.
+ */
+typedef void (*ssh_logging_callback) (int priority,
+ const char *function,
+ const char *buffer,
+ void *userdata);
+
+/**
+ * @brief SSH Connection status callback.
+ * @param session Current session handler
+ * @param status Percentage of connection status, going from 0.0 to 1.0
+ * once connection is done.
+ * @param userdata Userdata to be passed to the callback function.
+ */
+typedef void (*ssh_status_callback) (ssh_session session, float status,
+ void *userdata);
+
+/**
+ * @brief SSH global request callback. All global request will go through this
+ * callback.
+ * @param session Current session handler
+ * @param message the actual message
+ * @param userdata Userdata to be passed to the callback function.
+ */
+typedef void (*ssh_global_request_callback) (ssh_session session,
+ ssh_message message, void *userdata);
+
+/**
+ * @brief Handles an SSH new channel open X11 request. This happens when the server
+ * sends back an X11 connection attempt. This is a client-side API
+ * @param session current session handler
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns a valid ssh_channel handle if the request is to be allowed
+ * @returns NULL if the request should not be allowed
+ * @warning The channel pointer returned by this callback must be closed by the application.
+ */
+typedef ssh_channel (*ssh_channel_open_request_x11_callback) (ssh_session session,
+ const char * originator_address, int originator_port, void *userdata);
+
+/**
+ * The structure to replace libssh functions with appropriate callbacks.
+ */
+struct ssh_callbacks_struct {
+ /** DON'T SET THIS use ssh_callbacks_init() instead. */
+ size_t size;
+ /**
+ * User-provided data. User is free to set anything he wants here
+ */
+ void *userdata;
+ /**
+ * This functions will be called if e.g. a keyphrase is needed.
+ */
+ ssh_auth_callback auth_function;
+ /**
+ * This function will be called each time a loggable event happens.
+ */
+ ssh_log_callback log_function;
+ /**
+ * This function gets called during connection time to indicate the
+ * percentage of connection steps completed.
+ */
+ void (*connect_status_function)(void *userdata, float status);
+ /**
+ * This function will be called each time a global request is received.
+ */
+ ssh_global_request_callback global_request_function;
+ /** This function will be called when an incoming X11 request is received.
+ */
+ ssh_channel_open_request_x11_callback channel_open_request_x11_function;
+};
+typedef struct ssh_callbacks_struct *ssh_callbacks;
+
+/** These are callbacks used specifically in SSH servers.
+ */
+
+/**
+ * @brief SSH authentication callback.
+ * @param session Current session handler
+ * @param user User that wants to authenticate
+ * @param password Password used for authentication
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns SSH_AUTH_SUCCESS Authentication is accepted.
+ * @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
+ * @returns SSH_AUTH_DENIED Authentication failed.
+ */
+typedef int (*ssh_auth_password_callback) (ssh_session session, const char *user, const char *password,
+ void *userdata);
+
+/**
+ * @brief SSH authentication callback. Tries to authenticates user with the "none" method
+ * which is anonymous or passwordless.
+ * @param session Current session handler
+ * @param user User that wants to authenticate
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns SSH_AUTH_SUCCESS Authentication is accepted.
+ * @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
+ * @returns SSH_AUTH_DENIED Authentication failed.
+ */
+typedef int (*ssh_auth_none_callback) (ssh_session session, const char *user, void *userdata);
+
+/**
+ * @brief SSH authentication callback. Tries to authenticates user with the "gssapi-with-mic" method
+ * @param session Current session handler
+ * @param user Username of the user (can be spoofed)
+ * @param principal Authenticated principal of the user, including realm.
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns SSH_AUTH_SUCCESS Authentication is accepted.
+ * @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
+ * @returns SSH_AUTH_DENIED Authentication failed.
+ * @warning Implementations should verify that parameter user matches in some way the principal.
+ * user and principal can be different. Only the latter is guaranteed to be safe.
+ */
+typedef int (*ssh_auth_gssapi_mic_callback) (ssh_session session, const char *user, const char *principal,
+ void *userdata);
+
+/**
+ * @brief SSH authentication callback.
+ * @param session Current session handler
+ * @param user User that wants to authenticate
+ * @param pubkey public key used for authentication
+ * @param signature_state SSH_PUBLICKEY_STATE_NONE if the key is not signed (simple public key probe),
+ * SSH_PUBLICKEY_STATE_VALID if the signature is valid. Others values should be
+ * replied with a SSH_AUTH_DENIED.
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns SSH_AUTH_SUCCESS Authentication is accepted.
+ * @returns SSH_AUTH_PARTIAL Partial authentication, more authentication means are needed.
+ * @returns SSH_AUTH_DENIED Authentication failed.
+ */
+typedef int (*ssh_auth_pubkey_callback) (ssh_session session, const char *user, struct ssh_key_struct *pubkey,
+ char signature_state, void *userdata);
+
+
+/**
+ * @brief Handles an SSH service request
+ * @param session current session handler
+ * @param service name of the service (e.g. "ssh-userauth") requested
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns 0 if the request is to be allowed
+ * @returns -1 if the request should not be allowed
+ */
+
+typedef int (*ssh_service_request_callback) (ssh_session session, const char *service, void *userdata);
+
+/**
+ * @brief Handles an SSH new channel open session request
+ * @param session current session handler
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns a valid ssh_channel handle if the request is to be allowed
+ * @returns NULL if the request should not be allowed
+ * @warning The channel pointer returned by this callback must be closed by the application.
+ */
+typedef ssh_channel (*ssh_channel_open_request_session_callback) (ssh_session session, void *userdata);
+
+/*
+ * @brief handle the beginning of a GSSAPI authentication, server side.
+ * @param session current session handler
+ * @param user the username of the client
+ * @param n_oid number of available oids
+ * @param oids OIDs provided by the client
+ * @returns an ssh_string containing the chosen OID, that's supported by both
+ * client and server.
+ * @warning It is not necessary to fill this callback in if libssh is linked
+ * with libgssapi.
+ */
+typedef ssh_string (*ssh_gssapi_select_oid_callback) (ssh_session session, const char *user,
+ int n_oid, ssh_string *oids, void *userdata);
+
+/*
+ * @brief handle the negociation of a security context, server side.
+ * @param session current session handler
+ * @param[in] input_token input token provided by client
+ * @param[out] output_token output of the gssapi accept_sec_context method,
+ * NULL after completion.
+ * @returns SSH_OK if the token was generated correctly or accept_sec_context
+ * returned GSS_S_COMPLETE
+ * @returns SSH_ERROR in case of error
+ * @warning It is not necessary to fill this callback in if libssh is linked
+ * with libgssapi.
+ */
+typedef int (*ssh_gssapi_accept_sec_ctx_callback) (ssh_session session,
+ ssh_string input_token, ssh_string *output_token, void *userdata);
+
+/*
+ * @brief Verify and authenticates a MIC, server side.
+ * @param session current session handler
+ * @param[in] mic input mic to be verified provided by client
+ * @param[in] mic_buffer buffer of data to be signed.
+ * @param[in] mic_buffer_size size of mic_buffer
+ * @returns SSH_OK if the MIC was authenticated correctly
+ * @returns SSH_ERROR in case of error
+ * @warning It is not necessary to fill this callback in if libssh is linked
+ * with libgssapi.
+ */
+typedef int (*ssh_gssapi_verify_mic_callback) (ssh_session session,
+ ssh_string mic, void *mic_buffer, size_t mic_buffer_size, void *userdata);
+
+
+/**
+ * This structure can be used to implement a libssh server, with appropriate callbacks.
+ */
+
+struct ssh_server_callbacks_struct {
+ /** DON'T SET THIS use ssh_callbacks_init() instead. */
+ size_t size;
+ /**
+ * User-provided data. User is free to set anything he wants here
+ */
+ void *userdata;
+ /** This function gets called when a client tries to authenticate through
+ * password method.
+ */
+ ssh_auth_password_callback auth_password_function;
+
+ /** This function gets called when a client tries to authenticate through
+ * none method.
+ */
+ ssh_auth_none_callback auth_none_function;
+
+ /** This function gets called when a client tries to authenticate through
+ * gssapi-mic method.
+ */
+ ssh_auth_gssapi_mic_callback auth_gssapi_mic_function;
+
+ /** this function gets called when a client tries to authenticate or offer
+ * a public key.
+ */
+ ssh_auth_pubkey_callback auth_pubkey_function;
+
+ /** This functions gets called when a service request is issued by the
+ * client
+ */
+ ssh_service_request_callback service_request_function;
+ /** This functions gets called when a new channel request is issued by
+ * the client
+ */
+ ssh_channel_open_request_session_callback channel_open_request_session_function;
+ /** This function will be called when a new gssapi authentication is attempted.
+ */
+ ssh_gssapi_select_oid_callback gssapi_select_oid_function;
+ /** This function will be called when a gssapi token comes in.
+ */
+ ssh_gssapi_accept_sec_ctx_callback gssapi_accept_sec_ctx_function;
+ /* This function will be called when a MIC needs to be verified.
+ */
+ ssh_gssapi_verify_mic_callback gssapi_verify_mic_function;
+};
+typedef struct ssh_server_callbacks_struct *ssh_server_callbacks;
+
+/**
+ * @brief Set the session server callback functions.
+ *
+ * This functions sets the callback structure to use your own callback
+ * functions for user authentication, new channels and requests.
+ *
+ * @code
+ * struct ssh_server_callbacks_struct cb = {
+ * .userdata = data,
+ * .auth_password_function = my_auth_function
+ * };
+ * ssh_callbacks_init(&cb);
+ * ssh_set_server_callbacks(session, &cb);
+ * @endcode
+ *
+ * @param session The session to set the callback structure.
+ *
+ * @param cb The callback structure itself.
+ *
+ * @return SSH_OK on success, SSH_ERROR on error.
+ */
+LIBSSH_API int ssh_set_server_callbacks(ssh_session session, ssh_server_callbacks cb);
+
+/**
+ * These are the callbacks exported by the socket structure
+ * They are called by the socket module when a socket event appears
+ */
+struct ssh_socket_callbacks_struct {
+ /**
+ * User-provided data. User is free to set anything he wants here
+ */
+ void *userdata;
+ /**
+ * This function will be called each time data appears on socket. The data
+ * not consumed will appear on the next data event.
+ */
+ ssh_callback_data data;
+ /** This function will be called each time a controlflow state changes, i.e.
+ * the socket is available for reading or writing.
+ */
+ ssh_callback_int controlflow;
+ /** This function will be called each time an exception appears on socket. An
+ * exception can be a socket problem (timeout, ...) or an end-of-file.
+ */
+ ssh_callback_int_int exception;
+ /** This function is called when the ssh_socket_connect was used on the socket
+ * on nonblocking state, and the connection successed.
+ */
+ ssh_callback_int_int connected;
+};
+typedef struct ssh_socket_callbacks_struct *ssh_socket_callbacks;
+
+#define SSH_SOCKET_FLOW_WRITEWILLBLOCK 1
+#define SSH_SOCKET_FLOW_WRITEWONTBLOCK 2
+
+#define SSH_SOCKET_EXCEPTION_EOF 1
+#define SSH_SOCKET_EXCEPTION_ERROR 2
+
+#define SSH_SOCKET_CONNECTED_OK 1
+#define SSH_SOCKET_CONNECTED_ERROR 2
+#define SSH_SOCKET_CONNECTED_TIMEOUT 3
+
+/**
+ * @brief Initializes an ssh_callbacks_struct
+ * A call to this macro is mandatory when you have set a new
+ * ssh_callback_struct structure. Its goal is to maintain the binary
+ * compatibility with future versions of libssh as the structure
+ * evolves with time.
+ */
+#define ssh_callbacks_init(p) do {\
+ (p)->size=sizeof(*(p)); \
+} while(0);
+
+/**
+ * @internal
+ * @brief tests if a callback can be called without crash
+ * verifies that the struct size if big enough
+ * verifies that the callback pointer exists
+ * @param p callback pointer
+ * @param c callback name
+ * @returns nonzero if callback can be called
+ */
+#define ssh_callbacks_exists(p,c) (\
+ (p != NULL) && ( (char *)&((p)-> c) < (char *)(p) + (p)->size ) && \
+ ((p)-> c != NULL) \
+ )
+
+/** @brief Prototype for a packet callback, to be called when a new packet arrives
+ * @param session The current session of the packet
+ * @param type packet type (see ssh2.h)
+ * @param packet buffer containing the packet, excluding size, type and padding fields
+ * @param user user argument to the callback
+ * and are called each time a packet shows up
+ * @returns SSH_PACKET_USED Packet was parsed and used
+ * @returns SSH_PACKET_NOT_USED Packet was not used or understood, processing must continue
+ */
+typedef int (*ssh_packet_callback) (ssh_session session, uint8_t type, ssh_buffer packet, void *user);
+
+/** return values for a ssh_packet_callback */
+/** Packet was used and should not be parsed by another callback */
+#define SSH_PACKET_USED 1
+/** Packet was not used and should be passed to any other callback
+ * available */
+#define SSH_PACKET_NOT_USED 2
+
+
+/** @brief This macro declares a packet callback handler
+ * @code
+ * SSH_PACKET_CALLBACK(mycallback){
+ * ...
+ * }
+ * @endcode
+ */
+#define SSH_PACKET_CALLBACK(name) \
+ int name (ssh_session session, uint8_t type, ssh_buffer packet, void *user)
+
+struct ssh_packet_callbacks_struct {
+ /** Index of the first packet type being handled */
+ uint8_t start;
+ /** Number of packets being handled by this callback struct */
+ uint8_t n_callbacks;
+ /** A pointer to n_callbacks packet callbacks */
+ ssh_packet_callback *callbacks;
+ /**
+ * User-provided data. User is free to set anything he wants here
+ */
+ void *user;
+};
+
+typedef struct ssh_packet_callbacks_struct *ssh_packet_callbacks;
+
+/**
+ * @brief Set the session callback functions.
+ *
+ * This functions sets the callback structure to use your own callback
+ * functions for auth, logging and status.
+ *
+ * @code
+ * struct ssh_callbacks_struct cb = {
+ * .userdata = data,
+ * .auth_function = my_auth_function
+ * };
+ * ssh_callbacks_init(&cb);
+ * ssh_set_callbacks(session, &cb);
+ * @endcode
+ *
+ * @param session The session to set the callback structure.
+ *
+ * @param cb The callback structure itself.
+ *
+ * @return SSH_OK on success, SSH_ERROR on error.
+ */
+LIBSSH_API int ssh_set_callbacks(ssh_session session, ssh_callbacks cb);
+
+/**
+ * @brief SSH channel data callback. Called when data is available on a channel
+ * @param session Current session handler
+ * @param channel the actual channel
+ * @param data the data that has been read on the channel
+ * @param len the length of the data
+ * @param is_stderr is 0 for stdout or 1 for stderr
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns number of bytes processed by the callee. The remaining bytes will
+ * be sent in the next callback message, when more data is available.
+ */
+typedef int (*ssh_channel_data_callback) (ssh_session session,
+ ssh_channel channel,
+ void *data,
+ uint32_t len,
+ int is_stderr,
+ void *userdata);
+
+/**
+ * @brief SSH channel eof callback. Called when a channel receives EOF
+ * @param session Current session handler
+ * @param channel the actual channel
+ * @param userdata Userdata to be passed to the callback function.
+ */
+typedef void (*ssh_channel_eof_callback) (ssh_session session,
+ ssh_channel channel,
+ void *userdata);
+
+/**
+ * @brief SSH channel close callback. Called when a channel is closed by remote peer
+ * @param session Current session handler
+ * @param channel the actual channel
+ * @param userdata Userdata to be passed to the callback function.
+ */
+typedef void (*ssh_channel_close_callback) (ssh_session session,
+ ssh_channel channel,
+ void *userdata);
+
+/**
+ * @brief SSH channel signal callback. Called when a channel has received a signal
+ * @param session Current session handler
+ * @param channel the actual channel
+ * @param signal the signal name (without the SIG prefix)
+ * @param userdata Userdata to be passed to the callback function.
+ */
+typedef void (*ssh_channel_signal_callback) (ssh_session session,
+ ssh_channel channel,
+ const char *signal,
+ void *userdata);
+
+/**
+ * @brief SSH channel exit status callback. Called when a channel has received an exit status
+ * @param session Current session handler
+ * @param channel the actual channel
+ * @param userdata Userdata to be passed to the callback function.
+ */
+typedef void (*ssh_channel_exit_status_callback) (ssh_session session,
+ ssh_channel channel,
+ int exit_status,
+ void *userdata);
+
+/**
+ * @brief SSH channel exit signal callback. Called when a channel has received an exit signal
+ * @param session Current session handler
+ * @param channel the actual channel
+ * @param signal the signal name (without the SIG prefix)
+ * @param core a boolean telling wether a core has been dumped or not
+ * @param errmsg the description of the exception
+ * @param lang the language of the description (format: RFC 3066)
+ * @param userdata Userdata to be passed to the callback function.
+ */
+typedef void (*ssh_channel_exit_signal_callback) (ssh_session session,
+ ssh_channel channel,
+ const char *signal,
+ int core,
+ const char *errmsg,
+ const char *lang,
+ void *userdata);
+
+/**
+ * @brief SSH channel PTY request from a client.
+ * @param channel the channel
+ * @param term The type of terminal emulation
+ * @param width width of the terminal, in characters
+ * @param height height of the terminal, in characters
+ * @param pxwidth width of the terminal, in pixels
+ * @param pxheight height of the terminal, in pixels
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns 0 if the pty request is accepted
+ * @returns -1 if the request is denied
+ */
+typedef int (*ssh_channel_pty_request_callback) (ssh_session session,
+ ssh_channel channel,
+ const char *term,
+ int width, int height,
+ int pxwidth, int pwheight,
+ void *userdata);
+
+/**
+ * @brief SSH channel Shell request from a client.
+ * @param channel the channel
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns 0 if the shell request is accepted
+ * @returns 1 if the request is denied
+ */
+typedef int (*ssh_channel_shell_request_callback) (ssh_session session,
+ ssh_channel channel,
+ void *userdata);
+/**
+ * @brief SSH auth-agent-request from the client. This request is
+ * sent by a client when agent forwarding is available.
+ * Server is free to ignore this callback, no answer is expected.
+ * @param channel the channel
+ * @param userdata Userdata to be passed to the callback function.
+ */
+typedef void (*ssh_channel_auth_agent_req_callback) (ssh_session session,
+ ssh_channel channel,
+ void *userdata);
+
+/**
+ * @brief SSH X11 request from the client. This request is
+ * sent by a client when X11 forwarding is requested(and available).
+ * Server is free to ignore this callback, no answer is expected.
+ * @param channel the channel
+ * @param userdata Userdata to be passed to the callback function.
+ */
+typedef void (*ssh_channel_x11_req_callback) (ssh_session session,
+ ssh_channel channel,
+ int single_connection,
+ const char *auth_protocol,
+ const char *auth_cookie,
+ uint32_t screen_number,
+ void *userdata);
+/**
+ * @brief SSH channel PTY windows change (terminal size) from a client.
+ * @param channel the channel
+ * @param width width of the terminal, in characters
+ * @param height height of the terminal, in characters
+ * @param pxwidth width of the terminal, in pixels
+ * @param pxheight height of the terminal, in pixels
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns 0 if the pty request is accepted
+ * @returns -1 if the request is denied
+ */
+typedef int (*ssh_channel_pty_window_change_callback) (ssh_session session,
+ ssh_channel channel,
+ int width, int height,
+ int pxwidth, int pwheight,
+ void *userdata);
+
+/**
+ * @brief SSH channel Exec request from a client.
+ * @param channel the channel
+ * @param command the shell command to be executed
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns 0 if the exec request is accepted
+ * @returns 1 if the request is denied
+ */
+typedef int (*ssh_channel_exec_request_callback) (ssh_session session,
+ ssh_channel channel,
+ const char *command,
+ void *userdata);
+
+/**
+ * @brief SSH channel environment request from a client.
+ * @param channel the channel
+ * @param env_name name of the environment value to be set
+ * @param env_value value of the environment value to be set
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns 0 if the env request is accepted
+ * @returns 1 if the request is denied
+ * @warning some environment variables can be dangerous if changed (e.g.
+ * LD_PRELOAD) and should not be fulfilled.
+ */
+typedef int (*ssh_channel_env_request_callback) (ssh_session session,
+ ssh_channel channel,
+ const char *env_name,
+ const char *env_value,
+ void *userdata);
+/**
+ * @brief SSH channel subsystem request from a client.
+ * @param channel the channel
+ * @param subsystem the subsystem required
+ * @param userdata Userdata to be passed to the callback function.
+ * @returns 0 if the subsystem request is accepted
+ * @returns 1 if the request is denied
+ */
+typedef int (*ssh_channel_subsystem_request_callback) (ssh_session session,
+ ssh_channel channel,
+ const char *subsystem,
+ void *userdata);
+
+
+struct ssh_channel_callbacks_struct {
+ /** DON'T SET THIS use ssh_callbacks_init() instead. */
+ size_t size;
+ /**
+ * User-provided data. User is free to set anything he wants here
+ */
+ void *userdata;
+ /**
+ * This functions will be called when there is data available.
+ */
+ ssh_channel_data_callback channel_data_function;
+ /**
+ * This functions will be called when the channel has received an EOF.
+ */
+ ssh_channel_eof_callback channel_eof_function;
+ /**
+ * This functions will be called when the channel has been closed by remote
+ */
+ ssh_channel_close_callback channel_close_function;
+ /**
+ * This functions will be called when a signal has been received
+ */
+ ssh_channel_signal_callback channel_signal_function;
+ /**
+ * This functions will be called when an exit status has been received
+ */
+ ssh_channel_exit_status_callback channel_exit_status_function;
+ /**
+ * This functions will be called when an exit signal has been received
+ */
+ ssh_channel_exit_signal_callback channel_exit_signal_function;
+ /**
+ * This function will be called when a client requests a PTY
+ */
+ ssh_channel_pty_request_callback channel_pty_request_function;
+ /**
+ * This function will be called when a client requests a shell
+ */
+ ssh_channel_shell_request_callback channel_shell_request_function;
+ /** This function will be called when a client requests agent
+ * authentication forwarding.
+ */
+ ssh_channel_auth_agent_req_callback channel_auth_agent_req_function;
+ /** This function will be called when a client requests X11
+ * forwarding.
+ */
+ ssh_channel_x11_req_callback channel_x11_req_function;
+ /** This function will be called when a client requests a
+ * window change.
+ */
+ ssh_channel_pty_window_change_callback channel_pty_window_change_function;
+ /** This function will be called when a client requests a
+ * command execution.
+ */
+ ssh_channel_exec_request_callback channel_exec_request_function;
+ /** This function will be called when a client requests an environment
+ * variable to be set.
+ */
+ ssh_channel_env_request_callback channel_env_request_function;
+ /** This function will be called when a client requests a subsystem
+ * (like sftp).
+ */
+ ssh_channel_subsystem_request_callback channel_subsystem_request_function;
+};
+
+typedef struct ssh_channel_callbacks_struct *ssh_channel_callbacks;
+
+/**
+ * @brief Set the channel callback functions.
+ *
+ * This functions sets the callback structure to use your own callback
+ * functions for channel data and exceptions
+ *
+ * @code
+ * struct ssh_channel_callbacks_struct cb = {
+ * .userdata = data,
+ * .channel_data = my_channel_data_function
+ * };
+ * ssh_callbacks_init(&cb);
+ * ssh_set_channel_callbacks(channel, &cb);
+ * @endcode
+ *
+ * @param channel The channel to set the callback structure.
+ *
+ * @param cb The callback structure itself.
+ *
+ * @return SSH_OK on success, SSH_ERROR on error.
+ */
+LIBSSH_API int ssh_set_channel_callbacks(ssh_channel channel,
+ ssh_channel_callbacks cb);
+
+/** @} */
+
+/** @group libssh_threads
+ * @{
+ */
+
+typedef int (*ssh_thread_callback) (void **lock);
+
+typedef unsigned long (*ssh_thread_id_callback) (void);
+struct ssh_threads_callbacks_struct {
+ const char *type;
+ ssh_thread_callback mutex_init;
+ ssh_thread_callback mutex_destroy;
+ ssh_thread_callback mutex_lock;
+ ssh_thread_callback mutex_unlock;
+ ssh_thread_id_callback thread_id;
+};
+
+/**
+ * @brief Set the thread callbacks structure.
+ *
+ * This is necessary if your program is using libssh in a multithreaded fashion.
+ * This function must be called first, outside of any threading context (in your
+ * main() function for instance), before you call ssh_init().
+ *
+ * @param[in] cb A pointer to a ssh_threads_callbacks_struct structure, which
+ * contains the different callbacks to be set.
+ *
+ * @returns Always returns SSH_OK.
+ *
+ * @see ssh_threads_callbacks_struct
+ * @see SSH_THREADS_PTHREAD
+ * @bug libgcrypt 1.6 and bigger backend does not support custom callback.
+ * Using anything else than pthreads here will fail.
+ */
+LIBSSH_API int ssh_threads_set_callbacks(struct ssh_threads_callbacks_struct
+ *cb);
+
+/**
+ * @brief returns a pointer on the pthread threads callbacks, to be used with
+ * ssh_threads_set_callbacks.
+ * @warning you have to link with the library ssh_threads.
+ * @see ssh_threads_set_callbacks
+ */
+LIBSSH_API struct ssh_threads_callbacks_struct *ssh_threads_get_pthread(void);
+
+/**
+ * @brief Get the noop threads callbacks structure
+ *
+ * This can be used with ssh_threads_set_callbacks. These callbacks do nothing
+ * and are being used by default.
+ *
+ * @return Always returns a valid pointer to the noop callbacks structure.
+ *
+ * @see ssh_threads_set_callbacks
+ */
+LIBSSH_API struct ssh_threads_callbacks_struct *ssh_threads_get_noop(void);
+
+/**
+ * @brief Set the logging callback function.
+ *
+ * @param[in] cb The callback to set.
+ *
+ * @return 0 on success, < 0 on errror.
+ */
+LIBSSH_API int ssh_set_log_callback(ssh_logging_callback cb);
+
+/**
+ * @brief Get the pointer to the logging callback function.
+ *
+ * @return The pointer the the callback or NULL if none set.
+ */
+LIBSSH_API ssh_logging_callback ssh_get_log_callback(void);
+
+/** @} */
+#ifdef __cplusplus
+}
+#endif
+
+#endif /*_SSH_CALLBACK_H */
+
+/* @} */
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/legacy.h b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/legacy.h
new file mode 100755
index 0000000..911173e
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/legacy.h
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the SSH Library
+ *
+ * Copyright (c) 2010 by Aris Adamantiadis
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/* Since libssh.h includes legacy.h, it's important that libssh.h is included
+ * first. we don't define LEGACY_H now because we want it to be defined when
+ * included from libssh.h
+ * All function calls declared in this header are deprecated and meant to be
+ * removed in future.
+ */
+
+#ifndef LEGACY_H_
+#define LEGACY_H_
+
+typedef struct ssh_private_key_struct* ssh_private_key;
+typedef struct ssh_public_key_struct* ssh_public_key;
+
+LIBSSH_API int ssh_auth_list(ssh_session session);
+LIBSSH_API int ssh_userauth_offer_pubkey(ssh_session session, const char *username, int type, ssh_string publickey);
+LIBSSH_API int ssh_userauth_pubkey(ssh_session session, const char *username, ssh_string publickey, ssh_private_key privatekey);
+#ifndef _WIN32
+LIBSSH_API int ssh_userauth_agent_pubkey(ssh_session session, const char *username,
+ ssh_public_key publickey);
+#endif
+LIBSSH_API int ssh_userauth_autopubkey(ssh_session session, const char *passphrase);
+LIBSSH_API int ssh_userauth_privatekey_file(ssh_session session, const char *username,
+ const char *filename, const char *passphrase);
+
+SSH_DEPRECATED LIBSSH_API void buffer_free(ssh_buffer buffer);
+SSH_DEPRECATED LIBSSH_API void *buffer_get(ssh_buffer buffer);
+SSH_DEPRECATED LIBSSH_API uint32_t buffer_get_len(ssh_buffer buffer);
+SSH_DEPRECATED LIBSSH_API ssh_buffer buffer_new(void);
+
+SSH_DEPRECATED LIBSSH_API ssh_channel channel_accept_x11(ssh_channel channel, int timeout_ms);
+SSH_DEPRECATED LIBSSH_API int channel_change_pty_size(ssh_channel channel,int cols,int rows);
+SSH_DEPRECATED LIBSSH_API ssh_channel channel_forward_accept(ssh_session session, int timeout_ms);
+SSH_DEPRECATED LIBSSH_API int channel_close(ssh_channel channel);
+SSH_DEPRECATED LIBSSH_API int channel_forward_cancel(ssh_session session, const char *address, int port);
+SSH_DEPRECATED LIBSSH_API int channel_forward_listen(ssh_session session, const char *address, int port, int *bound_port);
+SSH_DEPRECATED LIBSSH_API void channel_free(ssh_channel channel);
+SSH_DEPRECATED LIBSSH_API int channel_get_exit_status(ssh_channel channel);
+SSH_DEPRECATED LIBSSH_API ssh_session channel_get_session(ssh_channel channel);
+SSH_DEPRECATED LIBSSH_API int channel_is_closed(ssh_channel channel);
+SSH_DEPRECATED LIBSSH_API int channel_is_eof(ssh_channel channel);
+SSH_DEPRECATED LIBSSH_API int channel_is_open(ssh_channel channel);
+SSH_DEPRECATED LIBSSH_API ssh_channel channel_new(ssh_session session);
+SSH_DEPRECATED LIBSSH_API int channel_open_forward(ssh_channel channel, const char *remotehost,
+ int remoteport, const char *sourcehost, int localport);
+SSH_DEPRECATED LIBSSH_API int channel_open_session(ssh_channel channel);
+SSH_DEPRECATED LIBSSH_API int channel_poll(ssh_channel channel, int is_stderr);
+SSH_DEPRECATED LIBSSH_API int channel_read(ssh_channel channel, void *dest, uint32_t count, int is_stderr);
+
+SSH_DEPRECATED LIBSSH_API int channel_read_buffer(ssh_channel channel, ssh_buffer buffer, uint32_t count,
+ int is_stderr);
+
+SSH_DEPRECATED LIBSSH_API int channel_read_nonblocking(ssh_channel channel, void *dest, uint32_t count,
+ int is_stderr);
+SSH_DEPRECATED LIBSSH_API int channel_request_env(ssh_channel channel, const char *name, const char *value);
+SSH_DEPRECATED LIBSSH_API int channel_request_exec(ssh_channel channel, const char *cmd);
+SSH_DEPRECATED LIBSSH_API int channel_request_pty(ssh_channel channel);
+SSH_DEPRECATED LIBSSH_API int channel_request_pty_size(ssh_channel channel, const char *term,
+ int cols, int rows);
+SSH_DEPRECATED LIBSSH_API int channel_request_shell(ssh_channel channel);
+SSH_DEPRECATED LIBSSH_API int channel_request_send_signal(ssh_channel channel, const char *signum);
+SSH_DEPRECATED LIBSSH_API int channel_request_sftp(ssh_channel channel);
+SSH_DEPRECATED LIBSSH_API int channel_request_subsystem(ssh_channel channel, const char *subsystem);
+SSH_DEPRECATED LIBSSH_API int channel_request_x11(ssh_channel channel, int single_connection, const char *protocol,
+ const char *cookie, int screen_number);
+SSH_DEPRECATED LIBSSH_API int channel_send_eof(ssh_channel channel);
+SSH_DEPRECATED LIBSSH_API int channel_select(ssh_channel *readchans, ssh_channel *writechans, ssh_channel *exceptchans, struct
+ timeval * timeout);
+SSH_DEPRECATED LIBSSH_API void channel_set_blocking(ssh_channel channel, int blocking);
+SSH_DEPRECATED LIBSSH_API int channel_write(ssh_channel channel, const void *data, uint32_t len);
+
+LIBSSH_API void privatekey_free(ssh_private_key prv);
+LIBSSH_API ssh_private_key privatekey_from_file(ssh_session session, const char *filename,
+ int type, const char *passphrase);
+LIBSSH_API void publickey_free(ssh_public_key key);
+LIBSSH_API int ssh_publickey_to_file(ssh_session session, const char *file,
+ ssh_string pubkey, int type);
+LIBSSH_API ssh_string publickey_from_file(ssh_session session, const char *filename,
+ int *type);
+LIBSSH_API ssh_public_key publickey_from_privatekey(ssh_private_key prv);
+LIBSSH_API ssh_string publickey_to_string(ssh_public_key key);
+LIBSSH_API int ssh_try_publickey_from_file(ssh_session session, const char *keyfile,
+ ssh_string *publickey, int *type);
+LIBSSH_API enum ssh_keytypes_e ssh_privatekey_type(ssh_private_key privatekey);
+
+LIBSSH_API ssh_string ssh_get_pubkey(ssh_session session);
+
+LIBSSH_API ssh_message ssh_message_retrieve(ssh_session session, uint32_t packettype);
+LIBSSH_API ssh_public_key ssh_message_auth_publickey(ssh_message msg);
+
+SSH_DEPRECATED LIBSSH_API void string_burn(ssh_string str);
+SSH_DEPRECATED LIBSSH_API ssh_string string_copy(ssh_string str);
+SSH_DEPRECATED LIBSSH_API void *string_data(ssh_string str);
+SSH_DEPRECATED LIBSSH_API int string_fill(ssh_string str, const void *data, size_t len);
+SSH_DEPRECATED LIBSSH_API void string_free(ssh_string str);
+SSH_DEPRECATED LIBSSH_API ssh_string string_from_char(const char *what);
+SSH_DEPRECATED LIBSSH_API size_t string_len(ssh_string str);
+SSH_DEPRECATED LIBSSH_API ssh_string string_new(size_t size);
+SSH_DEPRECATED LIBSSH_API char *string_to_char(ssh_string str);
+
+#endif /* LEGACY_H_ */
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/libssh.h b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/libssh.h
new file mode 100755
index 0000000..d16f8c6
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/libssh.h
@@ -0,0 +1,677 @@
+/*
+ * This file is part of the SSH Library
+ *
+ * Copyright (c) 2003-2009 by Aris Adamantiadis
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _LIBSSH_H
+#define _LIBSSH_H
+
+#if defined _WIN32 || defined __CYGWIN__
+ #ifdef LIBSSH_STATIC
+ #define LIBSSH_API
+ #else
+ #ifdef LIBSSH_EXPORTS
+ #ifdef __GNUC__
+ #define LIBSSH_API __attribute__((dllexport))
+ #else
+ #define LIBSSH_API __declspec(dllexport)
+ #endif
+ #else
+ #ifdef __GNUC__
+ #define LIBSSH_API __attribute__((dllimport))
+ #else
+ #define LIBSSH_API __declspec(dllimport)
+ #endif
+ #endif
+ #endif
+#else
+ #if __GNUC__ >= 4 && !defined(__OS2__)
+ #define LIBSSH_API __attribute__((visibility("default")))
+ #else
+ #define LIBSSH_API
+ #endif
+#endif
+
+#ifdef _MSC_VER
+ /* Visual Studio hasn't inttypes.h so it doesn't know uint32_t */
+ typedef int int32_t;
+ typedef unsigned int uint32_t;
+ typedef unsigned short uint16_t;
+ typedef unsigned char uint8_t;
+ typedef unsigned long long uint64_t;
+ typedef int mode_t;
+#else /* _MSC_VER */
+ #include <unistd.h>
+ #include <inttypes.h>
+ #include <sys/types.h>
+#endif /* _MSC_VER */
+
+#ifdef _WIN32
+ #include <winsock2.h>
+#else /* _WIN32 */
+ #include <sys/select.h> /* for fd_set * */
+ #include <netdb.h>
+#endif /* _WIN32 */
+
+#define SSH_STRINGIFY(s) SSH_TOSTRING(s)
+#define SSH_TOSTRING(s) #s
+
+/* libssh version macros */
+#define SSH_VERSION_INT(a, b, c) ((a) << 16 | (b) << 8 | (c))
+#define SSH_VERSION_DOT(a, b, c) a ##.## b ##.## c
+#define SSH_VERSION(a, b, c) SSH_VERSION_DOT(a, b, c)
+
+/* libssh version */
+#define LIBSSH_VERSION_MAJOR 0
+#define LIBSSH_VERSION_MINOR 7
+#define LIBSSH_VERSION_MICRO 4
+
+#define LIBSSH_VERSION_INT SSH_VERSION_INT(LIBSSH_VERSION_MAJOR, \
+ LIBSSH_VERSION_MINOR, \
+ LIBSSH_VERSION_MICRO)
+#define LIBSSH_VERSION SSH_VERSION(LIBSSH_VERSION_MAJOR, \
+ LIBSSH_VERSION_MINOR, \
+ LIBSSH_VERSION_MICRO)
+
+/* GCC have printf type attribute check. */
+#ifdef __GNUC__
+#define PRINTF_ATTRIBUTE(a,b) __attribute__ ((__format__ (__printf__, a, b)))
+#else
+#define PRINTF_ATTRIBUTE(a,b)
+#endif /* __GNUC__ */
+
+#ifdef __GNUC__
+#define SSH_DEPRECATED __attribute__ ((deprecated))
+#else
+#define SSH_DEPRECATED
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct ssh_counter_struct {
+ uint64_t in_bytes;
+ uint64_t out_bytes;
+ uint64_t in_packets;
+ uint64_t out_packets;
+};
+typedef struct ssh_counter_struct *ssh_counter;
+
+typedef struct ssh_agent_struct* ssh_agent;
+typedef struct ssh_buffer_struct* ssh_buffer;
+typedef struct ssh_channel_struct* ssh_channel;
+typedef struct ssh_message_struct* ssh_message;
+typedef struct ssh_pcap_file_struct* ssh_pcap_file;
+typedef struct ssh_key_struct* ssh_key;
+typedef struct ssh_scp_struct* ssh_scp;
+typedef struct ssh_session_struct* ssh_session;
+typedef struct ssh_string_struct* ssh_string;
+typedef struct ssh_event_struct* ssh_event;
+typedef void* ssh_gssapi_creds;
+
+/* Socket type */
+#ifdef _WIN32
+#ifndef socket_t
+typedef SOCKET socket_t;
+#endif /* socket_t */
+#else /* _WIN32 */
+#ifndef socket_t
+typedef int socket_t;
+#endif
+#endif /* _WIN32 */
+
+#define SSH_INVALID_SOCKET ((socket_t) -1)
+
+/* the offsets of methods */
+enum ssh_kex_types_e {
+ SSH_KEX=0,
+ SSH_HOSTKEYS,
+ SSH_CRYPT_C_S,
+ SSH_CRYPT_S_C,
+ SSH_MAC_C_S,
+ SSH_MAC_S_C,
+ SSH_COMP_C_S,
+ SSH_COMP_S_C,
+ SSH_LANG_C_S,
+ SSH_LANG_S_C
+};
+
+#define SSH_CRYPT 2
+#define SSH_MAC 3
+#define SSH_COMP 4
+#define SSH_LANG 5
+
+enum ssh_auth_e {
+ SSH_AUTH_SUCCESS=0,
+ SSH_AUTH_DENIED,
+ SSH_AUTH_PARTIAL,
+ SSH_AUTH_INFO,
+ SSH_AUTH_AGAIN,
+ SSH_AUTH_ERROR=-1
+};
+
+/* auth flags */
+#define SSH_AUTH_METHOD_UNKNOWN 0
+#define SSH_AUTH_METHOD_NONE 0x0001
+#define SSH_AUTH_METHOD_PASSWORD 0x0002
+#define SSH_AUTH_METHOD_PUBLICKEY 0x0004
+#define SSH_AUTH_METHOD_HOSTBASED 0x0008
+#define SSH_AUTH_METHOD_INTERACTIVE 0x0010
+#define SSH_AUTH_METHOD_GSSAPI_MIC 0x0020
+
+/* messages */
+enum ssh_requests_e {
+ SSH_REQUEST_AUTH=1,
+ SSH_REQUEST_CHANNEL_OPEN,
+ SSH_REQUEST_CHANNEL,
+ SSH_REQUEST_SERVICE,
+ SSH_REQUEST_GLOBAL
+};
+
+enum ssh_channel_type_e {
+ SSH_CHANNEL_UNKNOWN=0,
+ SSH_CHANNEL_SESSION,
+ SSH_CHANNEL_DIRECT_TCPIP,
+ SSH_CHANNEL_FORWARDED_TCPIP,
+ SSH_CHANNEL_X11
+};
+
+enum ssh_channel_requests_e {
+ SSH_CHANNEL_REQUEST_UNKNOWN=0,
+ SSH_CHANNEL_REQUEST_PTY,
+ SSH_CHANNEL_REQUEST_EXEC,
+ SSH_CHANNEL_REQUEST_SHELL,
+ SSH_CHANNEL_REQUEST_ENV,
+ SSH_CHANNEL_REQUEST_SUBSYSTEM,
+ SSH_CHANNEL_REQUEST_WINDOW_CHANGE,
+ SSH_CHANNEL_REQUEST_X11
+};
+
+enum ssh_global_requests_e {
+ SSH_GLOBAL_REQUEST_UNKNOWN=0,
+ SSH_GLOBAL_REQUEST_TCPIP_FORWARD,
+ SSH_GLOBAL_REQUEST_CANCEL_TCPIP_FORWARD,
+};
+
+enum ssh_publickey_state_e {
+ SSH_PUBLICKEY_STATE_ERROR=-1,
+ SSH_PUBLICKEY_STATE_NONE=0,
+ SSH_PUBLICKEY_STATE_VALID=1,
+ SSH_PUBLICKEY_STATE_WRONG=2
+};
+
+/* Status flags */
+/** Socket is closed */
+#define SSH_CLOSED 0x01
+/** Reading to socket won't block */
+#define SSH_READ_PENDING 0x02
+/** Session was closed due to an error */
+#define SSH_CLOSED_ERROR 0x04
+/** Output buffer not empty */
+#define SSH_WRITE_PENDING 0x08
+
+enum ssh_server_known_e {
+ SSH_SERVER_ERROR=-1,
+ SSH_SERVER_NOT_KNOWN=0,
+ SSH_SERVER_KNOWN_OK,
+ SSH_SERVER_KNOWN_CHANGED,
+ SSH_SERVER_FOUND_OTHER,
+ SSH_SERVER_FILE_NOT_FOUND
+};
+
+#ifndef MD5_DIGEST_LEN
+ #define MD5_DIGEST_LEN 16
+#endif
+/* errors */
+
+enum ssh_error_types_e {
+ SSH_NO_ERROR=0,
+ SSH_REQUEST_DENIED,
+ SSH_FATAL,
+ SSH_EINTR
+};
+
+/* some types for keys */
+enum ssh_keytypes_e{
+ SSH_KEYTYPE_UNKNOWN=0,
+ SSH_KEYTYPE_DSS=1,
+ SSH_KEYTYPE_RSA,
+ SSH_KEYTYPE_RSA1,
+ SSH_KEYTYPE_ECDSA,
+ SSH_KEYTYPE_ED25519
+};
+
+enum ssh_keycmp_e {
+ SSH_KEY_CMP_PUBLIC = 0,
+ SSH_KEY_CMP_PRIVATE
+};
+
+/* Error return codes */
+#define SSH_OK 0 /* No error */
+#define SSH_ERROR -1 /* Error of some kind */
+#define SSH_AGAIN -2 /* The nonblocking call must be repeated */
+#define SSH_EOF -127 /* We have already a eof */
+
+/**
+ * @addtogroup libssh_log
+ *
+ * @{
+ */
+
+enum {
+ /** No logging at all
+ */
+ SSH_LOG_NOLOG=0,
+ /** Only warnings
+ */
+ SSH_LOG_WARNING,
+ /** High level protocol information
+ */
+ SSH_LOG_PROTOCOL,
+ /** Lower level protocol infomations, packet level
+ */
+ SSH_LOG_PACKET,
+ /** Every function path
+ */
+ SSH_LOG_FUNCTIONS
+};
+/** @} */
+#define SSH_LOG_RARE SSH_LOG_WARNING
+
+/**
+ * @name Logging levels
+ *
+ * @brief Debug levels for logging.
+ * @{
+ */
+
+/** No logging at all */
+#define SSH_LOG_NONE 0
+/** Show only warnings */
+#define SSH_LOG_WARN 1
+/** Get some information what's going on */
+#define SSH_LOG_INFO 2
+/** Get detailed debuging information **/
+#define SSH_LOG_DEBUG 3
+/** Get trace output, packet information, ... */
+#define SSH_LOG_TRACE 4
+
+/** @} */
+
+enum ssh_options_e {
+ SSH_OPTIONS_HOST,
+ SSH_OPTIONS_PORT,
+ SSH_OPTIONS_PORT_STR,
+ SSH_OPTIONS_FD,
+ SSH_OPTIONS_USER,
+ SSH_OPTIONS_SSH_DIR,
+ SSH_OPTIONS_IDENTITY,
+ SSH_OPTIONS_ADD_IDENTITY,
+ SSH_OPTIONS_KNOWNHOSTS,
+ SSH_OPTIONS_TIMEOUT,
+ SSH_OPTIONS_TIMEOUT_USEC,
+ SSH_OPTIONS_SSH1,
+ SSH_OPTIONS_SSH2,
+ SSH_OPTIONS_LOG_VERBOSITY,
+ SSH_OPTIONS_LOG_VERBOSITY_STR,
+ SSH_OPTIONS_CIPHERS_C_S,
+ SSH_OPTIONS_CIPHERS_S_C,
+ SSH_OPTIONS_COMPRESSION_C_S,
+ SSH_OPTIONS_COMPRESSION_S_C,
+ SSH_OPTIONS_PROXYCOMMAND,
+ SSH_OPTIONS_BINDADDR,
+ SSH_OPTIONS_STRICTHOSTKEYCHECK,
+ SSH_OPTIONS_COMPRESSION,
+ SSH_OPTIONS_COMPRESSION_LEVEL,
+ SSH_OPTIONS_KEY_EXCHANGE,
+ SSH_OPTIONS_HOSTKEYS,
+ SSH_OPTIONS_GSSAPI_SERVER_IDENTITY,
+ SSH_OPTIONS_GSSAPI_CLIENT_IDENTITY,
+ SSH_OPTIONS_GSSAPI_DELEGATE_CREDENTIALS,
+ SSH_OPTIONS_HMAC_C_S,
+ SSH_OPTIONS_HMAC_S_C,
+};
+
+enum {
+ /** Code is going to write/create remote files */
+ SSH_SCP_WRITE,
+ /** Code is going to read remote files */
+ SSH_SCP_READ,
+ SSH_SCP_RECURSIVE=0x10
+};
+
+enum ssh_scp_request_types {
+ /** A new directory is going to be pulled */
+ SSH_SCP_REQUEST_NEWDIR=1,
+ /** A new file is going to be pulled */
+ SSH_SCP_REQUEST_NEWFILE,
+ /** End of requests */
+ SSH_SCP_REQUEST_EOF,
+ /** End of directory */
+ SSH_SCP_REQUEST_ENDDIR,
+ /** Warning received */
+ SSH_SCP_REQUEST_WARNING
+};
+
+LIBSSH_API int ssh_blocking_flush(ssh_session session, int timeout);
+LIBSSH_API ssh_channel ssh_channel_accept_x11(ssh_channel channel, int timeout_ms);
+LIBSSH_API int ssh_channel_change_pty_size(ssh_channel channel,int cols,int rows);
+LIBSSH_API int ssh_channel_close(ssh_channel channel);
+LIBSSH_API void ssh_channel_free(ssh_channel channel);
+LIBSSH_API int ssh_channel_get_exit_status(ssh_channel channel);
+LIBSSH_API ssh_session ssh_channel_get_session(ssh_channel channel);
+LIBSSH_API int ssh_channel_is_closed(ssh_channel channel);
+LIBSSH_API int ssh_channel_is_eof(ssh_channel channel);
+LIBSSH_API int ssh_channel_is_open(ssh_channel channel);
+LIBSSH_API ssh_channel ssh_channel_new(ssh_session session);
+LIBSSH_API int ssh_channel_open_auth_agent(ssh_channel channel);
+LIBSSH_API int ssh_channel_open_forward(ssh_channel channel, const char *remotehost,
+ int remoteport, const char *sourcehost, int localport);
+LIBSSH_API int ssh_channel_open_session(ssh_channel channel);
+LIBSSH_API int ssh_channel_open_x11(ssh_channel channel, const char *orig_addr, int orig_port);
+LIBSSH_API int ssh_channel_poll(ssh_channel channel, int is_stderr);
+LIBSSH_API int ssh_channel_poll_timeout(ssh_channel channel, int timeout, int is_stderr);
+LIBSSH_API int ssh_channel_read(ssh_channel channel, void *dest, uint32_t count, int is_stderr);
+LIBSSH_API int ssh_channel_read_timeout(ssh_channel channel, void *dest, uint32_t count, int is_stderr, int timeout_ms);
+LIBSSH_API int ssh_channel_read_nonblocking(ssh_channel channel, void *dest, uint32_t count,
+ int is_stderr);
+LIBSSH_API int ssh_channel_request_env(ssh_channel channel, const char *name, const char *value);
+LIBSSH_API int ssh_channel_request_exec(ssh_channel channel, const char *cmd);
+LIBSSH_API int ssh_channel_request_pty(ssh_channel channel);
+LIBSSH_API int ssh_channel_request_pty_size(ssh_channel channel, const char *term,
+ int cols, int rows);
+LIBSSH_API int ssh_channel_request_shell(ssh_channel channel);
+LIBSSH_API int ssh_channel_request_send_signal(ssh_channel channel, const char *signum);
+LIBSSH_API int ssh_channel_request_sftp(ssh_channel channel);
+LIBSSH_API int ssh_channel_request_subsystem(ssh_channel channel, const char *subsystem);
+LIBSSH_API int ssh_channel_request_x11(ssh_channel channel, int single_connection, const char *protocol,
+ const char *cookie, int screen_number);
+LIBSSH_API int ssh_channel_send_eof(ssh_channel channel);
+LIBSSH_API int ssh_channel_select(ssh_channel *readchans, ssh_channel *writechans, ssh_channel *exceptchans, struct
+ timeval * timeout);
+LIBSSH_API void ssh_channel_set_blocking(ssh_channel channel, int blocking);
+LIBSSH_API void ssh_channel_set_counter(ssh_channel channel,
+ ssh_counter counter);
+LIBSSH_API int ssh_channel_write(ssh_channel channel, const void *data, uint32_t len);
+LIBSSH_API uint32_t ssh_channel_window_size(ssh_channel channel);
+
+LIBSSH_API char *ssh_basename (const char *path);
+LIBSSH_API void ssh_clean_pubkey_hash(unsigned char **hash);
+LIBSSH_API int ssh_connect(ssh_session session);
+LIBSSH_API const char *ssh_copyright(void);
+LIBSSH_API void ssh_disconnect(ssh_session session);
+LIBSSH_API char *ssh_dirname (const char *path);
+LIBSSH_API int ssh_finalize(void);
+
+/* REVERSE PORT FORWARDING */
+LIBSSH_API ssh_channel ssh_channel_accept_forward(ssh_session session,
+ int timeout_ms,
+ int *destination_port);
+LIBSSH_API int ssh_channel_cancel_forward(ssh_session session,
+ const char *address,
+ int port);
+LIBSSH_API int ssh_channel_listen_forward(ssh_session session,
+ const char *address,
+ int port,
+ int *bound_port);
+
+LIBSSH_API void ssh_free(ssh_session session);
+LIBSSH_API const char *ssh_get_disconnect_message(ssh_session session);
+LIBSSH_API const char *ssh_get_error(void *error);
+LIBSSH_API int ssh_get_error_code(void *error);
+LIBSSH_API socket_t ssh_get_fd(ssh_session session);
+LIBSSH_API char *ssh_get_hexa(const unsigned char *what, size_t len);
+LIBSSH_API char *ssh_get_issue_banner(ssh_session session);
+LIBSSH_API int ssh_get_openssh_version(ssh_session session);
+
+LIBSSH_API int ssh_get_publickey(ssh_session session, ssh_key *key);
+
+enum ssh_publickey_hash_type {
+ SSH_PUBLICKEY_HASH_SHA1,
+ SSH_PUBLICKEY_HASH_MD5
+};
+LIBSSH_API int ssh_get_publickey_hash(const ssh_key key,
+ enum ssh_publickey_hash_type type,
+ unsigned char **hash,
+ size_t *hlen);
+
+/* DEPRECATED FUNCTIONS */
+SSH_DEPRECATED LIBSSH_API int ssh_get_pubkey_hash(ssh_session session, unsigned char **hash);
+SSH_DEPRECATED LIBSSH_API ssh_channel ssh_forward_accept(ssh_session session, int timeout_ms);
+SSH_DEPRECATED LIBSSH_API int ssh_forward_cancel(ssh_session session, const char *address, int port);
+SSH_DEPRECATED LIBSSH_API int ssh_forward_listen(ssh_session session, const char *address, int port, int *bound_port);
+
+
+LIBSSH_API int ssh_get_random(void *where,int len,int strong);
+LIBSSH_API int ssh_get_version(ssh_session session);
+LIBSSH_API int ssh_get_status(ssh_session session);
+LIBSSH_API int ssh_get_poll_flags(ssh_session session);
+LIBSSH_API int ssh_init(void);
+LIBSSH_API int ssh_is_blocking(ssh_session session);
+LIBSSH_API int ssh_is_connected(ssh_session session);
+LIBSSH_API int ssh_is_server_known(ssh_session session);
+
+/* LOGGING */
+LIBSSH_API int ssh_set_log_level(int level);
+LIBSSH_API int ssh_get_log_level(void);
+LIBSSH_API void *ssh_get_log_userdata(void);
+LIBSSH_API int ssh_set_log_userdata(void *data);
+LIBSSH_API void _ssh_log(int verbosity,
+ const char *function,
+ const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
+
+/* legacy */
+SSH_DEPRECATED LIBSSH_API void ssh_log(ssh_session session,
+ int prioriry,
+ const char *format, ...) PRINTF_ATTRIBUTE(3, 4);
+
+LIBSSH_API ssh_channel ssh_message_channel_request_open_reply_accept(ssh_message msg);
+LIBSSH_API int ssh_message_channel_request_reply_success(ssh_message msg);
+LIBSSH_API void ssh_message_free(ssh_message msg);
+LIBSSH_API ssh_message ssh_message_get(ssh_session session);
+LIBSSH_API int ssh_message_subtype(ssh_message msg);
+LIBSSH_API int ssh_message_type(ssh_message msg);
+LIBSSH_API int ssh_mkdir (const char *pathname, mode_t mode);
+LIBSSH_API ssh_session ssh_new(void);
+
+LIBSSH_API int ssh_options_copy(ssh_session src, ssh_session *dest);
+LIBSSH_API int ssh_options_getopt(ssh_session session, int *argcptr, char **argv);
+LIBSSH_API int ssh_options_parse_config(ssh_session session, const char *filename);
+LIBSSH_API int ssh_options_set(ssh_session session, enum ssh_options_e type,
+ const void *value);
+LIBSSH_API int ssh_options_get(ssh_session session, enum ssh_options_e type,
+ char **value);
+LIBSSH_API int ssh_options_get_port(ssh_session session, unsigned int * port_target);
+LIBSSH_API int ssh_pcap_file_close(ssh_pcap_file pcap);
+LIBSSH_API void ssh_pcap_file_free(ssh_pcap_file pcap);
+LIBSSH_API ssh_pcap_file ssh_pcap_file_new(void);
+LIBSSH_API int ssh_pcap_file_open(ssh_pcap_file pcap, const char *filename);
+
+/**
+ * @brief SSH authentication callback.
+ *
+ * @param prompt Prompt to be displayed.
+ * @param buf Buffer to save the password. You should null-terminate it.
+ * @param len Length of the buffer.
+ * @param echo Enable or disable the echo of what you type.
+ * @param verify Should the password be verified?
+ * @param userdata Userdata to be passed to the callback function. Useful
+ * for GUI applications.
+ *
+ * @return 0 on success, < 0 on error.
+ */
+typedef int (*ssh_auth_callback) (const char *prompt, char *buf, size_t len,
+ int echo, int verify, void *userdata);
+
+LIBSSH_API ssh_key ssh_key_new(void);
+LIBSSH_API void ssh_key_free (ssh_key key);
+LIBSSH_API enum ssh_keytypes_e ssh_key_type(const ssh_key key);
+LIBSSH_API const char *ssh_key_type_to_char(enum ssh_keytypes_e type);
+LIBSSH_API enum ssh_keytypes_e ssh_key_type_from_name(const char *name);
+LIBSSH_API int ssh_key_is_public(const ssh_key k);
+LIBSSH_API int ssh_key_is_private(const ssh_key k);
+LIBSSH_API int ssh_key_cmp(const ssh_key k1,
+ const ssh_key k2,
+ enum ssh_keycmp_e what);
+
+LIBSSH_API int ssh_pki_generate(enum ssh_keytypes_e type, int parameter,
+ ssh_key *pkey);
+LIBSSH_API int ssh_pki_import_privkey_base64(const char *b64_key,
+ const char *passphrase,
+ ssh_auth_callback auth_fn,
+ void *auth_data,
+ ssh_key *pkey);
+LIBSSH_API int ssh_pki_import_privkey_file(const char *filename,
+ const char *passphrase,
+ ssh_auth_callback auth_fn,
+ void *auth_data,
+ ssh_key *pkey);
+LIBSSH_API int ssh_pki_export_privkey_file(const ssh_key privkey,
+ const char *passphrase,
+ ssh_auth_callback auth_fn,
+ void *auth_data,
+ const char *filename);
+
+LIBSSH_API int ssh_pki_import_pubkey_base64(const char *b64_key,
+ enum ssh_keytypes_e type,
+ ssh_key *pkey);
+LIBSSH_API int ssh_pki_import_pubkey_file(const char *filename,
+ ssh_key *pkey);
+
+LIBSSH_API int ssh_pki_export_privkey_to_pubkey(const ssh_key privkey,
+ ssh_key *pkey);
+LIBSSH_API int ssh_pki_export_pubkey_base64(const ssh_key key,
+ char **b64_key);
+LIBSSH_API int ssh_pki_export_pubkey_file(const ssh_key key,
+ const char *filename);
+
+LIBSSH_API const char *ssh_pki_key_ecdsa_name(const ssh_key key);
+
+LIBSSH_API void ssh_print_hexa(const char *descr, const unsigned char *what, size_t len);
+LIBSSH_API int ssh_send_ignore (ssh_session session, const char *data);
+LIBSSH_API int ssh_send_debug (ssh_session session, const char *message, int always_display);
+LIBSSH_API void ssh_gssapi_set_creds(ssh_session session, const ssh_gssapi_creds creds);
+LIBSSH_API int ssh_scp_accept_request(ssh_scp scp);
+LIBSSH_API int ssh_scp_close(ssh_scp scp);
+LIBSSH_API int ssh_scp_deny_request(ssh_scp scp, const char *reason);
+LIBSSH_API void ssh_scp_free(ssh_scp scp);
+LIBSSH_API int ssh_scp_init(ssh_scp scp);
+LIBSSH_API int ssh_scp_leave_directory(ssh_scp scp);
+LIBSSH_API ssh_scp ssh_scp_new(ssh_session session, int mode, const char *location);
+LIBSSH_API int ssh_scp_pull_request(ssh_scp scp);
+LIBSSH_API int ssh_scp_push_directory(ssh_scp scp, const char *dirname, int mode);
+LIBSSH_API int ssh_scp_push_file(ssh_scp scp, const char *filename, size_t size, int perms);
+LIBSSH_API int ssh_scp_push_file64(ssh_scp scp, const char *filename, uint64_t size, int perms);
+LIBSSH_API int ssh_scp_read(ssh_scp scp, void *buffer, size_t size);
+LIBSSH_API const char *ssh_scp_request_get_filename(ssh_scp scp);
+LIBSSH_API int ssh_scp_request_get_permissions(ssh_scp scp);
+LIBSSH_API size_t ssh_scp_request_get_size(ssh_scp scp);
+LIBSSH_API uint64_t ssh_scp_request_get_size64(ssh_scp scp);
+LIBSSH_API const char *ssh_scp_request_get_warning(ssh_scp scp);
+LIBSSH_API int ssh_scp_write(ssh_scp scp, const void *buffer, size_t len);
+LIBSSH_API int ssh_select(ssh_channel *channels, ssh_channel *outchannels, socket_t maxfd,
+ fd_set *readfds, struct timeval *timeout);
+LIBSSH_API int ssh_service_request(ssh_session session, const char *service);
+LIBSSH_API int ssh_set_agent_channel(ssh_session session, ssh_channel channel);
+LIBSSH_API int ssh_set_agent_socket(ssh_session session, socket_t fd);
+LIBSSH_API void ssh_set_blocking(ssh_session session, int blocking);
+LIBSSH_API void ssh_set_counters(ssh_session session, ssh_counter scounter,
+ ssh_counter rcounter);
+LIBSSH_API void ssh_set_fd_except(ssh_session session);
+LIBSSH_API void ssh_set_fd_toread(ssh_session session);
+LIBSSH_API void ssh_set_fd_towrite(ssh_session session);
+LIBSSH_API void ssh_silent_disconnect(ssh_session session);
+LIBSSH_API int ssh_set_pcap_file(ssh_session session, ssh_pcap_file pcapfile);
+
+/* USERAUTH */
+LIBSSH_API int ssh_userauth_none(ssh_session session, const char *username);
+LIBSSH_API int ssh_userauth_list(ssh_session session, const char *username);
+LIBSSH_API int ssh_userauth_try_publickey(ssh_session session,
+ const char *username,
+ const ssh_key pubkey);
+LIBSSH_API int ssh_userauth_publickey(ssh_session session,
+ const char *username,
+ const ssh_key privkey);
+#ifndef _WIN32
+LIBSSH_API int ssh_userauth_agent(ssh_session session,
+ const char *username);
+#endif
+LIBSSH_API int ssh_userauth_publickey_auto(ssh_session session,
+ const char *username,
+ const char *passphrase);
+LIBSSH_API int ssh_userauth_password(ssh_session session,
+ const char *username,
+ const char *password);
+
+LIBSSH_API int ssh_userauth_kbdint(ssh_session session, const char *user, const char *submethods);
+LIBSSH_API const char *ssh_userauth_kbdint_getinstruction(ssh_session session);
+LIBSSH_API const char *ssh_userauth_kbdint_getname(ssh_session session);
+LIBSSH_API int ssh_userauth_kbdint_getnprompts(ssh_session session);
+LIBSSH_API const char *ssh_userauth_kbdint_getprompt(ssh_session session, unsigned int i, char *echo);
+LIBSSH_API int ssh_userauth_kbdint_getnanswers(ssh_session session);
+LIBSSH_API const char *ssh_userauth_kbdint_getanswer(ssh_session session, unsigned int i);
+LIBSSH_API int ssh_userauth_kbdint_setanswer(ssh_session session, unsigned int i,
+ const char *answer);
+LIBSSH_API int ssh_userauth_gssapi(ssh_session session);
+LIBSSH_API const char *ssh_version(int req_version);
+LIBSSH_API int ssh_write_knownhost(ssh_session session);
+
+LIBSSH_API void ssh_string_burn(ssh_string str);
+LIBSSH_API ssh_string ssh_string_copy(ssh_string str);
+LIBSSH_API void *ssh_string_data(ssh_string str);
+LIBSSH_API int ssh_string_fill(ssh_string str, const void *data, size_t len);
+LIBSSH_API void ssh_string_free(ssh_string str);
+LIBSSH_API ssh_string ssh_string_from_char(const char *what);
+LIBSSH_API size_t ssh_string_len(ssh_string str);
+LIBSSH_API ssh_string ssh_string_new(size_t size);
+LIBSSH_API const char *ssh_string_get_char(ssh_string str);
+LIBSSH_API char *ssh_string_to_char(ssh_string str);
+LIBSSH_API void ssh_string_free_char(char *s);
+
+LIBSSH_API int ssh_getpass(const char *prompt, char *buf, size_t len, int echo,
+ int verify);
+
+
+typedef int (*ssh_event_callback)(socket_t fd, int revents, void *userdata);
+
+LIBSSH_API ssh_event ssh_event_new(void);
+LIBSSH_API int ssh_event_add_fd(ssh_event event, socket_t fd, short events,
+ ssh_event_callback cb, void *userdata);
+LIBSSH_API int ssh_event_add_session(ssh_event event, ssh_session session);
+LIBSSH_API int ssh_event_dopoll(ssh_event event, int timeout);
+LIBSSH_API int ssh_event_remove_fd(ssh_event event, socket_t fd);
+LIBSSH_API int ssh_event_remove_session(ssh_event event, ssh_session session);
+LIBSSH_API void ssh_event_free(ssh_event event);
+LIBSSH_API const char* ssh_get_clientbanner(ssh_session session);
+LIBSSH_API const char* ssh_get_serverbanner(ssh_session session);
+LIBSSH_API const char* ssh_get_kex_algo(ssh_session session);
+LIBSSH_API const char* ssh_get_cipher_in(ssh_session session);
+LIBSSH_API const char* ssh_get_cipher_out(ssh_session session);
+LIBSSH_API const char* ssh_get_hmac_in(ssh_session session);
+LIBSSH_API const char* ssh_get_hmac_out(ssh_session session);
+
+#ifndef LIBSSH_LEGACY_0_4
+#include "libssh/legacy.h"
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* _LIBSSH_H */
+/* vim: set ts=2 sw=2 et cindent: */
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/libsshpp.hpp b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/libsshpp.hpp
new file mode 100755
index 0000000..af08a91
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/libsshpp.hpp
@@ -0,0 +1,614 @@
+/*
+ * This file is part of the SSH Library
+ *
+ * Copyright (c) 2010 by Aris Adamantiadis
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef LIBSSHPP_HPP_
+#define LIBSSHPP_HPP_
+
+/**
+ * @defgroup ssh_cpp The libssh C++ wrapper
+ *
+ * The C++ bindings for libssh are completely embedded in a single .hpp file, and
+ * this for two reasons:
+ * - C++ is hard to keep binary compatible, C is easy. We try to keep libssh C version
+ * as much as possible binary compatible between releases, while this would be hard for
+ * C++. If you compile your program with these headers, you will only link to the C version
+ * of libssh which will be kept ABI compatible. No need to recompile your C++ program
+ * each time a new binary-compatible version of libssh is out
+ * - Most of the functions in this file are really short and are probably worth the "inline"
+ * linking mode, which the compiler can decide to do in some case. There would be nearly no
+ * performance penalty of using the wrapper rather than native calls.
+ *
+ * Please visit the documentation of ssh::Session and ssh::Channel
+ * @see ssh::Session
+ * @see ssh::Channel
+ *
+ * If you wish not to use C++ exceptions, please define SSH_NO_CPP_EXCEPTIONS:
+ * @code
+ * #define SSH_NO_CPP_EXCEPTIONS
+ * #include <libssh/libsshpp.hpp>
+ * @endcode
+ * All functions will then return SSH_ERROR in case of error.
+ * @{
+ */
+
+/* do not use deprecated functions */
+#define LIBSSH_LEGACY_0_4
+
+#include <libssh/libssh.h>
+#include <libssh/server.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string>
+
+namespace ssh {
+
+class Channel;
+/** Some people do not like C++ exceptions. With this define, we give
+ * the choice to use or not exceptions.
+ * @brief if defined, disable C++ exceptions for libssh c++ wrapper
+ */
+#ifndef SSH_NO_CPP_EXCEPTIONS
+
+/** @brief This class describes a SSH Exception object. This object can be thrown
+ * by several SSH functions that interact with the network, and may fail because of
+ * socket, protocol or memory errors.
+ */
+class SshException{
+public:
+ SshException(ssh_session csession){
+ code=ssh_get_error_code(csession);
+ description=std::string(ssh_get_error(csession));
+ }
+ SshException(const SshException &e){
+ code=e.code;
+ description=e.description;
+ }
+ /** @brief returns the Error code
+ * @returns SSH_FATAL Fatal error happened (not recoverable)
+ * @returns SSH_REQUEST_DENIED Request was denied by remote host
+ * @see ssh_get_error_code
+ */
+ int getCode(){
+ return code;
+ }
+ /** @brief returns the error message of the last exception
+ * @returns pointer to a c string containing the description of error
+ * @see ssh_get_error
+ */
+ std::string getError(){
+ return description;
+ }
+private:
+ int code;
+ std::string description;
+};
+
+/** @internal
+ * @brief Macro to throw exception if there was an error
+ */
+#define ssh_throw(x) if((x)==SSH_ERROR) throw SshException(getCSession())
+#define ssh_throw_null(CSession,x) if((x)==NULL) throw SshException(CSession)
+#define void_throwable void
+#define return_throwable return
+
+#else
+
+/* No exception at all. All functions will return an error code instead
+ * of an exception
+ */
+#define ssh_throw(x) if((x)==SSH_ERROR) return SSH_ERROR
+#define ssh_throw_null(CSession,x) if((x)==NULL) return NULL
+#define void_throwable int
+#define return_throwable return SSH_OK
+#endif
+
+/**
+ * The ssh::Session class contains the state of a SSH connection.
+ */
+class Session {
+ friend class Channel;
+public:
+ Session(){
+ c_session=ssh_new();
+ }
+ ~Session(){
+ ssh_free(c_session);
+ c_session=NULL;
+ }
+ /** @brief sets an SSH session options
+ * @param type Type of option
+ * @param option cstring containing the value of option
+ * @throws SshException on error
+ * @see ssh_options_set
+ */
+ void_throwable setOption(enum ssh_options_e type, const char *option){
+ ssh_throw(ssh_options_set(c_session,type,option));
+ return_throwable;
+ }
+ /** @brief sets an SSH session options
+ * @param type Type of option
+ * @param option long integer containing the value of option
+ * @throws SshException on error
+ * @see ssh_options_set
+ */
+ void_throwable setOption(enum ssh_options_e type, long int option){
+ ssh_throw(ssh_options_set(c_session,type,&option));
+ return_throwable;
+ }
+ /** @brief sets an SSH session options
+ * @param type Type of option
+ * @param option void pointer containing the value of option
+ * @throws SshException on error
+ * @see ssh_options_set
+ */
+ void_throwable setOption(enum ssh_options_e type, void *option){
+ ssh_throw(ssh_options_set(c_session,type,option));
+ return_throwable;
+ }
+ /** @brief connects to the remote host
+ * @throws SshException on error
+ * @see ssh_connect
+ */
+ void_throwable connect(){
+ int ret=ssh_connect(c_session);
+ ssh_throw(ret);
+ return_throwable;
+ }
+ /** @brief Authenticates automatically using public key
+ * @throws SshException on error
+ * @returns SSH_AUTH_SUCCESS, SSH_AUTH_PARTIAL, SSH_AUTH_DENIED
+ * @see ssh_userauth_autopubkey
+ */
+ int userauthPublickeyAuto(void){
+ int ret=ssh_userauth_publickey_auto(c_session, NULL, NULL);
+ ssh_throw(ret);
+ return ret;
+ }
+ /** @brief Authenticates using the "none" method. Prefer using autopubkey if
+ * possible.
+ * @throws SshException on error
+ * @returns SSH_AUTH_SUCCESS, SSH_AUTH_PARTIAL, SSH_AUTH_DENIED
+ * @see ssh_userauth_none
+ * @see Session::userauthAutoPubkey
+ */
+ int userauthNone(){
+ int ret=ssh_userauth_none(c_session,NULL);
+ ssh_throw(ret);
+ return ret;
+ }
+ /** @brief Authenticates using the password method.
+ * @param[in] password password to use for authentication
+ * @throws SshException on error
+ * @returns SSH_AUTH_SUCCESS, SSH_AUTH_PARTIAL, SSH_AUTH_DENIED
+ * @see ssh_userauth_password
+ */
+ int userauthPassword(const char *password){
+ int ret=ssh_userauth_password(c_session,NULL,password);
+ ssh_throw(ret);
+ return ret;
+ }
+ /** @brief Try to authenticate using the publickey method.
+ * @param[in] pubkey public key to use for authentication
+ * @throws SshException on error
+ * @returns SSH_AUTH_SUCCESS if the pubkey is accepted,
+ * @returns SSH_AUTH_DENIED if the pubkey is denied
+ * @see ssh_userauth_try_pubkey
+ */
+ int userauthTryPublickey(ssh_key pubkey){
+ int ret=ssh_userauth_try_publickey(c_session, NULL, pubkey);
+ ssh_throw(ret);
+ return ret;
+ }
+ /** @brief Authenticates using the publickey method.
+ * @param[in] privkey private key to use for authentication
+ * @throws SshException on error
+ * @returns SSH_AUTH_SUCCESS, SSH_AUTH_PARTIAL, SSH_AUTH_DENIED
+ * @see ssh_userauth_pubkey
+ */
+ int userauthPublickey(ssh_key privkey){
+ int ret=ssh_userauth_publickey(c_session, NULL, privkey);
+ ssh_throw(ret);
+ return ret;
+ }
+ int userauthPrivatekeyFile(const char *filename,
+ const char *passphrase);
+ /** @brief Returns the available authentication methods from the server
+ * @throws SshException on error
+ * @returns Bitfield of available methods.
+ * @see ssh_userauth_list
+ */
+ int getAuthList(){
+ int ret=ssh_userauth_list(c_session, NULL);
+ ssh_throw(ret);
+ return ret;
+ }
+ /** @brief Disconnects from the SSH server and closes connection
+ * @see ssh_disconnect
+ */
+ void disconnect(){
+ ssh_disconnect(c_session);
+ }
+ /** @brief Returns the disconnect message from the server, if any
+ * @returns pointer to the message, or NULL. Do not attempt to free
+ * the pointer.
+ */
+ const char *getDisconnectMessage(){
+ const char *msg=ssh_get_disconnect_message(c_session);
+ return msg;
+ }
+ /** @internal
+ * @brief gets error message
+ */
+ const char *getError(){
+ return ssh_get_error(c_session);
+ }
+ /** @internal
+ * @brief returns error code
+ */
+ int getErrorCode(){
+ return ssh_get_error_code(c_session);
+ }
+ /** @brief returns the file descriptor used for the communication
+ * @returns the file descriptor
+ * @warning if a proxycommand is used, this function will only return
+ * one of the two file descriptors being used
+ * @see ssh_get_fd
+ */
+ socket_t getSocket(){
+ return ssh_get_fd(c_session);
+ }
+ /** @brief gets the Issue banner from the ssh server
+ * @returns the issue banner. This is generally a MOTD from server
+ * @see ssh_get_issue_banner
+ */
+ std::string getIssueBanner(){
+ char *banner=ssh_get_issue_banner(c_session);
+ std::string ret= std::string(banner);
+ ::free(banner);
+ return ret;
+ }
+ /** @brief returns the OpenSSH version (server) if possible
+ * @returns openssh version code
+ * @see ssh_get_openssh_version
+ */
+ int getOpensshVersion(){
+ return ssh_get_openssh_version(c_session);
+ }
+ /** @brief returns the version of the SSH protocol being used
+ * @returns the SSH protocol version
+ * @see ssh_get_version
+ */
+ int getVersion(){
+ return ssh_get_version(c_session);
+ }
+ /** @brief verifies that the server is known
+ * @throws SshException on error
+ * @returns Integer value depending on the knowledge of the
+ * server key
+ * @see ssh_is_server_known
+ */
+ int isServerKnown(){
+ int ret=ssh_is_server_known(c_session);
+ ssh_throw(ret);
+ return ret;
+ }
+ void log(int priority, const char *format, ...){
+ char buffer[1024];
+ va_list va;
+
+ va_start(va, format);
+ vsnprintf(buffer, sizeof(buffer), format, va);
+ va_end(va);
+ _ssh_log(priority, "libsshpp", "%s", buffer);
+ }
+
+ /** @brief copies options from a session to another
+ * @throws SshException on error
+ * @see ssh_options_copy
+ */
+ void_throwable optionsCopy(const Session &source){
+ ssh_throw(ssh_options_copy(source.c_session,&c_session));
+ return_throwable;
+ }
+ /** @brief parses a configuration file for options
+ * @throws SshException on error
+ * @param[in] file configuration file name
+ * @see ssh_options_parse_config
+ */
+ void_throwable optionsParseConfig(const char *file){
+ ssh_throw(ssh_options_parse_config(c_session,file));
+ return_throwable;
+ }
+ /** @brief silently disconnect from remote host
+ * @see ssh_silent_disconnect
+ */
+ void silentDisconnect(){
+ ssh_silent_disconnect(c_session);
+ }
+ /** @brief Writes the known host file with current
+ * host key
+ * @throws SshException on error
+ * @see ssh_write_knownhost
+ */
+ int writeKnownhost(){
+ int ret = ssh_write_knownhost(c_session);
+ ssh_throw(ret);
+ return ret;
+ }
+
+ /** @brief accept an incoming forward connection
+ * @param[in] timeout_ms timeout for waiting, in ms
+ * @returns new Channel pointer on the forward connection
+ * @returns NULL in case of error
+ * @warning you have to delete this pointer after use
+ * @see ssh_channel_forward_accept
+ * @see Session::listenForward
+ */
+ inline Channel *acceptForward(int timeout_ms);
+ /* implemented outside the class due Channel references */
+
+ void_throwable cancelForward(const char *address, int port){
+ int err=ssh_channel_cancel_forward(c_session, address, port);
+ ssh_throw(err);
+ return_throwable;
+ }
+
+ void_throwable listenForward(const char *address, int port,
+ int &boundport){
+ int err=ssh_channel_listen_forward(c_session, address, port, &boundport);
+ ssh_throw(err);
+ return_throwable;
+ }
+
+private:
+ ssh_session c_session;
+ ssh_session getCSession(){
+ return c_session;
+ }
+ /* No copy constructor, no = operator */
+ Session(const Session &);
+ Session& operator=(const Session &);
+};
+
+/** @brief the ssh::Channel class describes the state of an SSH
+ * channel.
+ * @see ssh_channel
+ */
+class Channel {
+ friend class Session;
+public:
+ Channel(Session &session){
+ channel=ssh_channel_new(session.getCSession());
+ this->session=&session;
+ }
+ ~Channel(){
+ ssh_channel_free(channel);
+ channel=NULL;
+ }
+
+ /** @brief accept an incoming X11 connection
+ * @param[in] timeout_ms timeout for waiting, in ms
+ * @returns new Channel pointer on the X11 connection
+ * @returns NULL in case of error
+ * @warning you have to delete this pointer after use
+ * @see ssh_channel_accept_x11
+ * @see Channel::requestX11
+ */
+ Channel *acceptX11(int timeout_ms){
+ ssh_channel x11chan = ssh_channel_accept_x11(channel,timeout_ms);
+ ssh_throw_null(getCSession(),x11chan);
+ Channel *newchan = new Channel(getSession(),x11chan);
+ return newchan;
+ }
+ /** @brief change the size of a pseudoterminal
+ * @param[in] cols number of columns
+ * @param[in] rows number of rows
+ * @throws SshException on error
+ * @see ssh_channel_change_pty_size
+ */
+ void_throwable changePtySize(int cols, int rows){
+ int err=ssh_channel_change_pty_size(channel,cols,rows);
+ ssh_throw(err);
+ return_throwable;
+ }
+
+ /** @brief closes a channel
+ * @throws SshException on error
+ * @see ssh_channel_close
+ */
+ void_throwable close(){
+ ssh_throw(ssh_channel_close(channel));
+ return_throwable;
+ }
+
+ int getExitStatus(){
+ return ssh_channel_get_exit_status(channel);
+ }
+ Session &getSession(){
+ return *session;
+ }
+ /** @brief returns true if channel is in closed state
+ * @see ssh_channel_is_closed
+ */
+ bool isClosed(){
+ return ssh_channel_is_closed(channel) != 0;
+ }
+ /** @brief returns true if channel is in EOF state
+ * @see ssh_channel_is_eof
+ */
+ bool isEof(){
+ return ssh_channel_is_eof(channel) != 0;
+ }
+ /** @brief returns true if channel is in open state
+ * @see ssh_channel_is_open
+ */
+ bool isOpen(){
+ return ssh_channel_is_open(channel) != 0;
+ }
+ int openForward(const char *remotehost, int remoteport,
+ const char *sourcehost=NULL, int localport=0){
+ int err=ssh_channel_open_forward(channel,remotehost,remoteport,
+ sourcehost, localport);
+ ssh_throw(err);
+ return err;
+ }
+ /* TODO: completely remove this ? */
+ void_throwable openSession(){
+ int err=ssh_channel_open_session(channel);
+ ssh_throw(err);
+ return_throwable;
+ }
+ int poll(bool is_stderr=false){
+ int err=ssh_channel_poll(channel,is_stderr);
+ ssh_throw(err);
+ return err;
+ }
+ int read(void *dest, size_t count, bool is_stderr){
+ int err;
+ /* handle int overflow */
+ if(count > 0x7fffffff)
+ count = 0x7fffffff;
+ err=ssh_channel_read_timeout(channel,dest,count,is_stderr,-1);
+ ssh_throw(err);
+ return err;
+ }
+ int read(void *dest, size_t count, int timeout){
+ int err;
+ /* handle int overflow */
+ if(count > 0x7fffffff)
+ count = 0x7fffffff;
+ err=ssh_channel_read_timeout(channel,dest,count,false,timeout);
+ ssh_throw(err);
+ return err;
+ }
+ int read(void *dest, size_t count, bool is_stderr=false, int timeout=-1){
+ int err;
+ /* handle int overflow */
+ if(count > 0x7fffffff)
+ count = 0x7fffffff;
+ err=ssh_channel_read_timeout(channel,dest,count,is_stderr,timeout);
+ ssh_throw(err);
+ return err;
+ }
+ int readNonblocking(void *dest, size_t count, bool is_stderr=false){
+ int err;
+ /* handle int overflow */
+ if(count > 0x7fffffff)
+ count = 0x7fffffff;
+ err=ssh_channel_read_nonblocking(channel,dest,count,is_stderr);
+ ssh_throw(err);
+ return err;
+ }
+ void_throwable requestEnv(const char *name, const char *value){
+ int err=ssh_channel_request_env(channel,name,value);
+ ssh_throw(err);
+ return_throwable;
+ }
+
+ void_throwable requestExec(const char *cmd){
+ int err=ssh_channel_request_exec(channel,cmd);
+ ssh_throw(err);
+ return_throwable;
+ }
+ void_throwable requestPty(const char *term=NULL, int cols=0, int rows=0){
+ int err;
+ if(term != NULL && cols != 0 && rows != 0)
+ err=ssh_channel_request_pty_size(channel,term,cols,rows);
+ else
+ err=ssh_channel_request_pty(channel);
+ ssh_throw(err);
+ return_throwable;
+ }
+
+ void_throwable requestShell(){
+ int err=ssh_channel_request_shell(channel);
+ ssh_throw(err);
+ return_throwable;
+ }
+ void_throwable requestSendSignal(const char *signum){
+ int err=ssh_channel_request_send_signal(channel, signum);
+ ssh_throw(err);
+ return_throwable;
+ }
+ void_throwable requestSubsystem(const char *subsystem){
+ int err=ssh_channel_request_subsystem(channel,subsystem);
+ ssh_throw(err);
+ return_throwable;
+ }
+ int requestX11(bool single_connection,
+ const char *protocol, const char *cookie, int screen_number){
+ int err=ssh_channel_request_x11(channel,single_connection,
+ protocol, cookie, screen_number);
+ ssh_throw(err);
+ return err;
+ }
+ void_throwable sendEof(){
+ int err=ssh_channel_send_eof(channel);
+ ssh_throw(err);
+ return_throwable;
+ }
+ /** @brief Writes on a channel
+ * @param data data to write.
+ * @param len number of bytes to write.
+ * @param is_stderr write should be done on the stderr channel (server only)
+ * @returns number of bytes written
+ * @throws SshException in case of error
+ * @see channel_write
+ * @see channel_write_stderr
+ */
+ int write(const void *data, size_t len, bool is_stderr=false){
+ int ret;
+ if(is_stderr){
+ ret=ssh_channel_write_stderr(channel,data,len);
+ } else {
+ ret=ssh_channel_write(channel,data,len);
+ }
+ ssh_throw(ret);
+ return ret;
+ }
+private:
+ ssh_session getCSession(){
+ return session->getCSession();
+ }
+ Channel (Session &session, ssh_channel c_channel){
+ this->channel=c_channel;
+ this->session=&session;
+ }
+ Session *session;
+ ssh_channel channel;
+ /* No copy and no = operator */
+ Channel(const Channel &);
+ Channel &operator=(const Channel &);
+};
+
+
+inline Channel *Session::acceptForward(int timeout_ms){
+ ssh_channel forward =
+ ssh_channel_accept_forward(c_session, timeout_ms, NULL);
+ ssh_throw_null(c_session,forward);
+ Channel *newchan = new Channel(*this,forward);
+ return newchan;
+ }
+
+} // namespace ssh
+
+/** @} */
+#endif /* LIBSSHPP_HPP_ */
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/server.h b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/server.h
new file mode 100755
index 0000000..385a10a
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/server.h
@@ -0,0 +1,336 @@
+/* Public include file for server support */
+/*
+ * This file is part of the SSH Library
+ *
+ * Copyright (c) 2003-2008 by Aris Adamantiadis
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @defgroup libssh_server The libssh server API
+ *
+ * @{
+ */
+
+#ifndef SERVER_H
+#define SERVER_H
+
+#include "libssh/libssh.h"
+#define SERVERBANNER CLIENTBANNER
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum ssh_bind_options_e {
+ SSH_BIND_OPTIONS_BINDADDR,
+ SSH_BIND_OPTIONS_BINDPORT,
+ SSH_BIND_OPTIONS_BINDPORT_STR,
+ SSH_BIND_OPTIONS_HOSTKEY,
+ SSH_BIND_OPTIONS_DSAKEY,
+ SSH_BIND_OPTIONS_RSAKEY,
+ SSH_BIND_OPTIONS_BANNER,
+ SSH_BIND_OPTIONS_LOG_VERBOSITY,
+ SSH_BIND_OPTIONS_LOG_VERBOSITY_STR,
+ SSH_BIND_OPTIONS_ECDSAKEY
+};
+
+typedef struct ssh_bind_struct* ssh_bind;
+
+/* Callback functions */
+
+/**
+ * @brief Incoming connection callback. This callback is called when a ssh_bind
+ * has a new incoming connection.
+ * @param sshbind Current sshbind session handler
+ * @param userdata Userdata to be passed to the callback function.
+ */
+typedef void (*ssh_bind_incoming_connection_callback) (ssh_bind sshbind,
+ void *userdata);
+
+/**
+ * @brief These are the callbacks exported by the ssh_bind structure.
+ *
+ * They are called by the server module when events appear on the network.
+ */
+struct ssh_bind_callbacks_struct {
+ /** DON'T SET THIS use ssh_callbacks_init() instead. */
+ size_t size;
+ /** A new connection is available. */
+ ssh_bind_incoming_connection_callback incoming_connection;
+};
+typedef struct ssh_bind_callbacks_struct *ssh_bind_callbacks;
+
+/**
+ * @brief Creates a new SSH server bind.
+ *
+ * @return A newly allocated ssh_bind session pointer.
+ */
+LIBSSH_API ssh_bind ssh_bind_new(void);
+
+LIBSSH_API int ssh_bind_options_set(ssh_bind sshbind,
+ enum ssh_bind_options_e type, const void *value);
+
+/**
+ * @brief Start listening to the socket.
+ *
+ * @param ssh_bind_o The ssh server bind to use.
+ *
+ * @return 0 on success, < 0 on error.
+ */
+LIBSSH_API int ssh_bind_listen(ssh_bind ssh_bind_o);
+
+/**
+ * @brief Set the callback for this bind.
+ *
+ * @param[in] sshbind The bind to set the callback on.
+ *
+ * @param[in] callbacks An already set up ssh_bind_callbacks instance.
+ *
+ * @param[in] userdata A pointer to private data to pass to the callbacks.
+ *
+ * @return SSH_OK on success, SSH_ERROR if an error occured.
+ *
+ * @code
+ * struct ssh_callbacks_struct cb = {
+ * .userdata = data,
+ * .auth_function = my_auth_function
+ * };
+ * ssh_callbacks_init(&cb);
+ * ssh_bind_set_callbacks(session, &cb);
+ * @endcode
+ */
+LIBSSH_API int ssh_bind_set_callbacks(ssh_bind sshbind, ssh_bind_callbacks callbacks,
+ void *userdata);
+
+/**
+ * @brief Set the session to blocking/nonblocking mode.
+ *
+ * @param ssh_bind_o The ssh server bind to use.
+ *
+ * @param blocking Zero for nonblocking mode.
+ */
+LIBSSH_API void ssh_bind_set_blocking(ssh_bind ssh_bind_o, int blocking);
+
+/**
+ * @brief Recover the file descriptor from the session.
+ *
+ * @param ssh_bind_o The ssh server bind to get the fd from.
+ *
+ * @return The file descriptor.
+ */
+LIBSSH_API socket_t ssh_bind_get_fd(ssh_bind ssh_bind_o);
+
+/**
+ * @brief Set the file descriptor for a session.
+ *
+ * @param ssh_bind_o The ssh server bind to set the fd.
+ *
+ * @param fd The file descriptssh_bind B
+ */
+LIBSSH_API void ssh_bind_set_fd(ssh_bind ssh_bind_o, socket_t fd);
+
+/**
+ * @brief Allow the file descriptor to accept new sessions.
+ *
+ * @param ssh_bind_o The ssh server bind to use.
+ */
+LIBSSH_API void ssh_bind_fd_toaccept(ssh_bind ssh_bind_o);
+
+/**
+ * @brief Accept an incoming ssh connection and initialize the session.
+ *
+ * @param ssh_bind_o The ssh server bind to accept a connection.
+ * @param session A preallocated ssh session
+ * @see ssh_new
+ * @return SSH_OK when a connection is established
+ */
+LIBSSH_API int ssh_bind_accept(ssh_bind ssh_bind_o, ssh_session session);
+
+/**
+ * @brief Accept an incoming ssh connection on the given file descriptor
+ * and initialize the session.
+ *
+ * @param ssh_bind_o The ssh server bind to accept a connection.
+ * @param session A preallocated ssh session
+ * @param fd A file descriptor of an already established TCP
+ * inbound connection
+ * @see ssh_new
+ * @see ssh_bind_accept
+ * @return SSH_OK when a connection is established
+ */
+LIBSSH_API int ssh_bind_accept_fd(ssh_bind ssh_bind_o, ssh_session session,
+ socket_t fd);
+
+LIBSSH_API ssh_gssapi_creds ssh_gssapi_get_creds(ssh_session session);
+
+/**
+ * @brief Handles the key exchange and set up encryption
+ *
+ * @param session A connected ssh session
+ * @see ssh_bind_accept
+ * @return SSH_OK if the key exchange was successful
+ */
+LIBSSH_API int ssh_handle_key_exchange(ssh_session session);
+
+/**
+ * @brief Free a ssh servers bind.
+ *
+ * @param ssh_bind_o The ssh server bind to free.
+ */
+LIBSSH_API void ssh_bind_free(ssh_bind ssh_bind_o);
+
+LIBSSH_API void ssh_set_auth_methods(ssh_session session, int auth_methods);
+
+/**********************************************************
+ * SERVER MESSAGING
+ **********************************************************/
+
+/**
+ * @brief Reply with a standard reject message.
+ *
+ * Use this function if you don't know what to respond or if you want to reject
+ * a request.
+ *
+ * @param[in] msg The message to use for the reply.
+ *
+ * @return 0 on success, -1 on error.
+ *
+ * @see ssh_message_get()
+ */
+LIBSSH_API int ssh_message_reply_default(ssh_message msg);
+
+/**
+ * @brief Get the name of the authenticated user.
+ *
+ * @param[in] msg The message to get the username from.
+ *
+ * @return The username or NULL if an error occured.
+ *
+ * @see ssh_message_get()
+ * @see ssh_message_type()
+ */
+LIBSSH_API const char *ssh_message_auth_user(ssh_message msg);
+
+/**
+ * @brief Get the password of the authenticated user.
+ *
+ * @param[in] msg The message to get the password from.
+ *
+ * @return The username or NULL if an error occured.
+ *
+ * @see ssh_message_get()
+ * @see ssh_message_type()
+ */
+LIBSSH_API const char *ssh_message_auth_password(ssh_message msg);
+
+/**
+ * @brief Get the publickey of the authenticated user.
+ *
+ * If you need the key for later user you should duplicate it.
+ *
+ * @param[in] msg The message to get the public key from.
+ *
+ * @return The public key or NULL.
+ *
+ * @see ssh_key_dup()
+ * @see ssh_key_cmp()
+ * @see ssh_message_get()
+ * @see ssh_message_type()
+ */
+LIBSSH_API ssh_key ssh_message_auth_pubkey(ssh_message msg);
+
+LIBSSH_API int ssh_message_auth_kbdint_is_response(ssh_message msg);
+LIBSSH_API enum ssh_publickey_state_e ssh_message_auth_publickey_state(ssh_message msg);
+LIBSSH_API int ssh_message_auth_reply_success(ssh_message msg,int partial);
+LIBSSH_API int ssh_message_auth_reply_pk_ok(ssh_message msg, ssh_string algo, ssh_string pubkey);
+LIBSSH_API int ssh_message_auth_reply_pk_ok_simple(ssh_message msg);
+
+LIBSSH_API int ssh_message_auth_set_methods(ssh_message msg, int methods);
+
+LIBSSH_API int ssh_message_auth_interactive_request(ssh_message msg,
+ const char *name, const char *instruction,
+ unsigned int num_prompts, const char **prompts, char *echo);
+
+LIBSSH_API int ssh_message_service_reply_success(ssh_message msg);
+LIBSSH_API const char *ssh_message_service_service(ssh_message msg);
+
+LIBSSH_API int ssh_message_global_request_reply_success(ssh_message msg,
+ uint16_t bound_port);
+
+LIBSSH_API void ssh_set_message_callback(ssh_session session,
+ int(*ssh_bind_message_callback)(ssh_session session, ssh_message msg, void *data),
+ void *data);
+LIBSSH_API int ssh_execute_message_callbacks(ssh_session session);
+
+LIBSSH_API const char *ssh_message_channel_request_open_originator(ssh_message msg);
+LIBSSH_API int ssh_message_channel_request_open_originator_port(ssh_message msg);
+LIBSSH_API const char *ssh_message_channel_request_open_destination(ssh_message msg);
+LIBSSH_API int ssh_message_channel_request_open_destination_port(ssh_message msg);
+
+LIBSSH_API ssh_channel ssh_message_channel_request_channel(ssh_message msg);
+
+LIBSSH_API const char *ssh_message_channel_request_pty_term(ssh_message msg);
+LIBSSH_API int ssh_message_channel_request_pty_width(ssh_message msg);
+LIBSSH_API int ssh_message_channel_request_pty_height(ssh_message msg);
+LIBSSH_API int ssh_message_channel_request_pty_pxwidth(ssh_message msg);
+LIBSSH_API int ssh_message_channel_request_pty_pxheight(ssh_message msg);
+
+LIBSSH_API const char *ssh_message_channel_request_env_name(ssh_message msg);
+LIBSSH_API const char *ssh_message_channel_request_env_value(ssh_message msg);
+
+LIBSSH_API const char *ssh_message_channel_request_command(ssh_message msg);
+
+LIBSSH_API const char *ssh_message_channel_request_subsystem(ssh_message msg);
+
+LIBSSH_API int ssh_message_channel_request_x11_single_connection(ssh_message msg);
+LIBSSH_API const char *ssh_message_channel_request_x11_auth_protocol(ssh_message msg);
+LIBSSH_API const char *ssh_message_channel_request_x11_auth_cookie(ssh_message msg);
+LIBSSH_API int ssh_message_channel_request_x11_screen_number(ssh_message msg);
+
+LIBSSH_API const char *ssh_message_global_request_address(ssh_message msg);
+LIBSSH_API int ssh_message_global_request_port(ssh_message msg);
+
+LIBSSH_API int ssh_channel_open_reverse_forward(ssh_channel channel, const char *remotehost,
+ int remoteport, const char *sourcehost, int localport);
+LIBSSH_API int ssh_channel_open_x11(ssh_channel channel,
+ const char *orig_addr, int orig_port);
+
+LIBSSH_API int ssh_channel_request_send_exit_status(ssh_channel channel,
+ int exit_status);
+LIBSSH_API int ssh_channel_request_send_exit_signal(ssh_channel channel,
+ const char *signum,
+ int core,
+ const char *errmsg,
+ const char *lang);
+LIBSSH_API int ssh_channel_write_stderr(ssh_channel channel,
+ const void *data,
+ uint32_t len);
+
+LIBSSH_API int ssh_send_keepalive(ssh_session session);
+
+/* deprecated functions */
+SSH_DEPRECATED LIBSSH_API int ssh_accept(ssh_session session);
+SSH_DEPRECATED LIBSSH_API int channel_write_stderr(ssh_channel channel,
+ const void *data, uint32_t len);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* SERVER_H */
+
+/** @} */
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/sftp.h b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/sftp.h
new file mode 100755
index 0000000..8fb8f11
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/sftp.h
@@ -0,0 +1,1000 @@
+/*
+ * This file is part of the SSH Library
+ *
+ * Copyright (c) 2003-2008 by Aris Adamantiadis
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @defgroup libssh_sftp The libssh SFTP API
+ *
+ * @brief SFTP handling functions
+ *
+ * SFTP commands are channeled by the ssh sftp subsystem. Every packet is
+ * sent/read using a sftp_packet type structure. Related to these packets,
+ * most of the server answers are messages having an ID and a message
+ * specific part. It is described by sftp_message when reading a message,
+ * the sftp system puts it into the queue, so the process having asked for
+ * it can fetch it, while continuing to read for other messages (it is
+ * unspecified in which order messages may be sent back to the client
+ *
+ * @{
+ */
+
+#ifndef SFTP_H
+#define SFTP_H
+
+#include <sys/types.h>
+
+#include "libssh.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _WIN32
+#ifndef uid_t
+ typedef uint32_t uid_t;
+#endif /* uid_t */
+#ifndef gid_t
+ typedef uint32_t gid_t;
+#endif /* gid_t */
+#ifdef _MSC_VER
+#ifndef ssize_t
+ typedef _W64 SSIZE_T ssize_t;
+#endif /* ssize_t */
+#endif /* _MSC_VER */
+#endif /* _WIN32 */
+
+#define LIBSFTP_VERSION 3
+
+typedef struct sftp_attributes_struct* sftp_attributes;
+typedef struct sftp_client_message_struct* sftp_client_message;
+typedef struct sftp_dir_struct* sftp_dir;
+typedef struct sftp_ext_struct *sftp_ext;
+typedef struct sftp_file_struct* sftp_file;
+typedef struct sftp_message_struct* sftp_message;
+typedef struct sftp_packet_struct* sftp_packet;
+typedef struct sftp_request_queue_struct* sftp_request_queue;
+typedef struct sftp_session_struct* sftp_session;
+typedef struct sftp_status_message_struct* sftp_status_message;
+typedef struct sftp_statvfs_struct* sftp_statvfs_t;
+
+struct sftp_session_struct {
+ ssh_session session;
+ ssh_channel channel;
+ int server_version;
+ int client_version;
+ int version;
+ sftp_request_queue queue;
+ uint32_t id_counter;
+ int errnum;
+ void **handles;
+ sftp_ext ext;
+};
+
+struct sftp_packet_struct {
+ sftp_session sftp;
+ uint8_t type;
+ ssh_buffer payload;
+};
+
+/* file handler */
+struct sftp_file_struct {
+ sftp_session sftp;
+ char *name;
+ uint64_t offset;
+ ssh_string handle;
+ int eof;
+ int nonblocking;
+};
+
+struct sftp_dir_struct {
+ sftp_session sftp;
+ char *name;
+ ssh_string handle; /* handle to directory */
+ ssh_buffer buffer; /* contains raw attributes from server which haven't been parsed */
+ uint32_t count; /* counts the number of following attributes structures into buffer */
+ int eof; /* end of directory listing */
+};
+
+struct sftp_message_struct {
+ sftp_session sftp;
+ uint8_t packet_type;
+ ssh_buffer payload;
+ uint32_t id;
+};
+
+/* this is a bunch of all data that could be into a message */
+struct sftp_client_message_struct {
+ sftp_session sftp;
+ uint8_t type;
+ uint32_t id;
+ char *filename; /* can be "path" */
+ uint32_t flags;
+ sftp_attributes attr;
+ ssh_string handle;
+ uint64_t offset;
+ uint32_t len;
+ int attr_num;
+ ssh_buffer attrbuf; /* used by sftp_reply_attrs */
+ ssh_string data; /* can be newpath of rename() */
+ ssh_buffer complete_message; /* complete message in case of retransmission*/
+ char *str_data; /* cstring version of data */
+};
+
+struct sftp_request_queue_struct {
+ sftp_request_queue next;
+ sftp_message message;
+};
+
+/* SSH_FXP_MESSAGE described into .7 page 26 */
+struct sftp_status_message_struct {
+ uint32_t id;
+ uint32_t status;
+ ssh_string error_unused; /* not used anymore */
+ ssh_string lang_unused; /* not used anymore */
+ char *errormsg;
+ char *langmsg;
+};
+
+struct sftp_attributes_struct {
+ char *name;
+ char *longname; /* ls -l output on openssh, not reliable else */
+ uint32_t flags;
+ uint8_t type;
+ uint64_t size;
+ uint32_t uid;
+ uint32_t gid;
+ char *owner; /* set if openssh and version 4 */
+ char *group; /* set if openssh and version 4 */
+ uint32_t permissions;
+ uint64_t atime64;
+ uint32_t atime;
+ uint32_t atime_nseconds;
+ uint64_t createtime;
+ uint32_t createtime_nseconds;
+ uint64_t mtime64;
+ uint32_t mtime;
+ uint32_t mtime_nseconds;
+ ssh_string acl;
+ uint32_t extended_count;
+ ssh_string extended_type;
+ ssh_string extended_data;
+};
+
+/**
+ * @brief SFTP statvfs structure.
+ */
+struct sftp_statvfs_struct {
+ uint64_t f_bsize; /** file system block size */
+ uint64_t f_frsize; /** fundamental fs block size */
+ uint64_t f_blocks; /** number of blocks (unit f_frsize) */
+ uint64_t f_bfree; /** free blocks in file system */
+ uint64_t f_bavail; /** free blocks for non-root */
+ uint64_t f_files; /** total file inodes */
+ uint64_t f_ffree; /** free file inodes */
+ uint64_t f_favail; /** free file inodes for to non-root */
+ uint64_t f_fsid; /** file system id */
+ uint64_t f_flag; /** bit mask of f_flag values */
+ uint64_t f_namemax; /** maximum filename length */
+};
+
+/**
+ * @brief Start a new sftp session.
+ *
+ * @param session The ssh session to use.
+ *
+ * @return A new sftp session or NULL on error.
+ *
+ * @see sftp_free()
+ */
+LIBSSH_API sftp_session sftp_new(ssh_session session);
+
+/**
+ * @brief Start a new sftp session with an existing channel.
+ *
+ * @param session The ssh session to use.
+ * @param channel An open session channel with subsystem already allocated
+ *
+ * @return A new sftp session or NULL on error.
+ *
+ * @see sftp_free()
+ */
+LIBSSH_API sftp_session sftp_new_channel(ssh_session session, ssh_channel channel);
+
+
+/**
+ * @brief Close and deallocate a sftp session.
+ *
+ * @param sftp The sftp session handle to free.
+ */
+LIBSSH_API void sftp_free(sftp_session sftp);
+
+/**
+ * @brief Initialize the sftp session with the server.
+ *
+ * @param sftp The sftp session to initialize.
+ *
+ * @return 0 on success, < 0 on error with ssh error set.
+ *
+ * @see sftp_new()
+ */
+LIBSSH_API int sftp_init(sftp_session sftp);
+
+/**
+ * @brief Get the last sftp error.
+ *
+ * Use this function to get the latest error set by a posix like sftp function.
+ *
+ * @param sftp The sftp session where the error is saved.
+ *
+ * @return The saved error (see server responses), < 0 if an error
+ * in the function occured.
+ *
+ * @see Server responses
+ */
+LIBSSH_API int sftp_get_error(sftp_session sftp);
+
+/**
+ * @brief Get the count of extensions provided by the server.
+ *
+ * @param sftp The sftp session to use.
+ *
+ * @return The count of extensions provided by the server, 0 on error or
+ * not available.
+ */
+LIBSSH_API unsigned int sftp_extensions_get_count(sftp_session sftp);
+
+/**
+ * @brief Get the name of the extension provided by the server.
+ *
+ * @param sftp The sftp session to use.
+ *
+ * @param indexn The index number of the extension name you want.
+ *
+ * @return The name of the extension.
+ */
+LIBSSH_API const char *sftp_extensions_get_name(sftp_session sftp, unsigned int indexn);
+
+/**
+ * @brief Get the data of the extension provided by the server.
+ *
+ * This is normally the version number of the extension.
+ *
+ * @param sftp The sftp session to use.
+ *
+ * @param indexn The index number of the extension data you want.
+ *
+ * @return The data of the extension.
+ */
+LIBSSH_API const char *sftp_extensions_get_data(sftp_session sftp, unsigned int indexn);
+
+/**
+ * @brief Check if the given extension is supported.
+ *
+ * @param sftp The sftp session to use.
+ *
+ * @param name The name of the extension.
+ *
+ * @param data The data of the extension.
+ *
+ * @return 1 if supported, 0 if not.
+ *
+ * Example:
+ *
+ * @code
+ * sftp_extension_supported(sftp, "statvfs at openssh.com", "2");
+ * @endcode
+ */
+LIBSSH_API int sftp_extension_supported(sftp_session sftp, const char *name,
+ const char *data);
+
+/**
+ * @brief Open a directory used to obtain directory entries.
+ *
+ * @param session The sftp session handle to open the directory.
+ * @param path The path of the directory to open.
+ *
+ * @return A sftp directory handle or NULL on error with ssh and
+ * sftp error set.
+ *
+ * @see sftp_readdir
+ * @see sftp_closedir
+ */
+LIBSSH_API sftp_dir sftp_opendir(sftp_session session, const char *path);
+
+/**
+ * @brief Get a single file attributes structure of a directory.
+ *
+ * @param session The sftp session handle to read the directory entry.
+ * @param dir The opened sftp directory handle to read from.
+ *
+ * @return A file attribute structure or NULL at the end of the
+ * directory.
+ *
+ * @see sftp_opendir()
+ * @see sftp_attribute_free()
+ * @see sftp_closedir()
+ */
+LIBSSH_API sftp_attributes sftp_readdir(sftp_session session, sftp_dir dir);
+
+/**
+ * @brief Tell if the directory has reached EOF (End Of File).
+ *
+ * @param dir The sftp directory handle.
+ *
+ * @return 1 if the directory is EOF, 0 if not.
+ *
+ * @see sftp_readdir()
+ */
+LIBSSH_API int sftp_dir_eof(sftp_dir dir);
+
+/**
+ * @brief Get information about a file or directory.
+ *
+ * @param session The sftp session handle.
+ * @param path The path to the file or directory to obtain the
+ * information.
+ *
+ * @return The sftp attributes structure of the file or directory,
+ * NULL on error with ssh and sftp error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API sftp_attributes sftp_stat(sftp_session session, const char *path);
+
+/**
+ * @brief Get information about a file or directory.
+ *
+ * Identical to sftp_stat, but if the file or directory is a symbolic link,
+ * then the link itself is stated, not the file that it refers to.
+ *
+ * @param session The sftp session handle.
+ * @param path The path to the file or directory to obtain the
+ * information.
+ *
+ * @return The sftp attributes structure of the file or directory,
+ * NULL on error with ssh and sftp error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API sftp_attributes sftp_lstat(sftp_session session, const char *path);
+
+/**
+ * @brief Get information about a file or directory from a file handle.
+ *
+ * @param file The sftp file handle to get the stat information.
+ *
+ * @return The sftp attributes structure of the file or directory,
+ * NULL on error with ssh and sftp error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API sftp_attributes sftp_fstat(sftp_file file);
+
+/**
+ * @brief Free a sftp attribute structure.
+ *
+ * @param file The sftp attribute structure to free.
+ */
+LIBSSH_API void sftp_attributes_free(sftp_attributes file);
+
+/**
+ * @brief Close a directory handle opened by sftp_opendir().
+ *
+ * @param dir The sftp directory handle to close.
+ *
+ * @return Returns SSH_NO_ERROR or SSH_ERROR if an error occured.
+ */
+LIBSSH_API int sftp_closedir(sftp_dir dir);
+
+/**
+ * @brief Close an open file handle.
+ *
+ * @param file The open sftp file handle to close.
+ *
+ * @return Returns SSH_NO_ERROR or SSH_ERROR if an error occured.
+ *
+ * @see sftp_open()
+ */
+LIBSSH_API int sftp_close(sftp_file file);
+
+/**
+ * @brief Open a file on the server.
+ *
+ * @param session The sftp session handle.
+ *
+ * @param file The file to be opened.
+ *
+ * @param accesstype Is one of O_RDONLY, O_WRONLY or O_RDWR which request
+ * opening the file read-only,write-only or read/write.
+ * Acesss may also be bitwise-or'd with one or more of
+ * the following:
+ * O_CREAT - If the file does not exist it will be
+ * created.
+ * O_EXCL - When used with O_CREAT, if the file already
+ * exists it is an error and the open will fail.
+ * O_TRUNC - If the file already exists it will be
+ * truncated.
+ *
+ * @param mode Mode specifies the permissions to use if a new file is
+ * created. It is modified by the process's umask in
+ * the usual way: The permissions of the created file are
+ * (mode & ~umask)
+ *
+ * @return A sftp file handle, NULL on error with ssh and sftp
+ * error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API sftp_file sftp_open(sftp_session session, const char *file, int accesstype,
+ mode_t mode);
+
+/**
+ * @brief Make the sftp communication for this file handle non blocking.
+ *
+ * @param[in] handle The file handle to set non blocking.
+ */
+LIBSSH_API void sftp_file_set_nonblocking(sftp_file handle);
+
+/**
+ * @brief Make the sftp communication for this file handle blocking.
+ *
+ * @param[in] handle The file handle to set blocking.
+ */
+LIBSSH_API void sftp_file_set_blocking(sftp_file handle);
+
+/**
+ * @brief Read from a file using an opened sftp file handle.
+ *
+ * @param file The opened sftp file handle to be read from.
+ *
+ * @param buf Pointer to buffer to recieve read data.
+ *
+ * @param count Size of the buffer in bytes.
+ *
+ * @return Number of bytes written, < 0 on error with ssh and sftp
+ * error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API ssize_t sftp_read(sftp_file file, void *buf, size_t count);
+
+/**
+ * @brief Start an asynchronous read from a file using an opened sftp file handle.
+ *
+ * Its goal is to avoid the slowdowns related to the request/response pattern
+ * of a synchronous read. To do so, you must call 2 functions:
+ *
+ * sftp_async_read_begin() and sftp_async_read().
+ *
+ * The first step is to call sftp_async_read_begin(). This function returns a
+ * request identifier. The second step is to call sftp_async_read() using the
+ * returned identifier.
+ *
+ * @param file The opened sftp file handle to be read from.
+ *
+ * @param len Size to read in bytes.
+ *
+ * @return An identifier corresponding to the sent request, < 0 on
+ * error.
+ *
+ * @warning When calling this function, the internal offset is
+ * updated corresponding to the len parameter.
+ *
+ * @warning A call to sftp_async_read_begin() sends a request to
+ * the server. When the server answers, libssh allocates
+ * memory to store it until sftp_async_read() is called.
+ * Not calling sftp_async_read() will lead to memory
+ * leaks.
+ *
+ * @see sftp_async_read()
+ * @see sftp_open()
+ */
+LIBSSH_API int sftp_async_read_begin(sftp_file file, uint32_t len);
+
+/**
+ * @brief Wait for an asynchronous read to complete and save the data.
+ *
+ * @param file The opened sftp file handle to be read from.
+ *
+ * @param data Pointer to buffer to recieve read data.
+ *
+ * @param len Size of the buffer in bytes. It should be bigger or
+ * equal to the length parameter of the
+ * sftp_async_read_begin() call.
+ *
+ * @param id The identifier returned by the sftp_async_read_begin()
+ * function.
+ *
+ * @return Number of bytes read, 0 on EOF, SSH_ERROR if an error
+ * occured, SSH_AGAIN if the file is opened in nonblocking
+ * mode and the request hasn't been executed yet.
+ *
+ * @warning A call to this function with an invalid identifier
+ * will never return.
+ *
+ * @see sftp_async_read_begin()
+ */
+LIBSSH_API int sftp_async_read(sftp_file file, void *data, uint32_t len, uint32_t id);
+
+/**
+ * @brief Write to a file using an opened sftp file handle.
+ *
+ * @param file Open sftp file handle to write to.
+ *
+ * @param buf Pointer to buffer to write data.
+ *
+ * @param count Size of buffer in bytes.
+ *
+ * @return Number of bytes written, < 0 on error with ssh and sftp
+ * error set.
+ *
+ * @see sftp_open()
+ * @see sftp_read()
+ * @see sftp_close()
+ */
+LIBSSH_API ssize_t sftp_write(sftp_file file, const void *buf, size_t count);
+
+/**
+ * @brief Seek to a specific location in a file.
+ *
+ * @param file Open sftp file handle to seek in.
+ *
+ * @param new_offset Offset in bytes to seek.
+ *
+ * @return 0 on success, < 0 on error.
+ */
+LIBSSH_API int sftp_seek(sftp_file file, uint32_t new_offset);
+
+/**
+ * @brief Seek to a specific location in a file. This is the
+ * 64bit version.
+ *
+ * @param file Open sftp file handle to seek in.
+ *
+ * @param new_offset Offset in bytes to seek.
+ *
+ * @return 0 on success, < 0 on error.
+ */
+LIBSSH_API int sftp_seek64(sftp_file file, uint64_t new_offset);
+
+/**
+ * @brief Report current byte position in file.
+ *
+ * @param file Open sftp file handle.
+ *
+ * @return The offset of the current byte relative to the beginning
+ * of the file associated with the file descriptor. < 0 on
+ * error.
+ */
+LIBSSH_API unsigned long sftp_tell(sftp_file file);
+
+/**
+ * @brief Report current byte position in file.
+ *
+ * @param file Open sftp file handle.
+ *
+ * @return The offset of the current byte relative to the beginning
+ * of the file associated with the file descriptor. < 0 on
+ * error.
+ */
+LIBSSH_API uint64_t sftp_tell64(sftp_file file);
+
+/**
+ * @brief Rewinds the position of the file pointer to the beginning of the
+ * file.
+ *
+ * @param file Open sftp file handle.
+ */
+LIBSSH_API void sftp_rewind(sftp_file file);
+
+/**
+ * @brief Unlink (delete) a file.
+ *
+ * @param sftp The sftp session handle.
+ *
+ * @param file The file to unlink/delete.
+ *
+ * @return 0 on success, < 0 on error with ssh and sftp error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API int sftp_unlink(sftp_session sftp, const char *file);
+
+/**
+ * @brief Remove a directoy.
+ *
+ * @param sftp The sftp session handle.
+ *
+ * @param directory The directory to remove.
+ *
+ * @return 0 on success, < 0 on error with ssh and sftp error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API int sftp_rmdir(sftp_session sftp, const char *directory);
+
+/**
+ * @brief Create a directory.
+ *
+ * @param sftp The sftp session handle.
+ *
+ * @param directory The directory to create.
+ *
+ * @param mode Specifies the permissions to use. It is modified by the
+ * process's umask in the usual way:
+ * The permissions of the created file are (mode & ~umask)
+ *
+ * @return 0 on success, < 0 on error with ssh and sftp error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API int sftp_mkdir(sftp_session sftp, const char *directory, mode_t mode);
+
+/**
+ * @brief Rename or move a file or directory.
+ *
+ * @param sftp The sftp session handle.
+ *
+ * @param original The original url (source url) of file or directory to
+ * be moved.
+ *
+ * @param newname The new url (destination url) of the file or directory
+ * after the move.
+ *
+ * @return 0 on success, < 0 on error with ssh and sftp error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API int sftp_rename(sftp_session sftp, const char *original, const char *newname);
+
+/**
+ * @brief Set file attributes on a file, directory or symbolic link.
+ *
+ * @param sftp The sftp session handle.
+ *
+ * @param file The file which attributes should be changed.
+ *
+ * @param attr The file attributes structure with the attributes set
+ * which should be changed.
+ *
+ * @return 0 on success, < 0 on error with ssh and sftp error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API int sftp_setstat(sftp_session sftp, const char *file, sftp_attributes attr);
+
+/**
+ * @brief Change the file owner and group
+ *
+ * @param sftp The sftp session handle.
+ *
+ * @param file The file which owner and group should be changed.
+ *
+ * @param owner The new owner which should be set.
+ *
+ * @param group The new group which should be set.
+ *
+ * @return 0 on success, < 0 on error with ssh and sftp error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API int sftp_chown(sftp_session sftp, const char *file, uid_t owner, gid_t group);
+
+/**
+ * @brief Change permissions of a file
+ *
+ * @param sftp The sftp session handle.
+ *
+ * @param file The file which owner and group should be changed.
+ *
+ * @param mode Specifies the permissions to use. It is modified by the
+ * process's umask in the usual way:
+ * The permissions of the created file are (mode & ~umask)
+ *
+ * @return 0 on success, < 0 on error with ssh and sftp error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API int sftp_chmod(sftp_session sftp, const char *file, mode_t mode);
+
+/**
+ * @brief Change the last modification and access time of a file.
+ *
+ * @param sftp The sftp session handle.
+ *
+ * @param file The file which owner and group should be changed.
+ *
+ * @param times A timeval structure which contains the desired access
+ * and modification time.
+ *
+ * @return 0 on success, < 0 on error with ssh and sftp error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API int sftp_utimes(sftp_session sftp, const char *file, const struct timeval *times);
+
+/**
+ * @brief Create a symbolic link.
+ *
+ * @param sftp The sftp session handle.
+ *
+ * @param target Specifies the target of the symlink.
+ *
+ * @param dest Specifies the path name of the symlink to be created.
+ *
+ * @return 0 on success, < 0 on error with ssh and sftp error set.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API int sftp_symlink(sftp_session sftp, const char *target, const char *dest);
+
+/**
+ * @brief Read the value of a symbolic link.
+ *
+ * @param sftp The sftp session handle.
+ *
+ * @param path Specifies the path name of the symlink to be read.
+ *
+ * @return The target of the link, NULL on error.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API char *sftp_readlink(sftp_session sftp, const char *path);
+
+/**
+ * @brief Get information about a mounted file system.
+ *
+ * @param sftp The sftp session handle.
+ *
+ * @param path The pathname of any file within the mounted file system.
+ *
+ * @return A statvfs structure or NULL on error.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API sftp_statvfs_t sftp_statvfs(sftp_session sftp, const char *path);
+
+/**
+ * @brief Get information about a mounted file system.
+ *
+ * @param file An opened file.
+ *
+ * @return A statvfs structure or NULL on error.
+ *
+ * @see sftp_get_error()
+ */
+LIBSSH_API sftp_statvfs_t sftp_fstatvfs(sftp_file file);
+
+/**
+ * @brief Free the memory of an allocated statvfs.
+ *
+ * @param statvfs_o The statvfs to free.
+ */
+LIBSSH_API void sftp_statvfs_free(sftp_statvfs_t statvfs_o);
+
+/**
+ * @brief Canonicalize a sftp path.
+ *
+ * @param sftp The sftp session handle.
+ *
+ * @param path The path to be canonicalized.
+ *
+ * @return The canonicalize path, NULL on error.
+ */
+LIBSSH_API char *sftp_canonicalize_path(sftp_session sftp, const char *path);
+
+/**
+ * @brief Get the version of the SFTP protocol supported by the server
+ *
+ * @param sftp The sftp session handle.
+ *
+ * @return The server version.
+ */
+LIBSSH_API int sftp_server_version(sftp_session sftp);
+
+#ifdef WITH_SERVER
+/**
+ * @brief Create a new sftp server session.
+ *
+ * @param session The ssh session to use.
+ *
+ * @param chan The ssh channel to use.
+ *
+ * @return A new sftp server session.
+ */
+LIBSSH_API sftp_session sftp_server_new(ssh_session session, ssh_channel chan);
+
+/**
+ * @brief Intialize the sftp server.
+ *
+ * @param sftp The sftp session to init.
+ *
+ * @return 0 on success, < 0 on error.
+ */
+LIBSSH_API int sftp_server_init(sftp_session sftp);
+#endif /* WITH_SERVER */
+
+/* this is not a public interface */
+#define SFTP_HANDLES 256
+sftp_packet sftp_packet_read(sftp_session sftp);
+int sftp_packet_write(sftp_session sftp,uint8_t type, ssh_buffer payload);
+void sftp_packet_free(sftp_packet packet);
+int buffer_add_attributes(ssh_buffer buffer, sftp_attributes attr);
+sftp_attributes sftp_parse_attr(sftp_session session, ssh_buffer buf,int expectname);
+/* sftpserver.c */
+
+LIBSSH_API sftp_client_message sftp_get_client_message(sftp_session sftp);
+LIBSSH_API void sftp_client_message_free(sftp_client_message msg);
+LIBSSH_API uint8_t sftp_client_message_get_type(sftp_client_message msg);
+LIBSSH_API const char *sftp_client_message_get_filename(sftp_client_message msg);
+LIBSSH_API void sftp_client_message_set_filename(sftp_client_message msg, const char *newname);
+LIBSSH_API const char *sftp_client_message_get_data(sftp_client_message msg);
+LIBSSH_API uint32_t sftp_client_message_get_flags(sftp_client_message msg);
+LIBSSH_API int sftp_send_client_message(sftp_session sftp, sftp_client_message msg);
+int sftp_reply_name(sftp_client_message msg, const char *name,
+ sftp_attributes attr);
+int sftp_reply_handle(sftp_client_message msg, ssh_string handle);
+ssh_string sftp_handle_alloc(sftp_session sftp, void *info);
+int sftp_reply_attr(sftp_client_message msg, sftp_attributes attr);
+void *sftp_handle(sftp_session sftp, ssh_string handle);
+int sftp_reply_status(sftp_client_message msg, uint32_t status, const char *message);
+int sftp_reply_names_add(sftp_client_message msg, const char *file,
+ const char *longname, sftp_attributes attr);
+int sftp_reply_names(sftp_client_message msg);
+int sftp_reply_data(sftp_client_message msg, const void *data, int len);
+void sftp_handle_remove(sftp_session sftp, void *handle);
+
+/* SFTP commands and constants */
+#define SSH_FXP_INIT 1
+#define SSH_FXP_VERSION 2
+#define SSH_FXP_OPEN 3
+#define SSH_FXP_CLOSE 4
+#define SSH_FXP_READ 5
+#define SSH_FXP_WRITE 6
+#define SSH_FXP_LSTAT 7
+#define SSH_FXP_FSTAT 8
+#define SSH_FXP_SETSTAT 9
+#define SSH_FXP_FSETSTAT 10
+#define SSH_FXP_OPENDIR 11
+#define SSH_FXP_READDIR 12
+#define SSH_FXP_REMOVE 13
+#define SSH_FXP_MKDIR 14
+#define SSH_FXP_RMDIR 15
+#define SSH_FXP_REALPATH 16
+#define SSH_FXP_STAT 17
+#define SSH_FXP_RENAME 18
+#define SSH_FXP_READLINK 19
+#define SSH_FXP_SYMLINK 20
+
+#define SSH_FXP_STATUS 101
+#define SSH_FXP_HANDLE 102
+#define SSH_FXP_DATA 103
+#define SSH_FXP_NAME 104
+#define SSH_FXP_ATTRS 105
+
+#define SSH_FXP_EXTENDED 200
+#define SSH_FXP_EXTENDED_REPLY 201
+
+/* attributes */
+/* sftp draft is completely braindead : version 3 and 4 have different flags for same constants */
+/* and even worst, version 4 has same flag for 2 different constants */
+/* follow up : i won't develop any sftp4 compliant library before having a clarification */
+
+#define SSH_FILEXFER_ATTR_SIZE 0x00000001
+#define SSH_FILEXFER_ATTR_PERMISSIONS 0x00000004
+#define SSH_FILEXFER_ATTR_ACCESSTIME 0x00000008
+#define SSH_FILEXFER_ATTR_ACMODTIME 0x00000008
+#define SSH_FILEXFER_ATTR_CREATETIME 0x00000010
+#define SSH_FILEXFER_ATTR_MODIFYTIME 0x00000020
+#define SSH_FILEXFER_ATTR_ACL 0x00000040
+#define SSH_FILEXFER_ATTR_OWNERGROUP 0x00000080
+#define SSH_FILEXFER_ATTR_SUBSECOND_TIMES 0x00000100
+#define SSH_FILEXFER_ATTR_EXTENDED 0x80000000
+#define SSH_FILEXFER_ATTR_UIDGID 0x00000002
+
+/* types */
+#define SSH_FILEXFER_TYPE_REGULAR 1
+#define SSH_FILEXFER_TYPE_DIRECTORY 2
+#define SSH_FILEXFER_TYPE_SYMLINK 3
+#define SSH_FILEXFER_TYPE_SPECIAL 4
+#define SSH_FILEXFER_TYPE_UNKNOWN 5
+
+/**
+ * @name Server responses
+ *
+ * @brief Responses returned by the sftp server.
+ * @{
+ */
+
+/** No error */
+#define SSH_FX_OK 0
+/** End-of-file encountered */
+#define SSH_FX_EOF 1
+/** File doesn't exist */
+#define SSH_FX_NO_SUCH_FILE 2
+/** Permission denied */
+#define SSH_FX_PERMISSION_DENIED 3
+/** Generic failure */
+#define SSH_FX_FAILURE 4
+/** Garbage received from server */
+#define SSH_FX_BAD_MESSAGE 5
+/** No connection has been set up */
+#define SSH_FX_NO_CONNECTION 6
+/** There was a connection, but we lost it */
+#define SSH_FX_CONNECTION_LOST 7
+/** Operation not supported by the server */
+#define SSH_FX_OP_UNSUPPORTED 8
+/** Invalid file handle */
+#define SSH_FX_INVALID_HANDLE 9
+/** No such file or directory path exists */
+#define SSH_FX_NO_SUCH_PATH 10
+/** An attempt to create an already existing file or directory has been made */
+#define SSH_FX_FILE_ALREADY_EXISTS 11
+/** We are trying to write on a write-protected filesystem */
+#define SSH_FX_WRITE_PROTECT 12
+/** No media in remote drive */
+#define SSH_FX_NO_MEDIA 13
+
+/** @} */
+
+/* file flags */
+#define SSH_FXF_READ 0x01
+#define SSH_FXF_WRITE 0x02
+#define SSH_FXF_APPEND 0x04
+#define SSH_FXF_CREAT 0x08
+#define SSH_FXF_TRUNC 0x10
+#define SSH_FXF_EXCL 0x20
+#define SSH_FXF_TEXT 0x40
+
+/* rename flags */
+#define SSH_FXF_RENAME_OVERWRITE 0x00000001
+#define SSH_FXF_RENAME_ATOMIC 0x00000002
+#define SSH_FXF_RENAME_NATIVE 0x00000004
+
+#define SFTP_OPEN SSH_FXP_OPEN
+#define SFTP_CLOSE SSH_FXP_CLOSE
+#define SFTP_READ SSH_FXP_READ
+#define SFTP_WRITE SSH_FXP_WRITE
+#define SFTP_LSTAT SSH_FXP_LSTAT
+#define SFTP_FSTAT SSH_FXP_FSTAT
+#define SFTP_SETSTAT SSH_FXP_SETSTAT
+#define SFTP_FSETSTAT SSH_FXP_FSETSTAT
+#define SFTP_OPENDIR SSH_FXP_OPENDIR
+#define SFTP_READDIR SSH_FXP_READDIR
+#define SFTP_REMOVE SSH_FXP_REMOVE
+#define SFTP_MKDIR SSH_FXP_MKDIR
+#define SFTP_RMDIR SSH_FXP_RMDIR
+#define SFTP_REALPATH SSH_FXP_REALPATH
+#define SFTP_STAT SSH_FXP_STAT
+#define SFTP_RENAME SSH_FXP_RENAME
+#define SFTP_READLINK SSH_FXP_READLINK
+#define SFTP_SYMLINK SSH_FXP_SYMLINK
+
+/* openssh flags */
+#define SSH_FXE_STATVFS_ST_RDONLY 0x1 /* read-only */
+#define SSH_FXE_STATVFS_ST_NOSUID 0x2 /* no setuid */
+
+#ifdef __cplusplus
+} ;
+#endif
+
+#endif /* SFTP_H */
+
+/** @} */
+/* vim: set ts=2 sw=2 et cindent: */
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/ssh2.h b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/ssh2.h
new file mode 100755
index 0000000..8b39b9a
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_bin/include/libssh/ssh2.h
@@ -0,0 +1,80 @@
+#ifndef __SSH2_H
+#define __SSH2_H
+
+#define SSH2_MSG_DISCONNECT 1
+#define SSH2_MSG_IGNORE 2
+#define SSH2_MSG_UNIMPLEMENTED 3
+#define SSH2_MSG_DEBUG 4
+#define SSH2_MSG_SERVICE_REQUEST 5
+#define SSH2_MSG_SERVICE_ACCEPT 6
+
+#define SSH2_MSG_KEXINIT 20
+#define SSH2_MSG_NEWKEYS 21
+
+#define SSH2_MSG_KEXDH_INIT 30
+#define SSH2_MSG_KEXDH_REPLY 31
+#define SSH2_MSG_KEX_ECDH_INIT 30
+#define SSH2_MSG_KEX_ECDH_REPLY 31
+#define SSH2_MSG_ECMQV_INIT 30
+#define SSH2_MSG_ECMQV_REPLY 31
+
+#define SSH2_MSG_KEX_DH_GEX_REQUEST_OLD 30
+#define SSH2_MSG_KEX_DH_GEX_GROUP 31
+#define SSH2_MSG_KEX_DH_GEX_INIT 32
+#define SSH2_MSG_KEX_DH_GEX_REPLY 33
+#define SSH2_MSG_KEX_DH_GEX_REQUEST 34
+#define SSH2_MSG_USERAUTH_REQUEST 50
+#define SSH2_MSG_USERAUTH_FAILURE 51
+#define SSH2_MSG_USERAUTH_SUCCESS 52
+#define SSH2_MSG_USERAUTH_BANNER 53
+#define SSH2_MSG_USERAUTH_PK_OK 60
+#define SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ 60
+#define SSH2_MSG_USERAUTH_INFO_REQUEST 60
+#define SSH2_MSG_USERAUTH_GSSAPI_RESPONSE 60
+#define SSH2_MSG_USERAUTH_INFO_RESPONSE 61
+#define SSH2_MSG_USERAUTH_GSSAPI_TOKEN 61
+#define SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE 63
+#define SSH2_MSG_USERAUTH_GSSAPI_ERROR 64
+#define SSH2_MSG_USERAUTH_GSSAPI_ERRTOK 65
+#define SSH2_MSG_USERAUTH_GSSAPI_MIC 66
+
+#define SSH2_MSG_GLOBAL_REQUEST 80
+#define SSH2_MSG_REQUEST_SUCCESS 81
+#define SSH2_MSG_REQUEST_FAILURE 82
+#define SSH2_MSG_CHANNEL_OPEN 90
+#define SSH2_MSG_CHANNEL_OPEN_CONFIRMATION 91
+#define SSH2_MSG_CHANNEL_OPEN_FAILURE 92
+#define SSH2_MSG_CHANNEL_WINDOW_ADJUST 93
+#define SSH2_MSG_CHANNEL_DATA 94
+#define SSH2_MSG_CHANNEL_EXTENDED_DATA 95
+#define SSH2_MSG_CHANNEL_EOF 96
+#define SSH2_MSG_CHANNEL_CLOSE 97
+#define SSH2_MSG_CHANNEL_REQUEST 98
+#define SSH2_MSG_CHANNEL_SUCCESS 99
+#define SSH2_MSG_CHANNEL_FAILURE 100
+
+#define SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT 1
+#define SSH2_DISCONNECT_PROTOCOL_ERROR 2
+#define SSH2_DISCONNECT_KEY_EXCHANGE_FAILED 3
+#define SSH2_DISCONNECT_HOST_AUTHENTICATION_FAILED 4
+#define SSH2_DISCONNECT_RESERVED 4
+#define SSH2_DISCONNECT_MAC_ERROR 5
+#define SSH2_DISCONNECT_COMPRESSION_ERROR 6
+#define SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE 7
+#define SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED 8
+#define SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE 9
+#define SSH2_DISCONNECT_CONNECTION_LOST 10
+#define SSH2_DISCONNECT_BY_APPLICATION 11
+#define SSH2_DISCONNECT_TOO_MANY_CONNECTIONS 12
+#define SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER 13
+#define SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE 14
+#define SSH2_DISCONNECT_ILLEGAL_USER_NAME 15
+
+#define SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED 1
+#define SSH2_OPEN_CONNECT_FAILED 2
+#define SSH2_OPEN_UNKNOWN_CHANNEL_TYPE 3
+#define SSH2_OPEN_RESOURCE_SHORTAGE 4
+
+#define SSH2_EXTENDED_DATA_STDERR 1
+
+#endif
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/lib/libssh.dll.a b/libssh/0.7.4-x2go1-mingw482_bin/lib/libssh.dll.a
new file mode 100755
index 0000000..f577da8
Binary files /dev/null and b/libssh/0.7.4-x2go1-mingw482_bin/lib/libssh.dll.a differ
diff --git a/libssh/0.7.4-x2go1-mingw482_bin/lib/libssh_threads.dll.a b/libssh/0.7.4-x2go1-mingw482_bin/lib/libssh_threads.dll.a
new file mode 100755
index 0000000..a528047
Binary files /dev/null and b/libssh/0.7.4-x2go1-mingw482_bin/lib/libssh_threads.dll.a differ
diff --git a/libssh/0.7.4-x2go1-mingw482_bin_set-timestamps.sh b/libssh/0.7.4-x2go1-mingw482_bin_set-timestamps.sh
new file mode 100755
index 0000000..7e55dcd
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_bin_set-timestamps.sh
@@ -0,0 +1,14 @@
+touch --no-create -d "2017-03-11 10:48:45.354887800 -0500" "0.7.4-x2go1-mingw482_bin/bin/libssh.dll"
+touch --no-create -d "2017-03-11 10:48:46.046136200 -0500" "0.7.4-x2go1-mingw482_bin/bin/libssh_threads.dll"
+touch --no-create -d "2017-03-11 08:43:13.884614200 -0500" "0.7.4-x2go1-mingw482_bin/CMake/libssh/libssh-config-version.cmake"
+touch --no-create -d "2015-05-15 19:42:04.689063900 -0400" "0.7.4-x2go1-mingw482_bin/CMake/libssh/libssh-config.cmake"
+touch --no-create -d "2017-03-11 10:47:44.759568700 -0500" "0.7.4-x2go1-mingw482_bin/CMake-Show-My-Changes.txt"
+touch --no-create -d "2015-01-11 08:49:15.811499900 -0500" "0.7.4-x2go1-mingw482_bin/include/libssh/callbacks.h"
+touch --no-create -d "2015-05-15 19:30:07.912858600 -0400" "0.7.4-x2go1-mingw482_bin/include/libssh/legacy.h"
+touch --no-create -d "2017-03-11 08:10:39.908742000 -0500" "0.7.4-x2go1-mingw482_bin/include/libssh/libssh.h"
+touch --no-create -d "2015-05-15 19:30:07.930869300 -0400" "0.7.4-x2go1-mingw482_bin/include/libssh/libsshpp.hpp"
+touch --no-create -d "2015-01-11 08:57:07.146954600 -0500" "0.7.4-x2go1-mingw482_bin/include/libssh/server.h"
+touch --no-create -d "2015-05-15 19:30:07.965879600 -0400" "0.7.4-x2go1-mingw482_bin/include/libssh/sftp.h"
+touch --no-create -d "2015-01-11 08:49:15.844533700 -0500" "0.7.4-x2go1-mingw482_bin/include/libssh/ssh2.h"
+touch --no-create -d "2017-03-11 10:48:45.261290700 -0500" "0.7.4-x2go1-mingw482_bin/lib/libssh.dll.a"
+touch --no-create -d "2017-03-11 10:48:46.028101300 -0500" "0.7.4-x2go1-mingw482_bin/lib/libssh_threads.dll.a"
diff --git a/libssh/0.7.4-x2go1-mingw482_src/0001-pki-Use-byte-mode-for-fopen.patch b/libssh/0.7.4-x2go1-mingw482_src/0001-pki-Use-byte-mode-for-fopen.patch
new file mode 100644
index 0000000..d103e60
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_src/0001-pki-Use-byte-mode-for-fopen.patch
@@ -0,0 +1,38 @@
+From ce029c0735a210ee544a6fe7d752e518f6699c16 Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn at cryptomilk.org>
+Date: Fri, 3 Feb 2017 13:18:16 +0100
+Subject: [PATCH 1/2] pki: Use byte mode for fopen()
+
+BUG: https://red.libssh.org/issues/251
+
+Signed-off-by: Andreas Schneider <asn at cryptomilk.org>
+(cherry picked from commit de369b46b1877d0f5546013518ef2a46932d6757)
+---
+ src/pki.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/pki.c b/src/pki.c
+index 5b26579..49e10b6 100644
+--- a/src/pki.c
++++ b/src/pki.c
+@@ -955,7 +955,7 @@ int ssh_pki_import_pubkey_file(const char *filename, ssh_key *pkey)
+ return SSH_ERROR;
+ }
+
+- file = fopen(filename, "r");
++ file = fopen(filename, "rb");
+ if (file == NULL) {
+ ssh_pki_log("Error opening %s: %s",
+ filename, strerror(errno));
+@@ -1233,7 +1233,7 @@ int ssh_pki_export_pubkey_file(const ssh_key key,
+ return SSH_ERROR;
+ }
+
+- fp = fopen(filename, "w+");
++ fp = fopen(filename, "wb+");
+ if (fp == NULL) {
+ return SSH_ERROR;
+ }
+--
+2.8.3
+
diff --git a/libssh/0.7.4-x2go1-mingw482_src/0002-Port-KDE-for-WIndows-s-Pageant-patch-0001-implement-.patch b/libssh/0.7.4-x2go1-mingw482_src/0002-Port-KDE-for-WIndows-s-Pageant-patch-0001-implement-.patch
new file mode 100644
index 0000000..daedb0a
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_src/0002-Port-KDE-for-WIndows-s-Pageant-patch-0001-implement-.patch
@@ -0,0 +1,530 @@
+From a0ab2cbb8d5f42e6073750be2f228b6c755f1eb0 Mon Sep 17 00:00:00 2001
+From: Mike DePaulo <mikedep333 at gmail.com>
+Date: Fri, 15 May 2015 20:05:23 -0400
+Subject: [PATCH 2/2] Port KDE for WIndows's Pageant patch
+ (0001-implement-support-for-putty-s-pageant-0.5.3.patch) to libssh-0.7.4
+
+---
+ include/libssh/agent.h | 2 -
+ src/CMakeLists.txt | 6 +++
+ src/agent.c | 79 ++++++++++++++++++++++++++++++++----
+ src/auth.c | 6 ---
+ src/pki.c | 2 -
+ src/session.c | 4 --
+ src/winpgntc.c | 107 +++++++++++++++++++++++++++++++++++++++++++++++++
+ src/winpgntc.h | 34 ++++++++++++++++
+ 8 files changed, 218 insertions(+), 22 deletions(-)
+ create mode 100644 src/winpgntc.c
+ create mode 100644 src/winpgntc.h
+
+diff --git a/include/libssh/agent.h b/include/libssh/agent.h
+index 77209d0..c65fe32 100644
+--- a/include/libssh/agent.h
++++ b/include/libssh/agent.h
+@@ -74,7 +74,6 @@ struct ssh_agent_struct {
+ ssh_channel channel;
+ };
+
+-#ifndef _WIN32
+ /* agent.c */
+ /**
+ * @brief Create a new ssh agent structure.
+@@ -112,7 +111,6 @@ ssh_key ssh_agent_get_first_ident(struct ssh_session_struct *session,
+ ssh_string ssh_agent_sign_data(ssh_session session,
+ const ssh_key pubkey,
+ struct ssh_buffer_struct *data);
+-#endif
+
+ #endif /* __AGENT_H */
+ /* vim: set ts=2 sw=2 et cindent: */
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 1012ddf..07ccece 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -151,6 +151,12 @@ set(libssh_SRCS
+ external/ge25519.c
+ external/sc25519.c
+ )
++if (WIN32)
++ set(libssh_SRCS
++ ${libssh_SRCS}
++ winpgntc.c
++ )
++endif (WIN32)
+
+ if (WITH_GCRYPT)
+ set(libssh_SRCS
+diff --git a/src/agent.c b/src/agent.c
+index e520773..6d7783c 100644
+--- a/src/agent.c
++++ b/src/agent.c
+@@ -33,8 +33,6 @@
+ * the agent returns the signed data
+ */
+
+-#ifndef _WIN32
+-
+ #include "config.h"
+
+ #include <stdlib.h>
+@@ -42,26 +40,44 @@
+ #include <string.h>
+ #include <stdio.h>
+
++#ifdef _WIN32
++#include <winsock2.h>
++#include <windows.h>
++#else
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif
++#endif
+
++#ifndef _WIN32
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
++#endif /* _WIN32 */
+
+ #include "libssh/agent.h"
+ #include "libssh/priv.h"
+ #include "libssh/socket.h"
+ #include "libssh/buffer.h"
+ #include "libssh/session.h"
++#ifndef _WIN32
++#include "libssh/priv.h"
++#include "libssh/socket.h"
+ #include "libssh/poll.h"
+ #include "libssh/pki.h"
++#else
++#include "winpgntc.h"
++#endif
+
+ /* macro to check for "agent failure" message */
+ #define agent_failed(x) \
+ (((x) == SSH_AGENT_FAILURE) || ((x) == SSH_COM_AGENT2_FAILURE) || \
+ ((x) == SSH2_AGENT_FAILURE))
+
++#ifdef _WIN32
++#define AGENT_COPYDATA_ID 0x804e50ba /* random goop */
++#endif
++
++
+ static uint32_t agent_get_u32(const void *vp) {
+ const uint8_t *p = (const uint8_t *)vp;
+ uint32_t v;
+@@ -83,6 +99,7 @@ static void agent_put_u32(void *vp, uint32_t v) {
+ p[3] = (uint8_t)v & 0xff;
+ }
+
++#ifndef _WIN32
+ static size_t atomicio(struct ssh_agent_struct *agent, void *buf, size_t n, int do_read) {
+ char *b = buf;
+ size_t pos = 0;
+@@ -109,10 +126,11 @@ static size_t atomicio(struct ssh_agent_struct *agent, void *buf, size_t n, int
+ continue;
+ }
+ #ifdef EWOULDBLOCK
+- if (errno == EAGAIN || errno == EWOULDBLOCK) {
++ if (errno == EAGAIN || errno == EWOULDBLOCK)
+ #else
+- if (errno == EAGAIN) {
++ if (errno == EAGAIN)
+ #endif
++ {
+ (void) ssh_poll(&pfd, 1, -1);
+ continue;
+ }
+@@ -142,6 +160,7 @@ static size_t atomicio(struct ssh_agent_struct *agent, void *buf, size_t n, int
+ return pos;
+ }
+ }
++#endif
+
+ ssh_agent agent_new(struct ssh_session_struct *session) {
+ ssh_agent agent = NULL;
+@@ -153,11 +172,13 @@ ssh_agent agent_new(struct ssh_session_struct *session) {
+ ZERO_STRUCTP(agent);
+
+ agent->count = 0;
++ #ifndef _WIN32
+ agent->sock = ssh_socket_new(session);
+ if (agent->sock == NULL) {
+ SAFE_FREE(agent);
+ return NULL;
+ }
++ #endif
+ agent->channel = NULL;
+ return agent;
+ }
+@@ -206,11 +227,13 @@ int ssh_set_agent_socket(ssh_session session, socket_t fd){
+ }
+
+ void agent_close(struct ssh_agent_struct *agent) {
++ #ifndef _WIN32
+ if (agent == NULL) {
+ return;
+ }
+
+ ssh_socket_close(agent->sock);
++ #endif
+ }
+
+ void agent_free(ssh_agent agent) {
+@@ -218,15 +241,18 @@ void agent_free(ssh_agent agent) {
+ if (agent->ident) {
+ ssh_buffer_free(agent->ident);
+ }
++#ifndef _WIN32
+ if (agent->sock) {
+ agent_close(agent);
+ ssh_socket_free(agent->sock);
+ }
++#endif
+ SAFE_FREE(agent);
+ }
+ }
+
+ static int agent_connect(ssh_session session) {
++#ifndef _WIN32
+ const char *auth_sock = NULL;
+
+ if (session == NULL || session->agent == NULL) {
+@@ -246,6 +272,9 @@ static int agent_connect(ssh_session session) {
+ }
+
+ return -1;
++#else
++ return 0;
++#endif
+ }
+
+ #if 0
+@@ -270,6 +299,7 @@ static int agent_decode_reply(struct ssh_session_struct *session, int type) {
+
+ static int agent_talk(struct ssh_session_struct *session,
+ struct ssh_buffer_struct *request, struct ssh_buffer_struct *reply) {
++#ifndef _WIN32
+ uint32_t len = 0;
+ uint8_t payload[1024] = {0};
+
+@@ -323,7 +353,39 @@ static int agent_talk(struct ssh_session_struct *session,
+ }
+ len -= n;
+ }
++#else
++ uint32_t inlen = 0, outlen = 0, i = 0;
++ uint8_t payload[1024] = {0};
++ uint8_t outload[1024] = {0};
++ uint8_t *t = outload;
++
++ inlen = ssh_buffer_get_len(request);
++ ssh_log(session, SSH_LOG_PACKET, "agent_talk - len of request: %u", inlen);
++ agent_put_u32(payload, inlen);
++
++ /* FIXME: make a clean copy here */
++ for(i = 0; i < inlen; i++) {
++ if(i == 1024) exit(1);
++ payload[i+4] = request->data[i];
++ }
++
++ agent_query((void*)payload, inlen + 4, &t, &outlen);
++
++ if (outlen > 256 * 1024) {
++ ssh_set_error(session, SSH_FATAL,
++ "Authentication response too long: %u", outlen);
++ return -1;
++ }
++ ssh_log(session, SSH_LOG_PACKET, "agent_talk - response length: %u", outlen);
+
++ outlen = outlen + 4;
++ /* the first 4 bytes are the size of the buffer */
++ if (ssh_buffer_add_data(reply, (t + 4), outlen) < 0) {
++ ssh_log(session, SSH_LOG_FUNCTIONS,
++ "Not enough space");
++ return -1;
++ }
++#endif
+ return 0;
+ }
+
+@@ -488,7 +550,7 @@ int agent_is_running(ssh_session session) {
+ if (session == NULL || session->agent == NULL) {
+ return 0;
+ }
+-
++#ifndef _WIN32
+ if (ssh_socket_is_open(session->agent->sock)) {
+ return 1;
+ } else {
+@@ -498,7 +560,10 @@ int agent_is_running(ssh_session session) {
+ return 1;
+ }
+ }
+-
++#else
++ if(FindWindow(TEXT("Pageant"), TEXT("Pageant")))
++ return 1;
++#endif
+ return 0;
+ }
+
+@@ -598,6 +663,4 @@ ssh_string ssh_agent_sign_data(ssh_session session,
+ return sig_blob;
+ }
+
+-#endif /* _WIN32 */
+-
+ /* vim: set ts=4 sw=4 et cindent: */
+diff --git a/src/auth.c b/src/auth.c
+index 48a0d5b..da03371 100755
+--- a/src/auth.c
++++ b/src/auth.c
+@@ -644,7 +644,6 @@ fail:
+ return SSH_AUTH_ERROR;
+ }
+
+-#ifndef _WIN32
+ static int ssh_userauth_agent_publickey(ssh_session session,
+ const char *username,
+ ssh_key pubkey)
+@@ -858,7 +857,6 @@ int ssh_userauth_agent(ssh_session session,
+ session->agent_state = NULL;
+ return rc;
+ }
+-#endif
+
+ enum ssh_auth_auto_state_e {
+ SSH_AUTH_AUTO_STATE_NONE=0,
+@@ -931,13 +929,11 @@ int ssh_userauth_publickey_auto(ssh_session session,
+ }
+ state = session->auth_auto_state;
+ if (state->state == SSH_AUTH_AUTO_STATE_NONE) {
+-#ifndef _WIN32
+ /* Try authentication with ssh-agent first */
+ rc = ssh_userauth_agent(session, username);
+ if (rc == SSH_AUTH_SUCCESS || rc == SSH_AUTH_AGAIN) {
+ return rc;
+ }
+-#endif
+ state->state = SSH_AUTH_AUTO_STATE_PUBKEY;
+ }
+ if (state->it == NULL) {
+@@ -1184,7 +1180,6 @@ fail:
+ return SSH_AUTH_ERROR;
+ }
+
+-#ifndef _WIN32
+ /* LEGACY */
+ int ssh_userauth_agent_pubkey(ssh_session session,
+ const char *username,
+@@ -1212,7 +1207,6 @@ int ssh_userauth_agent_pubkey(ssh_session session,
+
+ return rc;
+ }
+-#endif /* _WIN32 */
+
+ ssh_kbdint ssh_kbdint_new(void) {
+ ssh_kbdint kbd;
+diff --git a/src/pki.c b/src/pki.c
+index 49e10b6..b75e256 100644
+--- a/src/pki.c
++++ b/src/pki.c
+@@ -1527,7 +1527,6 @@ ssh_string ssh_pki_do_sign(ssh_session session,
+ return sig_blob;
+ }
+
+-#ifndef _WIN32
+ ssh_string ssh_pki_do_sign_agent(ssh_session session,
+ struct ssh_buffer_struct *buf,
+ const ssh_key pubkey) {
+@@ -1577,7 +1576,6 @@ ssh_string ssh_pki_do_sign_agent(ssh_session session,
+
+ return sig_blob;
+ }
+-#endif /* _WIN32 */
+
+ #ifdef WITH_SERVER
+ ssh_string ssh_srv_pki_do_sign_sessionid(ssh_session session,
+diff --git a/src/session.c b/src/session.c
+index f6d926a..f29867a 100644
+--- a/src/session.c
++++ b/src/session.c
+@@ -91,12 +91,10 @@ ssh_session ssh_new(void) {
+ ssh_set_blocking(session, 1);
+ session->maxchannel = FIRST_CHANNEL;
+
+-#ifndef _WIN32
+ session->agent = agent_new(session);
+ if (session->agent == NULL) {
+ goto err;
+ }
+-#endif /* _WIN32 */
+
+ /* OPTIONS */
+ session->opts.StrictHostKeyChecking = 1;
+@@ -230,9 +228,7 @@ void ssh_free(ssh_session session) {
+ crypto_free(session->current_crypto);
+ crypto_free(session->next_crypto);
+
+-#ifndef _WIN32
+ agent_free(session->agent);
+-#endif /* _WIN32 */
+
+ ssh_key_free(session->srv.dsa_key);
+ session->srv.dsa_key = NULL;
+diff --git a/src/winpgntc.c b/src/winpgntc.c
+new file mode 100644
+index 0000000..756ba79
+--- /dev/null
++++ b/src/winpgntc.c
+@@ -0,0 +1,107 @@
++/*
++ * winpgntc.c - interact with pageant on windows
++ *
++ * This file is part of the SSH Library
++ *
++ * Copyright (c) 2012 Patrick Spendrin <ps_ml at gmx.de>
++ *
++ * The SSH Library is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License as published by
++ * the Free Software Foundation; either version 2.1 of the License, or (at your
++ * option) any later version.
++ *
++ * The SSH Library is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
++ * License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * along with the SSH Library; see the file COPYING. If not, write to
++ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
++ * MA 02111-1307, USA.
++ */
++
++/* This file is based on the winpgntc.c from Putty sources:
++ PuTTY is copyright 1997-2012 Simon Tatham.
++
++ Portions copyright Robert de Bath, Joris van Rantwijk, Delian Delchev,
++ Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, Justin
++ Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus Kuhn, Colin
++ Watson, and CORE SDI S.A.
++
++ Permission is hereby granted, free of charge, to any person obtaining a
++ copy of this software and associated documentation files (the "Software"),
++ to deal in the Software without restriction, including without limitation
++ the rights to use, copy, modify, merge, publish, distribute, sublicense,
++ and/or sell copies of the Software, and to permit persons to whom the
++ Software is furnished to do so, subject to the following conditions:
++
++ The above copyright notice and this permission notice shall be included in
++ all copies or substantial portions of the Software.
++
++ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
++ SIMON TATHAM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
++ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
++ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
++
++#include <stdio.h>
++#include <stdlib.h>
++
++#include "libssh/agent.h"
++
++#define AGENT_COPYDATA_ID 0x804e50ba /* random goop */
++#define AGENT_MAX_MSGLEN 8192
++
++#define GET_32BIT(cp) \
++ (((unsigned long)(unsigned char)(cp)[0] << 24) | \
++ ((unsigned long)(unsigned char)(cp)[1] << 16) | \
++ ((unsigned long)(unsigned char)(cp)[2] << 8) | \
++ ((unsigned long)(unsigned char)(cp)[3]))
++
++int agent_query(void *in, int inlen, void **out, int *outlen)
++{
++ HWND hwnd;
++ char mapname[25];
++ HANDLE filemap;
++ unsigned char *p, *ret;
++ int id, retlen;
++ COPYDATASTRUCT cds;
++
++ *out = NULL;
++ *outlen = 0;
++
++ hwnd = FindWindow("Pageant", "Pageant");
++ if (!hwnd)
++ return 1; /* *out == NULL, so failure */
++ sprintf(mapname, "PageantRequest%08x", (unsigned)GetCurrentThreadId());
++ filemap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE,
++ 0, AGENT_MAX_MSGLEN, mapname);
++ if (filemap == NULL || filemap == INVALID_HANDLE_VALUE)
++ return 1; /* *out == NULL, so failure */
++ p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, 0);
++ memcpy(p, in, inlen);
++ cds.dwData = AGENT_COPYDATA_ID;
++ cds.cbData = 1 + strlen(mapname);
++ cds.lpData = mapname;
++
++ /*
++ * The user either passed a null callback (indicating that the
++ * query is required to be synchronous) or CreateThread failed.
++ * Either way, we need a synchronous request.
++ */
++ id = SendMessage(hwnd, WM_COPYDATA, (WPARAM) NULL, (LPARAM) &cds);
++ if (id > 0) {
++ retlen = 4 + GET_32BIT(p);
++ ret = (unsigned char *)malloc(retlen*sizeof(unsigned char));
++ if (ret) {
++ memcpy(ret, p, retlen);
++ *out = ret;
++ *outlen = retlen;
++ }
++ }
++ UnmapViewOfFile(p);
++ CloseHandle(filemap);
++ return 1;
++}
+diff --git a/src/winpgntc.h b/src/winpgntc.h
+new file mode 100644
+index 0000000..195a482
+--- /dev/null
++++ b/src/winpgntc.h
+@@ -0,0 +1,34 @@
++/*
++ * winpgntc.h - interact with pageant on windows
++ *
++ * This file is part of the SSH Library
++ *
++ * Copyright (c) 2012 Patrick Spendrin <ps_ml at gmx.de>
++ *
++ * The SSH Library is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License as published by
++ * the Free Software Foundation; either version 2.1 of the License, or (at your
++ * option) any later version.
++ *
++ * The SSH Library is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
++ * License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * along with the SSH Library; see the file COPYING. If not, write to
++ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
++ * MA 02111-1307, USA.
++ */
++
++
++#ifndef __WINPGNTC_H
++#define __WINPGNTC_H
++
++#ifdef _WIN32
++#include "libssh/agent.h"
++
++int agent_query(void *in, int inlen, void **out, int *outlen);
++
++#endif
++#endif /* __WINPGNTC_H */
+--
+2.8.3
+
diff --git a/libssh/0.7.4-x2go1-mingw482_src/CMake-Show-My-Changes.txt b/libssh/0.7.4-x2go1-mingw482_src/CMake-Show-My-Changes.txt
new file mode 100755
index 0000000..ef43695
--- /dev/null
+++ b/libssh/0.7.4-x2go1-mingw482_src/CMake-Show-My-Changes.txt
@@ -0,0 +1,13 @@
+Commandline options:
+-DCMAKE_C_COMPILER:FILEPATH="C:/i686-4.8.2-release-posix-dwarf-rt_v3-rev3/bin/gcc.exe" -DZLIB_LIBRARY_RELEASE:FILEPATH="C:/x2gobuilds/libssh_depends/zlib128-dll/zlib1.dll" -DWITH_GSSAPI:BOOL="0" -DWITH_NACL:BOOL="0" -DCMAKE_BUILD_TYPE:STRING="Release" -DCMAKE_MAKE_PROGRAM:FILEPATH="C:/i686-4.8.2-release-posix-dwarf-rt_v3-rev3/mingw32/bin/mingw32-make.exe" -DWITH_EXAMPLES:BOOL="0" -DZLIB_INCLUDE_DIR:PATH="C:/x2gobuilds/depends/zlib128-dll/include"
+
+
+Cache file:
+CMAKE_C_COMPILER:FILEPATH=C:/i686-4.8.2-release-posix-dwarf-rt_v3-rev3/bin/gcc.exe
+ZLIB_LIBRARY_RELEASE:FILEPATH=C:/x2gobuilds/libssh_depends/zlib128-dll/zlib1.dll
+WITH_GSSAPI:BOOL=0
+WITH_NACL:BOOL=0
+CMAKE_BUILD_TYPE:STRING=Release
+CMAKE_MAKE_PROGRAM:FILEPATH=C:/i686-4.8.2-release-posix-dwarf-rt_v3-rev3/mingw32/bin/mingw32-make.exe
+WITH_EXAMPLES:BOOL=0
+ZLIB_INCLUDE_DIR:PATH=C:/x2gobuilds/depends/zlib128-dll/include
diff --git a/libssh/0.7.4-x2go1-mingw482_src/libssh-0.7.4.tar.xz b/libssh/0.7.4-x2go1-mingw482_src/libssh-0.7.4.tar.xz
new file mode 100755
index 0000000..200a4ee
Binary files /dev/null and b/libssh/0.7.4-x2go1-mingw482_src/libssh-0.7.4.tar.xz differ
--
Alioth's /srv/git/code.x2go.org/x2goclient-contrib.git//..//_hooks_/post-receive-email on /srv/git/code.x2go.org/x2goclient-contrib.git
More information about the x2go-commits
mailing list