aboutsummaryrefslogtreecommitdiff
path: root/src/gns
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2016-10-07 09:43:32 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2016-10-07 09:43:32 +0000
commitb37e89b590b30cb4f650375807d60e1748930ba4 (patch)
tree7ec836c685f90d900241253780ffc21fa7bb23a0 /src/gns
parent014c0a8f67696d36bf27af70537a6a71abaa1653 (diff)
downloadgnunet-b37e89b590b30cb4f650375807d60e1748930ba4.tar.gz
gnunet-b37e89b590b30cb4f650375807d60e1748930ba4.zip
-add reverse autoadd; with test
Diffstat (limited to 'src/gns')
-rw-r--r--src/gns/gnunet-service-gns.c57
-rw-r--r--src/gns/gnunet-service-gns_reverser.c250
-rw-r--r--src/gns/gnunet-service-gns_reverser.h19
-rwxr-xr-xsrc/gns/test_gns_reverse_lookup.sh16
4 files changed, 286 insertions, 56 deletions
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index 221d75bba..3e718dac8 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -301,6 +301,7 @@ shutdown_task (void *cls)
301 identity_handle = NULL; 301 identity_handle = NULL;
302 } 302 }
303 GNS_resolver_done (); 303 GNS_resolver_done ();
304 GNS_reverse_done ();
304 GNS_shorten_done (); 305 GNS_shorten_done ();
305 while (NULL != (ma = ma_head)) 306 while (NULL != (ma = ma_head))
306 { 307 {
@@ -1061,6 +1062,51 @@ handle_monitor_error (void *cls)
1061 NULL); 1062 NULL);
1062} 1063}
1063 1064
1065/**
1066 * Method called to inform about the ego to be used for the master zone
1067 * for DNS interceptions.
1068 *
1069 * This function is only called ONCE, and 'NULL' being passed in
1070 * @a ego does indicate that interception is not configured.
1071 * If @a ego is non-NULL, we should start to intercept DNS queries
1072 * and resolve ".gnu" queries using the given ego as the master zone.
1073 *
1074 * @param cls closure, our `const struct GNUNET_CONFIGURATION_Handle *c`
1075 * @param ego ego handle
1076 * @param ctx context for application to store data for this ego
1077 * (during the lifetime of this process, initially NULL)
1078 * @param name name assigned by the user for this ego,
1079 * NULL if the user just deleted the ego and it
1080 * must thus no longer be used
1081 */
1082static void
1083identity_reverse_cb (void *cls,
1084 struct GNUNET_IDENTITY_Ego *ego,
1085 void **ctx,
1086 const char *name)
1087{
1088 identity_op = NULL;
1089
1090 if (NULL == ego)
1091 {
1092 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1093 _("No ego configured for `%s`\n"),
1094 "gns-master");
1095
1096 return;
1097 }
1098 if (GNUNET_SYSERR ==
1099 GNS_reverse_init (namestore_handle,
1100 GNUNET_IDENTITY_ego_get_private_key (ego),
1101 name))
1102 {
1103 GNUNET_break (0);
1104 GNUNET_SCHEDULER_add_now (&shutdown_task, NULL);
1105 return;
1106 }
1107}
1108
1109
1064 1110
1065/** 1111/**
1066 * Method called to inform about the ego to be used for the master zone 1112 * Method called to inform about the ego to be used for the master zone
@@ -1087,13 +1133,22 @@ identity_intercept_cb (void *cls,
1087{ 1133{
1088 const struct GNUNET_CONFIGURATION_Handle *cfg = cls; 1134 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
1089 struct GNUNET_CRYPTO_EcdsaPublicKey dns_root; 1135 struct GNUNET_CRYPTO_EcdsaPublicKey dns_root;
1090
1091 identity_op = NULL; 1136 identity_op = NULL;
1137
1138 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1139 "Looking for gns-intercept ego\n");
1140 identity_op = GNUNET_IDENTITY_get (identity_handle,
1141 "gns-reverse",
1142 &identity_reverse_cb,
1143 (void*)cfg);
1144
1145
1092 if (NULL == ego) 1146 if (NULL == ego)
1093 { 1147 {
1094 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 1148 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1095 _("No ego configured for `%s`\n"), 1149 _("No ego configured for `%s`\n"),
1096 "gns-intercept"); 1150 "gns-intercept");
1151
1097 return; 1152 return;
1098 } 1153 }
1099 GNUNET_IDENTITY_ego_get_public_key (ego, 1154 GNUNET_IDENTITY_ego_get_public_key (ego,
diff --git a/src/gns/gnunet-service-gns_reverser.c b/src/gns/gnunet-service-gns_reverser.c
index 2e66e7fa6..28c4f4e4d 100644
--- a/src/gns/gnunet-service-gns_reverser.c
+++ b/src/gns/gnunet-service-gns_reverser.c
@@ -46,6 +46,11 @@ struct ReverseRecordEntry
46 */ 46 */
47 struct GNUNET_GNSRECORD_ReverseRecord *record; 47 struct GNUNET_GNSRECORD_ReverseRecord *record;
48 48
49 /**
50 * Record length
51 */
52 size_t record_len;
53
49}; 54};
50 55
51struct IteratorHandle 56struct IteratorHandle
@@ -61,19 +66,19 @@ struct IteratorHandle
61 struct ReverseRecordEntry *records_tail; 66 struct ReverseRecordEntry *records_tail;
62 67
63 /** 68 /**
64 * Current delegation to expect 69 * Record count
65 */ 70 */
66 struct GNUNET_CRYPTO_EcdsaPublicKey target; 71 uint64_t record_count;
67 72
68 /** 73 /**
69 * The zone target for reverse record resolution 74 * Current delegation to expect
70 */ 75 */
71 struct GNUNET_CRYPTO_EcdsaPublicKey myzone; 76 struct GNUNET_CRYPTO_EcdsaPublicKey target;
72 77
73 /** 78 /**
74 * The nick of our zone 79 * Queue entry
75 */ 80 */
76 char *mynick; 81 struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
77 82
78}; 83};
79 84
@@ -151,6 +156,11 @@ struct GNS_ReverserHandle
151static struct GNUNET_SCHEDULER_Task *reverse_record_check_task; 156static struct GNUNET_SCHEDULER_Task *reverse_record_check_task;
152 157
153/** 158/**
159 * NS iterator task
160 */
161static struct GNUNET_SCHEDULER_Task *it_task;
162
163/**
154 * GNS lookup handle 164 * GNS lookup handle
155 */ 165 */
156static struct GNS_ResolverHandle *gns_lookup_reverse; 166static struct GNS_ResolverHandle *gns_lookup_reverse;
@@ -165,7 +175,23 @@ static struct GNUNET_NAMESTORE_Handle *ns;
165 */ 175 */
166static struct GNUNET_NAMESTORE_ZoneIterator *namestore_iter; 176static struct GNUNET_NAMESTORE_ZoneIterator *namestore_iter;
167 177
168void 178/**
179 * The zone target for reverse record resolution
180 */
181static struct GNUNET_CRYPTO_EcdsaPublicKey myzone;
182
183/**
184 * The zone target for reverse record resolution
185 */
186static struct GNUNET_CRYPTO_EcdsaPrivateKey pzone;
187
188/**
189 * The nick of our zone
190 */
191static char *mynick;
192
193
194static void
169cleanup_handle (struct GNS_ReverserHandle *rh) 195cleanup_handle (struct GNS_ReverserHandle *rh)
170{ 196{
171 struct ReverseTreeNode *rtn; 197 struct ReverseTreeNode *rtn;
@@ -174,14 +200,15 @@ cleanup_handle (struct GNS_ReverserHandle *rh)
174 { 200 {
175 if (NULL != rtn->name) 201 if (NULL != rtn->name)
176 GNUNET_free (rtn->name); 202 GNUNET_free (rtn->name);
177 GNUNET_CONTAINER_DLL_remove (rh->node_queue_head, 203 GNUNET_CONTAINER_DLL_remove (rh->node_queue_head,
178 rh->node_queue_tail, 204 rh->node_queue_tail,
179 rtn); 205 rtn);
180 GNUNET_free (rtn); 206 GNUNET_free (rtn);
181 } 207 }
208 GNUNET_free (rh);
182} 209}
183 210
184void 211static void
185handle_gns_result (void *cls, 212handle_gns_result (void *cls,
186 uint32_t rd_count, 213 uint32_t rd_count,
187 const struct GNUNET_GNSRECORD_Data *rd) 214 const struct GNUNET_GNSRECORD_Data *rd)
@@ -245,9 +272,10 @@ handle_gns_result (void *cls,
245 * Done here remove node from queue 272 * Done here remove node from queue
246 */ 273 */
247 rtn = rh->node_queue_head; 274 rtn = rh->node_queue_head;
248 GNUNET_CONTAINER_DLL_remove (rh->node_queue_head, 275 if (NULL != rtn)
249 rh->node_queue_tail, 276 GNUNET_CONTAINER_DLL_remove (rh->node_queue_head,
250 rtn); 277 rh->node_queue_tail,
278 rtn);
251 if (NULL == rh->node_queue_head) 279 if (NULL == rh->node_queue_head)
252 { 280 {
253 //No luck 281 //No luck
@@ -264,6 +292,16 @@ handle_gns_result (void *cls,
264 rh); 292 rh);
265} 293}
266 294
295/**
296 * Reverse lookup of a specific zone
297 * calls RecordLookupProcessor on result or timeout
298 *
299 * @param target the zone to perform the lookup in
300 * @param authority the authority
301 * @param proc the processor to call
302 * @param proc_cls the closure to pass to @a proc
303 * @return handle to cancel operation
304 */
267struct GNS_ReverserHandle * 305struct GNS_ReverserHandle *
268GNS_reverse_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *target, 306GNS_reverse_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *target,
269 const struct GNUNET_CRYPTO_EcdsaPublicKey *authority, 307 const struct GNUNET_CRYPTO_EcdsaPublicKey *authority,
@@ -309,47 +347,62 @@ GNS_reverse_lookup_cancel (struct GNS_ReverserHandle *rh)
309 return; 347 return;
310} 348}
311 349
312void 350/********************************************
351 * Reverse iterator
352 * ******************************************/
353
354
355static void
313next_it (void *cls); 356next_it (void *cls);
314 357
315void 358static void
316handle_gns_result_iter (void *cls, 359handle_gns_result_iter (void *cls,
317 uint32_t rd_count, 360 uint32_t rd_count,
318 const struct GNUNET_GNSRECORD_Data *rd) 361 const struct GNUNET_GNSRECORD_Data *rd)
319{ 362{
320 struct IteratorHandle *ith = cls; 363 struct IteratorHandle *ith = cls;
321 struct ReverseRecordEntry *rr; 364 struct ReverseRecordEntry *rr;
365 gns_lookup_reverse = NULL;
366 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
367 "GNS for REVERSE (%s)\n", mynick);
368
369
322 if ((rd_count != 1) || 370 if ((rd_count != 1) ||
323 (GNUNET_GNSRECORD_TYPE_PKEY != rd->record_type)) 371 (GNUNET_GNSRECORD_TYPE_PKEY != rd->record_type))
324 { 372 {
373 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
374 "GNS invalid REVERSE (%s)\n", mynick);
325 gns_lookup_reverse = NULL; 375 gns_lookup_reverse = NULL;
326 GNUNET_SCHEDULER_add_now (&next_it, NULL); 376 it_task = GNUNET_SCHEDULER_add_now (&next_it, ith);
327 return; 377 return;
328 } 378 }
329 379
330 380
331 rr = GNUNET_new (struct ReverseRecordEntry); 381 rr = GNUNET_new (struct ReverseRecordEntry);
332 rr->record = GNUNET_malloc (sizeof (struct GNUNET_GNSRECORD_ReverseRecord) 382 rr->record_len = sizeof (struct GNUNET_GNSRECORD_ReverseRecord)
333 + strlen (ith->mynick) + 1); 383 + strlen (mynick) + 1;
384 rr->record = GNUNET_malloc (rr->record_len);
334 rr->record->pkey = ith->target; 385 rr->record->pkey = ith->target;
335 rr->record->expiration.abs_value_us = rd->expiration_time; 386 rr->record->expiration.abs_value_us = rd->expiration_time;
336 GNUNET_memcpy ((char*)&rr->record[1], 387 GNUNET_memcpy ((char*)&rr->record[1],
337 ith->mynick, 388 mynick,
338 strlen (ith->mynick)); 389 strlen (mynick));
339 GNUNET_CONTAINER_DLL_insert (ith->records_head, 390 GNUNET_CONTAINER_DLL_insert (ith->records_head,
340 ith->records_tail, 391 ith->records_tail,
341 rr); 392 rr);
342 GNUNET_SCHEDULER_add_now (&next_it, NULL); 393 ith->record_count++;
394 it_task = GNUNET_SCHEDULER_add_now (&next_it, ith);
343} 395}
344 396
345void 397static void
346next_it (void *cls) 398next_it (void *cls)
347{ 399{
400 it_task = NULL;
348 GNUNET_assert (NULL != namestore_iter); 401 GNUNET_assert (NULL != namestore_iter);
349 GNUNET_NAMESTORE_zone_iterator_next (namestore_iter); 402 GNUNET_NAMESTORE_zone_iterator_next (namestore_iter);
350} 403}
351 404
352void 405static void
353iterator_cb (void *cls, 406iterator_cb (void *cls,
354 const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, 407 const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
355 const char *label, 408 const char *label,
@@ -357,42 +410,68 @@ iterator_cb (void *cls,
357 const struct GNUNET_GNSRECORD_Data *rd) 410 const struct GNUNET_GNSRECORD_Data *rd)
358{ 411{
359 struct IteratorHandle *ith = cls; 412 struct IteratorHandle *ith = cls;
360 struct GNUNET_CRYPTO_EcdsaPublicKey *target;
361 struct GNUNET_CRYPTO_EcdsaPublicKey zone; 413 struct GNUNET_CRYPTO_EcdsaPublicKey zone;
414 char *name;
415
416 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
417 "iterating for REVERSE (%s / %s)\n",
418 label,
419 mynick);
420
362 421
363 if ((rd_count != 1) || 422 if ((rd_count != 1) ||
364 (GNUNET_GNSRECORD_TYPE_PKEY != rd->record_type)) 423 (GNUNET_GNSRECORD_TYPE_PKEY != rd->record_type))
365 { 424 {
366 GNUNET_SCHEDULER_add_now (&next_it, NULL); 425 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
426 "wrong format (%s)\n", mynick);
427
428
429 it_task = GNUNET_SCHEDULER_add_now (&next_it, ith);
367 return; 430 return;
368 } 431 }
369 GNUNET_CRYPTO_ecdsa_key_get_public (key, 432 GNUNET_CRYPTO_ecdsa_key_get_public (key,
370 &zone); 433 &zone);
371 if (0 != memcmp (&zone, &ith->myzone, 434 if (0 != memcmp (&zone, &myzone,
372 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) 435 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)))
373 { 436 {
374 GNUNET_SCHEDULER_add_now (&next_it, NULL); 437 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
438 "wrong zone (%s)\n", mynick);
439
440
441 it_task = GNUNET_SCHEDULER_add_now (&next_it, ith);
375 return; 442 return;
376 } 443 }
377 target = (struct GNUNET_CRYPTO_EcdsaPublicKey *) rd->data; 444 ith->target = *((struct GNUNET_CRYPTO_EcdsaPublicKey *) rd->data);
378 gns_lookup_reverse = GNS_resolver_lookup (target, 445 GNUNET_asprintf (&name,
446 "%s.gnu",
447 mynick);
448 gns_lookup_reverse = GNS_resolver_lookup (&ith->target,
379 GNUNET_GNSRECORD_TYPE_PKEY, 449 GNUNET_GNSRECORD_TYPE_PKEY,
380 ith->mynick, 450 name,
381 NULL, 451 NULL,
382 GNUNET_GNS_LO_DEFAULT, 452 GNUNET_GNS_LO_DEFAULT,
383 &handle_gns_result_iter, 453 &handle_gns_result_iter,
384 ith); 454 ith);
455 GNUNET_free (name);
385} 456}
386 457
387void check_reverse_records (void *cls); 458static void check_reverse_records (void *cls);
388 459
389void 460static void
390finished_cb (void *cls) 461store_reverse (void *cls,
462 int32_t success,
463 const char *emsg)
391{ 464{
392 struct IteratorHandle *ith = cls; 465 struct IteratorHandle *ith = cls;
393 struct ReverseRecordEntry *rr; 466 struct ReverseRecordEntry *rr;
394 467
395 //TODO add results to namestore! 468 if (GNUNET_SYSERR == success)
469 {
470 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
471 emsg);
472 }
473 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stored records (%s)\n", mynick);
474
396 for (rr = ith->records_head; NULL != rr; rr = ith->records_head) 475 for (rr = ith->records_head; NULL != rr; rr = ith->records_head)
397 { 476 {
398 GNUNET_CONTAINER_DLL_remove (ith->records_head, 477 GNUNET_CONTAINER_DLL_remove (ith->records_head,
@@ -404,19 +483,60 @@ finished_cb (void *cls)
404 reverse_record_check_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_DAYS, 483 reverse_record_check_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_DAYS,
405 &check_reverse_records, 484 &check_reverse_records,
406 NULL); 485 NULL);
486 GNUNET_free (ith);
487}
488
489static void
490finished_cb (void *cls)
491{
492 struct IteratorHandle *ith = cls;
493 struct ReverseRecordEntry *rr;
494 struct GNUNET_GNSRECORD_Data rd[ith->record_count];
495
496 memset (rd, 0, sizeof (struct GNUNET_GNSRECORD_Data) * ith->record_count);
497
498 rr = ith->records_head;
499 for (int i = 0; i < ith->record_count; i++)
500 {
501 rd[i].data_size = rr->record_len;
502 rd[i].data = GNUNET_malloc (rr->record_len);
503 rd[i].record_type = GNUNET_GNSRECORD_TYPE_REVERSE;
504 rd[i].expiration_time = rr->record->expiration.abs_value_us;
505 GNUNET_memcpy ((char*) rd[i].data,
506 rr->record,
507 rr->record_len);
508 rr = rr->next;
509 }
510 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
511 "Finished iterating for REVERSE\n");
512
513 ith->ns_qe = GNUNET_NAMESTORE_records_store (ns,
514 &pzone,
515 "+",
516 ith->record_count,
517 rd,
518 &store_reverse,
519 ith);
520 namestore_iter = NULL;
407 521
408} 522}
409 523
410void 524static void
411it_error (void *cls) 525it_error (void *cls)
412{ 526{
413 finished_cb (cls); 527 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
528 "Error iterating for REVERSE\n");
414} 529}
415 530
416void 531static void
417check_reverse_records (void *cls) 532check_reverse_records (void *cls)
418{ 533{
419 struct IteratorHandle *ith = cls; 534 struct IteratorHandle *ith;
535 ith = GNUNET_new (struct IteratorHandle);
536 ith->record_count = 0;
537 reverse_record_check_task = NULL;
538 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
539 "Start iterating for REVERSE (%s)\n", mynick);
420 namestore_iter = GNUNET_NAMESTORE_zone_iteration_start (ns, 540 namestore_iter = GNUNET_NAMESTORE_zone_iteration_start (ns,
421 NULL, 541 NULL,
422 &it_error, 542 &it_error,
@@ -427,20 +547,48 @@ check_reverse_records (void *cls)
427 ith); 547 ith);
428} 548}
429 549
430void 550
431GNS_reverse_init (const struct GNUNET_CONFIGURATION_Handle *c, 551/**
432 const struct GNUNET_NAMESTORE_Handle *nh, 552 * Initialize reverser
433 const struct GNUNET_CRYPTO_EcdsaPublicKey *myzone, 553 *
434 const char *mynick) 554 * @param nh handle to a namestore
555 * @param key the private key of the gns-reverse zone
556 * @param name the name of the gns-reverse zone
557 * @return GNUNET_OK
558 */
559int
560GNS_reverse_init (struct GNUNET_NAMESTORE_Handle *nh,
561 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
562 const char *nick)
435{ 563{
436 struct IteratorHandle *ith; 564 GNUNET_asprintf (&mynick,
565 "%s",
566 nick);
567 GNUNET_CRYPTO_ecdsa_key_get_public (zone,
568 &myzone);
569 GNUNET_memcpy (&pzone,
570 zone,
571 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
572 ns = nh;
573 reverse_record_check_task = GNUNET_SCHEDULER_add_now (&check_reverse_records,
574 NULL);
575 return GNUNET_OK;
576}
437 577
438 ns = ns; 578/**
439 ith = GNUNET_new (struct IteratorHandle); 579 * Cleanup reverser
440 ith->mynick = GNUNET_strdup (mynick); 580 */
441 ith->myzone = *myzone; 581void
442 reverse_record_check_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_DAYS, 582GNS_reverse_done ()
443 &check_reverse_records, 583{
444 NULL); 584 GNUNET_free (mynick);
585 if (NULL != it_task)
586 GNUNET_SCHEDULER_cancel (it_task);
587 if (NULL != reverse_record_check_task)
588 GNUNET_SCHEDULER_cancel (reverse_record_check_task);
589 if (NULL != gns_lookup_reverse)
590 GNS_resolver_lookup_cancel (gns_lookup_reverse);
591 if (NULL != namestore_iter)
592 GNUNET_NAMESTORE_zone_iteration_stop (namestore_iter);
445} 593}
446 594
diff --git a/src/gns/gnunet-service-gns_reverser.h b/src/gns/gnunet-service-gns_reverser.h
index ecec7d743..fc9680a29 100644
--- a/src/gns/gnunet-service-gns_reverser.h
+++ b/src/gns/gnunet-service-gns_reverser.h
@@ -69,4 +69,23 @@ GNS_reverse_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *target,
69void 69void
70GNS_reverse_lookup_cancel (struct GNS_ReverserHandle *rh); 70GNS_reverse_lookup_cancel (struct GNS_ReverserHandle *rh);
71 71
72/**
73 * Initialize reverser
74 *
75 * @param nh handle to a namestore
76 * @param key the private key of the gns-reverse zone
77 * @param name the name of the gns-reverse zone
78 * @return GNUNET_OK
79 */
80int
81GNS_reverse_init (struct GNUNET_NAMESTORE_Handle *nh,
82 const struct GNUNET_CRYPTO_EcdsaPrivateKey *key,
83 const char *name);
84
85/**
86 * Cleanup reverser
87 */
88void
89GNS_reverse_done ();
90
72#endif 91#endif
diff --git a/src/gns/test_gns_reverse_lookup.sh b/src/gns/test_gns_reverse_lookup.sh
index 73b829e07..bff1c0662 100755
--- a/src/gns/test_gns_reverse_lookup.sh
+++ b/src/gns/test_gns_reverse_lookup.sh
@@ -16,7 +16,7 @@ fi
16 16
17TEST_NAME="dave.bob.alice.gnu" 17TEST_NAME="dave.bob.alice.gnu"
18gnunet-arm -s -c test_gns_lookup.conf 18gnunet-arm -s -c test_gns_lookup.conf
19gnunet-identity -C bobego -c test_gns_lookup.conf 19gnunet-identity -C bob -c test_gns_lookup.conf
20BOB_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep bob | awk '{print $3}') 20BOB_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep bob | awk '{print $3}')
21gnunet-identity -C daveego -c test_gns_lookup.conf 21gnunet-identity -C daveego -c test_gns_lookup.conf
22DAVE_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep dave | awk '{print $3}') 22DAVE_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep dave | awk '{print $3}')
@@ -24,14 +24,22 @@ gnunet-identity -C aliceego -c test_gns_lookup.conf
24ALICE_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep alice | awk '{print $3}') 24ALICE_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep alice | awk '{print $3}')
25gnunet-identity -C testego -c test_gns_lookup.conf 25gnunet-identity -C testego -c test_gns_lookup.conf
26ROOT_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep testego | awk '{print $3}') 26ROOT_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep testego | awk '{print $3}')
27
28gnunet-identity -s gns-reverse -e bob -c test_gns_lookup.conf
29
27gnunet-namestore -p -z testego -a -n alice -t PKEY -V $ALICE_PKEY -e never -c test_gns_lookup.conf 30gnunet-namestore -p -z testego -a -n alice -t PKEY -V $ALICE_PKEY -e never -c test_gns_lookup.conf
28gnunet-namestore -p -z aliceego -a -n bob -t PKEY -V $BOB_PKEY -e never -c test_gns_lookup.conf 31gnunet-namestore -p -z aliceego -a -n bob -t PKEY -V $BOB_PKEY -e never -c test_gns_lookup.conf
29gnunet-namestore -p -z aliceego -a -n + -t REVERSE -V "alice $ROOT_PKEY 0" -e never -c test_gns_lookup.conf 32gnunet-namestore -p -z aliceego -a -n + -t REVERSE -V "alice $ROOT_PKEY 0" -e never -c test_gns_lookup.conf
30gnunet-namestore -p -z bobego -a -n dave -t PKEY -V $DAVE_PKEY -e never -c test_gns_lookup.conf 33gnunet-namestore -p -z bob -a -n dave -t PKEY -V $DAVE_PKEY -e never -c test_gns_lookup.conf
31gnunet-namestore -p -z bobego -a -n + -t REVERSE -V "bob $ALICE_PKEY 0" -e never -c test_gns_lookup.conf 34gnunet-namestore -p -z bob -a -n alice -t PKEY -V $ALICE_PKEY -e never -c test_gns_lookup.conf
35#gnunet-namestore -p -z bob -a -n + -t REVERSE -V "bob $ALICE_PKEY 0" -e never -c test_gns_lookup.conf
32gnunet-namestore -p -z daveego -a -n + -t REVERSE -V "dave $BOB_PKEY 0" -e never -c test_gns_lookup.conf 36gnunet-namestore -p -z daveego -a -n + -t REVERSE -V "dave $BOB_PKEY 0" -e never -c test_gns_lookup.conf
37gnunet-namestore -p -z daveego -a -n bob -t PKEY -V $BOB_PKEY -e never -c test_gns_lookup.conf
33gnunet-arm -i gns -c test_gns_lookup.conf 38gnunet-arm -i gns -c test_gns_lookup.conf
34sleep 0.5 39$DO_TIMEOUT gnunet-gns --raw -z aliceego -u bob.gnu -t PKEY -c test_gns_lookup.conf
40sleep 10
41gnunet-namestore -z bob -D -c test_gns_lookup.conf
42gnunet-namestore -z daveego -D -c test_gns_lookup.conf
35RES_NAME=`$DO_TIMEOUT gnunet-gns --raw -z testego -R $DAVE_PKEY -c test_gns_lookup.conf` 43RES_NAME=`$DO_TIMEOUT gnunet-gns --raw -z testego -R $DAVE_PKEY -c test_gns_lookup.conf`
36gnunet-arm -e -c test_gns_lookup.conf 44gnunet-arm -e -c test_gns_lookup.conf
37rm -rf /tmp/test-gnunet-gns-peer-1/ 45rm -rf /tmp/test-gnunet-gns-peer-1/