From: Sean Bright Date: Thu, 28 Feb 2019 01:52:26 +0000 (-0500) Subject: res_pjsip_config_wizard: Don't crash if misconfigured X-Git-Tag: 13.26.0-rc1~39^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85b1f8f88649f8f04b63e9eb71bd1245a5f3369f;p=thirdparty%2Fasterisk.git 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 --- diff --git a/res/res_pjsip_config_wizard.c b/res/res_pjsip_config_wizard.c index d487c4ddda..0bdedd59d2 100644 --- a/res/res_pjsip_config_wizard.c +++ b/res/res_pjsip_config_wizard.c @@ -912,8 +912,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; }