[asterisk-commits] bebuild: tag 12.5.1 r423448 - in /tags/12.5.1: ./ include/asterisk/ res/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Sep 18 12:34:43 CDT 2014
Author: bebuild
Date: Thu Sep 18 12:34:40 2014
New Revision: 423448
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=423448
Log:
Merge changes for AST-2014-010, AST-2014-009
Modified:
tags/12.5.1/ (props changed)
tags/12.5.1/ChangeLog
tags/12.5.1/include/asterisk/res_pjsip_pubsub.h
tags/12.5.1/res/res_fax_spandsp.c
tags/12.5.1/res/res_pjsip_dialog_info_body_generator.c
tags/12.5.1/res/res_pjsip_exten_state.c
tags/12.5.1/res/res_pjsip_mwi.c
tags/12.5.1/res/res_pjsip_mwi_body_generator.c
tags/12.5.1/res/res_pjsip_pidf_body_generator.c
tags/12.5.1/res/res_pjsip_pubsub.c
tags/12.5.1/res/res_pjsip_xpidf_body_generator.c
Propchange: tags/12.5.1/
------------------------------------------------------------------------------
svn:mergeinfo = /branches/12:423344,423365
Modified: tags/12.5.1/ChangeLog
URL: http://svnview.digium.com/svn/asterisk/tags/12.5.1/ChangeLog?view=diff&rev=423448&r1=423447&r2=423448
==============================================================================
--- tags/12.5.1/ChangeLog (original)
+++ tags/12.5.1/ChangeLog Thu Sep 18 12:34:40 2014
@@ -1,3 +1,47 @@
+2014-09-18 Asterisk Development Team <asteriskteam at digium.com>
+
+ * Asterisk 12.5.1 Released.
+
+ * AST-2014-010: Resolve crash when the Message channel technology
+ enters into the ReceiveFax application using res_fax_spandsp
+
+ If faxing fails at a very early stage, then it is possible for
+ us to pass a NULL t30 state pointer to spandsp, which spandsp
+ is none too pleased with.
+
+ This patch ensures that we pass the correct pointer to spandsp
+ in the situation where we have not yet set our local t30 state
+ pointer.
+
+ An advisory was made for this issue due to the likelihood of
+ it occurring in some Asterisk configurations.
+
+ ASTERISK-24301 #close
+ Reported by Matt Jordan, Philippe Lindheimer
+
+ * AST-2014-009: Fix crash caused by SUBSCRIBE messages with unexpected
+ combination of Event and Accept headers
+
+ res_pjsip_pubsub has two separate checks that it makes when a
+ SUBSCRIBE arrives.
+ * It checks that there is a subscription handler for the Event
+ * It checks that there are body generators for the types in the
+ Accept header
+
+ The problem is, there's nothing that ensures that these two things
+ will actually mesh with each other. For instance, Asterisk will
+ accept a subscription to MWI that accepts pidf+xml bodies. That
+ doesn't make sense.
+
+ With this commit, we add some type information to the mix.
+ Subscription handlers state they generate data of type X, and body
+ generators state that they consume data of type X. This way,
+ Asterisk doesn't end up in some hilariously mismatched situation
+ like the one in the previous paragraph.
+
+ ASTERISK-24136 #close
+ Reported by Mark Michelson
+
2014-08-19 Asterisk Development Team <asteriskteam at digium.com>
* Asterisk 12.5.0 Released.
Modified: tags/12.5.1/include/asterisk/res_pjsip_pubsub.h
URL: http://svnview.digium.com/svn/asterisk/tags/12.5.1/include/asterisk/res_pjsip_pubsub.h?view=diff&rev=423448&r1=423447&r2=423448
==============================================================================
--- tags/12.5.1/include/asterisk/res_pjsip_pubsub.h (original)
+++ tags/12.5.1/include/asterisk/res_pjsip_pubsub.h Thu Sep 18 12:34:40 2014
@@ -221,11 +221,18 @@
struct ast_sip_body *body;
};
+/*!
+ * \brief Type information for NOTIFY/PUBLISH body data
+ */
+#define AST_SIP_EXTEN_STATE_DATA "ast_sip_exten_state_data"
+#define AST_SIP_MESSAGE_ACCUMULATOR "ast_sip_message_accumulator"
+
#define AST_SIP_MAX_ACCEPT 32
struct ast_sip_subscription_handler {
/*! The name of the event this handler deals with */
const char *event_name;
+ const char *body_type;
/*! The types of body this handler accepts.
*
* \note This option has no bearing when the handler is used in the
@@ -566,6 +573,8 @@
* In "plain/text", "text" is the subtype
*/
const char *subtype;
+ /*! The type of body that the body generator takes as input */
+ const char *body_type;
/*!
* \brief allocate body structure.
*
@@ -643,6 +652,16 @@
*/
int (*supplement_body)(void *body, void *data);
AST_LIST_ENTRY(ast_sip_pubsub_body_supplement) list;
+};
+
+/*!
+ * \brief Data used to create bodies for NOTIFY/PUBLISH requests.
+ */
+struct ast_sip_body_data {
+ /*! The type of the data */
+ const char *body_type;
+ /*! The actual data from which the body is generated */
+ void *body_data;
};
/*!
@@ -662,7 +681,7 @@
* \retval non-zero Failure
*/
int ast_sip_pubsub_generate_body_content(const char *content_type,
- const char *content_subtype, void *data, struct ast_str **str);
+ const char *content_subtype, struct ast_sip_body_data *data, struct ast_str **str);
/*!
* \since 13.0.0
Modified: tags/12.5.1/res/res_fax_spandsp.c
URL: http://svnview.digium.com/svn/asterisk/tags/12.5.1/res/res_fax_spandsp.c?view=diff&rev=423448&r1=423447&r2=423448
==============================================================================
--- tags/12.5.1/res/res_fax_spandsp.c (original)
+++ tags/12.5.1/res/res_fax_spandsp.c Thu Sep 18 12:34:40 2014
@@ -176,8 +176,25 @@
static void session_destroy(struct spandsp_pvt *p)
{
struct ast_frame *f;
-
- t30_terminate(p->t30_state);
+ t30_state_t *t30_to_terminate;
+
+ if (p->t30_state) {
+ t30_to_terminate = p->t30_state;
+ } else if (p->ist38) {
+#if SPANDSP_RELEASE_DATE >= 20080725
+ t30_to_terminate = &p->t38_state.t30;
+#else
+ t30_to_terminate = &p->t38_state.t30_state;
+#endif
+ } else {
+#if SPANDSP_RELEASE_DATE >= 20080725
+ t30_to_terminate = &p->fax_state.t30;
+#else
+ t30_to_terminate = &p->fax_state.t30_state;
+#endif
+ }
+
+ t30_terminate(t30_to_terminate);
p->isdone = 1;
ast_timer_close(p->timer);
Modified: tags/12.5.1/res/res_pjsip_dialog_info_body_generator.c
URL: http://svnview.digium.com/svn/asterisk/tags/12.5.1/res/res_pjsip_dialog_info_body_generator.c?view=diff&rev=423448&r1=423447&r2=423448
==============================================================================
--- tags/12.5.1/res/res_pjsip_dialog_info_body_generator.c (original)
+++ tags/12.5.1/res/res_pjsip_dialog_info_body_generator.c Thu Sep 18 12:34:40 2014
@@ -187,6 +187,7 @@
static struct ast_sip_pubsub_body_generator dialog_info_body_generator = {
.type = "application",
.subtype = "dialog-info+xml",
+ .body_type = AST_SIP_EXTEN_STATE_DATA,
.allocate_body = dialog_info_allocate_body,
.generate_body_content = dialog_info_generate_body_content,
.to_string = dialog_info_to_string,
Modified: tags/12.5.1/res/res_pjsip_exten_state.c
URL: http://svnview.digium.com/svn/asterisk/tags/12.5.1/res/res_pjsip_exten_state.c?view=diff&rev=423448&r1=423447&r2=423448
==============================================================================
--- tags/12.5.1/res/res_pjsip_exten_state.c (original)
+++ tags/12.5.1/res/res_pjsip_exten_state.c Thu Sep 18 12:34:40 2014
@@ -81,6 +81,7 @@
struct ast_sip_subscription_handler presence_handler = {
.event_name = "presence",
+ .body_type = AST_SIP_EXTEN_STATE_DATA,
.accept = { DEFAULT_PRESENCE_BODY, },
.default_accept = DEFAULT_PRESENCE_BODY,
.subscription_shutdown = subscription_shutdown,
@@ -93,6 +94,7 @@
struct ast_sip_subscription_handler dialog_handler = {
.event_name = "dialog",
+ .body_type = AST_SIP_EXTEN_STATE_DATA,
.accept = { DEFAULT_DIALOG_BODY, },
.default_accept = DEFAULT_DIALOG_BODY,
.subscription_shutdown = subscription_shutdown,
@@ -180,12 +182,16 @@
const pj_str_t *reason_str_ptr = NULL;
pjsip_tx_data *tdata;
struct ast_sip_body body;
+ struct ast_sip_body_data body_data = {
+ .body_type = AST_SIP_EXTEN_STATE_DATA,
+ .body_data = exten_state_data,
+ };
body.type = ast_sip_subscription_get_body_type(exten_state_sub->sip_sub);
body.subtype = ast_sip_subscription_get_body_subtype(exten_state_sub->sip_sub);
if (ast_sip_pubsub_generate_body_content(body.type, body.subtype,
- exten_state_data, &body_text)) {
+ &body_data, &body_text)) {
ast_log(LOG_ERROR, "Unable to create body on NOTIFY request\n");
return;
}
Modified: tags/12.5.1/res/res_pjsip_mwi.c
URL: http://svnview.digium.com/svn/asterisk/tags/12.5.1/res/res_pjsip_mwi.c?view=diff&rev=423448&r1=423447&r2=423448
==============================================================================
--- tags/12.5.1/res/res_pjsip_mwi.c (original)
+++ tags/12.5.1/res/res_pjsip_mwi.c Thu Sep 18 12:34:40 2014
@@ -63,6 +63,7 @@
static struct ast_sip_subscription_handler mwi_handler = {
.event_name = "message-summary",
+ .body_type = AST_SIP_MESSAGE_ACCUMULATOR,
.accept = { MWI_TYPE"/"MWI_SUBTYPE, },
.default_accept = MWI_TYPE"/"MWI_SUBTYPE,
.subscription_shutdown = mwi_subscription_shutdown,
@@ -432,6 +433,10 @@
pjsip_tx_data *tdata;
pj_str_t reason_str;
struct ast_sip_body body;
+ struct ast_sip_body_data body_data = {
+ .body_type = AST_SIP_MESSAGE_ACCUMULATOR,
+ .body_data = &counter,
+ };
body.type = sub->is_solicited ?
ast_sip_subscription_get_body_type(sub->sip_sub) :
@@ -448,7 +453,7 @@
reason_str_ptr = &reason_str;
}
- if (ast_sip_pubsub_generate_body_content(body.type, body.subtype, &counter, &body_text)) {
+ if (ast_sip_pubsub_generate_body_content(body.type, body.subtype, &body_data, &body_text)) {
ast_log(LOG_WARNING, "Unable to generate SIP MWI NOTIFY body.\n");
return;
}
Modified: tags/12.5.1/res/res_pjsip_mwi_body_generator.c
URL: http://svnview.digium.com/svn/asterisk/tags/12.5.1/res/res_pjsip_mwi_body_generator.c?view=diff&rev=423448&r1=423447&r2=423448
==============================================================================
--- tags/12.5.1/res/res_pjsip_mwi_body_generator.c (original)
+++ tags/12.5.1/res/res_pjsip_mwi_body_generator.c Thu Sep 18 12:34:40 2014
@@ -85,6 +85,7 @@
static struct ast_sip_pubsub_body_generator mwi_generator = {
.type = MWI_TYPE,
.subtype = MWI_SUBTYPE,
+ .body_type = AST_SIP_MESSAGE_ACCUMULATOR,
.allocate_body = mwi_allocate_body,
.generate_body_content = mwi_generate_body_content,
.to_string = mwi_to_string,
Modified: tags/12.5.1/res/res_pjsip_pidf_body_generator.c
URL: http://svnview.digium.com/svn/asterisk/tags/12.5.1/res/res_pjsip_pidf_body_generator.c?view=diff&rev=423448&r1=423447&r2=423448
==============================================================================
--- tags/12.5.1/res/res_pjsip_pidf_body_generator.c (original)
+++ tags/12.5.1/res/res_pjsip_pidf_body_generator.c Thu Sep 18 12:34:40 2014
@@ -109,6 +109,7 @@
static struct ast_sip_pubsub_body_generator pidf_body_generator = {
.type = "application",
.subtype = "pidf+xml",
+ .body_type = AST_SIP_EXTEN_STATE_DATA,
.allocate_body = pidf_allocate_body,
.generate_body_content = pidf_generate_body_content,
.to_string = pidf_to_string,
Modified: tags/12.5.1/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/tags/12.5.1/res/res_pjsip_pubsub.c?view=diff&rev=423448&r1=423447&r2=423448
==============================================================================
--- tags/12.5.1/res/res_pjsip_pubsub.c (original)
+++ tags/12.5.1/res/res_pjsip_pubsub.c Thu Sep 18 12:34:40 2014
@@ -366,7 +366,7 @@
static struct ast_sip_subscription_handler *find_sub_handler_for_event_name(const char *event_name);
static struct ast_sip_pubsub_body_generator *find_body_generator(char accept[AST_SIP_MAX_ACCEPT][64],
- size_t num_accept);
+ size_t num_accept, const char *body_type);
/*! \brief Retrieve a handler using the Event header of an rdata message */
static struct ast_sip_subscription_handler *subscription_get_handler_from_rdata(pjsip_rx_data *rdata)
@@ -414,7 +414,7 @@
num_accept_headers = 1;
}
- return find_body_generator(accept, num_accept_headers);
+ return find_body_generator(accept, num_accept_headers, handler->body_type);
}
/*! \brief Callback function to perform the actual recreation of a subscription */
@@ -1092,7 +1092,7 @@
}
static struct ast_sip_pubsub_body_generator *find_body_generator(char accept[AST_SIP_MAX_ACCEPT][64],
- size_t num_accept)
+ size_t num_accept, const char *body_type)
{
int i;
struct ast_sip_pubsub_body_generator *generator = NULL;
@@ -1101,6 +1101,12 @@
generator = find_body_generator_accept(accept[i]);
if (generator) {
ast_debug(3, "Body generator %p found for accept type %s\n", generator, accept[i]);
+ if (strcmp(generator->body_type, body_type)) {
+ ast_log(LOG_WARNING, "Body generator '%s/%s'(%p) does not accept the type of data this event generates\n",
+ generator->type, generator->subtype, generator);
+ generator = NULL;
+ continue;
+ }
break;
} else {
ast_debug(3, "No body generator found for accept type %s\n", accept[i]);
@@ -1511,7 +1517,7 @@
}
int ast_sip_pubsub_generate_body_content(const char *type, const char *subtype,
- void *data, struct ast_str **str)
+ struct ast_sip_body_data *data, struct ast_str **str)
{
struct ast_sip_pubsub_body_supplement *supplement;
struct ast_sip_pubsub_body_generator *generator;
@@ -1525,14 +1531,19 @@
return -1;
}
- body = generator->allocate_body(data);
+ if (strcmp(data->body_type, generator->body_type)) {
+ ast_log(LOG_WARNING, "Body generator does not accept the type of data provided\n");
+ return -1;
+ }
+
+ body = generator->allocate_body(data->body_data);
if (!body) {
ast_log(LOG_WARNING, "Unable to allocate a NOTIFY body of type %s/%s\n",
type, subtype);
return -1;
}
- if (generator->generate_body_content(body, data)) {
+ if (generator->generate_body_content(body, data->body_data)) {
res = -1;
goto end;
}
@@ -1541,7 +1552,7 @@
AST_RWLIST_TRAVERSE(&body_supplements, supplement, list) {
if (!strcmp(generator->type, supplement->type) &&
!strcmp(generator->subtype, supplement->subtype)) {
- res = supplement->supplement_body(body, data);
+ res = supplement->supplement_body(body, data->body_data);
if (res) {
break;
}
Modified: tags/12.5.1/res/res_pjsip_xpidf_body_generator.c
URL: http://svnview.digium.com/svn/asterisk/tags/12.5.1/res/res_pjsip_xpidf_body_generator.c?view=diff&rev=423448&r1=423447&r2=423448
==============================================================================
--- tags/12.5.1/res/res_pjsip_xpidf_body_generator.c (original)
+++ tags/12.5.1/res/res_pjsip_xpidf_body_generator.c Thu Sep 18 12:34:40 2014
@@ -126,6 +126,7 @@
static struct ast_sip_pubsub_body_generator xpidf_body_generator = {
.type = "application",
.subtype = "xpidf+xml",
+ .body_type = AST_SIP_EXTEN_STATE_DATA,
.allocate_body = xpidf_allocate_body,
.generate_body_content = xpidf_generate_body_content,
.to_string = xpidf_to_string,
@@ -135,6 +136,7 @@
static struct ast_sip_pubsub_body_generator cpim_pidf_body_generator = {
.type = "application",
.subtype = "cpim-pidf+xml",
+ .body_type = AST_SIP_EXTEN_STATE_DATA,
.allocate_body = xpidf_allocate_body,
.generate_body_content = xpidf_generate_body_content,
.to_string = xpidf_to_string,
More information about the asterisk-commits
mailing list