mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-23 11:46:21 +00:00
Show PGP error strings
This commit is contained in:
@@ -424,12 +424,13 @@ p_gpg_libver(void)
|
||||
}
|
||||
|
||||
gboolean
|
||||
p_gpg_valid_key(const char *const keyid)
|
||||
p_gpg_valid_key(const char *const keyid, char **err_str)
|
||||
{
|
||||
gpgme_ctx_t ctx;
|
||||
gpgme_error_t error = gpgme_new(&ctx);
|
||||
if (error) {
|
||||
log_error("GPG: Failed to create gpgme context. %s %s", gpgme_strsource(error), gpgme_strerror(error));
|
||||
*err_str = strdup(gpgme_strerror(error));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -438,18 +439,21 @@ p_gpg_valid_key(const char *const keyid)
|
||||
|
||||
if (error || key == NULL) {
|
||||
log_error("GPG: Failed to get key. %s %s", gpgme_strsource(error), gpgme_strerror(error));
|
||||
*err_str = strdup(gpgme_strerror(error));
|
||||
gpgme_release(ctx);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (key) {
|
||||
if (key == NULL) {
|
||||
*err_str = strdup("Unknown error");
|
||||
gpgme_release(ctx);
|
||||
gpgme_key_unref(key);
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gpgme_release(ctx);
|
||||
return FALSE;
|
||||
gpgme_key_unref(key);
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
||||
@@ -59,7 +59,7 @@ GHashTable* p_gpg_list_keys(void);
|
||||
void p_gpg_free_keys(GHashTable *keys);
|
||||
gboolean p_gpg_addkey(const char *const jid, const char *const keyid);
|
||||
GHashTable* p_gpg_pubkeys(void);
|
||||
gboolean p_gpg_valid_key(const char *const keyid);
|
||||
gboolean p_gpg_valid_key(const char *const keyid, char **err_str);
|
||||
gboolean p_gpg_available(const char *const barejid);
|
||||
const char* p_gpg_libver(void);
|
||||
char* p_gpg_sign(const char *const str, const char *const fp);
|
||||
|
||||
Reference in New Issue
Block a user