res_ari: Fix inverted test giving wrong error message.
authorRichard Mudgett <rmudgett@digium.com>
Sun, 26 Nov 2017 15:44:51 +0000 (09:44 -0600)
committerRichard Mudgett <rmudgett@digium.com>
Sun, 26 Nov 2017 15:51:59 +0000 (09:51 -0600)
The patch for ASTERISK_24560 inverted a test checking if the bridge name
is being updated to a different name.

* Fix the test to return "Changing bridge name is not implemented" when
someone attempts to change the bridge name.

ASTERISK-27445

Change-Id: I4b70bf08b0e02e016108b077ff75b345dec12fc9

res/ari/resource_bridges.c

index cd289aa..a320c29 100644 (file)
@@ -968,13 +968,12 @@ void ast_ari_bridges_create_with_id(struct ast_variable *headers,
 
        if (bridge) {
                /* update */
-               if (!ast_strlen_zero(args->name)) {
-                       if (!strcmp(args->name, bridge->name)) {
-                               ast_ari_response_error(
-                                       response, 500, "Internal Error",
-                                       "Changing bridge name is not implemented");
-                               return;
-                       }
+               if (!ast_strlen_zero(args->name)
+                       && strcmp(args->name, bridge->name)) {
+                       ast_ari_response_error(
+                               response, 500, "Internal Error",
+                               "Changing bridge name is not implemented");
+                       return;
                }
                if (!ast_strlen_zero(args->type)) {
                        ast_ari_response_error(