Import Upstream version 1.11.0

This commit is contained in:
luoyaoming 2024-05-07 13:49:03 +08:00
parent 257812c4b9
commit ec3e64f48f
464 changed files with 33303 additions and 22655 deletions

View File

@ -1,4 +1,5 @@
# Copyright (c) 2014, 2015 Alexander Lamaison <alexander.lamaison@gmail.com>
# Copyright (c) 2014, 2015 Alexander Lamaison <alexander.lamaison@gmail.com>
# Copyright (c) 2023 Viktor Szakats
#
# Redistribution and use in source and binary forms,
# with or without modification, are permitted provided
@ -33,23 +34,32 @@
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
# OF SUCH DAMAGE.
cmake_minimum_required(VERSION 2.8.11)
include(CheckFunctionExists)
include(CheckSymbolExists)
include(CheckIncludeFiles)
include(CheckSymbolExists)
include(CMakePushCheckState)
include(FeatureSummary)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}")
include(CheckFunctionExistsMayNeedLibrary)
include(CheckNonblockingSocketSupport)
cmake_minimum_required(VERSION 3.1)
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
project(libssh2 C)
set(PROJECT_URL "https://www.libssh2.org/")
set(PROJECT_DESCRIPTION "The SSH library")
if (CMAKE_VERSION VERSION_LESS "3.1")
if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
set (CMAKE_C_FLAGS "--std=gnu90 ${CMAKE_C_FLAGS}")
endif()
else()
set (CMAKE_C_STANDARD 90)
endif()
set(CMAKE_UNITY_BUILD_BATCH_SIZE 32)
option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
option(BUILD_STATIC_LIBS "Build Static Libraries" ON)
add_feature_info("Static library" BUILD_STATIC_LIBS
"creating libssh2 static library")
option(BUILD_SHARED_LIBS "Build Shared Libraries" ON)
add_feature_info("Shared library" BUILD_SHARED_LIBS
"creating libssh2 shared library (.so/.dll)")
# Parse version
@ -79,20 +89,359 @@ endif()
include(GNUInstallDirs)
install(
FILES docs/AUTHORS COPYING docs/HACKING README RELEASE-NOTES NEWS
FILES
COPYING NEWS README RELEASE-NOTES
docs/AUTHORS docs/BINDINGS.md docs/HACKING.md
DESTINATION ${CMAKE_INSTALL_DOCDIR})
include(max_warnings)
include(FeatureSummary)
# Add socket libraries
if(WIN32)
list(APPEND SOCKET_LIBRARIES ws2_32)
else()
check_function_exists_may_need_library(socket HAVE_SOCKET socket)
if(NEED_LIB_SOCKET)
list(APPEND SOCKET_LIBRARIES socket)
endif()
check_function_exists_may_need_library(inet_addr HAVE_INET_ADDR nsl)
if(NEED_LIB_NSL)
list(APPEND SOCKET_LIBRARIES nsl)
endif()
endif()
option(BUILD_EXAMPLES "Build libssh2 examples" ON)
option(BUILD_TESTING "Build libssh2 test suite" ON)
if(NOT BUILD_STATIC_LIBS AND NOT BUILD_SHARED_LIBS)
set(BUILD_STATIC_LIBS ON)
endif()
set(LIB_STATIC "libssh2_static")
set(LIB_SHARED "libssh2_shared")
# lib flavour selected for example and test programs.
if(BUILD_SHARED_LIBS)
set(LIB_SELECTED ${LIB_SHARED})
else()
set(LIB_SELECTED ${LIB_STATIC})
endif()
# Symbol hiding
option(HIDE_SYMBOLS "Set to ON to hide all libssh2 symbols that are not officially external" ON)
mark_as_advanced(HIDE_SYMBOLS)
if(HIDE_SYMBOLS)
set(LIB_SHARED_DEFINITIONS LIBSSH2_EXPORTS)
if(WIN32)
elseif((CMAKE_C_COMPILER_ID MATCHES "Clang") OR
(CMAKE_COMPILER_IS_GNUCC AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.0) OR
(CMAKE_C_COMPILER_ID MATCHES "Intel" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.1))
set(LIB_SHARED_C_FLAGS -fvisibility=hidden)
set(LIBSSH2_API "__attribute__ ((__visibility__ (\"default\")))")
elseif(CMAKE_C_COMPILER_ID MATCHES "SunPro" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0)
set(LIB_SHARED_C_FLAGS -xldscope=hidden)
set(LIBSSH2_API "__global")
endif()
endif()
# Options
# Enable debugging logging by default if the user configured a debug build
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(DEBUG_LOGGING_DEFAULT ON)
else()
set(DEBUG_LOGGING_DEFAULT OFF)
endif()
option(ENABLE_DEBUG_LOGGING "log execution with debug trace"
${DEBUG_LOGGING_DEFAULT})
add_feature_info(Logging ENABLE_DEBUG_LOGGING
"Logging of execution with debug trace")
if(ENABLE_DEBUG_LOGGING)
# Must be visible to the library and tests using internals
add_definitions(-DLIBSSH2DEBUG)
endif()
# Auto-detection
# Prefill values with known detection results
# Keep this synced with src/libssh2_setup.h
if(WIN32)
if(MINGW)
set(HAVE_SNPRINTF 1)
set(HAVE_UNISTD_H 1)
set(HAVE_INTTYPES_H 1)
set(HAVE_SYS_TIME_H 1)
set(HAVE_SYS_PARAM_H 1)
set(HAVE_GETTIMEOFDAY 1)
set(HAVE_STRTOLL 1)
elseif(MSVC)
set(HAVE_GETTIMEOFDAY 0)
if(NOT MSVC_VERSION LESS 1800)
set(HAVE_INTTYPES_H 1)
set(HAVE_STRTOLL 1)
else()
set(HAVE_INTTYPES_H 0)
set(HAVE_STRTOI64 1)
endif()
if(NOT MSVC_VERSION LESS 1900)
set(HAVE_SNPRINTF 1)
endif()
endif()
endif()
## Platform checks
check_include_files(inttypes.h HAVE_INTTYPES_H)
if(NOT MSVC)
check_include_files(unistd.h HAVE_UNISTD_H)
check_include_files(sys/time.h HAVE_SYS_TIME_H)
check_include_files(sys/param.h HAVE_SYS_PARAM_H) # tests
endif()
if(NOT WIN32)
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
check_include_files(sys/uio.h HAVE_SYS_UIO_H)
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
check_include_files(sys/ioctl.h HAVE_SYS_IOCTL_H)
check_include_files(sys/un.h HAVE_SYS_UN_H)
check_include_files(arpa/inet.h HAVE_ARPA_INET_H) # example and tests
check_include_files(netinet/in.h HAVE_NETINET_IN_H) # example and tests
endif()
# CMake uses C syntax in check_symbol_exists() that generates a warning with
# MSVC. To not break detection with ENABLE_WERRROR, we disable it for the
# duration of these tests.
if(MSVC AND ENABLE_WERROR)
cmake_push_check_state()
set(CMAKE_REQUIRED_FLAGS "/WX-")
endif()
if(HAVE_SYS_TIME_H)
check_symbol_exists(gettimeofday sys/time.h HAVE_GETTIMEOFDAY)
else()
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
endif()
check_symbol_exists(strtoll stdlib.h HAVE_STRTOLL)
if(NOT HAVE_STRTOLL)
# Try _strtoi64() if strtoll() is not available
check_symbol_exists(_strtoi64 stdlib.h HAVE_STRTOI64)
endif()
check_symbol_exists(snprintf stdio.h HAVE_SNPRINTF)
if(NOT WIN32)
check_symbol_exists(explicit_bzero string.h HAVE_EXPLICIT_BZERO)
check_symbol_exists(explicit_memset string.h HAVE_EXPLICIT_MEMSET)
check_symbol_exists(memset_s string.h HAVE_MEMSET_S)
endif()
if(MSVC AND ENABLE_WERROR)
cmake_pop_check_state()
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin" OR
${CMAKE_SYSTEM_NAME} STREQUAL "Interix")
# poll() does not work on these platforms
#
# Interix: "does provide poll(), but the implementing developer must
# have been in a bad mood, because poll() only works on the /proc
# filesystem here"
#
# macOS poll() has funny behaviors, like:
# not being able to do poll on no filedescriptors (10.3?)
# not being able to poll on some files (like anything in /dev)
# not having reliable timeout support
# inconsistent return of POLLHUP where other implementations give POLLIN
message("poll use is disabled on this platform")
elseif(NOT WIN32)
check_function_exists(poll HAVE_POLL)
endif()
if(WIN32)
set(HAVE_SELECT 1)
else()
check_function_exists(select HAVE_SELECT)
endif()
# Non-blocking socket support tests. Use a separate, yet unset variable
# for the socket libraries to not link against the other configured
# dependencies which might not have been built yet.
if(NOT WIN32)
cmake_push_check_state()
set(CMAKE_REQUIRED_LIBRARIES ${SOCKET_LIBRARIES})
check_nonblocking_socket_support()
cmake_pop_check_state()
endif()
# Config file
add_definitions(-DHAVE_CONFIG_H)
configure_file(src/libssh2_config_cmake.h.in
${CMAKE_CURRENT_BINARY_DIR}/src/libssh2_config.h)
## Cryptography backend choice
set(CRYPTO_BACKEND
""
CACHE
STRING
"The backend to use for cryptography: OpenSSL, wolfSSL, Libgcrypt,
WinCNG, mbedTLS, or empty to try any available")
# If the crypto backend was given, rather than searching for the first
# we are able to find, the find_package commands must abort configuration
# and report to the user.
if(CRYPTO_BACKEND)
set(SPECIFIC_CRYPTO_REQUIREMENT REQUIRED)
endif()
if(CRYPTO_BACKEND STREQUAL "OpenSSL" OR NOT CRYPTO_BACKEND)
find_package(OpenSSL ${SPECIFIC_CRYPTO_REQUIREMENT})
if(OPENSSL_FOUND)
set(CRYPTO_BACKEND "OpenSSL")
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_OPENSSL")
set(CRYPTO_BACKEND_INCLUDE_DIR ${OPENSSL_INCLUDE_DIR})
list(APPEND LIBRARIES ${OPENSSL_LIBRARIES})
list(APPEND PC_REQUIRES_PRIVATE libssl libcrypto)
if(WIN32)
# Statically linking to OpenSSL requires crypt32 for some Windows APIs.
# This should really be handled by FindOpenSSL.cmake.
list(APPEND LIBRARIES crypt32 bcrypt)
list(APPEND PC_LIBS -lcrypt32 -lbcrypt)
#set(CMAKE_FIND_DEBUG_MODE TRUE)
find_file(DLL_LIBCRYPTO
NAMES crypto.dll
libcrypto-1_1.dll libcrypto-1_1-x64.dll
libcrypto-3.dll libcrypto-3-x64.dll
HINTS ${_OPENSSL_ROOT_HINTS} PATHS ${_OPENSSL_ROOT_PATHS}
PATH_SUFFIXES bin NO_DEFAULT_PATH)
if(DLL_LIBCRYPTO)
message(STATUS "Found libcrypto DLL: ${DLL_LIBCRYPTO}")
else()
message(WARNING
"Unable to find OpenSSL libcrypto DLL, executables may not run")
endif()
find_file(DLL_LIBSSL
NAMES ssl.dll
libssl-1_1.dll libssl-1_1-x64.dll
libssl-3.dll libssl-3-x64.dll
HINTS ${_OPENSSL_ROOT_HINTS} PATHS ${_OPENSSL_ROOT_PATHS}
PATH_SUFFIXES bin NO_DEFAULT_PATH)
if(DLL_LIBSSL)
message(STATUS "Found libssl DLL: ${DLL_LIBSSL}")
else()
message(WARNING
"Unable to find OpenSSL libssl DLL, executables may not run")
endif()
#set(CMAKE_FIND_DEBUG_MODE FALSE)
if(DLL_LIBCRYPTO AND DLL_LIBSSL)
list(APPEND _RUNTIME_DEPENDENCIES ${DLL_LIBCRYPTO} ${DLL_LIBSSL})
endif()
endif()
find_package(ZLIB)
if(ZLIB_FOUND)
list(APPEND LIBRARIES ${ZLIB_LIBRARIES})
list(APPEND PC_REQUIRES_PRIVATE zlib)
endif()
endif()
endif()
if(CRYPTO_BACKEND STREQUAL "wolfSSL" OR NOT CRYPTO_BACKEND)
find_package(wolfssl ${SPECIFIC_CRYPTO_REQUIREMENT})
if(WOLFSSL_FOUND)
set(CRYPTO_BACKEND "wolfSSL")
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_WOLFSSL")
set(CRYPTO_BACKEND_INCLUDE_DIR ${WOLFSSL_INCLUDE_DIR} ${WOLFSSL_INCLUDE_DIR}/wolfssl)
list(APPEND LIBRARIES ${WOLFSSL_LIBRARIES})
list(APPEND PC_LIBS -lwolfssl)
if(WIN32)
list(APPEND LIBRARIES crypt32)
list(APPEND PC_LIBS -lcrypt32)
endif()
find_package(ZLIB)
if(ZLIB_FOUND)
list(APPEND CRYPTO_BACKEND_INCLUDE_DIR ${ZLIB_INCLUDE_DIR}) # Public wolfSSL headers require zlib headers
list(APPEND LIBRARIES ${ZLIB_LIBRARIES})
list(APPEND PC_REQUIRES_PRIVATE zlib)
endif()
endif()
endif()
if(CRYPTO_BACKEND STREQUAL "Libgcrypt" OR NOT CRYPTO_BACKEND)
find_package(Libgcrypt ${SPECIFIC_CRYPTO_REQUIREMENT})
if(LIBGCRYPT_FOUND)
set(CRYPTO_BACKEND "Libgcrypt")
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_LIBGCRYPT")
set(CRYPTO_BACKEND_INCLUDE_DIR ${LIBGCRYPT_INCLUDE_DIRS})
list(APPEND LIBRARIES ${LIBGCRYPT_LIBRARIES})
list(APPEND PC_LIBS -lgcrypt)
endif()
endif()
if(CRYPTO_BACKEND STREQUAL "mbedTLS" OR NOT CRYPTO_BACKEND)
find_package(mbedTLS ${SPECIFIC_CRYPTO_REQUIREMENT})
if(MBEDTLS_FOUND)
set(CRYPTO_BACKEND "mbedTLS")
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_MBEDTLS")
set(CRYPTO_BACKEND_INCLUDE_DIR ${MBEDTLS_INCLUDE_DIR})
list(APPEND LIBRARIES ${MBEDTLS_LIBRARIES})
list(APPEND PC_LIBS -lmbedcrypto)
link_directories(${MBEDTLS_LIBRARY_DIR})
endif()
endif()
# Detect platform-specific crypto-backends last:
if(CRYPTO_BACKEND STREQUAL "WinCNG" OR NOT CRYPTO_BACKEND)
if(WIN32)
set(CRYPTO_BACKEND "WinCNG")
set(CRYPTO_BACKEND_DEFINE "LIBSSH2_WINCNG")
set(CRYPTO_BACKEND_INCLUDE_DIR "")
list(APPEND LIBRARIES crypt32 bcrypt)
list(APPEND PC_LIBS -lcrypt32 -lbcrypt)
elseif(${SPECIFIC_CRYPTO_REQUIREMENT} STREQUAL ${REQUIRED})
message(FATAL_ERROR "WinCNG not available")
endif()
endif()
# Global functions
# Convert GNU Make assignments into CMake ones.
function(transform_makefile_inc INPUT_FILE OUTPUT_FILE)
file(READ ${INPUT_FILE} MAKEFILE_INC_CMAKE)
string(REGEX REPLACE "\\\\\n" "" MAKEFILE_INC_CMAKE ${MAKEFILE_INC_CMAKE})
string(REGEX REPLACE "([A-Za-z_]+) *= *([^\n]*)" "set(\\1 \\2)" MAKEFILE_INC_CMAKE ${MAKEFILE_INC_CMAKE})
file(WRITE ${OUTPUT_FILE} ${MAKEFILE_INC_CMAKE})
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${INPUT_FILE}")
endfunction()
#
add_subdirectory(src)
option(BUILD_EXAMPLES "Build libssh2 examples" ON)
if(BUILD_EXAMPLES)
add_subdirectory(example)
endif()
option(BUILD_TESTING "Build libssh2 test suite" ON)
if(BUILD_TESTING)
enable_testing()
add_subdirectory(tests)
@ -103,7 +452,11 @@ if(LINT)
add_custom_target(lint ALL
./ci/checksrc.sh
WORKING_DIRECTORY ${libssh2_SOURCE_DIR})
add_dependencies(libssh2 lint)
if(BUILD_STATIC_LIBS)
add_dependencies(${LIB_STATIC} lint)
else()
add_dependencies(${LIB_SHARED} lint)
endif()
endif()
add_subdirectory(docs)

View File

@ -2,7 +2,7 @@
* Copyright (c) 2005,2006 Mikhail Gusarov <dottedmag@dottedmag.net>
* Copyright (c) 2006-2007 The Written Word, Inc.
* Copyright (c) 2007 Eli Fant <elifantu@mail.ru>
* Copyright (c) 2009-2021 Daniel Stenberg
* Copyright (c) 2009-2023 Daniel Stenberg
* Copyright (C) 2008, 2009 Simon Josefsson
* Copyright (c) 2000 Markus Friedl
* Copyright (c) 2015 Microsoft Corp.
@ -41,4 +41,3 @@
* USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
* OF SUCH DAMAGE.
*/

View File

@ -1,3 +0,0 @@
CRYPTO_CSOURCES = openssl.c
CRYPTO_HHEADERS = openssl.h
CRYPTO_LTLIBS = $(LTLIBSSL)

View File

@ -1,3 +0,0 @@
CRYPTO_CSOURCES = wincng.c
CRYPTO_HHEADERS = wincng.h
CRYPTO_LTLIBS = $(LTLIBBCRYPT) $(LTLIBCRYPT32)

View File

@ -1,6 +1,9 @@
AUTOMAKE_OPTIONS = foreign nostdinc
SUBDIRS = src tests docs
SUBDIRS = src docs
if ENABLE_TESTS
SUBDIRS += tests
endif
if BUILD_EXAMPLES
SUBDIRS += example
endif
@ -8,44 +11,34 @@ endif
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libssh2.pc
include_HEADERS = \
include/libssh2.h \
include/libssh2_publickey.h \
include/libssh2_sftp.h
include_HEADERS = \
include/libssh2.h \
include/libssh2_publickey.h \
include/libssh2_sftp.h
NETWAREFILES = nw/keepscreen.c \
nw/nwlib.c \
nw/GNUmakefile \
nw/test/GNUmakefile
DISTCLEANFILES =
DSP = win32/libssh2.dsp
VCPROJ = win32/libssh2.vcproj
VMSFILES = vms/libssh2_make_example.dcl vms/libssh2_make_help.dcl \
vms/libssh2_make_kit.dcl vms/libssh2_make_lib.dcl vms/man2help.c \
vms/readme.vms vms/libssh2_config.h
DISTCLEANFILES = $(DSP)
WIN32FILES = src/libssh2.rc NMakefile
VMSFILES = vms/libssh2_make_example.dcl vms/libssh2_make_help.dcl \
vms/libssh2_make_kit.dcl vms/libssh2_make_lib.dcl vms/man2help.c \
vms/readme.vms vms/libssh2_config.h
OS400FILES = os400/README400 os400/initscript.sh os400/make.sh \
os400/make-src.sh os400/make-rpg.sh os400/make-include.sh \
os400/os400sys.c os400/ccsid.c \
os400/libssh2_config.h os400/macros.h os400/libssh2_ccsid.h \
os400/include/alloca.h os400/include/sys/socket.h os400/include/stdio.h \
os400/include/assert.h \
os400/libssh2rpg/libssh2.rpgle.in \
os400/libssh2rpg/libssh2_ccsid.rpgle.in \
os400/libssh2rpg/libssh2_publickey.rpgle \
os400/libssh2rpg/libssh2_sftp.rpgle
WIN32FILES = win32/GNUmakefile win32/test/GNUmakefile \
win32/libssh2_config.h win32/config.mk win32/rules.mk \
win32/Makefile.Watcom win32/libssh2.dsw win32/tests.dsp $(DSP) \
win32/msvcproj.head win32/msvcproj.foot win32/libssh2.rc
OS400FILES = os400/README400 os400/initscript.sh os400/make.sh \
os400/make-src.sh os400/make-rpg.sh os400/make-include.sh \
os400/os400sys.c os400/ccsid.c \
os400/libssh2_config.h os400/macros.h os400/libssh2_ccsid.h \
os400/include/alloca.h os400/include/sys/socket.h os400/include/stdio.h \
os400/libssh2rpg/libssh2.rpgle.in \
os400/libssh2rpg/libssh2_ccsid.rpgle.in \
os400/libssh2rpg/libssh2_publickey.rpgle \
os400/libssh2rpg/libssh2_sftp.rpgle \
Makefile.os400qc3.inc
EXTRA_DIST = $(WIN32FILES) $(NETWAREFILES) get_ver.awk \
maketgz NMakefile RELEASE-NOTES libssh2.pc.in $(VMSFILES) config.rpath \
CMakeLists.txt cmake $(OS400FILES)
EXTRA_DIST = $(WIN32FILES) get_ver.awk \
maketgz RELEASE-NOTES libssh2.pc.in $(VMSFILES) config.rpath \
CMakeLists.txt cmake git2news.pl libssh2-style.el README.md $(OS400FILES) \
buildconf Makefile.mk
ACLOCAL_AMFLAGS = -I m4
@ -76,79 +69,21 @@ build-coverage:
make CFLAGS=$(COVERAGE_CCOPTS) check
mkdir -p $(COVERAGE_OUT)
lcov --directory . --output-file $(COVERAGE_OUT)/$(PACKAGE).info \
--capture
--capture
gen-coverage:
genhtml --output-directory $(COVERAGE_OUT) \
$(COVERAGE_OUT)/$(PACKAGE).info \
--highlight --frames --legend \
--title "$(PACKAGE_NAME)"
$(COVERAGE_OUT)/$(PACKAGE).info \
--highlight --frames --legend \
--title "$(PACKAGE_NAME)"
coverage: init-coverage build-coverage gen-coverage
# DSP/VCPROJ generation adapted from libcurl
# only OpenSSL and WinCNG are supported with this build system
CRYPTO_CSOURCES = openssl.c wincng.c mbedtls.c
CRYPTO_HHEADERS = openssl.h wincng.h mbedtls.h
# Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc
WIN32SOURCES = $(CSOURCES)
WIN32HEADERS = $(HHEADERS) libssh2_config.h
$(DSP): win32/msvcproj.head win32/msvcproj.foot Makefile.am
echo "creating $(DSP)"
@( (cat $(srcdir)/win32/msvcproj.head; \
echo "# Begin Group \"Source Files\""; \
echo ""; \
echo "# PROP Default_Filter \"cpp;c;cxx\""; \
win32_srcs='$(WIN32SOURCES)'; \
sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \
for file in $$sorted_srcs; do \
echo "# Begin Source File"; \
echo ""; \
echo "SOURCE=..\\src\\"$$file; \
echo "# End Source File"; \
done; \
echo "# End Group"; \
echo "# Begin Group \"Header Files\""; \
echo ""; \
echo "# PROP Default_Filter \"h;hpp;hxx\""; \
win32_hdrs='$(WIN32HEADERS)'; \
sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \
for file in $$sorted_hdrs; do \
echo "# Begin Source File"; \
echo ""; \
if [ "$$file" = "libssh2_config.h" ]; \
then \
echo "SOURCE=.\\"$$file; \
else \
echo "SOURCE=..\\src\\"$$file; \
fi; \
echo "# End Source File"; \
done; \
echo "# End Group"; \
cat $(srcdir)/win32/msvcproj.foot) | \
awk '{printf("%s\r\n", gensub("\r", "", "g"))}' > $@ )
$(VCPROJ): win32/vc8proj.head win32/vc8proj.foot Makefile.am
echo "creating $(VCPROJ)"
@( (cat $(srcdir)/vc8proj.head; \
win32_srcs='$(WIN32SOURCES)'; \
sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \
for file in $$sorted_srcs; do \
echo "<File RelativePath=\""..\src\$$file"\"></File>"; \
done; \
echo "</Filter><Filter Name=\"Header Files\">"; \
win32_hdrs='$(WIN32HEADERS)'; \
sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \
for file in $$sorted_hdrs; do \
echo "<File RelativePath=\""..\src\$$file"\"></File>"; \
done; \
cat $(srcdir)/vc8proj.foot) | \
awk '{printf("%s\r\n", gensub("\r", "", "g"))}' > $@ )
checksrc:
perl src/checksrc.pl -i4 -m79 -ASIZEOFNOPAREN -ASNPRINTF -ACOPYRIGHT \
-AFOPENMODE -Wsrc/libssh2_config.h src/*.[ch] include/*.h example/*.c \
tests/*.[ch]
perl ci/checksrc.pl -i4 -m79 \
-ASNPRINTF \
-ACOPYRIGHT \
-AFOPENMODE \
-ATYPEDEFSTRUCT \
-Wsrc/libssh2_config.h src/*.[ch] include/*.h example/*.c \
tests/*.[ch]

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
@ -89,7 +89,8 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
@BUILD_EXAMPLES_TRUE@am__append_1 = example
@ENABLE_TESTS_TRUE@am__append_1 = tests
@BUILD_EXAMPLES_TRUE@am__append_2 = example
subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/autobuild.m4 \
@ -191,11 +192,11 @@ am__define_uniq_tagged_files = \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
DIST_SUBDIRS = src tests docs example
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.inc \
$(srcdir)/libssh2.pc.in COPYING ChangeLog NEWS README compile \
config.guess config.rpath config.sub depcomp install-sh \
ltmain.sh missing
DIST_SUBDIRS = src docs tests example
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libssh2.pc.in \
COPYING ChangeLog NEWS README compile config.guess \
config.rpath config.sub depcomp install-sh ltmain.sh missing \
tap-driver.sh
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@ -274,12 +275,13 @@ EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GREP = @GREP@
HAVE_LIBBCRYPT = @HAVE_LIBBCRYPT@
HAVE_LIBCRYPT32 = @HAVE_LIBCRYPT32@
HAVE_LIBGCRYPT = @HAVE_LIBGCRYPT@
HAVE_LIBMBEDCRYPTO = @HAVE_LIBMBEDCRYPTO@
HAVE_LIBSSL = @HAVE_LIBSSL@
HAVE_LIBWOLFSSL = @HAVE_LIBWOLFSSL@
HAVE_LIBZ = @HAVE_LIBZ@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@ -290,8 +292,6 @@ LD = @LD@
LDFLAGS = @LDFLAGS@
LIBBCRYPT = @LIBBCRYPT@
LIBBCRYPT_PREFIX = @LIBBCRYPT_PREFIX@
LIBCRYPT32 = @LIBCRYPT32@
LIBCRYPT32_PREFIX = @LIBCRYPT32_PREFIX@
LIBGCRYPT = @LIBGCRYPT@
LIBGCRYPT_PREFIX = @LIBGCRYPT_PREFIX@
LIBMBEDCRYPTO = @LIBMBEDCRYPTO@
@ -303,17 +303,19 @@ LIBSSH2VER = @LIBSSH2VER@
LIBSSL = @LIBSSL@
LIBSSL_PREFIX = @LIBSSL_PREFIX@
LIBTOOL = @LIBTOOL@
LIBWOLFSSL = @LIBWOLFSSL@
LIBWOLFSSL_PREFIX = @LIBWOLFSSL_PREFIX@
LIBZ = @LIBZ@
LIBZ_PREFIX = @LIBZ_PREFIX@
LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBBCRYPT = @LTLIBBCRYPT@
LTLIBCRYPT32 = @LTLIBCRYPT32@
LTLIBGCRYPT = @LTLIBGCRYPT@
LTLIBMBEDCRYPTO = @LTLIBMBEDCRYPTO@
LTLIBOBJS = @LTLIBOBJS@
LTLIBSSL = @LTLIBSSL@
LTLIBWOLFSSL = @LTLIBWOLFSSL@
LTLIBZ = @LTLIBZ@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
@ -335,6 +337,7 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
RC = @RC@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@ -396,69 +399,43 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AUTOMAKE_OPTIONS = foreign nostdinc
SUBDIRS = src tests docs $(am__append_1)
SUBDIRS = src docs $(am__append_1) $(am__append_2)
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libssh2.pc
include_HEADERS = \
include/libssh2.h \
include/libssh2_publickey.h \
include/libssh2_sftp.h
include/libssh2.h \
include/libssh2_publickey.h \
include/libssh2_sftp.h
NETWAREFILES = nw/keepscreen.c \
nw/nwlib.c \
nw/GNUmakefile \
nw/test/GNUmakefile
DISTCLEANFILES = ChangeLog
VMSFILES = vms/libssh2_make_example.dcl vms/libssh2_make_help.dcl \
vms/libssh2_make_kit.dcl vms/libssh2_make_lib.dcl vms/man2help.c \
vms/readme.vms vms/libssh2_config.h
DSP = win32/libssh2.dsp
VCPROJ = win32/libssh2.vcproj
DISTCLEANFILES = $(DSP) ChangeLog
VMSFILES = vms/libssh2_make_example.dcl vms/libssh2_make_help.dcl \
vms/libssh2_make_kit.dcl vms/libssh2_make_lib.dcl vms/man2help.c \
vms/readme.vms vms/libssh2_config.h
WIN32FILES = src/libssh2.rc NMakefile
OS400FILES = os400/README400 os400/initscript.sh os400/make.sh \
os400/make-src.sh os400/make-rpg.sh os400/make-include.sh \
os400/os400sys.c os400/ccsid.c \
os400/libssh2_config.h os400/macros.h os400/libssh2_ccsid.h \
os400/include/alloca.h os400/include/sys/socket.h os400/include/stdio.h \
os400/include/assert.h \
os400/libssh2rpg/libssh2.rpgle.in \
os400/libssh2rpg/libssh2_ccsid.rpgle.in \
os400/libssh2rpg/libssh2_publickey.rpgle \
os400/libssh2rpg/libssh2_sftp.rpgle
WIN32FILES = win32/GNUmakefile win32/test/GNUmakefile \
win32/libssh2_config.h win32/config.mk win32/rules.mk \
win32/Makefile.Watcom win32/libssh2.dsw win32/tests.dsp $(DSP) \
win32/msvcproj.head win32/msvcproj.foot win32/libssh2.rc
OS400FILES = os400/README400 os400/initscript.sh os400/make.sh \
os400/make-src.sh os400/make-rpg.sh os400/make-include.sh \
os400/os400sys.c os400/ccsid.c \
os400/libssh2_config.h os400/macros.h os400/libssh2_ccsid.h \
os400/include/alloca.h os400/include/sys/socket.h os400/include/stdio.h \
os400/libssh2rpg/libssh2.rpgle.in \
os400/libssh2rpg/libssh2_ccsid.rpgle.in \
os400/libssh2rpg/libssh2_publickey.rpgle \
os400/libssh2rpg/libssh2_sftp.rpgle \
Makefile.os400qc3.inc
EXTRA_DIST = $(WIN32FILES) $(NETWAREFILES) get_ver.awk \
maketgz NMakefile RELEASE-NOTES libssh2.pc.in $(VMSFILES) config.rpath \
CMakeLists.txt cmake $(OS400FILES)
EXTRA_DIST = $(WIN32FILES) get_ver.awk \
maketgz RELEASE-NOTES libssh2.pc.in $(VMSFILES) config.rpath \
CMakeLists.txt cmake git2news.pl libssh2-style.el README.md $(OS400FILES) \
buildconf Makefile.mk
ACLOCAL_AMFLAGS = -I m4
# DSP/VCPROJ generation adapted from libcurl
# only OpenSSL and WinCNG are supported with this build system
CRYPTO_CSOURCES = openssl.c wincng.c mbedtls.c
CRYPTO_HHEADERS = openssl.h wincng.h mbedtls.h
CSOURCES = channel.c comp.c crypt.c hostkey.c kex.c mac.c misc.c \
packet.c publickey.c scp.c session.c sftp.c userauth.c transport.c \
version.c knownhost.c agent.c $(CRYPTO_CSOURCES) pem.c keepalive.c global.c \
blowfish.c bcrypt_pbkdf.c agent_win.c
HHEADERS = libssh2_priv.h $(CRYPTO_HHEADERS) transport.h channel.h comp.h \
mac.h misc.h packet.h userauth.h session.h sftp.h crypto.h blf.h agent.h
# Makefile.inc provides the CSOURCES and HHEADERS defines
WIN32SOURCES = $(CSOURCES)
WIN32HEADERS = $(HHEADERS) libssh2_config.h
all: all-recursive
.SUFFIXES:
am--refresh: Makefile
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Makefile.inc $(am__configure_deps)
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@ -480,7 +457,6 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \
esac;
$(srcdir)/Makefile.inc $(am__empty):
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck
@ -1007,72 +983,24 @@ build-coverage:
make CFLAGS=$(COVERAGE_CCOPTS) check
mkdir -p $(COVERAGE_OUT)
lcov --directory . --output-file $(COVERAGE_OUT)/$(PACKAGE).info \
--capture
--capture
gen-coverage:
genhtml --output-directory $(COVERAGE_OUT) \
$(COVERAGE_OUT)/$(PACKAGE).info \
--highlight --frames --legend \
--title "$(PACKAGE_NAME)"
$(COVERAGE_OUT)/$(PACKAGE).info \
--highlight --frames --legend \
--title "$(PACKAGE_NAME)"
coverage: init-coverage build-coverage gen-coverage
$(DSP): win32/msvcproj.head win32/msvcproj.foot Makefile.am
echo "creating $(DSP)"
@( (cat $(srcdir)/win32/msvcproj.head; \
echo "# Begin Group \"Source Files\""; \
echo ""; \
echo "# PROP Default_Filter \"cpp;c;cxx\""; \
win32_srcs='$(WIN32SOURCES)'; \
sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \
for file in $$sorted_srcs; do \
echo "# Begin Source File"; \
echo ""; \
echo "SOURCE=..\\src\\"$$file; \
echo "# End Source File"; \
done; \
echo "# End Group"; \
echo "# Begin Group \"Header Files\""; \
echo ""; \
echo "# PROP Default_Filter \"h;hpp;hxx\""; \
win32_hdrs='$(WIN32HEADERS)'; \
sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \
for file in $$sorted_hdrs; do \
echo "# Begin Source File"; \
echo ""; \
if [ "$$file" = "libssh2_config.h" ]; \
then \
echo "SOURCE=.\\"$$file; \
else \
echo "SOURCE=..\\src\\"$$file; \
fi; \
echo "# End Source File"; \
done; \
echo "# End Group"; \
cat $(srcdir)/win32/msvcproj.foot) | \
awk '{printf("%s\r\n", gensub("\r", "", "g"))}' > $@ )
$(VCPROJ): win32/vc8proj.head win32/vc8proj.foot Makefile.am
echo "creating $(VCPROJ)"
@( (cat $(srcdir)/vc8proj.head; \
win32_srcs='$(WIN32SOURCES)'; \
sorted_srcs=`for file in $$win32_srcs; do echo $$file; done | sort`; \
for file in $$sorted_srcs; do \
echo "<File RelativePath=\""..\src\$$file"\"></File>"; \
done; \
echo "</Filter><Filter Name=\"Header Files\">"; \
win32_hdrs='$(WIN32HEADERS)'; \
sorted_hdrs=`for file in $$win32_hdrs; do echo $$file; done | sort`; \
for file in $$sorted_hdrs; do \
echo "<File RelativePath=\""..\src\$$file"\"></File>"; \
done; \
cat $(srcdir)/vc8proj.foot) | \
awk '{printf("%s\r\n", gensub("\r", "", "g"))}' > $@ )
checksrc:
perl src/checksrc.pl -i4 -m79 -ASIZEOFNOPAREN -ASNPRINTF -ACOPYRIGHT \
-AFOPENMODE -Wsrc/libssh2_config.h src/*.[ch] include/*.h example/*.c \
tests/*.[ch]
perl ci/checksrc.pl -i4 -m79 \
-ASNPRINTF \
-ACOPYRIGHT \
-AFOPENMODE \
-ATYPEDEFSTRUCT \
-Wsrc/libssh2_config.h src/*.[ch] include/*.h example/*.c \
tests/*.[ch]
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

View File

@ -1,7 +0,0 @@
CSOURCES = channel.c comp.c crypt.c hostkey.c kex.c mac.c misc.c \
packet.c publickey.c scp.c session.c sftp.c userauth.c transport.c \
version.c knownhost.c agent.c $(CRYPTO_CSOURCES) pem.c keepalive.c global.c \
blowfish.c bcrypt_pbkdf.c agent_win.c
HHEADERS = libssh2_priv.h $(CRYPTO_HHEADERS) transport.h channel.h comp.h \
mac.h misc.h packet.h userauth.h session.h sftp.h crypto.h blf.h agent.h

View File

@ -1,3 +0,0 @@
CRYPTO_CSOURCES = libgcrypt.c
CRYPTO_HHEADERS = libgcrypt.h
CRYPTO_LTLIBS = $(LTLIBGCRYPT)

View File

@ -1,3 +0,0 @@
CRYPTO_CSOURCES = mbedtls.c
CRYPTO_HHEADERS = mbedtls.h
CRYPTO_LTLIBS = $(LTLIBMBEDCRYPTO)

326
Makefile.mk Normal file
View File

@ -0,0 +1,326 @@
#########################################################################
#
# Makefile for building libssh2 with GCC-like toolchains.
# Use: make -f Makefile.mk [help|all|clean|dist|distclean|dyn|objclean|example|exampleclean|test|testclean]
#
# Written by Guenter Knauf and Viktor Szakats
#
# Look for ' ?=' to find accepted customization variables.
#
#########################################################################
### Common
CFLAGS ?=
CPPFLAGS ?=
LIBSSH2_CPPFLAGS_LIB ?=
RCFLAGS ?=
LDFLAGS ?=
LIBSSH2_LDFLAGS_BIN ?=
LIBSSH2_LDFLAGS_DYN ?=
LIBS ?=
CROSSPREFIX ?=
ifeq ($(CC),cc)
CC := gcc
endif
CC := $(CROSSPREFIX)$(CC)
AR := $(CROSSPREFIX)$(AR)
RC ?= $(CROSSPREFIX)windres
# For compatibility
ARCH ?=
ifeq ($(ARCH),w64)
TRIPLET := x86_64-w64-mingw32
CFLAGS += -m64
LDFLAGS += -m64
RCFLAGS += --target=pe-x86-64
else ifdef ARCH
TRIPLET := i686-w64-mingw32
CFLAGS += -m32
LDFLAGS += -m32
RCFLAGS += --target=pe-i386
else
TRIPLET ?= $(shell $(CC) -dumpmachine)
endif
BLD_DIR ?= $(TRIPLET)
ifneq ($(findstring -w,$(TRIPLET)),)
WIN32 := 1
BIN_EXT := .exe
DYN_EXT := .dll
else
CPPFLAGS += -I$(BLD_DIR) -DHAVE_CONFIG_H
endif
CPPFLAGS += -Isrc -Iinclude
RCFLAGS += -Iinclude
# examples, tests
LIBSSH2_LDFLAGS_BIN += -L$(BLD_DIR)
LIBS_BIN := -lssh2
ifdef WIN32
LIBS_BIN += -lws2_32
endif
ifdef DYN
ifdef WIN32
libssh2_DEPENDENCIES := $(BLD_DIR)/libssh2.dll.a
else
libssh2_DEPENDENCIES := $(BLD_DIR)/libssh2$(DYN_EXT)
endif
LIBSSH2_LDFLAGS_BIN += -shared
else
libssh2_DEPENDENCIES := $(BLD_DIR)/libssh2.a
LIBSSH2_LDFLAGS_BIN += -static
endif
### Optional features
# must be equal to DEBUG or NDEBUG
DB ?= NDEBUG
CPPFLAGS += -D$(DB)
ifeq ($(DB),NDEBUG)
OBJ_DIR := release
else
OBJ_DIR := debug
CFLAGS += -g
CPPFLAGS += -DLIBSSH2DEBUG
endif
OBJ_DIR := $(BLD_DIR)/$(OBJ_DIR)
# Linker options to exclude for shared mode executables.
_LDFLAGS :=
_LIBS :=
ifdef OPENSSL_PATH
CPPFLAGS += -DLIBSSH2_OPENSSL
OPENSSL_INCLUDE ?= $(OPENSSL_PATH)/include
OPENSSL_LIBPATH ?= $(OPENSSL_PATH)/lib
CPPFLAGS += -I"$(OPENSSL_INCLUDE)"
_LDFLAGS += -L"$(OPENSSL_LIBPATH)"
OPENSSL_LIBS ?= -lssl -lcrypto
_LIBS += $(OPENSSL_LIBS)
else ifdef WOLFSSL_PATH
CPPFLAGS += -DLIBSSH2_WOLFSSL
CPPFLAGS += -I"$(WOLFSSL_PATH)/include"
CPPFLAGS += -I"$(WOLFSSL_PATH)/include/wolfssl"
_LDFLAGS += -L"$(WOLFSSL_PATH)/lib"
_LIBS += -lwolfssl
else ifdef LIBGCRYPT_PATH
CPPFLAGS += -DLIBSSH2_LIBGCRYPT
CPPFLAGS += -I"$(LIBGCRYPT_PATH)/include"
_LDFLAGS += -L"$(LIBGCRYPT_PATH)/lib"
_LIBS += -lgcrypt
else ifdef MBEDTLS_PATH
CPPFLAGS += -DLIBSSH2_MBEDTLS
CPPFLAGS += -I"$(MBEDTLS_PATH)/include"
_LDFLAGS += -L"$(MBEDTLS_PATH)/lib"
_LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
else ifdef WIN32
CPPFLAGS += -DLIBSSH2_WINCNG
else
$(error No suitable cryptography backend found)
endif
ifdef ZLIB_PATH
CPPFLAGS += -DLIBSSH2_HAVE_ZLIB
CPPFLAGS += -I"$(ZLIB_PATH)/include"
_LDFLAGS += -L"$(ZLIB_PATH)/lib"
_LIBS += -lz
endif
ifdef WIN32
_LIBS += -lws2_32 -lcrypt32 -lbcrypt
endif
LIBSSH2_LDFLAGS_DYN += $(_LDFLAGS)
LIBS_DYN += $(_LIBS)
ifndef DYN
LIBSSH2_LDFLAGS_BIN += $(_LDFLAGS)
LIBS_BIN += $(_LIBS)
endif
### Rules
# Platform-dependent helper tool macros
ifneq ($(findstring /sh,$(SHELL)),)
DEL = rm -f $1
RMDIR = rm -fr $1
MKDIR = mkdir -p $1
COPY = -cp -afv $1 $2
DL = '
else
DEL = -del 2>NUL /q /f $(subst /,\,$1)
RMDIR = -rd 2>NUL /q /s $(subst /,\,$1)
MKDIR = -md 2>NUL $(subst /,\,$1)
COPY = -copy 2>NUL /y $(subst /,\,$1) $(subst /,\,$2)
endif
AWK := awk
ZIP := zip -qzr9
# Include the version info retrieved from libssh2.h
-include $(OBJ_DIR)/version.inc
vpath %.c src
ifdef WIN32
vpath %.rc src
endif
# Get CSOURCES define
include src/Makefile.inc
OBJS := $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%.o,$(CSOURCES)))
TARGET := $(BLD_DIR)/libssh2
# Override the path below to point to your Distribution folder.
DISTNAM ?= libssh2-$(LIBSSH2_VERSION_STR)-bin-$(word 1,$(subst -, ,$(TRIPLET)))
DISTDIR := $(BLD_DIR)/$(DISTNAM)
DISTARC := $(DISTDIR).zip
LIBSSH2_DYN_SUFFIX ?=
libssh2_dyn_LIBRARY := $(TARGET)$(LIBSSH2_DYN_SUFFIX)$(DYN_EXT)
OBJS_dyn := $(OBJS)
ifdef WIN32
libssh2_def_LIBRARY := $(libssh2_dyn_LIBRARY:$(DYN_EXT)=.def)
libssh2_dyn_a_LIBRARY := $(TARGET).dll.a
OBJS_dyn += $(OBJ_DIR)/libssh2.res
LIBSSH2_LDFLAGS_DYN += -Wl,--output-def,$(libssh2_def_LIBRARY),--out-implib,$(libssh2_dyn_a_LIBRARY)
endif
# Get noinst_PROGRAMS define
include example/Makefile.am
TARGETS_EXAMPLES := $(patsubst %.c,%$(BIN_EXT),$(strip $(wildcard example/*.c)))
all: lib dyn
# For compatibility
dll: dyn
dyn: prebuild $(libssh2_dyn_LIBRARY)
lib: prebuild $(TARGET).a
prebuild: $(OBJ_DIR) $(OBJ_DIR)/version.inc
example: $(TARGETS_EXAMPLES)
# Get DOCKER_TESTS, STANDALONE_TESTS, SSHD_TESTS, TESTS_WITH_LIB_STATIC,
# librunner_la_SOURCES defines
include tests/Makefile.inc
TARGETS_RUNNER := $(TARGET)-runner.a
TARGETS_RUNNER_OBJS := $(addprefix $(OBJ_DIR)/,$(patsubst %.c,%.o,$(filter %.c,$(librunner_la_SOURCES))))
TARGETS_TESTS := $(patsubst %.c,%$(BIN_EXT),$(addprefix tests/,$(addsuffix .c,$(DOCKER_TESTS) $(STANDALONE_TESTS) $(SSHD_TESTS))))
ifdef DYN
TARGETS_TESTS := $(filter-out $(patsubst %.c,%$(BIN_EXT),$(addprefix tests/,$(addsuffix .c,$(TESTS_WITH_LIB_STATIC)))),$(TARGETS_TESTS))
endif
test: $(TARGETS_RUNNER) $(TARGETS_TESTS)
$(TARGETS_RUNNER_OBJS):
$(CC) -W -Wall $(CFLAGS) $(CPPFLAGS) -c $(patsubst $(OBJ_DIR)/%.o,tests/%.c,$@) -o $@
$(TARGETS_RUNNER): $(TARGETS_RUNNER_OBJS)
@$(call DEL, $@)
$(AR) rcs $@ $^
test_%$(BIN_EXT): $(libssh2_DEPENDENCIES) $(TARGETS_RUNNER)
$(CC) -W -Wall $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBSSH2_LDFLAGS_BIN) \
$(patsubst %$(BIN_EXT),%.c,$@) -o $@ $(TARGETS_RUNNER) $(LIBS) $(LIBS_BIN)
%$(BIN_EXT): %.c $(libssh2_DEPENDENCIES)
$(CC) -W -Wall $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(LIBSSH2_LDFLAGS_BIN) $< -o $@ $(LIBS) $(LIBS_BIN)
$(OBJ_DIR)/%.o: %.c
$(CC) -W -Wall $(CFLAGS) $(CPPFLAGS) $(LIBSSH2_CPPFLAGS_LIB) -c $< -o $@
$(libssh2_dyn_LIBRARY) $(libssh2_dyn_a_LIBRARY): $(OBJS_dyn)
@$(call DEL, $@)
$(CC) $(LDFLAGS) -shared $(LIBSSH2_LDFLAGS_DYN) $^ -o $@ $(LIBS) $(LIBS_DYN)
ifdef WIN32
$(OBJ_DIR)/%.res: %.rc
$(RC) -O coff $(RCFLAGS) -i $< -o $@
endif
$(TARGET).a: $(OBJS)
@$(call DEL, $@)
$(AR) rcs $@ $^
$(OBJ_DIR)/version.inc: get_ver.awk include/libssh2.h $(OBJ_DIR)
$(AWK) -f $^ > $@
dist: all $(DISTDIR) $(DISTDIR)/readme.txt
@$(call MKDIR, $(DISTDIR)/bin)
@$(call MKDIR, $(DISTDIR)/include)
@$(call MKDIR, $(DISTDIR)/lib)
@$(call COPY, COPYING, $(DISTDIR))
@$(call COPY, README, $(DISTDIR))
@$(call COPY, RELEASE-NOTES, $(DISTDIR))
@$(call COPY, include/*.h, $(DISTDIR)/include)
@$(call COPY, $(TARGET).a, $(DISTDIR)/lib)
ifdef WIN32
@$(call COPY, $(libssh2_def_LIBRARY), $(DISTDIR)/bin)
@$(call COPY, $(libssh2_dyn_LIBRARY), $(DISTDIR)/bin)
@$(call COPY, $(libssh2_dyn_a_LIBRARY), $(DISTDIR)/lib)
else
@$(call COPY, $(libssh2_dyn_LIBRARY), $(DISTDIR)/lib)
endif
@echo Creating... $(DISTARC)
(cd $(DISTDIR)/.. && $(ZIP) $(abspath $(DISTARC)) $(DISTNAM)/* < $(abspath $(DISTDIR)/readme.txt))
distclean vclean: clean
$(call RMDIR, $(DISTDIR))
$(call DEL, $(DISTARC))
objclean: all
$(call RMDIR, $(OBJ_DIR))
exampleclean:
$(call DEL, $(TARGETS_EXAMPLES))
testclean:
$(call DEL, $(TARGETS_RUNNER_OBJS) $(TARGETS_RUNNER) $(TARGETS_TESTS))
clean:
$(call DEL, $(TARGET).a $(libssh2_dyn_LIBRARY) $(libssh2_def_LIBRARY) $(libssh2_dyn_a_LIBRARY))
$(call RMDIR, $(OBJ_DIR))
$(OBJ_DIR) $(DISTDIR):
@$(call MKDIR, $@)
$(DISTDIR)/readme.txt: Makefile.mk
@echo Creating... $@
@echo $(DL)This is a binary distribution for $(TRIPLET).$(DL) > $@
@echo $(DL)libssh2 version $(LIBSSH2_VERSION_STR)$(DL) >> $@
@echo $(DL)Please download the complete libssh2 package for$(DL) >> $@
@echo $(DL)any further documentation:$(DL) >> $@
@echo $(DL)https://www.libssh2.org/$(DL) >> $@
help: $(OBJ_DIR)/version.inc
@echo $(DL)===========================================================$(DL)
@echo $(DL)OpenSSL path = $(OPENSSL_PATH)$(DL)
@echo $(DL)wolfSSL path = $(WOLFSSL_PATH)$(DL)
@echo $(DL)libgcrypt path = $(LIBGCRYPT_PATH)$(DL)
@echo $(DL)mbedTLS path = $(MBEDTLS_PATH)$(DL)
@echo $(DL)zlib path = $(ZLIB_PATH)$(DL)
@echo $(DL)===========================================================$(DL)
@echo $(DL)libssh2 $(LIBSSH2_VERSION_STR) - available targets are:$(DL)
@echo $(DL)$(MAKE) all$(DL)
@echo $(DL)$(MAKE) dyn$(DL)
@echo $(DL)$(MAKE) lib$(DL)
@echo $(DL)$(MAKE) clean$(DL)
@echo $(DL)$(MAKE) dist$(DL)
@echo $(DL)$(MAKE) distclean$(DL)
@echo $(DL)$(MAKE) objclean$(DL)
@echo $(DL)$(MAKE) example$(DL)
@echo $(DL)$(MAKE) exampleclean$(DL)
@echo $(DL)$(MAKE) test$(DL)
@echo $(DL)$(MAKE) testclean$(DL)
@echo $(DL)===========================================================$(DL)

View File

@ -1,2 +0,0 @@
CRYPTO_CSOURCES = os400qc3.c
CRYPTO_HHEADERS = os400qc3.h

7796
NEWS

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,86 @@
!include "win32/config.mk"
!if "$(WITH_WINCNG)" == "1"
!include "Makefile.WinCNG.inc"
!else
!include "Makefile.OpenSSL.inc"
!if "$(TARGET)" == ""
TARGET=Release
!endif
!include "Makefile.inc"
!if "$(TARGET)" == "Debug"
SUFFIX=_debug
CFLAGS=/Od /MDd
DLLFLAGS=/LDd /DEBUG
!else
CFLAGS=/Oi /O2 /Oy /GF /Y- /MD /DNDEBUG
DLLFLAGS=/LD
!endif
CFLAGS=/nologo /GL /Zi /EHsc $(CFLAGS) /Iinclude
!if "$(OPENSSL_PATH)" != ""
CFLAGS=$(CFLAGS) /DLIBSSH2_OPENSSL /I$(OPENSSL_PATH)\include
LIBS=$(LIBS) $(OPENSSL_PATH)\lib\crypto.lib $(OPENSSL_PATH)\lib\ssl.lib
!else
CFLAGS=$(CFLAGS) /DLIBSSH2_WINCNG
LIBS=crypt32.lib bcrypt.lib
!endif
!if "$(ZLIB_PATH)" != ""
CFLAGS=$(CFLAGS) /DLIBSSH2_HAVE_ZLIB /I$(ZLIB_PATH)\include
LIBS=$(LIBS) $(ZLIB_PATH)\lib\zlib.lib
!endif
LIBS=$(LIBS) ws2_32.lib user32.lib advapi32.lib gdi32.lib
INTDIR=$(TARGET)
SUBDIR=src
!include "src/Makefile.inc"
OBJECTS=$(CSOURCES:.c=.obj)
# SUBDIRS=src example
SUBDIRS=src
!if "$(TARGET)" == "Debug"
OBJECTS=Debug/$(OBJECTS: = Debug/)
OBJECTS=$(OBJECTS: Debug/ = )
!else
TARGET=Release
OBJECTS=Release/$(OBJECTS: = Release/)
OBJECTS=$(OBJECTS: Release/ = )
!endif
all-sub: win32\objects.mk
-for %D in ($(SUBDIRS)) do $(MAKE) /nologo /f %D/NMakefile BUILD=$(BUILD) SUBDIR=%D all-sub
!if "$(AR)" == ""
AR=lib
ARFLAGS=-nologo /LTCG
!endif
clean:
-rmdir 2>NUL /s/q $(TARGET)
-del 2>NUL win32\objects.mk
RESOURCE=$(INTDIR)\libssh2.res
DLL=libssh2$(SUFFIX).dll
STATICLIB=$(INTDIR)\libssh2.lib
!if "$(BUILD_STATIC_LIB)" == ""
all: $(INTDIR) $(DLL)
!else
all: $(INTDIR) $(STATICLIB)
!endif
$(INTDIR):
@if not exist $(INTDIR) mkdir $(INTDIR)
$(DLL): $(OBJECTS) $(RESOURCE)
$(CC) -o $(DLL) $(CFLAGS) $(DLLFLAGS) $(OBJECTS) $(RESOURCE) $(LIBS)
$(STATICLIB): $(OBJECTS)
$(AR) $(ARFLAGS) -out:$@ $(OBJECTS)
$(RESOURCE): src\libssh2.rc
$(RC) /Iinclude /Fo"$@" $?
all-sub: $(INTDIR) all
clean-sub: clean
{$(SUBDIR)}.c{$(INTDIR)}.obj::
$(CC) -c $(CFLAGS) /Fo"$(INTDIR)\\" $<
clean:
-rd 2>NUL /q /s $(TARGET)
real-clean vclean: clean
-del 2>NUL libssh2.dll
@ -25,9 +88,3 @@ real-clean vclean: clean
-del 2>NUL libssh2.ilk
-del 2>NUL libssh2.lib
-del 2>NUL *.pdb
win32\objects.mk: Makefile.inc
@echo OBJECTS = \>$@
@for %O in ($(OBJECTS)) do @echo $$(INTDIR)\%O \>>$@
@echo $$(EOL)>>$@

2
README
View File

@ -6,7 +6,7 @@ the revised BSD license.
Web site: https://www.libssh2.org/
Mailing list: https://cool.haxx.se/mailman/listinfo/libssh2-devel
Mailing list: https://lists.haxx.se/listinfo/libssh2-devel
License: see COPYING

16
README.md Normal file
View File

@ -0,0 +1,16 @@
# libssh2 - SSH2 library
libssh2 is a library implementing the SSH2 protocol, available under
the revised BSD license.
[Web site](https://www.libssh2.org/)
[Mailing list](https://lists.haxx.se/listinfo/libssh2-devel)
[BSD Licensed](https://www.libssh2.org/license.html)
[Web site source code](https://github.com/libssh2/www)
Installation instructions:
- [for CMake](docs/INSTALL_CMAKE.md)
- [for autotools](docs/INSTALL_AUTOTOOLS)

View File

@ -1,62 +1,75 @@
libssh2 1.10
libssh2 1.11
This release includes the following enhancements and bugfixes:
o adds agent forwarding support
o adds OpenSSH Agent support on Windows
o adds ECDSA key support using the Mbed TLS backend
o adds ECDSA cert authentication
o adds diffie-hellman-group14-sha256, diffie-hellman-group16-sha512,
diffie-hellman-group18-sha512 key exchanges
o adds support for PKIX key reading when using ed25519 with OpenSSL
o adds support for EWOULDBLOCK on VMS systems
o adds support for building with OpenSSL 3
o adds support for using FIPS mode in OpenSSL
o adds debug symbols when building with MSVC
o adds support for building on the 3DS
o adds unicode build support on Windows
o restores os400 building
o increases min, max and opt Diffie Hellman group values
o improves portiablity of the make file
o improves timeout behavior with 2FA keyboard auth
o various improvements to the Wincng backend
o fixes reading parital packet replies when using an agent
o fixes Diffie Hellman key exchange on Windows 1903+ builds
o fixes building tests with older versions of OpenSSL
o fixes possible multiple definition warnings
o fixes potential cast issues _libssh2_ecdsa_key_get_curve_type()
o fixes potential use after free if libssh2_init() is called twice
o improved linking when using Mbed TLS
o fixes call to libssh2_crypto_exit() if crypto hasn't been initialized
o fixes crash when loading public keys with no id
o fixes possible out of bounds read when exchanging keys
o fixes possible out of bounds read when reading packets
o fixes possible out of bounds read when opening an X11 connection
o fixes possible out of bounds read when ecdh host keys
o fixes possible hang when trying to read a disconnected socket
o fixes a crash when using the delayed compression option
o fixes read error with large known host entries
o fixes various warnings
o fixes various small memory leaks
o improved error handling, various detailed errors will now be reported
o builds are now using OSS-Fuzz
o builds now use autoreconf instead of a custom build script
o cmake now respects install directory
o improved CI backend
o updated HACKING-CRYPTO documentation
o use markdown file extensions
o improved unit tests
o Adds support for encrypt-then-mac (ETM) MACs
o Adds support for AES-GCM crypto protocols
o Adds support for sk-ecdsa-sha2-nistp256 and sk-ssh-ed25519 keys
o Adds support for RSA certificate authentication
o Adds FIDO support with *_sk() functions
o Adds RSA-SHA2 key upgrading to OpenSSL, WinCNG, mbedTLS, OS400 backends
o Adds Agent Forwarding and libssh2_agent_sign()
o Adds support for Channel Signal message libssh2_channel_signal_ex()
o Adds support to get the user auth banner message libssh2_userauth_banner()
o Adds LIBSSH2_NO_{MD5, HMAC_RIPEMD, DSA, RSA, RSA_SHA1, ECDSA, ED25519,
AES_CBC, AES_CTR, BLOWFISH, RC4, CAST, 3DES} options
o Adds direct stream UNIX sockets with libssh2_channel_direct_streamlocal_ex()
o Adds wolfSSL support to CMake file
o Adds mbedTLS 3.x support
o Adds LibreSSL 3.5 support
o Adds support for CMake "unity" builds
o Adds CMake support for building shared and static libs in a single pass
o Adds symbol hiding support to CMake
o Adds support for libssh2.rc for all build tools
o Adds .zip, .tar.xz and .tar.bz2 release tarballs
o Enables ed25519 key support for LibreSSL 3.7.0 or higher
o Improves OpenSSL 1.1 and 3 compatibility
o Now requires OpenSSL 1.0.2 or newer
o Now requires CMake 3.1 or newer
o SFTP: Adds libssh2_sftp_open_ex_r() and libssh2_sftp_open_r() extended APIs
o SFTP: No longer has a packet limit when reading a directory
o SFTP: now parses attribute extensions if they exist
o SFTP: no longer will busy loop if SFTP fails to initialize
o SFTP: now clear various errors as expected
o SFTP: no longer skips files if the line buffer is too small
o SCP: add option to not quote paths
o SCP: Enables 64-bit offset support unconditionally
o Now skips leading \r and \n characters in banner_receive()
o Enables secure memory zeroing with all build tools on all platforms
o No longer logs SSH_MSG_REQUEST_FAILURE packets from keepalive
o Speed up base64 encoding by 7x
o Assert if there is an attempt to write a value that is too large
o WinCNG: fix memory leak in _libssh2_dh_secret()
o Added protection against possible null pointer dereferences
o Agent now handles overly large comment lengths
o Now ensure KEX replies don't include extra bytes
o Fixed possible buffer overflow when receiving SSH_MSG_USERAUTH_BANNER
o Fixed possible buffer overflow in keyboard interactive code path
o Fixed overlapping memcpy()
o Fixed Windows UWP builds
o Fixed DLL import name
o Renamed local RANDOM_PADDING macro to avoid unexpected define on Windows
o Support for building with gcc versions older than 8
o Improvements to CMake, Makefile, NMakefile, GNUmakefile, autoreconf files
o Restores ANSI C89 compliance
o Enabled new compiler warnings and fixed/silenced them
o Improved error messages
o Now uses CIFuzz
o Numerous minor code improvements
o Improvements to CI builds
o Improvements to unit tests
o Improvements to doc files
o Improvements to example files
o Removed "old gex" build option
o Removed no-encryption/no-mac builds
o Removed support for NetWare and Watcom wmake build files
This release would not have looked like this without help, code, reports and
advice from friends like these:
katzer, Orgad Shaneh, mark-i-m, Zenju, axjowa, Thilo Schulz,
Etienne Samson, hlefebvre, seba30, Panos, jethrogb, Fabrice Fontaine,
Will Cosgrove, Daniel Stenberg, Michael Buckley, Wallace Souza Silva,
Romain-Geissler-1A, meierha, Tseng Jun, Thomas Klausner, Brendan Shanks,
Harry Sintonen, monnerat, Koutheir Attouchi, Marc Hörsken, yann-morin-1998,
Wez Furlong, TDi-jonesds, David Benjamin, Max Dymond, Igor Klevanets,
Viktor Szakats, Laurent Stacul, Mstrodl, Gabriel Smith, MarcT512,
Paul Capron, teottin, Tor Erik Ottinsen, Brian Inglis
(40 contributors)
Viktor Szakats, Dan Fandrich, Will Cosgrove, Daniel Stenberg, Michael Buckley,
Zenju, Miguel de Icaza, Nick Woodruff, Keith Dart, Anders Borum,
Jörgen Sigvardsson, vajdaakos, Gustavo Junior Alves, Marc Hörsken, iruis,
Nishit Majithia, Stefan Eissing, metab0t, Y. Yang, skundu07, Mike Harris,
Gabriel Smith, Leo Liu, Miguel de Icaza, Sandeep Bansal, Harry Sintonen,
xalopp, tihmstar, Sunil Nimmagadda

View File

@ -1,3 +1,145 @@
dnl CURL_CPP_P
dnl
dnl Check if $cpp -P should be used for extract define values due to gcc 5
dnl splitting up strings and defines between line outputs. gcc by default
dnl (without -P) will show TEST EINVAL TEST as
dnl
dnl # 13 "conftest.c"
dnl TEST
dnl # 13 "conftest.c" 3 4
dnl 22
dnl # 13 "conftest.c"
dnl TEST
AC_DEFUN([CURL_CPP_P], [
AC_MSG_CHECKING([if cpp -P is needed])
AC_EGREP_CPP([TEST.*TEST], [
#include <errno.h>
TEST EINVAL TEST
], [cpp=no], [cpp=yes])
AC_MSG_RESULT([$cpp])
dnl we need cpp -P so check if it works then
if test "x$cpp" = "xyes"; then
AC_MSG_CHECKING([if cpp -P works])
OLDCPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS -P"
AC_EGREP_CPP([TEST.*TEST], [
#include <errno.h>
TEST EINVAL TEST
], [cpp_p=yes], [cpp_p=no])
AC_MSG_RESULT([$cpp_p])
if test "x$cpp_p" = "xno"; then
AC_MSG_WARN([failed to figure out cpp -P alternative])
# without -P
CPPPFLAG=""
else
# with -P
CPPPFLAG="-P"
fi
dnl restore CPPFLAGS
CPPFLAGS=$OLDCPPFLAGS
else
# without -P
CPPPFLAG=""
fi
])
dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
dnl -------------------------------------------------
dnl Use the C preprocessor to find out if the given object-style symbol
dnl is defined and get its expansion. This macro will not use default
dnl includes even if no INCLUDES argument is given. This macro will run
dnl silently when invoked with three arguments. If the expansion would
dnl result in a set of double-quoted strings the returned expansion will
dnl actually be a single double-quoted string concatenating all them.
AC_DEFUN([CURL_CHECK_DEF], [
AC_REQUIRE([CURL_CPP_P])dnl
OLDCPPFLAGS=$CPPFLAGS
# CPPPFLAG comes from CURL_CPP_P
CPPFLAGS="$CPPFLAGS $CPPPFLAG"
AS_VAR_PUSHDEF([ac_HaveDef], [curl_cv_have_def_$1])dnl
AS_VAR_PUSHDEF([ac_Def], [curl_cv_def_$1])dnl
if test -z "$SED"; then
AC_MSG_ERROR([SED not set. Cannot continue without SED being set.])
fi
if test -z "$GREP"; then
AC_MSG_ERROR([GREP not set. Cannot continue without GREP being set.])
fi
ifelse($3,,[AC_MSG_CHECKING([for preprocessor definition of $1])])
tmp_exp=""
AC_PREPROC_IFELSE([
AC_LANG_SOURCE(
ifelse($2,,,[$2])[[
#ifdef $1
CURL_DEF_TOKEN $1
#endif
]])
],[
tmp_exp=`eval "$ac_cpp conftest.$ac_ext" 2>/dev/null | \
"$GREP" CURL_DEF_TOKEN 2>/dev/null | \
"$SED" 's/.*CURL_DEF_TOKEN[[ ]][[ ]]*//' 2>/dev/null | \
"$SED" 's/[["]][[ ]]*[["]]//g' 2>/dev/null`
if test -z "$tmp_exp" || test "$tmp_exp" = "$1"; then
tmp_exp=""
fi
])
if test -z "$tmp_exp"; then
AS_VAR_SET(ac_HaveDef, no)
ifelse($3,,[AC_MSG_RESULT([no])])
else
AS_VAR_SET(ac_HaveDef, yes)
AS_VAR_SET(ac_Def, $tmp_exp)
ifelse($3,,[AC_MSG_RESULT([$tmp_exp])])
fi
AS_VAR_POPDEF([ac_Def])dnl
AS_VAR_POPDEF([ac_HaveDef])dnl
CPPFLAGS=$OLDCPPFLAGS
])
dnl CURL_CHECK_COMPILER_CLANG
dnl -------------------------------------------------
dnl Verify if compiler being used is clang.
AC_DEFUN([CURL_CHECK_COMPILER_CLANG], [
AC_BEFORE([$0],[CURL_CHECK_COMPILER_GNU_C])dnl
AC_MSG_CHECKING([if compiler is clang])
CURL_CHECK_DEF([__clang__], [], [silent])
if test "$curl_cv_have_def___clang__" = "yes"; then
AC_MSG_RESULT([yes])
AC_MSG_CHECKING([if compiler is xlclang])
CURL_CHECK_DEF([__ibmxl__], [], [silent])
if test "$curl_cv_have_def___ibmxl__" = "yes" ; then
dnl IBM's almost-compatible clang version
AC_MSG_RESULT([yes])
compiler_id="XLCLANG"
else
AC_MSG_RESULT([no])
compiler_id="CLANG"
fi
fullclangver=`$CC -v 2>&1 | grep version`
clangver=`echo $fullclangver | grep "based on LLVM " | "$SED" 's/.*(based on LLVM \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*)/\1/'`
if test -z "$clangver"; then
if echo $fullclangver | grep "Apple LLVM version " >/dev/null; then
dnl Starting with Xcode 7 / clang 3.7, Apple clang won't tell its upstream version
clangver="3.7"
else
clangver=`echo $fullclangver | "$SED" 's/.*version \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/'`
fi
fi
clangvhi=`echo $clangver | cut -d . -f1`
clangvlo=`echo $clangver | cut -d . -f2`
compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
flags_dbg_yes="-g"
flags_opt_all="-O -O0 -O1 -O2 -Os -O3 -O4"
flags_opt_yes="-O2"
flags_opt_off="-O0"
else
AC_MSG_RESULT([no])
fi
])
dnl **********************************************************************
dnl CURL_DETECT_ICC ([ACTION-IF-YES])
@ -28,23 +170,136 @@ AC_DEFUN([CURL_DETECT_ICC],
])
dnl We create a function for detecting which compiler we use and then set as
dnl pendantic compiler options as possible for that particular compiler. The
dnl pedantic compiler options as possible for that particular compiler. The
dnl options are only used for debug-builds.
AC_DEFUN([CURL_CC_DEBUG_OPTS],
[
if test "z$CLANG" = "z"; then
CURL_CHECK_COMPILER_CLANG
if test "z$compiler_id" = "zCLANG"; then
CLANG="yes"
else
CLANG="no"
fi
fi
if test "z$ICC" = "z"; then
CURL_DETECT_ICC
fi
if test "$GCC" = "yes"; then
if test "$CLANG" = "yes"; then
dnl figure out clang version!
AC_MSG_CHECKING([clang version])
fullclangver=`$CC -v 2>&1 | grep version`
clangver=`echo $fullclangver | grep "based on LLVM " | "$SED" 's/.*(based on LLVM \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*)/\1/'`
if test -z "$clangver"; then
if echo $fullclangver | grep "Apple LLVM version " >/dev/null; then
dnl Starting with Xcode 7 / clang 3.7, Apple clang won't tell its upstream version
clangver="3.7"
else
clangver=`echo $fullclangver | "$SED" 's/.*version \(@<:@0-9@:>@*\.@<:@0-9@:>@*\).*/\1/'`
fi
fi
clangvhi=`echo $clangver | cut -d . -f1`
clangvlo=`echo $clangver | cut -d . -f2`
compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
AC_MSG_RESULT($compiler_num)
WARN="-pedantic"
CURL_ADD_COMPILER_WARNINGS([WARN], [all extra])
CURL_ADD_COMPILER_WARNINGS([WARN], [pointer-arith write-strings])
CURL_ADD_COMPILER_WARNINGS([WARN], [shadow])
CURL_ADD_COMPILER_WARNINGS([WARN], [inline nested-externs])
CURL_ADD_COMPILER_WARNINGS([WARN], [missing-declarations])
CURL_ADD_COMPILER_WARNINGS([WARN], [missing-prototypes])
WARN="$WARN -Wno-long-long"
CURL_ADD_COMPILER_WARNINGS([WARN], [float-equal])
CURL_ADD_COMPILER_WARNINGS([WARN], [no-multichar sign-compare])
CURL_ADD_COMPILER_WARNINGS([WARN], [undef])
WARN="$WARN -Wno-format-nonliteral"
CURL_ADD_COMPILER_WARNINGS([WARN], [endif-labels strict-prototypes])
CURL_ADD_COMPILER_WARNINGS([WARN], [declaration-after-statement])
CURL_ADD_COMPILER_WARNINGS([WARN], [cast-align])
WARN="$WARN -Wno-system-headers"
CURL_ADD_COMPILER_WARNINGS([WARN], [shorten-64-to-32])
#
dnl Only clang 1.1 or later
if test "$compiler_num" -ge "101"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [unused])
fi
#
dnl Only clang 2.8 or later
if test "$compiler_num" -ge "208"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [vla])
fi
#
dnl Only clang 2.9 or later
if test "$compiler_num" -ge "209"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [shift-sign-overflow])
fi
#
dnl Only clang 3.0 or later (possibly earlier)
if test "$compiler_num" -ge "300"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [bad-function-cast])
CURL_ADD_COMPILER_WARNINGS([WARN], [conversion])
CURL_ADD_COMPILER_WARNINGS([WARN], [empty-body])
CURL_ADD_COMPILER_WARNINGS([WARN], [ignored-qualifiers])
CURL_ADD_COMPILER_WARNINGS([WARN], [type-limits])
CURL_ADD_COMPILER_WARNINGS([WARN], [no-sign-conversion])
fi
#
dnl Only clang 3.2 or later
if test "$compiler_num" -ge "302"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [enum-conversion])
case $host_os in
cygwin* | mingw*)
dnl skip missing-variable-declarations warnings for cygwin and
dnl mingw because the libtool wrapper executable causes them
;;
*)
CURL_ADD_COMPILER_WARNINGS([WARN], [missing-variable-declarations])
;;
esac
fi
#
dnl Only clang 3.4 or later
if test "$compiler_num" -ge "304"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [unused-const-variable])
fi
#
dnl Only clang 3.6 or later
if test "$compiler_num" -ge "306"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [double-promotion])
fi
#
dnl Only clang 3.9 or later
if test "$compiler_num" -ge "309"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [comma])
# avoid the varargs warning, fixed in 4.0
# https://bugs.llvm.org/show_bug.cgi?id=29140
if test "$compiler_num" -lt "400"; then
WARN="$WARN -Wno-varargs"
fi
fi
dnl clang 7 or later
if test "$compiler_num" -ge "700"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [assign-enum])
CURL_ADD_COMPILER_WARNINGS([WARN], [extra-semi-stmt])
fi
CFLAGS="$CFLAGS $WARN"
AC_MSG_NOTICE([Added this set of compiler options: $WARN])
elif test "$GCC" = "yes"; then
dnl figure out gcc version!
AC_MSG_CHECKING([gcc version])
gccver=`$CC -dumpversion`
num1=`echo $gccver | cut -d . -f1`
num2=`echo $gccver | cut -d . -f2`
gccnum=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
compiler_num=`(expr $num1 "*" 100 + $num2) 2>/dev/null`
AC_MSG_RESULT($gccver)
if test "$ICC" = "yes"; then
@ -61,7 +316,7 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
WARN="-wd279,269,981,1418,1419"
if test "$gccnum" -gt "600"; then
if test "$compiler_num" -gt "600"; then
dnl icc 6.0 and older doesn't have the -Wall flag
WARN="-Wall $WARN"
fi
@ -69,26 +324,24 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
dnl this is a set of options we believe *ALL* gcc versions support:
WARN="-W -Wall -Wwrite-strings -pedantic -Wpointer-arith -Wnested-externs -Winline -Wmissing-prototypes"
dnl -Wcast-align is a bit too annoying on all gcc versions ;-)
if test "$gccnum" -ge "207"; then
if test "$compiler_num" -ge "207"; then
dnl gcc 2.7 or later
WARN="$WARN -Wmissing-declarations"
fi
if test "$gccnum" -gt "295"; then
if test "$compiler_num" -gt "295"; then
dnl only if the compiler is newer than 2.95 since we got lots of
dnl "`_POSIX_C_SOURCE' is not defined" in system headers with
dnl gcc 2.95.4 on FreeBSD 4.9!
WARN="$WARN -Wundef -Wno-long-long -Wsign-compare"
WARN="$WARN -Wbad-function-cast -Wundef -Wno-long-long -Wno-multichar -Wshadow -Wsign-compare -Wunused"
fi
if test "$gccnum" -ge "296"; then
if test "$compiler_num" -ge "296"; then
dnl gcc 2.96 or later
WARN="$WARN -Wfloat-equal"
fi
if test "$gccnum" -gt "296"; then
if test "$compiler_num" -gt "296"; then
dnl this option does not exist in 2.96
WARN="$WARN -Wno-format-nonliteral"
fi
@ -98,16 +351,93 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
dnl Also, on gcc 4.0.X it is totally unbearable and complains all
dnl over making it unusable for generic purposes. Let's not use it.
if test "$gccnum" -ge "303"; then
if test "$compiler_num" -ge "303"; then
dnl gcc 3.3 and later
WARN="$WARN -Wendif-labels -Wstrict-prototypes"
fi
if test "$gccnum" -ge "304"; then
if test "$compiler_num" -ge "304"; then
# try these on gcc 3.4
WARN="$WARN -Wdeclaration-after-statement"
fi
dnl Only gcc 4.0 or later
if test "$compiler_num" -ge "400"; then
WARN="$WARN -Wstrict-aliasing=3"
fi
#
dnl Only gcc 4.1 or later (possibly earlier)
if test "$compiler_num" -ge "401"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [no-system-headers])
fi
#
dnl Only gcc 4.2 or later
if test "$compiler_num" -ge "402"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [cast-align])
fi
#
dnl Only gcc 4.3 or later
if test "$compiler_num" -ge "403"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [type-limits old-style-declaration])
CURL_ADD_COMPILER_WARNINGS([WARN], [missing-parameter-type empty-body])
CURL_ADD_COMPILER_WARNINGS([WARN], [ignored-qualifiers])
CURL_ADD_COMPILER_WARNINGS([WARN], [conversion])
WARN="$WARN -Wno-sign-conversion"
CURL_ADD_COMPILER_WARNINGS([WARN], [vla])
dnl required for -Warray-bounds, included in -Wall
WARN="$WARN -ftree-vrp"
fi
#
dnl Only gcc 4.5 or later
if test "$compiler_num" -ge "405"; then
dnl Only windows targets
case $host_os in
mingw*)
WARN="$WARN -Wno-pedantic-ms-format"
;;
esac
fi
#
dnl Only gcc 4.6 or later
if test "$compiler_num" -ge "406"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [double-promotion])
fi
#
dnl only gcc 4.8 or later
if test "$compiler_num" -ge "408"; then
WARN="$WARN -Wformat=2"
fi
#
dnl Only gcc 5 or later
if test "$compiler_num" -ge "500"; then
WARN="$WARN -Warray-bounds=2"
fi
#
dnl Only gcc 6 or later
if test "$compiler_num" -ge "600"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [shift-negative-value])
WARN="$WARN -Wshift-overflow=2"
CURL_ADD_COMPILER_WARNINGS([WARN], [null-dereference])
WARN="$WARN -fdelete-null-pointer-checks"
CURL_ADD_COMPILER_WARNINGS([WARN], [duplicated-cond])
CURL_ADD_COMPILER_WARNINGS([WARN], [unused-const-variable])
fi
#
dnl Only gcc 7 or later
if test "$compiler_num" -ge "700"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [duplicated-branches])
CURL_ADD_COMPILER_WARNINGS([WARN], [restrict])
CURL_ADD_COMPILER_WARNINGS([WARN], [alloc-zero])
WARN="$WARN -Wformat-overflow=2"
WARN="$WARN -Wformat-truncation=1"
fi
#
dnl Only gcc 10 or later
if test "$compiler_num" -ge "1000"; then
CURL_ADD_COMPILER_WARNINGS([WARN], [arith-conversion])
CURL_ADD_COMPILER_WARNINGS([WARN], [enum-conversion])
fi
for flag in $CPPFLAGS; do
case "$flag" in
-I*)
@ -148,6 +478,67 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
]) dnl end of AC_DEFUN()
dnl CURL_ADD_COMPILER_WARNINGS (WARNING-LIST, NEW-WARNINGS)
dnl -------------------------------------------------------
dnl Contents of variable WARNING-LIST and NEW-WARNINGS are
dnl handled as whitespace separated lists of words.
dnl Add each compiler warning from NEW-WARNINGS that has not
dnl been disabled via CFLAGS to WARNING-LIST.
AC_DEFUN([CURL_ADD_COMPILER_WARNINGS], [
AC_REQUIRE([CURL_SHFUNC_SQUEEZE])dnl
ac_var_added_warnings=""
for warning in [$2]; do
CURL_VAR_MATCH(CFLAGS, [-Wno-$warning -W$warning])
if test "$ac_var_match_word" = "no"; then
ac_var_added_warnings="$ac_var_added_warnings -W$warning"
fi
done
dnl squeeze whitespace out of result
[$1]="$[$1] $ac_var_added_warnings"
squeeze [$1]
])
dnl CURL_SHFUNC_SQUEEZE
dnl -------------------------------------------------
dnl Declares a shell function squeeze() which removes
dnl redundant whitespace out of a shell variable.
AC_DEFUN([CURL_SHFUNC_SQUEEZE], [
squeeze() {
_sqz_result=""
eval _sqz_input=\[$][$]1
for _sqz_token in $_sqz_input; do
if test -z "$_sqz_result"; then
_sqz_result="$_sqz_token"
else
_sqz_result="$_sqz_result $_sqz_token"
fi
done
eval [$]1=\$_sqz_result
return 0
}
])
dnl CURL_VAR_MATCH (VARNAME, VALUE)
dnl -------------------------------------------------
dnl Verifies if shell variable VARNAME contains VALUE.
dnl Contents of variable VARNAME and VALUE are handled
dnl as whitespace separated lists of words. If at least
dnl one word of VALUE is present in VARNAME the match
dnl is considered positive, otherwise false.
AC_DEFUN([CURL_VAR_MATCH], [
ac_var_match_word="no"
for word1 in $[$1]; do
for word2 in [$2]; do
if test "$word1" = "$word2"; then
ac_var_match_word="yes"
fi
done
done
])
dnl CURL_CHECK_NONBLOCKING_SOCKET
dnl -------------------------------------------------
dnl Check for how to set a socket to non-blocking state. There seems to exist
@ -163,12 +554,12 @@ AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET],
[
AC_MSG_CHECKING([non-blocking sockets style])
AC_TRY_COMPILE([
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
/* headers for O_NONBLOCK test */
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
],[
]], [[
/* try to compile O_NONBLOCK */
#if defined(sun) || defined(__sun__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
@ -187,22 +578,22 @@ AC_DEFUN([CURL_CHECK_NONBLOCKING_SOCKET],
#endif
int socket;
int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK);
],[
]])],[
dnl the O_NONBLOCK test was fine
nonblock="O_NONBLOCK"
AC_DEFINE(HAVE_O_NONBLOCK, 1, [use O_NONBLOCK for non-blocking sockets])
],[
dnl the code was bad, try a different program now, test 2
AC_TRY_COMPILE([
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
/* headers for FIONBIO test */
#include <unistd.h>
#include <stropts.h>
],[
]], [[
/* FIONBIO source test (old-style unix) */
int socket;
int flags = ioctl(socket, FIONBIO, &flags);
],[
]])],[
dnl FIONBIO test was good
nonblock="FIONBIO"
AC_DEFINE(HAVE_FIONBIO, 1, [use FIONBIO for non-blocking sockets])
@ -210,67 +601,34 @@ AC_DEFINE(HAVE_FIONBIO, 1, [use FIONBIO for non-blocking sockets])
dnl FIONBIO test was also bad
dnl the code was bad, try a different program now, test 3
AC_TRY_COMPILE([
/* headers for ioctlsocket test (Windows) */
#undef inline
#ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#ifdef HAVE_WINSOCK2_H
#include <winsock2.h>
#else
#ifdef HAVE_WINSOCK_H
#include <winsock.h>
#endif
#endif
#endif
],[
/* ioctlsocket source code */
SOCKET sd;
unsigned long flags = 0;
sd = socket(0, 0, 0);
ioctlsocket(sd, FIONBIO, &flags);
],[
dnl ioctlsocket test was good
nonblock="ioctlsocket"
AC_DEFINE(HAVE_IOCTLSOCKET, 1, [use ioctlsocket() for non-blocking sockets])
],[
dnl ioctlsocket didnt compile!, go to test 4
AC_TRY_LINK([
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
/* headers for IoctlSocket test (Amiga?) */
#include <sys/ioctl.h>
],[
]], [[
/* IoctlSocket source code */
int socket;
int flags = IoctlSocket(socket, FIONBIO, (long)1);
],[
]])],[
dnl ioctlsocket test was good
nonblock="IoctlSocket"
AC_DEFINE(HAVE_IOCTLSOCKET_CASE, 1, [use Ioctlsocket() for non-blocking sockets])
],[
dnl Ioctlsocket didnt compile, do test 5!
AC_TRY_COMPILE([
dnl Ioctlsocket did not compile, do test 4!
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
/* headers for SO_NONBLOCK test (BeOS) */
#include <socket.h>
],[
]], [[
/* SO_NONBLOCK source code */
long b = 1;
int socket;
int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
],[
]])],[
dnl the SO_NONBLOCK test was good
nonblock="SO_NONBLOCK"
AC_DEFINE(HAVE_SO_NONBLOCK, 1, [use SO_NONBLOCK for non-blocking sockets])
],[
dnl test 5 didnt compile!
dnl test 4 did not compile!
nonblock="nada"
AC_DEFINE(HAVE_DISABLED_NONBLOCKING, 1, [disabled non-blocking sockets])
])
dnl end of fifth test
])
dnl end of forth test
@ -419,15 +777,21 @@ m4_case([$1],
LIBSSH2_LIB_HAVE_LINKFLAGS([ssl], [crypto], [#include <openssl/ssl.h>], [
AC_DEFINE(LIBSSH2_OPENSSL, 1, [Use $1])
LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }libssl libcrypto"
# Not all OpenSSL have AES-CTR functions.
libssh2_save_LIBS="$LIBS"
LIBS="$LIBS $LIBSSL"
AC_CHECK_FUNCS(EVP_aes_128_ctr)
LIBS="$libssh2_save_LIBS"
found_crypto="$1"
found_crypto_str="OpenSSL (AES-CTR: ${ac_cv_func_EVP_aes_128_ctr:-N/A})"
found_crypto_str="OpenSSL"
])
],
[wolfssl], [
if test "${with_libwolfssl_prefix+set}" = set; then
CPPFLAGS="$CPPFLAGS${CPPFLAGS:+ }-I${with_libwolfssl_prefix}/include/wolfssl"
else
AC_MSG_ERROR([When using wolfSSL, must specify prefix with --with-libwolfssl-prefix in order to find OpenSSL compatibility headers.])
fi
LIBSSH2_LIB_HAVE_LINKFLAGS([wolfssl], [], [#include <wolfssl/options.h>], [
AC_DEFINE(LIBSSH2_WOLFSSL, 1, [Use $1])
LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }libwolfssl"
found_crypto="$1"
])
],
@ -443,20 +807,15 @@ m4_case([$1],
AC_DEFINE(LIBSSH2_MBEDTLS, 1, [Use $1])
LIBS="$LIBS -lmbedcrypto"
found_crypto="$1"
support_clear_memory=yes
])
],
[wincng], [
# Look for Windows Cryptography API: Next Generation
AC_CHECK_HEADERS([ntdef.h ntstatus.h], [], [], [#include <windows.h>])
AC_CHECK_DECLS([SecureZeroMemory], [], [], [#include <windows.h>])
LIBS="$LIBS -lcrypt32"
LIBSSH2_LIB_HAVE_LINKFLAGS([crypt32], [], [
#include <windows.h>
#include <wincrypt.h>
])
# Check necessary for old-MinGW
LIBSSH2_LIB_HAVE_LINKFLAGS([bcrypt], [], [
#include <windows.h>
#include <bcrypt.h>
@ -464,7 +823,6 @@ m4_case([$1],
AC_DEFINE(LIBSSH2_WINCNG, 1, [Use $1])
found_crypto="$1"
found_crypto_str="Windows Cryptography API: Next Generation"
support_clear_memory="$ac_cv_have_decl_SecureZeroMemory"
])
],
)
@ -486,8 +844,8 @@ AC_DEFUN([LIBSSH2_CHECK_OPTION_WERROR], [
AC_MSG_CHECKING([whether to enable compiler warnings as errors])
OPT_COMPILER_WERROR="default"
AC_ARG_ENABLE(werror,
AC_HELP_STRING([--enable-werror],[Enable compiler warnings as errors])
AC_HELP_STRING([--disable-werror],[Disable compiler warnings as errors]),
AS_HELP_STRING([--enable-werror],[Enable compiler warnings as errors])
AS_HELP_STRING([--disable-werror],[Disable compiler warnings as errors]),
OPT_COMPILER_WERROR=$enableval)
case "$OPT_COMPILER_WERROR" in
no)
@ -509,4 +867,3 @@ AC_HELP_STRING([--disable-werror],[Disable compiler warnings as errors]),
CFLAGS="$CFLAGS -Werror"
fi
])

10
aclocal.m4 vendored
View File

@ -1,4 +1,4 @@
# generated automatically by aclocal 1.16.4 -*- Autoconf -*-
# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
@ -35,7 +35,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.16'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.16.4], [],
m4_if([$1], [1.16.5], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@ -51,7 +51,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.16.4])dnl
[AM_AUTOMAKE_VERSION([1.16.5])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
@ -428,6 +428,10 @@ m4_defn([AC_PROG_CC])
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
[AC_PREREQ([2.65])dnl
m4_ifdef([_$0_ALREADY_INIT],
[m4_fatal([$0 expanded multiple times
]m4_defn([_$0_ALREADY_INIT]))],
[m4_define([_$0_ALREADY_INIT], m4_expansion_stack)])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl

8
buildconf Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
echo "***" >&2
echo "*** Do not use buildconf. Instead, use: autoreconf -fi" >&2
echo "*** Doing it for you now, but buildconf may disappear in the future." >&2
echo "***" >&2
exec ${AUTORECONF:-autoreconf} -fi "${@}"

View File

@ -69,13 +69,13 @@ function(check_function_exists_may_need_library function variable)
# new test
check_library_exists(${lib} ${function} "" HAVE_${function}_IN_${lib})
if(HAVE_${function}_IN_${lib})
set(${variable} 1 CACHE INTERNAL
"Function ${function} found in library ${lib}")
set(NEED_LIB_${UP_LIB} 1 CACHE INTERNAL
"Need to link ${lib}")
break()
set(${variable} 1 CACHE INTERNAL
"Function ${function} found in library ${lib}")
set(NEED_LIB_${UP_LIB} 1 CACHE INTERNAL
"Need to link ${lib}")
break()
endif()
endforeach()
endif()
endfunction()
endfunction()

View File

@ -11,10 +11,8 @@ include(CheckCSourceCompiles)
# method (if any):
# HAVE_O_NONBLOCK
# HAVE_FIONBIO
# HAVE_IOCTLSOCKET
# HAVE_IOCTLSOCKET_CASE
# HAVE_SO_NONBLOCK
# HAVE_DISABLED_NONBLOCKING
#
# The following variables may be set before calling this macro to
# modify the way the check is run:
@ -47,73 +45,49 @@ macro(check_nonblocking_socket_support)
#error \"O_NONBLOCK does not work on this platform\"
#endif
int main()
int main(void)
{
int socket;
int flags = fcntl(socket, F_SETFL, flags | O_NONBLOCK);
int socket = 0;
(void)fcntl(socket, F_SETFL, O_NONBLOCK);
}"
HAVE_O_NONBLOCK)
HAVE_O_NONBLOCK)
if(NOT HAVE_O_NONBLOCK)
check_c_source_compiles("/* FIONBIO test (old-style unix) */
#include <unistd.h>
#include <stropts.h>
int main()
int main(void)
{
int socket;
int flags = ioctl(socket, FIONBIO, &flags);
int socket = 0;
int flags = 0;
(void)ioctl(socket, FIONBIO, &flags);
}"
HAVE_FIONBIO)
HAVE_FIONBIO)
if(NOT HAVE_FIONBIO)
check_c_source_compiles("/* ioctlsocket test (Windows) */
#undef inline
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <winsock2.h>
int main()
{
SOCKET sd;
unsigned long flags = 0;
sd = socket(0, 0, 0);
ioctlsocket(sd, FIONBIO, &flags);
}"
HAVE_IOCTLSOCKET)
if(NOT HAVE_IOCTLSOCKET)
check_c_source_compiles("/* IoctlSocket test (Amiga?) */
check_c_source_compiles("/* IoctlSocket test (Amiga?) */
#include <sys/ioctl.h>
int main()
int main(void)
{
int socket;
int flags = IoctlSocket(socket, FIONBIO, (long)1);
int socket = 0;
(void)IoctlSocket(socket, FIONBIO, (long)1);
}"
HAVE_IOCTLSOCKET_CASE)
if(NOT HAVE_IOCTLSOCKET_CASE)
check_c_source_compiles("/* SO_NONBLOCK test (BeOS) */
if(NOT HAVE_IOCTLSOCKET_CASE)
check_c_source_compiles("/* SO_NONBLOCK test (BeOS) */
#include <socket.h>
int main()
int main(void)
{
long b = 1;
int socket;
int flags = setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
int socket = 0;
(void)setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &b, sizeof(b));
}"
HAVE_SO_NONBLOCK)
if(NOT HAVE_SO_NONBLOCK)
# No non-blocking socket method found
set(HAVE_DISABLED_NONBLOCKING 1)
endif()
endif()
endif()
endif()
endif()
endmacro()
endmacro()

View File

@ -50,4 +50,4 @@ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libgcrypt DEFAULT_MSG
LIBGCRYPT_LIBRARY LIBGCRYPT_INCLUDE_DIR)
mark_as_advanced(LIBGCRYPT_INCLUDE_DIR LIBGCRYPT_LIBRARY)
mark_as_advanced(LIBGCRYPT_INCLUDE_DIR LIBGCRYPT_LIBRARY)

View File

@ -10,55 +10,53 @@
# MBEDX509_LIBRARY - path to mbedTLS X.509 library
# MBEDCRYPTO_LIBRARY - path to mbedTLS Crypto library
FIND_PATH(MBEDTLS_INCLUDE_DIR mbedtls/version.h)
find_path(MBEDTLS_INCLUDE_DIR mbedtls/version.h)
IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARIES)
# Already in cache, be silent
SET(MBEDTLS_FIND_QUIETLY TRUE)
ENDIF()
if(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARIES)
# Already in cache, be silent
set(MBEDTLS_FIND_QUIETLY TRUE)
endif()
FIND_LIBRARY(MBEDTLS_LIBRARY NAMES mbedtls libmbedtls libmbedx509)
FIND_LIBRARY(MBEDX509_LIBRARY NAMES mbedx509 libmbedx509)
FIND_LIBRARY(MBEDCRYPTO_LIBRARY NAMES mbedcrypto libmbedcrypto)
find_library(MBEDTLS_LIBRARY NAMES mbedtls libmbedtls libmbedx509)
find_library(MBEDX509_LIBRARY NAMES mbedx509 libmbedx509)
find_library(MBEDCRYPTO_LIBRARY NAMES mbedcrypto libmbedcrypto)
IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY AND MBEDX509_LIBRARY AND MBEDCRYPTO_LIBRARY)
SET(MBEDTLS_FOUND TRUE)
ENDIF()
if(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY AND MBEDX509_LIBRARY AND MBEDCRYPTO_LIBRARY)
set(MBEDTLS_FOUND TRUE)
endif()
IF(MBEDTLS_FOUND)
# split mbedTLS into -L and -l linker options, so we can set them for pkg-config
GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_DIR ${MBEDTLS_LIBRARY} PATH)
GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY} NAME_WE)
GET_FILENAME_COMPONENT(MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY} NAME_WE)
GET_FILENAME_COMPONENT(MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY} NAME_WE)
STRING(REGEX REPLACE "^lib" "" MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY_FILE})
STRING(REGEX REPLACE "^lib" "" MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY_FILE})
STRING(REGEX REPLACE "^lib" "" MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY_FILE})
SET(MBEDTLS_LIBRARIES "-L${MBEDTLS_LIBRARY_DIR} -l${MBEDTLS_LIBRARY_FILE} -l${MBEDX509_LIBRARY_FILE} -l${MBEDCRYPTO_LIBRARY_FILE}")
if(MBEDTLS_FOUND)
# split mbedTLS into -L and -l linker options, so we can set them for pkg-config
get_filename_component(MBEDTLS_LIBRARY_DIR ${MBEDTLS_LIBRARY} PATH)
get_filename_component(MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY} NAME_WE)
get_filename_component(MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY} NAME_WE)
get_filename_component(MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY} NAME_WE)
string(REGEX REPLACE "^lib" "" MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY_FILE})
string(REGEX REPLACE "^lib" "" MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY_FILE})
string(REGEX REPLACE "^lib" "" MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY_FILE})
set(MBEDTLS_LIBRARIES "-L${MBEDTLS_LIBRARY_DIR} -l${MBEDTLS_LIBRARY_FILE} -l${MBEDX509_LIBRARY_FILE} -l${MBEDCRYPTO_LIBRARY_FILE}")
IF(NOT MBEDTLS_FIND_QUIETLY)
MESSAGE(STATUS "Found mbedTLS:")
FILE(READ ${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h MBEDTLSCONTENT)
STRING(REGEX MATCH "MBEDTLS_VERSION_STRING +\"[0-9|.]+\"" MBEDTLSMATCH ${MBEDTLSCONTENT})
IF (MBEDTLSMATCH)
STRING(REGEX REPLACE "MBEDTLS_VERSION_STRING +\"([0-9|.]+)\"" "\\1" MBEDTLS_VERSION ${MBEDTLSMATCH})
MESSAGE(STATUS " version ${MBEDTLS_VERSION}")
ENDIF(MBEDTLSMATCH)
MESSAGE(STATUS " TLS: ${MBEDTLS_LIBRARY}")
MESSAGE(STATUS " X509: ${MBEDX509_LIBRARY}")
MESSAGE(STATUS " Crypto: ${MBEDCRYPTO_LIBRARY}")
ENDIF(NOT MBEDTLS_FIND_QUIETLY)
ELSE(MBEDTLS_FOUND)
IF(MBEDTLS_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find mbedTLS")
ENDIF(MBEDTLS_FIND_REQUIRED)
ENDIF(MBEDTLS_FOUND)
if(NOT MBEDTLS_FIND_QUIETLY)
message(STATUS "Found mbedTLS:")
file(READ ${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h MBEDTLSCONTENT)
string(REGEX MATCH "MBEDTLS_VERSION_STRING +\"[0-9|.]+\"" MBEDTLSMATCH ${MBEDTLSCONTENT})
if(MBEDTLSMATCH)
string(REGEX REPLACE "MBEDTLS_VERSION_STRING +\"([0-9|.]+)\"" "\\1" MBEDTLS_VERSION ${MBEDTLSMATCH})
message(STATUS " version ${MBEDTLS_VERSION}")
endif()
message(STATUS " TLS: ${MBEDTLS_LIBRARY}")
message(STATUS " X509: ${MBEDX509_LIBRARY}")
message(STATUS " Crypto: ${MBEDCRYPTO_LIBRARY}")
endif()
elseif(MBEDTLS_FIND_REQUIRED)
message(FATAL_ERROR "Could not find mbedTLS")
endif()
MARK_AS_ADVANCED(
MBEDTLS_INCLUDE_DIR
MBEDTLS_LIBRARY_DIR
MBEDTLS_LIBRARIES
MBEDTLS_LIBRARY
MBEDX509_LIBRARY
MBEDCRYPTO_LIBRARY
mark_as_advanced(
MBEDTLS_INCLUDE_DIR
MBEDTLS_LIBRARY_DIR
MBEDTLS_LIBRARIES
MBEDTLS_LIBRARY
MBEDX509_LIBRARY
MBEDCRYPTO_LIBRARY
)

41
cmake/Findwolfssl.cmake Normal file
View File

@ -0,0 +1,41 @@
# - Try to find wolfssl
# Once done this will define
# WOLFSSL_FOUND - System has wolfssl
# WOLFSSL_INCLUDE_DIR - The wolfssl include directories
# WOLFSSL_LIBRARIES - The libraries needed to use wolfssl
find_package(PkgConfig QUIET)
pkg_check_modules(PC_WOLFSSL QUIET wolfssl)
find_path(WOLFSSL_INCLUDE_DIR
NAMES wolfssl/ssl.h
HINTS ${PC_WOLFSSL_INCLUDE_DIRS}
)
find_library(WOLFSSL_LIBRARY
NAMES wolfssl
HINTS ${PC_WOLFSSL_LIBRARY_DIRS}
)
if(WOLFSSL_INCLUDE_DIR)
set(_version_regex "^#define[ \t]+LIBWOLFSSL_VERSION_STRING[ \t]+\"([^\"]+)\".*")
file(STRINGS "${WOLFSSL_INCLUDE_DIR}/wolfssl/version.h"
WOLFSSL_VERSION REGEX "${_version_regex}")
string(REGEX REPLACE "${_version_regex}" "\\1"
WOLFSSL_VERSION "${WOLFSSL_VERSION}")
unset(_version_regex)
endif()
include(FindPackageHandleStandardArgs)
# handle the QUIETLY and REQUIRED arguments and set WOLFSSL_FOUND
# to TRUE if all listed variables are TRUE and the requested version
# matches.
find_package_handle_standard_args(wolfssl REQUIRED_VARS
WOLFSSL_LIBRARY WOLFSSL_INCLUDE_DIR
VERSION_VAR WOLFSSL_VERSION)
if(WOLFSSL_FOUND)
set(WOLFSSL_LIBRARIES ${WOLFSSL_LIBRARY})
set(WOLFSSL_INCLUDE_DIRS ${WOLFSSL_INCLUDE_DIR})
endif()
mark_as_advanced(WOLFSSL_INCLUDE_DIR WOLFSSL_LIBRARY)

View File

@ -1,64 +0,0 @@
# Copyright (c) 2014 Alexander Lamaison <alexander.lamaison@gmail.com>
#
# Redistribution and use in source and binary forms,
# with or without modification, are permitted provided
# that the following conditions are met:
#
# Redistributions of source code must retain the above
# copyright notice, this list of conditions and the
# following disclaimer.
#
# Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# Neither the name of the copyright holder nor the names
# of any other contributors may be used to endorse or
# promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
# OF SUCH DAMAGE.
# Some systems have their socket functions in a library.
# (Solaris -lsocket/-lnsl, Windows -lws2_32). This macro appends those
# libraries to the given list
macro(append_needed_socket_libraries LIBRARIES_LIST)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
# x86 Windows uses STDCALL for these functions, so their names are mangled,
# meaning the platform checks don't work. Hardcoding these until we get
# a better solution.
set(HAVE_SOCKET 1)
set(HAVE_SELECT 1)
set(HAVE_INET_ADDR 1)
set(NEED_LIB_WS2_32 1)
else()
check_function_exists_may_need_library(socket HAVE_SOCKET socket ws2_32)
check_function_exists_may_need_library(select HAVE_SELECT ws2_32)
check_function_exists_may_need_library(inet_addr HAVE_INET_ADDR nsl ws2_32)
endif()
if(NEED_LIB_SOCKET)
list(APPEND ${LIBRARIES_LIST} socket)
endif()
if(NEED_LIB_NSL)
list(APPEND ${LIBRARIES_LIST} nsl)
endif()
if(NEED_LIB_WS2_32)
list(APPEND ${LIBRARIES_LIST} ws2_32)
endif()
endmacro()

View File

@ -1,42 +0,0 @@
# Copyright (c) 2014 Alexander Lamaison <alexander.lamaison@gmail.com>
#
# Redistribution and use in source and binary forms,
# with or without modification, are permitted provided
# that the following conditions are met:
#
# Redistributions of source code must retain the above
# copyright notice, this list of conditions and the
# following disclaimer.
#
# Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following
# disclaimer in the documentation and/or other materials
# provided with the distribution.
#
# Neither the name of the copyright holder nor the names
# of any other contributors may be used to endorse or
# promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
# OF SUCH DAMAGE.
# Cross-compile 32-bit binary on 64-bit linux host
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)
set(CMAKE_SYSTEM_PROCESSOR "i386")
set(CMAKE_CXX_COMPILER_ARG1 "-m32")
set(CMAKE_C_COMPILER_ARG1 "-m32")

View File

@ -1,23 +1,211 @@
if(MSVC)
# Use the highest warning level for visual studio.
if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
if(CMAKE_C_FLAGS MATCHES "/W[0-4]")
string(REGEX REPLACE "/W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
endif()
# Copyright (c) 2023 Viktor Szakats
include(CheckCCompilerFlag)
option(ENABLE_WERROR "Turn compiler warnings into errors" OFF)
option(PICKY_COMPILER "Enable picky compiler options" ON)
if(ENABLE_WERROR)
if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
else() # llvm/clang and gcc style options
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
endif()
endif()
if(MSVC)
# Use the highest warning level for Visual Studio.
if(PICKY_COMPILER)
if(CMAKE_CXX_FLAGS MATCHES "[/-]W[0-4]")
string(REGEX REPLACE "[/-]W[0-4]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4")
endif()
if(CMAKE_C_FLAGS MATCHES "[/-]W[0-4]")
string(REGEX REPLACE "[/-]W[0-4]" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4")
endif()
endif()
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER_ID MATCHES "Clang")
# https://clang.llvm.org/docs/DiagnosticsReference.html
# https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
# Disable broken warnings
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
elseif(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()
if(NOT CMAKE_C_FLAGS MATCHES "-Wall")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
endif()
if(PICKY_COMPILER)
# WPICKY_ENABLE = Options we want to enable as-is.
# WPICKY_DETECT = Options we want to test first and enable if available.
# Prefer the -Wextra alias with clang.
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
set(WPICKY_ENABLE "-Wextra")
else()
set(WPICKY_ENABLE "-W")
endif()
list(APPEND WPICKY_ENABLE
-pedantic
)
# ----------------------------------
# Add new options here, if in doubt:
# ----------------------------------
set(WPICKY_DETECT
)
# Assume these options always exist with both clang and gcc.
# Require clang 3.0 / gcc 2.95 or later.
list(APPEND WPICKY_ENABLE
-Wbad-function-cast # clang 3.0 gcc 2.95
-Wconversion # clang 3.0 gcc 2.95
-Winline # clang 1.0 gcc 1.0
-Wmissing-declarations # clang 1.0 gcc 2.7
-Wmissing-prototypes # clang 1.0 gcc 1.0
-Wnested-externs # clang 1.0 gcc 2.7
-Wno-long-long # clang 1.0 gcc 2.95
-Wno-multichar # clang 1.0 gcc 2.95
-Wpointer-arith # clang 1.0 gcc 1.4
-Wshadow # clang 1.0 gcc 2.95
-Wsign-compare # clang 1.0 gcc 2.95
-Wundef # clang 1.0 gcc 2.95
-Wunused # clang 1.1 gcc 2.95
-Wwrite-strings # clang 1.0 gcc 1.4
)
# Always enable with clang, version dependent with gcc
set(WPICKY_COMMON_OLD
-Wcast-align # clang 1.0 gcc 4.2
-Wdeclaration-after-statement # clang 1.0 gcc 3.4
-Wempty-body # clang 3.0 gcc 4.3
-Wendif-labels # clang 1.0 gcc 3.3
-Wfloat-equal # clang 1.0 gcc 2.96 (3.0)
-Wignored-qualifiers # clang 3.0 gcc 4.3
-Wno-format-nonliteral # clang 1.0 gcc 2.96 (3.0)
-Wno-sign-conversion # clang 3.0 gcc 4.3
-Wno-system-headers # clang 1.0 gcc 3.0
-Wstrict-prototypes # clang 1.0 gcc 3.3
-Wtype-limits # clang 3.0 gcc 4.3
-Wvla # clang 2.8 gcc 4.3
)
set(WPICKY_COMMON
-Wdouble-promotion # clang 3.6 gcc 4.6 appleclang 6.3
-Wenum-conversion # clang 3.2 gcc 10.0 appleclang 4.6 g++ 11.0
-Wunused-const-variable # clang 3.4 gcc 6.0 appleclang 5.1
)
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
list(APPEND WPICKY_ENABLE
${WPICKY_COMMON_OLD}
-Wshift-sign-overflow # clang 2.9
-Wshorten-64-to-32 # clang 1.0
)
# Enable based on compiler version
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.6) OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.3))
list(APPEND WPICKY_ENABLE
${WPICKY_COMMON}
)
endif()
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 3.9) OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.3))
list(APPEND WPICKY_ENABLE
-Wcomma # clang 3.9 appleclang 8.3
-Wmissing-variable-declarations # clang 3.2 appleclang 4.6
)
endif()
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) OR
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.3))
list(APPEND WPICKY_ENABLE
-Wassign-enum # clang 7.0 appleclang 10.3
-Wextra-semi-stmt # clang 7.0 appleclang 10.3
)
endif()
else() # gcc
list(APPEND WPICKY_DETECT
${WPICKY_COMMON}
)
# Enable based on compiler version
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.3)
list(APPEND WPICKY_ENABLE
${WPICKY_COMMON_OLD}
-Wmissing-parameter-type # gcc 4.3
-Wold-style-declaration # gcc 4.3
-Wstrict-aliasing=3 # gcc 4.0
)
endif()
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5 AND MINGW)
list(APPEND WPICKY_ENABLE
-Wno-pedantic-ms-format # gcc 4.5 (mingw-only)
)
endif()
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8)
list(APPEND WPICKY_ENABLE
-Wformat=2 # clang 3.0 gcc 4.8 (clang part-default, enabling it fully causes -Wformat-nonliteral warnings)
)
endif()
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0)
list(APPEND WPICKY_ENABLE
-Warray-bounds=2 -ftree-vrp # clang 3.0 gcc 5.0 (clang default: -Warray-bounds)
)
endif()
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0)
list(APPEND WPICKY_ENABLE
-Wduplicated-cond # gcc 6.0
-Wnull-dereference # clang 3.0 gcc 6.0 (clang default)
-fdelete-null-pointer-checks
-Wshift-negative-value # clang 3.7 gcc 6.0 (clang default)
-Wshift-overflow=2 # clang 3.0 gcc 6.0 (clang default: -Wshift-overflow)
)
endif()
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0)
list(APPEND WPICKY_ENABLE
-Walloc-zero # gcc 7.0
-Wduplicated-branches # gcc 7.0
-Wformat-overflow=2 # gcc 7.0
-Wformat-truncation=1 # gcc 7.0
-Wrestrict # gcc 7.0
)
endif()
if(NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0)
list(APPEND WPICKY_ENABLE
-Warith-conversion # gcc 10.0
)
endif()
endif()
#
unset(WPICKY)
foreach(_CCOPT ${WPICKY_ENABLE})
set(WPICKY "${WPICKY} ${_CCOPT}")
endforeach()
foreach(_CCOPT ${WPICKY_DETECT})
# surprisingly, CHECK_C_COMPILER_FLAG needs a new variable to store each new
# test result in.
string(MAKE_C_IDENTIFIER "OPT${_CCOPT}" _optvarname)
# GCC only warns about unknown -Wno- options if there are also other diagnostic messages,
# so test for the positive form instead
string(REPLACE "-Wno-" "-W" _CCOPT_ON "${_CCOPT}")
check_c_compiler_flag(${_CCOPT_ON} ${_optvarname})
if(${_optvarname})
set(WPICKY "${WPICKY} ${_CCOPT}")
endif()
endforeach()
message(STATUS "Picky compiler options:${WPICKY}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WPICKY}")
endif()
endif()

