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.

206 lines
4.9 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. rmaudit.c
  5. Abstract:
  6. This module contains the Reference Monitor Auditing Command Workers.
  7. These workers call functions in the Auditing sub-component to do the real
  8. work.
  9. Author:
  10. Scott Birrell (ScottBi) November 14,1991
  11. Environment:
  12. Kernel mode only.
  13. Revision History:
  14. --*/
  15. #include "pch.h"
  16. #pragma hdrstop
  17. VOID
  18. SepRmSetAuditLogWrkr(
  19. IN PRM_COMMAND_MESSAGE CommandMessage,
  20. OUT PRM_REPLY_MESSAGE ReplyMessage
  21. );
  22. #ifdef ALLOC_PRAGMA
  23. #pragma alloc_text(PAGE,SepRmSetAuditEventWrkr)
  24. #pragma alloc_text(PAGE,SepRmSetAuditLogWrkr)
  25. #endif
  26. VOID
  27. SepRmSetAuditEventWrkr(
  28. IN PRM_COMMAND_MESSAGE CommandMessage,
  29. OUT PRM_REPLY_MESSAGE ReplyMessage
  30. )
  31. /*++
  32. Routine Description:
  33. This function carries out the Reference Monitor Set Audit Event
  34. Command. This command enables or disables auditing and optionally
  35. sets the auditing events.
  36. Arguments:
  37. CommandMessage - Pointer to structure containing RM command message
  38. information consisting of an LPC PORT_MESSAGE structure followed
  39. by the command number (RmSetAuditStateCommand) and a single command
  40. parameter in structure form.
  41. ReplyMessage - Pointer to structure containing RM reply message
  42. information consisting of an LPC PORT_MESSAGE structure followed
  43. by the command ReturnedStatus field in which a status code from the
  44. command will be returned.
  45. Return Value:
  46. VOID
  47. --*/
  48. {
  49. PPOLICY_AUDIT_EVENT_OPTIONS EventAuditingOptions;
  50. POLICY_AUDIT_EVENT_TYPE EventType;
  51. PAGED_CODE();
  52. SepAdtInitializeBounds();
  53. ReplyMessage->ReturnedStatus = STATUS_SUCCESS;
  54. //
  55. // Strict check that command is correct one for this worker.
  56. //
  57. ASSERT( CommandMessage->CommandNumber == RmAuditSetCommand );
  58. //
  59. // Extract the AuditingMode flag and put it in the right place.
  60. //
  61. SepAdtAuditingEnabled = (((PLSARM_POLICY_AUDIT_EVENTS_INFO) CommandMessage->CommandParams)->
  62. AuditingMode);
  63. //
  64. // For each element in the passed array, process changes to audit
  65. // nothing, and then success or failure flags.
  66. //
  67. EventAuditingOptions = ((PLSARM_POLICY_AUDIT_EVENTS_INFO) CommandMessage->CommandParams)->
  68. EventAuditingOptions;
  69. for ( EventType=AuditEventMinType;
  70. EventType <= AuditEventMaxType;
  71. EventType++ ) {
  72. SeAuditingState[EventType].AuditOnSuccess = FALSE;
  73. SeAuditingState[EventType].AuditOnFailure = FALSE;
  74. if ( EventAuditingOptions[EventType] & POLICY_AUDIT_EVENT_SUCCESS ) {
  75. SeAuditingState[EventType].AuditOnSuccess = TRUE;
  76. }
  77. if ( EventAuditingOptions[EventType] & POLICY_AUDIT_EVENT_FAILURE ) {
  78. SeAuditingState[EventType].AuditOnFailure = TRUE;
  79. }
  80. }
  81. //
  82. // Set the flag to indicate that we're auditing detailed events.
  83. // This is merely a timesaver so we can skip auditing setup in
  84. // time critical places like process creation.
  85. //
  86. //
  87. // Despite what the UI may imply, we never audit failures for detailed events, since
  88. // none of them can fail for security related reasons, and we're not interested in
  89. // auditing out of memory errors and stuff like that. So just set this flag when
  90. // they want to see successes and ignore the failure case.
  91. //
  92. // We may have to revisit this someday.
  93. //
  94. if ( SeAuditingState[AuditCategoryDetailedTracking].AuditOnSuccess && SepAdtAuditingEnabled ) {
  95. SeDetailedAuditing = TRUE;
  96. } else {
  97. SeDetailedAuditing = FALSE;
  98. }
  99. return;
  100. }
  101. VOID
  102. SepRmSetAuditLogWrkr(
  103. IN PRM_COMMAND_MESSAGE CommandMessage,
  104. OUT PRM_REPLY_MESSAGE ReplyMessage
  105. )
  106. /*++
  107. Routine Description:
  108. This function carries out the Reference Monitor Set Audit Log
  109. Command. This command stores parameters related to the Audit Log.
  110. Arguments:
  111. CommandMessage - Pointer to structure containing RM command message
  112. information consisting of an LPC PORT_MESSAGE structure followed
  113. by the command number (RmSetAuditStateCommand) and a single command
  114. parameter in structure form.
  115. ReplyMessage - Pointer to structure containing RM reply message
  116. information consisting of an LPC PORT_MESSAGE structure followed
  117. by the command ReturnedStatus field in which a status code from the
  118. command will be returned.
  119. Return Value:
  120. None. A status code is returned in ReplyMessage->ReturnedStatus
  121. --*/
  122. {
  123. PAGED_CODE();
  124. #if DBG
  125. DbgPrint("Security: RM Set Audit Log Command Received\n");
  126. #endif
  127. //
  128. // Call private function in Auditing Sub-component to do the work.
  129. //
  130. SepAdtSetAuditLogInformation(
  131. (PPOLICY_AUDIT_LOG_INFO) CommandMessage->CommandParams
  132. );
  133. ReplyMessage->ReturnedStatus = STATUS_SUCCESS;
  134. }