smtp: Added support for NTLM authentication
Modified smtp_endofresp() to detect NTLM from the server specified list of supported authentication mechanisms. Modified smtp_authenticate() to start the sending of the NTLM data. Added smtp_auth_ntlm_type1_message() which creates a NTLM type-1 message. This function is used by authenticate() to start the sending of data and by smtp_state_auth_ntlm_resp() when the AUTH command doesn't contain the type-1 message as part of the initial response. This lack of initial response can happen if an OOM error occurs or the type-1 message is longer than 504 characters. As the main AUTH command is limited to 512 character the data has to be transmitted in two parts; one containing the AUTH NTLM and the second containing the type-1 message. Added smtp_state_auth_ntlm_type2msg_resp() which handles the incoming type-2 message and sends an outgoing type-3 message. This type-2 message is sent by the server in response to our type-1 message. Modified smtp_state_auth_resp() to handle the response to: the AUTH NTLM without the initial response and the type-2 response. Modified smtp_disconnect() to cleanup the NTLM SSPI stack.
This commit is contained in:
committed by
Daniel Stenberg
parent
185ed3409a
commit
4d327d20c6
@@ -40,6 +40,8 @@ typedef enum {
|
||||
SMTP_AUTHLOGIN,
|
||||
SMTP_AUTHPASSWD,
|
||||
SMTP_AUTHCRAM,
|
||||
SMTP_AUTHNTLM,
|
||||
SMTP_AUTHNTLM_TYPE2MSG,
|
||||
SMTP_AUTH,
|
||||
SMTP_MAIL, /* MAIL FROM */
|
||||
SMTP_RCPT, /* RCPT TO */
|
||||
@@ -57,6 +59,7 @@ struct smtp_conn {
|
||||
size_t eob; /* number of bytes of the EOB (End Of Body) that has been
|
||||
received thus far */
|
||||
unsigned int authmechs; /* Accepted authentication methods. */
|
||||
unsigned int authused; /* Authentication method used for the connection */
|
||||
smtpstate state; /* always use smtp.c:state() to change state! */
|
||||
struct curl_slist *rcpt;
|
||||
bool ssldone; /* is connect() over SSL done? only relevant in multi mode */
|
||||
@@ -69,6 +72,7 @@ struct smtp_conn {
|
||||
#define SMTP_AUTH_DIGEST_MD5 0x0008
|
||||
#define SMTP_AUTH_GSSAPI 0x0010
|
||||
#define SMTP_AUTH_EXTERNAL 0x0020
|
||||
#define SMTP_AUTH_NTLM 0x0040
|
||||
|
||||
extern const struct Curl_handler Curl_handler_smtp;
|
||||
extern const struct Curl_handler Curl_handler_smtps;
|
||||
|
||||
Reference in New Issue
Block a user