[tor-commits] [translation/tor-browser-manual] Update translations for tor-browser-manual

2017-10-27 Thread translation
commit d0385561190ee43ecf4380024e0e5462533c41e5
Author: Translation commit bot 
Date:   Sat Oct 28 05:50:31 2017 +

Update translations for tor-browser-manual
---
 id/id.po | 4 
 1 file changed, 4 insertions(+)

diff --git a/id/id.po b/id/id.po
index 063daf87b..3b6482303 100644
--- a/id/id.po
+++ b/id/id.po
@@ -1159,6 +1159,10 @@ msgid ""
 "icon at the top-left of the window, which allows you to control the "
 "JavaScript that runs on individual web pages, or to block it entirely."
 msgstr ""
+"Tor Browser memuat perangkat tambahan bernama NoScript, yang dapat diakses "
+"melalui ikon 'S' pada bagian kanan-atas jendela. Ini memperbolehkan anda "
+"untuk mengkontrol JavaScript pada  satu halaman situs atau memblokir secara "
+"keseluruhan"
 
 #. This is a reference to an external file such as an image or video. When
 #. the file changes, the md5 hash will change to let you know you need to

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


[tor-commits] [translation/tor-browser-manual] Update translations for tor-browser-manual

2017-10-27 Thread translation
commit f96b43d0d594ae12811acc629546347baa6809d7
Author: Translation commit bot 
Date:   Sat Oct 28 05:20:31 2017 +

Update translations for tor-browser-manual
---
 id/id.po | 38 +-
 1 file changed, 29 insertions(+), 9 deletions(-)

diff --git a/id/id.po b/id/id.po
index 06c5fa0d1..063daf87b 100644
--- a/id/id.po
+++ b/id/id.po
@@ -271,7 +271,7 @@ msgstr ""
 
 #: circumvention.page:22
 msgid "Using pluggable transports"
-msgstr "Menggunakan angkutan colok"
+msgstr "Menggunakan pluggable transports"
 
 #. This is a reference to an external file such as an image or video. When
 #. the file changes, the md5 hash will change to let you know you need to
@@ -300,9 +300,9 @@ msgid ""
 " clicking on the green onion near your address bar and selecting “Tor "
 "Network Settings”."
 msgstr ""
-"Anda juga bisa mengatur angkutan colok sembari Peramban Tor sedang berjalan,"
-" dengan menekan pada bawang berwarna hijau di dekat address bar dan memilih "
-"\"Tor Network Settings\""
+"Anda juga bisa mengatur pluggable transports sembari Tor Browser sedang "
+"berjalan, dengan menekan pada bawang berwarna hijau di dekat kolom alamat "
+"dan memilih \"Tor Network Settings\""
 
 #: circumvention.page:41
 msgid ""
@@ -335,7 +335,7 @@ msgstr ""
 
 #: circumvention.page:60
 msgid "Which transport should I use?"
-msgstr "Angkutan manakah yang sebaiknya saya gunakan?"
+msgstr "Transport manakah yang sebaiknya saya gunakan?"
 
 #: circumvention.page:61
 msgid ""
@@ -344,8 +344,8 @@ msgid ""
 "Transports page), and their effectiveness depends on your individual "
 "circumstances."
 msgstr ""
-"Setiap angkutan yang terdaftar dalam menu Peluncur Tor bekerja dengan cara "
-"berbeda (untuk detil, lihat lamanAngkutan "
+"Setiap transports yang terdaftar dalam menu Peluncur Tor bekerja dengan cara"
+" berbeda (untuk detil, lihat lamanAngkutan "
 "Colok), dan efektivitasnya bergantung pada keadaan anda."
 
 #: circumvention.page:67
@@ -973,6 +973,15 @@ msgid ""
 "or unlink your activity, nor does it affect your current connections to "
 "other websites."
 msgstr ""
+"Pilihan ini berguna jika 1) exit relay  2) anda menggunakan saat tidak dapat"
+" terhubung dengan situs yang ada inginkan, atau tidak berjalan dengan baik. "
+"Memilih itu akan menyebabkan tab yang aktif saat ini atau jendela yang "
+"sedang berjalan melalui sebuah sirkuit Tor yang baru. Tabs lain yang sedang "
+"terbuka dan jendela dari website yang sama akan menggunakan sirkuit yang "
+"baru demikian juga dengan yang sedang dijalankan. Opsi ini tidak akan "
+"menghilangkan setiap infomasi pribadi atau tidak menghubungkan aktivitas "
+"anda, tidak juga berdampak pada koneksi anda saat ini pada website yang "
+"lain. "
 
 #: onionsites.page:6
 msgid "Services that are only accessible using Tor"
@@ -1110,6 +1119,13 @@ msgid ""
 "operators, or to an outside observer. For this reason, Flash is disabled by "
 "default in Tor Browser, and enabling it is not recommended."
 msgstr ""
+"Situs web video, seperti Vimeo menggunakan plugin Flash Player untuk "
+"menampilkan konten video. Sayangnya, perangkat lunak ini beroperasi secara "
+"independen dari Tor Browser dan tidak dapat secara mudah untuk dibuat "
+"mentaati pengaturan proxy Tor Browser. Itu dapat menyingkap lokasi "
+"sebenarnya dan alamat IP anda kepada operator situs web, atau kepada "
+"pengamat dari luar. Untuk alasan ini, Flash dinonaktifkan secara bawaan di "
+"Tor Browser, dan tidak direkomendasikan untuk mengaktifkannya."
 
 #: plugins.page:23
 msgid ""
@@ -1154,6 +1170,8 @@ msgid ""
 "external ref='media/plugins/noscript_menu.png' "
 "md5='df9e684b76a3c2e2bdcb879a19c20471'"
 msgstr ""
+"external ref='media/plugins/noscript_menu.png' "
+"md5='df9e684b76a3c2e2bdcb879a19c20471'"
 
 #: plugins.page:47
 msgid ""
@@ -1167,7 +1185,7 @@ msgstr ""
 
 #: plugins.page:58
 msgid "Browser Add-ons"
-msgstr ""
+msgstr "Peraban Add-ons"
 
 #: plugins.page:59
 msgid ""
@@ -1193,7 +1211,7 @@ msgstr ""
 
 #: secure-connections.page:12
 msgid "Secure Connections"
-msgstr ""
+msgstr "Koneksi Aman"
 
 #: secure-connections.page:14
 msgid ""
@@ -1215,6 +1233,8 @@ msgid ""
 "external ref='media/secure-connections/https.png' "
 "md5='364bcbde7a649b0cea9ae178007c1a50'"
 msgstr ""
+"eksternal ref='media/secure-connections/https.png' "
+"md5='364bcbde7a649b0cea9ae178007c1a50'"
 
 #: secure-connections.page:26
 msgid ""

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


[tor-commits] [translation/tor-browser-manual] Update translations for tor-browser-manual

2017-10-27 Thread translation
commit a4c93bc6ba11932ae00bee315c9b2890b24aede8
Author: Translation commit bot 
Date:   Sat Oct 28 04:50:34 2017 +

Update translations for tor-browser-manual
---
 id/id.po | 55 +--
 1 file changed, 45 insertions(+), 10 deletions(-)

diff --git a/id/id.po b/id/id.po
index cfbac04cb..06c5fa0d1 100644
--- a/id/id.po
+++ b/id/id.po
@@ -9,7 +9,6 @@
 # Arif Budiman , 2016
 # hpiece 8 , 2017
 # Christian "crse" Elbrianno , 2017
-# Eljuno Kasih , 2017
 # adhisuryo i , 2017
 # Faisal Bustamam , 2017
 # Benyamin Adrianus Dos Santos , 2017
@@ -665,7 +664,7 @@ msgstr ""
 
 #: index.page:6
 msgid "Tor Browser User Manual"
-msgstr "Panduan Pengguna Peramban Tor"
+msgstr "Panduan Pengguna Tor Browser"
 
 #: known-issues.page:6
 msgid "A list of known issues."
@@ -673,7 +672,7 @@ msgstr "Daftar masalah yang diketahui."
 
 #: known-issues.page:10
 msgid "Known Issues"
-msgstr "Masalah yang di ketahui"
+msgstr "Masalah yang telah diketahui"
 
 #: known-issues.page:14
 msgid ""
@@ -723,6 +722,8 @@ msgid ""
 "The Tor Browser package is dated January 1, 2000 00:00:00 UTC. This is to "
 "ensure that each software build is exactly reproducible."
 msgstr ""
+"Paket Tor Browser bertanggal 1 Januari 2000 00:00:00 UTC. Hal ini untuk "
+"menjamin bahwa setiap perangkat lunak secara tepat dapat digandakan."
 
 #: known-issues.page:54
 msgid ""
@@ -808,7 +809,7 @@ msgstr ""
 "Tor Browser memusatkan aktifitas berinternet seputar hubungan anda dengan "
 "situs pada kolom URL. Bahkan jika anda terhubung dengan dua situs berbeda "
 "yang menggunakan layanan pelacak pihak ke tiga, Tor Browser akan memaksa "
-"konten untuk dilewati dua sirkit Tor yang berbeda, jadi orang yang melacak "
+"konten untuk dilewati dua sirkuit Tor yang berbeda, jadi orang yang melacak "
 "tidak mengetahui bahwa kedua koneksi tersebut berasal dari browser anda. "
 
 #: managing-identities.page:38
@@ -818,6 +819,10 @@ msgid ""
 "single website in separate tabs or windows, without any loss of "
 "functionality."
 msgstr ""
+"Disamping itu, setiap koneksi untuk alamat situs tunggal akan dibuat dengan "
+"sirkuit Tor yang sama, artinya anda dapat menjelajahi halaman yang berbeda "
+"pada sebuat situs tunggal pada tabs atau jendela yang berbeda, tanpa "
+"kehilangan satupun funsionalitas. "
 
 #. This is a reference to an external file such as an image or video. When
 #. the file changes, the md5 hash will change to let you know you need to
@@ -945,6 +950,13 @@ msgid ""
 "connections. Tor Browser will warn you that all activity and downloads will "
 "be stopped, so take this into account before clicking “New Identity”."
 msgstr ""
+"Pilihan ini berguna jika Anda ingin mencegah aktivitas browser Anda agar "
+"tidak terhubung dengan apa yang Anda lakukan sebelumnya. Memilihnya akan "
+"menutup semua tab dan jendela yang terbuka, menghapus semua informasi "
+"pribadi seperti cookies dan riwayat penjelajahan, dan menggunakan sirkuit "
+"Tor baru untuk semua koneksi. Browser Tor akan memperingatkan Anda bahwa "
+"semua aktivitas dan unduhan akan dihentikan, jadi pertimbangkanlah ini "
+"sebelum mengklik \"New Identity\"."
 
 #: managing-identities.page:123
 msgid "New Tor Circuit for this Site"
@@ -1030,6 +1042,8 @@ msgid ""
 "external ref='media/onionsites/onion_url.png' "
 "md5='f97f7fe10f07c3959c4430934974bbaa'"
 msgstr ""
+"external ref='media/onionsites/onion_url.png' "
+"md5='f97f7fe10f07c3959c4430934974bbaa'"
 
 #: onionsites.page:50
 msgid ""
@@ -1037,6 +1051,9 @@ msgid ""
 "service in order to connect to it. An onion address is a string of sixteen "
 "mostly random letters and numbers, followed by “.onion”."
 msgstr ""
+"Seperti situs web yang lain, anda perlu tahu alamat dari sebuah layanan "
+"onion untuk dapat terhubung. Sebuah alamat layanan onion berupa deretan enam"
+" belas huruf dan nomor acak, diakhiri dengan \".onion\"."
 
 #: onionsites.page:58 troubleshooting.page:10
 msgid "Troubleshooting"
@@ -1048,6 +1065,9 @@ msgid ""
 "entered the 16-character onion address correctly: even a small mistake will "
 "stop Tor Browser from being able to reach the site."
 msgstr ""
+"Bila anda tidak dapat menjangkau layanan onion yang anda inginkan, pastikan "
+"anda sudah memasukkan 16 karakter alamat onion secara tepat: sebuah "
+"kesalahan kecil akan menghentikan Tor Browser menjangkau situs tersebut."
 
 #: onionsites.page:64
 msgid ""
@@ -1055,6 +1075,9 @@ msgid ""
 "later. There may be a temporary connection issue, or the site operators may "
 "have allowed it to go offline without warning."
 msgstr ""
+"Bila anda tetap tidak dapat terhubung ke layanan onion, mohon coba kembali. "
+"Mungkin ada persoalan koneksi, atau operator situs membuatnya \"offline\" "
+"tanpa peringatan."
 
 #: onionsites.page:69
 

[tor-commits] [translation/tor-browser-manual] Update translations for tor-browser-manual

2017-10-27 Thread translation
commit e4c1c5501baa69966eba7c8ad965845c9cbd0eac
Author: Translation commit bot 
Date:   Sat Oct 28 04:20:34 2017 +

Update translations for tor-browser-manual
---
 id/id.po | 66 +---
 1 file changed, 51 insertions(+), 15 deletions(-)

diff --git a/id/id.po b/id/id.po
index 145cafef5..cfbac04cb 100644
--- a/id/id.po
+++ b/id/id.po
@@ -1,6 +1,6 @@
 # Translators:
 # zk , 2016
-# Mark Hiro , 2016
+# Yerry Borang , 2016
 # Irham Duilah , 2016
 # Jaya Wijaya , 2016
 # runasand , 2016
@@ -10,7 +10,6 @@
 # hpiece 8 , 2017
 # Christian "crse" Elbrianno , 2017
 # Eljuno Kasih , 2017
-# Yerry Borang , 2017
 # adhisuryo i , 2017
 # Faisal Bustamam , 2017
 # Benyamin Adrianus Dos Santos , 2017
@@ -31,7 +30,7 @@ msgstr ""
 #. Put one translator per line, in the form NAME , YEAR1, YEAR2
 msgctxt "_"
 msgid "translator-credits"
-msgstr "Kredit-Translator"
+msgstr "Penghargaan untuk Penerjemah"
 
 #: about-tor-browser.page:7
 msgid "Learn what Tor Browser can do to protect your privacy and anonymity"
@@ -374,7 +373,7 @@ msgstr ""
 
 #: downloading.page:7
 msgid "How to download Tor Browser"
-msgstr "Bagaimana mengunduh Peramban Tor"
+msgstr "Bagaimana mengunduh Tor Browser"
 
 #: downloading.page:10
 msgid "Downloading"
@@ -484,7 +483,7 @@ msgid ""
 "Satori is an add-on for the Chrome or Chromium browsers that allows you to "
 "download several security and privacy programs from different sources."
 msgstr ""
-"Satori adalah  sebuah tambahan untuk  browser chrome atau chromium yang "
+"Satori adalah  sebuah tambahan untuk  peramban chrome atau chromium yang "
 "mengijinkan anda mengunduh beberapa program keamanan dan privasi dari  "
 "sumber yang berbeda"
 
@@ -806,6 +805,11 @@ msgid ""
 " be served over two different Tor circuits, so the tracker will not know "
 "that both connections originate from your browser."
 msgstr ""
+"Tor Browser memusatkan aktifitas berinternet seputar hubungan anda dengan "
+"situs pada kolom URL. Bahkan jika anda terhubung dengan dua situs berbeda "
+"yang menggunakan layanan pelacak pihak ke tiga, Tor Browser akan memaksa "
+"konten untuk dilewati dua sirkit Tor yang berbeda, jadi orang yang melacak "
+"tidak mengetahui bahwa kedua koneksi tersebut berasal dari browser anda. "
 
 #: managing-identities.page:38
 msgid ""
@@ -964,25 +968,32 @@ msgstr "Layanan hanya bisa diakses menggunakan Tor"
 
 #: onionsites.page:10
 msgid "Onion Services"
-msgstr ""
+msgstr "Layanan Onion"
 
 #: onionsites.page:11
 msgid ""
 "Onion services (formerly known as “hidden services”) are services (like "
 "websites) that are only accessible through the Tor network."
 msgstr ""
+"Layanan Onion (sebelumnya diketahui sebagai \"hidden services (layanan "
+"tersembunyi)\" adalah layanan (seperti sebuah situs web) yang hanya bisa "
+"diakses melalui jaringan Tor"
 
 #: onionsites.page:16
 msgid ""
 "Onion services offer several advantages over ordinary services on the non-"
 "private web:"
 msgstr ""
+"Layanan Onion menawarkan beberapa keuntungan daripada layanan biasa pada "
+"situs web yang tidak privat."
 
 #: onionsites.page:23
 msgid ""
 "An onion services’s location and IP address are hidden, making it difficult 
"
 "for adversaries to censor it or identify its operators."
 msgstr ""
+"Lokasi dan alamat IP pada layanan onion tersembunyi, membuat penentang sulit"
+" untuk menyensor atau mengidentifikasi operator yang menjalankannya."
 
 #: onionsites.page:29
 msgid ""
@@ -990,6 +1001,9 @@ msgid ""
 " you do not need to worry about connecting"
 " over HTTPS."
 msgstr ""
+"Semua lalu lintas antara pengguna Tor dan layanan onion terenkripsi dari "
+"ujung ke ujung, jadi anda tidak perlu khawatir untukmenghubungkan melalui HTTPS"
 
 #: onionsites.page:36
 msgid ""
@@ -998,10 +1012,13 @@ msgid ""
 " that it is connecting to the right location and that the connection is not "
 "being tampered with."
 msgstr ""
+"Alamat dari layanan onion dihasilkan secara otomatis, oleh sebab itu "
+"operator tidak perlu membeli sebuah nama domain; URL .onion juga menjamin "
+"bahwa Tor terhubung ke lokasi yang tepat dan koneksinya tidak digelapkan."
 
 #: onionsites.page:46
 msgid "How to access an onion service"
-msgstr ""
+msgstr "Cara mengakses sebuah layanan onion"
 
 #. This is a reference to an external file such as an image or video. When
 #. the file changes, the md5 hash will change to let you know you need to
@@ -1202,28 +1219,33 @@ msgid ""
 "When both buttons are grey, you see the data that is visible to observers "
 "when you don't use either tool."
 msgstr ""
+"Saat masing-masing tombol berwarna 

[tor-commits] [translation/whisperback_completed] Update translations for whisperback_completed

2017-10-27 Thread translation
commit e55f0ecfb44e0631758427955621f949b2c0f9aa
Author: Translation commit bot 
Date:   Sat Oct 28 04:15:30 2017 +

Update translations for whisperback_completed
---
 id/id.po | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/id/id.po b/id/id.po
index 9bce7479b..fb0231cc9 100644
--- a/id/id.po
+++ b/id/id.po
@@ -19,7 +19,7 @@ msgstr ""
 "Project-Id-Version: The Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-03-20 12:09+\n"
-"PO-Revision-Date: 2017-09-26 12:32+\n"
+"PO-Revision-Date: 2017-10-28 03:56+\n"
 "Last-Translator: adhisuryo i \n"
 "Language-Team: Indonesian 
(http://www.transifex.com/otf/torproject/language/id/)\n"
 "MIME-Version: 1.0\n"

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


[tor-commits] [translation/whisperback] Update translations for whisperback

2017-10-27 Thread translation
commit 6fec843e2a5d9386fec44d87e55ecd8d8ae904ff
Author: Translation commit bot 
Date:   Sat Oct 28 04:15:25 2017 +

Update translations for whisperback
---
 id/id.po | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/id/id.po b/id/id.po
index 9bce7479b..fb0231cc9 100644
--- a/id/id.po
+++ b/id/id.po
@@ -19,7 +19,7 @@ msgstr ""
 "Project-Id-Version: The Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-03-20 12:09+\n"
-"PO-Revision-Date: 2017-09-26 12:32+\n"
+"PO-Revision-Date: 2017-10-28 03:56+\n"
 "Last-Translator: adhisuryo i \n"
 "Language-Team: Indonesian 
(http://www.transifex.com/otf/torproject/language/id/)\n"
 "MIME-Version: 1.0\n"

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


[tor-commits] [translation/tor-browser-manual] Update translations for tor-browser-manual

2017-10-27 Thread translation
commit 6fac6dee98f2f4e9cebd893115dd175c5185535e
Author: Translation commit bot 
Date:   Sat Oct 28 03:50:32 2017 +

Update translations for tor-browser-manual
---
 id/id.po | 92 +---
 1 file changed, 83 insertions(+), 9 deletions(-)

diff --git a/id/id.po b/id/id.po
index d04d32449..145cafef5 100644
--- a/id/id.po
+++ b/id/id.po
@@ -1,9 +1,10 @@
 # Translators:
 # zk , 2016
 # Mark Hiro , 2016
-# Rendiyono Wahyu Saputro , 2016
+# Irham Duilah , 2016
 # Jaya Wijaya , 2016
 # runasand , 2016
+# Rendiyono Wahyu Saputro , 2016
 # Lucas Susanto , 2016
 # Arif Budiman , 2016
 # hpiece 8 , 2017
@@ -11,7 +12,6 @@
 # Eljuno Kasih , 2017
 # Yerry Borang , 2017
 # adhisuryo i , 2017
-# Irham Duilah , 2017
 # Faisal Bustamam , 2017
 # Benyamin Adrianus Dos Santos , 2017
 # Dinar Lubis , 2017
@@ -616,6 +616,12 @@ msgid ""
 "xref=\"circumvention\">Circumvention screen to configure a pluggable "
 "transport."
 msgstr ""
+"Layar pertama menanyakan jika akses ke jaringan Tor di blokir atau di sensor"
+" pada koneksi anda. Jika anda tidak yakin hal ini menjadi kasus, pilih "
+"\"No\". Jika anda mengetahui bahwa jaringan di sensor, atau anda mencoba dan"
+" gagal terhubung dengan jaringan Tor dan tidak ada yang lain yang berhasil, "
+"pilih \"yes\". Anda akan dibawa pada 1) circumvention 2) layar untuk "
+"mengkonfigurasi pluggable transport"
 
 #: first-time.page:55
 msgid ""
@@ -746,6 +752,9 @@ msgid ""
 "./start-tor-browser.desktop\n"
 ""
 msgstr ""
+"\n"
+"./start-tor-browser.desktop\n"
+""
 
 #: managing-identities.page:6
 msgid "Learn how to control personally-identifying information in Tor Browser"
@@ -778,6 +787,12 @@ msgid ""
 " Browser includes some additional features that help you control what "
 "information can be tied to your identity."
 msgstr ""
+"Menggunakan jaringan Tor,  dapat menghentikan pengamat menemukan lokasi dan "
+"alamat IP anda yang sebenarnya, namun jika walaupun tanpa informasi tersebut"
+"  pengamat masih mungkin  dapat menghubungkan  lokasi aktifitas anda yang "
+"berbeda beda secara keseluruhan. Untuk tujuan ini, Tor Browser menyertakan "
+"beberapa fitur tambahan yang akan membantu anda mengkontrol informasi apa "
+"yang akan disertakan pada identitas anda. "
 
 #: managing-identities.page:29
 msgid "The URL bar"
@@ -818,10 +833,12 @@ msgid ""
 "You can see a diagram of the circuit that Tor Browser is using for the "
 "current tab in the onion menu."
 msgstr ""
+"Kamu dapat melihat diagram dari sirkuit yang digunakan Tor Browser pada tab "
+"saat ini di menu onion."
 
 #: managing-identities.page:55
 msgid "Logging in over Tor"
-msgstr ""
+msgstr "Masuk lebih dari Tor"
 
 #: managing-identities.page:56
 msgid ""
@@ -829,6 +846,10 @@ msgid ""
 "there may be situations in which it makes sense to use Tor with websites "
 "that require usernames, passwords, or other identifying information."
 msgstr ""
+"Meskipun Tor Browser dirancang untuk memungkinkan anonimitas total pengguna "
+"di web, mungkin ada situasi di mana masuk akal untuk menggunakan Tor dengan "
+"situs web yang memerlukan nama pengguna, kata sandi, atau informasi "
+"identitas lainnya."
 
 #: managing-identities.page:62
 msgid ""
@@ -839,6 +860,13 @@ msgid ""
 "you reveal to the websites you browse. Logging in using Tor Browser is also "
 "useful if the website you are trying to reach is censored on your network."
 msgstr ""
+"Bila kamu masuk ke sebuah situs menggunakan peramban reguler, kamu juga "
+"menunjukkan alamat IP dan lokasi geografis anda dalam prosesnya. Hal yang "
+"sama seringkali juga terjadi saat kamu mengirim surel. Masuk ke dalam media "
+"sosial atau akun surel anda menggunakan Tor Browser memungkinkan anda untuk "
+"memilih informasi mana yang ingin anda ungkap ke situs yang anda kunjungi. "
+"Masuk menggunakan Tor Browser juga berguna bila situs yang kamu coba untuk "
+"akses disensor pada jaringan anda."
 
 #: managing-identities.page:72
 msgid ""
@@ -853,6 +881,9 @@ msgid ""
 "See the Secure Connections page for"
 " important information on how to secure your connection when logging in."
 msgstr ""
+"Lihat halamanSecure "
+"Connectionsuntuk informasi penting tentang cara mengamankan koneksi "
+"Anda saat login."
 
 #: managing-identities.page:87
 msgid ""
@@ -863,10 +894,17 @@ msgid ""
 "following the site’s recommended procedure for account recovery, or "
 "contacting the operators and explaining the situation."
 msgstr ""
+"Tor Browser seringkali membuat koneksi anda seakan-akan datang 

[tor-commits] [translation/tor-browser-manual] Update translations for tor-browser-manual

2017-10-27 Thread translation
commit dcface8fbb6820fde4e8ea86bd9b735fbc74d6fc
Author: Translation commit bot 
Date:   Sat Oct 28 03:20:50 2017 +

Update translations for tor-browser-manual
---
 id/id.po | 37 ++---
 1 file changed, 30 insertions(+), 7 deletions(-)

diff --git a/id/id.po b/id/id.po
index 7230cd078..d04d32449 100644
--- a/id/id.po
+++ b/id/id.po
@@ -440,10 +440,16 @@ msgid ""
 "“32-bit” or “64-bit” software: this depends on the model of the 
computer you"
 " are using."
 msgstr ""
+"GetTor akan merespon dengan email yang memuat tautan dari sumber pengunduh "
+"paket Tor Browser, tanda tangan kriptografi (diperlukan untuk memverikasi "
+"unduhan), sidik jari pengguna utama yang akan digunakan untuk membuat tanda "
+"tangan, dan paket checksum. Anda akan di tawarkan dengan  dua pilihan  "
+"perangkat lunak: '32 bit\" atau 64 bit. Pilihan ini tergantung dengan model "
+"komputer yang anda gunakan"
 
 #: downloading.page:57
 msgid "To use GetTor via Twitter:"
-msgstr ""
+msgstr "Mengunakan GetTor melalui Twitter"
 
 #: downloading.page:62
 msgid ""
@@ -471,7 +477,7 @@ msgstr ""
 
 #: downloading.page:84
 msgid "Satori"
-msgstr ""
+msgstr "Satori"
 
 #: downloading.page:85
 msgid ""
@@ -693,7 +699,7 @@ msgstr "Sophos Antivirus untuk Mac"
 
 #: known-issues.page:32
 msgid "Microsoft Security Essentials"
-msgstr ""
+msgstr "Microsoft Security yang penting"
 
 #: known-issues.page:37
 msgid ""
@@ -730,6 +736,8 @@ msgid ""
 "Tor Browser can also be started from the command line by running the "
 "following command from inside the Tor Browser directory:"
 msgstr ""
+"Tor Browser bisa juga di mulai dari garis command dengan menjalankan "
+"perintah dari dalam direktori Tor Browser"
 
 #: known-issues.page:66
 #, no-wrap
@@ -756,6 +764,11 @@ msgid ""
 "trackers, and advertising beacons, all of which can link your activity "
 "across different sites."
 msgstr ""
+"Saat kamu terkoneksi ke sebuah situs, bukan hanya operator situs tersebut "
+"yang bisa merekam informasi mengenai kunjungan anda. Kebanyakan situs saat "
+"ini menggunakan banyak sekali layanan pihak ketiga, termasuk tombol \"Like\""
+" pada sosial media, analisis pelacak, dan suar iklan, yang semuanya bisa "
+"mengkaitkan aktivitasmu di situs yang berbeda."
 
 #: managing-identities.page:20
 msgid ""
@@ -768,7 +781,7 @@ msgstr ""
 
 #: managing-identities.page:29
 msgid "The URL bar"
-msgstr ""
+msgstr "Bar URL"
 
 #: managing-identities.page:30
 msgid ""
@@ -797,6 +810,8 @@ msgid ""
 "external ref='media/managing-identities/circuit_full.png' "
 "md5='bd46d22de952fee42643be46d3f95928'"
 msgstr ""
+"external ref='media/managing-identities/circuit_full.png' "
+"md5='bd46d22de952fee42643be46d3f95928'"
 
 #: managing-identities.page:48
 msgid ""
@@ -830,6 +845,8 @@ msgid ""
 "When you log in to a website over Tor, there are several points you should "
 "bear in mind:"
 msgstr ""
+"Ketika anda masuk ke sebuah website memakai TOR, ada sejumlah hal yang mesti"
+" anda ingat:"
 
 #: managing-identities.page:79
 msgid ""
@@ -900,7 +917,7 @@ msgstr ""
 
 #: onionsites.page:6
 msgid "Services that are only accessible using Tor"
-msgstr ""
+msgstr "Layanan hanya bisa diakses menggunakan Tor"
 
 #: onionsites.page:10
 msgid "Onion Services"
@@ -963,7 +980,7 @@ msgstr ""
 
 #: onionsites.page:58 troubleshooting.page:10
 msgid "Troubleshooting"
-msgstr ""
+msgstr "Tawaran solusi"
 
 #: onionsites.page:59
 msgid ""
@@ -1292,13 +1309,16 @@ msgstr ""
 
 #: transports.page:28
 msgid "obfs3"
-msgstr ""
+msgstr "obfs3"
 
 #: transports.page:33
 msgid ""
 "obfs3 makes Tor traffic look random, so that it does not look like Tor or "
 "any other protocol. obfs3 bridges will work in most places."
 msgstr ""
+"obfs3 membuat lalu lintas Tor tampak acak, jadi nantinya tidak akan tampak "
+"seperti Tor atau protokol lainnya. obfs3 bridges akan bekerja di banyak "
+"tempat."
 
 #: transports.page:42
 msgid "obfs4"
@@ -1310,6 +1330,9 @@ msgid ""
 "from finding bridges by Internet scanning. obfs4 bridges are less likely to "
 "be blocked than obfs3 bridges."
 msgstr ""
+"obfs4 membuat lalu lintas Tor tampak acak seperti obfs3, dan juga mencegah "
+"sensor dari menemukan bridges oleh pemindaian internet. obfs4 bridges "
+"sedikit mirip dalam blokir dibandingkan obfs3 bridges."
 
 #: transports.page:56
 msgid "Scramblesuit"

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


[tor-commits] [bridgedb/master] Merge branch 'release/0.5.0'

2017-10-27 Thread isis
commit 513cd253bf3c1a44cc005b7aef9253d6ac4954ac
Merge: a09089c 9495ae8
Author: Isis Lovecruft 
Date:   Sat Oct 28 00:27:42 2017 +

Merge branch 'release/0.5.0'

 .test.requirements.txt |   2 +-
 .travis.requirements.txt   |   4 +-
 .travis.yml|  20 ++--
 CHANGELOG  |  19 
 Makefile   |   2 +-
 bridgedb.conf  |   4 +-
 bridgedb/Bridges.py|  67 
 bridgedb/Main.py   |   8 +-
 bridgedb/Stability.py  |  10 +-
 bridgedb/Storage.py|  24 +
 bridgedb/bridgerequest.py  |   4 +-
 bridgedb/bridges.py|  14 ++-
 bridgedb/captcha.py|   6 +-
 bridgedb/crypto.py |   6 +-
 bridgedb/distribute.py |   4 +-
 bridgedb/email/autoresponder.py|   4 +-
 bridgedb/email/distributor.py  |   6 +-
 bridgedb/email/dkim.py |   4 +-
 bridgedb/email/request.py  |   4 +-
 bridgedb/email/server.py   |   4 +-
 bridgedb/email/templates.py|   4 +-
 bridgedb/filters.py|   4 +-
 bridgedb/geo.py|   2 +-
 bridgedb/https/distributor.py  |   6 +-
 bridgedb/https/request.py  |   4 +-
 bridgedb/https/server.py   |   4 +-
 bridgedb/interfaces.py |   4 +-
 bridgedb/parse/descriptors.py  |   4 +-
 bridgedb/parse/fingerprint.py  |   4 +-
 bridgedb/parse/nickname.py |   6 +-
 bridgedb/parse/versions.py |   6 +-
 bridgedb/persistent.py |   6 +-
 bridgedb/proxy.py  |   6 +-
 bridgedb/qrcodes.py|   4 +-
 bridgedb/runner.py |   6 +-
 bridgedb/safelog.py|   4 +-
 bridgedb/schedule.py   |   4 +-
 bridgedb/strings.py|   6 +-
 {test => bridgedb/test}/README |   0
 {test => bridgedb/test}/__init__.py|   0
 {test => bridgedb/test}/deprecated.py  |   6 +-
 {test => bridgedb/test}/email_helpers.py   |   4 +-
 {test => bridgedb/test}/https_helpers.py   |   4 +-
 {test => bridgedb/test}/legacy_Tests.py|   0
 {test => bridgedb/test}/test_Bucket.py |   4 +-
 {test => bridgedb/test}/test_Main.py   |   6 +-
 bridgedb/test/test_Storage.py  | 115 +
 {test => bridgedb/test}/test_Tests.py  |  10 +-
 {test => bridgedb/test}/test_bridgedb.py   |   4 +-
 {test => bridgedb/test}/test_bridgerequest.py  |   4 +-
 {test => bridgedb/test}/test_bridges.py|   4 +-
 {test => bridgedb/test}/test_captcha.py|   4 +-
 {test => bridgedb/test}/test_configure.py  |   4 +-
 {test => bridgedb/test}/test_crypto.py |  10 +-
 {test => bridgedb/test}/test_distribute.py |   4 +-
 .../test}/test_email_autoresponder.py  |   6 +-
 {test => bridgedb/test}/test_email_distributor.py  |   6 +-
 {test => bridgedb/test}/test_email_dkim.py |   0
 {test => bridgedb/test}/test_email_request.py  |   0
 {test => bridgedb/test}/test_email_server.py   |   6 +-
 {test => bridgedb/test}/test_email_templates.py|   0
 {test => bridgedb/test}/test_filters.py|   4 +-
 {test => bridgedb/test}/test_geo.py|   4 +-
 {test => bridgedb/test}/test_https.py  |  10 +-
 {test => bridgedb/test}/test_https_distributor.py  |  12 +--
 {test => bridgedb/test}/test_https_request.py  |   4 +-
 {test => bridgedb/test}/test_https_server.py   |  14 +--
 {test => bridgedb/test}/test_interfaces.py |   4 +-
 {test => bridgedb/test}/test_parse_addr.py |   0
 {test => bridgedb/test}/test_parse_descriptors.py  |   6 +-
 {test => bridgedb/test}/test_parse_headers.py  |   6 +-
 {test => bridgedb/test}/test_parse_nickname.py |   6 +-
 {test => bridgedb/test}/test_parse_options.py  |   4 +-
 {test => bridgedb/test}/test_parse_versions.py |   4 +-
 {test => bridgedb/test}/test_persistent.py |   0
 .../test}/test_persistentSaveAndLoad.py|   0
 {test => bridgedb/test}/test_proxy.py  |   6 +-
 {test => bridgedb/test}/test_qrcodes.py|   4 +-
 {test => 

[tor-commits] [bridgedb/master] Update copyright years to 2017.

2017-10-27 Thread isis
commit cccfc980bf5c3b1213f086d68d2fdcd07c5ace20
Author: Isis Lovecruft 
Date:   Fri Jul 7 02:14:11 2017 +

Update copyright years to 2017.
---
 bridgedb.conf   |  4 ++--
 bridgedb/Bridges.py |  2 +-
 bridgedb/Main.py|  8 
 bridgedb/Stability.py   | 10 +-
 bridgedb/bridgerequest.py   |  4 ++--
 bridgedb/bridges.py |  4 ++--
 bridgedb/captcha.py |  6 +++---
 bridgedb/crypto.py  |  6 +++---
 bridgedb/distribute.py  |  4 ++--
 bridgedb/email/autoresponder.py |  4 ++--
 bridgedb/email/distributor.py   |  6 +++---
 bridgedb/email/dkim.py  |  4 ++--
 bridgedb/email/request.py   |  4 ++--
 bridgedb/email/server.py|  4 ++--
 bridgedb/email/templates.py |  4 ++--
 bridgedb/filters.py |  4 ++--
 bridgedb/geo.py |  2 +-
 bridgedb/https/distributor.py   |  6 +++---
 bridgedb/https/request.py   |  4 ++--
 bridgedb/https/server.py|  4 ++--
 bridgedb/interfaces.py  |  4 ++--
 bridgedb/parse/descriptors.py   |  4 ++--
 bridgedb/parse/fingerprint.py   |  4 ++--
 bridgedb/parse/nickname.py  |  6 +++---
 bridgedb/parse/versions.py  |  6 +++---
 bridgedb/persistent.py  |  6 +++---
 bridgedb/proxy.py   |  6 +++---
 bridgedb/qrcodes.py |  4 ++--
 bridgedb/runner.py  |  6 +++---
 bridgedb/safelog.py |  4 ++--
 bridgedb/schedule.py|  4 ++--
 bridgedb/strings.py |  6 +++---
 bridgedb/translations.py|  4 ++--
 bridgedb/txrecaptcha.py |  4 ++--
 bridgedb/util.py|  6 +++---
 test/deprecated.py  |  6 +++---
 test/email_helpers.py   |  4 ++--
 test/https_helpers.py   |  4 ++--
 test/test_Bucket.py |  4 ++--
 test/test_Main.py   |  6 +++---
 test/test_Tests.py  |  6 +++---
 test/test_bridgerequest.py  |  4 ++--
 test/test_bridges.py|  4 ++--
 test/test_captcha.py|  4 ++--
 test/test_configure.py  |  4 ++--
 test/test_crypto.py |  6 +++---
 test/test_distribute.py |  4 ++--
 test/test_email_distributor.py  |  4 ++--
 test/test_filters.py|  4 ++--
 test/test_geo.py|  4 ++--
 test/test_https.py  |  4 ++--
 test/test_https_distributor.py  |  6 +++---
 test/test_https_request.py  |  4 ++--
 test/test_https_server.py   |  4 ++--
 test/test_interfaces.py |  4 ++--
 test/test_parse_descriptors.py  |  4 ++--
 test/test_parse_headers.py  |  6 +++---
 test/test_parse_nickname.py |  6 +++---
 test/test_parse_options.py  |  4 ++--
 test/test_parse_versions.py |  4 ++--
 test/test_proxy.py  |  6 +++---
 test/test_qrcodes.py|  4 ++--
 test/test_schedule.py   |  4 ++--
 test/test_translations.py   |  4 ++--
 test/test_txrecaptcha.py|  4 ++--
 test/test_util.py   |  6 +++---
 test/util.py|  6 +++---
 67 files changed, 158 insertions(+), 158 deletions(-)

diff --git a/bridgedb.conf b/bridgedb.conf
index 4c547f5..25a9cbf 100644
--- a/bridgedb.conf
+++ b/bridgedb.conf
@@ -13,8 +13,8 @@
 # :authors: The Tor Project, Inc.
 # :license: This file is freely distributed as part of BridgeDB, see LICENSE
 #   for details.
-# :copyright: (c) 2007-2015 The Tor Project, Inc.
-# (c) 2007-2015, all sentient entities within the AUTHORS file
+# :copyright: (c) 2007-2017 The Tor Project, Inc.
+# (c) 2007-2017, all sentient entities within the AUTHORS file
 # :version: 0.3.3
 
#===
 #
diff --git a/bridgedb/Bridges.py b/bridgedb/Bridges.py
index 7a237fe..ddfb447 100644
--- a/bridgedb/Bridges.py
+++ b/bridgedb/Bridges.py
@@ -3,7 +3,7 @@
 # This file is part of BridgeDB, a Tor bridge distribution system.
 #
 # :authors: see AUTHORS file
-# :copyright: (c) 2007-2015, The Tor Project, Inc.
+# :copyright: (c) 2007-2017, The Tor Project, Inc.
 # :license: 3-Clause BSD, see LICENSE for licensing information
 
 """This module has low-level functionality for parsing bridges and arranging
diff --git a/bridgedb/Main.py b/bridgedb/Main.py
index 4990904..4273653 100644
--- a/bridgedb/Main.py
+++ b/bridgedb/Main.py
@@ -3,10 +3,10 @@
 # This file is part of BridgeDB, a Tor bridge distribution system.
 #
 # :authors: please see the AUTHORS file for attributions
-# :copyright: (c) 2013-2015, Isis Lovecruft
-# (c) 2013-2015, Matthew Finkel
-# (c) 2007-2015, Nick Mathewson
-# (c) 2007-2015, The Tor Project, Inc.
+# :copyright: (c) 2013-2017, Isis Lovecruft
+# (c) 2013-2017, Matthew Finkel
+# (c) 2007-2017, Nick Mathewson
+# (c) 2007-2017, The Tor Project, Inc.
 # :license: see LICENSE for licensing information
 
 """This 

[tor-commits] [bridgedb/master] Update Twisted and PyOpenSSL dependency versions, also for CI.

2017-10-27 Thread isis
commit 0ae12639cfb045763241454c803ff0d8ded4f58d
Author: Isis Lovecruft 
Date:   Fri Jul 21 19:13:35 2017 +

Update Twisted and PyOpenSSL dependency versions, also for CI.

 * FIXES #22998: https://bugs.torproject.org/22998
---
 .travis.yml  | 20 +---
 requirements.txt |  4 ++--
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 4717c23..9fb68f3 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -35,22 +35,28 @@ env:
 # https://github.com/pypa/virtualenv/issues/459
 - PYTHON_EGG_CACHE="${HOME}/.python-eggs-$(echo $RANDOM$PPID$RANDOM | 
sha256sum | cut -d ' ' -f 1)"
   matrix:
