Commit e8d96261 authored by Kathleen Brade's avatar Kathleen Brade Committed by Alex Catarineu
Browse files

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
parent 25edcec8
......@@ -289,18 +289,17 @@ nsresult nsProfileLock::LockWithSymlink(nsIFile* aLockFile,
if (!mReplacedLockTime)
// For Tor Browser, avoid a DNS lookup here so the Tor network is not
// bypassed. Instead, always use 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());
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment