From 2a485ca05842d11dd22bbf189a57467aa5c2377c Mon Sep 17 00:00:00 2001 From: Johan Danielsson Date: Tue, 13 Aug 2002 15:04:28 +0000 Subject: [PATCH] add some code to print the read config file git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@11094 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/krb5/verify_krb5_conf.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/lib/krb5/verify_krb5_conf.c b/lib/krb5/verify_krb5_conf.c index 5c8aaba78..026109b3e 100644 --- a/lib/krb5/verify_krb5_conf.c +++ b/lib/krb5/verify_krb5_conf.c @@ -436,6 +436,8 @@ check_section(krb5_context context, const char *path, krb5_config_section *cf, } if(e->name == NULL) { krb5_warnx(context, "%s: unknown entry", local); + for(e = entries; e->name != NULL; e++) + krb5_warnx(context, " %s", e->name); error |= 1; } free(local); @@ -444,6 +446,29 @@ check_section(krb5_context context, const char *path, krb5_config_section *cf, } +static void +dump_config(int level, krb5_config_section *top) +{ + krb5_config_section *x; + for(x = top; x; x = x->next) { + switch(x->type) { + case krb5_config_list: + if(level == 0) { + printf("[%s]\n", x->name); + } else { + printf("%*s%s = {\n", 4 * level, " ", x->name); + } + dump_config(level + 1, x->u.list); + if(level > 0) + printf("%*s}\n", 4 * level); + break; + case krb5_config_string: + printf("%*s%s = %s\n", 4 * level, " ", x->name, x->u.string); + break; + } + } +} + int main(int argc, char **argv) { @@ -452,6 +477,7 @@ main(int argc, char **argv) krb5_error_code ret; krb5_config_section *tmp_cf; int optind = 0; + int dump_config_file = 1; setprogname (argv[0]); @@ -489,5 +515,8 @@ main(int argc, char **argv) return 1; } + if(dump_config_file) + dump_config(0, tmp_cf); + return check_section(context, "", tmp_cf, toplevel_sections); }