aboutsummaryrefslogtreecommitdiff
path: root/src/gns
diff options
context:
space:
mode:
authorPhil <phil.buschmann@tum.de>2018-06-11 22:10:32 +0200
committerPhil <phil.buschmann@tum.de>2018-06-11 22:10:32 +0200
commit09b6a814e0ddcca0497c5cbf37940c27e6a5d9de (patch)
treef9884590450463aa95d9f858e9992e103467e89e /src/gns
parentc1062075eddca49cfeaac8f7fd8c84e73198c2aa (diff)
parentbb581dc55bfb90fc7f34797111b55d16e69b7af0 (diff)
downloadgnunet-09b6a814e0ddcca0497c5cbf37940c27e6a5d9de.tar.gz
gnunet-09b6a814e0ddcca0497c5cbf37940c27e6a5d9de.zip
-Merge branch 'master' of ssh://gnunet.org/gnunet into gsoc2018/rest_api
Diffstat (limited to 'src/gns')
-rw-r--r--src/gns/gns.h18
-rw-r--r--src/gns/gns_api.c18
-rw-r--r--src/gns/gns_api.h18
-rw-r--r--src/gns/gns_tld_api.c18
-rw-r--r--src/gns/gnunet-bcd.c18
-rw-r--r--src/gns/gnunet-dns2gns.c18
-rw-r--r--src/gns/gnunet-gns-benchmark.c18
-rw-r--r--src/gns/gnunet-gns-helper-service-w32.c18
-rw-r--r--src/gns/gnunet-gns-import.c18
-rw-r--r--src/gns/gnunet-gns-proxy.c487
-rw-r--r--src/gns/gnunet-gns.c18
-rw-r--r--src/gns/gnunet-service-gns.c18
-rw-r--r--src/gns/gnunet-service-gns.h18
-rw-r--r--src/gns/gnunet-service-gns_interceptor.c18
-rw-r--r--src/gns/gnunet-service-gns_interceptor.h18
-rw-r--r--src/gns/gnunet-service-gns_resolver.c50
-rw-r--r--src/gns/gnunet-service-gns_resolver.h18
-rw-r--r--src/gns/nss/nss_gns_query.c18
-rw-r--r--src/gns/nss/nss_gns_query.h18
-rw-r--r--src/gns/plugin_block_gns.c18
-rw-r--r--src/gns/plugin_gnsrecord_gns.c18
-rw-r--r--src/gns/plugin_rest_gns.c18
-rw-r--r--src/gns/test_gns_proxy.c18
-rw-r--r--src/gns/w32nsp-install.c18
-rw-r--r--src/gns/w32nsp-resolve.c18
-rw-r--r--src/gns/w32nsp.c18
-rw-r--r--src/gns/w32resolver.h18
27 files changed, 603 insertions, 384 deletions
diff --git a/src/gns/gns.h b/src/gns/gns.h
index d77bf53c6..8a615f43e 100644
--- a/src/gns/gns.h
+++ b/src/gns/gns.h
@@ -2,20 +2,18 @@
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2012-2013 GNUnet e.V. 3 Copyright (C) 2012-2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19 */ 17 */
20/** 18/**
21 * @file gns/gns.h 19 * @file gns/gns.h
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index ed30fa44c..8264bf715 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009-2013, 2016, 2018 GNUnet e.V. 3 Copyright (C) 2009-2013, 2016, 2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gns/gns_api.c 19 * @file gns/gns_api.c
diff --git a/src/gns/gns_api.h b/src/gns/gns_api.h
index e4912338f..622e4339c 100644
--- a/src/gns/gns_api.h
+++ b/src/gns/gns_api.h
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009-2013, 2016, 2018 GNUnet e.V. 3 Copyright (C) 2009-2013, 2016, 2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gns/gns_api.h 19 * @file gns/gns_api.h
diff --git a/src/gns/gns_tld_api.c b/src/gns/gns_tld_api.c
index 8a4d03b11..b053aa0c1 100644
--- a/src/gns/gns_tld_api.c
+++ b/src/gns/gns_tld_api.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009-2013, 2016, 2018 GNUnet e.V. 3 Copyright (C) 2009-2013, 2016, 2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gns/gns_tld_api.c 19 * @file gns/gns_tld_api.c
diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c
index d7fd1a812..5279e83a4 100644
--- a/src/gns/gnunet-bcd.c
+++ b/src/gns/gnunet-bcd.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2013 GNUnet e.V. 3 Copyright (C) 2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21/** 19/**
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c
index bc66f1325..e6e53d405 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012-2013 GNUnet e.V. 3 Copyright (C) 2012-2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gnunet-dns2gns.c 19 * @file gnunet-dns2gns.c
diff --git a/src/gns/gnunet-gns-benchmark.c b/src/gns/gnunet-gns-benchmark.c
index dd393972a..6ed4dfe6c 100644
--- a/src/gns/gnunet-gns-benchmark.c
+++ b/src/gns/gnunet-gns-benchmark.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2018 GNUnet e.V. 3 Copyright (C) 2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file src/gns/gnunet-gns-benchmark.c 19 * @file src/gns/gnunet-gns-benchmark.c
diff --git a/src/gns/gnunet-gns-helper-service-w32.c b/src/gns/gnunet-gns-helper-service-w32.c
index a59cc5981..0e3b3f0e6 100644
--- a/src/gns/gnunet-gns-helper-service-w32.c
+++ b/src/gns/gnunet-gns-helper-service-w32.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012, 2017 GNUnet e.V. 3 Copyright (C) 2012, 2017 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gnunet-gns-helper-service-w32.c 19 * @file gnunet-gns-helper-service-w32.c
diff --git a/src/gns/gnunet-gns-import.c b/src/gns/gnunet-gns-import.c
index 3b9b0a081..2b2c0ddee 100644
--- a/src/gns/gnunet-gns-import.c
+++ b/src/gns/gnunet-gns-import.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012-2013 GNUnet e.V. 3 Copyright (C) 2012-2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gnunet-gns.c 19 * @file gnunet-gns.c
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c
index 0d7d83b4b..9a405c49b 100644
--- a/src/gns/gnunet-gns-proxy.c
+++ b/src/gns/gnunet-gns-proxy.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012-2014 GNUnet e.V. 3 Copyright (C) 2012-2014 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @author Martin Schanzenbach 19 * @author Martin Schanzenbach
@@ -49,6 +47,15 @@
49 47
50 48
51/** 49/**
50 * FIXME: GnuTLS right now sometimes rejects valid certs, so as a
51 * VERY temporary workaround we just WARN the user instead of
52 * dropping the page. THIS SHOULD NOT BE USED IN PRODUCTION,
53 * set to 1 in production!!! FIXME!!!
54 */
55#define FIXED_CERT_VALIDATION_BUG 0
56
57
58/**
52 * Default Socks5 listen port. 59 * Default Socks5 listen port.
53 */ 60 */
54#define GNUNET_GNS_PROXY_PORT 7777 61#define GNUNET_GNS_PROXY_PORT 7777
@@ -106,7 +113,13 @@
106 * @param fun name of curl_easy-function that gave the error 113 * @param fun name of curl_easy-function that gave the error
107 * @param rc return code from curl 114 * @param rc return code from curl
108 */ 115 */
109#define LOG_CURL_EASY(level,fun,rc) GNUNET_log(level, _("%s failed at %s:%d: `%s'\n"), fun, __FILE__, __LINE__, curl_easy_strerror (rc)) 116#define LOG_CURL_EASY(level,fun,rc) \
117 GNUNET_log (level, \
118 _("%s failed at %s:%d: `%s'\n"), \
119 fun, \
120 __FILE__, \
121 __LINE__, \
122 curl_easy_strerror (rc))
110 123
111 124
112/* *************** Socks protocol definitions (move to TUN?) ****************** */ 125/* *************** Socks protocol definitions (move to TUN?) ****************** */
@@ -626,6 +639,11 @@ struct Socks5Request
626 * Did we suspend MHD processing? 639 * Did we suspend MHD processing?
627 */ 640 */
628 int suspended; 641 int suspended;
642
643 /**
644 * Did we pause CURL processing?
645 */
646 int curl_paused;
629}; 647};
630 648
631 649
@@ -679,6 +697,11 @@ static CURLM *curl_multi;
679static struct GNUNET_GNS_Handle *gns_handle; 697static struct GNUNET_GNS_Handle *gns_handle;
680 698
681/** 699/**
700 * Disable IPv6.
701 */
702static int disable_v6;
703
704/**
682 * DLL for http/https daemons 705 * DLL for http/https daemons
683 */ 706 */
684static struct MhdHttpList *mhd_httpd_head; 707static struct MhdHttpList *mhd_httpd_head;
@@ -763,21 +786,37 @@ cleanup_s5r (struct Socks5Request *s5r)
763 } 786 }
764 if ( (NULL != s5r->response) && 787 if ( (NULL != s5r->response) &&
765 (curl_failure_response != s5r->response) ) 788 (curl_failure_response != s5r->response) )
789 {
766 MHD_destroy_response (s5r->response); 790 MHD_destroy_response (s5r->response);
791 s5r->response = NULL;
792 }
767 if (NULL != s5r->rtask) 793 if (NULL != s5r->rtask)
794 {
768 GNUNET_SCHEDULER_cancel (s5r->rtask); 795 GNUNET_SCHEDULER_cancel (s5r->rtask);
796 s5r->rtask = NULL;
797 }
769 if (NULL != s5r->timeout_task) 798 if (NULL != s5r->timeout_task)
799 {
770 GNUNET_SCHEDULER_cancel (s5r->timeout_task); 800 GNUNET_SCHEDULER_cancel (s5r->timeout_task);
801 s5r->timeout_task = NULL;
802 }
771 if (NULL != s5r->wtask) 803 if (NULL != s5r->wtask)
804 {
772 GNUNET_SCHEDULER_cancel (s5r->wtask); 805 GNUNET_SCHEDULER_cancel (s5r->wtask);
806 s5r->wtask = NULL;
807 }
773 if (NULL != s5r->gns_lookup) 808 if (NULL != s5r->gns_lookup)
809 {
774 GNUNET_GNS_lookup_with_tld_cancel (s5r->gns_lookup); 810 GNUNET_GNS_lookup_with_tld_cancel (s5r->gns_lookup);
811 s5r->gns_lookup = NULL;
812 }
775 if (NULL != s5r->sock) 813 if (NULL != s5r->sock)
776 { 814 {
777 if (SOCKS5_SOCKET_WITH_MHD <= s5r->state) 815 if (SOCKS5_SOCKET_WITH_MHD <= s5r->state)
778 GNUNET_NETWORK_socket_free_memory_only_ (s5r->sock); 816 GNUNET_NETWORK_socket_free_memory_only_ (s5r->sock);
779 else 817 else
780 GNUNET_NETWORK_socket_close (s5r->sock); 818 GNUNET_NETWORK_socket_close (s5r->sock);
819 s5r->sock = NULL;
781 } 820 }
782 GNUNET_CONTAINER_DLL_remove (s5r_head, 821 GNUNET_CONTAINER_DLL_remove (s5r_head,
783 s5r_tail, 822 s5r_tail,
@@ -823,7 +862,9 @@ mhd_content_cb (void *cls,
823 start the download, the IO buffer is still full 862 start the download, the IO buffer is still full
824 with upload data. */ 863 with upload data. */
825 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 864 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
826 "Pausing MHD download, not yet ready for download\n"); 865 "Pausing MHD download %s%s, not yet ready for download\n",
866 s5r->domain,
867 s5r->url);
827 return 0; /* not yet ready for data download */ 868 return 0; /* not yet ready for data download */
828 } 869 }
829 bytes_to_copy = GNUNET_MIN (max, 870 bytes_to_copy = GNUNET_MIN (max,
@@ -832,12 +873,21 @@ mhd_content_cb (void *cls,
832 (SOCKS5_SOCKET_DOWNLOAD_DONE != s5r->state) ) 873 (SOCKS5_SOCKET_DOWNLOAD_DONE != s5r->state) )
833 { 874 {
834 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 875 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
835 "Pausing MHD download, no data available\n"); 876 "Pausing MHD download %s%s, no data available\n",
877 s5r->domain,
878 s5r->url);
836 if (NULL != s5r->curl) 879 if (NULL != s5r->curl)
837 { 880 {
838 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 881 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
839 "Continuing CURL interaction\n"); 882 "Continuing CURL interaction for %s%s\n",
840 curl_easy_pause (s5r->curl, CURLPAUSE_CONT); 883 s5r->domain,
884 s5r->url);
885 if (GNUNET_YES == s5r->curl_paused)
886 {
887 s5r->curl_paused = GNUNET_NO;
888 curl_easy_pause (s5r->curl,
889 CURLPAUSE_CONT);
890 }
841 curl_download_prepare (); 891 curl_download_prepare ();
842 } 892 }
843 if (GNUNET_NO == s5r->suspended) 893 if (GNUNET_NO == s5r->suspended)
@@ -851,13 +901,17 @@ mhd_content_cb (void *cls,
851 (SOCKS5_SOCKET_DOWNLOAD_DONE == s5r->state) ) 901 (SOCKS5_SOCKET_DOWNLOAD_DONE == s5r->state) )
852 { 902 {
853 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 903 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
854 "Completed MHD download\n"); 904 "Completed MHD download %s%s\n",
905 s5r->domain,
906 s5r->url);
855 return MHD_CONTENT_READER_END_OF_STREAM; 907 return MHD_CONTENT_READER_END_OF_STREAM;
856 } 908 }
857 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 909 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
858 "Writing %llu/%llu bytes\n", 910 "Writing %llu/%llu bytes to %s%s\n",
859 (unsigned long long) bytes_to_copy, 911 (unsigned long long) bytes_to_copy,
860 (unsigned long long) s5r->io_len); 912 (unsigned long long) s5r->io_len,
913 s5r->domain,
914 s5r->url);
861 GNUNET_memcpy (buf, 915 GNUNET_memcpy (buf,
862 s5r->io_buf, 916 s5r->io_buf,
863 bytes_to_copy); 917 bytes_to_copy);
@@ -865,10 +919,14 @@ mhd_content_cb (void *cls,
865 &s5r->io_buf[bytes_to_copy], 919 &s5r->io_buf[bytes_to_copy],
866 s5r->io_len - bytes_to_copy); 920 s5r->io_len - bytes_to_copy);
867 s5r->io_len -= bytes_to_copy; 921 s5r->io_len -= bytes_to_copy;
868 if (NULL != s5r->curl) 922 if ( (NULL != s5r->curl) &&
923 (GNUNET_YES == s5r->curl_paused) )
869 { 924 {
870 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 925 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
871 "Continuing CURL interaction\n"); 926 "Continuing CURL interaction for %s%s\n",
927 s5r->domain,
928 s5r->url);
929 s5r->curl_paused = GNUNET_NO;
872 curl_easy_pause (s5r->curl, 930 curl_easy_pause (s5r->curl,
873 CURLPAUSE_CONT); 931 CURLPAUSE_CONT);
874 } 932 }
@@ -911,8 +969,10 @@ check_ssl_certificate (struct Socks5Request *s5r)
911 tlsinfo->backend); 969 tlsinfo->backend);
912 return GNUNET_SYSERR; 970 return GNUNET_SYSERR;
913 } 971 }
914 chainp = gnutls_certificate_get_peers (tlsinfo->internals, &cert_list_size); 972 chainp = gnutls_certificate_get_peers (tlsinfo->internals,
915 if ( (! chainp) || (0 == cert_list_size) ) 973 &cert_list_size);
974 if ( (! chainp) ||
975 (0 == cert_list_size) )
916 return GNUNET_SYSERR; 976 return GNUNET_SYSERR;
917 977
918 size = sizeof (certdn); 978 size = sizeof (certdn);
@@ -1015,11 +1075,14 @@ check_ssl_certificate (struct Socks5Request *s5r)
1015 name))) 1075 name)))
1016 { 1076 {
1017 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1077 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1018 _("TLS certificate subject name (%s) does not match `%s'\n"), 1078 _("TLS certificate subject name (%s) does not match `%s': %d\n"),
1019 certdn, 1079 certdn,
1020 name); 1080 name,
1081 rc);
1082#if FIXED_CERT_VALIDATION_BUG
1021 gnutls_x509_crt_deinit (x509_cert); 1083 gnutls_x509_crt_deinit (x509_cert);
1022 return GNUNET_SYSERR; 1084 return GNUNET_SYSERR;
1085#endif
1023 } 1086 }
1024 } 1087 }
1025 else 1088 else
@@ -1075,15 +1138,17 @@ curl_check_hdr (void *buffer,
1075 if (GNUNET_OK != check_ssl_certificate (s5r)) 1138 if (GNUNET_OK != check_ssl_certificate (s5r))
1076 return 0; 1139 return 0;
1077 } 1140 }
1078 1141 ndup = GNUNET_strndup (buffer,
1079 ndup = GNUNET_strndup (buffer, bytes); 1142 bytes);
1080 hdr_type = strtok (ndup, ":"); 1143 hdr_type = strtok (ndup,
1144 ":");
1081 if (NULL == hdr_type) 1145 if (NULL == hdr_type)
1082 { 1146 {
1083 GNUNET_free (ndup); 1147 GNUNET_free (ndup);
1084 return bytes; 1148 return bytes;
1085 } 1149 }
1086 hdr_val = strtok (NULL, ""); 1150 hdr_val = strtok (NULL,
1151 "");
1087 if (NULL == hdr_val) 1152 if (NULL == hdr_val)
1088 { 1153 {
1089 GNUNET_free (ndup); 1154 GNUNET_free (ndup);
@@ -1105,7 +1170,9 @@ curl_check_hdr (void *buffer,
1105 domain_matched = GNUNET_NO; /* make sure we match domain at most once */ 1170 domain_matched = GNUNET_NO; /* make sure we match domain at most once */
1106 for (tok = strtok (hdr_val, ";"); NULL != tok; tok = strtok (NULL, ";")) 1171 for (tok = strtok (hdr_val, ";"); NULL != tok; tok = strtok (NULL, ";"))
1107 { 1172 {
1108 if ( (0 == strncasecmp (tok, " domain", strlen (" domain"))) && 1173 if ( (0 == strncasecmp (tok,
1174 " domain",
1175 strlen (" domain"))) &&
1109 (GNUNET_NO == domain_matched) ) 1176 (GNUNET_NO == domain_matched) )
1110 { 1177 {
1111 domain_matched = GNUNET_YES; 1178 domain_matched = GNUNET_YES;
@@ -1113,7 +1180,8 @@ curl_check_hdr (void *buffer,
1113 if (strlen (cookie_domain) < strlen (s5r->leho)) 1180 if (strlen (cookie_domain) < strlen (s5r->leho))
1114 { 1181 {
1115 delta_cdomain = strlen (s5r->leho) - strlen (cookie_domain); 1182 delta_cdomain = strlen (s5r->leho) - strlen (cookie_domain);
1116 if (0 == strcasecmp (cookie_domain, s5r->leho + delta_cdomain)) 1183 if (0 == strcasecmp (cookie_domain,
1184 s5r->leho + delta_cdomain))
1117 { 1185 {
1118 offset += sprintf (new_cookie_hdr + offset, 1186 offset += sprintf (new_cookie_hdr + offset,
1119 " domain=%s;", 1187 " domain=%s;",
@@ -1121,7 +1189,8 @@ curl_check_hdr (void *buffer,
1121 continue; 1189 continue;
1122 } 1190 }
1123 } 1191 }
1124 else if (0 == strcmp (cookie_domain, s5r->leho)) 1192 else if (0 == strcmp (cookie_domain,
1193 s5r->leho))
1125 { 1194 {
1126 offset += sprintf (new_cookie_hdr + offset, 1195 offset += sprintf (new_cookie_hdr + offset,
1127 " domain=%s;", 1196 " domain=%s;",
@@ -1132,7 +1201,9 @@ curl_check_hdr (void *buffer,
1132 _("Cookie domain `%s' supplied by server is invalid\n"), 1201 _("Cookie domain `%s' supplied by server is invalid\n"),
1133 tok); 1202 tok);
1134 } 1203 }
1135 GNUNET_memcpy (new_cookie_hdr + offset, tok, strlen (tok)); 1204 GNUNET_memcpy (new_cookie_hdr + offset,
1205 tok,
1206 strlen (tok));
1136 offset += strlen (tok); 1207 offset += strlen (tok);
1137 new_cookie_hdr[offset++] = ';'; 1208 new_cookie_hdr[offset++] = ';';
1138 } 1209 }
@@ -1140,7 +1211,14 @@ curl_check_hdr (void *buffer,
1140 } 1211 }
1141 1212
1142 new_location = NULL; 1213 new_location = NULL;
1143 if (0 == strcasecmp (MHD_HTTP_HEADER_LOCATION, hdr_type)) 1214 if (0 == strcasecmp (MHD_HTTP_HEADER_TRANSFER_ENCODING,
1215 hdr_type))
1216 {
1217 /* Ignore transfer encoding, set automatically by MHD if required */
1218 goto cleanup;
1219 }
1220 if (0 == strcasecmp (MHD_HTTP_HEADER_LOCATION,
1221 hdr_type))
1144 { 1222 {
1145 char *leho_host; 1223 char *leho_host;
1146 1224
@@ -1184,6 +1262,7 @@ curl_check_hdr (void *buffer,
1184 s5r->header_tail, 1262 s5r->header_tail,
1185 header); 1263 header);
1186 } 1264 }
1265 cleanup:
1187 GNUNET_free (ndup); 1266 GNUNET_free (ndup);
1188 GNUNET_free_non_null (new_cookie_hdr); 1267 GNUNET_free_non_null (new_cookie_hdr);
1189 GNUNET_free_non_null (new_location); 1268 GNUNET_free_non_null (new_location);
@@ -1227,7 +1306,9 @@ create_mhd_response_from_s5r (struct Socks5Request *s5r)
1227 s5r->domain, 1306 s5r->domain,
1228 s5r->url); 1307 s5r->url);
1229 s5r->response_code = resp_code; 1308 s5r->response_code = resp_code;
1230 s5r->response = MHD_create_response_from_callback ((-1 == content_length) ? MHD_SIZE_UNKNOWN : content_length, 1309 s5r->response = MHD_create_response_from_callback ((-1 == content_length)
1310 ? MHD_SIZE_UNKNOWN
1311 : content_length,
1231 IO_BUFFERSIZE, 1312 IO_BUFFERSIZE,
1232 &mhd_content_cb, 1313 &mhd_content_cb,
1233 s5r, 1314 s5r,
@@ -1269,6 +1350,7 @@ create_mhd_response_from_s5r (struct Socks5Request *s5r)
1269 return GNUNET_OK; 1350 return GNUNET_OK;
1270} 1351}
1271 1352
1353
1272/** 1354/**
1273 * Handle response payload data from cURL. Copies it into our `io_buf` to make 1355 * Handle response payload data from cURL. Copies it into our `io_buf` to make
1274 * it available to MHD. 1356 * it available to MHD.
@@ -1288,6 +1370,12 @@ curl_download_cb (void *ptr,
1288 struct Socks5Request *s5r = ctx; 1370 struct Socks5Request *s5r = ctx;
1289 size_t total = size * nmemb; 1371 size_t total = size * nmemb;
1290 1372
1373 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1374 "Receiving %ux%u bytes for `%s%s' from cURL\n",
1375 (unsigned int) size,
1376 (unsigned int) nmemb,
1377 s5r->domain,
1378 s5r->url);
1291 if (NULL == s5r->response) 1379 if (NULL == s5r->response)
1292 GNUNET_assert (GNUNET_OK == 1380 GNUNET_assert (GNUNET_OK ==
1293 create_mhd_response_from_s5r (s5r)); 1381 create_mhd_response_from_s5r (s5r));
@@ -1302,6 +1390,7 @@ curl_download_cb (void *ptr,
1302 "Pausing CURL download `%s%s', waiting for UPLOAD to finish\n", 1390 "Pausing CURL download `%s%s', waiting for UPLOAD to finish\n",
1303 s5r->domain, 1391 s5r->domain,
1304 s5r->url); 1392 s5r->url);
1393 s5r->curl_paused = GNUNET_YES;
1305 return CURL_WRITEFUNC_PAUSE; /* not yet ready for data download */ 1394 return CURL_WRITEFUNC_PAUSE; /* not yet ready for data download */
1306 } 1395 }
1307 if (sizeof (s5r->io_buf) - s5r->io_len < total) 1396 if (sizeof (s5r->io_buf) - s5r->io_len < total)
@@ -1313,6 +1402,7 @@ curl_download_cb (void *ptr,
1313 (unsigned long long) sizeof (s5r->io_buf), 1402 (unsigned long long) sizeof (s5r->io_buf),
1314 (unsigned long long) s5r->io_len, 1403 (unsigned long long) s5r->io_len,
1315 (unsigned long long) total); 1404 (unsigned long long) total);
1405 s5r->curl_paused = GNUNET_YES;
1316 return CURL_WRITEFUNC_PAUSE; /* not enough space */ 1406 return CURL_WRITEFUNC_PAUSE; /* not enough space */
1317 } 1407 }
1318 GNUNET_memcpy (&s5r->io_buf[s5r->io_len], 1408 GNUNET_memcpy (&s5r->io_buf[s5r->io_len],
@@ -1367,6 +1457,12 @@ curl_upload_cb (void *buf,
1367 (SOCKS5_SOCKET_UPLOAD_DONE == s5r->state) ) 1457 (SOCKS5_SOCKET_UPLOAD_DONE == s5r->state) )
1368 { 1458 {
1369 s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; 1459 s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED;
1460 if (GNUNET_YES == s5r->curl_paused)
1461 {
1462 s5r->curl_paused = GNUNET_NO;
1463 curl_easy_pause (s5r->curl,
1464 CURLPAUSE_CONT);
1465 }
1370 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1466 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1371 "Completed CURL UPLOAD %s%s\n", 1467 "Completed CURL UPLOAD %s%s\n",
1372 s5r->domain, 1468 s5r->domain,
@@ -1381,7 +1477,9 @@ curl_upload_cb (void *buf,
1381 } 1477 }
1382 to_copy = GNUNET_MIN (s5r->io_len, 1478 to_copy = GNUNET_MIN (s5r->io_len,
1383 len); 1479 len);
1384 GNUNET_memcpy (buf, s5r->io_buf, to_copy); 1480 GNUNET_memcpy (buf,
1481 s5r->io_buf,
1482 to_copy);
1385 memmove (s5r->io_buf, 1483 memmove (s5r->io_buf,
1386 &s5r->io_buf[to_copy], 1484 &s5r->io_buf[to_copy],
1387 s5r->io_len - to_copy); 1485 s5r->io_len - to_copy);
@@ -1445,20 +1543,28 @@ curl_download_prepare ()
1445 return; 1543 return;
1446 } 1544 }
1447 to = -1; 1545 to = -1;
1448 GNUNET_break (CURLM_OK == curl_multi_timeout (curl_multi, &to)); 1546 GNUNET_break (CURLM_OK ==
1547 curl_multi_timeout (curl_multi,
1548 &to));
1449 if (-1 == to) 1549 if (-1 == to)
1450 rtime = GNUNET_TIME_UNIT_FOREVER_REL; 1550 rtime = GNUNET_TIME_UNIT_FOREVER_REL;
1451 else 1551 else
1452 rtime = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, to); 1552 rtime = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS,
1553 to);
1453 if (-1 != max) 1554 if (-1 != max)
1454 { 1555 {
1455 grs = GNUNET_NETWORK_fdset_create (); 1556 grs = GNUNET_NETWORK_fdset_create ();
1456 gws = GNUNET_NETWORK_fdset_create (); 1557 gws = GNUNET_NETWORK_fdset_create ();
1457 GNUNET_NETWORK_fdset_copy_native (grs, &rs, max + 1); 1558 GNUNET_NETWORK_fdset_copy_native (grs,
1458 GNUNET_NETWORK_fdset_copy_native (gws, &ws, max + 1); 1559 &rs,
1560 max + 1);
1561 GNUNET_NETWORK_fdset_copy_native (gws,
1562 &ws,
1563 max + 1);
1459 curl_download_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, 1564 curl_download_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
1460 rtime, 1565 rtime,
1461 grs, gws, 1566 grs,
1567 gws,
1462 &curl_task_download, 1568 &curl_task_download,
1463 curl_multi); 1569 curl_multi);
1464 GNUNET_NETWORK_fdset_destroy (gws); 1570 GNUNET_NETWORK_fdset_destroy (gws);
@@ -1495,6 +1601,9 @@ curl_task_download (void *cls)
1495 running = 0; 1601 running = 0;
1496 mret = curl_multi_perform (curl_multi, 1602 mret = curl_multi_perform (curl_multi,
1497 &running); 1603 &running);
1604 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1605 "Checking CURL multi status: %d\n",
1606 mret);
1498 while (NULL != (msg = curl_multi_info_read (curl_multi, 1607 while (NULL != (msg = curl_multi_info_read (curl_multi,
1499 &msgnum))) 1608 &msgnum)))
1500 { 1609 {
@@ -1527,7 +1636,12 @@ curl_task_download (void *cls)
1527 GNUNET_assert (GNUNET_OK == 1636 GNUNET_assert (GNUNET_OK ==
1528 create_mhd_response_from_s5r (s5r)); 1637 create_mhd_response_from_s5r (s5r));
1529 } 1638 }
1530 s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE; 1639 s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE;
1640 if (GNUNET_YES == s5r->suspended)
1641 {
1642 MHD_resume_connection (s5r->con);
1643 s5r->suspended = GNUNET_NO;
1644 }
1531 run_mhd_now (s5r->hd); 1645 run_mhd_now (s5r->hd);
1532 break; 1646 break;
1533 default: 1647 default:
@@ -1538,6 +1652,11 @@ curl_task_download (void *cls)
1538 curl_easy_strerror (msg->data.result)); 1652 curl_easy_strerror (msg->data.result));
1539 /* FIXME: indicate error somehow? close MHD connection badly as well? */ 1653 /* FIXME: indicate error somehow? close MHD connection badly as well? */
1540 s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE; 1654 s5r->state = SOCKS5_SOCKET_DOWNLOAD_DONE;
1655 if (GNUNET_YES == s5r->suspended)
1656 {
1657 MHD_resume_connection (s5r->con);
1658 s5r->suspended = GNUNET_NO;
1659 }
1541 run_mhd_now (s5r->hd); 1660 run_mhd_now (s5r->hd);
1542 break; 1661 break;
1543 } 1662 }
@@ -1600,12 +1719,15 @@ con_val_iter (void *cls,
1600 struct Socks5Request *s5r = cls; 1719 struct Socks5Request *s5r = cls;
1601 char *hdr; 1720 char *hdr;
1602 1721
1603 if ( (0 == strcasecmp (MHD_HTTP_HEADER_HOST, key)) && 1722 if ( (0 == strcasecmp (MHD_HTTP_HEADER_HOST,
1723 key)) &&
1604 (NULL != s5r->leho) ) 1724 (NULL != s5r->leho) )
1605 value = s5r->leho; 1725 value = s5r->leho;
1606 if (0 == strcasecmp (MHD_HTTP_HEADER_CONTENT_LENGTH, key)) 1726 if (0 == strcasecmp (MHD_HTTP_HEADER_CONTENT_LENGTH,
1727 key))
1607 return MHD_YES; 1728 return MHD_YES;
1608 if (0 == strcasecmp (MHD_HTTP_HEADER_ACCEPT_ENCODING, key)) 1729 if (0 == strcasecmp (MHD_HTTP_HEADER_ACCEPT_ENCODING,
1730 key))
1609 return MHD_YES; 1731 return MHD_YES;
1610 GNUNET_asprintf (&hdr, 1732 GNUNET_asprintf (&hdr,
1611 "%s: %s", 1733 "%s: %s",
@@ -1670,7 +1792,7 @@ create_response (void *cls,
1670 return MHD_NO; 1792 return MHD_NO;
1671 } 1793 }
1672 s5r->con = con; 1794 s5r->con = con;
1673 //Fresh connection. 1795 /* Fresh connection. */
1674 if (SOCKS5_SOCKET_WITH_MHD == s5r->state) 1796 if (SOCKS5_SOCKET_WITH_MHD == s5r->state)
1675 { 1797 {
1676 /* first time here, initialize curl handle */ 1798 /* first time here, initialize curl handle */
@@ -1726,21 +1848,40 @@ create_response (void *cls,
1726 return MHD_queue_response (con, 1848 return MHD_queue_response (con,
1727 MHD_HTTP_INTERNAL_SERVER_ERROR, 1849 MHD_HTTP_INTERNAL_SERVER_ERROR,
1728 curl_failure_response); 1850 curl_failure_response);
1729 curl_easy_setopt (s5r->curl, CURLOPT_HEADERFUNCTION, &curl_check_hdr); 1851 curl_easy_setopt (s5r->curl,
1730 curl_easy_setopt (s5r->curl, CURLOPT_HEADERDATA, s5r); 1852 CURLOPT_HEADERFUNCTION,
1731 curl_easy_setopt (s5r->curl, CURLOPT_FOLLOWLOCATION, 0); 1853 &curl_check_hdr);
1854 curl_easy_setopt (s5r->curl,
1855 CURLOPT_HEADERDATA,
1856 s5r);
1857 curl_easy_setopt (s5r->curl,
1858 CURLOPT_FOLLOWLOCATION,
1859 0);
1732 if (s5r->is_gns) 1860 if (s5r->is_gns)
1733 curl_easy_setopt (s5r->curl, 1861 curl_easy_setopt (s5r->curl,
1734 CURLOPT_IPRESOLVE, 1862 CURLOPT_IPRESOLVE,
1735 CURL_IPRESOLVE_V4); 1863 CURL_IPRESOLVE_V4);
1736 curl_easy_setopt (s5r->curl, CURLOPT_CONNECTTIMEOUT, 600L); 1864 curl_easy_setopt (s5r->curl,
1737 curl_easy_setopt (s5r->curl, CURLOPT_TIMEOUT, 600L); 1865 CURLOPT_CONNECTTIMEOUT,
1738 curl_easy_setopt (s5r->curl, CURLOPT_NOSIGNAL, 1L); 1866 600L);
1739 curl_easy_setopt (s5r->curl, CURLOPT_HTTP_CONTENT_DECODING, 0); 1867 curl_easy_setopt (s5r->curl,
1740 curl_easy_setopt (s5r->curl, CURLOPT_HTTP_TRANSFER_DECODING, 0); 1868 CURLOPT_TIMEOUT,
1741 curl_easy_setopt (s5r->curl, CURLOPT_NOSIGNAL, 1L); 1869 600L);
1742 curl_easy_setopt (s5r->curl, CURLOPT_PRIVATE, s5r); 1870 curl_easy_setopt (s5r->curl,
1743 curl_easy_setopt (s5r->curl, CURLOPT_VERBOSE, 0L); 1871 CURLOPT_NOSIGNAL,
1872 1L);
1873 curl_easy_setopt (s5r->curl,
1874 CURLOPT_HTTP_CONTENT_DECODING,
1875 0);
1876 curl_easy_setopt (s5r->curl,
1877 CURLOPT_NOSIGNAL,
1878 1L);
1879 curl_easy_setopt (s5r->curl,
1880 CURLOPT_PRIVATE,
1881 s5r);
1882 curl_easy_setopt (s5r->curl,
1883 CURLOPT_VERBOSE,
1884 0L);
1744 /** 1885 /**
1745 * Pre-populate cache to resolve Hostname. 1886 * Pre-populate cache to resolve Hostname.
1746 * This is necessary as the DNS name in the CURLOPT_URL is used 1887 * This is necessary as the DNS name in the CURLOPT_URL is used
@@ -1796,11 +1937,22 @@ create_response (void *cls,
1796 MHD_HTTP_METHOD_PUT)) 1937 MHD_HTTP_METHOD_PUT))
1797 { 1938 {
1798 s5r->state = SOCKS5_SOCKET_UPLOAD_STARTED; 1939 s5r->state = SOCKS5_SOCKET_UPLOAD_STARTED;
1799 curl_easy_setopt (s5r->curl, CURLOPT_UPLOAD, 1L); 1940 curl_easy_setopt (s5r->curl,
1800 curl_easy_setopt (s5r->curl, CURLOPT_WRITEFUNCTION, &curl_download_cb); 1941 CURLOPT_UPLOAD,
1801 curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); 1942 1L);
1802 curl_easy_setopt (s5r->curl, CURLOPT_READFUNCTION, &curl_upload_cb); 1943 curl_easy_setopt (s5r->curl,
1803 curl_easy_setopt (s5r->curl, CURLOPT_READDATA, s5r); 1944 CURLOPT_WRITEFUNCTION,
1945 &curl_download_cb);
1946 curl_easy_setopt (s5r->curl,
1947 CURLOPT_WRITEDATA,
1948 s5r);
1949 GNUNET_assert (CURLE_OK ==
1950 curl_easy_setopt (s5r->curl,
1951 CURLOPT_READFUNCTION,
1952 &curl_upload_cb));
1953 curl_easy_setopt (s5r->curl,
1954 CURLOPT_READDATA,
1955 s5r);
1804 { 1956 {
1805 const char *us; 1957 const char *us;
1806 long upload_size; 1958 long upload_size;
@@ -1822,11 +1974,21 @@ create_response (void *cls,
1822 else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_POST)) 1974 else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_POST))
1823 { 1975 {
1824 s5r->state = SOCKS5_SOCKET_UPLOAD_STARTED; 1976 s5r->state = SOCKS5_SOCKET_UPLOAD_STARTED;
1825 curl_easy_setopt (s5r->curl, CURLOPT_POST, 1L); 1977 curl_easy_setopt (s5r->curl,
1826 curl_easy_setopt (s5r->curl, CURLOPT_WRITEFUNCTION, &curl_download_cb); 1978 CURLOPT_POST,
1827 curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); 1979 1L);
1828 curl_easy_setopt (s5r->curl, CURLOPT_READFUNCTION, &curl_upload_cb); 1980 curl_easy_setopt (s5r->curl,
1829 curl_easy_setopt (s5r->curl, CURLOPT_READDATA, s5r); 1981 CURLOPT_WRITEFUNCTION,
1982 &curl_download_cb);
1983 curl_easy_setopt (s5r->curl,
1984 CURLOPT_WRITEDATA,
1985 s5r);
1986 curl_easy_setopt (s5r->curl,
1987 CURLOPT_READFUNCTION,
1988 &curl_upload_cb);
1989 curl_easy_setopt (s5r->curl,
1990 CURLOPT_READDATA,
1991 s5r);
1830 { 1992 {
1831 const char *us; 1993 const char *us;
1832 long upload_size; 1994 long upload_size;
@@ -1834,7 +1996,7 @@ create_response (void *cls,
1834 us = MHD_lookup_connection_value (con, 1996 us = MHD_lookup_connection_value (con,
1835 MHD_HEADER_KIND, 1997 MHD_HEADER_KIND,
1836 MHD_HTTP_HEADER_CONTENT_LENGTH); 1998 MHD_HTTP_HEADER_CONTENT_LENGTH);
1837 if ( (1 == sscanf (us, 1999 if ( (NULL != us) && (1 == sscanf (us,
1838 "%ld", 2000 "%ld",
1839 &upload_size)) && 2001 &upload_size)) &&
1840 (upload_size >= 0) ) 2002 (upload_size >= 0) )
@@ -1842,25 +2004,42 @@ create_response (void *cls,
1842 curl_easy_setopt (s5r->curl, 2004 curl_easy_setopt (s5r->curl,
1843 CURLOPT_INFILESIZE, 2005 CURLOPT_INFILESIZE,
1844 upload_size); 2006 upload_size);
2007 } else {
2008 curl_easy_setopt (s5r->curl,
2009 CURLOPT_INFILESIZE,
2010 upload_size);
1845 } 2011 }
1846 } 2012 }
1847 } 2013 }
1848 else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_HEAD)) 2014 else if (0 == strcasecmp (meth,
2015 MHD_HTTP_METHOD_HEAD))
1849 { 2016 {
1850 s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; 2017 s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED;
1851 curl_easy_setopt (s5r->curl, CURLOPT_NOBODY, 1L); 2018 curl_easy_setopt (s5r->curl,
2019 CURLOPT_NOBODY,
2020 1L);
1852 } 2021 }
1853 else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_OPTIONS)) 2022 else if (0 == strcasecmp (meth,
2023 MHD_HTTP_METHOD_OPTIONS))
1854 { 2024 {
1855 s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; 2025 s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED;
1856 curl_easy_setopt (s5r->curl, CURLOPT_CUSTOMREQUEST, "OPTIONS"); 2026 curl_easy_setopt (s5r->curl,
2027 CURLOPT_CUSTOMREQUEST,
2028 "OPTIONS");
1857 } 2029 }
1858 else if (0 == strcasecmp (meth, MHD_HTTP_METHOD_GET)) 2030 else if (0 == strcasecmp (meth,
2031 MHD_HTTP_METHOD_GET))
1859 { 2032 {
1860 s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED; 2033 s5r->state = SOCKS5_SOCKET_DOWNLOAD_STARTED;
1861 curl_easy_setopt (s5r->curl, CURLOPT_HTTPGET, 1L); 2034 curl_easy_setopt (s5r->curl,
1862 curl_easy_setopt (s5r->curl, CURLOPT_WRITEFUNCTION, &curl_download_cb); 2035 CURLOPT_HTTPGET,
1863 curl_easy_setopt (s5r->curl, CURLOPT_WRITEDATA, s5r); 2036 1L);
2037 curl_easy_setopt (s5r->curl,
2038 CURLOPT_WRITEFUNCTION,
2039 &curl_download_cb);
2040 curl_easy_setopt (s5r->curl,
2041 CURLOPT_WRITEDATA,
2042 s5r);
1864 } 2043 }
1865 else 2044 else
1866 { 2045 {
@@ -1874,31 +2053,47 @@ create_response (void *cls,
1874 2053
1875 if (0 == strcasecmp (ver, MHD_HTTP_VERSION_1_0)) 2054 if (0 == strcasecmp (ver, MHD_HTTP_VERSION_1_0))
1876 { 2055 {
1877 curl_easy_setopt (s5r->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); 2056 curl_easy_setopt (s5r->curl,
2057 CURLOPT_HTTP_VERSION,
2058 CURL_HTTP_VERSION_1_0);
1878 } 2059 }
1879 else if (0 == strcasecmp (ver, MHD_HTTP_VERSION_1_1)) 2060 else if (0 == strcasecmp (ver, MHD_HTTP_VERSION_1_1))
1880 { 2061 {
1881 curl_easy_setopt (s5r->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1); 2062 curl_easy_setopt (s5r->curl,
2063 CURLOPT_HTTP_VERSION,
2064 CURL_HTTP_VERSION_1_1);
1882 } 2065 }
1883 else 2066 else
1884 { 2067 {
1885 curl_easy_setopt (s5r->curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_NONE); 2068 curl_easy_setopt (s5r->curl,
2069 CURLOPT_HTTP_VERSION,
2070 CURL_HTTP_VERSION_NONE);
1886 } 2071 }
1887 2072
1888 if (HTTPS_PORT == s5r->port) 2073 if (HTTPS_PORT == s5r->port)
1889 { 2074 {
1890 curl_easy_setopt (s5r->curl, CURLOPT_USE_SSL, CURLUSESSL_ALL); 2075 curl_easy_setopt (s5r->curl,
2076 CURLOPT_USE_SSL,
2077 CURLUSESSL_ALL);
1891 if (NULL != s5r->dane_data) 2078 if (NULL != s5r->dane_data)
1892 curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYPEER, 0L); 2079 curl_easy_setopt (s5r->curl,
2080 CURLOPT_SSL_VERIFYPEER,
2081 0L);
1893 else 2082 else
1894 curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYPEER, 1L); 2083 curl_easy_setopt (s5r->curl,
2084 CURLOPT_SSL_VERIFYPEER,
2085 1L);
1895 /* Disable cURL checking the hostname, as we will check ourselves 2086 /* Disable cURL checking the hostname, as we will check ourselves
1896 as only we have the domain name or the LEHO or the DANE record */ 2087 as only we have the domain name or the LEHO or the DANE record */
1897 curl_easy_setopt (s5r->curl, CURLOPT_SSL_VERIFYHOST, 0L); 2088 curl_easy_setopt (s5r->curl,
2089 CURLOPT_SSL_VERIFYHOST,
2090 0L);
1898 } 2091 }
1899 else 2092 else
1900 { 2093 {
1901 curl_easy_setopt (s5r->curl, CURLOPT_USE_SSL, CURLUSESSL_NONE); 2094 curl_easy_setopt (s5r->curl,
2095 CURLOPT_USE_SSL,
2096 CURLUSESSL_NONE);
1902 } 2097 }
1903 2098
1904 if (CURLM_OK != 2099 if (CURLM_OK !=
@@ -1931,7 +2126,9 @@ create_response (void *cls,
1931 /* FIXME: This must be set or a header with Transfer-Encoding: chunked. Else 2126 /* FIXME: This must be set or a header with Transfer-Encoding: chunked. Else
1932 * upload callback is not called! 2127 * upload callback is not called!
1933 */ 2128 */
1934 curl_easy_setopt (s5r->curl, CURLOPT_POSTFIELDSIZE, *upload_data_size); 2129 curl_easy_setopt (s5r->curl,
2130 CURLOPT_POSTFIELDSIZE,
2131 *upload_data_size);
1935 2132
1936 left = GNUNET_MIN (*upload_data_size, 2133 left = GNUNET_MIN (*upload_data_size,
1937 sizeof (s5r->io_buf) - s5r->io_len); 2134 sizeof (s5r->io_buf) - s5r->io_len);
@@ -1941,8 +2138,12 @@ create_response (void *cls,
1941 s5r->io_len += left; 2138 s5r->io_len += left;
1942 *upload_data_size -= left; 2139 *upload_data_size -= left;
1943 GNUNET_assert (NULL != s5r->curl); 2140 GNUNET_assert (NULL != s5r->curl);
1944 curl_easy_pause (s5r->curl, 2141 if (GNUNET_YES == s5r->curl_paused)
1945 CURLPAUSE_CONT); 2142 {
2143 s5r->curl_paused = GNUNET_NO;
2144 curl_easy_pause (s5r->curl,
2145 CURLPAUSE_CONT);
2146 }
1946 return MHD_YES; 2147 return MHD_YES;
1947 } 2148 }
1948 if (SOCKS5_SOCKET_UPLOAD_STARTED == s5r->state) 2149 if (SOCKS5_SOCKET_UPLOAD_STARTED == s5r->state)
@@ -2320,8 +2521,10 @@ load_file (const char* filename,
2320 uint64_t fsize; 2521 uint64_t fsize;
2321 2522
2322 if (GNUNET_OK != 2523 if (GNUNET_OK !=
2323 GNUNET_DISK_file_size (filename, &fsize, 2524 GNUNET_DISK_file_size (filename,
2324 GNUNET_YES, GNUNET_YES)) 2525 &fsize,
2526 GNUNET_YES,
2527 GNUNET_YES))
2325 return NULL; 2528 return NULL;
2326 if (fsize > MAX_PEM_SIZE) 2529 if (fsize > MAX_PEM_SIZE)
2327 return NULL; 2530 return NULL;
@@ -2353,7 +2556,8 @@ load_key_from_file (gnutls_x509_privkey_t key,
2353 gnutls_datum_t key_data; 2556 gnutls_datum_t key_data;
2354 int ret; 2557 int ret;
2355 2558
2356 key_data.data = load_file (keyfile, &key_data.size); 2559 key_data.data = load_file (keyfile,
2560 &key_data.size);
2357 if (NULL == key_data.data) 2561 if (NULL == key_data.data)
2358 return GNUNET_SYSERR; 2562 return GNUNET_SYSERR;
2359 ret = gnutls_x509_privkey_import (key, &key_data, 2563 ret = gnutls_x509_privkey_import (key, &key_data,
@@ -2383,15 +2587,18 @@ load_cert_from_file (gnutls_x509_crt_t crt,
2383 gnutls_datum_t cert_data; 2587 gnutls_datum_t cert_data;
2384 int ret; 2588 int ret;
2385 2589
2386 cert_data.data = load_file (certfile, &cert_data.size); 2590 cert_data.data = load_file (certfile,
2591 &cert_data.size);
2387 if (NULL == cert_data.data) 2592 if (NULL == cert_data.data)
2388 return GNUNET_SYSERR; 2593 return GNUNET_SYSERR;
2389 ret = gnutls_x509_crt_import (crt, &cert_data, 2594 ret = gnutls_x509_crt_import (crt,
2595 &cert_data,
2390 GNUTLS_X509_FMT_PEM); 2596 GNUTLS_X509_FMT_PEM);
2391 if (GNUTLS_E_SUCCESS != ret) 2597 if (GNUTLS_E_SUCCESS != ret)
2392 { 2598 {
2393 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2599 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2394 _("Unable to import certificate %s\n"), certfile); 2600 _("Unable to import certificate from `%s'\n"),
2601 certfile);
2395 } 2602 }
2396 GNUNET_free_non_null (cert_data.data); 2603 GNUNET_free_non_null (cert_data.data);
2397 return (GNUTLS_E_SUCCESS != ret) ? GNUNET_SYSERR : GNUNET_OK; 2604 return (GNUTLS_E_SUCCESS != ret) ? GNUNET_SYSERR : GNUNET_OK;
@@ -2421,14 +2628,27 @@ generate_gns_certificate (const char *name)
2421 GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_init (&request)); 2628 GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_init (&request));
2422 GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_set_key (request, proxy_ca.key)); 2629 GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_set_key (request, proxy_ca.key));
2423 pgc = GNUNET_new (struct ProxyGNSCertificate); 2630 pgc = GNUNET_new (struct ProxyGNSCertificate);
2424 gnutls_x509_crt_set_dn_by_oid (request, GNUTLS_OID_X520_COUNTRY_NAME, 2631 gnutls_x509_crt_set_dn_by_oid (request,
2425 0, "ZZ", 2); 2632 GNUTLS_OID_X520_COUNTRY_NAME,
2426 gnutls_x509_crt_set_dn_by_oid (request, GNUTLS_OID_X520_ORGANIZATION_NAME, 2633 0,
2427 0, "GNU Name System", 4); 2634 "ZZ",
2428 gnutls_x509_crt_set_dn_by_oid (request, GNUTLS_OID_X520_COMMON_NAME, 2635 strlen ("ZZ"));
2429 0, name, strlen (name)); 2636 gnutls_x509_crt_set_dn_by_oid (request,
2430 GNUNET_break (GNUTLS_E_SUCCESS == gnutls_x509_crt_set_version (request, 3)); 2637 GNUTLS_OID_X520_ORGANIZATION_NAME,
2431 gnutls_rnd (GNUTLS_RND_NONCE, &serial, sizeof (serial)); 2638 0,
2639 "GNU Name System",
2640 strlen ("GNU Name System"));
2641 gnutls_x509_crt_set_dn_by_oid (request,
2642 GNUTLS_OID_X520_COMMON_NAME,
2643 0,
2644 name,
2645 strlen (name));
2646 GNUNET_break (GNUTLS_E_SUCCESS ==
2647 gnutls_x509_crt_set_version (request,
2648 3));
2649 gnutls_rnd (GNUTLS_RND_NONCE,
2650 &serial,
2651 sizeof (serial));
2432 gnutls_x509_crt_set_serial (request, 2652 gnutls_x509_crt_set_serial (request,
2433 &serial, 2653 &serial,
2434 sizeof (serial)); 2654 sizeof (serial));
@@ -2442,15 +2662,21 @@ generate_gns_certificate (const char *name)
2442 etime = mktime (tm_data); 2662 etime = mktime (tm_data);
2443 gnutls_x509_crt_set_expiration_time (request, 2663 gnutls_x509_crt_set_expiration_time (request,
2444 etime); 2664 etime);
2445 gnutls_x509_crt_sign (request, 2665 gnutls_x509_crt_sign2 (request,
2446 proxy_ca.cert, 2666 proxy_ca.cert,
2447 proxy_ca.key); 2667 proxy_ca.key,
2668 GNUTLS_DIG_SHA512,
2669 0);
2448 key_buf_size = sizeof (pgc->key); 2670 key_buf_size = sizeof (pgc->key);
2449 cert_buf_size = sizeof (pgc->cert); 2671 cert_buf_size = sizeof (pgc->cert);
2450 gnutls_x509_crt_export (request, GNUTLS_X509_FMT_PEM, 2672 gnutls_x509_crt_export (request,
2451 pgc->cert, &cert_buf_size); 2673 GNUTLS_X509_FMT_PEM,
2452 gnutls_x509_privkey_export (proxy_ca.key, GNUTLS_X509_FMT_PEM, 2674 pgc->cert,
2453 pgc->key, &key_buf_size); 2675 &cert_buf_size);
2676 gnutls_x509_privkey_export (proxy_ca.key,
2677 GNUTLS_X509_FMT_PEM,
2678 pgc->key,
2679 &key_buf_size);
2454 gnutls_x509_crt_deinit (request); 2680 gnutls_x509_crt_deinit (request);
2455 return pgc; 2681 return pgc;
2456} 2682}
@@ -2789,8 +3015,10 @@ handle_gns_result (void *cls,
2789 } 3015 }
2790 if (GNUNET_YES == got_ip) 3016 if (GNUNET_YES == got_ip)
2791 break; 3017 break;
3018 if (GNUNET_YES == disable_v6)
3019 break;
2792 if (GNUNET_OK != 3020 if (GNUNET_OK !=
2793 GNUNET_NETWORK_test_pf (PF_INET)) 3021 GNUNET_NETWORK_test_pf (PF_INET6))
2794 break; 3022 break;
2795 /* FIXME: allow user to disable IPv6 per configuration option... */ 3023 /* FIXME: allow user to disable IPv6 per configuration option... */
2796 got_ip = GNUNET_YES; 3024 got_ip = GNUNET_YES;
@@ -2891,7 +3119,8 @@ do_s5r_read (void *cls)
2891 s5r->rtask = NULL; 3119 s5r->rtask = NULL;
2892 tc = GNUNET_SCHEDULER_get_task_context (); 3120 tc = GNUNET_SCHEDULER_get_task_context ();
2893 if ( (NULL != tc->read_ready) && 3121 if ( (NULL != tc->read_ready) &&
2894 (GNUNET_NETWORK_fdset_isset (tc->read_ready, s5r->sock)) ) 3122 (GNUNET_NETWORK_fdset_isset (tc->read_ready,
3123 s5r->sock)) )
2895 { 3124 {
2896 rlen = GNUNET_NETWORK_socket_recv (s5r->sock, 3125 rlen = GNUNET_NETWORK_socket_recv (s5r->sock,
2897 &s5r->rbuf[s5r->rbuf_len], 3126 &s5r->rbuf[s5r->rbuf_len],
@@ -3017,7 +3246,8 @@ do_s5r_read (void *cls)
3017 s5r->domain = GNUNET_strndup (dom_name, 3246 s5r->domain = GNUNET_strndup (dom_name,
3018 *dom_len); 3247 *dom_len);
3019 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3248 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3020 "Requested connection is to %s:%d\n", 3249 "Requested connection is to http%s://%s:%d\n",
3250 (HTTPS_PORT == s5r->port) ? "s" : "",
3021 s5r->domain, 3251 s5r->domain,
3022 ntohs (*port)); 3252 ntohs (*port));
3023 s5r->state = SOCKS5_RESOLVING; 3253 s5r->state = SOCKS5_RESOLVING;
@@ -3088,17 +3318,22 @@ do_accept (void *cls)
3088 if (lsock == lsock4) 3318 if (lsock == lsock4)
3089 ltask4 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, 3319 ltask4 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
3090 lsock, 3320 lsock,
3091 &do_accept, lsock); 3321 &do_accept,
3322 lsock);
3092 else if (lsock == lsock6) 3323 else if (lsock == lsock6)
3093 ltask6 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, 3324 ltask6 = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
3094 lsock, 3325 lsock,
3095 &do_accept, lsock); 3326 &do_accept,
3327 lsock);
3096 else 3328 else
3097 GNUNET_assert (0); 3329 GNUNET_assert (0);
3098 s = GNUNET_NETWORK_socket_accept (lsock, NULL, NULL); 3330 s = GNUNET_NETWORK_socket_accept (lsock,
3331 NULL,
3332 NULL);
3099 if (NULL == s) 3333 if (NULL == s)
3100 { 3334 {
3101 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "accept"); 3335 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR,
3336 "accept");
3102 return; 3337 return;
3103 } 3338 }
3104 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3339 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -3111,7 +3346,8 @@ do_accept (void *cls)
3111 s5r->state = SOCKS5_INIT; 3346 s5r->state = SOCKS5_INIT;
3112 s5r->rtask = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL, 3347 s5r->rtask = GNUNET_SCHEDULER_add_read_net (GNUNET_TIME_UNIT_FOREVER_REL,
3113 s5r->sock, 3348 s5r->sock,
3114 &do_s5r_read, s5r); 3349 &do_s5r_read,
3350 s5r);
3115} 3351}
3116 3352
3117 3353
@@ -3208,7 +3444,8 @@ bind_v4 ()
3208 if (NULL == ls) 3444 if (NULL == ls)
3209 return NULL; 3445 return NULL;
3210 if (GNUNET_OK != 3446 if (GNUNET_OK !=
3211 GNUNET_NETWORK_socket_bind (ls, (const struct sockaddr *) &sa4, 3447 GNUNET_NETWORK_socket_bind (ls,
3448 (const struct sockaddr *) &sa4,
3212 sizeof (sa4))) 3449 sizeof (sa4)))
3213 { 3450 {
3214 eno = errno; 3451 eno = errno;
@@ -3244,7 +3481,8 @@ bind_v6 ()
3244 if (NULL == ls) 3481 if (NULL == ls)
3245 return NULL; 3482 return NULL;
3246 if (GNUNET_OK != 3483 if (GNUNET_OK !=
3247 GNUNET_NETWORK_socket_bind (ls, (const struct sockaddr *) &sa6, 3484 GNUNET_NETWORK_socket_bind (ls,
3485 (const struct sockaddr *) &sa6,
3248 sizeof (sa6))) 3486 sizeof (sa6)))
3249 { 3487 {
3250 eno = errno; 3488 eno = errno;
@@ -3299,7 +3537,8 @@ run (void *cls,
3299 cafile = cafile_cfg; 3537 cafile = cafile_cfg;
3300 } 3538 }
3301 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 3539 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
3302 "Using %s as CA\n", cafile); 3540 "Using `%s' as CA\n",
3541 cafile);
3303 3542
3304 gnutls_global_init (); 3543 gnutls_global_init ();
3305 gnutls_x509_crt_init (&proxy_ca.cert); 3544 gnutls_x509_crt_init (&proxy_ca.cert);
@@ -3434,7 +3673,8 @@ run (void *cls,
3434 * @return 0 ok, 1 on error 3673 * @return 0 ok, 1 on error
3435 */ 3674 */
3436int 3675int
3437main (int argc, char *const *argv) 3676main (int argc,
3677 char *const *argv)
3438{ 3678{
3439 struct GNUNET_GETOPT_CommandLineOption options[] = { 3679 struct GNUNET_GETOPT_CommandLineOption options[] = {
3440 GNUNET_GETOPT_option_uint16 ('p', 3680 GNUNET_GETOPT_option_uint16 ('p',
@@ -3447,6 +3687,10 @@ main (int argc, char *const *argv)
3447 NULL, 3687 NULL,
3448 gettext_noop ("pem file to use as CA"), 3688 gettext_noop ("pem file to use as CA"),
3449 &cafile_opt), 3689 &cafile_opt),
3690 GNUNET_GETOPT_option_flag ('6',
3691 "disable-ivp6",
3692 gettext_noop ("disable use of IPv6"),
3693 &disable_v6),
3450 3694
3451 GNUNET_GETOPT_OPTION_END 3695 GNUNET_GETOPT_OPTION_END
3452 }; 3696 };
@@ -3455,8 +3699,9 @@ main (int argc, char *const *argv)
3455 "</head><body>cURL fail</body></html>"; 3699 "</head><body>cURL fail</body></html>";
3456 int ret; 3700 int ret;
3457 3701
3458 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, 3702 if (GNUNET_OK !=
3459 &argc, &argv)) 3703 GNUNET_STRINGS_get_utf8_args (argc, argv,
3704 &argc, &argv))
3460 return 2; 3705 return 2;
3461 GNUNET_log_setup ("gnunet-gns-proxy", 3706 GNUNET_log_setup ("gnunet-gns-proxy",
3462 "WARNING", 3707 "WARNING",
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c
index 34f6e2c82..149c8a7bb 100644
--- a/src/gns/gnunet-gns.c
+++ b/src/gns/gnunet-gns.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012-2013, 2017-2018 GNUnet e.V. 3 Copyright (C) 2012-2013, 2017-2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gnunet-gns.c 19 * @file gnunet-gns.c
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index aaa4aeb0e..71e744733 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2011-2018 GNUnet e.V. 3 Copyright (C) 2011-2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gns/gnunet-service-gns.c 19 * @file gns/gnunet-service-gns.c
diff --git a/src/gns/gnunet-service-gns.h b/src/gns/gnunet-service-gns.h
index 439bad881..952c7178f 100644
--- a/src/gns/gnunet-service-gns.h
+++ b/src/gns/gnunet-service-gns.h
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2018 GNUnet e.V. 3 Copyright (C) 2018 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gns/gnunet-service-gns.h 19 * @file gns/gnunet-service-gns.h
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c
index 0425e9500..ecf4d59f5 100644
--- a/src/gns/gnunet-service-gns_interceptor.c
+++ b/src/gns/gnunet-service-gns_interceptor.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009-2013 GNUnet e.V. 3 Copyright (C) 2009-2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gns/gnunet-service-gns_interceptor.c 19 * @file gns/gnunet-service-gns_interceptor.c
diff --git a/src/gns/gnunet-service-gns_interceptor.h b/src/gns/gnunet-service-gns_interceptor.h
index ff54b7b6e..460665cf0 100644
--- a/src/gns/gnunet-service-gns_interceptor.h
+++ b/src/gns/gnunet-service-gns_interceptor.h
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009, 2010, 2011, 2012 GNUnet e.V. 3 Copyright (C) 2009, 2010, 2011, 2012 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gns/gnunet-service-gns_interceptor.h 19 * @file gns/gnunet-service-gns_interceptor.h
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 0d04fc6b9..a90cc4c0e 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2011-2013 GNUnet e.V. 3 Copyright (C) 2011-2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21/** 19/**
@@ -373,6 +371,12 @@ struct GNS_ResolverHandle
373 char *name; 371 char *name;
374 372
375 /** 373 /**
374 * Legacy Hostname to use if we encountered GNS2DNS record
375 * and thus can deduct the LEHO from that transition.
376 */
377 char *leho;
378
379 /**
376 * DLL of results we got from DNS. 380 * DLL of results we got from DNS.
377 */ 381 */
378 struct DnsResult *dns_result_head; 382 struct DnsResult *dns_result_head;
@@ -965,6 +969,12 @@ dns_result_parser (void *cls,
965 af = AF_UNSPEC; 969 af = AF_UNSPEC;
966 break; 970 break;
967 } 971 }
972 if (NULL != rh->leho)
973 add_dns_result (rh,
974 GNUNET_TIME_UNIT_HOURS.rel_value_us,
975 GNUNET_GNSRECORD_TYPE_LEHO,
976 strlen (rh->leho),
977 rh->leho);
968 rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name, 978 rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name,
969 af, 979 af,
970 DNS_LOOKUP_TIMEOUT, 980 DNS_LOOKUP_TIMEOUT,
@@ -979,8 +989,8 @@ dns_result_parser (void *cls,
979 /* convert from (parsed) DNS to (binary) GNS format! */ 989 /* convert from (parsed) DNS to (binary) GNS format! */
980 rd_count = p->num_answers + p->num_authority_records + p->num_additional_records; 990 rd_count = p->num_answers + p->num_authority_records + p->num_additional_records;
981 { 991 {
982 struct GNUNET_GNSRECORD_Data rd[rd_count]; 992 struct GNUNET_GNSRECORD_Data rd[rd_count + 1]; /* +1 for LEHO */
983 unsigned int skip; 993 int skip;
984 char buf[UINT16_MAX]; 994 char buf[UINT16_MAX];
985 size_t buf_off; 995 size_t buf_off;
986 size_t buf_start; 996 size_t buf_start;
@@ -1104,11 +1114,23 @@ dns_result_parser (void *cls,
1104 skip++; 1114 skip++;
1105 continue; 1115 continue;
1106 } 1116 }
1117 } /* end of for all records in answer */
1118 if (NULL != rh->leho)
1119 {
1120 rd[rd_count - skip].record_type = GNUNET_GNSRECORD_TYPE_LEHO;
1121 rd[rd_count - skip].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
1122 rd[rd_count - skip].expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us;
1123 rd[rd_count - skip].data = rh->leho;
1124 rd[rd_count - skip].data_size = strlen (rh->leho);
1125 skip--; /* skip one LESS */
1126 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1127 "Adding LEHO %s\n",
1128 rh->leho);
1107 } 1129 }
1108 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1130 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1109 "Returning DNS response for `%s' with %u answers\n", 1131 "Returning DNS response for `%s' with %u answers\n",
1110 rh->ac_tail->label, 1132 rh->ac_tail->label,
1111 (unsigned int) p->num_answers); 1133 (unsigned int) (rd_count - skip));
1112 rh->proc (rh->proc_cls, 1134 rh->proc (rh->proc_cls,
1113 rd_count - skip, 1135 rd_count - skip,
1114 rd); 1136 rd);
@@ -1177,6 +1199,7 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh)
1177 rh->original_dns_id = p->id; 1199 rh->original_dns_id = p->id;
1178 GNUNET_assert (NULL != ac->authority_info.dns_authority.dns_handle); 1200 GNUNET_assert (NULL != ac->authority_info.dns_authority.dns_handle);
1179 GNUNET_assert (NULL == rh->dns_request); 1201 GNUNET_assert (NULL == rh->dns_request);
1202 rh->leho = GNUNET_strdup (ac->label);
1180 rh->dns_request = GNUNET_DNSSTUB_resolve (ac->authority_info.dns_authority.dns_handle, 1203 rh->dns_request = GNUNET_DNSSTUB_resolve (ac->authority_info.dns_authority.dns_handle,
1181 dns_request, 1204 dns_request,
1182 dns_request_length, 1205 dns_request_length,
@@ -2835,6 +2858,7 @@ GNS_resolver_lookup_cancel (struct GNS_ResolverHandle *rh)
2835 dr); 2858 dr);
2836 GNUNET_free (dr); 2859 GNUNET_free (dr);
2837 } 2860 }
2861 GNUNET_free_non_null (rh->leho);
2838 GNUNET_free (rh->name); 2862 GNUNET_free (rh->name);
2839 GNUNET_free (rh); 2863 GNUNET_free (rh);
2840} 2864}
diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h
index 06ecc51ce..d4cbd08f8 100644
--- a/src/gns/gnunet-service-gns_resolver.h
+++ b/src/gns/gnunet-service-gns_resolver.h
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009-2013 GNUnet e.V. 3 Copyright (C) 2009-2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gns/gnunet-service-gns_resolver.h 19 * @file gns/gnunet-service-gns_resolver.h
diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c
index 4700100b5..094e25ed5 100644
--- a/src/gns/nss/nss_gns_query.c
+++ b/src/gns/nss/nss_gns_query.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012 GNUnet e.V. 3 Copyright (C) 2012 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20#include <string.h> 18#include <string.h>
21#include <stdio.h> 19#include <stdio.h>
diff --git a/src/gns/nss/nss_gns_query.h b/src/gns/nss/nss_gns_query.h
index 024f11e2e..bb04f9004 100644
--- a/src/gns/nss/nss_gns_query.h
+++ b/src/gns/nss/nss_gns_query.h
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012 GNUnet e.V. 3 Copyright (C) 2012 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20#ifndef NSS_GNS_QUERY_H 18#ifndef NSS_GNS_QUERY_H
21#define NSS_GNS_QUERY_H 19#define NSS_GNS_QUERY_H
diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c
index a42fef953..677bb7721 100644
--- a/src/gns/plugin_block_gns.c
+++ b/src/gns/plugin_block_gns.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2010-2013 GNUnet e.V. 3 Copyright (C) 2010-2013 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21/** 19/**
diff --git a/src/gns/plugin_gnsrecord_gns.c b/src/gns/plugin_gnsrecord_gns.c
index b88e8fcc2..c99f39616 100644
--- a/src/gns/plugin_gnsrecord_gns.c
+++ b/src/gns/plugin_gnsrecord_gns.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2013, 2014, 2016 GNUnet e.V. 3 Copyright (C) 2013, 2014, 2016 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21/** 19/**
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index eeb74887e..82d62744c 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012-2015 GNUnet e.V. 3 Copyright (C) 2012-2015 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19 */ 17 */
20/** 18/**
21 * @author Martin Schanzenbach 19 * @author Martin Schanzenbach
diff --git a/src/gns/test_gns_proxy.c b/src/gns/test_gns_proxy.c
index b381f5b4f..4c915cabe 100644
--- a/src/gns/test_gns_proxy.c
+++ b/src/gns/test_gns_proxy.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet 2 This file is part of GNUnet
3 Copyright (C) 2007, 2009, 2011, 2012 Christian Grothoff 3 Copyright (C) 2007, 2009, 2011, 2012 Christian Grothoff
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21/** 19/**
diff --git a/src/gns/w32nsp-install.c b/src/gns/w32nsp-install.c
index a4da577ba..7a8beb703 100644
--- a/src/gns/w32nsp-install.c
+++ b/src/gns/w32nsp-install.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012 GNUnet e.V. 3 Copyright (C) 2012 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gns/w32nsp-install.c 19 * @file gns/w32nsp-install.c
diff --git a/src/gns/w32nsp-resolve.c b/src/gns/w32nsp-resolve.c
index 82f15c6cc..c1178cb23 100644
--- a/src/gns/w32nsp-resolve.c
+++ b/src/gns/w32nsp-resolve.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012 GNUnet e.V. 3 Copyright (C) 2012 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gns/w32nsp-resolve.c 19 * @file gns/w32nsp-resolve.c
diff --git a/src/gns/w32nsp.c b/src/gns/w32nsp.c
index 3e926fcc4..082319ffe 100644
--- a/src/gns/w32nsp.c
+++ b/src/gns/w32nsp.c
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2012 GNUnet e.V. 3 Copyright (C) 2012 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20/** 18/**
21 * @file gns/w32nsp.c 19 * @file gns/w32nsp.c
diff --git a/src/gns/w32resolver.h b/src/gns/w32resolver.h
index cac082b42..8649d82d4 100644
--- a/src/gns/w32resolver.h
+++ b/src/gns/w32resolver.h
@@ -2,20 +2,18 @@
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2009, 2012 GNUnet e.V. 3 Copyright (C) 2009, 2012 GNUnet e.V.
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software: you can redistribute it and/or modify it
6 it under the terms of the GNU General Public License as published 6 under the terms of the GNU Affero General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 by the Free Software Foundation, either version 3 of the License,
8 option) any later version. 8 or (at your option) any later version.
9 9
10 GNUnet is distributed in the hope that it will be useful, but 10 GNUnet is distributed in the hope that it will be useful, but
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 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 General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/ 17*/
20 18
21/** 19/**