Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

rmp.h File Reference

#include <nt.h>
#include <ntlsa.h>
#include "sep.h"

Go to the source code of this file.

Classes

struct  _SEP_RM_STATE
struct  _SEP_RM_CONNECT_INFO
struct  _SEP_LOGON_SESSION_REFERENCES
struct  _SEP_LOGON_SESSION_TERMINATED_NOTIFICATION

Defines

#define SEP_LOGON_TRACK_INDEX_MASK   (0x0000000FL)
#define SEP_LOGON_TRACK_ARRAY_SIZE   (0x00000010L)
#define SepRmAcquireDbReadLock()
#define SepRmAcquireDbWriteLock()
#define SepRmReleaseDbReadLock()
#define SepRmReleaseDbWriteLock()
#define SEP_RM_LSA_SHARED_MEMORY_SIZE   ((ULONG) PAGE_SIZE)
#define SEP_RM_COMMAND_MAX   4
#define SEP_TERMINATION_NOTIFY   0x1

Typedefs

typedef _SEP_RM_STATE SEP_RM_STATE
typedef _SEP_RM_STATEPSEP_RM_STATE
typedef _SEP_RM_CONNECT_INFO SEP_RM_CONNECT_INFO
typedef SEP_RM_CONNECT_INFOPSEP_RM_CONNECT_INFO
typedef VOID(* SEP_RM_COMMAND_WORKER )(PRM_COMMAND_MESSAGE, PRM_REPLY_MESSAGE)
typedef _SEP_LOGON_SESSION_REFERENCES SEP_LOGON_SESSION_REFERENCES
typedef _SEP_LOGON_SESSION_REFERENCESPSEP_LOGON_SESSION_REFERENCES
typedef _SEP_LOGON_SESSION_TERMINATED_NOTIFICATION SEP_LOGON_SESSION_TERMINATED_NOTIFICATION
typedef _SEP_LOGON_SESSION_TERMINATED_NOTIFICATIONPSEP_LOGON_SESSION_TERMINATED_NOTIFICATION

Functions

BOOLEAN SepRmDbInitialization (VOID)
VOID SepRmCommandServerThread (IN PVOID StartContext)
BOOLEAN SepRmCommandServerThreadInit ()
VOID SepRmComponentTestCommandWrkr (IN PRM_COMMAND_MESSAGE CommandMessage, OUT PRM_REPLY_MESSAGE ReplyMessage)
VOID SepRmSetAuditEventWrkr (IN PRM_COMMAND_MESSAGE CommandMessage, OUT PRM_REPLY_MESSAGE ReplyMessage)
VOID SepRmSendCommandToLsaWrkr (IN PRM_COMMAND_MESSAGE CommandMessage, OUT PRM_REPLY_MESSAGE ReplyMessage)
VOID SepRmCreateLogonSessionWrkr (IN PRM_COMMAND_MESSAGE CommandMessage, OUT PRM_REPLY_MESSAGE ReplyMessage)
VOID SepRmDeleteLogonSessionWrkr (IN PRM_COMMAND_MESSAGE CommandMessage, OUT PRM_REPLY_MESSAGE ReplyMessage)
NTSTATUS SepCreateLogonSessionTrack (IN PLUID LogonId)
NTSTATUS SepDeleteLogonSessionTrack (IN PLUID LogonId)

Variables

SEP_LOGON_SESSION_TERMINATED_NOTIFICATION SeFileSystemNotifyRoutinesHead
PEPROCESS SepRmLsaCallProcess
SEP_RM_STATE SepRmState
ERESOURCE SepRmDbLock
PSEP_LOGON_SESSION_REFERENCESSepLogonSessions


Define Documentation

#define SEP_LOGON_TRACK_ARRAY_SIZE   (0x00000010L)
 

Definition at line 41 of file rmp.h.

Referenced by SepRmDbInitialization().

#define SEP_LOGON_TRACK_INDEX_MASK   (0x0000000FL)
 

Definition at line 40 of file rmp.h.

#define SEP_RM_COMMAND_MAX   4
 

Definition at line 116 of file rmp.h.

#define SEP_RM_LSA_SHARED_MEMORY_SIZE   ((ULONG) PAGE_SIZE)
 

Definition at line 76 of file rmp.h.

Referenced by SepRmCallLsa().

#define SEP_TERMINATION_NOTIFY   0x1
 

Definition at line 134 of file rmp.h.

Referenced by SeMarkLogonSessionForTerminationNotification(), and SepDeReferenceLogonSession().

 
#define SepRmAcquireDbReadLock  ) 
 

Value:

Definition at line 57 of file rmp.h.

Referenced by SepNotifyFileSystems().

 
#define SepRmAcquireDbWriteLock  ) 
 

Value:

