]> git.ipfire.org Git - thirdparty/FORT-validator.git/commitdiff
Patch small bugs found while documenting
authorAlberto Leiva Popper <ydahhrk@gmail.com>
Sat, 16 Mar 2019 03:01:53 +0000 (21:01 -0600)
committerAlberto Leiva Popper <ydahhrk@gmail.com>
Sat, 16 Mar 2019 03:02:49 +0000 (21:02 -0600)
src/crypto/hash.c
src/object/manifest.c
src/rsync/rsync.c

index a61aa1740d09c97ff061642cbc56f3f14aae7a12..31736b90de9be8b64bc7a9de7dcdc122216f3b59 100644 (file)
@@ -134,8 +134,10 @@ hash_validate_file(char const *algorithm, struct rpki_uri const *uri,
        if (error)
                return error;
 
-       if (!hash_matches(expected->buf, expected->size, actual, actual_len))
-               return pr_err("File does not match its hash.");
+       if (!hash_matches(expected->buf, expected->size, actual, actual_len)) {
+               return pr_err("File '%s' does not match its manifest hash.",
+                   uri_get_printable(uri));
+       }
 
        return 0;
 }
index 2060afc2a13f7ddf04e917bd64aee81b4a22d9d9..8ad79662923fb82317e6cc6ff9f18a7dcf668a2b 100644 (file)
@@ -186,6 +186,12 @@ __handle_manifest(struct manifest *mft, struct rpp **pp)
                } /* Otherwise ownership was transferred to @pp. */
        }
 
+       /* rfc6486#section-7 */
+       if (rpp_get_crl(*pp) == NULL) {
+               error = pr_err("Manifest lacks a CRL.");
+               goto fail;
+       }
+
        return 0;
 
 fail:
index 851c01c0505633d6b0ff3ad4f16023773e8cd66f..515293d67942c59054605ef4a63f4ec1eaf761cf 100644 (file)
@@ -162,19 +162,15 @@ dir_exists(char *path, bool *result)
 
        *last_slash = '\0';
 
-       switch (stat(path, &_stat)) {
-       case 0:
+       if (stat(path, &_stat) == 0) {
                if (!S_ISDIR(_stat.st_mode)) {
                        return pr_err("Path '%s' exists and is not a directory.",
                            path);
                }
-
                *result = true;
-               break;
-       case ENOENT:
+       } else if (errno == ENOENT) {
                *result = false;
-               break;
-       default:
+       } else {
                return pr_errno(errno, "stat() failed");
        }