commit 1eeb621e9a20afc065518f34e6a6c87c35109fa3
Author: Mike Perry <mikeperry-git(a)torproject.org>
Date: Tue Oct 28 17:50:47 2014 -0700
Bug 8405: Add Tor patch for domain isolation.
Also clean up our patch application.
---
gitian/descriptors/linux/gitian-tor.yml | 20 ++-----
gitian/descriptors/mac/gitian-tor.yml | 20 ++-----
gitian/descriptors/windows/gitian-tor.yml | 20 ++-----
gitian/patches/bug8405.patch | 84 +++++++++++++++++++++++++++++
4 files changed, 99 insertions(+), 45 deletions(-)
diff --git a/gitian/descriptors/linux/gitian-tor.yml b/gitian/descriptors/linux/gitian-tor.yml
index e678203..68a5bae 100644
--- a/gitian/descriptors/linux/gitian-tor.yml
+++ b/gitian/descriptors/linux/gitian-tor.yml
@@ -27,6 +27,7 @@ files:
- "bug9665.patch"
- "bug8402.patch"
- "bug8402-master.patch"
+- "bug8405.patch"
- "dzip.sh"
- "openssl-linux32-utils.zip"
- "openssl-linux64-utils.zip"
@@ -82,23 +83,12 @@ script: |
export GIT_COMMITTER_NAME="nobody"
export GIT_COMMITTER_EMAIL="nobody@localhost"
export GIT_COMMITTER_DATE="$REFERENCE_DATETIME"
- if [ ${TOR_TAG::9} == "tor-0.2.4" ];
+ if [ ${TOR_TAG::9} == "tor-0.2.5" ];
then
- git am ~/build/bug10297.patch
- fi
- if [ $BUILD_PT_BUNDLES ]; then
- if [ ${TOR_TAG::9} == "tor-0.2.4" ];
- then
- git am ~/build/bug5018.patch
- git am ~/build/bug11069.patch
- git am ~/build/bug11156.patch
- git am ~/build/bug9665.patch
- git am ~/build/bug11200.patch
- git am ~/build/bug8402.patch
- elif [ ${TOR_TAG::9} == "tor-0.2.5" ];
- then
+ git am ~/build/bug8405.patch
git am ~/build/bug8402-master.patch
- fi
+ else # 0.2.6 and master
+ git am ~/build/bug8405.patch
fi
mkdir -p $OUTDIR/src
#git archive HEAD | tar -x -C $OUTDIR/src
diff --git a/gitian/descriptors/mac/gitian-tor.yml b/gitian/descriptors/mac/gitian-tor.yml
index 6022c0b..36b5b0f 100644
--- a/gitian/descriptors/mac/gitian-tor.yml
+++ b/gitian/descriptors/mac/gitian-tor.yml
@@ -23,6 +23,7 @@ files:
- "bug9665.patch"
- "bug8402.patch"
- "bug8402-master.patch"
+- "bug8405.patch"
- "apple-uni-sdk-10.6_20110407-0.flosoft1_i386.deb"
- "multiarch-darwin11-cctools127.2-gcc42-5666.3-llvmgcc42-2336.1-Linux-120724.tar.xz"
- "dzip.sh"
@@ -60,23 +61,12 @@ script: |
export GIT_COMMITTER_NAME="nobody"
export GIT_COMMITTER_EMAIL="nobody@localhost"
export GIT_COMMITTER_DATE="$REFERENCE_DATETIME"
- if [ ${TOR_TAG::9} == "tor-0.2.4" ];
+ if [ ${TOR_TAG::9} == "tor-0.2.5" ];
then
- git am ~/build/bug10297.patch
- fi
- if [ $BUILD_PT_BUNDLES ]; then
- if [ ${TOR_TAG::9} == "tor-0.2.4" ];
- then
- git am ~/build/bug5018.patch
- git am ~/build/bug11069.patch
- git am ~/build/bug11156.patch
- git am ~/build/bug9665.patch
- git am ~/build/bug11200.patch
- git am ~/build/bug8402.patch
- elif [ ${TOR_TAG::9} == "tor-0.2.5" ];
- then
+ git am ~/build/bug8405.patch
git am ~/build/bug8402-master.patch
- fi
+ else # 0.2.6 and master
+ git am ~/build/bug8405.patch
fi
mkdir -p $OUTDIR/src
#git archive HEAD | tar -x -C $OUTDIR/src
diff --git a/gitian/descriptors/windows/gitian-tor.yml b/gitian/descriptors/windows/gitian-tor.yml
index 0ac603c..6be93b5 100644
--- a/gitian/descriptors/windows/gitian-tor.yml
+++ b/gitian/descriptors/windows/gitian-tor.yml
@@ -23,6 +23,7 @@ files:
- "bug9665.patch"
- "bug8402.patch"
- "bug8402-master.patch"
+- "bug8405.patch"
- "binutils.tar.bz2"
- "dzip.sh"
- "mingw-w64-win32-utils.zip"
@@ -60,23 +61,12 @@ script: |
export GIT_COMMITTER_NAME="nobody"
export GIT_COMMITTER_EMAIL="nobody@localhost"
export GIT_COMMITTER_DATE="$REFERENCE_DATETIME"
- if [ ${TOR_TAG::9} == "tor-0.2.4" ];
+ if [ ${TOR_TAG::9} == "tor-0.2.5" ];
then
- git am ~/build/bug10297.patch
- fi
- if [ $BUILD_PT_BUNDLES ]; then
- if [ ${TOR_TAG::9} == "tor-0.2.4" ];
- then
- git am ~/build/bug5018.patch
- git am ~/build/bug11069.patch
- git am ~/build/bug11156.patch
- git am ~/build/bug9665.patch
- git am ~/build/bug11200.patch
- git am ~/build/bug8402.patch
- elif [ ${TOR_TAG::9} == "tor-0.2.5" ];
- then
+ git am ~/build/bug8405.patch
git am ~/build/bug8402-master.patch
- fi
+ else # 0.2.6 and master
+ git am ~/build/bug8405.patch
fi
mkdir -p $OUTDIR/src
#git archive HEAD | tar -x -C $OUTDIR/src
diff --git a/gitian/patches/bug8405.patch b/gitian/patches/bug8405.patch
new file mode 100644
index 0000000..3c40632
--- /dev/null
+++ b/gitian/patches/bug8405.patch
@@ -0,0 +1,84 @@
+From a298c77f7eba232154ff08ca1119b05ccd9eee9e Mon Sep 17 00:00:00 2001
+From: Arthur Edelstein <arthuredelstein(a)gmail.com>
+Date: Tue, 15 Jul 2014 21:27:59 -0700
+Subject: [PATCH] Bug #8405: Report SOCKS username/password in CIRC status
+ events
+
+Introduces two new circuit status name-value parameters: SOCKS_USERNAME
+and SOCKS_PASSWORD. Values are enclosing in quotes and unusual characters
+are escaped.
+
+Example:
+
+ 650 CIRC 5 EXTENDED [...] SOCKS_USERNAME="my_username" SOCKS_PASSWORD="my_password"
+---
+ src/common/util.c | 14 ++++++++++++++
+ src/common/util.h | 1 +
+ src/or/control.c | 14 ++++++++++++++
+ 3 files changed, 29 insertions(+)
+
+diff --git a/src/common/util.c b/src/common/util.c
+index 8589344..64cee56 100644
+--- a/src/common/util.c
++++ b/src/common/util.c
+@@ -1222,6 +1222,20 @@ esc_for_log(const char *s)
+ return result;
+ }
+
++/** Similar to esc_for_log. Allocate and return a new string representing
++ * the first n characters in <b>chars</b>, surround by quotes and using
++ * standard C escapes. If a NUL character is encountered in <b>chars</b>,
++ * the resulting string will be terminated there.
++ */
++char *
++esc_for_log_len(const char *chars, size_t n)
++{
++ char *string = tor_strndup(chars, n);
++ char *string_escaped = esc_for_log(string);
++ tor_free(string);
++ return string_escaped;
++}
++
+ /** Allocate and return a new string representing the contents of <b>s</b>,
+ * surrounded by quotes and using standard C escapes.
+ *
+diff --git a/src/common/util.h b/src/common/util.h
+index 97367a9..50c5a3d 100644
+--- a/src/common/util.h
++++ b/src/common/util.h
+@@ -229,6 +229,7 @@ int tor_mem_is_zero(const char *mem, size_t len);
+ int tor_digest_is_zero(const char *digest);
+ int tor_digest256_is_zero(const char *digest);
+ char *esc_for_log(const char *string) ATTR_MALLOC;
++char *esc_for_log_len(const char *chars, size_t n) ATTR_MALLOC;
+ const char *escaped(const char *string);
+
+ char *tor_escape_str_for_pt_args(const char *string,
+diff --git a/src/or/control.c b/src/or/control.c
+index 9285fc5..aa46df6 100644
+--- a/src/or/control.c
++++ b/src/or/control.c
+@@ -1862,6 +1862,20 @@ circuit_describe_status_for_controller(origin_circuit_t *circ)
+ smartlist_add_asprintf(descparts, "TIME_CREATED=%s", tbuf);
+ }
+
++ // Show username and/or password if available.
++ if (circ->socks_username_len > 0) {
++ char* socks_username_escaped = esc_for_log_len(circ->socks_username,
++ (size_t) circ->socks_username_len);
++ smartlist_add_asprintf(descparts, "SOCKS_USERNAME=%s", socks_username_escaped);
++ tor_free(socks_username_escaped);
++ }
++ if (circ->socks_password_len > 0) {
++ char* socks_password_escaped = esc_for_log_len(circ->socks_password,
++ (size_t) circ->socks_password_len);
++ smartlist_add_asprintf(descparts, "SOCKS_PASSWORD=%s", socks_password_escaped);
++ tor_free(socks_password_escaped);
++ }
++
+ rv = smartlist_join_strings(descparts, " ", 0, NULL);
+
+ SMARTLIST_FOREACH(descparts, char *, cp, tor_free(cp));
+--
+1.8.3.4 (Apple Git-47)
+