Fix "unused parameter" warnings.
This commit is contained in:
parent
0941638143
commit
2dd24449ad
@ -41,7 +41,7 @@ static int mosquitto__parse_socks_url(struct mosq_config *cfg, char *url);
|
||||
static int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, char *argv[]);
|
||||
|
||||
|
||||
static int check_format(struct mosq_config *cfg, const char *str)
|
||||
static int check_format(const char *str)
|
||||
{
|
||||
int i;
|
||||
int len;
|
||||
@ -575,7 +575,7 @@ int client_config_line_proc(struct mosq_config *cfg, int pub_or_sub, int argc, c
|
||||
fprintf(stderr, "Error: Out of memory.\n");
|
||||
return 1;
|
||||
}
|
||||
if(check_format(cfg, cfg->format)){
|
||||
if(check_format(cfg->format)){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -1062,7 +1062,7 @@ int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
int client_id_generate(struct mosq_config *cfg, const char *id_base)
|
||||
int client_id_generate(struct mosq_config *cfg)
|
||||
{
|
||||
if(cfg->id_prefix){
|
||||
cfg->id = malloc(strlen(cfg->id_prefix)+10);
|
||||
|
@ -109,7 +109,7 @@ struct mosq_config {
|
||||
int client_config_load(struct mosq_config *config, int pub_or_sub, int argc, char *argv[]);
|
||||
void client_config_cleanup(struct mosq_config *cfg);
|
||||
int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg);
|
||||
int client_id_generate(struct mosq_config *cfg, const char *id_base);
|
||||
int client_id_generate(struct mosq_config *cfg);
|
||||
int client_connect(struct mosquitto *mosq, struct mosq_config *cfg);
|
||||
|
||||
int cfg_parse_property(struct mosq_config *cfg, int argc, char *argv[], int *idx);
|
||||
|
@ -52,6 +52,10 @@ void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flag
|
||||
{
|
||||
int rc = MOSQ_ERR_SUCCESS;
|
||||
|
||||
UNUSED(obj);
|
||||
UNUSED(flags);
|
||||
UNUSED(properties);
|
||||
|
||||
if(!result){
|
||||
switch(cfg.pub_mode){
|
||||
case MSGMODE_CMD:
|
||||
@ -250,7 +254,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
if(client_id_generate(&cfg, "mosqpub")){
|
||||
if(client_id_generate(&cfg)){
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -49,11 +49,19 @@ static int buf_len = 1024;
|
||||
|
||||
void my_disconnect_callback(struct mosquitto *mosq, void *obj, int rc, const mosquitto_property *properties)
|
||||
{
|
||||
UNUSED(mosq);
|
||||
UNUSED(obj);
|
||||
UNUSED(rc);
|
||||
UNUSED(properties);
|
||||
|
||||
connected = false;
|
||||
}
|
||||
|
||||
void my_publish_callback(struct mosquitto *mosq, void *obj, int mid, int reason_code, const mosquitto_property *properties)
|
||||
{
|
||||
UNUSED(obj);
|
||||
UNUSED(properties);
|
||||
|
||||
last_mid_sent = mid;
|
||||
if(reason_code > 127){
|
||||
if(!cfg.quiet) fprintf(stderr, "Warning: Publish %d failed: %s.\n", mid, mosquitto_reason_string(reason_code));
|
||||
@ -71,6 +79,10 @@ void my_publish_callback(struct mosquitto *mosq, void *obj, int mid, int reason_
|
||||
|
||||
void my_log_callback(struct mosquitto *mosq, void *obj, int level, const char *str)
|
||||
{
|
||||
UNUSED(mosq);
|
||||
UNUSED(obj);
|
||||
UNUSED(level);
|
||||
|
||||
printf("%s\n", str);
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,10 @@ void print_message(struct mosq_config *cfg, const struct mosquitto_message *mess
|
||||
|
||||
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);
|
||||
}
|
||||
@ -67,6 +71,9 @@ void my_message_callback(struct mosquitto *mosq, void *obj, const struct mosquit
|
||||
int i;
|
||||
bool res;
|
||||
|
||||
UNUSED(obj);
|
||||
UNUSED(properties);
|
||||
|
||||
if(process_messages == false) return;
|
||||
|
||||
if(cfg.remove_retained && message->retain){
|
||||
@ -106,6 +113,10 @@ void my_connect_callback(struct mosquitto *mosq, void *obj, int result, int flag
|
||||
{
|
||||
int i;
|
||||
|
||||
UNUSED(obj);
|
||||
UNUSED(flags);
|
||||
UNUSED(properties);
|
||||
|
||||
if(!result){
|
||||
mosquitto_subscribe_multiple(mosq, NULL, cfg.topic_count, cfg.topics, cfg.qos, cfg.sub_opts, cfg.subscribe_props);
|
||||
|
||||
@ -128,6 +139,8 @@ void my_subscribe_callback(struct mosquitto *mosq, void *obj, int mid, int qos_c
|
||||
{
|
||||
int i;
|
||||
|
||||
UNUSED(obj);
|
||||
|
||||
if(!cfg.quiet) printf("Subscribed (mid: %d): %d", mid, granted_qos[0]);
|
||||
for(i=1; i<qos_count; i++){
|
||||
if(!cfg.quiet) printf(", %d", granted_qos[i]);
|
||||
@ -141,6 +154,10 @@ 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)
|
||||
{
|
||||
UNUSED(mosq);
|
||||
UNUSED(obj);
|
||||
UNUSED(level);
|
||||
|
||||
printf("%s\n", str);
|
||||
}
|
||||
|
||||
@ -281,7 +298,7 @@ int main(int argc, char *argv[])
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if(client_id_generate(&cfg, "mosqsub")){
|
||||
if(client_id_generate(&cfg)){
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
2
config.h
2
config.h
@ -58,4 +58,6 @@
|
||||
# define _Float128 uint64_t
|
||||
#endif
|
||||
|
||||
#define UNUSED(A) (void)(A)
|
||||
|
||||
#endif
|
||||
|
@ -18,47 +18,58 @@ Contributors:
|
||||
#include <mosquitto.h>
|
||||
#include <mosquittopp.h>
|
||||
|
||||
#define UNUSED(A) (void)(A)
|
||||
|
||||
namespace mosqpp {
|
||||
|
||||
static void on_connect_wrapper(struct mosquitto *mosq, void *userdata, int rc)
|
||||
{
|
||||
class mosquittopp *m = (class mosquittopp *)userdata;
|
||||
|
||||
UNUSED(mosq);
|
||||
|
||||
m->on_connect(rc);
|
||||
}
|
||||
|
||||
static void on_connect_with_flags_wrapper(struct mosquitto *mosq, void *userdata, int rc, int flags)
|
||||
{
|
||||
class mosquittopp *m = (class mosquittopp *)userdata;
|
||||
UNUSED(mosq);
|
||||
m->on_connect_with_flags(rc, flags);
|
||||
}
|
||||
|
||||
static void on_disconnect_wrapper(struct mosquitto *mosq, void *userdata, int rc)
|
||||
{
|
||||
class mosquittopp *m = (class mosquittopp *)userdata;
|
||||
UNUSED(mosq);
|
||||
m->on_disconnect(rc);
|
||||
}
|
||||
|
||||
static void on_publish_wrapper(struct mosquitto *mosq, void *userdata, int mid)
|
||||
{
|
||||
class mosquittopp *m = (class mosquittopp *)userdata;
|
||||
UNUSED(mosq);
|
||||
m->on_publish(mid);
|
||||
}
|
||||
|
||||
static void on_message_wrapper(struct mosquitto *mosq, void *userdata, const struct mosquitto_message *message)
|
||||
{
|
||||
class mosquittopp *m = (class mosquittopp *)userdata;
|
||||
UNUSED(mosq);
|
||||
m->on_message(message);
|
||||
}
|
||||
|
||||
static void on_subscribe_wrapper(struct mosquitto *mosq, void *userdata, int mid, int qos_count, const int *granted_qos)
|
||||
{
|
||||
class mosquittopp *m = (class mosquittopp *)userdata;
|
||||
UNUSED(mosq);
|
||||
m->on_subscribe(mid, qos_count, granted_qos);
|
||||
}
|
||||
|
||||
static void on_unsubscribe_wrapper(struct mosquitto *mosq, void *userdata, int mid)
|
||||
{
|
||||
class mosquittopp *m = (class mosquittopp *)userdata;
|
||||
UNUSED(mosq);
|
||||
m->on_unsubscribe(mid);
|
||||
}
|
||||
|
||||
@ -66,6 +77,7 @@ static void on_unsubscribe_wrapper(struct mosquitto *mosq, void *userdata, int m
|
||||
static void on_log_wrapper(struct mosquitto *mosq, void *userdata, int level, const char *str)
|
||||
{
|
||||
class mosquittopp *m = (class mosquittopp *)userdata;
|
||||
UNUSED(mosq);
|
||||
m->on_log(level, str);
|
||||
}
|
||||
|
||||
|
@ -68,6 +68,8 @@ int handle__pubrec(struct mosquitto_db *db, struct mosquitto *mosq)
|
||||
return db__message_delete(db, mosq, mid, mosq_md_out, mosq_ms_wait_for_pubrec, 2);
|
||||
}
|
||||
#else
|
||||
UNUSED(db);
|
||||
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PUBREC (Mid: %d)", mosq->id, mid);
|
||||
|
||||
if(reason_code < 0x80){
|
||||
|
@ -84,6 +84,8 @@ int handle__pubrel(struct mosquitto_db *db, struct mosquitto *mosq)
|
||||
rc = send__pubcomp(mosq, mid);
|
||||
if(rc) return rc;
|
||||
#else
|
||||
UNUSED(db);
|
||||
|
||||
log__printf(mosq, MOSQ_LOG_DEBUG, "Client %s received PUBREL (Mid: %d)", mosq->id, mid);
|
||||
|
||||
rc = send__pubcomp(mosq, mid);
|
||||
|
@ -42,6 +42,8 @@ static void on_connect(struct mosquitto *mosq, void *obj, int rc)
|
||||
{
|
||||
struct userdata__callback *userdata = obj;
|
||||
|
||||
UNUSED(rc);
|
||||
|
||||
mosquitto_subscribe(mosq, NULL, userdata->topic, userdata->qos);
|
||||
}
|
||||
|
||||
|
@ -372,6 +372,8 @@ void message__retry_check(struct mosquitto *mosq)
|
||||
|
||||
void mosquitto_message_retry_set(struct mosquitto *mosq, unsigned int message_retry)
|
||||
{
|
||||
UNUSED(mosq);
|
||||
UNUSED(message_retry);
|
||||
}
|
||||
|
||||
int message__out_update(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg_state state, int qos)
|
||||
|
@ -231,6 +231,8 @@ static unsigned int psk_client_callback(SSL *ssl, const char *hint,
|
||||
struct mosquitto *mosq;
|
||||
int len;
|
||||
|
||||
UNUSED(hint);
|
||||
|
||||
mosq = SSL_get_ex_data(ssl, tls_ex_index_mosq);
|
||||
if(!mosq) return 0;
|
||||
|
||||
@ -350,7 +352,7 @@ int net__try_connect_step2(struct mosquitto *mosq, uint16_t port, mosq_sock_t *s
|
||||
#endif
|
||||
|
||||
|
||||
int net__try_connect(struct mosquitto *mosq, const char *host, uint16_t port, mosq_sock_t *sock, const char *bind_address, bool blocking)
|
||||
int net__try_connect(const char *host, uint16_t port, mosq_sock_t *sock, const char *bind_address, bool blocking)
|
||||
{
|
||||
struct addrinfo hints;
|
||||
struct addrinfo *ainfo, *rp;
|
||||
@ -768,7 +770,7 @@ int net__socket_connect(struct mosquitto *mosq, const char *host, uint16_t port,
|
||||
|
||||
if(!mosq || !host || !port) return MOSQ_ERR_INVAL;
|
||||
|
||||
rc = net__try_connect(mosq, host, port, &sock, bind_address, blocking);
|
||||
rc = net__try_connect(host, port, &sock, bind_address, blocking);
|
||||
if(rc > 0) return rc;
|
||||
|
||||
mosq->sock = sock;
|
||||
|
@ -58,7 +58,7 @@ int net__socket_close(struct mosquitto_db *db, struct mosquitto *mosq);
|
||||
#else
|
||||
int net__socket_close(struct mosquitto *mosq);
|
||||
#endif
|
||||
int net__try_connect(struct mosquitto *mosq, const char *host, uint16_t port, mosq_sock_t *sock, const char *bind_address, bool blocking);
|
||||
int net__try_connect(const char *host, uint16_t port, mosq_sock_t *sock, const char *bind_address, bool blocking);
|
||||
int net__try_connect_step1(struct mosquitto *mosq, const char *host);
|
||||
int net__try_connect_step2(struct mosquitto *mosq, uint16_t port, mosq_sock_t *sock);
|
||||
int net__socket_connect_step3(struct mosquitto *mosq, const char *host);
|
||||
|
@ -100,6 +100,11 @@ int mosquitto_connect_srv(struct mosquitto *mosq, const char *host, int keepaliv
|
||||
return MOSQ_ERR_SUCCESS;
|
||||
|
||||
#else
|
||||
UNUSED(mosq);
|
||||
UNUSED(host);
|
||||
UNUSED(keepalive);
|
||||
UNUSED(bind_address);
|
||||
|
||||
return MOSQ_ERR_NOT_SUPPORTED;
|
||||
#endif
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ static char nibble_to_hex(uint8_t value)
|
||||
}
|
||||
}
|
||||
|
||||
static char *client_id_gen(struct mosquitto_db *db, int *idlen, const char *auto_id_prefix, int auto_id_prefix_len)
|
||||
static char *client_id_gen(int *idlen, const char *auto_id_prefix, int auto_id_prefix_len)
|
||||
{
|
||||
char *client_id;
|
||||
uint8_t rnd[16];
|
||||
@ -394,9 +394,9 @@ int handle__connect(struct mosquitto_db *db, struct mosquitto *context)
|
||||
goto handle_connect_error;
|
||||
}else{
|
||||
if(db->config->per_listener_settings){
|
||||
client_id = client_id_gen(db, &slen, context->listener->security_options.auto_id_prefix, context->listener->security_options.auto_id_prefix_len);
|
||||
client_id = client_id_gen(&slen, context->listener->security_options.auto_id_prefix, context->listener->security_options.auto_id_prefix_len);
|
||||
}else{
|
||||
client_id = client_id_gen(db, &slen, db->config->security_options.auto_id_prefix, db->config->security_options.auto_id_prefix_len);
|
||||
client_id = client_id_gen(&slen, db->config->security_options.auto_id_prefix, db->config->security_options.auto_id_prefix_len);
|
||||
}
|
||||
if(!client_id){
|
||||
rc = MOSQ_ERR_NOMEM;
|
||||
|
@ -354,6 +354,8 @@ int log__printf(struct mosquitto *mosq, int priority, const char *fmt, ...)
|
||||
va_list va;
|
||||
int rc;
|
||||
|
||||
UNUSED(mosq);
|
||||
|
||||
va_start(va, fmt);
|
||||
rc = log__vprintf(priority, fmt, va);
|
||||
va_end(va);
|
||||
|
@ -101,7 +101,7 @@ static void temp__expire_websockets_clients(struct mosquitto_db *db)
|
||||
}
|
||||
#endif
|
||||
|
||||
int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int listensock_count, int listener_max)
|
||||
int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int listensock_count)
|
||||
{
|
||||
#ifdef WITH_SYS_TREE
|
||||
time_t start_time = mosquitto_time();
|
||||
@ -238,7 +238,7 @@ int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int li
|
||||
&& now > context->bridge->primary_retry){
|
||||
|
||||
if(context->bridge->primary_retry_sock == INVALID_SOCKET){
|
||||
rc = net__try_connect(context, context->bridge->addresses[0].address,
|
||||
rc = net__try_connect(context->bridge->addresses[0].address,
|
||||
context->bridge->addresses[0].port,
|
||||
&context->bridge->primary_retry_sock, NULL, false);
|
||||
|
||||
|
@ -204,11 +204,9 @@ int main(int argc, char *argv[])
|
||||
struct mosquitto__config config;
|
||||
int i, j;
|
||||
FILE *pid;
|
||||
int listener_max;
|
||||
int rc;
|
||||
#ifdef WIN32
|
||||
SYSTEMTIME st;
|
||||
_setmaxstdio(2048);
|
||||
#else
|
||||
struct timeval tv;
|
||||
#endif
|
||||
@ -294,7 +292,6 @@ int main(int argc, char *argv[])
|
||||
sys_tree__init(&int_db);
|
||||
#endif
|
||||
|
||||
listener_max = -1;
|
||||
listensock_index = 0;
|
||||
for(i=0; i<config.listener_count; i++){
|
||||
if(config.listeners[i].protocol == mp_mqtt){
|
||||
@ -323,9 +320,6 @@ int main(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
listensock[listensock_index] = config.listeners[i].socks[j];
|
||||
if(listensock[listensock_index] > listener_max){
|
||||
listener_max = listensock[listensock_index];
|
||||
}
|
||||
listensock_index++;
|
||||
}
|
||||
}else if(config.listeners[i].protocol == mp_websockets){
|
||||
@ -370,7 +364,7 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
run = 1;
|
||||
rc = mosquitto_main_loop(&int_db, listensock, listensock_count, listener_max);
|
||||
rc = mosquitto_main_loop(&int_db, listensock, listensock_count);
|
||||
|
||||
log__printf(NULL, MOSQ_LOG_INFO, "mosquitto version %s terminating", VERSION);
|
||||
log__close(&config);
|
||||
|
@ -498,7 +498,7 @@ struct libws_mqtt_data {
|
||||
/* ============================================================
|
||||
* Main functions
|
||||
* ============================================================ */
|
||||
int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int listensock_count, int listener_max);
|
||||
int mosquitto_main_loop(struct mosquitto_db *db, mosq_sock_t *listensock, int listensock_count);
|
||||
struct mosquitto_db *mosquitto__get_db(void);
|
||||
|
||||
/* ============================================================
|
||||
|
@ -407,6 +407,9 @@ void handle_sigint(int signal)
|
||||
ts.c_lflag |= ECHO | ICANON;
|
||||
tcsetattr(0, TCSANOW, &ts);
|
||||
#endif
|
||||
|
||||
UNUSED(signal);
|
||||
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -251,6 +251,8 @@ int net__socket_accept(struct mosquitto_db *db, mosq_sock_t listensock)
|
||||
#ifdef WITH_TLS
|
||||
static int client_certificate_verify(int preverify_ok, X509_STORE_CTX *ctx)
|
||||
{
|
||||
UNUSED(ctx);
|
||||
|
||||
/* Preverify should check expiry, revocation. */
|
||||
return preverify_ok;
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ void LIB_ERROR(void)
|
||||
}
|
||||
|
||||
|
||||
int security__load_v2(struct mosquitto_db *db, struct mosquitto__auth_plugin *plugin, struct mosquitto_auth_opt *auth_options, int auth_option_count, void *lib)
|
||||
int security__load_v2(struct mosquitto__auth_plugin *plugin, struct mosquitto_auth_opt *auth_options, int auth_option_count, void *lib)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@ -116,7 +116,7 @@ int security__load_v2(struct mosquitto_db *db, struct mosquitto__auth_plugin *pl
|
||||
}
|
||||
|
||||
|
||||
int security__load_v3(struct mosquitto_db *db, struct mosquitto__auth_plugin *plugin, struct mosquitto_opt *auth_options, int auth_option_count, void *lib)
|
||||
int security__load_v3(struct mosquitto__auth_plugin *plugin, struct mosquitto_opt *auth_options, int auth_option_count, void *lib)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@ -189,7 +189,7 @@ int security__load_v3(struct mosquitto_db *db, struct mosquitto__auth_plugin *pl
|
||||
}
|
||||
|
||||
|
||||
static int security__module_init_single(struct mosquitto_db *db, struct mosquitto__security_options *opts)
|
||||
static int security__module_init_single(struct mosquitto__security_options *opts)
|
||||
{
|
||||
void *lib;
|
||||
int (*plugin_version)(void) = NULL;
|
||||
@ -225,7 +225,6 @@ static int security__module_init_single(struct mosquitto_db *db, struct mosquitt
|
||||
opts->auth_plugin_configs[i].plugin.version = version;
|
||||
if(version == 3){
|
||||
rc = security__load_v3(
|
||||
db,
|
||||
&opts->auth_plugin_configs[i].plugin,
|
||||
opts->auth_plugin_configs[i].options,
|
||||
opts->auth_plugin_configs[i].option_count,
|
||||
@ -236,7 +235,6 @@ static int security__module_init_single(struct mosquitto_db *db, struct mosquitt
|
||||
}
|
||||
}else if(version == 2){
|
||||
rc = security__load_v2(
|
||||
db,
|
||||
&opts->auth_plugin_configs[i].plugin,
|
||||
(struct mosquitto_auth_opt *)opts->auth_plugin_configs[i].options,
|
||||
opts->auth_plugin_configs[i].option_count,
|
||||
@ -267,11 +265,11 @@ int mosquitto_security_module_init(struct mosquitto_db *db)
|
||||
|
||||
if(db->config->per_listener_settings){
|
||||
for(i=0; i<db->config->listener_count; i++){
|
||||
rc = security__module_init_single(db, &db->config->listeners[i].security_options);
|
||||
rc = security__module_init_single(&db->config->listeners[i].security_options);
|
||||
if(rc) return rc;
|
||||
}
|
||||
}else{
|
||||
rc = security__module_init_single(db, &db->config->security_options);
|
||||
rc = security__module_init_single(&db->config->security_options);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
@ -463,7 +461,7 @@ static int acl__check_single(struct mosquitto__auth_plugin_config *auth_plugin,
|
||||
}
|
||||
|
||||
|
||||
static int acl__check_dollar(struct mosquitto_db *db, struct mosquitto *context, const char *topic, int access)
|
||||
static int acl__check_dollar(const char *topic, int access)
|
||||
{
|
||||
int rc;
|
||||
bool match = false;
|
||||
@ -508,7 +506,7 @@ int mosquitto_acl_check(struct mosquitto_db *db, struct mosquitto *context, cons
|
||||
return MOSQ_ERR_ACL_DENIED;
|
||||
}
|
||||
|
||||
rc = acl__check_dollar(db, context, topic, access);
|
||||
rc = acl__check_dollar(topic, access);
|
||||
if(rc) return rc;
|
||||
|
||||
rc = mosquitto_acl_check_default(db, context, topic, access);
|
||||
|
@ -43,6 +43,8 @@ int mosquitto_security_init_default(struct mosquitto_db *db, bool reload)
|
||||
char *pwf;
|
||||
char *pskf;
|
||||
|
||||
UNUSED(reload);
|
||||
|
||||
/* Load username/password data if required. */
|
||||
if(db->config->per_listener_settings){
|
||||
for(i=0; i<db->config->listener_count; i++){
|
||||
@ -587,6 +589,8 @@ static int acl__cleanup(struct mosquitto_db *db, bool reload)
|
||||
struct mosquitto *context, *ctxt_tmp;
|
||||
int i;
|
||||
|
||||
UNUSED(reload);
|
||||
|
||||
if(!db) return MOSQ_ERR_INVAL;
|
||||
|
||||
/* As we're freeing ACLs, we must clear context->acl_list to ensure no
|
||||
@ -919,6 +923,8 @@ static int unpwd__cleanup(struct mosquitto__unpwd **root, bool reload)
|
||||
{
|
||||
struct mosquitto__unpwd *u, *tmp;
|
||||
|
||||
UNUSED(reload);
|
||||
|
||||
if(!root) return MOSQ_ERR_INVAL;
|
||||
|
||||
HASH_ITER(hh, *root, u, tmp){
|
||||
|
@ -64,6 +64,8 @@ extern int run;
|
||||
/* Signal handler for SIGHUP - flag a config reload. */
|
||||
void handle_sighup(int signal)
|
||||
{
|
||||
UNUSED(signal);
|
||||
|
||||
flag_reload = true;
|
||||
}
|
||||
#endif
|
||||
@ -71,12 +73,16 @@ void handle_sighup(int signal)
|
||||
/* Signal handler for SIGINT and SIGTERM - just stop gracefully. */
|
||||
void handle_sigint(int signal)
|
||||
{
|
||||
UNUSED(signal);
|
||||
|
||||
run = 0;
|
||||
}
|
||||
|
||||
/* Signal handler for SIGUSR1 - backup the db. */
|
||||
void handle_sigusr1(int signal)
|
||||
{
|
||||
UNUSED(signal);
|
||||
|
||||
#ifdef WITH_PERSISTENCE
|
||||
flag_db_backup = true;
|
||||
#endif
|
||||
@ -85,6 +91,8 @@ void handle_sigusr1(int signal)
|
||||
/* Signal handler for SIGUSR2 - print subscription / retained tree. */
|
||||
void handle_sigusr2(int signal)
|
||||
{
|
||||
UNUSED(signal);
|
||||
|
||||
flag_tree_print = true;
|
||||
}
|
||||
|
||||
|
@ -669,7 +669,7 @@ void sub__tree_print(struct mosquitto__subhier *root, int level)
|
||||
}
|
||||
}
|
||||
|
||||
static int retain__process(struct mosquitto_db *db, struct mosquitto__subhier *branch, struct mosquitto *context, const char *sub, int sub_qos, uint32_t subscription_identifier, time_t now)
|
||||
static int retain__process(struct mosquitto_db *db, struct mosquitto__subhier *branch, struct mosquitto *context, int sub_qos, uint32_t subscription_identifier, time_t now)
|
||||
{
|
||||
int rc = 0;
|
||||
int qos;
|
||||
@ -750,7 +750,7 @@ static int retain__search(struct mosquitto_db *db, struct mosquitto__subhier *su
|
||||
*/
|
||||
flag = -1;
|
||||
if(branch->retained){
|
||||
retain__process(db, branch, context, sub, sub_qos, subscription_identifier, now);
|
||||
retain__process(db, branch, context, sub_qos, subscription_identifier, now);
|
||||
}
|
||||
if(branch->children){
|
||||
retain__search(db, branch, tokens, context, sub, sub_qos, subscription_identifier, now, level+1);
|
||||
@ -763,12 +763,12 @@ static int retain__search(struct mosquitto_db *db, struct mosquitto__subhier *su
|
||||
|| (!branch_tmp && tokens->next && !strcmp(tokens->next->topic, "#") && level>0)){
|
||||
|
||||
if(branch->retained){
|
||||
retain__process(db, branch, context, sub, sub_qos, subscription_identifier, now);
|
||||
retain__process(db, branch, context, sub_qos, subscription_identifier, now);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(branch->retained){
|
||||
retain__process(db, branch, context, sub, sub_qos, subscription_identifier, now);
|
||||
retain__process(db, branch, context, sub_qos, subscription_identifier, now);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user