Skip to content

Commit

Permalink
Merge branch 'master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Oct 23, 2018
2 parents e5eb03b + 07d59d2 commit 35dea07
Show file tree
Hide file tree
Showing 29 changed files with 442 additions and 103 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ project(mosquitto)
cmake_minimum_required(VERSION 2.8)
# Only for version 3 and up. cmake_policy(SET CMP0042 NEW)

set (VERSION 1.5.2)
set (VERSION 1.5.3)

add_definitions (-DCMAKE -DVERSION=\"${VERSION}\")

Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ Foundation IP policy.
Please read the [Eclipse Foundation policy on accepting contributions via Git](http:https://wiki.eclipse.org/Development_Resources/Contributing_via_Git).

1. Sign the [Eclipse ECA](http:https://www.eclipse.org/legal/ECA.php)
1. Register for an Eclipse Foundation User ID. You can register [here](https://dev.eclipse.org/site_login/createaccount.php).
2. Log into the [Projects Portal](https://projects.eclipse.org/), and click on the '[Eclipse ECA](https://projects.eclipse.org/user/sign/eca)' link.
2. Go to your [account settings](https://dev.eclipse.org/site_login/myaccount.php#open_tab_accountsettings) and add your GitHub username to your account.
1. Register for an Eclipse Foundation User ID. You can register [here](https://accounts.eclipse.org/user/register).
2. Log into the [Accounts Portal](https://accounts.eclipse.org/), and click on the '[Eclipse Contributor Agreement](https://accounts.eclipse.org/user/eca)' link.
2. Go to your [account settings](https://accounts.eclipse.org/user/edit) and add your GitHub username to your account.
3. Make sure that you _sign-off_ your Git commits in the following format:
``` Signed-off-by: John Smith <[email protected]> ``` This is usually at the bottom of the commit message. You can automate this by adding the '-s' flag when you make the commits. e.g. ```git commit -s -m "Adding a cool feature"```
4. Ensure that the email address that you make your commits with is the same one you used to sign up to the Eclipse Foundation website with.
Expand Down
17 changes: 16 additions & 1 deletion ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
1.5.3 - 201810xx
1.5.3 - 20180925
================

Security:
- Fix CVE-2018-12543. If a message is sent to Mosquitto with a topic that
begins with $, but is not $SYS, then an assert that should be unreachable is
triggered and Mosquitto will exit.

Broker:
- Elevate log level to warning for situation when socket limit is hit.
- Remove requirement to use `user root` in snap package config files.
- Fix retained messages not sent by bridges on outgoing topics at the first
connection. Closes #701.
- Documentation fixes. Closes #520, #600.
- Fix duplicate clients being added to by_id hash before the old client was
removed. Closes #645.
- Fix Windows version not starting if include_dir did not contain any files.
Closes #566.

Build:
- Various fixes to ease building.


1.5.2 - 20180919
Expand Down
4 changes: 2 additions & 2 deletions client/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ SHARED_DEP:=../lib/libmosquitto.so.${SOVERSION}
endif

ifeq ($(WITH_SHARED_LIBRARIES),yes)
ALL_DEPS:= mosquitto_pub mosquitto_sub
ALL_DEPS:= mosquitto_pub mosquitto_sub
else
ifeq ($(WITH_STATIC_LIBRARIES),yes)
ALL_DEPS:= static_pub static_sub
ALL_DEPS:= static_pub static_sub
endif
endif

Expand Down
31 changes: 14 additions & 17 deletions config.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
#ifndef CONFIG_H
/* ============================================================
* Control compile time options.
* ============================================================
*
* Compile time options have moved to config.mk.
*/
* Platform options
* ============================================================ */

#ifdef __APPLE__
# define __DARWIN_C_SOURCE
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__SYMBIAN32__) || defined(__QNX__)
# define _XOPEN_SOURCE 700
# define __BSD_VISIBLE 1
# define HAVE_NETINET_IN_H
#else
# define _XOPEN_SOURCE 700
# define _DEFAULT_SOURCE 1
# define _POSIX_C_SOURCE 200809L
#endif


/* ============================================================
Expand All @@ -27,16 +36,4 @@
#define uthash_malloc(sz) mosquitto__malloc(sz)
#define uthash_free(ptr,sz) mosquitto__free(ptr)

#ifdef __APPLE__
# define __DARWIN_C_SOURCE
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__SYMBIAN32__) || defined(__QNX__)
# define _XOPEN_SOURCE 700
# define __BSD_VISIBLE 1
# define HAVE_NETINET_IN_H
#else
# define _XOPEN_SOURCE 700
# define _DEFAULT_SOURCE 1
# define _POSIX_C_SOURCE 200809L
#endif

#endif
10 changes: 6 additions & 4 deletions config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ WITH_BUNDLED_DEPS:=yes

# Also bump lib/mosquitto.h, CMakeLists.txt,
# installer/mosquitto.nsi, installer/mosquitto64.nsi
VERSION=1.5.2
VERSION=1.5.3

# Client library SO version. Bump if incompatible API/ABI changes are made.
SOVERSION=1
Expand Down Expand Up @@ -281,9 +281,11 @@ ifeq ($(WITH_WEBSOCKETS),static)
endif

INSTALL?=install
prefix=/usr/local
mandir=${prefix}/share/man
localedir=${prefix}/share/locale
prefix?=/usr/local
incdir?=${prefix}/include
libdir?=${prefix}/lib${LIB_SUFFIX}
localedir?=${prefix}/share/locale
mandir?=${prefix}/share/man
STRIP?=strip

ifeq ($(WITH_STRIP),yes)
Expand Down
2 changes: 1 addition & 1 deletion installer/mosquitto.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'

Name "Eclipse Mosquitto"
!define VERSION 1.5.2
!define VERSION 1.5.3
OutFile "mosquitto-${VERSION}-install-windows-x86.exe"

InstallDir "$PROGRAMFILES\mosquitto"
Expand Down
2 changes: 1 addition & 1 deletion installer/mosquitto64.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'

Name "Eclipse Mosquitto"
!define VERSION 1.5.2
!define VERSION 1.5.3
OutFile "mosquitto-${VERSION}-install-windows-x64.exe"

!include "x64.nsh"
Expand Down
28 changes: 13 additions & 15 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,28 @@ ifeq ($(WITH_SHARED_LIBRARIES),yes)
endif

install : all
$(INSTALL) -d "${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/"

$(INSTALL) -d "${DESTDIR}${libdir}/"
ifeq ($(WITH_SHARED_LIBRARIES),yes)
$(INSTALL) ${STRIP_OPTS} libmosquitto.so.${SOVERSION} "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.so.${SOVERSION}"
ln -sf libmosquitto.so.${SOVERSION} "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.so"
$(INSTALL) ${STRIP_OPTS} libmosquitto.so.${SOVERSION} "${DESTDIR}${libdir}/libmosquitto.so.${SOVERSION}"
ln -sf libmosquitto.so.${SOVERSION} "${DESTDIR}${libdir}/libmosquitto.so"
endif
ifeq ($(WITH_STATIC_LIBRARIES),yes)
$(INSTALL) libmosquitto.a "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.a"
${CROSS_COMPILE}${STRIP} -g --strip-unneeded "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.a"
$(INSTALL) ${STRIP_OPTS} libmosquitto.a "${DESTDIR}${libdir}/libmosquitto.a"
endif
$(INSTALL) -d "${DESTDIR}${prefix}/include/"
$(INSTALL) mosquitto.h "${DESTDIR}${prefix}/include/mosquitto.h"
$(INSTALL) -d "${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/pkgconfig"
$(INSTALL) -m644 ../libmosquitto.pc.in "${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/pkgconfig/libmosquitto.pc"
sed -i -e "s#@CMAKE_INSTALL_PREFIX@#$(prefix)#" -e "s#@VERSION@#$(VERSION)#" "${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/pkgconfig/libmosquitto.pc"
$(INSTALL) -d "${DESTDIR}${incdir}/"
$(INSTALL) mosquitto.h "${DESTDIR}${incdir}/mosquitto.h"
$(INSTALL) -d "${DESTDIR}${libdir}/pkgconfig"
$(INSTALL) -m644 ../libmosquitto.pc.in "${DESTDIR}${libdir}/pkgconfig/libmosquitto.pc"
sed -i -e "s#@CMAKE_INSTALL_PREFIX@#${prefix}#" -e "s#@VERSION@#${VERSION}#" "${DESTDIR}${libdir}/pkgconfig/libmosquitto.pc"
ifeq ($(WITH_SHARED_LIBRARIES),yes)
$(MAKE) -C cpp install
endif

uninstall :
-rm -f "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.so.${SOVERSION}"
-rm -f "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.so"
-rm -f "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquitto.a"
-rm -f "${DESTDIR}${prefix}/include/mosquitto.h"
-rm -f "${DESTDIR}${libdir}/libmosquitto.so.${SOVERSION}"
-rm -f "${DESTDIR}${libdir}/libmosquitto.so"
-rm -f "${DESTDIR}${libdir}/libmosquitto.a"
-rm -f "${DESTDIR}${incdir}/mosquitto.h"

reallyclean : clean

Expand Down
28 changes: 14 additions & 14 deletions lib/cpp/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ endif
all : ${ALL_DEPS}

install : all
$(INSTALL) -d "${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/"
$(INSTALL) ${STRIP_OPTS} libmosquittopp.so.${SOVERSION} "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.so.${SOVERSION}"
ln -sf libmosquittopp.so.${SOVERSION} "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.so"
$(INSTALL) -d "${DESTDIR}${libdir}/"
$(INSTALL) ${STRIP_OPTS} libmosquittopp.so.${SOVERSION} "${DESTDIR}${libdir}/libmosquittopp.so.${SOVERSION}"
ln -sf libmosquittopp.so.${SOVERSION} "${DESTDIR}${libdir}/libmosquittopp.so"
ifeq ($(WITH_STATIC_LIBRARIES),yes)
$(INSTALL) libmosquittopp.a "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.a"
${CROSS_COMPILE}${STRIP} -g --strip-unneeded "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.a"
$(INSTALL) libmosquittopp.a "${DESTDIR}${libdir}/libmosquittopp.a"
${CROSS_COMPILE}${STRIP} -g --strip-unneeded "${DESTDIR}${libdir}/libmosquittopp.a"
endif
$(INSTALL) -d "${DESTDIR}${prefix}/include/"
$(INSTALL) mosquittopp.h "${DESTDIR}${prefix}/include/mosquittopp.h"
$(INSTALL) -d "${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/pkgconfig"
$(INSTALL) -m644 ../../libmosquittopp.pc.in "${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/pkgconfig/libmosquittopp.pc"
sed -i -e "s#@CMAKE_INSTALL_PREFIX@#$(prefix)#" -e "s#@VERSION@#$(VERSION)#" "${DESTDIR}$(prefix)/lib${LIB_SUFFIX}/pkgconfig/libmosquittopp.pc"
$(INSTALL) -d "${DESTDIR}${incdir}/"
$(INSTALL) mosquittopp.h "${DESTDIR}${incdir}/mosquittopp.h"
$(INSTALL) -d "${DESTDIR}${libdir}/pkgconfig/"
$(INSTALL) -m644 ../../libmosquittopp.pc.in "${DESTDIR}${libdir}/pkgconfig/libmosquittopp.pc"
sed -i -e "s#@CMAKE_INSTALL_PREFIX@#${prefix}#" -e "s#@VERSION@#${VERSION}#" "${DESTDIR}${libdir}/pkgconfig/libmosquittopp.pc"

uninstall :
-rm -f "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.so.${SOVERSION}"
-rm -f "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.so"
-rm -f "${DESTDIR}${prefix}/lib${LIB_SUFFIX}/libmosquittopp.a"
-rm -f "${DESTDIR}${prefix}/include/mosquittopp.h"
-rm -f "${DESTDIR}${libdir}/libmosquittopp.so.${SOVERSION}"
-rm -f "${DESTDIR}${libdir}/libmosquittopp.so"
-rm -f "${DESTDIR}${libdir}/libmosquittopp.a"
-rm -f "${DESTDIR}${incdir}/mosquittopp.h"

clean :
-rm -f *.o libmosquittopp.so.${SOVERSION} libmosquittopp.a
Expand Down
2 changes: 1 addition & 1 deletion lib/mosquitto.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extern "C" {

#define LIBMOSQUITTO_MAJOR 1
#define LIBMOSQUITTO_MINOR 5
#define LIBMOSQUITTO_REVISION 2
#define LIBMOSQUITTO_REVISION 3
/* LIBMOSQUITTO_VERSION_NUMBER looks like 1002001 for e.g. version 1.2.1. */
#define LIBMOSQUITTO_VERSION_NUMBER (LIBMOSQUITTO_MAJOR*1000000+LIBMOSQUITTO_MINOR*1000+LIBMOSQUITTO_REVISION)

Expand Down
2 changes: 2 additions & 0 deletions lib/mosquitto_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ struct mosquitto {
#endif
bool clean_session;
#ifdef WITH_BROKER
char *old_id; /* for when a duplicate client connects, but we still want to
know what the id was */
bool is_dropping;
bool is_bridge;
struct mosquitto__bridge *bridge;
Expand Down
24 changes: 23 additions & 1 deletion man/mosquitto.conf.5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,17 @@
<para>Reloaded on reload signal.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>allow_zero_length_clientid</option> [ true | false ]</term>
<listitem>
<para>MQTT 3.1.1 allows clients to connect with a zero
length client id and have the broker generate a client
id for them. Use this option to allow/disallow this
behaviour. Defaults to true.</para>
<para>See also the <option>auto_id_prefix</option> option.</para>
<para>Reloaded on reload signal.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>auth_opt_*</option> <replaceable>value</replaceable></term>
<listitem>
Expand Down Expand Up @@ -244,6 +255,17 @@
<para>Not currently reloaded on reload signal.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>auto_id_prefix</option> <replaceable>prefix</replaceable></term>
<listitem>
<para>If <option>allow_zero_length_clientid</option> is
<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>
<para>Reloaded on reload signal.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>autosave_interval</option> <replaceable>seconds</replaceable></term>
<listitem>
Expand Down Expand Up @@ -763,7 +785,7 @@
client connected to a listener with mount point
<replaceable>example</replaceable> can only see
messages that are published in the topic hierarchy
<replaceable>example</replaceable> and above.</para>
<replaceable>example</replaceable> and below.</para>
<para>Not reloaded on reload signal.</para>
</listitem>
</varlistentry>
Expand Down
2 changes: 1 addition & 1 deletion set-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

MAJOR=1
MINOR=5
REVISION=2
REVISION=3

sed -i "s/^VERSION=.*/VERSION=${MAJOR}.${MINOR}.${REVISION}/" config.mk

Expand Down
9 changes: 8 additions & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: mosquitto
version: 1.5.2
version: 1.5.3-1
summary: Eclipse Mosquitto MQTT broker
description: This is a message broker that supports version 3.1 and 3.1.1 of the MQTT
protocol.
Expand All @@ -26,6 +26,9 @@ apps:
command: usr/bin/mosquitto_sub
plugs: [network]

passwd:
command: usr/bin/mosquitto_passwd


parts:
script:
Expand Down Expand Up @@ -63,10 +66,14 @@ parts:
- usr/sbin/mosquitto
- usr/bin/mosquitto_pub
- usr/bin/mosquitto_sub
- usr/bin/mosquitto_passwd
- usr/lib/libmosquitto.so*
- lib/*-linux-gnu/libcrypto.so*
- lib/*-linux-gnu/libssl.so*
- lib/*-linux-gnu/libuuid.so*
- usr/include/mosquitto.h
- usr/include/mosquitto_broker.h
- usr/include/mosquitto_plugin.h

lws:
plugin: cmake
Expand Down
6 changes: 6 additions & 0 deletions src/bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ int bridge__connect_step1(struct mosquitto_db *db, struct mosquitto *context)
if(context->bridge->topics[i].direction == bd_out || context->bridge->topics[i].direction == bd_both){
log__printf(NULL, MOSQ_LOG_DEBUG, "Bridge %s doing local SUBSCRIBE on topic %s", context->id, context->bridge->topics[i].local_topic);
if(sub__add(db, context, context->bridge->topics[i].local_topic, context->bridge->topics[i].qos, &db->subs)) return 1;
sub__retain_queue(db, context,
context->bridge->topics[i].local_topic,
context->bridge->topics[i].qos);
}
}

Expand Down Expand Up @@ -308,6 +311,9 @@ int bridge__connect(struct mosquitto_db *db, struct mosquitto *context)
if(context->bridge->topics[i].direction == bd_out || context->bridge->topics[i].direction == bd_both){
log__printf(NULL, MOSQ_LOG_DEBUG, "Bridge %s doing local SUBSCRIBE on topic %s", context->id, context->bridge->topics[i].local_topic);
if(sub__add(db, context, context->bridge->topics[i].local_topic, context->bridge->topics[i].qos, &db->subs)) return 1;
sub__retain_queue(db, context,
context->bridge->topics[i].local_topic,
context->bridge->topics[i].qos);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1208,8 +1208,8 @@ int config__read_file_core(struct mosquitto__config *config, bool reload, struct
snprintf(dirpath, MAX_PATH, "%s\\*.conf", token);
fh = FindFirstFile(dirpath, &find_data);
if(fh == INVALID_HANDLE_VALUE){
log__printf(NULL, MOSQ_LOG_ERR, "Error: Unable to open include_dir '%s'.", token);
return 1;
/* No files found */
continue;
}

do{
Expand Down
4 changes: 4 additions & 0 deletions src/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ void context__cleanup(struct mosquitto_db *db, struct mosquitto *context, bool d
mosquitto__free(context->id);
context->id = NULL;
}
if(context->old_id){
mosquitto__free(context->old_id);
context->old_id = NULL;
}
packet__cleanup(&(context->in_packet));
if(context->current_out_packet){
packet__cleanup(context->current_out_packet);
Expand Down
5 changes: 5 additions & 0 deletions src/loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,12 +638,17 @@ void do_disconnect(struct mosquitto_db *db, struct mosquitto *context)
context->sock = INVALID_SOCKET;
context->pollfd_index = -1;
}
HASH_DELETE(hh_id, db->contexts_by_id, context);
context->old_id = context->id;
context->id = NULL;
}else
#endif
{
if(db->config->connection_messages == true){
if(context->id){
id = context->id;
}else if(context->old_id){
id = context->old_id;
}else{
id = "<unknown>";
}
Expand Down
Loading

0 comments on commit 35dea07

Please sign in to comment.