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.

766 lines
28 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <%
  4. '-------------------------------------------------------------------------
  5. ' ftpsvc_prop.asp: Serves in changing the Default FTP site properties.
  6. ' Description: This page displays the default ftp site properties and
  7. ' allows to change the properties
  8. ' Copyright (c) Microsoft Corporation. All rights reserved.
  9. '
  10. ' Date Description
  11. ' 16 Feb 2001 Creation Date.
  12. '-------------------------------------------------------------------------
  13. %>
  14. <!-- #include virtual="/admin/inc_framework.asp" -->
  15. <!-- #include file="loc_ftpsvc.asp" -->
  16. <%
  17. '-------------------------------------------------------------------------
  18. ' Global Constants and Variables
  19. '-------------------------------------------------------------------------
  20. Dim rc 'Return value for CreatePage
  21. Dim page 'Variable that receives the output page object when
  22. 'creating a page
  23. Dim idTabLogging 'variable for Logging Tab
  24. Dim idTabAccess 'variable for Access Tab
  25. Dim idTabMessage 'variable for Message Tab
  26. Dim SOURCE_FILE 'To hold source file name
  27. SOURCE_FILE = SA_GetScriptFileName()
  28. const CONST_ENABLE_LOG = 1 'constant for setting logging properties
  29. const CONST_DEFAULT_FTP_PORT = 21
  30. '-------------------------------------------------------------------------
  31. ' Global Form Variables
  32. '-------------------------------------------------------------------------
  33. Dim F_strEnableAnonymous 'value of Enable Anonymous(true/false)
  34. Dim F_strEnableOnlyAnonymous 'value of Enable only Anonymous(true/false)
  35. Dim F_strEnableAnonymousStatus 'Enable anonymous status(Checked/Disabled)
  36. Dim F_strEnableOnlyAnonymousStatus 'Enable only anonymous status(Checked/Disabled)
  37. Dim F_strGreetingMessage 'Greeting Message
  38. Dim F_strExitMessage 'Exit Message
  39. Dim F_strEnableLogging 'Enable Logging
  40. ' Create a Tabbed Property Page
  41. rc = SA_CreatePage( L_TASKTITLE_TEXT, "", PT_TABBED, page )
  42. ' Add three tabs Logging,Anonymous Access and Messages
  43. rc = SA_AddTabPage( page, L_LOGGING_TEXT, idTabLogging)
  44. rc = SA_AddTabPage( page, L_ANONYMOUSACCESS_TEXT, idTabAccess)
  45. rc = SA_AddTabPage( page, L_MESSAGES_TEXT, idTabMessage)
  46. ' Show the page
  47. rc = SA_ShowPage( page )
  48. '---------------------------------------------------------------------
  49. 'Function: OnInitPage()
  50. 'Description: Called to signal first time processing for this page.
  51. 'Input Variables: PageIn,EventArg
  52. 'Output Variables: PageIn,EventArg
  53. 'Returns: True/False
  54. 'Global Variables: In:L_*-Localization Strings
  55. ' In:CONST_WMI_WIN32_NAMESPACE-const for
  56. ' default workspace in wmi
  57. '---------------------------------------------------------------------
  58. Public Function OnInitPage(ByRef PageIn, ByRef EventArg)
  59. Call SA_TraceOut(SOURCE_FILE,"OnInitPage")
  60. 'getting default ftp site properties
  61. Call GetLoggingProp() 'getting log properties
  62. Call GetAnonymousProp() 'getting Anonymous Properties and messages
  63. Call ServeDefaultFTPSiteProp()'Sets the Form option values
  64. OnInitPage = TRUE
  65. End Function
  66. '---------------------------------------------------------------------
  67. 'Function: OnPostBackPage()
  68. 'Description: Called to signal that the page has been posted-back.
  69. 'Input Variables: PageIn,EventArg
  70. 'Output Variables: PageIn,EventArg
  71. 'Returns: True/False
  72. 'Global Variables: F_(*)-Form variables
  73. '---------------------------------------------------------------------
  74. Public Function OnPostBackPage(ByRef PageIn, ByRef EventArg)
  75. Call SA_TraceOut( SOURCE_FILE, "OnPostBackPage")
  76. F_strEnableLogging = Request.form("chkEnableLogging")
  77. F_strEnableAnonymous = Request.form("chkEnableAnonymous")
  78. F_strEnableOnlyAnonymous = Request.form("chkEnableOnlyAnonymous")
  79. F_strEnableAnonymousStatus = Request.form("hdnEnableAnonymousStatus")
  80. F_strEnableOnlyAnonymousStatus= Request.form("hdnEnableOnlyAnonymousStatus")
  81. F_strGreetingMessage =Request.form("txaWelcomeMsg")
  82. F_strExitMessage =Request.form("txtExitMsg")
  83. 'Sets the Form option values
  84. Call ServeDefaultFTPSiteProp()
  85. OnPostBackPage = TRUE
  86. End Function
  87. '---------------------------------------------------------------------
  88. 'Function: OnServeTabbedPropertyPage()
  89. 'Description: Called when the content needs to send
  90. 'Input Variables: PageIn,EventArg,iTab,bIsVisible
  91. 'Output Variables: PageIn,EventArg
  92. 'Returns: True/False
  93. 'Global Variables: In:iTab-tab selected
  94. ' In:idTabLogging-variable for Logging Tab
  95. ' In:idTabAccess-variable for Access Tab
  96. ' In:idTabMessage-variable for Message Tab
  97. '---------------------------------------------------------------------
  98. Public Function OnServeTabbedPropertyPage(ByRef PageIn, _
  99. ByVal iTab, _
  100. ByVal bIsVisible, ByRef EventArg)
  101. Call SA_TraceOut( SOURCE_FILE, "OnServeTabbedPropertyPage")
  102. Const CONSTTABGENERAL=0
  103. Const CONSTTABACCESS=1
  104. Const CONSTTABMESSAGE=2
  105. '
  106. ' Emit Web Framework required functions
  107. If ( iTab = CONSTTABGENERAL or iTab = CONSTTABACCESS or iTab = CONSTTABMESSAGE) Then
  108. Call ServeCommonJavaScript()
  109. End If
  110. '
  111. ' Emit content for the requested tab
  112. Select Case iTab
  113. Case idTabLogging
  114. Call ServeTabLogging(PageIn, bIsVisible)
  115. Case idTabAccess
  116. Call ServeTabAccess(PageIn, bIsVisible)
  117. Case idTabMessage
  118. Call ServeTabMessage(PageIn, bIsVisible)
  119. Case Else
  120. Call SA_TraceOut(SOURCE_FILE,_
  121. "OnServeTabbedPropertyPage unrecognized tab id: " + CStr(iTab))
  122. End Select
  123. OnServeTabbedPropertyPage = TRUE
  124. End Function
  125. '---------------------------------------------------------------------
  126. 'Function: OnSubmitPage()
  127. 'Description: Called when the page has been submitted for processing.
  128. 'Input Variables: PageIn,EventArg
  129. 'Output Variables: PageIn,EventArg
  130. 'Returns: True/False
  131. 'Global Variables: None
  132. '---------------------------------------------------------------------
  133. Public Function OnSubmitPage(ByRef PageIn, ByRef EventArg)
  134. Call SA_TraceOut( SOURCE_FILE, "OnSubmitPage")
  135. 'setting the default ftp site properties
  136. OnSubmitPage = SetDefaultFTPSiteProp()
  137. End Function
  138. '---------------------------------------------------------------------
  139. 'Function: OnClosePage()
  140. 'Description: Called when the page is about closed.
  141. 'Input Variables: PageIn,EventArg
  142. 'Output Variables: None
  143. 'Returns: True/False
  144. 'Global Variables: None
  145. '---------------------------------------------------------------------
  146. Public Function OnClosePage(ByRef PageIn, ByRef EventArg)
  147. Call SA_TraceOut( SOURCE_FILE, "OnClosePage")
  148. OnClosePage = TRUE
  149. End Function
  150. '-------------------------------------------------------------------------
  151. 'Function: ServeTabLogging()
  152. 'Description: For displaying outputs HTML for Logging tab to the user
  153. 'Input Variables: PageIn,bIsVisible
  154. 'Output Variables: PageIn,bIsVisible
  155. 'Returns: SA_NO_ERROR
  156. 'Global Variables: None
  157. '-------------------------------------------------------------------------
  158. Function ServeTabLogging(ByRef PageIn, ByVal bIsVisible)
  159. Call SA_TraceOut( SOURCE_FILE, "ServeTabLogging")
  160. If ( bIsVisible ) Then
  161. 'displaying html content of the logging tab
  162. Call LogTabView()
  163. Else
  164. 'hidden variables for logging tab
  165. Call LogTabHidden()
  166. End If
  167. ServeTabLogging = SA_NO_ERROR
  168. End Function
  169. '-------------------------------------------------------------------------
  170. 'Function: ServeTabAccess()
  171. 'Description: For displaying outputs HTML for Access tab to the user
  172. 'Input Variables: PageIn,bIsVisible
  173. 'Output Variables: PageIn,bIsVisible
  174. 'Returns: SA_NO_ERROR
  175. 'Global Variables: None
  176. '-------------------------------------------------------------------------
  177. Function ServeTabAccess(ByRef PageIn, ByVal bIsVisible)
  178. Call SA_TraceOut( SOURCE_FILE, "ServeTabAccess")
  179. If ( bIsVisible ) Then
  180. 'displaying html content of the Access tab
  181. Call AccessTabView()
  182. Else
  183. 'hidden variables for access tab
  184. Call AccessTabHidden()
  185. End If
  186. ServeTabAccess = SA_NO_ERROR
  187. End Function
  188. '-------------------------------------------------------------------------
  189. 'Function: ServeTabMessage()
  190. 'Description: For displaying outputs HTML for Message tab to the user
  191. 'Input Variables: PageIn,bIsVisible
  192. 'Output Variables: None
  193. 'Returns: SA_NO_ERROR
  194. 'Global Variables: None
  195. '-------------------------------------------------------------------------
  196. Function ServeTabMessage(ByRef PageIn, ByVal bIsVisible)
  197. Call SA_TraceOut( SOURCE_FILE, "ServeTabMessage")
  198. If ( bIsVisible ) Then
  199. 'displaying html content of the Message tab
  200. Call MessageTabView()
  201. Else
  202. 'hidden variables for Message tab
  203. Call MessageTabHidden()
  204. End If
  205. ServeTabMessage = SA_NO_ERROR
  206. End Function
  207. '-------------------------------------------------------------------------
  208. 'Function: ServeCommonJavaScript
  209. 'Description: Serves in initializing the values,setting the form
  210. ' data and validating the form values
  211. 'Input Variables: None
  212. 'Output Variables: None
  213. 'Returns: None
  214. 'Global Variables: None
  215. '-------------------------------------------------------------------------
  216. Function ServeCommonJavaScript()
  217. Call SA_TraceOut( SOURCE_FILE, "ServeCommonJavaScript")
  218. %>
  219. <script language="JavaScript">
  220. var objForm = eval("document.frmTask")
  221. var intSelTab = objForm.TabSelected.value
  222. // Set the Intial Form load values
  223. function Init()
  224. {
  225. return true;
  226. }
  227. // ValidatePage Function
  228. // ------------------
  229. // This function is called by the Web Framework as part of the
  230. // submit processing.Returning false will cause the submit to abort.
  231. //
  232. // Returns: True if the page is OK, false if error(s) exist.
  233. function ValidatePage()
  234. {
  235. return true;
  236. }
  237. // SetData Function
  238. // --------------
  239. // This function is called by the Web Framework and is called
  240. // only if ValidatePage returned a success (true) code. Typically you would
  241. // modify hidden form fields at this point.
  242. //
  243. function SetData()
  244. {
  245. return true;
  246. }
  247. //Function to store values of Enable Logging checkbox
  248. function storeEnableLoggingVals()
  249. {
  250. var objForm = eval("document.frmTask")
  251. var objEnableLog = objForm.chkEnableLogging
  252. //if enable log checkbox is checked,enable logging
  253. if(objEnableLog.checked == true)
  254. objForm.chkEnableLogging.value = "true"
  255. else
  256. objForm.chkEnableLogging.value= "false"
  257. }
  258. //Function to store values of Enable Anonymous users checkboxes
  259. function storeAnonymousVals()
  260. {
  261. var objForm = eval("document.frmTask")
  262. var objAnon = objForm.chkEnableAnonymous
  263. var objOnlyAnon = objForm.chkEnableOnlyAnonymous
  264. var strChecked="CHECKED"
  265. var strDisabled="DISABLED"
  266. if(objAnon.checked ==true )
  267. {
  268. objOnlyAnon.disabled = false
  269. if(objOnlyAnon.checked == true)
  270. {
  271. objForm.chkEnableOnlyAnonymous.value = "true"
  272. objForm.hdnEnableOnlyAnonymousStatus.value = strChecked
  273. }
  274. else
  275. {
  276. objForm.chkEnableOnlyAnonymous.value ="false"
  277. objForm.hdnEnableOnlyAnonymousStatus.value =""
  278. }
  279. objForm.chkEnableAnonymous.value = "true"
  280. objForm.hdnEnableAnonymousStatus.value = strChecked
  281. }
  282. else
  283. {
  284. objOnlyAnon.disabled = true
  285. objForm.chkEnableAnonymous.value = "false"
  286. objForm.chkEnableOnlyAnonymous.value = "false"
  287. objForm.hdnEnableAnonymousStatus.value = ""
  288. objOnlyAnon.checked = false
  289. objForm.hdnEnableOnlyAnonymousStatus.value = strDisabled
  290. }
  291. }
  292. //To disable Enter and escape key actions when
  293. // the focus is in TextArea (Welcome and Exit Messages)
  294. function HandleKey(input)
  295. {
  296. if(input == "DISABLE")
  297. document.onkeypress = "";
  298. else
  299. document.onkeypress = HandleKeyPress;
  300. }
  301. </script>
  302. <%
  303. End Function
  304. '-------------------------------------------------------------------------
  305. 'Function: LogTabView
  306. 'Description: For displaying outputs HTML for Logging tab to the user
  307. 'Input Variables: None
  308. 'Output Variables: None
  309. 'Returns: None
  310. 'Global Variables: L_(*)-Localization Strings
  311. ' F_(*)-Form Varibales
  312. '-------------------------------------------------------------------------
  313. Function LogTabView()
  314. Call SA_TraceOut( SOURCE_FILE, "LogTabView")
  315. %>
  316. <TABLE WIDTH=300 VALIGN=middle ALIGN=left BORDER=0 CELLSPACING=0 CELLPADDING=2>
  317. <TR>
  318. <TD CLASS="TasksBody">
  319. <INPUT TYPE="CHECKBOX" CLASS="FormField" NAME ="chkEnableLogging" <%=F_strEnableLogging%> VALUE="<%=F_strEnableLogging%>" onClick="storeEnableLoggingVals()">
  320. <%=L_ENABLELOGGING_TEXT%>
  321. </TD>
  322. <TR>
  323. </TABLE>
  324. <%
  325. End Function
  326. '-------------------------------------------------------------------------
  327. 'Function: LogTabHidden
  328. 'Description: For passing hidden variables for maintaing
  329. ' the state between tabs
  330. 'Input Variables: None
  331. 'Output Variables: None
  332. 'Returns: None
  333. 'Global Variables: F_(*)-Form Varibales
  334. '-------------------------------------------------------------------------
  335. Function LogTabHidden()
  336. Call SA_TraceOut( SOURCE_FILE, "LogTabHidden")
  337. %>
  338. <INPUT TYPE="HIDDEN" NAME="chkEnableLogging" VALUE="<%=F_strEnableLogging%>">
  339. <%
  340. End Function
  341. '-------------------------------------------------------------------------
  342. 'Function: AccessTabView
  343. 'Description: For displaying outputs HTML for Access tab to the user
  344. 'Input Variables: None
  345. 'Output Variables: None
  346. 'Returns: None
  347. 'Global Variables: L_(*)-Localization Strings
  348. ' F_(*)-Form Varibales
  349. '-------------------------------------------------------------------------
  350. Function AccessTabView()
  351. Call SA_TraceOut( SOURCE_FILE, "AccessTabView")
  352. %>
  353. <TABLE WIDTH=300 VALIGN=middle ALIGN=left BORDER=0 CELLSPACING=0 CELLPADDING=2>
  354. <TR>
  355. <TD CLASS="TasksBody">
  356. <INPUT TYPE="CHECKBOX" NAME ="chkEnableAnonymous" <%=F_strEnableAnonymousStatus%> VALUE="<%=F_strEnableAnonymous%>" onClick="storeAnonymousVals()" CLASS="FormField">
  357. <%=L_ENABLEANONYMOUSACCESS_TEXT%>
  358. </TD>
  359. </TR>
  360. <TR>
  361. <TD CLASS="TasksBody">
  362. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  363. <INPUT TYPE="CHECKBOX" NAME ="chkEnableOnlyAnonymous" <%=F_strEnableOnlyAnonymousStatus%> VALUE="<%=F_strEnableOnlyAnonymous%>" onClick="storeAnonymousVals()" CLASS="FormField">
  364. <%=L_ALLOWONLYANONYMOUSACCESS_TEXT%>
  365. </TD>
  366. <TR>
  367. <INPUT TYPE="HIDDEN" NAME="hdnEnableAnonymousStatus" VALUE="<%=F_strEnableAnonymousStatus%>">
  368. <INPUT TYPE="HIDDEN" NAME="hdnEnableOnlyAnonymousStatus" VALUE="<%=F_strEnableOnlyAnonymousStatus%>">
  369. </TABLE>
  370. <%
  371. End Function
  372. '-------------------------------------------------------------------------
  373. 'Function: AccessTabHidden
  374. 'Description: For passing hidden variables for maintaing
  375. ' the state between tabs
  376. 'Input Variables: None
  377. 'Output Variables: None
  378. 'Returns: None
  379. 'Global Variables: F_(*)-Form Varibales
  380. '-------------------------------------------------------------------------
  381. Function AccessTabHidden()
  382. Call SA_TraceOut( SOURCE_FILE, "AccessTabHidden")
  383. %>
  384. <INPUT TYPE="HIDDEN" NAME="chkEnableAnonymous" VALUE="<%=F_strEnableAnonymous%>">
  385. <INPUT TYPE="HIDDEN" NAME="chkEnableOnlyAnonymous" VALUE="<%=F_strEnableOnlyAnonymous%>">
  386. <INPUT TYPE="HIDDEN" NAME="hdnEnableAnonymousStatus" VALUE="<%=F_strEnableAnonymousStatus%>">
  387. <INPUT TYPE="HIDDEN" NAME="hdnEnableOnlyAnonymousStatus" VALUE="<%=F_strEnableOnlyAnonymousStatus%>">
  388. <%
  389. End Function
  390. '-------------------------------------------------------------------------
  391. 'Function: MessageTabView
  392. 'Description: For displaying outputs HTML for Access tab to the user
  393. 'Input Variables: None
  394. 'Output Variables: None
  395. 'Returns: None
  396. 'Global Variables: L_(*)-Localization Strings
  397. ' F_(*)-Form Varibales
  398. '-------------------------------------------------------------------------
  399. Function MessageTabView()
  400. Call SA_TraceOut( SOURCE_FILE, "MessageTabView")
  401. %>
  402. <TABLE WIDTH=300 VALIGN=middle ALIGN=left BORDER=0 CELLSPACING=0 CELLPADDING=2>
  403. <TR>
  404. <TD CLASS="TasksBody">
  405. <%=L_WELCOMEMESSAGE_TEXT%> <BR>
  406. <TEXTAREA CLASS="TextArea" NAME="txaWelcomeMsg" ROWS=5 COLS=45 WRAP="off" onfocus=HandleKey("DISABLE") onblur=HandleKey("ENABLE")><%=server.HTMLEncode(F_strGreetingMessage)%></TEXTAREA>
  407. </TD>
  408. </TR>
  409. <TR>
  410. <TD CLASS="TasksBody">
  411. <%=L_EXITMESSAGE_TEXT%><BR>
  412. <INPUT TYPE="Text" NAME="txtExitMsg" ROWS=5 COLS=45 WRAP="off" onfocus=HandleKey("DISABLE") onblur=HandleKey("ENABLE") value="<%=server.HTMLEncode(F_strExitMessage)%>" size=60 CLASS="FormField">
  413. </TD>
  414. </TR>
  415. </TABLE>
  416. <%
  417. End Function
  418. '-------------------------------------------------------------------------
  419. 'Function: MessageTabHidden
  420. 'Description: For passing hidden variables for maintaing
  421. ' the state between tabs
  422. 'Input Variables: None
  423. 'Output Variables: None
  424. 'Returns: None
  425. 'Global Variables: F_(*)-Form Varibales
  426. '-------------------------------------------------------------------------
  427. Function MessageTabHidden()
  428. Call SA_TraceOut( SOURCE_FILE, "MessageTabHidden")
  429. %>
  430. <INPUT TYPE="HIDDEN" NAME="txaWelcomeMsg" VALUE="<%=F_strGreetingMessage%>">
  431. <INPUT TYPE="HIDDEN" NAME="txtExitMsg" VALUE="<%=F_strExitMessage%>">
  432. <%
  433. End Function
  434. '-------------------------------------------------------------------------
  435. 'Function: SetDefaultFTPSiteProp
  436. 'Desription: Sets the Default FTP site properties.
  437. 'Input Variables: None
  438. 'Output variables: True on succesful setting else False.
  439. 'Returns: True/False
  440. 'Global Variables: In: F_strEnableAnonymous -Enable Anonymous(true/false)
  441. ' In: F_strEnableOnlyAnonymous -Enable only Anonymous(true/false)
  442. ' In: F_strGreetingMessage -Greeting Message
  443. ' In: F_strExitMessage -Exit Message
  444. ' In: L_FAILEDTOGETSITEINSTANCE_ERRORMESSAGE
  445. ' In: L_FAILEDTOSETPROPERTIES_ERRORMESSAGE
  446. 'Sets default FTP site properties. On Error displays Error Message using ServeFailurePage
  447. 'Returns True on successfull updation else false.
  448. '-------------------------------------------------------------------------
  449. Function SetDefaultFTPSiteProp
  450. Err.Clear
  451. On error resume next
  452. Call SA_TraceOut( SOURCE_FILE, "SetDefaultFTPSiteProp")
  453. Dim objContainer 'to hold the instance of default ftp site object(adsi)
  454. Const CONSTCHECKED="CHECKED" 'const for value "Checked"
  455. Const CONSTTRUE="TRUE" 'const for value "true"
  456. Const CONSTDISABLE=0 'const for disabling the logging,
  457. 'allow anonymous and AnonymousOnly.
  458. Const CONSTALLOWANONYMOUS=-1
  459. ' ADSI call to get the default ftp site object
  460. Set objContainer = GetObject("IIS://" + GetComputerName() +"/"+ GetFtpDefaultSite)
  461. If Err.number <> 0 then
  462. Call SA_TraceOut( SOURCE_FILE, "Failed to get the adsi object instance-SetDefaultFTPSiteProp")
  463. Call SA_ServeFailurePage(L_FAILEDTOGETSITEINSTANCE_ERRORMESSAGE)
  464. SetDefaultFTPSiteProp=false
  465. Exit Function
  466. End IF
  467. 'set the logging property
  468. If Ucase(F_strEnableLogging)=Ucase(CONSTCHECKED) Then
  469. objContainer.LogType = CONST_ENABLE_LOG
  470. Else
  471. objContainer.LogType = CONSTDISABLE
  472. End If
  473. 'setting the anonymous properties
  474. If Ucase(F_strEnableAnonymous)=Ucase(CONSTTRUE) Then
  475. objContainer.AllowAnonymous=CONSTALLOWANONYMOUS
  476. Else
  477. objContainer.AllowAnonymous=CONSTDISABLE
  478. End If
  479. If Ucase(F_strEnableOnlyAnonymous)=Ucase(CONSTTRUE) Then
  480. objContainer.AnonymousOnly=CONSTALLOWANONYMOUS
  481. Else
  482. objContainer.AnonymousOnly=CONSTDISABLE
  483. End If
  484. 'setting the welcome and exit messages
  485. objContainer.ExitMessage = F_strExitMessage
  486. objContainer.GreetingMessage = array(F_strGreetingMessage)
  487. 'saving all properties values
  488. objContainer.SetInfo()
  489. If Err.number <> 0 then
  490. Call SA_TraceOut( SOURCE_FILE,_
  491. "Failed to set the default ftp site properties-SetDefaultFTPSiteProp")
  492. SetErrMsg L_FAILEDTOSETPROPERTIES_ERRORMESSAGE & " " & " (" & Hex(Err.Number) & ")"
  493. SetDefaultFTPSiteProp=false
  494. Exit Function
  495. End IF
  496. 'destroying dynamically created objects
  497. Set objContainer=Nothing
  498. SetDefaultFTPSiteProp=true
  499. End Function
  500. '-------------------------------------------------------------------------
  501. 'Function name: GetAnonymousProp
  502. 'Desription: gets the Default FTP site properties.
  503. 'Input Variables: None
  504. 'Output variables: None
  505. 'Returns: True/False
  506. 'Global Variables: Out: F_strEnableAnonymous -Enable Anonymous(true/false)
  507. ' Out: F_strEnableOnlyAnonymous -Enable only Anonymous(true/false)
  508. ' Out: F_strGreetingMessage -Greeting Message
  509. ' Out: F_strExitMessage -Exit Message
  510. ' In: L_FAILEDTOGETSITEINSTANCE_ERRORMESSAGE
  511. 'Gets Default FTP Site properties.On Error or if the sevice is not found then
  512. 'Display Error Message using ServeFailurePage
  513. '-------------------------------------------------------------------------
  514. Function GetAnonymousProp()
  515. Err.Clear
  516. On Error Resume Next
  517. Call SA_TraceOut( SOURCE_FILE, "GetAnonymousProp()")
  518. Dim objContainer 'to hold the instance of default ftp site object(adsi)
  519. Dim arrGreetMsg 'to hold the array default ftp site greeting message
  520. Dim nIndex 'to run the loop to get the greeting message
  521. Dim strGreetMsg 'to hold the default ftp site greeting message
  522. ' ADSI call to get the local computer object
  523. Set objContainer = GetObject("IIS://" + GetComputerName() +"/"+ GetFtpDefaultSite)
  524. If Err.number <> 0 then
  525. Call SA_TraceOut( SOURCE_FILE, "Failed to get the adsi object instance-GetAnonymousProp")
  526. Call SA_ServeFailurePage(L_FAILEDTOGETSITEINSTANCE_ERRORMESSAGE)
  527. GetAnonymousProp=false
  528. Exit Function
  529. End IF
  530. If objContainer.AllowAnonymous=-CONST_ENABLE_LOG Then
  531. F_strEnableAnonymous=True
  532. Else
  533. F_strEnableAnonymous=false
  534. End If
  535. If objContainer.AnonymousOnly=-CONST_ENABLE_LOG Then
  536. F_strEnableOnlyAnonymous=true
  537. Else
  538. F_strEnableOnlyAnonymous=false
  539. End If
  540. 'getting greeting message
  541. arrGreetMsg = objContainer.GreetingMessage
  542. If arrGreetMsg <> "" then
  543. For nIndex =0 to Ubound(arrGreetMsg)
  544. strGreetMsg = strGreetMsg & arrGreetMsg(nIndex)
  545. Next
  546. F_strGreetingMessage = strGreetMsg
  547. Else
  548. F_strGreetingMessage = ""
  549. End If
  550. F_strExitMessage = Trim(objContainer.ExitMessage)
  551. 'destroying dynamically created objects
  552. Set objContainer=Nothing
  553. GetAnonymousProp=true
  554. End Function
  555. '-------------------------------------------------------------------------
  556. 'Function name: GetLoggingProp
  557. 'Desription: gets the Default FTP site logging properties.
  558. 'Input Variables: None
  559. 'Output variables: None
  560. 'Returns: True/False
  561. 'Global Variables: Out: F_strEnableLogging -logging value
  562. ' In: L_(*)-Localization strings
  563. 'Gets default FTP site Service properties.On Error or if the sevice is not found then
  564. 'Display Error Message using ServeFailurePage
  565. '-------------------------------------------------------------------------
  566. Function GetLoggingProp()
  567. Err.Clear
  568. on Error Resume Next
  569. Call SA_TraceOut( SOURCE_FILE, "GetLoggingProp()")
  570. Dim objContainer 'to hold the instance of default ftp site object(adsi)
  571. ' ADSI call to get the local computer object
  572. Set objContainer = GetObject("IIS://" + GetComputerName() +"/"+ GetFtpDefaultSite)
  573. If Err.number <> 0 then
  574. Call SA_TraceOut( SOURCE_FILE, "Failed to get the adsi object instance-GetLoggingProp")
  575. Call SA_ServeFailurePage(L_FAILEDTOGETSITEINSTANCE_ERRORMESSAGE )
  576. GetLoggingProp=false
  577. Exit Function
  578. End IF
  579. If objContainer.logtype=CONST_ENABLE_LOG then
  580. F_strEnableLogging = true
  581. End If
  582. 'destroying dynamically created objects
  583. Set objContainer=Nothing
  584. GetLoggingProp=true
  585. End Function
  586. '-------------------------------------------------------------------------
  587. 'Function name: ServeDefaultFTPSiteProp
  588. 'Desription: Sets the Form option values
  589. 'Input Variables: None
  590. 'Output variables: None
  591. 'Returns: None
  592. 'Global Variables: In: F_strEnableAnonymous -Enable Anonymous(true/false)
  593. ' In: F_strEnableOnlyAnonymous -Enable only Anonymous(true/false)
  594. ' Out: F_strEnableAnonymousStatus -Enable anonymous status(Checked/Disabled)
  595. ' Out: F_strEnableOnlyAnonymousStatus - Enable only anonymous status(Checked/Disabled)
  596. '-------------------------------------------------------------------------
  597. Function ServeDefaultFTPSiteProp()
  598. Err.Clear
  599. On Error Resume Next
  600. Call SA_TraceOut( SOURCE_FILE, "ServeDefaultFTPSiteProp()")
  601. Const CONSTCHECKED="CHECKED" 'const for value "constant"
  602. Const CONSTDISABLED="DISABLED" 'const for value "disabled"
  603. Const CONSTTRUE="TRUE" 'const for value "true"
  604. If (Ucase(F_strEnableAnonymous) = Ucase(CONSTTRUE)) Then
  605. F_strEnableAnonymousStatus ="CHECKED"
  606. If Ucase(F_strEnableOnlyAnonymous) = Ucase(CONSTTRUE) Then
  607. F_strEnableOnlyAnonymousStatus =CONSTCHECKED
  608. Else
  609. F_strEnableOnlyAnonymousStatus =""
  610. End If
  611. Else
  612. F_strEnableAnonymousStatus =""
  613. F_strEnableOnlyAnonymousStatus =CONSTDISABLED
  614. End If
  615. If (Ucase(F_strEnableLogging) = Ucase(CONSTTRUE)) Then
  616. F_strEnableLogging = CONSTCHECKED
  617. End If
  618. End Function
  619. '-------------------------------------------------------------------------
  620. 'Function name: GetFtpDefaultSite
  621. 'Description: Get name of the Default ftp site
  622. 'Input Variables: G_objService
  623. 'Output Variables: None
  624. 'Returns: String-Ftpsite name
  625. 'Global Variables: In: L_*-Localization strings
  626. '-------------------------------------------------------------------------
  627. Function GetFtpDefaultSite()
  628. Err.Clear
  629. On Error Resume Next
  630. Call SA_TraceOut( SOURCE_FILE, "GetFtpDefaultSite()")
  631. Dim objContainer 'to hold the instance of default ftp site object(adsi)
  632. Dim objFtp 'to hold the instance of objcontainer
  633. Dim objService 'to hold the WMI connector
  634. Dim strQuery 'to hold the WMI query
  635. Set objService = getWMIConnection(CONST_WMI_IIS_NAMESPACE)
  636. 'form the query
  637. strQuery = "select * from " & GetIISWMIProviderClassName("IIs_FtpServerSetting")
  638. Set objContainer = objService.ExecQuery(strQuery)
  639. If Err.number <> 0 then
  640. Call SA_TraceOut( SOURCE_FILE, "Failed to get the WMI object instance-GetFtpDefaultSite")
  641. Call SA_ServeFailurePage(L_FAILEDTOGETSITEINSTANCE_ERRORMESSAGE)
  642. Exit Function
  643. End IF
  644. Dim arrTmp
  645. For each objFtp in objContainer
  646. If IsIIS60Installed() Then
  647. If CInt(objFtp.ServerBindings(0).Port) = CONST_DEFAULT_FTP_PORT Then
  648. GetFtpDefaultSite=objFtp.Name
  649. Exit For
  650. End If
  651. Else
  652. arrTmp = split(objFtp.ServerBindings(0), ":")
  653. If CInt(arrTmp(1)) = CONST_DEFAULT_FTP_PORT Then
  654. GetFtpDefaultSite=objFtp.Name
  655. Exit for
  656. End If
  657. End If
  658. Next
  659. 'destroying dynamically created objects
  660. Set objContainer = Nothing
  661. End Function
  662. %>