summaryrefslogtreecommitdiff
path: root/main/pbx.c
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2014-05-29 18:51:41 +0000
committerKinsey Moore <kmoore@digium.com>2014-05-29 18:51:41 +0000
commite039996571226f705f50d5af1a65ff8fff58da6c (patch)
tree337a4a4901c72d73fd2fa68800f5b6643d1797c8 /main/pbx.c
parentfb5690ce4b9ff896a56fe9b9eb9eeed1a2b5f028 (diff)
PBX: Prevent incorrect hint parsing
Dynamic and pattern matching hints should not be checked for their last known state until they are instantiated by subscribers. (closes issue AFS-56) Reported by: John Hardin Patch AFS-56-pbx.diff submitted by Matt Jordan (license 6283) ........ Merged revisions 414813 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 414859 from http://svn.asterisk.org/svn/asterisk/branches/11 ........ Merged revisions 414860 from http://svn.asterisk.org/svn/asterisk/branches/12 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@414861 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/pbx.c')
-rw-r--r--main/pbx.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/main/pbx.c b/main/pbx.c
index 0d0c7aafa..2d9e15b08 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -5752,12 +5752,18 @@ static int ast_add_hint(struct ast_exten *e)
return -1;
}
hint_new->exten = e;
- hint_new->laststate = ast_extension_state2(e, NULL);
- if ((presence_state = extension_presence_state_helper(e, &subtype, &message)) > 0) {
- hint_new->last_presence_state = presence_state;
- hint_new->last_presence_subtype = subtype;
- hint_new->last_presence_message = message;
- message = subtype = NULL;
+ if (strstr(e->app, "${") && e->exten[0] == '_') {
+ /* The hint is dynamic and hasn't been evaluted yet */
+ hint_new->laststate = AST_DEVICE_INVALID;
+ hint_new->last_presence_state = AST_PRESENCE_INVALID;
+ } else {
+ hint_new->laststate = ast_extension_state2(e, NULL);
+ if ((presence_state = extension_presence_state_helper(e, &subtype, &message)) > 0) {
+ hint_new->last_presence_state = presence_state;
+ hint_new->last_presence_subtype = subtype;
+ hint_new->last_presence_message = message;
+ message = subtype = NULL;
+ }
}
/* Prevent multiple add hints from adding the same hint at the same time. */
@@ -7750,7 +7756,11 @@ static int show_dialplan_helper(int fd, const char *context, const char *exten,
struct ast_exten *e;
struct ast_include *i;
struct ast_ignorepat *ip;
+#ifndef LOW_MEMORY
+ char buf[1024], buf2[1024];
+#else
char buf[256], buf2[256];
+#endif
int context_info_printed = 0;
if (context && strcmp(ast_get_context_name(c), context))