]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res/res_phoneprov: Bail on registration if res_phoneprov didn't load
authorMatthew Jordan <mjordan@digium.com>
Fri, 10 Oct 2014 14:30:43 +0000 (14:30 +0000)
committerMatthew Jordan <mjordan@digium.com>
Fri, 10 Oct 2014 14:30:43 +0000 (14:30 +0000)
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.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@425220 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_phoneprov.c

index f3f975b714b2035f131995c6112517f6c777a787..6b0b91c2735f84914e33087f1b78dbd5be2b99b3 100644 (file)
@@ -1501,6 +1501,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);