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
This commit is contained in:
Sean Bright
2019-02-27 20:52:26 -05:00
parent b408bfdd06
commit 82a43394ed

View File

@@ -911,7 +911,11 @@ static int handle_registrations(const struct ast_sorcery *sorcery, struct object
}
if (is_variable_true(wizvars, "sends_auth")) {
username = ast_variable_find_last_in_list(wizvars, "outbound_auth/username");
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;
}