auth method needs persisting.

pull/2438/head
Roger A. Light 4 years ago
parent 0db28fe3a1
commit 68fbb7b5bb

@ -215,9 +215,11 @@ struct mosquitto_evt_persist_restore {
struct mosquitto_evt_persist_client {
const char *client_id;
const char *username;
const char *auth_method;
const struct mosquitto_message_v5 *will;
char *plugin_client_id;
char *plugin_username;
char *plugin_auth_method;
struct mosquitto_message_v5 *plugin_will;
time_t will_delay_time; /* update */
time_t session_expiry_time; /* update */

@ -57,6 +57,7 @@ void plugin_persist__handle_client_add(struct mosquitto *context)
memset(&event_data, 0, sizeof(event_data));
event_data.client_id = context->id;
event_data.username = context->username;
event_data.auth_method = context->auth_method;
event_data.will_delay_time = context->will_delay_time;
event_data.session_expiry_time = context->session_expiry_time;
event_data.will_delay_interval = context->will_delay_interval;
@ -88,6 +89,7 @@ void plugin_persist__handle_client_update(struct mosquitto *context)
memset(&event_data, 0, sizeof(event_data));
event_data.client_id = context->id;
event_data.username = context->username;
event_data.auth_method = context->auth_method;
event_data.will_delay_time = context->will_delay_time;
event_data.session_expiry_time = context->session_expiry_time;
event_data.will_delay_interval = context->will_delay_interval;

@ -413,6 +413,17 @@ int mosquitto_persist_client_add(const struct mosquitto_evt_persist_client *clie
}else{
context->username = NULL;
}
if(client->auth_method){
context->auth_method = mosquitto__strdup(client->plugin_auth_method);
if(!context->auth_method){
mosquitto__free(context->username);
mosquitto__free(context->id);
mosquitto__free(context);
return MOSQ_ERR_NOMEM;
}
}else{
context->auth_method = NULL;
}
context->clean_start = false;
context->will_delay_time = client->will_delay_time;
context->session_expiry_time = client->session_expiry_time;

Loading…
Cancel
Save