* @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"
#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 20)
/* test records to resolve */
-#define TEST_DOMAIN_PLUS "www.gads"
-#define TEST_DOMAIN_ZKEY "www2.gads"
-#define TEST_DOMAIN_DNS "www3.gads"
+#define TEST_DOMAIN_PLUS "www.gnu"
+#define TEST_DOMAIN_ZKEY "www2.gnu"
+#define TEST_DOMAIN_DNS "www3.gnu"
#define TEST_IP_PLUS "127.0.0.1"
#define TEST_IP_ZKEY "127.0.0.2"
#define TEST_IP_DNS "131.159.74.67"
-#define TEST_RECORD_CNAME_SERVER "server.gads"
+#define TEST_RECORD_CNAME_SERVER "server.gnu"
#define TEST_RECORD_CNAME_PLUS "server.+"
-#define TEST_RECORD_CNAME_ZKEY "www.188JSUMKEF25GVU8TTV0PBNNN8JVCPUEDFV1UHJJU884JD25V0T0.zkey"
+#define TEST_RECORD_CNAME_ZKEY "www.J7POEUT41A8PBFS7KVVDRF88GBOU4HK8PSU5QKVLVE3R9T91E99G.zkey"
#define TEST_RECORD_CNAME_DNS "gnunet.org"
#define TEST_RECORD_NAME_SERVER "server"
#define TEST_RECORD_NAME_PLUS "www"
#define TEST_RECORD_NAME_ZKEY "www2"
#define TEST_RECORD_NAME_DNS "www3"
-#define KEYFILE_BOB "zonefiles/188JSUMKEF25GVU8TTV0PBNNN8JVCPUEDFV1UHJJU884JD25V0T0.zkey"
+#define KEYFILE_BOB "zonefiles/J7POEUT41A8PBFS7KVVDRF88GBOU4HK8PSU5QKVLVE3R9T91E99G.zkey"
/* Task handle to use to schedule test failure */
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_CNAME)
+ if (rd[i].record_type == GNUNET_DNSPARSER_TYPE_CNAME)
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO, "CNAME: %s\n", rd[i].data);
if (0 == strcmp(rd[i].data, TEST_RECORD_CNAME_SERVER))
if (rd_count == 0)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- "Lookup failed, rp_filtering?\n");
- ok = 2;
- GNUNET_SCHEDULER_shutdown ();
- return;
+ "CNAME to DNS delegation failed. System offline?\n");
}
- ok = 1;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "name: %s\n", (char*)cls);
- for (i=0; i<rd_count; i++)
+ else
{
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, "type: %d\n", rd[i].record_type);
- if (rd[i].record_type == GNUNET_GNS_RECORD_A)
+ ok = 1;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "name: %s\n", (char*)cls);
+ for (i=0; i<rd_count; i++)
{
- 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, "type: %d\n", rd[i].record_type);
+ if (rd[i].record_type == GNUNET_DNSPARSER_TYPE_A)
{
- 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
+ else
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No resolution!\n");
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No resolution!\n");
}
+ }
}
- GNUNET_GNS_lookup (gns_handle, TEST_DOMAIN_PLUS, GNUNET_GNS_RECORD_CNAME,
+ GNUNET_GNS_lookup (gns_handle, TEST_DOMAIN_PLUS, GNUNET_DNSPARSER_TYPE_CNAME,
GNUNET_YES,
NULL,
&on_lookup_result_cname, TEST_DOMAIN_PLUS);
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"type: %d\n", rd[i].record_type);
- if (rd[i].record_type == GNUNET_GNS_RECORD_A)
+ if (rd[i].record_type == GNUNET_DNSPARSER_TYPE_A)
{
memcpy (&a, rd[i].data, sizeof(a));
addr = inet_ntoa(a);
"No resolution!\n");
}
}
- GNUNET_GNS_lookup (gns_handle, TEST_DOMAIN_DNS, GNUNET_GNS_RECORD_A,
+ GNUNET_GNS_lookup (gns_handle, TEST_DOMAIN_DNS, GNUNET_DNSPARSER_TYPE_A,
GNUNET_YES,
NULL,
&on_lookup_result_dns, TEST_DOMAIN_DNS);
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)
+ if (rd[i].record_type == GNUNET_DNSPARSER_TYPE_A)
{
memcpy(&a, rd[i].data, sizeof(a));
addr = inet_ntoa(a);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No resolution!\n");
}
}
- GNUNET_GNS_lookup (gns_handle, TEST_DOMAIN_ZKEY, GNUNET_GNS_RECORD_A,
+ GNUNET_GNS_lookup (gns_handle, TEST_DOMAIN_ZKEY, GNUNET_DNSPARSER_TYPE_A,
GNUNET_YES,
NULL,
&on_lookup_result_zkey, TEST_DOMAIN_ZKEY);
GNUNET_SCHEDULER_shutdown ();
return;
}
- GNUNET_GNS_lookup (gns_handle, TEST_DOMAIN_PLUS, GNUNET_GNS_RECORD_A,
+ GNUNET_GNS_lookup (gns_handle, TEST_DOMAIN_PLUS, GNUNET_DNSPARSER_TYPE_A,
GNUNET_YES,
NULL,
&on_lookup_result_plus, TEST_DOMAIN_PLUS);
const struct GNUNET_CONFIGURATION_Handle *ccfg,
struct GNUNET_TESTING_Peer *peer)
{
- struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded alice_pkey;
- struct GNUNET_CRYPTO_RsaPrivateKey *alice_key;
- struct GNUNET_CRYPTO_RsaPrivateKey *bob_key;
+ struct GNUNET_CRYPTO_EccPublicKey alice_pkey;
+ struct GNUNET_CRYPTO_EccPrivateKey *alice_key;
+ struct GNUNET_CRYPTO_EccPrivateKey *bob_key;
char* alice_keyfile;
struct GNUNET_NAMESTORE_RecordData rd;
const char* ip = TEST_IP_PLUS;
return;
}
- alice_key = GNUNET_CRYPTO_rsa_key_create_from_file (alice_keyfile);
- GNUNET_CRYPTO_rsa_key_get_public (alice_key, &alice_pkey);
+ alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (alice_keyfile);
+ GNUNET_CRYPTO_ecc_key_get_public (alice_key, &alice_pkey);
GNUNET_free(alice_keyfile);
- bob_key = GNUNET_CRYPTO_rsa_key_create_from_file (KEYFILE_BOB);
+ bob_key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE_BOB);
rd.expiration_time = UINT64_MAX;
GNUNET_assert(1 == inet_pton (AF_INET, ip, &web));
rd.record_type = GNUNET_DNSPARSER_TYPE_A;
rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
- GNUNET_NAMESTORE_record_create (namestore_handle,
- alice_key,
- TEST_RECORD_NAME_SERVER,
- &rd,
- NULL,
- NULL);
+ GNUNET_NAMESTORE_record_put_by_authority (namestore_handle,
+ alice_key,
+ TEST_RECORD_NAME_SERVER,
+ 1, &rd,
+ NULL,
+ NULL);
rd.data_size = strlen (TEST_RECORD_CNAME_PLUS);
rd.data = TEST_RECORD_CNAME_PLUS;
- rd.record_type = GNUNET_GNS_RECORD_CNAME;
+ rd.record_type = GNUNET_DNSPARSER_TYPE_CNAME;
- GNUNET_NAMESTORE_record_create (namestore_handle,
- alice_key,
- TEST_RECORD_NAME_PLUS,
- &rd,
- NULL,
- NULL);
+ GNUNET_NAMESTORE_record_put_by_authority (namestore_handle,
+ alice_key,
+ TEST_RECORD_NAME_PLUS,
+ 1, &rd,
+ NULL,
+ NULL);
rd.data_size = strlen (TEST_RECORD_CNAME_ZKEY);
rd.data = TEST_RECORD_CNAME_ZKEY;
- rd.record_type = GNUNET_GNS_RECORD_CNAME;
+ rd.record_type = GNUNET_DNSPARSER_TYPE_CNAME;
- GNUNET_NAMESTORE_record_create (namestore_handle,
- alice_key,
- TEST_RECORD_NAME_ZKEY,
- &rd,
- NULL,
- NULL);
+ GNUNET_NAMESTORE_record_put_by_authority (namestore_handle,
+ alice_key,
+ TEST_RECORD_NAME_ZKEY,
+ 1, &rd,
+ NULL,
+ NULL);
rd.data_size = strlen (TEST_RECORD_CNAME_DNS);
rd.data = TEST_RECORD_CNAME_DNS;
- rd.record_type = GNUNET_GNS_RECORD_CNAME;
+ rd.record_type = GNUNET_DNSPARSER_TYPE_CNAME;
- GNUNET_NAMESTORE_record_create (namestore_handle,
- alice_key,
- TEST_RECORD_NAME_DNS,
- &rd,
- NULL,
- NULL);
+ GNUNET_NAMESTORE_record_put_by_authority (namestore_handle,
+ alice_key,
+ TEST_RECORD_NAME_DNS,
+ 1, &rd,
+ NULL,
+ NULL);
GNUNET_assert(1 == inet_pton (AF_INET, TEST_IP_ZKEY, &web));
rd.data_size = sizeof(struct in_addr);
rd.data = &web;
rd.record_type = GNUNET_DNSPARSER_TYPE_A;
- GNUNET_NAMESTORE_record_create (namestore_handle,
- bob_key,
- TEST_RECORD_NAME_PLUS,
- &rd,
- &commence_testing,
- NULL);
- GNUNET_CRYPTO_rsa_key_free(alice_key);
- GNUNET_CRYPTO_rsa_key_free(bob_key);
+ GNUNET_NAMESTORE_record_put_by_authority (namestore_handle,
+ bob_key,
+ TEST_RECORD_NAME_PLUS,
+ 1, &rd,
+ &commence_testing,
+ NULL);
+ GNUNET_CRYPTO_ecc_key_free(alice_key);
+ GNUNET_CRYPTO_ecc_key_free(bob_key);
}