Definition at line 60 of file rmp.h.

Referenced by SeMarkLogonSessionForTerminationNotification(), SepAdtSetAuditLogInformation(), SepCreateLogonSessionTrack(), SepDeleteLogonSessionTrack(), SepDeReferenceLogonSession(), SepReferenceLogonSession(), SeRegisterLogonSessionTerminatedRoutine(), and SeUnregisterLogonSessionTerminatedRoutine().

 
#define SepRmReleaseDbReadLock  ) 
 

Value:

Definition at line 63 of file rmp.h.

Referenced by SepNotifyFileSystems().

 
#define SepRmReleaseDbWriteLock  ) 
 

Value:

Definition at line 66 of file rmp.h.

Referenced by SeMarkLogonSessionForTerminationNotification(), SepAdtSetAuditLogInformation(), SepCreateLogonSessionTrack(), SepDeleteLogonSessionTrack(), SepDeReferenceLogonSession(), SepReferenceLogonSession(), SeRegisterLogonSessionTerminatedRoutine(), and SeUnregisterLogonSessionTerminatedRoutine().


Typedef Documentation

typedef struct _SEP_LOGON_SESSION_REFERENCES * PSEP_LOGON_SESSION_REFERENCES
 

Referenced by SepReferenceLogonSession().

typedef struct _SEP_LOGON_SESSION_TERMINATED_NOTIFICATION * PSEP_LOGON_SESSION_TERMINATED_NOTIFICATION
 

Referenced by SeRegisterLogonSessionTerminatedRoutine().

typedef struct SEP_RM_CONNECT_INFO* PSEP_RM_CONNECT_INFO
 

Definition at line 109 of file rmp.h.

typedef struct _SEP_RM_STATE * PSEP_RM_STATE
 

typedef struct _SEP_LOGON_SESSION_REFERENCES SEP_LOGON_SESSION_REFERENCES
 

Referenced by SepCreateLogonSessionTrack().

typedef struct _SEP_LOGON_SESSION_TERMINATED_NOTIFICATION SEP_LOGON_SESSION_TERMINATED_NOTIFICATION
 

typedef VOID(* SEP_RM_COMMAND_WORKER)(PRM_COMMAND_MESSAGE, PRM_REPLY_MESSAGE)
 

Definition at line 118 of file rmp.h.

typedef struct _SEP_RM_CONNECT_INFO SEP_RM_CONNECT_INFO
 

Referenced by SeRmInitPhase1().

typedef struct _SEP_RM_STATE SEP_RM_STATE
 


Function Documentation

NTSTATUS SepCreateLogonSessionTrack IN PLUID  LogonId  ) 
 

Definition at line 541 of file rmlogon.c.

References ExAllocatePoolWithTag, ExFreePool(), _SEP_LOGON_SESSION_REFERENCES::LogonId, _SEP_LOGON_SESSION_REFERENCES::Next, NULL, PAGED_CODE, PagedPool, _SEP_LOGON_SESSION_REFERENCES::ReferenceCount, RtlEqualLuid(), SEP_LOGON_SESSION_REFERENCES, SepLogonSessionIndex, SepLogonSessions, SepRmAcquireDbWriteLock, and SepRmReleaseDbWriteLock.

Referenced by SepRmCreateLogonSessionWrkr(), and SepRmDbInitialization().

