allow accessing non-standard port of gopher by toggling network.gopher.port-restricted to false (default: true)

This commit is contained in:
roytam1 2018-11-15 22:09:09 +08:00
parent 50d79f4b2e
commit ee63982def
2 changed files with 15 additions and 4 deletions

View File

@ -2390,3 +2390,6 @@ pref("print.print_command", "lp -c -s ${MOZ_PRINTER_NAME:+'-d '}${MOZ_PRINTER_NA
#ifdef MOZ_X11
pref("network.gnomevfs.supported-protocols", "smb:,sftp:");
#endif
// restrict gopher port to port 70 only
pref("network.gopher.port-restricted", true);

View File

@ -122,13 +122,21 @@ nsGopherChannel::Init(nsIURI* uri, nsIProxyInfo* proxyInfo)
if (NS_FAILED(rv))
return rv;
PRBool restrictedPort = PR_TRUE;
nsCOMPtr<nsIPrefBranch> branch;
nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
if (!NS_FAILED(rv)) {
branch = do_QueryInterface(prefs);
branch->GetBoolPref("network.gopher.port-restricted" , &restrictedPort);
}
// For security reasons, don't allow anything expect the default
// gopher port (70). See bug 71916 - bbaetz@cs.mcgill.ca
/*
if (mPort==-1)
if(!restrictedPort) {
if (mPort==-1)
mPort=GOPHER_PORT;
} else
mPort=GOPHER_PORT;
*/
mPort=GOPHER_PORT;
// No path given
if (buffer[0]=='\0' || (buffer[0]=='/' && buffer[1]=='\0')) {