|
|
@ -341,7 +341,7 @@ void config__cleanup(struct mosquitto__config *config)
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
mosquitto__free(config->bridges[i].tls_version);
|
|
|
|
mosquitto__free(config->bridges[i].tls_version);
|
|
|
|
mosquitto__free(config->bridges[i].tls_cafile);
|
|
|
|
mosquitto__free(config->bridges[i].tls_cafile);
|
|
|
|
#ifdef WITH_TLS_PSK
|
|
|
|
#ifdef FINAL_WITH_TLS_PSK
|
|
|
|
mosquitto__free(config->bridges[i].tls_psk_identity);
|
|
|
|
mosquitto__free(config->bridges[i].tls_psk_identity);
|
|
|
|
mosquitto__free(config->bridges[i].tls_psk);
|
|
|
|
mosquitto__free(config->bridges[i].tls_psk);
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
@ -687,7 +687,7 @@ int config__read(struct mosquitto_db *db, struct mosquitto__config *config, bool
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef WITH_TLS_PSK
|
|
|
|
#ifdef FINAL_WITH_TLS_PSK
|
|
|
|
if(config->bridges[i].tls_psk && !config->bridges[i].tls_psk_identity){
|
|
|
|
if(config->bridges[i].tls_psk && !config->bridges[i].tls_psk_identity){
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration: missing bridge_identity.\n");
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration: missing bridge_identity.\n");
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
@ -921,7 +921,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef WITH_TLS_PSK
|
|
|
|
#ifdef FINAL_WITH_TLS_PSK
|
|
|
|
if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){
|
|
|
|
if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Cannot use both certificate and psk encryption in a single bridge.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Cannot use both certificate and psk encryption in a single bridge.");
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
@ -938,7 +938,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef WITH_TLS_PSK
|
|
|
|
#ifdef FINAL_WITH_TLS_PSK
|
|
|
|
if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){
|
|
|
|
if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Cannot use both certificate and psk encryption in a single bridge.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Cannot use both certificate and psk encryption in a single bridge.");
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
@ -955,7 +955,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef WITH_TLS_PSK
|
|
|
|
#ifdef FINAL_WITH_TLS_PSK
|
|
|
|
if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){
|
|
|
|
if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Cannot use both certificate and psk encryption in a single bridge.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Cannot use both certificate and psk encryption in a single bridge.");
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
@ -966,7 +966,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge and/or TLS support not available.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge and/or TLS support not available.");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}else if(!strcmp(token, "bridge_identity")){
|
|
|
|
}else if(!strcmp(token, "bridge_identity")){
|
|
|
|
#if defined(WITH_BRIDGE) && defined(WITH_TLS_PSK)
|
|
|
|
#if defined(WITH_BRIDGE) && defined(FINAL_WITH_TLS_PSK)
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
if(!cur_bridge){
|
|
|
|
if(!cur_bridge){
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
@ -1001,7 +1001,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#ifdef WITH_TLS_PSK
|
|
|
|
#ifdef FINAL_WITH_TLS_PSK
|
|
|
|
if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){
|
|
|
|
if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Cannot use both certificate and psk encryption in a single bridge.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Cannot use both certificate and psk encryption in a single bridge.");
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
@ -1036,7 +1036,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge support not available.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge support not available.");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}else if(!strcmp(token, "bridge_psk")){
|
|
|
|
}else if(!strcmp(token, "bridge_psk")){
|
|
|
|
#if defined(WITH_BRIDGE) && defined(WITH_TLS_PSK)
|
|
|
|
#if defined(WITH_BRIDGE) && defined(FINAL_WITH_TLS_PSK)
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
if(!cur_bridge){
|
|
|
|
if(!cur_bridge){
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
@ -1692,7 +1692,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Empty protocol value in configuration.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Empty protocol value in configuration.");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}else if(!strcmp(token, "psk_file")){
|
|
|
|
}else if(!strcmp(token, "psk_file")){
|
|
|
|
#ifdef WITH_TLS_PSK
|
|
|
|
#ifdef FINAL_WITH_TLS_PSK
|
|
|
|
conf__set_cur_security_options(config, cur_listener, &cur_security_options);
|
|
|
|
conf__set_cur_security_options(config, cur_listener, &cur_security_options);
|
|
|
|
if(reload){
|
|
|
|
if(reload){
|
|
|
|
mosquitto__free(cur_security_options->psk_file);
|
|
|
|
mosquitto__free(cur_security_options->psk_file);
|
|
|
@ -1703,7 +1703,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS/TLS-PSK support not available.");
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS/TLS-PSK support not available.");
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
}else if(!strcmp(token, "psk_hint")){
|
|
|
|
}else if(!strcmp(token, "psk_hint")){
|
|
|
|
#ifdef WITH_TLS_PSK
|
|
|
|
#ifdef FINAL_WITH_TLS_PSK
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
if(conf__parse_string(&token, "psk_hint", &cur_listener->psk_hint, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
if(conf__parse_string(&token, "psk_hint", &cur_listener->psk_hint, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
#else
|
|
|
|
#else
|
|
|
|