diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-27 00:44:51 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-01-27 00:44:51 +0000 |
commit | 7bfb8231cfdb98a7c59f9f7cf7bd86ab028947a7 (patch) | |
tree | d284542428f20ef2ab748a39b3f0cb6e95401966 /main/manager.c | |
parent | cabff4f9a522744775b8e332be78dd87278b6a74 (diff) |
Have the manager interface send back an "Already logged in" message instead of "Invalid/Unknown Command" when the client authenticates for a second time. (issue #8509 reported by pari)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@52373 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/manager.c')
-rw-r--r-- | main/manager.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/main/manager.c b/main/manager.c index b92226539..358634e94 100644 --- a/main/manager.c +++ b/main/manager.c @@ -2021,22 +2021,29 @@ static int process_message(struct mansession *s, const struct message *m) } else astman_send_error(s, m, "Authentication Required"); } else { - ast_mutex_lock(&actionlock); - for (tmp = first_action; tmp; tmp = tmp->next) { - if (strcasecmp(action, tmp->action)) - continue; + if (!strcasecmp(action, "Login")) { ast_mutex_lock(&s->__lock); - if ((s->writeperm & tmp->authority) == tmp->authority) { - if (tmp->func(s, m)) - ret = -1; - } else - astman_send_error(s, m, "Permission denied"); + astman_send_ack(s, m, "Already logged in"); ast_mutex_unlock(&s->__lock); - break; + } else { + ast_mutex_lock(&actionlock); + for (tmp = first_action; tmp; tmp = tmp->next) { + if (strcasecmp(action, tmp->action)) + continue; + ast_mutex_lock(&s->__lock); + if ((s->writeperm & tmp->authority) == tmp->authority) { + if (tmp->func(s, m)) + ret = -1; + } else + astman_send_error(s, m, "Permission denied"); + ast_mutex_unlock(&s->__lock); + break; + } + + ast_mutex_unlock(&actionlock); + if (!tmp) + astman_send_error(s, m, "Invalid/unknown command"); } - ast_mutex_unlock(&actionlock); - if (!tmp) - astman_send_error(s, m, "Invalid/unknown command"); } if (ret) return ret; |