提交 1cfd145c authored 作者: Anthony Minessale's avatar Anthony Minessale

add support for variable expander to recognize 717 vars as specificly globals

上级 2a257a56
...@@ -3411,12 +3411,16 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c ...@@ -3411,12 +3411,16 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c
memset(data, 0, olen); memset(data, 0, olen);
c = data; c = data;
for (p = indup; p && p < endof_indup && *p; p++) { for (p = indup; p && p < endof_indup && *p; p++) {
int global = 0;
vtype = 0; vtype = 0;
if (*p == '\\') { if (*p == '\\') {
if (*(p + 1) == '$') { if (*(p + 1) == '$') {
nv = 1; nv = 1;
p++; p++;
if (*(p + 1) == '$') {
p++;
}
} else if (*(p + 1) == '\'') { } else if (*(p + 1) == '\'') {
p++; p++;
continue; continue;
...@@ -3428,9 +3432,15 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c ...@@ -3428,9 +3432,15 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c
} }
if (*p == '$' && !nv) { if (*p == '$' && !nv) {
if (*(p + 1) == '$') {
p++;
global++;
}
if (*(p + 1)) { if (*(p + 1)) {
if (*(p + 1) == '{') { if (*(p + 1) == '{') {
vtype = 1; vtype = global ? 3 : 1;
} else { } else {
nv = 1; nv = 1;
} }
...@@ -3452,7 +3462,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c ...@@ -3452,7 +3462,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c
s++; s++;
if (vtype == 1 && *s == '{') { if ((vtype == 1 || vtype == 3) && *s == '{') {
br = 1; br = 1;
s++; s++;
} }
...@@ -3513,7 +3523,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c ...@@ -3513,7 +3523,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c
vtype = 2; vtype = 2;
} }
if (vtype == 1) { if (vtype == 1 || vtype == 3) {
char *expanded = NULL; char *expanded = NULL;
int offset = 0; int offset = 0;
int ooffset = 0; int ooffset = 0;
...@@ -3540,7 +3550,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c ...@@ -3540,7 +3550,7 @@ SWITCH_DECLARE(char *) switch_channel_expand_variables_check(switch_channel_t *c
idx = atoi(ptr); idx = atoi(ptr);
} }
if ((sub_val = (char *) switch_channel_get_variable_dup(channel, vname, SWITCH_TRUE, idx))) { if (vtype == 3 || (sub_val = (char *) switch_channel_get_variable_dup(channel, vname, SWITCH_TRUE, idx))) {
if (var_list && !switch_event_check_permission_list(var_list, vname)) { if (var_list && !switch_event_check_permission_list(var_list, vname)) {
sub_val = "INVALID"; sub_val = "INVALID";
} }
......
...@@ -1957,12 +1957,16 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, ...@@ -1957,12 +1957,16 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event,
memset(data, 0, olen); memset(data, 0, olen);
c = data; c = data;
for (p = indup; p && p < endof_indup && *p; p++) { for (p = indup; p && p < endof_indup && *p; p++) {
int global = 0;
vtype = 0; vtype = 0;
if (*p == '\\') { if (*p == '\\') {
if (*(p + 1) == '$') { if (*(p + 1) == '$') {
nv = 1; nv = 1;
p++; p++;
if (*(p + 1) == '$') {
p++;
}
} else if (*(p + 1) == '\'') { } else if (*(p + 1) == '\'') {
p++; p++;
continue; continue;
...@@ -1974,9 +1978,14 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, ...@@ -1974,9 +1978,14 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event,
} }
if (*p == '$' && !nv) { if (*p == '$' && !nv) {
if (*(p + 1) == '$') {
p++;
global++;
}
if (*(p + 1)) { if (*(p + 1)) {
if (*(p + 1) == '{') { if (*(p + 1) == '{') {
vtype = 1; vtype = global ? 3 : 1;
} else { } else {
nv = 1; nv = 1;
} }
...@@ -1998,7 +2007,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, ...@@ -1998,7 +2007,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event,
s++; s++;
if (vtype == 1 && *s == '{') { if ((vtype == 1 || vtype == 3) && *s == '{') {
br = 1; br = 1;
s++; s++;
} }
...@@ -2060,7 +2069,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, ...@@ -2060,7 +2069,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event,
vtype = 2; vtype = 2;
} }
if (vtype == 1) { if (vtype == 1 || vtype == 3) {
char *expanded = NULL; char *expanded = NULL;
int offset = 0; int offset = 0;
int ooffset = 0; int ooffset = 0;
...@@ -2086,7 +2095,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event, ...@@ -2086,7 +2095,7 @@ SWITCH_DECLARE(char *) switch_event_expand_headers_check(switch_event_t *event,
idx = atoi(ptr); idx = atoi(ptr);
} }
if (!(sub_val = switch_event_get_header_idx(event, vname, idx))) { if (vtype == 3 || !(sub_val = switch_event_get_header_idx(event, vname, idx))) {
switch_safe_free(gvar); switch_safe_free(gvar);
if ((gvar = switch_core_get_variable_dup(vname))) { if ((gvar = switch_core_get_variable_dup(vname))) {
sub_val = gvar; sub_val = gvar;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论