]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Don't perform a realtime lookup with a NULL keyword
authorMatthew Jordan <mjordan@digium.com>
Wed, 8 May 2013 18:36:21 +0000 (18:36 +0000)
committerMatthew Jordan <mjordan@digium.com>
Wed, 8 May 2013 18:36:21 +0000 (18:36 +0000)
Previously, a call to ast_load_realtime_multientry could get away with
passing a NULL parameter to the function, even though it really isn't
supposed to do that. After the change over to using ast_variable instead
of variadic arguments, the realtime engine gets unhappy if you do this.

This was always an unintended function call in app_directory anyway - now,
we just don't call into the realtime function calls if we don't have anything
to query on.

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

apps/app_directory.c

index b26a09cd9777709ec837d8c4056a2fc6413f3681..edfc349ea7ea6279c628fd13db9fdf129e3f123a 100644 (file)
@@ -440,7 +440,7 @@ AST_THREADSTORAGE(commonbuf);
 static struct ast_config *realtime_directory(char *context)
 {
        struct ast_config *cfg;
-       struct ast_config *rtdata;
+       struct ast_config *rtdata = NULL;
        struct ast_category *cat;
        struct ast_variable *var;
        char *mailbox;
@@ -475,7 +475,7 @@ static struct ast_config *realtime_directory(char *context)
                        rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", "context", "default", SENTINEL);
                        context = "default";
                }
-       } else {
+       } else if (!ast_strlen_zero(context)) {
                rtdata = ast_load_realtime_multientry("voicemail", "mailbox LIKE", "%", "context", context, SENTINEL);
        }