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.

168 lines
4.4 KiB

  1. # Test #1 - This test exercises all the basic functionalities of the
  2. # COM implementation of IAccessControl.
  3. # Init a new COM IAccessControl object by passing a NULL IStream pointer
  4. # into IPersistStream::Load
  5. Exec InitNewACL
  6. # I'll add 4 DENY_ACCESS ACEs and 5 GRANT_ACCESS ACEs to the ACL
  7. # First, I'll add the GRANT_ACCESS entries to the ACL but before doing that,
  8. # I have to set up an access request list locally
  9. ToggleAccessPerm COM_RIGHTS_EXECUTE
  10. Set TrusteeName RAYLAND\ACTEST1
  11. AddTrustee AccessRequestList
  12. Set TrusteeName RAYLAND\ACTEST2
  13. AddTrustee AccessRequestList
  14. Set TrusteeName RAYLAND\ACTEST3
  15. AddTrustee AccessRequestList
  16. Set TrusteeName RAYLAND\ACTEST4
  17. AddTrustee AccessRequestList
  18. Set TrusteeName rayland\administrator
  19. AddTrustee AccessRequestList
  20. # Add the GRANT_ACCESS ACEs
  21. Exec GrantAccessRights
  22. #Take a peek at the ACL
  23. Exec GetExplicitAccessRights
  24. # Goes through the same procedure for DENY_ACCESS ACEs but removes the local access request list first
  25. Destroy AccessRequestList
  26. Set TrusteeName RAYLAND\ACTEST5
  27. AddTrustee AccessRequestList
  28. Set TrusteeName RAYLAND\ACTEST6
  29. AddTrustee AccessRequestList
  30. Set TrusteeName RAYLAND\ACTEST7
  31. AddTrustee AccessRequestList
  32. Set TrusteeName RAYLAND\ACTEST8
  33. AddTrustee AccessRequestList
  34. # Add the DENY_ACCESS ACEs
  35. Exec DenyAccessRights
  36. # Call GetExplicitAccessRights to see if the ACL has been set up properly
  37. Exec GetExplicitAccessRights
  38. # Set current trustee to RAYLAND\ADMINISTRATOR and perform access check
  39. Set TrusteeName RaYLAnD\adminIstrator
  40. # RAYLAND\Administrator should be granted COM_RIGHTS_EXECUTE access
  41. Exec IsAccessPermitted
  42. # Call IsAccessPermitted to see if the caching mechanism works
  43. Exec IsAccessPermitted
  44. # Change the client security context to that of RAYLAND\ACTEST2 so I can preform some
  45. # access checking for RAYLAND\ACTEST2
  46. SwitchClientCtx
  47. ACTEST2
  48. RAYLAND
  49. # Set the current trustee to RAYLAND\ACTEST2
  50. Set TrusteeName RAYLAND\ACTEST2
  51. # Call IsAccessPermitted to perform acces checking. ACTEST2 should be granted access
  52. # to the object.
  53. Exec IsAccessPermitted
  54. # Call IsAccessPermitted to see if the caching mechanism works
  55. Exec IsAccessPermitted
  56. # Revoke some trustees from the ACL and see what happens....
  57. Set TrusteeName RAYLAND\ACTEST4
  58. AddTrustee TrusteeList
  59. Exec RevokeExplicitAccessRights
  60. Exec GetExplicitAccessRights
  61. Destroy TrusteeList
  62. Set Trusteename RAYLAND\ACTEST2
  63. AddTrustee TrusteeList
  64. Exec RevokeExplicitAccessRights
  65. Exec GetExplicitAccessRights
  66. # Call GetSizeMax to get the number of bytes required to dsave the ACL
  67. Exec GetSizeMax
  68. # Save the ACL to a file
  69. Exec SaveACL c:\actests\data1
  70. # Init a new ACL
  71. Exec InitNewACL
  72. # Take a look at the current ACL, it should be empty
  73. # Exec GetExplicitAccessRights
  74. # Load the ACL back from the same file
  75. Exec LoadACL c:\actests\data1
  76. # Take a look at the ACL, it should look the same as before it was saved
  77. Exec GetExplicitAccessRights
  78. # Revoke two grant ACEs to see what happens
  79. Set TrusteeName RAYLAND\ACTEST4
  80. AddTrustee TrusteeList
  81. Exec RevokeExplicitAccessRights
  82. # Take a look at the resulting ACL
  83. Exec GetExplicitAccessRights
  84. Destroy TrusteeList
  85. Set TrusteeName RAYLAND\ACTEST2
  86. AddTrustee TrusteeList
  87. Exec RevokeExplicitAccessRights
  88. # Take another peek a the resulting ACL
  89. Exec GetExplicitAccessRights
  90. # Perform access check for RAYLAND\ACTEST2 to check
  91. # if the revoking really works. RAYLAND\ACTEST2 should
  92. # be denied access to the object.
  93. Set TrusteeName RAYLAND\ACTEST2
  94. Exec IsAccessPermitted
  95. # Replace the ACL with a new one
  96. Set TrusteeName A
  97. Set AccessMode GRANT_ACCESS
  98. AddTrustee ExplicitAccessList
  99. Set TrusteeName B
  100. Set AccessMode DENY_ACCESS
  101. AddTrustee ExplicitAccessList
  102. Set TrusteeName G
  103. Set AccessMode GRANT_ACCESS
  104. AddTrustee ExplicitAccessList
  105. Set TrusteeName H
  106. Set AccessMode DENY_ACCESS
  107. AddTrustee ExplicitAccessList
  108. Set TrusteeName E
  109. Set AccessMode GRANT_ACCESS
  110. AddTrustee ExplicitAccessList
  111. Set TrusteeName K
  112. Set AccessMode DENY_ACCESS
  113. AddTrustee ExplicitAccessList
  114. Set TrusteeName F
  115. Set AccessMode GRANT_ACCESS
  116. AddTrustee ExplicitAccessList
  117. Set TrusteeName L
  118. Set AccessMode DENY_ACCESS
  119. AddTrustee ExplicitAccessList
  120. Set TrusteeName A
  121. Set AccessMode GRANT_ACCESS
  122. AddTrustee ExplicitAccessList
  123. Exec ReplaceAllAccessRights
  124. Exec GetExplicitAccessRights
  125. # Kill server and quit
  126. Quit
  127. # End of Test #1