[OpenSIPS-Users] core dump when using uac_registrant + db_text

Alexandr A. Alexandrov shurrman at gmail.com
Mon Oct 8 13:39:29 CEST 2012


Hello!

Ok, after commenting out all null values, I got registered (state 3).
The only thing - db_text module readme says that \t \n and \r have to be 
escaped. But in fact I had to remove escaping slashes in order for it to 
work...



08.10.2012 15:19, Alexandr A. Alexandrov пишет:
> Hello!
>
> Seems like when corresponding fields are empty - an exception occurs.
> When I comment out these parameters (setting string value to NULL and 
> .len=0), I get this:
>
> Program terminated with signal 11, Segmentation fault.
> #0  0x00007f88061cf3af in load_reg_info_from_db () at reg_db_handler.c:265
> 265                             uac_param.contact_params.len =
>
> Here is how the table fields go:
>
> username(string,null) password(string,null) binding_URI(string) 
> binding_params(string,null) expiry(int,null)
>
> But in the code I see this:
>
>                         /* Get the authentication user */
>                         uac_param.auth_user.s =
> (char*)values[username_col].val.string_val;
>                         uac_param.auth_user.len = 
> strlen(uac_param.auth_user.s);
>                         if (uac_param.auth_user.len == 0) 
> uac_param.auth_user.s = NULL;
>
>                         /* Get the authentication password */
>                         uac_param.auth_password.s =
> (char*)values[password_col].val.string_val;
>                         uac_param.auth_password.len = 
> strlen(uac_param.auth_password.s);
>                         if (uac_param.auth_password.len == 0)
>                                 uac_param.auth_password.s = NULL;
>
>                         /* Get the binding params */
>                         uac_param.contact_params.s =
> (char*)values[binding_params_col].val.string_val;
>                         uac_param.contact_params.len =
> strlen(uac_param.contact_params.s);
>                         if (uac_param.contact_params.len == 0)
>                                 uac_param.contact_params.s = NULL;
>
>                         /* Get the expiration param */
>                         uac_param.expires = 
> values[expiry_col].val.int_val;
>
> Looks like binding_URI is not processed?
> Also, is it ok that binding params are assigned to 
> uac_param.contact_params?
> It seems binding_URI is never processed (however it is required field).
>
>
> 08.10.2012 15:01, Alexandr A. Alexandrov пишет:
>> Hello!
>>
>> Program terminated with signal 11, Segmentation fault.
>> #0  0x00007f9aae966ddf in load_reg_info_from_db () at 
>> reg_db_handler.c:187
>> 187                             uac_param.proxy_uri.len =
>>
>>
>> (gdb) bt full
>> #0  0x00007f9aae966ddf in load_reg_info_from_db () at 
>> reg_db_handler.c:187
>>         res = (db_res_t *) 0x7f9ab136eaf8
>>         values = (db_val_t *) 0x7f9ab136dac8
>>         rows = (db_row_t *) 0x7f9ab136dab8
>>         nr_rows = <value optimized out>
>>         q_cols = {0x7f9aaeb73130, 0x7f9aaeb73140, 0x7f9aaeb73150, 
>> 0x7f9aaeb73160, 0x7f9aaeb73170, 0x7f9aaeb73180, 0x7f9aaeb73190, 
>> 0x7f9aaeb731a0,
>>   0x7f9aaeb731b0, 0x7f9aaeb731c0}
>>         p = <value optimized out>
>>         now = {s = 0x7f9ab136e960 "1349692979ion", len = 10}
>>         uri = {user = {s = 0x0, len = 0}, passwd = {s = 0x0, len = 
>> 0}, host = {s = 0x7f9ab135c8dc "wi\ngssof\t.ma\ngosip.\ru", len = 
>> 21}, port = {s = 0x0,
>>     len = 0}, params = {s = 0x0, len = 0}, headers = {s = 0x0, len = 
>> 0}, port_no = 0, proto = 0, type = SIP_URI_T, transport = {s = 0x0, 
>> len = 0}, ttl = {
>>     s = 0x0, len = 0}, user_param = {s = 0x0, len = 0}, maddr = {s = 
>> 0x0, len = 0}, method = {s = 0x0, len = 0}, lr = {s = 0x0, len = 0}, 
>> r2 = {s = 0x0,
>>     len = 0}, gr = {s = 0x0, len = 0}, transport_val = {s = 0x0, len 
>> = 0}, ttl_val = {s = 0x0, len = 0}, user_param_val = {s = 0x0, len = 
>> 0}, maddr_val = {
>>     s = 0x0, len = 0}, method_val = {s = 0x0, len = 0}, lr_val = {s = 
>> 0x0, len = 0}, r2_val = {s = 0x0, len = 0}, gr_val = {s = 0x0, len = 
>> 0}, u_name = {{
>>       s = 0x0, len = 0}, {s = 0x0, len = 0}, {s = 0x0, len = 0}, {s = 
>> 0x0, len = 0}, {s = 0x0, len = 0}}, u_val = {{s = 0x0, len = 0}, {s = 
>> 0x0, len = 0}, {
>>       s = 0x0, len = 0}, {s = 0x0, len = 0}, {s = 0x0, len = 0}}, 
>> u_params_no = 0}
>>         host = {s = 0x7d6f87 "/usr/local/etc/opensips/dbtext", len = 
>> -1363724976}
>>         port = <value optimized out>
>>         proto = <value optimized out>
>>         uac_param = {hash_code = 0, registrar_uri = {s = 
>> 0x7f9ab135c8d8 "sip:wi\ngssof\t.ma\ngosip.\ru", len = 25}, proxy_uri 
>> = {s = 0x0, len = 0},
>>   to_uri = {s = 0x0, len = 0}, from_uri = {s = 0x0, len = 0}, 
>> contact_uri = {s = 0x0, len = 0}, contact_params = {s = 0x0, len = 
>> 0}, auth_user = {s = 0x0,
>>     len = 0}, auth_password = {s = 0x0, len = 0}, expires = 0, 
>> send_sock = 0x0, next = 0x0}
>>         __FUNCTION__ = "load_reg_info_from_db"
>> #1  0x00007f9aae968cce in init_reg_db (db_url=0x7f9aaeb73550) at 
>> reg_db_handler.c:350
>>         __FUNCTION__ = "init_reg_db"
>> #2  0x00007f9aae96ab50 in mod_init () at registrant.c:198
>>         __FUNCTION__ = "mod_init"
>> #3  0x00000000004928b4 in init_mod (m=0x7f9ab13607a8) at sr_module.c:458
>>         __FUNCTION__ = "init_mod"
>> #4  0x00000000004311cf in main (argc=<value optimized out>, 
>> argv=0x7fffb9ee5fa8) at main.c:1466
>>         cfg_log_stderr = 0
>>         cfg_stream = (FILE *) 0x7c5010
>>         c = <value optimized out>
>>         r = <value optimized out>
>>         tmp = 0x7fffb9ee74e3 ""
>>         tmp_len = <value optimized out>
>>         port = <value optimized out>
>>         proto = <value optimized out>
>>         ret = <value optimized out>
>>         seed = 1449173645
>>         rfd = 4
>>         __FUNCTION__ = "main"
>>
>>
>>
>> 08.10.2012 13:59, Alexandr A. Alexandrov пишет:
>>> Hi!
>>>
>>> I am trying to use uac_registrant with db_text.
>>> Here is 'registrant' table:
>>>
>>> id(int,auto) registrar(string) proxy(string,null) aor(string) 
>>> third_party_registrant(string,null) username(string,null) 
>>> password(string,null) binding_URI(string) 
>>> binding_params(string,null) expiry(int,null) forced_socket(string,null)
>>> 1:sip\:wi\ngsof\t.ma\ngosip.\ru::sip\:mf\tes\t1 at wi\ngsof\t.ma\ngosip.\ru::mf\tes\t1:somepass:sip\:mf\tes\t1 at wi\ngsof\t.ma\ngosip.\ru::::
>>>
>>> The row seems to be ok (all escapes, \n in the end of line)
>>>
>>> Here is what I get in log:
>>>
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: request for table [registrant]
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: db is [/usr/local/etc/opensips/dbtext]
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: loading file 
>>> [/usr/local/etc/opensips/dbtext/registrant]
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_table_new: mtime is 1349689164
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[0] is INT!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[1] is STR!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[1] is actually STRING!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[2] is STR!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[2] is actually STRING!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[3] is STR!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[3] is actually STRING!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[4] is STR!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[4] is actually STRING!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[5] is STR!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[5] is actually STRING!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[6] is STR!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[6] is actually STRING!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[7] is STR!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[7] is actually STRING!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[8] is STR!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[8] is actually STRING!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[9] is INT!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[10] is STR!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_load_file: column[10] is actually STRING!
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_query: new res with 10 cols
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:db_text:dbt_result_new: new res with 10 cols
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:core:db_new_result: allocate 48 bytes for result set at 
>>> 0x7fdded96baf8
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:core:db_allocate_columns: allocate 280 bytes for result columns 
>>> at 0x7fdded96a988
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> DBG:core:db_allocate_rows: allocate 336 bytes for result rows and 
>>> values at 0x7fdded96aab8
>>> Oct  8 13:39:30 prod2 /usr/local/sbin/opensips[30380]: 
>>> INFO:uac_registrant:load_reg_info_from_db: loading [1] records from db
>>> Oct  8 13:39:30 prod2 kernel: opensips[30380]: segfault at 0 ip 
>>> 00007fddeaf63ddf sp 00007ffff64e0f60 error 4 in 
>>> uac_registrant.so[7fddeaf61000+e000]
>>> Oct  8 13:39:30 prod2 opensips: DBG:core:wait_status_code: read code 
>>> 0 ? rc = 0, errno=Inappropriate ioctl for device
>>> Oct  8 13:39:30 prod2 opensips: INFO:core:daemonize: pre-daemon 
>>> process exiting with -1
>>>
>>> Best reagrds,
>>> Alexandr A. Alexandrov
>>
>




More information about the Users mailing list