00547 : 00548 00549 This routine creates a new logon session tracking record. 00550 00551 This should only be called as a dispatch routine for a LSA->RM 00552 call (and once during system initialization). 00553 00554 If the specified logon session already exists, then an error is returned. 00555 00556 00557 00558 Arguments: 00559 00560 LogonId - Pointer to the logon session ID for which a new logon track is 00561 to be created. 00562 00563 Return Value: 00564 00565 STATUS_SUCCESS - The logon session track was created successfully. 00566 00567 STATUS_LOGON_SESSION_EXISTS - The logon session already exists. 00568 A new one has not been created. 00569 00570 --*/ 00571 00572 { 00573 00574 ULONG SessionArrayIndex; 00575 PSEP_LOGON_SESSION_REFERENCES Previous, Current; 00576 PSEP_LOGON_SESSION_REFERENCES LogonSessionTrack; 00577 00578 PAGED_CODE(); 00579 00580 // 00581 // Make sure we can allocate a new logon session track record 00582 // 00583 00584 LogonSessionTrack = (PSEP_LOGON_SESSION_REFERENCES) 00585 ExAllocatePoolWithTag( 00586 PagedPool, 00587 sizeof(SEP_LOGON_SESSION_REFERENCES), 00588 'sLeS' 00589 ); 00590 00591 if (LogonSessionTrack == NULL) { 00592 return STATUS_INSUFFICIENT_RESOURCES; 00593 } 00594 00595 LogonSessionTrack->LogonId = (*LogonId); 00596 LogonSessionTrack->ReferenceCount = 0; 00597 00598 00599 00600 SessionArrayIndex = SepLogonSessionIndex( LogonId ); 00601 00602 // 00603 // Protect modification of reference monitor database 00604 // 00605 00606 SepRmAcquireDbWriteLock(); 00607 00608 00609 // 00610 // Now walk the list for our logon session array hash index 00611 // looking for a duplicate logon session ID. 00612 // 00613 00614 Previous = (PSEP_LOGON_SESSION_REFERENCES) 00615 ((PVOID)&SepLogonSessions[ SessionArrayIndex ]); 00616 Current = Previous->Next; 00617 00618 while (Current != NULL) { 00619 00620 if (RtlEqualLuid( LogonId, &Current->LogonId) ) { 00621 00622 // 00623 // One already exists. Hmmm. 00624 // 00625 00626 SepRmReleaseDbWriteLock(); 00627 ExFreePool(LogonSessionTrack); 00628 return STATUS_LOGON_SESSION_EXISTS; 00629 00630 } 00631 00632 Previous = Current; 00633 Current = Current->Next; 00634 } 00635 00636 00637 // 00638 // Reached the end of the list without finding a duplicate. 00639 // Add the new one. 00640 // 00641 00642 LogonSessionTrack->Next = SepLogonSessions[ SessionArrayIndex ]; 00643 SepLogonSessions[ SessionArrayIndex ] = LogonSessionTrack; 00644 00645 00646 00647 00648 SepRmReleaseDbWriteLock(); 00649 return STATUS_SUCCESS; 00650 00651 }

NTSTATUS SepDeleteLogonSessionTrack IN PLUID  LogonId  ) 
 

Definition at line 655 of file rmlogon.c.

References ExFreePool(), _SEP_LOGON_SESSION_REFERENCES::LogonId, _SEP_LOGON_SESSION_REFERENCES::Next, NULL, PAGED_CODE, _SEP_LOGON_SESSION_REFERENCES::ReferenceCount, RtlEqualLuid(), SepLogonSessionIndex, SepLogonSessions, SepRmAcquireDbWriteLock, and SepRmReleaseDbWriteLock.

Referenced by SepRmDeleteLogonSessionWrkr().

00661 : 00662 00663 This routine creates a new logon session tracking record. 00664 00665 This should only be called as a dispatch routine for a LSA->RM 00666 call (and once during system initialization). 00667 00668 If the specified logon session already exists, then an error is returned. 00669 00670 00671 00672 Arguments: 00673 00674 LogonId - Pointer to the logon session ID whose logon track is 00675 to be deleted. 00676 00677 Return Value: 00678 00679 STATUS_SUCCESS - The logon session track was deleted successfully. 00680 00681 STATUS_BAD_LOGON_SESSION_STATE - The logon session has a non-zero 00682 reference count and can not be deleted. 00683 00684 STATUS_NO_SUCH_LOGON_SESSION - The specified logon session does not 00685 exist. 00686 00687 00688 --*/ 00689 00690 { 00691 00692 ULONG SessionArrayIndex; 00693 PSEP_LOGON_SESSION_REFERENCES Previous, Current; 00694 00695 PAGED_CODE(); 00696 00697 SessionArrayIndex = SepLogonSessionIndex( LogonId ); 00698 00699 // 00700 // Protect modification of reference monitor database 00701 // 00702 00703 SepRmAcquireDbWriteLock(); 00704 00705 00706 // 00707 // Now walk the list for our logon session array hash index. 00708 // 00709 00710 Previous = (PSEP_LOGON_SESSION_REFERENCES) 00711 ((PVOID)&SepLogonSessions[ SessionArrayIndex ]); 00712 Current = Previous->Next; 00713 00714 while (Current != NULL) { 00715 00716 // 00717 // If we found it, make sure reference count is zero 00718 // 00719 00720 if (RtlEqualLuid( LogonId, &Current->LogonId) ) { 00721 00722 if (Current->ReferenceCount == 0) { 00723 00724 // 00725 // Pull it from the list 00726 // 00727 00728 Previous->Next = Current->Next; 00729 00730 00731 // 00732 // No longer need to protect our pointer to this 00733 // record. 00734 // 00735 00736 SepRmReleaseDbWriteLock(); 00737 00738 00739 // 00740 // Deallocate the logon session track record. 00741 // 00742 00743 ExFreePool( (PVOID)Current ); 00744 00745 00746 return STATUS_SUCCESS; 00747 00748 } 00749 00750 // 00751 // reference count was not zero. This is not considered 00752 // a healthy situation. Return an error and let someone 00753 // else declare the bug check. 00754 // 00755 00756 SepRmReleaseDbWriteLock(); 00757 return STATUS_BAD_LOGON_SESSION_STATE; 00758 } 00759 00760 Previous = Current; 00761 Current = Current->Next; 00762 } 00763 00764 SepRmReleaseDbWriteLock(); 00765 00766 // 00767 // Someone asked us to delete a logon session that isn't 00768 // in the database. 00769 // 00770 00771 return STATUS_NO_SUCH_LOGON_SESSION; 00772 00773 }

VOID SepRmCommandServerThread IN PVOID  StartContext  ) 
 

