[asterisk-commits] file: branch 1.4 r52373 - /branches/1.4/main/manager.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Jan 26 17:44:52 MST 2007


Author: file
Date: Fri Jan 26 18:44:51 2007
New Revision: 52373

URL: http://svn.digium.com/view/asterisk?view=rev&rev=52373
Log:
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)

Modified:
    branches/1.4/main/manager.c

Modified: branches/1.4/main/manager.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/manager.c?view=diff&rev=52373&r1=52372&r2=52373
==============================================================================
--- branches/1.4/main/manager.c (original)
+++ branches/1.4/main/manager.c Fri Jan 26 18:44:51 2007
@@ -2021,22 +2021,29 @@
 		} 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;
-		}
-		ast_mutex_unlock(&actionlock);
-		if (!tmp)
-			astman_send_error(s, m, "Invalid/unknown command");
+		} 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");
+		}
 	}
 	if (ret)
 		return ret;



More information about the asterisk-commits mailing list