I want to add a few columns to the ```subscriber``` table to simplify setting a few headers I also use ```is_subscriber``` in ```route[LOCATION]``` to only save MESSAGEs (msilo) for subscribers
When using is_subscriber with ```3``` set for the flag, Kamailio should include the domain in the check and according to the auth_db documentation, "the credentials are not loaded in variables"
However, Kamailio still attempts to lookup and store the credentials configured with ```modparam("auth_db", "load_credentials", "rpid")```
``` ERROR: *** cfgtrace:request_route=[LOCATION] c=[/etc/kamailio/kamailiocfg] l=1064 a=27 n=is_subscriber DEBUG: auth_db [auth_db_modc:262]: w_is_subscriber(): uri [sip:86@examplecom] table [subscriber] flags [3] DEBUG: db_postgres [km_valc:163]: db_postgres_val2str(): PQescapeStringConn: in: 2 chars, out: 2 chars DEBUG: db_postgres [km_valc:163]: db_postgres_val2str(): PQescapeStringConn: in: 12 chars, out: 12 chars DEBUG: db_postgres [km_dbasec:271]: db_postgres_submit_query(): sending query ok: 0x7fdf607ed268 (2) - [select rpid from subscriber where username='86' AND domain='examplecom'] DEBUG: <core> [db_resc:115]: db_new_result(): allocate 56 bytes for result set at 0x7fdf6089af20 DEBUG: db_postgres [km_dbasec:551]: db_postgres_store_result(): 0x7fdf607ed268 PQresultStatus(PGRES_TUPLES_OK) PQgetResult(0x2860ad0) DEBUG: db_postgres [km_resc:108]: db_postgres_get_columns(): 1 columns returned from the query DEBUG: <core> [db_resc:152]: db_allocate_columns(): allocate 8 bytes for result names at 0x7fdf60864270 DEBUG: <core> [db_resc:163]: db_allocate_columns(): allocate 4 bytes for result types at 0x7fdf6074ad38 DEBUG: db_postgres [km_resc:125]: db_postgres_get_columns(): allocate 16 bytes for RES_NAMES[0] at 0x7fdf60940270 DEBUG: db_postgres [km_resc:132]: db_postgres_get_columns(): RES_NAMES(0x7fdf60940270)[0]=[rpid] DEBUG: db_postgres [km_resc:166]: db_postgres_get_columns(): use DB1_STRING result type DEBUG: db_postgres [km_resc:211]: db_postgres_convert_rows(): no rows returned from the query DEBUG: <core> [db_resc:79]: db_free_columns(): freeing 1 columns DEBUG: <core> [db_resc:83]: db_free_columns(): freeing RES_NAMES[0] at 0x7fdf60940270 DEBUG: <core> [db_resc:92]: db_free_columns(): freeing result names at 0x7fdf60864270 DEBUG: <core> [db_resc:97]: db_free_columns(): freeing result types at 0x7fdf6074ad38 DEBUG: <core> [db_resc:134]: db_free_result(): freeing result set at 0x7fdf6089af20 DEBUG: db_postgres [km_dbasec:433]: db_postgres_free_query(): PQclear(0x2860ad0) result set DEBUG: auth_db [authorizec:102]: fetch_credentials(): no result for user '86@examplecom' in [subscriber] ```
When adding additional parameters such as ```modparam("auth_db", "load_credentials", "rpid;accountcode")``` and executing ```if(is_subscriber("$ru", "subscriber", "3"))```, Kamailio quits ``` ERROR: *** cfgtrace:request_route=[LOCATION] c=[/etc/kamailio/kamailiocfg] l=1064 a=27 n=is_subscriber : <core> [mem/q_mallocc:130]: qm_debug_frag(): BUG: qm_*: fragm 0x7f7126bafc70 (address 0x7f7126bafca0) end overwritten(7f7126ad32c0, abcdefed)! CRITICAL: <core> [pass_fdc:275]: receive_fd(): EOF on 20 ALERT: <core> [mainc:727]: handle_sigs(): child process 21406 exited by a signal 6 ```
I don't see why Kamailio should even lookup the additional values when the ```is_subscriber``` flag is ```2``` or ```3```
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/500
Can you provide the gdb backtrace for the second case, exiting by signal 6?
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/500#issuecomment-180980657
For the case when is_subscriber() has the flag 2 set (not to load the credentials), the query is done only using the column of the first credential in order to see if the username record exists. If there will be no credentials list, then the username column is used for the query. But even when the first credential column is used, the avp will not be set (it is just used for the sql query).
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/500#issuecomment-180983951
@miconda, I've sent a backtrace to your gmail address.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/500#issuecomment-181026913
I pushed the fix to master and 4.3, can you try and confirm all ok?
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/500#issuecomment-181089319
Closed #500.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/500#event-542326613
Yes, it looks like 4602f2d fixed the issue. Thank you @miconda.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/500#issuecomment-181122283