#include "curl_gethostname.h"
#include "curl_sasl.h"
#include "warnless.h"
+/* The last 3 #include files should be in this order */
#include "curl_printf.h"
#include "curl_memory.h"
-/* The last #include file should be: */
#include "memdebug.h"
/* Local API functions */
/* Find the end of the message */
for(len = strlen(message); len--;)
if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' &&
- message[len] != '\t')
+ message[len] != '\t')
break;
/* Terminate the message */
/* Check we have enough data to authenticate with, and the
server supports authentiation, and end the connect phase if not */
if(!smtpc->auth_supported ||
- !Curl_sasl_can_authenticate(&smtpc->sasl, conn)) {
+ !Curl_sasl_can_authenticate(&smtpc->sasl, conn)) {
state(conn, SMTP_STOP);
return result;
}
static CURLcode smtp_perform_command(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct SMTP *smtp = data->req.protop;
/* Send the command */
if(smtp->rcpt)
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s %s",
- smtp->custom && smtp->custom[0] != '\0' ?
- smtp->custom : "VRFY",
- smtp->rcpt->data);
+ smtp->custom && smtp->custom[0] != '\0' ?
+ smtp->custom : "VRFY",
+ smtp->rcpt->data);
else
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s",
smtp->custom && smtp->custom[0] != '\0' ?
char *auth = NULL;
char *size = NULL;
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
/* Calculate the FROM parameter */
if(!data->set.str[STRING_MAIL_FROM])
static CURLcode smtp_perform_rcpt_to(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct SMTP *smtp = data->req.protop;
/* Send the RCPT TO command */
if(smtp->rcpt->data[0] == '<')
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:%s",
- smtp->rcpt->data);
+ smtp->rcpt->data);
else
result = Curl_pp_sendf(&conn->proto.smtpc.pp, "RCPT TO:<%s>",
- smtp->rcpt->data);
+ smtp->rcpt->data);
if(!result)
state(conn, SMTP_RCPT);
smtpstate instate)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
(void)instate; /* no use for this yet */
smtpstate instate)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
(void)instate; /* no use for this yet */
smtpstate instate)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct smtp_conn *smtpc = &conn->proto.smtpc;
const char *line = data->state.buffer;
size_t len = strlen(line);
smtpstate instate)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
(void)instate; /* no use for this yet */
smtpstate instate)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct smtp_conn *smtpc = &conn->proto.smtpc;
saslprogress progress;
smtpstate instate)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct SMTP *smtp = data->req.protop;
char *line = data->state.buffer;
size_t len = strlen(line);
smtpstate instate)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
(void)instate; /* no use for this yet */
smtpstate instate)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct SMTP *smtp = data->req.protop;
(void)instate; /* no use for this yet */
smtpstate instate)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
(void)instate; /* no use for this yet */
{
CURLcode result = CURLE_OK;
curl_socket_t sock = conn->sock[FIRSTSOCKET];
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
int smtpcode;
struct smtp_conn *smtpc = &conn->proto.smtpc;
struct pingpong *pp = &smtpc->pp;
return result;
}
-/* Allocate and initialize the SMTP struct for the current SessionHandle if
+/* Allocate and initialize the SMTP struct for the current Curl_easy if
required */
static CURLcode smtp_init(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct SMTP *smtp;
smtp = data->req.protop = calloc(sizeof(struct SMTP), 1);
bool premature)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct SMTP *smtp = data->req.protop;
struct pingpong *pp = &conn->proto.smtpc.pp;
char *eob;
(void)premature;
if(!smtp || !pp->conn)
- /* When the easy handle is removed from the multi interface while libcurl
- is still trying to resolve the host name, the SMTP struct is not yet
- initialized. However, the removal action calls Curl_done() which in
- turn calls this function, so we simply return success. */
return CURLE_OK;
if(status) {
TODO: when the multi interface is used, this _really_ should be using
the smtp_multi_statemach function but we have no general support for
- non-blocking DONE operations, not in the multi state machine and with
- Curl_done() invokes on several places in the code!
+ non-blocking DONE operations!
*/
result = smtp_block_statemach(conn);
}
{
/* This is SMTP and no proxy */
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct SMTP *smtp = data->req.protop;
DEBUGF(infof(conn->data, "DO phase starts\n"));
{
CURLcode result = CURLE_OK;
bool connected = FALSE;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
/* Make sure size is unknown at this point */
data->req.size = -1;
static CURLcode smtp_setup_connection(struct connectdata *conn)
{
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
CURLcode result;
/* Clear the TLS upgraded flag */
const char *value;
while(*ptr && *ptr != '=')
- ptr++;
+ ptr++;
value = ptr + 1;
static CURLcode smtp_parse_url_path(struct connectdata *conn)
{
/* The SMTP struct is already initialised in smtp_connect() */
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct smtp_conn *smtpc = &conn->proto.smtpc;
const char *path = data->state.path;
char localhost[HOSTNAME_MAX + 1];
static CURLcode smtp_parse_custom_request(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct SMTP *smtp = data->req.protop;
const char *custom = data->set.str[STRING_CUSTOMREQUEST];
*/
ssize_t i;
ssize_t si;
- struct SessionHandle *data = conn->data;
+ struct Curl_easy *data = conn->data;
struct SMTP *smtp = data->req.protop;
char *scratch = data->state.scratch;
char *newscratch = NULL;