Definition at line 309 of file rmmain.c.

References NT_SUCCESS, NTSTATUS(), NULL, PAGED_CODE, ReplyMessage(), _SEP_RM_STATE::RmCommandPortHandle, SepRmCommandDispatch, SepRmCommandServerThreadInit(), SepRmState, and Status.

Referenced by SeRmInitPhase1().

00315 : 00316 00317 This function is executed indefinitely by a dedicated permanent thread 00318 of the Sysinit Process, called the Reference Monitor Server Thread. 00319 This thread updates Reference Monitor Global State Data by dispatching 00320 commands sent from the LSA through the the Reference Monitor LPC Command 00321 Port. The following steps are repeated indefinitely: 00322 00323 o Initialize RM Command receive and reply buffer headers 00324 o Perform remaining Reference Monitor initialization involving LSA 00325 o Wait for RM command sent from LSA, send reply to previous command 00326 (if any) 00327 o Validate command 00328 o Dispatch to command worker routine to execute command. 00329 00330 Arguments: 00331 00332 None. 00333 00334 Return Value: 00335 00336 None. 00337 00338 --*/ 00339 00340 { 00341 NTSTATUS Status; 00342 PRM_REPLY_MESSAGE Reply; 00343 RM_COMMAND_MESSAGE CommandMessage; 00344 RM_REPLY_MESSAGE ReplyMessage; 00345 00346 PAGED_CODE(); 00347 00348 // 00349 // Perform the rest of the Reference Monitor initialization, involving 00350 // synchronization with the LSA or dependency on the LSA having run. 00351 // 00352 00353 if (!SepRmCommandServerThreadInit()) { 00354 00355 KdPrint(("Security: Terminating Rm Command Server Thread\n")); 00356 return; 00357 } 00358 00359 // 00360 // Initialize LPC port message header type and length fields for the 00361 // received command message. 00362 // 00363 00364 CommandMessage.MessageHeader.u2.ZeroInit = 0; 00365 CommandMessage.MessageHeader.u1.s1.TotalLength = 00366 (CSHORT) sizeof(RM_COMMAND_MESSAGE); 00367 CommandMessage.MessageHeader.u1.s1.DataLength = 00368 CommandMessage.MessageHeader.u1.s1.TotalLength - 00369 (CSHORT) sizeof(PORT_MESSAGE); 00370 00371 // 00372 // Initialize the LPC port message header type and data sizes for 00373 // for the reply message. 00374 // 00375 00376 ReplyMessage.MessageHeader.u2.ZeroInit = 0; 00377 ReplyMessage.MessageHeader.u1.s1.TotalLength = 00378 (CSHORT) sizeof(RM_COMMAND_MESSAGE); 00379 ReplyMessage.MessageHeader.u1.s1.DataLength = 00380 ReplyMessage.MessageHeader.u1.s1.TotalLength - 00381 (CSHORT) sizeof(PORT_MESSAGE); 00382 00383 // 00384 // First time through, there is no reply. 00385 // 00386 00387 Reply = NULL; 00388 00389 // 00390 // Now loop indefinitely, processing incoming Rm commands from the LSA. 00391 // 00392 00393 for(;;) { 00394 00395 // 00396 // Wait for Command, send reply to previous command (if any) 00397 // 00398 00399 Status = ZwReplyWaitReceivePort( 00400 SepRmState.RmCommandPortHandle, 00401 NULL, 00402 (PPORT_MESSAGE) Reply, 00403 (PPORT_MESSAGE) &CommandMessage 00404 ); 00405 00406 if (!NT_SUCCESS(Status)) { 00407 00408 // 00409 // malicious user apps can try to connect to this port. We will 00410 // fail later, but if their thread vanishes, we'll get a failure 00411 // here. Ignore it: 00412 // 00413 00414 if ( Status == STATUS_UNSUCCESSFUL ) 00415 { 00416 // 00417 // skip it: 00418 // 00419 00420 Reply = NULL ; 00421 continue; 00422 } 00423 00424 KdPrint(("Security: RM message receive from Lsa failed %lx\n", 00425 Status)); 00426 00427 } 00428 00429 // 00430 // Now dispatch to a routine to handle the command. Allow 00431 // command errors to occur without bringing system down just now. 00432 // 00433 00434 if ( CommandMessage.MessageHeader.u2.s2.Type == LPC_REQUEST ) { 00435 (*(SepRmCommandDispatch[CommandMessage.CommandNumber])) 00436 (&CommandMessage, &ReplyMessage); 00437 00438 // 00439 // Initialize the client thread info and message id for the 00440 // reply message. First time through, the reply message structure 00441 // is not used. 00442 // 00443 00444 ReplyMessage.MessageHeader.ClientId = 00445 CommandMessage.MessageHeader.ClientId; 00446 ReplyMessage.MessageHeader.MessageId = 00447 CommandMessage.MessageHeader.MessageId; 00448 00449 Reply = &ReplyMessage; 00450 00451 } else { 00452 00453 Reply = NULL; 00454 } 00455 } // end_for 00456 00457 // 00458 // Make compiler ferme la bouche 00459 // 00460 00461 StartContext; 00462 }

BOOLEAN SepRmCommandServerThreadInit  ) 
 

