diff --git a/ChangeLog.txt b/ChangeLog.txt index 75ca22f0..e505f825 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,7 @@ +Clients: +- Don't use / in auto-generated client ids. + + 1.4.12 - 20170528 ================= diff --git a/client/client_shared.c b/client/client_shared.c index caa33e18..fa3ea188 100644 --- a/client/client_shared.c +++ b/client/client_shared.c @@ -727,14 +727,14 @@ int client_id_generate(struct mosq_config *cfg, const char *id_base) hostname[0] = '\0'; gethostname(hostname, 256); hostname[255] = '\0'; - len = strlen(id_base) + strlen("/-") + 6 + strlen(hostname); + len = strlen(id_base) + strlen("|-") + 6 + strlen(hostname); cfg->id = malloc(len); if(!cfg->id){ if(!cfg->quiet) fprintf(stderr, "Error: Out of memory.\n"); mosquitto_lib_cleanup(); return 1; } - snprintf(cfg->id, len, "%s/%d-%s", id_base, getpid(), hostname); + snprintf(cfg->id, len, "%s|%d-%s", id_base, getpid(), hostname); if(strlen(cfg->id) > MOSQ_MQTT_ID_MAX_LENGTH){ /* Enforce maximum client id length of 23 characters */ cfg->id[MOSQ_MQTT_ID_MAX_LENGTH] = '\0';