summaryrefslogtreecommitdiff
path: root/include/asterisk
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2015-06-08 11:09:22 -0400
committerCorey Farrell <git@cfware.com>2015-06-08 11:09:22 -0400
commit55c8daf88b94f74e334ab246c51bdb7b469eedc4 (patch)
tree8c79fa393e6f2427929d2f89bf0bd4ee03b25a09 /include/asterisk
parent720251f2b80639324a37b2041997292d97858d39 (diff)
Fix unsafe uses of ast_context pointers.
Although ast_context_find, ast_context_find_or_create and ast_context_destroy perform locking of the contexts table, any context pointer can become invalid at any time that the contexts table is unlocked. This change adds locking around all complete operations involving these functions. Places where ast_context_find was followed by ast_context_destroy have been replaced with calls ast_context_destroy_by_name. ASTERISK-25094 #close Reported by: Corey Farrell Change-Id: I1866b6787730c9c4f3f836b6133ffe9c820734fa
Diffstat (limited to 'include/asterisk')
-rw-r--r--include/asterisk/pbx.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index 795af0584..599745878 100644
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -300,7 +300,21 @@ struct ast_context *ast_context_find_or_create(struct ast_context **extcontexts,
void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar);
/*!
- * \brief Destroy a context (matches the specified context (or ANY context if NULL)
+ * \brief Destroy a context by name
+ *
+ * \param context Name of the context to destroy
+ * \param registrar who registered it
+ *
+ * You can optionally leave out the registrar parameter. It will find it
+ * based on the context name.
+ *
+ * \retval -1 context not found
+ * \retval 0 Success
+ */
+int ast_context_destroy_by_name(const char *context, const char *registrar);
+
+/*!
+ * \brief Destroy a context (matches the specified context or ANY context if NULL)
*
* \param con context to destroy
* \param registrar who registered it