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: https://origsvn.digium.com/svn/asterisk/branches/1.4@108583 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2008-03-13 21:38:16 +00:00
parent a10f524dfb
commit efa3b46cdf
3 changed files with 32 additions and 1 deletions

View File

@@ -154,6 +154,21 @@ struct ast_datastore_info {
const char *type; /*!< Type of data store */
void *(*duplicate)(void *data); /*!< Duplicate item data (used for inheritance) */
void (*destroy)(void *data); /*!< Destroy function */
/*!
* \brief Fix up channel references
*
* \arg data The datastore data
* \arg old_chan The old channel owning the datastore
* \arg new_chan The new channel owning the datastore
*
* This is exactly like the fixup callback of the channel technology interface.
* It allows a datastore to fix any pointers it saved to the owning channel
* in case that the owning channel has changed. Generally, this would happen
* when the datastore is set to be inherited, and a masquerade occurs.
*
* \return nothing.
*/
void (*chan_fixup)(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan);
};
/*! \brief Structure for a channel data store */