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

[tor-commits] [tor-browser] 15/64: Bug 18800: Remove localhost DNS lookup in nsProfileLock.cpp



This is an automated email from the git hooks/post-receive script.

aguestuser pushed a commit to branch geckoview-99.0b3-11.5-2
in repository tor-browser.

commit 25d906ac1ce05705af03e7e5eeea1fa114df11cc
Author: Kathy Brade <brade@xxxxxxxxxxxxxxxxx>
AuthorDate: Thu Apr 21 10:40:26 2016 -0400

    Bug 18800: Remove localhost DNS lookup in nsProfileLock.cpp
    
    Instead of using the local computer's IP address within
    symlink-based profile lock signatures, always use 127.0.0.1.
---
 toolkit/profile/nsProfileLock.cpp | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/toolkit/profile/nsProfileLock.cpp b/toolkit/profile/nsProfileLock.cpp
index 28d38c11684e3..a1b3edc54a050 100644
--- a/toolkit/profile/nsProfileLock.cpp
+++ b/toolkit/profile/nsProfileLock.cpp
@@ -304,18 +304,17 @@ nsresult nsProfileLock::LockWithSymlink(nsIFile* aLockFile,
   if (!mReplacedLockTime)
     aLockFile->GetLastModifiedTimeOfLink(&mReplacedLockTime);
 
+  // For Tor Browser, avoid a DNS lookup here so the Tor network is not
+  // bypassed. Instead, always use 127.0.0.1 for the IP address portion
+  // of the lock signature, which may cause the browser to refuse to
+  // start in the rare event that all of the following conditions are met:
+  //   1. The browser profile is on a network file system.
+  //   2. The file system does not support fcntl() locking.
+  //   3. Tor Browser is run from two different computers at the same time.
+
   struct in_addr inaddr;
   inaddr.s_addr = htonl(INADDR_LOOPBACK);
 
-  char hostname[256];
-  PRStatus status = PR_GetSystemInfo(PR_SI_HOSTNAME, hostname, sizeof hostname);
-  if (status == PR_SUCCESS) {
-    char netdbbuf[PR_NETDB_BUF_SIZE];
-    PRHostEnt hostent;
-    status = PR_GetHostByName(hostname, netdbbuf, sizeof netdbbuf, &hostent);
-    if (status == PR_SUCCESS) memcpy(&inaddr, hostent.h_addr, sizeof inaddr);
-  }
-
   mozilla::SmprintfPointer signature =
       mozilla::Smprintf("%s:%s%lu", inet_ntoa(inaddr),
                         aHaveFcntlLock ? "+" : "", (unsigned long)getpid());

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits