[OpenSIPS-Users] uac_auth() segfault

Alexander Mustafin mustafin.aleksandr at gmail.com
Fri Apr 4 13:19:45 CEST 2014


Hello!

I can’t find commit in git for this problem. 

Maybe, my problem related:

opensips[4065]: segfault at 0 ip (null) sp 00007fff64ade248 error 14 in opensips[400000+14c000]


Best regards,
Alexander Mustafin
mustafin.aleksandr at gmail.com




27 марта 2014 г., в 2:08, Justin Zondagh <zondagh at gmail.com> написал(а):

> Thanks Bogdan, glad we could fix it.
> 
> Regards,
> Justin
> 
> 
> Justin Zondagh
> zondagh at gmail.com
> 
> Cape Town | South Africa
> skype: jrzondagh
> m: +27 72 598 4887 | f: +27 86 546 1405
> uk: +44 20 328 99610
> 
> 
> On Wed, Mar 26, 2014 at 7:57 PM, Bogdan-Andrei Iancu <bogdan at opensips.org> wrote:
> Hello Justin,
> 
> Thanks for all your help - I managed to find and fix the bug - please update from GIT and try again.
> 
> Best regards,
> Bogdan-Andrei Iancu
> OpenSIPS Founder and Developer
> http://www.opensips-solutions.com
> On 25.03.2014 21:31, Justin Zondagh wrote:
>> Hi Bogdan,
>> 
>> I placed the LM_DBG as follows
>> 
>>         if ( is_script_func_used("uac_auth", -1) ) {
>>                 /* load the UAC_AUTH API as uac_auth() is invoked from script */
>>                 if(load_uac_auth_api(&uac_auth_api)<0){
>>                         LM_ERR("can't load UAC_AUTH API, needed for uac_auth()\n");
>>                         goto error;
>>                 }
>> 
>>                 LM_DBG("Loaded uac_auth api as found in script");
>>         }
>> 
>> But nothing appears in the log on init.
>> 
>> 
>> 
>> I'm using the uac_auth() in a failure route
>> 
>> 
>> 
>> failure_route[ip_auth_fail]
>> {
>> 
>>         if (t_check_status("401")) {
>>                 xlog("L_INFO","[$ci] Got 401 from Proxy\n");
>> 
>>                 avp_db_query("select password from registrant where username = '$(avp(authuser){s.escape.common})'","$avp(authpass)");
>> 
>>                 $avp(authrealm) = "";
>> 
>>                 $avp(www) = $(<reply>hdr(WWW-Authenticate));
>>                 avp_subst("$avp(www)", "/Digest\s//");
>> 
>>                 #Get the realm from the www-auth header
>>                 $var(numkvp) = $(avp(www){csv.count});
>>                 $var(i) = 0;
>>                 while($var(i) < $var(numkvp)) {
>> 
>>                         $var(temp) = $(avp(www){s.select,$var(i),,});
>> 
>>                         if ($var(temp) =~ "realm.*") {
>>                                 $avp(authrealm) = $var(temp);
>>                                 avp_subst("$avp(authrealm)","/(realm=\")(.*)(\")/\2/");
>>                                 #$avp(authrealm) := "asterisk";
>>                         }
>> 
>>                         $var(i) = $var(i) + 1;
>>                 }
>> 
>>                 xlog("L_INFO","[$ci] authrealm is [$avp(authrealm)], authuser is [$avp(authuser)], authpass is [$avp(authpass)]\n");
>> 
>>                 #No need for loop prevention as Proxy sends 183 early media recording saying password is wrong, then sends 603
>> 
>>                 if (uac_auth()) {
>>                         xlog("L_INFO","[$ci] Built auth, sending back to Proxy\n");
>> 
>>                         t_on_failure("ip_auth_fail");
>> 
>>                         # the $du should really be uri as specified in Record-Route in 401, but using reply's source IP for now
>>                         $du = "sip:" + $(<reply>si) + ":5060";
>> 
>>                         xlog("L_INFO", "[$ci] Sending request with Auth header to [$du]\n");
>>                         t_relay();
>> 
>>                 }
>>         }
>> 
>>         if (t_was_cancelled()) {
>>                 exit;
>>         }
>> 
>> }
>> 
>> 
>> 
>> 
>> Justin Zondagh
>> zondagh at gmail.com
>> 
>> Cape Town | South Africa
>> skype: jrzondagh
>> m: +27 72 598 4887 | f: +27 86 546 1405
>> uk: +44 20 328 99610
>> 
>> 
>> On Tue, Mar 25, 2014 at 7:28 PM, Bogdan-Andrei Iancu <bogdan at opensips.org> wrote:
>> Hello Justin,
>> 
>> In the 1.10 code, in the UAC module, in the mod_init function, the binding to UAC AUTH module is to be done. See line 171 in modules/uac/uac.c
>> 
>> 
>>     if ( is_script_func_used("uac_auth", -1) ) {
>>         /* load the UAC_AUTH API as uac_auth() is invoked from script */
>>         if(load_uac_auth_api(&uac_auth_api)<0){
>>             LM_ERR("can't load UAC_AUTH API, needed for uac_auth()\n");
>>             goto error;
>>         }
>>     }
>> 
>> 
>> Maybe the is_script_func_used() doesn't trigger properly there - in what kind of route are you using the uac_auth() function ? Could you place a LM_DBG() in that 'if' statement to see if it goes in there ?
>> 
>> Thank and regards,
>>  Bogdan-Andrei Iancu
>> OpenSIPS Founder and Developer
>> http://www.opensips-solutions.com
>> On 25.03.2014 14:28, Justin Zondagh wrote:
>>> Hi Bogdan,
>>> 
>>> I have found and fixed the bug. The uac_auth_api wasn't being loaded before being called as you suspected.
>>> 
>>> I added this code
>>> 
>>>         if(load_uac_auth_api(&uac_auth_api) < 0){
>>>                 LM_INFO("Error loading uac_auth_api");
>>>                 goto error;
>>>         }
>>> 
>>> 
>>> before calling the API on the next line:
>>> 
>>>         crd = uac_auth_api._lookup_realm( &auth->realm );
>>> 
>>> 
>>> Seems to work now...
>>> 
>>> How do we commit this to code base?
>>> 
>>> Regards,
>>> Justin
>>> 
>>> 
>>> 
>>> Justin Zondagh
>>> zondagh at gmail.com
>>> 
>>> Cape Town | South Africa
>>> skype: jrzondagh
>>> m: +27 72 598 4887 | f: +27 86 546 1405
>>> uk: +44 20 328 99610
>>> 
>>> 
>>> On Tue, Mar 25, 2014 at 10:18 AM, Justin Zondagh <zondagh at gmail.com> wrote:
>>> They were the wrong way round, but swapped them and seems to have the same issue:
>> 
>> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20140404/cc05892a/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 496 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.opensips.org/pipermail/users/attachments/20140404/cc05892a/attachment-0001.pgp>


More information about the Users mailing list