Bug #308366 --> don't flag IP addresses that refer to local addresses as e-mail scams. Thanks to Laurens Holst <lholst@students.cs.uu.nl>

This commit is contained in:
scott%scott-macgregor.org 2006-07-06 22:55:25 +00:00
parent 77bbbb4727
commit e4a779ff2a
2 changed files with 38 additions and 2 deletions

View File

@ -805,6 +805,7 @@ function delayedOnLoadMessenger()
InitPanes();
MigrateAttachmentDownloadStore();
MigrateJunkMailSettings();
MigrateFolderViews();
accountManager.setSpecialFolders();
accountManager.loadVirtualFolders();
@ -1724,6 +1725,30 @@ function MigrateJunkMailSettings()
}
}
// The first time a user runs a build that supports folder views, pre-populate the favorite folders list
// with the existing INBOX folders.
function MigrateFolderViews()
{
var folderViewsVersion = pref.getIntPref("mail.folder.views.version");
if (!folderViewsVersion)
{
var servers = accountManager.allServers;
var server;
var inbox;
for (var index = 0; index < servers.Count(); index++)
{
server = servers.QueryElementAt(index, Components.interfaces.nsIMsgIncomingServer);
if (server)
{
inbox = GetInboxFolder(server);
if (inbox)
inbox.setFlag(MSG_FOLDER_FLAG_FAVORITE);
}
}
pref.setIntPref("mail.folder.views.version", 1);
}
}
// Thunderbird has been storing old attachment download meta data in downloads.rdf
// even though there was no way to show or clean up this data. Now that we are using
// the new download manager in toolkit, we don't want to present this old data.

View File

@ -116,8 +116,8 @@ function isPhishingURL(aLinkNode, aSilentMode)
{
unobscuredHostName.value = hrefURL.host;
if (hostNameIsIPAddress(hrefURL.host, unobscuredHostName))
phishingType = kPhishingWithIPAddress;
if (hostNameIsIPAddress(hrefURL.host, unobscuredHostName) && !isLocalIPAddress(unobscuredHostName))
phishingType = kPhishingWithIPAddress;
else if (misMatchedHostWithLinkText(aLinkNode, hrefURL, linkTextURL))
phishingType = kPhishingWithMismatchedHosts;
@ -247,3 +247,14 @@ function confirmSuspiciousURL(aPhishingType, aSuspiciousHostName)
var buttons = nsIPS.STD_YES_NO_BUTTONS + nsIPS.BUTTON_POS_1_DEFAULT;
return promptService.confirmEx(window, titleMsg, dialogMsg, buttons, "", "", "", "", {}); /* the yes button is in position 0 */
}
// returns true if the IP address is a local address.
function isLocalIPAddress(unobscuredHostName)
{
var ipComponents = unobscuredHostName.value.split(".");
return ipComponents[0] == 10 ||
(ipComponents[0] == 192 && ipComponents[1] == 168) ||
(ipComponents[0] == 169 && ipComponents[1] == 254) ||
(ipComponents[0] == 172 && ipComponents[1] >= 16 && ipComponents[1] < 32);
}