home *** CD-ROM | disk | FTP | other *** search
- ////////////////////////////////////////////////////////////////////////////////////////////
- //
- // PRODUCT: Norton Internet Security/Symantec Desktop Firewall
- //
- // NAME: IP-Popup.js (Javascript file for IP-Popup.HTM)
- //
- // Copyright (c) 2001 by Symantec Corporation. All rights reserved.
- //
- ////////////////////////////////////////////////////////////////////////////////////////////
-
- var checklist = null;
- var bUseDomainName = true;
-
- function Page_OnLoad()
- {
- var args = null;
- EnterIP.focus();
-
- // Set the title...
- window.title = UserManager.ProductName;
-
- UserManager.WatchForFREIntegStart();
-
- if (window.dialogArguments)
- {
- args = window.dialogArguments;
-
- if (args)
- {
- checklist = args[2];
- checklist2 = args[3];
-
- // Decide whether to use domain name text
- if( args[4] == null )
- {
- bUseDomainName = true;
- }
- else
- {
- bUseDomainName = args[4];
- }
- if( bUseDomainName == true )
- {
- domaintext.style.display = "";
- }
- else
- {
- domaintext.style.display = "none";
- }
-
- switch (args[0])
- {
- case "permit":
- PermitRule.style.display = "";
- BlockRule.style.display = "none";
- MonitorRule.style.display = "none";
- break;
- case "block":
- PermitRule.style.display = "none";
- BlockRule.style.display = "";
- MonitorRule.style.display = "none";
- break;
- case "monitor":
- PermitRule.style.display = "none";
- BlockRule.style.display = "none";
- MonitorRule.style.display = "";
- break;
- }
- }
- }
- }
-
- function UserManager_OnFREIntegratorStart()
- {
- window.navigate('res://closeme.xyz');
- }
-
- function SelSingleAddr_OnClick()
- {
- Range.style.display = "none";
- NetAddr.style.display = "none";
- SingleAddr.style.display = "";
- RRange.checked = false;
- RNetAddr.checked = false;
- RSingleAddr.checked = true;
- }
-
- function SelRange_OnClick()
- {
- SingleAddr.style.display = "none";
- NetAddr.style.display = "none";
- Range.style.display = "";
- RRange.checked = true;
- RNetAddr.checked = false;
- RSingleAddr.checked = false;
- }
-
- function SelNetAddr_OnClick()
- {
- SingleAddr.style.display = "none";
- Range.style.display = "none";
- NetAddr.style.display = "";
- RRange.checked = false;
- RNetAddr.checked = true;
- RSingleAddr.checked = false;
- }
-
- function OKB_OnClick()
- {
- var ipList = null;
- var Error = false;
-
- // Remove trailing and leading spaces
- EnterIP.value = trim(EnterIP.value);
- EnterStartIP.value = trim(EnterStartIP.value);
- EnterEndIP.value = trim(EnterEndIP.value);
- EnterNetIP.value = trim(EnterNetIP.value);
- EnterMask.value = trim(EnterMask.value);
-
- // some initial tests to see if they closed the dialog without entering any text at all.
- if ((AddrType[0].checked && (EnterIP.value != "")) ||
- (AddrType[1].checked && (EnterStartIP.value != "") && (EnterEndIP.value != "")) ||
- (AddrType[2].checked && (EnterNetIP.value != "") && (EnterMask.value != "")))
- {
-
- ipList = new ActiveXObject("ccFWSettg.IPList");
-
- //
- // Individual addresses
- //
- if (AddrType[0].checked)
- {
- var sAddresses = new String(EnterIP.value);
- var aAddress = sAddresses.split(" ");
-
- // Replace all "localhost" names with "127.0.0.1"
- var szNewIPList = "";
- for(var nElem = 0; nElem < aAddress.length; nElem++)
- {
- // If the user entered "localhost", change it to "127.0.0.1"
- if( aAddress[nElem].toLowerCase() == "localhost" )
- aAddress[nElem] = "127.0.0.1";
-
- if(szNewIPList.length > 0)
- szNewIPList += " " + aAddress[nElem];
- else
- szNewIPList = aAddress[nElem];
- }
-
- for(var nElem = 0; (nElem < aAddress.length) && (Error == false); nElem++)
- {
- // Create an IP Item for the new address
- var ip = new ActiveXObject("ccFWSettg.IPItem");
- ip.namedIP = aAddress[nElem];
-
- var dupIP = checklist.IsIPInList(ip);
- var dupIP2 = null;
-
- if(null != checklist2)
- {
- dupIP2 = checklist2.IsIPInList(ip);
- }
-
- var dupIP3 = ipList.IsIPInList(ip);
-
- if(null == dupIP3)
- {
- if((null == dupIP) && (null == dupIP2))
- {
- // Check if the address is a valid XXX.XXX.XXX.XXX
-
- ip.Type = 0;
- var bValid = ip.Valid;
-
- if (bValid != true && bUseDomainName == true)
- {
- // Not a valid IP, try a domain name.
- ip.Type = 1;
- bValid = ip.Valid;
- }
-
- if (bValid == true)
- {
- ipList.LastError = 0;
- ipList.AppendItem(ip);
- if(HandleListError(ipList.LastError, 1008, 106))
- Error = true;
- }
- else
- {
- webWind.MsgBox(StrID("IPInvalid"), UserManager.AppTitle, MB_OK | MB_ICONEXCLAMATION);
- Error = true;
- }
- }
- else
- {
- webWind.MsgBox(StrID("IPDupeEntry"), UserManager.AppTitle, MB_OK | MB_ICONEXCLAMATION);
- returnValue = null;
- Error = true;
- break;
- }
- }
- }
- }
- //
- // Range of addresses
- //
- else if (AddrType[1].checked)
- {
- //
- // Valid IP Address ("xxx.xxx.xxx.xxx")?
- //
-
- var ip = new ActiveXObject("ccFWSettg.IPItem");
-
- ip.RangeStart = EnterStartIP.value;
- ip.RangeEnd = EnterEndIP.value;
- ip.Type = 2;
-
- if(ip.Valid == true)
- {
- var dupIP = checklist.IsIPInList(ip);
- var dupIP2 = null;
-
- if(null != checklist2)
- {
- dupIP2 = checklist2.IsIPInList(ip);
- }
-
- if((null == dupIP) && (null == dupIP2))
- {
- ipList.LastError = 0;
- ipList.AppendItem(ip);
- if(HandleListError(ipList.LastError, 1008, 107))
- Error = true;
-
- }
- else
- {
- webWind.MsgBox(StrID("IPDupeEntry"), UserManager.AppTitle, MB_OK | MB_ICONEXCLAMATION);
- Error = true;
- }
- }
- else
- {
- webWind.MsgBox(StrID("StartEndIPInvalid"), UserManager.AppTitle, MB_OK | MB_ICONEXCLAMATION);
- Error = true;
- }
- }
- //
- // Network address
- //
- else if (AddrType[2].checked)
- {
- //
- // Valid IP Address ("xxx.xxx.xxx.xxx")?
- //
- var ip = new ActiveXObject("ccFWSettg.IPItem");
-
- ip.NetworkIP = EnterNetIP.value;
- ip.NetworkMask = EnterMask.value;
- ip.Type = 3;
-
- if(ip.Valid == true)
- {
- var dupIP = checklist.IsIPInList(ip);
- var dupIP2 = null;
-
- if(null != checklist2)
- {
- dupIP2 = checklist2.IsIPInList(ip);
- }
-
- if((null == dupIP) && (null == dupIP2))
- {
- ipList.LastError = 0;
- ipList.AppendItem(ip);
- if(HandleListError(ipList.LastError, 1008, 109))
- Error = true;
-
- }
- else
- {
- webWind.MsgBox(StrID("IPDupeEntry"), UserManager.AppTitle, MB_OK | MB_ICONEXCLAMATION);
- Error = true;
- }
-
- }
- else
- {
- webWind.MsgBox(StrID("NetIPInvalid"), UserManager.AppTitle, MB_OK | MB_ICONEXCLAMATION);
- Error = true;
- }
- }
- }
- else
- {
- webWind.MsgBox(StrID("MustEnterValue"), UserManager.AppTitle, MB_OK | MB_ICONEXCLAMATION);
- Error = true;
- }
-
- if (!Error)
- {
- returnValue = ipList;
- window.navigate("res://closeme.xyz");
- }
- }
-
- function CancelB_OnClick()
- {
- returnValue = null;
- window.navigate("res://closeme.xyz");
- }
-