auto_id_prefix now defaults to 'auto-'.

This commit is contained in:
Roger A. Light 2018-12-05 17:17:35 +00:00
parent 1d3949bce0
commit 48c2217015
4 changed files with 29 additions and 3 deletions

View File

@ -4,6 +4,7 @@
Broker features:
- Improved general support for broker generated client ids. Removed libuuid
dependency.
- auto_id_prefix now defaults to 'auto-'.
Client library features:
- Add mosquitto_subscribe_multiple() for sending subscriptions to multiple

View File

@ -262,7 +262,7 @@
<replaceable>true</replaceable>, this option allows you
to set a string that will be prefixed to the
automatically generated client ids to aid visibility in
logs. Defaults to no prefix.</para>
logs. Defaults to <option>auto-</option>.</para>
<para>Reloaded on reload signal.</para>
</listitem>
</varlistentry>

View File

@ -89,7 +89,8 @@
# If allow_zero_length_clientid is true, this option allows you to set a prefix
# to automatically generated client ids to aid visibility in logs.
#auto_id_prefix
# Defaults to 'auto-'
#auto_id_prefix auto-
# This option allows persistent clients (those with clean session set to false)
# to be removed if they do not reconnect within a certain time frame.

View File

@ -2066,8 +2066,10 @@ static int config__check(struct mosquitto__config *config)
{
/* Checks that are easy to make after the config has been loaded. */
int i;
#ifdef WITH_BRIDGE
int i, j;
int j;
struct mosquitto__bridge *bridge1, *bridge2;
char hostname[256];
int len;
@ -2115,6 +2117,28 @@ static int config__check(struct mosquitto__config *config)
}
}
#endif
/* Default to auto_id_prefix = 'auto-' if none set. */
if(config->per_listener_settings){
for(i=0; i<config->listener_count; i++){
if(!config->listeners[i].security_options.auto_id_prefix){
config->listeners[i].security_options.auto_id_prefix = mosquitto__strdup("auto-");
if(!config->listeners[i].security_options.auto_id_prefix){
return MOSQ_ERR_NOMEM;
}
config->listeners[i].security_options.auto_id_prefix_len = strlen("auto-");
}
}
}else{
if(!config->security_options.auto_id_prefix){
config->security_options.auto_id_prefix = mosquitto__strdup("auto-");
if(!config->security_options.auto_id_prefix){
return MOSQ_ERR_NOMEM;
}
config->security_options.auto_id_prefix_len = strlen("auto-");
}
}
return MOSQ_ERR_SUCCESS;
}