#1019 Fix restore-image legacy string parser

UMA reports that the restore image command (in queue mode) does not work,
the non-queue mode works fine though.

WebConsole stores queued commands in the database using the deprecated
SocketHidra legacy string format and ogServer parses them with sscanf().
The restore-image command has the field "ptc" which stores a string
with whitespaces, however, ogServer expects no whitespaces ("%s").

Update parser to read until carriage return, whitespaces included.
master
Javier Sánchez Parra 2021-02-05 11:19:41 +01:00 committed by OpenGnSys Support Team
parent f3905fe0f9
commit 0e4857a538
1 changed files with 2 additions and 1 deletions

View File

@ -2344,7 +2344,8 @@ static int og_cmd_legacy_image_restore(const char *input, struct og_cmd *cmd)
struct og_image_legacy img = {};
if (sscanf(input,
"dsk=%s\rpar=%s\ridi=%s\rnci=%s\ripr=%s\rifs=%s\rptc=%s\r",
"dsk=%s\rpar=%s\ridi=%s\rnci=%s\r"
"ipr=%s\rifs=%s\rptc=%[^\r]\r",
img.disk, img.part, img.image_id, img.name, img.repo,
software_id_str, restore_type_str) != 7)
return -1;