enumerate chain elements in dump output
authorDaniel Golle <daniel@makrotopia.org>
Thu, 7 Jun 2018 12:39:06 +0000 (14:39 +0200)
committerDaniel Golle <daniel@makrotopia.org>
Thu, 14 Jun 2018 16:51:22 +0000 (18:51 +0200)
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This work was sponsored by WIO (wiowireless.com)

ucert.c

diff --git a/ucert.c b/ucert.c
index f4a4b84..4beb499 100644 (file)
--- a/ucert.c
+++ b/ucert.c
@@ -353,14 +353,18 @@ static void cert_dump_blob(struct blob_attr *cert[CERT_ATTR_MAX]) {
 static int cert_dump(const char *certfile) {
        struct cert_object *cobj;
        static LIST_HEAD(certchain);
+       unsigned int count = 0;
 
        if (cert_load(certfile, &certchain)) {
                fprintf(stderr, "cannot parse cert\n");
                return 1;
        }
 
-       list_for_each_entry(cobj, &certchain, list)
+       list_for_each_entry(cobj, &certchain, list) {
+               fprintf(stderr, "=== CHAIN ELEMENT %02u ===\n", ++count);
                cert_dump_blob(cobj->cert);
+               fprintf(stderr, "========================\n");
+       }
 
        return 0;
 }