From 7aa1c265aaa5d6636e9ae8f2afb8e8530e743824 Mon Sep 17 00:00:00 2001
From: Paolo Patruno
Date: Fri, 20 Dec 2019 14:00:23 +0100
Subject: [PATCH] porting to mosquitto 1.6 and configuration for RMAP
---
.gitignore | 1 -
auth-plug.c | 8 +++++---
config.mk | 32 ++++++++++++++++++++++++++++++++
3 files changed, 37 insertions(+), 4 deletions(-)
create mode 100644 config.mk
diff --git a/.gitignore b/.gitignore
index 4ff7127e..e6a3fab4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,5 +6,4 @@ np
jp*.conf
Makefile
*.a
-config.mk
sundry
diff --git a/auth-plug.c b/auth-plug.c
index 735589f3..74e205ed 100644
--- a/auth-plug.c
+++ b/auth-plug.c
@@ -499,7 +499,7 @@ int mosquitto_auth_security_cleanup(void *userdata, struct mosquitto_auth_opt *a
#if MOSQ_AUTH_PLUGIN_VERSION >=3
-int mosquitto_auth_unpwd_check(void *userdata, const struct mosquitto *client, const char *username, const char *password)
+int mosquitto_auth_unpwd_check(void *userdata, struct mosquitto *client, const char *username, const char *password)
#else
int mosquitto_auth_unpwd_check(void *userdata, const char *username, const char *password)
#endif
@@ -598,7 +598,7 @@ int mosquitto_auth_unpwd_check(void *userdata, const char *username, const char
}
#if MOSQ_AUTH_PLUGIN_VERSION >= 3
-int mosquitto_auth_acl_check(void *userdata, int access, const struct mosquitto *client, const struct mosquitto_acl_msg *msg)
+int mosquitto_auth_acl_check(void *userdata, int access, struct mosquitto *client, const struct mosquitto_acl_msg *msg)
#else
int mosquitto_auth_acl_check(void *userdata, const char *clientid, const char *username, const char *topic, int access)
#endif
@@ -642,6 +642,7 @@ int mosquitto_auth_acl_check(void *userdata, const char *clientid, const char *u
* id to bypass ACL checks (or have a username/client id that cannot
* publish or receive messages to its own place in the hierarchy).
*/
+ /*
if(username && strpbrk(username, "+#/")){
_log(MOSQ_LOG_NOTICE, "ACL denying access to client with dangerous username \"%s\"", username);
return MOSQ_DENY_ACL;
@@ -651,6 +652,7 @@ int mosquitto_auth_acl_check(void *userdata, const char *clientid, const char *u
_log(MOSQ_LOG_NOTICE, "ACL denying access to client with dangerous client id \"%s\"", clientid);
return MOSQ_DENY_ACL;
}
+ */
_log(LOG_DEBUG, "mosquitto_auth_acl_check(..., %s, %s, %s, %s)",
clientid ? clientid : "NULL",
@@ -749,7 +751,7 @@ int mosquitto_auth_acl_check(void *userdata, const char *clientid, const char *u
#if MOSQ_AUTH_PLUGIN_VERSION >= 3
-int mosquitto_auth_psk_key_get(void *userdata, const struct mosquitto *client, const char *hint, const char *identity, char *key, int max_key_len)
+int mosquitto_auth_psk_key_get(void *userdata, struct mosquitto *client, const char *hint, const char *identity, char *key, int max_key_len)
#else
int mosquitto_auth_psk_key_get(void *userdata, const char *hint, const char *identity, char *key, int max_key_len)
#endif
diff --git a/config.mk b/config.mk
new file mode 100644
index 00000000..d645f079
--- /dev/null
+++ b/config.mk
@@ -0,0 +1,32 @@
+# Select your backends from this list
+BACKEND_CDB ?= no
+BACKEND_MYSQL ?= no
+BACKEND_SQLITE ?= no
+BACKEND_REDIS ?= no
+BACKEND_POSTGRES ?= no
+BACKEND_LDAP ?= no
+BACKEND_HTTP ?= yes
+BACKEND_JWT ?= no
+BACKEND_MONGO ?= no
+BACKEND_FILES ?= no
+BACKEND_MEMCACHED ?= no
+
+# Specify the path to the Mosquitto sources here
+# MOSQUITTO_SRC = /usr/local/Cellar/mosquitto/1.4.12
+MOSQUITTO_SRC =
+
+# Specify the path the OpenSSL here
+OPENSSLDIR = /usr
+
+# Add support for django hashers algorithm name
+SUPPORT_DJANGO_HASHERS ?= no
+
+# Specify optional/additional linker/compiler flags here
+# On macOS, add
+# CFG_LDFLAGS = -undefined dynamic_lookup
+# as described in https://github.com/eclipse/mosquitto/issues/244
+#
+# CFG_LDFLAGS = -undefined dynamic_lookup -L/usr/local/Cellar/openssl/1.0.2l/lib
+# CFG_CFLAGS = -I/usr/local/Cellar/openssl/1.0.2l/include -I/usr/local/Cellar/mosquitto/1.4.12/include
+CFG_LDFLAGS =
+CFG_CFLAGS =