src: prevent unlinking image to a partition

Fix partition code parse from strng to integer in
og_update_client_disk_info(), forcing a positive partition format
detection every refresh. This caused the unlink of images in every
partition during a refresh command.

Remove image idimagen=0 SQL instruction from software inventory.
Prevent image unlink during a sofware inventory command for a specific
partition.
master
Alejandro Sirgo Rica 2025-01-14 13:09:27 +01:00
parent 41c8dec51c
commit 2daa9cdb36
2 changed files with 2 additions and 2 deletions

View File

@ -673,7 +673,7 @@ static bool og_update_client_disk_info(struct og_dbi *dbi,
partitions[i].size, i + 1, __func__, __LINE__);
return false;
}
if (safe_strtoull(partitions[i].code, &part_code, 32, UINT32_MAX) < 0) {
if (safe_strtoull(partitions[i].code, &part_code, 16, UINT32_MAX) < 0) {
syslog(LOG_ERR, "failed to parse partition code %s for partition %d (%s:%d)\n",
partitions[i].code, i + 1, __func__, __LINE__);
return false;

View File

@ -575,7 +575,7 @@ bool cuestionPerfilSoftware(struct og_dbi *dbi, char *idc, char *ido,
if (idperfilsoftware != nwidperfilsoft) { // No coinciden los perfiles
// Actualiza el identificador del perfil software del ordenador
result = dbi_conn_queryf(dbi->conn,
"UPDATE ordenadores_particiones SET idperfilsoft=%d,idimagen=0"
"UPDATE ordenadores_particiones SET idperfilsoft=%d"
" WHERE idordenador=%s AND numpar=%s", nwidperfilsoft, ido, par);
if (!result) { // Error al insertar
dbi_conn_error(dbi->conn, &msglog);