mirror of
https://github.com/libssh2/libssh2.git
synced 2026-10-24 03:48:58 +03:00
badwords: add checker script, fix issues found
Checker script and wordlist comes from curl. Also: - checksrc.pl: sync up with curl. - unfold an IETF URL. - update all IETF URLs where missing. Closes #1959
This commit is contained in:
2
.github/SECURITY.md
vendored
2
.github/SECURITY.md
vendored
@@ -10,7 +10,7 @@ See [SECURITY.md](https://github.com/libssh2/libssh2/blob/master/docs/SECURITY.m
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you have found or just suspect a security problem somewhere in libssh2,
|
||||
If you have found or suspect a security problem somewhere in libssh2,
|
||||
email `libssh2-security@haxx.se` about it.
|
||||
|
||||
**Do not submit suspected security issues in the public bug tracker!**
|
||||
|
||||
4
.github/stale.yml
vendored
4
.github/stale.yml
vendored
@@ -6,7 +6,7 @@
|
||||
daysUntilStale: 120
|
||||
# Number of days of inactivity before a stale issue is closed
|
||||
daysUntilClose: 30
|
||||
# Issues with these labels will never be considered stale
|
||||
# Issues with these labels are never considered stale
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
@@ -15,7 +15,7 @@ staleLabel: stale
|
||||
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||
markComment: >
|
||||
This issue has been automatically marked as stale because it has not had
|
||||
recent activity. It will be closed if no further activity occurs. Thank you
|
||||
recent activity. It is closed if no further activity occurs. Thank you
|
||||
for your contributions.
|
||||
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||
closeComment: false
|
||||
|
||||
@@ -573,7 +573,7 @@ if(LIBSSH2_BUILD_DOCS)
|
||||
set(_build_docs TRUE)
|
||||
add_subdirectory(docs)
|
||||
else()
|
||||
message(WARNING "Perl not found. Will not build manuals.")
|
||||
message(WARNING "Perl not found. Cannot build manuals.")
|
||||
endif()
|
||||
endif()
|
||||
add_feature_info("Docs" _build_docs "build docs")
|
||||
|
||||
@@ -38,6 +38,9 @@ OS400FILES = os400/README400 os400/initscript.sh os400/make.sh \
|
||||
os400/rpg-examples/SFTPXMPLE
|
||||
|
||||
SCRIPTSFILES = \
|
||||
scripts/badwords \
|
||||
scripts/badwords-all \
|
||||
scripts/badwords.txt \
|
||||
scripts/cd2nroff \
|
||||
scripts/checksrc-all.pl \
|
||||
scripts/checksrc.pl \
|
||||
|
||||
@@ -150,7 +150,7 @@ This release includes the following enhancements and bugfixes:
|
||||
- cmake: bump policy_max, add `FATAL_ERROR` for old cmake versions (717c0836 #1510)
|
||||
- cmake: fix cmake warnings (47258265 #1511)
|
||||
- cmake: tidy up `-j` make option in integration tests (389d70bf #1509)
|
||||
- cmake: build but don't install static lib in certain conditions (5d03b4f9 #1469 #1450)
|
||||
- cmake: build but do not install static lib in certain conditions (5d03b4f9 #1469 #1450)
|
||||
- cmake: add clang-cl support to PickyWarnings.cmake (bf9bb045 #1480)
|
||||
- cmake: tidy up variables names in PickyWarnings.cmake (ac00f6c4 #1478)
|
||||
- cmake: decorate comments in Find modules (efad5f90 #1477)
|
||||
@@ -286,14 +286,14 @@ This release includes the following enhancements and bugfixes:
|
||||
- knownhost: fix for short hostnames (704299e9 #1500)
|
||||
- knownhost: improve known_hosts parsing and harden _libssh2_base64_encode() (d1c0e14d #1641)
|
||||
- knownhost: handle malformed comments in known_hosts parsing #1628 (aa4c7b5b #1629 #1628)
|
||||
- libgcrypt: bump weak random to very strong in `_libssh2_dh_key_pair()` (776be9f9 #1929 #149 follow: f7daf318)
|
||||
- libgcrypt: bump weak random to strong in `_libssh2_dh_key_pair()` (776be9f9 #1929 #149 follow: f7daf318)
|
||||
- libgcrypt: add support for RSA SHA-256/SHA-512 (f4642222 #1600)
|
||||
- libssh2_base64_decode: add deprecation warning (cf3aac1a)
|
||||
- libssh2_poll: add deprecated attribute, drop from no-deprecated builds (94d4a2d1 #1838 #1266 follow: 2b8038e1 follow: b1414503)
|
||||
- libssh2_scp_send, libssh2_scp_send_ex: add deprecation warning (70276045)
|
||||
- libssh2_trace.3: Update prototype (7495084b #1518 #1517)
|
||||
- libssh2.h: merge two `#if` branches (cbdb0a8c #1869 #1793 #1578)
|
||||
- libssh2.h: _WINDLL being defined doesn't mean libssh2 was built as a DLL (35326015 #1793 #1578)
|
||||
- libssh2.h: _WINDLL being defined does not mean libssh2 was built as a DLL (35326015 #1793 #1578)
|
||||
- libssh2.h: drop stray bits of Windows CE support (1d464325 #1770)
|
||||
- libssh2.h: typo fixes (780bf13a #1496)
|
||||
- libssh2.h: add note about release versions to `LIBSSH2_VERSION` (83590ac7 #1475 #771 #1473)
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
# This file describes the licensing and copyright situation for files that
|
||||
# cannot be annotated directly, for example because of being simply
|
||||
# uncommentable. Unless this is the case, a file should be annotated directly.
|
||||
# cannot be annotated directly, for example because of being uncommentable.
|
||||
# Unless this is the case, a file should be annotated directly.
|
||||
#
|
||||
# This follows the REUSE specification: https://reuse.software/spec-3.2/#reusetoml
|
||||
|
||||
|
||||
34
acinclude.m4
34
acinclude.m4
@@ -4,7 +4,7 @@ dnl CURL_CPP_P
|
||||
dnl
|
||||
dnl Check if $cpp -P should be used for extract define values due to gcc 5
|
||||
dnl splitting up strings and defines between line outputs. gcc by default
|
||||
dnl (without -P) will show TEST EINVAL TEST as
|
||||
dnl (without -P) shows TEST EINVAL TEST as
|
||||
dnl
|
||||
dnl # 13 "conftest.c"
|
||||
dnl TEST
|
||||
@@ -51,11 +51,11 @@ TEST EINVAL TEST
|
||||
dnl CURL_CHECK_DEF (SYMBOL, [INCLUDES], [SILENT])
|
||||
dnl -------------------------------------------------
|
||||
dnl Use the C preprocessor to find out if the given object-style symbol
|
||||
dnl is defined and get its expansion. This macro will not use default
|
||||
dnl includes even if no INCLUDES argument is given. This macro will run
|
||||
dnl is defined and get its expansion. This macro does not use default
|
||||
dnl includes even if no INCLUDES argument is given. This macro runs
|
||||
dnl silently when invoked with three arguments. If the expansion would
|
||||
dnl result in a set of double-quoted strings the returned expansion will
|
||||
dnl actually be a single double-quoted string concatenating all them.
|
||||
dnl result in a set of double-quoted strings the returned expansion is
|
||||
dnl actually a single double-quoted string concatenating all them.
|
||||
|
||||
AC_DEFUN([CURL_CHECK_DEF], [
|
||||
AC_REQUIRE([CURL_CPP_P])
|
||||
@@ -199,7 +199,7 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
|
||||
clangvlo=`echo $clangver | cut -d . -f2`
|
||||
compiler_num=`(expr $clangvhi "*" 100 + $clangvlo) 2>/dev/null`
|
||||
if test "$appleclang" = '1' && test "$oldapple" = '0'; then
|
||||
dnl Starting with Xcode 7 / clang 3.7, Apple clang won't tell its upstream version
|
||||
dnl Starting with Xcode 7 / clang 3.7, Apple clang does not tell its upstream version
|
||||
if test "$compiler_num" -ge '1700'; then compiler_num='1901'
|
||||
elif test "$compiler_num" -ge '1600'; then compiler_num='1700'
|
||||
elif test "$compiler_num" -ge '1500'; then compiler_num='1600'
|
||||
@@ -256,7 +256,7 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-noreturn])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [old-style-definition])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [redundant-decls])
|
||||
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [switch-enum]) # Not used because this basically disallows default case
|
||||
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [switch-enum]) # Not used: It makes default case unusable
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [type-limits])
|
||||
if test "x$have_windows_h" != "xyes"; then
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-macros]) # Seen to clash with libtool-generated stub code
|
||||
@@ -275,7 +275,7 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [sign-conversion])
|
||||
tmp_CFLAGS="$tmp_CFLAGS -Wno-error=sign-conversion" # FIXME
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [shift-sign-overflow])
|
||||
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [padded]) # Not used because we cannot change public structs
|
||||
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [padded]) # Not used: We cannot change public structs
|
||||
fi
|
||||
|
||||
dnl Only clang 3.0 or later
|
||||
@@ -340,7 +340,7 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
|
||||
case "$CFLAGS" in
|
||||
*-std=c89*|*-std=c90*|*-std=gnu89*|*-std=gnu90*)
|
||||
if test "$compiler_num" -ge "309"; then
|
||||
tmp_CFLAGS="$tmp_CFLAGS -Wno-comma" # Just silly
|
||||
tmp_CFLAGS="$tmp_CFLAGS -Wno-comma" # Silly
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -381,7 +381,7 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
|
||||
tmp_CFLAGS="-wd279,269,981,1418,1419"
|
||||
|
||||
if test "$compiler_num" -gt "600"; then
|
||||
dnl icc 6.0 and older doesn't have the -Wall flag
|
||||
dnl icc 6.0 and older does not have the -Wall flag
|
||||
tmp_CFLAGS="-Wall $tmp_CFLAGS"
|
||||
fi
|
||||
else dnl $ICC = yes
|
||||
@@ -452,10 +452,10 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-field-initializers])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [missing-noreturn])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unreachable-code unused-parameter])
|
||||
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [padded]) # Not used because we cannot change public structs
|
||||
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [padded]) # Not used: We cannot change public structs
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [pragmas])
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [redundant-decls])
|
||||
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [switch-enum]) # Not used because this basically disallows default case
|
||||
# CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [switch-enum]) # Not used: It makes default case unusable
|
||||
CURL_ADD_COMPILER_WARNINGS([tmp_CFLAGS], [unused-macros])
|
||||
fi
|
||||
|
||||
@@ -551,7 +551,7 @@ AC_DEFUN([CURL_CC_DEBUG_OPTS],
|
||||
case "$flag" in
|
||||
-I*)
|
||||
dnl Include path, provide a -isystem option for the same dir
|
||||
dnl to prevent warnings in those dirs. The -isystem was not very
|
||||
dnl to prevent warnings in those dirs. The -isystem was not
|
||||
dnl reliable on earlier gcc versions.
|
||||
add=`echo $flag | sed 's/^-I/-isystem /g'`
|
||||
tmp_CFLAGS="$tmp_CFLAGS $add"
|
||||
@@ -776,10 +776,10 @@ AC_DEFUN([CURL_CHECK_NEED_REENTRANT_SYSTEM], [
|
||||
dnl CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT
|
||||
dnl -------------------------------------------------
|
||||
dnl This macro ensures that configuration tests done
|
||||
dnl after this will execute with preprocessor symbol
|
||||
dnl after this execute with preprocessor symbol
|
||||
dnl _REENTRANT defined. This macro also ensures that
|
||||
dnl the generated config file defines NEED_REENTRANT
|
||||
dnl and that in turn setup.h will define _REENTRANT.
|
||||
dnl and that in turn setup.h defines _REENTRANT.
|
||||
dnl Internal macro for CURL_CONFIGURE_REENTRANT.
|
||||
|
||||
AC_DEFUN([CURL_CONFIGURE_FROM_NOW_ON_WITH_REENTRANT], [
|
||||
@@ -795,7 +795,7 @@ _EOF
|
||||
dnl CURL_CONFIGURE_REENTRANT
|
||||
dnl -------------------------------------------------
|
||||
dnl This first checks if the preprocessor _REENTRANT
|
||||
dnl symbol is already defined. If it isn't currently
|
||||
dnl symbol is already defined. If it is not currently
|
||||
dnl defined a set of checks are performed to verify
|
||||
dnl if its definition is required to make visible to
|
||||
dnl the compiler a set of *_r functions. Finally, if
|
||||
@@ -851,7 +851,7 @@ dnl --------------------------
|
||||
dnl Wrapper around LIBSSH2_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 includes a directory named lib64. To find libraries in $prefix/lib
|
||||
dnl we append -L$prefix/lib to LDFLAGS before checking.
|
||||
dnl
|
||||
dnl For convenience, $4 is expanded if [lib]$1 is found.
|
||||
|
||||
@@ -44,10 +44,10 @@ include(CheckLibraryExists)
|
||||
# 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 if found, this defines <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
|
||||
# defines 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
|
||||
|
||||
@@ -9,7 +9,7 @@ include(CheckCSourceCompiles)
|
||||
# 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
|
||||
# One of the following variables are set indicating the supported
|
||||
# method (if any):
|
||||
# HAVE_O_NONBLOCK
|
||||
# HAVE_FIONBIO
|
||||
|
||||
@@ -98,7 +98,7 @@ if(PICKY_COMPILER)
|
||||
-Wsign-conversion # clang 2.9 gcc 4.3
|
||||
-Wno-error=sign-conversion # FIXME
|
||||
-Wstrict-prototypes # clang 1.0 gcc 3.3
|
||||
# -Wswitch-enum # clang 2.7 gcc 4.1 # Not used: It basically disallows default case
|
||||
# -Wswitch-enum # clang 2.7 gcc 4.1 # Not used: It makes default case unusable
|
||||
-Wtype-limits # clang 2.7 gcc 4.3
|
||||
-Wunreachable-code # clang 2.7 gcc 4.1
|
||||
-Wunused-macros # clang 2.7 gcc 4.1
|
||||
@@ -266,7 +266,7 @@ if(PICKY_COMPILER)
|
||||
list(APPEND _picky "-wd4774") # 'snprintf': format string expected in argument 3 is not a string literal
|
||||
list(APPEND _picky "-wd4820") # 'A': 'N' bytes padding added after data member 'B'
|
||||
if(MSVC_VERSION GREATER_EQUAL 1900)
|
||||
list(APPEND _picky "-wd5045") # Compiler will insert Spectre mitigation for memory load if /Qspectre switch specified
|
||||
list(APPEND _picky "-wd5045") # Compiler inserts Spectre mitigation for memory load if /Qspectre switch specified
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@@ -292,7 +292,7 @@ endif()
|
||||
if(CMAKE_C_STANDARD STREQUAL 90)
|
||||
if((CMAKE_C_COMPILER_ID STREQUAL "Clang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 3.9) OR
|
||||
(CMAKE_C_COMPILER_ID STREQUAL "AppleClang" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 8.1))
|
||||
list(APPEND _picky "-Wno-comma") # Just silly
|
||||
list(APPEND _picky "-Wno-comma") # Silly
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ AS_HELP_STRING([--disable-docs],[Disable documentation]),
|
||||
BUILD_DOCS=1
|
||||
)
|
||||
if test -z "$PERL" -a "x$BUILD_DOCS" != "x0"; then
|
||||
AC_MSG_WARN([perl was not found. Will not build documentation.])
|
||||
AC_MSG_WARN([perl was not found. Cannot build documentation.])
|
||||
BUILD_DOCS=0
|
||||
fi
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ int 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().
|
||||
keylen-byte key. Is invoked right after libssh2_hmac_ctx_init().
|
||||
Returns 1 for success and 0 for failure.
|
||||
|
||||
3.2) SHA-256
|
||||
@@ -162,7 +162,7 @@ int 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().
|
||||
keylen-byte key. Is invoked right after libssh2_hmac_ctx_init().
|
||||
Returns 1 for success and 0 for failure.
|
||||
|
||||
3.3) SHA-384
|
||||
@@ -246,7 +246,7 @@ int 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().
|
||||
keylen-byte key. Is invoked right after libssh2_hmac_ctx_init().
|
||||
Returns 1 for success and 0 for failure.
|
||||
|
||||
3.5) MD5
|
||||
@@ -285,7 +285,7 @@ int 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().
|
||||
keylen-byte key. Is invoked right after libssh2_hmac_ctx_init().
|
||||
Returns 1 for success and 0 for failure.
|
||||
|
||||
3.6) RIPEMD-160
|
||||
@@ -297,7 +297,7 @@ int 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().
|
||||
the keylen-byte key. Is invoked right after libssh2_hmac_ctx_init().
|
||||
Returns 1 for success and 0 for failure.
|
||||
|
||||
4) Bidirectional key ciphers.
|
||||
@@ -968,7 +968,7 @@ const char *_libssh2_supported_key_sign_algorithms(LIBSSH2_SESSION *session,
|
||||
|
||||
This function is for implementing key hash upgrading as defined in RFC 8332.
|
||||
|
||||
Based on the incoming key_method value, this function will return a
|
||||
Based on the incoming key_method value, this function returns a
|
||||
list of supported algorithms that can upgrade the original key method algorithm
|
||||
as a comma separated list, if there is no upgrade option this function should
|
||||
return NULL.
|
||||
|
||||
@@ -148,7 +148,7 @@ their locations.
|
||||
## Specifying the System Type
|
||||
|
||||
There may be some features `configure` cannot figure out automatically, but
|
||||
needs to determine by the type of machine the package will run on. Usually,
|
||||
needs to determine by the type of machine the package runs on. Usually,
|
||||
assuming the package is built to be run on the _same_ architectures,
|
||||
`configure` can figure that out, but if it prints a message saying it cannot
|
||||
guess the machine type, give it the `--build=TYPE` option. TYPE can either be
|
||||
@@ -170,12 +170,12 @@ See the file `config.sub` for the possible values of each field. If
|
||||
to know the machine type.
|
||||
|
||||
If you are _building_ compiler tools for cross-compiling, you should use the
|
||||
option `--target=TYPE` to select the type of system they will produce code
|
||||
option `--target=TYPE` to select the type of system they produce code
|
||||
for.
|
||||
|
||||
If you want to _use_ a cross compiler, that generates code for a platform
|
||||
different from the build platform, you should specify the "host" platform
|
||||
(i.e., that on which the generated programs will eventually be run) with
|
||||
(i.e., that on which the generated programs eventually runs) with
|
||||
`--host=TYPE`.
|
||||
|
||||
## Sharing Defaults
|
||||
@@ -236,7 +236,7 @@ configuration-related scripts to be executed by `/bin/bash`.
|
||||
* `--quiet`, `--silent`, `-q`
|
||||
|
||||
Do not print messages saying which checks are being made. To suppress all
|
||||
normal output, redirect it to `/dev/null` (any error messages will still be
|
||||
normal output, redirect it to `/dev/null` (any error messages are still
|
||||
shown).
|
||||
|
||||
* `--srcdir=DIR`
|
||||
@@ -258,7 +258,7 @@ Some `./configure` options deserve additional comments:
|
||||
libssh2 can use the [Libgcrypt](https://www.gnupg.org/) library for
|
||||
cryptographic operations. One of the cryptographic libraries is required.
|
||||
|
||||
Configure will attempt to locate Libgcrypt automatically.
|
||||
Configure attempts to locate Libgcrypt automatically.
|
||||
|
||||
If your installation of Libgcrypt is in another location, specify it using
|
||||
`--with-libgcrypt-prefix`.
|
||||
@@ -270,7 +270,7 @@ Some `./configure` options deserve additional comments:
|
||||
libssh2 can use the [OpenSSL library](https://www.openssl-library.org/) for
|
||||
cryptographic operations. One of the cryptographic libraries is required.
|
||||
|
||||
Configure will attempt to locate OpenSSL in the default location.
|
||||
Configure attempts to locate OpenSSL in the default location.
|
||||
|
||||
If your installation of OpenSSL is in another location, specify it using
|
||||
`--with-libssl-prefix`.
|
||||
@@ -283,7 +283,7 @@ Some `./configure` options deserve additional comments:
|
||||
[mbedTLS library](https://www.trustedfirmware.org/projects/mbed-tls/) for
|
||||
cryptographic operations. One of the cryptographic libraries is required.
|
||||
|
||||
Configure will attempt to locate mbedTLS in the default location.
|
||||
Configure attempts to locate mbedTLS in the default location.
|
||||
|
||||
If your installation of mbedTLS is in another location, specify it using
|
||||
`--with-libmbedcrypto-prefix`.
|
||||
@@ -292,7 +292,7 @@ Some `./configure` options deserve additional comments:
|
||||
* `--without-libz`
|
||||
* `--with-libz-prefix=[DIR]`
|
||||
|
||||
If present, libssh2 will attempt to use the [zlib](https://zlib.net/) for
|
||||
If present, libssh2 attempts to use the [zlib](https://zlib.net/) for
|
||||
payload compression, however zlib is not required.
|
||||
|
||||
If your installation of Libz is in another location, specify it using
|
||||
@@ -300,5 +300,5 @@ Some `./configure` options deserve additional comments:
|
||||
|
||||
* `--enable-debug`
|
||||
|
||||
Will make the build use more pedantic and strict compiler options as well
|
||||
Makes the build use more pedantic and strict compiler options as well
|
||||
as enable the `libssh2_trace()` function (for showing debug traces).
|
||||
|
||||
@@ -31,8 +31,8 @@ cmake -B bld
|
||||
cmake --build bld
|
||||
```
|
||||
|
||||
libssh2 will be built as a static library and will use any cryptography
|
||||
library available. The library binary will be put in `bld/src`, with the
|
||||
libssh2 is built as a static library and uses any cryptography library
|
||||
available. The library binary is put in `bld/src`, with the
|
||||
examples in `bld/example` and the tests in `bld/tests`.
|
||||
|
||||
## Customising the build
|
||||
@@ -69,7 +69,7 @@ The following options are available:
|
||||
[`mbedTLS`](https://www.trustedfirmware.org/projects/mbed-tls/) or blank
|
||||
to use any library available.
|
||||
|
||||
CMake will attempt to locate the libraries automatically. For more
|
||||
CMake attempts to locate the libraries automatically. For more
|
||||
information, visit:
|
||||
<https://cmake.org/cmake/help/v3.18/manual/cmake-packages.7.html>
|
||||
|
||||
@@ -140,7 +140,7 @@ project.
|
||||
## How can I use libssh2 in my project if it also uses CMake?
|
||||
|
||||
If your own project also uses CMake, you do not need to worry about setting it
|
||||
up with libssh2's location. Add the following lines and CMake will find
|
||||
up with libssh2's location. Add the following lines and CMake finds
|
||||
libssh2 on your system, set up the necessary paths and link the library with
|
||||
your binary.
|
||||
|
||||
@@ -151,9 +151,9 @@ target_link_libraries(my_project_target libssh2::libssh2)
|
||||
|
||||
You still have to make libssh2 available on your system first. You can install
|
||||
it in the traditional way shown above, but you do not have to. Instead you can
|
||||
build it, which will export its location to the user
|
||||
build it, which exports its location to the user
|
||||
[package registry](https://cmake.org/cmake/help/v3.18/manual/cmake-packages.7.html#package-registry)
|
||||
where `find_package` will find it.
|
||||
where `find_package` finds it.
|
||||
|
||||
You can even combine the two steps using a so-called
|
||||
['superbuild' project](https://www.kitware.com/main/wp-content/uploads/2016/01/kitware_quarterly1009.pdf)
|
||||
|
||||
@@ -7,7 +7,7 @@ if BUILD_DOCS
|
||||
# Get man_MANS variable
|
||||
include Makefile.inc
|
||||
|
||||
MANPAGES = $(man_MANS:.3=.md)
|
||||
MAN_PAGESS = $(man_MANS:.3=.md)
|
||||
CLEANFILES = $(man_MANS)
|
||||
SUFFIXES = .3 .md
|
||||
|
||||
@@ -16,6 +16,6 @@ SUFFIXES = .3 .md
|
||||
|
||||
endif
|
||||
|
||||
EXTRA_DIST = $(MANPAGES) template.md AUTHORS BINDINGS.md HACKING.md \
|
||||
EXTRA_DIST = $(MAN_PAGESS) template.md AUTHORS BINDINGS.md HACKING.md \
|
||||
HACKING-CRYPTO INSTALL-AUTOTOOLS.md INSTALL-CMAKE.md REQUIREMENTS.md \
|
||||
SECURITY.md TODO.md CMakeLists.txt
|
||||
|
||||
@@ -11,7 +11,7 @@ should be handled in the libssh2 project.
|
||||
|
||||
## Publishing Information
|
||||
|
||||
All known and public libssh2 vulnerabilities will be listed on [the libssh2
|
||||
All known and public libssh2 vulnerabilities are listed on [the libssh2
|
||||
web site](https://libssh2.org/).
|
||||
|
||||
Security vulnerabilities should not be entered in the project's public bug
|
||||
@@ -24,7 +24,7 @@ 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
|
||||
bug tracker entry must NOT be created to track the issue since that makes
|
||||
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
|
||||
@@ -38,7 +38,7 @@ announcement.
|
||||
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
|
||||
- A person in the security team sends an email to the original reporter to
|
||||
acknowledge the report.
|
||||
|
||||
- The security team investigates the report and either rejects it or accepts
|
||||
@@ -67,7 +67,7 @@ announcement.
|
||||
[distros@openwall](https://oss-security.openwall.org/wiki/mailing-lists/distros)
|
||||
when also informing and preparing them for the upcoming public security
|
||||
vulnerability announcement - attach the advisory draft for information. Note
|
||||
that 'distros' will not accept an embargo longer than 14 days.
|
||||
that 'distros' do not accept an embargo longer than 14 days.
|
||||
|
||||
- Update the "security advisory" with the CVE number.
|
||||
|
||||
@@ -86,7 +86,7 @@ announcement.
|
||||
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
|
||||
- The security webpage on the web site should get the new vulnerability
|
||||
mentioned.
|
||||
|
||||
# Not security issues
|
||||
@@ -140,14 +140,14 @@ security issues.
|
||||
# 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 is not very
|
||||
formal. We basically only require that you have a long-term presence in the
|
||||
libssh2 project and you have shown an understanding for the project and its way
|
||||
of working. You must have been around for a good while and you should have no
|
||||
might ask you to join the list or you can ask to join it. It really is not
|
||||
formal. We 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 have been around for a good while and you should have no
|
||||
plans in vanishing in the near future.
|
||||
|
||||
We do not make the list of participants public mostly because it tends to vary
|
||||
somewhat over time and a list somewhere will only risk getting outdated.
|
||||
somewhat over time and a list somewhere only risks getting outdated.
|
||||
|
||||
# GitHub Private Vulnerability Reporting
|
||||
|
||||
|
||||
16
docs/TODO.md
16
docs/TODO.md
@@ -15,7 +15,7 @@ SPDX-License-Identifier: BSD-3-Clause
|
||||
does not then use as much memory as today. Possibly by an app-controllable
|
||||
"Window mode"?
|
||||
|
||||
* Decrease the number of mallocs. Everywhere. Will get easier once the
|
||||
* Decrease the number of mallocs. Everywhere. It gets easier once the
|
||||
buffering improvements have been done.
|
||||
|
||||
* Use `SO_NOSIGPIPE` for macOS/BSD systems where `MSG_NOSIGNAL` does not
|
||||
@@ -109,7 +109,7 @@ slow. (The original API had the `libssh2_poll_channel_read()` and
|
||||
much the same problems plus a few others.)
|
||||
|
||||
Traffic in the other direction is similarly limited: the app has to try
|
||||
sending to all channels, even though some of them may very well not accept any
|
||||
sending to all channels, even though some of them may well not accept any
|
||||
data at that point.
|
||||
|
||||
A SOLUTION
|
||||
@@ -119,15 +119,15 @@ I suggest we introduce two new helper functions:
|
||||
- `libssh2_transport_read()`
|
||||
|
||||
Read "a bunch" of data from the given socket and returns information to the
|
||||
app about what channels that are now readable (ie they will not block when
|
||||
read from). The function can be called over and over and it will repeatedly
|
||||
return info about what channels that are readable at that moment.
|
||||
app about what channels that are now readable (i.e. they do not block when
|
||||
read from). The function can be called over and over and it repeatedly
|
||||
returns info about what channels that are readable at that moment.
|
||||
|
||||
- `libssh2_transport_write()`
|
||||
|
||||
Returns information about what channels that are writable, in the sense
|
||||
that they have windows set from the remote side that allows data to get
|
||||
sent. Writing to one of those channels will not block. Of course, the
|
||||
sent. Writing to one of those channels does not block. Of course, the
|
||||
underlying socket may only accept a certain amount of data, so at the first
|
||||
short return, nothing more should be attempted to get sent until `select()`
|
||||
(or equivalent) has been used on the master socket again.
|
||||
@@ -139,8 +139,8 @@ out.
|
||||
VOLUNTARY
|
||||
|
||||
I wanted to mention that these two helper functions would not be mandatory in
|
||||
any way. They would just be there for those who want them, and existing
|
||||
programs can remain using the old functions only if they prefer to.
|
||||
any way. They would be there for those who want them, and existing programs
|
||||
can remain using the old functions only if they prefer to.
|
||||
|
||||
## New SFTP API
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ libssh2_agent_userauth(LIBSSH2_AGENT *agent,
|
||||
|
||||
*agent* - ssh-agent handle as returned by libssh2_agent_init(3)
|
||||
|
||||
*username* - Remote user name to authenticate as.
|
||||
*username* - Remote username to authenticate as.
|
||||
|
||||
*identity* - Public key to authenticate with, as returned by
|
||||
libssh2_agent_get_identity(3)
|
||||
|
||||
@@ -31,10 +31,10 @@ This function is **DEPRECATED** in 1.4.0. Use the
|
||||
|
||||
*banner* - A pointer to a user defined banner
|
||||
|
||||
Set the banner that will be sent to the remote host when the SSH session is
|
||||
Set the banner that is sent to the remote host when the SSH session is
|
||||
started with libssh2_session_handshake(3)
|
||||
This is optional; a banner corresponding to the protocol and libssh2 version
|
||||
will be sent by default.
|
||||
is sent by default.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
|
||||
@@ -24,12 +24,11 @@ libssh2_base64_decode(LIBSSH2_SESSION *session, char **dest,
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
This function is deemed DEPRECATED in 1.0 and will be removed from libssh2
|
||||
This function is deemed DEPRECATED in 1.0 and is removed from libssh2
|
||||
in a future version. Do not use it!
|
||||
|
||||
Decode a base64 chunk and store it into a newly allocated buffer. 'dest_len'
|
||||
will be set to hold the length of the returned buffer that '*dest' will point
|
||||
to.
|
||||
is set to hold the length of the returned buffer that '*dest' points to.
|
||||
|
||||
The returned buffer is allocated by this function, but it is not clear how to
|
||||
free that memory!
|
||||
|
||||
@@ -28,7 +28,7 @@ libssh2_channel_close(LIBSSH2_CHANNEL *channel);
|
||||
|
||||
Close an active data channel. In practice this means sending an SSH_MSG_CLOSE
|
||||
packet to the remote host which serves as instruction that no further data
|
||||
will be sent to it. The remote host may still send data back until it sends
|
||||
is sent to it. The remote host may still send data back until it sends
|
||||
its own close message in response. To wait for the remote end to close its
|
||||
connection as well, follow this command with libssh2_channel_wait_closed(3).
|
||||
|
||||
|
||||
@@ -29,16 +29,16 @@ libssh2_channel_forward_listen(LIBSSH2_SESSION *session, int port);
|
||||
# DESCRIPTION
|
||||
|
||||
Instruct the remote SSH server to begin listening for inbound TCP/IP
|
||||
connections. New connections will be queued by the library until accepted by
|
||||
connections. New connections are queued by the library until accepted by
|
||||
*libssh2_channel_forward_accept(3)*.
|
||||
|
||||
*session* - instance as returned by libssh2_session_init().
|
||||
|
||||
*host* - specific address to bind to on the remote host. Binding to
|
||||
0.0.0.0 (default when NULL is passed) will bind to all available addresses.
|
||||
0.0.0.0 (default when NULL is passed) binds to all available addresses.
|
||||
|
||||
*port* - port to bind to on the remote host. When 0 is passed, the remote
|
||||
host will select the first available dynamic port.
|
||||
host selects the first available dynamic port.
|
||||
|
||||
*bound_port* - Populated with the actual port bound on the remote
|
||||
host. Useful when requesting dynamic port numbers.
|
||||
|
||||
@@ -26,7 +26,7 @@ libssh2_channel_free(LIBSSH2_CHANNEL *channel);
|
||||
*channel* - Channel stream to free.
|
||||
|
||||
Release all resources associated with a channel stream. If the channel has
|
||||
not yet been closed with libssh2_channel_close(3) it will be called
|
||||
not yet been closed with libssh2_channel_close(3) it is called
|
||||
automatically so that the remote end may know that it can safely free its
|
||||
own resources.
|
||||
|
||||
|
||||
@@ -30,23 +30,23 @@ libssh2_channel_get_exit_signal(LIBSSH2_CHANNEL *channel,
|
||||
*exitsignal* - If not NULL, is populated by reference with the exit signal
|
||||
(without leading "SIG"). Note that the string is stored in a newly allocated
|
||||
buffer. If the remote program exited cleanly, the referenced string pointer
|
||||
will be set to NULL.
|
||||
is set to NULL.
|
||||
|
||||
*exitsignal_len* - If not NULL, is populated by reference with the length
|
||||
of exitsignal.
|
||||
|
||||
*errmsg* - If not NULL, is populated by reference with the error message
|
||||
(if provided by remote server, if not it will be set to NULL). Note that the
|
||||
(if provided by remote server, if not it is set to NULL). Note that the
|
||||
string is stored in a newly allocated buffer.
|
||||
|
||||
*errmsg_len* - If not NULL, is populated by reference with the length of errmsg.
|
||||
|
||||
*langtag* - If not NULL, is populated by reference with the language tag
|
||||
(if provided by remote server, if not it will be set to NULL). Note that the
|
||||
(if provided by remote server, if not it is set to NULL). Note that the
|
||||
string is stored in a newly allocated buffer.
|
||||
|
||||
*langtag_len* - If not NULL, is populated by reference with the length of langtag.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Numeric error code corresponding to the the Error Code constants.
|
||||
Numeric error code corresponding to the Error Code constants.
|
||||
|
||||
@@ -37,7 +37,7 @@ reading
|
||||
|
||||
**LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE**: Treat extended data and ordinary
|
||||
data the same. Merge all substreams such that calls to
|
||||
*libssh2_channel_read(3)* will pull from all substreams on a
|
||||
*libssh2_channel_read(3)* pulls from all substreams on a
|
||||
first-in/first-out basis.
|
||||
|
||||
**LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE**: Discard all extended data as it
|
||||
|
||||
@@ -35,7 +35,7 @@ reading
|
||||
|
||||
**LIBSSH2_CHANNEL_EXTENDED_DATA_MERGE**: Treat extended data and ordinary
|
||||
data the same. Merge all substreams such that calls to libssh2_channel_read(3)
|
||||
will pull from all substreams on a first-in/first-out basis.
|
||||
pulls from all substreams on a first-in/first-out basis.
|
||||
|
||||
**LIBSSH2_CHANNEL_EXTENDED_DATA_IGNORE**: Discard all extended data as it
|
||||
arrives.
|
||||
|
||||
@@ -30,17 +30,17 @@ This function is **DEPRECATED** in 1.1.0. Use the
|
||||
|
||||
Adjust the receive window for a channel by adjustment bytes. If the amount to
|
||||
be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the
|
||||
adjustment amount will be queued for a later packet.
|
||||
adjustment amount is queued for a later packet.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Returns the new size of the receive window (as understood by remote end). Note
|
||||
that the window value sent over the wire is strictly 32bit, but this API is
|
||||
made to return a 'long' which may not be 32 bit on all platforms.
|
||||
made to return a 'long' which may not be 32-bit on all platforms.
|
||||
|
||||
# ERRORS
|
||||
|
||||
In 1.0 and earlier, this function returns LIBSSH2_ERROR_EAGAIN for
|
||||
non-blocking channels where it would otherwise block. However, that is a
|
||||
negative number and this function only returns an unsigned value and this then
|
||||
leads to a very strange value being returned.
|
||||
leads to a strange value being returned.
|
||||
|
||||
@@ -28,7 +28,7 @@ libssh2_channel_receive_window_adjust2(LIBSSH2_CHANNEL * channel,
|
||||
|
||||
Adjust the receive window for a channel by adjustment bytes. If the amount to
|
||||
be adjusted is less than LIBSSH2_CHANNEL_MINADJUST and force is 0 the
|
||||
adjustment amount will be queued for a later packet.
|
||||
adjustment amount is queued for a later packet.
|
||||
|
||||
This function stores the new size of the receive window (as understood by
|
||||
remote end) in the variable 'window' points to.
|
||||
@@ -36,7 +36,7 @@ remote end) in the variable 'window' points to.
|
||||
# RETURN VALUE
|
||||
|
||||
Return 0 on success and a negative value on error. If used in non-blocking
|
||||
mode it will return LIBSSH2_ERROR_EAGAIN when it would otherwise block.
|
||||
mode it returns LIBSSH2_ERROR_EAGAIN when it would otherwise block.
|
||||
|
||||
# ERRORS
|
||||
|
||||
|
||||
@@ -26,12 +26,12 @@ libssh2_channel_request_auth_agent(LIBSSH2_CHANNEL *channel);
|
||||
|
||||
Request that agent forwarding be enabled for this SSH session. This sends the
|
||||
request over this specific channel, which causes the agent listener to be
|
||||
started on the remote side upon success. This agent listener will then run
|
||||
started on the remote side upon success. This agent listener is then run
|
||||
for the duration of the SSH session.
|
||||
|
||||
To use agent forwarding, libssh2_session_callback_set2(3)
|
||||
must first be called to set **LIBSSH2_CALLBACK_AUTHAGENT**.
|
||||
This callback will be invoked when the remote host opens a connection to the
|
||||
This callback is invoked when the remote host opens a connection to the
|
||||
local agent.
|
||||
|
||||
*channel* - Previously opened channel instance such as returned by
|
||||
|
||||
@@ -24,7 +24,7 @@ libssh2_channel_send_eof(LIBSSH2_CHANNEL *channel);
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Tell the remote host that no further data will be sent on the specified
|
||||
Tell the remote host that no further data is sent on the specified
|
||||
channel. Processes typically interpret this as a closed stdin descriptor.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
@@ -31,7 +31,7 @@ libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel, int blocking);
|
||||
make it non-blocking.
|
||||
|
||||
Currently this is a short cut call to libssh2_session_set_blocking(3)
|
||||
and therefore will affect the session and all channels.
|
||||
and therefore affects the session and all channels.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ libssh2_channel_signal_ex(LIBSSH2_CHANNEL *channel,
|
||||
# DESCRIPTION
|
||||
|
||||
A signal can be delivered to the remote process/service. Some servers or
|
||||
systems may not implement signals, in which case they will probably ignore this
|
||||
systems may not implement signals, in which case they probably ignore this
|
||||
message.
|
||||
|
||||
*channel* - Previously opened channel instance such as returned by libssh2_channel_open_ex(3).
|
||||
|
||||
@@ -28,8 +28,8 @@ libssh2_channel_window_read_ex(LIBSSH2_CHANNEL *channel,
|
||||
|
||||
Check the status of the read window. Returns the number of bytes which the
|
||||
remote end may send without overflowing the window limit read_avail (if
|
||||
passed) will be populated with the number of bytes actually available to be
|
||||
read window_size_initial (if passed) will be populated with the
|
||||
passed) is populated with the number of bytes actually available to be
|
||||
read window_size_initial (if passed) is populated with the
|
||||
window_size_initial as defined by the channel_open request
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
@@ -27,7 +27,7 @@ libssh2_channel_window_write_ex(LIBSSH2_CHANNEL *channel,
|
||||
|
||||
Check the status of the write window Returns the number of bytes which may be
|
||||
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) is populated with the size of the initial window as defined by
|
||||
the channel_open request
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
@@ -42,7 +42,7 @@ defines a stream ID of 1 to be the stderr substream.
|
||||
*libssh2_channel_write(3)* and *libssh2_channel_write_stderr(3)* are
|
||||
convenience macros for this function.
|
||||
|
||||
*libssh2_channel_write_ex(3)* will use as much as possible of the buffer
|
||||
*libssh2_channel_write_ex(3)* uses as much as possible of the buffer
|
||||
and put it into a single SSH protocol packet. This means that to get maximum
|
||||
performance when sending larger files, you should try to always pass in at
|
||||
least 32K of data to this function.
|
||||
|
||||
@@ -43,7 +43,7 @@ libssh2_channel_open_ex(3).
|
||||
|
||||
Request an X11 forwarding on *channel*. To use X11 forwarding,
|
||||
libssh2_session_callback_set2(3)
|
||||
must first be called to set **LIBSSH2_CALLBACK_X11**. This callback will be
|
||||
must first be called to set **LIBSSH2_CALLBACK_X11**. This callback is
|
||||
invoked when the remote host accepts the X11 forwarding.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
@@ -25,10 +25,10 @@ libssh2_free(LIBSSH2_SESSION *session, void *ptr);
|
||||
|
||||
Deallocate memory allocated by earlier call to libssh2 functions. It
|
||||
uses the memory allocation callbacks provided by the application, if any.
|
||||
Otherwise, this will call free().
|
||||
Otherwise, this calls free().
|
||||
|
||||
This function is mostly useful under Windows when libssh2 is linked to
|
||||
one run-time library and the application to another.
|
||||
one runtime library and the application to another.
|
||||
|
||||
# AVAILABILITY
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ libssh2_init(int flags);
|
||||
# DESCRIPTION
|
||||
|
||||
Initialize the libssh2 functions. This typically initialize the
|
||||
crypto library. It uses a global state, and is not thread safe -- you
|
||||
crypto library. It uses a global state, and is not thread-safe -- you
|
||||
must make sure this function is not called concurrently.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
@@ -29,7 +29,7 @@ Set how often keepalive messages should be sent. **want_reply** indicates
|
||||
whether the keepalive messages should request a response from the server.
|
||||
**interval** is number of seconds that can pass without any I/O, use 0 (the
|
||||
default) to disable keepalives. To avoid some busy-loop corner-cases, if you
|
||||
specify an interval of 1 it will be treated as 2.
|
||||
specify an interval of 1 it is treated as 2.
|
||||
|
||||
Note that non-blocking applications are responsible for sending the keepalive
|
||||
messages using **libssh2_keepalive_send(3)**.
|
||||
|
||||
@@ -38,8 +38,8 @@ future release.
|
||||
Adds a known host to the collection of known hosts identified by the 'hosts'
|
||||
handle.
|
||||
|
||||
*host* is a pointer the host name in plain text or hashed. If hashed, it
|
||||
must be provided base64 encoded. The host name can be the IP numerical address
|
||||
*host* is a pointer the hostname in plain text or hashed. If hashed, it
|
||||
must be provided base64 encoded. The hostname can be the IP numerical address
|
||||
of the host or the full name.
|
||||
|
||||
*saltP is a pointer to the salt used for the host hashing, if the host is
|
||||
@@ -52,10 +52,10 @@ The salt has to be provided base64 encoded with a trailing zero byte.
|
||||
argument
|
||||
|
||||
*typemask* is a bitmask that specifies format and info about the data
|
||||
passed to this function. Specifically, it details what format the host name is,
|
||||
passed to this function. Specifically, it details what format the hostname is,
|
||||
what format the key is and what key type it is.
|
||||
|
||||
The host name is given as one of the following types:
|
||||
The hostname is given as one of the following types:
|
||||
LIBSSH2_KNOWNHOST_TYPE_PLAIN, LIBSSH2_KNOWNHOST_TYPE_SHA1 or
|
||||
LIBSSH2_KNOWNHOST_TYPE_CUSTOM.
|
||||
|
||||
|
||||
@@ -33,13 +33,13 @@ libssh2_knownhost_addc(LIBSSH2_KNOWNHOSTS *hosts,
|
||||
Adds a known host to the collection of known hosts identified by the 'hosts'
|
||||
handle.
|
||||
|
||||
*host* is a pointer the host name in plain text or hashed. If hashed, it
|
||||
must be provided base64 encoded. The host name can be the IP numerical address
|
||||
*host* is a pointer the hostname in plain text or hashed. If hashed, it
|
||||
must be provided base64 encoded. The hostname can be the IP numerical address
|
||||
of the host or the full name.
|
||||
|
||||
If you want to add a key for a specific port number for the given host, you
|
||||
must provide the host name like '[host]:port' with the actual characters '['
|
||||
and ']' enclosing the host name and a colon separating the host part from the
|
||||
must provide the hostname like '[host]:port' with the actual characters '['
|
||||
and ']' enclosing the hostname and a colon separating the host part from the
|
||||
port number. For example: "[host.example.com]:222".
|
||||
|
||||
*salt* is a pointer to the salt used for the host hashing, if the host is
|
||||
@@ -56,10 +56,10 @@ argument
|
||||
*commentlen* is the total size in bytes of the comment pointed to by the *comment* argument
|
||||
|
||||
*typemask* is a bitmask that specifies format and info about the data
|
||||
passed to this function. Specifically, it details what format the host name is,
|
||||
passed to this function. Specifically, it details what format the hostname is,
|
||||
what format the key is and what key type it is.
|
||||
|
||||
The host name is given as one of the following types:
|
||||
The hostname is given as one of the following types:
|
||||
LIBSSH2_KNOWNHOST_TYPE_PLAIN, LIBSSH2_KNOWNHOST_TYPE_SHA1 or
|
||||
LIBSSH2_KNOWNHOST_TYPE_CUSTOM.
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ libssh2_knownhost_check(LIBSSH2_KNOWNHOSTS *hosts,
|
||||
Checks a host and its associated key against the collection of known hosts,
|
||||
and returns info back about the (partially) matched entry.
|
||||
|
||||
*host* is a pointer the host name in plain text. The host name can be the
|
||||
*host* is a pointer the hostname in plain text. The hostname can be the
|
||||
IP numerical address of the host or the full name.
|
||||
|
||||
*key* is a pointer to the key for the given host.
|
||||
@@ -41,10 +41,10 @@ IP numerical address of the host or the full name.
|
||||
argument
|
||||
|
||||
*typemask* is a bitmask that specifies format and info about the data
|
||||
passed to this function. Specifically, it details what format the host name is,
|
||||
passed to this function. Specifically, it details what format the hostname is,
|
||||
what format the key is and what key type it is.
|
||||
|
||||
The host name is given as one of the following types:
|
||||
The hostname is given as one of the following types:
|
||||
LIBSSH2_KNOWNHOST_TYPE_PLAIN or LIBSSH2_KNOWNHOST_TYPE_CUSTOM.
|
||||
|
||||
The key is encoded using one of the following encodings:
|
||||
|
||||
@@ -32,13 +32,13 @@ libssh2_knownhost_checkp(LIBSSH2_KNOWNHOSTS *hosts,
|
||||
Checks a host and its associated key against the collection of known hosts,
|
||||
and returns info back about the (partially) matched entry.
|
||||
|
||||
*host* is a pointer the host name in plain text. The host name can be the
|
||||
*host* is a pointer the hostname in plain text. The hostname can be the
|
||||
IP numerical address of the host or the full name.
|
||||
|
||||
*port* is the port number used by the host (or a negative number
|
||||
to check the generic host). If the port number is given, libssh2 will
|
||||
check the key for the specific host + port number combination in
|
||||
addition to the plain host name only check.
|
||||
to check the generic host). If the port number is given, libssh2
|
||||
checks the key for the specific host + port number combination in
|
||||
addition to the plain hostname only check.
|
||||
|
||||
*key* is a pointer to the key for the given host.
|
||||
|
||||
@@ -46,10 +46,10 @@ addition to the plain host name only check.
|
||||
argument
|
||||
|
||||
*typemask* is a bitmask that specifies format and info about the data
|
||||
passed to this function. Specifically, it details what format the host name is,
|
||||
passed to this function. Specifically, it details what format the hostname is,
|
||||
what format the key is and what key type it is.
|
||||
|
||||
The host name is given as one of the following types:
|
||||
The hostname is given as one of the following types:
|
||||
LIBSSH2_KNOWNHOST_TYPE_PLAIN or LIBSSH2_KNOWNHOST_TYPE_CUSTOM.
|
||||
|
||||
The key is encoded using one of the following encodings:
|
||||
|
||||
@@ -38,7 +38,7 @@ the 'type' output format.
|
||||
|
||||
*buflen* is the size of the *buffer*. See RETURN VALUE about the size.
|
||||
|
||||
*outlen* must be a pointer to a size_t variable that will get the output
|
||||
*outlen* must be a pointer to a size_t variable that gets the output
|
||||
length of the stored data chunk. The number does not included the trailing
|
||||
zero!
|
||||
|
||||
@@ -52,9 +52,9 @@ Returns a regular libssh2 error code, where negative values are error codes
|
||||
and 0 indicates success.
|
||||
|
||||
If the provided buffer is deemed too small to fit the data libssh2 wants to
|
||||
store in it, LIBSSH2_ERROR_BUFFER_TOO_SMALL will be returned. The application
|
||||
store in it, LIBSSH2_ERROR_BUFFER_TOO_SMALL is returned. The application
|
||||
is then advised to call the function again with a larger buffer. The
|
||||
*outlen* size will then hold the requested size.
|
||||
*outlen* size then holds the requested size.
|
||||
|
||||
# AVAILABILITY
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ This function is **DEPRECATED** in 1.7.0. Use the
|
||||
*session* - Session instance as returned by libssh2_session_init_ex(3)
|
||||
|
||||
*path* - Full path and filename of file to transfer. That is the remote
|
||||
file name.
|
||||
filename.
|
||||
|
||||
*sb* - Populated with remote file's size, mode, mtime, and atime
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ libssh2_scp_recv2(LIBSSH2_SESSION *session, const char *path, struct_stat *sb);
|
||||
*session* - Session instance as returned by libssh2_session_init_ex(3)
|
||||
|
||||
*path* - Full path and filename of file to transfer. That is the remote
|
||||
file name.
|
||||
filename.
|
||||
|
||||
*sb* - Populated with remote file's size, mode, mtime, and atime
|
||||
|
||||
|
||||
@@ -28,13 +28,13 @@ libssh2_scp_send64(LIBSSH2_SESSION *session, const char *path, int mode,
|
||||
*session* - Session instance as returned by libssh2_session_init_ex(3)
|
||||
|
||||
*path* - Full path and filename of file to transfer to. That is the remote
|
||||
file name.
|
||||
filename.
|
||||
|
||||
*mode* - File access mode to create file with
|
||||
|
||||
*size* - Size of file being transmitted (Must be known ahead of
|
||||
time). Note that this needs to be passed on as variable type
|
||||
libssh2_uint64_t. This type is 64 bit on modern operating systems and
|
||||
libssh2_uint64_t. This type is 64-bit on modern operating systems and
|
||||
compilers.
|
||||
|
||||
*mtime* - mtime to assign to file being created
|
||||
|
||||
@@ -31,7 +31,7 @@ This function has been deemed deprecated since libssh2 1.2.6. See
|
||||
*session* - Session instance as returned by libssh2_session_init_ex(3)
|
||||
|
||||
*path* - Full path and filename of file to transfer to. That is the remote
|
||||
file name.
|
||||
filename.
|
||||
|
||||
*mode* - File access mode to create file with
|
||||
|
||||
|
||||
@@ -31,8 +31,8 @@ the banner each server presents.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
A pointer to a string or NULL if something failed. The data pointed to will be
|
||||
allocated and associated to the session handle and will be freed by libssh2
|
||||
A pointer to a string or NULL if something failed. The data pointed to is
|
||||
allocated and associated to the session handle and is freed by libssh2
|
||||
when *libssh2_session_free(3)* is used.
|
||||
|
||||
# AVAILABILITY
|
||||
|
||||
@@ -30,9 +30,9 @@ libssh2_session_banner_set(LIBSSH2_SESSION *session, const char *banner);
|
||||
*banner* - A pointer to a zero-terminated string holding the user defined
|
||||
banner
|
||||
|
||||
Set the banner that will be sent to the remote host when the SSH session is
|
||||
Set the banner that is sent to the remote host when the SSH session is
|
||||
started with *libssh2_session_handshake(3)* This is optional; a banner
|
||||
corresponding to the protocol and libssh2 version will be sent by default.
|
||||
corresponding to the protocol and libssh2 version is sent by default.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ Called when a SSH_MSG_DISCONNECT message is received
|
||||
## LIBSSH2_CALLBACK_MACERROR
|
||||
|
||||
Called when a mismatched MAC has been detected in the transport layer. If the
|
||||
function returns 0, the packet will be accepted nonetheless.
|
||||
function returns 0, the packet is accepted nonetheless.
|
||||
|
||||
## LIBSSH2_CALLBACK_X11
|
||||
|
||||
@@ -130,7 +130,7 @@ void identities(LIBSSH2_SESSION* session, void *buffer,
|
||||
this differently. For example, one client may pass in an unsigned char ** for
|
||||
this parameter, while another may pass in a pointer to a struct.
|
||||
|
||||
Regardless of the type of buffer used, the client will need to send back a list
|
||||
Regardless of the type of buffer used, the client needs to send back a list
|
||||
of identities in the following format.
|
||||
|
||||
uint32 buffer length
|
||||
|
||||
@@ -29,13 +29,13 @@ Set options for the created session. *flag* is the option to set, while
|
||||
|
||||
## LIBSSH2_FLAG_SIGPIPE
|
||||
|
||||
If set, libssh2 will not attempt to block SIGPIPEs but will let them trigger
|
||||
If set, libssh2 does not attempt to block SIGPIPEs but lets them trigger
|
||||
from the underlying socket layer.
|
||||
|
||||
## LIBSSH2_FLAG_COMPRESS
|
||||
|
||||
If set - before the connection negotiation is performed - libssh2 will try to
|
||||
negotiate compression enabling for this connection. By default libssh2 will
|
||||
If set - before the connection negotiation is performed - libssh2 tries to
|
||||
negotiate compression enabling for this connection. By default libssh2 does
|
||||
not attempt to use compression.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
@@ -27,8 +27,8 @@ libssh2_session_handshake(LIBSSH2_SESSION *session, libssh2_socket_t socket);
|
||||
*session* - Session instance as returned by libssh2_session_init_ex(3)
|
||||
|
||||
*socket* - 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.
|
||||
though the protocol allows for any reliable transport and the library
|
||||
attempts to use any berkeley socket.
|
||||
|
||||
Begin transport layer protocol negotiation with the connected host.
|
||||
|
||||
|
||||
@@ -25,8 +25,8 @@ libssh2_session_hostkey(LIBSSH2_SESSION *session,
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Returns a pointer to the current host key, the value *len* points to will
|
||||
get the length of the key.
|
||||
Returns a pointer to the current host key, the value *len* points to
|
||||
gets the length of the key.
|
||||
|
||||
The value *type* points to the type of hostkey which is one of:
|
||||
LIBSSH2_HOSTKEY_TYPE_RSA, LIBSSH2_HOSTKEY_TYPE_DSS (deprecated), or
|
||||
|
||||
@@ -43,11 +43,11 @@ Callbacks for implementing a reallocator callback. Pass a value of NULL to
|
||||
use the default system reallocator.
|
||||
|
||||
*abstract* - Arbitrary pointer to application specific callback data.
|
||||
This value will be passed to any callback function associated with the named
|
||||
This value is passed to any callback function associated with the named
|
||||
session instance.
|
||||
|
||||
Initializes an SSH session object. By default system memory allocators
|
||||
(malloc(), free(), realloc()) will be used for any dynamically allocated memory
|
||||
(malloc(), free(), realloc()) are used for any dynamically allocated memory
|
||||
blocks. Alternate memory allocation functions may be specified using the
|
||||
extended version of this API call, and/or optional application specific data
|
||||
may be attached to the session object.
|
||||
|
||||
@@ -31,4 +31,4 @@ Determine the most recent error condition.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Numeric error code corresponding to the the Error Code constants.
|
||||
Numeric error code corresponding to the Error Code constants.
|
||||
|
||||
@@ -32,15 +32,15 @@ libssh2_session_last_error(LIBSSH2_SESSION *session,
|
||||
readable form of the most recent error message.
|
||||
|
||||
*errmsg_len* - If not NULL, is populated by reference with the length
|
||||
of errmsg. (The string is NUL-terminated, so the length is only useful as
|
||||
of errmsg. (The string is null-terminated, so the length is only useful as
|
||||
an optimization, to avoid calling strlen.)
|
||||
|
||||
*want_buf* - If set to a non-zero value, "ownership" of the errmsg
|
||||
buffer will be given to the calling scope. If necessary, the errmsg buffer
|
||||
will be duplicated.
|
||||
buffer is given to the calling scope. If necessary, the errmsg buffer
|
||||
is duplicated.
|
||||
|
||||
Determine the most recent error condition and its cause.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Numeric error code corresponding to the the Error Code constants.
|
||||
Numeric error code corresponding to the Error Code constants.
|
||||
|
||||
@@ -31,7 +31,7 @@ libssh2_session_method_pref(LIBSSH2_SESSION *session,
|
||||
|
||||
*prefs* - Coma delimited list of preferred methods to use with
|
||||
the most preferred listed first and the least preferred listed last.
|
||||
If a method is listed which is not supported by libssh2 it will be
|
||||
If a method is listed which is not supported by libssh2 it is
|
||||
ignored and not sent to the remote host during protocol negotiation.
|
||||
|
||||
Set preferred methods to be negotiated. These
|
||||
|
||||
@@ -28,13 +28,13 @@ libssh2_session_set_blocking(LIBSSH2_SESSION *session, int blocking);
|
||||
*blocking* - Set to a non-zero value to make the channel block, or zero to
|
||||
make it non-blocking.
|
||||
|
||||
Set or clear blocking mode on the selected on the session. This will
|
||||
instantly affect any channels associated with this session. If a read is
|
||||
Set or clear blocking mode on the selected on the session. This
|
||||
instantly affects any channels associated with this session. If a read is
|
||||
performed on a session with no data currently available, a blocking session
|
||||
will wait for data to arrive and return what it receives. A non-blocking
|
||||
session will return immediately with an empty buffer. If a write is performed
|
||||
on a session with no room for more data, a blocking session will wait for
|
||||
room. A non-blocking session will return immediately without writing
|
||||
waits for data to arrive and return what it receives. A non-blocking
|
||||
session returns immediately with an empty buffer. If a write is performed
|
||||
on a session with no room for more data, a blocking session waits for
|
||||
room. A non-blocking session returns immediately without writing
|
||||
anything.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
@@ -41,7 +41,7 @@ mechanism.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
Numeric error code corresponding to the the Error Code constants.
|
||||
Numeric error code corresponding to the Error Code constants.
|
||||
|
||||
# AVAILABILITY
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ Set the **timeout** in seconds for how long libssh2 packet read
|
||||
function calls may wait until they consider the situation an error and return
|
||||
LIBSSH2_ERROR_TIMEOUT.
|
||||
|
||||
By default or if you set the timeout to zero, the timeout will be set to
|
||||
By default or if you set the timeout to zero, the timeout is set to
|
||||
60 seconds.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
@@ -30,8 +30,8 @@ Starting in libssh2 version 1.2.8 this function is considered deprecated. Use
|
||||
*session* - Session instance as returned by libssh2_session_init_ex(3)
|
||||
|
||||
*socket* - 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.
|
||||
though the protocol allows for any reliable transport and the library
|
||||
attempts to use any berkeley socket.
|
||||
|
||||
Begin transport layer protocol negotiation with the connected host.
|
||||
|
||||
|
||||
@@ -27,23 +27,23 @@ libssh2_session_supported_algs(LIBSSH2_SESSION* session,
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
*session* - An instance of initialized LIBSSH2_SESSION (the function will
|
||||
use its pointer to the memory allocation function). *method_type* -
|
||||
*session* - An instance of initialized LIBSSH2_SESSION (the function
|
||||
uses its pointer to the memory allocation function). *method_type* -
|
||||
Method type. See *libssh2_session_method_pref(3)*. *algs* - Address
|
||||
of a pointer that will point to an array of returned algorithms
|
||||
of a pointer that points to an array of returned algorithms
|
||||
|
||||
Get a list of supported algorithms for the given *method_type*. The
|
||||
method_type parameter is equivalent to method_type in
|
||||
*libssh2_session_method_pref(3)*. If successful, the function will
|
||||
allocate the appropriate amount of memory. When not needed anymore, it must be
|
||||
*libssh2_session_method_pref(3)*. If successful, the function allocates
|
||||
the appropriate amount of memory. When not needed anymore, it must be
|
||||
deallocated by calling *libssh2_free(3)*. When this function is
|
||||
unsuccessful, this must not be done.
|
||||
|
||||
In order to get a list of all supported compression algorithms,
|
||||
libssh2_session_flag(session, LIBSSH2_FLAG_COMPRESS, 1) must be called before
|
||||
calling this function, otherwise only "none" will be returned.
|
||||
calling this function, otherwise only "none" is returned.
|
||||
|
||||
If successful, the function will allocate and fill the array with supported
|
||||
If successful, the function allocates and fill the array with supported
|
||||
algorithms (the same names as defined in RFC 4253). The array is not NULL
|
||||
terminated.
|
||||
|
||||
@@ -78,7 +78,7 @@ else {
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
On success, a number of returned algorithms (i.e a positive number will be
|
||||
On success, a number of returned algorithms (i.e a positive number is
|
||||
returned). In case of a failure, an error code (a negative number, see below)
|
||||
is returned. 0 should never be returned.
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ libssh2_sftp_fstat_ex(LIBSSH2_SFTP_HANDLE *handle,
|
||||
*attrs* - Pointer to an LIBSSH2_SFTP_ATTRIBUTES structure to set file
|
||||
metadata from or into depending on the value of setstat.
|
||||
|
||||
*setstat* - When non-zero, the file's metadata will be updated
|
||||
*setstat* - When non-zero, the file's metadata is updated
|
||||
with the data found in attrs according to the values of attrs-\>flags
|
||||
and other relevant member attributes.
|
||||
|
||||
@@ -49,7 +49,7 @@ LIBSSH2_SFTP_ATTRIBUTES is a typedefed struct that is defined as below
|
||||
struct _LIBSSH2_SFTP_ATTRIBUTES {
|
||||
|
||||
/* If flags & ATTR_* bit is set, then the value in this
|
||||
* struct will be meaningful Otherwise it should be ignored
|
||||
* struct is meaningful otherwise it should be ignored
|
||||
*/
|
||||
unsigned long flags;
|
||||
|
||||
@@ -69,14 +69,14 @@ struct _LIBSSH2_SFTP_ATTRIBUTES {
|
||||
};
|
||||
~~~
|
||||
|
||||
You will find a full set of defines and macros to identify flags and
|
||||
You find a full set of defines and macros to identify flags and
|
||||
permissions on the **libssh2_sftp.h** header file, but some of the
|
||||
most common ones are:
|
||||
|
||||
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
|
||||
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. Thus, you check for a user readable file, use the bit
|
||||
*LIBSSH2_SFTP_S_IRUSR* while you want to see if it is executable
|
||||
for other, you use *LIBSSH2_SFTP_S_IXOTH* and so on.
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se.
|
||||
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
|
||||
*LIBSSH2_FX_OP_UNSUPPORTED* will be returned in this case.
|
||||
*LIBSSH2_FX_OP_UNSUPPORTED* is returned in this case.
|
||||
|
||||
# AVAILABILITY
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ libssh2_sftp_last_error(LIBSSH2_SFTP *sftp);
|
||||
Returns the last error code produced by the SFTP layer. Note that this only
|
||||
returns a sensible error code if libssh2 returned LIBSSH2_ERROR_SFTP_PROTOCOL
|
||||
in a previous call. Using **libssh2_sftp_last_error(3)** without a
|
||||
preceding SFTP protocol error, it will return an unspecified value.
|
||||
preceding SFTP protocol error, it returns an unspecified value.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
|
||||
@@ -51,8 +51,8 @@ Force all writes to append data at the end of the file.
|
||||
|
||||
## LIBSSH2_FXF_CREAT,
|
||||
|
||||
If this flag is specified, then a new file will be created if one does not
|
||||
already exist (if LIBSSH2_FXF_TRUNC is specified, the new file will be
|
||||
If this flag is specified, then a new file is created if one does not
|
||||
already exist (if LIBSSH2_FXF_TRUNC is specified, the new file is
|
||||
truncated to zero length if it previously exists)
|
||||
|
||||
## LIBSSH2_FXF_TRUNC
|
||||
|
||||
@@ -53,8 +53,8 @@ Force all writes to append data at the end of the file.
|
||||
|
||||
## LIBSSH2_FXF_CREAT,
|
||||
|
||||
If this flag is specified, then a new file will be created if one does not
|
||||
already exist (if LIBSSH2_FXF_TRUNC is specified, the new file will be
|
||||
If this flag is specified, then a new file is created if one does not
|
||||
already exist (if LIBSSH2_FXF_TRUNC is specified, the new file is
|
||||
truncated to zero length if it previously exists)
|
||||
|
||||
## LIBSSH2_FXF_TRUNC
|
||||
|
||||
@@ -43,11 +43,11 @@ filesystem entry
|
||||
This function implements the posix-rename@openssh.com extension, which is
|
||||
useful when, for example, moving files across filesystems on a remote server.
|
||||
SSH_FXP_RENAME does not specify a specific implementation, but many servers
|
||||
will attempt to user hard links when moving files using SSH_FXP_RENAME.
|
||||
attempt to user hard links when moving files using SSH_FXP_RENAME.
|
||||
|
||||
If the server does not support posix-rename@openssh.com, this function will
|
||||
return LIBSSH2_FX_OP_UNSUPPORTED and you can call libssh2_sftp_rename_ex (3) as
|
||||
a backup.
|
||||
If the server does not support posix-rename@openssh.com, this function
|
||||
returns LIBSSH2_FX_OP_UNSUPPORTED and you can call libssh2_sftp_rename_ex (3)
|
||||
as a backup.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ libssh2_sftp_read(LIBSSH2_SFTP_HANDLE *handle,
|
||||
Reads a block of data from an LIBSSH2_SFTP_HANDLE. This method is modelled
|
||||
after the POSIX read(2)
|
||||
function and uses the same calling semantics. libssh2_sftp_read(3)
|
||||
will attempt to read as much as possible however it may not fill all of buffer
|
||||
attempts to read as much as possible however it may not fill all of buffer
|
||||
if the file pointer reaches the end or if further reads would cause the socket
|
||||
to block.
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ information for the next entry, if any.
|
||||
*buffer_maxlen* bytes to read data into.
|
||||
|
||||
*buffer_maxlen* - is the length of buffer in bytes. If the length of the
|
||||
filename is longer than the space provided by buffer_maxlen it will be
|
||||
filename is longer than the space provided by buffer_maxlen it is
|
||||
truncated to fit.
|
||||
|
||||
*longentry* - is a pointer to a pre-allocated buffer of at least
|
||||
@@ -48,7 +48,7 @@ a directory listing command is to display this data).
|
||||
|
||||
*longentry_maxlen* - is the length of longentry in bytes. If the length of
|
||||
the full directory entry is longer than the space provided by
|
||||
*longentry_maxlen* it will be truncated to fit.
|
||||
*longentry_maxlen* it is truncated to fit.
|
||||
|
||||
*attrs* - is a pointer to LIBSSH2_SFTP_ATTRIBUTES storage to populate
|
||||
statbuf style data into.
|
||||
|
||||
@@ -53,7 +53,7 @@ Rename a filesystem object on the remote filesystem. The semantics of
|
||||
this command typically include the ability to move a filesystem object
|
||||
between folders and/or filesystem mounts. If the LIBSSH2_SFTP_RENAME_OVERWRITE
|
||||
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
|
||||
fails. Use of the other two flags indicate a preference (but not a
|
||||
requirement) for the remote end to perform an atomic rename operation
|
||||
and/or using native system calls when possible.
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ operation. The localized file pointer is used as a convenience offset during
|
||||
read/write operations.
|
||||
|
||||
You MUST NOT seek during writing or reading a file with SFTP, as the internals
|
||||
use outstanding packets and changing the "file position" during transit will
|
||||
use outstanding packets and changing the "file position" during transit
|
||||
results in badness.
|
||||
|
||||
# AVAILABILITY
|
||||
|
||||
@@ -48,17 +48,16 @@ stat operation to perform:
|
||||
metadata from or into depending on the value of stat_type.
|
||||
|
||||
Get or Set statbuf type data on a remote filesystem object. When getting
|
||||
statbuf data, libssh2_sftp_stat(3)
|
||||
will follow all symlinks, while libssh2_sftp_lstat(3)
|
||||
will return data about the object encountered, even if that object
|
||||
happens to be a symlink.
|
||||
statbuf data, libssh2_sftp_stat(3) follows all symlinks, while
|
||||
libssh2_sftp_lstat(3) returns data about the object encountered, even if
|
||||
that object happens to be a symlink.
|
||||
|
||||
The LIBSSH2_SFTP_ATTRIBUTES struct looks like this:
|
||||
|
||||
~~~c
|
||||
struct LIBSSH2_SFTP_ATTRIBUTES {
|
||||
/* If flags & ATTR_* bit is set, then the value in this struct will be
|
||||
* meaningful Otherwise it should be ignored
|
||||
/* If flags & ATTR_* bit is set, then the value in this struct is
|
||||
* meaningful otherwise it should be ignored
|
||||
*/
|
||||
unsigned long flags;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ semantics.
|
||||
*count* - Number of bytes from 'buffer' to write. Note that it may not be
|
||||
possible to write all bytes as requested.
|
||||
|
||||
*libssh2_sftp_handle(3)* will use as much as possible of the buffer and
|
||||
*libssh2_sftp_handle(3)* uses as much as possible of the buffer and
|
||||
put it into a single SFTP protocol packet. This means that to get maximum
|
||||
performance when sending larger files, you should try to always pass in at
|
||||
least 32K of data to this function.
|
||||
@@ -46,24 +46,24 @@ least 32K of data to this function.
|
||||
|
||||
Starting in libssh2 version 1.2.8, the default behavior of libssh2 is to
|
||||
create several smaller outgoing packets for all data you pass to this function
|
||||
and it will return a positive number as soon as the first packet is
|
||||
acknowledged from the server.
|
||||
and it returns a positive number as soon as the first packet is acknowledged
|
||||
from the server.
|
||||
|
||||
This has the effect that sometimes more data has been sent off but is not acked
|
||||
yet when this function returns, and when this function is subsequently called
|
||||
again to write more data, libssh2 will immediately figure out that the data is
|
||||
again to write more data, libssh2 immediately figures out that the data is
|
||||
already received remotely.
|
||||
|
||||
In most normal situation this should not cause any problems, but it should be
|
||||
noted that if you have once called libssh2_sftp_write() with data and it returns
|
||||
short, you MUST still assume that the rest of the data might have been cached so
|
||||
you need to make sure you do not alter that data and think that the version you
|
||||
have in your next function invoke will be detected or used.
|
||||
have in your next function invoke is detected or used.
|
||||
|
||||
The reason for this funny behavior is that SFTP can only send 32K data in each
|
||||
packet and it gets all packets acked individually. This means we cannot use a
|
||||
simple serial approach if we want to reach high performance even on high
|
||||
latency connections. And we want that.
|
||||
latency connections, and we want that.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ libssh2_trace_sethandler installs a trace output handler for your application.
|
||||
By default, when tracing has been switched on via a call to libssh2_trace(),
|
||||
all output is written to stderr. By calling this method and passing a
|
||||
function pointer that matches the libssh2_trace_handler_func prototype,
|
||||
libssh2 will call back as it generates trace output. This can be used to
|
||||
libssh2 calls back as it generates trace output. This can be used to
|
||||
capture the trace output and put it into a log file or diagnostic window.
|
||||
This function has no effect unless libssh2 was built to support this option,
|
||||
and a typical "release build" might not.
|
||||
|
||||
@@ -36,7 +36,7 @@ yet been attempted, returns **LIBSSH2_ERROR_MISSING_USERAUTH_BANNER**.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
On success returns 0 and an UTF-8 NUL-terminated string is stored in the
|
||||
*banner*. This string is internally managed by libssh2 and will be
|
||||
deallocated upon session termination.
|
||||
On success returns 0 and an UTF-8 null-terminated string is stored in the
|
||||
*banner*. This string is internally managed by libssh2 and is deallocated
|
||||
upon session termination.
|
||||
On failure returns **LIBSSH2_ERROR_MISSING_USERAUTH_BANNER**.
|
||||
|
||||
@@ -36,10 +36,10 @@ for.
|
||||
*username_len* - Length of username parameter.
|
||||
|
||||
*response_callback* - As authentication proceeds, the host issues several
|
||||
(1 or more) challenges and requires responses. This callback will be called at
|
||||
(1 or more) challenges and requires responses. This callback is called at
|
||||
this moment. The callback is responsible to obtain responses for the
|
||||
challenges, fill the provided data structure and then return
|
||||
control. Responses will be sent to the host. String values will be free(3)ed
|
||||
control. Responses are sent to the host. String values are free(3)ed
|
||||
by the library. The callback prototype must match this:
|
||||
|
||||
~~~c
|
||||
@@ -54,7 +54,7 @@ void response(const char *name,
|
||||
|
||||
Attempts keyboard-interactive (challenge/response) authentication.
|
||||
|
||||
Note that many SSH servers will always issue a single "password" challenge,
|
||||
Note that many SSH servers always issue a single "password" challenge,
|
||||
requesting actual password as response, but it is not required by the
|
||||
protocol, and various authentication schemes, such as smartcard authentication
|
||||
may use keyboard-interactive authentication type too.
|
||||
|
||||
@@ -27,16 +27,16 @@ libssh2_userauth_list(LIBSSH2_SESSION *session,
|
||||
|
||||
*session* - Session instance as returned by libssh2_session_init_ex(3)
|
||||
|
||||
*username* - Username which will be used while authenticating. Note that
|
||||
*username* - Username which is used while authenticating. Note that
|
||||
most server implementations do not permit attempting authentication with
|
||||
different usernames between requests. Therefore this must be the same username
|
||||
you will use on later userauth calls.
|
||||
you use on later userauth calls.
|
||||
|
||||
*username_len* - Length of username parameter.
|
||||
|
||||
Send a **SSH_USERAUTH_NONE** request to the remote host. Unless the remote
|
||||
host is configured to accept none as a viable authentication scheme
|
||||
(unlikely), it will return **SSH_USERAUTH_FAILURE** along with a listing of
|
||||
(unlikely), it returns **SSH_USERAUTH_FAILURE** along with a listing of
|
||||
what authentication schemes it does support. In the unlikely event that none
|
||||
authentication succeeds, this method with return NULL. This case may be
|
||||
distinguished from a failing case by examining
|
||||
|
||||
@@ -44,9 +44,9 @@ libssh2_userauth_password_ex(LIBSSH2_SESSION *session,
|
||||
*password_len* - Length of password parameter.
|
||||
|
||||
*passwd_change_cb* - If the host accepts authentication but
|
||||
requests that the password be changed, this callback will be issued.
|
||||
requests that the password be changed, this callback is issued.
|
||||
If no callback is defined, but server required password change,
|
||||
authentication will fail.
|
||||
authentication fails.
|
||||
|
||||
Attempt basic password authentication. Note that many SSH servers
|
||||
which appear to support ordinary password authentication actually have
|
||||
|
||||
@@ -31,7 +31,7 @@ libssh2_userauth_publickey_fromfile_ex(LIBSSH2_SESSION *session,
|
||||
*session* - Session instance as returned by
|
||||
**libssh2_session_init_ex(3)**
|
||||
|
||||
*username* - Pointer to user name to authenticate as.
|
||||
*username* - Pointer to username to authenticate as.
|
||||
|
||||
*username_len* - Length of *username*.
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ libssh2_userauth_publickey_frommemory(LIBSSH2_SESSION *session,
|
||||
|
||||
*session* - Session instance as returned by libssh2_session_init_ex(3)
|
||||
|
||||
*username* - Remote user name to authenticate as.
|
||||
*username* - Remote username to authenticate as.
|
||||
|
||||
*username_len* - Length of username.
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ int name(LIBSSH2_SESSION *session, LIBSSH2_SK_SIG_INFO *sig_info,
|
||||
*username_len* - Length of username parameter.
|
||||
|
||||
*publickeydata* - Buffer containing the contents of a public key file. If
|
||||
NULL, the public key will be extracted from the privatekeydata. When using
|
||||
NULL, the public key is extracted from the privatekeydata. When using
|
||||
certificate authentication, this buffer should contain the public certificate
|
||||
data.
|
||||
|
||||
@@ -128,14 +128,14 @@ to the callback.
|
||||
*sig_r* - For Ed25519 signatures, this contains the entire signature, as
|
||||
returned directly from the authenticator. For ECDSA signatures, this contains
|
||||
the r component of the signature in a big-endian binary representation. For
|
||||
both algorithms, use LIBSSH2_ALLOC to allocate memory. It will be freed by the
|
||||
both algorithms, use LIBSSH2_ALLOC to allocate memory. It is freed by the
|
||||
caller.
|
||||
|
||||
*sig_r_len* - The length of the sig_r parameter.
|
||||
|
||||
*sig_s* - For ECDSA signatures, this contains the s component of the
|
||||
signature in a big-endian binary representation. Use LIBSSH2_ALLOC to allocate
|
||||
memory. It will be freed by the caller. For Ed25519 signatures, set this to
|
||||
memory. It is freed by the caller. For Ed25519 signatures, set this to
|
||||
NULL.
|
||||
|
||||
*sig_s_len* - The length of the sig_s parameter.
|
||||
|
||||
@@ -24,7 +24,7 @@ libssh2_version(int required_version);
|
||||
|
||||
If *required_version* is lower than or equal to the version number of the
|
||||
libssh2 in use, the version number of libssh2 is returned as a pointer to a
|
||||
zero terminated string.
|
||||
null-terminated string.
|
||||
|
||||
The *required_version* should be the version number as constructed by the
|
||||
LIBSSH2_VERSION_NUM define in the libssh2.h public header file, which is a 24
|
||||
@@ -33,7 +33,7 @@ number.
|
||||
|
||||
# RETURN VALUE
|
||||
|
||||
The version number of libssh2 is returned as a pointer to a zero terminated
|
||||
The version number of libssh2 is returned as a pointer to a null-terminated
|
||||
string or NULL if the *required_version* is not fulfilled.
|
||||
|
||||
# EXAMPLE
|
||||
@@ -56,4 +56,4 @@ printf(\&"libssh2 version: %s\&", libssh2_version(0));
|
||||
# AVAILABILITY
|
||||
|
||||
This function was added in libssh2 1.1, in previous versions there way no way
|
||||
to extract this info in run-time.
|
||||
to extract this info in runtime.
|
||||
|
||||
@@ -137,7 +137,7 @@ int main(int argc, char *argv[])
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
rc = libssh2_session_handshake(session, sock);
|
||||
@@ -149,7 +149,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
|
||||
@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
rc = libssh2_session_handshake(session, sock);
|
||||
@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Sample showing how to do SCP transfers in a non-blocking manner.
|
||||
*
|
||||
* The sample code has default values for host name, user name, password
|
||||
* The sample code has default values for hostname, username, password
|
||||
* and path to copy, but you can specify them on the command line like:
|
||||
*
|
||||
* $ ./scp_nonblock 192.168.0.1 user password /tmp/secrets
|
||||
@@ -173,7 +173,7 @@ int main(int argc, char *argv[])
|
||||
gettimeofday(&start, NULL);
|
||||
#endif
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
while((rc = libssh2_session_handshake(session, sock)) ==
|
||||
@@ -187,7 +187,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
|
||||
@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
rc = libssh2_session_handshake(session, sock);
|
||||
@@ -137,7 +137,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
|
||||
@@ -176,7 +176,7 @@ int main(int argc, char *argv[])
|
||||
/* Since we have set non-blocking, tell libssh2 we are non-blocking */
|
||||
libssh2_session_set_blocking(session, 0);
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
while((rc = libssh2_session_handshake(session, sock)) ==
|
||||
@@ -190,7 +190,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Sample showing how to do SFTP transfers.
|
||||
*
|
||||
* The sample code has default values for host name, user name, password
|
||||
* The sample code has default values for hostname, username, password
|
||||
* and path to copy, but you can specify them on the command line like:
|
||||
*
|
||||
* $ ./sftp 192.168.0.1 user password /tmp/secrets -p|-i|-k
|
||||
@@ -161,7 +161,7 @@ int main(int argc, char *argv[])
|
||||
/* Since we have set non-blocking, tell libssh2 we are blocking */
|
||||
libssh2_session_set_blocking(session, 1);
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
rc = libssh2_session_handshake(session, sock);
|
||||
@@ -173,7 +173,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
*
|
||||
* Sample showing how to do SFTP transfers in a non-blocking manner.
|
||||
*
|
||||
* It will first download a given source file, store it locally and then
|
||||
* upload the file again to a given destination file.
|
||||
* It first downloads a given source file, stores it locally and then
|
||||
* uploads the file again to a given destination file.
|
||||
*
|
||||
* Using the SFTP server running on 127.0.0.1
|
||||
*
|
||||
@@ -42,7 +42,7 @@ static const char *username = "username";
|
||||
static const char *password = "password";
|
||||
static const char *sftppath = "/tmp/TEST"; /* source path */
|
||||
static const char *dest = "/tmp/TEST2"; /* destination path */
|
||||
static const char *storage = "/tmp/sftp-storage"; /* local file name to store
|
||||
static const char *storage = "/tmp/sftp-storage"; /* local filename to store
|
||||
the downloaded file in */
|
||||
|
||||
static int waitsocket(libssh2_socket_t socket_fd, LIBSSH2_SESSION *session)
|
||||
@@ -151,7 +151,7 @@ int main(int argc, char *argv[])
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
rc = libssh2_session_handshake(session, sock);
|
||||
@@ -165,7 +165,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
@@ -286,12 +286,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
tempstorage = fopen(storage, "rb");
|
||||
if(!tempstorage) {
|
||||
/* weird, we cannot read the file we just wrote to... */
|
||||
/* weird, we cannot read the file we wrote to... */
|
||||
fprintf(stderr, "Cannot open %s for reading\n", storage);
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* we're done downloading, now reverse the process and upload the
|
||||
/* we are done downloading, now reverse the process and upload the
|
||||
temporarily stored data to the destination path */
|
||||
sftp_handle = libssh2_sftp_open(sftp_session, dest,
|
||||
LIBSSH2_FXF_WRITE |
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Sample showing how to do SFTP append of a local file onto a remote one.
|
||||
*
|
||||
* The sample code has default values for host name, user name, password
|
||||
* The sample code has default values for hostname, username, password
|
||||
* and path to copy, but you can specify them on the command line like:
|
||||
*
|
||||
* $ ./sftp_append 192.168.0.1 user password localfile /tmp/remotefile
|
||||
@@ -123,7 +123,7 @@ int main(int argc, char *argv[])
|
||||
/* Since we have set non-blocking, tell libssh2 we are blocking */
|
||||
libssh2_session_set_blocking(session, 1);
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
rc = libssh2_session_handshake(session, sock);
|
||||
@@ -135,7 +135,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Sample showing how to do SFTP mkdir
|
||||
*
|
||||
* The sample code has default values for host name, user name, password
|
||||
* The sample code has default values for hostname, username, password
|
||||
* and path to copy, but you can specify them on the command line like:
|
||||
*
|
||||
* $ ./sftp_mkdir 192.168.0.1 user password /tmp/sftp_mkdir
|
||||
@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
rc = libssh2_session_handshake(session, sock);
|
||||
@@ -115,7 +115,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Sample showing how to do SFTP non-blocking mkdir.
|
||||
*
|
||||
* The sample code has default values for host name, user name, password
|
||||
* The sample code has default values for hostname, username, password
|
||||
* and path to copy, but you can specify them on the command line like:
|
||||
*
|
||||
* $ ./sftp_mkdir_nonblock 192.168.0.1 user password /tmp/sftp_write_nonblock.c
|
||||
@@ -103,7 +103,7 @@ int main(int argc, char *argv[])
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
rc = libssh2_session_handshake(session, sock);
|
||||
@@ -115,7 +115,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Sample showing how to do SFTP non-blocking transfers.
|
||||
*
|
||||
* The sample code has default values for host name, user name, password
|
||||
* The sample code has default values for hostname, username, password
|
||||
* and path to copy, but you can specify them on the command line like:
|
||||
*
|
||||
* $ ./sftp_nonblock 192.168.0.1 user password /tmp/secrets
|
||||
@@ -174,7 +174,7 @@ int main(int argc, char *argv[])
|
||||
gettimeofday(&start, NULL);
|
||||
#endif
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
while((rc = libssh2_session_handshake(session, sock)) ==
|
||||
@@ -188,7 +188,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Sample showing how to do SFTP write transfers.
|
||||
*
|
||||
* The sample code has default values for host name, user name, password
|
||||
* The sample code has default values for hostname, username, password
|
||||
* and path to copy, but you can specify them on the command line like:
|
||||
*
|
||||
* $ ./sftp_write 192.168.0.1 user password sftp_write.c /tmp/secrets
|
||||
@@ -122,7 +122,7 @@ int main(int argc, char *argv[])
|
||||
/* Since we have set non-blocking, tell libssh2 we are blocking */
|
||||
libssh2_session_set_blocking(session, 1);
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
rc = libssh2_session_handshake(session, sock);
|
||||
@@ -134,7 +134,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Sample showing how to do SFTP non-blocking write transfers.
|
||||
*
|
||||
* The sample code has default values for host name, user name, password
|
||||
* The sample code has default values for hostname, username, password
|
||||
* and path to copy, but you can specify them on the command line like:
|
||||
*
|
||||
* $ ./sftp_write_nonblock 192.168.0.1 user password thisfile /tmp/storehere
|
||||
@@ -169,7 +169,7 @@ int main(int argc, char *argv[])
|
||||
/* Since we have set non-blocking, tell libssh2 we are non-blocking */
|
||||
libssh2_session_set_blocking(session, 0);
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
while((rc = libssh2_session_handshake(session, sock)) ==
|
||||
@@ -183,7 +183,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Sample showing how to do SFTP non-blocking write transfers.
|
||||
*
|
||||
* The sample code has default values for host name, user name, password
|
||||
* The sample code has default values for hostname, username, password
|
||||
* and path to copy, but you can specify them on the command line like:
|
||||
*
|
||||
* $ ./sftp_write_sliding 192.168.0.1 user password thisfile /tmp/storehere
|
||||
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
|
||||
/* Since we have set non-blocking, tell libssh2 we are non-blocking */
|
||||
libssh2_session_set_blocking(session, 0);
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
while((rc = libssh2_session_handshake(session, sock)) ==
|
||||
@@ -184,7 +184,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Sample doing an SFTP directory listing.
|
||||
*
|
||||
* The sample code has default values for host name, user name, password and
|
||||
* The sample code has default values for hostname, username, password and
|
||||
* path, but you can specify them on the command line like:
|
||||
*
|
||||
* $ ./sftpdir 192.168.0.1 user password /tmp/secretdir
|
||||
@@ -131,7 +131,7 @@ int main(int argc, char *argv[])
|
||||
goto shutdown;
|
||||
}
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
rc = libssh2_session_handshake(session, sock);
|
||||
@@ -143,7 +143,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
@@ -247,8 +247,7 @@ int main(int argc, char *argv[])
|
||||
rc = libssh2_sftp_readdir_ex(sftp_handle, mem, sizeof(mem),
|
||||
longentry, sizeof(longentry), &attrs);
|
||||
if(rc > 0) {
|
||||
/* rc is the length of the file name in the mem
|
||||
buffer */
|
||||
/* rc is the length of the filename in the mem buffer */
|
||||
|
||||
if(longentry[0] != '\0') {
|
||||
printf("%s\n", longentry);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
*
|
||||
* Sample doing an SFTP directory listing.
|
||||
*
|
||||
* The sample code has default values for host name, user name, password and
|
||||
* The sample code has default values for hostname, username, password and
|
||||
* path, but you can specify them on the command line like:
|
||||
*
|
||||
* $ ./sftpdir_nonblock 192.168.0.1 user password /tmp/secretdir
|
||||
@@ -113,7 +113,7 @@ int main(int argc, char *argv[])
|
||||
/* Since we have set non-blocking, tell libssh2 we are non-blocking */
|
||||
libssh2_session_set_blocking(session, 0);
|
||||
|
||||
/* ... start it up. This will trade welcome banners, exchange keys,
|
||||
/* ... start it up. This trades welcome banners, exchange keys,
|
||||
* and setup crypto, compression, and MAC layers
|
||||
*/
|
||||
while((rc = libssh2_session_handshake(session, sock)) ==
|
||||
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
|
||||
/* At this point we have not yet authenticated. The first thing to do
|
||||
* is check the hostkey's fingerprint against our known hosts Your app
|
||||
* may have it hard coded, may go to a file, may present it to the
|
||||
* user, that's your call
|
||||
* user, that is your call
|
||||
*/
|
||||
fingerprint = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
||||
fprintf(stderr, "Fingerprint: ");
|
||||
@@ -192,8 +192,7 @@ int main(int argc, char *argv[])
|
||||
&attrs)) == LIBSSH2_ERROR_EAGAIN)
|
||||
;
|
||||
if(rc > 0) {
|
||||
/* rc is the length of the file name in the mem
|
||||
buffer */
|
||||
/* rc is the length of the filename in the mem buffer */
|
||||
|
||||
if(attrs.flags & LIBSSH2_SFTP_ATTR_PERMISSIONS) {
|
||||
/* this should check what permissions it
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user