Skip to content

Commit e78b490

Browse files
author
Kathy Brade
committed
Bug 1769028: Disable DNS lookup in nsProfileLock when the proxy bypass protection is enabled r=mossop
Instead of using the local computer's IP address within symlink-based profile lock signatures, always use 127.0.0.1 when the proxy bypass protection is enabled. Differential Revision: https://phabricator.services.mozilla.com/D161264
1 parent 16d3777 commit e78b490

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

toolkit/profile/nsProfileLock.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,16 @@ nsresult nsProfileLock::LockWithSymlink(nsIFile* aLockFile,
307307
struct in_addr inaddr;
308308
inaddr.s_addr = htonl(INADDR_LOOPBACK);
309309

310+
// We still have not loaded the profile, so we may not have proxy information.
311+
// Avoiding a DNS lookup in this stage makes sure any proxy is not bypassed.
312+
// By default, the lookup is enabled, but when it is not, we use 127.0.0.1
313+
// for the IP address portion of the lock signature.
314+
// However, this may cause the browser to refuse to start in the rare case
315+
// that all of the following conditions are met:
316+
// 1. The browser profile is on a network file system.
317+
// 2. The file system does not support fcntl() locking.
318+
// 3. The browser is run from two different computers at the same time.
319+
# ifndef MOZ_PROXY_BYPASS_PROTECTION
310320
char hostname[256];
311321
PRStatus status = PR_GetSystemInfo(PR_SI_HOSTNAME, hostname, sizeof hostname);
312322
if (status == PR_SUCCESS) {
@@ -315,6 +325,7 @@ nsresult nsProfileLock::LockWithSymlink(nsIFile* aLockFile,
315325
status = PR_GetHostByName(hostname, netdbbuf, sizeof netdbbuf, &hostent);
316326
if (status == PR_SUCCESS) memcpy(&inaddr, hostent.h_addr, sizeof inaddr);
317327
}
328+
# endif
318329

319330
mozilla::SmprintfPointer signature =
320331
mozilla::Smprintf("%s:%s%lu", inet_ntoa(inaddr),

0 commit comments

Comments
 (0)