/*
* Claws Mail -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 the Claws Mail team
+ * Copyright (C) 1999-2009 the Claws Mail team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
gint i = 0;
gchar *ret;
GString *siginfo;
- gpgme_signature_t sig = status->signatures;
-
+ gpgme_signature_t sig = NULL;
+
siginfo = g_string_sized_new(64);
+ if (status == NULL) {
+ g_string_append_printf(siginfo,
+ _("Error checking signature: no status\n"));
+ goto bail;
+ }
+
+ sig = status->signatures;
+
while (sig) {
gpgme_user_id_t user = NULL;
gpgme_key_t key;
case GPG_ERR_KEY_EXPIRED:
g_string_append_printf(siginfo,
_("Good signature from uid \"%s\" (Validity: %s)\n"),
- uid, get_validity_str(user->validity));
+ uid, get_validity_str(user?user->validity:GPGME_VALIDITY_UNKNOWN));
break;
case GPG_ERR_SIG_EXPIRED:
g_string_append_printf(siginfo,
_("Expired signature from uid \"%s\" (Validity: %s)\n"),
- uid, get_validity_str(user->validity));
+ uid, get_validity_str(user?user->validity:GPGME_VALIDITY_UNKNOWN));
break;
case GPG_ERR_BAD_SIGNATURE:
g_string_append_printf(siginfo,
return NULL;
}
- err = gpgme_data_rewind(plain);
+ err = cm_gpgme_data_rewind(plain);
if (err) {
debug_print("can't seek (%d %d %s)\n", err, errno, strerror(errno));
}
return NULL;
}
- err = gpgme_data_rewind(plain);
+ err = cm_gpgme_data_rewind(plain);
if (err) {
debug_print("can't seek (%d %d %s)\n", err, errno, strerror(errno));
}
do {
err = gpgme_op_keylist_next(ctx, &key);
if (!err && key && key->protocol == gpgme_get_protocol(ctx) &&
- !key->expired && !key->revoked)
+ !key->expired && !key->revoked && !key->disabled)
break;
if (!err && key && key->protocol != gpgme_get_protocol(ctx)) {
debug_print("skipping a key (wrong protocol %d)\n", key->protocol);
gpgme_key_release(key);
}
- if (!err && key && (key->expired || key->revoked)) {
- debug_print("skipping a key (%s)\n", key->expired?"expired":"revoked");
+ if (!err && key && (key->expired || key->revoked || key->disabled)) {
+
+ debug_print("skipping a key");
+ if (key->expired)
+ debug_print(" expired");
+ if (key->revoked)
+ debug_print(" revoked");
+ if (key->disabled)
+ debug_print(" disabled");
+ debug_print("\n");
gpgme_key_release(key);
}
} while (!err);
do {
err = gpgme_op_keylist_next(ctx, &key2);
if (!err && key2 && key2->protocol == gpgme_get_protocol(ctx) &&
- !key2->expired && !key2->revoked)
+ !key2->expired && !key2->revoked && !key2->disabled)
break;
- if (!err && key && key2->protocol != gpgme_get_protocol(ctx)) {
+ if (!err && key2 && key2->protocol != gpgme_get_protocol(ctx)) {
debug_print("skipping a key (wrong protocol %d)\n", key2->protocol);
gpgme_key_release(key2);
}
- if (!err && key && (key2->expired || key2->revoked)) {
- debug_print("skipping a key (%s)\n", key2->expired?"expired":"revoked");
+ if (!err && key2 && (key2->expired || key2->revoked || key2->disabled)) {
+ debug_print("skipping a key");
+ if (key2->expired)
+ debug_print(" expired");
+ if (key2->revoked)
+ debug_print(" revoked");
+ if (key2->disabled)
+ debug_print(" disabled");
+ debug_print("\n");
gpgme_key_release(key2);
}
} while (!err);
return NULL;
/* I know it's deprecated, but we don't compile with _LARGEFILE */
- gpgme_data_rewind(data);
+ cm_gpgme_data_rewind(data);
while ((r = gpgme_data_read(data, buf, BUFSIZ)) > 0) {
result = realloc(result, r + w);
memcpy(result+w, buf, r);
}
return result;
}
+
+gpgme_error_t cm_gpgme_data_rewind(gpgme_data_t dh)
+{
+#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
+ if (gpgme_data_seek(dh, (off_t)0, SEEK_SET) == -1)
+ return gpg_error_from_errno(errno);
+ else
+ return 0;
+#else
+ return gpgme_data_rewind(dh);
+#endif
+}
+
#endif /* USE_GPGME */