<div dir="ltr"><div class="gmail_quote"><div dir="ltr">Hi All,<div><br></div><div>I'm running a compiled version of openSIPS 1.10 on Ubuntu 12.04.</div><div><br></div><div>I'm getting a segfault in the uac_auth() function and not too sure why. I am setting the username, password and realm avps before I call it.</div>
<div><br></div><div>The 401 comes in back from the UAS and then hits the failure_route[1], does some stuff and then crashes in what seems like uac_auth()...</div><div><br></div><div>==== Extract from CFG ====</div><div><br>
</div><div><br></div><div><div>route[1] { </div><div><br></div><div><span style="white-space:pre-wrap">        </span>xlog("L_INFO", "[$ci] Routing this Request");</div><div><br></div><div><span style="white-space:pre-wrap">        </span></div>
<div><span style="white-space:pre-wrap">        </span># for INVITEs enable some additional helper routes</div><div><span style="white-space:pre-wrap">        </span>if (is_method("INVITE|SUBSCRIBE|PUBLISH|INFO|MESSAGE|NOTIFY")) {</div>
<div><span style="white-space:pre-wrap">                </span>t_on_branch("2");</div><div><span style="white-space:pre-wrap">                </span>t_on_reply("2");</div><div><span style="white-space:pre-wrap">                </span>t_on_failure("1");</div>
<div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div><span style="white-space:pre-wrap">        </span>if (!t_relay()) {</div><div><span style="white-space:pre-wrap">                </span>sl_reply_error();</div>
<div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div><span style="white-space:pre-wrap">        </span>exit; </div><div>} </div></div><div><br></div><div><div>failure_route[1] { </div><div><br></div>
<div><br></div><div><span style="white-space:pre-wrap">        </span>if (t_check_status("401")) {</div><div><span style="white-space:pre-wrap">                </span>xlog("L_INFO","[$ci] Got 401 from Porta \n");<span style="white-space:pre-wrap">        </span></div>
<div><span style="white-space:pre-wrap">                </span></div><div> avp_db_query("select username from registrant_ip_map where external_ip = '$(avp(ext_si){s.escape.common})'","$avp(authuser)");</div>
<div><br></div><div><span style="white-space:pre-wrap">                </span>xlog("L_INFO","[$ci] Auth User [$avp(authuser)]");</div><div><br></div><div><span style="white-space:pre-wrap">                </span>avp_db_query("select password from registrant where username = '$(avp(authuser){s.escape.common})'","$avp(authpass)");</div>
<div><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">                </span>$avp(authrealm) = "";</div><div><br></div><div><span style="white-space:pre-wrap">                </span>$avp(www) = $(<reply>hdr(WWW-Authenticate));</div>
<div><span style="white-space:pre-wrap">                </span>avp_subst("$avp(www)", "/Digest\s//");</div><div><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">                </span>#Get the realm from the www-auth header</div>
<div><span style="white-space:pre-wrap">                </span>$var(numkvp) = $(avp(www){csv.count});</div><div><span style="white-space:pre-wrap">                </span>$var(i) = 0;</div><div><span style="white-space:pre-wrap">                </span>while($var(i) < $var(numkvp)) {</div>
<div><span style="white-space:pre-wrap">                </span></div><div><span style="white-space:pre-wrap">                        </span>$var(temp) = $(avp(www){s.select,$var(i),,});</div><div><span style="white-space:pre-wrap">                </span></div>
<div><span style="white-space:pre-wrap">                        </span>if ($var(temp) =~ "realm.*") {</div><div><span style="white-space:pre-wrap">                                </span>$avp(authrealm) = $var(temp);</div><div><span style="white-space:pre-wrap">                                </span>avp_subst("$avp(authrealm)","/(realm=\")(.*)(\")/\2/");</div>
<div><span style="white-space:pre-wrap">                        </span>}</div><div><br></div><div><span style="white-space:pre-wrap">                        </span>$var(i) = $var(i) + 1;</div><div><span style="white-space:pre-wrap">                </span>}<span style="white-space:pre-wrap">        </span></div>
<div><span style="white-space:pre-wrap">                </span></div><div> xlog("L_INFO","[$ci] authrealm is [$avp(authrealm)], authuser is [$avp(authuser)], authpass is [$avp(authpass)]\n");</div>
<div><br></div><div><span style="white-space:pre-wrap">                </span>#No need for loop prevention as Porta sends 183 early media recording saying password is wrong, then sends 603</div><div><span style="white-space:pre-wrap">                </span></div>
<div><span style="white-space:pre-wrap">                </span>if (uac_auth()) {</div><div><span style="white-space:pre-wrap">                        </span>xlog("L_INFO","[$ci] Built auth, sending back to Porta\n");</div><div><br>
</div><div><span style="white-space:pre-wrap">                        </span>t_on_failure("1");<span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">                        </span>t_relay();</div><div><span style="white-space:pre-wrap">                        </span>xlog("L_INFO","[$ci] Relay Auth in INVITE\n");</div>
<div><span style="white-space:pre-wrap">                </span>}</div><div><span style="white-space:pre-wrap">        </span>}</div><div><span style="white-space:pre-wrap">        </span></div><div><span style="white-space:pre-wrap">        </span>if (t_was_cancelled()) {</div>
<div><span style="white-space:pre-wrap">                </span>exit;</div><div><span style="white-space:pre-wrap">        </span>}</div><div><br></div><div><br></div><div><br></div><div>}</div></div><div><br></div><div><br></div><div>
==== EXTRACT FROM syslog =====</div><div><br></div><div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: [NjMzOGYxMGJjMGI5NzQzNTE3OWQ1NDBhYzcxMjcxOGU] Auth User [27877009000]</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:avpops:ops_dbquery_avps: query [select password from registrant where username = '27877009000']</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:db_mysql:mysql_raise_event: MySQL status has not changed: connected</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:db_new_result: allocate 28 bytes for result set at 0xb73d9a5c</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:db_mysql:db_mysql_get_columns: 1 columns returned from the query</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:db_allocate_columns: allocate 16 bytes for result columns at 0xb73d9a88</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:db_mysql:db_mysql_get_columns: RES_NAMES(0xb73d9a8c)[0]=[password]</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:db_mysql:db_mysql_get_columns: use DB_STRING result type</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:db_allocate_rows: allocate 28 bytes for result rows and values at 0xb73d9aa4</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:db_mysql:db_mysql_str2val: converting STRING [xxxxxxxx]</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:avpops:db_query_avp: rows [1]</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:avpops:db_query_avp: row [0]</div><div>
Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:avpops:db_close_query: close avp query</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:db_free_columns: freeing result columns at 0xb73d9a88</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:db_free_rows: freeing 1 rows</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:db_free_row: freeing row values at 0xb73d9aac</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:db_free_rows: freeing rows at 0xb73d9aa4</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:db_free_result: freeing result set at 0xb73d9a5c</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:pv_get_spec_value: Found context function 0xb6fa4abd</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:parse_headers: flags=ffffffffffffffff</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:get_hdr_field: content_length=0</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:get_hdr_field: found end of header</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:subst_run: running. r=0</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:subst_run: matched (0, 7): [Digest ]</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:avpops:ops_subst: subst to 1 avps</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:parse_csv: Parsing csv for : [realm="196.28.136.80",nonce="0a88ebc4eb91e7a1e2910f35e76191b6c66f"]</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:comp_scriptvar: int 26 : 0 / 2</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:subst_run: running. r=0</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:subst_run: matched (0, 21): [realm="196.28.136.80"]</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:avpops:ops_subst: subst to 1 avps</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:comp_scriptvar: int 26 : 1 / 2</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:comp_scriptvar: int 26 : 2 / 2</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: [NjMzOGYxMGJjMGI5NzQzNTE3OWQ1NDBhYzcxMjcxOGU] authrealm is [196.28.136.80], authuser is [27877009000], authpass is [xxxxxxxx]</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:uac:uac_auth: picked reply is 0xb73ca714, code 401</div>
<div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:parse_authenticate_body: <realm>="196.28.136.80" state=2</div><div>Jan 17 12:52:24 opensips4 /usr/src/opensips_1_10/opensips[1939]: DBG:core:parse_authenticate_body: <nonce>="0a88ebc4eb91e7a1e2910f35e76191b6c66f" state=3</div>
<div>Jan 17 12:52:24 opensips4 kernel: [ 249.123055] show_signal_msg: 15 callbacks suppressed</div><div>Jan 17 12:52:24 opensips4 kernel: [ 249.123060] opensips[1939]: segfault at 0 ip (null) sp bfde82ec error 14 in opensips[8048000+1a6000]</div>
<div>Jan 17 12:52:25 opensips4 /usr/src/opensips_1_10/opensips[1956]: DBG:tm:utimer_routine: timer routine:4,tl=0xb5003a5c next=(nil), timeout=4600000</div><div>Jan 17 12:52:25 opensips4 /usr/src/opensips_1_10/opensips[1968]: CRITICAL:core:receive_fd: EOF on 21</div>
<div>Jan 17 12:52:25 opensips4 /usr/src/opensips_1_10/opensips[1968]: DBG:core:handle_ser_child: dead child 10, pid 1939 (shutting down?)</div><div>Jan 17 12:52:25 opensips4 /usr/src/opensips_1_10/opensips[1968]: DBG:core:io_watch_del: io_watch_del op on index -1 21 (0x8213340, 21, -1, 0x0,0x1) fd_no=27 called</div>
<div>Jan 17 12:52:25 opensips4 /usr/src/opensips_1_10/opensips[1967]: INFO:core:sig_usr: signal 15 received</div><div>Jan 17 12:52:25 opensips4 /usr/src/opensips_1_10/opensips[1966]: INFO:core:sig_usr: signal 15 received</div>
<div>Jan 17 12:52:25 opensips4 /usr/src/opensips_1_10/opensips[1965]: INFO:core:sig_usr: signal 15 received</div></div><div><br></div><div>==== Back trace =====</div><div><br></div><div>available upon request</div><div><br>
</div><div><br></div><div><br></div>
<div>Any ideas?</div><div><br></div><div>Regards,</div><div><div><div dir="ltr"><div><b><br></b></div><b>Justin Zondagh<br></b><a href="mailto:zondagh@gmail.com" target="_blank">zondagh@gmail.com</a><br><br>Cape Town | South Africa<div>
skype: jrzondagh</div><div>m: <a href="tel:%2B27%2072%20598%204887" value="+27725984887" target="_blank">+27 72 598 4887</a> | f: <a href="tel:%2B27%2086%20546%201405" value="+27865461405" target="_blank">+27 86 546 1405</a></div>
<div>uk:<b> </b><a href="tel:%2B44%2020%20328%2099610" value="+442032899610" target="_blank">+44 20 328 99610</a></div></div></div>
</div></div>
</div><br></div>