[Asterisk-code-review] app_meetme: Don't erroneously set global variables. (asterisk[18])

Joshua Colp asteriskteam at digium.com
Wed Apr 27 18:40:13 CDT 2022


Joshua Colp has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/18465 )

Change subject: app_meetme: Don't erroneously set global variables.
......................................................................

app_meetme: Don't erroneously set global variables.

The admin_exec function in app_meetme is used by the SLA
applications for internal bridging. However, in these cases,
chan is NULL. Currently, this function will set some status
variables that are intended for a channel, but since channel
is NULL, this is erroneously creating meaningless global
variables, which shouldn't be happening. This sets these
variables only if chan is not NULL.

ASTERISK-30002 #close

Change-Id: I817df6c26f5bda131678e56791b0b61ba64fc6f7
---
M apps/app_meetme.c
1 file changed, 12 insertions(+), 4 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  Kevin Harwell: Looks good to me, approved
  Benjamin Keith Ford: Looks good to me, but someone else must approve



diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index e7ade64..e37c548 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -5239,7 +5239,9 @@
 
 	if (ast_strlen_zero(data)) {
 		ast_log(LOG_WARNING, "MeetMeAdmin requires an argument!\n");
-		pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE");
+		if (chan) {
+			pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE");
+		}
 		return -1;
 	}
 
@@ -5248,7 +5250,9 @@
 
 	if (!args.command) {
 		ast_log(LOG_WARNING, "MeetmeAdmin requires a command!\n");
-		pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE");
+		if (chan) {
+			pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOPARSE");
+		}
 		return -1;
 	}
 
@@ -5261,7 +5265,9 @@
 	if (!cnf) {
 		ast_log(LOG_WARNING, "Conference number '%s' not found!\n", args.confno);
 		AST_LIST_UNLOCK(&confs);
-		pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOTFOUND");
+		if (chan) {
+			pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", "NOTFOUND");
+		}
 		return 0;
 	}
 
@@ -5384,7 +5390,9 @@
 	AST_LIST_UNLOCK(&confs);
 
 	dispose_conf(cnf);
-	pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", res == -2 ? "NOTFOUND" : res ? "FAILED" : "OK");
+	if (chan) {
+		pbx_builtin_setvar_helper(chan, "MEETMEADMINSTATUS", res == -2 ? "NOTFOUND" : res ? "FAILED" : "OK");
+	}
 
 	return 0;
 }

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/18465
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 18
Gerrit-Change-Id: I817df6c26f5bda131678e56791b0b61ba64fc6f7
Gerrit-Change-Number: 18465
Gerrit-PatchSet: 2
Gerrit-Owner: N A <mail at interlinked.x10host.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220427/9a44a347/attachment.html>


More information about the asterisk-code-review mailing list