Skip to content
Snippets Groups Projects
Commit b1217873 authored by Matt Johnston's avatar Matt Johnston
Browse files

propagate from branch 'au.asn.ucc.matt.dropbear' (head 3d683afab1940779612505721e67bd9c98df057e)

            to branch 'au.asn.ucc.matt.dropbear.channel-fix' (head dec459c955c306f9ecddc3b4e04a963f3f264a0f)

--HG--
branch : channel-fix
extra : convert_revision : f5014cc84558f1e8eba42dbecf9f72f94bfe6134
parents e9bc9e6b 0f707bad
No related merge requests found
...@@ -73,10 +73,9 @@ struct Channel { ...@@ -73,10 +73,9 @@ struct Channel {
circbuffer *extrabuf; /* extended-data for the program - used like writebuf circbuffer *extrabuf; /* extended-data for the program - used like writebuf
but for stderr */ but for stderr */
int sentclosed, recvclosed; /* whether close/eof messages have been exchanged */
int sent_close, recv_close;
/* this is set when we receive/send a channel eof packet */ int recv_eof, sent_eof;
int recveof, senteof;
int initconn; /* used for TCP forwarding, whether the channel has been int initconn; /* used for TCP forwarding, whether the channel has been
fully initialised */ fully initialised */
...@@ -94,7 +93,7 @@ struct ChanType { ...@@ -94,7 +93,7 @@ struct ChanType {
int sepfds; /* Whether this channel has seperate pipes for in/out or not */ int sepfds; /* Whether this channel has seperate pipes for in/out or not */
char *name; char *name;
int (*inithandler)(struct Channel*); int (*inithandler)(struct Channel*);
int (*checkclose)(struct Channel*); int (*check_close)(struct Channel*);
void (*reqhandler)(struct Channel*); void (*reqhandler)(struct Channel*);
void (*closehandler)(struct Channel*); void (*closehandler)(struct Channel*);
......
...@@ -39,9 +39,6 @@ void recv_msg_channel_extended_data() { ...@@ -39,9 +39,6 @@ void recv_msg_channel_extended_data() {
TRACE(("enter recv_msg_channel_extended_data")) TRACE(("enter recv_msg_channel_extended_data"))
channel = getchannel(); channel = getchannel();
if (channel == NULL) {
dropbear_exit("Unknown channel");
}
if (channel->type != &clichansess) { if (channel->type != &clichansess) {
TRACE(("leave recv_msg_channel_extended_data: chantype is wrong")) TRACE(("leave recv_msg_channel_extended_data: chantype is wrong"))
......
This diff is collapsed.
...@@ -143,27 +143,21 @@ void session_loop(void(*loophandler)()) { ...@@ -143,27 +143,21 @@ void session_loop(void(*loophandler)()) {
dropbear_exit("Terminated by signal"); dropbear_exit("Terminated by signal");
} }
if (val < 0) { if (val < 0 && errno != EINTR) {
if (errno == EINTR) { dropbear_exit("Error in select");
/* This must happen even if we've been interrupted, so that }
* changed signal-handler vars can take effect etc */
if (loophandler) { if (val <= 0) {
loophandler(); /* If we were interrupted or the select timed out, we still
} * want to iterate over channels etc for reading, to handle
continue; * server processes exiting etc.
} else { * We don't want to read/write FDs. */
dropbear_exit("Error in select"); FD_ZERO(&writefd);
} FD_ZERO(&readfd);
} }
/* check for auth timeout, rekeying required etc */ /* check for auth timeout, rekeying required etc */
checktimeouts(); checktimeouts();
if (val == 0) {
/* timeout */
TRACE(("select timeout"))
continue;
}
/* process session socket's incoming/outgoing data */ /* process session socket's incoming/outgoing data */
if (ses.sock != -1) { if (ses.sock != -1) {
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
* Caution: Don't use this in an unfriendly environment (ie unfirewalled), * Caution: Don't use this in an unfriendly environment (ie unfirewalled),
* since the printing may not sanitise strings etc. This will add a reasonable * since the printing may not sanitise strings etc. This will add a reasonable
* amount to your executable size. */ * amount to your executable size. */
/*#define DEBUG_TRACE */ #define DEBUG_TRACE
/* All functions writing to the cleartext payload buffer call /* All functions writing to the cleartext payload buffer call
* CHECKCLEARTOWRITE() before writing. This is only really useful if you're * CHECKCLEARTOWRITE() before writing. This is only really useful if you're
......
...@@ -59,7 +59,6 @@ static void send_msg_chansess_exitstatus(struct Channel * channel, ...@@ -59,7 +59,6 @@ static void send_msg_chansess_exitstatus(struct Channel * channel,
struct ChanSess * chansess); struct ChanSess * chansess);
static void send_msg_chansess_exitsignal(struct Channel * channel, static void send_msg_chansess_exitsignal(struct Channel * channel,
struct ChanSess * chansess); struct ChanSess * chansess);
static int sesscheckclose(struct Channel *channel);
static void get_termmodes(struct ChanSess *chansess); static void get_termmodes(struct ChanSess *chansess);
...@@ -68,7 +67,7 @@ extern char** environ; ...@@ -68,7 +67,7 @@ extern char** environ;
static int sesscheckclose(struct Channel *channel) { static int sesscheckclose(struct Channel *channel) {
struct ChanSess *chansess = (struct ChanSess*)channel->typedata; struct ChanSess *chansess = (struct ChanSess*)channel->typedata;
return chansess->exit.exitpid >= 0; return chansess->exit.exitpid != -1;
} }
/* Handler for childs exiting, store the state for return to the client */ /* Handler for childs exiting, store the state for return to the client */
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment