aboutsummaryrefslogtreecommitdiff
path: root/src/gnsrecord
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-02-07 17:11:37 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2022-02-07 17:11:37 +0100
commit5ae898ac3c23e3103c45a558079f750cddd4c9e1 (patch)
treefa6b3ed495d46fe5064179180d1ac0c12f07b2e9 /src/gnsrecord
parent14b3c75ab523830f5c1744d5a0faa4168b4172a7 (diff)
downloadgnunet-5ae898ac3c23e3103c45a558079f750cddd4c9e1.tar.gz
gnunet-5ae898ac3c23e3103c45a558079f750cddd4c9e1.zip
-fix
Diffstat (limited to 'src/gnsrecord')
-rw-r--r--src/gnsrecord/gnsrecord_misc.c45
1 files changed, 36 insertions, 9 deletions
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index 5bf4aa371..c4a39a33d 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -445,45 +445,71 @@ GNUNET_GNSRECORD_normalize_record_set (const char *label,
445 * We also want consistent record sets in our local zone(s). 445 * We also want consistent record sets in our local zone(s).
446 * The only exception is the tombstone (above) which we ignore 446 * The only exception is the tombstone (above) which we ignore
447 * for the consistency check(s). 447 * for the consistency check(s).
448 * FIXME: What about shadow records? Should we ignore them?
448 */ 449 */
449 if (GNUNET_YES == GNUNET_GNSRECORD_is_zonekey_type (rd[i].record_type)) 450 if (GNUNET_YES == GNUNET_GNSRECORD_is_zonekey_type (rd[i].record_type))
450 { 451 {
451 have_zone_delegation = GNUNET_YES;
452 /* No delegation records under empty label*/ 452 /* No delegation records under empty label*/
453 if (have_empty_label) 453 if (have_empty_label)
454 { 454 {
455 *emsg = GNUNET_strdup (_ ( 455 *emsg = GNUNET_strdup (_ (
456 "Record set inconsistent: Multiple delegation records.")); 456 "Zone delegation record not allowed in apex."));
457 return GNUNET_SYSERR;
458 }
459 if ((GNUNET_YES == have_other) ||
460 (GNUNET_YES == have_redirect) ||
461 (GNUNET_YES == have_gns2dns))
462 {
463 *emsg = GNUNET_strdup (_ (
464 "Zone delegation record set contains mutually exclusive records."));
457 return GNUNET_SYSERR; 465 return GNUNET_SYSERR;
458 } 466 }
467 have_zone_delegation = GNUNET_YES;
459 } 468 }
460 else if (GNUNET_GNSRECORD_TYPE_REDIRECT == rd[i].record_type) 469 else if (GNUNET_GNSRECORD_TYPE_REDIRECT == rd[i].record_type)
461 { 470 {
462 if (GNUNET_YES == have_redirect) 471 if (GNUNET_YES == have_redirect)
463 { 472 {
464 *emsg = GNUNET_strdup (_ ( 473 *emsg = GNUNET_strdup (_ (
465 "Record set inconsistent: Multiple REDIRECT records.")); 474 "Multiple REDIRECT records."));
475 return GNUNET_SYSERR;
476
477 }
478 if ((GNUNET_YES == have_other) ||
479 (GNUNET_YES == have_zone_delegation) ||
480 (GNUNET_YES == have_gns2dns))
481 {
482 *emsg = GNUNET_strdup (_ (
483 "Redirection record set conains mutually exclusive records."));
466 return GNUNET_SYSERR; 484 return GNUNET_SYSERR;
467 } 485 }
468 have_redirect = GNUNET_YES;
469 /* No redirection records under empty label*/ 486 /* No redirection records under empty label*/
470 if (have_empty_label) 487 if (have_empty_label)
471 { 488 {
472 *emsg = GNUNET_strdup (_ ( 489 *emsg = GNUNET_strdup (_ (
473 "Record set inconsistent: REDIRECT record under apex label.")); 490 "Redirection records not allowed in apex."));
474 return GNUNET_SYSERR; 491 return GNUNET_SYSERR;
475 } 492 }
493 have_redirect = GNUNET_YES;
476 } 494 }
477 else if (GNUNET_GNSRECORD_TYPE_GNS2DNS == rd[i].record_type) 495 else if (GNUNET_GNSRECORD_TYPE_GNS2DNS == rd[i].record_type)
478 { 496 {
479 have_gns2dns = GNUNET_YES;
480 /* No gns2dns records under empty label*/ 497 /* No gns2dns records under empty label*/
481 if (have_empty_label) 498 if (have_empty_label)
482 { 499 {
483 *emsg = GNUNET_strdup (_ ( 500 *emsg = GNUNET_strdup (_ (
484 "Record set inconsistent: GNS2DNS record under apex label.\n")); 501 "Redirection records not allowed in apex..\n"));
502 return GNUNET_SYSERR;
503 }
504 if ((GNUNET_YES == have_other) ||
505 (GNUNET_YES == have_redirect) ||
506 (GNUNET_YES == have_zone_delegation))
507 {
508 *emsg = GNUNET_strdup (_ (
509 "Redirection record set conains mutually exclusive records."));
485 return GNUNET_SYSERR; 510 return GNUNET_SYSERR;
486 } 511 }
512 have_gns2dns = GNUNET_YES;
487 } 513 }
488 else 514 else
489 { 515 {
@@ -493,10 +519,11 @@ GNUNET_GNSRECORD_normalize_record_set (const char *label,
493 (GNUNET_YES == have_redirect) || 519 (GNUNET_YES == have_redirect) ||
494 (GNUNET_YES == have_gns2dns)) 520 (GNUNET_YES == have_gns2dns))
495 { 521 {
496 *emsg = GNUNET_strdup (_("Record set inconsistent: Mutually exclusive records.\n")); 522 *emsg = GNUNET_strdup (_ (
523 "Mutually exclusive records.\n"));
497 return GNUNET_SYSERR; 524 return GNUNET_SYSERR;
498 have_other = GNUNET_YES;
499 } 525 }
526 have_other = GNUNET_YES;
500 } 527 }
501 528
502 /* Ignore private records for public record set */ 529 /* Ignore private records for public record set */