[asterisk-commits] mmichelson: branch group/issue8824 r184040 - in /team/group/issue8824: apps/ ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Mar 24 16:47:49 CDT 2009
Author: mmichelson
Date: Tue Mar 24 16:47:45 2009
New Revision: 184040
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=184040
Log:
Address Russell's latest round of findings.
Modified:
team/group/issue8824/apps/app_directed_pickup.c
team/group/issue8824/apps/app_queue.c
team/group/issue8824/channels/chan_iax2.c
team/group/issue8824/channels/chan_sip.c
Modified: team/group/issue8824/apps/app_directed_pickup.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/apps/app_directed_pickup.c?view=diff&rev=184040&r1=184039&r2=184040
==============================================================================
--- team/group/issue8824/apps/app_directed_pickup.c (original)
+++ team/group/issue8824/apps/app_directed_pickup.c Tue Mar 24 16:47:45 2009
@@ -100,9 +100,12 @@
connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
ast_channel_update_connected_line(chan, &connected_caller);
- ast_party_connected_line_collect_caller(&connected_caller, &chan->cid);
+ ast_channel_lock(chan);
+ ast_connected_line_copy_from_caller(&connected_caller, &chan->cid);
+ ast_channel_unlock(chan);
connected_caller.source = AST_CONNECTED_LINE_UPDATE_SOURCE_ANSWER;
ast_channel_queue_connected_line_update(chan, &connected_caller);
+ ast_party_connected_line_free(&connected_caller);
if ((res = ast_answer(chan))) {
ast_log(LOG_WARNING, "Unable to answer '%s'\n", chan->name);
Modified: team/group/issue8824/apps/app_queue.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/apps/app_queue.c?view=diff&rev=184040&r1=184039&r2=184040
==============================================================================
--- team/group/issue8824/apps/app_queue.c (original)
+++ team/group/issue8824/apps/app_queue.c Tue Mar 24 16:47:45 2009
@@ -2778,6 +2778,11 @@
struct callattempt *epollo;
#endif
struct ast_party_connected_line connected_caller;
+ char *inchan_name;
+
+ ast_channel_lock(qe->chan);
+ inchan_name = ast_strdupa(qe->chan->name);
+ ast_channel_unlock(qe->chan);
starttime = (long) time(NULL);
#ifdef HAVE_EPOLL
@@ -2828,9 +2833,16 @@
}
winner = ast_waitfor_n(watchers, pos, to);
for (o = start; o; o = o->call_next) {
+ /* We go with a static buffer here instead of using ast_strdupa. Using
+ * ast_strdupa in a loop like this one can cause a stack overflow
+ */
+ char ochan_name[AST_CHANNEL_NAME];
+ ast_channel_lock(o->chan);
+ ast_copy_string(ochan_name, o->chan->name, sizeof(ochan_name));
+ ast_channel_unlock(o->chan);
if (o->stillgoing && (o->chan) && (o->chan->_state == AST_STATE_UP)) {
if (!peer) {
- ast_verb(3, "%s answered %s\n", o->chan->name, in->name);
+ ast_verb(3, "%s answered %s\n", ochan_name, inchan_name);
if (update_connectedline) {
if (o->connected.id.number) {
ast_channel_update_connected_line(in, &o->connected);
@@ -2851,7 +2863,7 @@
ast_copy_string(membername, o->member->membername, sizeof(membername));
if (!ast_strlen_zero(o->chan->call_forward) && !forwardsallowed) {
- ast_verb(3, "Forwarding %s to '%s' prevented.\n", in->name, o->chan->call_forward);
+ ast_verb(3, "Forwarding %s to '%s' prevented.\n", inchan_name, o->chan->call_forward);
numnochan++;
do_hang(o);
winner = NULL;
@@ -2874,7 +2886,7 @@
tech = "Local";
}
/* Before processing channel, go ahead and check for forwarding */
- ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", in->name, tech, stuff, o->chan->name);
+ ast_verb(3, "Now forwarding %s to '%s/%s' (thanks to %s)\n", inchan_name, tech, stuff, ochan_name);
/* Setup parameters */
o->chan = ast_request(tech, in->nativeformats, stuff, &status);
if (!o->chan) {
@@ -2930,7 +2942,7 @@
case AST_CONTROL_ANSWER:
/* This is our guy if someone answered. */
if (!peer) {
- ast_verb(3, "%s answered %s\n", o->chan->name, in->name);
+ ast_verb(3, "%s answered %s\n", ochan_name, inchan_name);
if (update_connectedline) {
if (o->connected.id.number) {
ast_channel_update_connected_line(in, &o->connected);
@@ -2947,7 +2959,7 @@
}
break;
case AST_CONTROL_BUSY:
- ast_verb(3, "%s is busy\n", o->chan->name);
+ ast_verb(3, "%s is busy\n", ochan_name);
if (in->cdr)
ast_cdr_busy(in->cdr);
do_hang(o);
@@ -2962,7 +2974,7 @@
numbusies++;
break;
case AST_CONTROL_CONGESTION:
- ast_verb(3, "%s is circuit-busy\n", o->chan->name);
+ ast_verb(3, "%s is circuit-busy\n", ochan_name);
if (in->cdr)
ast_cdr_busy(in->cdr);
endtime = (long) time(NULL);
@@ -2977,31 +2989,31 @@
numbusies++;
break;
case AST_CONTROL_RINGING:
- ast_verb(3, "%s is ringing\n", o->chan->name);
+ ast_verb(3, "%s is ringing\n", ochan_name);
break;
case AST_CONTROL_OFFHOOK:
/* Ignore going off hook */
break;
case AST_CONTROL_CONNECTED_LINE:
if (!update_connectedline) {
- ast_verb(3, "Connected line update to %s prevented.\n", in->name);
+ ast_verb(3, "Connected line update to %s prevented.\n", inchan_name);
} else if (qe->parent->strategy == QUEUE_STRATEGY_RINGALL) {
struct ast_party_connected_line connected;
- ast_verb(3, "%s connected line has changed. Saving it until answer for %s\n", o->chan->name, in->name);
+ ast_verb(3, "%s connected line has changed. Saving it until answer for %s\n", ochan_name, inchan_name);
ast_party_connected_line_set_init(&connected, &o->connected);
ast_connected_line_parse_data(f->data.ptr, f->datalen, &connected);
ast_party_connected_line_set(&o->connected, &connected);
ast_party_connected_line_free(&connected);
} else {
- ast_verb(3, "%s connected line has changed, passing it to %s\n", o->chan->name, in->name);
+ ast_verb(3, "%s connected line has changed, passing it to %s\n", ochan_name, inchan_name);
ast_indicate_data(in, AST_CONTROL_CONNECTED_LINE, f->data.ptr, f->datalen);
}
break;
case AST_CONTROL_REDIRECTING:
if (!update_connectedline) {
- ast_verb(3, "Redirecting update to %s prevented\n", in->name);
+ ast_verb(3, "Redirecting update to %s prevented\n", inchan_name);
} else {
- ast_verb(3, "%s redirecting info has changed, passing it to %s\n", o->chan->name, in->name);
+ ast_verb(3, "%s redirecting info has changed, passing it to %s\n", ochan_name, inchan_name);
ast_indicate_data(in, AST_CONTROL_REDIRECTING, f->data.ptr, f->datalen);
}
break;
Modified: team/group/issue8824/channels/chan_iax2.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/channels/chan_iax2.c?view=diff&rev=184040&r1=184039&r2=184040
==============================================================================
--- team/group/issue8824/channels/chan_iax2.c (original)
+++ team/group/issue8824/channels/chan_iax2.c Tue Mar 24 16:47:45 2009
@@ -11357,12 +11357,8 @@
trunkmaxsize = MAX_TRUNKDATA;
amaflags = 0;
delayreject = 0;
- ast_clear_flag((&globalflags), IAX_NOTRANSFER);
- ast_clear_flag((&globalflags), IAX_TRANSFERMEDIA);
- ast_clear_flag((&globalflags), IAX_USEJITTERBUF);
- ast_clear_flag((&globalflags), IAX_FORCEJITTERBUF);
- ast_clear_flag((&globalflags), IAX_SENDCONNECTEDLINE);
- ast_clear_flag((&globalflags), IAX_RECVCONNECTEDLINE);
+ ast_clear_flag((&globalflags), IAX_NOTRANSFER | IAX_TRANSFERMEDIA | IAX_USEJITTERBUF |
+ IAX_FORCEJITTERBUF | IAX_SENDCONNECTEDLINE | IAX_RECVCONNECTEDLINE);
delete_users();
}
Modified: team/group/issue8824/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/channels/chan_sip.c?view=diff&rev=184040&r1=184039&r2=184040
==============================================================================
--- team/group/issue8824/channels/chan_sip.c (original)
+++ team/group/issue8824/channels/chan_sip.c Tue Mar 24 16:47:45 2009
@@ -8811,7 +8811,7 @@
if (ast_test_flag(&p->flags[0], SIP_SENDRPID)
&& ast_test_flag(&p->flags[1], SIP_PAGE2_CONNECTLINEUPDATE_PEND)
- && (!strncasecmp(msg, "180", 3) || !strncasecmp(msg, "183", 3))) {
+ && (!strncmp(msg, "180", 3) || !strncmp(msg, "183", 3))) {
ast_clear_flag(&p->flags[1], SIP_PAGE2_CONNECTLINEUPDATE_PEND);
add_rpid(&resp, p);
}
@@ -9041,7 +9041,7 @@
*/
static int add_rpid(struct sip_request *req, struct sip_pvt *p)
{
- char tmp[256];
+ struct ast_str *tmp = ast_str_alloca(256);
char *lid_num = NULL;
char *lid_name = NULL;
int lid_pres;
@@ -9068,13 +9068,13 @@
if (ast_test_flag(&p->flags[0], SIP_SENDRPID_PAI)) {
if ((lid_pres & AST_PRES_RESTRICTION) != AST_PRES_ALLOWED) {
- snprintf(tmp, sizeof(tmp), "%s", anonymous_string);
+ ast_str_set(&tmp, -1, "%s", anonymous_string);
} else {
- snprintf(tmp, sizeof(tmp), "\"%s\" <sip:%s@%s>", lid_name, lid_num, fromdomain);
- }
- add_header(req, "P-Asserted-Identity", tmp);
+ ast_str_set(&tmp, -1, "\"%s\" <sip:%s@%s>", lid_name, lid_num, fromdomain);
+ }
+ add_header(req, "P-Asserted-Identity", ast_str_buffer(tmp));
} else {
- snprintf(tmp, sizeof(tmp), "\"%s\" <sip:%s@%s>;party=%s", lid_name, lid_num, fromdomain, ast_test_flag(&p->flags[0], SIP_OUTGOING) ? "calling" : "called");
+ ast_str_set(&tmp, -1, "\"%s\" <sip:%s@%s>;party=%s", lid_name, lid_num, fromdomain, ast_test_flag(&p->flags[0], SIP_OUTGOING) ? "calling" : "called");
switch (lid_pres) {
case AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED:
@@ -9109,10 +9109,11 @@
break;
}
- if (!ast_strlen_zero(privacy) && !ast_strlen_zero(screen))
- snprintf(tmp + strlen(tmp), sizeof(tmp) - strlen(tmp), ";privacy=%s;screen=%s", privacy, screen);
-
- add_header(req, "Remote-Party-ID", tmp);
+ if (!ast_strlen_zero(privacy) && !ast_strlen_zero(screen)) {
+ ast_str_append(&tmp, -1, ";privacy=%s;screen=%s", privacy, screen);
+ }
+
+ add_header(req, "Remote-Party-ID", ast_str_buffer(tmp));
}
return 0;
}
@@ -10792,7 +10793,7 @@
static int sip_reregister(const void *data)
{
/* if we are here, we know that we need to reregister. */
- struct sip_registry *r= (struct sip_registry *) data;
+ struct sip_registry *r = (struct sip_registry *) data;
/* if we couldn't get a reference to the registry object, punt */
if (!r)
More information about the asterisk-commits
mailing list