Merged revisions 61690 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61690 | russell | 2007-04-20 13:19:18 -0500 (Fri, 20 Apr 2007) | 4 lines

Fix the UpdateConfig manager action to properly treat "variables" and "objects"
differently (a=b versus a=>b).
(issue #9568, reported by pari, patch by me)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@61691 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2007-04-20 18:23:24 +00:00
parent 49af71c100
commit 97d0661327
4 changed files with 39 additions and 45 deletions

View File

@@ -1121,6 +1121,8 @@ static void handle_updates(struct mansession *s, const struct message *m, struct
struct ast_variable *v;
for (x=0;x<100000;x++) {
unsigned int object = 0;
snprintf(hdr, sizeof(hdr), "Action-%06d", x);
action = astman_get_header(m, hdr);
if (ast_strlen_zero(action))
@@ -1131,6 +1133,10 @@ static void handle_updates(struct mansession *s, const struct message *m, struct
var = astman_get_header(m, hdr);
snprintf(hdr, sizeof(hdr), "Value-%06d", x);
value = astman_get_header(m, hdr);
if (!ast_strlen_zero(value) && *value == '>') {
object = 1;
value++;
}
snprintf(hdr, sizeof(hdr), "Match-%06d", x);
match = astman_get_header(m, hdr);
if (!strcasecmp(action, "newcat")) {
@@ -1151,7 +1157,7 @@ static void handle_updates(struct mansession *s, const struct message *m, struct
ast_category_delete(cfg, cat);
} else if (!strcasecmp(action, "update")) {
if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) && (category = ast_category_get(cfg, cat)))
ast_variable_update(category, var, value, match);
ast_variable_update(category, var, value, match, object);
} else if (!strcasecmp(action, "delete")) {
if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) && (category = ast_category_get(cfg, cat)))
ast_variable_delete(category, var, match);
@@ -1159,7 +1165,7 @@ static void handle_updates(struct mansession *s, const struct message *m, struct
if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) &&
(category = ast_category_get(cfg, cat)) &&
(v = ast_variable_new(var, value))){
if (match && !strcasecmp(match, "object"))
if (object || (match && !strcasecmp(match, "object")))
v->object = 1;
ast_variable_append(category, v);
}