-# Debian Jessie
-- TWISTED_VERSION=14.0.2 PYOPENSSL_VERSION=0.14
+# What we're running on polyanthum
+- TWISTED_VERSION=16.1.1 PYOPENSSL_VERSION=16.2.0
 # Debian Stretch
-- TWISTED_VERSION=16.1.1 PYOPENSSL_VERSION=16.0.0
+- TWISTED_VERSION=16.6.0 PYOPENSSL_VERSION=16.2.0
+# Debian experimental (all other versions of Debian have the same 
dependency versions right now)
+- TWISTED_VERSION=17.1.0 PYOPENSSL_VERSION=16.2.0
 
 matrix:
   include:
 - python: "pypy"
-  env: TWISTED_VERSION=14.0.2 PYOPENSSL_VERSION=0.14
+  env: TWISTED_VERSION=16.1.1 PYOPENSSL_VERSION=16.2.0
 - python: "pypy"
-  env: TWISTED_VERSION=16.1.1 PYOPENSSL_VERSION=16.0.0
+  env: TWISTED_VERSION=16.6.0 PYOPENSSL_VERSION=16.2.0
   allow_failures:
+- python: "2.7"
+  env: TWISTED_VERSION=16.6.0 PYOPENSSL_VERSION=16.2.0
+- python: "2.7"
+  env: TWISTED_VERSION=17.1.0 PYOPENSSL_VERSION=16.2.0
 - python: "pypy"
-  env: TWISTED_VERSION=14.0.2 PYOPENSSL_VERSION=0.14
+  env: TWISTED_VERSION=16.1.1 PYOPENSSL_VERSION=16.2.0
 - python: "pypy"
-  env: TWISTED_VERSION=16.1.1 PYOPENSSL_VERSION=16.0.0
+  env: TWISTED_VERSION=16.6.0 PYOPENSSL_VERSION=16.2.0
   fast_finish: true
 
 before_install:
diff --git a/requirements.txt b/requirements.txt
index 26c2c1a..644de6c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,10 +1,10 @@
 Babel==0.9.6
 BeautifulSoup==3.2.1
 Mako==0.8.1
-Twisted==14.0.2
+Twisted==16.1.1
 ipaddr==2.1.11
 pycrypto==2.6.1
-pyOpenSSL==0.14
+pyOpenSSL==16.2.0
 pygeoip==0.2.7
 gnupg==2.0.1
 pillow>=2.6.1



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


[tor-commits] [bridgedb/master] Merge branch 'feature/2017-update-year' into develop

2017-10-27 Thread isis
commit 38e9bb643a0cb1d5ad720bc4120086ae4ce3ab62
Merge: ab51b84 cccfc98
Author: Isis Lovecruft 
Date:   Fri Jul 7 02:23:29 2017 +

Merge branch 'feature/2017-update-year' into develop

 bridgedb.conf   |  4 ++--
 bridgedb/Bridges.py |  2 +-
 bridgedb/Main.py|  8 
 bridgedb/Stability.py   | 10 +-
 bridgedb/bridgerequest.py   |  4 ++--
 bridgedb/bridges.py |  4 ++--
 bridgedb/captcha.py |  6 +++---
 bridgedb/crypto.py  |  6 +++---
 bridgedb/distribute.py  |  4 ++--
 bridgedb/email/autoresponder.py |  4 ++--
 bridgedb/email/distributor.py   |  6 +++---
 bridgedb/email/dkim.py  |  4 ++--
 bridgedb/email/request.py   |  4 ++--
 bridgedb/email/server.py|  4 ++--
 bridgedb/email/templates.py |  4 ++--
 bridgedb/filters.py |  4 ++--
 bridgedb/geo.py |  2 +-
 bridgedb/https/distributor.py   |  6 +++---
 bridgedb/https/request.py   |  4 ++--
 bridgedb/https/server.py|  4 ++--
 bridgedb/interfaces.py  |  4 ++--
 bridgedb/parse/descriptors.py   |  4 ++--
 bridgedb/parse/fingerprint.py   |  4 ++--
 bridgedb/parse/nickname.py  |  6 +++---
 bridgedb/parse/versions.py  |  6 +++---
 bridgedb/persistent.py  |  6 +++---
 bridgedb/proxy.py   |  6 +++---
 bridgedb/qrcodes.py |  4 ++--
 bridgedb/runner.py  |  6 +++---
 bridgedb/safelog.py |  4 ++--
 bridgedb/schedule.py|  4 ++--
 bridgedb/strings.py |  6 +++---
 bridgedb/translations.py|  4 ++--
 bridgedb/txrecaptcha.py |  4 ++--
 bridgedb/util.py|  6 +++---
 test/deprecated.py  |  6 +++---
 test/email_helpers.py   |  4 ++--
 test/https_helpers.py   |  4 ++--
 test/test_Bucket.py |  4 ++--
 test/test_Main.py   |  6 +++---
 test/test_Tests.py  |  6 +++---
 test/test_bridgerequest.py  |  4 ++--
 test/test_bridges.py|  4 ++--
 test/test_captcha.py|  4 ++--
 test/test_configure.py  |  4 ++--
 test/test_crypto.py |  6 +++---
 test/test_distribute.py |  4 ++--
 test/test_email_distributor.py  |  4 ++--
 test/test_filters.py|  4 ++--
 test/test_geo.py|  4 ++--
 test/test_https.py  |  4 ++--
 test/test_https_distributor.py  |  6 +++---
 test/test_https_request.py  |  4 ++--
 test/test_https_server.py   |  4 ++--
 test/test_interfaces.py |  4 ++--
 test/test_parse_descriptors.py  |  4 ++--
 test/test_parse_headers.py  |  6 +++---
 test/test_parse_nickname.py |  6 +++---
 test/test_parse_options.py  |  4 ++--
 test/test_parse_versions.py |  4 ++--
 test/test_proxy.py  |  6 +++---
 test/test_qrcodes.py|  4 ++--
 test/test_schedule.py   |  4 ++--
 test/test_translations.py   |  4 ++--
 test/test_txrecaptcha.py|  4 ++--
 test/test_util.py   |  6 +++---
 test/util.py|  6 +++---
 67 files changed, 158 insertions(+), 158 deletions(-)



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


[tor-commits] [bridgedb/master] Merge branch 'fix/23033' into develop

2017-10-27 Thread isis
commit f824063aecb820e46441d54906b5af3d6e5e75d3
Merge: 5a67734 92a79ac
Author: Isis Lovecruft 
Date:   Tue Jul 25 22:32:00 2017 +

Merge branch 'fix/23033' into develop

 bridgedb/test/test_Tests.py   |  4 ++--
 bridgedb/test/test_bridgedb.py|  4 ++--
 bridgedb/test/test_crypto.py  |  4 ++--
 bridgedb/test/test_email_autoresponder.py |  6 +++---
 bridgedb/test/test_email_distributor.py   |  2 +-
 bridgedb/test/test_email_server.py|  6 +++---
 bridgedb/test/test_https.py   |  6 +++---
 bridgedb/test/test_https_distributor.py   |  6 +++---
 bridgedb/test/test_https_server.py| 10 +-
 bridgedb/test/test_parse_descriptors.py   |  2 +-
 bridgedb/test/test_smtp.py|  4 ++--
 bridgedb/test/test_translations.py|  2 +-
 12 files changed, 28 insertions(+), 28 deletions(-)



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


[tor-commits] [bridgedb/master] Merge branch 'fix/23034' into develop

2017-10-27 Thread isis
commit 5a67734e8986c39b96dab4ce25a16ab799cb30b5
Merge: 38e9bb6 31f6e51
Author: Isis Lovecruft 
Date:   Tue Jul 25 21:01:20 2017 +

Merge branch 'fix/23034' into develop

 Makefile  | 2 +-
 {test => bridgedb/test}/README| 0
 {test => bridgedb/test}/__init__.py   | 0
 {test => bridgedb/test}/deprecated.py | 0
 {test => bridgedb/test}/email_helpers.py  | 0
 {test => bridgedb/test}/https_helpers.py  | 0
 {test => bridgedb/test}/legacy_Tests.py   | 0
 {test => bridgedb/test}/test_Bucket.py| 0
 {test => bridgedb/test}/test_Main.py  | 0
 {test => bridgedb/test}/test_Storage.py   | 0
 {test => bridgedb/test}/test_Tests.py | 0
 {test => bridgedb/test}/test_bridgedb.py  | 0
 {test => bridgedb/test}/test_bridgerequest.py | 0
 {test => bridgedb/test}/test_bridges.py   | 0
 {test => bridgedb/test}/test_captcha.py   | 0
 {test => bridgedb/test}/test_configure.py | 0
 {test => bridgedb/test}/test_crypto.py| 0
 {test => bridgedb/test}/test_distribute.py| 0
 {test => bridgedb/test}/test_email_autoresponder.py   | 0
 {test => bridgedb/test}/test_email_distributor.py | 0
 {test => bridgedb/test}/test_email_dkim.py| 0
 {test => bridgedb/test}/test_email_request.py | 0
 {test => bridgedb/test}/test_email_server.py  | 0
 {test => bridgedb/test}/test_email_templates.py   | 0
 {test => bridgedb/test}/test_filters.py   | 0
 {test => bridgedb/test}/test_geo.py   | 0
 {test => bridgedb/test}/test_https.py | 0
 {test => bridgedb/test}/test_https_distributor.py | 0
 {test => bridgedb/test}/test_https_request.py | 0
 {test => bridgedb/test}/test_https_server.py  | 0
 {test => bridgedb/test}/test_interfaces.py| 0
 {test => bridgedb/test}/test_parse_addr.py| 0
 {test => bridgedb/test}/test_parse_descriptors.py | 0
 {test => bridgedb/test}/test_parse_headers.py | 0
 {test => bridgedb/test}/test_parse_nickname.py| 0
 {test => bridgedb/test}/test_parse_options.py | 0
 {test => bridgedb/test}/test_parse_versions.py| 0
 {test => bridgedb/test}/test_persistent.py| 0
 {test => bridgedb/test}/test_persistentSaveAndLoad.py | 0
 {test => bridgedb/test}/test_proxy.py | 0
 {test => bridgedb/test}/test_qrcodes.py   | 0
 {test => bridgedb/test}/test_safelog.py   | 0
 {test => bridgedb/test}/test_schedule.py  | 0
 {test => bridgedb/test}/test_smtp.py  | 0
 {test => bridgedb/test}/test_translations.py  | 0
 {test => bridgedb/test}/test_txrecaptcha.py   | 0
 {test => bridgedb/test}/test_util.py  | 0
 {test => bridgedb/test}/util.py   | 0
 setup.py  | 4 +++-
 49 files changed, 4 insertions(+), 2 deletions(-)



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


[tor-commits] [bridgedb/master] Add CHANGELOG entries for version 0.5.0.

2017-10-27 Thread isis
commit 9495ae881a622c4fb4e5e9cf052f896ca847d5e4
Author: Isis Lovecruft 
Date:   Sat Oct 28 00:26:27 2017 +

Add CHANGELOG entries for version 0.5.0.
---
 CHANGELOG | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index 57e67cf..316e45d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,22 @@
+Changes in version 0.5.0 - 2017-10-28
+
+* FIXES #23957 https://bugs.torproject.org/23957
+BridgeDB now supports bridge operators choosing how their bridge
+will be distributed.  See the "BridgeDistribution" torrc option in
+tor's manpage for details.
+
+* FIXES #16650 https://bugs.torproject.org/16650
+BridgeDB is now accessible via select remote user interfaces
+through a meek tunnel.
+
+* FIXES #22998 https://bugs.torproject.org/23033
+* FIXES #23033 https://bugs.torproject.org/23033
+* FIXES #23034 https://bugs.torproject.org/23034
+Upgrades BridgeDB to newer versions of Twisted and PyOpenSSL, and
+fixes several issues due to non-backwards compatible changes
+within those libraries.
+
+
 Changes in version 0.4.0 - 2017-01-09
 
 * FIXES #21162 https://bugs.torproject.org/21162



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


[tor-commits] [bridgedb/master] Add unittests for SQL to determine which distributor to allocate to.

2017-10-27 Thread isis
commit 48d4562f544c0635e0ce75a4151a68ff10c6908f
Author: Isis Lovecruft 
Date:   Fri Oct 27 23:30:24 2017 +

Add unittests for SQL to determine which distributor to allocate to.
---
 bridgedb/test/test_Storage.py | 69 +++
 1 file changed, 64 insertions(+), 5 deletions(-)

diff --git a/bridgedb/test/test_Storage.py b/bridgedb/test/test_Storage.py
index 8b0affd..dffba2b 100644
--- a/bridgedb/test/test_Storage.py
+++ b/bridgedb/test/test_Storage.py
@@ -1,17 +1,23 @@
 #!/usr/bin/env python
 """Unittests for the :mod:`bridgedb.Storage` module."""
 
+import os
+import threading
+import time
+
 from twisted.python import log
 from twisted.trial import unittest
-import bridgedb.Storage as Storage
 from twisted.internet import reactor
 from twisted.internet.threads import deferToThread
-import os
-import threading
-from time import sleep
+
+import bridgedb.Storage as Storage
+
+from bridgedb.test.util import generateFakeBridges
 
 class DatabaseTest(unittest.TestCase):
 def setUp(self):
+self.fakeBridges = generateFakeBridges()
+self.validRings = ['https', 'unallocated', 'email', 'moat']
 self.dbfname = 'test-bridgedb.sqlite'
 Storage.setDBFilename(self.dbfname)
 
@@ -22,7 +28,7 @@ class DatabaseTest(unittest.TestCase):
 
 def _runAndDie(self, timeout, func):
 with func():
-sleep(timeout)
+time.sleep(timeout)
 
 def _cb_assertTrue(self, result):
 self.assertTrue(result)
@@ -54,3 +60,56 @@ class DatabaseTest(unittest.TestCase):
 d2.addCallback(self._cb_assertFalse)
 d2.addErrback(self._eb_Failure)
 d2.addCallback(self._cb_assertTrue, Storage.getDB(False))
+
+def test_insertBridgeAndGetRing_new_bridge(self):
+bridge = self.fakeBridges[0]
+Storage.initializeDBLock()
+with Storage.getDB() as db:
+ringname = db.insertBridgeAndGetRing(bridge, 'moat',
+ time.time(),
+ self.validRings)
+self.assertIn(ringname, self.validRings)
+
+def test_insertBridgeAndGetRing_already_seen_bridge(self):
+bridge = self.fakeBridges[0]
+Storage.initializeDBLock()
+with Storage.getDB() as db:
+ringname = db.insertBridgeAndGetRing(bridge, 'moat',
+ time.time(),
+ self.validRings)
+self.assertIn(ringname, self.validRings)
+ringname = db.insertBridgeAndGetRing(bridge, 'https',
+ time.time(),
+ self.validRings)
+self.assertIn(ringname, self.validRings)
+self.assertEqual(ringname, 'moat')
+
+def test_getBridgeDistributor_recognised(self):
+bridge = self.fakeBridges[0]
+Storage.initializeDBLock()
+with Storage.getDB() as db:
+ringname = db.insertBridgeAndGetRing(bridge, 'moat',
+ time.time(),
+ self.validRings)
+self.assertIn(ringname, self.validRings)
+self.assertEqual(ringname, 'moat')
+db.commit()
+
+with Storage.getDB() as db:
+ringname = db.getBridgeDistributor(bridge, self.validRings)
+self.assertEqual(ringname, 'moat')
+
+def test_getBridgeDistributor_unrecognised(self):
+bridge = self.fakeBridges[0]
+Storage.initializeDBLock()
+with Storage.getDB() as db:
+ringname = db.insertBridgeAndGetRing(bridge, 'godzilla',
+ time.time(),
+ self.validRings)
+self.assertIn(ringname, self.validRings)
+self.assertEqual(ringname, "unallocated")
+db.commit()
+
+with Storage.getDB() as db:
+ringname = db.getBridgeDistributor(bridge, self.validRings)
+self.assertEqual(ringname, "unallocated")



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


[tor-commits] [bridgedb/master] Bump stem version to support bridge-distribution-request lines.

2017-10-27 Thread isis
commit d1354e56edf9303c62df65c0a38d060da8b6feb6
Author: Isis Lovecruft 
Date:   Thu Oct 26 22:42:07 2017 +

Bump stem version to support bridge-distribution-request lines.
---
 .travis.requirements.txt | 2 +-
 requirements.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.travis.requirements.txt b/.travis.requirements.txt
index 0c1dc95..de5e58a 100644
--- a/.travis.requirements.txt
+++ b/.travis.requirements.txt
@@ -28,5 +28,5 @@ gnupg==2.0.1
 pillow>=2.6.1
 qrcode==5.0.1
 service_identity==14.0.0
-git+https://git.torproject.org/stem.git@ba8cee36a0348c1509ad3562051723b7948e19ce#egg=stem-1.4.1.dev0-py2.7
+git+https://git.torproject.org/stem.git@3eb59411781c4fa210979cb112b800c001a59f6c#egg=stem-1.5.4.dev1-py2.7
 zope.interface==3.6.1
diff --git a/requirements.txt b/requirements.txt
index 644de6c..f60d817 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -10,5 +10,5 @@ gnupg==2.0.1
 pillow>=2.6.1
 qrcode==5.0.1
 service_identity==14.0.0
-git+https://git.torproject.org/stem.git@152fa89c33114619913d2be13e67adb4e55ce7ab#egg=stem-1.4.1.dev1-py2.7
+git+https://git.torproject.org/stem.git@3eb59411781c4fa210979cb112b800c001a59f6c#egg=stem-1.5.4.dev1-py2.7
 zope.interface==3.6.1



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


[tor-commits] [bridgedb/master] Merge branch 'feature/23957' into develop

2017-10-27 Thread isis
commit 96707e2f0d3c76d23549be236f7d56a22f23f84b
Merge: 9de0976 48d4562
Author: Isis Lovecruft 
Date:   Sat Oct 28 00:18:22 2017 +

Merge branch 'feature/23957' into develop

 .test.requirements.txt|  2 +-
 .travis.requirements.txt  |  4 +--
 bridgedb/Bridges.py   | 65 +---
 bridgedb/Storage.py   | 24 +++
 bridgedb/bridges.py   | 10 +++
 bridgedb/test/test_Storage.py | 69 +++
 requirements.txt  |  2 +-
 7 files changed, 150 insertions(+), 26 deletions(-)



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


[tor-commits] [bridgedb/master] Add support for respecting "bridge-distribution-request" lines.

2017-10-27 Thread isis
commit 75206116fe6f39538f522776a158ca79959a6e79
Author: Isis Lovecruft 
Date:   Fri Oct 27 02:16:30 2017 +

Add support for respecting "bridge-distribution-request" lines.

 * CLOSES #23957: https://bugs.torproject.org/23957
---
 bridgedb/Bridges.py | 65 +++--
 bridgedb/Storage.py | 24 
 bridgedb/bridges.py | 10 +
 3 files changed, 82 insertions(+), 17 deletions(-)

diff --git a/bridgedb/Bridges.py b/bridgedb/Bridges.py
index ddfb447..ac403b6 100644
--- a/bridgedb/Bridges.py
+++ b/bridgedb/Bridges.py
@@ -454,29 +454,60 @@ class BridgeSplitter(object):
 if not bridge.flags.running:
 return
 
-# Determine which ring to put this bridge in if we haven't seen it
-# before.
-pos = self.hmac(bridge.identity)
-n = int(pos[:8], 16) % self.totalP
-pos = bisect.bisect_right(self.pValues, n) - 1
-assert 0 <= pos < len(self.rings)
-ringname = self.rings[pos]
-logging.info("%s placing bridge %s into hashring %s (via n=%s, 
pos=%s)."
- % (self.__class__.__name__, bridge, ringname, n, pos))
-
 validRings = self.rings + self.pseudoRings
+distribution_method = None
 
+# If the bridge already has a distributor, use that.
 with bridgedb.Storage.getDB() as db:
-ringname = db.insertBridgeAndGetRing(bridge, ringname, 
time.time(), 
- validRings)
+distribution_method = db.getBridgeDistributor(bridge, validRings)
+
+if distribution_method:
+logging.info("%s bridge %s was already in hashring %s" %
+ (self.__class__.__name__, bridge, 
distribution_method))
+else:
+# Check if the bridge requested a specific distribution method.
+if bridge.distribution_request:
+distribution_method = bridge.distribution_request
+logging.info("%s bridge %s requested placement in hashring %s"
+ % (self.__class__.__name__, bridge,
+distribution_method))
+
+# If they requested not to be distributed, honor the request:
+if distribution_method == "none":
+logging.info("%s bridge %s requested to not be distributed."
+ % (self.__class__.__name__, bridge))
+return
+
+# If we didn't know what they are talking about, or they requested
+# "any" distribution method, and we've never seen this bridge
+# before, then determine where to place it.
+if ((distribution_method not in validRings) or
+(distribution_method == "any")):
+
+pos = self.hmac(bridge.identity)
+n = int(pos[:8], 16) % self.totalP
+pos = bisect.bisect_right(self.pValues, n) - 1
+assert 0 <= pos < len(self.rings)
+distribution_method = self.rings[pos]
+logging.info(("%s placing bridge %s into hashring %s (via 
n=%s,"
+  " pos=%s).") % (self.__class__.__name__, bridge,
+  distribution_method, n, pos))
+
+with bridgedb.Storage.getDB() as db:
+ringname = db.insertBridgeAndGetRing(bridge, distribution_method,
+ time.time(), validRings)
 db.commit()
 
-# Pseudo distributors are always held in the "unallocated" ring
-if ringname in self.pseudoRings:
-ringname = "unallocated"
+# Pseudo distributors are always held in the "unallocated" ring
+if ringname in self.pseudoRings:
+ringname = "unallocated"
+
+ring = self.ringsByName.get(ringname)
+ring.insert(bridge)
 
-ring = self.ringsByName.get(ringname)
-ring.insert(bridge)
+if ring is None:
+logging.warn("Couldn't recognise ring named: '%s'" % ringname)
+logging.info("Current rings: %s" % " ".join(self.ringsByName))
 
 def dumpAssignments(self, f, description=""):
 for name,ring in self.ringsByName.iteritems():
diff --git a/bridgedb/Storage.py b/bridgedb/Storage.py
index ea9d26b..4182c4b 100644
--- a/bridgedb/Storage.py
+++ b/bridgedb/Storage.py
@@ -145,6 +145,26 @@ class Database(object):
 self._cur.close()
 self._conn.close()
 
