]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Mirror the previous commit on the read pipeline
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Tue, 15 Oct 2024 17:24:09 +0000 (11:24 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Tue, 15 Oct 2024 17:24:55 +0000 (11:24 -0600)
src/cache.c
src/rrdp.c

index bd90e0bef6a0bdb3e74427049bb24111fbc79f4d..741e61c40ef820d572098bd6309cc0f1a4e17941 100644 (file)
@@ -259,9 +259,11 @@ json2node(json_t *json)
        if (json_get_str(json, "path", &str))
                goto fail;
        node->map.path = pstrdup(str);
-       if (json_get_int(json, "dlerr", &node->dlerr))
+       error = json_get_int(json, "dlerr", &node->dlerr);
+       if (error != 0 && error != ENOENT)
                goto fail;
-       if (json_get_ts(json, "mtim", &node->mtim))
+       error = json_get_ts(json, "mtim", &node->mtim);
+       if (error != 0 && error != ENOENT)
                goto fail;
        error = json_get_object(json, "rrdp", &rrdp);
        if (error < 0)
index d98eee3093748d3941747cb26e9eb12cbcecf1e7..a42e4c6fcf1726f2a0596130eee922072276ab56 100644 (file)
@@ -1476,20 +1476,14 @@ rrdp_json2state(json_t *json, struct rrdp_state **result)
        STAILQ_INIT(&state->delta_hashes);
 
        error = json_get_str(json, TAGNAME_SESSION, &str);
-       if (error) {
-               if (error > 0)
-                       pr_op_err("Node is missing the '" TAGNAME_SESSION "' tag.");
+       if (error < 0)
                goto revert_notif;
-       }
-       state->session.session_id = pstrdup(str);
+       state->session.session_id = (error == 0) ? pstrdup(str) : NULL;
 
        error = json_get_str(json, TAGNAME_SERIAL, &str);
-       if (error) {
-               if (error > 0)
-                       pr_op_err("Node is missing the '" TAGNAME_SERIAL "' tag.");
+       if (error < 0)
                goto revert_session;
-       }
-       state->session.serial.str = pstrdup(str);
+       state->session.serial.str = (error == 0) ? pstrdup(str) : NULL;
 
        state->session.serial.num = BN_create();
        if (!BN_dec2bn(&state->session.serial.num, state->session.serial.str)) {