[asterisk-commits] rmudgett: trunk r401108 - in /trunk: ./ res/ari/resource_playback.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 16 16:22:27 CDT 2013


Author: rmudgett
Date: Wed Oct 16 16:22:25 2013
New Revision: 401108

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401108
Log:
ARI: Fix crash when POST /playback/{id}/control does not have an operation parameter.

(closes issue ASTERISK-22680)
Reported by: John Bigelow
........

Merged revisions 401107 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/res/ari/resource_playback.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/res/ari/resource_playback.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/ari/resource_playback.c?view=diff&rev=401108&r1=401107&r2=401108
==============================================================================
--- trunk/res/ari/resource_playback.c (original)
+++ trunk/res/ari/resource_playback.c Wed Oct 16 16:22:25 2013
@@ -68,7 +68,6 @@
 	}
 
 	res = stasis_app_playback_operation(playback, STASIS_PLAYBACK_STOP);
-
 	switch (res) {
 	case STASIS_PLAYBACK_OPER_OK:
 		ast_ari_response_no_content(response);
@@ -93,6 +92,11 @@
 	enum stasis_app_playback_media_operation oper;
 	enum stasis_playback_oper_results res;
 
+	if (!args->operation) {
+		ast_ari_response_error(response, 400,
+			"Bad Request", "Missing operation");
+		return;
+	}
 	if (strcmp(args->operation, "unpause") == 0) {
 		oper = STASIS_PLAYBACK_UNPAUSE;
 	} else if (strcmp(args->operation, "pause") == 0) {
@@ -108,7 +112,6 @@
 			"Bad Request", "Invalid operation %s",
 			args->operation);
 		return;
-
 	}
 
 	playback = stasis_app_playback_find_by_id(args->playback_id);
@@ -119,7 +122,6 @@
 	}
 
 	res = stasis_app_playback_operation(playback, oper);
-
 	switch (res) {
 	case STASIS_PLAYBACK_OPER_OK:
 		ast_ari_response_no_content(response);




More information about the asterisk-commits mailing list