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.

1401 lines
43 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <%
  4. ' Response.Buffer = True
  5. '-------------------------------------------------------------------------
  6. ' site_new.asp: Serves in creating a new site
  7. '
  8. ' Copyright (c) Microsoft Corporation. All rights reserved.
  9. '
  10. ' Date Description
  11. ' 14-Jan-2001 Creation Date
  12. ' 25-Jan-2001 Last Modified Date
  13. '-------------------------------------------------------------------------
  14. %>
  15. <!-- #include virtual="/admin/inc_framework.asp" -->
  16. <!-- #include file="resources.asp" -->
  17. <!-- #include file="inc_wsa.asp" -->
  18. <!-- #include file="Sitenew_prop.asp" -->
  19. <%
  20. Err.Clear
  21. 'On Error Resume Next
  22. '-------------------------------------------------------------------------
  23. ' Global Constants and Variables
  24. '-------------------------------------------------------------------------
  25. Dim G_strAnonName 'to hold Anonymous name
  26. Dim G_strAnonPwd 'to hold Anonymous pwd
  27. Dim G_strDirRoot 'to hold Domainname value
  28. Dim G_strSysName 'to hold system name
  29. Dim G_Browser_Grp 'to hold Browsers group for AD Scenario
  30. Dim G_Admin_Grp 'to hold Admin group for AD Scenario
  31. Dim G_Authors_Grp 'to hold Authors group for AD scenario
  32. Dim G_strSiteName 'to hold site name
  33. Dim G_AnonUserName 'to hold anonymouse username created by IIS
  34. Dim rc 'to hold return count value
  35. Dim page 'to hold page object
  36. Dim idTabGeneral 'to hold Ist tab value
  37. Dim idTabSiteID 'to hold IInd tab value
  38. Dim idTabAppSetting 'to hold Vth tab value
  39. '=========================================================================
  40. ' Entry point
  41. '=========================================================================
  42. '
  43. ' Set username value
  44. G_AnonUserName = GetIISAnonUsername()
  45. 'Create a Tabbed Property Page
  46. rc = SA_CreatePage( L_CREATETASKTITLE_TEXT, "", PT_TABBED, page )
  47. ' Add five tabs
  48. rc = SA_AddTabPage( page, L_GENERAL_TEXT, idTabGeneral)
  49. rc = SA_AddTabPage( page, L_SITEIDENTITY_TEXT, idTabSiteID)
  50. rc = SA_AddTabPage( page, L_APPLICATIONSETTINGS_TEXT, idTabAppSetting)
  51. ' Show the page
  52. rc = SA_ShowPage( page )
  53. '=========================================================================
  54. ' Web Framework Event Handlers
  55. '=========================================================================
  56. '-------------------------------------------------------------------------
  57. ' Function: OnInitPage
  58. '
  59. ' Synopsis: Called to signal first time processing for this page. Use
  60. ' this method to do first time initialization tasks.
  61. '
  62. ' Returns: TRUE to indicate initialization was successful. FALSE to
  63. ' indicate errors. Returning FALSE will cause the page to be
  64. ' abandoned.
  65. '
  66. '-------------------------------------------------------------------------
  67. Public Function OnInitPage(ByRef PageIn, ByRef EventArg)
  68. On Error Resume Next
  69. Call GetDomainRole( G_strDirRoot, G_strSysName )
  70. 'init the checkbox
  71. F_strCreatePathChecked = "true"
  72. '
  73. 'We won't support create Domain Admin Site anymore
  74. F_strAccountLocation = "1"
  75. OnInitPage = TRUE
  76. End Function
  77. '-------------------------------------------------------------------------
  78. ' Function: OnPostBackPage
  79. '
  80. ' Synopsis: Called to signal that the page has been posted-back. A post-
  81. ' back occurs in tabbed property pages and wizards as the user
  82. ' navigates through pages. It is differentiated from a Submit
  83. ' or Close operationin that the user is still working with the
  84. ' page.
  85. '
  86. ' The PostBack event should be used to save the state of page.
  87. '
  88. ' Returns: TRUE to indicate initialization was successful. FALSE to
  89. ' indicate errors. Returning FALSE will cause the page to be
  90. ' abandoned.
  91. '-------------------------------------------------------------------------
  92. Public Function OnPostBackPage(ByRef PageIn, ByRef EventArg)
  93. Err.clear
  94. on Error Resume Next
  95. 'get variables from form
  96. call SetGenFormVariables()
  97. call SetSiteIdentitiesFormVariables()
  98. call SetApplnSettingsFormVariables()
  99. Call SA_TRACEOUT("OnPostBackPage","OnPostBackPage called")
  100. OnPostBackPage = TRUE
  101. End Function
  102. '--------------------------------------------------------------------------
  103. ' Function: OnServeTabbedPropertyPage
  104. '
  105. ' Synopsis: Called when the page needs to be served. Use this method to
  106. ' serve content.
  107. '
  108. ' Returns: TRUE to indicate not problems occured. FALSE to indicate errors.
  109. ' Returning FALSE will cause the page to be abandoned.
  110. '
  111. '--------------------------------------------------------------------------
  112. Public Function OnServeTabbedPropertyPage(ByRef PageIn, _
  113. ByVal iTab, _
  114. ByVal bIsVisible, _
  115. ByRef EventArg)
  116. ' Emit Web Framework required functions
  117. If ( iTab = idTabGeneral) Then
  118. Call ServeCommonJavaScript()
  119. End If
  120. ' Emit content for the requested tab
  121. Select Case iTab
  122. Case idTabGeneral
  123. Call ServeTabGeneral(PageIn, bIsVisible)
  124. Case idTabSiteID
  125. Call ServeTabSiteID(PageIn, bIsVisible)
  126. Case idTabAppSetting
  127. Call ServeTabAppSetting(PageIn, bIsVisible)
  128. Case Else
  129. SA_TraceOut "TEMPLAGE_TABBED", _
  130. "OnServeTabbedPropertyPage unrecognized tab id: " + _
  131. CStr(iTab)
  132. End Select
  133. OnServeTabbedPropertyPage = TRUE
  134. End Function
  135. '-------------------------------------------------------------------------
  136. ' Function: OnSubmitPage
  137. '
  138. ' Synopsis: Called when the page has been submitted for processing. Use
  139. ' this method to process the submit request.
  140. '
  141. ' Returns: TRUE if the submit was successful, FALSE to indicate error(s).
  142. ' Returning FALSE will cause the page to be served again using
  143. ' a call to OnServePropertyPage.
  144. '
  145. '-------------------------------------------------------------------------
  146. Public Function OnSubmitPage(ByRef PageIn, ByRef EventArg)
  147. OnSubmitPage = CreateSite()
  148. End Function
  149. '-------------------------------------------------------------------------
  150. ' Function: OnClosePage
  151. '
  152. ' Synopsis: Called when the page is about to be closed. Use this method
  153. ' to perform clean-up processing.
  154. '
  155. ' Returns: TRUE to allow close, FALSE to prevent close. Returning FALSE
  156. ' will result in a call to OnServePropertyPage.
  157. '
  158. '-------------------------------------------------------------------------
  159. Public Function OnClosePage(ByRef PageIn, ByRef EventArg)
  160. OnClosePage = TRUE
  161. End Function
  162. '=========================================================================
  163. ' Private Functions
  164. '=========================================================================
  165. '-------------------------------------------------------------------------
  166. 'Function name :ServeTabGeneral
  167. 'Description :Serves General tab
  168. 'Input Variables :PageIn, bIsVisible
  169. 'Output Variables :None
  170. 'Returns :Success(Return value)
  171. 'Global Variables :None
  172. '-------------------------------------------------------------------------
  173. Function ServeTabGeneral(ByRef PageIn, ByVal bIsVisible)
  174. If ( bIsVisible ) Then
  175. call GeneralViewTab()
  176. Else
  177. 'update hidden variables
  178. call GeneralHiddenTab()
  179. End If
  180. ServeTabGeneral = gc_ERR_SUCCESS
  181. End Function
  182. '-------------------------------------------------------------------------
  183. 'Function name :ServeTabSiteID
  184. 'Description :Serves the Site identities tab
  185. 'Input Variables :PageIn, bIsVisible
  186. 'Output Variables :None
  187. 'Returns :Success(Return value)
  188. 'Global Variables :None
  189. '-------------------------------------------------------------------------
  190. Function ServeTabSiteID(ByRef PageIn, ByVal bIsVisible)
  191. If ( bIsVisible ) Then
  192. call SiteIdentitiesViewTab()
  193. Else
  194. 'update hidden variables
  195. call SiteIdentitiesHiddenTab()
  196. End If
  197. ServeTabSiteID = gc_ERR_SUCCESS
  198. End Function
  199. '-------------------------------------------------------------------------
  200. 'Function name :ServeTabAppSetting
  201. 'Description :Serve the Application Settings tab
  202. 'Input Variables :PageIn, bIsVisible
  203. 'Output Variables :None
  204. 'Returns :Success(Return value)
  205. 'Global Variables :None
  206. '-------------------------------------------------------------------------
  207. Function ServeTabAppSetting(ByRef PageIn, ByVal bIsVisible)
  208. If ( bIsVisible ) Then
  209. call ApplicationSettingsViewTab()
  210. Else
  211. 'update hidden variables
  212. call ApplicationSettingsHiddenTab()
  213. end if
  214. ServeTabAppSetting = gc_ERR_SUCCESS
  215. End Function
  216. '-------------------------------------------------------------------------
  217. ' Function: ServeCommonJavaScript
  218. '
  219. ' Synopsis: Common javascript functions that are required by the Web
  220. ' Framework.
  221. '
  222. '------------------------------------------------------------------------
  223. Function ServeCommonJavaScript()
  224. Err.clear
  225. on Error Resume Next
  226. %>
  227. <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js">
  228. </script>
  229. <script language="JavaScript">
  230. //
  231. // Microsoft Server Appliance Web Framework Support Functions
  232. // Copyright (c) Microsoft Corporation. All rights reserved.
  233. //
  234. // Init Function
  235. // -----------
  236. // This function is called by the Property Page web framework to
  237. // allow the page to perform first time initialization.
  238. //
  239. // This function must be included or a javascript runtime error will
  240. // occur.
  241. function Init()
  242. {
  243. //Get the selected tab
  244. var temp = top.main.document.forms['frmTask'].TabSelected.value;
  245. switch(temp)
  246. {
  247. //for General prop
  248. case '0':
  249. GenInit();
  250. break;
  251. //for Site prop
  252. case '1':
  253. SiteInit();
  254. break;
  255. //for Appl prop
  256. case '2':
  257. ApplInit();
  258. break;
  259. }
  260. }
  261. // ValidatePage Function
  262. // ------------------
  263. // This function is called by the Property Page framework as part of
  264. // the submit processing. Use this function to validate user input.
  265. // Returning false will cause the submit to abort.
  266. //
  267. // This function must be included or a javascript runtime error will
  268. // occur.
  269. // Returns: True if the page is OK, false if error(s) exist.
  270. function ValidatePage()
  271. {
  272. //Get the selected tab
  273. var temp = top.main.document.forms['frmTask'].TabSelected.value;
  274. switch(temp)
  275. {
  276. //for general prop
  277. case '0':
  278. return GenValidatePage();
  279. break;
  280. //for Site prop
  281. case '1':
  282. return SiteValidatePage();
  283. break;
  284. //for Appl prop
  285. case '2':
  286. return ApplValidatePage();
  287. break;
  288. }
  289. }
  290. // SetData Function
  291. // --------------
  292. // This function is called by the Property Page framework and is called
  293. // only if ValidatePage returned a success (true) code. Typically you
  294. // would modify hidden form fields at this point.
  295. //
  296. // This function must be included or a javascript runtime error will
  297. // occur.
  298. function SetData()
  299. {
  300. //Get the selected tab
  301. var temp = top.main.document.forms['frmTask'].TabSelected.value;
  302. switch(temp)
  303. {
  304. //for general prop
  305. case '0':
  306. GenSetData();
  307. break;
  308. //for Site prop
  309. case '1':
  310. SiteSetData();
  311. break;
  312. //for Appl prop
  313. case '2':
  314. ApplSetData();
  315. break;
  316. }
  317. }
  318. </script>
  319. <%
  320. End Function
  321. '----------------------------------------------------------------------------
  322. 'Function name :CreateSite
  323. 'Description :Serves in Creating a New Web Site
  324. 'Input Variables :None
  325. 'Output Variables :None
  326. 'Returns :Boolean (True if new site is created else returns False)
  327. 'Global Variables :None
  328. 'Functions Used :blnValidateInputs
  329. ' HandleWrkgrpAndNTDC
  330. ' blnCreateWebSite
  331. ' blnSetDiskQuotas
  332. ' blnSetDACLEntry
  333. '----------------------------------------------------------------------------
  334. Function CreateSite()
  335. on error resume next
  336. Err.Clear
  337. Call SA_TraceOut(SA_GetScriptFileName(), "Entering CreateSite()")
  338. Dim objRoot 'holds root object
  339. Dim strUserName 'hold user name
  340. Dim WebName 'hold web name
  341. Dim strBool
  342. CreateSite = FALSE
  343. Call GetDomainRole( G_strDirRoot, G_strSysName )
  344. Call SA_TraceOut(SA_GetScriptFileName(), "System name: " + CStr(G_strSysName))
  345. Call SA_TraceOut(SA_GetScriptFileName(), "Directory root: " + CStr(G_strDirRoot))
  346. ' Bind to the root object
  347. If F_strAccountLocation = "1" Then
  348. Set objRoot = GetObject("WinNT://" & G_strSysName)
  349. Else
  350. Set objRoot = GetObject("WinNT://" & G_strDirRoot)
  351. End If
  352. If Err.number <> 0 Then
  353. Call SA_TraceOut(SA_GetScriptFileName(), "Error creating Root object, error: " + CStr(Hex(Err.Number)) + " " + Err.Description)
  354. Call SA_SetErrMsg(SA_GetLocString("Sitearea.dll", "C04201D4", Array("WinNT://" & G_strDirRoot)))
  355. Exit Function
  356. End if
  357. '
  358. ' If an existing account was specified then the account name needs to be
  359. ' in the form ComputerName\AccountName. If the user did not enter the name
  360. ' in this form, then correct the name to match this format.
  361. If ( F_strAccountLocation = "2" ) Then
  362. If ( InStr(F_strAdminName, "\") = 0 ) Then
  363. F_strAdminName = G_strSysName & "\" & F_strAdminName
  364. End If
  365. End If
  366. 'user and groups names to be created
  367. G_strAnonName = F_strSiteID & "_Anon"
  368. G_Browser_Grp = F_strSiteID & "_Browsers"
  369. G_Admin_Grp = F_strSiteID & "_Admins"
  370. G_Authors_Grp = F_strSiteID & "_Authors"
  371. '1) verify input datas
  372. if ( NOT blnValidateInputs()) then
  373. Call SA_TraceOut(SA_GetScriptFileName(), "Error in input parameters")
  374. Exit Function
  375. End If
  376. '2) Create site users and generate the anonymous user's pwd
  377. If ( NOT CreateSiteUsers(objRoot)) Then
  378. Call SA_TraceOut(SA_GetScriptFileName(), "CreateSiteUsers error: " + CStr(Hex(Err.Number)) + " " + Err.Description)
  379. Exit Function
  380. End If
  381. '3) Create Web site. Use the Admin and Anon users created above for this
  382. If( NOT blnCreateWebSite(F_strSiteID, _
  383. F_strIPAddr, _
  384. F_strPort, _
  385. F_strHeader, _
  386. F_strDir, _
  387. F_strchkAllow, _
  388. F_selectActiveFormat, _
  389. F_strAdminName, _
  390. F_strDefaultPageText)) then
  391. Call SA_TraceOut(SA_GetScriptFileName(), "CreateWebSite error: " + CStr(Hex(Err.Number)) + " " + Err.Description)
  392. ' If we did not use an existing user account then we need to
  393. ' delete the accounts we created (see CreateSiteUsers function).
  394. If (F_strAccountLocation <> "2") Then
  395. Call blnDeleteUser(objRoot, F_strAdminName)
  396. Call blnDeleteUser(objRoot, G_strAnonName)
  397. end if
  398. SA_ServeFailurePage L_CREATEFAIL_ERRORMESSAGE
  399. exit function
  400. end if 'create site
  401. '4)Config directory DACL
  402. If(NOT ConfigDirDACL(F_strDir, F_strAdminName)) Then
  403. Call SA_TraceOut(SA_GetScriptFileName(), "ConfigDirDACL error: "+ CStr(Hex(Err.Number)) + " " + Err.Description)
  404. Exit Function
  405. End If
  406. '6) config virtual FTP site
  407. If F_strUploadMethod = UPLOADMETHOD_FTP Then
  408. Dim objService
  409. Set objService = getWMIConnection(CONST_WMI_IIS_NAMESPACE)
  410. If (NOT CreateVirFTPSite(objService, F_strAdminName, F_strDir, True, True, True)) Then
  411. Call SA_TraceOut(SA_GetScriptFileName(), "CreateVirFTPSite error: "+ CStr(Hex(Err.Number)) + " " + Err.Description)
  412. SetErrMsg L_ERR_CREATE_VIR_FTP_SITE
  413. If ( Len(GetErrMsg()) <= 0 ) Then
  414. Call SA_SetErrMsg(GetLocString("sitearea.dll", "404201DC", ""))
  415. End If
  416. Exit Function
  417. End If
  418. Set objService = Nothing
  419. End If
  420. '7) Setting return URL
  421. WebName = GetWebSiteNo(F_strSiteID)
  422. Call SA_TraceOut(SA_GetScriptFileName(), "New WebSite ID: " + CStr(WebName))
  423. Call SA_MungeURL(mstrReturnURL, "PKey",WebName)
  424. Call SA_TraceOut(SA_GetScriptFileName(), "ReturnURL: " + mstrReturnURL)
  425. '5) Config Frontpage
  426. If( NOT ConfigFrontPage(F_strAdminName)) Then
  427. Call SA_TraceOut(SA_GetScriptFileName(), "ConfigFrontPage error: "+ CStr(Hex(Err.Number)) + " " + Err.Description)
  428. If ( Len(GetErrMsg()) <= 0 ) Then
  429. Call SA_SetErrMsg(L_ERR_FRONTPAGE_CONFIGURATION)
  430. End If
  431. Exit Function
  432. End If
  433. CreateSite = TRUE
  434. Call SA_TraceOut(SA_GetScriptFileName(), "CreateSite() return code: " + CStr(CreateSite))
  435. 'release objects
  436. 'Set objRoot = nothing
  437. end function
  438. '----------------------------------------------------------------------------
  439. 'Function name :CreateSiteUsers
  440. 'Description :Serves in create administrator users
  441. 'Input Variables :None
  442. 'Output Variables :None
  443. 'Returns :Boolean (True if new site is created else returns False)
  444. 'Global Variables :None
  445. 'Functions Used :
  446. '----------------------------------------------------------------------------
  447. Function CreateSiteUsers(ByRef objRoot)
  448. On Error Resume Next
  449. Err.Clear
  450. CreateSiteUsers = False
  451. 'creates necessary ou's, users and groups, cleansup if
  452. 'something fails
  453. If F_strAccountLocation = "1" then
  454. 'creates necessary users , cleansup if something fails
  455. if NOT HandleWrkgrpAndNTDC(objRoot) then
  456. exit function
  457. end if
  458. Elseif F_strAccountLocation = "2" Then
  459. 'valid the exist user and prompt the user when err
  460. Dim objComputer
  461. Dim oUser
  462. Dim arrId
  463. Dim strDomain
  464. Dim strUser
  465. arrId = split(F_strAdminName,"\")
  466. If ubound(arrId) <> 1 Then
  467. SetErrMsg L_ERR_ADMINISTRATOR_NAME
  468. Exit Function
  469. End If
  470. strDomain = arrId(0)
  471. strUser = arrId(1)
  472. set objComputer = GetObject("WinNT://" & strDomain)
  473. If Err.number <> 0 Then
  474. SetErrMsg SA_GetLocString("Sitearea.dll", _
  475. "C04201D4", _
  476. Array("WinNT://" & strDomain))
  477. Exit Function
  478. End if
  479. Set oUser = objComputer.GetObject("user" , trim(strUser))
  480. If Err.number <> 0 Then
  481. SetErrMsg L_ERR_ACCOUNT_NOT_FOUND
  482. Exit Function
  483. End if
  484. End If
  485. CreateSiteUsers = True
  486. End Function
  487. '----------------------------------------------------------------------------
  488. 'Function name :ConfigDirDACL
  489. 'Description :Serves in set permission of directory
  490. 'Input Variables :None
  491. 'Output Variables :None
  492. 'Returns :Boolean (True if new site is created else returns False)
  493. 'Global Variables :None
  494. 'Functions Used :
  495. '----------------------------------------------------------------------------
  496. Function ConfigDirDACL(strDir,strAdminName)
  497. On Error Resume Next
  498. Err.Clear
  499. ConfigDirDACL = False
  500. ' Set DACL entries for Anon and Admin users for Home Directory
  501. if (NOT SetDaclForRootDir(strDir,strAdminName)) then
  502. Call SA_SetErrMsg(L_DACL_ERRORMESSAGE)
  503. Call SA_TraceOut ("site_new", "Failed to set the DACL for root dir ")
  504. Exit Function
  505. end if
  506. ConfigDirDACL = True
  507. End Function
  508. '----------------------------------------------------------------------------
  509. 'Function name :ConfigFrontPage
  510. 'Description :Serves in config front page
  511. 'Input Variables :None
  512. 'Output Variables :None
  513. 'Returns :Boolean (True if new site is created else returns False)
  514. 'Global Variables :None
  515. 'Functions Used :
  516. '----------------------------------------------------------------------------
  517. Function ConfigFrontPage(strAdminName)
  518. On Error Resume Next
  519. Err.Clear
  520. Dim objService
  521. Dim strUserName
  522. Set objService = getWMIConnection(CONST_WMI_IIS_NAMESPACE)
  523. ConfigFrontPage = True
  524. '
  525. ' Configure FrontPage Server Extensions if they are installed and were
  526. ' selected by the user.
  527. '
  528. If ( TRUE = isFrontPageInstalled(objService) And _
  529. UPLOADMETHOD_FPSE = F_strUploadMethod) Then
  530. ConfigFrontPage = False
  531. '
  532. ' User name depends on account type
  533. select case F_strAccountLocation
  534. case "1"
  535. strUserName = G_strSysName & "\" & strAdminName
  536. case "2"
  537. strUserName = strAdminName
  538. case else
  539. Call SA_TraceOut(SA_GetScriptFileName(), "Function ConfigFrontPage encountered unexpected AccountLocation code: " + CStr(F_strAccountLocation))
  540. Exit Function
  541. end select
  542. ConfigFrontPage = UpdateFrontPage(True, G_strSiteName, strUserName)
  543. End If
  544. End Function
  545. '-------------------------------------------------------------------------
  546. 'Function name :HandleWrkgrpAndNTDC
  547. 'Description :Creates req users in case of Workgrp and NTDC scenario
  548. 'Input Variables :objRoot
  549. 'Output Variables :None
  550. 'Returns :boolean
  551. 'Global Variables :None
  552. '-------------------------------------------------------------------------
  553. Function HandleWrkgrpAndNTDC( objRoot )
  554. Err.Clear
  555. On Error Resume Next
  556. Dim objSAHelper
  557. Dim strPassword
  558. Dim bCreatingAnon
  559. HandleWrkgrpAndNTDC = FALSE
  560. 'If we are creating Anonymous account we need to set these properties to
  561. ' TRUE
  562. ' 1) Password Never Expires
  563. ' 2) User cannot change password
  564. bCreatingAnon = False
  565. ' Create Admin user first because it is used for setting site operator
  566. if ( Not blnCreateUser(objRoot, F_strAdminName, F_strAdminPswd, bCreatingAnon) ) then
  567. Exit Function
  568. End If
  569. Set objSAHelper = server.CreateObject("ServerAppliance.SAHelper")
  570. if Err.number <> 0 then
  571. Call SA_TraceOut ("site_new", "createobject for sahelper failed")
  572. exit function
  573. else
  574. strPassword = objSAHelper.GenerateRandomPassword(14)
  575. if Err.number <> 0 then
  576. Call SA_TraceOut ("site_new", "generate random password failed")
  577. Set objSAHelper = Nothing
  578. exit function
  579. end if
  580. end if
  581. Set objSAHelper = Nothing
  582. 'Create Anonymous user for setting anonymous user settings in the web
  583. 'site
  584. SA_traceOut "G_strAnonName:", G_strAnonName
  585. bCreatingAnon = True
  586. '
  587. 'Set the pwd of the anonymous user, it needs to be used when we set the webvirdir object.
  588. 'That's because of the IIS security change, which won't install sub-authenticator from
  589. 'installation.
  590. G_strAnonPwd = strPassword
  591. SA_TraceOut "G_strAnonPwd:", G_strAnonPwd
  592. if ( Not blnCreateUser(objRoot, G_strAnonName, strPassword, bCreatingAnon) ) then
  593. Call blnDeleteUser(objRoot, F_strAdminName)
  594. Exit Function
  595. End If
  596. HandleWrkgrpAndNTDC = TRUE
  597. End Function
  598. '-------------------------------------------------------------------------
  599. 'Function name :blnValidateInputs
  600. 'Description :Validate Site identifier, directory path and admin
  601. ' user
  602. 'Input Variables :
  603. 'Output Variables :None
  604. 'Returns :boolean
  605. 'Global Variables :None
  606. '-------------------------------------------------------------------------
  607. Function blnValidateInputs()
  608. Err.clear
  609. On Error Resume Next
  610. blnValidateInputs = FALSE
  611. Dim arrFullName
  612. '1) Check whether the site Identifier exists
  613. If F_strAccountLocation = "1" Then
  614. if isValidSiteIdentifier(F_strSiteID, F_strAdminName, G_strSysName, True) = false then
  615. mintTabSelected = 0
  616. SetErrMsg SA_GetLocString("Sitearea.dll", _
  617. "C04200C1", _
  618. Array(F_strSiteID))
  619. exit Function
  620. end if
  621. Elseif F_strAccountLocation = "2" Then
  622. if isValidSiteIdentifier(F_strSiteID, "", "", False) = false then
  623. mintTabSelected = 0
  624. SetErrMsg SA_GetLocString("Sitearea.dll", _
  625. "C04200C1", _
  626. Array(F_strSiteID))
  627. exit Function
  628. end if
  629. End If
  630. '2) validates the dir and create the dir if necessary
  631. if (NOT ValidateSitePath(F_strCreatePathChecked, F_strDir)) then
  632. exit function
  633. end if
  634. Call SA_TraceOut( "site_new", "validateinputs successful" )
  635. blnValidateInputs = true
  636. end function
  637. '-------------------------------------------------------------------------
  638. 'Function name :blnCreateUser
  639. 'Description :Function to create user
  640. 'Input Variables :objRoot, strUserName, strPassword
  641. 'Output Variables :None
  642. 'Returns :Boolean
  643. 'Global Variables :None
  644. '
  645. '-------------------------------------------------------------------------
  646. Function blnCreateUser(objRoot, strUserName, strPassword, bCreatingAnon)
  647. Dim objUser 'holds user object
  648. Dim flagPasswd
  649. Err.Clear
  650. On Error Resume Next
  651. blnCreateUser = false
  652. ' create Admin user in SAM
  653. Set objUser = objRoot.Create("user" , trim(strUserName))
  654. objUser.setPassword(trim(strPassword))
  655. objUser.FullName = strUserName
  656. objUser.Description = strUserName
  657. 'If we are creating Anonymous account we need to set these properties to
  658. ' TRUE
  659. ' 1) Password Never Expires
  660. ' 2) User cannot change password
  661. If bCreatingAnon Then
  662. flagPasswd = &H10040
  663. objUser.Put "userFlags", flagPasswd
  664. End If
  665. objUser.SetInfo()
  666. If Err.number <> 0 Then
  667. mintTabSelected = 0
  668. If Err.number = &H800708C5 Then
  669. SetErrMsg L_ERR_PASSWORD_POLICY
  670. Else
  671. SetErrMsg L_UNABLETOSET_PASSWORD_ERRORMESSAGE
  672. End If
  673. exit Function
  674. end if
  675. 'release objects
  676. set objUser = nothing
  677. SA_traceout "blncreateuser success: strUserName", strUserName
  678. blnCreateUser = true
  679. End function
  680. '-------------------------------------------------------------------------
  681. 'Function name :blnCreateWebSite
  682. 'Description :Creating new web site
  683. 'Input Variables :None
  684. 'Output Variables :None
  685. 'Returns :Boolean (True if new site is created else returns
  686. ' False)
  687. 'Global Variables :None
  688. '-------------------------------------------------------------------------
  689. Function blnCreateWebSite(strSiteID, _
  690. strIPAddr, _
  691. strPort, _
  692. strHeader, _
  693. strDir, _
  694. strchkAllow, _
  695. selectActiveFormat, _
  696. strAdminName, _
  697. strDefaultPageText)
  698. On Error Resume Next
  699. Err.Clear
  700. Dim objService 'holds WMI connection object
  701. Dim objMasterWeb 'holds MasterWeb Connection
  702. Dim instWeb 'holds intance web
  703. Dim retVal 'holds return value
  704. Dim arrBindings 'holds arraybinidngs object
  705. Dim nNewSiteNo 'holds new site number
  706. Dim strSiteNum 'holds new site name
  707. Dim objSetting 'holds WMI Connection object
  708. Dim bIIS 'Allow IIS control password
  709. Dim siteName
  710. Dim strAnonPropUserName,strAnonPropPwd
  711. 'strAnonPropPwd holds the pwd of the anon user created
  712. strAnonPropPwd = ""
  713. Call SA_TraceOut ("site_new", "In handle blnCreateWebSite function")
  714. blnCreateWebSite = FALSE
  715. nNewSiteNo = GetNewSiteNo()
  716. '
  717. ' Delete any existing FrontPage Extension configuration for this new web site. We need
  718. ' to do this because FPSE does not clean-up after itself when a site is deleted. If someone
  719. ' manually deletes a site using the IIS snap-in, FPSE configuration information is left in the REG
  720. ' and we need to clear that out so the previous setting do not interfere with this new site.
  721. siteName = "W3SVC/"+CStr(nNewSiteNo)
  722. Call SA_TraceOut(SA_GetScriptFileName(), "Calling UpdateFrontPage(false, " & siteName & ", " & strAdminName & ") to delete FPSE")
  723. Call UpdateFrontPage("false", siteName, strAdminName)
  724. 'Get ServerBindings Value
  725. arrBindings = array(GetBindings(strIPAddr, strPort, strHeader))
  726. Set objService = getWMIConnection(CONST_WMI_IIS_NAMESPACE)
  727. Set instWeb = objService.Get(GetIISWMIProviderClassName("IIs_WebService") & ".Name='W3SVC'")
  728. If Err.Number <> 0 Then
  729. SetErrMsg L_INFORMATION_ERRORMESSAGE
  730. Exit Function
  731. End If
  732. If IsIIS60Installed() Then
  733. ' In IIS 6.0 WMI, Create a new web site needs to call CreateNewSite
  734. ' and it takes ServerBinding object as input argument instead of using
  735. ' a array of strings for bindings
  736. Dim arrObjBindings(0)
  737. set arrObjBindings(0) = objService.Get("ServerBinding").SpawnInstance_
  738. arrObjBindings(0).Port = strPort
  739. arrObjBindings(0).IP = strIPAddr
  740. arrObjBindings(0).Hostname = strHeader
  741. ' Create the website thru 6.0 WMI provider
  742. instWeb.CreateNewSite strSiteID, arrObjBindings, strDir, nNewSiteNo
  743. Else
  744. retVal = instWeb.CreateNewServer(nNewSiteNo, strSiteID, arrBindings, strDir)
  745. End If
  746. If Err.Number <> 0 Then
  747. SetErrMsg L_CREATEFAIL_ERRORMESSAGE
  748. Exit Function
  749. End If
  750. instWeb.Put_(WBEMFLAG) ' register the object created
  751. If Err.Number <> 0 Then
  752. SetErrMsg L_UPDATEFAIL_ERRORMESSAGE
  753. Exit Function
  754. End If
  755. strSiteNum = instWeb.Name & "/" & nNewSiteNo
  756. ' Get the Internal Site Identifier of the created Web site
  757. G_strSiteName = strSiteNum
  758. '1) Set ServerID property for newly created site
  759. if MakeManagedSite(objService, strSiteNum,strSiteID) = false then
  760. SetErrMsg L_CRMANAGEDSITE_REGKEY_ERRORMESSAGE
  761. 'delete site and exit
  762. retVal = DeleteWebSite( objService, strSiteNum )
  763. Exit Function
  764. end if
  765. If F_strAccountLocation = "1" Then
  766. strAnonPropUserName=G_strAnonName
  767. 'Set the pwd to the generated pwd for anon user
  768. strAnonPropPwd = G_strAnonPwd
  769. Else ' (F_strAccountLocation = "2")
  770. strAnonPropUserName = G_AnonUserName
  771. End If
  772. bIIS = True
  773. if NOT SetAnonProp(objService, strSiteNum, strchkAllow, _
  774. strAnonPropUserName, strAnonPropPwd, bIIS) then
  775. retVal = DeleteWebSite( objService, strSiteNum )
  776. Exit Function
  777. end if
  778. '2) Create Site Operator
  779. if NOT blnCreateIISOperator(objService, strSiteNum,strAdminName) then
  780. retVal = DeleteWebSite( objService, strSiteNum )
  781. Call SA_TRACEOUT("blnCreateWebSite","Create Site Operator failed")
  782. Exit Function
  783. end if
  784. '3) Set Access Read properties for Site
  785. if selectActiveFormat = "" then
  786. Set objSetting =objService.Get(GetIISWMIProviderClassName("IIs_WebServiceSetting") & ".Name='W3SVC'")
  787. if objSetting.Name = "W3SVC" then
  788. if objSetting.AccessExecute = TRUE and _
  789. objSetting.AccessScript = TRUE then
  790. selectActiveFormat = 2
  791. elseif objSetting.AccessExecute = false and _
  792. objSetting.AccessScript = TRUE then
  793. selectActiveFormat = 1
  794. elseif objSetting.AccessExecute = false and _
  795. objSetting.AccessScript = false then
  796. selectActiveFormat =0
  797. elseif isnull(objSetting.AccessExecute) and _
  798. isnull(objSetting.AccessScript) then
  799. selectActiveFormat = 0
  800. end if
  801. end if
  802. 'Release the object
  803. set objSetting = nothing
  804. end if
  805. '4) Set execute perms for Site
  806. if NOT SetExecPerms(selectActiveFormat, objService, _
  807. strSiteNum) then
  808. retVal = DeleteWebSite( objService, strSiteNum )
  809. Exit Function
  810. end if
  811. '5) Set Access Read properties for Site
  812. if NOT SetApplRead( objService, strSiteNum) then
  813. retVal = DeleteWebSite( objService, strSiteNum )
  814. Exit Function
  815. end if
  816. '6) Set default web page
  817. if NOT SetWebDefaultPage( objService, strDefaultPageText, strSiteNum) then
  818. retVal = DeleteWebSite( objService, strSiteNum )
  819. Exit Function
  820. end if
  821. '7) Start the Website
  822. retVal = StartWebSite(objService, strSiteNum )
  823. 'next
  824. Call SA_TraceOut ( "site_new.asp", "blnCreateWebSite Suceesfull" )
  825. 'release objects
  826. set objService = nothing
  827. set objMasterWeb = nothing
  828. blnCreateWebSite = true
  829. End function
  830. '-------------------------------------------------------------------------
  831. 'Function name :SetDaclForRootDir
  832. 'Description :Sets the DACL for root dir
  833. 'Input Variables :None
  834. 'Output Variables :None
  835. 'Returns :Boolean
  836. 'Global Variables :F_strDir, G_strAnonName, F_strAdminName
  837. '-------------------------------------------------------------------------
  838. Function SetDaclForRootDir(byref strDir, strAdminName)
  839. On Error Resume Next
  840. Err.Clear
  841. SetDaclForRootDir = FALSE
  842. Dim objService 'to hold WMI connection object
  843. Dim strTemp 'to hold temp value
  844. Dim objSecSetting 'to hold security setting value
  845. Dim objSecDescriptor 'to hold security descriptor value
  846. Dim strPath 'to hold Path
  847. Dim objDACL 'to hold DACL value
  848. Dim objSiteAdminAce 'to hold site ACE
  849. Dim objAdminAce 'to hold Admine ace
  850. Dim objAnonAce 'to hold Anon ace
  851. Dim objAuthAce 'to hold Auth ace
  852. Dim objDomainAce 'to hold domain admin ace
  853. Dim retval 'holds return value
  854. Set objService = getWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  855. objService.security_.impersonationlevel = 3
  856. 'get the sec seting for file
  857. strPath = "Win32_LogicalFileSecuritySetting.Path='" & strDir & "'"
  858. set objSecSetting = objService.Get(strPath)
  859. if Err.number <> 0 then
  860. Call SA_TraceOut ("site_new", "Failed to get Sec object for dir ")
  861. exit function
  862. end if
  863. 'get the ace's for all req users
  864. If F_strAccountLocation = "1" Then
  865. '
  866. ' add access user to root dir
  867. '
  868. if NOT GetUserAce(objService, strAdminName , G_strSysName, _
  869. CONST_FULLCONROL, objSiteAdminAce ) then
  870. Call SA_TraceOut ("site_new", _
  871. "Failed to get ACE object for Site Admin user ")
  872. exit function
  873. end if
  874. if NOT GetUserAce(objService, G_strAnonName, G_strSysName, _
  875. CONST_READEXEC, objAnonAce ) then
  876. Call SA_TraceOut ( "site_new", _
  877. "Failed to get ACE object for Anon user ")
  878. exit function
  879. end if
  880. '
  881. ' add access group to root dir
  882. '
  883. if NOT GetGroupAce(objService, SA_GetAccount_Administrators() , GetComputerName(), _
  884. CONST_FULLCONROL, objAdminAce ) then
  885. Call SA_TraceOut ("site_new", _
  886. "Failed to get ACE object for Admin user")
  887. exit function
  888. end if
  889. Elseif F_strAccountLocation = "2" Then
  890. Dim arrId
  891. Dim strDomain
  892. Dim strUser
  893. arrId = split(F_strAdminName,"\")
  894. If ubound(arrId) <> 1 Then
  895. SetErrMsg L_ERR_ADMINISTRATOR_NAME
  896. Exit Function
  897. End If
  898. strDomain = arrId(0)
  899. strUser = arrId(1)
  900. 'add access users in the location
  901. if NOT GetUserAce(objService, strUser , strDomain, _
  902. CONST_FULLCONROL, objSiteAdminAce ) then
  903. Call SA_TraceOut ("site_new", _
  904. "Failed to get ACE object for Site Admin user ")
  905. exit function
  906. end if
  907. 'IUSR_hostname (anonymous username created by IIS)
  908. if NOT GetUserAce(objService, G_AnonUserName , G_strSysName, _
  909. CONST_READEXEC, objAnonAce ) then
  910. Call SA_TraceOut ("site_new", _
  911. "Failed to get ACE object for Admin user")
  912. exit function
  913. end if
  914. 'add access group in the location
  915. If ucase(strDomain) = ucase(G_strSysName) Then
  916. if NOT GetGroupAce(objService, SA_GetAccount_Administrators() , GetComputerName(), _
  917. CONST_FULLCONROL, objAdminAce ) then
  918. Call SA_TraceOut ("site_new", _
  919. "Failed to get ACE object for Admin user")
  920. exit function
  921. end if
  922. Else
  923. if NOT GetGroupAce(objService, SA_GetAccount_Administrators() , GetComputerName(), _
  924. CONST_FULLCONROL, objAdminAce ) then
  925. Call SA_TraceOut ("site_new", _
  926. "Failed to get ACE object for Admin user")
  927. exit function
  928. end if
  929. if NOT GetGroupAce(objService, "Domain Admins" , strDomain,_
  930. CONST_FULLCONROL, objDomainAce ) then
  931. Call SA_TraceOut ("site_new", _
  932. "Failed to get ACE object for Admin user")
  933. exit function
  934. end if
  935. End if
  936. End If
  937. Set objSecDescriptor = objService.Get("Win32_SecurityDescriptor").SpawnInstance_()
  938. if Err.Number <> 0 then
  939. Call SA_TraceOut ("site_new", _
  940. "Failed to get create the Win32_SecurityDescriptor object ")
  941. exit function
  942. end if
  943. objSecDescriptor.Properties_.Item("DACL") = Array()
  944. Set objDACL = objSecDescriptor.Properties_.Item("DACL")
  945. If F_strAccountLocation = "1" Then
  946. objDACL.Value(0) = objSiteAdminAce
  947. objDACL.Value(1) = objAdminAce
  948. objDACL.Value(2) = objAnonAce
  949. ElseIf F_strAccountLocation = "2" Then
  950. objDACL.Value(0) = objSiteAdminAce
  951. objDACL.Value(1) = objAdminAce
  952. objDACL.Value(2) = objAnonAce
  953. If Not IsEmpty(objDomainAce) Then
  954. objDACL.Value(3) = objDomainAce
  955. End If
  956. End If
  957. objSecDescriptor.Properties_.Item("ControlFlags") = 32772
  958. Set objSecDescriptor.Properties_.Item("Owner") = objSiteAdminAce.Trustee
  959. Err.Clear
  960. retval = objSecSetting.SetSecurityDescriptor( objSecDescriptor )
  961. if Err.number <> 0 then
  962. Call SA_TraceOut ( "site_new", _
  963. "Failed to set the Security Descriptor for Root dir ")
  964. exit function
  965. end if
  966. Call SA_TraceOut ("site_new", "In SetDaclForRootDir success" )
  967. SetDaclForRootDir = TRUE
  968. 'Release the objects
  969. set objService = nothing
  970. set objSecSetting = nothing
  971. set objSecDescriptor = nothing
  972. End function
  973. '-------------------------------------------------------------------------
  974. 'Function name :blnDeleteUser
  975. 'Description :Deletes users if site not created
  976. 'Input Variables :None
  977. 'Output Variables :None
  978. 'Returns :Boolean
  979. 'Global Variables :None
  980. '-------------------------------------------------------------------------
  981. Sub blnDeleteUser(objRoot, strUserName)
  982. On Error Resume Next
  983. Err.Clear
  984. Dim nretval 'to hold return value
  985. 'deletes the Anonymous User from the System
  986. nretval = objRoot.Delete("user" , strUserName)
  987. If Err.Number <> 0 Then
  988. Call SA_TraceOut ("site_new", L_CANNOTDELETE_CREATEDUSERS_ERRORMESSAGE )
  989. End If
  990. End Sub
  991. '-------------------------------------------------------------------------
  992. 'Function name :DeleteWebSite
  993. 'Description :Deletes the web site
  994. 'Input Variables :objService, strSiteNum
  995. 'Output Variables :None
  996. 'Returns :Boolean
  997. 'Global Variables :None
  998. '-------------------------------------------------------------------------
  999. Function DeleteWebSite( objService, strSiteNum )
  1000. On Error Resume Next
  1001. Err.Clear
  1002. Dim strObjPath 'holds site collection
  1003. Dim objWebSite 'holds instance of the site
  1004. DeleteWebSite = FALSE
  1005. strObjPath = GetIISWMIProviderClassName("IIs_WebServer") & ".Name=" & chr(34) & strSiteNum & chr(34)
  1006. Set objWebSite = objService.Get(strObjPath)
  1007. if Err.Number <> 0 then
  1008. Call SA_TraceOut("site_new","Unable to get the web server object ")
  1009. Exit Function
  1010. End If
  1011. 'delete the object
  1012. objWebSite.Delete_
  1013. if Err.Number <> 0 then
  1014. SA_TraceOut "site_new", "Unable to delete the web site "
  1015. Exit Function
  1016. End If
  1017. DeleteWebSite = TRUE
  1018. 'Release the object
  1019. set objWebSite = nothing
  1020. End Function
  1021. '-------------------------------------------------------------------------
  1022. 'Function name :blnCreateIISOperator
  1023. 'Description :creates operators for the site
  1024. 'Input Variables :objService, strSiteNum
  1025. 'Output Variables :None
  1026. 'Returns :Boolean
  1027. 'Global Variables :None
  1028. '-------------------------------------------------------------------------
  1029. Function blnCreateIISOperator(objService, strSiteNum,strAdminName)
  1030. On Error Resume Next
  1031. Err.Clear
  1032. Dim objACE 'holds ACE
  1033. Dim strQuery 'holds Query string
  1034. Dim objAdminACLInstanceSet 'holds Admin ACL instanceset
  1035. Dim objAdminACLInstance 'holds Admin ACL instance
  1036. blnCreateIISOperator = FALSE
  1037. strQuery= GetIISWMIProviderClassName("IIs_AdminACL") & ".Name='" & strSiteNum &"'"
  1038. set objAdminACLInstanceSet = objService.Get(strQuery)
  1039. if err.number<>0 then
  1040. 'note action req
  1041. SetErrMsg L_INFORMATION_ERRORMESSAGE
  1042. exit function
  1043. end if
  1044. set objACE = objService.Get(GetIISWMIProviderClassName("IIs_ACE")).SpawnInstance_()
  1045. if err.number <>0 then
  1046. SetErrMsg L_INFORMATION_ERRORMESSAGE
  1047. exit function
  1048. end if
  1049. objACE.Name = objAdminACLInstanceSet.Name
  1050. objACE.AccessMask = 11
  1051. objACE.AceFlags = 0
  1052. objACE.AceType = 0
  1053. objACE.Trustee = strAdminName
  1054. objACE.Put_(WBEMFLAG)
  1055. blnCreateIISOperator = TRUE
  1056. 'release objects
  1057. set objACE = nothing
  1058. set objAdminACLInstanceSet = nothing
  1059. End function
  1060. '-------------------------------------------------------------------------
  1061. 'Function name :ValidateSitePath
  1062. 'Description :Validate Directory path, creates if necessary
  1063. 'Input Variables :None
  1064. 'Output Variables :None
  1065. 'Returns :Boolean
  1066. 'Global Variables :None
  1067. '-------------------------------------------------------------------------
  1068. Function ValidateSitePath(strCreatePathChecked,strFormDir)
  1069. Err.Clear
  1070. on error resume next
  1071. Dim objFso 'holds FileSystem object
  1072. Dim strDir 'holds Director path
  1073. Dim strIndx 'holds index value
  1074. Dim strDriveName 'holds drive name
  1075. Dim strQuery 'holds Query string
  1076. Dim objService 'holds WMI Connection
  1077. Dim objDirList 'holds Virtualdirectory collection list
  1078. Dim objDir 'holds instance of Virtualdirectory list
  1079. Dim strParentDir 'holds parent directory path
  1080. Dim nRetVal 'holds return value
  1081. Dim strDirPath 'holds directory path
  1082. Dim strWinDirPath 'holds windows directory path
  1083. ValidateSitePath = false
  1084. Set objFso = server.CreateObject("Scripting.FileSystemObject")
  1085. if Err.number <> 0 then
  1086. SetErrMsg L_FILEINFORMATION_ERRORMESSAGE
  1087. exit function
  1088. end if
  1089. Call SA_TRACEOUT("ValidateSitePath", CStr(strCreatePathChecked))
  1090. if strCreatePathChecked <> "true" then
  1091. 'if folder does not exist, give error as folder does not exist
  1092. if objFso.FolderExists(strFormDir)=false then
  1093. SetErrMsg L_DIR_DOESNOT_EXIST_ERRMSG
  1094. exit function
  1095. end if
  1096. end if
  1097. Set objService = getWMIConnection(CONST_WMI_IIS_NAMESPACE)
  1098. strQuery = "select path from " & GetIISWMIProviderClassName("IIs_WebVirtualDirSetting")
  1099. set objDirList=objService.Execquery(strQuery)
  1100. if Err.number <> 0 then
  1101. SetErrMsg L_INFORMATION_ERRORMESSAGE
  1102. exit function
  1103. end if
  1104. 'truncate last '\' char
  1105. if Right( strFormDir, 1 ) = "\" then
  1106. strFormDir = Left(strFormDir, len(strFormDir) - 1)
  1107. end if
  1108. strParentDir = objFso.GetParentFolderName(strFormDir)
  1109. for each objDir in objDirList
  1110. if strComp(objDir.path, strFormDir, 0) = 0 OR _
  1111. strComp(objDir.path, strParentDir, 0) = 0 then
  1112. mintTabSelected = 0
  1113. SetErrMsg L_DIR_FOR_WEB_SITES_TEXT
  1114. exit function
  1115. end if
  1116. next
  1117. 'check whether the Dir entered is Windows dir
  1118. if len(objFso.GetSpecialFolder(0)) = len(strFormDir) then
  1119. strWinDirPath = objFso.GetSpecialFolder(0)
  1120. else
  1121. strWinDirPath = objFso.GetSpecialFolder(0) & "\"
  1122. end if
  1123. strDirPath = mid(strFormDir,1,len(strWinDirPath))
  1124. if StrComp(trim(strDirPath),strWinDirPath,1) = 0 then
  1125. SetErrMsg L_INVALID_DIR_PATH_ERRMSG
  1126. mintTabSelected = 0
  1127. exit Function
  1128. end if
  1129. nRetVal = CreateSitePath( objFso, strFormDir )
  1130. if nRetVal <> CONST_SUCCESS then
  1131. if nRetVal = CONST_INVALID_DRIVE then
  1132. SetErrMsg L_INVALID_DRIVE_ERRMSG
  1133. elseif nRetVal = CONST_NOTNTFS_DRIVE then
  1134. SetErrMsg L_NOT_NTFS_DRIVE_ERRMSG
  1135. else
  1136. SetErrMsg L_FAILED_CREATE_DIR_ERRMSG
  1137. end if
  1138. mintTabSelected = 0
  1139. exit Function
  1140. end if
  1141. 'release objects
  1142. set objFso = nothing
  1143. set objDirList = nothing
  1144. set objService = nothing
  1145. ValidateSitePath = true
  1146. end function
  1147. %>