[svn] GnuPG - r4953 - in trunk: common sm

svn author wk cvs at cvs.gnupg.org
Mon Mar 16 10:44:45 CET 2009


Author: wk
Date: 2009-03-16 10:44:44 +0100 (Mon, 16 Mar 2009)
New Revision: 4953

Modified:
   trunk/common/ChangeLog
   trunk/common/gettime.c
   trunk/common/util.h
   trunk/sm/ChangeLog
   trunk/sm/certchain.c
   trunk/sm/certdump.c
   trunk/sm/gpgsm.c
   trunk/sm/verify.c
Log:
Remove duplicated code.


Modified: trunk/common/ChangeLog
===================================================================
--- trunk/common/ChangeLog	2009-03-15 03:58:38 UTC (rev 4952)
+++ trunk/common/ChangeLog	2009-03-16 09:44:44 UTC (rev 4953)
@@ -3,6 +3,11 @@
 	* http.c (do_parse_uri): Properly handle IPv6 literal addresses as
 	per RFC-2732.  Adapted from patch by Phil Pennock.
 
+2009-03-12  Werner Koch  <wk at g10code.com>
+
+	* gettime.c: Include i18n.h.
+	(dump_isotime): New.
+
 2009-03-06  Werner Koch  <wk at g10code.com>
 
 	* sexputil.c (make_canon_sexp): New.

Modified: trunk/sm/ChangeLog
===================================================================
--- trunk/sm/ChangeLog	2009-03-15 03:58:38 UTC (rev 4952)
+++ trunk/sm/ChangeLog	2009-03-16 09:44:44 UTC (rev 4953)
@@ -1,3 +1,9 @@
+2009-03-12  Werner Koch  <wk at g10code.com>
+
+	* certdump.c (gpgsm_dump_time): Remove.
+	* certdump.c, verify.c, certchain.c
+	* gpgsm.c: s/gpgsm_dump_time/dump_isotime/.
+
 2009-03-06  Werner Koch  <wk at g10code.com>
 
 	* call-agent.c (gpgsm_agent_keyinfo, keyinfo_status_cb): New.

Modified: trunk/common/gettime.c
===================================================================
--- trunk/common/gettime.c	2009-03-15 03:58:38 UTC (rev 4952)
+++ trunk/common/gettime.c	2009-03-16 09:44:44 UTC (rev 4953)
@@ -26,6 +26,7 @@
 #endif
 
 #include "util.h"
+#include "i18n.h"
 
 static unsigned long timewarp;
 static enum { NORMAL = 0, FROZEN, FUTURE, PAST } timemode;
@@ -495,7 +496,17 @@
 }
 
 
+void
+dump_isotime (const gnupg_isotime_t t)
+{
+  if (!t || !*t)
+    log_printf (_("[none]"));
+  else
+    log_printf ("%.4s-%.2s-%.2s %.2s:%.2s:%s",
+                t, t+4, t+6, t+9, t+11, t+13);
+}
 
+
 /* Add SECONDS to ATIME.  SECONDS may not be negative and is limited
    to about the equivalent of 62 years which should be more then
    enough for our purposes. */

Modified: trunk/common/util.h
===================================================================
--- trunk/common/util.h	2009-03-15 03:58:38 UTC (rev 4952)
+++ trunk/common/util.h	2009-03-16 09:44:44 UTC (rev 4953)
@@ -119,6 +119,7 @@
 gpg_error_t add_seconds_to_isotime (gnupg_isotime_t atime, int nseconds);
 gpg_error_t add_days_to_isotime (gnupg_isotime_t atime, int ndays);
 gpg_error_t check_isotime (const gnupg_isotime_t atime);
+void dump_isotime (const gnupg_isotime_t atime);
 
 /* Copy one ISO date to another, this is inline so that we can do a
    minimal sanity check.  A null date (empty string) is allowed.  */

Modified: trunk/sm/certchain.c
===================================================================
--- trunk/sm/certchain.c	2009-03-15 03:58:38 UTC (rev 4952)
+++ trunk/sm/certchain.c	2009-03-16 09:44:44 UTC (rev 4953)
@@ -979,7 +979,7 @@
       if (!listmode)
         {
           log_info ("  (valid from ");
-          gpgsm_dump_time (not_before);
+          dump_isotime (not_before);
           log_printf (")\n");
         }
       return gpg_error (GPG_ERR_CERT_TOO_YOUNG);
