Index: asterisk-svn-52502/main/manager.c =================================================================== --- asterisk-svn-52502/main/manager.c (revision 52502) +++ asterisk-svn-52502/main/manager.c (working copy) @@ -2018,31 +2018,38 @@ astman_send_ack(s, m, "See ya"); ast_mutex_unlock(&s->__lock); return -1; - } else + } else { + ast_mutex_lock(&s->__lock); astman_send_error(s, m, "Authentication Required"); + ast_mutex_unlock(&s->__lock); + } } else { if (!strcasecmp(action, "Login")) { ast_mutex_lock(&s->__lock); astman_send_ack(s, m, "Already logged in"); ast_mutex_unlock(&s->__lock); } else { - ast_mutex_lock(&actionlock); + //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 + } else { + ast_mutex_lock(&s->__lock); astman_send_error(s, m, "Permission denied"); - ast_mutex_unlock(&s->__lock); + ast_mutex_unlock(&s->__lock); + } break; } - ast_mutex_unlock(&actionlock); - if (!tmp) + //ast_mutex_unlock(&actionlock); + if (!tmp) { + ast_mutex_lock(&s->__lock); astman_send_error(s, m, "Invalid/unknown command"); + ast_mutex_unlock(&s->__lock); + } } } if (ret)