From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 9DF59138334 for ; Thu, 6 Jun 2019 08:14:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8BE37E08C8; Thu, 6 Jun 2019 08:14:05 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7166CE08C8 for ; Thu, 6 Jun 2019 08:14:05 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 9C5DA3457F2 for ; Thu, 6 Jun 2019 08:14:03 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 23F9D566 for ; Thu, 6 Jun 2019 08:14:01 +0000 (UTC) From: "Fabian Groffen" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" Message-ID: <1559808648.0ccae5a9f063ed2dc112340e70f4593d696aa0a5.grobian@gentoo> Subject: [gentoo-commits] proj/portage-utils:master commit in: / X-VCS-Repository: proj/portage-utils X-VCS-Files: TODO.md qmanifest.c X-VCS-Directories: / X-VCS-Committer: grobian X-VCS-Committer-Name: Fabian Groffen X-VCS-Revision: 0ccae5a9f063ed2dc112340e70f4593d696aa0a5 X-VCS-Branch: master Date: Thu, 6 Jun 2019 08:14:01 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: da37f8fb-b5dc-491c-8b2b-1a22766ebac0 X-Archives-Hash: 7cdac0c56c59c15c64b1ddf272f918e2 commit: 0ccae5a9f063ed2dc112340e70f4593d696aa0a5 Author: Fabian Groffen gentoo org> AuthorDate: Thu Jun 6 08:10:48 2019 +0000 Commit: Fabian Groffen gentoo org> CommitDate: Thu Jun 6 08:10:48 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=0ccae5a9 qmanifest: improve verification error descriptions try and report fingerprint being checked (which can be copy/pasted into gpg --list-keys) and use gpgme_strerror in case we don't handle the specific error, such that we still throw a possible hint at the user Signed-off-by: Fabian Groffen gentoo.org> TODO.md | 1 + qmanifest.c | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index 14bd6eb..61f1c98 100644 --- a/TODO.md +++ b/TODO.md @@ -90,6 +90,7 @@ # qmanifest - use openat in most places +- parse timestamps and print in local timezone # qlop - guestimate runtime based on best-matching pkg (e.g. with gcc) diff --git a/qmanifest.c b/qmanifest.c index 541ab34..551f54c 100644 --- a/qmanifest.c +++ b/qmanifest.c @@ -899,13 +899,18 @@ verify_gpg_sig(const char *path, verify_msg **msgs) if ((sig = vres->signatures) != NULL) { ret = xmalloc(sizeof(gpg_sig)); - if (sig->status != GPG_ERR_NO_PUBKEY) { - ret->algo = xstrdup(gpgme_pubkey_algo_name(sig->pubkey_algo)); + if (sig->fpr != NULL) { snprintf(buf, sizeof(buf), "%.4s %.4s %.4s %.4s %.4s %.4s %.4s %.4s %.4s %.4s", sig->fpr + 0, sig->fpr + 4, sig->fpr + 8, sig->fpr + 12, sig->fpr + 16, sig->fpr + 20, sig->fpr + 24, sig->fpr + 28, sig->fpr + 32, sig->fpr + 36); + } else { + snprintf(buf, sizeof(buf), ""); + } + + if (sig->status != GPG_ERR_NO_PUBKEY) { + ret->algo = xstrdup(gpgme_pubkey_algo_name(sig->pubkey_algo)); ret->fingerprint = xstrdup(buf); ret->isgood = sig->status == GPG_ERR_NO_ERROR ? 1 : 0; ctime = gmtime((time_t *)&sig->timestamp); @@ -955,13 +960,14 @@ verify_gpg_sig(const char *path, verify_msg **msgs) free(ret); ret = NULL; printf("the signature could not be verified due to a " - "missing key\n"); + "missing key for:\n %s", buf); break; default: free(ret); ret = NULL; - printf("there was some other error which prevented the " - "signature verification\n"); + printf("there was some error which prevented the " + "signature verification:\n %s: %s\n", + buf, gpgme_strerror(sig->status)); break; } }