summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorYves-Alexis Perez <corsac@debian.org>2018-09-24 15:11:14 +0200
committerYves-Alexis Perez <corsac@debian.org>2018-09-24 15:11:14 +0200
commite0e280b7669435b991b7e457abd8aa450930b3e8 (patch)
tree3e6084f13b14ad2df104e2ce6e589eb96c5f7ac9 /scripts
parent51a71ee15c1bcf0e82f363a16898f571e211f9c3 (diff)
downloadvyos-strongswan-e0e280b7669435b991b7e457abd8aa450930b3e8.tar.gz
vyos-strongswan-e0e280b7669435b991b7e457abd8aa450930b3e8.zip
New upstream version 5.7.0
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.in11
-rw-r--r--scripts/settings-test.c106
-rw-r--r--scripts/thread_analysis.c2
3 files changed, 93 insertions, 26 deletions
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index b13d3c5c6..a27f89f5c 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -371,7 +371,6 @@ PYTHON_VERSION = @PYTHON_VERSION@
PY_TEST = @PY_TEST@
RANLIB = @RANLIB@
RTLIB = @RTLIB@
-RUBY = @RUBY@
RUBYGEMDIR = @RUBYGEMDIR@
SED = @SED@
SET_MAKE = @SET_MAKE@
@@ -397,6 +396,8 @@ am__tar = @am__tar@
am__untar = @am__untar@
attest_plugins = @attest_plugins@
bindir = @bindir@
+botan_CFLAGS = @botan_CFLAGS@
+botan_LIBS = @botan_LIBS@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
@@ -417,8 +418,6 @@ dvidir = @dvidir@
exec_prefix = @exec_prefix@
fips_mode = @fips_mode@
fuzz_plugins = @fuzz_plugins@
-gtk_CFLAGS = @gtk_CFLAGS@
-gtk_LIBS = @gtk_LIBS@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -473,8 +472,6 @@ random_device = @random_device@
resolv_conf = @resolv_conf@
routing_table = @routing_table@
routing_table_prio = @routing_table_prio@
-ruby_CFLAGS = @ruby_CFLAGS@
-ruby_LIBS = @ruby_LIBS@
runstatedir = @runstatedir@
s_plugins = @s_plugins@
sbindir = @sbindir@
@@ -503,8 +500,12 @@ top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
tss2_CFLAGS = @tss2_CFLAGS@
tss2_LIBS = @tss2_LIBS@
+tss2_esys_CFLAGS = @tss2_esys_CFLAGS@
+tss2_esys_LIBS = @tss2_esys_LIBS@
tss2_socket_CFLAGS = @tss2_socket_CFLAGS@
tss2_socket_LIBS = @tss2_socket_LIBS@
+tss2_sys_CFLAGS = @tss2_sys_CFLAGS@
+tss2_sys_LIBS = @tss2_sys_LIBS@
tss2_tabrmd_CFLAGS = @tss2_tabrmd_CFLAGS@
tss2_tabrmd_LIBS = @tss2_tabrmd_LIBS@
urandom_device = @urandom_device@
diff --git a/scripts/settings-test.c b/scripts/settings-test.c
index 2169552ac..04637d0a9 100644
--- a/scripts/settings-test.c
+++ b/scripts/settings-test.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Tobias Brunner
+ * Copyright (C) 2014-2018 Tobias Brunner
* HSR Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -29,21 +29,32 @@
bool settings_parser_parse_file(void *this, char *name);
/**
- * Recursively print the section and all subsections/settings
+ * Produce indentation for the given level
*/
-static void print_section(section_t *section, int level)
+static void get_indent(char indent[BUF_LEN], int level)
{
- section_t *sub;
- kv_t *kv;
int i;
- char indent[256];
- for (i = 0; i < level * 2 && i < sizeof(indent) - 2; i += 2)
+ for (i = 0; i < level * 2 && i < BUF_LEN - 2; i += 2)
{
indent[i ] = ' ';
indent[i+1] = ' ';
}
indent[i] = '\0';
+}
+
+/**
+ * Recursively print the section and all subsections/settings
+ */
+static void print_section(section_t *section, int level)
+{
+ section_t *sub;
+ section_ref_t *ref;
+ kv_t *kv;
+ char indent[BUF_LEN];
+ int i, j;
+
+ get_indent(indent, level);
for (i = 0; i < array_count(section->kv_order); i++)
{
@@ -53,12 +64,52 @@ static void print_section(section_t *section, int level)
for (i = 0; i < array_count(section->sections_order); i++)
{
array_get(section->sections_order, i, &sub);
- printf("%s%s {\n", indent, sub->name);
+ printf("%s%s", indent, sub->name);
+ if (array_count(sub->references))
+ {
+ for (j = 0; j < array_count(sub->references); j++)
+ {
+ array_get(sub->references, j, &ref);
+ printf("%s%s", j == 0 ? " : " : ", ", ref->name);
+ }
+ }
+ printf(" {\n");
print_section(sub, level + 1);
printf("%s}\n", indent);
}
}
+/**
+ * Recursively print a given section and all subsections/settings
+ */
+static void print_settings_section(settings_t *settings, char *section,
+ int level)
+{
+ enumerator_t *enumerator;
+ char indent[BUF_LEN], buf[BUF_LEN], *key, *value;
+
+ get_indent(indent, level);
+
+ enumerator = settings->create_key_value_enumerator(settings, section);
+ while (enumerator->enumerate(enumerator, &key, &value))
+ {
+ printf("%s%s = %s\n", indent, key, value);
+
+ }
+ enumerator->destroy(enumerator);
+
+ enumerator = settings->create_section_enumerator(settings, section);
+ while (enumerator->enumerate(enumerator, &key))
+ {
+ printf("%s%s {\n", indent, key);
+ snprintf(buf, sizeof(buf), "%s%s%s", section,
+ strlen(section) ? "." : "", key);
+ print_settings_section(settings, buf, level + 1);
+ printf("%s}\n", indent);
+ }
+ enumerator->destroy(enumerator);
+}
+
static void usage(FILE *out, char *name)
{
fprintf(out, "Test strongswan.conf parser\n\n");
@@ -66,6 +117,7 @@ static void usage(FILE *out, char *name)
fprintf(out, "Options:\n");
fprintf(out, " -h, --help print this help.\n");
fprintf(out, " -d, --debug enables debugging of the parser.\n");
+ fprintf(out, " -r, --resolve displays the settings with references/redefines resolved.\n");
fprintf(out, " -f, --file=FILE config file to load (default STDIN).\n");
fprintf(out, "\n");
}
@@ -73,12 +125,7 @@ static void usage(FILE *out, char *name)
int main(int argc, char *argv[])
{
char *file = NULL;
-
- /* don't load strongswan.conf */
- library_init("", "settings-test");
- atexit(library_deinit);
-
- dbg_default_set_level(3);
+ bool resolve = FALSE;
while (true)
{
@@ -86,9 +133,10 @@ int main(int argc, char *argv[])
{"help", no_argument, NULL, 'h' },
{"debug", no_argument, NULL, 'd' },
{"file", required_argument, NULL, 'f' },
+ {"resolve", no_argument, NULL, 'r' },
{0,0,0,0 },
};
- switch (getopt_long(argc, argv, "hdf:", long_opts, NULL))
+ switch (getopt_long(argc, argv, "hdf:r", long_opts, NULL))
{
case EOF:
break;
@@ -101,6 +149,9 @@ int main(int argc, char *argv[])
case 'f':
file = optarg;
continue;
+ case 'r':
+ resolve = TRUE;
+ continue;
default:
usage(stderr, argv[0]);
return 1;
@@ -108,15 +159,32 @@ int main(int argc, char *argv[])
break;
}
+ /* don't load strongswan.conf */
+ library_init("", "settings-test");
+ atexit(library_deinit);
+
+ dbg_default_set_level(3);
+
if (file)
{
- section_t *root = settings_section_create(strdup("root"));
+ if (resolve)
+ {
+ settings_t *settings = settings_create(file);
+
+ print_settings_section(settings, "", 0);
+
+ settings->destroy(settings);
+ }
+ else
+ {
+ section_t *root = settings_section_create(strdup("root"));
- settings_parser_parse_file(root, file);
+ settings_parser_parse_file(root, file);
- print_section(root, 0);
+ print_section(root, 0);
- settings_section_destroy(root, NULL);
+ settings_section_destroy(root, NULL);
+ }
}
else
{
diff --git a/scripts/thread_analysis.c b/scripts/thread_analysis.c
index 2861431ef..6e4058eee 100644
--- a/scripts/thread_analysis.c
+++ b/scripts/thread_analysis.c
@@ -260,8 +260,6 @@ int main(int argc, char *argv[])
printf(" <p>\n");
printf(" <hr/>\n");
printf(" <em>&copy; 2008\n");
- printf(" <a href=\"http://ita.hsr.ch?&L=1\" target=\"popup\">\n");
- printf(" ITA Institute for Internet Technologies and Applications</a> -\n");
printf(" <a href=\"http://www.hsr.ch/?&L=1\" target=\"popup\">\n");
printf(" HSR Hochschule f&uuml;r Technik Rapperswil</a>\n");
printf(" </em>\n");