Hello Denis,

I think the problem in you case is that the radius dictionary does not
contain an entry for "SIP-AVP", and that is why attr is null, causing
the crash.

I added a fix on the trunk and i also attached the patch to this email
in case you don't use the trunk version. Please let me know if there
are any other issues.

Regards,
Irina Stanescu

On Thu, Jul 15, 2010 at 3:29 PM, Denis Putyato <[email protected]> wrote:
> Bogdan, i made another call which makes opensips crash
>
> ...
> Core was generated by `/usr/local/opensips/sbin/opensips -P 
> /var/run/opensips.pid'.
> Program terminated with signal 11, Segmentation fault.
> [New process 8833]
> #0  0xb7a0adf1 in send_auth_func (msg=0x81c113c, s1=0x81bcd34, s2=0x81bcd48) 
> at aaa_radius.c:369
> 369             for(; (vp = rc_avpair_get(vp, attr->value, 0)); vp = vp->next)
> (gdb) bt
> #0  0xb7a0adf1 in send_auth_func (msg=0x81c113c, s1=0x81bcd34, s2=0x81bcd48) 
> at aaa_radius.c:369
> #1  0x08056111 in do_action (a=0x81b7404, msg=0x81c113c) at action.c:967
> #2  0x08054f9e in run_action_list (a=0x81b5e14, msg=0x81c113c) at action.c:139
> #3  0x08057f97 in do_action (a=0x81b7680, msg=0x81c113c) at action.c:706
> #4  0x08054f9e in run_action_list (a=0x81b5938, msg=0x81c113c) at action.c:139
> #5  0x08057946 in do_action (a=0x81aa660, msg=0x81c113c) at action.c:119
> #6  0x08054f9e in run_action_list (a=0x81aa660, msg=0x81c113c) at action.c:139
> #7  0x08057f97 in do_action (a=0x81aa758, msg=0x81c113c) at action.c:706
> #8  0x08054f9e in run_action_list (a=0x81aa758, msg=0x81c113c) at action.c:139
> #9  0x08057f97 in do_action (a=0x81aaff4, msg=0x81c113c) at action.c:706
> #10 0x08054f9e in run_action_list (a=0x81aaff4, msg=0x81c113c) at action.c:139
> #11 0x08057f97 in do_action (a=0x81ac2d8, msg=0x81c113c) at action.c:706
> #12 0x08054f9e in run_action_list (a=0x81a9f24, msg=0x81c113c) at action.c:139
> #13 0x08057946 in do_action (a=0x81b428c, msg=0x81c113c) at action.c:119
> #14 0x08054f9e in run_action_list (a=0x81b1ab0, msg=0x81c113c) at action.c:139
> #15 0x08057946 in do_action (a=0x81b1308, msg=0x81c113c) at action.c:119
> #16 0x08054f9e in run_action_list (a=0x81b1308, msg=0x81c113c) at action.c:139
> #17 0x08057f97 in do_action (a=0x81b14cc, msg=0x81c113c) at action.c:706
> #18 0x08054f9e in run_action_list (a=0x81b0a70, msg=0x81c113c) at action.c:139
> #19 0x08057946 in do_action (a=0x81b078c, msg=0x81c113c) at action.c:119
> #20 0x08054f9e in run_action_list (a=0x81ad9e0, msg=0x81c113c) at action.c:139
> #21 0x08057946 in do_action (a=0x81ad50c, msg=0x81c113c) at action.c:119
> #22 0x08054f9e in run_action_list (a=0x81aca9c, msg=0x81c113c) at action.c:139
> #23 0x08057946 in do_action (a=0x81a9cb4, msg=0x81c113c) at action.c:119
> #24 0x08054f9e in run_action_list (a=0x81a6c50, msg=0x81c113c) at action.c:139
> #25 0x08057f97 in do_action (a=0x81a9d8c, msg=0x81c113c) at action.c:706
> #26 0x08054f9e in run_action_list (a=0x81a47e0, msg=0x81c113c) at action.c:139
> #27 0x080590bf in run_top_route (a=0x81a47e0, msg=0x81c113c) at action.c:119
> #28 0x08098b9c in receive_msg (
>    buf=0x8178200 "INVITE sip:[email protected]:5060 SIP/2.0\r\nVia: 
> SIP/2.0/UDP 213.170.75.90:5050;branch=z9hG4bK6912c413;rport\r\nMax-Forwards: 
> 70\r\nFrom: \"3364079\" 
> <sip:[email protected]:5050>;tag=as477593c3\r\nTo: "..., len=826,
>    rcv_info=0xbfeaed48) at receive.c:162
> #29 0x080da834 in udp_rcv_loop () at udp_server.c:492
> #30 0x0806ee80 in main (argc=3, argv=0xbfeaeee4) at main.c:818
> (gdb) print vp
> $1 = (VALUE_PAIR *) 0x854c8f8
> (gdb) print attr
> $2 = (DICT_ATTR *) 0x0
> (gdb)
>
> -----Original Message-----
> From: [email protected] 
> [mailto:[email protected]] On Behalf Of Bogdan-Andrei Iancu
> Sent: Thursday, July 15, 2010 3:48 PM
> To: OpenSIPS users mailling list
> Subject: Re: [OpenSIPS-Users] ACC_RADIUS makes opensips crash
>
> Hi Denis,
>
> That's perfect - thank you.
>
> Could you print in GDB the following values : vp , attr.
>
> Regards,
> Bogdan
>
> Denis Putyato wrote:
>> Hello, Bogdan
>>
>> Is this information you asked?
>>
>> gdb /usr/local/opensips/sbin/opensips /core
>> GNU gdb 6.8-debian
>> Copyright (C) 2008 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
>> and "show warranty" for details.
>> This GDB was configured as "i486-linux-gnu"...
>>
>> warning: Can't read pathname for load map: Input/output error.
>> ...
>> ...
>> Core was generated by `/usr/local/opensips/sbin/opensips -P 
>> /var/run/opensips.pid'.
>> Program terminated with signal 11, Segmentation fault.
>> [New process 24328]
>> #0  0xb79b7df1 in send_auth_func (msg=0x81c0fd4, s1=0x81bcbcc, s2=0x81bcbe0) 
>> at aaa_radius.c:369
>> 369           for(; (vp = rc_avpair_get(vp, attr->value, 0)); vp = vp->next)
>> (gdb) bt
>> #0  0xb79b7df1 in send_auth_func (msg=0x81c0fd4, s1=0x81bcbcc, s2=0x81bcbe0) 
>> at aaa_radius.c:369
>> #1  0x08056111 in do_action (a=0x81b729c, msg=0x81c0fd4) at action.c:967
>> #2  0x08054f9e in run_action_list (a=0x81b5e14, msg=0x81c0fd4) at 
>> action.c:139
>> #3  0x08057f97 in do_action (a=0x81b7518, msg=0x81c0fd4) at action.c:706
>> #4  0x08054f9e in run_action_list (a=0x81b5938, msg=0x81c0fd4) at 
>> action.c:139
>> #5  0x08057946 in do_action (a=0x81aa660, msg=0x81c0fd4) at action.c:119
>> #6  0x08054f9e in run_action_list (a=0x81aa660, msg=0x81c0fd4) at 
>> action.c:139
>> #7  0x08057f97 in do_action (a=0x81aa758, msg=0x81c0fd4) at action.c:706
>> #8  0x08054f9e in run_action_list (a=0x81aa758, msg=0x81c0fd4) at 
>> action.c:139
>> #9  0x08057f97 in do_action (a=0x81aaff4, msg=0x81c0fd4) at action.c:706
>> #10 0x08054f9e in run_action_list (a=0x81aaff4, msg=0x81c0fd4) at 
>> action.c:139
>> #11 0x08057f97 in do_action (a=0x81ac2d8, msg=0x81c0fd4) at action.c:706
>> #12 0x08054f9e in run_action_list (a=0x81a9f24, msg=0x81c0fd4) at 
>> action.c:139
>> #13 0x08057946 in do_action (a=0x81b428c, msg=0x81c0fd4) at action.c:119
>> #14 0x08054f9e in run_action_list (a=0x81b1ab0, msg=0x81c0fd4) at 
>> action.c:139
>> #15 0x08057946 in do_action (a=0x81b1308, msg=0x81c0fd4) at action.c:119
>> #16 0x08054f9e in run_action_list (a=0x81b1308, msg=0x81c0fd4) at 
>> action.c:139
>> #17 0x08057f97 in do_action (a=0x81b14cc, msg=0x81c0fd4) at action.c:706
>> #18 0x08054f9e in run_action_list (a=0x81b0a70, msg=0x81c0fd4) at 
>> action.c:139
>> #19 0x08057946 in do_action (a=0x81b078c, msg=0x81c0fd4) at action.c:119
>> #20 0x08054f9e in run_action_list (a=0x81ad9e0, msg=0x81c0fd4) at 
>> action.c:139
>> #21 0x08057946 in do_action (a=0x81ad50c, msg=0x81c0fd4) at action.c:119
>> #22 0x08054f9e in run_action_list (a=0x81aca9c, msg=0x81c0fd4) at 
>> action.c:139
>> #23 0x08057946 in do_action (a=0x81a9cb4, msg=0x81c0fd4) at action.c:119
>> #24 0x08054f9e in run_action_list (a=0x81a6c50, msg=0x81c0fd4) at 
>> action.c:139
>> #25 0x08057f97 in do_action (a=0x81a9d8c, msg=0x81c0fd4) at action.c:706
>> #26 0x08054f9e in run_action_list (a=0x81a47e0, msg=0x81c0fd4) at 
>> action.c:139
>> #27 0x080590bf in run_top_route (a=0x81a47e0, msg=0x81c0fd4) at action.c:119
>> #28 0x08098b9c in receive_msg (
>>     buf=0x8178200 "INVITE sip:[email protected]:5060 SIP/2.0\r\nVia: 
>> SIP/2.0/UDP 1.1.1.1:5050;branch=z9hG4bK7d781018;rport\r\nMax-Forwards: 
>> 70\r\nFrom: \"3364079\" <sip:[email protected]:5050>;tag=as3bb11c83\r\nTo: 
>> "..., len=826,
>>     rcv_info=0xbfb599f8) at receive.c:162
>> #29 0x080da834 in udp_rcv_loop () at udp_server.c:492
>> #30 0x0806ee80 in main (argc=3, argv=0xbfb59b94) at main.c:818
>>
>> -----Original Message-----
>> From: [email protected] 
>> [mailto:[email protected]] On Behalf Of Bogdan-Andrei Iancu
>> Sent: Wednesday, July 14, 2010 7:37 PM
>> To: OpenSIPS users mailling list
>> Subject: Re: [OpenSIPS-Users] ACC_RADIUS makes opensips crash
>>
>> Hi Denis,
>>
>> do you get a coredump file? if so, could you get a bracktrace from it
>> and post it here?
>>
>> Regards,
>> Bogdan
>>
>> Denis Putyato wrote:
>>
>>> Hello everybody!
>>>
>>> There is a problem with radius_send_auth(); function.
>>>
>>> This function is called from request route and after opensips received
>>> “Access-Accept” from radius server it is crashes with such error:
>>>
>>> Jul 14 14:59:02 kam /usr/local/opensips/sbin/opensips[21556]:
>>> DBG:aaa_radius:send_auth_func: radius authentication message sent
>>>
>>> Jul 14 14:59:02 kam kernel: [118250.317522] opensips[21556]: segfault
>>> at 24 ip b7a53df1 sp bf8f5590 error 4 in aaa_radius.so[b7a51000+7000]
>>>
>>> Jul 14 14:59:02 kam /usr/local/opensips/sbin/opensips[21561]:
>>> CRITICAL:core:receive_fd: EOF on 7
>>>
>>> Opensips.cfg:
>>>
>>> …
>>>
>>> …
>>>
>>> modparam("aaa_radius", "radius_config",
>>> "/etc/radiusclient-ng/radiusclient.conf")
>>>
>>> modparam("aaa_radius", "sets", "set1 = (User-Name = $avp(i:20),
>>> User-Password=$avp(i:50))")
>>>
>>> modparam("aaa_radius", "sets", "set2 = (Session-Timeout = $var(time))")
>>>
>>> …
>>>
>>> …
>>>
>>> route [7] {
>>>
>>> …
>>>
>>> radius_send_auth("set1","set2");
>>>
>>> …
>>>
>>> …
>>>
>>> }
>>>
>>> $avp(i:20) – tel. number
>>>
>>> $avp(i:50) – empty value. Has been inserted because radius server
>>> didn’t accept request from opensips without User-Password field
>>>
>>> Session-Timeout is ONLY one attribute that opensips receives from
>>> radius server.
>>>
>>> #cat /etc/radiusclient-ng/dictionary | grep Session-Timeout
>>>
>>> ATTRIBUTE Session-Timeout 27 integer
>>>
>>> Thank you for any help.
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Users mailing list
>>> [email protected]
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>
>>>
>>
>>
>>
>
>
> --
> Bogdan-Andrei Iancu
> OpenSIPS Bootcamp
> 20 - 24 September 2010, Frankfurt, Germany
> www.voice-system.ro
>
>
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
Index: modules/aaa_radius/aaa_radius.c
===================================================================
--- modules/aaa_radius/aaa_radius.c	(revision 7027)
+++ modules/aaa_radius/aaa_radius.c	(working copy)
@@ -64,6 +64,7 @@
 int set_size = 0;
 char* config_file = NULL;
 rc_handle *rh = NULL;
+DICT_ATTR *attr;
 
 int mod_init(void);
 int init_radius_handle(void);
@@ -293,7 +294,6 @@
 	char mess[1024];
 
 	VALUE_PAIR *send = NULL, *recv = NULL, *vp = NULL;
-	DICT_ATTR *attr;
 
 	if (!rh) {
 		if (init_radius_handle()) {
@@ -364,10 +364,10 @@
 		}
 	}
 
-	attr = rc_dict_findattr(rh, "SIP-AVP");
 	vp = recv;
-	for(; (vp = rc_avpair_get(vp, attr->value, 0)); vp = vp->next)
-		extract_avp(vp);
+	if (attr)
+		for(; (vp = rc_avpair_get(vp, attr->value, 0)); vp = vp->next)
+			extract_avp(vp);
 
 	if (send) rc_avpair_free(send);
 	if (recv) rc_avpair_free(recv);
@@ -498,6 +498,8 @@
 		return -1;
 	}
 
+	attr = rc_dict_findattr(rh, "SIP-AVP");
+
 	/* initialize values for the attributes in sets */
 	for (i = 0; i < set_size; i++) {
 		mp = sets[i]->parsed;
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to