[tor-commits] [tor/release-0.4.2] Makefile: Fix "make check-includes" for out-of-tree builds

2019-11-05 Thread teor
commit 10ef7a31cfa896fb8a4eddde92c4b7d1e7477ad6
Author: teor 
Date:   Wed Nov 6 12:29:35 2019 +1000

Makefile: Fix "make check-includes" for out-of-tree builds

Previously, it would run on the build tree, which did not contain
any sources.

Fixes bug 31335; bugfix on 0.3.5.1-alpha.
---
 Makefile.am  | 2 +-
 changes/bug31335 | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 485324fc7..03593df16 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -370,7 +370,7 @@ endif
 
 check-includes:
 if USEPYTHON
-   $(PYTHON) $(top_srcdir)/scripts/maint/practracker/includes.py
+   $(PYTHON) $(top_srcdir)/scripts/maint/practracker/includes.py 
$(top_srcdir)
 endif
 
 check-best-practices:
diff --git a/changes/bug31335 b/changes/bug31335
new file mode 100644
index 0..f633cf8b2
--- /dev/null
+++ b/changes/bug31335
@@ -0,0 +1,3 @@
+  o Minor bugfixes (code quality):
+- Fix "make check-includes" so it runs correctly on out-of-tree builds.
+  Fixes bug 31335; bugfix on 0.3.5.1-alpha.



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.2] Merge branch 'maint-0.4.2' into release-0.4.2

2019-11-05 Thread teor
commit cf56693f1cfd7174f41fc6a546a6c3f83a6e58e4
Merge: 3edd4842e 10ef7a31c
Author: teor 
Date:   Wed Nov 6 17:04:48 2019 +1000

Merge branch 'maint-0.4.2' into release-0.4.2

 Makefile.am  | 2 +-
 changes/bug31335 | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.2] Makefile: Fix "make check-includes" for out-of-tree builds

2019-11-05 Thread teor
commit 10ef7a31cfa896fb8a4eddde92c4b7d1e7477ad6
Author: teor 
Date:   Wed Nov 6 12:29:35 2019 +1000

Makefile: Fix "make check-includes" for out-of-tree builds

Previously, it would run on the build tree, which did not contain
any sources.

Fixes bug 31335; bugfix on 0.3.5.1-alpha.
---
 Makefile.am  | 2 +-
 changes/bug31335 | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 485324fc7..03593df16 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -370,7 +370,7 @@ endif
 
 check-includes:
 if USEPYTHON
-   $(PYTHON) $(top_srcdir)/scripts/maint/practracker/includes.py
+   $(PYTHON) $(top_srcdir)/scripts/maint/practracker/includes.py 
$(top_srcdir)
 endif
 
 check-best-practices:
diff --git a/changes/bug31335 b/changes/bug31335
new file mode 100644
index 0..f633cf8b2
--- /dev/null
+++ b/changes/bug31335
@@ -0,0 +1,3 @@
+  o Minor bugfixes (code quality):
+- Fix "make check-includes" so it runs correctly on out-of-tree builds.
+  Fixes bug 31335; bugfix on 0.3.5.1-alpha.

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] configure: Fix variable name typos

2019-11-05 Thread teor
commit bf5b17d8bbcc55fbae67b5c45077b9dcba697048
Author: teor 
Date:   Wed Nov 6 14:02:22 2019 +1000

configure: Fix variable name typos

The "if-present" clause of AC_ARG_ENABLE() sets enable_{lzma,zstd},
so we don't need to set it. The "if-not-present" clause needs to set
enable_{lzma,zstd}, rather than just {lzma,zstd}.

The rest of the script only ever checks for enable_{lzma,zstd} = no,
so these changes do not actually change the behaviour of configure.

Fixes bug 32401.
---
 configure.ac | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 487361773..e949aca9d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1080,10 +1080,10 @@ dnl Where we do we find lzma?
 AC_ARG_ENABLE(lzma,
   AS_HELP_STRING(--enable-lzma, [enable support for the LZMA compression 
scheme.]),
   [case "${enableval}" in
-"yes") lzma=true ;;
-"no")  lzma=false ;;
+"yes") ;;
+"no")  ;;
 * ) AC_MSG_ERROR(bad value for --enable-lzma) ;;
-  esac], [lzma=auto])
+  esac], [enable_lzma=auto])
 
 if test "x$enable_lzma" = "xno"; then
 have_lzma=no;
@@ -1112,10 +1112,10 @@ dnl Where we do we find zstd?
 AC_ARG_ENABLE(zstd,
   AS_HELP_STRING(--enable-zstd, [enable support for the Zstandard 
compression scheme.]),
   [case "${enableval}" in
-"yes") zstd=true ;;
-"no")  zstd=false ;;
+"yes") ;;
+"no")  ;;
 * ) AC_MSG_ERROR(bad value for --enable-zstd) ;;
-  esac], [zstd=auto])
+  esac], [enable_zstd=auto])
 
 if test "x$enable_zstd" = "xno"; then
 have_zstd=no;



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Merge branch 'maint-0.4.2'

2019-11-05 Thread teor
commit 23ff60c1509b005ad1fca758a8fa0745008ba22d
Merge: bf5b17d8b 10ef7a31c
Author: teor 
Date:   Wed Nov 6 17:04:52 2019 +1000

Merge branch 'maint-0.4.2'

 Makefile.am  | 2 +-
 changes/bug31335 | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/master] Makefile: Fix "make check-includes" for out-of-tree builds

2019-11-05 Thread teor
commit 10ef7a31cfa896fb8a4eddde92c4b7d1e7477ad6
Author: teor 
Date:   Wed Nov 6 12:29:35 2019 +1000

Makefile: Fix "make check-includes" for out-of-tree builds

Previously, it would run on the build tree, which did not contain
any sources.

Fixes bug 31335; bugfix on 0.3.5.1-alpha.
---
 Makefile.am  | 2 +-
 changes/bug31335 | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/Makefile.am b/Makefile.am
index 485324fc7..03593df16 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -370,7 +370,7 @@ endif
 
 check-includes:
 if USEPYTHON
-   $(PYTHON) $(top_srcdir)/scripts/maint/practracker/includes.py
+   $(PYTHON) $(top_srcdir)/scripts/maint/practracker/includes.py 
$(top_srcdir)
 endif
 
 check-best-practices:
diff --git a/changes/bug31335 b/changes/bug31335
new file mode 100644
index 0..f633cf8b2
--- /dev/null
+++ b/changes/bug31335
@@ -0,0 +1,3 @@
+  o Minor bugfixes (code quality):
+- Fix "make check-includes" so it runs correctly on out-of-tree builds.
+  Fixes bug 31335; bugfix on 0.3.5.1-alpha.



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/https_everywhere_completed] https://gitweb.torproject.org/translation.git/commit/?h=https_everywhere_completed

2019-11-05 Thread translation
commit a2fd2586f66f1df7de3ba69ae31fb69e7074
Author: Translation commit bot 
Date:   Wed Nov 6 05:46:03 2019 +


https://gitweb.torproject.org/translation.git/commit/?h=https_everywhere_completed
---
 da/https-everywhere.dtd | 1 +
 1 file changed, 1 insertion(+)

diff --git a/da/https-everywhere.dtd b/da/https-everywhere.dtd
index 0ebba6778..e8814a8c5 100644
--- a/da/https-everywhere.dtd
+++ b/da/https-everywhere.dtd
@@ -45,6 +45,7 @@
 
 
 
+
 
 
 

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/https_everywhere] https://gitweb.torproject.org/translation.git/commit/?h=https_everywhere

2019-11-05 Thread translation
commit 6a9ae936c70450df37b167c632013af91946a52d
Author: Translation commit bot 
Date:   Wed Nov 6 05:45:56 2019 +

https://gitweb.torproject.org/translation.git/commit/?h=https_everywhere
---
 da/https-everywhere.dtd | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/da/https-everywhere.dtd b/da/https-everywhere.dtd
index ef0fd7322..d0b4fc949 100644
--- a/da/https-everywhere.dtd
+++ b/da/https-everywhere.dtd
@@ -45,7 +45,7 @@
 
 
 
-
+
 
 
 

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [translation/support-portal] https://gitweb.torproject.org/translation.git/commit/?h=support-portal

2019-11-05 Thread translation
commit 3026a2b6db202e36e1ece4a4e282fc0a5360887b
Author: Translation commit bot 
Date:   Wed Nov 6 05:23:24 2019 +

https://gitweb.torproject.org/translation.git/commit/?h=support-portal
---
 contents+tr.po | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/contents+tr.po b/contents+tr.po
index 6e2ac9c9d..5d2d55745 100644
--- a/contents+tr.po
+++ b/contents+tr.po
@@ -5838,6 +5838,8 @@ msgstr ""
 #: (content/operators/packaged-tor/contents+en.lrquestion.title)
 msgid "Should I install Tor from my package manager, or build from source?"
 msgstr ""
+"Tor uygulamasını paket yöneticisinden mi yüklemeliyim yoksa kaynak 
kodundan "
+"mı derlemeliyim?"
 
 #: https//support.torproject.org/operators/packaged-tor/
 #: (content/operators/packaged-tor/contents+en.lrquestion.description)
@@ -5846,6 +5848,9 @@ msgid ""
 "to installing Tor from the [Tor Project's "
 "repository](https://support.torproject.org/apt/tor-deb-repo/)."
 msgstr ""
+"Özellikle Debian ya da Ubuntu kullanıyorsanız, Tor uygulamasını [Tor 
Projesi"
+" deposu](https://support.torproject.org/apt/tor-deb-repo/) üzerinden "
+"yüklemenizin bir kaç yararı vardır."
 
 #: https//support.torproject.org/operators/packaged-tor/
 #: (content/operators/packaged-tor/contents+en.lrquestion.description)
@@ -5853,6 +5858,8 @@ msgid ""
 "* Your `ulimit -n` gets set to 32768  high enough for Tor to keep open all "
 "the connections it needs."
 msgstr ""
+"* `ulimit -n` değeri 32768 olarak ayarlanır. Bu değer Tor tarafından 
gerek "
+"duyulan tüm bağlantıların açık tutulması için yeterince yüksektir."
 
 #: https//support.torproject.org/operators/packaged-tor/
 #: (content/operators/packaged-tor/contents+en.lrquestion.description)
@@ -5860,11 +5867,15 @@ msgid ""
 "* A user profile is created just for Tor, so Tor doesn't need to run as "
 "root."
 msgstr ""
+"* Yalnız Tor için özel bir kullanıcı profili oluşturulur. Böylece Tor "
+"uygulamasının root olarak çalışması gerekmez."
 
 #: https//support.torproject.org/operators/packaged-tor/
 #: (content/operators/packaged-tor/contents+en.lrquestion.description)
 msgid "* An init script is included so that Tor runs at boot."
 msgstr ""
+"* Bir başlatma betiği eklenir. Böylece Tor bilgisayar başlatılırken "
+"çalışabilir."
 
 #: https//support.torproject.org/operators/packaged-tor/
 #: (content/operators/packaged-tor/contents+en.lrquestion.description)
@@ -5872,11 +5883,14 @@ msgid ""
 "* Tor runs with `--verify-config`, so that most problems with your config "
 "file get caught."
 msgstr ""
+"* Tor `--verify-config` seçeneği ile çalışır. Böylece yapılandırma "
+"dosyasında olabilecek pek çok sorun yakalanabilir."
 
 #: https//support.torproject.org/operators/packaged-tor/
 #: (content/operators/packaged-tor/contents+en.lrquestion.description)
 msgid "* Tor can bind to low level ports, then drop privileges."
 msgstr ""
+"* Tor alt düzey kapı numaralarına bağlanabilir ve izinleri kaldırabilir."
 
 #: https//support.torproject.org/operators/relay-flexible/
 #: (content/operators/relay-flexible/contents+en.lrquestion.title)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.2] Merge branch 'maint-0.2.9' into maint-0.3.5

2019-11-05 Thread teor
commit 1bde356bf645f3c3d3b0a6e70c03e2baf9f89d26
Merge: 4abfcb799 0650bf369
Author: teor 
Date:   Wed Nov 6 11:19:30 2019 +1000

Merge branch 'maint-0.2.9' into maint-0.3.5

 changes/bug31107 |  4 
 src/core/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --cc src/core/or/channeltls.c
index 91a424728,0..4db283d20
mode 100644,00..100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@@ -1,2477 -1,0 +1,2485 @@@
 +/* * Copyright (c) 2012-2019, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file channeltls.c
 + *
 + * \brief A concrete subclass of channel_t using or_connection_t to transfer
 + * cells between Tor instances.
 + *
 + * This module fills in the various function pointers in channel_t, to
 + * implement the channel_tls_t channels as used in Tor today.  These channels
 + * are created from channel_tls_connect() and
 + * channel_tls_handle_incoming(). Each corresponds 1:1 to or_connection_t
 + * object, as implemented in connection_or.c.  These channels transmit cells
 + * to the underlying or_connection_t by calling
 + * connection_or_write_*_cell_to_buf(), and receive cells from the underlying
 + * or_connection_t when connection_or_process_cells_from_inbuf() calls
 + * channel_tls_handle_*_cell().
 + *
 + * Here we also implement the server (responder) side of the v3+ Tor link
 + * handshake, which uses CERTS and AUTHENTICATE cell to negotiate versions,
 + * exchange expected and observed IP and time information, and bootstrap a
 + * level of authentication higher than we have gotten on the raw TLS
 + * handshake.
 + *
 + * NOTE: Since there is currently only one type of channel, there are probably
 + * more than a few cases where functionality that is currently in
 + * channeltls.c, connection_or.c, and channel.c ought to be divided up
 + * differently.  The right time to do this is probably whenever we introduce
 + * our next channel type.
 + **/
 +
 +/*
 + * Define this so channel.h gives us things only channel_t subclasses
 + * should touch.
 + */
 +#define TOR_CHANNEL_INTERNAL_
 +
 +#define CHANNELTLS_PRIVATE
 +
 +#include "core/or/or.h"
 +#include "core/or/channel.h"
 +#include "core/or/channeltls.h"
 +#include "core/or/circuitmux.h"
 +#include "core/or/circuitmux_ewma.h"
 +#include "core/or/command.h"
 +#include "app/config/config.h"
 +#include "core/mainloop/connection.h"
 +#include "core/or/connection_or.h"
 +#include "feature/control/control.h"
 +#include "feature/client/entrynodes.h"
 +#include "trunnel/link_handshake.h"
 +#include "core/or/relay.h"
 +#include "feature/stats/rephist.h"
 +#include "feature/relay/router.h"
 +#include "feature/relay/routermode.h"
 +#include "feature/nodelist/dirlist.h"
 +#include "core/or/scheduler.h"
 +#include "feature/nodelist/torcert.h"
 +#include "feature/nodelist/networkstatus.h"
 +#include "trunnel/channelpadding_negotiation.h"
 +#include "core/or/channelpadding.h"
 +
 +#include "core/or/cell_st.h"
 +#include "core/or/cell_queue_st.h"
 +#include "core/or/extend_info_st.h"
 +#include "core/or/or_connection_st.h"
 +#include "core/or/or_handshake_certs_st.h"
 +#include "core/or/or_handshake_state_st.h"
 +#include "feature/nodelist/routerinfo_st.h"
 +#include "core/or/var_cell_st.h"
 +
 +#include "lib/tls/tortls.h"
 +#include "lib/tls/x509.h"
 +
 +/** How many CELL_PADDING cells have we received, ever? */
 +uint64_t stats_n_padding_cells_processed = 0;
 +/** How many CELL_VERSIONS cells have we received, ever? */
 +uint64_t stats_n_versions_cells_processed = 0;
 +/** How many CELL_NETINFO cells have we received, ever? */
 +uint64_t stats_n_netinfo_cells_processed = 0;
 +/** How many CELL_VPADDING cells have we received, ever? */
 +uint64_t stats_n_vpadding_cells_processed = 0;
 +/** How many CELL_CERTS cells have we received, ever? */
 +uint64_t stats_n_certs_cells_processed = 0;
 +/** How many CELL_AUTH_CHALLENGE cells have we received, ever? */
 +uint64_t stats_n_auth_challenge_cells_processed = 0;
 +/** How many CELL_AUTHENTICATE cells have we received, ever? */
 +uint64_t stats_n_authenticate_cells_processed = 0;
 +/** How many CELL_AUTHORIZE cells have we received, ever? */
 +uint64_t stats_n_authorize_cells_processed = 0;
 +
 +/** Active listener, if any */
 +static channel_listener_t *channel_tls_listener = NULL;
 +
 +/* channel_tls_t method declarations */
 +
 +static void channel_tls_close_method(channel_t *chan);
 +static const char * channel_tls_describe_transport_method(channel_t *chan);
 +static void channel_tls_free_method(channel_t *chan);
 +static double channel_tls_get_overhead_estimate_method(channel_t *chan);
 +static int
 +channel_tls_get_remote_addr_method(channel_t *chan, tor_addr_t *addr_out);
 +static int
 +channel_tls_get_transport_name_method(channel_t *chan, char **transport_out);
 +static const char *
 +channel_tls_get_remote_descr_method(channel_t *chan, int flags);
 +static int 

