aboutsummaryrefslogtreecommitdiff
path: root/src/social
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2016-06-06 20:00:23 +0000
committerGabor X Toth <*@tg-x.net>2016-06-06 20:00:23 +0000
commiteaddede2ab93ecd09f4bb9514e682a2165b67718 (patch)
tree50c2f076dc9d526f987f4d10a1e5cae5c6b72bd8 /src/social
parent24063cff9c2e4ba0196d2c63e7a1485e1425a11c (diff)
downloadgnunet-eaddede2ab93ecd09f4bb9514e682a2165b67718.tar.gz
gnunet-eaddede2ab93ecd09f4bb9514e682a2165b67718.zip
fixes
Diffstat (limited to 'src/social')
-rw-r--r--src/social/gnunet-service-social.c18
-rw-r--r--src/social/gnunet-social.c7
-rw-r--r--src/social/social_api.c9
-rw-r--r--src/social/test_social.c7
4 files changed, 30 insertions, 11 deletions
diff --git a/src/social/gnunet-service-social.c b/src/social/gnunet-service-social.c
index 079f1961c..6c57fed31 100644
--- a/src/social/gnunet-service-social.c
+++ b/src/social/gnunet-service-social.c
@@ -841,7 +841,7 @@ place_recv_relay_method (void *cls,
841 struct Place *plc = cls; 841 struct Place *plc = cls;
842 842
843 if (GNUNET_PSYC_MESSAGE_REQUEST & ntohs (msg->flags) 843 if (GNUNET_PSYC_MESSAGE_REQUEST & ntohs (msg->flags)
844 && GNUNET_YES == plc->is_host); 844 && GNUNET_YES == plc->is_host)
845 { 845 {
846 struct Host *hst = cls; 846 struct Host *hst = cls;
847 host_relay_message_part (hst, &meth->header, &msg->slave_pub_key); 847 host_relay_message_part (hst, &meth->header, &msg->slave_pub_key);
@@ -866,7 +866,7 @@ place_recv_relay_modifier (void *cls,
866 struct Place *plc = cls; 866 struct Place *plc = cls;
867 867
868 if (GNUNET_PSYC_MESSAGE_REQUEST & ntohs (msg->flags) 868 if (GNUNET_PSYC_MESSAGE_REQUEST & ntohs (msg->flags)
869 && GNUNET_YES == plc->is_host); 869 && GNUNET_YES == plc->is_host)
870 { 870 {
871 struct Host *hst = cls; 871 struct Host *hst = cls;
872 host_relay_message_part (hst, pmsg, &msg->slave_pub_key); 872 host_relay_message_part (hst, pmsg, &msg->slave_pub_key);
@@ -887,7 +887,7 @@ place_recv_relay_data (void *cls,
887 struct Place *plc = cls; 887 struct Place *plc = cls;
888 888
889 if (GNUNET_PSYC_MESSAGE_REQUEST & ntohs (msg->flags) 889 if (GNUNET_PSYC_MESSAGE_REQUEST & ntohs (msg->flags)
890 && GNUNET_YES == plc->is_host); 890 && GNUNET_YES == plc->is_host)
891 { 891 {
892 struct Host *hst = cls; 892 struct Host *hst = cls;
893 host_relay_message_part (hst, pmsg, &msg->slave_pub_key); 893 host_relay_message_part (hst, pmsg, &msg->slave_pub_key);
@@ -908,7 +908,7 @@ place_recv_relay_eom (void *cls,
908 struct Place *plc = cls; 908 struct Place *plc = cls;
909 909
910 if (GNUNET_PSYC_MESSAGE_REQUEST & ntohs (msg->flags) 910 if (GNUNET_PSYC_MESSAGE_REQUEST & ntohs (msg->flags)
911 && GNUNET_YES == plc->is_host); 911 && GNUNET_YES == plc->is_host)
912 { 912 {
913 struct Host *hst = cls; 913 struct Host *hst = cls;
914 host_relay_message_part (hst, pmsg, &msg->slave_pub_key); 914 host_relay_message_part (hst, pmsg, &msg->slave_pub_key);
@@ -1599,6 +1599,7 @@ guest_enter (const struct GuestEnterRequest *greq, struct Guest **ret_gst)
1599 uint16_t relay_size = gst->relay_count * sizeof (*relays); 1599 uint16_t relay_size = gst->relay_count * sizeof (*relays);
1600 if (remaining < relay_size) 1600 if (remaining < relay_size)
1601 { 1601 {
1602 GNUNET_free (gst);
1602 GNUNET_break (0); 1603 GNUNET_break (0);
1603 return GNUNET_SYSERR; 1604 return GNUNET_SYSERR;
1604 } 1605 }
@@ -1858,6 +1859,7 @@ client_recv_guest_enter_by_name (void *cls, struct GNUNET_SERVER_Client *client,
1858 { 1859 {
1859 if (NULL != gcls->join_msg) 1860 if (NULL != gcls->join_msg)
1860 GNUNET_free (gcls->join_msg); 1861 GNUNET_free (gcls->join_msg);
1862 GNUNET_free (gcls);
1861 GNUNET_break (0); 1863 GNUNET_break (0);
1862 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); 1864 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
1863 return; 1865 return;
@@ -2895,6 +2897,8 @@ psyc_recv_history_message (void *cls, const struct GNUNET_PSYC_MessageHeader *ms
2895 2897
2896 /** @todo FIXME: send only to requesting client */ 2898 /** @todo FIXME: send only to requesting client */
2897 place_send_msg (plc, &res->header); 2899 place_send_msg (plc, &res->header);
2900
2901 GNUNET_free (res);
2898} 2902}
2899 2903
2900 2904
@@ -3001,6 +3005,8 @@ psyc_recv_state_var (void *cls,
3001 3005
3002 /** @todo FIXME: send only to requesting client */ 3006 /** @todo FIXME: send only to requesting client */
3003 place_send_msg (plc, &res->header); 3007 place_send_msg (plc, &res->header);
3008
3009 GNUNET_free (res);
3004} 3010}
3005 3011
3006 3012
@@ -3304,10 +3310,14 @@ file_place_load (void *cls, const char *place_filename)
3304 if (GNUNET_OK != 3310 if (GNUNET_OK !=
3305 GNUNET_DISK_file_size (filename, &file_size, GNUNET_YES, GNUNET_YES) 3311 GNUNET_DISK_file_size (filename, &file_size, GNUNET_YES, GNUNET_YES)
3306 || file_size < sizeof (struct PlaceEnterRequest)) 3312 || file_size < sizeof (struct PlaceEnterRequest))
3313 {
3314 GNUNET_free (filename);
3307 return GNUNET_OK; 3315 return GNUNET_OK;
3316 }
3308 3317
3309 struct PlaceEnterRequest *ereq = GNUNET_malloc (file_size); 3318 struct PlaceEnterRequest *ereq = GNUNET_malloc (file_size);
3310 ssize_t read_size = GNUNET_DISK_fn_read (filename, ereq, file_size); 3319 ssize_t read_size = GNUNET_DISK_fn_read (filename, ereq, file_size);
3320 GNUNET_free (filename);
3311 if (read_size < 0 || read_size < sizeof (*ereq)) 3321 if (read_size < 0 || read_size < sizeof (*ereq))
3312 { 3322 {
3313 GNUNET_free (ereq); 3323 GNUNET_free (ereq);
diff --git a/src/social/gnunet-social.c b/src/social/gnunet-social.c
index b7a1314c2..a6ea772e7 100644
--- a/src/social/gnunet-social.c
+++ b/src/social/gnunet-social.c
@@ -1148,9 +1148,10 @@ run (void *cls, char *const *args, const char *cfgfile,
1148 1148
1149 if (opt_ego) 1149 if (opt_ego)
1150 { 1150 {
1151 GNUNET_CRYPTO_ecdsa_public_key_from_string (opt_ego, 1151 GNUNET_assert (GNUNET_OK ==
1152 strlen (opt_ego), 1152 GNUNET_CRYPTO_ecdsa_public_key_from_string (opt_ego,
1153 &ego_pub_key); 1153 strlen (opt_ego),
1154 &ego_pub_key));
1154 } 1155 }
1155 1156
1156 core = GNUNET_CORE_connect (cfg, NULL, &core_connected, NULL, NULL, 1157 core = GNUNET_CORE_connect (cfg, NULL, &core_connected, NULL, NULL,
diff --git a/src/social/social_api.c b/src/social/social_api.c
index e590f7856..3a57af5dd 100644
--- a/src/social/social_api.c
+++ b/src/social/social_api.c
@@ -411,6 +411,7 @@ host_recv_notice_place_leave_method (void *cls,
411 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 411 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
412 "_notice_place_leave: got method from nym %s (%s).\n", 412 "_notice_place_leave: got method from nym %s (%s).\n",
413 GNUNET_h2s (&hst->notice_place_leave_nym->pub_key_hash), str); 413 GNUNET_h2s (&hst->notice_place_leave_nym->pub_key_hash), str);
414 GNUNET_free (str);
414} 415}
415 416
416 417
@@ -459,6 +460,7 @@ host_recv_notice_place_leave_eom (void *cls,
459 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 460 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
460 "_notice_place_leave: got EOM from nym %s (%s).\n", 461 "_notice_place_leave: got EOM from nym %s (%s).\n",
461 GNUNET_h2s (&hst->notice_place_leave_nym->pub_key_hash), str); 462 GNUNET_h2s (&hst->notice_place_leave_nym->pub_key_hash), str);
463 GNUNET_free (str);
462 464
463 if (GNUNET_YES != is_cancelled) 465 if (GNUNET_YES != is_cancelled)
464 { 466 {
@@ -1355,14 +1357,17 @@ GNUNET_SOCIAL_host_entry_decision (struct GNUNET_SOCIAL_Host *hst,
1355void 1357void
1356GNUNET_SOCIAL_host_eject (struct GNUNET_SOCIAL_Host *hst, 1358GNUNET_SOCIAL_host_eject (struct GNUNET_SOCIAL_Host *hst,
1357 const struct GNUNET_SOCIAL_Nym *nym, 1359 const struct GNUNET_SOCIAL_Nym *nym,
1358 struct GNUNET_PSYC_Environment *env) 1360 struct GNUNET_PSYC_Environment *e)
1359{ 1361{
1362 struct GNUNET_PSYC_Environment *env = e;
1360 if (NULL == env) 1363 if (NULL == env)
1361 env = GNUNET_PSYC_env_create (); 1364 env = GNUNET_PSYC_env_create ();
1362 GNUNET_PSYC_env_add (env, GNUNET_PSYC_OP_SET, 1365 GNUNET_PSYC_env_add (env, GNUNET_PSYC_OP_SET,
1363 "_nym", &nym->pub_key, sizeof (nym->pub_key)); 1366 "_nym", &nym->pub_key, sizeof (nym->pub_key));
1364 GNUNET_SOCIAL_host_announce (hst, "_notice_place_leave", env, NULL, NULL, 1367 GNUNET_SOCIAL_host_announce (hst, "_notice_place_leave", env, NULL, NULL,
1365 GNUNET_SOCIAL_ANNOUNCE_NONE); 1368 GNUNET_SOCIAL_ANNOUNCE_NONE);
1369 if (NULL == e)
1370 GNUNET_PSYC_env_destroy (env);
1366} 1371}
1367 1372
1368 1373
@@ -1749,7 +1754,7 @@ GNUNET_SOCIAL_guest_enter_by_name (const struct GNUNET_SOCIAL_App *app,
1749 uint16_t password_size = strlen (password) + 1; 1754 uint16_t password_size = strlen (password) + 1;
1750 1755
1751 uint16_t join_msg_size = 0; 1756 uint16_t join_msg_size = 0;
1752 if (NULL != join_msg); 1757 if (NULL != join_msg)
1753 join_msg_size = ntohs (join_msg->header.size); 1758 join_msg_size = ntohs (join_msg->header.size);
1754 1759
1755 uint16_t greq_size = sizeof (struct GuestEnterByNameRequest) 1760 uint16_t greq_size = sizeof (struct GuestEnterByNameRequest)
diff --git a/src/social/test_social.c b/src/social/test_social.c
index 14bcac7a1..dd38a2920 100644
--- a/src/social/test_social.c
+++ b/src/social/test_social.c
@@ -463,10 +463,11 @@ app_recv_ego (void *cls,
463 const struct GNUNET_CRYPTO_EcdsaPublicKey *ego_pub_key, 463 const struct GNUNET_CRYPTO_EcdsaPublicKey *ego_pub_key,
464 const char *name) 464 const char *name)
465{ 465{
466 char *ego_pub_str = GNUNET_CRYPTO_ecdsa_public_key_to_string (ego_pub_key);
466 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 467 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
467 "Got app ego notification: %p %s %s\n", 468 "Got app ego notification: %p %s %s\n",
468 ego, name, 469 ego, name, ego_pub_str);
469 GNUNET_CRYPTO_ecdsa_public_key_to_string (ego_pub_key)); 470 GNUNET_free (ego_pub_str);
470 471
471 if (NULL != strstr (name, host_name) && TEST_HOST_CREATE == test) 472 if (NULL != strstr (name, host_name) && TEST_HOST_CREATE == test)
472 { 473 {
@@ -1097,6 +1098,8 @@ host_answer_door (void *cls,
1097 1098
1098 case TEST_HOST_ANSWER_DOOR_ADMIT: 1099 case TEST_HOST_ANSWER_DOOR_ADMIT:
1099 test = TEST_GUEST_RECV_ENTRY_DCSN_ADMIT; 1100 test = TEST_GUEST_RECV_ENTRY_DCSN_ADMIT;
1101 // fall through
1102
1100 case TEST_GUEST_ENTER_BY_NAME: 1103 case TEST_GUEST_ENTER_BY_NAME:
1101 join_resp = GNUNET_PSYC_message_create ("_notice_place_admit", env, 1104 join_resp = GNUNET_PSYC_message_create ("_notice_place_admit", env,
1102 DATA2ARG ("Welcome, nym!")); 1105 DATA2ARG ("Welcome, nym!"));