aboutsummaryrefslogtreecommitdiffstats
path: root/manager.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-07 00:20:13 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-03-07 00:20:13 +0000
commit8fc37c8f0d7bfb06b28b7907b6a54f85ce688989 (patch)
treef5c1d2d859299ec582878fd7dee30e7aa4cb24dc /manager.c
parentb585ba928d3b2a70ad931955e1be02b69e8fd10a (diff)
If the channels acquired using the manager Redirect action are not up, then
don't attempt to do anything with them. It could lead to weird behavior, including crashes. (issue #8977) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@58164 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'manager.c')
-rw-r--r--manager.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/manager.c b/manager.c
index d3488db7f..b2ea39b00 100644
--- a/manager.c
+++ b/manager.c
@@ -879,6 +879,11 @@ static int action_redirect(struct mansession *s, struct message *m)
return 0;
}
chan = ast_get_channel_by_name_locked(name);
+ if (chan->_state != AST_STATE_UP) {
+ astman_send_error(s, m, "Redirect failed, channel not up.\n");
+ ast_mutex_unlock(&chan->lock);
+ return 0;
+ }
if (!chan) {
char buf[BUFSIZ];
snprintf(buf, sizeof(buf), "Channel does not exist: %s", name);
@@ -887,6 +892,12 @@ static int action_redirect(struct mansession *s, struct message *m)
}
if (!ast_strlen_zero(name2))
chan2 = ast_get_channel_by_name_locked(name2);
+ if (chan2 && chan2->_state != AST_STATE_UP) {
+ astman_send_error(s, m, "Redirect failed, extra channel not up.\n");
+ ast_mutex_unlock(&chan->lock);
+ ast_mutex_unlock(&chan2->lock);
+ return 0;
+ }
res = ast_async_goto(chan, context, exten, pi);
if (!res) {
if (!ast_strlen_zero(name2)) {