* @author Martin Schanzenbach
*/
#include "platform.h"
-#include "gnunet_testing_lib-new.h"
+#include "gnunet_testing_lib.h"
#include "gnunet_core_service.h"
#include "block_dns.h"
#include "gnunet_signatures.h"
}
-static void
-end_badly_now ()
-{
- GNUNET_SCHEDULER_cancel (die_task);
- die_task = GNUNET_SCHEDULER_add_now (&end_badly, NULL);
-}
-
-
static void
shutdown_task (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
if (rd_count == 0)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Lookup failed, rp_filtering?\n");
- ok = 2;
+ "CNAME to DNS delegation failed. System offline?\n");
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "type: %d\n", rd[i].record_type);
if (rd[i].record_type == GNUNET_GNS_RECORD_A)
{
- memcpy(&a, rd[i].data, sizeof(a));
- addr = inet_ntoa(a);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "address: %s\n", addr);
- if (0 == strcmp(addr, TEST_IP_DNS))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "%s correctly resolved to %s!\n", TEST_DOMAIN_DNS, addr);
- ok = 0;
- }
+ memcpy(&a, rd[i].data, sizeof(a));
+ addr = inet_ntoa(a);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "address: %s\n", addr);
+ if (0 == strcmp(addr, TEST_IP_DNS))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "%s correctly resolved to %s!\n", TEST_DOMAIN_DNS, addr);
+ ok = 0;
+ }
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No resolution!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No resolution!\n");
}
}
}
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Lookup failed, rp_filtering?\n");
ok = 2;
+ GNUNET_SCHEDULER_shutdown ();
+ return;
}
- else
+ ok = 1;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "name: %s\n", (char*)cls);
+ for (i=0; i<rd_count; i++)
{
- ok = 1;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "name: %s\n", (char*)cls);
- for (i=0; i<rd_count; i++)
+ "type: %d\n", rd[i].record_type);
+ if (rd[i].record_type == GNUNET_GNS_RECORD_A)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "type: %d\n", rd[i].record_type);
- if (rd[i].record_type == GNUNET_GNS_RECORD_A)
- {
- memcpy (&a, rd[i].data, sizeof(a));
- addr = inet_ntoa(a);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "address: %s\n", addr);
- if (0 == strcmp (addr, TEST_IP_ZKEY))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "%s correctly resolved to %s!\n",
- TEST_DOMAIN_ZKEY, addr);
- ok = 0;
- }
- }
- else
+ memcpy (&a, rd[i].data, sizeof(a));
+ addr = inet_ntoa(a);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "address: %s\n", addr);
+ if (0 == strcmp (addr, TEST_IP_ZKEY))
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "No resolution!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "%s correctly resolved to %s!\n",
+ TEST_DOMAIN_ZKEY, addr);
+ ok = 0;
}
}
-
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "No resolution!\n");
+ }
+ }
GNUNET_GNS_lookup (gns_handle, TEST_DOMAIN_DNS, GNUNET_GNS_RECORD_A,
GNUNET_YES,
NULL,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Lookup failed, rp_filtering?\n");
ok = 2;
+ GNUNET_SCHEDULER_shutdown ();
+ return;
}
- else
+ ok = 1;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "name: %s\n", (char*)cls);
+ for (i=0; i<rd_count; i++)
{
- ok = 1;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "name: %s\n", (char*)cls);
- for (i=0; i<rd_count; i++)
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "type: %d\n", rd[i].record_type);
+ if (rd[i].record_type == GNUNET_GNS_RECORD_A)
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "type: %d\n", rd[i].record_type);
- if (rd[i].record_type == GNUNET_GNS_RECORD_A)
+ memcpy(&a, rd[i].data, sizeof(a));
+ addr = inet_ntoa(a);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "address: %s\n", addr);
+ if (0 == strcmp(addr, TEST_IP_PLUS))
{
- memcpy(&a, rd[i].data, sizeof(a));
- addr = inet_ntoa(a);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "address: %s\n", addr);
- if (0 == strcmp(addr, TEST_IP_PLUS))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "%s correctly resolved to %s!\n", TEST_DOMAIN_PLUS, addr);
- ok = 0;
- }
- }
- else
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No resolution!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "%s correctly resolved to %s!\n", TEST_DOMAIN_PLUS, addr);
+ ok = 0;
}
}
+ else
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No resolution!\n");
+ }
}
GNUNET_GNS_lookup (gns_handle, TEST_DOMAIN_ZKEY, GNUNET_GNS_RECORD_A,
GNUNET_YES,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to store record in namestore: %s\n",
emsg);
- end_badly_now ();
+ GNUNET_SCHEDULER_shutdown ();
return;
}
gns_handle = GNUNET_GNS_connect(cfg);
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to connect to GNS!\n");
- end_badly_now ();
+ GNUNET_SCHEDULER_shutdown ();
return;
}
GNUNET_GNS_lookup (gns_handle, TEST_DOMAIN_PLUS, GNUNET_GNS_RECORD_A,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to connect to namestore\n");
- end_badly_now ();
+ GNUNET_SCHEDULER_shutdown ();
return;
}
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to get key from cfg\n");
- end_badly_now ();
+ GNUNET_SCHEDULER_shutdown ();
return;
}