cURL / Mailing Lists / curl-library / Single Mail

curl-library

Specifing authentication types in SMTP

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Mon, 2 Apr 2012 22:17:46 +0100

Dear all,

I am wanting to specify the authentication types for SMTP just like the user
can for HTTP at present. So for example if the server responds with:

250-AUTH GSSAPI NTLM LOGIN

But I explicitly want to use LOGIN I should be able to tell curl and libcurl
to use that ;-)

As I see it there are two ways to do this:

1) Use CURLOPT_HTTPAUTH (so --anyauth, --ntlm, etc. will work)
2) Introduce a new option CURLOPT_SMTPAUTH

The problem with option 1 is SMTP authentication mechanisms such as (LOGIN
and EXTERNAL) don't currently have a CURLAUTH_ counterpart) however PLAIN
could map to CURLAUTH_BASIC, NTLM to CURLAUTH_NTLM and GSSAPI to
AUTHAUTH_GSSNEGOTIATE. This essentially means that the CURLOPT_HTTPAUTH
option becomes more of a CURLOPT_AUTH option and would have to include other
mechanism for other protocols (for example: APOP when I get round to adding
POP3 authentication).

The problem with options 2 is that it is yet another option and again when I
add authentication for POP3 there would be yet another option -
CURLOPT_POP3AUTH ;-)

As a quick test I tried changing line 261 in smtp.c to the following works:

if(wordlen == 5 && !memcmp(line, "LOGIN", 5) && conn->data->set.httpauth &
CURLAUTH_BASIC)

Your thoughts and suggestions would be welcomed.

Kind Regards

Steve

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-04-02