aboutsummaryrefslogtreecommitdiff
path: root/lib/smtp.h
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2011-10-01 14:46:14 +0100
committerDaniel Stenberg <daniel@haxx.se>2011-10-03 23:28:17 +0200
commit4d327d20c62d856c45f8ecf84d16fd7804ace0f1 (patch)
treef6af7e99ce1386b739fc9c592b7da0f6559f09b5 /lib/smtp.h
parent185ed3409a883d32f7b6d41e20fddd5b04d98a7d (diff)
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.
Diffstat (limited to 'lib/smtp.h')
-rw-r--r--lib/smtp.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/smtp.h b/lib/smtp.h
index bc4b91eaa..144d49615 100644
--- a/lib/smtp.h
+++ b/lib/smtp.h
@@ -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;