diff options
author | Matthew Jordan <mjordan@digium.com> | 2013-01-02 18:11:59 +0000 |
---|---|---|
committer | Matthew Jordan <mjordan@digium.com> | 2013-01-02 18:11:59 +0000 |
commit | 8fb5bdce9ab9f7f3758545753cbc787653920753 (patch) | |
tree | 65809194af8a4fa757fef26a30a2cc9c3ed02182 /res/res_calendar.c | |
parent | 1fb06fde957fb466388c764384c2e14698e2dc15 (diff) |
Prevent exhaustion of system resources through exploitation of event cache
Asterisk maintains an internal cache for devices in the event subsystem. The
device state cache holds the state of each device known to Asterisk, such that
consumers of device state information can query for the last known state for
a particular device, even if it is not part of an active call. The concept of
a device in Asterisk can include entities that do not have a physical
representation. One way that this occurred was when anonymous calls are allowed
in Asterisk. A device was automatically created and stored in the cache for
each anonymous call that occurred; this was possible in the SIP and IAX2
channel drivers and through channel drivers that utilized the
res_jabber/res_xmpp resource modules (Gtalk, Jingle, and Motif). These devices
are never removed from the system, allowing anonymous calls to potentially
exhaust a system's resources.
This patch changes the event cache subsystem and device state management to
no longer cache devices that are not associated with a physical entity.
(issue ASTERISK-20175)
Reported by: Russell Bryant, Leif Madsen, Joshua Colp
Tested by: kmoore
patches:
event-cachability-3.diff uploaded by jcolp (license 5000)
........
Merged revisions 378303 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 378320 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Merged revisions 378321 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@378322 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_calendar.c')
-rw-r--r-- | res/res_calendar.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/res/res_calendar.c b/res/res_calendar.c index ed441d10a..fd4237513 100644 --- a/res/res_calendar.c +++ b/res/res_calendar.c @@ -620,9 +620,9 @@ static struct ast_calendar_event *destroy_event(struct ast_calendar_event *event * but haven't hit the end event yet, go ahead and set the devicestate to the current busy status */ if (event->bs_start_sched < 0 && event->bs_end_sched >= 0) { if (!calendar_is_busy(event->owner)) { - ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Calendar:%s", event->owner->name); + ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Calendar:%s", event->owner->name); } else { - ast_devstate_changed(AST_DEVICE_BUSY, "Calendar:%s", event->owner->name); + ast_devstate_changed(AST_DEVICE_BUSY, AST_DEVSTATE_CACHABLE, "Calendar:%s", event->owner->name); } } @@ -880,9 +880,9 @@ static int calendar_devstate_change(const void *data) /* We can have overlapping events, so ignore the event->busy_state and check busy state * based on all events in the calendar */ if (!calendar_is_busy(event->owner)) { - ast_devstate_changed(AST_DEVICE_NOT_INUSE, "Calendar:%s", event->owner->name); + ast_devstate_changed(AST_DEVICE_NOT_INUSE, AST_DEVSTATE_CACHABLE, "Calendar:%s", event->owner->name); } else { - ast_devstate_changed(AST_DEVICE_BUSY, "Calendar:%s", event->owner->name); + ast_devstate_changed(AST_DEVICE_BUSY, AST_DEVSTATE_CACHABLE, "Calendar:%s", event->owner->name); } event = ast_calendar_unref_event(event); |