smtp: without a MAIL_FROM, send blank MAIL FROM
authorGisle Vanem <gvanem@broadpark.no>
Wed, 21 Sep 2011 20:24:45 +0000 (22:24 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 21 Sep 2011 20:24:45 +0000 (22:24 +0200)
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.

lib/smtp.c

index 977d323..bb29a83 100644 (file)
@@ -791,7 +791,11 @@ static CURLcode smtp_mail(struct connectdata *conn)
   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