Fix $CONTROL plugin unregistering.
This commit is contained in:
parent
711d24221d
commit
c927446264
@ -110,7 +110,7 @@ int control__register_callback(struct mosquitto_db *db, struct mosquitto__securi
|
||||
#endif
|
||||
}
|
||||
|
||||
int control__unregister_callback(struct mosquitto_db *db, struct mosquitto__callback *cb_base, MOSQ_FUNC_generic_callback cb_func, const char *topic)
|
||||
int control__unregister_callback(struct mosquitto_db *db, struct mosquitto__security_options *opts, MOSQ_FUNC_generic_callback cb_func, const char *topic)
|
||||
{
|
||||
#ifdef WITH_CONTROL
|
||||
struct mosquitto__callback *cb_found;
|
||||
@ -121,9 +121,9 @@ int control__unregister_callback(struct mosquitto_db *db, struct mosquitto__call
|
||||
if(topic_len == 0 || topic_len > 65535) return MOSQ_ERR_INVAL;
|
||||
if(strncmp(topic, "$CONTROL/", strlen("$CONTROL/"))) return MOSQ_ERR_INVAL;
|
||||
|
||||
HASH_FIND(hh, cb_base, topic, topic_len, cb_found);
|
||||
HASH_FIND(hh, opts->plugin_callbacks.control, topic, topic_len, cb_found);
|
||||
if(cb_found){
|
||||
HASH_DELETE(hh, cb_base, cb_found);
|
||||
HASH_DELETE(hh, opts->plugin_callbacks.control, cb_found);
|
||||
mosquitto__free(cb_found->data);
|
||||
mosquitto__free(cb_found);
|
||||
|
||||
|
@ -742,7 +742,7 @@ int control__process(struct mosquitto_db *db, struct mosquitto *context, struct
|
||||
void control__cleanup(struct mosquitto_db *db);
|
||||
#endif
|
||||
int control__register_callback(struct mosquitto_db *db, struct mosquitto__security_options *opts, MOSQ_FUNC_generic_callback cb_func, const char *topic, void *userdata);
|
||||
int control__unregister_callback(struct mosquitto_db *db, struct mosquitto__callback *cb_base, MOSQ_FUNC_generic_callback cb_func, const char *topic);
|
||||
int control__unregister_callback(struct mosquitto_db *db, struct mosquitto__security_options *opts, MOSQ_FUNC_generic_callback cb_func, const char *topic);
|
||||
|
||||
|
||||
/* ============================================================
|
||||
|
@ -245,8 +245,7 @@ int mosquitto_callback_unregister(mosquitto_plugin_id_t *identifier, int event,
|
||||
cb_base = &security_options->plugin_callbacks.ext_auth_continue;
|
||||
break;
|
||||
case MOSQ_EVT_CONTROL:
|
||||
cb_base = &security_options->plugin_callbacks.control;
|
||||
return control__unregister_callback(db, *cb_base, cb_func, data);
|
||||
return control__unregister_callback(db, security_options, cb_func, data);
|
||||
break;
|
||||
case MOSQ_EVT_MESSAGE:
|
||||
cb_base = &security_options->plugin_callbacks.message;
|
||||
|
Loading…
Reference in New Issue
Block a user