]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Have the manager interface send back an "Already logged in" message instead of "Inval...
authorJoshua Colp <jcolp@digium.com>
Sat, 27 Jan 2007 00:44:51 +0000 (00:44 +0000)
committerJoshua Colp <jcolp@digium.com>
Sat, 27 Jan 2007 00:44:51 +0000 (00:44 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@52373 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index b92226539bb1b60369d6ac6852377b02e108781c..358634e94dd93fa8b15ac629fcf78bbe235125d5 100644 (file)
@@ -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;