diff options
Diffstat (limited to 'src')
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 | ||
61 | if HAVE_MHD | 61 | if HAVE_MHD |
62 | if HAVE_JSON | 62 | if HAVE_JSON |
63 | REST_DIR = rest rest-plugins | 63 | REST_DIR = rest |
64 | endif | 64 | endif |
65 | endif | 65 | endif |
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 | ||
129 | endif | 129 | endif |
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@ |
2 | from __future__ import print_function | 2 | |
3 | import os | 3 | import os |
4 | import sys | 4 | import sys |
5 | import shutil | 5 | import 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 | |||
2 | while true; do | 39 | while 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 |
19 | done | 57 | done |
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 | ||
23 | sed -e "s/%LINKS%/$LINKS/;s/%NSE%/$NSE/" profiler.conf > .profiler.conf | 23 | sed -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 | ||
20 | from __future__ import absolute_import | ||
21 | from __future__ import print_function | ||
22 | from __future__ import division | ||
23 | from builtins import str | ||
24 | from builtins import range | ||
25 | from past.utils import old_div | ||
26 | import argparse | 20 | import argparse |
27 | import random | 21 | import random |
28 | from math import ceil, log, floor | 22 | from math import ceil, log, floor |
29 | from past.builtins import xrange | ||
30 | 23 | ||
31 | 24 | ||
32 | def bsc(n): | 25 | def bsc(n): |
@@ -43,14 +36,12 @@ def bsc(n): | |||
43 | 36 | ||
44 | def simulate(k, n, verbose): | 37 | def 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 | ||
3 | export GST_DEBUG_DUMP_DOT_DIR=/tmp/ | 3 | export GST_DEBUG_DUMP_DOT_DIR=/tmp/ |
4 | GST_DEBUG_DUMP_DOT_DIR=/tmp/ ./gnunet-helper-audio-record |GST_DEBUG_DUMP_DOT_DIR=/tmp/ ./gnunet-helper-audio-playback | 4 | GST_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) |
91 | endif | 91 | endif |
92 | endif | 92 | endif |
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 |
2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT | 2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT |
3 | 3 | ||
4 | LOCATION=$(which gnunet-config) | 4 | LOCATION=$(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 | ||
23 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 23 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
24 | 24 | ||
25 | TEST_ATTR="test" | 25 | TEST_ATTR="test" |
26 | TEST_ATTR2="test2" | 26 | TEST_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 |
2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT | 2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT |
3 | 3 | ||
4 | LOCATION=$(which gnunet-config) | 4 | LOCATION=$(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 | ||
25 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 25 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
26 | gnunet-arm -s -c test_credential_lookup.conf | 26 | gnunet-arm -s -c test_credential_lookup.conf |
27 | gnunet-identity -C service -c test_credential_lookup.conf | 27 | gnunet-identity -C service -c test_credential_lookup.conf |
28 | gnunet-identity -C alice -c test_credential_lookup.conf | 28 | gnunet-identity -C alice -c test_credential_lookup.conf |
@@ -82,9 +82,10 @@ gnunet-arm -e -c test_credential_lookup.conf | |||
82 | echo "Done" | 82 | echo "Done" |
83 | if [ "$RES_CRED" != "Failed." ] | 83 | if [ "$RES_CRED" != "Failed." ] |
84 | then | 84 | then |
85 | echo -e "${RES_CRED}" | 85 | # TODO: replace echo -e bashism. |
86 | exit 0 | 86 | echo -e "${RES_CRED}" |
87 | exit 0 | ||
87 | else | 88 | else |
88 | echo "FAIL: Failed to verify credential $RES_CRED." | 89 | echo "FAIL: Failed to verify credential $RES_CRED." |
89 | exit 1 | 90 | exit 1 |
90 | fi | 91 | fi |
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 |
2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT | 2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT |
3 | 3 | ||
4 | LOCATION=$(which gnunet-config) | 4 | LOCATION=$(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 | ||
23 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 23 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
24 | 24 | ||
25 | TEST_ATTR="test" | 25 | TEST_ATTR="test" |
26 | gnunet-arm -s -c test_credential_lookup.conf | 26 | gnunet-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 |
2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT | 2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT |
3 | 3 | ||
4 | LOCATION=$(which gnunet-config) | 4 | LOCATION=$(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 | ||
23 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 23 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
24 | 24 | ||
25 | TEST_ATTR="test" | 25 | TEST_ATTR="test" |
26 | gnunet-arm -s -c test_credential_lookup.conf | 26 | gnunet-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 |
2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT | 2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT |
3 | 3 | ||
4 | LOCATION=$(which gnunet-config) | 4 | LOCATION=$(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 | ||
25 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 25 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
26 | gnunet-arm -s -c test_credential_lookup.conf | 26 | gnunet-arm -s -c test_credential_lookup.conf |
27 | gnunet-identity -C service -c test_credential_lookup.conf | 27 | gnunet-identity -C service -c test_credential_lookup.conf |
28 | gnunet-identity -C alice -c test_credential_lookup.conf | 28 | gnunet-identity -C alice -c test_credential_lookup.conf |
@@ -73,6 +73,7 @@ gnunet-arm -e -c test_credential_lookup.conf | |||
73 | 73 | ||
74 | if [ "$RES_CRED" != "Failed." ] | 74 | if [ "$RES_CRED" != "Failed." ] |
75 | then | 75 | then |
76 | # TODO: replace echo -e bashism | ||
76 | echo -e "${RES_CRED}" | 77 | echo -e "${RES_CRED}" |
77 | exit 0 | 78 | exit 0 |
78 | else | 79 | else |
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 |
2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT | 2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT |
3 | 3 | ||
4 | LOCATION=$(which gnunet-config) | 4 | LOCATION=$(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 | ||
25 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 25 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
26 | gnunet-arm -s -c test_credential_lookup.conf | 26 | gnunet-arm -s -c test_credential_lookup.conf |
27 | gnunet-identity -C service -c test_credential_lookup.conf | 27 | gnunet-identity -C service -c test_credential_lookup.conf |
28 | gnunet-identity -C alice -c test_credential_lookup.conf | 28 | gnunet-identity -C alice -c test_credential_lookup.conf |
@@ -73,6 +73,7 @@ gnunet-arm -e -c test_credential_lookup.conf | |||
73 | 73 | ||
74 | if [ "$RES_CRED" != "Failed." ] | 74 | if [ "$RES_CRED" != "Failed." ] |
75 | then | 75 | then |
76 | # TODO: echo -e bashism | ||
76 | echo -e "${RES_CRED}" | 77 | echo -e "${RES_CRED}" |
77 | exit 0 | 78 | exit 0 |
78 | else | 79 | else |
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 |
2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT | 2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT |
3 | 3 | ||
4 | LOCATION=$(which gnunet-config) | 4 | LOCATION=$(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 | ||
25 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 25 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
26 | gnunet-arm -s -c test_credential_lookup.conf | 26 | gnunet-arm -s -c test_credential_lookup.conf |
27 | gnunet-identity -C service -c test_credential_lookup.conf | 27 | gnunet-identity -C service -c test_credential_lookup.conf |
28 | gnunet-identity -C alice -c test_credential_lookup.conf | 28 | gnunet-identity -C alice -c test_credential_lookup.conf |
@@ -79,6 +79,7 @@ gnunet-arm -e -c test_credential_lookup.conf | |||
79 | 79 | ||
80 | if [ "$RES_CRED" != "Failed." ] | 80 | if [ "$RES_CRED" != "Failed." ] |
81 | then | 81 | then |
82 | # TODO: replace echo -e bashism | ||
82 | echo -e "${RES_CRED}" | 83 | echo -e "${RES_CRED}" |
83 | exit 0 | 84 | exit 0 |
84 | else | 85 | else |
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 |
2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT | 2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT |
3 | 3 | ||
4 | LOCATION=$(which gnunet-config) | 4 | LOCATION=$(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 | ||
21 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 21 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
22 | gnunet-arm -s -c test_credential_lookup.conf | 22 | gnunet-arm -s -c test_credential_lookup.conf |
23 | gnunet-identity -C testissuer -c test_credential_lookup.conf | 23 | gnunet-identity -C testissuer -c test_credential_lookup.conf |
24 | gnunet-identity -C testsubject -c test_credential_lookup.conf | 24 | gnunet-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 | # |
14 | from __future__ import print_function | 14 | |
15 | from __future__ import absolute_import | ||
16 | import os | 15 | import os |
17 | import sys | 16 | import sys |
18 | import shutil | 17 | import 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 | ||
3 | ME=`whoami` | 3 | ME=`whoami` |
4 | if [ "$ME" != "root" ] | 4 | if [ "$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 |
28 | fi | 28 | fi |
29 | if ! iptables -t mangle --list &> /dev/null | 29 | if [ ! -x `which iptables` ] |
30 | then | ||
31 | echo "This test requires iptables. Skipping." | ||
32 | exit 77 | ||
33 | fi | ||
34 | if ! iptables -t mangle --list > /dev/null 2>&1 | ||
30 | then | 35 | then |
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 |
33 | fi | 38 | fi |
34 | if grep % /etc/resolv.conf &> /dev/null | 39 | if grep % /etc/resolv.conf > /dev/null 2>&1 |
35 | then | 40 | then |
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 |
54 | fi | 59 | fi |
60 | # TODO: jobs is a possible bashism. Fix. | ||
55 | kill `jobs -p` | 61 | kill `jobs -p` |
56 | exit $ret | 62 | exit $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 | */ |
125 | static int do_disable_creation_time; | 125 | static 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) |
21 | from __future__ import print_function | 21 | |
22 | import sys | 22 | import sys |
23 | import os | 23 | import os |
24 | import subprocess | 24 | import 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 |
66 | try: | 66 | try: |
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 | |||
89 | endif | 89 | endif |
90 | endif | 90 | endif |
91 | 91 | ||
92 | if HAVE_MHD | ||
93 | if HAVE_JSON | ||
94 | REST_PLUGIN = libgnunet_plugin_rest_gns.la | ||
95 | endif | ||
96 | endif | ||
97 | |||
92 | plugin_LTLIBRARIES = \ | 98 | plugin_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 | ||
97 | bin_SCRIPTS = \ | 104 | bin_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 | |||
115 | libgnunet_plugin_rest_gns_la_SOURCES = \ | ||
116 | plugin_rest_gns.c | ||
117 | libgnunet_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 | ||
125 | libgnunet_plugin_rest_gns_la_LDFLAGS = \ | ||
126 | $(GN_PLUGIN_LDFLAGS) | ||
127 | |||
128 | |||
107 | libgnunet_plugin_gnsrecord_gns_la_SOURCES = \ | 129 | libgnunet_plugin_gnsrecord_gns_la_SOURCES = \ |
108 | plugin_gnsrecord_gns.c | 130 | plugin_gnsrecord_gns.c |
109 | libgnunet_plugin_gnsrecord_gns_la_LIBADD = \ | 131 | libgnunet_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 | |||
32 | BINARY = gnunet-gns-proxy | 32 | BINARY = gnunet-gns-proxy |
33 | START_ON_DEMAND = NO | 33 | START_ON_DEMAND = NO |
34 | RUN_PER_USER = YES | 34 | RUN_PER_USER = YES |
35 | BIND_TO=127.0.0.1 | ||
36 | BIND_TO6=::1 | ||
35 | 37 | ||
36 | # Where is the certificate for the GNS proxy stored? | 38 | # Where is the certificate for the GNS proxy stored? |
37 | PROXY_CACERT = $GNUNET_DATA_HOME/gns/gns_ca_cert.pem | 39 | PROXY_CACERT = $GNUNET_DATA_HOME/gns/gns_ca_cert.pem |
@@ -42,6 +44,8 @@ PROXY_UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-gns-proxy.sock | |||
42 | BINARY = gnunet-dns2gns | 44 | BINARY = gnunet-dns2gns |
43 | START_ON_DEMAND = NO | 45 | START_ON_DEMAND = NO |
44 | RUN_PER_USER = YES | 46 | RUN_PER_USER = YES |
47 | BIND_TO=127.0.0.1 | ||
48 | BIND_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 |
47 | OPTIONS = -d 8.8.8.8 | 51 | OPTIONS = -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 | */ | ||
98 | static in_addr_t address; | ||
99 | |||
100 | /** | ||
101 | * The IPv6 address to bind to | ||
102 | */ | ||
103 | static 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 | ||
6 | OPENSSLCFG=@pkgdatadir@/openssl.cnf | 33 | # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND |
7 | if ! which openssl > /dev/null | 34 | # CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
8 | then | 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. |
11 | fi | 38 | # IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR |
12 | 39 | # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
13 | echo "Generating CA" | 40 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
14 | options='' | 41 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
15 | while 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 | 49 | progname=${0##*/} |
23 | ;; | 50 | |
24 | :) | 51 | setdefaults() |
25 | echo "Option -$OPTARG requires an argument." >&2 | 52 | { |
26 | exit 1 | 53 | verbosity=0 |
27 | ;; | 54 | runcmd= |
28 | esac | 55 | } |
29 | done | 56 | |
30 | 57 | statusmsg() | |
31 | GNSCERT=`mktemp /tmp/gnscertXXXXXX.pem` | 58 | { |
32 | GNSCAKY=`mktemp /tmp/gnscakeyXXXXXX.pem` | 59 | ${runcmd} echo " $@" |
33 | GNSCANO=`mktemp /tmp/gnscakeynoencXXXXXX.pem` | 60 | } |
34 | GNS_CA_CERT_PEM=`gnunet-config -s gns-proxy -o PROXY_CACERT -f $options` | 61 | |
35 | mkdir -p `dirname $GNS_CA_CERT_PEM` | 62 | infomsg() |
36 | 63 | { | |
37 | 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" | 64 | if [ $verbosity = 1 ]; then |
38 | 65 | statusmsg "INFO: $@" | |
39 | echo "Removing passphrase from key" | ||
40 | openssl rsa -passin pass:"GNU Name System" -in $GNSCAKY -out $GNSCANO | ||
41 | |||
42 | echo "Making private key available to gnunet-gns-proxy" | ||
43 | cat $GNSCERT $GNSCANO > $GNS_CA_CERT_PEM | ||
44 | |||
45 | if ! which certutil > /dev/null | ||
46 | then | ||
47 | echo "The 'certutil' command was not found. Not importing into browsers." | ||
48 | echo "For 'certutil' install nss." | ||
49 | else | ||
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 | 69 | warningmsg() |
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 | 74 | errormsg() |
68 | fi | 75 | { |
69 | fi | 76 | statusmsg "ERROR: $@" |
70 | 77 | } | |
71 | echo "Cleaning up." | 78 | |
72 | rm -f $GNSCAKY $GNSCANO $GNSCERT | 79 | linemsg() |
73 | 80 | { | |
74 | echo "===================================" | 81 | statusmsg "=========================================" |
75 | echo "You can now start gnunet-gns-proxy." | 82 | } |
76 | echo "Afterwards, configure your browser " | 83 | |
77 | echo " to use a SOCKS proxy on port 7777." | 84 | |
78 | echo "===================================" | 85 | usage() |
86 | { | ||
87 | if [ -n "$*" ]; then | ||
88 | echo "" | ||
89 | echo "${progname}: $*" | ||
90 | fi | ||
91 | cat <<_usage_ | ||
92 | |||
93 | Usage: ${progname} [-hv] [-c FILE] [...] | ||
94 | |||
95 | Options: | ||
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 | |||
106 | generate_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 | |||
161 | importbrowsers() | ||
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 | |||
196 | print_version() | ||
197 | { | ||
198 | GNUNET_ARM_VERSION=`gnunet-arm -v` | ||
199 | echo $GNUNET_ARM_VERSION | ||
200 | } | ||
201 | |||
202 | clean_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 | |||
217 | main() | ||
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 | |||
252 | main "$@" | ||
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 | */ | ||
667 | static in_addr_t address; | ||
668 | |||
669 | /** | ||
670 | * The IPv6 address to bind to | ||
671 | */ | ||
672 | static 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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | 4 | ||
@@ -14,7 +14,7 @@ then | |||
14 | exit 77 | 14 | exit 77 |
15 | fi | 15 | fi |
16 | 16 | ||
17 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | 17 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5" |
18 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 18 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
19 | 19 | ||
20 | TEST_IP="127.0.0.1" | 20 | TEST_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 | |||
31 | gnunet-arm -e -c test_gns_lookup.conf | 31 | gnunet-arm -e -c test_gns_lookup.conf |
32 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 32 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
33 | 33 | ||
34 | if [ "$RES_IP" == "$TEST_IP" ] | 34 | if [ "$RES_IP" = "$TEST_IP" ] |
35 | then | 35 | then |
36 | exit 0 | 36 | exit 0 |
37 | else | 37 | else |
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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "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 |
18 | DNS_RESOLVER="8.8.8.8" | 18 | DNS_RESOLVER="8.8.8.8" |
19 | if ! nslookup gnunet.org $DNS_RESOLVER &> /dev/null | 19 | if ! nslookup gnunet.org $DNS_RESOLVER > /dev/null 2>&1 |
20 | then | 20 | then |
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" | |||
36 | MY_EGO="myego" | 36 | MY_EGO="myego" |
37 | TEST_DOMAIN_PLUS="www.$MY_EGO" | 37 | TEST_DOMAIN_PLUS="www.$MY_EGO" |
38 | TEST_DOMAIN_DNS="www3.$MY_EGO" | 38 | TEST_DOMAIN_DNS="www3.$MY_EGO" |
39 | which timeout &> /dev/null && DO_TIMEOUT="timeout 15" | 39 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15" |
40 | 40 | ||
41 | gnunet-arm -s -c test_gns_lookup.conf | 41 | gnunet-arm -s -c test_gns_lookup.conf |
42 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf | 42 | gnunet-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 |
58 | RES_CNAME_RAW=`echo $RES_CNAME_RAW | tr [A-Z] [a-z]` | 58 | RES_CNAME_RAW=`echo $RES_CNAME_RAW | tr [A-Z] [a-z]` |
59 | TESTEGOZONE=`echo $TESTEGOZONE | tr [A-Z] [a-z]` | 59 | TESTEGOZONE=`echo $TESTEGOZONE | tr [A-Z] [a-z]` |
60 | if [ "$RES_CNAME_RAW" == "server.$TESTEGOZONE" ] | 60 | if [ "$RES_CNAME_RAW" = "server.$TESTEGOZONE" ] |
61 | then | 61 | then |
62 | echo "PASS: CNAME resolution from GNS" | 62 | echo "PASS: CNAME resolution from GNS" |
63 | else | 63 | else |
@@ -65,7 +65,7 @@ else | |||
65 | exit 1 | 65 | exit 1 |
66 | fi | 66 | fi |
67 | 67 | ||
68 | if [ "$RES_CNAME" == "$TEST_IP_PLUS" ] | 68 | if [ "$RES_CNAME" = "$TEST_IP_PLUS" ] |
69 | then | 69 | then |
70 | echo "PASS: IP resolution from GNS" | 70 | echo "PASS: IP resolution from GNS" |
71 | else | 71 | else |
@@ -73,7 +73,7 @@ else | |||
73 | exit 1 | 73 | exit 1 |
74 | fi | 74 | fi |
75 | 75 | ||
76 | if [ "$RES_CNAME_DNS" == "$TEST_IP_DNS" ] | 76 | if [ "$RES_CNAME_DNS" = "$TEST_IP_DNS" ] |
77 | then | 77 | then |
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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | 4 | ||
@@ -18,7 +18,7 @@ MY_EGO="myego" | |||
18 | rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` | 18 | rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` |
19 | CFG=`mktemp --tmpdir=$PWD` | 19 | CFG=`mktemp --tmpdir=$PWD` |
20 | cp test_gns_lookup.conf $CFG || exit 77 | 20 | cp test_gns_lookup.conf $CFG || exit 77 |
21 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | 21 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5" |
22 | TEST_IP="dead::beef" | 22 | TEST_IP="dead::beef" |
23 | gnunet-arm -s -c $CFG || exit 77 | 23 | gnunet-arm -s -c $CFG || exit 77 |
24 | gnunet-identity -C $MY_EGO -c $CFG | 24 | gnunet-identity -C $MY_EGO -c $CFG |
@@ -35,7 +35,7 @@ gnunet-arm -e -c $CFG | |||
35 | rm -rf `gnunet-config -c $CFG -f -s paths -o GNUNET_TEST_HOME` | 35 | rm -rf `gnunet-config -c $CFG -f -s paths -o GNUNET_TEST_HOME` |
36 | rm $CFG | 36 | rm $CFG |
37 | 37 | ||
38 | if [ "$RES_IP" == "$TEST_IP" ] | 38 | if [ "$RES_IP" = "$TEST_IP" ] |
39 | then | 39 | then |
40 | exit 0 | 40 | exit 0 |
41 | else | 41 | else |
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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 4 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
5 | 5 | ||
6 | LOCATION=$(which gnunet-config) | 6 | LOCATION=$(which gnunet-config) |
7 | if [ -z $LOCATION ] | 7 | if [ -z $LOCATION ] |
@@ -35,7 +35,7 @@ gnunet-arm -e -c test_gns_lookup.conf | |||
35 | 35 | ||
36 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 36 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
37 | 37 | ||
38 | if [ "$RES_IP" == "$TEST_IP" ] | 38 | if [ "$RES_IP" = "$TEST_IP" ] |
39 | then | 39 | then |
40 | exit 0 | 40 | exit 0 |
41 | else | 41 | else |
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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 4 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
5 | 5 | ||
6 | LOCATION=$(which gnunet-config) | 6 | LOCATION=$(which gnunet-config) |
7 | if [ -z $LOCATION ] | 7 | if [ -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 |
57 | fi | 57 | fi |
58 | if [ "$RES_IP" == "$TEST_IP" ] | 58 | if [ "$RES_IP" = "$TEST_IP" ] |
59 | then | 59 | then |
60 | exit 0 | 60 | exit 0 |
61 | else | 61 | else |
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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | 4 | ||
@@ -25,7 +25,7 @@ TEST_RECORD_NAME="homepage" | |||
25 | 25 | ||
26 | XNS=ns.joker.com | 26 | XNS=ns.joker.com |
27 | 27 | ||
28 | if ! nslookup gnunet.org a.$XNS &> /dev/null | 28 | if ! nslookup gnunet.org a.$XNS > /dev/null 2>&1 |
29 | then | 29 | then |
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 |
44 | TEST_DOMAIN="www.${TEST_RECORD_NAME}.$MY_EGO" | 44 | TEST_DOMAIN="www.${TEST_RECORD_NAME}.$MY_EGO" |
45 | 45 | ||
46 | which timeout &> /dev/null && DO_TIMEOUT="timeout 15" | 46 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15" |
47 | 47 | ||
48 | gnunet-arm -s -c test_gns_lookup.conf | 48 | gnunet-arm -s -c test_gns_lookup.conf |
49 | OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf gnunet.org` | 49 | OUT=`$DO_TIMEOUT gnunet-resolver -c test_gns_lookup.conf gnunet.org` |
@@ -77,7 +77,7 @@ gnunet-arm -e -c test_gns_lookup.conf | |||
77 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 77 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
78 | 78 | ||
79 | ret=0 | 79 | ret=0 |
80 | if [ "$RES_IP" == "$TEST_IP" ] | 80 | if [ "$RES_IP" = "$TEST_IP" ] |
81 | then | 81 | then |
82 | echo "PASS: Resolved $TEST_DOMAIN to $RES_IP." | 82 | echo "PASS: Resolved $TEST_DOMAIN to $RES_IP." |
83 | else | 83 | else |
@@ -85,7 +85,7 @@ else | |||
85 | ret=1 | 85 | ret=1 |
86 | fi | 86 | fi |
87 | 87 | ||
88 | if [ "$RES_IP6" == "$TEST_IP6" ] | 88 | if [ "$RES_IP6" = "$TEST_IP6" ] |
89 | then | 89 | then |
90 | echo "PASS: Resolved $TEST_DOMAIN to $RES_IP6." | 90 | echo "PASS: Resolved $TEST_DOMAIN to $RES_IP6." |
91 | else | 91 | else |
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 |
2 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 2 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
3 | 3 | ||
4 | LOCATION=$(which gnunet-config) | 4 | LOCATION=$(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 |
27 | TEST_RECORD_NAME="homepage" | 27 | TEST_RECORD_NAME="homepage" |
28 | 28 | ||
29 | if ! nslookup gnunet.org $TEST_IP_GNS2DNS &> /dev/null | 29 | if ! nslookup gnunet.org $TEST_IP_GNS2DNS > /dev/null 2>&1 |
30 | then | 30 | then |
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" | |||
44 | TEST_DOMAIN_ALT="${TEST_RECORD_NAME}.$MY_EGO" | 44 | TEST_DOMAIN_ALT="${TEST_RECORD_NAME}.$MY_EGO" |
45 | TEST_DOMAIN_ALT2="docs.${TEST_RECORD_NAME}.$MY_EGO" | 45 | TEST_DOMAIN_ALT2="docs.${TEST_RECORD_NAME}.$MY_EGO" |
46 | 46 | ||
47 | which timeout &> /dev/null && DO_TIMEOUT="timeout 15" | 47 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 15" |
48 | 48 | ||
49 | 49 | ||
50 | gnunet-arm -s -c test_gns_lookup.conf | 50 | gnunet-arm -s -c test_gns_lookup.conf |
@@ -83,7 +83,7 @@ gnunet-arm -e -c test_gns_lookup.conf | |||
83 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 83 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
84 | 84 | ||
85 | ret=0 | 85 | ret=0 |
86 | if [ "$RES_IP" == "$TEST_IP" ] | 86 | if [ "$RES_IP" = "$TEST_IP" ] |
87 | then | 87 | then |
88 | echo "PASS: Resolved $TEST_DOMAIN to $RES_IP." | 88 | echo "PASS: Resolved $TEST_DOMAIN to $RES_IP." |
89 | else | 89 | else |
@@ -91,7 +91,7 @@ else | |||
91 | ret=1 | 91 | ret=1 |
92 | fi | 92 | fi |
93 | 93 | ||
94 | if [ "$RES_IP6" == "$TEST_IP6" ] | 94 | if [ "$RES_IP6" = "$TEST_IP6" ] |
95 | then | 95 | then |
96 | echo "PASS: Resolved $TEST_DOMAIN to $RES_IP6." | 96 | echo "PASS: Resolved $TEST_DOMAIN to $RES_IP6." |
97 | else | 97 | else |
@@ -99,7 +99,7 @@ else | |||
99 | ret=1 | 99 | ret=1 |
100 | fi | 100 | fi |
101 | 101 | ||
102 | if [ "$RES_IP_ALT" == "$TEST_IP" ] | 102 | if [ "$RES_IP_ALT" = "$TEST_IP" ] |
103 | then | 103 | then |
104 | echo "PASS: Resolved $TEST_DOMAIN_ALT to $RES_IP_ALT." | 104 | echo "PASS: Resolved $TEST_DOMAIN_ALT to $RES_IP_ALT." |
105 | else | 105 | else |
@@ -107,7 +107,7 @@ else | |||
107 | ret=1 | 107 | ret=1 |
108 | fi | 108 | fi |
109 | 109 | ||
110 | if [ "$RES_IP_ALT2" == "$TEST_IP_ALT2" ] | 110 | if [ "$RES_IP_ALT2" = "$TEST_IP_ALT2" ] |
111 | then | 111 | then |
112 | echo "PASS: Resolved $TEST_DOMAIN_ALT2 to $RES_IP_ALT2." | 112 | echo "PASS: Resolved $TEST_DOMAIN_ALT2 to $RES_IP_ALT2." |
113 | else | 113 | else |
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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | 4 | ||
@@ -16,7 +16,7 @@ fi | |||
16 | MY_EGO="myego" | 16 | MY_EGO="myego" |
17 | 17 | ||
18 | rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` | 18 | rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` |
19 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 19 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
20 | TEST_IP="dead::beef" | 20 | TEST_IP="dead::beef" |
21 | gnunet-arm -s -c test_gns_lookup.conf | 21 | gnunet-arm -s -c test_gns_lookup.conf |
22 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf | 22 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
@@ -27,7 +27,7 @@ gnunet-identity -D $MY_EGO -c test_gns_lookup.conf | |||
27 | gnunet-arm -e -c test_gns_lookup.conf | 27 | gnunet-arm -e -c test_gns_lookup.conf |
28 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 28 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
29 | 29 | ||
30 | if [ "$RES_IP" == "$TEST_IP" ] | 30 | if [ "$RES_IP" = "$TEST_IP" ] |
31 | then | 31 | then |
32 | exit 0 | 32 | exit 0 |
33 | else | 33 | else |
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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | 4 | ||
@@ -15,7 +15,7 @@ then | |||
15 | fi | 15 | fi |
16 | 16 | ||
17 | rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` | 17 | rm -rf `gnunet-config -c test_gns_lookup.conf -s PATHS -o GNUNET_HOME -f` |
18 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 18 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
19 | TEST_IP="127.0.0.1" | 19 | TEST_IP="127.0.0.1" |
20 | MY_EGO="myego" | 20 | MY_EGO="myego" |
21 | LABEL="www" | 21 | LABEL="www" |
@@ -27,7 +27,7 @@ gnunet-namestore -z $MY_EGO -d -n $LABEL -t A -V $TEST_IP -e never -c test_gns_l | |||
27 | gnunet-identity -D $MY_EGO -c test_gns_lookup.conf | 27 | gnunet-identity -D $MY_EGO -c test_gns_lookup.conf |
28 | gnunet-arm -e -c test_gns_lookup.conf | 28 | gnunet-arm -e -c test_gns_lookup.conf |
29 | 29 | ||
30 | if [ "$RES_IP" == "$TEST_IP" ] | 30 | if [ "$RES_IP" = "$TEST_IP" ] |
31 | then | 31 | then |
32 | exit 0 | 32 | exit 0 |
33 | else | 33 | else |
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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | 4 | ||
@@ -15,7 +15,7 @@ then | |||
15 | fi | 15 | fi |
16 | 16 | ||
17 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 17 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
18 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | 18 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5" |
19 | 19 | ||
20 | MY_EGO="myego" | 20 | MY_EGO="myego" |
21 | TEST_MX="5,mail.+" | 21 | TEST_MX="5,mail.+" |
@@ -35,7 +35,7 @@ rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | |||
35 | RES_MX=`echo $RES_MX | tr [A-Z] [a-z]` | 35 | RES_MX=`echo $RES_MX | tr [A-Z] [a-z]` |
36 | WANT_MX=`echo $WANT_MX | tr [A-Z] [a-z]` | 36 | WANT_MX=`echo $WANT_MX | tr [A-Z] [a-z]` |
37 | 37 | ||
38 | if [ "$RES_MX" == "$WANT_MX" ] | 38 | if [ "$RES_MX" = "$WANT_MX" ] |
39 | then | 39 | then |
40 | exit 0 | 40 | exit 0 |
41 | else | 41 | else |
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 | ||
51 | static struct MHD_Daemon *mhd; | 51 | static struct MHD_Daemon *mhd; |
52 | 52 | ||
53 | static struct GNUNET_SCHEDULER_Task * mhd_task_id; | 53 | static struct GNUNET_SCHEDULER_Task *mhd_task_id; |
54 | 54 | ||
55 | static struct GNUNET_SCHEDULER_Task * curl_task_id; | 55 | static struct GNUNET_SCHEDULER_Task *curl_task_id; |
56 | 56 | ||
57 | static CURL *curl; | 57 | static CURL *curl; |
58 | 58 | ||
@@ -349,6 +349,7 @@ curl_main () | |||
349 | static void | 349 | static void |
350 | start_curl (void *cls) | 350 | start_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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | 4 | ||
@@ -19,7 +19,7 @@ OTHER_EGO="delegatedego" | |||
19 | 19 | ||
20 | 20 | ||
21 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 21 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
22 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | 22 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5" |
23 | TEST_IP="127.0.0.1" | 23 | TEST_IP="127.0.0.1" |
24 | gnunet-arm -s -c test_gns_lookup.conf | 24 | gnunet-arm -s -c test_gns_lookup.conf |
25 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf | 25 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
@@ -56,7 +56,7 @@ gnunet-identity -D $OTHER_EGO -c test_gns_lookup.conf | |||
56 | gnunet-arm -e -c test_gns_lookup.conf | 56 | gnunet-arm -e -c test_gns_lookup.conf |
57 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 57 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
58 | 58 | ||
59 | if [ "$RES_IP" == "$TEST_IP" ] | 59 | if [ "$RES_IP" = "$TEST_IP" ] |
60 | then | 60 | then |
61 | exit 0 | 61 | exit 0 |
62 | else | 62 | else |
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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | 4 | ||
@@ -25,7 +25,7 @@ MY_EGO="myego" | |||
25 | OTHER_EGO="delegatedego" | 25 | OTHER_EGO="delegatedego" |
26 | 26 | ||
27 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 27 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
28 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | 28 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5" |
29 | TEST_IP="127.0.0.1" | 29 | TEST_IP="127.0.0.1" |
30 | gnunet-arm -s -c test_gns_lookup.conf | 30 | gnunet-arm -s -c test_gns_lookup.conf |
31 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf | 31 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
@@ -48,13 +48,13 @@ gnunet-identity -D $OTHER_EGO -c test_gns_lookup.conf | |||
48 | gnunet-arm -e -c test_gns_lookup.conf | 48 | gnunet-arm -e -c test_gns_lookup.conf |
49 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 49 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
50 | 50 | ||
51 | if [ "$RES_IP_EXP" == "$TEST_IP" ] | 51 | if [ "$RES_IP_EXP" = "$TEST_IP" ] |
52 | then | 52 | then |
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 |
55 | fi | 55 | fi |
56 | 56 | ||
57 | if [ "$RES_IP" == "$TEST_IP" ] | 57 | if [ "$RES_IP" = "$TEST_IP" ] |
58 | then | 58 | then |
59 | exit 0 | 59 | exit 0 |
60 | else | 60 | else |
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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | 4 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5" |
5 | 5 | ||
6 | LOCATION=$(which gnunet-config) | 6 | LOCATION=$(which gnunet-config) |
7 | if [ -z $LOCATION ] | 7 | if [ -z $LOCATION ] |
@@ -40,7 +40,7 @@ then | |||
40 | exit 1 | 40 | exit 1 |
41 | fi | 41 | fi |
42 | 42 | ||
43 | if [ "x$RES_IP_REV" == "x" ] | 43 | if [ "x$RES_IP_REV" = "x" ] |
44 | then | 44 | then |
45 | exit 0 | 45 | exit 0 |
46 | else | 46 | else |
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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | 4 | ||
@@ -14,7 +14,7 @@ then | |||
14 | exit 77 | 14 | exit 77 |
15 | fi | 15 | fi |
16 | 16 | ||
17 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | 17 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5" |
18 | 18 | ||
19 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 19 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
20 | MY_EGO="myego" | 20 | MY_EGO="myego" |
@@ -24,7 +24,7 @@ TEST_IP_GNS2DNS="184.172.157.218" | |||
24 | TEST_RECORD_NAME="homepage" | 24 | TEST_RECORD_NAME="homepage" |
25 | TEST_RECORD_GNS2DNS="gnunet.org" | 25 | TEST_RECORD_GNS2DNS="gnunet.org" |
26 | 26 | ||
27 | if ! nslookup $TEST_RECORD_GNS2DNS $TEST_IP_GNS2DNS &> /dev/null | 27 | if ! nslookup $TEST_RECORD_GNS2DNS $TEST_IP_GNS2DNS > /dev/null 2>&1 |
28 | then | 28 | then |
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 | |||
34 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf | 34 | gnunet-identity -C $MY_EGO -c test_gns_lookup.conf |
35 | gnunet-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 | 35 | gnunet-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 |
36 | RES_SOA=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t SOA -c test_gns_lookup.conf` | 36 | RES_SOA=`$DO_TIMEOUT gnunet-gns --raw -u $TEST_DOMAIN -t SOA -c test_gns_lookup.conf` |
37 | gnunet-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 | 37 | gnunet-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 |
38 | gnunet-identity -D $MY_EGO -c test_gns_lookup.conf | 38 | gnunet-identity -D $MY_EGO -c test_gns_lookup.conf |
39 | gnunet-arm -e -c test_gns_lookup.conf | 39 | gnunet-arm -e -c test_gns_lookup.conf |
40 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 40 | rm -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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | 4 | ||
@@ -15,7 +15,7 @@ then | |||
15 | fi | 15 | fi |
16 | 16 | ||
17 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 17 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
18 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 18 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
19 | TEST_TXT="GNS powered txt record data" | 19 | TEST_TXT="GNS powered txt record data" |
20 | MY_EGO="myego" | 20 | MY_EGO="myego" |
21 | LABEL="testtxt" | 21 | LABEL="testtxt" |
@@ -28,7 +28,7 @@ gnunet-identity -D $MY_EGO -c test_gns_lookup.conf | |||
28 | gnunet-arm -e -c test_gns_lookup.conf | 28 | gnunet-arm -e -c test_gns_lookup.conf |
29 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 29 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
30 | 30 | ||
31 | if [ "$RES_TXT" == "$TEST_TXT" ] | 31 | if [ "$RES_TXT" = "$TEST_TXT" ] |
32 | then | 32 | then |
33 | exit 0 | 33 | exit 0 |
34 | else | 34 | else |
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. |
3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 3 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
4 | which timeout &> /dev/null && DO_TIMEOUT="timeout 5" | 4 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 5" |
5 | 5 | ||
6 | LOCATION=$(which gnunet-config) | 6 | LOCATION=$(which gnunet-config) |
7 | if [ -z $LOCATION ] | 7 | if [ -z $LOCATION ] |
@@ -30,7 +30,7 @@ gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gn | |||
30 | gnunet-arm -e -c test_gns_lookup.conf | 30 | gnunet-arm -e -c test_gns_lookup.conf |
31 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` | 31 | rm -rf `gnunet-config -c test_gns_lookup.conf -f -s paths -o GNUNET_TEST_HOME` |
32 | 32 | ||
33 | if [ "$RES_IP" == "$TEST_IP" ] | 33 | if [ "$RES_IP" = "$TEST_IP" ] |
34 | then | 34 | then |
35 | exit 0 | 35 | exit 0 |
36 | else | 36 | else |
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. |
3 | LOCATION=$(which gnunet-config) | 3 | # test -z being correct was a false assumption here. |
4 | if [ -z $LOCATION ] | 4 | # I have no executable 'fooble', but this will |
5 | then | 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. | ||
9 | existence() | ||
10 | { | ||
11 | command -v "$1" >/dev/null 2>&1 | ||
12 | } | ||
13 | |||
14 | LOCATION=`existence gnunet-config` | ||
15 | if test -z $LOCATION; then | ||
16 | LOCATION="gnunet-config" | ||
7 | fi | 17 | fi |
8 | $LOCATION --version | 18 | $LOCATION --version |
9 | if test $? != 0 | 19 | if test $? != 0 |
10 | then | 20 | then |
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 |
13 | fi | 23 | fi |
14 | 24 | ||
15 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT | 25 | trap "gnunet-arm -e -c test_gns_lookup.conf" SIGINT |
@@ -32,4 +42,5 @@ if [ "$LO" != "Address: 4.5.6.7" ] | |||
32 | then | 42 | then |
33 | echo "Fail: $LO" | 43 | echo "Fail: $LO" |
34 | fi | 44 | fi |
45 | # XXX: jobs. a builtin by bash, netbsd sh, maybe leave it be for now. | ||
35 | kill `jobs -p` | 46 | kill `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. | |
3 | TEST_DOMAIN="www.test" | 3 | TEST_DOMAIN="www.test" |
4 | 4 | ||
5 | # Delete old files before starting test | ||
6 | rm -rf /tmp/gnunet/test-gnunet-gns-testing/ | ||
5 | gnunet-arm -s -c test_gns_proxy.conf | 7 | gnunet-arm -s -c test_gns_proxy.conf |
6 | gnunet-gns-proxy-setup-ca -c test_gns_proxy.conf | 8 | gnunet-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 | |||
20 | OPTIONS = -b | 20 | OPTIONS = -b |
21 | 21 | ||
22 | # Default list of hostlist servers for bootstrapping | 22 | # Default list of hostlist servers for bootstrapping |
23 | SERVERS = http://v10.gnunet.org/hostlist https://gnunet.io/hostlist | 23 | SERVERS = 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 |
13 | endif | 13 | endif |
14 | 14 | ||
15 | if HAVE_MHD | ||
16 | if HAVE_JSON | ||
17 | REST_PLUGIN = libgnunet_plugin_rest_identity.la | ||
18 | endif | ||
19 | endif | ||
20 | |||
15 | pkgcfgdir= $(pkgdatadir)/config.d/ | 21 | pkgcfgdir= $(pkgdatadir)/config.d/ |
16 | 22 | ||
17 | libexecdir= $(pkglibdir)/libexec/ | 23 | libexecdir= $(pkglibdir)/libexec/ |
@@ -20,7 +26,20 @@ pkgcfg_DATA = \ | |||
20 | identity.conf | 26 | identity.conf |
21 | 27 | ||
22 | lib_LTLIBRARIES = \ | 28 | lib_LTLIBRARIES = \ |
23 | libgnunetidentity.la | 29 | libgnunetidentity.la \ |
30 | $(REST_PLUGIN) | ||
31 | |||
32 | |||
33 | libgnunet_plugin_rest_identity_la_SOURCES = \ | ||
34 | plugin_rest_identity.c | ||
35 | libgnunet_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 | ||
40 | libgnunet_plugin_rest_identity_la_LDFLAGS = \ | ||
41 | $(GN_PLUGIN_LDFLAGS) | ||
42 | |||
24 | 43 | ||
25 | libgnunetidentity_la_SOURCES = \ | 44 | libgnunetidentity_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 |
25 | endif | 25 | endif |
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 |
21 | from __future__ import print_function | 21 | |
22 | from builtins import object | ||
23 | import os | 22 | import os |
24 | import re | 23 | import re |
25 | import subprocess | 24 | import 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 |
21 | from __future__ import unicode_literals | 21 | |
22 | from __future__ import print_function | ||
23 | from builtins import object | ||
24 | from builtins import str | ||
25 | import os | 22 | import os |
26 | import subprocess | 23 | import subprocess |
27 | import sys | 24 | import 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 | # |
21 | from __future__ import print_function | 21 | |
22 | import signal | 22 | import signal |
23 | import sys | 23 | import sys |
24 | import os | 24 | import 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 | ||
28 | from __future__ import print_function | ||
29 | import sys | 28 | import sys |
30 | import signal | 29 | import signal |
31 | import os | 30 | import 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 | # |
21 | from __future__ import print_function | 21 | |
22 | import sys | 22 | import sys |
23 | import signal | 23 | import signal |
24 | import os | 24 | import 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 | # |
21 | from __future__ import print_function | 21 | |
22 | import sys | 22 | import sys |
23 | import signal | 23 | import signal |
24 | import os | 24 | import 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 | # |
21 | from __future__ import print_function | 21 | |
22 | import sys | 22 | import sys |
23 | import os | 23 | import os |
24 | import subprocess | 24 | import 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 | # |
21 | from __future__ import print_function | 21 | |
22 | import sys | 22 | import sys |
23 | import os | 23 | import os |
24 | import subprocess | 24 | import 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) |
105 | endif | 105 | endif |
106 | 106 | ||
107 | if HAVE_MHD | ||
108 | if HAVE_JSON | ||
109 | REST_PLUGIN = libgnunet_plugin_rest_namestore.la | ||
110 | endif | ||
111 | endif | ||
112 | |||
107 | lib_LTLIBRARIES = \ | 113 | lib_LTLIBRARIES = \ |
108 | libgnunetnamestore.la | 114 | libgnunetnamestore.la |
109 | 115 | ||
110 | 116 | ||
117 | libexec_PROGRAMS = \ | ||
118 | gnunet-service-namestore | ||
119 | |||
120 | bin_PROGRAMS = \ | ||
121 | gnunet-namestore \ | ||
122 | gnunet-zoneimport | ||
123 | |||
124 | if HAVE_MHD | ||
125 | libexec_PROGRAMS += \ | ||
126 | gnunet-namestore-fcfsd | ||
127 | endif | ||
128 | |||
129 | |||
130 | plugin_LTLIBRARIES = \ | ||
131 | $(SQLITE_PLUGIN) \ | ||
132 | $(POSTGRES_PLUGIN) \ | ||
133 | $(HEAP_PLUGIN) \ | ||
134 | $(REST_PLUGIN) | ||
135 | |||
136 | |||
137 | libgnunet_plugin_rest_namestore_la_SOURCES = \ | ||
138 | plugin_rest_namestore.c | ||
139 | libgnunet_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 | ||
147 | libgnunet_plugin_rest_namestore_la_LDFLAGS = \ | ||
148 | $(GN_PLUGIN_LDFLAGS) | ||
149 | |||
150 | |||
111 | libgnunetnamestore_la_SOURCES = \ | 151 | libgnunetnamestore_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 | ||
124 | libexec_PROGRAMS = \ | ||
125 | gnunet-service-namestore | ||
126 | |||
127 | bin_PROGRAMS = \ | ||
128 | gnunet-namestore \ | ||
129 | gnunet-zoneimport | ||
130 | |||
131 | if HAVE_MHD | ||
132 | libexec_PROGRAMS += \ | ||
133 | gnunet-namestore-fcfsd | ||
134 | endif | ||
135 | 164 | ||
136 | 165 | ||
137 | gnunet_zoneimport_SOURCES = \ | 166 | gnunet_zoneimport_SOURCES = \ |
@@ -176,12 +205,6 @@ gnunet_service_namestore_LDADD = \ | |||
176 | $(GN_LIBINTL) | 205 | $(GN_LIBINTL) |
177 | 206 | ||
178 | 207 | ||
179 | plugin_LTLIBRARIES = \ | ||
180 | $(SQLITE_PLUGIN) \ | ||
181 | $(POSTGRES_PLUGIN) \ | ||
182 | $(HEAP_PLUGIN) | ||
183 | |||
184 | |||
185 | 208 | ||
186 | libgnunet_plugin_namestore_heap_la_SOURCES = \ | 209 | libgnunet_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 | ||
6 | libexecdir= $(pkglibdir)/libexec/ | 6 | libexecdir= $(pkglibdir)/libexec/ |
7 | 7 | ||
8 | plugindir = $(libdir)/gnunet | ||
9 | |||
8 | pkgcfg_DATA = \ | 10 | pkgcfg_DATA = \ |
9 | peerinfo.conf | 11 | peerinfo.conf |
10 | 12 | ||
@@ -17,8 +19,29 @@ if USE_COVERAGE | |||
17 | XLIB = -lgcov | 19 | XLIB = -lgcov |
18 | endif | 20 | endif |
19 | 21 | ||
22 | if HAVE_MHD | ||
23 | if HAVE_JSON | ||
24 | REST_PLUGIN = libgnunet_plugin_rest_peerinfo.la | ||
25 | endif | ||
26 | endif | ||
27 | |||
20 | lib_LTLIBRARIES = libgnunetpeerinfo.la | 28 | lib_LTLIBRARIES = libgnunetpeerinfo.la |
21 | 29 | ||
30 | plugin_LTLIBRARIES = $(REST_PLUGIN) | ||
31 | |||
32 | libgnunet_plugin_rest_peerinfo_la_SOURCES = \ | ||
33 | plugin_rest_peerinfo.c | ||
34 | libgnunet_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 | ||
41 | libgnunet_plugin_rest_peerinfo_la_LDFLAGS = \ | ||
42 | $(GN_PLUGIN_LDFLAGS) | ||
43 | |||
44 | |||
22 | libgnunetpeerinfo_la_SOURCES = \ | 45 | libgnunetpeerinfo_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] |
8 | PORT = 0 | 8 | PORT = 0 |
9 | ALLOW_SHUTDOWN = YES | 9 | ALLOW_SHUTDOWN = YES |
10 | START_SYSTEM_SERVICES = NO | ||
11 | START_USER_SERVICES = NO | ||
12 | 10 | ||
13 | [exit] | 11 | [exit] |
14 | IMMEDIATE_START = YES | 12 | IMMEDIATE_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 @@ | |||
1 | gnunet-service-identity-provider | 1 | gnunet-reclaim |
2 | gnunet-identity-token | 2 | gnunet-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 | |||
16 | SQLITE_PLUGIN = libgnunet_plugin_reclaim_sqlite.la | 16 | SQLITE_PLUGIN = libgnunet_plugin_reclaim_sqlite.la |
17 | endif | 17 | endif |
18 | 18 | ||
19 | if HAVE_MHD | ||
20 | if HAVE_JSON | ||
21 | REST_PLUGIN = \ | ||
22 | libgnunet_plugin_rest_openid_connect.la \ | ||
23 | libgnunet_plugin_rest_reclaim.la | ||
24 | endif | ||
25 | endif | ||
26 | |||
19 | EXTRA_DIST = \ | 27 | EXTRA_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 |
34 | plugin_LTLIBRARIES = \ | 42 | plugin_LTLIBRARIES = \ |
35 | libgnunet_plugin_gnsrecord_reclaim.la \ | 43 | libgnunet_plugin_gnsrecord_reclaim.la \ |
36 | $(SQLITE_PLUGIN) | 44 | $(SQLITE_PLUGIN) \ |
45 | $(REST_PLUGIN) | ||
37 | 46 | ||
38 | bin_PROGRAMS = \ | 47 | bin_PROGRAMS = \ |
39 | gnunet-reclaim | 48 | gnunet-reclaim |
@@ -41,6 +50,41 @@ bin_PROGRAMS = \ | |||
41 | libexec_PROGRAMS = \ | 50 | libexec_PROGRAMS = \ |
42 | gnunet-service-reclaim | 51 | gnunet-service-reclaim |
43 | 52 | ||
53 | libgnunet_plugin_rest_reclaim_la_SOURCES = \ | ||
54 | plugin_rest_reclaim.c \ | ||
55 | json_reclaim.h \ | ||
56 | json_reclaim.c | ||
57 | libgnunet_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 | ||
66 | libgnunet_plugin_rest_reclaim_la_LDFLAGS = \ | ||
67 | $(GN_PLUGIN_LDFLAGS) | ||
68 | |||
69 | |||
70 | libgnunet_plugin_rest_openid_connect_la_SOURCES = \ | ||
71 | plugin_rest_openid_connect.c \ | ||
72 | oidc_helper.h \ | ||
73 | oidc_helper.c | ||
74 | libgnunet_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 | ||
84 | libgnunet_plugin_rest_openid_connect_la_LDFLAGS = \ | ||
85 | $(GN_PLUGIN_LDFLAGS) | ||
86 | |||
87 | |||
44 | libgnunet_plugin_gnsrecord_reclaim_la_SOURCES = \ | 88 | libgnunet_plugin_gnsrecord_reclaim_la_SOURCES = \ |
45 | plugin_gnsrecord_reclaim.c | 89 | plugin_gnsrecord_reclaim.c |
46 | libgnunet_plugin_gnsrecord_reclaim_la_LIBADD = \ | 90 | libgnunet_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 | ||
4 | LOCATION=$(which gnunet-config) | 4 | LOCATION=$(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 | ||
23 | which timeout &> /dev/null && DO_TIMEOUT="timeout 30" | 23 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
24 | 24 | ||
25 | TEST_ATTR="test" | 25 | TEST_ATTR="test" |
26 | gnunet-arm -s -c test_reclaim.conf | 26 | gnunet-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 | ||
2 | AM_CPPFLAGS = -I$(top_srcdir)/src/include | ||
3 | |||
4 | plugindir = $(libdir)/gnunet | ||
5 | |||
6 | pkgcfgdir= $(pkgdatadir)/config.d/ | ||
7 | |||
8 | libexecdir= $(pkglibdir)/libexec/ | ||
9 | |||
10 | |||
11 | if MINGW | ||
12 | WINFLAGS = -Wl,--no-undefined -Wl,--export-all-symbols | ||
13 | endif | ||
14 | |||
15 | if USE_COVERAGE | ||
16 | AM_CFLAGS = --coverage -O0 | ||
17 | XLIBS = -lgcov | ||
18 | endif | ||
19 | |||
20 | plugin_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 | ||
26 | if HAVE_ABE | ||
27 | plugin_LTLIBRARIES += libgnunet_plugin_rest_openid_connect.la \ | ||
28 | libgnunet_plugin_rest_reclaim.la | ||
29 | endif | ||
30 | |||
31 | libgnunet_plugin_rest_reclaim_la_SOURCES = \ | ||
32 | plugin_rest_reclaim.c \ | ||
33 | json_reclaim.h \ | ||
34 | json_reclaim.c | ||
35 | libgnunet_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 | ||
44 | libgnunet_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 | |||
59 | libgnunet_plugin_rest_copying_la_SOURCES = \ | ||
60 | plugin_rest_copying.c | ||
61 | libgnunet_plugin_rest_copying_la_LIBADD = \ | ||
62 | $(top_builddir)/src/rest/libgnunetrest.la \ | ||
63 | $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ | ||
64 | $(LTLIBINTL) -lmicrohttpd | ||
65 | libgnunet_plugin_rest_copying_la_LDFLAGS = \ | ||
66 | $(GN_PLUGIN_LDFLAGS) | ||
67 | |||
68 | libgnunet_plugin_rest_peerinfo_la_SOURCES = \ | ||
69 | plugin_rest_peerinfo.c | ||
70 | libgnunet_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 | ||
78 | libgnunet_plugin_rest_peerinfo_la_LDFLAGS = \ | ||
79 | $(GN_PLUGIN_LDFLAGS) | ||
80 | |||
81 | libgnunet_plugin_rest_identity_la_SOURCES = \ | ||
82 | plugin_rest_identity.c | ||
83 | libgnunet_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 | ||
88 | libgnunet_plugin_rest_identity_la_LDFLAGS = \ | ||
89 | $(GN_PLUGIN_LDFLAGS) | ||
90 | |||
91 | |||
92 | |||
93 | libgnunet_plugin_rest_namestore_la_SOURCES = \ | ||
94 | plugin_rest_namestore.c | ||
95 | libgnunet_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 | ||
103 | libgnunet_plugin_rest_namestore_la_LDFLAGS = \ | ||
104 | $(GN_PLUGIN_LDFLAGS) | ||
105 | |||
106 | libgnunet_plugin_rest_gns_la_SOURCES = \ | ||
107 | plugin_rest_gns.c | ||
108 | libgnunet_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 | ||
116 | libgnunet_plugin_rest_gns_la_LDFLAGS = \ | ||
117 | $(GN_PLUGIN_LDFLAGS) | ||
118 | |||
119 | libgnunet_plugin_rest_openid_connect_la_SOURCES = \ | ||
120 | plugin_rest_openid_connect.c \ | ||
121 | oidc_helper.h \ | ||
122 | oidc_helper.c | ||
123 | libgnunet_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 | ||
133 | libgnunet_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 | |||
20 | endif | 20 | endif |
21 | 21 | ||
22 | lib_LTLIBRARIES = \ | 22 | lib_LTLIBRARIES = \ |
23 | libgnunetrest.la | 23 | libgnunetrest.la |
24 | 24 | ||
25 | libexec_PROGRAMS = \ | 25 | libexec_PROGRAMS = \ |
26 | gnunet-rest-server | 26 | gnunet-rest-server |
27 | 27 | ||
28 | plugin_LTLIBRARIES = libgnunet_plugin_rest_copying.la | ||
29 | |||
28 | EXTRA_DIST = \ | 30 | EXTRA_DIST = \ |
29 | rest.conf | 31 | rest.conf |
30 | 32 | ||
33 | libgnunet_plugin_rest_copying_la_SOURCES = \ | ||
34 | plugin_rest_copying.c | ||
35 | libgnunet_plugin_rest_copying_la_LIBADD = \ | ||
36 | libgnunetrest.la \ | ||
37 | $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ | ||
38 | $(LTLIBINTL) -lmicrohttpd | ||
39 | libgnunet_plugin_rest_copying_la_LDFLAGS = \ | ||
40 | $(GN_PLUGIN_LDFLAGS) | ||
41 | |||
42 | |||
43 | |||
31 | gnunet_rest_server_SOURCES = \ | 44 | gnunet_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 @@ | |||
64 | static struct GNUNET_SCHEDULER_Task *httpd_task; | 64 | static struct GNUNET_SCHEDULER_Task *httpd_task; |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * The address to bind to | ||
68 | */ | ||
69 | static in_addr_t address; | ||
70 | |||
71 | /** | ||
72 | * The IPv6 address to bind to | ||
73 | */ | ||
74 | static 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 | */ |
69 | static unsigned long long port = GNUNET_REST_SERVICE_PORT; | 79 | static 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] |
2 | UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-rest.sock | 2 | UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-rest.sock |
3 | BINARY=gnunet-rest-server | 3 | BINARY=gnunet-rest-server |
4 | BIND_TO=127.0.0.1 | ||
5 | BIND_TO6=::1 | ||
4 | REST_PORT=7776 | 6 | REST_PORT=7776 |
5 | REST_ALLOW_HEADERS=Authorization,Accept,Content-Type | 7 | REST_ALLOW_HEADERS=Authorization,Accept,Content-Type |
6 | REST_ALLOW_ORIGIN=* | 8 | REST_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 |
21 | from __future__ import print_function | 21 | |
22 | from builtins import str | ||
23 | import sys | 22 | import sys |
24 | import os | 23 | import os |
25 | import subprocess | 24 | import 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 | ||
112 | static char* stat_type_strings[] = { | 114 | static 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@ |
2 | from __future__ import print_function | 2 | |
3 | import os | 3 | import os |
4 | import sys | 4 | import sys |
5 | import shutil | 5 | import 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 | ||
3 | for i in {1..0} | 3 | for i in $(seq 1 0) |
4 | do | 4 | do |
5 | echo RUN $i | 5 | echo RUN $i |
6 | ./test_transport_api_reliability_http | 6 | ./test_transport_api_reliability_http |
7 | done | 7 | done |
8 | 8 | ||
9 | for i in {1..100} | 9 | for i in $(seq 1 100) |
10 | do | 10 | do |
11 | echo RUN $i | 11 | echo RUN $i |
12 | ./test_transport_api_reliability_https | 12 | ./test_transport_api_reliability_https |
13 | done | 13 | done |
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 | ||
3 | C_ITERATIONS=5 | 3 | C_ITERATIONS=5 |
4 | C_MESSAGE_DELTA=10 | 4 | C_MESSAGE_DELTA=10 |
@@ -11,7 +11,7 @@ C_MESSAGE_END=2000 | |||
11 | # done | 11 | # done |
12 | 12 | ||
13 | 13 | ||
14 | for ((cur=$C_MESSAGE_START; cur<=$C_MESSAGE_END; cur = cur + $C_MESSAGE_DELTA)) | 14 | for $((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 | */ |
74 | static void | 74 | static void |
75 | print_option (void *cls, | 75 | print_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 | */ |
139 | static void | 140 | static 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: | 268 | cleanup: |
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 | §ion), | 294 | §ion), |
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 | */ | ||
30 | static char* device = "/dev/video0"; | 37 | static char* device = "/dev/video0"; |
38 | |||
39 | /** | ||
40 | * --verbose option | ||
41 | */ | ||
31 | static int verbose = false; | 42 | static int verbose = false; |
43 | |||
44 | /** | ||
45 | * --silent option | ||
46 | */ | ||
32 | static int silent = false; | 47 | static int silent = false; |
33 | 48 | ||
34 | // Handler exit code | 49 | /** |
50 | * Handler exit code | ||
51 | */ | ||
35 | static long unsigned int exit_code = 1; | 52 | static long unsigned int exit_code = 1; |
36 | 53 | ||
37 | // Helper process we started. | 54 | /** |
55 | * Helper process we started. | ||
56 | */ | ||
38 | static struct GNUNET_OS_Process *p; | 57 | static 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 | */ | ||
41 | static struct GNUNET_DISK_PipeHandle *sigpipe; | 63 | static 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 | */ |
71 | static void | 93 | static void |
72 | gnunet_uri (void *cls, const char *uri, const char *cfgfile, | 94 | gnunet_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 | */ | ||
155 | static const zbar_symbol_t * | ||
156 | get_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 | */ | ||
215 | static char * | ||
216 | run_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 | ||
191 | int | 291 | int |
192 | main (int argc, char *const *argv) | 292 | main (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 | ||
3 | FIFO=$(mktemp) | 3 | FIFO=$(mktemp) |
4 | 4 | ||