mirror of
https://github.com/moparisthebest/curl
synced 2024-11-11 12:05:06 -05:00
smtp: Simplified the next RCPT TO logic
This commit is contained in:
parent
ed4ce23c23
commit
0ea4a80bb2
50
lib/smtp.c
50
lib/smtp.c
@ -671,16 +671,14 @@ static CURLcode smtp_perform_rcpt_to(struct connectdata *conn)
|
|||||||
struct SMTP *smtp = data->req.protop;
|
struct SMTP *smtp = data->req.protop;
|
||||||
|
|
||||||
/* Send the RCPT TO command */
|
/* Send the RCPT TO command */
|
||||||
if(smtp->rcpt) {
|
if(smtp->rcpt->data[0] == '<')
|
||||||
if(smtp->rcpt->data[0] == '<')
|
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s",
|
||||||
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s",
|
smtp->rcpt->data);
|
||||||
smtp->rcpt->data);
|
else
|
||||||
else
|
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:<%s>",
|
||||||
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:<%s>",
|
smtp->rcpt->data);
|
||||||
smtp->rcpt->data);
|
if(!result)
|
||||||
if(!result)
|
state(conn, SMTP_RCPT);
|
||||||
state(conn, SMTP_RCPT);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1324,11 +1322,9 @@ static CURLcode smtp_state_mail_resp(struct connectdata *conn, int smtpcode,
|
|||||||
result = CURLE_SEND_ERROR;
|
result = CURLE_SEND_ERROR;
|
||||||
state(conn, SMTP_STOP);
|
state(conn, SMTP_STOP);
|
||||||
}
|
}
|
||||||
else {
|
else
|
||||||
smtp->rcpt = data->set.mail_rcpt;
|
/* Start the RCPT TO command */
|
||||||
|
|
||||||
result = smtp_perform_rcpt_to(conn);
|
result = smtp_perform_rcpt_to(conn);
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1349,17 +1345,14 @@ static CURLcode smtp_state_rcpt_resp(struct connectdata *conn, int smtpcode,
|
|||||||
state(conn, SMTP_STOP);
|
state(conn, SMTP_STOP);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(smtp->rcpt) {
|
smtp->rcpt = smtp->rcpt->next;
|
||||||
smtp->rcpt = smtp->rcpt->next;
|
|
||||||
|
if(smtp->rcpt)
|
||||||
|
/* Send the next RCPT TO command */
|
||||||
result = smtp_perform_rcpt_to(conn);
|
result = smtp_perform_rcpt_to(conn);
|
||||||
|
else
|
||||||
/* If we failed or still are sending RCPT data then return */
|
/* Send the DATA command */
|
||||||
if(result || smtp->rcpt)
|
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", "DATA");
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Send the DATA command */
|
|
||||||
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", "DATA");
|
|
||||||
|
|
||||||
if(!result)
|
if(!result)
|
||||||
state(conn, SMTP_DATA);
|
state(conn, SMTP_DATA);
|
||||||
@ -1747,17 +1740,16 @@ static CURLcode smtp_perform(struct connectdata *conn, bool *connected,
|
|||||||
|
|
||||||
*dophase_done = FALSE; /* not done yet */
|
*dophase_done = FALSE; /* not done yet */
|
||||||
|
|
||||||
|
/* Store the first recipient (or NULL if not specified) */
|
||||||
|
smtp->rcpt = data->set.mail_rcpt;
|
||||||
|
|
||||||
/* Start the first command in the DO phase */
|
/* Start the first command in the DO phase */
|
||||||
if(data->set.upload && data->set.mail_rcpt)
|
if(data->set.upload && data->set.mail_rcpt)
|
||||||
/* MAIL transfer */
|
/* MAIL transfer */
|
||||||
result = smtp_perform_mail(conn);
|
result = smtp_perform_mail(conn);
|
||||||
else {
|
else
|
||||||
/* Store the first recipient (or NULL if not specified) */
|
|
||||||
smtp->rcpt = data->set.mail_rcpt;
|
|
||||||
|
|
||||||
/* SMTP based command (VRFY, EXPN, NOOP, RSET or HELP) */
|
/* SMTP based command (VRFY, EXPN, NOOP, RSET or HELP) */
|
||||||
result = smtp_perform_command(conn);
|
result = smtp_perform_command(conn);
|
||||||
}
|
|
||||||
|
|
||||||
if(result)
|
if(result)
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user