smtp: Added support for NTLM authentication
authorSteve Holme <steve_holme@hotmail.com>
Sat, 1 Oct 2011 13:46:14 +0000 (14:46 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 3 Oct 2011 21:28:17 +0000 (23:28 +0200)
commit4d327d20c62d856c45f8ecf84d16fd7804ace0f1
treef6af7e99ce1386b739fc9c592b7da0f6559f09b5
parent185ed3409a883d32f7b6d41e20fddd5b04d98a7d
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.
lib/smtp.c
lib/smtp.h