* gpgmeplug.c: new macro days_to_seconds().
authorBernhard Reiter <bernhard.reiter@intevation.de>
Fri, 28 Jun 2002 14:51:12 +0000 (14:51 +0000)
committerBernhard Reiter <bernhard.reiter@intevation.de>
Fri, 28 Jun 2002 14:51:12 +0000 (14:51 +0000)
this also fixes the dividing factor.
(signatureCertificateDaysLeftToExpiry)
        (preceiverCertificateDaysLeftToExpiry): using the new macro

(caCertificateDaysLeftToExpiry)
(rootCertificateDaysLeftToExpiry): using new macro in deactivated code.

gpgmeplug/ChangeLog
gpgmeplug/gpgmeplug.c

index 86a8d88e78f42acb144105e1d4ec609825c725a0..3ff7ce1a8928f3843fd8cad1696226a0e2450371 100644 (file)
@@ -1,3 +1,14 @@
+2002-06-28  Bernhard Reiter <bernhard@intevation.de>
+
+       * gpgmeplug.c: new macro days_to_seconds().
+       this also fixes the dividing factor.
+       (signatureCertificateDaysLeftToExpiry) 
+        (preceiverCertificateDaysLeftToExpiry): using the new macro
+
+       (caCertificateDaysLeftToExpiry)  
+       (rootCertificateDaysLeftToExpiry): using new macro in deactivated code.
+
+
 2002-06-27  Steffen Hansen  <steffen@hrhansen.dk>
 
        * gpgmeplug.c: Fixed pattern related bug.
index c30f4518ecd720caa74c55aa1576434b3f7adc7e..56284cc555021de267c185c798ddc458e5a4423f 100644 (file)
 #include "cryptplug.h"
 
 
+#define days_from_seconds(x) ((x)/86400)
+
+
 typedef struct {
   const char*             bugURL;
   const char*             signatureKeyCertificate;
@@ -512,9 +515,7 @@ int signatureCertificateDaysLeftToExpiry( const char* certificate )
       time_t expire_time = gpgme_key_get_ulong_attr(
                              rKey,GPGME_ATTR_EXPIRE, NULL, 0 );
       time_t cur_time = time (NULL);
-      daysLeft = expire_time - cur_time;
-      // convert seconds into days
-      daysLeft /= 43200;
+      daysLeft = days_from_seconds(expire_time - cur_time);
       gpgme_key_release( rKey );
     }
   }
@@ -576,9 +577,7 @@ int caCertificateDaysLeftToExpiry( const char* certificate )
                              
                              NULL, 0 );
       time_t cur_time = time (NULL);
-      daysLeft = expire_time - cur_time;
-      // convert seconds into days
-      daysLeft /= 43200;
+      daysLeft = days_from_seconds(expire_time - cur_time);
       gpgme_key_release( rKey );
     }
   }
@@ -640,9 +639,7 @@ int rootCertificateDaysLeftToExpiry( const char* certificate )
                              
                              NULL, 0 );
       time_t cur_time = time (NULL);
-      daysLeft = expire_time - cur_time;
-      // convert seconds into days
-      daysLeft /= 43200;
+      daysLeft = days_from_seconds(expire_time - cur_time);
       gpgme_key_release( rKey );
     }
   }
@@ -803,9 +800,7 @@ int receiverCertificateDaysLeftToExpiry( const char* certificate )
       time_t expire_time = gpgme_key_get_ulong_attr(
                              rKey,GPGME_ATTR_EXPIRE, NULL, 0 );
       time_t cur_time = time (NULL);
-      daysLeft = expire_time - cur_time;
-      // convert seconds into days
-      daysLeft /= 43200;
+      daysLeft = days_from_seconds(expire_time - cur_time);
       gpgme_key_release( rKey );
     }
   }