@@ -994,7 +994,7 @@
       if (!listmode)
         {
           log_info ("  (expired at ");
-          gpgsm_dump_time (not_after);
+          dump_isotime (not_after);
           log_printf (")\n");
         }
       if (opt.ignore_expiration)
@@ -1043,9 +1043,9 @@
       do_list (1, listmode, listfp,
                _("certificate with invalid validity"));
       log_info ("  (valid from ");
-      gpgsm_dump_time (not_before);
+      dump_isotime (not_before);
       log_printf (" expired at ");
-      gpgsm_dump_time (not_after);
+      dump_isotime (not_after);
       log_printf (")\n");
       return gpg_error (GPG_ERR_BAD_CERT);
     }
@@ -1064,7 +1064,7 @@
       if (!listmode)
         {
           log_info ("  (valid from ");
-          gpgsm_dump_time (not_before);
+          dump_isotime (not_before);
           log_printf (")\n");
         }
       return gpg_error (GPG_ERR_CERT_TOO_YOUNG);
@@ -1087,13 +1087,13 @@
         {
           log_info (depth== 0? _("  (  signature created at ") :
                     /* */      _("  (certificate created at ") );
-          gpgsm_dump_time (check_time);
+          dump_isotime (check_time);
           log_printf (")\n");
           log_info (depth==0? _("  (certificate valid from ") :
                     /* */     _("  (     issuer valid from ") );
-          gpgsm_dump_time (not_before);
+          dump_isotime (not_before);
           log_info (" to ");
-          gpgsm_dump_time (not_after);
+          dump_isotime (not_after);
           log_printf (")\n");
         }
       if (opt.ignore_expiration)

Modified: trunk/sm/certdump.c
===================================================================
--- trunk/sm/certdump.c	2009-03-15 03:58:38 UTC (rev 4952)
+++ trunk/sm/certdump.c	2009-03-16 09:44:44 UTC (rev 4953)
@@ -148,19 +148,6 @@
 
 
 void
-gpgsm_dump_time (ksba_isotime_t t)
-{
-  if (!t || !*t)
-    log_printf (_("[none]"));
-  else
-    log_printf ("%.4s-%.2s-%.2s %.2s:%.2s:%s",
-                t, t+4, t+6, t+9, t+11, t+13);
-}
-
-
-
-
-void
 gpgsm_dump_string (const char *string)
 {
 
@@ -207,11 +194,11 @@
 
       ksba_cert_get_validity (cert, 0, t);
       log_debug ("  notBefore: ");
-      gpgsm_dump_time (t);
+      dump_isotime (t);
       log_printf ("\n");
       ksba_cert_get_validity (cert, 1, t);
       log_debug ("   notAfter: ");
-      gpgsm_dump_time (t);
+      dump_isotime (t);
       log_printf ("\n");
 
       dn = ksba_cert_get_issuer (cert, 0);

Modified: trunk/sm/gpgsm.c
===================================================================
--- trunk/sm/gpgsm.c	2009-03-15 03:58:38 UTC (rev 4952)
+++ trunk/sm/gpgsm.c	2009-03-16 09:44:44 UTC (rev 4953)
@@ -1405,7 +1405,7 @@
 
       log_info (_("WARNING: running with faked system time: "));
       gnupg_get_isotime (tbuf);
-      gpgsm_dump_time (tbuf);
+      dump_isotime (tbuf);
       log_printf ("\n");
     }
   

Modified: trunk/sm/verify.c
===================================================================
--- trunk/sm/verify.c	2009-03-15 03:58:38 UTC (rev 4952)
+++ trunk/sm/verify.c	2009-03-16 09:44:44 UTC (rev 4953)
@@ -446,7 +446,7 @@
 
       log_info (_("Signature made "));
       if (*sigtime)
-        gpgsm_dump_time (sigtime);
+        dump_isotime (sigtime);
       else
         log_printf (_("[date not given]"));
       log_printf (_(" using certificate ID 0x%08lX\n"),




More information about the Gnupg-commits mailing list