manager: Make WaitEvent action respect eventfilters
authorGeorge Joseph <george.joseph@fairview5.com>
Sat, 30 Aug 2014 17:24:57 +0000 (17:24 +0000)
committerGeorge Joseph <george.joseph@fairview5.com>
Sat, 30 Aug 2014 17:24:57 +0000 (17:24 +0000)
A WaitEvent issued via an http session isn't respecting eventfilters defined
for the user. I just added a match_filter to the predicate that controls
astman_append.

Tested by: George Joseph
Review: https://reviewboard.asterisk.org/r/3958/
........

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

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

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

Merged revisions 422442 from http://svn.asterisk.org/svn/asterisk/branches/13

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422443 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index eef5f47..5303f18 100644 (file)
@@ -1373,6 +1373,8 @@ static AO2_GLOBAL_OBJ_STATIC(event_docs);
 
 static enum add_filter_result manager_add_filter(const char *filter_pattern, struct ao2_container *whitefilters, struct ao2_container *blackfilters);
 
+static int match_filter(struct mansession *s, char *eventdata);
+
 /*!
  * @{ \brief Define AMI message types.
  */
@@ -3593,8 +3595,9 @@ static int action_waitevent(struct mansession *s, const struct message *m)
                struct eventqent *eqe = s->session->last_ev;
                astman_send_response(s, m, "Success", "Waiting for Event completed.");
                while ((eqe = advance_event(eqe))) {
-                       if (((s->session->readperm & eqe->category) == eqe->category) &&
-                           ((s->session->send_events & eqe->category) == eqe->category)) {
+                       if (((s->session->readperm & eqe->category) == eqe->category)
+                               && ((s->session->send_events & eqe->category) == eqe->category)
+                               && match_filter(s, eqe->eventdata)) {
                                astman_append(s, "%s", eqe->eventdata);
                        }
                        s->session->last_ev = eqe;