Protect against per_listener_settings being unset after it is set.

pull/2438/head
Roger A. Light 4 years ago
parent b62fd2ac71
commit 1cc82fc7e6

@ -2035,6 +2035,10 @@ static int config__read_file_core(struct mosquitto__config *config, bool reload,
}
if(conf__parse_string(&token, "password_file", &cur_security_options->password_file, &saveptr)) return MOSQ_ERR_INVAL;
}else if(!strcmp(token, "per_listener_settings")){
if(config->per_listener_settings){
/* Once this is set, don't let it be unset. It should be the first config option ideally. */
continue;
}
if(conf__parse_bool(&token, "per_listener_settings", &config->per_listener_settings, &saveptr)) return MOSQ_ERR_INVAL;
if(cur_security_options && config->per_listener_settings){
log__printf(NULL, MOSQ_LOG_ERR, "Error: per_listener_settings must be set before any other security settings.");

Loading…
Cancel
Save