1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

smtp: Reworked smtp_endofresp() to allow for extra capability detection

This commit is contained in:
Steve Holme 2013-02-08 21:19:34 +00:00
parent dda53476ca
commit 40f9bb787f

View File

@ -204,9 +204,9 @@ static const struct Curl_handler Curl_handler_smtps_proxy = {
#endif
#endif
/* Function that checks for an ending smtp status code at the start of the
given string, but also detects the supported authentication mechanisms
from the EHLO AUTH response. */
/* Function that checks for an ending SMTP status code at the start of the
given string, but also detects various capabilities from the EHLO response
including the supported authentication mechanisms. */
static int smtp_endofresp(struct pingpong *pp, int *resp)
{
char *line = pp->linestart_resp;
@ -223,17 +223,17 @@ static int smtp_endofresp(struct pingpong *pp, int *resp)
if((result = (line[3] == ' ')) != 0)
*resp = curlx_sltosi(strtol(line, NULL, 10));
/* Are we processing EHLO command responses? */
if(smtpc->state == SMTP_EHLO) {
line += 4;
len -= 4;
/* Does the server support the SIZE capability? */
if(smtpc->state == SMTP_EHLO && len >= 4 && !memcmp(line, "SIZE", 4)) {
DEBUGF(infof(conn->data, "Server supports SIZE extension.\n"));
smtpc->size_supported = true;
}
if(len >= 4 && !memcmp(line, "SIZE", 4))
smtpc->size_supported = TRUE;
/* Do we have the authentication mechanism list? */
if(smtpc->state == SMTP_EHLO && len >= 5 && !memcmp(line, "AUTH ", 5)) {
else if(len >= 5 && !memcmp(line, "AUTH ", 5)) {
line += 5;
len -= 5;
@ -274,6 +274,7 @@ static int smtp_endofresp(struct pingpong *pp, int *resp)
len -= wordlen;
}
}
}
return result;
}