mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-04 20:04:50 +00:00
asterisk: Audit locking of channel when manipulating flags.
When manipulating flags on a channel the channel has to be locked to guarantee that nothing else is also manipulating the flags. This change introduces locking where necessary to guarantee this. It also adds helper functions that manipulate channel flags and lock to reduce repeated code. ASTERISK-26789 Change-Id: I489280662dba0f4c50981bfc5b5a7073fef2db10
This commit is contained in:
@@ -3119,12 +3119,14 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, const char
|
||||
ast_verb(3, "AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argc >= 3 ? argv[2] : "");
|
||||
|
||||
if ((app_to_exec = pbx_findapp(argv[1]))) {
|
||||
ast_channel_lock(chan);
|
||||
if (!(workaround = ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS))) {
|
||||
ast_set_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS);
|
||||
}
|
||||
ast_channel_unlock(chan);
|
||||
res = pbx_exec(chan, app_to_exec, argc == 2 ? "" : argv[2]);
|
||||
if (!workaround) {
|
||||
ast_clear_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS);
|
||||
ast_channel_clear_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS);
|
||||
}
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Could not find application (%s)\n", argv[1]);
|
||||
|
Reference in New Issue
Block a user