home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 February
/
CHIP_2_98.iso
/
software
/
pelne
/
optionp
/
iis4_03.cab
/
iiacsshd.asp
< prev
next >
Wrap
Text File
|
1997-11-12
|
12KB
|
493 lines
<%@ LANGUAGE=VBScript %>
<% Option Explicit %>
<% Response.Expires = 0 %>
<% if Session("FONTSIZE") = "" then %>
<!--#include file="iito.inc"-->
<% else %>
<%
Const L_TCPRESTRICT_TEXT="IP Address Access Restrictions"
Const L_BYDEFAULT_TEXT="By default, all computers are:"
Const L_GRANTED_TEXT="Granted access"
Const L_DENIED_TEXT="Denied access"
Const L_EXCEPTBELOW_TEXT="Except those listed below:"
Const L_ACCESS_TEXT="Access"
Const L_IP_TEXT="IP Address"
Const L_SubNET_TEXT="Subnet Mask"
Const L_DOMAIN_TEXT="Domain"
Const L_SELECTITEM_TEXT="Select an item to delete."
On Error Resume Next
Dim path, currentobj, ipsecobj
path=Session("dpath")
Session("path")=path
Set currentobj=GetObject(path)
Set ipsecobj=currentobj.IPSecurity
Session("SpecObj")="IPSecurity"
Session("SpecProps")="GrantbyDefault,IPDeny,IPGrant,DomainGrant,DomainDeny"
function heading(width,thestring)
Dim i
width=width - len(thestring)
for i=width to 0 step -1
thestring=thestring & " "
Next
heading=thestring
end function
%>
<!--#include file="iiset.inc"-->
<HTML>
<SCRIPT LANGUAGE="JavaScript">
function SetBool(){
if (document.userform.rdoGrantbyDefault[0].checked){
document.userform.GrantbyDefault.value="True"
}
else{
document.userform.GrantbyDefault.value="False"
}
loadList();
}
</SCRIPT>
<BODY BGCOLOR="#CCCCCC" LINK="#000000" VLINK="#000000" ALINK="navy" LEFTMARGIN=5 TOPMARGIN=5 onLoad="loadList();loadHelp();">
<FORM NAME="userform">
<TABLE CELLSPACING=0 CELLPADDING=2>
<TR><TD STYLE="font-face: Helv,Arial; font-size:10pt;"><FONT SIZE=1 FACE="Helv,ARIAL"><B><%= L_TCPRESTRICT_TEXT %></B></FONT></TD></TR>
<TR><TD>
<BLOCKQUOTE>
<TABLE WIDTH="100%" CELLSPACING=0 CELLPADDING=2>
<TR>
<TD VALIGN="top" STYLE="font-face: Helv,Arial; font-size:10pt;">
<FONT SIZE=1 FACE="Helv,ARIAL">
<%= L_BYDEFAULT_TEXT %>
</FONT>
</TD>
<TD VALIGN="top" STYLE="font-face: Helv,Arial; font-size:10pt;">
<TABLE>
<TR>
<TD>
<FONT SIZE=1 FACE="Helv,ARIAL">
<IMG SRC="images/smallkey.gif" WIDTH=17 HEIGHT=18 BORDER=0 ALIGN="middle">
</FONT>
</TD>
<TD>
<FONT SIZE=1 FACE="Helv,ARIAL">
<% if ipsecobj.GrantbyDefault then %>
<INPUT TYPE="hidden" NAME="GrantbyDefault" VALUE="True">
<INPUT TYPE="radio" NAME="rdoGrantbyDefault" CHECKED OnClick="SetBool();">
<% else %>
<INPUT TYPE="hidden" NAME="GrantbyDefault" VALUE="False">
<INPUT TYPE="radio" NAME="rdoGrantbyDefault" OnClick="SetBool();">
<% end if %>
</FONT>
</TD>
<TD>
<FONT SIZE=1 FACE="Helv,ARIAL">
<%= L_GRANTED_TEXT %>
</FONT>
</TD>
</TR>
<TR>
<TD>
<FONT SIZE=1 FACE="Helv,ARIAL">
<IMG SRC="images/lock.gif" WIDTH=16 HEIGHT=18 BORDER=0 ALIGN="middle">
</FONT>
</TD>
<TD>
<FONT SIZE=1 FACE="Helv,ARIAL">
<% if ipsecobj.GrantbyDefault then %>
<INPUT TYPE="radio" NAME="rdoGrantbyDefault" OnClick="SetBool();">
<% else %>
<INPUT TYPE="radio" NAME="rdoGrantbyDefault" CHECKED OnClick="SetBool();">
<% end if %>
</FONT>
</TD>
<TD>
<FONT SIZE=1 FACE="Helv,ARIAL">
<%= L_DENIED_TEXT %>
</FONT>
</TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD STYLE="font-face: Helv,Arial; font-size:10pt;"><FONT SIZE=1 FACE="Helv,ARIAL"><%= L_EXCEPTBELOW_TEXT %></FONT></TD>
</TR>
</TABLE>
</BLOCKQUOTE>
</TD></TR>
</TABLE>
<TABLE BORDER=1 BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#CCCCCC" BORDERCOLORLIGHT="#CCCCCC">
<TR>
<TD BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" STYLE="font-face: Helv,Arial; font-size:10pt;">
<FONT SIZE=1 FACE="HELV,ARIAL">
<% if Session("FONTSIZE")="LARGE" then %>
<%= heading(5,L_ACCESS_TEXT) %>
<% else %>
<%= heading(18,L_ACCESS_TEXT) %>
<% end if %>
</FONT>
</TD>
<TD BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" STYLE="font-face: Helv,Arial; font-size:10pt;">
<FONT SIZE=1 FACE="HELV,ARIAL">
<A HREF="javascript:sortList('ip');">
<% if Session("FONTSIZE")="LARGE" then %>
<%= heading(28,L_IP_TEXT) %>
<% else %>
<%= heading(22,L_IP_TEXT) %>
<% end if %>
</A>
</FONT>
</TD>
<TD BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" STYLE="font-face: Helv,Arial; font-size:10pt;">
<FONT SIZE=1 FACE="HELV,ARIAL">
<A HREF="javascript:sortList('subnet');">
<% if Session("FONTSIZE")="LARGE" then %>
<%= heading(25,L_SubNET_TEXT) %>
<% else %>
<%= heading(17,L_SubNET_TEXT) %>
<% end if %>
</A>
</FONT>
</TD>
<TD BORDERCOLOR="#CCCCCC" BORDERCOLORDARK="#FFFFFF" BORDERCOLORLIGHT="#000000" STYLE="font-face: Helv,Arial; font-size:10pt;">
<FONT SIZE=1 FACE="HELV,ARIAL">
<A HREF="javascript:sortList('domain');">
<% if Session("FONTSIZE")="LARGE" then %>
<%= heading(43,L_DOMAIN_TEXT) %>
<% else %>
<%= heading(32,L_DOMAIN_TEXT) %>
<% end if %>
</A>
</FONT>
</TD>
</TR>
</TABLE>
</FORM>
<SCRIPT LANGUAGE="JavaScript">
function loadHelp(){
top.title.Global.helpFileName="iipy_4";
}
function isNum(txtcntrl) {
str=txtcntrl.value;
for (var i=0; i < str.length; i++) {
var ch=str.substring(i, i + 1);
if ((ch < "0" || "9" < ch) && ch !=',') {
alert("Please enter an integer.");
txtcntrl.focus()
return false;
}
}
return true;
}
function SetList(){
}
function disableDefault(dir,fromCntrl, toCntrl){
if (!dir){
if (fromCntrl.value !=""){
toCntrl.value=fromCntrl.value;
fromCntrl.value="";
}
}
else{
if (toCntrl.value !=""){
fromCntrl.value=toCntrl.value;
toCntrl.value="";
}
}
}
function enableDefault(chkCntrl){
chkCntrl.checked=true;
}
function loadList(){
parent.list.location="iiacssls.asp";
}
function setLastSel(id){
for (var i=0; i < cachedList.length; i++) {
if (cachedList[i].id == id){
listFunc.sel = i;
return;
}
}
}
function sortList(sortby)
{
i=eval(listFunc.sel);
if ( i != -1)
{
lastsel = cachedList[i].id
}
if (sortby != listFunc.sortby)
{
listFunc.sortby = sortby;
listFunc.sortAsc = true;
}
else
{
listFunc.sortAsc = !listFunc.sortAsc;
}
var num = parseFloat(cachedList[sortby]);
if (isNaN(num))
{
cachedList.sort(sortOrder);
}
else
{
cachedList.sort(numOrder);
}
if (!listFunc.sortAsc)
{
cachedList.reverse();
}
if ( i != -1)
{
setLastSel(lastsel);
}
loadList();
}
function sortOrder(a,b)
{
if (a[listFunc.sortby] < b[listFunc.sortby])
{
return -1;
}
else
{
if (a[listFunc.sortby] > b[listFunc.sortby])
{
return 1;
}
else
{
return 0;
}
}
}
function addItem(){
i=cachedList.length
listFunc.noupdate = true;
if (document.userform.rdoGrantbyDefault[0].checked){
access=false;
}
else{
access=true;
}
cachedList[i]=new listObj(i,access, "", "", "");
listFunc.sel=i;
cachedList[i].updated=true;
cachedList[i].newitem=true;
loadList();
}
function delItem(){
if (listFunc.sel >= 0){
listFunc.noupdate = true;
sel = eval(listFunc.sel);
cachedList[sel].deleted = true;
cachedList[sel].updated = true;
sel = sel-1;
<% 'run through the list to find the Next non-deleted item %>
for (var j = sel; j >=0; j--) {
if (cachedList[j].deleted){
}
else{
break
}
}
listFunc.sel = j;
loadList();
}
else{
alert("<%= L_SELECTITEM_TEXT %>");
}
}
function buildListForm(){
numrows=0;
for (var i=0; i < cachedList.length; i++) {
fullstr = cachedList[i].ip + cachedList[i].Subnet+ cachedList[i].domain;
if ((!cachedList[i].deleted) && (fullstr !="")){
numrows=numrows + 1;
}
}
qstr="numrows="+numrows;
qstr=qstr+"&cols=IPGrant&cols=IPDeny&cols=DomainGrant&cols=DomainDeny"
top.hlist.location.href="iihdn.asp?"+qstr;
<% 'the list values will be grabbed by the hiddenlistform script... %>
}
function SetListVals(){
listForm=top.hlist.document.hiddenlistform;
j=0;
for (var i=0; i < cachedList.length; i++) {
fullstr = cachedList[i].ip + cachedList[i].Subnet+ cachedList[i].domain;
if ((!cachedList[i].deleted) && (fullstr !="")){
ipSubnet=cachedList[i].ip + "," + cachedList[i].Subnet;
if (ipSubnet==","){
ipSubnet=""
}
else{
//if there is no subnet, set it to default...
if (ipSubnet.indexOf(",") == ipSubnet.length-1){
ipSubnet = ipSubnet + "255.255.255.255"
}
}
if (cachedList[i].access){
// this works because on entry, if the user enters a domain, the ip/Subnet will be cleared.
// if they enter an ip the domain will be cleared.
// ip/Subnet and domain should be mutually exclusive...
listForm.elements[j++].value=ipSubnet;
listForm.elements[j++].value="";
listForm.elements[j++].value=cachedList[i].domain;
listForm.elements[j++].value="";
}
else{
listForm.elements[j++].value="";
listForm.elements[j++].value=ipSubnet;
listForm.elements[j++].value="";
listForm.elements[j++].value=cachedList[i].domain;
}
}
cachedList[i].updated=false;
}
}
function listFuncs(){
this.sel = -1;
this.noupdate = false;
this.addItem=addItem;
this.delItem=delItem;
this.writeList=buildListForm;
this.SetListVals=SetListVals;
this.mainframe = top.opener.top;
}
function listObj(i,a,ip,s,dmn){
this.id = i;
this.access=a;
this.ip=ip;
this.Subnet=s;
this.domain=dmn;
this.deleted=false;
this.updated=false;
this.newitem=false;
}
cachedList=new Array()
<%
Dim agrantlist, arraybound, aAccess, i, Nexti
Dim agrantDomains, adenylist, adenyDomains
agrantlist=ipsecobj.IPGrant
if IsArray(agrantlist) then
arraybound=UBound(agrantlist)
if agrantlist(0) <> "" then
for i=0 to arraybound
aAccess=getIP(agrantlist(i))
%>cachedList[<%= i %>]=new listObj(<%= i %>, true, "<%= aAccess(0) %>","<%= aAccess(1) %>","");<%
Next
end if
end if
Nexti=UBound(agrantlist)+1
agrantdomains=ipsecobj.DomainGrant
if IsArray(agrantdomains) then
arraybound=UBound(agrantdomains)
if agrantdomains(0) <> "" then
for i=0 to arraybound
%>cachedList[<%= Nexti %>]=new listObj(<%= Nexti %>, true, "","","<%= agrantdomains(i) %>");<%
Nexti=Nexti + 1
Next
end if
end if
adenylist=ipsecobj.IPDeny
if IsArray(adenylist) then
arraybound=UBound(adenylist)
if adenylist(0) <> "" then
for i=0 to arraybound
aAccess=getIP(adenylist(i))
%>cachedList[<%= Nexti %>]=new listObj(<%= Nexti %>, false, "<%= aAccess(0) %>","<%= aAccess(1) %>","");<%
Nexti=Nexti + 1
Next
end if
end if
adenydomains=ipsecobj.DomainDeny
if IsArray(adenydomains) then
arraybound=UBound(adenydomains)
if adenydomains(0) <> "" then
for i=0 to arraybound
%>cachedList[<%= Nexti %>]=new listObj(<%= Nexti %>, false, "","","<%= adenydomains(i) %>");<%
Nexti=Nexti + 1
Next
end if
end if
function getIP(bindstr)
dim one, ip, sn
one=Instr(bindstr,",")
if one > 0 then
ip=Trim(Mid(bindstr,1,(one-1)))
sn=Trim(Mid(bindstr,(one+1)))
if sn = "255.255.255.255" then
sn = ""
end if
else
ip=bindstr
end if
getIP=Array(ip,sn)
end function
%>
listFunc=new listFuncs();
</SCRIPT>
</BODY>
</HTML>
<% end if %>