summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElias Summermatter <elias.summermatter@seccom.ch>2021-03-31 11:17:24 +0200
committerElias Summermatter <elias.summermatter@seccom.ch>2021-03-31 11:17:24 +0200
commit26d2c0d58612fb233cc25b2739bcf96693f5cd85 (patch)
tree16baec844f4a5d9b5383d91589fe4c8f74eec725
parentb5660e0a33f4c7a819de0b5056172f78f912e352 (diff)
parentca4c9eae269c34765df26699fe756860c7827693 (diff)
Merge branch 'master' of ssh://gnunet.org/gnunet
-rwxr-xr-x.buildbot/install.sh2
-rw-r--r--ChangeLog156
-rw-r--r--configure.ac12
-rw-r--r--doc/handbook/chapters/developer.texi215
-rw-r--r--doc/handbook/chapters/keyconcepts.texi25
-rw-r--r--doc/handbook/chapters/user.texi161
-rw-r--r--doc/handbook/images/messenger_room.pngbin0 -> 76244 bytes
-rw-r--r--doc/handbook/images/messenger_room.svg501
-rw-r--r--po/POTFILES.in25
-rw-r--r--src/Makefile.am6
-rw-r--r--src/arm/arm_api.c8
-rw-r--r--src/cadet/gnunet-service-cadet.c3
-rw-r--r--src/cadet/gnunet-service-cadet_channel.c1
-rw-r--r--src/gns/Makefile.am3
-rw-r--r--src/gns/gnunet-bcd.c22
-rw-r--r--src/gns/gnunet-dns2gns.c8
-rw-r--r--src/gns/gnunet-gns-proxy.c23
-rw-r--r--src/gns/gnunet-service-gns_interceptor.c1
-rw-r--r--src/gns/gnunet-service-gns_resolver.c27
-rw-r--r--src/gns/plugin_rest_gns.c4
-rw-r--r--src/gnsrecord/gnsrecord_misc.c17
-rw-r--r--src/gnsrecord/gnunet-gnsrecord-tvg.c2
-rw-r--r--src/include/gnunet_testbed_ng_service.h247
-rw-r--r--src/include/gnunet_testbed_service.h2
-rw-r--r--src/messenger/Makefile.am39
-rwxr-xr-x[-rw-r--r--]src/messenger/gnunet-messenger.c14
-rwxr-xr-x[-rw-r--r--]src/messenger/gnunet-service-messenger.c4
-rwxr-xr-x[-rw-r--r--]src/messenger/gnunet-service-messenger_member.c10
-rwxr-xr-x[-rw-r--r--]src/messenger/gnunet-service-messenger_message_store.c10
-rwxr-xr-x[-rw-r--r--]src/messenger/gnunet-service-messenger_operation_store.c4
-rwxr-xr-x[-rw-r--r--]src/messenger/messenger_api_contact_store.c9
-rwxr-xr-x[-rw-r--r--]src/messenger/messenger_api_message.c2
-rwxr-xr-x[-rw-r--r--]src/messenger/messenger_api_room.c16
-rwxr-xr-x[-rw-r--r--]src/messenger/messenger_api_room.h6
-rw-r--r--src/namestore/gnunet-service-namestore.c16
-rw-r--r--src/namestore/namestore_api.c6
-rw-r--r--src/namestore/plugin_rest_namestore.c2
-rw-r--r--src/peerinfo-tool/plugin_rest_peerinfo.c4
-rw-r--r--src/peerstore/peerstore_api.c5
-rw-r--r--src/peerstore/test_peerstore_api_sync.c87
-rw-r--r--src/reclaim/gnunet-service-reclaim.c5
-rw-r--r--src/reclaim/gnunet-service-reclaim_tickets.c15
-rw-r--r--src/reclaim/oidc_helper.c14
-rw-r--r--src/reclaim/plugin_rest_openid_connect.c50
-rw-r--r--src/reclaim/plugin_rest_reclaim.c131
-rw-r--r--src/reclaim/reclaim_api.c20
-rw-r--r--src/rest/plugin_rest_copying.c6
-rw-r--r--src/revocation/gnunet-revocation.c14
-rw-r--r--src/revocation/gnunet-service-revocation.c12
-rw-r--r--src/revocation/plugin_block_revocation.c9
-rw-r--r--src/revocation/revocation_api.c9
-rw-r--r--src/rps/gnunet-rps-profiler.c7
-rw-r--r--src/rps/gnunet-service-rps.c18
-rw-r--r--src/rps/gnunet-service-rps_custommap.c9
-rw-r--r--src/rps/rps-test_util.c16
-rw-r--r--src/testbed/Makefile.am3
-rw-r--r--src/testbed/testbed_api_cmd_controller.c294
-rw-r--r--src/testbed/testbed_api_cmd_peer.c249
-rw-r--r--src/testbed/testbed_api_cmd_service.c140
-rw-r--r--src/testing/testing_api_cmd_hello_world_birth.c6
-rw-r--r--src/transport/gnunet-communicator-tcp.c48
-rw-r--r--src/transport/gnunet-communicator-udp.c13
-rw-r--r--src/transport/gnunet-service-tng.c7
-rw-r--r--src/transport/transport-testing-communicator.c5
-rw-r--r--src/util/Makefile.am18
-rw-r--r--src/util/configuration.c1
-rw-r--r--src/util/container_meta_data.c7
-rw-r--r--src/util/crypto_rsa.c1
-rw-r--r--src/util/gnunet-crypto-tvg.c124
-rw-r--r--src/util/os_installation.c5
70 files changed, 2621 insertions, 340 deletions
diff --git a/.buildbot/install.sh b/.buildbot/install.sh
index b22f3aae0..8ddd77ec0 100755
--- a/.buildbot/install.sh
+++ b/.buildbot/install.sh
@@ -1,3 +1,5 @@
#!/bin/bash
+cd doc/tutorial; make tutorial.html &> /dev/null; cd -
+cd doc/doxygen; make full &> /dev/null; cd -
make install
diff --git a/ChangeLog b/ChangeLog
index 2faef1c9e..9c05a51a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,159 @@
+Thu, 18 Mar 2021 18:44:46 +0100 (7d85c27e9)
+Fixed setu tests and state maschine - Elias Summermatter
+
+Thu, 18 Mar 2021 17:55:24 +0100 (8cd1e1929)
+Fixed some bug in the statemaschin implementation of setu - Elias Summermatter
+
+Thu, 18 Mar 2021 16:07:40 +0100 (c4ccd7550)
+Setu tests use gnunet internal functions to generate randum elements - Elias Summermatter
+
+Thu, 18 Mar 2021 11:48:42 +0100 (f9ae0c23c)
+Added working test with randum set - Elias Summermatter
+
+Thu, 18 Mar 2021 08:45:31 +0100 (0d6237ae0)
+Added some randum elemet generation test for setu - Elias Summermatter
+
+Sun, 14 Mar 2021 14:04:00 +0100 (b47586e76)
+add packaging notice; fix #5633 - Martin Schanzenbach
+
+Tue, 9 Mar 2021 18:26:28 +0100 (0b2c0f22f)
+IDENTITY: Fix wrong key construction for anonymous ECDSA identity - Martin Schanzenbach
+
+Tue, 2 Mar 2021 17:16:18 +0100 (45ceb4fdf)
+add base32 encoder/decoder - Christian Grothoff
+
+Sun, 28 Feb 2021 13:51:25 +0100 (4cffc642c)
+build: do not redefine AM_MAKEINFOHTMLFLAGS - Martin Schanzenbach
+
+Sun, 28 Feb 2021 11:15:55 +0100 (eb8ca760c)
+GANA: Use GANA generated header for GNS record types. Update handbook - Martin Schanzenbach
+
+Tue, 23 Feb 2021 14:29:47 +0100 (d528f6cfb)
+HELLO: Fix netdb.h nonsense with h_addr - Martin Schanzenbach
+
+Tue, 23 Feb 2021 10:42:57 +0100 (74a234f0b)
+HANDBOOK: Add some info on TNG - Martin Schanzenbach
+
+Sun, 21 Feb 2021 20:56:47 +0100 (05040a491)
+HELLO: Add test for NG API; fix extraction more - Martin Schanzenbach
+
+Sun, 21 Feb 2021 16:44:51 +0100 (783a12b3c)
+HELLO-TNG: Fix parsing; sill broken - Martin Schanzenbach
+
+Sun, 21 Feb 2021 11:46:16 +0100 (f5439c229)
+TNG: Add queue update handling - Martin Schanzenbach
+
+Sun, 21 Feb 2021 10:53:34 +0100 (a3971a93c)
+Add struct names for FS events. #6743 - Martin Schanzenbach
+
+Thu, 18 Feb 2021 16:51:47 +0100 (8095b1a1b)
+SetU move check to union - Elias Summermatter
+
+Wed, 17 Feb 2021 18:00:43 +0100 (08adc88b4)
+Setu integrated new phase full receiving as described in rfc draft - Elias Summermatter
+
+Wed, 17 Feb 2021 17:32:23 +0100 (d5bf65f2b)
+Renamed Phase Expect IBF Cont -> Expect IBF Last - Elias Summermatter
+
+Wed, 17 Feb 2021 17:26:35 +0100 (d852cb5a6)
+Renamed Phase Done -> Finished - Elias Summermatter
+
+Wed, 17 Feb 2021 17:04:15 +0100 (be8897e14)
+Renamed Phase inventory passive -> passive decoding - Elias Summermatter
+
+Wed, 17 Feb 2021 15:57:46 +0100 (333459251)
+Renamed Phase inventory active -> active decoding & Added idea folder to git ignore - Elias Summermatter
+
+Sat, 30 Jan 2021 16:36:14 -0500 (5b152adc0)
+use AS_VERSION_COMPARE instead of AX_COMPARE_VERSION - Thien-Thi Nguyen
+
+Sat, 30 Jan 2021 08:37:12 -0500 (de1b87ea3)
+fix #6722: use AX_COMPARE_VERSION - Thien-Thi Nguyen
+
+Sat, 30 Jan 2021 12:41:15 +0100 (a5f200d53)
+fix #6690 - Christian Grothoff
+
+Thu, 28 Jan 2021 22:28:01 +0100 (a2169368b)
+implement #6716 - Christian Grothoff
+
+Thu, 7 Jan 2021 22:22:48 +0100 (4769344a7)
+convert to GMT, not localtime in GNUNET_TIME_year_to_time - Christian Grothoff
+
+Thu, 7 Jan 2021 10:26:54 +0100 (5b10ad755)
+properly document return value of GNUNET_PROGRAM_run - Christian Grothoff
+
+Sat, 2 Jan 2021 13:47:16 +0100 (eab08cec9)
+do not output synthetic paths - Christian Grothoff
+
+Sat, 2 Jan 2021 11:24:26 +0100 (0d4337da2)
+fix /proc/PID/maps parser format string - Christian Grothoff
+
+Thu, 31 Dec 2020 09:12:43 +0100 (ebd853c83)
+do not use atomic write for configuration file, we may not have permissions to do this, also should not be necessary - Christian Grothoff
+
+Wed, 30 Dec 2020 20:58:55 +0900 (c0465ff92)
+RECLAIM: Fix quirky OIDC address handling - Martin Schanzenbach
+
+Sat, 26 Dec 2020 14:15:58 +0900 (75a3a90fb)
+RECLAIM: automatically purge dangling references - Martin Schanzenbach
+
+Sat, 19 Dec 2020 18:43:38 +0100 (3636ea628)
+change GNUNET_DISK_fn_write() to always do atomic writes and to NOT overwrite existing files; also change the return value to not return the size of the written file but GNUNET_OK on success, and integrate creating the directory if needed; breaks API, hence bumping libgnunetutil version - Christian Grothoff
+
+Tue, 15 Dec 2020 04:54:32 -0500 (407765df1)
+include Configuration Handbook in gnunet.info - Thien-Thi Nguyen
+
+Tue, 15 Dec 2020 03:43:27 -0500 (db9d81947)
+add pxref to ‘Config file format’ - Thien-Thi Nguyen
+
+Tue, 15 Dec 2020 03:26:26 -0500 (52986bf33)
+[doc] Add section "Config file format" - Thien-Thi Nguyen
+
+Wed, 9 Dec 2020 23:00:07 +0100 (7d9592f20)
+add GNUNET_CRYPTO_hash_context_copy() function - Christian Grothoff
+
+Tue, 8 Dec 2020 16:50:27 +0900 (7ce054864)
+RECLAIM: Return userinfo claims from cache - Martin Schanzenbach
+
+Fri, 4 Dec 2020 17:36:35 +0100 (1346641a1)
+gnunet-crypto-tvg: fix bogus label - Florian Dold
+
+Fri, 4 Dec 2020 17:22:38 +0100 (4c10ff3b4)
+gnunet-crypto-tvg: add verification mode - Florian Dold
+
+Fri, 4 Dec 2020 14:52:45 +0100 (1a3070b15)
+gnunet-crypto-tvg: output JSON, fix memleaks - Florian Dold
+
+Sat, 21 Nov 2020 22:58:44 +0000 (d2e10ef67)
+rps: fix another 'format not a string literal' warning - Daniel Golle
+
+Mon, 16 Nov 2020 23:57:08 +0100 (91e8c2ff2)
+rps: deal with currently unused code - Julius Bünger
+
+Mon, 16 Nov 2020 23:36:12 +0100 (d30ec0f1f)
+rps: comment ill-defined code - Julius Bünger
+
+Mon, 16 Nov 2020 22:59:12 +0100 (0950b1df7)
+rps: properly initialise memory - Julius Bünger
+
+Mon, 16 Nov 2020 22:56:47 +0100 (266823196)
+rps: use proper signedness - Julius Bünger
+
+Mon, 16 Nov 2020 22:56:27 +0100 (89ea76819)
+rps: use correct buffer sizes - Julius Bünger
+
+Mon, 16 Nov 2020 22:55:49 +0100 (607211bb7)
+rps: use correct types in format strings - Julius Bünger
+
+Mon, 16 Nov 2020 22:53:30 +0100 (0108f132a)
+rps: get rid of warnings about harmless uninitialized variables - Julius Bünger
+
+Mon, 16 Nov 2020 04:54:21 +0100 (41000a00c)
+rps: fix sources for multiple warnings - Julius Bünger
+
+Sat, 14 Nov 2020 19:02:01 +0000 (ea18ebde8)
+rps: fix format not a string literal and no format arguments - Daniel Golle
+
Sat, 14 Nov 2020 10:57:31 +0900 (de83cfe23)
Updating ChangeLog for 0.14.0 - Martin Schanzenbach
diff --git a/configure.ac b/configure.ac
index 28c616069..f72039d09 100644
--- a/configure.ac
+++ b/configure.ac
@@ -416,8 +416,16 @@ gcrypt=0
NEED_LIBGCRYPT_API=1
NEED_LIBGCRYPT_VERSION=1.6.0
-
-AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION", gcrypt=1)
+# Check if we have libgcrypt >= 1.9. Some things do not work with it
+gcrypt19=0
+AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:1.9.0",
+ [AC_MSG_WARN(["Some subsystems do not work with gcrypt >=1.9.0"])
+ gcrypt=1
+ gcrypt19=1],
+ [AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION", gcrypt=1)]
+)
+AM_CONDITIONAL(HAVE_NOLIBGCRYPT19,
+ [test "$gcrypt19" = 0])
AC_CHECK_DECLS([gcry_mpi_set_opaque_copy], [], [], [[#include <gcrypt.h>]])
AS_IF([test $gcrypt = 0],
diff --git a/doc/handbook/chapters/developer.texi b/doc/handbook/chapters/developer.texi
index 8bc8c8005..8b0085cce 100644
--- a/doc/handbook/chapters/developer.texi
+++ b/doc/handbook/chapters/developer.texi
@@ -83,6 +83,7 @@ new chapters, sections or insightful comments.
* REST Subsystem::
* RPS Subsystem::
* TRANSPORT-NG Subsystem::
+* MESSENGER Subsystem::
@end menu
@node Developer Introduction
@@ -9705,3 +9706,217 @@ other peers. The semantics of the backchannel message are up to the
communicators which use them.
TRANSPORT may fail transmitting backchannel messages, and TRANSPORT will not
attempt to retransmit them.
+
+@cindex MESSENGER Subsystem
+@cindex MESSENGER
+@cindex messenger
+@node MESSENGER Subsystem
+@section MESSENGER Subsystem
+
+The MESSENGER subsystem is responsible for secure end-to-end communication in
+groups of nodes in the GNUnet overlay network. MESSENGER builds on the CADET
+subsystem which provides a reliable and secure end-to-end communication between
+the nodes inside of these groups.
+
+Additionally to the CADET security benefits, MESSENGER provides following
+properties designed for application level usage:
+
+@itemize @bullet
+@item MESSENGER provides integrity by signing the messages with the users
+ provided ego
+@item MESSENGER adds (optional) forward secrecy by replacing the key pair of the
+ used ego and signing the propagation of the new one with old one (chaining
+ egos)
+@item MESSENGER provides verification of a original sender by checking against
+ all used egos from a member which are currently in active use (active use
+ depends on the state of a member session)
+@item MESSENGER offsers (optional) decentralized message forwarding between all
+ nodes in a group to improve availability and prevent MITM-attacks
+@item MESSENGER handles new connections and disconnections from nodes in the
+ group by reconnecting them preserving an efficient structure for message
+ distribution (ensuring availability and accountablity)
+@item MESSENGER provides replay protection (messages can be uniquely identified
+ via SHA-512, include a timestamp and the hash of the last message)
+@item MESSENGER allows detection for dropped messages by chaining them (messages
+ refer to the last message by their hash) improving accountability
+@item MESSENGER allows requesting messages from other peers explicitly to ensure
+ availibility
+@item MESSENGER provides confidentiality by padding messages to few different
+ sizes (512 bytes, 4096 bytes, 32768 bytes and maximal message size from
+ CADET)
+@item MESSENGER adds (optional) confidentiality with ECDHE to exchange and use
+ symmetric encryption, encrypting with both AES-256 and Twofish but
+ allowing only selected members to decrypt (using the receivers ego for
+ ECDHE)
+@end itemize
+
+Also MESSENGER provides multiple features with privacy in mind:
+
+@itemize @bullet
+@item MESSENGER allows deleting messages from all peers in the group by the
+ original sender (uses the MESSENGER provided verification)
+@item MESSENGER allows using the publically known anonymous ego instead of any
+ unique identifying ego
+@item MESSENGER allows your node to decide between acting as host of the used
+ messaging room (sharing your peer's identity with all nodes in the group)
+ or acting as guest (sharing your peer's identity only with the nodes you
+ explicitly open a connection to)
+@item MESSENGER handles members independantly of the peer's identity making
+ forwarded messages indistinguishable from directly received ones (
+ complicating the tracking of messages and identifying its origin)
+@item MESSENGER allows names of members being not unique (also names are
+ optional)
+@item MESSENGER does not include information about the selected receiver of an
+ explicitly encrypted message in its header, complicating it for other
+ members to draw conclusions from communication partners
+@end itemize
+
+@menu
+* libgnunetmessenger::
+* Member sessions::
+@end menu
+
+@node libgnunetmessenger
+@subsection libgnunetmessenger
+
+The MESSENGER API (defined in @file{gnunet_messenger_service.h}) allows P2P
+applications built using GNUnet to communicate with specified kinds of messages
+in a group. It provides applications the ability to send and receive encrypted
+messages to any group of peers participating in GNUnet in a decentralized way (
+without even knowing all peers's identities).
+
+MESSENGER delivers messages to other peers in "rooms". A room uses a variable
+amount of CADET "channels" which will all be used for message distribution. Each
+channel can represent an outgoing connection opened by entering a room with
+@code{GNUNET_MESSENGER_enter_room} or an incoming connection if the room was
+opened before via @code{GNUNET_MESSENGER_open_room}.
+
+@image{images/messenger_room,6in,,Room structure}
+
+To enter a room you have to specify the "door" (peer's identity of a peer which
+has opened the room) and the key of the room (which is identical to a CADET
+"port"). To open a room you have to specify only the key to use. When opening a
+room you automatically distribute a PEER-message sharing your peer's identity in
+the room.
+
+Entering or opening a room can also be combined in any order. In any case you
+will automatically get a unique member ID and send a JOIN-message notifying
+others about your entry and your public key from your selected ego.
+
+The ego can be selected by name with the initial @code{GNUNET_MESSENGER_connect}
+besides setting a (identity-)callback for each change/confirmation of the used
+ego and a (message-)callback which gets called every time a message gets sent or
+received in the room. Once the identity-callback got called you can check your
+used ego with @code{GNUNET_MESSENGER_get_key} providing only its public key. The
+function returns NULL if the anonymous ego is used. If the ego should be
+replaced with a newly generated one, you can use @code{GNUNET_MESSENGER_update}
+to ensure proper chaining of used egos.
+
+Also once the identity-callback got called you can check your used name with
+@code{GNUNET_MESSENGER_get_name} and potentially change or set a name via
+@code{GNUNET_MESSENGER_set_name}. A name is for example required to create a new
+ego with @code{GNUNET_MESSENGER_update}. Also any change in ego or name will
+automatically be distributed in the room with a NAME- or KEY-message
+respectively.
+
+To send a message a message inside of a room you can use
+@code{GNUNET_MESSENGER_send_message}. If you specify a selected contact as
+receiver, the message gets encrypted automatically and will be sent as PRIVATE-
+message instead.
+
+To request a potentially missed message or to get a specific message after its
+original call of the message-callback, you can use
+@code{GNUNET_MESSENGER_get_message}. Additionally once a message was distributed
+to application level and the message-callback got called, you can get the
+contact respresenting a message's sender respectively with
+@code{GNUNET_MESSENGER_get_sender}. This allows getting name and the public key
+of any sender currently in use with @code{GNUNET_MESSENGER_contact_get_name}
+and @code{GNUNET_MESSENGER_contact_get_key}. It is also possible to iterate
+through all current members of a room with
+@code{GNUNET_MESSENGER_iterate_members} using a callback.
+
+To leave a room you can use @code{GNUNET_MESSENGER_close_room} which will also
+close the rooms connections once all applications on the same peer have left
+the room. Leaving a room will also send a LEAVE-message closing a member session
+on all connected peers before any connection will be closed. Leaving a room is
+however not required for any application to keep your member session open
+between multiple sessions of the actual application.
+
+Finally, when an application no longer wants to use CADET, it should call
+@code{GNUNET_MESSENGER_disconnect}. You don't have to explicitly close the used
+rooms or leave them.
+
+Here is a little summary to the kinds of messages you can send manually:
+
+@menu
+* MERGE-message::
+* INVITE-message::
+* TEXT-message::
+* FILE-message::
+* DELETE-message::
+@end menu
+
+@node MERGE-message
+@subsubsection MERGE-message
+
+MERGE-messages will generally be sent automatically to reduce the amount of
+parallel chained messages. This is necessary to close a member session for
+example. You can also send MERGE-messages manually if required to merge two
+chains of messages.
+
+@node INVITE-message
+@subsubsection INVITE-message
+
+INVITE-messages can be used to invite other members in a room to a different
+room, sharing one potential door and the required key to enter the room. This
+kind of message is typically sent as encrypted PRIVATE-message to selected
+members because it doesn't make much sense to invite all members from one room
+to another considering a rooms key doesn't specify its usage.
+
+@node TEXT-message
+@subsubsection TEXT-message
+
+TEXT-messages can be used to send simple text-based messages and should be
+considered as being in readable form without complex decoding. The text has to
+end with a NULL-terminator character and should be in UTF-8 encoding for most
+compatibility.
+
+@node FILE-message
+@subsubsection FILE-message
+
+FILE-messages can be used to share files inside of a room. They do not contain
+the actual file being shared but its original hash, filename, URI to download
+the file and a symmetric key to decrypt the downloaded file.
+
+It is recommended to use the FS subsystem and the FILE-messages in combination.
+
+@node DELETE-message
+@subsubsection DELETE-message
+
+DELETE-messages can be used to delete messages selected with its hash. You can
+also select any custom delay relative to the time of sending the DELETE-message.
+Deletion will only be processed on each peer in a room if the sender is
+authorized.
+
+The only information of a deleted message which being kept will be the chained
+hashes connecting the message graph for potential traversion. For example the
+check for completion of a member session requires this information.
+
+@node Member sessions
+@subsection Member sessions
+
+A member session is a triple of the room key, the member ID and the public key
+of the member's ego. Member sessions allow that a member can change their ID or
+their ego once at a time without loosing the ability to delete old messages or
+identifying the original sender of a message. On every change of ID or EGO a
+session will be marked as closed. So every session chain will only contain one
+open session with the current ID and public key.
+
+If a session is marked as closed the MESSENGER service will check from the first
+message opening a session to its last one closing the session for completion. If
+a the service can confirm that there is no message still missing which was sent
+from the closed member session, it will be marked as completed.
+
+A completed member session is not able to verify any incoming message to ensure
+forward secrecy preventing others from using old stolen egos.
+
diff --git a/doc/handbook/chapters/keyconcepts.texi b/doc/handbook/chapters/keyconcepts.texi
index eb95dbf78..f429997bf 100644
--- a/doc/handbook/chapters/keyconcepts.texi
+++ b/doc/handbook/chapters/keyconcepts.texi
@@ -152,6 +152,7 @@ and @pxref{Deniability}.
@menu
* How file-sharing achieves Anonymity::
+* How messaging provides Anonymity::
@end menu
Providing anonymity for users is the central goal for the anonymous
@@ -231,6 +232,30 @@ GAP --- practical anonymous networking. In Proceedings of
Designing Privacy Enhancing Technologies, 2003.
(@uref{https://git.gnunet.org/bibliography.git/plain/docs/aff.pdf, https://git.gnunet.org/bibliography.git/plain/docs/aff.pdf})
+@cindex How messaging provides Anonymity
+@node How messaging provides Anonymity
+@subsection How messaging provides Anonymity
+
+While the file-sharing tries to achieve anonymity through hiding actions in
+other traffic, the messaging service provides a weaker form of protection
+against identification.
+
+The messaging service allows the use of an anonymous ego for the signing and
+verification process of messages instead of a unique ego. This anonymous ego is
+a publically known key pair which is shared between all peers in GNUnet.
+
+Using this ego only ensures that individual messages alone can't identify its
+sender inside of a messenger room. It should be clarified that the route of
+the traffic for each message can still be tracked to identify the senders peer
+inside of a messenger room if the threat agent controls certain peers hosting
+the room.
+
+Also opening a room in the messenger service will potentially match your peer
+identity with the internal member identity from the messenger service. So
+despite using the anonymous ego you can reveal your peer identity. This means
+to decrease the chance of being identified, it is recommended to enter rooms but
+you should not open them for others.
+
@cindex Deniability
@node Deniability
@section Deniability
diff --git a/doc/handbook/chapters/user.texi b/doc/handbook/chapters/user.texi
index 5d5d2fe14..b5889891b 100644
--- a/doc/handbook/chapters/user.texi
+++ b/doc/handbook/chapters/user.texi
@@ -28,6 +28,7 @@ always welcome.
* The GNU Name System::
* reclaimID Identity Provider::
* Using the Virtual Public Network::
+* Using the GNUnet Messenger::
@end menu
@node Start and stop GNUnet
@@ -253,7 +254,6 @@ and development.
@subsection Creating a Business Card
@c FIXME: Which parts of texlive are needed? Some systems offer a modular
@c texlive (smaller size).
-
Before we can really use GNS, you should create a business card.
Note that this requires having @command{LaTeX} installed on your system.
If you are using a Debian GNU/Linux based operating system, the
@@ -261,6 +261,19 @@ following command should install the required components.
Keep in mind that this @b{requires 3GB} of downloaded data and possibly
@b{even more} when unpacked. On a GNU Guix based system texlive 2017 has
returns a DAG size of 5032.4 MiB.
+The packages which are confirmed to be required are:
+
+@itemize @bullet
+@item texlive-units
+@item texlive-labels
+@item texlive-pst-barcode
+@item texlive-luatex85
+@item texlive-preview
+@item texlive-pdfcrop
+@item texlive-koma-script
+@end itemize
+
+
@b{We welcome any help in identifying the required components of the
TexLive Distribution. This way we could just state the required components
without pulling in the full distribution of TexLive.}
@@ -2323,3 +2336,149 @@ service offered by that peer, you can create an IP tunnel to
that peer by specifying the peer's identity, service name and
protocol (--tcp or --udp) and you will again receive an IP address
that will terminate at the respective peer's service.
+
+@node Using the GNUnet Messenger
+@section Using the GNUnet Messenger
+
+The GNUnet Messenger subsystem allows decentralized message-based
+communication inside of so called rooms. Each room can be hosted by
+a variable amount of peers. Every member of a room has the possibility
+to host the room on its own peer. A peer allows any amount of members
+to join a room. The amount of members in a room is not restricted.
+
+Messages in a room will be distributed between all peers hosting the
+room or being internally (in context of the messenger service) connected
+to a hosting peer. All received or sent messages will be stored on any
+peer locally which is hosting the respective room or is internally
+connected to such a hosting peer.
+
+The Messenger service is built on the CADET subsystem to make internal
+connections between peers using a reliable and encrypted transmission.
+Additionally the service uses a discrete padding to few different sizes.
+So kinds of messages and potential content can't be identified by the
+size of traffic from any attacker being unable to break the encryption
+of the transmission layer.
+
+Another feature is additional end-to-end encryption for selected messages
+which uses the public key of another member (the receiver) to encrypt
+the message. Therefore it is ensured that only the selected member can
+read its content. This will also use additional padding.
+
+@menu
+* Current state::
+* Entering a room::
+* Opening a room::
+* Messaging in a room::
+* Private messaging::
+@end menu
+
+@node Current state
+@subsection Current state
+
+Currently there is only a simplistic CLI application available to use the
+messenger service. You can use this application with the
+@command{gnunet-messenger} command.
+
+This application was designed for testing purposes and it does not provide
+full functionality in the current state. It is planned to replace this CLI
+application in later stages with a fully featured one using a client-side
+library designed for messenger applications.
+
+@node Entering a room
+@subsection Entering a room
+
+You can enter any room by its ROOMKEY and any PEERIDENTITY of a hosting peer.
+Optionally you can provide any IDENTITY which can represent a local ego by
+its name.
+
+@example
+$ gnunet-messenger [-e IDENTITY] -d PEERIDENTITY -r ROOMKEY
+@end example
+
+A PEERIDENTITY gets entered in encoded form. You can get your own peer ID by
+using the @command{gnunet-peerinfo} command:
+
+@example
+$ gnunet-peerinfo -s
+@end example
+
+A ROOMKEY gets entered in readable text form. The service will then hash the
+entered ROOMKEY and use the result as shared secret for transmission through
+the CADET submodule. You can also optionally leave out the '-r' paramter and
+the ROOMKEY to use the zeroed hash instead.
+
+If no IDENTITY is provided you will not send any name to others, you will be
+referred as "anonymous" instead and use the anonymous ego. If you provide any
+IDENTITY a matching ego will be used to sign your messages. If there is no
+matching ego you will use the anonymous ego instead. The provided IDENTITY will
+be distributed as your name for the service in any case.
+
+@node Opening a room
+@subsection Opening a room
+
+You can open any room in a similar way to entering it. You just have to leave
+out the '-d' parameter and the PEERIDENTITY of the hosting peer.
+
+@example
+$ gnunet-messenger [-e IDENTITY] -r ROOMKEY
+@end example
+
+Providing ROOMKEY and IDENTITY is identical to entering a room. Opening a room
+will also make your peer to a host of this room. So others can enter the room
+through your peer if they have the required ROOMKEY and your peer ID.
+
+If you want to use the zeroed hash as shared secret key for the room you can
+also leave it out as well:
+
+@example
+$ gnunet-messenger
+@end example
+
+@node Messaging in a room
+@subsection Messaging in a room
+
+Once joined a room by entering it or opening it you can write text-based
+messages which will be distributed between all internally conntected peers. All
+sent messages will be displayed in the same way as received messages.
+
+This relates to the internal handling of sent and received messages being mostly
+identical on application layer. Every handled message will be represented
+visually depending on its kind, content and sender. A sender can usually be
+identified by the encoded member ID or their name.
+
+@example
+[17X37K] * 'anonymous' says: "hey"
+@end example
+
+@node Private messaging
+@subsection Private messaging
+
+As referred in the introduction the service allows sending private messages with
+additional end-to-end encryption. These messages will be visually represented
+by messages of the kind 'PRIVATE' in case they can't be decrypted with your used
+ego. Members who can't decrypt the message can potentially only identify its
+sender but they can't identify its receiver.
+
+@example
+[17X37K] ~ message: PRIVATE
+@end example
+
+If they can be decrypted they will appear as their secret message instead
+but marked visually.
+
+@example
+[17X37K] ** 'anonymous' says: "hey"
+@end example
+
+Currently you can only activate sending such encrypted text messages instead of
+usual text messages by adding the '-p' parameter:
+
+@example
+$ gnunet-messenger [-e IDENTITY] -d PEERIDENTITY -r ROOMKEY -p
+@end example
+
+Notice that you can only send such encrypted messages to members who use an ego
+which is not publically known as the anonymous ego to ensure transparency. If
+any user could decrypt these messages they would not be private. So as receiver
+of such messages the IDENTITY is required and it has to match a local ego.
+
diff --git a/doc/handbook/images/messenger_room.png b/doc/handbook/images/messenger_room.png
new file mode 100644
index 000000000..8b3590cf8
--- /dev/null
+++ b/doc/handbook/images/messenger_room.png
Binary files differ
diff --git a/doc/handbook/images/messenger_room.svg b/doc/handbook/images/messenger_room.svg
new file mode 100644
index 000000000..6bd8d425c
--- /dev/null
+++ b/doc/handbook/images/messenger_room.svg
@@ -0,0 +1,501 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="598.63586mm"
+ height="519.30621mm"
+ viewBox="0 0 598.63586 519.30621"
+ version="1.1"
+ id="svg8"
+ inkscape:version="1.0.2 (e86c870879, 2021-01-15)"
+ sodipodi:docname="messenger_room.svg"
+ inkscape:export-filename="./messenger_room.png"
+ inkscape:export-xdpi="50"
+ inkscape:export-ydpi="50">
+ <defs
+ id="defs2" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.35"
+ inkscape:cx="1617.1523"
+ inkscape:cy="893.76504"
+ inkscape:document-units="mm"
+ inkscape:current-layer="layer3"
+ inkscape:document-rotation="0"
+ showgrid="false"
+ fit-margin-top="10"
+ fit-margin-bottom="10"
+ fit-margin-right="10"
+ fit-margin-left="10"
+ lock-margins="true"
+ inkscape:window-width="2560"
+ inkscape:window-height="1376"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata5">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:groupmode="layer"
+ id="layer2"
+ inkscape:label="Layer 2"
+ style="display:inline"
+ transform="translate(192.28493,120.40152)">
+ <path
+ style="fill:none;stroke:#000000;stroke-width:3.365;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 26.206579,156.45999 97.162749,89.570022 199.7759,120.1979 181.87666,217.7128 89.324169,236.23068 Z"
+ id="path915" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:2.665;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 181.87666,217.7128 66.26913,94.14707"
+ id="path1063" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:2.665;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:2.665, 5.33;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 309.85632,121.37022 199.7759,120.1979"
+ id="path1065" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:2.665;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 248.9298,18.638951 199.7759,120.1979"
+ id="path1067" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:2.665;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M -76.608095,107.38658 26.206579,156.45999"
+ id="path1069" />
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer4"
+ inkscape:label="Layer 4"
+ style="display:inline"
+ transform="translate(192.28493,120.40152)">
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m -137.76937,77.365523 61.161275,30.021057"
+ id="path1225" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M -20.546549,199.60834 26.206579,156.45999"
+ id="path1227" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 58.558255,290.12036 89.324168,236.23068 125.2681,294.74464"
+ id="path1229" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 260.56143,374.91842 -12.41564,-63.05855 67.7611,18.91507"
+ id="path1231" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 237.39119,194.89545 181.87666,217.7128"
+ id="path1233" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 199.7759,120.1979 177.22801,54.184954"
+ id="path1235" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 309.85632,121.37022 61.96594,-12.96636"
+ id="path1237" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="M 248.9298,18.638951 229.25585,-38.546188"
+ id="path1239" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 55.073787,29.185372 42.088961,60.38465"
+ id="path1241" />
+ <path
+ style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.865, 3.73;stroke-dashoffset:0;stroke-opacity:1"
+ d="M -76.608095,107.38658 -138.56518,130.6705"
+ id="path1243" />
+ </g>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(192.28493,120.40152)">
+ <circle
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="path833"
+ cx="96.685127"
+ cy="88.539452"
+ r="20" />
+ <circle
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="path833-3"
+ cx="195.51556"
+ cy="120.85936"
+ r="20" />
+ <circle
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="path833-5"
+ cx="183.12799"
+ cy="214.72444"
+ r="20" />
+ <circle
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="path833-6"
+ cx="92.202576"
+ cy="236.97336"
+ r="20" />
+ <circle
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="path833-2"
+ cx="26.400755"
+ cy="158.9449"
+ r="20" />
+ <circle
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="path833-3-1"
+ cx="309.42667"
+ cy="120.44005"
+ r="20" />
+ <circle
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="path833-3-2"
+ cx="248.5799"
+ cy="19.344702"
+ r="20" />
+ <circle
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="path833-3-7"
+ cx="-74.235405"
+ cy="107.76899"
+ r="20" />
+ <circle
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="path833-3-0"
+ cx="249.89246"
+ cy="310.73776"
+ r="20" />
+ <path
+ style="display:inline;fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+ d="m 318.33679,228.47452 61.96594,-12.96636"
+ id="path1237-2" />
+ <circle
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6.265, 12.53;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill"
+ id="path833-3-1-8"
+ cx="317.90714"
+ cy="227.54434"
+ r="20" />
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:2.82, 5.64;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071-62-9"
+ width="28.700562"
+ height="22.81683"
+ x="366.24039"
+ y="204.47328" />
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="315.72601"
+ y="231.38942"
+ id="text1307-7-3-3-94-3"><tspan
+ sodipodi:role="line"
+ id="tspan1305-6-0-0-6-6"
+ x="315.72601"
+ y="231.38942"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">J</tspan></text>
+ </g>
+ <g
+ inkscape:groupmode="layer"
+ id="layer3"
+ inkscape:label="Layer 3"
+ transform="translate(192.28493,120.40152)">
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071"
+ width="28.700562"
+ height="22.81683"
+ x="41.152424"
+ y="17.00181" />
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071-6"
+ width="28.700562"
+ height="22.81683"
+ x="163.24538"
+ y="40.93095" />
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071-0"
+ width="28.700562"
+ height="22.81683"
+ x="217.0302"
+ y="-48.476658" />
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071-62"
+ width="28.700562"
+ height="22.81683"
+ x="357.75992"
+ y="97.368996" />
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071-61"
+ width="28.700562"
+ height="22.81683"
+ x="221.61465"
+ y="183.89601" />
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071-8"
+ width="28.700562"
+ height="22.81683"
+ x="302.37604"
+ y="319.27646" />
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071-7"
+ width="28.700562"
+ height="22.81683"
+ x="244.56342"
+ y="364.67789" />
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071-9"
+ width="28.700562"
+ height="22.81683"
+ x="43.508121"
+ y="279.02939" />
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071-2"
+ width="28.700562"
+ height="22.81683"
+ x="110.22536"
+ y="283.7334" />
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071-02"
+ width="28.700562"
+ height="22.81683"
+ x="-35.267426"
+ y="187.65363" />
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071-3"
+ width="28.700562"
+ height="22.81683"
+ x="-151.39322"
+ y="66.069321" />
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:2.82, 5.64;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071-3-7"
+ width="28.700562"
+ height="22.81683"
+ x="-154.87178"
+ y="119.88663" />
+ <g
+ id="g1600"
+ transform="translate(-2.9470331,-51.038598)">
+ <circle
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:3.78727;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="path833-6-5"
+ cx="-161.17276"
+ cy="336.83234"
+ r="12.09027" />
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="-140.58682"
+ y="342.66354"
+ id="text1307"><tspan
+ sodipodi:role="line"
+ id="tspan1305"
+ x="-140.58682"
+ y="342.66354"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">Peer</tspan></text>
+ </g>
+ <g
+ id="g1594"
+ transform="translate(-2.9470331,-54.443235)">
+ <rect
+ style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.96946;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill"
+ id="rect1071-9-9"
+ width="20.044254"
+ height="15.935102"
+ x="-171.19489"
+ y="365.45282" />
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="-140.78059"
+ y="379.28705"
+ id="text1307-7"><tspan
+ sodipodi:role="line"
+ id="tspan1305-6"
+ x="-140.78059"
+ y="379.28705"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">Application</tspan></text>
+ </g>
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="90.401619"
+ y="94.499252"
+ id="text1307-7-3"><tspan
+ sodipodi:role="line"
+ id="tspan1305-6-0"
+ x="90.401619"
+ y="94.499252"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">A</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="189.63115"
+ y="126.74821"
+ id="text1307-7-3-3"><tspan
+ sodipodi:role="line"
+ id="tspan1305-6-0-0"
+ x="189.63115"
+ y="126.74821"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">C</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="178.83551"
+ y="220.59999"
+ id="text1307-7-3-3-9"><tspan
+ sodipodi:role="line"
+ id="tspan1305-6-0-0-2"
+ x="178.83551"
+ y="220.59999"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">F</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="85.772736"
+ y="242.86221"
+ id="text1307-7-3-3-5"><tspan
+ sodipodi:role="line"
+ id="tspan1305-6-0-0-4"
+ x="85.772736"
+ y="242.86221"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">G</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="19.824577"
+ y="164.8027"
+ id="text1307-7-3-3-0"><tspan
+ sodipodi:role="line"
+ id="tspan1305-6-0-0-5"
+ x="19.824577"
+ y="164.8027"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">H</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="303.32053"
+ y="126.29786"
+ id="text1307-7-3-3-94"><tspan
+ sodipodi:role="line"
+ id="tspan1305-6-0-0-6"
+ x="303.32053"
+ y="126.29786"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">D</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="243.4848"
+ y="25.202511"
+ id="text1307-7-3-3-92"><tspan
+ sodipodi:role="line"
+ id="tspan1305-6-0-0-24"
+ x="243.4848"
+ y="25.202511"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">B</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="247.20479"
+ y="316.59558"
+ id="text1307-7-3-3-7"><tspan
+ sodipodi:role="line"
+ id="tspan1305-6-0-0-7"
+ x="247.20479"
+ y="316.59558"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">I</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="-79.01123"
+ y="113.64454"
+ id="text1307-7-3-3-54"><tspan
+ sodipodi:role="line"
+ id="tspan1305-6-0-0-8"
+ x="-79.01123"
+ y="113.64454"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">E</tspan></text>
+ <g
+ id="g1589"
+ transform="translate(-4.3496791,-53.330521)">
+ <path
+ style="fill:none;stroke:#000000;stroke-width:2.62782;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:2.62782, 5.25564;stroke-dashoffset:1.05113;stroke-opacity:1"
+ d="m -176.62134,400.99519 30.89715,0.38084"
+ id="path1521" />
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="-137.64647"
+ y="406.95029"
+ id="text1307-7-2"><tspan
+ sodipodi:role="line"
+ id="tspan1305-6-1"
+ x="-137.64647"
+ y="406.95029"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">Inactive</tspan></text>
+ </g>
+ <g
+ id="g1583"
+ transform="translate(-4.3496791,-49.693534)">
+ <path
+ style="fill:none;stroke:#000000;stroke-width:2.62782;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.05113;stroke-opacity:1"
+ d="m -176.62134,420.37019 30.89715,0.38084"
+ id="path1521-0" />
+ <text
+ xml:space="preserve"
+ style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559"
+ x="-138.78186"
+ y="426.42728"
+ id="text1307-7-0"><tspan
+ sodipodi:role="line"
+ id="tspan1305-6-5"
+ x="-138.78186"
+ y="426.42728"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">Active</tspan></text>
+ </g>
+ <text
+ xml:space="preserve"
+ style="font-size:50.8px;line-height:95.25px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.264583"
+ x="42.997746"
+ y="-77.287262"
+ id="text1604"><tspan
+ sodipodi:role="line"
+ id="tspan1602"
+ x="42.997746"
+ y="-77.287262"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.8px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.264583">Room</tspan></text>
+ </g>
+</svg>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index b2fa88d73..b3849abbd 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -207,25 +207,33 @@ src/json/json_mhd.c
src/messenger/gnunet-messenger.c
src/messenger/gnunet-service-messenger.c
src/messenger/gnunet-service-messenger_basement.c
-src/messenger/gnunet-service-messenger_contact.c
+src/messenger/gnunet-service-messenger_ego_store.c
src/messenger/gnunet-service-messenger_handle.c
src/messenger/gnunet-service-messenger_list_handles.c
src/messenger/gnunet-service-messenger_list_messages.c
+src/messenger/gnunet-service-messenger_member.c
+src/messenger/gnunet-service-messenger_member_session.c
+src/messenger/gnunet-service-messenger_member_store.c
src/messenger/gnunet-service-messenger_message_handle.c
src/messenger/gnunet-service-messenger_message_kind.c
src/messenger/gnunet-service-messenger_message_recv.c
src/messenger/gnunet-service-messenger_message_send.c
src/messenger/gnunet-service-messenger_message_store.c
+src/messenger/gnunet-service-messenger_operation.c
+src/messenger/gnunet-service-messenger_operation_store.c
src/messenger/gnunet-service-messenger_room.c
src/messenger/gnunet-service-messenger_service.c
src/messenger/gnunet-service-messenger_tunnel.c
-src/messenger/gnunet-service-messenger_util.c
src/messenger/messenger_api.c
src/messenger/messenger_api_contact.c
+src/messenger/messenger_api_contact_store.c
src/messenger/messenger_api_handle.c
src/messenger/messenger_api_list_tunnels.c
src/messenger/messenger_api_message.c
src/messenger/messenger_api_room.c
+src/messenger/messenger_api_util.c
+src/messenger/testing_messenger_barrier.c
+src/messenger/testing_messenger_setup.c
src/my/my.c
src/my/my_query_helper.c
src/my/my_result_helper.c
@@ -399,6 +407,9 @@ src/testbed/gnunet_mpi_test.c
src/testbed/gnunet_testbed_mpi_spawn.c
src/testbed/testbed_api.c
src/testbed/testbed_api_barriers.c
+src/testbed/testbed_api_cmd_controller.c
+src/testbed/testbed_api_cmd_peer.c
+src/testbed/testbed_api_cmd_service.c
src/testbed/testbed_api_hosts.c
src/testbed/testbed_api_operations.c
src/testbed/testbed_api_peers.c
@@ -412,6 +423,13 @@ src/testbed/testbed_api_underlay.c
src/testing/gnunet-testing.c
src/testing/list-keys.c
src/testing/testing.c
+src/testing/testing_api_cmd_batch.c
+src/testing/testing_api_cmd_hello_world.c
+src/testing/testing_api_cmd_hello_world_birth.c
+src/testing/testing_api_loop.c
+src/testing/testing_api_trait_cmd.c
+src/testing/testing_api_trait_process.c
+src/testing/testing_api_traits.c
src/topology/friends.c
src/topology/gnunet-daemon-topology.c
src/transport/gnunet-communicator-tcp.c
@@ -508,6 +526,7 @@ src/util/dnsparser.c
src/util/dnsstub.c
src/util/getopt.c
src/util/getopt_helpers.c
+src/util/gnunet-base32.c
src/util/gnunet-config-diff.c
src/util/gnunet-config.c
src/util/gnunet-crypto-tvg.c
@@ -550,7 +569,5 @@ src/vpn/vpn_api.c
src/zonemaster/gnunet-service-zonemaster-monitor.c
src/zonemaster/gnunet-service-zonemaster.c
src/fs/fs_api.h
-src/include/gnunet_identity_service.h
-src/include/gnunet_messenger_service.h
src/testbed/testbed_api.h
src/testbed/testbed_api_operations.h
diff --git a/src/Makefile.am b/src/Makefile.am
index d8a869acb..564923e28 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -45,6 +45,10 @@ if HAVE_POSTGRESQL
POSTGRES_DIR = pq
endif
+if HAVE_NOLIBGCRYPT19
+ SCALARPRODUCT_DIR = scalarproduct
+endif
+
REST_DIR = rest
@@ -93,7 +97,7 @@ SUBDIRS = \
seti \
setu \
consensus \
- scalarproduct \
+ $(SCALARPRODUCT_DIR) \
revocation \
vpn \
gns \
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c
index 899b6f152..2ec913a0a 100644
--- a/src/arm/arm_api.c
+++ b/src/arm/arm_api.c
@@ -951,7 +951,8 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h,
* 2) We're not connected to ARM.
* Cancel any reconnection attempts temporarily, then perform
* a service test.
- */if (GNUNET_YES == h->currently_up)
+ */
+ if (GNUNET_YES == h->currently_up)
{
LOG (GNUNET_ERROR_TYPE_DEBUG,
"ARM is already running\n");
@@ -970,7 +971,8 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h,
yet complete the MQ handshake. However, given that users
are unlikely to hammer 'gnunet-arm -s' on a busy system,
the above check should catch 99.99% of the cases where ARM
- is already running. */LOG (GNUNET_ERROR_TYPE_DEBUG,
+ is already running. */
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
"Starting ARM service\n");
if (NULL == (sig = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE)))
{
@@ -1003,13 +1005,13 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h,
op->rfd,
&notify_starting,
op);
+ GNUNET_DISK_pipe_close (sig);
}
else
{
op->async = GNUNET_SCHEDULER_add_now (&notify_starting,
op);
}
- GNUNET_DISK_pipe_close (sig);
return op;
}
diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c
index 2d3b548dd..c8d69e43d 100644
--- a/src/cadet/gnunet-service-cadet.c
+++ b/src/cadet/gnunet-service-cadet.c
@@ -1027,7 +1027,8 @@ handle_drop_message (void *cls,
ch = lookup_channel (c,
message->ccn);
- GCCH_assign_type_to_drop (ch, message);
+ if (NULL != ch)
+ GCCH_assign_type_to_drop (ch, message);
GNUNET_SERVICE_client_continue (c->client);
}
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c
index 6b22ae2b4..ae5d9210f 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -1858,6 +1858,7 @@ GCCH_handle_local_data (struct CadetChannel *ch,
}
else
{
+ GNUNET_free (env);
GNUNET_break (0);
return GNUNET_SYSERR;
}
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index 9f03311e1..3aaa734f2 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -80,9 +80,7 @@ bin_PROGRAMS = \
noinst_PROGRAMS = \
gnunet-gns-benchmark
-if LINUX
bin_PROGRAMS += gnunet-bcd
-endif
REST_PLUGIN = libgnunet_plugin_rest_gns.la
@@ -156,6 +154,7 @@ gnunet_bcd_SOURCES = \
gnunet-bcd.c
gnunet_bcd_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/identity/libgnunetidentity.la \
$(GN_LIBINTL) $(MHD_LIBS)
gnunet_bcd_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS)
diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c
index f71f477ef..a2e94089c 100644
--- a/src/gns/gnunet-bcd.c
+++ b/src/gns/gnunet-bcd.c
@@ -27,6 +27,7 @@
#include "platform.h"
#include <microhttpd.h>
#include "gnunet_util_lib.h"
+#include "gnunet_identity_service.h"
#include "gnunet_mhd_compat.h"
/**
@@ -148,7 +149,7 @@ access_handler_callback (void *cls,
char *p;
char *tmp;
char *deffile;
- struct GNUNET_CRYPTO_EcdsaPublicKey pub;
+ struct GNUNET_IDENTITY_PublicKey pub;
size_t slen;
FILE *f;
struct stat st;
@@ -166,9 +167,8 @@ access_handler_callback (void *cls,
MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "gnskey");
if ((NULL == gnskey) ||
(GNUNET_OK !=
- GNUNET_CRYPTO_ecdsa_public_key_from_string (gnskey,
- strlen (gnskey),
- &pub)))
+ GNUNET_IDENTITY_public_key_from_string (gnskey,
+ &pub)))
{
return MHD_queue_response (connection,
MHD_HTTP_OK,
@@ -218,10 +218,10 @@ access_handler_callback (void *cls,
(NULL == gns_nick) ? "" : gns_nick);
fclose (f);
GNUNET_asprintf (
- &p,
- "cd %s; cp %s gns-bcd.tex | pdflatex --enable-write18 gns-bcd.tex > /dev/null 2> /dev/null",
- tmp,
- resfile);
+ &p,
+ "cd %s; cp %s gns-bcd.tex | pdflatex --enable-write18 gns-bcd.tex > /dev/null 2> /dev/null",
+ tmp,
+ resfile);
GNUNET_free (deffile);
ret = system (p);
if (WIFSIGNALED (ret) || (0 != WEXITSTATUS (ret)))
@@ -506,7 +506,7 @@ main (int argc, char *const *argv)
"port",
"PORT",
gettext_noop (
- "Run HTTP serve on port PORT (default is 8888)"),
+ "Run HTTP serve on port PORT (default is 8888)"),
&port),
GNUNET_GETOPT_OPTION_END
};
@@ -523,8 +523,8 @@ main (int argc, char *const *argv)
options,
&run,
NULL))
- ? 0
- : 1;
+ ? 0
+ : 1;
GNUNET_free_nz ((void *) argv);
return ret;
}
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c
index 0a9b7c861..06f4c9841 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -309,6 +309,14 @@ dns_result_processor (void *cls,
}
request->packet = GNUNET_DNSPARSER_parse ((char *) dns,
r);
+ if (NULL == request->packet)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _ ("Failed to parse DNS response!\n"));
+ GNUNET_SCHEDULER_cancel (request->timeout_task);
+ do_timeout (request);
+ return;
+ }
GNUNET_DNSSTUB_resolve_cancel (request->dns_lookup);
send_response (request);
}
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index 833a8da01..d02f0f576 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -1841,6 +1841,7 @@ create_response (void *cls,
char *curlurl;
char ipstring[INET6_ADDRSTRLEN];
char ipaddr[INET6_ADDRSTRLEN + 2];
+ char *curl_hosts;
const struct sockaddr *sa;
const struct sockaddr_in *s4;
const struct sockaddr_in6 *s6;
@@ -1900,6 +1901,14 @@ create_response (void *cls,
GNUNET_break (0);
return MHD_NO;
}
+ GNUNET_asprintf (&curl_hosts,
+ "%s:%d:%s",
+ s5r->leho,
+ port,
+ ipaddr);
+ s5r->hosts = curl_slist_append (NULL,
+ curl_hosts);
+ GNUNET_free (curl_hosts);
}
else
{
@@ -1949,21 +1958,13 @@ create_response (void *cls,
* Pre-populate cache to resolve Hostname.
* This is necessary as the DNS name in the CURLOPT_URL is used
* for SNI http://de.wikipedia.org/wiki/Server_Name_Indication
- */if (NULL != s5r->leho)
+ */
+ if ((NULL != s5r->leho) &&
+ (NULL != s5r->hosts))
{
- char *curl_hosts;
-
- GNUNET_asprintf (&curl_hosts,
- "%s:%d:%s",
- s5r->leho,
- port,
- ipaddr);
- s5r->hosts = curl_slist_append (NULL,
- curl_hosts);
curl_easy_setopt (s5r->curl,
CURLOPT_RESOLVE,
s5r->hosts);
- GNUNET_free (curl_hosts);
}
if (s5r->is_gns)
{
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c
index b53f4af6b..255f85598 100644
--- a/src/gns/gnunet-service-gns_interceptor.c
+++ b/src/gns/gnunet-service-gns_interceptor.c
@@ -323,7 +323,6 @@ handle_dns_request (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Received malformed DNS packet, leaving it untouched.\n");
GNUNET_DNS_request_forward (rh);
- GNUNET_DNSPARSER_free_packet (p);
return;
}
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 49c1b340a..2f8a55804 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -764,6 +764,7 @@ transmit_lookup_dns_result (struct GNS_ResolverHandle *rh)
rd[i].data = pos->data;
rd[i].data_size = pos->data_size;
rd[i].record_type = pos->record_type;
+ rd[i].flags = GNUNET_GNSRECORD_RF_NONE;
/**
* If this is a LEHO, we added this before. It must be a supplemental
* record #LSD0001
@@ -772,12 +773,11 @@ transmit_lookup_dns_result (struct GNS_ResolverHandle *rh)
rd[i].flags |= GNUNET_GNSRECORD_RF_SUPPLEMENTAL;
if (0 == pos->expiration_time)
{
- rd[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
+ rd[i].flags |= GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
rd[i].expiration_time = 0;
}
else
{
- rd[i].flags = GNUNET_GNSRECORD_RF_NONE;
rd[i].expiration_time = pos->expiration_time;
}
i++;
@@ -1764,6 +1764,8 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh,
/**
* Records other than GNS2DNS not allowed
*/
+ if (NULL != ns)
+ GNUNET_free (ns);
return GNUNET_SYSERR;
}
off = 0;
@@ -1771,15 +1773,22 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh,
rd[i].data_size,
&off);
ip = GNUNET_strdup (&((const char *) rd[i].data)[off]);
+ if ((NULL == n) ||
+ (NULL == ip))
+ {
+ GNUNET_break_op (0);
+ if (NULL != n)
+ GNUNET_free (n);
+ if (NULL != ip)
+ GNUNET_free (ip);
+ continue;
+ }
+
off += strlen (ip) + 1;
- if ((NULL == n) ||
- (NULL == ip) ||
- (off != rd[i].data_size))
+ if (off != rd[i].data_size)
{
GNUNET_break_op (0);
- GNUNET_free (n);
- GNUNET_free (ip);
continue;
}
/* resolve 'ip' to determine the IP(s) of the DNS
@@ -1909,6 +1918,8 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh,
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_ ("Name `%s' cannot be converted to IDNA."),
tmp);
+ GNUNET_free (tmp);
+ GNUNET_free (ac);
return GNUNET_SYSERR;
}
GNUNET_free (tmp);
@@ -1922,6 +1933,8 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh,
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
_ ("GNS lookup resulted in DNS name that is too long (`%s')\n"),
ac->label);
+ GNUNET_free (ac->label);
+ GNUNET_free (ac);
return GNUNET_SYSERR;
}
continue_with_gns2dns (ac);
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index 2ccb5be2b..3a35c9999 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -270,7 +270,9 @@ handle_gns_response (void *cls,
result = json_dumps (result_obj, 0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result);
resp = GNUNET_REST_create_response (result);
- 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);
GNUNET_free (result);
json_decref (result_obj);
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c
index 82c38f19a..b907eed27 100644
--- a/src/gnsrecord/gnsrecord_misc.c
+++ b/src/gnsrecord/gnsrecord_misc.c
@@ -296,15 +296,20 @@ GNUNET_GNSRECORD_data_from_identity (const struct
size_t *data_size,
uint32_t *type)
{
+ char *tmp;
*type = ntohl (key->type);
*data_size = GNUNET_IDENTITY_key_get_length (key);
if (0 == *data_size)
return GNUNET_SYSERR;
- *data = GNUNET_malloc (*data_size);
- return (GNUNET_IDENTITY_write_key_to_buffer (key, *data, *data_size) ==
- *data_size?
- GNUNET_OK :
- GNUNET_SYSERR);
+ tmp = GNUNET_malloc (*data_size);
+ if (GNUNET_IDENTITY_write_key_to_buffer (key, tmp, *data_size)
+ != *data_size) {
+ GNUNET_free (tmp);
+ *data_size = 0;
+ return GNUNET_SYSERR;
+ }
+ *data = tmp;
+ return GNUNET_OK;
}
@@ -350,7 +355,7 @@ GNUNET_GNSRECORD_block_get_expiration (const struct
case GNUNET_GNSRECORD_TYPE_PKEY:
return GNUNET_TIME_absolute_ntoh (block->ecdsa_block.expiration_time);
default:
- return GNUNET_TIME_absolute_get_zero_ ();
+ GNUNET_break (0); /* Hopefully we never get here, but we might */
}
return GNUNET_TIME_absolute_get_zero_ ();
diff --git a/src/gnsrecord/gnunet-gnsrecord-tvg.c b/src/gnsrecord/gnunet-gnsrecord-tvg.c
index 47b13bdab..d6b35544c 100644
--- a/src/gnsrecord/gnunet-gnsrecord-tvg.c
+++ b/src/gnsrecord/gnunet-gnsrecord-tvg.c
@@ -172,7 +172,7 @@ run (void *cls,
fprintf (stdout, "RRBLOCK:\n");
print_bytes (rrblock, block_size, 8);
fprintf (stdout, "\n");
-
+ GNUNET_free (rdata);
}
diff --git a/src/include/gnunet_testbed_ng_service.h b/src/include/gnunet_testbed_ng_service.h
new file mode 100644
index 000000000..a6f30889f
--- /dev/null
+++ b/src/include/gnunet_testbed_ng_service.h
@@ -0,0 +1,247 @@
+/*
+ This file is part of GNUnet
+ Copyright (C) 2021 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+
+/**
+ * @author t3sserakt
+ *
+ * @file
+ * API for writing tests and creating large-scale emulation testbeds for GNUnet with command pattern.
+ *
+ * @defgroup testbed Testbed service
+ * Writing tests and creating large-scale emulation testbeds for GNUnet with command pattern.
+ *
+ * @see [Documentation](https://docs.gnunet.org/handbook/gnunet.html#TESTBED-NG-Subsystem)
+ *
+ * @{
+ */
+
+#ifndef GNUNET_TESTBED_NG_SERVICE_H
+#define GNUNET_TESTBED_NG_SERVICE_H
+
+#include "gnunet_util_lib.h"
+#include "gnunet_testing_ng_lib.h"
+
+struct ServiceState
+{
+ /**
+ * Handle to operation
+ */
+ struct GNUNET_TESTBED_Operation *operation;
+
+ /**
+ * Flag indicating if service is ready.
+ */
+ int service_ready;
+
+ /**
+ * Abort task identifier
+ */
+ struct GNUNET_SCHEDULER_Task *abort_task;
+
+ /**
+ * Label of peer command.
+ */
+ const char *peer_label;
+
+ /**
+ * Name of service to start.
+ */
+ const char *servicename;
+};
+
+struct PeerCmdState
+{
+ /**
+ * The label of a controller command.
+ */
+ const char *controller_label;
+
+ /**
+ * Handle to operation
+ */
+ struct GNUNET_TESTBED_Operation *operation;
+
+ /**
+ * Name of the host, use "NULL" for localhost.
+ */
+ const char *hostname;
+
+ /**
+ * Username to use for the login; may be NULL.
+ */
+ const char *username;
+
+ /**
+ * Port number to use for ssh; use 0 to let ssh decide.
+ */
+ uint16_t port;
+
+ /**
+ * The configuration to use as a template while starting a controller
+ * on this host. Operation queue sizes specific to a host are also
+ * read from this configuration handle.
+ */
+ struct GNUNET_CONFIGURATION_Handle *cfg;
+
+ /**
+ * The host to run peers and controllers on
+ */
+ struct GNUNET_TESTBED_Host *host;
+
+ /**
+ * Abort task identifier
+ */
+ struct GNUNET_SCHEDULER_Task *abort_task;
+
+ /**
+ * Handle for host registration
+ */
+ struct GNUNET_TESTBED_HostRegistrationHandle *reg_handle;
+
+ /**
+ * Flag indicating if peer is ready.
+ */
+ int peer_ready;
+
+ /**
+ * Flag indicating controller is going down.
+ */
+ int peer_going_down;
+
+ /**
+ * Interpreter state.
+ */
+ struct GNUNET_TESTING_Interpreter *is;
+
+ /**
+ * Peer to start
+ */
+ struct GNUNET_TESTBED_Peer *peer;
+};
+
+struct ControllerState
+{
+ /**
+ * The ip address of the controller which will be set as TRUSTED
+ * HOST(all connections form this ip are permitted by the testbed) when
+ * starting testbed controller at host. This can either be a single ip
+ * address or a network address in CIDR notation.
+ */
+ const char *trusted_ip;
+
+ /**
+ * Name of the host, use "NULL" for localhost.
+ */
+ const char *hostname;
+
+ /**
+ * Username to use for the login; may be NULL.
+ */
+ const char *username;
+
+ /**
+ * Port number to use for ssh; use 0 to let ssh decide.
+ */
+ uint16_t port;
+
+ /**
+ * The configuration to use as a template while starting a controller
+ * on this host. Operation queue sizes specific to a host are also
+ * read from this configuration handle.
+ */
+ struct GNUNET_CONFIGURATION_Handle *cfg;
+
+ /**
+ * The host to run peers and controllers on
+ */
+ struct GNUNET_TESTBED_Host *host;
+
+ /**
+ * The controller process
+ */
+ struct GNUNET_TESTBED_ControllerProc *cp;
+
+ /**
+ * The controller handle
+ */
+ struct GNUNET_TESTBED_Controller *controller;
+
+ /**
+ * A bit mask with set of events to call the controller for.
+ */
+ uint64_t event_mask;
+
+ /**
+ * Abort task identifier
+ */
+ struct GNUNET_SCHEDULER_Task *abort_task;
+
+ /**
+ * Handle for host registration
+ */
+ struct GNUNET_TESTBED_HostRegistrationHandle *reg_handle;
+
+ /**
+ * Flag indicating if host create with controller is ready.
+ */
+ int host_ready;
+
+ /**
+ * Flag indicating controller is going down.
+ */
+ int controller_going_down;
+
+ /**
+ * Interpreter state.
+ */
+ struct GNUNET_TESTING_Interpreter *is;
+};
+
+/**
+ * Offer data from trait
+ *
+ * @param cmd command to extract the controller from.
+ * @param pt pointer to controller.
+ * @return #GNUNET_OK on success.
+ */
+int
+GNUNET_TESTBED_get_trait_controller (const struct GNUNET_TESTING_Command *cmd,
+ struct GNUNET_TESTBED_Controller **
+ controller);
+
+struct GNUNET_TESTING_Command
+GNUNET_TESTBED_cmd_controller (const char *label,
+ const char *trusted_ip,
+ const char *hostname,
+ const char *username,
+ uint16_t port,
+ struct GNUNET_CONFIGURATION_Handle *cfg,
+ uint64_t event_mask);
+
+void
+GNUNET_TESTBED_shutdown_controller (struct ControllerState *cs);
+
+void
+GNUNET_TESTBED_shutdown_peer (struct PeerCmdState *ps);
+
+void
+GNUNET_TESTBED_shutdown_service (struct ServiceState *ss);
+
+#endif
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h
index 70cbfa90d..acdfb2034 100644
--- a/src/include/gnunet_testbed_service.h
+++ b/src/include/gnunet_testbed_service.h
@@ -27,7 +27,7 @@
* @defgroup testbed Testbed service
* Writing tests and creating large-scale emulation testbeds for GNUnet.
*
- * @see [Documentation](https://gnunet.org/gnunet-testbed-subsystem)
+ * @see [Documentation](https://docs.gnunet.org/handbook/gnunet.html#TESTBED-Subsystem)
*
* @{
*/
diff --git a/src/messenger/Makefile.am b/src/messenger/Makefile.am
index 1ebfbe5ed..2bb9ad922 100644
--- a/src/messenger/Makefile.am
+++ b/src/messenger/Makefile.am
@@ -25,35 +25,23 @@ bin_PROGRAMS = \
gnunet-messenger
lib_LTLIBRARIES = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
$(EXP_LIB)
-libgnunetmessenger_common_la_SOURCES = \
+libgnunetmessenger_la_SOURCES = \
+ messenger_api.c \
messenger_api_ego.h \
messenger_api_contact.c messenger_api_contact.h \
messenger_api_contact_store.c messenger_api_contact_store.h \
messenger_api_message.c messenger_api_message.h \
messenger_api_list_tunnels.c messenger_api_list_tunnels.h \
- messenger_api_util.c messenger_api_util.h
-libgnunetmessenger_common_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/cadet/libgnunetcadet.la \
- $(top_builddir)/src/identity/libgnunetidentity.la \
- $(XLIB) \
- $(LTLIBINTL)
-libgnunetmessenger_common_la_LDFLAGS = \
- $(GN_LIB_LDFLAGS) \
- -version-info 0:0:0
-
-libgnunetmessenger_la_SOURCES = \
- messenger_api.c \
+ messenger_api_util.c messenger_api_util.h \
messenger_api_handle.c messenger_api_handle.h \
messenger_api_room.c messenger_api_room.h
libgnunetmessenger_la_LIBADD = \
$(top_builddir)/src/util/libgnunetutil.la \
+ $(top_builddir)/src/cadet/libgnunetcadet.la \
$(top_builddir)/src/identity/libgnunetidentity.la \
- libgnunetmessenger_common.la \
$(XLIB) \
$(LTLIBINTL)
libgnunetmessenger_la_LDFLAGS = \
@@ -63,10 +51,8 @@ libgnunetmessenger_la_LDFLAGS = \
gnunet_messenger_SOURCES = \
gnunet-messenger.c
gnunet_messenger_LDADD = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
- $(top_builddir)/src/util/libgnunetutil.la \
- $(top_builddir)/src/identity/libgnunetidentity.la
+ $(top_builddir)/src/util/libgnunetutil.la
gnunet_messenger_LDFLAGS = \
$(GN_LIBINTL)
@@ -91,11 +77,10 @@ gnunet_service_messenger_SOURCES = \
gnunet-service-messenger_room.c gnunet-service-messenger_room.h \
gnunet-service-messenger_tunnel.c gnunet-service-messenger_tunnel.h
gnunet_service_messenger_LDADD = \
+ libgnunetmessenger.la \
$(top_builddir)/src/util/libgnunetutil.la \
$(top_builddir)/src/cadet/libgnunetcadet.la \
$(top_builddir)/src/identity/libgnunetidentity.la \
- libgnunetmessenger_common.la \
- libgnunetmessenger.la \
$(GN_LIBINTL)
check_PROGRAMS = \
@@ -121,7 +106,6 @@ endif
test_messenger_api_SOURCES = \
test_messenger.c
test_messenger_api_LDADD = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
@@ -129,7 +113,6 @@ test_messenger_api_LDADD = \
test_messenger_anonymous_SOURCES = \
test_messenger_anonymous.c
test_messenger_anonymous_LDADD = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
$(top_builddir)/src/testing/libgnunettesting.la \
$(top_builddir)/src/util/libgnunetutil.la
@@ -139,7 +122,6 @@ test_messenger_sync_client_SOURCES = \
testing_messenger_barrier.c testing_messenger_barrier.h \
testing_messenger_setup.c testing_messenger_setup.h
test_messenger_sync_client_LDADD = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
$(top_builddir)/src/testbed/libgnunettestbed.la \
$(top_builddir)/src/testing/libgnunettesting.la \
@@ -150,7 +132,6 @@ test_messenger_async_client_SOURCES = \
testing_messenger_barrier.c testing_messenger_barrier.h \
testing_messenger_setup.c testing_messenger_setup.h
test_messenger_async_client_LDADD = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
$(top_builddir)/src/testbed/libgnunettestbed.la \
$(top_builddir)/src/testing/libgnunettesting.la \
@@ -161,7 +142,6 @@ test_messenger_worst_client_SOURCES = \
testing_messenger_barrier.c testing_messenger_barrier.h \
testing_messenger_setup.c testing_messenger_setup.h
test_messenger_worst_client_LDADD = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
$(top_builddir)/src/testbed/libgnunettestbed.la \
$(top_builddir)/src/testing/libgnunettesting.la \
@@ -172,7 +152,6 @@ test_messenger_sync_p2p_SOURCES = \
testing_messenger_barrier.c testing_messenger_barrier.h \
testing_messenger_setup.c testing_messenger_setup.h
test_messenger_sync_p2p_LDADD = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
$(top_builddir)/src/testbed/libgnunettestbed.la \
$(top_builddir)/src/testing/libgnunettesting.la \
@@ -183,7 +162,6 @@ test_messenger_async_p2p_SOURCES = \
testing_messenger_barrier.c testing_messenger_barrier.h \
testing_messenger_setup.c testing_messenger_setup.h
test_messenger_async_p2p_LDADD = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
$(top_builddir)/src/testbed/libgnunettestbed.la \
$(top_builddir)/src/testing/libgnunettesting.la \
@@ -194,7 +172,6 @@ test_messenger_worst_p2p_SOURCES = \
testing_messenger_barrier.c testing_messenger_barrier.h \
testing_messenger_setup.c testing_messenger_setup.h
test_messenger_worst_p2p_LDADD = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
$(top_builddir)/src/testbed/libgnunettestbed.la \
$(top_builddir)/src/testing/libgnunettesting.la \
@@ -205,7 +182,6 @@ test_messenger_server_SOURCES = \
testing_messenger_barrier.c testing_messenger_barrier.h \
testing_messenger_setup.c testing_messenger_setup.h
test_messenger_server_LDADD = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
$(top_builddir)/src/testbed/libgnunettestbed.la \
$(top_builddir)/src/testing/libgnunettesting.la \
@@ -216,7 +192,6 @@ test_messenger_growth_SOURCES = \
testing_messenger_barrier.c testing_messenger_barrier.h \
testing_messenger_setup.c testing_messenger_setup.h
test_messenger_growth_LDADD = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
$(top_builddir)/src/testbed/libgnunettestbed.la \
$(top_builddir)/src/testing/libgnunettesting.la \
@@ -227,7 +202,6 @@ test_messenger_ring_SOURCES = \
testing_messenger_barrier.c testing_messenger_barrier.h \
testing_messenger_setup.c testing_messenger_setup.h
test_messenger_ring_LDADD = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
$(top_builddir)/src/testbed/libgnunettestbed.la \
$(top_builddir)/src/testing/libgnunettesting.la \
@@ -238,7 +212,6 @@ test_messenger_adapt_SOURCES = \
testing_messenger_barrier.c testing_messenger_barrier.h \
testing_messenger_setup.c testing_messenger_setup.h
test_messenger_adapt_LDADD = \
- libgnunetmessenger_common.la \
libgnunetmessenger.la \
$(top_builddir)/src/testbed/libgnunettestbed.la \
$(top_builddir)/src/testing/libgnunettesting.la \
diff --git a/src/messenger/gnunet-messenger.c b/src/messenger/gnunet-messenger.c
index 737bb83c8..094ae398d 100644..100755
--- a/src/messenger/gnunet-messenger.c
+++ b/src/messenger/gnunet-messenger.c
@@ -229,18 +229,12 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle)
if (room_key)
GNUNET_CRYPTO_hash (room_key, strlen (room_key), &key);
+ struct GNUNET_PeerIdentity door_peer;
struct GNUNET_PeerIdentity *door = NULL;
- if (door_id)
- {
- door = GNUNET_new(struct GNUNET_PeerIdentity);
-
- if (GNUNET_OK != GNUNET_CRYPTO_eddsa_public_key_from_string (door_id, strlen (door_id), &(door->public_key)))
- {
- GNUNET_free(door);
- door = NULL;
- }
- }
+ if ((door_id) &&
+ (GNUNET_OK == GNUNET_CRYPTO_eddsa_public_key_from_string (door_id, strlen (door_id), &(door_peer.public_key))))
+ door = &door_peer;
const char *name = GNUNET_MESSENGER_get_name (handle);
diff --git a/src/messenger/gnunet-service-messenger.c b/src/messenger/gnunet-service-messenger.c
index 187b65ed5..76fb31d95 100644..100755
--- a/src/messenger/gnunet-service-messenger.c
+++ b/src/messenger/gnunet-service-messenger.c
@@ -191,7 +191,7 @@ check_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg)
const uint16_t length = full_length - sizeof(*msg);
const char *buffer = ((const char*) msg) + sizeof(*msg);
- uint16_t key_length = 0;
+ ssize_t key_length = 0;
if (!(flags & GNUNET_MESSENGER_FLAG_PRIVATE))
goto check_for_message;
@@ -231,7 +231,7 @@ handle_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg)
const char *buffer = ((const char*) msg) + sizeof(*msg);
const uint16_t length = ntohs (msg->header.size) - sizeof(*msg);
- uint16_t key_length = 0;
+ ssize_t key_length = 0;
struct GNUNET_IDENTITY_PublicKey public_key;
diff --git a/src/messenger/gnunet-service-messenger_member.c b/src/messenger/gnunet-service-messenger_member.c
index 6e39cec13..7f00e8438 100644..100755
--- a/src/messenger/gnunet-service-messenger_member.c
+++ b/src/messenger/gnunet-service-messenger_member.c
@@ -335,7 +335,11 @@ add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSEN
struct GNUNET_HashCode hash;
GNUNET_CRYPTO_hash(public_key, sizeof(*public_key), &hash);
- GNUNET_CONTAINER_multihashmap_put(member->sessions, &hash, session, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
+ if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put(
+ member->sessions, &hash, session,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Adding a member session failed: %s\n",
+ GNUNET_h2s(&hash));
}
void
@@ -348,7 +352,9 @@ remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MES
struct GNUNET_HashCode hash;
GNUNET_CRYPTO_hash(public_key, sizeof(*public_key), &hash);
- GNUNET_CONTAINER_multihashmap_remove(member->sessions, &hash, session);
+ if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove(member->sessions, &hash, session))
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Removing a member session failed: %s\n",
+ GNUNET_h2s(&hash));
}
struct GNUNET_MESSENGER_ClosureIterateSessions {
diff --git a/src/messenger/gnunet-service-messenger_message_store.c b/src/messenger/gnunet-service-messenger_message_store.c
index 1f3d262ac..b143c6c98 100644..100755
--- a/src/messenger/gnunet-service-messenger_message_store.c
+++ b/src/messenger/gnunet-service-messenger_message_store.c
@@ -158,6 +158,8 @@ load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store, const cha
struct GNUNET_MESSENGER_MessageLinkStorage storage;
struct GNUNET_MESSENGER_MessageLink *link = NULL;
+ memset(&storage, 0, sizeof(storage));
+
do
{
if ((sizeof(storage.hash) != GNUNET_DISK_file_read (entries, &(storage.hash), sizeof(storage.hash))) ||
@@ -311,6 +313,8 @@ save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *dir
save.store = store;
save.storage = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, permission);
+ GNUNET_free(filename);
+
if (!save.storage)
goto save_entries;
@@ -324,7 +328,6 @@ close_links:
GNUNET_DISK_file_close (save.storage);
save_entries:
- GNUNET_free(filename);
GNUNET_asprintf (&filename, "%s%s", directory, "entries.store");
save.store = store;
@@ -417,7 +420,10 @@ get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNU
if ((GNUNET_YES != decoding) || (GNUNET_CRYPTO_hash_cmp (hash, &check) != 0))
{
- GNUNET_CONTAINER_multihashmap_remove (store->entries, hash, entry);
+ if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (store->entries, hash, entry))
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Corrupted entry could not be removed from store: %s\n",
+ GNUNET_h2s(hash));
+
store->rewrite_entries = GNUNET_YES;
goto free_message;
diff --git a/src/messenger/gnunet-service-messenger_operation_store.c b/src/messenger/gnunet-service-messenger_operation_store.c
index 05985ef84..a32fbad2c 100644..100755
--- a/src/messenger/gnunet-service-messenger_operation_store.c
+++ b/src/messenger/gnunet-service-messenger_operation_store.c
@@ -184,7 +184,9 @@ cancel_store_operation (struct GNUNET_MESSENGER_OperationStore *store,
stop_operation(op);
- GNUNET_CONTAINER_multihashmap_remove(store->operations, hash, op);
+ if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove(store->operations, hash, op))
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Canceled operation could not be removed: %s\n",
+ GNUNET_h2s(hash));
destroy_operation(op);
}
diff --git a/src/messenger/messenger_api_contact_store.c b/src/messenger/messenger_api_contact_store.c
index 5238b2c58..6a517c2e0 100644..100755
--- a/src/messenger/messenger_api_contact_store.c
+++ b/src/messenger/messenger_api_contact_store.c
@@ -155,8 +155,10 @@ update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET
store, next_context, &hash
);
- GNUNET_CONTAINER_multihashmap_put (map, &hash, contact,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST);
+ if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (map, &hash, contact,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Updating a contact failed: %s\n",
+ GNUNET_h2s(&hash));
}
}
@@ -176,7 +178,8 @@ remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET
);
if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (map, &hash, contact))
- return;
+ GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Removing a contact failed: %s\n",
+ GNUNET_h2s(&hash));
destroy_contact (contact);
}
diff --git a/src/messenger/messenger_api_message.c b/src/messenger/messenger_api_message.c
index d88859186..0d885f9ee 100644..100755
--- a/src/messenger/messenger_api_message.c
+++ b/src/messenger/messenger_api_message.c
@@ -590,7 +590,7 @@ int
decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer,
int include_signature, uint16_t *padding)
{
- GNUNET_assert((message) && (buffer));
+ GNUNET_assert((message) && (buffer) && (length >= sizeof(message->header)));
uint16_t offset = 0;
diff --git a/src/messenger/messenger_api_room.c b/src/messenger/messenger_api_room.c
index df141ca12..5b7edee60 100644..100755
--- a/src/messenger/messenger_api_room.c
+++ b/src/messenger/messenger_api_room.c
@@ -106,7 +106,7 @@ get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_H
return (entry? entry->sender : NULL);
}
-static void
+static struct GNUNET_MESSENGER_Contact*
handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender,
const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
{
@@ -124,6 +124,8 @@ handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER
(GNUNET_OK == GNUNET_CONTAINER_multishortmap_put(room->members, &(message->header.sender_id), sender,
GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)))
increase_contact_rc(sender);
+
+ return sender;
}
static void
@@ -140,7 +142,7 @@ handle_leave_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGE
struct GNUNET_MESSENGER_ContactStore *store = get_handle_contact_store(room->handle);
if (GNUNET_YES == decrease_contact_rc(sender))
- remove_store_contact(store, sender, &context);
+ GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "A contact does not share any room with you anymore!\n");
}
static void
@@ -216,17 +218,17 @@ handle_delete_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENG
}
}
-void
+struct GNUNET_MESSENGER_Contact*
handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender,
const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash)
{
if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains (room->messages, hash))
- return;
+ return sender;
switch (message->header.kind)
{
case GNUNET_MESSENGER_KIND_JOIN:
- handle_join_message (room, sender, message, hash);
+ sender = handle_join_message (room, sender, message, hash);
break;
case GNUNET_MESSENGER_KIND_LEAVE:
handle_leave_message (room, sender, message, hash);
@@ -253,7 +255,7 @@ handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER
struct GNUNET_MESSENGER_RoomMessageEntry *entry = GNUNET_new(struct GNUNET_MESSENGER_RoomMessageEntry);
if (!entry)
- return;
+ return sender;
entry->sender = sender;
entry->message = copy_message (message);
@@ -264,6 +266,8 @@ handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER
destroy_message (entry->message);
GNUNET_free(entry);
}
+
+ return sender;
}
struct GNUNET_MESSENGER_MemberCall
diff --git a/src/messenger/messenger_api_room.h b/src/messenger/messenger_api_room.h
index 9455fd43b..eb41cf740 100644..100755
--- a/src/messenger/messenger_api_room.h
+++ b/src/messenger/messenger_api_room.h
@@ -100,12 +100,16 @@ get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_H
* Handles a <i>message</i> with a given <i>hash</i> in a <i>room</i> for the client API to update
* members and its information. The function also stores the message in map locally for access afterwards.
*
+ * The contact of the message's sender could be updated or even created. It may not be freed or destroyed though!
+ * (The contact may still be in use for old messages...)
+ *
* @param[in/out] room Room
* @param[in/out] sender Contact of sender
* @param[in] message Message
* @param[in] hash Hash of message
+ * @return Contact of sender
*/
-void
+struct GNUNET_MESSENGER_Contact*
handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender,
const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash);
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c
index d6774b37b..79210939f 100644
--- a/src/namestore/gnunet-service-namestore.c
+++ b/src/namestore/gnunet-service-namestore.c
@@ -743,13 +743,14 @@ send_lookup_response (struct NamestoreClient *nc,
nick->flags =
(nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE;
merge_with_nick_records (nick, rd_count, rd, &res_count, &res);
- GNUNET_free (nick);
}
else
{
res_count = rd_count;
res = (struct GNUNET_GNSRECORD_Data *) rd;
}
+ if (NULL != nick)
+ GNUNET_free (nick);
GNUNET_assert (-1 != GNUNET_GNSRECORD_records_get_size (res_count, res));
@@ -758,12 +759,16 @@ send_lookup_response (struct NamestoreClient *nc,
rd_ser_len = GNUNET_GNSRECORD_records_get_size (res_count, res);
if (rd_ser_len < 0)
{
+ if (rd != res)
+ GNUNET_free (res);
GNUNET_break (0);
GNUNET_SERVICE_client_drop (nc->client);
return;
}
if (((size_t) rd_ser_len) >= UINT16_MAX - name_len - sizeof(*zir_msg))
{
+ if (rd != res)
+ GNUNET_free (res);
GNUNET_break (0);
GNUNET_SERVICE_client_drop (nc->client);
return;
@@ -920,12 +925,15 @@ refresh_block (struct NamestoreClient *nc,
nick->flags =
(nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE;
merge_with_nick_records (nick, rd_count, rd, &res_count, &res);
- GNUNET_free (nick);
}
+ if (NULL != nick)
+ GNUNET_free (nick);
if (0 == res_count)
{
if (NULL != nc)
send_store_response (nc, GNUNET_OK, rid);
+ if (rd != res)
+ GNUNET_free (res);
return; /* no data, no need to update cache */
}
if (GNUNET_YES == disable_namecache)
@@ -936,6 +944,8 @@ refresh_block (struct NamestoreClient *nc,
GNUNET_NO);
if (NULL != nc)
send_store_response (nc, GNUNET_OK, rid);
+ if (rd != res)
+ GNUNET_free (res);
return;
}
exp_time = GNUNET_GNSRECORD_record_get_expiration_time (res_count, res);
@@ -970,6 +980,8 @@ refresh_block (struct NamestoreClient *nc,
&finish_cache_operation,
cop);
GNUNET_free (block);
+ if (rd != res)
+ GNUNET_free (res);
}
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c
index c845b5019..2d5327e06 100644
--- a/src/namestore/namestore_api.c
+++ b/src/namestore/namestore_api.c
@@ -690,6 +690,12 @@ handle_zone_to_name_response (void *cls,
LOG (GNUNET_ERROR_TYPE_DEBUG, "Received ZONE_TO_NAME_RESPONSE\n");
qe = find_qe (h, ntohl (msg->gns_header.r_id));
+ if (NULL == qe)
+ {
+ LOG (GNUNET_ERROR_TYPE_WARNING,
+ "Response queue already gone...\n");
+ return;
+ }
res = ntohs (msg->res);
switch (res)
{
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c
index edcbeb874..ae93e5eff 100644
--- a/src/namestore/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
@@ -375,6 +375,8 @@ get_egoentry_namestore (struct RequestHandle *handle, char *name)
if (NULL == name)
return NULL;
tmp = strtok (copy, "/");
+ if (NULL == tmp)
+ return NULL;
for (ego_entry = ego_head; NULL != ego_entry;
ego_entry = ego_entry->next)
{
diff --git a/src/peerinfo-tool/plugin_rest_peerinfo.c b/src/peerinfo-tool/plugin_rest_peerinfo.c
index 4bbc7442e..f969a175b 100644
--- a/src/peerinfo-tool/plugin_rest_peerinfo.c
+++ b/src/peerinfo-tool/plugin_rest_peerinfo.c
@@ -379,7 +379,9 @@ peerinfo_list_finished (void *cls)
result_str = json_dumps (handle->response, 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"));
handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
GNUNET_free (result_str);
GNUNET_SCHEDULER_add_now (&cleanup_handle, handle);
diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c
index db5aee0d5..196d44faa 100644
--- a/src/peerstore/peerstore_api.c
+++ b/src/peerstore/peerstore_api.c
@@ -823,7 +823,12 @@ reconnect (void *cls)
&handle_client_error,
h);
if (NULL == h->mq)
+ {
+ h->reconnect_task =
+ GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h);
+ h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay);
return;
+ }
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Resending pending requests after reconnect.\n");
if (NULL != h->watches)
diff --git a/src/peerstore/test_peerstore_api_sync.c b/src/peerstore/test_peerstore_api_sync.c
index 4c826c654..5057c98b5 100644
--- a/src/peerstore/test_peerstore_api_sync.c
+++ b/src/peerstore/test_peerstore_api_sync.c
@@ -67,6 +67,24 @@ static const char *val = "test_peerstore_api_store_val";
/**
+ * Timeout
+ */
+#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10)
+
+/**
+ * Timeout task
+ */
+static struct GNUNET_SCHEDULER_Task *to;
+
+/**
+ * Iterate handle
+ */
+static struct GNUNET_PEERSTORE_IterateContext *it;
+
+static void
+test_cont (void *cls);
+
+/**
* Function that should be called with the result of the
* lookup, and finally once with NULL to signal the end
* of the iteration.
@@ -89,9 +107,24 @@ iterate_cb (void *cls,
GNUNET_break (NULL == emsg);
if (NULL == record)
{
- GNUNET_PEERSTORE_disconnect (h,
- GNUNET_NO);
- GNUNET_SCHEDULER_shutdown ();
+ it = NULL;
+ if (0 == ok)
+ {
+ GNUNET_PEERSTORE_disconnect (h,
+ GNUNET_NO);
+ if (NULL != to)
+ {
+ GNUNET_SCHEDULER_cancel (to);
+ to = NULL;
+ }
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+ }
+ /**
+ * Try again
+ */
+ GNUNET_SCHEDULER_add_now (&test_cont,
+ NULL);
return;
}
rec_val = record->value;
@@ -100,6 +133,22 @@ iterate_cb (void *cls,
}
+static void
+timeout_task (void *cls)
+{
+ to = NULL;
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Timeout reached\n");
+ if (NULL != it)
+ GNUNET_PEERSTORE_iterate_cancel (it);
+ it = NULL;
+ GNUNET_PEERSTORE_disconnect (h,
+ GNUNET_NO);
+ GNUNET_SCHEDULER_shutdown ();
+ return;
+}
+
+
/**
* Run the 2nd stage of the test where we fetch the
* data that should have been stored.
@@ -109,12 +158,11 @@ iterate_cb (void *cls,
static void
test_cont (void *cls)
{
- h = GNUNET_PEERSTORE_connect (cfg);
- GNUNET_PEERSTORE_iterate (h,
- subsystem,
- &pid, key,
- &iterate_cb,
- NULL);
+ it = GNUNET_PEERSTORE_iterate (h,
+ subsystem,
+ &pid, key,
+ &iterate_cb,
+ NULL);
}
@@ -122,10 +170,9 @@ static void
disc_cont (void *cls)
{
GNUNET_PEERSTORE_disconnect (h, GNUNET_YES);
- h = NULL;
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
- &test_cont,
- NULL);
+ h = GNUNET_PEERSTORE_connect (cfg);
+ GNUNET_SCHEDULER_add_now (&test_cont,
+ NULL);
}
@@ -133,12 +180,17 @@ static void
store_cont (void *cls, int success)
{
ok = success;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Success: %s\n",
+ (GNUNET_SYSERR == ok) ? "no" : "yes");
/* We need to wait a little bit to give the disconnect
a chance to actually finish the operation; otherwise,
the test may fail non-deterministically if the new
connection is faster than the cleanup routine of the
- old one. */GNUNET_SCHEDULER_add_now (&disc_cont,
- NULL);
+ old one. */
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
+ &disc_cont,
+ NULL);
}
@@ -174,7 +226,10 @@ run (void *cls,
{
cfg = c;
memset (&pid, 1, sizeof(pid));
- test1 ();
+ to = GNUNET_SCHEDULER_add_delayed (TIMEOUT,
+ &timeout_task,
+ NULL);
+ GNUNET_SCHEDULER_add_now (&test1, NULL);
}
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c
index 913b667b7..04c12735b 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -731,9 +731,12 @@ static int
check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im)
{
uint16_t size;
+ size_t attrs_len;
size = ntohs (im->header.size);
- if (size <= sizeof(struct IssueTicketMessage))
+ attrs_len = ntohs (im->attr_len);
+
+ if (attrs_len > size - sizeof(struct IssueTicketMessage))
{
GNUNET_break (0);
return GNUNET_SYSERR;
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c b/src/reclaim/gnunet-service-reclaim_tickets.c
index ef2303bd7..48b3fe214 100644
--- a/src/reclaim/gnunet-service-reclaim_tickets.c
+++ b/src/reclaim/gnunet-service-reclaim_tickets.c
@@ -690,7 +690,10 @@ rvk_move_attr_cb (void *cls,
return;
}
GNUNET_RECLAIM_id_generate (&rvk->move_attr->new_id);
- new_label = NULL;
+ new_label =
+ GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id,
+ sizeof (rvk->move_attr->new_id));
+
attr_data = NULL;
// new_rd = *rd;
for (int i = 0; i < rd_count; i++)
@@ -714,9 +717,6 @@ rvk_move_attr_cb (void *cls,
new_rd[i].record_type = rd[i].record_type;
new_rd[i].flags = rd[i].flags;
new_rd[i].expiration_time = rd[i].expiration_time;
- new_label =
- GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id,
- sizeof (rvk->move_attr->new_id));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label);
GNUNET_free (claim);
}
@@ -738,9 +738,6 @@ rvk_move_attr_cb (void *cls,
new_rd[i].record_type = rd[i].record_type;
new_rd[i].flags = rd[i].flags;
new_rd[i].expiration_time = rd[i].expiration_time;
- new_label =
- GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id,
- sizeof (rvk->move_attr->new_id));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding credential %s\n",
new_label);
GNUNET_free (credential);
@@ -1400,7 +1397,7 @@ issue_ticket (struct TicketIssueHandle *ih)
attrs_record,
&store_ticket_issue_cont,
ih);
- for (j = 0; j > i; j++)
+ for (j = 0; j < i; j++)
{
if (attrs_record[j].record_type
!= GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION)
@@ -1585,7 +1582,7 @@ filter_tickets_cb (void *cls,
cleanup_issue_handle (tih);
return;
}
-
+ GNUNET_RECLAIM_presentation_list_destroy (ticket_presentations);
// ticket not found in current record, checking next record set
GNUNET_NAMESTORE_zone_iterator_next (tih->ns_it, 1);
}
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c
index bd3a8ee05..7b24ee598 100644
--- a/src/reclaim/oidc_helper.c
+++ b/src/reclaim/oidc_helper.c
@@ -839,11 +839,17 @@ int
OIDC_access_token_parse (const char *token,
struct GNUNET_RECLAIM_Ticket **ticket)
{
- if (sizeof (struct GNUNET_RECLAIM_Ticket) !=
- GNUNET_STRINGS_base64_decode (token,
- strlen (token),
- (void**) ticket))
+ size_t sret;
+ char *decoded;
+ sret = GNUNET_STRINGS_base64_decode (token,
+ strlen (token),
+ (void**) &decoded);
+ if (sizeof (struct GNUNET_RECLAIM_Ticket) != sret)
+ {
+ GNUNET_free (decoded);
return GNUNET_SYSERR;
+ }
+ *ticket = (struct GNUNET_RECLAIM_Ticket *) decoded;
return GNUNET_OK;
}
diff --git a/src/reclaim/plugin_rest_openid_connect.c b/src/reclaim/plugin_rest_openid_connect.c
index 0ee61755b..c6259d745 100644
--- a/src/reclaim/plugin_rest_openid_connect.c
+++ b/src/reclaim/plugin_rest_openid_connect.c
@@ -686,7 +686,10 @@ do_userinfo_error (void *cls)
handle->emsg,
(NULL != handle->edesc) ? handle->edesc : "");
resp = GNUNET_REST_create_response ("");
- MHD_add_response_header (resp, MHD_HTTP_HEADER_WWW_AUTHENTICATE, "Bearer");
+ GNUNET_assert (MHD_NO !=
+ MHD_add_response_header (resp,
+ MHD_HTTP_HEADER_WWW_AUTHENTICATE,
+ "Bearer"));
handle->proc (handle->proc_cls, resp, handle->response_code);
cleanup_handle (handle);
GNUNET_free (error);
@@ -713,7 +716,8 @@ do_redirect_error (void *cls)
(NULL != handle->oidc->state) ? "&state=" : "",
(NULL != handle->oidc->state) ? handle->oidc->state : "");
resp = GNUNET_REST_create_response ("");
- MHD_add_response_header (resp, "Location", redirect);
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Location", redirect));
handle->proc (handle->proc_cls, resp, MHD_HTTP_FOUND);
cleanup_handle (handle);
GNUNET_free (redirect);
@@ -1022,7 +1026,8 @@ oidc_ticket_issue_cb (void *cls,
handle->oidc->state);
}
resp = GNUNET_REST_create_response ("");
- MHD_add_response_header (resp, "Location", redirect_uri);
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Location", redirect_uri));
handle->proc (handle->proc_cls, resp, MHD_HTTP_FOUND);
cleanup_handle (handle);
GNUNET_free (redirect_uri);
@@ -1381,7 +1386,8 @@ build_redirect (void *cls)
handle->oidc->state);
}
resp = GNUNET_REST_create_response ("");
- MHD_add_response_header (resp, "Location", redirect_uri);
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Location", redirect_uri));
handle->proc (handle->proc_cls, resp, MHD_HTTP_FOUND);
cleanup_handle (handle);
GNUNET_free (redirect_uri);
@@ -1764,8 +1770,12 @@ login_cont (struct GNUNET_REST_RequestHandle *con_handle,
"%s;Max-Age=%d",
cookie,
OIDC_COOKIE_EXPIRATION);
- MHD_add_response_header (resp, "Set-Cookie", header_val);
- MHD_add_response_header (resp, "Access-Control-Allow-Methods", "POST");
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Set-Cookie", header_val));
+ GNUNET_assert (MHD_NO !=
+ MHD_add_response_header (resp,
+ "Access-Control-Allow-Methods",
+ "POST"));
GNUNET_CRYPTO_hash (cookie, strlen (cookie), &cache_key);
if (0 != strcmp (json_string_value (identity), "Denied"))
@@ -1880,7 +1890,8 @@ parse_credentials_post_body (struct RequestHandle *handle,
}
pass = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map,
&cache_key);
- if (NULL == pass) {
+ if (NULL == pass)
+ {
GNUNET_free (*client_id);
*client_id = NULL;
return GNUNET_SYSERR;
@@ -2134,6 +2145,8 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
GNUNET_free (code);
if (NULL != nonce)
GNUNET_free (nonce);
+ GNUNET_RECLAIM_attribute_list_destroy (cl);
+ GNUNET_RECLAIM_presentation_list_destroy (pl);
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
@@ -2149,6 +2162,8 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
handle->edesc = GNUNET_strdup ("No signing secret configured!");
handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
GNUNET_free (code);
+ GNUNET_RECLAIM_attribute_list_destroy (cl);
+ GNUNET_RECLAIM_presentation_list_destroy (pl);
if (NULL != nonce)
GNUNET_free (nonce);
GNUNET_SCHEDULER_add_now (&do_error, handle);
@@ -2191,9 +2206,14 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
&json_response);
resp = GNUNET_REST_create_response (json_response);
- MHD_add_response_header (resp, "Cache-Control", "no-store");
- MHD_add_response_header (resp, "Pragma", "no-cache");
- MHD_add_response_header (resp, "Content-Type", "application/json");
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Cache-Control",
+ "no-store"));
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Pragma", "no-cache"));
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Content-Type",
+ "application/json"));
handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
GNUNET_RECLAIM_attribute_list_destroy (cl);
GNUNET_RECLAIM_presentation_list_destroy (pl);
@@ -2665,8 +2685,14 @@ oidc_config_cors (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);
- MHD_add_response_header (resp, "Access-Control-Allow-Origin", "*");
+ GNUNET_assert (MHD_NO !=
+ MHD_add_response_header (resp,
+ "Access-Control-Allow-Methods",
+ allow_methods));
+ GNUNET_assert (MHD_NO !=
+ MHD_add_response_header (resp,
+ "Access-Control-Allow-Origin",
+ "*"));
handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
cleanup_handle (handle);
return;
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c
index 84456b386..39d24ea61 100644
--- a/src/reclaim/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -353,14 +353,18 @@ finished_cont (void *cls, int32_t success, const char *emsg)
struct MHD_Response *resp;
handle->idp_op = NULL;
- resp = GNUNET_REST_create_response (emsg);
- MHD_add_response_header (resp, "Content-Type", "application/json");
- MHD_add_response_header (resp, "Access-Control-Allow-Methods", allow_methods);
if (GNUNET_OK != success)
{
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
+ resp = GNUNET_REST_create_response (emsg);
+ GNUNET_assert (MHD_NO != MHD_add_response_header (resp,
+ "Content-Type",
+ "application/json"));
+ 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);
}
@@ -372,13 +376,15 @@ delete_finished_cb (void *cls, int32_t success, const char *emsg)
struct RequestHandle *handle = cls;
struct MHD_Response *resp;
- resp = GNUNET_REST_create_response (emsg);
- MHD_add_response_header (resp, "Access-Control-Allow-Methods", allow_methods);
if (GNUNET_OK != success)
{
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
+ resp = GNUNET_REST_create_response (emsg);
+ 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);
}
@@ -399,7 +405,10 @@ return_response (void *cls)
result_str = json_dumps (handle->resp_object, 0);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
resp = GNUNET_REST_create_response (result_str);
- 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_free (result_str);
cleanup_handle (handle);
@@ -461,8 +470,8 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
static void
add_credential_cont (struct GNUNET_REST_RequestHandle *con_handle,
- const char *url,
- void *cls)
+ const char *url,
+ void *cls)
{
struct RequestHandle *handle = cls;
const struct GNUNET_IDENTITY_PrivateKey *identity_priv;
@@ -513,7 +522,15 @@ add_credential_cont (struct GNUNET_REST_RequestHandle *con_handle,
handle->rest_handle->data,
handle->rest_handle->data_size);
data_json = json_loads (term_data, JSON_DECODE_ANY, &err);
- GNUNET_JSON_parse (data_json, attrspec, NULL, NULL);
+ if (GNUNET_OK != GNUNET_JSON_parse (data_json, attrspec, NULL, NULL))
+ {
+ json_decref (data_json);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unable to parse JSON from %s\n",
+ term_data);
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
+ return;
+ }
json_decref (data_json);
if (NULL == attribute)
{
@@ -530,11 +547,11 @@ add_credential_cont (struct GNUNET_REST_RequestHandle *con_handle,
GNUNET_RECLAIM_id_generate (&attribute->id);
exp = GNUNET_TIME_UNIT_HOURS;
handle->idp_op = GNUNET_RECLAIM_credential_store (idp,
- identity_priv,
- attribute,
- &exp,
- &finished_cont,
- handle);
+ identity_priv,
+ attribute,
+ &exp,
+ &finished_cont,
+ handle);
GNUNET_JSON_parse_free (attrspec);
}
@@ -545,8 +562,8 @@ add_credential_cont (struct GNUNET_REST_RequestHandle *con_handle,
*/
static void
cred_collect (void *cls,
- const struct GNUNET_IDENTITY_PublicKey *identity,
- const struct GNUNET_RECLAIM_Credential *cred)
+ const struct GNUNET_IDENTITY_PublicKey *identity,
+ const struct GNUNET_RECLAIM_Credential *cred)
{
struct RequestHandle *handle = cls;
struct GNUNET_RECLAIM_AttributeList *attrs;
@@ -565,8 +582,8 @@ cred_collect (void *cls,
attrs = GNUNET_RECLAIM_credential_get_attributes (cred);
issuer = GNUNET_RECLAIM_credential_get_issuer (cred);
tmp_value = GNUNET_RECLAIM_credential_value_to_string (cred->type,
- cred->data,
- cred->data_size);
+ cred->data,
+ cred->data_size);
cred_obj = json_object ();
json_object_set_new (cred_obj, "value", json_string (tmp_value));
json_object_set_new (cred_obj, "name", json_string (cred->name));
@@ -578,7 +595,7 @@ cred_collect (void *cls,
GNUNET_free (issuer);
}
if (GNUNET_OK == GNUNET_RECLAIM_credential_get_expiration (cred,
- &exp))
+ &exp))
{
json_object_set_new (cred_obj, "expiration", json_integer (
exp.abs_value_us));
@@ -613,7 +630,8 @@ cred_collect (void *cls,
json_object_set_new (cred_obj, "attributes", attr_arr);
}
json_array_append_new (handle->resp_object, cred_obj);
- GNUNET_RECLAIM_attribute_list_destroy (attrs);
+ if (NULL != attrs)
+ GNUNET_RECLAIM_attribute_list_destroy (attrs);
GNUNET_RECLAIM_get_credentials_next (handle->cred_it);
}
@@ -627,8 +645,8 @@ cred_collect (void *cls,
*/
static void
list_credential_cont (struct GNUNET_REST_RequestHandle *con_handle,
- const char *url,
- void *cls)
+ const char *url,
+ void *cls)
{
struct RequestHandle *handle = cls;
const struct GNUNET_IDENTITY_PrivateKey *priv_key;
@@ -664,14 +682,14 @@ list_credential_cont (struct GNUNET_REST_RequestHandle *con_handle,
}
priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
handle->cred_it = GNUNET_RECLAIM_get_credentials_start (idp,
- priv_key,
- &collect_error_cb,
- handle,
- &cred_collect,
- handle,
- &
- collect_finished_cb,
- handle);
+ priv_key,
+ &collect_error_cb,
+ handle,
+ &cred_collect,
+ handle,
+ &
+ collect_finished_cb,
+ handle);
}
@@ -684,8 +702,8 @@ list_credential_cont (struct GNUNET_REST_RequestHandle *con_handle,
*/
static void
delete_credential_cont (struct GNUNET_REST_RequestHandle *con_handle,
- const char *url,
- void *cls)
+ const char *url,
+ void *cls)
{
struct RequestHandle *handle = cls;
const struct GNUNET_IDENTITY_PrivateKey *priv_key;
@@ -734,10 +752,10 @@ delete_credential_cont (struct GNUNET_REST_RequestHandle *con_handle,
GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id));
attr.name = "";
handle->idp_op = GNUNET_RECLAIM_credential_delete (idp,
- priv_key,
- &attr,
- &delete_finished_cb,
- handle);
+ priv_key,
+ &attr,
+ &delete_finished_cb,
+ handle);
GNUNET_free (identity_id_str);
}
@@ -900,8 +918,8 @@ parse_jwt (const struct GNUNET_RECLAIM_Credential *cred,
json_error_t *json_err = NULL;
jwt_string = GNUNET_RECLAIM_credential_value_to_string (cred->type,
- cred->data,
- cred->data_size);
+ cred->data,
+ cred->data_size);
char *jwt_body = strtok (jwt_string, delim);
jwt_body = strtok (NULL, delim);
GNUNET_STRINGS_base64_decode (jwt_body, strlen (jwt_body),
@@ -1424,25 +1442,24 @@ rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle,
static const struct GNUNET_REST_RequestHandler handlers[] =
{ { MHD_HTTP_METHOD_GET,
GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &list_attribute_cont },
- { MHD_HTTP_METHOD_POST,
- GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &add_attribute_cont },
- { MHD_HTTP_METHOD_DELETE,
- GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &delete_attribute_cont },
- { MHD_HTTP_METHOD_GET,
- GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &list_credential_cont },
- { MHD_HTTP_METHOD_POST,
- GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &add_credential_cont },
- { MHD_HTTP_METHOD_DELETE,
- GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &delete_credential_cont },
- { MHD_HTTP_METHOD_GET,
- GNUNET_REST_API_NS_IDENTITY_TICKETS, &list_tickets_cont },
- { MHD_HTTP_METHOD_POST,
- GNUNET_REST_API_NS_IDENTITY_REVOKE, &revoke_ticket_cont },
- { MHD_HTTP_METHOD_POST,
- GNUNET_REST_API_NS_IDENTITY_CONSUME, &consume_ticket_cont },
- { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_RECLAIM, &options_cont },
- GNUNET_REST_HANDLER_END
- };
+ { MHD_HTTP_METHOD_POST,
+ GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &add_attribute_cont },
+ { MHD_HTTP_METHOD_DELETE,
+ GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &delete_attribute_cont },
+ { MHD_HTTP_METHOD_GET,
+ GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &list_credential_cont },
+ { MHD_HTTP_METHOD_POST,
+ GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &add_credential_cont },
+ { MHD_HTTP_METHOD_DELETE,
+ GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &delete_credential_cont },
+ { MHD_HTTP_METHOD_GET,
+ GNUNET_REST_API_NS_IDENTITY_TICKETS, &list_tickets_cont },
+ { MHD_HTTP_METHOD_POST,
+ GNUNET_REST_API_NS_IDENTITY_REVOKE, &revoke_ticket_cont },
+ { MHD_HTTP_METHOD_POST,
+ GNUNET_REST_API_NS_IDENTITY_CONSUME, &consume_ticket_cont },
+ { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_RECLAIM, &options_cont },
+ GNUNET_REST_HANDLER_END};
handle->response_code = 0;
handle->timeout = GNUNET_TIME_UNIT_FOREVER_REL;
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c
index f4f2b946a..c08cc868c 100644
--- a/src/reclaim/reclaim_api.c
+++ b/src/reclaim/reclaim_api.c
@@ -651,18 +651,15 @@ handle_consume_ticket_result (void *cls,
le->attribute, NULL);
}
}
- if (NULL != attrs)
- GNUNET_RECLAIM_attribute_list_destroy (attrs);
- if (NULL != pl)
- GNUNET_RECLAIM_presentation_list_destroy (pl);
- attrs = NULL;
- pl = NULL;
}
op->atr_cb (op->cls, NULL, NULL, NULL);
}
+ if (NULL != attrs)
+ GNUNET_RECLAIM_attribute_list_destroy (attrs);
+ if (NULL != pl)
+ GNUNET_RECLAIM_presentation_list_destroy (pl);
GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op);
free_op (op);
- GNUNET_free (attrs);
return;
}
GNUNET_assert (0);
@@ -804,7 +801,7 @@ check_credential_result (void *cls, const struct CredentialResultMessage *msg)
*/
static void
handle_credential_result (void *cls, const struct
- CredentialResultMessage *msg)
+ CredentialResultMessage *msg)
{
static struct GNUNET_IDENTITY_PrivateKey identity_dummy;
struct GNUNET_RECLAIM_Handle *h = cls;
@@ -871,6 +868,7 @@ handle_credential_result (void *cls, const struct
GNUNET_assert (0);
}
+
/**
* Handle an incoming message of type
* #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
@@ -925,7 +923,7 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg)
if (NULL != op)
{
if (0 < pres_len)
- pres = GNUNET_RECLAIM_presentation_list_deserialize ((char*)&msg[1],
+ pres = GNUNET_RECLAIM_presentation_list_deserialize ((char*) &msg[1],
pres_len);
GNUNET_CONTAINER_DLL_remove (handle->op_head, handle->op_tail, op);
if (0 ==
@@ -1485,7 +1483,7 @@ GNUNET_RECLAIM_get_credentials_start (
*/
void
GNUNET_RECLAIM_get_credentials_next (struct
- GNUNET_RECLAIM_CredentialIterator *ait)
+ GNUNET_RECLAIM_CredentialIterator *ait)
{
struct GNUNET_RECLAIM_Handle *h = ait->h;
struct CredentialIterationNextMessage *msg;
@@ -1507,7 +1505,7 @@ GNUNET_RECLAIM_get_credentials_next (struct
*/
void
GNUNET_RECLAIM_get_credentials_stop (struct
- GNUNET_RECLAIM_CredentialIterator *ait)
+ GNUNET_RECLAIM_CredentialIterator *ait)
{
struct GNUNET_RECLAIM_Handle *h = ait->h;
struct GNUNET_MQ_Envelope *env;
diff --git a/src/rest/plugin_rest_copying.c b/src/rest/plugin_rest_copying.c
index 6d074d3d1..52783a81a 100644
--- a/src/rest/plugin_rest_copying.c
+++ b/src/rest/plugin_rest_copying.c
@@ -138,9 +138,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);
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c
index b5737158b..99fecdd35 100644
--- a/src/revocation/gnunet-revocation.c
+++ b/src/revocation/gnunet-revocation.c
@@ -307,17 +307,9 @@ calculate_pow (void *cls)
return;
}
pow_passes++;
- /**
- * Otherwise CTRL-C does not work
- */
- if (0 == pow_passes % 128)
- pow_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
- &calculate_pow,
- ph);
- else
- pow_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
- &calculate_pow,
- ph);
+ pow_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS,
+ &calculate_pow,
+ ph);
}
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c
index 863289aae..6f70720ba 100644
--- a/src/revocation/gnunet-service-revocation.c
+++ b/src/revocation/gnunet-service-revocation.c
@@ -306,12 +306,19 @@ publicize_rm (const struct RevokeMessage *rm)
struct RevokeMessage *cp;
struct GNUNET_HashCode hc;
struct GNUNET_SETU_Element e;
+ ssize_t pklen;
const struct GNUNET_IDENTITY_PublicKey *pk;
struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1];
pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
+ pklen = GNUNET_IDENTITY_key_get_length (pk);
+ if (0 > pklen)
+ {
+ GNUNET_break_op (0);
+ return GNUNET_SYSERR;
+ }
GNUNET_CRYPTO_hash (pk,
- GNUNET_IDENTITY_key_get_length (pk),
+ pklen,
&hc);
if (GNUNET_YES ==
GNUNET_CONTAINER_multihashmap_contains (revocation_map,
@@ -384,7 +391,8 @@ check_revoke_message (void *cls,
uint16_t size;
size = ntohs (rm->header.size);
- if (size <= sizeof(struct RevokeMessage))
+ if (size <= sizeof(struct RevokeMessage) ||
+ (size > UINT16_MAX))
{
GNUNET_break (0);
return GNUNET_SYSERR;
diff --git a/src/revocation/plugin_block_revocation.c b/src/revocation/plugin_block_revocation.c
index 3c9344a49..1928d09cd 100644
--- a/src/revocation/plugin_block_revocation.c
+++ b/src/revocation/plugin_block_revocation.c
@@ -134,6 +134,7 @@ block_plugin_revocation_evaluate (void *cls,
{
struct InternalContext *ic = cls;
struct GNUNET_HashCode chash;
+ ssize_t pklen;
const struct RevokeMessage *rm = reply_block;
if (NULL == reply_block)
@@ -153,8 +154,14 @@ block_plugin_revocation_evaluate (void *cls,
GNUNET_break_op (0);
return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
}
+ pklen = GNUNET_IDENTITY_key_get_length (pk);
+ if (0 > pklen)
+ {
+ GNUNET_break_op (0);
+ return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
+ }
GNUNET_CRYPTO_hash (pk,
- GNUNET_IDENTITY_key_get_length (pk),
+ pklen,
&chash);
if (GNUNET_YES ==
GNUNET_BLOCK_GROUP_bf_test_and_set (group,
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c
index 5cf191847..e2f871c23 100644
--- a/src/revocation/revocation_api.c
+++ b/src/revocation/revocation_api.c
@@ -492,6 +492,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
unsigned int tmp_score = 0;
unsigned int epochs;
uint64_t pow_val;
+ ssize_t pklen;
const struct GNUNET_IDENTITY_PublicKey *pk;
pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1];
@@ -517,9 +518,15 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow,
GNUNET_memcpy (&buf[sizeof(uint64_t)],
&pow->timestamp,
sizeof (uint64_t));
+ pklen = GNUNET_IDENTITY_key_get_length (pk);
+ if (0 > pklen)
+ {
+ GNUNET_break (0);
+ return GNUNET_NO;
+ }
GNUNET_memcpy (&buf[sizeof(uint64_t) * 2],
pk,
- GNUNET_IDENTITY_key_get_length (pk));
+ pklen);
for (unsigned int i = 0; i < POW_COUNT; i++)
{
pow_val = GNUNET_ntohll (pow->pow[i]);
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c
index 82aeffb79..908dcca17 100644
--- a/src/rps/gnunet-rps-profiler.c
+++ b/src/rps/gnunet-rps-profiler.c
@@ -3067,9 +3067,10 @@ run (void *cls,
}
else
{
- duration = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
- (timeout.rel_value_us / 1000000)
- * 0.75);
+ duration = GNUNET_TIME_relative_multiply (
+ GNUNET_TIME_UNIT_SECONDS,
+ ( (double) timeout.rel_value_us / (double) 1000000)
+ * 0.75);
}
}
else
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index dc4c5dab7..56eab288e 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -965,8 +965,6 @@ remove_channel_ctx (struct ChannelCtx *channel_ctx)
channel_ctx->destruction_task = NULL;
}
- GNUNET_free (channel_ctx);
-
if (NULL == peer_ctx)
return;
if (channel_ctx == peer_ctx->send_channel_ctx)
@@ -978,6 +976,7 @@ remove_channel_ctx (struct ChannelCtx *channel_ctx)
{
peer_ctx->recv_channel_ctx = NULL;
}
+ GNUNET_free (channel_ctx);
}
@@ -2637,7 +2636,7 @@ insert_in_sampler (void *cls,
}
#ifdef TO_FILE
sub->num_observed_peers++;
- GNUNET_CONTAINER_multipeermap_put
+ (void) GNUNET_CONTAINER_multipeermap_put
(sub->observed_unique_peers,
peer,
NULL,
@@ -2802,7 +2801,7 @@ clean_peer (struct Sub *sub,
peer))) &&
(GNUNET_NO == View_contains_peer (sub->view, peer)) &&
(GNUNET_NO == CustomPeerMap_contains_peer (sub->push_map, peer)) &&
- (GNUNET_NO == CustomPeerMap_contains_peer (sub->push_map, peer)) &&
+ (GNUNET_NO == CustomPeerMap_contains_peer (sub->pull_map, peer)) &&
(0 == RPS_sampler_count_id (sub->sampler, peer)) &&
(GNUNET_YES == check_removable (get_peer_ctx (sub->peer_map, peer))))
{ /* We can safely remove this peer */
@@ -2836,13 +2835,20 @@ cleanup_destroyed_channel (void *cls,
(void) channel;
channel_ctx->channel = NULL;
- remove_channel_ctx (channel_ctx);
if ((NULL != peer_ctx) &&
(peer_ctx->send_channel_ctx == channel_ctx) &&
- (GNUNET_YES == check_sending_channel_needed (channel_ctx->peer_ctx)) )
+ (GNUNET_YES == check_sending_channel_needed (peer_ctx)) )
{
+ remove_channel_ctx (channel_ctx);
remove_peer (peer_ctx->sub, &peer_ctx->peer_id);
}
+ else
+ {
+ /* We need this if-else construct because we need to make sure the channel
+ * (context) is cleaned up before removing the peer, but still neet to
+ * compare it while checking the condition */
+ remove_channel_ctx (channel_ctx);
+ }
}
diff --git a/src/rps/gnunet-service-rps_custommap.c b/src/rps/gnunet-service-rps_custommap.c
index 54e361d32..392c29397 100644
--- a/src/rps/gnunet-service-rps_custommap.c
+++ b/src/rps/gnunet-service-rps_custommap.c
@@ -206,6 +206,7 @@ CustomPeerMap_remove_peer (const struct CustomPeerMap *c_peer_map,
struct GNUNET_PeerIdentity *p;
uint32_t *last_index;
struct GNUNET_PeerIdentity *last_p;
+ int ret;
if (GNUNET_NO == CustomPeerMap_contains_peer (c_peer_map,
peer))
@@ -234,9 +235,11 @@ CustomPeerMap_remove_peer (const struct CustomPeerMap *c_peer_map,
last_p);
GNUNET_assert (NULL != last_index);
GNUNET_assert (CustomPeerMap_size (c_peer_map) == *last_index);
- GNUNET_CONTAINER_multihashmap32_put (c_peer_map->hash_map,
- *index, last_p,
- GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ ret = GNUNET_CONTAINER_multihashmap32_put (c_peer_map->hash_map,
+ *index,
+ last_p,
+ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ GNUNET_assert (GNUNET_OK == ret);
GNUNET_CONTAINER_multihashmap32_remove_all (c_peer_map->hash_map,
*last_index);
*last_index = *index;
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c
index 497225973..6dee20c95 100644
--- a/src/rps/rps-test_util.c
+++ b/src/rps/rps-test_util.c
@@ -152,12 +152,16 @@ close_all_files ()
{
int ret;
- ret = GNUNET_CONTAINER_multihashmap_iterate (open_files,
- close_files_iter,
- NULL);
- GNUNET_CONTAINER_multihashmap_destroy (open_files);
- open_files = NULL;
- return ret;
+ if (NULL != open_files)
+ {
+ ret = GNUNET_CONTAINER_multihashmap_iterate (open_files,
+ close_files_iter,
+ NULL);
+ GNUNET_CONTAINER_multihashmap_destroy (open_files);
+ open_files = NULL;
+ return ret;
+ }
+ return GNUNET_YES;
}
diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am
index 7c1e217bb..7a59670cb 100644
--- a/src/testbed/Makefile.am
+++ b/src/testbed/Makefile.am
@@ -94,6 +94,9 @@ lib_LTLIBRARIES = \
libgnunettestbed_la_SOURCES = \
testbed_api.c testbed_api.h testbed.h \
testbed_api_hosts.c testbed_api_hosts.h testbed_helper.h \
+ testbed_api_cmd_controller.c \
+ testbed_api_cmd_peer.c \
+ testbed_api_cmd_service.c \
testbed_api_operations.c testbed_api_operations.h \
testbed_api_peers.c testbed_api_peers.h \
testbed_api_services.c \
diff --git a/src/testbed/testbed_api_cmd_controller.c b/src/testbed/testbed_api_cmd_controller.c
new file mode 100644
index 000000000..d65f41760
--- /dev/null
+++ b/src/testbed/testbed_api_cmd_controller.c
@@ -0,0 +1,294 @@
+/*
+ This file is part of GNUnet
+ Copyright (C) 2021 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+
+/**
+ * @file testbed/testbed_api_cmd_controller.c
+ * @brief Command to create a controller.
+ * @author t3sserakt
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_testing_ng_lib.h"
+#include "gnunet-service-testbed.h"
+#include "testbed_api_hosts.h"
+#include "gnunet_testbed_ng_service.h"
+
+
+/**
+ * Generic logging shortcut
+ */
+#define LOG(kind, ...) \
+ GNUNET_log (kind, __VA_ARGS__)
+
+
+/**
+ * abort task to run on test timed out
+ *
+ * @param cls NULL
+ * @param tc the task context
+ */
+static void
+do_abort (void *cls)
+{
+ struct ControllerState *cs = cls;
+
+ if (GNUNET_NO == cs->host_ready)
+ {
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
+ cs->abort_task = NULL;
+ GNUNET_TESTBED_shutdown_controller (cs);
+ }
+}
+
+
+/**
+*
+*
+* @param cls closure
+* @param cmd current CMD being cleaned up.
+*/
+static void
+controller_cleanup (void *cls,
+ const struct GNUNET_TESTING_Command *cmd)
+{
+ (void) cls;
+}
+
+
+/**
+ * Signature of the event handler function called by the
+ * respective event controller.
+ *
+ * @param cls closure
+ * @param event information about the event
+ */
+static void
+controller_cb (void *cls,
+ const struct GNUNET_TESTBED_EventInformation *event)
+{
+ struct ControllerState *cs = cls;
+
+ if (NULL != event->details.operation_finished.emsg)
+ {
+ LOG (GNUNET_ERROR_TYPE_ERROR, "There was an operation error: %s\n",
+ event->details.operation_finished.emsg);
+ GNUNET_TESTBED_shutdown_controller (cs);
+ }
+ else if (NULL == event->details.operation_finished.generic)
+ {
+ GNUNET_TESTBED_operation_done (event->op);
+ }
+}
+
+
+/**
+ * Callback which will be called to after a host registration succeeded or failed
+ *
+ * @param cls the host which has been registered
+ * @param emsg the error message; NULL if host registration is successful
+ */
+static void
+registration_comp (void *cls,
+ const char *emsg)
+{
+ struct ControllerState *cs = cls;
+
+ if (NULL != emsg)
+ {
+ LOG (GNUNET_ERROR_TYPE_ERROR,
+ "There was an error during host registration: %s\n",
+ emsg);
+ GNUNET_TESTBED_shutdown_controller (cs);
+ }
+ else
+ {
+ cs->reg_handle = NULL;
+ cs->host_ready = GNUNET_YES;
+ GNUNET_TESTING_interpreter_next (cs->is);
+ }
+}
+
+
+/**
+ * Callback to signal successfull startup of the controller process
+ *
+ * @param cls the closure from GNUNET_TESTBED_controller_start()
+ * @param cfg the configuration with which the controller has been started;
+ * NULL if status is not #GNUNET_OK
+ * @param status #GNUNET_OK if the startup is successfull; #GNUNET_SYSERR if not,
+ * GNUNET_TESTBED_controller_stop() shouldn't be called in this case
+ */
+static void
+controller_status_cb (void *cls,
+ const struct GNUNET_CONFIGURATION_Handle *cfg_,
+ int status)
+{
+ struct ControllerState *cs = cls;
+
+ if (GNUNET_OK != status)
+ {
+ cs->cp = NULL;
+ return;
+ }
+
+ cs->controller =
+ GNUNET_TESTBED_controller_connect (cs->host, cs->event_mask, &controller_cb,
+ cs);
+ cs->reg_handle =
+ GNUNET_TESTBED_register_host (cs->controller, cs->host, &registration_comp,
+ cs);
+}
+
+
+static void
+controller_run (void *cls,
+ const struct GNUNET_TESTING_Command *cmd,
+ struct GNUNET_TESTING_Interpreter *is)
+{
+ struct ControllerState *cs = cls;
+
+ cs->is = is;
+ cs->host = GNUNET_TESTBED_host_create (cs->hostname, cs->username, cs->cfg,
+ cs->port);
+ cs->cp = GNUNET_TESTBED_controller_start (cs->trusted_ip,
+ cs->host,
+ &controller_status_cb,
+ cs);
+ cs->abort_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_MINUTES, 5),
+ &do_abort,
+ cs);
+}
+
+/**
+*
+*
+* @param cls closure.
+* @param[out] ret result
+* @param trait name of the trait.
+* @param index index number of the object to offer.
+* @return #GNUNET_OK on success.
+*/
+static int
+controller_traits (void *cls,
+ const void **ret,
+ const char *trait,
+ unsigned int index)
+{
+ (void) cls;
+
+ struct ControllerState *cs = cls;
+
+
+ struct GNUNET_TESTING_Trait traits[] = {
+ {
+ .index = 0,
+ .trait_name = "controller",
+ .ptr = (const void *) cs->controller,
+ },
+ GNUNET_TESTING_trait_end ()
+ };
+
+ return GNUNET_TESTING_get_trait (traits,
+ ret,
+ trait,
+ index);
+ return GNUNET_OK;
+}
+
+
+/**
+ * Offer data from trait
+ *
+ * @param cmd command to extract the controller from.
+ * @param pt pointer to controller.
+ * @return #GNUNET_OK on success.
+ */
+int
+GNUNET_TESTBED_get_trait_controller (const struct GNUNET_TESTING_Command *cmd,
+ struct GNUNET_TESTBED_Controller **
+ controller)
+{
+ return cmd->traits (cmd->cls,
+ (const void **) controller,
+ "controller",
+ (unsigned int) 0);
+}
+
+
+/**
+ * Shutdown nicely
+ *
+ * @param cs controller state.
+ */
+void
+GNUNET_TESTBED_shutdown_controller (struct ControllerState *cs)
+{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Shutting down...\n");
+
+ cs->controller_going_down = GNUNET_YES;
+
+ if (NULL != cs->abort_task)
+ GNUNET_SCHEDULER_cancel (cs->abort_task);
+ if (NULL != cs->reg_handle)
+ GNUNET_TESTBED_cancel_registration (cs->reg_handle);
+ if (NULL != cs->controller)
+ GNUNET_TESTBED_controller_disconnect (cs->controller);
+ if (NULL != cs->cfg)
+ GNUNET_CONFIGURATION_destroy (cs->cfg);
+ if (NULL != cs->cp)
+ GNUNET_TESTBED_controller_stop (cs->cp);
+ if (NULL != cs->host)
+ GNUNET_TESTBED_host_destroy (cs->host);
+}
+
+
+
+struct GNUNET_TESTING_Command
+GNUNET_TESTBED_cmd_controller (const char *label,
+ const char *trusted_ip,
+ const char *hostname,
+ const char *username,
+ uint16_t port,
+ struct GNUNET_CONFIGURATION_Handle *cfg,
+ uint64_t event_mask)
+{
+ struct ControllerState *cs;
+
+ cs = GNUNET_new (struct ControllerState);
+ cs->event_mask = event_mask;
+ cs->trusted_ip = trusted_ip;
+ cs->hostname = hostname;
+ cs->username = username;
+ cs->port = port;
+ cs->cfg = cfg;
+
+ struct GNUNET_TESTING_Command cmd = {
+ .cls = cs,
+ .label = label,
+ .run = &controller_run,
+ .cleanup = &controller_cleanup,
+ .traits = &controller_traits
+ };
+
+ return cmd;
+}
diff --git a/src/testbed/testbed_api_cmd_peer.c b/src/testbed/testbed_api_cmd_peer.c
new file mode 100644
index 000000000..4a727bc94
--- /dev/null
+++ b/src/testbed/testbed_api_cmd_peer.c
@@ -0,0 +1,249 @@
+/*
+ This file is part of GNUnet
+ Copyright (C) 2021 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+
+
+/**
+ * @file testbed/testbed_api_cmd_controller.c
+ * @brief Command to create a controller.
+ * @author t3sserakt
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_testing_ng_lib.h"
+#include "gnunet_testbed_ng_service.h"
+#include "gnunet-service-testbed.h"
+#include "testbed_api_peers.h"
+
+
+/**
+ * Generic logging shortcut
+ */
+#define LOG(kind, ...) \
+ GNUNET_log (kind, __VA_ARGS__)
+
+
+/**
+*
+*
+* @param cls closure.
+* @param[out] ret result
+* @param trait name of the trait.
+* @param index index number of the object to offer.
+* @return #GNUNET_OK on success.
+*/
+static int
+peer_traits (void *cls,
+ const void **ret,
+ const char *trait,
+ unsigned int index)
+{
+ (void) cls;
+ return GNUNET_OK;
+}
+
+
+/**
+*
+*
+* @param cls closure
+* @param cmd current CMD being cleaned up.
+*/
+static void
+peer_cleanup (void *cls,
+ const struct GNUNET_TESTING_Command *cmd)
+{
+ (void) cls;
+}
+
+
+/**
+ * abort task to run on test timed out
+ *
+ * @param cls NULL
+ * @param tc the task context
+ */
+static void
+do_abort (void *cls)
+{
+ struct PeerCmdState *ps = cls;
+
+ if (GNUNET_NO == ps->peer_ready)
+ {
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
+ ps->abort_task = NULL;
+ GNUNET_TESTBED_shutdown_peer (ps);
+ }
+}
+
+
+/**
+ * Functions of this signature are called when a peer has been successfully
+ * created
+ *
+ * @param cls the closure from GNUNET_TESTBED_peer_create()
+ * @param emsg MAY contain an error description, if starting peer failed.
+ */
+static void
+peer_started_cb (void *cls,
+ const char *emsg)
+{
+ struct PeerCmdState *ps = cls;
+
+ GNUNET_TESTBED_operation_done (ps->operation);
+ if (NULL == emsg)
+ {
+ ps->peer_ready = GNUNET_YES;
+ GNUNET_TESTING_interpreter_next (ps->is);
+ }
+ else
+ {
+ LOG (GNUNET_ERROR_TYPE_ERROR, "There was an error starting a peer: %s\n",
+ emsg);
+ }
+
+}
+
+
+/**
+ * Functions of this signature are called when a peer has been successfully
+ * created
+ *
+ * @param cls the closure from GNUNET_TESTBED_peer_create()
+ * @param peer the handle for the created peer; NULL on any error during
+ * creation
+ * @param emsg NULL if peer is not NULL; else MAY contain the error description
+ */
+static void
+peer_create_cb (void *cls,
+ struct GNUNET_TESTBED_Peer *peer,
+ const char *emsg)
+{
+ struct PeerCmdState *ps = cls;
+
+ ps->peer = peer;
+ GNUNET_TESTBED_operation_done (ps->operation);
+ ps->operation = GNUNET_TESTBED_peer_start (NULL,
+ peer,
+ &peer_started_cb,
+ ps);
+}
+
+
+static void
+peer_run (void *cls,
+ const struct GNUNET_TESTING_Command *cmd,
+ struct GNUNET_TESTING_Interpreter *is)
+{
+ struct PeerCmdState *ps = cls;
+ const struct GNUNET_TESTING_Command *controller_cmd;
+ struct GNUNET_TESTBED_Controller *controller;
+
+ ps->is = is;
+ controller_cmd = GNUNET_TESTING_interpreter_lookup_command (
+ ps->controller_label);
+ GNUNET_TESTBED_get_trait_controller (controller_cmd,
+ &controller);
+ ps->host = GNUNET_TESTBED_host_create (ps->hostname, ps->username, ps->cfg,
+ ps->port);
+ ps->operation =
+ GNUNET_TESTBED_peer_create (controller,
+ ps->host,
+ ps->cfg,
+ &peer_create_cb,
+ ps);
+
+ ps->abort_task =
+ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply
+ (GNUNET_TIME_UNIT_MINUTES, 5),
+ &do_abort,
+ ps);
+}
+
+
+void
+peer_stopped_cb (void *cls,
+ const char *emsg)
+{
+ struct PeerCmdState *ps = cls;
+
+ if (NULL != emsg)
+ {
+ LOG (GNUNET_ERROR_TYPE_ERROR, "There was an error stopping a peer: %s\n",
+ emsg);
+ }
+ GNUNET_TESTBED_operation_done (ps->operation);
+ GNUNET_TESTBED_peer_destroy (ps->peer);
+}
+
+
+/**
+ * Shutdown nicely
+ *
+ * @param cs controller state.
+ */
+void
+GNUNET_TESTBED_shutdown_peer (struct PeerCmdState *ps)
+{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Shutting down...\n");
+
+ ps->peer_going_down = GNUNET_YES;
+
+ if (NULL != ps->abort_task)
+ GNUNET_SCHEDULER_cancel (ps->abort_task);
+ if (NULL != ps->cfg)
+ GNUNET_CONFIGURATION_destroy (ps->cfg);
+ if (NULL != ps->host)
+ GNUNET_TESTBED_host_destroy (ps->host);
+
+ GNUNET_TESTBED_operation_done (ps->operation);
+ ps->operation = GNUNET_TESTBED_peer_stop (NULL, ps->peer, peer_stopped_cb,
+ ps);
+
+}
+
+
+struct GNUNET_TESTING_Command
+GNUNET_TESTBED_cmd_peer (const char *label,
+ const char *controller_label,
+ const char *hostname,
+ const char *username,
+ uint16_t port,
+ struct GNUNET_CONFIGURATION_Handle *cfg)
+{
+ struct PeerCmdState *ps;
+
+ ps = GNUNET_new (struct PeerCmdState);
+ ps->hostname = hostname;
+ ps->username = username;
+ ps->port = port;
+ ps->cfg = cfg;
+ ps->controller_label = controller_label;
+
+ struct GNUNET_TESTING_Command cmd = {
+ .cls = ps,
+ .label = label,
+ .run = &peer_run,
+ .cleanup = &peer_cleanup,
+ .traits = &peer_traits
+ };
+
+ return cmd;
+}
diff --git a/src/testbed/testbed_api_cmd_service.c b/src/testbed/testbed_api_cmd_service.c
new file mode 100644
index 000000000..58b3309de
--- /dev/null
+++ b/src/testbed/testbed_api_cmd_service.c
@@ -0,0 +1,140 @@
+/*
+ This file is part of GNUnet
+ Copyright (C) 2021 GNUnet e.V.
+
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+ SPDX-License-Identifier: AGPL3.0-or-later
+ */
+
+/**
+ * @file testbed/testbed_api_cmd_controller.c
+ * @brief Command to create a controller.
+ * @author t3sserakt
+ */
+#include "platform.h"
+#include "gnunet_util_lib.h"
+#include "gnunet_testing_ng_lib.h"
+#include "gnunet-service-testbed.h"
+#include "testbed_api_hosts.h"
+#include "gnunet_testbed_ng_service.h"
+
+/**
+ * Generic logging shortcut
+ */
+#define LOG(kind, ...) \
+ GNUNET_log (kind, __VA_ARGS__)
+
+
+/**
+ * abort task to run on test timed out
+ *
+ * @param cls NULL
+ * @param tc the task context
+ */
+static void
+do_abort (void *cls)
+{
+ struct ServiceState *ss = cls;
+
+ if (GNUNET_NO == ss->service_ready)
+ {
+ LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n");
+ ss->abort_task = NULL;
+ GNUNET_TESTBED_shutdown_service (ss);
+ }
+}
+
+/**
+*
+*
+* @param cls closure
+* @param cmd current CMD being cleaned up.
+*/
+static void
+service_cleanup (void *cls,
+ const struct GNUNET_TESTING_Command *cmd)
+{
+ (void) cls;
+}
+
+/**
+*
+*
+* @param cls closure.
+* @param[out] ret result
+* @param trait name of the trait.
+* @param index index number of the object to offer.
+* @return #GNUNET_OK on success.
+*/
+static int
+service_traits (void *cls,
+ const void **ret,
+ const char *trait,
+ unsigned int index)
+{
+ (void) cls;
+ return GNUNET_OK;
+}
+
+static void
+service_run (void *cls,
+ const struct GNUNET_TESTING_Command *cmd,
+ struct GNUNET_TESTING_Interpreter *is)
+{
+ struct ServiceState *ss = cls;
+
+ // TODO this is unfinished code!
+ ss->operation =
+ GNUNET_TESTBED_service_connect (NULL, NULL, NULL,
+ NULL, NULL,
+ NULL,
+ NULL, NULL);
+
+}
+
+/**
+ * Shutdown nicely
+ *
+ * @param cs service state.
+ */
+void
+GNUNET_TESTBED_shutdown_service (struct ServiceState *cs)
+{
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "Shutting down...\n");
+}
+
+
+struct GNUNET_TESTING_Command
+GNUNET_TESTBED_cmd_service (const char *label,
+ const char *peer_label,
+ const char *servicename)
+{
+ struct ServiceState *ss;
+
+ ss = GNUNET_new (struct ServiceState);
+ ss->servicename = servicename;
+ ss->peer_label = peer_label;
+
+ struct GNUNET_TESTING_Command cmd = {
+ .cls = ss,
+ .label = label,
+ .run = &service_run,
+ .cleanup = &service_cleanup,
+ .traits = &service_traits
+ };
+
+ return cmd;
+}
diff --git a/src/testing/testing_api_cmd_hello_world_birth.c b/src/testing/testing_api_cmd_hello_world_birth.c
index 546b30212..0faf93cd8 100644
--- a/src/testing/testing_api_cmd_hello_world_birth.c
+++ b/src/testing/testing_api_cmd_hello_world_birth.c
@@ -118,10 +118,8 @@ hello_world_birth_run (void *cls,
/**
* Offer data from trait
*
- * @param cmd command to extract the url from.
- * @param pt which url is to be picked, in case
- * multiple are offered.
- * @param[out] url where to write the url.
+ * @param cmd command to extract the message from.
+ * @param pt pointer to message.
* @return #GNUNET_OK on success.
*/
int
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c
index c8a4c0375..9dd2797df 100644
--- a/src/transport/gnunet-communicator-tcp.c
+++ b/src/transport/gnunet-communicator-tcp.c
@@ -877,12 +877,14 @@ queue_destroy (struct Queue *queue)
{
struct ListenTask *lt = NULL;
struct GNUNET_HashCode h_sock;
+ int sockfd;
- GNUNET_CRYPTO_hash (queue->listen_sock,
- sizeof(queue->listen_sock),
+ sockfd = GNUNET_NETWORK_get_fd (queue->listen_sock);
+ GNUNET_CRYPTO_hash (&sockfd,
+ sizeof(int),
&h_sock);
- lt = GNUNET_CONTAINER_multihashmap_get (lt_map, &h_sock);
+ lt = GNUNET_CONTAINER_multihashmap_get (lt_map, &h_sock);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Disconnecting queue for peer `%s'\n",
@@ -1263,7 +1265,8 @@ rekey_monotime_cb (void *cls,
pid,
GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_REKEY,
rekey_monotonic_time,
- sizeof(rekey_monotonic_time),
+ sizeof(*
+ rekey_monotonic_time),
GNUNET_TIME_UNIT_FOREVER_ABS,
GNUNET_PEERSTORE_STOREOPTION_REPLACE,
&rekey_monotime_store_cb,
@@ -1413,18 +1416,18 @@ handshake_ack_monotime_cb (void *cls,
queue_finish (queue);
return;
}
- queue->handshake_ack_monotime_sc = GNUNET_PEERSTORE_store (peerstore,
- "transport_tcp_communicator",
- pid,
- GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK,
- handshake_ack_monotonic_time,
- sizeof(
- handshake_ack_monotonic_time),
- GNUNET_TIME_UNIT_FOREVER_ABS,
- GNUNET_PEERSTORE_STOREOPTION_REPLACE,
- &
- handshake_ack_monotime_store_cb,
- queue);
+ queue->handshake_ack_monotime_sc =
+ GNUNET_PEERSTORE_store (peerstore,
+ "transport_tcp_communicator",
+ pid,
+ GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK,
+ handshake_ack_monotonic_time,
+ sizeof(*handshake_ack_monotonic_time),
+ GNUNET_TIME_UNIT_FOREVER_ABS,
+ GNUNET_PEERSTORE_STOREOPTION_REPLACE,
+ &
+ handshake_ack_monotime_store_cb,
+ queue);
}
@@ -3255,6 +3258,7 @@ init_socket (struct sockaddr *addr,
socklen_t sto_len;
struct GNUNET_NETWORK_Handle *listen_sock;
struct ListenTask *lt;
+ int sockfd;
struct GNUNET_HashCode h_sock;
if (NULL == addr)
@@ -3343,8 +3347,9 @@ init_socket (struct sockaddr *addr,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"creating hash\n");
- GNUNET_CRYPTO_hash (lt->listen_sock,
- sizeof(lt->listen_sock),
+ sockfd = GNUNET_NETWORK_get_fd (lt->listen_sock);
+ GNUNET_CRYPTO_hash (&sockfd,
+ sizeof(int),
&h_sock);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -3564,6 +3569,7 @@ run (void *cls,
peerstore = GNUNET_PEERSTORE_connect (cfg);
if (NULL == peerstore)
{
+ GNUNET_free (bindto);
GNUNET_break (0);
GNUNET_SCHEDULER_shutdown ();
return;
@@ -3596,7 +3602,6 @@ run (void *cls,
GNUNET_free (po);
nat_register ();
GNUNET_free (bindto);
-
return;
}
@@ -3609,8 +3614,8 @@ run (void *cls,
in = tcp_address_to_sockaddr_numeric_v4 (&in_len, v4, bind_port);
init_socket (in, in_len);
nat_register ();
+ GNUNET_free (start);
GNUNET_free (bindto);
-
return;
}
@@ -3620,8 +3625,8 @@ run (void *cls,
in = tcp_address_to_sockaddr_numeric_v6 (&in_len, v6, bind_port);
init_socket (in, in_len);
nat_register ();
+ GNUNET_free (start);
GNUNET_free (bindto);
-
return;
}
@@ -3635,6 +3640,7 @@ run (void *cls,
&init_socket_resolv,
&port);
GNUNET_free (bindto);
+ GNUNET_free (start);
}
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c
index 415dc4b48..d75f4ae00 100644
--- a/src/transport/gnunet-communicator-udp.c
+++ b/src/transport/gnunet-communicator-udp.c
@@ -1492,16 +1492,9 @@ add_acks (struct SharedSecret *ss, int acks_to_add)
struct ReceiverAddress *receiver = ss->receiver;
- if (NULL == ss)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "secret NULL!\n");
-
- if (NULL == receiver)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Receiver NULL!\n");
- if (NULL == receiver->d_qh)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Queue NULL!\n");
+ GNUNET_assert (NULL != ss);
+ GNUNET_assert (NULL != receiver);
+ GNUNET_assert (NULL != receiver->d_qh);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Tell transport we have %u more acks!\n",
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c
index 3cba49250..cbf795eea 100644
--- a/src/transport/gnunet-service-tng.c
+++ b/src/transport/gnunet-service-tng.c
@@ -6976,7 +6976,6 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl)
if (MAX_DV_HOPS_ALLOWED == nhops)
{
/* At limit, we're out of here! */
- finish_cmc_handling (cmc);
return;
}
@@ -9640,11 +9639,13 @@ handle_add_queue_message (void *cls,
{
if (queue->qid != aqm->qid)
continue;
- neighbour = queue->neighbour;
break;
}
- if (NULL == queue)
+
+ if (NULL != queue)
{
+ neighbour = queue->neighbour;
+ } else {
neighbour = lookup_neighbour (&aqm->receiver);
if (NULL == neighbour)
{
diff --git a/src/transport/transport-testing-communicator.c b/src/transport/transport-testing-communicator.c
index de356fb9c..040f16d5d 100644
--- a/src/transport/transport-testing-communicator.c
+++ b/src/transport/transport-testing-communicator.c
@@ -548,6 +548,11 @@ handle_update_queue_message (void *cls,
tc_queue = tc_queue->next;
}
}
+ if (NULL == tc_queue)
+ {
+ GNUNET_SERVICE_client_continue (client->client);
+ return;
+ }
GNUNET_assert (tc_queue->qid == msg->qid);
GNUNET_assert (0 == GNUNET_memcmp (&tc_queue->peer_id, &msg->receiver));
tc_queue->nt = msg->nt;
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index 6b9e083a7..e2614e5e3 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -25,6 +25,11 @@ if ENABLE_BENCHMARK
PTHREAD = -lpthread
endif
+if HAVE_NOLIBGCRYPT19
+ DLOG = crypto_ecc_dlog.c
+ DLOG_TEST = test_crypto_ecc_dlog
+endif
+
gnunet_config_diff_SOURCES = \
gnunet-config-diff.c
gnunet_config_diff_LDADD = \
@@ -58,7 +63,7 @@ libgnunetutil_la_SOURCES = \
crypto_symmetric.c \
crypto_crc.c \
crypto_ecc.c \
- crypto_ecc_dlog.c \
+ $(DLOG) \
crypto_ecc_setup.c \
crypto_hash.c \
crypto_hash_file.c \
@@ -248,7 +253,6 @@ libgnunet_plugin_test_la_LDFLAGS = \
if HAVE_BENCHMARKS
BENCHMARKS = \
perf_crypto_hash \
- perf_crypto_ecc_dlog \
perf_crypto_rsa \
perf_crypto_paillier \
perf_crypto_symmetric \
@@ -256,6 +260,10 @@ if HAVE_BENCHMARKS
perf_malloc \
perf_mq \
perf_scheduler
+
+if HAVE_NOLIBGCRYPT19
+ BENCHMARKS += perf_crypto_ecc_dlog
+endif
endif
if HAVE_SSH_KEY
@@ -287,7 +295,7 @@ check_PROGRAMS = \
test_crypto_ecdhe \
test_crypto_ecdh_eddsa \
test_crypto_ecdh_ecdsa \
- test_crypto_ecc_dlog \
+ $(DLOG_TEST) \
test_crypto_hash \
test_crypto_hash_context \
test_crypto_hkdf \
@@ -448,11 +456,13 @@ test_crypto_eddsa_LDADD = \
libgnunetutil.la \
$(LIBGCRYPT_LIBS)
+if HAVE_NOLIBGCRYPT19
test_crypto_ecc_dlog_SOURCES = \
test_crypto_ecc_dlog.c
test_crypto_ecc_dlog_LDADD = \
libgnunetutil.la \
$(LIBGCRYPT_LIBS)
+endif
test_crypto_ecdhe_SOURCES = \
test_crypto_ecdhe.c
@@ -595,11 +605,13 @@ perf_crypto_hash_SOURCES = \
perf_crypto_hash_LDADD = \
libgnunetutil.la
+if HAVE_NOLIBGCRYPT19
perf_crypto_ecc_dlog_SOURCES = \
perf_crypto_ecc_dlog.c
perf_crypto_ecc_dlog_LDADD = \
libgnunetutil.la \
-lgcrypt
+endif
perf_crypto_rsa_SOURCES = \
perf_crypto_rsa.c
diff --git a/src/util/configuration.c b/src/util/configuration.c
index bda643b83..3294d11f4 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -606,6 +606,7 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg,
if (NULL == h)
{
GNUNET_free (fn);
+ GNUNET_free (cfg_buf);
return GNUNET_SYSERR;
}
if (((ssize_t) size) !=
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c
index b66a7b258..efaac1136 100644
--- a/src/util/container_meta_data.c
+++ b/src/util/container_meta_data.c
@@ -964,6 +964,9 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
{
/* does not fit! */
GNUNET_free (ent);
+ if (NULL != cdata)
+ GNUNET_free (cdata);
+ cdata = NULL;
return GNUNET_SYSERR;
}
@@ -976,9 +979,9 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData
if (NULL != pos->mime_type)
left -= strlen (pos->mime_type) + 1;
- GNUNET_free (cdata);
+ if (NULL != cdata)
+ GNUNET_free (cdata);
cdata = NULL;
-
i++;
}
GNUNET_free (ent);
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c
index 63232cab6..5e4c4d1e6 100644
--- a/src/util/crypto_rsa.c
+++ b/src/util/crypto_rsa.c
@@ -863,6 +863,7 @@ rsa_sign_mpi (const struct GNUNET_CRYPTO_RsaPrivateKey *key,
__FILE__,
__LINE__,
gcry_strerror (rc));
+ gcry_sexp_release (data);
GNUNET_break (0);
return NULL;
}
diff --git a/src/util/gnunet-crypto-tvg.c b/src/util/gnunet-crypto-tvg.c
index 8949f427c..28e44e28b 100644
--- a/src/util/gnunet-crypto-tvg.c
+++ b/src/util/gnunet-crypto-tvg.c
@@ -128,6 +128,7 @@ d2j (json_t *vec,
json_object_set_new (vec, label, json);
}
+
/**
* Add a number to a test vector.
*
@@ -138,8 +139,8 @@ d2j (json_t *vec,
*/
static void
uint2j (json_t *vec,
- const char *label,
- unsigned int num)
+ const char *label,
+ unsigned int num)
{
json_t *json = json_integer (num);
@@ -154,7 +155,7 @@ expect_data_fixed (json_t *vec,
size_t expect_len)
{
const char *s = json_string_value (json_object_get (vec, name));
-
+
if (NULL == s)
return GNUNET_NO;
@@ -166,6 +167,7 @@ expect_data_fixed (json_t *vec,
return GNUNET_OK;
}
+
static int
expect_data_dynamic (json_t *vec,
const char *name,
@@ -173,6 +175,7 @@ expect_data_dynamic (json_t *vec,
size_t *ret_len)
{
const char *s = json_string_value (json_object_get (vec, name));
+ char *tmp;
size_t len;
if (NULL == s)
@@ -181,10 +184,14 @@ expect_data_dynamic (json_t *vec,
len = (strlen (s) * 5) / 8;
if (NULL != ret_len)
*ret_len = len;
- *data = GNUNET_malloc (len);
+ tmp = GNUNET_malloc (len);
- if (GNUNET_OK != GNUNET_STRINGS_string_to_data (s, strlen (s), *data, len))
+ if (GNUNET_OK != GNUNET_STRINGS_string_to_data (s, strlen (s), tmp, len))
+ {
+ GNUNET_free (tmp);
return GNUNET_NO;
+ }
+ *data = tmp;
return GNUNET_OK;
}
@@ -197,7 +204,7 @@ expect_data_dynamic (json_t *vec,
*
* @returns GNUNET_OK if the vector is okay
*/
-static int
+static int
checkvec (const char *operation,
json_t *vec)
{
@@ -220,10 +227,11 @@ checkvec (const char *operation,
return GNUNET_SYSERR;
}
if (GNUNET_OK != expect_data_fixed (vec,
- "output",
- &hash_out,
- sizeof (hash_out)))
+ "output",
+ &hash_out,
+ sizeof (hash_out)))
{
+ GNUNET_free (data);
GNUNET_break (0);
return GNUNET_NO;
}
@@ -232,9 +240,11 @@ checkvec (const char *operation,
if (0 != GNUNET_memcmp (&hc, &hash_out))
{
+ GNUNET_free (data);
GNUNET_break (0);
return GNUNET_NO;
}
+ GNUNET_free (data);
}
else if (0 == strcmp (operation, "ecc_ecdh"))
{
@@ -245,33 +255,33 @@ checkvec (const char *operation,
struct GNUNET_HashCode skm_comp;
if (GNUNET_OK != expect_data_fixed (vec,
- "priv1",
- &priv1,
- sizeof (priv1)))
+ "priv1",
+ &priv1,
+ sizeof (priv1)))
{
GNUNET_break (0);
return GNUNET_NO;
}
if (GNUNET_OK != expect_data_fixed (vec,
- "priv2",
- &priv2,
- sizeof (priv2)))
+ "priv2",
+ &priv2,
+ sizeof (priv2)))
{
GNUNET_break (0);
return GNUNET_NO;
}
if (GNUNET_OK != expect_data_fixed (vec,
- "pub1",
- &pub1,
- sizeof (pub1)))
+ "pub1",
+ &pub1,
+ sizeof (pub1)))
{
GNUNET_break (0);
return GNUNET_NO;
}
if (GNUNET_OK != expect_data_fixed (vec,
- "skm",
- &skm,
- sizeof (skm)))
+ "skm",
+ &skm,
+ sizeof (skm)))
{
GNUNET_break (0);
return GNUNET_NO;
@@ -407,6 +417,8 @@ checkvec (const char *operation,
&ikm,
&ikm_len))
{
+ GNUNET_free (out);
+ GNUNET_free (out_comp);
GNUNET_break (0);
return GNUNET_SYSERR;
}
@@ -416,6 +428,9 @@ checkvec (const char *operation,
&salt,
&salt_len))
{
+ GNUNET_free (out);
+ GNUNET_free (out_comp);
+ GNUNET_free (ikm);
GNUNET_break (0);
return GNUNET_SYSERR;
}
@@ -425,6 +440,10 @@ checkvec (const char *operation,
&ctx,
&ctx_len))
{
+ GNUNET_free (out);
+ GNUNET_free (out_comp);
+ GNUNET_free (ikm);
+ GNUNET_free (salt);
GNUNET_break (0);
return GNUNET_SYSERR;
}
@@ -442,10 +461,19 @@ checkvec (const char *operation,
if (0 != memcmp (out, out_comp, out_len))
{
+ GNUNET_free (out);
+ GNUNET_free (out_comp);
+ GNUNET_free (ikm);
+ GNUNET_free (salt);
+ GNUNET_free (ctx);
GNUNET_break (0);
return GNUNET_NO;
}
-
+ GNUNET_free (out);
+ GNUNET_free (out_comp);
+ GNUNET_free (ikm);
+ GNUNET_free (salt);
+ GNUNET_free (ctx);
}
else if (0 == strcmp (operation, "eddsa_ecdh"))
{
@@ -562,6 +590,7 @@ checkvec (const char *operation,
&public_enc_data,
&public_enc_len))
{
+ GNUNET_free (blinded_data);
GNUNET_break (0);
return GNUNET_SYSERR;
}
@@ -571,6 +600,8 @@ checkvec (const char *operation,
&secret_enc_data,
&secret_enc_len))
{
+ GNUNET_free (blinded_data);
+ GNUNET_free (public_enc_data);
GNUNET_break (0);
return GNUNET_SYSERR;
}
@@ -580,6 +611,9 @@ checkvec (const char *operation,
&sig_enc_data,
&sig_enc_length))
{
+ GNUNET_free (blinded_data);
+ GNUNET_free (public_enc_data);
+ GNUNET_free (secret_enc_data);
GNUNET_break (0);
return GNUNET_SYSERR;
}
@@ -601,6 +635,11 @@ checkvec (const char *operation,
blinded_data_comp,
blinded_len)) )
{
+ GNUNET_free (blinded_data);
+ GNUNET_free (public_enc_data);
+ GNUNET_free (secret_enc_data);
+ GNUNET_free (sig_enc_data);
+ GNUNET_free (skey);
GNUNET_break (0);
return GNUNET_NO;
}
@@ -611,14 +650,27 @@ checkvec (const char *operation,
pkey));
public_enc_len = GNUNET_CRYPTO_rsa_public_key_encode (pkey,
&public_enc_data);
- sig_enc_length_comp = GNUNET_CRYPTO_rsa_signature_encode (sig, &sig_enc_data_comp);
+ sig_enc_length_comp = GNUNET_CRYPTO_rsa_signature_encode (sig,
+ &sig_enc_data_comp);
if ( (sig_enc_length != sig_enc_length_comp) ||
(0 != memcmp (sig_enc_data, sig_enc_data_comp, sig_enc_length) ))
{
+ GNUNET_free (blinded_sig);
+ GNUNET_free (blinded_data);
+ GNUNET_free (public_enc_data);
+ GNUNET_free (secret_enc_data);
+ GNUNET_free (sig_enc_data);
+ GNUNET_free (skey);
GNUNET_break (0);
return GNUNET_NO;
}
+ GNUNET_free (blinded_sig);
+ GNUNET_free (blinded_data);
+ GNUNET_free (public_enc_data);
+ GNUNET_free (secret_enc_data);
+ GNUNET_free (sig_enc_data);
+ GNUNET_free (skey);
}
else
{
@@ -629,6 +681,7 @@ checkvec (const char *operation,
return GNUNET_OK;
}
+
/**
* Check test vectors from stdin.
*
@@ -656,7 +709,7 @@ check_vectors ()
return 1;
}
vectors = json_object_get (vecfile, "vectors");
- if (!json_is_array (vectors))
+ if (! json_is_array (vectors))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "bad vectors\n");
json_decref (vecfile);
@@ -692,6 +745,7 @@ check_vectors ()
}
}
+
/**
* Output test vectors.
*
@@ -868,20 +922,20 @@ output_vectors ()
GNUNET_CRYPTO_ecdh_eddsa (&priv_ecdhe, &pub_eddsa, &key_material);
d2j (vec, "priv_ecdhe",
- &priv_ecdhe,
- sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
+ &priv_ecdhe,
+ sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey));
d2j (vec, "pub_ecdhe",
- &pub_ecdhe,
- sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
+ &pub_ecdhe,
+ sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
d2j (vec, "priv_eddsa",
- &priv_eddsa,
- sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey));
+ &priv_eddsa,
+ sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey));
d2j (vec, "pub_eddsa",
- &pub_eddsa,
- sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
+ &pub_eddsa,
+ sizeof (struct GNUNET_CRYPTO_EddsaPublicKey));
d2j (vec, "key_material",
- &key_material,
- sizeof (struct GNUNET_HashCode));
+ &key_material,
+ sizeof (struct GNUNET_HashCode));
}
{
@@ -968,6 +1022,7 @@ output_vectors ()
GNUNET_free (blinded_data);
GNUNET_free (sig_enc_data);
GNUNET_free (blinded_sig_enc_data);
+ GNUNET_free (secret_enc_data);
}
json_dumpf (vecfile, stdout, JSON_INDENT (2));
@@ -977,6 +1032,7 @@ output_vectors ()
return 0;
}
+
/**
* Main function that will be run.
*
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index d1e5e0da5..02d4d439d 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -736,7 +736,12 @@ GNUNET_OS_get_suid_binary_path (const struct GNUNET_CONFIGURATION_Handle *cfg,
"SUID_BINARY_PATH",
&path);
if ((NULL == path) || (0 == strlen (path)))
+ {
+ if (NULL != path)
+ GNUNET_free (path);
+ cache = NULL;
return GNUNET_OS_get_libexec_binary_path (progname);
+ }
path_len = strlen (path);
GNUNET_asprintf (&binary,
"%s%s%s",