mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 00:04:53 +00:00
Merged revisions 127560 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r127560 | mmichelson | 2008-07-02 15:47:38 -0500 (Wed, 02 Jul 2008) | 3 lines Fix thread-safety of some of the pbx_builtin_getvar_helper calls ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@127562 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1859,6 +1859,7 @@ static int login_exec(struct ast_channel *chan, void *data)
|
|||||||
|
|
||||||
ast_copy_string(agent_goodbye, agentgoodbye, sizeof(agent_goodbye));
|
ast_copy_string(agent_goodbye, agentgoodbye, sizeof(agent_goodbye));
|
||||||
|
|
||||||
|
ast_channel_lock(chan);
|
||||||
/* Set Channel Specific Login Overrides */
|
/* Set Channel Specific Login Overrides */
|
||||||
if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTLMAXLOGINTRIES"))) {
|
if (!ast_strlen_zero(pbx_builtin_getvar_helper(chan, "AGENTLMAXLOGINTRIES"))) {
|
||||||
max_login_tries = atoi(pbx_builtin_getvar_helper(chan, "AGENTMAXLOGINTRIES"));
|
max_login_tries = atoi(pbx_builtin_getvar_helper(chan, "AGENTMAXLOGINTRIES"));
|
||||||
@@ -1880,6 +1881,7 @@ static int login_exec(struct ast_channel *chan, void *data)
|
|||||||
tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTGOODBYE");
|
tmpoptions=pbx_builtin_getvar_helper(chan, "AGENTGOODBYE");
|
||||||
ast_verb(3, "Saw variable AGENTGOODBYE=%s, setting agent_goodbye to: %s on Channel '%s'.\n",tmpoptions,agent_goodbye,chan->name);
|
ast_verb(3, "Saw variable AGENTGOODBYE=%s, setting agent_goodbye to: %s on Channel '%s'.\n",tmpoptions,agent_goodbye,chan->name);
|
||||||
}
|
}
|
||||||
|
ast_channel_unlock(chan);
|
||||||
/* End Channel Specific Login Overrides */
|
/* End Channel Specific Login Overrides */
|
||||||
|
|
||||||
if (!ast_strlen_zero(args.options)) {
|
if (!ast_strlen_zero(args.options)) {
|
||||||
@@ -1920,6 +1922,8 @@ static int login_exec(struct ast_channel *chan, void *data)
|
|||||||
/* Check again for accuracy */
|
/* Check again for accuracy */
|
||||||
AST_LIST_LOCK(&agents);
|
AST_LIST_LOCK(&agents);
|
||||||
AST_LIST_TRAVERSE(&agents, p, list) {
|
AST_LIST_TRAVERSE(&agents, p, list) {
|
||||||
|
int unlock_channel = 1;
|
||||||
|
ast_channel_lock(chan);
|
||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
if (!strcmp(p->agent, user) &&
|
if (!strcmp(p->agent, user) &&
|
||||||
!strcmp(p->password, pass) && !p->pending) {
|
!strcmp(p->password, pass) && !p->pending) {
|
||||||
@@ -1964,6 +1968,8 @@ static int login_exec(struct ast_channel *chan, void *data)
|
|||||||
p->enddtmf = *tmpoptions;
|
p->enddtmf = *tmpoptions;
|
||||||
ast_verb(3, "Saw variable AGENTENDDTMF=%s, setting enddtmf to: %c for Agent '%s'.\n", tmpoptions, p->enddtmf, p->agent);
|
ast_verb(3, "Saw variable AGENTENDDTMF=%s, setting enddtmf to: %c for Agent '%s'.\n", tmpoptions, p->enddtmf, p->agent);
|
||||||
}
|
}
|
||||||
|
ast_channel_unlock(chan);
|
||||||
|
unlock_channel = 0;
|
||||||
/* End Channel Specific Agent Overrides */
|
/* End Channel Specific Agent Overrides */
|
||||||
if (!p->chan) {
|
if (!p->chan) {
|
||||||
long logintime;
|
long logintime;
|
||||||
@@ -2106,6 +2112,9 @@ static int login_exec(struct ast_channel *chan, void *data)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
|
if (unlock_channel) {
|
||||||
|
ast_channel_unlock(chan);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!p)
|
if (!p)
|
||||||
AST_LIST_UNLOCK(&agents);
|
AST_LIST_UNLOCK(&agents);
|
||||||
|
Reference in New Issue
Block a user