]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
main/config.c: AMI action UpdateConfig EmptyCat clears all categories
authorMatthew Jordan <mjordan@digium.com>
Fri, 30 May 2014 11:50:59 +0000 (11:50 +0000)
committerMatthew Jordan <mjordan@digium.com>
Fri, 30 May 2014 11:50:59 +0000 (11:50 +0000)
When invoking UpdateConfig AMI action with Action set to EmptyCat, Asterisk
will make all categories empty in the config but the one requested with a
Cat variable. This is due to a bug in ast_category_empty (main/config.c)
that makes an incorrect comparison for a category name.

This patch corrects the comparison such that only the requested category
is cleared.

Review: https://reviewboard.asterisk.org/r/3573/

ASTERISK-23803 #close
Reported by: zvision
patches:
  manager.c.diff uploaded by zvision (License 5755)

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

main/config.c

index e8c5cf7d7a0d60086af0db4e3b45837c989fa487..5d4f195857bedd32299f22cd859bb231f76b5a62 100644 (file)
@@ -994,7 +994,7 @@ int ast_category_empty(struct ast_config *cfg, const char *category)
        struct ast_category *cat;
 
        for (cat = cfg->root; cat; cat = cat->next) {
-               if (!strcasecmp(cat->name, category))
+               if (strcasecmp(cat->name, category))
                        continue;
                ast_variables_destroy(cat->root);
                cat->root = NULL;