summaryrefslogtreecommitdiffstats
path: root/src/rest.c
diff options
context:
space:
mode:
authorJavier Sánchez Parra <jsanchez@soleta.eu>2020-12-02 09:46:24 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2020-12-02 14:11:55 +0100
commit6d628dc1b2106e68d2e5d6aac16a3870d22986ea (patch)
treebb88d9a3a5e34550958e629bc7b390478dba2759 /src/rest.c
parent8d914564c852346236fbad13819fdfde6920bb37 (diff)
#1010 Fix /software missing body in queued mode
ogServer do not send /software parameters to ogClient in queued mode. Add parameters as JSON body.
Diffstat (limited to 'src/rest.c')
-rw-r--r--src/rest.c17
1 files changed, 16 insertions, 1 deletions
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;
}