[tor-commits] [tor/release-0.4.2] Merge remote-tracking branch 'tor-github/pr/1342' into maint-0.2.9

2019-11-05 Thread teor
commit 0650bf3695ae2e118426f3f6ecf1f8a344562119
Merge: c06d540ff f0e412099
Author: teor 
Date:   Wed Nov 6 11:15:45 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1342' into maint-0.2.9

 changes/ticket31466  | 5 +
 src/or/connection_edge.c | 8 +---
 2 files changed, 10 insertions(+), 3 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.2] Merge branch 'maint-0.3.5' into maint-0.4.0

2019-11-05 Thread teor
commit 03e77ef036e41486b8bfe138d11790c928f49f35
Merge: 54e2d0dc2 1bde356bf
Author: teor 
Date:   Wed Nov 6 11:19:38 2019 +1000

Merge branch 'maint-0.3.5' into maint-0.4.0

 changes/bug30916  |  4 +++
 changes/bug31107  |  4 +++
 changes/bug31408  |  5 
 changes/bug31837  |  5 
 changes/ticket31466   |  5 
 src/core/or/channeltls.c  | 10 ++-
 src/core/or/connection_edge.c |  6 ++--
 src/feature/relay/router.c| 18 +---
 src/lib/fs/conffile.c | 10 ---
 src/test/test_config.c| 68 +++
 src/test/test_rebind.py   | 16 +-
 11 files changed, 127 insertions(+), 24 deletions(-)




___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.2] Merge remote-tracking branch 'tor-github/pr/1374' into maint-0.4.1

2019-11-05 Thread teor
commit 4f9a0033920b21882c4b6eead3c1826ee8e9
Merge: 63aff4a43 9b73088c1
Author: teor 
Date:   Wed Nov 6 11:19:13 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1374' into maint-0.4.1

 changes/bug31897 | 3 +++
 src/test/test_util.c | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.2] Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

2019-11-05 Thread teor
commit 6bfdd096792194d1077a101a34859bff996c940e
Merge: 15d67842f bf4a27c0e
Author: teor 
Date:   Wed Nov 6 11:16:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

 changes/ticket31466   | 5 +
 src/core/or/connection_edge.c | 6 --
 2 files changed, 9 insertions(+), 2 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.2] Merge branch 'maint-0.4.2' into release-0.4.2

2019-11-05 Thread teor
commit 3edd4842e38e925677bbd8911f0bdd0f9ab41bb0
Merge: dbae58d58 76fd872db
Author: teor 
Date:   Wed Nov 6 11:19:58 2019 +1000

Merge branch 'maint-0.4.2' into release-0.4.2

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.2] Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5

2019-11-05 Thread teor
commit d2e4262ebc134f4c6ae9e702a14da45489575b4f
Merge: 6bfdd0967 2da4d64a6
Author: teor 
Date:   Wed Nov 6 11:17:01 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5

 changes/bug30916   |  4 
 src/feature/relay/router.c | 18 --
 2 files changed, 12 insertions(+), 10 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.2] Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

2019-11-05 Thread teor
commit 0e2834a3718a3932cfe8d3148d203a0604451073
Merge: d2e4262eb 0614f8390
Author: teor 
Date:   Wed Nov 6 11:17:43 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

 changes/bug31408   |  5 
 src/lib/fs/conffile.c  | 10 +---
 src/test/test_config.c | 68 ++
 3 files changed, 79 insertions(+), 4 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.2] Merge branch 'maint-0.4.1' into maint-0.4.2

2019-11-05 Thread teor
commit 76fd872db88782c6bce1b539e27ba1d1ab88cbdb
Merge: 2395800d3 de6ceb0be
Author: teor 
Date:   Wed Nov 6 11:19:54 2019 +1000

Merge branch 'maint-0.4.1' into maint-0.4.2




___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] Merge branch 'maint-0.4.0' into maint-0.4.1

2019-11-05 Thread teor
commit de6ceb0bee8c1bf56d8929940a109bdc2a2d7521
Merge: 4f9a00339 03e77ef03
Author: teor 
Date:   Wed Nov 6 11:19:46 2019 +1000

Merge branch 'maint-0.4.0' into maint-0.4.1

 changes/bug31408|  5 
 changes/bug31837|  5 
 src/lib/fs/conffile.c   | 10 +---
 src/test/test_config.c  | 68 +
 src/test/test_rebind.py | 16 +++-
 5 files changed, 93 insertions(+), 11 deletions(-)




___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] Merge remote-tracking branch 'tor-github/pr/1342' into maint-0.2.9

2019-11-05 Thread teor
commit 0650bf3695ae2e118426f3f6ecf1f8a344562119
Merge: c06d540ff f0e412099
Author: teor 
Date:   Wed Nov 6 11:15:45 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1342' into maint-0.2.9

 changes/ticket31466  | 5 +
 src/or/connection_edge.c | 8 +---
 2 files changed, 10 insertions(+), 3 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5

2019-11-05 Thread teor
commit d2e4262ebc134f4c6ae9e702a14da45489575b4f
Merge: 6bfdd0967 2da4d64a6
Author: teor 
Date:   Wed Nov 6 11:17:01 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5

 changes/bug30916   |  4 
 src/feature/relay/router.c | 18 --
 2 files changed, 12 insertions(+), 10 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.2] Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

2019-11-05 Thread teor
commit c06d540ff9b507e0fa9749948fe406fb17dbee73
Merge: 752c35ca9 3c97ab3c2
Author: teor 
Date:   Wed Nov 6 11:14:53 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

 changes/bug31107|  4 
 src/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] Merge branch 'maint-0.2.9' into maint-0.3.5

2019-11-05 Thread teor
commit 1bde356bf645f3c3d3b0a6e70c03e2baf9f89d26
Merge: 4abfcb799 0650bf369
Author: teor 
Date:   Wed Nov 6 11:19:30 2019 +1000

Merge branch 'maint-0.2.9' into maint-0.3.5

 changes/bug31107 |  4 
 src/core/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --cc src/core/or/channeltls.c
index 91a424728,0..4db283d20
mode 100644,00..100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@@ -1,2477 -1,0 +1,2485 @@@
 +/* * Copyright (c) 2012-2019, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file channeltls.c
 + *
 + * \brief A concrete subclass of channel_t using or_connection_t to transfer
 + * cells between Tor instances.
 + *
 + * This module fills in the various function pointers in channel_t, to
 + * implement the channel_tls_t channels as used in Tor today.  These channels
 + * are created from channel_tls_connect() and
 + * channel_tls_handle_incoming(). Each corresponds 1:1 to or_connection_t
 + * object, as implemented in connection_or.c.  These channels transmit cells
 + * to the underlying or_connection_t by calling
 + * connection_or_write_*_cell_to_buf(), and receive cells from the underlying
 + * or_connection_t when connection_or_process_cells_from_inbuf() calls
 + * channel_tls_handle_*_cell().
 + *
 + * Here we also implement the server (responder) side of the v3+ Tor link
 + * handshake, which uses CERTS and AUTHENTICATE cell to negotiate versions,
 + * exchange expected and observed IP and time information, and bootstrap a
 + * level of authentication higher than we have gotten on the raw TLS
 + * handshake.
 + *
 + * NOTE: Since there is currently only one type of channel, there are probably
 + * more than a few cases where functionality that is currently in
 + * channeltls.c, connection_or.c, and channel.c ought to be divided up
 + * differently.  The right time to do this is probably whenever we introduce
 + * our next channel type.
 + **/
 +
 +/*
 + * Define this so channel.h gives us things only channel_t subclasses
 + * should touch.
 + */
 +#define TOR_CHANNEL_INTERNAL_
 +
 +#define CHANNELTLS_PRIVATE
 +
 +#include "core/or/or.h"
 +#include "core/or/channel.h"
 +#include "core/or/channeltls.h"
 +#include "core/or/circuitmux.h"
 +#include "core/or/circuitmux_ewma.h"
 +#include "core/or/command.h"
 +#include "app/config/config.h"
 +#include "core/mainloop/connection.h"
 +#include "core/or/connection_or.h"
 +#include "feature/control/control.h"
 +#include "feature/client/entrynodes.h"
 +#include "trunnel/link_handshake.h"
 +#include "core/or/relay.h"
 +#include "feature/stats/rephist.h"
 +#include "feature/relay/router.h"
 +#include "feature/relay/routermode.h"
 +#include "feature/nodelist/dirlist.h"
 +#include "core/or/scheduler.h"
 +#include "feature/nodelist/torcert.h"
 +#include "feature/nodelist/networkstatus.h"
 +#include "trunnel/channelpadding_negotiation.h"
 +#include "core/or/channelpadding.h"
 +
 +#include "core/or/cell_st.h"
 +#include "core/or/cell_queue_st.h"
 +#include "core/or/extend_info_st.h"
 +#include "core/or/or_connection_st.h"
 +#include "core/or/or_handshake_certs_st.h"
 +#include "core/or/or_handshake_state_st.h"
 +#include "feature/nodelist/routerinfo_st.h"
 +#include "core/or/var_cell_st.h"
 +
 +#include "lib/tls/tortls.h"
 +#include "lib/tls/x509.h"
 +
 +/** How many CELL_PADDING cells have we received, ever? */
 +uint64_t stats_n_padding_cells_processed = 0;
 +/** How many CELL_VERSIONS cells have we received, ever? */
 +uint64_t stats_n_versions_cells_processed = 0;
 +/** How many CELL_NETINFO cells have we received, ever? */
 +uint64_t stats_n_netinfo_cells_processed = 0;
 +/** How many CELL_VPADDING cells have we received, ever? */
 +uint64_t stats_n_vpadding_cells_processed = 0;
 +/** How many CELL_CERTS cells have we received, ever? */
 +uint64_t stats_n_certs_cells_processed = 0;
 +/** How many CELL_AUTH_CHALLENGE cells have we received, ever? */
 +uint64_t stats_n_auth_challenge_cells_processed = 0;
 +/** How many CELL_AUTHENTICATE cells have we received, ever? */
 +uint64_t stats_n_authenticate_cells_processed = 0;
 +/** How many CELL_AUTHORIZE cells have we received, ever? */
 +uint64_t stats_n_authorize_cells_processed = 0;
 +
 +/** Active listener, if any */
 +static channel_listener_t *channel_tls_listener = NULL;
 +
 +/* channel_tls_t method declarations */
 +
 +static void channel_tls_close_method(channel_t *chan);
 +static const char * channel_tls_describe_transport_method(channel_t *chan);
 +static void channel_tls_free_method(channel_t *chan);
 +static double channel_tls_get_overhead_estimate_method(channel_t *chan);
 +static int
 +channel_tls_get_remote_addr_method(channel_t *chan, tor_addr_t *addr_out);
 +static int
 +channel_tls_get_transport_name_method(channel_t *chan, char **transport_out);
 +static const char *
 +channel_tls_get_remote_descr_method(channel_t *chan, int flags);
 +static int 

[tor-commits] [tor/release-0.4.1] Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

2019-11-05 Thread teor
commit 4abfcb7997e4a753643fd969317c502efc6be06e
Merge: 0e2834a37 cf2b00d3f
Author: teor 
Date:   Wed Nov 6 11:18:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

 changes/bug31837|  5 +
 src/test/test_rebind.py | 16 +---
 2 files changed, 14 insertions(+), 7 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] test/rebind: Make control formatting and log parsing more robust

2019-11-05 Thread teor
commit cf2b00d3f50f3421c3c22777113e25d5f7812e67
Author: teor 
Date:   Tue Aug 6 01:33:14 2019 +1000

test/rebind: Make control formatting and log parsing more robust

* actually sleep when tor has not logged anything
* log at debug level when waiting for tor to log something
* backslash-replace bad UTF-8 characters in logs
* format control messages as ASCII: tor does not accept UTF-8 control 
commands

Fixes bug 31837; bugfix on 0.3.5.1-alpha.
---
 changes/bug31837|  5 +
 src/test/test_rebind.py | 16 +---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/changes/bug31837 b/changes/bug31837
new file mode 100644
index 0..0f976edfe
--- /dev/null
+++ b/changes/bug31837
@@ -0,0 +1,5 @@
+  o Minor bugfixes (testing):
+- When testing port rebinding, don't busy-wait for tor to log. Instead,
+  actually sleep for a short time before polling again. Also improve the
+  formatting of control commands and log messages.
+  Fixes bug 31837; bugfix on 0.3.5.1-alpha.
diff --git a/src/test/test_rebind.py b/src/test/test_rebind.py
index 45ad1c546..30a587858 100644
--- a/src/test/test_rebind.py
+++ b/src/test/test_rebind.py
@@ -31,15 +31,17 @@ def wait_for_log(s):
 cutoff = time.time() + LOG_TIMEOUT
 while time.time() < cutoff:
 l = tor_process.stdout.readline()
-l = l.decode('utf8')
+l = l.decode('utf8', 'backslashreplace')
 if s in l:
 logging.info('Tor logged: "{}"'.format(l.strip()))
 return
-logging.info('Tor logged: "{}", waiting for "{}"'.format(l.strip(), s))
 # readline() returns a blank string when there is no output
 # avoid busy-waiting
-if len(s) == 0:
+if len(l) == 0:
+logging.debug('Tor has not logged anything, waiting for 
"{}"'.format(s))
 time.sleep(LOG_WAIT)
+else:
+logging.info('Tor logged: "{}", waiting for 
"{}"'.format(l.strip(), s))
 fail('Could not find "{}" in logs after {} seconds'.format(s, LOG_TIMEOUT))
 
 def pick_random_port():
@@ -119,18 +121,18 @@ if control_socket.connect_ex(('127.0.0.1', control_port)):
 tor_process.terminate()
 fail('Cannot connect to ControlPort')
 
-control_socket.sendall('AUTHENTICATE \r\n'.encode('utf8'))
-control_socket.sendall('SETCONF 
SOCKSPort=0.0.0.0:{}\r\n'.format(socks_port).encode('utf8'))
+control_socket.sendall('AUTHENTICATE \r\n'.encode('ascii'))
+control_socket.sendall('SETCONF 
SOCKSPort=0.0.0.0:{}\r\n'.format(socks_port).encode('ascii'))
 wait_for_log('Opened Socks listener')
 
 try_connecting_to_socksport()
 
-control_socket.sendall('SETCONF 
SOCKSPort=127.0.0.1:{}\r\n'.format(socks_port).encode('utf8'))
+control_socket.sendall('SETCONF 
SOCKSPort=127.0.0.1:{}\r\n'.format(socks_port).encode('ascii'))
 wait_for_log('Opened Socks listener')
 
 try_connecting_to_socksport()
 
-control_socket.sendall('SIGNAL HALT\r\n'.encode('utf8'))
+control_socket.sendall('SIGNAL HALT\r\n'.encode('ascii'))
 
 wait_for_log('exiting cleanly')
 logging.info('OK')



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.2] Merge branch 'maint-0.4.0' into maint-0.4.1

2019-11-05 Thread teor
commit de6ceb0bee8c1bf56d8929940a109bdc2a2d7521
Merge: 4f9a00339 03e77ef03
Author: teor 
Date:   Wed Nov 6 11:19:46 2019 +1000

Merge branch 'maint-0.4.0' into maint-0.4.1

 changes/bug31408|  5 
 changes/bug31837|  5 
 src/lib/fs/conffile.c   | 10 +---
 src/test/test_config.c  | 68 +
 src/test/test_rebind.py | 16 +++-
 5 files changed, 93 insertions(+), 11 deletions(-)




___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.2] Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

2019-11-05 Thread teor
commit 4abfcb7997e4a753643fd969317c502efc6be06e
Merge: 0e2834a37 cf2b00d3f
Author: teor 
Date:   Wed Nov 6 11:18:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

 changes/bug31837|  5 +
 src/test/test_rebind.py | 16 +---
 2 files changed, 14 insertions(+), 7 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

2019-11-05 Thread teor
commit c06d540ff9b507e0fa9749948fe406fb17dbee73
Merge: 752c35ca9 3c97ab3c2
Author: teor 
Date:   Wed Nov 6 11:14:53 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

 changes/bug31107|  4 
 src/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] Merge branch 'maint-0.3.5' into maint-0.4.0

2019-11-05 Thread teor
commit 03e77ef036e41486b8bfe138d11790c928f49f35
Merge: 54e2d0dc2 1bde356bf
Author: teor 
Date:   Wed Nov 6 11:19:38 2019 +1000

Merge branch 'maint-0.3.5' into maint-0.4.0

 changes/bug30916  |  4 +++
 changes/bug31107  |  4 +++
 changes/bug31408  |  5 
 changes/bug31837  |  5 
 changes/ticket31466   |  5 
 src/core/or/channeltls.c  | 10 ++-
 src/core/or/connection_edge.c |  6 ++--
 src/feature/relay/router.c| 18 +---
 src/lib/fs/conffile.c | 10 ---
 src/test/test_config.c| 68 +++
 src/test/test_rebind.py   | 16 +-
 11 files changed, 127 insertions(+), 24 deletions(-)




___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] changes: use correct bugfix release, and reword changes file for 31408

2019-11-05 Thread teor
commit 0614f839054a52e6e1a79a366fcc70da0691df66
Author: teor 
Date:   Mon Sep 23 11:11:50 2019 +1000

changes: use correct bugfix release, and reword changes file for 31408
---
 changes/bug31408 | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/changes/bug31408 b/changes/bug31408
index 7a6744cee..3e4ffa927 100644
--- a/changes/bug31408
+++ b/changes/bug31408
@@ -1,4 +1,5 @@
   o Major bugfixes (torrc):
-- Fix configuration files in a %included folder containing a 
-  configuration file with only comments or whitespace being
-  ignored. Fixes bug 31408; bugfix on 0.4.0.5.
+- Stop ignoring torrc options after an %include directive, when the
+  included directory ends with a file that does not contain any config
+  options. (But does contain comments or whitespace.)
+  Fixes bug 31408; bugfix on 0.3.1.1-alpha.



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] changes: use correct bugfix release, and reword changes file for 31408

2019-11-05 Thread teor
commit 0614f839054a52e6e1a79a366fcc70da0691df66
Author: teor 
Date:   Mon Sep 23 11:11:50 2019 +1000

changes: use correct bugfix release, and reword changes file for 31408
---
 changes/bug31408 | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/changes/bug31408 b/changes/bug31408
index 7a6744cee..3e4ffa927 100644
--- a/changes/bug31408
+++ b/changes/bug31408
@@ -1,4 +1,5 @@
   o Major bugfixes (torrc):
-- Fix configuration files in a %included folder containing a 
-  configuration file with only comments or whitespace being
-  ignored. Fixes bug 31408; bugfix on 0.4.0.5.
+- Stop ignoring torrc options after an %include directive, when the
+  included directory ends with a file that does not contain any config
+  options. (But does contain comments or whitespace.)
+  Fixes bug 31408; bugfix on 0.3.1.1-alpha.



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] util/map_anon_nofork: Add a cast to avoid passing -48 to memset

