aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-10 10:50:04 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-10 10:50:04 +0000
commita012cdcb14c71e2a259ac84c13baa9c22c68a0c8 (patch)
treef9d2eaeb9dfb0e6e3e7b28bb03b2fb9c064d79ca /src
parentb73ad06bd39b3d005c22ffcfe8423a5c9d92b37e (diff)
downloadgnunet-a012cdcb14c71e2a259ac84c13baa9c22c68a0c8.tar.gz
gnunet-a012cdcb14c71e2a259ac84c13baa9c22c68a0c8.zip
-fix crash in gnunet-namestore -a if no other records already existed
Diffstat (limited to 'src')
-rw-r--r--src/namestore/gnunet-namestore.c25
-rw-r--r--src/namestore/namestore_api.c28
2 files changed, 28 insertions, 25 deletions
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c
index 10e328df8..aadf741ad 100644
--- a/src/namestore/gnunet-namestore.c
+++ b/src/namestore/gnunet-namestore.c
@@ -239,9 +239,9 @@ do_shutdown (void *cls,
239 * operation. 239 * operation.
240 * 240 *
241 * @param cls closure, location of the QueueEntry pointer to NULL out 241 * @param cls closure, location of the QueueEntry pointer to NULL out
242 * @param success GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate) 242 * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate)
243 * GNUNET_NO if content was already there 243 * #GNUNET_NO if content was already there
244 * GNUNET_YES (or other positive value) on success 244 * #GNUNET_YES (or other positive value) on success
245 * @param emsg NULL on success, otherwise an error message 245 * @param emsg NULL on success, otherwise an error message
246 */ 246 */
247static void 247static void
@@ -273,9 +273,9 @@ add_continuation (void *cls,
273 * operation. 273 * operation.
274 * 274 *
275 * @param cls closure, unused 275 * @param cls closure, unused
276 * @param success GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate) 276 * @param success #GNUNET_SYSERR on failure (including timeout/queue drop/failure to validate)
277 * GNUNET_NO if content was already there 277 * #GNUNET_NO if content was already there
278 * GNUNET_YES (or other positive value) on success 278 * #GNUNET_YES (or other positive value) on success
279 * @param emsg NULL on success, otherwise an error message 279 * @param emsg NULL on success, otherwise an error message
280 */ 280 */
281static void 281static void
@@ -301,7 +301,7 @@ del_continuation (void *cls,
301 * @param cls closure 301 * @param cls closure
302 * @param zone_key private key of the zone 302 * @param zone_key private key of the zone
303 * @param name name that is being mapped (at most 255 characters long) 303 * @param name name that is being mapped (at most 255 characters long)
304 * @param rd_len number of entries in 'rd' array 304 * @param rd_len number of entries in @a rd array
305 * @param rd array of records with data to store 305 * @param rd array of records with data to store
306 */ 306 */
307static void 307static void
@@ -320,7 +320,7 @@ display_record (void *cls,
320 list_it = NULL; 320 list_it = NULL;
321 if ( (NULL == del_qe) && 321 if ( (NULL == del_qe) &&
322 (NULL == add_qe_uri) && 322 (NULL == add_qe_uri) &&
323 (NULL == add_qe) ) 323 (NULL == add_qe) )
324 GNUNET_SCHEDULER_shutdown (); 324 GNUNET_SCHEDULER_shutdown ();
325 return; 325 return;
326 } 326 }
@@ -369,7 +369,7 @@ sync_cb (void *cls)
369 * @param cls closure, unused 369 * @param cls closure, unused
370 * @param zone_key private key of the zone 370 * @param zone_key private key of the zone
371 * @param rec_name name that is being mapped (at most 255 characters long) 371 * @param rec_name name that is being mapped (at most 255 characters long)
372 * @param rd_count number of entries in 'rd' array 372 * @param rd_count number of entries in @a rd array
373 * @param rd array of records with data to store 373 * @param rd array of records with data to store
374 */ 374 */
375static void 375static void
@@ -409,7 +409,10 @@ get_existing_record (void *cls,
409 rde, 409 rde,
410 &add_continuation, 410 &add_continuation,
411 &add_qe); 411 &add_qe);
412 GNUNET_NAMESTORE_zone_iteration_stop (add_zit); 412 /* only cancel if we were not told that this
413 was the end of the iteration already */
414 if (NULL != rec_name)
415 GNUNET_NAMESTORE_zone_iteration_stop (add_zit);
413 add_zit = NULL; 416 add_zit = NULL;
414} 417}
415 418
@@ -420,7 +423,7 @@ get_existing_record (void *cls,
420 * operation. 423 * operation.
421 * 424 *
422 * @param cls closure with our configuration 425 * @param cls closure with our configuration
423 * @param result GNUNET_YES if the namestore service is running 426 * @param result #GNUNET_YES if the namestore service is running
424 */ 427 */
425static void 428static void
426testservice_task (void *cls, 429testservice_task (void *cls,
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index 9e2e13066..a57aa2967 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -416,13 +416,13 @@ handle_record_result (struct GNUNET_NAMESTORE_QueueEntry *qe,
416 416
417 417
418/** 418/**
419 * Handle an incoming message of type 'GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE' 419 * Handle an incoming message of type #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE.
420 * 420 *
421 * @param qe the respective entry in the message queue 421 * @param qe the respective entry in the message queue
422 * @param msg the message we received 422 * @param msg the message we received
423 * @param size the message size 423 * @param size the message size
424 * @return GNUNET_OK on success, GNUNET_NO if we notified the client about 424 * @return #GNUNET_OK on success, #GNUNET_NO if we notified the client about
425 * the error, GNUNET_SYSERR on error and we did NOT notify the client 425 * the error, #GNUNET_SYSERR on error and we did NOT notify the client
426 */ 426 */
427static int 427static int
428handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe, 428handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
@@ -493,10 +493,10 @@ handle_zone_to_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
493 * 493 *
494 * @param qe the respective zone iteration handle 494 * @param qe the respective zone iteration handle
495 * @param msg the message we received 495 * @param msg the message we received
496 * @param type the message type in HBO 496 * @param type the message type in host byte order
497 * @param size the message size 497 * @param size the message size
498 * @return GNUNET_OK on success, GNUNET_NO if we notified the client about 498 * @return #GNUNET_OK on success, #GNUNET_NO if we notified the client about
499 * the error, GNUNET_SYSERR on error and we did NOT notify the client 499 * the error, #GNUNET_SYSERR on error and we did NOT notify the client
500 */ 500 */
501static int 501static int
502manage_record_operations (struct GNUNET_NAMESTORE_QueueEntry *qe, 502manage_record_operations (struct GNUNET_NAMESTORE_QueueEntry *qe,
@@ -555,8 +555,8 @@ manage_record_operations (struct GNUNET_NAMESTORE_QueueEntry *qe,
555 * @param ze the respective iterator for this operation 555 * @param ze the respective iterator for this operation
556 * @param msg the message containing the respoonse 556 * @param msg the message containing the respoonse
557 * @param size the message size 557 * @param size the message size
558 * @return GNUNET_YES on success, 'ze' should be kept, GNUNET_NO on success if 'ze' should 558 * @return #GNUNET_YES on success, @a ze should be kept, #GNUNET_NO on success if @a ze should
559 * not be kept any longer, GNUNET_SYSERR on error (disconnect) and 'ze' should be kept 559 * not be kept any longer, #GNUNET_SYSERR on error (disconnect) and @a ze should be kept
560 */ 560 */
561static int 561static int
562handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze, 562handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze,
@@ -587,7 +587,8 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze,
587 } 587 }
588 if ((0 == name_len) && (0 == (memcmp (&msg->private_key, &priv_dummy, sizeof (priv_dummy))))) 588 if ((0 == name_len) && (0 == (memcmp (&msg->private_key, &priv_dummy, sizeof (priv_dummy)))))
589 { 589 {
590 LOG (GNUNET_ERROR_TYPE_DEBUG, "Zone iteration is completed!\n"); 590 LOG (GNUNET_ERROR_TYPE_DEBUG,
591 "Zone iteration is completed!\n");
591 if (NULL != ze->proc) 592 if (NULL != ze->proc)
592 ze->proc (ze->proc_cls, NULL, NULL, 0, NULL); 593 ze->proc (ze->proc_cls, NULL, NULL, 0, NULL);
593 return GNUNET_NO; 594 return GNUNET_NO;
@@ -621,8 +622,8 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze,
621 * @param msg the message we received 622 * @param msg the message we received
622 * @param type the message type in HBO 623 * @param type the message type in HBO
623 * @param size the message size 624 * @param size the message size
624 * @return GNUNET_YES on success, 'ze' should be kept, GNUNET_NO on success if 'ze' should 625 * @return #GNUNET_YES on success, @a ze should be kept, #GNUNET_NO on success if @a ze should
625 * not be kept any longer, GNUNET_SYSERR on error (disconnect) and 'ze' should be kept 626 * not be kept any longer, #GNUNET_SYSERR on error (disconnect) and @a ze should be kept
626 */ 627 */
627static int 628static int
628manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze, 629manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze,
@@ -650,7 +651,7 @@ manage_zone_operations (struct GNUNET_NAMESTORE_ZoneIterator *ze,
650 * Type of a function to call when we receive a message 651 * Type of a function to call when we receive a message
651 * from the service. 652 * from the service.
652 * 653 *
653 * @param cls the 'struct GNUNET_NAMESTORE_SchedulingHandle' 654 * @param cls the `struct GNUNET_NAMESTORE_SchedulingHandle`
654 * @param msg message received, NULL on timeout or fatal error 655 * @param msg message received, NULL on timeout or fatal error
655 */ 656 */
656static void 657static void
@@ -710,8 +711,7 @@ process_namestore_message (void *cls,
710 GNUNET_free (qe); 711 GNUNET_free (qe);
711 } 712 }
712 } 713 }
713 714 /* Is it a zone iteration operation? */
714 /* Is it a zone iteration operation ? */
715 for (ze = h->z_head; ze != NULL; ze = ze->next) 715 for (ze = h->z_head; ze != NULL; ze = ze->next)
716 if (ze->op_id == r_id) 716 if (ze->op_id == r_id)
717 break; 717 break;