[Asterisk-code-review] res_pjsip_config_wizard: Don't crash if misconfigured (...asterisk[master])

Joshua Colp asteriskteam at digium.com
Thu Feb 28 07:47:52 CST 2019


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11062 )

Change subject: res_pjsip_config_wizard: Don't crash if misconfigured
......................................................................

res_pjsip_config_wizard: Don't crash if misconfigured

If both send_registrations and send_auth are both set to yes,
outbound_auth/username must be set or we crash.

ASTERISK-27992 #close

Change-Id: I6418d56de1ae53f80393b314c2584048fbf7f11d
---
M res/res_pjsip_config_wizard.c
1 file changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
  George Joseph: Looks good to me, approved



diff --git a/res/res_pjsip_config_wizard.c b/res/res_pjsip_config_wizard.c
index 3a761a7..4d24922 100644
--- a/res/res_pjsip_config_wizard.c
+++ b/res/res_pjsip_config_wizard.c
@@ -910,8 +910,12 @@
 		client_uri_pattern = "sip:${USERNAME}@${REMOTE_HOST}";
 	}
 
-	if(is_variable_true(wizvars, "sends_auth")) {
-		username = ast_variable_find_last_in_list(wizvars, "outbound_auth/username");
+	if (is_variable_true(wizvars, "sends_auth")) {
+		if (!(username = ast_variable_find_last_in_list(wizvars, "outbound_auth/username"))) {
+			ast_log(LOG_ERROR, "Wizard '%s' must have 'outbound_auth/username' if it sends"
+				" authentication.\n", id);
+			return -1;
+		}
 	} else {
 		username = id;
 	}

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I6418d56de1ae53f80393b314c2584048fbf7f11d
Gerrit-Change-Number: 11062
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190228/68e958ec/attachment.html>


More information about the asterisk-code-review mailing list