2019-11-05 Thread teor
commit 9b73088c14fe24a1554950363fb80468c695937f
Author: Nick Mathewson 
Date:   Thu Oct 3 07:21:25 2019 -0400

util/map_anon_nofork: Add a cast to avoid passing -48 to memset

This fixes coverity CID 1454593, and bug 31948. Bug not in any
released version of Tor.
---
 src/test/test_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index 6ecff6f1c..b4d8a4d76 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -6190,7 +6190,7 @@ test_util_map_anon_nofork(void *arg)
   tor_munmap_anonymous(ptr, sz);
   ptr = tor_mmap_anonymous(sz, ANONMAP_NOINHERIT, );
   tt_ptr_op(ptr, OP_NE, 0);
-  memset(ptr, TEST_VALUE, sz);
+  memset(ptr, (uint8_t)TEST_VALUE, sz);
 
   tt_int_op(0, OP_EQ, pipe(pipefd));
   pid_t child = fork();



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] Merge branch 'maint-0.2.9' into maint-0.3.5

2019-11-05 Thread teor
commit 1bde356bf645f3c3d3b0a6e70c03e2baf9f89d26
Merge: 4abfcb799 0650bf369
Author: teor 
Date:   Wed Nov 6 11:19:30 2019 +1000

Merge branch 'maint-0.2.9' into maint-0.3.5

 changes/bug31107 |  4 
 src/core/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --cc src/core/or/channeltls.c
index 91a424728,0..4db283d20
mode 100644,00..100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@@ -1,2477 -1,0 +1,2485 @@@
 +/* * Copyright (c) 2012-2019, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file channeltls.c
 + *
 + * \brief A concrete subclass of channel_t using or_connection_t to transfer
 + * cells between Tor instances.
 + *
 + * This module fills in the various function pointers in channel_t, to
 + * implement the channel_tls_t channels as used in Tor today.  These channels
 + * are created from channel_tls_connect() and
 + * channel_tls_handle_incoming(). Each corresponds 1:1 to or_connection_t
 + * object, as implemented in connection_or.c.  These channels transmit cells
 + * to the underlying or_connection_t by calling
 + * connection_or_write_*_cell_to_buf(), and receive cells from the underlying
 + * or_connection_t when connection_or_process_cells_from_inbuf() calls
 + * channel_tls_handle_*_cell().
 + *
 + * Here we also implement the server (responder) side of the v3+ Tor link
 + * handshake, which uses CERTS and AUTHENTICATE cell to negotiate versions,
 + * exchange expected and observed IP and time information, and bootstrap a
 + * level of authentication higher than we have gotten on the raw TLS
 + * handshake.
 + *
 + * NOTE: Since there is currently only one type of channel, there are probably
 + * more than a few cases where functionality that is currently in
 + * channeltls.c, connection_or.c, and channel.c ought to be divided up
 + * differently.  The right time to do this is probably whenever we introduce
 + * our next channel type.
 + **/
 +
 +/*
 + * Define this so channel.h gives us things only channel_t subclasses
 + * should touch.
 + */
 +#define TOR_CHANNEL_INTERNAL_
 +
 +#define CHANNELTLS_PRIVATE
 +
 +#include "core/or/or.h"
 +#include "core/or/channel.h"
 +#include "core/or/channeltls.h"
 +#include "core/or/circuitmux.h"
 +#include "core/or/circuitmux_ewma.h"
 +#include "core/or/command.h"
 +#include "app/config/config.h"
 +#include "core/mainloop/connection.h"
 +#include "core/or/connection_or.h"
 +#include "feature/control/control.h"
 +#include "feature/client/entrynodes.h"
 +#include "trunnel/link_handshake.h"
 +#include "core/or/relay.h"
 +#include "feature/stats/rephist.h"
 +#include "feature/relay/router.h"
 +#include "feature/relay/routermode.h"
 +#include "feature/nodelist/dirlist.h"
 +#include "core/or/scheduler.h"
 +#include "feature/nodelist/torcert.h"
 +#include "feature/nodelist/networkstatus.h"
 +#include "trunnel/channelpadding_negotiation.h"
 +#include "core/or/channelpadding.h"
 +
 +#include "core/or/cell_st.h"
 +#include "core/or/cell_queue_st.h"
 +#include "core/or/extend_info_st.h"
 +#include "core/or/or_connection_st.h"
 +#include "core/or/or_handshake_certs_st.h"
 +#include "core/or/or_handshake_state_st.h"
 +#include "feature/nodelist/routerinfo_st.h"
 +#include "core/or/var_cell_st.h"
 +
 +#include "lib/tls/tortls.h"
 +#include "lib/tls/x509.h"
 +
 +/** How many CELL_PADDING cells have we received, ever? */
 +uint64_t stats_n_padding_cells_processed = 0;
 +/** How many CELL_VERSIONS cells have we received, ever? */
 +uint64_t stats_n_versions_cells_processed = 0;
 +/** How many CELL_NETINFO cells have we received, ever? */
 +uint64_t stats_n_netinfo_cells_processed = 0;
 +/** How many CELL_VPADDING cells have we received, ever? */
 +uint64_t stats_n_vpadding_cells_processed = 0;
 +/** How many CELL_CERTS cells have we received, ever? */
 +uint64_t stats_n_certs_cells_processed = 0;
 +/** How many CELL_AUTH_CHALLENGE cells have we received, ever? */
 +uint64_t stats_n_auth_challenge_cells_processed = 0;
 +/** How many CELL_AUTHENTICATE cells have we received, ever? */
 +uint64_t stats_n_authenticate_cells_processed = 0;
 +/** How many CELL_AUTHORIZE cells have we received, ever? */
 +uint64_t stats_n_authorize_cells_processed = 0;
 +
 +/** Active listener, if any */
 +static channel_listener_t *channel_tls_listener = NULL;
 +
 +/* channel_tls_t method declarations */
 +
 +static void channel_tls_close_method(channel_t *chan);
 +static const char * channel_tls_describe_transport_method(channel_t *chan);
 +static void channel_tls_free_method(channel_t *chan);
 +static double channel_tls_get_overhead_estimate_method(channel_t *chan);
 +static int
 +channel_tls_get_remote_addr_method(channel_t *chan, tor_addr_t *addr_out);
 +static int
 +channel_tls_get_transport_name_method(channel_t *chan, char **transport_out);
 +static const char *
 +channel_tls_get_remote_descr_method(channel_t *chan, int flags);
 +static int 

[tor-commits] [tor/release-0.4.0] Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

2019-11-05 Thread teor
commit 6bfdd096792194d1077a101a34859bff996c940e
Merge: 15d67842f bf4a27c0e
Author: teor 
Date:   Wed Nov 6 11:16:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

 changes/ticket31466   | 5 +
 src/core/or/connection_edge.c | 6 --
 2 files changed, 9 insertions(+), 2 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] Fix bug when %including folder with comment only files. #31408

2019-11-05 Thread teor
commit 15490816da0f8b651d67acef9c7f4e5bf9652ce2
Author: Daniel Pinto 
Date:   Sun Sep 22 22:30:48 2019 +0100

Fix bug when %including folder with comment only files. #31408

When processing a %included folder, a bug caused the pointer to
the last element of the options list to be set to NULL when
processing a file with only comments or whitepace. This could
cause options from other files on the same folder to be
discarded depending on the lines after the affected %include.
---
 changes/bug31408   |  4 +++
 src/lib/fs/conffile.c  | 10 +---
 src/test/test_config.c | 68 ++
 3 files changed, 78 insertions(+), 4 deletions(-)

diff --git a/changes/bug31408 b/changes/bug31408
new file mode 100644
index 0..7a6744cee
--- /dev/null
+++ b/changes/bug31408
@@ -0,0 +1,4 @@
+  o Major bugfixes (torrc):
+- Fix configuration files in a %included folder containing a 
+  configuration file with only comments or whitespace being
+  ignored. Fixes bug 31408; bugfix on 0.4.0.5.
diff --git a/src/lib/fs/conffile.c b/src/lib/fs/conffile.c
index 7bb2f2393..0d5d56b33 100644
--- a/src/lib/fs/conffile.c
+++ b/src/lib/fs/conffile.c
@@ -153,16 +153,18 @@ config_process_include(const char *path, int 
recursion_level, int extended,
   int rv = -1;
   SMARTLIST_FOREACH_BEGIN(config_files, const char *, config_file) {
 config_line_t *included_config = NULL;
+config_line_t *included_config_last = NULL;
 if (config_get_included_config(config_file, recursion_level, extended,
-   _config, list_last,
+   _config, _config_last,
opened_lst) < 0) {
   goto done;
 }
 
 *next = included_config;
-if (*list_last)
-  next = &(*list_last)->next;
-
+if (included_config_last) {
+  next = _config_last->next;
+  *list_last = included_config_last;
+}
   } SMARTLIST_FOREACH_END(config_file);
   *list = ret_list;
   rv = 0;
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 0de6b1291..8f011ce1f 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -5287,6 +5287,73 @@ test_config_include_folder_order(void *data)
 }
 
 static void
+test_config_include_blank_file_last(void *data)
+{
+  (void)data;
+
+  config_line_t *result = NULL;
+  char *torrcd = NULL;
+  char *path = NULL;
+  char *dir = tor_strdup(get_fname("test_include_blank_file_last"));
+  tt_ptr_op(dir, OP_NE, NULL);
+
+#ifdef _WIN32
+  tt_int_op(mkdir(dir), OP_EQ, 0);
+#else
+  tt_int_op(mkdir(dir, 0700), OP_EQ, 0);
+#endif
+
+  tor_asprintf(, "%s"PATH_SEPARATOR"%s", dir, "torrc.d");
+
+#ifdef _WIN32
+  tt_int_op(mkdir(torrcd), OP_EQ, 0);
+#else
+  tt_int_op(mkdir(torrcd, 0700), OP_EQ, 0);
+#endif
+
+  tor_asprintf(, "%s"PATH_SEPARATOR"%s", torrcd, "aa_1st");
+  tt_int_op(write_str_to_file(path, "Test 1\n", 0), OP_EQ, 0);
+  tor_free(path);
+
+  tor_asprintf(, "%s"PATH_SEPARATOR"%s", torrcd, "bb_2nd");
+  tt_int_op(write_str_to_file(path, "Test 2\n", 0), OP_EQ, 0);
+  tor_free(path);
+
+  tor_asprintf(, "%s"PATH_SEPARATOR"%s", torrcd, "cc_comment");
+  tt_int_op(write_str_to_file(path, "# comment only\n", 0), OP_EQ, 0);
+  tor_free(path);
+
+  char torrc_contents[1000];
+  tor_snprintf(torrc_contents, sizeof(torrc_contents),
+   "%%include %s\n"
+   "Test 3\n",
+   torrcd);
+
+  int include_used;
+  tt_int_op(config_get_lines_include(torrc_contents, , 0, _used,
+NULL), OP_EQ, 0);
+  tt_ptr_op(result, OP_NE, NULL);
+  tt_int_op(include_used, OP_EQ, 1);
+
+  int len = 0;
+  config_line_t *next;
+  for (next = result; next != NULL; next = next->next) {
+char expected[10];
+tor_snprintf(expected, sizeof(expected), "%d", len + 1);
+tt_str_op(next->key, OP_EQ, "Test");
+tt_str_op(next->value, OP_EQ, expected);
+len++;
+  }
+  tt_int_op(len, OP_EQ, 3);
+
+ done:
+  config_free_lines(result);
+  tor_free(torrcd);
+  tor_free(path);
+  tor_free(dir);
+}
+
+static void
 test_config_include_path_syntax(void *data)
 {
   (void)data;
@@ -5848,6 +5915,7 @@ struct testcase_t config_tests[] = {
   CONFIG_TEST(include_recursion_before_after, 0),
   CONFIG_TEST(include_recursion_after_only, 0),
   CONFIG_TEST(include_folder_order, 0),
+  CONFIG_TEST(include_blank_file_last, 0),
   CONFIG_TEST(include_path_syntax, 0),
   CONFIG_TEST(include_not_processed, 0),
   CONFIG_TEST(include_has_include, 0),



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] test: Avoid a map_anon_nofork test failure on SunOS

2019-11-05 Thread teor
commit 2420c8c9366e498dfaf3b4b6389ece9dc27ca537
Author: teor 
Date:   Mon Sep 30 14:54:56 2019 +1000

test: Avoid a map_anon_nofork test failure on SunOS

This test failure happened due to a signed/unsigned integer
comparison.

This bug occurred on SunOS, it may also occur on other systems that
use signed char as the default. (And cast 1-byte integer constants
to an unsigned integer.)

Fixes bug 31897; bugfix on 0.4.1.1-alpha.
---
 changes/bug31897 | 3 +++
 src/test/test_util.c | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/changes/bug31897 b/changes/bug31897
new file mode 100644
index 0..81c63e704
--- /dev/null
+++ b/changes/bug31897
@@ -0,0 +1,3 @@
+  o Minor bugfixes (tests, SunOS):
+- Avoid a map_anon_nofork test failure due to a signed/unsigned integer
+  comparison. Fixes bug 31897; bugfix on 0.4.1.1-alpha.
diff --git a/src/test/test_util.c b/src/test/test_util.c
index 2faadd4e1..6ecff6f1c 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -6182,6 +6182,7 @@ test_util_map_anon_nofork(void *arg)
* crash, or send zero. */
 
   char *ptr = NULL;
+  const char TEST_VALUE = 0xd0;
   size_t sz = 16384;
   int pipefd[2] = {-1, -1};
   unsigned inherit=0;
@@ -6189,7 +6190,7 @@ test_util_map_anon_nofork(void *arg)
   tor_munmap_anonymous(ptr, sz);
   ptr = tor_mmap_anonymous(sz, ANONMAP_NOINHERIT, );
   tt_ptr_op(ptr, OP_NE, 0);
-  memset(ptr, 0xd0, sz);
+  memset(ptr, TEST_VALUE, sz);
 
   tt_int_op(0, OP_EQ, pipe(pipefd));
   pid_t child = fork();
@@ -6220,7 +6221,7 @@ test_util_map_anon_nofork(void *arg)
 // noinherit isn't implemented.
 tt_int_op(inherit, OP_EQ, INHERIT_RES_KEEP);
 tt_int_op((int)r, OP_EQ, 1); // child should send us a byte.
-tt_int_op(buf[0], OP_EQ, 0xd0); // that byte should what we set it to.
+tt_int_op(buf[0], OP_EQ, TEST_VALUE); // that byte should be TEST_VALUE.
   }
 
   int ws;



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.2] util/map_anon_nofork: Add a cast to avoid passing -48 to memset

