From 866c395dcc617dd3859876e8a63fa7af3f9d0013 Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Fri, 30 Oct 2020 12:35:34 +0000 Subject: [PATCH] Dynsec: Add "disabled" property for getClient/listClients. --- apps/mosquitto_ctrl/dynsec.c | 5 +++++ plugins/dynamic-security/clients.c | 1 + 2 files changed, 6 insertions(+) diff --git a/apps/mosquitto_ctrl/dynsec.c b/apps/mosquitto_ctrl/dynsec.c index 4a458793..ecad6cf7 100644 --- a/apps/mosquitto_ctrl/dynsec.c +++ b/apps/mosquitto_ctrl/dynsec.c @@ -142,6 +142,11 @@ static void print_client(cJSON *j_response) printf("Clientid:\n"); } + jtmp = cJSON_GetObjectItem(j_client, "disabled"); + if(jtmp && cJSON_IsBool(jtmp)){ + printf("Disabled: %s\n", cJSON_IsTrue(jtmp)?"true":"false"); + } + j_array = cJSON_GetObjectItem(j_client, "roles"); if(j_array && cJSON_IsArray(j_array)){ first = true; diff --git a/plugins/dynamic-security/clients.c b/plugins/dynamic-security/clients.c index 0c4bbeb8..05562d6d 100644 --- a/plugins/dynamic-security/clients.c +++ b/plugins/dynamic-security/clients.c @@ -676,6 +676,7 @@ static cJSON *add_client_to_json(struct dynsec__client *client, bool verbose) || (client->clientid && cJSON_AddStringToObject(j_client, "clientid", client->clientid) == NULL) || (client->text_name && cJSON_AddStringToObject(j_client, "textname", client->text_name) == NULL) || (client->text_description && cJSON_AddStringToObject(j_client, "textdescription", client->text_description) == NULL) + || (client->disabled && cJSON_AddBoolToObject(j_client, "disabled", client->disabled) == NULL) ){ cJSON_Delete(j_client);