cURL / Mailing Lists / curl-library / Single Mail


[PATCH] Added support for NTLM authentication to SMTP

From: Steve Holme <>
Date: Sat, 1 Oct 2011 19:26:11 +0100

Dear all,

Please find attached three patches which ultimately add NTLM authorisation
support to SMTP. This carries on the work I was involved with during July
and August but unfortunately ran out of time on to complete for the v7.22.0

The patches are as follows:

* General tidy up of smtp.c - This cleans up the code and layout of
functions to be consistent and reworks smtp_authenticate() to be simpler and
easier to follow.
* This adds the outlen parameter into Curl_ntlm_create_type1_message() and
Curl_ntlm_create_type3_message() functions as per my original patches from
July. Strictly speaking this additional parameter is only requires adding to
Curl_ntlm_create_type1_message() as smtp_authenticate() needs it for the
AUTH command length but it does no harm being on both functions - at least
it provides consistency and future proofing for anyone else that my require
* The final patch adds the actual NTLM authentication to SMTP and in the
process introduces three new functions to 1) Send the authentication message
with a type-1 message 2) Handle the scenario when a AUTH NTLM doesn't
contain the type-1 message (initial response) and 3) Handle the type-2
response, sending the type-3 message back to the server.

The code is based on the latest that is in GIT, plus the patch that I posted
on Friday in the following email:

Any feedback, comments or suggestions always welcome.

Kind Regards


Received on 2011-10-01