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.

650 lines
23 KiB

  1. <% '-------------------------------------------------------------------------
  2. ' sharecifs_new.asp: Create a CIFS share.
  3. '
  4. ' Copyright (c) Microsoft Corporation. All rights reserved.
  5. '
  6. ' Date Description
  7. ' 17 Nov 2001 Creation Date.
  8. ' 9 March 2001 Modified Date.
  9. '-------------------------------------------------------------------------
  10. %>
  11. <%
  12. '-------------------------------------------------------------------------
  13. 'Form Variables
  14. '-------------------------------------------------------------------------
  15. Dim F_strUserlimitcheck_y 'Allow users radio status value
  16. Dim F_strUserlimitcheck_n 'Allow users radio status value
  17. Dim F_nUserLimit 'Allow User Limit value
  18. Dim F_strUservaluedisable 'Allow user textbox status value
  19. Dim F_strCachinglimitcheck 'Folder caching checkbox status value
  20. Dim F_strLocalUsers 'All local users and groups
  21. Dim F_nCacheOption 'value of the folder cache option
  22. Dim F_UserAccessMaskMaster '* seperated string having access control list of user
  23. Dim F_flagDisable 'Form controls status value used for Hidden shares
  24. Dim F_strPermittedMembers 'Currently selected users and groups
  25. Dim F_strAllowUsersData ', seperated string of allowuser flag and value
  26. Dim F_strComment 'cifs comment
  27. F_strUserlimitcheck_y = "CHECKED"
  28. F_strUserlimitcheck_n = ""
  29. F_nUserLimit = 0
  30. F_strUservaluedisable = "DISABLED"
  31. F_strCachinglimitcheck = "CHECKED"
  32. F_nCacheOption = "0"
  33. F_UserAccessMaskMaster =""
  34. F_strPermittedMembers =""
  35. F_strAllowUsersData =""
  36. '-------------------------------------------------------------------------
  37. 'Global Variables
  38. '-------------------------------------------------------------------------
  39. Dim G_objService 'object to WMI service
  40. Dim G_strLocalmachinename 'Local machine name
  41. Dim G_strTemp 'Allow user temp array
  42. set G_objService = getWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  43. G_strLocalmachinename = GetComputerName()
  44. %>
  45. <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js"></script>
  46. <script language="JavaScript" >
  47. // Set the initial form values
  48. function CIFSInit()
  49. {
  50. var objForm
  51. var nCachevalue
  52. objForm = eval("document.frmTask")
  53. //If Domain member listbox is empty then disable listbox add button
  54. if(objForm.lstDomainMembers.length != 0 )
  55. {
  56. objForm.lstDomainMembers.options[0].selected = true;
  57. objForm.btnAddMember.disabled = false;
  58. }
  59. else
  60. {
  61. objForm.btnRemoveMember.disabled = true;
  62. objForm.btnAddMember.disabled = true;
  63. }
  64. /*If selected member listbox is not empty then
  65. select first member else disable remove button and enable add button*/
  66. if(objForm.lstPermittedMembers.length != 0 )
  67. {
  68. objForm.btnAddMember.disabled = false;
  69. objForm.lstPermittedMembers.options[0].selected=true;
  70. setUsermask('<%=G_strLocalmachinename%>');
  71. }
  72. else
  73. {
  74. objForm.btnRemoveMember.disabled = true;
  75. objForm.btnAddMember.disabled = false;
  76. }
  77. //Disable Add button until a charecter is pressed
  78. disableAddButton(document.frmTask.txtDomainUser,document.frmTask.btnAddDomainMember)
  79. //select the folder cache option
  80. nCachevalue = objForm.hdnCacheValue.value;
  81. switch(parseInt(nCachevalue))
  82. {
  83. case 16:
  84. objForm.lstCacheOptions.options[1].selected =true;
  85. break;
  86. case 32:
  87. objForm.lstCacheOptions.options[2].selected =true;
  88. break;
  89. case 48:
  90. objForm.lstCacheOptions.disabled =true;
  91. objForm.chkAllowCaching.checked = false;
  92. break;
  93. default :
  94. objForm.lstCacheOptions.options[0].selected =true;
  95. break;
  96. }
  97. // checks for the default folder cache value
  98. EnableorDisableCacheProp(objForm.chkAllowCaching);
  99. }// end of function Init()
  100. // Validate the page form values
  101. function CIFSValidatePage()
  102. {
  103. var objForm
  104. objForm = eval("document.frmTask")
  105. //Throw Error on zero or null user entry in allow user textbox
  106. if(getRadioButtonValue(objForm.radAllowUserlimit) == "n" )
  107. {
  108. if (IsAllSpaces(objForm.txtAllowUserValue.value))
  109. {
  110. DisplayErr("<% =Server.HTMLEncode(SA_EscapeQuotes(L_NOSPACES_ERRORMESSAGE)) %>");
  111. return false;
  112. }
  113. if (objForm.txtAllowUserValue.value == 0)
  114. {
  115. DisplayErr("<% =Server.HTMLEncode(SA_EscapeQuotes(L_ZEROUSERS_ERRORMESSAGE))%>");
  116. return false;
  117. }
  118. }
  119. UpdateHiddenVariables()
  120. return true;
  121. }
  122. //Function to update hidden varibales
  123. function CIFSSetData()
  124. {
  125. UpdateHiddenVariables()
  126. }
  127. //Function to set the hidden varibales to be sent to the server
  128. function UpdateHiddenVariables()
  129. {
  130. var objForm
  131. var strCurrentusers
  132. var intCurrentMembersLength
  133. var strAllowUsersData
  134. strCurrentusers =""
  135. document.frmTask.hdnComment.value=document.frmTask.txtComment.value
  136. objForm = eval("document.frmTask")
  137. intCurrentMembersLength = objForm.lstPermittedMembers.length;
  138. for(var i=0 ; i < intCurrentMembersLength; i++)
  139. {
  140. strCurrentusers = strCurrentusers + String.fromCharCode(1) +
  141. objForm.lstPermittedMembers[i].value + String.fromCharCode(2)+ objForm.lstPermittedMembers[i].text
  142. }
  143. document.frmTask.hdnCurrentUsers.value=strCurrentusers;
  144. if(getRadioButtonValue(objForm.radAllowUserlimit) == "n" )
  145. strAllowUsersData = "n" + "," + objForm.txtAllowUserValue.value;
  146. else
  147. strAllowUsersData = "y" + ",";
  148. objForm.hdnAllowUsers.value = strAllowUsersData;
  149. //if cache options unchecked
  150. if(objForm.chkAllowCaching.checked == false)
  151. {
  152. objForm.hdnCacheValue.value = "48"
  153. }
  154. }
  155. //To check for Invalid Characters
  156. function checkKeyforValidCharacters(strName)
  157. {
  158. var nLength = strName.length;
  159. for(var i=0; i<nLength;i++)
  160. {
  161. var charAtPos = strName.charCodeAt(i);
  162. if(charAtPos == 47 || charAtPos ==58 || charAtPos == 42 || charAtPos == 63 || charAtPos == 34 || charAtPos == 60 || charAtPos == 62 || charAtPos == 124 || charAtPos == 91 || charAtPos == 93 || charAtPos == 59 || charAtPos == 43 || charAtPos == 61 || charAtPos == 44 )
  163. {
  164. return false
  165. }
  166. }
  167. return true
  168. }
  169. </script>
  170. <% '-------------------------------------------------------------------------
  171. ' Function name: ServeCIFSPage
  172. ' Description: Serves in displaying the page Header,Middle,Bottom Parts.
  173. ' Input Variables: None.
  174. ' Output Variables: None
  175. ' Return Values: None.
  176. '-------------------------------------------------------------------------
  177. Function ServeCIFSPage
  178. %> <table valign="middle" align="left" border="0" cellspacing="0" cellpadding="2" >
  179. <tr>
  180. <td colspan=4 class="TasksBody">
  181. <table>
  182. <tr>
  183. <td class="TasksBody">
  184. <%=L_COMMENT_TEXT%>
  185. </td>
  186. <td class="TasksBody">
  187. &nbsp;&nbsp;&nbsp;<input type="text" name="txtComment" class="FormField" Maxlength="256" value="<%=Server.HTMLEncode(UnescapeChars(ReplaceSubString(F_strComment,"\u0022", """")))%>" size=53>
  188. </td>
  189. </tr>
  190. <tr>
  191. <td class="TasksBody">
  192. <%=L_USERLIMIT_TEXT%>
  193. </td>
  194. <td class="TasksBody">
  195. &nbsp;&nbsp;<input name="radAllowUserlimit" type="radio" class="FormRadioButton" value= "y" tabindex="1" <%=F_strUserlimitcheck_y%> OnClick ="javascript:allowUserValueEdit(this)" >&nbsp;<%=L_MAXIMUMALLOWED_TEXT%>
  196. </td>
  197. </tr>
  198. <tr>
  199. <td class="TasksBody">
  200. &nbsp;
  201. </td>
  202. <td class="TasksBody" align="left">
  203. &nbsp;&nbsp;<input name="radAllowUserlimit" type="radio" class="FormRadioButton" value= "n" <%=F_strUserlimitcheck_n%>
  204. OnClick ="javascript:allowUserValueEdit(this)">&nbsp;<%=L_ALLOW_TEXT%>
  205. <input name="txtAllowUserValue" type="text" class ="FormField" value="<% = F_nUserLimit %>" style="WIDTH=50px"<% =F_strUservaluedisable %> tabindex="2"
  206. OnKeyUP="javaScript:checkUserLimit(this)" OnKeypress="javaScript:checkkeyforNumbers(this)">
  207. </td>
  208. </tr>
  209. </table>
  210. </td>
  211. </tr>
  212. <tr>
  213. <td class="TasksBody" colspan="4">
  214. <input name="chkAllowCaching" type="checkbox" class="FormCheckBox" <%=F_strCachinglimitcheck%> OnClick="EnableorDisableCacheProp(this)" >
  215. <%=L_ALLOWCACHING_TEXT %>
  216. <br>
  217. <br>
  218. <%=L_SETTING_TEXT%> &nbsp;&nbsp;
  219. <select rows="1" name="lstCacheOptions" class ="FormField" onChange="storeCacheProp()">
  220. <option value="0" selected> <%=L_MANUALCACHEDOCS_TEXT%> </option>
  221. <option value="16"> <%=L_AUTOCACHEDOCS_TEXT %> </option>
  222. <option value="32"> <%=L_AUTOCACHEPROGS_TEXT %> </option>
  223. </select>
  224. <br>
  225. <br>
  226. </td>
  227. </tr>
  228. <tr>
  229. <td class="TasksBody" colspan="4">
  230. <table valign="middle" align="left" border="0" cellspacing="0" cellpadding="2">
  231. <tr>
  232. <td class="TasksBody">
  233. <%=L_PERMISSIONS_TEXT%>
  234. </td>
  235. <td class="TasksBody" align="left">
  236. <%=L_ALLOWPROMPT_TEXT%>
  237. </td>
  238. <td class="TasksBody" align="left">
  239. <%=L_DENYPROMPT_TEXT%>
  240. </td>
  241. </tr>
  242. <tr>
  243. <td class="TasksBody">
  244. <select size="11" name="lstPermittedMembers" class="FormField" onChange="setUsermask('<%=G_strLocalmachinename%>')">
  245. <%
  246. ServetoListBox(F_strPermittedMembers)
  247. %>
  248. </select>
  249. </td>
  250. <td valign="top" align="center" class="TasksBody">
  251. <select name="lstAllowpermissions" size="1" class="FormField" onChange="JavaScript: setAllowaccess('<%=G_strLocalmachinename%>',lstPermittedMembers)" tabindex="6" <% =F_flagDisable%> >
  252. <option value="4"> <%=L_FULLCONTROL_TEXT%> </option>
  253. <option value="3"> <%=L_CHANGE_TEXT %> </option>
  254. <option value="2"> <%=L_READ_TEXT %> </option>
  255. <option value="1"> <%=L_CHANGEREAD_TEXT %> </option>
  256. <option value="0"> <%=L_NONE_TEXT %> </option>
  257. </select>
  258. <br>
  259. <br>
  260. <%
  261. Call SA_ServeOnClickButtonEx(L_CIFS_ADD_TEXT, "", "addDomainMember(document.frmTask.txtDomainUser)", 60, 0, F_flagDisable, "btnAddDomainMember")
  262. %>
  263. <br>
  264. <br>
  265. <%
  266. Call SA_ServeOnClickButtonEx(L_CIFS_ADD_TEXT, "", "addMember()", 60, 0, F_flagDisable, "btnAddMember")
  267. %>
  268. <br>
  269. <br>
  270. <%
  271. Call SA_ServeOnClickButtonEx(L_CIFS_REMOVE_TEXT, "", "removeMember()", 60, 0, F_flagDisable, "btnRemoveMember")
  272. %>
  273. </td>
  274. <td class="TasksBody" valign="top">
  275. <select name="lstDenypermissions" size="1" class="FormField" onChange="JavaScript: setDenyaccess('<%=G_strLocalmachinename%>',lstPermittedMembers)" tabindex="7" <% =F_flagDisable%> >
  276. <option value="4"> <%=L_FULLCONTROL_TEXT%> </option>
  277. <option value="3"> <%=L_CHANGE_TEXT %> </option>
  278. <option value="2"> <%=L_READ_TEXT %> </option>
  279. <option value="1"> <%=L_CHANGEREAD_TEXT %> </option>
  280. <option value="0"> <%=L_NONE_TEXT %> </option>
  281. </select>
  282. <br>
  283. <br>
  284. <%=L_CIFSADDUSERORGROUP_TEXT %>
  285. <br>
  286. <input type="text" class="FormField" style="WIDTH:150px" name="txtDomainUser" onKeyUP ="disableAddButton(this,document.frmTask.btnAddDomainMember)">
  287. <br>
  288. <select multiple class ="FormField" size="5" name="lstDomainMembers" >
  289. <%
  290. ServetoListBox(F_strLocalUsers)
  291. %>
  292. </select>
  293. </td>
  294. </tr>
  295. </table>
  296. </td>
  297. </tr>
  298. <tr>
  299. <td class="TasksBody" colspan="4">
  300. <%=L_ADDUSERHELP_TEXT%>
  301. </td>
  302. </tr>
  303. </table>
  304. <%
  305. Call ServeCIFSHiddenValues
  306. End Function
  307. '-------------------------------------------------------------------------
  308. ' Function name: CIFSOnPostBackPage
  309. ' Description: Serves in getting the values from previous form
  310. ' Input Variables: None.
  311. ' Output Variables: None
  312. ' Return Values: None
  313. ' Global Variables: Out: F_strPermittedMembers - Currently selected users
  314. ' and groups
  315. ' Out: F_UserAccessMaskMaster - * seperated string
  316. ' having access control list of user
  317. ' Out: F_nCacheOption -value of the folder cache option
  318. ' Out: F_strAllowUsersData - , seperated string of
  319. ' allowuser flag and value
  320. ' Out: F_flagDisable -Form controls status value
  321. ' Out: F_strComment - Share description
  322. ' Out: G_strTemp -Allow user temp array
  323. ' in: G_objService - object to WMI service
  324. '-------------------------------------------------------------------------
  325. Function CIFSOnPostBackPage
  326. Err.Clear
  327. On Error Resume Next
  328. F_strComment = Request.Form ("hdnComment")
  329. F_strPermittedMembers = Request.Form ("hdnCurrentUsers")
  330. F_UserAccessMaskMaster = Request.Form ("hdnUserAccessMaskMaster")
  331. F_nCacheOption = Request.Form ("hdnCacheValue")
  332. F_strAllowUsersData = Request.Form ("hdnAllowUsers")
  333. F_strLocalUsers = getLocalUsersList(G_objService)
  334. F_strLocalUsers = F_strLocalUsers & Getbuiltingroups(G_objService)
  335. F_strLocalUsers = F_strLocalUsers & getGroups(G_objService,G_strLocalmachinename)
  336. 'added for coment updation
  337. F_strComment = F_strNewDescription
  338. F_strShareName = F_strNewSharename
  339. F_strSharePath = F_strNewSharePath
  340. G_strTemp = split(F_strAllowUsersData,",")
  341. if G_strTemp(0) = "n" then
  342. checkradio G_strTemp(1),"n"
  343. else
  344. checkradio "","y"
  345. end if
  346. End Function
  347. '-------------------------------------------------------------------------
  348. ' Function name: CIFSOnInitPage
  349. ' Description: Serves in getting the values from system
  350. ' Input Variables: None.
  351. ' Output Variables: None
  352. ' Return Values: None
  353. ' Global Variables: Out: F_strPermittedMembers - Currently selected users
  354. ' and groups
  355. ' Out: F_UserAccessMaskMaster - * seperated string
  356. ' having access control list of user
  357. ' Out: F_nCacheOption -value of the folder cache option
  358. ' Out: F_strAllowUsersData - , seperated string of
  359. ' allowuser flag and value
  360. ' Out: F_flagDisable -Form controls status value
  361. ' Out: F_strComment - Share description
  362. ' in: G_objService - object to WMI service
  363. '-------------------------------------------------------------------------
  364. Function CIFSOnInitPage
  365. Err.Clear
  366. On Error Resume Next
  367. F_strLocalUsers = getLocalUsersList(G_objService)
  368. F_strLocalUsers = F_strLocalUsers & Getbuiltingroups(G_objService)
  369. F_strLocalUsers = F_strLocalUsers & getGroups(G_objService,G_strLocalmachinename)
  370. F_strShareName = F_strNewSharename
  371. F_strSharePath = F_strNewSharePath
  372. Dim sEveryone
  373. sEveryone = SA_GetAccount_Everyone()
  374. F_strPermittedMembers = chr(1)& sEveryone & chr(2)& sEveryone
  375. F_UserAccessMaskMaster ="*" & "" &"," & sEveryone & "," & 2032127 &","& 0 & "," & "a"
  376. If instr(F_strSharesChecked,"W") > 0 Then
  377. F_nCacheOption = getShareCacheProp(F_strShareName)
  378. getCIFSshareProp()
  379. End if
  380. End Function
  381. '-------------------------------------------------------------------------
  382. ' Function name: SetCIFSshareProp
  383. ' Description: To set the sharedescritpion,maximum allowed users ,
  384. ' users and their allowed permissions of the given share
  385. ' Input Variables: None.
  386. ' Output Variables: None
  387. ' Return Values: True on sucess, False on error (and error msg
  388. ' will be set by SA_SetErrMsg)
  389. ' Global Variables: in: F_strShareName -CIFS share name
  390. ' in: F_UserAccessMaskMaster - * seperated string having access control list of user
  391. ' in: F_nCacheOption -value of the folder cache option
  392. ' in: F_strAllowUsersData - , seperated string of allowuser flag and value
  393. ' in: F_flagDisable -Form controls status value used for Hidden shares
  394. ' in: F_strComment - Share description
  395. ' in: G_objService - object to WMI service
  396. ' in: L_SHARENAMENOTFOUND_ERRORMESSAGE
  397. ' in: L_FAILEDTOSETSHAREINFO_ERRORMESSAGE
  398. ' Updates system with CIFS properties as given by F_UserAccessMaskMaster. If an error
  399. ' occurs, sets error message with SA_SetErrMsg and exits with False.
  400. '-------------------------------------------------------------------------
  401. function SetCIFSshareProp()
  402. Err.Clear
  403. On Error resume next
  404. Dim objShareInstance
  405. Dim objclass
  406. Dim objSecDescriptor
  407. Dim nRetVal
  408. Dim strDomain
  409. Dim strUser
  410. Dim strAccess
  411. Dim strAce
  412. Dim i
  413. Dim objACE
  414. Dim objTrustee
  415. Dim arrSubAccessMask
  416. DIm arrShareItem
  417. Dim arrUserSID
  418. Dim objDACL
  419. Dim strWMIPath
  420. Dim sEveryone
  421. sEveryone = SA_GetAccount_Everyone()
  422. 'Setting the User EVERYONE deny FullControl Accessmask
  423. If (F_UserAccessMaskMaster = "") then
  424. F_UserAccessMaskMaster = "*" & "" & "," & sEveryone & "," & "0" & "," & "0"
  425. End If
  426. arrSubAccessMask = split(F_UserAccessMaskMaster,"*")
  427. Set objShareInstance = G_objService.Get("Win32_Share.Name=" & chr(34) & F_strShareName & chr(34))
  428. '------------- Localization String -------------
  429. Dim arrVarReplacementString(0)
  430. arrVarReplacementString(0) = F_strShareName
  431. DIM L_SHARENAMENOTFOUND_ERRORMESSAGE
  432. L_SHARENAMENOTFOUND_ERRORMESSAGE = SA_GetLocString("foldermsg.dll", "C03A005B", arrVarReplacementString)
  433. '------------
  434. Dim strNTAuthorityDomainName
  435. Dim strBuiltinDomainName
  436. ' Get localized domain names
  437. strNTAuthorityDomainName = getNTAuthorityDomainName(G_objService)
  438. strBuiltinDomainName = getBuiltinDomainName(G_objService)
  439. If Err.number <> 0 Then
  440. SA_SetErrMsg(L_SHARENAMENOTFOUND_ERRORMESSAGE )
  441. SetCIFSshareProp =FALSE
  442. Exit Function
  443. End If
  444. 'checking whether the added domain user existance
  445. for i=0 to Ubound(arrSubAccessMask)-1
  446. arrShareItem = split(arrSubAccessMask(i+1),",")
  447. strDomain = arrShareItem(0)
  448. strUser = arrShareItem(1)
  449. '------------- Localization String -------------
  450. Dim arrVarReplacementStrings(0)
  451. arrVarReplacementStrings(0) = strDomain & "\" & strUser
  452. DIM L_USERNOTFOUND_ERRORMESSAGE
  453. L_USERNOTFOUND_ERRORMESSAGE = SA_GetLocString("foldermsg.dll", "C03A0062", arrVarReplacementStrings)
  454. '------------
  455. 'Do not check if user is local or SID string
  456. If Left(strUser,1) <> "?" Then
  457. If not( UCASE(strDomain) = UCASE(G_strLocalmachinename) or UCASE(strDomain) = UCASE(strNTAuthorityDomainName) or UCASE(strDomain)= UCASE(strBuiltinDomainName) or strDomain = "") then
  458. strWMIPath = "Domain=" & chr(34) & strDomain & chr(34) & "," & "Name=" & chr(34) & strUser & chr(34)
  459. if (not (isValidInstance(G_objService,"Win32_Account",strWMIPath))) then
  460. SA_SetErrMsg L_USERNOTFOUND_ERRORMESSAGE & " (" & Hex(Err.Number) & ")"
  461. SetCIFSshareProp =FALSE
  462. Exit function
  463. End If
  464. End If
  465. End If
  466. Next
  467. Set objclass = G_objService.Get("Win32_SecurityDescriptor")
  468. Set objSecDescriptor = objclass.SpawnInstance_()
  469. 'Hardcoding the Control Flag value
  470. objSecDescriptor.Properties_.Item("ControlFlags") = 32772
  471. objSecDescriptor.Properties_.Item("DACL") = Array()
  472. Set objDACL = objSecDescriptor.Properties_.Item("DACL")
  473. for i=0 to Ubound(arrSubAccessMask)-1
  474. arrShareItem = split(arrSubAccessMask(i+1),",")
  475. strDomain = arrShareItem(0)
  476. strUser = arrShareItem(1)
  477. strAccess = arrShareItem(2)
  478. strAce = arrShareItem(3)
  479. 'If Username has "?" at start of the string then get SID based on SID string
  480. 'Else get SID for username ,Domain.
  481. If Left(strUser,1) <> "?" Then
  482. arrUserSID = getsidvalue(strUser,strDomain)
  483. Else
  484. strUser = Right(strUser, (Len(strUser) - 1))
  485. arrUserSID = getBinarySIDforstirngSID(strUser)
  486. End if
  487. Set objTrustee = SetTrustee(strDomain,strUser,arrUserSID)
  488. Set objACE = SetACE(strAccess, 3, strAce, objTrustee)
  489. objDACL.Value(i) = objACE
  490. Next
  491. if (G_strTemp(0) = "n") then
  492. If (objShareInstance.Type <> 0) then
  493. nRetVal = objShareInstance.SetShareInfo(F_nUserLimit,F_strComment)
  494. else
  495. nRetVal = objShareInstance.SetShareInfo(F_nUserLimit, F_strComment, objSecDescriptor)
  496. End If
  497. else
  498. If (objShareInstance.Type <> 0) then
  499. nRetVal = objShareInstance.SetShareInfo(4294967295,F_strComment)
  500. else
  501. nRetVal = objShareInstance.SetShareInfo(4294967295, F_strComment, objSecDescriptor)
  502. End If
  503. End If
  504. If nRetVal = 0 and Err.number = 0 then
  505. SetCIFSshareProp =TRUE
  506. else
  507. SA_SetErrMsg L_FAILEDTOSETSHAREINFO_ERRORMESSAGE & "(" & Err.Number & ")"
  508. SetCIFSshareProp =FALSE
  509. End If
  510. 'setting cache options
  511. if(setShareCacheProp(F_strShareName,F_nCacheOption)) then
  512. SetCIFSshareProp =TRUE
  513. else
  514. SetCIFSshareProp =FALSE
  515. end If
  516. SetCIFSshareProp = True
  517. End FUnction
  518. '-------------------------------------------------------------------------
  519. ' Function name: getCIFSshareProp
  520. ' Description: gets the CIFS properties from system
  521. ' Input Variables: None.
  522. ' Output Variables: None
  523. ' Return Values: True on sucess, False on error (and error msg
  524. ' will be set by SA_SetErrMsg)
  525. ' Global Variables: In: F_strShareName -CIFS share name
  526. ' Out: F_flagDisable -Form controls status value used for Hidden shares
  527. ' In: G_objService - object of WMI service
  528. ' In: L_SHARENOTFOUND_ERRORMESSAGE
  529. ' Gets the CIFS Allow maximum values and if share type is hidden the F_flagDisable
  530. ' is assigned "DISABLE".If unable to find the share name then calls
  531. ' servefailure page
  532. '-------------------------------------------------------------------------
  533. Function getCIFSshareProp()
  534. Err.Clear
  535. On Error resume next
  536. Dim objShare
  537. Dim objSharePath
  538. objSharePath = "Win32_Share.Name=" & "'" & F_strShareName & "'"
  539. set objShare = G_objService.Get(objSharePath)
  540. If Err.Number <> 0 then
  541. Call SA_ServeFailurepageEx(L_SHARENOTFOUND_ERRORMESSAGE,mstrReturnURL)
  542. Exit Function
  543. End If
  544. If objShare.AllowMaximum = false then
  545. checkradio objShare.MaximumAllowed,"n"
  546. else
  547. checkradio "","y"
  548. End if
  549. getCIFSshareProp = True
  550. End FUnction
  551. '------------------------------------------------------------------
  552. 'Function name: ServeCIFSHiddenValues()
  553. 'Description: Serve Hidden Values
  554. 'Input Variables: None
  555. 'Output Variables: None
  556. 'Global Variables: F_(*)
  557. '------------------------------------------------------------------
  558. Function ServeCIFSHiddenValues
  559. %>
  560. <input type="hidden" name="hdnCacheValue" value ="<%=F_nCacheOption%>">
  561. <input type="hidden" name="hdnUserAccessMaskMaster" value="<%= F_UserAccessMaskMaster%>" >
  562. <input type="hidden" name="hdnCurrentUsers" value="<%=F_strPermittedMembers%>">
  563. <input type="hidden" name="hdnAllowUsers" value="<%=F_strAllowUsersData%>" >
  564. <input type="hidden" name="hdnComment" value="<%=Server.HTMLEncode(UnescapeChars(ReplaceSubString(F_strComment,"\u0022", """")))%>">
  565. <%
  566. End Function
  567. %>