From 6595f080e1f333558043c03da1911b91b2658e74 Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Wed, 10 Mar 2021 15:59:55 -0600 Subject: [PATCH] hx509: Fix hxtool building w/o ASN.1 templating --- lib/hx509/Makefile.am | 4 ++++ lib/hx509/hxtool.c | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/lib/hx509/Makefile.am b/lib/hx509/Makefile.am index decf97162..5120b35e9 100644 --- a/lib/hx509/Makefile.am +++ b/lib/hx509/Makefile.am @@ -110,6 +110,10 @@ hxtool_LDADD = \ $(LIB_roken) \ $(top_builddir)/lib/sl/libsl.la +if ASN1_TEMPLATING +hxtool_CPPFLAGS = -DASN1_PRINTING_WORKS +endif + CLEANFILES = $(BUILT_SOURCES) sel-gram.c sel-lex.c \ $(TESTS) \ hxtool-commands.c hxtool-commands.h *.tmp \ diff --git a/lib/hx509/hxtool.c b/lib/hx509/hxtool.c index b5284812a..dcda324ea 100644 --- a/lib/hx509/hxtool.c +++ b/lib/hx509/hxtool.c @@ -718,6 +718,7 @@ print_f(hx509_context hxcontext, void *ctx, hx509_cert cert) static int HX509_LIB_CALL print_fjson(hx509_context hxcontext, void *ctx, hx509_cert cert) { +#ifdef ASN1_PRINTING_WORKS const Certificate *c = NULL; char *json = NULL; @@ -730,6 +731,10 @@ print_fjson(hx509_context hxcontext, void *ctx, hx509_cert cert) hx509_err(context, 1, errno, "Could not format certificate as JSON"); free(json); return 0; +#else + err(1, "JSON printing of certificates not supported; try enabling or " + "not disabling ASN.1 templating in Heimdal build configuration"); +#endif }