]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
res_pjsip_config_wizard: Fix change detection for wizard settings
authorSean Bright <sean.bright@gmail.com>
Sun, 5 Jan 2020 16:00:46 +0000 (11:00 -0500)
committerSean Bright <sean.bright@gmail.com>
Sun, 5 Jan 2020 16:12:54 +0000 (10:12 -0600)
ast_sorcery_changeset_create() is not commutative and will fail to detect
differences between two variable lists depending on what changed, so switch to
ast_variable_lists_match().

ASTERISK-28492 #close
Reported by: Jean-Denis Girard

Change-Id: I7b3256983ddfaa2138d3de92a444a53b5193a4e1

res/res_pjsip_config_wizard.c

index 4d24922880ef6be3d583faf2aff62bc6f7a3ad5f..aec4b58ac055ad74cdfe3650a807fd411cf2343e 100644 (file)
@@ -1101,18 +1101,17 @@ static void object_type_loaded_observer(const char *name,
        while ((category = ast_category_browse_filtered(cfg, NULL, category, "type=^wizard$"))) {
                const char *id = ast_category_get_name(category);
                struct ast_category *last_cat = NULL;
-               struct ast_variable *change_set = NULL;
+               int changes = 0;
 
                if (otw->last_config) {
                        last_cat = ast_category_get(otw->last_config, id, "type=^wizard$");
-                       ast_sorcery_changeset_create(ast_category_first(category), ast_category_first(last_cat), &change_set);
+                       changes = !ast_variable_lists_match(ast_category_first(category), ast_category_first(last_cat), 1);
                        if (last_cat) {
                                ast_category_delete(otw->last_config, last_cat);
                        }
                }
 
-               if (!last_cat || change_set) {
-                       ast_variables_destroy(change_set);
+               if (!last_cat || changes) {
                        ast_debug(3, "%s: %s(s) for wizard '%s'\n", reloaded ? "Reload" : "Load", object_type, id);
                        if (wizard_apply_handler(sorcery, otw, category)) {
                                ast_log(LOG_ERROR, "Unable to create objects for wizard '%s'\n", id);