summaryrefslogtreecommitdiffstats
path: root/src/rest.c
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2023-11-23 10:17:07 +0100
committerOpenGnSys Support Team <soporte-og@soleta.eu>2023-11-23 10:19:36 +0100
commit9c69f112de52833ea5e723c0235b8c0bcd0d85d8 (patch)
tree41546f222766c3bbec0579face1ea751e116cb00 /src/rest.c
parentfc0f19fe30559f5c9c916789bc8690d13d798d64 (diff)
rest: remove dead code in /repository/add
Remove unused code in this request and do not assume center id.
Diffstat (limited to 'src/rest.c')
-rw-r--r--src/rest.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/src/rest.c b/src/rest.c
index 6b361d5..b479b75 100644
--- a/src/rest.c
+++ b/src/rest.c
@@ -5400,18 +5400,13 @@ static int og_cmd_post_repository_add(json_t *element,
struct og_msg_params *params,
char *buffer_reply)
{
- struct og_buffer og_buffer = {
- .data = buffer_reply,
- };
- struct og_repository repo = {
- .center = 1,
- };
+ struct og_repository repo = {};
const char *key, *msglog;
- json_t *value, *root;
struct in_addr addr;
struct og_dbi *dbi;
dbi_result result;
- int err = 0, id;
+ json_t *value;
+ int err = 0;
json_object_foreach(element, key, value) {
if (!strcmp(key, "name")) {
@@ -5464,25 +5459,6 @@ static int og_cmd_post_repository_add(json_t *element,
return -1;
}
- root = json_object();
- if (!root) {
- syslog(LOG_ERR, "Cannot allocate JSON object (%s:%d)\n",
- __func__, __LINE__);
- dbi_result_free(result);
- og_dbi_close(dbi);
- return -1;
- }
- id = dbi_conn_sequence_last(dbi->conn, NULL);
- json_object_set_new(root, "id", json_integer(id));
- json_object_set_new(root, "ip", json_string(repo.ip));
- json_object_set_new(root, "name", json_string(repo.name));
- json_object_set_new(root, "center", json_integer(repo.center));
- if (json_dump_callback(root, og_json_dump_clients, &og_buffer, 0)) {
- json_decref(root);
- return -1;
- }
-
- json_decref(root);
dbi_result_free(result);
og_dbi_close(dbi);