2019-11-05 Thread teor
commit 9b73088c14fe24a1554950363fb80468c695937f
Author: Nick Mathewson 
Date:   Thu Oct 3 07:21:25 2019 -0400

util/map_anon_nofork: Add a cast to avoid passing -48 to memset

This fixes coverity CID 1454593, and bug 31948. Bug not in any
released version of Tor.
---
 src/test/test_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index 6ecff6f1c..b4d8a4d76 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -6190,7 +6190,7 @@ test_util_map_anon_nofork(void *arg)
   tor_munmap_anonymous(ptr, sz);
   ptr = tor_mmap_anonymous(sz, ANONMAP_NOINHERIT, );
   tt_ptr_op(ptr, OP_NE, 0);
-  memset(ptr, TEST_VALUE, sz);
+  memset(ptr, (uint8_t)TEST_VALUE, sz);
 
   tt_int_op(0, OP_EQ, pipe(pipefd));
   pid_t child = fork();



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] Merge remote-tracking branch 'tor-github/pr/1374' into maint-0.4.1

2019-11-05 Thread teor
commit 4f9a0033920b21882c4b6eead3c1826ee8e9
Merge: 63aff4a43 9b73088c1
Author: teor 
Date:   Wed Nov 6 11:19:13 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1374' into maint-0.4.1

 changes/bug31897 | 3 +++
 src/test/test_util.c | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] Merge branch 'maint-0.3.5' into maint-0.4.0

2019-11-05 Thread teor
commit 03e77ef036e41486b8bfe138d11790c928f49f35
Merge: 54e2d0dc2 1bde356bf
Author: teor 
Date:   Wed Nov 6 11:19:38 2019 +1000

Merge branch 'maint-0.3.5' into maint-0.4.0

 changes/bug30916  |  4 +++
 changes/bug31107  |  4 +++
 changes/bug31408  |  5 
 changes/bug31837  |  5 
 changes/ticket31466   |  5 
 src/core/or/channeltls.c  | 10 ++-
 src/core/or/connection_edge.c |  6 ++--
 src/feature/relay/router.c| 18 +---
 src/lib/fs/conffile.c | 10 ---
 src/test/test_config.c| 68 +++
 src/test/test_rebind.py   | 16 +-
 11 files changed, 127 insertions(+), 24 deletions(-)




___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

2019-11-05 Thread teor
commit c06d540ff9b507e0fa9749948fe406fb17dbee73
Merge: 752c35ca9 3c97ab3c2
Author: teor 
Date:   Wed Nov 6 11:14:53 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

 changes/bug31107|  4 
 src/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

2019-11-05 Thread teor
commit 0e2834a3718a3932cfe8d3148d203a0604451073
Merge: d2e4262eb 0614f8390
Author: teor 
Date:   Wed Nov 6 11:17:43 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

 changes/bug31408   |  5 
 src/lib/fs/conffile.c  | 10 +---
 src/test/test_config.c | 68 ++
 3 files changed, 79 insertions(+), 4 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] Merge branch 'maint-0.2.9' into maint-0.3.5

2019-11-05 Thread teor
commit 1bde356bf645f3c3d3b0a6e70c03e2baf9f89d26
Merge: 4abfcb799 0650bf369
Author: teor 
Date:   Wed Nov 6 11:19:30 2019 +1000

Merge branch 'maint-0.2.9' into maint-0.3.5

 changes/bug31107 |  4 
 src/core/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --cc src/core/or/channeltls.c
index 91a424728,0..4db283d20
mode 100644,00..100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@@ -1,2477 -1,0 +1,2485 @@@
 +/* * Copyright (c) 2012-2019, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file channeltls.c
 + *
 + * \brief A concrete subclass of channel_t using or_connection_t to transfer
 + * cells between Tor instances.
 + *
 + * This module fills in the various function pointers in channel_t, to
 + * implement the channel_tls_t channels as used in Tor today.  These channels
 + * are created from channel_tls_connect() and
 + * channel_tls_handle_incoming(). Each corresponds 1:1 to or_connection_t
 + * object, as implemented in connection_or.c.  These channels transmit cells
 + * to the underlying or_connection_t by calling
 + * connection_or_write_*_cell_to_buf(), and receive cells from the underlying
 + * or_connection_t when connection_or_process_cells_from_inbuf() calls
 + * channel_tls_handle_*_cell().
 + *
 + * Here we also implement the server (responder) side of the v3+ Tor link
 + * handshake, which uses CERTS and AUTHENTICATE cell to negotiate versions,
 + * exchange expected and observed IP and time information, and bootstrap a
 + * level of authentication higher than we have gotten on the raw TLS
 + * handshake.
 + *
 + * NOTE: Since there is currently only one type of channel, there are probably
 + * more than a few cases where functionality that is currently in
 + * channeltls.c, connection_or.c, and channel.c ought to be divided up
 + * differently.  The right time to do this is probably whenever we introduce
 + * our next channel type.
 + **/
 +
 +/*
 + * Define this so channel.h gives us things only channel_t subclasses
 + * should touch.
 + */
 +#define TOR_CHANNEL_INTERNAL_
 +
 +#define CHANNELTLS_PRIVATE
 +
 +#include "core/or/or.h"
 +#include "core/or/channel.h"
 +#include "core/or/channeltls.h"
 +#include "core/or/circuitmux.h"
 +#include "core/or/circuitmux_ewma.h"
 +#include "core/or/command.h"
 +#include "app/config/config.h"
 +#include "core/mainloop/connection.h"
 +#include "core/or/connection_or.h"
 +#include "feature/control/control.h"
 +#include "feature/client/entrynodes.h"
 +#include "trunnel/link_handshake.h"
 +#include "core/or/relay.h"
 +#include "feature/stats/rephist.h"
 +#include "feature/relay/router.h"
 +#include "feature/relay/routermode.h"
 +#include "feature/nodelist/dirlist.h"
 +#include "core/or/scheduler.h"
 +#include "feature/nodelist/torcert.h"
 +#include "feature/nodelist/networkstatus.h"
 +#include "trunnel/channelpadding_negotiation.h"
 +#include "core/or/channelpadding.h"
 +
 +#include "core/or/cell_st.h"
 +#include "core/or/cell_queue_st.h"
 +#include "core/or/extend_info_st.h"
 +#include "core/or/or_connection_st.h"
 +#include "core/or/or_handshake_certs_st.h"
 +#include "core/or/or_handshake_state_st.h"
 +#include "feature/nodelist/routerinfo_st.h"
 +#include "core/or/var_cell_st.h"
 +
 +#include "lib/tls/tortls.h"
 +#include "lib/tls/x509.h"
 +
 +/** How many CELL_PADDING cells have we received, ever? */
 +uint64_t stats_n_padding_cells_processed = 0;
 +/** How many CELL_VERSIONS cells have we received, ever? */
 +uint64_t stats_n_versions_cells_processed = 0;
 +/** How many CELL_NETINFO cells have we received, ever? */
 +uint64_t stats_n_netinfo_cells_processed = 0;
 +/** How many CELL_VPADDING cells have we received, ever? */
 +uint64_t stats_n_vpadding_cells_processed = 0;
 +/** How many CELL_CERTS cells have we received, ever? */
 +uint64_t stats_n_certs_cells_processed = 0;
 +/** How many CELL_AUTH_CHALLENGE cells have we received, ever? */
 +uint64_t stats_n_auth_challenge_cells_processed = 0;
 +/** How many CELL_AUTHENTICATE cells have we received, ever? */
 +uint64_t stats_n_authenticate_cells_processed = 0;
 +/** How many CELL_AUTHORIZE cells have we received, ever? */
 +uint64_t stats_n_authorize_cells_processed = 0;
 +
 +/** Active listener, if any */
 +static channel_listener_t *channel_tls_listener = NULL;
 +
 +/* channel_tls_t method declarations */
 +
 +static void channel_tls_close_method(channel_t *chan);
 +static const char * channel_tls_describe_transport_method(channel_t *chan);
 +static void channel_tls_free_method(channel_t *chan);
 +static double channel_tls_get_overhead_estimate_method(channel_t *chan);
 +static int
 +channel_tls_get_remote_addr_method(channel_t *chan, tor_addr_t *addr_out);
 +static int
 +channel_tls_get_transport_name_method(channel_t *chan, char **transport_out);
 +static const char *
 +channel_tls_get_remote_descr_method(channel_t *chan, int flags);
 +static int 

[tor-commits] [tor/release-0.4.1] Merge branch 'maint-0.4.1' into release-0.4.1

2019-11-05 Thread teor
commit fd31468ea14c6c8f659833ae0398e931f95fb1b3
Merge: 13155e241 de6ceb0be
Author: teor 
Date:   Wed Nov 6 11:19:50 2019 +1000

Merge branch 'maint-0.4.1' into release-0.4.1

 changes/bug31408|  5 
 changes/bug31837|  5 
 changes/bug31897|  3 +++
 src/lib/fs/conffile.c   | 10 +---
 src/test/test_config.c  | 68 +
 src/test/test_rebind.py | 16 +++-
 src/test/test_util.c|  5 ++--
 7 files changed, 99 insertions(+), 13 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] Fix bug when %including folder with comment only files. #31408

2019-11-05 Thread teor
commit 15490816da0f8b651d67acef9c7f4e5bf9652ce2
Author: Daniel Pinto 
Date:   Sun Sep 22 22:30:48 2019 +0100

Fix bug when %including folder with comment only files. #31408

When processing a %included folder, a bug caused the pointer to
the last element of the options list to be set to NULL when
processing a file with only comments or whitepace. This could
cause options from other files on the same folder to be
discarded depending on the lines after the affected %include.
---
 changes/bug31408   |  4 +++
 src/lib/fs/conffile.c  | 10 +---
 src/test/test_config.c | 68 ++
 3 files changed, 78 insertions(+), 4 deletions(-)

diff --git a/changes/bug31408 b/changes/bug31408
new file mode 100644
index 0..7a6744cee
--- /dev/null
+++ b/changes/bug31408
@@ -0,0 +1,4 @@
+  o Major bugfixes (torrc):
+- Fix configuration files in a %included folder containing a 
+  configuration file with only comments or whitespace being
+  ignored. Fixes bug 31408; bugfix on 0.4.0.5.
diff --git a/src/lib/fs/conffile.c b/src/lib/fs/conffile.c
index 7bb2f2393..0d5d56b33 100644
--- a/src/lib/fs/conffile.c
+++ b/src/lib/fs/conffile.c
@@ -153,16 +153,18 @@ config_process_include(const char *path, int 
recursion_level, int extended,
   int rv = -1;
   SMARTLIST_FOREACH_BEGIN(config_files, const char *, config_file) {
 config_line_t *included_config = NULL;
+config_line_t *included_config_last = NULL;
 if (config_get_included_config(config_file, recursion_level, extended,
-   _config, list_last,
+   _config, _config_last,
opened_lst) < 0) {
   goto done;
 }
 
 *next = included_config;
-if (*list_last)
-  next = &(*list_last)->next;
-
+if (included_config_last) {
+  next = _config_last->next;
+  *list_last = included_config_last;
+}
   } SMARTLIST_FOREACH_END(config_file);
   *list = ret_list;
   rv = 0;
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 0de6b1291..8f011ce1f 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -5287,6 +5287,73 @@ test_config_include_folder_order(void *data)
 }
 
 static void
+test_config_include_blank_file_last(void *data)
+{
+  (void)data;
+
+  config_line_t *result = NULL;
+  char *torrcd = NULL;
+  char *path = NULL;
+  char *dir = tor_strdup(get_fname("test_include_blank_file_last"));
+  tt_ptr_op(dir, OP_NE, NULL);
+
+#ifdef _WIN32
+  tt_int_op(mkdir(dir), OP_EQ, 0);
+#else
+  tt_int_op(mkdir(dir, 0700), OP_EQ, 0);
+#endif
+
+  tor_asprintf(, "%s"PATH_SEPARATOR"%s", dir, "torrc.d");
+
+#ifdef _WIN32
+  tt_int_op(mkdir(torrcd), OP_EQ, 0);
+#else
+  tt_int_op(mkdir(torrcd, 0700), OP_EQ, 0);
+#endif
+
+  tor_asprintf(, "%s"PATH_SEPARATOR"%s", torrcd, "aa_1st");
+  tt_int_op(write_str_to_file(path, "Test 1\n", 0), OP_EQ, 0);
+  tor_free(path);
+
+  tor_asprintf(, "%s"PATH_SEPARATOR"%s", torrcd, "bb_2nd");
+  tt_int_op(write_str_to_file(path, "Test 2\n", 0), OP_EQ, 0);
+  tor_free(path);
+
+  tor_asprintf(, "%s"PATH_SEPARATOR"%s", torrcd, "cc_comment");
+  tt_int_op(write_str_to_file(path, "# comment only\n", 0), OP_EQ, 0);
+  tor_free(path);
+
+  char torrc_contents[1000];
+  tor_snprintf(torrc_contents, sizeof(torrc_contents),
+   "%%include %s\n"
+   "Test 3\n",
+   torrcd);
+
+  int include_used;
+  tt_int_op(config_get_lines_include(torrc_contents, , 0, _used,
+NULL), OP_EQ, 0);
+  tt_ptr_op(result, OP_NE, NULL);
+  tt_int_op(include_used, OP_EQ, 1);
+
+  int len = 0;
+  config_line_t *next;
+  for (next = result; next != NULL; next = next->next) {
+char expected[10];
+tor_snprintf(expected, sizeof(expected), "%d", len + 1);
+tt_str_op(next->key, OP_EQ, "Test");
+tt_str_op(next->value, OP_EQ, expected);
+len++;
+  }
+  tt_int_op(len, OP_EQ, 3);
+
+ done:
+  config_free_lines(result);
+  tor_free(torrcd);
+  tor_free(path);
+  tor_free(dir);
+}
+
+static void
 test_config_include_path_syntax(void *data)
 {
   (void)data;
@@ -5848,6 +5915,7 @@ struct testcase_t config_tests[] = {
   CONFIG_TEST(include_recursion_before_after, 0),
   CONFIG_TEST(include_recursion_after_only, 0),
   CONFIG_TEST(include_folder_order, 0),
+  CONFIG_TEST(include_blank_file_last, 0),
   CONFIG_TEST(include_path_syntax, 0),
   CONFIG_TEST(include_not_processed, 0),
   CONFIG_TEST(include_has_include, 0),



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

2019-11-05 Thread teor
commit 4abfcb7997e4a753643fd969317c502efc6be06e
Merge: 0e2834a37 cf2b00d3f
Author: teor 
Date:   Wed Nov 6 11:18:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

 changes/bug31837|  5 +
 src/test/test_rebind.py | 16 +---
 2 files changed, 14 insertions(+), 7 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] Merge branch 'maint-0.4.0' into release-0.4.0

2019-11-05 Thread teor
commit e241523195d2bc3ac03383aab9c88e612633d461
Merge: ff601da0d 03e77ef03
Author: teor 
Date:   Wed Nov 6 11:19:42 2019 +1000

Merge branch 'maint-0.4.0' into release-0.4.0

 changes/bug30916  |  4 +++
 changes/bug31107  |  4 +++
 changes/bug31408  |  5 
 changes/bug31837  |  5 
 changes/ticket31466   |  5 
 src/core/or/channeltls.c  | 10 ++-
 src/core/or/connection_edge.c |  6 ++--
 src/feature/relay/router.c| 18 +---
 src/lib/fs/conffile.c | 10 ---
 src/test/test_config.c| 68 +++
 src/test/test_rebind.py   | 16 +-
 11 files changed, 127 insertions(+), 24 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] Merge remote-tracking branch 'tor-github/pr/1342' into maint-0.2.9

