Inform about signature expirations. Gpgme 0.3.10 is now required.

This commit is contained in:
Melvin Hadasht 2002-11-29 14:52:27 +00:00
parent 1ce3011d9f
commit afcba7e66b
5 changed files with 81 additions and 4 deletions

View file

@ -1,3 +1,20 @@
2002-11-29 [melvin] 0.8.6claws36
* configure.in
Increased minimal gpgme version to 0.3.10 (Zombies out)
and to detect signatures expirations (gpgme 0.3.6)
* src/main.c
Use non obsolescent function for Gpgme engine checking.
* src/rfc2015.c
Inform about expired signatures or signatures which key
has expired. Expiration date is displayed.
* src/sigstatus.c
Inform about expired signatures or signatures which key
has expired.
2002-11-28 [paul] 0.8.6claws35
* src/folderview.c

View file

@ -11,7 +11,7 @@ MINOR_VERSION=8
MICRO_VERSION=6
INTERFACE_AGE=0
BINARY_AGE=0
EXTRA_VERSION=claws35
EXTRA_VERSION=claws36
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
@ -130,7 +130,7 @@ AC_ARG_ENABLE(gpgme,
AC_MSG_CHECKING([whether to use GPGME])
if test $ac_cv_enable_gpgme = yes; then
AC_MSG_RESULT(yes)
AM_PATH_GPGME(0.3.5, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP),
AM_PATH_GPGME(0.3.10, AC_DEFINE(USE_GPGME, 1, Define if you use GPGME to support OpenPGP),
[use_gpgme=no ac_cv_enable_gpgme=no])
else
AC_MSG_RESULT(no)

View file

@ -258,7 +258,8 @@ int main(int argc, char *argv[])
#if USE_GPGME
gpg_started = FALSE;
if (gpgme_check_engine()) { /* Also does some gpgme init */
if (gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP) !=
GPGME_No_Error) { /* Also does some gpgme init */
rfc2015_disable_all();
debug_print("gpgme_engine_version:\n%s\n",
gpgme_get_engine_info());

View file

@ -61,7 +61,19 @@ static char *mime_version_name[] = {
NULL
};
static char *create_boundary (void);
static char *create_boundary (void);
static void sig_expiration_check (GString *str,
GpgmeCtx ctx,
GpgmeKey key,
GpgmeSigStat status,
int idx);
static void sig_expired (GString *str,
GpgmeCtx ctx,
int idx);
static void sig_key_expired (GString *str,
GpgmeKey key,
int idx);
#if 0
static void dump_mimeinfo (const char *text, MimeInfo *x)
@ -138,6 +150,12 @@ sig_status_to_string (GpgmeSigStat status)
case GPGME_SIG_STAT_GOOD:
result = _("Good signature");
break;
case GPGME_SIG_STAT_GOOD_EXP:
result = _("Good signature but it has expired");
break;
case GPGME_SIG_STAT_GOOD_EXPKEY:
result = _("Good signature but the key has expired");
break;
case GPGME_SIG_STAT_BAD:
result = _("BAD signature");
break;
@ -173,6 +191,12 @@ sig_status_with_name (GpgmeSigStat status)
case GPGME_SIG_STAT_GOOD:
result = _("Good signature from \"%s\"");
break;
case GPGME_SIG_STAT_GOOD_EXP:
result = _("Good signature from \"%s\" but it has expired");
break;
case GPGME_SIG_STAT_GOOD_EXPKEY:
result = _("Good signature from \"%s\" but the key has expired");
break;
case GPGME_SIG_STAT_BAD:
result = _("BAD signature from \"%s\"");
break;
@ -199,6 +223,7 @@ sig_status_for_key(GString *str, GpgmeCtx ctx, GpgmeSigStat status,
{
gint idx = 0;
const char *uid;
unsigned long exp_time;
uid = gpgme_key_get_string_attr (key, GPGME_ATTR_USERID, NULL, idx);
if (uid == NULL) {
@ -207,6 +232,7 @@ sig_status_for_key(GString *str, GpgmeCtx ctx, GpgmeSigStat status,
if ((fpr != NULL) && (*fpr != '\0'))
g_string_sprintfa (str, "Key fingerprint: %s\n", fpr);
g_string_append (str, _("Cannot find user ID for this key."));
sig_expiration_check(str, ctx, key, status, 0);
return;
}
g_string_sprintfa (str, sig_status_with_name (status), uid);
@ -220,6 +246,33 @@ sig_status_for_key(GString *str, GpgmeCtx ctx, GpgmeSigStat status,
g_string_sprintfa (str, _(" aka \"%s\"\n"),
uid);
}
sig_expiration_check(str, ctx, key, status, 0);
}
static void
sig_expiration_check(GString *str, GpgmeCtx ctx, GpgmeKey key,
GpgmeSigStat status, int idx)
{
if (status == GPGME_SIG_STAT_GOOD_EXP)
sig_expired(str, ctx, idx);
else if (status == GPGME_SIG_STAT_GOOD_EXPKEY)
sig_key_expired(str, key, idx);
}
static void
sig_expired(GString *str, GpgmeCtx ctx, int idx)
{
unsigned long exp_time;
exp_time = gpgme_get_sig_ulong_attr(ctx, idx, GPGME_ATTR_EXPIRE, 0);
g_string_sprintfa(str, _("Signature expired %s"), ctime(&exp_time));
}
static void
sig_key_expired(GString *str, GpgmeKey key, int idx)
{
unsigned long exp_time;
exp_time = gpgme_key_get_ulong_attr(key, GPGME_ATTR_EXPIRE, NULL, idx);
g_string_sprintfa(str, _("Key expired %s"), ctime(&exp_time));
}
static gchar *

View file

@ -224,6 +224,12 @@ const char *gpgmegtk_sig_status_to_string(GpgmeSigStat status)
case GPGME_SIG_STAT_GOOD:
result = _("Good signature");
break;
case GPGME_SIG_STAT_GOOD_EXP:
result = _("Good signature but it has expired");
break;
case GPGME_SIG_STAT_GOOD_EXPKEY:
result = _("Good signature but the key has expired");
break;
case GPGME_SIG_STAT_BAD:
result = _("BAD signature");
break;