Skip to content
Snippets Groups Projects
Commit 73e416fe authored by Kathleen Brade's avatar Kathleen Brade
Browse files

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.
parent 1f36df65
No related branches found
No related tags found
No related merge requests found
...@@ -11,9 +11,10 @@ import ( ...@@ -11,9 +11,10 @@ import (
) )
const ( const (
firefoxPath = "./firefox" firefoxPath = "./firefox"
firefoxProfilePath = "TorBrowser/Data/Browser/profile.meek-http-helper" firefoxProfilePath = "TorBrowser/Data/Browser/profile.meek-http-helper"
profileTemplatePath = "" torDataDirFirefoxProfilePath = ""
profileTemplatePath = ""
) )
func osSpecificCommandSetup(cmd *exec.Cmd) { func osSpecificCommandSetup(cmd *exec.Cmd) {
......
...@@ -9,12 +9,17 @@ import "os/exec" ...@@ -9,12 +9,17 @@ import "os/exec"
const ( const (
// During startup of meek-client-torbrowser, the browser profile is // During startup of meek-client-torbrowser, the browser profile is
// created and maintained under firefoxProfilePath by making a // created and maintained under a meek-specific directory by making a
// recursive copy of everything under profileTemplatePath. // recursive copy of everything under profileTemplatePath (see
// https://bugs.torproject.org/18904 // https://bugs.torproject.org/18904).
firefoxPath = "../firefox" // If the TOR_BROWSER_TOR_DATA_DIR env var is set, the path for the
firefoxProfilePath = "../../../../TorBrowser-Data/Tor/PluggableTransports/profile.meek-http-helper" // meek-specific profile directory is constructed by appending
profileTemplatePath = "../../Resources/TorBrowser/Tor/PluggableTransports/template-profile.meek-http-helper" // 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) { func osSpecificCommandSetup(cmd *exec.Cmd) {
......
...@@ -206,9 +206,14 @@ func runFirefox() (cmd *exec.Cmd, stdout io.Reader, err error) { ...@@ -206,9 +206,14 @@ func runFirefox() (cmd *exec.Cmd, stdout io.Reader, err error) {
return return
} }
var profilePath string var profilePath string
profilePath, err = filepath.Abs(firefoxProfilePath) var torDataDir = os.Getenv("TOR_BROWSER_TOR_DATA_DIR")
if err != nil { if torDataDir != "" && torDataDirFirefoxProfilePath != "" {
return profilePath = filepath.Join(torDataDir, torDataDirFirefoxProfilePath)
} else {
profilePath, err = filepath.Abs(firefoxProfilePath)
if err != nil {
return
}
} }
err = prepareBrowserProfile(profilePath) err = prepareBrowserProfile(profilePath)
if err != nil { if err != nil {
......
...@@ -8,9 +8,10 @@ package main ...@@ -8,9 +8,10 @@ package main
import "os/exec" import "os/exec"
const ( const (
firefoxPath = "./firefox.exe" firefoxPath = "./firefox.exe"
firefoxProfilePath = "TorBrowser/Data/Browser/profile.meek-http-helper" firefoxProfilePath = "TorBrowser/Data/Browser/profile.meek-http-helper"
profileTemplatePath = "" torDataDirFirefoxProfilePath = ""
profileTemplatePath = ""
) )
func osSpecificCommandSetup(cmd *exec.Cmd) { func osSpecificCommandSetup(cmd *exec.Cmd) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment