summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlurchi <lurchi@strangeplace.net>2018-01-07 00:59:50 +0100
committerlurchi <lurchi@strangeplace.net>2018-01-07 01:00:16 +0100
commitea351cef94af33ccf28c66434c28aefc100ad6e0 (patch)
tree353402ffae266e4c31cc1462710dab0c56b24e92 /src
parent1522c35f31166008edec5a3ac341d80626792e42 (diff)
parent9a558c93bd51152121c4c15dad0a5a66e8e87c96 (diff)
downloadgnunet-ea351cef94af33ccf28c66434c28aefc100ad6e0.tar.gz
gnunet-ea351cef94af33ccf28c66434c28aefc100ad6e0.zip
Merge branch 'master' of https://gnunet.org/git/gnunet
Diffstat (limited to 'src')
-rw-r--r--src/fs/fs_search.c19
-rw-r--r--src/fs/fs_uri.c25
-rw-r--r--src/gns/gnunet-dns2gns.c45
-rw-r--r--src/include/gnunet_fs_service.h3
-rw-r--r--src/peerinfo/gnunet-service-peerinfo.c6
-rw-r--r--src/set/gnunet-service-set_union.c9
-rw-r--r--src/transport/plugin_transport_tcp.c7
-rw-r--r--src/util/common_allocation.c1
-rw-r--r--src/util/configuration.c1
9 files changed, 80 insertions, 36 deletions
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c
index 8c6f5edcf..83aae2fc5 100644
--- a/src/fs/fs_search.c
+++ b/src/fs/fs_search.c
@@ -568,7 +568,13 @@ process_ksk_result (struct GNUNET_FS_SearchContext *sc,
568 568
569 /* check if new */ 569 /* check if new */
570 GNUNET_assert (NULL != sc); 570 GNUNET_assert (NULL != sc);
571 GNUNET_FS_uri_to_key (uri, &key); 571 if (GNUNET_OK !=
572 GNUNET_FS_uri_to_key (uri,
573 &key))
574 {
575 GNUNET_break_op (0);
576 return;
577 }
572 if (GNUNET_SYSERR == 578 if (GNUNET_SYSERR ==
573 GNUNET_CONTAINER_multihashmap_get_multiple (ent->results, 579 GNUNET_CONTAINER_multihashmap_get_multiple (ent->results,
574 &key, 580 &key,
@@ -680,8 +686,15 @@ process_sks_result (struct GNUNET_FS_SearchContext *sc,
680 686
681 /* check if new */ 687 /* check if new */
682 GNUNET_assert (NULL != sc); 688 GNUNET_assert (NULL != sc);
683 GNUNET_FS_uri_to_key (uri, &key); 689 if (GNUNET_OK !=
684 GNUNET_CRYPTO_hash_xor (&uri->data.chk.chk.key, &uri->data.chk.chk.query, 690 GNUNET_FS_uri_to_key (uri,
691 &key))
692 {
693 GNUNET_break (0);
694 return;
695 }
696 GNUNET_CRYPTO_hash_xor (&uri->data.chk.chk.key,
697 &uri->data.chk.chk.query,
685 &key); 698 &key);
686 if (GNUNET_SYSERR == 699 if (GNUNET_SYSERR ==
687 GNUNET_CONTAINER_multihashmap_get_multiple (sc->master_result_map, &key, 700 GNUNET_CONTAINER_multihashmap_get_multiple (sc->master_result_map, &key,
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c
index 11968b750..b90c75981 100644
--- a/src/fs/fs_uri.c
+++ b/src/fs/fs_uri.c
@@ -96,8 +96,9 @@
96 * 96 *
97 * @param uri uri to convert to a unique key 97 * @param uri uri to convert to a unique key
98 * @param key where to store the unique key 98 * @param key where to store the unique key
99 * @return #GNUNET_OK on success
99 */ 100 */
100void 101int
101GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, 102GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri,
102 struct GNUNET_HashCode *key) 103 struct GNUNET_HashCode *key)
103{ 104{
@@ -105,25 +106,35 @@ GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri,
105 { 106 {
106 case GNUNET_FS_URI_CHK: 107 case GNUNET_FS_URI_CHK:
107 *key = uri->data.chk.chk.query; 108 *key = uri->data.chk.chk.query;
108 return; 109 return GNUNET_OK;
109 case GNUNET_FS_URI_SKS: 110 case GNUNET_FS_URI_SKS:
110 GNUNET_CRYPTO_hash (uri->data.sks.identifier, 111 GNUNET_CRYPTO_hash (uri->data.sks.identifier,
111 strlen (uri->data.sks.identifier), key); 112 strlen (uri->data.sks.identifier),
112 break; 113 key);
114 return GNUNET_OK;
113 case GNUNET_FS_URI_KSK: 115 case GNUNET_FS_URI_KSK:
114 if (uri->data.ksk.keywordCount > 0) 116 if (uri->data.ksk.keywordCount > 0)
117 {
115 GNUNET_CRYPTO_hash (uri->data.ksk.keywords[0], 118 GNUNET_CRYPTO_hash (uri->data.ksk.keywords[0],
116 strlen (uri->data.ksk.keywords[0]), key); 119 strlen (uri->data.ksk.keywords[0]),
120 key);
121 return GNUNET_OK;
122 }
123 else
124 {
125 memset (key, 0, sizeof (struct GNUNET_HashCode));
126 return GNUNET_SYSERR;
127 }
117 break; 128 break;
118 case GNUNET_FS_URI_LOC: 129 case GNUNET_FS_URI_LOC:
119 GNUNET_CRYPTO_hash (&uri->data.loc.fi, 130 GNUNET_CRYPTO_hash (&uri->data.loc.fi,
120 sizeof (struct FileIdentifier) + 131 sizeof (struct FileIdentifier) +
121 sizeof (struct GNUNET_PeerIdentity), 132 sizeof (struct GNUNET_PeerIdentity),
122 key); 133 key);
123 break; 134 return GNUNET_OK;
124 default: 135 default:
125 memset (key, 0, sizeof (struct GNUNET_HashCode)); 136 memset (key, 0, sizeof (struct GNUNET_HashCode));
126 break; 137 return GNUNET_SYSERR;
127 } 138 }
128} 139}
129 140
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c
index 424677d14..2f0de030d 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -533,14 +533,21 @@ read_dns4 (void *cls)
533 } 533 }
534 { 534 {
535 char buf[size + 1]; 535 char buf[size + 1];
536 ssize_t sret;
536 537
537 addrlen = sizeof (v4); 538 addrlen = sizeof (v4);
538 GNUNET_break (size == 539 sret = GNUNET_NETWORK_socket_recvfrom (listen_socket4,
539 GNUNET_NETWORK_socket_recvfrom (listen_socket4, 540 buf,
540 buf, 541 size + 1,
541 size + 1, 542 (struct sockaddr *) &v4,
542 (struct sockaddr *) &v4, 543 &addrlen);
543 &addrlen)); 544 if (0 > sret)
545 {
546 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
547 "recvfrom");
548 return;
549 }
550 GNUNET_break (size == (size_t) sret);
544 handle_request (listen_socket4, 551 handle_request (listen_socket4,
545 &v4, 552 &v4,
546 addrlen, 553 addrlen,
@@ -579,16 +586,26 @@ read_dns6 (void *cls)
579 } 586 }
580 { 587 {
581 char buf[size]; 588 char buf[size];
589 ssize_t sret;
582 590
583 addrlen = sizeof (v6); 591 addrlen = sizeof (v6);
584 GNUNET_break (size == 592 sret = GNUNET_NETWORK_socket_recvfrom (listen_socket6,
585 GNUNET_NETWORK_socket_recvfrom (listen_socket6, 593 buf,
586 buf, 594 size,
587 size, 595 (struct sockaddr *) &v6,
588 (struct sockaddr *) &v6, 596 &addrlen);
589 &addrlen)); 597 if (0 > sret)
590 handle_request (listen_socket6, &v6, addrlen, 598 {
591 buf, size); 599 GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
600 "recvfrom");
601 return;
602 }
603 GNUNET_break (size == (size_t) sret);
604 handle_request (listen_socket6,
605 &v6,
606 addrlen,
607 buf,
608 size);
592 } 609 }
593} 610}
594 611
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h
index ac418072e..cbad374b5 100644
--- a/src/include/gnunet_fs_service.h
+++ b/src/include/gnunet_fs_service.h
@@ -109,8 +109,9 @@ typedef int
109 * 109 *
110 * @param uri uri to convert to a unique key 110 * @param uri uri to convert to a unique key
111 * @param key wherer to store the unique key 111 * @param key wherer to store the unique key
112 * @return #GNUNET_OK on success
112 */ 113 */
113void 114int
114GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, 115GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri,
115 struct GNUNET_HashCode *key); 116 struct GNUNET_HashCode *key);
116 117
diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c
index bdb6e5e0d..6b39149be 100644
--- a/src/peerinfo/gnunet-service-peerinfo.c
+++ b/src/peerinfo/gnunet-service-peerinfo.c
@@ -1146,12 +1146,12 @@ handle_hello (void *cls,
1146 struct GNUNET_SERVICE_Client *client = cls; 1146 struct GNUNET_SERVICE_Client *client = cls;
1147 struct GNUNET_PeerIdentity pid; 1147 struct GNUNET_PeerIdentity pid;
1148 1148
1149 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1150 "HELLO message received for peer `%s'\n",
1151 GNUNET_i2s (&pid));
1152 GNUNET_assert (GNUNET_OK == 1149 GNUNET_assert (GNUNET_OK ==
1153 GNUNET_HELLO_get_id (hello, 1150 GNUNET_HELLO_get_id (hello,
1154 &pid)); 1151 &pid));
1152 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1153 "HELLO message received for peer `%s'\n",
1154 GNUNET_i2s (&pid));
1155 add_host_to_known_hosts (&pid); 1155 add_host_to_known_hosts (&pid);
1156 update_hello (&pid, 1156 update_hello (&pid,
1157 hello); 1157 hello);
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index 9586dcf27..219cc6235 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -389,10 +389,11 @@ get_ibf_key (const struct GNUNET_HashCode *src)
389 struct IBF_Key key; 389 struct IBF_Key key;
390 uint16_t salt = 0; 390 uint16_t salt = 0;
391 391
392 GNUNET_CRYPTO_kdf (&key, sizeof (key), 392 GNUNET_assert (GNUNET_OK ==
393 src, sizeof *src, 393 GNUNET_CRYPTO_kdf (&key, sizeof (key),
394 &salt, sizeof (salt), 394 src, sizeof *src,
395 NULL, 0); 395 &salt, sizeof (salt),
396 NULL, 0));
396 return key; 397 return key;
397} 398}
398 399
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index c5d6e6d34..8b00543c3 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -3351,9 +3351,10 @@ handle_tcp_data (void *cls,
3351 void *vaddr = NULL; 3351 void *vaddr = NULL;
3352 size_t alen; 3352 size_t alen;
3353 3353
3354 GNUNET_SERVER_client_get_address (client, 3354 GNUNET_assert (GNUNET_OK ==
3355 &vaddr, 3355 GNUNET_SERVER_client_get_address (client,
3356 &alen); 3356 &vaddr,
3357 &alen));
3357 LOG (GNUNET_ERROR_TYPE_ERROR, 3358 LOG (GNUNET_ERROR_TYPE_ERROR,
3358 "Received unexpected %u bytes of type %u from `%s'\n", 3359 "Received unexpected %u bytes of type %u from `%s'\n",
3359 (unsigned int) ntohs (message->size), 3360 (unsigned int) ntohs (message->size),
diff --git a/src/util/common_allocation.c b/src/util/common_allocation.c
index be2538c3f..80047bb52 100644
--- a/src/util/common_allocation.c
+++ b/src/util/common_allocation.c
@@ -484,6 +484,7 @@ GNUNET_asprintf (char **buf,
484 va_start (args, format); 484 va_start (args, format);
485 ret = VSNPRINTF (NULL, 0, format, args); 485 ret = VSNPRINTF (NULL, 0, format, args);
486 va_end (args); 486 va_end (args);
487 GNUNET_assert (ret >= 0);
487 *buf = GNUNET_malloc (ret + 1); 488 *buf = GNUNET_malloc (ret + 1);
488 va_start (args, format); 489 va_start (args, format);
489 ret = VSPRINTF (*buf, format, args); 490 ret = VSPRINTF (*buf, format, args);
diff --git a/src/util/configuration.c b/src/util/configuration.c
index 7f1d98902..25eeaf80f 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -421,7 +421,6 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
421 size_t m_size; 421 size_t m_size;
422 size_t c_size; 422 size_t c_size;
423 423
424
425 /* Pass1 : calculate the buffer size required */ 424 /* Pass1 : calculate the buffer size required */
426 m_size = 0; 425 m_size = 0;
427 for (sec = cfg->sections; NULL != sec; sec = sec->next) 426 for (sec = cfg->sections; NULL != sec; sec = sec->next)