summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2014-10-10 14:31:42 +0000
committerMatthew Jordan <mjordan@digium.com>2014-10-10 14:31:42 +0000
commitc3ff212caeacbf972593002d9e7a426db4b1c105 (patch)
tree15d47eee30c0fd045fc102108642821faa918657
parentc46100ad5f96f050d2c31ae3d7026e2ae9214571 (diff)
res/res_phoneprov: Bail on registration if res_phoneprov didn't load
If res_phoneprov failed to fully load (due to not being configured), the providers container will be NULL. If a module attempts to register a phone provisioning provider, it should check for the presence of the container. If there is no providers container, it should return an error. This patch makes the ast_phoneprov_provider_register function do that... otherwise this would be a silly commit message. ........ Merged revisions 425220 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 425221 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@425222 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--res/res_phoneprov.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c
index aa082c738..ef5a890fe 100644
--- a/res/res_phoneprov.c
+++ b/res/res_phoneprov.c
@@ -1502,6 +1502,11 @@ int ast_phoneprov_provider_register(char *provider_name,
return -1;
}
+ if (!providers) {
+ ast_log(LOG_WARNING, "Provider '%s' cannot be registered: res_phoneprov not loaded.\n", provider_name);
+ return -1;
+ }
+
provider = find_provider(provider_name);
if (provider) {
ast_log(LOG_ERROR, "There is already a provider registered named '%s'.\n", provider_name);