1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

smtp: Re-factored all perform based functions

Standardised the naming of all perform based functions to be in the form
smtp_perform_something().
This commit is contained in:
Steve Holme 2013-04-16 19:47:15 +01:00
parent f737e3a3dd
commit c306d2e42f

View File

@ -345,12 +345,12 @@ static void state(struct connectdata *conn, smtpstate newstate)
/***********************************************************************
*
* smtp_state_ehlo()
* smtp_perform_ehlo()
*
* Sends the EHLO command to not only initialise communication with the ESMTP
* server but to also obtain a list of server side supported capabilities.
*/
static CURLcode smtp_state_ehlo(struct connectdata *conn)
static CURLcode smtp_perform_ehlo(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct smtp_conn *smtpc = &conn->proto.smtpc;
@ -371,11 +371,11 @@ static CURLcode smtp_state_ehlo(struct connectdata *conn)
/***********************************************************************
*
* smtp_state_helo()
* smtp_perform_helo()
*
* Sends the HELO command to initialise communication with the SMTP server.
*/
static CURLcode smtp_state_helo(struct connectdata *conn)
static CURLcode smtp_perform_helo(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct smtp_conn *smtpc = &conn->proto.smtpc;
@ -394,11 +394,11 @@ static CURLcode smtp_state_helo(struct connectdata *conn)
/***********************************************************************
*
* smtp_state_starttls()
* smtp_perform_starttls()
*
* Sends the STLS command to start the upgrade to TLS.
*/
static CURLcode smtp_state_starttls(struct connectdata *conn)
static CURLcode smtp_perform_starttls(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
@ -413,11 +413,11 @@ static CURLcode smtp_state_starttls(struct connectdata *conn)
/***********************************************************************
*
* smtp_state_upgrade_tls()
* smtp_perform_upgrade_tls()
*
* Performs the upgrade to TLS.
*/
static CURLcode smtp_state_upgrade_tls(struct connectdata *conn)
static CURLcode smtp_perform_upgrade_tls(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct smtp_conn *smtpc = &conn->proto.smtpc;
@ -431,7 +431,7 @@ static CURLcode smtp_state_upgrade_tls(struct connectdata *conn)
if(smtpc->ssldone) {
smtp_to_smtps(conn);
result = smtp_state_ehlo(conn);
result = smtp_perform_ehlo(conn);
}
}
@ -440,12 +440,12 @@ static CURLcode smtp_state_upgrade_tls(struct connectdata *conn)
/***********************************************************************
*
* smtp_authenticate()
* smtp_perform_authenticate()
*
* Sends an AUTH command allowing the client to login with the appropriate
* SASL authentication mechanism.
*/
static CURLcode smtp_authenticate(struct connectdata *conn)
static CURLcode smtp_perform_authenticate(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct smtp_conn *smtpc = &conn->proto.smtpc;
@ -541,11 +541,11 @@ static CURLcode smtp_authenticate(struct connectdata *conn)
/***********************************************************************
*
* smtp_mail()
* smtp_perform_mail()
*
* Sends an MAIL command to initiate the upload of a message.
*/
static CURLcode smtp_mail(struct connectdata *conn)
static CURLcode smtp_perform_mail(struct connectdata *conn)
{
char *from = NULL;
char *auth = NULL;
@ -618,12 +618,12 @@ static CURLcode smtp_mail(struct connectdata *conn)
/***********************************************************************
*
* smtp_rcpt_to()
* smtp_perform_rcpt_to()
*
* Sends a RCPT TO command for a given recipient as part of the message upload
* process.
*/
static CURLcode smtp_rcpt_to(struct connectdata *conn)
static CURLcode smtp_perform_rcpt_to(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
struct SessionHandle *data = conn->data;
@ -646,11 +646,11 @@ static CURLcode smtp_rcpt_to(struct connectdata *conn)
/***********************************************************************
*
* smtp_quit()
* smtp_perform_quit()
*
* Performs the quit action prior to sclose() being called.
*/
static CURLcode smtp_quit(struct connectdata *conn)
static CURLcode smtp_perform_quit(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
@ -678,7 +678,7 @@ static CURLcode smtp_state_servergreet_resp(struct connectdata *conn,
result = CURLE_FTP_WEIRD_SERVER_REPLY;
}
else
result = smtp_state_ehlo(conn);
result = smtp_perform_ehlo(conn);
return result;
}
@ -699,10 +699,10 @@ static CURLcode smtp_state_starttls_resp(struct connectdata *conn,
result = CURLE_USE_SSL_FAILED;
}
else
result = smtp_authenticate(conn);
result = smtp_perform_authenticate(conn);
}
else
result = smtp_state_upgrade_tls(conn);
result = smtp_perform_upgrade_tls(conn);
return result;
}
@ -720,7 +720,7 @@ static CURLcode smtp_state_ehlo_resp(struct connectdata *conn, int smtpcode,
if(smtpcode/100 != 2) {
if((data->set.use_ssl <= CURLUSESSL_TRY || conn->ssl[FIRSTSOCKET].use) &&
!conn->bits.user_passwd)
result = smtp_state_helo(conn);
result = smtp_perform_helo(conn);
else {
failf(data, "Remote access denied: %d", smtpcode);
result = CURLE_REMOTE_ACCESS_DENIED;
@ -730,17 +730,17 @@ static CURLcode smtp_state_ehlo_resp(struct connectdata *conn, int smtpcode,
/* We don't have a SSL/TLS connection yet, but SSL is requested */
if(smtpc->tls_supported)
/* Switch to TLS connection now */
result = smtp_state_starttls(conn);
result = smtp_perform_starttls(conn);
else if(data->set.use_ssl == CURLUSESSL_TRY)
/* Fallback and carry on with authentication */
result = smtp_authenticate(conn);
result = smtp_perform_authenticate(conn);
else {
failf(data, "STARTTLS not supported.");
result = CURLE_USE_SSL_FAILED;
}
}
else
result = smtp_authenticate(conn);
result = smtp_perform_authenticate(conn);
return result;
}
@ -1118,7 +1118,7 @@ static CURLcode smtp_state_mail_resp(struct connectdata *conn, int smtpcode,
else {
smtp->rcpt = data->set.mail_rcpt;
result = smtp_rcpt_to(conn);
result = smtp_perform_rcpt_to(conn);
}
return result;
@ -1142,7 +1142,7 @@ static CURLcode smtp_state_rcpt_resp(struct connectdata *conn, int smtpcode,
else {
if(smtp->rcpt) {
smtp->rcpt = smtp->rcpt->next;
result = smtp_rcpt_to(conn);
result = smtp_perform_rcpt_to(conn);
/* If we failed or still are sending RCPT data then return */
if(result || smtp->rcpt)
@ -1210,7 +1210,7 @@ static CURLcode smtp_statemach_act(struct connectdata *conn)
/* Busy upgrading the connection; right now all I/O is SSL/TLS, not SMTP */
if(smtpc->state == SMTP_UPGRADETLS)
return smtp_state_upgrade_tls(conn);
return smtp_perform_upgrade_tls(conn);
/* Flush any data that needs to be sent */
if(pp->sendleft)
@ -1523,7 +1523,7 @@ static CURLcode smtp_perform(struct connectdata *conn, bool *connected,
*dophase_done = FALSE; /* not done yet */
/* Start the first command in the DO phase */
result = smtp_mail(conn);
result = smtp_perform_mail(conn);
if(result)
return result;
@ -1586,7 +1586,7 @@ static CURLcode smtp_disconnect(struct connectdata *conn,
/* The SMTP session may or may not have been allocated/setup at this
point! */
if(!dead_connection && smtpc->pp.conn)
if(!smtp_quit(conn))
if(!smtp_perform_quit(conn))
(void)smtp_block_statemach(conn); /* ignore errors on QUIT */
/* Disconnect from the server */