]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
moved chunk_skip_zero to chunk.h
authorAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 3 Apr 2012 12:12:50 +0000 (14:12 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Tue, 3 Apr 2012 12:12:50 +0000 (14:12 +0200)
src/libcharon/plugins/stroke/stroke_list.c
src/libstrongswan/chunk.h
src/pki/commands/print.c

index c056dce238d029e65dd214f928e336c0763afe26..1eaa0b8f71f7ee10af021a1a819ab2083eb595c7 100644 (file)
@@ -833,7 +833,7 @@ static void stroke_list_certs(linked_list_t *list, char *label,
 
                        fprintf(out, "  subject:  \"%Y\"\n", cert->get_subject(cert));
                        fprintf(out, "  issuer:   \"%Y\"\n", cert->get_issuer(cert));
-                       serial = x509->get_serial(x509);
+                       serial = chunk_skip_zero(x509->get_serial(x509));
                        fprintf(out, "  serial:    %#B\n", &serial);
 
                        /* list validity */
@@ -1015,13 +1015,14 @@ static void stroke_list_crls(linked_list_t *list, bool utc, FILE *out)
                fprintf(out, "  issuer:   \"%Y\"\n", cert->get_issuer(cert));
 
                /* list optional crlNumber */
-               chunk = crl->get_serial(crl);
+               chunk = chunk_skip_zero(crl->get_serial(crl));
                if (chunk.ptr)
                {
                        fprintf(out, "  serial:    %#B\n", &chunk);
                }
                if (crl->is_delta_crl(crl, &chunk))
                {
+                       chunk = chunk_skip_zero(chunk);         
                        fprintf(out, "  delta for: %#B\n", &chunk);
                }
 
index 672664874162f4a7382e74d36302628b4a1afc2f..4ff686f80f531334bb8cb037427e9b2096ba570b 100644 (file)
@@ -234,6 +234,24 @@ static inline chunk_t chunk_skip(chunk_t chunk, size_t bytes)
        return chunk_empty;
 }
 
+/**
+ * Skip a leading zero-valued byte
+ */
+static inline chunk_t chunk_skip_zero(chunk_t chunk)
+{
+       if (chunk.len && *chunk.ptr == 0x00)
+       {
+               if (chunk.len == 1)
+               {
+                       return chunk_empty;
+               }
+               chunk.ptr++;
+               chunk.len--;
+       }
+       return chunk;
+}
+
+
 /**
  *  Compare two chunks, returns zero if a equals b
  *  or negative/positive if a is small/greater than b
index 02d0cec17f340c074729ec2d5b6dc88b61142bf0..a7f02bfac443189e691ccb940628223570907d41 100644 (file)
 
 #include <time.h>
 
-/**
- * Print a chunk without leading zero byte
- */
-static chunk_t chunk_skip_zero(chunk_t chunk)
-{
-       if (chunk.len && *chunk.ptr == 0x00)
-       {
-               if (chunk.len == 1)
-               {
-                       return chunk_empty;
-               }
-               chunk.ptr++;
-               chunk.len--;
-       }
-       return chunk;
-}
-
 /**
  * Print public key information
  */