From f67dd0f9038810dbaad6ee8a64cb89625b0aa95f Mon Sep 17 00:00:00 2001 From: Luke Howard Date: Mon, 17 May 2021 09:57:00 +1000 Subject: [PATCH] roken: move Heimdal vis.h extensions to separate header vis.h is not built on platforms (such as macOS) that already have that header, which resulted in prototypes for Heimdal-specific vis.h extensions being absent. Move those prototypes to a separate header, vis-extras.h, which must be explicitly included in order to use the Heimdal extensions. --- lib/asn1/extra.c | 3 ++- lib/asn1/gen_template.c | 1 + lib/asn1/template.c | 1 + lib/hx509/print.c | 1 + lib/roken/Makefile.am | 3 ++- lib/roken/NTMakefile | 1 + lib/roken/vis-extras.h | 27 +++++++++++++++++++++++++++ lib/roken/vis.c | 2 ++ lib/roken/vis.hin | 8 -------- 9 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 lib/roken/vis-extras.h diff --git a/lib/asn1/extra.c b/lib/asn1/extra.c index 9e04723a0..889250124 100644 --- a/lib/asn1/extra.c +++ b/lib/asn1/extra.c @@ -35,7 +35,8 @@ #include "der_locl.h" #include "heim_asn1.h" -#include "vis.h" +#include +#include RCSID("$Id$"); diff --git a/lib/asn1/gen_template.c b/lib/asn1/gen_template.c index 87e0ce60b..147bf7156 100644 --- a/lib/asn1/gen_template.c +++ b/lib/asn1/gen_template.c @@ -41,6 +41,7 @@ #include "gen_locl.h" #include +#include static const char *symbol_name(const char *, const Type *); static void generate_template_type(const char *, const char **, const char *, const char *, const char *, diff --git a/lib/asn1/template.c b/lib/asn1/template.c index 78881648b..27f4300ee 100644 --- a/lib/asn1/template.c +++ b/lib/asn1/template.c @@ -36,6 +36,7 @@ #include "der_locl.h" #include #include +#include struct asn1_type_func asn1_template_prim[A1T_NUM_ENTRY] = { #define el(name, type) { \ diff --git a/lib/hx509/print.c b/lib/hx509/print.c index 386f1cc33..544001ebc 100644 --- a/lib/hx509/print.c +++ b/lib/hx509/print.c @@ -33,6 +33,7 @@ #include "hx_locl.h" #include +#include /** * @page page_print Hx509 printing functions diff --git a/lib/roken/Makefile.am b/lib/roken/Makefile.am index 9e837b538..85900300f 100644 --- a/lib/roken/Makefile.am +++ b/lib/roken/Makefile.am @@ -89,7 +89,7 @@ else vis_h = vis.h endif -rkvis_SOURCES = vis.c $(vis_h) +rkvis_SOURCES = vis.c $(vis_h) vis-extras.h rkvis_CPPFLAGS = -DTEST rkbase32_SOURCES = base32.c @@ -179,6 +179,7 @@ libroken_la_SOURCES = \ unvis.c \ vis.c \ $(vis_h) \ + vis-extras.h \ warnerr.c \ write_pid.c \ xfree.c \ diff --git a/lib/roken/NTMakefile b/lib/roken/NTMakefile index 6e33d1f06..3a451399f 100644 --- a/lib/roken/NTMakefile +++ b/lib/roken/NTMakefile @@ -179,6 +179,7 @@ INCFILES = \ $(INCDIR)\stdbool.h \ $(INCDIR)\syslog.h \ $(INCDIR)\vis.h \ + $(INCDIR)\vis-extras.h \ !ifndef HAVE_STDINT_H $(INCDIR)\stdint.h \ !endif diff --git a/lib/roken/vis-extras.h b/lib/roken/vis-extras.h new file mode 100644 index 000000000..693edf828 --- /dev/null +++ b/lib/roken/vis-extras.h @@ -0,0 +1,27 @@ +#ifndef _VIS_EXTRAS_H_ +#define _VIS_EXTRAS_H_ + +#include + +ROKEN_CPP_START + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL + rk_strasvis(char **, const char *, int, const char *); + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL + rk_strasvisx(char **, const char *, size_t, int, const char *); + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL + rk_strrasvis(char **, size_t *, const char *, int, const char *); + +ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL + rk_strrasvisx(char **, size_t *, const char *, size_t, int, const char *); + +ROKEN_CPP_END + +#define strasvis(a, b, c, d) rk_strasvis(a, b, c, d) +#define strasvisx(a, b, c, d) rk_strasvisx(a, b, c, d) +#define strrasvis(a, b, c, d) rk_strrasvis(a, b, c, d) +#define strrasvisx(a, b, c, d) rk_strrasvisx(a, b, c, d) + +#endif /* !_VIS_EXTRAS_H_ */ diff --git a/lib/roken/vis.c b/lib/roken/vis.c index e93021e4c..c598967fb 100644 --- a/lib/roken/vis.c +++ b/lib/roken/vis.c @@ -396,6 +396,8 @@ rk_strsvisx(char *dst, const char *csrc, size_t len, int flag, const char *extra * buffer as needed. Based on OpenBSD's stravis(). */ +#include + ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strasvis(char **out, const char *csrc, int flag, const char *extra) { diff --git a/lib/roken/vis.hin b/lib/roken/vis.hin index 43f6c1f0a..f1027f524 100644 --- a/lib/roken/vis.hin +++ b/lib/roken/vis.hin @@ -117,14 +117,6 @@ ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strvisx(char *, const char *, size_t, int); ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strsvisx(char *, const char *, size_t, int, const char *); -ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL - rk_strasvis(char **, const char *, int, const char *); -ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL - rk_strasvisx(char **, const char *, size_t, int, const char *); -ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL - rk_strrasvis(char **, size_t *, const char *, int, const char *); -ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL - rk_strrasvisx(char **, size_t *, const char *, size_t, int, const char *); ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL rk_strunvis(char *, const char *); ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL