diff options
Diffstat (limited to 'src/util')
51 files changed, 286 insertions, 154 deletions
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index ac125fb66..df319fe77 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am | |||
@@ -31,6 +31,9 @@ endif | |||
31 | 31 | ||
32 | if !MINGW | 32 | if !MINGW |
33 | SERVER_CLIENT_UNIX = test_server_with_client_unix | 33 | SERVER_CLIENT_UNIX = test_server_with_client_unix |
34 | TEST_CLIENT_UNIC_NC = test_client_unix.nc | ||
35 | else | ||
36 | TEST_CLIENT_UNIC_NC = | ||
34 | endif | 37 | endif |
35 | 38 | ||
36 | if USE_COVERAGE | 39 | if USE_COVERAGE |
@@ -266,7 +269,7 @@ endif | |||
266 | check_PROGRAMS = \ | 269 | check_PROGRAMS = \ |
267 | test_bio \ | 270 | test_bio \ |
268 | test_client.nc \ | 271 | test_client.nc \ |
269 | test_client_unix.nc \ | 272 | $(TEST_CLIENT_UNIX_NC) \ |
270 | $(SSH_USING_TESTS) \ | 273 | $(SSH_USING_TESTS) \ |
271 | test_common_allocation \ | 274 | test_common_allocation \ |
272 | test_common_endian \ | 275 | test_common_endian \ |
diff --git a/src/util/bio.c b/src/util/bio.c index 62f4904f7..08e30dc01 100644 --- a/src/util/bio.c +++ b/src/util/bio.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include "platform.h" | 25 | #include "platform.h" |
26 | #include "gnunet_util_lib.h" | 26 | #include "gnunet_util_lib.h" |
27 | 27 | ||
28 | #define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__) | 28 | #define LOG(kind,...) GNUNET_log_from (kind, "util-bio",__VA_ARGS__) |
29 | 29 | ||
30 | #ifndef PATH_MAX | 30 | #ifndef PATH_MAX |
31 | /** | 31 | /** |
diff --git a/src/util/client.c b/src/util/client.c index a5e04d7b2..0f7d0d359 100644 --- a/src/util/client.c +++ b/src/util/client.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include "gnunet_socks.h" | 33 | #include "gnunet_socks.h" |
34 | 34 | ||
35 | 35 | ||
36 | #define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__) | 36 | #define LOG(kind,...) GNUNET_log_from (kind, "util-client",__VA_ARGS__) |
37 | 37 | ||
38 | 38 | ||
39 | /** | 39 | /** |
@@ -298,6 +298,11 @@ recv_message (void *cls, | |||
298 | 298 | ||
299 | if (GNUNET_YES == cstate->in_destroy) | 299 | if (GNUNET_YES == cstate->in_destroy) |
300 | return GNUNET_SYSERR; | 300 | return GNUNET_SYSERR; |
301 | |||
302 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
303 | "Received message of type %u and size %u from %s\n", | ||
304 | ntohs (msg->type), ntohs (msg->size), cstate->service_name); | ||
305 | |||
301 | GNUNET_MQ_inject_message (cstate->mq, | 306 | GNUNET_MQ_inject_message (cstate->mq, |
302 | msg); | 307 | msg); |
303 | if (GNUNET_YES == cstate->in_destroy) | 308 | if (GNUNET_YES == cstate->in_destroy) |
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c index 71a2221ee..737584815 100644 --- a/src/util/common_allocation.c +++ b/src/util/common_allocation.c | |||
@@ -32,9 +32,9 @@ | |||
32 | #include <malloc/malloc.h> | 32 | #include <malloc/malloc.h> |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__) | 35 | #define LOG(kind,...) GNUNET_log_from (kind, "util-common-allocation",__VA_ARGS__) |
36 | 36 | ||
37 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 37 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-common-allocation", syscall) |
38 | 38 | ||
39 | #ifndef INT_MAX | 39 | #ifndef INT_MAX |
40 | #define INT_MAX 0x7FFFFFFF | 40 | #define INT_MAX 0x7FFFFFFF |
diff --git a/src/util/common_endian.c b/src/util/common_endian.c index 4c8ad7182..f29e42c98 100644 --- a/src/util/common_endian.c +++ b/src/util/common_endian.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "platform.h" | 28 | #include "platform.h" |
29 | #include "gnunet_crypto_lib.h" | 29 | #include "gnunet_crypto_lib.h" |
30 | 30 | ||
31 | #define LOG(kind,...) GNUNET_log_from (kind, "util",__VA_ARGS__) | 31 | #define LOG(kind,...) GNUNET_log_from (kind, "util-common-endian",__VA_ARGS__) |
32 | 32 | ||
33 | 33 | ||
34 | uint64_t | 34 | uint64_t |
diff --git a/src/util/configuration_loader.c b/src/util/configuration_loader.c index 07eeb98f0..ceaf2a6ea 100644 --- a/src/util/configuration_loader.c +++ b/src/util/configuration_loader.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | 29 | ||
30 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 30 | #define LOG(kind,...) GNUNET_log_from (kind, "util-configuration", __VA_ARGS__) |
31 | 31 | ||
32 | 32 | ||
33 | /** | 33 | /** |
diff --git a/src/util/connection.c b/src/util/connection.c index 02dd9f991..e822b264f 100644 --- a/src/util/connection.c +++ b/src/util/connection.c | |||
@@ -35,9 +35,9 @@ | |||
35 | #include "gnunet_resolver_service.h" | 35 | #include "gnunet_resolver_service.h" |
36 | 36 | ||
37 | 37 | ||
38 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 38 | #define LOG(kind,...) GNUNET_log_from (kind, "util-connection", __VA_ARGS__) |
39 | 39 | ||
40 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 40 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-connection", syscall) |
41 | 41 | ||
42 | 42 | ||
43 | /** | 43 | /** |
@@ -335,12 +335,17 @@ GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access_cb, | |||
335 | struct sockaddr_in6 *v6; | 335 | struct sockaddr_in6 *v6; |
336 | struct sockaddr *sa; | 336 | struct sockaddr *sa; |
337 | void *uaddr; | 337 | void *uaddr; |
338 | struct GNUNET_CONNECTION_Credentials *gcp; | ||
339 | struct GNUNET_CONNECTION_Credentials gc; | ||
340 | #ifdef SO_PEERCRED | 338 | #ifdef SO_PEERCRED |
341 | struct ucred uc; | 339 | struct ucred uc; |
342 | socklen_t olen; | 340 | socklen_t olen; |
343 | #endif | 341 | #endif |
342 | struct GNUNET_CONNECTION_Credentials *gcp; | ||
343 | #if HAVE_GETPEEREID || defined(SO_PEERCRED) || HAVE_GETPEERUCRED | ||
344 | struct GNUNET_CONNECTION_Credentials gc; | ||
345 | |||
346 | gc.uid = 0; | ||
347 | gc.gid = 0; | ||
348 | #endif | ||
344 | 349 | ||
345 | addrlen = sizeof (addr); | 350 | addrlen = sizeof (addr); |
346 | sock = | 351 | sock = |
@@ -386,8 +391,6 @@ GNUNET_CONNECTION_create_from_accept (GNUNET_CONNECTION_AccessCheck access_cb, | |||
386 | GNUNET_memcpy (uaddr, addr, addrlen); | 391 | GNUNET_memcpy (uaddr, addr, addrlen); |
387 | } | 392 | } |
388 | gcp = NULL; | 393 | gcp = NULL; |
389 | gc.uid = 0; | ||
390 | gc.gid = 0; | ||
391 | if (AF_UNIX == sa->sa_family) | 394 | if (AF_UNIX == sa->sa_family) |
392 | { | 395 | { |
393 | #if HAVE_GETPEEREID | 396 | #if HAVE_GETPEEREID |
diff --git a/src/util/container_bloomfilter.c b/src/util/container_bloomfilter.c index 58725dcc5..aedca232d 100644 --- a/src/util/container_bloomfilter.c +++ b/src/util/container_bloomfilter.c | |||
@@ -42,11 +42,11 @@ | |||
42 | #include "platform.h" | 42 | #include "platform.h" |
43 | #include "gnunet_util_lib.h" | 43 | #include "gnunet_util_lib.h" |
44 | 44 | ||
45 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 45 | #define LOG(kind,...) GNUNET_log_from (kind, "util-container-bloomfilter", __VA_ARGS__) |
46 | 46 | ||
47 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 47 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-container-bloomfilter", syscall) |
48 | 48 | ||
49 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 49 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-container-bloomfilter", syscall, filename) |
50 | 50 | ||
51 | struct GNUNET_CONTAINER_BloomFilter | 51 | struct GNUNET_CONTAINER_BloomFilter |
52 | { | 52 | { |
diff --git a/src/util/container_heap.c b/src/util/container_heap.c index 1ead5ec6d..21bdee834 100644 --- a/src/util/container_heap.c +++ b/src/util/container_heap.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "platform.h" | 28 | #include "platform.h" |
29 | #include "gnunet_container_lib.h" | 29 | #include "gnunet_container_lib.h" |
30 | 30 | ||
31 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 31 | #define LOG(kind,...) GNUNET_log_from (kind, "util-container-heap", __VA_ARGS__) |
32 | 32 | ||
33 | #define EXTRA_CHECKS 0 | 33 | #define EXTRA_CHECKS 0 |
34 | 34 | ||
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c index b4d231dae..ec527005a 100644 --- a/src/util/container_meta_data.c +++ b/src/util/container_meta_data.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #endif | 31 | #endif |
32 | #include <zlib.h> | 32 | #include <zlib.h> |
33 | 33 | ||
34 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 34 | #define LOG(kind,...) GNUNET_log_from (kind, "util-container-meta-data", __VA_ARGS__) |
35 | 35 | ||
36 | 36 | ||
37 | 37 | ||
diff --git a/src/util/container_multihashmap.c b/src/util/container_multihashmap.c index d85562579..ffeb4a71f 100644 --- a/src/util/container_multihashmap.c +++ b/src/util/container_multihashmap.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_container_lib.h" | 27 | #include "gnunet_container_lib.h" |
28 | 28 | ||
29 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 29 | #define LOG(kind,...) GNUNET_log_from (kind, "util-container-multihashmap", __VA_ARGS__) |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * An entry in the hash map with the full key. | 32 | * An entry in the hash map with the full key. |
diff --git a/src/util/container_multihashmap32.c b/src/util/container_multihashmap32.c index 4cc9b7ebd..d33c3c2d9 100644 --- a/src/util/container_multihashmap32.c +++ b/src/util/container_multihashmap32.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include "platform.h" | 28 | #include "platform.h" |
29 | #include "gnunet_container_lib.h" | 29 | #include "gnunet_container_lib.h" |
30 | 30 | ||
31 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 31 | #define LOG(kind,...) GNUNET_log_from (kind, "util-container-multihashmap32", __VA_ARGS__) |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * An entry in the hash map. | 34 | * An entry in the hash map. |
diff --git a/src/util/container_multipeermap.c b/src/util/container_multipeermap.c index 6c62e7403..7830771d8 100644 --- a/src/util/container_multipeermap.c +++ b/src/util/container_multipeermap.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | 28 | ||
29 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 29 | #define LOG(kind,...) GNUNET_log_from (kind, "util-container-multipeermap", __VA_ARGS__) |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * An entry in the hash map with the full key. | 32 | * An entry in the hash map with the full key. |
diff --git a/src/util/container_multishortmap.c b/src/util/container_multishortmap.c index 5e8a47b09..cfa82ca20 100644 --- a/src/util/container_multishortmap.c +++ b/src/util/container_multishortmap.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | 28 | ||
29 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 29 | #define LOG(kind,...) GNUNET_log_from (kind, "util-container-multishortmap", __VA_ARGS__) |
30 | 30 | ||
31 | /** | 31 | /** |
32 | * An entry in the hash map with the full key. | 32 | * An entry in the hash map with the full key. |
diff --git a/src/util/crypto_crc.c b/src/util/crypto_crc.c index d7f5f7fc8..03b24d9f7 100644 --- a/src/util/crypto_crc.c +++ b/src/util/crypto_crc.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include "platform.h" | 30 | #include "platform.h" |
31 | #include "gnunet_crypto_lib.h" | 31 | #include "gnunet_crypto_lib.h" |
32 | 32 | ||
33 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 33 | #define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-crc", __VA_ARGS__) |
34 | 34 | ||
35 | /* Avoid wasting space on 8-byte longs. */ | 35 | /* Avoid wasting space on 8-byte longs. */ |
36 | #if UINT_MAX >= 0xffffffff | 36 | #if UINT_MAX >= 0xffffffff |
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c index 3f9150762..eaa49a991 100644 --- a/src/util/crypto_ecc.c +++ b/src/util/crypto_ecc.c | |||
@@ -38,11 +38,11 @@ | |||
38 | */ | 38 | */ |
39 | #define CURVE "Ed25519" | 39 | #define CURVE "Ed25519" |
40 | 40 | ||
41 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 41 | #define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-ecc", __VA_ARGS__) |
42 | 42 | ||
43 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 43 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-crypto-ecc", syscall) |
44 | 44 | ||
45 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 45 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-crypto-ecc", syscall, filename) |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Log an error message at log-level 'level' that indicates | 48 | * Log an error message at log-level 'level' that indicates |
diff --git a/src/util/crypto_ecc_setup.c b/src/util/crypto_ecc_setup.c index 0ce55ddbf..2f2e2f122 100644 --- a/src/util/crypto_ecc_setup.c +++ b/src/util/crypto_ecc_setup.c | |||
@@ -27,11 +27,11 @@ | |||
27 | #include <gcrypt.h> | 27 | #include <gcrypt.h> |
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | 29 | ||
30 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 30 | #define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-ecc", __VA_ARGS__) |
31 | 31 | ||
32 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 32 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-crypto-ecc", syscall) |
33 | 33 | ||
34 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 34 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-crypto-ecc", syscall, filename) |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * Log an error message at log-level 'level' that indicates | 37 | * Log an error message at log-level 'level' that indicates |
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c index 31824e72a..49dbacd0b 100644 --- a/src/util/crypto_hash.c +++ b/src/util/crypto_hash.c | |||
@@ -28,9 +28,9 @@ | |||
28 | #include "gnunet_strings_lib.h" | 28 | #include "gnunet_strings_lib.h" |
29 | #include <gcrypt.h> | 29 | #include <gcrypt.h> |
30 | 30 | ||
31 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 31 | #define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-hash", __VA_ARGS__) |
32 | 32 | ||
33 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 33 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-crypto-hash", syscall, filename) |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * Hash block of given size. | 36 | * Hash block of given size. |
diff --git a/src/util/crypto_hash_file.c b/src/util/crypto_hash_file.c index ace5212c9..3e5900200 100644 --- a/src/util/crypto_hash_file.c +++ b/src/util/crypto_hash_file.c | |||
@@ -27,9 +27,9 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include <gcrypt.h> | 28 | #include <gcrypt.h> |
29 | 29 | ||
30 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 30 | #define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-hash-file", __VA_ARGS__) |
31 | 31 | ||
32 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 32 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-crypto-hash-file", syscall, filename) |
33 | 33 | ||
34 | 34 | ||
35 | /** | 35 | /** |
diff --git a/src/util/crypto_hkdf.c b/src/util/crypto_hkdf.c index c6c43f800..f04d3e675 100644 --- a/src/util/crypto_hkdf.c +++ b/src/util/crypto_hkdf.c | |||
@@ -36,7 +36,7 @@ | |||
36 | * - Matthias Wachs (08.10.2010) | 36 | * - Matthias Wachs (08.10.2010) |
37 | */ | 37 | */ |
38 | 38 | ||
39 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 39 | #define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-hkdf", __VA_ARGS__) |
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Set this to 0 if you compile this code outside of GNUnet. | 42 | * Set this to 0 if you compile this code outside of GNUnet. |
diff --git a/src/util/crypto_kdf.c b/src/util/crypto_kdf.c index 78fb1911a..6d7c5a096 100644 --- a/src/util/crypto_kdf.c +++ b/src/util/crypto_kdf.c | |||
@@ -30,7 +30,7 @@ | |||
30 | #include "platform.h" | 30 | #include "platform.h" |
31 | #include "gnunet_crypto_lib.h" | 31 | #include "gnunet_crypto_lib.h" |
32 | 32 | ||
33 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 33 | #define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-kdf", __VA_ARGS__) |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * @brief Derive key | 36 | * @brief Derive key |
diff --git a/src/util/crypto_mpi.c b/src/util/crypto_mpi.c index 668d5e602..ff3e9a8a7 100644 --- a/src/util/crypto_mpi.c +++ b/src/util/crypto_mpi.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "gnunet_crypto_lib.h" | 29 | #include "gnunet_crypto_lib.h" |
30 | 30 | ||
31 | 31 | ||
32 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 32 | #define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-mpi", __VA_ARGS__) |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Log an error message at log-level 'level' that indicates | 35 | * Log an error message at log-level 'level' that indicates |
diff --git a/src/util/crypto_random.c b/src/util/crypto_random.c index 8897ae24f..d5b5eb9ec 100644 --- a/src/util/crypto_random.c +++ b/src/util/crypto_random.c | |||
@@ -28,9 +28,9 @@ | |||
28 | #include "gnunet_crypto_lib.h" | 28 | #include "gnunet_crypto_lib.h" |
29 | #include <gcrypt.h> | 29 | #include <gcrypt.h> |
30 | 30 | ||
31 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 31 | #define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-random", __VA_ARGS__) |
32 | 32 | ||
33 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 33 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-crypto-random", syscall) |
34 | 34 | ||
35 | 35 | ||
36 | /* TODO: ndurner, move this to plibc? */ | 36 | /* TODO: ndurner, move this to plibc? */ |
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c index 443d597e4..7a108c21b 100644 --- a/src/util/crypto_rsa.c +++ b/src/util/crypto_rsa.c | |||
@@ -25,7 +25,7 @@ | |||
25 | #include <gcrypt.h> | 25 | #include <gcrypt.h> |
26 | #include "gnunet_crypto_lib.h" | 26 | #include "gnunet_crypto_lib.h" |
27 | 27 | ||
28 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 28 | #define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-rsa", __VA_ARGS__) |
29 | 29 | ||
30 | 30 | ||
31 | /** | 31 | /** |
@@ -430,7 +430,7 @@ rsa_blinding_key_derive (const struct GNUNET_CRYPTO_RsaPublicKey *pkey, | |||
430 | char *xts = "Blinding KDF extrator HMAC key"; /* Trusts bks' randomness more */ | 430 | char *xts = "Blinding KDF extrator HMAC key"; /* Trusts bks' randomness more */ |
431 | struct RsaBlindingKey *blind; | 431 | struct RsaBlindingKey *blind; |
432 | gcry_mpi_t n; | 432 | gcry_mpi_t n; |
433 | 433 | ||
434 | blind = GNUNET_new (struct RsaBlindingKey); | 434 | blind = GNUNET_new (struct RsaBlindingKey); |
435 | GNUNET_assert( NULL != blind ); | 435 | GNUNET_assert( NULL != blind ); |
436 | 436 | ||
@@ -454,25 +454,25 @@ rsa_blinding_key_derive (const struct GNUNET_CRYPTO_RsaPublicKey *pkey, | |||
454 | } | 454 | } |
455 | 455 | ||
456 | 456 | ||
457 | /* | 457 | /* |
458 | We originally added GNUNET_CRYPTO_kdf_mod_mpi for the benifit of the | 458 | We originally added GNUNET_CRYPTO_kdf_mod_mpi for the benifit of the |
459 | previous routine. | 459 | previous routine. |
460 | 460 | ||
461 | There was previously a call to GNUNET_CRYPTO_kdf in | 461 | There was previously a call to GNUNET_CRYPTO_kdf in |
462 | bkey = rsa_blinding_key_derive (len, bks); | 462 | bkey = rsa_blinding_key_derive (len, bks); |
463 | that gives exactly len bits where | 463 | that gives exactly len bits where |
464 | len = GNUNET_CRYPTO_rsa_public_key_len (pkey); | 464 | len = GNUNET_CRYPTO_rsa_public_key_len (pkey); |
465 | 465 | ||
466 | Now r = 2^(len-1)/pkey.n is the probability that a set high bit being | 466 | Now r = 2^(len-1)/pkey.n is the probability that a set high bit being |
467 | okay, meaning bkey < pkey.n. It follows that (1-r)/2 of the time bkey > | 467 | okay, meaning bkey < pkey.n. It follows that (1-r)/2 of the time bkey > |
468 | pkey.n making the effective bkey be | 468 | pkey.n making the effective bkey be |
469 | bkey mod pkey.n = bkey - pkey.n | 469 | bkey mod pkey.n = bkey - pkey.n |
470 | so the effective bkey has its high bit set with probability r/2. | 470 | so the effective bkey has its high bit set with probability r/2. |
471 | 471 | ||
472 | We expect r to be close to 1/2 if the exchange is honest, but the | 472 | We expect r to be close to 1/2 if the exchange is honest, but the |
473 | exchange can choose r otherwise. | 473 | exchange can choose r otherwise. |
474 | 474 | ||
475 | In blind signing, the exchange sees | 475 | In blind signing, the exchange sees |
476 | B = bkey * S mod pkey.n | 476 | B = bkey * S mod pkey.n |
477 | On deposit, the exchange sees S so they can compute bkey' = B/S mod | 477 | On deposit, the exchange sees S so they can compute bkey' = B/S mod |
478 | pkey.n for all B they recorded to see if bkey' has it's high bit set. | 478 | pkey.n for all B they recorded to see if bkey' has it's high bit set. |
@@ -489,7 +489,7 @@ the wrong and right probabilities 1/3 and 1/4, respectively. | |||
489 | I feared this gives the exchange a meaningful fraction of a bit of | 489 | I feared this gives the exchange a meaningful fraction of a bit of |
490 | information per coin involved in the transaction. It sounds damaging if | 490 | information per coin involved in the transaction. It sounds damaging if |
491 | numerous coins were involved. And it could run across transactions in | 491 | numerous coins were involved. And it could run across transactions in |
492 | some scenarios. | 492 | some scenarios. |
493 | 493 | ||
494 | We fixed this by using a more uniform deterministic pseudo-random number | 494 | We fixed this by using a more uniform deterministic pseudo-random number |
495 | generator for blinding factors. I do not believe this to be a problem | 495 | generator for blinding factors. I do not believe this to be a problem |
@@ -748,7 +748,7 @@ GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, | |||
748 | } | 748 | } |
749 | 749 | ||
750 | data = rsa_full_domain_hash (pkey, hash); | 750 | data = rsa_full_domain_hash (pkey, hash); |
751 | if (NULL == data) | 751 | if (NULL == data) |
752 | goto rsa_gcd_validate_failure; | 752 | goto rsa_gcd_validate_failure; |
753 | 753 | ||
754 | bkey = rsa_blinding_key_derive (pkey, bks); | 754 | bkey = rsa_blinding_key_derive (pkey, bks); |
@@ -771,7 +771,7 @@ GNUNET_CRYPTO_rsa_blind (const struct GNUNET_HashCode *hash, | |||
771 | gcry_mpi_release (ne[0]); | 771 | gcry_mpi_release (ne[0]); |
772 | gcry_mpi_release (ne[1]); | 772 | gcry_mpi_release (ne[1]); |
773 | gcry_mpi_release (r_e); | 773 | gcry_mpi_release (r_e); |
774 | rsa_blinding_key_free (bkey); | 774 | rsa_blinding_key_free (bkey); |
775 | 775 | ||
776 | *buf_size = numeric_mpi_alloc_n_print (data_r_e, buf); | 776 | *buf_size = numeric_mpi_alloc_n_print (data_r_e, buf); |
777 | gcry_mpi_release (data_r_e); | 777 | gcry_mpi_release (data_r_e); |
@@ -917,7 +917,7 @@ GNUNET_CRYPTO_rsa_sign_fdh (const struct GNUNET_CRYPTO_RsaPrivateKey *key, | |||
917 | GNUNET_CRYPTO_rsa_public_key_free (pkey); | 917 | GNUNET_CRYPTO_rsa_public_key_free (pkey); |
918 | if (NULL == v) /* rsa_gcd_validate failed meaning */ | 918 | if (NULL == v) /* rsa_gcd_validate failed meaning */ |
919 | return NULL; /* our *own* RSA key is malicious. */ | 919 | return NULL; /* our *own* RSA key is malicious. */ |
920 | 920 | ||
921 | sig = rsa_sign_mpi (key, v); | 921 | sig = rsa_sign_mpi (key, v); |
922 | gcry_mpi_release (v); | 922 | gcry_mpi_release (v); |
923 | return sig; | 923 | return sig; |
@@ -1077,11 +1077,11 @@ GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_RsaSignature *sig, | |||
1077 | } | 1077 | } |
1078 | 1078 | ||
1079 | bkey = rsa_blinding_key_derive (pkey, bks); | 1079 | bkey = rsa_blinding_key_derive (pkey, bks); |
1080 | if (NULL == bkey) | 1080 | if (NULL == bkey) |
1081 | { | 1081 | { |
1082 | /* RSA key is malicious since rsa_gcd_validate failed here. | 1082 | /* RSA key is malicious since rsa_gcd_validate failed here. |
1083 | * It should have failed during GNUNET_CRYPTO_rsa_blind too though, | 1083 | * It should have failed during GNUNET_CRYPTO_rsa_blind too though, |
1084 | * so the exchange is being malicious in an unfamilair way, maybe | 1084 | * so the exchange is being malicious in an unfamilair way, maybe |
1085 | * just trying to crash us. */ | 1085 | * just trying to crash us. */ |
1086 | GNUNET_break_op (0); | 1086 | GNUNET_break_op (0); |
1087 | gcry_mpi_release (n); | 1087 | gcry_mpi_release (n); |
@@ -1096,10 +1096,10 @@ GNUNET_CRYPTO_rsa_unblind (struct GNUNET_CRYPTO_RsaSignature *sig, | |||
1096 | n)) | 1096 | n)) |
1097 | { | 1097 | { |
1098 | /* We cannot find r mod n, so gcd(r,n) != 1, which should get * | 1098 | /* We cannot find r mod n, so gcd(r,n) != 1, which should get * |
1099 | * caught above, but we handle it the same here. */ | 1099 | * caught above, but we handle it the same here. */ |
1100 | GNUNET_break_op (0); | 1100 | GNUNET_break_op (0); |
1101 | gcry_mpi_release (r_inv); | 1101 | gcry_mpi_release (r_inv); |
1102 | rsa_blinding_key_free (bkey); | 1102 | rsa_blinding_key_free (bkey); |
1103 | gcry_mpi_release (n); | 1103 | gcry_mpi_release (n); |
1104 | gcry_mpi_release (s); | 1104 | gcry_mpi_release (s); |
1105 | return NULL; | 1105 | return NULL; |
@@ -1144,11 +1144,11 @@ GNUNET_CRYPTO_rsa_verify (const struct GNUNET_HashCode *hash, | |||
1144 | r = rsa_full_domain_hash (pkey, hash); | 1144 | r = rsa_full_domain_hash (pkey, hash); |
1145 | if (NULL == r) { | 1145 | if (NULL == r) { |
1146 | GNUNET_break_op (0); | 1146 | GNUNET_break_op (0); |
1147 | /* RSA key is malicious since rsa_gcd_validate failed here. | 1147 | /* RSA key is malicious since rsa_gcd_validate failed here. |
1148 | * It should have failed during GNUNET_CRYPTO_rsa_blind too though, | 1148 | * It should have failed during GNUNET_CRYPTO_rsa_blind too though, |
1149 | * so the exchange is being malicious in an unfamilair way, maybe | 1149 | * so the exchange is being malicious in an unfamilair way, maybe |
1150 | * just trying to crash us. Arguably, we've only an internal error | 1150 | * just trying to crash us. Arguably, we've only an internal error |
1151 | * though because we should've detected this in our previous call | 1151 | * though because we should've detected this in our previous call |
1152 | * to GNUNET_CRYPTO_rsa_unblind. */ | 1152 | * to GNUNET_CRYPTO_rsa_unblind. */ |
1153 | return GNUNET_NO; | 1153 | return GNUNET_NO; |
1154 | } | 1154 | } |
diff --git a/src/util/crypto_symmetric.c b/src/util/crypto_symmetric.c index 381a5d2f8..e25e2f1dd 100644 --- a/src/util/crypto_symmetric.c +++ b/src/util/crypto_symmetric.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "gnunet_crypto_lib.h" | 29 | #include "gnunet_crypto_lib.h" |
30 | #include <gcrypt.h> | 30 | #include <gcrypt.h> |
31 | 31 | ||
32 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 32 | #define LOG(kind,...) GNUNET_log_from (kind, "util-crypto-symmetric", __VA_ARGS__) |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Create a new SessionKey (for symmetric encryption). | 35 | * Create a new SessionKey (for symmetric encryption). |
diff --git a/src/util/disk.c b/src/util/disk.c index 40043549b..d3d5d87dc 100644 --- a/src/util/disk.c +++ b/src/util/disk.c | |||
@@ -28,11 +28,11 @@ | |||
28 | #include "gnunet_strings_lib.h" | 28 | #include "gnunet_strings_lib.h" |
29 | #include "gnunet_disk_lib.h" | 29 | #include "gnunet_disk_lib.h" |
30 | 30 | ||
31 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 31 | #define LOG(kind,...) GNUNET_log_from (kind, "util-disk", __VA_ARGS__) |
32 | 32 | ||
33 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 33 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-disk", syscall) |
34 | 34 | ||
35 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 35 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-disk", syscall, filename) |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * Block size for IO for copying files. | 38 | * Block size for IO for copying files. |
@@ -1840,6 +1840,8 @@ GNUNET_DISK_get_handle_from_w32_handle (HANDLE osfh) | |||
1840 | { | 1840 | { |
1841 | if (0 != ResetEvent (osfh)) | 1841 | if (0 != ResetEvent (osfh)) |
1842 | ftype = GNUNET_DISK_HANLDE_TYPE_EVENT; | 1842 | ftype = GNUNET_DISK_HANLDE_TYPE_EVENT; |
1843 | else | ||
1844 | return NULL; | ||
1843 | } | 1845 | } |
1844 | else | 1846 | else |
1845 | return NULL; | 1847 | return NULL; |
diff --git a/src/util/getopt.c b/src/util/getopt.c index e150496ae..ff62dba9b 100644 --- a/src/util/getopt.c +++ b/src/util/getopt.c | |||
@@ -47,9 +47,9 @@ Copyright Copyright (C) 2006 Christian Grothoff | |||
47 | #endif | 47 | #endif |
48 | #endif | 48 | #endif |
49 | 49 | ||
50 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 50 | #define LOG(kind,...) GNUNET_log_from (kind, "util-getopt", __VA_ARGS__) |
51 | 51 | ||
52 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 52 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-getopt", syscall) |
53 | 53 | ||
54 | #if defined (WIN32) && !defined (__CYGWIN32__) | 54 | #if defined (WIN32) && !defined (__CYGWIN32__) |
55 | /* It's not Unix, really. See? Capital letters. */ | 55 | /* It's not Unix, really. See? Capital letters. */ |
diff --git a/src/util/getopt_helpers.c b/src/util/getopt_helpers.c index ab0b67412..4d7104503 100644 --- a/src/util/getopt_helpers.c +++ b/src/util/getopt_helpers.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | 28 | ||
29 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 29 | #define LOG(kind,...) GNUNET_log_from (kind, "util-getopt", __VA_ARGS__) |
30 | 30 | ||
31 | 31 | ||
32 | /** | 32 | /** |
diff --git a/src/util/load.c b/src/util/load.c index d374d7a17..d1de6aa36 100644 --- a/src/util/load.c +++ b/src/util/load.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | 28 | ||
29 | 29 | ||
30 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 30 | #define LOG(kind,...) GNUNET_log_from (kind, "util-load", __VA_ARGS__) |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Values we track for load calculations. | 33 | * Values we track for load calculations. |
diff --git a/src/util/mq.c b/src/util/mq.c index fe47f6ab4..79e2d0455 100644 --- a/src/util/mq.c +++ b/src/util/mq.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2012-2014 GNUnet e.V. | 3 | Copyright (C) 2012-2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -26,7 +26,7 @@ | |||
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | 28 | ||
29 | #define LOG(kind,...) GNUNET_log_from (kind, "mq",__VA_ARGS__) | 29 | #define LOG(kind,...) GNUNET_log_from (kind, "util-mq",__VA_ARGS__) |
30 | 30 | ||
31 | 31 | ||
32 | struct GNUNET_MQ_Envelope | 32 | struct GNUNET_MQ_Envelope |
@@ -235,24 +235,29 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, | |||
235 | { | 235 | { |
236 | const struct GNUNET_MQ_MessageHandler *handler; | 236 | const struct GNUNET_MQ_MessageHandler *handler; |
237 | int handled = GNUNET_NO; | 237 | int handled = GNUNET_NO; |
238 | uint16_t ms = ntohs (mh->size); | 238 | uint16_t msize = ntohs (mh->size); |
239 | uint16_t mtype = ntohs (mh->type); | ||
240 | |||
241 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
242 | "Received message of type %u and size %u\n", | ||
243 | mtype, msize); | ||
239 | 244 | ||
240 | if (NULL == mq->handlers) | 245 | if (NULL == mq->handlers) |
241 | goto done; | 246 | goto done; |
242 | for (handler = mq->handlers; NULL != handler->cb; handler++) | 247 | for (handler = mq->handlers; NULL != handler->cb; handler++) |
243 | { | 248 | { |
244 | if (handler->type == ntohs (mh->type)) | 249 | if (handler->type == mtype) |
245 | { | 250 | { |
246 | handled = GNUNET_YES; | 251 | handled = GNUNET_YES; |
247 | if ( (handler->expected_size > ms) || | 252 | if ( (handler->expected_size > msize) || |
248 | ( (handler->expected_size != ms) && | 253 | ( (handler->expected_size != msize) && |
249 | (NULL == handler->mv) ) ) | 254 | (NULL == handler->mv) ) ) |
250 | { | 255 | { |
251 | /* Too small, or not an exact size and | 256 | /* Too small, or not an exact size and |
252 | no 'mv' handler to check rest */ | 257 | no 'mv' handler to check rest */ |
253 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 258 | LOG (GNUNET_ERROR_TYPE_ERROR, |
254 | "Received malformed message of type %u\n", | 259 | "Received malformed message of type %u\n", |
255 | (unsigned int) handler->type); | 260 | (unsigned int) handler->type); |
256 | GNUNET_MQ_inject_error (mq, | 261 | GNUNET_MQ_inject_error (mq, |
257 | GNUNET_MQ_ERROR_MALFORMED); | 262 | GNUNET_MQ_ERROR_MALFORMED); |
258 | break; | 263 | break; |
@@ -267,9 +272,9 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, | |||
267 | else | 272 | else |
268 | { | 273 | { |
269 | /* Message rejected by check routine */ | 274 | /* Message rejected by check routine */ |
270 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 275 | LOG (GNUNET_ERROR_TYPE_ERROR, |
271 | "Received malformed message of type %u\n", | 276 | "Received malformed message of type %u\n", |
272 | (unsigned int) handler->type); | 277 | (unsigned int) handler->type); |
273 | GNUNET_MQ_inject_error (mq, | 278 | GNUNET_MQ_inject_error (mq, |
274 | GNUNET_MQ_ERROR_MALFORMED); | 279 | GNUNET_MQ_ERROR_MALFORMED); |
275 | } | 280 | } |
@@ -279,9 +284,8 @@ GNUNET_MQ_inject_message (struct GNUNET_MQ_Handle *mq, | |||
279 | done: | 284 | done: |
280 | if (GNUNET_NO == handled) | 285 | if (GNUNET_NO == handled) |
281 | LOG (GNUNET_ERROR_TYPE_INFO, | 286 | LOG (GNUNET_ERROR_TYPE_INFO, |
282 | "No handler for message of type %d and size %d\n", | 287 | "No handler for message of type %u and size %u\n", |
283 | ntohs (mh->type), | 288 | mtype, msize); |
284 | ntohs (mh->size)); | ||
285 | } | 289 | } |
286 | 290 | ||
287 | 291 | ||
@@ -358,6 +362,7 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, | |||
358 | GNUNET_assert (NULL == ev->parent_queue); | 362 | GNUNET_assert (NULL == ev->parent_queue); |
359 | 363 | ||
360 | mq->queue_length++; | 364 | mq->queue_length++; |
365 | GNUNET_break (mq->queue_length < 10000); /* This would seem like a bug... */ | ||
361 | ev->parent_queue = mq; | 366 | ev->parent_queue = mq; |
362 | /* is the implementation busy? queue it! */ | 367 | /* is the implementation busy? queue it! */ |
363 | if ( (NULL != mq->current_envelope) || | 368 | if ( (NULL != mq->current_envelope) || |
@@ -377,6 +382,46 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, | |||
377 | 382 | ||
378 | 383 | ||
379 | /** | 384 | /** |
385 | * Remove the first envelope that has not yet been sent from the message | ||
386 | * queue and return it. | ||
387 | * | ||
388 | * @param mq queue to remove envelope from | ||
389 | * @return NULL if queue is empty (or has no envelope that is not under transmission) | ||
390 | */ | ||
391 | struct GNUNET_MQ_Envelope * | ||
392 | GNUNET_MQ_unsent_head (struct GNUNET_MQ_Handle *mq) | ||
393 | { | ||
394 | struct GNUNET_MQ_Envelope *env; | ||
395 | |||
396 | env = mq->envelope_head; | ||
397 | GNUNET_CONTAINER_DLL_remove (mq->envelope_head, | ||
398 | mq->envelope_tail, | ||
399 | env); | ||
400 | mq->queue_length--; | ||
401 | env->parent_queue = NULL; | ||
402 | return env; | ||
403 | } | ||
404 | |||
405 | |||
406 | /** | ||
407 | * Function to copy an envelope. The envelope must not yet | ||
408 | * be in any queue or have any options or callbacks set. | ||
409 | * | ||
410 | * @param env envelope to copy | ||
411 | * @return copy of @a env | ||
412 | */ | ||
413 | struct GNUNET_MQ_Envelope * | ||
414 | GNUNET_MQ_env_copy (struct GNUNET_MQ_Envelope *env) | ||
415 | { | ||
416 | GNUNET_assert (NULL == env->next); | ||
417 | GNUNET_assert (NULL == env->parent_queue); | ||
418 | GNUNET_assert (NULL == env->sent_cb); | ||
419 | GNUNET_assert (GNUNET_NO == env->have_custom_options); | ||
420 | return GNUNET_MQ_msg_copy (env->mh); | ||
421 | } | ||
422 | |||
423 | |||
424 | /** | ||
380 | * Send a copy of a message with the given message queue. | 425 | * Send a copy of a message with the given message queue. |
381 | * Can be called repeatedly on the same envelope. | 426 | * Can be called repeatedly on the same envelope. |
382 | * | 427 | * |
@@ -716,9 +761,13 @@ server_client_send_impl (struct GNUNET_MQ_Handle *mq, | |||
716 | const struct GNUNET_MessageHeader *msg, | 761 | const struct GNUNET_MessageHeader *msg, |
717 | void *impl_state) | 762 | void *impl_state) |
718 | { | 763 | { |
719 | struct ServerClientSocketState *state = impl_state; | ||
720 | |||
721 | GNUNET_assert (NULL != mq); | 764 | GNUNET_assert (NULL != mq); |
765 | |||
766 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
767 | "Sending message of type %u and size %u\n", | ||
768 | ntohs (msg->type), ntohs (msg->size)); | ||
769 | |||
770 | struct ServerClientSocketState *state = impl_state; | ||
722 | state->th = GNUNET_SERVER_notify_transmit_ready (state->client, | 771 | state->th = GNUNET_SERVER_notify_transmit_ready (state->client, |
723 | ntohs (msg->size), | 772 | ntohs (msg->size), |
724 | GNUNET_TIME_UNIT_FOREVER_REL, | 773 | GNUNET_TIME_UNIT_FOREVER_REL, |
diff --git a/src/util/mst.c b/src/util/mst.c index 1422c248e..9f1d30d7a 100644 --- a/src/util/mst.c +++ b/src/util/mst.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #define ALIGN_FACTOR 8 | 34 | #define ALIGN_FACTOR 8 |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 37 | #define LOG(kind,...) GNUNET_log_from (kind, "util-mst", __VA_ARGS__) |
38 | 38 | ||
39 | 39 | ||
40 | /** | 40 | /** |
diff --git a/src/util/network.c b/src/util/network.c index 67f2801c5..c82caafd9 100644 --- a/src/util/network.c +++ b/src/util/network.c | |||
@@ -28,9 +28,9 @@ | |||
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | #include "disk.h" | 29 | #include "disk.h" |
30 | 30 | ||
31 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 31 | #define LOG(kind,...) GNUNET_log_from (kind, "util-network", __VA_ARGS__) |
32 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 32 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-network", syscall, filename) |
33 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 33 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-network", syscall) |
34 | 34 | ||
35 | #define DEBUG_NETWORK GNUNET_EXTRA_LOGGING | 35 | #define DEBUG_NETWORK GNUNET_EXTRA_LOGGING |
36 | 36 | ||
diff --git a/src/util/os_installation.c b/src/util/os_installation.c index ea3ae3e79..1226c5966 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c | |||
@@ -44,9 +44,9 @@ | |||
44 | #endif | 44 | #endif |
45 | 45 | ||
46 | 46 | ||
47 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 47 | #define LOG(kind,...) GNUNET_log_from (kind, "util-os-installation", __VA_ARGS__) |
48 | 48 | ||
49 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 49 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-os-installation", syscall, filename) |
50 | 50 | ||
51 | 51 | ||
52 | /** | 52 | /** |
@@ -823,9 +823,13 @@ GNUNET_OS_check_helper_binary (const char *binary, | |||
823 | #ifdef MINGW | 823 | #ifdef MINGW |
824 | char *binaryexe; | 824 | char *binaryexe; |
825 | 825 | ||
826 | GNUNET_asprintf (&binaryexe, "%s.exe", binary); | 826 | GNUNET_asprintf (&binaryexe, |
827 | if ( (GNUNET_YES == GNUNET_STRINGS_path_is_absolute (binaryexe, GNUNET_NO, | 827 | "%s.exe", |
828 | NULL, NULL)) || | 828 | binary); |
829 | if ( (GNUNET_YES == | ||
830 | GNUNET_STRINGS_path_is_absolute (binaryexe, | ||
831 | GNUNET_NO, | ||
832 | NULL, NULL)) || | ||
829 | (0 == strncmp (binary, "./", 2)) ) | 833 | (0 == strncmp (binary, "./", 2)) ) |
830 | p = GNUNET_strdup (binaryexe); | 834 | p = GNUNET_strdup (binaryexe); |
831 | else | 835 | else |
@@ -840,16 +844,24 @@ GNUNET_OS_check_helper_binary (const char *binary, | |||
840 | } | 844 | } |
841 | GNUNET_free (binaryexe); | 845 | GNUNET_free (binaryexe); |
842 | #else | 846 | #else |
843 | if ( (GNUNET_YES == GNUNET_STRINGS_path_is_absolute (binary, GNUNET_NO, | 847 | if ( (GNUNET_YES == |
844 | NULL, NULL)) || | 848 | GNUNET_STRINGS_path_is_absolute (binary, |
849 | GNUNET_NO, | ||
850 | NULL, | ||
851 | NULL)) || | ||
845 | (0 == strncmp (binary, "./", 2)) ) | 852 | (0 == strncmp (binary, "./", 2)) ) |
853 | { | ||
846 | p = GNUNET_strdup (binary); | 854 | p = GNUNET_strdup (binary); |
855 | } | ||
847 | else | 856 | else |
848 | { | 857 | { |
849 | p = get_path_from_PATH (binary); | 858 | p = get_path_from_PATH (binary); |
850 | if (NULL != p) | 859 | if (NULL != p) |
851 | { | 860 | { |
852 | GNUNET_asprintf (&pf, "%s/%s", p, binary); | 861 | GNUNET_asprintf (&pf, |
862 | "%s/%s", | ||
863 | p, | ||
864 | binary); | ||
853 | GNUNET_free (p); | 865 | GNUNET_free (p); |
854 | p = pf; | 866 | p = pf; |
855 | } | 867 | } |
@@ -862,9 +874,12 @@ GNUNET_OS_check_helper_binary (const char *binary, | |||
862 | binary); | 874 | binary); |
863 | return GNUNET_SYSERR; | 875 | return GNUNET_SYSERR; |
864 | } | 876 | } |
865 | if (0 != ACCESS (p, X_OK)) | 877 | if (0 != ACCESS (p, |
878 | X_OK)) | ||
866 | { | 879 | { |
867 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "access", p); | 880 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, |
881 | "access", | ||
882 | p); | ||
868 | GNUNET_free (p); | 883 | GNUNET_free (p); |
869 | return GNUNET_SYSERR; | 884 | return GNUNET_SYSERR; |
870 | } | 885 | } |
@@ -873,22 +888,30 @@ GNUNET_OS_check_helper_binary (const char *binary, | |||
873 | { | 888 | { |
874 | /* as we run as root, we don't insist on SUID */ | 889 | /* as we run as root, we don't insist on SUID */ |
875 | GNUNET_free (p); | 890 | GNUNET_free (p); |
876 | return GNUNET_OK; | 891 | return GNUNET_YES; |
877 | } | 892 | } |
878 | #endif | 893 | #endif |
879 | if (0 != STAT (p, &statbuf)) | 894 | if (0 != STAT (p, |
895 | &statbuf)) | ||
880 | { | 896 | { |
881 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "stat", p); | 897 | LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, |
898 | "stat", | ||
899 | p); | ||
882 | GNUNET_free (p); | 900 | GNUNET_free (p); |
883 | return GNUNET_SYSERR; | 901 | return GNUNET_SYSERR; |
884 | } | 902 | } |
885 | if (check_suid){ | 903 | if (check_suid) |
904 | { | ||
886 | #ifndef MINGW | 905 | #ifndef MINGW |
887 | if ((0 != (statbuf.st_mode & S_ISUID)) && (0 == statbuf.st_uid)) | 906 | if ( (0 != (statbuf.st_mode & S_ISUID)) && |
907 | (0 == statbuf.st_uid) ) | ||
888 | { | 908 | { |
889 | GNUNET_free (p); | 909 | GNUNET_free (p); |
890 | return GNUNET_YES; | 910 | return GNUNET_YES; |
891 | } | 911 | } |
912 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
913 | _("Binary `%s' exists, but is not SUID\n"), | ||
914 | p); | ||
892 | /* binary exists, but not SUID */ | 915 | /* binary exists, but not SUID */ |
893 | #else | 916 | #else |
894 | STARTUPINFO start; | 917 | STARTUPINFO start; |
diff --git a/src/util/os_network.c b/src/util/os_network.c index 5e4546d08..5cb2b6864 100644 --- a/src/util/os_network.c +++ b/src/util/os_network.c | |||
@@ -31,11 +31,11 @@ | |||
31 | #include "gnunet_util_lib.h" | 31 | #include "gnunet_util_lib.h" |
32 | 32 | ||
33 | 33 | ||
34 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 34 | #define LOG(kind,...) GNUNET_log_from (kind, "util-os-network", __VA_ARGS__) |
35 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 35 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-os-network", syscall, filename) |
36 | 36 | ||
37 | 37 | ||
38 | #if ! (HAVE_GETIFADDRS && HAVE_FREEIFADDRS) | 38 | #if ! (HAVE_GETIFADDRS && HAVE_FREEIFADDRS) && !MINGW |
39 | /** | 39 | /** |
40 | * Try to enumerate all network interfaces using 'ifconfig'. | 40 | * Try to enumerate all network interfaces using 'ifconfig'. |
41 | * | 41 | * |
diff --git a/src/util/os_priority.c b/src/util/os_priority.c index 4b1dbd491..2c4f7ca09 100644 --- a/src/util/os_priority.c +++ b/src/util/os_priority.c | |||
@@ -29,11 +29,11 @@ | |||
29 | #include "disk.h" | 29 | #include "disk.h" |
30 | #include <unistr.h> | 30 | #include <unistr.h> |
31 | 31 | ||
32 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 32 | #define LOG(kind,...) GNUNET_log_from (kind, "util-os-priority", __VA_ARGS__) |
33 | 33 | ||
34 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 34 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-os-priority", syscall) |
35 | 35 | ||
36 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 36 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-os-priority", syscall, filename) |
37 | 37 | ||
38 | #define GNUNET_OS_CONTROL_PIPE "GNUNET_OS_CONTROL_PIPE" | 38 | #define GNUNET_OS_CONTROL_PIPE "GNUNET_OS_CONTROL_PIPE" |
39 | 39 | ||
@@ -1091,7 +1091,10 @@ start_process (int pipe_control, | |||
1091 | &lsocks_read, sizeof (HANDLE)); | 1091 | &lsocks_read, sizeof (HANDLE)); |
1092 | } | 1092 | } |
1093 | else | 1093 | else |
1094 | { | ||
1094 | lsocks_pipe = NULL; | 1095 | lsocks_pipe = NULL; |
1096 | lsocks_write_fd = NULL; | ||
1097 | } | ||
1095 | 1098 | ||
1096 | env_off = 0; | 1099 | env_off = 0; |
1097 | if (GNUNET_YES == pipe_control) | 1100 | if (GNUNET_YES == pipe_control) |
@@ -1229,7 +1232,7 @@ start_process (int pipe_control, | |||
1229 | if (sizeof (count) != wrote) | 1232 | if (sizeof (count) != wrote) |
1230 | { | 1233 | { |
1231 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1234 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1232 | "Failed to write %u count bytes to the child: %u\n", | 1235 | "Failed to write %u count bytes to the child: %lu\n", |
1233 | sizeof (count), GetLastError ()); | 1236 | sizeof (count), GetLastError ()); |
1234 | break; | 1237 | break; |
1235 | } | 1238 | } |
@@ -1240,7 +1243,7 @@ start_process (int pipe_control, | |||
1240 | if (SOCKET_ERROR == WSADuplicateSocketA (lsocks[i], gnunet_proc->pid, &pi)) | 1243 | if (SOCKET_ERROR == WSADuplicateSocketA (lsocks[i], gnunet_proc->pid, &pi)) |
1241 | { | 1244 | { |
1242 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1245 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1243 | "Failed to duplicate an socket[%llu]: %u\n", i, | 1246 | "Failed to duplicate an socket[%u]: %lu\n", i, |
1244 | GetLastError ()); | 1247 | GetLastError ()); |
1245 | break; | 1248 | break; |
1246 | } | 1249 | } |
@@ -1257,7 +1260,7 @@ start_process (int pipe_control, | |||
1257 | if (sizeof (size) != wrote) | 1260 | if (sizeof (size) != wrote) |
1258 | { | 1261 | { |
1259 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1262 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1260 | "Failed to write %u size[%llu] bytes to the child: %u\n", | 1263 | "Failed to write %u size[%u] bytes to the child: %lu\n", |
1261 | sizeof (size), i, GetLastError ()); | 1264 | sizeof (size), i, GetLastError ()); |
1262 | break; | 1265 | break; |
1263 | } | 1266 | } |
@@ -1266,7 +1269,7 @@ start_process (int pipe_control, | |||
1266 | if (sizeof (pi) != wrote) | 1269 | if (sizeof (pi) != wrote) |
1267 | { | 1270 | { |
1268 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1271 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1269 | "Failed to write %u socket[%llu] bytes to the child: %u\n", | 1272 | "Failed to write %u socket[%u] bytes to the child: %lu\n", |
1270 | sizeof (pi), i, GetLastError ()); | 1273 | sizeof (pi), i, GetLastError ()); |
1271 | break; | 1274 | break; |
1272 | } | 1275 | } |
diff --git a/src/util/peer.c b/src/util/peer.c index 5d54a4301..b637dc229 100644 --- a/src/util/peer.c +++ b/src/util/peer.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include "gnunet_peer_lib.h" | 27 | #include "gnunet_peer_lib.h" |
28 | 28 | ||
29 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 29 | #define LOG(kind,...) GNUNET_log_from (kind, "util-peer", __VA_ARGS__) |
30 | 30 | ||
31 | 31 | ||
32 | struct PeerEntry | 32 | struct PeerEntry |
diff --git a/src/util/plugin.c b/src/util/plugin.c index c7ac47a7c..fb296f80d 100644 --- a/src/util/plugin.c +++ b/src/util/plugin.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <ltdl.h> | 28 | #include <ltdl.h> |
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | 30 | ||
31 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 31 | #define LOG(kind,...) GNUNET_log_from (kind, "util-plugin", __VA_ARGS__) |
32 | 32 | ||
33 | /** | 33 | /** |
34 | * Linked list of active plugins. | 34 | * Linked list of active plugins. |
diff --git a/src/util/program.c b/src/util/program.c index d0dd49909..e2b356f88 100644 --- a/src/util/program.c +++ b/src/util/program.c | |||
@@ -31,9 +31,9 @@ | |||
31 | #include "speedup.h" | 31 | #include "speedup.h" |
32 | #include <gcrypt.h> | 32 | #include <gcrypt.h> |
33 | 33 | ||
34 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 34 | #define LOG(kind,...) GNUNET_log_from (kind, "util-program", __VA_ARGS__) |
35 | 35 | ||
36 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 36 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-program", syscall, filename) |
37 | 37 | ||
38 | /** | 38 | /** |
39 | * Context for the command. | 39 | * Context for the command. |
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c index fdeaed006..f33c31f1c 100644 --- a/src/util/resolver_api.c +++ b/src/util/resolver_api.c | |||
@@ -29,9 +29,9 @@ | |||
29 | #include "gnunet_resolver_service.h" | 29 | #include "gnunet_resolver_service.h" |
30 | #include "resolver.h" | 30 | #include "resolver.h" |
31 | 31 | ||
32 | #define LOG(kind,...) GNUNET_log_from (kind, "resolver-api", __VA_ARGS__) | 32 | #define LOG(kind,...) GNUNET_log_from (kind, "util-resolver-api", __VA_ARGS__) |
33 | 33 | ||
34 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "resolver-api", syscall) | 34 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-resolver-api", syscall) |
35 | 35 | ||
36 | /** | 36 | /** |
37 | * Maximum supported length for a hostname | 37 | * Maximum supported length for a hostname |
@@ -250,7 +250,7 @@ void | |||
250 | GNUNET_RESOLVER_disconnect () | 250 | GNUNET_RESOLVER_disconnect () |
251 | { | 251 | { |
252 | struct GNUNET_RESOLVER_RequestHandle *rh; | 252 | struct GNUNET_RESOLVER_RequestHandle *rh; |
253 | 253 | ||
254 | while (NULL != (rh = req_head)) | 254 | while (NULL != (rh = req_head)) |
255 | { | 255 | { |
256 | GNUNET_assert (GNUNET_SYSERR == rh->was_transmitted); | 256 | GNUNET_assert (GNUNET_SYSERR == rh->was_transmitted); |
@@ -298,7 +298,7 @@ static void | |||
298 | check_disconnect () | 298 | check_disconnect () |
299 | { | 299 | { |
300 | struct GNUNET_RESOLVER_RequestHandle *rh; | 300 | struct GNUNET_RESOLVER_RequestHandle *rh; |
301 | 301 | ||
302 | for (rh = req_head; NULL != rh; rh = rh->next) | 302 | for (rh = req_head; NULL != rh; rh = rh->next) |
303 | if (GNUNET_SYSERR != rh->was_transmitted) | 303 | if (GNUNET_SYSERR != rh->was_transmitted) |
304 | return; | 304 | return; |
diff --git a/src/util/server.c b/src/util/server.c index 00e37c9d9..83c30e328 100644 --- a/src/util/server.c +++ b/src/util/server.c | |||
@@ -28,11 +28,11 @@ | |||
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | #include "gnunet_protocols.h" | 29 | #include "gnunet_protocols.h" |
30 | 30 | ||
31 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 31 | #define LOG(kind,...) GNUNET_log_from (kind, "util-server", __VA_ARGS__) |
32 | 32 | ||
33 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 33 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-server", syscall) |
34 | 34 | ||
35 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 35 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-server", syscall, filename) |
36 | 36 | ||
37 | 37 | ||
38 | /** | 38 | /** |
@@ -945,9 +945,9 @@ GNUNET_SERVER_inject (struct GNUNET_SERVER_Handle *server, | |||
945 | 945 | ||
946 | type = ntohs (message->type); | 946 | type = ntohs (message->type); |
947 | size = ntohs (message->size); | 947 | size = ntohs (message->size); |
948 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 948 | LOG (GNUNET_ERROR_TYPE_INFO, |
949 | "Server schedules transmission of %u-byte message of type %u to client.\n", | 949 | "Received message of type %u and size %u from client\n", |
950 | size, type); | 950 | type, size); |
951 | found = GNUNET_NO; | 951 | found = GNUNET_NO; |
952 | for (pos = server->handlers; NULL != pos; pos = pos->next) | 952 | for (pos = server->handlers; NULL != pos; pos = pos->next) |
953 | { | 953 | { |
@@ -1240,8 +1240,8 @@ client_message_tokenizer_callback (void *cls, | |||
1240 | int ret; | 1240 | int ret; |
1241 | 1241 | ||
1242 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1242 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1243 | "Tokenizer gives server message of type %u from client\n", | 1243 | "Tokenizer gives server message of type %u and size %u from client\n", |
1244 | ntohs (message->type)); | 1244 | ntohs (message->type), ntohs (message->size)); |
1245 | sender->in_process_client_buffer = GNUNET_YES; | 1245 | sender->in_process_client_buffer = GNUNET_YES; |
1246 | ret = GNUNET_SERVER_inject (server, sender, message); | 1246 | ret = GNUNET_SERVER_inject (server, sender, message); |
1247 | sender->in_process_client_buffer = GNUNET_NO; | 1247 | sender->in_process_client_buffer = GNUNET_NO; |
diff --git a/src/util/server_mst.c b/src/util/server_mst.c index 8c9bc4b5b..5155b54da 100644 --- a/src/util/server_mst.c +++ b/src/util/server_mst.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #define ALIGN_FACTOR 8 | 34 | #define ALIGN_FACTOR 8 |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 37 | #define LOG(kind,...) GNUNET_log_from (kind, "util-server-mst", __VA_ARGS__) |
38 | 38 | ||
39 | 39 | ||
40 | /** | 40 | /** |
diff --git a/src/util/server_tc.c b/src/util/server_tc.c index 40a8ba015..8ae380a85 100644 --- a/src/util/server_tc.c +++ b/src/util/server_tc.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | 30 | ||
31 | 31 | ||
32 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 32 | #define LOG(kind,...) GNUNET_log_from (kind, "util-server-tc", __VA_ARGS__) |
33 | 33 | ||
34 | 34 | ||
35 | /** | 35 | /** |
diff --git a/src/util/service.c b/src/util/service.c index 11128425d..496904fb1 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -36,11 +36,11 @@ | |||
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | 38 | ||
39 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 39 | #define LOG(kind,...) GNUNET_log_from (kind, "util-service", __VA_ARGS__) |
40 | 40 | ||
41 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 41 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-service", syscall) |
42 | 42 | ||
43 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 43 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-service", syscall, filename) |
44 | 44 | ||
45 | 45 | ||
46 | /* ******************* access control ******************** */ | 46 | /* ******************* access control ******************** */ |
diff --git a/src/util/service_new.c b/src/util/service_new.c index 90829c08c..22eec0bde 100644 --- a/src/util/service_new.c +++ b/src/util/service_new.c | |||
@@ -37,11 +37,11 @@ | |||
37 | #endif | 37 | #endif |
38 | 38 | ||
39 | 39 | ||
40 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 40 | #define LOG(kind,...) GNUNET_log_from (kind, "util-service", __VA_ARGS__) |
41 | 41 | ||
42 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 42 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-service", syscall) |
43 | 43 | ||
44 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util", syscall, filename) | 44 | #define LOG_STRERROR_FILE(kind,syscall,filename) GNUNET_log_from_strerror_file (kind, "util-service", syscall, filename) |
45 | 45 | ||
46 | 46 | ||
47 | /** | 47 | /** |
@@ -1969,6 +1969,7 @@ do_send (void *cls) | |||
1969 | client->msg_pos += ret; | 1969 | client->msg_pos += ret; |
1970 | if (left > ret) | 1970 | if (left > ret) |
1971 | { | 1971 | { |
1972 | GNUNET_assert (NULL == client->drop_task); | ||
1972 | client->send_task | 1973 | client->send_task |
1973 | = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, | 1974 | = GNUNET_SCHEDULER_add_write_net (GNUNET_TIME_UNIT_FOREVER_REL, |
1974 | client->sock, | 1975 | client->sock, |
@@ -1995,7 +1996,14 @@ service_mq_send (struct GNUNET_MQ_Handle *mq, | |||
1995 | { | 1996 | { |
1996 | struct GNUNET_SERVICE_Client *client = impl_state; | 1997 | struct GNUNET_SERVICE_Client *client = impl_state; |
1997 | 1998 | ||
1999 | if (NULL != client->drop_task) | ||
2000 | return; /* we're going down right now, do not try to send */ | ||
1998 | GNUNET_assert (NULL == client->send_task); | 2001 | GNUNET_assert (NULL == client->send_task); |
2002 | |||
2003 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
2004 | "Sending message of type %u and size %u to client\n", | ||
2005 | ntohs (msg->type), ntohs (msg->size)); | ||
2006 | |||
1999 | client->msg = msg; | 2007 | client->msg = msg; |
2000 | client->msg_pos = 0; | 2008 | client->msg_pos = 0; |
2001 | client->send_task | 2009 | client->send_task |
@@ -2094,6 +2102,10 @@ service_client_mst_cb (void *cls, | |||
2094 | { | 2102 | { |
2095 | struct GNUNET_SERVICE_Client *client = cls; | 2103 | struct GNUNET_SERVICE_Client *client = cls; |
2096 | 2104 | ||
2105 | LOG (GNUNET_ERROR_TYPE_INFO, | ||
2106 | "Received message of type %u and size %u from client\n", | ||
2107 | ntohs (message->type), ntohs (message->size)); | ||
2108 | |||
2097 | GNUNET_assert (GNUNET_NO == client->needs_continue); | 2109 | GNUNET_assert (GNUNET_NO == client->needs_continue); |
2098 | client->needs_continue = GNUNET_YES; | 2110 | client->needs_continue = GNUNET_YES; |
2099 | client->warn_type = ntohs (message->type); | 2111 | client->warn_type = ntohs (message->type); |
@@ -2390,8 +2402,8 @@ resume_client_receive (void *cls) | |||
2390 | GNUNET_YES); | 2402 | GNUNET_YES); |
2391 | if (GNUNET_SYSERR == ret) | 2403 | if (GNUNET_SYSERR == ret) |
2392 | { | 2404 | { |
2393 | GNUNET_break (0); | 2405 | if (NULL != c->drop_task) |
2394 | GNUNET_SERVICE_client_drop (c); | 2406 | GNUNET_SERVICE_client_drop (c); |
2395 | return; | 2407 | return; |
2396 | } | 2408 | } |
2397 | if (GNUNET_NO == ret) | 2409 | if (GNUNET_NO == ret) |
@@ -2464,6 +2476,10 @@ finish_client_drop (void *cls) | |||
2464 | struct GNUNET_SERVICE_Client *c = cls; | 2476 | struct GNUNET_SERVICE_Client *c = cls; |
2465 | struct GNUNET_SERVICE_Handle *sh = c->sh; | 2477 | struct GNUNET_SERVICE_Handle *sh = c->sh; |
2466 | 2478 | ||
2479 | c->drop_task = NULL; | ||
2480 | GNUNET_assert (NULL == c->send_task); | ||
2481 | GNUNET_assert (NULL == c->recv_task); | ||
2482 | GNUNET_assert (NULL == c->warn_task); | ||
2467 | GNUNET_MST_destroy (c->mst); | 2483 | GNUNET_MST_destroy (c->mst); |
2468 | GNUNET_MQ_destroy (c->mq); | 2484 | GNUNET_MQ_destroy (c->mq); |
2469 | if (GNUNET_NO == c->persist) | 2485 | if (GNUNET_NO == c->persist) |
@@ -2500,7 +2516,7 @@ GNUNET_SERVICE_client_drop (struct GNUNET_SERVICE_Client *c) | |||
2500 | if (NULL != c->drop_task) | 2516 | if (NULL != c->drop_task) |
2501 | { | 2517 | { |
2502 | /* asked to drop twice! */ | 2518 | /* asked to drop twice! */ |
2503 | GNUNET_break (0); | 2519 | GNUNET_assert (0); |
2504 | return; | 2520 | return; |
2505 | } | 2521 | } |
2506 | GNUNET_CONTAINER_DLL_remove (sh->clients_head, | 2522 | GNUNET_CONTAINER_DLL_remove (sh->clients_head, |
diff --git a/src/util/signal.c b/src/util/signal.c index 543fcd899..cb917e36a 100644 --- a/src/util/signal.c +++ b/src/util/signal.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include "gnunet_util_lib.h" | 28 | #include "gnunet_util_lib.h" |
29 | 29 | ||
30 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 30 | #define LOG(kind,...) GNUNET_log_from (kind, "util-signal", __VA_ARGS__) |
31 | 31 | ||
32 | 32 | ||
33 | struct GNUNET_SIGNAL_Context | 33 | struct GNUNET_SIGNAL_Context |
diff --git a/src/util/socks.c b/src/util/socks.c index fee79cc80..37e60e3e4 100644 --- a/src/util/socks.c +++ b/src/util/socks.c | |||
@@ -29,9 +29,9 @@ | |||
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | 30 | ||
31 | 31 | ||
32 | #define LOG(kind,...) GNUNET_log_from (kind, "socks", __VA_ARGS__) | 32 | #define LOG(kind,...) GNUNET_log_from (kind, "util-socks", __VA_ARGS__) |
33 | 33 | ||
34 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "socks", syscall) | 34 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-socks", syscall) |
35 | 35 | ||
36 | 36 | ||
37 | /* SOCKS5 authentication methods */ | 37 | /* SOCKS5 authentication methods */ |
diff --git a/src/util/speedup.c b/src/util/speedup.c index 97df65c8e..c6a4cf678 100644 --- a/src/util/speedup.c +++ b/src/util/speedup.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
28 | #include "speedup.h" | 28 | #include "speedup.h" |
29 | 29 | ||
30 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 30 | #define LOG(kind,...) GNUNET_log_from (kind, "util-speedup", __VA_ARGS__) |
31 | 31 | ||
32 | 32 | ||
33 | static struct GNUNET_TIME_Relative interval; | 33 | static struct GNUNET_TIME_Relative interval; |
diff --git a/src/util/strings.c b/src/util/strings.c index 2b51d3e52..d3268f4d9 100644 --- a/src/util/strings.c +++ b/src/util/strings.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2005-2013 GNUnet e.V. | 3 | Copyright (C) 2005-2017 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software; you can redistribute it and/or modify | 5 | GNUnet is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published | 6 | it under the terms of the GNU General Public License as published |
@@ -17,7 +17,6 @@ | |||
17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 | Boston, MA 02110-1301, USA. | 18 | Boston, MA 02110-1301, USA. |
19 | */ | 19 | */ |
20 | |||
21 | /** | 20 | /** |
22 | * @file util/strings.c | 21 | * @file util/strings.c |
23 | * @brief string functions | 22 | * @brief string functions |
@@ -35,9 +34,9 @@ | |||
35 | #include <unistr.h> | 34 | #include <unistr.h> |
36 | #include <uniconv.h> | 35 | #include <uniconv.h> |
37 | 36 | ||
38 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 37 | #define LOG(kind,...) GNUNET_log_from (kind, "util-strings", __VA_ARGS__) |
39 | 38 | ||
40 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util", syscall) | 39 | #define LOG_STRERROR(kind,syscall) GNUNET_log_from_strerror (kind, "util-strings", syscall) |
41 | 40 | ||
42 | 41 | ||
43 | /** | 42 | /** |
@@ -90,6 +89,37 @@ GNUNET_STRINGS_buffer_fill (char *buffer, size_t size, unsigned int count, ...) | |||
90 | 89 | ||
91 | 90 | ||
92 | /** | 91 | /** |
92 | * Convert a peer path to a human-readable string. | ||
93 | * | ||
94 | * @param pids array of PIDs to convert to a string | ||
95 | * @param num_pids length of the @a pids array | ||
96 | * @return string representing the array of @a pids | ||
97 | */ | ||
98 | char * | ||
99 | GNUNET_STRINGS_pp2s (const struct GNUNET_PeerIdentity *pids, | ||
100 | unsigned int num_pids) | ||
101 | { | ||
102 | char *buf; | ||
103 | size_t off; | ||
104 | size_t plen = num_pids * 5 + 1; | ||
105 | |||
106 | off = 0; | ||
107 | buf = GNUNET_malloc (plen); | ||
108 | for (unsigned int i = 0; | ||
109 | i < num_pids; | ||
110 | i++) | ||
111 | { | ||
112 | off += GNUNET_snprintf (&buf[off], | ||
113 | plen - off, | ||
114 | "%s%s", | ||
115 | GNUNET_i2s (&pids[i]), | ||
116 | (i == num_pids -1) ? "" : "-"); | ||
117 | } | ||
118 | return buf; | ||
119 | } | ||
120 | |||
121 | |||
122 | /** | ||
93 | * Given a buffer of a given size, find "count" | 123 | * Given a buffer of a given size, find "count" |
94 | * 0-terminated strings in the buffer and assign | 124 | * 0-terminated strings in the buffer and assign |
95 | * the count (varargs) of type "const char**" to the | 125 | * the count (varargs) of type "const char**" to the |
diff --git a/src/util/time.c b/src/util/time.c index 89b0c2d44..19100ac36 100644 --- a/src/util/time.c +++ b/src/util/time.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "gnunet_crypto_lib.h" | 27 | #include "gnunet_crypto_lib.h" |
28 | #include "gnunet_time_lib.h" | 28 | #include "gnunet_time_lib.h" |
29 | 29 | ||
30 | #define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__) | 30 | #define LOG(kind,...) GNUNET_log_from (kind, "util-time", __VA_ARGS__) |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Variable used to simulate clock skew. Used for testing, never in production. | 33 | * Variable used to simulate clock skew. Used for testing, never in production. |
diff --git a/src/util/win.c b/src/util/win.c index 7cd7e0f3c..97877b0ca 100644 --- a/src/util/win.c +++ b/src/util/win.c | |||
@@ -534,10 +534,9 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count) | |||
534 | for (i = 0; !found && i < interfaces4_len / sizeof (INTERFACE_INFO); i++) | 534 | for (i = 0; !found && i < interfaces4_len / sizeof (INTERFACE_INFO); i++) |
535 | { | 535 | { |
536 | struct sockaddr_in *m = (struct sockaddr_in *) &r->mask; | 536 | struct sockaddr_in *m = (struct sockaddr_in *) &r->mask; |
537 | if (GNUNET_memcpy (&interfaces4[i].iiAddress.Address, | 537 | GNUNET_memcpy (&interfaces4[i].iiAddress.Address, |
538 | unicast->Address.lpSockaddr, | 538 | unicast->Address.lpSockaddr, |
539 | unicast->Address.iSockaddrLength) != 0) | 539 | unicast->Address.iSockaddrLength); |
540 | continue; | ||
541 | found = 1; | 540 | found = 1; |
542 | GNUNET_memcpy (&r->address, &interfaces4[i].iiAddress.Address, | 541 | GNUNET_memcpy (&r->address, &interfaces4[i].iiAddress.Address, |
543 | sizeof (struct sockaddr_in)); | 542 | sizeof (struct sockaddr_in)); |
@@ -557,10 +556,9 @@ EnumNICs3 (struct EnumNICs3_results **results, int *results_count) | |||
557 | interfaces6 != NULL && !found && i < interfaces6->iAddressCount; | 556 | interfaces6 != NULL && !found && i < interfaces6->iAddressCount; |
558 | i++) | 557 | i++) |
559 | { | 558 | { |
560 | if (GNUNET_memcpy (interfaces6->Address[i].lpSockaddr, | 559 | GNUNET_memcpy (interfaces6->Address[i].lpSockaddr, |
561 | unicast->Address.lpSockaddr, | 560 | unicast->Address.lpSockaddr, |
562 | unicast->Address.iSockaddrLength) != 0) | 561 | unicast->Address.iSockaddrLength); |
563 | continue; | ||
564 | found = 1; | 562 | found = 1; |
565 | GNUNET_memcpy (&r->address, interfaces6->Address[i].lpSockaddr, | 563 | GNUNET_memcpy (&r->address, interfaces6->Address[i].lpSockaddr, |
566 | sizeof (struct sockaddr_in6)); | 564 | sizeof (struct sockaddr_in6)); |
diff --git a/src/util/winproc.c b/src/util/winproc.c index 66c225ce5..318b68a88 100644 --- a/src/util/winproc.c +++ b/src/util/winproc.c | |||
@@ -69,7 +69,7 @@ TAddAce GNAddAce; | |||
69 | TAddAccessAllowedAce GNAddAccessAllowedAce; | 69 | TAddAccessAllowedAce GNAddAccessAllowedAce; |
70 | TSetNamedSecurityInfo GNSetNamedSecurityInfo; | 70 | TSetNamedSecurityInfo GNSetNamedSecurityInfo; |
71 | 71 | ||
72 | #define LOG(kind,...) GNUNET_log_from (kind, "winproc", __VA_ARGS__) | 72 | #define LOG(kind,...) GNUNET_log_from (kind, "util-winproc", __VA_ARGS__) |
73 | /** | 73 | /** |
74 | * Log (panic) messages from PlibC | 74 | * Log (panic) messages from PlibC |
75 | */ | 75 | */ |