diff options
Diffstat (limited to 'src/rest.c')
-rw-r--r-- | src/rest.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -1777,6 +1777,10 @@ static int og_cmd_post_client_update(json_t *element, err = og_json_parse_string_copy(value, computer.name, sizeof(computer.name)); + } else if (!strcmp(key, "boot")) { + err = og_json_parse_string_copy(value, + computer.boot, + sizeof(computer.boot)); } else if (!strcmp(key, "mac")) { err = og_json_parse_string_copy(value, computer.mac, @@ -1824,14 +1828,16 @@ static int og_cmd_post_client_update(json_t *element, " inremotepc=%u," " idaula=%u," " nombreordenador='%s'," - " mac='%s'" + " mac='%s'," + " arranque='%s'" " WHERE ip='%s';", computer.serial_number, computer.netdriver, computer.maintenance, computer.netiface, computer.repo_id, computer.netmask, computer.remote, computer.room, computer.name, - computer.mac, computer.ip); + computer.mac, computer.boot, + computer.ip); if (!result) { dbi_conn_error(dbi->conn, &msglog); syslog(LOG_ERR, "failed to update client in database (%s:%d) %s\n", @@ -1841,6 +1847,14 @@ static int og_cmd_post_client_update(json_t *element, } dbi_result_free(result); + + if (og_set_client_mode(dbi, computer.mac, computer.boot)) { + syslog(LOG_ERR, "failed to set client boot mode (%s:%d)\n", + __func__, __LINE__); + og_dbi_close(dbi); + return -1; + } + og_dbi_close(dbi); return 0; } |