[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [meek/master] Bug 19646: Mac OS: wrong location for meek browser profile
commit 73e416fe9cb97d1bde9404b71b5dfe1957affc76
Author: Kathy Brade <brade@xxxxxxxxxxxxxxxxx>
Date: Wed Nov 2 11:44:28 2016 -0400
Bug 19646: Mac OS: wrong location for meek browser profile
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.
---
meek-client-torbrowser/linux.go | 7 ++++---
meek-client-torbrowser/mac.go | 17 +++++++++++------
meek-client-torbrowser/meek-client-torbrowser.go | 11 ++++++++---
meek-client-torbrowser/windows.go | 7 ++++---
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) {
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits