[sr-dev] [kamailio] auth_db is_subscriber looks up credentials even with flag 2 or 3 set, then dies with multiple credentials to lookup (#500)

Anthony Messina notifications at github.com
Sun Feb 7 01:48:29 CET 2016


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 at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20160206/2375027c/attachment.html>


More information about the sr-dev mailing list