Referenced by SepRmCommandServerThread().

VOID SepRmComponentTestCommandWrkr IN PRM_COMMAND_MESSAGE  CommandMessage,
OUT PRM_REPLY_MESSAGE  ReplyMessage
 

Definition at line 758 of file rmmain.c.

References ASSERT, PAGED_CODE, and ReplyMessage().

00765 : 00766 00767 BUGWARNING - Remove this command when other RM commands are implemented. 00768 Until then, this command is the only way a CT can verify that 00769 an RM command with parameters is sent correctly. 00770 00771 This function processes the Component Test RM command. 00772 This is a temporary command that can be used to verify that the link 00773 from RM to LSA is working. This command verifies that the link 00774 is working by receiving a ULONG parameter and verifying that it 00775 has the expected value. 00776 00777 Arguments: 00778 00779 CommandMessage - Pointer to structure containing RM command message 00780 information consisting of an LPC PORT_MESSAGE structure followed 00781 by the command number (RmComponentTestCommand). This command 00782 currently has one parameter, a fixed ulong value. 00783 00784 ReplyMessage - Pointer to structure containing LSA reply message 00785 information consisting of an LPC PORT_MESSAGE structure followed 00786 by the command ReturnedStatus field in which a status code from the 00787 command will be returned. 00788 00789 Return Value: 00790 00791 VOID 00792 00793 --*/ 00794 00795 { 00796 PAGED_CODE(); 00797 00798 ReplyMessage->ReturnedStatus = STATUS_SUCCESS; 00799 00800 // 00801 // Strict check that command is correct. 00802 // 00803 00804 ASSERT( CommandMessage->CommandNumber == RmComponentTestCommand ); 00805 00806 KdPrint(("Security: RM Component Test Command Received\n")); 00807 00808 // 00809 // Verify that the parameter value passed is as expected. 00810 // 00811 00812 if (*((ULONG *) CommandMessage->CommandParams) != 00813 RM_CT_COMMAND_PARAM_VALUE ) { 00814 00815 ReplyMessage->ReturnedStatus = STATUS_INVALID_PARAMETER; 00816 } 00817 00818 return; 00819 }

VOID SepRmCreateLogonSessionWrkr IN PRM_COMMAND_MESSAGE  CommandMessage,
OUT PRM_REPLY_MESSAGE  ReplyMessage
 

Definition at line 122 of file rmlogon.c.

References ASSERT, NTSTATUS(), PAGED_CODE, ReplyMessage(), SepCreateLogonSessionTrack(), and Status.

00129 : 00130 00131 This function is the dispatch routine for the LSA --> RM 00132 "CreateLogonSession" call. 00133 00134 The arguments passed to this routine are defined by the 00135 type SEP_RM_COMMAND_WORKER. 00136 00137 00138 Arguments: 00139 00140 CommandMessage - Points to structure containing RM command message 00141 information consisting of an LPC PORT_MESSAGE structure followed 00142 by the command number (RmComponentTestCommand) and a command-specific 00143 body. The command-specific body of this parameter is a LUID of the 00144 logon session to be created. 00145 00146 ReplyMessage - Pointer to structure containing LSA reply message 00147 information consisting of an LPC PORT_MESSAGE structure followed 00148 by the command ReturnedStatus field in which a status code from the 00149 command will be returned. 00150 00151 Return Value: 00152 00153 VOID 00154 00155 --*/ 00156 00157 { 00158 00159 NTSTATUS Status; 00160 LUID LogonId; 00161 00162 PAGED_CODE(); 00163 00164 // 00165 // Check that command is expected type 00166 // 00167 00168 ASSERT( CommandMessage->CommandNumber == RmCreateLogonSession ); 00169 00170 00171 // 00172 // Typecast the command parameter to what we expect. 00173 // 00174 00175 LogonId = *((LUID UNALIGNED *) CommandMessage->CommandParams); 00176 00177 00178 00179 // 00180 // Try to create the logon session tracking record 00181 // 00182 00183 Status = SepCreateLogonSessionTrack( &LogonId ); 00184 00185 00186 00187 // 00188 // Set the reply status 00189 // 00190 00191 ReplyMessage->ReturnedStatus = Status; 00192 00193 00194 return; 00195 }

BOOLEAN SepRmDbInitialization VOID   ) 
 

Definition at line 95 of file rmvars.c.

References ASSERT, _SEP_RM_STATE::AuditingEnabled, ExAllocatePoolWithTag, ExInitializeResource, FALSE, NT_SUCCESS, NTSTATUS(), NULL, _SEP_RM_STATE::OperationalMode, PagedPool, SeAnonymousAuthenticationId, SEP_LOGON_TRACK_ARRAY_SIZE, SepCreateLogonSessionTrack(), SepLogonSessions, SepRmDbLock, SepRmState, SeSystemAuthenticationId, Status, and TRUE.

Referenced by SepRmInitPhase0().

00100 : 00101 00102 This function initializes the reference monitor in-memory database. 00103 00104 Arguments: 00105 00106 None. 00107 00108 Return Value: 00109 00110 TRUE if database successfully initialized. 00111 FALSE if not successfully initialized. 00112 00113 --*/ 00114 { 00115 NTSTATUS Status; 00116 ULONG i; 00117 00118 00119 // 00120 // Create the reference monitor database lock 00121 // 00122 // Use SepRmAcquireDbReadLock() 00123 // SepRmAcquireDbWriteLock() 00124 // SepRmReleaseDbReadLock() 00125 // SepRmReleaseDbWriteLock() 00126 // 00127 // to gain access to the reference monitor database. 00128 // 00129 00130 ExInitializeResource(&SepRmDbLock); 00131 00132 // 00133 // Initialize the Logon Session tracking array. 00134 // 00135 00136 SepLogonSessions = ExAllocatePoolWithTag( PagedPool, 00137 sizeof( PSEP_LOGON_SESSION_REFERENCES ) * SEP_LOGON_TRACK_ARRAY_SIZE, 00138 'SLeS' 00139 ); 00140 00141 if (SepLogonSessions == NULL) { 00142 return( FALSE ); 00143 } 00144 00145 for (i=0;i<SEP_LOGON_TRACK_ARRAY_SIZE;i++) { 00146 00147 SepLogonSessions[ i ] = NULL; 00148 } 00149 00150 // 00151 // Now add in a record representing the system logon session. 00152 // 00153 00154 Status = SepCreateLogonSessionTrack( &SeSystemAuthenticationId ); 00155 ASSERT( NT_SUCCESS(Status) ); 00156 if ( !NT_SUCCESS(Status)) { 00157 return FALSE; 00158 } 00159 00160 // 00161 // Add one for the null session logon session 00162 // 00163 00164 Status = SepCreateLogonSessionTrack( &SeAnonymousAuthenticationId ); 00165 ASSERT( NT_SUCCESS(Status) ); 00166 if ( !NT_SUCCESS(Status)) { 00167 return FALSE; 00168 } 00169 00170 00171 00172 00173 // 00174 // The correct RM state will be set when the local security policy 00175 // information is retrieved (by the LSA) and subsequently passed to 00176 // the reference monitor later on in initialization. For now, initialize 00177 // the state to something that will work for the remainder of 00178 // system initialization. 00179 // 00180 00181 SepRmState.AuditingEnabled = 0; // auditing state disabled. 00182 SepRmState.OperationalMode = LSA_MODE_PASSWORD_PROTECTED; 00183 00184 00185 00186 return TRUE; 00187 00188 00189 } }

VOID SepRmDeleteLogonSessionWrkr IN PRM_COMMAND_MESSAGE  CommandMessage,
OUT PRM_REPLY_MESSAGE  ReplyMessage
 

Definition at line 200 of file rmlogon.c.

References ASSERT, NTSTATUS(), PAGED_CODE, ReplyMessage(), SepDeleteLogonSessionTrack(), and Status.

00207 : 00208 00209 This function is the dispatch routine for the LSA --> RM 00210 "DeleteLogonSession" call. 00211 00212 The arguments passed to this routine are defined by the 00213 type SEP_RM_COMMAND_WORKER. 00214 00215 00216 Arguments: 00217 00218 CommandMessage - Points to structure containing RM command message 00219 information consisting of an LPC PORT_MESSAGE structure followed 00220 by the command number (RmComponentTestCommand) and a command-specific 00221 body. The command-specific body of this parameter is a LUID of the 00222 logon session to be created. 00223 00224 ReplyMessage - Pointer to structure containing LSA reply message 00225 information consisting of an LPC PORT_MESSAGE structure followed 00226 by the command ReturnedStatus field in which a status code from the 00227 command will be returned. 00228 00229 Return Value: 00230 00231 VOID 00232 00233 --*/ 00234 00235 { 00236 00237 NTSTATUS Status; 00238 LUID LogonId; 00239 00240 PAGED_CODE(); 00241 00242 // 00243 // Check that command is expected type 00244 // 00245 00246 ASSERT( CommandMessage->CommandNumber == RmDeleteLogonSession ); 00247 00248 00249 // 00250 // Typecast the command parameter to what we expect. 00251 // 00252 00253 LogonId = *((LUID UNALIGNED *) CommandMessage->CommandParams); 00254 00255 00256 00257 // 00258 // Try to create the logon session tracking record 00259 // 00260 00261 Status = SepDeleteLogonSessionTrack( &LogonId ); 00262 00263 00264 00265 // 00266 // Set the reply status 00267 // 00268 00269 ReplyMessage->ReturnedStatus = Status; 00270 00271 00272 return; 00273 }

VOID SepRmSendCommandToLsaWrkr IN PRM_COMMAND_MESSAGE  CommandMessage,
OUT PRM_REPLY_MESSAGE  ReplyMessage
 

Definition at line 824 of file rmmain.c.

References ASSERT, NULL, PAGED_CODE, and ReplyMessage().

00831 : 00832 00833 This function carries out the special Rm Send Command To Lsa Command. This 00834 command is used only by the ctlsarm component test which checks that 00835 LSA to RM and RM to LSA communication via LPC is working. 00836 00837 Arguments: 00838 00839 CommandMessage - Pointer to structure containing RM command message 00840 information consisting of an LPC PORT_MESSAGE structure followed 00841 by the command number (RmDisableAuditCommand), followed by the 00842 command parameters. The parameters of this special command consists 00843 of the Command Number of an LSA command and its parameters (if any). 00844 00845 ReplyMessage - Pointer to structure containing RM reply message 00846 information consisting of an LPC PORT_MESSAGE structure followed 00847 by the command ReturnedStatus field in which a status code from the 00848 command will be returned. 00849 00850 Return Value: 00851 00852 VOID 00853 00854 --*/ 00855 00856 { 00857 // 00858 // Obtain a pointer to the LSA command's params, and the size of the 00859 // params in bytes. If there are no params, set the pointer to NULL. 00860 // 00861 00862 PVOID LsaCommandParams = 00863 ((RM_SEND_COMMAND_TO_LSA_PARAMS *) 00864 (CommandMessage->CommandParams))->LsaCommandParams; 00865 ULONG LsaCommandParamsLength = 00866 ((RM_SEND_COMMAND_TO_LSA_PARAMS *) 00867 (CommandMessage->CommandParams))->LsaCommandParamsLength; 00868 00869 PAGED_CODE(); 00870 00871 if (LsaCommandParamsLength == 0) { 00872 00873 LsaCommandParams = NULL; 00874 00875 } 00876 00877 // 00878 // Strict check that command is correct one for this worker. 00879 // 00880 00881 ASSERT( CommandMessage->CommandNumber == RmSendCommandToLsaCommand ); 00882 00883 KdPrint(("Security: RM Send Command back to LSA Command Received\n")); 00884 00885 ReplyMessage->ReturnedStatus = STATUS_SUCCESS; 00886 00887 // Status = SepRmCallLsa( 00888 // ((RM_SEND_COMMAND_TO_LSA_PARAMS *) 00889 // (CommandMessage->CommandParams))->LsaCommandNumber, 00890 // LsaCommandParams, 00891 // LsaCommandParamsLength, 00892 // NULL, 00893 // 0, 00894 // NULL, 00895 // NULL 00896 // ); 00897 00898 00899 return; 00900 00901 }

VOID SepRmSetAuditEventWrkr IN PRM_COMMAND_MESSAGE  CommandMessage,
OUT PRM_REPLY_MESSAGE  ReplyMessage
 

Definition at line 51 of file rmaudit.c.

References ASSERT, _SE_AUDITING_STATE::AuditOnFailure, _SE_AUDITING_STATE::AuditOnSuccess, FALSE, PAGED_CODE, ReplyMessage(), SeAuditingState, SeDetailedAuditing, SepAdtAuditingEnabled, SepAdtInitializeBounds(), and TRUE.

00058 : 00059 00060 This function carries out the Reference Monitor Set Audit Event 00061 Command. This command enables or disables auditing and optionally 00062 sets the auditing events. 00063 00064 00065 Arguments: 00066 00067 CommandMessage - Pointer to structure containing RM command message 00068 information consisting of an LPC PORT_MESSAGE structure followed 00069 by the command number (RmSetAuditStateCommand) and a single command 00070 parameter in structure form. 00071 00072 ReplyMessage - Pointer to structure containing RM reply message 00073 information consisting of an LPC PORT_MESSAGE structure followed 00074 by the command ReturnedStatus field in which a status code from the 00075 command will be returned. 00076 00077 Return Value: 00078 00079 VOID 00080 00081 --*/ 00082 00083 { 00084 00085 PPOLICY_AUDIT_EVENT_OPTIONS EventAuditingOptions; 00086 POLICY_AUDIT_EVENT_TYPE EventType; 00087 00088 PAGED_CODE(); 00089 00090 SepAdtInitializeBounds(); 00091 00092 ReplyMessage->ReturnedStatus = STATUS_SUCCESS; 00093 00094 // 00095 // Strict check that command is correct one for this worker. 00096 // 00097 00098 ASSERT( CommandMessage->CommandNumber == RmAuditSetCommand ); 00099 00100 // 00101 // Extract the AuditingMode flag and put it in the right place. 00102 // 00103 00104 SepAdtAuditingEnabled = (((PLSARM_POLICY_AUDIT_EVENTS_INFO) CommandMessage->CommandParams)-> 00105 AuditingMode); 00106 00107 // 00108 // For each element in the passed array, process changes to audit 00109 // nothing, and then success or failure flags. 00110 // 00111 00112 EventAuditingOptions = ((PLSARM_POLICY_AUDIT_EVENTS_INFO) CommandMessage->CommandParams)-> 00113 EventAuditingOptions; 00114 00115 00116 for ( EventType=AuditEventMinType; 00117 EventType <= AuditEventMaxType; 00118 EventType++ ) { 00119 00120 SeAuditingState[EventType].AuditOnSuccess = FALSE; 00121 SeAuditingState[EventType].AuditOnFailure = FALSE; 00122 00123 if ( EventAuditingOptions[EventType] & POLICY_AUDIT_EVENT_SUCCESS ) { 00124 00125 SeAuditingState[EventType].AuditOnSuccess = TRUE; 00126 } 00127 00128 if ( EventAuditingOptions[EventType] & POLICY_AUDIT_EVENT_FAILURE ) { 00129 00130 SeAuditingState[EventType].AuditOnFailure = TRUE; 00131 } 00132 } 00133 00134 // 00135 // Set the flag to indicate that we're auditing detailed events. 00136 // This is merely a timesaver so we can skip auditing setup in 00137 // time critical places like process creation. 00138 // 00139 00140 // 00141 // Despite what the UI may imply, we never audit failures for detailed events, since 00142 // none of them can fail for security related reasons, and we're not interested in 00143 // auditing out of memory errors and stuff like that. So just set this flag when 00144 // they want to see successes and ignore the failure case. 00145 // 00146 // We may have to revisit this someday. 00147 // 00148 00149 if ( SeAuditingState[AuditCategoryDetailedTracking].AuditOnSuccess && SepAdtAuditingEnabled ) { 00150 00151 SeDetailedAuditing = TRUE; 00152 00153 } else { 00154 00155 SeDetailedAuditing = FALSE; 00156 } 00157 00158 return; 00159 }


Variable Documentation

SEP_LOGON_SESSION_TERMINATED_NOTIFICATION SeFileSystemNotifyRoutinesHead
 

Definition at line 151 of file rmp.h.

Referenced by SepNotifyFileSystems(), SeRegisterLogonSessionTerminatedRoutine(), and SeUnregisterLogonSessionTerminatedRoutine().

PSEP_LOGON_SESSION_REFERENCES* SepLogonSessions
 

Definition at line 229 of file rmp.h.

Referenced by SeMarkLogonSessionForTerminationNotification(), SepCreateLogonSessionTrack(), SepDeleteLogonSessionTrack(), SepDeReferenceLogonSession(), SepReferenceLogonSession(), and SepRmDbInitialization().

ERESOURCE SepRmDbLock
 

Definition at line 228 of file rmp.h.

Referenced by SepRmDbInitialization().

PEPROCESS SepRmLsaCallProcess
 

Definition at line 226 of file rmp.h.

Referenced by SepRmCallLsa(), and SepRmCommandServerThreadInit().

SEP_RM_STATE SepRmState
 

Definition at line 227 of file rmp.h.

Referenced by SepRmCallLsa(), SepRmCommandServerThread(), SepRmCommandServerThreadInit(), SepRmDbInitialization(), and SeRmInitPhase1().


Generated on Sat May 15 19:45:29 2004 for test by doxygen 1.3.7