Compare commits

...

6 Commits

Author SHA1 Message Date
Sara Golemon
2207b99afb Bump version number 2006-03-02 01:10:06 +00:00
Sara Golemon
1d7522bc06 BugFix#1436593: Apply build options for HPUX targets 2006-02-23 23:14:35 +00:00
Mikhail Gusarov
a4e61c265b Fixed errorneous flushing packets for unrelated channels when one is closed
(thanks to Alexander Holyapin)
2006-02-20 08:39:54 +00:00
Sara Golemon
502a48afa1 Fix make install on MacOSX 2006-01-06 17:34:03 +00:00
Sara Golemon
efc3841fd2 Add terminating NULL to readlin/realpath results 2005-11-17 23:20:32 +00:00
Sara Golemon
f9d65b0984 Fix miscellaneous bugs in src/channel.c and src/packet.c
Courtessy David Robins
2005-11-02 00:26:24 +00:00
9 changed files with 42 additions and 8 deletions

View File

@@ -18,9 +18,10 @@ all:
(cd $$dir && $(MAKE) all) \ (cd $$dir && $(MAKE) all) \
|| case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \ || case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail" done && test -z "$$fail"
sample:
$(CC) -o ssh2_sample.o ssh2_sample.c $(CFLAGS) $(CC) -o ssh2_sample.o ssh2_sample.c $(CFLAGS)
$(CC) -o ssh2_sample ssh2_sample.o $(LIBS) $(CC) -o ssh2_sample ssh2_sample.o $(LIBS)
install: install: all
$(top_srcdir)/mkinstalldirs $(DESTDIR)$(incldir) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(incldir)
$(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(libdir)
@for dir in ${subdirs}; do \ @for dir in ${subdirs}; do \

13
README
View File

@@ -1,6 +1,19 @@
libssh2 - SSH2 library libssh2 - SSH2 library
====================== ======================
Version 0.13
------------
Fixed channel not being marked closed when CHANNEL_CLOSE package cannot be sent. (David Robins)
Fixed payload packet allocation bug when invalid packet length received. (David Robins)
Fixed `make install' target for MacOSX.
Add terminating NULL character to readlink()/realpath() results.
BugFix#1436593: Apply build options for HPUX targets.
Version 0.12 Version 0.12
------------ ------------

View File

@@ -1,8 +1,11 @@
# AC_PREREQ(2.57) # AC_PREREQ(2.57)
AC_INIT(libssh2,0.12,sarag@libssh2.org) AC_INIT(libssh2,0.13,sarag@libssh2.org)
AC_CONFIG_SRCDIR([src]) AC_CONFIG_SRCDIR([src])
AC_CONFIG_HEADER([include/libssh2_config.h]) AC_CONFIG_HEADER([include/libssh2_config.h])
# Default to the same as CC
LDCC="\$(CC)"
# Check for the OS. # Check for the OS.
AC_CANONICAL_HOST AC_CANONICAL_HOST
case "$host" in case "$host" in
@@ -16,6 +19,11 @@ case "$host" in
SHLIB_LDFLAGS="-dynamiclib -flat_namespace" SHLIB_LDFLAGS="-dynamiclib -flat_namespace"
CFLAGS="$CFLAGS -DLIBSSH2_DARWIN" CFLAGS="$CFLAGS -DLIBSSH2_DARWIN"
;; ;;
*hpux*)
SHLIB_SUFFIX_NAME="sl"
SHLIB_LDFLAGS="-b +vnocompatwarnings -L/lib/pa20_64"
LDCC="ld"
;;
*) *)
SHLIB_SUFFIX_NAME="so" SHLIB_SUFFIX_NAME="so"
SHLIB_LDFLAGS="-shared" SHLIB_LDFLAGS="-shared"
@@ -31,6 +39,7 @@ AC_CHECK_LIB(m, ceil, [ SHLIB_LDFLAGS="$SHLIB_LDFLAGS -lm" ])
AC_SUBST(SHLIB_SUFFIX_NAME) AC_SUBST(SHLIB_SUFFIX_NAME)
AC_SUBST(SHLIB_LDFLAGS) AC_SUBST(SHLIB_LDFLAGS)
AC_SUBST(LDCC)
AC_SUBST(LIBS) AC_SUBST(LIBS)
AC_PROG_CC AC_PROG_CC

View File

@@ -71,7 +71,7 @@ typedef unsigned long long libssh2_uint64_t;
typedef long long libssh2_int64_t; typedef long long libssh2_int64_t;
#endif #endif
#define LIBSSH2_VERSION "0.12" #define LIBSSH2_VERSION "0.13"
#define LIBSSH2_APINO 200507211326 #define LIBSSH2_APINO 200507211326
/* Part of every banner, user specified or not */ /* Part of every banner, user specified or not */

View File

@@ -53,6 +53,10 @@
#include <openssl/md5.h> #include <openssl/md5.h>
#endif #endif
#ifdef __hpux
# define inline
#endif
#define LIBSSH2_ALLOC(session, count) session->alloc((count), &(session)->abstract) #define LIBSSH2_ALLOC(session, count) session->alloc((count), &(session)->abstract)
#define LIBSSH2_REALLOC(session, ptr, count) ((ptr) ? session->realloc((ptr), (count), &(session)->abstract) : session->alloc((count), &(session)->abstract)) #define LIBSSH2_REALLOC(session, ptr, count) ((ptr) ? session->realloc((ptr), (count), &(session)->abstract) : session->alloc((count), &(session)->abstract))
#define LIBSSH2_FREE(session, ptr) session->free((ptr), &(session)->abstract) #define LIBSSH2_FREE(session, ptr) session->free((ptr), &(session)->abstract)

View File

@@ -7,8 +7,10 @@ libdir = @exec_prefix@/lib
incldir = @prefix@/include incldir = @prefix@/include
CC = @CC@ CC = @CC@
LDCC = @LDCC@
CFLAGS = -c @CFLAGS@ -Wall -g -I../include/ -fPIC CFLAGS = -c @CFLAGS@ -Wall -g -I../include/ -fPIC
LDFLAGS = @LDFLAGS@ LDFLAGS = @LDFLAGS@
SHLIB_LDFLAGS = @SHLIB_LDFLAGS@
LIBS = @LIBS@ LIBS = @LIBS@
INSTALL = @INSTALL@ INSTALL = @INSTALL@
@@ -54,7 +56,7 @@ userauth.o: userauth.c
all: libssh2.@SHLIB_SUFFIX_NAME@ all: libssh2.@SHLIB_SUFFIX_NAME@
libssh2.@SHLIB_SUFFIX_NAME@: $(OBJECTS) libssh2.@SHLIB_SUFFIX_NAME@: $(OBJECTS)
$(CC) -o libssh2.@SHLIB_SUFFIX_NAME@ $(SHLIB_LDFLAGS) $(OBJECTS) $(LIBS) $(LDFLAGS) @SHLIB_LDFLAGS@ $(LDCC) -o libssh2.@SHLIB_SUFFIX_NAME@ $(SHLIB_LDFLAGS) $(OBJECTS) $(LIBS) $(LDFLAGS)
libssh2.a: $(OBJECTS) libssh2.a: $(OBJECTS)
rm -f libssh2.a rm -f libssh2.a
ar q libssh2.a $(OBJECTS) ar q libssh2.a $(OBJECTS)

View File

@@ -1104,6 +1104,7 @@ LIBSSH2_API int libssh2_channel_close(LIBSSH2_CHANNEL *channel)
if (channel->close_cb) { if (channel->close_cb) {
LIBSSH2_CHANNEL_CLOSE(session, channel); LIBSSH2_CHANNEL_CLOSE(session, channel);
} }
channel->local.close = 1;
packet[0] = SSH_MSG_CHANNEL_CLOSE; packet[0] = SSH_MSG_CHANNEL_CLOSE;
libssh2_htonu32(packet + 1, channel->remote.id); libssh2_htonu32(packet + 1, channel->remote.id);
@@ -1111,7 +1112,6 @@ LIBSSH2_API int libssh2_channel_close(LIBSSH2_CHANNEL *channel)
libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND, "Unable to send close-channel request", 0); libssh2_error(session, LIBSSH2_ERROR_SOCKET_SEND, "Unable to send close-channel request", 0);
return -1; return -1;
} }
channel->local.close = 1;
/* TODO: Wait up to a timeout value for a CHANNEL_CLOSE to come back, to avoid the problem alluded to in channel_nextid */ /* TODO: Wait up to a timeout value for a CHANNEL_CLOSE to come back, to avoid the problem alluded to in channel_nextid */

View File

@@ -893,6 +893,10 @@ int libssh2_packet_read(LIBSSH2_SESSION *session, int should_block)
payload_len = packet_length - padding_length - 1; /* padding_length(1) */ payload_len = packet_length - padding_length - 1; /* padding_length(1) */
payload = LIBSSH2_ALLOC(session, payload_len); payload = LIBSSH2_ALLOC(session, payload_len);
if (!payload) {
libssh2_error(session, LIBSSH2_ERROR_ALLOC, "Unable to allocate memory for copy of plaintext data", 0);
return -1;
}
if (libssh2_blocking_read(session, payload, payload_len) < payload_len) { if (libssh2_blocking_read(session, payload, payload_len) < payload_len) {
return (session->socket_state == LIBSSH2_SOCKET_DISCONNECTED) ? 0 : -1; return (session->socket_state == LIBSSH2_SOCKET_DISCONNECTED) ? 0 : -1;
@@ -936,7 +940,7 @@ int libssh2_packet_ask_ex(LIBSSH2_SESSION *session, unsigned char packet_type, u
while (packet) { while (packet) {
if (packet->data[0] == packet_type && if (packet->data[0] == packet_type &&
(packet->data_len >= (match_ofs + match_len)) && (packet->data_len >= (match_ofs + match_len)) &&
(!match_buf || (strncmp(packet->data + match_ofs, match_buf, match_len) == 0))) { (!match_buf || (memcmp(packet->data + match_ofs, match_buf, match_len) == 0))) {
*data = packet->data; *data = packet->data;
*data_len = packet->data_len; *data_len = packet->data_len;

View File

@@ -1452,10 +1452,11 @@ LIBSSH2_API int libssh2_sftp_symlink_ex(LIBSSH2_SFTP *sftp, const char *path, in
} }
link_len = libssh2_ntohu32(data + 9); link_len = libssh2_ntohu32(data + 9);
if (link_len > target_len) { if (link_len >= target_len) {
link_len = target_len; link_len = target_len - 1;
} }
memcpy(target, data + 13, link_len); memcpy(target, data + 13, link_len);
target[link_len] = 0;
LIBSSH2_FREE(session, data); LIBSSH2_FREE(session, data);
return link_len; return link_len;