Merge branch 'master' of https://gnunet.org/git/gnunet
authorlurchi <lurchi@strangeplace.net>
Sat, 6 Jan 2018 23:59:50 +0000 (00:59 +0100)
committerlurchi <lurchi@strangeplace.net>
Sun, 7 Jan 2018 00:00:16 +0000 (01:00 +0100)
13 files changed:
AUTHORS
doc/documentation/chapters/developer.texi
doc/documentation/chapters/philosophy.texi
doc/documentation/chapters/user.texi
src/fs/fs_search.c
src/fs/fs_uri.c
src/gns/gnunet-dns2gns.c
src/include/gnunet_fs_service.h
src/peerinfo/gnunet-service-peerinfo.c
src/set/gnunet-service-set_union.c
src/transport/plugin_transport_tcp.c
src/util/common_allocation.c
src/util/configuration.c

diff --git a/AUTHORS b/AUTHORS
index e49319ac04367a2d5bef328257092ee7a9f5f355..136848e3fde6d63ed1aee587c0240058885ecb94 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -33,6 +33,7 @@ Contributions also came from:
 Adam Warrington [ UPnP ]
 Adriano Peluso [ Documentation export to Texinfo ]
 Alex Harper [ OS X CPU load ]
+Amirouche Boubekki <amirouche@hypermove.net>
 Andrew McDonald <andrew@mcdonald.org.uk> [ SHA-512]
 Andy Green <andy@warmcat.com>
 Antti Salonen
index ada6d37a09a65aa599bd21b92190aa25cf34d85a..a99f6a4813dd75a7214ef6c0c34e4ff5accde73c 100644 (file)
@@ -94,6 +94,7 @@ following links:
 @c ** FIXME: Link to files in source, not online.
 @c ** FIXME: Where is the Java tutorial?
 @itemize @bullet
