aboutsummaryrefslogtreecommitdiffstats
path: root/src/conftest/conftest.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2010-11-09 11:17:20 +0100
committerMartin Willi <martin@revosec.ch>2011-01-05 16:45:42 +0100
commita60b8928412f6fbe6e6fa0d5f8a68c9f3e96025b (patch)
treea781471d727c7596f24532ebe57cc6a050e9228c /src/conftest/conftest.c
parente5e71e46d9decbfeac85530f3e12d0c4d6b78781 (diff)
downloadstrongswan-a60b8928412f6fbe6e6fa0d5f8a68c9f3e96025b.tar.bz2
strongswan-a60b8928412f6fbe6e6fa0d5f8a68c9f3e96025b.tar.xz
Support hook suffixes to use the same hook multiple times
Diffstat (limited to 'src/conftest/conftest.c')
-rw-r--r--src/conftest/conftest.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/conftest/conftest.c b/src/conftest/conftest.c
index 9be141118..0d610c5b4 100644
--- a/src/conftest/conftest.c
+++ b/src/conftest/conftest.c
@@ -214,19 +214,27 @@ static bool load_keys(settings_t *settings, char *dir)
static bool load_hooks()
{
enumerator_t *enumerator;
- char *name, buf[64];
- hook_t *(*create)(void);
+ char *name, *pos, buf[64];
+ hook_t *(*create)(char*);
hook_t *hook;
enumerator = conftest->test->create_section_enumerator(conftest->test,
"hooks");
while (enumerator->enumerate(enumerator, &name))
{
- snprintf(buf, sizeof(buf), "%s_hook_create", name);
+ pos = strchr(name, '-');
+ if (pos)
+ {
+ snprintf(buf, sizeof(buf), "%.*s_hook_create", pos - name, name);
+ }
+ else
+ {
+ snprintf(buf, sizeof(buf), "%s_hook_create", name);
+ }
create = dlsym(RTLD_DEFAULT, buf);
if (create)
{
- hook = create();
+ hook = create(name);
if (hook)
{
conftest->hooks->insert_last(conftest->hooks, hook);