mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-09-25 11:15:54 +08:00
Merge branch 'master' into develop
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
<!--
|
||||
|
||||
STOP! If you are reporting a security issue, which includes *anything* that
|
||||
may cause the broker/client to crash, please do NOT report it here but
|
||||
follow the steps at https://www.eclipse.org/security/
|
||||
|
||||
If your issue is not a bug or a feature request, please use the mailing list at
|
||||
https://dev.eclipse.org/mailman/listinfo/mosquitto-dev to ask your question.
|
||||
There are many more people available to help there than on this issue tracker.
|
||||
|
||||
If you are reporting a bug PLEASE include the version of Mosquitto you are
|
||||
using and what platform (Windows, Ubuntu/Fedora/... Linux, FreeBSD, ...) you
|
||||
are running on.
|
||||
|
||||
Please also note that some systems have old versions of Mosquitto available in
|
||||
their package repositories. We would be very grateful if you would check to
|
||||
see whether the bug is still present in a newer version before submitting your
|
||||
issue.
|
||||
|
||||
-->
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.0)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
|
||||
project(mosquitto)
|
||||
set (VERSION 2.0.8)
|
||||
set (VERSION 2.0.10)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/")
|
||||
|
||||
|
||||
+60
-1
@@ -36,15 +36,72 @@ Clients:
|
||||
Closes #2180.
|
||||
|
||||
|
||||
2.0.9 - 2021-03-xx
|
||||
2.0.10 - 2021-04-03
|
||||
==================
|
||||
|
||||
Security:
|
||||
- CVE-2021-23980: If an authenticated client connected with MQTT v5 sent a
|
||||
malformed CONNACK message to the broker a NULL pointer dereference occurred,
|
||||
most likely resulting in a segfault.
|
||||
Affects versions 2.0.0 to 2.0.9 inclusive.
|
||||
|
||||
Broker:
|
||||
- Don't over write new receive-maximum if a v5 client connects and takes over
|
||||
an old session. Closes #2134.
|
||||
- Fix CVE-xxxx-xxxx. Closes #2163.
|
||||
|
||||
Clients:
|
||||
- Set `receive-maximum` to not exceed the `-C` message count in mosquitto_sub
|
||||
and mosquitto_rr, to avoid potentially lost messages. Closes #2134.
|
||||
- Fix TLS-PSK mode not working with port 8883. Closes #2152.
|
||||
|
||||
Client library:
|
||||
- Fix possible socket leak. This would occur if a client was using
|
||||
`mosquitto_loop_start()`, then if the connection failed due to the remote
|
||||
server being inaccessible they called `mosquitto_loop_stop(, true)` and
|
||||
recreated the mosquitto object.
|
||||
|
||||
Build:
|
||||
- A variety of minor build related fixes, like functions not having previous
|
||||
declarations.
|
||||
- Fix CMake cross compile builds not finding opensslconf.h. Closes #2160.
|
||||
- Fix build on Solaris non-sparc. Closes #2136.
|
||||
|
||||
|
||||
2.0.9 - 2021-03-11
|
||||
==================
|
||||
|
||||
Security:
|
||||
- If an empty or invalid CA file was provided to the client library for
|
||||
verifying the remote broker, then the initial connection would fail but
|
||||
subsequent connections would succeed without verifying the remote broker
|
||||
certificate. Closes #2130.
|
||||
- If an empty or invalid CA file was provided to the broker for verifying the
|
||||
remote broker for an outgoing bridge connection then the initial connection
|
||||
would fail but subsequent connections would succeed without verifying the
|
||||
remote broker certificate. Closes #2130.
|
||||
|
||||
Broker:
|
||||
- Fix encrypted bridge connections incorrectly connecting when `bridge_cafile`
|
||||
is empty or invalid. Closes #2130.
|
||||
- Fix `tls_version` behaviour not matching documentation. It was setting the
|
||||
exact TLS version to use, not the minimium TLS version to use. Closes #2110.
|
||||
- Fix messages to `$` prefixed topics being rejected. Closes #2111.
|
||||
- Fix QoS 0 messages not being delivered when max_queued_bytes was configured.
|
||||
Closes #2123.
|
||||
- Fix bridge increasing backoff calculation.
|
||||
- Improve handling of invalid combinations of listener address and bind
|
||||
interface configurations. Closes #2081.
|
||||
- Fix `max_keepalive` option not applying to clients connecting with keepalive
|
||||
set to 0. Closes #2117.
|
||||
|
||||
Client library:
|
||||
- Fix encrypted connections incorrectly connecting when the CA file passed to
|
||||
`mosquitto_tls_set()` is empty or invalid. Closes #2130.
|
||||
- Fix connections retrying very rapidly in some situations.
|
||||
|
||||
Build:
|
||||
- Fix cmake epoll detection.
|
||||
|
||||
|
||||
2.0.8 - 2021-02-25
|
||||
@@ -1783,6 +1840,8 @@ Client library:
|
||||
- Add support for MQTT v3.1.1.
|
||||
- Don't quit mosquitto_loop_forever() if broker not available on first
|
||||
connect. Closes bug #453293, but requires more work.
|
||||
- Don't reset queued messages state on CONNACK. Fixes bug with duplicate
|
||||
messages on connection.
|
||||
|
||||
|
||||
1.3.5 - 20141008
|
||||
|
||||
+5
-18
@@ -1,18 +1,16 @@
|
||||
Mosquitto for Windows
|
||||
=====================
|
||||
|
||||
Mosquitto for Windows comes in 32-bit and 64-bit flavours.
|
||||
|
||||
In both cases, the dependencies are not provided in this installer and must be
|
||||
installed separately in the case that they are not already available.
|
||||
|
||||
Mosquitto for Windows comes in 64-bit and 32-bit flavours. All dependencies are
|
||||
provided in the installer.
|
||||
|
||||
Capabilities
|
||||
------------
|
||||
|
||||
Some versions of Windows have limitations on the number of concurrent
|
||||
connections, set at approximately 2048 connections depending on the version of
|
||||
Windows you are using.
|
||||
connections. In modern versions of Windows, e.g. Windows 10 or Windows Server
|
||||
2019, this is approximately 8192 connections. In earlier versions of Windows,
|
||||
this limit is 2048 connections.
|
||||
|
||||
|
||||
Websockets
|
||||
@@ -23,7 +21,6 @@ through a statically compiled version of libwebsockets and is being distributed
|
||||
under the Static Linking Exception (Section 2) of the License. As a result, the
|
||||
content is not subject to the LGPL 2.1.
|
||||
|
||||
Please note that on Windows, libwebsockets limits connections to a maximum of 64 clients.
|
||||
|
||||
Library Thread Support
|
||||
----------------------
|
||||
@@ -35,16 +32,6 @@ A better solution that the old pthreads-win32 is being looked into, so support
|
||||
will return in the future. If you need thread support, the code still supports
|
||||
it just fine. Support has been dropped to simplify installation.
|
||||
|
||||
Dependencies
|
||||
------------
|
||||
|
||||
* OpenSSL
|
||||
Link: http://slproweb.com/products/Win32OpenSSL.html
|
||||
Install "Win32 OpenSSL 1.1.0* Light" or "Win64 OpenSSL 1.1.0* Light"
|
||||
Required DLLs: libssl-1_1.dll, libcrypto-1_1.dll or libssl-1_1-x64.dll, libcrypto-1_1-x64.dll
|
||||
|
||||
Please ensure that the required DLLs are on the system path, or are in the same directory as
|
||||
the mosquitto executable - usually C:\Program Files (x86)\mosquitto or C:\Program Files\mosquitto.
|
||||
|
||||
Windows Service
|
||||
---------------
|
||||
|
||||
@@ -27,6 +27,7 @@ Contributors:
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "db_dump.h"
|
||||
#include <mosquitto_broker_internal.h>
|
||||
#include <memory_mosq.h>
|
||||
#include <persist.h>
|
||||
|
||||
@@ -19,6 +19,7 @@ Contributors:
|
||||
#include <inttypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "db_dump.h"
|
||||
#include <mosquitto_broker_internal.h>
|
||||
#include <memory_mosq.h>
|
||||
#include <mqtt_protocol.h>
|
||||
@@ -142,7 +143,7 @@ static void print__properties(mosquitto_property *properties)
|
||||
}
|
||||
|
||||
|
||||
void print__client(struct P_client *chunk, int length)
|
||||
void print__client(struct P_client *chunk, uint32_t length)
|
||||
{
|
||||
printf("DB_CHUNK_CLIENT:\n");
|
||||
printf("\tLength: %d\n", length);
|
||||
@@ -159,7 +160,7 @@ void print__client(struct P_client *chunk, int length)
|
||||
}
|
||||
|
||||
|
||||
void print__client_msg(struct P_client_msg *chunk, int length)
|
||||
void print__client_msg(struct P_client_msg *chunk, uint32_t length)
|
||||
{
|
||||
printf("DB_CHUNK_CLIENT_MSG:\n");
|
||||
printf("\tLength: %d\n", length);
|
||||
@@ -175,8 +176,10 @@ void print__client_msg(struct P_client_msg *chunk, int length)
|
||||
}
|
||||
|
||||
|
||||
void print__msg_store(struct P_msg_store *chunk, int length)
|
||||
void print__msg_store(struct P_msg_store *chunk, uint32_t length)
|
||||
{
|
||||
uint8_t *payload;
|
||||
|
||||
printf("DB_CHUNK_MSG_STORE:\n");
|
||||
printf("\tLength: %d\n", length);
|
||||
printf("\tStore ID: %" PRIu64 "\n", chunk->F.store_id);
|
||||
@@ -190,8 +193,6 @@ void print__msg_store(struct P_msg_store *chunk, int length)
|
||||
printf("\tPayload Length: %d\n", chunk->F.payloadlen);
|
||||
printf("\tExpiry Time: %" PRIu64 "\n", chunk->F.expiry_time);
|
||||
|
||||
uint8_t *payload;
|
||||
|
||||
payload = chunk->payload;
|
||||
if(chunk->F.payloadlen < 256){
|
||||
/* Print payloads with UTF-8 data below an arbitrary limit of 256 bytes */
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "misc_mosq.h"
|
||||
#include "mosquitto_broker_internal.h"
|
||||
#include "mosquitto_internal.h"
|
||||
#include "util_mosq.h"
|
||||
|
||||
#ifndef UNUSED
|
||||
# define UNUSED(A) (void)(A)
|
||||
#endif
|
||||
|
||||
struct mosquitto *context__init(mosq_sock_t sock)
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@ LIBMOSQ:=../../lib/libmosquitto.a
|
||||
endif
|
||||
endif
|
||||
|
||||
LOCAL_CPPFLAGS:=-I../mosquitto_passwd
|
||||
LOCAL_CPPFLAGS:=-I../mosquitto_passwd -DWITH_CJSON
|
||||
|
||||
OBJS= mosquitto_ctrl.o \
|
||||
client.o \
|
||||
|
||||
@@ -79,6 +79,8 @@ void dynsec__print_usage(void)
|
||||
printf("acltype: publishClientSend|publishClientReceive\n");
|
||||
printf(" |subscribeLiteral|subscribePattern\n");
|
||||
printf(" |unsubscribeLiteral|unsubscribePattern\n");
|
||||
printf("\nFor more information see:\n");
|
||||
printf(" https://mosquitto.org/documentation/dynamic-security/\n\n");
|
||||
}
|
||||
|
||||
cJSON *cJSON_AddIntToObject(cJSON * const object, const char * const name, int number)
|
||||
@@ -689,7 +691,7 @@ static cJSON *init_create(const char *username, const char *password, const char
|
||||
}
|
||||
|
||||
/* mosquitto_ctrl dynsec init <filename> <admin-user> <admin-password> [role-name] */
|
||||
int dynsec_init(int argc, char *argv[])
|
||||
static int dynsec_init(int argc, char *argv[])
|
||||
{
|
||||
char *filename;
|
||||
char *admin_user;
|
||||
|
||||
@@ -28,7 +28,7 @@ Contributors:
|
||||
#include "mosquitto.h"
|
||||
#include "mosquitto_ctrl.h"
|
||||
|
||||
void print_version(void)
|
||||
static void print_version(void)
|
||||
{
|
||||
int major, minor, revision;
|
||||
|
||||
@@ -36,14 +36,15 @@ void print_version(void)
|
||||
printf("mosquitto_ctrl version %s running on libmosquitto %d.%d.%d.\n", VERSION, major, minor, revision);
|
||||
}
|
||||
|
||||
void print_usage(void)
|
||||
static void print_usage(void)
|
||||
{
|
||||
printf("mosquitto_ctrl is a tool for administering certain Mosquitto features.\n");
|
||||
print_version();
|
||||
printf("\nGeneral usage: mosquitto_ctrl <module> <module-command> <command-options>\n");
|
||||
printf("For module specific help use: mosquitto_ctrl <module> help\n");
|
||||
printf("\nModules available: dynsec\n");
|
||||
printf("\nSee https://mosquitto.org/man/mosquitto_ctrl-1.html for more information.\n\n");
|
||||
printf("\nFor more information see:\n");
|
||||
printf(" https://mosquitto.org/man/mosquitto_ctrl-1.html\n\n");
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +52,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
struct mosq_ctrl ctrl;
|
||||
int rc = MOSQ_ERR_SUCCESS;
|
||||
FUNC_ctrl_main ctrl_main = NULL;
|
||||
FUNC_ctrl_main l_ctrl_main = NULL;
|
||||
void *lib = NULL;
|
||||
char lib_name[200];
|
||||
|
||||
@@ -76,22 +77,22 @@ int main(int argc, char *argv[])
|
||||
|
||||
/* In built modules */
|
||||
if(!strcasecmp(argv[0], "dynsec")){
|
||||
ctrl_main = dynsec__main;
|
||||
l_ctrl_main = dynsec__main;
|
||||
}else{
|
||||
/* Attempt external module */
|
||||
snprintf(lib_name, sizeof(lib_name), "mosquitto_ctrl_%s.so", argv[0]);
|
||||
lib = LIB_LOAD(lib_name);
|
||||
if(lib){
|
||||
ctrl_main = (FUNC_ctrl_main)LIB_SYM(lib, "ctrl_main");
|
||||
l_ctrl_main = (FUNC_ctrl_main)LIB_SYM(lib, "ctrl_main");
|
||||
}
|
||||
}
|
||||
if(ctrl_main == NULL){
|
||||
if(l_ctrl_main == NULL){
|
||||
fprintf(stderr, "Error: Module '%s' not supported.\n", argv[0]);
|
||||
rc = MOSQ_ERR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
if(ctrl_main){
|
||||
rc = ctrl_main(argc-1, &argv[1], &ctrl);
|
||||
if(l_ctrl_main){
|
||||
rc = l_ctrl_main(argc-1, &argv[1], &ctrl);
|
||||
if(rc < 0){
|
||||
/* Usage print */
|
||||
rc = 0;
|
||||
|
||||
@@ -35,7 +35,9 @@ Contributors:
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#define MAX_BUFFER_LEN 65536
|
||||
#include "get_password.h"
|
||||
|
||||
#define MAX_BUFFER_LEN 65500
|
||||
#define SALT_LEN 12
|
||||
|
||||
void get_password__reset_term(void)
|
||||
|
||||
@@ -52,7 +52,7 @@ Contributors:
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#define MAX_BUFFER_LEN 65536
|
||||
#define MAX_BUFFER_LEN 65500
|
||||
#define SALT_LEN 12
|
||||
|
||||
#include "misc_mosq.h"
|
||||
@@ -107,7 +107,7 @@ static FILE *mpw_tmpfile(void)
|
||||
#endif
|
||||
|
||||
|
||||
void print_usage(void)
|
||||
static void print_usage(void)
|
||||
{
|
||||
printf("mosquitto_passwd is a tool for managing password files for mosquitto.\n\n");
|
||||
printf("Usage: mosquitto_passwd [-H sha512 | -H sha512-pbkdf2] [-c | -D] passwordfile username\n");
|
||||
@@ -122,7 +122,7 @@ void print_usage(void)
|
||||
printf("\nSee https://mosquitto.org/ for more information.\n\n");
|
||||
}
|
||||
|
||||
int output_new_password(FILE *fptr, const char *username, const char *password, int iterations)
|
||||
static int output_new_password(FILE *fptr, const char *username, const char *password, int iterations)
|
||||
{
|
||||
int rc;
|
||||
char *salt64 = NULL, *hash64 = NULL;
|
||||
@@ -255,7 +255,7 @@ static int delete_pwuser_cb(FILE *fptr, FILE *ftmp, const char *username, const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int delete_pwuser(FILE *fptr, FILE *ftmp, const char *username)
|
||||
static int delete_pwuser(FILE *fptr, FILE *ftmp, const char *username)
|
||||
{
|
||||
struct cb_helper helper;
|
||||
int rc;
|
||||
@@ -288,7 +288,7 @@ static int update_file_cb(FILE *fptr, FILE *ftmp, const char *username, const ch
|
||||
}
|
||||
}
|
||||
|
||||
int update_file(FILE *fptr, FILE *ftmp)
|
||||
static int update_file(FILE *fptr, FILE *ftmp)
|
||||
{
|
||||
return pwfile_iterate(fptr, ftmp, update_file_cb, NULL);
|
||||
}
|
||||
@@ -315,7 +315,7 @@ static int update_pwuser_cb(FILE *fptr, FILE *ftmp, const char *username, const
|
||||
return rc;
|
||||
}
|
||||
|
||||
int update_pwuser(FILE *fptr, FILE *ftmp, const char *username, const char *password, int iterations)
|
||||
static int update_pwuser(FILE *fptr, FILE *ftmp, const char *username, const char *password, int iterations)
|
||||
{
|
||||
struct cb_helper helper;
|
||||
int rc;
|
||||
@@ -334,7 +334,7 @@ int update_pwuser(FILE *fptr, FILE *ftmp, const char *username, const char *pass
|
||||
}
|
||||
|
||||
|
||||
int copy_contents(FILE *src, FILE *dest)
|
||||
static int copy_contents(FILE *src, FILE *dest)
|
||||
{
|
||||
char buf[MAX_BUFFER_LEN];
|
||||
size_t len;
|
||||
@@ -361,7 +361,7 @@ int copy_contents(FILE *src, FILE *dest)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int create_backup(const char *backup_file, FILE *fptr)
|
||||
static int create_backup(const char *backup_file, FILE *fptr)
|
||||
{
|
||||
FILE *fbackup;
|
||||
|
||||
@@ -380,7 +380,7 @@ int create_backup(const char *backup_file, FILE *fptr)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void handle_sigint(int signal)
|
||||
static void handle_sigint(int signal)
|
||||
{
|
||||
get_password__reset_term();
|
||||
|
||||
|
||||
+17
-8
@@ -183,7 +183,7 @@ static int check_format(const char *str)
|
||||
}
|
||||
|
||||
|
||||
void init_config(struct mosq_config *cfg, int pub_or_sub)
|
||||
static void init_config(struct mosq_config *cfg, int pub_or_sub)
|
||||
{
|
||||
memset(cfg, 0, sizeof(*cfg));
|
||||
cfg->port = PORT_UNDEFINED;
|
||||
@@ -519,7 +519,7 @@ int client_config_load(struct mosq_config *cfg, int pub_or_sub, int argc, char *
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
int cfg_add_topic(struct mosq_config *cfg, int type, char *topic, const char *arg)
|
||||
static int cfg_add_topic(struct mosq_config *cfg, int type, char *topic, const char *arg)
|
||||
{
|
||||
if(mosquitto_validate_utf8(topic, (int )strlen(topic))){
|
||||
fprintf(stderr, "Error: Malformed UTF-8 in %s argument.\n\n", arg);
|
||||
@@ -1293,6 +1293,14 @@ static int client_tls_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
# ifdef FINAL_WITH_TLS_PSK
|
||||
}else if(cfg->psk){
|
||||
if(mosquitto_tls_psk_set(mosq, cfg->psk, cfg->psk_identity, NULL)){
|
||||
err_printf(cfg, "Error: Problem setting TLS-PSK options.\n");
|
||||
mosquitto_lib_cleanup();
|
||||
return 1;
|
||||
}
|
||||
# endif
|
||||
}else if(cfg->port == 8883){
|
||||
mosquitto_int_option(mosq, MOSQ_OPT_TLS_USE_OS_CERTS, 1);
|
||||
}
|
||||
@@ -1320,12 +1328,6 @@ static int client_tls_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
|
||||
err_printf(cfg, "Error: Problem setting TLS ALPN protocol.\n");
|
||||
return 1;
|
||||
}
|
||||
# ifdef FINAL_WITH_TLS_PSK
|
||||
if(cfg->psk && mosquitto_tls_psk_set(mosq, cfg->psk, cfg->psk_identity, NULL)){
|
||||
err_printf(cfg, "Error: Problem setting TLS-PSK options.\n");
|
||||
return 1;
|
||||
}
|
||||
# endif
|
||||
if((cfg->tls_version || cfg->ciphers) && mosquitto_tls_opts_set(mosq, 1, cfg->tls_version, cfg->ciphers)){
|
||||
err_printf(cfg, "Error: Problem setting TLS options, check the options are valid.\n");
|
||||
return 1;
|
||||
@@ -1377,6 +1379,13 @@ int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
|
||||
if(cfg->tcp_nodelay){
|
||||
mosquitto_int_option(mosq, MOSQ_OPT_TCP_NODELAY, 1);
|
||||
}
|
||||
|
||||
if(cfg->msg_count > 0 && cfg->msg_count < 20){
|
||||
/* 20 is the default "receive maximum"
|
||||
* If we don't set this, then we can receive > msg_count messages
|
||||
* before we quit.*/
|
||||
mosquitto_int_option(mosq, MOSQ_OPT_RECEIVE_MAXIMUM, cfg->msg_count);
|
||||
}
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,10 @@ Contributors:
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(attrib)
|
||||
#endif
|
||||
|
||||
/* pub_client.c modes */
|
||||
#define MSGMODE_NONE 0
|
||||
#define MSGMODE_CMD 1
|
||||
@@ -138,6 +142,5 @@ int client_connect(struct mosquitto *mosq, struct mosq_config *cfg);
|
||||
|
||||
int cfg_parse_property(struct mosq_config *cfg, int argc, char *argv[], int *idx);
|
||||
|
||||
void err_printf(const struct mosq_config *cfg, const char *fmt, ...);
|
||||
|
||||
void err_printf(const struct mosq_config *cfg, const char *fmt, ...) __attribute__((format(printf, 2, 3)));
|
||||
#endif
|
||||
|
||||
+4
-4
@@ -232,7 +232,7 @@ int pub_shared_init(void)
|
||||
}
|
||||
|
||||
|
||||
int pub_stdin_line_loop(struct mosquitto *mosq)
|
||||
static int pub_stdin_line_loop(struct mosquitto *mosq)
|
||||
{
|
||||
char *buf2;
|
||||
int buf_len_actual = 0;
|
||||
@@ -334,7 +334,7 @@ int pub_stdin_line_loop(struct mosquitto *mosq)
|
||||
}
|
||||
|
||||
|
||||
int pub_other_loop(struct mosquitto *mosq)
|
||||
static int pub_other_loop(struct mosquitto *mosq)
|
||||
{
|
||||
int rc;
|
||||
int loop_delay = 1000;
|
||||
@@ -387,7 +387,7 @@ void pub_shared_cleanup(void)
|
||||
}
|
||||
|
||||
|
||||
void print_version(void)
|
||||
static void print_version(void)
|
||||
{
|
||||
int major, minor, revision;
|
||||
|
||||
@@ -395,7 +395,7 @@ void print_version(void)
|
||||
printf("mosquitto_pub version %s running on libmosquitto %d.%d.%d.\n", VERSION, major, minor, revision);
|
||||
}
|
||||
|
||||
void print_usage(void)
|
||||
static void print_usage(void)
|
||||
{
|
||||
int major, minor, revision;
|
||||
|
||||
|
||||
+5
-7
@@ -50,8 +50,6 @@ enum rr__state {
|
||||
|
||||
static enum rr__state client_state = rr_s_new;
|
||||
|
||||
extern struct mosq_config cfg;
|
||||
|
||||
bool process_messages = true;
|
||||
int msg_count = 0;
|
||||
struct mosquitto *g_mosq = NULL;
|
||||
@@ -59,7 +57,7 @@ static bool timed_out = false;
|
||||
static int connack_result = 0;
|
||||
|
||||
#ifndef WIN32
|
||||
void my_signal_handler(int signum)
|
||||
static void my_signal_handler(int signum)
|
||||
{
|
||||
if(signum == SIGALRM){
|
||||
process_messages = false;
|
||||
@@ -80,7 +78,7 @@ int my_publish(struct mosquitto *mosq, int *mid, const char *topic, int payloadl
|
||||
}
|
||||
|
||||
|
||||
void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message, const mosquitto_property *properties)
|
||||
static void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message, const mosquitto_property *properties)
|
||||
{
|
||||
UNUSED(mosq);
|
||||
UNUSED(obj);
|
||||
@@ -151,7 +149,7 @@ void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flag
|
||||
}
|
||||
|
||||
|
||||
void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos)
|
||||
static void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos)
|
||||
{
|
||||
UNUSED(obj);
|
||||
UNUSED(mid);
|
||||
@@ -179,7 +177,7 @@ void my_publish_callback(struct mosquitto *mosq, void *obj, int mid, int reason_
|
||||
}
|
||||
|
||||
|
||||
void print_version(void)
|
||||
static void print_version(void)
|
||||
{
|
||||
int major, minor, revision;
|
||||
|
||||
@@ -187,7 +185,7 @@ void print_version(void)
|
||||
printf("mosquitto_rr version %s running on libmosquitto %d.%d.%d.\n", VERSION, major, minor, revision);
|
||||
}
|
||||
|
||||
void print_usage(void)
|
||||
static void print_usage(void)
|
||||
{
|
||||
int major, minor, revision;
|
||||
|
||||
|
||||
+7
-19
@@ -48,7 +48,7 @@ static int connack_result = 0;
|
||||
bool connack_received = false;
|
||||
|
||||
#ifndef WIN32
|
||||
void my_signal_handler(int signum)
|
||||
static void my_signal_handler(int signum)
|
||||
{
|
||||
if(signum == SIGALRM || signum == SIGTERM || signum == SIGINT){
|
||||
if(connack_received){
|
||||
@@ -65,19 +65,7 @@ void my_signal_handler(int signum)
|
||||
#endif
|
||||
|
||||
|
||||
void my_publish_callback(struct mosquitto *mosq, void *obj, int mid, int reason_code, const mosquitto_property *properties)
|
||||
{
|
||||
UNUSED(obj);
|
||||
UNUSED(reason_code);
|
||||
UNUSED(properties);
|
||||
|
||||
if(process_messages == false && (mid == last_mid || last_mid == 0)){
|
||||
mosquitto_disconnect_v5(mosq, 0, cfg.disconnect_props);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message, const mosquitto_property *properties)
|
||||
static void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquitto_message *message, const mosquitto_property *properties)
|
||||
{
|
||||
int i;
|
||||
bool res;
|
||||
@@ -120,7 +108,7 @@ void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquit
|
||||
}
|
||||
}
|
||||
|
||||
void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flags, const mosquitto_property *properties)
|
||||
static void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flags, const mosquitto_property *properties)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -153,7 +141,7 @@ void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flag
|
||||
}
|
||||
}
|
||||
|
||||
void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos)
|
||||
static void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_count, const int *granted_qos)
|
||||
{
|
||||
int i;
|
||||
bool some_sub_allowed = (granted_qos[0] < 128);
|
||||
@@ -177,7 +165,7 @@ void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_c
|
||||
}
|
||||
}
|
||||
|
||||
void my_log_callback(struct mosquitto *mosq, void *obj, int level, const char *str)
|
||||
static void my_log_callback(struct mosquitto *mosq, void *obj, int level, const char *str)
|
||||
{
|
||||
UNUSED(mosq);
|
||||
UNUSED(obj);
|
||||
@@ -186,7 +174,7 @@ void my_log_callback(struct mosquitto *mosq, void *obj, int level, const char *s
|
||||
printf("%s\n", str);
|
||||
}
|
||||
|
||||
void print_version(void)
|
||||
static void print_version(void)
|
||||
{
|
||||
int major, minor, revision;
|
||||
|
||||
@@ -194,7 +182,7 @@ void print_version(void)
|
||||
printf("mosquitto_sub version %s running on libmosquitto %d.%d.%d.\n", VERSION, major, minor, revision);
|
||||
}
|
||||
|
||||
void print_usage(void)
|
||||
static void print_usage(void)
|
||||
{
|
||||
int major, minor, revision;
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ WITH_XTREPORT=no
|
||||
|
||||
# Also bump lib/mosquitto.h, CMakeLists.txt,
|
||||
# installer/mosquitto.nsi, installer/mosquitto64.nsi
|
||||
VERSION=2.0.8
|
||||
VERSION=2.0.10
|
||||
|
||||
# Client library SO version. Bump if incompatible API/ABI changes are made.
|
||||
SOVERSION=1
|
||||
@@ -140,6 +140,7 @@ DB_HTML_XSL=man/html.xsl
|
||||
#MANCOUNTRIES=en_GB
|
||||
|
||||
UNAME:=$(shell uname -s)
|
||||
ARCH:=$(shell uname -p)
|
||||
|
||||
ifeq ($(UNAME),SunOS)
|
||||
ifeq ($(CC),cc)
|
||||
@@ -148,7 +149,7 @@ ifeq ($(UNAME),SunOS)
|
||||
CFLAGS?=-Wall -ggdb -O2
|
||||
endif
|
||||
else
|
||||
CFLAGS?=-Wall -ggdb -O2 -Wconversion
|
||||
CFLAGS?=-Wall -ggdb -O2 -Wconversion -Wextra
|
||||
endif
|
||||
|
||||
STATIC_LIB_DEPS:=
|
||||
@@ -199,9 +200,15 @@ ifeq ($(WITH_SHARED_LIBRARIES),yes)
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME),SunOS)
|
||||
ifeq ($(CC),cc)
|
||||
LIB_CFLAGS:=$(LIB_CFLAGS) -xc99 -KPIC
|
||||
else
|
||||
SEDINPLACE:=
|
||||
ifeq ($(ARCH),sparc)
|
||||
ifeq ($(CC),cc)
|
||||
LIB_CFLAGS:=$(LIB_CFLAGS) -xc99 -KPIC
|
||||
else
|
||||
LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC
|
||||
endif
|
||||
endif
|
||||
ifeq ($(ARCH),i386)
|
||||
LIB_CFLAGS:=$(LIB_CFLAGS) -fPIC
|
||||
endif
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ FROM alpine:3.12
|
||||
LABEL maintainer="Roger Light <roger@atchoo.org>" \
|
||||
description="Eclipse Mosquitto MQTT Broker"
|
||||
|
||||
ENV VERSION=1.5.10 \
|
||||
DOWNLOAD_SHA256=00d9688dffef0e2c26f3fb1486931ed5d89042d81f6d4c1dd455d63080149c20 \
|
||||
ENV VERSION=1.5.11 \
|
||||
DOWNLOAD_SHA256=4a3b8a8f5505d27a7a966dd68bfd76f1e69feb51796d1b46b7271d1bb5a1a299 \
|
||||
GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \
|
||||
LWS_VERSION=2.4.2
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ FROM alpine:3.12
|
||||
LABEL maintainer="Roger Light <roger@atchoo.org>" \
|
||||
description="Eclipse Mosquitto MQTT Broker"
|
||||
|
||||
ENV VERSION=1.5.10 \
|
||||
DOWNLOAD_SHA256=00d9688dffef0e2c26f3fb1486931ed5d89042d81f6d4c1dd455d63080149c20 \
|
||||
ENV VERSION=1.5.11 \
|
||||
DOWNLOAD_SHA256=4a3b8a8f5505d27a7a966dd68bfd76f1e69feb51796d1b46b7271d1bb5a1a299 \
|
||||
GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \
|
||||
LWS_VERSION=2.4.2 \
|
||||
LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6
|
||||
|
||||
@@ -3,8 +3,8 @@ FROM alpine:3.12
|
||||
LABEL maintainer="Roger Light <roger@atchoo.org>" \
|
||||
description="Eclipse Mosquitto MQTT Broker"
|
||||
|
||||
ENV VERSION=1.6.13 \
|
||||
DOWNLOAD_SHA256=ce205248dd323e4e562ff83e9e84d0f9a16f4bda87183c367c66a7163c0fc287 \
|
||||
ENV VERSION=1.6.14 \
|
||||
DOWNLOAD_SHA256=5ea7e342bfbd212a0addb915036be168040dea945e5de5fe739c43c5ff3823e4 \
|
||||
GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \
|
||||
LWS_VERSION=2.4.2 \
|
||||
LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6
|
||||
|
||||
@@ -3,8 +3,8 @@ FROM alpine:3.12
|
||||
LABEL maintainer="Roger Light <roger@atchoo.org>" \
|
||||
description="Eclipse Mosquitto MQTT Broker"
|
||||
|
||||
ENV VERSION=1.6.13 \
|
||||
DOWNLOAD_SHA256=ce205248dd323e4e562ff83e9e84d0f9a16f4bda87183c367c66a7163c0fc287 \
|
||||
ENV VERSION=1.6.14 \
|
||||
DOWNLOAD_SHA256=5ea7e342bfbd212a0addb915036be168040dea945e5de5fe739c43c5ff3823e4 \
|
||||
GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \
|
||||
LWS_VERSION=2.4.2 \
|
||||
LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6
|
||||
|
||||
@@ -3,8 +3,8 @@ FROM alpine:3.12
|
||||
LABEL maintainer="Roger Light <roger@atchoo.org>" \
|
||||
description="Eclipse Mosquitto MQTT Broker"
|
||||
|
||||
ENV VERSION=2.0.8 \
|
||||
DOWNLOAD_SHA256=b15da8fc4edcb91d554e1259e220ea0173ef639ceaa4b465e06feb7e125b84bf \
|
||||
ENV VERSION=2.0.10 \
|
||||
DOWNLOAD_SHA256=0188f7b21b91d6d80e992b8d6116ba851468b3bd154030e8a003ed28fb6f4a44 \
|
||||
GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \
|
||||
LWS_VERSION=2.4.2 \
|
||||
LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 \
|
||||
|
||||
@@ -3,8 +3,8 @@ FROM alpine:3.12
|
||||
LABEL maintainer="Roger Light <roger@atchoo.org>" \
|
||||
description="Eclipse Mosquitto MQTT Broker"
|
||||
|
||||
ENV VERSION=2.0.8 \
|
||||
DOWNLOAD_SHA256=b15da8fc4edcb91d554e1259e220ea0173ef639ceaa4b465e06feb7e125b84bf \
|
||||
ENV VERSION=2.0.10 \
|
||||
DOWNLOAD_SHA256=0188f7b21b91d6d80e992b8d6116ba851468b3bd154030e8a003ed28fb6f4a44 \
|
||||
GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \
|
||||
LWS_VERSION=2.4.2 \
|
||||
LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 \
|
||||
|
||||
+102
-62
@@ -1,74 +1,114 @@
|
||||
FROM alpine:edge AS build
|
||||
FROM alpine:3.12
|
||||
|
||||
LABEL maintainer="Roger Light <roger@atchoo.org>" \
|
||||
description="Eclipse Mosquitto MQTT Broker"
|
||||
|
||||
# A released dist version, like "1.2.3"
|
||||
ARG VERSION
|
||||
RUN test -n "${VERSION}"
|
||||
|
||||
RUN apk --no-cache add \
|
||||
build-base \
|
||||
c-ares-dev \
|
||||
ca-certificates \
|
||||
cjson-dev \
|
||||
curl \
|
||||
libwebsockets-dev \
|
||||
libxslt \
|
||||
openssl-dev \
|
||||
python2 \
|
||||
util-linux-dev
|
||||
ENV \
|
||||
GPG_KEYS=A0D6EEA1DCAE49A635A3B2F0779B22DFB3E717B7 \
|
||||
LWS_VERSION=2.4.2 \
|
||||
LWS_SHA256=73012d7fcf428dedccc816e83a63a01462e27819d5537b8e0d0c7264bfacfad6 \
|
||||
CJSON_VERSION=1.7.14 \
|
||||
CJSON_SHA256=fb50a663eefdc76bafa80c82bc045af13b1363e8f45cec8b442007aef6a41343
|
||||
|
||||
# This build procedure is based on:
|
||||
# https://github.com/alpinelinux/aports/blob/master/main/mosquitto/APKBUILD
|
||||
#
|
||||
# If this step fails, double check the version build-arg and make sure its
|
||||
# a valid published tarball at https://mosquitto.org/files/source/
|
||||
RUN mkdir -p /build /install && \
|
||||
curl -SL https://mosquitto.org/files/source/mosquitto-${VERSION}.tar.gz \
|
||||
| tar --strip=1 -xzC /build && \
|
||||
make -C /build \
|
||||
WITH_MEMORY_TRACKING=no \
|
||||
WITH_WEBSOCKETS=yes \
|
||||
WITH_SRV=yes \
|
||||
WITH_TLS_PSK=no \
|
||||
WITH_ADNS=no \
|
||||
prefix=/usr \
|
||||
binary && \
|
||||
make -C /build \
|
||||
prefix=/usr \
|
||||
DESTDIR="/install" \
|
||||
install && \
|
||||
mv /install/etc/mosquitto/mosquitto.conf.example /install/etc/mosquitto/mosquitto.conf && \
|
||||
sed -i -e 's/#log_dest stderr/log_dest syslog/' /install/etc/mosquitto/mosquitto.conf
|
||||
|
||||
|
||||
# Single-layer image for the mosquitto distribution
|
||||
FROM alpine:latest
|
||||
LABEL maintainer="Jonathan Hanson <jonathan@jonathan-hanson.org>" \
|
||||
description="Eclipse Mosquitto MQTT Broker"
|
||||
|
||||
# Install the run-time dependencies
|
||||
RUN apk --no-cache add \
|
||||
busybox \
|
||||
ca-certificates \
|
||||
cjson \
|
||||
openssl \
|
||||
libuuid \
|
||||
libwebsockets \
|
||||
musl
|
||||
|
||||
# Copy over the built install from the earlier image layer
|
||||
COPY --from=build /install /
|
||||
|
||||
# Set up the mosquitto directories and the mosquitto user
|
||||
RUN addgroup -S mosquitto 2>/dev/null && \
|
||||
adduser -S -D -H -h /var/empty -s /sbin/nologin -G mosquitto -g mosquitto mosquitto 2>/dev/null && \
|
||||
RUN set -x && \
|
||||
apk --no-cache add --virtual build-deps \
|
||||
build-base \
|
||||
cmake \
|
||||
gnupg \
|
||||
openssl-dev \
|
||||
util-linux-dev && \
|
||||
wget https://github.com/warmcat/libwebsockets/archive/v${LWS_VERSION}.tar.gz -O /tmp/lws.tar.gz && \
|
||||
echo "$LWS_SHA256 /tmp/lws.tar.gz" | sha256sum -c - && \
|
||||
mkdir -p /build/lws && \
|
||||
tar --strip=1 -xf /tmp/lws.tar.gz -C /build/lws && \
|
||||
rm /tmp/lws.tar.gz && \
|
||||
cd /build/lws && \
|
||||
cmake . \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DLWS_IPV6=ON \
|
||||
-DLWS_WITHOUT_BUILTIN_GETIFADDRS=ON \
|
||||
-DLWS_WITHOUT_CLIENT=ON \
|
||||
-DLWS_WITHOUT_EXTENSIONS=ON \
|
||||
-DLWS_WITHOUT_TESTAPPS=ON \
|
||||
-DLWS_WITH_SHARED=OFF \
|
||||
-DLWS_WITH_ZIP_FOPS=OFF \
|
||||
-DLWS_WITH_ZLIB=OFF && \
|
||||
make -j "$(nproc)" && \
|
||||
rm -rf /root/.cmake && \
|
||||
wget https://github.com/DaveGamble/cJSON/archive/v${CJSON_VERSION}.tar.gz -O /tmp/cjson.tar.gz && \
|
||||
echo "$CJSON_SHA256 /tmp/cjson.tar.gz" | sha256sum -c - && \
|
||||
mkdir -p /build/cjson && \
|
||||
tar --strip=1 -xf /tmp/cjson.tar.gz -C /build/cjson && \
|
||||
rm /tmp/cjson.tar.gz && \
|
||||
cd /build/cjson && \
|
||||
cmake . \
|
||||
-DCMAKE_BUILD_TYPE=MinSizeRel \
|
||||
-DBUILD_SHARED_AND_STATIC_LIBS=OFF \
|
||||
-DBUILD_SHARED_LIBS=OFF \
|
||||
-DCJSON_BUILD_SHARED_LIBS=OFF \
|
||||
-DCJSON_OVERRIDE_BUILD_SHARED_LIBS=OFF \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr && \
|
||||
make -j "$(nproc)" && \
|
||||
rm -rf /root/.cmake && \
|
||||
wget https://mosquitto.org/files/source/mosquitto-${VERSION}.tar.gz -O /tmp/mosq.tar.gz && \
|
||||
wget https://mosquitto.org/files/source/mosquitto-${VERSION}.tar.gz.asc -O /tmp/mosq.tar.gz.asc && \
|
||||
export GNUPGHOME="$(mktemp -d)" && \
|
||||
found=''; \
|
||||
for server in \
|
||||
ha.pool.sks-keyservers.net \
|
||||
hkp://keyserver.ubuntu.com:80 \
|
||||
hkp://p80.pool.sks-keyservers.net:80 \
|
||||
pgp.mit.edu \
|
||||
; do \
|
||||
echo "Fetching GPG key $GPG_KEYS from $server"; \
|
||||
gpg --keyserver "$server" --keyserver-options timeout=10 --recv-keys "$GPG_KEYS" && found=yes && break; \
|
||||
done; \
|
||||
test -z "$found" && echo >&2 "error: failed to fetch GPG key $GPG_KEYS" && exit 1; \
|
||||
gpg --batch --verify /tmp/mosq.tar.gz.asc /tmp/mosq.tar.gz && \
|
||||
gpgconf --kill all && \
|
||||
rm -rf "$GNUPGHOME" /tmp/mosq.tar.gz.asc && \
|
||||
mkdir -p /build/mosq && \
|
||||
tar --strip=1 -xf /tmp/mosq.tar.gz -C /build/mosq && \
|
||||
rm /tmp/mosq.tar.gz && \
|
||||
make -C /build/mosq -j "$(nproc)" \
|
||||
CFLAGS="-Wall -O2 -I/build/lws/include -I/build" \
|
||||
LDFLAGS="-L/build/lws/lib -L/build/cjson" \
|
||||
WITH_ADNS=no \
|
||||
WITH_DOCS=no \
|
||||
WITH_SHARED_LIBRARIES=yes \
|
||||
WITH_SRV=no \
|
||||
WITH_STRIP=yes \
|
||||
WITH_TLS_PSK=no \
|
||||
WITH_WEBSOCKETS=yes \
|
||||
prefix=/usr \
|
||||
binary && \
|
||||
addgroup -S -g 1883 mosquitto 2>/dev/null && \
|
||||
adduser -S -u 1883 -D -H -h /var/empty -s /sbin/nologin -G mosquitto -g mosquitto mosquitto 2>/dev/null && \
|
||||
mkdir -p /mosquitto/config /mosquitto/data /mosquitto/log && \
|
||||
cp /etc/mosquitto/mosquitto.conf /mosquitto/config && \
|
||||
chown -R mosquitto:mosquitto /mosquitto
|
||||
install -d /usr/sbin/ && \
|
||||
install -s -m755 /build/mosq/client/mosquitto_pub /usr/bin/mosquitto_pub && \
|
||||
install -s -m755 /build/mosq/client/mosquitto_rr /usr/bin/mosquitto_rr && \
|
||||
install -s -m755 /build/mosq/client/mosquitto_sub /usr/bin/mosquitto_sub && \
|
||||
install -s -m644 /build/mosq/lib/libmosquitto.so.1 /usr/lib/libmosquitto.so.1 && \
|
||||
install -s -m755 /build/mosq/src/mosquitto /usr/sbin/mosquitto && \
|
||||
install -s -m755 /build/mosq/apps/mosquitto_ctrl/mosquitto_ctrl /usr/bin/mosquitto_ctrl && \
|
||||
install -s -m755 /build/mosq/apps/mosquitto_passwd/mosquitto_passwd /usr/bin/mosquitto_passwd && \
|
||||
install -s -m755 /build/mosq/plugins/dynamic-security/mosquitto_dynamic_security.so /usr/lib/mosquitto_dynamic_security.so && \
|
||||
install -m644 /build/mosq/mosquitto.conf /mosquitto/config/mosquitto.conf && \
|
||||
chown -R mosquitto:mosquitto /mosquitto && \
|
||||
apk --no-cache add \
|
||||
ca-certificates && \
|
||||
apk del build-deps && \
|
||||
rm -rf /build
|
||||
|
||||
VOLUME ["/mosquitto/config", "/mosquitto/data", "/mosquitto/log"]
|
||||
VOLUME ["/mosquitto/data", "/mosquitto/log"]
|
||||
|
||||
# Set up the entry point script and default command
|
||||
COPY docker-entrypoint.sh /
|
||||
COPY docker-entrypoint.sh mosquitto-no-auth.conf /
|
||||
EXPOSE 1883
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
CMD ["/usr/sbin/mosquitto", "-c", "/mosquitto/config/mosquitto.conf"]
|
||||
|
||||
@@ -9,6 +9,19 @@ Three docker volumes have been created in the image to be used for configuration
|
||||
/mosquitto/log
|
||||
```
|
||||
|
||||
## Running without a configuration file
|
||||
Mosquitto 2.0 requires you to configure listeners and authentication before it
|
||||
will allow connections from anything other than the loopback interface. In the
|
||||
context of a container, this means you would normally need to provide a
|
||||
configuration file with your settings.
|
||||
|
||||
If you wish to run mosquitto without any authentication, and without setting
|
||||
any other configuration options, you can do so by using a configuration
|
||||
provided in the container for this purpose:
|
||||
```
|
||||
docker run -it -p 1883:1883 eclipse-mosquitto:<version> mosquitto -c /mosquitto-no-auth.conf
|
||||
```
|
||||
|
||||
## Configuration
|
||||
When creating a container from the image, the default configuration values are used.
|
||||
To use a custom configuration file, mount a **local** configuration file to `/mosquitto/config/mosquitto.conf`
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# This is a Mosquitto configuration file that creates a listener on port 1883
|
||||
# that allows unauthenticated access.
|
||||
|
||||
listener 1883
|
||||
allow_anonymous true
|
||||
+1
-1
@@ -66,7 +66,7 @@ extern "C" {
|
||||
|
||||
#define LIBMOSQUITTO_MAJOR 2
|
||||
#define LIBMOSQUITTO_MINOR 0
|
||||
#define LIBMOSQUITTO_REVISION 8
|
||||
#define LIBMOSQUITTO_REVISION 10
|
||||
/* 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)
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||
|
||||
Name "Eclipse Mosquitto"
|
||||
!define VERSION 2.0.8
|
||||
!define VERSION 2.0.10
|
||||
OutFile "mosquitto-${VERSION}-install-windows-x86.exe"
|
||||
|
||||
InstallDir "$PROGRAMFILES\mosquitto"
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
!define env_hklm 'HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"'
|
||||
|
||||
Name "Eclipse Mosquitto"
|
||||
!define VERSION 2.0.8
|
||||
!define VERSION 2.0.10
|
||||
OutFile "mosquitto-${VERSION}-install-windows-x64.exe"
|
||||
|
||||
!include "x64.nsh"
|
||||
|
||||
+1
-1
@@ -190,7 +190,7 @@ static int mosquitto__reconnect(struct mosquitto *mosq, bool blocking)
|
||||
|
||||
packet__cleanup_all(mosq);
|
||||
|
||||
message__reconnect_reset(mosq);
|
||||
message__reconnect_reset(mosq, false);
|
||||
|
||||
if(mosq->sock != INVALID_SOCKET){
|
||||
net__socket_close(mosq); //close socket
|
||||
|
||||
@@ -26,6 +26,7 @@ Contributors:
|
||||
#include "mqtt_protocol.h"
|
||||
#include "packet_mosq.h"
|
||||
#include "property_mosq.h"
|
||||
#include "read_handle.h"
|
||||
|
||||
|
||||
int handle__auth(struct mosquitto *mosq)
|
||||
|
||||
@@ -82,7 +82,7 @@ int handle__connack(struct mosquitto *mosq)
|
||||
mosquitto_property_read_int32(properties, MQTT_PROP_MAXIMUM_PACKET_SIZE, &mosq->maximum_packet_size, false);
|
||||
|
||||
mosq->msgs_out.inflight_quota = mosq->msgs_out.inflight_maximum;
|
||||
message__reconnect_reset(mosq);
|
||||
message__reconnect_reset(mosq, true);
|
||||
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received CONNACK (%d)", mosq->id, reason_code);
|
||||
if(reason_code == MQTT_RC_SUCCESS){
|
||||
|
||||
@@ -27,6 +27,7 @@ Contributors:
|
||||
#include "net_mosq.h"
|
||||
#include "packet_mosq.h"
|
||||
#include "property_mosq.h"
|
||||
#include "read_handle.h"
|
||||
#include "send_mosq.h"
|
||||
#include "util_mosq.h"
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ Contributors:
|
||||
#include "messages_mosq.h"
|
||||
#include "packet_mosq.h"
|
||||
#include "property_mosq.h"
|
||||
#include "read_handle.h"
|
||||
#include "send_mosq.h"
|
||||
#include "time_mosq.h"
|
||||
#include "util_mosq.h"
|
||||
|
||||
@@ -32,6 +32,7 @@ Contributors:
|
||||
#include "mqtt_protocol.h"
|
||||
#include "packet_mosq.h"
|
||||
#include "property_mosq.h"
|
||||
#include "read_handle.h"
|
||||
#include "util_mosq.h"
|
||||
|
||||
|
||||
|
||||
+3
-2
@@ -23,11 +23,12 @@ Contributors:
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "logging_mosq.h"
|
||||
#include "mosquitto_internal.h"
|
||||
#include "mosquitto.h"
|
||||
#include "memory_mosq.h"
|
||||
|
||||
int log__printf(struct mosquitto *mosq, int priority, const char *fmt, ...)
|
||||
int log__printf(struct mosquitto *mosq, unsigned int priority, const char *fmt, ...)
|
||||
{
|
||||
va_list va;
|
||||
char *s;
|
||||
@@ -50,7 +51,7 @@ int log__printf(struct mosquitto *mosq, int priority, const char *fmt, ...)
|
||||
va_end(va);
|
||||
s[len-1] = '\0'; /* Ensure string is null terminated. */
|
||||
|
||||
mosq->on_log(mosq, mosq->userdata, priority, s);
|
||||
mosq->on_log(mosq, mosq->userdata, (int)priority, s);
|
||||
|
||||
mosquitto__free(s);
|
||||
}
|
||||
|
||||
+5
-1
@@ -20,6 +20,10 @@ Contributors:
|
||||
|
||||
#include "mosquitto.h"
|
||||
|
||||
int log__printf(struct mosquitto *mosq, unsigned int priority, const char *fmt, ...);
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(attrib)
|
||||
#endif
|
||||
|
||||
int log__printf(struct mosquitto *mosq, unsigned int level, const char *fmt, ...) __attribute__((format(printf, 3, 4)));
|
||||
|
||||
#endif
|
||||
|
||||
@@ -204,6 +204,12 @@ static int interruptible_sleep(struct mosquitto *mosq, time_t reconnect_delay)
|
||||
char pairbuf;
|
||||
int maxfd = 0;
|
||||
|
||||
#ifndef WIN32
|
||||
while(read(mosq->sockpairR, &pairbuf, 1) > 0);
|
||||
#else
|
||||
while(recv(mosq->sockpairR, &pairbuf, 1, 0) > 0);
|
||||
#endif
|
||||
|
||||
local_timeout.tv_sec = reconnect_delay;
|
||||
#ifdef HAVE_PSELECT
|
||||
local_timeout.tv_nsec = 0;
|
||||
|
||||
+11
-9
@@ -137,7 +137,7 @@ int message__queue(struct mosquitto *mosq, struct mosquitto_message_all *message
|
||||
return message__release_to_inflight(mosq, dir);
|
||||
}
|
||||
|
||||
void message__reconnect_reset(struct mosquitto *mosq)
|
||||
void message__reconnect_reset(struct mosquitto *mosq, bool update_quota_only)
|
||||
{
|
||||
struct mosquitto_message_all *message, *tmp;
|
||||
assert(mosq);
|
||||
@@ -167,15 +167,17 @@ void message__reconnect_reset(struct mosquitto *mosq)
|
||||
|
||||
if(mosq->msgs_out.inflight_quota != 0){
|
||||
util__decrement_send_quota(mosq);
|
||||
if(message->msg.qos == 1){
|
||||
message->state = mosq_ms_publish_qos1;
|
||||
}else if(message->msg.qos == 2){
|
||||
if(message->state == mosq_ms_wait_for_pubrec){
|
||||
message->state = mosq_ms_publish_qos2;
|
||||
}else if(message->state == mosq_ms_wait_for_pubcomp){
|
||||
message->state = mosq_ms_resend_pubrel;
|
||||
if (update_quota_only == false){
|
||||
if(message->msg.qos == 1){
|
||||
message->state = mosq_ms_publish_qos1;
|
||||
}else if(message->msg.qos == 2){
|
||||
if(message->state == mosq_ms_wait_for_pubrec){
|
||||
message->state = mosq_ms_publish_qos2;
|
||||
}else if(message->state == mosq_ms_wait_for_pubcomp){
|
||||
message->state = mosq_ms_resend_pubrel;
|
||||
}
|
||||
/* Should be able to preserve state. */
|
||||
}
|
||||
/* Should be able to preserve state. */
|
||||
}
|
||||
}else{
|
||||
message->state = mosq_ms_invalid;
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ void message__cleanup_all(struct mosquitto *mosq);
|
||||
void message__cleanup(struct mosquitto_message_all **message);
|
||||
int message__delete(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_direction dir, int qos);
|
||||
int message__queue(struct mosquitto *mosq, struct mosquitto_message_all *message, enum mosquitto_msg_direction dir);
|
||||
void message__reconnect_reset(struct mosquitto *mosq);
|
||||
void message__reconnect_reset(struct mosquitto *mosq, bool update_quota_only);
|
||||
int message__release_to_inflight(struct mosquitto *mosq, enum mosquitto_msg_direction dir);
|
||||
int message__remove(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_direction dir, struct mosquitto_message_all **message, int qos);
|
||||
void message__retry_check(struct mosquitto *mosq);
|
||||
|
||||
@@ -36,6 +36,8 @@ Contributors:
|
||||
# include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#include "misc_mosq.h"
|
||||
|
||||
|
||||
FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read)
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ Contributors:
|
||||
#define MISC_MOSQ_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
|
||||
FILE *mosquitto__fopen(const char *path, const char *mode, bool restrict_read);
|
||||
char *misc__trimblanks(char *str);
|
||||
|
||||
@@ -195,6 +195,7 @@ int mosquitto_reinitialise(struct mosquitto *mosq, const char *id, bool clean_st
|
||||
#ifdef WITH_TLS
|
||||
mosq->ssl = NULL;
|
||||
mosq->ssl_ctx = NULL;
|
||||
mosq->ssl_ctx_defaults = true;
|
||||
mosq->tls_cert_reqs = SSL_VERIFY_PEER;
|
||||
mosq->tls_insecure = false;
|
||||
mosq->want_write = false;
|
||||
|
||||
+1
-4
@@ -917,16 +917,13 @@ int net__socket_connect_step3(struct mosquitto *mosq, const char *host)
|
||||
/* Create a socket and connect it to 'ip' on port 'port'. */
|
||||
int net__socket_connect(struct mosquitto *mosq, const char *host, uint16_t port, const char *bind_address, bool blocking)
|
||||
{
|
||||
mosq_sock_t sock = INVALID_SOCKET;
|
||||
int rc, rc2;
|
||||
|
||||
if(!mosq || !host) return MOSQ_ERR_INVAL;
|
||||
|
||||
rc = net__try_connect(host, port, &sock, bind_address, blocking);
|
||||
rc = net__try_connect(host, port, &mosq->sock, bind_address, blocking);
|
||||
if(rc > 0) return rc;
|
||||
|
||||
mosq->sock = sock;
|
||||
|
||||
if(mosq->tcp_nodelay){
|
||||
int flag = 1;
|
||||
if(setsockopt(mosq->sock, IPPROTO_TCP, TCP_NODELAY, (const void*)&flag, sizeof(int)) != 0){
|
||||
|
||||
+2
-1
@@ -64,10 +64,11 @@ int mosquitto__verify_ocsp_status_cb(SSL * ssl, void *arg)
|
||||
OCSP_BASICRESP *br = NULL;
|
||||
X509_STORE *st = NULL;
|
||||
STACK_OF(X509) *ch = NULL;
|
||||
long len;
|
||||
|
||||
UNUSED(ssl);
|
||||
|
||||
long len = SSL_get_tlsext_status_ocsp_resp(mosq->ssl, &p);
|
||||
len = SSL_get_tlsext_status_ocsp_resp(mosq->ssl, &p);
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "OCSP: SSL_get_tlsext_status_ocsp_resp returned %ld bytes", len);
|
||||
|
||||
/* the following functions expect a const pointer */
|
||||
|
||||
+3
-3
@@ -33,7 +33,7 @@ Contributors:
|
||||
#include "property_mosq.h"
|
||||
|
||||
|
||||
int property__read(struct mosquitto__packet *packet, uint32_t *len, mosquitto_property *property)
|
||||
static int property__read(struct mosquitto__packet *packet, uint32_t *len, mosquitto_property *property)
|
||||
{
|
||||
int rc;
|
||||
uint32_t property_identifier;
|
||||
@@ -355,7 +355,7 @@ unsigned int property__get_remaining_length(const mosquitto_property *props)
|
||||
}
|
||||
|
||||
|
||||
int property__write(struct mosquitto__packet *packet, const mosquitto_property *property)
|
||||
static int property__write(struct mosquitto__packet *packet, const mosquitto_property *property)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -975,7 +975,7 @@ int mosquitto_property_check_all(int command, const mosquitto_property *properti
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
const mosquitto_property *property__get_property(const mosquitto_property *proplist, int identifier, bool skip_first)
|
||||
static const mosquitto_property *property__get_property(const mosquitto_property *proplist, int identifier, bool skip_first)
|
||||
{
|
||||
const mosquitto_property *p;
|
||||
bool is_first = true;
|
||||
|
||||
@@ -32,6 +32,7 @@ Contributors:
|
||||
#include "mqtt_protocol.h"
|
||||
#include "packet_mosq.h"
|
||||
#include "property_mosq.h"
|
||||
#include "send_mosq.h"
|
||||
|
||||
int send__connect(struct mosquitto *mosq, uint16_t keepalive, bool clean_session, const mosquitto_property *properties)
|
||||
{
|
||||
|
||||
@@ -32,10 +32,11 @@ Contributors:
|
||||
#include "mqtt_protocol.h"
|
||||
#include "packet_mosq.h"
|
||||
#include "property_mosq.h"
|
||||
#include "send_mosq.h"
|
||||
#include "util_mosq.h"
|
||||
|
||||
|
||||
int send__subscribe(struct mosquitto *mosq, int *mid, int topic_count, const char **topic, int topic_qos, const mosquitto_property *properties)
|
||||
int send__subscribe(struct mosquitto *mosq, int *mid, int topic_count, char *const *const topic, int topic_qos, const mosquitto_property *properties)
|
||||
{
|
||||
struct mosquitto__packet *packet = NULL;
|
||||
uint32_t packetlen;
|
||||
|
||||
+2
-1
@@ -23,7 +23,7 @@ Contributors:
|
||||
#include <limits.h>
|
||||
#ifdef WIN32
|
||||
# include <ws2tcpip.h>
|
||||
#elif __QNX__
|
||||
#elif defined(__QNX__)
|
||||
# include <sys/socket.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <netinet/in.h>
|
||||
@@ -40,6 +40,7 @@ Contributors:
|
||||
#include "net_mosq.h"
|
||||
#include "packet_mosq.h"
|
||||
#include "send_mosq.h"
|
||||
#include "socks_mosq.h"
|
||||
#include "util_mosq.h"
|
||||
|
||||
#define SOCKS_AUTH_NONE 0x00U
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user