aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/gnunet-namestore-fcfsd.c
diff options
context:
space:
mode:
authorAlessio Vanni <vannilla@firemail.cc>2021-05-16 01:04:51 +0200
committerAlessio Vanni <vannilla@firemail.cc>2021-05-16 14:02:08 +0200
commit8cee30bb827c253ea924fd3397558bfec86902b8 (patch)
tree90f0b66ee3522c14dd822e39634d00b768f8c17a /src/namestore/gnunet-namestore-fcfsd.c
parent2bca4006c49c7b3875034f6fd6530cbcfe20bcb1 (diff)
downloadgnunet-8cee30bb827c253ea924fd3397558bfec86902b8.tar.gz
gnunet-8cee30bb827c253ea924fd3397558bfec86902b8.zip
-add forgotten NULL values
Diffstat (limited to 'src/namestore/gnunet-namestore-fcfsd.c')
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c
index ec99d13e5..e1fa0a0a6 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -403,7 +403,8 @@ register_error_cb (void *cls)
403 MHD_resume_connection (rd->c); 403 MHD_resume_connection (rd->c);
404 rd->searching = NULL; 404 rd->searching = NULL;
405 rd->body = make_json ("error", "true", 405 rd->body = make_json ("error", "true",
406 "message", _ ("unable to scan namestore")); 406 "message", _ ("unable to scan namestore"),
407 NULL);
407 rd->body_length = strlen (rd->body); 408 rd->body_length = strlen (rd->body);
408 rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR; 409 rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR;
409 run_httpd_now (); 410 run_httpd_now ();
@@ -433,14 +434,16 @@ register_done_cb (void *cls,
433 rd->register_name, 434 rd->register_name,
434 emsg); 435 emsg);
435 rd->body = make_json ("error", "true", 436 rd->body = make_json ("error", "true",
436 "message", emsg); 437 "message", emsg,
438 NULL);
437 rd->body_length = strlen (rd->body); 439 rd->body_length = strlen (rd->body);
438 rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR; 440 rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR;
439 } 441 }
440 else 442 else
441 { 443 {
442 rd->body = make_json ("error", "false", 444 rd->body = make_json ("error", "false",
443 "message", _ ("no errors")); 445 "message", _ ("no errors"),
446 NULL);
444 rd->body_length = strlen (rd->body); 447 rd->body_length = strlen (rd->body);
445 rd->code = MHD_HTTP_OK; 448 rd->code = MHD_HTTP_OK;
446 } 449 }
@@ -481,7 +484,8 @@ register_do_cb (void *cls,
481 MHD_resume_connection (rd->c); 484 MHD_resume_connection (rd->c);
482 rd->searching = NULL; 485 rd->searching = NULL;
483 rd->body = make_json ("error", "true", 486 rd->body = make_json ("error", "true",
484 "message", _ ("key exists")); 487 "message", _ ("key exists"),
488 NULL);
485 rd->body_length = strlen (rd->body); 489 rd->body_length = strlen (rd->body);
486 rd->code = MHD_HTTP_FORBIDDEN; 490 rd->code = MHD_HTTP_FORBIDDEN;
487 run_httpd_now (); 491 run_httpd_now ();
@@ -501,7 +505,8 @@ register_do_cb (void *cls,
501 MHD_resume_connection (rd->c); 505 MHD_resume_connection (rd->c);
502 rd->searching = NULL; 506 rd->searching = NULL;
503 rd->body = make_json ("error", "true", 507 rd->body = make_json ("error", "true",
504 "message", _ ("unable to store record")); 508 "message", _ ("unable to store record"),
509 NULL);
505 rd->body_length = strlen (rd->body); 510 rd->body_length = strlen (rd->body);
506 rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR; 511 rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR;
507 run_httpd_now (); 512 run_httpd_now ();
@@ -536,7 +541,8 @@ iterate_error_cb (void *cls)
536 MHD_resume_connection (rd->c); 541 MHD_resume_connection (rd->c);
537 rd->iterating = NULL; 542 rd->iterating = NULL;
538 rd->body = make_json ("error", "true", 543 rd->body = make_json ("error", "true",
539 "message", _ ("unable to scan namestore")); 544 "message", _ ("unable to scan namestore"),
545 NULL);
540 rd->body_length = strlen (rd->body); 546 rd->body_length = strlen (rd->body);
541 rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR; 547 rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR;
542 run_httpd_now (); 548 run_httpd_now ();
@@ -574,7 +580,8 @@ iterate_do_cb (void *cls,
574 580
575 MHD_resume_connection (rd->c); 581 MHD_resume_connection (rd->c);
576 rd->body = make_json ("error", "true", 582 rd->body = make_json ("error", "true",
577 "message", _ ("name exists\n")); 583 "message", _ ("name exists\n"),
584 NULL);
578 rd->body_length = strlen (rd->body); 585 rd->body_length = strlen (rd->body);
579 rd->code = MHD_HTTP_FORBIDDEN; 586 rd->code = MHD_HTTP_FORBIDDEN;
580 GNUNET_NAMESTORE_zone_iteration_stop (rd->iterating); 587 GNUNET_NAMESTORE_zone_iteration_stop (rd->iterating);
@@ -756,13 +763,15 @@ create_response (void *cls,
756 case GNUNET_JSON_PR_OUT_OF_MEMORY: 763 case GNUNET_JSON_PR_OUT_OF_MEMORY:
757 case GNUNET_JSON_PR_REQUEST_TOO_LARGE: 764 case GNUNET_JSON_PR_REQUEST_TOO_LARGE:
758 rd->body = make_json ("error", "true", 765 rd->body = make_json ("error", "true",
759 "message", _ ("unable to process submitted data")); 766 "message", _ ("unable to process submitted data"),
767 NULL);
760 rd->body_length = strlen (rd->body); 768 rd->body_length = strlen (rd->body);
761 rd->code = MHD_HTTP_PAYLOAD_TOO_LARGE; 769 rd->code = MHD_HTTP_PAYLOAD_TOO_LARGE;
762 return MHD_YES; 770 return MHD_YES;
763 case GNUNET_JSON_PR_JSON_INVALID: 771 case GNUNET_JSON_PR_JSON_INVALID:
764 rd->body = make_json ("error", "true", 772 rd->body = make_json ("error", "true",
765 "message", _ ("the submitted data is invalid")); 773 "message", _ ("the submitted data is invalid"),
774 NULL);
766 rd->body_length = strlen (rd->body); 775 rd->body_length = strlen (rd->body);
767 rd->code = MHD_HTTP_BAD_REQUEST; 776 rd->code = MHD_HTTP_BAD_REQUEST;
768 return MHD_YES; 777 return MHD_YES;
@@ -778,7 +787,8 @@ create_response (void *cls,
778 { 787 {
779 json_decref (json); 788 json_decref (json);
780 rd->body = make_json ("error", "true", 789 rd->body = make_json ("error", "true",
781 "message", _ ("invalid parameters")); 790 "message", _ ("invalid parameters"),
791 NULL);
782 rd->body_length = strlen (rd->body); 792 rd->body_length = strlen (rd->body);
783 rd->code = MHD_HTTP_BAD_REQUEST; 793 rd->code = MHD_HTTP_BAD_REQUEST;
784 return MHD_YES; 794 return MHD_YES;
@@ -794,9 +804,11 @@ create_response (void *cls,
794 NULL != strchr (rd->register_name, '+')) 804 NULL != strchr (rd->register_name, '+'))
795 { 805 {
796 rd->body = make_json ("error", "true", 806 rd->body = make_json ("error", "true",
797 "message", _ ("invalid name")); 807 "message", _ ("invalid name"),
808 NULL);
798 rd->body_length = strlen (rd->body); 809 rd->body_length = strlen (rd->body);
799 rd->code = MHD_HTTP_BAD_REQUEST; 810 rd->code = MHD_HTTP_BAD_REQUEST;
811 return MHD_YES;
800 } 812 }
801 813
802 if (GNUNET_OK != GNUNET_IDENTITY_public_key_from_string (rd->register_key, 814 if (GNUNET_OK != GNUNET_IDENTITY_public_key_from_string (rd->register_key,
@@ -807,7 +819,8 @@ create_response (void *cls,
807 rd->register_key); 819 rd->register_key);
808 820
809 rd->body = make_json ("error", "true", 821 rd->body = make_json ("error", "true",
810 "message", _ ("unable to parse key")); 822 "message", _ ("unable to parse key"),
823 NULL);
811 rd->body_length = strlen (rd->body); 824 rd->body_length = strlen (rd->body);
812 rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR; 825 rd->code = MHD_HTTP_INTERNAL_SERVER_ERROR;
813 return MHD_YES; 826 return MHD_YES;