]> git.ipfire.org Git - thirdparty/asterisk.git/commit
sorcery: Make is_object_field_registered handle field names that are regexes.
authorGeorge Joseph <george.joseph@fairview5.com>
Fri, 21 Nov 2014 17:41:15 +0000 (17:41 +0000)
committerGeorge Joseph <george.joseph@fairview5.com>
Fri, 21 Nov 2014 17:41:15 +0000 (17:41 +0000)
commit3ecfa0e1aca75923b0615f0d0907873011ce78e9
tree6a183ea8eebc84de02c514d3460f7c1bf8411453
parenta26057ea42c3e24f474e9211572e76556f818d48
sorcery: Make is_object_field_registered handle field names that are regexes.

As a result of https://reviewboard.asterisk.org/r/3305, res_sorcery_realtime
was tossing database fields that didn't have an exact match to a sorcery
registered field.  This broke the ability to use regexes as field names which
manifested itself as a failure of res_pjsip_phoneprov_provider which uses
this capability.  It also broke handling of fields that start with '@' in
realtime but I don't think anyone noticed.

This patch does the following...
* Modifies ast_sorcery_fields_register to pre-compile the name regex.
* Modifies ast_sorcery_is_object_field_registered to test the regex if it
  exists instead of doing an exact strcmp.
* Modifies res_pjsip_phoneprov_provider with a few tweaks to get it to work
  with realtime.

Tested-by: George Joseph
Review: https://reviewboard.asterisk.org/r/4185/

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@428543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
main/sorcery.c
res/res_pjsip_phoneprov_provider.c
tests/test_sorcery.c