From 82a43394ed8af87c421b6b0505731f04bd8c0e99 Mon Sep 17 00:00:00 2001 From: Sean Bright <sean.bright@gmail.com> Date: Wed, 27 Feb 2019 20:52:26 -0500 Subject: [PATCH] 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 --- res/res_pjsip_config_wizard.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/res/res_pjsip_config_wizard.c b/res/res_pjsip_config_wizard.c index 3a761a7c7e..4d24922880 100644 --- a/res/res_pjsip_config_wizard.c +++ b/res/res_pjsip_config_wizard.c @@ -910,8 +910,12 @@ static int handle_registrations(const struct ast_sorcery *sorcery, struct object 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; } -- GitLab