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

Sean Bright asteriskteam at digium.com
Wed Feb 27 19:53:57 CST 2019


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11060


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(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/60/11060/1

diff --git a/res/res_pjsip_config_wizard.c b/res/res_pjsip_config_wizard.c
index d487c4d..0bdedd5 100644
--- a/res/res_pjsip_config_wizard.c
+++ b/res/res_pjsip_config_wizard.c
@@ -912,8 +912,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/+/11060
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I6418d56de1ae53f80393b314c2584048fbf7f11d
Gerrit-Change-Number: 11060
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190227/203dd226/attachment-0001.html>


More information about the asterisk-code-review mailing list