#define VERBOSE GNUNET_YES
/* Timeout for entire testcase */
-#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 5)
+#define TIMEOUT GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 30)
/* If number of peers not in config file, use this number */
#define DEFAULT_NUM_PEERS 2
#define DHT_OPERATION_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30)
+#define KEYFILE_SHORTEN = "zonefiles/188JSUMKEF25GVU8TTV0PBNNN8JVCPUEDFV1UHJJU884JD25V0T0.zkey"
+#define KEYFILE_PRIVATE = "zonefiles/OEFL7A4VEF1B40QLEMTG5D8G1CN6EN16QUSG5R2DT71GRJN34LSG.zkey"
#define KEYFILE_BOB "../namestore/zonefiles/HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"
#define KEYFILE_ALICE "../namestore/zonefiles/N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"shorten test failed! (wanted: %s got: %s\n",
- (char*)cls, sname);
+ TEST_EXPECTED_RESULT, sname);
ok = 1;
}
do_shorten(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
GNUNET_GNS_shorten_zone (gns_handle, TEST_DOMAIN,
- &our_zone,
- &process_shorten_result,
- TEST_DOMAIN);
+ &priv_zone,
+ &short_zone,
+ &our_zone,
+ &process_shorten_result,
+ TEST_DOMAIN);
}
static void
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_TYPE_A)
+ if (rd[i].record_type == GNUNET_GNS_RECORD_A)
{
memcpy(&a, rd[i].data, sizeof(a));
addr = inet_ntoa(a);
GNUNET_CRYPTO_rsa_key_free(bob_key);
GNUNET_CRYPTO_rsa_key_free(alice_key);
+ GNUNET_NAMESTORE_disconnect (namestore_handle);
gns_handle = GNUNET_GNS_connect(cfg);
if (NULL == gns_handle)
GNUNET_GNS_lookup_zone (gns_handle, TEST_DOMAIN,
&our_zone,
- GNUNET_GNS_RECORD_TYPE_A,
+ GNUNET_GNS_RECORD_A,
GNUNET_NO,
short_key,
&on_lookup_result, TEST_DOMAIN);
struct GNUNET_CRYPTO_RsaSignature *sig;
struct GNUNET_NAMESTORE_RecordData rd;
- rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
+ memset (&rd, 0, sizeof (struct GNUNET_NAMESTORE_RecordData));
+ rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value;
rd.data_size = strlen(TEST_PSEU_ALICE)+1;
rd.data = TEST_PSEU_ALICE;
rd.record_type = GNUNET_GNS_RECORD_PSEU;
+ rd.flags = 0;
sig = GNUNET_NAMESTORE_create_signature(alice_key,
- GNUNET_TIME_UNIT_FOREVER_ABS,
- "+",
- &rd, 1);
+ GNUNET_TIME_UNIT_FOREVER_ABS,
+ "+",
+ &rd, 1);
+
+ GNUNET_assert (NULL != sig);
+
+ GNUNET_break (GNUNET_OK == GNUNET_NAMESTORE_verify_signature (&alice_pkey,
+ GNUNET_TIME_UNIT_FOREVER_ABS,
+ "+",
+ 1,
+ &rd,
+ sig));
rd_payload_length = GNUNET_NAMESTORE_records_get_size (1, &rd);
nrb = GNUNET_malloc(rd_payload_length + strlen("+") + 1
+ sizeof(struct GNSNameRecordBlock));
GNUNET_BLOCK_TYPE_GNS_NAMERECORD,
rd_payload_length,
(char*)nrb,
- rd.expiration,
+ GNUNET_TIME_UNIT_FOREVER_ABS,
DHT_OPERATION_TIMEOUT,
&commence_testing,
NULL);
char* ip = TEST_IP;
struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
- rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
+ rd.expiration_time = UINT64_MAX;
GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
rd.data_size = sizeof(struct in_addr);
rd.data = web;
rd.record_type = GNUNET_DNSPARSER_TYPE_A;
-
+ rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
+
sig = GNUNET_NAMESTORE_create_signature(alice_key,
GNUNET_TIME_UNIT_FOREVER_ABS,
TEST_RECORD_NAME,
&rd, 1);
+
+ GNUNET_break (GNUNET_OK == GNUNET_NAMESTORE_verify_signature (&alice_pkey,
+ GNUNET_TIME_UNIT_FOREVER_ABS,
+ TEST_RECORD_NAME,
+ 1,
+ &rd,
+ sig));
rd_payload_length = GNUNET_NAMESTORE_records_get_size (1, &rd);
nrb = GNUNET_malloc(rd_payload_length + strlen(TEST_RECORD_NAME) + 1
+ sizeof(struct GNSNameRecordBlock));
GNUNET_BLOCK_TYPE_GNS_NAMERECORD,
rd_payload_length,
(char*)nrb,
- rd.expiration,
+ GNUNET_TIME_UNIT_FOREVER_ABS,
DHT_OPERATION_TIMEOUT,
&put_pseu_dht,
NULL);
struct GNUNET_CRYPTO_RsaSignature *sig;
struct GNUNET_NAMESTORE_RecordData rd;
- rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
+ rd.expiration_time = UINT64_MAX;
rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
rd.data = &alice_hash;
rd.record_type = GNUNET_GNS_RECORD_PKEY;
-
+ rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
+
sig = GNUNET_NAMESTORE_create_signature(bob_key,
GNUNET_TIME_UNIT_FOREVER_ABS,
TEST_AUTHORITY_ALICE,
GNUNET_BLOCK_TYPE_GNS_NAMERECORD,
rd_payload_length,
(char*)nrb,
- rd.expiration,
+ GNUNET_TIME_UNIT_FOREVER_ABS,
DHT_OPERATION_TIMEOUT,
&put_www_dht,
NULL);
- GNUNET_NAMESTORE_disconnect(namestore_handle, GNUNET_NO);
GNUNET_free (nrb);
}
fin_init_zone (void *cls, int32_t success, const char *emsg)
{
struct GNUNET_NAMESTORE_RecordData rd;
- rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
+ rd.expiration_time = UINT64_MAX;
rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
rd.data = &bob_hash;
rd.record_type = GNUNET_GNS_RECORD_PKEY;
-
+ rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
+
GNUNET_NAMESTORE_record_create (namestore_handle,
our_key,
TEST_AUTHORITY_BOB,
{
struct GNUNET_NAMESTORE_RecordData rd;
- rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
+ rd.expiration_time = UINT64_MAX;
rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
rd.data = &short_zone;
rd.record_type = GNUNET_GNS_RECORD_PKEY;
+ rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
GNUNET_NAMESTORE_record_create (namestore_handle,
priv_key,
GNUNET_CRYPTO_short_hash(&short_pkey, sizeof(short_pkey), &short_zone);
struct GNUNET_NAMESTORE_RecordData rd;
- rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
+ rd.expiration_time = UINT64_MAX;
rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
rd.data = &priv_zone;
rd.record_type = GNUNET_GNS_RECORD_PKEY;
+ rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
GNUNET_NAMESTORE_record_create (namestore_handle,
our_key,