1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 21:21:31 +00:00

Update libssh2 to 1.11.1

This commit is contained in:
dmiller
2025-04-14 17:20:50 +00:00
parent 58ef6f6dac
commit 2bc341de52
118 changed files with 11071 additions and 4234 deletions

View File

@@ -1,6 +1,6 @@
/* Copyright (c) 2004-2009, Sara Golemon <sarag@libssh2.org>
* Copyright (c) 2009-2021 Daniel Stenberg
* Copyright (c) 2010 Simon Josefsson <simon@josefsson.org>
/* Copyright (C) Sara Golemon <sarag@libssh2.org>
* Copyright (C) Daniel Stenberg
* Copyright (C) Simon Josefsson <simon@josefsson.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms,
@@ -35,24 +35,26 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef LIBSSH2_H
#define LIBSSH2_H 1
#define LIBSSH2_COPYRIGHT "2004-2023 The libssh2 project and its contributors."
#define LIBSSH2_COPYRIGHT "The libssh2 project and its contributors."
/* We use underscore instead of dash when appending DEV in dev versions just
to make the BANNER define (used by src/session.c) be a valid SSH
banner. Release versions have no appended strings and may of course not
have dashes either. */
#define LIBSSH2_VERSION "1.11.0"
#define LIBSSH2_VERSION "1.11.1"
/* The numeric version number is also available "in parts" by using these
defines: */
#define LIBSSH2_VERSION_MAJOR 1
#define LIBSSH2_VERSION_MINOR 11
#define LIBSSH2_VERSION_PATCH 0
#define LIBSSH2_VERSION_PATCH 1
/* This is the numeric version of the libssh2 version number, meant for easier
parsing and comparisons by programs. The LIBSSH2_VERSION_NUM define will
@@ -69,7 +71,7 @@
and it is always a greater number in a more recent release. It makes
comparisons with greater than and less than work.
*/
#define LIBSSH2_VERSION_NUM 0x010b00
#define LIBSSH2_VERSION_NUM 0x010b01
/*
* This is the date and time when the full source package was created. The
@@ -80,7 +82,7 @@
*
* "Mon Feb 12 11:35:33 UTC 2007"
*/
#define LIBSSH2_TIMESTAMP "Tue May 30 03:58:58 PM UTC 2023"
#define LIBSSH2_TIMESTAMP "Wed Oct 16 08:03:21 UTC 2024"
#ifndef RC_INVOKED
@@ -88,11 +90,7 @@
extern "C" {
#endif
#if defined(_WIN32) || defined(WIN32)
#define LIBSSH2_WIN32
#endif
#ifdef LIBSSH2_WIN32
#ifdef _WIN32
# include <basetsd.h>
# include <winsock2.h>
#endif
@@ -104,8 +102,8 @@ extern "C" {
/* Allow alternate API prefix from CFLAGS or calling app */
#ifndef LIBSSH2_API
# ifdef LIBSSH2_WIN32
# if defined(LIBSSH2_EXPORTS) || defined(DLL_EXPORT) || defined(_WINDLL)
# ifdef _WIN32
# if defined(LIBSSH2_EXPORTS) || defined(_WINDLL)
# ifdef LIBSSH2_LIBRARY
# define LIBSSH2_API __declspec(dllexport)
# else
@@ -114,9 +112,9 @@ extern "C" {
# else
# define LIBSSH2_API
# endif
# else /* !LIBSSH2_WIN32 */
# else /* !_WIN32 */
# define LIBSSH2_API
# endif /* LIBSSH2_WIN32 */
# endif /* _WIN32 */
#endif /* LIBSSH2_API */
#ifdef HAVE_SYS_UIO_H
@@ -142,13 +140,44 @@ typedef unsigned long long libssh2_uint64_t;
typedef long long libssh2_int64_t;
#endif
#ifdef LIBSSH2_WIN32
#ifdef _WIN32
typedef SOCKET libssh2_socket_t;
#define LIBSSH2_INVALID_SOCKET INVALID_SOCKET
#else /* !LIBSSH2_WIN32 */
#define LIBSSH2_SOCKET_CLOSE(s) closesocket(s)
#else /* !_WIN32 */
typedef int libssh2_socket_t;
#define LIBSSH2_INVALID_SOCKET -1
#endif /* LIBSSH2_WIN32 */
#define LIBSSH2_SOCKET_CLOSE(s) close(s)
#endif /* _WIN32 */
/* Compile-time deprecation macros */
#if !defined(LIBSSH2_DISABLE_DEPRECATION) && !defined(LIBSSH2_LIBRARY)
# if defined(_MSC_VER)
# if _MSC_VER >= 1400
# define LIBSSH2_DEPRECATED(version, message) \
__declspec(deprecated("since libssh2 " # version ". " message))
# elif _MSC_VER >= 1310
# define LIBSSH2_DEPRECATED(version, message) \
__declspec(deprecated)
# endif
# elif defined(__GNUC__) && !defined(__INTEL_COMPILER)
# if (defined(__clang__) && __clang_major__ >= 3) || \
(__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
# define LIBSSH2_DEPRECATED(version, message) \
__attribute__((deprecated("since libssh2 " # version ". " message)))
# elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
# define LIBSSH2_DEPRECATED(version, message) \
__attribute__((deprecated))
# endif
# elif defined(__SUNPRO_C) && __SUNPRO_C >= 0x5130
# define LIBSSH2_DEPRECATED(version, message) \
__attribute__((deprecated))
# endif
#endif
#ifndef LIBSSH2_DEPRECATED
#define LIBSSH2_DEPRECATED(version, message)
#endif
/*
* Determine whether there is small or large file support on windows.
@@ -174,7 +203,7 @@ typedef int libssh2_socket_t;
# undef LIBSSH2_USE_WIN32_LARGE_FILES
#endif
#if defined(LIBSSH2_WIN32) && !defined(LIBSSH2_USE_WIN32_LARGE_FILES) && \
#if defined(_WIN32) && !defined(LIBSSH2_USE_WIN32_LARGE_FILES) && \
!defined(LIBSSH2_USE_WIN32_SMALL_FILES)
# define LIBSSH2_USE_WIN32_SMALL_FILES
#endif
@@ -263,7 +292,7 @@ typedef struct _LIBSSH2_USERAUTH_KBDINT_PROMPT
typedef struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE
{
char *text;
unsigned int length;
unsigned int length; /* FIXME: change type to size_t */
} LIBSSH2_USERAUTH_KBDINT_RESPONSE;
typedef struct _LIBSSH2_SK_SIG_INFO {
@@ -281,6 +310,7 @@ typedef struct _LIBSSH2_SK_SIG_INFO {
const unsigned char *data, size_t data_len, void **abstract)
/* 'keyboard-interactive' authentication callback */
/* FIXME: name_len, instruction_len -> size_t, num_prompts -> unsigned int? */
#define LIBSSH2_USERAUTH_KBDINT_RESPONSE_FUNC(name_) \
void name_(const char *name, int name_len, const char *instruction, \
int instruction_len, int num_prompts, \
@@ -300,6 +330,8 @@ typedef struct _LIBSSH2_SK_SIG_INFO {
#define LIBSSH2_SK_PRESENCE_REQUIRED 0x01
#define LIBSSH2_SK_VERIFICATION_REQUIRED 0x04
/* FIXME: update lengths to size_t (or ssize_t): */
/* Callbacks for special SSH packets */
#define LIBSSH2_IGNORE_FUNC(name) \
void name(LIBSSH2_SESSION *session, const char *message, int message_len, \
@@ -470,7 +502,7 @@ typedef struct _LIBSSH2_POLLFD {
/* Hostkey Types */
#define LIBSSH2_HOSTKEY_TYPE_UNKNOWN 0
#define LIBSSH2_HOSTKEY_TYPE_RSA 1
#define LIBSSH2_HOSTKEY_TYPE_DSS 2
#define LIBSSH2_HOSTKEY_TYPE_DSS 2 /* deprecated */
#define LIBSSH2_HOSTKEY_TYPE_ECDSA_256 3
#define LIBSSH2_HOSTKEY_TYPE_ECDSA_384 4
#define LIBSSH2_HOSTKEY_TYPE_ECDSA_521 5
@@ -555,6 +587,9 @@ typedef struct _LIBSSH2_POLLFD {
#define LIBSSH2_ERROR_RANDGEN -49
#define LIBSSH2_ERROR_MISSING_USERAUTH_BANNER -50
#define LIBSSH2_ERROR_ALGO_UNSUPPORTED -51
#define LIBSSH2_ERROR_MAC_FAILURE -52
#define LIBSSH2_ERROR_HASH_INIT -53
#define LIBSSH2_ERROR_HASH_CALC -54
/* this is a define to provide the old (<= 1.2.7) name */
#define LIBSSH2_ERROR_BANNER_NONE LIBSSH2_ERROR_BANNER_RECV
@@ -615,14 +650,25 @@ libssh2_session_init_ex(LIBSSH2_ALLOC_FUNC((*my_alloc)),
LIBSSH2_API void **libssh2_session_abstract(LIBSSH2_SESSION *session);
typedef void (libssh2_cb_generic)(void);
LIBSSH2_API libssh2_cb_generic *
libssh2_session_callback_set2(LIBSSH2_SESSION *session, int cbtype,
libssh2_cb_generic *callback);
LIBSSH2_DEPRECATED(1.11.1, "Use libssh2_session_callback_set2()")
LIBSSH2_API void *libssh2_session_callback_set(LIBSSH2_SESSION *session,
int cbtype, void *callback);
LIBSSH2_API int libssh2_session_banner_set(LIBSSH2_SESSION *session,
const char *banner);
#ifndef LIBSSH2_NO_DEPRECATED
LIBSSH2_DEPRECATED(1.4.0, "Use libssh2_session_banner_set()")
LIBSSH2_API int libssh2_banner_set(LIBSSH2_SESSION *session,
const char *banner);
LIBSSH2_DEPRECATED(1.2.8, "Use libssh2_session_handshake()")
LIBSSH2_API int libssh2_session_startup(LIBSSH2_SESSION *session, int sock);
#endif
LIBSSH2_API int libssh2_session_handshake(LIBSSH2_SESSION *session,
libssh2_socket_t sock);
LIBSSH2_API int libssh2_session_disconnect_ex(LIBSSH2_SESSION *session,
@@ -909,12 +955,13 @@ libssh2_channel_window_read_ex(LIBSSH2_CHANNEL *channel,
#define libssh2_channel_window_read(channel) \
libssh2_channel_window_read_ex((channel), NULL, NULL)
/* libssh2_channel_receive_window_adjust() is DEPRECATED, do not use! */
#ifndef LIBSSH2_NO_DEPRECATED
LIBSSH2_DEPRECATED(1.1.0, "Use libssh2_channel_receive_window_adjust2()")
LIBSSH2_API unsigned long
libssh2_channel_receive_window_adjust(LIBSSH2_CHANNEL *channel,
unsigned long adjustment,
unsigned char force);
#endif
LIBSSH2_API int
libssh2_channel_receive_window_adjust2(LIBSSH2_CHANNEL *channel,
unsigned long adjustment,
@@ -953,12 +1000,15 @@ LIBSSH2_API void libssh2_session_set_read_timeout(LIBSSH2_SESSION* session,
long timeout);
LIBSSH2_API long libssh2_session_get_read_timeout(LIBSSH2_SESSION* session);
/* libssh2_channel_handle_extended_data() is DEPRECATED, do not use! */
#ifndef LIBSSH2_NO_DEPRECATED
LIBSSH2_DEPRECATED(1.1.0, "libssh2_channel_handle_extended_data2()")
LIBSSH2_API void libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel,
int ignore_mode);
#endif
LIBSSH2_API int libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel,
int ignore_mode);
#ifndef LIBSSH2_NO_DEPRECATED
/* libssh2_channel_ignore_extended_data() is defined below for BC with version
* 0.1
*
@@ -966,11 +1016,12 @@ LIBSSH2_API int libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel,
* LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE is passed, extended data will be read
* (FIFO) from the standard data channel
*/
/* DEPRECATED */
/* DEPRECATED since 0.3.0. Use libssh2_channel_handle_extended_data2(). */
#define libssh2_channel_ignore_extended_data(channel, ignore) \
libssh2_channel_handle_extended_data((channel), (ignore) ? \
LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE : \
LIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL)
#endif
#define LIBSSH2_CHANNEL_FLUSH_EXTENDED_DATA -1
#define LIBSSH2_CHANNEL_FLUSH_ALL -2
@@ -995,10 +1046,12 @@ LIBSSH2_API int libssh2_channel_close(LIBSSH2_CHANNEL *channel);
LIBSSH2_API int libssh2_channel_wait_closed(LIBSSH2_CHANNEL *channel);
LIBSSH2_API int libssh2_channel_free(LIBSSH2_CHANNEL *channel);
/* libssh2_scp_recv is DEPRECATED, do not use! */
#ifndef LIBSSH2_NO_DEPRECATED
LIBSSH2_DEPRECATED(1.7.0, "Use libssh2_scp_recv2()")
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv(LIBSSH2_SESSION *session,
const char *path,
struct stat *sb);
#endif
/* Use libssh2_scp_recv2() for large (> 2GB) file support on windows */
LIBSSH2_API LIBSSH2_CHANNEL *libssh2_scp_recv2(LIBSSH2_SESSION *session,
const char *path,
@@ -1094,7 +1147,7 @@ libssh2_knownhost_init(LIBSSH2_SESSION *session);
#define LIBSSH2_KNOWNHOST_KEY_SHIFT 18
#define LIBSSH2_KNOWNHOST_KEY_RSA1 (1<<18)
#define LIBSSH2_KNOWNHOST_KEY_SSHRSA (2<<18)
#define LIBSSH2_KNOWNHOST_KEY_SSHDSS (3<<18)
#define LIBSSH2_KNOWNHOST_KEY_SSHDSS (3<<18) /* deprecated */
#define LIBSSH2_KNOWNHOST_KEY_ECDSA_256 (4<<18)
#define LIBSSH2_KNOWNHOST_KEY_ECDSA_384 (5<<18)
#define LIBSSH2_KNOWNHOST_KEY_ECDSA_521 (6<<18)
@@ -1418,7 +1471,7 @@ libssh2_agent_get_identity_path(LIBSSH2_AGENT *agent);
*/
LIBSSH2_API void libssh2_keepalive_config(LIBSSH2_SESSION *session,
int want_reply,
unsigned interval);
unsigned int interval);
/*
* libssh2_keepalive_send()