On 06/13/2013 10:09 AM, Andreas Wehrmann wrote:
> Hey there!
>
> Nothing to do with the problem but I just wanted to say that you can
> simplify/strengthen
> the code for building the auth string by doing it like this code:
>
> "sip" is of type <sip_t const* sip>, which is delivered by NUA to the
> callback:
>
> sip_www_authenticate_t const* www_auth = sip->sip_www_authenticate;
> char const* scheme = www_auth->au_scheme;
> const char* realm = msg_params_find( www_auth->au_params, "realm=" );
> char auth_str[ 8192 ] = { 0 };
> snprintf( auth_str, 8192, "%s:%s:%s:%s",
>                 scheme, realm,
>                 "USERNAME",
>                 "PASSWORD" );
> nua_authenticate( nh, NUTAG_AUTH( auth_str ), TAG_END() );
>
>

Just to be thorough: The code above should check whether sheme or realm 
is NULL;
Just in case.



------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to