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.

197 lines
5.3 KiB

  1. /*++
  2. Copyright (c) 2001 Microsoft Corporation
  3. Module Name:
  4. sid.cxx
  5. Abstract:
  6. Routines implementing the SID pseudo-object.
  7. Author:
  8. Cliff Van Dyke (cliffv) 8-May-2001
  9. --*/
  10. #include "pch.hxx"
  11. DWORD
  12. AzpSidInit(
  13. IN PGENERIC_OBJECT ParentGenericObject,
  14. IN PGENERIC_OBJECT ChildGenericObject
  15. )
  16. /*++
  17. Routine Description:
  18. This routine is a worker routine for AzSidCreate. It does any object specific
  19. initialization that needs to be done.
  20. On entry, AzGlResource must be locked exclusively.
  21. Arguments:
  22. ParentGenericObject - Specifies the parent object to add the child object onto.
  23. The reference count has been incremented on this object.
  24. ChildGenericObject - Specifies the newly allocated child object.
  25. The reference count has been incremented on this object.
  26. Return Value:
  27. NO_ERROR - The operation was successful
  28. ERROR_NOT_ENOUGH_MEMORY - not enough memory
  29. Other exception status codes
  30. --*/
  31. {
  32. PAZP_SID AzpSid = (PAZP_SID) ChildGenericObject;
  33. //
  34. // Initialization
  35. //
  36. ASSERT( AzpIsLockedExclusive( &AzGlResource ) );
  37. //
  38. // Behave differently depending on the object type of the parent object
  39. //
  40. ASSERT( ParentGenericObject->ObjectType == OBJECT_TYPE_AZAUTHSTORE ||
  41. ParentGenericObject->ObjectType == OBJECT_TYPE_APPLICATION ||
  42. ParentGenericObject->ObjectType == OBJECT_TYPE_SCOPE );
  43. //
  44. // Sids are referenced by groups and roles.
  45. //
  46. // Let the generic object manager know all of the lists we support
  47. //
  48. ChildGenericObject->GenericObjectLists = &AzpSid->backGroupMembers,
  49. // Sids are referenced by groups
  50. ObInitObjectList( &AzpSid->backGroupMembers,
  51. &AzpSid->backGroupNonMembers,
  52. TRUE, // backward link
  53. AZP_LINKPAIR_SID_MEMBERS,
  54. 0, // No dirty bit on back link
  55. NULL,
  56. NULL,
  57. NULL );
  58. ObInitObjectList( &AzpSid->backGroupNonMembers,
  59. &AzpSid->backRoles,
  60. TRUE, // backward link
  61. AZP_LINKPAIR_SID_NON_MEMBERS,
  62. 0, // No dirty bit on back link
  63. NULL,
  64. NULL,
  65. NULL );
  66. // Sids are referenced by "Roles"
  67. ObInitObjectList( &AzpSid->backRoles,
  68. &AzpSid->backAdmins,
  69. TRUE, // Backward link
  70. 0, // No link pair id
  71. 0, // No dirty bit on back link
  72. NULL,
  73. NULL,
  74. NULL );
  75. // Sids are referenced by object admins
  76. ObInitObjectList( &AzpSid->backAdmins,
  77. &AzpSid->backReaders,
  78. TRUE, // Backward link
  79. AZP_LINKPAIR_POLICY_ADMINS, // diff admins and readers
  80. 0, // No dirty bit on back link
  81. NULL,
  82. NULL,
  83. NULL );
  84. if ( !IsDelegatorObject( ParentGenericObject->ObjectType ) ) {
  85. // Sids are referenced by object readers
  86. ObInitObjectList( &AzpSid->backReaders,
  87. NULL,
  88. TRUE, // Backward link
  89. AZP_LINKPAIR_POLICY_READERS, // diff admins and readers
  90. 0, // No dirty bit on back link
  91. NULL,
  92. NULL,
  93. NULL );
  94. } else {
  95. // Sids are referenced by object readers
  96. ObInitObjectList( &AzpSid->backReaders,
  97. &AzpSid->backDelegatedPolicyUsers,
  98. TRUE, // Backward link
  99. AZP_LINKPAIR_POLICY_READERS, // diff admins and readers
  100. 0, // No dirty bit on back link
  101. NULL,
  102. NULL,
  103. NULL );
  104. // Sids are referenced by delegated object users
  105. ObInitObjectList( &AzpSid->backDelegatedPolicyUsers,
  106. NULL,
  107. TRUE, // Backward link
  108. AZP_LINKPAIR_DELEGATED_POLICY_USERS,
  109. 0, // No dirty bit on back link
  110. NULL,
  111. NULL,
  112. NULL );
  113. }
  114. return NO_ERROR;
  115. }
  116. VOID
  117. AzpSidFree(
  118. IN PGENERIC_OBJECT GenericObject
  119. )
  120. /*++
  121. Routine Description:
  122. This routine is a worker routine for Sid object free. It does any object specific
  123. cleanup that needs to be done.
  124. On entry, AzGlResource must be locked exclusively.
  125. Arguments:
  126. GenericObject - Specifies a pointer to the object to be deleted.
  127. Return Value:
  128. None
  129. --*/
  130. {
  131. // PAZP_SID AzpSid = (PAZP_SID) GenericObject;
  132. UNREFERENCED_PARAMETER( GenericObject );
  133. //
  134. // Initialization
  135. //
  136. ASSERT( AzpIsLockedExclusive( &AzGlResource ) );
  137. //
  138. // Free any local strings
  139. //
  140. }