mirror of
https://github.com/libssh2/libssh2.git
synced 2025-07-29 13:01:14 +03:00
tidy-up: C header use
- drop unused or duplicate C headers.
- add missing ones (that worked by chance).
(`string.h`, `stdlib.h`)
- mention the functions that need certain headers.
- move some headers from crypto header to crypto C source.
- reorder headers in some places.
- simplify the #if tree for `sys/select.h` in `libssh2_priv.h`.
- move scp-specific macros next to their header to `scp.c`
Follow-up to 5db836b2a8
Closes #999
This commit is contained in:
@ -141,7 +141,7 @@ check_include_files(inttypes.h HAVE_INTTYPES_H)
|
||||
if(NOT MSVC)
|
||||
check_include_files(unistd.h HAVE_UNISTD_H)
|
||||
check_include_files(sys/time.h HAVE_SYS_TIME_H)
|
||||
check_include_files(sys/param.h HAVE_SYS_PARAM_H)
|
||||
check_include_files(sys/param.h HAVE_SYS_PARAM_H) # tests
|
||||
endif()
|
||||
if(NOT WIN32)
|
||||
check_include_files(sys/select.h HAVE_SYS_SELECT_H)
|
||||
|
@ -10,9 +10,6 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -23,11 +20,9 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE (in_addr_t)~0
|
||||
|
@ -22,11 +22,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||
static const char *privkey = "/home/username/.ssh/id_rsa";
|
||||
|
@ -17,9 +17,6 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -33,11 +30,7 @@
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||
static const char *privkey = "/home/username/.ssh/id_rsa";
|
||||
|
@ -18,11 +18,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||
static const char *privkey = "/home/username/.ssh/id_rsa";
|
||||
|
@ -8,9 +8,6 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -21,12 +18,8 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <time.h> /* for time() */
|
||||
|
||||
static const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||
static const char *privkey = "/home/username/.ssh/id_rsa";
|
||||
|
@ -28,11 +28,8 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
static const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||
static const char *privkey = "/home/username/.ssh/id_rsa";
|
||||
|
@ -18,9 +18,6 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -28,11 +25,7 @@
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||
static const char *privkey = "/home/username/.ssh/id_rsa";
|
||||
|
@ -24,11 +24,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||
static const char *privkey = "/home/username/.ssh/id_rsa";
|
||||
|
@ -24,11 +24,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||
static const char *privkey = "/home/username/.ssh/id_rsa";
|
||||
|
@ -24,11 +24,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||
static const char *privkey = "/home/username/.ssh/id_rsa";
|
||||
|
@ -18,9 +18,6 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -34,11 +31,7 @@
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||
static const char *privkey = "/home/username/.ssh/id_rsa";
|
||||
|
@ -24,11 +24,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||
static const char *privkey = "/home/username/.ssh/id_rsa";
|
||||
|
@ -14,9 +14,6 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -27,12 +24,8 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <time.h> /* for time() */
|
||||
|
||||
static const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||
static const char *privkey = "/home/username/.ssh/id_rsa";
|
||||
|
@ -14,9 +14,6 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -27,12 +24,9 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
#include <time.h> /* for time() */
|
||||
#include <string.h>
|
||||
|
||||
static const char *pubkey = "/home/username/.ssh/id_rsa.pub";
|
||||
static const char *privkey = "/home/username/.ssh/id_rsa";
|
||||
|
@ -24,11 +24,8 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define __FILESIZE "I64u"
|
||||
|
@ -24,11 +24,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define __FILESIZE "I64u"
|
||||
|
@ -28,12 +28,9 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
||||
#define snprintf _snprintf
|
||||
|
@ -22,12 +22,8 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
static const char *username = "username";
|
||||
|
||||
|
@ -17,9 +17,6 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -30,12 +27,8 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static const char *hostname = "127.0.0.1";
|
||||
static const char *commandline = "uptime";
|
||||
|
@ -12,9 +12,6 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -25,12 +22,9 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
static const char *hostname = "127.0.0.1";
|
||||
static const char *commandline = "cat";
|
||||
|
@ -14,9 +14,6 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -27,12 +24,9 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
static const char *hostname = "127.0.0.1";
|
||||
static const char *commandline = "uptime";
|
||||
|
@ -14,11 +14,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
|
@ -10,9 +10,6 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -23,11 +20,9 @@
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE (in_addr_t)~0
|
||||
|
@ -20,9 +20,6 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SELECT_H
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
@ -33,11 +30,7 @@
|
||||
#include <sys/un.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <termios.h>
|
||||
|
@ -185,8 +185,6 @@ typedef int libssh2_socket_t;
|
||||
|
||||
#ifdef LIBSSH2_USE_WIN32_LARGE_FILES
|
||||
# include <io.h>
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
# define LIBSSH2_STRUCT_STAT_SIZE_FORMAT "%I64d"
|
||||
typedef struct _stati64 libssh2_struct_stat;
|
||||
typedef __int64 libssh2_struct_stat_size;
|
||||
@ -197,8 +195,6 @@ typedef __int64 libssh2_struct_stat_size;
|
||||
*/
|
||||
|
||||
#ifdef LIBSSH2_USE_WIN32_SMALL_FILES
|
||||
# include <sys/types.h>
|
||||
# include <sys/stat.h>
|
||||
# ifndef _WIN32_WCE
|
||||
# define LIBSSH2_STRUCT_STAT_SIZE_FORMAT "%d"
|
||||
typedef struct _stat libssh2_struct_stat;
|
||||
|
@ -39,7 +39,10 @@
|
||||
|
||||
#include "libssh2_priv.h"
|
||||
#include "agent.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h> /* for getenv() */
|
||||
|
||||
#ifdef HAVE_SYS_UN_H
|
||||
#include <sys/un.h>
|
||||
#else
|
||||
@ -48,6 +51,7 @@
|
||||
support them. */
|
||||
#undef PF_UNIX
|
||||
#endif
|
||||
|
||||
#include "userauth.h"
|
||||
#include "session.h"
|
||||
|
||||
|
@ -39,7 +39,6 @@
|
||||
|
||||
#include "libssh2_priv.h"
|
||||
#include "agent.h"
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(WIN32) && !defined(LIBSSH2_WINDOWS_UWP)
|
||||
|
||||
|
@ -20,10 +20,6 @@
|
||||
#ifndef HAVE_BCRYPT_PBKDF
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#define LIBSSH2_BCRYPT_PBKDF_C
|
||||
#include "blowfish.c"
|
||||
|
@ -39,13 +39,14 @@
|
||||
*/
|
||||
|
||||
#include "libssh2_priv.h"
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <fcntl.h>
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "channel.h"
|
||||
|
@ -37,6 +37,7 @@
|
||||
*/
|
||||
|
||||
#include "libssh2_priv.h"
|
||||
|
||||
#ifdef LIBSSH2_HAVE_ZLIB
|
||||
#include <zlib.h>
|
||||
#undef compress /* dodge name clash with ZLIB macro */
|
||||
|
@ -38,8 +38,6 @@
|
||||
|
||||
#ifdef LIBSSH2_CRYPTO_C /* Compile this via crypto.c */
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#if LIBSSH2_RSA
|
||||
int
|
||||
_libssh2_rsa_new(libssh2_rsa_ctx ** rsa,
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "libssh2_setup.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
|
||||
@ -59,14 +60,8 @@
|
||||
*/
|
||||
#ifdef HAVE_POLL
|
||||
# include <poll.h>
|
||||
#else
|
||||
# if defined(HAVE_SELECT) && !defined(WIN32)
|
||||
# ifdef HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
# else
|
||||
# include <sys/types.h>
|
||||
# endif
|
||||
# endif
|
||||
#elif defined(HAVE_SELECT) && defined(HAVE_SYS_SELECT_H)
|
||||
# include <sys/select.h>
|
||||
#endif
|
||||
|
||||
/* Needed for struct iovec on some platforms */
|
||||
@ -914,14 +909,6 @@ struct _LIBSSH2_SESSION
|
||||
long packet_read_timeout;
|
||||
};
|
||||
|
||||
#if defined(HAVE_STRTOLL)
|
||||
#define scpsize_strtol strtoll
|
||||
#elif defined(HAVE_STRTOI64)
|
||||
#define scpsize_strtol _strtoi64
|
||||
#else
|
||||
#define scpsize_strtol strtol
|
||||
#endif
|
||||
|
||||
/* session.state bits */
|
||||
#define LIBSSH2_STATE_EXCHANGING_KEYS 0x00000001
|
||||
#define LIBSSH2_STATE_NEWKEYS 0x00000002
|
||||
|
@ -37,6 +37,8 @@
|
||||
|
||||
#ifdef LIBSSH2_CRYPTO_C /* Compile this via crypto.c */
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#if MBEDTLS_VERSION_NUMBER < 0x03000000
|
||||
#define mbedtls_cipher_info_get_key_bitlen(c) (c->key_bitlen)
|
||||
#define mbedtls_cipher_info_get_iv_size(c) (c->iv_size)
|
||||
|
@ -39,9 +39,6 @@
|
||||
|
||||
#define LIBSSH2_CRYPTO_ENGINE libssh2_mbedtls
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <mbedtls/platform.h>
|
||||
#include <mbedtls/md.h>
|
||||
#include <mbedtls/rsa.h>
|
||||
@ -162,6 +159,7 @@
|
||||
#define libssh2_sha1(data, datalen, hash) \
|
||||
_libssh2_mbedtls_hash(data, datalen, MBEDTLS_MD_SHA1, hash)
|
||||
|
||||
|
||||
/*******************************************************************/
|
||||
/*
|
||||
* mbedTLS backend: SHA256 functions
|
||||
|
@ -40,21 +40,18 @@
|
||||
#include "libssh2_priv.h"
|
||||
#include "misc.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef WIN32
|
||||
/* Force parameter type. */
|
||||
#define recv(s, b, l, f) recv((s), (b), (int)(l), (f))
|
||||
#define send(s, b, l, f) send((s), (b), (int)(l), (f))
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
/* snprintf not in Visual Studio CRT and _snprintf dangerously incompatible.
|
||||
We provide a safe wrapper if snprintf not found */
|
||||
#ifdef LIBSSH2_SNPRINTF
|
||||
|
@ -40,8 +40,8 @@
|
||||
|
||||
#ifdef LIBSSH2_CRYPTO_C /* Compile this via crypto.c */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef EVP_MAX_BLOCK_LENGTH
|
||||
#define EVP_MAX_BLOCK_LENGTH 32
|
||||
|
@ -41,7 +41,6 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <alloca.h>
|
||||
#include <sys/uio.h>
|
||||
|
@ -39,24 +39,18 @@
|
||||
*/
|
||||
|
||||
#include "libssh2_priv.h"
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_INTTYPES_H
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
/* Needed for struct iovec on some platforms */
|
||||
#ifdef HAVE_SYS_UIO_H
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "transport.h"
|
||||
#include "channel.h"
|
||||
#include "packet.h"
|
||||
|
11
src/scp.c
11
src/scp.c
@ -37,12 +37,19 @@
|
||||
*/
|
||||
|
||||
#include "libssh2_priv.h"
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "channel.h"
|
||||
#include "session.h"
|
||||
|
||||
#include <stdlib.h> /* strtoll(), _strtoi64(), strtol() */
|
||||
|
||||
#if defined(HAVE_STRTOLL)
|
||||
#define scpsize_strtol strtoll
|
||||
#elif defined(HAVE_STRTOI64)
|
||||
#define scpsize_strtol _strtoi64
|
||||
#else
|
||||
#define scpsize_strtol strtol
|
||||
#endif
|
||||
|
||||
/* Max. length of a quoted string after libssh2_shell_quotearg() processing */
|
||||
#define _libssh2_shell_quotedsize(s) (3 * strlen(s) + 2)
|
||||
|
@ -42,18 +42,17 @@
|
||||
#ifdef WIN32
|
||||
#include <ws2tcpip.h> /* for socklen_t */
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "transport.h"
|
||||
#include "session.h"
|
||||
#include "channel.h"
|
||||
|
@ -37,14 +37,15 @@
|
||||
* OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "libssh2_priv.h"
|
||||
#include "libssh2_sftp.h"
|
||||
|
||||
#include "channel.h"
|
||||
#include "session.h"
|
||||
#include "sftp.h"
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/* This release of libssh2 implements Version 5 with automatic downgrade
|
||||
* based on server's declaration
|
||||
* https://www.ietf.org/archive/id/draft-ietf-secsh-filexfer-05.txt
|
||||
|
@ -39,13 +39,9 @@
|
||||
*/
|
||||
|
||||
#include "libssh2_priv.h"
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
#ifdef LIBSSH2DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "transport.h"
|
||||
|
@ -40,9 +40,6 @@
|
||||
#include "libssh2_priv.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
/* Needed for struct iovec on some platforms */
|
||||
#ifdef HAVE_SYS_UIO_H
|
||||
|
@ -41,19 +41,20 @@
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <ctype.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#if defined(WIN32) && defined(_WIN64)
|
||||
#define LIBSSH2_SOCKET_MASK "%lld"
|
||||
|
@ -38,25 +38,25 @@
|
||||
#include "session_fixture.h"
|
||||
#include "openssh_fixture.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#include <direct.h>
|
||||
#define chdir _chdir
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_PARAM_H
|
||||
#include <sys/param.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
static LIBSSH2_SESSION *connected_session = NULL;
|
||||
static libssh2_socket_t connected_socket = LIBSSH2_INVALID_SOCKET;
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdlib.h> /* for getenv() */
|
||||
|
||||
static const char *hostname = "127.0.0.1";
|
||||
static const unsigned short port_number = 4711;
|
||||
|
Reference in New Issue
Block a user