From: Sree Harsha Totakura Date: Mon, 2 Jul 2012 21:39:16 +0000 (+0000) Subject: added TESTING_IGNORE_KEYS X-Git-Tag: initial-import-from-subversion-38251~12688 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=cd5d883c4068daff30217ae8ec93ba2fb10a699a;p=oweals%2Fgnunet.git added TESTING_IGNORE_KEYS --- diff --git a/src/testing/test_testing_defaults.conf b/src/testing/test_testing_defaults.conf index a89064f81..0705b2d15 100644 --- a/src/testing/test_testing_defaults.conf +++ b/src/testing/test_testing_defaults.conf @@ -9,6 +9,9 @@ PORT = 2564 PORT = 2565 PLUGINS = tcp +[transport-tcp] +TESTING_IGNORE_KEYS = SOMETHING;KEY1;ACCEPT_FROM; + [arm] PORT = 2566 DEFAULTSERVICES = diff --git a/src/testing/test_testing_portreservation.c b/src/testing/test_testing_portreservation.c index f689f455a..4815d47fd 100644 --- a/src/testing/test_testing_portreservation.c +++ b/src/testing/test_testing_portreservation.c @@ -66,7 +66,7 @@ run (void *cls, char *const *args, const char *cfgfile, GNUNET_assert (old_port1 == new_port1); GNUNET_TESTING_release_port (system, GNUNET_YES, new_port1); GNUNET_TESTING_release_port (system, GNUNET_YES, new_port2); - GNUNET_TESTING_system_destroy (system, GNUNET_NO); + GNUNET_TESTING_system_destroy (system, GNUNET_YES); } diff --git a/src/testing/testing.c b/src/testing/testing.c index bba38ead3..87c432fb1 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -614,12 +614,59 @@ static void update_config_sections (void *cls, const char *section) { - struct UpdateContext *uc = cls; + struct UpdateContext *uc = cls; + char **ikeys; + char *val; + char *ptr; char *orig_allowed_hosts; char *allowed_hosts; + uint16_t ikeys_cnt; + uint16_t key; + + ikeys_cnt = 0; + val = NULL; + if (GNUNET_YES == GNUNET_CONFIGURATION_have_value (uc->cfg, section, + "TESTING_IGNORE_KEYS")) + { + GNUNET_assert + (GNUNET_YES == + GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, + "TESTING_IGNORE_KEYS", &val)); + ptr = val; + for (ikeys_cnt = 0; NULL != (ptr = strstr (ptr, ";")); ikeys_cnt++) + ptr++; + if (0 == ikeys_cnt) + GNUNET_break (0); + else + { + ikeys = GNUNET_malloc ((sizeof (char *)) * ikeys_cnt); + ptr = val; + for (key = 0; key < ikeys_cnt; key++) + { + ikeys[key] = ptr; + ptr = strstr (ptr, ";"); + *ptr = '\0'; + ptr++; + } + } + } + if (0 != ikeys_cnt) + { + for (key = 0; key < ikeys_cnt; key++) + { + if (NULL != strstr (ikeys[key], "ACCEPT_FROM")) + { + GNUNET_free (ikeys); + GNUNET_free (val); + return; + } + } + GNUNET_free (ikeys); + } + GNUNET_free_non_null (val); - if (NULL != strstr (section, "transport-")) - return; + /* if (NULL != strstr (section, "transport-")) */ + /* return; */ if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (uc->cfg, section, "ACCEPT_FROM",