2019-11-05 Thread teor
commit 0650bf3695ae2e118426f3f6ecf1f8a344562119
Merge: c06d540ff f0e412099
Author: teor 
Date:   Wed Nov 6 11:15:45 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1342' into maint-0.2.9

 changes/ticket31466  | 5 +
 src/or/connection_edge.c | 8 +---
 2 files changed, 10 insertions(+), 3 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] Treat an unexpected constant-sized VERSIONS cell as a PROTOCOL_WARN.

2019-11-05 Thread teor
commit 3c97ab3c24ba4a133377c7ec6ec89cc6903ffb2e
Author: Nick Mathewson 
Date:   Tue Sep 17 09:09:36 2019 -0400

Treat an unexpected constant-sized VERSIONS cell as a PROTOCOL_WARN.

We previously used tor_fragile_assert() to declare that this case
could not happen: VERSIONS cells are always supposed to be
variable-sized, right?

This is incorrect, though.  On a v1 link protocol connection, all
cells are fixed-sized.  There aren't supposed to be any VERSIONS
cells with this version of the protocol, but apparently, somebody
was messing up.  (The v1 link protocol is obsolete, so probably the
implementer responsible didn't mean to be using it.)

Fixes bug 31107.  Bugfix on 0.2.4.4-alpha, when we introduced a
tor_fragile_assert() for this case.
---
 changes/bug31107|  4 
 src/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/changes/bug31107 b/changes/bug31107
new file mode 100644
index 0..9652927c3
--- /dev/null
+++ b/changes/bug31107
@@ -0,0 +1,4 @@
+  o Minor bugfixes (logging, protocol violations):
+- Do not log a nonfatal assertion failure when receiving a VERSIONS
+  cell on a connection using the obsolete v1 link protocol. Log a
+  protocol_warn instead. Fixes bug 31107; bugfix on 0.2.4.4-alpha.
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index d44f71913..6f4e413dc 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -1098,7 +1098,15 @@ channel_tls_handle_cell(cell_t *cell, or_connection_t 
*conn)
   /* do nothing */
   break;
 case CELL_VERSIONS:
-  tor_fragile_assert();
+  /* A VERSIONS cell should always be a variable-length cell, and
+   * so should never reach this function (which handles constant-sized
+   * cells). But if the connection is using the (obsolete) v1 link
+   * protocol, all cells will be treated as constant-sized, and so
+   * it's possible we'll reach this code.
+   */
+  log_fn(LOG_PROTOCOL_WARN, LD_CHANNEL,
+ "Received unexpected VERSIONS cell on a channel using link "
+ "protocol %d; ignoring.", conn->link_proto);
   break;
 case CELL_NETINFO:
   ++stats_n_netinfo_cells_processed;



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5

2019-11-05 Thread teor
commit d2e4262ebc134f4c6ae9e702a14da45489575b4f
Merge: 6bfdd0967 2da4d64a6
Author: teor 
Date:   Wed Nov 6 11:17:01 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5

 changes/bug30916   |  4 
 src/feature/relay/router.c | 18 --
 2 files changed, 12 insertions(+), 10 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] Add a rate-limit to our warning about the disabled .exit notation

2019-11-05 Thread teor
commit f0e4120996d3a96252200ea5302dcde3af6e0bc0
Author: Nick Mathewson 
Date:   Wed Sep 18 15:38:33 2019 -0400

Add a rate-limit to our warning about the disabled .exit notation

This warning would previously be given every time we tried to open a
connection to a foo.exit address, which could potentially be used to
flood the logs.  Now, we don't allow this warning to appear more
than once every 15 minutes.

Fixes bug 31466; bugfix on 0.2.2.1-alpha, when .exit was first
deprecated.
---
 changes/ticket31466  | 5 +
 src/or/connection_edge.c | 8 +---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/changes/ticket31466 b/changes/ticket31466
