Applying Ingo's patch: Makes signatureCertificateDaysLeftToExpiry() and receiverCertificateDaysLeftToExpiry() handle the case that a certificate _never_ expires correctly.

This commit is contained in:
Karl-Heinz Zimmer 2002-09-29 21:14:16 +00:00
parent e9f9833e05
commit f9a1d51756

View File

@ -557,6 +557,7 @@ int signatureCertificateDaysLeftToExpiry( const char* certificate )
if ( GPGME_No_Error == err ) {
time_t expire_time = gpgme_key_get_ulong_attr(
rKey, GPGME_ATTR_EXPIRE, NULL, 0 );
if ( 0 != expire_time ) {
time_t cur_time = time (NULL);
if( cur_time > expire_time ) {
daysLeft = days_from_seconds(cur_time - expire_time);
@ -564,6 +565,7 @@ int signatureCertificateDaysLeftToExpiry( const char* certificate )
}
else
daysLeft = days_from_seconds(expire_time - cur_time);
}
gpgme_key_release( rKey );
}
}
@ -847,6 +849,7 @@ int receiverCertificateDaysLeftToExpiry( const char* certificate )
if ( GPGME_No_Error == err ) {
time_t expire_time = gpgme_key_get_ulong_attr(
rKey,GPGME_ATTR_EXPIRE, NULL, 0 );
if ( 0 != expire_time ) {
time_t cur_time = time (NULL);
if( cur_time > expire_time ) {
daysLeft = days_from_seconds(cur_time - expire_time);
@ -854,6 +857,7 @@ int receiverCertificateDaysLeftToExpiry( const char* certificate )
}
else
daysLeft = days_from_seconds(expire_time - cur_time);
}
gpgme_key_release( rKey );
}
}