Fix TELNET transfers not being aborted upon write callback failures
This commit is contained in:
parent
d15b8273d6
commit
fa96436661
6
CHANGES
6
CHANGES
@ -6,6 +6,12 @@
|
|||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
Yang Tse (12 Mar 2009)
|
||||||
|
- Added missing Curl_read() return code checking in TELNET transfers.
|
||||||
|
|
||||||
|
- Pierre Brico found and fixed TELNET transfers not being aborted upon
|
||||||
|
a write callback failure.
|
||||||
|
|
||||||
Daniel Stenberg (11 Mar 2009)
|
Daniel Stenberg (11 Mar 2009)
|
||||||
- Kamil Dudka made the curl tool properly call curl_global_init() before any
|
- Kamil Dudka made the curl tool properly call curl_global_init() before any
|
||||||
other libcurl function.
|
other libcurl function.
|
||||||
|
@ -19,6 +19,7 @@ This release includes the following bugfixes:
|
|||||||
o an alloc-related call in the OpenSSL-using code didn't check the return value
|
o an alloc-related call in the OpenSSL-using code didn't check the return value
|
||||||
o curl_easy_duphandle() failed to duplicate cookies at times
|
o curl_easy_duphandle() failed to duplicate cookies at times
|
||||||
o missing TELNET timeout support in Windows builds
|
o missing TELNET timeout support in Windows builds
|
||||||
|
o missing Curl_read() and write callback result checking in TELNET transfers
|
||||||
|
|
||||||
This release includes the following known bugs:
|
This release includes the following known bugs:
|
||||||
|
|
||||||
|
28
lib/telnet.c
28
lib/telnet.c
@ -108,7 +108,7 @@ static CURLcode check_wsock2 ( struct SessionHandle *data );
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static
|
static
|
||||||
void telrcv(struct connectdata *,
|
CURLcode telrcv(struct connectdata *,
|
||||||
const unsigned char *inbuf, /* Data received from socket */
|
const unsigned char *inbuf, /* Data received from socket */
|
||||||
ssize_t count); /* Number of bytes received */
|
ssize_t count); /* Number of bytes received */
|
||||||
|
|
||||||
@ -952,19 +952,26 @@ static void suboption(struct connectdata *conn)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void telrcv(struct connectdata *conn,
|
CURLcode telrcv(struct connectdata *conn,
|
||||||
const unsigned char *inbuf, /* Data received from socket */
|
const unsigned char *inbuf, /* Data received from socket */
|
||||||
ssize_t count) /* Number of bytes received */
|
ssize_t count) /* Number of bytes received */
|
||||||
{
|
{
|
||||||
unsigned char c;
|
unsigned char c;
|
||||||
|
CURLcode result;
|
||||||
int in = 0;
|
int in = 0;
|
||||||
int startwrite=-1;
|
int startwrite=-1;
|
||||||
struct SessionHandle *data = conn->data;
|
struct SessionHandle *data = conn->data;
|
||||||
struct TELNET *tn = (struct TELNET *)data->state.proto.telnet;
|
struct TELNET *tn = (struct TELNET *)data->state.proto.telnet;
|
||||||
|
|
||||||
#define startskipping() \
|
#define startskipping() \
|
||||||
if(startwrite >= 0) \
|
if(startwrite >= 0) { \
|
||||||
Curl_client_write(conn, CLIENTWRITE_BODY, (char *)&inbuf[startwrite], in-startwrite); \
|
result = Curl_client_write(conn, \
|
||||||
|
CLIENTWRITE_BODY, \
|
||||||
|
(char *)&inbuf[startwrite], \
|
||||||
|
in-startwrite); \
|
||||||
|
if(result != CURLE_OK) \
|
||||||
|
return result; \
|
||||||
|
} \
|
||||||
startwrite = -1
|
startwrite = -1
|
||||||
|
|
||||||
#define writebyte() \
|
#define writebyte() \
|
||||||
@ -1119,6 +1126,7 @@ void telrcv(struct connectdata *conn,
|
|||||||
++in;
|
++in;
|
||||||
}
|
}
|
||||||
bufferflush();
|
bufferflush();
|
||||||
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Escape and send a telnet data block */
|
/* Escape and send a telnet data block */
|
||||||
@ -1389,7 +1397,11 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
telrcv(conn, (unsigned char *)buf, nread);
|
code = telrcv(conn, (unsigned char *)buf, nread);
|
||||||
|
if(code) {
|
||||||
|
keepon = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
@ -1475,7 +1487,11 @@ static CURLcode telnet_do(struct connectdata *conn, bool *done)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
telrcv(conn, (unsigned char *)buf, nread);
|
code = telrcv(conn, (unsigned char *)buf, nread);
|
||||||
|
if(code) {
|
||||||
|
keepon = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Negotiate if the peer has started negotiating,
|
/* Negotiate if the peer has started negotiating,
|
||||||
otherwise don't. We don't want to speak telnet with
|
otherwise don't. We don't want to speak telnet with
|
||||||
|
Loading…
x
Reference in New Issue
Block a user