new file mode 100644
index 0..e535b4502
--- /dev/null
+++ b/changes/ticket31466
@@ -0,0 +1,5 @@
+  o Minor bugfixes (logging):
+- Rate-limit our the logging message about the obsolete .exit notation.
+  Previously, there was no limit on this warning, which could potentially
+  be triggered many times by a hostile website. Fixes bug 31466;
+  bugfix on 0.2.2.1-alpha.
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 7a97c632d..5638d9a1b 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -1186,9 +1186,11 @@ connection_ap_handshake_rewrite(entry_connection_t *conn,
* disallowed when they're coming straight from the client, but you're
* allowed to have them in MapAddress commands and so forth. */
   if (!strcmpend(socks->address, ".exit") && !options->AllowDotExit) {
-log_warn(LD_APP, "The  \".exit\" notation is disabled in Tor due to "
- "security risks. Set AllowDotExit in your torrc to enable "
- "it (at your own risk).");
+static ratelim_t exit_warning_limit = RATELIM_INIT(60*15);
+log_fn_ratelim(_warning_limit, LOG_WARN, LD_APP,
+   "The  \".exit\" notation is disabled in Tor due to "
+   "security risks.  Set AllowDotExit in your torrc to enable "
+   "it (at your own risk).");
 control_event_client_status(LOG_WARN, "SOCKS_BAD_HOSTNAME HOSTNAME=%s",
 escaped(socks->address));
 out->end_reason = END_STREAM_REASON_TORPROTOCOL;



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] test/rebind: Make control formatting and log parsing more robust

2019-11-05 Thread teor
commit cf2b00d3f50f3421c3c22777113e25d5f7812e67
Author: teor 
Date:   Tue Aug 6 01:33:14 2019 +1000

test/rebind: Make control formatting and log parsing more robust

* actually sleep when tor has not logged anything
* log at debug level when waiting for tor to log something
* backslash-replace bad UTF-8 characters in logs
* format control messages as ASCII: tor does not accept UTF-8 control 
commands

Fixes bug 31837; bugfix on 0.3.5.1-alpha.
---
 changes/bug31837|  5 +
 src/test/test_rebind.py | 16 +---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/changes/bug31837 b/changes/bug31837
new file mode 100644
index 0..0f976edfe
--- /dev/null
+++ b/changes/bug31837
@@ -0,0 +1,5 @@
+  o Minor bugfixes (testing):
+- When testing port rebinding, don't busy-wait for tor to log. Instead,
+  actually sleep for a short time before polling again. Also improve the
+  formatting of control commands and log messages.
+  Fixes bug 31837; bugfix on 0.3.5.1-alpha.
diff --git a/src/test/test_rebind.py b/src/test/test_rebind.py
index 45ad1c546..30a587858 100644
--- a/src/test/test_rebind.py
+++ b/src/test/test_rebind.py
@@ -31,15 +31,17 @@ def wait_for_log(s):
 cutoff = time.time() + LOG_TIMEOUT
 while time.time() < cutoff:
 l = tor_process.stdout.readline()
-l = l.decode('utf8')
+l = l.decode('utf8', 'backslashreplace')
 if s in l:
 logging.info('Tor logged: "{}"'.format(l.strip()))
 return
-logging.info('Tor logged: "{}", waiting for "{}"'.format(l.strip(), s))
 # readline() returns a blank string when there is no output
 # avoid busy-waiting
-if len(s) == 0:
+if len(l) == 0:
+logging.debug('Tor has not logged anything, waiting for 
"{}"'.format(s))
 time.sleep(LOG_WAIT)
+else:
+logging.info('Tor logged: "{}", waiting for 
"{}"'.format(l.strip(), s))
 fail('Could not find "{}" in logs after {} seconds'.format(s, LOG_TIMEOUT))
 
 def pick_random_port():
@@ -119,18 +121,18 @@ if control_socket.connect_ex(('127.0.0.1', control_port)):
 tor_process.terminate()
 fail('Cannot connect to ControlPort')
 
-control_socket.sendall('AUTHENTICATE \r\n'.encode('utf8'))
-control_socket.sendall('SETCONF 
SOCKSPort=0.0.0.0:{}\r\n'.format(socks_port).encode('utf8'))
+control_socket.sendall('AUTHENTICATE \r\n'.encode('ascii'))
+control_socket.sendall('SETCONF 
SOCKSPort=0.0.0.0:{}\r\n'.format(socks_port).encode('ascii'))
 wait_for_log('Opened Socks listener')
 
 try_connecting_to_socksport()
 
-control_socket.sendall('SETCONF 
SOCKSPort=127.0.0.1:{}\r\n'.format(socks_port).encode('utf8'))
+control_socket.sendall('SETCONF 
SOCKSPort=127.0.0.1:{}\r\n'.format(socks_port).encode('ascii'))
 wait_for_log('Opened Socks listener')
 
 try_connecting_to_socksport()
 
-control_socket.sendall('SIGNAL HALT\r\n'.encode('utf8'))
+control_socket.sendall('SIGNAL HALT\r\n'.encode('ascii'))
 
 wait_for_log('exiting cleanly')
 logging.info('OK')



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.1] Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

2019-11-05 Thread teor
commit 6bfdd096792194d1077a101a34859bff996c940e
Merge: 15d67842f bf4a27c0e
Author: teor 
Date:   Wed Nov 6 11:16:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

 changes/ticket31466   | 5 +
 src/core/or/connection_edge.c | 6 --
 2 files changed, 9 insertions(+), 2 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

2019-11-05 Thread teor
commit 0e2834a3718a3932cfe8d3148d203a0604451073
Merge: d2e4262eb 0614f8390
Author: teor 
Date:   Wed Nov 6 11:17:43 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

 changes/bug31408   |  5 
 src/lib/fs/conffile.c  | 10 +---
 src/test/test_config.c | 68 ++
 3 files changed, 79 insertions(+), 4 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] Extract expressions in construct_ntor_key_map()

2019-11-05 Thread teor
commit 1e9488f2fd829d48eb5ef6c2170e0f7163061136
Author: Nick Mathewson 
Date:   Wed Sep 18 11:11:05 2019 -0400

Extract expressions in construct_ntor_key_map()

No behavioral change here: this is just refactoring.
---
 src/feature/relay/router.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index dad2c6a50..88a30cef0 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -278,19 +278,16 @@ construct_ntor_key_map(void)
 {
   di_digest256_map_t *m = NULL;
 
-  if (!tor_mem_is_zero((const char*)
-   curve25519_onion_key.pubkey.public_key,
-   CURVE25519_PUBKEY_LEN)) {
-dimap_add_entry(,
-curve25519_onion_key.pubkey.public_key,
+  const uint8_t *cur_pk = curve25519_onion_key.pubkey.public_key;
+  const uint8_t *last_pk = last_curve25519_onion_key.pubkey.public_key;
+
+  if (!tor_mem_is_zero((const char *)cur_pk, CURVE25519_PUBKEY_LEN)) {
+dimap_add_entry(, cur_pk,
 tor_memdup(_onion_key,
sizeof(curve25519_keypair_t)));
   }
-  if (!tor_mem_is_zero((const char*)
-  last_curve25519_onion_key.pubkey.public_key,
-   CURVE25519_PUBKEY_LEN)) {
-dimap_add_entry(,
-last_curve25519_onion_key.pubkey.public_key,
+  if (!tor_mem_is_zero((const char*)last_pk, CURVE25519_PUBKEY_LEN)) {
+dimap_add_entry(, last_pk,
 tor_memdup(_curve25519_onion_key,
sizeof(curve25519_keypair_t)));
   }



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] Extract expressions in construct_ntor_key_map()

2019-11-05 Thread teor
commit 1e9488f2fd829d48eb5ef6c2170e0f7163061136
Author: Nick Mathewson 
Date:   Wed Sep 18 11:11:05 2019 -0400

Extract expressions in construct_ntor_key_map()

No behavioral change here: this is just refactoring.
---
 src/feature/relay/router.c | 17 +++--
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index dad2c6a50..88a30cef0 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -278,19 +278,16 @@ construct_ntor_key_map(void)
 {
   di_digest256_map_t *m = NULL;
 
-  if (!tor_mem_is_zero((const char*)
-   curve25519_onion_key.pubkey.public_key,
-   CURVE25519_PUBKEY_LEN)) {
-dimap_add_entry(,
-curve25519_onion_key.pubkey.public_key,
+  const uint8_t *cur_pk = curve25519_onion_key.pubkey.public_key;
+  const uint8_t *last_pk = last_curve25519_onion_key.pubkey.public_key;
+
+  if (!tor_mem_is_zero((const char *)cur_pk, CURVE25519_PUBKEY_LEN)) {
+dimap_add_entry(, cur_pk,
 tor_memdup(_onion_key,
sizeof(curve25519_keypair_t)));
   }
-  if (!tor_mem_is_zero((const char*)
-  last_curve25519_onion_key.pubkey.public_key,
-   CURVE25519_PUBKEY_LEN)) {
-dimap_add_entry(,
-last_curve25519_onion_key.pubkey.public_key,
+  if (!tor_mem_is_zero((const char*)last_pk, CURVE25519_PUBKEY_LEN)) {
+dimap_add_entry(, last_pk,
 tor_memdup(_curve25519_onion_key,
sizeof(curve25519_keypair_t)));
   }



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] Avoid a crash if our "current" and "old" ntor onion keys are equal

2019-11-05 Thread teor
commit 2da4d64a64a803f4b0a6d56e517b4288bef6c4f8
Author: Nick Mathewson 
Date:   Wed Sep 18 11:14:45 2019 -0400

Avoid a crash if our "current" and "old" ntor onion keys are equal

Our dimap code asserts if you try to add the same key twice; this
can't happen if everything is running smoothly, but it's possible if
you try to start a relay where secret_onion_key_ntor is the same as
secret_onion_key_ntor.old.

Fixes bug 30916; bugfix on 0.2.4.8-alpha when ntor keys were
introduced.
---
 changes/bug30916   | 4 
 src/feature/relay/router.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/changes/bug30916 b/changes/bug30916
new file mode 100644
index 0..b006bfc75
--- /dev/null
+++ b/changes/bug30916
@@ -0,0 +1,4 @@
+  o Minor bugfixes (relay):
+- Avoid crashing when starting with a corrupt keys directory where
+  the old ntor key and the new ntor key are identical. Fixes bug 30916;
+  bugfix on 0.2.4.8-alpha.
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 88a30cef0..1dbaf2ed6 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -286,7 +286,8 @@ construct_ntor_key_map(void)
 tor_memdup(_onion_key,
sizeof(curve25519_keypair_t)));
   }
-  if (!tor_mem_is_zero((const char*)last_pk, CURVE25519_PUBKEY_LEN)) {
+  if (!tor_mem_is_zero((const char*)last_pk, CURVE25519_PUBKEY_LEN) &&
+  tor_memneq(cur_pk, last_pk, CURVE25519_PUBKEY_LEN)) {
 dimap_add_entry(, last_pk,
 tor_memdup(_curve25519_onion_key,
sizeof(curve25519_keypair_t)));



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.2.9] Merge remote-tracking branch 'tor-github/pr/1342' into maint-0.2.9

2019-11-05 Thread teor
commit 0650bf3695ae2e118426f3f6ecf1f8a344562119
Merge: c06d540ff f0e412099
Author: teor 
Date:   Wed Nov 6 11:15:45 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1342' into maint-0.2.9

 changes/ticket31466  | 5 +
 src/or/connection_edge.c | 8 +---
 2 files changed, 10 insertions(+), 3 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] Add a rate-limit to our warning about the disabled .exit notation

2019-11-05 Thread teor
commit f0e4120996d3a96252200ea5302dcde3af6e0bc0
Author: Nick Mathewson 
Date:   Wed Sep 18 15:38:33 2019 -0400

Add a rate-limit to our warning about the disabled .exit notation

This warning would previously be given every time we tried to open a
connection to a foo.exit address, which could potentially be used to
flood the logs.  Now, we don't allow this warning to appear more
than once every 15 minutes.

Fixes bug 31466; bugfix on 0.2.2.1-alpha, when .exit was first
deprecated.
---
 changes/ticket31466  | 5 +
 src/or/connection_edge.c | 8 +---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/changes/ticket31466 b/changes/ticket31466
new file mode 100644
index 0..e535b4502
--- /dev/null
+++ b/changes/ticket31466
@@ -0,0 +1,5 @@
+  o Minor bugfixes (logging):
+- Rate-limit our the logging message about the obsolete .exit notation.
+  Previously, there was no limit on this warning, which could potentially
+  be triggered many times by a hostile website. Fixes bug 31466;
+  bugfix on 0.2.2.1-alpha.
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 7a97c632d..5638d9a1b 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -1186,9 +1186,11 @@ connection_ap_handshake_rewrite(entry_connection_t *conn,
* disallowed when they're coming straight from the client, but you're
* allowed to have them in MapAddress commands and so forth. */
   if (!strcmpend(socks->address, ".exit") && !options->AllowDotExit) {
-log_warn(LD_APP, "The  \".exit\" notation is disabled in Tor due to "
- "security risks. Set AllowDotExit in your torrc to enable "
- "it (at your own risk).");
+static ratelim_t exit_warning_limit = RATELIM_INIT(60*15);
+log_fn_ratelim(_warning_limit, LOG_WARN, LD_APP,
+   "The  \".exit\" notation is disabled in Tor due to "
+   "security risks.  Set AllowDotExit in your torrc to enable "
+   "it (at your own risk).");
 control_event_client_status(LOG_WARN, "SOCKS_BAD_HOSTNAME HOSTNAME=%s",
 escaped(socks->address));
 out->end_reason = END_STREAM_REASON_TORPROTOCOL;



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5

2019-11-05 Thread teor
commit d2e4262ebc134f4c6ae9e702a14da45489575b4f
Merge: 6bfdd0967 2da4d64a6
Author: teor 
Date:   Wed Nov 6 11:17:01 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5

 changes/bug30916   |  4 
 src/feature/relay/router.c | 18 --
 2 files changed, 12 insertions(+), 10 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

2019-11-05 Thread teor
commit c06d540ff9b507e0fa9749948fe406fb17dbee73
Merge: 752c35ca9 3c97ab3c2
Author: teor 
Date:   Wed Nov 6 11:14:53 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

 changes/bug31107|  4 
 src/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

2019-11-05 Thread teor
commit 0e2834a3718a3932cfe8d3148d203a0604451073
Merge: d2e4262eb 0614f8390
Author: teor 
Date:   Wed Nov 6 11:17:43 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

 changes/bug31408   |  5 
 src/lib/fs/conffile.c  | 10 +---
 src/test/test_config.c | 68 ++
 3 files changed, 79 insertions(+), 4 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] changes: use correct bugfix release, and reword changes file for 31408

2019-11-05 Thread teor
commit 0614f839054a52e6e1a79a366fcc70da0691df66
Author: teor 
Date:   Mon Sep 23 11:11:50 2019 +1000

changes: use correct bugfix release, and reword changes file for 31408
---
 changes/bug31408 | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/changes/bug31408 b/changes/bug31408
index 7a6744cee..3e4ffa927 100644
--- a/changes/bug31408
+++ b/changes/bug31408
@@ -1,4 +1,5 @@
   o Major bugfixes (torrc):
-- Fix configuration files in a %included folder containing a 
-  configuration file with only comments or whitespace being
-  ignored. Fixes bug 31408; bugfix on 0.4.0.5.
+- Stop ignoring torrc options after an %include directive, when the
+  included directory ends with a file that does not contain any config
+  options. (But does contain comments or whitespace.)
+  Fixes bug 31408; bugfix on 0.3.1.1-alpha.



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

2019-11-05 Thread teor
commit 6bfdd096792194d1077a101a34859bff996c940e
Merge: 15d67842f bf4a27c0e
Author: teor 
Date:   Wed Nov 6 11:16:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

 changes/ticket31466   | 5 +
 src/core/or/connection_edge.c | 6 --
 2 files changed, 9 insertions(+), 2 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.2.9] Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

2019-11-05 Thread teor
commit c06d540ff9b507e0fa9749948fe406fb17dbee73
Merge: 752c35ca9 3c97ab3c2
Author: teor 
Date:   Wed Nov 6 11:14:53 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

 changes/bug31107|  4 
 src/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.4.0] Avoid a crash if our "current" and "old" ntor onion keys are equal

2019-11-05 Thread teor
commit 2da4d64a64a803f4b0a6d56e517b4288bef6c4f8
Author: Nick Mathewson 
Date:   Wed Sep 18 11:14:45 2019 -0400

Avoid a crash if our "current" and "old" ntor onion keys are equal

Our dimap code asserts if you try to add the same key twice; this
can't happen if everything is running smoothly, but it's possible if
you try to start a relay where secret_onion_key_ntor is the same as
secret_onion_key_ntor.old.

Fixes bug 30916; bugfix on 0.2.4.8-alpha when ntor keys were
introduced.
---
 changes/bug30916   | 4 
 src/feature/relay/router.c | 3 ++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/changes/bug30916 b/changes/bug30916
new file mode 100644
index 0..b006bfc75
--- /dev/null
+++ b/changes/bug30916
@@ -0,0 +1,4 @@
+  o Minor bugfixes (relay):
+- Avoid crashing when starting with a corrupt keys directory where
+  the old ntor key and the new ntor key are identical. Fixes bug 30916;
+  bugfix on 0.2.4.8-alpha.
diff --git a/src/feature/relay/router.c b/src/feature/relay/router.c
index 88a30cef0..1dbaf2ed6 100644
--- a/src/feature/relay/router.c
+++ b/src/feature/relay/router.c
@@ -286,7 +286,8 @@ construct_ntor_key_map(void)
 tor_memdup(_onion_key,
sizeof(curve25519_keypair_t)));
   }
-  if (!tor_mem_is_zero((const char*)last_pk, CURVE25519_PUBKEY_LEN)) {
+  if (!tor_mem_is_zero((const char*)last_pk, CURVE25519_PUBKEY_LEN) &&
+  tor_memneq(cur_pk, last_pk, CURVE25519_PUBKEY_LEN)) {
 dimap_add_entry(, last_pk,
 tor_memdup(_curve25519_onion_key,
sizeof(curve25519_keypair_t)));



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] Merge branch 'maint-0.3.5' into release-0.3.5

2019-11-05 Thread teor
commit 1fb110d3ab296c74b8380f8eb449fc9290583532
Merge: db5df1acf 1bde356bf
Author: teor 
Date:   Wed Nov 6 11:19:34 2019 +1000

Merge branch 'maint-0.3.5' into release-0.3.5

 changes/bug30916  |  4 +++
 changes/bug31107  |  4 +++
 changes/bug31408  |  5 
 changes/bug31837  |  5 
 changes/ticket31466   |  5 
 src/core/or/channeltls.c  | 10 ++-
 src/core/or/connection_edge.c |  6 ++--
 src/feature/relay/router.c| 18 +---
 src/lib/fs/conffile.c | 10 ---
 src/test/test_config.c| 68 +++
 src/test/test_rebind.py   | 16 +-
 11 files changed, 127 insertions(+), 24 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.2.9] Merge branch 'maint-0.2.9' into release-0.2.9

2019-11-05 Thread teor
commit d7f76b8c47ffd2512b9b454a2af87243e0f68993
Merge: 9343b4120 0650bf369
Author: teor 
Date:   Wed Nov 6 11:19:25 2019 +1000

Merge branch 'maint-0.2.9' into release-0.2.9

 changes/bug31107 |  4 
 changes/ticket31466  |  5 +
 src/or/channeltls.c  | 10 +-
 src/or/connection_edge.c |  8 +---
 4 files changed, 23 insertions(+), 4 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] test/rebind: Make control formatting and log parsing more robust

2019-11-05 Thread teor
commit cf2b00d3f50f3421c3c22777113e25d5f7812e67
Author: teor 
Date:   Tue Aug 6 01:33:14 2019 +1000

test/rebind: Make control formatting and log parsing more robust

* actually sleep when tor has not logged anything
* log at debug level when waiting for tor to log something
* backslash-replace bad UTF-8 characters in logs
* format control messages as ASCII: tor does not accept UTF-8 control 
commands

Fixes bug 31837; bugfix on 0.3.5.1-alpha.
---
 changes/bug31837|  5 +
 src/test/test_rebind.py | 16 +---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/changes/bug31837 b/changes/bug31837
new file mode 100644
index 0..0f976edfe
--- /dev/null
+++ b/changes/bug31837
@@ -0,0 +1,5 @@
+  o Minor bugfixes (testing):
+- When testing port rebinding, don't busy-wait for tor to log. Instead,
+  actually sleep for a short time before polling again. Also improve the
+  formatting of control commands and log messages.
+  Fixes bug 31837; bugfix on 0.3.5.1-alpha.
diff --git a/src/test/test_rebind.py b/src/test/test_rebind.py
index 45ad1c546..30a587858 100644
--- a/src/test/test_rebind.py
+++ b/src/test/test_rebind.py
@@ -31,15 +31,17 @@ def wait_for_log(s):
 cutoff = time.time() + LOG_TIMEOUT
 while time.time() < cutoff:
 l = tor_process.stdout.readline()
-l = l.decode('utf8')
+l = l.decode('utf8', 'backslashreplace')
 if s in l:
 logging.info('Tor logged: "{}"'.format(l.strip()))
 return
-logging.info('Tor logged: "{}", waiting for "{}"'.format(l.strip(), s))
 # readline() returns a blank string when there is no output
 # avoid busy-waiting
-if len(s) == 0:
+if len(l) == 0:
+logging.debug('Tor has not logged anything, waiting for 
"{}"'.format(s))
 time.sleep(LOG_WAIT)
+else:
+logging.info('Tor logged: "{}", waiting for 
"{}"'.format(l.strip(), s))
 fail('Could not find "{}" in logs after {} seconds'.format(s, LOG_TIMEOUT))
 
 def pick_random_port():
@@ -119,18 +121,18 @@ if control_socket.connect_ex(('127.0.0.1', control_port)):
 tor_process.terminate()
 fail('Cannot connect to ControlPort')
 
-control_socket.sendall('AUTHENTICATE \r\n'.encode('utf8'))
-control_socket.sendall('SETCONF 
SOCKSPort=0.0.0.0:{}\r\n'.format(socks_port).encode('utf8'))
+control_socket.sendall('AUTHENTICATE \r\n'.encode('ascii'))
+control_socket.sendall('SETCONF 
SOCKSPort=0.0.0.0:{}\r\n'.format(socks_port).encode('ascii'))
 wait_for_log('Opened Socks listener')
 
 try_connecting_to_socksport()
 
-control_socket.sendall('SETCONF 
SOCKSPort=127.0.0.1:{}\r\n'.format(socks_port).encode('utf8'))
+control_socket.sendall('SETCONF 
SOCKSPort=127.0.0.1:{}\r\n'.format(socks_port).encode('ascii'))
 wait_for_log('Opened Socks listener')
 
 try_connecting_to_socksport()
 
-control_socket.sendall('SIGNAL HALT\r\n'.encode('utf8'))
+control_socket.sendall('SIGNAL HALT\r\n'.encode('ascii'))
 
 wait_for_log('exiting cleanly')
 logging.info('OK')



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.2] Merge branch 'maint-0.2.9' into maint-0.3.5

2019-11-05 Thread teor
commit 1bde356bf645f3c3d3b0a6e70c03e2baf9f89d26
Merge: 4abfcb799 0650bf369
Author: teor 
Date:   Wed Nov 6 11:19:30 2019 +1000

Merge branch 'maint-0.2.9' into maint-0.3.5

 changes/bug31107 |  4 
 src/core/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --cc src/core/or/channeltls.c
index 91a424728,0..4db283d20
mode 100644,00..100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@@ -1,2477 -1,0 +1,2485 @@@
 +/* * Copyright (c) 2012-2019, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file channeltls.c
 + *
 + * \brief A concrete subclass of channel_t using or_connection_t to transfer
 + * cells between Tor instances.
 + *
 + * This module fills in the various function pointers in channel_t, to
 + * implement the channel_tls_t channels as used in Tor today.  These channels
 + * are created from channel_tls_connect() and
 + * channel_tls_handle_incoming(). Each corresponds 1:1 to or_connection_t
 + * object, as implemented in connection_or.c.  These channels transmit cells
 + * to the underlying or_connection_t by calling
 + * connection_or_write_*_cell_to_buf(), and receive cells from the underlying
 + * or_connection_t when connection_or_process_cells_from_inbuf() calls
 + * channel_tls_handle_*_cell().
 + *
 + * Here we also implement the server (responder) side of the v3+ Tor link
 + * handshake, which uses CERTS and AUTHENTICATE cell to negotiate versions,
 + * exchange expected and observed IP and time information, and bootstrap a
 + * level of authentication higher than we have gotten on the raw TLS
 + * handshake.
 + *
 + * NOTE: Since there is currently only one type of channel, there are probably
 + * more than a few cases where functionality that is currently in
 + * channeltls.c, connection_or.c, and channel.c ought to be divided up
 + * differently.  The right time to do this is probably whenever we introduce
 + * our next channel type.
 + **/
 +
 +/*
 + * Define this so channel.h gives us things only channel_t subclasses
 + * should touch.
 + */
 +#define TOR_CHANNEL_INTERNAL_
 +
 +#define CHANNELTLS_PRIVATE
 +
 +#include "core/or/or.h"
 +#include "core/or/channel.h"
 +#include "core/or/channeltls.h"
 +#include "core/or/circuitmux.h"
 +#include "core/or/circuitmux_ewma.h"
 +#include "core/or/command.h"
 +#include "app/config/config.h"
 +#include "core/mainloop/connection.h"
 +#include "core/or/connection_or.h"
 +#include "feature/control/control.h"
 +#include "feature/client/entrynodes.h"
 +#include "trunnel/link_handshake.h"
 +#include "core/or/relay.h"
 +#include "feature/stats/rephist.h"
 +#include "feature/relay/router.h"
 +#include "feature/relay/routermode.h"
 +#include "feature/nodelist/dirlist.h"
 +#include "core/or/scheduler.h"
 +#include "feature/nodelist/torcert.h"
 +#include "feature/nodelist/networkstatus.h"
 +#include "trunnel/channelpadding_negotiation.h"
 +#include "core/or/channelpadding.h"
 +
 +#include "core/or/cell_st.h"
 +#include "core/or/cell_queue_st.h"
 +#include "core/or/extend_info_st.h"
 +#include "core/or/or_connection_st.h"
 +#include "core/or/or_handshake_certs_st.h"
 +#include "core/or/or_handshake_state_st.h"
 +#include "feature/nodelist/routerinfo_st.h"
 +#include "core/or/var_cell_st.h"
 +
 +#include "lib/tls/tortls.h"
 +#include "lib/tls/x509.h"
 +
 +/** How many CELL_PADDING cells have we received, ever? */
 +uint64_t stats_n_padding_cells_processed = 0;
 +/** How many CELL_VERSIONS cells have we received, ever? */
 +uint64_t stats_n_versions_cells_processed = 0;
 +/** How many CELL_NETINFO cells have we received, ever? */
 +uint64_t stats_n_netinfo_cells_processed = 0;
 +/** How many CELL_VPADDING cells have we received, ever? */
 +uint64_t stats_n_vpadding_cells_processed = 0;
 +/** How many CELL_CERTS cells have we received, ever? */
 +uint64_t stats_n_certs_cells_processed = 0;
 +/** How many CELL_AUTH_CHALLENGE cells have we received, ever? */
 +uint64_t stats_n_auth_challenge_cells_processed = 0;
 +/** How many CELL_AUTHENTICATE cells have we received, ever? */
 +uint64_t stats_n_authenticate_cells_processed = 0;
 +/** How many CELL_AUTHORIZE cells have we received, ever? */
 +uint64_t stats_n_authorize_cells_processed = 0;
 +
 +/** Active listener, if any */
 +static channel_listener_t *channel_tls_listener = NULL;
 +
 +/* channel_tls_t method declarations */
 +
 +static void channel_tls_close_method(channel_t *chan);
 +static const char * channel_tls_describe_transport_method(channel_t *chan);
 +static void channel_tls_free_method(channel_t *chan);
 +static double channel_tls_get_overhead_estimate_method(channel_t *chan);
 +static int
 +channel_tls_get_remote_addr_method(channel_t *chan, tor_addr_t *addr_out);
 +static int
 +channel_tls_get_transport_name_method(channel_t *chan, char **transport_out);
 +static const char *
 +channel_tls_get_remote_descr_method(channel_t *chan, int flags);
 +static int 

[tor-commits] [tor/release-0.3.5] Treat an unexpected constant-sized VERSIONS cell as a PROTOCOL_WARN.

2019-11-05 Thread teor
commit 3c97ab3c24ba4a133377c7ec6ec89cc6903ffb2e
Author: Nick Mathewson 
Date:   Tue Sep 17 09:09:36 2019 -0400

Treat an unexpected constant-sized VERSIONS cell as a PROTOCOL_WARN.

We previously used tor_fragile_assert() to declare that this case
could not happen: VERSIONS cells are always supposed to be
variable-sized, right?

This is incorrect, though.  On a v1 link protocol connection, all
cells are fixed-sized.  There aren't supposed to be any VERSIONS
cells with this version of the protocol, but apparently, somebody
was messing up.  (The v1 link protocol is obsolete, so probably the
implementer responsible didn't mean to be using it.)

Fixes bug 31107.  Bugfix on 0.2.4.4-alpha, when we introduced a
tor_fragile_assert() for this case.
---
 changes/bug31107|  4 
 src/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/changes/bug31107 b/changes/bug31107
new file mode 100644
index 0..9652927c3
--- /dev/null
+++ b/changes/bug31107
@@ -0,0 +1,4 @@
+  o Minor bugfixes (logging, protocol violations):
+- Do not log a nonfatal assertion failure when receiving a VERSIONS
+  cell on a connection using the obsolete v1 link protocol. Log a
+  protocol_warn instead. Fixes bug 31107; bugfix on 0.2.4.4-alpha.
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index d44f71913..6f4e413dc 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -1098,7 +1098,15 @@ channel_tls_handle_cell(cell_t *cell, or_connection_t 
*conn)
   /* do nothing */
   break;
 case CELL_VERSIONS:
-  tor_fragile_assert();
+  /* A VERSIONS cell should always be a variable-length cell, and
+   * so should never reach this function (which handles constant-sized
+   * cells). But if the connection is using the (obsolete) v1 link
+   * protocol, all cells will be treated as constant-sized, and so
+   * it's possible we'll reach this code.
+   */
+  log_fn(LOG_PROTOCOL_WARN, LD_CHANNEL,
+ "Received unexpected VERSIONS cell on a channel using link "
+ "protocol %d; ignoring.", conn->link_proto);
   break;
 case CELL_NETINFO:
   ++stats_n_netinfo_cells_processed;



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

2019-11-05 Thread teor
commit 4abfcb7997e4a753643fd969317c502efc6be06e
Merge: 0e2834a37 cf2b00d3f
Author: teor 
Date:   Wed Nov 6 11:18:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

 changes/bug31837|  5 +
 src/test/test_rebind.py | 16 +---
 2 files changed, 14 insertions(+), 7 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] Merge remote-tracking branch 'tor-github/pr/1342' into maint-0.2.9

2019-11-05 Thread teor
commit 0650bf3695ae2e118426f3f6ecf1f8a344562119
Merge: c06d540ff f0e412099
Author: teor 
Date:   Wed Nov 6 11:15:45 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1342' into maint-0.2.9

 changes/ticket31466  | 5 +
 src/or/connection_edge.c | 8 +---
 2 files changed, 10 insertions(+), 3 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.2.9] Add a rate-limit to our warning about the disabled .exit notation

2019-11-05 Thread teor
commit f0e4120996d3a96252200ea5302dcde3af6e0bc0
Author: Nick Mathewson 
Date:   Wed Sep 18 15:38:33 2019 -0400

Add a rate-limit to our warning about the disabled .exit notation

This warning would previously be given every time we tried to open a
connection to a foo.exit address, which could potentially be used to
flood the logs.  Now, we don't allow this warning to appear more
than once every 15 minutes.

Fixes bug 31466; bugfix on 0.2.2.1-alpha, when .exit was first
deprecated.
---
 changes/ticket31466  | 5 +
 src/or/connection_edge.c | 8 +---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/changes/ticket31466 b/changes/ticket31466
new file mode 100644
index 0..e535b4502
--- /dev/null
+++ b/changes/ticket31466
@@ -0,0 +1,5 @@
+  o Minor bugfixes (logging):
+- Rate-limit our the logging message about the obsolete .exit notation.
+  Previously, there was no limit on this warning, which could potentially
+  be triggered many times by a hostile website. Fixes bug 31466;
+  bugfix on 0.2.2.1-alpha.
diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 7a97c632d..5638d9a1b 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -1186,9 +1186,11 @@ connection_ap_handshake_rewrite(entry_connection_t *conn,
* disallowed when they're coming straight from the client, but you're
* allowed to have them in MapAddress commands and so forth. */
   if (!strcmpend(socks->address, ".exit") && !options->AllowDotExit) {
-log_warn(LD_APP, "The  \".exit\" notation is disabled in Tor due to "
- "security risks. Set AllowDotExit in your torrc to enable "
- "it (at your own risk).");
+static ratelim_t exit_warning_limit = RATELIM_INIT(60*15);
+log_fn_ratelim(_warning_limit, LOG_WARN, LD_APP,
+   "The  \".exit\" notation is disabled in Tor due to "
+   "security risks.  Set AllowDotExit in your torrc to enable "
+   "it (at your own risk).");
 control_event_client_status(LOG_WARN, "SOCKS_BAD_HOSTNAME HOSTNAME=%s",
 escaped(socks->address));
 out->end_reason = END_STREAM_REASON_TORPROTOCOL;



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.3.5] Fix bug when %including folder with comment only files. #31408

2019-11-05 Thread teor
commit 15490816da0f8b651d67acef9c7f4e5bf9652ce2
Author: Daniel Pinto 
Date:   Sun Sep 22 22:30:48 2019 +0100

Fix bug when %including folder with comment only files. #31408

When processing a %included folder, a bug caused the pointer to
the last element of the options list to be set to NULL when
processing a file with only comments or whitepace. This could
cause options from other files on the same folder to be
discarded depending on the lines after the affected %include.
---
 changes/bug31408   |  4 +++
 src/lib/fs/conffile.c  | 10 +---
 src/test/test_config.c | 68 ++
 3 files changed, 78 insertions(+), 4 deletions(-)

diff --git a/changes/bug31408 b/changes/bug31408
new file mode 100644
index 0..7a6744cee
--- /dev/null
+++ b/changes/bug31408
@@ -0,0 +1,4 @@
+  o Major bugfixes (torrc):
+- Fix configuration files in a %included folder containing a 
+  configuration file with only comments or whitespace being
+  ignored. Fixes bug 31408; bugfix on 0.4.0.5.
diff --git a/src/lib/fs/conffile.c b/src/lib/fs/conffile.c
index 7bb2f2393..0d5d56b33 100644
--- a/src/lib/fs/conffile.c
+++ b/src/lib/fs/conffile.c
@@ -153,16 +153,18 @@ config_process_include(const char *path, int 
recursion_level, int extended,
   int rv = -1;
   SMARTLIST_FOREACH_BEGIN(config_files, const char *, config_file) {
 config_line_t *included_config = NULL;
+config_line_t *included_config_last = NULL;
 if (config_get_included_config(config_file, recursion_level, extended,
-   _config, list_last,
+   _config, _config_last,
opened_lst) < 0) {
   goto done;
 }
 
 *next = included_config;
-if (*list_last)
-  next = &(*list_last)->next;
-
+if (included_config_last) {
+  next = _config_last->next;
+  *list_last = included_config_last;
+}
   } SMARTLIST_FOREACH_END(config_file);
   *list = ret_list;
   rv = 0;
diff --git a/src/test/test_config.c b/src/test/test_config.c
index 0de6b1291..8f011ce1f 100644
--- a/src/test/test_config.c
+++ b/src/test/test_config.c
@@ -5287,6 +5287,73 @@ test_config_include_folder_order(void *data)
 }
 
 static void
+test_config_include_blank_file_last(void *data)
+{
+  (void)data;
+
+  config_line_t *result = NULL;
+  char *torrcd = NULL;
+  char *path = NULL;
+  char *dir = tor_strdup(get_fname("test_include_blank_file_last"));
+  tt_ptr_op(dir, OP_NE, NULL);
+
+#ifdef _WIN32
+  tt_int_op(mkdir(dir), OP_EQ, 0);
+#else
+  tt_int_op(mkdir(dir, 0700), OP_EQ, 0);
+#endif
+
+  tor_asprintf(, "%s"PATH_SEPARATOR"%s", dir, "torrc.d");
+
+#ifdef _WIN32
+  tt_int_op(mkdir(torrcd), OP_EQ, 0);
+#else
+  tt_int_op(mkdir(torrcd, 0700), OP_EQ, 0);
+#endif
+
+  tor_asprintf(, "%s"PATH_SEPARATOR"%s", torrcd, "aa_1st");
+  tt_int_op(write_str_to_file(path, "Test 1\n", 0), OP_EQ, 0);
+  tor_free(path);
+
+  tor_asprintf(, "%s"PATH_SEPARATOR"%s", torrcd, "bb_2nd");
+  tt_int_op(write_str_to_file(path, "Test 2\n", 0), OP_EQ, 0);
+  tor_free(path);
+
+  tor_asprintf(, "%s"PATH_SEPARATOR"%s", torrcd, "cc_comment");
+  tt_int_op(write_str_to_file(path, "# comment only\n", 0), OP_EQ, 0);
+  tor_free(path);
+
+  char torrc_contents[1000];
+  tor_snprintf(torrc_contents, sizeof(torrc_contents),
+   "%%include %s\n"
+   "Test 3\n",
+   torrcd);
+
+  int include_used;
+  tt_int_op(config_get_lines_include(torrc_contents, , 0, _used,
+NULL), OP_EQ, 0);
+  tt_ptr_op(result, OP_NE, NULL);
+  tt_int_op(include_used, OP_EQ, 1);
+
+  int len = 0;
+  config_line_t *next;
+  for (next = result; next != NULL; next = next->next) {
+char expected[10];
+tor_snprintf(expected, sizeof(expected), "%d", len + 1);
+tt_str_op(next->key, OP_EQ, "Test");
+tt_str_op(next->value, OP_EQ, expected);
+len++;
+  }
+  tt_int_op(len, OP_EQ, 3);
+
+ done:
+  config_free_lines(result);
+  tor_free(torrcd);
+  tor_free(path);
+  tor_free(dir);
+}
+
+static void
 test_config_include_path_syntax(void *data)
 {
   (void)data;
@@ -5848,6 +5915,7 @@ struct testcase_t config_tests[] = {
   CONFIG_TEST(include_recursion_before_after, 0),
   CONFIG_TEST(include_recursion_after_only, 0),
   CONFIG_TEST(include_folder_order, 0),
+  CONFIG_TEST(include_blank_file_last, 0),
   CONFIG_TEST(include_path_syntax, 0),
   CONFIG_TEST(include_not_processed, 0),
   CONFIG_TEST(include_has_include, 0),



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.2] Merge branch 'maint-0.4.0' into maint-0.4.1

2019-11-05 Thread teor
commit de6ceb0bee8c1bf56d8929940a109bdc2a2d7521
Merge: 4f9a00339 03e77ef03
Author: teor 
Date:   Wed Nov 6 11:19:46 2019 +1000

Merge branch 'maint-0.4.0' into maint-0.4.1

 changes/bug31408|  5 
 changes/bug31837|  5 
 src/lib/fs/conffile.c   | 10 +---
 src/test/test_config.c  | 68 +
 src/test/test_rebind.py | 16 +++-
 5 files changed, 93 insertions(+), 11 deletions(-)




___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/release-0.2.9] Treat an unexpected constant-sized VERSIONS cell as a PROTOCOL_WARN.

2019-11-05 Thread teor
commit 3c97ab3c24ba4a133377c7ec6ec89cc6903ffb2e
Author: Nick Mathewson 
Date:   Tue Sep 17 09:09:36 2019 -0400

Treat an unexpected constant-sized VERSIONS cell as a PROTOCOL_WARN.

We previously used tor_fragile_assert() to declare that this case
could not happen: VERSIONS cells are always supposed to be
variable-sized, right?

This is incorrect, though.  On a v1 link protocol connection, all
cells are fixed-sized.  There aren't supposed to be any VERSIONS
cells with this version of the protocol, but apparently, somebody
was messing up.  (The v1 link protocol is obsolete, so probably the
implementer responsible didn't mean to be using it.)

Fixes bug 31107.  Bugfix on 0.2.4.4-alpha, when we introduced a
tor_fragile_assert() for this case.
---
 changes/bug31107|  4 
 src/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/changes/bug31107 b/changes/bug31107
new file mode 100644
index 0..9652927c3
--- /dev/null
+++ b/changes/bug31107
@@ -0,0 +1,4 @@
+  o Minor bugfixes (logging, protocol violations):
+- Do not log a nonfatal assertion failure when receiving a VERSIONS
+  cell on a connection using the obsolete v1 link protocol. Log a
+  protocol_warn instead. Fixes bug 31107; bugfix on 0.2.4.4-alpha.
diff --git a/src/or/channeltls.c b/src/or/channeltls.c
index d44f71913..6f4e413dc 100644
--- a/src/or/channeltls.c
+++ b/src/or/channeltls.c
@@ -1098,7 +1098,15 @@ channel_tls_handle_cell(cell_t *cell, or_connection_t 
*conn)
   /* do nothing */
   break;
 case CELL_VERSIONS:
-  tor_fragile_assert();
+  /* A VERSIONS cell should always be a variable-length cell, and
+   * so should never reach this function (which handles constant-sized
+   * cells). But if the connection is using the (obsolete) v1 link
+   * protocol, all cells will be treated as constant-sized, and so
+   * it's possible we'll reach this code.
+   */
+  log_fn(LOG_PROTOCOL_WARN, LD_CHANNEL,
+ "Received unexpected VERSIONS cell on a channel using link "
+ "protocol %d; ignoring.", conn->link_proto);
   break;
 case CELL_NETINFO:
   ++stats_n_netinfo_cells_processed;



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.2] Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

2019-11-05 Thread teor
commit 0e2834a3718a3932cfe8d3148d203a0604451073
Merge: d2e4262eb 0614f8390
Author: teor 
Date:   Wed Nov 6 11:17:43 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

 changes/bug31408   |  5 
 src/lib/fs/conffile.c  | 10 +---
 src/test/test_config.c | 68 ++
 3 files changed, 79 insertions(+), 4 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.2] Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

2019-11-05 Thread teor
commit 4abfcb7997e4a753643fd969317c502efc6be06e
Merge: 0e2834a37 cf2b00d3f
Author: teor 
Date:   Wed Nov 6 11:18:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

 changes/bug31837|  5 +
 src/test/test_rebind.py | 16 +---
 2 files changed, 14 insertions(+), 7 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.2] util/map_anon_nofork: Add a cast to avoid passing -48 to memset

2019-11-05 Thread teor
commit 9b73088c14fe24a1554950363fb80468c695937f
Author: Nick Mathewson 
Date:   Thu Oct 3 07:21:25 2019 -0400

util/map_anon_nofork: Add a cast to avoid passing -48 to memset

This fixes coverity CID 1454593, and bug 31948. Bug not in any
released version of Tor.
---
 src/test/test_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index 6ecff6f1c..b4d8a4d76 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -6190,7 +6190,7 @@ test_util_map_anon_nofork(void *arg)
   tor_munmap_anonymous(ptr, sz);
   ptr = tor_mmap_anonymous(sz, ANONMAP_NOINHERIT, );
   tt_ptr_op(ptr, OP_NE, 0);
-  memset(ptr, TEST_VALUE, sz);
+  memset(ptr, (uint8_t)TEST_VALUE, sz);
 
   tt_int_op(0, OP_EQ, pipe(pipefd));
   pid_t child = fork();



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.2] Merge remote-tracking branch 'tor-github/pr/1342' into maint-0.2.9

2019-11-05 Thread teor
commit 0650bf3695ae2e118426f3f6ecf1f8a344562119
Merge: c06d540ff f0e412099
Author: teor 
Date:   Wed Nov 6 11:15:45 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1342' into maint-0.2.9

 changes/ticket31466  | 5 +
 src/or/connection_edge.c | 8 +---
 2 files changed, 10 insertions(+), 3 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.2] Merge branch 'maint-0.4.1' into maint-0.4.2

2019-11-05 Thread teor
commit 76fd872db88782c6bce1b539e27ba1d1ab88cbdb
Merge: 2395800d3 de6ceb0be
Author: teor 
Date:   Wed Nov 6 11:19:54 2019 +1000

Merge branch 'maint-0.4.1' into maint-0.4.2

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.2] Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

2019-11-05 Thread teor
commit 6bfdd096792194d1077a101a34859bff996c940e
Merge: 15d67842f bf4a27c0e
Author: teor 
Date:   Wed Nov 6 11:16:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

 changes/ticket31466   | 5 +
 src/core/or/connection_edge.c | 6 --
 2 files changed, 9 insertions(+), 2 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.2] Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5

2019-11-05 Thread teor
commit d2e4262ebc134f4c6ae9e702a14da45489575b4f
Merge: 6bfdd0967 2da4d64a6
Author: teor 
Date:   Wed Nov 6 11:17:01 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5

 changes/bug30916   |  4 
 src/feature/relay/router.c | 18 --
 2 files changed, 12 insertions(+), 10 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.2] Merge branch 'maint-0.3.5' into maint-0.4.0

2019-11-05 Thread teor
commit 03e77ef036e41486b8bfe138d11790c928f49f35
Merge: 54e2d0dc2 1bde356bf
Author: teor 
Date:   Wed Nov 6 11:19:38 2019 +1000

Merge branch 'maint-0.3.5' into maint-0.4.0

 changes/bug30916  |  4 +++
 changes/bug31107  |  4 +++
 changes/bug31408  |  5 
 changes/bug31837  |  5 
 changes/ticket31466   |  5 
 src/core/or/channeltls.c  | 10 ++-
 src/core/or/connection_edge.c |  6 ++--
 src/feature/relay/router.c| 18 +---
 src/lib/fs/conffile.c | 10 ---
 src/test/test_config.c| 68 +++
 src/test/test_rebind.py   | 16 +-
 11 files changed, 127 insertions(+), 24 deletions(-)




___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.1] Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

2019-11-05 Thread teor
commit c06d540ff9b507e0fa9749948fe406fb17dbee73
Merge: 752c35ca9 3c97ab3c2
Author: teor 
Date:   Wed Nov 6 11:14:53 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

 changes/bug31107|  4 
 src/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.2] Merge remote-tracking branch 'tor-github/pr/1374' into maint-0.4.1

2019-11-05 Thread teor
commit 4f9a0033920b21882c4b6eead3c1826ee8e9
Merge: 63aff4a43 9b73088c1
Author: teor 
Date:   Wed Nov 6 11:19:13 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1374' into maint-0.4.1

 changes/bug31897 | 3 +++
 src/test/test_util.c | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.2] Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

2019-11-05 Thread teor
commit c06d540ff9b507e0fa9749948fe406fb17dbee73
Merge: 752c35ca9 3c97ab3c2
Author: teor 
Date:   Wed Nov 6 11:14:53 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1330' into maint-0.2.9

 changes/bug31107|  4 
 src/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.1] Merge branch 'maint-0.4.0' into maint-0.4.1

2019-11-05 Thread teor
commit de6ceb0bee8c1bf56d8929940a109bdc2a2d7521
Merge: 4f9a00339 03e77ef03
Author: teor 
Date:   Wed Nov 6 11:19:46 2019 +1000

Merge branch 'maint-0.4.0' into maint-0.4.1

 changes/bug31408|  5 
 changes/bug31837|  5 
 src/lib/fs/conffile.c   | 10 +---
 src/test/test_config.c  | 68 +
 src/test/test_rebind.py | 16 +++-
 5 files changed, 93 insertions(+), 11 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.1] Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

