Merged revisions 305889 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.6.2

................
  r305889 | rmudgett | 2011-02-02 18:15:07 -0600 (Wed, 02 Feb 2011) | 17 lines
  
  Merged revisions 305888 via svnmerge from
  https://origsvn.digium.com/svn/asterisk/branches/1.4
  
  ........
    r305888 | rmudgett | 2011-02-02 18:02:43 -0600 (Wed, 02 Feb 2011) | 8 lines
  
    Minor AST_FRAME_TEXT related issues.
  
    * Include the null terminator in the buffer length.  When the frame is
    queued it is copied.  If the null terminator is not part of the frame
    buffer length, the receiver could see garbage appended onto it.
  
    * Add channel lock protection with ast_sendtext().
  
    * Fixed AMI SendText action ast_sendtext() return value check.
  ........
................


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@305923 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/1.8.6
Richard Mudgett 15 years ago
parent 70edcdef43
commit a785544090

@ -98,10 +98,10 @@ static int sendtext_exec(struct ast_channel *chan, const char *data)
return 0;
}
status = "FAILURE";
ast_channel_unlock(chan);
if (!ast_sendtext(chan, ast_str_buffer(str))) {
status = "SUCCESS";
}
ast_channel_unlock(chan);
pbx_builtin_setvar_helper(chan, "SENDTEXTSTATUS", status);
return 0;
}

@ -15333,7 +15333,7 @@ static void receive_message(struct sip_pvt *p, struct sip_request *req)
f.subclass.integer = 0;
f.offset = 0;
f.data.ptr = buf;
f.datalen = strlen(buf);
f.datalen = strlen(buf) + 1;
ast_queue_frame(p->owner, &f);
transmit_response(p, "202 Accepted", req); /* We respond 202 accepted, since we relay the message */
return;

@ -4465,13 +4465,18 @@ char *ast_recvtext(struct ast_channel *chan, int timeout)
int ast_sendtext(struct ast_channel *chan, const char *text)
{
int res = 0;
ast_channel_lock(chan);
/* Stop if we're a zombie or need a soft hangup */
if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan))
if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
ast_channel_unlock(chan);
return -1;
}
CHECK_BLOCKING(chan);
if (chan->tech->send_text)
res = chan->tech->send_text(chan, text);
ast_clear_flag(chan, AST_FLAG_BLOCKING);
ast_channel_unlock(chan);
return res;
}

@ -3251,12 +3251,10 @@ static int action_sendtext(struct mansession *s, const struct message *m)
return 0;
}
ast_channel_lock(c);
res = ast_sendtext(c, textmsg);
ast_channel_unlock(c);
c = ast_channel_unref(c);
if (res > 0) {
if (res >= 0) {
astman_send_ack(s, m, "Success");
} else {
astman_send_error(s, m, "Failure");

Loading…
Cancel
Save