Compare commits
5 Commits
start
...
RELEASE.0.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
013f64698c | ||
![]() |
54290ae77d | ||
![]() |
433a94606a | ||
![]() |
82e9e2ba0f | ||
![]() |
2f41af6cdf |
9
INSTALL
Normal file
9
INSTALL
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
Installing libssh2
|
||||||
|
==================
|
||||||
|
|
||||||
|
* Untar this tarball (which, if you're reading this, you've already done)
|
||||||
|
|
||||||
|
* Run: ./configure (passing additional options as desired)
|
||||||
|
|
||||||
|
* Run: make all install
|
||||||
|
|
@@ -10,7 +10,7 @@ CC = @CC@
|
|||||||
CFLAGS = -c @CFLAGS@ -Iinclude/ -Wall -g
|
CFLAGS = -c @CFLAGS@ -Iinclude/ -Wall -g
|
||||||
LIBS = -lssh2 -Lsrc/
|
LIBS = -lssh2 -Lsrc/
|
||||||
INSTALL = @INSTALL@
|
INSTALL = @INSTALL@
|
||||||
VERSION=0.1-dev
|
VERSION=0.1
|
||||||
DISTLIB=libssh2-$(VERSION)
|
DISTLIB=libssh2-$(VERSION)
|
||||||
|
|
||||||
all:
|
all:
|
||||||
@@ -40,8 +40,8 @@ dist:
|
|||||||
rm -f $(DISTLIB)
|
rm -f $(DISTLIB)
|
||||||
ln -s . $(DISTLIB)
|
ln -s . $(DISTLIB)
|
||||||
tar -zcf $(DISTLIB).tar.gz \
|
tar -zcf $(DISTLIB).tar.gz \
|
||||||
$(DISTLIB)/configure.in $(DISTLIB)/configure $(DISTLIB)/Makefile.in $(DISTLIB)/ssh2_sample.c \
|
$(DISTLIB)/configure $(DISTLIB)/Makefile.in $(DISTLIB)/ssh2_sample.c \
|
||||||
$(DISTLIB)/LICENSE $(DISTLIB)/README $(DISTLIB)/TODO \
|
$(DISTLIB)/LICENSE $(DISTLIB)/README $(DISTLIB)/TODO $(DISTLIB)/INSTALL \
|
||||||
$(DISTLIB)/mkinstalldirs $(DISTLIB)/install-sh \
|
$(DISTLIB)/mkinstalldirs $(DISTLIB)/install-sh \
|
||||||
$(DISTLIB)/src/*.c $(DISTLIB)/src/Makefile.in \
|
$(DISTLIB)/src/*.c $(DISTLIB)/src/Makefile.in \
|
||||||
$(DISTLIB)/include/libssh2.h $(DISTLIB)/include/libssh2_priv.h $(DISTLIB)/include/libssh2_config.h.in
|
$(DISTLIB)/include/libssh2.h $(DISTLIB)/include/libssh2_priv.h $(DISTLIB)/include/libssh2_config.h.in
|
||||||
|
@@ -42,7 +42,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
#define LIBSSH2_VERSION "0.1dev"
|
#define LIBSSH2_VERSION "0.1"
|
||||||
|
|
||||||
/* Part of every banner, user specified or not */
|
/* Part of every banner, user specified or not */
|
||||||
#define LIBSSH2_SSH_BANNER "SSH-2.0-libssh2_" LIBSSH2_VERSION
|
#define LIBSSH2_SSH_BANNER "SSH-2.0-libssh2_" LIBSSH2_VERSION
|
||||||
@@ -202,6 +202,7 @@ LIBSSH2_API int libssh2_channel_write_ex(LIBSSH2_CHANNEL *channel, int stream_id
|
|||||||
#define libssh2_channel_write_stderr(channel, buf, buflen) libssh2_channel_write_ex((channel), SSH_EXTENDED_DATA_STDERR, (buf), (buflen))
|
#define libssh2_channel_write_stderr(channel, buf, buflen) libssh2_channel_write_ex((channel), SSH_EXTENDED_DATA_STDERR, (buf), (buflen))
|
||||||
|
|
||||||
LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel, int blocking);
|
LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel, int blocking);
|
||||||
|
LIBSSH2_API void libssh2_channel_ignore_extended_data(LIBSSH2_CHANNEL *channel, int ignore);
|
||||||
|
|
||||||
LIBSSH2_API int libssh2_channel_send_eof(LIBSSH2_CHANNEL *channel);
|
LIBSSH2_API int libssh2_channel_send_eof(LIBSSH2_CHANNEL *channel);
|
||||||
LIBSSH2_API int libssh2_channel_eof(LIBSSH2_CHANNEL *channel);
|
LIBSSH2_API int libssh2_channel_eof(LIBSSH2_CHANNEL *channel);
|
||||||
|
@@ -98,7 +98,7 @@ typedef struct _libssh2_channel_data {
|
|||||||
unsigned long window_size_initial, window_size, packet_size;
|
unsigned long window_size_initial, window_size, packet_size;
|
||||||
|
|
||||||
/* Set to 1 when CHANNEL_CLOSE / CHANNEL_EOF sent/received */
|
/* Set to 1 when CHANNEL_CLOSE / CHANNEL_EOF sent/received */
|
||||||
int close, eof;
|
char close, eof, ignore_extended_data;
|
||||||
} libssh2_channel_data;
|
} libssh2_channel_data;
|
||||||
|
|
||||||
struct _LIBSSH2_CHANNEL {
|
struct _LIBSSH2_CHANNEL {
|
||||||
|
@@ -4,7 +4,7 @@
|
|||||||
# Created: 1993-05-16
|
# Created: 1993-05-16
|
||||||
# Public domain
|
# Public domain
|
||||||
|
|
||||||
# $Id: mkinstalldirs,v 1.1.1.1 2004/12/07 21:17:20 sarag Exp $
|
# $Id: mkinstalldirs,v 1.1 2004/12/07 21:17:20 sarag Exp $
|
||||||
|
|
||||||
errstatus=0
|
errstatus=0
|
||||||
|
|
||||||
|
@@ -337,6 +337,7 @@ LIBSSH2_API int libssh2_channel_request_pty_ex(LIBSSH2_CHANNEL *channel, char *t
|
|||||||
LIBSSH2_FREE(session, packet);
|
LIBSSH2_FREE(session, packet);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
LIBSSH2_FREE(session, packet);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
@@ -433,6 +434,56 @@ LIBSSH2_API void libssh2_channel_set_blocking(LIBSSH2_CHANNEL *channel, int bloc
|
|||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
/* {{{ libssh2_channel_ignore_extended_data
|
||||||
|
* Ignore (or stop ignoring) extended data
|
||||||
|
*/
|
||||||
|
LIBSSH2_API void libssh2_channel_ignore_extended_data(LIBSSH2_CHANNEL *channel, int ignore)
|
||||||
|
{
|
||||||
|
channel->remote.ignore_extended_data = ignore;
|
||||||
|
|
||||||
|
if (ignore) {
|
||||||
|
/* Flush queued extended data */
|
||||||
|
LIBSSH2_PACKET *packet = channel->session->packets.head;
|
||||||
|
unsigned long refund_bytes = 0;
|
||||||
|
|
||||||
|
while (packet) {
|
||||||
|
LIBSSH2_PACKET *next = packet->next;
|
||||||
|
|
||||||
|
if ((packet->data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA) && (libssh2_ntohu32(packet->data + 1) == channel->local.id)) {
|
||||||
|
refund_bytes += packet->data_len - 13;
|
||||||
|
LIBSSH2_FREE(channel->session, packet->data);
|
||||||
|
if (packet->prev) {
|
||||||
|
packet->prev->next = packet->next;
|
||||||
|
} else {
|
||||||
|
channel->session->packets.head = packet->next;
|
||||||
|
}
|
||||||
|
if (packet->next) {
|
||||||
|
packet->next->prev = packet->prev;
|
||||||
|
} else {
|
||||||
|
channel->session->packets.tail = packet->prev;
|
||||||
|
}
|
||||||
|
LIBSSH2_FREE(channel->session, packet);
|
||||||
|
}
|
||||||
|
packet = next;
|
||||||
|
}
|
||||||
|
if (refund_bytes && channel->remote.window_size_initial) {
|
||||||
|
unsigned char adjust[9]; /* packet_type(1) + channel(4) + adjustment(4) */
|
||||||
|
|
||||||
|
/* Adjust the window based on the block we just freed */
|
||||||
|
adjust[0] = SSH_MSG_CHANNEL_WINDOW_ADJUST;
|
||||||
|
libssh2_htonu32(adjust + 1, channel->remote.id);
|
||||||
|
libssh2_htonu32(adjust + 5, refund_bytes);
|
||||||
|
|
||||||
|
if (libssh2_packet_write(channel->session, adjust, 9)) {
|
||||||
|
libssh2_error(channel->session, LIBSSH2_ERROR_SOCKET_SEND, "Unable to send transfer-window adjustment packet", 0);
|
||||||
|
} else {
|
||||||
|
channel->remote.window_size += refund_bytes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ libssh2_channel_read_ex
|
/* {{{ libssh2_channel_read_ex
|
||||||
* Read data from a channel
|
* Read data from a channel
|
||||||
*/
|
*/
|
||||||
@@ -480,6 +531,7 @@ LIBSSH2_API int libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel, int stream_id,
|
|||||||
}
|
}
|
||||||
LIBSSH2_FREE(session, packet->data);
|
LIBSSH2_FREE(session, packet->data);
|
||||||
|
|
||||||
|
if (channel->remote.window_size_initial) {
|
||||||
/* Adjust the window based on the block we just freed */
|
/* Adjust the window based on the block we just freed */
|
||||||
adjust[0] = SSH_MSG_CHANNEL_WINDOW_ADJUST;
|
adjust[0] = SSH_MSG_CHANNEL_WINDOW_ADJUST;
|
||||||
libssh2_htonu32(adjust + 1, channel->remote.id);
|
libssh2_htonu32(adjust + 1, channel->remote.id);
|
||||||
@@ -492,6 +544,7 @@ LIBSSH2_API int libssh2_channel_read_ex(LIBSSH2_CHANNEL *channel, int stream_id,
|
|||||||
LIBSSH2_FREE(session, packet);
|
LIBSSH2_FREE(session, packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
packet = next;
|
packet = next;
|
||||||
}
|
}
|
||||||
blocking_read = 1;
|
blocking_read = 1;
|
||||||
@@ -663,6 +716,11 @@ LIBSSH2_API int libssh2_channel_free(LIBSSH2_CHANNEL *channel)
|
|||||||
LIBSSH2_FREE(session, data);
|
LIBSSH2_FREE(session, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* free "channel_type" */
|
||||||
|
if (channel->channel_type) {
|
||||||
|
LIBSSH2_FREE(session, channel->channel_type);
|
||||||
|
}
|
||||||
|
|
||||||
/* Unlink from channel brigade */
|
/* Unlink from channel brigade */
|
||||||
if (channel->prev) {
|
if (channel->prev) {
|
||||||
channel->prev->next = channel->next;
|
channel->prev->next = channel->next;
|
||||||
|
18
src/packet.c
18
src/packet.c
@@ -153,6 +153,24 @@ static int libssh2_packet_add(LIBSSH2_SESSION *session, unsigned char *data, siz
|
|||||||
LIBSSH2_FREE(session, data);
|
LIBSSH2_FREE(session, data);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if (channel->remote.ignore_extended_data && (data[0] == SSH_MSG_CHANNEL_EXTENDED_DATA)) {
|
||||||
|
/* Pretend we didn't receive this */
|
||||||
|
LIBSSH2_FREE(session, data);
|
||||||
|
|
||||||
|
if (channel->remote.window_size_initial) {
|
||||||
|
/* Adjust the window based on the block we just freed */
|
||||||
|
unsigned char adjust[9];
|
||||||
|
|
||||||
|
adjust[0] = SSH_MSG_CHANNEL_WINDOW_ADJUST;
|
||||||
|
libssh2_htonu32(adjust + 1, channel->remote.id);
|
||||||
|
libssh2_htonu32(adjust + 5, datalen - 13);
|
||||||
|
|
||||||
|
if (libssh2_packet_write(channel->session, adjust, 9)) {
|
||||||
|
libssh2_error(channel->session, LIBSSH2_ERROR_SOCKET_SEND, "Unable to send transfer-window adjustment packet", 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* REMEMBER! remote means remote as source of data, NOT remote window! */
|
/* REMEMBER! remote means remote as source of data, NOT remote window! */
|
||||||
if (channel->remote.packet_size < (datalen - data_head)) {
|
if (channel->remote.packet_size < (datalen - data_head)) {
|
||||||
|
Reference in New Issue
Block a user