FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 07-05-2011, 01:35 PM
Florian Pritz
 
Default check if keyring is readable

If we can't read the keyring, gpgme will output confusing debug
information and fail to verify the signature, so we should warn the user before.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
---
lib/libalpm/signing.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
index 1ac9963..19d3454 100644
--- a/lib/libalpm/signing.c
+++ b/lib/libalpm/signing.c
@@ -110,6 +110,8 @@ static int init_gpgme(alpm_handle_t *handle)
const char *version, *sigdir;
gpgme_error_t err;
gpgme_engine_info_t enginfo;
+ const char *needed_files[] = {"secring.gpg", "trustdb.gpg", "gpg.conf", NULL};
+ int i = 0;

if(init) {
/* we already successfully initialized the library */
@@ -121,6 +123,21 @@ static int init_gpgme(alpm_handle_t *handle)
RET_ERR(handle, ALPM_ERR_SIG_MISSINGDIR, 1);
}

+ i = 0;
+ while (needed_files[i] != NULL) {
+ char *check_path = NULL;
+ size_t len = strlen(sigdir) + strlen(needed_files[i]) + 1;
+
+ CALLOC(check_path, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
+ snprintf(check_path, len, "%s%s", sigdir, needed_files[i]);
+
+ if(access(check_path, R_OK) != 0) {
+ _alpm_log(handle, ALPM_LOG_WARNING, _(""%s" not readable. Signature verification will likely fail!
"), check_path);
+ }
+ i++;
+ }
+
+
/* calling gpgme_check_version() returns the current version and runs
* some internal library setup code */
version = gpgme_check_version(NULL);
--
1.7.6
 

Thread Tools




All times are GMT. The time now is 07:28 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org