+@c broken link
 @item @uref{https://gnunet.org/git/gnunet.git/plain/doc/gnunet-c-tutorial.pdf, GNUnet C tutorial}
 @item GNUnet Java tutorial
 @end itemize
@@ -273,7 +274,7 @@ library is a wapper around block plugins which provide the necessary
 functions for each block type.
 @item @file{statistics/} --- statistics service
 The statistics service enables associating
-values (of type uint64_t) with a componenet name and a string. The main
+values (of type uint64_t) with a component name and a string. The main
 uses is debugging (counting events), performance tracking and user
 entertainment (what did my peer do today?).
 @item @file{arm/} --- Automatic Restart Manager (ARM)
@@ -2450,7 +2451,7 @@ memcpy (tbuf, nameTrans, strlen (nameTrans) + 1);
 
 Note that, here the functions @code{htonl}, @code{htons} and
 @code{GNUNET_TIME_absolute_hton} are applied to convert little endian
-into big endian, about the usage of the big/small edian order and the
+into big endian, about the usage of the big/small endian order and the
 corresponding conversion function please refer to Introduction of
 Big Endian and Little Endian.
 
@@ -7027,6 +7028,7 @@ bandwidth consumption.
 
 @c %**end of header
 
+@c inconsistent use of ``must'' above it's written ``MUST''
 In contrast to GET operations, developers @strong{must} manually re-run
 PUT operations periodically (if they intend the content to continue to be
 available). Content stored in the DHT expires or might be lost due to
@@ -7055,7 +7057,7 @@ Using the monitoring API, applications can choose to monitor these
 requests, possibly limiting themselves to requests for a particular block
 type.
 
-The monitoring API is not only usefu only for diagnostics, it can also be
+The monitoring API is not only useful for diagnostics, it can also be
 used to trigger application operations based on PUT operations.
 For example, an application may use PUTs to distribute work requests to
 other peers.
@@ -7149,7 +7151,7 @@ already knows more than about a thousand blocks may need to send
 several of these messages. Naturally, the client should transmit these
 messages as quickly as possible after the original GET request such that
 the DHT can filter those results in the network early on. Naturally, as
-these messages are send after the original request, it is conceivalbe
+these messages are sent after the original request, it is conceivalbe
 that the DHT service may return blocks that match those already known
 to the client anyway.
 
@@ -7240,7 +7242,7 @@ A peer can search the DHT by sending @code{struct PeerGetMessage}s of type
 @code{GNUNET_MESSAGE_TYPE_DHT_P2P_GET} to other peers. In addition to the
 usual information about the request (type, routing options, desired
 replication level for the request, the key and the extended query), a GET
-request also again contains a hop counter, a Bloom filter over the peers
+request also contains a hop counter, a Bloom filter over the peers
 that have processed the request already and depending on the routing
 options the full path traversed by the GET.
 Finally, a GET request includes a variable-size second Bloom filter and a
index c8e2651c33006d940f278ee7273662830dcff35b..681d5acc362d0c377e7105d91da82e8b6d70905a 100644 (file)
@@ -47,7 +47,9 @@ Refer to @uref{https://www.gnu.org/philosophy/free-sw.html, https://www.gnu.org/
 @item GNUnet must only disclose the minimal amount of information
 necessary.
 @c TODO: Explain 'fully' in the terminology section.
-@item GNUnet must be fully distributed and survive Byzantine failures
+@item GNUnet must be fully distributed and survive
+@uref{https://en.wikipedia.org/wiki/Byzantine_fault_tolerance, Byzantine failures}
+@footnote{@uref{https://en.wikipedia.org/wiki/Byzantine_fault_tolerance, https://en.wikipedia.org/wiki/Byzantine_fault_tolerance}}
 at any position in the network.
 @item GNUnet must make it explicit to the user which entities are
 considered to be trustworthy when establishing secured communications.
@@ -163,7 +165,7 @@ DH (Diffie---Hellman) key exchange using ephemeral eliptic curve
 cryptography. The ephemeral ECC (Eliptic Curve Cryptography) keys are
 signed using ECDSA (@uref{http://en.wikipedia.org/wiki/ECDSA, ECDSA}).
 The shared secret from ECDHE is used to create a pair of session keys
-@c FIXME: LOng word for HKDF
+@c FIXME: LOng word for HKDF. More FIXMEs: Explain MITM etc.
 (using HKDF) which are then used to encrypt the communication between the
 two peers using both 256-bit AES (Advanced Encryption Standard)
 and 256-bit Twofish (with independently derived secret keys).
@@ -173,8 +175,6 @@ without requiring signatures each time. GNUnet uses SHA-512
 (Secure Hash Algorithm) hash codes to verify the integrity of messages.
 
 In GNUnet, the identity of a host is its public key. For that reason,
-@c FIXME: is it clear to the average reader what a man-in-the-middle
-@c attack is?
 man-in-the-middle attacks will not break the authentication or accounting
 goals. Essentially, for GNUnet, the IP of the host has nothing to do with
 the identity of the host. As the public key is the only thing that truly
@@ -420,8 +420,9 @@ public key first.
 @node Egos
 @subsection Egos
 
+@c what is the difference between peer identity and egos? It seems
+@c like both are linked to public-private key pair.
 Egos are your "identities" in GNUnet. Any user can assume multiple
 identities, for example to separate their activities online. Egos can
 correspond to pseudonyms or real-world identities. Technically, an
 ego is first of all a public-private key pair.
-
index 4159a6b32b01886ec6a71f6e95a23568ba237bb1..1a30a7336dfb22ccc1bb0446a131aaa74625245d 100644 (file)
@@ -1183,6 +1183,8 @@ shared under the keyword "Das Kapital".
 
 Search results are printed by gnunet-search like this:
 
+@c it will be better the avoid the ellipsis altogether because I don't
+@c understand the explanation below that
 @example
 $ gnunet-download -o "COPYING" --- gnunet://fs/chk/N8...C92.17992
 => The GNU Public License <= (mimetype: text/plain)
@@ -1192,6 +1194,7 @@ $ gnunet-download -o "COPYING" --- gnunet://fs/chk/N8...C92.17992
 The first line is the command you would have to enter to download
 the file. The argument passed to @code{-o} is the suggested
 filename (you may change it to whatever you like).
+@c except it's triple dash in the above example ---
 The @code{--} is followed by key for decrypting the file,
 the query for searching the file, a checksum (in hexadecimal)
 finally the size of the file in bytes.
@@ -1235,6 +1238,7 @@ GNUnet's file-encoding mechanism will ensure file integrity, even if the
 existing file was not downloaded from GNUnet in the first place.
 
 You may want to use the @command{-V} switch (must be added before
+@c Same as above it's triple dash
 the @command{--}) to turn on verbose reporting. In this case,
 @command{gnunet-download} will print the current number of
 bytes downloaded whenever new data was received.
@@ -1301,7 +1305,7 @@ unavailable.
 @c %**end of header
 
 Each namespace is associated with meta-data that describes
-the namespace. This meta data is provided by the user at
+the namespace. This meta-data is provided by the user at
 the time that the namespace is advertised. Advertisements
 are published under keywords so that they can be found using
 normal keyword-searches. This way, users can learn about new
index 8c6f5edcf2730a8b5c76145a6c42dd1ce666becc..83aae2fc5c928c55548e168f4fa8a22500e2b05a 100644 (file)
@@ -568,7 +568,13 @@ process_ksk_result (struct GNUNET_FS_SearchContext *sc,
 
   /* check if new */
   GNUNET_assert (NULL != sc);
-  GNUNET_FS_uri_to_key (uri, &key);
+  if (GNUNET_OK !=
+      GNUNET_FS_uri_to_key (uri,
+                           &key))
+  {
+    GNUNET_break_op (0);
+    return;
+  }
   if (GNUNET_SYSERR ==
       GNUNET_CONTAINER_multihashmap_get_multiple (ent->results,
                                                   &key,
@@ -680,8 +686,15 @@ process_sks_result (struct GNUNET_FS_SearchContext *sc,
 
   /* check if new */
   GNUNET_assert (NULL != sc);
-  GNUNET_FS_uri_to_key (uri, &key);
-  GNUNET_CRYPTO_hash_xor (&uri->data.chk.chk.key, &uri->data.chk.chk.query,
+  if (GNUNET_OK !=
+      GNUNET_FS_uri_to_key (uri,
+                           &key))
+  {
+    GNUNET_break (0);
+    return;
+  }
+  GNUNET_CRYPTO_hash_xor (&uri->data.chk.chk.key,
+                         &uri->data.chk.chk.query,
                           &key);
   if (GNUNET_SYSERR ==
       GNUNET_CONTAINER_multihashmap_get_multiple (sc->master_result_map, &key,
index 11968b750ee9e8d8b30e0c93b0f400bb395e3afa..b90c75981ae54391b8fc780ba775383f90366c07 100644 (file)
@@ -96,8 +96,9 @@
  *
  * @param uri uri to convert to a unique key
  * @param key where to store the unique key
+ * @return #GNUNET_OK on success
  */
-void
+int
 GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri,
                      struct GNUNET_HashCode *key)
 {
@@ -105,25 +106,35 @@ GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri,
   {
   case GNUNET_FS_URI_CHK:
     *key = uri->data.chk.chk.query;
-    return;
+    return GNUNET_OK;
   case GNUNET_FS_URI_SKS:
     GNUNET_CRYPTO_hash (uri->data.sks.identifier,
-                        strlen (uri->data.sks.identifier), key);
-    break;
+                        strlen (uri->data.sks.identifier),
+                       key);
+    return GNUNET_OK;
   case GNUNET_FS_URI_KSK:
     if (uri->data.ksk.keywordCount > 0)
+    {
       GNUNET_CRYPTO_hash (uri->data.ksk.keywords[0],
-                          strlen (uri->data.ksk.keywords[0]), key);
+                          strlen (uri->data.ksk.keywords[0]),
+                         key);
+      return GNUNET_OK;
+    }
+    else
+    {
+      memset (key, 0, sizeof (struct GNUNET_HashCode));
+      return GNUNET_SYSERR;
+    }
     break;
   case GNUNET_FS_URI_LOC:
     GNUNET_CRYPTO_hash (&uri->data.loc.fi,
                         sizeof (struct FileIdentifier) +
                         sizeof (struct GNUNET_PeerIdentity),
                         key);
-    break;
+    return GNUNET_OK;
   default:
     memset (key, 0, sizeof (struct GNUNET_HashCode));
-    break;
+    return GNUNET_SYSERR;
   }
 }
 
index 424677d14de1cc0b113b8c988a3e1ddb1f2d9015..2f0de030d55d5317009e41d735b73df9ecaa6daa 100644 (file)
@@ -533,14 +533,21 @@ read_dns4 (void *cls)
     }
   {
     char buf[size + 1];
+    ssize_t sret;
 
     addrlen = sizeof (v4);
-    GNUNET_break (size ==
-                 GNUNET_NETWORK_socket_recvfrom (listen_socket4,
-                                                 buf,
-                                                 size + 1,
-                                                 (struct sockaddr *) &v4,
-                                                 &addrlen));
+    sret = GNUNET_NETWORK_socket_recvfrom (listen_socket4,
+                                          buf,
+                                          size + 1,
+                                          (struct sockaddr *) &v4,
+                                          &addrlen);
+    if (0 > sret)
+    {
+      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+                          "recvfrom");
+      return;
+    }
+    GNUNET_break (size == (size_t) sret);
     handle_request (listen_socket4,
                    &v4,
                    addrlen,
@@ -579,16 +586,26 @@ read_dns6 (void *cls)
     }
   {
     char buf[size];
+    ssize_t sret;
 
     addrlen = sizeof (v6);
-    GNUNET_break (size ==
-                 GNUNET_NETWORK_socket_recvfrom (listen_socket6,
-                                                 buf,
-                                                 size,
-                                                 (struct sockaddr *) &v6,
-                                                 &addrlen));
-    handle_request (listen_socket6, &v6, addrlen,
-                   buf, size);
+    sret = GNUNET_NETWORK_socket_recvfrom (listen_socket6,
+                                          buf,
+                                          size,
+                                          (struct sockaddr *) &v6,
+                                          &addrlen);
+    if (0 > sret)
+    {
+      GNUNET_log_strerror (GNUNET_ERROR_TYPE_WARNING,
+                          "recvfrom");
+      return;
+    }
+    GNUNET_break (size == (size_t) sret);
+    handle_request (listen_socket6,
+                   &v6,
+                   addrlen,
+                   buf,
+                   size);
   }
 }
 
index ac418072ec20436ab8b869f21692b6a9a4634abc..cbad374b5d9757879d6c397dea25894bff886a18 100644 (file)
@@ -109,8 +109,9 @@ typedef int
  *
  * @param uri uri to convert to a unique key
  * @param key wherer to store the unique key
+ * @return #GNUNET_OK on success
  */
-void
+int
 GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri,
                      struct GNUNET_HashCode *key);
 
index bdb6e5e0dee8220f76e7409f356b7d83e247a82f..6b39149bebd3c45803aed1ba6392faffb008b4b1 100644 (file)
@@ -1146,12 +1146,12 @@ handle_hello (void *cls,
   struct GNUNET_SERVICE_Client *client = cls;
   struct GNUNET_PeerIdentity pid;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "HELLO message received for peer `%s'\n",
-              GNUNET_i2s (&pid));
   GNUNET_assert (GNUNET_OK ==
                  GNUNET_HELLO_get_id (hello,
                                       &pid));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "HELLO message received for peer `%s'\n",
+              GNUNET_i2s (&pid));
   add_host_to_known_hosts (&pid);
   update_hello (&pid,
                 hello);
index 9586dcf27fd1f8fba5c12ebe75aec6cd395ee33a..219cc6235c66a777d565cbc1b0bb53eba26bf182 100644 (file)
@@ -389,10 +389,11 @@ get_ibf_key (const struct GNUNET_HashCode *src)
   struct IBF_Key key;
   uint16_t salt = 0;
 
-  GNUNET_CRYPTO_kdf (&key, sizeof (key),
-                     src, sizeof *src,
-                     &salt, sizeof (salt),
-                     NULL, 0);
+  GNUNET_assert (GNUNET_OK ==
+                GNUNET_CRYPTO_kdf (&key, sizeof (key),
+                                   src, sizeof *src,
+                                   &salt, sizeof (salt),
+                                   NULL, 0));
   return key;
 }
 
index c5d6e6d345389f384b890e882535cc5ab79a48b0..8b00543c3df57e9d055679b7d0db3be2f3320d51 100644 (file)
@@ -3351,9 +3351,10 @@ handle_tcp_data (void *cls,
     void *vaddr = NULL;
     size_t alen;
 
-    GNUNET_SERVER_client_get_address (client,
-                                      &vaddr,
-                                      &alen);
+    GNUNET_assert (GNUNET_OK ==
+                  GNUNET_SERVER_client_get_address (client,
+                                                    &vaddr,
+                                                    &alen));
     LOG (GNUNET_ERROR_TYPE_ERROR,
          "Received unexpected %u bytes of type %u from `%s'\n",
          (unsigned int) ntohs (message->size),
index be2538c3f4c941661bb5e1c012df2baccf27210c..80047bb5269d01b0bb4a787962e3a483b2d8e311 100644 (file)
@@ -484,6 +484,7 @@ GNUNET_asprintf (char **buf,
   va_start (args, format);
   ret = VSNPRINTF (NULL, 0, format, args);
   va_end (args);
+  GNUNET_assert (ret >= 0);
   *buf = GNUNET_malloc (ret + 1);
   va_start (args, format);
   ret = VSPRINTF (*buf, format, args);
index 7f1d98902a33a9d9e76623c826f69b0f9b298189..25eeaf80fcb4dc0ce0298cc6372810475dcde37e 100644 (file)
@@ -421,7 +421,6 @@ GNUNET_CONFIGURATION_serialize (const struct GNUNET_CONFIGURATION_Handle *cfg,
   size_t m_size;
   size_t c_size;
 
-
   /* Pass1 : calculate the buffer size required */
   m_size = 0;
   for (sec = cfg->sections; NULL != sec; sec = sec->next)