diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2015-11-08 09:30:39 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2015-11-08 09:30:42 +0100 |
commit | 3a181d85ff9e7abd1819fee87030d8eef96688df (patch) | |
tree | c51faeb4d8253cdc5ed4740bfd2dad621ace7cd1 /src | |
parent | fd309b3c7e8cd34fa7a8de851b8640905d29eb73 (diff) | |
download | gnutls-3a181d85ff9e7abd1819fee87030d8eef96688df.tar.gz |
p11tool: introduced --only-urls option
This option allows printing a compact listing containing only of URLs.
Diffstat (limited to 'src')
-rw-r--r-- | src/certtool-common.h | 2 | ||||
-rw-r--r-- | src/p11tool-args.def | 6 | ||||
-rw-r--r-- | src/p11tool.c | 4 | ||||
-rw-r--r-- | src/pkcs11.c | 9 |
4 files changed, 20 insertions, 1 deletions
diff --git a/src/certtool-common.h b/src/certtool-common.h index 9ada00aa42..1ba6b10fce 100644 --- a/src/certtool-common.h +++ b/src/certtool-common.h @@ -64,6 +64,8 @@ typedef struct common_info { unsigned key_usage; unsigned int batch; + /* when printing PKCS #11 objects, only print urls */ + unsigned int only_urls; unsigned int verbose; } common_info_st; diff --git a/src/p11tool-args.def b/src/p11tool-args.def index 36bb146e56..939c117ecb 100644 --- a/src/p11tool-args.def +++ b/src/p11tool-args.def @@ -416,6 +416,12 @@ flag = { }; flag = { + name = only-urls; + descrip = "Print a compact listing using only the URLs"; + doc = ""; +}; + +flag = { name = batch; descrip = "Disable all interaction with the tool"; doc = "In batch mode there will be no prompts, all parameters need to be specified on command line."; diff --git a/src/p11tool.c b/src/p11tool.c index b647cbbcd9..c21b05922f 100644 --- a/src/p11tool.c +++ b/src/p11tool.c @@ -191,6 +191,10 @@ static void cmd_parser(int argc, char **argv) batch = cinfo.batch = 1; } + if (HAVE_OPT(ONLY_URLS)) { + batch = cinfo.only_urls = 1; + } + if (ENABLED_OPT(INDER) || ENABLED_OPT(INRAW)) cinfo.incert_format = GNUTLS_X509_FMT_DER; else diff --git a/src/pkcs11.c b/src/pkcs11.c index 24edee0be3..e0ede4f56e 100644 --- a/src/pkcs11.c +++ b/src/pkcs11.c @@ -157,7 +157,14 @@ pkcs11_list(FILE * outfile, const char *url, int type, unsigned int flags, exit(1); } - fprintf(outfile, "Object %d:\n\tURL: %s\n", i, output); + if (info->only_urls) { + fprintf(outfile, "%s\n", output); + gnutls_free(output); + continue; + } else { + fprintf(outfile, "Object %d:\n\tURL: %s\n", i, output); + gnutls_free(output); + } otype = gnutls_pkcs11_obj_get_type(crt_list[i]); fprintf(outfile, "\tType: %s\n", |