aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac4
-rw-r--r--libssh/channels1.c8
-rw-r--r--libssh/connect.c22
-rw-r--r--libssh/session.c10
-rw-r--r--libssh/socket.c6
5 files changed, 19 insertions, 31 deletions
diff --git a/configure.ac b/configure.ac
index 2ec3845c..1d0f2b88 100644
--- a/configure.ac
+++ b/configure.ac
@@ -13,8 +13,8 @@ AM_MAINTAINER_MODE
# (Interfaces removed: CURRENT++, AGE=0, REVISION=0)
# (Interfaces added: CURRENT++, AGE++, REVISION=0)
# (No interfaces changed: REVISION++)
-LIBSSH_CURRENT=2
-LIBSSH_AGE=0
+LIBSSH_CURRENT=3
+LIBSSH_AGE=1
LIBSSH_REVISION=0
AC_SUBST(LIBSSH_CURRENT)
AC_SUBST(LIBSSH_AGE)
diff --git a/libssh/channels1.c b/libssh/channels1.c
index d90d2398..d7affa58 100644
--- a/libssh/channels1.c
+++ b/libssh/channels1.c
@@ -62,7 +62,7 @@ int channel_open_session1(CHANNEL *chan){
* much simplier under ssh2. I just hope the defaults values are ok ...
*/
-int channel_request_pty_size1(CHANNEL *channel, char *terminal, int col,
+int channel_request_pty_size1(CHANNEL *channel, char *terminal, int col,
int row){
STRING *str;
SSH_SESSION *session=channel->session;
@@ -163,13 +163,13 @@ static void channel_rcv_data1(SSH_SESSION *session, int is_stderr){
channel_default_bufferize(channel,str->string,string_len(str),
is_stderr);
free(str);
-}
+}
static void channel_rcv_close1(SSH_SESSION *session){
CHANNEL *channel=session->channels;
u32 status;
buffer_get_u32(session->in_buffer,&status);
- /* it's much more than a channel closing. spec says it's the last
+ /* it's much more than a channel closing. spec says it's the last
* message sent by server (strange)
*/
/* actually status is lost somewhere */
@@ -190,7 +190,7 @@ void channel_handle1(SSH_SESSION *session, int type){
break;
default:
ssh_say(0,"Unexepected message %d\n",type);
-
+
}
}
diff --git a/libssh/connect.c b/libssh/connect.c
index 9f444787..c96200d2 100644
--- a/libssh/connect.c
+++ b/libssh/connect.c
@@ -77,7 +77,7 @@ static int getai(const char *host, int port, struct addrinfo **ai)
struct addrinfo hints;
char *service=NULL;
char s_port[10];
-
+
memset(&hints,0,sizeof(hints));
hints.ai_protocol=IPPROTO_TCP;
hints.ai_family=PF_UNSPEC;
@@ -140,7 +140,7 @@ int ssh_connect_ai_timeout(SSH_SESSION *session, const char *host, int port, str
/* specified by its IP address or hostname. */
/* output is the file descriptor, <0 if failed. */
-socket_t ssh_connect_host(SSH_SESSION *session, const char *host, const char
+socket_t ssh_connect_host(SSH_SESSION *session, const char *host, const char
*bind_addr, int port,long timeout, long usec){
socket_t s=-1;
int my_errno;
@@ -152,7 +152,7 @@ socket_t ssh_connect_host(SSH_SESSION *session, const char *host, const char
leave_function();
return -1;
}
-
+
for(ai2=ai;ai2!=NULL;ai2=ai2->ai_next){
/* create socket */
s=socket(ai2->ai_family,ai2->ai_socktype,ai2->ai_protocol);
@@ -176,7 +176,7 @@ socket_t ssh_connect_host(SSH_SESSION *session, const char *host, const char
if(bind(s,bind_ai2->ai_addr,bind_ai2->ai_addrlen)<0){
ssh_set_error(session,SSH_FATAL,"Binding local address : %s",strerror(errno));
continue;
- }
+ }
else{
break;
}
@@ -212,18 +212,6 @@ socket_t ssh_connect_host(SSH_SESSION *session, const char *host, const char
/** \addtogroup ssh_session
* * @{ */
-/** \internal
- * \brief polls the stream for activity
- * \param session ssh session
- * \param write value pointed to set to 1 if it is possible to write
- * \param except value pointed to set to 1 if there is an exception
- * \return 1 if it is possible to read, 0 otherwise, -1 on error
- */
-int ssh_fd_poll(SSH_SESSION *session, int *write, int *except){
- return ssh_socket_poll(session->socket,write,except);
-}
-
-
/** This functions acts more or less like the select(2) syscall.\n
* There is no support for writing or exceptions.\n
* \brief wrapper for the select syscall
@@ -300,7 +288,7 @@ int ssh_select(CHANNEL **channels,CHANNEL **outchannels, socket_t maxfd, fd_set
for(i=0;channels[i];i++)
if(channels[i]->session->alive && ssh_socket_fd_isset(channels[i]->session->socket,&localset))
ssh_socket_set_toread(channels[i]->session->socket);
-
+
/* now, test each channel */
j=0;
for(i=0;channels[i];i++){
diff --git a/libssh/session.c b/libssh/session.c
index 264855b7..dc485ec8 100644
--- a/libssh/session.c
+++ b/libssh/session.c
@@ -92,7 +92,7 @@ void ssh_cleanup(SSH_SESSION *session){
ssh_message_free(session->ssh_message);
free(session->ssh_message);
}
- memset(session,'X',sizeof(SSH_SESSION)); /* burn connection, it could hangs
+ memset(session,'X',sizeof(SSH_SESSION)); /* burn connection, it could hangs
sensitive datas */
free(session);
//leave_function();
@@ -129,8 +129,8 @@ void ssh_set_blocking(SSH_SESSION *session,int blocking){
session->blocking=blocking?1:0;
}
-/** In case you'd need the file descriptor of the connection
- * to the server/client
+/** In case you'd need the file descriptor of the connection
+ * to the server/client
* \brief recover the fd of connection
* \param session ssh session
* \return file descriptor of the connection, or -1 if it is
@@ -153,7 +153,7 @@ void ssh_set_fd_toread(SSH_SESSION *session){
*/
void ssh_set_fd_towrite(SSH_SESSION *session){
ssh_socket_set_towrite(session->socket);
-
+
}
/** \brief say the session it has an exception to catch on the file descriptor
@@ -170,7 +170,7 @@ int ssh_handle_packets(SSH_SESSION *session){
int w,err,r,i=0;
enter_function();
do {
- r=ssh_fd_poll(session,&w,&err);
+ r=ssh_socket_poll(session->socket,&w,&err);
if(r<=0){
leave_function();
return r; // error or no data available
diff --git a/libssh/socket.c b/libssh/socket.c
index a80d10c5..6765b36b 100644
--- a/libssh/socket.c
+++ b/libssh/socket.c
@@ -414,7 +414,7 @@ int ssh_socket_poll(struct socket *s, int *write, int *except){
*except=s->data_except;
*write=s->data_to_write;
leave_function();
- return s->data_to_read;
+ return s->data_to_read || (buffer_get_rest_len(s->in_buffer)>0);
}
#endif
@@ -454,7 +454,7 @@ int ssh_socket_poll(struct socket *s, int *write, int *except){
*except=s->data_except;
*write=s->data_to_write;
leave_function();
- return s->data_to_read;
+ return s->data_to_read || (buffer_get_rest_len(s->in_buffer)>0);
}
#endif
@@ -491,7 +491,7 @@ int ssh_socket_nonblocking_flush(struct socket *s){
}
buffer_pass_bytes(s->out_buffer,w);
/* refresh the socket status */
- ssh_fd_poll(session,&can_write,&except);
+ ssh_socket_poll(session->socket,&can_write,&except);
}
if(buffer_get_rest_len(s->out_buffer)>0){
leave_function();