- Jack Zhang reported a problem with SMTP: we wrongly used multiple addresses
in the same RCPT TO line, when they should be sent in separate single commands. I updated test case 802 to verify this. - I also fixed a bad use of my_setopt_str() of CURLOPT_MAIL_RCPT in the curl tool which made it try to output it as string for the --libcurl feature which could lead to crashes.
This commit is contained in:
9
CHANGES
9
CHANGES
@@ -6,6 +6,15 @@
|
|||||||
|
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
|
Daniel Stenberg (12 Feb 2010)
|
||||||
|
- Jack Zhang reported a problem with SMTP: we wrongly used multiple addresses
|
||||||
|
in the same RCPT TO line, when they should be sent in separate single
|
||||||
|
commands. I updated test case 802 to verify this.
|
||||||
|
|
||||||
|
- I also fixed a bad use of my_setopt_str() of CURLOPT_MAIL_RCPT in the curl
|
||||||
|
tool which made it try to output it as string for the --libcurl feature
|
||||||
|
which could lead to crashes.
|
||||||
|
|
||||||
Yang Tse (11 Feb 2010)
|
Yang Tse (11 Feb 2010)
|
||||||
- Steven M. Schweda fixed VMS builder bad behavior when used in a batch job,
|
- Steven M. Schweda fixed VMS builder bad behavior when used in a batch job,
|
||||||
removed obsolete batch_compile.com and defines.com and updated VMS readme.
|
removed obsolete batch_compile.com and defines.com and updated VMS readme.
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ This release includes the following changes:
|
|||||||
This release includes the following bugfixes:
|
This release includes the following bugfixes:
|
||||||
|
|
||||||
o VMS builder bad behavior when used in a batch job
|
o VMS builder bad behavior when used in a batch job
|
||||||
|
o multiple recepients with SMTP
|
||||||
|
|
||||||
This release includes the following known bugs:
|
This release includes the following known bugs:
|
||||||
|
|
||||||
@@ -22,6 +23,6 @@ This release includes the following known bugs:
|
|||||||
This release would not have looked like this without help, code, reports and
|
This release would not have looked like this without help, code, reports and
|
||||||
advice from friends like these:
|
advice from friends like these:
|
||||||
|
|
||||||
Steven M. Schweda
|
Steven M. Schweda, Yang Tse, Jack Zhang
|
||||||
|
|
||||||
Thanks! (and sorry if I forgot to mention someone)
|
Thanks! (and sorry if I forgot to mention someone)
|
||||||
|
|||||||
39
lib/smtp.c
39
lib/smtp.c
@@ -344,27 +344,18 @@ static CURLcode smtp_state_mail_resp(struct connectdata *conn,
|
|||||||
state(conn, SMTP_STOP);
|
state(conn, SMTP_STOP);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
struct smtp_conn *smtpc = &conn->proto.smtpc;
|
||||||
|
|
||||||
/* send RCPT TO */
|
/* send RCPT TO */
|
||||||
struct curl_slist *rcpt;
|
smtpc->rcpt = data->set.mail_rcpt;
|
||||||
char *buffer = NULL;
|
|
||||||
|
|
||||||
for(rcpt = data->set.mail_rcpt; rcpt; rcpt=rcpt->next) {
|
if(smtpc->rcpt) {
|
||||||
char *add = aprintf("%s%s%s", buffer?buffer:"", buffer?", ":"",
|
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s",
|
||||||
rcpt->data);
|
smtpc->rcpt->data);
|
||||||
if(!add) {
|
if(result)
|
||||||
free(buffer);
|
return result;
|
||||||
return CURLE_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
buffer = add;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s", buffer);
|
|
||||||
|
|
||||||
free(buffer);
|
|
||||||
|
|
||||||
if(result)
|
|
||||||
return result;
|
|
||||||
|
|
||||||
state(conn, SMTP_RCPT);
|
state(conn, SMTP_RCPT);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@@ -385,6 +376,20 @@ static CURLcode smtp_state_rcpt_resp(struct connectdata *conn,
|
|||||||
state(conn, SMTP_STOP);
|
state(conn, SMTP_STOP);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
struct smtp_conn *smtpc = &conn->proto.smtpc;
|
||||||
|
|
||||||
|
/* one RCPT is done, but if there's one more to send go on */
|
||||||
|
smtpc->rcpt = smtpc->rcpt->next;
|
||||||
|
if(smtpc->rcpt) {
|
||||||
|
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s",
|
||||||
|
smtpc->rcpt->data);
|
||||||
|
if(result)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
state(conn, SMTP_RCPT);
|
||||||
|
return CURLE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
/* send DATA */
|
/* send DATA */
|
||||||
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "DATA", "");
|
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "DATA", "");
|
||||||
if(result)
|
if(result)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 2009 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@@ -49,6 +49,7 @@ struct smtp_conn {
|
|||||||
int eob; /* number of bytes of the EOB (End Of Body) that has been
|
int eob; /* number of bytes of the EOB (End Of Body) that has been
|
||||||
received thus far */
|
received thus far */
|
||||||
smtpstate state; /* always use smtp.c:state() to change state! */
|
smtpstate state; /* always use smtp.c:state() to change state! */
|
||||||
|
struct curl_slist *rcpt;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct Curl_handler Curl_handler_smtp;
|
extern const struct Curl_handler Curl_handler_smtp;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ To: another
|
|||||||
body
|
body
|
||||||
</stdin>
|
</stdin>
|
||||||
<command>
|
<command>
|
||||||
smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 802@foo --mail-from 802@from -T -
|
smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 802@foo --mail-rcpt 802@foobar.example --mail-from 802@from -T -
|
||||||
</command>
|
</command>
|
||||||
</client>
|
</client>
|
||||||
|
|
||||||
@@ -37,6 +37,7 @@ smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 802@foo --mail-from 802@from -T -
|
|||||||
EHLO user
|
EHLO user
|
||||||
MAIL FROM:802@from
|
MAIL FROM:802@from
|
||||||
RCPT TO:802@foo
|
RCPT TO:802@foo
|
||||||
|
RCPT TO:802@foobar.example
|
||||||
DATA
|
DATA
|
||||||
QUIT
|
QUIT
|
||||||
</protocol>
|
</protocol>
|
||||||
|
|||||||
Reference in New Issue
Block a user