summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKathy Brade <brade@pearlcrescent.com>2016-11-02 11:44:28 -0400
committerKathy Brade <brade@pearlcrescent.com>2016-11-04 14:36:02 -0400
commit73e416fe9cb97d1bde9404b71b5dfe1957affc76 (patch)
tree188a80c4fed525a38946517ca6f4484e8cac8911
parent1f36df651c77dba1834baf0abdba4a5ad62e0a2a (diff)
Bug 19646: Mac OS: wrong location for meek browser profilebug19646-01
On OSX, use the TOR_BROWSER_TOR_DATA_DIR environment variable value (if available) to determine the location of the meek browser profile. This fixes a problem where meek-client-torbrowser attempted to use a path under /Applications/TorBrowser-Data, to which regular users may not have write access.
-rw-r--r--meek-client-torbrowser/linux.go7
-rw-r--r--meek-client-torbrowser/mac.go17
-rw-r--r--meek-client-torbrowser/meek-client-torbrowser.go11
-rw-r--r--meek-client-torbrowser/windows.go7
4 files changed, 27 insertions, 15 deletions
diff --git a/meek-client-torbrowser/linux.go b/meek-client-torbrowser/linux.go
index ae363bd..71b5cfb 100644
--- a/meek-client-torbrowser/linux.go
+++ b/meek-client-torbrowser/linux.go
@@ -11,9 +11,10 @@ import (
)
const (
- firefoxPath = "./firefox"
- firefoxProfilePath = "TorBrowser/Data/Browser/profile.meek-http-helper"
- profileTemplatePath = ""
+ firefoxPath = "./firefox"
+ firefoxProfilePath = "TorBrowser/Data/Browser/profile.meek-http-helper"
+ torDataDirFirefoxProfilePath = ""
+ profileTemplatePath = ""
)
func osSpecificCommandSetup(cmd *exec.Cmd) {
diff --git a/meek-client-torbrowser/mac.go b/meek-client-torbrowser/mac.go
index 7ec98d9..f88ed38 100644
--- a/meek-client-torbrowser/mac.go
+++ b/meek-client-torbrowser/mac.go
@@ -9,12 +9,17 @@ import "os/exec"
const (
// During startup of meek-client-torbrowser, the browser profile is
- // created and maintained under firefoxProfilePath by making a
- // recursive copy of everything under profileTemplatePath.
- // https://bugs.torproject.org/18904
- firefoxPath = "../firefox"
- firefoxProfilePath = "../../../../TorBrowser-Data/Tor/PluggableTransports/profile.meek-http-helper"
- profileTemplatePath = "../../Resources/TorBrowser/Tor/PluggableTransports/template-profile.meek-http-helper"
+ // created and maintained under a meek-specific directory by making a
+ // recursive copy of everything under profileTemplatePath (see
+ // https://bugs.torproject.org/18904).
+ // If the TOR_BROWSER_TOR_DATA_DIR env var is set, the path for the
+ // meek-specific profile directory is constructed by appending
+ // torDataDirFirefoxProfilePath to TOR_BROWSER_TOR_DATA_DIR. Otherwise,
+ // firefoxProfilePath (a relative path) is used.
+ firefoxPath = "../firefox"
+ torDataDirFirefoxProfilePath = "PluggableTransports/profile.meek-http-helper"
+ firefoxProfilePath = "../../../../TorBrowser-Data/Tor/PluggableTransports/profile.meek-http-helper"
+ profileTemplatePath = "../../Resources/TorBrowser/Tor/PluggableTransports/template-profile.meek-http-helper"
)
func osSpecificCommandSetup(cmd *exec.Cmd) {
diff --git a/meek-client-torbrowser/meek-client-torbrowser.go b/meek-client-torbrowser/meek-client-torbrowser.go
index eea9087..4592495 100644
--- a/meek-client-torbrowser/meek-client-torbrowser.go
+++ b/meek-client-torbrowser/meek-client-torbrowser.go
@@ -206,9 +206,14 @@ func runFirefox() (cmd *exec.Cmd, stdout io.Reader, err error) {
return
}
var profilePath string
- profilePath, err = filepath.Abs(firefoxProfilePath)
- if err != nil {
- return
+ var torDataDir = os.Getenv("TOR_BROWSER_TOR_DATA_DIR")
+ if torDataDir != "" && torDataDirFirefoxProfilePath != "" {
+ profilePath = filepath.Join(torDataDir, torDataDirFirefoxProfilePath)
+ } else {
+ profilePath, err = filepath.Abs(firefoxProfilePath)
+ if err != nil {
+ return
+ }
}
err = prepareBrowserProfile(profilePath)
if err != nil {
diff --git a/meek-client-torbrowser/windows.go b/meek-client-torbrowser/windows.go
index 3b1905e..f837e6e 100644
--- a/meek-client-torbrowser/windows.go
+++ b/meek-client-torbrowser/windows.go
@@ -8,9 +8,10 @@ package main
import "os/exec"
const (
- firefoxPath = "./firefox.exe"
- firefoxProfilePath = "TorBrowser/Data/Browser/profile.meek-http-helper"
- profileTemplatePath = ""
+ firefoxPath = "./firefox.exe"
+ firefoxProfilePath = "TorBrowser/Data/Browser/profile.meek-http-helper"
+ torDataDirFirefoxProfilePath = ""
+ profileTemplatePath = ""
)
func osSpecificCommandSetup(cmd *exec.Cmd) {