On Thu 26/Jan/2017 01:53:59 +0100 Sam Varshavchik wrote:
> Alessandro Vesely writes:
>> On Wed 25/Jan/2017 14:33:16 +0100 Sam Varshavchik wrote:
>>> Alessandro Vesely writes:
>>>>
>>>> The main difficulty is to get the sources for the include files:
>>>>
>>>> I include courierauth.h and courierauthsasl.h from authlib-devel.  But
>>>> I also need:
>>>>
>>>> #include    "libs/libhmac/hmac.h" // for struct hmac_hashinfo
>>>> #include    "cramlib.h" // for auth_cram_callback
>>>>
>>>> In addition, I also need auth.h, because cramlib.h includes it (it
>>>> would suffice to declare "struct authinfo;" to avoid the inclusion).
>>>> All file names in include_HEADER start with "courier", so some
>>>> renaming would be in order if this issue is ever addressed.
>>>
>>> It should be possible for you to support SASL authentication by using
>>> authsasl_list, that's declared in courierauthsasl.h.
>>
>> The authsasl_cram function declared in courierauthsasl.h seems to be
>> designed to be called /during/ the dialog.  In authProg, instead, I read
>> stuff more or less like:
>>
>>    AUTH 30\nesmtp\nlogin\njoe@spam\npassword
>>
>> /after/ the dialog is already terminated.  If it was SASL instead of login, 
>> the
>> last two lines read would contain challenge and response, which I decode with
>> authsasl_frombase64(); then I pass cleartext password, challenge and response
>> to auth_cram_callback(), and based on its return code either authenticate the
>> user or fail.
>
> Yeah, ok.
>
> These exported functions are meant to be used for developing authentication
> clients, not servers.
>
> Looks like all you need are the functions in cramlib.h

Yes, and the structure defined in hmac.h.  I trimmed the text above so as to 
make it more likely to fit on a sticky note, for the next release of authlib, 
whenever it comes.

> Specifically, auth_get_cram() is going to decode the challenge and response
> into a struct cram_callback_info.

I can't recall why I opted to fill a craminfo directly instead.  Perhaps 
because I had already tokenized authdata, or maybe I just overlooked it.

> Then, auth_cram_callback() takes a pointer to authinfo, where it only really
> looks at clearpasswd. The second argument is the pointer to the decoded
> cram_callback_info, which also contains a pointer to callback_func, that's
> going to get invoked if the challenge was successful.

Yup!

Thank you for taking a look at it
Ale

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to