From 6d628dc1b2106e68d2e5d6aac16a3870d22986ea Mon Sep 17 00:00:00 2001 From: Javier Sánchez Parra Date: Wed, 2 Dec 2020 09:46:24 +0100 Subject: #1010 Fix /software missing body in queued mode ogServer do not send /software parameters to ogClient in queued mode. Add parameters as JSON body. --- src/rest.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/rest.c b/src/rest.c index b208f50..d5b046d 100644 --- a/src/rest.c +++ b/src/rest.c @@ -2272,7 +2272,22 @@ static int og_cmd_legacy_hardware(const char *input, struct og_cmd *cmd) static int og_cmd_legacy_software(const char *input, struct og_cmd *cmd) { - og_cmd_init(cmd, OG_METHOD_GET, OG_CMD_SOFTWARE, NULL); + char part_str[OG_DB_SMALLINT_MAXLEN + 1]; + char disk_str[OG_DB_SMALLINT_MAXLEN + 1]; + json_t *root, *disk, *partition; + + if (sscanf(input, "dsk=%s\rpar=%s\r", disk_str, part_str) != 2) + return -1; + partition = json_string(part_str); + disk = json_string(disk_str); + + root = json_object(); + if (!root) + return -1; + json_object_set_new(root, "partition", partition); + json_object_set_new(root, "disk", disk); + + og_cmd_init(cmd, OG_METHOD_GET, OG_CMD_SOFTWARE, root); return 0; } -- cgit v1.2.3-18-g5258