diff options
author | Rob Austein <sra@hactrn.net> | 2008-06-27 15:05:34 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2008-06-27 15:05:34 +0000 |
commit | 0d970dd4abce0fa8b93c89b3f9954b8806661704 (patch) | |
tree | 62dedffddb49954722afbe8a52682cbbbc76b8e4 | |
parent | 3b04b70e3d93a21104d6dad396aedb5c34e0d932 (diff) |
Tighten up EVP_PKEY_cmp() return code check, fix TA installation filename
svn path=/rcynic/rcynic.c; revision=1953
-rw-r--r-- | rcynic/rcynic.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/rcynic/rcynic.c b/rcynic/rcynic.c index fe4b8e8a..9315a3eb 100644 --- a/rcynic/rcynic.c +++ b/rcynic/rcynic.c @@ -2735,7 +2735,8 @@ int main(int argc, char *argv[]) } memcpy(uri, val->value, j); uri[j] = '\0'; - if (!uri_to_filename(uri, path1, sizeof(path1), rc.unauthenticated)) { + if (!uri_to_filename(uri, path1, sizeof(path1), rc.unauthenticated) || + !uri_to_filename(uri, path2, sizeof(path2), rc.authenticated)) { logmsg(&rc, log_usage_err, "Couldn't convert trust anchor URI %s to filename", uri); goto done; } @@ -2754,7 +2755,7 @@ int main(int argc, char *argv[]) logmsg(&rc, log_data_err, "Couldn't read trust anchor %s", path1); if (x && (xpkey = X509_get_pubkey(x)) == NULL) logmsg(&rc, log_data_err, "Couldn't read public key from trust anchor %s", uri); - j = (xpkey && EVP_PKEY_cmp(pkey, xpkey)); + j = (xpkey && EVP_PKEY_cmp(pkey, xpkey) == 1); EVP_PKEY_free(pkey); EVP_PKEY_free(xpkey); if (!j) { @@ -2768,7 +2769,7 @@ int main(int argc, char *argv[]) logmsg(&rc, log_telemetry, "Copying trust anchor %s to %s", path1, path2); - if (!mkdir_maybe(&rc, rc.authenticated) || + if (!mkdir_maybe(&rc, path2) || !(rc.use_links ? ln(path1, path2) : cp(path1, path2))) { logmsg(&rc, log_sys_err, "Couldn't %s trust anchor %s", (rc.use_links ? "link" : "copy"), path1); |