diff options
author | t3sserakt <t3ss@posteo.de> | 2023-02-07 17:27:46 +0100 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2023-02-07 17:27:46 +0100 |
commit | 5f4f2527d94f5fddf9624344bbbb0262094f9816 (patch) | |
tree | 2e7d8be06bf2832398d40b99cdbc6641565f93cb | |
parent | fb61e1a7a5fbd7b8f696dd7b66b15ae7c35f9013 (diff) | |
parent | 35ca280a76340f52284378083d97701a459ff5fb (diff) | |
download | gnunet-5f4f2527d94f5fddf9624344bbbb0262094f9816.tar.gz gnunet-5f4f2527d94f5fddf9624344bbbb0262094f9816.zip |
Merge branch 'master' of ssh://git.gnunet.org/gnunet
81 files changed, 375 insertions, 180 deletions
@@ -1,2 +1,6 @@ | |||
1 | v0.19.2 (e9bc4c898): | 1 | v0.19.3: |
2 | - New changelog format origin \ No newline at end of file | 2 | - We now detect MySQL's strange, version-dependent my_bool type on configure. |
3 | - Add pkg-config definitions for gnunet messenger. | ||
4 | |||
5 | v0.19.2: | ||
6 | - New changelog format origin | ||
diff --git a/configure.ac b/configure.ac index 2bc9d0f2a..3e7b42a12 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -489,7 +489,7 @@ AC_ARG_ENABLE([gcc-hardening], | |||
489 | [AS_HELP_STRING([--enable-gcc-hardening], [enable compiler security checks])], | 489 | [AS_HELP_STRING([--enable-gcc-hardening], [enable compiler security checks])], |
490 | [AS_IF([test "x$enableval" = "xyes"], | 490 | [AS_IF([test "x$enableval" = "xyes"], |
491 | [CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all" | 491 | [CFLAGS="$CFLAGS -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector-all" |
492 | CFLAGS="$CFLAGS -fwrapv -fPIE -Wstacl-protector" | 492 | CFLAGS="$CFLAGS -fwrapv -fPIE -Wstack-protector" |
493 | CFLAGS="$CFLAGS --param ssp-buffer-size=1" | 493 | CFLAGS="$CFLAGS --param ssp-buffer-size=1" |
494 | LDFLAGS="$LDFLAGS -pie"])]) | 494 | LDFLAGS="$LDFLAGS -pie"])]) |
495 | 495 | ||
@@ -940,14 +940,12 @@ mysql_bool="bool" | |||
940 | AS_IF([test "x$mysql" = "xtrue"], | 940 | AS_IF([test "x$mysql" = "xtrue"], |
941 | [AC_MSG_CHECKING([for my_bool]) | 941 | [AC_MSG_CHECKING([for my_bool]) |
942 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( | 942 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM( |
943 | [[#include <mysql/mysql.h>]], | 943 | [[#include <mysql/mysql.h>] |
944 | [[#ifndef my_bool | 944 | [typedef int my_bool;]])], # Hint: this fails if my_bool is defined already |
945 | #no my_bool found | ||
946 | #endif]])], | ||
947 | [AC_MSG_RESULT([yes]) | ||
948 | mysql_bool="my_bool"], | ||
949 | [AC_MSG_RESULT([no]) | 945 | [AC_MSG_RESULT([no]) |
950 | mysql_bool="bool"])]) | 946 | mysql_bool="bool"], |
947 | [AC_MSG_RESULT([yes]) | ||
948 | mysql_bool="my_bool"])]) | ||
951 | 949 | ||
952 | AC_SUBST([mysql_bool]) | 950 | AC_SUBST([mysql_bool]) |
953 | 951 | ||
diff --git a/contrib/gana b/contrib/gana | |||
Subproject 79163ab6ea6f6cfe7f4311f91fb45c747b8c33d | Subproject 66228b8a4306f028d843d78fbfcca54260539ff | ||
diff --git a/contrib/scripts/Makefile.am b/contrib/scripts/Makefile.am index 4cbf955bf..398157f10 100644 --- a/contrib/scripts/Makefile.am +++ b/contrib/scripts/Makefile.am | |||
@@ -43,7 +43,6 @@ EXTRA_DIST = \ | |||
43 | find_typedefs.py \ | 43 | find_typedefs.py \ |
44 | pydmesg \ | 44 | pydmesg \ |
45 | visualize_stats.sh \ | 45 | visualize_stats.sh \ |
46 | changelog_delta.sh \ | ||
47 | debug \ | 46 | debug \ |
48 | build_cscope.sh \ | 47 | build_cscope.sh \ |
49 | lint/lint-man.sh \ | 48 | lint/lint-man.sh \ |
diff --git a/contrib/scripts/update_news.sh b/contrib/scripts/update_news.sh index 2ee5fa3dc..014ac8bd7 100644..100755 --- a/contrib/scripts/update_news.sh +++ b/contrib/scripts/update_news.sh | |||
@@ -4,10 +4,10 @@ if [ -z $NEW_VERSION ]; then | |||
4 | NEW_VERSION="Unreleased" | 4 | NEW_VERSION="Unreleased" |
5 | fi | 5 | fi |
6 | DELTA_SH="contrib/scripts/news_delta.sh" | 6 | DELTA_SH="contrib/scripts/news_delta.sh" |
7 | LASTHASH=$(head -n1 NEWS | cut -d " " -f 2 | tr -d \( | tr -d \) | tr -d :) | 7 | LASTVER=$(head -n1 NEWS | tr -d :) |
8 | 8 | ||
9 | echo "$NEW_VERSION ($(git rev-parse --short HEAD)):" > NEWS.delta || exit 1 | 9 | echo "$NEW_VERSION:" > NEWS.delta || exit 1 |
10 | $DELTA_SH $LASTHASH >> NEWS.delta || exit 1 | 10 | $DELTA_SH $LASTVER >> NEWS.delta || exit 1 |
11 | cp NEWS NEWS.bak || exit 1 | 11 | cp NEWS NEWS.bak || exit 1 |
12 | cat NEWS.delta > NEWS || exit 1 | 12 | cat NEWS.delta > NEWS || exit 1 |
13 | cat NEWS.bak >> NEWS || exit 1 | 13 | cat NEWS.bak >> NEWS || exit 1 |
diff --git a/contrib/sphinx b/contrib/sphinx | |||
Subproject 4f40b5deca02c8dc64ff6c73e6602e6abdd1bae | Subproject 9c5b9d9040d21542eff792e26624cf9669b127a | ||
diff --git a/src/consensus/gnunet-consensus-profiler.c b/src/consensus/gnunet-consensus-profiler.c index 07a536a2d..535837008 100644 --- a/src/consensus/gnunet-consensus-profiler.c +++ b/src/consensus/gnunet-consensus-profiler.c | |||
@@ -380,7 +380,7 @@ disconnect_adapter (void *cls, void *op_result) | |||
380 | /** | 380 | /** |
381 | * Callback to be called when the requested peer information is available | 381 | * Callback to be called when the requested peer information is available |
382 | * | 382 | * |
383 | * @param cb_cls the closure from GNUNET_TETSBED_peer_get_information() | 383 | * @param cb_cls the closure from GNUNET_TESTBED_peer_get_information() |
384 | * @param op the operation this callback corresponds to | 384 | * @param op the operation this callback corresponds to |
385 | * @param pinfo the result; will be NULL if the operation has failed | 385 | * @param pinfo the result; will be NULL if the operation has failed |
386 | * @param emsg error message if the operation has failed; will be NULL if the | 386 | * @param emsg error message if the operation has failed; will be NULL if the |
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c index eb5ca7c2b..099c6fa3b 100644 --- a/src/core/test_core_quota_compliance.c +++ b/src/core/test_core_quota_compliance.c | |||
@@ -530,6 +530,7 @@ process_hello (void *cls, | |||
530 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 530 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
531 | "Received (my) HELLO from transport service\n"); | 531 | "Received (my) HELLO from transport service\n"); |
532 | GNUNET_assert (message != NULL); | 532 | GNUNET_assert (message != NULL); |
533 | if (NULL != p->hello) GNUNET_free (p->hello); | ||
533 | p->hello = GNUNET_malloc (ntohs (message->size)); | 534 | p->hello = GNUNET_malloc (ntohs (message->size)); |
534 | GNUNET_memcpy (p->hello, message, ntohs (message->size)); | 535 | GNUNET_memcpy (p->hello, message, ntohs (message->size)); |
535 | if ((p == &p1) && | 536 | if ((p == &p1) && |
diff --git a/src/datacache/test_datacache.c b/src/datacache/test_datacache.c index fd5a5f54c..5392f6b17 100644 --- a/src/datacache/test_datacache.c +++ b/src/datacache/test_datacache.c | |||
@@ -198,6 +198,7 @@ main (int argc, char *argv[]) | |||
198 | fprintf (stderr, | 198 | fprintf (stderr, |
199 | "Missed some testcases: %d\n", | 199 | "Missed some testcases: %d\n", |
200 | ok); | 200 | ok); |
201 | GNUNET_free (plugin_name); | ||
201 | return ok; | 202 | return ok; |
202 | } | 203 | } |
203 | 204 | ||
diff --git a/src/datacache/test_datacache_quota.c b/src/datacache/test_datacache_quota.c index 994147a64..0ad7fb8a4 100644 --- a/src/datacache/test_datacache_quota.c +++ b/src/datacache/test_datacache_quota.c | |||
@@ -186,6 +186,7 @@ main (int argc, | |||
186 | fprintf (stderr, | 186 | fprintf (stderr, |
187 | "Missed some testcases: %d\n", | 187 | "Missed some testcases: %d\n", |
188 | ok); | 188 | ok); |
189 | GNUNET_free (plugin_name); | ||
189 | return ok; | 190 | return ok; |
190 | } | 191 | } |
191 | 192 | ||
diff --git a/src/dht/gnunet-dht-get.c b/src/dht/gnunet-dht-get.c index 1ae9235f8..02f04de26 100644 --- a/src/dht/gnunet-dht-get.c +++ b/src/dht/gnunet-dht-get.c | |||
@@ -284,6 +284,7 @@ run (void *cls, | |||
284 | int | 284 | int |
285 | main (int argc, char *const *argv) | 285 | main (int argc, char *const *argv) |
286 | { | 286 | { |
287 | char *u8_argv = NULL; | ||
287 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 288 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
288 | GNUNET_GETOPT_option_string ( | 289 | GNUNET_GETOPT_option_string ( |
289 | 'k', | 290 | 'k', |
@@ -341,6 +342,9 @@ main (int argc, char *const *argv) | |||
341 | NULL)) | 342 | NULL)) |
342 | ? ret | 343 | ? ret |
343 | : 1; | 344 | : 1; |
345 | // This is ugly, but meh. The GNUNET_STRINGS_get_utf8_args allows us to do this. | ||
346 | u8_argv = (char*) argv; | ||
347 | GNUNET_free (u8_argv); | ||
344 | } | 348 | } |
345 | 349 | ||
346 | 350 | ||
diff --git a/src/dht/gnunet-dht-put.c b/src/dht/gnunet-dht-put.c index 531107ef2..37e7911b5 100644 --- a/src/dht/gnunet-dht-put.c +++ b/src/dht/gnunet-dht-put.c | |||
@@ -179,6 +179,7 @@ run (void *cls, | |||
179 | int | 179 | int |
180 | main (int argc, char *const *argv) | 180 | main (int argc, char *const *argv) |
181 | { | 181 | { |
182 | char *u8_argv = NULL; | ||
182 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 183 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
183 | GNUNET_GETOPT_option_string ( | 184 | GNUNET_GETOPT_option_string ( |
184 | 'd', | 185 | 'd', |
@@ -244,6 +245,9 @@ main (int argc, char *const *argv) | |||
244 | NULL)) | 245 | NULL)) |
245 | ? ret | 246 | ? ret |
246 | : 1; | 247 | : 1; |
248 | // This is ugly, but meh. The GNUNET_STRINGS_get_utf8_args allows us to do this. | ||
249 | u8_argv = (char*) argv; | ||
250 | GNUNET_free (u8_argv); | ||
247 | } | 251 | } |
248 | 252 | ||
249 | 253 | ||
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index 823f046ed..8b8c54c67 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c | |||
@@ -1811,7 +1811,10 @@ GNUNET_FS_search_stop (struct GNUNET_FS_SearchContext *sc) | |||
1811 | { | 1811 | { |
1812 | GNUNET_assert (GNUNET_FS_uri_test_ksk (sc->uri)); | 1812 | GNUNET_assert (GNUNET_FS_uri_test_ksk (sc->uri)); |
1813 | for (i = 0; i < sc->uri->data.ksk.keywordCount; i++) | 1813 | for (i = 0; i < sc->uri->data.ksk.keywordCount; i++) |
1814 | { | ||
1814 | GNUNET_CONTAINER_multihashmap_destroy (sc->requests[i].results); | 1815 | GNUNET_CONTAINER_multihashmap_destroy (sc->requests[i].results); |
1816 | GNUNET_free (sc->requests[i].keyword); | ||
1817 | } | ||
1815 | } | 1818 | } |
1816 | GNUNET_free (sc->requests); | 1819 | GNUNET_free (sc->requests); |
1817 | GNUNET_free (sc->emsg); | 1820 | GNUNET_free (sc->emsg); |
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index b938e3593..f192c017d 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c | |||
@@ -691,7 +691,7 @@ GSF_iterate_pending_requests_ (GSF_PendingRequestIterator it, void *cls) | |||
691 | { | 691 | { |
692 | GNUNET_CONTAINER_multihashmap_iterate ( | 692 | GNUNET_CONTAINER_multihashmap_iterate ( |
693 | pr_map, | 693 | pr_map, |
694 | (GNUNET_CONTAINER_MulitHashMapIteratorCallback) it, | 694 | (GNUNET_CONTAINER_MultiHashMapIteratorCallback) it, |
695 | cls); | 695 | cls); |
696 | } | 696 | } |
697 | 697 | ||
diff --git a/src/gns/test_proxy.sh b/src/gns/test_proxy.sh index 720fe643d..bb63a436e 100755 --- a/src/gns/test_proxy.sh +++ b/src/gns/test_proxy.sh | |||
@@ -2,7 +2,7 @@ | |||
2 | # This file is in the public domain. | 2 | # This file is in the public domain. |
3 | TEST_DOMAIN="www.test" | 3 | TEST_DOMAIN="www.test" |
4 | GNUNET_TMP="$(gnunet-config -f -s PATHS -o GNUNET_TMP)" | 4 | GNUNET_TMP="$(gnunet-config -f -s PATHS -o GNUNET_TMP)" |
5 | PROXY_CACERT="$(gnunet-config -f -c test_gnunet_proxy.conf -s gns-proxy -o PROXY_CACERT)" | 5 | PROXY_CACERT="$(gnunet-config -f -c test_gns_proxy.conf -s gns-proxy -o PROXY_CACERT)" |
6 | 6 | ||
7 | # Delete old files before starting test | 7 | # Delete old files before starting test |
8 | rm -rf "$GNUNET_TMP/test-gnunet-gns-testing/" | 8 | rm -rf "$GNUNET_TMP/test-gnunet-gns-testing/" |
diff --git a/src/gnsrecord/test_gnsrecord_block_expiration.c b/src/gnsrecord/test_gnsrecord_block_expiration.c index 69f7f6aa1..3ef02e631 100644 --- a/src/gnsrecord/test_gnsrecord_block_expiration.c +++ b/src/gnsrecord/test_gnsrecord_block_expiration.c | |||
@@ -78,6 +78,7 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
78 | rd[1].expiration_time = expiration_abs_shadow.abs_value_us; | 78 | rd[1].expiration_time = expiration_abs_shadow.abs_value_us; |
79 | rd[1].record_type = TEST_RECORD_TYPE; | 79 | rd[1].record_type = TEST_RECORD_TYPE; |
80 | rd[1].data_size = TEST_RECORD_DATALEN; | 80 | rd[1].data_size = TEST_RECORD_DATALEN; |
81 | GNUNET_free (rd[1].data); | ||
81 | rd[1].data = GNUNET_malloc (TEST_RECORD_DATALEN); | 82 | rd[1].data = GNUNET_malloc (TEST_RECORD_DATALEN); |
82 | rd[1].flags = GNUNET_GNSRECORD_RF_SHADOW; | 83 | rd[1].flags = GNUNET_GNSRECORD_RF_SHADOW; |
83 | memset ((char *) rd[1].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); | 84 | memset ((char *) rd[1].data, TEST_RECORD_DATA, TEST_RECORD_DATALEN); |
@@ -86,6 +87,8 @@ run (void *cls, char *const *args, const char *cfgfile, | |||
86 | GNUNET_GNSRECORD_record_get_expiration_time (2, | 87 | GNUNET_GNSRECORD_record_get_expiration_time (2, |
87 | rd, | 88 | rd, |
88 | GNUNET_TIME_UNIT_ZERO_ABS).abs_value_us); | 89 | GNUNET_TIME_UNIT_ZERO_ABS).abs_value_us); |
90 | GNUNET_free (rd[0].data); | ||
91 | GNUNET_free (rd[1].data); | ||
89 | res = 0; | 92 | res = 0; |
90 | } | 93 | } |
91 | 94 | ||
diff --git a/src/gnsrecord/test_gnsrecord_crypto.c b/src/gnsrecord/test_gnsrecord_crypto.c index 5b1032f1e..92a7a9f1f 100644 --- a/src/gnsrecord/test_gnsrecord_crypto.c +++ b/src/gnsrecord/test_gnsrecord_crypto.c | |||
@@ -143,6 +143,8 @@ test_with_type (struct GNUNET_IDENTITY_PrivateKey *privkey) | |||
143 | s_name, | 143 | s_name, |
144 | &rd_decrypt_cb, | 144 | &rd_decrypt_cb, |
145 | NULL)); | 145 | NULL)); |
146 | for (int i = 0; i < RECORDS; i++) GNUNET_free(s_rd[i].data); | ||
147 | GNUNET_free (s_rd); | ||
146 | GNUNET_free (block); | 148 | GNUNET_free (block); |
147 | } | 149 | } |
148 | 150 | ||
diff --git a/src/hello/hello-ng.c b/src/hello/hello-ng.c index da3a069e0..9d77e4f80 100644 --- a/src/hello/hello-ng.c +++ b/src/hello/hello-ng.c | |||
@@ -169,9 +169,11 @@ GNUNET_HELLO_extract_address (const void *raw, | |||
169 | sig, | 169 | sig, |
170 | public_key)) | 170 | public_key)) |
171 | { | 171 | { |
172 | GNUNET_free (data); | ||
172 | GNUNET_break_op (0); | 173 | GNUNET_break_op (0); |
173 | return NULL; | 174 | return NULL; |
174 | } | 175 | } |
176 | GNUNET_free (data); | ||
175 | *mono_time = raw_mono_time; | 177 | *mono_time = raw_mono_time; |
176 | *nt = raw_nt; | 178 | *nt = raw_nt; |
177 | return GNUNET_strdup (raw_addr); | 179 | return GNUNET_strdup (raw_addr); |
diff --git a/src/hello/test_hello-ng.c b/src/hello/test_hello-ng.c index 4ace9439f..ef84e2425 100644 --- a/src/hello/test_hello-ng.c +++ b/src/hello/test_hello-ng.c | |||
@@ -31,6 +31,7 @@ main (int argc, | |||
31 | struct GNUNET_PeerIdentity pid; | 31 | struct GNUNET_PeerIdentity pid; |
32 | struct GNUNET_TIME_Absolute t = GNUNET_TIME_absolute_get (); | 32 | struct GNUNET_TIME_Absolute t = GNUNET_TIME_absolute_get (); |
33 | char *res; | 33 | char *res; |
34 | char *address; | ||
34 | size_t res_len; | 35 | size_t res_len; |
35 | enum GNUNET_NetworkType nt; | 36 | enum GNUNET_NetworkType nt; |
36 | 37 | ||
@@ -47,10 +48,13 @@ main (int argc, | |||
47 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 48 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
48 | "%s\n", res); | 49 | "%s\n", res); |
49 | GNUNET_assert (NULL != | 50 | GNUNET_assert (NULL != |
50 | GNUNET_HELLO_extract_address ((void**) res, | 51 | (address = |
52 | GNUNET_HELLO_extract_address ((void**) res, | ||
51 | res_len, | 53 | res_len, |
52 | &pid, | 54 | &pid, |
53 | &nt, | 55 | &nt, |
54 | &t)); | 56 | &t))); |
57 | GNUNET_free (address); | ||
58 | GNUNET_free (res); | ||
55 | return 0; | 59 | return 0; |
56 | } | 60 | } |
diff --git a/src/hello/test_hello-uri.c b/src/hello/test_hello-uri.c index 7e70d6763..01b6f2d8e 100644 --- a/src/hello/test_hello-uri.c +++ b/src/hello/test_hello-uri.c | |||
@@ -207,6 +207,7 @@ main (int argc, | |||
207 | url); | 207 | url); |
208 | GNUNET_free (url); | 208 | GNUNET_free (url); |
209 | } | 209 | } |
210 | GNUNET_HELLO_builder_free (b); | ||
210 | 211 | ||
211 | return 0; | 212 | return 0; |
212 | } | 213 | } |
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h index 02bd32330..ce1b8f296 100644 --- a/src/include/gnunet_container_lib.h +++ b/src/include/gnunet_container_lib.h | |||
@@ -401,7 +401,7 @@ enum GNUNET_CONTAINER_MultiHashMapOption | |||
401 | * #GNUNET_NO if not. | 401 | * #GNUNET_NO if not. |
402 | */ | 402 | */ |
403 | typedef enum GNUNET_GenericReturnValue | 403 | typedef enum GNUNET_GenericReturnValue |
404 | (*GNUNET_CONTAINER_MulitHashMapIteratorCallback)( | 404 | (*GNUNET_CONTAINER_MultiHashMapIteratorCallback)( |
405 | void *cls, | 405 | void *cls, |
406 | const struct GNUNET_HashCode *key, | 406 | const struct GNUNET_HashCode *key, |
407 | void *value); | 407 | void *value); |
@@ -580,7 +580,7 @@ GNUNET_CONTAINER_multihashmap_size ( | |||
580 | int | 580 | int |
581 | GNUNET_CONTAINER_multihashmap_iterate ( | 581 | GNUNET_CONTAINER_multihashmap_iterate ( |
582 | struct GNUNET_CONTAINER_MultiHashMap *map, | 582 | struct GNUNET_CONTAINER_MultiHashMap *map, |
583 | GNUNET_CONTAINER_MulitHashMapIteratorCallback it, | 583 | GNUNET_CONTAINER_MultiHashMapIteratorCallback it, |
584 | void *it_cls); | 584 | void *it_cls); |
585 | 585 | ||
586 | 586 | ||
@@ -650,7 +650,7 @@ int | |||
650 | GNUNET_CONTAINER_multihashmap_get_multiple ( | 650 | GNUNET_CONTAINER_multihashmap_get_multiple ( |
651 | struct GNUNET_CONTAINER_MultiHashMap *map, | 651 | struct GNUNET_CONTAINER_MultiHashMap *map, |
652 | const struct GNUNET_HashCode *key, | 652 | const struct GNUNET_HashCode *key, |
653 | GNUNET_CONTAINER_MulitHashMapIteratorCallback it, | 653 | GNUNET_CONTAINER_MultiHashMapIteratorCallback it, |
654 | void *it_cls); | 654 | void *it_cls); |
655 | 655 | ||
656 | 656 | ||
@@ -668,7 +668,7 @@ GNUNET_CONTAINER_multihashmap_get_multiple ( | |||
668 | unsigned int | 668 | unsigned int |
669 | GNUNET_CONTAINER_multihashmap_get_random ( | 669 | GNUNET_CONTAINER_multihashmap_get_random ( |
670 | const struct GNUNET_CONTAINER_MultiHashMap *map, | 670 | const struct GNUNET_CONTAINER_MultiHashMap *map, |
671 | GNUNET_CONTAINER_MulitHashMapIteratorCallback it, | 671 | GNUNET_CONTAINER_MultiHashMapIteratorCallback it, |
672 | void *it_cls); | 672 | void *it_cls); |
673 | 673 | ||
674 | 674 | ||
@@ -1550,7 +1550,7 @@ struct GNUNET_CONTAINER_MultiHashMap32Iterator; | |||
1550 | * #GNUNET_NO if not. | 1550 | * #GNUNET_NO if not. |
1551 | */ | 1551 | */ |
1552 | typedef enum GNUNET_GenericReturnValue | 1552 | typedef enum GNUNET_GenericReturnValue |
1553 | (*GNUNET_CONTAINER_MulitHashMapIterator32Callback)( | 1553 | (*GNUNET_CONTAINER_MultiHashMapIterator32Callback)( |
1554 | void *cls, | 1554 | void *cls, |
1555 | uint32_t key, | 1555 | uint32_t key, |
1556 | void *value); | 1556 | void *value); |
@@ -1621,7 +1621,7 @@ GNUNET_CONTAINER_multihashmap32_get ( | |||
1621 | int | 1621 | int |
1622 | GNUNET_CONTAINER_multihashmap32_iterate ( | 1622 | GNUNET_CONTAINER_multihashmap32_iterate ( |
1623 | struct GNUNET_CONTAINER_MultiHashMap32 *map, | 1623 | struct GNUNET_CONTAINER_MultiHashMap32 *map, |
1624 | GNUNET_CONTAINER_MulitHashMapIterator32Callback it, | 1624 | GNUNET_CONTAINER_MultiHashMapIterator32Callback it, |
1625 | void *it_cls); | 1625 | void *it_cls); |
1626 | 1626 | ||
1627 | 1627 | ||
@@ -1729,7 +1729,7 @@ int | |||
1729 | GNUNET_CONTAINER_multihashmap32_get_multiple ( | 1729 | GNUNET_CONTAINER_multihashmap32_get_multiple ( |
1730 | struct GNUNET_CONTAINER_MultiHashMap32 *map, | 1730 | struct GNUNET_CONTAINER_MultiHashMap32 *map, |
1731 | uint32_t key, | 1731 | uint32_t key, |
1732 | GNUNET_CONTAINER_MulitHashMapIterator32Callback it, | 1732 | GNUNET_CONTAINER_MultiHashMapIterator32Callback it, |
1733 | void *it_cls); | 1733 | void *it_cls); |
1734 | 1734 | ||
1735 | 1735 | ||
diff --git a/src/include/gnunet_mq_lib.h b/src/include/gnunet_mq_lib.h index 95e8c619b..f424c49c2 100644 --- a/src/include/gnunet_mq_lib.h +++ b/src/include/gnunet_mq_lib.h | |||
@@ -994,7 +994,7 @@ GNUNET_MQ_destroy_notify_cancel ( | |||
994 | * Call the message message handler that was registered | 994 | * Call the message message handler that was registered |
995 | * for the type of the given message in the given message queue. | 995 | * for the type of the given message in the given message queue. |
996 | * | 996 | * |
997 | * This function is indented to be used for the implementation | 997 | * This function is intended to be used for the implementation |
998 | * of message queues. | 998 | * of message queues. |
999 | * | 999 | * |
1000 | * @param mq message queue with the handlers | 1000 | * @param mq message queue with the handlers |
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index acd87e2cd..2aeafc977 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h | |||
@@ -428,7 +428,7 @@ typedef void | |||
428 | * GNUNET_TESTBED_ControllerStatusCallback() | 428 | * GNUNET_TESTBED_ControllerStatusCallback() |
429 | * | 429 | * |
430 | * @param trusted_ip the ip address of the controller which will be set as TRUSTED | 430 | * @param trusted_ip the ip address of the controller which will be set as TRUSTED |
431 | * HOST(all connections form this ip are permitted by the testbed) when | 431 | * HOST(all connections from this ip are permitted by the testbed) when |
432 | * starting testbed controller at host. This can either be a single ip | 432 | * starting testbed controller at host. This can either be a single ip |
433 | * address or a network address in CIDR notation. | 433 | * address or a network address in CIDR notation. |
434 | * @param host the host where the controller has to be started. CANNOT be NULL. | 434 | * @param host the host where the controller has to be started. CANNOT be NULL. |
@@ -752,7 +752,7 @@ struct GNUNET_TESTBED_PeerInformation | |||
752 | * Callback to be called when the requested peer information is available | 752 | * Callback to be called when the requested peer information is available |
753 | * The peer information in the callback is valid until the operation 'op' is canceled. | 753 | * The peer information in the callback is valid until the operation 'op' is canceled. |
754 | * | 754 | * |
755 | * @param cb_cls the closure from GNUNET_TETSBED_peer_get_information() | 755 | * @param cb_cls the closure from GNUNET_TESTBED_peer_get_information() |
756 | * @param op the operation this callback corresponds to | 756 | * @param op the operation this callback corresponds to |
757 | * @param pinfo the result; will be NULL if the operation has failed | 757 | * @param pinfo the result; will be NULL if the operation has failed |
758 | * @param emsg error message if the operation has failed; will be NULL if the | 758 | * @param emsg error message if the operation has failed; will be NULL if the |
diff --git a/src/json/test_json.c b/src/json/test_json.c index d6c372cf3..db376d213 100644 --- a/src/json/test_json.c +++ b/src/json/test_json.c | |||
@@ -141,6 +141,7 @@ test_raw () | |||
141 | GNUNET_assert (NULL != j); | 141 | GNUNET_assert (NULL != j); |
142 | GNUNET_assert (GNUNET_OK == GNUNET_JSON_parse (j, spec, NULL, NULL)); | 142 | GNUNET_assert (GNUNET_OK == GNUNET_JSON_parse (j, spec, NULL, NULL)); |
143 | GNUNET_assert (0 == memcmp (blob, blob2, i)); | 143 | GNUNET_assert (0 == memcmp (blob, blob2, i)); |
144 | json_decref (j); | ||
144 | } | 145 | } |
145 | return 0; | 146 | return 0; |
146 | } | 147 | } |
@@ -177,6 +178,8 @@ test_rsa () | |||
177 | GNUNET_assert (GNUNET_OK == GNUNET_JSON_parse (js, sspec, NULL, NULL)); | 178 | GNUNET_assert (GNUNET_OK == GNUNET_JSON_parse (js, sspec, NULL, NULL)); |
178 | GNUNET_break (0 == GNUNET_CRYPTO_rsa_signature_cmp (sig, sig2)); | 179 | GNUNET_break (0 == GNUNET_CRYPTO_rsa_signature_cmp (sig, sig2)); |
179 | GNUNET_break (0 == GNUNET_CRYPTO_rsa_public_key_cmp (pub, pub2)); | 180 | GNUNET_break (0 == GNUNET_CRYPTO_rsa_public_key_cmp (pub, pub2)); |
181 | json_decref (jp); | ||
182 | json_decref (js); | ||
180 | GNUNET_CRYPTO_rsa_signature_free (sig); | 183 | GNUNET_CRYPTO_rsa_signature_free (sig); |
181 | GNUNET_CRYPTO_rsa_signature_free (sig2); | 184 | GNUNET_CRYPTO_rsa_signature_free (sig2); |
182 | GNUNET_CRYPTO_rsa_private_key_free (priv); | 185 | GNUNET_CRYPTO_rsa_private_key_free (priv); |
@@ -216,6 +219,8 @@ test_boolean () | |||
216 | 219 | ||
217 | GNUNET_assert (GNUNET_OK != GNUNET_JSON_parse (json, pspec, NULL, NULL)); | 220 | GNUNET_assert (GNUNET_OK != GNUNET_JSON_parse (json, pspec, NULL, NULL)); |
218 | 221 | ||
222 | json_decref (json); | ||
223 | |||
219 | return 0; | 224 | return 0; |
220 | } | 225 | } |
221 | 226 | ||
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index 7288db902..0329c9c63 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c | |||
@@ -464,8 +464,10 @@ parse_recordline (const char *line) | |||
464 | _ ("Invalid record data for type %s: `%s'.\n"), | 464 | _ ("Invalid record data for type %s: `%s'.\n"), |
465 | GNUNET_GNSRECORD_number_to_typename (record.record_type), | 465 | GNUNET_GNSRECORD_number_to_typename (record.record_type), |
466 | tok); | 466 | tok); |
467 | GNUNET_free (cp); | ||
467 | return GNUNET_SYSERR; | 468 | return GNUNET_SYSERR; |
468 | } | 469 | } |
470 | GNUNET_free (cp); | ||
469 | 471 | ||
470 | r = GNUNET_malloc (sizeof(struct RecordSetEntry) + record.data_size); | 472 | r = GNUNET_malloc (sizeof(struct RecordSetEntry) + record.data_size); |
471 | r->next = *head; | 473 | r->next = *head; |
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index d25287c9f..ed06b1dc5 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -1735,11 +1735,19 @@ handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | |||
1735 | ssize_t read; | 1735 | ssize_t read; |
1736 | size_t key_len; | 1736 | size_t key_len; |
1737 | size_t kb_read; | 1737 | size_t kb_read; |
1738 | size_t rp_msg_len; | ||
1739 | size_t rs_len; | ||
1740 | size_t rs_off; | ||
1741 | size_t body_len; | ||
1738 | struct StoreActivity *sa; | 1742 | struct StoreActivity *sa; |
1739 | struct RecordSet *rs; | 1743 | struct RecordSet *rs; |
1740 | enum GNUNET_ErrorCode res; | 1744 | enum GNUNET_ErrorCode res; |
1741 | 1745 | ||
1742 | key_len = ntohs (rp_msg->key_len); | 1746 | key_len = ntohs (rp_msg->key_len); |
1747 | rp_msg_len = ntohs (rp_msg->gns_header.header.size); | ||
1748 | body_len = rp_msg_len - sizeof (*rp_msg); | ||
1749 | rs_off = sizeof (*rp_msg) + key_len; | ||
1750 | rs_len = rp_msg_len - rs_off; | ||
1743 | if ((GNUNET_SYSERR == | 1751 | if ((GNUNET_SYSERR == |
1744 | GNUNET_IDENTITY_read_private_key_from_buffer (&rp_msg[1], | 1752 | GNUNET_IDENTITY_read_private_key_from_buffer (&rp_msg[1], |
1745 | key_len, | 1753 | key_len, |
@@ -1756,7 +1764,7 @@ handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | |||
1756 | "Received NAMESTORE_RECORD_STORE message\n"); | 1764 | "Received NAMESTORE_RECORD_STORE message\n"); |
1757 | rid = ntohl (rp_msg->gns_header.r_id); | 1765 | rid = ntohl (rp_msg->gns_header.r_id); |
1758 | rd_set_count = ntohs (rp_msg->rd_set_count); | 1766 | rd_set_count = ntohs (rp_msg->rd_set_count); |
1759 | buf = (const char *) &rp_msg[1] + key_len; | 1767 | buf = (const char *) rp_msg + rs_off; |
1760 | for (int i = 0; i < rd_set_count; i++) | 1768 | for (int i = 0; i < rd_set_count; i++) |
1761 | { | 1769 | { |
1762 | rs = (struct RecordSet *) buf; | 1770 | rs = (struct RecordSet *) buf; |
@@ -1770,15 +1778,12 @@ handle_record_store (void *cls, const struct RecordStoreMessage *rp_msg) | |||
1770 | } | 1778 | } |
1771 | buf += read; | 1779 | buf += read; |
1772 | } | 1780 | } |
1773 | sa = GNUNET_malloc (sizeof(struct StoreActivity) | 1781 | sa = GNUNET_malloc (sizeof(struct StoreActivity) + rs_len); |
1774 | + ntohs (rp_msg->gns_header.header.size) | ||
1775 | - sizeof (*rp_msg)); | ||
1776 | GNUNET_CONTAINER_DLL_insert (sa_head, sa_tail, sa); | 1782 | GNUNET_CONTAINER_DLL_insert (sa_head, sa_tail, sa); |
1777 | sa->nc = nc; | 1783 | sa->nc = nc; |
1778 | sa->rs = (struct RecordSet *) &sa[1]; | 1784 | sa->rs = (struct RecordSet *) &sa[1]; |
1779 | sa->rd_set_count = rd_set_count; | 1785 | sa->rd_set_count = rd_set_count; |
1780 | GNUNET_memcpy (&sa[1], (char *) &rp_msg[1] + key_len, | 1786 | GNUNET_memcpy (&sa[1], (char *) rp_msg + rs_off, rs_len); |
1781 | ntohs (rp_msg->gns_header.header.size) - sizeof (*rp_msg)); | ||
1782 | sa->rid = rid; | 1787 | sa->rid = rid; |
1783 | sa->rd_set_pos = 0; | 1788 | sa->rd_set_pos = 0; |
1784 | sa->private_key = zone; | 1789 | sa->private_key = zone; |
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index df6ba1f33..2c5efb745 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -619,11 +619,17 @@ handle_record_result (void *cls, const struct RecordResultMessage *msg) | |||
619 | } | 619 | } |
620 | if (NULL != ze) | 620 | if (NULL != ze) |
621 | { | 621 | { |
622 | if (NULL != ze->proc) | 622 | // Store them here because a callback could free ze |
623 | ze->proc (ze->proc_cls, &private_key, name, rd_count, rd); | 623 | GNUNET_NAMESTORE_RecordMonitor proc; |
624 | if (NULL != ze->proc2) | 624 | GNUNET_NAMESTORE_RecordSetMonitor proc2; |
625 | ze->proc2 (ze->proc_cls, &private_key, name, | 625 | void *proc_cls = ze->proc_cls; |
626 | rd_count, rd, GNUNET_TIME_absolute_ntoh (msg->expire)); | 626 | proc = ze->proc; |
627 | proc2 = ze->proc2; | ||
628 | if (NULL != proc) | ||
629 | proc (proc_cls, &private_key, name, rd_count, rd); | ||
630 | if (NULL != proc2) | ||
631 | proc2 (proc_cls, &private_key, name, | ||
632 | rd_count, rd, GNUNET_TIME_absolute_ntoh (msg->expire)); | ||
627 | return; | 633 | return; |
628 | } | 634 | } |
629 | } | 635 | } |
diff --git a/src/namestore/perf_namestore_api_import.c b/src/namestore/perf_namestore_api_import.c index cde5eaad5..b4f17f742 100644 --- a/src/namestore/perf_namestore_api_import.c +++ b/src/namestore/perf_namestore_api_import.c | |||
@@ -397,6 +397,7 @@ main (int argc, | |||
397 | } | 397 | } |
398 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 398 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
399 | "GNUNET_TEST_HOME"); | 399 | "GNUNET_TEST_HOME"); |
400 | GNUNET_free (plugin_name); | ||
400 | GNUNET_free (cfg_name); | 401 | GNUNET_free (cfg_name); |
401 | return res; | 402 | return res; |
402 | } | 403 | } |
diff --git a/src/namestore/perf_namestore_api_zone_iteration.c b/src/namestore/perf_namestore_api_zone_iteration.c index 0e0b6d93b..bf89d6225 100644 --- a/src/namestore/perf_namestore_api_zone_iteration.c +++ b/src/namestore/perf_namestore_api_zone_iteration.c | |||
@@ -369,6 +369,7 @@ main (int argc, | |||
369 | } | 369 | } |
370 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 370 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
371 | "GNUNET_TEST_HOME"); | 371 | "GNUNET_TEST_HOME"); |
372 | GNUNET_free (plugin_name); | ||
372 | GNUNET_free (cfg_name); | 373 | GNUNET_free (cfg_name); |
373 | return res; | 374 | return res; |
374 | } | 375 | } |
diff --git a/src/namestore/test_common.c b/src/namestore/test_common.c index e35c76075..60749a0b1 100644 --- a/src/namestore/test_common.c +++ b/src/namestore/test_common.c | |||
@@ -102,6 +102,7 @@ TNC_test_plugin (const char *cfg_name) | |||
102 | GNUNET_asprintf (&cfg_name, file_template, plugin_name); \ | 102 | GNUNET_asprintf (&cfg_name, file_template, plugin_name); \ |
103 | if (! TNC_test_plugin (cfg_name)) \ | 103 | if (! TNC_test_plugin (cfg_name)) \ |
104 | { \ | 104 | { \ |
105 | GNUNET_free (plugin_name); \ | ||
105 | GNUNET_free (cfg_name); \ | 106 | GNUNET_free (cfg_name); \ |
106 | return 77; \ | 107 | return 77; \ |
107 | } \ | 108 | } \ |
@@ -119,6 +120,7 @@ TNC_test_plugin (const char *cfg_name) | |||
119 | GNUNET_asprintf (&cfg_name, "test_namestore_api_%s.conf", plugin_name); \ | 120 | GNUNET_asprintf (&cfg_name, "test_namestore_api_%s.conf", plugin_name); \ |
120 | if (! TNC_test_plugin (cfg_name)) \ | 121 | if (! TNC_test_plugin (cfg_name)) \ |
121 | { \ | 122 | { \ |
123 | GNUNET_free (plugin_name); \ | ||
122 | GNUNET_free (cfg_name); \ | 124 | GNUNET_free (cfg_name); \ |
123 | return 77; \ | 125 | return 77; \ |
124 | } \ | 126 | } \ |
diff --git a/src/namestore/test_namestore_api_edit_records.c b/src/namestore/test_namestore_api_edit_records.c index fb588f0e1..fbee57432 100644 --- a/src/namestore/test_namestore_api_edit_records.c +++ b/src/namestore/test_namestore_api_edit_records.c | |||
@@ -390,6 +390,7 @@ main (int argc, char *argv[]) | |||
390 | } | 390 | } |
391 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 391 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
392 | "GNUNET_TEST_HOME"); | 392 | "GNUNET_TEST_HOME"); |
393 | GNUNET_free (plugin_name); | ||
393 | GNUNET_free (cfg_name); | 394 | GNUNET_free (cfg_name); |
394 | return res; | 395 | return res; |
395 | } | 396 | } |
diff --git a/src/namestore/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c index 8fa001196..b26674a95 100644 --- a/src/namestore/test_namestore_api_lookup_nick.c +++ b/src/namestore/test_namestore_api_lookup_nick.c | |||
@@ -338,6 +338,7 @@ main (int argc, char *argv[]) | |||
338 | } | 338 | } |
339 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 339 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
340 | "GNUNET_TEST_HOME"); | 340 | "GNUNET_TEST_HOME"); |
341 | GNUNET_free (plugin_name); | ||
341 | GNUNET_free (cfg_name); | 342 | GNUNET_free (cfg_name); |
342 | return res; | 343 | return res; |
343 | } | 344 | } |
diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c index b129c2996..271f4c40b 100644 --- a/src/namestore/test_namestore_api_monitoring.c +++ b/src/namestore/test_namestore_api_monitoring.c | |||
@@ -369,6 +369,7 @@ main (int argc, | |||
369 | } | 369 | } |
370 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 370 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
371 | "GNUNET_TEST_HOME"); | 371 | "GNUNET_TEST_HOME"); |
372 | GNUNET_free (plugin_name); | ||
372 | GNUNET_free (cfg_name); | 373 | GNUNET_free (cfg_name); |
373 | return res; | 374 | return res; |
374 | } | 375 | } |
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c index bc03de541..87476b309 100644 --- a/src/namestore/test_namestore_api_monitoring_existing.c +++ b/src/namestore/test_namestore_api_monitoring_existing.c | |||
@@ -384,6 +384,7 @@ main (int argc, | |||
384 | } | 384 | } |
385 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 385 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
386 | "GNUNET_TEST_HOME"); | 386 | "GNUNET_TEST_HOME"); |
387 | GNUNET_free (plugin_name); | ||
387 | GNUNET_free (cfg_name); | 388 | GNUNET_free (cfg_name); |
388 | return res; | 389 | return res; |
389 | } | 390 | } |
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 5aab2ebe6..9c00cdfad 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -210,6 +210,7 @@ main (int argc, char *argv[]) | |||
210 | } | 210 | } |
211 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 211 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
212 | "GNUNET_TEST_HOME"); | 212 | "GNUNET_TEST_HOME"); |
213 | GNUNET_free (plugin_name); | ||
213 | GNUNET_free (cfg_name); | 214 | GNUNET_free (cfg_name); |
214 | return res; | 215 | return res; |
215 | } | 216 | } |
diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c index ea95a6b57..9a3eabbee 100644 --- a/src/namestore/test_namestore_api_remove_not_existing_record.c +++ b/src/namestore/test_namestore_api_remove_not_existing_record.c | |||
@@ -170,6 +170,7 @@ main (int argc, char *argv[]) | |||
170 | } | 170 | } |
171 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 171 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
172 | "GNUNET_TEST_HOME"); | 172 | "GNUNET_TEST_HOME"); |
173 | GNUNET_free (plugin_name); | ||
173 | GNUNET_free (cfg_name); | 174 | GNUNET_free (cfg_name); |
174 | return res; | 175 | return res; |
175 | } | 176 | } |
diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c index d291045e5..f8a3dd412 100644 --- a/src/namestore/test_namestore_api_store.c +++ b/src/namestore/test_namestore_api_store.c | |||
@@ -163,6 +163,7 @@ main (int argc, char *argv[]) | |||
163 | } | 163 | } |
164 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 164 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
165 | "GNUNET_TEST_HOME"); | 165 | "GNUNET_TEST_HOME"); |
166 | GNUNET_free (plugin_name); | ||
166 | GNUNET_free (cfg_name); | 167 | GNUNET_free (cfg_name); |
167 | return res; | 168 | return res; |
168 | } | 169 | } |
diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c index bef19385c..9baa4becd 100644 --- a/src/namestore/test_namestore_api_store_update.c +++ b/src/namestore/test_namestore_api_store_update.c | |||
@@ -143,6 +143,7 @@ lookup_success (void *cls, | |||
143 | &rd_new, | 143 | &rd_new, |
144 | &put_cont, | 144 | &put_cont, |
145 | (void *) name); | 145 | (void *) name); |
146 | GNUNET_free (rd_new.data); | ||
146 | update_performed = GNUNET_YES; | 147 | update_performed = GNUNET_YES; |
147 | } | 148 | } |
148 | else | 149 | else |
@@ -259,6 +260,7 @@ main (int argc, | |||
259 | } | 260 | } |
260 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 261 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
261 | "GNUNET_TEST_HOME"); | 262 | "GNUNET_TEST_HOME"); |
263 | GNUNET_free (plugin_name); | ||
262 | GNUNET_free (cfg_name); | 264 | GNUNET_free (cfg_name); |
263 | return res; | 265 | return res; |
264 | } | 266 | } |
diff --git a/src/namestore/test_namestore_api_tx_rollback.c b/src/namestore/test_namestore_api_tx_rollback.c index 5b4bc6174..1b1d00c96 100644 --- a/src/namestore/test_namestore_api_tx_rollback.c +++ b/src/namestore/test_namestore_api_tx_rollback.c | |||
@@ -255,6 +255,7 @@ main (int argc, char *argv[]) | |||
255 | } | 255 | } |
256 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 256 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
257 | "GNUNET_TEST_HOME"); | 257 | "GNUNET_TEST_HOME"); |
258 | GNUNET_free (plugin_name); | ||
258 | GNUNET_free (cfg_name); | 259 | GNUNET_free (cfg_name); |
259 | return res; | 260 | return res; |
260 | } | 261 | } |
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c index e072dbef9..f9bf4986b 100644 --- a/src/namestore/test_namestore_api_zone_iteration.c +++ b/src/namestore/test_namestore_api_zone_iteration.c | |||
@@ -455,6 +455,7 @@ main (int argc, char *argv[]) | |||
455 | } | 455 | } |
456 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 456 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
457 | "GNUNET_TEST_HOME"); | 457 | "GNUNET_TEST_HOME"); |
458 | GNUNET_free (plugin_name); | ||
458 | GNUNET_free (cfg_name); | 459 | GNUNET_free (cfg_name); |
459 | return res; | 460 | return res; |
460 | } | 461 | } |
diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c b/src/namestore/test_namestore_api_zone_iteration_nick.c index e371bb312..5855b1e87 100644 --- a/src/namestore/test_namestore_api_zone_iteration_nick.c +++ b/src/namestore/test_namestore_api_zone_iteration_nick.c | |||
@@ -451,6 +451,7 @@ main (int argc, char *argv[]) | |||
451 | } | 451 | } |
452 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 452 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
453 | "GNUNET_TEST_HOME"); | 453 | "GNUNET_TEST_HOME"); |
454 | GNUNET_free (plugin_name); | ||
454 | GNUNET_free (cfg_name); | 455 | GNUNET_free (cfg_name); |
455 | return res; | 456 | return res; |
456 | } | 457 | } |
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c index 074cd4dbb..519383169 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c | |||
@@ -438,6 +438,7 @@ main (int argc, char *argv[]) | |||
438 | } | 438 | } |
439 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 439 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
440 | "GNUNET_TEST_HOME"); | 440 | "GNUNET_TEST_HOME"); |
441 | GNUNET_free (plugin_name); | ||
441 | GNUNET_free (cfg_name); | 442 | GNUNET_free (cfg_name); |
442 | return res; | 443 | return res; |
443 | } | 444 | } |
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c index 7efe59648..4fe86301c 100644 --- a/src/namestore/test_namestore_api_zone_iteration_stop.c +++ b/src/namestore/test_namestore_api_zone_iteration_stop.c | |||
@@ -439,6 +439,7 @@ main (int argc, char *argv[]) | |||
439 | } | 439 | } |
440 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 440 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
441 | "GNUNET_TEST_HOME"); | 441 | "GNUNET_TEST_HOME"); |
442 | GNUNET_free (plugin_name); | ||
442 | GNUNET_free (cfg_name); | 443 | GNUNET_free (cfg_name); |
443 | 444 | ||
444 | return res; | 445 | return res; |
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index dfdefa039..a99b7bc71 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c | |||
@@ -257,6 +257,7 @@ main (int argc, | |||
257 | } | 257 | } |
258 | GNUNET_DISK_purge_cfg_dir (cfg_name, | 258 | GNUNET_DISK_purge_cfg_dir (cfg_name, |
259 | "GNUNET_TEST_HOME"); | 259 | "GNUNET_TEST_HOME"); |
260 | GNUNET_free (plugin_name); | ||
260 | GNUNET_free (cfg_name); | 261 | GNUNET_free (cfg_name); |
261 | return res; | 262 | return res; |
262 | } | 263 | } |
diff --git a/src/nat/nat_api.c b/src/nat/nat_api.c index 3072cff7f..31f8f388d 100644 --- a/src/nat/nat_api.c +++ b/src/nat/nat_api.c | |||
@@ -673,6 +673,9 @@ GNUNET_NAT_request_reversal (struct GNUNET_NAT_Handle *nh, | |||
673 | void | 673 | void |
674 | GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *nh) | 674 | GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *nh) |
675 | { | 675 | { |
676 | struct AddrEntry *ae; | ||
677 | struct AddrEntry *next; | ||
678 | |||
676 | if (NULL != nh->mq) | 679 | if (NULL != nh->mq) |
677 | { | 680 | { |
678 | GNUNET_MQ_destroy (nh->mq); | 681 | GNUNET_MQ_destroy (nh->mq); |
@@ -683,6 +686,14 @@ GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *nh) | |||
683 | GNUNET_SCHEDULER_cancel (nh->reconnect_task); | 686 | GNUNET_SCHEDULER_cancel (nh->reconnect_task); |
684 | nh->reconnect_task = NULL; | 687 | nh->reconnect_task = NULL; |
685 | } | 688 | } |
689 | next = nh->ae_head; | ||
690 | while (NULL != next) | ||
691 | { | ||
692 | ae = next; | ||
693 | next = next->next; | ||
694 | GNUNET_CONTAINER_DLL_remove (nh->ae_head, nh->ae_tail, ae); | ||
695 | GNUNET_free (ae); | ||
696 | } | ||
686 | GNUNET_free (nh->reg); | 697 | GNUNET_free (nh->reg); |
687 | GNUNET_free (nh); | 698 | GNUNET_free (nh); |
688 | } | 699 | } |
diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c index b3e793d93..1c13369cf 100644 --- a/src/peerstore/peerstore_api.c +++ b/src/peerstore/peerstore_api.c | |||
@@ -608,9 +608,10 @@ handle_iterate_end (void *cls, const struct GNUNET_MessageHeader *msg) | |||
608 | callback_cls = ic->callback_cls; | 608 | callback_cls = ic->callback_cls; |
609 | ic->iterating = GNUNET_NO; | 609 | ic->iterating = GNUNET_NO; |
610 | GNUNET_PEERSTORE_iterate_cancel (ic); | 610 | GNUNET_PEERSTORE_iterate_cancel (ic); |
611 | /* NOTE: set this here and not after callback because callback may free h */ | ||
612 | h->reconnect_delay = GNUNET_TIME_UNIT_ZERO; | ||
611 | if (NULL != callback) | 613 | if (NULL != callback) |
612 | callback (callback_cls, NULL, NULL); | 614 | callback (callback_cls, NULL, NULL); |
613 | h->reconnect_delay = GNUNET_TIME_UNIT_ZERO; | ||
614 | } | 615 | } |
615 | 616 | ||
616 | 617 | ||
@@ -781,9 +782,9 @@ handle_watch_record (void *cls, const struct StoreRecordMessage *msg) | |||
781 | disconnect_and_schedule_reconnect (h); | 782 | disconnect_and_schedule_reconnect (h); |
782 | return; | 783 | return; |
783 | } | 784 | } |
785 | h->reconnect_delay = GNUNET_TIME_UNIT_ZERO; | ||
784 | if (NULL != wc->callback) | 786 | if (NULL != wc->callback) |
785 | wc->callback (wc->callback_cls, record, NULL); | 787 | wc->callback (wc->callback_cls, record, NULL); |
786 | h->reconnect_delay = GNUNET_TIME_UNIT_ZERO; | ||
787 | PEERSTORE_destroy_record (record); | 788 | PEERSTORE_destroy_record (record); |
788 | } | 789 | } |
789 | 790 | ||
diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c index e8617a5c9..02af17c8c 100644 --- a/src/pq/pq_connect.c +++ b/src/pq/pq_connect.c | |||
@@ -166,7 +166,7 @@ GNUNET_PQ_exec_sql (struct GNUNET_PQ_Context *db, | |||
166 | "Applying SQL file `%s' on database %s\n", | 166 | "Applying SQL file `%s' on database %s\n", |
167 | fn, | 167 | fn, |
168 | db->config_str); | 168 | db->config_str); |
169 | psql = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_ERR, | 169 | psql = GNUNET_OS_start_process (GNUNET_OS_INHERIT_STD_NONE, |
170 | NULL, | 170 | NULL, |
171 | NULL, | 171 | NULL, |
172 | NULL, | 172 | NULL, |
diff --git a/src/pq/pq_eval.c b/src/pq/pq_eval.c index cc16c7864..e31475e13 100644 --- a/src/pq/pq_eval.c +++ b/src/pq/pq_eval.c | |||
@@ -42,19 +42,6 @@ | |||
42 | #define PQ_DIAG_SQLSTATE_SERIALIZATION_FAILURE "40001" | 42 | #define PQ_DIAG_SQLSTATE_SERIALIZATION_FAILURE "40001" |
43 | 43 | ||
44 | 44 | ||
45 | /** | ||
46 | * Check the @a result's error code to see what happened. | ||
47 | * Also logs errors. | ||
48 | * | ||
49 | * @param db database to execute the statement with | ||
50 | * @param statement_name name of the statement that created @a result | ||
51 | * @param result result to check | ||
52 | * @return status code from the result, mapping PQ status | ||
53 | * codes to `enum GNUNET_DB_QueryStatus`. Never | ||
54 | * returns positive values as this function does | ||
55 | * not look at the result set. | ||
56 | * @deprecated (low level, let's see if we can do with just the high-level functions) | ||
57 | */ | ||
58 | enum GNUNET_DB_QueryStatus | 45 | enum GNUNET_DB_QueryStatus |
59 | GNUNET_PQ_eval_result (struct GNUNET_PQ_Context *db, | 46 | GNUNET_PQ_eval_result (struct GNUNET_PQ_Context *db, |
60 | const char *statement_name, | 47 | const char *statement_name, |
@@ -144,22 +131,6 @@ GNUNET_PQ_eval_result (struct GNUNET_PQ_Context *db, | |||
144 | } | 131 | } |
145 | 132 | ||
146 | 133 | ||
147 | /** | ||
148 | * Execute a named prepared @a statement that is NOT a SELECT | ||
149 | * statement in @a connection using the given @a params. Returns the | ||
150 | * resulting session state. | ||
151 | * | ||
152 | * @param db database to execute the statement with | ||
153 | * @param statement_name name of the statement | ||
154 | * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) | ||
155 | * @return status code from the result, mapping PQ status | ||
156 | * codes to `enum GNUNET_DB_QueryStatus`. If the | ||
157 | * statement was a DELETE or UPDATE statement, the | ||
158 | * number of affected rows is returned.; if the | ||
159 | * statement was an INSERT statement, and no row | ||
160 | * was added due to a UNIQUE violation, we return | ||
161 | * zero; if INSERT was successful, we return one. | ||
162 | */ | ||
163 | enum GNUNET_DB_QueryStatus | 134 | enum GNUNET_DB_QueryStatus |
164 | GNUNET_PQ_eval_prepared_non_select (struct GNUNET_PQ_Context *db, | 135 | GNUNET_PQ_eval_prepared_non_select (struct GNUNET_PQ_Context *db, |
165 | const char *statement_name, | 136 | const char *statement_name, |
@@ -190,21 +161,6 @@ GNUNET_PQ_eval_prepared_non_select (struct GNUNET_PQ_Context *db, | |||
190 | } | 161 | } |
191 | 162 | ||
192 | 163 | ||
193 | /** | ||
194 | * Execute a named prepared @a statement that is a SELECT statement | ||
195 | * which may return multiple results in @a connection using the given | ||
196 | * @a params. Call @a rh with the results. Returns the query | ||
197 | * status including the number of results given to @a rh (possibly zero). | ||
198 | * @a rh will not have been called if the return value is negative. | ||
199 | * | ||
200 | * @param db database to execute the statement with | ||
201 | * @param statement_name name of the statement | ||
202 | * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) | ||
203 | * @param rh function to call with the result set, NULL to ignore | ||
204 | * @param rh_cls closure to pass to @a rh | ||
205 | * @return status code from the result, mapping PQ status | ||
206 | * codes to `enum GNUNET_DB_QueryStatus`. | ||
207 | */ | ||
208 | enum GNUNET_DB_QueryStatus | 164 | enum GNUNET_DB_QueryStatus |
209 | GNUNET_PQ_eval_prepared_multi_select (struct GNUNET_PQ_Context *db, | 165 | GNUNET_PQ_eval_prepared_multi_select (struct GNUNET_PQ_Context *db, |
210 | const char *statement_name, | 166 | const char *statement_name, |
@@ -239,21 +195,6 @@ GNUNET_PQ_eval_prepared_multi_select (struct GNUNET_PQ_Context *db, | |||
239 | } | 195 | } |
240 | 196 | ||
241 | 197 | ||
242 | /** | ||
243 | * Execute a named prepared @a statement that is a SELECT statement | ||
244 | * which must return a single result in @a connection using the given | ||
245 | * @a params. Stores the result (if any) in @a rs, which the caller | ||
246 | * must then clean up using #GNUNET_PQ_cleanup_result() if the return | ||
247 | * value was #GNUNET_DB_STATUS_SUCCESS_ONE_RESULT. Returns the | ||
248 | * resulting session status. | ||
249 | * | ||
250 | * @param db database to execute the statement with | ||
251 | * @param statement_name name of the statement | ||
252 | * @param params parameters to give to the statement (#GNUNET_PQ_query_param_end-terminated) | ||
253 | * @param[in,out] rs result specification to use for storing the result of the query | ||
254 | * @return status code from the result, mapping PQ status | ||
255 | * codes to `enum GNUNET_DB_QueryStatus`. | ||
256 | */ | ||
257 | enum GNUNET_DB_QueryStatus | 198 | enum GNUNET_DB_QueryStatus |
258 | GNUNET_PQ_eval_prepared_singleton_select ( | 199 | GNUNET_PQ_eval_prepared_singleton_select ( |
259 | struct GNUNET_PQ_Context *db, | 200 | struct GNUNET_PQ_Context *db, |
diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c index 6dbacf7ff..3e708fc04 100644 --- a/src/pq/pq_event.c +++ b/src/pq/pq_event.c | |||
@@ -525,7 +525,7 @@ GNUNET_PG_get_event_notify_channel (const struct GNUNET_DB_EventHeaderP *es) | |||
525 | char *end; | 525 | char *end; |
526 | 526 | ||
527 | end = stpcpy (sql, | 527 | end = stpcpy (sql, |
528 | "NOTIFY X"); | 528 | "X"); |
529 | end = es_to_channel (es, | 529 | end = es_to_channel (es, |
530 | end); | 530 | end); |
531 | GNUNET_assert (NULL != end); | 531 | GNUNET_assert (NULL != end); |
diff --git a/src/pq/pq_exec.c b/src/pq/pq_exec.c index 33fe8733d..1fd8c5068 100644 --- a/src/pq/pq_exec.c +++ b/src/pq/pq_exec.c | |||
@@ -26,12 +26,6 @@ | |||
26 | #include "pq.h" | 26 | #include "pq.h" |
27 | 27 | ||
28 | 28 | ||
29 | /** | ||
30 | * Create a `struct GNUNET_PQ_ExecuteStatement` where errors are fatal. | ||
31 | * | ||
32 | * @param sql actual SQL statement | ||
33 | * @return initialized struct | ||
34 | */ | ||
35 | struct GNUNET_PQ_ExecuteStatement | 29 | struct GNUNET_PQ_ExecuteStatement |
36 | GNUNET_PQ_make_execute (const char *sql) | 30 | GNUNET_PQ_make_execute (const char *sql) |
37 | { | 31 | { |
@@ -44,13 +38,6 @@ GNUNET_PQ_make_execute (const char *sql) | |||
44 | } | 38 | } |
45 | 39 | ||
46 | 40 | ||
47 | /** | ||
48 | * Create a `struct GNUNET_PQ_ExecuteStatement` where errors should | ||
49 | * be tolerated. | ||
50 | * | ||
51 | * @param sql actual SQL statement | ||
52 | * @return initialized struct | ||
53 | */ | ||
54 | struct GNUNET_PQ_ExecuteStatement | 41 | struct GNUNET_PQ_ExecuteStatement |
55 | GNUNET_PQ_make_try_execute (const char *sql) | 42 | GNUNET_PQ_make_try_execute (const char *sql) |
56 | { | 43 | { |
diff --git a/src/reclaim/did_helper.c b/src/reclaim/did_helper.c index 1c04ede33..17f3b21b2 100644 --- a/src/reclaim/did_helper.c +++ b/src/reclaim/did_helper.c | |||
@@ -78,7 +78,7 @@ DID_identity_to_did (struct GNUNET_IDENTITY_Ego *ego) | |||
78 | enum GNUNET_GenericReturnValue | 78 | enum GNUNET_GenericReturnValue |
79 | DID_did_to_pkey (const char *did, struct GNUNET_IDENTITY_PublicKey *pkey) | 79 | DID_did_to_pkey (const char *did, struct GNUNET_IDENTITY_PublicKey *pkey) |
80 | { | 80 | { |
81 | char pkey_str[MAX_DID_SPECIFIC_IDENTIFIER_LENGTH]; | 81 | char pkey_str[MAX_DID_SPECIFIC_IDENTIFIER_LENGTH + 1]; /* 0-term */ |
82 | 82 | ||
83 | if ((1 != (sscanf (did, | 83 | if ((1 != (sscanf (did, |
84 | GNUNET_DID_METHOD_PREFIX "%" | 84 | GNUNET_DID_METHOD_PREFIX "%" |
@@ -98,7 +98,7 @@ DID_did_to_pkey (const char *did, struct GNUNET_IDENTITY_PublicKey *pkey) | |||
98 | * @brief Convert a base 64 encoded public key to a GNUNET key | 98 | * @brief Convert a base 64 encoded public key to a GNUNET key |
99 | */ | 99 | */ |
100 | struct GNUNET_IDENTITY_PublicKey * | 100 | struct GNUNET_IDENTITY_PublicKey * |
101 | GNUNET_DID_key_covert_multibase_base64_to_gnunet (char *pkey_str) | 101 | GNUNET_DID_key_convert_multibase_base64_to_gnunet (char *pkey_str) |
102 | { | 102 | { |
103 | return NULL; | 103 | return NULL; |
104 | } | 104 | } |
@@ -107,7 +107,7 @@ GNUNET_DID_key_covert_multibase_base64_to_gnunet (char *pkey_str) | |||
107 | * @brief Convert GNUNET key to a base 64 encoded public key | 107 | * @brief Convert GNUNET key to a base 64 encoded public key |
108 | */ | 108 | */ |
109 | char * | 109 | char * |
110 | DID_key_covert_gnunet_to_multibase_base64 (struct | 110 | DID_key_convert_gnunet_to_multibase_base64 (struct |
111 | GNUNET_IDENTITY_PublicKey * | 111 | GNUNET_IDENTITY_PublicKey * |
112 | pkey) | 112 | pkey) |
113 | { | 113 | { |
@@ -154,7 +154,7 @@ DID_pkey_to_did_document (struct GNUNET_IDENTITY_PublicKey *pkey) | |||
154 | did_str = DID_pkey_to_did (pkey); | 154 | did_str = DID_pkey_to_did (pkey); |
155 | GNUNET_asprintf (&verify_id_str, "%s#key-1", did_str); | 155 | GNUNET_asprintf (&verify_id_str, "%s#key-1", did_str); |
156 | 156 | ||
157 | pkey_multibase_str = DID_key_covert_gnunet_to_multibase_base64 (pkey); | 157 | pkey_multibase_str = DID_key_convert_gnunet_to_multibase_base64 (pkey); |
158 | 158 | ||
159 | didd_json = json_pack ( | 159 | didd_json = json_pack ( |
160 | "{s:[ss], s:s, s:[{s:s, s:s, s:s, s:s}], s:[s], s:[s]}", | 160 | "{s:[ss], s:s, s:[{s:s, s:s, s:s, s:s}], s:[s], s:[s]}", |
diff --git a/src/reclaim/did_helper.h b/src/reclaim/did_helper.h index 5cad48ca8..fea86af5e 100644 --- a/src/reclaim/did_helper.h +++ b/src/reclaim/did_helper.h | |||
@@ -52,13 +52,13 @@ DID_did_to_pkey (const char *did, struct GNUNET_IDENTITY_PublicKey *pkey); | |||
52 | // * @brief Convert a base 64 encoded public key to a GNUNET key | 52 | // * @brief Convert a base 64 encoded public key to a GNUNET key |
53 | // */ | 53 | // */ |
54 | // struct GNUNET_IDENTITY_PublicKey * | 54 | // struct GNUNET_IDENTITY_PublicKey * |
55 | // GNUNET_DID_key_covert_multibase_base64_to_gnunet(char *); | 55 | // GNUNET_DID_key_convert_multibase_base64_to_gnunet(char *); |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * @brief Convert GNUNET key to a base 64 encoded public key | 58 | * @brief Convert GNUNET key to a base 64 encoded public key |
59 | */ | 59 | */ |
60 | char * | 60 | char * |
61 | DID_key_covert_gnunet_to_multibase_base64 (struct | 61 | DID_key_convert_gnunet_to_multibase_base64 (struct |
62 | GNUNET_IDENTITY_PublicKey *); | 62 | GNUNET_IDENTITY_PublicKey *); |
63 | 63 | ||
64 | /** | 64 | /** |
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c index da5f90409..cb8703495 100644 --- a/src/reclaim/gnunet-reclaim.c +++ b/src/reclaim/gnunet-reclaim.c | |||
@@ -218,7 +218,10 @@ do_cleanup (void *cls) | |||
218 | if (NULL != identity_handle) | 218 | if (NULL != identity_handle) |
219 | GNUNET_IDENTITY_disconnect (identity_handle); | 219 | GNUNET_IDENTITY_disconnect (identity_handle); |
220 | if (NULL != attr_list) | 220 | if (NULL != attr_list) |
221 | GNUNET_free (attr_list); | 221 | { |
222 | GNUNET_RECLAIM_attribute_list_destroy (attr_list); | ||
223 | attr_list = NULL; | ||
224 | } | ||
222 | if (NULL != attr_to_delete) | 225 | if (NULL != attr_to_delete) |
223 | GNUNET_free (attr_to_delete); | 226 | GNUNET_free (attr_to_delete); |
224 | if (NULL == credential_type) | 227 | if (NULL == credential_type) |
diff --git a/src/reclaim/test_did_helper.c b/src/reclaim/test_did_helper.c index 446c199fc..02db28925 100644 --- a/src/reclaim/test_did_helper.c +++ b/src/reclaim/test_did_helper.c | |||
@@ -69,6 +69,7 @@ test_GNUNET_DID_pkey_to_did () | |||
69 | char *str_did; | 69 | char *str_did; |
70 | str_did = DID_pkey_to_did (&test_pkey); | 70 | str_did = DID_pkey_to_did (&test_pkey); |
71 | GNUNET_assert (strcmp ((char *) test_did, str_did) == 0); | 71 | GNUNET_assert (strcmp ((char *) test_did, str_did) == 0); |
72 | GNUNET_free (str_did); | ||
72 | } | 73 | } |
73 | 74 | ||
74 | void | 75 | void |
@@ -84,15 +85,16 @@ test_GNUNET_DID_did_to_pkey () | |||
84 | } | 85 | } |
85 | 86 | ||
86 | // void | 87 | // void |
87 | // test_GNUNET_DID_key_covert_multibase_base64_to_gnunet (); | 88 | // test_GNUNET_DID_key_convert_multibase_base64_to_gnunet (); |
88 | 89 | ||
89 | void | 90 | void |
90 | test_GNUNET_DID_key_covert_gnunet_to_multibase_base64 () | 91 | test_GNUNET_DID_key_convert_gnunet_to_multibase_base64 () |
91 | { | 92 | { |
92 | char *multibase_key; | 93 | char *multibase_key; |
93 | multibase_key = DID_key_covert_gnunet_to_multibase_base64 (&test_pkey); | 94 | multibase_key = DID_key_convert_gnunet_to_multibase_base64 (&test_pkey); |
94 | 95 | ||
95 | GNUNET_assert (strcmp (test_multibase_key, multibase_key) == 0); | 96 | GNUNET_assert (strcmp (test_multibase_key, multibase_key) == 0); |
97 | GNUNET_free (multibase_key); | ||
96 | } | 98 | } |
97 | 99 | ||
98 | void | 100 | void |
@@ -102,6 +104,8 @@ test_GNUNET_DID_pkey_to_did_document () | |||
102 | char *did_document_str = DID_pkey_to_did_document (&test_pkey); | 104 | char *did_document_str = DID_pkey_to_did_document (&test_pkey); |
103 | did_document = json_loads (did_document_str, JSON_DECODE_ANY, NULL); | 105 | did_document = json_loads (did_document_str, JSON_DECODE_ANY, NULL); |
104 | GNUNET_assert (json_equal (test_did_document, did_document) == 1); | 106 | GNUNET_assert (json_equal (test_did_document, did_document) == 1); |
107 | json_decref (did_document); | ||
108 | GNUNET_free (did_document_str); | ||
105 | } | 109 | } |
106 | 110 | ||
107 | int | 111 | int |
@@ -127,6 +131,7 @@ main () | |||
127 | test_GNUNET_DID_pkey_to_did (); | 131 | test_GNUNET_DID_pkey_to_did (); |
128 | test_GNUNET_DID_did_to_pkey (); | 132 | test_GNUNET_DID_did_to_pkey (); |
129 | test_GNUNET_DID_pkey_to_did_document (); | 133 | test_GNUNET_DID_pkey_to_did_document (); |
130 | test_GNUNET_DID_key_covert_gnunet_to_multibase_base64 (); | 134 | test_GNUNET_DID_key_convert_gnunet_to_multibase_base64 (); |
135 | json_decref (test_did_document); | ||
131 | return 0; | 136 | return 0; |
132 | } | 137 | } |
diff --git a/src/reclaim/test_reclaim_attribute.c b/src/reclaim/test_reclaim_attribute.c index 0740812eb..acbcda62d 100644 --- a/src/reclaim/test_reclaim_attribute.c +++ b/src/reclaim/test_reclaim_attribute.c | |||
@@ -45,4 +45,5 @@ main (int argc, char *argv[]) | |||
45 | //GNUNET_assert (-1 != deser_len); | 45 | //GNUNET_assert (-1 != deser_len); |
46 | GNUNET_free (ser_data); | 46 | GNUNET_free (ser_data); |
47 | GNUNET_RECLAIM_attribute_list_destroy (al); | 47 | GNUNET_RECLAIM_attribute_list_destroy (al); |
48 | GNUNET_RECLAIM_attribute_list_destroy (al_two); | ||
48 | } | 49 | } |
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c index f9a949e61..5163c2271 100644 --- a/src/rest/gnunet-rest-server.c +++ b/src/rest/gnunet-rest-server.c | |||
@@ -1193,6 +1193,7 @@ run (void *cls, | |||
1193 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, | 1193 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, |
1194 | "write", | 1194 | "write", |
1195 | basic_auth_file); | 1195 | basic_auth_file); |
1196 | GNUNET_free (basic_auth_file); | ||
1196 | } | 1197 | } |
1197 | else | 1198 | else |
1198 | { | 1199 | { |
@@ -1205,8 +1206,10 @@ run (void *cls, | |||
1205 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1206 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1206 | "Unable to read basic auth secret file.\n"); | 1207 | "Unable to read basic auth secret file.\n"); |
1207 | GNUNET_SCHEDULER_shutdown (); | 1208 | GNUNET_SCHEDULER_shutdown (); |
1209 | GNUNET_free (basic_auth_file); | ||
1208 | return; | 1210 | return; |
1209 | } | 1211 | } |
1212 | GNUNET_free (basic_auth_file); | ||
1210 | if (0 != getlogin_r (cuser, _POSIX_LOGIN_NAME_MAX)) | 1213 | if (0 != getlogin_r (cuser, _POSIX_LOGIN_NAME_MAX)) |
1211 | { | 1214 | { |
1212 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1215 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index e10771557..2cee70857 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -899,6 +899,8 @@ run (void *cls, | |||
899 | cfg = c; | 899 | cfg = c; |
900 | revocation_map = GNUNET_CONTAINER_multihashmap_create (16, | 900 | revocation_map = GNUNET_CONTAINER_multihashmap_create (16, |
901 | GNUNET_NO); | 901 | GNUNET_NO); |
902 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | ||
903 | NULL); | ||
902 | if (GNUNET_OK != | 904 | if (GNUNET_OK != |
903 | GNUNET_CONFIGURATION_get_value_number (cfg, | 905 | GNUNET_CONFIGURATION_get_value_number (cfg, |
904 | "REVOCATION", | 906 | "REVOCATION", |
@@ -1001,8 +1003,6 @@ run (void *cls, | |||
1001 | } | 1003 | } |
1002 | GNUNET_free (fn); | 1004 | GNUNET_free (fn); |
1003 | 1005 | ||
1004 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | ||
1005 | NULL); | ||
1006 | peers = GNUNET_CONTAINER_multipeermap_create (128, | 1006 | peers = GNUNET_CONTAINER_multipeermap_create (128, |
1007 | GNUNET_YES); | 1007 | GNUNET_YES); |
1008 | /* Connect to core service and register core handlers */ | 1008 | /* Connect to core service and register core handlers */ |
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index a0813ddcd..327b03494 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -427,20 +427,18 @@ check_signature_identity (const struct GNUNET_REVOCATION_PowP *pow, | |||
427 | struct GNUNET_REVOCATION_SignaturePurposePS *spurp; | 427 | struct GNUNET_REVOCATION_SignaturePurposePS *spurp; |
428 | unsigned char *sig; | 428 | unsigned char *sig; |
429 | size_t ksize; | 429 | size_t ksize; |
430 | int ret; | ||
430 | 431 | ||
431 | ksize = GNUNET_IDENTITY_public_key_get_length (key); | 432 | ksize = GNUNET_IDENTITY_public_key_get_length (key); |
432 | spurp = REV_create_signature_message (pow); | 433 | spurp = REV_create_signature_message (pow); |
433 | sig = ((unsigned char*) &pow[1] + ksize); | 434 | sig = ((unsigned char*) &pow[1] + ksize); |
434 | if (GNUNET_OK != | 435 | ret = |
435 | GNUNET_IDENTITY_signature_verify_raw_ ( | 436 | GNUNET_IDENTITY_signature_verify_raw_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION, |
436 | GNUNET_SIGNATURE_PURPOSE_REVOCATION, | 437 | &spurp->purpose, |
437 | &spurp->purpose, | 438 | sig, |
438 | sig, | 439 | key); |
439 | key)) | 440 | GNUNET_free (spurp); |
440 | { | 441 | return ret == GNUNET_OK ? GNUNET_OK : GNUNET_SYSERR; |
441 | return GNUNET_SYSERR; | ||
442 | } | ||
443 | return GNUNET_OK; | ||
444 | } | 442 | } |
445 | 443 | ||
446 | 444 | ||
@@ -588,6 +586,7 @@ sign_pow_identity (const struct GNUNET_IDENTITY_PrivateKey *key, | |||
588 | int result = GNUNET_IDENTITY_sign_raw_ (key, | 586 | int result = GNUNET_IDENTITY_sign_raw_ (key, |
589 | &rp->purpose, | 587 | &rp->purpose, |
590 | (void*) sig); | 588 | (void*) sig); |
589 | GNUNET_free (rp); | ||
591 | if (result == GNUNET_SYSERR) | 590 | if (result == GNUNET_SYSERR) |
592 | return GNUNET_NO; | 591 | return GNUNET_NO; |
593 | else | 592 | else |
diff --git a/src/secretsharing/gnunet-secretsharing-profiler.c b/src/secretsharing/gnunet-secretsharing-profiler.c index 76bba0bc9..432d6da89 100644 --- a/src/secretsharing/gnunet-secretsharing-profiler.c +++ b/src/secretsharing/gnunet-secretsharing-profiler.c | |||
@@ -446,7 +446,7 @@ session_disconnect_adapter (void *cls, void *op_result) | |||
446 | /** | 446 | /** |
447 | * Callback to be called when the requested peer information is available | 447 | * Callback to be called when the requested peer information is available |
448 | * | 448 | * |
449 | * @param cb_cls the closure from GNUNET_TETSBED_peer_get_information() | 449 | * @param cb_cls the closure from GNUNET_TESTBED_peer_get_information() |
450 | * @param op the operation this callback corresponds to | 450 | * @param op the operation this callback corresponds to |
451 | * @param pinfo the result; will be NULL if the operation has failed | 451 | * @param pinfo the result; will be NULL if the operation has failed |
452 | * @param emsg error message if the operation has failed; will be NULL if the | 452 | * @param emsg error message if the operation has failed; will be NULL if the |
diff --git a/src/secretsharing/test_secretsharing_api.c b/src/secretsharing/test_secretsharing_api.c index 227af1c3e..470bfddf4 100644 --- a/src/secretsharing/test_secretsharing_api.c +++ b/src/secretsharing/test_secretsharing_api.c | |||
@@ -45,6 +45,7 @@ secret_ready_cb (void *cls, | |||
45 | success = 1; | 45 | success = 1; |
46 | // FIXME: check that our share is valid, which we can do as there's only | 46 | // FIXME: check that our share is valid, which we can do as there's only |
47 | // one peer. | 47 | // one peer. |
48 | GNUNET_SECRETSHARING_share_destroy (my_share); | ||
48 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "secret ready, shutting down\n"); | 49 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "secret ready, shutting down\n"); |
49 | GNUNET_SCHEDULER_shutdown (); | 50 | GNUNET_SCHEDULER_shutdown (); |
50 | } | 51 | } |
diff --git a/src/set/gnunet-set-ibf-profiler.c b/src/set/gnunet-set-ibf-profiler.c index 944b63d30..6465b15b8 100644 --- a/src/set/gnunet-set-ibf-profiler.c +++ b/src/set/gnunet-set-ibf-profiler.c | |||
@@ -67,7 +67,7 @@ register_hashcode (struct GNUNET_HashCode *hash) | |||
67 | 67 | ||
68 | static void | 68 | static void |
69 | iter_hashcodes (struct IBF_Key key, | 69 | iter_hashcodes (struct IBF_Key key, |
70 | GNUNET_CONTAINER_MulitHashMapIteratorCallback iter, | 70 | GNUNET_CONTAINER_MultiHashMapIteratorCallback iter, |
71 | void *cls) | 71 | void *cls) |
72 | { | 72 | { |
73 | struct GNUNET_HashCode replicated; | 73 | struct GNUNET_HashCode replicated; |
diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c index 339d347f8..f85ddb224 100644 --- a/src/setu/gnunet-service-setu.c +++ b/src/setu/gnunet-service-setu.c | |||
@@ -1552,6 +1552,16 @@ check_byzantine_bounds (struct Operation *op) | |||
1552 | } | 1552 | } |
1553 | 1553 | ||
1554 | 1554 | ||
1555 | static enum GNUNET_GenericReturnValue | ||
1556 | free_values_iter(void *cls, | ||
1557 | const struct GNUNET_HashCode *key, | ||
1558 | void *value) | ||
1559 | { | ||
1560 | GNUNET_free (value); | ||
1561 | return GNUNET_YES; | ||
1562 | } | ||
1563 | |||
1564 | |||
1555 | /* FIXME: the destroy logic is a mess and should be cleaned up! */ | 1565 | /* FIXME: the destroy logic is a mess and should be cleaned up! */ |
1556 | 1566 | ||
1557 | /** | 1567 | /** |
@@ -1605,6 +1615,19 @@ _GSS_operation_destroy (struct Operation *op) | |||
1605 | GNUNET_CONTAINER_multihashmap32_destroy (op->key_to_element); | 1615 | GNUNET_CONTAINER_multihashmap32_destroy (op->key_to_element); |
1606 | op->key_to_element = NULL; | 1616 | op->key_to_element = NULL; |
1607 | } | 1617 | } |
1618 | if (NULL != op->message_control_flow) | ||
1619 | { | ||
1620 | GNUNET_CONTAINER_multihashmap_iterate (op->message_control_flow, | ||
1621 | &free_values_iter, | ||
1622 | NULL); | ||
1623 | GNUNET_CONTAINER_multihashmap_destroy (op->message_control_flow); | ||
1624 | op->message_control_flow = NULL; | ||
1625 | } | ||
1626 | if (NULL != op->inquiries_sent) | ||
1627 | { | ||
1628 | GNUNET_CONTAINER_multihashmap_destroy (op->inquiries_sent); | ||
1629 | op->inquiries_sent = NULL; | ||
1630 | } | ||
1608 | if (NULL != set) | 1631 | if (NULL != set) |
1609 | { | 1632 | { |
1610 | GNUNET_CONTAINER_DLL_remove (set->ops_head, | 1633 | GNUNET_CONTAINER_DLL_remove (set->ops_head, |
@@ -5043,7 +5066,7 @@ handle_client_evaluate (void *cls, | |||
5043 | #endif | 5066 | #endif |
5044 | 5067 | ||
5045 | /* Advance generation values, so that | 5068 | /* Advance generation values, so that |
5046 | mutations won't interfer with the running operation. */ | 5069 | mutations won't interfere with the running operation. */ |
5047 | op->set = set; | 5070 | op->set = set; |
5048 | op->generation_created = set->current_generation; | 5071 | op->generation_created = set->current_generation; |
5049 | advance_generation (set); | 5072 | advance_generation (set); |
diff --git a/src/setu/gnunet-service-setu_protocol.h b/src/setu/gnunet-service-setu_protocol.h index c2a166e60..c896166ce 100644 --- a/src/setu/gnunet-service-setu_protocol.h +++ b/src/setu/gnunet-service-setu_protocol.h | |||
@@ -218,7 +218,7 @@ struct StrataEstimatorMessage | |||
218 | /** | 218 | /** |
219 | * Size of the local set | 219 | * Size of the local set |
220 | */ | 220 | */ |
221 | uint64_t set_size; | 221 | uint64_t set_size GNUNET_PACKED; |
222 | }; | 222 | }; |
223 | 223 | ||
224 | 224 | ||
diff --git a/src/setu/gnunet-service-setu_strata_estimator.c b/src/setu/gnunet-service-setu_strata_estimator.c index 7981cc847..43ccf3afd 100644 --- a/src/setu/gnunet-service-setu_strata_estimator.c +++ b/src/setu/gnunet-service-setu_strata_estimator.c | |||
@@ -85,7 +85,8 @@ salt_key (const struct IBF_Key *k_in, | |||
85 | uint64_t x = k_in->key_val; | 85 | uint64_t x = k_in->key_val; |
86 | 86 | ||
87 | /* rotate ibf key */ | 87 | /* rotate ibf key */ |
88 | x = (x >> s) | (x << (64 - s)); | 88 | if (s > 0) |
89 | x = (x >> s) | (x << (64 - s)); | ||
89 | k_out->key_val = x; | 90 | k_out->key_val = x; |
90 | } | 91 | } |
91 | 92 | ||
diff --git a/src/setu/gnunet-setu-ibf-profiler.c b/src/setu/gnunet-setu-ibf-profiler.c index 944b63d30..6465b15b8 100644 --- a/src/setu/gnunet-setu-ibf-profiler.c +++ b/src/setu/gnunet-setu-ibf-profiler.c | |||
@@ -67,7 +67,7 @@ register_hashcode (struct GNUNET_HashCode *hash) | |||
67 | 67 | ||
68 | static void | 68 | static void |
69 | iter_hashcodes (struct IBF_Key key, | 69 | iter_hashcodes (struct IBF_Key key, |
70 | GNUNET_CONTAINER_MulitHashMapIteratorCallback iter, | 70 | GNUNET_CONTAINER_MultiHashMapIteratorCallback iter, |
71 | void *cls) | 71 | void *cls) |
72 | { | 72 | { |
73 | struct GNUNET_HashCode replicated; | 73 | struct GNUNET_HashCode replicated; |
diff --git a/src/testbed/test_testbed_api.c b/src/testbed/test_testbed_api.c index a46a7596a..ffc98f42c 100644 --- a/src/testbed/test_testbed_api.c +++ b/src/testbed/test_testbed_api.c | |||
@@ -265,7 +265,7 @@ service_connect_comp_cb (void *cls, | |||
265 | /** | 265 | /** |
266 | * Callback to be called when the requested peer information is available | 266 | * Callback to be called when the requested peer information is available |
267 | * | 267 | * |
268 | * @param cb_cls the closure from GNUNET_TETSBED_peer_get_information() | 268 | * @param cb_cls the closure from GNUNET_TESTBED_peer_get_information() |
269 | * @param op the operation this callback corresponds to | 269 | * @param op the operation this callback corresponds to |
270 | * @param pinfo the result; will be NULL if the operation has failed | 270 | * @param pinfo the result; will be NULL if the operation has failed |
271 | * @param emsg error message if the operation has failed; will be NULL if the | 271 | * @param emsg error message if the operation has failed; will be NULL if the |
diff --git a/src/testbed/test_testbed_api_test.c b/src/testbed/test_testbed_api_test.c index f451c6555..1728badc1 100644 --- a/src/testbed/test_testbed_api_test.c +++ b/src/testbed/test_testbed_api_test.c | |||
@@ -118,7 +118,7 @@ do_abort (void *cls) | |||
118 | /** | 118 | /** |
119 | * Callback to be called when the requested peer information is available | 119 | * Callback to be called when the requested peer information is available |
120 | * | 120 | * |
121 | * @param cb_cls the closure from GNUNET_TETSBED_peer_get_information() | 121 | * @param cb_cls the closure from GNUNET_TESTBED_peer_get_information() |
122 | * @param op the operation this callback corresponds to | 122 | * @param op the operation this callback corresponds to |
123 | * @param pinfo the result; will be NULL if the operation has failed | 123 | * @param pinfo the result; will be NULL if the operation has failed |
124 | * @param emsg error message if the operation has failed; will be NULL if the | 124 | * @param emsg error message if the operation has failed; will be NULL if the |
diff --git a/src/testbed/testbed_api.c b/src/testbed/testbed_api.c index 2ae0a1703..ee7aac9b7 100644 --- a/src/testbed/testbed_api.c +++ b/src/testbed/testbed_api.c | |||
@@ -1945,7 +1945,7 @@ GNUNET_TESTBED_overlay_write_topology_to_file ( | |||
1945 | * want to use this in testing | 1945 | * want to use this in testing |
1946 | * | 1946 | * |
1947 | * @param trusted_ip the ip address of the controller which will be set as TRUSTED | 1947 | * @param trusted_ip the ip address of the controller which will be set as TRUSTED |
1948 | * HOST(all connections form this ip are permitted by the testbed) when | 1948 | * HOST(all connections from this ip are permitted by the testbed) when |
1949 | * starting testbed controller at host. This can either be a single ip | 1949 | * starting testbed controller at host. This can either be a single ip |
1950 | * address or a network address in CIDR notation. | 1950 | * address or a network address in CIDR notation. |
1951 | * @param hostname the hostname of the destination this message is intended for | 1951 | * @param hostname the hostname of the destination this message is intended for |
diff --git a/src/testbed/testbed_api_hosts.c b/src/testbed/testbed_api_hosts.c index 824bd0187..2919b8b75 100644 --- a/src/testbed/testbed_api_hosts.c +++ b/src/testbed/testbed_api_hosts.c | |||
@@ -792,7 +792,7 @@ free_argv (char **argv) | |||
792 | * be set locally in the function from its parameteres. If the environmental | 792 | * be set locally in the function from its parameteres. If the environmental |
793 | * variable is not found then it defaults to `ssh -o BatchMode=yes -o | 793 | * variable is not found then it defaults to `ssh -o BatchMode=yes -o |
794 | * NoHostAuthenticationForLocalhost=yes -o StrictHostkeyChecking=no -o | 794 | * NoHostAuthenticationForLocalhost=yes -o StrictHostkeyChecking=no -o |
795 | * PasswordAuthentication=noc' | 795 | * PasswordAuthentication=no' |
796 | * | 796 | * |
797 | * @param port the destination port number | 797 | * @param port the destination port number |
798 | * @param hostname the hostname of the target host | 798 | * @param hostname the hostname of the target host |
@@ -872,7 +872,7 @@ gen_rsh_args (const char *port, const char *hostname, const char *username) | |||
872 | /** | 872 | /** |
873 | * Generates the arguments needed for executing the given binary in a remote | 873 | * Generates the arguments needed for executing the given binary in a remote |
874 | * shell. Builds the arguments from the environmental variable | 874 | * shell. Builds the arguments from the environmental variable |
875 | * GNUNET_TETSBED_RSH_CMD_SUFFIX. If the environmental variable is not found, | 875 | * GNUNET_TESTBED_RSH_CMD_SUFFIX. If the environmental variable is not found, |
876 | * only the given binary name will be present in the returned arguments | 876 | * only the given binary name will be present in the returned arguments |
877 | * | 877 | * |
878 | * @param append_args the arguments to append after generating the suffix | 878 | * @param append_args the arguments to append after generating the suffix |
@@ -1054,7 +1054,7 @@ GNUNET_TESTBED_controller_start (const char *trusted_ip, | |||
1054 | host->locked = GNUNET_YES; | 1054 | host->locked = GNUNET_YES; |
1055 | API_VIOLATION ( | 1055 | API_VIOLATION ( |
1056 | GNUNET_NO == host->controller_started, | 1056 | GNUNET_NO == host->controller_started, |
1057 | "Attempting to start a controller on a host which is already started a controller"); | 1057 | "Attempting to start a controller on a host on which a controller is already started"); |
1058 | cp = GNUNET_new (struct GNUNET_TESTBED_ControllerProc); | 1058 | cp = GNUNET_new (struct GNUNET_TESTBED_ControllerProc); |
1059 | if (0 == GNUNET_TESTBED_host_get_id_ (host)) | 1059 | if (0 == GNUNET_TESTBED_host_get_id_ (host)) |
1060 | { | 1060 | { |
@@ -1339,6 +1339,7 @@ GNUNET_TESTBED_is_host_habitable ( | |||
1339 | if (NULL == h->auxp) | 1339 | if (NULL == h->auxp) |
1340 | { | 1340 | { |
1341 | GNUNET_break (0); /* Cannot exec SSH? */ | 1341 | GNUNET_break (0); /* Cannot exec SSH? */ |
1342 | free_argv (h->helper_argv); | ||
1342 | GNUNET_free (h); | 1343 | GNUNET_free (h); |
1343 | return NULL; | 1344 | return NULL; |
1344 | } | 1345 | } |
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index ed01558eb..431bd7d0d 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am | |||
@@ -321,6 +321,8 @@ check_PROGRAMS = \ | |||
321 | test_resolver_api.nc \ | 321 | test_resolver_api.nc \ |
322 | test_scheduler \ | 322 | test_scheduler \ |
323 | test_scheduler_delay \ | 323 | test_scheduler_delay \ |
324 | test_scheduler_hogging_cancel \ | ||
325 | test_scheduler_hogging_priority \ | ||
324 | test_service \ | 326 | test_service \ |
325 | test_strings \ | 327 | test_strings \ |
326 | test_strings_to_data \ | 328 | test_strings_to_data \ |
@@ -587,6 +589,16 @@ test_scheduler_delay_SOURCES = \ | |||
587 | test_scheduler_delay_LDADD = \ | 589 | test_scheduler_delay_LDADD = \ |
588 | libgnunetutil.la | 590 | libgnunetutil.la |
589 | 591 | ||
592 | test_scheduler_hogging_cancel_SOURCES = \ | ||
593 | test_scheduler_hogging_cancel.c | ||
594 | test_scheduler_hogging_cancel_LDADD = \ | ||
595 | libgnunetutil.la | ||
596 | |||
597 | test_scheduler_hogging_priority_SOURCES = \ | ||
598 | test_scheduler_hogging_priority.c | ||
599 | test_scheduler_hogging_priority_LDADD = \ | ||
600 | libgnunetutil.la | ||
601 | |||
590 | test_service_SOURCES = \ | 602 | test_service_SOURCES = \ |
591 | test_service.c | 603 | test_service.c |
592 | test_service_LDADD = \ | 604 | test_service_LDADD = \ |
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c index ab909484a..b61395471 100644 --- a/src/util/container_multihashmap.c +++ b/src/util/container_multihashmap.c | |||
@@ -308,7 +308,7 @@ GNUNET_CONTAINER_multihashmap_get ( | |||
308 | int | 308 | int |
309 | GNUNET_CONTAINER_multihashmap_iterate ( | 309 | GNUNET_CONTAINER_multihashmap_iterate ( |
310 | struct GNUNET_CONTAINER_MultiHashMap *map, | 310 | struct GNUNET_CONTAINER_MultiHashMap *map, |
311 | GNUNET_CONTAINER_MulitHashMapIteratorCallback it, | 311 | GNUNET_CONTAINER_MultiHashMapIteratorCallback it, |
312 | void *it_cls) | 312 | void *it_cls) |
313 | { | 313 | { |
314 | int count; | 314 | int count; |
@@ -781,7 +781,7 @@ int | |||
781 | GNUNET_CONTAINER_multihashmap_get_multiple ( | 781 | GNUNET_CONTAINER_multihashmap_get_multiple ( |
782 | struct GNUNET_CONTAINER_MultiHashMap *map, | 782 | struct GNUNET_CONTAINER_MultiHashMap *map, |
783 | const struct GNUNET_HashCode *key, | 783 | const struct GNUNET_HashCode *key, |
784 | GNUNET_CONTAINER_MulitHashMapIteratorCallback it, | 784 | GNUNET_CONTAINER_MultiHashMapIteratorCallback it, |
785 | void *it_cls) | 785 | void *it_cls) |
786 | { | 786 | { |
787 | int count; | 787 | int count; |
@@ -847,7 +847,7 @@ GNUNET_CONTAINER_multihashmap_get_multiple ( | |||
847 | unsigned int | 847 | unsigned int |
848 | GNUNET_CONTAINER_multihashmap_get_random ( | 848 | GNUNET_CONTAINER_multihashmap_get_random ( |
849 | const struct GNUNET_CONTAINER_MultiHashMap *map, | 849 | const struct GNUNET_CONTAINER_MultiHashMap *map, |
850 | GNUNET_CONTAINER_MulitHashMapIteratorCallback it, | 850 | GNUNET_CONTAINER_MultiHashMapIteratorCallback it, |
851 | void *it_cls) | 851 | void *it_cls) |
852 | { | 852 | { |
853 | unsigned int off; | 853 | unsigned int off; |
diff --git a/src/util/container_multihashmap32.c b/src/util/container_multihashmap32.c index 4ff4e1678..4ddf0053b 100644 --- a/src/util/container_multihashmap32.c +++ b/src/util/container_multihashmap32.c | |||
@@ -225,7 +225,7 @@ GNUNET_CONTAINER_multihashmap32_get ( | |||
225 | int | 225 | int |
226 | GNUNET_CONTAINER_multihashmap32_iterate ( | 226 | GNUNET_CONTAINER_multihashmap32_iterate ( |
227 | struct GNUNET_CONTAINER_MultiHashMap32 *map, | 227 | struct GNUNET_CONTAINER_MultiHashMap32 *map, |
228 | GNUNET_CONTAINER_MulitHashMapIterator32Callback it, | 228 | GNUNET_CONTAINER_MultiHashMapIterator32Callback it, |
229 | void *it_cls) | 229 | void *it_cls) |
230 | { | 230 | { |
231 | int count; | 231 | int count; |
@@ -491,7 +491,7 @@ int | |||
491 | GNUNET_CONTAINER_multihashmap32_get_multiple ( | 491 | GNUNET_CONTAINER_multihashmap32_get_multiple ( |
492 | struct GNUNET_CONTAINER_MultiHashMap32 *map, | 492 | struct GNUNET_CONTAINER_MultiHashMap32 *map, |
493 | uint32_t key, | 493 | uint32_t key, |
494 | GNUNET_CONTAINER_MulitHashMapIterator32Callback it, | 494 | GNUNET_CONTAINER_MultiHashMapIterator32Callback it, |
495 | void *it_cls) | 495 | void *it_cls) |
496 | { | 496 | { |
497 | int count; | 497 | int count; |
diff --git a/src/util/crypto_crc.c b/src/util/crypto_crc.c index 9328f2b84..f93b5b0b3 100644 --- a/src/util/crypto_crc.c +++ b/src/util/crypto_crc.c | |||
@@ -114,7 +114,7 @@ GNUNET_CRYPTO_crc16_step (uint32_t sum, const void *buf, size_t len) | |||
114 | for (; len >= 2; len -= 2) | 114 | for (; len >= 2; len -= 2) |
115 | sum += *(hdr++); | 115 | sum += *(hdr++); |
116 | if (len == 1) | 116 | if (len == 1) |
117 | sum += (*hdr) & ntohs (0xFF00); | 117 | sum += ntohs(*((uint8_t *)hdr) << 8); |
118 | return sum; | 118 | return sum; |
119 | } | 119 | } |
120 | 120 | ||
diff --git a/src/util/crypto_ecc_gnsrecord.c b/src/util/crypto_ecc_gnsrecord.c index b902e0e0a..fc99bfc18 100644 --- a/src/util/crypto_ecc_gnsrecord.c +++ b/src/util/crypto_ecc_gnsrecord.c | |||
@@ -361,7 +361,9 @@ GNUNET_CRYPTO_eddsa_private_key_derive ( | |||
361 | gcry_mpi_release (h); | 361 | gcry_mpi_release (h); |
362 | gcry_mpi_release (x); | 362 | gcry_mpi_release (x); |
363 | gcry_mpi_release (n); | 363 | gcry_mpi_release (n); |
364 | gcry_mpi_release (h_mod_n); | ||
364 | gcry_mpi_release (a1); | 365 | gcry_mpi_release (a1); |
366 | gcry_mpi_release (eight); | ||
365 | gcry_mpi_release (a2); | 367 | gcry_mpi_release (a2); |
366 | gcry_ctx_release (ctx); | 368 | gcry_ctx_release (ctx); |
367 | GNUNET_CRYPTO_mpi_print_unsigned (dc, sizeof(dc), d); | 369 | GNUNET_CRYPTO_mpi_print_unsigned (dc, sizeof(dc), d); |
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c index e45cb42e0..95c5c3480 100644 --- a/src/util/crypto_hash.c +++ b/src/util/crypto_hash.c | |||
@@ -73,7 +73,7 @@ GNUNET_CRYPTO_hash_from_string2 (const char *enc, | |||
73 | size_t enclen, | 73 | size_t enclen, |
74 | struct GNUNET_HashCode *result) | 74 | struct GNUNET_HashCode *result) |
75 | { | 75 | { |
76 | char upper_enc[enclen]; | 76 | char upper_enc[enclen+1]; |
77 | char *up_ptr = upper_enc; | 77 | char *up_ptr = upper_enc; |
78 | 78 | ||
79 | if (GNUNET_OK != GNUNET_STRINGS_utf8_toupper (enc, up_ptr)) | 79 | if (GNUNET_OK != GNUNET_STRINGS_utf8_toupper (enc, up_ptr)) |
diff --git a/src/util/crypto_hash_file.c b/src/util/crypto_hash_file.c index 7300bab29..96d364d2b 100644 --- a/src/util/crypto_hash_file.c +++ b/src/util/crypto_hash_file.c | |||
@@ -184,6 +184,7 @@ GNUNET_CRYPTO_hash_file (enum GNUNET_SCHEDULER_Priority priority, | |||
184 | if (GPG_ERR_NO_ERROR != gcry_md_open (&fhc->md, GCRY_MD_SHA512, 0)) | 184 | if (GPG_ERR_NO_ERROR != gcry_md_open (&fhc->md, GCRY_MD_SHA512, 0)) |
185 | { | 185 | { |
186 | GNUNET_break (0); | 186 | GNUNET_break (0); |
187 | GNUNET_free (fhc->filename); | ||
187 | GNUNET_free (fhc); | 188 | GNUNET_free (fhc); |
188 | return NULL; | 189 | return NULL; |
189 | } | 190 | } |
@@ -227,6 +228,7 @@ GNUNET_CRYPTO_hash_file_cancel (struct GNUNET_CRYPTO_FileHashContext *fhc) | |||
227 | GNUNET_free (fhc->filename); | 228 | GNUNET_free (fhc->filename); |
228 | GNUNET_break (GNUNET_OK == | 229 | GNUNET_break (GNUNET_OK == |
229 | GNUNET_DISK_file_close (fhc->fh)); | 230 | GNUNET_DISK_file_close (fhc->fh)); |
231 | gcry_md_close (fhc->md); | ||
230 | GNUNET_free (fhc); | 232 | GNUNET_free (fhc); |
231 | } | 233 | } |
232 | 234 | ||
diff --git a/src/util/gnunet-crypto-tvg.c b/src/util/gnunet-crypto-tvg.c index 4655407f0..5a16bb8fc 100644 --- a/src/util/gnunet-crypto-tvg.c +++ b/src/util/gnunet-crypto-tvg.c | |||
@@ -637,11 +637,12 @@ checkvec (const char *operation, | |||
637 | blinded_len)) ) | 637 | blinded_len)) ) |
638 | { | 638 | { |
639 | GNUNET_free (blinded_data); | 639 | GNUNET_free (blinded_data); |
640 | GNUNET_free (blinded_data_comp); | ||
640 | GNUNET_free (public_enc_data); | 641 | GNUNET_free (public_enc_data); |
641 | GNUNET_free (secret_enc_data); | 642 | GNUNET_free (secret_enc_data); |
642 | GNUNET_free (sig_enc_data); | 643 | GNUNET_free (sig_enc_data); |
643 | GNUNET_free (skey); | 644 | GNUNET_CRYPTO_rsa_private_key_free (skey); |
644 | GNUNET_free (pkey); | 645 | GNUNET_CRYPTO_rsa_public_key_free (pkey); |
645 | GNUNET_break (0); | 646 | GNUNET_break (0); |
646 | return GNUNET_NO; | 647 | return GNUNET_NO; |
647 | } | 648 | } |
@@ -650,6 +651,7 @@ checkvec (const char *operation, | |||
650 | sig = GNUNET_CRYPTO_rsa_unblind (blinded_sig, &bks, pkey); | 651 | sig = GNUNET_CRYPTO_rsa_unblind (blinded_sig, &bks, pkey); |
651 | GNUNET_assert (GNUNET_YES == GNUNET_CRYPTO_rsa_verify (&message_hash, sig, | 652 | GNUNET_assert (GNUNET_YES == GNUNET_CRYPTO_rsa_verify (&message_hash, sig, |
652 | pkey)); | 653 | pkey)); |
654 | GNUNET_free(public_enc_data); | ||
653 | public_enc_len = GNUNET_CRYPTO_rsa_public_key_encode (pkey, | 655 | public_enc_len = GNUNET_CRYPTO_rsa_public_key_encode (pkey, |
654 | &public_enc_data); | 656 | &public_enc_data); |
655 | sig_enc_length_comp = GNUNET_CRYPTO_rsa_signature_encode (sig, | 657 | sig_enc_length_comp = GNUNET_CRYPTO_rsa_signature_encode (sig, |
@@ -658,25 +660,29 @@ checkvec (const char *operation, | |||
658 | if ( (sig_enc_length != sig_enc_length_comp) || | 660 | if ( (sig_enc_length != sig_enc_length_comp) || |
659 | (0 != memcmp (sig_enc_data, sig_enc_data_comp, sig_enc_length) )) | 661 | (0 != memcmp (sig_enc_data, sig_enc_data_comp, sig_enc_length) )) |
660 | { | 662 | { |
661 | GNUNET_free (blinded_sig); | 663 | GNUNET_CRYPTO_rsa_signature_free (blinded_sig); |
662 | GNUNET_free (blinded_data); | 664 | GNUNET_free (blinded_data); |
665 | GNUNET_free (blinded_data_comp); | ||
663 | GNUNET_free (public_enc_data); | 666 | GNUNET_free (public_enc_data); |
664 | GNUNET_free (secret_enc_data); | 667 | GNUNET_free (secret_enc_data); |
665 | GNUNET_free (sig_enc_data); | 668 | GNUNET_free (sig_enc_data); |
666 | GNUNET_free (skey); | 669 | GNUNET_free (sig_enc_data_comp); |
667 | GNUNET_free (sig); | 670 | GNUNET_CRYPTO_rsa_private_key_free (skey); |
668 | GNUNET_free (pkey); | 671 | GNUNET_CRYPTO_rsa_signature_free (sig); |
672 | GNUNET_CRYPTO_rsa_public_key_free (pkey); | ||
669 | GNUNET_break (0); | 673 | GNUNET_break (0); |
670 | return GNUNET_NO; | 674 | return GNUNET_NO; |
671 | } | 675 | } |
672 | GNUNET_free (blinded_sig); | 676 | GNUNET_CRYPTO_rsa_signature_free (blinded_sig); |
673 | GNUNET_free (blinded_data); | 677 | GNUNET_free (blinded_data); |
678 | GNUNET_free (blinded_data_comp); | ||
674 | GNUNET_free (public_enc_data); | 679 | GNUNET_free (public_enc_data); |
675 | GNUNET_free (secret_enc_data); | 680 | GNUNET_free (secret_enc_data); |
676 | GNUNET_free (sig_enc_data); | 681 | GNUNET_free (sig_enc_data); |
677 | GNUNET_free (sig); | 682 | GNUNET_free (sig_enc_data_comp); |
678 | GNUNET_free (pkey); | 683 | GNUNET_CRYPTO_rsa_signature_free (sig); |
679 | GNUNET_free (skey); | 684 | GNUNET_CRYPTO_rsa_public_key_free (pkey); |
685 | GNUNET_CRYPTO_rsa_private_key_free (skey); | ||
680 | } | 686 | } |
681 | else if (0 == strcmp (operation, "cs_blind_signing")) | 687 | else if (0 == strcmp (operation, "cs_blind_signing")) |
682 | { | 688 | { |
@@ -1009,6 +1015,7 @@ check_vectors () | |||
1009 | break; | 1015 | break; |
1010 | } | 1016 | } |
1011 | } | 1017 | } |
1018 | json_decref (vecfile); | ||
1012 | return (ret == GNUNET_OK) ? 0 : 1; | 1019 | return (ret == GNUNET_OK) ? 0 : 1; |
1013 | } | 1020 | } |
1014 | } | 1021 | } |
diff --git a/src/util/scheduler.c b/src/util/scheduler.c index f3b220c4a..70193a0d2 100644 --- a/src/util/scheduler.c +++ b/src/util/scheduler.c | |||
@@ -248,6 +248,13 @@ struct GNUNET_SCHEDULER_Task | |||
248 | struct GNUNET_AsyncScopeSave scope; | 248 | struct GNUNET_AsyncScopeSave scope; |
249 | }; | 249 | }; |
250 | 250 | ||
251 | /** | ||
252 | * Placed at the end of a ready queue to indicate where a scheduler run pass | ||
253 | * ends. The next, prev, in_ready_list and priority fields are the only ones | ||
254 | * that should be used. | ||
255 | */ | ||
256 | static struct GNUNET_SCHEDULER_Task pass_end_marker; | ||
257 | |||
251 | 258 | ||
252 | /** | 259 | /** |
253 | * A struct representing an event the select driver is waiting for | 260 | * A struct representing an event the select driver is waiting for |
@@ -503,6 +510,27 @@ get_timeout () | |||
503 | return timeout; | 510 | return timeout; |
504 | } | 511 | } |
505 | 512 | ||
513 | static void remove_pass_end_marker () | ||
514 | { | ||
515 | if (pass_end_marker.in_ready_list) | ||
516 | { | ||
517 | GNUNET_CONTAINER_DLL_remove (ready_head[pass_end_marker.priority], | ||
518 | ready_tail[pass_end_marker.priority], | ||
519 | &pass_end_marker); | ||
520 | pass_end_marker.in_ready_list = GNUNET_NO; | ||
521 | } | ||
522 | } | ||
523 | |||
524 | static void set_work_priority (enum GNUNET_SCHEDULER_Priority p) | ||
525 | { | ||
526 | remove_pass_end_marker (); | ||
527 | GNUNET_CONTAINER_DLL_insert_tail (ready_head[p], | ||
528 | ready_tail[p], | ||
529 | &pass_end_marker); | ||
530 | pass_end_marker.priority = p; | ||
531 | pass_end_marker.in_ready_list = GNUNET_YES; | ||
532 | work_priority = p; | ||
533 | } | ||
506 | 534 | ||
507 | /** | 535 | /** |
508 | * Put a task that is ready for execution into the ready queue. | 536 | * Put a task that is ready for execution into the ready queue. |
@@ -518,7 +546,7 @@ queue_ready_task (struct GNUNET_SCHEDULER_Task *task) | |||
518 | ready_tail[p], | 546 | ready_tail[p], |
519 | task); | 547 | task); |
520 | if (p > work_priority) | 548 | if (p > work_priority) |
521 | work_priority = p; | 549 | set_work_priority (p); |
522 | task->in_ready_list = GNUNET_YES; | 550 | task->in_ready_list = GNUNET_YES; |
523 | ready_count++; | 551 | ready_count++; |
524 | } | 552 | } |
@@ -752,6 +780,9 @@ GNUNET_SCHEDULER_get_load (enum GNUNET_SCHEDULER_Priority p) | |||
752 | NULL != pos; | 780 | NULL != pos; |
753 | pos = pos->next) | 781 | pos = pos->next) |
754 | ret++; | 782 | ret++; |
783 | if (pass_end_marker.in_ready_list && pass_end_marker.priority == p) | ||
784 | // Don't count the dummy marker | ||
785 | ret--; | ||
755 | return ret; | 786 | return ret; |
756 | } | 787 | } |
757 | 788 | ||
@@ -2030,8 +2061,6 @@ GNUNET_SCHEDULER_do_work (struct GNUNET_SCHEDULER_Handle *sh) | |||
2030 | } | 2061 | } |
2031 | else | 2062 | else |
2032 | { | 2063 | { |
2033 | struct GNUNET_SCHEDULER_Task *last; | ||
2034 | |||
2035 | /* find out which task priority level we are going to | 2064 | /* find out which task priority level we are going to |
2036 | process this time */ | 2065 | process this time */ |
2037 | max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP; | 2066 | max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP; |
@@ -2050,8 +2079,9 @@ GNUNET_SCHEDULER_do_work (struct GNUNET_SCHEDULER_Handle *sh) | |||
2050 | 2079 | ||
2051 | /* process all *existing* tasks at this priority | 2080 | /* process all *existing* tasks at this priority |
2052 | level, then yield */ | 2081 | level, then yield */ |
2053 | last = ready_tail[work_priority]; | 2082 | set_work_priority (work_priority); |
2054 | while (NULL != (pos = ready_head[work_priority])) | 2083 | while (NULL != (pos = ready_head[work_priority]) |
2084 | && pos != &pass_end_marker) | ||
2055 | { | 2085 | { |
2056 | GNUNET_CONTAINER_DLL_remove (ready_head[work_priority], | 2086 | GNUNET_CONTAINER_DLL_remove (ready_head[work_priority], |
2057 | ready_tail[work_priority], | 2087 | ready_tail[work_priority], |
@@ -2121,14 +2151,8 @@ GNUNET_SCHEDULER_do_work (struct GNUNET_SCHEDULER_Handle *sh) | |||
2121 | active_task = NULL; | 2151 | active_task = NULL; |
2122 | dump_backtrace (pos); | 2152 | dump_backtrace (pos); |
2123 | destroy_task (pos); | 2153 | destroy_task (pos); |
2124 | /* pointer 'pos' was free'd, but we can still safely check for | ||
2125 | pointer equality still. */ | ||
2126 | if (pos == last) | ||
2127 | break; /* All tasks that _were_ ready when we started were | ||
2128 | executed. New tasks may have been added in the | ||
2129 | meantime, but we should check with the OS to | ||
2130 | be sure no higher-priority actions are pending! */ | ||
2131 | } | 2154 | } |
2155 | remove_pass_end_marker (); | ||
2132 | } | 2156 | } |
2133 | shutdown_if_no_lifeness (); | 2157 | shutdown_if_no_lifeness (); |
2134 | if (0 == ready_count) | 2158 | if (0 == ready_count) |
diff --git a/src/util/test_common_allocation.c b/src/util/test_common_allocation.c index e262b696e..d4cc4bb58 100644 --- a/src/util/test_common_allocation.c +++ b/src/util/test_common_allocation.c | |||
@@ -154,6 +154,7 @@ check2 (void) | |||
154 | a1, | 154 | a1, |
155 | 5)); | 155 | 5)); |
156 | GNUNET_assert (5 == a1_len); | 156 | GNUNET_assert (5 == a1_len); |
157 | GNUNET_free (a1); | ||
157 | return 0; | 158 | return 0; |
158 | } | 159 | } |
159 | 160 | ||
diff --git a/src/util/test_scheduler_hogging_cancel.c b/src/util/test_scheduler_hogging_cancel.c new file mode 100644 index 000000000..7611338b3 --- /dev/null +++ b/src/util/test_scheduler_hogging_cancel.c | |||
@@ -0,0 +1,51 @@ | |||
1 | #include "gnunet_util_lib.h" | ||
2 | #include <unistd.h> | ||
3 | |||
4 | static int count = 0; | ||
5 | static int final_count; | ||
6 | static struct GNUNET_SCHEDULER_Task *t4; | ||
7 | |||
8 | static void end (void *cls) | ||
9 | { | ||
10 | final_count = count; | ||
11 | count = 5000; | ||
12 | GNUNET_SCHEDULER_shutdown (); | ||
13 | } | ||
14 | |||
15 | static void self_rescheduling (void *cls) | ||
16 | { | ||
17 | if (0 == count) | ||
18 | { | ||
19 | GNUNET_SCHEDULER_cancel (t4); | ||
20 | GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_UNIT_MILLISECONDS, | ||
21 | GNUNET_SCHEDULER_PRIORITY_URGENT, | ||
22 | &end, | ||
23 | NULL); | ||
24 | sleep (1); | ||
25 | /* end should be added to ready queue on next scheduler pass for certain | ||
26 | now */ | ||
27 | } | ||
28 | if (++count < 5000) | ||
29 | { | ||
30 | GNUNET_SCHEDULER_add_now (&self_rescheduling, NULL); | ||
31 | } | ||
32 | } | ||
33 | |||
34 | static void to_be_canceled (void *cls) | ||
35 | { | ||
36 | /* Don't run me! */ | ||
37 | } | ||
38 | |||
39 | |||
40 | static void init (void *cls) | ||
41 | { | ||
42 | GNUNET_SCHEDULER_add_now (&self_rescheduling, NULL); | ||
43 | t4 = GNUNET_SCHEDULER_add_now (&to_be_canceled, NULL); | ||
44 | } | ||
45 | |||
46 | |||
47 | int main (int argc, char **argv) | ||
48 | { | ||
49 | GNUNET_SCHEDULER_run (&init, NULL); | ||
50 | return final_count < 5000 ? 0 : 1; | ||
51 | } | ||
diff --git a/src/util/test_scheduler_hogging_priority.c b/src/util/test_scheduler_hogging_priority.c new file mode 100644 index 000000000..217a39ce7 --- /dev/null +++ b/src/util/test_scheduler_hogging_priority.c | |||
@@ -0,0 +1,55 @@ | |||
1 | #include "gnunet_util_lib.h" | ||
2 | #include <unistd.h> | ||
3 | |||
4 | static int count = 0; | ||
5 | static int final_count; | ||
6 | |||
7 | static void end (void *cls) | ||
8 | { | ||
9 | final_count = count; | ||
10 | count = 5000; | ||
11 | GNUNET_SCHEDULER_shutdown (); | ||
12 | } | ||
13 | |||
14 | static void self_rescheduling (void *cls) | ||
15 | { | ||
16 | if (count == 0) | ||
17 | { | ||
18 | GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_UNIT_MILLISECONDS, | ||
19 | GNUNET_SCHEDULER_PRIORITY_URGENT, | ||
20 | &end, | ||
21 | NULL); | ||
22 | sleep(1); | ||
23 | /* end should be added to ready queue on next scheduler pass for certain | ||
24 | now */ | ||
25 | } | ||
26 | if (++count < 5000) | ||
27 | { | ||
28 | GNUNET_SCHEDULER_add_now (&self_rescheduling, NULL); | ||
29 | } | ||
30 | } | ||
31 | |||
32 | |||
33 | static void noop (void *cls) | ||
34 | { | ||
35 | } | ||
36 | |||
37 | static void indirection (void *cls) | ||
38 | { | ||
39 | GNUNET_SCHEDULER_add_with_reason_and_priority (&self_rescheduling, NULL, | ||
40 | GNUNET_SCHEDULER_REASON_STARTUP, | ||
41 | GNUNET_SCHEDULER_PRIORITY_HIGH); | ||
42 | } | ||
43 | |||
44 | static void init (void *cls) | ||
45 | { | ||
46 | GNUNET_SCHEDULER_add_now (&indirection, NULL); | ||
47 | GNUNET_SCHEDULER_add_now (&noop, NULL); | ||
48 | } | ||
49 | |||
50 | |||
51 | int main (int argc, char **argv) | ||
52 | { | ||
53 | GNUNET_SCHEDULER_run (&init, NULL); | ||
54 | return final_count < 5000 ? 0 : 1; | ||
55 | } | ||