From 67d9094665d82da43490789f4cde1f3e48dc4c5f Mon Sep 17 00:00:00 2001 From: "Roland C. Dowdeswell" Date: Thu, 5 Apr 2012 20:20:19 +0100 Subject: [PATCH] Allow hxtool to process multiple --pk-init-principal args. --- lib/hx509/hxtool-commands.in | 2 +- lib/hx509/hxtool.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/hx509/hxtool-commands.in b/lib/hx509/hxtool-commands.in index ab517224e..5df67f874 100644 --- a/lib/hx509/hxtool-commands.in +++ b/lib/hx509/hxtool-commands.in @@ -646,7 +646,7 @@ command = { } option = { long = "pk-init-principal" - type = "string" + type = "strings" help = "PK-INIT principal (for SAN)" } option = { diff --git a/lib/hx509/hxtool.c b/lib/hx509/hxtool.c index 204110b03..ef95af2f9 100644 --- a/lib/hx509/hxtool.c +++ b/lib/hx509/hxtool.c @@ -1692,12 +1692,13 @@ eval_types(hx509_context contextp, } } - if (opt->pk_init_principal_string) { + for (i = 0; i < opt->pk_init_principal_strings.num_strings; i++) { + const char *pk_init_princ = opt->pk_init_principal_strings.strings[i]; + if (!ctopt.pkinit) errx(1, "pk-init principal given but no pk-init oid"); - ret = hx509_ca_tbs_add_san_pkinit(contextp, tbs, - opt->pk_init_principal_string); + ret = hx509_ca_tbs_add_san_pkinit(contextp, tbs, pk_init_princ); if (ret) hx509_err(contextp, 1, ret, "hx509_ca_tbs_add_san_pkinit"); }