curl-library
RE: Want to contribute SMTP AUTH configuration
Date: Thu, 14 Oct 2010 11:01:01 +0200
Sune Ahlgren wrote:
> A possibility to control what kind of authentication mechanism to
allow from an SMTP client. NOT compile time, but execution time.
First, please note that the current code for SMTP authentication has
been written with extensions in mind; that is: adding new authentication
mechanisms (if you need some) is quite easy regarding curl integration.
Next, here are some hints to solve your problem:
Server supported authentication mechanisms are latched (in field
authmechs) by procedure smtp_endofresp() (smtp.c) as an or'ed value of
flags SMTP_AUTH_LOGIN, SMTP_AUTH_PLAIN, SMTP_AUTH_CRAM_MD5,
SMTP_AUTH_DIGEST_MD5, SMTP_AUTH_GSSAPI and SMTP_AUTH_EXTERNAL. (as you
have noted, all these mechanisms are not yet supported). These symbols
are currently private and defined in smtp.h.
To implement the control you require, I would proceed as follow:
1) Make all SMTP_AUTH_* symbols public (into curl/curl.h), prepending
"CURL" to each of them and updating the code accordingly.
2) define unsigned int field smtpauthmask in structure UserDefined
(urldata.h)
3) Preset this field to all flags (i.e.: ~0) in Curl_init_userdefined(),
url.c.
4) Add a curl_easy_setopt() option (in Curl_setopt(), url.c) that takes
an or'ed value similar to authmechs and store this parameter in field
smtpauthmask.
5) Mask authmechs with smtpauthmask at use time in smtp.c.
These are just hints, please do as you feel it !
Cheers,
Patrick
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-10-14