aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2014-06-08 12:20:00 +0000
committerChristian Grothoff <christian@grothoff.org>2014-06-08 12:20:00 +0000
commit2e6caf50d32666619490efd5a6289cea8d6e65df (patch)
tree7620cf673192bb0f41c66ddfb05446a679e9b031 /src/namestore
parent7d7d63ce11fd452fe7051eaae0ecc589aaa45486 (diff)
downloadgnunet-2e6caf50d32666619490efd5a6289cea8d6e65df.tar.gz
gnunet-2e6caf50d32666619490efd5a6289cea8d6e65df.zip
-fix #3301
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/gnunet-namestore.c52
1 files changed, 46 insertions, 6 deletions
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 07c79f033..8c8c7660e 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -459,23 +459,63 @@ get_existing_record (void *cls,
459{ 459{
460 struct GNUNET_GNSRECORD_Data rdn[rd_count + 1]; 460 struct GNUNET_GNSRECORD_Data rdn[rd_count + 1];
461 struct GNUNET_GNSRECORD_Data *rde; 461 struct GNUNET_GNSRECORD_Data *rde;
462 unsigned int i;
462 463
463 add_qe = NULL; 464 add_qe = NULL;
464 if ( (NULL != zone_key) && 465 if ( (NULL != zone_key) &&
465 (0 != strcmp (rec_name, name)) ) 466 (0 != strcmp (rec_name, name)) )
466 { 467 {
467 GNUNET_break (0); 468 GNUNET_break (0);
469 ret = 1;
470 test_finished ();
468 return; 471 return;
469 } 472 }
470 473
471 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received %u records for name `%s'\n", 474 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
472 rd_count, rec_name); 475 "Received %u records for name `%s'\n",
473 476 rd_count, rec_name);
477 for (i=0;i<rd_count;i++)
478 {
479 switch (rd[i].record_type)
480 {
481 case GNUNET_DNSPARSER_TYPE_CNAME:
482 fprintf (stderr,
483 _("A %s record exists already under `%s', no other records can be added.\n"),
484 "CNAME",
485 rec_name);
486 ret = 1;
487 test_finished ();
488 return;
489 case GNUNET_GNSRECORD_TYPE_PKEY:
490 fprintf (stderr,
491 _("A %s record exists already under `%s', no other records can be added.\n"),
492 "PKEY",
493 rec_name);
494 ret = 1;
495 test_finished ();
496 case GNUNET_GNSRECORD_TYPE_GNS2DNS:
497 fprintf (stderr,
498 _("A %s record exists already under `%s', no other records can be added.\n"),
499 "GNS2DNS",
500 rec_name);
501 ret = 1;
502 test_finished ();
503 return;
504 case GNUNET_DNSPARSER_TYPE_NS:
505 if ( (GNUNET_DNSPARSER_TYPE_A == type) ||
506 (GNUNET_DNSPARSER_TYPE_AAAA == type) )
507 break;
508 fprintf (stderr,
509 _("A %s record exists already under `%s', only A/AAAA records can be added.\n"),
510 "NS",
511 rec_name);
512 ret = 1;
513 test_finished ();
514 return;
515 }
516 }
474 memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data)); 517 memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data));
475 memcpy (&rdn[1], rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data)); 518 memcpy (&rdn[1], rd, rd_count * sizeof (struct GNUNET_GNSRECORD_Data));
476 /* FIXME: should add some logic to overwrite records if there
477 can only be one record of a particular type, and to check
478 if the combination of records is valid to begin with... */
479 rde = &rdn[0]; 519 rde = &rdn[0];
480 rde->data = data; 520 rde->data = data;
481 rde->data_size = data_size; 521 rde->data_size = data_size;