|
|
|
@ -778,6 +778,10 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
struct mosquitto__listener *cur_listener = &config->default_listener;
|
|
|
|
|
int i;
|
|
|
|
|
int lineno_ext = 0;
|
|
|
|
|
char **files;
|
|
|
|
|
int file_count;
|
|
|
|
|
char *kpass_sha = NULL, *kpass_sha_bin = NULL;
|
|
|
|
|
char *keyform ;
|
|
|
|
|
|
|
|
|
|
*lineno = 0;
|
|
|
|
|
|
|
|
|
@ -798,7 +802,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
if(conf__parse_string(&token, "acl_file", &cur_security_options->acl_file, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(!strcmp(token, "address") || !strcmp(token, "addresses")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge || cur_bridge->addresses){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -860,7 +864,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
conf__set_cur_security_options(config, cur_listener, &cur_security_options);
|
|
|
|
|
if(conf__parse_bool(&token, "allow_zero_length_clientid", &cur_security_options->allow_zero_length_clientid, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(!strncmp(token, "auth_opt_", 9)){
|
|
|
|
|
if(reload) continue; // Auth plugin not currently valid for reloading.
|
|
|
|
|
if(reload) continue; /* Auth plugin not currently valid for reloading. */
|
|
|
|
|
if(!cur_auth_plugin_config){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: An auth_opt_ option exists in the config file without an auth_plugin.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -903,7 +907,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
|
}
|
|
|
|
|
}else if(!strcmp(token, "auth_plugin")){
|
|
|
|
|
if(reload) continue; // Auth plugin not currently valid for reloading.
|
|
|
|
|
if(reload) continue; /* Auth plugin not currently valid for reloading. */
|
|
|
|
|
conf__set_cur_security_options(config, cur_listener, &cur_security_options);
|
|
|
|
|
cur_security_options->auth_plugin_configs = mosquitto__realloc(cur_security_options->auth_plugin_configs, (cur_security_options->auth_plugin_config_count+1)*sizeof(struct mosquitto__auth_plugin_config));
|
|
|
|
|
if(!cur_security_options->auth_plugin_configs){
|
|
|
|
@ -919,7 +923,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
cur_security_options->auth_plugin_config_count++;
|
|
|
|
|
if(conf__parse_string(&token, "auth_plugin", &cur_auth_plugin_config->path, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(!strcmp(token, "auth_plugin_deny_special_chars")){
|
|
|
|
|
if(reload) continue; // Auth plugin not currently valid for reloading.
|
|
|
|
|
if(reload) continue; /* Auth plugin not currently valid for reloading. */
|
|
|
|
|
if(!cur_auth_plugin_config){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: An auth_plugin_deny_special_chars option exists in the config file without an auth_plugin.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -939,14 +943,14 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
}else if(!strcmp(token, "autosave_on_changes")){
|
|
|
|
|
if(conf__parse_bool(&token, "autosave_on_changes", &config->autosave_on_changes, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(!strcmp(token, "bind_address")){
|
|
|
|
|
if(reload) continue; // Listener not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_string(&token, "default listener bind_address", &config->default_listener.host, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
if(conf__attempt_resolve(config->default_listener.host, "bind_address", MOSQ_LOG_ERR, "Error")){
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
|
}
|
|
|
|
|
}else if(!strcmp(token, "bind_interface")){
|
|
|
|
|
#ifdef SO_BINDTODEVICE
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_string(&token, "bind_interface", &cur_listener->bind_interface, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
#else
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: bind_interface specified but socket option not available.");
|
|
|
|
@ -954,7 +958,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "bridge_attempt_unsubscribe")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -965,7 +969,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "bridge_cafile")){
|
|
|
|
|
#if defined(WITH_BRIDGE) && defined(WITH_TLS)
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -982,7 +986,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "bridge_alpn")){
|
|
|
|
|
#if defined(WITH_BRIDGE) && defined(WITH_TLS)
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -993,7 +997,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "bridge_capath")){
|
|
|
|
|
#if defined(WITH_BRIDGE) && defined(WITH_TLS)
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1010,7 +1014,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "bridge_certfile")){
|
|
|
|
|
#if defined(WITH_BRIDGE) && defined(WITH_TLS)
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1027,7 +1031,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "bridge_identity")){
|
|
|
|
|
#if defined(WITH_BRIDGE) && defined(FINAL_WITH_TLS_PSK)
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1042,7 +1046,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "bridge_insecure")){
|
|
|
|
|
#if defined(WITH_BRIDGE) && defined(WITH_TLS)
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1056,7 +1060,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "bridge_require_ocsp")){
|
|
|
|
|
#if defined(WITH_BRIDGE) && defined(WITH_TLS)
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1067,7 +1071,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "bridge_keyfile")){
|
|
|
|
|
#if defined(WITH_BRIDGE) && defined(WITH_TLS)
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1084,7 +1088,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "bridge_protocol_version")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1108,7 +1112,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "bridge_psk")){
|
|
|
|
|
#if defined(WITH_BRIDGE) && defined(FINAL_WITH_TLS_PSK)
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1123,7 +1127,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "bridge_tls_version")){
|
|
|
|
|
#if defined(WITH_BRIDGE) && defined(WITH_TLS)
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1134,7 +1138,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "cafile")){
|
|
|
|
|
#if defined(WITH_TLS)
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(cur_listener->psk_hint){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Cannot use both certificate and psk encryption in a single listener.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1145,14 +1149,14 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "capath")){
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_string(&token, "capath", &cur_listener->capath, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
#else
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS support not available.");
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "certfile")){
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(cur_listener->psk_hint){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Cannot use both certificate and psk encryption in a single listener.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1166,14 +1170,14 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
if(conf__parse_bool(&token, "check_retain_source", &config->check_retain_source, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(!strcmp(token, "ciphers")){
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_string(&token, "ciphers", &cur_listener->ciphers, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
#else
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS support not available.");
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "clientid") || !strcmp(token, "remote_clientid")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1184,7 +1188,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "cleansession")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1201,7 +1205,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
if(conf__parse_string(&token, "clientid_prefixes", &config->clientid_prefixes, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(!strcmp(token, "connection")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
token = strtok_r(NULL, " ", &saveptr);
|
|
|
|
|
if(token){
|
|
|
|
|
/* Check for existing bridge name. */
|
|
|
|
@ -1249,28 +1253,28 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
if(conf__parse_bool(&token, token, &config->connection_messages, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(!strcmp(token, "crlfile")){
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_string(&token, "crlfile", &cur_listener->crlfile, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
#else
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS support not available.");
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "dhparamfile")){
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_string(&token, "dhparamfile", &cur_listener->dhparamfile, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
#else
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS support not available.");
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "http_dir")){
|
|
|
|
|
#ifdef WITH_WEBSOCKETS
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_string(&token, "http_dir", &cur_listener->http_dir, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
#else
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Websockets support not available.");
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "idle_timeout")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1292,8 +1296,6 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char **files;
|
|
|
|
|
int file_count;
|
|
|
|
|
rc = config__get_dir_files(token, &files, &file_count);
|
|
|
|
|
if(rc) return rc;
|
|
|
|
|
|
|
|
|
@ -1317,7 +1319,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
}
|
|
|
|
|
}else if(!strcmp(token, "keepalive_interval")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1332,7 +1334,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "keyfile")){
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_string(&token, "keyfile", &cur_listener->keyfile, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
#else
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS support not available.");
|
|
|
|
@ -1392,7 +1394,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
}
|
|
|
|
|
}else if(!strcmp(token, "local_clientid")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1403,7 +1405,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "local_password")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1414,7 +1416,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "local_username")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1549,7 +1551,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Empty log_type value in configuration.");
|
|
|
|
|
}
|
|
|
|
|
}else if(!strcmp(token, "max_connections")){
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
token = strtok_r(NULL, " ", &saveptr);
|
|
|
|
|
if(token){
|
|
|
|
|
cur_listener->max_connections = atoi(token);
|
|
|
|
@ -1558,7 +1560,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Empty max_connections value in configuration.");
|
|
|
|
|
}
|
|
|
|
|
}else if(!strcmp(token, "maximum_qos")){
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_int(&token, "maximum_qos", &tmp_int, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
if(tmp_int < 0 || tmp_int > 2){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: maximum_qos must be between 0 and 2 inclusive.");
|
|
|
|
@ -1625,7 +1627,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
|
}
|
|
|
|
|
}else if(!strcmp(token, "mount_point")){
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(config->listener_count == 0){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: You must use create a listener before using the mount_point option in the configuration file.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1639,7 +1641,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
}
|
|
|
|
|
}else if(!strcmp(token, "notifications")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1650,7 +1652,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "notifications_local_only")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1661,7 +1663,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "notification_topic")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1672,7 +1674,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "password") || !strcmp(token, "remote_password")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1733,10 +1735,10 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Empty persistent_client_expiration value in configuration.");
|
|
|
|
|
}
|
|
|
|
|
}else if(!strcmp(token, "pid_file")){
|
|
|
|
|
if(reload) continue; // pid file not valid for reloading.
|
|
|
|
|
if(reload) continue; /* pid file not valid for reloading. */
|
|
|
|
|
if(conf__parse_string(&token, "pid_file", &config->pid_file, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(!strcmp(token, "port")){
|
|
|
|
|
if(reload) continue; // Listener not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(config->default_listener.port){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Default listener port specified multiple times. Only the latest will be used.");
|
|
|
|
|
}
|
|
|
|
@ -1783,7 +1785,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "psk_hint")){
|
|
|
|
|
#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;
|
|
|
|
|
#else
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS/TLS-PSK support not available.");
|
|
|
|
@ -1792,14 +1794,14 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
if(conf__parse_bool(&token, token, &config->queue_qos0_messages, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(!strcmp(token, "require_certificate")){
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_bool(&token, "require_certificate", &cur_listener->require_certificate, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
#else
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS support not available.");
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "restart_timeout")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1832,7 +1834,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: The retry_interval option is no longer available.");
|
|
|
|
|
}else if(!strcmp(token, "round_robin")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1845,7 +1847,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
if(conf__parse_bool(&token, "set_tcp_nodelay", &config->set_tcp_nodelay, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(!strcmp(token, "start_type")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1873,7 +1875,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge support not available.");
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "socket_domain")){
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
token = strtok_r(NULL, " ", &saveptr);
|
|
|
|
|
if(token){
|
|
|
|
|
if(!strcmp(token, "ipv4")){
|
|
|
|
@ -1898,7 +1900,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
}
|
|
|
|
|
}else if(!strcmp(token, "threshold")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -1913,15 +1915,14 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "tls_engine")){
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_string(&token, "tls_engine", &cur_listener->tls_engine, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
#else
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS support not available.");
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "tls_engine_kpass_sha1")){
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
char *kpass_sha = NULL, *kpass_sha_bin = NULL;
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_string(&token, "tls_engine_kpass_sha1", &kpass_sha, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
if(mosquitto__hex2bin_sha1(kpass_sha, (unsigned char**)&kpass_sha_bin) != MOSQ_ERR_SUCCESS){
|
|
|
|
|
mosquitto__free(kpass_sha);
|
|
|
|
@ -1934,8 +1935,8 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "tls_keyform")){
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
char *keyform = NULL;
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
keyform = NULL;
|
|
|
|
|
if(conf__parse_string(&token, "tls_keyform", &keyform, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
cur_listener->tls_keyform = mosq_k_pem;
|
|
|
|
|
if(!strcmp(keyform, "engine")) cur_listener->tls_keyform = mosq_k_engine;
|
|
|
|
@ -1945,14 +1946,14 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "tls_version")){
|
|
|
|
|
#if defined(WITH_TLS)
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_string(&token, "tls_version", &cur_listener->tls_version, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
#else
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS support not available.");
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "topic")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -2105,7 +2106,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: Bridge support not available.");
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "max_topic_alias")){
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
token = strtok_r(NULL, " ", &saveptr);
|
|
|
|
|
if(token){
|
|
|
|
|
cur_listener->max_topic_alias = atoi(token);
|
|
|
|
@ -2114,7 +2115,7 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
}
|
|
|
|
|
}else if(!strcmp(token, "try_private")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
@ -2127,28 +2128,28 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
|
|
|
|
|
if(conf__parse_bool(&token, token, &config->upgrade_outgoing_qos, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(!strcmp(token, "use_identity_as_username")){
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_bool(&token, "use_identity_as_username", &cur_listener->use_identity_as_username, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
#else
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS support not available.");
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "use_subject_as_username")){
|
|
|
|
|
#ifdef WITH_TLS
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_bool(&token, "use_subject_as_username", &cur_listener->use_subject_as_username, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
#else
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_WARNING, "Warning: TLS support not available.");
|
|
|
|
|
#endif
|
|
|
|
|
}else if(!strcmp(token, "user")){
|
|
|
|
|
if(reload) continue; // Drop privileges user not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Drop privileges user not valid for reloading. */
|
|
|
|
|
mosquitto__free(config->user);
|
|
|
|
|
if(conf__parse_string(&token, "user", &config->user, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(!strcmp(token, "use_username_as_clientid")){
|
|
|
|
|
if(reload) continue; // Listeners not valid for reloading.
|
|
|
|
|
if(reload) continue; /* Listeners not valid for reloading. */
|
|
|
|
|
if(conf__parse_bool(&token, "use_username_as_clientid", &cur_listener->use_username_as_clientid, saveptr)) return MOSQ_ERR_INVAL;
|
|
|
|
|
}else if(!strcmp(token, "username") || !strcmp(token, "remote_username")){
|
|
|
|
|
#ifdef WITH_BRIDGE
|
|
|
|
|
if(reload) continue; // FIXME
|
|
|
|
|
if(reload) continue; /* FIXME */
|
|
|
|
|
if(!cur_bridge){
|
|
|
|
|
log__printf(NULL, MOSQ_LOG_ERR, "Error: Invalid bridge configuration.");
|
|
|
|
|
return MOSQ_ERR_INVAL;
|
|
|
|
|