aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am8
-rw-r--r--src/arm/test_gnunet_arm.py.in2
-rwxr-xr-xsrc/cadet/loopcheck.sh42
-rwxr-xr-xsrc/cadet/run_profiler.sh2
-rw-r--r--src/consensus/consensus-simulation.py.in13
-rw-r--r--src/conversation/test.sh2
-rw-r--r--src/credential/Makefile.am16
-rw-r--r--src/credential/plugin_rest_credential.c (renamed from src/rest-plugins/plugin_rest_credential.c)0
-rwxr-xr-xsrc/credential/test_credential_collect.sh4
-rwxr-xr-xsrc/credential/test_credential_collect_rest.sh13
-rwxr-xr-xsrc/credential/test_credential_issue.sh4
-rwxr-xr-xsrc/credential/test_credential_issue_rest.sh4
-rwxr-xr-xsrc/credential/test_credential_verify.sh5
-rwxr-xr-xsrc/credential/test_credential_verify_and.sh5
-rwxr-xr-xsrc/credential/test_credential_verify_rest.sh5
-rwxr-xr-xsrc/credential/test_credential_verify_simple.sh4
-rw-r--r--src/dht/test_dht_tools.py.in3
-rw-r--r--src/dns/gnunet-helper-dns.c2
-rwxr-xr-xsrc/dns/test_gnunet_dns.sh12
-rwxr-xr-xsrc/exit/install-exit-helper.sh2
-rw-r--r--src/fs/gnunet-publish.c14
-rwxr-xr-xsrc/fs/test_gnunet_fs_psd.py.in2
-rwxr-xr-xsrc/fs/test_gnunet_fs_rec.py.in4
-rw-r--r--src/gns/Makefile.am24
-rw-r--r--src/gns/gns.conf.in4
-rw-r--r--src/gns/gnunet-dns2gns.c60
-rw-r--r--src/gns/gnunet-gns-proxy-setup-ca.in322
-rw-r--r--src/gns/gnunet-gns-proxy.c59
-rw-r--r--src/gns/plugin_rest_gns.c (renamed from src/rest-plugins/plugin_rest_gns.c)0
-rwxr-xr-xsrc/gns/test_gns_at_lookup.sh6
-rwxr-xr-xsrc/gns/test_gns_cname_lookup.sh12
-rwxr-xr-xsrc/gns/test_gns_config_lookup.sh6
-rwxr-xr-xsrc/gns/test_gns_delegated_lookup.sh6
-rwxr-xr-xsrc/gns/test_gns_dht_lookup.sh6
-rwxr-xr-xsrc/gns/test_gns_gns2dns_cname_lookup.sh10
-rwxr-xr-xsrc/gns/test_gns_gns2dns_lookup.sh14
-rwxr-xr-xsrc/gns/test_gns_ipv6_lookup.sh6
-rwxr-xr-xsrc/gns/test_gns_lookup.sh6
-rwxr-xr-xsrc/gns/test_gns_mx_lookup.sh6
-rw-r--r--src/gns/test_gns_proxy.c16
-rwxr-xr-xsrc/gns/test_gns_quickupdate.sh6
-rwxr-xr-xsrc/gns/test_gns_rel_expiration.sh8
-rwxr-xr-xsrc/gns/test_gns_revocation.sh6
-rwxr-xr-xsrc/gns/test_gns_soa_lookup.sh8
-rwxr-xr-xsrc/gns/test_gns_txt_lookup.sh6
-rwxr-xr-xsrc/gns/test_gns_zkey_lookup.sh6
-rwxr-xr-xsrc/gns/test_gnunet_gns.sh25
-rwxr-xr-xsrc/gns/test_plugin_rest_gns.sh (renamed from src/rest-plugins/test_plugin_rest_gns.sh)0
-rwxr-xr-xsrc/gns/test_proxy.sh4
-rw-r--r--src/hostlist/hostlist.conf2
-rw-r--r--src/identity/Makefile.am21
-rw-r--r--src/identity/plugin_rest_identity.c (renamed from src/rest-plugins/plugin_rest_identity.c)0
-rwxr-xr-xsrc/identity/test_plugin_rest_identity.sh (renamed from src/rest-plugins/test_plugin_rest_identity.sh)0
-rw-r--r--src/integration-tests/Makefile.am4
-rw-r--r--src/integration-tests/gnunet_pyexpect.py.in3
-rw-r--r--src/integration-tests/gnunet_testing.py.in5
-rwxr-xr-xsrc/integration-tests/test_integration_bootstrap_and_connect.py.in2
-rwxr-xr-xsrc/integration-tests/test_integration_clique.py.in1
-rwxr-xr-xsrc/integration-tests/test_integration_disconnect.py.in2
-rwxr-xr-xsrc/integration-tests/test_integration_disconnect_nat.py.in2
-rwxr-xr-xsrc/integration-tests/test_integration_reconnect.py.in2
-rwxr-xr-xsrc/integration-tests/test_integration_reconnect_nat.py.in2
-rw-r--r--src/namestore/Makefile.am57
-rw-r--r--src/namestore/plugin_rest_namestore.c (renamed from src/rest-plugins/plugin_rest_namestore.c)0
-rwxr-xr-xsrc/namestore/test_plugin_rest_namestore.sh (renamed from src/rest-plugins/test_plugin_rest_namestore.sh)0
-rwxr-xr-xsrc/nat/install-nat-helper.sh2
-rw-r--r--src/peerinfo/Makefile.am23
-rw-r--r--src/peerinfo/plugin_rest_peerinfo.c (renamed from src/rest-plugins/plugin_rest_peerinfo.c)0
-rw-r--r--src/pt/test_gns_vpn.c2
-rw-r--r--src/pt/test_gns_vpn.conf2
-rw-r--r--src/reclaim/.gitignore4
-rw-r--r--src/reclaim/Makefile.am46
-rw-r--r--src/reclaim/json_reclaim.c (renamed from src/rest-plugins/json_reclaim.c)0
-rw-r--r--src/reclaim/json_reclaim.h (renamed from src/rest-plugins/json_reclaim.h)0
-rw-r--r--src/reclaim/oidc_helper.c (renamed from src/rest-plugins/oidc_helper.c)0
-rw-r--r--src/reclaim/oidc_helper.h (renamed from src/rest-plugins/oidc_helper.h)0
-rw-r--r--src/reclaim/plugin_rest_openid_connect.c (renamed from src/rest-plugins/plugin_rest_openid_connect.c)0
-rw-r--r--src/reclaim/plugin_rest_reclaim.c (renamed from src/rest-plugins/plugin_rest_reclaim.c)0
-rwxr-xr-xsrc/reclaim/test_reclaim.sh4
-rw-r--r--src/rest-plugins/Makefile.am135
-rw-r--r--src/rest/Makefile.am15
-rw-r--r--src/rest/gnunet-rest-server.c63
-rw-r--r--src/rest/plugin_rest_copying.c (renamed from src/rest-plugins/plugin_rest_copying.c)0
-rw-r--r--src/rest/rest.conf2
-rw-r--r--src/revocation/test_local_revocation.py.in3
-rw-r--r--src/rps/gnunet-rps-profiler.c76
-rw-r--r--src/rps/gnunet-service-rps.c18
-rw-r--r--src/rps/rps-test_util.h2
-rw-r--r--src/statistics/test_gnunet_statistics.py.in2
-rwxr-xr-xsrc/transport/benchmark.sh8
-rwxr-xr-xsrc/transport/install-bluetooth-helper.sh2
-rwxr-xr-xsrc/transport/install-wlan-helper.sh2
-rwxr-xr-xsrc/transport/profile_transport.sh4
-rw-r--r--src/util/gnunet-config.c130
-rw-r--r--src/util/gnunet-qr.c221
-rwxr-xr-xsrc/vpn/install-vpn-helper.sh2
-rwxr-xr-xsrc/vpn/tests/test-helper-icmp.sh2
-rwxr-xr-xsrc/vpn/tests/test-helper-ifaddr.sh2
98 files changed, 1122 insertions, 553 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 03738e4ed..c1c708aa6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -60,7 +60,7 @@ endif
60 60
61if HAVE_MHD 61if HAVE_MHD
62if HAVE_JSON 62if HAVE_JSON
63 REST_DIR = rest rest-plugins 63 REST_DIR = rest
64endif 64endif
65endif 65endif
66 66
@@ -81,6 +81,8 @@ SUBDIRS = \
81 statistics \ 81 statistics \
82 arm \ 82 arm \
83 $(TESTING) \ 83 $(TESTING) \
84 $(JSON_DIR) \
85 $(REST_DIR) \
84 peerinfo \ 86 peerinfo \
85 $(SQLITE_DIR) \ 87 $(SQLITE_DIR) \
86 $(MYSQL_DIR) \ 88 $(MYSQL_DIR) \
@@ -121,9 +123,7 @@ SUBDIRS = \
121 exit \ 123 exit \
122 pt \ 124 pt \
123 secretsharing \ 125 secretsharing \
124 $(EXP_DIR) \ 126 $(EXP_DIR) \
125 $(JSON_DIR) \
126 $(REST_DIR) \
127 integration-tests 127 integration-tests
128 128
129endif 129endif
diff --git a/src/arm/test_gnunet_arm.py.in b/src/arm/test_gnunet_arm.py.in
index 10bb58a9c..1d067b5d9 100644
--- a/src/arm/test_gnunet_arm.py.in
+++ b/src/arm/test_gnunet_arm.py.in
@@ -1,5 +1,5 @@
1#!@PYTHON@ 1#!@PYTHON@
2from __future__ import print_function 2
3import os 3import os
4import sys 4import sys
5import shutil 5import shutil
diff --git a/src/cadet/loopcheck.sh b/src/cadet/loopcheck.sh
index ddc8c191c..9b867e95b 100755
--- a/src/cadet/loopcheck.sh
+++ b/src/cadet/loopcheck.sh
@@ -1,4 +1,41 @@
1#!/bin/sh 1#!/usr/bin/env bash
2# This script is in the public domain
3# POSIX shell solution for named pipes and pipestatus,
4# http://shell.cfajohnson.com/cus-faq-2.html#Q11
5# run() {
6# j=1
7# while eval "\${pipestatus_$j+:} false"; do
8# unset pipestatus_$j
9# j=$(($j+1))
10# done
11# j=1 com= k=1 l=
12# for a; do
13# if [ "x$a" = 'x|' ]; then
14# com="$com { $l "'3>&-
15# echo "pipestatus_'$j'=$?" >&3
16# } 4>&- |'
17# j=$(($j+1)) l=
18# else
19# l="$l \"\$$k\""
20# fi
21# k=$(($k+1))
22# done
23# com="$com $l"' 3>&- >&4 4>&-
24# echo "pipestatus_'$j'=$?"'
25# exec 4>&1
26# eval "$(exec 3>&1; eval "$com")"
27# exec 4>&-
28# j=1
29# while eval "\${pipestatus_$j+:} false"; do
30# eval "[ \$pipestatus_$j -eq 0 ]" || return 1
31# j=$(($j+1))
32# done
33# return 0
34# }
35
36# # https://mywiki.wooledge.org/Bashism has another solution:
37# # mkfifo fifo; command2 <fifo & command1 >fifo; echo "$?"
38
2while true; do 39while true; do
3 if [ "$1" = "" ]; then 40 if [ "$1" = "" ]; then
4 echo All 41 echo All
@@ -7,6 +44,7 @@ while true; do
7 echo One 44 echo One
8 LOGFILE="test_`date "+%m.%d-%H:%M:%S"`.log" 45 LOGFILE="test_`date "+%m.%d-%H:%M:%S"`.log"
9 taskset 01 $1 2>&1 | tee $LOGFILE | grep -v DEBUG; 46 taskset 01 $1 2>&1 | tee $LOGFILE | grep -v DEBUG;
47 # TODO: Replace $PIPESTATUS with more portable code
10 if [ "${PIPESTATUS[0]}" != "0" ]; then 48 if [ "${PIPESTATUS[0]}" != "0" ]; then
11 echo "Failed"; 49 echo "Failed";
12 date; 50 date;
@@ -15,5 +53,5 @@ while true; do
15 fi 53 fi
16 grep cadet test_*.log | grep -B 10 ERROR && break 54 grep cadet test_*.log | grep -B 10 ERROR && break
17 grep cadet test_*.log | grep -B 10 Assert && break 55 grep cadet test_*.log | grep -B 10 Assert && break
18 ls core* &> /dev/null && break 56 ls core* > /dev/null 2>&1 && break
19done 57done
diff --git a/src/cadet/run_profiler.sh b/src/cadet/run_profiler.sh
index 81ea4a761..4273dcd27 100755
--- a/src/cadet/run_profiler.sh
+++ b/src/cadet/run_profiler.sh
@@ -22,4 +22,4 @@ echo "using $PEERS peers, $LINKS links";
22 22
23sed -e "s/%LINKS%/$LINKS/;s/%NSE%/$NSE/" profiler.conf > .profiler.conf 23sed -e "s/%LINKS%/$LINKS/;s/%NSE%/$NSE/" profiler.conf > .profiler.conf
24 24
25./gnunet-cadet-profiler $ROUNDTIME $PEERS $PINGS $4 |& tee log | grep -v DEBUG 25./gnunet-cadet-profiler $ROUNDTIME $PEERS $PINGS $4 2>&1 | tee log | grep -v DEBUG
diff --git a/src/consensus/consensus-simulation.py.in b/src/consensus/consensus-simulation.py.in
index 161015d00..39daf81c6 100644
--- a/src/consensus/consensus-simulation.py.in
+++ b/src/consensus/consensus-simulation.py.in
@@ -17,16 +17,9 @@
17# 17#
18# SPDX-License-Identifier: AGPL3.0-or-later 18# SPDX-License-Identifier: AGPL3.0-or-later
19 19
20from __future__ import absolute_import
21from __future__ import print_function
22from __future__ import division
23from builtins import str
24from builtins import range
25from past.utils import old_div
26import argparse 20import argparse
27import random 21import random
28from math import ceil, log, floor 22from math import ceil, log, floor
29from past.builtins import xrange
30 23
31 24
32def bsc(n): 25def bsc(n):
@@ -43,14 +36,12 @@ def bsc(n):
43 36
44def simulate(k, n, verbose): 37def simulate(k, n, verbose):
45 assert k < n 38 assert k < n
46 largest_arc = old_div(int(2**ceil(log(n, 2))), 2) 39 largest_arc = int(2**ceil(log(n, 2))) // 2
47 num_ghosts = (2 * largest_arc) - n 40 num_ghosts = (2 * largest_arc) - n
48 if verbose: 41 if verbose:
49 print("we have", num_ghosts, "ghost peers") 42 print("we have", num_ghosts, "ghost peers")
50 # n.b. all peers with idx<k are evil 43 # n.b. all peers with idx<k are evil
51 peers = list(range(n)) 44 peers = list(range(n))
52 # py2-3 compatible, backwards.
53 # refer to http://python-future.org/compatible_idioms.html#xrange
54 info = [1 << x for x in range(n)] 45 info = [1 << x for x in range(n)]
55 46
56 def done_p(): 47 def done_p():
@@ -111,4 +102,4 @@ if __name__ == "__main__":
111 sum = 0.0 102 sum = 0.0
112 for n in range(0, args.r): 103 for n in range(0, args.r):
113 sum += simulate(args.k, args.n, args.verbose) 104 sum += simulate(args.k, args.n, args.verbose)
114 print(old_div(sum, args.r)) 105 print(sum // args.r)
diff --git a/src/conversation/test.sh b/src/conversation/test.sh
index ca4d15ac1..20e82bc88 100644
--- a/src/conversation/test.sh
+++ b/src/conversation/test.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2 2
3export GST_DEBUG_DUMP_DOT_DIR=/tmp/ 3export GST_DEBUG_DUMP_DOT_DIR=/tmp/
4GST_DEBUG_DUMP_DOT_DIR=/tmp/ ./gnunet-helper-audio-record |GST_DEBUG_DUMP_DOT_DIR=/tmp/ ./gnunet-helper-audio-playback 4GST_DEBUG_DUMP_DOT_DIR=/tmp/ ./gnunet-helper-audio-record |GST_DEBUG_DUMP_DOT_DIR=/tmp/ ./gnunet-helper-audio-playback
diff --git a/src/credential/Makefile.am b/src/credential/Makefile.am
index b96e33b5c..aaac0d2c2 100644
--- a/src/credential/Makefile.am
+++ b/src/credential/Makefile.am
@@ -90,3 +90,19 @@ if HAVE_SQLITE
90 TESTS = $(check_SCRIPTS) 90 TESTS = $(check_SCRIPTS)
91endif 91endif
92endif 92endif
93
94#libgnunet_plugin_rest_credential_la_SOURCES = \
95# plugin_rest_credential.c
96#libgnunet_plugin_rest_credential_la_LIBADD = \
97# $(top_builddir)/src/credential/libgnunetcredential.la \
98# $(top_builddir)/src/rest/libgnunetrest.la \
99# $(top_builddir)/src/identity/libgnunetidentity.la \
100# $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
101# $(LTLIBINTL) -ljansson -lmicrohttpd
102#libgnunet_plugin_rest_credential_la_LDFLAGS = \
103# $(GN_PLUGIN_LDFLAGS)
104
105
106
107
108
diff --git a/src/rest-plugins/plugin_rest_credential.c b/src/credential/plugin_rest_credential.c
index 78267b54e..78267b54e 100644
--- a/src/rest-plugins/plugin_rest_credential.c
+++ b/src/credential/plugin_rest_credential.c
diff --git a/src/credential/test_credential_collect.sh b/src/credential/test_credential_collect.sh
index 6c713063f..0ae063eda 100755
--- a/src/credential/test_credential_collect.sh
+++ b/src/credential/test_credential_collect.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT 2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT
3 3
4LOCATION=$(which gnunet-config) 4LOCATION=$(which gnunet-config)
@@ -20,7 +20,7 @@ rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f`
20# (3) PKEY3.user -> PKEY4 20# (3) PKEY3.user -> PKEY4
21 21
22 22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 23which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
24 24
25TEST_ATTR="test" 25TEST_ATTR="test"
26TEST_ATTR2="test2" 26TEST_ATTR2="test2"
diff --git a/src/credential/test_credential_collect_rest.sh b/src/credential/test_credential_collect_rest.sh
index 0b31f85bc..fe59d9399 100755
--- a/src/credential/test_credential_collect_rest.sh
+++ b/src/credential/test_credential_collect_rest.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT 2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT
3 3
4LOCATION=$(which gnunet-config) 4LOCATION=$(which gnunet-config)
@@ -22,7 +22,7 @@ rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f`
22# (5) GNUnet.developer -> Alice 22# (5) GNUnet.developer -> Alice
23 23
24 24
25which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 25which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
26gnunet-arm -s -c test_credential_lookup.conf 26gnunet-arm -s -c test_credential_lookup.conf
27gnunet-identity -C service -c test_credential_lookup.conf 27gnunet-identity -C service -c test_credential_lookup.conf
28gnunet-identity -C alice -c test_credential_lookup.conf 28gnunet-identity -C alice -c test_credential_lookup.conf
@@ -82,9 +82,10 @@ gnunet-arm -e -c test_credential_lookup.conf
82echo "Done" 82echo "Done"
83if [ "$RES_CRED" != "Failed." ] 83if [ "$RES_CRED" != "Failed." ]
84then 84then
85 echo -e "${RES_CRED}" 85 # TODO: replace echo -e bashism.
86 exit 0 86 echo -e "${RES_CRED}"
87 exit 0
87else 88else
88 echo "FAIL: Failed to verify credential $RES_CRED." 89 echo "FAIL: Failed to verify credential $RES_CRED."
89 exit 1 90 exit 1
90fi 91fi
diff --git a/src/credential/test_credential_issue.sh b/src/credential/test_credential_issue.sh
index 158d91c5b..f06de5d42 100755
--- a/src/credential/test_credential_issue.sh
+++ b/src/credential/test_credential_issue.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT 2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT
3 3
4LOCATION=$(which gnunet-config) 4LOCATION=$(which gnunet-config)
@@ -20,7 +20,7 @@ rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f`
20# (3) PKEY3.user -> PKEY4 20# (3) PKEY3.user -> PKEY4
21 21
22 22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 23which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
24 24
25TEST_ATTR="test" 25TEST_ATTR="test"
26gnunet-arm -s -c test_credential_lookup.conf 26gnunet-arm -s -c test_credential_lookup.conf
diff --git a/src/credential/test_credential_issue_rest.sh b/src/credential/test_credential_issue_rest.sh
index 15cd55083..c518c08ec 100755
--- a/src/credential/test_credential_issue_rest.sh
+++ b/src/credential/test_credential_issue_rest.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT 2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT
3 3
4LOCATION=$(which gnunet-config) 4LOCATION=$(which gnunet-config)
@@ -20,7 +20,7 @@ rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f`
20# (3) PKEY3.user -> PKEY4 20# (3) PKEY3.user -> PKEY4
21 21
22 22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 23which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
24 24
25TEST_ATTR="test" 25TEST_ATTR="test"
26gnunet-arm -s -c test_credential_lookup.conf 26gnunet-arm -s -c test_credential_lookup.conf
diff --git a/src/credential/test_credential_verify.sh b/src/credential/test_credential_verify.sh
index d042bcfe6..49d4d4afb 100755
--- a/src/credential/test_credential_verify.sh
+++ b/src/credential/test_credential_verify.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/usr/bin/env bash
2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT 2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT
3 3
4LOCATION=$(which gnunet-config) 4LOCATION=$(which gnunet-config)
@@ -22,7 +22,7 @@ rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f`
22# (5) GNUnet.developer -> Alice 22# (5) GNUnet.developer -> Alice
23 23
24 24
25which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 25which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
26gnunet-arm -s -c test_credential_lookup.conf 26gnunet-arm -s -c test_credential_lookup.conf
27gnunet-identity -C service -c test_credential_lookup.conf 27gnunet-identity -C service -c test_credential_lookup.conf
28gnunet-identity -C alice -c test_credential_lookup.conf 28gnunet-identity -C alice -c test_credential_lookup.conf
@@ -73,6 +73,7 @@ gnunet-arm -e -c test_credential_lookup.conf
73 73
74if [ "$RES_CRED" != "Failed." ] 74if [ "$RES_CRED" != "Failed." ]
75then 75then
76 # TODO: replace echo -e bashism
76 echo -e "${RES_CRED}" 77 echo -e "${RES_CRED}"
77 exit 0 78 exit 0
78else 79else
diff --git a/src/credential/test_credential_verify_and.sh b/src/credential/test_credential_verify_and.sh
index 9d5c1962e..7e8dc1392 100755
--- a/src/credential/test_credential_verify_and.sh
+++ b/src/credential/test_credential_verify_and.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/usr/bin/env bash
2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT 2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT
3 3
4LOCATION=$(which gnunet-config) 4LOCATION=$(which gnunet-config)
@@ -22,7 +22,7 @@ rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f`
22# (5) GNUnet.developer -> Alice 22# (5) GNUnet.developer -> Alice
23 23
24 24
25which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 25which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
26gnunet-arm -s -c test_credential_lookup.conf 26gnunet-arm -s -c test_credential_lookup.conf
27gnunet-identity -C service -c test_credential_lookup.conf 27gnunet-identity -C service -c test_credential_lookup.conf
28gnunet-identity -C alice -c test_credential_lookup.conf 28gnunet-identity -C alice -c test_credential_lookup.conf
@@ -73,6 +73,7 @@ gnunet-arm -e -c test_credential_lookup.conf
73 73
74if [ "$RES_CRED" != "Failed." ] 74if [ "$RES_CRED" != "Failed." ]
75then 75then
76 # TODO: echo -e bashism
76 echo -e "${RES_CRED}" 77 echo -e "${RES_CRED}"
77 exit 0 78 exit 0
78else 79else
diff --git a/src/credential/test_credential_verify_rest.sh b/src/credential/test_credential_verify_rest.sh
index 6133ea25e..99db5da8a 100755
--- a/src/credential/test_credential_verify_rest.sh
+++ b/src/credential/test_credential_verify_rest.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/usr/bin/env bash
2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT 2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT
3 3
4LOCATION=$(which gnunet-config) 4LOCATION=$(which gnunet-config)
@@ -22,7 +22,7 @@ rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f`
22# (5) GNUnet.developer -> Alice 22# (5) GNUnet.developer -> Alice
23 23
24 24
25which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 25which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
26gnunet-arm -s -c test_credential_lookup.conf 26gnunet-arm -s -c test_credential_lookup.conf
27gnunet-identity -C service -c test_credential_lookup.conf 27gnunet-identity -C service -c test_credential_lookup.conf
28gnunet-identity -C alice -c test_credential_lookup.conf 28gnunet-identity -C alice -c test_credential_lookup.conf
@@ -79,6 +79,7 @@ gnunet-arm -e -c test_credential_lookup.conf
79 79
80if [ "$RES_CRED" != "Failed." ] 80if [ "$RES_CRED" != "Failed." ]
81then 81then
82 # TODO: replace echo -e bashism
82 echo -e "${RES_CRED}" 83 echo -e "${RES_CRED}"
83 exit 0 84 exit 0
84else 85else
diff --git a/src/credential/test_credential_verify_simple.sh b/src/credential/test_credential_verify_simple.sh
index bcb3f9877..41afb47b0 100755
--- a/src/credential/test_credential_verify_simple.sh
+++ b/src/credential/test_credential_verify_simple.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT 2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT
3 3
4LOCATION=$(which gnunet-config) 4LOCATION=$(which gnunet-config)
@@ -18,7 +18,7 @@ rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f`
18# (3) Isser.user -> Subject 18# (3) Isser.user -> Subject
19 19
20 20
21which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 21which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
22gnunet-arm -s -c test_credential_lookup.conf 22gnunet-arm -s -c test_credential_lookup.conf
23gnunet-identity -C testissuer -c test_credential_lookup.conf 23gnunet-identity -C testissuer -c test_credential_lookup.conf
24gnunet-identity -C testsubject -c test_credential_lookup.conf 24gnunet-identity -C testsubject -c test_credential_lookup.conf
diff --git a/src/dht/test_dht_tools.py.in b/src/dht/test_dht_tools.py.in
index 38a9f9622..2d9379a42 100644
--- a/src/dht/test_dht_tools.py.in
+++ b/src/dht/test_dht_tools.py.in
@@ -11,8 +11,7 @@
11# 11#
12# The code does NOT depend on DHT routing or any actual P2P functionality. 12# The code does NOT depend on DHT routing or any actual P2P functionality.
13# 13#
14from __future__ import print_function 14
15from __future__ import absolute_import
16import os 15import os
17import sys 16import sys
18import shutil 17import shutil
diff --git a/src/dns/gnunet-helper-dns.c b/src/dns/gnunet-helper-dns.c
index f236924bb..fb970224a 100644
--- a/src/dns/gnunet-helper-dns.c
+++ b/src/dns/gnunet-helper-dns.c
@@ -83,7 +83,7 @@
83 */ 83 */
84#define MAX_SIZE 65536 84#define MAX_SIZE 65536
85 85
86#ifndef _LINUX_IN6_H 86#if !HAVE_DECL_STRUCT_IN6_IFREQ
87/** 87/**
88 * This is in linux/include/net/ipv6.h, but not always exported... 88 * This is in linux/include/net/ipv6.h, but not always exported...
89 */ 89 */
diff --git a/src/dns/test_gnunet_dns.sh b/src/dns/test_gnunet_dns.sh
index 57b9716f5..0fa338c9b 100755
--- a/src/dns/test_gnunet_dns.sh
+++ b/src/dns/test_gnunet_dns.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2 2
3ME=`whoami` 3ME=`whoami`
4if [ "$ME" != "root" ] 4if [ "$ME" != "root" ]
@@ -26,12 +26,17 @@ then
26 echo "This test requires nslookup. Skipping." 26 echo "This test requires nslookup. Skipping."
27 exit 77 27 exit 77
28fi 28fi
29if ! iptables -t mangle --list &> /dev/null 29if [ ! -x `which iptables` ]
30then
31 echo "This test requires iptables. Skipping."
32 exit 77
33fi
34if ! iptables -t mangle --list > /dev/null 2>&1
30then 35then
31 echo "This test requires iptables with 'mangle' support. Skipping." 36 echo "This test requires iptables with 'mangle' support. Skipping."
32 exit 77 37 exit 77
33fi 38fi
34if grep % /etc/resolv.conf &> /dev/null 39if grep % /etc/resolv.conf > /dev/null 2>&1
35then 40then
36 echo "This system seems to use a DNS server on an IPv6 link-local address, which is not supported. Skipping." 41 echo "This system seems to use a DNS server on an IPv6 link-local address, which is not supported. Skipping."
37 exit 77 42 exit 77
@@ -52,5 +57,6 @@ else
52 echo "Test run, with success." 57 echo "Test run, with success."
53 ret=0 58 ret=0
54fi 59fi
60# TODO: jobs is a possible bashism. Fix.
55kill `jobs -p` 61kill `jobs -p`
56exit $ret 62exit $ret
diff --git a/src/exit/install-exit-helper.sh b/src/exit/install-exit-helper.sh
index 76af4efa7..d9ae14106 100755
--- a/src/exit/install-exit-helper.sh
+++ b/src/exit/install-exit-helper.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# $1 - bindir 2# $1 - bindir
3# $2 - sudo binary (optional) 3# $2 - sudo binary (optional)
4$2 chown root:root $1/gnunet-helper-exit || true 4$2 chown root:root $1/gnunet-helper-exit || true
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c
index eb8a7ed19..fbf32c2a7 100644
--- a/src/fs/gnunet-publish.c
+++ b/src/fs/gnunet-publish.c
@@ -122,7 +122,7 @@ static int extract_only;
122/** 122/**
123 * Command-line option to disable adding creation time. 123 * Command-line option to disable adding creation time.
124 */ 124 */
125static int do_disable_creation_time; 125static int enable_creation_time;
126 126
127/** 127/**
128 * Handle to the directory scanner (for recursive insertions). 128 * Handle to the directory scanner (for recursive insertions).
@@ -419,7 +419,7 @@ publish_inspector (void *cls,
419 GNUNET_CONTAINER_meta_data_destroy (meta); 419 GNUNET_CONTAINER_meta_data_destroy (meta);
420 meta = NULL; 420 meta = NULL;
421 } 421 }
422 if (!do_disable_creation_time) 422 if (enable_creation_time)
423 GNUNET_CONTAINER_meta_data_add_publication_date (m); 423 GNUNET_CONTAINER_meta_data_add_publication_date (m);
424 if (extract_only) 424 if (extract_only)
425 { 425 {
@@ -902,15 +902,15 @@ main (int argc,
902 "LEVEL", 902 "LEVEL",
903 gettext_noop ("set the desired LEVEL of sender-anonymity"), 903 gettext_noop ("set the desired LEVEL of sender-anonymity"),
904 &bo.anonymity_level), 904 &bo.anonymity_level),
905 GNUNET_GETOPT_option_flag ('d',
906 "disable-creation-time",
907 gettext_noop ("disable adding the creation time to the "
908 "metadata of the uploaded file"),
909 &do_disable_creation_time),
910 GNUNET_GETOPT_option_flag ('D', 905 GNUNET_GETOPT_option_flag ('D',
911 "disable-extractor", 906 "disable-extractor",
912 gettext_noop ("do not use libextractor to add keywords or metadata"), 907 gettext_noop ("do not use libextractor to add keywords or metadata"),
913 &disable_extractor), 908 &disable_extractor),
909 GNUNET_GETOPT_option_flag ('E',
910 "enable-creation-time",
911 gettext_noop ("enable adding the creation time to the "
912 "metadata of the uploaded file"),
913 &enable_creation_time),
914 GNUNET_GETOPT_option_flag ('e', 914 GNUNET_GETOPT_option_flag ('e',
915 "extract", 915 "extract",
916 gettext_noop ("print list of extracted keywords that would " 916 gettext_noop ("print list of extracted keywords that would "
diff --git a/src/fs/test_gnunet_fs_psd.py.in b/src/fs/test_gnunet_fs_psd.py.in
index d5a036c28..a1e4db9d5 100755
--- a/src/fs/test_gnunet_fs_psd.py.in
+++ b/src/fs/test_gnunet_fs_psd.py.in
@@ -18,7 +18,7 @@
18# SPDX-License-Identifier: AGPL3.0-or-later 18# SPDX-License-Identifier: AGPL3.0-or-later
19# 19#
20# Testcase for file-sharing command-line tools (publish, search, download) 20# Testcase for file-sharing command-line tools (publish, search, download)
21from __future__ import print_function 21
22import sys 22import sys
23import os 23import os
24import subprocess 24import subprocess
diff --git a/src/fs/test_gnunet_fs_rec.py.in b/src/fs/test_gnunet_fs_rec.py.in
index 59063a9ee..0f881564f 100755
--- a/src/fs/test_gnunet_fs_rec.py.in
+++ b/src/fs/test_gnunet_fs_rec.py.in
@@ -11,7 +11,7 @@
11# WITHOUT ANY WARRANTY; without even the implied warranty of 11# WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13# Affero General Public License for more details. 13# Affero General Public License for more details.
14# 14#
15# You should have received a copy of the GNU Affero General Public License 15# You should have received a copy of the GNU Affero General Public License
16# along with this program. If not, see <http://www.gnu.org/licenses/>. 16# along with this program. If not, see <http://www.gnu.org/licenses/>.
17# 17#
@@ -65,7 +65,7 @@ tar.extractall()
65# first, basic publish-search-download run 65# first, basic publish-search-download run
66try: 66try:
67 pub = pexpect() 67 pub = pexpect()
68 pub.spawn(None, [publish, '-c', 'test_gnunet_fs_rec_data.conf', '-d', '-k', 'testdir', 'dir/'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) 68 pub.spawn(None, [publish, '-c', 'test_gnunet_fs_rec_data.conf', '-k', 'testdir', 'dir/'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
69 # Can't say much for publishing, except that the last one is the toplevel directory 69 # Can't say much for publishing, except that the last one is the toplevel directory
70 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n")) 70 pub.expect("stdout", re.compile(r"Publishing `.+' done\.\r?\n"))
71 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n")) 71 pub.expect("stdout", re.compile(r"URI is `gnunet://fs/chk/[A-Z0-9]{103}\.[A-Z0-9]{103}\.\d+'\.\r?\n"))
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index 434d50f34..6ebbbcaff 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -89,9 +89,16 @@ bin_PROGRAMS += gnunet-bcd
89endif 89endif
90endif 90endif
91 91
92if HAVE_MHD
93if HAVE_JSON
94REST_PLUGIN = libgnunet_plugin_rest_gns.la
95endif
96endif
97
92plugin_LTLIBRARIES = \ 98plugin_LTLIBRARIES = \
93 libgnunet_plugin_block_gns.la \ 99 libgnunet_plugin_block_gns.la \
94 libgnunet_plugin_gnsrecord_gns.la 100 libgnunet_plugin_gnsrecord_gns.la \
101 $(REST_PLUGIN)
95 102
96 103
97bin_SCRIPTS = \ 104bin_SCRIPTS = \
@@ -104,6 +111,21 @@ gnunet-gns-proxy-setup-ca: gnunet-gns-proxy-setup-ca.in Makefile
104 $(do_subst) < $(srcdir)/gnunet-gns-proxy-setup-ca.in > gnunet-gns-proxy-setup-ca 111 $(do_subst) < $(srcdir)/gnunet-gns-proxy-setup-ca.in > gnunet-gns-proxy-setup-ca
105 chmod +x gnunet-gns-proxy-setup-ca 112 chmod +x gnunet-gns-proxy-setup-ca
106 113
114
115libgnunet_plugin_rest_gns_la_SOURCES = \
116 plugin_rest_gns.c
117libgnunet_plugin_rest_gns_la_LIBADD = \
118 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
119 libgnunetgns.la \
120 $(top_builddir)/src/rest/libgnunetrest.la \
121 $(top_builddir)/src/identity/libgnunetidentity.la \
122 $(top_builddir)/src/json/libgnunetjson.la \
123 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
124 $(LTLIBINTL) -ljansson -lmicrohttpd
125libgnunet_plugin_rest_gns_la_LDFLAGS = \
126 $(GN_PLUGIN_LDFLAGS)
127
128
107libgnunet_plugin_gnsrecord_gns_la_SOURCES = \ 129libgnunet_plugin_gnsrecord_gns_la_SOURCES = \
108 plugin_gnsrecord_gns.c 130 plugin_gnsrecord_gns.c
109libgnunet_plugin_gnsrecord_gns_la_LIBADD = \ 131libgnunet_plugin_gnsrecord_gns_la_LIBADD = \
diff --git a/src/gns/gns.conf.in b/src/gns/gns.conf.in
index 2e6a02b07..3252e4888 100644
--- a/src/gns/gns.conf.in
+++ b/src/gns/gns.conf.in
@@ -32,6 +32,8 @@ INTERCEPT_DNS = NO
32BINARY = gnunet-gns-proxy 32BINARY = gnunet-gns-proxy
33START_ON_DEMAND = NO 33START_ON_DEMAND = NO
34RUN_PER_USER = YES 34RUN_PER_USER = YES
35BIND_TO=127.0.0.1
36BIND_TO6=::1
35 37
36# Where is the certificate for the GNS proxy stored? 38# Where is the certificate for the GNS proxy stored?
37PROXY_CACERT = $GNUNET_DATA_HOME/gns/gns_ca_cert.pem 39PROXY_CACERT = $GNUNET_DATA_HOME/gns/gns_ca_cert.pem
@@ -42,6 +44,8 @@ PROXY_UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-gns-proxy.sock
42BINARY = gnunet-dns2gns 44BINARY = gnunet-dns2gns
43START_ON_DEMAND = NO 45START_ON_DEMAND = NO
44RUN_PER_USER = YES 46RUN_PER_USER = YES
47BIND_TO=127.0.0.1
48BIND_TO6=::1
45 49
46# -d: DNS resolver to use, -s: suffix to use, -f: fcfs suffix to use 50# -d: DNS resolver to use, -s: suffix to use, -f: fcfs suffix to use
47OPTIONS = -d 8.8.8.8 51OPTIONS = -d 8.8.8.8
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c
index 68d090579..d2eabf02c 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -92,6 +92,17 @@ struct Request
92 uint16_t original_request_id; 92 uint16_t original_request_id;
93}; 93};
94 94
95/**
96 * The address to bind to
97 */
98static in_addr_t address;
99
100/**
101 * The IPv6 address to bind to
102 */
103static struct in6_addr address6;
104
105
95 106
96/** 107/**
97 * Handle to GNS resolver. 108 * Handle to GNS resolver.
@@ -578,6 +589,7 @@ run (void *cls,
578 const char *cfgfile, 589 const char *cfgfile,
579 const struct GNUNET_CONFIGURATION_Handle *c) 590 const struct GNUNET_CONFIGURATION_Handle *c)
580{ 591{
592 char *addr_str;
581 (void) cls; 593 (void) cls;
582 (void) args; 594 (void) args;
583 (void) cfgfile; 595 (void) cfgfile;
@@ -602,6 +614,52 @@ run (void *cls,
602 gns = NULL; 614 gns = NULL;
603 return; 615 return;
604 } 616 }
617
618 /* Get address to bind to */
619 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (c, "dns2gns",
620 "BIND_TO",
621 &addr_str))
622 {
623 //No address specified
624 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
625 "Don't know what to bind to...\n");
626 GNUNET_free (addr_str);
627 GNUNET_SCHEDULER_shutdown ();
628 return;
629 }
630 if (1 != inet_pton (AF_INET, addr_str, &address))
631 {
632 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
633 "Unable to parse address %s\n",
634 addr_str);
635 GNUNET_free (addr_str);
636 GNUNET_SCHEDULER_shutdown ();
637 return;
638 }
639 GNUNET_free (addr_str);
640 /* Get address to bind to */
641 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (c, "dns2gns",
642 "BIND_TO6",
643 &addr_str))
644 {
645 //No address specified
646 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
647 "Don't know what to bind6 to...\n");
648 GNUNET_free (addr_str);
649 GNUNET_SCHEDULER_shutdown ();
650 return;
651 }
652 if (1 != inet_pton (AF_INET6, addr_str, &address6))
653 {
654 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
655 "Unable to parse IPv6 address %s\n",
656 addr_str);
657 GNUNET_free (addr_str);
658 GNUNET_SCHEDULER_shutdown ();
659 return;
660 }
661 GNUNET_free (addr_str);
662
605 listen_socket4 = GNUNET_NETWORK_socket_create (PF_INET, 663 listen_socket4 = GNUNET_NETWORK_socket_create (PF_INET,
606 SOCK_DGRAM, 664 SOCK_DGRAM,
607 IPPROTO_UDP); 665 IPPROTO_UDP);
@@ -611,6 +669,7 @@ run (void *cls,
611 669
612 memset (&v4, 0, sizeof (v4)); 670 memset (&v4, 0, sizeof (v4));
613 v4.sin_family = AF_INET; 671 v4.sin_family = AF_INET;
672 v4.sin_addr.s_addr = address;
614#if HAVE_SOCKADDR_IN_SIN_LEN 673#if HAVE_SOCKADDR_IN_SIN_LEN
615 v4.sin_len = sizeof (v4); 674 v4.sin_len = sizeof (v4);
616#endif 675#endif
@@ -634,6 +693,7 @@ run (void *cls,
634 693
635 memset (&v6, 0, sizeof (v6)); 694 memset (&v6, 0, sizeof (v6));
636 v6.sin6_family = AF_INET6; 695 v6.sin6_family = AF_INET6;
696 v6.sin6_addr = address6;
637#if HAVE_SOCKADDR_IN_SIN_LEN 697#if HAVE_SOCKADDR_IN_SIN_LEN
638 v6.sin6_len = sizeof (v6); 698 v6.sin6_len = sizeof (v6);
639#endif 699#endif
diff --git a/src/gns/gnunet-gns-proxy-setup-ca.in b/src/gns/gnunet-gns-proxy-setup-ca.in
index 0a6fab18a..184da4853 100644
--- a/src/gns/gnunet-gns-proxy-setup-ca.in
+++ b/src/gns/gnunet-gns-proxy-setup-ca.in
@@ -1,78 +1,252 @@
1#!/bin/sh 1#!/bin/sh
2# This shell script will generate an X509 certificate for your gnunet-gns-proxy
3# and install it (for both GNUnet and your browser).
4# 2#
3# This shell script will generate an X509 certificate for
4# your gnunet-gns-proxy and install it (for both GNUnet
5# and your browser).
6#
7# TODO: Implement support for more browsers
8# TODO: Debug and switch to the new version
9# TODO - The only remaining task is fixing the getopts
10# TODO: Error checks
11#
12# The current version partially reuses and recycles
13# code from build.sh by NetBSD (although not entirely
14# used because it needs debugging):
15#
16# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
17# All rights reserved.
18#
19# This code is derived from software contributed to
20# The NetBSD Foundation by Todd Vierling and Luke Mewburn.
21
22# Redistribution and use in source and binary forms, with or
23# without modification, are permitted provided that the following
24# conditions are met:
25# 1. Redistributions of source code must retain the above
26# copyright notice, this list of conditions and the following
27# disclaimer.
28# 2. Redistributions in binary form must reproduce the above
29# copyright notice, this list of conditions and the following
30# disclaimer in the documentation and/or other materials
31# provided with the distribution.
5 32
6OPENSSLCFG=@pkgdatadir@/openssl.cnf 33# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
7if ! which openssl > /dev/null 34# CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
8then 35# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
9 echo "'openssl' command not found. Please install it." 36# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
10 exit 1 37# DISCLAIMED.
11fi 38# IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR
12 39# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
13echo "Generating CA" 40# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
14options='' 41# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
15while getopts "c:" opt; do 42# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
16 case $opt in 43# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
17 c) 44# LIABILITY, OR TORT
18 options="$options -c $OPTARG" 45# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
19 ;; 46# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
20 \?) 47# OF SUCH DAMAGE.
21 echo "Invalid option: -$OPTARG" >&2 48
22 exit 1 49progname=${0##*/}
23 ;; 50
24 :) 51setdefaults()
25 echo "Option -$OPTARG requires an argument." >&2 52{
26 exit 1 53 verbosity=0
27 ;; 54 runcmd=
28 esac 55}
29done 56
30 57statusmsg()
31GNSCERT=`mktemp /tmp/gnscertXXXXXX.pem` 58{
32GNSCAKY=`mktemp /tmp/gnscakeyXXXXXX.pem` 59 ${runcmd} echo " $@"
33GNSCANO=`mktemp /tmp/gnscakeynoencXXXXXX.pem` 60}
34GNS_CA_CERT_PEM=`gnunet-config -s gns-proxy -o PROXY_CACERT -f $options` 61
35mkdir -p `dirname $GNS_CA_CERT_PEM` 62infomsg()
36 63{
37openssl req -config $OPENSSLCFG -new -x509 -days 3650 -extensions v3_ca -keyout $GNSCAKY -out $GNSCERT -subj "/C=ZZ/L=World/O=GNU/OU=GNUnet/CN=GNS Proxy CA/emailAddress=bounce@gnunet.org" -passout pass:"GNU Name System" 64 if [ $verbosity = 1 ]; then
38 65 statusmsg "INFO: $@"
39echo "Removing passphrase from key"
40openssl rsa -passin pass:"GNU Name System" -in $GNSCAKY -out $GNSCANO
41
42echo "Making private key available to gnunet-gns-proxy"
43cat $GNSCERT $GNSCANO > $GNS_CA_CERT_PEM
44
45if ! which certutil > /dev/null
46then
47 echo "The 'certutil' command was not found. Not importing into browsers."
48 echo "For 'certutil' install nss."
49else
50 echo "Importing CA into browsers"
51 for f in ~/.mozilla/firefox/*.*/
52 do
53 if [ -d $f ]; then
54 echo "Importing CA info Firefox at $f"
55 # delete old certificate (if any)
56 certutil -D -n "GNS Proxy CA" -d "$f" >/dev/null 2>/dev/null
57 # add new certificate
58 certutil -A -n "GNS Proxy CA" -t CT,, -d "$f" < $GNSCERT
59 fi 66 fi
60 done 67}
61 68
62 if [ -d ~/.pki/nssdb/ ]; then 69warningmsg()
63 echo "Importing CA into Chrome at ~/.pki/nssdb/" 70{
64 # delete old certificate (if any) 71 statusmsg "WARNING: $@"
65 certutil -D -n "GNS Proxy CA" -d ~/.pki/nssdb/ >/dev/null 2>/dev/null 72}
66 # add new certificate 73
67 certutil -A -n "GNS Proxy CA" -t CT,, -d ~/.pki/nssdb/ < $GNSCERT 74errormsg()
68 fi 75{
69fi 76 statusmsg "ERROR: $@"
70 77}
71echo "Cleaning up." 78
72rm -f $GNSCAKY $GNSCANO $GNSCERT 79linemsg()
73 80{
74echo "===================================" 81 statusmsg "========================================="
75echo "You can now start gnunet-gns-proxy." 82}
76echo "Afterwards, configure your browser " 83
77echo " to use a SOCKS proxy on port 7777." 84
78echo "===================================" 85usage()
86{
87 if [ -n "$*" ]; then
88 echo ""
89 echo "${progname}: $*"
90 fi
91 cat <<_usage_
92
93Usage: ${progname} [-hv] [-c FILE] [...]
94
95Options:
96 -c FILE Use the configuration file FILE.
97 -h Print this help message.
98 -v Print the version and exit.
99 -V be verbose
100
101_usage_
102 exit 1
103}
104
105
106generate_ca()
107{
108 echo ""
109 infomsg "Generating CA"
110 TMPDIR=${TMPDIR:-/tmp}
111 if [ -e "$TMPDIR" ]; then
112 GNSCERT=`mktemp -t certXXXXXXXX.pem` || exit 1
113 GNSCAKY=`mktemp -t cakyXXXXXXXX.pem` || exit 1
114 GNSCANO=`mktemp -t canoXXXXXXXX.pem` || exit 1
115 else
116 # This warning is mostly pointless.
117 warning "You need to export the TMPDIR variable"
118 fi
119
120 # # ------------- gnutls
121 #
122 # if ! which certutil > /dev/null
123 # then
124 # warningmsg "The 'certutil' command was not found."
125 # warningmsg "Not importing into browsers."
126 # warningmsg "For 'certutil' install nss."
127 # else
128 # # Generate CA key
129 # # pkcs#8 password-protects key
130 # certtool --pkcs8 --generate-privkey --sec-param high --outfile ca-key.pem
131 # # self-sign the CA to create public certificate
132 # certtool --generate-self-signed --load-privkey ca-key.pem --template ca.cfg --outfile ca.pem
133
134 # ------------- openssl
135
136 OPENSSLCFG=@pkgdatadir@/openssl.cnf
137 if test -z "`openssl version`" > /dev/null
138 then
139 warningmsg "'openssl' command not found. Please install it."
140 infomsg "Cleaning up."
141 rm -f $GNSCAKY $GNSCANO $GNSCERT
142 exit 1
143 fi
144 if [ -n "${GNUNET_CONFIG_FILE}" ]; then
145 GNUNET_CONFIG="-c ${GNUNET_CONFIG_FILE}"
146 else
147 GNUNET_CONFIG=""
148 fi
149 GNS_CA_CERT_PEM=`gnunet-config ${GNUNET_CONFIG} -s gns-proxy -o PROXY_CACERT -f ${options}`
150 mkdir -p `dirname $GNS_CA_CERT_PEM`
151
152 openssl req -config $OPENSSLCFG -new -x509 -days 3650 -extensions v3_ca -keyout $GNSCAKY -out $GNSCERT -subj "/C=ZZ/L=World/O=GNU/OU=GNUnet/CN=GNS Proxy CA/emailAddress=bounce@gnunet.org" -passout pass:"GNU Name System"
153
154 infomsg "Removing passphrase from key"
155 openssl rsa -passin pass:"GNU Name System" -in $GNSCAKY -out $GNSCANO
156
157 infomsg "Making private key available to gnunet-gns-proxy"
158 cat $GNSCERT $GNSCANO > $GNS_CA_CERT_PEM
159}
160
161importbrowsers()
162{
163 # Don't check with -H, -H defies any method to not
164 # print the output on screen! Let's hope that every
165 # certutil gets build with some kind of build flags
166 # which end up being printed here:
167 if test -z "`certutil --build-flags`" > /dev/null 2>&1
168 then
169 warningmsg "The 'certutil' command was not found."
170 warningmsg "Not importing into browsers."
171 warningmsg "For 'certutil' install nss."
172 else
173 infomsg "Importing CA into browsers"
174 # TODO: Error handling?
175 for f in ~/.mozilla/firefox/*.*/
176 do
177 if [ -d $f ]; then
178 infomsg "Importing CA into Firefox at $f"
179 # delete old certificate (if any)
180 certutil -D -n "GNS Proxy CA" -d "$f" >/dev/null 2>/dev/null
181 # add new certificate
182 certutil -A -n "GNS Proxy CA" -t CT,, -d "$f" < $GNSCERT
183 fi
184 done
185 # TODO: Error handling?
186 if [ -d ~/.pki/nssdb/ ]; then
187 infomsg "Importing CA into Chrome at ~/.pki/nssdb/"
188 # delete old certificate (if any)
189 certutil -D -n "GNS Proxy CA" -d ~/.pki/nssdb/ >/dev/null 2>/dev/null
190 # add new certificate
191 certutil -A -n "GNS Proxy CA" -t CT,, -d ~/.pki/nssdb/ < $GNSCERT
192 fi
193 fi
194}
195
196print_version()
197{
198 GNUNET_ARM_VERSION=`gnunet-arm -v`
199 echo $GNUNET_ARM_VERSION
200}
201
202clean_up()
203{
204 infomsg "Cleaning up."
205 rm -f $GNSCAKY $GNSCANO $GNSCERT
206 if [ -e $SETUP_TMPDIR ]; then
207 rm -rf $SETUP_TMPDIR
208 fi
209
210 linemsg
211 statusmsg "You can now start gnunet-gns-proxy."
212 statusmsg "Afterwards, configure your browser "
213 statusmsg "to use a SOCKS proxy on port 7777. "
214 linemsg
215}
216
217main()
218{
219 while getopts "vhVc:" opt; do
220 case $opt in
221 v)
222 print_version
223 exit 0
224 ;;
225 h)
226 usage
227 ;;
228 V)
229 verbosity=1
230 ;;
231 c)
232 options="$options -c $OPTARG"
233 infomsg "Using configuration file $OPTARG"
234 GNUNET_CONFIG_FILE=${OPTARG}
235 ;;
236 \?)
237 echo "Invalid option: -$OPTARG" >&2
238 usage
239 ;;
240 :)
241 echo "Option -$OPTARG requires an argument." >&2
242 usage
243 ;;
244 esac
245 done
246 setdefaults
247 generate_ca
248 importbrowsers
249 clean_up
250}
251
252main "$@"
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index 65a7b6018..bae222499 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -661,6 +661,15 @@ struct Socks5Request
661 661
662/* *********************** Globals **************************** */ 662/* *********************** Globals **************************** */
663 663
664/**
665 * The address to bind to
666 */
667static in_addr_t address;
668
669/**
670 * The IPv6 address to bind to
671 */
672static struct in6_addr address6;
664 673
665/** 674/**
666 * The port the proxy is running on (default 7777) 675 * The port the proxy is running on (default 7777)
@@ -2182,7 +2191,7 @@ create_response (void *cls,
2182 } 2191 }
2183 MHD_get_connection_values (con, 2192 MHD_get_connection_values (con,
2184 MHD_HEADER_KIND, 2193 MHD_HEADER_KIND,
2185 &con_val_iter, 2194 (MHD_KeyValueIterator) &con_val_iter,
2186 s5r); 2195 s5r);
2187 curl_easy_setopt (s5r->curl, 2196 curl_easy_setopt (s5r->curl,
2188 CURLOPT_HTTPHEADER, 2197 CURLOPT_HTTPHEADER,
@@ -3516,6 +3525,7 @@ bind_v4 ()
3516 memset (&sa4, 0, sizeof (sa4)); 3525 memset (&sa4, 0, sizeof (sa4));
3517 sa4.sin_family = AF_INET; 3526 sa4.sin_family = AF_INET;
3518 sa4.sin_port = htons (port); 3527 sa4.sin_port = htons (port);
3528 sa4.sin_addr.s_addr = address;
3519#if HAVE_SOCKADDR_IN_SIN_LEN 3529#if HAVE_SOCKADDR_IN_SIN_LEN
3520 sa4.sin_len = sizeof (sa4); 3530 sa4.sin_len = sizeof (sa4);
3521#endif 3531#endif
@@ -3553,6 +3563,7 @@ bind_v6 ()
3553 memset (&sa6, 0, sizeof (sa6)); 3563 memset (&sa6, 0, sizeof (sa6));
3554 sa6.sin6_family = AF_INET6; 3564 sa6.sin6_family = AF_INET6;
3555 sa6.sin6_port = htons (port); 3565 sa6.sin6_port = htons (port);
3566 sa6.sin6_addr = address6;
3556#if HAVE_SOCKADDR_IN_SIN_LEN 3567#if HAVE_SOCKADDR_IN_SIN_LEN
3557 sa6.sin6_len = sizeof (sa6); 3568 sa6.sin6_len = sizeof (sa6);
3558#endif 3569#endif
@@ -3591,10 +3602,56 @@ run (void *cls,
3591{ 3602{
3592 char* cafile_cfg = NULL; 3603 char* cafile_cfg = NULL;
3593 char* cafile; 3604 char* cafile;
3605 char* addr_str;
3594 struct MhdHttpList *hd; 3606 struct MhdHttpList *hd;
3595 3607
3596 cfg = c; 3608 cfg = c;
3597 3609
3610 /* Get address to bind to */
3611 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "gns-proxy",
3612 "BIND_TO",
3613 &addr_str))
3614 {
3615 //No address specified
3616 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3617 "Don't know what to bind to...\n");
3618 GNUNET_free (addr_str);
3619 GNUNET_SCHEDULER_shutdown ();
3620 return;
3621 }
3622 if (1 != inet_pton (AF_INET, addr_str, &address))
3623 {
3624 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3625 "Unable to parse address %s\n",
3626 addr_str);
3627 GNUNET_free (addr_str);
3628 GNUNET_SCHEDULER_shutdown ();
3629 return;
3630 }
3631 GNUNET_free (addr_str);
3632 /* Get address to bind to */
3633 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "gns-proxy",
3634 "BIND_TO6",
3635 &addr_str))
3636 {
3637 //No address specified
3638 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3639 "Don't know what to bind6 to...\n");
3640 GNUNET_free (addr_str);
3641 GNUNET_SCHEDULER_shutdown ();
3642 return;
3643 }
3644 if (1 != inet_pton (AF_INET6, addr_str, &address6))
3645 {
3646 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
3647 "Unable to parse IPv6 address %s\n",
3648 addr_str);
3649 GNUNET_free (addr_str);
3650 GNUNET_SCHEDULER_shutdown ();
3651 return;
3652 }
3653 GNUNET_free (addr_str);
3654
3598 if (NULL == (curl_multi = curl_multi_init ())) 3655 if (NULL == (curl_multi = curl_multi_init ()))
3599 { 3656 {
3600 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 3657 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
diff --git a/src/rest-plugins/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index e41df4085..e41df4085 100644
--- a/src/rest-plugins/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
diff --git a/src/gns/test_gns_at_lookup.sh b/src/gns/test_gns_at_lookup.sh
index d900c070b..bacc63eb0 100755
--- a/src/gns/test_gns_at_lookup.sh
+++ b/src/gns/test_gns_at_lookup.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4 4
@@ -14,7 +14,7 @@ then
14 exit 77 14 exit 77
15fi 15fi
16 16
17which timeout &> /dev/null && DO_TIMEOUT="timeout 5" 17which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5"
18rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 18rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
19 19
20TEST_IP="127.0.0.1" 20TEST_IP="127.0.0.1"
@@ -31,7 +31,7 @@ gnunet-namestore -z delegatedego -d -n '@' -t A -V $TEST_IP -e never -c test_gn
31gnunet-arm -e -c test_gns_lookup.conf 31gnunet-arm -e -c test_gns_lookup.conf
32rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 32rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
33 33
34if [ "$RES_IP" == "$TEST_IP" ] 34if [ "$RES_IP" = "$TEST_IP" ]
35then 35then
36 exit 0 36 exit 0
37else 37else
diff --git a/src/gns/test_gns_cname_lookup.sh b/src/gns/test_gns_cname_lookup.sh
index de575c561..d97a4fe5e 100755
--- a/src/gns/test_gns_cname_lookup.sh
+++ b/src/gns/test_gns_cname_lookup.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4 4
@@ -16,7 +16,7 @@ fi
16 16
17# permissive DNS resolver we will use for the test 17# permissive DNS resolver we will use for the test
18DNS_RESOLVER="8.8.8.8" 18DNS_RESOLVER="8.8.8.8"
19if ! nslookup gnunet.org $DNS_RESOLVER &> /dev/null 19if ! nslookup gnunet.org $DNS_RESOLVER > /dev/null 2>&1
20then 20then
21 echo "Cannot reach DNS, skipping test" 21 echo "Cannot reach DNS, skipping test"
22 exit 77 22 exit 77
@@ -36,7 +36,7 @@ TEST_RECORD_NAME_DNS="www3"
36MY_EGO="myego" 36MY_EGO="myego"
37TEST_DOMAIN_PLUS="www.$MY_EGO" 37TEST_DOMAIN_PLUS="www.$MY_EGO"
38TEST_DOMAIN_DNS="www3.$MY_EGO" 38TEST_DOMAIN_DNS="www3.$MY_EGO"
39which timeout &> /dev/null && DO_TIMEOUT="timeout 15" 39which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15"
40 40
41gnunet-arm -s -c test_gns_lookup.conf 41gnunet-arm -s -c test_gns_lookup.conf
42gnunet-identity -C $MY_EGO -c test_gns_lookup.conf 42gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
@@ -57,7 +57,7 @@ rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
57# make cmp case-insensitive by converting to lower case first 57# make cmp case-insensitive by converting to lower case first
58RES_CNAME_RAW=`echo $RES_CNAME_RAW | tr [A-Z] [a-z]` 58RES_CNAME_RAW=`echo $RES_CNAME_RAW | tr [A-Z] [a-z]`
59TESTEGOZONE=`echo $TESTEGOZONE | tr [A-Z] [a-z]` 59TESTEGOZONE=`echo $TESTEGOZONE | tr [A-Z] [a-z]`
60if [ "$RES_CNAME_RAW" == "server.$TESTEGOZONE" ] 60if [ "$RES_CNAME_RAW" = "server.$TESTEGOZONE" ]
61then 61then
62 echo "PASS: CNAME resolution from GNS" 62 echo "PASS: CNAME resolution from GNS"
63else 63else
@@ -65,7 +65,7 @@ else
65 exit 1 65 exit 1
66fi 66fi
67 67
68if [ "$RES_CNAME" == "$TEST_IP_PLUS" ] 68if [ "$RES_CNAME" = "$TEST_IP_PLUS" ]
69then 69then
70 echo "PASS: IP resolution from GNS" 70 echo "PASS: IP resolution from GNS"
71else 71else
@@ -73,7 +73,7 @@ else
73 exit 1 73 exit 1
74fi 74fi
75 75
76if [ "$RES_CNAME_DNS" == "$TEST_IP_DNS" ] 76if [ "$RES_CNAME_DNS" = "$TEST_IP_DNS" ]
77then 77then
78 echo "PASS: IP resolution from DNS" 78 echo "PASS: IP resolution from DNS"
79 exit 0 79 exit 0
diff --git a/src/gns/test_gns_config_lookup.sh b/src/gns/test_gns_config_lookup.sh
index 35d7c32d9..1c5a62b01 100755
--- a/src/gns/test_gns_config_lookup.sh
+++ b/src/gns/test_gns_config_lookup.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4 4
@@ -18,7 +18,7 @@ MY_EGO="myego"
18rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` 18rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f`
19CFG=`mktemp --tmpdir=$PWD` 19CFG=`mktemp --tmpdir=$PWD`
20cp test_gns_lookup.conf $CFG || exit 77 20cp test_gns_lookup.conf $CFG || exit 77
21which timeout &> /dev/null && DO_TIMEOUT="timeout 5" 21which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5"
22TEST_IP="dead::beef" 22TEST_IP="dead::beef"
23gnunet-arm -s -c $CFG || exit 77 23gnunet-arm -s -c $CFG || exit 77
24gnunet-identity -C $MY_EGO -c $CFG 24gnunet-identity -C $MY_EGO -c $CFG
@@ -35,7 +35,7 @@ gnunet-arm -e -c $CFG
35rm -rf `gnunet-config -c $CFG -f -s paths -o GNUNET_TEST_HOME` 35rm -rf `gnunet-config -c $CFG -f -s paths -o GNUNET_TEST_HOME`
36rm $CFG 36rm $CFG
37 37
38if [ "$RES_IP" == "$TEST_IP" ] 38if [ "$RES_IP" = "$TEST_IP" ]
39then 39then
40 exit 0 40 exit 0
41else 41else
diff --git a/src/gns/test_gns_delegated_lookup.sh b/src/gns/test_gns_delegated_lookup.sh
index 21774ad8d..af9994b34 100755
--- a/src/gns/test_gns_delegated_lookup.sh
+++ b/src/gns/test_gns_delegated_lookup.sh
@@ -1,7 +1,7 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 4which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
5 5
6LOCATION=$(which gnunet-config) 6LOCATION=$(which gnunet-config)
7if [ -z $LOCATION ] 7if [ -z $LOCATION ]
@@ -35,7 +35,7 @@ gnunet-arm -e -c test_gns_lookup.conf
35 35
36rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 36rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
37 37
38if [ "$RES_IP" == "$TEST_IP" ] 38if [ "$RES_IP" = "$TEST_IP" ]
39then 39then
40 exit 0 40 exit 0
41else 41else
diff --git a/src/gns/test_gns_dht_lookup.sh b/src/gns/test_gns_dht_lookup.sh
index 07e559752..ac90d58a8 100755
--- a/src/gns/test_gns_dht_lookup.sh
+++ b/src/gns/test_gns_dht_lookup.sh
@@ -1,7 +1,7 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 4which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
5 5
6LOCATION=$(which gnunet-config) 6LOCATION=$(which gnunet-config)
7if [ -z $LOCATION ] 7if [ -z $LOCATION ]
@@ -55,7 +55,7 @@ then
55 echo "Failed to resolve to proper IP, got $RES_IP_REL. (relative expiration)" 55 echo "Failed to resolve to proper IP, got $RES_IP_REL. (relative expiration)"
56 #exit 1 56 #exit 1
57fi 57fi
58if [ "$RES_IP" == "$TEST_IP" ] 58if [ "$RES_IP" = "$TEST_IP" ]
59then 59then
60 exit 0 60 exit 0
61else 61else
diff --git a/src/gns/test_gns_gns2dns_cname_lookup.sh b/src/gns/test_gns_gns2dns_cname_lookup.sh
index c07905d83..fbc1dd7ee 100755
--- a/src/gns/test_gns_gns2dns_cname_lookup.sh
+++ b/src/gns/test_gns_gns2dns_cname_lookup.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4 4
@@ -25,7 +25,7 @@ TEST_RECORD_NAME="homepage"
25 25
26XNS=ns.joker.com 26XNS=ns.joker.com
27 27
28if ! nslookup gnunet.org a.$XNS &> /dev/null 28if ! nslookup gnunet.org a.$XNS > /dev/null 2>&1
29then 29then
30 echo "Cannot reach DNS, skipping test" 30 echo "Cannot reach DNS, skipping test"
31 exit 77 31 exit 77
@@ -43,7 +43,7 @@ MY_EGO="myego"
43# various names we will use for resolution 43# various names we will use for resolution
44TEST_DOMAIN="www.${TEST_RECORD_NAME}.$MY_EGO" 44TEST_DOMAIN="www.${TEST_RECORD_NAME}.$MY_EGO"
45 45
46which timeout &> /dev/null && DO_TIMEOUT="timeout 15" 46which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15"
47 47
48gnunet-arm -s -c test_gns_lookup.conf 48gnunet-arm -s -c test_gns_lookup.conf
49OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf gnunet.org` 49OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf gnunet.org`
@@ -77,7 +77,7 @@ gnunet-arm -e -c test_gns_lookup.conf
77rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 77rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
78 78
79ret=0 79ret=0
80if [ "$RES_IP" == "$TEST_IP" ] 80if [ "$RES_IP" = "$TEST_IP" ]
81then 81then
82 echo "PASS: Resolved $TEST_DOMAIN to $RES_IP." 82 echo "PASS: Resolved $TEST_DOMAIN to $RES_IP."
83else 83else
@@ -85,7 +85,7 @@ else
85 ret=1 85 ret=1
86fi 86fi
87 87
88if [ "$RES_IP6" == "$TEST_IP6" ] 88if [ "$RES_IP6" = "$TEST_IP6" ]
89then 89then
90 echo "PASS: Resolved $TEST_DOMAIN to $RES_IP6." 90 echo "PASS: Resolved $TEST_DOMAIN to $RES_IP6."
91else 91else
diff --git a/src/gns/test_gns_gns2dns_lookup.sh b/src/gns/test_gns_gns2dns_lookup.sh
index 24fb36b9d..22caa68ff 100755
--- a/src/gns/test_gns_gns2dns_lookup.sh
+++ b/src/gns/test_gns_gns2dns_lookup.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 2trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
3 3
4LOCATION=$(which gnunet-config) 4LOCATION=$(which gnunet-config)
@@ -26,7 +26,7 @@ TEST_IP_GNS2DNS="8.8.8.8"
26# main label used during resolution 26# main label used during resolution
27TEST_RECORD_NAME="homepage" 27TEST_RECORD_NAME="homepage"
28 28
29if ! nslookup gnunet.org $TEST_IP_GNS2DNS &> /dev/null 29if ! nslookup gnunet.org $TEST_IP_GNS2DNS > /dev/null 2>&1
30then 30then
31 echo "Cannot reach DNS, skipping test" 31 echo "Cannot reach DNS, skipping test"
32 exit 77 32 exit 77
@@ -44,7 +44,7 @@ TEST_DOMAIN="www.${TEST_RECORD_NAME}.$MY_EGO"
44TEST_DOMAIN_ALT="${TEST_RECORD_NAME}.$MY_EGO" 44TEST_DOMAIN_ALT="${TEST_RECORD_NAME}.$MY_EGO"
45TEST_DOMAIN_ALT2="docs.${TEST_RECORD_NAME}.$MY_EGO" 45TEST_DOMAIN_ALT2="docs.${TEST_RECORD_NAME}.$MY_EGO"
46 46
47which timeout &> /dev/null && DO_TIMEOUT="timeout 15" 47which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15"
48 48
49 49
50gnunet-arm -s -c test_gns_lookup.conf 50gnunet-arm -s -c test_gns_lookup.conf
@@ -83,7 +83,7 @@ gnunet-arm -e -c test_gns_lookup.conf
83rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 83rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
84 84
85ret=0 85ret=0
86if [ "$RES_IP" == "$TEST_IP" ] 86if [ "$RES_IP" = "$TEST_IP" ]
87then 87then
88 echo "PASS: Resolved $TEST_DOMAIN to $RES_IP." 88 echo "PASS: Resolved $TEST_DOMAIN to $RES_IP."
89else 89else
@@ -91,7 +91,7 @@ else
91 ret=1 91 ret=1
92fi 92fi
93 93
94if [ "$RES_IP6" == "$TEST_IP6" ] 94if [ "$RES_IP6" = "$TEST_IP6" ]
95then 95then
96 echo "PASS: Resolved $TEST_DOMAIN to $RES_IP6." 96 echo "PASS: Resolved $TEST_DOMAIN to $RES_IP6."
97else 97else
@@ -99,7 +99,7 @@ else
99 ret=1 99 ret=1
100fi 100fi
101 101
102if [ "$RES_IP_ALT" == "$TEST_IP" ] 102if [ "$RES_IP_ALT" = "$TEST_IP" ]
103then 103then
104 echo "PASS: Resolved $TEST_DOMAIN_ALT to $RES_IP_ALT." 104 echo "PASS: Resolved $TEST_DOMAIN_ALT to $RES_IP_ALT."
105else 105else
@@ -107,7 +107,7 @@ else
107 ret=1 107 ret=1
108fi 108fi
109 109
110if [ "$RES_IP_ALT2" == "$TEST_IP_ALT2" ] 110if [ "$RES_IP_ALT2" = "$TEST_IP_ALT2" ]
111then 111then
112 echo "PASS: Resolved $TEST_DOMAIN_ALT2 to $RES_IP_ALT2." 112 echo "PASS: Resolved $TEST_DOMAIN_ALT2 to $RES_IP_ALT2."
113else 113else
diff --git a/src/gns/test_gns_ipv6_lookup.sh b/src/gns/test_gns_ipv6_lookup.sh
index 72da5ee2c..5dbb34a2c 100755
--- a/src/gns/test_gns_ipv6_lookup.sh
+++ b/src/gns/test_gns_ipv6_lookup.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4 4
@@ -16,7 +16,7 @@ fi
16MY_EGO="myego" 16MY_EGO="myego"
17 17
18rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` 18rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f`
19which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 19which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
20TEST_IP="dead::beef" 20TEST_IP="dead::beef"
21gnunet-arm -s -c test_gns_lookup.conf 21gnunet-arm -s -c test_gns_lookup.conf
22gnunet-identity -C $MY_EGO -c test_gns_lookup.conf 22gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
@@ -27,7 +27,7 @@ gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
27gnunet-arm -e -c test_gns_lookup.conf 27gnunet-arm -e -c test_gns_lookup.conf
28rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 28rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
29 29
30if [ "$RES_IP" == "$TEST_IP" ] 30if [ "$RES_IP" = "$TEST_IP" ]
31then 31then
32 exit 0 32 exit 0
33else 33else
diff --git a/src/gns/test_gns_lookup.sh b/src/gns/test_gns_lookup.sh
index 2dffa1251..4bd6ae879 100755
--- a/src/gns/test_gns_lookup.sh
+++ b/src/gns/test_gns_lookup.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4 4
@@ -15,7 +15,7 @@ then
15fi 15fi
16 16
17rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` 17rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f`
18which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 18which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
19TEST_IP="127.0.0.1" 19TEST_IP="127.0.0.1"
20MY_EGO="myego" 20MY_EGO="myego"
21LABEL="www" 21LABEL="www"
@@ -27,7 +27,7 @@ gnunet-namestore -z $MY_EGO -d -n $LABEL -t A -V $TEST_IP -e never -c test_gns_l
27gnunet-identity -D $MY_EGO -c test_gns_lookup.conf 27gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
28gnunet-arm -e -c test_gns_lookup.conf 28gnunet-arm -e -c test_gns_lookup.conf
29 29
30if [ "$RES_IP" == "$TEST_IP" ] 30if [ "$RES_IP" = "$TEST_IP" ]
31then 31then
32 exit 0 32 exit 0
33else 33else
diff --git a/src/gns/test_gns_mx_lookup.sh b/src/gns/test_gns_mx_lookup.sh
index 79ac37b0a..4e9d98358 100755
--- a/src/gns/test_gns_mx_lookup.sh
+++ b/src/gns/test_gns_mx_lookup.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4 4
@@ -15,7 +15,7 @@ then
15fi 15fi
16 16
17rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 17rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
18which timeout &> /dev/null && DO_TIMEOUT="timeout 5" 18which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5"
19 19
20MY_EGO="myego" 20MY_EGO="myego"
21TEST_MX="5,mail.+" 21TEST_MX="5,mail.+"
@@ -35,7 +35,7 @@ rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
35RES_MX=`echo $RES_MX | tr [A-Z] [a-z]` 35RES_MX=`echo $RES_MX | tr [A-Z] [a-z]`
36WANT_MX=`echo $WANT_MX | tr [A-Z] [a-z]` 36WANT_MX=`echo $WANT_MX | tr [A-Z] [a-z]`
37 37
38if [ "$RES_MX" == "$WANT_MX" ] 38if [ "$RES_MX" = "$WANT_MX" ]
39then 39then
40 exit 0 40 exit 0
41else 41else
diff --git a/src/gns/test_gns_proxy.c b/src/gns/test_gns_proxy.c
index 75fe95617..2a7f8104b 100644
--- a/src/gns/test_gns_proxy.c
+++ b/src/gns/test_gns_proxy.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
@@ -50,9 +50,9 @@ static int global_ret;
50 50
51static struct MHD_Daemon *mhd; 51static struct MHD_Daemon *mhd;
52 52
53static struct GNUNET_SCHEDULER_Task * mhd_task_id; 53static struct GNUNET_SCHEDULER_Task *mhd_task_id;
54 54
55static struct GNUNET_SCHEDULER_Task * curl_task_id; 55static struct GNUNET_SCHEDULER_Task *curl_task_id;
56 56
57static CURL *curl; 57static CURL *curl;
58 58
@@ -349,6 +349,7 @@ curl_main ()
349static void 349static void
350start_curl (void *cls) 350start_curl (void *cls)
351{ 351{
352 curl_task_id = NULL;
352 GNUNET_asprintf (&url, 353 GNUNET_asprintf (&url,
353 "https://%s:%d/hello_world", 354 "https://%s:%d/hello_world",
354 TEST_DOMAIN, port); 355 TEST_DOMAIN, port);
@@ -369,7 +370,9 @@ start_curl (void *cls)
369 multi = curl_multi_init (); 370 multi = curl_multi_init ();
370 GNUNET_assert (multi != NULL); 371 GNUNET_assert (multi != NULL);
371 GNUNET_assert (CURLM_OK == curl_multi_add_handle (multi, curl)); 372 GNUNET_assert (CURLM_OK == curl_multi_add_handle (multi, curl));
372 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Beginning HTTP download from `%s'\n", url); 373 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
374 "Beginning HTTP download from `%s'\n",
375 url);
373 curl_main (); 376 curl_main ();
374} 377}
375 378
@@ -391,7 +394,8 @@ commence_testing (void *cls)
391{ 394{
392 curl_task_id = 395 curl_task_id =
393 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, 396 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS,
394 &start_curl, NULL); 397 &start_curl,
398 NULL);
395} 399}
396 400
397 401
@@ -561,4 +565,4 @@ main (int argc, char *const *argv)
561 return global_ret; 565 return global_ret;
562} 566}
563 567
564/* end of test_gns_vpn.c */ 568/* end of test_gns_proxy.c */
diff --git a/src/gns/test_gns_quickupdate.sh b/src/gns/test_gns_quickupdate.sh
index d9807fe22..d2b4bf2cb 100755
--- a/src/gns/test_gns_quickupdate.sh
+++ b/src/gns/test_gns_quickupdate.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4 4
@@ -19,7 +19,7 @@ OTHER_EGO="delegatedego"
19 19
20 20
21rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 21rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
22which timeout &> /dev/null && DO_TIMEOUT="timeout 5" 22which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5"
23TEST_IP="127.0.0.1" 23TEST_IP="127.0.0.1"
24gnunet-arm -s -c test_gns_lookup.conf 24gnunet-arm -s -c test_gns_lookup.conf
25gnunet-identity -C $MY_EGO -c test_gns_lookup.conf 25gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
@@ -56,7 +56,7 @@ gnunet-identity -D $OTHER_EGO -c test_gns_lookup.conf
56gnunet-arm -e -c test_gns_lookup.conf 56gnunet-arm -e -c test_gns_lookup.conf
57rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 57rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
58 58
59if [ "$RES_IP" == "$TEST_IP" ] 59if [ "$RES_IP" = "$TEST_IP" ]
60then 60then
61 exit 0 61 exit 0
62else 62else
diff --git a/src/gns/test_gns_rel_expiration.sh b/src/gns/test_gns_rel_expiration.sh
index c7c66bc27..993c2131e 100755
--- a/src/gns/test_gns_rel_expiration.sh
+++ b/src/gns/test_gns_rel_expiration.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4 4
@@ -25,7 +25,7 @@ MY_EGO="myego"
25OTHER_EGO="delegatedego" 25OTHER_EGO="delegatedego"
26 26
27rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 27rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
28which timeout &> /dev/null && DO_TIMEOUT="timeout 5" 28which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5"
29TEST_IP="127.0.0.1" 29TEST_IP="127.0.0.1"
30gnunet-arm -s -c test_gns_lookup.conf 30gnunet-arm -s -c test_gns_lookup.conf
31gnunet-identity -C $MY_EGO -c test_gns_lookup.conf 31gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
@@ -48,13 +48,13 @@ gnunet-identity -D $OTHER_EGO -c test_gns_lookup.conf
48gnunet-arm -e -c test_gns_lookup.conf 48gnunet-arm -e -c test_gns_lookup.conf
49rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 49rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
50 50
51if [ "$RES_IP_EXP" == "$TEST_IP" ] 51if [ "$RES_IP_EXP" = "$TEST_IP" ]
52then 52then
53 echo "Failed to properly expire IP, got $RES_IP_EXP." 53 echo "Failed to properly expire IP, got $RES_IP_EXP."
54 exit 1 54 exit 1
55fi 55fi
56 56
57if [ "$RES_IP" == "$TEST_IP" ] 57if [ "$RES_IP" = "$TEST_IP" ]
58then 58then
59 exit 0 59 exit 0
60else 60else
diff --git a/src/gns/test_gns_revocation.sh b/src/gns/test_gns_revocation.sh
index 08a0f8ac1..3c0cf02fb 100755
--- a/src/gns/test_gns_revocation.sh
+++ b/src/gns/test_gns_revocation.sh
@@ -1,7 +1,7 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4which timeout &> /dev/null && DO_TIMEOUT="timeout 5" 4which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5"
5 5
6LOCATION=$(which gnunet-config) 6LOCATION=$(which gnunet-config)
7if [ -z $LOCATION ] 7if [ -z $LOCATION ]
@@ -40,7 +40,7 @@ then
40 exit 1 40 exit 1
41fi 41fi
42 42
43if [ "x$RES_IP_REV" == "x" ] 43if [ "x$RES_IP_REV" = "x" ]
44then 44then
45 exit 0 45 exit 0
46else 46else
diff --git a/src/gns/test_gns_soa_lookup.sh b/src/gns/test_gns_soa_lookup.sh
index 6a09ac8c7..c5b049b72 100755
--- a/src/gns/test_gns_soa_lookup.sh
+++ b/src/gns/test_gns_soa_lookup.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4 4
@@ -14,7 +14,7 @@ then
14 exit 77 14 exit 77
15fi 15fi
16 16
17which timeout &> /dev/null && DO_TIMEOUT="timeout 5" 17which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5"
18 18
19rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 19rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
20MY_EGO="myego" 20MY_EGO="myego"
@@ -24,7 +24,7 @@ TEST_IP_GNS2DNS="184.172.157.218"
24TEST_RECORD_NAME="homepage" 24TEST_RECORD_NAME="homepage"
25TEST_RECORD_GNS2DNS="gnunet.org" 25TEST_RECORD_GNS2DNS="gnunet.org"
26 26
27if ! nslookup $TEST_RECORD_GNS2DNS $TEST_IP_GNS2DNS &> /dev/null 27if ! nslookup $TEST_RECORD_GNS2DNS $TEST_IP_GNS2DNS > /dev/null 2>&1
28then 28then
29 echo "Cannot reach DNS, skipping test" 29 echo "Cannot reach DNS, skipping test"
30 exit 77 30 exit 77
@@ -34,7 +34,7 @@ gnunet-arm -s -c test_gns_lookup.conf
34gnunet-identity -C $MY_EGO -c test_gns_lookup.conf 34gnunet-identity -C $MY_EGO -c test_gns_lookup.conf
35gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf 35gnunet-namestore -p -z $MY_EGO -a -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf
36RES_SOA=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t SOA -c test_gns_lookup.conf` 36RES_SOA=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t SOA -c test_gns_lookup.conf`
37gnunet-namestore -z $MY_EGO -d -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf &> /dev/null 37gnunet-namestore -z $MY_EGO -d -n $TEST_RECORD_NAME -t GNS2DNS -V ${TEST_RECORD_GNS2DNS}@${TEST_IP_GNS2DNS} -e never -c test_gns_lookup.conf > /dev/null 2>&1
38gnunet-identity -D $MY_EGO -c test_gns_lookup.conf 38gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
39gnunet-arm -e -c test_gns_lookup.conf 39gnunet-arm -e -c test_gns_lookup.conf
40rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 40rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
diff --git a/src/gns/test_gns_txt_lookup.sh b/src/gns/test_gns_txt_lookup.sh
index 6c6b4b3f6..b0c9144c2 100755
--- a/src/gns/test_gns_txt_lookup.sh
+++ b/src/gns/test_gns_txt_lookup.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4 4
@@ -15,7 +15,7 @@ then
15fi 15fi
16 16
17rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 17rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
18which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 18which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
19TEST_TXT="GNS powered txt record data" 19TEST_TXT="GNS powered txt record data"
20MY_EGO="myego" 20MY_EGO="myego"
21LABEL="testtxt" 21LABEL="testtxt"
@@ -28,7 +28,7 @@ gnunet-identity -D $MY_EGO -c test_gns_lookup.conf
28gnunet-arm -e -c test_gns_lookup.conf 28gnunet-arm -e -c test_gns_lookup.conf
29rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 29rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
30 30
31if [ "$RES_TXT" == "$TEST_TXT" ] 31if [ "$RES_TXT" = "$TEST_TXT" ]
32then 32then
33 exit 0 33 exit 0
34else 34else
diff --git a/src/gns/test_gns_zkey_lookup.sh b/src/gns/test_gns_zkey_lookup.sh
index b36a16fa2..03118d741 100755
--- a/src/gns/test_gns_zkey_lookup.sh
+++ b/src/gns/test_gns_zkey_lookup.sh
@@ -1,7 +1,7 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 3trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
4which timeout &> /dev/null && DO_TIMEOUT="timeout 5" 4which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5"
5 5
6LOCATION=$(which gnunet-config) 6LOCATION=$(which gnunet-config)
7if [ -z $LOCATION ] 7if [ -z $LOCATION ]
@@ -30,7 +30,7 @@ gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gn
30gnunet-arm -e -c test_gns_lookup.conf 30gnunet-arm -e -c test_gns_lookup.conf
31rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` 31rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME`
32 32
33if [ "$RES_IP" == "$TEST_IP" ] 33if [ "$RES_IP" = "$TEST_IP" ]
34then 34then
35 exit 0 35 exit 0
36else 36else
diff --git a/src/gns/test_gnunet_gns.sh b/src/gns/test_gnunet_gns.sh
index f6b4e721a..74c49c537 100755
--- a/src/gns/test_gnunet_gns.sh
+++ b/src/gns/test_gnunet_gns.sh
@@ -1,15 +1,25 @@
1#!/bin/bash 1#!/bin/sh
2# This file is in the public domain. 2# This file is in the public domain.
3LOCATION=$(which gnunet-config) 3# test -z being correct was a false assumption here.
4if [ -z $LOCATION ] 4# I have no executable 'fooble', but this will
5then 5# return 1:
6 LOCATION="gnunet-config" 6# if test -z "`which fooble`"; then echo 1; fi
7# The command builtin might not work with busybox's ash
8# but this works for now.
9existence()
10{
11 command -v "$1" >/dev/null 2>&1
12}
13
14LOCATION=`existence gnunet-config`
15if test -z $LOCATION; then
16 LOCATION="gnunet-config"
7fi 17fi
8$LOCATION --version 18$LOCATION --version
9if test $? != 0 19if test $? != 0
10then 20then
11 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" 21 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
12 exit 77 22 exit 77
13fi 23fi
14 24
15trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT 25trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT
@@ -32,4 +42,5 @@ if [ "$LO" != "Address: 4.5.6.7" ]
32then 42then
33 echo "Fail: $LO" 43 echo "Fail: $LO"
34fi 44fi
45# XXX: jobs. a builtin by bash, netbsd sh, maybe leave it be for now.
35kill `jobs -p` 46kill `jobs -p`
diff --git a/src/rest-plugins/test_plugin_rest_gns.sh b/src/gns/test_plugin_rest_gns.sh
index ec495a04b..ec495a04b 100755
--- a/src/rest-plugins/test_plugin_rest_gns.sh
+++ b/src/gns/test_plugin_rest_gns.sh
diff --git a/src/gns/test_proxy.sh b/src/gns/test_proxy.sh
index c960d4df9..7c17cd4c5 100755
--- a/src/gns/test_proxy.sh
+++ b/src/gns/test_proxy.sh
@@ -1,7 +1,9 @@
1#!/bin/bash 1#!/bin/bash
2 2# This file is in the public domain.
3TEST_DOMAIN="www.test" 3TEST_DOMAIN="www.test"
4 4
5# Delete old files before starting test
6rm -rf /tmp/gnunet/test-gnunet-gns-testing/
5gnunet-arm -s -c test_gns_proxy.conf 7gnunet-arm -s -c test_gns_proxy.conf
6gnunet-gns-proxy-setup-ca -c test_gns_proxy.conf 8gnunet-gns-proxy-setup-ca -c test_gns_proxy.conf
7 9
diff --git a/src/hostlist/hostlist.conf b/src/hostlist/hostlist.conf
index 32e5d8320..6b7a6aac7 100644
--- a/src/hostlist/hostlist.conf
+++ b/src/hostlist/hostlist.conf
@@ -20,7 +20,7 @@ HOSTLISTFILE = $GNUNET_CONFIG_HOME/hostlist/learned.txt
20OPTIONS = -b 20OPTIONS = -b
21 21
22# Default list of hostlist servers for bootstrapping 22# Default list of hostlist servers for bootstrapping
23SERVERS = http://v10.gnunet.org/hostlist https://gnunet.io/hostlist 23SERVERS = http://v11.gnunet.org/hostlist https://gnunet.io/hostlist
24# http://silent.0xdeadc0de.eu:8080/ 24# http://silent.0xdeadc0de.eu:8080/
25 25
26# bind hostlist http server to a specific IPv4 26# bind hostlist http server to a specific IPv4
diff --git a/src/identity/Makefile.am b/src/identity/Makefile.am
index 1f21fc65d..5c1af8e19 100644
--- a/src/identity/Makefile.am
+++ b/src/identity/Makefile.am
@@ -12,6 +12,12 @@ if USE_COVERAGE
12 XLIB = -lgcov 12 XLIB = -lgcov
13endif 13endif
14 14
15if HAVE_MHD
16if HAVE_JSON
17REST_PLUGIN = libgnunet_plugin_rest_identity.la
18endif
19endif
20
15pkgcfgdir= $(pkgdatadir)/config.d/ 21pkgcfgdir= $(pkgdatadir)/config.d/
16 22
17libexecdir= $(pkglibdir)/libexec/ 23libexecdir= $(pkglibdir)/libexec/
@@ -20,7 +26,20 @@ pkgcfg_DATA = \
20 identity.conf 26 identity.conf
21 27
22lib_LTLIBRARIES = \ 28lib_LTLIBRARIES = \
23 libgnunetidentity.la 29 libgnunetidentity.la \
30 $(REST_PLUGIN)
31
32
33libgnunet_plugin_rest_identity_la_SOURCES = \
34 plugin_rest_identity.c
35libgnunet_plugin_rest_identity_la_LIBADD = \
36 libgnunetidentity.la \
37 $(top_builddir)/src/rest/libgnunetrest.la \
38 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
39 $(LTLIBINTL) -ljansson -lmicrohttpd
40libgnunet_plugin_rest_identity_la_LDFLAGS = \
41 $(GN_PLUGIN_LDFLAGS)
42
24 43
25libgnunetidentity_la_SOURCES = \ 44libgnunetidentity_la_SOURCES = \
26 identity_api.c \ 45 identity_api.c \
diff --git a/src/rest-plugins/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c
index 3bfca3121..3bfca3121 100644
--- a/src/rest-plugins/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
diff --git a/src/rest-plugins/test_plugin_rest_identity.sh b/src/identity/test_plugin_rest_identity.sh
index a5879dd7e..a5879dd7e 100755
--- a/src/rest-plugins/test_plugin_rest_identity.sh
+++ b/src/identity/test_plugin_rest_identity.sh
diff --git a/src/integration-tests/Makefile.am b/src/integration-tests/Makefile.am
index 368980064..26dd4f92d 100644
--- a/src/integration-tests/Makefile.am
+++ b/src/integration-tests/Makefile.am
@@ -20,8 +20,8 @@ check_SCRIPTS = \
20 test_integration_disconnect.py \ 20 test_integration_disconnect.py \
21 test_integration_disconnect_nat.py \ 21 test_integration_disconnect_nat.py \
22 test_integration_reconnect.py \ 22 test_integration_reconnect.py \
23 test_integration_reconnect_nat.py \ 23 test_integration_reconnect_nat.py
24 test_integration_clique.py 24# test_integration_clique.py
25endif 25endif
26 26
27 27
diff --git a/src/integration-tests/gnunet_pyexpect.py.in b/src/integration-tests/gnunet_pyexpect.py.in
index 83acb908f..d757634a5 100644
--- a/src/integration-tests/gnunet_pyexpect.py.in
+++ b/src/integration-tests/gnunet_pyexpect.py.in
@@ -18,8 +18,7 @@
18# SPDX-License-Identifier: AGPL3.0-or-later 18# SPDX-License-Identifier: AGPL3.0-or-later
19# 19#
20# Testcase for gnunet-peerinfo 20# Testcase for gnunet-peerinfo
21from __future__ import print_function 21
22from builtins import object
23import os 22import os
24import re 23import re
25import subprocess 24import subprocess
diff --git a/src/integration-tests/gnunet_testing.py.in b/src/integration-tests/gnunet_testing.py.in
index c9342ecf0..c3596d232 100644
--- a/src/integration-tests/gnunet_testing.py.in
+++ b/src/integration-tests/gnunet_testing.py.in
@@ -18,10 +18,7 @@
18# SPDX-License-Identifier: AGPL3.0-or-later 18# SPDX-License-Identifier: AGPL3.0-or-later
19# 19#
20# Functions for integration testing 20# Functions for integration testing
21from __future__ import unicode_literals 21
22from __future__ import print_function
23from builtins import object
24from builtins import str
25import os 22import os
26import subprocess 23import subprocess
27import sys 24import sys
diff --git a/src/integration-tests/test_integration_bootstrap_and_connect.py.in b/src/integration-tests/test_integration_bootstrap_and_connect.py.in
index f0de1c0cd..4b4b35629 100755
--- a/src/integration-tests/test_integration_bootstrap_and_connect.py.in
+++ b/src/integration-tests/test_integration_bootstrap_and_connect.py.in
@@ -18,7 +18,7 @@
18# SPDX-License-Identifier: AGPL3.0-or-later 18# SPDX-License-Identifier: AGPL3.0-or-later
19# 19#
20# 20#
21from __future__ import print_function 21
22import signal 22import signal
23import sys 23import sys
24import os 24import os
diff --git a/src/integration-tests/test_integration_clique.py.in b/src/integration-tests/test_integration_clique.py.in
index b5d6dd518..0444cf249 100755
--- a/src/integration-tests/test_integration_clique.py.in
+++ b/src/integration-tests/test_integration_clique.py.in
@@ -25,7 +25,6 @@
25# Conditions for successful exit: 25# Conditions for successful exit:
26# Both peers have 2 connected peers in transport, core, topology, fs and dht 26# Both peers have 2 connected peers in transport, core, topology, fs and dht
27 27
28from __future__ import print_function
29import sys 28import sys
30import signal 29import signal
31import os 30import os
diff --git a/src/integration-tests/test_integration_disconnect.py.in b/src/integration-tests/test_integration_disconnect.py.in
index a81c78540..737014e61 100755
--- a/src/integration-tests/test_integration_disconnect.py.in
+++ b/src/integration-tests/test_integration_disconnect.py.in
@@ -18,7 +18,7 @@
18# SPDX-License-Identifier: AGPL3.0-or-later 18# SPDX-License-Identifier: AGPL3.0-or-later
19# 19#
20# 20#
21from __future__ import print_function 21
22import sys 22import sys
23import signal 23import signal
24import os 24import os
diff --git a/src/integration-tests/test_integration_disconnect_nat.py.in b/src/integration-tests/test_integration_disconnect_nat.py.in
index 601586f47..c3d5d8901 100755
--- a/src/integration-tests/test_integration_disconnect_nat.py.in
+++ b/src/integration-tests/test_integration_disconnect_nat.py.in
@@ -18,7 +18,7 @@
18# SPDX-License-Identifier: AGPL3.0-or-later 18# SPDX-License-Identifier: AGPL3.0-or-later
19# 19#
20# 20#
21from __future__ import print_function 21
22import sys 22import sys
23import signal 23import signal
24import os 24import os
diff --git a/src/integration-tests/test_integration_reconnect.py.in b/src/integration-tests/test_integration_reconnect.py.in
index e8abacd48..8c4193680 100755
--- a/src/integration-tests/test_integration_reconnect.py.in
+++ b/src/integration-tests/test_integration_reconnect.py.in
@@ -18,7 +18,7 @@
18# SPDX-License-Identifier: AGPL3.0-or-later 18# SPDX-License-Identifier: AGPL3.0-or-later
19# 19#
20# 20#
21from __future__ import print_function 21
22import sys 22import sys
23import os 23import os
24import subprocess 24import subprocess
diff --git a/src/integration-tests/test_integration_reconnect_nat.py.in b/src/integration-tests/test_integration_reconnect_nat.py.in
index 61d2ea966..45626d50d 100755
--- a/src/integration-tests/test_integration_reconnect_nat.py.in
+++ b/src/integration-tests/test_integration_reconnect_nat.py.in
@@ -18,7 +18,7 @@
18# SPDX-License-Identifier: AGPL3.0-or-later 18# SPDX-License-Identifier: AGPL3.0-or-later
19# 19#
20# 20#
21from __future__ import print_function 21
22import sys 22import sys
23import os 23import os
24import subprocess 24import subprocess
diff --git a/src/namestore/Makefile.am b/src/namestore/Makefile.am
index ac4eebd06..25941b4fb 100644
--- a/src/namestore/Makefile.am
+++ b/src/namestore/Makefile.am
@@ -104,10 +104,50 @@ TESTS = \
104 $(check_SCRIPTS) 104 $(check_SCRIPTS)
105endif 105endif
106 106
107if HAVE_MHD
108if HAVE_JSON
109REST_PLUGIN = libgnunet_plugin_rest_namestore.la
110endif
111endif
112
107lib_LTLIBRARIES = \ 113lib_LTLIBRARIES = \
108 libgnunetnamestore.la 114 libgnunetnamestore.la
109 115
110 116
117libexec_PROGRAMS = \
118 gnunet-service-namestore
119
120bin_PROGRAMS = \
121 gnunet-namestore \
122 gnunet-zoneimport
123
124if HAVE_MHD
125libexec_PROGRAMS += \
126 gnunet-namestore-fcfsd
127endif
128
129
130plugin_LTLIBRARIES = \
131 $(SQLITE_PLUGIN) \
132 $(POSTGRES_PLUGIN) \
133 $(HEAP_PLUGIN) \
134 $(REST_PLUGIN)
135
136
137libgnunet_plugin_rest_namestore_la_SOURCES = \
138 plugin_rest_namestore.c
139libgnunet_plugin_rest_namestore_la_LIBADD = \
140 libgnunetnamestore.la \
141 $(top_builddir)/src/rest/libgnunetrest.la \
142 $(top_builddir)/src/identity/libgnunetidentity.la \
143 $(top_builddir)/src/json/libgnunetjson.la \
144 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
145 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
146 $(LTLIBINTL) -ljansson -lmicrohttpd
147libgnunet_plugin_rest_namestore_la_LDFLAGS = \
148 $(GN_PLUGIN_LDFLAGS)
149
150
111libgnunetnamestore_la_SOURCES = \ 151libgnunetnamestore_la_SOURCES = \
112 namestore_api.c \ 152 namestore_api.c \
113 namestore_api_monitor.c \ 153 namestore_api_monitor.c \
@@ -121,17 +161,6 @@ libgnunetnamestore_la_LDFLAGS = \
121 $(GN_LIB_LDFLAGS) $(WINFLAGS) \ 161 $(GN_LIB_LDFLAGS) $(WINFLAGS) \
122 -version-info 0:1:0 162 -version-info 0:1:0
123 163
124libexec_PROGRAMS = \
125 gnunet-service-namestore
126
127bin_PROGRAMS = \
128 gnunet-namestore \
129 gnunet-zoneimport
130
131if HAVE_MHD
132libexec_PROGRAMS += \
133 gnunet-namestore-fcfsd
134endif
135 164
136 165
137gnunet_zoneimport_SOURCES = \ 166gnunet_zoneimport_SOURCES = \
@@ -176,12 +205,6 @@ gnunet_service_namestore_LDADD = \
176 $(GN_LIBINTL) 205 $(GN_LIBINTL)
177 206
178 207
179plugin_LTLIBRARIES = \
180 $(SQLITE_PLUGIN) \
181 $(POSTGRES_PLUGIN) \
182 $(HEAP_PLUGIN)
183
184
185 208
186libgnunet_plugin_namestore_heap_la_SOURCES = \ 209libgnunet_plugin_namestore_heap_la_SOURCES = \
187 plugin_namestore_heap.c 210 plugin_namestore_heap.c
diff --git a/src/rest-plugins/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c
index 26a037eae..26a037eae 100644
--- a/src/rest-plugins/plugin_rest_namestore.c
+++ b/src/namestore/plugin_rest_namestore.c
diff --git a/src/rest-plugins/test_plugin_rest_namestore.sh b/src/namestore/test_plugin_rest_namestore.sh
index 532c7caae..532c7caae 100755
--- a/src/rest-plugins/test_plugin_rest_namestore.sh
+++ b/src/namestore/test_plugin_rest_namestore.sh
diff --git a/src/nat/install-nat-helper.sh b/src/nat/install-nat-helper.sh
index 502aa71f1..d5ee91fa3 100755
--- a/src/nat/install-nat-helper.sh
+++ b/src/nat/install-nat-helper.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# $1 - bindir 2# $1 - bindir
3# $2 - sudo binary (optional) 3# $2 - sudo binary (optional)
4$2 chown root:root $1/gnunet-helper-nat-server $1/gnunet-helper-nat-client || true 4$2 chown root:root $1/gnunet-helper-nat-server $1/gnunet-helper-nat-client || true
diff --git a/src/peerinfo/Makefile.am b/src/peerinfo/Makefile.am
index ef79d6720..3c710eb93 100644
--- a/src/peerinfo/Makefile.am
+++ b/src/peerinfo/Makefile.am
@@ -5,6 +5,8 @@ pkgcfgdir= $(pkgdatadir)/config.d/
5 5
6libexecdir= $(pkglibdir)/libexec/ 6libexecdir= $(pkglibdir)/libexec/
7 7
8plugindir = $(libdir)/gnunet
9
8pkgcfg_DATA = \ 10pkgcfg_DATA = \
9 peerinfo.conf 11 peerinfo.conf
10 12
@@ -17,8 +19,29 @@ if USE_COVERAGE
17 XLIB = -lgcov 19 XLIB = -lgcov
18endif 20endif
19 21
22if HAVE_MHD
23if HAVE_JSON
24REST_PLUGIN = libgnunet_plugin_rest_peerinfo.la
25endif
26endif
27
20lib_LTLIBRARIES = libgnunetpeerinfo.la 28lib_LTLIBRARIES = libgnunetpeerinfo.la
21 29
30plugin_LTLIBRARIES = $(REST_PLUGIN)
31
32libgnunet_plugin_rest_peerinfo_la_SOURCES = \
33 plugin_rest_peerinfo.c
34libgnunet_plugin_rest_peerinfo_la_LIBADD = \
35 $(top_builddir)/src/hello/libgnunethello.la \
36 libgnunetpeerinfo.la \
37 $(top_builddir)/src/rest/libgnunetrest.la \
38 $(top_builddir)/src/json/libgnunetjson.la \
39 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
40 $(LTLIBINTL) -ljansson -lmicrohttpd
41libgnunet_plugin_rest_peerinfo_la_LDFLAGS = \
42 $(GN_PLUGIN_LDFLAGS)
43
44
22libgnunetpeerinfo_la_SOURCES = \ 45libgnunetpeerinfo_la_SOURCES = \
23 peerinfo_api.c peerinfo.h \ 46 peerinfo_api.c peerinfo.h \
24 peerinfo_api_notify.c 47 peerinfo_api_notify.c
diff --git a/src/rest-plugins/plugin_rest_peerinfo.c b/src/peerinfo/plugin_rest_peerinfo.c
index 24af2c193..24af2c193 100644
--- a/src/rest-plugins/plugin_rest_peerinfo.c
+++ b/src/peerinfo/plugin_rest_peerinfo.c
diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c
index 05fab18be..069277a00 100644
--- a/src/pt/test_gns_vpn.c
+++ b/src/pt/test_gns_vpn.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
diff --git a/src/pt/test_gns_vpn.conf b/src/pt/test_gns_vpn.conf
index 85dd08113..9277aa3c3 100644
--- a/src/pt/test_gns_vpn.conf
+++ b/src/pt/test_gns_vpn.conf
@@ -7,8 +7,6 @@ PLUGINS = tcp
7[arm] 7[arm]
8PORT = 0 8PORT = 0
9ALLOW_SHUTDOWN = YES 9ALLOW_SHUTDOWN = YES
10START_SYSTEM_SERVICES = NO
11START_USER_SERVICES = NO
12 10
13[exit] 11[exit]
14IMMEDIATE_START = YES 12IMMEDIATE_START = YES
diff --git a/src/reclaim/.gitignore b/src/reclaim/.gitignore
index ef77fccdc..46472101b 100644
--- a/src/reclaim/.gitignore
+++ b/src/reclaim/.gitignore
@@ -1,2 +1,2 @@
1gnunet-service-identity-provider 1gnunet-reclaim
2gnunet-identity-token 2gnunet-service-reclaim
diff --git a/src/reclaim/Makefile.am b/src/reclaim/Makefile.am
index f9942fa23..13918508e 100644
--- a/src/reclaim/Makefile.am
+++ b/src/reclaim/Makefile.am
@@ -16,6 +16,14 @@ if HAVE_SQLITE
16SQLITE_PLUGIN = libgnunet_plugin_reclaim_sqlite.la 16SQLITE_PLUGIN = libgnunet_plugin_reclaim_sqlite.la
17endif 17endif
18 18
19if HAVE_MHD
20if HAVE_JSON
21REST_PLUGIN = \
22 libgnunet_plugin_rest_openid_connect.la \
23 libgnunet_plugin_rest_reclaim.la
24endif
25endif
26
19EXTRA_DIST = \ 27EXTRA_DIST = \
20 reclaim.conf \ 28 reclaim.conf \
21 test_reclaim_defaults.conf \ 29 test_reclaim_defaults.conf \
@@ -33,7 +41,8 @@ lib_LTLIBRARIES = \
33 libgnunetreclaim.la 41 libgnunetreclaim.la
34plugin_LTLIBRARIES = \ 42plugin_LTLIBRARIES = \
35 libgnunet_plugin_gnsrecord_reclaim.la \ 43 libgnunet_plugin_gnsrecord_reclaim.la \
36 $(SQLITE_PLUGIN) 44 $(SQLITE_PLUGIN) \
45 $(REST_PLUGIN)
37 46
38bin_PROGRAMS = \ 47bin_PROGRAMS = \
39 gnunet-reclaim 48 gnunet-reclaim
@@ -41,6 +50,41 @@ bin_PROGRAMS = \
41libexec_PROGRAMS = \ 50libexec_PROGRAMS = \
42 gnunet-service-reclaim 51 gnunet-service-reclaim
43 52
53libgnunet_plugin_rest_reclaim_la_SOURCES = \
54 plugin_rest_reclaim.c \
55 json_reclaim.h \
56 json_reclaim.c
57libgnunet_plugin_rest_reclaim_la_LIBADD = \
58 $(top_builddir)/src/identity/libgnunetidentity.la \
59 libgnunetreclaim.la \
60 $(top_builddir)/src/json/libgnunetjson.la \
61 $(top_builddir)/src/rest/libgnunetrest.la \
62 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
63 $(top_builddir)/src/namestore/libgnunetnamestore.la \
64 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
65 $(LTLIBINTL) -ljansson -lmicrohttpd
66libgnunet_plugin_rest_reclaim_la_LDFLAGS = \
67 $(GN_PLUGIN_LDFLAGS)
68
69
70libgnunet_plugin_rest_openid_connect_la_SOURCES = \
71 plugin_rest_openid_connect.c \
72 oidc_helper.h \
73 oidc_helper.c
74libgnunet_plugin_rest_openid_connect_la_LIBADD = \
75 $(top_builddir)/src/identity/libgnunetidentity.la \
76 libgnunetreclaim.la \
77 $(top_builddir)/src/rest/libgnunetrest.la \
78 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
79 $(top_builddir)/src/namestore/libgnunetnamestore.la \
80$(top_builddir)/src/gns/libgnunetgns.la \
81 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
82 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
83 $(LTLIBINTL) -ljansson -lmicrohttpd
84libgnunet_plugin_rest_openid_connect_la_LDFLAGS = \
85 $(GN_PLUGIN_LDFLAGS)
86
87
44libgnunet_plugin_gnsrecord_reclaim_la_SOURCES = \ 88libgnunet_plugin_gnsrecord_reclaim_la_SOURCES = \
45 plugin_gnsrecord_reclaim.c 89 plugin_gnsrecord_reclaim.c
46libgnunet_plugin_gnsrecord_reclaim_la_LIBADD = \ 90libgnunet_plugin_gnsrecord_reclaim_la_LIBADD = \
diff --git a/src/rest-plugins/json_reclaim.c b/src/reclaim/json_reclaim.c
index 0fe9150d9..0fe9150d9 100644
--- a/src/rest-plugins/json_reclaim.c
+++ b/src/reclaim/json_reclaim.c
diff --git a/src/rest-plugins/json_reclaim.h b/src/reclaim/json_reclaim.h
index ced2e10dd..ced2e10dd 100644
--- a/src/rest-plugins/json_reclaim.h
+++ b/src/reclaim/json_reclaim.h
diff --git a/src/rest-plugins/oidc_helper.c b/src/reclaim/oidc_helper.c
index 646e58551..646e58551 100644
--- a/src/rest-plugins/oidc_helper.c
+++ b/src/reclaim/oidc_helper.c
diff --git a/src/rest-plugins/oidc_helper.h b/src/reclaim/oidc_helper.h
index d718b7a78..d718b7a78 100644
--- a/src/rest-plugins/oidc_helper.h
+++ b/src/reclaim/oidc_helper.h
diff --git a/src/rest-plugins/plugin_rest_openid_connect.c b/src/reclaim/plugin_rest_openid_connect.c
index e755f079b..e755f079b 100644
--- a/src/rest-plugins/plugin_rest_openid_connect.c
+++ b/src/reclaim/plugin_rest_openid_connect.c
diff --git a/src/rest-plugins/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c
index b36ed2bb6..b36ed2bb6 100644
--- a/src/rest-plugins/plugin_rest_reclaim.c
+++ b/src/reclaim/plugin_rest_reclaim.c
diff --git a/src/reclaim/test_reclaim.sh b/src/reclaim/test_reclaim.sh
index 311f5382a..da93b10f7 100755
--- a/src/reclaim/test_reclaim.sh
+++ b/src/reclaim/test_reclaim.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2#trap "gnunet-arm -e -c test_reclaim_lookup.conf" SIGINT 2#trap "gnunet-arm -e -c test_reclaim_lookup.conf" SIGINT
3 3
4LOCATION=$(which gnunet-config) 4LOCATION=$(which gnunet-config)
@@ -20,7 +20,7 @@ rm -rf `gnunet-config -c test_reclaim.conf -s PATHS -o GNUNET_HOME -f`
20# (3) PKEY3.user -> PKEY4 20# (3) PKEY3.user -> PKEY4
21 21
22 22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 23which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
24 24
25TEST_ATTR="test" 25TEST_ATTR="test"
26gnunet-arm -s -c test_reclaim.conf 26gnunet-arm -s -c test_reclaim.conf
diff --git a/src/rest-plugins/Makefile.am b/src/rest-plugins/Makefile.am
deleted file mode 100644
index 006c23101..000000000
--- a/src/rest-plugins/Makefile.am
+++ /dev/null
@@ -1,135 +0,0 @@
1# This Makefile.am is in the public domain
2AM_CPPFLAGS = -I$(top_srcdir)/src/include
3
4plugindir = $(libdir)/gnunet
5
6pkgcfgdir= $(pkgdatadir)/config.d/
7
8libexecdir= $(pkglibdir)/libexec/
9
10
11if MINGW
12 WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols
13endif
14
15if USE_COVERAGE
16 AM_CFLAGS = --coverage -O0
17 XLIBS = -lgcov
18endif
19
20plugin_LTLIBRARIES = \
21 libgnunet_plugin_rest_copying.la \
22 libgnunet_plugin_rest_peerinfo.la \
23 libgnunet_plugin_rest_identity.la \
24 libgnunet_plugin_rest_namestore.la \
25 libgnunet_plugin_rest_gns.la
26if HAVE_ABE
27plugin_LTLIBRARIES += libgnunet_plugin_rest_openid_connect.la \
28 libgnunet_plugin_rest_reclaim.la
29endif
30
31libgnunet_plugin_rest_reclaim_la_SOURCES = \
32 plugin_rest_reclaim.c \
33 json_reclaim.h \
34 json_reclaim.c
35libgnunet_plugin_rest_reclaim_la_LIBADD = \
36 $(top_builddir)/src/identity/libgnunetidentity.la \
37 $(top_builddir)/src/reclaim/libgnunetreclaim.la \
38 $(top_builddir)/src/json/libgnunetjson.la \
39 $(top_builddir)/src/rest/libgnunetrest.la \
40 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
41 $(top_builddir)/src/namestore/libgnunetnamestore.la \
42 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
43 $(LTLIBINTL) -ljansson -lmicrohttpd
44libgnunet_plugin_rest_reclaim_la_LDFLAGS = \
45 i$(GN_PLUGIN_LDFLAGS)
46
47
48#libgnunet_plugin_rest_credential_la_SOURCES = \
49# plugin_rest_credential.c
50#libgnunet_plugin_rest_credential_la_LIBADD = \
51# $(top_builddir)/src/credential/libgnunetcredential.la \
52# $(top_builddir)/src/rest/libgnunetrest.la \
53# $(top_builddir)/src/identity/libgnunetidentity.la \
54# $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
55# $(LTLIBINTL) -ljansson -lmicrohttpd
56#libgnunet_plugin_rest_credential_la_LDFLAGS = \
57# $(GN_PLUGIN_LDFLAGS)
58
59libgnunet_plugin_rest_copying_la_SOURCES = \
60 plugin_rest_copying.c
61libgnunet_plugin_rest_copying_la_LIBADD = \
62 $(top_builddir)/src/rest/libgnunetrest.la \
63 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
64 $(LTLIBINTL) -lmicrohttpd
65libgnunet_plugin_rest_copying_la_LDFLAGS = \
66 $(GN_PLUGIN_LDFLAGS)
67
68libgnunet_plugin_rest_peerinfo_la_SOURCES = \
69 plugin_rest_peerinfo.c
70libgnunet_plugin_rest_peerinfo_la_LIBADD = \
71 $(top_builddir)/src/hello/libgnunethello.la \
72 $(top_builddir)/src/peerinfo/libgnunetpeerinfo.la \
73 $(top_builddir)/src/rest/libgnunetrest.la \
74 $(top_builddir)/src/json/libgnunetjson.la \
75 $(top_builddir)/src/transport/libgnunettransport.la \
76 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
77 $(LTLIBINTL) -ljansson -lmicrohttpd
78libgnunet_plugin_rest_peerinfo_la_LDFLAGS = \
79 $(GN_PLUGIN_LDFLAGS)
80
81libgnunet_plugin_rest_identity_la_SOURCES = \
82 plugin_rest_identity.c
83libgnunet_plugin_rest_identity_la_LIBADD = \
84 $(top_builddir)/src/identity/libgnunetidentity.la \
85 $(top_builddir)/src/rest/libgnunetrest.la \
86 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
87 $(LTLIBINTL) -ljansson -lmicrohttpd
88libgnunet_plugin_rest_identity_la_LDFLAGS = \
89 $(GN_PLUGIN_LDFLAGS)
90
91
92
93libgnunet_plugin_rest_namestore_la_SOURCES = \
94 plugin_rest_namestore.c
95libgnunet_plugin_rest_namestore_la_LIBADD = \
96 $(top_builddir)/src/namestore/libgnunetnamestore.la \
97 $(top_builddir)/src/rest/libgnunetrest.la \
98 $(top_builddir)/src/identity/libgnunetidentity.la \
99 $(top_builddir)/src/json/libgnunetjson.la \
100 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
101 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
102 $(LTLIBINTL) -ljansson -lmicrohttpd
103libgnunet_plugin_rest_namestore_la_LDFLAGS = \
104 $(GN_PLUGIN_LDFLAGS)
105
106libgnunet_plugin_rest_gns_la_SOURCES = \
107 plugin_rest_gns.c
108libgnunet_plugin_rest_gns_la_LIBADD = \
109 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
110 $(top_builddir)/src/gns/libgnunetgns.la \
111 $(top_builddir)/src/rest/libgnunetrest.la \
112 $(top_builddir)/src/identity/libgnunetidentity.la \
113 $(top_builddir)/src/json/libgnunetjson.la \
114 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
115 $(LTLIBINTL) -ljansson -lmicrohttpd
116libgnunet_plugin_rest_gns_la_LDFLAGS = \
117 $(GN_PLUGIN_LDFLAGS)
118
119libgnunet_plugin_rest_openid_connect_la_SOURCES = \
120 plugin_rest_openid_connect.c \
121 oidc_helper.h \
122 oidc_helper.c
123libgnunet_plugin_rest_openid_connect_la_LIBADD = \
124 $(top_builddir)/src/identity/libgnunetidentity.la \
125 $(top_builddir)/src/reclaim/libgnunetreclaim.la \
126 $(top_builddir)/src/rest/libgnunetrest.la \
127 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
128 $(top_builddir)/src/namestore/libgnunetnamestore.la \
129$(top_builddir)/src/gns/libgnunetgns.la \
130 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
131 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
132 $(LTLIBINTL) -ljansson -lmicrohttpd
133libgnunet_plugin_rest_openid_connect_la_LDFLAGS = \
134 $(GN_PLUGIN_LDFLAGS)
135
diff --git a/src/rest/Makefile.am b/src/rest/Makefile.am
index 6c23ad2a6..acb95140b 100644
--- a/src/rest/Makefile.am
+++ b/src/rest/Makefile.am
@@ -20,14 +20,27 @@ if USE_COVERAGE
20endif 20endif
21 21
22lib_LTLIBRARIES = \ 22lib_LTLIBRARIES = \
23 libgnunetrest.la 23 libgnunetrest.la
24 24
25libexec_PROGRAMS = \ 25libexec_PROGRAMS = \
26 gnunet-rest-server 26 gnunet-rest-server
27 27
28plugin_LTLIBRARIES = libgnunet_plugin_rest_copying.la
29
28EXTRA_DIST = \ 30EXTRA_DIST = \
29 rest.conf 31 rest.conf
30 32
33libgnunet_plugin_rest_copying_la_SOURCES = \
34 plugin_rest_copying.c
35libgnunet_plugin_rest_copying_la_LIBADD = \
36 libgnunetrest.la \
37 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
38 $(LTLIBINTL) -lmicrohttpd
39libgnunet_plugin_rest_copying_la_LDFLAGS = \
40 $(GN_PLUGIN_LDFLAGS)
41
42
43
31gnunet_rest_server_SOURCES = \ 44gnunet_rest_server_SOURCES = \
32 gnunet-rest-server.c 45 gnunet-rest-server.c
33 46
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c
index 77f3d898d..3cbb750ba 100644
--- a/src/rest/gnunet-rest-server.c
+++ b/src/rest/gnunet-rest-server.c
@@ -64,6 +64,16 @@
64static struct GNUNET_SCHEDULER_Task *httpd_task; 64static struct GNUNET_SCHEDULER_Task *httpd_task;
65 65
66/** 66/**
67 * The address to bind to
68 */
69static in_addr_t address;
70
71/**
72 * The IPv6 address to bind to
73 */
74static struct in6_addr address6;
75
76/**
67 * The port the service is running on (default 7776) 77 * The port the service is running on (default 7776)
68 */ 78 */
69static unsigned long long port = GNUNET_REST_SERVICE_PORT; 79static unsigned long long port = GNUNET_REST_SERVICE_PORT;
@@ -406,11 +416,11 @@ create_response (void *cls,
406 con_handle->data_handle = rest_conndata_handle; 416 con_handle->data_handle = rest_conndata_handle;
407 MHD_get_connection_values (con, 417 MHD_get_connection_values (con,
408 MHD_GET_ARGUMENT_KIND, 418 MHD_GET_ARGUMENT_KIND,
409 &url_iterator, 419 (MHD_KeyValueIterator) &url_iterator,
410 rest_conndata_handle); 420 rest_conndata_handle);
411 MHD_get_connection_values (con, 421 MHD_get_connection_values (con,
412 MHD_HEADER_KIND, 422 MHD_HEADER_KIND,
413 &header_iterator, 423 (MHD_KeyValueIterator) &header_iterator,
414 rest_conndata_handle); 424 rest_conndata_handle);
415 con_handle->pp = MHD_create_post_processor(con, 425 con_handle->pp = MHD_create_post_processor(con,
416 65536, 426 65536,
@@ -695,6 +705,7 @@ bind_v4 ()
695 memset (&sa4, 0, sizeof (sa4)); 705 memset (&sa4, 0, sizeof (sa4));
696 sa4.sin_family = AF_INET; 706 sa4.sin_family = AF_INET;
697 sa4.sin_port = htons (port); 707 sa4.sin_port = htons (port);
708 sa4.sin_addr.s_addr = address;
698#if HAVE_SOCKADDR_IN_SIN_LEN 709#if HAVE_SOCKADDR_IN_SIN_LEN
699 sa4.sin_len = sizeof (sa4); 710 sa4.sin_len = sizeof (sa4);
700#endif 711#endif
@@ -731,6 +742,7 @@ bind_v6 ()
731 memset (&sa6, 0, sizeof (sa6)); 742 memset (&sa6, 0, sizeof (sa6));
732 sa6.sin6_family = AF_INET6; 743 sa6.sin6_family = AF_INET6;
733 sa6.sin6_port = htons (port); 744 sa6.sin6_port = htons (port);
745 sa6.sin6_addr = address6;
734#if HAVE_SOCKADDR_IN_SIN_LEN 746#if HAVE_SOCKADDR_IN_SIN_LEN
735 sa6.sin6_len = sizeof (sa6); 747 sa6.sin6_len = sizeof (sa6);
736#endif 748#endif
@@ -806,9 +818,56 @@ run (void *cls,
806 const char *cfgfile, 818 const char *cfgfile,
807 const struct GNUNET_CONFIGURATION_Handle *c) 819 const struct GNUNET_CONFIGURATION_Handle *c)
808{ 820{
821 char* addr_str;
809 cfg = c; 822 cfg = c;
810 plugin_map = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO); 823 plugin_map = GNUNET_CONTAINER_multihashmap_create (10, GNUNET_NO);
811 824
825 /* Get address to bind to */
826 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "rest",
827 "BIND_TO",
828 &addr_str))
829 {
830 //No address specified
831 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
832 "Don't know what to bind to...\n");
833 GNUNET_free (addr_str);
834 GNUNET_SCHEDULER_shutdown ();
835 return;
836 }
837 if (1 != inet_pton (AF_INET, addr_str, &address))
838 {
839 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
840 "Unable to parse address %s\n",
841 addr_str);
842 GNUNET_free (addr_str);
843 GNUNET_SCHEDULER_shutdown ();
844 return;
845 }
846 GNUNET_free (addr_str);
847 /* Get address to bind to */
848 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "rest",
849 "BIND_TO6",
850 &addr_str))
851 {
852 //No address specified
853 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
854 "Don't know what to bind6 to...\n");
855 GNUNET_free (addr_str);
856 GNUNET_SCHEDULER_shutdown ();
857 return;
858 }
859 if (1 != inet_pton (AF_INET6, addr_str, &address6))
860 {
861 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
862 "Unable to parse IPv6 address %s\n",
863 addr_str);
864 GNUNET_free (addr_str);
865 GNUNET_SCHEDULER_shutdown ();
866 return;
867 }
868 GNUNET_free (addr_str);
869
870
812 /* Get CORS data from cfg */ 871 /* Get CORS data from cfg */
813 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "rest", 872 if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, "rest",
814 "REST_ALLOW_ORIGIN", 873 "REST_ALLOW_ORIGIN",
diff --git a/src/rest-plugins/plugin_rest_copying.c b/src/rest/plugin_rest_copying.c
index 92c2c6601..92c2c6601 100644
--- a/src/rest-plugins/plugin_rest_copying.c
+++ b/src/rest/plugin_rest_copying.c
diff --git a/src/rest/rest.conf b/src/rest/rest.conf
index 138751696..bef8cf473 100644
--- a/src/rest/rest.conf
+++ b/src/rest/rest.conf
@@ -1,6 +1,8 @@
1[rest] 1[rest]
2UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-rest.sock 2UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-rest.sock
3BINARY=gnunet-rest-server 3BINARY=gnunet-rest-server
4BIND_TO=127.0.0.1
5BIND_TO6=::1
4REST_PORT=7776 6REST_PORT=7776
5REST_ALLOW_HEADERS=Authorization,Accept,Content-Type 7REST_ALLOW_HEADERS=Authorization,Accept,Content-Type
6REST_ALLOW_ORIGIN=* 8REST_ALLOW_ORIGIN=*
diff --git a/src/revocation/test_local_revocation.py.in b/src/revocation/test_local_revocation.py.in
index 5caa616ca..4cc6119ca 100644
--- a/src/revocation/test_local_revocation.py.in
+++ b/src/revocation/test_local_revocation.py.in
@@ -18,8 +18,7 @@
18# SPDX-License-Identifier: AGPL3.0-or-later 18# SPDX-License-Identifier: AGPL3.0-or-later
19# 19#
20# Testcase for ego revocation 20# Testcase for ego revocation
21from __future__ import print_function 21
22from builtins import str
23import sys 22import sys
24import os 23import os
25import subprocess 24import subprocess
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c
index 9aa786334..af27546f2 100644
--- a/src/rps/gnunet-rps-profiler.c
+++ b/src/rps/gnunet-rps-profiler.c
@@ -84,29 +84,31 @@ enum STAT_TYPE
84 STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL, /* 5 */ 84 STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL, /* 5 */
85 STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL, /* 6 */ 85 STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL, /* 6 */
86 STAT_TYPE_ISSUED_PUSH_SEND, /* 7 */ 86 STAT_TYPE_ISSUED_PUSH_SEND, /* 7 */
87 STAT_TYPE_ISSUED_PULL_REQ, /* 8 */ 87 STAT_TYPE_ISSUED_PUSH_SEND_MH, /* 8 */
88 STAT_TYPE_ISSUED_PULL_REQ_MH, /* 9 */ 88 STAT_TYPE_ISSUED_PULL_REQ, /* 9 */
89 STAT_TYPE_ISSUED_PULL_REP, /* 10 */ 89 STAT_TYPE_ISSUED_PULL_REQ_MH, /* 10 */
90 STAT_TYPE_SENT_PUSH_SEND, /* 11 */ 90 STAT_TYPE_ISSUED_PULL_REP, /* 11 */
91 STAT_TYPE_SENT_PULL_REQ, /* 12 */ 91 STAT_TYPE_SENT_PUSH_SEND, /* 12 */
92 STAT_TYPE_SENT_PULL_REQ_MH, /* 13 */ 92 STAT_TYPE_SENT_PULL_REQ, /* 13 */
93 STAT_TYPE_SENT_PULL_REP, /* 14 */ 93 STAT_TYPE_SENT_PULL_REQ_MH, /* 14 */
94 STAT_TYPE_RECV_PUSH_SEND, /* 15 */ 94 STAT_TYPE_SENT_PULL_REP, /* 15 */
95 STAT_TYPE_RECV_PULL_REQ, /* 16 */ 95 STAT_TYPE_RECV_PUSH_SEND, /* 16 */
96 STAT_TYPE_RECV_PULL_REQ_MH, /* 17 */ 96 STAT_TYPE_RECV_PUSH_SEND_MH, /* 17 */
97 STAT_TYPE_RECV_PULL_REP, /* 18 */ 97 STAT_TYPE_RECV_PULL_REQ, /* 18 */
98 STAT_TYPE_RECV_PULL_REP_MH, /* 19 */ 98 STAT_TYPE_RECV_PULL_REQ_MH, /* 19 */
99 STAT_TYPE_VIEW_SIZE, /* 20 */ 99 STAT_TYPE_RECV_PULL_REP, /* 20 */
100 STAT_TYPE_KNOWN_PEERS, /* 21 */ 100 STAT_TYPE_RECV_PULL_REP_MH, /* 21 */
101 STAT_TYPE_VALID_PEERS, /* 22 */ 101 STAT_TYPE_VIEW_SIZE, /* 22 */
102 STAT_TYPE_LEARND_PEERS, /* 23 */ 102 STAT_TYPE_KNOWN_PEERS, /* 23 */
103 STAT_TYPE_PENDING_ONLINE_CHECKS, /* 24 */ 103 STAT_TYPE_VALID_PEERS, /* 24 */
104 STAT_TYPE_UNREQUESTED_PULL_REPLIES, /* 25 */ 104 STAT_TYPE_LEARND_PEERS, /* 25 */
105 STAT_TYPE_PEERS_IN_PUSH_MAP, /* 26 */ 105 STAT_TYPE_PENDING_ONLINE_CHECKS, /* 26 */
106 STAT_TYPE_PEERS_IN_PULL_MAP, /* 27 */ 106 STAT_TYPE_UNREQUESTED_PULL_REPLIES, /* 27 */
107 STAT_TYPE_PEERS_IN_VIEW, /* 28 */ 107 STAT_TYPE_PEERS_IN_PUSH_MAP, /* 28 */
108 STAT_TYPE_VIEW_SIZE_AIM, /* 29 */ 108 STAT_TYPE_PEERS_IN_PULL_MAP, /* 29 */
109 STAT_TYPE_MAX, /* 30 */ 109 STAT_TYPE_PEERS_IN_VIEW, /* 30 */
110 STAT_TYPE_VIEW_SIZE_AIM, /* 31 */
111 STAT_TYPE_MAX, /* 32 */
110}; 112};
111 113
112static char* stat_type_strings[] = { 114static char* stat_type_strings[] = {
@@ -118,6 +120,7 @@ static char* stat_type_strings[] = {
118 "# rounds blocked - too many pushes, no pull replies", 120 "# rounds blocked - too many pushes, no pull replies",
119 "# rounds blocked - no pushes, no pull replies", 121 "# rounds blocked - no pushes, no pull replies",
120 "# push send issued", 122 "# push send issued",
123 "# push send issued (multi-hop peer)",
121 "# pull request send issued", 124 "# pull request send issued",
122 "# pull request send issued (multi-hop peer)", 125 "# pull request send issued (multi-hop peer)",
123 "# pull reply send issued", 126 "# pull reply send issued",
@@ -126,6 +129,7 @@ static char* stat_type_strings[] = {
126 "# pull requests sent (multi-hop peer)", 129 "# pull requests sent (multi-hop peer)",
127 "# pull replys sent", 130 "# pull replys sent",
128 "# push message received", 131 "# push message received",
132 "# push message received (multi-hop peer)",
129 "# pull request message received", 133 "# pull request message received",
130 "# pull request message received (multi-hop peer)", 134 "# pull request message received (multi-hop peer)",
131 "# pull reply messages received", 135 "# pull reply messages received",
@@ -206,6 +210,12 @@ enum STAT_TYPE stat_str_2_type (const char *stat_str)
206 { 210 {
207 return STAT_TYPE_ISSUED_PUSH_SEND; 211 return STAT_TYPE_ISSUED_PUSH_SEND;
208 } 212 }
213 else if (0 == strncmp (stat_type_strings[STAT_TYPE_ISSUED_PUSH_SEND_MH],
214 stat_str,
215 strlen (stat_type_strings[STAT_TYPE_ISSUED_PUSH_SEND_MH])))
216 {
217 return STAT_TYPE_ISSUED_PUSH_SEND_MH;
218 }
209 else if (0 == strncmp (stat_type_strings[STAT_TYPE_ISSUED_PULL_REQ], 219 else if (0 == strncmp (stat_type_strings[STAT_TYPE_ISSUED_PULL_REQ],
210 stat_str, 220 stat_str,
211 strlen (stat_type_strings[STAT_TYPE_ISSUED_PULL_REQ]))) 221 strlen (stat_type_strings[STAT_TYPE_ISSUED_PULL_REQ])))
@@ -254,6 +264,12 @@ enum STAT_TYPE stat_str_2_type (const char *stat_str)
254 { 264 {
255 return STAT_TYPE_RECV_PUSH_SEND; 265 return STAT_TYPE_RECV_PUSH_SEND;
256 } 266 }
267 else if (0 == strncmp (stat_type_strings[STAT_TYPE_RECV_PUSH_SEND_MH],
268 stat_str,
269 strlen (stat_type_strings[STAT_TYPE_RECV_PUSH_SEND_MH])))
270 {
271 return STAT_TYPE_RECV_PUSH_SEND_MH;
272 }
257 else if (0 == strncmp (stat_type_strings[STAT_TYPE_RECV_PULL_REQ], 273 else if (0 == strncmp (stat_type_strings[STAT_TYPE_RECV_PULL_REQ],
258 stat_str, 274 stat_str,
259 strlen (stat_type_strings[STAT_TYPE_RECV_PULL_REQ]))) 275 strlen (stat_type_strings[STAT_TYPE_RECV_PULL_REQ])))
@@ -2461,9 +2477,9 @@ void write_final_stats (void){
2461 "%s, %" /* id */ 2477 "%s, %" /* id */
2462 PRIu64 ", %" /* rounds */ 2478 PRIu64 ", %" /* rounds */
2463 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* blocking */ 2479 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* blocking */
2464 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* issued */ 2480 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* issued */
2465 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* sent */ 2481 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* sent */
2466 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* recv */ 2482 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* recv */
2467 PRIu64 ", %" /* view size */ 2483 PRIu64 ", %" /* view size */
2468 PRIu64 ", %" /* known peers */ 2484 PRIu64 ", %" /* known peers */
2469 PRIu64 ", %" /* valid peers */ 2485 PRIu64 ", %" /* valid peers */
@@ -2484,6 +2500,7 @@ void write_final_stats (void){
2484 rps_peers[i].stats[STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL], 2500 rps_peers[i].stats[STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL],
2485 rps_peers[i].stats[STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL], 2501 rps_peers[i].stats[STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL],
2486 rps_peers[i].stats[STAT_TYPE_ISSUED_PUSH_SEND], 2502 rps_peers[i].stats[STAT_TYPE_ISSUED_PUSH_SEND],
2503 rps_peers[i].stats[STAT_TYPE_ISSUED_PUSH_SEND_MH],
2487 rps_peers[i].stats[STAT_TYPE_ISSUED_PULL_REQ], 2504 rps_peers[i].stats[STAT_TYPE_ISSUED_PULL_REQ],
2488 rps_peers[i].stats[STAT_TYPE_ISSUED_PULL_REQ_MH], 2505 rps_peers[i].stats[STAT_TYPE_ISSUED_PULL_REQ_MH],
2489 rps_peers[i].stats[STAT_TYPE_ISSUED_PULL_REP], 2506 rps_peers[i].stats[STAT_TYPE_ISSUED_PULL_REP],
@@ -2492,6 +2509,7 @@ void write_final_stats (void){
2492 rps_peers[i].stats[STAT_TYPE_SENT_PULL_REQ_MH], 2509 rps_peers[i].stats[STAT_TYPE_SENT_PULL_REQ_MH],
2493 rps_peers[i].stats[STAT_TYPE_SENT_PULL_REP], 2510 rps_peers[i].stats[STAT_TYPE_SENT_PULL_REP],
2494 rps_peers[i].stats[STAT_TYPE_RECV_PUSH_SEND], 2511 rps_peers[i].stats[STAT_TYPE_RECV_PUSH_SEND],
2512 rps_peers[i].stats[STAT_TYPE_RECV_PUSH_SEND_MH],
2495 rps_peers[i].stats[STAT_TYPE_RECV_PULL_REQ], 2513 rps_peers[i].stats[STAT_TYPE_RECV_PULL_REQ],
2496 rps_peers[i].stats[STAT_TYPE_RECV_PULL_REQ_MH], 2514 rps_peers[i].stats[STAT_TYPE_RECV_PULL_REQ_MH],
2497 rps_peers[i].stats[STAT_TYPE_RECV_PULL_REP_MH], 2515 rps_peers[i].stats[STAT_TYPE_RECV_PULL_REP_MH],
@@ -2517,9 +2535,9 @@ void write_final_stats (void){
2517 "SUM %" 2535 "SUM %"
2518 PRIu64 " %" /* rounds */ 2536 PRIu64 " %" /* rounds */
2519 PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" /* blocking */ 2537 PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" PRIu64 " %" /* blocking */
2520 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* issued */ 2538 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* issued */
2521 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* sent */ 2539 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* sent */
2522 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* recv */ 2540 PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" PRIu64 ", %" /* recv */
2523 PRIu64 ", %" /* view size */ 2541 PRIu64 ", %" /* view size */
2524 PRIu64 ", %" /* known peers */ 2542 PRIu64 ", %" /* known peers */
2525 PRIu64 ", %" /* valid peers */ 2543 PRIu64 ", %" /* valid peers */
@@ -2538,6 +2556,7 @@ void write_final_stats (void){
2538 sums[STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL], 2556 sums[STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL],
2539 sums[STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL], 2557 sums[STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL],
2540 sums[STAT_TYPE_ISSUED_PUSH_SEND], 2558 sums[STAT_TYPE_ISSUED_PUSH_SEND],
2559 sums[STAT_TYPE_ISSUED_PUSH_SEND_MH],
2541 sums[STAT_TYPE_ISSUED_PULL_REQ], 2560 sums[STAT_TYPE_ISSUED_PULL_REQ],
2542 sums[STAT_TYPE_ISSUED_PULL_REQ_MH], 2561 sums[STAT_TYPE_ISSUED_PULL_REQ_MH],
2543 sums[STAT_TYPE_ISSUED_PULL_REP], 2562 sums[STAT_TYPE_ISSUED_PULL_REP],
@@ -2546,6 +2565,7 @@ void write_final_stats (void){
2546 sums[STAT_TYPE_SENT_PULL_REQ_MH], 2565 sums[STAT_TYPE_SENT_PULL_REQ_MH],
2547 sums[STAT_TYPE_SENT_PULL_REP], 2566 sums[STAT_TYPE_SENT_PULL_REP],
2548 sums[STAT_TYPE_RECV_PUSH_SEND], 2567 sums[STAT_TYPE_RECV_PUSH_SEND],
2568 sums[STAT_TYPE_RECV_PUSH_SEND_MH],
2549 sums[STAT_TYPE_RECV_PULL_REQ], 2569 sums[STAT_TYPE_RECV_PULL_REQ],
2550 sums[STAT_TYPE_RECV_PULL_REQ_MH], 2570 sums[STAT_TYPE_RECV_PULL_REQ_MH],
2551 sums[STAT_TYPE_RECV_PULL_REP], 2571 sums[STAT_TYPE_RECV_PULL_REP],
@@ -2855,6 +2875,7 @@ run (void *cls,
2855 BIT(STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL) | 2875 BIT(STAT_TYPE_BLOCKS_MANY_PUSH_NO_PULL) |
2856 BIT(STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL) | 2876 BIT(STAT_TYPE_BLOCKS_NO_PUSH_NO_PULL) |
2857 BIT(STAT_TYPE_ISSUED_PUSH_SEND) | 2877 BIT(STAT_TYPE_ISSUED_PUSH_SEND) |
2878 BIT(STAT_TYPE_ISSUED_PUSH_SEND_MH) |
2858 BIT(STAT_TYPE_ISSUED_PULL_REQ) | 2879 BIT(STAT_TYPE_ISSUED_PULL_REQ) |
2859 BIT(STAT_TYPE_ISSUED_PULL_REQ_MH) | 2880 BIT(STAT_TYPE_ISSUED_PULL_REQ_MH) |
2860 BIT(STAT_TYPE_ISSUED_PULL_REP) | 2881 BIT(STAT_TYPE_ISSUED_PULL_REP) |
@@ -2863,6 +2884,7 @@ run (void *cls,
2863 BIT(STAT_TYPE_SENT_PULL_REQ_MH) | 2884 BIT(STAT_TYPE_SENT_PULL_REQ_MH) |
2864 BIT(STAT_TYPE_SENT_PULL_REP) | 2885 BIT(STAT_TYPE_SENT_PULL_REP) |
2865 BIT(STAT_TYPE_RECV_PUSH_SEND) | 2886 BIT(STAT_TYPE_RECV_PUSH_SEND) |
2887 BIT(STAT_TYPE_RECV_PUSH_SEND_MH) |
2866 BIT(STAT_TYPE_RECV_PULL_REQ) | 2888 BIT(STAT_TYPE_RECV_PULL_REQ) |
2867 BIT(STAT_TYPE_RECV_PULL_REQ_MH) | 2889 BIT(STAT_TYPE_RECV_PULL_REQ_MH) |
2868 BIT(STAT_TYPE_RECV_PULL_REP) | 2890 BIT(STAT_TYPE_RECV_PULL_REP) |
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 63d4c1865..1871ef006 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -3500,6 +3500,15 @@ handle_peer_push (void *cls,
3500 if (channel_ctx->peer_ctx->sub == msub) 3500 if (channel_ctx->peer_ctx->sub == msub)
3501 { 3501 {
3502 GNUNET_STATISTICS_update(stats, "# push message received", 1, GNUNET_NO); 3502 GNUNET_STATISTICS_update(stats, "# push message received", 1, GNUNET_NO);
3503 if (NULL != map_single_hop &&
3504 GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (map_single_hop,
3505 peer))
3506 {
3507 GNUNET_STATISTICS_update (stats,
3508 "# push message received (multi-hop peer)",
3509 1,
3510 GNUNET_NO);
3511 }
3503 } 3512 }
3504 3513
3505 #if ENABLE_MALICIOUS 3514 #if ENABLE_MALICIOUS
@@ -3881,6 +3890,15 @@ send_push (struct PeerContext *peer_ctx)
3881 "# push send issued", 3890 "# push send issued",
3882 1, 3891 1,
3883 GNUNET_NO); 3892 GNUNET_NO);
3893 if (NULL != map_single_hop &&
3894 GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (map_single_hop,
3895 &peer_ctx->peer_id))
3896 {
3897 GNUNET_STATISTICS_update (stats,
3898 "# push send issued (multi-hop peer)",
3899 1,
3900 GNUNET_NO);
3901 }
3884 } 3902 }
3885} 3903}
3886 3904
diff --git a/src/rps/rps-test_util.h b/src/rps/rps-test_util.h
index ace833034..5009073d0 100644
--- a/src/rps/rps-test_util.h
+++ b/src/rps/rps-test_util.h
@@ -65,7 +65,7 @@ close_all_files ();
65#define to_file(file_name, ...) do { \ 65#define to_file(file_name, ...) do { \
66 char tmp_buf[512] = "";\ 66 char tmp_buf[512] = "";\
67 int size;\ 67 int size;\
68 if (NULL == file_name) return; \ 68 if (NULL == file_name) break; \
69 size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\ 69 size = GNUNET_snprintf(tmp_buf,sizeof(tmp_buf),__VA_ARGS__);\
70 if (0 > size)\ 70 if (0 > size)\
71 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\ 71 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,\
diff --git a/src/statistics/test_gnunet_statistics.py.in b/src/statistics/test_gnunet_statistics.py.in
index 64e66f238..b14dc9d9e 100644
--- a/src/statistics/test_gnunet_statistics.py.in
+++ b/src/statistics/test_gnunet_statistics.py.in
@@ -1,5 +1,5 @@
1#!@PYTHON@ 1#!@PYTHON@
2from __future__ import print_function 2
3import os 3import os
4import sys 4import sys
5import shutil 5import shutil
diff --git a/src/transport/benchmark.sh b/src/transport/benchmark.sh
index 6ae68af2a..a29e6ec2d 100755
--- a/src/transport/benchmark.sh
+++ b/src/transport/benchmark.sh
@@ -1,15 +1,13 @@
1#/bin/sh 1#!/bin/sh
2 2
3for i in {1..0} 3for i in $(seq 1 0)
4do 4do
5 echo RUN $i 5 echo RUN $i
6 ./test_transport_api_reliability_http 6 ./test_transport_api_reliability_http
7done 7done
8 8
9for i in {1..100} 9for i in $(seq 1 100)
10do 10do
11 echo RUN $i 11 echo RUN $i
12 ./test_transport_api_reliability_https 12 ./test_transport_api_reliability_https
13done 13done
14
15 \ No newline at end of file
diff --git a/src/transport/install-bluetooth-helper.sh b/src/transport/install-bluetooth-helper.sh
index 409078759..5c40250fa 100755
--- a/src/transport/install-bluetooth-helper.sh
+++ b/src/transport/install-bluetooth-helper.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# $1 - bindir 2# $1 - bindir
3# $2 - sudo binary (optional) 3# $2 - sudo binary (optional)
4$2 chown root:root $1/gnunet-helper-transport-bluetooth || true 4$2 chown root:root $1/gnunet-helper-transport-bluetooth || true
diff --git a/src/transport/install-wlan-helper.sh b/src/transport/install-wlan-helper.sh
index 54b3360be..0fa9c9806 100755
--- a/src/transport/install-wlan-helper.sh
+++ b/src/transport/install-wlan-helper.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# $1 - bindir 2# $1 - bindir
3# $2 - sudo binary (optional) 3# $2 - sudo binary (optional)
4$2 chown root:root $1/gnunet-helper-transport-wlan || true 4$2 chown root:root $1/gnunet-helper-transport-wlan || true
diff --git a/src/transport/profile_transport.sh b/src/transport/profile_transport.sh
index aa5c4a88f..0e6935fc7 100755
--- a/src/transport/profile_transport.sh
+++ b/src/transport/profile_transport.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2 2
3C_ITERATIONS=5 3C_ITERATIONS=5
4C_MESSAGE_DELTA=10 4C_MESSAGE_DELTA=10
@@ -11,7 +11,7 @@ C_MESSAGE_END=2000
11# done 11# done
12 12
13 13
14for ((cur=$C_MESSAGE_START; cur<=$C_MESSAGE_END; cur = cur + $C_MESSAGE_DELTA)) 14for $((cur=$C_MESSAGE_START; cur<=$C_MESSAGE_END; cur = cur + $C_MESSAGE_DELTA))
15{ 15{
16 ./gnunet-transport-profiler -p NSGWRTMHG2YJK9KZSTEWKJ5TK20AGRDBWHFA1ZNKKZ7T360MZ8S0 -s -c perf_https_peer1.conf -n 20240 -m $cur -i 4 16 ./gnunet-transport-profiler -p NSGWRTMHG2YJK9KZSTEWKJ5TK20AGRDBWHFA1ZNKKZ7T360MZ8S0 -s -c perf_https_peer1.conf -n 20240 -m $cur -i 4
17 sleep 1 17 sleep 1
diff --git a/src/util/gnunet-config.c b/src/util/gnunet-config.c
index 361fa55d6..f700428a2 100644
--- a/src/util/gnunet-config.c
+++ b/src/util/gnunet-config.c
@@ -73,9 +73,9 @@ static int rewrite;
73 */ 73 */
74static void 74static void
75print_option (void *cls, 75print_option (void *cls,
76 const char *section, 76 const char *section,
77 const char *option, 77 const char *option,
78 const char *value) 78 const char *value)
79{ 79{
80 const struct GNUNET_CONFIGURATION_Handle *cfg = cls; 80 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
81 81
@@ -86,27 +86,27 @@ print_option (void *cls,
86 char *fn; 86 char *fn;
87 87
88 GNUNET_assert (GNUNET_OK == 88 GNUNET_assert (GNUNET_OK ==
89 GNUNET_CONFIGURATION_get_value_filename (cfg, 89 GNUNET_CONFIGURATION_get_value_filename (cfg,
90 section, 90 section,
91 option, 91 option,
92 &value_fn)); 92 &value_fn));
93 fn = GNUNET_STRINGS_filename_expand (value_fn); 93 fn = GNUNET_STRINGS_filename_expand (value_fn);
94 if (NULL == fn) 94 if (NULL == fn)
95 fn = value_fn; 95 fn = value_fn;
96 else 96 else
97 GNUNET_free (value_fn); 97 GNUNET_free (value_fn);
98 fprintf (stdout, 98 fprintf (stdout,
99 "%s = %s\n", 99 "%s = %s\n",
100 option, 100 option,
101 fn); 101 fn);
102 GNUNET_free (fn); 102 GNUNET_free (fn);
103 } 103 }
104 else 104 else
105 { 105 {
106 fprintf (stdout, 106 fprintf (stdout,
107 "%s = %s\n", 107 "%s = %s\n",
108 option, 108 option,
109 value); 109 value);
110 } 110 }
111} 111}
112 112
@@ -123,8 +123,8 @@ print_section_name (void *cls,
123{ 123{
124 (void) cls; 124 (void) cls;
125 fprintf (stdout, 125 fprintf (stdout,
126 "%s\n", 126 "%s\n",
127 section); 127 section);
128} 128}
129 129
130 130
@@ -133,7 +133,8 @@ print_section_name (void *cls,
133 * 133 *
134 * @param cls closure 134 * @param cls closure
135 * @param args remaining command-line arguments 135 * @param args remaining command-line arguments
136 * @param cfgfile name of the configuration file used (for saving, can be NULL!) 136 * @param cfgfile name of the configuration file used (for saving,
137 * can be NULL!)
137 * @param cfg configuration 138 * @param cfg configuration
138 */ 139 */
139static void 140static void
@@ -192,35 +193,36 @@ run (void *cls,
192 { 193 {
193 GNUNET_CONFIGURATION_iterate_section_values (cfg, 194 GNUNET_CONFIGURATION_iterate_section_values (cfg,
194 section, 195 section,
195 &print_option, 196 &print_option,
196 (void *) cfg); 197 (void *) cfg);
197 } 198 }
198 else 199 else
199 { 200 {
200 if (is_filename) 201 if (is_filename)
201 { 202 {
202 if (GNUNET_OK != 203 if (GNUNET_OK !=
203 GNUNET_CONFIGURATION_get_value_filename (cfg, 204 GNUNET_CONFIGURATION_get_value_filename (cfg,
204 section, 205 section,
205 option, 206 option,
206 &value)) 207 &value))
207 { 208 {
208 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, 209 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
209 section, option); 210 section, option);
210 ret = 3; 211 ret = 3;
211 goto cleanup; 212 goto cleanup;
212 } 213 }
213 } 214 }
214 else 215 else
215 { 216 {
216 if (GNUNET_OK != 217 if (GNUNET_OK !=
217 GNUNET_CONFIGURATION_get_value_string (cfg, section, option, &value)) 218 GNUNET_CONFIGURATION_get_value_string (cfg, section,
218 { 219 option, &value))
219 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, 220 {
220 section, option); 221 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
221 ret = 3; 222 section, option);
223 ret = 3;
222 goto cleanup; 224 goto cleanup;
223 } 225 }
224 } 226 }
225 fprintf (stdout, "%s\n", value); 227 fprintf (stdout, "%s\n", value);
226 } 228 }
@@ -245,10 +247,10 @@ run (void *cls,
245 const char *xdg = getenv ("XDG_CONFIG_HOME"); 247 const char *xdg = getenv ("XDG_CONFIG_HOME");
246 if (NULL != xdg) 248 if (NULL != xdg)
247 GNUNET_asprintf (&cfg_fn, 249 GNUNET_asprintf (&cfg_fn,
248 "%s%s%s", 250 "%s%s%s",
249 xdg, 251 xdg,
250 DIR_SEPARATOR_STR, 252 DIR_SEPARATOR_STR,
251 GNUNET_OS_project_data_get ()->config_file); 253 GNUNET_OS_project_data_get ()->config_file);
252 else 254 else
253 cfg_fn = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file); 255 cfg_fn = GNUNET_strdup (GNUNET_OS_project_data_get ()->user_config_file);
254 cfgfile = cfg_fn; 256 cfgfile = cfg_fn;
@@ -256,14 +258,14 @@ run (void *cls,
256 if ( (NULL != diff) || (NULL != out) ) 258 if ( (NULL != diff) || (NULL != out) )
257 { 259 {
258 if (GNUNET_OK != 260 if (GNUNET_OK !=
259 GNUNET_CONFIGURATION_write ((NULL == out) ? diff : out, 261 GNUNET_CONFIGURATION_write ((NULL == out) ? diff : out,
260 cfgfile)) 262 cfgfile))
261 ret = 2; 263 ret = 2;
262 } 264 }
263 GNUNET_free_non_null (cfg_fn); 265 GNUNET_free_non_null (cfg_fn);
264 if (NULL != out) 266 if (NULL != out)
265 GNUNET_CONFIGURATION_destroy (out); 267 GNUNET_CONFIGURATION_destroy (out);
266 cleanup: 268cleanup:
267 if (NULL != diff) 269 if (NULL != diff)
268 GNUNET_CONFIGURATION_destroy (diff); 270 GNUNET_CONFIGURATION_destroy (diff);
269} 271}
@@ -282,32 +284,32 @@ main (int argc,
282{ 284{
283 struct GNUNET_GETOPT_CommandLineOption options[] = { 285 struct GNUNET_GETOPT_CommandLineOption options[] = {
284 GNUNET_GETOPT_option_flag ('f', 286 GNUNET_GETOPT_option_flag ('f',
285 "filename", 287 "filename",
286 gettext_noop ("obtain option of value as a filename (with $-expansion)"), 288 gettext_noop ("interpret option value as a filename (with $-expansion)"),
287 &is_filename), 289 &is_filename),
288 GNUNET_GETOPT_option_string ('s', 290 GNUNET_GETOPT_option_string ('s',
289 "section", 291 "section",
290 "SECTION", 292 "SECTION",
291 gettext_noop ("name of the section to access"), 293 gettext_noop ("name of the section to access"),
292 &section), 294 &section),
293 GNUNET_GETOPT_option_string ('o', 295 GNUNET_GETOPT_option_string ('o',
294 "option", 296 "option",
295 "OPTION", 297 "OPTION",
296 gettext_noop ("name of the option to access"), 298 gettext_noop ("name of the option to access"),
297 &option), 299 &option),
298 GNUNET_GETOPT_option_string ('V', 300 GNUNET_GETOPT_option_string ('V',
299 "value", 301 "value",
300 "VALUE", 302 "VALUE",
301 gettext_noop ("value to set"), 303 gettext_noop ("value to set"),
302 &value), 304 &value),
303 GNUNET_GETOPT_option_flag ('S', 305 GNUNET_GETOPT_option_flag ('S',
304 "list-sections", 306 "list-sections",
305 gettext_noop ("print available configuration sections"), 307 gettext_noop ("print available configuration sections"),
306 &list_sections), 308 &list_sections),
307 GNUNET_GETOPT_option_flag ('w', 309 GNUNET_GETOPT_option_flag ('w',
308 "rewrite", 310 "rewrite",
309 gettext_noop ("write configuration file that only contains delta to defaults"), 311 gettext_noop ("write configuration file that only contains delta to defaults"),
310 &rewrite), 312 &rewrite),
311 GNUNET_GETOPT_OPTION_END 313 GNUNET_GETOPT_OPTION_END
312 }; 314 };
313 if (GNUNET_OK != 315 if (GNUNET_OK !=
@@ -316,12 +318,12 @@ main (int argc,
316 return 2; 318 return 2;
317 319
318 ret = (GNUNET_OK == 320 ret = (GNUNET_OK ==
319 GNUNET_PROGRAM_run (argc, 321 GNUNET_PROGRAM_run (argc,
320 argv, 322 argv,
321 "gnunet-config [OPTIONS]", 323 "gnunet-config [OPTIONS]",
322 gettext_noop ("Manipulate GNUnet configuration files"), 324 gettext_noop ("Manipulate GNUnet configuration files"),
323 options, 325 options,
324 &run, NULL)) ? 0 : ret; 326 &run, NULL)) ? 0 : ret;
325 GNUNET_free ((void*) argv); 327 GNUNET_free ((void*) argv);
326 return ret; 328 return ret;
327} 329}
diff --git a/src/util/gnunet-qr.c b/src/util/gnunet-qr.c
index 1106d5cb2..fa95d6c05 100644
--- a/src/util/gnunet-qr.c
+++ b/src/util/gnunet-qr.c
@@ -17,7 +17,12 @@
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19*/
20 20/**
21 * @file util/gnunet-qr.c
22 * @author Hartmut Goebel (original implementation)
23 * @author Martin Schanzenbach (integrate gnunet-uri)
24 * @author Christian Grothoff (error handling)
25 */
21#include <stdio.h> 26#include <stdio.h>
22#include <zbar.h> 27#include <zbar.h>
23#include <stdbool.h> 28#include <stdbool.h>
@@ -26,18 +31,35 @@
26 31
27#define LOG(fmt, ...) if (verbose == true) printf(fmt, ## __VA_ARGS__) 32#define LOG(fmt, ...) if (verbose == true) printf(fmt, ## __VA_ARGS__)
28 33
29// Command line options 34/**
35 * Video device to capture from. Sane default for GNU/Linux systems.
36 */
30static char* device = "/dev/video0"; 37static char* device = "/dev/video0";
38
39/**
40 * --verbose option
41 */
31static int verbose = false; 42static int verbose = false;
43
44/**
45 * --silent option
46 */
32static int silent = false; 47static int silent = false;
33 48
34// Handler exit code 49/**
50 * Handler exit code
51 */
35static long unsigned int exit_code = 1; 52static long unsigned int exit_code = 1;
36 53
37// Helper process we started. 54/**
55 * Helper process we started.
56 */
38static struct GNUNET_OS_Process *p; 57static struct GNUNET_OS_Process *p;
39 58
40// Pipe used to communicate shutdown via signal. 59
60/**
61 * Pipe used to communicate child death via signal.
62 */
41static struct GNUNET_DISK_PipeHandle *sigpipe; 63static struct GNUNET_DISK_PipeHandle *sigpipe;
42 64
43 65
@@ -69,8 +91,10 @@ maint_child_death (void *cls)
69 * @param cfg configuration 91 * @param cfg configuration
70 */ 92 */
71static void 93static void
72gnunet_uri (void *cls, const char *uri, const char *cfgfile, 94gnunet_uri (void *cls,
73 const struct GNUNET_CONFIGURATION_Handle *cfg) 95 const char *uri,
96 const char *cfgfile,
97 const struct GNUNET_CONFIGURATION_Handle *cfg)
74{ 98{
75 const char *orig_uri; 99 const char *orig_uri;
76 const char *slash; 100 const char *slash;
@@ -88,7 +112,8 @@ gnunet_uri (void *cls, const char *uri, const char *cfgfile,
88 uri += strlen ("gnunet://"); 112 uri += strlen ("gnunet://");
89 if (NULL == (slash = strchr (uri, '/'))) 113 if (NULL == (slash = strchr (uri, '/')))
90 { 114 {
91 fprintf (stderr, _("Invalid URI: fails to specify subsystem\n")); 115 fprintf (stderr,
116 _("Invalid URI: fails to specify subsystem\n"));
92 return; 117 return;
93 } 118 }
94 subsystem = GNUNET_strndup (uri, slash - uri); 119 subsystem = GNUNET_strndup (uri, slash - uri);
@@ -98,7 +123,9 @@ gnunet_uri (void *cls, const char *uri, const char *cfgfile,
98 subsystem, 123 subsystem,
99 &program)) 124 &program))
100 { 125 {
101 fprintf (stderr, _("No handler known for subsystem `%s'\n"), subsystem); 126 fprintf (stderr,
127 _("No handler known for subsystem `%s'\n"),
128 subsystem);
102 GNUNET_free (subsystem); 129 GNUNET_free (subsystem);
103 return; 130 return;
104 } 131 }
@@ -120,6 +147,111 @@ gnunet_uri (void *cls, const char *uri, const char *cfgfile,
120 147
121 148
122/** 149/**
150 * Obtain QR code 'symbol' from @a proc.
151 *
152 * @param proc zbar processor to use
153 * @return NULL on error
154 */
155static const zbar_symbol_t *
156get_symbol (zbar_processor_t *proc)
157{
158 const zbar_symbol_set_t* symbols;
159 int rc;
160 int n;
161
162 if (0 !=
163 zbar_processor_parse_config (proc, "enable"))
164 {
165 GNUNET_break (0);
166 return NULL;
167 }
168
169 /* initialize the Processor */
170 if (0 !=
171 (rc = zbar_processor_init(proc, device, 1)))
172 {
173 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
174 "Failed to open device `%s': %d\n",
175 device,
176 rc);
177 return NULL;
178 }
179
180 /* enable the preview window */
181 if ( (0 != (rc = zbar_processor_set_visible (proc, 1))) ||
182 (0 != (rc = zbar_processor_set_active(proc, 1))) )
183 {
184 GNUNET_break (0);
185 return NULL;
186 }
187
188 /* read at least one barcode (or until window closed) */
189 LOG ("Capturing\n");
190 n = zbar_process_one (proc, -1);
191
192 /* hide the preview window */
193 (void) zbar_processor_set_active (proc, 0);
194 (void) zbar_processor_set_visible (proc, 0);
195 if (-1 == n)
196 return NULL; /* likely user closed the window */
197 LOG ("Got %i images\n",
198 n);
199 /* extract results */
200 symbols = zbar_processor_get_results (proc);
201 if (NULL == symbols)
202 {
203 GNUNET_break (0);
204 return NULL;
205 }
206 return zbar_symbol_set_first_symbol (symbols);
207}
208
209
210/**
211 * Run zbar QR code parser.
212 *
213 * @return NULL on error, otherwise the URI that we found
214 */
215static char *
216run_zbar ()
217{
218 zbar_processor_t *proc;
219 const char *data;
220 char *ret;
221 const zbar_symbol_t* symbol;
222
223 /* configure the Processor */
224 proc = zbar_processor_create (1);
225 if (NULL == proc)
226 {
227 GNUNET_break (0);
228 return NULL;
229 }
230
231 symbol = get_symbol (proc);
232 if (NULL == symbol)
233 {
234 zbar_processor_destroy (proc);
235 return NULL;
236 }
237 data = zbar_symbol_get_data (symbol);
238 if (NULL == data)
239 {
240 GNUNET_break (0);
241 zbar_processor_destroy (proc);
242 return NULL;
243 }
244 LOG ("Found %s \"%s\"\n",
245 zbar_get_symbol_name (zbar_symbol_get_type(symbol)),
246 data);
247 ret = GNUNET_strdup (data);
248 /* clean up */
249 zbar_processor_destroy(proc);
250 return ret;
251}
252
253
254/**
123 * Main function that will be run by the scheduler. 255 * Main function that will be run by the scheduler.
124 * 256 *
125 * @param cls closure 257 * @param cls closure
@@ -133,65 +265,33 @@ run (void *cls,
133 const char *cfgfile, 265 const char *cfgfile,
134 const struct GNUNET_CONFIGURATION_Handle *cfg) 266 const struct GNUNET_CONFIGURATION_Handle *cfg)
135{ 267{
136 /* create a Processor */ 268 char *data;
137 LOG("Initializing\n");
138 zbar_processor_t *proc = zbar_processor_create(1);
139
140 // FIXME: Wrap all this into a function which returns an error on
141 // failure. And here ensure the processor is destroyed at the end.
142
143 /* configure the Processor */
144 zbar_processor_parse_config(proc, "enable");
145
146 /* initialize the Processor */
147 LOG("Opening video device %s\n", device);
148 // FIXME: error handling
149 zbar_processor_init(proc, device, 1);
150
151 /* enable the preview window */
152 zbar_processor_set_visible(proc, 1);
153 zbar_processor_set_active(proc, 1);
154
155 /* keep scanning until user provides key/mouse input */
156 //zbar_processor_user_wait(proc, -1);
157 269
158 // read at least one barcode (or until window closed) 270 data = run_zbar ();
159 LOG("Capturing\n"); 271 if (NULL == data)
160 int n; 272 return;
161 n = zbar_process_one(proc, -1); 273 gnunet_uri (cls,
162 LOG("Got %i images\n", n); 274 data,
163 // FIXME: Error handling (n = -1) 275 cfgfile,
164 276 cfg);
165 // hide the preview window 277 if (exit_code != 0)
166 zbar_processor_set_active(proc, 0); 278 {
167 zbar_processor_set_visible(proc, 0); 279 printf ("Failed to add URI %s\n",
168 280 data);
169 // extract results
170 const zbar_symbol_set_t* symbols = zbar_processor_get_results(proc);
171 const zbar_symbol_t* symbol = zbar_symbol_set_first_symbol(symbols);
172
173 if (symbol != NULL) {
174 const char* data = zbar_symbol_get_data(symbol);
175 LOG("Found %s \"%s\"\n",
176 zbar_get_symbol_name(zbar_symbol_get_type(symbol)), data);
177
178 gnunet_uri(cls, data, cfgfile, cfg);
179 if (exit_code != 0) {
180 printf("Failed to add URI %s\n", data);
181 } else {
182 printf("Added URI %s\n", data);
183 }
184 } 281 }
185 282 else
186 /* clean up */ 283 {
187 zbar_processor_destroy(proc); 284 printf ("Added URI %s\n",
285 data);
286 }
287 GNUNET_free (data);
188}; 288};
189 289
190 290
191int 291int
192main (int argc, char *const *argv) 292main (int argc, char *const *argv)
193{ 293{
194 static int ret; 294 int ret;
195 struct GNUNET_GETOPT_CommandLineOption options[] = { 295 struct GNUNET_GETOPT_CommandLineOption options[] = {
196 GNUNET_GETOPT_option_string ('d', "device", "DEVICE", 296 GNUNET_GETOPT_option_string ('d', "device", "DEVICE",
197 gettext_noop ("use video-device DEVICE (default: /dev/video0"), 297 gettext_noop ("use video-device DEVICE (default: /dev/video0"),
@@ -204,6 +304,7 @@ main (int argc, char *const *argv)
204 &silent), 304 &silent),
205 GNUNET_GETOPT_OPTION_END 305 GNUNET_GETOPT_OPTION_END
206 }; 306 };
307
207 ret = GNUNET_PROGRAM_run (argc, 308 ret = GNUNET_PROGRAM_run (argc,
208 argv, 309 argv,
209 "gnunet-qr", 310 "gnunet-qr",
diff --git a/src/vpn/install-vpn-helper.sh b/src/vpn/install-vpn-helper.sh
index 0996e7839..086dabb67 100755
--- a/src/vpn/install-vpn-helper.sh
+++ b/src/vpn/install-vpn-helper.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2# $1 - bindir 2# $1 - bindir
3# $2 - sudo binary (optional) 3# $2 - sudo binary (optional)
4$2 chown root:root $1/gnunet-helper-vpn || true 4$2 chown root:root $1/gnunet-helper-vpn || true
diff --git a/src/vpn/tests/test-helper-icmp.sh b/src/vpn/tests/test-helper-icmp.sh
index eb5bd043b..2d0c8425a 100755
--- a/src/vpn/tests/test-helper-icmp.sh
+++ b/src/vpn/tests/test-helper-icmp.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2 2
3/opt/gnunet/bin/gnunet-helper-vpn < ping > result 2>/dev/null & 3/opt/gnunet/bin/gnunet-helper-vpn < ping > result 2>/dev/null &
4 4
diff --git a/src/vpn/tests/test-helper-ifaddr.sh b/src/vpn/tests/test-helper-ifaddr.sh
index f64f9aa53..b8fde999d 100755
--- a/src/vpn/tests/test-helper-ifaddr.sh
+++ b/src/vpn/tests/test-helper-ifaddr.sh
@@ -1,4 +1,4 @@
1#!/bin/bash 1#!/bin/sh
2 2
3FIFO=$(mktemp) 3FIFO=$(mktemp)
4 4