[asterisk-commits] seanbright: branch 1.8 r316663 - /branches/1.8/main/manager.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed May 4 09:35:12 CDT 2011


Author: seanbright
Date: Wed May  4 09:35:05 2011
New Revision: 316663

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=316663
Log:
Only return a single error via AMI when requesting a forbidden action.

(closes issue #19216)
Reported by: oej
Patches:
      issue19216-1.8-r316204.patch uploaded by seanbright (license 71)
Tested by: seanbright

Modified:
    branches/1.8/main/manager.c

Modified: branches/1.8/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/manager.c?view=diff&rev=316663&r1=316662&r2=316663
==============================================================================
--- branches/1.8/main/manager.c (original)
+++ branches/1.8/main/manager.c Wed May  4 09:35:05 2011
@@ -4484,18 +4484,25 @@
 		}
 		if (s->session->writeperm & tmp->authority || tmp->authority == 0) {
 			call_func = tmp->func;
+		}
+		break;
+	}
+	AST_RWLIST_UNLOCK(&actions);
+
+	if (tmp) {
+		if (call_func) {
+			/* Call our AMI function after we unlock our actions lists */
+			ast_debug(1, "Running action '%s'\n", tmp->action);
+			ret = call_func(s, m);
 		} else {
+			/* If we found our action but don't have a function pointer, access
+			 * was denied, so bail out.
+			 */
+			report_req_not_allowed(s, action);
+			mansession_lock(s);
 			astman_send_error(s, m, "Permission denied");
-			report_req_not_allowed(s, action);
-		}
-		break;
-	}
-	AST_RWLIST_UNLOCK(&actions);
-
-	if (tmp && call_func) {
-		/* call AMI function after actions list are unlocked */
-		ast_debug(1, "Running action '%s'\n", tmp->action);
-		ret = call_func(s, m);
+			mansession_unlock(s);
+		}
 	} else {
 		char buf[512];
 		if (!tmp) {




More information about the asterisk-commits mailing list