Source code of Windows XP (NT5)
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.

377 lines
8.1 KiB

  1. <%@ LANGUAGE = VBScript %>
  2. <% 'Option Explicit %>
  3. <!-- #include file="directives.inc" -->
  4. <!--#include file="iiputls.str"-->
  5. <%
  6. Const ADS_PROPERTY_CLEAR = 1
  7. On Error Resume Next
  8. Dim path, currentobj, SpecObject, lasterr, key, changed, clearPaths
  9. lasterr=""
  10. changed = false
  11. path=Session("path")
  12. Set currentobj=GetObject(path)
  13. if Session("clearPathsOneTime") <> "" then
  14. clearPaths = Session("clearPathsOneTime")
  15. else
  16. clearPaths = (Session("clearPaths") <> "")
  17. end if
  18. SpecObject = ""
  19. SpecObject = GetObjectType(SpecObject, Session("SpecObj"),"Filters")
  20. SpecObject = GetObjectType(SpecObject, Session("SpecObj"),"Mime")
  21. SpecObject = GetObjectType(SpecObject, Session("SpecObj"),"IPSecurity")
  22. SpecObject = GetObjectType(SpecObject, Session("SpecObj"),"Operators")
  23. Select Case SpecObject
  24. Case "Filters"
  25. saveFilters
  26. Case "Mime"
  27. saveMIMEs
  28. Case "IPSecurity"
  29. saveIPSecurity
  30. Case "Operators"
  31. saveOperators
  32. Case Else
  33. saveGenericLists
  34. End Select
  35. Function getObjectType(SpecObject,SpecObjString,ObjType)
  36. If InStr(SpecObjString,ObjType) > 0 then
  37. getObjectType = ObjType
  38. Else
  39. getObjectType = SpecObject
  40. End If
  41. End Function
  42. Sub killChildPaths(key, thisobj)
  43. dim aSetChildPaths, childpath, child
  44. if clearPaths then
  45. aSetChildPaths = thisobj.GetDataPaths(key,IIS_DATA_INHERIT)
  46. For Each childpath in aSetChildPaths
  47. childPath = cleanPath(childPath)
  48. Set child = GetObject(childpath)
  49. if child.ADSPath <> thisobj.ADSPath then
  50. if (instr(LCase(child.ADSPath), "IIS://localhost/w3svc/info") > 0) OR (instr(LCase(child.ADSPath), "IIS://localhost/msftpsvc/info") > 0) then
  51. else
  52. child.PutEx ADS_PROPERTY_CLEAR, key, ""
  53. child.SetInfo
  54. end if
  55. end if
  56. Next
  57. end if
  58. Session("clearPathsOneTime") = ""
  59. End Sub
  60. Function cleanPath(pathstr)
  61. if Right(pathstr,1) = "/" then
  62. pathstr = Mid(pathstr, 1,len(pathstr)-1)
  63. end if
  64. cleanPath = pathstr
  65. End Function
  66. Sub saveGenericLists()
  67. dim proparray, oldarray
  68. proparray=Array()
  69. For Each key In Request.Form
  70. if (key="DELETED" or key="NEWITEM") then
  71. else
  72. proparray = setPropArray()
  73. oldarray=currentobj.Get(key)
  74. Response.write "New Array" & "<BR>"
  75. printarray(proparray)
  76. Response.write "Old Array" & "<BR>"
  77. printarray(oldarray)
  78. if chkUpdated(oldarray,proparray) then
  79. currentobj.Put key, (proparray)
  80. killChildPaths key, currentobj
  81. end if
  82. end if
  83. Next
  84. currentobj.SetInfo
  85. End Sub
  86. Sub saveOperators()
  87. dim currentobj, secdes, dacl, Ace, NewAce, Trustee
  88. dim proparray
  89. proparray=Array()
  90. key = "Trustee"
  91. Set currentobj = GetObject(path)
  92. Set secdes = currentobj.Get("AdminACL")
  93. Set dacl = secdes.DiscretionaryACL
  94. proparray = setPropArray()
  95. 'First, clear down our control list...
  96. currentobj.PutEx ADS_PROPERTY_CLEAR, "AdminACL", ""
  97. currentobj.SetInfo
  98. Set currentobj = GetObject(path)
  99. Set secdes = currentobj.Get("AdminACL")
  100. Set dacl = secdes.DiscretionaryACL
  101. For Each Trustee in proparray
  102. 'Ignore the administrator trustees. These are special and will be set automatically by the object.
  103. if Trustee <> L_BIADMINISTRATORS_TEXT and Trustee <> L_ADMINISTRATORS_TEXT then
  104. ' Set up the ACEs
  105. Set NewAce = CreateObject("AccessControlEntry")
  106. NewAce.Trustee = Trustee
  107. NewAce.AccessMask = 11
  108. dacl.AddAce NewAce
  109. end if
  110. Next
  111. secdes.DiscretionaryACL = (dacl)
  112. currentobj.AdminACL = secdes
  113. currentobj.SetInfo
  114. killChildPaths "AdminACL", currentobj
  115. End Sub
  116. Sub saveIPSecurity()
  117. Dim sobj, specprops, dd
  118. Dim proparray, oldarray
  119. response.write currentobj.ADsPath
  120. Set sobj=currentobj.Get(Session("SpecObj"))
  121. specprops=UCase(Session("SpecProps"))
  122. proparray=Array()
  123. For Each key In Request.Form
  124. if (key="DELETED" or key="NEWITEM") then
  125. else
  126. proparray = setPropArray()
  127. Select Case UCase(key)
  128. Case "IPGRANT"
  129. oldarray=sobj.IPGrant
  130. Case "IPDENY"
  131. oldarray=sobj.IPDeny
  132. Case "DOMAINGRANT"
  133. oldarray=sobj.DomainGrant
  134. Case "DOMAINDENY"
  135. oldarray=sobj.DomainDeny
  136. End Select
  137. if chkUpdated(oldarray,proparray) then
  138. Select Case UCase(key)
  139. Case "IPGRANT"
  140. sobj.IPGrant=(proparray)
  141. Case "IPDENY"
  142. sobj.IPDeny=(proparray)
  143. Case "DOMAINGRANT"
  144. sobj.DomainGrant=(proparray)
  145. Case "DOMAINDENY"
  146. sobj.DomainDeny=(proparray)
  147. End Select
  148. end if
  149. end if
  150. Next
  151. if Session("SpecObj")="IPSecurity" then
  152. currentobj.IPSecurity=sobj
  153. end if
  154. currentobj.SetInfo
  155. killChildPaths "IPSecurity", currentobj
  156. End Sub
  157. Sub saveFilters()
  158. Dim filterspath, filterCol, loadOrder, formsize, filtername,fltrObj, fltr,i
  159. filterspath = path & "/Filters"
  160. if isObject(filterspath) then
  161. Set filterCol = GetObject(filterspath)
  162. else
  163. Set filterCol=currentobj.Create("IIsFilters","Filters")
  164. end if
  165. loadOrder = Request.Form("FilterName")
  166. filterCol.FilterLoadOrder = (loadOrder)
  167. filterCol.KeyType = "IIsFilters"
  168. filterCol.SetInfo
  169. formsize=Request.Form("FilterName").Count-1
  170. For i=0 to formsize
  171. filtername = Request.Form("FilterName")(i+1)
  172. Response.write filtername
  173. if filtername <> "" then
  174. if isObject(filterspath & "/" & filtername) then
  175. Set fltrObj = GetObject(filterspath & "/" & filtername)
  176. else
  177. Set fltrObj=filterCol.Create("IIsFilter",filtername)
  178. end if
  179. fltrObj.FilterPath = (Request.Form("FilterPath")(i+1))
  180. fltrObj.SetInfo
  181. end if
  182. Next
  183. 'now, make sure we haven't deleted or renamed any...
  184. For Each fltr in filterCol
  185. filtername = fltr.Name
  186. Response.write filtername
  187. if InStr(loadOrder,filtername) = 0 then
  188. filterCol.Delete "IIsFilter", filtername
  189. end if
  190. Next
  191. filterCol.SetInfo
  192. End Sub
  193. Sub saveMIMES()
  194. Dim MIMEpath, MimeMaps, formsize, i, Map
  195. Dim aMimeMap
  196. if Session("vtype") = "comp" then
  197. MIMEpath = path & "/MimeMap"
  198. else
  199. MIMEpath = path
  200. end if
  201. if isObject(MIMEpath) then
  202. Set MimeMaps = GetObject(MIMEpath)
  203. else
  204. Set MimeMaps=currentobj.Create("IIsMimeMap","MimeMap")
  205. MimeMaps.KeyType = "IIsMimeMap"
  206. MimeMaps.SetInfo
  207. end if
  208. aMimeMap = MimeMaps.MimeMap
  209. formsize=Request.Form("ext").Count-1
  210. ReDim aMimeMap(formsize)
  211. i = 0
  212. if (formsize = 0 and Request.Form("ext")(1) <> "") or formsize > 0 then
  213. For i = 0 to formsize
  214. Set Map = CreateObject("Mimemap")
  215. Map.Extension=Request.Form("ext")(i+1)
  216. Map.MimeType=Request.Form("app")(i+1)
  217. Set aMimeMap(i) = Map
  218. Next
  219. MimeMaps.Mimemap = aMimeMap
  220. else
  221. MimeMaps.PutEx ADS_PROPERTY_CLEAR, "MimeMap", ""
  222. MimeMaps.GetInfo
  223. end if
  224. MimeMaps.SetInfo
  225. End Sub
  226. Function setPropArray()
  227. dim formsize,arraysize,i, j
  228. dim proparray
  229. 'key is global
  230. formsize=Request.Form(key).Count-1
  231. arraysize=0
  232. for i=0 to formsize
  233. if Request.Form(key)(i+1) <> "" then
  234. arraysize=arraysize + 1
  235. end if
  236. Next
  237. if arraysize=0 then
  238. ReDim proparray(0)
  239. if (Request.Form(key)(1) <> "") then
  240. proparray(0)=Request.Form(key)(1)
  241. else
  242. proparray = Array()
  243. end if
  244. else
  245. ReDim proparray(arraysize-1)
  246. j=0
  247. for i=0 to formsize
  248. if Request.Form(key)(i+1) <> "" then
  249. proparray(j)=Request.Form(key)(i+1)
  250. j=j+1
  251. end if
  252. Next
  253. end if
  254. setPropArray = proparray
  255. End Function
  256. Function chkUpdated(oldarray,proparray)
  257. dim proparraybound,arrayWasUpdated, i
  258. if IsArray(oldarray) then
  259. proparraybound=UBound(proparray)
  260. if UBound(oldarray) <> proparraybound then
  261. arrayWasUpdated=true
  262. else
  263. for i=0 to proparraybound
  264. if oldarray(i) <> proparray(i) then
  265. arrayWasUpdated=true
  266. end if
  267. Next
  268. end if
  269. else
  270. if proparraybound > 0 then
  271. arrayWasUpdated=true
  272. else
  273. arrayWasUpdated=(proparray(0) <> oldarray)
  274. end if
  275. end if
  276. 'set our global changed var
  277. changed = arrayWasUpdated
  278. chkUpdated = arrayWasUpdated
  279. End Function
  280. Function printarray(aprop)
  281. Dim prop
  282. for each prop in aprop
  283. response.write prop & "<BR>"
  284. next
  285. End Function
  286. Function isObject(path)
  287. On Error Resume Next
  288. Dim testObj
  289. set testObj = GetObject(path)
  290. isObject = (err = 0)
  291. err = 0
  292. End Function
  293. %>
  294. <SCRIPT LANGUAGE="JavaScript">
  295. parentdoc = parent.location.href;
  296. if (parentdoc.indexOf("pop") != -1){
  297. top.location.href="iipopcl.asp";
  298. }
  299. </SCRIPT>
  300. <HTML>
  301. <BODY BGCOLOR="#000000" TEXT="#FFCC00" TOPMARGIN=0 LEFTMARGIN=0>
  302. </BODY>
  303. </HTML>