diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-02-08 00:29:47 +0100 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-02-08 00:29:47 +0100 |
commit | fab89196f0a3a14b8d1e3de593958b78f6d58775 (patch) | |
tree | 26672a891427ec5550e70081535e2fa51f7b9316 /src/namestore | |
parent | 801b48edcf34f571b7ad7f99269ae683a1497a02 (diff) | |
download | gnunet-fab89196f0a3a14b8d1e3de593958b78f6d58775.tar.gz gnunet-fab89196f0a3a14b8d1e3de593958b78f6d58775.zip |
-fix namestore logic
Diffstat (limited to 'src/namestore')
-rw-r--r-- | src/namestore/gnunet-namestore.c | 71 | ||||
-rw-r--r-- | src/namestore/gnunet-service-namestore.c | 22 |
2 files changed, 15 insertions, 78 deletions
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index 71f23e315..ba8f633cc 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c | |||
@@ -447,8 +447,8 @@ display_record (const char *rname, | |||
447 | if ((GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) && | 447 | if ((GNUNET_GNSRECORD_TYPE_NICK == rd[i].record_type) && |
448 | (0 != strcmp (rname, GNUNET_GNS_EMPTY_LABEL_AT))) | 448 | (0 != strcmp (rname, GNUNET_GNS_EMPTY_LABEL_AT))) |
449 | continue; | 449 | continue; |
450 | if (GNUNET_GNSRECORD_TYPE_TOMBSTONE == rd[i].record_type) | 450 | /*if (GNUNET_GNSRECORD_TYPE_TOMBSTONE == rd[i].record_type) |
451 | continue; | 451 | continue;*/ |
452 | if ((type != rd[i].record_type) && (GNUNET_GNSRECORD_TYPE_ANY != type)) | 452 | if ((type != rd[i].record_type) && (GNUNET_GNSRECORD_TYPE_ANY != type)) |
453 | continue; | 453 | continue; |
454 | typestr = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type); | 454 | typestr = GNUNET_GNSRECORD_number_to_typename (rd[i].record_type); |
@@ -651,28 +651,6 @@ get_existing_record (void *cls, | |||
651 | { | 651 | { |
652 | switch (rd[i].record_type) | 652 | switch (rd[i].record_type) |
653 | { | 653 | { |
654 | case GNUNET_DNSPARSER_TYPE_CNAME: | ||
655 | fprintf ( | ||
656 | stderr, | ||
657 | _ ( | ||
658 | "A %s record exists already under `%s', no other records can be added.\n"), | ||
659 | "CNAME", | ||
660 | rec_name); | ||
661 | ret = 1; | ||
662 | test_finished (); | ||
663 | return; | ||
664 | |||
665 | case GNUNET_GNSRECORD_TYPE_PKEY: | ||
666 | case GNUNET_GNSRECORD_TYPE_EDKEY: | ||
667 | fprintf ( | ||
668 | stderr, | ||
669 | _ ( | ||
670 | "A zone key record exists already under `%s', no other records can be added.\n"), | ||
671 | rec_name); | ||
672 | ret = 1; | ||
673 | test_finished (); | ||
674 | return; | ||
675 | |||
676 | case GNUNET_DNSPARSER_TYPE_SOA: | 654 | case GNUNET_DNSPARSER_TYPE_SOA: |
677 | if (GNUNET_DNSPARSER_TYPE_SOA == type) | 655 | if (GNUNET_DNSPARSER_TYPE_SOA == type) |
678 | { | 656 | { |
@@ -688,51 +666,6 @@ get_existing_record (void *cls, | |||
688 | break; | 666 | break; |
689 | } | 667 | } |
690 | } | 668 | } |
691 | switch (type) | ||
692 | { | ||
693 | case GNUNET_DNSPARSER_TYPE_CNAME: | ||
694 | if (0 != rd_count) | ||
695 | { | ||
696 | fprintf (stderr, | ||
697 | _ ( | ||
698 | "Records already exist under `%s', cannot add `%s' record.\n"), | ||
699 | rec_name, | ||
700 | "CNAME"); | ||
701 | ret = 1; | ||
702 | test_finished (); | ||
703 | return; | ||
704 | } | ||
705 | break; | ||
706 | |||
707 | case GNUNET_GNSRECORD_TYPE_PKEY: | ||
708 | case GNUNET_GNSRECORD_TYPE_EDKEY: | ||
709 | if (0 != rd_count) | ||
710 | { | ||
711 | fprintf (stderr, | ||
712 | _ ( | ||
713 | "Records already exist under `%s', cannot add record.\n"), | ||
714 | rec_name); | ||
715 | ret = 1; | ||
716 | test_finished (); | ||
717 | return; | ||
718 | } | ||
719 | break; | ||
720 | |||
721 | case GNUNET_GNSRECORD_TYPE_GNS2DNS: | ||
722 | for (unsigned int i = 0; i < rd_count; i++) | ||
723 | if (GNUNET_GNSRECORD_TYPE_GNS2DNS != rd[i].record_type) | ||
724 | { | ||
725 | fprintf ( | ||
726 | stderr, | ||
727 | _ ( | ||
728 | "Non-GNS2DNS records already exist under `%s', cannot add GNS2DNS record.\n"), | ||
729 | rec_name); | ||
730 | ret = 1; | ||
731 | test_finished (); | ||
732 | return; | ||
733 | } | ||
734 | break; | ||
735 | } | ||
736 | memset (rdn, 0, sizeof(struct GNUNET_GNSRECORD_Data)); | 669 | memset (rdn, 0, sizeof(struct GNUNET_GNSRECORD_Data)); |
737 | GNUNET_memcpy (&rdn[1], rd, rd_count * sizeof(struct GNUNET_GNSRECORD_Data)); | 670 | GNUNET_memcpy (&rdn[1], rd, rd_count * sizeof(struct GNUNET_GNSRECORD_Data)); |
738 | rde = &rdn[0]; | 671 | rde = &rdn[0]; |
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 51f9b9168..8c93b9a0d 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -1484,12 +1484,12 @@ get_block_exp_existing (void *cls, | |||
1484 | char *emsg; | 1484 | char *emsg; |
1485 | 1485 | ||
1486 | if (GNUNET_OK != GNUNET_GNSRECORD_convert_records_for_export (label, | 1486 | if (GNUNET_OK != GNUNET_GNSRECORD_convert_records_for_export (label, |
1487 | rd, | 1487 | rd, |
1488 | rd_count, | 1488 | rd_count, |
1489 | rd_pub, | 1489 | rd_pub, |
1490 | &rd_pub_count, | 1490 | &rd_pub_count, |
1491 | exp, | 1491 | exp, |
1492 | &emsg)) | 1492 | &emsg)) |
1493 | { | 1493 | { |
1494 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1494 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1495 | "%s\n", emsg); | 1495 | "%s\n", emsg); |
@@ -1522,7 +1522,8 @@ handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | |||
1522 | 1522 | ||
1523 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1523 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1524 | "Received NAMESTORE_RECORD_STORE message\n"); | 1524 | "Received NAMESTORE_RECORD_STORE message\n"); |
1525 | existing_block_exp.abs_value_us = 0; | 1525 | existing_block_exp = GNUNET_TIME_UNIT_ZERO_ABS; |
1526 | new_block_exp = GNUNET_TIME_UNIT_ZERO_ABS; | ||
1526 | rid = ntohl (rp_msg->gns_header.r_id); | 1527 | rid = ntohl (rp_msg->gns_header.r_id); |
1527 | name_len = ntohs (rp_msg->name_len); | 1528 | name_len = ntohs (rp_msg->name_len); |
1528 | rd_count = ntohs (rp_msg->rd_count); | 1529 | rd_count = ntohs (rp_msg->rd_count); |
@@ -1634,7 +1635,7 @@ handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | |||
1634 | existing_block_exp.abs_value_us; | 1635 | existing_block_exp.abs_value_us; |
1635 | rd_nf[rd_nf_count].data = NULL; | 1636 | rd_nf[rd_nf_count].data = NULL; |
1636 | rd_nf[rd_nf_count].data_size = 0; | 1637 | rd_nf[rd_nf_count].data_size = 0; |
1637 | rd_nf[rd_nf_count].flags |= GNUNET_GNSRECORD_RF_PRIVATE; | 1638 | rd_nf[rd_nf_count].flags = GNUNET_GNSRECORD_RF_PRIVATE; |
1638 | rd_nf_count++; | 1639 | rd_nf_count++; |
1639 | } | 1640 | } |
1640 | if ((0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT, conv_name)) && | 1641 | if ((0 == strcmp (GNUNET_GNS_EMPTY_LABEL_AT, conv_name)) && |
@@ -1652,7 +1653,10 @@ handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | |||
1652 | 1653 | ||
1653 | if (GNUNET_OK != res) | 1654 | if (GNUNET_OK != res) |
1654 | { | 1655 | { |
1655 | /* store not successful or zonemaster, not need to tell monitors */ | 1656 | /* store not successful, no need to tell monitors */ |
1657 | send_store_response (nc, res, _("Store failed"), rid); | ||
1658 | GNUNET_SERVICE_client_continue (nc->client); | ||
1659 | GNUNET_free (conv_name); | ||
1656 | } | 1660 | } |
1657 | 1661 | ||
1658 | sa = GNUNET_malloc (sizeof(struct StoreActivity) | 1662 | sa = GNUNET_malloc (sizeof(struct StoreActivity) |