summaryrefslogtreecommitdiffstats
path: root/src/client.c
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2023-12-12 16:49:25 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2023-12-12 17:02:44 +0100
commitee09056908bc925d018a5466629872434ac3edf6 (patch)
tree92866106311664e5e0558e83dc9ac101dc3c6cec /src/client.c
parente3b8f3d2f9ea5f1b3ea68c4d5ba862680f7851fa (diff)
client: parse permissions and lastupdate in /image/create response from clientv1.2.5-5
Use permissions and last update from client. update src/schema.c to add a new database version.
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/client.c b/src/client.c
index f2eb865..93bd8f8 100644
--- a/src/client.c
+++ b/src/client.c
@@ -500,7 +500,7 @@ static int og_resp_refresh(json_t *data, struct og_client *cli)
static int update_image_info(struct og_dbi *dbi, const char *image_id,
const char *clonator, const char *compressor,
const char *filesystem, const uint64_t datasize,
- uint64_t size)
+ uint64_t size, uint64_t lastupdate, uint32_t perms)
{
const char *msglog;
dbi_result result;
@@ -508,9 +508,10 @@ static int update_image_info(struct og_dbi *dbi, const char *image_id,
result = dbi_conn_queryf(dbi->conn,
"UPDATE imagenes"
" SET clonator='%s', compressor='%s',"
- " filesystem='%s', datasize=%lld"
+ " filesystem='%s', datasize=%lld, "
+ " size=%lld, lastupdate=%lld, permissions=%u "
" WHERE idimagen=%s", clonator, compressor, filesystem,
- datasize, image_id);
+ datasize, size, lastupdate, perms, image_id);
if (!result) {
dbi_conn_error(dbi->conn, &msglog);
@@ -525,10 +526,10 @@ static int update_image_info(struct og_dbi *dbi, const char *image_id,
static int og_resp_image_create(json_t *data, struct og_client *cli)
{
+ uint64_t datasize = 0, size = 0, lastupdate = 0;
struct og_software_legacy soft_legacy;
struct og_image_legacy img_legacy;
struct og_computer computer = {};
- uint64_t datasize = 0, size = 0;
const char *compressor = NULL;
const char *filesystem = NULL;
const char *partition = NULL;
@@ -539,6 +540,7 @@ static int og_resp_image_create(json_t *data, struct og_client *cli)
const char *code = NULL;
const char *name = NULL;
const char *repo = NULL;
+ uint32_t perms = 0;
struct og_dbi *dbi;
const char *key;
json_t *value;
@@ -573,6 +575,10 @@ static int og_resp_image_create(json_t *data, struct og_client *cli)
err = og_json_parse_uint64(value, &datasize);
else if (!strcmp(key, "size"))
err = og_json_parse_uint64(value, &size);
+ else if (!strcmp(key, "lastupdate"))
+ err = og_json_parse_uint64(value, &lastupdate);
+ else if (!strcmp(key, "perms"))
+ err = og_json_parse_uint(value, &perms);
if (err < 0)
return err;
@@ -636,7 +642,7 @@ static int og_resp_image_create(json_t *data, struct og_client *cli)
}
res = update_image_info(dbi, image_id, clonator, compressor,
- filesystem, datasize, size);
+ filesystem, datasize, size, lastupdate, perms);
og_dbi_close(dbi);
if (res) {