Compare commits
23 Commits
libssh2-1.
...
libssh2-1.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e885300b18 | ||
![]() |
92a9f95279 | ||
![]() |
e91d4c9790 | ||
![]() |
69a3354467 | ||
![]() |
3ede6e280e | ||
![]() |
b583311a93 | ||
![]() |
27ac5aa40d | ||
![]() |
a123051200 | ||
![]() |
62901253a4 | ||
![]() |
7c5ee0fa66 | ||
![]() |
1e15075a8e | ||
![]() |
ad63fc2df6 | ||
![]() |
d46185eaa5 | ||
![]() |
9c4b380dd6 | ||
![]() |
e887a8bd0f | ||
![]() |
04692445d4 | ||
![]() |
a955f8428b | ||
![]() |
ededdfa9c2 | ||
![]() |
11f9dce3d7 | ||
![]() |
6bbebcf36c | ||
![]() |
7a87bba02a | ||
![]() |
c8374cdc10 | ||
![]() |
9b2bed22fc |
@@ -1,6 +1,9 @@
|
||||
AUTOMAKE_OPTIONS = foreign nostdinc
|
||||
|
||||
SUBDIRS = src example tests docs
|
||||
SUBDIRS = src tests docs
|
||||
if BUILD_EXAMPLES
|
||||
SUBDIRS += example
|
||||
endif
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libssh2.pc
|
||||
|
@@ -1,28 +1,21 @@
|
||||
libssh2 1.4.1
|
||||
libssh2 1.4.2
|
||||
|
||||
This release includes the following bugfixes:
|
||||
|
||||
o build error with gcrypt backend
|
||||
o always do "forced" window updates to avoid corner case stalls
|
||||
o aes: the init function fails when OpenSSL has AES support
|
||||
o transport_send: Finish in-progress key exchange before sending data
|
||||
o channel_write: acknowledge transport errors
|
||||
o examples/x11.c: Make sure sizeof passed to read operation is correct
|
||||
o examples/x11.c:,Fix suspicious sizeof usage
|
||||
o sftp_packet_add: verify the packet before accepting it
|
||||
o SFTP: preserve the original error code more
|
||||
o sftp_packet_read: adjust window size as necessary
|
||||
o Use safer snprintf rather then sprintf in several places
|
||||
o Define and use LIBSSH2_INVALID_SOCKET instead of INVALID_SOCKET
|
||||
o sftp_write: cannot return acked data *and* EAGAIN
|
||||
o sftp_read: avoid data *and* EAGAIN
|
||||
o libssh2.h: Add missing prototype for libssh2_session_banner_set()
|
||||
o Return LIBSSH2_ERROR_SOCKET_DISCONNECT on EOF when reading banner
|
||||
o userauth.c: fread() from public key file to correctly detect any errors
|
||||
o configure.ac: Add option to disable build of the example applications
|
||||
o Added 'Requires.private:' line to libssh2.pc
|
||||
o SFTP: filter off incoming "zombie" responses
|
||||
o gettimeofday: no need for a replacement under cygwin
|
||||
o SSH_MSG_CHANNEL_REQUEST: default to want_reply
|
||||
o win32/libssh2_config.h: Remove hardcoded #define LIBSSH2_HAVE_ZLIB
|
||||
|
||||
This release would not have looked like this without help, code, reports and
|
||||
advice from friends like these:
|
||||
|
||||
Armen Babakhanian, Paul Howarth, Matthew Booth, Steven Dake, Peter Stuge,
|
||||
Matt Lawson, Tom Weber, Alexander Lamaison
|
||||
Alexander Lamaison, Rafael Kitover, Guenter Knauf, Peter Stuge,
|
||||
Oleksiy Zagorskyi
|
||||
|
||||
Thanks! (and sorry if I forgot to mention someone)
|
||||
|
||||
|
21
configure.ac
21
configure.ac
@@ -96,13 +96,17 @@ AC_ARG_WITH(libz,
|
||||
# Look for OpenSSL (default)
|
||||
if test "$use_openssl" != "no" && test "$use_libgcrypt" != "yes"; then
|
||||
AC_LIB_HAVE_LINKFLAGS([ssl], [crypto], [#include <openssl/ssl.h>])
|
||||
LIBSREQUIRED=libssl,libcrypto
|
||||
fi
|
||||
|
||||
# Look for libgcrypt
|
||||
if test "$ac_cv_libssl" != "yes" && test "$use_libgcrypt" != "no"; then
|
||||
AC_LIB_HAVE_LINKFLAGS([gcrypt], [], [#include <gcrypt.h>])
|
||||
LIBSREQUIRED=libgcrypt
|
||||
fi
|
||||
|
||||
AC_SUBST(LIBSREQUIRED)
|
||||
|
||||
if test "$ac_cv_libssl" != "yes" && test "$ac_cv_libgcrypt" != "yes"; then
|
||||
AC_MSG_ERROR([cannot find OpenSSL or Libgcrypt,
|
||||
try --with-libssl-prefix=PATH or --with-libgcrypt-prefix=PATH])
|
||||
@@ -215,6 +219,22 @@ AC_HELP_STRING([--disable-hidden-symbols],[Leave all symbols with default visibi
|
||||
AC_MSG_RESULT(no)
|
||||
)
|
||||
|
||||
# Build example applications?
|
||||
AC_MSG_CHECKING([whether to build example applications])
|
||||
AC_ARG_ENABLE([examples-build],
|
||||
AC_HELP_STRING([--enable-examples-build], [Build example applications (this is the default)])
|
||||
AC_HELP_STRING([--disable-examples-build], [Do not build example applications]),
|
||||
[case "$enableval" in
|
||||
no | false)
|
||||
build_examples='no'
|
||||
;;
|
||||
*)
|
||||
build_examples='yes'
|
||||
;;
|
||||
esac], [build_examples='yes'])
|
||||
AC_MSG_RESULT($build_examples)
|
||||
AM_CONDITIONAL([BUILD_EXAMPLES], [test "x$build_examples" != "xno"])
|
||||
|
||||
# Checks for header files.
|
||||
# AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h])
|
||||
@@ -300,6 +320,7 @@ AC_MSG_NOTICE([summary of build options:
|
||||
Library types: Shared=${enable_shared}, Static=${enable_static}
|
||||
Crypto library: openssl: ${ac_cv_libssl:-no} (AES-CTR: ${ac_cv_func_EVP_aes_128_ctr:-N/A}) libgcrypt: ${ac_cv_libgcrypt:-no}
|
||||
Debug build: $enable_debug
|
||||
Build examples: $build_examples
|
||||
Path to sshd: $ac_cv_path_SSHD (only for self-tests)
|
||||
libz compression: $ac_cv_libz
|
||||
])
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2004-2009, Sara Golemon <sarag@libssh2.org>
|
||||
* Copyright (c) 2009-2010 Daniel Stenberg
|
||||
* Copyright (c) 2009-2012 Daniel Stenberg
|
||||
* Copyright (c) 2010 Simon Josefsson <simon@josefsson.org>
|
||||
* All rights reserved.
|
||||
*
|
||||
@@ -40,19 +40,19 @@
|
||||
#ifndef LIBSSH2_H
|
||||
#define LIBSSH2_H 1
|
||||
|
||||
#define LIBSSH2_COPYRIGHT "2004-2011 The libssh2 project and its contributors."
|
||||
#define LIBSSH2_COPYRIGHT "2004-2012 The libssh2 project and its contributors."
|
||||
|
||||
/* We use underscore instead of dash when appending DEV in dev versions just
|
||||
to make the BANNER define (used by src/session.c) be a valid SSH
|
||||
banner. Release versions have no appended strings and may of course not
|
||||
have dashes either. */
|
||||
#define LIBSSH2_VERSION "1.4.0_DEV"
|
||||
#define LIBSSH2_VERSION "1.4.2_DEV"
|
||||
|
||||
/* The numeric version number is also available "in parts" by using these
|
||||
defines: */
|
||||
#define LIBSSH2_VERSION_MAJOR 1
|
||||
#define LIBSSH2_VERSION_MINOR 4
|
||||
#define LIBSSH2_VERSION_PATCH 0
|
||||
#define LIBSSH2_VERSION_PATCH 2
|
||||
|
||||
/* This is the numeric version of the libssh2 version number, meant for easier
|
||||
parsing and comparions by programs. The LIBSSH2_VERSION_NUM define will
|
||||
@@ -69,7 +69,7 @@
|
||||
and it is always a greater number in a more recent release. It makes
|
||||
comparisons with greater than and less than work.
|
||||
*/
|
||||
#define LIBSSH2_VERSION_NUM 0x010400
|
||||
#define LIBSSH2_VERSION_NUM 0x010402
|
||||
|
||||
/*
|
||||
* This is the date and time when the full source package was created. The
|
||||
|
@@ -11,6 +11,7 @@ Name: libssh2
|
||||
URL: http://www.libssh2.org/
|
||||
Description: Library for SSH-based communication
|
||||
Version: @LIBSSH2VER@
|
||||
Requires.private: @LIBSREQUIRED@
|
||||
Libs: -L${libdir} -lssh2 @LDFLAGS@ @LIBS@
|
||||
Libs.private: @LIBS@
|
||||
Cflags: -I${includedir}
|
||||
|
@@ -14,12 +14,12 @@ endif
|
||||
|
||||
# Edit the path below to point to the base of your Zlib sources.
|
||||
ifndef ZLIB_PATH
|
||||
ZLIB_PATH = ../../zlib-1.2.5
|
||||
ZLIB_PATH = ../../zlib-1.2.6
|
||||
endif
|
||||
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.8r
|
||||
OPENSSL_PATH = ../../openssl-0.9.8v
|
||||
endif
|
||||
|
||||
# Edit the path below to point to your Distribution folder.
|
||||
@@ -229,9 +229,11 @@ $(OBJDIR)/version.inc: ../include/libssh2.h $(OBJDIR)
|
||||
|
||||
dist: all $(DISTDIR) $(DISTDIR)/readme.txt
|
||||
@-$(MD) $(DISTDIR)$(DS)bin
|
||||
@-$(CP) ../AUTHORS $(DISTDIR)
|
||||
@-$(CP) ../COPYING $(DISTDIR)
|
||||
@-$(CP) ../INSTALL $(DISTDIR)
|
||||
@-$(CP) ../README $(DISTDIR)
|
||||
@-$(CP) ../RELEASE-NOTES $(DEVLDIR)
|
||||
@$(CP) $(TARGET).nlm $(DISTDIR)/bin
|
||||
@echo Creating $(DISTARC)
|
||||
@$(ZIP) $(DISTARC) $(DISTDIR)/* < $(DISTDIR)/readme.txt
|
||||
@@ -240,9 +242,11 @@ dev: all $(DEVLDIR) $(DEVLDIR)/readme.txt
|
||||
@-$(MD) $(DEVLDIR)$(DS)bin
|
||||
@-$(MD) $(DEVLDIR)$(DS)include
|
||||
@-$(MD) $(DEVLDIR)$(DS)nw
|
||||
@-$(CP) ../AUTHORS $(DISTDIR)
|
||||
@-$(CP) ../COPYING $(DISTDIR)
|
||||
@-$(CP) ../INSTALL $(DEVLDIR)
|
||||
@-$(CP) ../README $(DEVLDIR)
|
||||
@-$(CP) ../RELEASE-NOTES $(DEVLDIR)
|
||||
@$(CP) $(TARGET).nlm $(DEVLDIR)/bin
|
||||
@$(CP) ../include/*.h $(DEVLDIR)/include
|
||||
@$(CP) libssh2_config.h $(DEVLDIR)/include
|
||||
|
@@ -14,12 +14,12 @@ endif
|
||||
|
||||
# Edit the path below to point to the base of your Zlib sources.
|
||||
ifndef ZLIB_PATH
|
||||
ZLIB_PATH = ../../../zlib-1.2.5
|
||||
ZLIB_PATH = ../../../zlib-1.2.6
|
||||
endif
|
||||
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../../openssl-0.9.8r
|
||||
OPENSSL_PATH = ../../../openssl-0.9.8v
|
||||
endif
|
||||
|
||||
# Edit the var below to enable static linking of libssh2 and libz
|
||||
|
@@ -78,7 +78,7 @@ void _libssh2_htonu32(unsigned char *buf, uint32_t val);
|
||||
void _libssh2_store_u32(unsigned char **buf, uint32_t value);
|
||||
void _libssh2_store_str(unsigned char **buf, const char *str, size_t len);
|
||||
|
||||
#if defined(LIBSSH2_WIN32) && !defined(__MINGW32__)
|
||||
#if defined(LIBSSH2_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN__)
|
||||
/* provide a private one */
|
||||
#undef HAVE_GETTIMEOFDAY
|
||||
int __cdecl _libssh2_gettimeofday(struct timeval *tp, void *tzp);
|
||||
|
@@ -751,7 +751,7 @@ _libssh2_packet_add(LIBSSH2_SESSION * session, unsigned char *data,
|
||||
if(datalen >= 9) {
|
||||
uint32_t channel = _libssh2_ntohu32(data + 1);
|
||||
uint32_t len = _libssh2_ntohu32(data + 5);
|
||||
unsigned char want_reply = 0;
|
||||
unsigned char want_reply = 1;
|
||||
|
||||
if(len < (datalen - 10))
|
||||
want_reply = data[9 + len];
|
||||
|
@@ -143,7 +143,7 @@ banner_receive(LIBSSH2_SESSION * session)
|
||||
|
||||
if (ret == 0) {
|
||||
session->socket_state = LIBSSH2_SOCKET_DISCONNECTED;
|
||||
return LIBSSH2_ERROR_SOCKET_RECV;
|
||||
return LIBSSH2_ERROR_SOCKET_DISCONNECT;
|
||||
}
|
||||
|
||||
if (c == '\0') {
|
||||
|
116
src/sftp.c
116
src/sftp.c
@@ -132,6 +132,66 @@ static void _libssh2_store_u64(unsigned char **ptr, libssh2_uint64_t value)
|
||||
*ptr += 8;
|
||||
}
|
||||
|
||||
/*
|
||||
* Search list of zombied FXP_READ request IDs.
|
||||
*
|
||||
* Returns NULL if ID not in list.
|
||||
*/
|
||||
static struct sftp_zombie_requests *
|
||||
find_zombie_request(LIBSSH2_SFTP *sftp, uint32_t request_id)
|
||||
{
|
||||
struct sftp_zombie_requests *zombie =
|
||||
_libssh2_list_first(&sftp->zombie_requests);
|
||||
|
||||
while(zombie) {
|
||||
if(zombie->request_id == request_id)
|
||||
break;
|
||||
else
|
||||
zombie = _libssh2_list_next(&zombie->node);
|
||||
}
|
||||
|
||||
return zombie;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_zombie_request(LIBSSH2_SFTP *sftp, uint32_t request_id)
|
||||
{
|
||||
LIBSSH2_SESSION *session = sftp->channel->session;
|
||||
|
||||
struct sftp_zombie_requests *zombie = find_zombie_request(sftp,
|
||||
request_id);
|
||||
if(zombie) {
|
||||
_libssh2_debug(session, LIBSSH2_TRACE_SFTP,
|
||||
"Removing request ID %ld from the list of zombie requests",
|
||||
request_id);
|
||||
|
||||
_libssh2_list_remove(&zombie->node);
|
||||
LIBSSH2_FREE(session, zombie);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
add_zombie_request(LIBSSH2_SFTP *sftp, uint32_t request_id)
|
||||
{
|
||||
LIBSSH2_SESSION *session = sftp->channel->session;
|
||||
|
||||
struct sftp_zombie_requests *zombie;
|
||||
|
||||
_libssh2_debug(session, LIBSSH2_TRACE_SFTP,
|
||||
"Marking request ID %ld as a zombie request", request_id);
|
||||
|
||||
zombie = LIBSSH2_ALLOC(sftp->channel->session,
|
||||
sizeof(struct sftp_zombie_requests));
|
||||
if (!zombie)
|
||||
return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
|
||||
"malloc fail for zombie request ID");
|
||||
else {
|
||||
zombie->request_id = request_id;
|
||||
_libssh2_list_add(&sftp->zombie_requests, &zombie->node);
|
||||
return LIBSSH2_ERROR_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* sftp_packet_add
|
||||
*
|
||||
@@ -143,6 +203,7 @@ sftp_packet_add(LIBSSH2_SFTP *sftp, unsigned char *data,
|
||||
{
|
||||
LIBSSH2_SESSION *session = sftp->channel->session;
|
||||
LIBSSH2_SFTP_PACKET *packet;
|
||||
uint32_t request_id;
|
||||
|
||||
_libssh2_debug(session, LIBSSH2_TRACE_SFTP, "Received packet %d (len %d)",
|
||||
(int) data[0], data_len);
|
||||
@@ -188,6 +249,21 @@ sftp_packet_add(LIBSSH2_SFTP *sftp, unsigned char *data,
|
||||
"Out of sync with the world");
|
||||
}
|
||||
|
||||
request_id = _libssh2_ntohu32(&data[1]);
|
||||
|
||||
/* Don't add the packet if it answers a request we've given up on. */
|
||||
if((data[0] == SSH_FXP_STATUS || data[0] == SSH_FXP_DATA)
|
||||
&& find_zombie_request(sftp, request_id)) {
|
||||
|
||||
/* If we get here, the file ended before the response arrived. We
|
||||
are no longer interested in the request so we discard it */
|
||||
|
||||
LIBSSH2_FREE(session, data);
|
||||
|
||||
remove_zombie_request(sftp, request_id);
|
||||
return LIBSSH2_ERROR_NONE;
|
||||
}
|
||||
|
||||
packet = LIBSSH2_ALLOC(session, sizeof(LIBSSH2_SFTP_PACKET));
|
||||
if (!packet) {
|
||||
return _libssh2_error(session, LIBSSH2_ERROR_ALLOC,
|
||||
@@ -196,7 +272,7 @@ sftp_packet_add(LIBSSH2_SFTP *sftp, unsigned char *data,
|
||||
|
||||
packet->data = data;
|
||||
packet->data_len = data_len;
|
||||
packet->request_id = _libssh2_ntohu32(&data[1]);
|
||||
packet->request_id = request_id;
|
||||
|
||||
_libssh2_list_add(&sftp->packets, &packet->node);
|
||||
|
||||
@@ -216,6 +292,7 @@ sftp_packet_read(LIBSSH2_SFTP *sftp)
|
||||
unsigned char *packet = NULL;
|
||||
ssize_t rc;
|
||||
unsigned long recv_window;
|
||||
int packet_type;
|
||||
|
||||
_libssh2_debug(session, LIBSSH2_TRACE_SFTP, "recv packet");
|
||||
|
||||
@@ -324,13 +401,17 @@ sftp_packet_read(LIBSSH2_SFTP *sftp)
|
||||
|
||||
sftp->partial_packet = NULL;
|
||||
|
||||
/* sftp_packet_add takes ownership of the packet and might free it
|
||||
so we take a copy of the packet type before we call it. */
|
||||
packet_type = packet[0];
|
||||
rc = sftp_packet_add(sftp, packet, sftp->partial_len);
|
||||
if (rc) {
|
||||
LIBSSH2_FREE(session, packet);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return packet[0];
|
||||
else {
|
||||
return packet_type;
|
||||
}
|
||||
}
|
||||
/* WON'T REACH */
|
||||
}
|
||||
@@ -363,6 +444,10 @@ static void sftp_packetlist_flush(LIBSSH2_SFTP_HANDLE *handle)
|
||||
if(!rc)
|
||||
/* we found a packet, free it */
|
||||
LIBSSH2_FREE(session, data);
|
||||
else if(chunk->sent)
|
||||
/* there was no incoming packet for this request, mark this
|
||||
request as a zombie if it ever sent the request */
|
||||
add_zombie_request(sftp, chunk->request_id);
|
||||
|
||||
_libssh2_list_remove(&chunk->node);
|
||||
LIBSSH2_FREE(session, chunk);
|
||||
@@ -433,10 +518,7 @@ sftp_packet_require(LIBSSH2_SFTP *sftp, unsigned char packet_type,
|
||||
|
||||
while (session->socket_state == LIBSSH2_SOCKET_CONNECTED) {
|
||||
rc = sftp_packet_read(sftp);
|
||||
if (rc == LIBSSH2_ERROR_EAGAIN)
|
||||
return rc;
|
||||
else if (rc <= 0)
|
||||
/* TODO: isn't this supposed to be < 0 only? */
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
/* data was read, check the queue again */
|
||||
@@ -1377,6 +1459,12 @@ static ssize_t sftp_read(LIBSSH2_SFTP_HANDLE * handle, char *buffer,
|
||||
|
||||
switch (data[0]) {
|
||||
case SSH_FXP_STATUS:
|
||||
/* remove the chunk we just processed keeping track of the
|
||||
* next one in case we need it */
|
||||
next = _libssh2_list_next(&chunk->node);
|
||||
_libssh2_list_remove(&chunk->node);
|
||||
LIBSSH2_FREE(session, chunk);
|
||||
|
||||
/* we must remove all outstanding READ requests, as either we
|
||||
got an error or we're at end of file */
|
||||
sftp_packetlist_flush(handle);
|
||||
@@ -2091,13 +2179,15 @@ libssh2_sftp_tell64(LIBSSH2_SFTP_HANDLE *handle)
|
||||
}
|
||||
|
||||
/*
|
||||
* Flush all remaining incoming SFTP packets.
|
||||
* Flush all remaining incoming SFTP packets and zombies.
|
||||
*/
|
||||
static void sftp_packet_flush(LIBSSH2_SFTP *sftp)
|
||||
{
|
||||
LIBSSH2_CHANNEL *channel = sftp->channel;
|
||||
LIBSSH2_SESSION *session = channel->session;
|
||||
LIBSSH2_SFTP_PACKET *packet = _libssh2_list_first(&sftp->packets);
|
||||
struct sftp_zombie_requests *zombie =
|
||||
_libssh2_list_first(&sftp->zombie_requests);
|
||||
|
||||
while(packet) {
|
||||
LIBSSH2_SFTP_PACKET *next;
|
||||
@@ -2111,6 +2201,16 @@ static void sftp_packet_flush(LIBSSH2_SFTP *sftp)
|
||||
packet = next;
|
||||
}
|
||||
|
||||
while(zombie) {
|
||||
/* figure out the next node */
|
||||
struct sftp_zombie_requests *next = _libssh2_list_next(&zombie->node);
|
||||
/* unlink the current one */
|
||||
_libssh2_list_remove(&zombie->node);
|
||||
/* free the memory */
|
||||
LIBSSH2_FREE(session, zombie);
|
||||
zombie = next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* sftp_close_handle
|
||||
|
@@ -60,6 +60,11 @@ struct sftp_pipeline_chunk {
|
||||
unsigned char packet[1]; /* data */
|
||||
};
|
||||
|
||||
struct sftp_zombie_requests {
|
||||
struct list_node node;
|
||||
uint32_t request_id;
|
||||
};
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) ((x)<(y)?(x):(y))
|
||||
#endif
|
||||
@@ -136,6 +141,9 @@ struct _LIBSSH2_SFTP
|
||||
|
||||
struct list_head packets;
|
||||
|
||||
/* List of FXP_READ responses to ignore because EOF already received. */
|
||||
struct list_head zombie_requests;
|
||||
|
||||
/* a list of _LIBSSH2_SFTP_HANDLE structs */
|
||||
struct list_head sftp_handles;
|
||||
|
||||
|
@@ -472,7 +472,7 @@ file_read_publickey(LIBSSH2_SESSION * session, unsigned char **method,
|
||||
return _libssh2_error(session, LIBSSH2_ERROR_FILE,
|
||||
"Unable to open public key file");
|
||||
}
|
||||
while (!feof(fd) && (c = fgetc(fd)) != '\r' && c != '\n')
|
||||
while (!feof(fd) && 1 == fread(&c, 1, 1, fd) && c != '\r' && c != '\n')
|
||||
pubkey_len++;
|
||||
if (feof(fd)) {
|
||||
/* the last character was EOF */
|
||||
|
@@ -9,14 +9,14 @@
|
||||
|
||||
# Edit the path below to point to the base of your Zlib sources.
|
||||
ifndef ZLIB_PATH
|
||||
ZLIB_PATH = ../../zlib-1.2.5
|
||||
ZLIB_PATH = ../../zlib-1.2.6
|
||||
endif
|
||||
# since currently always enabled in libssh2_config.h set here too!
|
||||
WITH_ZLIB = 1
|
||||
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../openssl-0.9.8r
|
||||
OPENSSL_PATH = ../../openssl-1.0.1a
|
||||
endif
|
||||
|
||||
# Edit the var below to set to your architecture or set environment var.
|
||||
@@ -72,7 +72,7 @@ DS = /
|
||||
else
|
||||
CP = copy
|
||||
RM = del /q /f 2>NUL
|
||||
MD = md
|
||||
MD = md 2>NUL
|
||||
RD = rd /q /s 2>NUL
|
||||
XX =
|
||||
DS = $(XX)\$(XX)
|
||||
@@ -95,6 +95,12 @@ ifeq ($(ARCH),w64)
|
||||
CFLAGS += -D_AMD64_
|
||||
endif
|
||||
|
||||
ifdef LINK_STATIC
|
||||
LDLIBS += $(OPENSSL_PATH)/out/libcrypto.$(LIBEXT) $(OPENSSL_PATH)/out/libssl.$(LIBEXT)
|
||||
else
|
||||
LDLIBS += $(OPENSSL_PATH)/out/libeay32.$(LIBEXT) $(OPENSSL_PATH)/out/libssl32.$(LIBEXT)
|
||||
endif
|
||||
|
||||
ifeq ($(CC),mwcc)
|
||||
LD = mwld
|
||||
RC = mwwinrc
|
||||
@@ -119,7 +125,7 @@ ARFLAGS = -cq
|
||||
LIBEXT = a
|
||||
RANLIB = $(CROSSPREFIX)ranlib
|
||||
#LDLIBS += -lwsock32
|
||||
LDLIBS += -lws2_32
|
||||
LDLIBS += -lws2_32 -lgdi32
|
||||
RCFLAGS = -I. -I ../include -O coff -i
|
||||
CFLAGS += -fno-strict-aliasing
|
||||
CFLAGS += -Wall # -pedantic
|
||||
@@ -128,12 +134,6 @@ endif
|
||||
INCLUDES = -I. -I../include
|
||||
INCLUDES += -I$(OPENSSL_PATH)/outinc -I$(OPENSSL_PATH)/outinc/openssl
|
||||
|
||||
ifdef LINK_STATIC
|
||||
LDLIBS += $(OPENSSL_PATH)/out/libcrypto.$(LIBEXT) $(OPENSSL_PATH)/out/libssl.$(LIBEXT)
|
||||
else
|
||||
LDLIBS += $(OPENSSL_PATH)/out/libeay32.$(LIBEXT) $(OPENSSL_PATH)/out/libssl32.$(LIBEXT)
|
||||
endif
|
||||
|
||||
ifdef WITH_ZLIB
|
||||
INCLUDES += -I$(ZLIB_PATH)
|
||||
LDLIBS += $(ZLIB_PATH)/libz.$(LIBEXT)
|
||||
@@ -172,9 +172,11 @@ $(OBJDIR)/version.inc: ../include/libssh2.h $(OBJDIR)
|
||||
|
||||
dist: all $(DISTDIR) $(DISTDIR)/readme.txt
|
||||
@-$(MD) $(DISTDIR)$(DS)bin
|
||||
@-$(CP) ..$(DS)AUTHORS $(DISTDIR)
|
||||
@-$(CP) ..$(DS)COPYING $(DISTDIR)
|
||||
@-$(CP) ..$(DS)INSTALL $(DISTDIR)
|
||||
@-$(CP) ..$(DS)LICENSE $(DISTDIR)
|
||||
@-$(CP) ..$(DS)README $(DISTDIR)
|
||||
@-$(CP) ..$(DS)RELEASE-NOTES $(DEVLDIR)
|
||||
@$(CP) $(TARGET).dll $(DISTDIR)$(DS)bin
|
||||
@echo Creating $(DISTARC)
|
||||
@$(ZIP) $(DISTARC) $(DISTDIR)/* < $(DISTDIR)/readme.txt
|
||||
@@ -183,9 +185,11 @@ dev: all $(DEVLDIR) $(DEVLDIR)/readme.txt
|
||||
@-$(MD) $(DEVLDIR)$(DS)bin
|
||||
@-$(MD)$(DEVLDIR)$(DS)include
|
||||
@-$(MD) $(DEVLDIR)$(DS)win32
|
||||
@-$(CP) ..$(DS)AUTHORS $(DISTDIR)
|
||||
@-$(CP) ..$(DS)COPYING $(DISTDIR)
|
||||
@-$(CP) ..$(DS)INSTALL $(DEVLDIR)
|
||||
@-$(CP) ..$(DS)LICENSE $(DEVLDIR)
|
||||
@-$(CP) ..$(DS)README $(DEVLDIR)
|
||||
@-$(CP) ..$(DS)RELEASE-NOTES $(DEVLDIR)
|
||||
@$(CP) $(TARGET).dll $(DEVLDIR)$(DS)bin
|
||||
@$(CP) ..$(DS)include$(DS)*.h $(DEVLDIR)$(DS)include
|
||||
@$(CP) libssh2_config.h $(DEVLDIR)/include
|
||||
|
@@ -64,13 +64,13 @@ CFLAGS += -d_WIN32_WINNT=0x0501 -dENABLE_IPV6
|
||||
!ifdef %zlib_root
|
||||
ZLIB_ROOT = $(%zlib_root)
|
||||
!else
|
||||
ZLIB_ROOT = ..\..\zlib-1.2.5
|
||||
ZLIB_ROOT = ..\..\zlib-1.2.6
|
||||
!endif
|
||||
|
||||
!ifdef %openssl_root
|
||||
OPENSSL_ROOT = $(%openssl_root)
|
||||
!else
|
||||
OPENSSL_ROOT = ..\..\openssl-0.9.8r
|
||||
OPENSSL_ROOT = ..\..\openssl-0.9.8v
|
||||
!endif
|
||||
|
||||
#!ifdef %use_zlib
|
||||
|
@@ -1,10 +1,10 @@
|
||||
|
||||
# Tweak these for your system
|
||||
OPENSSLINC=..\openssl-0.9.8q\inc32
|
||||
OPENSSLLIB=..\openssl-0.9.8q\out32dll
|
||||
OPENSSLINC=..\openssl-0.9.8v\inc32
|
||||
OPENSSLLIB=..\openssl-0.9.8v\out32dll
|
||||
|
||||
ZLIBINC=-DLIBSSH2_HAVE_ZLIB=1 /I..\zlib-1.2.5
|
||||
ZLIBLIB=..\zlib-1.2.5
|
||||
ZLIBINC=-DLIBSSH2_HAVE_ZLIB=1 /I..\zlib-1.2.6
|
||||
ZLIBLIB=..\zlib-1.2.6
|
||||
|
||||
!if "$(TARGET)" == ""
|
||||
TARGET=Release
|
||||
|
@@ -34,9 +34,6 @@
|
||||
#define strcasecmp stricmp
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/* Compile in zlib support */
|
||||
#define LIBSSH2_HAVE_ZLIB 1
|
||||
|
||||
/* Enable newer diffie-hellman-group-exchange-sha1 syntax */
|
||||
#define LIBSSH2_DH_GEX_NEW 1
|
||||
|
||||
|
@@ -9,12 +9,12 @@
|
||||
|
||||
# Edit the path below to point to the base of your Zlib sources.
|
||||
ifndef ZLIB_PATH
|
||||
ZLIB_PATH = ../../../zlib-1.2.5
|
||||
ZLIB_PATH = ../../../zlib-1.2.6
|
||||
endif
|
||||
|
||||
# Edit the path below to point to the base of your OpenSSL package.
|
||||
ifndef OPENSSL_PATH
|
||||
OPENSSL_PATH = ../../../openssl-0.9.8r
|
||||
OPENSSL_PATH = ../../../openssl-0.9.8v
|
||||
endif
|
||||
|
||||
# Edit the var below to set to your architecture or set environment var.
|
||||
@@ -61,7 +61,7 @@ DS = /
|
||||
else
|
||||
CP = copy
|
||||
RM = del /q /f 2>NUL
|
||||
MD = md
|
||||
MD = md 2>NUL
|
||||
RD = rd /q /s 2>NUL
|
||||
XX =
|
||||
DS = $(XX)\$(XX)
|
||||
|
Reference in New Issue
Block a user