[prev in list] [next in list] [prev in thread] [next in thread]
List: kmail-devel
Subject: Bugfix for gpgmeplug
From: Ingo =?iso-8859-15?q?Kl=F6cker?= <kloecker () kde ! org>
Date: 2002-09-28 13:38:57
[Download RAW message or body]
[Attachment #2 (multipart/mixed)]
Hi,
the attached patch makes signatureCertificateDaysLeftToExpiry() and
receiverCertificateDaysLeftToExpiry() handle the case that a
certificate _never_ expires correctly. I was always told that my key
expired 11598 days ago.
BTW, it would be nice if you could implement the following stuff asap
because KDE 3.1 is released approx. a month from now.
=====
bool isEmailInCertificate( const char* email, const char* certificate )
{
/* PENDING(g10) this function should return true if the email
address passed as the first parameter is contained in the
certificate passed as the second parameter, and false
otherwise. This is used to alert the user if his own email
address is not contained in the certificate he uses for
signing.
Note that the parameter email can be anything that is allowed
in a From: line.
Another note: OK, OK, we'll handle that in the MUA. You can
assume that you only get the email address.
*/
return false; /* dummy*/
}
=====
int caCertificateDaysLeftToExpiry( const char* certificate )
{
/* PENDING(g10)
Please return the number of days that are left until the
CA certificate for the certificate specified in the parameter
certificate expires.
*/
...
return 10; /* dummy that triggers a warning in the MUA */
}
=====
int rootCertificateDaysLeftToExpiry( const char* certificate )
{
/* PENDING(g10)
Please return the number of days that are left until the
root certificate for the certificate specified in the parameter
certificate expires.
*/
...
return 10; /* dummy that triggers a warning in the MUA */
}
=====
Regards,
Ingo
["gpgmeplug.c.diff" (text/x-diff)]
? Makefile.in
? gpgmeplug.c.diff
Index: gpgmeplug.c
===================================================================
RCS file: /cvs/gnupg/gpgme/gpgmeplug/gpgmeplug.c,v
retrieving revision 1.108
diff -u -3 -p -r1.108 gpgmeplug.c
--- gpgmeplug.c 20 Sep 2002 11:47:55 -0000 1.108
+++ gpgmeplug.c 28 Sep 2002 13:24:07 -0000
@@ -557,13 +557,15 @@ int signatureCertificateDaysLeftToExpiry
if ( GPGME_No_Error == err ) {
time_t expire_time = gpgme_key_get_ulong_attr(
rKey, GPGME_ATTR_EXPIRE, NULL, 0 );
- time_t cur_time = time (NULL);
- if( cur_time > expire_time ) {
- daysLeft = days_from_seconds(cur_time - expire_time);
- daysLeft *= -1;
+ if ( 0 != expire_time ) {
+ time_t cur_time = time (NULL);
+ if( cur_time > expire_time ) {
+ daysLeft = days_from_seconds(cur_time - expire_time);
+ daysLeft *= -1;
+ }
+ else
+ daysLeft = days_from_seconds(expire_time - cur_time);
}
- else
- daysLeft = days_from_seconds(expire_time - cur_time);
gpgme_key_release( rKey );
}
}
@@ -847,13 +849,15 @@ int receiverCertificateDaysLeftToExpiry(
if ( GPGME_No_Error == err ) {
time_t expire_time = gpgme_key_get_ulong_attr(
rKey,GPGME_ATTR_EXPIRE, NULL, 0 );
- time_t cur_time = time (NULL);
- if( cur_time > expire_time ) {
- daysLeft = days_from_seconds(cur_time - expire_time);
- daysLeft *= -1;
+ if ( 0 != expire_time ) {
+ time_t cur_time = time (NULL);
+ if( cur_time > expire_time ) {
+ daysLeft = days_from_seconds(cur_time - expire_time);
+ daysLeft *= -1;
+ }
+ else
+ daysLeft = days_from_seconds(expire_time - cur_time);
}
- else
- daysLeft = days_from_seconds(expire_time - cur_time);
gpgme_key_release( rKey );
}
}
[Attachment #6 (application/pgp-signature)]
_______________________________________________
KMail Developers mailing list
kmail@mail.kde.org
http://mail.kde.org/mailman/listinfo/kmail
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic