From e9f09ab2bce1e1aa1b619507b45d228bbc49f12c Mon Sep 17 00:00:00 2001
From: Matthew Jordan <mjordan@digium.com>
Date: Fri, 30 May 2014 12:05:33 +0000
Subject: [PATCH] main/config.c: AMI action UpdateConfig EmptyCat clears all
 categories

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)
........

Merged revisions 414880 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 414881 from http://svn.asterisk.org/svn/asterisk/branches/11
........

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


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414883 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 main/config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main/config.c b/main/config.c
index 30817be416..a3d82f4f88 100644
--- a/main/config.c
+++ b/main/config.c
@@ -1168,7 +1168,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;
-- 
GitLab