+def getBridgeDistributor(self, bridge, validRings):
+"""If a ``bridge`` is already in the database, get its distributor.
+
+:rtype: None or str
+:returns: The ``bridge`` distribution method, if one was
+already assigned, otherwise, returns None.
+"""
+distribution_method = None
+cur = self._cur
+
+cur.execute("SELECT id, distributor 

[tor-commits] [bridgedb/master] Bump leekspin version to 2.2.0.

2017-10-27 Thread isis
commit 163db1e141bd42601f4b05c50f609cfc0b17a760
Author: Isis Lovecruft 
Date:   Thu Oct 26 23:02:20 2017 +

Bump leekspin version to 2.2.0.
---
 .test.requirements.txt   | 2 +-
 .travis.requirements.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.test.requirements.txt b/.test.requirements.txt
index f48bba3..6a85c00 100644
--- a/.test.requirements.txt
+++ b/.test.requirements.txt
@@ -6,7 +6,7 @@
 # $ make coverage
 #
 coverage==4.2
-leekspin==1.1.4
+git+https://git.torproject.org/user/isis/leekspin.git@bad0bed11a9018f6b3c6998b26e2cb06f5b5#egg=leekspin-2.2.0.dev1-py2.7
 mechanize==0.2.5
 pep8==1.5.7
 # pylint must be pinned until pylint bug #203 is fixed. See
diff --git a/.travis.requirements.txt b/.travis.requirements.txt
index de5e58a..092d4f2 100644
--- a/.travis.requirements.txt
+++ b/.travis.requirements.txt
@@ -15,7 +15,7 @@
 #--
 coverage==4.2
 coveralls==0.4.2
-leekspin==1.1.4
+git+https://git.torproject.org/user/isis/leekspin.git@bad0bed11a9018f6b3c6998b26e2cb06f5b5#egg=leekspin-2.2.0.dev1-py2.7
 mechanize==0.2.5
 sure==1.2.2
 Babel==0.9.6



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


[tor-commits] [bridgedb/master] Merge branch 'master' into develop

2017-10-27 Thread isis
commit ab51b841590e422d81fe6138929ec52c9fe1167c
Merge: 62b17e8 a09089c
Author: Isis Lovecruft 
Date:   Mon Jan 9 19:59:05 2017 +

Merge branch 'master' into develop




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


[tor-commits] [bridgedb/master] Move tests back into bridgedb directory to fix `python setup.py test`.

2017-10-27 Thread isis
commit 31f6e514fd4bb647939c222b143c097ee24fa6d3
Author: Isis Lovecruft 
Date:   Tue Jul 25 20:47:23 2017 +

Move tests back into bridgedb directory to fix `python setup.py test`.

 * FIXES #23034.
---
 Makefile  | 2 +-
 {test => bridgedb/test}/README| 0
 {test => bridgedb/test}/__init__.py   | 0
 {test => bridgedb/test}/deprecated.py | 0
 {test => bridgedb/test}/email_helpers.py  | 0
 {test => bridgedb/test}/https_helpers.py  | 0
 {test => bridgedb/test}/legacy_Tests.py   | 0
 {test => bridgedb/test}/test_Bucket.py| 0
 {test => bridgedb/test}/test_Main.py  | 0
 {test => bridgedb/test}/test_Storage.py   | 0
 {test => bridgedb/test}/test_Tests.py | 0
 {test => bridgedb/test}/test_bridgedb.py  | 0
 {test => bridgedb/test}/test_bridgerequest.py | 0
 {test => bridgedb/test}/test_bridges.py   | 0
 {test => bridgedb/test}/test_captcha.py   | 0
 {test => bridgedb/test}/test_configure.py | 0
 {test => bridgedb/test}/test_crypto.py| 0
 {test => bridgedb/test}/test_distribute.py| 0
 {test => bridgedb/test}/test_email_autoresponder.py   | 0
 {test => bridgedb/test}/test_email_distributor.py | 0
 {test => bridgedb/test}/test_email_dkim.py| 0
 {test => bridgedb/test}/test_email_request.py | 0
 {test => bridgedb/test}/test_email_server.py  | 0
 {test => bridgedb/test}/test_email_templates.py   | 0
 {test => bridgedb/test}/test_filters.py   | 0
 {test => bridgedb/test}/test_geo.py   | 0
 {test => bridgedb/test}/test_https.py | 0
 {test => bridgedb/test}/test_https_distributor.py | 0
 {test => bridgedb/test}/test_https_request.py | 0
 {test => bridgedb/test}/test_https_server.py  | 0
 {test => bridgedb/test}/test_interfaces.py| 0
 {test => bridgedb/test}/test_parse_addr.py| 0
 {test => bridgedb/test}/test_parse_descriptors.py | 0
 {test => bridgedb/test}/test_parse_headers.py | 0
 {test => bridgedb/test}/test_parse_nickname.py| 0
 {test => bridgedb/test}/test_parse_options.py | 0
 {test => bridgedb/test}/test_parse_versions.py| 0
 {test => bridgedb/test}/test_persistent.py| 0
 {test => bridgedb/test}/test_persistentSaveAndLoad.py | 0
 {test => bridgedb/test}/test_proxy.py | 0
 {test => bridgedb/test}/test_qrcodes.py   | 0
 {test => bridgedb/test}/test_safelog.py   | 0
 {test => bridgedb/test}/test_schedule.py  | 0
 {test => bridgedb/test}/test_smtp.py  | 0
 {test => bridgedb/test}/test_translations.py  | 0
 {test => bridgedb/test}/test_txrecaptcha.py   | 0
 {test => bridgedb/test}/test_util.py  | 0
 {test => bridgedb/test}/util.py   | 0
 setup.py  | 4 +++-
 49 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 8aa92a3..906ce94 100644
--- a/Makefile
+++ b/Makefile
@@ -73,7 +73,7 @@ ifeq ($(PYTHON_IMPLEMENTATION),PyPy)
@echo "Detected PyPy... not running coverage."
python setup.py test
 else
-   coverage run --rcfile=".coveragerc" $(TRIAL) ./test/test_*.py
+   coverage run --rcfile=".coveragerc" $(TRIAL) ./bridgedb/test/test_*.py
coverage report --rcfile=".coveragerc"
 endif
 
diff --git a/test/README b/bridgedb/test/README
similarity index 100%
rename from test/README
rename to bridgedb/test/README
diff --git a/test/__init__.py b/bridgedb/test/__init__.py
similarity index 100%
rename from test/__init__.py
rename to bridgedb/test/__init__.py
diff --git a/test/deprecated.py b/bridgedb/test/deprecated.py
similarity index 100%
rename from test/deprecated.py
rename to bridgedb/test/deprecated.py
diff --git a/test/email_helpers.py b/bridgedb/test/email_helpers.py
similarity index 100%
rename from test/email_helpers.py
rename to bridgedb/test/email_helpers.py
diff --git a/test/https_helpers.py b/bridgedb/test/https_helpers.py
similarity index 100%
rename from test/https_helpers.py
rename to bridgedb/test/https_helpers.py
diff --git a/test/legacy_Tests.py b/bridgedb/test/legacy_Tests.py
similarity index 100%
rename from test/legacy_Tests.py
rename to bridgedb/test/legacy_Tests.py
diff --git a/test/test_Bucket.py b/bridgedb/test/test_Bucket.py
similarity index 100%
rename from test/test_Bucket.py
rename to bridgedb/test/test_Bucket.py
diff --git a/test/test_Main.py b/bridgedb/test/test_Main.py
similarity index 100%
rename from test/test_Main.py
rename to bridgedb/test/test_Main.py
diff --git a/test/test_Storage.py b/bridgedb/test/test_Storage.py
similarity index 100%
rename from test/test_Storage.py
rename to 

[tor-commits] [bridgedb/master] Merge branch 'fix/22998' into develop

2017-10-27 Thread isis
commit 9de09766c0c4fedea2db328a80fb7ecf8f7fd43e
Merge: f824063 0ae1263
Author: Isis Lovecruft 
Date:   Tue Jul 25 22:54:32 2017 +

Merge branch 'fix/22998' into develop

 .travis.yml  | 20 +---
 requirements.txt |  4 ++--
 2 files changed, 15 insertions(+), 9 deletions(-)



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


[tor-commits] [bridgedb/develop] Merge branch 'feature/23957' into develop

2017-10-27 Thread isis
commit 96707e2f0d3c76d23549be236f7d56a22f23f84b
Merge: 9de0976 48d4562
Author: Isis Lovecruft 
Date:   Sat Oct 28 00:18:22 2017 +

Merge branch 'feature/23957' into develop

 .test.requirements.txt|  2 +-
 .travis.requirements.txt  |  4 +--
 bridgedb/Bridges.py   | 65 +---
 bridgedb/Storage.py   | 24 +++
 bridgedb/bridges.py   | 10 +++
 bridgedb/test/test_Storage.py | 69 +++
 requirements.txt  |  2 +-
 7 files changed, 150 insertions(+), 26 deletions(-)



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


[tor-commits] [bridgedb/develop] Add CHANGELOG entries for version 0.5.0.

2017-10-27 Thread isis
commit 9495ae881a622c4fb4e5e9cf052f896ca847d5e4
Author: Isis Lovecruft 
Date:   Sat Oct 28 00:26:27 2017 +

Add CHANGELOG entries for version 0.5.0.
---
 CHANGELOG | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index 57e67cf..316e45d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,22 @@
+Changes in version 0.5.0 - 2017-10-28
+
+* FIXES #23957 https://bugs.torproject.org/23957
+BridgeDB now supports bridge operators choosing how their bridge
+will be distributed.  See the "BridgeDistribution" torrc option in
+tor's manpage for details.
+
+* FIXES #16650 https://bugs.torproject.org/16650
+BridgeDB is now accessible via select remote user interfaces
+through a meek tunnel.
+
+* FIXES #22998 https://bugs.torproject.org/23033
+* FIXES #23033 https://bugs.torproject.org/23033
+* FIXES #23034 https://bugs.torproject.org/23034
+Upgrades BridgeDB to newer versions of Twisted and PyOpenSSL, and
+fixes several issues due to non-backwards compatible changes
+within those libraries.
+
+
 Changes in version 0.4.0 - 2017-01-09
 
 * FIXES #21162 https://bugs.torproject.org/21162



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


[tor-commits] [bridgedb/master] Fix broken relative imports due to upgrading Twisted.

2017-10-27 Thread isis
commit 92a79ac4d6ae0ba4f8bd213a8449742f641d7e4b
Author: Isis Lovecruft 
Date:   Tue Jul 25 22:22:28 2017 +

Fix broken relative imports due to upgrading Twisted.

 * FIXES #23033
---
 bridgedb/test/test_Tests.py   |  4 ++--
 bridgedb/test/test_bridgedb.py|  4 ++--
 bridgedb/test/test_crypto.py  |  4 ++--
 bridgedb/test/test_email_autoresponder.py |  6 +++---
 bridgedb/test/test_email_distributor.py   |  2 +-
 bridgedb/test/test_email_server.py|  6 +++---
 bridgedb/test/test_https.py   |  6 +++---
 bridgedb/test/test_https_distributor.py   |  6 +++---
 bridgedb/test/test_https_server.py| 10 +-
 bridgedb/test/test_parse_descriptors.py   |  2 +-
 bridgedb/test/test_smtp.py|  4 ++--
 bridgedb/test/test_translations.py|  2 +-
 12 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/bridgedb/test/test_Tests.py b/bridgedb/test/test_Tests.py
index 79e0daa..41bd4ca 100644
--- a/bridgedb/test/test_Tests.py
+++ b/bridgedb/test/test_Tests.py
@@ -26,8 +26,8 @@ import os
 from twisted.python import monkey
 from twisted.trial import unittest
 
-from . import legacy_Tests as Tests
-from . import deprecated
+from bridgedb.test import legacy_Tests as Tests
+from bridgedb.test import deprecated
 
 
 logging.disable(50)
diff --git a/bridgedb/test/test_bridgedb.py b/bridgedb/test/test_bridgedb.py
index 00c231b..70c71f0 100644
--- a/bridgedb/test/test_bridgedb.py
+++ b/bridgedb/test/test_bridgedb.py
@@ -21,8 +21,8 @@ from twisted.trial import unittest
 from twisted.trial.unittest import FailTest
 from twisted.trial.unittest import SkipTest
 
-from .util import processExists
-from .util import getBridgeDBPID
+from bridgedb.test.util import processExists
+from bridgedb.test.util import getBridgeDBPID
 
 
 class BridgeDBCliTest(unittest.TestCase):
diff --git a/bridgedb/test/test_crypto.py b/bridgedb/test/test_crypto.py
index 3010b5c..10974bb 100644
--- a/bridgedb/test/test_crypto.py
+++ b/bridgedb/test/test_crypto.py
@@ -34,8 +34,8 @@ from bridgedb import crypto
 from bridgedb import txrecaptcha
 from bridgedb.persistent import Conf
 
-from .util import fileCheckDecorator
-from .email_helpers import _createConfig
+from bridgedb.test.util import fileCheckDecorator
+from bridgedb.test.email_helpers import _createConfig
 
 
 logging.disable(50)
diff --git a/bridgedb/test/test_email_autoresponder.py 
b/bridgedb/test/test_email_autoresponder.py
index 77fb77a..6bdac9e 100644
--- a/bridgedb/test/test_email_autoresponder.py
+++ b/bridgedb/test/test_email_autoresponder.py
@@ -27,9 +27,9 @@ from bridgedb.email import autoresponder
 from bridgedb.email.server import SMTPMessage
 from bridgedb.email.distributor import TooSoonEmail
 
-from .email_helpers import _createConfig
-from .email_helpers import _createMailServerContext
-from .email_helpers import DummyEmailDistributorWithState
+from bridgedb.test.email_helpers import _createConfig
+from bridgedb.test.email_helpers import _createMailServerContext
+from bridgedb.test.email_helpers import DummyEmailDistributorWithState
 
 
 class CreateResponseBodyTests(unittest.TestCase):
diff --git a/bridgedb/test/test_email_distributor.py 
b/bridgedb/test/test_email_distributor.py
index dd9997e..0d727b8 100644
--- a/bridgedb/test/test_email_distributor.py
+++ b/bridgedb/test/test_email_distributor.py
@@ -29,7 +29,7 @@ from bridgedb.parse.addr import BadEmail
 from bridgedb.parse.addr import UnsupportedDomain
 from bridgedb.parse.addr import normalizeEmail
 
-from .util import generateFakeBridges
+from bridgedb.test.util import generateFakeBridges
 
 logging.disable(50)
 
diff --git a/bridgedb/test/test_email_server.py 
b/bridgedb/test/test_email_server.py
index 3a3d62d..946133c 100644
--- a/bridgedb/test/test_email_server.py
+++ b/bridgedb/test/test_email_server.py
@@ -37,9 +37,9 @@ from bridgedb.email.distributor import TooSoonEmail
 from bridgedb.parse.addr import BadEmail
 from bridgedb.schedule import Unscheduled
 
-from . import util
-from .email_helpers import _createConfig
-from .email_helpers import _createMailServerContext
+from bridgedb.test import util
+from bridgedb.test.email_helpers import _createConfig
+from bridgedb.test.email_helpers import _createMailServerContext
 
 
 class SMTPMessageTests(unittest.TestCase):
diff --git a/bridgedb/test/test_https.py b/bridgedb/test/test_https.py
index c29d6b0..8432c20 100644
--- a/bridgedb/test/test_https.py
+++ b/bridgedb/test/test_https.py
@@ -38,9 +38,9 @@ from twisted.trial.reporter import TestResult
 from twisted.trial.unittest import FailTest
 from twisted.trial.unittest import SkipTest
 
-from .test_Tests import DynamicTestCaseMeta
-from .util import processExists
-from .util import getBridgeDBPID
+from bridgedb.test.test_Tests import DynamicTestCaseMeta
+from bridgedb.test.util import processExists
+from bridgedb.test.util import getBridgeDBPID
 
 
 HTTP_ROOT = 'http://127.0.0.1:6788'
diff --git 

[tor-commits] [bridgedb/develop] Merge branch 'release/0.5.0'

2017-10-27 Thread isis
commit 513cd253bf3c1a44cc005b7aef9253d6ac4954ac
Merge: a09089c 9495ae8
Author: Isis Lovecruft 
Date:   Sat Oct 28 00:27:42 2017 +

Merge branch 'release/0.5.0'

 .test.requirements.txt |   2 +-
 .travis.requirements.txt   |   4 +-
 .travis.yml|  20 ++--
 CHANGELOG  |  19 
 Makefile   |   2 +-
 bridgedb.conf  |   4 +-
 bridgedb/Bridges.py|  67 
 bridgedb/Main.py   |   8 +-
 bridgedb/Stability.py  |  10 +-
 bridgedb/Storage.py|  24 +
 bridgedb/bridgerequest.py  |   4 +-
 bridgedb/bridges.py|  14 ++-
 bridgedb/captcha.py|   6 +-
 bridgedb/crypto.py |   6 +-
 bridgedb/distribute.py |   4 +-
 bridgedb/email/autoresponder.py|   4 +-
 bridgedb/email/distributor.py  |   6 +-
 bridgedb/email/dkim.py |   4 +-
 bridgedb/email/request.py  |   4 +-
 bridgedb/email/server.py   |   4 +-
 bridgedb/email/templates.py|   4 +-
 bridgedb/filters.py|   4 +-
 bridgedb/geo.py|   2 +-
 bridgedb/https/distributor.py  |   6 +-
 bridgedb/https/request.py  |   4 +-
 bridgedb/https/server.py   |   4 +-
 bridgedb/interfaces.py |   4 +-
 bridgedb/parse/descriptors.py  |   4 +-
 bridgedb/parse/fingerprint.py  |   4 +-
 bridgedb/parse/nickname.py |   6 +-
 bridgedb/parse/versions.py |   6 +-
 bridgedb/persistent.py |   6 +-
 bridgedb/proxy.py  |   6 +-
 bridgedb/qrcodes.py|   4 +-
 bridgedb/runner.py |   6 +-
 bridgedb/safelog.py|   4 +-
 bridgedb/schedule.py   |   4 +-
 bridgedb/strings.py|   6 +-
 {test => bridgedb/test}/README |   0
 {test => bridgedb/test}/__init__.py|   0
 {test => bridgedb/test}/deprecated.py  |   6 +-
 {test => bridgedb/test}/email_helpers.py   |   4 +-
 {test => bridgedb/test}/https_helpers.py   |   4 +-
 {test => bridgedb/test}/legacy_Tests.py|   0
 {test => bridgedb/test}/test_Bucket.py |   4 +-
 {test => bridgedb/test}/test_Main.py   |   6 +-
 bridgedb/test/test_Storage.py  | 115 +
 {test => bridgedb/test}/test_Tests.py  |  10 +-
 {test => bridgedb/test}/test_bridgedb.py   |   4 +-
 {test => bridgedb/test}/test_bridgerequest.py  |   4 +-
 {test => bridgedb/test}/test_bridges.py|   4 +-
 {test => bridgedb/test}/test_captcha.py|   4 +-
 {test => bridgedb/test}/test_configure.py  |   4 +-
 {test => bridgedb/test}/test_crypto.py |  10 +-
 {test => bridgedb/test}/test_distribute.py |   4 +-
 .../test}/test_email_autoresponder.py  |   6 +-
 {test => bridgedb/test}/test_email_distributor.py  |   6 +-
 {test => bridgedb/test}/test_email_dkim.py |   0
 {test => bridgedb/test}/test_email_request.py  |   0
 {test => bridgedb/test}/test_email_server.py   |   6 +-
 {test => bridgedb/test}/test_email_templates.py|   0
 {test => bridgedb/test}/test_filters.py|   4 +-
 {test => bridgedb/test}/test_geo.py|   4 +-
 {test => bridgedb/test}/test_https.py  |  10 +-
 {test => bridgedb/test}/test_https_distributor.py  |  12 +--
 {test => bridgedb/test}/test_https_request.py  |   4 +-
 {test => bridgedb/test}/test_https_server.py   |  14 +--
 {test => bridgedb/test}/test_interfaces.py |   4 +-
 {test => bridgedb/test}/test_parse_addr.py |   0
 {test => bridgedb/test}/test_parse_descriptors.py  |   6 +-
 {test => bridgedb/test}/test_parse_headers.py  |   6 +-
 {test => bridgedb/test}/test_parse_nickname.py |   6 +-
 {test => bridgedb/test}/test_parse_options.py  |   4 +-
 {test => bridgedb/test}/test_parse_versions.py |   4 +-
 {test => bridgedb/test}/test_persistent.py |   0
 .../test}/test_persistentSaveAndLoad.py|   0
 {test => bridgedb/test}/test_proxy.py  |   6 +-
 {test => bridgedb/test}/test_qrcodes.py|   4 +-
 {test => 

[tor-commits] [bridgedb/develop] Merge branch 'master' into develop

2017-10-27 Thread isis
commit f23f3630321e4b98db7ef47dfb596eb06ad94abb
Merge: 96707e2 513cd25
Author: Isis Lovecruft 
Date:   Sat Oct 28 00:27:59 2017 +

Merge branch 'master' into develop

 CHANGELOG | 19 +++
 1 file changed, 19 insertions(+)

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


[tor-commits] [bridgedb/develop] Bump stem version to support bridge-distribution-request lines.

2017-10-27 Thread isis
commit d1354e56edf9303c62df65c0a38d060da8b6feb6
Author: Isis Lovecruft 
Date:   Thu Oct 26 22:42:07 2017 +

Bump stem version to support bridge-distribution-request lines.
---
 .travis.requirements.txt | 2 +-
 requirements.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.travis.requirements.txt b/.travis.requirements.txt
index 0c1dc95..de5e58a 100644
--- a/.travis.requirements.txt
+++ b/.travis.requirements.txt
@@ -28,5 +28,5 @@ gnupg==2.0.1
 pillow>=2.6.1
 qrcode==5.0.1
 service_identity==14.0.0
-git+https://git.torproject.org/stem.git@ba8cee36a0348c1509ad3562051723b7948e19ce#egg=stem-1.4.1.dev0-py2.7
+git+https://git.torproject.org/stem.git@3eb59411781c4fa210979cb112b800c001a59f6c#egg=stem-1.5.4.dev1-py2.7
 zope.interface==3.6.1
diff --git a/requirements.txt b/requirements.txt
index 644de6c..f60d817 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -10,5 +10,5 @@ gnupg==2.0.1
 pillow>=2.6.1
 qrcode==5.0.1
 service_identity==14.0.0
-git+https://git.torproject.org/stem.git@152fa89c33114619913d2be13e67adb4e55ce7ab#egg=stem-1.4.1.dev1-py2.7
+git+https://git.torproject.org/stem.git@3eb59411781c4fa210979cb112b800c001a59f6c#egg=stem-1.5.4.dev1-py2.7
 zope.interface==3.6.1



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


[tor-commits] [bridgedb/develop] Bump leekspin version to 2.2.0.

2017-10-27 Thread isis
commit 163db1e141bd42601f4b05c50f609cfc0b17a760
Author: Isis Lovecruft 
Date:   Thu Oct 26 23:02:20 2017 +

Bump leekspin version to 2.2.0.
---
 .test.requirements.txt   | 2 +-
 .travis.requirements.txt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.test.requirements.txt b/.test.requirements.txt
index f48bba3..6a85c00 100644
--- a/.test.requirements.txt
+++ b/.test.requirements.txt
@@ -6,7 +6,7 @@
 # $ make coverage
 #
 coverage==4.2
-leekspin==1.1.4
+git+https://git.torproject.org/user/isis/leekspin.git@bad0bed11a9018f6b3c6998b26e2cb06f5b5#egg=leekspin-2.2.0.dev1-py2.7
 mechanize==0.2.5
 pep8==1.5.7
 # pylint must be pinned until pylint bug #203 is fixed. See
diff --git a/.travis.requirements.txt b/.travis.requirements.txt
index de5e58a..092d4f2 100644
--- a/.travis.requirements.txt
+++ b/.travis.requirements.txt
@@ -15,7 +15,7 @@
 #--
 coverage==4.2
 coveralls==0.4.2
-leekspin==1.1.4
+git+https://git.torproject.org/user/isis/leekspin.git@bad0bed11a9018f6b3c6998b26e2cb06f5b5#egg=leekspin-2.2.0.dev1-py2.7
 mechanize==0.2.5
 sure==1.2.2
 Babel==0.9.6



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


[tor-commits] [bridgedb/develop] Add unittests for SQL to determine which distributor to allocate to.

2017-10-27 Thread isis
commit 48d4562f544c0635e0ce75a4151a68ff10c6908f
Author: Isis Lovecruft 
Date:   Fri Oct 27 23:30:24 2017 +

Add unittests for SQL to determine which distributor to allocate to.
---
 bridgedb/test/test_Storage.py | 69 +++
 1 file changed, 64 insertions(+), 5 deletions(-)

diff --git a/bridgedb/test/test_Storage.py b/bridgedb/test/test_Storage.py
index 8b0affd..dffba2b 100644
--- a/bridgedb/test/test_Storage.py
+++ b/bridgedb/test/test_Storage.py
@@ -1,17 +1,23 @@
 #!/usr/bin/env python
 """Unittests for the :mod:`bridgedb.Storage` module."""
 
+import os
+import threading
+import time
+
 from twisted.python import log
 from twisted.trial import unittest
-import bridgedb.Storage as Storage
 from twisted.internet import reactor
 from twisted.internet.threads import deferToThread
-import os
-import threading
-from time import sleep
+
+import bridgedb.Storage as Storage
+
+from bridgedb.test.util import generateFakeBridges
 
 class DatabaseTest(unittest.TestCase):
 def setUp(self):
+self.fakeBridges = generateFakeBridges()
+self.validRings = ['https', 'unallocated', 'email', 'moat']
 self.dbfname = 'test-bridgedb.sqlite'
 Storage.setDBFilename(self.dbfname)
 
@@ -22,7 +28,7 @@ class DatabaseTest(unittest.TestCase):
 
 def _runAndDie(self, timeout, func):
 with func():
-sleep(timeout)
+time.sleep(timeout)
 
 def _cb_assertTrue(self, result):
 self.assertTrue(result)
@@ -54,3 +60,56 @@ class DatabaseTest(unittest.TestCase):
 d2.addCallback(self._cb_assertFalse)
 d2.addErrback(self._eb_Failure)
 d2.addCallback(self._cb_assertTrue, Storage.getDB(False))
+
+def test_insertBridgeAndGetRing_new_bridge(self):
+bridge = self.fakeBridges[0]
+Storage.initializeDBLock()
+with Storage.getDB() as db:
+ringname = db.insertBridgeAndGetRing(bridge, 'moat',
+ time.time(),
+ self.validRings)
+self.assertIn(ringname, self.validRings)
+
+def test_insertBridgeAndGetRing_already_seen_bridge(self):
+bridge = self.fakeBridges[0]
+Storage.initializeDBLock()
+with Storage.getDB() as db:
+ringname = db.insertBridgeAndGetRing(bridge, 'moat',
+ time.time(),
+ self.validRings)
+self.assertIn(ringname, self.validRings)
+ringname = db.insertBridgeAndGetRing(bridge, 'https',
+ time.time(),
+ self.validRings)
+self.assertIn(ringname, self.validRings)
+self.assertEqual(ringname, 'moat')
+
+def test_getBridgeDistributor_recognised(self):
+bridge = self.fakeBridges[0]
+Storage.initializeDBLock()
+with Storage.getDB() as db:
+ringname = db.insertBridgeAndGetRing(bridge, 'moat',
+ time.time(),
+ self.validRings)
+self.assertIn(ringname, self.validRings)
+self.assertEqual(ringname, 'moat')
+db.commit()
+
+with Storage.getDB() as db:
+ringname = db.getBridgeDistributor(bridge, self.validRings)
+self.assertEqual(ringname, 'moat')
+
+def test_getBridgeDistributor_unrecognised(self):
+bridge = self.fakeBridges[0]
+Storage.initializeDBLock()
+with Storage.getDB() as db:
+ringname = db.insertBridgeAndGetRing(bridge, 'godzilla',
+ time.time(),
+ self.validRings)
+self.assertIn(ringname, self.validRings)
+self.assertEqual(ringname, "unallocated")
+db.commit()
+
+with Storage.getDB() as db:
+ringname = db.getBridgeDistributor(bridge, self.validRings)
+self.assertEqual(ringname, "unallocated")



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


[tor-commits] [bridgedb/develop] Add support for respecting "bridge-distribution-request" lines.

2017-10-27 Thread isis
commit 75206116fe6f39538f522776a158ca79959a6e79
Author: Isis Lovecruft 
Date:   Fri Oct 27 02:16:30 2017 +

Add support for respecting "bridge-distribution-request" lines.

 * CLOSES #23957: https://bugs.torproject.org/23957
---
 bridgedb/Bridges.py | 65 +++--
 bridgedb/Storage.py | 24 
 bridgedb/bridges.py | 10 +
 3 files changed, 82 insertions(+), 17 deletions(-)

diff --git a/bridgedb/Bridges.py b/bridgedb/Bridges.py
index ddfb447..ac403b6 100644
--- a/bridgedb/Bridges.py
+++ b/bridgedb/Bridges.py
@@ -454,29 +454,60 @@ class BridgeSplitter(object):
 if not bridge.flags.running:
 return
 
-# Determine which ring to put this bridge in if we haven't seen it
-# before.
-pos = self.hmac(bridge.identity)
-n = int(pos[:8], 16) % self.totalP
-pos = bisect.bisect_right(self.pValues, n) - 1
-assert 0 <= pos < len(self.rings)
-ringname = self.rings[pos]
-logging.info("%s placing bridge %s into hashring %s (via n=%s, 
pos=%s)."
- % (self.__class__.__name__, bridge, ringname, n, pos))
-
 validRings = self.rings + self.pseudoRings
+distribution_method = None
 
+# If the bridge already has a distributor, use that.
 with bridgedb.Storage.getDB() as db:
-ringname = db.insertBridgeAndGetRing(bridge, ringname, 
time.time(), 
- validRings)
+distribution_method = db.getBridgeDistributor(bridge, validRings)
+
+if distribution_method:
+logging.info("%s bridge %s was already in hashring %s" %
+ (self.__class__.__name__, bridge, 
distribution_method))
+else:
+# Check if the bridge requested a specific distribution method.
+if bridge.distribution_request:
+distribution_method = bridge.distribution_request
+logging.info("%s bridge %s requested placement in hashring %s"
+ % (self.__class__.__name__, bridge,
+distribution_method))
+
+# If they requested not to be distributed, honor the request:
+if distribution_method == "none":
+logging.info("%s bridge %s requested to not be distributed."
+ % (self.__class__.__name__, bridge))
+return
+
+# If we didn't know what they are talking about, or they requested
+# "any" distribution method, and we've never seen this bridge
+# before, then determine where to place it.
+if ((distribution_method not in validRings) or
+(distribution_method == "any")):
+
+pos = self.hmac(bridge.identity)
+n = int(pos[:8], 16) % self.totalP
+pos = bisect.bisect_right(self.pValues, n) - 1
+assert 0 <= pos < len(self.rings)
+distribution_method = self.rings[pos]
+logging.info(("%s placing bridge %s into hashring %s (via 
n=%s,"
+  " pos=%s).") % (self.__class__.__name__, bridge,
+  distribution_method, n, pos))
+
+with bridgedb.Storage.getDB() as db:
+ringname = db.insertBridgeAndGetRing(bridge, distribution_method,
+ time.time(), validRings)
 db.commit()
 
-# Pseudo distributors are always held in the "unallocated" ring
-if ringname in self.pseudoRings:
-ringname = "unallocated"
+# Pseudo distributors are always held in the "unallocated" ring
+if ringname in self.pseudoRings:
+ringname = "unallocated"
+
+ring = self.ringsByName.get(ringname)
+ring.insert(bridge)
 
-ring = self.ringsByName.get(ringname)
-ring.insert(bridge)
+if ring is None:
+logging.warn("Couldn't recognise ring named: '%s'" % ringname)
+logging.info("Current rings: %s" % " ".join(self.ringsByName))
 
 def dumpAssignments(self, f, description=""):
 for name,ring in self.ringsByName.iteritems():
diff --git a/bridgedb/Storage.py b/bridgedb/Storage.py
index ea9d26b..4182c4b 100644
--- a/bridgedb/Storage.py
+++ b/bridgedb/Storage.py
@@ -145,6 +145,26 @@ class Database(object):
 self._cur.close()
 self._conn.close()
 
