From 29cf8e9ba801bd224240af1181849e0cbe5d1472 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Mon, 6 Jan 2014 10:01:49 +0100 Subject: [PATCH] xbps_repo_open: just call xbps_pubkey2fp() if pubkey is valid (issue #27). --- lib/repo.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/repo.c b/lib/repo.c index 5daeccbc..e6fea96d 100644 --- a/lib/repo.c +++ b/lib/repo.c @@ -163,11 +163,13 @@ xbps_repo_open(struct xbps_handle *xhp, const char *url) goto out; } if ((meta = repo_get_dict(repo))) { - repo->is_signed = true; xbps_dictionary_get_cstring_nocopy(meta, "signature-by", &repo->signedby); - repo->pubkey = xbps_dictionary_get(meta, "public-key"); xbps_dictionary_get_uint16(meta, "public-key-size", &repo->pubkey_size); - repo->hexfp = xbps_pubkey2fp(repo->xhp, repo->pubkey); + repo->pubkey = xbps_dictionary_get(meta, "public-key"); + if (repo->pubkey) { + repo->is_signed = true; + repo->hexfp = xbps_pubkey2fp(repo->xhp, repo->pubkey); + } } out: