aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_protocols.h6
-rw-r--r--src/namestore/gnunet-service-namestore.c10
-rw-r--r--src/namestore/namestore_api.c81
3 files changed, 70 insertions, 27 deletions
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 4831c9215..898ad6258 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -1352,6 +1352,12 @@ extern "C"
1352 */ 1352 */
1353#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP 448 1353#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP 448
1354 1354
1355/**
1356 * Service to client: end of list of results
1357 */
1358#define GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT_END 449
1359
1360
1355/******************************************************************************* 1361/*******************************************************************************
1356 * LOCKMANAGER message types 1362 * LOCKMANAGER message types
1357 ******************************************************************************/ 1363 ******************************************************************************/
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index 6ad7354ad..1b9e01e18 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -1733,7 +1733,7 @@ run_zone_iteration_round (struct ZoneIteration *zi,
1733{ 1733{
1734 struct ZoneIterationProcResult proc; 1734 struct ZoneIterationProcResult proc;
1735 struct GNUNET_MQ_Envelope *env; 1735 struct GNUNET_MQ_Envelope *env;
1736 struct RecordResultMessage *rrm; 1736 struct GNUNET_NAMESTORE_Header *em;
1737 struct GNUNET_TIME_Absolute start; 1737 struct GNUNET_TIME_Absolute start;
1738 struct GNUNET_TIME_Relative duration; 1738 struct GNUNET_TIME_Relative duration;
1739 1739
@@ -1778,9 +1778,9 @@ run_zone_iteration_round (struct ZoneIteration *zi,
1778 (unsigned long long) (limit - proc.limit), 1778 (unsigned long long) (limit - proc.limit),
1779 (unsigned long long) limit); 1779 (unsigned long long) limit);
1780 /* send empty response to indicate end of list */ 1780 /* send empty response to indicate end of list */
1781 env = GNUNET_MQ_msg (rrm, 1781 env = GNUNET_MQ_msg (em,
1782 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT); 1782 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT_END);
1783 rrm->gns_header.r_id = htonl (zi->request_id); 1783 em->r_id = htonl (zi->request_id);
1784 GNUNET_MQ_send (zi->nc->mq, 1784 GNUNET_MQ_send (zi->nc->mq,
1785 env); 1785 env);
1786 GNUNET_CONTAINER_DLL_remove (zi->nc->op_head, 1786 GNUNET_CONTAINER_DLL_remove (zi->nc->op_head,
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index 55745d83d..527576718 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -523,6 +523,7 @@ static int
523check_record_result (void *cls, 523check_record_result (void *cls,
524 const struct RecordResultMessage *msg) 524 const struct RecordResultMessage *msg)
525{ 525{
526 static struct GNUNET_CRYPTO_EcdsaPrivateKey priv_dummy;
526 const char *name; 527 const char *name;
527 size_t msg_len; 528 size_t msg_len;
528 size_t name_len; 529 size_t name_len;
@@ -543,12 +544,19 @@ check_record_result (void *cls,
543 return GNUNET_SYSERR; 544 return GNUNET_SYSERR;
544 } 545 }
545 name = (const char *) &msg[1]; 546 name = (const char *) &msg[1];
546 if ( (name_len > 0) && 547 if ( (0 == name_len) ||
547 ('\0' != name[name_len -1]) ) 548 ('\0' != name[name_len -1]) )
548 { 549 {
549 GNUNET_break (0); 550 GNUNET_break (0);
550 return GNUNET_SYSERR; 551 return GNUNET_SYSERR;
551 } 552 }
553 if (0 == memcmp (&msg->private_key,
554 &priv_dummy,
555 sizeof (priv_dummy)) )
556 {
557 GNUNET_break (0);
558 return GNUNET_SYSERR;
559 }
552 return check_rd (rd_len, 560 return check_rd (rd_len,
553 &name[name_len], 561 &name[name_len],
554 ntohs (msg->rd_count)); 562 ntohs (msg->rd_count));
@@ -566,7 +574,6 @@ static void
566handle_record_result (void *cls, 574handle_record_result (void *cls,
567 const struct RecordResultMessage *msg) 575 const struct RecordResultMessage *msg)
568{ 576{
569 static struct GNUNET_CRYPTO_EcdsaPrivateKey priv_dummy;
570 struct GNUNET_NAMESTORE_Handle *h = cls; 577 struct GNUNET_NAMESTORE_Handle *h = cls;
571 struct GNUNET_NAMESTORE_QueueEntry *qe; 578 struct GNUNET_NAMESTORE_QueueEntry *qe;
572 struct GNUNET_NAMESTORE_ZoneIterator *ze; 579 struct GNUNET_NAMESTORE_ZoneIterator *ze;
@@ -595,25 +602,6 @@ handle_record_result (void *cls,
595 force_reconnect (h); 602 force_reconnect (h);
596 return; 603 return;
597 } 604 }
598 if ( (0 == name_len) &&
599 (0 == (memcmp (&msg->private_key,
600 &priv_dummy,
601 sizeof (priv_dummy)))) )
602 {
603 LOG (GNUNET_ERROR_TYPE_DEBUG,
604 "Zone iteration completed!\n");
605 if (NULL == ze)
606 {
607 GNUNET_break (0);
608 force_reconnect (h);
609 return;
610 }
611 if (NULL != ze->finish_cb)
612 ze->finish_cb (ze->finish_cb_cls);
613 free_ze (ze);
614 return;
615 }
616
617 name = (const char *) &msg[1]; 605 name = (const char *) &msg[1];
618 rd_tmp = &name[name_len]; 606 rd_tmp = &name[name_len];
619 { 607 {
@@ -654,6 +642,51 @@ handle_record_result (void *cls,
654 642
655/** 643/**
656 * Handle an incoming message of type 644 * Handle an incoming message of type
645 * #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT_END
646 *
647 * @param cls
648 * @param msg the message we received
649 */
650static void
651handle_record_result_end (void *cls,
652 const struct GNUNET_NAMESTORE_Header *msg)
653{
654 struct GNUNET_NAMESTORE_Handle *h = cls;
655 struct GNUNET_NAMESTORE_QueueEntry *qe;
656 struct GNUNET_NAMESTORE_ZoneIterator *ze;
657
658 LOG (GNUNET_ERROR_TYPE_DEBUG,
659 "Received RECORD_RESULT_END\n");
660 ze = find_zi (h,
661 ntohl (msg->r_id));
662 qe = find_qe (h,
663 ntohl (msg->r_id));
664 if ( (NULL == ze) &&
665 (NULL == qe) )
666 return; /* rid not found */
667 if ( (NULL != ze) &&
668 (NULL != qe) )
669 {
670 GNUNET_break (0); /* rid ambigous */
671 force_reconnect (h);
672 return;
673 }
674 LOG (GNUNET_ERROR_TYPE_DEBUG,
675 "Zone iteration completed!\n");
676 if (NULL == ze)
677 {
678 GNUNET_break (0);
679 force_reconnect (h);
680 return;
681 }
682 if (NULL != ze->finish_cb)
683 ze->finish_cb (ze->finish_cb_cls);
684 free_ze (ze);
685}
686
687
688/**
689 * Handle an incoming message of type
657 * #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE. 690 * #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE.
658 * 691 *
659 * @param qe the respective entry in the message queue 692 * @param qe the respective entry in the message queue
@@ -810,6 +843,10 @@ reconnect (struct GNUNET_NAMESTORE_Handle *h)
810 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT, 843 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT,
811 struct RecordResultMessage, 844 struct RecordResultMessage,
812 h), 845 h),
846 GNUNET_MQ_hd_fixed_size (record_result_end,
847 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT_END,
848 struct GNUNET_NAMESTORE_Header,
849 h),
813 GNUNET_MQ_hd_var_size (lookup_result, 850 GNUNET_MQ_hd_var_size (lookup_result,
814 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE, 851 GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE,
815 struct LabelLookupResponseMessage, 852 struct LabelLookupResponseMessage,