View File

@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify

1500
config.guess vendored

File diff suppressed because it is too large Load Diff

2855
config.sub vendored

File diff suppressed because it is too large Load Diff

4726
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,9 @@
# AC_PREREQ(2.57)
AC_INIT(libssh2, [-], libssh2-devel@cool.haxx.se)
# AC_PREREQ(2.59)
AC_INIT([libssh2],[-],[libssh2-devel@lists.haxx.se])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src])
AC_CONFIG_HEADERS([src/libssh2_config.h])
AC_REQUIRE_AUX_FILE([tap-driver.sh])
AM_MAINTAINER_MODE
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
@ -33,11 +34,9 @@ AB_INIT
AC_CANONICAL_HOST
case "$host" in
*-mingw*)
CFLAGS="$CFLAGS -DLIBSSH2_WIN32"
LIBS="$LIBS -lws2_32"
;;
*darwin*)
CFLAGS="$CFLAGS -DLIBSSH2_DARWIN"
;;
*hpux*)
;;
@ -48,12 +47,6 @@ case "$host" in
;;
esac
AC_CHECK_TYPE(long long,
[AC_DEFINE(HAVE_LONGLONG, 1,
[Define to 1 if the compiler supports the 'long long' data type.])]
longlong="yes"
)
dnl Our configure and build reentrant settings
CURL_CONFIGURE_REENTRANT
@ -74,10 +67,17 @@ AC_PATH_PROGS(SSHD, [sshd], [],
[$PATH$PATH_SEPARATOR/usr/libexec$PATH_SEPARATOR]dnl
[/usr/sbin$PATH_SEPARATOR/usr/etc$PATH_SEPARATOR/etc])
AM_CONDITIONAL(SSHD, test -n "$SSHD")
m4_ifdef([LT_INIT],
[dnl
LT_INIT([win32-dll])
],[dnl
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
])
AC_C_BIGENDIAN
LT_LANG([Windows Resource])
dnl check for how to do large files
AC_SYS_LARGEFILE
@ -85,16 +85,16 @@ AC_SYS_LARGEFILE
found_crypto=none
found_crypto_str=""
support_clear_memory=no
crypto_errors=""
m4_set_add([crypto_backends], [openssl])
m4_set_add([crypto_backends], [libgcrypt])
m4_set_add([crypto_backends], [mbedtls])
m4_set_add([crypto_backends], [wincng])
m4_set_add([crypto_backends], [wolfssl])
AC_ARG_WITH([crypto],
AC_HELP_STRING([--with-crypto=auto|]m4_set_contents([crypto_backends], [|]),
AS_HELP_STRING([--with-crypto=auto|]m4_set_contents([crypto_backends], [|]),
[Select crypto backend (default: auto)]),
use_crypto=$withval,
use_crypto=auto
@ -114,7 +114,7 @@ esac
if test "$found_crypto" = "none"; then
crypto_errors="${crypto_errors}
Specify --with-crypto=\$backend and/or the neccessary library search prefix.
Specify --with-crypto=\$backend and/or the necessary library search prefix.
Known crypto backends: auto, m4_set_contents([crypto_backends], [, ])"
AS_MESSAGE([ERROR: ${crypto_errors}])
@ -122,14 +122,10 @@ else
test "$found_crypto_str" = "" && found_crypto_str="$found_crypto"
fi
m4_set_foreach([crypto_backends], [backend],
[AM_CONDITIONAL(m4_toupper(backend), test "$found_crypto" = "backend")]
)
# libz
AC_ARG_WITH([libz],
AC_HELP_STRING([--with-libz],[Use libz for compression]),
AS_HELP_STRING([--with-libz],[Use libz for compression]),
use_libz=$withval,
use_libz=auto)
@ -159,43 +155,14 @@ AC_SUBST(LIBSREQUIRED)
#
# Optional Settings
#
AC_ARG_ENABLE(crypt-none,
AC_HELP_STRING([--enable-crypt-none],[Permit "none" cipher -- NOT RECOMMENDED]),
[AC_DEFINE(LIBSSH2_CRYPT_NONE, 1, [Enable "none" cipher -- NOT RECOMMENDED])])
AC_ARG_ENABLE(mac-none,
AC_HELP_STRING([--enable-mac-none],[Permit "none" MAC -- NOT RECOMMENDED]),
[AC_DEFINE(LIBSSH2_MAC_NONE, 1, [Enable "none" MAC -- NOT RECOMMENDED])])
AC_ARG_ENABLE(gex-new,
AC_HELP_STRING([--disable-gex-new],[Disable "new" diffie-hellman-group-exchange-sha1 method]),
[GEX_NEW=$enableval])
if test "$GEX_NEW" != "no"; then
AC_DEFINE(LIBSSH2_DH_GEX_NEW, 1, [Enable newer diffie-hellman-group-exchange-sha1 syntax])
fi
AC_ARG_ENABLE(clear-memory,
AC_HELP_STRING([--disable-clear-memory],[Disable clearing of memory before being freed]),
AS_HELP_STRING([--disable-clear-memory],[Disable clearing of memory before being freed]),
[CLEAR_MEMORY=$enableval])
if test "$CLEAR_MEMORY" != "no"; then
if test "$support_clear_memory" = "yes"; then
AC_DEFINE(LIBSSH2_CLEAR_MEMORY, 1, [Enable clearing of memory before being freed])
enable_clear_memory=yes
else
if test "$CLEAR_MEMORY" = "yes"; then
AC_MSG_ERROR([secure clearing/zeroing of memory is not supported by the selected crypto backend])
else
AC_MSG_WARN([secure clearing/zeroing of memory is not supported by the selected crypto backend])
fi
enable_clear_memory=unsupported
fi
if test "$CLEAR_MEMORY" = "no"; then
AC_DEFINE(LIBSSH2_NO_CLEAR_MEMORY, 1, [Disable clearing of memory before being freed])
enable_clear_memory=no
else
if test "$support_clear_memory" = "yes"; then
enable_clear_memory=no
else
AC_MSG_WARN([secure clearing/zeroing of memory is not supported by the selected crypto backend])
enable_clear_memory=unsupported
fi
enable_clear_memory=yes
fi
dnl ************************************************************
@ -203,8 +170,8 @@ dnl option to switch on compiler debug options
dnl
AC_MSG_CHECKING([whether to enable pedantic and debug compiler options])
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[Enable pedantic and debug options])
AC_HELP_STRING([--disable-debug],[Disable debug options]),
AS_HELP_STRING([--enable-debug],[Enable pedantic and debug options])
AS_HELP_STRING([--disable-debug],[Disable debug options]),
[ case "$enable_debug" in
no)
AC_MSG_RESULT(no)
@ -232,8 +199,8 @@ dnl on gcc >= 4.0 and SunPro C.
dnl
AC_MSG_CHECKING([whether to enable hidden symbols in the library])
AC_ARG_ENABLE(hidden-symbols,
AC_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
AS_HELP_STRING([--enable-hidden-symbols],[Hide internal symbols in library])
AS_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibility in library]),
[ case "$enableval" in
no)
AC_MSG_RESULT(no)
@ -264,11 +231,36 @@ AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibi
AC_MSG_RESULT(no)
)
# Build tests?
AC_ARG_ENABLE([tests],
[AS_HELP_STRING([--disable-tests], [Disable tests @<:@default=enabled@:>@])],
[
if ! test "x${enable_tests}" = "xyes"; then
enable_tests="no"
fi
],
[enable_tests="yes"])
AM_CONDITIONAL([ENABLE_TESTS], [test "x$enable_tests" = xyes])
# Run Docker tests?
AC_ARG_ENABLE([docker-tests],
[AS_HELP_STRING([--disable-docker-tests],
[Do not run tests requiring Docker])],
[run_docker_tests=no], [run_docker_tests=yes])
AM_CONDITIONAL([RUN_DOCKER_TESTS], [test "x$run_docker_tests" != "xno"])
# Run sshd tests?
AC_ARG_ENABLE([sshd-tests],
[AS_HELP_STRING([--disable-sshd-tests],
[Do not run tests requiring sshd])],
[run_sshd_tests=no], [run_sshd_tests=yes])
AM_CONDITIONAL([RUN_SSHD_TESTS], [test "x$run_sshd_tests" != "xno"])
# Build example applications?
AC_MSG_CHECKING([whether to build example applications])
AC_ARG_ENABLE([examples-build],
AC_HELP_STRING([--enable-examples-build], [Build example applications (this is the default)])
AC_HELP_STRING([--disable-examples-build], [Do not build example applications]),
AS_HELP_STRING([--enable-examples-build], [Build example applications (this is the default)])
AS_HELP_STRING([--disable-examples-build], [Do not build example applications]),
[case "$enableval" in
no | false)
build_examples='no'
@ -296,19 +288,17 @@ AM_CONDITIONAL([USE_OSSFUZZ_STATIC], [test -f "$LIB_FUZZING_ENGINE"])
# Checks for header files.
# AC_HEADER_STDC
AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h])
AC_CHECK_HEADERS([errno.h fcntl.h stdio.h unistd.h sys/param.h sys/uio.h])
AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/ioctl.h sys/time.h])
AC_CHECK_HEADERS([arpa/inet.h netinet/in.h])
AC_CHECK_HEADERS([sys/un.h], [have_sys_un_h=yes], [have_sys_un_h=no])
AM_CONDITIONAL([HAVE_SYS_UN_H], test "x$have_sys_un_h" = xyes)
AC_CHECK_HEADERS([sys/un.h])
case $host in
*-*-cygwin* | *-*-cegcc*)
# These are POSIX-like systems using BSD-like sockets API.
;;
*)
AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h])
AC_CHECK_HEADERS([windows.h], [have_windows_h=yes], [have_windows_h=no])
;;
esac
@ -318,7 +308,7 @@ case $host in
dnl Interix: "does provide poll(), but the implementing developer must
dnl have been in a bad mood, because poll() only works on the /proc
dnl filesystem here"
dnl Mac OS X's poll has funny behaviors, like:
dnl macOS poll() has funny behaviors, like:
dnl not being able to do poll on no fildescriptors (10.3?)
dnl not being able to poll on some files (like anything in /dev)
dnl not having reliable timeout support
@ -330,21 +320,21 @@ case $host in
;;
esac
AC_CHECK_FUNCS(gettimeofday select strtoll memset_s)
AC_CHECK_FUNCS(gettimeofday select strtoll explicit_bzero explicit_memset memset_s snprintf)
dnl Check for select() into ws2_32 for Msys/Mingw
if test "$ac_cv_func_select" != "yes"; then
AC_MSG_CHECKING([for select in ws2_32])
AC_TRY_LINK([
#ifdef HAVE_WINSOCK2_H
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#ifdef HAVE_WINDOWS_H
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <winsock2.h>
#endif
],[
]], [[
select(0,(fd_set *)NULL,(fd_set *)NULL,(fd_set *)NULL,(struct timeval *)NULL);
],[
]])],[
AC_MSG_RESULT([yes])
HAVE_SELECT="1"
AC_DEFINE_UNQUOTED(HAVE_SELECT, 1,
@ -378,9 +368,25 @@ if test $missing_required_deps = 1; then
AC_MSG_ERROR([Required dependencies are missing!])
fi
AM_CONDITIONAL([HAVE_WINDRES],
[test "x$have_windows_h" = "xyes" && test "x${enable_shared}" = "xyes" && test -n "${RC}"])
# Configure parameters
LIBSSH2_CHECK_OPTION_WERROR
# Append crypto lib
if test "$found_crypto" = "openssl"; then
LIBS="${LIBS} ${LTLIBSSL}"
elif test "$found_crypto" = "wolfssl"; then
LIBS="${LIBS} ${LTLIBWOLFSSL}"
elif test "$found_crypto" = "libgcrypt"; then
LIBS="${LIBS} ${LTLIBGCRYPT}"
elif test "$found_crypto" = "wincng"; then
LIBS="${LIBS} ${LTLIBBCRYPT}"
elif test "$found_crypto" = "mbedtls"; then
LIBS="${LIBS} ${LTLIBMBEDCRYPTO}"
fi
AC_CONFIG_FILES([Makefile
src/Makefile
tests/Makefile
@ -399,9 +405,11 @@ AC_MSG_NOTICE([summary of build options:
Compiler flags: ${CFLAGS}
Library types: Shared=${enable_shared}, Static=${enable_static}
Crypto library: ${found_crypto_str}
zlib compression: ${found_libz}
Clear memory: $enable_clear_memory
Debug build: $enable_debug
Build examples: $build_examples
Run Docker tests: $run_docker_tests
Run sshd tests: $run_sshd_tests
Path to sshd: $ac_cv_path_SSHD (only for self-tests)
zlib compression: ${found_libz}
])

View File

@ -1,8 +0,0 @@
libssh2 for Debian
Please edit this to provide information specific to
this libssh2 Debian package.
(Automatically generated by debmake Version 4.3.1)
-- Luoyaoming <luoyaoming@kylinos.cn> Fri, 09 Dec 2022 09:50:06 +0800

6
debian/changelog vendored
View File

@ -1,6 +0,0 @@
libssh2 (1.10.0-ok1) yangtze; urgency=low
* Initial release
-- Luoyaoming <luoyaoming@kylinos.cn> Fri, 09 Dec 2022 09:50:06 +0800

42
debian/control vendored
View File

@ -1,42 +0,0 @@
Source: libssh2
Section: libs
Priority: optional
Maintainer: Openkylin Developers <packaging@lists.openkylin.top>
Build-Depends: debhelper-compat (= 13)
, libssl-dev
, zlib1g-dev
, chrpath
, openssh-server
Standards-Version: 4.6.0
Homepage: https://libssh2.org/
Rules-Requires-Root: no
Vcs-Browser: https://gitee/openkylin/libssh2
Vcs-Git: https://gitee/openkylin/libssh2.git
Package: libssh2-1
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Pre-Depends: ${misc:Pre-Depends}
Multi-Arch: same
Description: SSH2 client-side library
libssh2 is a client-side C library implementing the SSH2 protocol.
It supports regular terminal, SCP and SFTP (v1-v5) sessions;
port forwarding, X11 forwarding; password, key-based and
keyboard-interactive authentication.
.
This package contains the runtime library.
Package: libssh2-1-dev
Section: libdevel
Architecture: any
Depends: libssh2-1 (= ${binary:Version}), ${misc:Depends}
, libssl-dev
, zlib1g-dev
Multi-Arch: same
Description: SSH2 client-side library (development headers)
libssh2 is a client-side C library implementing the SSH2 protocol.
It supports regular terminal, SCP and SFTP (v1-v5) sessions;
port forwarding, X11 forwarding; password, key-based and
keyboard-interactive authentication.
.
This package contains the development files.

1084
debian/copyright vendored

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
README

View File

@ -1,3 +0,0 @@
example/*.c
example/*.h.in
example/Makefile*

View File

@ -1,4 +0,0 @@
usr/include/*
usr/lib/*/*.a
usr/lib/*/*.so
usr/lib/*/pkgconfig/*.pc

View File

@ -1 +0,0 @@
usr/share/man/man3/libssh2*.3

View File

@ -1,2 +0,0 @@
docs/AUTHORS
RELEASE-NOTES

View File

@ -1 +0,0 @@
usr/lib/*/*.so.*

View File

@ -1,132 +0,0 @@
# SymbolsHelper-Confirmed: 1.10.0 amd64
libssh2.so.1 libssh2-1 #MINVER#
* Build-Depends-Package: libssh2-1-dev
libssh2_agent_connect@Base 1.2.3
libssh2_agent_disconnect@Base 1.2.3
libssh2_agent_free@Base 1.2.3
libssh2_agent_get_identity@Base 1.2.3
libssh2_agent_get_identity_path@Base 1.9.0
libssh2_agent_init@Base 1.2.3
libssh2_agent_list_identities@Base 1.2.3
libssh2_agent_set_identity_path@Base 1.9.0
libssh2_agent_userauth@Base 1.2.3
libssh2_banner_set@Base 1.0
libssh2_base64_decode@Base 1.0
libssh2_channel_close@Base 1.0
libssh2_channel_direct_tcpip_ex@Base 1.0
libssh2_channel_eof@Base 1.0
libssh2_channel_flush_ex@Base 1.0
libssh2_channel_forward_accept@Base 1.0
libssh2_channel_forward_cancel@Base 1.0
libssh2_channel_forward_listen_ex@Base 1.0
libssh2_channel_free@Base 1.0
libssh2_channel_get_exit_signal@Base 1.2.8
libssh2_channel_get_exit_status@Base 1.0
libssh2_channel_handle_extended_data2@Base 1.0
libssh2_channel_handle_extended_data@Base 1.0
libssh2_channel_open_ex@Base 1.0
libssh2_channel_process_startup@Base 1.0
libssh2_channel_read_ex@Base 1.0
libssh2_channel_receive_window_adjust2@Base 1.1
libssh2_channel_receive_window_adjust@Base 1.0
libssh2_channel_request_auth_agent@Base 1.10
libssh2_channel_request_pty_ex@Base 1.0
libssh2_channel_request_pty_size_ex@Base 1.0
libssh2_channel_send_eof@Base 1.0
libssh2_channel_set_blocking@Base 1.0
libssh2_channel_setenv_ex@Base 1.0
libssh2_channel_wait_closed@Base 1.0
libssh2_channel_wait_eof@Base 1.0
libssh2_channel_window_read_ex@Base 1.0
libssh2_channel_window_write_ex@Base 1.0
libssh2_channel_write_ex@Base 1.0
libssh2_channel_x11_req_ex@Base 1.0
libssh2_crypt_methods@Base 1.0
libssh2_exit@Base 1.2.5
libssh2_free@Base 1.2.8
libssh2_hostkey_hash@Base 1.0
libssh2_hostkey_methods@Base 1.0
libssh2_init@Base 1.2.5
libssh2_keepalive_config@Base 1.2.5
libssh2_keepalive_send@Base 1.2.5
libssh2_knownhost_add@Base 1.2
libssh2_knownhost_addc@Base 1.2.5
libssh2_knownhost_check@Base 1.2
libssh2_knownhost_checkp@Base 1.2.6
libssh2_knownhost_del@Base 1.2
libssh2_knownhost_free@Base 1.2
libssh2_knownhost_get@Base 1.2
libssh2_knownhost_init@Base 1.2
libssh2_knownhost_readfile@Base 1.2
libssh2_knownhost_readline@Base 1.2
libssh2_knownhost_writefile@Base 1.2
libssh2_knownhost_writeline@Base 1.2
libssh2_poll@Base 1.0
libssh2_poll_channel_read@Base 1.0
libssh2_publickey_add_ex@Base 1.0
libssh2_publickey_init@Base 1.0
libssh2_publickey_list_fetch@Base 1.0
libssh2_publickey_list_free@Base 1.0
libssh2_publickey_remove_ex@Base 1.0
libssh2_publickey_shutdown@Base 1.0
libssh2_scp_recv@Base 1.0
libssh2_scp_recv2@Base 1.7.0
libssh2_scp_send64@Base 1.2.6
libssh2_scp_send_ex@Base 1.0
libssh2_session_abstract@Base 1.0
libssh2_session_banner_get@Base 1.4.0
libssh2_session_banner_set@Base 1.4.0
libssh2_session_block_directions@Base 1.0
libssh2_session_callback_set@Base 1.0
libssh2_session_disconnect_ex@Base 1.0
libssh2_session_flag@Base 1.0
libssh2_session_free@Base 1.0
libssh2_session_get_blocking@Base 1.0
libssh2_session_get_timeout@Base 1.2.9
libssh2_session_handshake@Base 1.2.8
libssh2_session_hostkey@Base 1.2
libssh2_session_init_ex@Base 1.0
libssh2_session_last_errno@Base 1.0
libssh2_session_last_error@Base 1.0
libssh2_session_method_pref@Base 1.0
libssh2_session_methods@Base 1.0
libssh2_session_set_blocking@Base 1.0
libssh2_session_set_last_error@Base 1.7.0
libssh2_session_set_timeout@Base 1.2.9
libssh2_session_startup@Base 1.0
libssh2_session_supported_algs@Base 1.4.0
libssh2_sftp_close_handle@Base 1.0
libssh2_sftp_dtor@Base 1.0
libssh2_sftp_fstat_ex@Base 1.0
libssh2_sftp_fstatvfs@Base 1.2.6
libssh2_sftp_fsync@Base 1.5.0
libssh2_sftp_get_channel@Base 1.4.0
libssh2_sftp_init@Base 1.0
libssh2_sftp_last_error@Base 1.0
libssh2_sftp_mkdir_ex@Base 1.0
libssh2_sftp_open_ex@Base 1.0
libssh2_sftp_read@Base 1.0
libssh2_sftp_readdir_ex@Base 1.0
libssh2_sftp_rename_ex@Base 1.0
libssh2_sftp_rmdir_ex@Base 1.0
libssh2_sftp_seek64@Base 1.0
libssh2_sftp_seek@Base 1.0
libssh2_sftp_shutdown@Base 1.0
libssh2_sftp_stat_ex@Base 1.0
libssh2_sftp_statvfs@Base 1.2.
libssh2_sftp_symlink_ex@Base 1.0
libssh2_sftp_tell64@Base 1.0
libssh2_sftp_tell@Base 1.0
libssh2_sftp_unlink_ex@Base 1.0
libssh2_sftp_write@Base 1.0
libssh2_trace@Base 1.0
libssh2_trace_sethandler@Base 1.2.3
libssh2_userauth_authenticated@Base 1.0
libssh2_userauth_hostbased_fromfile_ex@Base 1.0
libssh2_userauth_publickey_frommemory@Base 1.7.0
libssh2_userauth_keyboard_interactive_ex@Base 1.0
libssh2_userauth_list@Base 1.0
libssh2_userauth_password_ex@Base 1.0
libssh2_userauth_publickey@Base 1.2.3
libssh2_userauth_publickey_fromfile_ex@Base 1.0
libssh2_version@Base 1.1

5
debian/man vendored
View File

@ -1,5 +0,0 @@
#!/bin/sh
# Stub to avoid running mansyntax.sh test
exit 0

View File

@ -1 +0,0 @@
usr/lib/*/*.la

29
debian/rules vendored
View File

@ -1,29 +0,0 @@
#!/usr/bin/make -f
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
# openssl license issue has been fixed: #668271, #924937
#CONFIGURE_EXTRA_FLAGS += --with-libgcrypt --without-openssl
CONFIGURE_EXTRA_FLAGS += --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)
CONFIGURE_EXTRA_FLAGS += --disable-rpath
%:
dh $@ --with autoreconf
override_dh_auto_configure:
dh_auto_configure -- $(CONFIGURE_EXTRA_FLAGS)
override_dh_installexamples:
dh_installexamples -a -X .deps -X Makefile -X .gitignore
override_dh_installchangelogs:
dh_installchangelogs NEWS
#
# mansyntax.sh test duplicates functionality of debhelper and requires presence
# of en_US.utf8 locale. Ensure it is not run by providing a fake man(1) tool.
#
override_dh_auto_test:
PATH=$(CURDIR)/debian:$$PATH dh_auto_test -a

View File

@ -1 +0,0 @@
3.0 (native)

View File

@ -1,2 +0,0 @@
Tests: unit-test
Depends: @, gcc, libc-dev, autoconf, libssl-dev, zlib1g-dev, chrpath, openssh-server

View File

@ -1,16 +0,0 @@
#!/bin/sh
set -e
exec 2>&1
./configure --disable-static --disable-rpath
make
rm -f src/.libs/libssh2.so*
ln -s /usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)/libssh2.so src/.libs/
ln -s /usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)/libssh2.so.? src/.libs/
ln -s /usr/lib/$(dpkg-architecture -qDEB_BUILD_MULTIARCH)/libssh2.so.?.?.? src/.libs/
make check

View File

@ -1,4 +0,0 @@
Bug-Database: https://github.com/libssh2/libssh2/issues
Bug-Submit: https://github.com/libssh2/libssh2/issues/new
Repository: https://github.com/libssh2/libssh2.git
Repository-Browse: https://github.com/libssh2/libssh2

3
debian/watch vendored
View File

@ -1,3 +0,0 @@
version=4
https://www.libssh2.org/download/libssh2-(.+)\.tar\.gz
pgpmode=auto

View File

@ -3,7 +3,7 @@
scriptversion=2018-03-07.03; # UTC
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
# Copyright (C) 1999-2021 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

View File

@ -1,5 +1,5 @@
libssh2 is the result of many friendly people. This list is an attempt to
mention all contributors. If we've missed anyone, tell us!
mention all contributors. If we have missed anyone, tell us!
This list of names is a-z sorted.
@ -71,6 +71,7 @@ Steven Van Ingelgem
TJ Saunders
Tommy Lindgren
Tor Arntsen
Viktor Szakats
Vincent Jaulin
Vincent Torri
Vlad Grachov

View File

@ -1,29 +0,0 @@
Creative people have written bindings or interfaces for various environments
and programming languages. Using one of these bindings allows you to take
advantage of libssh2 directly from within your favourite language.
The bindings listed below are not part of the libssh2 distribution archives,
but must be downloaded and installed separately.
Cocoa/Objective-C
https://github.com/karelia/libssh2_sftp-Cocoa-wrapper
Haskell
FFI bindings - https://hackage.haskell.org/package/libssh2
Perl
Net::SSH2 - https://metacpan.org/pod/Net::SSH2
PHP
ssh2 - https://pecl.php.net/package/ssh2
Python
pylibssh2 - https://pypi.python.org/pypi/pylibssh2
Python-ctypes
PySsh2 - https://github.com/gellule/PySsh2
Ruby
libssh2-ruby - https://github.com/mitchellh/libssh2-ruby

25
docs/BINDINGS.md Normal file
View File

@ -0,0 +1,25 @@
libssh2 bindings
================
Creative people have written bindings or interfaces for various environments
and programming languages. Using one of these bindings allows you to take
advantage of libssh2 directly from within your favourite language.
The bindings listed below are not part of the libssh2 distribution archives,
but must be downloaded and installed separately.
<!-- markdown-link-check-disable -->
[Cocoa/Objective-C](https://github.com/karelia/libssh2_sftp-Cocoa-wrapper)
[Haskell FFI bindings](https://hackage.haskell.org/package/libssh2)
[Perl Net::SSH2](https://metacpan.org/pod/Net::SSH2)
[PHP ssh2](https://pecl.php.net/package/ssh2)
[Python pylibssh2](https://pypi.python.org/pypi/pylibssh2)
[Python-ctypes PySsh2](https://github.com/gellule/PySsh2)
[Ruby libssh2-ruby](https://github.com/mitchellh/libssh2-ruby)

View File

@ -1,4 +1,5 @@
# Copyright (c) 2014 Alexander Lamaison <alexander.lamaison@gmail.com>
# Copyright (c) 2023 Viktor Szakats
#
# Redistribution and use in source and binary forms,
# with or without modification, are permitted provided
@ -33,178 +34,9 @@
# USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
# OF SUCH DAMAGE.
set(MAN_PAGES
libssh2_agent_connect.3
libssh2_agent_disconnect.3
libssh2_agent_free.3
libssh2_agent_get_identity.3
libssh2_agent_get_identity_path.3
libssh2_agent_init.3
libssh2_agent_list_identities.3
libssh2_agent_set_identity_path.3
libssh2_agent_userauth.3
libssh2_banner_set.3
libssh2_base64_decode.3
libssh2_channel_close.3
libssh2_channel_direct_tcpip.3
libssh2_channel_direct_tcpip_ex.3
libssh2_channel_eof.3
libssh2_channel_exec.3
libssh2_channel_flush.3
libssh2_channel_flush_ex.3
libssh2_channel_flush_stderr.3
libssh2_channel_forward_accept.3
libssh2_channel_forward_cancel.3
libssh2_channel_forward_listen.3
libssh2_channel_forward_listen_ex.3
libssh2_channel_free.3
libssh2_channel_get_exit_signal.3
libssh2_channel_get_exit_status.3
libssh2_channel_handle_extended_data.3
libssh2_channel_handle_extended_data2.3
libssh2_channel_ignore_extended_data.3
libssh2_channel_open_ex.3
libssh2_channel_open_session.3
libssh2_channel_process_startup.3
libssh2_channel_read.3
libssh2_channel_read_ex.3
libssh2_channel_read_stderr.3
libssh2_channel_receive_window_adjust.3
libssh2_channel_receive_window_adjust2.3
libssh2_channel_request_pty.3
libssh2_channel_request_pty_ex.3
libssh2_channel_request_pty_size.3
libssh2_channel_request_pty_size_ex.3
libssh2_channel_send_eof.3
libssh2_channel_set_blocking.3
libssh2_channel_setenv.3
libssh2_channel_setenv_ex.3
libssh2_channel_shell.3
libssh2_channel_subsystem.3
libssh2_channel_wait_closed.3
libssh2_channel_wait_eof.3
libssh2_channel_window_read.3
libssh2_channel_window_read_ex.3
libssh2_channel_window_write.3
libssh2_channel_window_write_ex.3
libssh2_channel_write.3
libssh2_channel_write_ex.3
libssh2_channel_write_stderr.3
libssh2_channel_x11_req.3
libssh2_channel_x11_req_ex.3
libssh2_exit.3
libssh2_free.3
libssh2_hostkey_hash.3
libssh2_init.3
libssh2_keepalive_config.3
libssh2_keepalive_send.3
libssh2_knownhost_add.3
libssh2_knownhost_addc.3
libssh2_knownhost_check.3
libssh2_knownhost_checkp.3
libssh2_knownhost_del.3
libssh2_knownhost_free.3
libssh2_knownhost_get.3
libssh2_knownhost_init.3
libssh2_knownhost_readfile.3
libssh2_knownhost_readline.3
libssh2_knownhost_writefile.3
libssh2_knownhost_writeline.3
libssh2_poll.3
libssh2_poll_channel_read.3
libssh2_publickey_add.3
libssh2_publickey_add_ex.3
libssh2_publickey_init.3
libssh2_publickey_list_fetch.3
libssh2_publickey_list_free.3
libssh2_publickey_remove.3
libssh2_publickey_remove_ex.3
libssh2_publickey_shutdown.3
libssh2_scp_recv.3
libssh2_scp_recv2.3
libssh2_scp_send.3
libssh2_scp_send64.3
libssh2_scp_send_ex.3
libssh2_session_abstract.3
libssh2_session_banner_get.3
libssh2_session_banner_set.3
libssh2_session_block_directions.3
libssh2_session_callback_set.3
libssh2_session_disconnect.3
libssh2_session_disconnect_ex.3
libssh2_session_flag.3
libssh2_session_free.3
libssh2_session_get_blocking.3
libssh2_session_get_timeout.3
libssh2_session_handshake.3
libssh2_session_hostkey.3
libssh2_session_init.3
libssh2_session_init_ex.3
libssh2_session_last_errno.3
libssh2_session_last_error.3
libssh2_session_set_last_error.3
libssh2_session_method_pref.3
libssh2_session_methods.3
libssh2_session_set_blocking.3
libssh2_session_set_timeout.3
libssh2_session_startup.3
libssh2_session_supported_algs.3
libssh2_sftp_close.3
libssh2_sftp_close_handle.3
libssh2_sftp_closedir.3
libssh2_sftp_fsetstat.3
libssh2_sftp_fstat.3
libssh2_sftp_fstat_ex.3
libssh2_sftp_fstatvfs.3
libssh2_sftp_fsync.3
libssh2_sftp_get_channel.3
libssh2_sftp_init.3
libssh2_sftp_last_error.3
libssh2_sftp_lstat.3
libssh2_sftp_mkdir.3
libssh2_sftp_mkdir_ex.3
libssh2_sftp_open.3
libssh2_sftp_open_ex.3
libssh2_sftp_opendir.3
libssh2_sftp_read.3
libssh2_sftp_readdir.3
libssh2_sftp_readdir_ex.3
libssh2_sftp_readlink.3
libssh2_sftp_realpath.3
libssh2_sftp_rename.3
libssh2_sftp_rename_ex.3
libssh2_sftp_rewind.3
libssh2_sftp_rmdir.3
libssh2_sftp_rmdir_ex.3
libssh2_sftp_seek.3
libssh2_sftp_seek64.3
libssh2_sftp_setstat.3
libssh2_sftp_shutdown.3
libssh2_sftp_stat.3
libssh2_sftp_stat_ex.3
libssh2_sftp_statvfs.3
libssh2_sftp_symlink.3
libssh2_sftp_symlink_ex.3
libssh2_sftp_tell.3
libssh2_sftp_tell64.3
libssh2_sftp_unlink.3
libssh2_sftp_unlink_ex.3
libssh2_sftp_write.3
libssh2_trace.3
libssh2_trace_sethandler.3
libssh2_userauth_authenticated.3
libssh2_userauth_hostbased_fromfile.3
libssh2_userauth_hostbased_fromfile_ex.3
libssh2_userauth_keyboard_interactive.3
libssh2_userauth_keyboard_interactive_ex.3
libssh2_userauth_list.3
libssh2_userauth_password.3
libssh2_userauth_password_ex.3
libssh2_userauth_publickey.3
libssh2_userauth_publickey_fromfile.3
libssh2_userauth_publickey_fromfile_ex.3
libssh2_userauth_publickey_frommemory.3
libssh2_version.3)
transform_makefile_inc("Makefile.am" "${CMAKE_CURRENT_BINARY_DIR}/Makefile.am.cmake")
# Get 'dist_man_MANS' variable
include(${CMAKE_CURRENT_BINARY_DIR}/Makefile.am.cmake)
include(GNUInstallDirs)
install(FILES ${MAN_PAGES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
install(FILES ${dist_man_MANS} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)

View File

@ -1,13 +0,0 @@
libssh2 source code style guide:
- 4 level indent
- spaces-only (no tabs)
- open braces on the if/for line:
if (banana) {
go_nuts();
}
- keep source lines shorter than 80 columns
- See libssh2-style.el for how to achieve this within Emacs

View File

@ -31,18 +31,20 @@ LIBSSH2_LIB_HAVE_LINKFLAGS from LIBSSH2_CRYPTO_CHECK, which automatically
creates and handles a --with-$newname-prefix option and sets an
LTLIBNEWNAME variable on success.
0.3) Create Makefile.newname.inc in the top-level directory
0.3) Add new header to src/Makefile.inc
This must set CRYPTO_CSOURCES, CRYPTO_HHEADERS and CRYPTO_LTLIBS.
Set CRYPTO_CSOURCES and CRYPTO_HHEADERS to the new backend source files
and set CRYPTO_LTLIBS to the required library linking parameters, e.g.
$(LTLIBNEWNAME) as generated by by LIBSSH2_LIB_HAVE_LINKFLAGS.
0.4) Include new source in src/crypto.c
0.4) Add a new block in src/Makefile.am
0.5) Add a new block in configure.ac
if NEWNAME
include ../Makefile.newname.inc
endif
```
elif test "$found_crypto" = "newname"; then
LIBS="${LIBS} ${LTLIBNEWNAME}"
```
0.6) Add CMake detection logic to CMakeLists.txt
0.7) Add manual config logic to Makefile.mk
1) Crypto library initialization/termination.
@ -53,6 +55,10 @@ Initializes the crypto library. May be an empty macro if not needed.
void libssh2_crypto_exit(void);
Terminates the crypto library use. May be an empty macro if not needed.
1.1) Crypto runtime detection
The libssh2_crypto_engine_t enum must include the new engine, and
libssh2_crypto_engine() must return it when it is built in.
2) HMAC
@ -148,7 +154,7 @@ Note: if the ctx parameter is modified by the underlying code,
this procedure must be implemented as a macro to map ctx --> &ctx.
int libssh2_sha256(const unsigned char *message,
unsigned long len,
size_t len,
unsigned char output[SHA256_DIGEST_LENGTH]);
Computes the SHA-256 signature over the given message of length len and
store the result into the output buffer.
@ -193,7 +199,7 @@ Note: if the ctx parameter is modified by the underlying code,
this procedure must be implemented as a macro to map ctx --> &ctx.
int libssh2_sha384(const unsigned char *message,
unsigned long len,
size_t len,
unsigned char output[SHA384_DIGEST_LENGTH]);
Computes the SHA-384 signature over the given message of length len and
store the result into the output buffer.
@ -227,7 +233,7 @@ Note: if the ctx parameter is modified by the underlying code,
this procedure must be implemented as a macro to map ctx --> &ctx.
int libssh2_sha512(const unsigned char *message,
unsigned long len,
size_t len,
unsigned char output[SHA512_DIGEST_LENGTH]);
Computes the SHA-512 signature over the given message of length len and
store the result into the output buffer.
@ -317,7 +323,8 @@ int _libssh2_cipher_crypt(_libssh2_cipher_ctx *ctx,
_libssh2_cipher_type(algo),
int encrypt,
unsigned char *block,
size_t blocksize);
size_t blocksize,
int firstlast);
Encrypt or decrypt in-place data at (block, blocksize) using the given
context and/or algorithm.
Return 0 if OK, else -1.
@ -388,7 +395,7 @@ _libssh2_cipher_cast5
CAST5-CBC algorithm identifier initializer.
#define with constant value of type _libssh2_cipher_type().
4.5) Tripple DES in CBC block mode.
4.5) Triple DES in CBC block mode.
LIBSSH2_3DES
#define as 1 if the crypto library supports TripleDES in CBC mode, else 0.
If defined as 0, the rest of this section can be omitted.
@ -400,6 +407,21 @@ TripleDES-CBC algorithm identifier initializer.
5) Diffie-Hellman support.
LIBSSH2_DH_GEX_MINGROUP
The minimum Diffie-Hellman group length in bits supported by the backend.
Usually defined as 2048.
LIBSSH2_DH_GEX_OPTGROUP
The preferred Diffie-Hellman group length in bits. Usually defined as 4096.
LIBSSH2_DH_GEX_MAXGROUP
The maximum Diffie-Hellman group length in bits supported by the backend.
Usually defined as 8192.
LIBSSH2_DH_MAX_MODULUS_BITS
The maximum Diffie-Hellman modulus bit count accepted from the server. This
value must be supported by the backend. Usually 16384.
5.1) Diffie-Hellman context.
_libssh2_dh_ctx
Type of a Diffie-Hellman computation context.
@ -595,7 +617,7 @@ This procedure is already prototyped in crypto.h.
int _libssh2_rsa_new_private_frommemory(libssh2_rsa_ctx **rsa,
LIBSSH2_SESSION *session,
const char *data,
size_t data_len,
size_t data_len,
unsigned const char *passphrase);
Gets an RSA private key from data into a new RSA context.
Must call _libssh2_init_if_needed().
@ -604,8 +626,8 @@ This procedure is already prototyped in crypto.h.
int _libssh2_rsa_sha1_verify(libssh2_rsa_ctx *rsa,
const unsigned char *sig,
unsigned long sig_len,
const unsigned char *m, unsigned long m_len);
size_t sig_len,
const unsigned char *m, size_t m_len);
Verify (sig, sig_len) signature of (m, m_len) using an SHA-1 hash and the
RSA context.
Return 0 if OK, else -1.
@ -637,6 +659,53 @@ Note: this procedure is not used if macro _libssh2_rsa_sha1_signv() is defined.
void _libssh2_rsa_free(libssh2_rsa_ctx *rsactx);
Releases the RSA computation context at rsactx.
LIBSSH2_RSA_SHA2
#define as 1 if the crypto library supports RSA SHA2 256/512, else 0.
If defined as 0, the rest of this section can be omitted.
int _libssh2_rsa_sha2_sign(LIBSSH2_SESSION * session,
libssh2_rsa_ctx * rsactx,
const unsigned char *hash,
size_t hash_len,
unsigned char **signature,
size_t *signature_len);
RSA signs the (hash, hashlen) SHA-2 hash bytes based on hash length and stores
the allocated signature at (signature, signature_len).
Signature buffer must be allocated from the given session.
Returns 0 if OK, else -1.
This procedure is already prototyped in crypto.h.
Note: this procedure is not used if both macros _libssh2_rsa_sha2_256_signv()
and _libssh2_rsa_sha2_512_signv are defined.
int _libssh2_rsa_sha2_256_signv(LIBSSH2_SESSION *session,
unsigned char **sig, size_t *siglen,
int count, const struct iovec vector[],
libssh2_rsa_ctx *ctx);
RSA signs the SHA-256 hash computed over the count data chunks in vector.
Signature is stored at (sig, siglen).
Signature buffer must be allocated from the given session.
Returns 0 if OK, else -1.
Note: this procedure is optional: if provided, it MUST be defined as a macro.
int _libssh2_rsa_sha2_512_signv(LIBSSH2_SESSION *session,
unsigned char **sig, size_t *siglen,
int count, const struct iovec vector[],
libssh2_rsa_ctx *ctx);
RSA signs the SHA-512 hash computed over the count data chunks in vector.
Signature is stored at (sig, siglen).
Signature buffer must be allocated from the given session.
Returns 0 if OK, else -1.
Note: this procedure is optional: if provided, it MUST be defined as a macro.
int _libssh2_rsa_sha2_verify(libssh2_rsa_ctx * rsa,
size_t hash_len,
const unsigned char *sig,
size_t sig_len,
const unsigned char *m, size_t m_len);
Verify (sig, sig_len) signature of (m, m_len) using an SHA-2 hash based on
hash length and the RSA context.
Return 0 if OK, else -1.
This procedure is already prototyped in crypto.h.
7.2) DSA
LIBSSH2_DSA
@ -687,7 +756,7 @@ This procedure is already prototyped in crypto.h.
int _libssh2_dsa_sha1_verify(libssh2_dsa_ctx *dsactx,
const unsigned char *sig,
const unsigned char *m, unsigned long m_len);
const unsigned char *m, size_t m_len);
Verify (sig, siglen) signature of (m, m_len) using an SHA-1 hash and the
DSA context.
Returns 0 if OK, else -1.
@ -695,7 +764,7 @@ This procedure is already prototyped in crypto.h.
int _libssh2_dsa_sha1_sign(libssh2_dsa_ctx *dsactx,
const unsigned char *hash,
unsigned long hash_len, unsigned char *sig);
size_t hash_len, unsigned char *sig);
DSA signs the (hash, hash_len) data using SHA-1 and store the signature at sig.
Returns 0 if OK, else -1.
This procedure is already prototyped in crypto.h.
@ -844,7 +913,7 @@ This procedure is already prototyped in crypto.h.
int _libssh2_ed25519_new_public(libssh2_ed25519_ctx **ed_ctx,
LIBSSH2_SESSION *session,
const unsigned char *raw_pub_key,
const uint8_t key_len);
const size_t key_len);
Stores at ed_ctx a new ED25519 key context for raw public key (raw_pub_key,
key_len).
Return 0 if OK, else -1.
@ -897,6 +966,17 @@ In example, this is needed to preset unused structure slacks on platforms
requiring it.
If this is not needed, it should be defined as an empty macro.
int _libssh2_random(unsigned char *buf, int len);
int _libssh2_random(unsigned char *buf, size_t len);
Store len random bytes at buf.
Returns 0 if OK, else -1.
const char * _libssh2_supported_key_sign_algorithms(LIBSSH2_SESSION *session,
unsigned char *key_method,
size_t key_method_len);
This function is for implementing key hash upgrading as defined in RFC 8332.
Based on the incoming key_method value, this function will return a
list of supported algorithms that can upgrade the original key method algorithm
as a comma separated list, if there is no upgrade option this function should
return NULL.

14
docs/HACKING.md Normal file
View File

@ -0,0 +1,14 @@
# libssh2 source code style guide
- 4 level indent
- spaces-only (no tabs)
- open braces on the if/for line:
```
if (banana) {
go_nuts();
}
```
- keep source lines shorter than 80 columns
- See `libssh2-style.el` for how to achieve this within Emacs

View File

@ -11,8 +11,7 @@ When Building directly from Master
==================================
If you want to build directly from the git repository, you must first
generate the configure script and Makefile using autotools. There is
a convenience script that calls all tools in the correct order. Make
generate the configure script and Makefile using autotools. Make
sure that autoconf, automake and libtool are installed on your system,
then execute:
@ -38,7 +37,7 @@ file `config.log' containing compiler output (useful mainly for
debugging `configure').
It can also use an optional file (typically called `config.cache'
and enabled with `--cache-file=config.cache' or simply `-C') that saves
and enabled with `--cache-file=config.cache' or shortly `-C') that saves
the results of its tests to speed up reconfiguring. (Caching is
disabled by default to prevent problems with accidental use of stale
cache files.)
@ -47,7 +46,7 @@ cache files.)
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If you are using the cache, and at
some point `config.cache' contains results you don't want to keep, you
some point `config.cache' contains results you do not want to keep, you
may remove or edit it.
The file `configure.ac' (or `configure.in') is used to create
@ -58,7 +57,7 @@ a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
`./configure' to configure the package for your system. If you are
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
@ -149,7 +148,7 @@ is something like `gnu-as' or `x' (for the X Window System). The
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
find the X include and library files automatically, but if it does not,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
@ -171,7 +170,7 @@ where SYSTEM can have one of these forms:
OS KERNEL-OS
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
`config.sub' is not included in this package, then this package does not
need to know the machine type.
If you are _building_ compiler tools for cross-compiling, you should
@ -255,73 +254,33 @@ More configure options
Some ./configure options deserve additional comments:
* --enable-crypt-none
The SSH2 Transport allows for unencrypted data
transmission using the "none" cipher. Because this is
such a huge security hole, it is typically disabled on
SSH2 implementations and is disabled in libssh2 by
default as well.
Enabling this option will allow for "none" as a
negotiable method, however it still requires that the
method be advertized by the remote end and that no
more-preferable methods are available.
* --enable-mac-none
The SSH2 Transport also allows implementations to
forego a message authentication code. While this is
less of a security risk than using a "none" cipher, it
is still not recommended as disabling MAC hashes
removes a layer of security.
Enabling this option will allow for "none" as a
negotiable method, however it still requires that the
method be advertized by the remote end and that no
more-preferable methods are available.
* --disable-gex-new
The diffie-hellman-group-exchange-sha1 (dh-gex) key
exchange method originally defined an exchange
negotiation using packet type 30 to request a
generation pair based on a single target value. Later
refinement of dh-gex provided for range and target
values. By default libssh2 will use the newer range
method.
If you experience trouble connecting to an old SSH
server using dh-gex, try this option to fallback on
the older more reliable method.
* --with-libgcrypt
* --without-libgcrypt
* --with-libgcrypt-prefix=DIR
libssh2 can use the Libgcrypt library
(https://www.gnupg.org/) for cryptographic operations.
libssh2 can use the Libgcrypt library
(https://www.gnupg.org/) for cryptographic operations.
One of the cryptographic libraries is required.
Configure will attempt to locate Libgcrypt
automatically.
Configure will attempt to locate Libgcrypt
automatically.
If your installation of Libgcrypt is in another
location, specify it using --with-libgcrypt-prefix.
If your installation of Libgcrypt is in another
location, specify it using --with-libgcrypt-prefix.
* --with-openssl
* --without-openssl
* --with-libssl-prefix=[DIR]
libssh2 can use the OpenSSL library
(https://www.openssl.org) for cryptographic operations.
libssh2 can use the OpenSSL library
(https://www.openssl.org) for cryptographic operations.
One of the cryptographic libraries is required.
Configure will attempt to locate OpenSSL in the
default location.
Configure will attempt to locate OpenSSL in the
default location.
If your installation of OpenSSL is in another
location, specify it using --with-libssl-prefix.
If your installation of OpenSSL is in another
location, specify it using --with-libssl-prefix.
* --with-mbedtls
* --without-mbedtls
@ -341,15 +300,15 @@ Some ./configure options deserve additional comments:
* --without-libz
* --with-libz-prefix=[DIR]
If present, libssh2 will attempt to use the zlib
(http://www.zlib.org) for payload compression, however
zlib is not required.
If present, libssh2 will attempt to use the zlib
(https://zlib.net/) for payload compression, however
zlib is not required.
If your installation of Libz is in another location,
specify it using --with-libz-prefix.
If your installation of Libz is in another location,
specify it using --with-libz-prefix.
* --enable-debug
Will make the build use more pedantic and strict compiler
options as well as enable the libssh2_trace() function (for
showing debug traces).
Will make the build use more pedantic and strict compiler
options as well as enable the libssh2_trace() function (for
showing debug traces).

View File

@ -6,10 +6,11 @@ Web site source code: https://github.com/libssh2/www
Installation instructions are in docs/INSTALL
=======
To build libssh2 you will need CMake v2.8 or later [1] and one of the
To build libssh2 you will need CMake v3.1 or later [1] and one of the
following cryptography libraries:
* OpenSSL
* wolfSSL
* Libgcrypt
* WinCNG
* mbedTLS
@ -35,8 +36,8 @@ cryptography library available. The library binary will be put in
Customising the build
---------------------
Of course, you might want to customise the build options. You can
pass the options to CMake on the command line:
You might want to customise the build options. You can pass the options
to CMake on the command line:
cmake -D<option>=<value> ..
@ -46,11 +47,17 @@ The following options are available:
Enables running the source code linter when building. Can be `ON` or `OFF`.
* `BUILD_STATIC_LIBS=ON`
Determines whether to build a libssh2 static library.
Can be `ON` or `OFF`.
* `BUILD_SHARED_LIBS=OFF`
Determines whether libssh2 is built as a static library or as a
shared library (.dll/.so). Can be `ON` or `OFF`.
Determines whether to build a libssh2 shared library (.dll/.so).
Can be `ON` or `OFF`.
If enabled, the optional static lib is also built with PIC enabled.
* `CRYPTO_BACKEND=`
@ -64,43 +71,9 @@ The following options are available:
* `ENABLE_ZLIB_COMPRESSION=OFF`
Will use zlib (http://www.zlib.org) for payload compression. Can
Will use zlib (https://zlib.net/) for payload compression. Can
be `ON` or `OFF`.
* `ENABLE_CRYPT_NONE=OFF`
The SSH2 Transport allows for unencrypted data transmission using
the "none" cipher. Because this is such a huge security hole, it
is typically disabled on SSH2 implementations and is disabled in
libssh2 by default as well.
Enabling this option will allow for "none" as a negotiable method,
however it still requires that the method be advertized by the
remote end and that no more-preferable methods are available.
* `ENABLE_MAC_NONE=OFF`
The SSH2 Transport also allows implementations to forego a message
authentication code. While this is less of a security risk than
using a "none" cipher, it is still not recommended as disabling
MAC hashes removes a layer of security.
Enabling this option will allow for "none" as a negotiable method,
however it still requires that the method be advertized by the
remote end and that no more-preferable methods are available.
* `ENABLE_GEX_NEW=ON`
The diffie-hellman-group-exchange-sha1 (dh-gex) key exchange
method originally defined an exchange negotiation using packet
type 30 to request a generation pair based on a single target
value. Later refinement of dh-gex provided for range and target
values. By default libssh2 will use the newer range method.
If you experience trouble connecting to an old SSH server using
dh-gex, try this option to fallback on the older more reliable
method.
* `ENABLE_DEBUG_LOGGING=ON` in Debug, `=OFF` in Release
Will enable the libssh2_trace() function for showing debug traces.
@ -116,8 +89,8 @@ The previous examples used CMake to start the build using:
cmake --build .
Alternatively, once CMake has configured your project, you can just
use your own build tool, e.g GNU make, Visual Studio, etc., from that
Alternatively, once CMake has configured your project, you can use
your own build tool, e.g GNU make, Visual Studio, etc., from that
point onwards.
Tests
@ -134,7 +107,7 @@ or
cmake --build . --target RUN_TESTS
```
How do I use libssh2 in my project if my project doesn't use CMake?
How do I use libssh2 in my project if my project does not use CMake?
-------------------------------------------------------------------
If you are not using CMake for your own project, install libssh2
@ -149,26 +122,25 @@ or
```
and then specify the install location to your project in the normal
way for your build environment. If you don't like the default install
way for your build environment. If you do not like the default install
location, add `-DCMAKE_INSTALL_PREFIX=<chosen prefix>` when initially
configuring the project.
How can I use libssh2 in my project if it also uses CMake?
----------------------------------------------------------
If your own project also uses CMake, you don't need to worry about
setting it up with libssh2's location. Just add just the following
lines and CMake will find libssh2 on your system, set up the necessary
paths and link the library with your binary.
If your own project also uses CMake, you do not need to worry about
setting it up with libssh2's location. Add the following lines and
CMake will find libssh2 on your system, set up the necessary paths and
link the library with your binary.
find_package(Libssh2 REQUIRED CONFIG)
target_link_libraries(my_project_target Libssh2::libssh2)
Of course, you still have to make libssh2 available on your system
first. You can install it in the traditional way shown above, but you
don't have to. Instead you can just build it, which will export its
location to the user package registry [3] where `find_package` will
find it.
You still have to make libssh2 available on your system first. You can
install it in the traditional way shown above, but you do not have to.
Instead you can build it, which will export its location to the user
package registry [3] where `find_package` will find it.
You can even combine the two steps using a so-called 'superbuild'
project [4] that downloads, builds and exports libssh2, and then

View File

@ -1,177 +1,187 @@
# $Id: Makefile.am,v 1.37 2009/03/26 15:41:15 bagder Exp $
EXTRA_DIST = template.3 BINDINGS INSTALL_AUTOTOOLS INSTALL_CMAKE.md HACKING TODO \
AUTHORS CMakeLists.txt HACKING-CRYPTO SECURITY.md
EXTRA_DIST = template.3 AUTHORS BINDINGS.md HACKING.md HACKING-CRYPTO \
INSTALL_AUTOTOOLS INSTALL_CMAKE.md SECURITY.md TODO CMakeLists.txt
dist_man_MANS = \
libssh2_agent_connect.3 \
libssh2_agent_disconnect.3 \
libssh2_agent_free.3 \
libssh2_agent_get_identity.3 \
libssh2_agent_get_identity_path.3 \
libssh2_agent_init.3 \
libssh2_agent_list_identities.3 \
libssh2_agent_set_identity_path.3 \
libssh2_agent_userauth.3 \
libssh2_banner_set.3 \
libssh2_base64_decode.3 \
libssh2_channel_close.3 \
libssh2_channel_direct_tcpip.3 \
libssh2_channel_direct_tcpip_ex.3 \
libssh2_channel_eof.3 \
libssh2_channel_exec.3 \
libssh2_channel_flush.3 \
libssh2_channel_flush_ex.3 \
libssh2_channel_flush_stderr.3 \
libssh2_channel_forward_accept.3 \
libssh2_channel_forward_cancel.3 \
libssh2_channel_forward_listen.3 \
libssh2_channel_forward_listen_ex.3 \
libssh2_channel_free.3 \
libssh2_channel_get_exit_signal.3 \
libssh2_channel_get_exit_status.3 \
libssh2_channel_handle_extended_data.3 \
libssh2_channel_handle_extended_data2.3 \
libssh2_channel_ignore_extended_data.3 \
libssh2_channel_open_ex.3 \
libssh2_channel_open_session.3 \
libssh2_channel_process_startup.3 \
libssh2_channel_read.3 \
libssh2_channel_read_ex.3 \
libssh2_channel_read_stderr.3 \
libssh2_channel_receive_window_adjust.3 \
libssh2_channel_receive_window_adjust2.3 \
libssh2_channel_request_pty.3 \
libssh2_channel_request_pty_ex.3 \
libssh2_channel_request_pty_size.3 \
libssh2_channel_request_pty_size_ex.3 \
libssh2_channel_send_eof.3 \
libssh2_channel_set_blocking.3 \
libssh2_channel_setenv.3 \
libssh2_channel_setenv_ex.3 \
libssh2_channel_shell.3 \
libssh2_channel_subsystem.3 \
libssh2_channel_wait_closed.3 \
libssh2_channel_wait_eof.3 \
libssh2_channel_window_read.3 \
libssh2_channel_window_read_ex.3 \
libssh2_channel_window_write.3 \
libssh2_channel_window_write_ex.3 \
libssh2_channel_write.3 \
libssh2_channel_write_ex.3 \
libssh2_channel_write_stderr.3 \
libssh2_channel_x11_req.3 \
libssh2_channel_x11_req_ex.3 \
libssh2_exit.3 \
libssh2_free.3 \
libssh2_hostkey_hash.3 \
libssh2_init.3 \
libssh2_keepalive_config.3 \
libssh2_keepalive_send.3 \
libssh2_knownhost_add.3 \
libssh2_knownhost_addc.3 \
libssh2_knownhost_check.3 \
libssh2_knownhost_checkp.3 \
libssh2_knownhost_del.3 \
libssh2_knownhost_free.3 \
libssh2_knownhost_get.3 \
libssh2_knownhost_init.3 \
libssh2_knownhost_readfile.3 \
libssh2_knownhost_readline.3 \
libssh2_knownhost_writefile.3 \
libssh2_knownhost_writeline.3 \
libssh2_poll.3 \
libssh2_poll_channel_read.3 \
libssh2_publickey_add.3 \
libssh2_publickey_add_ex.3 \
libssh2_publickey_init.3 \
libssh2_publickey_list_fetch.3 \
libssh2_publickey_list_free.3 \
libssh2_publickey_remove.3 \
libssh2_publickey_remove_ex.3 \
libssh2_publickey_shutdown.3 \
libssh2_scp_recv.3 \
libssh2_scp_recv2.3 \
libssh2_scp_send.3 \
libssh2_scp_send64.3 \
libssh2_scp_send_ex.3 \
libssh2_session_abstract.3 \
libssh2_session_banner_get.3 \
libssh2_session_banner_set.3 \
libssh2_session_block_directions.3 \
libssh2_session_callback_set.3 \
libssh2_session_disconnect.3 \
libssh2_session_disconnect_ex.3 \
libssh2_session_flag.3 \
libssh2_session_free.3 \
libssh2_session_get_blocking.3 \
libssh2_session_get_timeout.3 \
libssh2_session_handshake.3 \
libssh2_session_hostkey.3 \
libssh2_session_init.3 \
libssh2_session_init_ex.3 \
libssh2_session_last_errno.3 \
libssh2_session_last_error.3 \
libssh2_session_set_last_error.3 \
libssh2_session_method_pref.3 \
libssh2_session_methods.3 \
libssh2_session_set_blocking.3 \
libssh2_session_set_timeout.3 \
libssh2_session_startup.3 \
libssh2_session_supported_algs.3 \
libssh2_sftp_close.3 \
libssh2_sftp_close_handle.3 \
libssh2_sftp_closedir.3 \
libssh2_sftp_fsetstat.3 \
libssh2_sftp_fstat.3 \
libssh2_sftp_fstat_ex.3 \
libssh2_sftp_fstatvfs.3 \
libssh2_sftp_fsync.3 \
libssh2_sftp_get_channel.3 \
libssh2_sftp_init.3 \
libssh2_sftp_last_error.3 \
libssh2_sftp_lstat.3 \
libssh2_sftp_mkdir.3 \
libssh2_sftp_mkdir_ex.3 \
libssh2_sftp_open.3 \
libssh2_sftp_open_ex.3 \
libssh2_sftp_opendir.3 \
libssh2_sftp_read.3 \
libssh2_sftp_readdir.3 \
libssh2_sftp_readdir_ex.3 \
libssh2_sftp_readlink.3 \
libssh2_sftp_realpath.3 \
libssh2_sftp_rename.3 \
libssh2_sftp_rename_ex.3 \
libssh2_sftp_rewind.3 \
libssh2_sftp_rmdir.3 \
libssh2_sftp_rmdir_ex.3 \
libssh2_sftp_seek.3 \
libssh2_sftp_seek64.3 \
libssh2_sftp_setstat.3 \
libssh2_sftp_shutdown.3 \
libssh2_sftp_stat.3 \
libssh2_sftp_stat_ex.3 \
libssh2_sftp_statvfs.3 \
libssh2_sftp_symlink.3 \
libssh2_sftp_symlink_ex.3 \
libssh2_sftp_tell.3 \
libssh2_sftp_tell64.3 \
libssh2_sftp_unlink.3 \
libssh2_sftp_unlink_ex.3 \
libssh2_sftp_write.3 \
libssh2_trace.3 \
libssh2_trace_sethandler.3 \
libssh2_userauth_authenticated.3 \
libssh2_userauth_hostbased_fromfile.3 \
libssh2_userauth_hostbased_fromfile_ex.3 \
libssh2_userauth_keyboard_interactive.3 \
libssh2_userauth_keyboard_interactive_ex.3 \
libssh2_userauth_list.3 \
libssh2_userauth_password.3 \
libssh2_userauth_password_ex.3 \
libssh2_userauth_publickey.3 \
libssh2_userauth_publickey_fromfile.3 \
libssh2_userauth_publickey_fromfile_ex.3 \
libssh2_userauth_publickey_frommemory.3 \
libssh2_version.3
libssh2_agent_connect.3 \
libssh2_agent_disconnect.3 \
libssh2_agent_free.3 \
libssh2_agent_get_identity.3 \
libssh2_agent_get_identity_path.3 \
libssh2_agent_init.3 \
libssh2_agent_list_identities.3 \
libssh2_agent_set_identity_path.3 \
libssh2_agent_sign.3 \
libssh2_agent_userauth.3 \
libssh2_banner_set.3 \
libssh2_base64_decode.3 \
libssh2_channel_close.3 \
libssh2_channel_direct_streamlocal_ex.3 \
libssh2_channel_direct_tcpip.3 \
libssh2_channel_direct_tcpip_ex.3 \
libssh2_channel_eof.3 \
libssh2_channel_exec.3 \
libssh2_channel_flush.3 \
libssh2_channel_flush_ex.3 \
libssh2_channel_flush_stderr.3 \
libssh2_channel_forward_accept.3 \
libssh2_channel_forward_cancel.3 \
libssh2_channel_forward_listen.3 \
libssh2_channel_forward_listen_ex.3 \
libssh2_channel_free.3 \
libssh2_channel_get_exit_signal.3 \
libssh2_channel_get_exit_status.3 \
libssh2_channel_handle_extended_data.3 \
libssh2_channel_handle_extended_data2.3 \
libssh2_channel_ignore_extended_data.3 \
libssh2_channel_open_ex.3 \
libssh2_channel_open_session.3 \
libssh2_channel_process_startup.3 \
libssh2_channel_read.3 \
libssh2_channel_read_ex.3 \
libssh2_channel_read_stderr.3 \
libssh2_channel_receive_window_adjust.3 \
libssh2_channel_receive_window_adjust2.3 \
libssh2_channel_request_auth_agent.3 \
libssh2_channel_request_pty.3 \
libssh2_channel_request_pty_ex.3 \
libssh2_channel_request_pty_size.3 \
libssh2_channel_request_pty_size_ex.3 \
libssh2_channel_send_eof.3 \
libssh2_channel_set_blocking.3 \
libssh2_channel_setenv.3 \
libssh2_channel_setenv_ex.3 \
libssh2_channel_shell.3 \
libssh2_channel_signal_ex.3 \
libssh2_channel_subsystem.3 \
libssh2_channel_wait_closed.3 \
libssh2_channel_wait_eof.3 \
libssh2_channel_window_read.3 \
libssh2_channel_window_read_ex.3 \
libssh2_channel_window_write.3 \
libssh2_channel_window_write_ex.3 \
libssh2_channel_write.3 \
libssh2_channel_write_ex.3 \
libssh2_channel_write_stderr.3 \
libssh2_channel_x11_req.3 \
libssh2_channel_x11_req_ex.3 \
libssh2_crypto_engine.3 \
libssh2_exit.3 \
libssh2_free.3 \
libssh2_hostkey_hash.3 \
libssh2_init.3 \
libssh2_keepalive_config.3 \
libssh2_keepalive_send.3 \
libssh2_knownhost_add.3 \
libssh2_knownhost_addc.3 \
libssh2_knownhost_check.3 \
libssh2_knownhost_checkp.3 \
libssh2_knownhost_del.3 \
libssh2_knownhost_free.3 \
libssh2_knownhost_get.3 \
libssh2_knownhost_init.3 \
libssh2_knownhost_readfile.3 \
libssh2_knownhost_readline.3 \
libssh2_knownhost_writefile.3 \
libssh2_knownhost_writeline.3 \
libssh2_poll.3 \
libssh2_poll_channel_read.3 \
libssh2_publickey_add.3 \
libssh2_publickey_add_ex.3 \
libssh2_publickey_init.3 \
libssh2_publickey_list_fetch.3 \
libssh2_publickey_list_free.3 \
libssh2_publickey_remove.3 \
libssh2_publickey_remove_ex.3 \
libssh2_publickey_shutdown.3 \
libssh2_scp_recv.3 \
libssh2_scp_recv2.3 \
libssh2_scp_send.3 \
libssh2_scp_send64.3 \
libssh2_scp_send_ex.3 \
libssh2_session_abstract.3 \
libssh2_session_banner_get.3 \
libssh2_session_banner_set.3 \
libssh2_session_block_directions.3 \
libssh2_session_callback_set.3 \
libssh2_session_disconnect.3 \
libssh2_session_disconnect_ex.3 \
libssh2_session_flag.3 \
libssh2_session_free.3 \
libssh2_session_get_blocking.3 \
libssh2_session_get_read_timeout.3 \
libssh2_session_get_timeout.3 \
libssh2_session_handshake.3 \
libssh2_session_hostkey.3 \
libssh2_session_init.3 \
libssh2_session_init_ex.3 \
libssh2_session_last_errno.3 \
libssh2_session_last_error.3 \
libssh2_session_method_pref.3 \
libssh2_session_methods.3 \
libssh2_session_set_blocking.3 \
libssh2_session_set_last_error.3 \
libssh2_session_set_read_timeout.3 \
libssh2_session_set_timeout.3 \
libssh2_session_startup.3 \
libssh2_session_supported_algs.3 \
libssh2_sftp_close.3 \
libssh2_sftp_close_handle.3 \
libssh2_sftp_closedir.3 \
libssh2_sftp_fsetstat.3 \
libssh2_sftp_fstat.3 \
libssh2_sftp_fstat_ex.3 \
libssh2_sftp_fstatvfs.3 \
libssh2_sftp_fsync.3 \
libssh2_sftp_get_channel.3 \
libssh2_sftp_init.3 \
libssh2_sftp_last_error.3 \
libssh2_sftp_lstat.3 \
libssh2_sftp_mkdir.3 \
libssh2_sftp_mkdir_ex.3 \
libssh2_sftp_open.3 \
libssh2_sftp_open_ex.3 \
libssh2_sftp_open_ex_r.3 \
libssh2_sftp_open_r.3 \
libssh2_sftp_opendir.3 \
libssh2_sftp_read.3 \
libssh2_sftp_readdir.3 \
libssh2_sftp_readdir_ex.3 \
libssh2_sftp_readlink.3 \
libssh2_sftp_realpath.3 \
libssh2_sftp_rename.3 \
libssh2_sftp_rename_ex.3 \
libssh2_sftp_rewind.3 \
libssh2_sftp_rmdir.3 \
libssh2_sftp_rmdir_ex.3 \
libssh2_sftp_seek.3 \
libssh2_sftp_seek64.3 \
libssh2_sftp_setstat.3 \
libssh2_sftp_shutdown.3 \
libssh2_sftp_stat.3 \
libssh2_sftp_stat_ex.3 \
libssh2_sftp_statvfs.3 \
libssh2_sftp_symlink.3 \
libssh2_sftp_symlink_ex.3 \
libssh2_sftp_tell.3 \
libssh2_sftp_tell64.3 \
libssh2_sftp_unlink.3 \
libssh2_sftp_unlink_ex.3 \
libssh2_sftp_write.3 \
libssh2_sign_sk.3 \
libssh2_trace.3 \
libssh2_trace_sethandler.3 \
libssh2_userauth_authenticated.3 \
libssh2_userauth_banner.3 \
libssh2_userauth_hostbased_fromfile.3 \
libssh2_userauth_hostbased_fromfile_ex.3 \
libssh2_userauth_keyboard_interactive.3 \
libssh2_userauth_keyboard_interactive_ex.3 \
libssh2_userauth_list.3 \
libssh2_userauth_password.3 \
libssh2_userauth_password_ex.3 \
libssh2_userauth_publickey.3 \
libssh2_userauth_publickey_fromfile.3 \
libssh2_userauth_publickey_fromfile_ex.3 \
libssh2_userauth_publickey_frommemory.3 \
libssh2_userauth_publickey_sk.3 \
libssh2_version.3

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.16.4 from Makefile.am.
# Makefile.in generated by automake 1.16.5 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
@ -13,8 +13,6 @@
# PARTICULAR PURPOSE.
@SET_MAKE@
# $Id: Makefile.am,v 1.37 2009/03/26 15:41:15 bagder Exp $
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
@ -191,12 +189,13 @@ EGREP = @EGREP@
ETAGS = @ETAGS@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
FILECMD = @FILECMD@
GREP = @GREP@
HAVE_LIBBCRYPT = @HAVE_LIBBCRYPT@
HAVE_LIBCRYPT32 = @HAVE_LIBCRYPT32@
HAVE_LIBGCRYPT = @HAVE_LIBGCRYPT@
HAVE_LIBMBEDCRYPTO = @HAVE_LIBMBEDCRYPTO@
HAVE_LIBSSL = @HAVE_LIBSSL@
HAVE_LIBWOLFSSL = @HAVE_LIBWOLFSSL@
HAVE_LIBZ = @HAVE_LIBZ@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@ -207,8 +206,6 @@ LD = @LD@
LDFLAGS = @LDFLAGS@
LIBBCRYPT = @LIBBCRYPT@
LIBBCRYPT_PREFIX = @LIBBCRYPT_PREFIX@
LIBCRYPT32 = @LIBCRYPT32@
LIBCRYPT32_PREFIX = @LIBCRYPT32_PREFIX@
LIBGCRYPT = @LIBGCRYPT@
LIBGCRYPT_PREFIX = @LIBGCRYPT_PREFIX@
LIBMBEDCRYPTO = @LIBMBEDCRYPTO@
@ -220,17 +217,19 @@ LIBSSH2VER = @LIBSSH2VER@
LIBSSL = @LIBSSL@
LIBSSL_PREFIX = @LIBSSL_PREFIX@
LIBTOOL = @LIBTOOL@
LIBWOLFSSL = @LIBWOLFSSL@
LIBWOLFSSL_PREFIX = @LIBWOLFSSL_PREFIX@
LIBZ = @LIBZ@
LIBZ_PREFIX = @LIBZ_PREFIX@
LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBBCRYPT = @LTLIBBCRYPT@
LTLIBCRYPT32 = @LTLIBCRYPT32@
LTLIBGCRYPT = @LTLIBGCRYPT@
LTLIBMBEDCRYPTO = @LTLIBMBEDCRYPTO@
LTLIBOBJS = @LTLIBOBJS@
LTLIBSSL = @LTLIBSSL@
LTLIBWOLFSSL = @LTLIBWOLFSSL@
LTLIBZ = @LTLIBZ@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
MAINT = @MAINT@
@ -252,6 +251,7 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
RC = @RC@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@ -312,181 +312,193 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
EXTRA_DIST = template.3 BINDINGS INSTALL_AUTOTOOLS INSTALL_CMAKE.md HACKING TODO \
AUTHORS CMakeLists.txt HACKING-CRYPTO SECURITY.md
EXTRA_DIST = template.3 AUTHORS BINDINGS.md HACKING.md HACKING-CRYPTO \
INSTALL_AUTOTOOLS INSTALL_CMAKE.md SECURITY.md TODO CMakeLists.txt
dist_man_MANS = \
libssh2_agent_connect.3 \
libssh2_agent_disconnect.3 \
libssh2_agent_free.3 \
libssh2_agent_get_identity.3 \
libssh2_agent_get_identity_path.3 \
libssh2_agent_init.3 \
libssh2_agent_list_identities.3 \
libssh2_agent_set_identity_path.3 \
libssh2_agent_userauth.3 \
libssh2_banner_set.3 \
libssh2_base64_decode.3 \
libssh2_channel_close.3 \
libssh2_channel_direct_tcpip.3 \
libssh2_channel_direct_tcpip_ex.3 \
libssh2_channel_eof.3 \
libssh2_channel_exec.3 \
libssh2_channel_flush.3 \
libssh2_channel_flush_ex.3 \
libssh2_channel_flush_stderr.3 \
libssh2_channel_forward_accept.3 \
libssh2_channel_forward_cancel.3 \
libssh2_channel_forward_listen.3 \
libssh2_channel_forward_listen_ex.3 \
libssh2_channel_free.3 \
libssh2_channel_get_exit_signal.3 \
libssh2_channel_get_exit_status.3 \
libssh2_channel_handle_extended_data.3 \
libssh2_channel_handle_extended_data2.3 \
libssh2_channel_ignore_extended_data.3 \
libssh2_channel_open_ex.3 \
libssh2_channel_open_session.3 \
libssh2_channel_process_startup.3 \
libssh2_channel_read.3 \
libssh2_channel_read_ex.3 \
libssh2_channel_read_stderr.3 \
libssh2_channel_receive_window_adjust.3 \
libssh2_channel_receive_window_adjust2.3 \
libssh2_channel_request_pty.3 \
libssh2_channel_request_pty_ex.3 \
libssh2_channel_request_pty_size.3 \
libssh2_channel_request_pty_size_ex.3 \
libssh2_channel_send_eof.3 \
libssh2_channel_set_blocking.3 \
libssh2_channel_setenv.3 \
libssh2_channel_setenv_ex.3 \
libssh2_channel_shell.3 \
libssh2_channel_subsystem.3 \
libssh2_channel_wait_closed.3 \
libssh2_channel_wait_eof.3 \
libssh2_channel_window_read.3 \
libssh2_channel_window_read_ex.3 \
libssh2_channel_window_write.3 \
libssh2_channel_window_write_ex.3 \
libssh2_channel_write.3 \
libssh2_channel_write_ex.3 \
libssh2_channel_write_stderr.3 \
libssh2_channel_x11_req.3 \
libssh2_channel_x11_req_ex.3 \
libssh2_exit.3 \
libssh2_free.3 \
libssh2_hostkey_hash.3 \
libssh2_init.3 \
libssh2_keepalive_config.3 \
libssh2_keepalive_send.3 \
libssh2_knownhost_add.3 \
libssh2_knownhost_addc.3 \
libssh2_knownhost_check.3 \
libssh2_knownhost_checkp.3 \
libssh2_knownhost_del.3 \
libssh2_knownhost_free.3 \
libssh2_knownhost_get.3 \
libssh2_knownhost_init.3 \
libssh2_knownhost_readfile.3 \
libssh2_knownhost_readline.3 \
libssh2_knownhost_writefile.3 \
libssh2_knownhost_writeline.3 \
libssh2_poll.3 \
libssh2_poll_channel_read.3 \
libssh2_publickey_add.3 \
libssh2_publickey_add_ex.3 \
libssh2_publickey_init.3 \
libssh2_publickey_list_fetch.3 \
libssh2_publickey_list_free.3 \
libssh2_publickey_remove.3 \
libssh2_publickey_remove_ex.3 \
libssh2_publickey_shutdown.3 \
libssh2_scp_recv.3 \
libssh2_scp_recv2.3 \
libssh2_scp_send.3 \
libssh2_scp_send64.3 \
libssh2_scp_send_ex.3 \
libssh2_session_abstract.3 \
libssh2_session_banner_get.3 \
libssh2_session_banner_set.3 \
libssh2_session_block_directions.3 \
libssh2_session_callback_set.3 \
libssh2_session_disconnect.3 \
libssh2_session_disconnect_ex.3 \
libssh2_session_flag.3 \
libssh2_session_free.3 \
libssh2_session_get_blocking.3 \
libssh2_session_get_timeout.3 \
libssh2_session_handshake.3 \
libssh2_session_hostkey.3 \
libssh2_session_init.3 \
libssh2_session_init_ex.3 \
libssh2_session_last_errno.3 \
libssh2_session_last_error.3 \
libssh2_session_set_last_error.3 \
libssh2_session_method_pref.3 \
libssh2_session_methods.3 \
libssh2_session_set_blocking.3 \
libssh2_session_set_timeout.3 \
libssh2_session_startup.3 \
libssh2_session_supported_algs.3 \
libssh2_sftp_close.3 \
libssh2_sftp_close_handle.3 \
libssh2_sftp_closedir.3 \
libssh2_sftp_fsetstat.3 \
libssh2_sftp_fstat.3 \
libssh2_sftp_fstat_ex.3 \
libssh2_sftp_fstatvfs.3 \
libssh2_sftp_fsync.3 \
libssh2_sftp_get_channel.3 \
libssh2_sftp_init.3 \
libssh2_sftp_last_error.3 \
libssh2_sftp_lstat.3 \
libssh2_sftp_mkdir.3 \
libssh2_sftp_mkdir_ex.3 \
libssh2_sftp_open.3 \
libssh2_sftp_open_ex.3 \
libssh2_sftp_opendir.3 \
libssh2_sftp_read.3 \
libssh2_sftp_readdir.3 \
libssh2_sftp_readdir_ex.3 \
libssh2_sftp_readlink.3 \
libssh2_sftp_realpath.3 \
libssh2_sftp_rename.3 \
libssh2_sftp_rename_ex.3 \
libssh2_sftp_rewind.3 \
libssh2_sftp_rmdir.3 \
libssh2_sftp_rmdir_ex.3 \
libssh2_sftp_seek.3 \
libssh2_sftp_seek64.3 \
libssh2_sftp_setstat.3 \
libssh2_sftp_shutdown.3 \
libssh2_sftp_stat.3 \
libssh2_sftp_stat_ex.3 \
libssh2_sftp_statvfs.3 \
libssh2_sftp_symlink.3 \
libssh2_sftp_symlink_ex.3 \
libssh2_sftp_tell.3 \
libssh2_sftp_tell64.3 \
libssh2_sftp_unlink.3 \
libssh2_sftp_unlink_ex.3 \
libssh2_sftp_write.3 \
libssh2_trace.3 \
libssh2_trace_sethandler.3 \
libssh2_userauth_authenticated.3 \
libssh2_userauth_hostbased_fromfile.3 \
libssh2_userauth_hostbased_fromfile_ex.3 \
libssh2_userauth_keyboard_interactive.3 \
libssh2_userauth_keyboard_interactive_ex.3 \
libssh2_userauth_list.3 \
libssh2_userauth_password.3 \
libssh2_userauth_password_ex.3 \
libssh2_userauth_publickey.3 \
libssh2_userauth_publickey_fromfile.3 \
libssh2_userauth_publickey_fromfile_ex.3 \
libssh2_userauth_publickey_frommemory.3 \
libssh2_version.3
libssh2_agent_connect.3 \
libssh2_agent_disconnect.3 \
libssh2_agent_free.3 \
libssh2_agent_get_identity.3 \
libssh2_agent_get_identity_path.3 \
libssh2_agent_init.3 \
libssh2_agent_list_identities.3 \
libssh2_agent_set_identity_path.3 \
libssh2_agent_sign.3 \
libssh2_agent_userauth.3 \
libssh2_banner_set.3 \
libssh2_base64_decode.3 \
libssh2_channel_close.3 \
libssh2_channel_direct_streamlocal_ex.3 \
libssh2_channel_direct_tcpip.3 \
libssh2_channel_direct_tcpip_ex.3 \
libssh2_channel_eof.3 \
libssh2_channel_exec.3 \
libssh2_channel_flush.3 \
libssh2_channel_flush_ex.3 \
libssh2_channel_flush_stderr.3 \
libssh2_channel_forward_accept.3 \
libssh2_channel_forward_cancel.3 \
libssh2_channel_forward_listen.3 \
libssh2_channel_forward_listen_ex.3 \
libssh2_channel_free.3 \
libssh2_channel_get_exit_signal.3 \
libssh2_channel_get_exit_status.3 \
libssh2_channel_handle_extended_data.3 \
libssh2_channel_handle_extended_data2.3 \
libssh2_channel_ignore_extended_data.3 \
libssh2_channel_open_ex.3 \
libssh2_channel_open_session.3 \
libssh2_channel_process_startup.3 \
libssh2_channel_read.3 \
libssh2_channel_read_ex.3 \
libssh2_channel_read_stderr.3 \
libssh2_channel_receive_window_adjust.3 \
libssh2_channel_receive_window_adjust2.3 \
libssh2_channel_request_auth_agent.3 \
libssh2_channel_request_pty.3 \
libssh2_channel_request_pty_ex.3 \
libssh2_channel_request_pty_size.3 \
libssh2_channel_request_pty_size_ex.3 \
libssh2_channel_send_eof.3 \
libssh2_channel_set_blocking.3 \
libssh2_channel_setenv.3 \
libssh2_channel_setenv_ex.3 \
libssh2_channel_shell.3 \
libssh2_channel_signal_ex.3 \
libssh2_channel_subsystem.3 \
libssh2_channel_wait_closed.3 \
libssh2_channel_wait_eof.3 \
libssh2_channel_window_read.3 \
libssh2_channel_window_read_ex.3 \
libssh2_channel_window_write.3 \
libssh2_channel_window_write_ex.3 \
libssh2_channel_write.3 \
libssh2_channel_write_ex.3 \
libssh2_channel_write_stderr.3 \
libssh2_channel_x11_req.3 \
libssh2_channel_x11_req_ex.3 \
libssh2_crypto_engine.3 \
libssh2_exit.3 \
libssh2_free.3 \
libssh2_hostkey_hash.3 \
libssh2_init.3 \
libssh2_keepalive_config.3 \
libssh2_keepalive_send.3 \
libssh2_knownhost_add.3 \
libssh2_knownhost_addc.3 \
libssh2_knownhost_check.3 \
libssh2_knownhost_checkp.3 \
libssh2_knownhost_del.3 \
libssh2_knownhost_free.3 \
libssh2_knownhost_get.3 \
libssh2_knownhost_init.3 \
libssh2_knownhost_readfile.3 \
libssh2_knownhost_readline.3 \
libssh2_knownhost_writefile.3 \
libssh2_knownhost_writeline.3 \
libssh2_poll.3 \
libssh2_poll_channel_read.3 \
libssh2_publickey_add.3 \
libssh2_publickey_add_ex.3 \
libssh2_publickey_init.3 \
libssh2_publickey_list_fetch.3 \
libssh2_publickey_list_free.3 \
libssh2_publickey_remove.3 \
libssh2_publickey_remove_ex.3 \
libssh2_publickey_shutdown.3 \
libssh2_scp_recv.3 \
libssh2_scp_recv2.3 \
libssh2_scp_send.3 \
libssh2_scp_send64.3 \
libssh2_scp_send_ex.3 \
libssh2_session_abstract.3 \
libssh2_session_banner_get.3 \
libssh2_session_banner_set.3 \
libssh2_session_block_directions.3 \
libssh2_session_callback_set.3 \
libssh2_session_disconnect.3 \
libssh2_session_disconnect_ex.3 \
libssh2_session_flag.3 \
libssh2_session_free.3 \
libssh2_session_get_blocking.3 \
libssh2_session_get_read_timeout.3 \
libssh2_session_get_timeout.3 \
libssh2_session_handshake.3 \
libssh2_session_hostkey.3 \
libssh2_session_init.3 \
libssh2_session_init_ex.3 \
libssh2_session_last_errno.3 \
libssh2_session_last_error.3 \
libssh2_session_method_pref.3 \
libssh2_session_methods.3 \
libssh2_session_set_blocking.3 \
libssh2_session_set_last_error.3 \
libssh2_session_set_read_timeout.3 \
libssh2_session_set_timeout.3 \
libssh2_session_startup.3 \
libssh2_session_supported_algs.3 \
libssh2_sftp_close.3 \
libssh2_sftp_close_handle.3 \
libssh2_sftp_closedir.3 \
libssh2_sftp_fsetstat.3 \
libssh2_sftp_fstat.3 \
libssh2_sftp_fstat_ex.3 \
libssh2_sftp_fstatvfs.3 \
libssh2_sftp_fsync.3 \
libssh2_sftp_get_channel.3 \
libssh2_sftp_init.3 \
libssh2_sftp_last_error.3 \
libssh2_sftp_lstat.3 \
libssh2_sftp_mkdir.3 \
libssh2_sftp_mkdir_ex.3 \
libssh2_sftp_open.3 \
libssh2_sftp_open_ex.3 \
libssh2_sftp_open_ex_r.3 \
libssh2_sftp_open_r.3 \
libssh2_sftp_opendir.3 \
libssh2_sftp_read.3 \
libssh2_sftp_readdir.3 \
libssh2_sftp_readdir_ex.3 \
libssh2_sftp_readlink.3 \
libssh2_sftp_realpath.3 \
libssh2_sftp_rename.3 \
libssh2_sftp_rename_ex.3 \
libssh2_sftp_rewind.3 \
libssh2_sftp_rmdir.3 \
libssh2_sftp_rmdir_ex.3 \
libssh2_sftp_seek.3 \
libssh2_sftp_seek64.3 \
libssh2_sftp_setstat.3 \
libssh2_sftp_shutdown.3 \
libssh2_sftp_stat.3 \
libssh2_sftp_stat_ex.3 \
libssh2_sftp_statvfs.3 \
libssh2_sftp_symlink.3 \
libssh2_sftp_symlink_ex.3 \
libssh2_sftp_tell.3 \
libssh2_sftp_tell64.3 \
libssh2_sftp_unlink.3 \
libssh2_sftp_unlink_ex.3 \
libssh2_sftp_write.3 \
libssh2_sign_sk.3 \
libssh2_trace.3 \
libssh2_trace_sethandler.3 \
libssh2_userauth_authenticated.3 \
libssh2_userauth_banner.3 \
libssh2_userauth_hostbased_fromfile.3 \
libssh2_userauth_hostbased_fromfile_ex.3 \
libssh2_userauth_keyboard_interactive.3 \
libssh2_userauth_keyboard_interactive_ex.3 \
libssh2_userauth_list.3 \
libssh2_userauth_password.3 \
libssh2_userauth_password_ex.3 \
libssh2_userauth_publickey.3 \
libssh2_userauth_publickey_fromfile.3 \
libssh2_userauth_publickey_fromfile_ex.3 \
libssh2_userauth_publickey_frommemory.3 \
libssh2_userauth_publickey_sk.3 \
libssh2_version.3
all: all-am
@ -500,9 +512,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/Makefile'; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu docs/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign docs/Makefile
$(AUTOMAKE) --gnu docs/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \

View File

@ -28,8 +28,8 @@ reference to the security nature of the commit if done prior to the public
announcement.
- The person discovering the issue, the reporter, reports the vulnerability
privately to `libssh2-security@haxx.se`. That's an email alias that reaches a
handful of selected and trusted people.
privately to `libssh2-security@haxx.se`. That is an email alias that reaches
a handful of selected and trusted people.
- Messages that do not relate to the reporting or managing of an undisclosed
security vulnerability in libssh2 are ignored and no further action is
@ -61,10 +61,10 @@ announcement.
contributors properly.
- Request a CVE number from
[distros@openwall](http://oss-security.openwall.org/wiki/mailing-lists/distros)
[distros@openwall](https://oss-security.openwall.org/wiki/mailing-lists/distros)
when also informing and preparing them for the upcoming public security
vulnerability announcement - attach the advisory draft for information. Note
that 'distros' won't accept an embargo longer than 14 days.
that 'distros' will not accept an embargo longer than 14 days.
- Update the "security advisory" with the CVE number.
@ -90,10 +90,10 @@ LIBSSH2-SECURITY (at haxx dot se)
--------------------------------
Who is on this list? There are a couple of criteria you must meet, and then we
might ask you to join the list or you can ask to join it. It really isn't very
might ask you to join the list or you can ask to join it. It really is not very
formal. We basically only require that you have a long-term presence in the
libssh2 project and you have shown an understanding for the project and its way
of working. You must've been around for a good while and you should have no
of working. You must have been around for a good while and you should have no
plans in vanishing in the near future.
We do not make the list of participants public mostly because it tends to vary

View File

@ -5,18 +5,18 @@ Things TODO
Improvements" below for details
* make sure the windowing code adapts better to slow situations so that it
doesn't then use as much memory as today. Possibly by an app-controllable
does not then use as much memory as today. Possibly by an app-controllable
"Window mode"?
* Decrease the number of mallocs. Everywhere. Will get easier once the
buffering improvements have been done.
* Use SO_NOSIGPIPE for Mac OS/BSD systems where MSG_NOSIGNAL doesn't
* Use SO_NOSIGPIPE for Mac OS/BSD systems where MSG_NOSIGNAL does not
exist/work
* Extend the test suite to actually test lots of aspects of libssh2
* Fix all compiler warnings (some can't be done without API changes)
* Update public API to drop casts added to fix compiler warnings
* Expose error messages sent by the server
@ -41,7 +41,7 @@ At next SONAME bump
libssh2_poll()
libssh2_poll_channel_read()
libssh2_session_startup() (libssh2_session_handshake() is the replacement)
libssh2_banner_set() (libssh2_session_banner_set() is the repacement)
libssh2_banner_set() (libssh2_session_banner_set() is the replacement)
* Rename a few function:
@ -60,7 +60,7 @@ At next SONAME bump
* remove the existing libssh2_scp_send_ex() function and rename
libssh2_scp_send64 to become the new libssh2_scp_send instead.
* remove the existing libssh2_knownhost_check() functin and rename
* remove the existing libssh2_knownhost_check() function and rename
libssh2_knownhost_checkp() to become the new libssh2_knownhost_check instead
Buffering Improvements
@ -119,7 +119,7 @@ I suggest we introduce two new helper functions:
short return, nothing more should be attempted to get sent until select()
(or equivalent) has been used on the master socket again.
I haven't yet figured out a sensible API for how these functions should return
I have not yet figured out a sensible API for how these functions should return
that info, but if we agree on the general principles I guess we can work that
out.

View File

@ -1,18 +1,21 @@
.\"
.\" Copyright (c) 2009 by Daiki Ueno
.\"
.TH libssh2_agent_connect 3 "23 Dec 2009" "libssh2 1.2" "libssh2 manual"
.TH libssh2_agent_connect 3 "23 Dec 2009" "libssh2" "libssh2"
.SH NAME
libssh2_agent_connect - connect to an ssh-agent
.SH SYNOPSIS
.nf
#include <libssh2.h>
int libssh2_agent_connect(LIBSSH2_AGENT *agent);
int
libssh2_agent_connect(LIBSSH2_AGENT *agent);
.fi
.SH DESCRIPTION
Connect to an ssh-agent running on the system.
Call \fBlibssh2_agent_disconnect(3)\fP to close the connection after
you're doing using it.
you are doing using it.
.SH RETURN VALUE
Returns 0 if succeeded, or a negative value for error.
.SH AVAILABILITY
@ -20,4 +23,3 @@ Added in libssh2 1.2
.SH SEE ALSO
.BR libssh2_agent_init(3)
.BR libssh2_agent_disconnect(3)

View File

@ -1,13 +1,16 @@
.\"
.\" Copyright (c) 2009 by Daiki Ueno
.\"
.TH libssh2_agent_disconnect 3 "23 Dec 2009" "libssh2 1.2" "libssh2 manual"
.TH libssh2_agent_disconnect 3 "23 Dec 2009" "libssh2" "libssh2"
.SH NAME
libssh2_agent_disconnect - close a connection to an ssh-agent
.SH SYNOPSIS
.nf
#include <libssh2.h>
int libssh2_agent_disconnect(LIBSSH2_AGENT *agent);
int
libssh2_agent_disconnect(LIBSSH2_AGENT *agent);
.fi
.SH DESCRIPTION
Close a connection to an ssh-agent.

View File

@ -1,13 +1,16 @@
.\"
.\" Copyright (c) 2009 by Daiki Ueno
.\"
.TH libssh2_agent_free 3 "28 May 2009" "libssh2 1.2" "libssh2 manual"
.TH libssh2_agent_free 3 "28 May 2009" "libssh2" "libssh2"
.SH NAME
libssh2_agent_free - free an ssh-agent handle
.SH SYNOPSIS
.nf
#include <libssh2.h>
void libssh2_agent_free(LIBSSH2_AGENT *agent);
void
libssh2_agent_free(LIBSSH2_AGENT *agent);
.fi
.SH DESCRIPTION
Free an ssh-agent handle. This function also frees the internal
collection of public keys.

View File

@ -1,15 +1,18 @@
.\"
.\" Copyright (c) 2009 by Daiki Ueno
.\"
.TH libssh2_agent_get_identity 3 "23 Dec 2009" "libssh2 1.2" "libssh2 manual"
.TH libssh2_agent_get_identity 3 "23 Dec 2009" "libssh2" "libssh2"
.SH NAME
libssh2_agent_get_identity - get a public key off the collection of public keys managed by ssh-agent
.SH SYNOPSIS
.nf
#include <libssh2.h>
int libssh2_agent_get_identity(LIBSSH2_AGENT *agent,
struct libssh2_agent_publickey **store,
struct libssh2_agent_publickey *prev);
int
libssh2_agent_get_identity(LIBSSH2_AGENT *agent,
struct libssh2_agent_publickey **store,
struct libssh2_agent_publickey *prev);
.fi
.SH DESCRIPTION
\fIlibssh2_agent_get_identity(3)\fP allows an application to iterate
over all public keys in the collection managed by ssh-agent.

View File

@ -1,14 +1,16 @@
.\"
.\" Copyright (c) 2019 by Will Cosgrove
.\"
.TH libssh2_agent_get_identity_path 3 "6 Mar 2019" "libssh2 1.9" "libssh2 manual"
.TH libssh2_agent_get_identity_path 3 "6 Mar 2019" "libssh2" "libssh2"
.SH NAME
libssh2_agent_get_identity_path - gets the custom ssh-agent socket path
.SH SYNOPSIS
.nf
#include <libssh2.h>
const char *
libssh2_agent_get_identity_path(LIBSSH2_AGENT *agent);
.fi
.SH DESCRIPTION
Returns the custom agent identity socket path if set using libssh2_agent_set_identity_path()
@ -19,4 +21,3 @@ Added in libssh2 1.9
.SH SEE ALSO
.BR libssh2_agent_init(3)
.BR libssh2_agent_set_identity_path(3)

View File

@ -1,20 +1,23 @@
.\"
.\" Copyright (c) 2009 by Daiki Ueno
.\"
.TH libssh2_agent_init 3 "23 Dec 2009" "libssh2 1.2" "libssh2 manual"
.TH libssh2_agent_init 3 "23 Dec 2009" "libssh2" "libssh2"
.SH NAME
libssh2_agent_init - init an ssh-agent handle
.SH SYNOPSIS
.nf
#include <libssh2.h>
LIBSSH2_AGENT *libssh2_agent_init(LIBSSH2_SESSION *session);
LIBSSH2_AGENT *
libssh2_agent_init(LIBSSH2_SESSION *session);
.fi
.SH DESCRIPTION
Init an ssh-agent handle. Returns the handle to an internal
representation of an ssh-agent connection. After the successful
initialization, an application can call \fBlibssh2_agent_connect(3)\fP
to connect to a running ssh-agent.
Call \fBlibssh2_agent_free(3)\fP to free the handle again after you're
Call \fBlibssh2_agent_free(3)\fP to free the handle again after you are
doing using it.
.SH RETURN VALUE
Returns a handle pointer or NULL if something went wrong. The returned handle

View File

@ -1,13 +1,16 @@
.\"
.\" Copyright (c) 2009 by Daiki Ueno
.\"
.TH libssh2_agent_list_identities 3 "23 Dec 2009" "libssh2 1.2" "libssh2 manual"
.TH libssh2_agent_list_identities 3 "23 Dec 2009" "libssh2" "libssh2"
.SH NAME
libssh2_agent_list_identities - request an ssh-agent to list of public keys.
.SH SYNOPSIS
.nf
#include <libssh2.h>
int libssh2_agent_list_identities(LIBSSH2_AGENT *agent);
int
libssh2_agent_list_identities(LIBSSH2_AGENT *agent);
.fi
.SH DESCRIPTION
Request an ssh-agent to list of public keys, and stores them in the
internal collection of the handle. Call
@ -21,4 +24,3 @@ Added in libssh2 1.2
.SH SEE ALSO
.BR libssh2_agent_connect(3)
.BR libssh2_agent_get_identity(3)

View File

@ -1,14 +1,16 @@
.\"
.\" Copyright (c) 2019 by Will Cosgrove
.\"
.TH libssh2_agent_set_identity_path 3 "6 Mar 2019" "libssh2 1.9" "libssh2 manual"
.TH libssh2_agent_set_identity_path 3 "6 Mar 2019" "libssh2" "libssh2"
.SH NAME
libssh2_agent_set_identity_path - set an ssh-agent socket path on disk
.SH SYNOPSIS
.nf
#include <libssh2.h>
void
libssh2_agent_set_identity_path(LIBSSH2_AGENT *agent, const char *path);
.fi
.SH DESCRIPTION
Allows a custom agent identity socket path instead of the default SSH_AUTH_SOCK env value
@ -19,4 +21,3 @@ Added in libssh2 1.9
.SH SEE ALSO
.BR libssh2_agent_init(3)
.BR libssh2_agent_get_identity_path(3)

52
docs/libssh2_agent_sign.3 Normal file
View File

@ -0,0 +1,52 @@
.TH libssh2_agent_sign 3 "1 Oct 2022" "libssh2" "libssh2"
.SH NAME
libssh2_agent_sign - sign data, with the help of ssh-agent
.SH SYNOPSIS
.nf
#include <libssh2.h>
int
libssh2_agent_sign(LIBSSH2_AGENT *agent,
struct libssh2_agent_publickey *identity,
unsigned char **sig,
size_t *s_len,
const unsigned char *data,
size_t d_len,
const char *method,
unsigned int method_len);
.fi
.SH DESCRIPTION
\fIagent\fP - ssh-agent handle as returned by
.BR libssh2_agent_init(3)
\fIidentity\fP - Public key to authenticate with, as returned by
.BR libssh2_agent_get_identity(3)
\fIsig\fP - A pointer to a buffer in which to place the signature. The caller
is responsible for freeing the signature with LIBSSH2_FREE.
\fIs_len\fP - A pointer to the length of the sig parameter.
\fIdata\fP - The data to sign.
\fId_len\fP - The length of the data parameter.
\fImethod\fP - A buffer indicating the signing method. This should match the
string at the start of identity->blob.
\fImethod_len\fP - The length of the method parameter.
Sign data using an ssh-agent. This function can be used in a callback
registered with libssh2_session_callback_set(3) using
LIBSSH2_CALLBACK_AUTHAGENT_SIGN to sign an authentication challenge from a
server. However, the client is responsible for implementing the code that calls
this callback in response to a SSH2_AGENTC_SIGN_REQUEST message.
.SH RETURN VALUE
Returns 0 if succeeded, or a negative value for error.
.SH AVAILABILITY
Added in libssh2 1.11.0
.SH SEE ALSO
.BR libssh2_agent_init(3)
.BR libssh2_agent_get_identity(3)
.BR libssh2_agent_userauth(3)
.BR libssh2_session_callback_set(3)

View File

@ -1,22 +1,25 @@
.\"
.\" Copyright (c) 2009 by Daiki Ueno
.\"
.TH libssh2_agent_userauth 3 "23 Dec 2009" "libssh2 1.2" "libssh2 manual"
.TH libssh2_agent_userauth 3 "23 Dec 2009" "libssh2" "libssh2"
.SH NAME
libssh2_agent_userauth - authenticate a session with a public key, with the help of ssh-agent
.SH SYNOPSIS
.nf
#include <libssh2.h>
int libssh2_agent_userauth(LIBSSH2_AGENT *agent,
const char *username,
struct libssh2_agent_publickey *identity);
int
libssh2_agent_userauth(LIBSSH2_AGENT *agent,
const char *username,
struct libssh2_agent_publickey *identity);
.fi
.SH DESCRIPTION
\fIagent\fP - ssh-agent handle as returned by
\fIagent\fP - ssh-agent handle as returned by
.BR libssh2_agent_init(3)
\fIusername\fP - Remote user name to authenticate as.
\fIidentity\fP - Public key to authenticate with, as returned by
\fIidentity\fP - Public key to authenticate with, as returned by
.BR libssh2_agent_get_identity(3)
Attempt public key authentication with the help of ssh-agent.
@ -27,3 +30,4 @@ Added in libssh2 1.2
.SH SEE ALSO
.BR libssh2_agent_init(3)
.BR libssh2_agent_get_identity(3)
.BR libssh2_agent_sign(3)

View File

@ -1,29 +1,30 @@
.TH libssh2_banner_set 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_banner_set 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_banner_set - set the SSH protocol banner for the local client
.SH SYNOPSIS
.nf
#include <libssh2.h>
int
int
libssh2_banner_set(LIBSSH2_SESSION *session, const char *banner);
.fi
.SH DESCRIPTION
This function is \fBDEPRECATED\fP. Use \fIlibssh2_session_banner_set(3)\fP
instead!
\fIsession\fP - Session instance as returned by
\fIsession\fP - Session instance as returned by
.BR libssh2_session_init_ex(3)
\fIbanner\fP - A pointer to a user defined banner
Set the banner that will be sent to the remote host when the SSH session is
started with
Set the banner that will be sent to the remote host when the SSH session is
started with
.BR libssh2_session_handshake(3)
This is optional; a banner corresponding to the protocol and libssh2 version will be sent by default.
.SH RETURN VALUE
Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se.
.SH AVAILABILITY
Marked as deprecated since 1.4.0
.SH ERRORS

View File

@ -1,15 +1,18 @@
.TH libssh2_base64_decode 3 "23 Dec 2008" "libssh2 1.0" "libssh2 manual"
.TH libssh2_base64_decode 3 "23 Dec 2008" "libssh2 1.0" "libssh2"
.SH NAME
libssh2_base64_decode - decode a base64 encoded string
.SH SYNOPSIS
.nf
#include <libssh2.h>
int libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest,
unsigned int *dest_len, const char *src,
unsigned int src_len);
int
libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest,
unsigned int *dest_len, const char *src,
unsigned int src_len);
.fi
.SH DESCRIPTION
This function is deemed DEPRECATED and will be removed from libssh2 in a
future version. Don't use it!
future version. Do not use it!
Decode a base64 chunk and store it into a newly allocated buffer. 'dest_len'
will be set to hold the length of the returned buffer that '*dest' will point
@ -19,7 +22,7 @@ The returned buffer is allocated by this function, but it is not clear how to
free that memory!
.SH BUGS
The memory that *dest points to is allocated by the malloc function libssh2
uses, but there's no way for an application to free this data in a safe and
uses, but there is no way for an application to free this data in a safe and
reliable way!
.SH RETURN VALUE
0 if successful, \-1 if any error occurred.

View File

@ -1,29 +1,27 @@
.TH libssh2_channel_close 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_channel_close 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_channel_close - close a channel
.SH SYNOPSIS
.nf
#include <libssh2.h>
int
int
libssh2_channel_close(LIBSSH2_CHANNEL *channel);
.fi
.SH DESCRIPTION
\fIchannel\fP - active channel stream to set closed status on.
Close an active data channel. In practice this means sending an SSH_MSG_CLOSE
packet to the remote host which serves as instruction that no further data
will be sent to it. The remote host may still send data back until it sends
its own close message in response. To wait for the remote end to close its
connection as well, follow this command with
Close an active data channel. In practice this means sending an SSH_MSG_CLOSE
packet to the remote host which serves as instruction that no further data
will be sent to it. The remote host may still send data back until it sends
its own close message in response. To wait for the remote end to close its
connection as well, follow this command with
.BR libssh2_channel_wait_closed(3)
.SH RETURN VALUE
Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se.
.SH ERRORS
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
.SH SEE ALSO
.BR libssh2_channel_open_ex(3)

View File

@ -0,0 +1,32 @@
.TH libssh2_channel_direct_streamlocal_ex 3 "10 Apr 2023" "libssh2 1.11.0" "libssh2"
.SH NAME
libssh2_channel_direct_streamlocal_ex - Tunnel a UNIX socket connection through an SSH session
.SH SYNOPSIS
.nf
#include <libssh2.h>
LIBSSH2_CHANNEL *
libssh2_channel_direct_streamlocal_ex(LIBSSH2_SESSION *session,
const char *socket_path,
const char *shost, int sport);
.fi
.SH DESCRIPTION
\fIsession\fP - Session instance as returned by
.BR libssh2_session_init_ex(3)
\fIsocket_path\fP - UNIX socket to connect to using the SSH host as a proxy.
\fIshost\fP - Host to tell the SSH server the connection originated on.
\fIsport\fP - Port to tell the SSH server the connection originated from.
Tunnel a UNIX socket connection through the SSH transport via the remote host to
a third party. Communication from the client to the SSH server remains
encrypted, communication from the server to the 3rd party host travels
in cleartext.
.SH RETURN VALUE
Pointer to a newly allocated LIBSSH2_CHANNEL instance, or NULL on errors.
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
.SH SEE ALSO
.BR libssh2_session_init_ex(3)

View File

@ -1,12 +1,14 @@
.TH libssh2_channel_direct_tcpip 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.TH libssh2_channel_direct_tcpip 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2"
.SH NAME
libssh2_channel_direct_tcpip - convenience macro for \fIlibssh2_channel_direct_tcpip_ex(3)\fP calls
.SH SYNOPSIS
.nf
#include <libssh2.h>
LIBSSH2_CHANNEL *
libssh2_channel_direct_tcpip(LIBSSH2_SESSION *session, const char *host, int port);
libssh2_channel_direct_tcpip(LIBSSH2_SESSION *session,
const char *host, int port);
.fi
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_direct_tcpip_ex(3)\fP.

View File

@ -1,17 +1,21 @@
.TH libssh2_channel_direct_tcpip_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_channel_direct_tcpip_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_channel_direct_tcpip_ex - Tunnel a TCP connection through an SSH session
.SH SYNOPSIS
.nf
#include <libssh2.h>
LIBSSH2_CHANNEL *
libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session, const char *host, int port, const char *shost, int sport);
LIBSSH2_CHANNEL *
libssh2_channel_direct_tcpip(LIBSSH2_SESSION *session, const char *host, int port);
LIBSSH2_CHANNEL *
libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session,
const char *host, int port,
const char *shost, int sport);
LIBSSH2_CHANNEL *
libssh2_channel_direct_tcpip(LIBSSH2_SESSION *session,
const char *host, int port);
.fi
.SH DESCRIPTION
\fIsession\fP - Session instance as returned by
\fIsession\fP - Session instance as returned by
.BR libssh2_session_init_ex(3)
\fIhost\fP - Third party host to connect to using the SSH host as a proxy.
@ -22,11 +26,10 @@ libssh2_channel_direct_tcpip(LIBSSH2_SESSION *session, const char *host, int por
\fIsport\fP - Port to tell the SSH server the connection originated from.
Tunnel a TCP/IP connection through the SSH transport via the remote host to
a third party. Communication from the client to the SSH server remains
encrypted, communication from the server to the 3rd party host travels
Tunnel a TCP/IP connection through the SSH transport via the remote host to
a third party. Communication from the client to the SSH server remains
encrypted, communication from the server to the 3rd party host travels
in cleartext.
.SH RETURN VALUE
Pointer to a newly allocated LIBSSH2_CHANNEL instance, or NULL on errors.
.SH ERRORS

View File

@ -1,11 +1,13 @@
.TH libssh2_channel_eof 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_channel_eof 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_channel_eof - check a channel's EOF status
.SH SYNOPSIS
.nf
#include <libssh2.h>
int
int
libssh2_channel_eof(LIBSSH2_CHANNEL *channel);
.fi
.SH DESCRIPTION
\fIchannel\fP - active channel stream to set closed status on.

View File

@ -1,11 +1,13 @@
.TH libssh2_channel_exec 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.TH libssh2_channel_exec 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2"
.SH NAME
libssh2_channel_exec - convenience macro for \fIlibssh2_channel_process_startup(3)\fP calls
.SH SYNOPSIS
.nf
#include <libssh2.h>
int libssh2_channel_exec(LIBSSH2_CHANNEL *channel, const char *command);
int
libssh2_channel_exec(LIBSSH2_CHANNEL *channel, const char *command);
.fi
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_process_startup(3)\fP.

View File

@ -1,11 +1,13 @@
.TH libssh2_channel_flush 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.TH libssh2_channel_flush 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2"
.SH NAME
libssh2_channel_flush - convenience macro for \fIlibssh2_channel_flush_ex(3)\fP calls
.SH SYNOPSIS
.nf
#include <libssh2.h>
int libssh2_channel_flush(LIBSSH2_CHANNEL *channel);
int
libssh2_channel_flush(LIBSSH2_CHANNEL *channel);
.fi
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_flush_ex(3)\fP.

View File

@ -1,32 +1,32 @@
.TH libssh2_channel_flush_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_channel_flush_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_channel_flush_ex - flush a channel
.SH SYNOPSIS
.nf
#include <libssh2.h>
int
int
libssh2_channel_flush_ex(LIBSSH2_CHANNEL *channel, int streamid);
int
int
libssh2_channel_flush(LIBSSH2_CHANNEL *channel);
int
int
libssh2_channel_flush_stderr(LIBSSH2_CHANNEL *channel);
.fi
.SH DESCRIPTION
\fIchannel\fP - Active channel stream to flush.
\fIstreamid\fP - Specific substream number to flush. Groups of substreams may
\fIstreamid\fP - Specific substream number to flush. Groups of substreams may
be flushed by passing on of the following Constants.
.br
\fBLIBSSH2_CHANNEL_FLUSH_EXTENDED_DATA\fP: Flush all extended data substreams
.br
\fBLIBSSH2_CHANNEL_FLUSH_ALL\fP: Flush all substreams
Flush the read buffer for a given channel instance. Individual substreams may
Flush the read buffer for a given channel instance. Individual substreams may
be flushed by number or using one of the provided macros.
.SH RETURN VALUE
Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
Return the number of bytes flushed or negative on failure.
It returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se.

View File

@ -1,11 +1,13 @@
.TH libssh2_channel_flush_stderr 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.TH libssh2_channel_flush_stderr 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2"
.SH NAME
libssh2_channel_flush_stderr - convenience macro for \fIlibssh2_channel_flush_ex(3)\fP calls
.SH SYNOPSIS
.nf
#include <libssh2.h>
int libssh2_channel_flush_stderr(LIBSSH2_CHANNEL *channel);
int
libssh2_channel_flush_stderr(LIBSSH2_CHANNEL *channel);
.fi
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_flush_ex(3)\fP.

View File

@ -1,12 +1,13 @@
.TH libssh2_channel_forward_accept 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_channel_forward_accept 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_channel_forward_accept - accept a queued connection
.SH SYNOPSIS
.nf
#include <libssh2.h>
LIBSSH2_CHANNEL *
libssh2_channel_forward_accept(LIBSSH2_LISTENER *listener);
.fi
.SH DESCRIPTION
\fIlistener\fP is a forwarding listener instance as returned by
\fBlibssh2_channel_forward_listen_ex(3)\fP.

View File

@ -1,27 +1,25 @@
.TH libssh2_channel_forward_cancel 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_channel_forward_cancel 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_channel_forward_cancel - cancel a forwarded TCP port
.SH SYNOPSIS
.nf
#include <libssh2.h>
int
int
libssh2_channel_forward_cancel(LIBSSH2_LISTENER *listener);
.fi
.SH DESCRIPTION
\fIlistener\fP - Forwarding listener instance as returned by
\fIlistener\fP - Forwarding listener instance as returned by
.BR libssh2_channel_forward_listen_ex(3)
Instruct the remote host to stop listening for new connections on a previously requested host/port.
.SH RETURN VALUE
Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se.
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
.SH SEE ALSO
.BR libssh2_channel_forward_listen_ex(3)

View File

@ -1,11 +1,13 @@
.TH libssh2_channel_forward_listen 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.TH libssh2_channel_forward_listen 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2"
.SH NAME
libssh2_channel_forward_listen - convenience macro for \fIlibssh2_channel_forward_listen_ex(3)\fP calls
.SH SYNOPSIS
.nf
#include <libssh2.h>
int libssh2_channel_forward_listen(LIBSSH2_SESSION *session, int port);
int
libssh2_channel_forward_listen(LIBSSH2_SESSION *session, int port);
.fi
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_forward_listen_ex(3)\fP.

View File

@ -1,21 +1,24 @@
.TH libssh2_channel_forward_listen_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_channel_forward_listen_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_channel_forward_listen_ex - listen to inbound connections
.SH SYNOPSIS
.nf
#include <libssh2.h>
LIBSSH2_LISTENER *
libssh2_channel_forward_listen_ex(LIBSSH2_SESSION *session, char *host, int port, int *bound_port, int queue_maxsize);
LIBSSH2_LISTENER *
libssh2_channel_forward_listen_ex(LIBSSH2_SESSION *session,
char *host, int port,
int *bound_port, int queue_maxsize);
LIBSSH2_LISTENER *
LIBSSH2_LISTENER *
libssh2_channel_forward_listen(LIBSSH2_SESSION *session, int port);
.fi
.SH DESCRIPTION
Instruct the remote SSH server to begin listening for inbound TCP/IP
connections. New connections will be queued by the library until accepted by
\fIlibssh2_channel_forward_accept(3)\fP.
\fIsession\fP - instance as returned by libssh2_session_init().
\fIsession\fP - instance as returned by libssh2_session_init().
\fIhost\fP - specific address to bind to on the remote host. Binding to
0.0.0.0 (default when NULL is passed) will bind to all available addresses.

View File

@ -1,25 +1,24 @@
.TH libssh2_channel_free 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_channel_free 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_channel_free - free all resources associated with a channel
.SH SYNOPSIS
.nf
#include <libssh2.h>
int
int
libssh2_channel_free(LIBSSH2_CHANNEL *channel);
.fi
.SH DESCRIPTION
\fIchannel\fP - Channel stream to free.
Release all resources associated with a channel stream. If the channel has
not yet been closed with
Release all resources associated with a channel stream. If the channel has
not yet been closed with
.BR libssh2_channel_close(3)
, it will be called automatically so that the remote end may know that it
, it will be called automatically so that the remote end may know that it
can safely free its own resources.
.SH RETURN VALUE
Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se.
.SH SEE ALSO
.BR libssh2_channel_close(3)

View File

@ -1,22 +1,26 @@
.TH libssh2_channel_get_exit_signal 3 "4 Oct 2010" "libssh2 1.2.8" "libssh2 manual"
.TH libssh2_channel_get_exit_signal 3 "4 Oct 2010" "libssh2 1.2.8" "libssh2"
.SH NAME
libssh2_channel_get_exit_signal - get the remote exit signal
.SH SYNOPSIS
.nf
#include <libssh2.h>
int
libssh2_channel_get_exit_signal(LIBSSH2_CHANNEL *channel, char **exitsignal, size_t *exitsignal_len, char **errmsg, size_t *errmsg_len, char **langtag, size_t *langtag_len);
int
libssh2_channel_get_exit_signal(LIBSSH2_CHANNEL *channel,
char **exitsignal, size_t *exitsignal_len,
char **errmsg, size_t *errmsg_len,
char **langtag, size_t *langtag_len);
.fi
.SH DESCRIPTION
\fIchannel\fP - Closed channel stream to retrieve exit signal from.
\fIexitsignal\fP - If not NULL, is populated by reference with the exit signal
(without leading "SIG"). Note that the string is stored in a newly allocated
buffer. If the remote program exited cleanly, the referenced string pointer
will be set to NULL.
will be set to NULL.
\fIexitsignal_len\fP - If not NULL, is populated by reference with the length
of exitsignal.
of exitsignal.
\fIerrmsg\fP - If not NULL, is populated by reference with the error message
(if provided by remote server, if not it will be set to NULL). Note that the
@ -24,11 +28,10 @@ string is stored in a newly allocated buffer.
\fIerrmsg_len\fP - If not NULL, is populated by reference with the length of errmsg.
\fIlangtag\fP - If not NULL, is populated by reference with the language tag
\fIlangtag\fP - If not NULL, is populated by reference with the language tag
(if provided by remote server, if not it will be set to NULL). Note that the
string is stored in a newly allocated buffer.
\fIlangtag_len\fP - If not NULL, is populated by reference with the length of langtag.
.SH RETURN VALUE
Numeric error code corresponding to the the Error Code constants.

View File

@ -1,18 +1,18 @@
.TH libssh2_channel_get_exit_status 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_channel_get_exit_status 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_channel_get_exit_status - get the remote exit code
.SH SYNOPSIS
.nf
#include <libssh2.h>
int
int
libssh2_channel_get_exit_status(LIBSSH2_CHANNEL* channel)
.fi
.SH DESCRIPTION
\fIchannel\fP - Closed channel stream to retrieve exit status from.
Returns the exit code raised by the process running on the remote host at
the other end of the named channel. Note that the exit status may not be
Returns the exit code raised by the process running on the remote host at
the other end of the named channel. Note that the exit status may not be
available if the remote end has not yet set its status to closed.
.SH RETURN VALUE
Returns 0 on failure, otherwise the \fIExit Status\fP reported by remote host

View File

@ -1,12 +1,14 @@
.TH libssh2_channel_handle_extended_data 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_channel_handle_extended_data 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_channel_handle_extended_data - set extended data handling mode
.SH SYNOPSIS
.nf
#include <libssh2.h>
void
libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel, int ignore_mode);
void
libssh2_channel_handle_extended_data(LIBSSH2_CHANNEL *channel,
int ignore_mode);
.fi
.SH DESCRIPTION
This function is deprecated. Use the
\fIlibssh2_channel_handle_extended_data2(3)\fP function instead!
@ -15,7 +17,7 @@ This function is deprecated. Use the
\fIignore_mode\fP - One of the three LIBSSH2_CHANNEL_EXTENDED_DATA_* Constants.
.br
\fBLIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL\fP: Queue extended data for eventual
\fBLIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL\fP: Queue extended data for eventual
reading
.br
\fBLIBSSH2_CHANNEL_EXTENDED_DATA_MERGE\fP: Treat extended data and ordinary
@ -23,7 +25,7 @@ data the same. Merge all substreams such that calls to
\fIlibssh2_channel_read(3)\fP will pull from all substreams on a
first-in/first-out basis.
.br
\fBLIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE\fP: Discard all extended data as it
\fBLIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE\fP: Discard all extended data as it
arrives.
Change how a channel deals with extended data packets. By default all extended

View File

@ -1,35 +1,35 @@
.TH libssh2_channel_handle_extended_data2 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_channel_handle_extended_data2 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_channel_handle_extended_data2 - set extended data handling mode
.SH SYNOPSIS
.nf
#include <libssh2.h>
int
libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel, int ignore_mode);
int
libssh2_channel_handle_extended_data2(LIBSSH2_CHANNEL *channel,
int ignore_mode);
.fi
.SH DESCRIPTION
\fIchannel\fP - Active channel stream to change extended data handling on.
\fIignore_mode\fP - One of the three LIBSSH2_CHANNEL_EXTENDED_DATA_* Constants.
.br
\fBLIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL\fP: Queue extended data for eventual
\fBLIBSSH2_CHANNEL_EXTENDED_DATA_NORMAL\fP: Queue extended data for eventual
reading
.br
\fBLIBSSH2_CHANNEL_EXTENDED_DATA_MERGE\fP: Treat extended data and ordinary
data the same. Merge all substreams such that calls to
\fBLIBSSH2_CHANNEL_EXTENDED_DATA_MERGE\fP: Treat extended data and ordinary
data the same. Merge all substreams such that calls to
.BR libssh2_channel_read(3)
will pull from all substreams on a first-in/first-out basis.
.br
\fBLIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE\fP: Discard all extended data as it
\fBLIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE\fP: Discard all extended data as it
arrives.
Change how a channel deals with extended data packets. By default all
extended data is queued until read by
Change how a channel deals with extended data packets. By default all
extended data is queued until read by
.BR libssh2_channel_read_ex(3)
.SH RETURN VALUE
Return 0 on success or LIBSSH2_ERROR_EAGAIN when it would otherwise block.
.SH SEE ALSO
.BR libssh2_channel_handle_extended_data(3)
.BR libssh2_channel_read_ex(3)

View File

@ -1,11 +1,14 @@
.TH libssh2_channel_ignore_extended_data 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.TH libssh2_channel_ignore_extended_data 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2"
.SH NAME
libssh2_channel_ignore_extended_data - convenience macro for \fIlibssh2_channel_handle_extended_data(3)\fP calls
.SH SYNOPSIS
.nf
#include <libssh2.h>
libssh2_channel_ignore_extended_data(arguments)
void
libssh2_channel_ignore_extended_data(LIBSSH2_CHANNEL *channel,
int ignore_mode);
.fi
.SH DESCRIPTION
This function is deprecated. Use the
\fIlibssh2_channel_handle_extended_data2(3)\fP function instead!

View File

@ -1,54 +1,56 @@
.TH libssh2_channel_open_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_channel_open_ex 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_channel_open_ex - establish a generic session channel
.SH SYNOPSIS
.nf
#include <libssh2.h>
LIBSSH2_CHANNEL *
libssh2_channel_open_ex(LIBSSH2_SESSION *session, const char *channel_type, unsigned int channel_type_len, unsigned int window_size, unsigned int packet_size, const char *message, unsigned int message_len);
libssh2_channel_open_ex(LIBSSH2_SESSION *session, const char *channel_type,
unsigned int channel_type_len,
unsigned int window_size,
unsigned int packet_size,
const char *message, unsigned int message_len);
LIBSSH2_CHANNEL *
libssh2_channel_open_session(session);
.fi
.SH DESCRIPTION
\fIsession\fP - Session instance as returned by
\fIsession\fP - Session instance as returned by
.BR libssh2_session_init_ex(3)
\fIchannel_type\fP - Channel type to open. Typically one of session,
direct-tcpip, or tcpip-forward. The SSH2 protocol allowed for additional
\fIchannel_type\fP - Channel type to open. Typically one of session,
direct-tcpip, or tcpip-forward. The SSH2 protocol allowed for additional
types including local, custom channel types.
\fIchannel_type_len\fP - Length of channel_type
\fIwindow_size\fP - Maximum amount of unacknowledged data remote host is
\fIwindow_size\fP - Maximum amount of unacknowledged data remote host is
allowed to send before receiving an SSH_MSG_CHANNEL_WINDOW_ADJUST packet.
\fIpacket_size\fP - Maximum number of bytes remote host is allowed to send
\fIpacket_size\fP - Maximum number of bytes remote host is allowed to send
in a single SSH_MSG_CHANNEL_DATA or SSG_MSG_CHANNEL_EXTENDED_DATA packet.
\fImessage\fP - Additional data as required by the selected channel_type.
\fImessage_len\fP - Length of message parameter.
Allocate a new channel for exchanging data with the server. This method is
typically called through its macroized form:
Allocate a new channel for exchanging data with the server. This method is
typically called through its macroized form:
.BR libssh2_channel_open_session(3)
or via
or via
.BR libssh2_channel_direct_tcpip(3)
or
.BR libssh2_channel_forward_listen(3)
.SH RETURN VALUE
Pointer to a newly allocated LIBSSH2_CHANNEL instance, or NULL on errors.
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
\fILIBSSH2_ERROR_CHANNEL_FAILURE\fP -
\fILIBSSH2_ERROR_CHANNEL_FAILURE\fP -
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would block.
.SH SEE ALSO
Add related functions

View File

@ -1,12 +1,13 @@
.TH libssh2_channel_open_session 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.TH libssh2_channel_open_session 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2"
.SH NAME
libssh2_channel_open_session - convenience macro for \fIlibssh2_channel_open_ex(3)\fP calls
.SH SYNOPSIS
.nf
#include <libssh2.h>
LIBSSH2_CHANNEL *
libssh2_channel_open_session(LIBSSH2_SESSION *session);
.fi
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_open_ex(3)\fP.

View File

@ -1,19 +1,21 @@
.TH libssh2_channel_process_startup 3 "1 Jun 2007" "libssh2 0.15" "libssh2 manual"
.TH libssh2_channel_process_startup 3 "1 Jun 2007" "libssh2 0.15" "libssh2"
.SH NAME
libssh2_channel_process_startup - request a shell on a channel
.SH SYNOPSIS
.nf
#include <libssh2.h>
int libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel,
const char *request,
unsigned int request_len,
const char *message,
unsigned int message_len);
int
libssh2_channel_process_startup(LIBSSH2_CHANNEL *channel,
const char *request,
unsigned int request_len,
const char *message,
unsigned int message_len);
.fi
.SH DESCRIPTION
\fIchannel\fP - Active session channel instance.
\fIrequest\fP - Type of process to startup. The SSH2 protocol currently
\fIrequest\fP - Type of process to startup. The SSH2 protocol currently
defines shell, exec, and subsystem as standard process services.
\fIrequest_len\fP - Length of request parameter.
@ -22,17 +24,17 @@ defines shell, exec, and subsystem as standard process services.
\fImessage_len\fP - Length of message parameter.
Initiate a request on a session type channel such as returned by
Initiate a request on a session type channel such as returned by
.BR libssh2_channel_open_ex(3)
.SH RETURN VALUE
Return 0 on success or negative on failure. It returns
LIBSSH2_ERROR_EAGAIN when it would otherwise block. While
LIBSSH2_ERROR_EAGAIN is a negative number, it isn't really a failure per se.
LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se.
.SH ERRORS
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
\fILIBSSH2_ERROR_CHANNEL_REQUEST_DENIED\fP -
\fILIBSSH2_ERROR_CHANNEL_REQUEST_DENIED\fP -
.SH SEE ALSO
.BR libssh2_channel_open_ex(3)

View File

@ -1,11 +1,14 @@
.TH libssh2_channel_read 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2 manual"
.TH libssh2_channel_read 3 "20 Feb 2010" "libssh2 1.2.4" "libssh2"
.SH NAME
libssh2_channel_read - convenience macro for \fIlibssh2_channel_read_ex(3)\fP calls
.SH SYNOPSIS
.nf
#include <libssh2.h>
ssize_t libssh2_channel_read(LIBSSH2_CHANNEL *channel, char *buf, size_t buflen);
ssize_t
libssh2_channel_read(LIBSSH2_CHANNEL *channel,
char *buf, size_t buflen);
.fi
.SH DESCRIPTION
This is a macro defined in a public libssh2 header file that is using the
underlying function \fIlibssh2_channel_read_ex(3)\fP.

Some files were not shown because too many files have changed in this diff Show More