Skip to content

Commit

Permalink
smtp: Added support for the STLS capability (Part One)
Browse files Browse the repository at this point in the history
Introduced detection of the STARTTLS capability, in order to add support
for TLS upgrades without unconditionally sending the STARTTLS command.
  • Loading branch information
captain-caveman2k committed Feb 10, 2013
1 parent 2f66ca1 commit c76cb3d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/smtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,15 +228,20 @@ static int smtp_endofresp(struct pingpong *pp, int *resp)
line += 4;
len -= 4;

/* Does the server support the STARTTLS capability? */
if(len >= 8 && !memcmp(line, "STARTTLS", 8))
smtpc->tls_supported = TRUE;

/* Does the server support the SIZE capability? */
if(len >= 4 && !memcmp(line, "SIZE", 4))
else if(len >= 4 && !memcmp(line, "SIZE", 4))
smtpc->size_supported = TRUE;

/* Do we have the authentication mechanism list? */
else if(len >= 5 && !memcmp(line, "AUTH ", 5)) {
line += 5;
len -= 5;

/* Loop through the data line */
for(;;) {
while(len &&
(*line == ' ' || *line == '\t' ||
Expand Down
1 change: 1 addition & 0 deletions lib/smtp.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ struct smtp_conn {
smtpstate state; /* Always use smtp.c:state() to change state! */
struct curl_slist *rcpt; /* Recipient list */
bool ssldone; /* Is connect() over SSL done? */
bool tls_supported; /* StartTLS capability supported by server */
bool size_supported; /* If server supports SIZE extension according to
RFC 1870 */
};
Expand Down

0 comments on commit c76cb3d

Please sign in to comment.