diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-05-10 00:20:56 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-05-10 00:21:01 +0200 |
commit | d50dd8c4f267095c08b9f600f5389bb77de13a49 (patch) | |
tree | 014cada921cb70c4c0d9563d63e5445bc984b3f4 /src | |
parent | 365b525733c719ed1e4385344c3a36b513da7051 (diff) | |
download | gnunet-d50dd8c4f267095c08b9f600f5389bb77de13a49.tar.gz gnunet-d50dd8c4f267095c08b9f600f5389bb77de13a49.zip |
-fix bugs
Diffstat (limited to 'src')
-rw-r--r-- | src/pq/pq_connect.c | 3 | ||||
-rw-r--r-- | src/testing/testing.c | 59 |
2 files changed, 34 insertions, 28 deletions
diff --git a/src/pq/pq_connect.c b/src/pq/pq_connect.c index c8ed24de4..2bbc7e885 100644 --- a/src/pq/pq_connect.c +++ b/src/pq/pq_connect.c | |||
@@ -398,7 +398,8 @@ get_array_type_oids (struct GNUNET_PQ_Context *db) | |||
398 | if ( (GNUNET_PQ_ARRAY_UNKNOWN != atype) && | 398 | if ( (GNUNET_PQ_ARRAY_UNKNOWN != atype) && |
399 | (1 == sscanf (oid_s, | 399 | (1 == sscanf (oid_s, |
400 | "%u%c", | 400 | "%u%c", |
401 | &db->arraytype2oid[atype]))) | 401 | &db->arraytype2oid[atype], |
402 | &dummy))) | ||
402 | { | 403 | { |
403 | nfound++; | 404 | nfound++; |
404 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 405 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
diff --git a/src/testing/testing.c b/src/testing/testing.c index 2a9b0309f..fe56250a5 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c | |||
@@ -51,8 +51,8 @@ | |||
51 | * if the start script was not started from within a new namespace | 51 | * if the start script was not started from within a new namespace |
52 | * created by unshare. The UPNP test case needs public IP | 52 | * created by unshare. The UPNP test case needs public IP |
53 | * addresse for miniupnpd to function. | 53 | * addresse for miniupnpd to function. |
54 | * FIXME We should introduce a switch indicating if public | 54 | * FIXME We should introduce a switch indicating if public |
55 | * addresses should be used or not. This info has to be | 55 | * addresses should be used or not. This info has to be |
56 | * propagated from the start script to the c code. | 56 | * propagated from the start script to the c code. |
57 | #define ROUTER_CONNECT_ADDRESS_TEMPLATE "%s-172.16.150.%u" | 57 | #define ROUTER_CONNECT_ADDRESS_TEMPLATE "%s-172.16.150.%u" |
58 | 58 | ||
@@ -1283,8 +1283,8 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, | |||
1283 | goto err_ret; | 1283 | goto err_ret; |
1284 | } | 1284 | } |
1285 | GNUNET_DISK_file_close (fd); | 1285 | GNUNET_DISK_file_close (fd); |
1286 | ss_instances = GNUNET_malloc (sizeof(struct SharedServiceInstance *) | 1286 | ss_instances = GNUNET_new_array (system->n_shared_services, |
1287 | * system->n_shared_services); | 1287 | struct SharedServiceInstance*); |
1288 | for (cnt = 0; cnt < system->n_shared_services; cnt++) | 1288 | for (cnt = 0; cnt < system->n_shared_services; cnt++) |
1289 | { | 1289 | { |
1290 | ss = &system->shared_services[cnt]; | 1290 | ss = &system->shared_services[cnt]; |
@@ -1755,7 +1755,7 @@ GNUNET_TESTING_get_testname_from_underscore (const char *argv0) | |||
1755 | 1755 | ||
1756 | 1756 | ||
1757 | /** | 1757 | /** |
1758 | * Every line in the topology configuration starts with a string indicating which | 1758 | * Every line in the topology configuration starts with a string indicating which |
1759 | * kind of information will be configured with this line. Configuration values following | 1759 | * kind of information will be configured with this line. Configuration values following |
1760 | * this string are seperated by special sequences of characters. An integer value seperated | 1760 | * this string are seperated by special sequences of characters. An integer value seperated |
1761 | * by ':' is returned by this function. | 1761 | * by ':' is returned by this function. |
@@ -1773,7 +1773,7 @@ get_first_value (const char *line) | |||
1773 | char *rest = NULL; | 1773 | char *rest = NULL; |
1774 | 1774 | ||
1775 | slen = strlen (line) + 1; | 1775 | slen = strlen (line) + 1; |
1776 | copy = malloc (slen); | 1776 | copy = GNUNET_malloc (slen); |
1777 | memcpy (copy, line, slen); | 1777 | memcpy (copy, line, slen); |
1778 | token = strtok_r (copy, ":", &rest); | 1778 | token = strtok_r (copy, ":", &rest); |
1779 | token = strtok_r (NULL, ":", &rest); | 1779 | token = strtok_r (NULL, ":", &rest); |
@@ -1801,11 +1801,11 @@ get_key (const char *line) | |||
1801 | char *rest = NULL; | 1801 | char *rest = NULL; |
1802 | 1802 | ||
1803 | slen = strlen (line) + 1; | 1803 | slen = strlen (line) + 1; |
1804 | copy = malloc (slen); | 1804 | copy = GNUNET_malloc (slen); |
1805 | memcpy (copy, line, slen); | 1805 | memcpy (copy, line, slen); |
1806 | token = strtok_r (copy, ":", &rest); | 1806 | token = strtok_r (copy, ":", &rest); |
1807 | tlen = strlen (token) + 1; | 1807 | tlen = strlen (token) + 1; |
1808 | ret = malloc (tlen); | 1808 | ret = GNUNET_malloc (tlen); |
1809 | memcpy (ret, token, tlen); | 1809 | memcpy (ret, token, tlen); |
1810 | GNUNET_free (copy); | 1810 | GNUNET_free (copy); |
1811 | return ret; | 1811 | return ret; |
@@ -1813,7 +1813,7 @@ get_key (const char *line) | |||
1813 | 1813 | ||
1814 | 1814 | ||
1815 | /** | 1815 | /** |
1816 | * Every line in the topology configuration starts with a string indicating which | 1816 | * Every line in the topology configuration starts with a string indicating which |
1817 | * kind of information will be configured with this line. Configuration values following | 1817 | * kind of information will be configured with this line. Configuration values following |
1818 | * this string are seperated by special sequences of characters. A string value seperated | 1818 | * this string are seperated by special sequences of characters. A string value seperated |
1819 | * by ':' is returned by this function. | 1819 | * by ':' is returned by this function. |
@@ -1831,7 +1831,7 @@ get_first_string_value (const char *line) | |||
1831 | char *rest = NULL; | 1831 | char *rest = NULL; |
1832 | 1832 | ||
1833 | slen = strlen (line) + 1; | 1833 | slen = strlen (line) + 1; |
1834 | copy = malloc (slen); | 1834 | copy = GNUNET_malloc (slen); |
1835 | memcpy (copy, line, slen); | 1835 | memcpy (copy, line, slen); |
1836 | token = strtok_r (copy, ":", &rest); | 1836 | token = strtok_r (copy, ":", &rest); |
1837 | token = strtok_r (NULL, ":", &rest); | 1837 | token = strtok_r (NULL, ":", &rest); |
@@ -1839,7 +1839,7 @@ get_first_string_value (const char *line) | |||
1839 | "first token %s\n", | 1839 | "first token %s\n", |
1840 | token); | 1840 | token); |
1841 | slen_token = strlen (token); | 1841 | slen_token = strlen (token); |
1842 | ret = malloc (slen_token + 1); | 1842 | ret = GNUNET_malloc (slen_token + 1); |
1843 | memcpy (ret, token, slen_token + 1); | 1843 | memcpy (ret, token, slen_token + 1); |
1844 | GNUNET_free (copy); | 1844 | GNUNET_free (copy); |
1845 | return ret; | 1845 | return ret; |
@@ -1847,9 +1847,9 @@ get_first_string_value (const char *line) | |||
1847 | 1847 | ||
1848 | 1848 | ||
1849 | /** | 1849 | /** |
1850 | * Every line in the topology configuration starts with a string indicating which | 1850 | * Every line in the topology configuration starts with a string indicating which |
1851 | * kind of information will be configured with this line. Configuration values following | 1851 | * kind of information will be configured with this line. Configuration values following |
1852 | * this string are seperated by special sequences of characters. A second integer value | 1852 | * this string are seperated by special sequences of characters. A second integer value |
1853 | * seperated by ':' from a first value is returned by this function. | 1853 | * seperated by ':' from a first value is returned by this function. |
1854 | * | 1854 | * |
1855 | * @param line The line of configuration. | 1855 | * @param line The line of configuration. |
@@ -1877,9 +1877,9 @@ get_second_value (const char *line) | |||
1877 | 1877 | ||
1878 | 1878 | ||
1879 | /** | 1879 | /** |
1880 | * Every line in the topology configuration starts with a string indicating which | 1880 | * Every line in the topology configuration starts with a string indicating which |
1881 | * kind of information will be configured with this line. Configuration values following | 1881 | * kind of information will be configured with this line. Configuration values following |
1882 | * this string are seperated by special sequences of characters. A value might be | 1882 | * this string are seperated by special sequences of characters. A value might be |
1883 | * a key value pair. | 1883 | * a key value pair. |
1884 | * This function returns the value for a specific key in a configuration line. | 1884 | * This function returns the value for a specific key in a configuration line. |
1885 | * | 1885 | * |
@@ -1915,9 +1915,9 @@ get_value (const char *key, const char *line) | |||
1915 | 1915 | ||
1916 | 1916 | ||
1917 | /** | 1917 | /** |
1918 | * Every line in the topology configuration starts with a string indicating which | 1918 | * Every line in the topology configuration starts with a string indicating which |
1919 | * kind of information will be configured with this line. Configuration values following | 1919 | * kind of information will be configured with this line. Configuration values following |
1920 | * this string are seperated by special sequences of characters. A value might be | 1920 | * this string are seperated by special sequences of characters. A value might be |
1921 | * a key value pair. A special key is the 'connect' key which can appear more than once. | 1921 | * a key value pair. A special key is the 'connect' key which can appear more than once. |
1922 | * The value is the information about a connection via some protocol to some other node. | 1922 | * The value is the information about a connection via some protocol to some other node. |
1923 | * This function returns the struct GNUNET_TESTING_NodeConnection which holds the information | 1923 | * This function returns the struct GNUNET_TESTING_NodeConnection which holds the information |
@@ -2020,19 +2020,19 @@ get_connect_value (const char *line, | |||
2020 | 2020 | ||
2021 | 2021 | ||
2022 | /** | 2022 | /** |
2023 | * Every line in the topology configuration starts with a string indicating which | 2023 | * Every line in the topology configuration starts with a string indicating which |
2024 | * kind of information will be configured with this line. Configuration values following | 2024 | * kind of information will be configured with this line. Configuration values following |
2025 | * this string are seperated by special sequences of characters. A value might be | 2025 | * this string are seperated by special sequences of characters. A value might be |
2026 | * a key value pair. A special key is the 'connect' key. | 2026 | * a key value pair. A special key is the 'connect' key. |
2027 | * The value is the information about a connections via some protocol to other nodes. | 2027 | * The value is the information about a connections via some protocol to other nodes. |
2028 | * Each connection itself is a key value pair separated by the character '|' and | 2028 | * Each connection itself is a key value pair separated by the character '|' and |
2029 | * surrounded by the characters '{' and '}'. | 2029 | * surrounded by the characters '{' and '}'. |
2030 | * The struct GNUNET_TESTING_NodeConnection holds the information of each connection value. | 2030 | * The struct GNUNET_TESTING_NodeConnection holds the information of each connection value. |
2031 | * This function extracts the values of each connection into a DLL of | 2031 | * This function extracts the values of each connection into a DLL of |
2032 | * struct GNUNET_TESTING_NodeConnection which will be added to a node. | 2032 | * struct GNUNET_TESTING_NodeConnection which will be added to a node. |
2033 | * | 2033 | * |
2034 | * @param line The line of configuration. | 2034 | * @param line The line of configuration. |
2035 | * @param node The struct GNUNET_TESTING_NetjailNode to which the DLL of | 2035 | * @param node The struct GNUNET_TESTING_NetjailNode to which the DLL of |
2036 | * struct GNUNET_TESTING_NodeConnection will be added. | 2036 | * struct GNUNET_TESTING_NodeConnection will be added. |
2037 | */ | 2037 | */ |
2038 | static void | 2038 | static void |
@@ -2165,14 +2165,15 @@ log_topo (const struct GNUNET_TESTING_NetjailTopology *topology) | |||
2165 | return GNUNET_YES; | 2165 | return GNUNET_YES; |
2166 | } | 2166 | } |
2167 | 2167 | ||
2168 | |||
2168 | /** | 2169 | /** |
2169 | * This function extracts information about a specific node from the topology. | 2170 | * This function extracts information about a specific node from the topology. |
2170 | * | 2171 | * |
2171 | * @param num The global index number of the node. | 2172 | * @param num The global index number of the node. |
2172 | * @param[out] node_ex A struct GNUNET_TESTING_NetjailNode with information about the node. | 2173 | * @param[out] node_ex A struct GNUNET_TESTING_NetjailNode with information about the node. |
2173 | * @param[out] namespace_ex A struct GNUNET_TESTING_NetjailNamespace with information about the namespace | 2174 | * @param[out] namespace_ex A struct GNUNET_TESTING_NetjailNamespace with information about the namespace |
2174 | the node is in or NULL, if the node is a global node. | 2175 | the node is in or NULL, if the node is a global node. |
2175 | * @param[out] node_connections_ex A struct GNUNET_TESTING_NodeConnection with information about the connection | 2176 | * @param[out] node_connections_ex A struct GNUNET_TESTING_NodeConnection with information about the connection |
2176 | of this node to other nodes. | 2177 | of this node to other nodes. |
2177 | */ | 2178 | */ |
2178 | static void | 2179 | static void |
@@ -2249,6 +2250,7 @@ get_node_info (unsigned int num, | |||
2249 | } | 2250 | } |
2250 | } | 2251 | } |
2251 | 2252 | ||
2253 | |||
2252 | /** | 2254 | /** |
2253 | * Get a node from the topology. | 2255 | * Get a node from the topology. |
2254 | * | 2256 | * |
@@ -2258,7 +2260,7 @@ get_node_info (unsigned int num, | |||
2258 | */ | 2260 | */ |
2259 | struct GNUNET_TESTING_NetjailNode * | 2261 | struct GNUNET_TESTING_NetjailNode * |
2260 | GNUNET_TESTING_get_node (unsigned int num, | 2262 | GNUNET_TESTING_get_node (unsigned int num, |
2261 | struct GNUNET_TESTING_NetjailTopology *topology) | 2263 | struct GNUNET_TESTING_NetjailTopology *topology) |
2262 | { | 2264 | { |
2263 | struct GNUNET_TESTING_NetjailNode *node; | 2265 | struct GNUNET_TESTING_NetjailNode *node; |
2264 | struct GNUNET_TESTING_NetjailNamespace *namespace; | 2266 | struct GNUNET_TESTING_NetjailNamespace *namespace; |
@@ -2280,7 +2282,8 @@ GNUNET_TESTING_get_node (unsigned int num, | |||
2280 | */ | 2282 | */ |
2281 | struct GNUNET_TESTING_NodeConnection * | 2283 | struct GNUNET_TESTING_NodeConnection * |
2282 | GNUNET_TESTING_get_connections (unsigned int num, | 2284 | GNUNET_TESTING_get_connections (unsigned int num, |
2283 | const struct GNUNET_TESTING_NetjailTopology *topology) | 2285 | const struct |
2286 | GNUNET_TESTING_NetjailTopology *topology) | ||
2284 | { | 2287 | { |
2285 | struct GNUNET_TESTING_NetjailNode *node; | 2288 | struct GNUNET_TESTING_NetjailNode *node; |
2286 | struct GNUNET_TESTING_NetjailNamespace *namespace; | 2289 | struct GNUNET_TESTING_NetjailNamespace *namespace; |
@@ -2304,7 +2307,7 @@ GNUNET_TESTING_get_connections (unsigned int num, | |||
2304 | */ | 2307 | */ |
2305 | struct GNUNET_PeerIdentity * | 2308 | struct GNUNET_PeerIdentity * |
2306 | GNUNET_TESTING_get_peer (unsigned int num, | 2309 | GNUNET_TESTING_get_peer (unsigned int num, |
2307 | const struct GNUNET_TESTING_System *tl_system) | 2310 | const struct GNUNET_TESTING_System *tl_system) |
2308 | { | 2311 | { |
2309 | struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity); | 2312 | struct GNUNET_PeerIdentity *peer = GNUNET_new (struct GNUNET_PeerIdentity); |
2310 | struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key; | 2313 | struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key; |
@@ -2466,6 +2469,7 @@ GNUNET_TESTING_get_address (struct GNUNET_TESTING_NodeConnection *connection, | |||
2466 | return addr; | 2469 | return addr; |
2467 | } | 2470 | } |
2468 | 2471 | ||
2472 | |||
2469 | /** | 2473 | /** |
2470 | * Get the number of unintentional additional connections the node waits for. | 2474 | * Get the number of unintentional additional connections the node waits for. |
2471 | * | 2475 | * |
@@ -2502,6 +2506,7 @@ GNUNET_TESTING_get_additional_connects (unsigned int num, | |||
2502 | return node->additional_connects; | 2506 | return node->additional_connects; |
2503 | } | 2507 | } |
2504 | 2508 | ||
2509 | |||
2505 | static void | 2510 | static void |
2506 | parse_ac (struct GNUNET_TESTING_NetjailNode *p_node, const char *token) | 2511 | parse_ac (struct GNUNET_TESTING_NetjailNode *p_node, const char *token) |
2507 | { | 2512 | { |