Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
4.8 KiB

  1. <%@Language="VBScript"%>
  2. <HTML>
  3. <!--#include file = "text.asp"-->
  4. <title><%=L_Title_Text%></title>
  5. <STYLE>
  6. </STYLE>
  7. <head>
  8. <META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
  9. </head>
  10. <BODY BGCOLOR=#FFFFFF LINK=000000 VLINK=000000>
  11. <%On Error goto 0%>
  12. <%if Request.Form("cancel") <> "" then
  13. if Request.Form("denyifcancel") <> "" then
  14. Response.Status = "401 Unauthorized"
  15. Response.End
  16. else
  17. Response.Redirect(Request.QueryString)
  18. end if
  19. Response.End
  20. end if
  21. %>
  22. <!-- Windows NT Server with IIS -->
  23. <%if Instr(1,Request.ServerVariables("SERVER_SOFTWARE"), "IIS") > 0 then%>
  24. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>
  25. <TR VALIGN=CENTER>
  26. <TD></TD>
  27. <TD WIDTH=20> </TD>
  28. <TD><FONT SIZE=+3 COLOR=#000000><B><%=L_ISM_Text%><BR> <FONT SIZE=-1><%=L_IIS6_Text%><FONT></B></FONT></TD>
  29. </TR>
  30. </Table>
  31. <%end if%>
  32. <!-- Windows NT Workstation with PWS -->
  33. <%if Instr(1,Request.ServerVariables("SERVER_SOFTWARE"), "PWS") then%>
  34. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0>
  35. <TR VALIGN=CENTER>
  36. <TD></TD>
  37. <TD WIDTH=20> </TD>
  38. <TD><FONT SIZE=+3 COLOR=#000000><B><%=L_ISM_Text%><BR> <FONT SIZE=-1><%=L_PWS_Text%><FONT></B></FONT></TD>
  39. </TR>
  40. </Table>
  41. <%end if%>
  42. <p>
  43. <%if Request.Form("new") <> Request.Form("new2") then %>
  44. <%=L_PWDM_Text%><p>
  45. <%Response.End%>
  46. <%end if%>
  47. <%
  48. On Error resume next
  49. dim domain,posbs, posat, username, pUser, root
  50. domain = Trim(Request.Form("domain"))
  51. ' if no domain is present we try to get the domain from the username,
  52. ' e.g. domainusername or [email protected]
  53. if domain = "" then
  54. posbs = Instr(1,Request.Form("acct"),"\" )
  55. posat = Instr(1,Request.Form("acct"),"@" )
  56. if posbs > 0 then
  57. domain = Left(Request.Form("acct"),posbs-1)
  58. username = Right(Request.Form("acct"),len(Request.Form("acct")) - posbs)
  59. elseif posat > 0 then
  60. domain = Right(Request.Form("acct"),len(Request.Form("acct")) - posat)
  61. username = Left(Request.Form("acct"),posat-1)
  62. else
  63. username = Request.Form("acct")
  64. set nw = Server.CreateObject("WScript.Network")
  65. domain = nw.Computername
  66. end if
  67. else
  68. username = Trim(Request.Form("acct"))
  69. end if
  70. ' verify that the characters in the user name are valid
  71. if IsInvalidUsername(username) = true then
  72. Response.Write L_InvalidUsername_Text & "."
  73. Response.Write "<br><H3><a href=" & Server.HTMLEncode(Request.ServerVariables("HTTP_REFERER")) & ">" & L_Back_Text & " </a></H3>"
  74. Response.End
  75. end if
  76. ' verify that the characters in the domain name are valid
  77. if IsInvalidDomainname(domain) = true then
  78. Response.Write L_InvalidDomainname_Text & "."
  79. Response.Write "<br><H3><a href=" & Server.HTMLEncode(Request.ServerVariables("HTTP_REFERER")) & ">" & L_Back_Text & " </a></H3>"
  80. Response.End
  81. end if
  82. set pUser = GetObject("WinNT://" & domain & "/" & username & ",user")
  83. if Not IsObject(pUser) then
  84. set root = GetObject("WinNT:")
  85. set pUser = root.OpenDSObject("WinNT://" & domain & "/" & username & ",user", username, Request.Form("old"),1)
  86. Response.Write "<!--OpenDSObject call-->"
  87. end if
  88. if Not IsObject(pUser) then
  89. 'Response.Write "domain <> null - OpenDSObject also failed"
  90. if err.number = -2147024843 then
  91. Response.Write L_NotExist_Text & "."
  92. else
  93. if err.description <> "" then
  94. Response.Write L_Error_Text & ": " & err.description
  95. else
  96. Response.Write L_Errornumber_Text & ": " & err.number
  97. end if
  98. Response.Write "<br><H3><a href=" & Server.HTMLEncode(Request.ServerVariables("HTTP_REFERER")) & ">" & L_Back_Text & "</a></H3>"
  99. end if
  100. Response.End
  101. end if
  102. err.Clear
  103. pUser.ChangePassword Request.Form("old"), Request.Form("new")
  104. if err.number <> 0 then
  105. if err.number = -2147024810 then
  106. Response.Write "<p>" & L_Error_Text & ": " & L_Invalid_Text
  107. elseif err.number = -2147022651 then
  108. Response.Write L_PasswordToShort_Text
  109. else
  110. Response.Write L_Errornumber_Text & ": " & err.number
  111. end if
  112. Response.Write "<br><H3><a href=" & Server.HTMLEncode(Request.ServerVariables("HTTP_REFERER")) & ">" & L_Back_Text & "</a></H3>"
  113. Response.End
  114. else
  115. Response.Write L_PasswordChanged_Text & ".<p>"
  116. end if
  117. %>
  118. <br>
  119. <a href="<%=Server.HTMLEncode(Request.QueryString)%>"> " <%=L_BackTo_Text%> "<%=Server.HTMLEncode(Request.QueryString)%></a>
  120. </body></html>
  121. <%
  122. function IsInvalidUsername(username)
  123. dim re
  124. set re = new RegExp
  125. ' list of invalid characters in a user name.
  126. re.Pattern = "[/\\""\[\]:<>\+=;,@]"
  127. IsInvalidUsername = re.Test(username)
  128. end function
  129. function IsInvalidDomainname(domainname)
  130. dim re
  131. set re = new RegExp
  132. ' list of invalid characters in a domain name.
  133. re.Pattern = "[/\\""\[\]:<>\+=;,@!#$%^&\(\)\{\}\|~]"
  134. IsInvalidDomainName = re.Test(domainname)
  135. end function
  136. %>