summaryrefslogtreecommitdiffstats
path: root/remoting/tools
diff options
context:
space:
mode:
authorlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-25 04:12:42 +0000
committerlambroslambrou@chromium.org <lambroslambrou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-25 04:12:42 +0000
commit7594dcfb0b40cb8c93f2287971a48ac12f2417bc (patch)
tree3f21e0869c287f7bc78dab13a26ad88170f8d101 /remoting/tools
parentec6cac544da21214a4a5d72138bc57edd4fd3221 (diff)
downloadchromium_src-7594dcfb0b40cb8c93f2287971a48ac12f2417bc.zip
chromium_src-7594dcfb0b40cb8c93f2287971a48ac12f2417bc.tar.gz
chromium_src-7594dcfb0b40cb8c93f2287971a48ac12f2417bc.tar.bz2
Redirect Me2Me session stdout+stderr to /tmp.
Avoids potential problems if $HOME happens to be located on NFS. BUG=None TEST=Manual Review URL: http://codereview.chromium.org/9467014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123643 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/tools')
-rwxr-xr-xremoting/tools/me2me_virtual_host.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/remoting/tools/me2me_virtual_host.py b/remoting/tools/me2me_virtual_host.py
index 00ddb69..b0eb122 100755
--- a/remoting/tools/me2me_virtual_host.py
+++ b/remoting/tools/me2me_virtual_host.py
@@ -24,6 +24,7 @@ import signal
import socket
import subprocess
import sys
+import tempfile
import time
import urllib2
import uuid
@@ -435,6 +436,14 @@ def daemonize(log_filename):
"""Background this process and detach from controlling terminal, redirecting
stdout/stderr to |log_filename|."""
+ # TODO(lambroslambrou): Having stdout/stderr redirected to a log file is not
+ # ideal - it could create a filesystem DoS if the daemon or a child process
+ # were to write excessive amounts to stdout/stderr. Ideally, stdout/stderr
+ # should be redirected to a pipe or socket, and a process at the other end
+ # should consume the data and write it to a logging facility which can do
+ # data-capping or log-rotation. The 'logger' command-line utility could be
+ # used for this, but it might cause too much syslog spam.
+
# Create new (temporary) file-descriptors before forking, so any errors get
# reported to the main process and set the correct exit-code.
# The mode is provided, since Python otherwise sets a default mode of 0777,
@@ -626,10 +635,10 @@ def main():
# daemonize() must only be called after prompting for user/password, as the
# process will become detached from the controlling terminal.
- log_filename = os.path.join(CONFIG_DIR, "host#%s.log" % host_hash)
if not options.foreground:
- daemonize(log_filename)
+ log_file = tempfile.NamedTemporaryFile(prefix="me2me_host_", delete=False)
+ daemonize(log_file.name)
g_pidfile.write_pid()