aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-08-24 09:26:15 +0000
committerChristian Grothoff <christian@grothoff.org>2013-08-24 09:26:15 +0000
commit8babf5f841c8d364a0ab271e395f7e9a0e9b2632 (patch)
tree7922b17cc2a9e05481dc18518f65c66d2cab1940
parent1d69e52d2f0717a1d99d92f41cba468f888f7697 (diff)
downloadgnunet-8babf5f841c8d364a0ab271e395f7e9a0e9b2632.tar.gz
gnunet-8babf5f841c8d364a0ab271e395f7e9a0e9b2632.zip
-convert additional record types
-rw-r--r--src/gns/gnunet-service-gns_resolver.c125
1 files changed, 0 insertions, 125 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 1c76e060c..e501fa3cb 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -527,131 +527,6 @@ expand_plus (char* dest,
527} 527}
528 528
529 529
530/**
531 * finish lookup
532 */
533static void
534finish_lookup (struct ResolverHandle *rh,
535 struct RecordLookupHandle* rlh,
536 unsigned int rd_count,
537 const struct GNUNET_NAMESTORE_RecordData *rd)
538{
539 unsigned int i;
540 char new_rr_data[GNUNET_DNSPARSER_MAX_NAME_LENGTH];
541 char new_mx_data[MAX_MX_LENGTH];
542 char new_soa_data[MAX_SOA_LENGTH];
543 char new_srv_data[MAX_SRV_LENGTH];
544 struct GNUNET_TUN_DnsSrvRecord *old_srv;
545 struct GNUNET_TUN_DnsSrvRecord *new_srv;
546 struct GNUNET_TUN_DnsSoaRecord *old_soa;
547 struct GNUNET_TUN_DnsSoaRecord *new_soa;
548 struct GNUNET_NAMESTORE_RecordData p_rd[rd_count];
549 char* repl_string;
550 char* pos;
551 unsigned int offset;
552
553 if (GNUNET_SCHEDULER_NO_TASK != rh->timeout_task)
554 {
555 GNUNET_SCHEDULER_cancel(rh->timeout_task);
556 rh->timeout_task = GNUNET_SCHEDULER_NO_TASK;
557 }
558
559 GNUNET_CONTAINER_DLL_remove (rlh_head, rlh_tail, rh);
560
561 if (0 < rd_count)
562 memcpy(p_rd, rd, rd_count*sizeof(struct GNUNET_NAMESTORE_RecordData));
563
564 for (i = 0; i < rd_count; i++)
565 {
566
567 if ((GNUNET_DNSPARSER_TYPE_NS != rd[i].record_type) &&
568 (GNUNET_DNSPARSER_TYPE_PTR != rd[i].record_type) &&
569 (GNUNET_DNSPARSER_TYPE_CNAME != rd[i].record_type) &&
570 (GNUNET_DNSPARSER_TYPE_MX != rd[i].record_type) &&
571 (GNUNET_DNSPARSER_TYPE_SOA != rd[i].record_type) &&
572 (GNUNET_DNSPARSER_TYPE_SRV != rd[i].record_type))
573 {
574 p_rd[i].data = rd[i].data;
575 continue;
576 }
577
578 /**
579 * for all those records we 'should'
580 * also try to resolve the A/AAAA records (RFC1035)
581 * This is a feature and not important
582 */
583
584 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
585 "GNS_POSTPROCESS: Postprocessing\n");
586 if (0 == strcmp(rh->name, GNUNET_GNS_MASTERZONE_STR))
587 repl_string = rlh->name;
588 else
589 repl_string = rlh->name+strlen(rh->name)+1;
590
591 offset = 0;
592 if (GNUNET_DNSPARSER_TYPE_MX == rd[i].record_type)
593 {
594 memcpy (new_mx_data, (char*)rd[i].data, sizeof(uint16_t));
595 offset = sizeof (uint16_t);
596 pos = new_mx_data + offset;
597 // FIXME: how do we know that 'pos' has enough space for the new name?
598 expand_plus (pos, (char*)rd[i].data+sizeof(uint16_t),
599 repl_string);
600 offset += strlen(new_mx_data+sizeof(uint16_t)) + 1;
601 p_rd[i].data = new_mx_data;
602 p_rd[i].data_size = offset;
603 }
604 else if (GNUNET_DNSPARSER_TYPE_SRV == rd[i].record_type)
605 {
606 /*
607 * Prio, weight and port
608 */
609 new_srv = (struct GNUNET_TUN_DnsSrvRecord*)new_srv_data;
610 old_srv = (struct GNUNET_TUN_DnsSrvRecord*)rd[i].data;
611 new_srv->prio = old_srv->prio;
612 new_srv->weight = old_srv->weight;
613 new_srv->port = old_srv->port;
614 // FIXME: how do we know that '&new_srv[1]' has enough space for the new name?
615 expand_plus((char*)&new_srv[1], (char*)&old_srv[1],
616 repl_string);
617 p_rd[i].data = new_srv_data;
618 p_rd[i].data_size = sizeof (struct GNUNET_TUN_DnsSrvRecord) + strlen ((char*)&new_srv[1]) + 1;
619 }
620 else if (GNUNET_DNSPARSER_TYPE_SOA == rd[i].record_type)
621 {
622 /* expand mname and rname */
623 old_soa = (struct GNUNET_TUN_DnsSoaRecord*)rd[i].data;
624 new_soa = (struct GNUNET_TUN_DnsSoaRecord*)new_soa_data;
625 memcpy (new_soa, old_soa, sizeof (struct GNUNET_TUN_DnsSoaRecord));
626 // FIXME: how do we know that 'new_soa[1]' has enough space for the new name?
627 expand_plus((char*)&new_soa[1], (char*)&old_soa[1], repl_string);
628 offset = strlen ((char*)&new_soa[1]) + 1;
629 // FIXME: how do we know that 'new_soa[1]' has enough space for the new name?
630 expand_plus((char*)&new_soa[1] + offset,
631 (char*)&old_soa[1] + strlen ((char*)&old_soa[1]) + 1,
632 repl_string);
633 p_rd[i].data_size = sizeof (struct GNUNET_TUN_DnsSoaRecord)
634 + offset
635 + strlen ((char*)&new_soa[1] + offset);
636 p_rd[i].data = new_soa_data;
637 }
638 else
639 {
640 pos = new_rr_data;
641 // FIXME: how do we know that 'rd[i].data' has enough space for the new name?
642 expand_plus(pos, (char*)rd[i].data, repl_string);
643 p_rd[i].data_size = strlen(new_rr_data)+1;
644 p_rd[i].data = new_rr_data;
645 }
646
647 }
648
649 rlh->proc(rlh->proc_cls, rd_count, p_rd);
650 GNUNET_free(rlh);
651 free_resolver_handle (rh);
652}
653
654
655#endif 530#endif
656 531
657/////////////////////////////////////////////////////////////////////////////////////////////////// 532///////////////////////////////////////////////////////////////////////////////////////////////////