Previous checking for Bug 343059 was a patch by Serge Gautherie <gautheri@noos.fr>

This commit is contained in:
bugzilla%standard8.demon.co.uk 2006-07-20 16:50:18 +00:00
Родитель 4b05c9de36
Коммит 9b41e6edd5
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -114,7 +114,7 @@ function isPhishingURL(aLinkNode, aSilentMode, aHref)
{
unobscuredHostName.value = hrefURL.host;
if (hostNameIsIPAddress(hrefURL.host, unobscuredHostName))
if (hostNameIsIPAddress(hrefURL.host, unobscuredHostName) && !isLocalIPAddress(unobscuredHostName))
phishingType = kPhishingWithIPAddress;
else if (misMatchedHostWithLinkText(aLinkNode, hrefURL, linkTextURL))
phishingType = kPhishingWithMismatchedHosts;
@ -243,3 +243,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);
}