[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [meek/master] Have meek-client-torbrowser give meek-client a stdin that doesn't close.



commit a47e634f594c26a5e6676bf5de3f0d1d5bb620af
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Thu Jan 11 12:31:02 2018 -0800

    Have meek-client-torbrowser give meek-client a stdin that doesn't close.
    
    https://bugs.torproject.org/24642
    
    Running meek-client-torbrowser with the environment variable
    TOR_PT_EXIT_ON_STDIN_CLOSE=1 would cause meek-client to exit
    immediately, as it sensed that its stdin was closed.
    meek-client-torbrowser was running the meek-client subprocess with a nil
    Stdin, which causes its stdin to be /dev/null (or NUL on Windows), which
    returns an immediate EOF. So instead, give meek-client an StdinPipe and
    just keep it open. (We could alternatively keep track of it and close it
    when necessary, but that would take further refactoring.)
    
    The commit where things would have first broken was
    0ec986eb2b4bc23d81e6e8beffd382890f55bfb1 (part of tag 0.28), which
    added TOR_PT_EXIT_ON_STDIN_CLOSE awareness to meek-client. But it was
    not meek-client's fault.
    
    This bug did not affect any releases of Tor Browser, despite that on
    Windows we unconditionally set TOR_PT_EXIT_ON_STDIN_CLOSE=1 via
    terminateprocess-buffer, because Tor Browser is still using tag 0.25,
    which doesn't have the TOR_PT_EXIT_ON_STDIN_CLOSE change in meek-client.
---
 meek-client-torbrowser/meek-client-torbrowser.go | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/meek-client-torbrowser/meek-client-torbrowser.go b/meek-client-torbrowser/meek-client-torbrowser.go
index db35080..0064b4b 100644
--- a/meek-client-torbrowser/meek-client-torbrowser.go
+++ b/meek-client-torbrowser/meek-client-torbrowser.go
@@ -268,6 +268,12 @@ func runMeekClient(helperAddr string, meekClientCommandLine []string) (cmd *exec
 	args := meekClientCommandLine[1:]
 	args = append(args, []string{"--helper", helperAddr}...)
 	cmd = exec.Command(meekClientPath, args...)
+	// Give the subprocess a stdin for TOR_PT_EXIT_ON_STDIN_CLOSE purposes.
+	// https://bugs.torproject.org/24642
+	_, err = cmd.StdinPipe()
+	if err != nil {
+		return
+	}
 	cmd.Stdout = os.Stdout
 	cmd.Stderr = os.Stderr
 	log.Printf("running meek-client command %q", cmd.Args)



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