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