From: Martin Willi Date: Wed, 28 Jan 2015 17:20:55 +0000 (+0100) Subject: stroke: List loaded CGA parameters in "ipsec listcerts" X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=60bfd95012d1cc9c82ace5331b3f10528fe62b5b;p=thirdparty%2Fstrongswan.git stroke: List loaded CGA parameters in "ipsec listcerts" --- diff --git a/src/libcharon/plugins/stroke/stroke_list.c b/src/libcharon/plugins/stroke/stroke_list.c index 490983100e..bae3c1edd4 100644 --- a/src/libcharon/plugins/stroke/stroke_list.c +++ b/src/libcharon/plugins/stroke/stroke_list.c @@ -881,6 +881,38 @@ static void stroke_list_pgp(linked_list_t *list,bool utc, FILE *out) enumerator->destroy(enumerator); } +/** + * list CGA parameters + */ +static void stroke_list_cga(linked_list_t *list, FILE *out) +{ + enumerator_t *enumerator; + certificate_t *cert; + bool first = TRUE; + + enumerator = list->create_enumerator(list); + while (enumerator->enumerate(enumerator, &cert)) + { + public_key_t *public; + + if (first) + { + fprintf(out, "\n"); + fprintf(out, "List of CGA parameters:\n"); + first = FALSE; + } + fprintf(out, "\n"); + fprintf(out, " CGA: %Y\n", cert->get_subject(cert)); + public = cert->get_public_key(cert); + if (public) + { + list_public_key(public, out); + public->destroy(public); + } + } + enumerator->destroy(enumerator); +} + /** * list all X.509 certificates matching the flags */ @@ -1452,6 +1484,14 @@ METHOD(stroke_list_t, list, void, stroke_list_pgp(pgp_list, msg->list.utc, out); pgp_list->destroy_offset(pgp_list, offsetof(certificate_t, destroy)); } + if (msg->list.flags & LIST_CERTS) + { + linked_list_t *cgas; + + cgas = create_unique_cert_list(CERT_CGA_PARAMS); + stroke_list_cga(cgas, out); + cgas->destroy_offset(cgas, offsetof(certificate_t, destroy)); + } if (msg->list.flags & (LIST_CERTS | LIST_CACERTS | LIST_OCSPCERTS | LIST_AACERTS)) { cert_list = create_unique_cert_list(CERT_X509);