- I made the SMTP code expect a 250 response back from the server after the
full DATA has been sent, and I modified the test SMTP server to also send that response. As usual, the DONE operation that is made after a completed transfer is still not doable in a non-blocking way so this waiting for 250 is unfortunately made blockingly.
This commit is contained in:
7
CHANGES
7
CHANGES
@@ -6,6 +6,13 @@
|
|||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
Daniel Stenberg (20 Feb 2010)
|
||||||
|
- I made the SMTP code expect a 250 response back from the server after the
|
||||||
|
full DATA has been sent, and I modified the test SMTP server to also send
|
||||||
|
that response. As usual, the DONE operation that is made after a completed
|
||||||
|
transfer is still not doable in a non-blocking way so this waiting for 250
|
||||||
|
is unfortunately made blockingly.
|
||||||
|
|
||||||
Yang Tse (14 Feb 2010)
|
Yang Tse (14 Feb 2010)
|
||||||
- Overhauled test suite getpart() function. Fixing potential out of bounds
|
- Overhauled test suite getpart() function. Fixing potential out of bounds
|
||||||
stack and memory overwrites triggered with huge test case definitions.
|
stack and memory overwrites triggered with huge test case definitions.
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ This release includes the following bugfixes:
|
|||||||
o multiple recepients with SMTP
|
o multiple recepients with SMTP
|
||||||
o fixed the CURL_FORMAT_* defines when building with cmake
|
o fixed the CURL_FORMAT_* defines when building with cmake
|
||||||
o missing quote in libcurl.m4
|
o missing quote in libcurl.m4
|
||||||
|
o SMTP: now waits for 250 after the DATA transfer
|
||||||
|
|
||||||
This release includes the following known bugs:
|
This release includes the following known bugs:
|
||||||
|
|
||||||
|
|||||||
37
lib/smtp.c
37
lib/smtp.c
@@ -232,6 +232,7 @@ static void state(struct connectdata *conn,
|
|||||||
"MAIL",
|
"MAIL",
|
||||||
"RCPT",
|
"RCPT",
|
||||||
"DATA",
|
"DATA",
|
||||||
|
"POSTDATA",
|
||||||
"QUIT",
|
"QUIT",
|
||||||
/* LAST */
|
/* LAST */
|
||||||
};
|
};
|
||||||
@@ -424,6 +425,25 @@ static CURLcode smtp_state_data_resp(struct connectdata *conn,
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* for the POSTDATA response, which is received after the entire DATA
|
||||||
|
part has been sent off to the server */
|
||||||
|
static CURLcode smtp_state_postdata_resp(struct connectdata *conn,
|
||||||
|
int smtpcode,
|
||||||
|
smtpstate instate)
|
||||||
|
{
|
||||||
|
CURLcode result = CURLE_OK;
|
||||||
|
struct SessionHandle *data = conn->data;
|
||||||
|
struct FTP *smtp = data->state.proto.smtp;
|
||||||
|
|
||||||
|
(void)instate; /* no use for this yet */
|
||||||
|
|
||||||
|
if(smtpcode != 250)
|
||||||
|
result = CURLE_RECV_ERROR;
|
||||||
|
|
||||||
|
state(conn, SMTP_STOP);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static CURLcode smtp_statemach_act(struct connectdata *conn)
|
static CURLcode smtp_statemach_act(struct connectdata *conn)
|
||||||
{
|
{
|
||||||
CURLcode result;
|
CURLcode result;
|
||||||
@@ -484,6 +504,10 @@ static CURLcode smtp_statemach_act(struct connectdata *conn)
|
|||||||
result = smtp_state_data_resp(conn, smtpcode, smtpc->state);
|
result = smtp_state_data_resp(conn, smtpcode, smtpc->state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SMTP_POSTDATA:
|
||||||
|
result = smtp_state_postdata_resp(conn, smtpcode, smtpc->state);
|
||||||
|
break;
|
||||||
|
|
||||||
case SMTP_QUIT:
|
case SMTP_QUIT:
|
||||||
/* fallthrough, just stop! */
|
/* fallthrough, just stop! */
|
||||||
default:
|
default:
|
||||||
@@ -691,6 +715,19 @@ static CURLcode smtp_done(struct connectdata *conn, CURLcode status,
|
|||||||
SMTP_EOB_LEN, /* buffer size */
|
SMTP_EOB_LEN, /* buffer size */
|
||||||
&bytes_written); /* actually sent away */
|
&bytes_written); /* actually sent away */
|
||||||
|
|
||||||
|
|
||||||
|
if(status == CURLE_OK) {
|
||||||
|
state(conn, SMTP_POSTDATA);
|
||||||
|
/* run the state-machine
|
||||||
|
|
||||||
|
TODO: when the multi interface is used, this _really_ should be using
|
||||||
|
the smtp_multi_statemach function but we have no general support for
|
||||||
|
non-blocking DONE operations, not in the multi state machine and with
|
||||||
|
Curl_done() invokes on several places in the code!
|
||||||
|
*/
|
||||||
|
result = smtp_easy_statemach(conn);
|
||||||
|
}
|
||||||
|
|
||||||
/* clear these for next connection */
|
/* clear these for next connection */
|
||||||
smtp->transfer = FTPTRANSFER_BODY;
|
smtp->transfer = FTPTRANSFER_BODY;
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ typedef enum {
|
|||||||
SMTP_MAIL, /* MAIL FROM */
|
SMTP_MAIL, /* MAIL FROM */
|
||||||
SMTP_RCPT, /* RCPT TO */
|
SMTP_RCPT, /* RCPT TO */
|
||||||
SMTP_DATA,
|
SMTP_DATA,
|
||||||
|
SMTP_POSTDATA,
|
||||||
SMTP_QUIT,
|
SMTP_QUIT,
|
||||||
SMTP_LAST /* never used */
|
SMTP_LAST /* never used */
|
||||||
} smtpstate;
|
} smtpstate;
|
||||||
|
|||||||
@@ -545,6 +545,7 @@ sub DATA_smtp {
|
|||||||
print FILE "$ulsize bytes would've been stored here\n";
|
print FILE "$ulsize bytes would've been stored here\n";
|
||||||
}
|
}
|
||||||
close(FILE);
|
close(FILE);
|
||||||
|
sendcontrol "250 OK, data received!\r\n";
|
||||||
logmsg "received $ulsize bytes upload\n";
|
logmsg "received $ulsize bytes upload\n";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user