diff options
author | Nils Gillmann <ng0@n0.is> | 2018-07-03 06:49:02 +0000 |
---|---|---|
committer | Nils Gillmann <ng0@n0.is> | 2018-07-03 06:49:02 +0000 |
commit | 061526a35bf19cd71e375ae7eb9dc3b5fd6c711f (patch) | |
tree | 29b3783f28375235c19b52a1148031a7b39c7f11 | |
parent | c579fa83c2652aac6a093ceeb36854bee3800cbe (diff) | |
parent | bb3371542e3c1fff2c4abb4d2ba3decf925b4352 (diff) | |
download | gnunet-061526a35bf19cd71e375ae7eb9dc3b5fd6c711f.tar.gz gnunet-061526a35bf19cd71e375ae7eb9dc3b5fd6c711f.zip |
Merge branch 'master' of gnunet.org:gnunet
-rw-r--r-- | contrib/.gitignore | 1 | ||||
-rw-r--r-- | contrib/Makefile.am | 11 | ||||
-rw-r--r-- | doc/man/Makefile.am | 1 | ||||
-rw-r--r-- | doc/man/gnunet-gns.1 | 2 | ||||
-rw-r--r-- | doc/man/gnunet-timeout.1 | 20 | ||||
-rw-r--r-- | po/POTFILES.in | 1 | ||||
-rw-r--r-- | src/gns/gns_api.c | 7 | ||||
-rw-r--r-- | src/gns/gnunet-gns.c | 10 | ||||
-rw-r--r-- | src/gns/nss/nss_gns.c | 269 | ||||
-rw-r--r-- | src/gns/nss/nss_gns_query.c | 25 | ||||
-rw-r--r-- | src/gns/nss/nss_gns_query.h | 30 | ||||
-rw-r--r-- | src/identity/identity_api_lookup.c | 8 | ||||
-rw-r--r-- | src/rps/gnunet-service-rps.c | 7 | ||||
-rw-r--r-- | src/set/gnunet-service-set_intersection.c | 19 | ||||
-rw-r--r-- | src/set/gnunet-service-set_union.c | 19 | ||||
-rw-r--r-- | src/util/.gitignore | 5 | ||||
-rw-r--r-- | src/util/Makefile.am | 16 | ||||
-rw-r--r-- | src/util/client.c | 13 | ||||
-rw-r--r-- | src/util/dnsparser.c | 9 | ||||
-rw-r--r-- | src/util/gnunet-timeout-w32.c (renamed from contrib/timeout_watchdog_w32.c) | 6 | ||||
-rw-r--r-- | src/util/gnunet-timeout.c (renamed from contrib/timeout_watchdog.c) | 82 |
21 files changed, 334 insertions, 227 deletions
diff --git a/contrib/.gitignore b/contrib/.gitignore index 304706d7e..d6ef469ba 100644 --- a/contrib/.gitignore +++ b/contrib/.gitignore | |||
@@ -2,7 +2,6 @@ gnunet_janitor.py | |||
2 | gnunet_pyexpect.py | 2 | gnunet_pyexpect.py |
3 | pydiffer.py | 3 | pydiffer.py |
4 | terminate.py | 4 | terminate.py |
5 | timeout_watchdog | ||
6 | gnunet_pyexpect.py | 5 | gnunet_pyexpect.py |
7 | gnunet_pyexpect.pyc | 6 | gnunet_pyexpect.pyc |
8 | pydiffer.pyc | 7 | pydiffer.pyc |
diff --git a/contrib/Makefile.am b/contrib/Makefile.am index 158e43998..eec3300b9 100644 --- a/contrib/Makefile.am +++ b/contrib/Makefile.am | |||
@@ -5,17 +5,6 @@ tap32dir = $(pkgdatadir)/openvpn-tap32/tapw32/ | |||
5 | 5 | ||
6 | tap64dir = $(pkgdatadir)/openvpn-tap32/tapw64/ | 6 | tap64dir = $(pkgdatadir)/openvpn-tap32/tapw64/ |
7 | 7 | ||
8 | noinst_PROGRAMS = \ | ||
9 | timeout_watchdog | ||
10 | |||
11 | if !MINGW | ||
12 | timeout_watchdog_SOURCES = \ | ||
13 | timeout_watchdog.c | ||
14 | else | ||
15 | timeout_watchdog_SOURCES = \ | ||
16 | timeout_watchdog_w32.c | ||
17 | endif | ||
18 | |||
19 | noinst_SCRIPTS = \ | 8 | noinst_SCRIPTS = \ |
20 | scripts/terminate.py \ | 9 | scripts/terminate.py \ |
21 | scripts/pydiffer.py \ | 10 | scripts/pydiffer.py \ |
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index a6a116dca..37f881d60 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am | |||
@@ -37,6 +37,7 @@ man_MANS = \ | |||
37 | gnunet-statistics.1 \ | 37 | gnunet-statistics.1 \ |
38 | gnunet-testbed-profiler.1 \ | 38 | gnunet-testbed-profiler.1 \ |
39 | gnunet-testing-run-service.1 \ | 39 | gnunet-testing-run-service.1 \ |
40 | gnunet-timeout.1 \ | ||
40 | gnunet-transport.1 \ | 41 | gnunet-transport.1 \ |
41 | gnunet-transport-certificate-creation.1 \ | 42 | gnunet-transport-certificate-creation.1 \ |
42 | gnunet-unindex.1 \ | 43 | gnunet-unindex.1 \ |
diff --git a/doc/man/gnunet-gns.1 b/doc/man/gnunet-gns.1 index 9466dae03..9e4482653 100644 --- a/doc/man/gnunet-gns.1 +++ b/doc/man/gnunet-gns.1 | |||
@@ -46,7 +46,7 @@ Print GNUnet version number. | |||
46 | .SH RETURN VALUE | 46 | .SH RETURN VALUE |
47 | 47 | ||
48 | gnunet\-gns will return 0 on success, 1 on internal failures, 2 on | 48 | gnunet\-gns will return 0 on success, 1 on internal failures, 2 on |
49 | launch failures, 3 if the given name is not configured to use GNS. | 49 | launch failures, 4 if the given name is not configured to use GNS. |
50 | 50 | ||
51 | 51 | ||
52 | .SH BUGS | 52 | .SH BUGS |
diff --git a/doc/man/gnunet-timeout.1 b/doc/man/gnunet-timeout.1 new file mode 100644 index 000000000..e413254f4 --- /dev/null +++ b/doc/man/gnunet-timeout.1 | |||
@@ -0,0 +1,20 @@ | |||
1 | .TH GNUNET\-TIMOUET 1 "Jun 5, 2018" "GNUnet" | ||
2 | |||
3 | .SH NAME | ||
4 | gnunet\-timeout \- run process with timeout | ||
5 | |||
6 | .SH SYNOPSIS | ||
7 | .B gnunet\-timeout | ||
8 | .RI TIMEOUT PROGRAM ARGS | ||
9 | .br | ||
10 | |||
11 | .SH DESCRIPTION | ||
12 | \fBgnunet\-timeout\fP can be used to run another process with a | ||
13 | timeout. Provided as the standard "timout" utility may not be | ||
14 | available on all platforms. | ||
15 | |||
16 | .SH BUGS | ||
17 | Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org> | ||
18 | |||
19 | .SH SEE | ||
20 | timeout(1) | ||
diff --git a/po/POTFILES.in b/po/POTFILES.in index 38fa52508..8a95064a6 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in | |||
@@ -325,6 +325,7 @@ src/rps/gnunet-service-rps_sampler.c | |||
325 | src/rps/gnunet-service-rps_sampler_elem.c | 325 | src/rps/gnunet-service-rps_sampler_elem.c |
326 | src/rps/gnunet-service-rps_view.c | 326 | src/rps/gnunet-service-rps_view.c |
327 | src/rps/rps_api.c | 327 | src/rps/rps_api.c |
328 | src/rps/rps_test_lib.c | ||
328 | src/rps/rps-test_util.c | 329 | src/rps/rps-test_util.c |
329 | src/scalarproduct/gnunet-scalarproduct.c | 330 | src/scalarproduct/gnunet-scalarproduct.c |
330 | src/scalarproduct/gnunet-service-scalarproduct_alice.c | 331 | src/scalarproduct/gnunet-service-scalarproduct_alice.c |
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index 0ec9209da..3b658da92 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.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 | */ |
@@ -232,7 +232,6 @@ reconnect (struct GNUNET_GNS_Handle *handle) | |||
232 | handle), | 232 | handle), |
233 | GNUNET_MQ_handler_end () | 233 | GNUNET_MQ_handler_end () |
234 | }; | 234 | }; |
235 | struct GNUNET_GNS_LookupRequest *lh; | ||
236 | 235 | ||
237 | GNUNET_assert (NULL == handle->mq); | 236 | GNUNET_assert (NULL == handle->mq); |
238 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 237 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -244,7 +243,9 @@ reconnect (struct GNUNET_GNS_Handle *handle) | |||
244 | handle); | 243 | handle); |
245 | if (NULL == handle->mq) | 244 | if (NULL == handle->mq) |
246 | return; | 245 | return; |
247 | for (lh = handle->lookup_head; NULL != lh; lh = lh->next) | 246 | for (struct GNUNET_GNS_LookupRequest *lh = handle->lookup_head; |
247 | NULL != lh; | ||
248 | lh = lh->next) | ||
248 | GNUNET_MQ_send_copy (handle->mq, | 249 | GNUNET_MQ_send_copy (handle->mq, |
249 | lh->env); | 250 | lh->env); |
250 | } | 251 | } |
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index 149c8a7bb..463348ed3 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.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 | */ |
@@ -65,8 +65,9 @@ static struct GNUNET_GNS_LookupWithTldRequest *lr; | |||
65 | /** | 65 | /** |
66 | * Global return value. | 66 | * Global return value. |
67 | * 0 on success (default), | 67 | * 0 on success (default), |
68 | * 1 on internal failures, 2 on launch failure, | 68 | * 1 on internal failures |
69 | * 3 if the name is not a GNS-supported TLD, | 69 | * 2 on launch failure, |
70 | * 4 if the name is not a GNS-supported TLD, | ||
70 | */ | 71 | */ |
71 | static int global_ret; | 72 | static int global_ret; |
72 | 73 | ||
@@ -114,7 +115,7 @@ process_lookup_result (void *cls, | |||
114 | lr = NULL; | 115 | lr = NULL; |
115 | if (GNUNET_NO == was_gns) | 116 | if (GNUNET_NO == was_gns) |
116 | { | 117 | { |
117 | global_ret = 3; | 118 | global_ret = 4; /* not for GNS */ |
118 | GNUNET_SCHEDULER_shutdown (); | 119 | GNUNET_SCHEDULER_shutdown (); |
119 | return; | 120 | return; |
120 | } | 121 | } |
@@ -183,7 +184,6 @@ run (void *cls, | |||
183 | global_ret = 2; | 184 | global_ret = 2; |
184 | return; | 185 | return; |
185 | } | 186 | } |
186 | |||
187 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, | 187 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, |
188 | NULL); | 188 | NULL); |
189 | 189 | ||
diff --git a/src/gns/nss/nss_gns.c b/src/gns/nss/nss_gns.c index 9c9233d35..58aab47fd 100644 --- a/src/gns/nss/nss_gns.c +++ b/src/gns/nss/nss_gns.c | |||
@@ -54,121 +54,126 @@ | |||
54 | * @return a nss_status code | 54 | * @return a nss_status code |
55 | */ | 55 | */ |
56 | enum nss_status | 56 | enum nss_status |
57 | _nss_gns_gethostbyname2_r( | 57 | _nss_gns_gethostbyname2_r(const char *name, |
58 | const char *name, | 58 | int af, |
59 | int af, | 59 | struct hostent *result, |
60 | struct hostent * result, | 60 | char *buffer, |
61 | char *buffer, | 61 | size_t buflen, |
62 | size_t buflen, | 62 | int *errnop, |
63 | int *errnop, | 63 | int *h_errnop) |
64 | int *h_errnop) { | 64 | { |
65 | 65 | struct userdata u; | |
66 | struct userdata u; | 66 | enum nss_status status = NSS_STATUS_UNAVAIL; |
67 | enum nss_status status = NSS_STATUS_UNAVAIL; | 67 | int i; |
68 | int i; | 68 | size_t address_length; |
69 | size_t address_length, l, idx, astart; | 69 | size_t l; |
70 | 70 | size_t idx; | |
71 | if (af == AF_UNSPEC) | 71 | size_t astart; |
72 | |||
73 | if (af == AF_UNSPEC) | ||
72 | #ifdef NSS_IPV6_ONLY | 74 | #ifdef NSS_IPV6_ONLY |
73 | af = AF_INET6; | 75 | af = AF_INET6; |
74 | #else | 76 | #else |
75 | af = AF_INET; | 77 | af = AF_INET; |
76 | #endif | 78 | #endif |
77 | 79 | ||
78 | #ifdef NSS_IPV4_ONLY | 80 | #ifdef NSS_IPV4_ONLY |
79 | if (af != AF_INET) | 81 | if (af != AF_INET) |
80 | #elif NSS_IPV6_ONLY | 82 | #elif NSS_IPV6_ONLY |
81 | if (af != AF_INET6) | 83 | if (af != AF_INET6) |
82 | #else | 84 | #else |
83 | if (af != AF_INET && af != AF_INET6) | 85 | if ( (af != AF_INET) && |
86 | (af != AF_INET6) ) | ||
84 | #endif | 87 | #endif |
85 | { | 88 | { |
86 | *errnop = EINVAL; | 89 | *errnop = EINVAL; |
87 | *h_errnop = NO_RECOVERY; | 90 | *h_errnop = NO_RECOVERY; |
88 | 91 | ||
89 | goto finish; | 92 | goto finish; |
90 | } | 93 | } |
91 | |||
92 | address_length = af == AF_INET ? sizeof(ipv4_address_t) : sizeof(ipv6_address_t); | ||
93 | if (buflen < | ||
94 | sizeof(char*)+ /* alias names */ | ||
95 | strlen(name)+1) { /* official name */ | ||
96 | |||
97 | *errnop = ERANGE; | ||
98 | *h_errnop = NO_RECOVERY; | ||
99 | status = NSS_STATUS_TRYAGAIN; | ||
100 | |||
101 | goto finish; | ||
102 | } | ||
103 | |||
104 | u.count = 0; | ||
105 | u.data_len = 0; | ||
106 | |||
107 | i = gns_resolve_name(af, name, &u); | ||
108 | if (-3 == i) | ||
109 | { | ||
110 | status = NSS_STATUS_NOTFOUND; | ||
111 | goto finish; | ||
112 | } | ||
113 | if (-2 == i) | ||
114 | { | ||
115 | status = NSS_STATUS_UNAVAIL; | ||
116 | goto finish; | ||
117 | } | ||
118 | if ( (-1 == i) || | ||
119 | (u.count == 0) ) | ||
120 | { | ||
121 | *errnop = ETIMEDOUT; | ||
122 | *h_errnop = HOST_NOT_FOUND; | ||
123 | status = NSS_STATUS_NOTFOUND; | ||
124 | goto finish; | ||
125 | } | ||
126 | |||
127 | |||
128 | /* Alias names */ | ||
129 | *((char**) buffer) = NULL; | ||
130 | result->h_aliases = (char**) buffer; | ||
131 | idx = sizeof(char*); | ||
132 | |||
133 | /* Official name */ | ||
134 | strcpy(buffer+idx, name); | ||
135 | result->h_name = buffer+idx; | ||
136 | idx += strlen(name)+1; | ||
137 | |||
138 | ALIGN(idx); | ||
139 | |||
140 | result->h_addrtype = af; | ||
141 | result->h_length = address_length; | ||
142 | |||
143 | /* Check if there's enough space for the addresses */ | ||
144 | if (buflen < idx+u.data_len+sizeof(char*)*(u.count+1)) { | ||
145 | *errnop = ERANGE; | ||
146 | *h_errnop = NO_RECOVERY; | ||
147 | status = NSS_STATUS_TRYAGAIN; | ||
148 | goto finish; | ||
149 | } | ||
150 | 94 | ||
95 | address_length = (af == AF_INET) ? sizeof(ipv4_address_t) : sizeof(ipv6_address_t); | ||
96 | if (buflen < | ||
97 | sizeof(char*)+ /* alias names */ | ||
98 | strlen(name)+1) | ||
99 | { /* official name */ | ||
100 | *errnop = ERANGE; | ||
101 | *h_errnop = NO_RECOVERY; | ||
102 | status = NSS_STATUS_TRYAGAIN; | ||
103 | |||
104 | goto finish; | ||
105 | } | ||
106 | u.count = 0; | ||
107 | u.data_len = 0; | ||
108 | i = gns_resolve_name (af, | ||
109 | name, | ||
110 | &u); | ||
111 | if (-3 == i) | ||
112 | { | ||
113 | status = NSS_STATUS_NOTFOUND; | ||
114 | goto finish; | ||
115 | } | ||
116 | if (-2 == i) | ||
117 | { | ||
118 | status = NSS_STATUS_UNAVAIL; | ||
119 | goto finish; | ||
120 | } | ||
121 | if ( (-1 == i) || | ||
122 | (u.count == 0) ) | ||
123 | { | ||
124 | *errnop = ETIMEDOUT; | ||
125 | *h_errnop = HOST_NOT_FOUND; | ||
126 | status = NSS_STATUS_NOTFOUND; | ||
127 | goto finish; | ||
128 | } | ||
129 | /* Alias names */ | ||
130 | *((char**) buffer) = NULL; | ||
131 | result->h_aliases = (char**) buffer; | ||
132 | idx = sizeof(char*); | ||
133 | |||
134 | /* Official name */ | ||
135 | strcpy (buffer+idx, | ||
136 | name); | ||
137 | result->h_name = buffer+idx; | ||
138 | idx += strlen (name)+1; | ||
139 | |||
140 | ALIGN(idx); | ||
141 | |||
142 | result->h_addrtype = af; | ||
143 | result->h_length = address_length; | ||
144 | |||
145 | /* Check if there's enough space for the addresses */ | ||
146 | if (buflen < idx+u.data_len+sizeof(char*)*(u.count+1)) | ||
147 | { | ||
148 | *errnop = ERANGE; | ||
149 | *h_errnop = NO_RECOVERY; | ||
150 | status = NSS_STATUS_TRYAGAIN; | ||
151 | goto finish; | ||
152 | } | ||
151 | /* Addresses */ | 153 | /* Addresses */ |
152 | astart = idx; | 154 | astart = idx; |
153 | l = u.count*address_length; | 155 | l = u.count*address_length; |
154 | if (0 != l) | 156 | if (0 != l) |
155 | memcpy(buffer+astart, &u.data, l); | 157 | memcpy (buffer+astart, |
156 | /* address_length is a multiple of 32bits, so idx is still aligned | 158 | &u.data, |
157 | * correctly */ | 159 | l); |
158 | idx += l; | 160 | /* address_length is a multiple of 32bits, so idx is still aligned |
159 | 161 | * correctly */ | |
160 | /* Address array address_length is always a multiple of 32bits */ | 162 | idx += l; |
161 | for (i = 0; i < u.count; i++) | 163 | |
162 | ((char**) (buffer+idx))[i] = buffer+astart+address_length*i; | 164 | /* Address array address_length is always a multiple of 32bits */ |
163 | ((char**) (buffer+idx))[i] = NULL; | 165 | for (i = 0; i < u.count; i++) |
164 | result->h_addr_list = (char**) (buffer+idx); | 166 | ((char**) (buffer+idx))[i] = buffer+astart+address_length*i; |
165 | 167 | ((char**) (buffer+idx))[i] = NULL; | |
166 | status = NSS_STATUS_SUCCESS; | 168 | result->h_addr_list = (char**) (buffer+idx); |
169 | |||
170 | status = NSS_STATUS_SUCCESS; | ||
167 | 171 | ||
168 | finish: | 172 | finish: |
169 | return status; | 173 | return status; |
170 | } | 174 | } |
171 | 175 | ||
176 | |||
172 | /** | 177 | /** |
173 | * The gethostbyname hook executed by nsswitch | 178 | * The gethostbyname hook executed by nsswitch |
174 | * | 179 | * |
@@ -176,29 +181,28 @@ finish: | |||
176 | * @param result the result hostent | 181 | * @param result the result hostent |
177 | * @param buffer the result buffer | 182 | * @param buffer the result buffer |
178 | * @param buflen length of the buffer | 183 | * @param buflen length of the buffer |
179 | * @param errnop idk | 184 | * @param errnop[out] the low-level error code to return to the application |
180 | * @param h_errnop idk | 185 | * @param h_errnop idk |
181 | * @return a nss_status code | 186 | * @return a nss_status code |
182 | */ | 187 | */ |
183 | enum nss_status | 188 | enum nss_status |
184 | _nss_gns_gethostbyname_r ( | 189 | _nss_gns_gethostbyname_r (const char *name, |
185 | const char *name, | 190 | struct hostent *result, |
186 | struct hostent *result, | 191 | char *buffer, |
187 | char *buffer, | 192 | size_t buflen, |
188 | size_t buflen, | 193 | int *errnop, |
189 | int *errnop, | 194 | int *h_errnop) |
190 | int *h_errnop) { | 195 | { |
191 | 196 | return _nss_gns_gethostbyname2_r (name, | |
192 | return _nss_gns_gethostbyname2_r( | 197 | AF_UNSPEC, |
193 | name, | 198 | result, |
194 | AF_UNSPEC, | 199 | buffer, |
195 | result, | 200 | buflen, |
196 | buffer, | 201 | errnop, |
197 | buflen, | 202 | h_errnop); |
198 | errnop, | ||
199 | h_errnop); | ||
200 | } | 203 | } |
201 | 204 | ||
205 | |||
202 | /** | 206 | /** |
203 | * The gethostbyaddr hook executed by nsswitch | 207 | * The gethostbyaddr hook executed by nsswitch |
204 | * We can't do this so we always return NSS_STATUS_UNAVAIL | 208 | * We can't do this so we always return NSS_STATUS_UNAVAIL |
@@ -209,23 +213,22 @@ _nss_gns_gethostbyname_r ( | |||
209 | * @param result the result hostent | 213 | * @param result the result hostent |
210 | * @param buffer the result buffer | 214 | * @param buffer the result buffer |
211 | * @param buflen length of the buffer | 215 | * @param buflen length of the buffer |
212 | * @param errnop idk | 216 | * @param errnop[out] the low-level error code to return to the application |
213 | * @param h_errnop idk | 217 | * @param h_errnop idk |
214 | * @return NSS_STATUS_UNAVAIL | 218 | * @return NSS_STATUS_UNAVAIL |
215 | */ | 219 | */ |
216 | enum nss_status | 220 | enum nss_status |
217 | _nss_gns_gethostbyaddr_r( | 221 | _nss_gns_gethostbyaddr_r (const void* addr, |
218 | const void* addr, | 222 | int len, |
219 | int len, | 223 | int af, |
220 | int af, | 224 | struct hostent *result, |
221 | struct hostent *result, | 225 | char *buffer, |
222 | char *buffer, | 226 | size_t buflen, |
223 | size_t buflen, | 227 | int *errnop, |
224 | int *errnop, | 228 | int *h_errnop) |
225 | int *h_errnop) { | 229 | { |
226 | 230 | *errnop = EINVAL; | |
227 | *errnop = EINVAL; | 231 | *h_errnop = NO_RECOVERY; |
228 | *h_errnop = NO_RECOVERY; | 232 | //NOTE we allow to leak this into DNS so no NOTFOUND |
229 | //NOTE we allow to leak this into DNS so no NOTFOUND | 233 | return NSS_STATUS_UNAVAIL; |
230 | return NSS_STATUS_UNAVAIL; | ||
231 | } | 234 | } |
diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c index 094e25ed5..867ead624 100644 --- a/src/gns/nss/nss_gns_query.c +++ b/src/gns/nss/nss_gns_query.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 | */ |
@@ -48,14 +48,16 @@ gns_resolve_name (int af, | |||
48 | { | 48 | { |
49 | if (-1 == asprintf (&cmd, | 49 | if (-1 == asprintf (&cmd, |
50 | "%s -t AAAA -u %s\n", | 50 | "%s -t AAAA -u %s\n", |
51 | "gnunet-gns -r", name)) | 51 | "gnunet-gns -r", |
52 | name)) | ||
52 | return -1; | 53 | return -1; |
53 | } | 54 | } |
54 | else | 55 | else |
55 | { | 56 | { |
56 | if (-1 == asprintf (&cmd, | 57 | if (-1 == asprintf (&cmd, |
57 | "%s %s\n", | 58 | "%s %s\n", |
58 | "gnunet-gns -r -u", name)) | 59 | "gnunet-gns -r -u", |
60 | name)) | ||
59 | return -1; | 61 | return -1; |
60 | } | 62 | } |
61 | if (NULL == (p = popen (cmd, "r"))) | 63 | if (NULL == (p = popen (cmd, "r"))) |
@@ -63,7 +65,9 @@ gns_resolve_name (int af, | |||
63 | free (cmd); | 65 | free (cmd); |
64 | return -1; | 66 | return -1; |
65 | } | 67 | } |
66 | while (NULL != fgets (line, sizeof(line), p)) | 68 | while (NULL != fgets (line, |
69 | sizeof(line), | ||
70 | p)) | ||
67 | { | 71 | { |
68 | if (u->count >= MAX_ENTRIES) | 72 | if (u->count >= MAX_ENTRIES) |
69 | break; | 73 | break; |
@@ -72,7 +76,9 @@ gns_resolve_name (int af, | |||
72 | line[strlen(line)-1] = '\0'; | 76 | line[strlen(line)-1] = '\0'; |
73 | if (AF_INET == af) | 77 | if (AF_INET == af) |
74 | { | 78 | { |
75 | if (inet_pton(af, line, &(u->data.ipv4[u->count]))) | 79 | if (inet_pton(af, |
80 | line, | ||
81 | &u->data.ipv4[u->count])) | ||
76 | { | 82 | { |
77 | u->count++; | 83 | u->count++; |
78 | u->data_len += sizeof(ipv4_address_t); | 84 | u->data_len += sizeof(ipv4_address_t); |
@@ -86,7 +92,9 @@ gns_resolve_name (int af, | |||
86 | } | 92 | } |
87 | else if (AF_INET6 == af) | 93 | else if (AF_INET6 == af) |
88 | { | 94 | { |
89 | if (inet_pton(af, line, &(u->data.ipv6[u->count]))) | 95 | if (inet_pton(af, |
96 | line, | ||
97 | &u->data.ipv6[u->count])) | ||
90 | { | 98 | { |
91 | u->count++; | 99 | u->count++; |
92 | u->data_len += sizeof(ipv6_address_t); | 100 | u->data_len += sizeof(ipv6_address_t); |
@@ -105,7 +113,10 @@ gns_resolve_name (int af, | |||
105 | if (4 == ret) | 113 | if (4 == ret) |
106 | return -2; /* not for GNS */ | 114 | return -2; /* not for GNS */ |
107 | if (3 == ret) | 115 | if (3 == ret) |
108 | return -3; /* timeout */ | 116 | return -3; /* timeout -> not found */ |
117 | if ( (2 == ret) || (1 == ret) ) | ||
118 | return -2; /* launch failure -> service unavailable */ | ||
109 | return 0; | 119 | return 0; |
110 | } | 120 | } |
121 | |||
111 | /* end of nss_gns_query.c */ | 122 | /* end of nss_gns_query.c */ |
diff --git a/src/gns/nss/nss_gns_query.h b/src/gns/nss/nss_gns_query.h index bb04f9004..48cab4b22 100644 --- a/src/gns/nss/nss_gns_query.h +++ b/src/gns/nss/nss_gns_query.h | |||
@@ -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 | */ |
@@ -26,25 +26,30 @@ | |||
26 | /* Maximum number of entries to return */ | 26 | /* Maximum number of entries to return */ |
27 | #define MAX_ENTRIES 16 | 27 | #define MAX_ENTRIES 16 |
28 | 28 | ||
29 | typedef struct { | 29 | typedef struct |
30 | uint32_t address; | 30 | { |
31 | uint32_t address; | ||
31 | } ipv4_address_t; | 32 | } ipv4_address_t; |
32 | 33 | ||
33 | typedef struct { | 34 | |
34 | uint8_t address[16]; | 35 | typedef struct |
36 | { | ||
37 | uint8_t address[16]; | ||
35 | } ipv6_address_t; | 38 | } ipv6_address_t; |
36 | 39 | ||
37 | 40 | ||
38 | struct userdata { | 41 | struct userdata |
42 | { | ||
39 | int count; | 43 | int count; |
40 | int data_len; /* only valid when doing reverse lookup */ | 44 | int data_len; /* only valid when doing reverse lookup */ |
41 | union { | 45 | union { |
42 | ipv4_address_t ipv4[MAX_ENTRIES]; | 46 | ipv4_address_t ipv4[MAX_ENTRIES]; |
43 | ipv6_address_t ipv6[MAX_ENTRIES]; | 47 | ipv6_address_t ipv6[MAX_ENTRIES]; |
44 | char *name[MAX_ENTRIES]; | 48 | char *name[MAX_ENTRIES]; |
45 | } data; | 49 | } data; |
46 | }; | 50 | }; |
47 | 51 | ||
52 | |||
48 | /** | 53 | /** |
49 | * Wrapper function that uses gnunet-gns cli tool to resolve | 54 | * Wrapper function that uses gnunet-gns cli tool to resolve |
50 | * an IPv4/6 address. | 55 | * an IPv4/6 address. |
@@ -54,8 +59,9 @@ struct userdata { | |||
54 | * @param u the userdata (result struct) | 59 | * @param u the userdata (result struct) |
55 | * @return -1 on error else 0 | 60 | * @return -1 on error else 0 |
56 | */ | 61 | */ |
57 | int gns_resolve_name(int af, | 62 | int |
58 | const char *name, | 63 | gns_resolve_name(int af, |
59 | struct userdata *userdata); | 64 | const char *name, |
65 | struct userdata *userdata); | ||
60 | 66 | ||
61 | #endif | 67 | #endif |
diff --git a/src/identity/identity_api_lookup.c b/src/identity/identity_api_lookup.c index 593a5dbb0..25aec8ede 100644 --- a/src/identity/identity_api_lookup.c +++ b/src/identity/identity_api_lookup.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 | */ |
@@ -131,6 +131,12 @@ GNUNET_IDENTITY_ego_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
131 | el->identity = GNUNET_IDENTITY_connect (cfg, | 131 | el->identity = GNUNET_IDENTITY_connect (cfg, |
132 | &identity_cb, | 132 | &identity_cb, |
133 | el); | 133 | el); |
134 | if (NULL == el->identity) | ||
135 | { | ||
136 | GNUNET_free (el->name); | ||
137 | GNUNET_free (el); | ||
138 | return NULL; | ||
139 | } | ||
134 | return el; | 140 | return el; |
135 | } | 141 | } |
136 | 142 | ||
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index 84fb33be2..5a75ac55a 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -1666,10 +1666,11 @@ Peers_cleanup_destroyed_channel (void *cls, | |||
1666 | { | 1666 | { |
1667 | struct GNUNET_PeerIdentity *peer = cls; | 1667 | struct GNUNET_PeerIdentity *peer = cls; |
1668 | struct PeerContext *peer_ctx; | 1668 | struct PeerContext *peer_ctx; |
1669 | uint32_t *channel_flag; | ||
1669 | 1670 | ||
1670 | if (GNUNET_NO == Peers_check_peer_known (peer)) | 1671 | if (GNUNET_NO == Peers_check_peer_known (peer)) |
1671 | {/* We don't want to implicitly create a context that we're about to kill */ | 1672 | {/* We don't want to implicitly create a context that we're about to kill */ |
1672 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1673 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1673 | "channel (%s) without associated context was destroyed\n", | 1674 | "channel (%s) without associated context was destroyed\n", |
1674 | GNUNET_i2s (peer)); | 1675 | GNUNET_i2s (peer)); |
1675 | return; | 1676 | return; |
@@ -1697,12 +1698,16 @@ Peers_cleanup_destroyed_channel (void *cls, | |||
1697 | if (NULL != peer_ctx->send_channel) | 1698 | if (NULL != peer_ctx->send_channel) |
1698 | { | 1699 | { |
1699 | GNUNET_CADET_channel_destroy (peer_ctx->send_channel); | 1700 | GNUNET_CADET_channel_destroy (peer_ctx->send_channel); |
1701 | channel_flag = Peers_get_channel_flag (&peer_ctx->peer_id, Peers_CHANNEL_ROLE_SENDING); | ||
1702 | Peers_set_channel_flag (channel_flag, Peers_CHANNEL_DESTROING); | ||
1700 | peer_ctx->send_channel = NULL; | 1703 | peer_ctx->send_channel = NULL; |
1701 | peer_ctx->mq = NULL; | 1704 | peer_ctx->mq = NULL; |
1702 | } | 1705 | } |
1703 | if (NULL != peer_ctx->recv_channel) | 1706 | if (NULL != peer_ctx->recv_channel) |
1704 | { | 1707 | { |
1705 | GNUNET_CADET_channel_destroy (peer_ctx->recv_channel); | 1708 | GNUNET_CADET_channel_destroy (peer_ctx->recv_channel); |
1709 | channel_flag = Peers_get_channel_flag (&peer_ctx->peer_id, Peers_CHANNEL_ROLE_RECEIVING); | ||
1710 | Peers_set_channel_flag (channel_flag, Peers_CHANNEL_DESTROING); | ||
1706 | peer_ctx->recv_channel = NULL; | 1711 | peer_ctx->recv_channel = NULL; |
1707 | } | 1712 | } |
1708 | /* Set the #Peers_ONLINE flag accordingly */ | 1713 | /* Set the #Peers_ONLINE flag accordingly */ |
diff --git a/src/set/gnunet-service-set_intersection.c b/src/set/gnunet-service-set_intersection.c index 254763b45..1083384f5 100644 --- a/src/set/gnunet-service-set_intersection.c +++ b/src/set/gnunet-service-set_intersection.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 | */ |
@@ -23,6 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | #include "platform.h" | 24 | #include "platform.h" |
25 | #include "gnunet_util_lib.h" | 25 | #include "gnunet_util_lib.h" |
26 | #include "gnunet_statistics_service.h" | ||
26 | #include "gnunet-service-set.h" | 27 | #include "gnunet-service-set.h" |
27 | #include "gnunet_block_lib.h" | 28 | #include "gnunet_block_lib.h" |
28 | #include "gnunet-service-set_protocol.h" | 29 | #include "gnunet-service-set_protocol.h" |
@@ -215,6 +216,10 @@ send_client_removed_element (struct Operation *op, | |||
215 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 216 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
216 | "Sending removed element (size %u) to client\n", | 217 | "Sending removed element (size %u) to client\n", |
217 | element->size); | 218 | element->size); |
219 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
220 | "# Element removed messages sent", | ||
221 | 1, | ||
222 | GNUNET_NO); | ||
218 | GNUNET_assert (0 != op->client_request_id); | 223 | GNUNET_assert (0 != op->client_request_id); |
219 | ev = GNUNET_MQ_msg_extra (rm, | 224 | ev = GNUNET_MQ_msg_extra (rm, |
220 | element->size, | 225 | element->size, |
@@ -406,6 +411,10 @@ fail_intersection_operation (struct Operation *op) | |||
406 | 411 | ||
407 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 412 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
408 | "Intersection operation failed\n"); | 413 | "Intersection operation failed\n"); |
414 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
415 | "# Intersection operations failed", | ||
416 | 1, | ||
417 | GNUNET_NO); | ||
409 | if (NULL != op->state->my_elements) | 418 | if (NULL != op->state->my_elements) |
410 | { | 419 | { |
411 | GNUNET_CONTAINER_multihashmap_destroy (op->state->my_elements); | 420 | GNUNET_CONTAINER_multihashmap_destroy (op->state->my_elements); |
@@ -466,6 +475,10 @@ send_bloomfilter (struct Operation *op) | |||
466 | op); | 475 | op); |
467 | 476 | ||
468 | /* send our Bloom filter */ | 477 | /* send our Bloom filter */ |
478 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
479 | "# Intersection Bloom filters sent", | ||
480 | 1, | ||
481 | GNUNET_NO); | ||
469 | chunk_size = 60 * 1024 - sizeof (struct BFMessage); | 482 | chunk_size = 60 * 1024 - sizeof (struct BFMessage); |
470 | if (bf_size <= chunk_size) | 483 | if (bf_size <= chunk_size) |
471 | { | 484 | { |
@@ -534,6 +547,10 @@ send_client_done_and_destroy (void *cls) | |||
534 | 547 | ||
535 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 548 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
536 | "Intersection succeeded, sending DONE to local client\n"); | 549 | "Intersection succeeded, sending DONE to local client\n"); |
550 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
551 | "# Intersection operations succeeded", | ||
552 | 1, | ||
553 | GNUNET_NO); | ||
537 | ev = GNUNET_MQ_msg (rm, | 554 | ev = GNUNET_MQ_msg (rm, |
538 | GNUNET_MESSAGE_TYPE_SET_RESULT); | 555 | GNUNET_MESSAGE_TYPE_SET_RESULT); |
539 | rm->request_id = htonl (op->client_request_id); | 556 | rm->request_id = htonl (op->client_request_id); |
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c index c3c14f1ba..c1268948a 100644 --- a/src/set/gnunet-service-set_union.c +++ b/src/set/gnunet-service-set_union.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 | */ |
@@ -758,8 +758,8 @@ get_order_from_difference (unsigned int diff) | |||
758 | */ | 758 | */ |
759 | static int | 759 | static int |
760 | send_full_element_iterator (void *cls, | 760 | send_full_element_iterator (void *cls, |
761 | const struct GNUNET_HashCode *key, | 761 | const struct GNUNET_HashCode *key, |
762 | void *value) | 762 | void *value) |
763 | { | 763 | { |
764 | struct Operation *op = cls; | 764 | struct Operation *op = cls; |
765 | struct GNUNET_SET_ElementMessage *emsg; | 765 | struct GNUNET_SET_ElementMessage *emsg; |
@@ -1371,7 +1371,8 @@ send_client_element (struct Operation *op, | |||
1371 | * | 1371 | * |
1372 | * @param op operation | 1372 | * @param op operation |
1373 | */ | 1373 | */ |
1374 | void destroy_channel (struct Operation *op) | 1374 | static void |
1375 | destroy_channel (struct Operation *op) | ||
1375 | { | 1376 | { |
1376 | struct GNUNET_CADET_Channel *channel; | 1377 | struct GNUNET_CADET_Channel *channel; |
1377 | 1378 | ||
@@ -1404,7 +1405,11 @@ send_client_done (void *cls) | |||
1404 | 1405 | ||
1405 | if (PHASE_DONE != op->state->phase) { | 1406 | if (PHASE_DONE != op->state->phase) { |
1406 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1407 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1407 | "union operation failed\n"); | 1408 | "Union operation failed\n"); |
1409 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
1410 | "# Union operations failed", | ||
1411 | 1, | ||
1412 | GNUNET_NO); | ||
1408 | ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT); | 1413 | ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT); |
1409 | rm->result_status = htons (GNUNET_SET_STATUS_FAILURE); | 1414 | rm->result_status = htons (GNUNET_SET_STATUS_FAILURE); |
1410 | rm->request_id = htonl (op->client_request_id); | 1415 | rm->request_id = htonl (op->client_request_id); |
@@ -1416,6 +1421,10 @@ send_client_done (void *cls) | |||
1416 | 1421 | ||
1417 | op->state->client_done_sent = GNUNET_YES; | 1422 | op->state->client_done_sent = GNUNET_YES; |
1418 | 1423 | ||
1424 | GNUNET_STATISTICS_update (_GSS_statistics, | ||
1425 | "# Union operations succeeded", | ||
1426 | 1, | ||
1427 | GNUNET_NO); | ||
1419 | LOG (GNUNET_ERROR_TYPE_INFO, | 1428 | LOG (GNUNET_ERROR_TYPE_INFO, |
1420 | "Signalling client that union operation is done\n"); | 1429 | "Signalling client that union operation is done\n"); |
1421 | ev = GNUNET_MQ_msg (rm, | 1430 | ev = GNUNET_MQ_msg (rm, |
diff --git a/src/util/.gitignore b/src/util/.gitignore index 8e7093568..7b190ca76 100644 --- a/src/util/.gitignore +++ b/src/util/.gitignore | |||
@@ -69,4 +69,7 @@ perf_crypto_hash | |||
69 | perf_crypto_symmetric | 69 | perf_crypto_symmetric |
70 | perf_crypto_rsa | 70 | perf_crypto_rsa |
71 | perf_crypto_ecc_dlog | 71 | perf_crypto_ecc_dlog |
72 | test_hexcoder test_regex test_tun | 72 | test_hexcoder |
73 | test_regex | ||
74 | test_tun | ||
75 | gnunet-timeout | ||
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index ec7bcb016..4ae073c2c 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am | |||
@@ -166,6 +166,7 @@ lib_LTLIBRARIES = libgnunetutil.la | |||
166 | 166 | ||
167 | libexec_PROGRAMS = \ | 167 | libexec_PROGRAMS = \ |
168 | gnunet-service-resolver \ | 168 | gnunet-service-resolver \ |
169 | gnunet-timeout \ | ||
169 | $(W32CONSOLEHELPER) | 170 | $(W32CONSOLEHELPER) |
170 | 171 | ||
171 | bin_SCRIPTS =\ | 172 | bin_SCRIPTS =\ |
@@ -192,6 +193,15 @@ endif | |||
192 | endif | 193 | endif |
193 | 194 | ||
194 | 195 | ||
196 | if !MINGW | ||
197 | gnunet_timeout_SOURCES = \ | ||
198 | gnunet-timeout.c | ||
199 | else | ||
200 | gnunet_timeout_SOURCES = \ | ||
201 | gnunet-timeout-w32.c | ||
202 | endif | ||
203 | |||
204 | |||
195 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' | 205 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' |
196 | 206 | ||
197 | gnunet-qr: gnunet-qr.py.in Makefile | 207 | gnunet-qr: gnunet-qr.py.in Makefile |
@@ -334,12 +344,12 @@ test_hexcoder_LDADD = \ | |||
334 | test_tun_SOURCES = \ | 344 | test_tun_SOURCES = \ |
335 | test_tun.c | 345 | test_tun.c |
336 | test_tun_LDADD = \ | 346 | test_tun_LDADD = \ |
337 | libgnunetutil.la | 347 | libgnunetutil.la |
338 | 348 | ||
339 | test_regex_SOURCES = \ | 349 | test_regex_SOURCES = \ |
340 | test_regex.c | 350 | test_regex.c |
341 | test_regex_LDADD = \ | 351 | test_regex_LDADD = \ |
342 | libgnunetutil.la | 352 | libgnunetutil.la |
343 | 353 | ||
344 | test_os_start_process_SOURCES = \ | 354 | test_os_start_process_SOURCES = \ |
345 | test_os_start_process.c | 355 | test_os_start_process.c |
@@ -622,4 +632,4 @@ EXTRA_DIST = \ | |||
622 | test_resolver_api_data.conf \ | 632 | test_resolver_api_data.conf \ |
623 | test_service_data.conf \ | 633 | test_service_data.conf \ |
624 | test_speedup_data.conf \ | 634 | test_speedup_data.conf \ |
625 | gnunet-qr.py.in | 635 | gnunet-qr.py.in |
diff --git a/src/util/client.c b/src/util/client.c index 44e326eab..1f569255a 100644 --- a/src/util/client.c +++ b/src/util/client.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 | */ |
@@ -721,6 +721,17 @@ test_service_configuration (const char *service_name, | |||
721 | &unixpath)) && | 721 | &unixpath)) && |
722 | (0 < strlen (unixpath))) | 722 | (0 < strlen (unixpath))) |
723 | ret = GNUNET_OK; | 723 | ret = GNUNET_OK; |
724 | else if ((GNUNET_OK == | ||
725 | GNUNET_CONFIGURATION_have_value (cfg, | ||
726 | service_name, | ||
727 | "UNIXPATH"))) | ||
728 | { | ||
729 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, | ||
730 | service_name, | ||
731 | "UNIXPATH", | ||
732 | _("not a valid filename")); | ||
733 | return GNUNET_SYSERR; /* UNIXPATH specified but invalid! */ | ||
734 | } | ||
724 | GNUNET_free_non_null (unixpath); | 735 | GNUNET_free_non_null (unixpath); |
725 | #endif | 736 | #endif |
726 | 737 | ||
diff --git a/src/util/dnsparser.c b/src/util/dnsparser.c index 57d0a014c..6fb6d657f 100644 --- a/src/util/dnsparser.c +++ b/src/util/dnsparser.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 | */ |
@@ -956,8 +956,11 @@ GNUNET_DNSPARSER_builder_add_name (char *dst, | |||
956 | len = dot - idna_name; | 956 | len = dot - idna_name; |
957 | if ( (len >= 64) || (0 == len) ) | 957 | if ( (len >= 64) || (0 == len) ) |
958 | { | 958 | { |
959 | GNUNET_break (0); | 959 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
960 | goto fail; /* segment too long or empty */ | 960 | "Invalid DNS name `%s': label with %u characters encountered\n", |
961 | name, | ||
962 | len); | ||
963 | goto fail; /* label too long or empty */ | ||
961 | } | 964 | } |
962 | dst[pos++] = (char) (uint8_t) len; | 965 | dst[pos++] = (char) (uint8_t) len; |
963 | GNUNET_memcpy (&dst[pos], | 966 | GNUNET_memcpy (&dst[pos], |
diff --git a/contrib/timeout_watchdog_w32.c b/src/util/gnunet-timeout-w32.c index 901eb6207..78b268fe2 100644 --- a/contrib/timeout_watchdog_w32.c +++ b/src/util/gnunet-timeout-w32.c | |||
@@ -11,13 +11,13 @@ | |||
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 | */ |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * @file contrib/timeout_watchdog_w32.c | 20 | * @file src/util/gnunet-timeout-w32.c |
21 | * @brief small tool starting a child process, waiting that it terminates or killing it after a given timeout period | 21 | * @brief small tool starting a child process, waiting that it terminates or killing it after a given timeout period |
22 | * @author LRN | 22 | * @author LRN |
23 | */ | 23 | */ |
@@ -182,7 +182,7 @@ main (int argc, char *argv[]) | |||
182 | exit (0); | 182 | exit (0); |
183 | } | 183 | } |
184 | printf ("Child processes were killed after timeout of %u seconds\n", | 184 | printf ("Child processes were killed after timeout of %u seconds\n", |
185 | timeout); | 185 | timeout); |
186 | TerminateJobObject (job, 1); | 186 | TerminateJobObject (job, 1); |
187 | CloseHandle (proc.hProcess); | 187 | CloseHandle (proc.hProcess); |
188 | exit (1); | 188 | exit (1); |
diff --git a/contrib/timeout_watchdog.c b/src/util/gnunet-timeout.c index 70e840d55..8dfb6ad17 100644 --- a/contrib/timeout_watchdog.c +++ b/src/util/gnunet-timeout.c | |||
@@ -11,13 +11,13 @@ | |||
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 | */ |
18 | 18 | ||
19 | /** | 19 | /** |
20 | * @file contrib/timeout_watchdog.c | 20 | * @file src/util/gnunet-timeout.c |
21 | * @brief small tool starting a child process, waiting that it terminates or killing it after a given timeout period | 21 | * @brief small tool starting a child process, waiting that it terminates or killing it after a given timeout period |
22 | * @author Matthias Wachs | 22 | * @author Matthias Wachs |
23 | */ | 23 | */ |
@@ -39,25 +39,35 @@ sigchld_handler (int val) | |||
39 | int ret = 0; | 39 | int ret = 0; |
40 | 40 | ||
41 | (void) val; | 41 | (void) val; |
42 | waitpid (child, &status, 0); | 42 | waitpid (child, |
43 | &status, | ||
44 | 0); | ||
43 | if (WIFEXITED (status) != 0) | 45 | if (WIFEXITED (status) != 0) |
44 | { | 46 | { |
45 | ret = WEXITSTATUS (status); | 47 | ret = WEXITSTATUS (status); |
46 | printf ("Test process exited with result %u\n", ret); | 48 | fprintf (stderr, |
47 | } | 49 | "Process exited with result %u\n", |
50 | ret); | ||
51 | exit (ret); /* return same status code */ | ||
52 | } | ||
48 | if (WIFSIGNALED (status) != 0) | 53 | if (WIFSIGNALED (status) != 0) |
49 | { | 54 | { |
50 | ret = WTERMSIG (status); | 55 | ret = WTERMSIG (status); |
51 | printf ("Test process was signaled %u\n", ret); | 56 | fprintf (stderr, |
52 | } | 57 | "Process received signal %u\n", |
53 | exit (ret); | 58 | ret); |
59 | kill (getpid (), | ||
60 | ret); /* kill self with the same signal */ | ||
61 | } | ||
62 | exit (-1); | ||
54 | } | 63 | } |
55 | 64 | ||
56 | 65 | ||
57 | static void | 66 | static void |
58 | sigint_handler (int val) | 67 | sigint_handler (int val) |
59 | { | 68 | { |
60 | kill (0, val); | 69 | kill (0, |
70 | val); | ||
61 | exit (val); | 71 | exit (val); |
62 | } | 72 | } |
63 | 73 | ||
@@ -70,18 +80,18 @@ main (int argc, | |||
70 | pid_t gpid = 0; | 80 | pid_t gpid = 0; |
71 | 81 | ||
72 | if (argc < 3) | 82 | if (argc < 3) |
73 | { | 83 | { |
74 | printf | 84 | fprintf (stderr, |
75 | ("arg 1: timeout in sec., arg 2: executable, arg<n> arguments\n"); | 85 | "arg 1: timeout in sec., arg 2: executable, arg<n> arguments\n"); |
76 | exit (1); | 86 | exit (-1); |
77 | } | 87 | } |
78 | 88 | ||
79 | timeout = atoi (argv[1]); | 89 | timeout = atoi (argv[1]); |
80 | 90 | ||
81 | if (timeout == 0) | 91 | if (timeout == 0) |
82 | timeout = 600; | 92 | timeout = 600; |
83 | 93 | ||
84 | /* with getpgid() it does not compile, but getpgrp is the BSD version and working */ | 94 | /* with getpgid() it does not compile, but getpgrp is the BSD version and working */ |
85 | gpid = getpgrp (); | 95 | gpid = getpgrp (); |
86 | 96 | ||
87 | signal (SIGCHLD, sigchld_handler); | 97 | signal (SIGCHLD, sigchld_handler); |
@@ -94,23 +104,25 @@ main (int argc, | |||
94 | 104 | ||
95 | child = fork (); | 105 | child = fork (); |
96 | if (child == 0) | 106 | if (child == 0) |
97 | { | 107 | { |
98 | /* int setpgrp(pid_t pid, pid_t pgid); is not working on this machine */ | 108 | /* int setpgrp(pid_t pid, pid_t pgid); is not working on this machine */ |
99 | //setpgrp (0, pid_t gpid); | 109 | //setpgrp (0, pid_t gpid); |
100 | if (-1 != gpid) | 110 | if (-1 != gpid) |
101 | setpgid (0, gpid); | 111 | setpgid (0, gpid); |
102 | execvp (argv[2], &argv[2]); | 112 | execvp (argv[2], |
103 | exit (1); | 113 | &argv[2]); |
104 | } | 114 | exit (-1); |
115 | } | ||
105 | if (child > 0) | 116 | if (child > 0) |
106 | { | 117 | { |
107 | sleep (timeout); | 118 | sleep (timeout); |
108 | printf ("Child processes were killed after timeout of %u seconds\n", | 119 | printf ("Child processes were killed after timeout of %u seconds\n", |
109 | timeout); | 120 | timeout); |
110 | kill (0, SIGTERM); | 121 | kill (0, |
111 | exit (1); | 122 | SIGTERM); |
112 | } | 123 | exit (3); |
113 | exit (1); | 124 | } |
125 | exit (-1); | ||
114 | } | 126 | } |
115 | 127 | ||
116 | /* end of timeout_watchdog.c */ | 128 | /* end of timeout_watchdog.c */ |