cURL / Mailing Lists / curl-users / Single Mail

curl-users

--mail-from missing

From: Gisle Vanem <gvanem_at_broadpark.no>
Date: Wed, 21 Sep 2011 22:04:20 +0200

If I try to send mail without a '--mail-from', libcurl crashes
due to a missing 'data->set.str[STRING_MAIL_FROM]'.

E.g.
echo Hello | curl -v smtp://mail.broadpark.no

crashes:
curl!smtp_mail(struct connectdata * conn = 0x003e3b60)+0x2c
curl!smtp_perform(struct connectdata * conn = 0x003e3b60, bool * connected = 0x0013f5e0, bool * dophase_done = 0x0013f648)+0x57
curl!smtp_regular_transfer(struct connectdata * conn = 0x003e3b60, bool * dophase_done = 0x0013f648)+0x92
curl!smtp_do(struct connectdata * conn = 0x003e3b60, bool * done = 0x0013f648)+0x4e
curl!Curl_do(struct connectdata ** connp = 0x0013f664, bool * done = 0x0013f648)+0x6a
curl!Curl_do_perform(struct SessionHandle * data = 0x004d0068)+0xb1
curl!Curl_perform(struct SessionHandle * data = 0x004d0068)+0x20
curl!curl_easy_perform(void * curl = 0x004d0068)+0x10a
..

I think curl should ignore this case and smtp.c should test for this.
Since RFC-2821 seems to allow a "null reverse-path". Ref.
"MAIL FROM:<>" in section 3.7, page 25. Hence I suggest this patch:

--- Git-latest/lib/smtp.c Tue Sep 13 22:51:01 2011
+++ lib/smtp.c Wed Sep 21 21:52:20 2011
@@ -791,7 +791,10 @@
   struct SessionHandle *data = conn->data;

   /* send MAIL FROM */
- if(data->set.str[STRING_MAIL_FROM][0] == '<')
+ if (!data->set.str[STRING_MAIL_FROM]) /* null reverse-path, RFC-2821, sect. 3.7 */
+ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "MAIL FROM:<>");
+
+ else if(data->set.str[STRING_MAIL_FROM][0] == '<')
     result = Curl_pp_sendf(&conn->proto.smtpc.pp, "MAIL FROM:%s",
                            data->set.str[STRING_MAIL_FROM]);
   else

--gv

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-09-21