Source code of Windows XP (NT5)
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.

286 lines
7.3 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. adt.h
  5. Abstract:
  6. Local Security Authority - Audit Log Management - Public Defines,
  7. data and function prototypes.
  8. Functions, data and defines in this module are exported to the
  9. whole of the Lsa subsystem from the Auditing Sub-component.
  10. Author:
  11. Scott Birrell (ScottBi) November 20, 1991
  12. Environment:
  13. Revision History:
  14. --*/
  15. #ifndef _ADT_H
  16. #define _ADT_H
  17. //
  18. // Initialization Pass for Auditing.
  19. //
  20. extern ULONG LsapAdtInitializationPass;
  21. //
  22. // Audit Log Information. This must be kept in sync with the information
  23. // in the Lsa Database.
  24. //
  25. extern POLICY_AUDIT_LOG_INFO LsapAdtLogInformation;
  26. extern LSARM_POLICY_AUDIT_EVENTS_INFO LsapAdtEventsInformation;
  27. //
  28. // Audit Log Full Information.
  29. //
  30. extern POLICY_AUDIT_FULL_QUERY_INFO LsapAdtLogFullInformation;
  31. //
  32. // Audit Log Maximum Record Id. Audit Records are numbered serially until
  33. // this limit is reached, then numbering wraps to 0.
  34. //
  35. #define LSAP_ADT_MAXIMUM_RECORD_ID (0x7fffffffL)
  36. //
  37. // Options for LsapAdtQueryAuditLogFullInfo
  38. //
  39. #define LSAP_ADT_LOG_FULL_UPDATE ((ULONG)(0x00000001L))
  40. NTSTATUS
  41. LsapAdtWriteLogWrkr(
  42. IN PLSA_COMMAND_MESSAGE CommandMessage,
  43. OUT PLSA_REPLY_MESSAGE ReplyMessage
  44. );
  45. NTSTATUS
  46. LsapAdtSetInfoLog(
  47. IN LSAPR_HANDLE PolicyHandle,
  48. IN PPOLICY_AUDIT_LOG_INFO PolicyAuditLogInfo
  49. );
  50. NTSTATUS
  51. LsapAdtInitialize(
  52. );
  53. NTSTATUS
  54. LsapAdtInitializeDefaultAuditing(
  55. IN ULONG Options,
  56. OUT PLSARM_POLICY_AUDIT_EVENTS_INFO AuditEventsInformation
  57. );
  58. VOID
  59. LsapAdtAuditingLogon(
  60. PLSARM_POLICY_AUDIT_EVENTS_INFO AuditEventsInfo
  61. );
  62. VOID
  63. LsapAdtAuditPackageLoad(
  64. PUNICODE_STRING PackageFileName
  65. );
  66. VOID
  67. LsapAdtGenerateLsaAuditSystemAccessChange(
  68. IN USHORT EventCategory,
  69. IN ULONG EventID,
  70. IN USHORT EventType,
  71. IN PSID ClientSid,
  72. IN LUID CallerAuthenticationId,
  73. IN PSID TargetSid,
  74. IN PCWSTR szSystemAccess
  75. );
  76. NTSTATUS
  77. LsapAdtGenerateLsaAuditEvent(
  78. IN LSAPR_HANDLE ObjectHandle,
  79. IN ULONG AuditEventCategory,
  80. IN ULONG AuditEventId,
  81. IN PPRIVILEGE_SET Privileges,
  82. IN ULONG SidCount,
  83. IN PSID *Sids OPTIONAL,
  84. IN ULONG UnicodeStringCount,
  85. IN PUNICODE_STRING UnicodeStrings OPTIONAL,
  86. IN PLSARM_POLICY_AUDIT_EVENTS_INFO PolicyAuditEventsInfo OPTIONAL
  87. );
  88. NTSTATUS
  89. LsapAdtTrustedDomainAdd(
  90. IN USHORT EventType,
  91. IN PUNICODE_STRING pName,
  92. IN PSID pSid,
  93. IN ULONG Type,
  94. IN ULONG Direction,
  95. IN ULONG Attributes
  96. );
  97. NTSTATUS
  98. LsapAdtTrustedDomainRem(
  99. IN USHORT EventType,
  100. IN PUNICODE_STRING pName,
  101. IN PSID pSid,
  102. IN PSID pClientSid,
  103. IN PLUID pClientAuthId
  104. );
  105. NTSTATUS
  106. LsapAdtTrustedDomainMod(
  107. IN USHORT EventType,
  108. IN PSID pDomainSid,
  109. IN PUNICODE_STRING pOldName,
  110. IN ULONG OldType,
  111. IN ULONG OldDirection,
  112. IN ULONG OldAttributes,
  113. IN PUNICODE_STRING pNewName,
  114. IN ULONG NewType,
  115. IN ULONG NewDirection,
  116. IN ULONG NewAttributes
  117. );
  118. NTSTATUS
  119. LsapAdtGenerateLsaAuditEventWithClientSid(
  120. IN ULONG AuditEventCategory,
  121. IN ULONG AuditEventId,
  122. IN PSID ClientSid,
  123. IN LUID ClientAuthenticationId,
  124. IN PPRIVILEGE_SET Privileges,
  125. IN ULONG SidCount,
  126. IN PSID *Sids OPTIONAL,
  127. IN ULONG UnicodeStringCount,
  128. IN PUNICODE_STRING UnicodeStrings OPTIONAL,
  129. IN PLSARM_POLICY_AUDIT_EVENTS_INFO PolicyAuditEventsInfo OPTIONAL
  130. );
  131. typedef enum _OBJECT_OPERATION_TYPE {
  132. ObjectOperationNone=0,
  133. ObjectOperationQuery,
  134. ObjectOperationDummyLast
  135. } OBJECT_OPERATION_TYPE;
  136. NTSTATUS
  137. LsapAdtGenerateObjectOperationAuditEvent(
  138. IN LSAPR_HANDLE ObjectHandle,
  139. IN USHORT AuditEventType,
  140. IN OBJECT_OPERATION_TYPE OperationType
  141. );
  142. NTSTATUS
  143. LsapAdtGenerateDomainPolicyChangeAuditEvent(
  144. IN POLICY_DOMAIN_INFORMATION_CLASS InformationClass,
  145. IN USHORT AuditEventType,
  146. IN LSAP_DB_ATTRIBUTE* OldAttributes,
  147. IN LSAP_DB_ATTRIBUTE* NewAttributes,
  148. IN ULONG AttributeCount
  149. );
  150. BOOLEAN
  151. LsapAdtIsAuditingEnabledForCategory(
  152. IN POLICY_AUDIT_EVENT_TYPE AuditCategory,
  153. IN UINT AuditEventType
  154. );
  155. NTSTATUS
  156. LsapAdtTrustedForestNamespaceCollision(
  157. IN LSA_FOREST_TRUST_COLLISION_RECORD_TYPE CollisionTargetType,
  158. IN PUNICODE_STRING pCollisionTargetName,
  159. IN PUNICODE_STRING pForestRootDomainName,
  160. IN PUNICODE_STRING pTopLevelName,
  161. IN PUNICODE_STRING pDnsName,
  162. IN PUNICODE_STRING pNetbiosName,
  163. IN PSID pSid,
  164. IN ULONG NewFlags
  165. );
  166. NTSTATUS
  167. LsapAdtTrustedForestInfoEntryAdd(
  168. IN PUNICODE_STRING pForestRootDomainName,
  169. IN PSID pForestRootDomainSid,
  170. IN PLUID pOperationId,
  171. IN LSA_FOREST_TRUST_RECORD_TYPE EntryType,
  172. IN ULONG Flags,
  173. IN PUNICODE_STRING TopLevelName,
  174. IN PUNICODE_STRING DnsName,
  175. IN PUNICODE_STRING NetbiosName,
  176. IN PSID pSid
  177. );
  178. NTSTATUS
  179. LsapAdtTrustedForestInfoEntryRem(
  180. IN PUNICODE_STRING pForestRootDomainName,
  181. IN PSID pForestRootDomainSid,
  182. IN PLUID pOperationId,
  183. IN LSA_FOREST_TRUST_RECORD_TYPE EntryType,
  184. IN ULONG Flags,
  185. IN PUNICODE_STRING TopLevelName,
  186. IN PUNICODE_STRING DnsName,
  187. IN PUNICODE_STRING NetbiosName,
  188. IN PSID pSid
  189. );
  190. NTSTATUS
  191. LsapAdtTrustedForestInfoEntryMod(
  192. IN PUNICODE_STRING pForestRootDomainName,
  193. IN PSID pForestRootDomainSid,
  194. IN PLUID pOperationId,
  195. IN LSA_FOREST_TRUST_RECORD_TYPE EntryType,
  196. IN ULONG OldFlags,
  197. IN PUNICODE_STRING pOldTopLevelName,
  198. IN PUNICODE_STRING pOldDnsName,
  199. IN PUNICODE_STRING pOldNetbiosName,
  200. IN PSID pOldSid,
  201. IN ULONG NewFlags,
  202. IN PUNICODE_STRING pNewTopLevelName,
  203. IN PUNICODE_STRING pNewDnsName,
  204. IN PUNICODE_STRING pNewNetbiosName,
  205. IN PSID pNewSid
  206. );
  207. #define LsapAdtAuditingEnabled() \
  208. (LsapAdtEventsInformation.AuditingMode)
  209. #define LsapAdtAuditingPolicyChanges() \
  210. (LsapAdtAuditingEnabled() && \
  211. (LsapAdtEventsInformation.EventAuditingOptions[ AuditCategoryPolicyChange ] & POLICY_AUDIT_EVENT_SUCCESS))
  212. //
  213. // Macro to determine the size of a PRIVILEGE_SET
  214. //
  215. #define LsapPrivilegeSetSize( PrivilegeSet ) \
  216. ( ( PrivilegeSet ) == NULL ? 0 : \
  217. ((( PrivilegeSet )->PrivilegeCount > 0) \
  218. ? \
  219. ((ULONG)sizeof(PRIVILEGE_SET) + \
  220. ( \
  221. (( PrivilegeSet )->PrivilegeCount - ANYSIZE_ARRAY) * \
  222. (ULONG)sizeof(LUID_AND_ATTRIBUTES) \
  223. ) \
  224. ) \
  225. : ((ULONG)sizeof(PRIVILEGE_SET) - (ULONG)sizeof(LUID_AND_ATTRIBUTES)) \
  226. ))
  227. #endif // _ADT_H