sorcery: Make is_object_field_registered handle field names that are regexes.
authorGeorge Joseph <george.joseph@fairview5.com>
Fri, 21 Nov 2014 17:49:39 +0000 (17:49 +0000)
committerGeorge Joseph <george.joseph@fairview5.com>
Fri, 21 Nov 2014 17:49:39 +0000 (17:49 +0000)
commit4394e0431c81e80741273e4f3f63be4137716ff5
treec53b605fe5fe54bb7d2d8768d476bff8f64b7437
parentd663e045f5613ba5b0620a3bb6f3f0fe0c35b1dc
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/
........

Merged revisions 428543 from http://svn.asterisk.org/svn/asterisk/branches/12
........

Merged revisions 428544 from http://svn.asterisk.org/svn/asterisk/branches/13

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