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.

245 lines
7.9 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997 - 1999
  6. //
  7. // File: schemap.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _SCHEMAP_H_
  11. #define _SCHEMAP_H_
  12. //
  13. //Purpose contains all the attributes of an objecttype
  14. //
  15. typedef struct _OBJECT_TYPE_CACHE
  16. {
  17. GUID guidObject;
  18. DWORD flags;
  19. HDPA hListProperty; //List of Property of the objecttype
  20. HDPA hListExtRights; //List of Extended Rights of the objecttype
  21. HDPA hListPropertySet; //List of PropertySet of the objecttype
  22. HDPA hListChildObject; //List of Child Classes of the objecttype
  23. }OBJECT_TYPE_CACHE,*POBJECT_TYPE_CACHE;
  24. #define OTC_PROP 0x00000001 //hListProperty is present.
  25. #define OTC_EXTR 0x00000002 //hListExtRights,hListPropertySet is present
  26. #define OTC_COBJ 0x00000004 //hListChildObject is present
  27. typedef struct _ER_ENTRY
  28. {
  29. GUID guid;
  30. DWORD mask;
  31. DWORD dwFlags;
  32. WCHAR szName[ANYSIZE_ARRAY];
  33. } ER_ENTRY, *PER_ENTRY;
  34. typedef struct _PROP_ENTRY
  35. {
  36. GUID *pguid;
  37. GUID *pasguid;
  38. DWORD dwFlags;
  39. WCHAR szName[ANYSIZE_ARRAY];
  40. }PROP_ENTRY,*PPROP_ENTRY;
  41. //
  42. // Structures used by the cache
  43. //
  44. typedef struct _IdCacheEntry
  45. {
  46. GUID guid;
  47. GUID asGuid; //attributeSecurityGuid, Present only for properties.
  48. BOOL bAuxClass;
  49. WCHAR szLdapName[ANYSIZE_ARRAY];
  50. } ID_CACHE_ENTRY, *PID_CACHE_ENTRY;
  51. typedef struct _InheritTypeArray
  52. {
  53. GUID guidObjectType;
  54. DWORD dwFlags;
  55. ULONG cInheritTypes;
  56. SI_INHERIT_TYPE aInheritType[ANYSIZE_ARRAY];
  57. } INHERIT_TYPE_ARRAY, *PINHERIT_TYPE_ARRAY;
  58. typedef struct _AccessArray
  59. {
  60. GUID guidObjectType;
  61. DWORD dwFlags;
  62. ULONG cAccesses;
  63. ULONG iDefaultAccess;
  64. SI_ACCESS aAccess[ANYSIZE_ARRAY];
  65. } ACCESS_ARRAY, *PACCESS_ARRAY;
  66. //
  67. // CSchemaCache object definition
  68. //
  69. class CSchemaCache
  70. {
  71. protected:
  72. BSTR m_strSchemaSearchPath;
  73. BSTR m_strERSearchPath;
  74. BSTR m_strFilterFile;
  75. //
  76. //Cache of all classes in schema
  77. //
  78. HDPA m_hClassCache;
  79. //
  80. //Cache of all attributes in schema
  81. //
  82. HDPA m_hPropertyCache;
  83. HANDLE m_hClassThread;
  84. HANDLE m_hPropertyThread;
  85. HRESULT m_hrClassResult;
  86. HRESULT m_hrPropertyResult;
  87. PINHERIT_TYPE_ARRAY m_pInheritTypeArray;
  88. //
  89. //Cache for each objecttype. Contains lists of
  90. //childclasses, propsets, extRigts, & properties
  91. //
  92. //
  93. HDPA m_hObjectTypeCache;
  94. //
  95. //Cache of ACCESS_RIGHT for each object type
  96. //
  97. HDPA m_hAccessInfoCache;
  98. //
  99. //This ACCESS_RIGHT is used if SCHEMA_COMMON_PERM flag is present
  100. //
  101. ACCESS_INFO m_AICommon;
  102. CRITICAL_SECTION m_ObjectTypeCacheCritSec;
  103. int m_nDsListObjectEnforced;
  104. HANDLE m_hLoadLibPropWaitEvent;
  105. HANDLE m_hLoadLibClassWaitEvent;
  106. AUTHZ_RESOURCE_MANAGER_HANDLE m_ResourceManager; //Used for access check
  107. public:
  108. CSchemaCache(LPCWSTR pszServer);
  109. ~CSchemaCache();
  110. LPCWSTR GetClassName(LPCGUID pguidObjectType);
  111. HRESULT GetInheritTypes(LPCGUID pguidObjectType,
  112. DWORD dwFlags,
  113. PSI_INHERIT_TYPE *ppInheritTypes,
  114. ULONG *pcInheritTypes);
  115. HRESULT GetAccessRights(LPCGUID pguidObjectType,
  116. LPCWSTR pszClassName,
  117. HDPA pAuxList,
  118. LPCWSTR pszSchemaPath,
  119. DWORD dwFlags,
  120. PACCESS_INFO* ppAccesInfo);
  121. HRESULT GetDefaultSD( GUID *pSchemaIDGuid,
  122. PSID pDomainSid,
  123. PSID pRootDomainSid,
  124. PSECURITY_DESCRIPTOR * ppSD = NULL );
  125. HRESULT GetObjectTypeList(GUID *pSchamaGuid,
  126. HDPA hAuxList,
  127. LPCWSTR pszSchemaPath,
  128. DWORD dwFlags,
  129. POBJECT_TYPE_LIST *ppObjectTypeList ,
  130. DWORD * pObjectTypeListCount );
  131. AUTHZ_RESOURCE_MANAGER_HANDLE GetAuthzRM(){ return m_ResourceManager; }
  132. HRESULT LookupClassID(LPCWSTR pszClass, LPGUID pGuid);
  133. protected:
  134. HRESULT WaitOnClassThread()
  135. { WaitOnThread(&m_hClassThread); return m_hrClassResult; }
  136. HRESULT WaitOnPropertyThread()
  137. { WaitOnThread(&m_hPropertyThread); return m_hrPropertyResult; }
  138. private:
  139. PID_CACHE_ENTRY LookupID(HDPA hCache, LPCWSTR pszLdapName);
  140. PID_CACHE_ENTRY LookupClass(LPCGUID pguidObjectType);
  141. LPCGUID LookupPropertyID(LPCWSTR pszProperty);
  142. BOOL IsAuxClass(LPCGUID pguidObjectType);
  143. int GetListObjectEnforced(void);
  144. BOOL HideListObjectAccess(void);
  145. HRESULT BuildAccessArray(LPCGUID pguidObjectType,
  146. LPCWSTR pszClassName,
  147. LPCWSTR pszSchemaPath,
  148. HDPA hAuxList,
  149. DWORD dwFlags,
  150. PSI_ACCESS *ppAccesses,
  151. ULONG *pcAccesses,
  152. ULONG *piDefaultAccess);
  153. HRESULT EnumVariantList(LPVARIANT pvarList,
  154. HDPA hTempList,
  155. DWORD dwFlags,
  156. IDsDisplaySpecifier *pDisplaySpec,
  157. LPCWSTR pszPropertyClass,
  158. BOOL bObjectTypeList);
  159. UINT AddTempListToAccessList(HDPA hTempList,
  160. PSI_ACCESS *ppAccess,
  161. LPWSTR *ppszData,
  162. DWORD dwAccessFlags,
  163. DWORD dwFlags,
  164. BOOL bPropSet);
  165. static DWORD WINAPI SchemaClassThread(LPVOID pvThreadData);
  166. static DWORD WINAPI SchemaPropertyThread(LPVOID pvThreadData);
  167. HRESULT BuildInheritTypeArray(DWORD dwFlags);
  168. HRESULT
  169. GetExtendedRightsForNClasses(IN LPWSTR pszSchemaSearchPath,
  170. IN LPCGUID pguidClass,
  171. IN HDPA hAuxList,
  172. OUT HDPA *phERList,
  173. OUT HDPA *phPropSetList);
  174. HRESULT
  175. GetChildClassesForNClasses(IN LPCGUID pguidObjectType,
  176. IN LPCWSTR pszClassName,
  177. IN HDPA hAuxList,
  178. IN LPCWSTR pszSchemaPath,
  179. OUT HDPA *phChildList);
  180. HRESULT
  181. GetPropertiesForNClasses(IN LPCGUID pguidObjectType,
  182. IN LPCWSTR pszClassName,
  183. IN HDPA hAuxList,
  184. IN LPCWSTR pszSchemaPath,
  185. OUT HDPA *phPropertyList);
  186. HRESULT
  187. GetExtendedRightsForOneClass(IN LPWSTR pszSchemaSearchPath,
  188. IN LPCGUID pguidClass,
  189. OUT HDPA *phERList,
  190. OUT HDPA *phPropSetList);
  191. HRESULT
  192. GetChildClassesForOneClass(IN LPCGUID pguidObjectType,
  193. IN LPCWSTR pszClassName,
  194. IN LPCWSTR pszSchemaPath,
  195. OUT HDPA *phChildList);
  196. HRESULT
  197. GetPropertiesForOneClass(IN LPCGUID pguidObjectType,
  198. IN LPCWSTR pszClassName,
  199. IN LPCWSTR pszSchemaPath,
  200. OUT HDPA *phPropertyList);
  201. };
  202. typedef CSchemaCache *PSCHEMACACHE;
  203. extern PSCHEMACACHE g_pSchemaCache;
  204. #endif // _SCHEMAP_H_