home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 February
/
CHIP_2_98.iso
/
software
/
pelne
/
optionp
/
ims.cab
/
smosec.asp
< prev
next >
Wrap
Text File
|
1997-10-20
|
13KB
|
490 lines
<%
'----------------------------------------------------------------------------
'
'
' File: smosec.asp
'
' Description: Outbound security page
'
' Copyright (C) 1997 Microsoft Corporation
'
'------------------------------------------------------------------------------
%>
<% Response.Expires = 0 %>
<%
REM LOCALIZATION
L_PAGETITLE_TEXT = "Outbound Security"
L_NOAUTH_TEXT = "No authentication"
L_CLEAR_TXT_AUTH_TEXT = "Clear text authentication"
L_WINDOWS_NT_CHALLENGE_TEXT = "Windows NT Challenge/Response authentication"
L_ACCOUNT_TEXT = "Account:"
L_WINDOWS_NT_ACCOUNT_TEXT = "WindowsNTAccount:"
L_TLSENCRYP_TEXT = "TLS encryption"
L_OK_TEXT = "OK"
L_CANCEL_TEXT = "Cancel"
L_HELP_TEXT = "Help"
L_CHANGE_TEXT = "Change..."
L_AUTHACCOUNT_TEXT = "AuthenticationAccount"
CHANGETXT_TEXT = "change"
REM End LOCAIZATION
SAVE_TEXT = "save"
DOMAINS_TEXT = "domain"
UPDATE_TEXT = "update"
SMTP_NO_ACTION = 0 ' 0x00000000
SMTP_SSL = 4 ' 0x00000004
SMTP_AUTH_NTLM = 128 ' 0x00000080
SMTP_AUTH_CLEARTEXT = 256 ' 0x00000100
REM UserName Get's the userName that is logged on
REM dpath IIS path set by the Global.asa
REM a Action to be performed, blank for editing 'save' for saving the data
REM siteInstance Server instance
REM sectype type of security to edit, blank for delivery, 'domain' for domains
UserName = Request("LOGON_USER")
dpath = Session("dpath")
a = Request("a")
siteInstance = Request("ServerInstance")
sectype = Request("sectype")
DomainName = Request("DomainName")
RouteAction = Request("newRouteAction")
RouteUserName = Request("txtRouteUserName")
RoutePassword = Request("txtRoutePassword")
RouteActionString = Request("txtRouteActionString")
%>
<!--#include file="smerrors.asp" -->
<script language="javascript">
<%
if (siteInstance = "") then
siteInstance = Session("ServerInstance")
else
Session("ServerInstance") = siteInstance
end if
if (Session("svr") = "") then
Session("svr") = Request.ServerVariables("SERVER_NAME")
end if
svr = UCase(Session("svr"))
if (dpath = "") then
dpath = "IIS://" & svr & "/SmtpSvc"
end if
On Error Resume Next
set smtpAdm = GetObject(dpath)
if (Err <> 0) then
szError = GetErrorMessage(Err) %>
alert("<% = szError %> : <% = Err %>");
<%
end if
szServerString = dpath & "/" & siteInstance
On Error Resume Next
set smtpServer = GetObject(szServerString)
if (Err <> 0) then
szError = GetErrorMessage(Err) %>
alert("<% = szError %> : <% = Err %>");
<%
end if
szDomainString = szServerString & "/" & "Domain"
szDomainClassString = "IIsSmtpDomain"
Dim smtpDomain
if (sectype = DOMAINS_TEXT) then
On Error Resume Next
set smtpDomain = GetObject(szDomainString & "/" & DomainName)
if (Err <> 0) then
szError = GetErrorMessage(Err) %>
alert("<% = szError %> : <% = Err %>");
<% end if
end if
'----------------------------------------------------------------------------
'
' If we are saving then check all the variables
'
'----------------------------------------------------------------------------
if (a = SAVE_TEXT) then
'
' Check to see which bits are set
'
if (RouteAction And SMTP_NO_ACTION) then
RouteUserName = ""
RoutePassword = ""
end if
if ((RouteAction And SMTP_AUTH_CLEARTEXT) And ((InStr(RouteUserName, "\")) <> 0)) then
RouteUserName = ""
end if
if (sectype = DOMAINS_TEXT) then
smtpDomain.RouteUserName = RouteUserName
smtpDomain.RoutePassword = RoutePassword
smtpDomain.RouteActionString = RouteActionString
On Error Resume Next
smtpDomain.SetInfo
if (Err <> 0) then
szError = GetErrorMessage(Err) %>
alert("<% = szError %> : <% = Err %>");
<% end if
else
'unflag all options
szBitMask = smtpServer.RouteAction
szBitMask = szBitMask AND NOT SMTP_AUTH_NTLM
szBitMask = szBitMask AND NOT SMTP_AUTH_CLEARTEXT
szBitMask = szBitMask AND NOT SMTP_SSL
'set bitmask
szBitMask = szBitMask OR RouteAction
smtpServer.RouteAction = szBitMask
smtpServer.RouteUserName = RouteUserName
smtpServer.RoutePassword = RoutePassword
smtpServer.RouteActionString = RouteActionString
On Error Resume Next
smtpServer.SetInfo
if (Err <> 0) then
szError = GetErrorMessage(Err) %>
alert("<% = szError %> : <% = Err %>");
<% end if
end if
elseif (a <> UPDATE_TEXT) then
if (sectype = DOMAINS_TEXT) then
RouteActionString = smtpDomain.RouteActionString
RouteAction = smtpDomain.RouteAction
RouteUserName = smtpDomain.RouteUserName
RoutePassword = smtpDomain.RoutePassword %>
<%
else
RouteAction = smtpServer.RouteAction
RouteUserName = smtpServer.RouteUserName
RoutePassword = smtpServer.RoutePassword
end if
end if
%>
</script>
<HTML>
<HEAD>
<% if (a <> SAVE_TEXT) then %>
<script language="javascript">
function onOK()
{
uform = document.userform;
uform.a.value = "<% = SAVE_TEXT %>";
GetRouteAction();
uform.submit();
}
<% REM Javascript function helpBox %>
function helpBox()
{
window.open("help/smosech.htm","<% = L_HELP_TEXT %>","toolbar=no,scrollbars=yes,directories=no,menubar=no,width=450,height=450");
}
function Initalize()
{
uform = document.userform;
<%
szBitMask = RouteAction
iLength = Len(szBitMask)
icomp = 0
icomp = szBitMask And SMTP_NO_ACTION
if (icomp = 0) then %>
uform.rdoAutType[0].checked = true;
<% end if
icomp = 0
icomp = szBitMask And SMTP_SSL
if (icomp) then %>
uform.chkTLS.checked = true;
<% end if
icomp = 0
icomp = szBitMask And SMTP_AUTH_NTLM
if (icomp) then %>
uform.rdoAutType[2].checked = true;
<% end if
icomp = 0
icomp = szBitMask And SMTP_AUTH_CLEARTEXT
if (icomp) then %>
uform.rdoAutType[1].checked = true;
<% end if %>
}
function GetRouteAction()
{
uform = document.userform;
var szBitMask = <% = RouteAction %>;
szBitMask = szBitMask & ~<% = SMTP_AUTH_NTLM %>;
szBitMask = szBitMask & ~<% = SMTP_AUTH_CLEARTEXT %>;
szBitMask = szBitMask & ~<% = SMTP_SSL %>;
if (uform.rdoAutType[0].checked)
{
szBitMask = szBitMask | <% = SMTP_NO_ACTION %>;
}
if (uform.rdoAutType[2].checked)
{
szBitMask = szBitMask | <% = SMTP_AUTH_NTLM %>;
}
if (uform.rdoAutType[1].checked)
{
szBitMask = szBitMask | <% = SMTP_AUTH_CLEARTEXT %>;
}
if (uform.chkTLS.checked)
{
szBitMask = szBitMask | <% = SMTP_SSL %>;
}
uform.newRouteAction.value = szBitMask;
}
function authDialog(szType)
{
var width = 375;
var height = 260;
uform = document.userform;
uform.txtRoutePassword.value = "";
uform.txtRouteUserName.value = "";
<% if Instr(Request.ServerVariables("HTTP_USER_AGENT"),"MSIE") then %>
<% else %>
width = width + 25;
height = height + 25;
<% end if %>
var title = "<% = CHANGETXT_TEXT %>";
<% RouteUserName = Replace(RouteUserName, "\", "%5C%5C") %>
var path = "smAu.asp?svr=<% = svr %>&ServerInstance=<% = siteInstance %>";
var route = "&RouteUserName=<% = RouteUserName %>";
if (szType == "clear")
{
//Clear Text Authentication
uform.rdoAutType[1].checked = true;
path = path + "&AuthType=clear" + route;
}
else
{
//NT Challenge/Response
uform.rdoAutType[2].checked = true;
path = path + "&AuthType=NT" + route;
GetRouteAction();
}
GetRouteAction();
var winstr = "toolbar=no,scrollbars=no,directories=no,menubar=no,width="+width+",height="+height+",resizable=no";
var accountbox = window.open(path,title,winstr);
if(accountbox != null)
{
if (accountbox.opener == null)
{
accountbox.opener = self;
}
}
<% RouteUserName = Replace(RouteUserName, "%5C%5C", "\") %>
GetRouteAction();
}
function myTest()
{
GetRouteAction();
}
</script>
<% end if %>
<TITLE><% = L_PAGETITLE_TEXT %></TITLE>
</HEAD>
<% if (a = SAVE_TEXT) then %>
<script language="javascript">
<% if (secType = DOMAINS_TEXT) then %>
var szBitMask = <% = smtpDomain.RouteAction %>
wform = opener.document.userform;
var szBitMask = wform.newActionType.value;
szBitMask = szBitMask & ~<% = SMTP_AUTH_NTLM %>;
szBitMask = szBitMask & ~<% = SMTP_AUTH_CLEARTEXT %>;
szBitMask = szBitMask & ~<% = SMTP_SSL %>;
wform.newActionType.value = szBitMask;
wform.newActionType.value = wform.newActionType.value | <% = RouteAction %>;
<% end if %>
</script>
<BODY background="images\black.gif" BGCOLOR="#CCCCCC" TEXT="#000000" TOPMARGIN=15 LINK="#000000" VLINK="#000000" ALINK="#000000" onLoad="close();">
<% else %>
<BODY background="images\black.gif" BGCOLOR="#CCCCCC" TEXT="#000000" TOPMARGIN=15 LINK="#000000" VLINK="#000000" ALINK="#000000">
<% end if %>
<% if (a <> SAVE_TEXT) then %>
<FORM NAME="userform" ACTION="smosec.asp" METHOD="post">
<INPUT TYPE="hidden" NAME="a" VALUE="<% = a %>">
<input type="hidden" name="newRouteAction" value="<% = RouteAction %>">
<input type="hidden" name="txtRoutePassword" value="<% = RoutePassword %>">
<input type="hidden" name="txtRouteActionString" value="<% = RouteActionString %>">
<input type="hidden" name="txtRouteUserName" value="<% = RouteUserName %>">
<input type="hidden" name="DomainName" value="<% = DomainName %>">
<input type="hidden" name="secType" value="<% = secType %>">
<TABLE BORDER="1" BGCOLOR="#CCCCCC" WIDTH="100%" cellpadding="10">
<TR><TD>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="2" CELLSPACING="2">
<TR>
<TD colspan="3">
<FONT FACE="Arial" SIZE=2>
<input type="radio" name="rdoAutType" value="<% = L_NOAUTH_TEXT %>" onClick="GetRouteAction();">
<% = L_NOAUTH_TEXT %>
</font>
</TD>
</TR><TR>
<TD colspan="3">
<FONT FACE="Arial" SIZE=2>
<input type="radio" name="rdoAutType" value="<% = L_CLEAR_TXT_AUTH_TEXT %>" onClick="GetRouteAction();">
<% = L_CLEAR_TXT_AUTH_TEXT %>
</font>
</TD>
</TR><TR>
<TD colspan="2" width="75%">
<FONT FACE="Arial" SIZE=2>
<% = L_ACCOUNT_TEXT %>
<% if (Mid(Hex(RouteAction), 1, 1) = "1") then %>
<% = RouteUserName %>
<% else %>
<% end if %>
</font>
</td><td>
<FONT FACE="Arial" SIZE=2>
<INPUT NAME="btnChange" TYPE="button" VALUE="<% = L_CHANGE_TEXT %>" size="40" OnClick="authDialog('clear');">
</font>
</TD>
</TR><TR>
<TD colspan="3" height="1">
</TD>
</TR><TR>
<TD COLSPAN="3">
<FONT FACE="Arial" SIZE=2>
<input type="radio" name="rdoAutType" value="<% = L_WINDOWS_NT_CHALLENGE_TEXT %>" onClick="GetRouteAction();">
<% = L_WINDOWS_NT_CHALLENGE_TEXT %>
</font>
</TD>
</TR><TR>
<TD colspan="2">
<FONT FACE="Arial" SIZE=2>
<% = L_WINDOWS_NT_ACCOUNT_TEXT %>
<% if (Mid(Hex(RouteAction), 1, 1) = "8") then %>
<% = RouteUserName %>
<% else %>
<% end if %>
</font>
</td><td>
<FONT FACE="Arial" SIZE=2>
<INPUT NAME="btnChange" TYPE="button" VALUE="<% = L_CHANGE_TEXT %>" size="40" OnClick="authDialog('NT');">
</font>
</TD>
</TR><TR>
<TD colspan="3">
<FONT FACE="Arial" SIZE=2>
<input TYPE="CHECKBOX" Name="chkTLS" VALUE="<% = L_TLSENCRYP_TEXT %>" onClick="GetRouteAction();">
<% = L_TLSENCRYP_TEXT %>
</TD>
</TR>
</table>
</TD></TR>
</TABLE>
<P>
<TABLE ALIGN="right" BORDER=0 CELLPADDING=2 CELLSPACING=2>
<TR>
<TD>
<TABLE VALIGN="top" BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR="#FFCC00">
<TR>
<TD VALIGN="middle">
<FONT FACE="Arial" SIZE=2>
<B><A HREF="javascript:onOK();">
<IMG SRC="images/gnicok.gif" BORDER=0 ALIGN="top" HEIGHT=16 WIDTH=16></A>
<A HREF="javascript:onOK();"><% = L_OK_TEXT%></A></B>
</FONT>
</TD>
</TR>
</TABLE>
</TD>
<TD>
<TABLE VALIGN="top" BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR="#FFCC00">
<TR>
<TD VALIGN="middle">
<FONT FACE="Arial" SIZE=2>
<B><A HREF="javascript:close();">
<IMG SRC="images/gniccncl.gif" BORDER=0 ALIGN="top" HEIGHT=16 WIDTH=16></A>
<A HREF="javascript:close();"><% = L_CANCEL_TEXT %></A></B>
</FONT>
</TD>
</TR>
</TABLE>
</TD>
<TD>
<TABLE VALIGN="top" BORDER=0 CELLPADDING=5 CELLSPACING=0 BGCOLOR="#FFCC00">
<TR>
<TD VALIGN="middle">
<FONT FACE="Arial" SIZE=2><A HREF="javascript:helpBox();">
<IMG SRC="images/gnichelp.gif" BORDER=0 ALIGN="top" HEIGHT=16 WIDTH=16></A>
<B><A HREF="javascript:helpBox();"><% = L_HELP_TEXT %></A></B>
</FONT>
</TD>
</TR>
</TABLE>
</TD>
<TD> </TD>
</TR>
</TABLE>
</FORM>
<script language="javascript">
Initalize();
GetRouteAction();
</script>
<% end if %>
</BODY>
</HTML>