mirror of
https://github.com/php-win-ext/libssh2.git
synced 2026-04-25 09:38:08 +02:00
Compare commits
27 Commits
libssh2-1.4.2
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 60401ec4c2 | |||
| c9d9ea4f2d | |||
| 660faf6946 | |||
| 314c2127c2 | |||
| 6b93b1a5ab | |||
| 40fd51727e | |||
| 557e55cd59 | |||
| 8dc8fa5e1f | |||
| f93d744e98 | |||
| 15f0a3a1f0 | |||
| 29ad98fd94 | |||
| c4da10e055 | |||
| 5575ab639f | |||
| a365c4b36b | |||
| a56bb0f5f7 | |||
| a5fa8b438a | |||
| 97e8f97daa | |||
| 41ac52760c | |||
| 65ee8928d0 | |||
| 3283fa5cca | |||
| 243b685dc6 | |||
| 658c0e74e8 | |||
| 6766c003a5 | |||
| f1650ecd31 | |||
| 4eb4bf99ee | |||
| a97f508ed6 | |||
| 613bf4c912 |
+117
@@ -0,0 +1,117 @@
|
|||||||
|
# Copyright (c) 2014, 2015 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.
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 2.8.11)
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
option(BUILD_SHARED_LIBS "Build Shared Libraries" OFF)
|
||||||
|
|
||||||
|
# Parse version
|
||||||
|
|
||||||
|
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/include/libssh2.h _HEADER_CONTENTS)
|
||||||
|
string(
|
||||||
|
REGEX REPLACE ".*#define LIBSSH2_VERSION[ \t]+\"([^\"]+)\".*" "\\1"
|
||||||
|
LIBSSH2_VERSION "${_HEADER_CONTENTS}")
|
||||||
|
string(
|
||||||
|
REGEX REPLACE ".*#define LIBSSH2_VERSION_MAJOR[ \t]+([0-9]+).*" "\\1"
|
||||||
|
LIBSSH2_VERSION_MAJOR "${_HEADER_CONTENTS}")
|
||||||
|
string(
|
||||||
|
REGEX REPLACE ".*#define LIBSSH2_VERSION_MINOR[ \t]+([0-9]+).*" "\\1"
|
||||||
|
LIBSSH2_VERSION_MINOR "${_HEADER_CONTENTS}")
|
||||||
|
string(
|
||||||
|
REGEX REPLACE ".*#define LIBSSH2_VERSION_PATCH[ \t]+([0-9]+).*" "\\1"
|
||||||
|
LIBSSH2_VERSION_PATCH "${_HEADER_CONTENTS}")
|
||||||
|
|
||||||
|
if(NOT LIBSSH2_VERSION OR
|
||||||
|
NOT LIBSSH2_VERSION_MAJOR MATCHES "^[0-9]+$" OR
|
||||||
|
NOT LIBSSH2_VERSION_MINOR MATCHES "^[0-9]+$" OR
|
||||||
|
NOT LIBSSH2_VERSION_PATCH MATCHES "^[0-9]+$")
|
||||||
|
message(
|
||||||
|
FATAL_ERROR
|
||||||
|
"Unable to parse version from"
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/include/libssh2.h")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
install(
|
||||||
|
FILES docs/AUTHORS COPYING docs/HACKING README RELEASE-NOTES NEWS
|
||||||
|
DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
||||||
|
|
||||||
|
include(max_warnings)
|
||||||
|
include(FeatureSummary)
|
||||||
|
|
||||||
|
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)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
option(LINT "Check style while building" OFF)
|
||||||
|
if(LINT)
|
||||||
|
add_custom_target(lint ALL
|
||||||
|
./ci/checksrc.sh
|
||||||
|
WORKING_DIRECTORY ${libssh2_SOURCE_DIR})
|
||||||
|
add_dependencies(libssh2 lint)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_subdirectory(docs)
|
||||||
|
|
||||||
|
feature_summary(WHAT ALL)
|
||||||
|
|
||||||
|
set(CPACK_PACKAGE_VERSION_MAJOR ${LIBSSH2_VERSION_MAJOR})
|
||||||
|
set(CPACK_PACKAGE_VERSION_MINOR ${LIBSSH2_VERSION_MINOR})
|
||||||
|
set(CPACK_PACKAGE_VERSION_PATCH ${LIBSSH2_VERSION_PATCH})
|
||||||
|
set(CPACK_PACKAGE_VERSION ${LIBSSH2_VERSION})
|
||||||
|
include(CPack)
|
||||||
@@ -2,8 +2,10 @@
|
|||||||
* Copyright (c) 2005,2006 Mikhail Gusarov <dottedmag@dottedmag.net>
|
* Copyright (c) 2005,2006 Mikhail Gusarov <dottedmag@dottedmag.net>
|
||||||
* Copyright (c) 2006-2007 The Written Word, Inc.
|
* Copyright (c) 2006-2007 The Written Word, Inc.
|
||||||
* Copyright (c) 2007 Eli Fant <elifantu@mail.ru>
|
* Copyright (c) 2007 Eli Fant <elifantu@mail.ru>
|
||||||
* Copyright (c) 2009 Daniel Stenberg
|
* Copyright (c) 2009-2021 Daniel Stenberg
|
||||||
* Copyright (C) 2008, 2009 Simon Josefsson
|
* Copyright (C) 2008, 2009 Simon Josefsson
|
||||||
|
* Copyright (c) 2000 Markus Friedl
|
||||||
|
* Copyright (c) 2015 Microsoft Corp.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms,
|
* Redistribution and use in source and binary forms,
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
CRYPTO_CSOURCES = openssl.c
|
||||||
|
CRYPTO_HHEADERS = openssl.h
|
||||||
|
CRYPTO_LTLIBS = $(LTLIBSSL)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
CRYPTO_CSOURCES = wincng.c
|
||||||
|
CRYPTO_HHEADERS = wincng.h
|
||||||
|
CRYPTO_LTLIBS = $(LTLIBBCRYPT) $(LTLIBCRYPT32)
|
||||||
+26
-7
@@ -14,10 +14,9 @@ include_HEADERS = \
|
|||||||
include/libssh2_sftp.h
|
include/libssh2_sftp.h
|
||||||
|
|
||||||
NETWAREFILES = nw/keepscreen.c \
|
NETWAREFILES = nw/keepscreen.c \
|
||||||
nw/Makefile \
|
nw/nwlib.c \
|
||||||
nw/Makefile.netware \
|
nw/GNUmakefile \
|
||||||
nw/nwlib.c \
|
nw/test/GNUmakefile
|
||||||
nw/test/Makefile.netware
|
|
||||||
|
|
||||||
DSP = win32/libssh2.dsp
|
DSP = win32/libssh2.dsp
|
||||||
VCPROJ = win32/libssh2.vcproj
|
VCPROJ = win32/libssh2.vcproj
|
||||||
@@ -33,8 +32,20 @@ win32/libssh2_config.h win32/config.mk win32/rules.mk \
|
|||||||
win32/Makefile.Watcom win32/libssh2.dsw win32/tests.dsp $(DSP) \
|
win32/Makefile.Watcom win32/libssh2.dsw win32/tests.dsp $(DSP) \
|
||||||
win32/msvcproj.head win32/msvcproj.foot win32/libssh2.rc
|
win32/msvcproj.head win32/msvcproj.foot win32/libssh2.rc
|
||||||
|
|
||||||
EXTRA_DIST = $(WIN32FILES) buildconf $(NETWAREFILES) get_ver.awk HACKING \
|
OS400FILES = os400/README400 os400/initscript.sh os400/make.sh \
|
||||||
maketgz NMakefile TODO RELEASE-NOTES libssh2.pc.in $(VMSFILES)
|
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)
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
@@ -76,6 +87,9 @@ gen-coverage:
|
|||||||
coverage: init-coverage build-coverage gen-coverage
|
coverage: init-coverage build-coverage gen-coverage
|
||||||
|
|
||||||
# DSP/VCPROJ generation adapted from libcurl
|
# 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
|
# Makefile.inc provides the CSOURCES and HHEADERS defines
|
||||||
include Makefile.inc
|
include Makefile.inc
|
||||||
|
|
||||||
@@ -105,7 +119,7 @@ $(DSP): win32/msvcproj.head win32/msvcproj.foot Makefile.am
|
|||||||
for file in $$sorted_hdrs; do \
|
for file in $$sorted_hdrs; do \
|
||||||
echo "# Begin Source File"; \
|
echo "# Begin Source File"; \
|
||||||
echo ""; \
|
echo ""; \
|
||||||
if [ "$$file" == "libssh2_config.h" ]; \
|
if [ "$$file" = "libssh2_config.h" ]; \
|
||||||
then \
|
then \
|
||||||
echo "SOURCE=.\\"$$file; \
|
echo "SOURCE=.\\"$$file; \
|
||||||
else \
|
else \
|
||||||
@@ -133,3 +147,8 @@ $(VCPROJ): win32/vc8proj.head win32/vc8proj.foot Makefile.am
|
|||||||
done; \
|
done; \
|
||||||
cat $(srcdir)/vc8proj.foot) | \
|
cat $(srcdir)/vc8proj.foot) | \
|
||||||
awk '{printf("%s\r\n", gensub("\r", "", "g"))}' > $@ )
|
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]
|
||||||
|
|||||||
+516
-266
File diff suppressed because it is too large
Load Diff
+4
-4
@@ -1,7 +1,7 @@
|
|||||||
CSOURCES = channel.c comp.c crypt.c hostkey.c kex.c mac.c misc.c \
|
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 \
|
packet.c publickey.c scp.c session.c sftp.c userauth.c transport.c \
|
||||||
version.c knownhost.c agent.c openssl.c libgcrypt.c pem.c keepalive.c \
|
version.c knownhost.c agent.c $(CRYPTO_CSOURCES) pem.c keepalive.c global.c \
|
||||||
global.c
|
blowfish.c bcrypt_pbkdf.c agent_win.c
|
||||||
|
|
||||||
HHEADERS = libssh2_priv.h openssl.h libgcrypt.h transport.h channel.h \
|
HHEADERS = libssh2_priv.h $(CRYPTO_HHEADERS) transport.h channel.h comp.h \
|
||||||
comp.h mac.h misc.h packet.h userauth.h session.h sftp.h crypto.h
|
mac.h misc.h packet.h userauth.h session.h sftp.h crypto.h blf.h agent.h
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
CRYPTO_CSOURCES = libgcrypt.c
|
||||||
|
CRYPTO_HHEADERS = libgcrypt.h
|
||||||
|
CRYPTO_LTLIBS = $(LTLIBGCRYPT)
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
CRYPTO_CSOURCES = mbedtls.c
|
||||||
|
CRYPTO_HHEADERS = mbedtls.h
|
||||||
|
CRYPTO_LTLIBS = $(LTLIBMBEDCRYPTO)
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
CRYPTO_CSOURCES = os400qc3.c
|
||||||
|
CRYPTO_HHEADERS = os400qc3.h
|
||||||
@@ -1,19 +1,33 @@
|
|||||||
!include "win32/config.mk"
|
!include "win32/config.mk"
|
||||||
|
|
||||||
|
!if "$(WITH_WINCNG)" == "1"
|
||||||
|
!include "Makefile.WinCNG.inc"
|
||||||
|
!else
|
||||||
|
!include "Makefile.OpenSSL.inc"
|
||||||
|
!endif
|
||||||
|
!include "Makefile.inc"
|
||||||
|
|
||||||
|
OBJECTS=$(CSOURCES:.c=.obj)
|
||||||
|
|
||||||
# SUBDIRS=src example
|
# SUBDIRS=src example
|
||||||
SUBDIRS=src
|
SUBDIRS=src
|
||||||
|
|
||||||
all-sub:
|
all-sub: win32\objects.mk
|
||||||
-for %D in ($(SUBDIRS)) do $(MAKE) /nologo /f %D/NMakefile BUILD=$(BUILD) SUBDIR=%D all-sub
|
-for %D in ($(SUBDIRS)) do $(MAKE) /nologo /f %D/NMakefile BUILD=$(BUILD) SUBDIR=%D all-sub
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
-rmdir /s/q $(TARGET)
|
-rmdir 2>NUL /s/q $(TARGET)
|
||||||
|
-del 2>NUL win32\objects.mk
|
||||||
|
|
||||||
real-clean: clean
|
real-clean vclean: clean
|
||||||
-del libssh2.dll
|
-del 2>NUL libssh2.dll
|
||||||
-del libssh2.exp
|
-del 2>NUL libssh2.exp
|
||||||
-del libssh2.ilk
|
-del 2>NUL libssh2.ilk
|
||||||
-del libssh2.lib
|
-del 2>NUL libssh2.lib
|
||||||
-del *.pdb
|
-del 2>NUL *.pdb
|
||||||
|
|
||||||
|
win32\objects.mk: Makefile.inc
|
||||||
|
@echo OBJECTS = \>$@
|
||||||
|
@for %O in ($(OBJECTS)) do @echo $$(INTDIR)\%O \>>$@
|
||||||
|
@echo $$(EOL)>>$@
|
||||||
|
|
||||||
|
|||||||
@@ -4,94 +4,16 @@ libssh2 - SSH2 library
|
|||||||
libssh2 is a library implementing the SSH2 protocol, available under
|
libssh2 is a library implementing the SSH2 protocol, available under
|
||||||
the revised BSD license.
|
the revised BSD license.
|
||||||
|
|
||||||
Web site: http://www.libssh2.org/
|
Web site: https://www.libssh2.org/
|
||||||
|
|
||||||
Mailing list: http://cool.haxx.se/mailman/listinfo/libssh2-devel
|
Mailing list: https://cool.haxx.se/mailman/listinfo/libssh2-devel
|
||||||
|
|
||||||
Generic installation instructions are in INSTALL. Some ./configure
|
License: see COPYING
|
||||||
options deserve additional comments:
|
|
||||||
|
|
||||||
* --enable-crypt-none
|
Source code: https://github.com/libssh2/libssh2
|
||||||
|
|
||||||
The SSH2 Transport allows for unencrypted data
|
Web site source code: https://github.com/libssh2/www
|
||||||
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
|
Installation instructions are in:
|
||||||
negotiable method, however it still requires that the
|
- docs/INSTALL_CMAKE for CMake
|
||||||
method be advertized by the remote end and that no
|
- docs/INSTALL_AUTOTOOLS for Autotools
|
||||||
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
|
|
||||||
(http://www.gnupg.org/) for cryptographic operations.
|
|
||||||
Either Libgcrypt or OpenSSL is required.
|
|
||||||
|
|
||||||
Configure will attempt to locate Libgcrypt
|
|
||||||
automatically.
|
|
||||||
|
|
||||||
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
|
|
||||||
(http://www.openssl.org) for cryptographic operations.
|
|
||||||
Either Libgcrypt or OpenSSL is required.
|
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
* --with-libz
|
|
||||||
* --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 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).
|
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
# libssh2
|
|
||||||
|
|
||||||
libssh2 is a client-side C library implementing the SSH2 protocol.
|
|
||||||
|
|
||||||
# Building for PHP
|
|
||||||
|
|
||||||
libssh2 depends on openssl and zlib. To build follow these steps:
|
|
||||||
|
|
||||||
* create a directory named "deps" inside the root of libssh2 source tree and put the dependencies there
|
|
||||||
* use win32/libssh2.vcproj to build the libssh2 with VS2008
|
|
||||||
+55
-14
@@ -1,21 +1,62 @@
|
|||||||
libssh2 1.4.2
|
libssh2 1.10
|
||||||
|
|
||||||
This release includes the following bugfixes:
|
This release includes the following enhancements and bugfixes:
|
||||||
|
|
||||||
o Return LIBSSH2_ERROR_SOCKET_DISCONNECT on EOF when reading banner
|
o adds agent forwarding support
|
||||||
o userauth.c: fread() from public key file to correctly detect any errors
|
o adds OpenSSH Agent support on Windows
|
||||||
o configure.ac: Add option to disable build of the example applications
|
o adds ECDSA key support using the Mbed TLS backend
|
||||||
o Added 'Requires.private:' line to libssh2.pc
|
o adds ECDSA cert authentication
|
||||||
o SFTP: filter off incoming "zombie" responses
|
o adds diffie-hellman-group14-sha256, diffie-hellman-group16-sha512,
|
||||||
o gettimeofday: no need for a replacement under cygwin
|
diffie-hellman-group18-sha512 key exchanges
|
||||||
o SSH_MSG_CHANNEL_REQUEST: default to want_reply
|
o adds support for PKIX key reading when using ed25519 with OpenSSL
|
||||||
o win32/libssh2_config.h: Remove hardcoded #define LIBSSH2_HAVE_ZLIB
|
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
|
||||||
|
|
||||||
This release would not have looked like this without help, code, reports and
|
This release would not have looked like this without help, code, reports and
|
||||||
advice from friends like these:
|
advice from friends like these:
|
||||||
|
|
||||||
Alexander Lamaison, Rafael Kitover, Guenter Knauf, Peter Stuge,
|
katzer, Orgad Shaneh, mark-i-m, Zenju, axjowa, Thilo Schulz,
|
||||||
Oleksiy Zagorskyi
|
Etienne Samson, hlefebvre, seba30, Panos, jethrogb, Fabrice Fontaine,
|
||||||
|
Will Cosgrove, Daniel Stenberg, Michael Buckley, Wallace Souza Silva,
|
||||||
Thanks! (and sorry if I forgot to mention someone)
|
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)
|
||||||
|
|||||||
+128
@@ -382,3 +382,131 @@ AC_DEFUN([CURL_CONFIGURE_REENTRANT], [
|
|||||||
#
|
#
|
||||||
])
|
])
|
||||||
|
|
||||||
|
dnl LIBSSH2_LIB_HAVE_LINKFLAGS
|
||||||
|
dnl --------------------------
|
||||||
|
dnl Wrapper around AC_LIB_HAVE_LINKFLAGS to also check $prefix/lib, if set.
|
||||||
|
dnl
|
||||||
|
dnl autoconf only checks $prefix/lib64 if gcc -print-search-dirs output
|
||||||
|
dnl includes a directory named lib64. So, to find libraries in $prefix/lib
|
||||||
|
dnl we append -L$prefix/lib to LDFLAGS before checking.
|
||||||
|
dnl
|
||||||
|
dnl For conveniece, $4 is expanded if [lib]$1 is found.
|
||||||
|
|
||||||
|
AC_DEFUN([LIBSSH2_LIB_HAVE_LINKFLAGS], [
|
||||||
|
libssh2_save_CPPFLAGS="$CPPFLAGS"
|
||||||
|
libssh2_save_LDFLAGS="$LDFLAGS"
|
||||||
|
|
||||||
|
if test "${with_lib$1_prefix+set}" = set; then
|
||||||
|
CPPFLAGS="$CPPFLAGS${CPPFLAGS:+ }-I${with_lib$1_prefix}/include"
|
||||||
|
LDFLAGS="$LDFLAGS${LDFLAGS:+ }-L${with_lib$1_prefix}/lib"
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_LIB_HAVE_LINKFLAGS([$1], [$2], [$3])
|
||||||
|
|
||||||
|
LDFLAGS="$libssh2_save_LDFLAGS"
|
||||||
|
|
||||||
|
if test "$ac_cv_lib$1" = "yes"; then :
|
||||||
|
$4
|
||||||
|
else
|
||||||
|
CPPFLAGS="$libssh2_save_CPPFLAGS"
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([LIBSSH2_CHECK_CRYPTO], [
|
||||||
|
if test "$use_crypto" = "auto" && test "$found_crypto" = "none" || test "$use_crypto" = "$1"; then
|
||||||
|
m4_case([$1],
|
||||||
|
[openssl], [
|
||||||
|
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})"
|
||||||
|
])
|
||||||
|
],
|
||||||
|
|
||||||
|
[libgcrypt], [
|
||||||
|
LIBSSH2_LIB_HAVE_LINKFLAGS([gcrypt], [], [#include <gcrypt.h>], [
|
||||||
|
AC_DEFINE(LIBSSH2_LIBGCRYPT, 1, [Use $1])
|
||||||
|
found_crypto="$1"
|
||||||
|
])
|
||||||
|
],
|
||||||
|
|
||||||
|
[mbedtls], [
|
||||||
|
LIBSSH2_LIB_HAVE_LINKFLAGS([mbedcrypto], [], [#include <mbedtls/version.h>], [
|
||||||
|
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>])
|
||||||
|
|
||||||
|
LIBSSH2_LIB_HAVE_LINKFLAGS([crypt32], [], [
|
||||||
|
#include <windows.h>
|
||||||
|
#include <wincrypt.h>
|
||||||
|
])
|
||||||
|
LIBSSH2_LIB_HAVE_LINKFLAGS([bcrypt], [], [
|
||||||
|
#include <windows.h>
|
||||||
|
#include <bcrypt.h>
|
||||||
|
], [
|
||||||
|
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"
|
||||||
|
])
|
||||||
|
],
|
||||||
|
)
|
||||||
|
test "$found_crypto" = "none" &&
|
||||||
|
crypto_errors="${crypto_errors}No $1 crypto library found!
|
||||||
|
"
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
|
||||||
|
dnl LIBSSH2_CHECK_OPTION_WERROR
|
||||||
|
dnl -------------------------------------------------
|
||||||
|
dnl Verify if configure has been invoked with option
|
||||||
|
dnl --enable-werror or --disable-werror, and set
|
||||||
|
dnl shell variable want_werror as appropriate.
|
||||||
|
|
||||||
|
AC_DEFUN([LIBSSH2_CHECK_OPTION_WERROR], [
|
||||||
|
AC_BEFORE([$0],[LIBSSH2_CHECK_COMPILER])dnl
|
||||||
|
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]),
|
||||||
|
OPT_COMPILER_WERROR=$enableval)
|
||||||
|
case "$OPT_COMPILER_WERROR" in
|
||||||
|
no)
|
||||||
|
dnl --disable-werror option used
|
||||||
|
want_werror="no"
|
||||||
|
;;
|
||||||
|
default)
|
||||||
|
dnl configure option not specified
|
||||||
|
want_werror="no"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
dnl --enable-werror option used
|
||||||
|
want_werror="yes"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
AC_MSG_RESULT([$want_werror])
|
||||||
|
|
||||||
|
if test X"$want_werror" = Xyes; then
|
||||||
|
CFLAGS="$CFLAGS -Werror"
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
|
|||||||
Vendored
+675
-384
File diff suppressed because it is too large
Load Diff
@@ -1,22 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
LIBTOOLIZE="libtoolize"
|
|
||||||
|
|
||||||
if [ "x`which $LIBTOOLIZE`" = "x" ]; then
|
|
||||||
LIBTOOLIZE="glibtoolize"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x`which $LIBTOOLIZE`" = "x" ]; then
|
|
||||||
echo "Neither libtoolize nor glibtoolize could be found!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
${LIBTOOLIZE} --copy --automake --force
|
|
||||||
${ACLOCAL:-aclocal} -I m4 $ACLOCAL_FLAGS
|
|
||||||
${AUTOHEADER:-autoheader}
|
|
||||||
# copy the private libssh2_config.h.in to the examples dir so that
|
|
||||||
# it can be included without pointing the include path to the private
|
|
||||||
# source dir
|
|
||||||
cp src/libssh2_config.h.in example/libssh2_config.h.in
|
|
||||||
${AUTOCONF:-autoconf}
|
|
||||||
${AUTOMAKE:-automake} --add-missing --copy
|
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
|
||||||
|
# - check_function_exists_maybe_need_library(<function> <var> [lib1 ... libn])
|
||||||
|
#
|
||||||
|
# Check if function is available for linking, first without extra libraries, and
|
||||||
|
# then, if not found that way, linking in each optional library as well. This
|
||||||
|
# function is similar to autotools AC_SEARCH_LIBS.
|
||||||
|
#
|
||||||
|
# If the function if found, this will define <var>.
|
||||||
|
#
|
||||||
|
# If the function was only found by linking in an additional library, this
|
||||||
|
# will define NEED_LIB_LIBX, where LIBX is the one of lib1 to libn that
|
||||||
|
# makes the function available, in uppercase.
|
||||||
|
#
|
||||||
|
# The following variables may be set before calling this macro to
|
||||||
|
# modify the way the check is run:
|
||||||
|
#
|
||||||
|
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
|
||||||
|
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
|
||||||
|
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||||
|
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||||
|
#
|
||||||
|
|
||||||
|
include(CheckFunctionExists)
|
||||||
|
include(CheckLibraryExists)
|
||||||
|
|
||||||
|
function(check_function_exists_may_need_library function variable)
|
||||||
|
|
||||||
|
check_function_exists(${function} ${variable})
|
||||||
|
|
||||||
|
if(NOT ${variable})
|
||||||
|
foreach(lib ${ARGN})
|
||||||
|
string(TOUPPER ${lib} UP_LIB)
|
||||||
|
# Use new variable to prevent cache from previous step shortcircuiting
|
||||||
|
# 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()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endfunction()
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
include(CheckCSourceCompiles)
|
||||||
|
|
||||||
|
# - check_nonblocking_socket_support()
|
||||||
|
#
|
||||||
|
# Check for how to set a socket to non-blocking state. There seems to exist
|
||||||
|
# four known different ways, with the one used almost everywhere being POSIX
|
||||||
|
# and XPG3, while the other different ways for different systems (old BSD,
|
||||||
|
# Windows and Amiga).
|
||||||
|
#
|
||||||
|
# One of the following variables will be set indicating the supported
|
||||||
|
# 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:
|
||||||
|
#
|
||||||
|
# CMAKE_REQUIRED_FLAGS = string of compile command line flags
|
||||||
|
# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
|
||||||
|
# CMAKE_REQUIRED_INCLUDES = list of include directories
|
||||||
|
# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
|
||||||
|
#
|
||||||
|
macro(check_nonblocking_socket_support)
|
||||||
|
# There are two known platforms (AIX 3.x and SunOS 4.1.x) where the
|
||||||
|
# O_NONBLOCK define is found but does not work.
|
||||||
|
check_c_source_compiles("
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
#if defined(sun) || defined(__sun__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
|
||||||
|
# if defined(__SVR4) || defined(__srv4__)
|
||||||
|
# define PLATFORM_SOLARIS
|
||||||
|
# else
|
||||||
|
# define PLATFORM_SUNOS4
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
#if (defined(_AIX) || defined(__xlC__)) && !defined(_AIX41)
|
||||||
|
# define PLATFORM_AIX_V3
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(PLATFORM_SUNOS4) || defined(PLATFORM_AIX_V3) || defined(__BEOS__)
|
||||||
|
#error \"O_NONBLOCK does not work on this platform\"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int socket;
|
||||||
|
int flags = fcntl(socket, F_SETFL, flags | 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 socket;
|
||||||
|
int flags = ioctl(socket, FIONBIO, &flags);
|
||||||
|
}"
|
||||||
|
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?) */
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int socket;
|
||||||
|
int flags = IoctlSocket(socket, FIONBIO, (long)1);
|
||||||
|
}"
|
||||||
|
HAVE_IOCTLSOCKET_CASE)
|
||||||
|
|
||||||
|
if(NOT HAVE_IOCTLSOCKET_CASE)
|
||||||
|
check_c_source_compiles("/* SO_NONBLOCK test (BeOS) */
|
||||||
|
#include <socket.h>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
long b = 1;
|
||||||
|
int socket;
|
||||||
|
int flags = 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()
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
include(CMakeParseArguments)
|
||||||
|
|
||||||
|
function(ADD_TARGET_TO_COPY_DEPENDENCIES)
|
||||||
|
set(options)
|
||||||
|
set(oneValueArgs TARGET)
|
||||||
|
set(multiValueArgs DEPENDENCIES BEFORE_TARGETS)
|
||||||
|
cmake_parse_arguments(COPY
|
||||||
|
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||||
|
|
||||||
|
if(NOT COPY_DEPENDENCIES)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Using a custom target to drive custom commands stops multiple
|
||||||
|
# parallel builds trying to kick off the commands at the same time
|
||||||
|
add_custom_target(${COPY_TARGET})
|
||||||
|
|
||||||
|
foreach(target ${COPY_BEFORE_TARGETS})
|
||||||
|
add_dependencies(${target} ${COPY_TARGET})
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
foreach(dependency ${COPY_DEPENDENCIES})
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
TARGET ${COPY_TARGET}
|
||||||
|
DEPENDS ${dependency}
|
||||||
|
# Make directory first otherwise file is copied in place of
|
||||||
|
# directory instead of into it
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
ARGS -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
ARGS -E copy ${dependency} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
|
||||||
|
VERBATIM)
|
||||||
|
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
endfunction()
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
# - Try to find Libgcrypt
|
||||||
|
# This will define all or none of:
|
||||||
|
# LIBGCRYPT_FOUND - if Libgcrypt headers and library was found
|
||||||
|
# LIBGCRYPT_INCLUDE_DIRS - The Libgcrypt include directories
|
||||||
|
# LIBGCRYPT_LIBRARIES - The libraries needed to use Libgcrypt
|
||||||
|
|
||||||
|
find_path(LIBGCRYPT_INCLUDE_DIR gcrypt.h)
|
||||||
|
|
||||||
|
find_library(LIBGCRYPT_LIBRARY NAMES gcrypt libgcrypt)
|
||||||
|
|
||||||
|
set(LIBGCRYPT_LIBRARIES ${LIBGCRYPT_LIBRARY})
|
||||||
|
set(LIBGCRYPT_INCLUDE_DIRS ${LIBGCRYPT_INCLUDE_DIR})
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(Libgcrypt DEFAULT_MSG
|
||||||
|
LIBGCRYPT_LIBRARY LIBGCRYPT_INCLUDE_DIR)
|
||||||
|
|
||||||
|
mark_as_advanced(LIBGCRYPT_INCLUDE_DIR LIBGCRYPT_LIBRARY)
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
# - Try to find mbedTLS
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# Read-Only variables
|
||||||
|
# MBEDTLS_FOUND - system has mbedTLS
|
||||||
|
# MBEDTLS_INCLUDE_DIR - the mbedTLS include directory
|
||||||
|
# MBEDTLS_LIBRARY_DIR - the mbedTLS library directory
|
||||||
|
# MBEDTLS_LIBRARIES - Link these to use mbedTLS
|
||||||
|
# MBEDTLS_LIBRARY - path to mbedTLS library
|
||||||
|
# MBEDX509_LIBRARY - path to mbedTLS X.509 library
|
||||||
|
# MBEDCRYPTO_LIBRARY - path to mbedTLS Crypto library
|
||||||
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
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_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)
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(
|
||||||
|
MBEDTLS_INCLUDE_DIR
|
||||||
|
MBEDTLS_LIBRARY_DIR
|
||||||
|
MBEDTLS_LIBRARIES
|
||||||
|
MBEDTLS_LIBRARY
|
||||||
|
MBEDX509_LIBRARY
|
||||||
|
MBEDCRYPTO_LIBRARY
|
||||||
|
)
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
# 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()
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
# 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")
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
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()
|
||||||
|
|
||||||
|
# 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()
|
||||||
|
endif()
|
||||||
@@ -0,0 +1,348 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
# Wrapper for compilers which do not understand '-c -o'.
|
||||||
|
|
||||||
|
scriptversion=2018-03-07.03; # UTC
|
||||||
|
|
||||||
|
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
|
||||||
|
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||||
|
#
|
||||||
|
# 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
|
||||||
|
# the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
# any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
# As a special exception to the GNU General Public License, if you
|
||||||
|
# distribute this file as part of a program that contains a
|
||||||
|
# configuration script generated by Autoconf, you may include it under
|
||||||
|
# the same distribution terms that you use for the rest of that program.
|
||||||
|
|
||||||
|
# This file is maintained in Automake, please report
|
||||||
|
# bugs to <bug-automake@gnu.org> or send patches to
|
||||||
|
# <automake-patches@gnu.org>.
|
||||||
|
|
||||||
|
nl='
|
||||||
|
'
|
||||||
|
|
||||||
|
# We need space, tab and new line, in precisely that order. Quoting is
|
||||||
|
# there to prevent tools from complaining about whitespace usage.
|
||||||
|
IFS=" "" $nl"
|
||||||
|
|
||||||
|
file_conv=
|
||||||
|
|
||||||
|
# func_file_conv build_file lazy
|
||||||
|
# Convert a $build file to $host form and store it in $file
|
||||||
|
# Currently only supports Windows hosts. If the determined conversion
|
||||||
|
# type is listed in (the comma separated) LAZY, no conversion will
|
||||||
|
# take place.
|
||||||
|
func_file_conv ()
|
||||||
|
{
|
||||||
|
file=$1
|
||||||
|
case $file in
|
||||||
|
/ | /[!/]*) # absolute file, and not a UNC file
|
||||||
|
if test -z "$file_conv"; then
|
||||||
|
# lazily determine how to convert abs files
|
||||||
|
case `uname -s` in
|
||||||
|
MINGW*)
|
||||||
|
file_conv=mingw
|
||||||
|
;;
|
||||||
|
CYGWIN* | MSYS*)
|
||||||
|
file_conv=cygwin
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
file_conv=wine
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
case $file_conv/,$2, in
|
||||||
|
*,$file_conv,*)
|
||||||
|
;;
|
||||||
|
mingw/*)
|
||||||
|
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||||
|
;;
|
||||||
|
cygwin/* | msys/*)
|
||||||
|
file=`cygpath -m "$file" || echo "$file"`
|
||||||
|
;;
|
||||||
|
wine/*)
|
||||||
|
file=`winepath -w "$file" || echo "$file"`
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# func_cl_dashL linkdir
|
||||||
|
# Make cl look for libraries in LINKDIR
|
||||||
|
func_cl_dashL ()
|
||||||
|
{
|
||||||
|
func_file_conv "$1"
|
||||||
|
if test -z "$lib_path"; then
|
||||||
|
lib_path=$file
|
||||||
|
else
|
||||||
|
lib_path="$lib_path;$file"
|
||||||
|
fi
|
||||||
|
linker_opts="$linker_opts -LIBPATH:$file"
|
||||||
|
}
|
||||||
|
|
||||||
|
# func_cl_dashl library
|
||||||
|
# Do a library search-path lookup for cl
|
||||||
|
func_cl_dashl ()
|
||||||
|
{
|
||||||
|
lib=$1
|
||||||
|
found=no
|
||||||
|
save_IFS=$IFS
|
||||||
|
IFS=';'
|
||||||
|
for dir in $lib_path $LIB
|
||||||
|
do
|
||||||
|
IFS=$save_IFS
|
||||||
|
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||||
|
found=yes
|
||||||
|
lib=$dir/$lib.dll.lib
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if test -f "$dir/$lib.lib"; then
|
||||||
|
found=yes
|
||||||
|
lib=$dir/$lib.lib
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if test -f "$dir/lib$lib.a"; then
|
||||||
|
found=yes
|
||||||
|
lib=$dir/lib$lib.a
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
IFS=$save_IFS
|
||||||
|
|
||||||
|
if test "$found" != yes; then
|
||||||
|
lib=$lib.lib
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# func_cl_wrapper cl arg...
|
||||||
|
# Adjust compile command to suit cl
|
||||||
|
func_cl_wrapper ()
|
||||||
|
{
|
||||||
|
# Assume a capable shell
|
||||||
|
lib_path=
|
||||||
|
shared=:
|
||||||
|
linker_opts=
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
if test -n "$eat"; then
|
||||||
|
eat=
|
||||||
|
else
|
||||||
|
case $1 in
|
||||||
|
-o)
|
||||||
|
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||||
|
eat=1
|
||||||
|
case $2 in
|
||||||
|
*.o | *.[oO][bB][jJ])
|
||||||
|
func_file_conv "$2"
|
||||||
|
set x "$@" -Fo"$file"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
func_file_conv "$2"
|
||||||
|
set x "$@" -Fe"$file"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
-I)
|
||||||
|
eat=1
|
||||||
|
func_file_conv "$2" mingw
|
||||||
|
set x "$@" -I"$file"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-I*)
|
||||||
|
func_file_conv "${1#-I}" mingw
|
||||||
|
set x "$@" -I"$file"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-l)
|
||||||
|
eat=1
|
||||||
|
func_cl_dashl "$2"
|
||||||
|
set x "$@" "$lib"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-l*)
|
||||||
|
func_cl_dashl "${1#-l}"
|
||||||
|
set x "$@" "$lib"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-L)
|
||||||
|
eat=1
|
||||||
|
func_cl_dashL "$2"
|
||||||
|
;;
|
||||||
|
-L*)
|
||||||
|
func_cl_dashL "${1#-L}"
|
||||||
|
;;
|
||||||
|
-static)
|
||||||
|
shared=false
|
||||||
|
;;
|
||||||
|
-Wl,*)
|
||||||
|
arg=${1#-Wl,}
|
||||||
|
save_ifs="$IFS"; IFS=','
|
||||||
|
for flag in $arg; do
|
||||||
|
IFS="$save_ifs"
|
||||||
|
linker_opts="$linker_opts $flag"
|
||||||
|
done
|
||||||
|
IFS="$save_ifs"
|
||||||
|
;;
|
||||||
|
-Xlinker)
|
||||||
|
eat=1
|
||||||
|
linker_opts="$linker_opts $2"
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
set x "$@" "$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||||
|
func_file_conv "$1"
|
||||||
|
set x "$@" -Tp"$file"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||||
|
func_file_conv "$1" mingw
|
||||||
|
set x "$@" "$file"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set x "$@" "$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
if test -n "$linker_opts"; then
|
||||||
|
linker_opts="-link$linker_opts"
|
||||||
|
fi
|
||||||
|
exec "$@" $linker_opts
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
eat=
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
'')
|
||||||
|
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||||
|
exit 1;
|
||||||
|
;;
|
||||||
|
-h | --h*)
|
||||||
|
cat <<\EOF
|
||||||
|
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||||
|
|
||||||
|
Wrapper for compilers which do not understand '-c -o'.
|
||||||
|
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||||
|
arguments, and rename the output as expected.
|
||||||
|
|
||||||
|
If you are trying to build a whole package this is not the
|
||||||
|
right script to run: please start by reading the file 'INSTALL'.
|
||||||
|
|
||||||
|
Report bugs to <bug-automake@gnu.org>.
|
||||||
|
EOF
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
-v | --v*)
|
||||||
|
echo "compile $scriptversion"
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||||
|
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||||
|
func_cl_wrapper "$@" # Doesn't return...
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
ofile=
|
||||||
|
cfile=
|
||||||
|
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
if test -n "$eat"; then
|
||||||
|
eat=
|
||||||
|
else
|
||||||
|
case $1 in
|
||||||
|
-o)
|
||||||
|
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||||
|
# So we strip '-o arg' only if arg is an object.
|
||||||
|
eat=1
|
||||||
|
case $2 in
|
||||||
|
*.o | *.obj)
|
||||||
|
ofile=$2
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set x "$@" -o "$2"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
;;
|
||||||
|
*.c)
|
||||||
|
cfile=$1
|
||||||
|
set x "$@" "$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
set x "$@" "$1"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
if test -z "$ofile" || test -z "$cfile"; then
|
||||||
|
# If no '-o' option was seen then we might have been invoked from a
|
||||||
|
# pattern rule where we don't need one. That is ok -- this is a
|
||||||
|
# normal compilation that the losing compiler can handle. If no
|
||||||
|
# '.c' file was seen then we are probably linking. That is also
|
||||||
|
# ok.
|
||||||
|
exec "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Name of file we expect compiler to create.
|
||||||
|
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||||
|
|
||||||
|
# Create the lock directory.
|
||||||
|
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||||
|
# that we are using for the .o file. Also, base the name on the expected
|
||||||
|
# object file name, since that is what matters with a parallel build.
|
||||||
|
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||||
|
while true; do
|
||||||
|
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
# FIXME: race condition here if user kills between mkdir and trap.
|
||||||
|
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||||
|
|
||||||
|
# Run the compile.
|
||||||
|
"$@"
|
||||||
|
ret=$?
|
||||||
|
|
||||||
|
if test -f "$cofile"; then
|
||||||
|
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||||
|
elif test -f "${cofile}bj"; then
|
||||||
|
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rmdir "$lockdir"
|
||||||
|
exit $ret
|
||||||
|
|
||||||
|
# Local Variables:
|
||||||
|
# mode: shell-script
|
||||||
|
# sh-indentation: 2
|
||||||
|
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||||
|
# time-stamp-start: "scriptversion="
|
||||||
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
|
# time-stamp-time-zone: "UTC0"
|
||||||
|
# time-stamp-end: "; # UTC"
|
||||||
|
# End:
|
||||||
Vendored
+435
-485
File diff suppressed because it is too large
Load Diff
Vendored
+346
-231
File diff suppressed because it is too large
Load Diff
+137
-56
@@ -2,8 +2,9 @@
|
|||||||
AC_INIT(libssh2, [-], libssh2-devel@cool.haxx.se)
|
AC_INIT(libssh2, [-], libssh2-devel@cool.haxx.se)
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AC_CONFIG_SRCDIR([src])
|
AC_CONFIG_SRCDIR([src])
|
||||||
AM_CONFIG_HEADER([src/libssh2_config.h example/libssh2_config.h])
|
AC_CONFIG_HEADERS([src/libssh2_config.h])
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
|
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
||||||
|
|
||||||
dnl SED is needed by some of the tools
|
dnl SED is needed by some of the tools
|
||||||
AC_PATH_PROG( SED, sed, sed-was-not-found-by-configure,
|
AC_PATH_PROG( SED, sed, sed-was-not-found-by-configure,
|
||||||
@@ -35,12 +36,9 @@ case "$host" in
|
|||||||
CFLAGS="$CFLAGS -DLIBSSH2_WIN32"
|
CFLAGS="$CFLAGS -DLIBSSH2_WIN32"
|
||||||
LIBS="$LIBS -lws2_32"
|
LIBS="$LIBS -lws2_32"
|
||||||
;;
|
;;
|
||||||
*-cygwin)
|
*darwin*)
|
||||||
CFLAGS="$CFLAGS -DLIBSSH2_WIN32"
|
CFLAGS="$CFLAGS -DLIBSSH2_DARWIN"
|
||||||
;;
|
;;
|
||||||
*darwin*)
|
|
||||||
CFLAGS="$CFLAGS -DLIBSSH2_DARWIN"
|
|
||||||
;;
|
|
||||||
*hpux*)
|
*hpux*)
|
||||||
;;
|
;;
|
||||||
*osf*)
|
*osf*)
|
||||||
@@ -68,6 +66,7 @@ AC_SEARCH_LIBS(inet_addr, nsl)
|
|||||||
AC_SUBST(LIBS)
|
AC_SUBST(LIBS)
|
||||||
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
AC_PROG_CXX
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
@@ -82,60 +81,81 @@ AC_C_BIGENDIAN
|
|||||||
dnl check for how to do large files
|
dnl check for how to do large files
|
||||||
AC_SYS_LARGEFILE
|
AC_SYS_LARGEFILE
|
||||||
|
|
||||||
# Configure parameters
|
# Crypto backends
|
||||||
AC_ARG_WITH(libgcrypt,
|
|
||||||
AC_HELP_STRING([--with-libgcrypt],[Use Libgcrypt for crypto]),
|
|
||||||
use_libgcrypt=$withval,use_libgcrypt=auto)
|
|
||||||
AC_ARG_WITH(openssl,
|
|
||||||
AC_HELP_STRING([--with-openssl],[Use OpenSSL for crypto]),
|
|
||||||
use_openssl=$withval,use_openssl=auto)
|
|
||||||
AC_ARG_WITH(libz,
|
|
||||||
AC_HELP_STRING([--with-libz],[Use Libz for compression]),
|
|
||||||
use_libz=$withval,use_libz=auto)
|
|
||||||
|
|
||||||
# Look for OpenSSL (default)
|
found_crypto=none
|
||||||
if test "$use_openssl" != "no" && test "$use_libgcrypt" != "yes"; then
|
found_crypto_str=""
|
||||||
AC_LIB_HAVE_LINKFLAGS([ssl], [crypto], [#include <openssl/ssl.h>])
|
support_clear_memory=no
|
||||||
LIBSREQUIRED=libssl,libcrypto
|
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])
|
||||||
|
|
||||||
|
AC_ARG_WITH([crypto],
|
||||||
|
AC_HELP_STRING([--with-crypto=auto|]m4_set_contents([crypto_backends], [|]),
|
||||||
|
[Select crypto backend (default: auto)]),
|
||||||
|
use_crypto=$withval,
|
||||||
|
use_crypto=auto
|
||||||
|
)
|
||||||
|
|
||||||
|
case "${use_crypto}" in
|
||||||
|
auto|m4_set_contents([crypto_backends], [|]))
|
||||||
|
m4_set_map([crypto_backends], [LIBSSH2_CHECK_CRYPTO])
|
||||||
|
;;
|
||||||
|
yes|"")
|
||||||
|
crypto_errors="No crypto backend specified!"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
crypto_errors="Unknown crypto backend '${use_crypto}' specified!"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if test "$found_crypto" = "none"; then
|
||||||
|
crypto_errors="${crypto_errors}
|
||||||
|
Specify --with-crypto=\$backend and/or the neccessary library search prefix.
|
||||||
|
|
||||||
|
Known crypto backends: auto, m4_set_contents([crypto_backends], [, ])"
|
||||||
|
AS_MESSAGE([ERROR: ${crypto_errors}])
|
||||||
|
else
|
||||||
|
test "$found_crypto_str" = "" && found_crypto_str="$found_crypto"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Look for libgcrypt
|
m4_set_foreach([crypto_backends], [backend],
|
||||||
if test "$ac_cv_libssl" != "yes" && test "$use_libgcrypt" != "no"; then
|
[AM_CONDITIONAL(m4_toupper(backend), test "$found_crypto" = "backend")]
|
||||||
AC_LIB_HAVE_LINKFLAGS([gcrypt], [], [#include <gcrypt.h>])
|
)
|
||||||
LIBSREQUIRED=libgcrypt
|
|
||||||
|
# libz
|
||||||
|
|
||||||
|
AC_ARG_WITH([libz],
|
||||||
|
AC_HELP_STRING([--with-libz],[Use libz for compression]),
|
||||||
|
use_libz=$withval,
|
||||||
|
use_libz=auto)
|
||||||
|
|
||||||
|
found_libz=no
|
||||||
|
libz_errors=""
|
||||||
|
|
||||||
|
if test "$use_libz" != no; then
|
||||||
|
AC_LIB_HAVE_LINKFLAGS([z], [], [#include <zlib.h>])
|
||||||
|
if test "$ac_cv_libz" != yes; then
|
||||||
|
if test "$use_libz" = auto; then
|
||||||
|
AC_MSG_NOTICE([Cannot find libz, disabling compression])
|
||||||
|
found_libz="disabled; no libz found"
|
||||||
|
else
|
||||||
|
libz_errors="No libz found!
|
||||||
|
Try --with-libz-prefix=PATH if you know that you have it."
|
||||||
|
AS_MESSAGE([ERROR: $libz_errors])
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
AC_DEFINE(LIBSSH2_HAVE_ZLIB, 1, [Compile in zlib support])
|
||||||
|
LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }zlib"
|
||||||
|
found_libz="yes"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_SUBST(LIBSREQUIRED)
|
AC_SUBST(LIBSREQUIRED)
|
||||||
|
|
||||||
if test "$ac_cv_libssl" != "yes" && test "$ac_cv_libgcrypt" != "yes"; then
|
|
||||||
AC_MSG_ERROR([cannot find OpenSSL or Libgcrypt,
|
|
||||||
try --with-libssl-prefix=PATH or --with-libgcrypt-prefix=PATH])
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test "$ac_cv_libgcrypt" = "yes"; then
|
|
||||||
AC_DEFINE(LIBSSH2_LIBGCRYPT, 1, [Use libgcrypt])
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL(LIBGCRYPT, test "$ac_cv_libgcrypt" = "yes")
|
|
||||||
|
|
||||||
# Not all OpenSSL have AES-CTR functions.
|
|
||||||
if test "$ac_cv_libssl" = "yes"; then
|
|
||||||
save_LDFLAGS="$LDFLAGS"
|
|
||||||
LDFLAGS="$LDFLAGS $LIBSSL"
|
|
||||||
AC_CHECK_FUNCS(EVP_aes_128_ctr)
|
|
||||||
LDFLAGS="$save_LDFLAGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Look for Libz
|
|
||||||
if test "$use_libz" != "no"; then
|
|
||||||
AC_LIB_HAVE_LINKFLAGS([z], [], [#include <zlib.h>])
|
|
||||||
if test "$ac_cv_libz" != yes; then
|
|
||||||
AC_MSG_NOTICE([Cannot find libz, disabling compression])
|
|
||||||
AC_MSG_NOTICE([Try --with-libz-prefix=PATH if you know you have it])
|
|
||||||
else
|
|
||||||
AC_DEFINE(LIBSSH2_HAVE_ZLIB, 1, [Compile in zlib support])
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Optional Settings
|
# Optional Settings
|
||||||
#
|
#
|
||||||
@@ -154,6 +174,30 @@ if test "$GEX_NEW" != "no"; then
|
|||||||
AC_DEFINE(LIBSSH2_DH_GEX_NEW, 1, [Enable newer diffie-hellman-group-exchange-sha1 syntax])
|
AC_DEFINE(LIBSSH2_DH_GEX_NEW, 1, [Enable newer diffie-hellman-group-exchange-sha1 syntax])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_ARG_ENABLE(clear-memory,
|
||||||
|
AC_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
|
||||||
|
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
|
||||||
|
fi
|
||||||
|
|
||||||
dnl ************************************************************
|
dnl ************************************************************
|
||||||
dnl option to switch on compiler debug options
|
dnl option to switch on compiler debug options
|
||||||
dnl
|
dnl
|
||||||
@@ -164,6 +208,7 @@ AC_HELP_STRING([--disable-debug],[Disable debug options]),
|
|||||||
[ case "$enable_debug" in
|
[ case "$enable_debug" in
|
||||||
no)
|
no)
|
||||||
AC_MSG_RESULT(no)
|
AC_MSG_RESULT(no)
|
||||||
|
CPPFLAGS="$CPPFLAGS -DNDEBUG"
|
||||||
;;
|
;;
|
||||||
*) AC_MSG_RESULT(yes)
|
*) AC_MSG_RESULT(yes)
|
||||||
enable_debug=yes
|
enable_debug=yes
|
||||||
@@ -235,6 +280,21 @@ esac], [build_examples='yes'])
|
|||||||
AC_MSG_RESULT($build_examples)
|
AC_MSG_RESULT($build_examples)
|
||||||
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
|
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
|
||||||
|
|
||||||
|
|
||||||
|
# Build OSS fuzzing targets?
|
||||||
|
AC_ARG_ENABLE([ossfuzzers],
|
||||||
|
[AS_HELP_STRING([--enable-ossfuzzers],
|
||||||
|
[Whether to generate the fuzzers for OSS-Fuzz])],
|
||||||
|
[have_ossfuzzers=yes], [have_ossfuzzers=no])
|
||||||
|
AM_CONDITIONAL([USE_OSSFUZZERS], [test "x$have_ossfuzzers" = "xyes"])
|
||||||
|
|
||||||
|
|
||||||
|
# Set the correct flags for the given fuzzing engine.
|
||||||
|
AC_SUBST([LIB_FUZZING_ENGINE])
|
||||||
|
AM_CONDITIONAL([USE_OSSFUZZ_FLAG], [test "x$LIB_FUZZING_ENGINE" = "x-fsanitize=fuzzer"])
|
||||||
|
AM_CONDITIONAL([USE_OSSFUZZ_STATIC], [test -f "$LIB_FUZZING_ENGINE"])
|
||||||
|
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
# AC_HEADER_STDC
|
# 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 stdlib.h unistd.h sys/uio.h])
|
||||||
@@ -270,7 +330,7 @@ case $host in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
AC_CHECK_FUNCS(gettimeofday select strtoll)
|
AC_CHECK_FUNCS(gettimeofday select strtoll memset_s)
|
||||||
|
|
||||||
dnl Check for select() into ws2_32 for Msys/Mingw
|
dnl Check for select() into ws2_32 for Msys/Mingw
|
||||||
if test "$ac_cv_func_select" != "yes"; then
|
if test "$ac_cv_func_select" != "yes"; then
|
||||||
@@ -302,9 +362,29 @@ AC_C_INLINE
|
|||||||
|
|
||||||
CURL_CHECK_NONBLOCKING_SOCKET
|
CURL_CHECK_NONBLOCKING_SOCKET
|
||||||
|
|
||||||
|
missing_required_deps=0
|
||||||
|
|
||||||
|
if test "${libz_errors}" != ""; then
|
||||||
|
AS_MESSAGE([ERROR: ${libz_errors}])
|
||||||
|
missing_required_deps=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$found_crypto" = "none"; then
|
||||||
|
AS_MESSAGE([ERROR: ${crypto_errors}])
|
||||||
|
missing_required_deps=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test $missing_required_deps = 1; then
|
||||||
|
AC_MSG_ERROR([Required dependencies are missing!])
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Configure parameters
|
||||||
|
LIBSSH2_CHECK_OPTION_WERROR
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile
|
AC_CONFIG_FILES([Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
tests/Makefile
|
tests/Makefile
|
||||||
|
tests/ossfuzz/Makefile
|
||||||
example/Makefile
|
example/Makefile
|
||||||
docs/Makefile
|
docs/Makefile
|
||||||
libssh2.pc])
|
libssh2.pc])
|
||||||
@@ -318,9 +398,10 @@ AC_MSG_NOTICE([summary of build options:
|
|||||||
Compiler: ${CC}
|
Compiler: ${CC}
|
||||||
Compiler flags: ${CFLAGS}
|
Compiler flags: ${CFLAGS}
|
||||||
Library types: Shared=${enable_shared}, Static=${enable_static}
|
Library types: Shared=${enable_shared}, Static=${enable_static}
|
||||||
Crypto library: openssl: ${ac_cv_libssl:-no} (AES-CTR: ${ac_cv_func_EVP_aes_128_ctr:-N/A}) libgcrypt: ${ac_cv_libgcrypt:-no}
|
Crypto library: ${found_crypto_str}
|
||||||
|
Clear memory: $enable_clear_memory
|
||||||
Debug build: $enable_debug
|
Debug build: $enable_debug
|
||||||
Build examples: $build_examples
|
Build examples: $build_examples
|
||||||
Path to sshd: $ac_cv_path_SSHD (only for self-tests)
|
Path to sshd: $ac_cv_path_SSHD (only for self-tests)
|
||||||
libz compression: $ac_cv_libz
|
zlib compression: ${found_libz}
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# depcomp - compile a program generating dependencies as side-effects
|
# depcomp - compile a program generating dependencies as side-effects
|
||||||
|
|
||||||
scriptversion=2005-07-09.11
|
scriptversion=2018-03-07.03; # UTC
|
||||||
|
|
||||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
|
# Copyright (C) 1999-2020 Free Software Foundation, Inc.
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -16,9 +16,7 @@ scriptversion=2005-07-09.11
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
# 02110-1301, USA.
|
|
||||||
|
|
||||||
# As a special exception to the GNU General Public License, if you
|
# As a special exception to the GNU General Public License, if you
|
||||||
# distribute this file as part of a program that contains a
|
# distribute this file as part of a program that contains a
|
||||||
@@ -29,9 +27,9 @@ scriptversion=2005-07-09.11
|
|||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
'')
|
'')
|
||||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||||
exit 1;
|
exit 1;
|
||||||
;;
|
;;
|
||||||
-h | --h*)
|
-h | --h*)
|
||||||
cat <<\EOF
|
cat <<\EOF
|
||||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||||
@@ -41,11 +39,11 @@ as side-effects.
|
|||||||
|
|
||||||
Environment variables:
|
Environment variables:
|
||||||
depmode Dependency tracking mode.
|
depmode Dependency tracking mode.
|
||||||
source Source file read by `PROGRAMS ARGS'.
|
source Source file read by 'PROGRAMS ARGS'.
|
||||||
object Object file output by `PROGRAMS ARGS'.
|
object Object file output by 'PROGRAMS ARGS'.
|
||||||
DEPDIR directory where to store dependencies.
|
DEPDIR directory where to store dependencies.
|
||||||
depfile Dependency file to output.
|
depfile Dependency file to output.
|
||||||
tmpdepfile Temporary file to use when outputing dependencies.
|
tmpdepfile Temporary file to use when outputting dependencies.
|
||||||
libtool Whether libtool is used (yes/no).
|
libtool Whether libtool is used (yes/no).
|
||||||
|
|
||||||
Report bugs to <bug-automake@gnu.org>.
|
Report bugs to <bug-automake@gnu.org>.
|
||||||
@@ -58,6 +56,66 @@ EOF
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
# Get the directory component of the given path, and save it in the
|
||||||
|
# global variables '$dir'. Note that this directory component will
|
||||||
|
# be either empty or ending with a '/' character. This is deliberate.
|
||||||
|
set_dir_from ()
|
||||||
|
{
|
||||||
|
case $1 in
|
||||||
|
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||||
|
*) dir=;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
# Get the suffix-stripped basename of the given path, and save it the
|
||||||
|
# global variable '$base'.
|
||||||
|
set_base_from ()
|
||||||
|
{
|
||||||
|
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||||
|
}
|
||||||
|
|
||||||
|
# If no dependency file was actually created by the compiler invocation,
|
||||||
|
# we still have to create a dummy depfile, to avoid errors with the
|
||||||
|
# Makefile "include basename.Plo" scheme.
|
||||||
|
make_dummy_depfile ()
|
||||||
|
{
|
||||||
|
echo "#dummy" > "$depfile"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Factor out some common post-processing of the generated depfile.
|
||||||
|
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||||
|
aix_post_process_depfile ()
|
||||||
|
{
|
||||||
|
# If the compiler actually managed to produce a dependency file,
|
||||||
|
# post-process it.
|
||||||
|
if test -f "$tmpdepfile"; then
|
||||||
|
# Each line is of the form 'foo.o: dependency.h'.
|
||||||
|
# Do two passes, one to just change these to
|
||||||
|
# $object: dependency.h
|
||||||
|
# and one to simply output
|
||||||
|
# dependency.h:
|
||||||
|
# which is needed to avoid the deleted-header problem.
|
||||||
|
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||||
|
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||||
|
} > "$depfile"
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
else
|
||||||
|
make_dummy_depfile
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# A tabulation character.
|
||||||
|
tab=' '
|
||||||
|
# A newline character.
|
||||||
|
nl='
|
||||||
|
'
|
||||||
|
# Character ranges might be problematic outside the C locale.
|
||||||
|
# These definitions help.
|
||||||
|
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||||
|
lower=abcdefghijklmnopqrstuvwxyz
|
||||||
|
digits=0123456789
|
||||||
|
alpha=${upper}${lower}
|
||||||
|
|
||||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -70,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
|||||||
|
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
|
|
||||||
|
# Avoid interferences from the environment.
|
||||||
|
gccflag= dashmflag=
|
||||||
|
|
||||||
# Some modes work just like other modes, but use different flags. We
|
# Some modes work just like other modes, but use different flags. We
|
||||||
# parameterize here, but still list the modes in the big case below,
|
# parameterize here, but still list the modes in the big case below,
|
||||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||||
@@ -81,9 +142,32 @@ if test "$depmode" = hp; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if test "$depmode" = dashXmstdout; then
|
if test "$depmode" = dashXmstdout; then
|
||||||
# This is just like dashmstdout with a different argument.
|
# This is just like dashmstdout with a different argument.
|
||||||
dashmflag=-xM
|
dashmflag=-xM
|
||||||
depmode=dashmstdout
|
depmode=dashmstdout
|
||||||
|
fi
|
||||||
|
|
||||||
|
cygpath_u="cygpath -u -f -"
|
||||||
|
if test "$depmode" = msvcmsys; then
|
||||||
|
# This is just like msvisualcpp but w/o cygpath translation.
|
||||||
|
# Just convert the backslash-escaped backslashes to single forward
|
||||||
|
# slashes to satisfy depend.m4
|
||||||
|
cygpath_u='sed s,\\\\,/,g'
|
||||||
|
depmode=msvisualcpp
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$depmode" = msvc7msys; then
|
||||||
|
# This is just like msvc7 but w/o cygpath translation.
|
||||||
|
# Just convert the backslash-escaped backslashes to single forward
|
||||||
|
# slashes to satisfy depend.m4
|
||||||
|
cygpath_u='sed s,\\\\,/,g'
|
||||||
|
depmode=msvc7
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$depmode" = xlc; then
|
||||||
|
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||||
|
gccflag=-qmakedep=gcc,-MF
|
||||||
|
depmode=gcc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$depmode" in
|
case "$depmode" in
|
||||||
@@ -91,10 +175,22 @@ gcc3)
|
|||||||
## gcc 3 implements dependency tracking that does exactly what
|
## gcc 3 implements dependency tracking that does exactly what
|
||||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||||
"$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
|
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||||
|
## the command line argument order; so add the flags where they
|
||||||
|
## appear in depend2.am. Note that the slowdown incurred here
|
||||||
|
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||||
|
for arg
|
||||||
|
do
|
||||||
|
case $arg in
|
||||||
|
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||||
|
*) set fnord "$@" "$arg" ;;
|
||||||
|
esac
|
||||||
|
shift # fnord
|
||||||
|
shift # $arg
|
||||||
|
done
|
||||||
|
"$@"
|
||||||
stat=$?
|
stat=$?
|
||||||
if test $stat -eq 0; then :
|
if test $stat -ne 0; then
|
||||||
else
|
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
exit $stat
|
exit $stat
|
||||||
fi
|
fi
|
||||||
@@ -102,13 +198,17 @@ gcc3)
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
gcc)
|
gcc)
|
||||||
|
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||||
|
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||||
|
## (see the conditional assignment to $gccflag above).
|
||||||
## There are various ways to get dependency output from gcc. Here's
|
## There are various ways to get dependency output from gcc. Here's
|
||||||
## why we pick this rather obscure method:
|
## why we pick this rather obscure method:
|
||||||
## - Don't want to use -MD because we'd like the dependencies to end
|
## - Don't want to use -MD because we'd like the dependencies to end
|
||||||
## up in a subdir. Having to rename by hand is ugly.
|
## up in a subdir. Having to rename by hand is ugly.
|
||||||
## (We might end up doing this anyway to support other compilers.)
|
## (We might end up doing this anyway to support other compilers.)
|
||||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||||
## -MM, not -M (despite what the docs say).
|
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||||
|
## supported by the other compilers which use the 'gcc' depmode.
|
||||||
## - Using -M directly means running the compiler twice (even worse
|
## - Using -M directly means running the compiler twice (even worse
|
||||||
## than renaming).
|
## than renaming).
|
||||||
if test -z "$gccflag"; then
|
if test -z "$gccflag"; then
|
||||||
@@ -116,31 +216,31 @@ gcc)
|
|||||||
fi
|
fi
|
||||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||||
stat=$?
|
stat=$?
|
||||||
if test $stat -eq 0; then :
|
if test $stat -ne 0; then
|
||||||
else
|
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
exit $stat
|
exit $stat
|
||||||
fi
|
fi
|
||||||
rm -f "$depfile"
|
rm -f "$depfile"
|
||||||
echo "$object : \\" > "$depfile"
|
echo "$object : \\" > "$depfile"
|
||||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
# The second -e expression handles DOS-style file names with drive
|
||||||
## The second -e expression handles DOS-style file names with drive letters.
|
# letters.
|
||||||
sed -e 's/^[^:]*: / /' \
|
sed -e 's/^[^:]*: / /' \
|
||||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||||
## This next piece of magic avoids the `deleted header file' problem.
|
## This next piece of magic avoids the "deleted header file" problem.
|
||||||
## The problem is that when a header file which appears in a .P file
|
## The problem is that when a header file which appears in a .P file
|
||||||
## is deleted, the dependency causes make to die (because there is
|
## is deleted, the dependency causes make to die (because there is
|
||||||
## typically no way to rebuild the header). We avoid this by adding
|
## typically no way to rebuild the header). We avoid this by adding
|
||||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||||
## this for us directly.
|
## this for us directly.
|
||||||
tr ' ' '
|
## Some versions of gcc put a space before the ':'. On the theory
|
||||||
' < "$tmpdepfile" |
|
|
||||||
## Some versions of gcc put a space before the `:'. On the theory
|
|
||||||
## that the space means something, we add a space to the output as
|
## that the space means something, we add a space to the output as
|
||||||
## well.
|
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||||
|
## to the object. Take care to not repeat it in the output.
|
||||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||||
## correctly. Breaking it into two sed invocations is a workaround.
|
## correctly. Breaking it into two sed invocations is a workaround.
|
||||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
tr ' ' "$nl" < "$tmpdepfile" \
|
||||||
|
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||||
|
| sed -e 's/$/ :/' >> "$depfile"
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -158,8 +258,7 @@ sgi)
|
|||||||
"$@" -MDupdate "$tmpdepfile"
|
"$@" -MDupdate "$tmpdepfile"
|
||||||
fi
|
fi
|
||||||
stat=$?
|
stat=$?
|
||||||
if test $stat -eq 0; then :
|
if test $stat -ne 0; then
|
||||||
else
|
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
exit $stat
|
exit $stat
|
||||||
fi
|
fi
|
||||||
@@ -167,99 +266,156 @@ sgi)
|
|||||||
|
|
||||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||||
echo "$object : \\" > "$depfile"
|
echo "$object : \\" > "$depfile"
|
||||||
|
|
||||||
# Clip off the initial element (the dependent). Don't try to be
|
# Clip off the initial element (the dependent). Don't try to be
|
||||||
# clever and replace this with sed code, as IRIX sed won't handle
|
# clever and replace this with sed code, as IRIX sed won't handle
|
||||||
# lines with more than a fixed number of characters (4096 in
|
# lines with more than a fixed number of characters (4096 in
|
||||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||||
# dependency line.
|
# dependency line.
|
||||||
tr ' ' '
|
tr ' ' "$nl" < "$tmpdepfile" \
|
||||||
' < "$tmpdepfile" \
|
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
| tr "$nl" ' ' >> "$depfile"
|
||||||
tr '
|
echo >> "$depfile"
|
||||||
' ' ' >> $depfile
|
|
||||||
echo >> $depfile
|
|
||||||
|
|
||||||
# The second pass generates a dummy entry for each header file.
|
# The second pass generates a dummy entry for each header file.
|
||||||
tr ' ' '
|
tr ' ' "$nl" < "$tmpdepfile" \
|
||||||
' < "$tmpdepfile" \
|
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
>> "$depfile"
|
||||||
>> $depfile
|
|
||||||
else
|
else
|
||||||
# The sourcefile does not contain any dependencies, so just
|
make_dummy_depfile
|
||||||
# store a dummy comment line, to avoid errors with the Makefile
|
|
||||||
# "include basename.Plo" scheme.
|
|
||||||
echo "#dummy" > "$depfile"
|
|
||||||
fi
|
fi
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
xlc)
|
||||||
|
# This case exists only to let depend.m4 do its work. It works by
|
||||||
|
# looking at the text of this script. This case will never be run,
|
||||||
|
# since it is checked for above.
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
aix)
|
aix)
|
||||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||||
# in a .u file. In older versions, this file always lives in the
|
# in a .u file. In older versions, this file always lives in the
|
||||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||||
# start of each line; $object doesn't have directory information.
|
# start of each line; $object doesn't have directory information.
|
||||||
# Version 6 uses the directory in both cases.
|
# Version 6 uses the directory in both cases.
|
||||||
stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
|
set_dir_from "$object"
|
||||||
tmpdepfile="$stripped.u"
|
set_base_from "$object"
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
|
tmpdepfile1=$dir$base.u
|
||||||
|
tmpdepfile2=$base.u
|
||||||
|
tmpdepfile3=$dir.libs/$base.u
|
||||||
"$@" -Wc,-M
|
"$@" -Wc,-M
|
||||||
else
|
else
|
||||||
|
tmpdepfile1=$dir$base.u
|
||||||
|
tmpdepfile2=$dir$base.u
|
||||||
|
tmpdepfile3=$dir$base.u
|
||||||
"$@" -M
|
"$@" -M
|
||||||
fi
|
fi
|
||||||
stat=$?
|
stat=$?
|
||||||
|
if test $stat -ne 0; then
|
||||||
if test -f "$tmpdepfile"; then :
|
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||||
else
|
|
||||||
stripped=`echo "$stripped" | sed 's,^.*/,,'`
|
|
||||||
tmpdepfile="$stripped.u"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if test $stat -eq 0; then :
|
|
||||||
else
|
|
||||||
rm -f "$tmpdepfile"
|
|
||||||
exit $stat
|
exit $stat
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test -f "$tmpdepfile"; then
|
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||||
outname="$stripped.o"
|
do
|
||||||
# Each line is of the form `foo.o: dependent.h'.
|
test -f "$tmpdepfile" && break
|
||||||
# Do two passes, one to just change these to
|
done
|
||||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
aix_post_process_depfile
|
||||||
sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
|
;;
|
||||||
sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
|
|
||||||
else
|
tcc)
|
||||||
# The sourcefile does not contain any dependencies, so just
|
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||||
# store a dummy comment line, to avoid errors with the Makefile
|
# FIXME: That version still under development at the moment of writing.
|
||||||
# "include basename.Plo" scheme.
|
# Make that this statement remains true also for stable, released
|
||||||
echo "#dummy" > "$depfile"
|
# versions.
|
||||||
|
# It will wrap lines (doesn't matter whether long or short) with a
|
||||||
|
# trailing '\', as in:
|
||||||
|
#
|
||||||
|
# foo.o : \
|
||||||
|
# foo.c \
|
||||||
|
# foo.h \
|
||||||
|
#
|
||||||
|
# It will put a trailing '\' even on the last line, and will use leading
|
||||||
|
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||||
|
# "Emit spaces for -MD").
|
||||||
|
"$@" -MD -MF "$tmpdepfile"
|
||||||
|
stat=$?
|
||||||
|
if test $stat -ne 0; then
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
exit $stat
|
||||||
fi
|
fi
|
||||||
|
rm -f "$depfile"
|
||||||
|
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||||
|
# We have to change lines of the first kind to '$object: \'.
|
||||||
|
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||||
|
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||||
|
# dummy dependency, to avoid the deleted-header problem.
|
||||||
|
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
icc)
|
## The order of this option in the case statement is important, since the
|
||||||
# Intel's C compiler understands `-MD -MF file'. However on
|
## shell code in configure will try each of these formats in the order
|
||||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
## listed in this file. A plain '-MD' option would be understood by many
|
||||||
# ICC 7.0 will fill foo.d with something like
|
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||||
# foo.o: sub/foo.c
|
pgcc)
|
||||||
# foo.o: sub/foo.h
|
# Portland's C compiler understands '-MD'.
|
||||||
# which is wrong. We want:
|
# Will always output deps to 'file.d' where file is the root name of the
|
||||||
# sub/foo.o: sub/foo.c
|
# source file under compilation, even if file resides in a subdirectory.
|
||||||
# sub/foo.o: sub/foo.h
|
# The object file name does not affect the name of the '.d' file.
|
||||||
# sub/foo.c:
|
# pgcc 10.2 will output
|
||||||
# sub/foo.h:
|
|
||||||
# ICC 7.1 will output
|
|
||||||
# foo.o: sub/foo.c sub/foo.h
|
# foo.o: sub/foo.c sub/foo.h
|
||||||
# and will wrap long lines using \ :
|
# and will wrap long lines using '\' :
|
||||||
# foo.o: sub/foo.c ... \
|
# foo.o: sub/foo.c ... \
|
||||||
# sub/foo.h ... \
|
# sub/foo.h ... \
|
||||||
# ...
|
# ...
|
||||||
|
set_dir_from "$object"
|
||||||
|
# Use the source, not the object, to determine the base name, since
|
||||||
|
# that's sadly what pgcc will do too.
|
||||||
|
set_base_from "$source"
|
||||||
|
tmpdepfile=$base.d
|
||||||
|
|
||||||
"$@" -MD -MF "$tmpdepfile"
|
# For projects that build the same source file twice into different object
|
||||||
stat=$?
|
# files, the pgcc approach of using the *source* file root name can cause
|
||||||
if test $stat -eq 0; then :
|
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||||
else
|
# the same $tmpdepfile.
|
||||||
|
lockdir=$base.d-lock
|
||||||
|
trap "
|
||||||
|
echo '$0: caught signal, cleaning up...' >&2
|
||||||
|
rmdir '$lockdir'
|
||||||
|
exit 1
|
||||||
|
" 1 2 13 15
|
||||||
|
numtries=100
|
||||||
|
i=$numtries
|
||||||
|
while test $i -gt 0; do
|
||||||
|
# mkdir is a portable test-and-set.
|
||||||
|
if mkdir "$lockdir" 2>/dev/null; then
|
||||||
|
# This process acquired the lock.
|
||||||
|
"$@" -MD
|
||||||
|
stat=$?
|
||||||
|
# Release the lock.
|
||||||
|
rmdir "$lockdir"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
# If the lock is being held by a different process, wait
|
||||||
|
# until the winning process is done or we timeout.
|
||||||
|
while test -d "$lockdir" && test $i -gt 0; do
|
||||||
|
sleep 1
|
||||||
|
i=`expr $i - 1`
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
i=`expr $i - 1`
|
||||||
|
done
|
||||||
|
trap - 1 2 13 15
|
||||||
|
if test $i -le 0; then
|
||||||
|
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||||
|
echo "$0: check lockdir '$lockdir'" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test $stat -ne 0; then
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
exit $stat
|
exit $stat
|
||||||
fi
|
fi
|
||||||
@@ -271,68 +427,141 @@ icc)
|
|||||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||||
# correctly. Breaking it into two sed invocations is a workaround.
|
# correctly. Breaking it into two sed invocations is a workaround.
|
||||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||||
sed -e 's/$/ :/' >> "$depfile"
|
| sed -e 's/$/ :/' >> "$depfile"
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
hp2)
|
||||||
|
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||||
|
# compilers, which have integrated preprocessors. The correct option
|
||||||
|
# to use with these is +Maked; it writes dependencies to a file named
|
||||||
|
# 'foo.d', which lands next to the object file, wherever that
|
||||||
|
# happens to be.
|
||||||
|
# Much of this is similar to the tru64 case; see comments there.
|
||||||
|
set_dir_from "$object"
|
||||||
|
set_base_from "$object"
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
tmpdepfile1=$dir$base.d
|
||||||
|
tmpdepfile2=$dir.libs/$base.d
|
||||||
|
"$@" -Wc,+Maked
|
||||||
|
else
|
||||||
|
tmpdepfile1=$dir$base.d
|
||||||
|
tmpdepfile2=$dir$base.d
|
||||||
|
"$@" +Maked
|
||||||
|
fi
|
||||||
|
stat=$?
|
||||||
|
if test $stat -ne 0; then
|
||||||
|
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
|
||||||
|
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||||
|
do
|
||||||
|
test -f "$tmpdepfile" && break
|
||||||
|
done
|
||||||
|
if test -f "$tmpdepfile"; then
|
||||||
|
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||||
|
# Add 'dependent.h:' lines.
|
||||||
|
sed -ne '2,${
|
||||||
|
s/^ *//
|
||||||
|
s/ \\*$//
|
||||||
|
s/$/:/
|
||||||
|
p
|
||||||
|
}' "$tmpdepfile" >> "$depfile"
|
||||||
|
else
|
||||||
|
make_dummy_depfile
|
||||||
|
fi
|
||||||
|
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||||
|
;;
|
||||||
|
|
||||||
tru64)
|
tru64)
|
||||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||||
# dependencies in `foo.d' instead, so we check for that too.
|
# dependencies in 'foo.d' instead, so we check for that too.
|
||||||
# Subdirectories are respected.
|
# Subdirectories are respected.
|
||||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
set_dir_from "$object"
|
||||||
test "x$dir" = "x$object" && dir=
|
set_base_from "$object"
|
||||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
|
||||||
|
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
# With Tru64 cc, shared objects can also be used to make a
|
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||||
# static library. This mecanism is used in libtool 1.4 series to
|
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||||
# handle both shared and static libraries in a single compilation.
|
# in $dir$base.o.d. We have to check for both files, because
|
||||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
# one of the two compilations can be disabled. We should prefer
|
||||||
#
|
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||||
# With libtool 1.5 this exception was removed, and libtool now
|
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||||
# generates 2 separate objects for the 2 libraries. These two
|
# the former would cause a distcleancheck panic.
|
||||||
# compilations output dependencies in in $dir.libs/$base.o.d and
|
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||||
# in $dir$base.o.d. We have to check for both files, because
|
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||||
# one of the two compilations can be disabled. We should prefer
|
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
"$@" -Wc,-MD
|
||||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
else
|
||||||
# the former would cause a distcleancheck panic.
|
tmpdepfile1=$dir$base.d
|
||||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
tmpdepfile2=$dir$base.d
|
||||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
tmpdepfile3=$dir$base.d
|
||||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
"$@" -MD
|
||||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
fi
|
||||||
"$@" -Wc,-MD
|
|
||||||
else
|
|
||||||
tmpdepfile1=$dir$base.o.d
|
|
||||||
tmpdepfile2=$dir$base.d
|
|
||||||
tmpdepfile3=$dir$base.d
|
|
||||||
tmpdepfile4=$dir$base.d
|
|
||||||
"$@" -MD
|
|
||||||
fi
|
|
||||||
|
|
||||||
stat=$?
|
stat=$?
|
||||||
if test $stat -eq 0; then :
|
if test $stat -ne 0; then
|
||||||
else
|
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
exit $stat
|
||||||
exit $stat
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||||
do
|
do
|
||||||
test -f "$tmpdepfile" && break
|
test -f "$tmpdepfile" && break
|
||||||
done
|
done
|
||||||
if test -f "$tmpdepfile"; then
|
# Same post-processing that is required for AIX mode.
|
||||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
aix_post_process_depfile
|
||||||
# That's a tab and a space in the [].
|
;;
|
||||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
|
||||||
else
|
msvc7)
|
||||||
echo "#dummy" > "$depfile"
|
if test "$libtool" = yes; then
|
||||||
fi
|
showIncludes=-Wc,-showIncludes
|
||||||
rm -f "$tmpdepfile"
|
else
|
||||||
;;
|
showIncludes=-showIncludes
|
||||||
|
fi
|
||||||
|
"$@" $showIncludes > "$tmpdepfile"
|
||||||
|
stat=$?
|
||||||
|
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||||
|
if test $stat -ne 0; then
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
exit $stat
|
||||||
|
fi
|
||||||
|
rm -f "$depfile"
|
||||||
|
echo "$object : \\" > "$depfile"
|
||||||
|
# The first sed program below extracts the file names and escapes
|
||||||
|
# backslashes for cygpath. The second sed program outputs the file
|
||||||
|
# name when reading, but also accumulates all include files in the
|
||||||
|
# hold buffer in order to output them again at the end. This only
|
||||||
|
# works with sed implementations that can handle large buffers.
|
||||||
|
sed < "$tmpdepfile" -n '
|
||||||
|
/^Note: including file: *\(.*\)/ {
|
||||||
|
s//\1/
|
||||||
|
s/\\/\\\\/g
|
||||||
|
p
|
||||||
|
}' | $cygpath_u | sort -u | sed -n '
|
||||||
|
s/ /\\ /g
|
||||||
|
s/\(.*\)/'"$tab"'\1 \\/p
|
||||||
|
s/.\(.*\) \\/\1:/
|
||||||
|
H
|
||||||
|
$ {
|
||||||
|
s/.*/'"$tab"'/
|
||||||
|
G
|
||||||
|
p
|
||||||
|
}' >> "$depfile"
|
||||||
|
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||||
|
rm -f "$tmpdepfile"
|
||||||
|
;;
|
||||||
|
|
||||||
|
msvc7msys)
|
||||||
|
# This case exists only to let depend.m4 do its work. It works by
|
||||||
|
# looking at the text of this script. This case will never be run,
|
||||||
|
# since it is checked for above.
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
#nosideeffect)
|
#nosideeffect)
|
||||||
# This comment above is used by automake to tell side-effect
|
# This comment above is used by automake to tell side-effect
|
||||||
@@ -345,13 +574,13 @@ dashmstdout)
|
|||||||
|
|
||||||
# Remove the call to Libtool.
|
# Remove the call to Libtool.
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
while test $1 != '--mode=compile'; do
|
while test "X$1" != 'X--mode=compile'; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove `-o $object'.
|
# Remove '-o $object'.
|
||||||
IFS=" "
|
IFS=" "
|
||||||
for arg
|
for arg
|
||||||
do
|
do
|
||||||
@@ -371,18 +600,18 @@ dashmstdout)
|
|||||||
done
|
done
|
||||||
|
|
||||||
test -z "$dashmflag" && dashmflag=-M
|
test -z "$dashmflag" && dashmflag=-M
|
||||||
# Require at least two characters before searching for `:'
|
# Require at least two characters before searching for ':'
|
||||||
# in the target name. This is to cope with DOS-style filenames:
|
# in the target name. This is to cope with DOS-style filenames:
|
||||||
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
|
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||||
"$@" $dashmflag |
|
"$@" $dashmflag |
|
||||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||||
rm -f "$depfile"
|
rm -f "$depfile"
|
||||||
cat < "$tmpdepfile" > "$depfile"
|
cat < "$tmpdepfile" > "$depfile"
|
||||||
tr ' ' '
|
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||||
' < "$tmpdepfile" | \
|
# correctly. Breaking it into two sed invocations is a workaround.
|
||||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
tr ' ' "$nl" < "$tmpdepfile" \
|
||||||
## correctly. Breaking it into two sed invocations is a workaround.
|
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
| sed -e 's/$/ :/' >> "$depfile"
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -396,41 +625,51 @@ makedepend)
|
|||||||
"$@" || exit $?
|
"$@" || exit $?
|
||||||
# Remove any Libtool call
|
# Remove any Libtool call
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
while test $1 != '--mode=compile'; do
|
while test "X$1" != 'X--mode=compile'; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
# X makedepend
|
# X makedepend
|
||||||
shift
|
shift
|
||||||
cleared=no
|
cleared=no eat=no
|
||||||
for arg in "$@"; do
|
for arg
|
||||||
|
do
|
||||||
case $cleared in
|
case $cleared in
|
||||||
no)
|
no)
|
||||||
set ""; shift
|
set ""; shift
|
||||||
cleared=yes ;;
|
cleared=yes ;;
|
||||||
esac
|
esac
|
||||||
|
if test $eat = yes; then
|
||||||
|
eat=no
|
||||||
|
continue
|
||||||
|
fi
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
-D*|-I*)
|
-D*|-I*)
|
||||||
set fnord "$@" "$arg"; shift ;;
|
set fnord "$@" "$arg"; shift ;;
|
||||||
# Strip any option that makedepend may not understand. Remove
|
# Strip any option that makedepend may not understand. Remove
|
||||||
# the object too, otherwise makedepend will parse it as a source file.
|
# the object too, otherwise makedepend will parse it as a source file.
|
||||||
|
-arch)
|
||||||
|
eat=yes ;;
|
||||||
-*|$object)
|
-*|$object)
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
set fnord "$@" "$arg"; shift ;;
|
set fnord "$@" "$arg"; shift ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
obj_suffix="`echo $object | sed 's/^.*\././'`"
|
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||||
touch "$tmpdepfile"
|
touch "$tmpdepfile"
|
||||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||||
rm -f "$depfile"
|
rm -f "$depfile"
|
||||||
cat < "$tmpdepfile" > "$depfile"
|
# makedepend may prepend the VPATH from the source file name to the object.
|
||||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||||
' | \
|
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||||
## correctly. Breaking it into two sed invocations is a workaround.
|
# correctly. Breaking it into two sed invocations is a workaround.
|
||||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
sed '1,2d' "$tmpdepfile" \
|
||||||
|
| tr ' ' "$nl" \
|
||||||
|
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||||
|
| sed -e 's/$/ :/' >> "$depfile"
|
||||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -441,13 +680,13 @@ cpp)
|
|||||||
|
|
||||||
# Remove the call to Libtool.
|
# Remove the call to Libtool.
|
||||||
if test "$libtool" = yes; then
|
if test "$libtool" = yes; then
|
||||||
while test $1 != '--mode=compile'; do
|
while test "X$1" != 'X--mode=compile'; do
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove `-o $object'.
|
# Remove '-o $object'.
|
||||||
IFS=" "
|
IFS=" "
|
||||||
for arg
|
for arg
|
||||||
do
|
do
|
||||||
@@ -466,10 +705,10 @@ cpp)
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
"$@" -E |
|
"$@" -E \
|
||||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||||
sed '$ s: \\$::' > "$tmpdepfile"
|
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||||
rm -f "$depfile"
|
rm -f "$depfile"
|
||||||
echo "$object : \\" > "$depfile"
|
echo "$object : \\" > "$depfile"
|
||||||
cat < "$tmpdepfile" >> "$depfile"
|
cat < "$tmpdepfile" >> "$depfile"
|
||||||
@@ -479,35 +718,56 @@ cpp)
|
|||||||
|
|
||||||
msvisualcpp)
|
msvisualcpp)
|
||||||
# Important note: in order to support this mode, a compiler *must*
|
# Important note: in order to support this mode, a compiler *must*
|
||||||
# always write the preprocessed file to stdout, regardless of -o,
|
# always write the preprocessed file to stdout.
|
||||||
# because we must use -o when running libtool.
|
|
||||||
"$@" || exit $?
|
"$@" || exit $?
|
||||||
|
|
||||||
|
# Remove the call to Libtool.
|
||||||
|
if test "$libtool" = yes; then
|
||||||
|
while test "X$1" != 'X--mode=compile'; do
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
shift
|
||||||
|
fi
|
||||||
|
|
||||||
IFS=" "
|
IFS=" "
|
||||||
for arg
|
for arg
|
||||||
do
|
do
|
||||||
case "$arg" in
|
case "$arg" in
|
||||||
|
-o)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
$object)
|
||||||
|
shift
|
||||||
|
;;
|
||||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||||
set fnord "$@"
|
set fnord "$@"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
set fnord "$@" "$arg"
|
set fnord "$@" "$arg"
|
||||||
shift
|
shift
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
"$@" -E |
|
"$@" -E 2>/dev/null |
|
||||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
|
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||||
rm -f "$depfile"
|
rm -f "$depfile"
|
||||||
echo "$object : \\" > "$depfile"
|
echo "$object : \\" > "$depfile"
|
||||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||||
echo " " >> "$depfile"
|
echo "$tab" >> "$depfile"
|
||||||
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||||
rm -f "$tmpdepfile"
|
rm -f "$tmpdepfile"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
msvcmsys)
|
||||||
|
# This case exists only to let depend.m4 do its work. It works by
|
||||||
|
# looking at the text of this script. This case will never be run,
|
||||||
|
# since it is checked for above.
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
|
||||||
none)
|
none)
|
||||||
exec "$@"
|
exec "$@"
|
||||||
;;
|
;;
|
||||||
@@ -523,8 +783,9 @@ exit 0
|
|||||||
# Local Variables:
|
# Local Variables:
|
||||||
# mode: shell-script
|
# mode: shell-script
|
||||||
# sh-indentation: 2
|
# sh-indentation: 2
|
||||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||||
# time-stamp-start: "scriptversion="
|
# time-stamp-start: "scriptversion="
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||||
# time-stamp-end: "$"
|
# time-stamp-time-zone: "UTC0"
|
||||||
|
# time-stamp-end: "; # UTC"
|
||||||
# End:
|
# End:
|
||||||
|
|||||||
@@ -6,32 +6,57 @@
|
|||||||
Adam Gobiowski
|
Adam Gobiowski
|
||||||
Alexander Holyapin
|
Alexander Holyapin
|
||||||
Alexander Lamaison
|
Alexander Lamaison
|
||||||
|
Alfred Gebert
|
||||||
Ben Kibbey
|
Ben Kibbey
|
||||||
Bjorn Stenborg
|
Bjorn Stenborg
|
||||||
Carlo Bramini
|
Carlo Bramini
|
||||||
|
Cristian Rodríguez
|
||||||
|
Daiki Ueno
|
||||||
Dan Casey
|
Dan Casey
|
||||||
Dan Fandrich
|
Dan Fandrich
|
||||||
Daniel Stenberg
|
Daniel Stenberg
|
||||||
|
Dave Hayden
|
||||||
|
Dave McCaldon
|
||||||
David J Sullivan
|
David J Sullivan
|
||||||
David Robins
|
David Robins
|
||||||
|
Dmitry Smirnov
|
||||||
|
Douglas Masterson
|
||||||
Edink Kadribasic
|
Edink Kadribasic
|
||||||
Erik Brossler
|
Erik Brossler
|
||||||
Francois Dupoux
|
Francois Dupoux
|
||||||
|
Gellule Xg
|
||||||
|
Grubsky Grigory
|
||||||
Guenter Knauf
|
Guenter Knauf
|
||||||
Heiner Steven
|
Heiner Steven
|
||||||
|
Henrik Nordstrom
|
||||||
James Housleys
|
James Housleys
|
||||||
|
Jasmeet Bagga
|
||||||
Jean-Louis Charton
|
Jean-Louis Charton
|
||||||
|
Jernej Kovacic
|
||||||
|
Joey Degges
|
||||||
|
John Little
|
||||||
|
Jose Baars
|
||||||
Jussi Mononen
|
Jussi Mononen
|
||||||
|
Kamil Dudka
|
||||||
|
Lars Nordin
|
||||||
Mark McPherson
|
Mark McPherson
|
||||||
|
Mark Smith
|
||||||
Markus Moeller
|
Markus Moeller
|
||||||
|
Matt Lilley
|
||||||
|
Matthew Booth
|
||||||
|
Maxime Larocque
|
||||||
Mike Protts
|
Mike Protts
|
||||||
Mikhail Gusarov
|
Mikhail Gusarov
|
||||||
Neil Gierman
|
Neil Gierman
|
||||||
Olivier Hervieu
|
Olivier Hervieu
|
||||||
|
Paul Howarth
|
||||||
|
Paul Querna
|
||||||
Paul Veldkamp
|
Paul Veldkamp
|
||||||
Peter Krempa
|
Peter Krempa
|
||||||
Peter O'Gorman
|
Peter O'Gorman
|
||||||
Peter Stuge
|
Peter Stuge
|
||||||
|
Pierre Joye
|
||||||
|
Rafael Kitover
|
||||||
Romain Bondue
|
Romain Bondue
|
||||||
Sara Golemon
|
Sara Golemon
|
||||||
Satish Mittal
|
Satish Mittal
|
||||||
@@ -39,10 +64,16 @@ Sean Peterson
|
|||||||
Selcuk Gueney
|
Selcuk Gueney
|
||||||
Simon Hart
|
Simon Hart
|
||||||
Simon Josefsson
|
Simon Josefsson
|
||||||
|
Sofian Brabez
|
||||||
Steven Ayre
|
Steven Ayre
|
||||||
|
Steven Dake
|
||||||
Steven Van Ingelgem
|
Steven Van Ingelgem
|
||||||
|
TJ Saunders
|
||||||
|
Tommy Lindgren
|
||||||
Tor Arntsen
|
Tor Arntsen
|
||||||
Vincent Jaulin
|
Vincent Jaulin
|
||||||
|
Vincent Torri
|
||||||
Vlad Grachov
|
Vlad Grachov
|
||||||
Wez Furlong
|
Wez Furlong
|
||||||
Yang Tse
|
Yang Tse
|
||||||
|
Zl Liu
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
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
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
# 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.
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
install(FILES ${MAN_PAGES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man3)
|
||||||
@@ -0,0 +1,902 @@
|
|||||||
|
Definitions needed to implement a specific crypto library
|
||||||
|
|
||||||
|
This document offers some hints about implementing a new crypto library
|
||||||
|
interface.
|
||||||
|
|
||||||
|
A crypto library interface consists of at least a header file, defining
|
||||||
|
entities referenced from the libssh2 core modules.
|
||||||
|
Real code implementation (if needed), is left at the implementor's choice.
|
||||||
|
|
||||||
|
This document lists the entities that must/may be defined in the header file.
|
||||||
|
|
||||||
|
Procedures listed as "void" may indeed have a result type: the void indication
|
||||||
|
indicates the libssh2 core modules never use the function result.
|
||||||
|
|
||||||
|
|
||||||
|
0) Build system.
|
||||||
|
|
||||||
|
Adding a crypto backend to the autotools build system (./configure) is easy:
|
||||||
|
|
||||||
|
0.1) Add one new line in configure.ac
|
||||||
|
|
||||||
|
m4_set_add([crypto_backends], [newname])
|
||||||
|
|
||||||
|
This automatically creates a --with-crypto=newname option.
|
||||||
|
|
||||||
|
0.2) Add an m4_case stanza to LIBSSH2_CRYPTO_CHECK in acinclude.m4
|
||||||
|
|
||||||
|
This must check for all required libraries, and if found set and AC_SUBST a
|
||||||
|
variable with the library linking flags. The recommended method is to use
|
||||||
|
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
|
||||||
|
|
||||||
|
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) Add a new block in src/Makefile.am
|
||||||
|
|
||||||
|
if NEWNAME
|
||||||
|
include ../Makefile.newname.inc
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
1) Crypto library initialization/termination.
|
||||||
|
|
||||||
|
void libssh2_crypto_init(void);
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
2) HMAC
|
||||||
|
|
||||||
|
libssh2_hmac_ctx
|
||||||
|
Type of an HMAC computation context. Generally a struct.
|
||||||
|
Used for all hash algorithms.
|
||||||
|
|
||||||
|
void libssh2_hmac_ctx_init(libssh2_hmac_ctx ctx);
|
||||||
|
Initializes the HMAC computation context ctx.
|
||||||
|
Called before setting-up the hash algorithm.
|
||||||
|
Note: if the ctx parameter is modified by the underlying code,
|
||||||
|
this procedure must be implemented as a macro to map ctx --> &ctx.
|
||||||
|
|
||||||
|
void libssh2_hmac_update(libssh2_hmac_ctx ctx,
|
||||||
|
const unsigned char *data,
|
||||||
|
int datalen);
|
||||||
|
Continue computation of an HMAC on datalen bytes at data using context ctx.
|
||||||
|
Note: if the ctx parameter is modified by the underlying code,
|
||||||
|
this procedure must be implemented as a macro to map ctx --> &ctx.
|
||||||
|
|
||||||
|
void libssh2_hmac_final(libssh2_hmac_ctx ctx,
|
||||||
|
unsigned char output[]);
|
||||||
|
Get the computed HMAC from context ctx into the output buffer. The
|
||||||
|
minimum data buffer size depends on the HMAC hash algorithm.
|
||||||
|
Note: if the ctx parameter is modified by the underlying code,
|
||||||
|
this procedure must be implemented as a macro to map ctx --> &ctx.
|
||||||
|
|
||||||
|
void libssh2_hmac_cleanup(libssh2_hmac_ctx *ctx);
|
||||||
|
Releases the HMAC computation context at ctx.
|
||||||
|
|
||||||
|
|
||||||
|
3) Hash algorithms.
|
||||||
|
|
||||||
|
3.1) SHA-1
|
||||||
|
Must always be implemented.
|
||||||
|
|
||||||
|
SHA_DIGEST_LENGTH
|
||||||
|
#define to 20, the SHA-1 digest length.
|
||||||
|
|
||||||
|
libssh2_sha1_ctx
|
||||||
|
Type of an SHA-1 computation context. Generally a struct.
|
||||||
|
|
||||||
|
int libssh2_sha1_init(libssh2_sha1_ctx *x);
|
||||||
|
Initializes the SHA-1 computation context at x.
|
||||||
|
Returns 1 for success and 0 for failure
|
||||||
|
|
||||||
|
void libssh2_sha1_update(libssh2_sha1_ctx ctx,
|
||||||
|
const unsigned char *data,
|
||||||
|
size_t len);
|
||||||
|
Continue computation of SHA-1 on len bytes at data using context ctx.
|
||||||
|
Note: if the ctx parameter is modified by the underlying code,
|
||||||
|
this procedure must be implemented as a macro to map ctx --> &ctx.
|
||||||
|
|
||||||
|
void libssh2_sha1_final(libssh2_sha1_ctx ctx,
|
||||||
|
unsigned char output[SHA_DIGEST_LEN]);
|
||||||
|
Get the computed SHA-1 signature from context ctx and store it into the
|
||||||
|
output buffer.
|
||||||
|
Release the context.
|
||||||
|
Note: if the ctx parameter is modified by the underlying code,
|
||||||
|
this procedure must be implemented as a macro to map ctx --> &ctx.
|
||||||
|
|
||||||
|
void libssh2_hmac_sha1_init(libssh2_hmac_ctx *ctx,
|
||||||
|
const void *key,
|
||||||
|
int keylen);
|
||||||
|
Setup the HMAC computation context ctx for an HMAC-SHA-1 computation using the
|
||||||
|
keylen-byte key. Is invoked just after libssh2_hmac_ctx_init().
|
||||||
|
|
||||||
|
3.2) SHA-256
|
||||||
|
Must always be implemented.
|
||||||
|
|
||||||
|
SHA256_DIGEST_LENGTH
|
||||||
|
#define to 32, the SHA-256 digest length.
|
||||||
|
|
||||||
|
libssh2_sha256_ctx
|
||||||
|
Type of an SHA-256 computation context. Generally a struct.
|
||||||
|
|
||||||
|
int libssh2_sha256_init(libssh2_sha256_ctx *x);
|
||||||
|
Initializes the SHA-256 computation context at x.
|
||||||
|
Returns 1 for success and 0 for failure
|
||||||
|
|
||||||
|
void libssh2_sha256_update(libssh2_sha256_ctx ctx,
|
||||||
|
const unsigned char *data,
|
||||||
|
size_t len);
|
||||||
|
Continue computation of SHA-256 on len bytes at data using context ctx.
|
||||||
|
Note: if the ctx parameter is modified by the underlying code,
|
||||||
|
this procedure must be implemented as a macro to map ctx --> &ctx.
|
||||||
|
|
||||||
|
void libssh2_sha256_final(libssh2_sha256_ctx ctx,
|
||||||
|
unsigned char output[SHA256_DIGEST_LENGTH]);
|
||||||
|
Gets the computed SHA-256 signature from context ctx into the output buffer.
|
||||||
|
Release the context.
|
||||||
|
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,
|
||||||
|
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.
|
||||||
|
Return 1 if error, else 0.
|
||||||
|
Note: Seems unused in current code, but defined in each crypto library backend.
|
||||||
|
|
||||||
|
LIBSSH2_HMAC_SHA256
|
||||||
|
#define as 1 if the crypto library supports HMAC-SHA-256, else 0.
|
||||||
|
If defined as 0, the rest of this section can be omitted.
|
||||||
|
|
||||||
|
void libssh2_hmac_sha256_init(libssh2_hmac_ctx *ctx,
|
||||||
|
const void *key,
|
||||||
|
int keylen);
|
||||||
|
Setup the HMAC computation context ctx for an HMAC-256 computation using the
|
||||||
|
keylen-byte key. Is invoked just after libssh2_hmac_ctx_init().
|
||||||
|
|
||||||
|
3.3) SHA-384
|
||||||
|
Mandatory if ECDSA is implemented. Can be omitted otherwise.
|
||||||
|
|
||||||
|
SHA384_DIGEST_LENGTH
|
||||||
|
#define to 48, the SHA-384 digest length.
|
||||||
|
|
||||||
|
libssh2_sha384_ctx
|
||||||
|
Type of an SHA-384 computation context. Generally a struct.
|
||||||
|
|
||||||
|
int libssh2_sha384_init(libssh2_sha384_ctx *x);
|
||||||
|
Initializes the SHA-384 computation context at x.
|
||||||
|
Returns 1 for success and 0 for failure
|
||||||
|
|
||||||
|
void libssh2_sha384_update(libssh2_sha384_ctx ctx,
|
||||||
|
const unsigned char *data,
|
||||||
|
size_t len);
|
||||||
|
Continue computation of SHA-384 on len bytes at data using context ctx.
|
||||||
|
Note: if the ctx parameter is modified by the underlying code,
|
||||||
|
this procedure must be implemented as a macro to map ctx --> &ctx.
|
||||||
|
|
||||||
|
void libssh2_sha384_final(libssh2_sha384_ctx ctx,
|
||||||
|
unsigned char output[SHA384_DIGEST_LENGTH]);
|
||||||
|
Gets the computed SHA-384 signature from context ctx into the output buffer.
|
||||||
|
Release the context.
|
||||||
|
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,
|
||||||
|
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.
|
||||||
|
Return 1 if error, else 0.
|
||||||
|
|
||||||
|
3.4) SHA-512
|
||||||
|
Must always be implemented.
|
||||||
|
|
||||||
|
SHA512_DIGEST_LENGTH
|
||||||
|
#define to 64, the SHA-512 digest length.
|
||||||
|
|
||||||
|
libssh2_sha512_ctx
|
||||||
|
Type of an SHA-512 computation context. Generally a struct.
|
||||||
|
|
||||||
|
int libssh2_sha512_init(libssh2_sha512_ctx *x);
|
||||||
|
Initializes the SHA-512 computation context at x.
|
||||||
|
Returns 1 for success and 0 for failure
|
||||||
|
|
||||||
|
void libssh2_sha512_update(libssh2_sha512_ctx ctx,
|
||||||
|
const unsigned char *data,
|
||||||
|
size_t len);
|
||||||
|
Continue computation of SHA-512 on len bytes at data using context ctx.
|
||||||
|
Note: if the ctx parameter is modified by the underlying code,
|
||||||
|
this procedure must be implemented as a macro to map ctx --> &ctx.
|
||||||
|
|
||||||
|
void libssh2_sha512_final(libssh2_sha512_ctx ctx,
|
||||||
|
unsigned char output[SHA512_DIGEST_LENGTH]);
|
||||||
|
Gets the computed SHA-512 signature from context ctx into the output buffer.
|
||||||
|
Release the context.
|
||||||
|
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,
|
||||||
|
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.
|
||||||
|
Return 1 if error, else 0.
|
||||||
|
Note: Seems unused in current code, but defined in each crypto library backend.
|
||||||
|
|
||||||
|
LIBSSH2_HMAC_SHA512
|
||||||
|
#define as 1 if the crypto library supports HMAC-SHA-512, else 0.
|
||||||
|
If defined as 0, the rest of this section can be omitted.
|
||||||
|
|
||||||
|
void libssh2_hmac_sha512_init(libssh2_hmac_ctx *ctx,
|
||||||
|
const void *key,
|
||||||
|
int keylen);
|
||||||
|
Setup the HMAC computation context ctx for an HMAC-512 computation using the
|
||||||
|
keylen-byte key. Is invoked just after libssh2_hmac_ctx_init().
|
||||||
|
|
||||||
|
3.5) MD5
|
||||||
|
LIBSSH2_MD5
|
||||||
|
#define to 1 if the crypto library supports MD5, else 0.
|
||||||
|
If defined as 0, the rest of this section can be omitted.
|
||||||
|
|
||||||
|
MD5_DIGEST_LENGTH
|
||||||
|
#define to 16, the MD5 digest length.
|
||||||
|
|
||||||
|
libssh2_md5_ctx
|
||||||
|
Type of an MD5 computation context. Generally a struct.
|
||||||
|
|
||||||
|
int libssh2_md5_init(libssh2_md5_ctx *x);
|
||||||
|
Initializes the MD5 computation context at x.
|
||||||
|
Returns 1 for success and 0 for failure
|
||||||
|
|
||||||
|
void libssh2_md5_update(libssh2_md5_ctx ctx,
|
||||||
|
const unsigned char *data,
|
||||||
|
size_t len);
|
||||||
|
Continues computation of MD5 on len bytes at data using context ctx.
|
||||||
|
Returns 1 for success and 0 for failure.
|
||||||
|
Note: if the ctx parameter is modified by the underlying code,
|
||||||
|
this procedure must be implemented as a macro to map ctx --> &ctx.
|
||||||
|
|
||||||
|
void libssh2_md5_final(libssh2_md5_ctx ctx,
|
||||||
|
unsigned char output[MD5_DIGEST_LENGTH]);
|
||||||
|
Gets the computed MD5 signature from context ctx into the output buffer.
|
||||||
|
Release the context.
|
||||||
|
Note: if the ctx parameter is modified by the underlying code,
|
||||||
|
this procedure must be implemented as a macro to map ctx --> &ctx.
|
||||||
|
|
||||||
|
void libssh2_hmac_md5_init(libssh2_hmac_ctx *ctx,
|
||||||
|
const void *key,
|
||||||
|
int keylen);
|
||||||
|
Setup the HMAC computation context ctx for an HMAC-MD5 computation using the
|
||||||
|
keylen-byte key. Is invoked just after libssh2_hmac_ctx_init().
|
||||||
|
|
||||||
|
3.6) RIPEMD-160
|
||||||
|
LIBSSH2_HMAC_RIPEMD
|
||||||
|
#define as 1 if the crypto library supports HMAC-RIPEMD-160, else 0.
|
||||||
|
If defined as 0, the rest of this section can be omitted.
|
||||||
|
|
||||||
|
void libssh2_hmac_ripemd160_init(libssh2_hmac_ctx *ctx,
|
||||||
|
const void *key,
|
||||||
|
int keylen);
|
||||||
|
Setup the HMAC computation context ctx for an HMAC-RIPEMD-160 computation using
|
||||||
|
the keylen-byte key. Is invoked just after libssh2_hmac_ctx_init().
|
||||||
|
Returns 1 for success and 0 for failure.
|
||||||
|
|
||||||
|
|
||||||
|
4) Bidirectional key ciphers.
|
||||||
|
|
||||||
|
_libssh2_cipher_ctx
|
||||||
|
Type of a cipher computation context.
|
||||||
|
|
||||||
|
_libssh2_cipher_type(name);
|
||||||
|
Macro defining name as storage identifying a cipher algorithm for
|
||||||
|
the crypto library interface. No trailing semicolon.
|
||||||
|
|
||||||
|
int _libssh2_cipher_init(_libssh2_cipher_ctx *h,
|
||||||
|
_libssh2_cipher_type(algo),
|
||||||
|
unsigned char *iv,
|
||||||
|
unsigned char *secret,
|
||||||
|
int encrypt);
|
||||||
|
Creates a cipher context for the given algorithm with the initialization vector
|
||||||
|
iv and the secret key secret. Prepare for encryption or decryption depending on
|
||||||
|
encrypt.
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_cipher_crypt(_libssh2_cipher_ctx *ctx,
|
||||||
|
_libssh2_cipher_type(algo),
|
||||||
|
int encrypt,
|
||||||
|
unsigned char *block,
|
||||||
|
size_t blocksize);
|
||||||
|
Encrypt or decrypt in-place data at (block, blocksize) using the given
|
||||||
|
context and/or algorithm.
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
void _libssh2_cipher_dtor(_libssh2_cipher_ctx *ctx);
|
||||||
|
Release cipher context at ctx.
|
||||||
|
|
||||||
|
4.1) AES
|
||||||
|
4.1.1) AES in CBC block mode.
|
||||||
|
LIBSSH2_AES
|
||||||
|
#define as 1 if the crypto library supports AES in CBC mode, else 0.
|
||||||
|
If defined as 0, the rest of this section can be omitted.
|
||||||
|
|
||||||
|
_libssh2_cipher_aes128
|
||||||
|
AES-128-CBC algorithm identifier initializer.
|
||||||
|
#define with constant value of type _libssh2_cipher_type().
|
||||||
|
|
||||||
|
_libssh2_cipher_aes192
|
||||||
|
AES-192-CBC algorithm identifier initializer.
|
||||||
|
#define with constant value of type _libssh2_cipher_type().
|
||||||
|
|
||||||
|
_libssh2_cipher_aes256
|
||||||
|
AES-256-CBC algorithm identifier initializer.
|
||||||
|
#define with constant value of type _libssh2_cipher_type().
|
||||||
|
|
||||||
|
4.1.2) AES in CTR block mode.
|
||||||
|
LIBSSH2_AES_CTR
|
||||||
|
#define as 1 if the crypto library supports AES in CTR mode, else 0.
|
||||||
|
If defined as 0, the rest of this section can be omitted.
|
||||||
|
|
||||||
|
_libssh2_cipher_aes128ctr
|
||||||
|
AES-128-CTR algorithm identifier initializer.
|
||||||
|
#define with constant value of type _libssh2_cipher_type().
|
||||||
|
|
||||||
|
_libssh2_cipher_aes192ctr
|
||||||
|
AES-192-CTR algorithm identifier initializer.
|
||||||
|
#define with constant value of type _libssh2_cipher_type().
|
||||||
|
|
||||||
|
_libssh2_cipher_aes256ctr
|
||||||
|
AES-256-CTR algorithm identifier initializer.
|
||||||
|
#define with constant value of type _libssh2_cipher_type().
|
||||||
|
|
||||||
|
4.2) Blowfish in CBC block mode.
|
||||||
|
LIBSSH2_BLOWFISH
|
||||||
|
#define as 1 if the crypto library supports blowfish in CBC mode, else 0.
|
||||||
|
If defined as 0, the rest of this section can be omitted.
|
||||||
|
|
||||||
|
_libssh2_cipher_blowfish
|
||||||
|
Blowfish-CBC algorithm identifier initializer.
|
||||||
|
#define with constant value of type _libssh2_cipher_type().
|
||||||
|
|
||||||
|
4.3) RC4.
|
||||||
|
LIBSSH2_RC4
|
||||||
|
#define as 1 if the crypto library supports RC4 (arcfour), else 0.
|
||||||
|
If defined as 0, the rest of this section can be omitted.
|
||||||
|
|
||||||
|
_libssh2_cipher_arcfour
|
||||||
|
RC4 algorithm identifier initializer.
|
||||||
|
#define with constant value of type _libssh2_cipher_type().
|
||||||
|
|
||||||
|
4.4) CAST5 in CBC block mode.
|
||||||
|
LIBSSH2_CAST
|
||||||
|
#define 1 if the crypto library supports cast, else 0.
|
||||||
|
If defined as 0, the rest of this section can be omitted.
|
||||||
|
|
||||||
|
_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.
|
||||||
|
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.
|
||||||
|
|
||||||
|
_libssh2_cipher_3des
|
||||||
|
TripleDES-CBC algorithm identifier initializer.
|
||||||
|
#define with constant value of type _libssh2_cipher_type().
|
||||||
|
|
||||||
|
|
||||||
|
5) Diffie-Hellman support.
|
||||||
|
|
||||||
|
5.1) Diffie-Hellman context.
|
||||||
|
_libssh2_dh_ctx
|
||||||
|
Type of a Diffie-Hellman computation context.
|
||||||
|
Must always be defined.
|
||||||
|
|
||||||
|
5.2) Diffie-Hellman computation procedures.
|
||||||
|
void libssh2_dh_init(_libssh2_dh_ctx *dhctx);
|
||||||
|
Initializes the Diffie-Hellman context at `dhctx'. No effective context
|
||||||
|
creation needed here.
|
||||||
|
|
||||||
|
int libssh2_dh_key_pair(_libssh2_dh_ctx *dhctx, _libssh2_bn *public,
|
||||||
|
_libssh2_bn *g, _libssh2_bn *p, int group_order,
|
||||||
|
_libssh2_bn_ctx *bnctx);
|
||||||
|
Generates a Diffie-Hellman key pair using base `g', prime `p' and the given
|
||||||
|
`group_order'. Can use the given big number context `bnctx' if needed.
|
||||||
|
The private key is stored as opaque in the Diffie-Hellman context `*dhctx' and
|
||||||
|
the public key is returned in `public'.
|
||||||
|
0 is returned upon success, else -1.
|
||||||
|
|
||||||
|
int libssh2_dh_secret(_libssh2_dh_ctx *dhctx, _libssh2_bn *secret,
|
||||||
|
_libssh2_bn *f, _libssh2_bn *p, _libssh2_bn_ctx * bnctx)
|
||||||
|
Computes the Diffie-Hellman secret from the previously created context `*dhctx',
|
||||||
|
the public key `f' from the other party and the same prime `p' used at
|
||||||
|
context creation. The result is stored in `secret'.
|
||||||
|
0 is returned upon success, else -1.
|
||||||
|
|
||||||
|
void libssh2_dh_dtor(_libssh2_dh_ctx *dhctx)
|
||||||
|
Destroys Diffie-Hellman context at `dhctx' and resets its storage.
|
||||||
|
|
||||||
|
|
||||||
|
6) Big numbers.
|
||||||
|
Positive multi-byte integers support is sufficient.
|
||||||
|
|
||||||
|
6.1) Computation contexts.
|
||||||
|
This has a real meaning if the big numbers computations need some context
|
||||||
|
storage. If not, use a dummy type and functions (macros).
|
||||||
|
|
||||||
|
_libssh2_bn_ctx
|
||||||
|
Type of multiple precision computation context. May not be empty. if not used,
|
||||||
|
#define as char, for example.
|
||||||
|
|
||||||
|
_libssh2_bn_ctx _libssh2_bn_ctx_new(void);
|
||||||
|
Returns a new multiple precision computation context.
|
||||||
|
|
||||||
|
void _libssh2_bn_ctx_free(_libssh2_bn_ctx ctx);
|
||||||
|
Releases a multiple precision computation context.
|
||||||
|
|
||||||
|
6.2) Computation support.
|
||||||
|
_libssh2_bn
|
||||||
|
Type of multiple precision numbers (aka bignumbers or huge integers) for the
|
||||||
|
crypto library.
|
||||||
|
|
||||||
|
_libssh2_bn * _libssh2_bn_init(void);
|
||||||
|
Creates a multiple precision number (preset to zero).
|
||||||
|
|
||||||
|
_libssh2_bn * _libssh2_bn_init_from_bin(void);
|
||||||
|
Create a multiple precision number intended to be set by the
|
||||||
|
_libssh2_bn_from_bin() function (see below). Unlike _libssh2_bn_init(), this
|
||||||
|
code may be a dummy initializer if the _libssh2_bn_from_bin() actually
|
||||||
|
allocates the number. Returns a value of type _libssh2_bn *.
|
||||||
|
|
||||||
|
void _libssh2_bn_free(_libssh2_bn *bn);
|
||||||
|
Destroys the multiple precision number at bn.
|
||||||
|
|
||||||
|
unsigned long _libssh2_bn_bytes(_libssh2_bn *bn);
|
||||||
|
Get the number of bytes needed to store the bits of the multiple precision
|
||||||
|
number at bn.
|
||||||
|
|
||||||
|
unsigned long _libssh2_bn_bits(_libssh2_bn *bn);
|
||||||
|
Returns the number of bits of multiple precision number at bn.
|
||||||
|
|
||||||
|
int _libssh2_bn_set_word(_libssh2_bn *bn, unsigned long val);
|
||||||
|
Sets the value of bn to val.
|
||||||
|
Returns 1 on success, 0 otherwise.
|
||||||
|
|
||||||
|
_libssh2_bn * _libssh2_bn_from_bin(_libssh2_bn *bn, int len,
|
||||||
|
const unsigned char *val);
|
||||||
|
Converts the positive integer in big-endian form of length len at val
|
||||||
|
into a _libssh2_bn and place it in bn. If bn is NULL, a new _libssh2_bn is
|
||||||
|
created.
|
||||||
|
Returns a pointer to target _libssh2_bn or NULL if error.
|
||||||
|
|
||||||
|
int _libssh2_bn_to_bin(_libssh2_bn *bn, unsigned char *val);
|
||||||
|
Converts the absolute value of bn into big-endian form and store it at
|
||||||
|
val. val must point to _libssh2_bn_bytes(bn) bytes of memory.
|
||||||
|
Returns the length of the big-endian number.
|
||||||
|
|
||||||
|
|
||||||
|
7) Private key algorithms.
|
||||||
|
Format of an RSA public key:
|
||||||
|
a) "ssh-rsa".
|
||||||
|
b) RSA exponent, MSB first, with high order bit = 0.
|
||||||
|
c) RSA modulus, MSB first, with high order bit = 0.
|
||||||
|
Each item is preceded by its 32-bit byte length, MSB first.
|
||||||
|
|
||||||
|
Format of a DSA public key:
|
||||||
|
a) "ssh-dss".
|
||||||
|
b) p, MSB first, with high order bit = 0.
|
||||||
|
c) q, MSB first, with high order bit = 0.
|
||||||
|
d) g, MSB first, with high order bit = 0.
|
||||||
|
e) pub_key, MSB first, with high order bit = 0.
|
||||||
|
Each item is preceded by its 32-bit byte length, MSB first.
|
||||||
|
|
||||||
|
Format of an ECDSA public key:
|
||||||
|
a) "ecdsa-sha2-nistp256" or "ecdsa-sha2-nistp384" or "ecdsa-sha2-nistp521".
|
||||||
|
b) domain: "nistp256", "nistp384" or "nistp521" matching a).
|
||||||
|
c) raw public key ("octal").
|
||||||
|
Each item is preceded by its 32-bit byte length, MSB first.
|
||||||
|
|
||||||
|
Format of an ED25519 public key:
|
||||||
|
a) "ssh-ed25519".
|
||||||
|
b) raw key (32 bytes).
|
||||||
|
Each item is preceded by its 32-bit byte length, MSB first.
|
||||||
|
|
||||||
|
int _libssh2_pub_priv_keyfile(LIBSSH2_SESSION *session,
|
||||||
|
unsigned char **method,
|
||||||
|
size_t *method_len,
|
||||||
|
unsigned char **pubkeydata,
|
||||||
|
size_t *pubkeydata_len,
|
||||||
|
const char *privatekey,
|
||||||
|
const char *passphrase);
|
||||||
|
Reads a private key from file privatekey and extract the public key -->
|
||||||
|
(pubkeydata, pubkeydata_len). Store the associated method (ssh-rsa or ssh-dss)
|
||||||
|
into (method, method_len).
|
||||||
|
Both buffers have to be allocated using LIBSSH2_ALLOC().
|
||||||
|
Returns 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_pub_priv_keyfilememory(LIBSSH2_SESSION *session,
|
||||||
|
unsigned char **method,
|
||||||
|
size_t *method_len,
|
||||||
|
unsigned char **pubkeydata,
|
||||||
|
size_t *pubkeydata_len,
|
||||||
|
const char *privatekeydata,
|
||||||
|
size_t privatekeydata_len,
|
||||||
|
const char *passphrase);
|
||||||
|
Gets a private key from bytes at (privatekeydata, privatekeydata_len) and
|
||||||
|
extract the public key --> (pubkeydata, pubkeydata_len). Store the associated
|
||||||
|
method (ssh-rsa or ssh-dss) into (method, method_len).
|
||||||
|
Both buffers have to be allocated using LIBSSH2_ALLOC().
|
||||||
|
Returns 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
|
||||||
|
7.1) RSA
|
||||||
|
LIBSSH2_RSA
|
||||||
|
#define as 1 if the crypto library supports RSA, else 0.
|
||||||
|
If defined as 0, the rest of this section can be omitted.
|
||||||
|
|
||||||
|
libssh2_rsa_ctx
|
||||||
|
Type of an RSA computation context. Generally a struct.
|
||||||
|
|
||||||
|
int _libssh2_rsa_new(libssh2_rsa_ctx **rsa,
|
||||||
|
const unsigned char *edata,
|
||||||
|
unsigned long elen,
|
||||||
|
const unsigned char *ndata,
|
||||||
|
unsigned long nlen,
|
||||||
|
const unsigned char *ddata,
|
||||||
|
unsigned long dlen,
|
||||||
|
const unsigned char *pdata,
|
||||||
|
unsigned long plen,
|
||||||
|
const unsigned char *qdata,
|
||||||
|
unsigned long qlen,
|
||||||
|
const unsigned char *e1data,
|
||||||
|
unsigned long e1len,
|
||||||
|
const unsigned char *e2data,
|
||||||
|
unsigned long e2len,
|
||||||
|
const unsigned char *coeffdata, unsigned long coefflen);
|
||||||
|
Creates a new context for RSA computations from key source values:
|
||||||
|
pdata, plen Prime number p. Only used if private key known (ddata).
|
||||||
|
qdata, qlen Prime number q. Only used if private key known (ddata).
|
||||||
|
ndata, nlen Modulus n.
|
||||||
|
edata, elen Exponent e.
|
||||||
|
ddata, dlen e^-1 % phi(n) = private key. May be NULL if unknown.
|
||||||
|
e1data, e1len dp = d % (p-1). Only used if private key known (dtata).
|
||||||
|
e2data, e2len dq = d % (q-1). Only used if private key known (dtata).
|
||||||
|
coeffdata, coefflen q^-1 % p. Only used if private key known.
|
||||||
|
Returns 0 if OK.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
Note: the current generic code only calls this function with e and n (public
|
||||||
|
key parameters): unless used internally by the backend, it is not needed to
|
||||||
|
support the private key and the other parameters here.
|
||||||
|
|
||||||
|
int _libssh2_rsa_new_private(libssh2_rsa_ctx **rsa,
|
||||||
|
LIBSSH2_SESSION *session,
|
||||||
|
const char *filename,
|
||||||
|
unsigned const char *passphrase);
|
||||||
|
Reads an RSA private key from file filename into a new RSA context.
|
||||||
|
Must call _libssh2_init_if_needed().
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
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,
|
||||||
|
unsigned const char *passphrase);
|
||||||
|
Gets an RSA private key from data into a new RSA context.
|
||||||
|
Must call _libssh2_init_if_needed().
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
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);
|
||||||
|
Verify (sig, sig_len) signature of (m, m_len) using an SHA-1 hash and the
|
||||||
|
RSA context.
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_rsa_sha1_signv(LIBSSH2_SESSION *session,
|
||||||
|
unsigned char **sig, size_t *siglen,
|
||||||
|
int count, const struct iovec vector[],
|
||||||
|
libssh2_rsa_ctx *ctx);
|
||||||
|
RSA signs the SHA-1 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_sha1_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-1 hash bytes 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 macro _libssh2_rsa_sha1_signv() is defined.
|
||||||
|
|
||||||
|
void _libssh2_rsa_free(libssh2_rsa_ctx *rsactx);
|
||||||
|
Releases the RSA computation context at rsactx.
|
||||||
|
|
||||||
|
|
||||||
|
7.2) DSA
|
||||||
|
LIBSSH2_DSA
|
||||||
|
#define as 1 if the crypto library supports DSA, else 0.
|
||||||
|
If defined as 0, the rest of this section can be omitted.
|
||||||
|
|
||||||
|
|
||||||
|
libssh2_dsa_ctx
|
||||||
|
Type of a DSA computation context. Generally a struct.
|
||||||
|
|
||||||
|
int _libssh2_dsa_new(libssh2_dsa_ctx **dsa,
|
||||||
|
const unsigned char *pdata,
|
||||||
|
unsigned long plen,
|
||||||
|
const unsigned char *qdata,
|
||||||
|
unsigned long qlen,
|
||||||
|
const unsigned char *gdata,
|
||||||
|
unsigned long glen,
|
||||||
|
const unsigned char *ydata,
|
||||||
|
unsigned long ylen,
|
||||||
|
const unsigned char *x, unsigned long x_len);
|
||||||
|
Creates a new context for DSA computations from source key values:
|
||||||
|
pdata, plen Prime number p. Only used if private key known (ddata).
|
||||||
|
qdata, qlen Prime number q. Only used if private key known (ddata).
|
||||||
|
gdata, glen G number.
|
||||||
|
ydata, ylen Public key.
|
||||||
|
xdata, xlen Private key. Only taken if xlen non-zero.
|
||||||
|
Returns 0 if OK.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_dsa_new_private(libssh2_dsa_ctx **dsa,
|
||||||
|
LIBSSH2_SESSION *session,
|
||||||
|
const char *filename,
|
||||||
|
unsigned const char *passphrase);
|
||||||
|
Gets a DSA private key from file filename into a new DSA context.
|
||||||
|
Must call _libssh2_init_if_needed().
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_dsa_new_private_frommemory(libssh2_dsa_ctx **dsa,
|
||||||
|
LIBSSH2_SESSION *session,
|
||||||
|
const char *data,
|
||||||
|
size_t data_len,
|
||||||
|
unsigned const char *passphrase);
|
||||||
|
Gets a DSA private key from the data_len-bytes data into a new DSA context.
|
||||||
|
Must call _libssh2_init_if_needed().
|
||||||
|
Returns 0 if OK, else -1.
|
||||||
|
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);
|
||||||
|
Verify (sig, siglen) signature of (m, m_len) using an SHA-1 hash and the
|
||||||
|
DSA context.
|
||||||
|
Returns 0 if OK, else -1.
|
||||||
|
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);
|
||||||
|
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.
|
||||||
|
|
||||||
|
void _libssh2_dsa_free(libssh2_dsa_ctx *dsactx);
|
||||||
|
Releases the DSA computation context at dsactx.
|
||||||
|
|
||||||
|
|
||||||
|
7.3) ECDSA
|
||||||
|
LIBSSH2_ECDSA
|
||||||
|
#define as 1 if the crypto library supports ECDSA, else 0.
|
||||||
|
If defined as 0, _libssh2_ec_key should be defined as void and the rest of
|
||||||
|
this section can be omitted.
|
||||||
|
|
||||||
|
EC_MAX_POINT_LEN
|
||||||
|
Maximum point length. Usually defined as ((528 * 2 / 8) + 1) (= 133).
|
||||||
|
|
||||||
|
libssh2_ecdsa_ctx
|
||||||
|
Type of an ECDSA computation context. Generally a struct.
|
||||||
|
|
||||||
|
_libssh2_ec_key
|
||||||
|
Type of an elliptic curve key.
|
||||||
|
|
||||||
|
libssh2_curve_type
|
||||||
|
An enum type defining curve types. Current supported identifiers are:
|
||||||
|
LIBSSH2_EC_CURVE_NISTP256
|
||||||
|
LIBSSH2_EC_CURVE_NISTP384
|
||||||
|
LIBSSH2_EC_CURVE_NISTP521
|
||||||
|
|
||||||
|
int _libssh2_ecdsa_create_key(_libssh2_ec_key **out_private_key,
|
||||||
|
unsigned char **out_public_key_octal,
|
||||||
|
size_t *out_public_key_octal_len,
|
||||||
|
libssh2_curve_type curve_type);
|
||||||
|
Create a new ECDSA private key of type curve_type and return it at
|
||||||
|
out_private_key. If out_public_key_octal is not NULL, store an allocated
|
||||||
|
pointer to the associated public key in "octal" form in it and its length
|
||||||
|
at out_public_key_octal_len.
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_ecdsa_new_private(libssh2_ecdsa_ctx **ec_ctx,
|
||||||
|
LIBSSH2_SESSION * session,
|
||||||
|
const char *filename,
|
||||||
|
unsigned const char *passphrase);
|
||||||
|
Reads an ECDSA private key from PEM file filename into a new ECDSA context.
|
||||||
|
Must call _libssh2_init_if_needed().
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_ecdsa_new_private_frommemory(libssh2_ecdsa_ctx ** ec_ctx,
|
||||||
|
LIBSSH2_SESSION * session,
|
||||||
|
const char *filedata,
|
||||||
|
size_t filedata_len,
|
||||||
|
unsigned const char *passphrase);
|
||||||
|
Builds an ECDSA private key from PEM data at filedata of length filedata_len
|
||||||
|
into a new ECDSA context stored at ec_ctx.
|
||||||
|
Must call _libssh2_init_if_needed().
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_ecdsa_curve_name_with_octal_new(libssh2_ecdsa_ctx **ecdsactx,
|
||||||
|
const unsigned char *k,
|
||||||
|
size_t k_len,
|
||||||
|
libssh2_curve_type type);
|
||||||
|
Stores at ecdsactx a new ECDSA context associated with the given curve type
|
||||||
|
and with "octal" form public key (k, k_len).
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_ecdsa_new_openssh_private(libssh2_ecdsa_ctx **ec_ctx,
|
||||||
|
LIBSSH2_SESSION * session,
|
||||||
|
const char *filename,
|
||||||
|
unsigned const char *passphrase);
|
||||||
|
Reads a PEM-encoded ECDSA private key from file filename encrypted with
|
||||||
|
passphrase and stores at ec_ctx a new ECDSA context for it.
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
Currently used only from openssl backend (ought to be private).
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_ecdsa_sign(LIBSSH2_SESSION *session, libssh2_ecdsa_ctx *ec_ctx,
|
||||||
|
const unsigned char *hash, unsigned long hash_len,
|
||||||
|
unsigned char **signature, size_t *signature_len);
|
||||||
|
ECDSA signs the (hash, hashlen) hash bytes and stores the allocated
|
||||||
|
signature at (signature, signature_len). Hash algorithm used should be
|
||||||
|
SHA-256, SHA-384 or SHA-512 depending on type stored in ECDSA context at ec_ctx.
|
||||||
|
Signature buffer must be allocated from the given session.
|
||||||
|
Returns 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_ecdsa_verify(libssh2_ecdsa_ctx *ctx,
|
||||||
|
const unsigned char *r, size_t r_len,
|
||||||
|
const unsigned char *s, size_t s_len,
|
||||||
|
const unsigned char *m, size_t m_len);
|
||||||
|
Verify the ECDSA signature made of (r, r_len) and (s, s_len) of (m, m_len)
|
||||||
|
using the hash algorithm configured in the ECDSA context ctx.
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
libssh2_curve_type _libssh2_ecdsa_get_curve_type(libssh2_ecdsa_ctx *ecdsactx);
|
||||||
|
Returns the curve type associated with given context.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_ecdsa_curve_type_from_name(const char *name,
|
||||||
|
libssh2_curve_type *out_type);
|
||||||
|
Stores in out_type the curve type matching string name of the form
|
||||||
|
"ecdsa-sha2-nistpxxx".
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
Currently used only from openssl backend (ought to be private).
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
void _libssh2_ecdsa_free(libssh2_ecdsa_ctx *ecdsactx);
|
||||||
|
Releases the ECDSA computation context at ecdsactx.
|
||||||
|
|
||||||
|
|
||||||
|
7.4) ED25519
|
||||||
|
LIBSSH2_ED25519
|
||||||
|
#define as 1 if the crypto library supports ED25519, else 0.
|
||||||
|
If defined as 0, the rest of this section can be omitted.
|
||||||
|
|
||||||
|
|
||||||
|
libssh2_ed25519_ctx
|
||||||
|
Type of an ED25519 computation context. Generally a struct.
|
||||||
|
|
||||||
|
int _libssh2_curve25519_new(LIBSSH2_SESSION *session, libssh2_ed25519_ctx **ctx,
|
||||||
|
uint8_t **out_public_key,
|
||||||
|
uint8_t **out_private_key);
|
||||||
|
Generates an ED25519 key pair, stores a pointer to them at out_private_key
|
||||||
|
and out_public_key respectively and stores at ctx a new ED25519 context for
|
||||||
|
this key.
|
||||||
|
Argument ctx, out_private_key and out_public key may be NULL to disable storing
|
||||||
|
the corresponding value.
|
||||||
|
Length of each key is LIBSSH2_ED25519_KEY_LEN (32 bytes).
|
||||||
|
Key buffers are allocated and should be released by caller after use.
|
||||||
|
Returns 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_ed25519_new_private(libssh2_ed25519_ctx **ed_ctx,
|
||||||
|
LIBSSH2_SESSION *session,
|
||||||
|
const char *filename,
|
||||||
|
const uint8_t *passphrase);
|
||||||
|
Reads an ED25519 private key from PEM file filename into a new ED25519 context.
|
||||||
|
Must call _libssh2_init_if_needed().
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
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);
|
||||||
|
Stores at ed_ctx a new ED25519 key context for raw public key (raw_pub_key,
|
||||||
|
key_len).
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_ed25519_new_private_frommemory(libssh2_ed25519_ctx **ed_ctx,
|
||||||
|
LIBSSH2_SESSION *session,
|
||||||
|
const char *filedata,
|
||||||
|
size_t filedata_len,
|
||||||
|
unsigned const char *passphrase);
|
||||||
|
Builds an ED25519 private key from PEM data at filedata of length filedata_len
|
||||||
|
into a new ED25519 context stored at ed_ctx.
|
||||||
|
Must call _libssh2_init_if_needed().
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_ed25519_sign(libssh2_ed25519_ctx *ctx, LIBSSH2_SESSION *session,
|
||||||
|
uint8_t **out_sig, size_t *out_sig_len,
|
||||||
|
const uint8_t *message, size_t message_len);
|
||||||
|
ED25519 signs the (message, message_len) bytes and stores the allocated
|
||||||
|
signature at (sig, sig_len).
|
||||||
|
Signature buffer is allocated from the given session.
|
||||||
|
Returns 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_ed25519_verify(libssh2_ed25519_ctx *ctx, const uint8_t *s,
|
||||||
|
size_t s_len, const uint8_t *m, size_t m_len);
|
||||||
|
Verify (s, s_len) signature of (m, m_len) using the given ED25519 context.
|
||||||
|
Return 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
int _libssh2_curve25519_gen_k(_libssh2_bn **k,
|
||||||
|
uint8_t private_key[LIBSSH2_ED25519_KEY_LEN],
|
||||||
|
uint8_t srvr_public_key[LIBSSH2_ED25519_KEY_LEN]);
|
||||||
|
Computes a shared ED25519 secret key from the given raw server public key and
|
||||||
|
raw client public key and stores it as a big number in *k. Big number should
|
||||||
|
have been initialized before calling this function.
|
||||||
|
Returns 0 if OK, else -1.
|
||||||
|
This procedure is already prototyped in crypto.h.
|
||||||
|
|
||||||
|
void _libssh2_ed25519_free(libssh2_ed25519_ctx *ed25519ctx);
|
||||||
|
Releases the ED25519 computation context at ed25519ctx.
|
||||||
|
|
||||||
|
|
||||||
|
8) Miscellaneous
|
||||||
|
|
||||||
|
void libssh2_prepare_iovec(struct iovec *vector, unsigned int len);
|
||||||
|
Prepare len consecutive iovec slots before using them.
|
||||||
|
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);
|
||||||
|
Store len random bytes at buf.
|
||||||
|
Returns 0 if OK, else -1.
|
||||||
@@ -7,6 +7,22 @@ Software Foundation, Inc.
|
|||||||
This file is free documentation; the Free Software Foundation gives
|
This file is free documentation; the Free Software Foundation gives
|
||||||
unlimited permission to copy, distribute and modify it.
|
unlimited permission to copy, distribute and modify it.
|
||||||
|
|
||||||
|
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
|
||||||
|
sure that autoconf, automake and libtool are installed on your system,
|
||||||
|
then execute:
|
||||||
|
|
||||||
|
autoreconf -fi
|
||||||
|
|
||||||
|
After executing this script, you can build the project as usual:
|
||||||
|
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
|
||||||
Basic Installation
|
Basic Installation
|
||||||
==================
|
==================
|
||||||
|
|
||||||
@@ -234,3 +250,106 @@ configuration-related scripts to be executed by `/bin/bash'.
|
|||||||
`configure' also accepts some other, not widely useful, options. Run
|
`configure' also accepts some other, not widely useful, options. Run
|
||||||
`configure --help' for more details.
|
`configure --help' for more details.
|
||||||
|
|
||||||
|
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.
|
||||||
|
One of the cryptographic libraries is required.
|
||||||
|
|
||||||
|
Configure will attempt to locate Libgcrypt
|
||||||
|
automatically.
|
||||||
|
|
||||||
|
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.
|
||||||
|
One of the cryptographic libraries is required.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
* --with-mbedtls
|
||||||
|
* --without-mbedtls
|
||||||
|
* --with-libmbedtls-prefix=[DIR]
|
||||||
|
|
||||||
|
libssh2 can use the mbedTLS library
|
||||||
|
(https://tls.mbed.org) for cryptographic operations.
|
||||||
|
One of the cryptographic libraries is required.
|
||||||
|
|
||||||
|
Configure will attempt to locate mbedTLS in the
|
||||||
|
default location.
|
||||||
|
|
||||||
|
If your installation of mbedTLS is in another
|
||||||
|
location, specify it using --with-libmbedtls-prefix.
|
||||||
|
|
||||||
|
* --with-libz
|
||||||
|
* --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 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).
|
||||||
@@ -0,0 +1,193 @@
|
|||||||
|
License: see COPYING
|
||||||
|
|
||||||
|
Source code: https://github.com/libssh2/libssh2
|
||||||
|
|
||||||
|
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
|
||||||
|
following cryptography libraries:
|
||||||
|
|
||||||
|
* OpenSSL
|
||||||
|
* Libgcrypt
|
||||||
|
* WinCNG
|
||||||
|
* mbedTLS
|
||||||
|
|
||||||
|
Getting started
|
||||||
|
---------------
|
||||||
|
|
||||||
|
If you are happy with the default options, make a new build directory,
|
||||||
|
change to it, configure the build environment and build the project:
|
||||||
|
|
||||||
|
```
|
||||||
|
mkdir bin
|
||||||
|
cd bin
|
||||||
|
cmake ..
|
||||||
|
cmake --build .
|
||||||
|
```
|
||||||
|
|
||||||
|
libssh2 will be built as a static library and will use any
|
||||||
|
cryptography library available. The library binary will be put in
|
||||||
|
`bin/src`, with the examples in `bin/example` and the tests in
|
||||||
|
`bin/tests`.
|
||||||
|
|
||||||
|
Customising the build
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
Of course, you might want to customise the build options. You can
|
||||||
|
pass the options to CMake on the command line:
|
||||||
|
|
||||||
|
cmake -D<option>=<value> ..
|
||||||
|
|
||||||
|
The following options are available:
|
||||||
|
|
||||||
|
* `LINT=ON`
|
||||||
|
|
||||||
|
Enables running the source code linter when building. 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`.
|
||||||
|
|
||||||
|
* `CRYPTO_BACKEND=`
|
||||||
|
|
||||||
|
Chooses a specific cryptography library to use for cryptographic
|
||||||
|
operations. Can be `OpenSSL` (https://www.openssl.org),
|
||||||
|
`Libgcrypt` (https://www.gnupg.org/), `WinCNG` (Windows Vista+),
|
||||||
|
`mbedTLS` (https://tls.mbed.org/) or blank to use any library available.
|
||||||
|
|
||||||
|
CMake will attempt to locate the libraries automatically. See [2]
|
||||||
|
for more information.
|
||||||
|
|
||||||
|
* `ENABLE_ZLIB_COMPRESSION=OFF`
|
||||||
|
|
||||||
|
Will use zlib (http://www.zlib.org) 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.
|
||||||
|
|
||||||
|
* `CLEAR_MEMORY=ON`
|
||||||
|
|
||||||
|
Securely zero memory before freeing it (if the backend supports this).
|
||||||
|
|
||||||
|
Build tools
|
||||||
|
-----------
|
||||||
|
|
||||||
|
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
|
||||||
|
point onwards.
|
||||||
|
|
||||||
|
Tests
|
||||||
|
-----
|
||||||
|
|
||||||
|
To test the build, run the appropriate test target for your build
|
||||||
|
system. For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
cmake --build . --target test
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```
|
||||||
|
cmake --build . --target RUN_TESTS
|
||||||
|
```
|
||||||
|
|
||||||
|
How do I use libssh2 in my project if my project doesn't use CMake?
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
|
||||||
|
If you are not using CMake for your own project, install libssh2
|
||||||
|
```
|
||||||
|
cmake <libssh2 source location>
|
||||||
|
cmake --build .
|
||||||
|
cmake --build . --target install
|
||||||
|
```
|
||||||
|
or
|
||||||
|
```
|
||||||
|
cmake --build . --target INSTALL
|
||||||
|
```
|
||||||
|
|
||||||
|
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
|
||||||
|
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.
|
||||||
|
|
||||||
|
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 can even combine the two steps using a so-called 'superbuild'
|
||||||
|
project [4] that downloads, builds and exports libssh2, and then
|
||||||
|
builds your project:
|
||||||
|
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
ExternalProject_Add(
|
||||||
|
Libssh2
|
||||||
|
URL <libssh2 download location>
|
||||||
|
URL_HASH SHA1=<libssh2 archive SHA1>
|
||||||
|
INSTALL_COMMAND "")
|
||||||
|
|
||||||
|
ExternalProject_Add(
|
||||||
|
MyProject DEPENDS Libssh2
|
||||||
|
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
INSTALL_COMMAND "")
|
||||||
|
|
||||||
|
[1] https://www.cmake.org/cmake/resources/software.html
|
||||||
|
[2] https://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html
|
||||||
|
[3] https://www.cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html#package-registry
|
||||||
|
[4] https://blog.kitware.com/wp-content/uploads/2016/01/kitware_quarterly1009.pdf
|
||||||
+9
-1
@@ -1,14 +1,17 @@
|
|||||||
# $Id: Makefile.am,v 1.37 2009/03/26 15:41:15 bagder Exp $
|
# $Id: Makefile.am,v 1.37 2009/03/26 15:41:15 bagder Exp $
|
||||||
|
|
||||||
EXTRA_DIST = template.3
|
EXTRA_DIST = template.3 BINDINGS INSTALL_AUTOTOOLS INSTALL_CMAKE.md HACKING TODO \
|
||||||
|
AUTHORS CMakeLists.txt HACKING-CRYPTO SECURITY.md
|
||||||
|
|
||||||
dist_man_MANS = \
|
dist_man_MANS = \
|
||||||
libssh2_agent_connect.3 \
|
libssh2_agent_connect.3 \
|
||||||
libssh2_agent_disconnect.3 \
|
libssh2_agent_disconnect.3 \
|
||||||
libssh2_agent_free.3 \
|
libssh2_agent_free.3 \
|
||||||
libssh2_agent_get_identity.3 \
|
libssh2_agent_get_identity.3 \
|
||||||
|
libssh2_agent_get_identity_path.3 \
|
||||||
libssh2_agent_init.3 \
|
libssh2_agent_init.3 \
|
||||||
libssh2_agent_list_identities.3 \
|
libssh2_agent_list_identities.3 \
|
||||||
|
libssh2_agent_set_identity_path.3 \
|
||||||
libssh2_agent_userauth.3 \
|
libssh2_agent_userauth.3 \
|
||||||
libssh2_banner_set.3 \
|
libssh2_banner_set.3 \
|
||||||
libssh2_base64_decode.3 \
|
libssh2_base64_decode.3 \
|
||||||
@@ -88,6 +91,7 @@ dist_man_MANS = \
|
|||||||
libssh2_publickey_remove_ex.3 \
|
libssh2_publickey_remove_ex.3 \
|
||||||
libssh2_publickey_shutdown.3 \
|
libssh2_publickey_shutdown.3 \
|
||||||
libssh2_scp_recv.3 \
|
libssh2_scp_recv.3 \
|
||||||
|
libssh2_scp_recv2.3 \
|
||||||
libssh2_scp_send.3 \
|
libssh2_scp_send.3 \
|
||||||
libssh2_scp_send64.3 \
|
libssh2_scp_send64.3 \
|
||||||
libssh2_scp_send_ex.3 \
|
libssh2_scp_send_ex.3 \
|
||||||
@@ -102,11 +106,13 @@ dist_man_MANS = \
|
|||||||
libssh2_session_free.3 \
|
libssh2_session_free.3 \
|
||||||
libssh2_session_get_blocking.3 \
|
libssh2_session_get_blocking.3 \
|
||||||
libssh2_session_get_timeout.3 \
|
libssh2_session_get_timeout.3 \
|
||||||
|
libssh2_session_handshake.3 \
|
||||||
libssh2_session_hostkey.3 \
|
libssh2_session_hostkey.3 \
|
||||||
libssh2_session_init.3 \
|
libssh2_session_init.3 \
|
||||||
libssh2_session_init_ex.3 \
|
libssh2_session_init_ex.3 \
|
||||||
libssh2_session_last_errno.3 \
|
libssh2_session_last_errno.3 \
|
||||||
libssh2_session_last_error.3 \
|
libssh2_session_last_error.3 \
|
||||||
|
libssh2_session_set_last_error.3 \
|
||||||
libssh2_session_method_pref.3 \
|
libssh2_session_method_pref.3 \
|
||||||
libssh2_session_methods.3 \
|
libssh2_session_methods.3 \
|
||||||
libssh2_session_set_blocking.3 \
|
libssh2_session_set_blocking.3 \
|
||||||
@@ -120,6 +126,7 @@ dist_man_MANS = \
|
|||||||
libssh2_sftp_fstat.3 \
|
libssh2_sftp_fstat.3 \
|
||||||
libssh2_sftp_fstat_ex.3 \
|
libssh2_sftp_fstat_ex.3 \
|
||||||
libssh2_sftp_fstatvfs.3 \
|
libssh2_sftp_fstatvfs.3 \
|
||||||
|
libssh2_sftp_fsync.3 \
|
||||||
libssh2_sftp_get_channel.3 \
|
libssh2_sftp_get_channel.3 \
|
||||||
libssh2_sftp_init.3 \
|
libssh2_sftp_init.3 \
|
||||||
libssh2_sftp_last_error.3 \
|
libssh2_sftp_last_error.3 \
|
||||||
@@ -166,4 +173,5 @@ dist_man_MANS = \
|
|||||||
libssh2_userauth_publickey.3 \
|
libssh2_userauth_publickey.3 \
|
||||||
libssh2_userauth_publickey_fromfile.3 \
|
libssh2_userauth_publickey_fromfile.3 \
|
||||||
libssh2_userauth_publickey_fromfile_ex.3 \
|
libssh2_userauth_publickey_fromfile_ex.3 \
|
||||||
|
libssh2_userauth_publickey_frommemory.3 \
|
||||||
libssh2_version.3
|
libssh2_version.3
|
||||||
|
|||||||
+278
-119
@@ -1,8 +1,8 @@
|
|||||||
# Makefile.in generated by automake 1.9.6 from Makefile.am.
|
# Makefile.in generated by automake 1.16.4 from Makefile.am.
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
|
||||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
# with or without modifications, as long as this notice is preserved.
|
# with or without modifications, as long as this notice is preserved.
|
||||||
@@ -15,15 +15,67 @@
|
|||||||
@SET_MAKE@
|
@SET_MAKE@
|
||||||
|
|
||||||
# $Id: Makefile.am,v 1.37 2009/03/26 15:41:15 bagder Exp $
|
# $Id: Makefile.am,v 1.37 2009/03/26 15:41:15 bagder Exp $
|
||||||
srcdir = @srcdir@
|
|
||||||
top_srcdir = @top_srcdir@
|
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
|
am__is_gnu_make = { \
|
||||||
|
if test -z '$(MAKELEVEL)'; then \
|
||||||
|
false; \
|
||||||
|
elif test -n '$(MAKE_HOST)'; then \
|
||||||
|
true; \
|
||||||
|
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||||
|
true; \
|
||||||
|
else \
|
||||||
|
false; \
|
||||||
|
fi; \
|
||||||
|
}
|
||||||
|
am__make_running_with_option = \
|
||||||
|
case $${target_option-} in \
|
||||||
|
?) ;; \
|
||||||
|
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||||
|
"target option '$${target_option-}' specified" >&2; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
has_opt=no; \
|
||||||
|
sane_makeflags=$$MAKEFLAGS; \
|
||||||
|
if $(am__is_gnu_make); then \
|
||||||
|
sane_makeflags=$$MFLAGS; \
|
||||||
|
else \
|
||||||
|
case $$MAKEFLAGS in \
|
||||||
|
*\\[\ \ ]*) \
|
||||||
|
bs=\\; \
|
||||||
|
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||||
|
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||||
|
esac; \
|
||||||
|
fi; \
|
||||||
|
skip_next=no; \
|
||||||
|
strip_trailopt () \
|
||||||
|
{ \
|
||||||
|
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||||
|
}; \
|
||||||
|
for flg in $$sane_makeflags; do \
|
||||||
|
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||||
|
case $$flg in \
|
||||||
|
*=*|--*) continue;; \
|
||||||
|
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||||
|
-*I?*) strip_trailopt 'I';; \
|
||||||
|
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||||
|
-*O?*) strip_trailopt 'O';; \
|
||||||
|
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||||
|
-*l?*) strip_trailopt 'l';; \
|
||||||
|
-[dEDm]) skip_next=yes;; \
|
||||||
|
-[JT]) skip_next=yes;; \
|
||||||
|
esac; \
|
||||||
|
case $$flg in \
|
||||||
|
*$$target_option*) has_opt=yes; break;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
test $$has_opt = yes
|
||||||
|
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||||
|
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||||
pkgdatadir = $(datadir)/@PACKAGE@
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
pkglibdir = $(libdir)/@PACKAGE@
|
|
||||||
pkgincludedir = $(includedir)/@PACKAGE@
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
top_builddir = ..
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||||
INSTALL = @INSTALL@
|
|
||||||
install_sh_DATA = $(install_sh) -c -m 644
|
install_sh_DATA = $(install_sh) -c -m 644
|
||||||
install_sh_PROGRAM = $(install_sh) -c
|
install_sh_PROGRAM = $(install_sh) -c
|
||||||
install_sh_SCRIPT = $(install_sh) -c
|
install_sh_SCRIPT = $(install_sh) -c
|
||||||
@@ -38,8 +90,6 @@ POST_UNINSTALL = :
|
|||||||
build_triplet = @build@
|
build_triplet = @build@
|
||||||
host_triplet = @host@
|
host_triplet = @host@
|
||||||
subdir = docs
|
subdir = docs
|
||||||
DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.am \
|
|
||||||
$(srcdir)/Makefile.in
|
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
am__aclocal_m4_deps = $(top_srcdir)/m4/autobuild.m4 \
|
am__aclocal_m4_deps = $(top_srcdir)/m4/autobuild.m4 \
|
||||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||||
@@ -49,35 +99,85 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/autobuild.m4 \
|
|||||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
$(ACLOCAL_M4)
|
$(ACLOCAL_M4)
|
||||||
|
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||||
mkinstalldirs = $(install_sh) -d
|
mkinstalldirs = $(install_sh) -d
|
||||||
CONFIG_HEADER = $(top_builddir)/src/libssh2_config.h \
|
CONFIG_HEADER = $(top_builddir)/src/libssh2_config.h
|
||||||
$(top_builddir)/example/libssh2_config.h
|
|
||||||
CONFIG_CLEAN_FILES =
|
CONFIG_CLEAN_FILES =
|
||||||
|
CONFIG_CLEAN_VPATH_FILES =
|
||||||
|
AM_V_P = $(am__v_P_@AM_V@)
|
||||||
|
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||||
|
am__v_P_0 = false
|
||||||
|
am__v_P_1 = :
|
||||||
|
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||||
|
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||||
|
am__v_GEN_0 = @echo " GEN " $@;
|
||||||
|
am__v_GEN_1 =
|
||||||
|
AM_V_at = $(am__v_at_@AM_V@)
|
||||||
|
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||||
|
am__v_at_0 = @
|
||||||
|
am__v_at_1 =
|
||||||
SOURCES =
|
SOURCES =
|
||||||
DIST_SOURCES =
|
DIST_SOURCES =
|
||||||
|
am__can_run_installinfo = \
|
||||||
|
case $$AM_UPDATE_INFO_DIR in \
|
||||||
|
n|no|NO) false;; \
|
||||||
|
*) (install-info --version) >/dev/null 2>&1;; \
|
||||||
|
esac
|
||||||
|
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||||
|
am__vpath_adj = case $$p in \
|
||||||
|
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||||
|
*) f=$$p;; \
|
||||||
|
esac;
|
||||||
|
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||||
|
am__install_max = 40
|
||||||
|
am__nobase_strip_setup = \
|
||||||
|
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||||
|
am__nobase_strip = \
|
||||||
|
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||||
|
am__nobase_list = $(am__nobase_strip_setup); \
|
||||||
|
for p in $$list; do echo "$$p $$p"; done | \
|
||||||
|
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||||
|
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||||
|
if (++n[$$2] == $(am__install_max)) \
|
||||||
|
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||||
|
END { for (dir in files) print dir, files[dir] }'
|
||||||
|
am__base_list = \
|
||||||
|
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||||
|
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||||
|
am__uninstall_files_from_dir = { \
|
||||||
|
test -z "$$files" \
|
||||||
|
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
||||||
|
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
||||||
|
$(am__cd) "$$dir" && rm -f $$files; }; \
|
||||||
|
}
|
||||||
man3dir = $(mandir)/man3
|
man3dir = $(mandir)/man3
|
||||||
am__installdirs = "$(DESTDIR)$(man3dir)"
|
am__installdirs = "$(DESTDIR)$(man3dir)"
|
||||||
NROFF = nroff
|
NROFF = nroff
|
||||||
MANS = $(dist_man_MANS)
|
MANS = $(dist_man_MANS)
|
||||||
|
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||||
|
am__DIST_COMMON = $(dist_man_MANS) $(srcdir)/Makefile.in AUTHORS TODO
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
ACLOCAL = @ACLOCAL@
|
ACLOCAL = @ACLOCAL@
|
||||||
ALLOCA = @ALLOCA@
|
ALLOCA = @ALLOCA@
|
||||||
AMDEP_FALSE = @AMDEP_FALSE@
|
|
||||||
AMDEP_TRUE = @AMDEP_TRUE@
|
|
||||||
AMTAR = @AMTAR@
|
AMTAR = @AMTAR@
|
||||||
|
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||||
AR = @AR@
|
AR = @AR@
|
||||||
AS = @AS@
|
AS = @AS@
|
||||||
AUTOCONF = @AUTOCONF@
|
AUTOCONF = @AUTOCONF@
|
||||||
AUTOHEADER = @AUTOHEADER@
|
AUTOHEADER = @AUTOHEADER@
|
||||||
AUTOMAKE = @AUTOMAKE@
|
AUTOMAKE = @AUTOMAKE@
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
BUILD_EXAMPLES_FALSE = @BUILD_EXAMPLES_FALSE@
|
|
||||||
BUILD_EXAMPLES_TRUE = @BUILD_EXAMPLES_TRUE@
|
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CCDEPMODE = @CCDEPMODE@
|
CCDEPMODE = @CCDEPMODE@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
CPPFLAGS = @CPPFLAGS@
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
CSCOPE = @CSCOPE@
|
||||||
|
CTAGS = @CTAGS@
|
||||||
|
CXX = @CXX@
|
||||||
|
CXXCPP = @CXXCPP@
|
||||||
|
CXXDEPMODE = @CXXDEPMODE@
|
||||||
|
CXXFLAGS = @CXXFLAGS@
|
||||||
CYGPATH_W = @CYGPATH_W@
|
CYGPATH_W = @CYGPATH_W@
|
||||||
DEFS = @DEFS@
|
DEFS = @DEFS@
|
||||||
DEPDIR = @DEPDIR@
|
DEPDIR = @DEPDIR@
|
||||||
@@ -88,24 +188,31 @@ ECHO_C = @ECHO_C@
|
|||||||
ECHO_N = @ECHO_N@
|
ECHO_N = @ECHO_N@
|
||||||
ECHO_T = @ECHO_T@
|
ECHO_T = @ECHO_T@
|
||||||
EGREP = @EGREP@
|
EGREP = @EGREP@
|
||||||
|
ETAGS = @ETAGS@
|
||||||
EXEEXT = @EXEEXT@
|
EXEEXT = @EXEEXT@
|
||||||
FGREP = @FGREP@
|
FGREP = @FGREP@
|
||||||
GREP = @GREP@
|
GREP = @GREP@
|
||||||
|
HAVE_LIBBCRYPT = @HAVE_LIBBCRYPT@
|
||||||
|
HAVE_LIBCRYPT32 = @HAVE_LIBCRYPT32@
|
||||||
HAVE_LIBGCRYPT = @HAVE_LIBGCRYPT@
|
HAVE_LIBGCRYPT = @HAVE_LIBGCRYPT@
|
||||||
|
HAVE_LIBMBEDCRYPTO = @HAVE_LIBMBEDCRYPTO@
|
||||||
HAVE_LIBSSL = @HAVE_LIBSSL@
|
HAVE_LIBSSL = @HAVE_LIBSSL@
|
||||||
HAVE_LIBZ = @HAVE_LIBZ@
|
HAVE_LIBZ = @HAVE_LIBZ@
|
||||||
HAVE_SYS_UN_H_FALSE = @HAVE_SYS_UN_H_FALSE@
|
INSTALL = @INSTALL@
|
||||||
HAVE_SYS_UN_H_TRUE = @HAVE_SYS_UN_H_TRUE@
|
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||||
LD = @LD@
|
LD = @LD@
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LIBBCRYPT = @LIBBCRYPT@
|
||||||
|
LIBBCRYPT_PREFIX = @LIBBCRYPT_PREFIX@
|
||||||
|
LIBCRYPT32 = @LIBCRYPT32@
|
||||||
|
LIBCRYPT32_PREFIX = @LIBCRYPT32_PREFIX@
|
||||||
LIBGCRYPT = @LIBGCRYPT@
|
LIBGCRYPT = @LIBGCRYPT@
|
||||||
LIBGCRYPT_FALSE = @LIBGCRYPT_FALSE@
|
|
||||||
LIBGCRYPT_PREFIX = @LIBGCRYPT_PREFIX@
|
LIBGCRYPT_PREFIX = @LIBGCRYPT_PREFIX@
|
||||||
LIBGCRYPT_TRUE = @LIBGCRYPT_TRUE@
|
LIBMBEDCRYPTO = @LIBMBEDCRYPTO@
|
||||||
|
LIBMBEDCRYPTO_PREFIX = @LIBMBEDCRYPTO_PREFIX@
|
||||||
LIBOBJS = @LIBOBJS@
|
LIBOBJS = @LIBOBJS@
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
LIBSREQUIRED = @LIBSREQUIRED@
|
LIBSREQUIRED = @LIBSREQUIRED@
|
||||||
@@ -115,17 +222,21 @@ LIBSSL_PREFIX = @LIBSSL_PREFIX@
|
|||||||
LIBTOOL = @LIBTOOL@
|
LIBTOOL = @LIBTOOL@
|
||||||
LIBZ = @LIBZ@
|
LIBZ = @LIBZ@
|
||||||
LIBZ_PREFIX = @LIBZ_PREFIX@
|
LIBZ_PREFIX = @LIBZ_PREFIX@
|
||||||
|
LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@
|
||||||
LIPO = @LIPO@
|
LIPO = @LIPO@
|
||||||
LN_S = @LN_S@
|
LN_S = @LN_S@
|
||||||
|
LTLIBBCRYPT = @LTLIBBCRYPT@
|
||||||
|
LTLIBCRYPT32 = @LTLIBCRYPT32@
|
||||||
LTLIBGCRYPT = @LTLIBGCRYPT@
|
LTLIBGCRYPT = @LTLIBGCRYPT@
|
||||||
|
LTLIBMBEDCRYPTO = @LTLIBMBEDCRYPTO@
|
||||||
LTLIBOBJS = @LTLIBOBJS@
|
LTLIBOBJS = @LTLIBOBJS@
|
||||||
LTLIBSSL = @LTLIBSSL@
|
LTLIBSSL = @LTLIBSSL@
|
||||||
LTLIBZ = @LTLIBZ@
|
LTLIBZ = @LTLIBZ@
|
||||||
|
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||||
MAINT = @MAINT@
|
MAINT = @MAINT@
|
||||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
|
||||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
|
||||||
MAKEINFO = @MAKEINFO@
|
MAKEINFO = @MAKEINFO@
|
||||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||||
|
MKDIR_P = @MKDIR_P@
|
||||||
NM = @NM@
|
NM = @NM@
|
||||||
NMEDIT = @NMEDIT@
|
NMEDIT = @NMEDIT@
|
||||||
OBJDUMP = @OBJDUMP@
|
OBJDUMP = @OBJDUMP@
|
||||||
@@ -145,15 +256,16 @@ SED = @SED@
|
|||||||
SET_MAKE = @SET_MAKE@
|
SET_MAKE = @SET_MAKE@
|
||||||
SHELL = @SHELL@
|
SHELL = @SHELL@
|
||||||
SSHD = @SSHD@
|
SSHD = @SSHD@
|
||||||
SSHD_FALSE = @SSHD_FALSE@
|
|
||||||
SSHD_TRUE = @SSHD_TRUE@
|
|
||||||
STRIP = @STRIP@
|
STRIP = @STRIP@
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
|
abs_builddir = @abs_builddir@
|
||||||
|
abs_srcdir = @abs_srcdir@
|
||||||
|
abs_top_builddir = @abs_top_builddir@
|
||||||
|
abs_top_srcdir = @abs_top_srcdir@
|
||||||
ac_ct_AR = @ac_ct_AR@
|
ac_ct_AR = @ac_ct_AR@
|
||||||
ac_ct_CC = @ac_ct_CC@
|
ac_ct_CC = @ac_ct_CC@
|
||||||
|
ac_ct_CXX = @ac_ct_CXX@
|
||||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
|
||||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
|
||||||
am__include = @am__include@
|
am__include = @am__include@
|
||||||
am__leading_dot = @am__leading_dot@
|
am__leading_dot = @am__leading_dot@
|
||||||
am__quote = @am__quote@
|
am__quote = @am__quote@
|
||||||
@@ -165,6 +277,7 @@ build_alias = @build_alias@
|
|||||||
build_cpu = @build_cpu@
|
build_cpu = @build_cpu@
|
||||||
build_os = @build_os@
|
build_os = @build_os@
|
||||||
build_vendor = @build_vendor@
|
build_vendor = @build_vendor@
|
||||||
|
builddir = @builddir@
|
||||||
datadir = @datadir@
|
datadir = @datadir@
|
||||||
datarootdir = @datarootdir@
|
datarootdir = @datarootdir@
|
||||||
docdir = @docdir@
|
docdir = @docdir@
|
||||||
@@ -190,18 +303,27 @@ pdfdir = @pdfdir@
|
|||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
psdir = @psdir@
|
psdir = @psdir@
|
||||||
|
runstatedir = @runstatedir@
|
||||||
sbindir = @sbindir@
|
sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
|
srcdir = @srcdir@
|
||||||
sysconfdir = @sysconfdir@
|
sysconfdir = @sysconfdir@
|
||||||
target_alias = @target_alias@
|
target_alias = @target_alias@
|
||||||
EXTRA_DIST = template.3
|
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
|
||||||
|
|
||||||
dist_man_MANS = \
|
dist_man_MANS = \
|
||||||
libssh2_agent_connect.3 \
|
libssh2_agent_connect.3 \
|
||||||
libssh2_agent_disconnect.3 \
|
libssh2_agent_disconnect.3 \
|
||||||
libssh2_agent_free.3 \
|
libssh2_agent_free.3 \
|
||||||
libssh2_agent_get_identity.3 \
|
libssh2_agent_get_identity.3 \
|
||||||
|
libssh2_agent_get_identity_path.3 \
|
||||||
libssh2_agent_init.3 \
|
libssh2_agent_init.3 \
|
||||||
libssh2_agent_list_identities.3 \
|
libssh2_agent_list_identities.3 \
|
||||||
|
libssh2_agent_set_identity_path.3 \
|
||||||
libssh2_agent_userauth.3 \
|
libssh2_agent_userauth.3 \
|
||||||
libssh2_banner_set.3 \
|
libssh2_banner_set.3 \
|
||||||
libssh2_base64_decode.3 \
|
libssh2_base64_decode.3 \
|
||||||
@@ -281,6 +403,7 @@ dist_man_MANS = \
|
|||||||
libssh2_publickey_remove_ex.3 \
|
libssh2_publickey_remove_ex.3 \
|
||||||
libssh2_publickey_shutdown.3 \
|
libssh2_publickey_shutdown.3 \
|
||||||
libssh2_scp_recv.3 \
|
libssh2_scp_recv.3 \
|
||||||
|
libssh2_scp_recv2.3 \
|
||||||
libssh2_scp_send.3 \
|
libssh2_scp_send.3 \
|
||||||
libssh2_scp_send64.3 \
|
libssh2_scp_send64.3 \
|
||||||
libssh2_scp_send_ex.3 \
|
libssh2_scp_send_ex.3 \
|
||||||
@@ -295,11 +418,13 @@ dist_man_MANS = \
|
|||||||
libssh2_session_free.3 \
|
libssh2_session_free.3 \
|
||||||
libssh2_session_get_blocking.3 \
|
libssh2_session_get_blocking.3 \
|
||||||
libssh2_session_get_timeout.3 \
|
libssh2_session_get_timeout.3 \
|
||||||
|
libssh2_session_handshake.3 \
|
||||||
libssh2_session_hostkey.3 \
|
libssh2_session_hostkey.3 \
|
||||||
libssh2_session_init.3 \
|
libssh2_session_init.3 \
|
||||||
libssh2_session_init_ex.3 \
|
libssh2_session_init_ex.3 \
|
||||||
libssh2_session_last_errno.3 \
|
libssh2_session_last_errno.3 \
|
||||||
libssh2_session_last_error.3 \
|
libssh2_session_last_error.3 \
|
||||||
|
libssh2_session_set_last_error.3 \
|
||||||
libssh2_session_method_pref.3 \
|
libssh2_session_method_pref.3 \
|
||||||
libssh2_session_methods.3 \
|
libssh2_session_methods.3 \
|
||||||
libssh2_session_set_blocking.3 \
|
libssh2_session_set_blocking.3 \
|
||||||
@@ -313,6 +438,7 @@ dist_man_MANS = \
|
|||||||
libssh2_sftp_fstat.3 \
|
libssh2_sftp_fstat.3 \
|
||||||
libssh2_sftp_fstat_ex.3 \
|
libssh2_sftp_fstat_ex.3 \
|
||||||
libssh2_sftp_fstatvfs.3 \
|
libssh2_sftp_fstatvfs.3 \
|
||||||
|
libssh2_sftp_fsync.3 \
|
||||||
libssh2_sftp_get_channel.3 \
|
libssh2_sftp_get_channel.3 \
|
||||||
libssh2_sftp_init.3 \
|
libssh2_sftp_init.3 \
|
||||||
libssh2_sftp_last_error.3 \
|
libssh2_sftp_last_error.3 \
|
||||||
@@ -359,6 +485,7 @@ dist_man_MANS = \
|
|||||||
libssh2_userauth_publickey.3 \
|
libssh2_userauth_publickey.3 \
|
||||||
libssh2_userauth_publickey_fromfile.3 \
|
libssh2_userauth_publickey_fromfile.3 \
|
||||||
libssh2_userauth_publickey_fromfile_ex.3 \
|
libssh2_userauth_publickey_fromfile_ex.3 \
|
||||||
|
libssh2_userauth_publickey_frommemory.3 \
|
||||||
libssh2_version.3
|
libssh2_version.3
|
||||||
|
|
||||||
all: all-am
|
all: all-am
|
||||||
@@ -368,22 +495,21 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
|
|||||||
@for dep in $?; do \
|
@for dep in $?; do \
|
||||||
case '$(am__configure_deps)' in \
|
case '$(am__configure_deps)' in \
|
||||||
*$$dep*) \
|
*$$dep*) \
|
||||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||||
&& exit 0; \
|
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||||
exit 1;; \
|
exit 1;; \
|
||||||
esac; \
|
esac; \
|
||||||
done; \
|
done; \
|
||||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/Makefile'; \
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign docs/Makefile'; \
|
||||||
cd $(top_srcdir) && \
|
$(am__cd) $(top_srcdir) && \
|
||||||
$(AUTOMAKE) --foreign docs/Makefile
|
$(AUTOMAKE) --foreign docs/Makefile
|
||||||
.PRECIOUS: Makefile
|
|
||||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
@case '$?' in \
|
@case '$?' in \
|
||||||
*config.status*) \
|
*config.status*) \
|
||||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||||
*) \
|
*) \
|
||||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||||
esac;
|
esac;
|
||||||
|
|
||||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
@@ -393,92 +519,92 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
|||||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
$(am__aclocal_m4_deps):
|
||||||
|
|
||||||
mostlyclean-libtool:
|
mostlyclean-libtool:
|
||||||
-rm -f *.lo
|
-rm -f *.lo
|
||||||
|
|
||||||
clean-libtool:
|
clean-libtool:
|
||||||
-rm -rf .libs _libs
|
-rm -rf .libs _libs
|
||||||
|
install-man3: $(dist_man_MANS)
|
||||||
distclean-libtool:
|
|
||||||
-rm -f libtool
|
|
||||||
uninstall-info-am:
|
|
||||||
install-man3: $(man3_MANS) $(man_MANS)
|
|
||||||
@$(NORMAL_INSTALL)
|
@$(NORMAL_INSTALL)
|
||||||
test -z "$(man3dir)" || $(mkdir_p) "$(DESTDIR)$(man3dir)"
|
@list1=''; \
|
||||||
@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
|
list2='$(dist_man_MANS)'; \
|
||||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
test -n "$(man3dir)" \
|
||||||
for i in $$l2; do \
|
&& test -n "`echo $$list1$$list2`" \
|
||||||
case "$$i" in \
|
|| exit 0; \
|
||||||
*.3*) list="$$list $$i" ;; \
|
echo " $(MKDIR_P) '$(DESTDIR)$(man3dir)'"; \
|
||||||
esac; \
|
$(MKDIR_P) "$(DESTDIR)$(man3dir)" || exit 1; \
|
||||||
|
{ for i in $$list1; do echo "$$i"; done; \
|
||||||
|
if test -n "$$list2"; then \
|
||||||
|
for i in $$list2; do echo "$$i"; done \
|
||||||
|
| sed -n '/\.3[a-z]*$$/p'; \
|
||||||
|
fi; \
|
||||||
|
} | while read p; do \
|
||||||
|
if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
|
||||||
|
echo "$$d$$p"; echo "$$p"; \
|
||||||
|
done | \
|
||||||
|
sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
|
||||||
|
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
|
||||||
|
sed 'N;N;s,\n, ,g' | { \
|
||||||
|
list=; while read file base inst; do \
|
||||||
|
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
|
||||||
|
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
|
||||||
|
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \
|
||||||
|
fi; \
|
||||||
done; \
|
done; \
|
||||||
for i in $$list; do \
|
for i in $$list; do echo "$$i"; done | $(am__base_list) | \
|
||||||
if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
|
while read files; do \
|
||||||
else file=$$i; fi; \
|
test -z "$$files" || { \
|
||||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \
|
||||||
case "$$ext" in \
|
$(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \
|
||||||
3*) ;; \
|
done; }
|
||||||
*) ext='3' ;; \
|
|
||||||
esac; \
|
|
||||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
|
||||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
|
||||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
|
||||||
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
|
|
||||||
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst"; \
|
|
||||||
done
|
|
||||||
uninstall-man3:
|
uninstall-man3:
|
||||||
@$(NORMAL_UNINSTALL)
|
@$(NORMAL_UNINSTALL)
|
||||||
@list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
|
@list=''; test -n "$(man3dir)" || exit 0; \
|
||||||
l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
|
files=`{ for i in $$list; do echo "$$i"; done; \
|
||||||
for i in $$l2; do \
|
l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
|
||||||
case "$$i" in \
|
sed -n '/\.3[a-z]*$$/p'; \
|
||||||
*.3*) list="$$list $$i" ;; \
|
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \
|
||||||
esac; \
|
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
|
||||||
done; \
|
dir='$(DESTDIR)$(man3dir)'; $(am__uninstall_files_from_dir)
|
||||||
for i in $$list; do \
|
tags TAGS:
|
||||||
ext=`echo $$i | sed -e 's/^.*\\.//'`; \
|
|
||||||
case "$$ext" in \
|
|
||||||
3*) ;; \
|
|
||||||
*) ext='3' ;; \
|
|
||||||
esac; \
|
|
||||||
inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
|
|
||||||
inst=`echo $$inst | sed -e 's/^.*\///'`; \
|
|
||||||
inst=`echo $$inst | sed '$(transform)'`.$$ext; \
|
|
||||||
echo " rm -f '$(DESTDIR)$(man3dir)/$$inst'"; \
|
|
||||||
rm -f "$(DESTDIR)$(man3dir)/$$inst"; \
|
|
||||||
done
|
|
||||||
tags: TAGS
|
|
||||||
TAGS:
|
|
||||||
|
|
||||||
ctags: CTAGS
|
ctags CTAGS:
|
||||||
CTAGS:
|
|
||||||
|
|
||||||
|
cscope cscopelist:
|
||||||
|
|
||||||
distdir: $(DISTFILES)
|
distdir: $(BUILT_SOURCES)
|
||||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
|
||||||
list='$(DISTFILES)'; for file in $$list; do \
|
distdir-am: $(DISTFILES)
|
||||||
case $$file in \
|
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
list='$(DISTFILES)'; \
|
||||||
esac; \
|
dist_files=`for file in $$list; do echo $$file; done | \
|
||||||
|
sed -e "s|^$$srcdirstrip/||;t" \
|
||||||
|
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||||
|
case $$dist_files in \
|
||||||
|
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||||
|
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||||
|
sort -u` ;; \
|
||||||
|
esac; \
|
||||||
|
for file in $$dist_files; do \
|
||||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
|
||||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
|
||||||
dir="/$$dir"; \
|
|
||||||
$(mkdir_p) "$(distdir)$$dir"; \
|
|
||||||
else \
|
|
||||||
dir=''; \
|
|
||||||
fi; \
|
|
||||||
if test -d $$d/$$file; then \
|
if test -d $$d/$$file; then \
|
||||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
if test -d "$(distdir)/$$file"; then \
|
||||||
|
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||||
fi; \
|
fi; \
|
||||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||||
|
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||||
|
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||||
|
fi; \
|
||||||
|
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||||
else \
|
else \
|
||||||
test -f $(distdir)/$$file \
|
test -f "$(distdir)/$$file" \
|
||||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||||
|| exit 1; \
|
|| exit 1; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
@@ -487,7 +613,7 @@ check: check-am
|
|||||||
all-am: Makefile $(MANS)
|
all-am: Makefile $(MANS)
|
||||||
installdirs:
|
installdirs:
|
||||||
for dir in "$(DESTDIR)$(man3dir)"; do \
|
for dir in "$(DESTDIR)$(man3dir)"; do \
|
||||||
test -z "$$dir" || $(mkdir_p) "$$dir"; \
|
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||||
done
|
done
|
||||||
install: install-am
|
install: install-am
|
||||||
install-exec: install-exec-am
|
install-exec: install-exec-am
|
||||||
@@ -499,16 +625,22 @@ install-am: all-am
|
|||||||
|
|
||||||
installcheck: installcheck-am
|
installcheck: installcheck-am
|
||||||
install-strip:
|
install-strip:
|
||||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
if test -z '$(STRIP)'; then \
|
||||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
`test -z '$(STRIP)' || \
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
install; \
|
||||||
|
else \
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
|
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||||
|
fi
|
||||||
mostlyclean-generic:
|
mostlyclean-generic:
|
||||||
|
|
||||||
clean-generic:
|
clean-generic:
|
||||||
|
|
||||||
distclean-generic:
|
distclean-generic:
|
||||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||||
|
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||||
|
|
||||||
maintainer-clean-generic:
|
maintainer-clean-generic:
|
||||||
@echo "This command is intended for maintainers to use"
|
@echo "This command is intended for maintainers to use"
|
||||||
@@ -519,7 +651,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
|
|||||||
|
|
||||||
distclean: distclean-am
|
distclean: distclean-am
|
||||||
-rm -f Makefile
|
-rm -f Makefile
|
||||||
distclean-am: clean-am distclean-generic distclean-libtool
|
distclean-am: clean-am distclean-generic
|
||||||
|
|
||||||
dvi: dvi-am
|
dvi: dvi-am
|
||||||
|
|
||||||
@@ -527,18 +659,38 @@ dvi-am:
|
|||||||
|
|
||||||
html: html-am
|
html: html-am
|
||||||
|
|
||||||
|
html-am:
|
||||||
|
|
||||||
info: info-am
|
info: info-am
|
||||||
|
|
||||||
info-am:
|
info-am:
|
||||||
|
|
||||||
install-data-am: install-man
|
install-data-am: install-man
|
||||||
|
|
||||||
|
install-dvi: install-dvi-am
|
||||||
|
|
||||||
|
install-dvi-am:
|
||||||
|
|
||||||
install-exec-am:
|
install-exec-am:
|
||||||
|
|
||||||
|
install-html: install-html-am
|
||||||
|
|
||||||
|
install-html-am:
|
||||||
|
|
||||||
install-info: install-info-am
|
install-info: install-info-am
|
||||||
|
|
||||||
|
install-info-am:
|
||||||
|
|
||||||
install-man: install-man3
|
install-man: install-man3
|
||||||
|
|
||||||
|
install-pdf: install-pdf-am
|
||||||
|
|
||||||
|
install-pdf-am:
|
||||||
|
|
||||||
|
install-ps: install-ps-am
|
||||||
|
|
||||||
|
install-ps-am:
|
||||||
|
|
||||||
installcheck-am:
|
installcheck-am:
|
||||||
|
|
||||||
maintainer-clean: maintainer-clean-am
|
maintainer-clean: maintainer-clean-am
|
||||||
@@ -557,21 +709,28 @@ ps: ps-am
|
|||||||
|
|
||||||
ps-am:
|
ps-am:
|
||||||
|
|
||||||
uninstall-am: uninstall-info-am uninstall-man
|
uninstall-am: uninstall-man
|
||||||
|
|
||||||
uninstall-man: uninstall-man3
|
uninstall-man: uninstall-man3
|
||||||
|
|
||||||
|
.MAKE: install-am install-strip
|
||||||
|
|
||||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||||
distclean distclean-generic distclean-libtool distdir dvi \
|
cscopelist-am ctags-am distclean distclean-generic \
|
||||||
dvi-am html html-am info info-am install install-am \
|
distclean-libtool distdir dvi dvi-am html html-am info info-am \
|
||||||
install-data install-data-am install-exec install-exec-am \
|
install install-am install-data install-data-am install-dvi \
|
||||||
install-info install-info-am install-man install-man3 \
|
install-dvi-am install-exec install-exec-am install-html \
|
||||||
install-strip installcheck installcheck-am installdirs \
|
install-html-am install-info install-info-am install-man \
|
||||||
maintainer-clean maintainer-clean-generic mostlyclean \
|
install-man3 install-pdf install-pdf-am install-ps \
|
||||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
install-ps-am install-strip installcheck installcheck-am \
|
||||||
uninstall uninstall-am uninstall-info-am uninstall-man \
|
installdirs maintainer-clean maintainer-clean-generic \
|
||||||
|
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
|
||||||
|
ps ps-am tags-am uninstall uninstall-am uninstall-man \
|
||||||
uninstall-man3
|
uninstall-man3
|
||||||
|
|
||||||
|
.PRECIOUS: Makefile
|
||||||
|
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
# 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.
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
.NOEXPORT:
|
.NOEXPORT:
|
||||||
|
|||||||
@@ -0,0 +1,100 @@
|
|||||||
|
libssh2 security
|
||||||
|
================
|
||||||
|
|
||||||
|
This document is intended to provide guidance on how security vulnerabilities
|
||||||
|
should be handled in the libssh2 project.
|
||||||
|
|
||||||
|
Publishing Information
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
All known and public libssh2 vulnerabilities will be listed on [the libssh2
|
||||||
|
web site](https://www.libssh2.org/).
|
||||||
|
|
||||||
|
Security vulnerabilities should not be entered in the project's public bug
|
||||||
|
tracker unless the necessary configuration is in place to limit access to the
|
||||||
|
issue to only the reporter and the project's security team.
|
||||||
|
|
||||||
|
Vulnerability Handling
|
||||||
|
----------------------
|
||||||
|
|
||||||
|
The typical process for handling a new security vulnerability is as follows.
|
||||||
|
|
||||||
|
No information should be made public about a vulnerability until it is
|
||||||
|
formally announced at the end of this process. That means, for example that a
|
||||||
|
bug tracker entry must NOT be created to track the issue since that will make
|
||||||
|
the issue public and it should not be discussed on the project's public
|
||||||
|
mailing list. Also messages associated with any commits should not make any
|
||||||
|
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.
|
||||||
|
|
||||||
|
- Messages that do not relate to the reporting or managing of an undisclosed
|
||||||
|
security vulnerability in libssh2 are ignored and no further action is
|
||||||
|
required.
|
||||||
|
|
||||||
|
- A person in the security team sends an e-mail to the original reporter to
|
||||||
|
acknowledge the report.
|
||||||
|
|
||||||
|
- The security team investigates the report and either rejects it or accepts
|
||||||
|
it.
|
||||||
|
|
||||||
|
- If the report is rejected, the team writes to the reporter to explain why.
|
||||||
|
|
||||||
|
- If the report is accepted, the team writes to the reporter to let him/her
|
||||||
|
know it is accepted and that they are working on a fix.
|
||||||
|
|
||||||
|
- The security team discusses the problem, works out a fix, considers the
|
||||||
|
impact of the problem and suggests a release schedule. This discussion
|
||||||
|
should involve the reporter as much as possible.
|
||||||
|
|
||||||
|
- The release of the information should be "as soon as possible" and is most
|
||||||
|
often synced with an upcoming release that contains the fix. If the
|
||||||
|
reporter, or anyone else, thinks the next planned release is too far away
|
||||||
|
then a separate earlier release for security reasons should be considered.
|
||||||
|
|
||||||
|
- Write a security advisory draft about the problem that explains what the
|
||||||
|
problem is, its impact, which versions it affects, solutions or
|
||||||
|
workarounds, when the release is out and make sure to credit all
|
||||||
|
contributors properly.
|
||||||
|
|
||||||
|
- Request a CVE number from
|
||||||
|
[distros@openwall](http://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.
|
||||||
|
|
||||||
|
- Update the "security advisory" with the CVE number.
|
||||||
|
|
||||||
|
- The security team commits the fix in a private branch. The commit message
|
||||||
|
should ideally contain the CVE number. This fix is usually also distributed
|
||||||
|
to the 'distros' mailing list to allow them to use the fix prior to the
|
||||||
|
public announcement.
|
||||||
|
|
||||||
|
- At the day of the next release, the private branch is merged into the master
|
||||||
|
branch and pushed. Once pushed, the information is accessible to the public
|
||||||
|
and the actual release should follow suit immediately afterwards.
|
||||||
|
|
||||||
|
- The project team creates a release that includes the fix.
|
||||||
|
|
||||||
|
- The project team announces the release and the vulnerability to the world in
|
||||||
|
the same manner we always announce releases. It gets sent to the libssh2
|
||||||
|
mailing list and the oss-security mailing list.
|
||||||
|
|
||||||
|
- The security web page on the web site should get the new vulnerability
|
||||||
|
mentioned.
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
|
plans in vanishing in the near future.
|
||||||
|
|
||||||
|
We do not make the list of participants public mostly because it tends to vary
|
||||||
|
somewhat over time and a list somewhere will only risk getting outdated.
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
.\"
|
||||||
|
.\" Copyright (c) 2019 by Will Cosgrove
|
||||||
|
.\"
|
||||||
|
.TH libssh2_agent_get_identity_path 3 "6 Mar 2019" "libssh2 1.9" "libssh2 manual"
|
||||||
|
.SH NAME
|
||||||
|
libssh2_agent_get_identity_path - gets the custom ssh-agent socket path
|
||||||
|
.SH SYNOPSIS
|
||||||
|
#include <libssh2.h>
|
||||||
|
|
||||||
|
const char *
|
||||||
|
libssh2_agent_get_identity_path(LIBSSH2_AGENT *agent);
|
||||||
|
.SH DESCRIPTION
|
||||||
|
Returns the custom agent identity socket path if set using libssh2_agent_set_identity_path()
|
||||||
|
|
||||||
|
.SH RETURN VALUE
|
||||||
|
Returns the socket path on disk.
|
||||||
|
.SH AVAILABILITY
|
||||||
|
Added in libssh2 1.9
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR libssh2_agent_init(3)
|
||||||
|
.BR libssh2_agent_set_identity_path(3)
|
||||||
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
.\"
|
||||||
|
.\" Copyright (c) 2019 by Will Cosgrove
|
||||||
|
.\"
|
||||||
|
.TH libssh2_agent_set_identity_path 3 "6 Mar 2019" "libssh2 1.9" "libssh2 manual"
|
||||||
|
.SH NAME
|
||||||
|
libssh2_agent_set_identity_path - set an ssh-agent socket path on disk
|
||||||
|
.SH SYNOPSIS
|
||||||
|
#include <libssh2.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
libssh2_agent_set_identity_path(LIBSSH2_AGENT *agent, const char *path);
|
||||||
|
.SH DESCRIPTION
|
||||||
|
Allows a custom agent identity socket path instead of the default SSH_AUTH_SOCK env value
|
||||||
|
|
||||||
|
.SH RETURN VALUE
|
||||||
|
Returns void
|
||||||
|
.SH AVAILABILITY
|
||||||
|
Added in libssh2 1.9
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR libssh2_agent_init(3)
|
||||||
|
.BR libssh2_agent_get_identity_path(3)
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
.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 manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libssh2_banner_set - set the SSH prococol banner for the local client
|
libssh2_banner_set - set the SSH protocol banner for the local client
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ The returned buffer is allocated by this function, but it is not clear how to
|
|||||||
free that memory!
|
free that memory!
|
||||||
.SH BUGS
|
.SH BUGS
|
||||||
The memory that *dest points to is allocated by the malloc function libssh2
|
The memory that *dest points to is allocated by the malloc function libssh2
|
||||||
uses, but there's no way for an appliction to free this data in a safe and
|
uses, but there's no way for an application to free this data in a safe and
|
||||||
reliable way!
|
reliable way!
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
0 if successful, \-1 if any error occurred.
|
0 if successful, \-1 if any error occurred.
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ int
|
|||||||
libssh2_channel_get_exit_status(LIBSSH2_CHANNEL* channel)
|
libssh2_channel_get_exit_status(LIBSSH2_CHANNEL* channel)
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fIchannel\fP - Closed channel stream to retreive exit status from.
|
\fIchannel\fP - Closed channel stream to retrieve exit status from.
|
||||||
|
|
||||||
Returns the exit code raised by the process running on the remote host at
|
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
|
the other end of the named channel. Note that the exit status may not be
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ int
|
|||||||
libssh2_channel_wait_eof(LIBSSH2_CHANNEL *channel);
|
libssh2_channel_wait_eof(LIBSSH2_CHANNEL *channel);
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Wait for the remote end to acknowledge an EOF request.
|
Wait for the remote end to send EOF.
|
||||||
|
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
Return 0 on success or negative on failure. It returns
|
Return 0 on success or negative on failure. It returns
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ libssh2_channel_window_write - convenience macro for \fIlibssh2_channel_window_w
|
|||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
|
|
||||||
unsigend long libssh2_channel_window_write(LIBSSH2_CHANNEL *channel);
|
unsigned long libssh2_channel_window_write(LIBSSH2_CHANNEL *channel);
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
This is a macro defined in a public libssh2 header file that is using the
|
This is a macro defined in a public libssh2 header file that is using the
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ libssh2_channel_window_write_ex(LIBSSH2_CHANNEL *channel,
|
|||||||
unsigned long *window_size_initial)
|
unsigned long *window_size_initial)
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
Check the status of the write window Returns the number of bytes which may be
|
Check the status of the write window Returns the number of bytes which may be
|
||||||
safely writen on the channel without blocking. 'window_size_initial' (if
|
safely written on the channel without blocking. 'window_size_initial' (if
|
||||||
passed) will be populated with the size of the initial window as defined by
|
passed) will be populated with the size of the initial window as defined by
|
||||||
the channel_open request
|
the channel_open request
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
Number of bytes which may be safely writen on the channel without blocking.
|
Number of bytes which may be safely written on the channel without blocking.
|
||||||
.SH ERRORS
|
.SH ERRORS
|
||||||
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
|
|||||||
@@ -11,15 +11,16 @@ libssh2_hostkey_hash(LIBSSH2_SESSION *session, int hash_type);
|
|||||||
\fIsession\fP - Session instance as returned by
|
\fIsession\fP - Session instance as returned by
|
||||||
.BR libssh2_session_init_ex(3)
|
.BR libssh2_session_init_ex(3)
|
||||||
|
|
||||||
\fIhash_type\fP - One of: \fBLIBSSH2_HOSTKEY_HASH_MD5\fP or
|
\fIhash_type\fP - One of: \fBLIBSSH2_HOSTKEY_HASH_MD5\fP,
|
||||||
\fBLIBSSH2_HOSTKEY_HASH_SHA1\fP.
|
\fBLIBSSH2_HOSTKEY_HASH_SHA1\fP or \fBLIBSSH2_HOSTKEY_HASH_SHA256\fP.
|
||||||
|
|
||||||
Returns the computed digest of the remote system's hostkey. The length of
|
Returns the computed digest of the remote system's hostkey. The length of
|
||||||
the returned string is hash_type specific (e.g. 16 bytes for MD5,
|
the returned string is hash_type specific (e.g. 16 bytes for MD5,
|
||||||
20 bytes for SHA1).
|
20 bytes for SHA1, 32 bytes for SHA256).
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
Computed hostkey hash value. or NULL if the session has not yet been started
|
Computed hostkey hash value, or NULL if the information is not available
|
||||||
up. (The hash consists of raw binary bytes, not hex digits, so is not
|
(either the session has not yet been started up, or the requested hash
|
||||||
directly printable.)
|
algorithm was not available). The hash consists of raw binary bytes, not hex
|
||||||
|
digits, so it is not directly printable.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR libssh2_session_init_ex(3)
|
.BR libssh2_session_init_ex(3)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ The salt has to be provided base64 encoded with a trailing zero byte.
|
|||||||
argument
|
argument
|
||||||
|
|
||||||
\fItypemask\fP is a bitmask that specifies format and info about the data
|
\fItypemask\fP is a bitmask that specifies format and info about the data
|
||||||
passed to this function. Specificly, it details what format the host name is,
|
passed to this function. Specifically, it details what format the host name is,
|
||||||
what format the key is and what key type it is.
|
what format the key is and what key type it is.
|
||||||
|
|
||||||
The host name is given as one of the following types:
|
The host name is given as one of the following types:
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ argument
|
|||||||
\fIcommentlen\fP is the total size in bytes of the comment pointed to by the \fIcomment\fP argument
|
\fIcommentlen\fP is the total size in bytes of the comment pointed to by the \fIcomment\fP argument
|
||||||
|
|
||||||
\fItypemask\fP is a bitmask that specifies format and info about the data
|
\fItypemask\fP is a bitmask that specifies format and info about the data
|
||||||
passed to this function. Specificly, it details what format the host name is,
|
passed to this function. Specifically, it details what format the host name is,
|
||||||
what format the key is and what key type it is.
|
what format the key is and what key type it is.
|
||||||
|
|
||||||
The host name is given as one of the following types:
|
The host name is given as one of the following types:
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ IP numerical address of the host or the full name.
|
|||||||
argument
|
argument
|
||||||
|
|
||||||
\fItypemask\fP is a bitmask that specifies format and info about the data
|
\fItypemask\fP is a bitmask that specifies format and info about the data
|
||||||
passed to this function. Specificly, it details what format the host name is,
|
passed to this function. Specifically, it details what format the host name is,
|
||||||
what format the key is and what key type it is.
|
what format the key is and what key type it is.
|
||||||
|
|
||||||
The host name is given as one of the following types:
|
The host name is given as one of the following types:
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ addition to the plain host name only check.
|
|||||||
argument
|
argument
|
||||||
|
|
||||||
\fItypemask\fP is a bitmask that specifies format and info about the data
|
\fItypemask\fP is a bitmask that specifies format and info about the data
|
||||||
passed to this function. Specificly, it details what format the host name is,
|
passed to this function. Specifically, it details what format the host name is,
|
||||||
what format the key is and what key type it is.
|
what format the key is and what key type it is.
|
||||||
|
|
||||||
The host name is given as one of the following types:
|
The host name is given as one of the following types:
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ int libssh2_poll(LIBSSH2_POLLFD *fds, unsigned int nfds, long timeout);
|
|||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
This function is deprecated. Do note use. We encourage users to instead use
|
This function is deprecated. Do note use. We encourage users to instead use
|
||||||
the \fIpoll(3)\fP or \fIselect(3)\fP functions to check for socket activity or
|
the \fIpoll(3)\fP or \fIselect(3)\fP functions to check for socket activity or
|
||||||
when specific sockets are ready to get recevied from or send to.
|
when specific sockets are ready to get received from or send to.
|
||||||
|
|
||||||
Poll for activity on a socket, channel, listener, or any combination of these
|
Poll for activity on a socket, channel, listener, or any combination of these
|
||||||
three types. The calling semantics for this function generally match
|
three types. The calling semantics for this function generally match
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ LIBSSH2_CHANNEL *
|
|||||||
libssh2_scp_recv(LIBSSH2_SESSION *session, const char *path, struct stat *sb);
|
libssh2_scp_recv(LIBSSH2_SESSION *session, const char *path, struct stat *sb);
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
|
This function is \fBDEPRECATED\fP. Use \fIlibssh2_scp_recv2(3)\fP
|
||||||
|
instead!
|
||||||
|
|
||||||
\fIsession\fP - Session instance as returned by
|
\fIsession\fP - Session instance as returned by
|
||||||
.BR libssh2_session_init_ex(3)
|
.BR libssh2_session_init_ex(3)
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
.TH libssh2_scp_recv2 3 "29 Jun 2015" "libssh2 1.6.1" "libssh2 manual"
|
||||||
|
.SH NAME
|
||||||
|
libssh2_scp_recv2 - request a remote file via SCP
|
||||||
|
.SH SYNOPSIS
|
||||||
|
#include <libssh2.h>
|
||||||
|
|
||||||
|
LIBSSH2_CHANNEL *
|
||||||
|
libssh2_scp_recv2(LIBSSH2_SESSION *session, const char *path, struct_stat *sb);
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\fIsession\fP - Session instance as returned by
|
||||||
|
.BR libssh2_session_init_ex(3)
|
||||||
|
|
||||||
|
\fIpath\fP - Full path and filename of file to transfer. That is the remote
|
||||||
|
file name.
|
||||||
|
|
||||||
|
\fIsb\fP - Populated with remote file's size, mode, mtime, and atime
|
||||||
|
|
||||||
|
Request a file from the remote host via SCP.
|
||||||
|
.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_SCP_PROTOCOL\fP -
|
||||||
|
|
||||||
|
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would
|
||||||
|
block.
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR libssh2_session_init_ex(3)
|
||||||
|
.BR libssh2_channel_open_ex(3)
|
||||||
|
|
||||||
@@ -17,7 +17,7 @@ de-referenced pointer, the internal storage of the session instance may be
|
|||||||
modified in place.
|
modified in place.
|
||||||
|
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
A pointer to session internal storage whos contents point to previously
|
A pointer to session internal storage who's contents point to previously
|
||||||
provided abstract data.
|
provided abstract data.
|
||||||
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.TH libssh2_session_banner_set 3 "9 Sep 2011" "libssh2 1.4.0" "libssh2 manual"
|
.TH libssh2_session_banner_set 3 "9 Sep 2011" "libssh2 1.4.0" "libssh2 manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libssh2_session_banner_set - set the SSH prococol banner for the local client
|
libssh2_session_banner_set - set the SSH protocol banner for the local client
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
|
|
||||||
|
|||||||
@@ -32,11 +32,43 @@ function returns 0, the packet will be accepted nonetheless.
|
|||||||
.IP LIBSSH2_CALLBACK_X11
|
.IP LIBSSH2_CALLBACK_X11
|
||||||
Called when an X11 connection has been accepted
|
Called when an X11 connection has been accepted
|
||||||
.IP LIBSSH2_CALLBACK_SEND
|
.IP LIBSSH2_CALLBACK_SEND
|
||||||
Called when libssh2 wants to send some data on the connection.
|
Called when libssh2 wants to send data on the connection. Can be set to a
|
||||||
Can be set to a custom function to handle I/O your own way.
|
custom function to handle I/O your own way.
|
||||||
|
|
||||||
|
The prototype of the callback:
|
||||||
|
|
||||||
|
.nf
|
||||||
|
ssize_t sendcb(libssh2_socket_t sockfd, const void *buffer,
|
||||||
|
size_t length, int flags, void **abstract);
|
||||||
|
.fi
|
||||||
|
|
||||||
|
\fBsockfd\fP is the socket to write to, \fBbuffer\fP points to the data to
|
||||||
|
send, \fBlength\fP is the size of the data, \fBflags\fP is the flags that
|
||||||
|
would've been used to a \fIsend()\fP call and \fBabstract\fP is a pointer to
|
||||||
|
the abstract pointer set in the \fIlibssh2_session_init_ex(3)\fP call.
|
||||||
|
|
||||||
|
The callback returns the number of bytes sent, or -1 for error. The special
|
||||||
|
return code \fB-EAGAIN\fP can be returned to signal that the send was aborted
|
||||||
|
to prevent getting blocked and it needs to be called again.
|
||||||
.IP LIBSSH2_CALLBACK_RECV
|
.IP LIBSSH2_CALLBACK_RECV
|
||||||
Called when libssh2 wants to receive some data from the connection.
|
Called when libssh2 wants to read data from the connection. Can be set to a
|
||||||
Can be set to a custom function to handle I/O your own way.
|
custom function to handle I/O your own way.
|
||||||
|
|
||||||
|
The prototype of the callback:
|
||||||
|
|
||||||
|
.nf
|
||||||
|
ssize_t recvcb(libssh2_socket_t sockfd, void *buffer,
|
||||||
|
size_t length, int flags, void **abstract);
|
||||||
|
.fi
|
||||||
|
|
||||||
|
\fBsockfd\fP is the socket to read from, \fBbuffer\fP where to store received
|
||||||
|
data into, \fBlength\fP is the size of the buffer, \fBflags\fP is the flags
|
||||||
|
that would've been used to a \fIrecv()\fP call and \fBabstract\fP is a pointer
|
||||||
|
to the abstract pointer set in the \fIlibssh2_session_init_ex(3)\fP call.
|
||||||
|
|
||||||
|
The callback returns the number of bytes read, or -1 for error. The special
|
||||||
|
return code \fB-EAGAIN\fP can be returned to signal that the read was aborted
|
||||||
|
to prevent getting blocked and it needs to be called again.
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
Pointer to previous callback handler. Returns NULL if no prior callback
|
Pointer to previous callback handler. Returns NULL if no prior callback
|
||||||
handler was set or the callback type was unknown.
|
handler was set or the callback type was unknown.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ libssh2_session_disconnect(LIBSSH2_SESSION *session, const char *description);
|
|||||||
|
|
||||||
\fIdescription\fP - Human readable reason for disconnection.
|
\fIdescription\fP - Human readable reason for disconnection.
|
||||||
|
|
||||||
\fIlang\fP - Localization string describing the langauge/encoding of the description provided.
|
\fIlang\fP - Localization string describing the language/encoding of the description provided.
|
||||||
|
|
||||||
Send a disconnect message to the remote host associated with \fIsession\fP,
|
Send a disconnect message to the remote host associated with \fIsession\fP,
|
||||||
along with a \fIreason\fP symbol and a verbose \fIdescription\fP.
|
along with a \fIreason\fP symbol and a verbose \fIdescription\fP.
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
.TH libssh2_session_handshake 3 "7 Oct 2010" "libssh2 1.2.8" "libssh2 manual"
|
||||||
|
.SH NAME
|
||||||
|
libssh2_session_handshake - perform the SSH handshake
|
||||||
|
.SH SYNOPSIS
|
||||||
|
#include <libssh2.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
libssh2_session_handshake(LIBSSH2_SESSION *session, libssh2_socket_t socket);
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\fIsession\fP - Session instance as returned by
|
||||||
|
.BR libssh2_session_init_ex(3)
|
||||||
|
|
||||||
|
\fIsocket\fP - Connected socket descriptor. Typically a TCP connection
|
||||||
|
though the protocol allows for any reliable transport and the library will
|
||||||
|
attempt to use any berkeley socket.
|
||||||
|
|
||||||
|
Begin transport layer protocol negotiation with the connected host.
|
||||||
|
.SH RETURN VALUE
|
||||||
|
Returns 0 on success, negative on failure.
|
||||||
|
.SH ERRORS
|
||||||
|
\fILIBSSH2_ERROR_SOCKET_NONE\fP - The socket is invalid.
|
||||||
|
|
||||||
|
\fILIBSSH2_ERROR_BANNER_SEND\fP - Unable to send banner to remote host.
|
||||||
|
|
||||||
|
\fILIBSSH2_ERROR_KEX_FAILURE\fP - >Encryption key exchange with the remote
|
||||||
|
host failed.
|
||||||
|
|
||||||
|
\fILIBSSH2_ERROR_SOCKET_SEND\fP - Unable to send data on socket.
|
||||||
|
|
||||||
|
\fILIBSSH2_ERROR_SOCKET_DISCONNECT\fP - The socket was disconnected.
|
||||||
|
|
||||||
|
\fILIBSSH2_ERROR_PROTO\fP - An invalid SSH protocol response was received on
|
||||||
|
the socket.
|
||||||
|
|
||||||
|
\fILIBSSH2_ERROR_EAGAIN\fP - Marked for non-blocking I/O but the call would block.
|
||||||
|
.SH AVAILABILITY
|
||||||
|
Added in 1.2.8
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR libssh2_session_free(3)
|
||||||
|
.BR libssh2_session_init_ex(3)
|
||||||
@@ -18,3 +18,4 @@ Numeric error code corresponding to the the Error Code constants.
|
|||||||
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR libssh2_session_last_error(3)
|
.BR libssh2_session_last_error(3)
|
||||||
|
.BR libssh2_session_set_last_error(3)
|
||||||
|
|||||||
@@ -29,3 +29,4 @@ Numeric error code corresponding to the the Error Code constants.
|
|||||||
|
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR libssh2_session_last_errno(3)
|
.BR libssh2_session_last_errno(3)
|
||||||
|
.BR libssh2_session_set_last_error(3)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ If a method is listed which is not supported by libssh2 it will be
|
|||||||
ignored and not sent to the remote host during protocol negotiation.
|
ignored and not sent to the remote host during protocol negotiation.
|
||||||
|
|
||||||
Set preferred methods to be negotiated. These
|
Set preferred methods to be negotiated. These
|
||||||
preferrences must be set prior to calling
|
preferences must be set prior to calling
|
||||||
.BR libssh2_session_handshake(3)
|
.BR libssh2_session_handshake(3)
|
||||||
as they are used during the protocol initiation phase.
|
as they are used during the protocol initiation phase.
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
.TH libssh2_session_set_last_error 3 "26 Oct 2015" "libssh2 1.6.1" "libssh2 manual"
|
||||||
|
.SH NAME
|
||||||
|
libssh2_session_set_last_error - sets the internal error state
|
||||||
|
.SH SYNOPSIS
|
||||||
|
#include <libssh2.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
libssh2_session_set_last_error(LIBSSH2_SESSION *session, int errcode, const char *errmsg)
|
||||||
|
|
||||||
|
.SH DESCRIPTION
|
||||||
|
\fIsession\fP - Session instance as returned by
|
||||||
|
.BR libssh2_session_init_ex(3)
|
||||||
|
|
||||||
|
\fIerrcode\fP - One of the error codes as defined in the public
|
||||||
|
libssh2 header file.
|
||||||
|
|
||||||
|
\fIerrmsg\fP - If not NULL, a copy of the given string is stored
|
||||||
|
inside the session object as the error message.
|
||||||
|
|
||||||
|
This function is provided for high level language wrappers
|
||||||
|
(i.e. Python or Perl) and other libraries that may extend libssh2 with
|
||||||
|
additional features while still relying on its error reporting
|
||||||
|
mechanism.
|
||||||
|
|
||||||
|
.SH RETURN VALUE
|
||||||
|
Numeric error code corresponding to the the Error Code constants.
|
||||||
|
|
||||||
|
.SH AVAILABILITY
|
||||||
|
Added in 1.6.1
|
||||||
|
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR libssh2_session_last_error(3)
|
||||||
|
.BR libssh2_session_last_errno(3)
|
||||||
@@ -10,9 +10,9 @@ int libssh2_session_supported_algs(LIBSSH2_SESSION* session,
|
|||||||
const char*** algs);
|
const char*** algs);
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fIsession\fP - An instance of initialized LIBSSH2_SESSION (the function will
|
\fIsession\fP - An instance of initialized LIBSSH2_SESSION (the function will
|
||||||
use its pointer to the memory allocation function). \fImethod_type\fP - Method
|
use its pointer to the memory allocation function). \fImethod_type\fP -
|
||||||
type. See .BR \fIlibssh2_session_method_pref(3)\fP. \fIalgs\fP - Address of a
|
Method type. See \fIlibssh2_session_method_pref(3)\fP. \fIalgs\fP - Address
|
||||||
pointer that will point to an array af returned algorithms
|
of a pointer that will point to an array of returned algorithms
|
||||||
|
|
||||||
Get a list of supported algorithms for the given \fImethod_type\fP. The
|
Get a list of supported algorithms for the given \fImethod_type\fP. The
|
||||||
method_type parameter is equivalent to method_type in
|
method_type parameter is equivalent to method_type in
|
||||||
@@ -36,7 +36,7 @@ const char **algorithms;
|
|||||||
int rc, i;
|
int rc, i;
|
||||||
LIBSSH2_SESSION *session;
|
LIBSSH2_SESSION *session;
|
||||||
|
|
||||||
/* initilize session */
|
/* initialize session */
|
||||||
session = libssh2_session_init();
|
session = libssh2_session_init();
|
||||||
rc = libssh2_session_supported_algs(session,
|
rc = libssh2_session_supported_algs(session,
|
||||||
LIBSSH2_METHOD_CRYPT_CS,
|
LIBSSH2_METHOD_CRYPT_CS,
|
||||||
@@ -44,9 +44,9 @@ rc = libssh2_session_supported_algs(session,
|
|||||||
if (rc>0) {
|
if (rc>0) {
|
||||||
/* the call succeeded, do sth. with the list of algorithms
|
/* the call succeeded, do sth. with the list of algorithms
|
||||||
(e.g. list them)... */
|
(e.g. list them)... */
|
||||||
printf("Supported symmetric algorithms:\n");
|
printf("Supported symmetric algorithms:\\n");
|
||||||
for ( i=0; i<rc; i++ )
|
for ( i=0; i<rc; i++ )
|
||||||
printf("\t%s\n", algorithms[i]);
|
printf("\\t%s\\n", algorithms[i]);
|
||||||
|
|
||||||
/* ... and free the allocated memory when not needed anymore */
|
/* ... and free the allocated memory when not needed anymore */
|
||||||
libssh2_free(session, algorithms);
|
libssh2_free(session, algorithms);
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ or \fBlibssh2_sftp_opendir(3)\fP (which is a macro).
|
|||||||
|
|
||||||
Close an active LIBSSH2_SFTP_HANDLE. Because files and directories share the
|
Close an active LIBSSH2_SFTP_HANDLE. Because files and directories share the
|
||||||
same underlying storage mechanism these methods may be used
|
same underlying storage mechanism these methods may be used
|
||||||
interchangably. \fBlibssh2_sftp_close(3)\fP and \fBlibssh2_sftp_closedir(3)\fP
|
interchangeably. \fBlibssh2_sftp_close(3)\fP and \fBlibssh2_sftp_closedir(3)\fP
|
||||||
are macros for \fBlibssh2_sftp_close_handle(3)\fP.
|
are macros for \fBlibssh2_sftp_close_handle(3)\fP.
|
||||||
|
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ int
|
|||||||
libssh2_sftp_fstat_ex(LIBSSH2_SFTP_HANDLE *handle,
|
libssh2_sftp_fstat_ex(LIBSSH2_SFTP_HANDLE *handle,
|
||||||
LIBSSH2_SFTP_ATTRIBUTES *attrs, int setstat)
|
LIBSSH2_SFTP_ATTRIBUTES *attrs, int setstat)
|
||||||
|
|
||||||
#define libbssh2_sftp_fstat(handle, attrs) \\
|
#define libssh2_sftp_fstat(handle, attrs) \\
|
||||||
libssh2_sftp_fstat_ex((handle), (attrs), 0)
|
libssh2_sftp_fstat_ex((handle), (attrs), 0)
|
||||||
#define libssh2_sftp_fsetstat(handle, attrs) \\
|
#define libssh2_sftp_fsetstat(handle, attrs) \\
|
||||||
libssh2_sftp_fstat_ex((handle), (attrs), 1)
|
libssh2_sftp_fstat_ex((handle), (attrs), 1)
|
||||||
@@ -60,7 +60,7 @@ most common ones are:
|
|||||||
|
|
||||||
To check for specific user permissions, the set of defines are in the
|
To check for specific user permissions, the set of defines are in the
|
||||||
pattern LIBSSH2_SFTP_S_I<action><who> where <action> is R, W or X for
|
pattern LIBSSH2_SFTP_S_I<action><who> where <action> is R, W or X for
|
||||||
read, write and excutable and <who> is USR, GRP and OTH for user,
|
read, write and executable and <who> is USR, GRP and OTH for user,
|
||||||
group and other. So, you check for a user readable file, use the bit
|
group and other. So, you check for a user readable file, use the bit
|
||||||
\fILIBSSH2_SFTP_S_IRUSR\fP while you want to see if it is executable
|
\fILIBSSH2_SFTP_S_IRUSR\fP while you want to see if it is executable
|
||||||
for other, you use \fILIBSSH2_SFTP_S_IXOTH\fP and so on.
|
for other, you use \fILIBSSH2_SFTP_S_IXOTH\fP and so on.
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
.TH libssh2_sftp_fsync 3 "8 Apr 2013" "libssh2 1.4.4" "libssh2 manual"
|
||||||
|
.SH NAME
|
||||||
|
libssh2_sftp_fsync - synchronize file to disk
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.nf
|
||||||
|
#include <libssh2.h>
|
||||||
|
#include <libssh2_sftp.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
libssh2_sftp_fsync(LIBSSH2_SFTP_HANDLE *handle)
|
||||||
|
.fi
|
||||||
|
.SH DESCRIPTION
|
||||||
|
This function causes the remote server to synchronize the file
|
||||||
|
data and metadata to disk (like fsync(2)).
|
||||||
|
|
||||||
|
For this to work requires fsync@openssh.com support on the server.
|
||||||
|
|
||||||
|
\fIhandle\fP - SFTP File Handle as returned by
|
||||||
|
.BR libssh2_sftp_open_ex(3)
|
||||||
|
|
||||||
|
.SH RETURN VALUE
|
||||||
|
Returns 0 on success or negative on failure. If used in non-blocking mode, 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.
|
||||||
|
.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_SFTP_PROTOCOL\fP - An invalid SFTP protocol response
|
||||||
|
was received on the socket, or an SFTP operation caused an errorcode
|
||||||
|
to be returned by the server. In particular, this can be returned if
|
||||||
|
the SSH server does not support the fsync operation: the SFTP subcode
|
||||||
|
\fILIBSSH2_FX_OP_UNSUPPORTED\fP will be returned in this case.
|
||||||
|
|
||||||
|
.SH AVAILABILITY
|
||||||
|
Added in libssh2 1.4.4 and OpenSSH 6.3.
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR fsync(2)
|
||||||
@@ -1,21 +1,21 @@
|
|||||||
.TH libssh2_sftp_get_channel 3 "9 Sep 2011" "libssh2 1.4.0" "libssh2 manual"
|
.TH libssh2_sftp_get_channel 3 "9 Sep 2011" "libssh2 1.4.0" "libssh2 manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libssh2_sftp_get_channel - return the channel of sftp
|
libssh2_sftp_get_channel - return the channel of sftp
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
#include <libssh2_sftp.h>
|
#include <libssh2_sftp.h>
|
||||||
|
|
||||||
.fi
|
.fi
|
||||||
LIBSSH2_CHANNEL *libssh2_sftp_get_channel(LIBSSH2_SFTP *sftp);
|
LIBSSH2_CHANNEL *libssh2_sftp_get_channel(LIBSSH2_SFTP *sftp);
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fIsftp\fP - SFTP instance as returned by
|
\fIsftp\fP - SFTP instance as returned by
|
||||||
.BR libssh2_sftp_init(3)
|
.BR libssh2_sftp_init(3)
|
||||||
|
|
||||||
Return the channel of the given sftp handle.
|
Return the channel of the given sftp handle.
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
The channel of the SFTP instance or NULL if something was wrong.
|
The channel of the SFTP instance or NULL if something was wrong.
|
||||||
.SH AVAILABILITY
|
.SH AVAILABILITY
|
||||||
Added in 1.4.0
|
Added in 1.4.0
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
.BR libssh2_sftp_init(3)
|
.BR libssh2_sftp_init(3)
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ libssh2_sftp_mkdir(LIBSSH2_SFTP *sftp, const char *path, long mode);
|
|||||||
.BR libssh2_sftp_init(3)
|
.BR libssh2_sftp_init(3)
|
||||||
|
|
||||||
\fIpath\fP - full path of the new directory to create. Note that the new
|
\fIpath\fP - full path of the new directory to create. Note that the new
|
||||||
directory's parents must all exist priot to making this call.
|
directory's parents must all exist prior to making this call.
|
||||||
|
|
||||||
\fIpath_len\fP - length of the full path of the new directory to create.
|
\fIpath_len\fP - length of the full path of the new directory to create.
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ filesystem entry
|
|||||||
Bitmask flags made up of LIBSSH2_SFTP_RENAME_* constants.
|
Bitmask flags made up of LIBSSH2_SFTP_RENAME_* constants.
|
||||||
|
|
||||||
Rename a filesystem object on the remote filesystem. The semantics of
|
Rename a filesystem object on the remote filesystem. The semantics of
|
||||||
this command typically include the ability to move a filsystem object
|
this command typically include the ability to move a filesystem object
|
||||||
between folders and/or filesystem mounts. If the LIBSSH2_SFTP_RENAME_OVERWRITE
|
between folders and/or filesystem mounts. If the LIBSSH2_SFTP_RENAME_OVERWRITE
|
||||||
flag is not set and the destfile entry already exists, the operation
|
flag is not set and the destfile entry already exists, the operation
|
||||||
will fail. Use of the other two flags indicate a preference (but not a
|
will fail. Use of the other two flags indicate a preference (but not a
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ libssh2_sftp_rewind - convenience macro for \fIlibssh2_sftp_seek64(3)\fP calls
|
|||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
|
|
||||||
int libssh2_sftp_rewind(LINBSSH2_SFTP_HANDLE *handle);
|
int libssh2_sftp_rewind(LIBSSH2_SFTP_HANDLE *handle);
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
This is a macro defined in a public libssh2 header file that is using the
|
This is a macro defined in a public libssh2 header file that is using the
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ libssh2_sftp_stat - convenience macro for \fIlibssh2_sftp_fstat_ex(3)\fP calls
|
|||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
#include <libssh2.h>
|
#include <libssh2.h>
|
||||||
|
|
||||||
int libssh2_sftp_stat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_STFP_ATTRIBUTES *attrs);
|
int libssh2_sftp_stat(LIBSSH2_SFTP *sftp, const char *path, LIBSSH2_SFTP_ATTRIBUTES *attrs);
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
This is a macro defined in a public libssh2 header file that is using the
|
This is a macro defined in a public libssh2 header file that is using the
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ These are convenience macros:
|
|||||||
.BR libssh2_sftp_realpath(3)
|
.BR libssh2_sftp_realpath(3)
|
||||||
: Resolve a complex, relative, or symlinked filepath to its effective target.
|
: Resolve a complex, relative, or symlinked filepath to its effective target.
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
When using LIBSSH2_SFTP_SYMLINK, this funtion returns 0 on success or negative
|
When using LIBSSH2_SFTP_SYMLINK, this function returns 0 on success or negative
|
||||||
on failure.
|
on failure.
|
||||||
|
|
||||||
When using LIBSSH2_SFTP_READLINK or LIBSSH2_SFTP_REALPATH, it returns the
|
When using LIBSSH2_SFTP_READLINK or LIBSSH2_SFTP_REALPATH, it returns the
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ distinguished from a failing case by examining
|
|||||||
\fIlibssh2_userauth_authenticated(3)\fP.
|
\fIlibssh2_userauth_authenticated(3)\fP.
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
On success a comma delimited list of supported authentication schemes. This
|
On success a comma delimited list of supported authentication schemes. This
|
||||||
list is internally managed by libssh2. On failure ruturns NULL.
|
list is internally managed by libssh2. On failure returns NULL.
|
||||||
.SH ERRORS
|
.SH ERRORS
|
||||||
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
|
\fILIBSSH2_ERROR_ALLOC\fP - An internal memory allocation call failed.
|
||||||
|
|
||||||
|
|||||||
@@ -7,24 +7,28 @@ libssh2_userauth_publickey_fromfile - authenticate a session with a public key,
|
|||||||
.nf
|
.nf
|
||||||
int libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session,
|
int libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session,
|
||||||
const char *username,
|
const char *username,
|
||||||
|
unsigned int ousername_len,
|
||||||
const char *publickey,
|
const char *publickey,
|
||||||
const char *privatekey,
|
const char *privatekey,
|
||||||
const char *passphrase);
|
const char *passphrase);
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fIsession\fP - Session instance as returned by
|
\fIsession\fP - Session instance as returned by
|
||||||
.BR libssh2_session_init_ex(3)
|
\fBlibssh2_session_init_ex(3)\fP
|
||||||
|
|
||||||
\fIusername\fP - Remote user name to authenticate as.
|
\fIusername\fP - Pointer to user name to authenticate as.
|
||||||
|
|
||||||
\fIusername_len\fP - Length of username.
|
\fIusername_len\fP - Length of \fIusername\fP.
|
||||||
|
|
||||||
\fIpublickey\fP - Path and name of public key file. (e.g. /etc/ssh/hostkey.pub)
|
\fIpublickey\fP - Path name of the public key file.
|
||||||
|
(e.g. /etc/ssh/hostkey.pub). If libssh2 is built against OpenSSL, this option
|
||||||
|
can be set to NULL.
|
||||||
|
|
||||||
\fIprivatekey\fP - Path and name of private key file. (e.g. /etc/ssh/hostkey)
|
\fIprivatekey\fP - Path name of the private key file. (e.g. /etc/ssh/hostkey)
|
||||||
|
|
||||||
\fIpassphrase\fP - Passphrase to use when decoding private key file.
|
\fIpassphrase\fP - Passphrase to use when decoding \fIprivatekey\fP.
|
||||||
|
|
||||||
Attempt public key authentication using a PEM encoded private key file stored on disk
|
Attempt public key authentication using a PEM encoded private key file stored
|
||||||
|
on disk
|
||||||
|
|
||||||
.SH RETURN VALUE
|
.SH RETURN VALUE
|
||||||
Return 0 on success or negative on failure. It returns
|
Return 0 on success or negative on failure. It returns
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
.TH libssh2_userauth_publickey_frommemory 3 "1 Sep 2014" "libssh2 1.5" "libssh2 manual"
|
||||||
|
.SH NAME
|
||||||
|
libssh2_userauth_publickey_frommemory - authenticate a session with a public key, read from memory
|
||||||
|
.SH SYNOPSIS
|
||||||
|
#include <libssh2.h>
|
||||||
|
|
||||||
|
.nf
|
||||||
|
int libssh2_userauth_publickey_frommemory(LIBSSH2_SESSION *session,
|
||||||
|
const char *username,
|
||||||
|
size_t username_len,
|
||||||
|
const char *publickeydata,
|
||||||
|
size_t publickeydata_len,
|
||||||
|
const char *privatekeydata,
|
||||||
|
size_t privatekeydata_len,
|
||||||
|
const char *passphrase);
|
||||||
|
.SH DESCRIPTION
|
||||||
|
This function allows to authenticate a session with a public key read from memory.
|
||||||
|
It's only supported when libssh2 is backed by OpenSSL.
|
||||||
|
\fIsession\fP - Session instance as returned by
|
||||||
|
.BR libssh2_session_init_ex(3)
|
||||||
|
|
||||||
|
\fIusername\fP - Remote user name to authenticate as.
|
||||||
|
|
||||||
|
\fIusername_len\fP - Length of username.
|
||||||
|
|
||||||
|
\fIpublickeydata\fP - Buffer containing the contents of a public key file.
|
||||||
|
|
||||||
|
\fIpublickeydata_len\fP - Length of public key data.
|
||||||
|
|
||||||
|
\fIprivatekeydata\fP - Buffer containing the contents of a private key file.
|
||||||
|
|
||||||
|
\fIprivatekeydata_len\fP - Length of private key data.
|
||||||
|
|
||||||
|
\fIpassphrase\fP - Passphrase to use when decoding private key file.
|
||||||
|
|
||||||
|
Attempt public key authentication using a PEM encoded private key file stored in memory.
|
||||||
|
.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.
|
||||||
|
.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_SOCKET_TIMEOUT\fP -
|
||||||
|
|
||||||
|
\fILIBSSH2_ERROR_PUBLICKEY_UNVERIFIED\fP - The username/public key
|
||||||
|
combination was invalid.
|
||||||
|
|
||||||
|
\fILIBSSH2_ERROR_AUTHENTICATION_FAILED\fP - Authentication using the supplied
|
||||||
|
public key was not accepted.
|
||||||
|
.SH AVAILABILITY
|
||||||
|
libssh2_userauth_publickey_frommemory was added in libssh2 1.6.0
|
||||||
|
.SH SEE ALSO
|
||||||
|
.BR libssh2_session_init_ex(3)
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
# Copyright (c) 2014, 2015 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.
|
||||||
|
|
||||||
|
include(CheckIncludeFiles)
|
||||||
|
include(CheckSymbolExists)
|
||||||
|
include(CopyRuntimeDependencies)
|
||||||
|
include(SocketLibraries)
|
||||||
|
|
||||||
|
set(EXAMPLES
|
||||||
|
direct_tcpip
|
||||||
|
ssh2
|
||||||
|
scp
|
||||||
|
scp_nonblock
|
||||||
|
scp_write
|
||||||
|
scp_write_nonblock
|
||||||
|
sftp
|
||||||
|
sftp_nonblock
|
||||||
|
sftp_write
|
||||||
|
sftp_write_nonblock
|
||||||
|
sftp_mkdir
|
||||||
|
sftp_mkdir_nonblock
|
||||||
|
sftp_RW_nonblock
|
||||||
|
sftp_write_sliding
|
||||||
|
sftpdir
|
||||||
|
sftpdir_nonblock
|
||||||
|
ssh2_exec
|
||||||
|
ssh2_agent
|
||||||
|
ssh2_agent_forwarding
|
||||||
|
ssh2_echo
|
||||||
|
sftp_append
|
||||||
|
subsystem_netconf
|
||||||
|
tcpip-forward)
|
||||||
|
|
||||||
|
append_needed_socket_libraries(LIBRARIES)
|
||||||
|
|
||||||
|
foreach(example ${EXAMPLES})
|
||||||
|
add_executable(example-${example} ${example}.c)
|
||||||
|
list(APPEND EXAMPLE_TARGETS example-${example})
|
||||||
|
# to find generated header
|
||||||
|
target_include_directories(example-${example} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
target_link_libraries(example-${example} libssh2 ${LIBRARIES})
|
||||||
|
endforeach()
|
||||||
|
add_target_to_copy_dependencies(
|
||||||
|
TARGET copy_example_dependencies
|
||||||
|
DEPENDENCIES ${RUNTIME_DEPENDENCIES}
|
||||||
|
BEFORE_TARGETS ${EXAMPLE_TARGETS})
|
||||||
|
|
||||||
|
## Platform checks
|
||||||
|
check_include_files(inttypes.h HAVE_INTTYPES_H)
|
||||||
|
check_include_files(unistd.h HAVE_UNISTD_H)
|
||||||
|
check_include_files(stdlib.h HAVE_STDLIB_H)
|
||||||
|
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
|
||||||
|
check_include_files(sys/socket.h HAVE_SYS_SOCKET_H)
|
||||||
|
check_include_files(sys/time.h HAVE_SYS_TIME_H)
|
||||||
|
check_include_files(arpa/inet.h HAVE_ARPA_INET_H)
|
||||||
|
check_include_files(netinet/in.h HAVE_NETINET_IN_H)
|
||||||
|
check_include_files(winsock2.h HAVE_WINSOCK2_H)
|
||||||
|
|
||||||
|
check_symbol_exists(strcasecmp strings.h HAVE_STRCASECMP)
|
||||||
|
check_symbol_exists(_stricmp string.h HAVE__STRICMP)
|
||||||
|
check_symbol_exists(snprintf stdio.h HAVE_SNPRINTF)
|
||||||
|
check_symbol_exists(_snprintf stdio.h HAVE__SNPRINTF)
|
||||||
|
|
||||||
|
check_symbol_exists(__func__ "" HAVE___FUNC__)
|
||||||
|
check_symbol_exists(__FUNCTION__ "" HAVE___FUNCTION__)
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/libssh2_config_cmake.h.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/libssh2_config.h)
|
||||||
+4
-4
@@ -1,17 +1,17 @@
|
|||||||
AUTOMAKE_OPTIONS = foreign nostdinc
|
AUTOMAKE_OPTIONS = foreign nostdinc
|
||||||
|
|
||||||
EXTRA_DIST = libssh2_config.h.in
|
EXTRA_DIST = libssh2_config.h.in libssh2_config_cmake.h.in CMakeLists.txt
|
||||||
|
|
||||||
# samples
|
# samples
|
||||||
noinst_PROGRAMS = direct_tcpip ssh2 scp scp_nonblock scp_write \
|
noinst_PROGRAMS = direct_tcpip ssh2 scp scp_nonblock scp_write \
|
||||||
scp_write_nonblock sftp sftp_nonblock sftp_write sftp_write_nonblock \
|
scp_write_nonblock sftp sftp_nonblock sftp_write sftp_write_nonblock \
|
||||||
sftp_mkdir sftp_mkdir_nonblock sftp_RW_nonblock sftp_write_sliding \
|
sftp_mkdir sftp_mkdir_nonblock sftp_RW_nonblock sftp_write_sliding \
|
||||||
sftpdir sftpdir_nonblock ssh2_exec ssh2_agent ssh2_echo sftp_append \
|
sftpdir sftpdir_nonblock ssh2_exec ssh2_agent ssh2_agent_forwarding \
|
||||||
subsystem_netconf tcpip-forward
|
ssh2_echo sftp_append subsystem_netconf tcpip-forward
|
||||||
|
|
||||||
if HAVE_SYS_UN_H
|
if HAVE_SYS_UN_H
|
||||||
noinst_PROGRAMS += x11
|
noinst_PROGRAMS += x11
|
||||||
endif
|
endif
|
||||||
|
|
||||||
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/example
|
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/example -I../src
|
||||||
LDADD = $(top_builddir)/src/libssh2.la
|
LDADD = $(top_builddir)/src/libssh2.la
|
||||||
|
|||||||
+468
-225
@@ -1,8 +1,8 @@
|
|||||||
# Makefile.in generated by automake 1.9.6 from Makefile.am.
|
# Makefile.in generated by automake 1.16.4 from Makefile.am.
|
||||||
# @configure_input@
|
# @configure_input@
|
||||||
|
|
||||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
# Copyright (C) 1994-2021 Free Software Foundation, Inc.
|
||||||
# 2003, 2004, 2005 Free Software Foundation, Inc.
|
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
# This Makefile.in is free software; the Free Software Foundation
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
# gives unlimited permission to copy and/or distribute it,
|
||||||
# with or without modifications, as long as this notice is preserved.
|
# with or without modifications, as long as this notice is preserved.
|
||||||
@@ -14,15 +14,67 @@
|
|||||||
|
|
||||||
@SET_MAKE@
|
@SET_MAKE@
|
||||||
|
|
||||||
srcdir = @srcdir@
|
|
||||||
top_srcdir = @top_srcdir@
|
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
|
am__is_gnu_make = { \
|
||||||
|
if test -z '$(MAKELEVEL)'; then \
|
||||||
|
false; \
|
||||||
|
elif test -n '$(MAKE_HOST)'; then \
|
||||||
|
true; \
|
||||||
|
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
|
||||||
|
true; \
|
||||||
|
else \
|
||||||
|
false; \
|
||||||
|
fi; \
|
||||||
|
}
|
||||||
|
am__make_running_with_option = \
|
||||||
|
case $${target_option-} in \
|
||||||
|
?) ;; \
|
||||||
|
*) echo "am__make_running_with_option: internal error: invalid" \
|
||||||
|
"target option '$${target_option-}' specified" >&2; \
|
||||||
|
exit 1;; \
|
||||||
|
esac; \
|
||||||
|
has_opt=no; \
|
||||||
|
sane_makeflags=$$MAKEFLAGS; \
|
||||||
|
if $(am__is_gnu_make); then \
|
||||||
|
sane_makeflags=$$MFLAGS; \
|
||||||
|
else \
|
||||||
|
case $$MAKEFLAGS in \
|
||||||
|
*\\[\ \ ]*) \
|
||||||
|
bs=\\; \
|
||||||
|
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
|
||||||
|
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
|
||||||
|
esac; \
|
||||||
|
fi; \
|
||||||
|
skip_next=no; \
|
||||||
|
strip_trailopt () \
|
||||||
|
{ \
|
||||||
|
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
|
||||||
|
}; \
|
||||||
|
for flg in $$sane_makeflags; do \
|
||||||
|
test $$skip_next = yes && { skip_next=no; continue; }; \
|
||||||
|
case $$flg in \
|
||||||
|
*=*|--*) continue;; \
|
||||||
|
-*I) strip_trailopt 'I'; skip_next=yes;; \
|
||||||
|
-*I?*) strip_trailopt 'I';; \
|
||||||
|
-*O) strip_trailopt 'O'; skip_next=yes;; \
|
||||||
|
-*O?*) strip_trailopt 'O';; \
|
||||||
|
-*l) strip_trailopt 'l'; skip_next=yes;; \
|
||||||
|
-*l?*) strip_trailopt 'l';; \
|
||||||
|
-[dEDm]) skip_next=yes;; \
|
||||||
|
-[JT]) skip_next=yes;; \
|
||||||
|
esac; \
|
||||||
|
case $$flg in \
|
||||||
|
*$$target_option*) has_opt=yes; break;; \
|
||||||
|
esac; \
|
||||||
|
done; \
|
||||||
|
test $$has_opt = yes
|
||||||
|
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
|
||||||
|
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
|
||||||
pkgdatadir = $(datadir)/@PACKAGE@
|
pkgdatadir = $(datadir)/@PACKAGE@
|
||||||
pkglibdir = $(libdir)/@PACKAGE@
|
|
||||||
pkgincludedir = $(includedir)/@PACKAGE@
|
pkgincludedir = $(includedir)/@PACKAGE@
|
||||||
top_builddir = ..
|
pkglibdir = $(libdir)/@PACKAGE@
|
||||||
|
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||||
INSTALL = @INSTALL@
|
|
||||||
install_sh_DATA = $(install_sh) -c -m 644
|
install_sh_DATA = $(install_sh) -c -m 644
|
||||||
install_sh_PROGRAM = $(install_sh) -c
|
install_sh_PROGRAM = $(install_sh) -c
|
||||||
install_sh_SCRIPT = $(install_sh) -c
|
install_sh_SCRIPT = $(install_sh) -c
|
||||||
@@ -44,13 +96,12 @@ noinst_PROGRAMS = direct_tcpip$(EXEEXT) ssh2$(EXEEXT) scp$(EXEEXT) \
|
|||||||
sftp_mkdir_nonblock$(EXEEXT) sftp_RW_nonblock$(EXEEXT) \
|
sftp_mkdir_nonblock$(EXEEXT) sftp_RW_nonblock$(EXEEXT) \
|
||||||
sftp_write_sliding$(EXEEXT) sftpdir$(EXEEXT) \
|
sftp_write_sliding$(EXEEXT) sftpdir$(EXEEXT) \
|
||||||
sftpdir_nonblock$(EXEEXT) ssh2_exec$(EXEEXT) \
|
sftpdir_nonblock$(EXEEXT) ssh2_exec$(EXEEXT) \
|
||||||
ssh2_agent$(EXEEXT) ssh2_echo$(EXEEXT) sftp_append$(EXEEXT) \
|
ssh2_agent$(EXEEXT) ssh2_agent_forwarding$(EXEEXT) \
|
||||||
|
ssh2_echo$(EXEEXT) sftp_append$(EXEEXT) \
|
||||||
subsystem_netconf$(EXEEXT) tcpip-forward$(EXEEXT) \
|
subsystem_netconf$(EXEEXT) tcpip-forward$(EXEEXT) \
|
||||||
$(am__EXEEXT_1)
|
$(am__EXEEXT_1)
|
||||||
@HAVE_SYS_UN_H_TRUE@am__append_1 = x11
|
@HAVE_SYS_UN_H_TRUE@am__append_1 = x11
|
||||||
subdir = example
|
subdir = example
|
||||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
|
||||||
$(srcdir)/libssh2_config.h.in
|
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||||
am__aclocal_m4_deps = $(top_srcdir)/m4/autobuild.m4 \
|
am__aclocal_m4_deps = $(top_srcdir)/m4/autobuild.m4 \
|
||||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||||
@@ -60,15 +111,21 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/autobuild.m4 \
|
|||||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||||
$(ACLOCAL_M4)
|
$(ACLOCAL_M4)
|
||||||
|
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
|
||||||
mkinstalldirs = $(install_sh) -d
|
mkinstalldirs = $(install_sh) -d
|
||||||
CONFIG_HEADER = $(top_builddir)/src/libssh2_config.h libssh2_config.h
|
CONFIG_HEADER = $(top_builddir)/src/libssh2_config.h
|
||||||
CONFIG_CLEAN_FILES =
|
CONFIG_CLEAN_FILES =
|
||||||
|
CONFIG_CLEAN_VPATH_FILES =
|
||||||
@HAVE_SYS_UN_H_TRUE@am__EXEEXT_1 = x11$(EXEEXT)
|
@HAVE_SYS_UN_H_TRUE@am__EXEEXT_1 = x11$(EXEEXT)
|
||||||
PROGRAMS = $(noinst_PROGRAMS)
|
PROGRAMS = $(noinst_PROGRAMS)
|
||||||
direct_tcpip_SOURCES = direct_tcpip.c
|
direct_tcpip_SOURCES = direct_tcpip.c
|
||||||
direct_tcpip_OBJECTS = direct_tcpip.$(OBJEXT)
|
direct_tcpip_OBJECTS = direct_tcpip.$(OBJEXT)
|
||||||
direct_tcpip_LDADD = $(LDADD)
|
direct_tcpip_LDADD = $(LDADD)
|
||||||
direct_tcpip_DEPENDENCIES = $(top_builddir)/src/libssh2.la
|
direct_tcpip_DEPENDENCIES = $(top_builddir)/src/libssh2.la
|
||||||
|
AM_V_lt = $(am__v_lt_@AM_V@)
|
||||||
|
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
|
||||||
|
am__v_lt_0 = --silent
|
||||||
|
am__v_lt_1 =
|
||||||
scp_SOURCES = scp.c
|
scp_SOURCES = scp.c
|
||||||
scp_OBJECTS = scp.$(OBJEXT)
|
scp_OBJECTS = scp.$(OBJEXT)
|
||||||
scp_LDADD = $(LDADD)
|
scp_LDADD = $(LDADD)
|
||||||
@@ -137,6 +194,10 @@ ssh2_agent_SOURCES = ssh2_agent.c
|
|||||||
ssh2_agent_OBJECTS = ssh2_agent.$(OBJEXT)
|
ssh2_agent_OBJECTS = ssh2_agent.$(OBJEXT)
|
||||||
ssh2_agent_LDADD = $(LDADD)
|
ssh2_agent_LDADD = $(LDADD)
|
||||||
ssh2_agent_DEPENDENCIES = $(top_builddir)/src/libssh2.la
|
ssh2_agent_DEPENDENCIES = $(top_builddir)/src/libssh2.la
|
||||||
|
ssh2_agent_forwarding_SOURCES = ssh2_agent_forwarding.c
|
||||||
|
ssh2_agent_forwarding_OBJECTS = ssh2_agent_forwarding.$(OBJEXT)
|
||||||
|
ssh2_agent_forwarding_LDADD = $(LDADD)
|
||||||
|
ssh2_agent_forwarding_DEPENDENCIES = $(top_builddir)/src/libssh2.la
|
||||||
ssh2_echo_SOURCES = ssh2_echo.c
|
ssh2_echo_SOURCES = ssh2_echo.c
|
||||||
ssh2_echo_OBJECTS = ssh2_echo.$(OBJEXT)
|
ssh2_echo_OBJECTS = ssh2_echo.$(OBJEXT)
|
||||||
ssh2_echo_LDADD = $(LDADD)
|
ssh2_echo_LDADD = $(LDADD)
|
||||||
@@ -157,50 +218,112 @@ x11_SOURCES = x11.c
|
|||||||
x11_OBJECTS = x11.$(OBJEXT)
|
x11_OBJECTS = x11.$(OBJEXT)
|
||||||
x11_LDADD = $(LDADD)
|
x11_LDADD = $(LDADD)
|
||||||
x11_DEPENDENCIES = $(top_builddir)/src/libssh2.la
|
x11_DEPENDENCIES = $(top_builddir)/src/libssh2.la
|
||||||
|
AM_V_P = $(am__v_P_@AM_V@)
|
||||||
|
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
|
||||||
|
am__v_P_0 = false
|
||||||
|
am__v_P_1 = :
|
||||||
|
AM_V_GEN = $(am__v_GEN_@AM_V@)
|
||||||
|
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
|
||||||
|
am__v_GEN_0 = @echo " GEN " $@;
|
||||||
|
am__v_GEN_1 =
|
||||||
|
AM_V_at = $(am__v_at_@AM_V@)
|
||||||
|
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
|
||||||
|
am__v_at_0 = @
|
||||||
|
am__v_at_1 =
|
||||||
DEFAULT_INCLUDES =
|
DEFAULT_INCLUDES =
|
||||||
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
depcomp = $(SHELL) $(top_srcdir)/depcomp
|
||||||
am__depfiles_maybe = depfiles
|
am__maybe_remake_depfiles = depfiles
|
||||||
|
am__depfiles_remade = ./$(DEPDIR)/direct_tcpip.Po ./$(DEPDIR)/scp.Po \
|
||||||
|
./$(DEPDIR)/scp_nonblock.Po ./$(DEPDIR)/scp_write.Po \
|
||||||
|
./$(DEPDIR)/scp_write_nonblock.Po ./$(DEPDIR)/sftp.Po \
|
||||||
|
./$(DEPDIR)/sftp_RW_nonblock.Po ./$(DEPDIR)/sftp_append.Po \
|
||||||
|
./$(DEPDIR)/sftp_mkdir.Po ./$(DEPDIR)/sftp_mkdir_nonblock.Po \
|
||||||
|
./$(DEPDIR)/sftp_nonblock.Po ./$(DEPDIR)/sftp_write.Po \
|
||||||
|
./$(DEPDIR)/sftp_write_nonblock.Po \
|
||||||
|
./$(DEPDIR)/sftp_write_sliding.Po ./$(DEPDIR)/sftpdir.Po \
|
||||||
|
./$(DEPDIR)/sftpdir_nonblock.Po ./$(DEPDIR)/ssh2.Po \
|
||||||
|
./$(DEPDIR)/ssh2_agent.Po ./$(DEPDIR)/ssh2_agent_forwarding.Po \
|
||||||
|
./$(DEPDIR)/ssh2_echo.Po ./$(DEPDIR)/ssh2_exec.Po \
|
||||||
|
./$(DEPDIR)/subsystem_netconf.Po ./$(DEPDIR)/tcpip-forward.Po \
|
||||||
|
./$(DEPDIR)/x11.Po
|
||||||
|
am__mv = mv -f
|
||||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
||||||
LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
|
LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||||
|
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
|
||||||
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
|
||||||
$(AM_CFLAGS) $(CFLAGS)
|
$(AM_CFLAGS) $(CFLAGS)
|
||||||
|
AM_V_CC = $(am__v_CC_@AM_V@)
|
||||||
|
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
|
||||||
|
am__v_CC_0 = @echo " CC " $@;
|
||||||
|
am__v_CC_1 =
|
||||||
CCLD = $(CC)
|
CCLD = $(CC)
|
||||||
LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
|
||||||
|
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||||
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
$(AM_LDFLAGS) $(LDFLAGS) -o $@
|
||||||
|
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
|
||||||
|
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
|
||||||
|
am__v_CCLD_0 = @echo " CCLD " $@;
|
||||||
|
am__v_CCLD_1 =
|
||||||
SOURCES = direct_tcpip.c scp.c scp_nonblock.c scp_write.c \
|
SOURCES = direct_tcpip.c scp.c scp_nonblock.c scp_write.c \
|
||||||
scp_write_nonblock.c sftp.c sftp_RW_nonblock.c sftp_append.c \
|
scp_write_nonblock.c sftp.c sftp_RW_nonblock.c sftp_append.c \
|
||||||
sftp_mkdir.c sftp_mkdir_nonblock.c sftp_nonblock.c \
|
sftp_mkdir.c sftp_mkdir_nonblock.c sftp_nonblock.c \
|
||||||
sftp_write.c sftp_write_nonblock.c sftp_write_sliding.c \
|
sftp_write.c sftp_write_nonblock.c sftp_write_sliding.c \
|
||||||
sftpdir.c sftpdir_nonblock.c ssh2.c ssh2_agent.c ssh2_echo.c \
|
sftpdir.c sftpdir_nonblock.c ssh2.c ssh2_agent.c \
|
||||||
ssh2_exec.c subsystem_netconf.c tcpip-forward.c x11.c
|
ssh2_agent_forwarding.c ssh2_echo.c ssh2_exec.c \
|
||||||
|
subsystem_netconf.c tcpip-forward.c x11.c
|
||||||
DIST_SOURCES = direct_tcpip.c scp.c scp_nonblock.c scp_write.c \
|
DIST_SOURCES = direct_tcpip.c scp.c scp_nonblock.c scp_write.c \
|
||||||
scp_write_nonblock.c sftp.c sftp_RW_nonblock.c sftp_append.c \
|
scp_write_nonblock.c sftp.c sftp_RW_nonblock.c sftp_append.c \
|
||||||
sftp_mkdir.c sftp_mkdir_nonblock.c sftp_nonblock.c \
|
sftp_mkdir.c sftp_mkdir_nonblock.c sftp_nonblock.c \
|
||||||
sftp_write.c sftp_write_nonblock.c sftp_write_sliding.c \
|
sftp_write.c sftp_write_nonblock.c sftp_write_sliding.c \
|
||||||
sftpdir.c sftpdir_nonblock.c ssh2.c ssh2_agent.c ssh2_echo.c \
|
sftpdir.c sftpdir_nonblock.c ssh2.c ssh2_agent.c \
|
||||||
ssh2_exec.c subsystem_netconf.c tcpip-forward.c x11.c
|
ssh2_agent_forwarding.c ssh2_echo.c ssh2_exec.c \
|
||||||
ETAGS = etags
|
subsystem_netconf.c tcpip-forward.c x11.c
|
||||||
CTAGS = ctags
|
am__can_run_installinfo = \
|
||||||
|
case $$AM_UPDATE_INFO_DIR in \
|
||||||
|
n|no|NO) false;; \
|
||||||
|
*) (install-info --version) >/dev/null 2>&1;; \
|
||||||
|
esac
|
||||||
|
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
|
||||||
|
# Read a list of newline-separated strings from the standard input,
|
||||||
|
# and print each of them once, without duplicates. Input order is
|
||||||
|
# *not* preserved.
|
||||||
|
am__uniquify_input = $(AWK) '\
|
||||||
|
BEGIN { nonempty = 0; } \
|
||||||
|
{ items[$$0] = 1; nonempty = 1; } \
|
||||||
|
END { if (nonempty) { for (i in items) print i; }; } \
|
||||||
|
'
|
||||||
|
# Make sure the list of sources is unique. This is necessary because,
|
||||||
|
# e.g., the same source file might be shared among _SOURCES variables
|
||||||
|
# for different programs/libraries.
|
||||||
|
am__define_uniq_tagged_files = \
|
||||||
|
list='$(am__tagged_files)'; \
|
||||||
|
unique=`for i in $$list; do \
|
||||||
|
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
||||||
|
done | $(am__uniquify_input)`
|
||||||
|
am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||||
ACLOCAL = @ACLOCAL@
|
ACLOCAL = @ACLOCAL@
|
||||||
ALLOCA = @ALLOCA@
|
ALLOCA = @ALLOCA@
|
||||||
AMDEP_FALSE = @AMDEP_FALSE@
|
|
||||||
AMDEP_TRUE = @AMDEP_TRUE@
|
|
||||||
AMTAR = @AMTAR@
|
AMTAR = @AMTAR@
|
||||||
|
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||||
AR = @AR@
|
AR = @AR@
|
||||||
AS = @AS@
|
AS = @AS@
|
||||||
AUTOCONF = @AUTOCONF@
|
AUTOCONF = @AUTOCONF@
|
||||||
AUTOHEADER = @AUTOHEADER@
|
AUTOHEADER = @AUTOHEADER@
|
||||||
AUTOMAKE = @AUTOMAKE@
|
AUTOMAKE = @AUTOMAKE@
|
||||||
AWK = @AWK@
|
AWK = @AWK@
|
||||||
BUILD_EXAMPLES_FALSE = @BUILD_EXAMPLES_FALSE@
|
|
||||||
BUILD_EXAMPLES_TRUE = @BUILD_EXAMPLES_TRUE@
|
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CCDEPMODE = @CCDEPMODE@
|
CCDEPMODE = @CCDEPMODE@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
CPP = @CPP@
|
CPP = @CPP@
|
||||||
CPPFLAGS = @CPPFLAGS@
|
CPPFLAGS = @CPPFLAGS@
|
||||||
|
CSCOPE = @CSCOPE@
|
||||||
|
CTAGS = @CTAGS@
|
||||||
|
CXX = @CXX@
|
||||||
|
CXXCPP = @CXXCPP@
|
||||||
|
CXXDEPMODE = @CXXDEPMODE@
|
||||||
|
CXXFLAGS = @CXXFLAGS@
|
||||||
CYGPATH_W = @CYGPATH_W@
|
CYGPATH_W = @CYGPATH_W@
|
||||||
DEFS = @DEFS@
|
DEFS = @DEFS@
|
||||||
DEPDIR = @DEPDIR@
|
DEPDIR = @DEPDIR@
|
||||||
@@ -211,24 +334,31 @@ ECHO_C = @ECHO_C@
|
|||||||
ECHO_N = @ECHO_N@
|
ECHO_N = @ECHO_N@
|
||||||
ECHO_T = @ECHO_T@
|
ECHO_T = @ECHO_T@
|
||||||
EGREP = @EGREP@
|
EGREP = @EGREP@
|
||||||
|
ETAGS = @ETAGS@
|
||||||
EXEEXT = @EXEEXT@
|
EXEEXT = @EXEEXT@
|
||||||
FGREP = @FGREP@
|
FGREP = @FGREP@
|
||||||
GREP = @GREP@
|
GREP = @GREP@
|
||||||
|
HAVE_LIBBCRYPT = @HAVE_LIBBCRYPT@
|
||||||
|
HAVE_LIBCRYPT32 = @HAVE_LIBCRYPT32@
|
||||||
HAVE_LIBGCRYPT = @HAVE_LIBGCRYPT@
|
HAVE_LIBGCRYPT = @HAVE_LIBGCRYPT@
|
||||||
|
HAVE_LIBMBEDCRYPTO = @HAVE_LIBMBEDCRYPTO@
|
||||||
HAVE_LIBSSL = @HAVE_LIBSSL@
|
HAVE_LIBSSL = @HAVE_LIBSSL@
|
||||||
HAVE_LIBZ = @HAVE_LIBZ@
|
HAVE_LIBZ = @HAVE_LIBZ@
|
||||||
HAVE_SYS_UN_H_FALSE = @HAVE_SYS_UN_H_FALSE@
|
INSTALL = @INSTALL@
|
||||||
HAVE_SYS_UN_H_TRUE = @HAVE_SYS_UN_H_TRUE@
|
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
INSTALL_DATA = @INSTALL_DATA@
|
||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||||
LD = @LD@
|
LD = @LD@
|
||||||
LDFLAGS = @LDFLAGS@
|
LDFLAGS = @LDFLAGS@
|
||||||
|
LIBBCRYPT = @LIBBCRYPT@
|
||||||
|
LIBBCRYPT_PREFIX = @LIBBCRYPT_PREFIX@
|
||||||
|
LIBCRYPT32 = @LIBCRYPT32@
|
||||||
|
LIBCRYPT32_PREFIX = @LIBCRYPT32_PREFIX@
|
||||||
LIBGCRYPT = @LIBGCRYPT@
|
LIBGCRYPT = @LIBGCRYPT@
|
||||||
LIBGCRYPT_FALSE = @LIBGCRYPT_FALSE@
|
|
||||||
LIBGCRYPT_PREFIX = @LIBGCRYPT_PREFIX@
|
LIBGCRYPT_PREFIX = @LIBGCRYPT_PREFIX@
|
||||||
LIBGCRYPT_TRUE = @LIBGCRYPT_TRUE@
|
LIBMBEDCRYPTO = @LIBMBEDCRYPTO@
|
||||||
|
LIBMBEDCRYPTO_PREFIX = @LIBMBEDCRYPTO_PREFIX@
|
||||||
LIBOBJS = @LIBOBJS@
|
LIBOBJS = @LIBOBJS@
|
||||||
LIBS = @LIBS@
|
LIBS = @LIBS@
|
||||||
LIBSREQUIRED = @LIBSREQUIRED@
|
LIBSREQUIRED = @LIBSREQUIRED@
|
||||||
@@ -238,17 +368,21 @@ LIBSSL_PREFIX = @LIBSSL_PREFIX@
|
|||||||
LIBTOOL = @LIBTOOL@
|
LIBTOOL = @LIBTOOL@
|
||||||
LIBZ = @LIBZ@
|
LIBZ = @LIBZ@
|
||||||
LIBZ_PREFIX = @LIBZ_PREFIX@
|
LIBZ_PREFIX = @LIBZ_PREFIX@
|
||||||
|
LIB_FUZZING_ENGINE = @LIB_FUZZING_ENGINE@
|
||||||
LIPO = @LIPO@
|
LIPO = @LIPO@
|
||||||
LN_S = @LN_S@
|
LN_S = @LN_S@
|
||||||
|
LTLIBBCRYPT = @LTLIBBCRYPT@
|
||||||
|
LTLIBCRYPT32 = @LTLIBCRYPT32@
|
||||||
LTLIBGCRYPT = @LTLIBGCRYPT@
|
LTLIBGCRYPT = @LTLIBGCRYPT@
|
||||||
|
LTLIBMBEDCRYPTO = @LTLIBMBEDCRYPTO@
|
||||||
LTLIBOBJS = @LTLIBOBJS@
|
LTLIBOBJS = @LTLIBOBJS@
|
||||||
LTLIBSSL = @LTLIBSSL@
|
LTLIBSSL = @LTLIBSSL@
|
||||||
LTLIBZ = @LTLIBZ@
|
LTLIBZ = @LTLIBZ@
|
||||||
|
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
|
||||||
MAINT = @MAINT@
|
MAINT = @MAINT@
|
||||||
MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
|
|
||||||
MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
|
|
||||||
MAKEINFO = @MAKEINFO@
|
MAKEINFO = @MAKEINFO@
|
||||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
MANIFEST_TOOL = @MANIFEST_TOOL@
|
||||||
|
MKDIR_P = @MKDIR_P@
|
||||||
NM = @NM@
|
NM = @NM@
|
||||||
NMEDIT = @NMEDIT@
|
NMEDIT = @NMEDIT@
|
||||||
OBJDUMP = @OBJDUMP@
|
OBJDUMP = @OBJDUMP@
|
||||||
@@ -268,15 +402,16 @@ SED = @SED@
|
|||||||
SET_MAKE = @SET_MAKE@
|
SET_MAKE = @SET_MAKE@
|
||||||
SHELL = @SHELL@
|
SHELL = @SHELL@
|
||||||
SSHD = @SSHD@
|
SSHD = @SSHD@
|
||||||
SSHD_FALSE = @SSHD_FALSE@
|
|
||||||
SSHD_TRUE = @SSHD_TRUE@
|
|
||||||
STRIP = @STRIP@
|
STRIP = @STRIP@
|
||||||
VERSION = @VERSION@
|
VERSION = @VERSION@
|
||||||
|
abs_builddir = @abs_builddir@
|
||||||
|
abs_srcdir = @abs_srcdir@
|
||||||
|
abs_top_builddir = @abs_top_builddir@
|
||||||
|
abs_top_srcdir = @abs_top_srcdir@
|
||||||
ac_ct_AR = @ac_ct_AR@
|
ac_ct_AR = @ac_ct_AR@
|
||||||
ac_ct_CC = @ac_ct_CC@
|
ac_ct_CC = @ac_ct_CC@
|
||||||
|
ac_ct_CXX = @ac_ct_CXX@
|
||||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||||
am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
|
|
||||||
am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
|
|
||||||
am__include = @am__include@
|
am__include = @am__include@
|
||||||
am__leading_dot = @am__leading_dot@
|
am__leading_dot = @am__leading_dot@
|
||||||
am__quote = @am__quote@
|
am__quote = @am__quote@
|
||||||
@@ -288,6 +423,7 @@ build_alias = @build_alias@
|
|||||||
build_cpu = @build_cpu@
|
build_cpu = @build_cpu@
|
||||||
build_os = @build_os@
|
build_os = @build_os@
|
||||||
build_vendor = @build_vendor@
|
build_vendor = @build_vendor@
|
||||||
|
builddir = @builddir@
|
||||||
datadir = @datadir@
|
datadir = @datadir@
|
||||||
datarootdir = @datarootdir@
|
datarootdir = @datarootdir@
|
||||||
docdir = @docdir@
|
docdir = @docdir@
|
||||||
@@ -313,16 +449,20 @@ pdfdir = @pdfdir@
|
|||||||
prefix = @prefix@
|
prefix = @prefix@
|
||||||
program_transform_name = @program_transform_name@
|
program_transform_name = @program_transform_name@
|
||||||
psdir = @psdir@
|
psdir = @psdir@
|
||||||
|
runstatedir = @runstatedir@
|
||||||
sbindir = @sbindir@
|
sbindir = @sbindir@
|
||||||
sharedstatedir = @sharedstatedir@
|
sharedstatedir = @sharedstatedir@
|
||||||
|
srcdir = @srcdir@
|
||||||
sysconfdir = @sysconfdir@
|
sysconfdir = @sysconfdir@
|
||||||
target_alias = @target_alias@
|
target_alias = @target_alias@
|
||||||
|
top_build_prefix = @top_build_prefix@
|
||||||
|
top_builddir = @top_builddir@
|
||||||
|
top_srcdir = @top_srcdir@
|
||||||
AUTOMAKE_OPTIONS = foreign nostdinc
|
AUTOMAKE_OPTIONS = foreign nostdinc
|
||||||
EXTRA_DIST = libssh2_config.h.in
|
EXTRA_DIST = libssh2_config.h.in libssh2_config_cmake.h.in CMakeLists.txt
|
||||||
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/example
|
AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/example -I../src
|
||||||
LDADD = $(top_builddir)/src/libssh2.la
|
LDADD = $(top_builddir)/src/libssh2.la
|
||||||
all: libssh2_config.h
|
all: all-am
|
||||||
$(MAKE) $(AM_MAKEFLAGS) all-am
|
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .c .lo .o .obj
|
.SUFFIXES: .c .lo .o .obj
|
||||||
@@ -330,22 +470,21 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
|
|||||||
@for dep in $?; do \
|
@for dep in $?; do \
|
||||||
case '$(am__configure_deps)' in \
|
case '$(am__configure_deps)' in \
|
||||||
*$$dep*) \
|
*$$dep*) \
|
||||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
|
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||||
&& exit 0; \
|
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||||
exit 1;; \
|
exit 1;; \
|
||||||
esac; \
|
esac; \
|
||||||
done; \
|
done; \
|
||||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign example/Makefile'; \
|
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign example/Makefile'; \
|
||||||
cd $(top_srcdir) && \
|
$(am__cd) $(top_srcdir) && \
|
||||||
$(AUTOMAKE) --foreign example/Makefile
|
$(AUTOMAKE) --foreign example/Makefile
|
||||||
.PRECIOUS: Makefile
|
|
||||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||||
@case '$?' in \
|
@case '$?' in \
|
||||||
*config.status*) \
|
*config.status*) \
|
||||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||||
*) \
|
*) \
|
||||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
|
||||||
esac;
|
esac;
|
||||||
|
|
||||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||||
@@ -355,99 +494,112 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
|||||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||||
|
$(am__aclocal_m4_deps):
|
||||||
libssh2_config.h: stamp-h2
|
|
||||||
@if test ! -f $@; then \
|
|
||||||
rm -f stamp-h2; \
|
|
||||||
$(MAKE) stamp-h2; \
|
|
||||||
else :; fi
|
|
||||||
|
|
||||||
stamp-h2: $(srcdir)/libssh2_config.h.in $(top_builddir)/config.status
|
|
||||||
@rm -f stamp-h2
|
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status example/libssh2_config.h
|
|
||||||
$(srcdir)/libssh2_config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
|
||||||
cd $(top_srcdir) && $(AUTOHEADER)
|
|
||||||
rm -f stamp-h2
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
distclean-hdr:
|
|
||||||
-rm -f libssh2_config.h stamp-h2
|
|
||||||
|
|
||||||
clean-noinstPROGRAMS:
|
clean-noinstPROGRAMS:
|
||||||
@list='$(noinst_PROGRAMS)'; for p in $$list; do \
|
@list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
|
||||||
f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
|
echo " rm -f" $$list; \
|
||||||
echo " rm -f $$p $$f"; \
|
rm -f $$list || exit $$?; \
|
||||||
rm -f $$p $$f ; \
|
test -n "$(EXEEXT)" || exit 0; \
|
||||||
done
|
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
|
||||||
direct_tcpip$(EXEEXT): $(direct_tcpip_OBJECTS) $(direct_tcpip_DEPENDENCIES)
|
echo " rm -f" $$list; \
|
||||||
|
rm -f $$list
|
||||||
|
|
||||||
|
direct_tcpip$(EXEEXT): $(direct_tcpip_OBJECTS) $(direct_tcpip_DEPENDENCIES) $(EXTRA_direct_tcpip_DEPENDENCIES)
|
||||||
@rm -f direct_tcpip$(EXEEXT)
|
@rm -f direct_tcpip$(EXEEXT)
|
||||||
$(LINK) $(direct_tcpip_LDFLAGS) $(direct_tcpip_OBJECTS) $(direct_tcpip_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(direct_tcpip_OBJECTS) $(direct_tcpip_LDADD) $(LIBS)
|
||||||
scp$(EXEEXT): $(scp_OBJECTS) $(scp_DEPENDENCIES)
|
|
||||||
|
scp$(EXEEXT): $(scp_OBJECTS) $(scp_DEPENDENCIES) $(EXTRA_scp_DEPENDENCIES)
|
||||||
@rm -f scp$(EXEEXT)
|
@rm -f scp$(EXEEXT)
|
||||||
$(LINK) $(scp_LDFLAGS) $(scp_OBJECTS) $(scp_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(scp_OBJECTS) $(scp_LDADD) $(LIBS)
|
||||||
scp_nonblock$(EXEEXT): $(scp_nonblock_OBJECTS) $(scp_nonblock_DEPENDENCIES)
|
|
||||||
|
scp_nonblock$(EXEEXT): $(scp_nonblock_OBJECTS) $(scp_nonblock_DEPENDENCIES) $(EXTRA_scp_nonblock_DEPENDENCIES)
|
||||||
@rm -f scp_nonblock$(EXEEXT)
|
@rm -f scp_nonblock$(EXEEXT)
|
||||||
$(LINK) $(scp_nonblock_LDFLAGS) $(scp_nonblock_OBJECTS) $(scp_nonblock_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(scp_nonblock_OBJECTS) $(scp_nonblock_LDADD) $(LIBS)
|
||||||
scp_write$(EXEEXT): $(scp_write_OBJECTS) $(scp_write_DEPENDENCIES)
|
|
||||||
|
scp_write$(EXEEXT): $(scp_write_OBJECTS) $(scp_write_DEPENDENCIES) $(EXTRA_scp_write_DEPENDENCIES)
|
||||||
@rm -f scp_write$(EXEEXT)
|
@rm -f scp_write$(EXEEXT)
|
||||||
$(LINK) $(scp_write_LDFLAGS) $(scp_write_OBJECTS) $(scp_write_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(scp_write_OBJECTS) $(scp_write_LDADD) $(LIBS)
|
||||||
scp_write_nonblock$(EXEEXT): $(scp_write_nonblock_OBJECTS) $(scp_write_nonblock_DEPENDENCIES)
|
|
||||||
|
scp_write_nonblock$(EXEEXT): $(scp_write_nonblock_OBJECTS) $(scp_write_nonblock_DEPENDENCIES) $(EXTRA_scp_write_nonblock_DEPENDENCIES)
|
||||||
@rm -f scp_write_nonblock$(EXEEXT)
|
@rm -f scp_write_nonblock$(EXEEXT)
|
||||||
$(LINK) $(scp_write_nonblock_LDFLAGS) $(scp_write_nonblock_OBJECTS) $(scp_write_nonblock_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(scp_write_nonblock_OBJECTS) $(scp_write_nonblock_LDADD) $(LIBS)
|
||||||
sftp$(EXEEXT): $(sftp_OBJECTS) $(sftp_DEPENDENCIES)
|
|
||||||
|
sftp$(EXEEXT): $(sftp_OBJECTS) $(sftp_DEPENDENCIES) $(EXTRA_sftp_DEPENDENCIES)
|
||||||
@rm -f sftp$(EXEEXT)
|
@rm -f sftp$(EXEEXT)
|
||||||
$(LINK) $(sftp_LDFLAGS) $(sftp_OBJECTS) $(sftp_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(sftp_OBJECTS) $(sftp_LDADD) $(LIBS)
|
||||||
sftp_RW_nonblock$(EXEEXT): $(sftp_RW_nonblock_OBJECTS) $(sftp_RW_nonblock_DEPENDENCIES)
|
|
||||||
|
sftp_RW_nonblock$(EXEEXT): $(sftp_RW_nonblock_OBJECTS) $(sftp_RW_nonblock_DEPENDENCIES) $(EXTRA_sftp_RW_nonblock_DEPENDENCIES)
|
||||||
@rm -f sftp_RW_nonblock$(EXEEXT)
|
@rm -f sftp_RW_nonblock$(EXEEXT)
|
||||||
$(LINK) $(sftp_RW_nonblock_LDFLAGS) $(sftp_RW_nonblock_OBJECTS) $(sftp_RW_nonblock_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(sftp_RW_nonblock_OBJECTS) $(sftp_RW_nonblock_LDADD) $(LIBS)
|
||||||
sftp_append$(EXEEXT): $(sftp_append_OBJECTS) $(sftp_append_DEPENDENCIES)
|
|
||||||
|
sftp_append$(EXEEXT): $(sftp_append_OBJECTS) $(sftp_append_DEPENDENCIES) $(EXTRA_sftp_append_DEPENDENCIES)
|
||||||
@rm -f sftp_append$(EXEEXT)
|
@rm -f sftp_append$(EXEEXT)
|
||||||
$(LINK) $(sftp_append_LDFLAGS) $(sftp_append_OBJECTS) $(sftp_append_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(sftp_append_OBJECTS) $(sftp_append_LDADD) $(LIBS)
|
||||||
sftp_mkdir$(EXEEXT): $(sftp_mkdir_OBJECTS) $(sftp_mkdir_DEPENDENCIES)
|
|
||||||
|
sftp_mkdir$(EXEEXT): $(sftp_mkdir_OBJECTS) $(sftp_mkdir_DEPENDENCIES) $(EXTRA_sftp_mkdir_DEPENDENCIES)
|
||||||
@rm -f sftp_mkdir$(EXEEXT)
|
@rm -f sftp_mkdir$(EXEEXT)
|
||||||
$(LINK) $(sftp_mkdir_LDFLAGS) $(sftp_mkdir_OBJECTS) $(sftp_mkdir_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(sftp_mkdir_OBJECTS) $(sftp_mkdir_LDADD) $(LIBS)
|
||||||
sftp_mkdir_nonblock$(EXEEXT): $(sftp_mkdir_nonblock_OBJECTS) $(sftp_mkdir_nonblock_DEPENDENCIES)
|
|
||||||
|
sftp_mkdir_nonblock$(EXEEXT): $(sftp_mkdir_nonblock_OBJECTS) $(sftp_mkdir_nonblock_DEPENDENCIES) $(EXTRA_sftp_mkdir_nonblock_DEPENDENCIES)
|
||||||
@rm -f sftp_mkdir_nonblock$(EXEEXT)
|
@rm -f sftp_mkdir_nonblock$(EXEEXT)
|
||||||
$(LINK) $(sftp_mkdir_nonblock_LDFLAGS) $(sftp_mkdir_nonblock_OBJECTS) $(sftp_mkdir_nonblock_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(sftp_mkdir_nonblock_OBJECTS) $(sftp_mkdir_nonblock_LDADD) $(LIBS)
|
||||||
sftp_nonblock$(EXEEXT): $(sftp_nonblock_OBJECTS) $(sftp_nonblock_DEPENDENCIES)
|
|
||||||
|
sftp_nonblock$(EXEEXT): $(sftp_nonblock_OBJECTS) $(sftp_nonblock_DEPENDENCIES) $(EXTRA_sftp_nonblock_DEPENDENCIES)
|
||||||
@rm -f sftp_nonblock$(EXEEXT)
|
@rm -f sftp_nonblock$(EXEEXT)
|
||||||
$(LINK) $(sftp_nonblock_LDFLAGS) $(sftp_nonblock_OBJECTS) $(sftp_nonblock_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(sftp_nonblock_OBJECTS) $(sftp_nonblock_LDADD) $(LIBS)
|
||||||
sftp_write$(EXEEXT): $(sftp_write_OBJECTS) $(sftp_write_DEPENDENCIES)
|
|
||||||
|
sftp_write$(EXEEXT): $(sftp_write_OBJECTS) $(sftp_write_DEPENDENCIES) $(EXTRA_sftp_write_DEPENDENCIES)
|
||||||
@rm -f sftp_write$(EXEEXT)
|
@rm -f sftp_write$(EXEEXT)
|
||||||
$(LINK) $(sftp_write_LDFLAGS) $(sftp_write_OBJECTS) $(sftp_write_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(sftp_write_OBJECTS) $(sftp_write_LDADD) $(LIBS)
|
||||||
sftp_write_nonblock$(EXEEXT): $(sftp_write_nonblock_OBJECTS) $(sftp_write_nonblock_DEPENDENCIES)
|
|
||||||
|
sftp_write_nonblock$(EXEEXT): $(sftp_write_nonblock_OBJECTS) $(sftp_write_nonblock_DEPENDENCIES) $(EXTRA_sftp_write_nonblock_DEPENDENCIES)
|
||||||
@rm -f sftp_write_nonblock$(EXEEXT)
|
@rm -f sftp_write_nonblock$(EXEEXT)
|
||||||
$(LINK) $(sftp_write_nonblock_LDFLAGS) $(sftp_write_nonblock_OBJECTS) $(sftp_write_nonblock_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(sftp_write_nonblock_OBJECTS) $(sftp_write_nonblock_LDADD) $(LIBS)
|
||||||
sftp_write_sliding$(EXEEXT): $(sftp_write_sliding_OBJECTS) $(sftp_write_sliding_DEPENDENCIES)
|
|
||||||
|
sftp_write_sliding$(EXEEXT): $(sftp_write_sliding_OBJECTS) $(sftp_write_sliding_DEPENDENCIES) $(EXTRA_sftp_write_sliding_DEPENDENCIES)
|
||||||
@rm -f sftp_write_sliding$(EXEEXT)
|
@rm -f sftp_write_sliding$(EXEEXT)
|
||||||
$(LINK) $(sftp_write_sliding_LDFLAGS) $(sftp_write_sliding_OBJECTS) $(sftp_write_sliding_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(sftp_write_sliding_OBJECTS) $(sftp_write_sliding_LDADD) $(LIBS)
|
||||||
sftpdir$(EXEEXT): $(sftpdir_OBJECTS) $(sftpdir_DEPENDENCIES)
|
|
||||||
|
sftpdir$(EXEEXT): $(sftpdir_OBJECTS) $(sftpdir_DEPENDENCIES) $(EXTRA_sftpdir_DEPENDENCIES)
|
||||||
@rm -f sftpdir$(EXEEXT)
|
@rm -f sftpdir$(EXEEXT)
|
||||||
$(LINK) $(sftpdir_LDFLAGS) $(sftpdir_OBJECTS) $(sftpdir_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(sftpdir_OBJECTS) $(sftpdir_LDADD) $(LIBS)
|
||||||
sftpdir_nonblock$(EXEEXT): $(sftpdir_nonblock_OBJECTS) $(sftpdir_nonblock_DEPENDENCIES)
|
|
||||||
|
sftpdir_nonblock$(EXEEXT): $(sftpdir_nonblock_OBJECTS) $(sftpdir_nonblock_DEPENDENCIES) $(EXTRA_sftpdir_nonblock_DEPENDENCIES)
|
||||||
@rm -f sftpdir_nonblock$(EXEEXT)
|
@rm -f sftpdir_nonblock$(EXEEXT)
|
||||||
$(LINK) $(sftpdir_nonblock_LDFLAGS) $(sftpdir_nonblock_OBJECTS) $(sftpdir_nonblock_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(sftpdir_nonblock_OBJECTS) $(sftpdir_nonblock_LDADD) $(LIBS)
|
||||||
ssh2$(EXEEXT): $(ssh2_OBJECTS) $(ssh2_DEPENDENCIES)
|
|
||||||
|
ssh2$(EXEEXT): $(ssh2_OBJECTS) $(ssh2_DEPENDENCIES) $(EXTRA_ssh2_DEPENDENCIES)
|
||||||
@rm -f ssh2$(EXEEXT)
|
@rm -f ssh2$(EXEEXT)
|
||||||
$(LINK) $(ssh2_LDFLAGS) $(ssh2_OBJECTS) $(ssh2_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(ssh2_OBJECTS) $(ssh2_LDADD) $(LIBS)
|
||||||
ssh2_agent$(EXEEXT): $(ssh2_agent_OBJECTS) $(ssh2_agent_DEPENDENCIES)
|
|
||||||
|
ssh2_agent$(EXEEXT): $(ssh2_agent_OBJECTS) $(ssh2_agent_DEPENDENCIES) $(EXTRA_ssh2_agent_DEPENDENCIES)
|
||||||
@rm -f ssh2_agent$(EXEEXT)
|
@rm -f ssh2_agent$(EXEEXT)
|
||||||
$(LINK) $(ssh2_agent_LDFLAGS) $(ssh2_agent_OBJECTS) $(ssh2_agent_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(ssh2_agent_OBJECTS) $(ssh2_agent_LDADD) $(LIBS)
|
||||||
ssh2_echo$(EXEEXT): $(ssh2_echo_OBJECTS) $(ssh2_echo_DEPENDENCIES)
|
|
||||||
|
ssh2_agent_forwarding$(EXEEXT): $(ssh2_agent_forwarding_OBJECTS) $(ssh2_agent_forwarding_DEPENDENCIES) $(EXTRA_ssh2_agent_forwarding_DEPENDENCIES)
|
||||||
|
@rm -f ssh2_agent_forwarding$(EXEEXT)
|
||||||
|
$(AM_V_CCLD)$(LINK) $(ssh2_agent_forwarding_OBJECTS) $(ssh2_agent_forwarding_LDADD) $(LIBS)
|
||||||
|
|
||||||
|
ssh2_echo$(EXEEXT): $(ssh2_echo_OBJECTS) $(ssh2_echo_DEPENDENCIES) $(EXTRA_ssh2_echo_DEPENDENCIES)
|
||||||
@rm -f ssh2_echo$(EXEEXT)
|
@rm -f ssh2_echo$(EXEEXT)
|
||||||
$(LINK) $(ssh2_echo_LDFLAGS) $(ssh2_echo_OBJECTS) $(ssh2_echo_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(ssh2_echo_OBJECTS) $(ssh2_echo_LDADD) $(LIBS)
|
||||||
ssh2_exec$(EXEEXT): $(ssh2_exec_OBJECTS) $(ssh2_exec_DEPENDENCIES)
|
|
||||||
|
ssh2_exec$(EXEEXT): $(ssh2_exec_OBJECTS) $(ssh2_exec_DEPENDENCIES) $(EXTRA_ssh2_exec_DEPENDENCIES)
|
||||||
@rm -f ssh2_exec$(EXEEXT)
|
@rm -f ssh2_exec$(EXEEXT)
|
||||||
$(LINK) $(ssh2_exec_LDFLAGS) $(ssh2_exec_OBJECTS) $(ssh2_exec_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(ssh2_exec_OBJECTS) $(ssh2_exec_LDADD) $(LIBS)
|
||||||
subsystem_netconf$(EXEEXT): $(subsystem_netconf_OBJECTS) $(subsystem_netconf_DEPENDENCIES)
|
|
||||||
|
subsystem_netconf$(EXEEXT): $(subsystem_netconf_OBJECTS) $(subsystem_netconf_DEPENDENCIES) $(EXTRA_subsystem_netconf_DEPENDENCIES)
|
||||||
@rm -f subsystem_netconf$(EXEEXT)
|
@rm -f subsystem_netconf$(EXEEXT)
|
||||||
$(LINK) $(subsystem_netconf_LDFLAGS) $(subsystem_netconf_OBJECTS) $(subsystem_netconf_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(subsystem_netconf_OBJECTS) $(subsystem_netconf_LDADD) $(LIBS)
|
||||||
tcpip-forward$(EXEEXT): $(tcpip_forward_OBJECTS) $(tcpip_forward_DEPENDENCIES)
|
|
||||||
|
tcpip-forward$(EXEEXT): $(tcpip_forward_OBJECTS) $(tcpip_forward_DEPENDENCIES) $(EXTRA_tcpip_forward_DEPENDENCIES)
|
||||||
@rm -f tcpip-forward$(EXEEXT)
|
@rm -f tcpip-forward$(EXEEXT)
|
||||||
$(LINK) $(tcpip_forward_LDFLAGS) $(tcpip_forward_OBJECTS) $(tcpip_forward_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(tcpip_forward_OBJECTS) $(tcpip_forward_LDADD) $(LIBS)
|
||||||
x11$(EXEEXT): $(x11_OBJECTS) $(x11_DEPENDENCIES)
|
|
||||||
|
x11$(EXEEXT): $(x11_OBJECTS) $(x11_DEPENDENCIES) $(EXTRA_x11_DEPENDENCIES)
|
||||||
@rm -f x11$(EXEEXT)
|
@rm -f x11$(EXEEXT)
|
||||||
$(LINK) $(x11_LDFLAGS) $(x11_OBJECTS) $(x11_LDADD) $(LIBS)
|
$(AM_V_CCLD)$(LINK) $(x11_OBJECTS) $(x11_LDADD) $(LIBS)
|
||||||
|
|
||||||
mostlyclean-compile:
|
mostlyclean-compile:
|
||||||
-rm -f *.$(OBJEXT)
|
-rm -f *.$(OBJEXT)
|
||||||
@@ -455,50 +607,57 @@ mostlyclean-compile:
|
|||||||
distclean-compile:
|
distclean-compile:
|
||||||
-rm -f *.tab.c
|
-rm -f *.tab.c
|
||||||
|
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/direct_tcpip.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/direct_tcpip.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scp.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scp.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scp_nonblock.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scp_nonblock.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scp_write.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scp_write.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scp_write_nonblock.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scp_write_nonblock.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_RW_nonblock.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_RW_nonblock.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_append.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_append.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_mkdir.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_mkdir.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_mkdir_nonblock.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_mkdir_nonblock.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_nonblock.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_nonblock.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_write.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_write.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_write_nonblock.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_write_nonblock.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_write_sliding.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftp_write_sliding.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftpdir.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftpdir.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftpdir_nonblock.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sftpdir_nonblock.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssh2.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssh2.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssh2_agent.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssh2_agent.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssh2_echo.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssh2_agent_forwarding.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssh2_exec.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssh2_echo.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subsystem_netconf.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ssh2_exec.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpip-forward.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/subsystem_netconf.Po@am__quote@ # am--include-marker
|
||||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11.Po@am__quote@
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tcpip-forward.Po@am__quote@ # am--include-marker
|
||||||
|
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x11.Po@am__quote@ # am--include-marker
|
||||||
|
|
||||||
|
$(am__depfiles_remade):
|
||||||
|
@$(MKDIR_P) $(@D)
|
||||||
|
@echo '# dummy' >$@-t && $(am__mv) $@-t $@
|
||||||
|
|
||||||
|
am--depfiles: $(am__depfiles_remade)
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
@am__fastdepCC_FALSE@ $(COMPILE) -c $<
|
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
|
||||||
|
|
||||||
.c.obj:
|
.c.obj:
|
||||||
@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
|
||||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
|
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
||||||
|
|
||||||
.c.lo:
|
.c.lo:
|
||||||
@am__fastdepCC_TRUE@ if $(LTCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
|
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
|
||||||
@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
|
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
|
||||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||||
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
|
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
|
||||||
|
|
||||||
mostlyclean-libtool:
|
mostlyclean-libtool:
|
||||||
-rm -f *.lo
|
-rm -f *.lo
|
||||||
@@ -506,88 +665,93 @@ mostlyclean-libtool:
|
|||||||
clean-libtool:
|
clean-libtool:
|
||||||
-rm -rf .libs _libs
|
-rm -rf .libs _libs
|
||||||
|
|
||||||
distclean-libtool:
|
ID: $(am__tagged_files)
|
||||||
-rm -f libtool
|
$(am__define_uniq_tagged_files); mkid -fID $$unique
|
||||||
uninstall-info-am:
|
tags: tags-am
|
||||||
|
TAGS: tags
|
||||||
|
|
||||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
|
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
set x; \
|
||||||
unique=`for i in $$list; do \
|
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
|
||||||
done | \
|
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
|
||||||
END { for (i in files) print i; }'`; \
|
|
||||||
mkid -fID $$unique
|
|
||||||
tags: TAGS
|
|
||||||
|
|
||||||
TAGS: $(HEADERS) $(SOURCES) libssh2_config.h.in $(TAGS_DEPENDENCIES) \
|
|
||||||
$(TAGS_FILES) $(LISP)
|
|
||||||
tags=; \
|
|
||||||
here=`pwd`; \
|
here=`pwd`; \
|
||||||
list='$(SOURCES) $(HEADERS) libssh2_config.h.in $(LISP) $(TAGS_FILES)'; \
|
$(am__define_uniq_tagged_files); \
|
||||||
unique=`for i in $$list; do \
|
shift; \
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
||||||
done | \
|
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
|
||||||
END { for (i in files) print i; }'`; \
|
|
||||||
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
|
|
||||||
test -n "$$unique" || unique=$$empty_fix; \
|
test -n "$$unique" || unique=$$empty_fix; \
|
||||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
if test $$# -gt 0; then \
|
||||||
$$tags $$unique; \
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
"$$@" $$unique; \
|
||||||
|
else \
|
||||||
|
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
||||||
|
$$unique; \
|
||||||
|
fi; \
|
||||||
fi
|
fi
|
||||||
ctags: CTAGS
|
ctags: ctags-am
|
||||||
CTAGS: $(HEADERS) $(SOURCES) libssh2_config.h.in $(TAGS_DEPENDENCIES) \
|
|
||||||
$(TAGS_FILES) $(LISP)
|
CTAGS: ctags
|
||||||
tags=; \
|
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
|
||||||
here=`pwd`; \
|
$(am__define_uniq_tagged_files); \
|
||||||
list='$(SOURCES) $(HEADERS) libssh2_config.h.in $(LISP) $(TAGS_FILES)'; \
|
test -z "$(CTAGS_ARGS)$$unique" \
|
||||||
unique=`for i in $$list; do \
|
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
|
||||||
done | \
|
|
||||||
$(AWK) ' { files[$$0] = 1; } \
|
|
||||||
END { for (i in files) print i; }'`; \
|
|
||||||
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|
|
||||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
||||||
$$tags $$unique
|
$$unique
|
||||||
|
|
||||||
GTAGS:
|
GTAGS:
|
||||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
here=`$(am__cd) $(top_builddir) && pwd` \
|
||||||
&& cd $(top_srcdir) \
|
&& $(am__cd) $(top_srcdir) \
|
||||||
&& gtags -i $(GTAGS_ARGS) $$here
|
&& gtags -i $(GTAGS_ARGS) "$$here"
|
||||||
|
cscopelist: cscopelist-am
|
||||||
|
|
||||||
|
cscopelist-am: $(am__tagged_files)
|
||||||
|
list='$(am__tagged_files)'; \
|
||||||
|
case "$(srcdir)" in \
|
||||||
|
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
||||||
|
*) sdir=$(subdir)/$(srcdir) ;; \
|
||||||
|
esac; \
|
||||||
|
for i in $$list; do \
|
||||||
|
if test -f "$$i"; then \
|
||||||
|
echo "$(subdir)/$$i"; \
|
||||||
|
else \
|
||||||
|
echo "$$sdir/$$i"; \
|
||||||
|
fi; \
|
||||||
|
done >> $(top_builddir)/cscope.files
|
||||||
|
|
||||||
distclean-tags:
|
distclean-tags:
|
||||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
||||||
|
distdir: $(BUILT_SOURCES)
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) distdir-am
|
||||||
|
|
||||||
distdir: $(DISTFILES)
|
distdir-am: $(DISTFILES)
|
||||||
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
|
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
|
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||||
list='$(DISTFILES)'; for file in $$list; do \
|
list='$(DISTFILES)'; \
|
||||||
case $$file in \
|
dist_files=`for file in $$list; do echo $$file; done | \
|
||||||
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
|
sed -e "s|^$$srcdirstrip/||;t" \
|
||||||
$(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
|
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||||
esac; \
|
case $$dist_files in \
|
||||||
|
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||||
|
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||||
|
sort -u` ;; \
|
||||||
|
esac; \
|
||||||
|
for file in $$dist_files; do \
|
||||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||||
dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
|
|
||||||
if test "$$dir" != "$$file" && test "$$dir" != "."; then \
|
|
||||||
dir="/$$dir"; \
|
|
||||||
$(mkdir_p) "$(distdir)$$dir"; \
|
|
||||||
else \
|
|
||||||
dir=''; \
|
|
||||||
fi; \
|
|
||||||
if test -d $$d/$$file; then \
|
if test -d $$d/$$file; then \
|
||||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||||
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
|
if test -d "$(distdir)/$$file"; then \
|
||||||
|
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||||
fi; \
|
fi; \
|
||||||
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
|
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||||
|
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||||
|
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||||
|
fi; \
|
||||||
|
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||||
else \
|
else \
|
||||||
test -f $(distdir)/$$file \
|
test -f "$(distdir)/$$file" \
|
||||||
|| cp -p $$d/$$file $(distdir)/$$file \
|
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||||
|| exit 1; \
|
|| exit 1; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
check-am: all-am
|
check-am: all-am
|
||||||
check: check-am
|
check: check-am
|
||||||
all-am: Makefile $(PROGRAMS) libssh2_config.h
|
all-am: Makefile $(PROGRAMS)
|
||||||
installdirs:
|
installdirs:
|
||||||
install: install-am
|
install: install-am
|
||||||
install-exec: install-exec-am
|
install-exec: install-exec-am
|
||||||
@@ -599,16 +763,22 @@ install-am: all-am
|
|||||||
|
|
||||||
installcheck: installcheck-am
|
installcheck: installcheck-am
|
||||||
install-strip:
|
install-strip:
|
||||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
if test -z '$(STRIP)'; then \
|
||||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
`test -z '$(STRIP)' || \
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
install; \
|
||||||
|
else \
|
||||||
|
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||||
|
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||||
|
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
||||||
|
fi
|
||||||
mostlyclean-generic:
|
mostlyclean-generic:
|
||||||
|
|
||||||
clean-generic:
|
clean-generic:
|
||||||
|
|
||||||
distclean-generic:
|
distclean-generic:
|
||||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||||
|
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||||
|
|
||||||
maintainer-clean-generic:
|
maintainer-clean-generic:
|
||||||
@echo "This command is intended for maintainers to use"
|
@echo "This command is intended for maintainers to use"
|
||||||
@@ -619,10 +789,33 @@ clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
|
|||||||
mostlyclean-am
|
mostlyclean-am
|
||||||
|
|
||||||
distclean: distclean-am
|
distclean: distclean-am
|
||||||
-rm -rf ./$(DEPDIR)
|
-rm -f ./$(DEPDIR)/direct_tcpip.Po
|
||||||
|
-rm -f ./$(DEPDIR)/scp.Po
|
||||||
|
-rm -f ./$(DEPDIR)/scp_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/scp_write.Po
|
||||||
|
-rm -f ./$(DEPDIR)/scp_write_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_RW_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_append.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_mkdir.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_mkdir_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_write.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_write_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_write_sliding.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftpdir.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftpdir_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/ssh2.Po
|
||||||
|
-rm -f ./$(DEPDIR)/ssh2_agent.Po
|
||||||
|
-rm -f ./$(DEPDIR)/ssh2_agent_forwarding.Po
|
||||||
|
-rm -f ./$(DEPDIR)/ssh2_echo.Po
|
||||||
|
-rm -f ./$(DEPDIR)/ssh2_exec.Po
|
||||||
|
-rm -f ./$(DEPDIR)/subsystem_netconf.Po
|
||||||
|
-rm -f ./$(DEPDIR)/tcpip-forward.Po
|
||||||
|
-rm -f ./$(DEPDIR)/x11.Po
|
||||||
-rm -f Makefile
|
-rm -f Makefile
|
||||||
distclean-am: clean-am distclean-compile distclean-generic \
|
distclean-am: clean-am distclean-compile distclean-generic \
|
||||||
distclean-hdr distclean-libtool distclean-tags
|
distclean-tags
|
||||||
|
|
||||||
dvi: dvi-am
|
dvi: dvi-am
|
||||||
|
|
||||||
@@ -630,22 +823,65 @@ dvi-am:
|
|||||||
|
|
||||||
html: html-am
|
html: html-am
|
||||||
|
|
||||||
|
html-am:
|
||||||
|
|
||||||
info: info-am
|
info: info-am
|
||||||
|
|
||||||
info-am:
|
info-am:
|
||||||
|
|
||||||
install-data-am:
|
install-data-am:
|
||||||
|
|
||||||
|
install-dvi: install-dvi-am
|
||||||
|
|
||||||
|
install-dvi-am:
|
||||||
|
|
||||||
install-exec-am:
|
install-exec-am:
|
||||||
|
|
||||||
|
install-html: install-html-am
|
||||||
|
|
||||||
|
install-html-am:
|
||||||
|
|
||||||
install-info: install-info-am
|
install-info: install-info-am
|
||||||
|
|
||||||
|
install-info-am:
|
||||||
|
|
||||||
install-man:
|
install-man:
|
||||||
|
|
||||||
|
install-pdf: install-pdf-am
|
||||||
|
|
||||||
|
install-pdf-am:
|
||||||
|
|
||||||
|
install-ps: install-ps-am
|
||||||
|
|
||||||
|
install-ps-am:
|
||||||
|
|
||||||
installcheck-am:
|
installcheck-am:
|
||||||
|
|
||||||
maintainer-clean: maintainer-clean-am
|
maintainer-clean: maintainer-clean-am
|
||||||
-rm -rf ./$(DEPDIR)
|
-rm -f ./$(DEPDIR)/direct_tcpip.Po
|
||||||
|
-rm -f ./$(DEPDIR)/scp.Po
|
||||||
|
-rm -f ./$(DEPDIR)/scp_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/scp_write.Po
|
||||||
|
-rm -f ./$(DEPDIR)/scp_write_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_RW_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_append.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_mkdir.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_mkdir_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_write.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_write_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftp_write_sliding.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftpdir.Po
|
||||||
|
-rm -f ./$(DEPDIR)/sftpdir_nonblock.Po
|
||||||
|
-rm -f ./$(DEPDIR)/ssh2.Po
|
||||||
|
-rm -f ./$(DEPDIR)/ssh2_agent.Po
|
||||||
|
-rm -f ./$(DEPDIR)/ssh2_agent_forwarding.Po
|
||||||
|
-rm -f ./$(DEPDIR)/ssh2_echo.Po
|
||||||
|
-rm -f ./$(DEPDIR)/ssh2_exec.Po
|
||||||
|
-rm -f ./$(DEPDIR)/subsystem_netconf.Po
|
||||||
|
-rm -f ./$(DEPDIR)/tcpip-forward.Po
|
||||||
|
-rm -f ./$(DEPDIR)/x11.Po
|
||||||
-rm -f Makefile
|
-rm -f Makefile
|
||||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||||
|
|
||||||
@@ -662,19 +898,26 @@ ps: ps-am
|
|||||||
|
|
||||||
ps-am:
|
ps-am:
|
||||||
|
|
||||||
uninstall-am: uninstall-info-am
|
uninstall-am:
|
||||||
|
|
||||||
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
|
.MAKE: install-am install-strip
|
||||||
clean-libtool clean-noinstPROGRAMS ctags distclean \
|
|
||||||
distclean-compile distclean-generic distclean-hdr \
|
.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \
|
||||||
|
clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \
|
||||||
|
ctags ctags-am distclean distclean-compile distclean-generic \
|
||||||
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
distclean-libtool distclean-tags distdir dvi dvi-am html \
|
||||||
html-am info info-am install install-am install-data \
|
html-am info info-am install install-am install-data \
|
||||||
install-data-am install-exec install-exec-am install-info \
|
install-data-am install-dvi install-dvi-am install-exec \
|
||||||
install-info-am install-man install-strip installcheck \
|
install-exec-am install-html install-html-am install-info \
|
||||||
|
install-info-am install-man install-pdf install-pdf-am \
|
||||||
|
install-ps install-ps-am install-strip installcheck \
|
||||||
installcheck-am installdirs maintainer-clean \
|
installcheck-am installdirs maintainer-clean \
|
||||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
||||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||||
tags uninstall uninstall-am uninstall-info-am
|
tags tags-am uninstall uninstall-am
|
||||||
|
|
||||||
|
.PRECIOUS: Makefile
|
||||||
|
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
# 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.
|
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||||
|
|||||||
+111
-59
@@ -15,10 +15,13 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#ifdef HAVE_STDLIB_H
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#ifdef HAVE_SYS_SELECT_H
|
#ifdef HAVE_SYS_SELECT_H
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -48,7 +51,7 @@ enum {
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int rc, sock = -1, listensock = -1, forwardsock = -1, i, auth = AUTH_NONE;
|
int rc, i, auth = AUTH_NONE;
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
socklen_t sinlen;
|
socklen_t sinlen;
|
||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
@@ -64,44 +67,65 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
char sockopt;
|
char sockopt;
|
||||||
|
SOCKET sock = INVALID_SOCKET;
|
||||||
|
SOCKET listensock = INVALID_SOCKET, forwardsock = INVALID_SOCKET;
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err != 0) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
int sockopt;
|
int sockopt, sock = -1;
|
||||||
|
int listensock = -1, forwardsock = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1)
|
if(argc > 1)
|
||||||
server_ip = argv[1];
|
server_ip = argv[1];
|
||||||
if (argc > 2)
|
if(argc > 2)
|
||||||
username = argv[2];
|
username = argv[2];
|
||||||
if (argc > 3)
|
if(argc > 3)
|
||||||
password = argv[3];
|
password = argv[3];
|
||||||
if (argc > 4)
|
if(argc > 4)
|
||||||
local_listenip = argv[4];
|
local_listenip = argv[4];
|
||||||
if (argc > 5)
|
if(argc > 5)
|
||||||
local_listenport = atoi(argv[5]);
|
local_listenport = atoi(argv[5]);
|
||||||
if (argc > 6)
|
if(argc > 6)
|
||||||
remote_desthost = argv[6];
|
remote_desthost = argv[6];
|
||||||
if (argc > 7)
|
if(argc > 7)
|
||||||
remote_destport = atoi(argv[7]);
|
remote_destport = atoi(argv[7]);
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Connect to SSH server */
|
/* Connect to SSH server */
|
||||||
sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
sock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
#ifdef WIN32
|
||||||
|
if(sock == INVALID_SOCKET) {
|
||||||
|
fprintf(stderr, "failed to open socket!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if(sock == -1) {
|
||||||
|
perror("socket");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
if (INADDR_NONE == (sin.sin_addr.s_addr = inet_addr(server_ip))) {
|
sin.sin_addr.s_addr = inet_addr(server_ip);
|
||||||
|
if(INADDR_NONE == sin.sin_addr.s_addr) {
|
||||||
perror("inet_addr");
|
perror("inet_addr");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
if (connect(sock, (struct sockaddr*)(&sin),
|
if(connect(sock, (struct sockaddr*)(&sin),
|
||||||
sizeof(struct sockaddr_in)) != 0) {
|
sizeof(struct sockaddr_in)) != 0) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -135,74 +159,97 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* check what authentication methods are available */
|
/* check what authentication methods are available */
|
||||||
userauthlist = libssh2_userauth_list(session, username, strlen(username));
|
userauthlist = libssh2_userauth_list(session, username, strlen(username));
|
||||||
printf("Authentication methods: %s\n", userauthlist);
|
fprintf(stderr, "Authentication methods: %s\n", userauthlist);
|
||||||
if (strstr(userauthlist, "password"))
|
if(strstr(userauthlist, "password"))
|
||||||
auth |= AUTH_PASSWORD;
|
auth |= AUTH_PASSWORD;
|
||||||
if (strstr(userauthlist, "publickey"))
|
if(strstr(userauthlist, "publickey"))
|
||||||
auth |= AUTH_PUBLICKEY;
|
auth |= AUTH_PUBLICKEY;
|
||||||
|
|
||||||
/* check for options */
|
/* check for options */
|
||||||
if(argc > 8) {
|
if(argc > 8) {
|
||||||
if ((auth & AUTH_PASSWORD) && !strcasecmp(argv[8], "-p"))
|
if((auth & AUTH_PASSWORD) && !strcasecmp(argv[8], "-p"))
|
||||||
auth = AUTH_PASSWORD;
|
auth = AUTH_PASSWORD;
|
||||||
if ((auth & AUTH_PUBLICKEY) && !strcasecmp(argv[8], "-k"))
|
if((auth & AUTH_PUBLICKEY) && !strcasecmp(argv[8], "-k"))
|
||||||
auth = AUTH_PUBLICKEY;
|
auth = AUTH_PUBLICKEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth & AUTH_PASSWORD) {
|
if(auth & AUTH_PASSWORD) {
|
||||||
if (libssh2_userauth_password(session, username, password)) {
|
if(libssh2_userauth_password(session, username, password)) {
|
||||||
fprintf(stderr, "Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else if (auth & AUTH_PUBLICKEY) {
|
}
|
||||||
if (libssh2_userauth_publickey_fromfile(session, username, keyfile1,
|
else if(auth & AUTH_PUBLICKEY) {
|
||||||
keyfile2, password)) {
|
if(libssh2_userauth_publickey_fromfile(session, username, keyfile1,
|
||||||
printf("\tAuthentication by public key failed!\n");
|
keyfile2, password)) {
|
||||||
|
fprintf(stderr, "\tAuthentication by public key failed!\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
printf("\tAuthentication by public key succeeded.\n");
|
fprintf(stderr, "\tAuthentication by public key succeeded.\n");
|
||||||
} else {
|
}
|
||||||
printf("No supported authentication methods found!\n");
|
else {
|
||||||
|
fprintf(stderr, "No supported authentication methods found!\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
listensock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
listensock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
#ifdef WIN32
|
||||||
|
if(listensock == INVALID_SOCKET) {
|
||||||
|
fprintf(stderr, "failed to open listen socket!\n");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if(listensock == -1) {
|
||||||
|
perror("socket");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(local_listenport);
|
sin.sin_port = htons(local_listenport);
|
||||||
if (INADDR_NONE == (sin.sin_addr.s_addr = inet_addr(local_listenip))) {
|
sin.sin_addr.s_addr = inet_addr(local_listenip);
|
||||||
|
if(INADDR_NONE == sin.sin_addr.s_addr) {
|
||||||
perror("inet_addr");
|
perror("inet_addr");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
sockopt = 1;
|
sockopt = 1;
|
||||||
setsockopt(listensock, SOL_SOCKET, SO_REUSEADDR, &sockopt, sizeof(sockopt));
|
setsockopt(listensock, SOL_SOCKET, SO_REUSEADDR, &sockopt,
|
||||||
sinlen=sizeof(sin);
|
sizeof(sockopt));
|
||||||
if (-1 == bind(listensock, (struct sockaddr *)&sin, sinlen)) {
|
sinlen = sizeof(sin);
|
||||||
|
if(-1 == bind(listensock, (struct sockaddr *)&sin, sinlen)) {
|
||||||
perror("bind");
|
perror("bind");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
if (-1 == listen(listensock, 2)) {
|
if(-1 == listen(listensock, 2)) {
|
||||||
perror("listen");
|
perror("listen");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Waiting for TCP connection on %s:%d...\n",
|
fprintf(stderr, "Waiting for TCP connection on %s:%d...\n",
|
||||||
inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
|
inet_ntoa(sin.sin_addr), ntohs(sin.sin_port));
|
||||||
|
|
||||||
forwardsock = accept(listensock, (struct sockaddr *)&sin, &sinlen);
|
forwardsock = accept(listensock, (struct sockaddr *)&sin, &sinlen);
|
||||||
if (-1 == forwardsock) {
|
#ifdef WIN32
|
||||||
|
if(forwardsock == INVALID_SOCKET) {
|
||||||
|
fprintf(stderr, "failed to accept forward socket!\n");
|
||||||
|
goto shutdown;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
if(forwardsock == -1) {
|
||||||
perror("accept");
|
perror("accept");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
shost = inet_ntoa(sin.sin_addr);
|
shost = inet_ntoa(sin.sin_addr);
|
||||||
sport = ntohs(sin.sin_port);
|
sport = ntohs(sin.sin_port);
|
||||||
|
|
||||||
printf("Forwarding connection from %s:%d here to remote %s:%d\n", shost,
|
fprintf(stderr, "Forwarding connection from %s:%d here to remote %s:%d\n",
|
||||||
sport, remote_desthost, remote_destport);
|
shost, sport, remote_desthost, remote_destport);
|
||||||
|
|
||||||
channel = libssh2_channel_direct_tcpip_ex(session, remote_desthost,
|
channel = libssh2_channel_direct_tcpip_ex(session, remote_desthost,
|
||||||
remote_destport, shost, sport);
|
remote_destport, shost, sport);
|
||||||
if (!channel) {
|
if(!channel) {
|
||||||
fprintf(stderr, "Could not open the direct-tcpip channel!\n"
|
fprintf(stderr, "Could not open the direct-tcpip channel!\n"
|
||||||
"(Note that this can be a problem at the server!"
|
"(Note that this can be a problem at the server!"
|
||||||
" Please review the server logs.)\n");
|
" Please review the server logs.)\n");
|
||||||
@@ -212,54 +259,59 @@ int main(int argc, char *argv[])
|
|||||||
/* Must use non-blocking IO hereafter due to the current libssh2 API */
|
/* Must use non-blocking IO hereafter due to the current libssh2 API */
|
||||||
libssh2_session_set_blocking(session, 0);
|
libssh2_session_set_blocking(session, 0);
|
||||||
|
|
||||||
while (1) {
|
while(1) {
|
||||||
FD_ZERO(&fds);
|
FD_ZERO(&fds);
|
||||||
FD_SET(forwardsock, &fds);
|
FD_SET(forwardsock, &fds);
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 0;
|
||||||
tv.tv_usec = 100000;
|
tv.tv_usec = 100000;
|
||||||
rc = select(forwardsock + 1, &fds, NULL, NULL, &tv);
|
rc = select(forwardsock + 1, &fds, NULL, NULL, &tv);
|
||||||
if (-1 == rc) {
|
if(-1 == rc) {
|
||||||
perror("select");
|
perror("select");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
if (rc && FD_ISSET(forwardsock, &fds)) {
|
if(rc && FD_ISSET(forwardsock, &fds)) {
|
||||||
len = recv(forwardsock, buf, sizeof(buf), 0);
|
len = recv(forwardsock, buf, sizeof(buf), 0);
|
||||||
if (len < 0) {
|
if(len < 0) {
|
||||||
perror("read");
|
perror("read");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
} else if (0 == len) {
|
}
|
||||||
printf("The client at %s:%d disconnected!\n", shost, sport);
|
else if(0 == len) {
|
||||||
|
fprintf(stderr, "The client at %s:%d disconnected!\n", shost,
|
||||||
|
sport);
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
wr = 0;
|
wr = 0;
|
||||||
do {
|
while(wr < len) {
|
||||||
i = libssh2_channel_write(channel, buf, len);
|
i = libssh2_channel_write(channel, buf + wr, len - wr);
|
||||||
if (i < 0) {
|
if(LIBSSH2_ERROR_EAGAIN == i) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(i < 0) {
|
||||||
fprintf(stderr, "libssh2_channel_write: %d\n", i);
|
fprintf(stderr, "libssh2_channel_write: %d\n", i);
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
wr += i;
|
wr += i;
|
||||||
} while(i > 0 && wr < len);
|
}
|
||||||
}
|
}
|
||||||
while (1) {
|
while(1) {
|
||||||
len = libssh2_channel_read(channel, buf, sizeof(buf));
|
len = libssh2_channel_read(channel, buf, sizeof(buf));
|
||||||
if (LIBSSH2_ERROR_EAGAIN == len)
|
if(LIBSSH2_ERROR_EAGAIN == len)
|
||||||
break;
|
break;
|
||||||
else if (len < 0) {
|
else if(len < 0) {
|
||||||
fprintf(stderr, "libssh2_channel_read: %d", (int)len);
|
fprintf(stderr, "libssh2_channel_read: %d", (int)len);
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
wr = 0;
|
wr = 0;
|
||||||
while (wr < len) {
|
while(wr < len) {
|
||||||
i = send(forwardsock, buf + wr, len - wr, 0);
|
i = send(forwardsock, buf + wr, len - wr, 0);
|
||||||
if (i <= 0) {
|
if(i <= 0) {
|
||||||
perror("write");
|
perror("write");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
wr += i;
|
wr += i;
|
||||||
}
|
}
|
||||||
if (libssh2_channel_eof(channel)) {
|
if(libssh2_channel_eof(channel)) {
|
||||||
printf("The server at %s:%d disconnected!\n",
|
fprintf(stderr, "The server at %s:%d disconnected!\n",
|
||||||
remote_desthost, remote_destport);
|
remote_desthost, remote_destport);
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -274,7 +326,7 @@ shutdown:
|
|||||||
close(forwardsock);
|
close(forwardsock);
|
||||||
close(listensock);
|
close(listensock);
|
||||||
#endif
|
#endif
|
||||||
if (channel)
|
if(channel)
|
||||||
libssh2_channel_free(channel);
|
libssh2_channel_free(channel);
|
||||||
libssh2_session_disconnect(session, "Client disconnecting normally");
|
libssh2_session_disconnect(session, "Client disconnecting normally");
|
||||||
libssh2_session_free(session);
|
libssh2_session_free(session);
|
||||||
|
|||||||
@@ -21,6 +21,10 @@
|
|||||||
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
/* Define to 1 if you have the <arpa/inet.h> header file. */
|
||||||
#undef HAVE_ARPA_INET_H
|
#undef HAVE_ARPA_INET_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the declaration of `SecureZeroMemory', and to 0 if
|
||||||
|
you don't. */
|
||||||
|
#undef HAVE_DECL_SECUREZEROMEMORY
|
||||||
|
|
||||||
/* disabled non-blocking sockets */
|
/* disabled non-blocking sockets */
|
||||||
#undef HAVE_DISABLED_NONBLOCKING
|
#undef HAVE_DISABLED_NONBLOCKING
|
||||||
|
|
||||||
@@ -51,9 +55,18 @@
|
|||||||
/* use Ioctlsocket() for non-blocking sockets */
|
/* use Ioctlsocket() for non-blocking sockets */
|
||||||
#undef HAVE_IOCTLSOCKET_CASE
|
#undef HAVE_IOCTLSOCKET_CASE
|
||||||
|
|
||||||
|
/* Define if you have the bcrypt library. */
|
||||||
|
#undef HAVE_LIBBCRYPT
|
||||||
|
|
||||||
|
/* Define if you have the crypt32 library. */
|
||||||
|
#undef HAVE_LIBCRYPT32
|
||||||
|
|
||||||
/* Define if you have the gcrypt library. */
|
/* Define if you have the gcrypt library. */
|
||||||
#undef HAVE_LIBGCRYPT
|
#undef HAVE_LIBGCRYPT
|
||||||
|
|
||||||
|
/* Define if you have the mbedcrypto library. */
|
||||||
|
#undef HAVE_LIBMBEDCRYPTO
|
||||||
|
|
||||||
/* Define if you have the ssl library. */
|
/* Define if you have the ssl library. */
|
||||||
#undef HAVE_LIBSSL
|
#undef HAVE_LIBSSL
|
||||||
|
|
||||||
@@ -66,9 +79,18 @@
|
|||||||
/* Define to 1 if you have the <memory.h> header file. */
|
/* Define to 1 if you have the <memory.h> header file. */
|
||||||
#undef HAVE_MEMORY_H
|
#undef HAVE_MEMORY_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `memset_s' function. */
|
||||||
|
#undef HAVE_MEMSET_S
|
||||||
|
|
||||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||||
#undef HAVE_NETINET_IN_H
|
#undef HAVE_NETINET_IN_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <ntdef.h> header file. */
|
||||||
|
#undef HAVE_NTDEF_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the <ntstatus.h> header file. */
|
||||||
|
#undef HAVE_NTSTATUS_H
|
||||||
|
|
||||||
/* use O_NONBLOCK for non-blocking sockets */
|
/* use O_NONBLOCK for non-blocking sockets */
|
||||||
#undef HAVE_O_NONBLOCK
|
#undef HAVE_O_NONBLOCK
|
||||||
|
|
||||||
@@ -138,6 +160,9 @@
|
|||||||
/* to make a symbol visible */
|
/* to make a symbol visible */
|
||||||
#undef LIBSSH2_API
|
#undef LIBSSH2_API
|
||||||
|
|
||||||
|
/* Enable clearing of memory before being freed */
|
||||||
|
#undef LIBSSH2_CLEAR_MEMORY
|
||||||
|
|
||||||
/* Enable "none" cipher -- NOT RECOMMENDED */
|
/* Enable "none" cipher -- NOT RECOMMENDED */
|
||||||
#undef LIBSSH2_CRYPT_NONE
|
#undef LIBSSH2_CRYPT_NONE
|
||||||
|
|
||||||
@@ -153,8 +178,16 @@
|
|||||||
/* Enable "none" MAC -- NOT RECOMMENDED */
|
/* Enable "none" MAC -- NOT RECOMMENDED */
|
||||||
#undef LIBSSH2_MAC_NONE
|
#undef LIBSSH2_MAC_NONE
|
||||||
|
|
||||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
/* Use mbedtls */
|
||||||
*/
|
#undef LIBSSH2_MBEDTLS
|
||||||
|
|
||||||
|
/* Use openssl */
|
||||||
|
#undef LIBSSH2_OPENSSL
|
||||||
|
|
||||||
|
/* Use wincng */
|
||||||
|
#undef LIBSSH2_WINCNG
|
||||||
|
|
||||||
|
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||||
#undef LT_OBJDIR
|
#undef LT_OBJDIR
|
||||||
|
|
||||||
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */
|
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */
|
||||||
@@ -207,6 +240,11 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Enable large inode numbers on Mac OS X 10.5. */
|
||||||
|
#ifndef _DARWIN_USE_64_BIT_INODE
|
||||||
|
# define _DARWIN_USE_64_BIT_INODE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||||
#undef _FILE_OFFSET_BITS
|
#undef _FILE_OFFSET_BITS
|
||||||
|
|
||||||
@@ -221,3 +259,6 @@
|
|||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
#undef inline
|
#undef inline
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||||
|
#undef size_t
|
||||||
|
|||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Headers */
|
||||||
|
#cmakedefine HAVE_UNISTD_H
|
||||||
|
#cmakedefine HAVE_INTTYPES_H
|
||||||
|
#cmakedefine HAVE_STDLIB_H
|
||||||
|
#cmakedefine HAVE_SYS_SELECT_H
|
||||||
|
#cmakedefine HAVE_SYS_SOCKET_H
|
||||||
|
#cmakedefine HAVE_SYS_TIME_H
|
||||||
|
#cmakedefine HAVE_ARPA_INET_H
|
||||||
|
#cmakedefine HAVE_NETINET_IN_H
|
||||||
|
#cmakedefine HAVE_WINSOCK2_H
|
||||||
|
|
||||||
|
/* Functions */
|
||||||
|
#cmakedefine HAVE_STRCASECMP
|
||||||
|
#cmakedefine HAVE__STRICMP
|
||||||
|
#cmakedefine HAVE_SNPRINTF
|
||||||
|
#cmakedefine HAVE__SNPRINTF
|
||||||
|
|
||||||
|
/* Workaround for platforms without POSIX strcasecmp (e.g. Windows) */
|
||||||
|
#ifndef HAVE_STRCASECMP
|
||||||
|
# ifdef HAVE__STRICMP
|
||||||
|
# define strcasecmp _stricmp
|
||||||
|
# define HAVE_STRCASECMP
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Symbols */
|
||||||
|
#cmakedefine HAVE___FUNC__
|
||||||
|
#cmakedefine HAVE___FUNCTION__
|
||||||
|
|
||||||
|
/* Workaround for platforms without C90 __func__ */
|
||||||
|
#ifndef HAVE___FUNC__
|
||||||
|
# ifdef HAVE___FUNCTION__
|
||||||
|
# define __func__ __FUNCTION__
|
||||||
|
# define HAVE___FUNC__
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
+37
-28
@@ -38,37 +38,43 @@ int main(int argc, char *argv[])
|
|||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
LIBSSH2_SESSION *session;
|
LIBSSH2_SESSION *session;
|
||||||
LIBSSH2_CHANNEL *channel;
|
LIBSSH2_CHANNEL *channel;
|
||||||
const char *username="username";
|
const char *username = "username";
|
||||||
const char *password="password";
|
const char *password = "password";
|
||||||
const char *scppath="/tmp/TEST";
|
const char *scppath = "/tmp/TEST";
|
||||||
struct stat fileinfo;
|
libssh2_struct_stat fileinfo;
|
||||||
int rc;
|
int rc;
|
||||||
off_t got=0;
|
libssh2_struct_stat_size got = 0;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err != 0) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if(argc > 1) {
|
||||||
hostaddr = inet_addr(argv[1]);
|
hostaddr = inet_addr(argv[1]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hostaddr = htonl(0x7F000001);
|
hostaddr = htonl(0x7F000001);
|
||||||
}
|
}
|
||||||
if (argc > 2) {
|
if(argc > 2) {
|
||||||
username = argv[2];
|
username = argv[2];
|
||||||
}
|
}
|
||||||
if (argc > 3) {
|
if(argc > 3) {
|
||||||
password = argv[3];
|
password = argv[3];
|
||||||
}
|
}
|
||||||
if (argc > 4) {
|
if(argc > 4) {
|
||||||
scppath = argv[4];
|
scppath = argv[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,8 +87,8 @@ int main(int argc, char *argv[])
|
|||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
sin.sin_addr.s_addr = hostaddr;
|
sin.sin_addr.s_addr = hostaddr;
|
||||||
if (connect(sock, (struct sockaddr*)(&sin),
|
if(connect(sock, (struct sockaddr*)(&sin),
|
||||||
sizeof(struct sockaddr_in)) != 0) {
|
sizeof(struct sockaddr_in)) != 0) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -114,27 +120,29 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (auth_pw) {
|
if(auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
if (libssh2_userauth_password(session, username, password)) {
|
if(libssh2_userauth_password(session, username, password)) {
|
||||||
fprintf(stderr, "Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Or by public key */
|
/* Or by public key */
|
||||||
if (libssh2_userauth_publickey_fromfile(session, username,
|
#define HOME_DIR "/home/username/"
|
||||||
"/home/username/.ssh/id_rsa.pub",
|
if(libssh2_userauth_publickey_fromfile(session, username,
|
||||||
"/home/username/.ssh/id_rsa",
|
HOME_DIR ".ssh/id_rsa.pub",
|
||||||
password)) {
|
HOME_DIR ".ssh/id_rsa",
|
||||||
|
password)) {
|
||||||
fprintf(stderr, "\tAuthentication by public key failed\n");
|
fprintf(stderr, "\tAuthentication by public key failed\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Request a file via SCP */
|
/* Request a file via SCP */
|
||||||
channel = libssh2_scp_recv(session, scppath, &fileinfo);
|
channel = libssh2_scp_recv2(session, scppath, &fileinfo);
|
||||||
|
|
||||||
if (!channel) {
|
if(!channel) {
|
||||||
fprintf(stderr, "Unable to open a session: %d\n",
|
fprintf(stderr, "Unable to open a session: %d\n",
|
||||||
libssh2_session_last_errno(session));
|
libssh2_session_last_errno(session));
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
@@ -143,10 +151,10 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
while(got < fileinfo.st_size) {
|
while(got < fileinfo.st_size) {
|
||||||
char mem[1024];
|
char mem[1024];
|
||||||
int amount=sizeof(mem);
|
int amount = sizeof(mem);
|
||||||
|
|
||||||
if((fileinfo.st_size -got) < amount) {
|
if((fileinfo.st_size -got) < amount) {
|
||||||
amount = fileinfo.st_size -got;
|
amount = (int)(fileinfo.st_size -got);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = libssh2_channel_read(channel, mem, amount);
|
rc = libssh2_channel_read(channel, mem, amount);
|
||||||
@@ -165,7 +173,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
shutdown:
|
shutdown:
|
||||||
|
|
||||||
libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing");
|
libssh2_session_disconnect(session,
|
||||||
|
"Normal Shutdown, Thank you for playing");
|
||||||
libssh2_session_free(session);
|
libssh2_session_free(session);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|||||||
+64
-46
@@ -38,12 +38,14 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_GETTIMEOFDAY
|
||||||
/* diff in ms */
|
/* diff in ms */
|
||||||
static long tvdiff(struct timeval newer, struct timeval older)
|
static long tvdiff(struct timeval newer, struct timeval older)
|
||||||
{
|
{
|
||||||
return (newer.tv_sec-older.tv_sec)*1000+
|
return (newer.tv_sec-older.tv_sec)*1000+
|
||||||
(newer.tv_usec-older.tv_usec)/1000;
|
(newer.tv_usec-older.tv_usec)/1000;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int waitsocket(int socket_fd, LIBSSH2_SESSION *session)
|
static int waitsocket(int socket_fd, LIBSSH2_SESSION *session)
|
||||||
{
|
{
|
||||||
@@ -83,42 +85,50 @@ int main(int argc, char *argv[])
|
|||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
LIBSSH2_SESSION *session;
|
LIBSSH2_SESSION *session;
|
||||||
LIBSSH2_CHANNEL *channel;
|
LIBSSH2_CHANNEL *channel;
|
||||||
const char *username="username";
|
const char *username = "username";
|
||||||
const char *password="password";
|
const char *password = "password";
|
||||||
const char *scppath="/tmp/TEST";
|
const char *scppath = "/tmp/TEST";
|
||||||
struct stat fileinfo;
|
libssh2_struct_stat fileinfo;
|
||||||
|
#ifdef HAVE_GETTIMEOFDAY
|
||||||
struct timeval start;
|
struct timeval start;
|
||||||
struct timeval end;
|
struct timeval end;
|
||||||
int rc;
|
|
||||||
int total = 0;
|
|
||||||
long time_ms;
|
long time_ms;
|
||||||
|
#endif
|
||||||
|
int rc;
|
||||||
int spin = 0;
|
int spin = 0;
|
||||||
off_t got=0;
|
libssh2_struct_stat_size got = 0;
|
||||||
|
libssh2_struct_stat_size total = 0;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err != 0) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if(argc > 1) {
|
||||||
hostaddr = inet_addr(argv[1]);
|
hostaddr = inet_addr(argv[1]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hostaddr = htonl(0x7F000001);
|
hostaddr = htonl(0x7F000001);
|
||||||
}
|
}
|
||||||
if (argc > 2) {
|
if(argc > 2) {
|
||||||
username = argv[2];
|
username = argv[2];
|
||||||
}
|
}
|
||||||
if (argc > 3) {
|
if(argc > 3) {
|
||||||
password = argv[3];
|
password = argv[3];
|
||||||
}
|
}
|
||||||
if (argc > 4) {
|
if(argc > 4) {
|
||||||
scppath = argv[4];
|
scppath = argv[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc != 0) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -131,27 +141,29 @@ int main(int argc, char *argv[])
|
|||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
sin.sin_addr.s_addr = hostaddr;
|
sin.sin_addr.s_addr = hostaddr;
|
||||||
if (connect(sock, (struct sockaddr*)(&sin), sizeof(struct sockaddr_in)) != 0) {
|
if(connect(sock, (struct sockaddr*)(&sin), sizeof(struct sockaddr_in))) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a session instance */
|
/* Create a session instance */
|
||||||
session = libssh2_session_init();
|
session = libssh2_session_init();
|
||||||
if (!session)
|
if(!session)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Since we have set non-blocking, tell libssh2 we are non-blocking */
|
/* Since we have set non-blocking, tell libssh2 we are non-blocking */
|
||||||
libssh2_session_set_blocking(session, 0);
|
libssh2_session_set_blocking(session, 0);
|
||||||
|
|
||||||
|
#ifdef HAVE_GETTIMEOFDAY
|
||||||
gettimeofday(&start, NULL);
|
gettimeofday(&start, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||||
* and setup crypto, compression, and MAC layers
|
* and setup crypto, compression, and MAC layers
|
||||||
*/
|
*/
|
||||||
while ((rc = libssh2_session_handshake(session, sock)) ==
|
while((rc = libssh2_session_handshake(session, sock)) ==
|
||||||
LIBSSH2_ERROR_EAGAIN);
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if(rc) {
|
||||||
fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
|
fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -168,24 +180,25 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (auth_pw) {
|
if(auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
while ((rc = libssh2_userauth_password(session, username, password)) ==
|
while((rc = libssh2_userauth_password(session, username, password)) ==
|
||||||
LIBSSH2_ERROR_EAGAIN);
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if(rc) {
|
||||||
fprintf(stderr, "Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Or by public key */
|
/* Or by public key */
|
||||||
while ((rc = libssh2_userauth_publickey_fromfile(session, username,
|
while((rc = libssh2_userauth_publickey_fromfile(session, username,
|
||||||
"/home/username/"
|
"/home/username/"
|
||||||
".ssh/id_rsa.pub",
|
".ssh/id_rsa.pub",
|
||||||
"/home/username/"
|
"/home/username/"
|
||||||
".ssh/id_rsa",
|
".ssh/id_rsa",
|
||||||
password)) ==
|
password)) ==
|
||||||
LIBSSH2_ERROR_EAGAIN);
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if(rc) {
|
||||||
fprintf(stderr, "\tAuthentication by public key failed\n");
|
fprintf(stderr, "\tAuthentication by public key failed\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -196,11 +209,11 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Request a file via SCP */
|
/* Request a file via SCP */
|
||||||
fprintf(stderr, "libssh2_scp_recv()!\n");
|
fprintf(stderr, "libssh2_scp_recv2()!\n");
|
||||||
do {
|
do {
|
||||||
channel = libssh2_scp_recv(session, scppath, &fileinfo);
|
channel = libssh2_scp_recv2(session, scppath, &fileinfo);
|
||||||
|
|
||||||
if (!channel) {
|
if(!channel) {
|
||||||
if(libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN) {
|
if(libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN) {
|
||||||
char *err_msg;
|
char *err_msg;
|
||||||
|
|
||||||
@@ -213,7 +226,7 @@ int main(int argc, char *argv[])
|
|||||||
waitsocket(sock, session);
|
waitsocket(sock, session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!channel);
|
} while(!channel);
|
||||||
fprintf(stderr, "libssh2_scp_recv() is done, now receive data!\n");
|
fprintf(stderr, "libssh2_scp_recv() is done, now receive data!\n");
|
||||||
|
|
||||||
while(got < fileinfo.st_size) {
|
while(got < fileinfo.st_size) {
|
||||||
@@ -221,22 +234,22 @@ int main(int argc, char *argv[])
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
int amount=sizeof(mem);
|
int amount = sizeof(mem);
|
||||||
|
|
||||||
if ((fileinfo.st_size -got) < amount) {
|
if((fileinfo.st_size -got) < amount) {
|
||||||
amount = fileinfo.st_size - got;
|
amount = (int)(fileinfo.st_size - got);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* loop until we block */
|
/* loop until we block */
|
||||||
rc = libssh2_channel_read(channel, mem, amount);
|
rc = libssh2_channel_read(channel, mem, amount);
|
||||||
if (rc > 0) {
|
if(rc > 0) {
|
||||||
write(1, mem, rc);
|
write(1, mem, rc);
|
||||||
got += rc;
|
got += rc;
|
||||||
total += rc;
|
total += rc;
|
||||||
}
|
}
|
||||||
} while (rc > 0);
|
} while(rc > 0);
|
||||||
|
|
||||||
if ((rc == LIBSSH2_ERROR_EAGAIN) && (got < fileinfo.st_size)) {
|
if((rc == LIBSSH2_ERROR_EAGAIN) && (got < fileinfo.st_size)) {
|
||||||
/* this is due to blocking that would occur otherwise
|
/* this is due to blocking that would occur otherwise
|
||||||
so we loop on this condition */
|
so we loop on this condition */
|
||||||
|
|
||||||
@@ -247,11 +260,16 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_GETTIMEOFDAY
|
||||||
gettimeofday(&end, NULL);
|
gettimeofday(&end, NULL);
|
||||||
|
|
||||||
time_ms = tvdiff(end, start);
|
time_ms = tvdiff(end, start);
|
||||||
printf("Got %d bytes in %ld ms = %.1f bytes/sec spin: %d\n", total,
|
fprintf(stderr, "Got %ld bytes in %ld ms = %.1f bytes/sec spin: %d\n",
|
||||||
time_ms, total/(time_ms/1000.0), spin );
|
(long)total,
|
||||||
|
time_ms, total/(time_ms/1000.0), spin);
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "Got %ld bytes spin: %d\n", (long)total, spin);
|
||||||
|
#endif
|
||||||
|
|
||||||
libssh2_channel_free(channel);
|
libssh2_channel_free(channel);
|
||||||
channel = NULL;
|
channel = NULL;
|
||||||
|
|||||||
+38
-30
@@ -38,10 +38,10 @@ int main(int argc, char *argv[])
|
|||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
LIBSSH2_SESSION *session = NULL;
|
LIBSSH2_SESSION *session = NULL;
|
||||||
LIBSSH2_CHANNEL *channel;
|
LIBSSH2_CHANNEL *channel;
|
||||||
const char *username="username";
|
const char *username = "username";
|
||||||
const char *password="password";
|
const char *password = "password";
|
||||||
const char *loclfile="scp_write.c";
|
const char *loclfile = "scp_write.c";
|
||||||
const char *scppath="/tmp/TEST";
|
const char *scppath = "/tmp/TEST";
|
||||||
FILE *local;
|
FILE *local;
|
||||||
int rc;
|
int rc;
|
||||||
char mem[1024];
|
char mem[1024];
|
||||||
@@ -51,36 +51,42 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err != 0) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if(argc > 1) {
|
||||||
hostaddr = inet_addr(argv[1]);
|
hostaddr = inet_addr(argv[1]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hostaddr = htonl(0x7F000001);
|
hostaddr = htonl(0x7F000001);
|
||||||
}
|
}
|
||||||
if (argc > 2) {
|
if(argc > 2) {
|
||||||
username = argv[2];
|
username = argv[2];
|
||||||
}
|
}
|
||||||
if (argc > 3) {
|
if(argc > 3) {
|
||||||
password = argv[3];
|
password = argv[3];
|
||||||
}
|
}
|
||||||
if(argc > 4) {
|
if(argc > 4) {
|
||||||
loclfile = argv[4];
|
loclfile = argv[4];
|
||||||
}
|
}
|
||||||
if (argc > 5) {
|
if(argc > 5) {
|
||||||
scppath = argv[5];
|
scppath = argv[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc != 0) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
local = fopen(loclfile, "rb");
|
local = fopen(loclfile, "rb");
|
||||||
if (!local) {
|
if(!local) {
|
||||||
fprintf(stderr, "Can't open local file %s\n", loclfile);
|
fprintf(stderr, "Can't open local file %s\n", loclfile);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -100,8 +106,8 @@ int main(int argc, char *argv[])
|
|||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
sin.sin_addr.s_addr = hostaddr;
|
sin.sin_addr.s_addr = hostaddr;
|
||||||
if (connect(sock, (struct sockaddr*)(&sin),
|
if(connect(sock, (struct sockaddr*)(&sin),
|
||||||
sizeof(struct sockaddr_in)) != 0) {
|
sizeof(struct sockaddr_in)) != 0) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -133,18 +139,20 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (auth_pw) {
|
if(auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
if (libssh2_userauth_password(session, username, password)) {
|
if(libssh2_userauth_password(session, username, password)) {
|
||||||
fprintf(stderr, "Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Or by public key */
|
/* Or by public key */
|
||||||
if (libssh2_userauth_publickey_fromfile(session, username,
|
#define HOME "/home/username/"
|
||||||
"/home/username/.ssh/id_rsa.pub",
|
if(libssh2_userauth_publickey_fromfile(session, username,
|
||||||
"/home/username/.ssh/id_rsa",
|
HOME ".ssh/id_rsa.pub",
|
||||||
password)) {
|
HOME ".ssh/id_rsa",
|
||||||
|
password)) {
|
||||||
fprintf(stderr, "\tAuthentication by public key failed\n");
|
fprintf(stderr, "\tAuthentication by public key failed\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -154,7 +162,7 @@ int main(int argc, char *argv[])
|
|||||||
channel = libssh2_scp_send(session, scppath, fileinfo.st_mode & 0777,
|
channel = libssh2_scp_send(session, scppath, fileinfo.st_mode & 0777,
|
||||||
(unsigned long)fileinfo.st_size);
|
(unsigned long)fileinfo.st_size);
|
||||||
|
|
||||||
if (!channel) {
|
if(!channel) {
|
||||||
char *errmsg;
|
char *errmsg;
|
||||||
int errlen;
|
int errlen;
|
||||||
int err = libssh2_session_last_error(session, &errmsg, &errlen, 0);
|
int err = libssh2_session_last_error(session, &errmsg, &errlen, 0);
|
||||||
@@ -165,7 +173,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "SCP session waiting to send file\n");
|
fprintf(stderr, "SCP session waiting to send file\n");
|
||||||
do {
|
do {
|
||||||
nread = fread(mem, 1, sizeof(mem), local);
|
nread = fread(mem, 1, sizeof(mem), local);
|
||||||
if (nread <= 0) {
|
if(nread <= 0) {
|
||||||
/* end of file */
|
/* end of file */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -174,7 +182,7 @@ int main(int argc, char *argv[])
|
|||||||
do {
|
do {
|
||||||
/* write the same data over and over, until error or completion */
|
/* write the same data over and over, until error or completion */
|
||||||
rc = libssh2_channel_write(channel, ptr, nread);
|
rc = libssh2_channel_write(channel, ptr, nread);
|
||||||
if (rc < 0) {
|
if(rc < 0) {
|
||||||
fprintf(stderr, "ERROR %d\n", rc);
|
fprintf(stderr, "ERROR %d\n", rc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -183,9 +191,9 @@ int main(int argc, char *argv[])
|
|||||||
ptr += rc;
|
ptr += rc;
|
||||||
nread -= rc;
|
nread -= rc;
|
||||||
}
|
}
|
||||||
} while (nread);
|
} while(nread);
|
||||||
|
|
||||||
} while (1);
|
} while(1);
|
||||||
|
|
||||||
fprintf(stderr, "Sending EOF\n");
|
fprintf(stderr, "Sending EOF\n");
|
||||||
libssh2_channel_send_eof(channel);
|
libssh2_channel_send_eof(channel);
|
||||||
@@ -202,7 +210,7 @@ int main(int argc, char *argv[])
|
|||||||
shutdown:
|
shutdown:
|
||||||
|
|
||||||
if(session) {
|
if(session) {
|
||||||
libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing");
|
libssh2_session_disconnect(session, "Normal Shutdown");
|
||||||
libssh2_session_free(session);
|
libssh2_session_free(session);
|
||||||
}
|
}
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -210,7 +218,7 @@ int main(int argc, char *argv[])
|
|||||||
#else
|
#else
|
||||||
close(sock);
|
close(sock);
|
||||||
#endif
|
#endif
|
||||||
if (local)
|
if(local)
|
||||||
fclose(local);
|
fclose(local);
|
||||||
fprintf(stderr, "all done\n");
|
fprintf(stderr, "all done\n");
|
||||||
|
|
||||||
|
|||||||
@@ -73,10 +73,10 @@ int main(int argc, char *argv[])
|
|||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
LIBSSH2_SESSION *session = NULL;
|
LIBSSH2_SESSION *session = NULL;
|
||||||
LIBSSH2_CHANNEL *channel;
|
LIBSSH2_CHANNEL *channel;
|
||||||
const char *username="username";
|
const char *username = "username";
|
||||||
const char *password="password";
|
const char *password = "password";
|
||||||
const char *loclfile="scp_write.c";
|
const char *loclfile = "scp_write.c";
|
||||||
const char *scppath="/tmp/TEST";
|
const char *scppath = "/tmp/TEST";
|
||||||
FILE *local;
|
FILE *local;
|
||||||
int rc;
|
int rc;
|
||||||
char mem[1024*100];
|
char mem[1024*100];
|
||||||
@@ -90,36 +90,42 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err != 0) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if(argc > 1) {
|
||||||
hostaddr = inet_addr(argv[1]);
|
hostaddr = inet_addr(argv[1]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hostaddr = htonl(0x7F000001);
|
hostaddr = htonl(0x7F000001);
|
||||||
}
|
}
|
||||||
if (argc > 2) {
|
if(argc > 2) {
|
||||||
username = argv[2];
|
username = argv[2];
|
||||||
}
|
}
|
||||||
if (argc > 3) {
|
if(argc > 3) {
|
||||||
password = argv[3];
|
password = argv[3];
|
||||||
}
|
}
|
||||||
if(argc > 4) {
|
if(argc > 4) {
|
||||||
loclfile = argv[4];
|
loclfile = argv[4];
|
||||||
}
|
}
|
||||||
if (argc > 5) {
|
if(argc > 5) {
|
||||||
scppath = argv[5];
|
scppath = argv[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc != 0) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
local = fopen(loclfile, "rb");
|
local = fopen(loclfile, "rb");
|
||||||
if (!local) {
|
if(!local) {
|
||||||
fprintf(stderr, "Can't local file %s\n", loclfile);
|
fprintf(stderr, "Can't local file %s\n", loclfile);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -135,8 +141,8 @@ int main(int argc, char *argv[])
|
|||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
sin.sin_addr.s_addr = hostaddr;
|
sin.sin_addr.s_addr = hostaddr;
|
||||||
if (connect(sock, (struct sockaddr*)(&sin),
|
if(connect(sock, (struct sockaddr*)(&sin),
|
||||||
sizeof(struct sockaddr_in)) != 0) {
|
sizeof(struct sockaddr_in)) != 0) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -153,8 +159,8 @@ int main(int argc, char *argv[])
|
|||||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||||
* and setup crypto, compression, and MAC layers
|
* and setup crypto, compression, and MAC layers
|
||||||
*/
|
*/
|
||||||
while ((rc = libssh2_session_handshake(session, sock))
|
while((rc = libssh2_session_handshake(session, sock))
|
||||||
== LIBSSH2_ERROR_EAGAIN);
|
== LIBSSH2_ERROR_EAGAIN);
|
||||||
if(rc) {
|
if(rc) {
|
||||||
fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
|
fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
|
||||||
return -1;
|
return -1;
|
||||||
@@ -172,21 +178,24 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (auth_pw) {
|
if(auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
while ((rc = libssh2_userauth_password(session, username, password)) ==
|
while((rc = libssh2_userauth_password(session, username, password)) ==
|
||||||
LIBSSH2_ERROR_EAGAIN);
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if(rc) {
|
||||||
fprintf(stderr, "Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Or by public key */
|
/* Or by public key */
|
||||||
while ((rc = libssh2_userauth_publickey_fromfile(session, username,
|
#define HOME "/home/username/"
|
||||||
"/home/username/.ssh/id_rsa.pub",
|
while((rc = libssh2_userauth_publickey_fromfile(session, username,
|
||||||
"/home/username/.ssh/id_rsa",
|
HOME ".ssh/id_rsa.pub",
|
||||||
password)) == LIBSSH2_ERROR_EAGAIN);
|
HOME ".ssh/id_rsa",
|
||||||
if (rc) {
|
password)) ==
|
||||||
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
|
if(rc) {
|
||||||
fprintf(stderr, "\tAuthentication by public key failed\n");
|
fprintf(stderr, "\tAuthentication by public key failed\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -197,21 +206,21 @@ int main(int argc, char *argv[])
|
|||||||
channel = libssh2_scp_send(session, scppath, fileinfo.st_mode & 0777,
|
channel = libssh2_scp_send(session, scppath, fileinfo.st_mode & 0777,
|
||||||
(unsigned long)fileinfo.st_size);
|
(unsigned long)fileinfo.st_size);
|
||||||
|
|
||||||
if ((!channel) && (libssh2_session_last_errno(session) !=
|
if((!channel) && (libssh2_session_last_errno(session) !=
|
||||||
LIBSSH2_ERROR_EAGAIN)) {
|
LIBSSH2_ERROR_EAGAIN)) {
|
||||||
char *err_msg;
|
char *err_msg;
|
||||||
|
|
||||||
libssh2_session_last_error(session, &err_msg, NULL, 0);
|
libssh2_session_last_error(session, &err_msg, NULL, 0);
|
||||||
fprintf(stderr, "%s\n", err_msg);
|
fprintf(stderr, "%s\n", err_msg);
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} while (!channel);
|
} while(!channel);
|
||||||
|
|
||||||
fprintf(stderr, "SCP session waiting to send file\n");
|
fprintf(stderr, "SCP session waiting to send file\n");
|
||||||
start = time(NULL);
|
start = time(NULL);
|
||||||
do {
|
do {
|
||||||
nread = fread(mem, 1, sizeof(mem), local);
|
nread = fread(mem, 1, sizeof(mem), local);
|
||||||
if (nread <= 0) {
|
if(nread <= 0) {
|
||||||
/* end of file */
|
/* end of file */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -221,12 +230,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
prev = 0;
|
prev = 0;
|
||||||
do {
|
do {
|
||||||
while ((rc = libssh2_channel_write(channel, ptr, nread)) ==
|
while((rc = libssh2_channel_write(channel, ptr, nread)) ==
|
||||||
LIBSSH2_ERROR_EAGAIN) {
|
LIBSSH2_ERROR_EAGAIN) {
|
||||||
waitsocket(sock, session);
|
waitsocket(sock, session);
|
||||||
prev = 0;
|
prev = 0;
|
||||||
}
|
}
|
||||||
if (rc < 0) {
|
if(rc < 0) {
|
||||||
fprintf(stderr, "ERROR %d total %ld / %d prev %d\n", rc,
|
fprintf(stderr, "ERROR %d total %ld / %d prev %d\n", rc,
|
||||||
total, (int)nread, (int)prev);
|
total, (int)nread, (int)prev);
|
||||||
break;
|
break;
|
||||||
@@ -238,31 +247,31 @@ int main(int argc, char *argv[])
|
|||||||
nread -= rc;
|
nread -= rc;
|
||||||
ptr += rc;
|
ptr += rc;
|
||||||
}
|
}
|
||||||
} while (nread);
|
} while(nread);
|
||||||
} while (!nread); /* only continue if nread was drained */
|
} while(!nread); /* only continue if nread was drained */
|
||||||
|
|
||||||
duration = (int)(time(NULL)-start);
|
duration = (int)(time(NULL)-start);
|
||||||
|
|
||||||
printf("%ld bytes in %d seconds makes %.1f bytes/sec\n",
|
fprintf(stderr, "%ld bytes in %d seconds makes %.1f bytes/sec\n",
|
||||||
total, duration, total/(double)duration);
|
total, duration, total/(double)duration);
|
||||||
|
|
||||||
fprintf(stderr, "Sending EOF\n");
|
fprintf(stderr, "Sending EOF\n");
|
||||||
while (libssh2_channel_send_eof(channel) == LIBSSH2_ERROR_EAGAIN);
|
while(libssh2_channel_send_eof(channel) == LIBSSH2_ERROR_EAGAIN);
|
||||||
|
|
||||||
fprintf(stderr, "Waiting for EOF\n");
|
fprintf(stderr, "Waiting for EOF\n");
|
||||||
while (libssh2_channel_wait_eof(channel) == LIBSSH2_ERROR_EAGAIN);
|
while(libssh2_channel_wait_eof(channel) == LIBSSH2_ERROR_EAGAIN);
|
||||||
|
|
||||||
fprintf(stderr, "Waiting for channel to close\n");
|
fprintf(stderr, "Waiting for channel to close\n");
|
||||||
while (libssh2_channel_wait_closed(channel) == LIBSSH2_ERROR_EAGAIN);
|
while(libssh2_channel_wait_closed(channel) == LIBSSH2_ERROR_EAGAIN);
|
||||||
|
|
||||||
libssh2_channel_free(channel);
|
libssh2_channel_free(channel);
|
||||||
channel = NULL;
|
channel = NULL;
|
||||||
|
|
||||||
shutdown:
|
shutdown:
|
||||||
|
|
||||||
while (libssh2_session_disconnect(session,
|
while(libssh2_session_disconnect(session,
|
||||||
"Normal Shutdown, Thank you for playing") ==
|
"Normal Shutdown,") ==
|
||||||
LIBSSH2_ERROR_EAGAIN);
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
libssh2_session_free(session);
|
libssh2_session_free(session);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|||||||
+82
-64
@@ -37,57 +37,59 @@
|
|||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
|
||||||
const char *keyfile1="~/.ssh/id_rsa.pub";
|
const char *keyfile1 = "~/.ssh/id_rsa.pub";
|
||||||
const char *keyfile2="~/.ssh/id_rsa";
|
const char *keyfile2 = "~/.ssh/id_rsa";
|
||||||
const char *username="username";
|
const char *username = "username";
|
||||||
const char *password="password";
|
const char *password = "password";
|
||||||
const char *sftppath="/tmp/TEST";
|
const char *sftppath = "/tmp/TEST";
|
||||||
|
|
||||||
|
|
||||||
static void kbd_callback(const char *name, int name_len,
|
static void kbd_callback(const char *name, int name_len,
|
||||||
const char *instruction, int instruction_len, int num_prompts,
|
const char *instruction, int instruction_len,
|
||||||
const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts,
|
int num_prompts,
|
||||||
LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses,
|
const LIBSSH2_USERAUTH_KBDINT_PROMPT *prompts,
|
||||||
void **abstract)
|
LIBSSH2_USERAUTH_KBDINT_RESPONSE *responses,
|
||||||
|
void **abstract)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
size_t n;
|
size_t n;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
(void)abstract;
|
(void)abstract;
|
||||||
|
|
||||||
printf("Performing keyboard-interactive authentication.\n");
|
fprintf(stderr, "Performing keyboard-interactive authentication.\n");
|
||||||
|
|
||||||
printf("Authentication name: '");
|
fprintf(stderr, "Authentication name: '");
|
||||||
fwrite(name, 1, name_len, stdout);
|
fwrite(name, 1, name_len, stderr);
|
||||||
printf("'\n");
|
fprintf(stderr, "'\n");
|
||||||
|
|
||||||
printf("Authentication instruction: '");
|
fprintf(stderr, "Authentication instruction: '");
|
||||||
fwrite(instruction, 1, instruction_len, stdout);
|
fwrite(instruction, 1, instruction_len, stderr);
|
||||||
printf("'\n");
|
fprintf(stderr, "'\n");
|
||||||
|
|
||||||
printf("Number of prompts: %d\n\n", num_prompts);
|
fprintf(stderr, "Number of prompts: %d\n\n", num_prompts);
|
||||||
|
|
||||||
for (i = 0; i < num_prompts; i++) {
|
for(i = 0; i < num_prompts; i++) {
|
||||||
printf("Prompt %d from server: '", i);
|
fprintf(stderr, "Prompt %d from server: '", i);
|
||||||
fwrite(prompts[i].text, 1, prompts[i].length, stdout);
|
fwrite(prompts[i].text, 1, prompts[i].length, stderr);
|
||||||
printf("'\n");
|
fprintf(stderr, "'\n");
|
||||||
|
|
||||||
printf("Please type response: ");
|
fprintf(stderr, "Please type response: ");
|
||||||
fgets(buf, sizeof(buf), stdin);
|
fgets(buf, sizeof(buf), stdin);
|
||||||
n = strlen(buf);
|
n = strlen(buf);
|
||||||
while (n > 0 && strchr("\r\n", buf[n - 1]))
|
while(n > 0 && strchr("\r\n", buf[n - 1]))
|
||||||
n--;
|
n--;
|
||||||
buf[n] = 0;
|
buf[n] = 0;
|
||||||
|
|
||||||
responses[i].text = strdup(buf);
|
responses[i].text = strdup(buf);
|
||||||
responses[i].length = n;
|
responses[i].length = n;
|
||||||
|
|
||||||
printf("Response %d from user is '", i);
|
fprintf(stderr, "Response %d from user is '", i);
|
||||||
fwrite(responses[i].text, 1, responses[i].length, stdout);
|
fwrite(responses[i].text, 1, responses[i].length, stderr);
|
||||||
printf("'\n\n");
|
fprintf(stderr, "'\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Done. Sending keyboard-interactive responses to server now.\n");
|
fprintf(stderr,
|
||||||
|
"Done. Sending keyboard-interactive responses to server now.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -105,13 +107,19 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err != 0) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if(argc > 1) {
|
||||||
hostaddr = inet_addr(argv[1]);
|
hostaddr = inet_addr(argv[1]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hostaddr = htonl(0x7F000001);
|
hostaddr = htonl(0x7F000001);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,9 +133,9 @@ int main(int argc, char *argv[])
|
|||||||
sftppath = argv[4];
|
sftppath = argv[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc != 0) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,8 +148,8 @@ int main(int argc, char *argv[])
|
|||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
sin.sin_addr.s_addr = hostaddr;
|
sin.sin_addr.s_addr = hostaddr;
|
||||||
if (connect(sock, (struct sockaddr*)(&sin),
|
if(connect(sock, (struct sockaddr*)(&sin),
|
||||||
sizeof(struct sockaddr_in)) != 0) {
|
sizeof(struct sockaddr_in)) != 0) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -178,61 +186,70 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* check what authentication methods are available */
|
/* check what authentication methods are available */
|
||||||
userauthlist = libssh2_userauth_list(session, username, strlen(username));
|
userauthlist = libssh2_userauth_list(session, username, strlen(username));
|
||||||
printf("Authentication methods: %s\n", userauthlist);
|
fprintf(stderr, "Authentication methods: %s\n", userauthlist);
|
||||||
if (strstr(userauthlist, "password") != NULL) {
|
if(strstr(userauthlist, "password") != NULL) {
|
||||||
auth_pw |= 1;
|
auth_pw |= 1;
|
||||||
}
|
}
|
||||||
if (strstr(userauthlist, "keyboard-interactive") != NULL) {
|
if(strstr(userauthlist, "keyboard-interactive") != NULL) {
|
||||||
auth_pw |= 2;
|
auth_pw |= 2;
|
||||||
}
|
}
|
||||||
if (strstr(userauthlist, "publickey") != NULL) {
|
if(strstr(userauthlist, "publickey") != NULL) {
|
||||||
auth_pw |= 4;
|
auth_pw |= 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if we got an 4. argument we set this option if supported */
|
/* if we got an 4. argument we set this option if supported */
|
||||||
if(argc > 5) {
|
if(argc > 5) {
|
||||||
if ((auth_pw & 1) && !strcasecmp(argv[5], "-p")) {
|
if((auth_pw & 1) && !strcasecmp(argv[5], "-p")) {
|
||||||
auth_pw = 1;
|
auth_pw = 1;
|
||||||
}
|
}
|
||||||
if ((auth_pw & 2) && !strcasecmp(argv[5], "-i")) {
|
if((auth_pw & 2) && !strcasecmp(argv[5], "-i")) {
|
||||||
auth_pw = 2;
|
auth_pw = 2;
|
||||||
}
|
}
|
||||||
if ((auth_pw & 4) && !strcasecmp(argv[5], "-k")) {
|
if((auth_pw & 4) && !strcasecmp(argv[5], "-k")) {
|
||||||
auth_pw = 4;
|
auth_pw = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth_pw & 1) {
|
if(auth_pw & 1) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
if (libssh2_userauth_password(session, username, password)) {
|
if(libssh2_userauth_password(session, username, password)) {
|
||||||
fprintf(stderr, "Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else if (auth_pw & 2) {
|
}
|
||||||
|
else if(auth_pw & 2) {
|
||||||
/* Or via keyboard-interactive */
|
/* Or via keyboard-interactive */
|
||||||
if (libssh2_userauth_keyboard_interactive(session, username, &kbd_callback) ) {
|
if(libssh2_userauth_keyboard_interactive(session, username,
|
||||||
printf("\tAuthentication by keyboard-interactive failed!\n");
|
&kbd_callback) ) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"\tAuthentication by keyboard-interactive failed!\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
} else {
|
|
||||||
printf("\tAuthentication by keyboard-interactive succeeded.\n");
|
|
||||||
}
|
}
|
||||||
} else if (auth_pw & 4) {
|
else {
|
||||||
|
fprintf(stderr,
|
||||||
|
"\tAuthentication by keyboard-interactive succeeded.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(auth_pw & 4) {
|
||||||
/* Or by public key */
|
/* Or by public key */
|
||||||
if (libssh2_userauth_publickey_fromfile(session, username, keyfile1, keyfile2, password)) {
|
if(libssh2_userauth_publickey_fromfile(session, username, keyfile1,
|
||||||
printf("\tAuthentication by public key failed!\n");
|
keyfile2, password)) {
|
||||||
|
fprintf(stderr, "\tAuthentication by public key failed!\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
} else {
|
|
||||||
printf("\tAuthentication by public key succeeded.\n");
|
|
||||||
}
|
}
|
||||||
} else {
|
else {
|
||||||
printf("No supported authentication methods found!\n");
|
fprintf(stderr, "\tAuthentication by public key succeeded.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fprintf(stderr, "No supported authentication methods found!\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(stderr, "libssh2_sftp_init()!\n");
|
fprintf(stderr, "libssh2_sftp_init()!\n");
|
||||||
sftp_session = libssh2_sftp_init(session);
|
sftp_session = libssh2_sftp_init(session);
|
||||||
|
|
||||||
if (!sftp_session) {
|
if(!sftp_session) {
|
||||||
fprintf(stderr, "Unable to init SFTP session\n");
|
fprintf(stderr, "Unable to init SFTP session\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -242,7 +259,7 @@ int main(int argc, char *argv[])
|
|||||||
sftp_handle =
|
sftp_handle =
|
||||||
libssh2_sftp_open(sftp_session, sftppath, LIBSSH2_FXF_READ, 0);
|
libssh2_sftp_open(sftp_session, sftppath, LIBSSH2_FXF_READ, 0);
|
||||||
|
|
||||||
if (!sftp_handle) {
|
if(!sftp_handle) {
|
||||||
fprintf(stderr, "Unable to open file with SFTP: %ld\n",
|
fprintf(stderr, "Unable to open file with SFTP: %ld\n",
|
||||||
libssh2_sftp_last_error(sftp_session));
|
libssh2_sftp_last_error(sftp_session));
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
@@ -254,19 +271,20 @@ int main(int argc, char *argv[])
|
|||||||
/* loop until we fail */
|
/* loop until we fail */
|
||||||
fprintf(stderr, "libssh2_sftp_read()!\n");
|
fprintf(stderr, "libssh2_sftp_read()!\n");
|
||||||
rc = libssh2_sftp_read(sftp_handle, mem, sizeof(mem));
|
rc = libssh2_sftp_read(sftp_handle, mem, sizeof(mem));
|
||||||
if (rc > 0) {
|
if(rc > 0) {
|
||||||
write(1, mem, rc);
|
write(1, mem, rc);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (1);
|
} while(1);
|
||||||
|
|
||||||
libssh2_sftp_close(sftp_handle);
|
libssh2_sftp_close(sftp_handle);
|
||||||
libssh2_sftp_shutdown(sftp_session);
|
libssh2_sftp_shutdown(sftp_session);
|
||||||
|
|
||||||
shutdown:
|
shutdown:
|
||||||
|
|
||||||
libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing");
|
libssh2_session_disconnect(session, "Normal Shutdown");
|
||||||
libssh2_session_free(session);
|
libssh2_session_free(session);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|||||||
+52
-43
@@ -79,10 +79,10 @@ int main(int argc, char *argv[])
|
|||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
LIBSSH2_SESSION *session;
|
LIBSSH2_SESSION *session;
|
||||||
const char *username="username";
|
const char *username = "username";
|
||||||
const char *password="password";
|
const char *password = "password";
|
||||||
const char *sftppath="/tmp/TEST"; /* source path */
|
const char *sftppath = "/tmp/TEST"; /* source path */
|
||||||
const char *dest="/tmp/TEST2"; /* destination path */
|
const char *dest = "/tmp/TEST2"; /* destination path */
|
||||||
int rc;
|
int rc;
|
||||||
LIBSSH2_SFTP *sftp_session;
|
LIBSSH2_SFTP *sftp_session;
|
||||||
LIBSSH2_SFTP_HANDLE *sftp_handle;
|
LIBSSH2_SFTP_HANDLE *sftp_handle;
|
||||||
@@ -90,16 +90,22 @@ int main(int argc, char *argv[])
|
|||||||
char mem[1000];
|
char mem[1000];
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
fd_set fd;
|
fd_set fd;
|
||||||
|
fd_set fd2;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err != 0) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc != 0) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,7 +118,7 @@ int main(int argc, char *argv[])
|
|||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
sin.sin_addr.s_addr = htonl(0x7F000001);
|
sin.sin_addr.s_addr = htonl(0x7F000001);
|
||||||
if (connect(sock, (struct sockaddr*)(&sin),
|
if(connect(sock, (struct sockaddr*)(&sin),
|
||||||
sizeof(struct sockaddr_in)) != 0) {
|
sizeof(struct sockaddr_in)) != 0) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -141,11 +147,11 @@ int main(int argc, char *argv[])
|
|||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 20; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if(argc > 1) {
|
if(argc > 1) {
|
||||||
username = argv[1];
|
username = argv[1];
|
||||||
@@ -162,30 +168,31 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
tempstorage = fopen(STORAGE, "wb");
|
tempstorage = fopen(STORAGE, "wb");
|
||||||
if(!tempstorage) {
|
if(!tempstorage) {
|
||||||
printf("Can't open temp storage file %s\n", STORAGE);
|
fprintf(stderr, "Can't open temp storage file %s\n", STORAGE);
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth_pw) {
|
if(auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
while ((rc = libssh2_userauth_password(session, username, password))
|
while((rc = libssh2_userauth_password(session, username, password))
|
||||||
== LIBSSH2_ERROR_EAGAIN);
|
== LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if(rc) {
|
||||||
printf("Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Or by public key */
|
/* Or by public key */
|
||||||
while ((rc =
|
while((rc =
|
||||||
libssh2_userauth_publickey_fromfile(session, username,
|
libssh2_userauth_publickey_fromfile(session, username,
|
||||||
"/home/username/"
|
"/home/username/"
|
||||||
".ssh/id_rsa.pub",
|
".ssh/id_rsa.pub",
|
||||||
"/home/username/"
|
"/home/username/"
|
||||||
".ssh/id_rsa",
|
".ssh/id_rsa",
|
||||||
password)) ==
|
password)) ==
|
||||||
LIBSSH2_ERROR_EAGAIN);
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if(rc) {
|
||||||
printf("\tAuthentication by public key failed\n");
|
fprintf(stderr, "\tAuthentication by public key failed\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,15 +211,15 @@ int main(int argc, char *argv[])
|
|||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!sftp_session);
|
} while(!sftp_session);
|
||||||
|
|
||||||
/* Request a file via SFTP */
|
/* Request a file via SFTP */
|
||||||
do {
|
do {
|
||||||
sftp_handle = libssh2_sftp_open(sftp_session, sftppath,
|
sftp_handle = libssh2_sftp_open(sftp_session, sftppath,
|
||||||
LIBSSH2_FXF_READ, 0);
|
LIBSSH2_FXF_READ, 0);
|
||||||
|
|
||||||
if (!sftp_handle) {
|
if(!sftp_handle) {
|
||||||
if (libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN) {
|
if(libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN) {
|
||||||
fprintf(stderr, "Unable to open file with SFTP\n");
|
fprintf(stderr, "Unable to open file with SFTP\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -221,7 +228,7 @@ int main(int argc, char *argv[])
|
|||||||
waitsocket(sock, session); /* now we wait */
|
waitsocket(sock, session); /* now we wait */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!sftp_handle);
|
} while(!sftp_handle);
|
||||||
|
|
||||||
fprintf(stderr, "libssh2_sftp_open() is done, now receive data!\n");
|
fprintf(stderr, "libssh2_sftp_open() is done, now receive data!\n");
|
||||||
do {
|
do {
|
||||||
@@ -237,7 +244,7 @@ int main(int argc, char *argv[])
|
|||||||
/* write to temporary storage area */
|
/* write to temporary storage area */
|
||||||
fwrite(mem, rc, 1, tempstorage);
|
fwrite(mem, rc, 1, tempstorage);
|
||||||
}
|
}
|
||||||
} while (rc > 0);
|
} while(rc > 0);
|
||||||
|
|
||||||
if(rc != LIBSSH2_ERROR_EAGAIN) {
|
if(rc != LIBSSH2_ERROR_EAGAIN) {
|
||||||
/* error or end of file */
|
/* error or end of file */
|
||||||
@@ -248,11 +255,12 @@ int main(int argc, char *argv[])
|
|||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
|
|
||||||
FD_ZERO(&fd);
|
FD_ZERO(&fd);
|
||||||
|
FD_ZERO(&fd2);
|
||||||
FD_SET(sock, &fd);
|
FD_SET(sock, &fd);
|
||||||
|
FD_SET(sock, &fd2);
|
||||||
|
|
||||||
/* wait for readable or writeable */
|
/* wait for readable or writeable */
|
||||||
rc = select(sock+1, &fd, &fd, NULL, &timeout);
|
rc = select(sock + 1, &fd, &fd2, NULL, &timeout);
|
||||||
if(rc <= 0) {
|
if(rc <= 0) {
|
||||||
/* negative is error
|
/* negative is error
|
||||||
0 is timeout */
|
0 is timeout */
|
||||||
@@ -260,7 +268,7 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (1);
|
} while(1);
|
||||||
|
|
||||||
libssh2_sftp_close(sftp_handle);
|
libssh2_sftp_close(sftp_handle);
|
||||||
fclose(tempstorage);
|
fclose(tempstorage);
|
||||||
@@ -296,7 +304,7 @@ int main(int argc, char *argv[])
|
|||||||
nread);
|
nread);
|
||||||
ptr += rc;
|
ptr += rc;
|
||||||
nread -= nread;
|
nread -= nread;
|
||||||
} while (rc >= 0);
|
} while(rc >= 0);
|
||||||
|
|
||||||
if(rc != LIBSSH2_ERROR_EAGAIN) {
|
if(rc != LIBSSH2_ERROR_EAGAIN) {
|
||||||
/* error or end of file */
|
/* error or end of file */
|
||||||
@@ -307,11 +315,12 @@ int main(int argc, char *argv[])
|
|||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
|
|
||||||
FD_ZERO(&fd);
|
FD_ZERO(&fd);
|
||||||
|
FD_ZERO(&fd2);
|
||||||
FD_SET(sock, &fd);
|
FD_SET(sock, &fd);
|
||||||
|
FD_SET(sock, &fd2);
|
||||||
|
|
||||||
/* wait for readable or writeable */
|
/* wait for readable or writeable */
|
||||||
rc = select(sock+1, &fd, &fd, NULL, &timeout);
|
rc = select(sock + 1, &fd, &fd2, NULL, &timeout);
|
||||||
if(rc <= 0) {
|
if(rc <= 0) {
|
||||||
/* negative is error
|
/* negative is error
|
||||||
0 is timeout */
|
0 is timeout */
|
||||||
@@ -319,7 +328,7 @@ int main(int argc, char *argv[])
|
|||||||
rc);
|
rc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (1);
|
} while(1);
|
||||||
fprintf(stderr, "SFTP upload done!\n");
|
fprintf(stderr, "SFTP upload done!\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -331,7 +340,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
shutdown:
|
shutdown:
|
||||||
|
|
||||||
libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing");
|
libssh2_session_disconnect(session, "Normal Shutdown");
|
||||||
libssh2_session_free(session);
|
libssh2_session_free(session);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -339,9 +348,9 @@ int main(int argc, char *argv[])
|
|||||||
#else
|
#else
|
||||||
close(sock);
|
close(sock);
|
||||||
#endif
|
#endif
|
||||||
if (tempstorage)
|
if(tempstorage)
|
||||||
fclose(tempstorage);
|
fclose(tempstorage);
|
||||||
printf("all done\n");
|
fprintf(stderr, "all done\n");
|
||||||
|
|
||||||
libssh2_exit();
|
libssh2_exit();
|
||||||
|
|
||||||
|
|||||||
+44
-36
@@ -40,10 +40,10 @@ int main(int argc, char *argv[])
|
|||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
LIBSSH2_SESSION *session;
|
LIBSSH2_SESSION *session;
|
||||||
const char *username="username";
|
const char *username = "username";
|
||||||
const char *password="password";
|
const char *password = "password";
|
||||||
const char *loclfile="sftp_write.c";
|
const char *loclfile = "sftp_write.c";
|
||||||
const char *sftppath="/tmp/TEST";
|
const char *sftppath = "/tmp/TEST";
|
||||||
int rc;
|
int rc;
|
||||||
FILE *local;
|
FILE *local;
|
||||||
LIBSSH2_SFTP *sftp_session;
|
LIBSSH2_SFTP *sftp_session;
|
||||||
@@ -55,13 +55,19 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if(argc > 1) {
|
||||||
hostaddr = inet_addr(argv[1]);
|
hostaddr = inet_addr(argv[1]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hostaddr = htonl(0x7F000001);
|
hostaddr = htonl(0x7F000001);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,15 +84,15 @@ int main(int argc, char *argv[])
|
|||||||
sftppath = argv[5];
|
sftppath = argv[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
local = fopen(loclfile, "rb");
|
local = fopen(loclfile, "rb");
|
||||||
if (!local) {
|
if(!local) {
|
||||||
printf("Can't local file %s\n", loclfile);
|
fprintf(stderr, "Can't open local file %s\n", loclfile);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,8 +105,8 @@ int main(int argc, char *argv[])
|
|||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
sin.sin_addr.s_addr = hostaddr;
|
sin.sin_addr.s_addr = hostaddr;
|
||||||
if (connect(sock, (struct sockaddr*)(&sin),
|
if(connect(sock, (struct sockaddr*)(&sin),
|
||||||
sizeof(struct sockaddr_in)) != 0) {
|
sizeof(struct sockaddr_in)) != 0) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -129,25 +135,27 @@ int main(int argc, char *argv[])
|
|||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 20; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (auth_pw) {
|
if(auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
if (libssh2_userauth_password(session, username, password)) {
|
if(libssh2_userauth_password(session, username, password)) {
|
||||||
printf("Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Or by public key */
|
/* Or by public key */
|
||||||
if (libssh2_userauth_publickey_fromfile(session, username,
|
#define HOME "/home/username/"
|
||||||
"/home/username/.ssh/id_rsa.pub",
|
if(libssh2_userauth_publickey_fromfile(session, username,
|
||||||
"/home/username/.ssh/id_rsa",
|
HOME ".ssh/id_rsa.pub",
|
||||||
password)) {
|
HOME ".ssh/id_rsa",
|
||||||
printf("\tAuthentication by public key failed\n");
|
password)) {
|
||||||
|
fprintf(stderr, "\tAuthentication by public key failed\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,7 +163,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "libssh2_sftp_init()!\n");
|
fprintf(stderr, "libssh2_sftp_init()!\n");
|
||||||
sftp_session = libssh2_sftp_init(session);
|
sftp_session = libssh2_sftp_init(session);
|
||||||
|
|
||||||
if (!sftp_session) {
|
if(!sftp_session) {
|
||||||
fprintf(stderr, "Unable to init SFTP session\n");
|
fprintf(stderr, "Unable to init SFTP session\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -168,29 +176,29 @@ int main(int argc, char *argv[])
|
|||||||
LIBSSH2_FXF_WRITE|LIBSSH2_FXF_READ,
|
LIBSSH2_FXF_WRITE|LIBSSH2_FXF_READ,
|
||||||
LIBSSH2_SFTP_S_IRUSR|LIBSSH2_SFTP_S_IWUSR|
|
LIBSSH2_SFTP_S_IRUSR|LIBSSH2_SFTP_S_IWUSR|
|
||||||
LIBSSH2_SFTP_S_IRGRP|LIBSSH2_SFTP_S_IROTH);
|
LIBSSH2_SFTP_S_IRGRP|LIBSSH2_SFTP_S_IROTH);
|
||||||
if (!sftp_handle) {
|
if(!sftp_handle) {
|
||||||
fprintf(stderr, "Unable to open file with SFTP\n");
|
fprintf(stderr, "Unable to open file with SFTP\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(libssh2_sftp_fstat_ex(sftp_handle, &attrs, 0) < 0) {
|
if(libssh2_sftp_fstat_ex(sftp_handle, &attrs, 0) < 0) {
|
||||||
printf("libssh2_sftp_fstat_ex failed\n");
|
fprintf(stderr, "libssh2_sftp_fstat_ex failed\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
libssh2_sftp_seek64(sftp_handle, attrs.filesize);
|
libssh2_sftp_seek64(sftp_handle, attrs.filesize);
|
||||||
printf("Did a seek to position %ld\n", (long) attrs.filesize);
|
fprintf(stderr, "Did a seek to position %ld\n", (long) attrs.filesize);
|
||||||
|
|
||||||
fprintf(stderr, "libssh2_sftp_open() a handle for APPEND\n");
|
fprintf(stderr, "libssh2_sftp_open() a handle for APPEND\n");
|
||||||
|
|
||||||
if (!sftp_handle) {
|
if(!sftp_handle) {
|
||||||
fprintf(stderr, "Unable to open file with SFTP\n");
|
fprintf(stderr, "Unable to open file with SFTP\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "libssh2_sftp_open() is done, now send data!\n");
|
fprintf(stderr, "libssh2_sftp_open() is done, now send data!\n");
|
||||||
do {
|
do {
|
||||||
nread = fread(mem, 1, sizeof(mem), local);
|
nread = fread(mem, 1, sizeof(mem), local);
|
||||||
if (nread <= 0) {
|
if(nread <= 0) {
|
||||||
/* end of file */
|
/* end of file */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -203,9 +211,9 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
ptr += rc;
|
ptr += rc;
|
||||||
nread -= rc;
|
nread -= rc;
|
||||||
} while (nread);
|
} while(nread);
|
||||||
|
|
||||||
} while (rc > 0);
|
} while(rc > 0);
|
||||||
|
|
||||||
libssh2_sftp_close(sftp_handle);
|
libssh2_sftp_close(sftp_handle);
|
||||||
libssh2_sftp_shutdown(sftp_session);
|
libssh2_sftp_shutdown(sftp_session);
|
||||||
@@ -220,9 +228,9 @@ shutdown:
|
|||||||
#else
|
#else
|
||||||
close(sock);
|
close(sock);
|
||||||
#endif
|
#endif
|
||||||
if (local)
|
if(local)
|
||||||
fclose(local);
|
fclose(local);
|
||||||
printf("all done\n");
|
fprintf(stderr, "all done\n");
|
||||||
|
|
||||||
libssh2_exit();
|
libssh2_exit();
|
||||||
|
|
||||||
|
|||||||
+29
-22
@@ -40,21 +40,27 @@ int main(int argc, char *argv[])
|
|||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
LIBSSH2_SESSION *session;
|
LIBSSH2_SESSION *session;
|
||||||
const char *username="username";
|
const char *username = "username";
|
||||||
const char *password="password";
|
const char *password = "password";
|
||||||
const char *sftppath="/tmp/sftp_mkdir";
|
const char *sftppath = "/tmp/sftp_mkdir";
|
||||||
int rc;
|
int rc;
|
||||||
LIBSSH2_SFTP *sftp_session;
|
LIBSSH2_SFTP *sftp_session;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err != 0) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if(argc > 1) {
|
||||||
hostaddr = inet_addr(argv[1]);
|
hostaddr = inet_addr(argv[1]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hostaddr = htonl(0x7F000001);
|
hostaddr = htonl(0x7F000001);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,9 +74,9 @@ int main(int argc, char *argv[])
|
|||||||
sftppath = argv[4];
|
sftppath = argv[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc != 0) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +89,7 @@ int main(int argc, char *argv[])
|
|||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
sin.sin_addr.s_addr = hostaddr;
|
sin.sin_addr.s_addr = hostaddr;
|
||||||
if (connect(sock, (struct sockaddr*)(&sin),
|
if(connect(sock, (struct sockaddr*)(&sin),
|
||||||
sizeof(struct sockaddr_in)) != 0) {
|
sizeof(struct sockaddr_in)) != 0) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -110,32 +116,33 @@ int main(int argc, char *argv[])
|
|||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 20; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (auth_pw) {
|
if(auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
if (libssh2_userauth_password(session, username, password)) {
|
if(libssh2_userauth_password(session, username, password)) {
|
||||||
printf("Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Or by public key */
|
/* Or by public key */
|
||||||
if (libssh2_userauth_publickey_fromfile(session, username,
|
if(libssh2_userauth_publickey_fromfile(session, username,
|
||||||
"/home/username/.ssh/id_rsa.pub",
|
"/home/username/.ssh/id_rsa.pub",
|
||||||
"/home/username/.ssh/id_rsa",
|
"/home/username/.ssh/id_rsa",
|
||||||
password)) {
|
password)) {
|
||||||
printf("\tAuthentication by public key failed\n");
|
fprintf(stderr, "\tAuthentication by public key failed\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sftp_session = libssh2_sftp_init(session);
|
sftp_session = libssh2_sftp_init(session);
|
||||||
|
|
||||||
if (!sftp_session) {
|
if(!sftp_session) {
|
||||||
fprintf(stderr, "Unable to init SFTP session\n");
|
fprintf(stderr, "Unable to init SFTP session\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -156,7 +163,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
shutdown:
|
shutdown:
|
||||||
|
|
||||||
libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing");
|
libssh2_session_disconnect(session, "Normal Shutdown");
|
||||||
libssh2_session_free(session);
|
libssh2_session_free(session);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -164,7 +171,7 @@ int main(int argc, char *argv[])
|
|||||||
#else
|
#else
|
||||||
close(sock);
|
close(sock);
|
||||||
#endif
|
#endif
|
||||||
printf("all done\n");
|
fprintf(stderr, "all done\n");
|
||||||
|
|
||||||
libssh2_exit();
|
libssh2_exit();
|
||||||
|
|
||||||
|
|||||||
@@ -40,21 +40,27 @@ int main(int argc, char *argv[])
|
|||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
LIBSSH2_SESSION *session;
|
LIBSSH2_SESSION *session;
|
||||||
const char *username="username";
|
const char *username = "username";
|
||||||
const char *password="password";
|
const char *password = "password";
|
||||||
const char *sftppath="/tmp/sftp_mkdir_nonblock";
|
const char *sftppath = "/tmp/sftp_mkdir_nonblock";
|
||||||
int rc;
|
int rc;
|
||||||
LIBSSH2_SFTP *sftp_session;
|
LIBSSH2_SFTP *sftp_session;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err != 0) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if(argc > 1) {
|
||||||
hostaddr = inet_addr(argv[1]);
|
hostaddr = inet_addr(argv[1]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hostaddr = htonl(0x7F000001);
|
hostaddr = htonl(0x7F000001);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,9 +74,9 @@ int main(int argc, char *argv[])
|
|||||||
sftppath = argv[4];
|
sftppath = argv[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc != 0) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,7 +89,7 @@ int main(int argc, char *argv[])
|
|||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
sin.sin_addr.s_addr = hostaddr;
|
sin.sin_addr.s_addr = hostaddr;
|
||||||
if (connect(sock, (struct sockaddr*)(&sin),
|
if(connect(sock, (struct sockaddr*)(&sin),
|
||||||
sizeof(struct sockaddr_in)) != 0) {
|
sizeof(struct sockaddr_in)) != 0) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -110,25 +116,26 @@ int main(int argc, char *argv[])
|
|||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 20; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (auth_pw) {
|
if(auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
if (libssh2_userauth_password(session, username, password)) {
|
if(libssh2_userauth_password(session, username, password)) {
|
||||||
printf("Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Or by public key */
|
/* Or by public key */
|
||||||
if (libssh2_userauth_publickey_fromfile(session, username,
|
if(libssh2_userauth_publickey_fromfile(session, username,
|
||||||
"/home/username/.ssh/id_rsa.pub",
|
"/home/username/.ssh/id_rsa.pub",
|
||||||
"/home/username/.ssh/id_rsa",
|
"/home/username/.ssh/id_rsa",
|
||||||
password)) {
|
password)) {
|
||||||
printf("\tAuthentication by public key failed\n");
|
fprintf(stderr, "\tAuthentication by public key failed\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,7 +143,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "libssh2_sftp_init()!\n");
|
fprintf(stderr, "libssh2_sftp_init()!\n");
|
||||||
sftp_session = libssh2_sftp_init(session);
|
sftp_session = libssh2_sftp_init(session);
|
||||||
|
|
||||||
if (!sftp_session) {
|
if(!sftp_session) {
|
||||||
fprintf(stderr, "Unable to init SFTP session\n");
|
fprintf(stderr, "Unable to init SFTP session\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -146,7 +153,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
fprintf(stderr, "libssh2_sftp_mkdirnb()!\n");
|
fprintf(stderr, "libssh2_sftp_mkdirnb()!\n");
|
||||||
/* Make a directory via SFTP */
|
/* Make a directory via SFTP */
|
||||||
while (libssh2_sftp_mkdir(sftp_session, sftppath,
|
while(libssh2_sftp_mkdir(sftp_session, sftppath,
|
||||||
LIBSSH2_SFTP_S_IRWXU|
|
LIBSSH2_SFTP_S_IRWXU|
|
||||||
LIBSSH2_SFTP_S_IRGRP|LIBSSH2_SFTP_S_IXGRP|
|
LIBSSH2_SFTP_S_IRGRP|LIBSSH2_SFTP_S_IXGRP|
|
||||||
LIBSSH2_SFTP_S_IROTH|LIBSSH2_SFTP_S_IXOTH)
|
LIBSSH2_SFTP_S_IROTH|LIBSSH2_SFTP_S_IXOTH)
|
||||||
@@ -156,7 +163,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
shutdown:
|
shutdown:
|
||||||
|
|
||||||
libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing");
|
libssh2_session_disconnect(session, "Normal Shutdown");
|
||||||
libssh2_session_free(session);
|
libssh2_session_free(session);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -164,7 +171,7 @@ int main(int argc, char *argv[])
|
|||||||
#else
|
#else
|
||||||
close(sock);
|
close(sock);
|
||||||
#endif
|
#endif
|
||||||
printf("all done\n");
|
fprintf(stderr, "all done\n");
|
||||||
|
|
||||||
libssh2_exit();
|
libssh2_exit();
|
||||||
|
|
||||||
|
|||||||
+61
-42
@@ -39,12 +39,14 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_GETTIMEOFDAY
|
||||||
/* diff in ms */
|
/* diff in ms */
|
||||||
static long tvdiff(struct timeval newer, struct timeval older)
|
static long tvdiff(struct timeval newer, struct timeval older)
|
||||||
{
|
{
|
||||||
return (newer.tv_sec-older.tv_sec)*1000+
|
return (newer.tv_sec-older.tv_sec)*1000+
|
||||||
(newer.tv_usec-older.tv_usec)/1000;
|
(newer.tv_usec-older.tv_usec)/1000;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static int waitsocket(int socket_fd, LIBSSH2_SESSION *session)
|
static int waitsocket(int socket_fd, LIBSSH2_SESSION *session)
|
||||||
{
|
{
|
||||||
@@ -83,43 +85,51 @@ int main(int argc, char *argv[])
|
|||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
LIBSSH2_SESSION *session;
|
LIBSSH2_SESSION *session;
|
||||||
const char *username="username";
|
const char *username = "username";
|
||||||
const char *password="password";
|
const char *password = "password";
|
||||||
const char *sftppath="/tmp/TEST";
|
const char *sftppath = "/tmp/TEST";
|
||||||
|
#ifdef HAVE_GETTIMEOFDAY
|
||||||
struct timeval start;
|
struct timeval start;
|
||||||
struct timeval end;
|
struct timeval end;
|
||||||
|
long time_ms;
|
||||||
|
#endif
|
||||||
int rc;
|
int rc;
|
||||||
int total = 0;
|
int total = 0;
|
||||||
long time_ms;
|
|
||||||
int spin = 0;
|
int spin = 0;
|
||||||
LIBSSH2_SFTP *sftp_session;
|
LIBSSH2_SFTP *sftp_session;
|
||||||
LIBSSH2_SFTP_HANDLE *sftp_handle;
|
LIBSSH2_SFTP_HANDLE *sftp_handle;
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err != 0) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if(argc > 1) {
|
||||||
hostaddr = inet_addr(argv[1]);
|
hostaddr = inet_addr(argv[1]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hostaddr = htonl(0x7F000001);
|
hostaddr = htonl(0x7F000001);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 2) {
|
if(argc > 2) {
|
||||||
username = argv[2];
|
username = argv[2];
|
||||||
}
|
}
|
||||||
if (argc > 3) {
|
if(argc > 3) {
|
||||||
password = argv[3];
|
password = argv[3];
|
||||||
}
|
}
|
||||||
if (argc > 4) {
|
if(argc > 4) {
|
||||||
sftppath = argv[4];
|
sftppath = argv[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc != 0) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,7 +142,7 @@ int main(int argc, char *argv[])
|
|||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
sin.sin_addr.s_addr = hostaddr;
|
sin.sin_addr.s_addr = hostaddr;
|
||||||
if (connect(sock, (struct sockaddr*)(&sin),
|
if(connect(sock, (struct sockaddr*)(&sin),
|
||||||
sizeof(struct sockaddr_in)) != 0) {
|
sizeof(struct sockaddr_in)) != 0) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -140,20 +150,22 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Create a session instance */
|
/* Create a session instance */
|
||||||
session = libssh2_session_init();
|
session = libssh2_session_init();
|
||||||
if (!session)
|
if(!session)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Since we have set non-blocking, tell libssh2 we are non-blocking */
|
/* Since we have set non-blocking, tell libssh2 we are non-blocking */
|
||||||
libssh2_session_set_blocking(session, 0);
|
libssh2_session_set_blocking(session, 0);
|
||||||
|
|
||||||
|
#ifdef HAVE_GETTIMEOFDAY
|
||||||
gettimeofday(&start, NULL);
|
gettimeofday(&start, NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||||
* and setup crypto, compression, and MAC layers
|
* and setup crypto, compression, and MAC layers
|
||||||
*/
|
*/
|
||||||
while ((rc = libssh2_session_handshake(session, sock)) ==
|
while((rc = libssh2_session_handshake(session, sock)) ==
|
||||||
LIBSSH2_ERROR_EAGAIN);
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if(rc) {
|
||||||
fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
|
fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -170,25 +182,26 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (auth_pw) {
|
if(auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
while ((rc = libssh2_userauth_password(session, username, password))
|
while((rc = libssh2_userauth_password(session, username, password))
|
||||||
== LIBSSH2_ERROR_EAGAIN);
|
== LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if(rc) {
|
||||||
fprintf(stderr, "Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Or by public key */
|
/* Or by public key */
|
||||||
while ((rc =
|
while((rc =
|
||||||
libssh2_userauth_publickey_fromfile(session, username,
|
libssh2_userauth_publickey_fromfile(session, username,
|
||||||
"/home/username/"
|
"/home/username/"
|
||||||
".ssh/id_rsa.pub",
|
".ssh/id_rsa.pub",
|
||||||
"/home/username/"
|
"/home/username/"
|
||||||
".ssh/id_rsa",
|
".ssh/id_rsa",
|
||||||
password)) ==
|
password)) ==
|
||||||
LIBSSH2_ERROR_EAGAIN);
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if(rc) {
|
||||||
fprintf(stderr, "\tAuthentication by public key failed\n");
|
fprintf(stderr, "\tAuthentication by public key failed\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -211,7 +224,7 @@ int main(int argc, char *argv[])
|
|||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!sftp_session);
|
} while(!sftp_session);
|
||||||
|
|
||||||
fprintf(stderr, "libssh2_sftp_open()!\n");
|
fprintf(stderr, "libssh2_sftp_open()!\n");
|
||||||
/* Request a file via SFTP */
|
/* Request a file via SFTP */
|
||||||
@@ -219,8 +232,8 @@ int main(int argc, char *argv[])
|
|||||||
sftp_handle = libssh2_sftp_open(sftp_session, sftppath,
|
sftp_handle = libssh2_sftp_open(sftp_session, sftppath,
|
||||||
LIBSSH2_FXF_READ, 0);
|
LIBSSH2_FXF_READ, 0);
|
||||||
|
|
||||||
if (!sftp_handle) {
|
if(!sftp_handle) {
|
||||||
if (libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN) {
|
if(libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN) {
|
||||||
fprintf(stderr, "Unable to open file with SFTP\n");
|
fprintf(stderr, "Unable to open file with SFTP\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -229,38 +242,44 @@ int main(int argc, char *argv[])
|
|||||||
waitsocket(sock, session); /* now we wait */
|
waitsocket(sock, session); /* now we wait */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} while (!sftp_handle);
|
} while(!sftp_handle);
|
||||||
|
|
||||||
fprintf(stderr, "libssh2_sftp_open() is done, now receive data!\n");
|
fprintf(stderr, "libssh2_sftp_open() is done, now receive data!\n");
|
||||||
do {
|
do {
|
||||||
char mem[1024*24];
|
char mem[1024*24];
|
||||||
|
|
||||||
/* loop until we fail */
|
/* loop until we fail */
|
||||||
while ((rc = libssh2_sftp_read(sftp_handle, mem,
|
while((rc = libssh2_sftp_read(sftp_handle, mem,
|
||||||
sizeof(mem))) == LIBSSH2_ERROR_EAGAIN) {
|
sizeof(mem))) == LIBSSH2_ERROR_EAGAIN) {
|
||||||
spin++;
|
spin++;
|
||||||
waitsocket(sock, session); /* now we wait */
|
waitsocket(sock, session); /* now we wait */
|
||||||
}
|
}
|
||||||
if (rc > 0) {
|
if(rc > 0) {
|
||||||
total += rc;
|
total += rc;
|
||||||
write(1, mem, rc);
|
write(1, mem, rc);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (1);
|
} while(1);
|
||||||
|
|
||||||
|
#ifdef HAVE_GETTIMEOFDAY
|
||||||
gettimeofday(&end, NULL);
|
gettimeofday(&end, NULL);
|
||||||
time_ms = tvdiff(end, start);
|
time_ms = tvdiff(end, start);
|
||||||
printf("Got %d bytes in %ld ms = %.1f bytes/sec spin: %d\n", total,
|
fprintf(stderr, "Got %d bytes in %ld ms = %.1f bytes/sec spin: %d\n",
|
||||||
time_ms, total/(time_ms/1000.0), spin );
|
total,
|
||||||
|
time_ms, total/(time_ms/1000.0), spin);
|
||||||
|
#else
|
||||||
|
fprintf(stderr, "Got %d bytes spin: %d\n", total, spin);
|
||||||
|
#endif
|
||||||
|
|
||||||
libssh2_sftp_close(sftp_handle);
|
libssh2_sftp_close(sftp_handle);
|
||||||
libssh2_sftp_shutdown(sftp_session);
|
libssh2_sftp_shutdown(sftp_session);
|
||||||
|
|
||||||
shutdown:
|
shutdown:
|
||||||
|
|
||||||
printf("libssh2_session_disconnect\n");
|
fprintf(stderr, "libssh2_session_disconnect\n");
|
||||||
while (libssh2_session_disconnect(session,
|
while(libssh2_session_disconnect(session,
|
||||||
"Normal Shutdown, Thank you") ==
|
"Normal Shutdown, Thank you") ==
|
||||||
LIBSSH2_ERROR_EAGAIN);
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
libssh2_session_free(session);
|
libssh2_session_free(session);
|
||||||
|
|||||||
+40
-32
@@ -40,10 +40,10 @@ int main(int argc, char *argv[])
|
|||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
LIBSSH2_SESSION *session;
|
LIBSSH2_SESSION *session;
|
||||||
const char *username="username";
|
const char *username = "username";
|
||||||
const char *password="password";
|
const char *password = "password";
|
||||||
const char *loclfile="sftp_write.c";
|
const char *loclfile = "sftp_write.c";
|
||||||
const char *sftppath="/tmp/TEST";
|
const char *sftppath = "/tmp/TEST";
|
||||||
int rc;
|
int rc;
|
||||||
FILE *local;
|
FILE *local;
|
||||||
LIBSSH2_SFTP *sftp_session;
|
LIBSSH2_SFTP *sftp_session;
|
||||||
@@ -54,13 +54,19 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err != 0) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if(argc > 1) {
|
||||||
hostaddr = inet_addr(argv[1]);
|
hostaddr = inet_addr(argv[1]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hostaddr = htonl(0x7F000001);
|
hostaddr = htonl(0x7F000001);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,15 +83,15 @@ int main(int argc, char *argv[])
|
|||||||
sftppath = argv[5];
|
sftppath = argv[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc != 0) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
local = fopen(loclfile, "rb");
|
local = fopen(loclfile, "rb");
|
||||||
if (!local) {
|
if(!local) {
|
||||||
printf("Can't local file %s\n", loclfile);
|
fprintf(stderr, "Can't open local file %s\n", loclfile);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +104,7 @@ int main(int argc, char *argv[])
|
|||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
sin.sin_addr.s_addr = hostaddr;
|
sin.sin_addr.s_addr = hostaddr;
|
||||||
if (connect(sock, (struct sockaddr*)(&sin),
|
if(connect(sock, (struct sockaddr*)(&sin),
|
||||||
sizeof(struct sockaddr_in)) != 0) {
|
sizeof(struct sockaddr_in)) != 0) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -128,25 +134,27 @@ int main(int argc, char *argv[])
|
|||||||
* user, that's your call
|
* user, that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 20; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (auth_pw) {
|
if(auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
if (libssh2_userauth_password(session, username, password)) {
|
if(libssh2_userauth_password(session, username, password)) {
|
||||||
printf("Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Or by public key */
|
/* Or by public key */
|
||||||
if (libssh2_userauth_publickey_fromfile(session, username,
|
const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||||
"/home/username/.ssh/id_rsa.pub",
|
const char *privkey = "/home/username/.ssh/id_rsa.pub";
|
||||||
"/home/username/.ssh/id_rsa",
|
if(libssh2_userauth_publickey_fromfile(session, username,
|
||||||
password)) {
|
pubkey, privkey,
|
||||||
printf("\tAuthentication by public key failed\n");
|
password)) {
|
||||||
|
fprintf(stderr, "\tAuthentication by public key failed\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -154,7 +162,7 @@ int main(int argc, char *argv[])
|
|||||||
fprintf(stderr, "libssh2_sftp_init()!\n");
|
fprintf(stderr, "libssh2_sftp_init()!\n");
|
||||||
sftp_session = libssh2_sftp_init(session);
|
sftp_session = libssh2_sftp_init(session);
|
||||||
|
|
||||||
if (!sftp_session) {
|
if(!sftp_session) {
|
||||||
fprintf(stderr, "Unable to init SFTP session\n");
|
fprintf(stderr, "Unable to init SFTP session\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
@@ -167,14 +175,14 @@ int main(int argc, char *argv[])
|
|||||||
LIBSSH2_SFTP_S_IRUSR|LIBSSH2_SFTP_S_IWUSR|
|
LIBSSH2_SFTP_S_IRUSR|LIBSSH2_SFTP_S_IWUSR|
|
||||||
LIBSSH2_SFTP_S_IRGRP|LIBSSH2_SFTP_S_IROTH);
|
LIBSSH2_SFTP_S_IRGRP|LIBSSH2_SFTP_S_IROTH);
|
||||||
|
|
||||||
if (!sftp_handle) {
|
if(!sftp_handle) {
|
||||||
fprintf(stderr, "Unable to open file with SFTP\n");
|
fprintf(stderr, "Unable to open file with SFTP\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "libssh2_sftp_open() is done, now send data!\n");
|
fprintf(stderr, "libssh2_sftp_open() is done, now send data!\n");
|
||||||
do {
|
do {
|
||||||
nread = fread(mem, 1, sizeof(mem), local);
|
nread = fread(mem, 1, sizeof(mem), local);
|
||||||
if (nread <= 0) {
|
if(nread <= 0) {
|
||||||
/* end of file */
|
/* end of file */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -187,9 +195,9 @@ int main(int argc, char *argv[])
|
|||||||
break;
|
break;
|
||||||
ptr += rc;
|
ptr += rc;
|
||||||
nread -= rc;
|
nread -= rc;
|
||||||
} while (nread);
|
} while(nread);
|
||||||
|
|
||||||
} while (rc > 0);
|
} while(rc > 0);
|
||||||
|
|
||||||
libssh2_sftp_close(sftp_handle);
|
libssh2_sftp_close(sftp_handle);
|
||||||
libssh2_sftp_shutdown(sftp_session);
|
libssh2_sftp_shutdown(sftp_session);
|
||||||
@@ -204,9 +212,9 @@ shutdown:
|
|||||||
#else
|
#else
|
||||||
close(sock);
|
close(sock);
|
||||||
#endif
|
#endif
|
||||||
if (local)
|
if(local)
|
||||||
fclose(local);
|
fclose(local);
|
||||||
printf("all done\n");
|
fprintf(stderr, "all done\n");
|
||||||
|
|
||||||
libssh2_exit();
|
libssh2_exit();
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* The sample code has default values for host name, user name, password
|
* The sample code has default values for host name, user name, password
|
||||||
* and path to copy, but you can specify them on the command line like:
|
* and path to copy, but you can specify them on the command line like:
|
||||||
*
|
*
|
||||||
* "sftp 192.168.0.1 user password sftp_write_nonblock.c /tmp/sftp_write_nonblock.c"
|
* "sftp 192.168.0.1 user password thisfile /tmp/storehere"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libssh2_config.h"
|
#include "libssh2_config.h"
|
||||||
@@ -77,10 +77,10 @@ int main(int argc, char *argv[])
|
|||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
LIBSSH2_SESSION *session;
|
LIBSSH2_SESSION *session;
|
||||||
const char *username="username";
|
const char *username = "username";
|
||||||
const char *password="password";
|
const char *password = "password";
|
||||||
const char *loclfile="sftp_write_nonblock.c";
|
const char *loclfile = "sftp_write_nonblock.c";
|
||||||
const char *sftppath="/tmp/sftp_write_nonblock.c";
|
const char *sftppath = "/tmp/sftp_write_nonblock.c";
|
||||||
int rc;
|
int rc;
|
||||||
FILE *local;
|
FILE *local;
|
||||||
LIBSSH2_SFTP *sftp_session;
|
LIBSSH2_SFTP *sftp_session;
|
||||||
@@ -94,38 +94,44 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err != 0) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if(argc > 1) {
|
||||||
hostaddr = inet_addr(argv[1]);
|
hostaddr = inet_addr(argv[1]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hostaddr = htonl(0x7F000001);
|
hostaddr = htonl(0x7F000001);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 2) {
|
if(argc > 2) {
|
||||||
username = argv[2];
|
username = argv[2];
|
||||||
}
|
}
|
||||||
if (argc > 3) {
|
if(argc > 3) {
|
||||||
password = argv[3];
|
password = argv[3];
|
||||||
}
|
}
|
||||||
if (argc > 4) {
|
if(argc > 4) {
|
||||||
loclfile = argv[4];
|
loclfile = argv[4];
|
||||||
}
|
}
|
||||||
if (argc > 5) {
|
if(argc > 5) {
|
||||||
sftppath = argv[5];
|
sftppath = argv[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc != 0) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
local = fopen(loclfile, "rb");
|
local = fopen(loclfile, "rb");
|
||||||
if (!local) {
|
if(!local) {
|
||||||
printf("Can't local file %s\n", loclfile);
|
fprintf(stderr, "Can't open local file %s\n", loclfile);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +144,7 @@ int main(int argc, char *argv[])
|
|||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
sin.sin_addr.s_addr = hostaddr;
|
sin.sin_addr.s_addr = hostaddr;
|
||||||
if (connect(sock, (struct sockaddr*)(&sin),
|
if(connect(sock, (struct sockaddr*)(&sin),
|
||||||
sizeof(struct sockaddr_in)) != 0) {
|
sizeof(struct sockaddr_in)) != 0) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -147,7 +153,7 @@ int main(int argc, char *argv[])
|
|||||||
/* Create a session instance
|
/* Create a session instance
|
||||||
*/
|
*/
|
||||||
session = libssh2_session_init();
|
session = libssh2_session_init();
|
||||||
if (!session)
|
if(!session)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Since we have set non-blocking, tell libssh2 we are non-blocking */
|
/* Since we have set non-blocking, tell libssh2 we are non-blocking */
|
||||||
@@ -156,9 +162,9 @@ int main(int argc, char *argv[])
|
|||||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||||
* and setup crypto, compression, and MAC layers
|
* and setup crypto, compression, and MAC layers
|
||||||
*/
|
*/
|
||||||
while ((rc = libssh2_session_handshake(session, sock))
|
while((rc = libssh2_session_handshake(session, sock))
|
||||||
== LIBSSH2_ERROR_EAGAIN);
|
== LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if(rc) {
|
||||||
fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
|
fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -169,29 +175,31 @@ int main(int argc, char *argv[])
|
|||||||
* that's your call
|
* that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 20; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (auth_pw) {
|
if(auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
while ((rc = libssh2_userauth_password(session, username, password)) ==
|
while((rc = libssh2_userauth_password(session, username, password)) ==
|
||||||
LIBSSH2_ERROR_EAGAIN);
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if(rc) {
|
||||||
printf("Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Or by public key */
|
/* Or by public key */
|
||||||
while ((rc = libssh2_userauth_publickey_fromfile(session, username,
|
const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||||
"/home/username/.ssh/id_rsa.pub",
|
const char *privkey = "/home/username/.ssh/id_rsa";
|
||||||
"/home/username/.ssh/id_rsa",
|
while((rc = libssh2_userauth_publickey_fromfile(session, username,
|
||||||
password)) ==
|
pubkey, privkey,
|
||||||
LIBSSH2_ERROR_EAGAIN);
|
password)) ==
|
||||||
if (rc) {
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
printf("\tAuthentication by public key failed\n");
|
if(rc) {
|
||||||
|
fprintf(stderr, "\tAuthentication by public key failed\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -200,28 +208,28 @@ int main(int argc, char *argv[])
|
|||||||
do {
|
do {
|
||||||
sftp_session = libssh2_sftp_init(session);
|
sftp_session = libssh2_sftp_init(session);
|
||||||
|
|
||||||
if (!sftp_session &&
|
if(!sftp_session &&
|
||||||
(libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) {
|
(libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) {
|
||||||
fprintf(stderr, "Unable to init SFTP session\n");
|
fprintf(stderr, "Unable to init SFTP session\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} while (!sftp_session);
|
} while(!sftp_session);
|
||||||
|
|
||||||
fprintf(stderr, "libssh2_sftp_open()!\n");
|
fprintf(stderr, "libssh2_sftp_open()!\n");
|
||||||
/* Request a file via SFTP */
|
/* Request a file via SFTP */
|
||||||
do {
|
do {
|
||||||
sftp_handle =
|
sftp_handle =
|
||||||
libssh2_sftp_open(sftp_session, sftppath,
|
libssh2_sftp_open(sftp_session, sftppath,
|
||||||
LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC,
|
LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|
|
||||||
LIBSSH2_SFTP_S_IRUSR|LIBSSH2_SFTP_S_IWUSR|
|
LIBSSH2_FXF_TRUNC,
|
||||||
LIBSSH2_SFTP_S_IRGRP|LIBSSH2_SFTP_S_IROTH);
|
LIBSSH2_SFTP_S_IRUSR|LIBSSH2_SFTP_S_IWUSR|
|
||||||
|
LIBSSH2_SFTP_S_IRGRP|LIBSSH2_SFTP_S_IROTH);
|
||||||
if (!sftp_handle &&
|
if(!sftp_handle &&
|
||||||
(libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) {
|
(libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) {
|
||||||
fprintf(stderr, "Unable to open file with SFTP\n");
|
fprintf(stderr, "Unable to open file with SFTP\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} while (!sftp_handle);
|
} while(!sftp_handle);
|
||||||
|
|
||||||
fprintf(stderr, "libssh2_sftp_open() is done, now send data!\n");
|
fprintf(stderr, "libssh2_sftp_open() is done, now send data!\n");
|
||||||
|
|
||||||
@@ -229,7 +237,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
nread = fread(mem, 1, sizeof(mem), local);
|
nread = fread(mem, 1, sizeof(mem), local);
|
||||||
if (nread <= 0) {
|
if(nread <= 0) {
|
||||||
/* end of file */
|
/* end of file */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -239,7 +247,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
/* write data in a loop until we block */
|
/* write data in a loop until we block */
|
||||||
while ((rc = libssh2_sftp_write(sftp_handle, ptr, nread)) ==
|
while((rc = libssh2_sftp_write(sftp_handle, ptr, nread)) ==
|
||||||
LIBSSH2_ERROR_EAGAIN) {
|
LIBSSH2_ERROR_EAGAIN) {
|
||||||
waitsocket(sock, session);
|
waitsocket(sock, session);
|
||||||
}
|
}
|
||||||
@@ -248,12 +256,12 @@ int main(int argc, char *argv[])
|
|||||||
ptr += rc;
|
ptr += rc;
|
||||||
nread -= rc;
|
nread -= rc;
|
||||||
|
|
||||||
} while (nread);
|
} while(nread);
|
||||||
} while (rc > 0);
|
} while(rc > 0);
|
||||||
|
|
||||||
duration = (int)(time(NULL)-start);
|
duration = (int)(time(NULL)-start);
|
||||||
|
|
||||||
printf("%ld bytes in %d seconds makes %.1f bytes/sec\n",
|
fprintf(stderr, "%ld bytes in %d seconds makes %.1f bytes/sec\n",
|
||||||
total, duration, total/(double)duration);
|
total, duration, total/(double)duration);
|
||||||
|
|
||||||
|
|
||||||
@@ -263,7 +271,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
shutdown:
|
shutdown:
|
||||||
|
|
||||||
while (libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing")
|
while(libssh2_session_disconnect(session, "Normal Shutdown")
|
||||||
== LIBSSH2_ERROR_EAGAIN);
|
== LIBSSH2_ERROR_EAGAIN);
|
||||||
libssh2_session_free(session);
|
libssh2_session_free(session);
|
||||||
|
|
||||||
@@ -272,7 +280,7 @@ shutdown:
|
|||||||
#else
|
#else
|
||||||
close(sock);
|
close(sock);
|
||||||
#endif
|
#endif
|
||||||
printf("all done\n");
|
fprintf(stderr, "all done\n");
|
||||||
|
|
||||||
libssh2_exit();
|
libssh2_exit();
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
* The sample code has default values for host name, user name, password
|
* The sample code has default values for host name, user name, password
|
||||||
* and path to copy, but you can specify them on the command line like:
|
* and path to copy, but you can specify them on the command line like:
|
||||||
*
|
*
|
||||||
* "sftp 192.168.0.1 user password sftp_write_nonblock.c /tmp/sftp_write_nonblock.c"
|
* "sftp 192.168.0.1 user password file /tmp/storehere"
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libssh2_config.h"
|
#include "libssh2_config.h"
|
||||||
@@ -77,10 +77,10 @@ int main(int argc, char *argv[])
|
|||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
const char *fingerprint;
|
const char *fingerprint;
|
||||||
LIBSSH2_SESSION *session;
|
LIBSSH2_SESSION *session;
|
||||||
const char *username="username";
|
const char *username = "username";
|
||||||
const char *password="password";
|
const char *password = "password";
|
||||||
const char *loclfile="sftp_write_nonblock.c";
|
const char *loclfile = "sftp_write_nonblock.c";
|
||||||
const char *sftppath="/tmp/sftp_write_nonblock.c";
|
const char *sftppath = "/tmp/sftp_write_nonblock.c";
|
||||||
int rc;
|
int rc;
|
||||||
FILE *local;
|
FILE *local;
|
||||||
LIBSSH2_SFTP *sftp_session;
|
LIBSSH2_SFTP *sftp_session;
|
||||||
@@ -94,38 +94,44 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
WSADATA wsadata;
|
WSADATA wsadata;
|
||||||
|
int err;
|
||||||
|
|
||||||
WSAStartup(MAKEWORD(2,0), &wsadata);
|
err = WSAStartup(MAKEWORD(2, 0), &wsadata);
|
||||||
|
if(err != 0) {
|
||||||
|
fprintf(stderr, "WSAStartup failed with error: %d\n", err);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (argc > 1) {
|
if(argc > 1) {
|
||||||
hostaddr = inet_addr(argv[1]);
|
hostaddr = inet_addr(argv[1]);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hostaddr = htonl(0x7F000001);
|
hostaddr = htonl(0x7F000001);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 2) {
|
if(argc > 2) {
|
||||||
username = argv[2];
|
username = argv[2];
|
||||||
}
|
}
|
||||||
if (argc > 3) {
|
if(argc > 3) {
|
||||||
password = argv[3];
|
password = argv[3];
|
||||||
}
|
}
|
||||||
if (argc > 4) {
|
if(argc > 4) {
|
||||||
loclfile = argv[4];
|
loclfile = argv[4];
|
||||||
}
|
}
|
||||||
if (argc > 5) {
|
if(argc > 5) {
|
||||||
sftppath = argv[5];
|
sftppath = argv[5];
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = libssh2_init (0);
|
rc = libssh2_init(0);
|
||||||
if (rc != 0) {
|
if(rc != 0) {
|
||||||
fprintf (stderr, "libssh2 initialization failed (%d)\n", rc);
|
fprintf(stderr, "libssh2 initialization failed (%d)\n", rc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
local = fopen(loclfile, "rb");
|
local = fopen(loclfile, "rb");
|
||||||
if (!local) {
|
if(!local) {
|
||||||
printf("Can't local file %s\n", loclfile);
|
fprintf(stderr, "Can't open local file %s\n", loclfile);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +144,7 @@ int main(int argc, char *argv[])
|
|||||||
sin.sin_family = AF_INET;
|
sin.sin_family = AF_INET;
|
||||||
sin.sin_port = htons(22);
|
sin.sin_port = htons(22);
|
||||||
sin.sin_addr.s_addr = hostaddr;
|
sin.sin_addr.s_addr = hostaddr;
|
||||||
if (connect(sock, (struct sockaddr*)(&sin),
|
if(connect(sock, (struct sockaddr*)(&sin),
|
||||||
sizeof(struct sockaddr_in)) != 0) {
|
sizeof(struct sockaddr_in)) != 0) {
|
||||||
fprintf(stderr, "failed to connect!\n");
|
fprintf(stderr, "failed to connect!\n");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -147,7 +153,7 @@ int main(int argc, char *argv[])
|
|||||||
/* Create a session instance
|
/* Create a session instance
|
||||||
*/
|
*/
|
||||||
session = libssh2_session_init();
|
session = libssh2_session_init();
|
||||||
if (!session)
|
if(!session)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Since we have set non-blocking, tell libssh2 we are non-blocking */
|
/* Since we have set non-blocking, tell libssh2 we are non-blocking */
|
||||||
@@ -156,9 +162,9 @@ int main(int argc, char *argv[])
|
|||||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||||
* and setup crypto, compression, and MAC layers
|
* and setup crypto, compression, and MAC layers
|
||||||
*/
|
*/
|
||||||
while ((rc = libssh2_session_handshake(session, sock))
|
while((rc = libssh2_session_handshake(session, sock))
|
||||||
== LIBSSH2_ERROR_EAGAIN);
|
== LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if(rc) {
|
||||||
fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
|
fprintf(stderr, "Failure establishing SSH session: %d\n", rc);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -169,29 +175,31 @@ int main(int argc, char *argv[])
|
|||||||
* that's your call
|
* that's your call
|
||||||
*/
|
*/
|
||||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||||
printf("Fingerprint: ");
|
fprintf(stderr, "Fingerprint: ");
|
||||||
for(i = 0; i < 20; i++) {
|
for(i = 0; i < 20; i++) {
|
||||||
printf("%02X ", (unsigned char)fingerprint[i]);
|
fprintf(stderr, "%02X ", (unsigned char)fingerprint[i]);
|
||||||
}
|
}
|
||||||
printf("\n");
|
fprintf(stderr, "\n");
|
||||||
|
|
||||||
if (auth_pw) {
|
if(auth_pw) {
|
||||||
/* We could authenticate via password */
|
/* We could authenticate via password */
|
||||||
while ((rc = libssh2_userauth_password(session, username, password)) ==
|
while((rc = libssh2_userauth_password(session, username, password)) ==
|
||||||
LIBSSH2_ERROR_EAGAIN);
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
if (rc) {
|
if(rc) {
|
||||||
printf("Authentication by password failed.\n");
|
fprintf(stderr, "Authentication by password failed.\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
/* Or by public key */
|
/* Or by public key */
|
||||||
while ((rc = libssh2_userauth_publickey_fromfile(session, username,
|
#define PUBKEY "/home/username/.ssh/id_rsa.pub"
|
||||||
"/home/username/.ssh/id_rsa.pub",
|
#define PRIVKEY "/home/username/.ssh/id_rsa"
|
||||||
"/home/username/.ssh/id_rsa",
|
while((rc = libssh2_userauth_publickey_fromfile(session, username,
|
||||||
password)) ==
|
PUBKEY, PRIVKEY,
|
||||||
LIBSSH2_ERROR_EAGAIN);
|
password)) ==
|
||||||
if (rc) {
|
LIBSSH2_ERROR_EAGAIN);
|
||||||
printf("\tAuthentication by public key failed\n");
|
if(rc) {
|
||||||
|
fprintf(stderr, "\tAuthentication by public key failed\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -200,28 +208,29 @@ int main(int argc, char *argv[])
|
|||||||
do {
|
do {
|
||||||
sftp_session = libssh2_sftp_init(session);
|
sftp_session = libssh2_sftp_init(session);
|
||||||
|
|
||||||
if (!sftp_session &&
|
if(!sftp_session &&
|
||||||
(libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) {
|
(libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) {
|
||||||
fprintf(stderr, "Unable to init SFTP session\n");
|
fprintf(stderr, "Unable to init SFTP session\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} while (!sftp_session);
|
} while(!sftp_session);
|
||||||
|
|
||||||
fprintf(stderr, "libssh2_sftp_open()!\n");
|
fprintf(stderr, "libssh2_sftp_open()!\n");
|
||||||
/* Request a file via SFTP */
|
/* Request a file via SFTP */
|
||||||
do {
|
do {
|
||||||
sftp_handle =
|
sftp_handle =
|
||||||
libssh2_sftp_open(sftp_session, sftppath,
|
libssh2_sftp_open(sftp_session, sftppath,
|
||||||
LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|LIBSSH2_FXF_TRUNC,
|
LIBSSH2_FXF_WRITE|LIBSSH2_FXF_CREAT|
|
||||||
LIBSSH2_SFTP_S_IRUSR|LIBSSH2_SFTP_S_IWUSR|
|
LIBSSH2_FXF_TRUNC,
|
||||||
LIBSSH2_SFTP_S_IRGRP|LIBSSH2_SFTP_S_IROTH);
|
LIBSSH2_SFTP_S_IRUSR|LIBSSH2_SFTP_S_IWUSR|
|
||||||
|
LIBSSH2_SFTP_S_IRGRP|LIBSSH2_SFTP_S_IROTH);
|
||||||
|
|
||||||
if (!sftp_handle &&
|
if(!sftp_handle &&
|
||||||
(libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) {
|
(libssh2_session_last_errno(session) != LIBSSH2_ERROR_EAGAIN)) {
|
||||||
fprintf(stderr, "Unable to open file with SFTP\n");
|
fprintf(stderr, "Unable to open file with SFTP\n");
|
||||||
goto shutdown;
|
goto shutdown;
|
||||||
}
|
}
|
||||||
} while (!sftp_handle);
|
} while(!sftp_handle);
|
||||||
|
|
||||||
fprintf(stderr, "libssh2_sftp_open() is done, now send data!\n");
|
fprintf(stderr, "libssh2_sftp_open() is done, now send data!\n");
|
||||||
|
|
||||||
@@ -230,9 +239,9 @@ int main(int argc, char *argv[])
|
|||||||
memuse = 0; /* it starts blank */
|
memuse = 0; /* it starts blank */
|
||||||
do {
|
do {
|
||||||
nread = fread(&mem[memuse], 1, sizeof(mem)-memuse, local);
|
nread = fread(&mem[memuse], 1, sizeof(mem)-memuse, local);
|
||||||
if (nread <= 0) {
|
if(nread <= 0) {
|
||||||
/* end of file */
|
/* end of file */
|
||||||
if (memuse > 0)
|
if(memuse > 0)
|
||||||
/* the previous sending is not finished */
|
/* the previous sending is not finished */
|
||||||
nread = 0;
|
nread = 0;
|
||||||
else
|
else
|
||||||
@@ -242,7 +251,7 @@ int main(int argc, char *argv[])
|
|||||||
total += nread;
|
total += nread;
|
||||||
|
|
||||||
/* write data in a loop until we block */
|
/* write data in a loop until we block */
|
||||||
while ((rc = libssh2_sftp_write(sftp_handle, mem, memuse)) ==
|
while((rc = libssh2_sftp_write(sftp_handle, mem, memuse)) ==
|
||||||
LIBSSH2_ERROR_EAGAIN) {
|
LIBSSH2_ERROR_EAGAIN) {
|
||||||
waitsocket(sock, session);
|
waitsocket(sock, session);
|
||||||
}
|
}
|
||||||
@@ -258,11 +267,11 @@ int main(int argc, char *argv[])
|
|||||||
/* 'mem' was consumed fully */
|
/* 'mem' was consumed fully */
|
||||||
memuse = 0;
|
memuse = 0;
|
||||||
|
|
||||||
} while (rc > 0);
|
} while(rc > 0);
|
||||||
|
|
||||||
duration = (int)(time(NULL)-start);
|
duration = (int)(time(NULL)-start);
|
||||||
|
|
||||||
printf("%ld bytes in %d seconds makes %.1f bytes/sec\n",
|
fprintf(stderr, "%ld bytes in %d seconds makes %.1f bytes/sec\n",
|
||||||
total, duration, total/(double)duration);
|
total, duration, total/(double)duration);
|
||||||
|
|
||||||
|
|
||||||
@@ -272,8 +281,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
shutdown:
|
shutdown:
|
||||||
|
|
||||||
while (libssh2_session_disconnect(session, "Normal Shutdown, Thank you for playing")
|
while(libssh2_session_disconnect(session, "Normal Shutdown")
|
||||||
== LIBSSH2_ERROR_EAGAIN);
|
== LIBSSH2_ERROR_EAGAIN);
|
||||||
libssh2_session_free(session);
|
libssh2_session_free(session);
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
@@ -281,7 +290,7 @@ shutdown:
|
|||||||
#else
|
#else
|
||||||
close(sock);
|
close(sock);
|
||||||
#endif
|
#endif
|
||||||
printf("all done\n");
|
fprintf(stderr, "all done\n");
|
||||||
|
|
||||||
libssh2_exit();
|
libssh2_exit();
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user