2019-11-05 Thread teor
commit 6bfdd096792194d1077a101a34859bff996c940e
Merge: 15d67842f bf4a27c0e
Author: teor 
Date:   Wed Nov 6 11:16:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

 changes/ticket31466   | 5 +
 src/core/or/connection_edge.c | 6 --
 2 files changed, 9 insertions(+), 2 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.1] Merge branch 'maint-0.2.9' into maint-0.3.5

2019-11-05 Thread teor
commit 1bde356bf645f3c3d3b0a6e70c03e2baf9f89d26
Merge: 4abfcb799 0650bf369
Author: teor 
Date:   Wed Nov 6 11:19:30 2019 +1000

Merge branch 'maint-0.2.9' into maint-0.3.5

 changes/bug31107 |  4 
 src/core/or/channeltls.c | 10 +-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --cc src/core/or/channeltls.c
index 91a424728,0..4db283d20
mode 100644,00..100644
--- a/src/core/or/channeltls.c
+++ b/src/core/or/channeltls.c
@@@ -1,2477 -1,0 +1,2485 @@@
 +/* * Copyright (c) 2012-2019, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file channeltls.c
 + *
 + * \brief A concrete subclass of channel_t using or_connection_t to transfer
 + * cells between Tor instances.
 + *
 + * This module fills in the various function pointers in channel_t, to
 + * implement the channel_tls_t channels as used in Tor today.  These channels
 + * are created from channel_tls_connect() and
 + * channel_tls_handle_incoming(). Each corresponds 1:1 to or_connection_t
 + * object, as implemented in connection_or.c.  These channels transmit cells
 + * to the underlying or_connection_t by calling
 + * connection_or_write_*_cell_to_buf(), and receive cells from the underlying
 + * or_connection_t when connection_or_process_cells_from_inbuf() calls
 + * channel_tls_handle_*_cell().
 + *
 + * Here we also implement the server (responder) side of the v3+ Tor link
 + * handshake, which uses CERTS and AUTHENTICATE cell to negotiate versions,
 + * exchange expected and observed IP and time information, and bootstrap a
 + * level of authentication higher than we have gotten on the raw TLS
 + * handshake.
 + *
 + * NOTE: Since there is currently only one type of channel, there are probably
 + * more than a few cases where functionality that is currently in
 + * channeltls.c, connection_or.c, and channel.c ought to be divided up
 + * differently.  The right time to do this is probably whenever we introduce
 + * our next channel type.
 + **/
 +
 +/*
 + * Define this so channel.h gives us things only channel_t subclasses
 + * should touch.
 + */
 +#define TOR_CHANNEL_INTERNAL_
 +
 +#define CHANNELTLS_PRIVATE
 +
 +#include "core/or/or.h"
 +#include "core/or/channel.h"
 +#include "core/or/channeltls.h"
 +#include "core/or/circuitmux.h"
 +#include "core/or/circuitmux_ewma.h"
 +#include "core/or/command.h"
 +#include "app/config/config.h"
 +#include "core/mainloop/connection.h"
 +#include "core/or/connection_or.h"
 +#include "feature/control/control.h"
 +#include "feature/client/entrynodes.h"
 +#include "trunnel/link_handshake.h"
 +#include "core/or/relay.h"
 +#include "feature/stats/rephist.h"
 +#include "feature/relay/router.h"
 +#include "feature/relay/routermode.h"
 +#include "feature/nodelist/dirlist.h"
 +#include "core/or/scheduler.h"
 +#include "feature/nodelist/torcert.h"
 +#include "feature/nodelist/networkstatus.h"
 +#include "trunnel/channelpadding_negotiation.h"
 +#include "core/or/channelpadding.h"
 +
 +#include "core/or/cell_st.h"
 +#include "core/or/cell_queue_st.h"
 +#include "core/or/extend_info_st.h"
 +#include "core/or/or_connection_st.h"
 +#include "core/or/or_handshake_certs_st.h"
 +#include "core/or/or_handshake_state_st.h"
 +#include "feature/nodelist/routerinfo_st.h"
 +#include "core/or/var_cell_st.h"
 +
 +#include "lib/tls/tortls.h"
 +#include "lib/tls/x509.h"
 +
 +/** How many CELL_PADDING cells have we received, ever? */
 +uint64_t stats_n_padding_cells_processed = 0;
 +/** How many CELL_VERSIONS cells have we received, ever? */
 +uint64_t stats_n_versions_cells_processed = 0;
 +/** How many CELL_NETINFO cells have we received, ever? */
 +uint64_t stats_n_netinfo_cells_processed = 0;
 +/** How many CELL_VPADDING cells have we received, ever? */
 +uint64_t stats_n_vpadding_cells_processed = 0;
 +/** How many CELL_CERTS cells have we received, ever? */
 +uint64_t stats_n_certs_cells_processed = 0;
 +/** How many CELL_AUTH_CHALLENGE cells have we received, ever? */
 +uint64_t stats_n_auth_challenge_cells_processed = 0;
 +/** How many CELL_AUTHENTICATE cells have we received, ever? */
 +uint64_t stats_n_authenticate_cells_processed = 0;
 +/** How many CELL_AUTHORIZE cells have we received, ever? */
 +uint64_t stats_n_authorize_cells_processed = 0;
 +
 +/** Active listener, if any */
 +static channel_listener_t *channel_tls_listener = NULL;
 +
 +/* channel_tls_t method declarations */
 +
 +static void channel_tls_close_method(channel_t *chan);
 +static const char * channel_tls_describe_transport_method(channel_t *chan);
 +static void channel_tls_free_method(channel_t *chan);
 +static double channel_tls_get_overhead_estimate_method(channel_t *chan);
 +static int
 +channel_tls_get_remote_addr_method(channel_t *chan, tor_addr_t *addr_out);
 +static int
 +channel_tls_get_transport_name_method(channel_t *chan, char **transport_out);
 +static const char *
 +channel_tls_get_remote_descr_method(channel_t *chan, int flags);
 +static int 

