summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2021-08-16 09:20:46 +0200
committert3sserakt <t3ss@posteo.de>2021-08-16 09:21:00 +0200
commit0cd927b915340f09d19c8d2d6f6851c81340ec70 (patch)
tree3e435523b7eab4fe6247cf955c10fc47c111cdf4 /src
parent58b837048d27e04db8f5c02d6559fe7880c6cdb3 (diff)
parent26132842da462e44c397bda0941bcb9bf5e1c942 (diff)
Merge branch 'master' of ssh://gnunet.org/gnunet
Diffstat (limited to 'src')
-rw-r--r--src/arm/arm_api.c7
-rw-r--r--src/conversation/conversation_api.c1
-rw-r--r--src/datacache/plugin_datacache_postgres.c4
-rw-r--r--src/datacache/plugin_datacache_sqlite.c2
-rw-r--r--src/datastore/datastore_api.c4
-rw-r--r--src/datastore/plugin_datastore_mysql.c2
-rw-r--r--src/datastore/plugin_datastore_postgres.c2
-rw-r--r--src/datastore/plugin_datastore_sqlite.c4
-rw-r--r--src/gns/gnunet-gns-proxy.c2
-rw-r--r--src/hostlist/hostlist.conf2
-rw-r--r--src/identity/identity_api.c4
-rw-r--r--src/identity/plugin_rest_identity.c26
-rw-r--r--src/include/Makefile.am1
-rw-r--r--src/include/gnunet_container_lib.h3
-rw-r--r--src/messenger/gnunet-service-messenger_member.c1
-rw-r--r--src/messenger/gnunet-service-messenger_room.c1
-rw-r--r--src/namecache/namecache_api.c1
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c12
-rw-r--r--src/namestore/plugin_rest_namestore.c6
-rw-r--r--src/rest/plugin_rest_config.c14
-rw-r--r--src/revocation/gnunet-service-revocation.c1
-rw-r--r--src/setu/gnunet-service-setu.c62
-rw-r--r--src/setu/ibf.c10
-rw-r--r--src/testing/Makefile.am2
-rw-r--r--src/transport/Makefile.am2
-rw-r--r--src/util/client.c1
-rw-r--r--src/util/configuration.c1
-rw-r--r--src/util/crypto_hkdf.c6
-rw-r--r--src/util/disk.c1
-rw-r--r--src/util/network.c2
-rw-r--r--src/util/os_priority.c10
-rw-r--r--src/util/strings.c2
-rw-r--r--src/vpn/Makefile.am5
-rw-r--r--src/vpn/gnunet-helper-vpn.c11
34 files changed, 123 insertions, 92 deletions
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c
index afc32fc3a..5fcbfb0a9 100644
--- a/src/arm/arm_api.c
+++ b/src/arm/arm_api.c
@@ -977,9 +977,12 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h,
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
"pipe");
- } else {
+ ret = GNUNET_ARM_RESULT_START_FAILED;
+ }
+ else
+ {
wsig = GNUNET_DISK_pipe_detach_end (sig,
- GNUNET_DISK_PIPE_END_WRITE);
+ GNUNET_DISK_PIPE_END_WRITE);
ret = start_arm_service (h,
std_inheritance,
wsig);
diff --git a/src/conversation/conversation_api.c b/src/conversation/conversation_api.c
index 88fe8f11c..1984abdd6 100644
--- a/src/conversation/conversation_api.c
+++ b/src/conversation/conversation_api.c
@@ -645,6 +645,7 @@ GNUNET_CONVERSATION_phone_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_CRYPTO_hash (line,
strlen (line),
&line_port);
+ GNUNET_free (line);
phone = GNUNET_new (struct GNUNET_CONVERSATION_Phone);
if (GNUNET_OK !=
GNUNET_CRYPTO_get_peer_identity (cfg,
diff --git a/src/datacache/plugin_datacache_postgres.c b/src/datacache/plugin_datacache_postgres.c
index 724324ca4..6613ae928 100644
--- a/src/datacache/plugin_datacache_postgres.c
+++ b/src/datacache/plugin_datacache_postgres.c
@@ -306,7 +306,7 @@ postgres_plugin_get (void *cls,
{
struct Plugin *plugin = cls;
uint32_t type32 = (uint32_t) type;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Absolute now = { 0 };
struct GNUNET_PQ_QueryParam paramk[] = {
GNUNET_PQ_query_param_auto_from_type (key),
GNUNET_PQ_query_param_absolute_time (&now),
@@ -424,7 +424,7 @@ postgres_plugin_get_random (void *cls,
{
struct Plugin *plugin = cls;
uint32_t off;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Absolute now = { 0 };
struct GNUNET_TIME_Absolute expiration_time;
size_t data_size;
void *data;
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c
index a7da6b068..66ff9e82c 100644
--- a/src/datacache/plugin_datacache_sqlite.c
+++ b/src/datacache/plugin_datacache_sqlite.c
@@ -468,7 +468,7 @@ sqlite_plugin_get_random (void *cls,
struct GNUNET_TIME_Absolute exp;
size_t size;
void *dat;
- uint32_t off;
+ uint32_t off = 0;
size_t psize;
uint32_t type;
struct GNUNET_PeerIdentity *path;
diff --git a/src/datastore/datastore_api.c b/src/datastore/datastore_api.c
index d658b9c85..a49bc8586 100644
--- a/src/datastore/datastore_api.c
+++ b/src/datastore/datastore_api.c
@@ -1400,7 +1400,7 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h,
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Asked to look for data of type %u under key `%s'\n",
(unsigned int) type,
- GNUNET_h2s (key));
+ (NULL != key) ? GNUNET_h2s (key) : "NULL");
if (NULL == key)
{
env = GNUNET_MQ_msg (gm,
@@ -1430,7 +1430,7 @@ GNUNET_DATASTORE_get_key (struct GNUNET_DATASTORE_Handle *h,
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Could not queue request for `%s'\n",
- GNUNET_h2s (key));
+ (NULL != key) ? GNUNET_h2s (key): "NULL");
return NULL;
}
#if INSANE_STATISTICS
diff --git a/src/datastore/plugin_datastore_mysql.c b/src/datastore/plugin_datastore_mysql.c
index 4f0e0838e..216a6faa4 100644
--- a/src/datastore/plugin_datastore_mysql.c
+++ b/src/datastore/plugin_datastore_mysql.c
@@ -994,7 +994,7 @@ mysql_plugin_get_expiration (void *cls,
void *proc_cls)
{
struct Plugin *plugin = cls;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Absolute now = { 0 };
struct GNUNET_MY_QueryParam params_select[] = {
GNUNET_MY_query_param_absolute_time (&now),
GNUNET_MY_query_param_end
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c
index 66929f91a..8fb0bf6ee 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -729,7 +729,7 @@ postgres_plugin_get_expiration (void *cls,
void *proc_cls)
{
struct Plugin *plugin = cls;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Absolute now = { 0 };
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_absolute_time (&now),
GNUNET_PQ_query_param_end
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c
index f58955b7b..3c2d7f2d4 100644
--- a/src/datastore/plugin_datastore_sqlite.c
+++ b/src/datastore/plugin_datastore_sqlite.c
@@ -1029,7 +1029,7 @@ sqlite_plugin_get_replication (void *cls,
{
struct Plugin *plugin = cls;
struct ReplCtx rc;
- uint64_t rvalue;
+ uint64_t rvalue = 0;
uint32_t repl;
struct GNUNET_SQ_QueryParam params_sel_repl[] =
{ GNUNET_SQ_query_param_uint64 (&rvalue),
@@ -1096,7 +1096,7 @@ sqlite_plugin_get_expiration (void *cls,
{
struct Plugin *plugin = cls;
sqlite3_stmt *stmt;
- struct GNUNET_TIME_Absolute now;
+ struct GNUNET_TIME_Absolute now = { 0 };
struct GNUNET_SQ_QueryParam params[] = { GNUNET_SQ_query_param_absolute_time (
&now),
GNUNET_SQ_query_param_end };
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index 5e3f9d6df..ec9fb12ae 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -1264,7 +1264,7 @@ curl_check_hdr (void *buffer,
}
GNUNET_free (leho_host);
}
- if (0 == strcasecmp (MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,
+ else if (0 == strcasecmp (MHD_HTTP_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN,
hdr_type))
{
char *leho_host;
diff --git a/src/hostlist/hostlist.conf b/src/hostlist/hostlist.conf
index 0a31a23ad..d994ce9fb 100644
--- a/src/hostlist/hostlist.conf
+++ b/src/hostlist/hostlist.conf
@@ -20,7 +20,7 @@ HOSTLISTFILE = $GNUNET_CONFIG_HOME/hostlist/learned.txt
OPTIONS = -b
# Default list of hostlist servers for bootstrapping
-SERVERS = http://v14.gnunet.org/hostlist https://gnunet.io/hostlist
+SERVERS = http://v15.gnunet.org/hostlist https://gnunet.io/hostlist
# http://silent.0xdeadc0de.eu:8080/
# bind hostlist http server to a specific IPv4
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index 3bbe0b957..22371f91a 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -1236,14 +1236,12 @@ GNUNET_IDENTITY_public_key_from_string (const char *str,
struct GNUNET_IDENTITY_PublicKey *key)
{
enum GNUNET_GenericReturnValue ret;
- enum GNUNET_IDENTITY_KeyType ktype;
ret = GNUNET_STRINGS_string_to_data (str,
strlen (str),
key,
sizeof (*key));
if (GNUNET_OK != ret)
return GNUNET_SYSERR;
- ktype = ntohl (key->type);
return GNUNET_OK;
}
@@ -1254,14 +1252,12 @@ GNUNET_IDENTITY_private_key_from_string (const char *str,
struct GNUNET_IDENTITY_PrivateKey *key)
{
enum GNUNET_GenericReturnValue ret;
- enum GNUNET_IDENTITY_KeyType ktype;
ret = GNUNET_STRINGS_string_to_data (str,
strlen (str),
key,
sizeof (*key));
if (GNUNET_OK != ret)
return GNUNET_SYSERR;
- ktype = ntohl (key->type);
return GNUNET_OK;
}
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c
index dba1d478d..d7cd0e826 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -322,7 +322,9 @@ do_error (void *cls)
handle->response_code = MHD_HTTP_OK;
response = json_dumps (json_error, 0);
resp = GNUNET_REST_create_response (response);
- MHD_add_response_header (resp, "Content-Type", "application/json");
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Content-Type",
+ "application/json"));
handle->proc (handle->proc_cls, resp, handle->response_code);
json_decref (json_error);
GNUNET_free (response);
@@ -412,7 +414,9 @@ ego_get_for_subsystem (void *cls,
result_str = json_dumps (json_root, 0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
resp = GNUNET_REST_create_response (result_str);
- MHD_add_response_header (resp, "Content-Type", "application/json");
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Content-Type",
+ "application/json"));
json_decref (json_root);
handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
GNUNET_free (result_str);
@@ -514,7 +518,9 @@ ego_get_all (struct GNUNET_REST_RequestHandle *con_handle,
result_str = json_dumps (json_root, 0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
resp = GNUNET_REST_create_response (result_str);
- MHD_add_response_header (resp, "Content-Type", "application/json");
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Content-Type",
+ "application/json"));
json_decref (json_root);
handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
GNUNET_free (result_str);
@@ -561,7 +567,9 @@ ego_get_response (struct RequestHandle *handle, struct EgoEntry *ego_entry)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
resp = GNUNET_REST_create_response (result_str);
handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
- MHD_add_response_header (resp, "Content-Type", "application/json");
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Content-Type",
+ "application/json"));
json_decref (json_ego);
GNUNET_free (result_str);
GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
@@ -1195,7 +1203,9 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle,
// For now, independent of path return all options
resp = GNUNET_REST_create_response (NULL);
- MHD_add_response_header (resp, "Access-Control-Allow-Methods", allow_methods);
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Access-Control-Allow-Methods",
+ allow_methods));
handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
return;
@@ -1216,6 +1226,12 @@ list_ego (void *cls,
state = ID_REST_STATE_POST_INIT;
return;
}
+ if (NULL == ego)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Called with NULL ego\n");
+ return;
+ }
if (ID_REST_STATE_INIT == state)
{
ego_entry = GNUNET_new (struct EgoEntry);
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index d15186342..16ff25350 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -117,6 +117,7 @@ gnunetinclude_HEADERS = \
gnunet_testbed_logger_service.h \
gnunet_testbed_ng_service.h \
gnunet_testing_lib.h \
+ gnunet_testing_plugin.h \
gnunet_testing_ng_lib.h \
gnunet_time_lib.h \
gnunet_transport_service.h \
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index c8930746d..3eb80595c 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -2608,7 +2608,8 @@ GNUNET_CONTAINER_heap_node_get_cost (
* @return #GNUNET_YES if we should continue to iterate,
* #GNUNET_NO if not.
*/
-typedef int (*GNUNET_CONTAINER_HeapIterator) (
+typedef int
+(*GNUNET_CONTAINER_HeapIterator) (
void *cls,
struct GNUNET_CONTAINER_HeapNode *node,
void *element,
diff --git a/src/messenger/gnunet-service-messenger_member.c b/src/messenger/gnunet-service-messenger_member.c
index 7f00e8438..b0a735dbe 100644
--- a/src/messenger/gnunet-service-messenger_member.c
+++ b/src/messenger/gnunet-service-messenger_member.c
@@ -88,6 +88,7 @@ callback_scan_for_sessions (void *cls, const char *filename)
GNUNET_asprintf (&directory, "%s%c", filename, DIR_SEPARATOR);
load_member_session(member, directory);
+ GNUNET_free (directory);
}
return GNUNET_OK;
diff --git a/src/messenger/gnunet-service-messenger_room.c b/src/messenger/gnunet-service-messenger_room.c
index c3a5e3a4b..73e94908f 100644
--- a/src/messenger/gnunet-service-messenger_room.c
+++ b/src/messenger/gnunet-service-messenger_room.c
@@ -1144,6 +1144,7 @@ load_room (struct GNUNET_MESSENGER_SrvRoom *room)
GNUNET_asprintf (&last_messages_file, "%s%s", room_dir, "last_messages.list");
load_message_state(&(room->state), room_dir);
+ GNUNET_free (last_messages_file);
}
GNUNET_free(room_dir);
diff --git a/src/namecache/namecache_api.c b/src/namecache/namecache_api.c
index fdbf142a7..70c848037 100644
--- a/src/namecache/namecache_api.c
+++ b/src/namecache/namecache_api.c
@@ -228,6 +228,7 @@ handle_lookup_block_response (void *cls,
char buf[size] GNUNET_ALIGN;
struct GNUNET_GNSRECORD_Block *block;
+ memset (buf, 0, size);
block = (struct GNUNET_GNSRECORD_Block *) buf;
GNUNET_memcpy (block,
&msg[1],
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c
index 847f7cb64..95d4c5878 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -185,15 +185,15 @@ do_shutdown (void *cls)
}
if (NULL != notfound_page)
{
- MHD_destroy_response (main_page->response);
- GNUNET_free (main_page->handle);
- GNUNET_free (main_page);
+ MHD_destroy_response (notfound_page->response);
+ GNUNET_free (notfound_page->handle);
+ GNUNET_free (notfound_page);
}
if (NULL != forbidden_page)
{
- MHD_destroy_response (main_page->response);
- GNUNET_free (main_page->handle);
- GNUNET_free (main_page);
+ MHD_destroy_response (forbidden_page->response);
+ GNUNET_free (forbidden_page->handle);
+ GNUNET_free (forbidden_page);
}
if (NULL != namestore)
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c
index ae93e5eff..ff5494dc7 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -955,6 +955,12 @@ list_ego (void *cls,
state = ID_REST_STATE_POST_INIT;
return;
}
+ if (NULL == ego)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ "Called with NULL ego\n");
+ return;
+ }
if (ID_REST_STATE_INIT == state)
{
ego_entry = GNUNET_new (struct EgoEntry);
diff --git a/src/rest/plugin_rest_config.c b/src/rest/plugin_rest_config.c
index af833efff..b0f18754c 100644
--- a/src/rest/plugin_rest_config.c
+++ b/src/rest/plugin_rest_config.c
@@ -91,7 +91,6 @@ static struct RequestHandle *requests_head;
static struct RequestHandle *requests_tail;
-
/**
* Cleanup request handle.
*
@@ -199,7 +198,9 @@ get_cont (struct GNUNET_REST_RequestHandle *con_handle,
}
response = json_dumps (result, 0);
resp = GNUNET_REST_create_response (response);
- MHD_add_response_header (resp, "Content-Type", "application/json");
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Content-Type",
+ "application/json"));
handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
cleanup_handle (handle);
GNUNET_free (response);
@@ -334,6 +335,7 @@ set_cont (struct GNUNET_REST_RequestHandle *con_handle,
handle->proc (handle->proc_cls,
GNUNET_REST_create_response (NULL),
MHD_HTTP_OK);
+ GNUNET_free (cfg_fn);
cleanup_handle (handle);
}
@@ -352,9 +354,9 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle,
struct RequestHandle *handle = cls;
resp = GNUNET_REST_create_response (NULL);
- MHD_add_response_header (resp,
- "Access-Control-Allow-Methods",
- MHD_HTTP_METHOD_GET);
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Access-Control-Allow-Methods",
+ MHD_HTTP_METHOD_GET));
handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
cleanup_handle (handle);
}
@@ -424,7 +426,7 @@ libgnunet_plugin_rest_config_init (void *cls)
api->cls = &plugin;
api->name = GNUNET_REST_API_NS_CONFIG;
api->process_request = &rest_config_process_request;
- GNUNET_log (GNUNET_ERROR_TYPE_INFO, _("CONFIG REST API initialized\n"));
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO, _ ("CONFIG REST API initialized\n"));
return api;
}
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index 2d8111adb..5fe0ade98 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -949,6 +949,7 @@ run (void *cls,
if (0 > ksize)
{
GNUNET_break_op (0);
+ GNUNET_free (rm);
GNUNET_free (fn);
return;
}
diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index b01b897d8..339d347f8 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -1119,15 +1119,16 @@ estimate_best_mode_of_operation (uint64_t avg_element_size,
ibf_bucket_count = IBF_MIN_SIZE;
}
uint64_t ibf_message_count = ceil ( ((float) ibf_bucket_count)
- / MAX_BUCKETS_PER_MESSAGE);
+ / ((float) MAX_BUCKETS_PER_MESSAGE));
uint64_t estimated_counter_size = ceil (
- MIN (2 * log2l ((float) local_set_size / ibf_bucket_count), log2l (
- local_set_size)));
+ MIN (2 * log2l (((float) local_set_size)
+ / ((float) ibf_bucket_count)),
+ log2l (local_set_size)));
long double counter_bytes = (float) estimated_counter_size / 8;
- uint64_t ibf_bytes = ceil ((sizeof(struct IBFMessage) * ibf_message_count)
+ uint64_t ibf_bytes = ceil ((sizeof (struct IBFMessage) * ibf_message_count)
* 1.2 \
+ (ibf_bucket_count * sizeof(struct IBF_Key)) * 1.2 \
+ (ibf_bucket_count * sizeof(struct IBF_KeyHash))
@@ -1135,18 +1136,18 @@ estimate_best_mode_of_operation (uint64_t avg_element_size,
+ (ibf_bucket_count * counter_bytes) * 1.2);
/* Estimate full byte count for differential sync */
- uint64_t element_size = (avg_element_size + sizeof(struct
- GNUNET_SETU_ElementMessage)) \
+ uint64_t element_size = (avg_element_size
+ + sizeof (struct GNUNET_SETU_ElementMessage)) \
* estimated_total_diff;
uint64_t done_size = sizeof_done_header;
- uint64_t inquery_size = (sizeof(struct IBF_Key) + sizeof(struct
- InquiryMessage))
+ uint64_t inquery_size = (sizeof (struct IBF_Key)
+ + sizeof (struct InquiryMessage))
* estimated_total_diff;
uint64_t demand_size =
(sizeof(struct GNUNET_HashCode) + sizeof(struct GNUNET_MessageHeader))
* estimated_total_diff;
- uint64_t offer_size = (sizeof(struct GNUNET_HashCode) + sizeof(struct
- GNUNET_MessageHeader))
+ uint64_t offer_size = (sizeof (struct GNUNET_HashCode)
+ + sizeof (struct GNUNET_MessageHeader))
* estimated_total_diff;
uint64_t total_bytes_diff = (element_size + done_size + inquery_size
@@ -1183,12 +1184,13 @@ estimate_best_mode_of_operation (uint64_t avg_element_size,
* @param allowed_phases
* @param size_phases
* @param op
- * @return GNUNET_YES if message permitted in phase and GNUNET_NO if not permitted in given
+ * @return #GNUNET_YES if message permitted in phase and #GNUNET_NO if not permitted in given
* phase
*/
-static int
-check_valid_phase (const uint8_t allowed_phases[], size_t size_phases, struct
- Operation *op)
+static enum GNUNET_GenericReturnValue
+check_valid_phase (const uint8_t allowed_phases[],
+ size_t size_phases,
+ struct Operation *op)
{
/**
* Iterate over allowed phases
@@ -2146,11 +2148,15 @@ send_ibf (struct Operation *op,
LOG (GNUNET_ERROR_TYPE_DEBUG,
"sending ibf of size %u\n",
- 1 << ibf_size);
+ (unsigned int) ibf_size);
{
char name[64];
- GNUNET_snprintf (name, sizeof(name), "# sent IBF (order %u)", ibf_size);
+
+ GNUNET_snprintf (name,
+ sizeof(name),
+ "# sent IBF (order %u)",
+ ibf_size);
GNUNET_STATISTICS_update (_GSS_statistics, name, 1, GNUNET_NO);
}
@@ -4111,26 +4117,20 @@ handle_union_p2p_offer (void *cls,
perf_store.demand.sent += 1;
perf_store.demand.sent_var_bytes += sizeof(struct GNUNET_HashCode);
#endif
- ev = GNUNET_MQ_msg_header_extra (demands,
- sizeof(struct GNUNET_HashCode),
- GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND);
/* Save send demand message for message control */
if (GNUNET_YES !=
update_message_control_flow (
op->message_control_flow,
MSG_CFS_SENT,
hash,
- DEMAND_MESSAGE)
- )
+ DEMAND_MESSAGE))
{
- // GNUNET_free (ev);
LOG (GNUNET_ERROR_TYPE_ERROR,
"Double demand message sent found!\n");
GNUNET_break (0);
fail_union_operation (op);
return;
}
- ;
/* Mark offer as received received */
if (GNUNET_YES !=
@@ -4138,37 +4138,31 @@ handle_union_p2p_offer (void *cls,
op->message_control_flow,
MSG_CFS_RECEIVED,
hash,
- OFFER_MESSAGE)
- )
+ OFFER_MESSAGE))
{
- // GNUNET_free (ev);
LOG (GNUNET_ERROR_TYPE_ERROR,
"Double offer message received found!\n");
GNUNET_break (0);
fail_union_operation (op);
return;
}
- ;
-
/* Mark element to be expected to received */
if (GNUNET_YES !=
update_message_control_flow (
op->message_control_flow,
MSG_CFS_EXPECTED,
hash,
- ELEMENT_MESSAGE)
- )
+ ELEMENT_MESSAGE))
{
- // GNUNET_free (ev);
LOG (GNUNET_ERROR_TYPE_ERROR,
"Element already expected!\n");
GNUNET_break (0);
fail_union_operation (op);
return;
}
- ;
-
-
+ ev = GNUNET_MQ_msg_header_extra (demands,
+ sizeof(struct GNUNET_HashCode),
+ GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND);
GNUNET_memcpy (&demands[1],
hash,
sizeof(struct GNUNET_HashCode));
diff --git a/src/setu/ibf.c b/src/setu/ibf.c
index 8f29adb62..dbd23c320 100644
--- a/src/setu/ibf.c
+++ b/src/setu/ibf.c
@@ -462,11 +462,11 @@ unpack_counter (const struct InvertibleBloomFilter *ibf,
/**
* Pack data left in story before finishing
*/
- while (bit_to_read_left >= 0)
+ while (true)
{
/**
- * Stop decoding when end is reached
- */
+ * Stop decoding when end is reached
+ */
if (ibf_counter_ctr > (count - 1))
return;
@@ -504,13 +504,9 @@ unpack_counter (const struct InvertibleBloomFilter *ibf,
store = store | byte_read;
}
break;
-
}
-
}
-
}
-
}
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am
index 868e3fcec..8b28e6e23 100644
--- a/src/testing/Makefile.am
+++ b/src/testing/Makefile.am
@@ -15,7 +15,7 @@ lib_LTLIBRARIES = \
libgnunettesting.la
libgnunettesting_la_SOURCES = \
- testing.c \
+ testing.c testing.h \
testing_api_cmd_system_create.c \
testing_api_cmd_batch.c \
testing_api_cmd_hello_world.c \
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am
index e19ebd8e9..0613f663d 100644
--- a/src/transport/Makefile.am
+++ b/src/transport/Makefile.am
@@ -647,7 +647,6 @@ endif
if ENABLE_TEST_RUN
AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
TESTS = \
- test_transport_api_cmd_simple_send \
test_transport_address_switch_tcp \
$(HTTP_SWITCH) \
$(HTTPS_SWITCH) \
@@ -707,6 +706,7 @@ test_transport_api_slow_ats
endif
if HAVE_EXPERIMENTAL
TESTS += \
+ test_transport_api_cmd_simple_send \
test_transport_address_switch_udp \
test_plugin_udp \
test_transport_api_udp \
diff --git a/src/util/client.c b/src/util/client.c
index afd2fe900..4e5eca32a 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -745,6 +745,7 @@ test_service_configuration (const char *service_name,
service_name,
"UNIXPATH",
_ ("not a valid filename"));
+ GNUNET_free (unixpath);
return GNUNET_SYSERR; /* UNIXPATH specified but invalid! */
}
GNUNET_free (unixpath);
diff --git a/src/util/configuration.c b/src/util/configuration.c
index dff3c2e99..1aa52ad76 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -1007,6 +1007,7 @@ GNUNET_CONFIGURATION_parse (struct GNUNET_CONFIGURATION_Handle *cfg,
cf->source_filename,
parent->source_filename,
filename);
+ GNUNET_free (fn);
return GNUNET_SYSERR;
}
}
diff --git a/src/util/crypto_hkdf.c b/src/util/crypto_hkdf.c
index 86a814b12..7270b87b6 100644
--- a/src/util/crypto_hkdf.c
+++ b/src/util/crypto_hkdf.c
@@ -77,7 +77,11 @@ static const void *
doHMAC (gcry_md_hd_t mac, const void *key, size_t key_len, const void *buf,
size_t buf_len)
{
- gcry_md_setkey (mac, key, key_len);
+ if (GPG_ERR_NO_ERROR != gcry_md_setkey (mac, key, key_len))
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
gcry_md_write (mac, buf, buf_len);
return (const void *) gcry_md_read (mac, 0);
diff --git a/src/util/disk.c b/src/util/disk.c
index ada35249f..2efb52d46 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -1020,6 +1020,7 @@ GNUNET_DISK_glob (const char *glob_pattern,
LOG (GNUNET_ERROR_TYPE_ERROR,
"unsupported glob pattern: '%s'\n",
glob_pattern);
+ GNUNET_free (mypat);
return -1;
}
diff --git a/src/util/network.c b/src/util/network.c
index e771a9834..61da37ab7 100644
--- a/src/util/network.c
+++ b/src/util/network.c
@@ -122,7 +122,7 @@ GNUNET_NETWORK_test_pf (int pf)
}
else
{
- close (s);
+ GNUNET_break (0 == close (s));
ret = GNUNET_OK;
}
switch (pf)
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index 1ed9bcbf7..dc2f0f97e 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -316,7 +316,7 @@ open_dev_null (int target_fd, int flags)
if (-1 == dup2 (fd, target_fd))
{
GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "dup2");
- (void) close (fd);
+ GNUNET_break (0 == close (fd));
return;
}
GNUNET_break (0 == close (fd));
@@ -395,7 +395,7 @@ start_process (enum GNUNET_OS_InheritStdioFlags std_inheritance,
if (NULL != childpipe_write)
GNUNET_DISK_file_close (childpipe_write);
if (0 <= dup_childpipe_read_fd)
- close (dup_childpipe_read_fd);
+ GNUNET_break (0 == close (dup_childpipe_read_fd));
return NULL;
}
childpipe_read_fd = dup_childpipe_read_fd;
@@ -474,7 +474,7 @@ start_process (enum GNUNET_OS_InheritStdioFlags std_inheritance,
if (NULL != childpipe_write)
GNUNET_DISK_file_close (childpipe_write);
if (0 <= childpipe_read_fd)
- close (childpipe_read_fd);
+ GNUNET_break (0 == close (childpipe_read_fd));
errno = eno;
return NULL;
}
@@ -486,7 +486,7 @@ start_process (enum GNUNET_OS_InheritStdioFlags std_inheritance,
gnunet_proc->control_pipe = childpipe_write;
if (0 != (std_inheritance & GNUNET_OS_USE_PIPE_CONTROL))
{
- close (childpipe_read_fd);
+ GNUNET_break (0 == close (childpipe_read_fd));
}
GNUNET_array_grow (lscp, ls, 0);
return gnunet_proc;
@@ -564,7 +564,7 @@ start_process (enum GNUNET_OS_InheritStdioFlags std_inheritance,
{
/* Bury any existing FD, no matter what; they should all be closed
* on exec anyway and the important ones have been dup'ed away */
- (void) close (tgt);
+ GNUNET_break (0 == close (tgt));
GNUNET_assert (-1 != dup2 (lscp[i], tgt));
}
/* unset close-on-exec flag */
diff --git a/src/util/strings.c b/src/util/strings.c
index 24335e444..673915888 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -1600,7 +1600,7 @@ GNUNET_STRINGS_base64_encode (const void *in,
char *opt;
ret = 0;
- GNUNET_assert (len / 4 < SIZE_MAX);
+ GNUNET_assert (len < SIZE_MAX / 4 * 3 );
opt = GNUNET_malloc (2 + (len * 4 / 3) + 8);
for (size_t i = 0; i < len; ++i)
{
diff --git a/src/vpn/Makefile.am b/src/vpn/Makefile.am
index d1ecd9f98..a5bbb6e22 100644
--- a/src/vpn/Makefile.am
+++ b/src/vpn/Makefile.am
@@ -31,7 +31,10 @@ bin_PROGRAMS = \
gnunet-vpn
gnunet_helper_vpn_SOURCES = \
-gnunet-helper-vpn.c
+ gnunet-helper-vpn.c
+gnunet_helper_vpn_LDADD = \
+ $(top_builddir)/src/util/libgnunetutil.la \
+ $(GN_LIBINTL)
gnunet_service_vpn_SOURCES = \
gnunet-service-vpn.c
diff --git a/src/vpn/gnunet-helper-vpn.c b/src/vpn/gnunet-helper-vpn.c
index 7eeb07379..7686d51d5 100644
--- a/src/vpn/gnunet-helper-vpn.c
+++ b/src/vpn/gnunet-helper-vpn.c
@@ -246,7 +246,8 @@ set_address6 (const char *dev,
if (0 != close (fd))
{
fprintf (stderr,
- "close failed: %s\n",
+ "close failed at line %d: %s\n",
+ __LINE__,
strerror (errno));
exit (1);
}
@@ -367,9 +368,9 @@ set_address4 (const char *dev,
if (0 != close (fd))
{
fprintf (stderr,
- "close failed: %s\n",
+ "close failed at line %d: %s\n",
+ __LINE__,
strerror (errno));
- (void) close (fd);
exit (1);
}
}
@@ -653,7 +654,7 @@ main (int argc, char **argv)
{
fprintf (stderr,
"Fatal: prefix_len out of range\n");
- close (fd_tun);
+ (void) close (fd_tun);
return 1;
}
@@ -701,6 +702,6 @@ main (int argc, char **argv)
run (fd_tun);
global_ret = 0;
cleanup:
- close (fd_tun);
+ (void) close (fd_tun);
return global_ret;
}