aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-06 12:05:24 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-06 12:05:24 +0000
commit8675d5f1a8906b4255562f878e140acc0ee8fafc (patch)
tree40f140e61d6b2a5212d2aa94b7379ec0d9f03494 /src
parent3a56bf7aa7e6de7d096cb509054b5dab1e50d119 (diff)
downloadgnunet-8675d5f1a8906b4255562f878e140acc0ee8fafc.tar.gz
gnunet-8675d5f1a8906b4255562f878e140acc0ee8fafc.zip
-misc fixes
Diffstat (limited to 'src')
-rw-r--r--src/fs/gnunet-publish.c3
-rw-r--r--src/gns/gnunet-service-gns_resolver.c12
-rw-r--r--src/hostlist/hostlist-server.c1
-rw-r--r--src/identity/gnunet-identity.c3
-rw-r--r--src/include/gnunet_namestore_service.h6
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c37
-rw-r--r--src/namestore/gnunet-service-namestore.c2
-rw-r--r--src/namestore/namestore_api_common.c5
-rw-r--r--src/regex/regex_api.c8
9 files changed, 51 insertions, 26 deletions
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index f621140cd..58beb371c 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -669,6 +669,7 @@ identity_continuation (const char *args0)
669 _("Failed to access `%s': %s\n"), 669 _("Failed to access `%s': %s\n"),
670 args0, 670 args0,
671 STRERROR (errno)); 671 STRERROR (errno));
672 GNUNET_free_non_null (ex);
672 return; 673 return;
673 } 674 }
674 ds = GNUNET_FS_directory_scan_start (args0, 675 ds = GNUNET_FS_directory_scan_start (args0,
@@ -679,8 +680,10 @@ identity_continuation (const char *args0)
679 { 680 {
680 FPRINTF (stderr, 681 FPRINTF (stderr,
681 "%s", _("Failed to start meta directory scanner. Is gnunet-helper-publish-fs installed?\n")); 682 "%s", _("Failed to start meta directory scanner. Is gnunet-helper-publish-fs installed?\n"));
683 GNUNET_free_non_null (ex);
682 return; 684 return;
683 } 685 }
686 GNUNET_free_non_null (ex);
684} 687}
685 688
686 689
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index dd893c6b3..458e21b9d 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -727,6 +727,7 @@ dns_result_parser (void *cls,
727 GNUNET_free (rh->name); 727 GNUNET_free (rh->name);
728 rh->name = GNUNET_strdup (p->answers[0].data.hostname); 728 rh->name = GNUNET_strdup (p->answers[0].data.hostname);
729 start_resolver_lookup (rh); 729 start_resolver_lookup (rh);
730 GNUNET_DNSPARSER_free_packet (p);
730 return; 731 return;
731 } 732 }
732 /* FIXME: add DNAME support */ 733 /* FIXME: add DNAME support */
@@ -1195,8 +1196,8 @@ handle_gns_resolution_result (void *cls,
1195 rd_new[rd_off].data_size = scratch_off - scratch_start; 1196 rd_new[rd_off].data_size = scratch_off - scratch_start;
1196 rd_off++; 1197 rd_off++;
1197 } 1198 }
1198 GNUNET_free (cname);
1199 } 1199 }
1200 GNUNET_free_non_null (cname);
1200 } 1201 }
1201 break; 1202 break;
1202 case GNUNET_DNSPARSER_TYPE_SOA: 1203 case GNUNET_DNSPARSER_TYPE_SOA:
@@ -1231,8 +1232,9 @@ handle_gns_resolution_result (void *cls,
1231 rd_new[rd_off].data_size = scratch_off - scratch_start; 1232 rd_new[rd_off].data_size = scratch_off - scratch_start;
1232 rd_off++; 1233 rd_off++;
1233 } 1234 }
1234 GNUNET_DNSPARSER_free_soa (soa);
1235 } 1235 }
1236 if (NULL != soa)
1237 GNUNET_DNSPARSER_free_soa (soa);
1236 } 1238 }
1237 break; 1239 break;
1238 case GNUNET_DNSPARSER_TYPE_MX: 1240 case GNUNET_DNSPARSER_TYPE_MX:
@@ -1266,8 +1268,9 @@ handle_gns_resolution_result (void *cls,
1266 rd_new[rd_off].data_size = scratch_off - scratch_start; 1268 rd_new[rd_off].data_size = scratch_off - scratch_start;
1267 rd_off++; 1269 rd_off++;
1268 } 1270 }
1269 GNUNET_DNSPARSER_free_mx (mx);
1270 } 1271 }
1272 if (NULL != mx)
1273 GNUNET_DNSPARSER_free_mx (mx);
1271 } 1274 }
1272 break; 1275 break;
1273 case GNUNET_DNSPARSER_TYPE_SRV: 1276 case GNUNET_DNSPARSER_TYPE_SRV:
@@ -1305,8 +1308,9 @@ handle_gns_resolution_result (void *cls,
1305 rd_new[rd_off].data_size = scratch_off - scratch_start; 1308 rd_new[rd_off].data_size = scratch_off - scratch_start;
1306 rd_off++; 1309 rd_off++;
1307 } 1310 }
1308 GNUNET_DNSPARSER_free_srv (srv);
1309 } 1311 }
1312 if (NULL != srv)
1313 GNUNET_DNSPARSER_free_srv (srv);
1310 } 1314 }
1311 break; 1315 break;
1312 case GNUNET_NAMESTORE_TYPE_PKEY: 1316 case GNUNET_NAMESTORE_TYPE_PKEY:
diff --git a/src/hostlist/hostlist-server.c b/src/hostlist/hostlist-server.c
index 031c7a13e..d888c89b3 100644
--- a/src/hostlist/hostlist-server.c
+++ b/src/hostlist/hostlist-server.c
@@ -634,6 +634,7 @@ GNUNET_HOSTLIST_server_start (const struct GNUNET_CONFIGURATION_Handle *c,
634 ip); 634 ip);
635 sa = NULL; 635 sa = NULL;
636 } 636 }
637 GNUNET_free (ip);
637 } 638 }
638 else 639 else
639 sa = NULL; 640 sa = NULL;
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c
index c1803ea1d..5e4288f89 100644
--- a/src/identity/gnunet-identity.c
+++ b/src/identity/gnunet-identity.c
@@ -264,10 +264,13 @@ print_ego (void *cls,
264 } 264 }
265 if (! (list | monitor)) 265 if (! (list | monitor))
266 return; 266 return;
267 if (NULL == ego)
268 return;
267 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 269 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
268 s = GNUNET_CRYPTO_ecc_public_key_to_string (&pk); 270 s = GNUNET_CRYPTO_ecc_public_key_to_string (&pk);
269 if ( (monitor) || (NULL != identifier) ) 271 if ( (monitor) || (NULL != identifier) )
270 fprintf (stderr, "%s - %s\n", identifier, s); 272 fprintf (stderr, "%s - %s\n", identifier, s);
273 GNUNET_free (s);
271} 274}
272 275
273 276
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h
index 99fc7dcd1..8982df2bc 100644
--- a/src/include/gnunet_namestore_service.h
+++ b/src/include/gnunet_namestore_service.h
@@ -327,9 +327,9 @@ GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h,
327 * Process a record that was stored in the namestore. 327 * Process a record that was stored in the namestore.
328 * 328 *
329 * @param cls closure 329 * @param cls closure
330 * @param zone private key of the zone 330 * @param zone private key of the zone; NULL on disconnect
331 * @param label label of the records 331 * @param label label of the records; NULL on disconnect
332 * @param rd_count number of entries in @a rd array 332 * @param rd_count number of entries in @a rd array, 0 if label was deleted
333 * @param rd array of records with data to store 333 * @param rd array of records with data to store
334 */ 334 */
335typedef void (*GNUNET_NAMESTORE_RecordMonitor) (void *cls, 335typedef void (*GNUNET_NAMESTORE_RecordMonitor) (void *cls,
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c
index c0b9f4da6..041b046ba 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -23,6 +23,8 @@
23 * @author Christian Grothoff 23 * @author Christian Grothoff
24 * 24 *
25 * TODO: 25 * TODO:
26 * - need to track active zone info requests so we can cancel them
27 * during shutdown, right?
26 * - the code currently contains a 'race' between checking that the 28 * - the code currently contains a 'race' between checking that the
27 * domain name is available and allocating it to the new public key 29 * domain name is available and allocating it to the new public key
28 * (should this race be solved by namestore or by fcfsd?) 30 * (should this race be solved by namestore or by fcfsd?)
@@ -921,6 +923,8 @@ identity_cb (void *cls,
921 void **ctx, 923 void **ctx,
922 const char *name) 924 const char *name)
923{ 925{
926 int options;
927
924 id_op = NULL; 928 id_op = NULL;
925 if (NULL == ego) 929 if (NULL == ego)
926 { 930 {
@@ -930,21 +934,24 @@ identity_cb (void *cls,
930 } 934 }
931 fcfs_zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego); 935 fcfs_zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego);
932 936
933 937 options = MHD_USE_DUAL_STACK | MHD_USE_DEBUG;
934 httpd = MHD_start_daemon ( 938 do
935#ifdef MHD_USE_DUAL_STACK 939 {
936 MHD_USE_DUAL_STACK | 940 httpd = MHD_start_daemon (options,
937#endif 941 (uint16_t) port,
938 MHD_USE_DEBUG, 942 NULL, NULL,
939 (uint16_t) port, 943 &create_response, NULL,
940 NULL, NULL, 944 MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 128,
941 &create_response, NULL, 945 MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 1,
942 MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 128, 946 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16,
943 MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 1, 947 MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 * 1024),
944 MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16, 948 MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL,
945 MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 * 1024), 949 MHD_OPTION_END);
946 MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL, 950 if (MHD_USE_DEBUG == options)
947 MHD_OPTION_END); 951 break;
952 options = MHD_USE_DEBUG;
953 }
954 while (NULL == httpd);
948 if (NULL == httpd) 955 if (NULL == httpd)
949 { 956 {
950 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 957 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index a1ce120d8..b58f43613 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -752,7 +752,7 @@ handle_zone_to_name_it (void *cls,
752 "Found result for zone-to-name lookup: `%s'\n", 752 "Found result for zone-to-name lookup: `%s'\n",
753 name); 753 name);
754 res = GNUNET_YES; 754 res = GNUNET_YES;
755 name_len = strlen (name) + 1; 755 name_len = (NULL == name) ? 0 : strlen (name) + 1;
756 rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); 756 rd_ser_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd);
757 msg_size = sizeof (struct ZoneToNameResponseMessage) + name_len + rd_ser_len; 757 msg_size = sizeof (struct ZoneToNameResponseMessage) + name_len + rd_ser_len;
758 if (msg_size >= GNUNET_SERVER_MAX_MESSAGE_SIZE) 758 if (msg_size >= GNUNET_SERVER_MAX_MESSAGE_SIZE)
diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c
index 3094d1aad..1956d420e 100644
--- a/src/namestore/namestore_api_common.c
+++ b/src/namestore/namestore_api_common.c
@@ -450,8 +450,8 @@ GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
450 struct GNUNET_CRYPTO_AesInitializationVector iv; 450 struct GNUNET_CRYPTO_AesInitializationVector iv;
451 struct GNUNET_CRYPTO_AesSessionKey skey; 451 struct GNUNET_CRYPTO_AesSessionKey skey;
452 452
453 if (ntohl (block->purpose.size) < 453 if (ntohl (block->purpose.size) <
454 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) - 454 sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
455 sizeof (struct GNUNET_TIME_AbsoluteNBO)) 455 sizeof (struct GNUNET_TIME_AbsoluteNBO))
456 { 456 {
457 GNUNET_break_op (0); 457 GNUNET_break_op (0);
@@ -979,6 +979,7 @@ GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicKey *pkey)
979 &pkeys[slen / 2], 979 &pkeys[slen / 2],
980 (int) (slen / 2), 980 (int) (slen / 2),
981 pkeys); 981 pkeys);
982 GNUNET_free (pkeys);
982 return ret; 983 return ret;
983} 984}
984 985
diff --git a/src/regex/regex_api.c b/src/regex/regex_api.c
index b22d78b90..afc028cdb 100644
--- a/src/regex/regex_api.c
+++ b/src/regex/regex_api.c
@@ -134,7 +134,10 @@ GNUNET_REGEX_announce (const struct GNUNET_CONFIGURATION_Handle *cfg,
134 a->cfg = cfg; 134 a->cfg = cfg;
135 a->client = GNUNET_CLIENT_connect ("regex", cfg); 135 a->client = GNUNET_CLIENT_connect ("regex", cfg);
136 if (NULL == a->client) 136 if (NULL == a->client)
137 {
138 GNUNET_free (a);
137 return NULL; 139 return NULL;
140 }
138 a->msg.header.type = htons (GNUNET_MESSAGE_TYPE_REGEX_ANNOUNCE); 141 a->msg.header.type = htons (GNUNET_MESSAGE_TYPE_REGEX_ANNOUNCE);
139 a->msg.header.size = htons (slen + sizeof (struct AnnounceMessage)); 142 a->msg.header.size = htons (slen + sizeof (struct AnnounceMessage));
140 a->msg.compression = htons (compression); 143 a->msg.compression = htons (compression);
@@ -299,11 +302,14 @@ GNUNET_REGEX_search (const struct GNUNET_CONFIGURATION_Handle *cfg,
299 size_t slen; 302 size_t slen;
300 303
301 slen = strlen (string) + 1; 304 slen = strlen (string) + 1;
302 s = GNUNET_malloc (sizeof (struct GNUNET_REGEX_Search)); 305 s = GNUNET_new (struct GNUNET_REGEX_Search);
303 s->cfg = cfg; 306 s->cfg = cfg;
304 s->client = GNUNET_CLIENT_connect ("regex", cfg); 307 s->client = GNUNET_CLIENT_connect ("regex", cfg);
305 if (NULL == s->client) 308 if (NULL == s->client)
309 {
310 GNUNET_free (s);
306 return NULL; 311 return NULL;
312 }
307 s->callback = callback; 313 s->callback = callback;
308 s->callback_cls = callback_cls; 314 s->callback_cls = callback_cls;
309 s->msg = GNUNET_malloc (sizeof (struct SearchMessage) + slen); 315 s->msg = GNUNET_malloc (sizeof (struct SearchMessage) + slen);