+def getBridgeDistributor(self, bridge, validRings):
+"""If a ``bridge`` is already in the database, get its distributor.
+
+:rtype: None or str
+:returns: The ``bridge`` distribution method, if one was
+already assigned, otherwise, returns None.
+"""
+distribution_method = None
+cur = self._cur
+
+cur.execute("SELECT id, distributor 

[tor-commits] [translation/tor-browser-manual] Update translations for tor-browser-manual

2017-10-27 Thread translation
commit 1a796fecc441702de9e874685b0d711bb87d2b9d
Author: Translation commit bot 
Date:   Fri Oct 27 23:50:36 2017 +

Update translations for tor-browser-manual
---
 nl_BE/nl_BE.po | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/nl_BE/nl_BE.po b/nl_BE/nl_BE.po
index c85d17b47..2959987ce 100644
--- a/nl_BE/nl_BE.po
+++ b/nl_BE/nl_BE.po
@@ -1,11 +1,12 @@
 # Translators:
 # Katrien Igodt , 2016
+# Joren Vandeweyer , 2017
 msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "POT-Creation-Date: 2016-12-06 16:36-0600\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
-"Last-Translator: Katrien Igodt , 2016\n"
+"Last-Translator: Joren Vandeweyer , 2017\n"
 "Language-Team: Dutch (Belgium) 
(https://www.transifex.com/otf/teams/1519/nl_BE/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -491,7 +492,7 @@ msgstr ""
 
 #: index.page:6
 msgid "Tor Browser User Manual"
-msgstr ""
+msgstr "Tor Browser gebruikshandleiding"
 
 #: known-issues.page:6
 msgid "A list of known issues."

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


[tor-commits] [translation/torbutton-abouttorproperties_completed] Update translations for torbutton-abouttorproperties_completed

2017-10-27 Thread translation
commit b9d7c860d57fa5c4bafd205f3533e05fcf2d8e89
Author: Translation commit bot 
Date:   Fri Oct 27 23:48:37 2017 +

Update translations for torbutton-abouttorproperties_completed
---
 nl_BE/abouttor.properties | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/nl_BE/abouttor.properties b/nl_BE/abouttor.properties
index 157214c3e..e3612fa98 100644
--- a/nl_BE/abouttor.properties
+++ b/nl_BE/abouttor.properties
@@ -7,3 +7,14 @@ aboutTor.searchDDG.privacy=Zoekveilig metDuckD
 aboutTor.searchDDG.privacy.link=https://duckduckgo.com/privacy.html
 # The following string is a link which replaces %2$S above.
 aboutTor.searchDDG.search.link=https://duckduckgo.com/
+
+aboutTor.donationBanner.donate=Doneer nu!
+
+aboutTor.donationBanner.slogan=Tor: Digitale tegenspraak aanmoedigen
+aboutTor.donationBanner.mozilla=Geef vandaag en Mozilla zal u gift koppelen!
+
+aboutTor.donationBanner.tagline1=Beschermen van Journalisten, Whistleblowers, 
& Activisten sinds 2006
+aboutTor.donationBanner.tagline2=Wereldwijde Netwerk Vrijheid
+aboutTor.donationBanner.tagline3=Online Vrijheid
+aboutTor.donationBanner.tagline4=Bevorderen van gratis wereldwijde vrije mening
+aboutTor.donationBanner.tagline5=Bescherming van de privacy van miljoenen elke 
dag

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


[tor-commits] [translation/torbutton-abouttorproperties] Update translations for torbutton-abouttorproperties

2017-10-27 Thread translation
commit 9b6b6c2379f17065586aa983aa247a33d8fc3ba2
Author: Translation commit bot 
Date:   Fri Oct 27 23:48:32 2017 +

Update translations for torbutton-abouttorproperties
---
 nl_BE/abouttor.properties | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/nl_BE/abouttor.properties b/nl_BE/abouttor.properties
index 8936055a0..e3612fa98 100644
--- a/nl_BE/abouttor.properties
+++ b/nl_BE/abouttor.properties
@@ -8,13 +8,13 @@ 
aboutTor.searchDDG.privacy.link=https://duckduckgo.com/privacy.html
 # The following string is a link which replaces %2$S above.
 aboutTor.searchDDG.search.link=https://duckduckgo.com/
 
-aboutTor.donationBanner.donate=Donate Now!
+aboutTor.donationBanner.donate=Doneer nu!
 
-aboutTor.donationBanner.slogan=Tor: Powering Digital Resistance
-aboutTor.donationBanner.mozilla=Give today and Mozilla will match your gift!
+aboutTor.donationBanner.slogan=Tor: Digitale tegenspraak aanmoedigen
+aboutTor.donationBanner.mozilla=Geef vandaag en Mozilla zal u gift koppelen!
 
-aboutTor.donationBanner.tagline1=Protecting Journalists, Whistleblowers, & 
Activists Since 2006
-aboutTor.donationBanner.tagline2=Networking Freedom Worldwide
-aboutTor.donationBanner.tagline3=Freedom Online
-aboutTor.donationBanner.tagline4=Fostering Free Expression Worldwide
-aboutTor.donationBanner.tagline5=Protecting the Privacy of Millions Every Day
+aboutTor.donationBanner.tagline1=Beschermen van Journalisten, Whistleblowers, 
& Activisten sinds 2006
+aboutTor.donationBanner.tagline2=Wereldwijde Netwerk Vrijheid
+aboutTor.donationBanner.tagline3=Online Vrijheid
+aboutTor.donationBanner.tagline4=Bevorderen van gratis wereldwijde vrije mening
+aboutTor.donationBanner.tagline5=Bescherming van de privacy van miljoenen elke 
dag

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


[tor-commits] [translation/torbutton-brandproperties_completed] Update translations for torbutton-brandproperties_completed

2017-10-27 Thread translation
commit 712e8a952d2d3a0443d53439c3a39b7fe16efa5d
Author: Translation commit bot 
Date:   Fri Oct 27 23:47:25 2017 +

Update translations for torbutton-brandproperties_completed
---
 nl_BE/brand.properties | 16 
 1 file changed, 16 insertions(+)

diff --git a/nl_BE/brand.properties b/nl_BE/brand.properties
new file mode 100644
index 0..f4aa65987
--- /dev/null
+++ b/nl_BE/brand.properties
@@ -0,0 +1,16 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+brandShorterName=Tor Browser
+brandShortName=Tor Browser
+brandFullName=Tor Browser
+vendorShortName=Tor Project
+
+homePageSingleStartMain=Firefox Start, een snelle startpagina met ingebouwde 
zoekfunctie
+homePageImport=Importeer uw startpagina uit %S
+
+homePageMigrationPageTitle=Startpagina keuze
+homePageMigrationDescription=Selecteer de startpagina die je wil gebruiken:
+
+syncBrandShortName=Synchroniseer

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


[tor-commits] [translation/abouttor-homepage_completed] Update translations for abouttor-homepage_completed

2017-10-27 Thread translation
commit eb9877db3614fd5a0273ab4da300bad712f635c7
Author: Translation commit bot 
Date:   Fri Oct 27 23:47:14 2017 +

Update translations for abouttor-homepage_completed
---
 nl_BE/aboutTor.dtd | 19 ---
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/nl_BE/aboutTor.dtd b/nl_BE/aboutTor.dtd
index 980ac359a..af33fbad6 100644
--- a/nl_BE/aboutTor.dtd
+++ b/nl_BE/aboutTor.dtd
@@ -1,30 +1,25 @@
 
 
 
 
-
+
 
-
+
 
 
 
-
-
+
+
 
 
 
-
-
-
 
 
-
-https://startpage.com/rth/search;>
-https://duckduckgo.com/html/;>
+https://duckduckgo.com;>
 
 
 
@@ -34,6 +29,8 @@
 
 
 https://www.torproject.org/download/download.html.en#warning;>
+
+
 
 
 

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


[tor-commits] [translation/abouttor-homepage] Update translations for abouttor-homepage

2017-10-27 Thread translation
commit 8f7c533e82a85c56ecf7c99107a922f5084d95f1
Author: Translation commit bot 
Date:   Fri Oct 27 23:47:09 2017 +

Update translations for abouttor-homepage
---
 nl_BE/aboutTor.dtd | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/nl_BE/aboutTor.dtd b/nl_BE/aboutTor.dtd
index fca631e85..af33fbad6 100644
--- a/nl_BE/aboutTor.dtd
+++ b/nl_BE/aboutTor.dtd
@@ -6,14 +6,14 @@
 
 
 
-
+
 
 
 
 
 
-
-
+
+
 
 
 
@@ -30,7 +30,7 @@
 
 https://www.torproject.org/download/download.html.en#warning;>
 
-
+
 
 
 

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


[tor-commits] [translation/torbutton-brandproperties] Update translations for torbutton-brandproperties

2017-10-27 Thread translation
commit c6b5d17093d40c6d8778c33390565c359a1d4c77
Author: Translation commit bot 
Date:   Fri Oct 27 23:47:20 2017 +

Update translations for torbutton-brandproperties
---
 nl_BE/brand.properties | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/nl_BE/brand.properties b/nl_BE/brand.properties
index 732c15741..f4aa65987 100644
--- a/nl_BE/brand.properties
+++ b/nl_BE/brand.properties
@@ -7,10 +7,10 @@ brandShortName=Tor Browser
 brandFullName=Tor Browser
 vendorShortName=Tor Project
 
-homePageSingleStartMain=Firefox Start, a fast home page with built-in search
-homePageImport=Import your home page from %S
+homePageSingleStartMain=Firefox Start, een snelle startpagina met ingebouwde 
zoekfunctie
+homePageImport=Importeer uw startpagina uit %S
 
-homePageMigrationPageTitle=Home Page Selection
-homePageMigrationDescription=Please select the home page you wish to use:
+homePageMigrationPageTitle=Startpagina keuze
+homePageMigrationDescription=Selecteer de startpagina die je wil gebruiken:
 
-syncBrandShortName=Sync
+syncBrandShortName=Synchroniseer

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


[tor-commits] [translation/tails-misc] Update translations for tails-misc

2017-10-27 Thread translation
commit 569b63e0b022415b1106a8e996e3316360cf7177
Author: Translation commit bot 
Date:   Fri Oct 27 23:17:02 2017 +

Update translations for tails-misc
---
 nl_BE.po | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/nl_BE.po b/nl_BE.po
index be1ee8c6d..06f959739 100644
--- a/nl_BE.po
+++ b/nl_BE.po
@@ -3,14 +3,15 @@
 # This file is distributed under the same license as the PACKAGE package.
 # 
 # Translators:
+# Joren Vandeweyer , 2017
 # Katrien Igodt , 2015
 msgid ""
 msgstr ""
 "Project-Id-Version: The Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-09-13 20:10+0200\n"
-"PO-Revision-Date: 2017-09-19 23:00+\n"
-"Last-Translator: carolyn \n"
+"PO-Revision-Date: 2017-10-27 22:55+\n"
+"Last-Translator: Joren Vandeweyer \n"
 "Language-Team: Dutch (Belgium) 
(http://www.transifex.com/otf/torproject/language/nl_BE/)\n"
 "MIME-Version: 1.0\n"
 "Content-Type: text/plain; charset=UTF-8\n"
@@ -336,4 +337,4 @@ msgstr ""
 
 #: 
../config/chroot_local-includes/usr/share/polkit-1/actions/org.boum.tails.root-terminal.policy.in.h:1
 msgid "To start a Root Terminal, you need to authenticate."
-msgstr ""
+msgstr "Om een Root Terminal te starten, moet u eerst authenticeren."

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


[tor-commits] [tor/master] remove errant ;

2017-10-27 Thread nickm
commit 7515eefb70c03ed4508aac97ccbd0f7eed179d92
Author: Nick Mathewson 
Date:   Fri Oct 27 17:58:50 2017 -0400

remove errant ;
---
 src/or/protover_rust.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/or/protover_rust.c b/src/or/protover_rust.c
index 27f19c5fe..0c409b168 100644
--- a/src/or/protover_rust.c
+++ b/src/or/protover_rust.c
@@ -13,7 +13,7 @@
 #ifdef HAVE_RUST
 
 /* Define for compatibility, used in main.c */
-void protover_free_all(void) {};
+void protover_free_all(void) {}
 
 #endif
 

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


[tor-commits] [translation/tails-misc] Update translations for tails-misc

2017-10-27 Thread translation
commit 5e02b46c05f7864827de56d54cc9f0afece9f852
Author: Translation commit bot 
Date:   Fri Oct 27 20:47:10 2017 +

Update translations for tails-misc
---
 lt.po | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lt.po b/lt.po
index 847f8505d..c190aff61 100644
--- a/lt.po
+++ b/lt.po
@@ -10,7 +10,7 @@ msgstr ""
 "Project-Id-Version: The Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-09-13 20:10+0200\n"
-"PO-Revision-Date: 2017-09-19 18:35+\n"
+"PO-Revision-Date: 2017-10-27 20:32+\n"
 "Last-Translator: carolyn \n"
 "Language-Team: Lithuanian 
(http://www.transifex.com/otf/torproject/language/lt/)\n"
 "MIME-Version: 1.0\n"

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


[tor-commits] [tor/master] remove changes files from <= 0.3.2

2017-10-27 Thread nickm
commit afe555aebc6aa29579b62971ef4cb243584da320
Author: Nick Mathewson 
Date:   Fri Oct 27 16:22:09 2017 -0400

remove changes files from <= 0.3.2
---
 changes/bug20532  | 4 
 changes/bug21509  | 3 ---
 changes/bug23653  | 7 ---
 changes/bug23670  | 3 ---
 changes/bug23678  | 7 ---
 changes/bug23739  | 3 ---
 changes/bug23741  | 4 
 changes/bug23748  | 5 -
 changes/bug23755  | 4 
 changes/bug23757  | 4 
 changes/bug23758  | 4 
 changes/bug23790  | 6 --
 changes/bug23862  | 5 -
 changes/bug23874  | 3 ---
 changes/bug23952  | 4 
 changes/bug24002  | 5 -
 changes/feature18329  | 9 -
 changes/geoip-october2017 | 4 
 changes/longclaw_23592| 3 ---
 changes/ticket23910   | 3 ---
 20 files changed, 90 deletions(-)

diff --git a/changes/bug20532 b/changes/bug20532
deleted file mode 100644
index 7c190ea03..0
--- a/changes/bug20532
+++ /dev/null
@@ -1,4 +0,0 @@
-  o Minor bugfixes (bridges):
-- Overwrite the bridge address earlier in the process of directly
-  retrieving its descriptor, to make sure we reach it on the configured
-  address.  Fixes bug 20532; bugfix on 0.2.0.10-alpha.
diff --git a/changes/bug21509 b/changes/bug21509
deleted file mode 100644
index 593a01ef2..0
--- a/changes/bug21509
+++ /dev/null
@@ -1,3 +0,0 @@
-  o Minor bugfixes (hidden service v3, fuzzing):
-- Fix the hidden service v3 descriptor decoding fuzzing to use the latest
-  decoding API correctly. Fixes bug 21509; bugfix on 0.3.2.1-alpha.
diff --git a/changes/bug23653 b/changes/bug23653
deleted file mode 100644
index 81760cbb8..0
--- a/changes/bug23653
+++ /dev/null
@@ -1,7 +0,0 @@
-  o Minor bugfixes (hidden service client):
-- When getting multiple SOCKS request for the same .onion address, don't
-  trigger multiple descriptor fetches.
-- When the descriptor fetch fails with an internal error, no more HSDir to
-  query or we aren't allowed to fetch (FetchHidServDescriptors 0), close
-  all pending SOCKS request for that .onion. Fixes bug 23653; bugfix on
-  0.3.2.1-alpha.
diff --git a/changes/bug23670 b/changes/bug23670
deleted file mode 100644
index 039bc3947..0
--- a/changes/bug23670
+++ /dev/null
@@ -1,3 +0,0 @@
-  o Minor features (entry guards):
-- Improve logs issued when we are missing descriptors of primary guards.
-  Resolves ticket 23670.
diff --git a/changes/bug23678 b/changes/bug23678
deleted file mode 100644
index 8138ea71e..0
--- a/changes/bug23678
+++ /dev/null
@@ -1,7 +0,0 @@
-  o Minor bugfixes (warnings):
-- When we get an HTTP request on a SOCKS port, tell the user about
-  the new HTTPTunnelPort option. Previously, we would give a
-  "Tor is not an HTTP Proxy" message, which stopped being true when
-  HTTPTunnelPort was introduced. Fixes bug 23678; bugfix on
-  0.3.2.1-alpha.
-
diff --git a/changes/bug23739 b/changes/bug23739
deleted file mode 100644
index 3207b5eaf..0
--- a/changes/bug23739
+++ /dev/null
@@ -1,3 +0,0 @@
-  o Minor bugfixes (documentation):
-- Document better how to read gcov and what our postprocessing scripts do.
-  Fixes bug 23739; bugfix on 0.2.9.1-alpha.
diff --git a/changes/bug23741 b/changes/bug23741
deleted file mode 100644
index 92f06f527..0
--- a/changes/bug23741
+++ /dev/null
@@ -1,4 +0,0 @@
-  o Minor bugfixes (testing):
-- Prevent scripts/test/coverage from attempting to move gcov
-  output to the root directory.  Fixes bug 23741; bugfix on
-  0.2.5.1-alpha.
diff --git a/changes/bug23748 b/changes/bug23748
deleted file mode 100644
index 0bd3f3f8f..0
--- a/changes/bug23748
+++ /dev/null
@@ -1,5 +0,0 @@
-  o Minor bugfixes (hidden service):
-- Always make sure the hidden service generate the public key file if it
-  is missing. Prior to this, if the public key was deleted from disk, it
-  wouldn't get recreated. Fixes bug 23748; bugfix on 0.3.2.2-alpha.
-  Patch from "cathugger".
diff --git a/changes/bug23755 b/changes/bug23755
deleted file mode 100644
index 98f097034..0
--- a/changes/bug23755
+++ /dev/null
@@ -1,4 +0,0 @@
-  o Minor bugfixes (testing):
-- Stop unconditionally mirroring the tor repository in GitLab CI.
-  This prevented developers from enabling GitLab CI on master.
-  Fixes bug 23755; bugfix on 0.3.2.2-alpha.
diff --git a/changes/bug23757 b/changes/bug23757
deleted file mode 100644
index 02507a0b4..0
--- a/changes/bug23757
+++ /dev/null
@@ -1,4 +0,0 @@
-  o Minor bugfixes (testing):
-- Adjust the GitLab CI configuration to more closely match that of Travis
-  CI. Fixes bug 23757; bugfix on 0.3.2.2-alpha.
-
diff --git a/changes/bug23758 b/changes/bug23758
deleted file mode 100644
index 565791e8f..0
--- a/changes/bug23758
+++ /dev/null
@@ 

[tor-commits] [stem/master] Fix issue causing tests to be unable to run

2017-10-27 Thread atagar
commit 10fb8a63c2cd53ee0bc5d292a93a5dc891440ad0
Author: Damian Johnson 
Date:   Fri Oct 27 12:23:07 2017 -0700

Fix issue causing tests to be unable to run

Oops, python 2.6 fixes added a regression breaking everything *except* 
python
2.6. Oops. :P

  Traceback (most recent call last):
File "./run_tests.py", line 20, in 
  RUN_ASYNC_TESTS = true
  NameError: name 'true' is not defined
---
 run_tests.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/run_tests.py b/run_tests.py
index fe4a908f..69afd971 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -17,7 +17,7 @@ try:
   # TODO: added in python 2.7, drop check when removing 2.6 support
 
   import importlib
-  RUN_ASYNC_TESTS = true
+  RUN_ASYNC_TESTS = True
 except ImportError:
   RUN_ASYNC_TESTS = False
 

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


[tor-commits] [webwml/master] Merge branch 'master' of ssh://git-rw.torproject.org/project/web/webwml

2017-10-27 Thread hiro
commit 05ccf93e942a2d5ce59aa317055024d42ea1b737
Merge: bfe079ed ebd9653e
Author: hiromipaw 
Date:   Fri Oct 27 19:44:48 2017 +0200

Merge branch 'master' of ssh://git-rw.torproject.org/project/web/webwml

 Makefile | 2 +-
 include/versions.wmi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

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


[tor-commits] [webwml/master] remove temp files

2017-10-27 Thread hiro
commit bfe079ed8b6f348cdaabc60abeb1642402c40d2e
Author: hiromipaw 
Date:   Fri Oct 27 19:44:41 2017 +0200

remove temp files
---
 include/#navigation.wmi# | 29 -
 include/.#navigation.wmi |  1 -
 2 files changed, 30 deletions(-)

diff --git a/include/#navigation.wmi# b/include/#navigation.wmi#
deleted file mode 100644
index 456b4f04..
--- a/include/#navigation.wmi#
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/wml
-
-## translation metadata
-# Revision: $Revision: 22069 $
-# Translation-Priority: 1-high
-
-<:
-# path  link text
-my @navigation = (
-'index', 'Home',
-'about/overview'  , 'About Tor',
-'docs/documentation'  , 'Documentation',
-'press/press' , 'Press',
-''  , 'Blog',
-   '', 'Newsletter',
-'about/contact'   , 'Contact',
-);
-my @donatenav = (
-'index', 'Home',
-'about/overview'  , 'About Tor',
-'about/contact'   , 'Contact',
-);
-my @calltoaction = (
-'download/download-easy'   , 'Download',
-'getinvolved/volunteer', 'Get Involved',
-'donate/donate-button' , 'Donate',
-);
-
-:>
diff --git a/include/.#navigation.wmi b/include/.#navigation.wmi
deleted file mode 12
index de260ad0..
--- a/include/.#navigation.wmi
+++ /dev/null
@@ -1 +0,0 @@
-hiro@coruscant.9885:1509102593
\ No newline at end of file



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


[tor-commits] [stem/master] Loosen regex metching for python 2.6 assertions

2017-10-27 Thread atagar
commit e69d22fdf8003e0422fd97d4de7538947a1d2fb4
Author: Damian Johnson 
Date:   Fri Oct 27 09:43:47 2017 -0700

Loosen regex metching for python 2.6 assertions

Python 2.6 lacks assertRaisesRegexp so we made our own handler for it. 
However,
the assertions it did were more strict, causing failures for tests that pass
with other python versions...

  ==
  FAIL: test_get_info_address_caching
  --
  Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/mock.py", line 1201, in 
patched
  return func(*args, **keywargs)
File "/home/atagar/Desktop/stem/test/unit/control/controller.py", line 
61, in test_get_info_address_caching
  self.assertRaisesRegexp(stem.ProtocolError, 'Address unknown', 
self.controller.get_info, 'address')
File "/home/atagar/Desktop/stem/stem/util/test_tools.py", line 270, in 
assertRaisesRegexp
  self.assertTrue(re.match(exc_msg, str(exc)))
  AssertionError
---
 stem/util/test_tools.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/stem/util/test_tools.py b/stem/util/test_tools.py
index 62ca1577..c6e2b304 100644
--- a/stem/util/test_tools.py
+++ b/stem/util/test_tools.py
@@ -273,7 +273,7 @@ class TimedTestRunner(unittest.TextTestRunner):
   func(*args, **kwargs)
   self.fail('Expected a %s to be raised but nothing was' % 
exc_type)
 except exc_type as exc:
-  self.assertTrue(re.match(exc_msg, str(exc)))
+  self.assertTrue(re.search(exc_msg, str(exc), re.MULTILINE))
   else:
 return super(original_type, self).assertRaisesRegexp(exc_type, 
exc_msg, func, *args, **kwargs)
 

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


[tor-commits] [stem/master] Skip running async tests under python 2.6

2017-10-27 Thread atagar
commit 70b49df22b11f9dfc18e939413d9e847996c1f11
Author: Damian Johnson 
Date:   Fri Oct 27 09:20:43 2017 -0700

Skip running async tests under python 2.6

Turns out importlib was added in python 2.7...

  Traceback (most recent call last):
File "./run_tests.py", line 9, in 
  import importlib
  ImportError: No module named importlib

This means we're losing quite a bit of test coverage under python 2.6 but...
screw it. Guido rolled his eyes when I mentioned we even offered 2.6 
support.
It's been dead a long time.

We'll continue to support python 2.6 until stem 2.0, but not gonna bend over
backwards for it. This change will let us invoke our tests again.
---
 run_tests.py| 11 +--
 stem/util/test_tools.py |  6 ++
 test/integ/process.py   |  2 +-
 test/task.py| 14 --
 4 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/run_tests.py b/run_tests.py
index e2bc19ad..fe4a908f 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -6,7 +6,6 @@
 Runs unit and integration tests. For usage information run this with '--help'.
 """
 
-import importlib
 import os
 import sys
 import threading
@@ -15,6 +14,14 @@ import traceback
 import unittest
 
 try:
+  # TODO: added in python 2.7, drop check when removing 2.6 support
+
+  import importlib
+  RUN_ASYNC_TESTS = true
+except ImportError:
+  RUN_ASYNC_TESTS = False
+
+try:
   from StringIO import StringIO
 except ImportError:
   from io import StringIO
@@ -194,7 +201,7 @@ def main():
 async_args = test.AsyncTestArgs(default_test_dir, args.tor_path)
 
 for module_str in stem.util.test_tools.ASYNC_TESTS:
-  if not args.specific_test or module_str.startswith(args.specific_test):
+  if RUN_ASYNC_TESTS and (not args.specific_test or 
module_str.startswith(args.specific_test)):
 module = importlib.import_module(module_str.rsplit('.', 1)[0])
 test_classes = [v for k, v in module.__dict__.items() if 
k.startswith('Test')]
 
diff --git a/stem/util/test_tools.py b/stem/util/test_tools.py
index d12ccf82..62ca1577 100644
--- a/stem/util/test_tools.py
+++ b/stem/util/test_tools.py
@@ -158,6 +158,9 @@ class AsyncTest(object):
 self._status = AsyncStatus.PENDING
 
   def run(self, *runner_args, **kwargs):
+if stem.prereq._is_python_26():
+  return  # not supported under python 2.6
+
 def _wrapper(conn, runner, args):
   os.nice(12)
 
@@ -199,6 +202,9 @@ class AsyncTest(object):
 self.result(None)
 
   def result(self, test):
+if stem.prereq._is_python_26():
+  return  # not supported under python 2.6
+
 with self._process_lock:
   if self._status == AsyncStatus.PENDING:
 self.run()
diff --git a/test/integ/process.py b/test/integ/process.py
index 72cba38b..1c8035b5 100644
--- a/test/integ/process.py
+++ b/test/integ/process.py
@@ -45,7 +45,7 @@ PublishServerDescriptor 0
 DataDirectory %s
 """
 
-TOR_CMD = None
+TOR_CMD = 'tor'
 
 
 def random_port():
diff --git a/test/task.py b/test/task.py
index 53606a19..2af92875 100644
--- a/test/task.py
+++ b/test/task.py
@@ -22,7 +22,6 @@
   +- PYCODESTYLE_TASK - style checks
 """
 
-import importlib
 import os
 import re
 import sys
@@ -39,6 +38,14 @@ import test.output
 
 from test.output import STATUS, ERROR, NO_NL, println
 
+try:
+  # TODO: remove check when dropping python 2.6 support
+
+  import importlib
+  HAS_IMPORTLIB = True
+except ImportError:
+  HAS_IMPORTLIB = False
+
 CONFIG = stem.util.conf.config_dict('test', {
   'integ.test_directory': './test/data',
   'test.unit_tests': '',
@@ -81,6 +88,9 @@ def _import_tests():
   register if they're asynchronous.
   """
 
+  if not HAS_IMPORTLIB:
+return
+
   for module in (CONFIG['test.unit_tests'].splitlines() + 
CONFIG['test.integ_tests'].splitlines()):
 importlib.import_module(module.rsplit('.', 1)[0])
 
@@ -217,7 +227,7 @@ class ModuleVersion(Task):
 def version_check():
   if prereq_check is None or prereq_check():
 for module in modules:
-  if stem.util.test_tools._module_exists(module):
+  if HAS_IMPORTLIB and stem.util.test_tools._module_exists(module):
 return importlib.import_module(module).__version__
 
   return 'missing'



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


[tor-commits] [tor/master] Only prototype rust_welcome_string() when it exists.

2017-10-27 Thread nickm
commit 5e52beceb080864a0dfb570d9c8d1d10ccac3e88
Author: Nick Mathewson 
Date:   Fri Oct 27 13:03:24 2017 -0400

Only prototype rust_welcome_string() when it exists.
---
 src/or/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/or/main.c b/src/or/main.c
index b9d261e09..bc47c9eb2 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -127,9 +127,11 @@
 
 void evdns_shutdown(int);
 
+#ifdef HAVE_RUST
 // helper function defined in Rust to output a log message indicating if tor is
 // running with Rust enabled. See src/rust/tor_util
 char *rust_welcome_string(void);
+#endif
 
 /* PROTOTYPES **/
 

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


[tor-commits] [tor/master] [rust] Avoid a clone in contract_protocol_list()

2017-10-27 Thread nickm
commit 69502942b00ecc944437894b40b286cbfa3df928
Author: Nick Mathewson 
Date:   Fri Oct 27 13:02:14 2017 -0400

[rust] Avoid a clone in contract_protocol_list()
---
 src/rust/protover/protover.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs
index 11e9d0079..f19f7972f 100644
--- a/src/rust/protover/protover.rs
+++ b/src/rust/protover/protover.rs
@@ -429,8 +429,9 @@ fn find_range(list: ) -> (bool, u32) {
 /// A `String` representation of this set in ascending order.
 ///
 fn contract_protocol_list<'a>(supported_set: &'a HashSet) -> String {
-let mut supported_clone = supported_set.clone();
-let mut supported: Vec = supported_clone.drain().collect();
+let mut supported: Vec = supported_set.iter()
+   .map(|x| *x)
+   .collect();
 supported.sort();
 
 let mut final_output: Vec = Vec::new();



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


[tor-commits] [tor/master] Allow test_rust.sh to run from outside the makefile

2017-10-27 Thread nickm
commit 12f58b42a8adfeee09b140819819eee4108e22d8
Author: Nick Mathewson 
Date:   Fri Oct 27 12:54:52 2017 -0400

Allow test_rust.sh to run from outside the makefile

(This is just a matter of making sure that we handle the case where
abs_top_builddir is not set)
---
 src/test/test_rust.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/test/test_rust.sh b/src/test/test_rust.sh
index 50740fd18..8d7900e1d 100755
--- a/src/test/test_rust.sh
+++ b/src/test/test_rust.sh
@@ -5,9 +5,11 @@ crates="protover tor_util smartlist tor_allocate"
 
 exitcode=0
 
+set -e
+
 for crate in $crates; do
 cd "${abs_top_srcdir:-.}/src/rust/${crate}"
-CARGO_TARGET_DIR="${abs_top_builddir}/src/rust/target" 
CARGO_HOME="${abs_top_builddir}/src/rust" "${CARGO:-cargo}" test 
${CARGO_ONLINE-"--frozen"} || exitcode=1
+CARGO_TARGET_DIR="${abs_top_builddir:-../../..}/src/rust/target" 
CARGO_HOME="${abs_top_builddir:-../../..}/src/rust" "${CARGO:-cargo}" test 
${CARGO_ONLINE-"--frozen"} || exitcode=1
 cd -
 done
 

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


[tor-commits] [tor/master] [rust] Add "unsafe" to the testing-mode tor_malloc_ wrapper.

2017-10-27 Thread nickm
commit 1e66ab363a561c3b419269eca8f7e92346718075
Author: Nick Mathewson 
Date:   Fri Oct 27 12:49:51 2017 -0400

[rust] Add "unsafe" to the testing-mode tor_malloc_ wrapper.

This change lets us remove the allow(unused_unsafe) directive
from allocate_and_copy_string().
---
 src/rust/tor_allocate/tor_allocate.rs | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/rust/tor_allocate/tor_allocate.rs 
b/src/rust/tor_allocate/tor_allocate.rs
index 8a6fabe9c..359df1cd7 100644
--- a/src/rust/tor_allocate/tor_allocate.rs
+++ b/src/rust/tor_allocate/tor_allocate.rs
@@ -12,9 +12,9 @@ extern "C" {
 // Defined only for tests, used for testing purposes, so that we don't need
 // to link to tor C files. Uses the system allocator
 #[cfg(test)]
-extern "C" fn tor_malloc_(size: usize) -> *mut c_void {
+unsafe extern "C" fn tor_malloc_(size: usize) -> *mut c_void {
 use libc::malloc;
-unsafe { malloc(size) }
+malloc(size)
 }
 
 /// Allocate memory using tor_malloc_ and copy an existing string into the
@@ -28,10 +28,6 @@ extern "C" fn tor_malloc_(size: usize) -> *mut c_void {
 ///
 /// A `*mut c_char` that should be freed by tor_free in C
 ///
-/// Allow unused unsafe as at compile-time, we get warnings that unsafe is not
-/// needed even though this calls tor_malloc in C.
-///
-#[allow(unused_unsafe)]
 pub fn allocate_and_copy_string(src: ) -> *mut c_char {
 let bytes: &[u8] = src.as_bytes();
 



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


[tor-commits] [tor/master] Add a build-rust alias to just rebuild the rust code.

2017-10-27 Thread nickm
commit 6e08807b543bad89be4de72ab73c0c2c5997aac7
Author: Nick Mathewson 
Date:   Fri Oct 27 12:52:07 2017 -0400

Add a build-rust alias to just rebuild the rust code.
---
 src/rust/tor_rust/include.am | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/src/rust/tor_rust/include.am b/src/rust/tor_rust/include.am
index f3b0748ba..90f37a9f1 100644
--- a/src/rust/tor_rust/include.am
+++ b/src/rust/tor_rust/include.am
@@ -15,4 +15,10 @@ distclean-rust:
$(CARGO) clean --quiet $(CARGO_ONLINE) )
rm -rf "$(abs_top_builddir)/src/rust/registry"
 
+if USE_RUST
+build-rust: src/rust/target/release/@TOR_RUST_STATIC_NAME@
+else
+build-rust:
+endif
+
 FORCE:



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


[tor-commits] [tor/master] forward-port the 0.3.2.3-alpha changelog

2017-10-27 Thread nickm
commit d64297e4e0c08c26502078cb7ee2815f9d2f8049
Author: Nick Mathewson 
Date:   Fri Oct 27 12:36:14 2017 -0400

forward-port the 0.3.2.3-alpha changelog
---
 ChangeLog | 99 +++
 1 file changed, 99 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index ac517ca75..c77d5a570 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,102 @@
+Changes in version 0.3.2.3-alpha - 2017-10-27
+  Tor 0.3.2.3-alpha is the third release in the 0.3.2 series. It fixes
+  numerous small bugs in earlier versions of 0.3.2.x, and adds a new
+  directory authority, Bastet.
+
+  o Directory authority changes:
+- Add "Bastet" as a ninth directory authority to the default list.
+  Closes ticket 23910.
+- The directory authority "Longclaw" has changed its IP address.
+  Closes ticket 23592.
+
+  o Minor features (bridge):
+- Bridge relays can now set the BridgeDistribution config option to
+  add a "bridge-distribution-request" line to their bridge
+  descriptor, which tells BridgeDB how they'd like their bridge
+  address to be given out. (Note that as of Oct 2017, BridgeDB does
+  not yet implement this feature.) As a side benefit, this feature
+  provides a way to distinguish bridge descriptors from non-bridge
+  descriptors. Implements tickets 18329.
+
+  o Minor features (client, entry guards):
+- Improve log messages when missing descriptors for primary guards.
+  Resolves ticket 23670.
+
+  o Minor features (geoip):
+- Update geoip and geoip6 to the October 4 2017 Maxmind GeoLite2
+  Country database.
+
+  o Minor bugfixes (bridge):
+- Overwrite the bridge address earlier in the process of retrieving
+  its descriptor, to make sure we reach it on the configured
+  address. Fixes bug 20532; bugfix on 0.2.0.10-alpha.
+
+  o Minor bugfixes (documentation):
+- Document better how to read gcov, and what our gcov postprocessing
+  scripts do. Fixes bug 23739; bugfix on 0.2.9.1-alpha.
+
+  o Minor bugfixes (entry guards):
+- Tor now updates its guard state when it reads a consensus
+  regardless of whether it's missing descriptors. That makes tor use
+  its primary guards to fetch descriptors in some edge cases where
+  it would previously have used fallback directories. Fixes bug
+  23862; bugfix on 0.3.0.1-alpha.
+
+  o Minor bugfixes (hidden service client):
+- When handling multiple SOCKS request for the same .onion address,
+  only fetch the service descriptor once.
+- When a descriptor fetch fails with a non-recoverable error, close
+  all pending SOCKS requests for that .onion. Fixes bug 23653;
+  bugfix on 0.3.2.1-alpha.
+
+  o Minor bugfixes (hidden service):
+- Always regenerate missing hidden service public key files. Prior
+  to this, if the public key was deleted from disk, it wouldn't get
+  recreated. Fixes bug 23748; bugfix on 0.3.2.2-alpha. Patch
+  from "cathugger".
+- Make sure that we have a usable ed25519 key when the intro point
+  relay supports ed25519 link authentication. Fixes bug 24002;
+  bugfix on 0.3.2.1-alpha.
+
+  o Minor bugfixes (hidden service, v2):
+- When reloading configured hidden services, copy all information
+  from the old service object. Previously, some data was omitted,
+  causing delays in descriptor upload, and other bugs. Fixes bug
+  23790; bugfix on 0.2.1.9-alpha.
+
+  o Minor bugfixes (memory safety, defensive programming):
+- Clear the target address when node_get_prim_orport() returns
+  early. Fixes bug 23874; bugfix on 0.2.8.2-alpha.
+
+  o Minor bugfixes (relay):
+- Avoid a BUG warning when receiving a dubious CREATE cell while an
+  option transition is in progress. Fixes bug 23952; bugfix
+  on 0.3.2.1-alpha.
+
+  o Minor bugfixes (testing):
+- Adjust the GitLab CI configuration to more closely match that of
+  Travis CI. Fixes bug 23757; bugfix on 0.3.2.2-alpha.
+- Prevent scripts/test/coverage from attempting to move gcov output
+  to the root directory. Fixes bug 23741; bugfix on 0.2.5.1-alpha.
+- When running unit tests as root, skip a test that would fail
+  because it expects a permissions error. This affects some
+  continuous integration setups. Fixes bug 23758; bugfix
+  on 0.3.2.2-alpha.
+- Stop unconditionally mirroring the tor repository in GitLab CI.
+  This prevented developers from enabling GitLab CI on master. Fixes
+  bug 23755; bugfix on 0.3.2.2-alpha.
+- Fix the hidden service v3 descriptor decoding fuzzing to use the
+  latest decoding API correctly. Fixes bug 21509; bugfix
+  on 0.3.2.1-alpha.
+
+  o Minor bugfixes (warnings):
+- When we get an HTTP request on a SOCKS port, tell the user about
+  the new HTTPTunnelPort option. Previously, we would give a "Tor is
+  not an HTTP Proxy" message, which stopped being true when
+

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

2017-10-27 Thread nickm
commit 080bcfa2390a135f585d5fe386bf08834c16acdb
Merge: 023d756bf d5eea977b
Author: Nick Mathewson 
Date:   Fri Oct 27 12:33:34 2017 -0400

Merge branch 'maint-0.3.2' into release-0.3.2

 configure.ac| 2 +-
 contrib/win32build/tor-mingw.nsi.in | 2 +-
 src/win32/orconfig.h| 2 +-
 3 files changed, 3 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.2] bump to 0.3.2.3-alpha-dev.

2017-10-27 Thread nickm
commit d5eea977be405b984e651564736179df4b27b31c
Author: Nick Mathewson 
Date:   Fri Oct 27 12:33:13 2017 -0400

bump to 0.3.2.3-alpha-dev.
---
 configure.ac| 2 +-
 contrib/win32build/tor-mingw.nsi.in | 2 +-
 src/win32/orconfig.h| 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index ca2e803ea..592e04a5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ dnl Copyright (c) 2007-2017, The Tor Project, Inc.
 dnl See LICENSE for licensing information
 
 AC_PREREQ([2.63])
-AC_INIT([tor],[0.3.2.3-alpha])
+AC_INIT([tor],[0.3.2.3-alpha-dev])
 AC_CONFIG_SRCDIR([src/or/main.c])
 AC_CONFIG_MACRO_DIR([m4])
 
diff --git a/contrib/win32build/tor-mingw.nsi.in 
b/contrib/win32build/tor-mingw.nsi.in
index ef35b312a..4c1f709a2 100644
--- a/contrib/win32build/tor-mingw.nsi.in
+++ b/contrib/win32build/tor-mingw.nsi.in
@@ -8,7 +8,7 @@
 !include "LogicLib.nsh"
 !include "FileFunc.nsh"
 !insertmacro GetParameters
-!define VERSION "0.3.2.3-alpha"
+!define VERSION "0.3.2.3-alpha-dev"
 !define INSTALLER "tor-${VERSION}-win32.exe"
 !define WEBSITE "https://www.torproject.org/;
 !define LICENSE "LICENSE"
diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h
index 6d3f9fd1c..38c6d5118 100644
--- a/src/win32/orconfig.h
+++ b/src/win32/orconfig.h
@@ -218,7 +218,7 @@
 #define USING_TWOS_COMPLEMENT
 
 /* Version number of package */
-#define VERSION "0.3.2.3-alpha"
+#define VERSION "0.3.2.3-alpha-dev"
 
 
 



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


[tor-commits] [tor/master] Include rust files in 'make dist'

2017-10-27 Thread nickm
commit 2153814ba8b28a652ef7cd80a7bdf1516201eaa2
Author: Nick Mathewson 
Date:   Fri Oct 27 12:19:31 2017 -0400

Include rust files in 'make dist'
---
 src/rust/include.am | 22 +-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/src/rust/include.am b/src/rust/include.am
index 025d921b3..9c4337484 100644
--- a/src/rust/include.am
+++ b/src/rust/include.am
@@ -3,4 +3,24 @@ include src/rust/tor_rust/include.am
 EXTRA_DIST +=\
src/rust/Cargo.toml \
src/rust/Cargo.lock \
-   src/rust/.cargo/config.in
+   src/rust/.cargo/config.in \
+   src/rust/external/Cargo.toml \
+   src/rust/external/external.rs \
+   src/rust/external/lib.rs \
+   src/rust/protover/Cargo.toml \
+   src/rust/protover/ffi.rs \
+   src/rust/protover/lib.rs \
+   src/rust/protover/protover.rs \
+   src/rust/protover/tests/protover.rs \
+   src/rust/smartlist/Cargo.toml \
+   src/rust/smartlist/lib.rs \
+   src/rust/smartlist/smartlist.rs \
+   src/rust/tor_allocate/Cargo.toml \
+   src/rust/tor_allocate/lib.rs \
+   src/rust/tor_allocate/tor_allocate.rs \
+   src/rust/tor_rust/Cargo.toml \
+   src/rust/tor_rust/include.am \
+   src/rust/tor_rust/lib.rs \
+   src/rust/tor_util/Cargo.toml \
+   src/rust/tor_util/ffi.rs \
+   src/rust/tor_util/lib.rs



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


[tor-commits] [tor/master] Make distcleancheck pass with --enable-rust

2017-10-27 Thread nickm
commit 3a364529a49257aaa3710499874bde84fb6b0d06
Author: Nick Mathewson 
Date:   Fri Oct 27 12:35:13 2017 -0400

Make distcleancheck pass with --enable-rust
---
 Makefile.am  | 5 +
 src/rust/tor_rust/include.am | 7 +++
 2 files changed, 12 insertions(+)

diff --git a/Makefile.am b/Makefile.am
index 137fb1edc..3445fc064 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -246,3 +246,8 @@ mostlyclean-local:
 clean-local:
rm -rf $(top_builddir)/src/rust/target
rm -rf $(top_builddir)/src/rust/.cargo/registry
+
+if USE_RUST
+distclean-local: distclean-rust
+endif
+
diff --git a/src/rust/tor_rust/include.am b/src/rust/tor_rust/include.am
index 6bfec77fb..f3b0748ba 100644
--- a/src/rust/tor_rust/include.am
+++ b/src/rust/tor_rust/include.am
@@ -8,4 +8,11 @@ src/rust/target/release/@TOR_RUST_STATIC_NAME@: FORCE
CARGO_HOME="$(abs_top_builddir)/src/rust" \
$(CARGO) build --release --quiet $(CARGO_ONLINE) )
 
+distclean-rust:
+   ( cd "$(abs_top_srcdir)/src/rust/tor_rust" ; \
+   CARGO_TARGET_DIR="$(abs_top_builddir)/src/rust/target" \
+   CARGO_HOME="$(abs_top_builddir)/src/rust" \
+   $(CARGO) clean --quiet $(CARGO_ONLINE) )
+   rm -rf "$(abs_top_builddir)/src/rust/registry"
+
 FORCE:

___
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.3.2'

2017-10-27 Thread nickm
commit 3cf863df1c29128aa10533d99c897a06dcac9e0c
Merge: 2153814ba d5eea977b
Author: Nick Mathewson 
Date:   Fri Oct 27 12:33:21 2017 -0400

Merge branch 'maint-0.3.2'

"ours" merge to avoid version bump.




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


[tor-commits] [tor/master] repair "make distcheck"

2017-10-27 Thread nickm
commit 7f764bcba80e7184f0f9f0715e0d125483143f70
Author: Nick Mathewson 
Date:   Fri Oct 27 11:59:15 2017 -0400

repair "make distcheck"
---
 src/rust/tor_rust/include.am | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/rust/tor_rust/include.am b/src/rust/tor_rust/include.am
index 7d30592b0..6bfec77fb 100644
--- a/src/rust/tor_rust/include.am
+++ b/src/rust/tor_rust/include.am
@@ -1,7 +1,6 @@
 EXTRA_DIST +=\
src/rust/tor_rust/Cargo.toml \
-   src/rust/tor_rust/lib.rs \
-   src/rust/tor_rust/tor_rust.rs
+   src/rust/tor_rust/lib.rs
 
 src/rust/target/release/@TOR_RUST_STATIC_NAME@: FORCE
( cd "$(abs_top_srcdir)/src/rust/tor_rust" ; \



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


[tor-commits] [tor/master] bump to 0.3.2.3-alpha-dev.

2017-10-27 Thread nickm
commit d5eea977be405b984e651564736179df4b27b31c
Author: Nick Mathewson 
Date:   Fri Oct 27 12:33:13 2017 -0400

bump to 0.3.2.3-alpha-dev.
---
 configure.ac| 2 +-
 contrib/win32build/tor-mingw.nsi.in | 2 +-
 src/win32/orconfig.h| 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index ca2e803ea..592e04a5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ dnl Copyright (c) 2007-2017, The Tor Project, Inc.
 dnl See LICENSE for licensing information
 
 AC_PREREQ([2.63])
-AC_INIT([tor],[0.3.2.3-alpha])
+AC_INIT([tor],[0.3.2.3-alpha-dev])
 AC_CONFIG_SRCDIR([src/or/main.c])
 AC_CONFIG_MACRO_DIR([m4])
 
diff --git a/contrib/win32build/tor-mingw.nsi.in 
b/contrib/win32build/tor-mingw.nsi.in
index ef35b312a..4c1f709a2 100644
--- a/contrib/win32build/tor-mingw.nsi.in
+++ b/contrib/win32build/tor-mingw.nsi.in
@@ -8,7 +8,7 @@
 !include "LogicLib.nsh"
 !include "FileFunc.nsh"
 !insertmacro GetParameters
-!define VERSION "0.3.2.3-alpha"
+!define VERSION "0.3.2.3-alpha-dev"
 !define INSTALLER "tor-${VERSION}-win32.exe"
 !define WEBSITE "https://www.torproject.org/;
 !define LICENSE "LICENSE"
diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h
index 6d3f9fd1c..38c6d5118 100644
--- a/src/win32/orconfig.h
+++ b/src/win32/orconfig.h
@@ -218,7 +218,7 @@
 #define USING_TWOS_COMPLEMENT
 
 /* Version number of package */
-#define VERSION "0.3.2.3-alpha"
+#define VERSION "0.3.2.3-alpha-dev"
 
 
 



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


[tor-commits] [tor/maint-0.3.2] bump to 0.3.2.3-alpha-dev.

2017-10-27 Thread nickm
commit d5eea977be405b984e651564736179df4b27b31c
Author: Nick Mathewson 
Date:   Fri Oct 27 12:33:13 2017 -0400

bump to 0.3.2.3-alpha-dev.
---
 configure.ac| 2 +-
 contrib/win32build/tor-mingw.nsi.in | 2 +-
 src/win32/orconfig.h| 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index ca2e803ea..592e04a5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ dnl Copyright (c) 2007-2017, The Tor Project, Inc.
 dnl See LICENSE for licensing information
 
 AC_PREREQ([2.63])
-AC_INIT([tor],[0.3.2.3-alpha])
+AC_INIT([tor],[0.3.2.3-alpha-dev])
 AC_CONFIG_SRCDIR([src/or/main.c])
 AC_CONFIG_MACRO_DIR([m4])
 
diff --git a/contrib/win32build/tor-mingw.nsi.in 
b/contrib/win32build/tor-mingw.nsi.in
index ef35b312a..4c1f709a2 100644
--- a/contrib/win32build/tor-mingw.nsi.in
+++ b/contrib/win32build/tor-mingw.nsi.in
@@ -8,7 +8,7 @@
 !include "LogicLib.nsh"
 !include "FileFunc.nsh"
 !insertmacro GetParameters
-!define VERSION "0.3.2.3-alpha"
+!define VERSION "0.3.2.3-alpha-dev"
 !define INSTALLER "tor-${VERSION}-win32.exe"
 !define WEBSITE "https://www.torproject.org/;
 !define LICENSE "LICENSE"
diff --git a/src/win32/orconfig.h b/src/win32/orconfig.h
index 6d3f9fd1c..38c6d5118 100644
--- a/src/win32/orconfig.h
+++ b/src/win32/orconfig.h
@@ -218,7 +218,7 @@
 #define USING_TWOS_COMPLEMENT
 
 /* Version number of package */
-#define VERSION "0.3.2.3-alpha"
+#define VERSION "0.3.2.3-alpha-dev"
 
 
 

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


[tor-commits] [stem/master] Fix python3 unit test error

2017-10-27 Thread atagar
commit a021aae5c6ef16a77d709f131bf6b777e6f938de
Author: Damian Johnson 
Date:   Fri Oct 27 09:10:17 2017 -0700

Fix python3 unit test error

Oops, python3 regression slipped in with prior work...

  ==
  ERROR: test_connections
  --
  Traceback (most recent call last):
File "/usr/local/lib/python3.2/dist-packages/mock/mock.py", line 1305, 
in patched
  return func(*args, **keywargs)
File "/home/atagar/Desktop/stem/test/unit/util/proc.py", line 215, in 
test_connections
  tcp = b'%s\n 0: : : 01 : 
55:  8 ' % TITLE_LINE
  TypeError: unsupported operand type(s) for %: 'bytes' and 'bytes'
---
 test/unit/util/proc.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/unit/util/proc.py b/test/unit/util/proc.py
index 4c24b279..562d618a 100644
--- a/test/unit/util/proc.py
+++ b/test/unit/util/proc.py
@@ -212,8 +212,8 @@ class TestProc(unittest.TestCase):
   '/proc/%s/fd/4' % pid: 'pipe:[40404]',
 }[param]
 
-tcp = b'%s\n 0: : : 01 : 
55:  8 ' % TITLE_LINE
-udp = b'%s\n A: : : DD : 
FF:  H ' % TITLE_LINE
+tcp = TITLE_LINE + b'\n 0: : : 01 
: 55:  8 '
+udp = TITLE_LINE + b'\n A: : : DD 
: FF:  H '
 
 path_exists_mock.side_effect = lambda param: {
   '/proc/net/tcp': True,

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


[tor-commits] [tor/master] declare shutdown_did_not_work_callback() with ATTR_NORETURN

2017-10-27 Thread nickm
commit f803c1bb1761915ca57a4d8c65b2fed79f2a8886
Author: Nick Mathewson 
Date:   Fri Oct 27 11:51:42 2017 -0400

declare shutdown_did_not_work_callback() with ATTR_NORETURN
---
 src/or/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/or/main.c b/src/or/main.c
index bb5935690..b9d261e09 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -143,6 +143,8 @@ static void 
connection_start_reading_from_linked_conn(connection_t *conn);
 static int connection_should_read_from_linked_conn(connection_t *conn);
 static int run_main_loop_until_done(void);
 static void process_signal(int sig);
+static void shutdown_did_not_work_callback(evutil_socket_t fd, short event,
+   void *arg) ATTR_NORETURN;
 
 /* START VARIABLES **/
 int global_read_bucket; /**< Max number of bytes I can read this second. */

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


[tor-commits] [webwml/master] bump alpha version

2017-10-27 Thread nickm
commit ebd9653ec0b4278b6f2c103cfab0f3b5cbdac300
Author: Nick Mathewson 
Date:   Fri Oct 27 11:48:32 2017 -0400

bump alpha version
---
 Makefile | 2 +-
 include/versions.wmi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 02a4502e..fedfe22b 100644
--- a/Makefile
+++ b/Makefile
@@ -15,7 +15,7 @@
 # website component, and set it to needs_review.
 
 export STABLETAG=tor-0.3.1.8
-export DEVTAG=tor-0.3.2.2-alpha
+export DEVTAG=tor-0.3.2.3-alpha
 
 
 WMLBASE=.
diff --git a/include/versions.wmi b/include/versions.wmi
index afd4f549..140d377b 100644
--- a/include/versions.wmi
+++ b/include/versions.wmi
@@ -1,5 +1,5 @@
 0.3.1.8
-0.3.2.2-alpha
+0.3.2.3-alpha
 
 0.3.1.7
 

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


[tor-commits] [nyx/master] Use stem's address caching

2017-10-27 Thread atagar
commit 5766118620a45d9df9731e1c00f7538a001dd3d4
Author: Damian Johnson 
Date:   Thu Oct 26 10:55:19 2017 -0700

Use stem's address caching

Now that stem can cache our address we can drop our our_address() helper.
---
 nyx/__init__.py  | 25 +++--
 nyx/panel/connection.py  |  6 +++---
 nyx/panel/header.py  |  2 +-
 nyx/tracker.py   |  4 ++--
 test/panel/connection.py |  8 
 test/panel/header.py |  2 +-
 6 files changed, 14 insertions(+), 33 deletions(-)

diff --git a/nyx/__init__.py b/nyx/__init__.py
index 5947294..7c61651 100644
--- a/nyx/__init__.py
+++ b/nyx/__init__.py
@@ -9,7 +9,6 @@ Tor curses monitoring application.
   nyx_interface - nyx interface singleton
   tor_controller - tor connection singleton
   cache - provides our application cache
-  our_address - provides our ip address
 
   show_message - shows a message to the user
   input_prompt - prompts the user for text input
@@ -105,9 +104,9 @@ CACHE = None
 CHROOT = None
 BASE_DIR = os.path.sep.join(__file__.split(os.path.sep)[:-1])
 
-CACHED_ADDRESS = None
-ADDRESS_FETCHED = None
-ADDRESS_FETCH_RATE = 60
+# our address infrequently changes so we can cache it for a while
+
+stem.control.CACHE_ADDRESS_FOR = 30
 
 # disable trace level messages about cache hits
 
@@ -251,24 +250,6 @@ def cache():
   return CACHE
 
 
-def our_address(default = None):
-  """
-  Provides our ip address.
-
-  :param str default: response if address is unavailable
-
-  :returns: **str** with our address
-  """
-
-  global CACHED_ADDRESS, ADDRESS_FETCHED
-
-  if ADDRESS_FETCHED is None or (time.time() - ADDRESS_FETCHED) > 
ADDRESS_FETCH_RATE:
-CACHED_ADDRESS = tor_controller().get_info('address', None)
-ADDRESS_FETCHED = time.time()
-
-  return CACHED_ADDRESS if CACHED_ADDRESS is not None else default
-
-
 def show_message(message = None, *attr, **kwargs):
   """
   Shows a message in our header.
diff --git a/nyx/panel/connection.py b/nyx/panel/connection.py
index 1a090ac..fc586b6 100644
--- a/nyx/panel/connection.py
+++ b/nyx/panel/connection.py
@@ -608,10 +608,10 @@ def _draw_line(subwindow, x, y, line, is_selected, width, 
current_time):
 
 
 def _draw_address_column(subwindow, x, y, line, attr):
+  src = tor_controller().get_info('address', line.connection.local_address)
+
   if line.line_type == LineType.CONNECTION:
-src = '%s:%s' % (nyx.our_address(line.connection.local_address), 
line.connection.local_port)
-  else:
-src = nyx.our_address(line.connection.local_address)
+src = '%s:%s' % (src, line.connection.local_port)
 
   if line.line_type == LineType.CIRCUIT_HEADER and line.circuit.status != 
'BUILT':
 dst = 'Building...'
diff --git a/nyx/panel/header.py b/nyx/panel/header.py
index 0820a21..b1cbfbf 100644
--- a/nyx/panel/header.py
+++ b/nyx/panel/header.py
@@ -268,7 +268,7 @@ class Sampling(object):
   'version': str(controller.get_version('Unknown')).split()[0],
   'version_status': controller.get_info('status/version/current', 
'Unknown'),
 
-  'address': or_listeners[0][0] if (or_listeners and or_listeners[0][0] != 
'0.0.0.0') else nyx.our_address('Unknown'),
+  'address': or_listeners[0][0] if (or_listeners and or_listeners[0][0] != 
'0.0.0.0') else controller.get_info('address', 'Unknown'),
   'or_port': or_listeners[0][1] if or_listeners else '',
   'dir_port': controller.get_conf('DirPort', '0'),
   'control_port': str(control_listeners[0][1]) if control_listeners else 
None,
diff --git a/nyx/tracker.py b/nyx/tracker.py
index fb41f9e..fa2381e 100644
--- a/nyx/tracker.py
+++ b/nyx/tracker.py
@@ -903,7 +903,7 @@ class ConsensusTracker(object):
 
 controller = tor_controller()
 
-if nyx.our_address() == address:
+if controller.get_info('address', None) == address:
   fingerprint = controller.get_info('fingerprint', None)
   ports = controller.get_ports(stem.control.Listener.OR, None)
 
@@ -924,7 +924,7 @@ class ConsensusTracker(object):
 controller = tor_controller()
 
 if fingerprint == controller.get_info('fingerprint', None):
-  my_address = nyx.our_address()
+  my_address = controller.get_info('address', None)
   my_or_ports = controller.get_ports(stem.control.Listener.OR, [])
 
   if my_address and len(my_or_ports) == 1:
diff --git a/test/panel/connection.py b/test/panel/connection.py
index c95f31a..f075f77 100644
--- a/test/panel/connection.py
+++ b/test/panel/connection.py
@@ -195,9 +195,9 @@ class TestConnectionPanel(unittest.TestCase):
 
   @require_curses
   @patch('nyx.panel.connection.tor_controller')
-  @patch('nyx.our_address', Mock(return_value = '82.121.9.9'))
   def test_draw_line(self, tor_controller_mock):
 tor_controller_mock().is_geoip_unavailable.return_value = False
+tor_controller_mock().get_info.return_value = '82.121.9.9'
 
 test_data = ((
   line(),
@@ -213,7 +213,7 @@ class TestConnectionPanel(unittest.TestCase):
   ' |  

[tor-commits] [stem/master] Temporarily cache 'GETINFO address' responses

2017-10-27 Thread atagar
commit d0922386bf73ab81e3db9f993adf9842c18f4d2a
Author: Damian Johnson 
Date:   Wed Oct 25 13:33:34 2017 -0700

Temporarily cache 'GETINFO address' responses

This is a mutable parameter, but it's both reasonably static and highly
requested. Caching it for a second by default.
---
 stem/control.py | 23 +++
 test/unit/control/controller.py | 29 +++--
 2 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index 6746441c..eebc24b6 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -372,6 +372,7 @@ MAPPED_CONFIG_KEYS = {
 # unchangeable GETINFO parameters
 
 CACHEABLE_GETINFO_PARAMS = (
+  'address',
   'version',
   'config-file',
   'exit-policy/default',
@@ -389,6 +390,12 @@ CACHEABLE_GETINFO_PARAMS_UNTIL_SETCONF = (
   'accounting/enabled',
 )
 
+# 'GETINFO address' isn't technically cachable, but it's also both highly
+# requested and highly static. As such fetching it at a fixed rate. If
+# you'd like you can set this global to zero to disable caching.
+
+CACHE_ADDRESS_FOR = 1.0
+
 # GETCONF parameters we shouldn't cache. This includes hidden service
 # perameters due to the funky way they're set and retrieved (for instance,
 # 'SETCONF HiddenServiceDir' effects 'GETCONF HiddenServiceOptions').
@@ -1048,6 +1055,9 @@ class Controller(BaseController):
 self._event_listeners_lock = threading.RLock()
 self._enabled_features = []
 self._is_geoip_unavailable = None
+
+self._address_cached_at = 0
+self._last_address_exc = None
 self._last_fingerprint_exc = None
 
 super(Controller, self).__init__(control_socket, is_authenticated)
@@ -1145,6 +1155,8 @@ class Controller(BaseController):
 for param in params:
   if param.startswith('ip-to-country/') and param != 
'ip-to-country/0.0.0.0' and self.is_geoip_unavailable():
 raise stem.ProtocolError('Tor geoip database is unavailable')
+  elif param == 'address' and self._last_address_exc and (time.time() - 
self._address_cached_at) < CACHE_ADDRESS_FOR:
+raise self._last_address_exc  # we already know we can't resolve an 
address
   elif param == 'fingerprint' and self._last_fingerprint_exc and 
self.get_conf('ORPort', None) is None:
 raise self._last_fingerprint_exc  # we already know we're not a relay
 
@@ -1153,6 +1165,9 @@ class Controller(BaseController):
 cached_results = self._get_cache_map(map(str.lower, params), 'getinfo')
 
 for key in cached_results:
+  if key == 'address' and (time.time() - self._address_cached_at) > 
CACHE_ADDRESS_FOR:
+continue  # cached address is too old
+
   user_expected_key = _case_insensitive_lookup(params, key)
   reply[user_expected_key] = cached_results[key]
   params.remove(user_expected_key)
@@ -1192,6 +1207,10 @@ class Controller(BaseController):
 
 self._set_cache(to_cache, 'getinfo')
 
+  if 'address' in params:
+self._address_cached_at = time.time()
+self._last_address_exc = None
+
   if 'fingerprint' in params:
 self._last_fingerprint_exc = None
 
@@ -1202,6 +1221,10 @@ class Controller(BaseController):
   else:
 return list(reply.values())[0]
 except stem.ControllerError as exc:
+  if 'address' in params:
+self._address_cached_at = time.time()
+self._last_address_exc = exc
+
   if 'fingerprint' in params:
 self._last_fingerprint_exc = exc
 
diff --git a/test/unit/control/controller.py b/test/unit/control/controller.py
index c7e412c5..a9a7e73d 100644
--- a/test/unit/control/controller.py
+++ b/test/unit/control/controller.py
@@ -5,6 +5,7 @@ integ tests, but a few bits lend themselves to unit testing.
 
 import datetime
 import io
+import time
 import unittest
 
 import stem.descriptor.router_status_entry
@@ -46,13 +47,37 @@ class TestControl(unittest.TestCase):
   self.assertTrue(stem.control.event_description(event) is not None)
 
   @patch('stem.control.Controller.msg')
-  def test_get_get_info(self, msg_mock):
+  def test_get_info(self, msg_mock):
 msg_mock.return_value = ControlMessage.from_str('250-hello=hi right 
back!\r\n250 OK\r\n', 'GETINFO')
 self.assertEqual('hi right back!', self.controller.get_info('hello'))
 
   @patch('stem.control.Controller.msg')
+  def test_get_info_address_caching(self, msg_mock):
+test_start = time.time()
+msg_mock.return_value = ControlMessage.from_str('551 Address unknown\r\n')
+
+self.assertEqual(0, self.controller._address_cached_at)
+self.assertEqual(None, self.controller._last_address_exc)
+self.assertRaisesRegexp(stem.ProtocolError, 'Address unknown', 
self.controller.get_info, 'address')
+self.assertTrue(test_start <= self.controller._address_cached_at <= 
time.time())
+self.assertEqual("GETINFO response didn't have an OK status:\nAddress 
unknown", str(self.controller._last_address_exc))
+

[tor-commits] [tor/release-0.3.2] changelog fix; thanks dgoulet

2017-10-27 Thread nickm
commit 023d756bfc04c244403ca7fb13e3e077dbe16408
Author: Nick Mathewson 
Date:   Fri Oct 27 11:20:44 2017 -0400

changelog fix; thanks dgoulet
---
 ChangeLog | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5cb6469f2..87517a2a5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -59,10 +59,10 @@ Changes in version 0.3.2.3-alpha - 2017-10-27
   bugfix on 0.3.2.1-alpha.
 
   o Minor bugfixes (hidden service, v2):
-- When reloading a configured with hidden service(s), copy all
-  information from the old service object. Previously, some data was
-  omitted, causing delays in descriptor upload, and other bugs.
-  Fixes bug 23790; bugfix on 0.2.1.9-alpha.
+- When reloading configured hidden services, copy all information
+  from the old service object. Previously, some data was omitted,
+  causing delays in descriptor upload, and other bugs. Fixes bug
+  23790; bugfix on 0.2.1.9-alpha.
 
   o Minor bugfixes (memory safety, defensive programming):
 - Clear the target address when node_get_prim_orport() returns

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


[tor-commits] [tor/master] Merge remote-tracking branch 'public/exit_carefully'

2017-10-27 Thread nickm
commit 30a681553f2ecc7747236085dd3331e9875651d5
Merge: fa78546db a62f59f00
Author: Nick Mathewson 
Date:   Fri Oct 27 11:13:05 2017 -0400

Merge remote-tracking branch 'public/exit_carefully'

 changes/bug23848 |   8 +++
 src/common/compat_libevent.h |   1 +
 src/or/config.c  |  67 +---
 src/or/connection_edge.c |   2 +-
 src/or/control.c |   3 +-
 src/or/hibernate.c   |   7 ++-
 src/or/main.c| 119 ---
 src/or/main.h|   4 +-
 src/or/ntmain.c  |   2 +-
 src/test/test_keygen.sh  | 109 +++
 10 files changed, 278 insertions(+), 44 deletions(-)

diff --cc src/or/config.c
index 63a1cac99,64e42c93c..82c35e952
--- a/src/or/config.c
+++ b/src/or/config.c
@@@ -1684,13 -1667,11 +1687,16 @@@ options_act(const or_options_t *old_opt
return -1;
}
  
 +  if (options->ProtocolWarnings)
 +protocol_warning_severity_level = LOG_WARN;
 +  else
 +protocol_warning_severity_level = LOG_INFO;
 +
-   if (consider_adding_dir_servers(options, old_options) < 0)
+   if (consider_adding_dir_servers(options, old_options) < 0) {
+ //  This should get validated earlier, and committed here, to
+ //  lower opportunities for reaching an error case.
  return -1;
+   }
  
if (rend_non_anonymous_mode_enabled(options)) {
  log_warn(LD_GENERAL, "This copy of Tor was compiled or configured to run "



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


[tor-commits] [tor/master] Return instead of exiting in options_init_from_torrc()

2017-10-27 Thread nickm
commit 1df43aff41eb8198712af0aa14ec2d574b26682c
Author: Nick Mathewson 
Date:   Fri Oct 20 11:15:32 2017 -0400

Return instead of exiting in options_init_from_torrc()
---
 src/or/config.c  | 31 +++
 src/or/control.c |  3 +--
 src/or/main.c| 29 -
 src/or/ntmain.c  |  2 +-
 4 files changed, 45 insertions(+), 20 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index 55ab76c81..3795aeaa3 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -4981,7 +4981,8 @@ load_torrc_from_disk(config_line_t *cmd_arg, int 
defaults_file)
 /** Read a configuration file into options, finding the configuration
  * file location based on the command line.  After loading the file
  * call options_init_from_string() to load the config.
- * Return 0 if success, -1 if failure. */
+ * Return 0 if success, -1 if failure, and 1 if we succeeded but should exit
+ * anyway. */
 int
 options_init_from_torrc(int argc, char **argv)
 {
@@ -5008,22 +5009,22 @@ options_init_from_torrc(int argc, char **argv)
   if (config_line_find(cmdline_only_options, "-h") ||
   config_line_find(cmdline_only_options, "--help")) {
 print_usage();
-exit(0); //  bad exit, though probably harmless
+return 1;
   }
   if (config_line_find(cmdline_only_options, "--list-torrc-options")) {
 /* For validating whether we've documented everything. */
 list_torrc_options();
-exit(0); //  bad exit, though probably harmless
+return 1;
   }
   if (config_line_find(cmdline_only_options, "--list-deprecated-options")) {
 /* For validating whether what we have deprecated really exists. */
 list_deprecated_options();
-exit(0); //  bad exit, though probably harmless
+return 1;
   }
 
   if (config_line_find(cmdline_only_options, "--version")) {
 printf("Tor version %s.\n",get_version());
-exit(0); //  bad exit, though probably harmless
+return 1;
   }
 
   if (config_line_find(cmdline_only_options, "--library-versions")) {
@@ -5051,7 +5052,7 @@ options_init_from_torrc(int argc, char **argv)
 tor_compress_header_version_str(ZSTD_METHOD));
 }
 //TODO: Hex versions?
-exit(0); //  bad exit, though probably harmless
+return 1;
   }
 
   command = CMD_RUN_TOR;
@@ -5112,7 +5113,8 @@ options_init_from_torrc(int argc, char **argv)
   get_options_mutable()->keygen_force_passphrase = FORCE_PASSPHRASE_OFF;
 } else {
   log_err(LD_CONFIG, "--no-passphrase specified without --keygen!");
-  exit(1); //  bad exit
+  retval = -1;
+  goto err;
 }
   }
 
@@ -5121,7 +5123,8 @@ options_init_from_torrc(int argc, char **argv)
   get_options_mutable()->change_key_passphrase = 1;
 } else {
   log_err(LD_CONFIG, "--newpass specified without --keygen!");
-  exit(1); //  bad exit
+  retval = -1;
+  goto err;
 }
   }
 
@@ -5131,17 +5134,20 @@ options_init_from_torrc(int argc, char **argv)
 if (fd_line) {
   if (get_options()->keygen_force_passphrase == FORCE_PASSPHRASE_OFF) {
 log_err(LD_CONFIG, "--no-passphrase specified with --passphrase-fd!");
-exit(1); //  bad exit
+retval = -1;
+goto err;
   } else if (command != CMD_KEYGEN) {
 log_err(LD_CONFIG, "--passphrase-fd specified without --keygen!");
-exit(1); //  bad exit
+retval = -1;
+goto err;
   } else {
 const char *v = fd_line->value;
 int ok = 1;
 long fd = tor_parse_long(v, 10, 0, INT_MAX, , NULL);
 if (fd < 0 || ok == 0) {
   log_err(LD_CONFIG, "Invalid --passphrase-fd value %s", escaped(v));
-  exit(1); //  bad exit
+  retval = -1;
+  goto err;
 }
 get_options_mutable()->keygen_passphrase_fd = (int)fd;
 get_options_mutable()->use_keygen_passphrase_fd = 1;
@@ -5156,7 +5162,8 @@ options_init_from_torrc(int argc, char **argv)
 if (key_line) {
   if (command != CMD_KEYGEN) {
 log_err(LD_CONFIG, "--master-key without --keygen!");
-exit(1); //  bad exit
+retval = -1;
+goto err;
   } else {
 get_options_mutable()->master_key_fname = tor_strdup(key_line->value);
   }
diff --git a/src/or/control.c b/src/or/control.c
index ab164700e..7b89a1370 100644
--- a/src/or/control.c
+++ b/src/or/control.c
@@ -6571,8 +6571,7 @@ monitor_owning_controller_process(const char 
*process_spec)
 "owning controller: %s.  Exiting.",
 msg);
 owning_controller_process_spec = NULL;
-tor_cleanup();
-exit(1); //  bad exit: or questionable, at least.
+tor_shutdown_event_loop_and_exit(1);
   }
 }
 
diff --git a/src/or/main.c b/src/or/main.c
index d47c8f4dd..9121e5216 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2420,10 +2420,18 @@ do_hup(void)
   /* first, reload config variables, in case they've changed */
   if 

[tor-commits] [tor/master] Clarify doc on tell_event_loop_to_run_external_code()

2017-10-27 Thread nickm
commit 0a10335d2e23e43de401cf955c8f188ce19106a6
Author: Nick Mathewson 
Date:   Fri Oct 27 11:14:37 2017 -0400

Clarify doc on tell_event_loop_to_run_external_code()
---
 src/or/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/or/main.c b/src/or/main.c
index 5510df253..a615a6be0 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -648,7 +648,8 @@ connection_should_read_from_linked_conn(connection_t *conn)
 
 /** If we called event_base_loop() and told it to never stop until it
  * runs out of events, now we've changed our mind: tell it we want it to
- * finish. */
+ * exit once the current round of callbacks is done, so that we can
+ * run external code, and then return to the main loop. */
 void
 tell_event_loop_to_run_external_code(void)
 {



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


[tor-commits] [tor/master] Add unit tests for cases of starting with bogus keygen arguments

2017-10-27 Thread nickm
commit c4a07b261b552c39b64c8d47f1ba75f4bb4f37d6
Author: Nick Mathewson 
Date:   Fri Oct 20 19:10:05 2017 -0400

Add unit tests for cases of starting with bogus keygen arguments

In particular, this tests that we give an appropriate warning when
we are told to use some keygen argument, but --keygen is not specified.
---
 src/test/test_keygen.sh | 109 
 1 file changed, 109 insertions(+)

diff --git a/src/test/test_keygen.sh b/src/test/test_keygen.sh
index 87012cd28..b3d4d8e39 100755
--- a/src/test/test_keygen.sh
+++ b/src/test/test_keygen.sh
@@ -40,6 +40,12 @@ fi
   CASE8=$dflt
   CASE9=$dflt
   CASE10=$dflt
+  CASE11A=$dflt
+  CASE11B=$dflt
+  CASE11C=$dflt
+  CASE11D=$dflt
+  CASE11E=$dflt
+  CASE11F=$dflt
 
   if [ $# -ge 1 ]; then
  eval "CASE${1}"=1
@@ -363,6 +369,109 @@ echo " Case 10 ok"
 
 fi
 
+# Case 11a: -passphrase-fd without --keygen
+
+if [ "$CASE11A" = 1 ]; then
+
+ME="${DATA_DIR}/case11a"
+
+mkdir -p "${ME}/keys"
+
+${TOR} --DataDirectory "${ME}" --passphrase-fd 1 > "${ME}/stdout" && die 
"Successfully started with passphrase-fd but no keygen?" || true
+
+grep "passphrase-fd specified without --keygen" "${ME}/stdout" >/dev/null || 
die "Tor didn't declare that there was a problem with the arguments."
+
+echo " Case 11A ok"
+
+fi
+
+# Case 11b: --no-passphrase without --keygen
+
+if [ "$CASE11B" = 1 ]; then
+
+ME="${DATA_DIR}/case11b"
+
+mkdir -p "${ME}/keys"
+
+${TOR} --DataDirectory "${ME}" --no-passphrase > "${ME}/stdout" && die 
"Successfully started with no-passphrase but no keygen?" || true
+
+grep "no-passphrase specified without --keygen" "${ME}/stdout" >/dev/null || 
die "Tor didn't declare that there was a problem with the arguments."
+
+echo " Case 11B ok"
+
+fi
+
+# Case 11c: --newpass without --keygen
+
+if [ "$CASE11C" = 1 ]; then
+
+ME="${DATA_DIR}/case11C"
+
+mkdir -p "${ME}/keys"
+
+${TOR} --DataDirectory "${ME}" --newpass > "${ME}/stdout" && die "Successfully 
started with newpass but no keygen?" || true
+
+grep "newpass specified without --keygen" "${ME}/stdout" >/dev/null || die 
"Tor didn't declare that there was a problem with the arguments."
+
+echo " Case 11C ok"
+
+fi
+
+ --master-key does not work yet, but this will test the error case
+  when it does.
+#
+# Case 11d: --master-key without --keygen
+#
+if [ "$CASE11D" = 1 ]; then
+#
+# ME="${DATA_DIR}/case11d"
+#
+# mkdir -p "${ME}/keys"
+#
+# ${TOR} --DataDirectory "${ME}" --master-key "${ME}/foobar" > "${ME}/stdout" 
&& die "Successfully started with master-key but no keygen?" || true
+#
+# cat "${ME}/stdout"
+#
+# grep "master-key without --keygen" "${ME}/stdout" >/dev/null || die "Tor 
didn't declare that there was a problem with the arguments."
+
+echo " Case 11D skipped"
+
+fi
+
+
+# Case 11E: Silly passphrase-fd
+
+if [ "$CASE11E" = 1 ]; then
+
+ME="${DATA_DIR}/case11E"
+
+mkdir -p "${ME}/keys"
+
+${TOR} --DataDirectory "${ME}" --keygen --passphrase-fd ewigeblumenkraft > 
"${ME}/stdout" && die "Successfully started with bogus passphrase-fd?" || true
+
+grep "Invalid --passphrase-fd value" "${ME}/stdout" >/dev/null || die "Tor 
didn't declare that there was a problem with the arguments."
+
+echo " Case 11E ok"
+
+fi
+
+
+# Case 11F: --no-passphrase with --passphrase-fd
+
+if [ "$CASE11F" = 1 ]; then
+
+ME="${DATA_DIR}/case11F"
+
+mkdir -p "${ME}/keys"
+
+${TOR} --DataDirectory "${ME}" --keygen --passphrase-fd 1 --no-passphrase > 
"${ME}/stdout" && die "Successfully started with bogus passphrase-fd 
combination?" || true
+
+grep "no-passphrase specified with --passphrase-fd" "${ME}/stdout" >/dev/null 
|| die "Tor didn't declare that there was a problem with the arguments."
+
+echo " Case 11F ok"
+
+fi
+
 
 # Check cert-only.
 



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


[tor-commits] [tor/master] Add a comment about removing the failsafe event loop exit code

2017-10-27 Thread nickm
commit 79e7c0af0e4bd9a813ddd9226b43cc49112edd19
Author: Nick Mathewson 
Date:   Fri Oct 27 11:15:43 2017 -0400

Add a comment about removing the failsafe event loop exit code
---
 src/or/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/or/main.c b/src/or/main.c
index a615a6be0..bb5935690 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -691,6 +691,7 @@ tor_shutdown_event_loop_and_exit(int exitcode)
 
   /* Die with an assertion failure in ten seconds, if for some reason we don't
* exit normally. */
+  /*  We should consider this code if it's never used. */
   struct timeval ten_seconds = { 10, 0 };
   event_base_once(tor_libevent_get_base(), -1, EV_TIMEOUT,
   shutdown_did_not_work_callback, NULL,

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


[tor-commits] [tor/master] Mark "previously validated foo could not be set" blocks as unreachable.

2017-10-27 Thread nickm
commit a62f59f000f05ac5f5a7a22387007a1b8c2ee2a4
Author: Nick Mathewson 
Date:   Fri Oct 20 19:28:12 2017 -0400

Mark "previously validated foo could not be set" blocks as unreachable.
---
 src/or/config.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/src/or/config.c b/src/or/config.c
index 6f7bf23df..64e42c93c 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1717,9 +1717,11 @@ options_act(const or_options_t *old_options)
 for (cl = options->Bridges; cl; cl = cl->next) {
   bridge_line_t *bridge_line = parse_bridge_line(cl->value);
   if (!bridge_line) {
+// LCOV_EXCL_START
 log_warn(LD_BUG,
  "Previously validated Bridge line could not be added!");
 return -1;
+// LCOV_EXCL_STOP
   }
   bridge_add_from_config(bridge_line);
 }
@@ -1727,15 +1729,19 @@ options_act(const or_options_t *old_options)
   }
 
   if (running_tor && hs_config_service_all(options, 0)<0) {
+// LCOV_EXCL_START
 log_warn(LD_BUG,
"Previously validated hidden services line could not be added!");
 return -1;
+// LCOV_EXCL_STOP
   }
 
   if (running_tor && rend_parse_service_authorization(options, 0) < 0) {
+// LCOV_EXCL_START
 log_warn(LD_BUG, "Previously validated client authorization for "
  "hidden services could not be added!");
 return -1;
+// LCOV_EXCL_STOP
   }
 
   /* Load state */
@@ -1758,10 +1764,12 @@ options_act(const or_options_t *old_options)
 if (options->ClientTransportPlugin) {
   for (cl = options->ClientTransportPlugin; cl; cl = cl->next) {
 if (parse_transport_line(options, cl->value, 0, 0) < 0) {
+  // LCOV_EXCL_START
   log_warn(LD_BUG,
"Previously validated ClientTransportPlugin line "
"could not be added!");
   return -1;
+  // LCOV_EXCL_STOP
 }
   }
 }
@@ -1769,10 +1777,12 @@ options_act(const or_options_t *old_options)
 if (options->ServerTransportPlugin && server_mode(options)) {
   for (cl = options->ServerTransportPlugin; cl; cl = cl->next) {
 if (parse_transport_line(options, cl->value, 0, 1) < 0) {
+  // LCOV_EXCL_START
   log_warn(LD_BUG,
"Previously validated ServerTransportPlugin line "
"could not be added!");
   return -1;
+  // LCOV_EXCL_STOP
 }
   }
 }
@@ -1858,8 +1868,10 @@ options_act(const or_options_t *old_options)
 
   /* Set up accounting */
   if (accounting_parse_options(options, 0)<0) {
+// LCOV_EXCL_START
 log_warn(LD_BUG,"Error in previously validated accounting options");
 return -1;
+// LCOV_EXCL_STOP
   }
   if (accounting_is_enabled(options))
 configure_accounting(time(NULL));
@@ -1895,10 +1907,12 @@ options_act(const or_options_t *old_options)
   }
 
   if (parse_outbound_addresses(options, 0, ) < 0) {
+// LCOV_EXCL_START
 log_warn(LD_BUG, "Failed parsing previously validated outbound "
  "bind addresses: %s", msg);
 tor_free(msg);
 return -1;
+// LCOV_EXCL_STOP
   }
 
   config_maybe_load_geoip_files_(options, old_options);



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


[tor-commits] [tor/master] On locking failure, return -1 instead of exit()ing.

2017-10-27 Thread nickm
commit c247a2df6b7f6b5d997ef9e5ccc25eaaf3918db8
Author: Nick Mathewson 
Date:   Fri Oct 20 10:27:05 2017 -0400

On locking failure, return -1 instead of exit()ing.

This is safe, since the only caller (options_act) will check the
return value, and propagate failure.
---
 src/or/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/or/main.c b/src/or/main.c
index 4d252faf2..8bfea7895 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -3265,7 +3265,7 @@ try_locking(const or_options_t *options, int 
err_if_locked)
 r = try_locking(options, 0);
 if (r<0) {
   log_err(LD_GENERAL, "No, it's still there.  Exiting.");
-  exit(1); //  bad exit
+  return -1;
 }
 return r;
   }



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


[tor-commits] [tor/master] Return from instead of exit()ing when ed25519 key check fails.

2017-10-27 Thread nickm
commit 853e73e815c1be9c9e533160f803de56e7d21147
Author: Nick Mathewson 
Date:   Fri Oct 20 11:03:53 2017 -0400

Return from instead of exit()ing when ed25519 key check fails.
---
 src/or/main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/or/main.c b/src/or/main.c
index 8bfea7895..d47c8f4dd 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -1609,8 +1609,7 @@ check_ed_keys_callback(time_t now, const or_options_t 
*options)
   if (new_signing_key < 0 ||
   generate_ed_link_cert(options, now, new_signing_key > 0)) {
 log_err(LD_OR, "Unable to update Ed25519 keys!  Exiting.");
-tor_cleanup();
-exit(1); //  bad exit
+tor_shutdown_event_loop_and_exit(1);
   }
 }
 return 30;



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


[tor-commits] [tor/master] Add a failsafe to kill tor if the new exit code doesn't work.

2017-10-27 Thread nickm
commit c82cc8acb5aa43b3d96490d927dcc622f2c825e3
Author: Nick Mathewson 
Date:   Fri Oct 20 10:22:04 2017 -0400

Add a failsafe to kill tor if the new exit code doesn't work.

It _should_ work, and I don't see a reason that it wouldn't, but
just in case, add a 10 second timer to make tor die with an
assertion failure if it's supposed to exit but it doesn't.
---
 src/or/main.c | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/src/or/main.c b/src/or/main.c
index 6af61d513..c3822dd94 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -656,6 +656,22 @@ tell_event_loop_to_run_external_code(void)
   }
 }
 
+/** Failsafe measure that should never actually be necessary: If
+ * tor_shutdown_event_loop_and_exit() somehow doesn't successfully exit the
+ * event loop, then this callback will kill Tor with an assertion failure
+ * seconds later
+ */
+static void
+shutdown_did_not_work_callback(evutil_socket_t fd, short event, void *arg)
+{
+  // LCOV_EXCL_START
+  (void) fd;
+  (void) event;
+  (void) arg;
+  tor_assert_unreached();
+  // LCOV_EXCL_STOP
+}
+
 /**
  * After finishing the current callback (if any), shut down the main loop,
  * clean up the process, and exit with exitcode.
@@ -669,6 +685,13 @@ tor_shutdown_event_loop_and_exit(int exitcode)
   main_loop_should_exit = 1;
   main_loop_exit_value = exitcode;
 
+  /* Die with an assertion failure in ten seconds, if for some reason we don't
+   * exit normally. */
+  struct timeval ten_seconds = { 10, 0 };
+  event_base_once(tor_libevent_get_base(), -1, EV_TIMEOUT,
+  shutdown_did_not_work_callback, NULL,
+  _seconds);
+
   /* Unlike loopexit, loopbreak prevents other callbacks from running. */
   tor_event_base_loopbreak(tor_libevent_get_base());
 }



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


[tor-commits] [tor/master] Exit more carefully when options_act() fails.

2017-10-27 Thread nickm
commit 3c99b810a46c2aba2ea4108018e78bc8f6a19013
Author: Nick Mathewson 
Date:   Fri Oct 20 11:34:03 2017 -0400

Exit more carefully when options_act() fails.

Also, annotate options_act() with places where we should be
pre-validating values.
---
 src/or/config.c | 22 --
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/or/config.c b/src/or/config.c
index 3795aeaa3..6f7bf23df 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -835,9 +835,12 @@ set_options(or_options_t *new_val, char **msg)
 return -1;
   }
   if (options_act(old_options) < 0) { /* acting on the options failed. die. */
-log_err(LD_BUG,
-"Acting on config options left us in a broken state. Dying.");
-exit(1); //  bad exit
+if (! tor_event_loop_shutdown_is_pending()) {
+  log_err(LD_BUG,
+  "Acting on config options left us in a broken state. Dying.");
+  tor_shutdown_event_loop_and_exit(1);
+}
+return -1;
   }
   /* Issues a CONF_CHANGED event to notify controller of the change. If Tor is
* just starting up then the old_options will be undefined. */
@@ -1664,8 +1667,11 @@ options_act(const or_options_t *old_options)
   return -1;
   }
 
-  if (consider_adding_dir_servers(options, old_options) < 0)
+  if (consider_adding_dir_servers(options, old_options) < 0) {
+//  This should get validated earlier, and committed here, to
+//  lower opportunities for reaching an error case.
 return -1;
+  }
 
   if (rend_non_anonymous_mode_enabled(options)) {
 log_warn(LD_GENERAL, "This copy of Tor was compiled or configured to run "
@@ -1674,6 +1680,7 @@ options_act(const or_options_t *old_options)
 
 #ifdef ENABLE_TOR2WEB_MODE
 /* LCOV_EXCL_START */
+  //  This should move into options_validate()
   if (!options->Tor2webMode) {
 log_err(LD_CONFIG, "This copy of Tor was compiled to run in "
 "'tor2web mode'. It can only be run with the Tor2webMode torrc "
@@ -1682,6 +1689,7 @@ options_act(const or_options_t *old_options)
   }
 /* LCOV_EXCL_STOP */
 #else /* !(defined(ENABLE_TOR2WEB_MODE)) */
+  //  This should move into options_validate()
   if (options->Tor2webMode) {
 log_err(LD_CONFIG, "This copy of Tor was not compiled to run in "
 "'tor2web mode'. It cannot be run with the Tor2webMode torrc "
@@ -1850,7 +1858,7 @@ options_act(const or_options_t *old_options)
 
   /* Set up accounting */
   if (accounting_parse_options(options, 0)<0) {
-log_warn(LD_CONFIG,"Error in accounting options");
+log_warn(LD_BUG,"Error in previously validated accounting options");
 return -1;
   }
   if (accounting_is_enabled(options))
@@ -1874,6 +1882,7 @@ options_act(const or_options_t *old_options)
 char *http_authenticator;
 http_authenticator = alloc_http_authenticator(options->BridgePassword);
 if (!http_authenticator) {
+  //  This should get validated in options_validate().
   log_warn(LD_BUG, "Unable to allocate HTTP authenticator. Not setting "
"BridgePassword.");
   return -1;
@@ -1886,7 +1895,8 @@ options_act(const or_options_t *old_options)
   }
 
   if (parse_outbound_addresses(options, 0, ) < 0) {
-log_warn(LD_BUG, "Failed parsing outbound bind addresses: %s", msg);
+log_warn(LD_BUG, "Failed parsing previously validated outbound "
+ "bind addresses: %s", msg);
 tor_free(msg);
 return -1;
   }



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


[tor-commits] [tor/master] Changes file for ticket 23848

2017-10-27 Thread nickm
commit 90daa28df403472d4a6aa7067ce6ab3264cdbe55
Author: Nick Mathewson 
Date:   Fri Oct 20 11:39:11 2017 -0400

Changes file for ticket 23848
---
 changes/bug23848 | 8 
 1 file changed, 8 insertions(+)

diff --git a/changes/bug23848 b/changes/bug23848
new file mode 100644
index 0..e2aec687c
--- /dev/null
+++ b/changes/bug23848
@@ -0,0 +1,8 @@
+  o Minor features (embedding):
+- On most errors that would cause Tor to exit, it now tries to return
+  from the tor_main() function, rather than calling the system exit()
+  function.  Most users won't notice a difference here, but it should
+  make a significant difference on platforms that try to run Tor inside
+  a separate thread: they should now be able to survive Tor's exit
+  conditions rather than having Tor shut down the entire process.
+  Closes ticket 23848.



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


[tor-commits] [tor/master] Rename "tell_event_loop_to_finish" to "...run_external_code"

2017-10-27 Thread nickm
commit 78cbced45cd244c8aab84e6fb8087b852769f5bc
Author: Nick Mathewson 
Date:   Fri Oct 20 09:59:48 2017 -0400

Rename "tell_event_loop_to_finish" to "...run_external_code"

This function was never about 'finishing' the event loop, but rather
about making sure that the code outside the event loop would be run
at least once.
---
 src/or/connection_edge.c | 2 +-
 src/or/main.c| 4 ++--
 src/or/main.h| 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/or/connection_edge.c b/src/or/connection_edge.c
index 77dac62b0..7d6667dbc 100644
--- a/src/or/connection_edge.c
+++ b/src/or/connection_edge.c
@@ -999,7 +999,7 @@ connection_ap_mark_as_pending_circuit_(entry_connection_t 
*entry_conn,
* So the fix is to tell it right now that it ought to finish its loop at
* its next available opportunity.
*/
-  tell_event_loop_to_finish();
+  tell_event_loop_to_run_external_code();
 }
 
 /** Mark entry_conn as no longer waiting for a circuit. */
diff --git a/src/or/main.c b/src/or/main.c
index be6162834..e3a73ef03 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -639,7 +639,7 @@ connection_should_read_from_linked_conn(connection_t *conn)
  * runs out of events, now we've changed our mind: tell it we want it to
  * finish. */
 void
-tell_event_loop_to_finish(void)
+tell_event_loop_to_run_external_code(void)
 {
   if (!called_loop_once) {
 struct timeval tv = { 0, 0 };
@@ -663,7 +663,7 @@ connection_start_reading_from_linked_conn(connection_t 
*conn)
 /* make sure that the event_base_loop() function exits at
  * the end of its run through the current connections, so we can
  * activate read events for linked connections. */
-tell_event_loop_to_finish();
+tell_event_loop_to_run_external_code();
   } else {
 tor_assert(smartlist_contains(active_linked_connection_lst, conn));
   }
diff --git a/src/or/main.h b/src/or/main.h
index 132ab12bb..808aa1414 100644
--- a/src/or/main.h
+++ b/src/or/main.h
@@ -45,7 +45,7 @@ int connection_is_writing(connection_t *conn);
 MOCK_DECL(void,connection_stop_writing,(connection_t *conn));
 MOCK_DECL(void,connection_start_writing,(connection_t *conn));
 
-void tell_event_loop_to_finish(void);
+void tell_event_loop_to_run_external_code(void);
 
 void connection_stop_reading_from_linked_conn(connection_t *conn);
 



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


[tor-commits] [tor/master] Expose a new function to make the event loop exit once and for all.

2017-10-27 Thread nickm
commit f0c3b6238168e351835fdc64b5c93b84d6528870
Author: Nick Mathewson 
Date:   Fri Oct 20 10:16:00 2017 -0400

Expose a new function to make the event loop exit once and for all.

Instead of calling tor_cleanup(), exit(x), we can now call
tor_shutdown_event_loop_and_exit.
---
 src/common/compat_libevent.h |  1 +
 src/or/main.c| 47 +++-
 src/or/main.h|  2 ++
 3 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/src/common/compat_libevent.h b/src/common/compat_libevent.h
index 834354c40..3d8672fc6 100644
--- a/src/common/compat_libevent.h
+++ b/src/common/compat_libevent.h
@@ -30,6 +30,7 @@ periodic_timer_t *periodic_timer_new(struct event_base *base,
 void periodic_timer_free(periodic_timer_t *);
 
 #define tor_event_base_loopexit event_base_loopexit
+#define tor_event_base_loopbreak event_base_loopbreak
 
 /** Defines a configuration for using libevent with Tor: passed as an argument
  * to tor_libevent_initialize() to describe how we want to set up. */
diff --git a/src/or/main.c b/src/or/main.c
index e3a73ef03..6af61d513 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -192,6 +192,14 @@ static smartlist_t *active_linked_connection_lst = NULL;
  * loop_once. If so, there's no need to trigger a loopexit in order
  * to handle linked connections. */
 static int called_loop_once = 0;
+/** Flag: if true, it's time to shut down, so the main loop should exit as
+ * soon as possible.
+ */
+static int main_loop_should_exit = 0;
+/** The return value that the main loop should yield when it exits, if
+ * main_loop_should_exit is true.
+ */
+static int main_loop_exit_value = 0;
 
 /** We set this to 1 when we've opened a circuit, so we can print a log
  * entry to inform the user that Tor is working.  We set it to 0 when
@@ -648,6 +656,30 @@ tell_event_loop_to_run_external_code(void)
   }
 }
 
+/**
+ * After finishing the current callback (if any), shut down the main loop,
+ * clean up the process, and exit with exitcode.
+ */
+void
+tor_shutdown_event_loop_and_exit(int exitcode)
+{
+  if (main_loop_should_exit)
+return; /* Ignore multiple calls to this function. */
+
+  main_loop_should_exit = 1;
+  main_loop_exit_value = exitcode;
+
+  /* Unlike loopexit, loopbreak prevents other callbacks from running. */
+  tor_event_base_loopbreak(tor_libevent_get_base());
+}
+
+/** Return true iff tor_shutdown_event_loop_and_exit() has been called. */
+int
+tor_event_loop_shutdown_is_pending(void)
+{
+  return main_loop_should_exit;
+}
+
 /** Helper: Tell the main loop to begin reading bytes into conn from
  * its linked connection, if it is not doing so already.  Called by
  * connection_start_reading and connection_start_writing as appropriate. */
@@ -2595,6 +2627,9 @@ do_main_loop(void)
   }
 #endif /* defined(HAVE_SYSTEMD) */
 
+  main_loop_should_exit = 0;
+  main_loop_exit_value = 0;
+
   return run_main_loop_until_done();
 }
 
@@ -2610,6 +2645,9 @@ run_main_loop_once(void)
   if (nt_service_is_stopping())
 return 0;
 
+  if (main_loop_should_exit)
+return 0;
+
 #ifndef _WIN32
   /* Make it easier to tell whether libevent failure is our fault or not. */
   errno = 0;
@@ -2656,6 +2694,9 @@ run_main_loop_once(void)
 }
   }
 
+  if (main_loop_should_exit)
+return 0;
+
   /* And here is where we put callbacks that happen "every time the event loop
* runs."  They must be very fast, or else the whole Tor process will get
* slowed down.
@@ -2684,7 +2725,11 @@ run_main_loop_until_done(void)
   do {
 loop_result = run_main_loop_once();
   } while (loop_result == 1);
-  return loop_result;
+
+  if (main_loop_should_exit)
+return main_loop_exit_value;
+  else
+return loop_result;
 }
 
 /** Libevent callback: invoked when we get a signal.
diff --git a/src/or/main.h b/src/or/main.h
index 808aa1414..5ab77c03e 100644
--- a/src/or/main.h
+++ b/src/or/main.h
@@ -46,6 +46,8 @@ MOCK_DECL(void,connection_stop_writing,(connection_t *conn));
 MOCK_DECL(void,connection_start_writing,(connection_t *conn));
 
 void tell_event_loop_to_run_external_code(void);
+void tor_shutdown_event_loop_and_exit(int exitcode);
+int tor_event_loop_shutdown_is_pending(void);
 
 void connection_stop_reading_from_linked_conn(connection_t *conn);
 



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


[tor-commits] [tor/master] Replace most bad exits in main.c, hibernate.c

2017-10-27 Thread nickm
commit 9bafc3b1efd64b19695cd78fb51070ff8d3939f5
Author: Nick Mathewson 
Date:   Fri Oct 20 10:25:55 2017 -0400

Replace most bad exits in main.c, hibernate.c

This should make most of the reasons that we hibernate cleaner.
---
 src/or/hibernate.c |  7 +++
 src/or/main.c  | 11 +--
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/or/hibernate.c b/src/or/hibernate.c
index be2bc7ce9..8f665a15a 100644
--- a/src/or/hibernate.c
+++ b/src/or/hibernate.c
@@ -818,8 +818,8 @@ hibernate_begin(hibernate_state_t new_state, time_t now)
 log_notice(LD_GENERAL,"SIGINT received %s; exiting now.",
hibernate_state == HIBERNATE_STATE_EXITING ?
"a second time" : "while hibernating");
-tor_cleanup();
-exit(0); //  bad exit
+tor_shutdown_event_loop_and_exit(0);
+return;
   }
 
   if (new_state == HIBERNATE_STATE_LOWBANDWIDTH &&
@@ -980,8 +980,7 @@ consider_hibernation(time_t now)
 tor_assert(shutdown_time);
 if (shutdown_time <= now) {
   log_notice(LD_GENERAL, "Clean shutdown finished. Exiting.");
-  tor_cleanup();
-  exit(0); //  bad exit
+  tor_shutdown_event_loop_and_exit(0);
 }
 return; /* if exiting soon, don't worry about bandwidth limits */
   }
diff --git a/src/or/main.c b/src/or/main.c
index c3822dd94..4d252faf2 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -2776,14 +2776,13 @@ process_signal(int sig)
 {
 case SIGTERM:
   log_notice(LD_GENERAL,"Catching signal TERM, exiting cleanly.");
-  tor_cleanup();
-  exit(0); //  bad exit
+  tor_shutdown_event_loop_and_exit(0);
   break;
 case SIGINT:
   if (!server_mode(get_options())) { /* do it now */
 log_notice(LD_GENERAL,"Interrupt: exiting cleanly.");
-tor_cleanup();
-exit(0); //  bad exit
+tor_shutdown_event_loop_and_exit(0);
+return;
   }
 #ifdef HAVE_SYSTEMD
   sd_notify(0, "STOPPING=1");
@@ -2812,8 +2811,8 @@ process_signal(int sig)
 #endif
   if (do_hup() < 0) {
 log_warn(LD_CONFIG,"Restart failed (config error?). Exiting.");
-tor_cleanup();
-exit(1); //  bad exit
+tor_shutdown_event_loop_and_exit(1);
+return;
   }
 #ifdef HAVE_SYSTEMD
   sd_notify(0, "READY=1");



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


[tor-commits] [tor/master] Make sure all C files have copyright/license notices

2017-10-27 Thread nickm
commit fa78546dbc0e62fc1b24daef881c460412f04e7e
Author: Nick Mathewson 
Date:   Fri Oct 27 10:59:36 2017 -0400

Make sure all C files have copyright/license notices
---
 src/common/crypto_pwbox.h  | 3 +++
 src/test/test-memwipe.c| 3 +++
 src/test/test_accounting.c | 3 +++
 src/test/test_channelpadding.c | 3 +++
 src/test/test_dns.c| 3 +++
 src/test/test_routerset.c  | 3 +++
 src/test/test_shared_random.c  | 3 +++
 src/test/test_status.c | 3 +++
 8 files changed, 24 insertions(+)

diff --git a/src/common/crypto_pwbox.h b/src/common/crypto_pwbox.h
index cee865358..a26b6d2c1 100644
--- a/src/common/crypto_pwbox.h
+++ b/src/common/crypto_pwbox.h
@@ -1,3 +1,6 @@
+/* Copyright (c) 2014-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
 #ifndef CRYPTO_PWBOX_H_INCLUDED_
 #define CRYPTO_PWBOX_H_INCLUDED_
 
diff --git a/src/test/test-memwipe.c b/src/test/test-memwipe.c
index 484f13dd0..89d946d50 100644
--- a/src/test/test-memwipe.c
+++ b/src/test/test-memwipe.c
@@ -1,3 +1,6 @@
+/* Copyright (c) 2015-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
 #include "orconfig.h"
 #include 
 #include 
diff --git a/src/test/test_accounting.c b/src/test/test_accounting.c
index 7edba988a..b0d37b298 100644
--- a/src/test/test_accounting.c
+++ b/src/test/test_accounting.c
@@ -1,3 +1,6 @@
+/* Copyright (c) 2014-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
 #include "or.h"
 #include "test.h"
 #define HIBERNATE_PRIVATE
diff --git a/src/test/test_channelpadding.c b/src/test/test_channelpadding.c
index d54c9cc52..fe21057c8 100644
--- a/src/test/test_channelpadding.c
+++ b/src/test/test_channelpadding.c
@@ -1,3 +1,6 @@
+/* Copyright (c) 2016-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
 #define TOR_CHANNEL_INTERNAL_
 #define MAIN_PRIVATE
 #define NETWORKSTATUS_PRIVATE
diff --git a/src/test/test_dns.c b/src/test/test_dns.c
index 19dcb0293..66b231b6d 100644
--- a/src/test/test_dns.c
+++ b/src/test/test_dns.c
@@ -1,3 +1,6 @@
+/* Copyright (c) 2015-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
 #include "or.h"
 #include "test.h"
 
diff --git a/src/test/test_routerset.c b/src/test/test_routerset.c
index c9c69911d..6da2275c3 100644
--- a/src/test/test_routerset.c
+++ b/src/test/test_routerset.c
@@ -1,3 +1,6 @@
+/* Copyright (c) 2014-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
 #define ROUTERSET_PRIVATE
 
 #include "or.h"
diff --git a/src/test/test_shared_random.c b/src/test/test_shared_random.c
index a9d58e6b8..80494f64c 100644
--- a/src/test/test_shared_random.c
+++ b/src/test/test_shared_random.c
@@ -1,3 +1,6 @@
+/* Copyright (c) 2016-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
 #define SHARED_RANDOM_PRIVATE
 #define SHARED_RANDOM_STATE_PRIVATE
 #define CONFIG_PRIVATE
diff --git a/src/test/test_status.c b/src/test/test_status.c
index f86f8e3b9..50ea203e4 100644
--- a/src/test/test_status.c
+++ b/src/test/test_status.c
@@ -1,3 +1,6 @@
+/* Copyright (c) 2014-2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
 #define STATUS_PRIVATE
 #define HIBERNATE_PRIVATE
 #define LOG_PRIVATE

___
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 'protover-rust-impl_squashed'

2017-10-27 Thread nickm
commit f5e9e2748ff5fa245936ce5e465d19b3d300e393
Merge: c4804bb28 91a1b9058
Author: Nick Mathewson 
Date:   Fri Oct 27 10:05:30 2017 -0400

Merge branch 'protover-rust-impl_squashed'

 Makefile.am|   2 +-
 changes/ticket22840|   8 +
 configure.ac   |   6 +-
 src/common/compat_rust.c   |  39 --
 src/common/compat_rust.h   |  28 --
 src/common/include.am  |   6 -
 src/or/include.am  |   1 +
 src/or/main.c  |  18 +-
 src/or/protover.c  |   4 +
 src/or/protover.h  |   6 +-
 src/or/protover_rust.c |  19 +
 src/rust/Cargo.lock|  41 ++
 src/rust/Cargo.toml|   2 +-
 src/rust/external/Cargo.toml   |  13 +
 src/rust/external/external.rs  |  33 ++
 src/rust/external/lib.rs   |  14 +
 src/rust/include.am|   2 +-
 src/rust/protover/Cargo.toml   |  25 +
 src/rust/protover/ffi.rs   | 185 +++
 src/rust/protover/lib.rs   |  33 ++
 src/rust/protover/protover.rs  | 851 +
 src/rust/protover/tests/protover.rs| 291 +++
 src/rust/smartlist/Cargo.toml  |  13 +
 src/rust/smartlist/lib.rs  |   8 +
 src/rust/smartlist/smartlist.rs| 115 +
 src/rust/tor_allocate/Cargo.toml   |  13 +
 src/rust/tor_allocate/lib.rs   |  15 +
 src/rust/tor_allocate/tor_allocate.rs  | 101 
 src/rust/tor_rust/Cargo.toml   |  16 +
 src/rust/tor_rust/include.am   |  12 +
 src/rust/tor_rust/lib.rs   |   5 +
 src/rust/tor_util/Cargo.toml   |   5 +-
 src/rust/tor_util/ffi.rs   |  62 +--
 src/rust/tor_util/include.am   |  13 -
 src/rust/tor_util/lib.rs   |  14 +-
 src/rust/tor_util/rust_string.rs   | 101 
 src/rust/tor_util/tests/rust_string.rs |  37 --
 src/test/include.am|   1 -
 src/test/test.c|   1 -
 src/test/test.h|   1 -
 src/test/test_protover.c   |  43 +-
 src/test/test_rust.c   |  31 --
 src/test/test_rust.sh  |   5 +-
 43 files changed, 1908 insertions(+), 331 deletions(-)

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


[tor-commits] [tor/master] remove experimental rust features

2017-10-27 Thread nickm
commit 90daad999e78c8ec8239e63ea03df6b3b2e364b6
Author: Chelsea Holland Komlo 
Date:   Wed Oct 25 23:02:38 2017 -0400

remove experimental rust features

allow unsafe on function that calls C
---
 src/rust/protover/lib.rs  | 2 --
 src/rust/protover/protover.rs | 3 ++-
 src/rust/tor_allocate/tor_allocate.rs | 4 
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/rust/protover/lib.rs b/src/rust/protover/lib.rs
index 620191f88..5a5dea440 100644
--- a/src/rust/protover/lib.rs
+++ b/src/rust/protover/lib.rs
@@ -1,5 +1,3 @@
-#![feature(inclusive_range_syntax)]
-
 //! Copyright (c) 2016-2017, The Tor Project, Inc. */
 //! See LICENSE for licensing information */
 
diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs
index 37589a83f..8a546e09a 100644
--- a/src/rust/protover/protover.rs
+++ b/src/rust/protover/protover.rs
@@ -362,7 +362,8 @@ fn expand_version_range(range: ) -> Result {
 "cannot parse protocol range upper bound",
 ))?;
 
-Ok((lower..=higher).collect())
+// We can use inclusive range syntax when it becomes stable.
+Ok((lower..higher+1).collect())
 }
 
 /// Checks to see if there is a continuous range of integers, starting at the
diff --git a/src/rust/tor_allocate/tor_allocate.rs 
b/src/rust/tor_allocate/tor_allocate.rs
index 7b348b6d0..03ed2499c 100644
--- a/src/rust/tor_allocate/tor_allocate.rs
+++ b/src/rust/tor_allocate/tor_allocate.rs
@@ -25,6 +25,10 @@ extern "C" fn tor_malloc_ ( size: usize) ->  *mut c_void {
 ///
 /// A `*mut c_char` that should be freed by tor_free in C
 ///
+/// Allow unused unsafe as at compile-time, we get warnings that unsafe is not
+/// needed even though this calls tor_malloc in C.
+///
+#[allow(unused_unsafe)]
 pub fn allocate_and_copy_string(src: ) -> *mut c_char {
 let bytes: &[u8] = src.as_bytes();
 



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


[tor-commits] [tor/master] use tor allocator for string allocation in rust

2017-10-27 Thread nickm
commit be583a34a3815c2c10e86094ab0610e4b7f9c869
Author: Chelsea Holland Komlo 
Date:   Wed Oct 11 15:21:20 2017 -0400

use tor allocator for string allocation in rust
---
 Makefile.am   |  1 -
 configure.ac  |  2 -
 src/common/include.am |  2 -
 src/common/rust_types.c   | 55 --
 src/common/rust_types.h   | 22 ---
 src/or/include.am |  2 +-
 src/or/protover_rust.c| 92 ---
 src/rust/Cargo.lock   | 15 +++
 src/rust/Cargo.toml   |  2 +-
 src/rust/c_string/Cargo.toml  | 13 --
 src/rust/c_string/ffi.rs  | 19 -
 src/rust/c_string/include.am  | 12 --
 src/rust/external/external.rs |  9 +++--
 src/rust/include.am   |  1 -
 src/rust/protover/Cargo.toml  |  3 ++
 src/rust/protover/ffi.rs  | 62 ++---
 src/rust/protover/lib.rs  |  1 +
 src/rust/protover/protover.rs |  2 +-
 18 files changed, 40 insertions(+), 275 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 9067e9a8a..27ee33e1e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,7 +28,6 @@ endif
 if USE_RUST
 rust_ldadd=$(top_builddir)/src/rust/target/release/@TOR_RUST_UTIL_STATIC_NAME@
 
rust_ldadd+=$(top_builddir)/src/rust/target/release/@TOR_RUST_PROTOVER_STATIC_NAME@
-rust_ldadd+=$(top_builddir)/src/rust/target/release/@TOR_RUST_C_STRING_STATIC_NAME@
 else
 rust_ldadd=
 endif
diff --git a/configure.ac b/configure.ac
index b2b353f6b..e20a6b990 100644
--- a/configure.ac
+++ b/configure.ac
@@ -441,11 +441,9 @@ if test "x$enable_rust" = "xyes"; then
   if test "$bwin32" = "true"; then
 TOR_RUST_UTIL_STATIC_NAME=tor_util.lib
 TOR_RUST_PROTOVER_STATIC_NAME=libprotover.lib
-TOR_RUST_C_STRING_STATIC_NAME=libc_string.lib
   else
 TOR_RUST_UTIL_STATIC_NAME=libtor_util.a
 TOR_RUST_PROTOVER_STATIC_NAME=libprotover.a
-TOR_RUST_C_STRING_STATIC_NAME=libc_string.a
   fi
 
   AC_SUBST(TOR_RUST_UTIL_STATIC_NAME)
diff --git a/src/common/include.am b/src/common/include.am
index 7ce84e17c..cd5eea340 100644
--- a/src/common/include.am
+++ b/src/common/include.am
@@ -94,7 +94,6 @@ LIBOR_A_SRC = \
   src/common/util_bug.c\
   src/common/util_format.c \
   src/common/util_process.c\
-  src/common/rust_types.c  \
   src/common/sandbox.c \
   src/common/storagedir.c  \
   src/common/workqueue.c   \
@@ -180,7 +179,6 @@ COMMONHEADERS = \
   src/common/procmon.h \
   src/common/pubsub.h  \
   src/common/sandbox.h \
-  src/common/rust_types.h  \
   src/common/storagedir.h  \
   src/common/testsupport.h \
   src/common/timers.h  \
diff --git a/src/common/rust_types.c b/src/common/rust_types.c
deleted file mode 100644
index 1b6dd3990..0
--- a/src/common/rust_types.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright (c) 2017, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-/**
- * \file rust_types.c
- * \brief This file is used for handling types returned from Rust to C.
- **/
-
-#include "or.h"
-#include "rust_types.h"
-
-#ifdef HAVE_RUST
-
-void free_rust_str(char *ret);
-
-/* Because Rust strings can only be freed from Rust, we first copy the string's
- * contents to a c pointer, and then free the Rust string.
- * This function can be extended to return a success/error value if needed.
- */
-void
-move_rust_str_to_c_and_free(rust_str_ref_t src, char **dest)
-{
-  if (!src) {
-log_warn(LD_BUG, "Received a null pointer from protover rust.");
-return;
-  }
-
-  if (!dest) {
-log_warn(LD_BUG, "Received a null pointer from caller to rust. "
- "This results in a memory leak due to not freeing the rust "
- "string that was meant to be copied..");
-return;
-  }
-
-  *dest = tor_strdup(src);
-  free_rust_str(src);
-  return;
-}
-
-#else
-
-/* When Rust is not enabled, this function should never be used. Log a warning
- * in the case that it is ever called when Rust is not enabled.
- */
-void
-move_rust_str_to_c_and_free(rust_str_ref_t src, char **dest)
-{
-  (void) src;
-  (void) dest;
-log_warn(LD_BUG, "Received a call to free a Rust string when we are "
- " not running with Rust enabled.");
-  return;
-}
-#endif /* defined(HAVE_RUST) */
-
diff --git a/src/common/rust_types.h b/src/common/rust_types.h
deleted file mode 100644
index b6d807e65..0
--- a/src/common/rust_types.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (c) 2017, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-/**
- * \file rust_types.h
- * \brief Headers for rust_types.c
- 

[tor-commits] [tor/master] cargo fmt; fix line length warnings

2017-10-27 Thread nickm
commit 6be75bd61d72636a1c23b6fd9866d33a35433a73
Author: Chelsea Holland Komlo 
Date:   Thu Oct 26 09:50:50 2017 -0400

cargo fmt; fix line length warnings
---
 src/rust/protover/ffi.rs  |  1 -
 src/rust/protover/protover.rs | 14 --
 src/rust/protover/tests/protover.rs   | 16 
 src/rust/smartlist/smartlist.rs   |  5 ++---
 src/rust/tor_allocate/tor_allocate.rs | 18 --
 src/rust/tor_util/ffi.rs  |  6 --
 6 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs
index 23a289bd5..f897c9808 100644
--- a/src/rust/protover/ffi.rs
+++ b/src/rust/protover/ffi.rs
@@ -13,7 +13,6 @@ use tor_allocate::allocate_and_copy_string;
 /// Translate C enums to Rust Proto enums, using the integer value of the C
 /// enum to map to its associated Rust enum
 /// This is dependant on the associated C enum preserving ordering.
-/// Modify the C documentation to give warnings-  you must also re-order the 
rust
 fn translate_to_rust(c_proto: uint32_t) -> Result {
 match c_proto {
 0 => Ok(Proto::Link),
diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs
index 8a546e09a..d75da61aa 100644
--- a/src/rust/protover/protover.rs
+++ b/src/rust/protover/protover.rs
@@ -142,7 +142,8 @@ fn tor_supported() -> Result, 
&'static str> {
 /// This function will error if:
 ///
 /// * the `version_string` is empty or contains an equals (`"="`) sign,
-/// * the expansion of a version range produces an error (see 
`expand_version_range`),
+/// * the expansion of a version range produces an error (see
+///  `expand_version_range`),
 /// * any single version number is not parseable as an `u32` in radix 10, or
 /// * there are greater than 2^16 version numbers to expand.
 ///
@@ -293,10 +294,12 @@ pub fn all_supported(protocols: ) -> (bool, String) {
 /// ```
 /// use protover::*;
 ///
-/// let is_supported = protover_string_supports_protocol("Link=3-4 Cons=1", 
Proto::Cons,1);
+/// let is_supported = protover_string_supports_protocol("Link=3-4 Cons=1",
+///  Proto::Cons,1);
 /// assert_eq!(true, is_supported);
 ///
-/// let is_not_supported = protover_string_supports_protocol("Link=3-4 
Cons=1", Proto::Cons,5);
+/// let is_not_supported = protover_string_supports_protocol("Link=3-4 Cons=1",
+///   Proto::Cons,5);
 /// assert_eq!(false, is_not_supported)
 /// ```
 pub fn protover_string_supports_protocol(
@@ -363,7 +366,7 @@ fn expand_version_range(range: ) -> Result {
 ))?;
 
 // We can use inclusive range syntax when it becomes stable.
-Ok((lower..higher+1).collect())
+Ok((lower..higher + 1).collect())
 }
 
 /// Checks to see if there is a continuous range of integers, starting at the
@@ -477,8 +480,7 @@ fn contract_protocol_list<'a>(supported_set: &'a 
HashSet) -> String {
 fn parse_protocols_from_string_with_no_validation<'a>(
 protocol_string: &'a str,
 ) -> Result, &'static str> {
-let protocols = _string.split(" ")
-.collect::>()[..];
+let protocols = _string.split(" ").collect::>()[..];
 
 let mut parsed: HashMap = HashMap::new();
 
diff --git a/src/rust/protover/tests/protover.rs 
b/src/rust/protover/tests/protover.rs
index 7d8484ecc..af7633a48 100644
--- a/src/rust/protover/tests/protover.rs
+++ b/src/rust/protover/tests/protover.rs
@@ -1,7 +1,7 @@
 extern crate protover;
 
 #[test]
-fn 
parse_protocol_list_with_single_protocol_and_single_version_returns_set_of_one(){
+fn parse_protocol_list_with_single_proto_and_single_version() {
 let protocol = "Cons=1";
 let (is_supported, unsupported) = protover::all_supported(protocol);
 assert_eq!(true, is_supported);
@@ -9,7 +9,7 @@ fn 
parse_protocol_list_with_single_protocol_and_single_version_returns_set_of_on
 }
 
 #[test]
-fn 
parse_protocol_list_with_single_protocol_and_multiple_versions_returns_set_of_one(){
+fn parse_protocol_list_with_single_protocol_and_multiple_versions() {
 let protocol = "Cons=1-2";
 let (is_supported, unsupported) = protover::all_supported(protocol);
 assert_eq!(true, is_supported);
@@ -17,7 +17,7 @@ fn 
parse_protocol_list_with_single_protocol_and_multiple_versions_returns_set_of
 }
 
 #[test]
-fn 
parse_protocol_list_with_different_single_protocol_and_single_version_returns_set_of_one(){
+fn parse_protocol_list_with_different_single_protocol_and_single_version() {
 let protocol = "HSDir=1";
 let (is_supported, unsupported) = protover::all_supported(protocol);
 assert_eq!(true, is_supported);
@@ -25,7 +25,7 @@ fn 
parse_protocol_list_with_different_single_protocol_and_single_version_returns
 }
 
 #[test]
-fn 

[tor-commits] [tor/master] Add a changes file

2017-10-27 Thread nickm
commit 91a1b9058bccf17893bea3e0c8dd98b5141bdfa9
Author: Nick Mathewson 
Date:   Fri Oct 27 10:01:47 2017 -0400

Add a changes file
---
 changes/ticket22840 | 8 
 1 file changed, 8 insertions(+)

diff --git a/changes/ticket22840 b/changes/ticket22840
new file mode 100644
index 0..6d234fb0d
--- /dev/null
+++ b/changes/ticket22840
@@ -0,0 +1,8 @@
+  o Major features (Rust experimentation):
+- Tor now ships with an optional implementation of one of its smaller
+  modules (protover.c) in the Rust programming language.  To try it
+  out, install a Rust build environment, and configure Tor with
+  "--enable-rust --enable-cargo-online-mode".  This should not
+  cause any user-visible changes, but should help us gain more experience
+  with Rust, and plan future Rust integration work.
+  Implementation by Chelsea Komlo. Closes ticket 22840.



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


[tor-commits] [tor/master] move to allocating c strings from rust

2017-10-27 Thread nickm
commit 91bca5c31b9eefe4d07645f690f69914c89a5594
Author: Chelsea Holland Komlo 
Date:   Sun Oct 22 00:07:16 2017 -0400

move to allocating c strings from rust
---
 src/common/compat_rust.c   |  39 -
 src/common/compat_rust.h   |  28 -
 src/common/include.am  |   6 --
 src/or/main.c  |  18 +++---
 src/rust/Cargo.lock|   1 +
 src/rust/tor_allocate/tor_allocate.rs  |   4 +-
 src/rust/tor_util/Cargo.toml   |   3 +
 src/rust/tor_util/ffi.rs   |  57 ---
 src/rust/tor_util/lib.rs   |  11 +---
 src/rust/tor_util/rust_string.rs   | 101 -
 src/rust/tor_util/tests/rust_string.rs |  37 
 src/test/include.am|   1 -
 src/test/test.c|   1 -
 src/test/test.h|   1 -
 src/test/test_rust.c   |  31 --
 src/test/test_rust.sh  |   5 +-
 16 files changed, 33 insertions(+), 311 deletions(-)

diff --git a/src/common/compat_rust.c b/src/common/compat_rust.c
deleted file mode 100644
index 366fd4037..0
--- a/src/common/compat_rust.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Copyright (c) 2017, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-/**
- * \file rust_compat.c
- * \brief Rust FFI compatibility functions and helpers. This file is only built
- * if Rust is not used.
- **/
-
-#include "compat_rust.h"
-#include "util.h"
-
-/**
- * Free storage pointed to by str, and itself.
- */
-void
-rust_str_free(rust_str_t str)
-{
-char *s = (char *)str;
-tor_free(s);
-}
-
-/**
- * Return zero-terminated contained string.
- */
-const char *
-rust_str_get(const rust_str_t str)
-{
-return (const char *)str;
-}
-
-/* If we were using Rust, we'd say so on startup. */
-rust_str_t
-rust_welcome_string(void)
-{
-char *s = tor_malloc_zero(1);
-return (rust_str_t)s;
-}
-
diff --git a/src/common/compat_rust.h b/src/common/compat_rust.h
deleted file mode 100644
index 72fde3929..0
--- a/src/common/compat_rust.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (c) 2017, The Tor Project, Inc. */
-/* See LICENSE for licensing information */
-
-/**
- * \file rust_compat.h
- * \brief Headers for rust_compat.c
- **/
-
-#ifndef TOR_RUST_COMPAT_H
-#define TOR_RUST_COMPAT_H
-
-#include "torint.h"
-
-/**
- * Strings allocated in Rust must be freed from Rust code again. Let's make
- * it less likely to accidentally mess up and call tor_free() on it, because
- * currently it'll just work but might break at any time.
- */
-typedef uintptr_t rust_str_t;
-
-void rust_str_free(rust_str_t);
-
-const char *rust_str_get(const rust_str_t);
-
-rust_str_t rust_welcome_string(void);
-
-#endif /* !defined(TOR_RUST_COMPAT_H) */
-
diff --git a/src/common/include.am b/src/common/include.am
index cd5eea340..2856c40fd 100644
--- a/src/common/include.am
+++ b/src/common/include.am
@@ -101,11 +101,6 @@ LIBOR_A_SRC = \
   $(threads_impl_source)   \
   $(readpassphrase_source)
 
-if USE_RUST
-else
-LIBOR_A_SRC += src/common/compat_rust.c
-endif
-
 src/common/src_common_libor_testing_a-log.$(OBJEXT) \
   src/common/log.$(OBJEXT): micro-revision.i
 
@@ -156,7 +151,6 @@ COMMONHEADERS = \
   src/common/compat.h  \
   src/common/compat_libevent.h \
   src/common/compat_openssl.h  \
-  src/common/compat_rust.h \
   src/common/compat_threads.h  \
   src/common/compat_time.h \
   src/common/compress.h\
diff --git a/src/or/main.c b/src/or/main.c
index 65b0b8f4d..e9f636aa5 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -60,7 +60,6 @@
 #include "circuitlist.h"
 #include "circuituse.h"
 #include "command.h"
-#include "compat_rust.h"
 #include "compress.h"
 #include "config.h"
 #include "confparse.h"
@@ -128,6 +127,10 @@
 
 void evdns_shutdown(int);
 
+// helper function defined in Rust to output a log message indicating if tor is
+// running with Rust enabled. See src/rust/tor_util
+char *rust_welcome_string(void);
+
 /* PROTOTYPES **/
 
 static void dumpmemusage(int severity);
@@ -3111,14 +3114,13 @@ tor_init(int argc, char *argv[])
  "Expect more bugs than usual.");
   }
 
-  {
-rust_str_t rust_str = rust_welcome_string();
-const char *s = rust_str_get(rust_str);
-if (strlen(s) > 0) {
-  log_notice(LD_GENERAL, "%s", s);
-}
-rust_str_free(rust_str);
+#ifdef HAVE_RUST
+  char *rust_str = rust_welcome_string();
+  if (rust_str != NULL && strlen(rust_str) > 0) {
+log_notice(LD_GENERAL, "%s", rust_str);
   }
+  tor_free(rust_str);
+#endif
 
   if (network_init()<0) {
 log_err(LD_BUG,"Error initializing network; exiting.");
diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock
index 

[tor-commits] [tor/master] refactor build infrastructure for single rust binary

2017-10-27 Thread nickm
commit 0c4d535972bcf14fec0b65c82359db28b0cc0091
Author: Chelsea Holland Komlo 
Date:   Thu Oct 12 17:29:51 2017 -0400

refactor build infrastructure for single rust binary
---
 Makefile.am  |  3 +--
 configure.ac | 10 +++---
 src/rust/Cargo.lock  |  8 
 src/rust/Cargo.toml  |  2 +-
 src/rust/include.am  |  3 +--
 src/rust/tor_rust/Cargo.toml | 16 
 src/rust/tor_rust/include.am | 12 
 src/rust/tor_rust/lib.rs |  5 +
 src/rust/tor_util/include.am | 13 -
 9 files changed, 47 insertions(+), 25 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 27ee33e1e..137fb1edc 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -26,8 +26,7 @@ TESTING_TOR_BINARY=$(top_builddir)/src/or/tor$(EXEEXT)
 endif
 
 if USE_RUST
-rust_ldadd=$(top_builddir)/src/rust/target/release/@TOR_RUST_UTIL_STATIC_NAME@
-rust_ldadd+=$(top_builddir)/src/rust/target/release/@TOR_RUST_PROTOVER_STATIC_NAME@
+rust_ldadd=$(top_builddir)/src/rust/target/release/@TOR_RUST_STATIC_NAME@
 else
 rust_ldadd=
 endif
diff --git a/configure.ac b/configure.ac
index e20a6b990..c0d454ae4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -439,16 +439,12 @@ if test "x$enable_rust" = "xyes"; then
   dnl For now both MSVC and MinGW rust libraries will output static libs with
   dnl the MSVC naming convention.
   if test "$bwin32" = "true"; then
-TOR_RUST_UTIL_STATIC_NAME=tor_util.lib
-TOR_RUST_PROTOVER_STATIC_NAME=libprotover.lib
+TOR_RUST_STATIC_NAME=tor_rust.lib
   else
-TOR_RUST_UTIL_STATIC_NAME=libtor_util.a
-TOR_RUST_PROTOVER_STATIC_NAME=libprotover.a
+TOR_RUST_STATIC_NAME=libtor_rust.a
   fi
 
-  AC_SUBST(TOR_RUST_UTIL_STATIC_NAME)
-  AC_SUBST(TOR_RUST_PROTOVER_STATIC_NAME)
-  AC_SUBST(TOR_RUST_C_STRING_STATIC_NAME)
+  AC_SUBST(TOR_RUST_STATIC_NAME)
   AC_SUBST(CARGO_ONLINE)
   AC_SUBST(RUST_DL)
 
diff --git a/src/rust/Cargo.lock b/src/rust/Cargo.lock
index 56cb9d76b..a5686979f 100644
--- a/src/rust/Cargo.lock
+++ b/src/rust/Cargo.lock
@@ -42,5 +42,13 @@ dependencies = [
  "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "tor_rust"
+version = "0.1.0"
+dependencies = [
+ "protover 0.0.1",
+ "tor_util 0.0.1",
+]
+
 [metadata]
 "checksum libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)" 
= "babb8281da88cba992fa1f4ddec7d63ed96280a1a53ec9b919fd37b53d71e502"
diff --git a/src/rust/Cargo.toml b/src/rust/Cargo.toml
index 5d4292bbd..953c9b96b 100644
--- a/src/rust/Cargo.toml
+++ b/src/rust/Cargo.toml
@@ -1,5 +1,5 @@
 [workspace]
-members = ["tor_util", "protover", "smartlist", "external", "tor_allocate"]
+members = ["tor_util", "protover", "smartlist", "external", "tor_allocate", 
"tor_rust"]
 
 [profile.release]
 debug = true
diff --git a/src/rust/include.am b/src/rust/include.am
index 716d46f4c..025d921b3 100644
--- a/src/rust/include.am
+++ b/src/rust/include.am
@@ -1,5 +1,4 @@
-include src/rust/tor_util/include.am
-include src/rust/protover/include.am
+include src/rust/tor_rust/include.am
 
 EXTRA_DIST +=\
src/rust/Cargo.toml \
diff --git a/src/rust/tor_rust/Cargo.toml b/src/rust/tor_rust/Cargo.toml
new file mode 100644
index 0..86fad3ee7
--- /dev/null
+++ b/src/rust/tor_rust/Cargo.toml
@@ -0,0 +1,16 @@
+[package]
+authors = ["The Tor Project"]
+name = "tor_rust"
+version = "0.1.0"
+
+[lib]
+name = "tor_rust"
+path = "lib.rs"
+crate_type = ["rlib", "staticlib"]
+
+[dependencies.tor_util]
+path = "../tor_util"
+
+[dependencies.protover]
+path = "../protover"
+
diff --git a/src/rust/tor_rust/include.am b/src/rust/tor_rust/include.am
new file mode 100644
index 0..7d30592b0
--- /dev/null
+++ b/src/rust/tor_rust/include.am
@@ -0,0 +1,12 @@
+EXTRA_DIST +=\
+   src/rust/tor_rust/Cargo.toml \
+   src/rust/tor_rust/lib.rs \
+   src/rust/tor_rust/tor_rust.rs
+
+src/rust/target/release/@TOR_RUST_STATIC_NAME@: FORCE
+   ( cd "$(abs_top_srcdir)/src/rust/tor_rust" ; \
+   CARGO_TARGET_DIR="$(abs_top_builddir)/src/rust/target" \
+   CARGO_HOME="$(abs_top_builddir)/src/rust" \
+   $(CARGO) build --release --quiet $(CARGO_ONLINE) )
+
+FORCE:
diff --git a/src/rust/tor_rust/lib.rs b/src/rust/tor_rust/lib.rs
new file mode 100644
index 0..c1585c048
--- /dev/null
+++ b/src/rust/tor_rust/lib.rs
@@ -0,0 +1,5 @@
+extern crate tor_util;
+extern crate protover;
+
+pub use tor_util::*;
+pub use protover::*;
diff --git a/src/rust/tor_util/include.am b/src/rust/tor_util/include.am
deleted file mode 100644
index ec3898577..0
--- a/src/rust/tor_util/include.am
+++ /dev/null
@@ -1,13 +0,0 @@
-EXTRA_DIST +=\
-   src/rust/tor_util/Cargo.toml \
-   src/rust/tor_util/lib.rs \
-   src/rust/tor_util/ffi.rs \
-   src/rust/tor_util/rust_string.rs
-
-src/rust/target/release/@TOR_RUST_UTIL_STATIC_NAME@: FORCE
-   ( cd "$(abs_top_srcdir)/src/rust/tor_util" ; \
-   

[tor-commits] [tor/master] update tor_allocate and add tests

2017-10-27 Thread nickm
commit 7999d0bf6b362972f7e2edab9586435bd4daf563
Author: Chelsea Holland Komlo 
Date:   Wed Oct 25 22:22:10 2017 -0400

update tor_allocate and add tests
---
 src/rust/tor_allocate/tor_allocate.rs | 22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/rust/tor_allocate/tor_allocate.rs 
b/src/rust/tor_allocate/tor_allocate.rs
index e2fc3ea36..7b348b6d0 100644
--- a/src/rust/tor_allocate/tor_allocate.rs
+++ b/src/rust/tor_allocate/tor_allocate.rs
@@ -1,5 +1,5 @@
 use libc::{c_char, c_void};
-use std::{ptr, slice};
+use std::{ptr, slice, mem};
 
 #[cfg(not(test))]
 extern "C" {
@@ -19,29 +19,35 @@ extern "C" fn tor_malloc_ ( size: usize) ->  *mut c_void {
 ///
 /// # Inputs
 ///
-/// * `src`, a reference to a String that will be copied.
+/// * `src`, a reference to a String.
 ///
 /// # Returns
 ///
-/// A `String` that should be freed by tor_free in C
+/// A `*mut c_char` that should be freed by tor_free in C
 ///
 pub fn allocate_and_copy_string(src: ) -> *mut c_char {
-let bytes = src.as_bytes();
+let bytes: &[u8] = src.as_bytes();
 
-let size = bytes.len();
-let size_with_null_byte = size + 1;
+let size =  mem::size_of_val::<[u8]>(bytes);
+let size_one_byte = mem::size_of::();
+
+// handle integer overflow when adding one to the calculated length
+let size_with_null_byte = match size.checked_add(size_one_byte) {
+Some(n) => n,
+None => return ptr::null_mut(),
+};
 
 let dest = unsafe { tor_malloc_(size_with_null_byte) as *mut u8 };
 
 if dest.is_null() {
-return dest as *mut c_char;
+return ptr::null_mut();
 }
 
 unsafe { ptr::copy_nonoverlapping(bytes.as_ptr(), dest, size) };
 
 // set the last byte as null, using the ability to index into a slice
 // rather than doing pointer arithmatic
-let slice = unsafe { slice::from_raw_parts_mut(dest, size_with_null_byte) 
};
+let slice = unsafe { slice::from_raw_parts_mut(dest, size_with_null_byte)};
 slice[size] = 0; // add a null terminator
 
 dest as *mut c_char



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


[tor-commits] [tor/master] remove unused include.am for rust modules

2017-10-27 Thread nickm
commit 7d126b9db9628740aeb40a007d247a8affee466f
Author: Chelsea Holland Komlo 
Date:   Mon Oct 23 23:19:44 2017 -0400

remove unused include.am for rust modules
---
 src/rust/protover/include.am | 14 --
 src/rust/tor_allocate/include.am | 13 -
 2 files changed, 27 deletions(-)

diff --git a/src/rust/protover/include.am b/src/rust/protover/include.am
deleted file mode 100644
index 326dbbb7f..0
--- a/src/rust/protover/include.am
+++ /dev/null
@@ -1,14 +0,0 @@
-EXTRA_DIST +=\
-   src/rust/protover/Cargo.toml \
-   src/rust/protover/lib.rs \
-   src/rust/protover/ffi.rs \
-   src/rust/protover/external.rs
-
-src/rust/target/release/@TOR_RUST_PROTOVER_STATIC_NAME@: FORCE
-   ( cd "$(abs_top_srcdir)/src/rust/protover" ; \
-   CARGO_TARGET_DIR="$(abs_top_builddir)/src/rust/target" \
-CARGO_HOME="$(abs_top_builddir)/src/rust" \
-   $(CARGO) build --release --quiet $(CARGO_ONLINE) )
-
-FORCE:
-
diff --git a/src/rust/tor_allocate/include.am b/src/rust/tor_allocate/include.am
deleted file mode 100644
index 9e770dbc0..0
--- a/src/rust/tor_allocate/include.am
+++ /dev/null
@@ -1,13 +0,0 @@
-EXTRA_DIST +=\
-   src/rust/tor_allocate/Cargo.toml \
-   src/rust/tor_allocate/lib.rs \
-   src/rust/tor_allocate/tor_allocate.rs
-
-src/rust/target/release/@TOR_RUST_C_STRING_STATIC_NAME@: FORCE
-   ( cd "$(abs_top_srcdir)/src/rust/tor_allocate" ; \
-   CARGO_TARGET_DIR="$(abs_top_builddir)/src/rust/target" \
-CARGO_HOME="$(abs_top_builddir)/src/rust" \
-   $(CARGO) build --release --quiet $(CARGO_ONLINE) )
-
-FORCE:
-



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


[tor-commits] [tor/master] add tor allocator for rust

2017-10-27 Thread nickm
commit 76bbdfbfa9eca46b53d3ec5a44deafce51d2875a
Author: Chelsea Holland Komlo 
Date:   Sat Oct 14 23:05:31 2017 -0400

add tor allocator for rust
---
 src/rust/protover/ffi.rs  | 20 
 src/rust/tor_allocate/Cargo.toml  | 13 +
 src/rust/tor_allocate/include.am  | 13 +
 src/rust/tor_allocate/lib.rs  | 12 +
 src/rust/tor_allocate/tor_allocate.rs | 90 +++
 5 files changed, 138 insertions(+), 10 deletions(-)

diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs
index 539b6c0ba..23a289bd5 100644
--- a/src/rust/protover/ffi.rs
+++ b/src/rust/protover/ffi.rs
@@ -8,7 +8,7 @@ use std::ffi::CString;
 
 use protover::*;
 use smartlist::*;
-use tor_allocate::allocate_string;
+use tor_allocate::allocate_and_copy_string;
 
 /// Translate C enums to Rust Proto enums, using the integer value of the C
 /// enum to map to its associated Rust enum
@@ -124,17 +124,17 @@ pub extern "C" fn protover_compute_vote(
 ) -> *mut c_char {
 
 if list.is_null() {
-let mut empty = String::new();
-return allocate_string( empty);
+let empty = String::new();
+return allocate_and_copy_string();
 }
 
 // Dereference of raw pointer requires an unsafe block. The pointer is
 // checked above to ensure it is not null.
 let data: Vec = unsafe { (*list).get_list() };
 
-let mut vote = compute_vote(data, threshold);
+let vote = compute_vote(data, threshold);
 
-allocate_string( vote)
+allocate_and_copy_string()
 }
 
 /// Provide an interface for C to translate arguments and return types for
@@ -162,10 +162,10 @@ pub extern "C" fn protover_compute_for_old_tor(
 ) -> *mut c_char {
 // Not handling errors when unwrapping as the content is controlled
 // and is an empty string
-let mut empty = String::new();
+let empty = String::new();
 
 if version.is_null() {
-return allocate_string( empty);
+return allocate_and_copy_string();
 }
 
 // Require an unsafe block to read the version from a C string. The pointer
@@ -174,10 +174,10 @@ pub extern "C" fn protover_compute_for_old_tor(
 
 let version = match c_str.to_str() {
 Ok(n) => n,
-Err(_) => return allocate_string( empty),
+Err(_) => return allocate_and_copy_string(),
 };
 
-let mut supported = compute_for_old_tor();
+let supported = compute_for_old_tor();
 
-allocate_string( supported)
+allocate_and_copy_string()
 }
diff --git a/src/rust/tor_allocate/Cargo.toml b/src/rust/tor_allocate/Cargo.toml
new file mode 100644
index 0..ceb08b78a
--- /dev/null
+++ b/src/rust/tor_allocate/Cargo.toml
@@ -0,0 +1,13 @@
+[package]
+authors = ["The Tor Project"]
+version = "0.0.1"
+name = "tor_allocate"
+
+[dependencies]
+libc = "0.2.22"
+
+[lib]
+name = "tor_allocate"
+path = "lib.rs"
+crate_type = ["rlib", "staticlib"]
+
diff --git a/src/rust/tor_allocate/include.am b/src/rust/tor_allocate/include.am
new file mode 100644
index 0..9e770dbc0
--- /dev/null
+++ b/src/rust/tor_allocate/include.am
@@ -0,0 +1,13 @@
+EXTRA_DIST +=\
+   src/rust/tor_allocate/Cargo.toml \
+   src/rust/tor_allocate/lib.rs \
+   src/rust/tor_allocate/tor_allocate.rs
+
+src/rust/target/release/@TOR_RUST_C_STRING_STATIC_NAME@: FORCE
+   ( cd "$(abs_top_srcdir)/src/rust/tor_allocate" ; \
+   CARGO_TARGET_DIR="$(abs_top_builddir)/src/rust/target" \
+CARGO_HOME="$(abs_top_builddir)/src/rust" \
+   $(CARGO) build --release --quiet $(CARGO_ONLINE) )
+
+FORCE:
+
diff --git a/src/rust/tor_allocate/lib.rs b/src/rust/tor_allocate/lib.rs
new file mode 100644
index 0..81afd095f
--- /dev/null
+++ b/src/rust/tor_allocate/lib.rs
@@ -0,0 +1,12 @@
+//! Allocation helper functions that allow data to be allocated in Rust
+//! using tor's specified allocator. In doing so, this can be later freed
+//! from C.
+//!
+//! This is currently a temporary solution, we will later use tor's allocator
+//! by default for any allocation that occurs in Rust. However, as this will
+//! stabalize in 2018, we can use this as a temporary measure.
+
+extern crate libc;
+
+mod tor_allocate;
+pub use tor_allocate::*;
diff --git a/src/rust/tor_allocate/tor_allocate.rs 
b/src/rust/tor_allocate/tor_allocate.rs
new file mode 100644
index 0..de1d13942
--- /dev/null
+++ b/src/rust/tor_allocate/tor_allocate.rs
@@ -0,0 +1,90 @@
+use libc::{c_char, c_void};
+use std::{ptr, slice};
+
+#[cfg(not(test))]
+extern "C" {
+fn tor_malloc_ ( size: usize) ->  *mut c_void;
+}
+
+// Defined only for tests, used for testing purposes, so that we don't need
+// to link to tor C files. Uses the system allocator
+#[cfg(test)]
+extern "C" fn tor_malloc_ ( size: usize) ->  *mut c_void {
+use libc::malloc;
+unsafe { malloc(size) }
+}
+
+/// Allocate memory using tor_malloc_ and copy an existing string into the
+/// allocated buffer, returning a pointer that 

[tor-commits] [tor/master] minimize scope for unsafe

2017-10-27 Thread nickm
commit 0c04b54d4d78f7f3117948358b3d05e644fa1aeb
Author: Chelsea Holland Komlo 
Date:   Thu Sep 28 03:08:37 2017 +

minimize scope for unsafe

update documentation

missing check for null
---
 src/common/rust_types.c   | 2 +-
 src/or/protover_rust.c| 2 +-
 src/rust/external/external.rs | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/common/rust_types.c b/src/common/rust_types.c
index d116b515b..1b6dd3990 100644
--- a/src/common/rust_types.c
+++ b/src/common/rust_types.c
@@ -26,7 +26,7 @@ move_rust_str_to_c_and_free(rust_str_ref_t src, char **dest)
   }
 
   if (!dest) {
-log_warn(LD_BUG, "Received a null pointer from caller to protover rust. "
+log_warn(LD_BUG, "Received a null pointer from caller to rust. "
  "This results in a memory leak due to not freeing the rust "
  "string that was meant to be copied..");
 return;
diff --git a/src/or/protover_rust.c b/src/or/protover_rust.c
index ebe815357..261555d1e 100644
--- a/src/or/protover_rust.c
+++ b/src/or/protover_rust.c
@@ -85,7 +85,7 @@ protover_all_supported(const char *s, char **missing_out)
   rust_str_ref_t missing_out_copy = NULL;
   int is_supported  = rust_protover_all_supported(s, _out_copy);
 
-  if (!is_supported) {
+  if (!is_supported && missing_out_copy != NULL) {
 move_rust_str_to_c_and_free(missing_out_copy, missing_out);
   }
 
diff --git a/src/rust/external/external.rs b/src/rust/external/external.rs
index 0e8d1eb0d..f3267949c 100644
--- a/src/rust/external/external.rs
+++ b/src/rust/external/external.rs
@@ -24,6 +24,6 @@ pub fn c_tor_version_as_new_as(platform: , cutoff: ) 
-> bool {
 let result: c_int;
 unsafe {
 result = tor_version_as_new_as(c_platform.as_ptr(), c_cutoff.as_ptr());
-result == 1
 }
+result == 1
 }



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


[tor-commits] [tor/master] Add missing copyright/license statements on all .rs files

2017-10-27 Thread nickm
commit 2ca8fcb892d6e0452160ed9a19fe7cb4c3741b40
Author: Nick Mathewson 
Date:   Fri Oct 27 09:54:54 2017 -0400

Add missing copyright/license statements on all .rs files

(Yes, I have Chelsea's permission.)
---
 src/rust/external/external.rs | 3 +++
 src/rust/protover/ffi.rs  | 3 +++
 src/rust/protover/protover.rs | 3 +++
 src/rust/protover/tests/protover.rs   | 3 +++
 src/rust/smartlist/lib.rs | 3 +++
 src/rust/smartlist/smartlist.rs   | 3 +++
 src/rust/tor_allocate/lib.rs  | 3 +++
 src/rust/tor_allocate/tor_allocate.rs | 3 +++
 src/rust/tor_util/ffi.rs  | 3 +++
 src/rust/tor_util/lib.rs  | 3 +++
 10 files changed, 30 insertions(+)

diff --git a/src/rust/external/external.rs b/src/rust/external/external.rs
index 09d80cb2b..b9e17f021 100644
--- a/src/rust/external/external.rs
+++ b/src/rust/external/external.rs
@@ -1,3 +1,6 @@
+// Copyright (c) 2016-2017, The Tor Project, Inc. */
+// See LICENSE for licensing information */
+
 use libc::{c_char, c_int};
 use std::ffi::CString;
 
diff --git a/src/rust/protover/ffi.rs b/src/rust/protover/ffi.rs
index f897c9808..cf2e9fd78 100644
--- a/src/rust/protover/ffi.rs
+++ b/src/rust/protover/ffi.rs
@@ -1,3 +1,6 @@
+// Copyright (c) 2016-2017, The Tor Project, Inc. */
+// See LICENSE for licensing information */
+
 //! FFI functions, only to be called from C.
 //!
 //! Equivalent C versions of this api are in `src/or/protover.c`
diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs
index d75da61aa..11e9d0079 100644
--- a/src/rust/protover/protover.rs
+++ b/src/rust/protover/protover.rs
@@ -1,3 +1,6 @@
+// Copyright (c) 2016-2017, The Tor Project, Inc. */
+// See LICENSE for licensing information */
+
 use external::c_tor_version_as_new_as;
 
 use std::str::FromStr;
diff --git a/src/rust/protover/tests/protover.rs 
b/src/rust/protover/tests/protover.rs
index af7633a48..f4e394b3e 100644
--- a/src/rust/protover/tests/protover.rs
+++ b/src/rust/protover/tests/protover.rs
@@ -1,3 +1,6 @@
+// Copyright (c) 2016-2017, The Tor Project, Inc. */
+// See LICENSE for licensing information */
+
 extern crate protover;
 
 #[test]
diff --git a/src/rust/smartlist/lib.rs b/src/rust/smartlist/lib.rs
index 71d89a3b8..14a814831 100644
--- a/src/rust/smartlist/lib.rs
+++ b/src/rust/smartlist/lib.rs
@@ -1,3 +1,6 @@
+// Copyright (c) 2016-2017, The Tor Project, Inc. */
+// See LICENSE for licensing information */
+
 extern crate libc;
 
 mod smartlist;
diff --git a/src/rust/smartlist/smartlist.rs b/src/rust/smartlist/smartlist.rs
index 9f5e14f1a..ec5d7a57f 100644
--- a/src/rust/smartlist/smartlist.rs
+++ b/src/rust/smartlist/smartlist.rs
@@ -1,3 +1,6 @@
+// Copyright (c) 2016-2017, The Tor Project, Inc. */
+// See LICENSE for licensing information */
+
 use std::slice;
 use libc::{c_char, c_int};
 use std::ffi::CStr;
diff --git a/src/rust/tor_allocate/lib.rs b/src/rust/tor_allocate/lib.rs
index 81afd095f..937a5dcf6 100644
--- a/src/rust/tor_allocate/lib.rs
+++ b/src/rust/tor_allocate/lib.rs
@@ -1,3 +1,6 @@
+// Copyright (c) 2016-2017, The Tor Project, Inc. */
+// See LICENSE for licensing information */
+
 //! Allocation helper functions that allow data to be allocated in Rust
 //! using tor's specified allocator. In doing so, this can be later freed
 //! from C.
diff --git a/src/rust/tor_allocate/tor_allocate.rs 
b/src/rust/tor_allocate/tor_allocate.rs
index 663600ec5..8a6fabe9c 100644
--- a/src/rust/tor_allocate/tor_allocate.rs
+++ b/src/rust/tor_allocate/tor_allocate.rs
@@ -1,3 +1,6 @@
+// Copyright (c) 2016-2017, The Tor Project, Inc. */
+// See LICENSE for licensing information */
+
 use libc::{c_char, c_void};
 use std::{ptr, slice, mem};
 
diff --git a/src/rust/tor_util/ffi.rs b/src/rust/tor_util/ffi.rs
index 214727a19..76c6e6d39 100644
--- a/src/rust/tor_util/ffi.rs
+++ b/src/rust/tor_util/ffi.rs
@@ -1,3 +1,6 @@
+// Copyright (c) 2016-2017, The Tor Project, Inc. */
+// See LICENSE for licensing information */
+
 //! FFI functions to announce Rust support during tor startup, only to be
 //! called from C.
 //!
diff --git a/src/rust/tor_util/lib.rs b/src/rust/tor_util/lib.rs
index 9c863e39b..42fa9d5ad 100644
--- a/src/rust/tor_util/lib.rs
+++ b/src/rust/tor_util/lib.rs
@@ -1,3 +1,6 @@
+// Copyright (c) 2016-2017, The Tor Project, Inc. */
+// See LICENSE for licensing information */
+
 //! Small module to announce Rust support during startup for demonstration
 //! purposes.
 //!



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


[tor-commits] [tor/master] refactor smartlist for readability

2017-10-27 Thread nickm
commit cd2a036959e90e77bc5002c05dae120f54f8ecb8
Author: Chelsea Holland Komlo 
Date:   Sun Oct 22 00:24:15 2017 -0400

refactor smartlist for readability

limit scoping of unsafe, and other cleanup
---
 src/rust/smartlist/smartlist.rs | 51 ++---
 1 file changed, 32 insertions(+), 19 deletions(-)

diff --git a/src/rust/smartlist/smartlist.rs b/src/rust/smartlist/smartlist.rs
index 5eff3fe43..59296ab3b 100644
--- a/src/rust/smartlist/smartlist.rs
+++ b/src/rust/smartlist/smartlist.rs
@@ -1,50 +1,62 @@
 use std::slice;
-use libc::c_char;
+use libc::{c_char, c_int};
 use std::ffi::CStr;
 
 /// Smartlists are a type used in C code in tor to define a collection of a
 /// generic type, which has a capacity and a number used. Each Smartlist
 /// defines how to extract the list of values from the underlying C structure
-/// Implementations are required to have a C representation
+///
+/// Implementations are required to have a C representation, as this module
+/// serves purely to translate smartlists as defined in tor to vectors in Rust.
 pub trait Smartlist {
 fn get_list() -> Vec;
 }
+
 #[repr(C)]
 pub struct Stringlist {
 pub list: *const *const c_char,
-pub num_used: u8,
-pub capacity: u8,
+pub num_used: c_int,
+pub capacity: c_int,
 }
 
 impl Smartlist for Stringlist {
 fn get_list() -> Vec {
 let empty: Vec = Vec::new();
-let mut v: Vec = Vec::new();
+let mut rust_list: Vec = Vec::new();
 
-if self.list.is_null() {
+if self.list.is_null() || self.num_used == 0 {
 return empty;
 }
 
 // unsafe, as we need to extract the smartlist list into a vector of
 // pointers, and then transform each element into a Rust string.
-unsafe {
-let elems =
-slice::from_raw_parts(self.list, self.num_used as usize);
-
-for i in elems.iter() {
-let c_str = CStr::from_ptr(*i);
-let r_str = match c_str.to_str() {
-Ok(n) => n,
-Err(_) => return empty,
-};
-v.push(String::from(r_str));
+let elems: &[*const i8] = unsafe {
+slice::from_raw_parts(self.list, self.num_used as usize)
+};
+
+for elem in elems.iter() {
+if elem.is_null() {
+continue;
 }
+
+// unsafe, as we need to create a cstring from the referenced
+// element
+let c_string = unsafe { CStr::from_ptr(*elem) };
+
+let r_string = match c_string.to_str() {
+Ok(n) => n,
+Err(_) => return empty,
+};
+
+rust_list.push(String::from(r_string));
 }
 
-v
+rust_list
 }
 }
 
+// TODO: CHK: this module maybe should be tested from a test in C with a
+// smartlist as defined in tor.
 #[cfg(test)]
 mod test {
 #[test]
@@ -83,9 +95,10 @@ mod test {
 let p_args: Vec<_> =
 c_strings.iter().map(|arg| arg.as_ptr()).collect();
 
-// then, collect a pointer for the list itself
 let p: *const *const c_char = p_args.as_ptr();
 
+// This is the representation that we expect when receiving a
+// smartlist at the Rust/C FFI layer.
 let sl = Stringlist {
 list: p,
 num_used: 2,



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


[tor-commits] [tor/master] remove unneeded dependencies, remove types where unnecessary

2017-10-27 Thread nickm
commit d14a83f74fcbe5fae97d944ac8f7f8645e160d3a
Author: Chelsea Holland Komlo 
Date:   Sat Oct 14 22:27:36 2017 -0400

remove unneeded dependencies, remove types where unnecessary
---
 src/rust/protover/protover.rs | 32 +++-
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/src/rust/protover/protover.rs b/src/rust/protover/protover.rs
index f85d16b73..37589a83f 100644
--- a/src/rust/protover/protover.rs
+++ b/src/rust/protover/protover.rs
@@ -1,10 +1,8 @@
 use external::c_tor_version_as_new_as;
 
 use std::str::FromStr;
-use std::str::SplitN;
 use std::fmt;
-use std::collections::HashMap;
-use std::collections::HashSet;
+use std::collections::{HashMap, HashSet};
 use std::string::String;
 
 /// The first version of Tor that included "proto" entries in its descriptors.
@@ -191,14 +189,14 @@ fn get_versions(version_string: ) -> 
Result {
 fn get_proto_and_vers<'a>(
 protocol_entry: &'a str,
 ) -> Result<(Proto, HashSet), &'static str> {
-let mut parts: SplitN<'a, > = protocol_entry.splitn(2, "=");
+let mut parts = protocol_entry.splitn(2, "=");
 
-let proto:  = match parts.next() {
+let proto = match parts.next() {
 Some(n) => n,
 None => return Err("invalid protover entry"),
 };
 
-let vers:  = match parts.next() {
+let vers = match parts.next() {
 Some(n) => n,
 None => return Err("invalid protover entry"),
 };
@@ -272,7 +270,7 @@ fn contains_only_supported_protocols(proto_entry: ) -> 
bool {
 /// assert_eq!("Link=5-6", unsupported);
 ///
 pub fn all_supported(protocols: ) -> (bool, String) {
-let unsupported: Vec<> = protocols
+let unsupported = protocols
 .split_whitespace()
 .filter(|v| !contains_only_supported_protocols(v))
 .collect::>();
@@ -348,19 +346,19 @@ fn expand_version_range(range: ) -> Result {
 
 let mut parts = range.split("-");
 
-let lower_string:  = parts.next().ok_or(
+let lower_string = parts.next().ok_or(
 "cannot parse protocol range lower bound",
 )?;
 
-let lower: u32 = u32::from_str_radix(lower_string, 10).or(Err(
+let lower = u32::from_str_radix(lower_string, 10).or(Err(
 "cannot parse protocol range lower bound",
 ))?;
 
-let higher_string:  = parts.next().ok_or(
+let higher_string = parts.next().ok_or(
 "cannot parse protocol range upper bound",
 )?;
 
-let higher: u32 = u32::from_str_radix(higher_string, 10).or(Err(
+let higher = u32::from_str_radix(higher_string, 10).or(Err(
 "cannot parse protocol range upper bound",
 ))?;
 
@@ -391,7 +389,7 @@ fn find_range(list: ) -> (bool, u32) {
 }
 
 let mut iterable = list.iter().peekable();
-let mut range_end: u32 = match iterable.next() {
+let mut range_end = match iterable.next() {
 Some(n) => *n,
 None => return (false, 0),
 };
@@ -478,20 +476,20 @@ fn contract_protocol_list<'a>(supported_set: &'a 
HashSet) -> String {
 fn parse_protocols_from_string_with_no_validation<'a>(
 protocol_string: &'a str,
 ) -> Result, &'static str> {
-let protocols: &[&'a str] =
-_string.split(" ").collect::>()[..];
+let protocols = _string.split(" ")
+.collect::>()[..];
 
 let mut parsed: HashMap = HashMap::new();
 
 for subproto in protocols {
-let mut parts: SplitN<'a, > = subproto.splitn(2, "=");
+let mut parts = subproto.splitn(2, "=");
 
-let name:  = match parts.next() {
+let name = match parts.next() {
 Some(n) => n,
 None => return Err("invalid protover entry"),
 };
 
-let vers:  = match parts.next() {
+let vers = match parts.next() {
 Some(n) => n,
 None => return Err("invalid protover entry"),
 };



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


[tor-commits] [tor/master] rust implementation of protover

2017-10-27 Thread nickm
commit d1820c1516a31a149fc51a9e5126bf899e4c4e08
Author: Chelsea Holland Komlo 
Date:   Wed Sep 27 19:48:07 2017 +

rust implementation of protover
---
 Makefile.am |   2 +
 configure.ac|   6 +
 src/common/include.am   |   2 +
 src/common/rust_types.c |  55 +++
 src/common/rust_types.h |  22 +
 src/or/include.am   |   1 +
 src/or/protover.c   |   4 +
 src/or/protover.h   |   6 +-
 src/or/protover_rust.c  | 111 +
 src/rust/Cargo.lock |  31 ++
 src/rust/Cargo.toml |   2 +-
 src/rust/c_string/Cargo.toml|  13 +
 src/rust/c_string/ffi.rs|  19 +
 src/rust/c_string/include.am|  12 +
 src/rust/external/Cargo.toml|  13 +
 src/rust/external/external.rs   |  29 ++
 src/rust/external/lib.rs|  14 +
 src/rust/include.am |   2 +
 src/rust/protover/Cargo.toml|  22 +
 src/rust/protover/ffi.rs| 205 +
 src/rust/protover/include.am|  14 +
 src/rust/protover/lib.rs|  34 ++
 src/rust/protover/protover.rs   | 847 
 src/rust/protover/tests/protover.rs | 288 
 src/rust/smartlist/Cargo.toml   |  13 +
 src/rust/smartlist/lib.rs   |   5 +
 src/rust/smartlist/smartlist.rs | 100 +
 src/rust/tor_util/Cargo.toml|   2 +-
 src/test/test_protover.c|  43 +-
 29 files changed, 1913 insertions(+), 4 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index ad2ceb66a..9067e9a8a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,6 +27,8 @@ endif
 
 if USE_RUST
 rust_ldadd=$(top_builddir)/src/rust/target/release/@TOR_RUST_UTIL_STATIC_NAME@
+rust_ldadd+=$(top_builddir)/src/rust/target/release/@TOR_RUST_PROTOVER_STATIC_NAME@
+rust_ldadd+=$(top_builddir)/src/rust/target/release/@TOR_RUST_C_STRING_STATIC_NAME@
 else
 rust_ldadd=
 endif
diff --git a/configure.ac b/configure.ac
index d2682944f..b2b353f6b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -440,11 +440,17 @@ if test "x$enable_rust" = "xyes"; then
   dnl the MSVC naming convention.
   if test "$bwin32" = "true"; then
 TOR_RUST_UTIL_STATIC_NAME=tor_util.lib
+TOR_RUST_PROTOVER_STATIC_NAME=libprotover.lib
+TOR_RUST_C_STRING_STATIC_NAME=libc_string.lib
   else
 TOR_RUST_UTIL_STATIC_NAME=libtor_util.a
+TOR_RUST_PROTOVER_STATIC_NAME=libprotover.a
+TOR_RUST_C_STRING_STATIC_NAME=libc_string.a
   fi
 
   AC_SUBST(TOR_RUST_UTIL_STATIC_NAME)
+  AC_SUBST(TOR_RUST_PROTOVER_STATIC_NAME)
+  AC_SUBST(TOR_RUST_C_STRING_STATIC_NAME)
   AC_SUBST(CARGO_ONLINE)
   AC_SUBST(RUST_DL)
 
diff --git a/src/common/include.am b/src/common/include.am
index cd5eea340..7ce84e17c 100644
--- a/src/common/include.am
+++ b/src/common/include.am
@@ -94,6 +94,7 @@ LIBOR_A_SRC = \
   src/common/util_bug.c\
   src/common/util_format.c \
   src/common/util_process.c\
+  src/common/rust_types.c  \
   src/common/sandbox.c \
   src/common/storagedir.c  \
   src/common/workqueue.c   \
@@ -179,6 +180,7 @@ COMMONHEADERS = \
   src/common/procmon.h \
   src/common/pubsub.h  \
   src/common/sandbox.h \
+  src/common/rust_types.h  \
   src/common/storagedir.h  \
   src/common/testsupport.h \
   src/common/timers.h  \
diff --git a/src/common/rust_types.c b/src/common/rust_types.c
new file mode 100644
index 0..d116b515b
--- /dev/null
+++ b/src/common/rust_types.c
@@ -0,0 +1,55 @@
+/* Copyright (c) 2017, The Tor Project, Inc. */
+/* See LICENSE for licensing information */
+
+/**
+ * \file rust_types.c
+ * \brief This file is used for handling types returned from Rust to C.
+ **/
+
+#include "or.h"
+#include "rust_types.h"
+
+#ifdef HAVE_RUST
+
+void free_rust_str(char *ret);
+
+/* Because Rust strings can only be freed from Rust, we first copy the string's
+ * contents to a c pointer, and then free the Rust string.
+ * This function can be extended to return a success/error value if needed.
+ */
+void
+move_rust_str_to_c_and_free(rust_str_ref_t src, char **dest)
+{
+  if (!src) {
+log_warn(LD_BUG, "Received a null pointer from protover rust.");
+return;
+  }
+
+  if (!dest) {
+log_warn(LD_BUG, "Received a null pointer from caller to protover rust. "
+ "This results in a memory leak due to not freeing the rust "
+ "string that was meant to be copied..");
+return;
+  }
+
+  *dest = tor_strdup(src);
+  free_rust_str(src);
+  return;
+}
+
+#else
+
+/* When Rust is not enabled, this function 

[tor-commits] [translation/whisperback] Update translations for whisperback

2017-10-27 Thread translation
commit 33aa0826e0fb71a406e2a5669fc7b3126dd2c90a
Author: Translation commit bot 
Date:   Fri Oct 27 13:45:24 2017 +

Update translations for whisperback
---
 fr/fr.po | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fr/fr.po b/fr/fr.po
index 2e603643e..6e582c720 100644
--- a/fr/fr.po
+++ b/fr/fr.po
@@ -15,7 +15,7 @@ msgstr ""
 "Project-Id-Version: The Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-03-20 12:09+\n"
-"PO-Revision-Date: 2017-10-20 15:19+\n"
+"PO-Revision-Date: 2017-10-27 13:31+\n"
 "Last-Translator: French language coordinator \n"
 "Language-Team: French 
(http://www.transifex.com/otf/torproject/language/fr/)\n"
 "MIME-Version: 1.0\n"

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


[tor-commits] [translation/whisperback_completed] Update translations for whisperback_completed

2017-10-27 Thread translation
commit 5a3cbac6c9421f30de72dcdb728079c88f3137d9
Author: Translation commit bot 
Date:   Fri Oct 27 13:45:30 2017 +

Update translations for whisperback_completed
---
 fr/fr.po | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fr/fr.po b/fr/fr.po
index 2e603643e..6e582c720 100644
--- a/fr/fr.po
+++ b/fr/fr.po
@@ -15,7 +15,7 @@ msgstr ""
 "Project-Id-Version: The Tor Project\n"
 "Report-Msgid-Bugs-To: \n"
 "POT-Creation-Date: 2017-03-20 12:09+\n"
-"PO-Revision-Date: 2017-10-20 15:19+\n"
+"PO-Revision-Date: 2017-10-27 13:31+\n"
 "Last-Translator: French language coordinator \n"
 "Language-Team: French 
(http://www.transifex.com/otf/torproject/language/fr/)\n"
 "MIME-Version: 1.0\n"

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


  1   2   >