From: Alberto Leiva Popper Date: Sat, 16 Mar 2019 03:01:53 +0000 (-0600) Subject: Patch small bugs found while documenting X-Git-Tag: v0.0.2~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36106000413e9539a4b7f92a27f58cd4dd08ddec;p=thirdparty%2FFORT-validator.git Patch small bugs found while documenting --- diff --git a/src/crypto/hash.c b/src/crypto/hash.c index a61aa174..31736b90 100644 --- a/src/crypto/hash.c +++ b/src/crypto/hash.c @@ -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; } diff --git a/src/object/manifest.c b/src/object/manifest.c index 2060afc2..8ad79662 100644 --- a/src/object/manifest.c +++ b/src/object/manifest.c @@ -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: diff --git a/src/rsync/rsync.c b/src/rsync/rsync.c index 851c01c0..515293d6 100644 --- a/src/rsync/rsync.c +++ b/src/rsync/rsync.c @@ -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"); }