aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_chanspy.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-13 21:38:16 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-03-13 21:38:16 +0000
commit9de01fb3abcbdb0ff3f86cf681312d069a637e62 (patch)
tree328a01455a79762006feaaa5e9a01d520465436d /apps/app_chanspy.c
parent89a1622c3cce158491be6cf1d4eca05a51534f4f (diff)
Fix another issue that was causing crashes in chanspy. This introduces a new
datastore callback, called chan_fixup(). The concept is exactly like the fixup callback that is used in the channel technology interface. This callback gets called when the owning channel changes due to a masquerade. Before this was introduced, if a masquerade happened on a channel being spyed on, the channel pointer in the datastore became invalid. (closes issue #12187) (reported by, and lots of testing from atis) (props to file for the help with ideas) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@108583 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_chanspy.c')
-rw-r--r--apps/app_chanspy.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c
index f2951c3d5..41e658037 100644
--- a/apps/app_chanspy.c
+++ b/apps/app_chanspy.c
@@ -390,9 +390,19 @@ static void chanspy_ds_destroy(void *data)
ast_mutex_unlock(&chanspy_ds->lock);
}
+static void chanspy_ds_chan_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
+{
+ struct chanspy_ds *chanspy_ds = data;
+
+ ast_mutex_lock(&chanspy_ds->lock);
+ chanspy_ds->chan = new_chan;
+ ast_mutex_unlock(&chanspy_ds->lock);
+}
+
static const struct ast_datastore_info chanspy_ds_info = {
.type = "chanspy",
.destroy = chanspy_ds_destroy,
+ .chan_fixup = chanspy_ds_chan_fixup,
};
static struct chanspy_ds *chanspy_ds_free(struct chanspy_ds *chanspy_ds)