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.

155 lines
3.9 KiB

  1. //+-------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997 - 1997.
  5. //
  6. // File: lucache.h
  7. //
  8. // Contents: Name/Sid and Name/Property mapping and cache
  9. // functions and declarations
  10. //
  11. // History: 2-Feb-97 MacM Created
  12. //
  13. //--------------------------------------------------------------------
  14. #ifndef __LUCACHE_H__
  15. #define __LUCACHE_H__
  16. #include <winldap.h>
  17. #include <accctrl.h>
  18. typedef struct _ACTRL_NAME_CACHE
  19. {
  20. PWSTR pwszName;
  21. PSID pSid;
  22. SID_NAME_USE SidUse;
  23. struct _ACTRL_NAME_CACHE *pNextName;
  24. struct _ACTRL_NAME_CACHE *pNextSid;
  25. } ACTRL_NAME_CACHE, *PACTRL_NAME_CACHE;
  26. #define ACTRL_NAME_TABLE_SIZE 15
  27. //
  28. // Comment this out to use the LSA routines directly for every lookup
  29. //
  30. #define USE_NAME_CACHE
  31. #define ACTRL_OBJ_ID_TABLE_SIZE 100
  32. #ifndef PGUID
  33. typedef GUID *PGUID;
  34. #endif
  35. typedef struct _ACTRL_OBJ_ID_CACHE
  36. {
  37. PWSTR pwszName;
  38. GUID Guid;
  39. struct _ACTRL_OBJ_ID_CACHE *pNextName;
  40. struct _ACTRL_OBJ_ID_CACHE *pNextGuid;
  41. } ACTRL_OBJ_ID_CACHE, *PACTRL_OBJ_ID_CACHE;
  42. //
  43. // This supports the control rights cache.
  44. typedef struct _ACTRL_RIGHTS_CACHE
  45. {
  46. GUID ObjectClassGuid;
  47. ULONG cRights;
  48. PWSTR *RightsList;
  49. struct _ACTRL_RIGHTS_CACHE *pNext;
  50. }
  51. ACTRL_RIGHTS_CACHE, *PACTRL_RIGHTS_CACHE;
  52. //
  53. // Information on the last access to the DS
  54. //
  55. typedef struct _ACTRL_ID_SCHEMA_INFO
  56. {
  57. LDAP LDAP;
  58. BOOL fLDAP;
  59. PWSTR pwszPath;
  60. DWORD LastReadTime;
  61. } ACTRL_ID_SCHEMA_INFO, *PACTRL_ID_SCHEMA_INFO;
  62. //
  63. // Keep the name and sid caches in synch.
  64. // Nodes are only inserted into the name cache, and are merely referenced
  65. // by the sid cache.
  66. extern PACTRL_NAME_CACHE grgNameCache[ACTRL_NAME_TABLE_SIZE];
  67. extern PACTRL_NAME_CACHE grgSidCache[ACTRL_NAME_TABLE_SIZE];
  68. extern PACTRL_OBJ_ID_CACHE grgIdNameCache[ACTRL_OBJ_ID_TABLE_SIZE];
  69. extern PACTRL_OBJ_ID_CACHE grgIdGuidCache[ACTRL_OBJ_ID_TABLE_SIZE];
  70. extern PACTRL_RIGHTS_CACHE grgRightsNameCache[ACTRL_OBJ_ID_TABLE_SIZE];
  71. INT
  72. ActrlHashName(PWSTR pwszName);
  73. INT
  74. ActrlHashSid(PSID pSid);
  75. DWORD
  76. AccctrlInitializeSidNameCache(VOID);
  77. VOID
  78. AccctrlFreeSidNameCache(VOID);
  79. DWORD
  80. AccctrlLookupName(IN PWSTR pwszServer,
  81. IN PSID pSid,
  82. IN BOOL fAllocateReturn,
  83. OUT PWSTR *ppwszName,
  84. OUT PSID_NAME_USE pSidNameUse);
  85. DWORD
  86. AccctrlLookupSid(IN PWSTR pwszServer,
  87. IN PWSTR pwszName,
  88. IN BOOL fAllocateReturn,
  89. OUT PSID *ppSid,
  90. OUT PSID_NAME_USE pSidNameUse);
  91. INT
  92. ActrlHashIdName(PWSTR pwszName);
  93. INT
  94. ActrlHashGuid(PGUID pGuid);
  95. DWORD
  96. AccctrlInitializeIdNameCache(VOID);
  97. VOID
  98. AccctrlFreeIdNameCache(VOID);
  99. DWORD
  100. AccctrlLookupIdName(IN PLDAP pLDAP,
  101. IN PWSTR pwszDsPath,
  102. IN PGUID pGuid,
  103. IN BOOL fAllocateReturn,
  104. IN BOOL fFailUnknownGuid,
  105. OUT PWSTR *ppwszIdName);
  106. DWORD
  107. AccctrlLookupGuid(IN PLDAP pLDAP,
  108. IN PWSTR pwszDsPath,
  109. IN PWSTR pwszName,
  110. IN BOOL fAllocateReturn,
  111. OUT PGUID *ppGuid);
  112. //
  113. // Control rights lookup
  114. //
  115. DWORD
  116. AccctrlInitializeRightsCache(VOID);
  117. VOID
  118. AccctrlFreeRightsCache(VOID);
  119. DWORD
  120. AccctrlLookupRightsByName(IN PLDAP pLDAP,
  121. IN PWSTR pwszDsPath,
  122. IN PWSTR pwszName,
  123. OUT PULONG pCount,
  124. OUT PACTRL_CONTROL_INFOW *ControlInfo);
  125. #endif