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.

862 lines
28 KiB

  1. <% '-------------------------------------------------------------------------
  2. ' Share_nfsnew.asp: Manage NFS new share permissions
  3. '
  4. ' Copyright (c) Microsoft Corporation. All rights reserved.
  5. '
  6. ' Date Description
  7. ' 10 Oct 2000 Creation Date.
  8. ' 9 March 2001 Modified Date.
  9. '----------------------------------------------------------------
  10. %>
  11. <!--#include file="share_nfsprop.js" -->
  12. <%
  13. '---------------------------------------------------------------
  14. 'global Constants
  15. '--------------------------------------------------------------
  16. Const G_nMEMBERS = 40' Upper limit of array that holds
  17. ' clients and client groups list
  18. Const G_GROUP = 1 ' Constants used to call SFU API's
  19. Const G_MEMBER = 2 ' Constants used to call SFU API's
  20. Const G_PERMISSION_TAB = 0 ' Permission Tab
  21. '---------------------------------------------------------------
  22. 'Global Variables
  23. '---------------------------------------------------------------
  24. Dim G_objRegistryHandle ' Registry object
  25. Dim F_REGISTRY_PATH ' Path to registry key
  26. Dim G_CLGRPS ' Used to get all the
  27. ' Client Groups and Members
  28. Dim G_bValidateEditText ' If we need to validate edit text
  29. G_bValidateEditText = True
  30. ' SFU 2.3 - 2-28
  31. ' Anonymous
  32. Dim G_bAllowAnonAccess
  33. '---------------------------------------------------------------
  34. 'Form Variables
  35. '---------------------------------------------------------------
  36. Dim F_strNFSShareName ' NFS Share name
  37. Dim F_strShareNFSPath ' NFS Share Path
  38. Dim F_strPermissionList ' User name list
  39. Dim F_strAccessType ' ACL
  40. Dim F_bAddBtnClick ' User Clicked on Add
  41. Dim F_strCommName ' Name of Client or Client Group
  42. Dim F_strClientInfo ' Stores Permission list
  43. Dim F_strGlobalPerm ' Global permission setting
  44. Dim F_strCliGrp ' List of Clients and Client Groups
  45. Dim F_strEUCJPStatus ' status of the EUCJP checkbox ( check/uncheck )
  46. '---------------------------------------------------------------=
  47. 'Initializing of Reg path
  48. '---------------------------------------------------------------=
  49. F_REGISTRY_PATH ="SOFTWARE\Microsoft\Server For NFS\CurrentVersion\exports"
  50. '---------------------------------------------------------------=
  51. F_strCommName =""
  52. 'Function Call to get the registry handle connection
  53. set G_objRegistryHandle = RegConnection()
  54. '-------------------------------------------------------------------------
  55. ' Function name: ServerSideValidation()
  56. ' Description: Server side validation
  57. ' Input Variables: None.
  58. ' Output Variables: None
  59. ' Return Values: None.
  60. '-------------------------------------------------------------------------
  61. Function ServerSideValidation()
  62. Err.Clear
  63. On Error Resume Next
  64. Dim arrPermissions ' Permissions
  65. Dim i
  66. Dim ComputerID 'Return value
  67. Dim strCompName 'Client IP or Computer Name
  68. Dim cPermissions
  69. Dim strTemp 'Temparary variable
  70. ServerSideValidation = True
  71. Const CONST_UNKNOWN_HOST="UNKNOWN HOST"
  72. Const CONST_NOACESS="0,ALL MACHINES,0,1;"
  73. Const CONST_READONLY="0,ALL MACHINES,0,2;"
  74. Const CONST_READWRITE="0,ALL MACHINES,0,4;"
  75. arrPermissions = split(F_strPermissionList, ";")
  76. cPermissions = ubound(arrPermissions)
  77. For i = 1 to (ubound(arrPermissions)-1)
  78. strTemp=split(arrPermissions(i), ",")
  79. strCompName =strTemp(1)
  80. If Instr(arrPermissions(i),"G")=0 Then
  81. ComputerID = ValidateMember(strCompName)
  82. If ComputerID <> CONST_UNKNOWN_HOST Then
  83. If cPermissions = 1 Then
  84. 'Set the ALL MACHINES to NO ACESS
  85. F_strPermissionList = Replace(F_strPermissionList,CONST_READWRITE,_
  86. CONST_NOACESS)
  87. F_strPermissionList = Replace(F_strPermissionList,CONST_READONLY,_
  88. CONST_NOACESS)
  89. End if
  90. Else
  91. Dim arrRepString(1)
  92. Dim strResolveErrMsg
  93. arrRepString(0) = strCompName
  94. strResolveErrMsg = SA_GetLocString("foldermsg.dll", "C03A0095", arrRepString)
  95. Call SA_SetErrMsg(strResolveErrMsg)
  96. ServerSideValidation=False
  97. Exit Function
  98. End if
  99. End if
  100. Next
  101. End Function
  102. '-------------------------------------------------------------------------
  103. ' Function name: ServeNFSPage
  104. ' Description: Serves in displaying the page Header,Middle,Bottom Parts.
  105. ' Input Variables: None.
  106. ' Output Variables: None
  107. ' Return Values: None.
  108. '-------------------------------------------------------------------------
  109. Function ServeNFSPage
  110. Err.Clear
  111. On Error Resume Next
  112. %>
  113. <table>
  114. <tr>
  115. <td class="TasksBody" nowrap align=left>
  116. <%=L_SHAREPATH_TEXT%>
  117. </td>
  118. <td class="TasksBody" nowrap align=left>
  119. <%=F_strShareNFSPath%>
  120. </td>
  121. </tr>
  122. <tr height="6">
  123. <td class="TasksBody">
  124. </td>
  125. </tr>
  126. <!-- SFU 2.3 - 2-28 -->
  127. <tr>
  128. <td class="TasksBody" colspan=2>
  129. <input type="checkbox" name="chkAllowAnnon" class="FormCheckBox" <%=GetAnnonAccessCheckState()%> value="ON" ><%=L_ALLOWANNON_TEXT%>
  130. </td>
  131. </tr>
  132. <!-- END SFU 2.3 - 2-28 -->
  133. <tr>
  134. <td class="TasksBody" colspan=2>
  135. <input type="checkbox" name="chkEUCJP" class="FormCheckBox" <%=F_strEUCJPStatus %> value="ON" ><%=L_EUCJP_TEXT%>
  136. </td>
  137. </tr>
  138. </table>
  139. <table>
  140. <tr>
  141. <td class="TasksBody">
  142. <%=L_PERMISSIONS_TEXT%>
  143. </td>
  144. </tr>
  145. <tr>
  146. <td height="80" class="TasksBody">
  147. <select id="lstPermissions" name="lstPermissions" class="FormField" size="8" onClick="DisableBtn();" onChange="if (document.frmTask.scrollCliGrp.selectedIndex!= -1){ document.frmTask.scrollCliGrp.selectedIndex= -1;selectAccess( document.frmTask.lstPermissions,document.frmTask.cboRights );}if(document.frmTask.lstPermissions.selectedIndex ==0){document.frmTask.btnRemove.disabled=true;} else{ document.frmTask.btnRemove.disabled=false;}selectAccess(this,cboRights);" style="font-family: Courier" >
  148. <%
  149. 'Function call to get the permissions
  150. Call getPermissions()
  151. %>
  152. </select>
  153. </td>
  154. </tr>
  155. </table>
  156. <table>
  157. <tr valign=top>
  158. <td class="TasksBody">
  159. <% =L_CLIENTANDGROUPS_TEXT %>
  160. </td>
  161. <td class="TasksBody">
  162. <% =L_NFS_CLIENT_TEXT %>
  163. </td>
  164. </tr>
  165. <tr valign=top>
  166. <td class="TasksBody">
  167. <select name="scrollCliGrp" class="FormField" size="4" language=javascript onChange="if (document.frmTask.lstPermissions.selectedIndex!= -1){ document.frmTask.lstPermissions.selectedIndex= -1;selectAccess( document.frmTask.lstPermissions,document.frmTask.cboRights );}clgrps_onChange(this);" onClick="OnSelectClientGroup()" >
  168. <%FillClientGroupsList()%>
  169. </select>
  170. </td>
  171. <td class="TasksBody">
  172. <input type="text" name="txtCommName" class="FormField" style="HEIGHT: 22; WIDTH: 175" size="20" onClick="OnSelectNameInput();" OnKeyUP="disableAdd(this,document.frmTask.btnAdd)" onFocus=HandleKey("DISABLE") onBlur=HandleKey("ENABLE") >
  173. </td>
  174. </tr>
  175. </table>
  176. <table>
  177. <tr>
  178. <td class="TasksBody" nowrap>
  179. <%=L_SHARETYPE_TEXT%>
  180. </td>
  181. <td class="TasksBody">
  182. <select name="cboRights" class="FormField" onChange ="changeRights()">
  183. <option value="1,17"><%=L_NOACESS_TEXT%></option>
  184. <option value="2,18"><%=L_READONLY_TEXT%></option>
  185. <option value="4,19" selected><%=L_READWRITE_TEXT%></option>
  186. <option value="10,20"><%=L_READONLY_TEXT & " + " & L_ROOT_TEXT%></option>
  187. <option value="12,21"><%=L_READWRITE_TEXT & " + " & L_ROOT_TEXT%></option>
  188. </select>
  189. </td>
  190. </table>
  191. <table>
  192. <tr>
  193. <td class="TasksBody" align=center width=150>
  194. <%
  195. Call SA_ServeOnClickButtonEx(L_NFS_ADD_TEXT, "", "getUsernames(txtCommName,lstPermissions)", 60, 0, "ENABLED", "btnAdd")
  196. %>
  197. </td>
  198. <td class="TasksBody" align=center width=150>
  199. <%
  200. Call SA_ServeOnClickButtonEx(L_NFS_REMOVE_TEXT, "", "fnbRemove(lstPermissions,'Comm'); if (lstPermissions.length==0){ btnRemove.disabled=true;}", 60, 0, "DISABLED", "btnRemove")
  201. %>
  202. </td>
  203. </tr>
  204. </table>
  205. <%
  206. Call ServeNFSHiddenValues
  207. End Function
  208. '----------------------------------------------------------------------------
  209. 'Function name: ValidateMember
  210. 'Description: validate the computer name is valid
  211. 'Input Variables: MemberName
  212. 'Oupput Variables: IP value is obtained
  213. 'Return Values: None.
  214. 'GlobalVariables: None
  215. '----------------------------------------------------------------------------
  216. Function ValidateMember(MemberName)
  217. Err.Clear
  218. On Error Resume Next
  219. If isIP(MemberName) Then
  220. ValidateMember=ClientIP(MemberName)
  221. Else
  222. ValidateMember = ClientStr(MemberName)
  223. End if
  224. End Function
  225. '----------------------------------------------------------------------------
  226. 'Function name: ClientStr
  227. 'Description: function for validClient if entered in String format
  228. 'Input Variables: Client
  229. 'Oupput Variables: Hex value of Client for client Id
  230. 'GlobalVariables: None
  231. '----------------------------------------------------------------------------
  232. Function ClientStr(MemberName)
  233. ' It looks like nobody is using this method to convert the machine name
  234. ' to an IP address. If so, this function should be deleted.
  235. ClientStr = ClientIP(MemberName)
  236. Exit Function
  237. End Function
  238. '----------------------------------------------------------------------------
  239. 'Function name: ClientIP
  240. 'Description: function for validClient if entered in IP format
  241. 'Input Variables: Client
  242. 'Oupput Variables: value of Client for client Id
  243. 'GlobalVariables None
  244. '----------------------------------------------------------------------------
  245. Function ClientIP(MemberName)
  246. Err.Clear
  247. On Error Resume Next
  248. Const CONST_UNKNOWN_HOST="UNKNOWN HOST"
  249. If ( TRUE = Ping(MemberName) ) Then
  250. ClientIP = IPaddress
  251. Else
  252. ClientIP = CONST_UNKNOWN_HOST
  253. End If
  254. End Function
  255. '----------------------------------------------------------------------------
  256. 'Function name: FillMembers
  257. 'Description: Serves in printing the permissions of
  258. ' the selected NFSShare in the ListBox
  259. 'Input Variables: Grpname: list the the members of this Group.
  260. 'Output Variables: (None)
  261. 'Global Variables: In:F_strPermissionList -List of Permissions
  262. '----------------------------------------------------------------------------
  263. Function FillMembers(Grpname)
  264. Err.Clear
  265. On Error Resume Next
  266. Dim strCmems ' Member list
  267. Dim nCount ' Count of members
  268. Dim nCounter ' For loop index
  269. Dim clientGroupObj ' CliGrpEnum Object
  270. set clientGroupObj = Server.CreateObject("CliGrpEnum.1")
  271. strCmems = ""
  272. clientGroupObj.machine = GetComputerName
  273. clientGroupObj.ReadClientGroupsReg()
  274. clientGroupObj.presentgroup=Grpname
  275. clientGroupObj.mode = G_MEMBER
  276. clientGroupObj.moveFirst()
  277. nCount = cint(clientGroupObj.memCount(""))
  278. If nCount = 0 Then
  279. strCmems=""
  280. End If
  281. For nCounter=0 to nCount-1
  282. strCmems = strCmems & cstr(clientGroupObj.memName)
  283. ' CligrpEnum throws an exception if you iterate past the end
  284. ' This short circuits the exception
  285. If nCount <> nCounter+1 Then
  286. clientGroupObj.moveNext()
  287. End If
  288. Next
  289. FillMembers = cstr(strCmems) & cstr("->[")
  290. set clientGroupObj = nothing
  291. End Function
  292. '----------------------------------------------------------------------------
  293. 'Function name: getPermissions
  294. 'Description: Serves in printing the permissions of
  295. ' the selected NFSShare in the ListBox
  296. 'Input Variables: (None)
  297. 'Output Variables: (None)
  298. 'Global Variables: In:F_strPermissionList -List of Permissions
  299. '----------------------------------------------------------------------------
  300. Function getPermissions()
  301. Err.Clear
  302. On Error Resume Next
  303. Dim arrPermissionList,arrTemp
  304. Dim strTemp,i,strClient,j,strGlobalP
  305. F_strPermissionList=F_strPermissionList & "N" & "," & strCompName & _
  306. "," & ComputerID & "," & F_strAccessType & "0;"
  307. arrPermissionList=split(F_strPermissionList,";",-1,0)
  308. For i=Lbound(arrPermissionList) To (Ubound(arrPermissionList)-1)
  309. arrTemp=Split(arrPermissionList(i),",")
  310. strGlobalP = arrTemp(3)
  311. strClient=ConvertPerm(strGlobalP)
  312. strTemp=server.htmlencode(arrTemp(1)) & buildSpaces(23-len(arrTemp(1))) & strClient
  313. Response.Write("<option value=" & Chr(34) & server.htmlencode(arrTemp(0)) & "," & _
  314. server.htmlencode(arrTemp(1))&"," & server.htmlencode(arrTemp(2)) &","& server.htmlencode(arrTemp(3)) &","& server.htmlencode(arrTemp(4)) & _
  315. Chr(34)& " >" & replace(strTemp," " ,"&nbsp;") & "</option>")
  316. Next
  317. End Function
  318. '----------------------------------------------------------------------------
  319. 'Function name: NFSOnInitPage
  320. 'Description: Serves in Getting the data from system
  321. 'Input Variables: (None)
  322. 'Output Variables: (None)
  323. 'Global Variables: Out:F_strNFSShareName -updated Share name(from previous form)
  324. ' Out:F_strShareNFSPath -share path(from previous form)
  325. ' Out:F_strPermissionList -List of Permissions
  326. '----------------------------------------------------------------------------
  327. Function NFSOnInitPage()
  328. Err.Clear
  329. On Error Resume Next
  330. Const CONST_READONLY="0,ALL MACHINES,0,2,7;"
  331. F_strNFSShareName = ""
  332. F_strShareNFSPath = ""
  333. 'Function call to get the default share permissions
  334. F_strPermissionList =CONST_READONLY
  335. G_bAllowAnonAccess = FALSE
  336. End Function
  337. '----------------------------------------------------------------------------
  338. 'Function name: NFSOnPostBackPage
  339. 'Description: Serves in Getting the data from Client
  340. 'Input Variables: (None)
  341. 'Output Variables: (None)
  342. 'Global Variables: Out:F_strPermissionList -List of Permissions(from form)
  343. ' Out:F_strNFSShareName -Share name(from from)
  344. ' Out:F_strShareNFSPath -Share path(from from)
  345. '----------------------------------------------------------------------------
  346. Function NFSOnPostBackPage
  347. Err.Clear
  348. On Error Resume Next
  349. F_strNFSShareName = F_strNewSharename
  350. F_strShareNFSPath = F_strNewSharePath
  351. F_strAccessType = Request.Form("cboRights")
  352. F_strCommName = Request.Form("txtCommName")
  353. F_strEUCJPstatus = Request.Form("hidEUCJP")
  354. 'If there is no data in the edit field use from the list box
  355. if ( F_strCommName = "" ) Then
  356. G_bValidateEditText = False
  357. F_strCommName = Request.Form("scrollCliGrp")
  358. F_strCliGrp = Request.Form("scrollCliGrp")
  359. End IF
  360. F_strPermissionList = Request.Form("hidUserNames")
  361. F_strClientInfo = Request.Form("hidClientInfo")
  362. F_REGISTRY_PATH = Request.Form("hidRegistryPath")
  363. F_strGlobalPerm = Request.Form("hidGlobalperm")
  364. F_bAddBtnClick = Request.Form("hidAddBtn")
  365. Call SA_TraceOut(SA_GetScriptFileName(), "Request.Form(chkAllowAnnon): " & Request.Form("chkAllowAnnon"))
  366. If ( Len(Request.Form("hidchkAllowAnnon")) > 0 ) Then
  367. G_bAllowAnonAccess = TRUE
  368. Else
  369. G_bAllowAnonAccess = FALSE
  370. End If
  371. Call SA_TraceOut(SA_GetScriptFileName(), "Post-Back state for G_bAllowAnonAccess = " & G_bAllowAnonAccess)
  372. End Function
  373. '----------------------------------------------------------------------------
  374. 'Function name: UpdateNFSPermissions
  375. 'Description: Serves in Setting user permissions
  376. 'Input Variables: (None)
  377. 'Oupput Variables: Boolean -Returns ( True/Flase )True: If
  378. ' Implemented properly False: If error in Implemented
  379. 'GlobalVariables: In:G_objRegistryHandle -Server connection for registry to default space
  380. ' In:F_REGISTRY_PATH -Path of the registry
  381. ' In:L_(*) -Localized strings
  382. '----------------------------------------------------------------------------
  383. Function UpdateNFSPermissions()
  384. Err.Clear
  385. On Error Resume Next
  386. Dim arrPermissionList
  387. Dim i
  388. Dim strQueryForCmd
  389. Dim intReturnValue
  390. UpdateNFSPermissions = FALSE
  391. strQueryForCmd = ""
  392. If not ServerSideValidation Then
  393. UpdateNFSPermissions = False
  394. Exit function
  395. End if
  396. if trim(F_strPermissionList) <> "" then
  397. arrPermissionList= split(F_strPermissionList,";")
  398. strQueryForCmd = strQueryForCmd & getClientsAndPermissions(arrPermissionList(0),False)
  399. 'Checking for the share with allmachines no access
  400. IF ( Ucase(Trim(strQueryForCmd)) = Ucase("No Access") ) Then
  401. IF ( Ubound(arrPermissionList)=1 ) Then
  402. SA_SetErrMsg L_CANNOTCREATE_EMPTY_SHARE__ERRORMESSAGE & "(" & Hex(Err.Number) & ")"
  403. Exit Function
  404. Else
  405. strQueryForCmd=""
  406. End IF
  407. End IF
  408. 'Applying the ANON property on every share
  409. If ( TRUE = G_bAllowAnonAccess ) Then
  410. strQueryForCmd=strQueryForCmd & "ANON=YES "
  411. Else
  412. strQueryForCmd=strQueryForCmd & "ANON=NO "
  413. End If
  414. 'Applying the EUCJP property on the share
  415. IF (Ucase(F_strEUCJPStatus)="CHECKED") Then
  416. strQueryForCmd=strQueryForCmd & "ENCODING=EUC-JP "
  417. End If
  418. FOR i = 1 to ubound(arrPermissionList) - 1
  419. strQueryForCmd = strQueryForCmd & getClientsAndPermissions(arrPermissionList(i),True)
  420. Next
  421. end if
  422. 'Call to Delete a share
  423. If NOT deleteShareNFS(F_strNFSShareName) Then
  424. SA_SetErrMsg L_UPDATION_FAIL_ERRORMESSAGE & "(" & Hex(Err.Number) & ")"
  425. Exit Function
  426. End If
  427. intReturnValue = CreateNFSShare(F_strNFSShareName, F_strShareNFSPath, strQueryForCmd)
  428. If intReturnValue = True Then
  429. UpdateNFSPermissions = TRUE
  430. Else
  431. UpdateNFSPermissions =False
  432. SA_SetErrMsg L_UPDATION_FAIL_ERRORMESSAGE & "(" & Hex(Err.Number) & ")"
  433. Exit Function
  434. End If
  435. End Function
  436. '----------------------------------------------------------------------------
  437. 'Function name: getClientsAndPermissions
  438. 'Description: Serves in building the string of permissions of the
  439. ' clientGroups to send as input to the nfsshare.exe
  440. 'Input Variables: In: strClientPermValue - the comma seperated values for a given client
  441. ' In: blnAppendClient - Is the client Name needs to be appended in the inParam to exe?
  442. 'Oupput Variables: None
  443. 'Returns: The String of ClientGroups and their permissions
  444. ' Example: RW RO="abc" RW="xyz"
  445. 'GlobalVariables: None
  446. '----------------------------------------------------------------------------
  447. Function getClientsAndPermissions(strClientPermValue, blnAppendClient)
  448. Err.Clear
  449. On Error Resume Next
  450. Dim strReturnValue
  451. Dim strRoot
  452. Dim arrClientPermissions
  453. Dim strClient
  454. Dim strPermissions
  455. Const CONST_NA= "No Access"
  456. Const CONST_RO= "RO"
  457. Const CONST_RW= "RW"
  458. Const CONST_ROOT= "ROOT"
  459. strReturnValue = ""
  460. strRoot = ""
  461. If strClientPermValue = "" Then
  462. getClientsAndPermissions = strReturnValue
  463. Exit Function
  464. End If
  465. arrClientPermissions = Split(strClientPermValue,",")
  466. strClient = Chr(34) & replace(arrClientPermissions(1),chr(34),"\"&chr(34)) & Chr(34)
  467. strPermissions = arrClientPermissions(3)
  468. Select Case CInt(strPermissions)
  469. Case 1
  470. strReturnValue = CONST_NA
  471. Case 2
  472. strReturnValue = CONST_RO
  473. Case 4
  474. strReturnValue = CONST_RW
  475. Case 9
  476. strReturnValue = CONST_NA
  477. strRoot = CONST_ROOT
  478. Case 10
  479. strReturnValue = CONST_RO
  480. strRoot = CONST_ROOT
  481. Case 12
  482. strReturnValue = CONST_RW
  483. strRoot = CONST_ROOT
  484. Case Else
  485. ' this will not occur
  486. strReturnValue = CONST_RW
  487. End SELECT
  488. If blnAppendClient = FALSE Then
  489. strReturnValue = strReturnValue
  490. Else
  491. strReturnValue = strReturnValue & "=" & strClient
  492. End If
  493. if strRoot <> "" Then
  494. If blnAppendClient = FALSE Then
  495. strReturnValue = strReturnValue & " " & strRoot
  496. Else
  497. strReturnValue = strReturnValue & " " & strRoot & "=" & strClient
  498. End If
  499. End If
  500. getClientsAndPermissions = strReturnValue & " "
  501. End Function
  502. '----------------------------------------------------------------------------
  503. 'Function name: ConvertIP
  504. 'Description: function converts the IP address to the HEX value
  505. ' for clinetid to be updated in registry.
  506. 'Input Variables: IP Address.
  507. 'OutPut Variables: HEX value
  508. '----------------------------------------------------------------------------
  509. Function ConvertIP(IPaddress)
  510. Err.Clear
  511. On Error Resume Next
  512. Dim IPValue,IP,IP1,IP2,IP3,IP4
  513. IP = split(IPaddress,".")
  514. IP1 =hex(IP(0))
  515. if IP(0) <=9 then
  516. IP1 = 0 & IP1
  517. end if
  518. IP2=hex(IP(1))
  519. if IP(1) <=9 then
  520. IP2 = 0 & IP2
  521. end if
  522. IP3=hex(IP(2))
  523. if IP(2) <=9 then
  524. IP3 = 0 & IP3
  525. end if
  526. IP4= hex(IP(3))
  527. if IP(3) <=9 then
  528. IP4 = 0 & IP4
  529. end if
  530. IPValue= LCase(IP4&IP3&IP2&IP1)
  531. ConvertIP= IPValue
  532. End Function
  533. '----------------------------------------------------------------------------
  534. 'Function name: isIP
  535. 'Description: function checks for valid IP format
  536. 'Input Variables: IP Address.
  537. 'OutPut Variables: returns true if in IP format or returns false
  538. '----------------------------------------------------------------------------
  539. Function isIP(strIP)
  540. Err.Clear
  541. On Error Resume Next
  542. isIP = TRUE
  543. Dim i
  544. For i = 1 to Len(strIP)
  545. If mid(strIP,i,1) <> "." and Not isNumeric(mid(strIP,i,1)) Then
  546. isIP = FALSE
  547. Exit Function
  548. End if
  549. Next
  550. End Function
  551. '----------------------------------------------------------------------------
  552. 'Function name: ConvertPerm
  553. 'Description: Converts the permissions which is int value to a string
  554. 'Input Variables: (None)
  555. 'Oupput Variables: permission description is obtained
  556. 'GlobalVariables: None
  557. '----------------------------------------------------------------------------
  558. Function ConvertPerm(arg_str)
  559. Err.Clear
  560. On Error Resume Next
  561. Const INVALIDENTRY="invalid entry"
  562. Dim strClient
  563. select case arg_str
  564. case 1,17:
  565. strClient=L_NOACESS_TEXT
  566. case 2,18:
  567. strClient=L_READONLY_TEXT
  568. case 4,19:
  569. strClient=L_READWRITE_TEXT
  570. case 9,20:
  571. strClient=L_NOACESS_TEXT & " + " & L_ROOT_TEXT
  572. case 10,21:
  573. strClient=L_READONLY_TEXT & " + " & L_ROOT_TEXT
  574. case 12,22:
  575. strClient=L_READWRITE_TEXT & " + " & L_ROOT_TEXT
  576. case else
  577. strClient =INVALIDENTRY
  578. End Select
  579. ConvertPerm = strClient
  580. End Function
  581. '---------------------------------------------------------------------
  582. 'Function name: buildSpaces
  583. 'Description: Helper function to return String with nbsps
  584. ' which act as spaces in the list box
  585. 'Input Variables: intCount -spacesCount
  586. 'OutPut Variables: spacesstring -Returns the nbsp string
  587. '---------------------------------------------------------------------
  588. Function buildSpaces(intCount)
  589. Err.Clear
  590. On Error Resume Next
  591. Dim i , strSpace
  592. strSpace="&nbsp;"
  593. 'Forming a string with the count send as parameter
  594. For i=1 To intCount
  595. strSpace=strSpace & "&nbsp;"
  596. Next
  597. buildSpaces=strSpace
  598. End Function
  599. '----------------------------------------------------------------------------
  600. ' Function name: FillClientGroupsList
  601. ' Description: Builds the client group list.
  602. ' Input Variables: None
  603. ' Output Variables: None
  604. ' Returns: None
  605. 'lobal Variables: G_CLGRPS
  606. '----------------------------------------------------------------------------
  607. Function FillClientGroupsList()
  608. Err.Clear
  609. On Error Resume Next
  610. Dim strCgrps ' Client groups
  611. Dim arrMembers ' Array of Members
  612. Dim nGroupCount ' Group count
  613. Dim nCounter ' index into group loop
  614. Dim nMemCounter ' index into members in a group list
  615. Dim nArrMemCount ' Total member count
  616. Dim clientGroupObj ' CliGrpEnum.1 object
  617. clientGroupObj = null
  618. Dim arrAllMembers() 'Array of all members within all groups
  619. ReDim arrAllMembers( G_nMEMBERS)
  620. set clientGroupObj = Server.CreateObject("CliGrpEnum.1")
  621. clientGroupObj.machine = GetComputerName
  622. clientGroupObj.ReadClientGroupsReg()
  623. clientGroupObj.mode = G_GROUP
  624. clientGroupObj.moveFirst()
  625. nGroupCount = cint(clientGroupObj.grpCount)
  626. nArrMemCount = -1
  627. If nGroupCount=0 Then
  628. strCgrps=""
  629. End If
  630. For nCounter= 0 to nGroupCount-1
  631. strCgrps = strCgrps & cstr(clientGroupObj.grpName) & "->["
  632. For nMemCounter = 0 to (ubound(arrMembers))-1
  633. If Not bIsMember( arrAllMembers, arrMembers(nMemCounter), nArrMemCount ) Then
  634. 'Response.Write "<OPTION VALUE=" & chr(34) & server.htmlencode(cstr(arrMembers(nMemCounter)))&","&"G" & chr(34) & ">" & _
  635. Response.Write "<OPTION VALUE=" & chr(34) & server.htmlencode(cstr(arrMembers(nMemCounter))) & chr(34) & ">" & _
  636. replace(Server.HTMLEncode( arrMembers(nMemCounter))," ", "&nbsp;") & "</OPTION>"
  637. nArrMemCount = nArrMemCount + 1
  638. arrAllMembers( nArrMemCount ) = arrMembers(nMemCounter)
  639. End If
  640. Next
  641. 'Response.Write "<OPTION VALUE=" & chr(34) & server.HTMLEncode(cstr(clientGroupObj.grpName))&","& "G" & chr(34) & ">" & _
  642. Response.Write "<OPTION VALUE=" & chr(34) & server.HTMLEncode(cstr(clientGroupObj.grpName)) & chr(34) & ">" & _
  643. replace(Server.HTMLEncode(cstr(clientGroupObj.grpName))," " ,"&nbsp;") & "</OPTION>"
  644. ' CligrpEnum throws an exception if you iterate past the end
  645. ' This short circuits the exception
  646. If nGroupCount <> nCounter+1 Then
  647. clientGroupObj.moveNext()
  648. End If
  649. Next
  650. G_CLGRPS = strCgrps
  651. set clientGroupObj = nothing
  652. End Function
  653. '----------------------------------------------------------------------------
  654. ' Function name: bIsMember
  655. ' Description : Tests is a member needed to be added to the client group list.
  656. ' Input Variables: In:aaCliAndCligrps - Existing list of Members ( array )
  657. ' In:strNewMem - New Member to be added to the list.
  658. ' In:intCount - Count of members in above array.
  659. ' Output Variables: None
  660. ' Returns: True, if strNewMem is already a member, otherwise False
  661. '----------------------------------------------------------------------------
  662. Function bIsMember( arrCliAndCliGrps, strNewMem, nCount )
  663. Err.Clear
  664. On Error Resume Next
  665. Dim nMemCounter ' For loop index
  666. bIsMember = False
  667. If strNewMem = "" Then
  668. bIsMember = True
  669. Else
  670. If nCount > -1 Then
  671. For nMemCounter = 0 to nCount
  672. If UCASE(strNewMem) = UCASE( arrCliAndCliGrps(nMemCounter) ) Then
  673. bIsMember = True
  674. End If
  675. Next
  676. End If
  677. End If
  678. End Function
  679. Function GetAnnonAccessCurrentState()
  680. If ( G_bAllowAnonAccess ) Then
  681. GetAnnonAccessCurrentState = "ON"
  682. Else
  683. GetAnnonAccessCurrentState = ""
  684. End If
  685. Call SA_TraceOut(SA_GetScriptFileName(), "GetAnnonAccessCurrentState returning: " & GetAnnonAccessCurrentState)
  686. End Function
  687. Function GetAnnonAccessCheckState()
  688. If ( G_bAllowAnonAccess ) Then
  689. GetAnnonAccessCheckState = " CHECKED "
  690. Else
  691. GetAnnonAccessCheckState = ""
  692. End If
  693. Call SA_TraceOut(SA_GetScriptFileName(), "GetAnnonAccessCheckState returning: " & GetAnnonAccessCheckState)
  694. End Function
  695. '------------------------------------------------------------------
  696. 'Function name: ServeNFSHiddenValues()
  697. 'Description: Serve Hidden Values
  698. 'Input Variables: None
  699. 'Output Variables: None
  700. 'Global Variables: F_(*)
  701. '------------------------------------------------------------------
  702. Function ServeNFSHiddenValues
  703. %>
  704. <input type="hidden" name="hidClientInfo" value="<%=server.htmlencode(F_strClientInfo)%>">
  705. <input type="hidden" name="hidGlobalperm" value="<%=F_strGlobalPerm%>">
  706. <input type="hidden" name="hidRegistryPath" value="<%=F_REGISTRY_PATH%>">
  707. <input type="hidden" name="hidUserNames" value="<%=server.htmlencode(F_strPermissionList)%>">
  708. <input type="hidden" name="hidAddBtn" value="<%=F_bAddBtnClick%>">
  709. <input type="hidden" name="hidstrShareName" value="<%=F_strNFSShareName%>">
  710. <input type="hidden" name="hidstrSharePath" value="<%=F_strShareNFSPath%>">
  711. <input type="hidden" name="hidCliGrp" value="<%=server.htmlencode(F_strCliGrp)%>">
  712. <input type="hidden" name="hidEUCJP" value="<%=F_strEUCJPstatus%>">
  713. <input type="hidden" name="hidchkAllowAnnon" value="<%=GetAnnonAccessCurrentState()%>" >
  714. <input type="hidden" name="hidGroups" value="<%=server.htmlencode(G_CLGRPS)%>">
  715. <input type="hidden" name="blnnewCligrp">
  716. <input type="hidden" name="blnremCligrp">
  717. <input type="hidden" name="blnnewMem">
  718. <input type="hidden" name="blnremMem">
  719. <input type="hidden" name="newCligrp">
  720. <input type="hidden" name="remCligrp">
  721. <input type="hidden" name="newMem">
  722. <input type="hidden" name="remMem">
  723. <input type="hidden" name="grpmem">
  724. <%
  725. End Function
  726. %>