diff options
author | Roberto Hueso Gómez <rhueso@soleta.eu> | 2020-10-06 14:19:06 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2020-10-06 16:04:17 +0200 |
commit | f537dafa775307255019df9a119c8f81a52607ca (patch) | |
tree | 3b3863f88e514ddbfc5d25be335cdb478a5a0174 /src/client.c | |
parent | 27fbc658293db97775385f6cc54a36bf0d6c454d (diff) |
#941 Use fixed length strings in og_computer and og_dbi_get_computer_info
This patch is a refactor for og_computer and og_dbi_get_computer_info.
It now uses fixed lenght strings to make it more reliable and avoid
errors if the DB is not returning a null ended string.
Diffstat (limited to 'src/client.c')
-rw-r--r-- | src/client.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/src/client.c b/src/client.c index 7c66a38..b475189 100644 --- a/src/client.c +++ b/src/client.c @@ -133,7 +133,6 @@ static int og_resp_hardware(json_t *data, struct og_client *cli) if (!dbi) { syslog(LOG_ERR, "cannot open connection database (%s:%d)\n", __func__, __LINE__); - og_dbi_free_computer_info(&computer); return -1; } @@ -150,7 +149,6 @@ static int og_resp_hardware(json_t *data, struct og_client *cli) res = actualizaHardware(dbi, legacy.hardware, legacy.id, computer.name, legacy.center); og_dbi_close(dbi); - og_dbi_free_computer_info(&computer); if (!res) { syslog(LOG_ERR, "Problem updating client configuration\n"); @@ -203,7 +201,6 @@ static int og_resp_software(json_t *data, struct og_client *cli) if (!dbi) { syslog(LOG_ERR, "cannot open connection database (%s:%d)\n", __func__, __LINE__); - og_dbi_free_computer_info(&computer); return -1; } @@ -221,7 +218,6 @@ static int og_resp_software(json_t *data, struct og_client *cli) res = actualizaSoftware(dbi, legacy.software, legacy.part, legacy.id, computer.name, legacy.center); og_dbi_close(dbi); - og_dbi_free_computer_info(&computer); if (!res) { syslog(LOG_ERR, "Problem updating client configuration\n"); @@ -351,7 +347,6 @@ static int og_resp_refresh(json_t *data, struct og_client *cli) if (!dbi) { syslog(LOG_ERR, "cannot open connection database (%s:%d)\n", __func__, __LINE__); - og_dbi_free_computer_info(&computer); return -1; } @@ -366,19 +361,15 @@ static int og_resp_refresh(json_t *data, struct og_client *cli) if (!res) { syslog(LOG_ERR, "Problem updating client configuration\n"); - og_dbi_free_computer_info(&computer); return -1; } if (!cli->autorun && computer.procedure_id) { cli->autorun = true; - if (og_dbi_queue_autorun(computer.id, computer.procedure_id)) { - og_dbi_free_computer_info(&computer); + if (og_dbi_queue_autorun(computer.id, computer.procedure_id)) return -1; - } } - og_dbi_free_computer_info(&computer); return 0; } @@ -502,12 +493,10 @@ static int og_resp_image_create(json_t *data, struct og_client *cli) computer.name, soft_legacy.center); if (!res) { - og_dbi_free_computer_info(&computer); og_dbi_close(dbi); syslog(LOG_ERR, "Problem updating client configuration\n"); return -1; } - og_dbi_free_computer_info(&computer); res = actualizaCreacionImagen(dbi, img_legacy.image_id, @@ -609,8 +598,6 @@ static int og_resp_image_restore(json_t *data, struct og_client *cli) snprintf(img_legacy.disk, sizeof(img_legacy.disk), "%s", disk); snprintf(soft_legacy.id, sizeof(soft_legacy.id), "%d", computer.id); - og_dbi_free_computer_info(&computer); - res = actualizaRestauracionImagen(dbi, img_legacy.image_id, img_legacy.disk, |