[tor-commits] [tor/maint-0.4.1] Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

2019-11-05 Thread teor
commit 4abfcb7997e4a753643fd969317c502efc6be06e
Merge: 0e2834a37 cf2b00d3f
Author: teor 
Date:   Wed Nov 6 11:18:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

 changes/bug31837|  5 +
 src/test/test_rebind.py | 16 +---
 2 files changed, 14 insertions(+), 7 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.0] Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

2019-11-05 Thread teor
commit 4abfcb7997e4a753643fd969317c502efc6be06e
Merge: 0e2834a37 cf2b00d3f
Author: teor 
Date:   Wed Nov 6 11:18:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1354' into maint-0.3.5

 changes/bug31837|  5 +
 src/test/test_rebind.py | 16 +---
 2 files changed, 14 insertions(+), 7 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.1] test/rebind: Make control formatting and log parsing more robust

2019-11-05 Thread teor
commit cf2b00d3f50f3421c3c22777113e25d5f7812e67
Author: teor 
Date:   Tue Aug 6 01:33:14 2019 +1000

test/rebind: Make control formatting and log parsing more robust

* actually sleep when tor has not logged anything
* log at debug level when waiting for tor to log something
* backslash-replace bad UTF-8 characters in logs
* format control messages as ASCII: tor does not accept UTF-8 control 
commands

Fixes bug 31837; bugfix on 0.3.5.1-alpha.
---
 changes/bug31837|  5 +
 src/test/test_rebind.py | 16 +---
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/changes/bug31837 b/changes/bug31837
new file mode 100644
index 0..0f976edfe
--- /dev/null
+++ b/changes/bug31837
@@ -0,0 +1,5 @@
+  o Minor bugfixes (testing):
+- When testing port rebinding, don't busy-wait for tor to log. Instead,
+  actually sleep for a short time before polling again. Also improve the
+  formatting of control commands and log messages.
+  Fixes bug 31837; bugfix on 0.3.5.1-alpha.
diff --git a/src/test/test_rebind.py b/src/test/test_rebind.py
index 45ad1c546..30a587858 100644
--- a/src/test/test_rebind.py
+++ b/src/test/test_rebind.py
@@ -31,15 +31,17 @@ def wait_for_log(s):
 cutoff = time.time() + LOG_TIMEOUT
 while time.time() < cutoff:
 l = tor_process.stdout.readline()
-l = l.decode('utf8')
+l = l.decode('utf8', 'backslashreplace')
 if s in l:
 logging.info('Tor logged: "{}"'.format(l.strip()))
 return
-logging.info('Tor logged: "{}", waiting for "{}"'.format(l.strip(), s))
 # readline() returns a blank string when there is no output
 # avoid busy-waiting
-if len(s) == 0:
+if len(l) == 0:
+logging.debug('Tor has not logged anything, waiting for 
"{}"'.format(s))
 time.sleep(LOG_WAIT)
+else:
+logging.info('Tor logged: "{}", waiting for 
"{}"'.format(l.strip(), s))
 fail('Could not find "{}" in logs after {} seconds'.format(s, LOG_TIMEOUT))
 
 def pick_random_port():
@@ -119,18 +121,18 @@ if control_socket.connect_ex(('127.0.0.1', control_port)):
 tor_process.terminate()
 fail('Cannot connect to ControlPort')
 
-control_socket.sendall('AUTHENTICATE \r\n'.encode('utf8'))
-control_socket.sendall('SETCONF 
SOCKSPort=0.0.0.0:{}\r\n'.format(socks_port).encode('utf8'))
+control_socket.sendall('AUTHENTICATE \r\n'.encode('ascii'))
+control_socket.sendall('SETCONF 
SOCKSPort=0.0.0.0:{}\r\n'.format(socks_port).encode('ascii'))
 wait_for_log('Opened Socks listener')
 
 try_connecting_to_socksport()
 
-control_socket.sendall('SETCONF 
SOCKSPort=127.0.0.1:{}\r\n'.format(socks_port).encode('utf8'))
+control_socket.sendall('SETCONF 
SOCKSPort=127.0.0.1:{}\r\n'.format(socks_port).encode('ascii'))
 wait_for_log('Opened Socks listener')
 
 try_connecting_to_socksport()
 
-control_socket.sendall('SIGNAL HALT\r\n'.encode('utf8'))
+control_socket.sendall('SIGNAL HALT\r\n'.encode('ascii'))
 
 wait_for_log('exiting cleanly')
 logging.info('OK')



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.1] Merge branch 'maint-0.3.5' into maint-0.4.0

2019-11-05 Thread teor
commit 03e77ef036e41486b8bfe138d11790c928f49f35
Merge: 54e2d0dc2 1bde356bf
Author: teor 
Date:   Wed Nov 6 11:19:38 2019 +1000

Merge branch 'maint-0.3.5' into maint-0.4.0

 changes/bug30916  |  4 +++
 changes/bug31107  |  4 +++
 changes/bug31408  |  5 
 changes/bug31837  |  5 
 changes/ticket31466   |  5 
 src/core/or/channeltls.c  | 10 ++-
 src/core/or/connection_edge.c |  6 ++--
 src/feature/relay/router.c| 18 +---
 src/lib/fs/conffile.c | 10 ---
 src/test/test_config.c| 68 +++
 src/test/test_rebind.py   | 16 +-
 11 files changed, 127 insertions(+), 24 deletions(-)




___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.1] Merge remote-tracking branch 'tor-github/pr/1374' into maint-0.4.1

2019-11-05 Thread teor
commit 4f9a0033920b21882c4b6eead3c1826ee8e9
Merge: 63aff4a43 9b73088c1
Author: teor 
Date:   Wed Nov 6 11:19:13 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1374' into maint-0.4.1

 changes/bug31897 | 3 +++
 src/test/test_util.c | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.0] Merge branch 'maint-0.3.5' into maint-0.4.0

2019-11-05 Thread teor
commit 03e77ef036e41486b8bfe138d11790c928f49f35
Merge: 54e2d0dc2 1bde356bf
Author: teor 
Date:   Wed Nov 6 11:19:38 2019 +1000

Merge branch 'maint-0.3.5' into maint-0.4.0

 changes/bug30916  |  4 +++
 changes/bug31107  |  4 +++
 changes/bug31408  |  5 
 changes/bug31837  |  5 
 changes/ticket31466   |  5 
 src/core/or/channeltls.c  | 10 ++-
 src/core/or/connection_edge.c |  6 ++--
 src/feature/relay/router.c| 18 +---
 src/lib/fs/conffile.c | 10 ---
 src/test/test_config.c| 68 +++
 src/test/test_rebind.py   | 16 +-
 11 files changed, 127 insertions(+), 24 deletions(-)

___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.1] Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5

2019-11-05 Thread teor
commit d2e4262ebc134f4c6ae9e702a14da45489575b4f
Merge: 6bfdd0967 2da4d64a6
Author: teor 
Date:   Wed Nov 6 11:17:01 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1340' into maint-0.3.5

 changes/bug30916   |  4 
 src/feature/relay/router.c | 18 --
 2 files changed, 12 insertions(+), 10 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.1] Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

2019-11-05 Thread teor
commit 0e2834a3718a3932cfe8d3148d203a0604451073
Merge: d2e4262eb 0614f8390
Author: teor 
Date:   Wed Nov 6 11:17:43 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

 changes/bug31408   |  5 
 src/lib/fs/conffile.c  | 10 +---
 src/test/test_config.c | 68 ++
 3 files changed, 79 insertions(+), 4 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.0] Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

2019-11-05 Thread teor
commit 6bfdd096792194d1077a101a34859bff996c940e
Merge: 15d67842f bf4a27c0e
Author: teor 
Date:   Wed Nov 6 11:16:09 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1343' into maint-0.3.5

 changes/ticket31466   | 5 +
 src/core/or/connection_edge.c | 6 --
 2 files changed, 9 insertions(+), 2 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


[tor-commits] [tor/maint-0.4.0] Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

2019-11-05 Thread teor
commit 0e2834a3718a3932cfe8d3148d203a0604451073
Merge: d2e4262eb 0614f8390
Author: teor 
Date:   Wed Nov 6 11:17:43 2019 +1000

Merge remote-tracking branch 'tor-github/pr/1348' into maint-0.3.5

 changes/bug31408   |  5 
 src/lib/fs/conffile.c  | 10 +---
 src/test/test_config.c | 68 ++
 3 files changed, 79 insertions(+), 4 deletions(-)



___
tor-commits mailing list
tor-commits@lists.torproject.org
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits


  1   2   3   >