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

ctlnpqos.c File Reference

Go to the source code of this file.

Defines

#define DevPrint
#define Error(N, S)   { DbgPrint(#N); DbgPrint(" Error %08lx\n", S); }
#define Delay(SECONDS)

Functions

BOOLEAN SepClientTestStatic (VOID)
BOOLEAN SepClientTestDynamic (VOID)
BOOLEAN SepClientTestEffectiveOnly (BOOLEAN StaticTest)
BOOLEAN SepClientTestNotEffectiveOnly (BOOLEAN StaticTest)
BOOLEAN SepClientTestAnonymous (BOOLEAN StaticTest, BOOLEAN EffectiveOnly)
BOOLEAN SepClientTestIdentification (BOOLEAN StaticTest, BOOLEAN EffectiveOnly)
BOOLEAN SepClientTestImpersonation (BOOLEAN StaticTest, BOOLEAN EffectiveOnly)
VOID SepClientConnect (SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, SECURITY_CONTEXT_TRACKING_MODE TrackingMode, BOOLEAN EffectiveOnly)
VOID SepClientMakeRemoteCall (VOID)
VOID SepClientDropConnection (VOID)
BOOLEAN SepClientTest (VOID)
NTSTATUS SepClientInitialize ()
BOOLEAN SepServerTestStatic (VOID)
BOOLEAN SepServerTestDynamic (VOID)
BOOLEAN SepServerTestEffectiveOnly (BOOLEAN StaticTest)
BOOLEAN SepServerTestNotEffectiveOnly (BOOLEAN StaticTest)
BOOLEAN SepServerTestAnonymous (BOOLEAN StaticTest, BOOLEAN EffectiveOnly)
BOOLEAN SepServerTestIdentification (BOOLEAN StaticTest, BOOLEAN EffectiveOnly)
BOOLEAN SepServerTestImpersonation (BOOLEAN StaticTest, BOOLEAN EffectiveOnly)
VOID SepServerWaitForNextConnect (VOID)
VOID SepServerGetNextMessage (VOID)
VOID SepServerCompleteMessage (VOID)
VOID SepServerDropConnection (VOID)
BOOLEAN SepServerTest (VOID)
NTSTATUS SepServerInitialize ()
VOID SepServerSpawnClientProcess (VOID)
VOID SepWritePipe (PSZ String)
VOID SepReadPipe (VOID)
VOID SepTransceivePipe (PSZ String)
HANDLE SepServerCreatePipe (VOID)
VOID SepServerListenPipe (VOID)
VOID SepServerImpersonatePipe (VOID)
VOID SepServerDisconnectPipe (VOID)
HANDLE SepClientOpenPipe (VOID)
BOOLEAN CtLnpQos (VOID)
VOID SepServerImpersonateClient (VOID)
VOID SepServerRevertToSelf (VOID)
VOID SepReadPipe ()
VOID SepServerListenPipe ()
VOID SepServerImpersonatePipe ()
VOID SepServerDisconnectPipe ()

Variables

NTSTATUS Status
OBJECT_ATTRIBUTES ObjectAttributes
STRING EventName
UNICODE_STRING UnicodeEventName
HANDLE EventHandle
STRING PortName
UNICODE_STRING UnicodePortName
STRING RelativePortName
UNICODE_STRING UnicodeRelativePortName
HANDLE EarPort
HANDLE TalkPort
SECURITY_QUALITY_OF_SERVICE SecurityQos
ULONG RequestCount
HANDLE ClientToken
TOKEN_STATISTICS ClientTokenStatistics
ULONG IgnoreLength
HANDLE SepServerThread


Define Documentation

#define Delay SECONDS   ) 
 

Value:

{ \ LARGE_INTEGER Time; \ Time.QuadPart = -10 * 1000 * 1000, ((LONGLONG)SECONDS); \ NtDelayExecution(TRUE,(PLARGE_INTEGER)&Time); \ }

Definition at line 13 of file ctlnpqos.c.

Referenced by VdmpDelayInterrupt().

#define DevPrint
 

Definition at line 8 of file ctlnpqos.c.

Referenced by SepClientConnect(), SepClientMakeRemoteCall(), SepReadPipe(), SepServerCompleteMessage(), SepServerDisconnectPipe(), SepServerDropConnection(), SepServerGetNextMessage(), SepServerImpersonateClient(), SepServerImpersonatePipe(), SepServerListenPipe(), SepServerWaitForNextConnect(), SepTransceivePipe(), and SepWritePipe().

#define Error N,
 )     { DbgPrint(#N); DbgPrint(" Error %08lx\n", S); }
 

Definition at line 11 of file ctlnpqos.c.

Referenced by AlStatusMsg(), AlStatusMsgNoWait(), CcLogError(), ConnectConv(), CreateDesktopHeap(), RestoreSpb(), SepClientOpenPipe(), SepReadPipe(), SepServerCreatePipe(), SepServerDisconnectPipe(), SepServerImpersonatePipe(), SepServerListenPipe(), SepTransceivePipe(), SepWritePipe(), SpbCheckRect2(), ValidateHdesk(), vAlStatusMsg(), Win32CommandChannelThread(), xxxCreateDesktop(), xxxCreateDesktop2(), and xxxOpenDesktop().


Function Documentation

BOOLEAN CtLnpQos VOID   ) 
 

Definition at line 1165 of file ctlnpqos.c.

References DbgPrint, EventHandle, EventName, FALSE, NT_SUCCESS, NtCreateEvent(), NtTerminateThread(), NULL, ObjectAttributes, PortName, RelativePortName, RtlAnsiStringToUnicodeString(), RtlFreeUnicodeString(), RtlInitString(), SEASSERT_SUCCESS, SepClientInitialize(), SepClientTest(), SepServerInitialize(), SepServerTest(), Status, TRUE, UnicodeEventName, UnicodePortName, and UnicodeRelativePortName.

Referenced by Test().

01166 { 01167 01168 BOOLEAN Result = TRUE; 01169 01170 RtlInitString( &PortName, "\\Device\\NamedPipe\\TestLnpQosServerPort" ); 01171 Status = RtlAnsiStringToUnicodeString( 01172 &UnicodePortName, 01173 &PortName, 01174 TRUE ); SEASSERT_SUCCESS( NT_SUCCESS(Status) ); 01175 01176 RtlInitString( &RelativePortName, "TestLnpQosServerPort" ); 01177 Status = RtlAnsiStringToUnicodeString( 01178 &UnicodeRelativePortName, 01179 &RelativePortName, 01180 TRUE ); SEASSERT_SUCCESS( NT_SUCCESS(Status) ); 01181 01182 01183 // 01184 // Determine whether we are the client or server side of the test. 01185 // This is done by creating or opening a named event object. If the 01186 // event does not yet exist, then we are the client, and must create 01187 // the server process. Otherwise, we are the server and the client 01188 // is waiting for us to signal the event. 01189 // 01190 01191 RtlInitString( &EventName, "\\TestLnpQosEvent" ); 01192 Status = RtlAnsiStringToUnicodeString( 01193 &UnicodeEventName, 01194 &EventName, 01195 TRUE ); SEASSERT_SUCCESS( NT_SUCCESS(Status) ); 01196 01197 InitializeObjectAttributes( 01198 &ObjectAttributes, 01199 &UnicodeEventName, 01200 OBJ_OPENIF, 01201 NULL, 01202 NULL 01203 ); 01204 Status = NtCreateEvent( 01205 &EventHandle, 01206 EVENT_ALL_ACCESS, 01207 &ObjectAttributes, 01208 SynchronizationEvent, 01209 FALSE 01210 ); 01211 RtlFreeUnicodeString( &UnicodeEventName ); 01212 01213 if (Status == STATUS_OBJECT_NAME_EXISTS) { 01214 01215 // 01216 // Server is already running, therefore, this process gets to be 01217 // the client. 01218 // 01219 01220 Status = SepClientInitialize(); SEASSERT_SUCCESS(Status); 01221 Result = SepClientTest(); 01222 01223 } else { 01224 01225 SEASSERT_SUCCESS(Status); 01226 01227 // 01228 // Event wasn't yet there, so we must be the server. 01229 // 01230 01231 DbgPrint("Se: Starting Local Named Pipe Impersonation Test.\n"); 01232 01233 Status = SepServerInitialize(); SEASSERT_SUCCESS(Status); 01234 Result = SepServerTest(); 01235 01236 DbgPrint("Se: End Test.\n"); 01237 01238 } 01239 01240 01241 01242 Status = NtTerminateThread( NtCurrentThread(), STATUS_SUCCESS); 01243 SEASSERT_SUCCESS(Status); 01244 01245 return Result; 01246 01247 }

VOID SepClientConnect SECURITY_IMPERSONATION_LEVEL  ImpersonationLevel,
SECURITY_CONTEXT_TRACKING_MODE  TrackingMode,
BOOLEAN  EffectiveOnly
 

Definition at line 218 of file ctlnpqos.c.

References DevPrint, SecurityQos, SepClientOpenPipe(), and TalkPort.

00224 { 00225 00226 SecurityQos.ImpersonationLevel = ImpersonationLevel; 00227 SecurityQos.ContextTrackingMode = TrackingMode; 00228 SecurityQos.EffectiveOnly = EffectiveOnly; 00229 00230 DevPrint("\nClient: "); 00231 TalkPort = SepClientOpenPipe(); 00232 00233 return; 00234 }

VOID SepClientDropConnection VOID   ) 
 

Definition at line 252 of file ctlnpqos.c.

References NtClose(), SEASSERT_SUCCESS, Status, and TalkPort.

00254 { 00255 00256 Status = NtClose( TalkPort ); SEASSERT_SUCCESS(Status); 00257 00258 return; 00259 00260 }

NTSTATUS SepClientInitialize  ) 
 

Definition at line 553 of file ctlnpqos.c.

References DbgPrint, EventHandle, NtClose(), NtSetEvent(), NULL, RequestCount, SEASSERT_SUCCESS, and Status.

Referenced by CtLnpQos(), and CtLpcQos().

00556 { 00557 00558 00559 00560 DbgPrint("Se: Client Initializing ...\n"); 00561 00562 00563 RequestCount = 0; 00564 00565 00566 // 00567 // Signal the named event to start the test 00568 // 00569 00570 DbgPrint("Se: Client Starting Test ...\n"); 00571 Status = NtSetEvent( EventHandle, NULL ); SEASSERT_SUCCESS(Status); 00572 00573 Status = NtClose( EventHandle ); SEASSERT_SUCCESS(Status); 00574 00575 00576 return STATUS_SUCCESS; 00577 }

VOID SepClientMakeRemoteCall VOID   ) 
 

Definition at line 238 of file ctlnpqos.c.

References DevPrint, RequestCount, and SepTransceivePipe().

00240 { 00241 00242 DevPrint("\nClient: "); 00243 SepTransceivePipe( "Make Client Call\n" ); 00244 00245 RequestCount += 1; 00246 00247 return; 00248 }

HANDLE SepClientOpenPipe VOID   ) 
 

Definition at line 1582 of file ctlnpqos.c.

References ASSERT, Buffer, COMPLETION_MODE, Error, FALSE, Name, NAMED_PIPE_CONFIGURATION, NT_SUCCESS, NtClose(), NtFsControlFile(), NtOpenFile(), NtSetInformationFile(), NTSTATUS(), NtWaitForSingleObject(), NULL, ObjectAttributes, READ_MODE, RelativePortName, RtlAllocateHeap, RtlAnsiStringToUnicodeString(), RtlFreeUnicodeString(), RtlInitString(), SEASSERT_SUCCESS, SecurityQos, Status, TRUE, and UnicodePortName.

Referenced by SepClientConnect().

01585 { 01586 HANDLE PipeHandle, NpfsHandle; 01587 NTSTATUS Status; 01588 IO_STATUS_BLOCK Iosb; 01589 ULONG Share; 01590 STRING Npfs; 01591 UNICODE_STRING UnicodeNpfs; 01592 PFILE_PIPE_WAIT_FOR_BUFFER WaitPipe; 01593 ULONG WaitPipeLength; 01594 NAMED_PIPE_CONFIGURATION Config = FILE_PIPE_FULL_DUPLEX; 01595 READ_MODE ReadMode = FILE_PIPE_MESSAGE_MODE; 01596 COMPLETION_MODE CompletionMode = FILE_PIPE_QUEUE_OPERATION; 01597 01598 01599 //#ifdef NOT_YET_WORKING 01600 // 01601 // Wait for the server's pipe to reach a listen state... 01602 // 01603 01604 RtlInitString( &Npfs, "\\Device\\NamedPipe\\"); 01605 Status = RtlAnsiStringToUnicodeString( 01606 &UnicodeNpfs, 01607 &Npfs, 01608 TRUE ); SEASSERT_SUCCESS( NT_SUCCESS(Status) ); 01609 01610 InitializeObjectAttributes( 01611 &ObjectAttributes, 01612 &UnicodeNpfs, 01613 OBJ_CASE_INSENSITIVE, 01614 NULL, 01615 NULL); 01616 01617 if (!NT_SUCCESS(Status = NtOpenFile( 01618 &NpfsHandle, 01619 GENERIC_READ | SYNCHRONIZE, 01620 &ObjectAttributes, 01621 &Iosb, 01622 FILE_SHARE_READ, 01623 0 ))) { 01624 01625 Error( OpenNpfs, Status ); 01626 } 01627 RtlFreeUnicodeString( &UnicodeNpfs ); 01628 01629 WaitPipeLength = 01630 FIELD_OFFSET(FILE_PIPE_WAIT_FOR_BUFFER, Name[0]) + 01631 RelativePortName.MaximumLength; //UNICODEFIX UnicodeRelativePortName.MaximumLength; 01632 WaitPipe = RtlAllocateHeap(RtlProcessHeap(), 0, WaitPipeLength); 01633 WaitPipe->TimeoutSpecified = FALSE; 01634 01635 WaitPipe->NameLength = RelativePortName.Length; //UNICODEFIX UnicodeRelativePortName.Length; 01636 strcpy(WaitPipe->Name, RelativePortName.Buffer); //UNICODEFIX UnicodePortName.Buffer; 01637 01638 if (!NT_SUCCESS(Status = NtFsControlFile( 01639 NpfsHandle, 01640 NULL, // Event 01641 NULL, // ApcRoutine 01642 NULL, // ApcContext 01643 &Iosb, 01644 FSCTL_PIPE_WAIT, 01645 WaitPipe, // Buffer for data to the FS 01646 WaitPipeLength, 01647 NULL, // OutputBuffer 01648 0 // OutputBufferLength 01649 ))) { 01650 01651 Error( ClientWaitPipe, Status ); 01652 } 01653 if (Status == STATUS_PENDING) { 01654 if (!NT_SUCCESS(Status = NtWaitForSingleObject( NpfsHandle, TRUE, NULL ))) { 01655 01656 Error( NtWaitForSingleObject, Status ); 01657 } 01658 } 01659 01660 if (!NT_SUCCESS(Iosb.Status)) { 01661 01662 Error( ClientWaitPipeFinalStatus, Iosb.Status ); 01663 } 01664 01665 Status = NtClose( NpfsHandle ); 01666 ASSERT(NT_SUCCESS(Status)); 01667 //#endif // NOT_YET_WORKING 01668 // Delay(1); 01669 01670 01671 // 01672 // Initialize the attributes 01673 // 01674 01675 InitializeObjectAttributes( 01676 &ObjectAttributes, 01677 &UnicodePortName, 01678 OBJ_CASE_INSENSITIVE, 01679 NULL, 01680 NULL 01681 ); 01682 ObjectAttributes.SecurityQualityOfService = (PVOID)(&SecurityQos); 01683 01684 // 01685 // Calculate the share access 01686 // 01687 01688 Share = (Config == FILE_PIPE_INBOUND ? FILE_SHARE_WRITE : 01689 (Config == FILE_PIPE_OUTBOUND ? FILE_SHARE_READ : 01690 FILE_SHARE_READ | FILE_SHARE_WRITE)); 01691 01692 01693 01694 // 01695 // And now open it... 01696 // 01697 01698 if (!NT_SUCCESS(Status = NtOpenFile( 01699 &PipeHandle, 01700 GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, 01701 &ObjectAttributes, 01702 &Iosb, 01703 Share, 01704 0 ))) { 01705 01706 Error( OpenPipe, Status ); 01707 } 01708 01709 if ((ReadMode != FILE_PIPE_BYTE_STREAM_MODE) || 01710 (CompletionMode != FILE_PIPE_QUEUE_OPERATION)) { 01711 01712 FILE_PIPE_INFORMATION Buffer; 01713 01714 Buffer.ReadMode = ReadMode; 01715 Buffer.CompletionMode = CompletionMode; 01716 01717 if (!NT_SUCCESS(Status = NtSetInformationFile( 01718 PipeHandle, 01719 &Iosb, 01720 &Buffer, 01721 sizeof(FILE_PIPE_INFORMATION), 01722 FilePipeInformation ))) { 01723 01724 Error( NtSetInformationFile, Status ); 01725 } 01726 } 01727 01728 return PipeHandle; 01729 }

BOOLEAN SepClientTest VOID   ) 
 

Definition at line 502 of file ctlnpqos.c.

References DbgPrint, SepClientTestDynamic(), SepClientTestStatic(), and TRUE.

00504 : 00505 // 00506 // Static Context Tracking Tests 00507 // Effective Only 00508 // Anonymous 00509 // Identification 00510 // Impersonation 00511 // Not Effective Only 00512 // Anonymous 00513 // Identification 00514 // Impersonation 00515 // 00516 // Dynamic Context Tracking Tests 00517 // Effective Only 00518 // Identification 00519 // Impersonation 00520 // Not Effective Only 00521 // Identification 00522 // Impersonation 00523 // 00524 { 00525 00526 BOOLEAN CompletionStatus; 00527 00528 00529 00530 00531 // 00532 // Run the static test suite... 00533 // 00534 00535 CompletionStatus = SepClientTestStatic(); 00536 00537 // 00538 // Run the dynamic test suite... 00539 // 00540 00541 if (CompletionStatus == TRUE) { 00542 CompletionStatus = SepClientTestDynamic(); 00543 } 00544 00545 DbgPrint("Se: Client Test Complete.\n"); 00546 00547 00548 return CompletionStatus; 00549 }

BOOLEAN SepClientTestAnonymous BOOLEAN  StaticTest,
BOOLEAN  EffectiveOnly
 

Definition at line 363 of file ctlnpqos.c.

References SepClientConnect(), SepClientDropConnection(), SepClientMakeRemoteCall(), and TRUE.

00368 { 00369 00371 // // 00372 // Anonymous Use Test // 00373 // // 00375 00376 SECURITY_CONTEXT_TRACKING_MODE TrackingMode; 00377 00378 if (StaticTest) { 00379 TrackingMode = SECURITY_STATIC_TRACKING; 00380 } else { 00381 TrackingMode = SECURITY_DYNAMIC_TRACKING; 00382 } 00383 00384 if (!StaticTest) { 00385 // 00386 // No action for dynamic test 00387 // 00388 return TRUE; 00389 } 00390 00391 // 00392 // Anonymous Use ... Test 00393 // 00394 00395 00396 SepClientConnect( 00397 SecurityAnonymous, 00398 TrackingMode, 00399 EffectiveOnly 00400 ); 00401 00402 SepClientMakeRemoteCall(); 00403 00404 SepClientDropConnection(); 00405 00406 00407 return TRUE; 00408 }

BOOLEAN SepClientTestDynamic VOID   ) 
 

Definition at line 288 of file ctlnpqos.c.

References FALSE, SepClientTestEffectiveOnly(), SepClientTestNotEffectiveOnly(), and TRUE.

00290 { 00291 BOOLEAN CompletionStatus; 00292 00293 // 00294 // Dynamic Context Tracking ... Suite 00295 // 00296 00297 CompletionStatus = SepClientTestEffectiveOnly( FALSE ); 00298 00299 00300 if (CompletionStatus == TRUE) { 00301 00302 CompletionStatus = SepClientTestNotEffectiveOnly( FALSE ); 00303 } 00304 00305 return CompletionStatus; 00306 00307 }

BOOLEAN SepClientTestEffectiveOnly BOOLEAN  StaticTest  ) 
 

Definition at line 311 of file ctlnpqos.c.

References SepClientTestAnonymous(), SepClientTestIdentification(), SepClientTestImpersonation(), and TRUE.

00316 { 00317 00318 BOOLEAN CompletionStatus; 00319 00320 // 00321 // Effective Only ... Test 00322 // 00323 00324 CompletionStatus = SepClientTestAnonymous( StaticTest, TRUE ); 00325 if (CompletionStatus == TRUE) { 00326 CompletionStatus = SepClientTestIdentification( StaticTest, TRUE ); 00327 } 00328 if (CompletionStatus == TRUE) { 00329 CompletionStatus = SepClientTestImpersonation( StaticTest, TRUE ); 00330 } 00331 00332 return CompletionStatus; 00333 00334 }

BOOLEAN SepClientTestIdentification BOOLEAN  StaticTest,
BOOLEAN  EffectiveOnly
 

Definition at line 412 of file ctlnpqos.c.

References SepClientConnect(), SepClientDropConnection(), SepClientMakeRemoteCall(), and TRUE.

00417 { 00418 00420 // // 00421 // Identification Use Test // 00422 // // 00424 00425 SECURITY_CONTEXT_TRACKING_MODE TrackingMode; 00426 00427 if (StaticTest) { 00428 TrackingMode = SECURITY_STATIC_TRACKING; 00429 } else { 00430 TrackingMode = SECURITY_DYNAMIC_TRACKING; 00431 } 00432 00433 // 00434 // Identification Use ... Test 00435 // 00436 00437 00438 SepClientConnect( 00439 SecurityIdentification, 00440 TrackingMode, 00441 EffectiveOnly 00442 ); 00443 00444 SepClientMakeRemoteCall(); 00445 00446 SepClientDropConnection(); 00447 00448 00449 return TRUE; 00450 00451 }

BOOLEAN SepClientTestImpersonation BOOLEAN  StaticTest,
BOOLEAN  EffectiveOnly
 

Definition at line 455 of file ctlnpqos.c.

References SepClientConnect(), SepClientDropConnection(), SepClientMakeRemoteCall(), and TRUE.

00460 { 00461 00463 // // 00464 // Impersonation Use Test // 00465 // // 00467 00468 SECURITY_CONTEXT_TRACKING_MODE TrackingMode; 00469 00470 if (StaticTest) { 00471 TrackingMode = SECURITY_STATIC_TRACKING; 00472 } else { 00473 TrackingMode = SECURITY_DYNAMIC_TRACKING; 00474 } 00475 00476 00477 // 00478 // Impersonation Use ... Test 00479 // 00480 00481 00482 SepClientConnect( 00483 SecurityImpersonation, 00484 TrackingMode, 00485 EffectiveOnly 00486 ); 00487 00488 SepClientMakeRemoteCall(); 00489 00490 SepClientDropConnection(); 00491 00492 00493 00494 return TRUE; 00495 00496 }

BOOLEAN SepClientTestNotEffectiveOnly BOOLEAN  StaticTest  ) 
 

Definition at line 338 of file ctlnpqos.c.

References FALSE, SepClientTestAnonymous(), SepClientTestIdentification(), SepClientTestImpersonation(), and TRUE.

00342 { 00343 BOOLEAN CompletionStatus; 00344 00345 // 00346 // Not Effective Only ... Test 00347 // 00348 00349 CompletionStatus = SepClientTestAnonymous( StaticTest, FALSE ); 00350 if (CompletionStatus == TRUE) { 00351 CompletionStatus = SepClientTestIdentification( StaticTest, FALSE ); 00352 } 00353 if (CompletionStatus == TRUE) { 00354 CompletionStatus = SepClientTestImpersonation( StaticTest, FALSE ); 00355 } 00356 00357 return CompletionStatus; 00358 00359 }

BOOLEAN SepClientTestStatic VOID   ) 
 

Definition at line 264 of file ctlnpqos.c.

References SepClientTestEffectiveOnly(), SepClientTestNotEffectiveOnly(), and TRUE.

00266 { 00267 00268 BOOLEAN CompletionStatus; 00269 00270 // 00271 // Static Context Tracking ... Suite 00272 // 00273 00274 CompletionStatus = SepClientTestEffectiveOnly( TRUE ); 00275 00276 00277 if (CompletionStatus == TRUE) { 00278 00279 CompletionStatus = SepClientTestNotEffectiveOnly( TRUE ); 00280 } 00281 00282 return CompletionStatus; 00283 00284 }

VOID SepReadPipe  ) 
 

Definition at line 1258 of file ctlnpqos.c.

References Buffer, DevPrint, Error, NT_SUCCESS, NtReadFile(), NtWaitForSingleObject(), NULL, Status, TalkPort, and TRUE.

Referenced by SepServerGetNextMessage().

01260 { 01261 IO_STATUS_BLOCK Iosb; 01262 UCHAR Buffer[512]; 01263 01264 DevPrint("ReadPipe...\n", 0); 01265 01266 if (!NT_SUCCESS(Status = NtReadFile( TalkPort, 01267 (HANDLE)NULL, 01268 (PIO_APC_ROUTINE)NULL, 01269 (PVOID)NULL, 01270 &Iosb, 01271 Buffer, 01272 512, 01273 (PLARGE_INTEGER)NULL, 01274 (PULONG) NULL ))) { 01275 Error( NtReadFile, Status ); 01276 } 01277 01278 if (!NT_SUCCESS(Status = NtWaitForSingleObject( TalkPort, TRUE, NULL ))) { 01279 01280 Error( NtWaitForSingleObject, Status ); 01281 } 01282 01283 if (!NT_SUCCESS(Iosb.Status)) { 01284 01285 Error( NtReadFileFinalStatus, Iosb.Status ); 01286 } 01287 01288 return; 01289 }

VOID SepReadPipe VOID   ) 
 

VOID SepServerCompleteMessage VOID   ) 
 

Definition at line 626 of file ctlnpqos.c.

References DevPrint, and SepWritePipe().

00628 { 00629 00630 DevPrint("\nServer: "); 00631 SepWritePipe("Return From Server\n"); 00632 return; 00633 }

HANDLE SepServerCreatePipe VOID   ) 
 

Definition at line 1377 of file ctlnpqos.c.

References COMPLETION_MODE, Error, NAMED_PIPE_CONFIGURATION, NAMED_PIPE_TYPE, NT_SUCCESS, NtCreateNamedPipeFile(), NTSTATUS(), NULL, ObjectAttributes, READ_MODE, RtlFreeUnicodeString(), Status, and UnicodePortName.

Referenced by SepServerInitialize().

01380 { 01381 HANDLE PipeHandle; 01382 NTSTATUS Status; 01383 IO_STATUS_BLOCK Iosb; 01384 LARGE_INTEGER Timeout; 01385 READ_MODE Mode; 01386 ULONG Share; 01387 NAMED_PIPE_CONFIGURATION Config = FILE_PIPE_FULL_DUPLEX; 01388 NAMED_PIPE_TYPE PipeType = FILE_PIPE_MESSAGE_TYPE; 01389 COMPLETION_MODE CompletionMode = FILE_PIPE_QUEUE_OPERATION; 01390 ULONG MaximumInstances = 4; 01391 01392 01393 // 01394 // Set the default timeout to 60 seconds, and initalize the attributes 01395 // 01396 01397 Timeout.QuadPart = -10 * 1000 * 1000 * 60; 01398 01399 InitializeObjectAttributes( 01400 &ObjectAttributes, 01401 &UnicodePortName, 01402 OBJ_CASE_INSENSITIVE, 01403 NULL, 01404 NULL 01405 ); 01406 01407 // 01408 // Calculate the readmode and share access 01409 // 01410 01411 Mode = (PipeType == FILE_PIPE_MESSAGE_TYPE ? FILE_PIPE_MESSAGE_MODE : 01412 FILE_PIPE_BYTE_STREAM_MODE); 01413 01414 Share = (Config == FILE_PIPE_INBOUND ? FILE_SHARE_WRITE : 01415 (Config == FILE_PIPE_OUTBOUND ? FILE_SHARE_READ : 01416 FILE_SHARE_READ | FILE_SHARE_WRITE)); 01417 01418 if (!NT_SUCCESS(Status = NtCreateNamedPipeFile( 01419 &PipeHandle, 01420 GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, 01421 &ObjectAttributes, 01422 &Iosb, 01423 Share, 01424 FILE_CREATE, 01425 0, 01426 PipeType, 01427 Mode, 01428 CompletionMode, 01429 MaximumInstances, 01430 1024, 01431 1024, 01432 (PLARGE_INTEGER)&Timeout ))) { 01433 01434 Error( CreatePipe, Status ); 01435 } 01436 RtlFreeUnicodeString( &UnicodePortName ); 01437 01438 return PipeHandle; 01439 }

VOID SepServerDisconnectPipe  ) 
 

Definition at line 1520 of file ctlnpqos.c.

References DevPrint, EarPort, Error, NT_SUCCESS, NtClose(), NtFlushBuffersFile(), NtFsControlFile(), NTSTATUS(), NtWaitForSingleObject(), NULL, SEASSERT_SUCCESS, Status, TalkPort, and TRUE.

Referenced by SepServerDropConnection().

01522 { 01523 NTSTATUS Status; 01524 IO_STATUS_BLOCK Iosb; 01525 01526 DevPrint("DisconnectPipe...\n", 0); 01527 DevPrint(" (Flush)...\n", 0); 01528 01529 if (!NT_SUCCESS(Status = NtFlushBuffersFile( 01530 TalkPort, 01531 &Iosb 01532 ))) { 01533 Error( DisconnectPipe, Status ); 01534 } 01535 01536 if (!NT_SUCCESS(Iosb.Status)) { 01537 01538 Error( FlushPipeFinalStatus, Iosb.Status ); 01539 } 01540 01541 01542 DevPrint(" (Close Talk Port)...\n", 0); 01543 Status = NtClose( TalkPort ); SEASSERT_SUCCESS(Status); 01544 01545 DevPrint(" (Disconnect)...\n", 0); 01546 if (!NT_SUCCESS(Status = NtFsControlFile( 01547 EarPort, 01548 NULL, // Event 01549 NULL, // ApcRoutine 01550 NULL, // ApcContext 01551 &Iosb, 01552 FSCTL_PIPE_DISCONNECT, 01553 NULL, // InputBuffer 01554 0, // InputBufferLength, 01555 NULL, // OutputBuffer 01556 0 // OutputBufferLength 01557 ))) { 01558 01559 Error( DisconnectPipe, Status ); 01560 } 01561 if (!NT_SUCCESS(Status = NtWaitForSingleObject( EarPort, TRUE, NULL ))) { 01562 01563 Error( NtWaitForSingleObject, Status ); 01564 } 01565 01566 if (!NT_SUCCESS(Iosb.Status)) { 01567 01568 Error( DisconnectPipeFinalStatus, Iosb.Status ); 01569 } 01570 01571 return; 01572 }

VOID SepServerDisconnectPipe VOID   ) 
 

VOID SepServerDropConnection VOID   ) 
 

Definition at line 665 of file ctlnpqos.c.

References DevPrint, and SepServerDisconnectPipe().

00667 { 00668 DevPrint("\nServer: "); 00669 SepServerDisconnectPipe(); 00670 00671 return; 00672 }

VOID SepServerGetNextMessage VOID   ) 
 

Definition at line 611 of file ctlnpqos.c.

References DevPrint, RequestCount, and SepReadPipe().

00613 { 00614 00615 00616 00617 DevPrint("\nServer: "); 00618 SepReadPipe(); 00619 00620 RequestCount += 1; 00621 00622 return; 00623 }

VOID SepServerImpersonateClient VOID   ) 
 

Definition at line 636 of file ctlnpqos.c.

References DevPrint, and SepServerImpersonatePipe().

00638 { 00639 00640 DevPrint("\nServer: "); 00641 SepServerImpersonatePipe( ); 00642 00643 }

VOID SepServerImpersonatePipe  ) 
 

Definition at line 1482 of file ctlnpqos.c.

References DevPrint, Error, NT_SUCCESS, NtFsControlFile(), NTSTATUS(), NtWaitForSingleObject(), NULL, Status, TalkPort, and TRUE.

Referenced by SepServerImpersonateClient().

01484 { 01485 NTSTATUS Status; 01486 IO_STATUS_BLOCK Iosb; 01487 01488 DevPrint("ImpersonatePipe...\n", 0); 01489 01490 if (!NT_SUCCESS(Status = NtFsControlFile( 01491 TalkPort, 01492 NULL, // Event 01493 NULL, // ApcRoutine 01494 NULL, // ApcContext 01495 &Iosb, 01496 FSCTL_PIPE_IMPERSONATE, 01497 NULL, // InputBuffer 01498 0, // InputBufferLength, 01499 NULL, // OutputBuffer 01500 0 // OutputBufferLength 01501 ))) { 01502 01503 Error( ImpersonatePipe, Status ); 01504 } 01505 if (!NT_SUCCESS(Status = NtWaitForSingleObject( TalkPort, TRUE, NULL ))) { 01506 01507 Error( NtWaitForSingleObject, Status ); 01508 } 01509 01510 if (!NT_SUCCESS(Iosb.Status)) { 01511 01512 Error( ImpersonatePipeFinalStatus, Iosb.Status ); 01513 } 01514 01515 return; 01516 }

VOID SepServerImpersonatePipe VOID   ) 
 

NTSTATUS SepServerInitialize  ) 
 

Definition at line 1028 of file ctlnpqos.c.

References ASSERT, DbgPrint, EarPort, EventHandle, NT_SUCCESS, NtClose(), NtOpenThread(), NtWaitForSingleObject(), NULL, RequestCount, SEASSERT_SUCCESS, SepServerCreatePipe(), SepServerSpawnClientProcess(), SepServerThread, Status, and TRUE.

Referenced by CtLnpQos(), and CtLpcQos().

01031 { 01032 01033 OBJECT_ATTRIBUTES ThreadAttributes; 01034 PTEB CurrentTeb; 01035 01036 01037 DbgPrint("Se: Server Initializing ...\n"); 01038 01039 // 01040 // Initialize global variables 01041 // 01042 01043 RequestCount = 0; 01044 01045 // 01046 // Get a handle to our thread to so that we can access our thread 01047 // even when impersonating an anonymous client (which we can't do 01048 // using NtCurrentThread()). 01049 // 01050 01051 CurrentTeb = NtCurrentTeb(); 01052 InitializeObjectAttributes(&ThreadAttributes, NULL, 0, NULL, NULL); 01053 Status = NtOpenThread( 01054 &SepServerThread, // TargetHandle 01055 THREAD_ALL_ACCESS, // DesiredAccess 01056 &ThreadAttributes, // ObjectAttributes 01057 &CurrentTeb->ClientId // ClientId 01058 ); 01059 ASSERT( NT_SUCCESS(Status) ); 01060 01061 01062 // 01063 // Create the server's port 01064 // 01065 01066 EarPort = SepServerCreatePipe(); 01067 01068 01069 01070 // 01071 // Spawn a copy of ourselves... 01072 // 01073 01074 DbgPrint("Se: Server Spawning client process ...\n"); 01075 SepServerSpawnClientProcess(); 01076 01077 01078 DbgPrint("Se: Server waiting for start of test signal ...\n"); 01079 01080 Status = NtWaitForSingleObject( 01081 EventHandle, 01082 TRUE, 01083 NULL 01084 ); SEASSERT_SUCCESS(Status); 01085 01086 Status = NtClose( EventHandle ); SEASSERT_SUCCESS(Status); 01087 01088 01089 return STATUS_SUCCESS; 01090 }

VOID SepServerListenPipe  ) 
 

Definition at line 1443 of file ctlnpqos.c.

References DevPrint, EarPort, Error, NT_SUCCESS, NtFsControlFile(), NTSTATUS(), NtWaitForSingleObject(), NULL, Status, and TRUE.

Referenced by SepServerWaitForNextConnect().

01445 { 01446 NTSTATUS Status; 01447 IO_STATUS_BLOCK Iosb; 01448 01449 DevPrint("ListenPipe...\n", 0); 01450 01451 if (!NT_SUCCESS(Status = NtFsControlFile( 01452 EarPort, 01453 NULL, // Event 01454 NULL, // ApcRoutine 01455 NULL, // ApcContext 01456 &Iosb, 01457 FSCTL_PIPE_LISTEN, 01458 NULL, // InputBuffer 01459 0, // InputBufferLength, 01460 NULL, // OutputBuffer 01461 0 // OutputBufferLength 01462 ))) { 01463 01464 Error( ListenPipe, Status ); 01465 } 01466 if (!NT_SUCCESS(Status = NtWaitForSingleObject( EarPort, TRUE, NULL ))) { 01467 01468 Error( NtWaitForSingleObject, Status ); 01469 } 01470 01471 if (!NT_SUCCESS(Iosb.Status)) { 01472 01473 Error( ListenPipeFinalStatus, Iosb.Status ); 01474 } 01475 01476 01477 return; 01478 }

VOID SepServerListenPipe VOID   ) 
 

VOID SepServerRevertToSelf VOID   ) 
 

Definition at line 647 of file ctlnpqos.c.

References NtSetInformationThread(), NTSTATUS(), NULL, SEASSERT_SUCCESS, and SepServerThread.

00649 { 00650 NTSTATUS TmpStatus; 00651 HANDLE NullHandle; 00652 00653 NullHandle = NULL; 00654 TmpStatus = NtSetInformationThread( 00655 SepServerThread, 00656 ThreadImpersonationToken, 00657 (PVOID)&NullHandle, 00658 (ULONG)sizeof(HANDLE) 00659 ); SEASSERT_SUCCESS(TmpStatus); 00660 00661 }

VOID SepServerSpawnClientProcess VOID   ) 
 

Definition at line 1093 of file ctlnpqos.c.

References FALSE, NT_SUCCESS, NtResumeThread(), NULL, RtlAnsiStringToUnicodeString(), RtlCreateProcessParameters(), RtlCreateUserProcess(), RtlDestroyProcessParameters(), RtlFreeUnicodeString(), RtlInitString(), SEASSERT_SUCCESS, Status, and TRUE.

01095 { 01096 01097 RTL_USER_PROCESS_INFORMATION ProcessInformation; 01098 STRING ProgramName; 01099 UNICODE_STRING UnicodeProgramName; 01100 STRING ImagePathName; 01101 UNICODE_STRING UnicodeImagePathName; 01102 PRTL_USER_PROCESS_PARAMETERS ProcessParameters; 01103 01104 RtlInitString( &ProgramName, "\\SystemRoot\\Bin\\utlnpqos.exe" ); 01105 Status = RtlAnsiStringToUnicodeString( 01106 &UnicodeProgramName, 01107 &ProgramName, 01108 TRUE ); SEASSERT_SUCCESS( NT_SUCCESS(Status) ); 01109 RtlInitString( &ImagePathName, "utlnpqos.exe"); 01110 Status = RtlAnsiStringToUnicodeString( 01111 &UnicodeImagePathName, 01112 &ImagePathName, 01113 TRUE ); SEASSERT_SUCCESS( NT_SUCCESS(Status) ); 01114 01115 01116 Status = RtlCreateProcessParameters( 01117 &ProcessParameters, 01118 &ImagePathName, // FIX, FIX &UnicodeImagePathName, (when converted to unicode) 01119 NULL, 01120 NULL, 01121 NULL, 01122 NULL, 01123 NULL, 01124 NULL, 01125 NULL, 01126 NULL 01127 ); 01128 01129 SEASSERT_SUCCESS(Status); 01130 RtlFreeUnicodeString( &UnicodeImagePathName ); 01131 01132 01133 Status = RtlCreateUserProcess( 01134 &ProgramName, // FIX, FIX &UnicodeProgramName (when converted to unicode) 01135 ProcessParameters, // ProcessParameters 01136 NULL, // ProcessSecurityDescriptor 01137 NULL, // ThreadSecurityDescriptor 01138 NtCurrentProcess(), // ParentProcess 01139 FALSE, // InheritHandles 01140 NULL, // DebugPort 01141 NULL, // ExceptionPort 01142 &ProcessInformation // ProcessInformation 01143 ); SEASSERT_SUCCESS(Status); 01144 RtlFreeUnicodeString( &UnicodeProgramName ); 01145 01146 Status = NtResumeThread( 01147 ProcessInformation.Thread, 01148 NULL 01149 ); SEASSERT_SUCCESS(Status); 01150 01151 RtlDestroyProcessParameters( ProcessParameters ); 01152 01153 }

BOOLEAN SepServerTest VOID   ) 
 

Definition at line 960 of file ctlnpqos.c.

References DbgPrint, SepServerTestDynamic(), SepServerTestStatic(), and TRUE.

00962 : 00963 // 00964 // Static Context Tracking Tests 00965 // Effective Only 00966 // Anonymous 00967 // Identification 00968 // Impersonation 00969 // Not Effective Only 00970 // Anonymous 00971 // Identification 00972 // Impersonation 00973 // 00974 // Dynamic Context Tracking Tests 00975 // Effective Only 00976 // Identification 00977 // Impersonation 00978 // Not Effective Only 00979 // Identification 00980 // Impersonation 00981 // 00982 { 00983 00984 BOOLEAN CompletionStatus; 00985 00986 00987 DbgPrint("Se: Server Starting Test ...\n"); 00988 00989 // 00990 // Run the static test suite... 00991 // 00992 00993 CompletionStatus = SepServerTestStatic(); 00994 00995 // 00996 // Run the dynamic test suite... 00997 // 00998 00999 if (CompletionStatus == TRUE) { 01000 CompletionStatus = SepServerTestDynamic(); 01001 } 01002 01003 DbgPrint("Se: Server Test Complete.\n"); 01004 01005 // 01006 // Print test results 01007 // 01008 01009 DbgPrint("\n"); 01010 DbgPrint("\n"); 01011 DbgPrint("**********************\n"); 01012 DbgPrint("** **\n"); 01013 01014 if (CompletionStatus == TRUE) { 01015 DbgPrint("** Test Succeeded **\n"); 01016 } else { 01017 DbgPrint("** Test Failed !! **\n"); 01018 } 01019 01020 DbgPrint("** **\n"); 01021 DbgPrint("**********************\n"); 01022 01023 return CompletionStatus; 01024 01025 }

BOOLEAN SepServerTestAnonymous BOOLEAN  StaticTest,
BOOLEAN  EffectiveOnly
 

Definition at line 765 of file ctlnpqos.c.

References ClientToken, DbgPrint, FALSE, NtOpenThreadToken(), SepServerCompleteMessage(), SepServerDropConnection(), SepServerGetNextMessage(), SepServerImpersonateClient(), SepServerRevertToSelf(), SepServerThread, SepServerWaitForNextConnect(), Status, and TRUE.

00770 { 00771 BOOLEAN CompletionStatus = TRUE; 00772 00774 // // 00775 // Anonymous Use Test // 00776 // // 00778 00779 00780 if (!StaticTest) { 00781 // 00782 // No action for dynamic test 00783 // 00784 00785 return TRUE; 00786 } 00787 00788 DbgPrint("Se: Anonymous Use ... "); 00789 00790 SepServerWaitForNextConnect(); 00791 00792 SepServerGetNextMessage(); 00793 00794 00795 SepServerImpersonateClient(); 00796 Status = NtOpenThreadToken( 00797 SepServerThread, 00798 TOKEN_ALL_ACCESS, 00799 TRUE, 00800 &ClientToken 00801 ); 00802 SepServerRevertToSelf(); 00803 if (Status == STATUS_CANT_OPEN_ANONYMOUS) { 00804 00805 DbgPrint(" Succeeded\n"); 00806 00807 } else { 00808 DbgPrint("* ! FAILED (srvr) ! *\n"); 00809 DbgPrint("Status is: 0x%lx \n", Status ); 00810 CompletionStatus = FALSE; 00811 } 00812 00813 00814 SepServerCompleteMessage(); 00815 00816 SepServerDropConnection(); 00817 00818 // 00819 // Appease the compiler Gods.. 00820 // 00821 00822 if (EffectiveOnly) {;} 00823 00824 00825 return CompletionStatus; 00826 00827 }

BOOLEAN SepServerTestDynamic VOID   ) 
 

Definition at line 696 of file ctlnpqos.c.

References DbgPrint, FALSE, SepServerTestEffectiveOnly(), SepServerTestNotEffectiveOnly(), and TRUE.

00698 { 00699 BOOLEAN CompletionStatus; 00700 00701 DbgPrint("Se: Dynamic Context Tracking ... Suite\n"); 00702 00703 CompletionStatus = SepServerTestEffectiveOnly( FALSE ); 00704 00705 00706 if (CompletionStatus == TRUE) { 00707 00708 CompletionStatus = SepServerTestNotEffectiveOnly( FALSE ); 00709 } 00710 00711 return CompletionStatus; 00712 00713 }

BOOLEAN SepServerTestEffectiveOnly BOOLEAN  StaticTest  ) 
 

Definition at line 717 of file ctlnpqos.c.

References DbgPrint, SepServerTestAnonymous(), SepServerTestIdentification(), SepServerTestImpersonation(), and TRUE.

00721 { 00722 00723 BOOLEAN CompletionStatus; 00724 00725 DbgPrint("Se: Effective Only ... Test\n"); 00726 00727 CompletionStatus = SepServerTestAnonymous( StaticTest, TRUE ); 00728 if (CompletionStatus == TRUE) { 00729 CompletionStatus = SepServerTestIdentification( StaticTest, TRUE ); 00730 } 00731 if (CompletionStatus == TRUE) { 00732 CompletionStatus = SepServerTestImpersonation( StaticTest, TRUE ); 00733 } 00734 00735 return CompletionStatus; 00736 00737 }

BOOLEAN SepServerTestIdentification BOOLEAN  StaticTest,
BOOLEAN  EffectiveOnly
 

Definition at line 831 of file ctlnpqos.c.

References ClientToken, ClientTokenStatistics, DbgPrint, FALSE, IgnoreLength, NtOpenThreadToken(), NtQueryInformationToken(), SEASSERT_SUCCESS, SepServerCompleteMessage(), SepServerDropConnection(), SepServerGetNextMessage(), SepServerImpersonateClient(), SepServerRevertToSelf(), SepServerThread, SepServerWaitForNextConnect(), Status, and TRUE.

00836 { 00837 00838 BOOLEAN CompletionStatus = TRUE; 00840 // // 00841 // Identification Use Test // 00842 // // 00844 00845 DbgPrint("Se: Identification Use ... "); 00846 00847 SepServerWaitForNextConnect(); 00848 00849 SepServerGetNextMessage(); 00850 00851 SepServerImpersonateClient(); 00852 Status = NtOpenThreadToken( 00853 SepServerThread, 00854 TOKEN_ALL_ACCESS, 00855 TRUE, 00856 &ClientToken 00857 ); SEASSERT_SUCCESS(Status); 00858 SepServerRevertToSelf(); 00859 Status = NtQueryInformationToken( 00860 ClientToken, 00861 TokenStatistics, 00862 &ClientTokenStatistics, 00863 (ULONG)sizeof(TOKEN_STATISTICS), 00864 &IgnoreLength 00865 ); SEASSERT_SUCCESS(Status); 00866 00867 if ( (ClientTokenStatistics.TokenType == TokenImpersonation) && 00868 (ClientTokenStatistics.ImpersonationLevel == SecurityIdentification) 00869 ) { 00870 DbgPrint(" Succeeded\n"); 00871 00872 } else { 00873 DbgPrint("* ! FAILED (srvr) ! *\n"); 00874 CompletionStatus = FALSE; 00875 } 00876 00877 00878 SepServerCompleteMessage(); 00879 00880 SepServerDropConnection(); 00881 00882 // 00883 // Appease the compiler Gods.. 00884 // 00885 if (StaticTest) {;} 00886 if (EffectiveOnly) {;} 00887 00888 return CompletionStatus; 00889 }

BOOLEAN SepServerTestImpersonation BOOLEAN  StaticTest,
BOOLEAN  EffectiveOnly
 

Definition at line 893 of file ctlnpqos.c.

References ClientToken, ClientTokenStatistics, DbgPrint, FALSE, IgnoreLength, NtOpenThreadToken(), NtQueryInformationToken(), SEASSERT_SUCCESS, SepServerCompleteMessage(), SepServerDropConnection(), SepServerGetNextMessage(), SepServerImpersonateClient(), SepServerRevertToSelf(), SepServerThread, SepServerWaitForNextConnect(), Status, and TRUE.

00898 { 00899 BOOLEAN CompletionStatus = TRUE; 00900 00902 // // 00903 // Impersonation Use Test // 00904 // // 00906 00907 DbgPrint("Se: Impersonation Use ... "); 00908 00909 00910 SepServerWaitForNextConnect(); 00911 00912 SepServerGetNextMessage(); 00913 00914 00915 00916 SepServerImpersonateClient(); 00917 Status = NtOpenThreadToken( 00918 SepServerThread, 00919 TOKEN_ALL_ACCESS, 00920 TRUE, 00921 &ClientToken 00922 ); SEASSERT_SUCCESS(Status); 00923 SepServerRevertToSelf(); 00924 Status = NtQueryInformationToken( 00925 ClientToken, 00926 TokenStatistics, 00927 &ClientTokenStatistics, 00928 (ULONG)sizeof(TOKEN_STATISTICS), 00929 &IgnoreLength 00930 ); SEASSERT_SUCCESS(Status); 00931 00932 if ( (ClientTokenStatistics.TokenType == TokenImpersonation) && 00933 (ClientTokenStatistics.ImpersonationLevel == SecurityImpersonation) 00934 ) { 00935 DbgPrint(" Succeeded\n"); 00936 00937 } else { 00938 DbgPrint("* ! FAILED (srvr) ! *\n"); 00939 CompletionStatus = FALSE; 00940 } 00941 00942 00943 00944 00945 SepServerCompleteMessage(); 00946 00947 SepServerDropConnection(); 00948 00949 // 00950 // Appease the compiler gods 00951 // 00952 if (StaticTest) {;} 00953 if (EffectiveOnly) {;} 00954 00955 return CompletionStatus; 00956 }

BOOLEAN SepServerTestNotEffectiveOnly BOOLEAN  StaticTest  ) 
 

Definition at line 741 of file ctlnpqos.c.

References DbgPrint, FALSE, SepServerTestAnonymous(), SepServerTestIdentification(), SepServerTestImpersonation(), and TRUE.

00745 { 00746 00747 BOOLEAN CompletionStatus; 00748 00749 DbgPrint("Se: Not Effective Only ... Test\n"); 00750 00751 CompletionStatus = SepServerTestAnonymous( StaticTest, FALSE ); 00752 if (CompletionStatus == TRUE) { 00753 CompletionStatus = SepServerTestIdentification( StaticTest, FALSE ); 00754 } 00755 if (CompletionStatus == TRUE) { 00756 CompletionStatus = SepServerTestImpersonation( StaticTest, FALSE ); 00757 } 00758 00759 return CompletionStatus; 00760 00761 }

BOOLEAN SepServerTestStatic VOID   ) 
 

Definition at line 675 of file ctlnpqos.c.

References DbgPrint, SepServerTestEffectiveOnly(), SepServerTestNotEffectiveOnly(), and TRUE.

00677 { 00678 BOOLEAN CompletionStatus; 00679 00680 DbgPrint("Se: Static Context Tracking ... Suite\n"); 00681 00682 CompletionStatus = SepServerTestEffectiveOnly( TRUE ); 00683 00684 00685 if (CompletionStatus == TRUE) { 00686 00687 CompletionStatus = SepServerTestNotEffectiveOnly( TRUE ); 00688 } 00689 00690 return CompletionStatus; 00691 00692 }

VOID SepServerWaitForNextConnect VOID   ) 
 

Definition at line 588 of file ctlnpqos.c.

References ASSERT, DevPrint, EarPort, NT_SUCCESS, NtDuplicateObject(), SepServerListenPipe(), Status, and TalkPort.

00589 { 00590 00591 DevPrint("\nServer: "); 00592 SepServerListenPipe(); 00593 00594 Status = NtDuplicateObject( 00595 NtCurrentProcess(), // SourceProcessHandle 00596 EarPort, // SourceHandle 00597 NtCurrentProcess(), // TargetProcessHandle 00598 &TalkPort, // TargetHandle 00599 0, // DesiredAccess (over-ridden by option) 00600 0, // HandleAttributes 00601 DUPLICATE_SAME_ACCESS // Options 00602 ); 00603 ASSERT(NT_SUCCESS(Status)); 00604 00605 00606 return; 00607 00608 }

VOID SepTransceivePipe PSZ  String  ) 
 

Definition at line 1330 of file ctlnpqos.c.

References Buffer, DevPrint, Error, NT_SUCCESS, NtFsControlFile(), NTSTATUS(), NtWaitForSingleObject(), NULL, Status, String, strlen(), TalkPort, and TRUE.

Referenced by SepClientMakeRemoteCall().

01333 { 01334 NTSTATUS Status; 01335 IO_STATUS_BLOCK Iosb; 01336 UCHAR Buffer[512]; 01337 01338 01339 DevPrint("TransceivePipe...\n", 0); 01340 01341 if (!NT_SUCCESS(Status = NtFsControlFile( 01342 TalkPort, 01343 NULL, // Event 01344 NULL, // ApcRoutine 01345 NULL, // ApcContext 01346 &Iosb, 01347 FSCTL_PIPE_TRANSCEIVE, 01348 String, 01349 strlen( String ), 01350 Buffer, 01351 511 01352 ))) { 01353 Error( NtTransceiveFile, Status ); 01354 } 01355 01356 if (!NT_SUCCESS(Status = NtWaitForSingleObject( TalkPort, TRUE, NULL ))) { 01357 01358 Error( NtWaitForSingleObject, Status ); 01359 } 01360 01361 if (!NT_SUCCESS(Iosb.Status)) { 01362 01363 Error( NtTransceiveFileFinalStatus, Iosb.Status ); 01364 } 01365 01366 return; 01367 }

VOID SepWritePipe PSZ  String  ) 
 

Definition at line 1293 of file ctlnpqos.c.

References DevPrint, Error, NT_SUCCESS, NTSTATUS(), NtWaitForSingleObject(), NtWriteFile(), NULL, Status, String, strlen(), TalkPort, and TRUE.

Referenced by SepServerCompleteMessage().

01296 { 01297 NTSTATUS Status; 01298 IO_STATUS_BLOCK Iosb; 01299 01300 01301 DevPrint("WritePipe...\n", 0); 01302 01303 if (!NT_SUCCESS(Status = NtWriteFile( TalkPort, 01304 (HANDLE)NULL, 01305 (PIO_APC_ROUTINE)NULL, 01306 (PVOID)NULL, 01307 &Iosb, 01308 String, 01309 strlen( String ), 01310 (PLARGE_INTEGER)NULL, 01311 (PULONG)NULL ))) { 01312 Error( NtWriteFile, Status ); 01313 } 01314 01315 if (!NT_SUCCESS(Status = NtWaitForSingleObject( TalkPort, TRUE, NULL ))) { 01316 01317 Error( NtWaitForSingleObject, Status ); 01318 } 01319 01320 if (!NT_SUCCESS(Iosb.Status)) { 01321 01322 Error( NtWriteFileFinalStatus, Iosb.Status ); 01323 } 01324 01325 return; 01326 }


Variable Documentation

HANDLE ClientToken
 

Definition at line 39 of file ctlnpqos.c.

Referenced by NtAccessCheck(), NtAccessCheckByType(), NtAccessCheckByTypeResultList(), NtAccessCheckByTypeResultListAndAuditAlarmByHandle(), NtOpenObjectAuditAlarm(), NtPrivilegeCheck(), NtPrivilegedServiceAuditAlarm(), NtPrivilegeObjectAuditAlarm(), RtlpGetDefaultsSubjectContext(), SeAccessCheckByType(), SeCopyClientToken(), SepAccessCheck(), SepAccessCheckAndAuditAlarm(), SepAdtObjectReferenceAuditAlarm(), SepAdtOpenObjectAuditAlarm(), SepAdtOpenObjectForDeleteAuditAlarm(), SepAdtPrivilegedServiceAuditAlarm(), SepAdtPrivilegeObjectAuditAlarm(), SepServerTestAnonymous(), SepServerTestIdentification(), and SepServerTestImpersonation().

TOKEN_STATISTICS ClientTokenStatistics
 

Definition at line 40 of file ctlnpqos.c.

Referenced by RtlNewInstanceSecurityObject(), SepServerTestIdentification(), and SepServerTestImpersonation().

HANDLE EarPort
 

Definition at line 35 of file ctlnpqos.c.

Referenced by SepServerDisconnectPipe(), SepServerInitialize(), SepServerListenPipe(), and SepServerWaitForNextConnect().

HANDLE EventHandle
 

Definition at line 30 of file ctlnpqos.c.

Referenced by CtLnpQos(), CtLpcQos(), IoCreateNotificationEvent(), IoCreateSynchronizationEvent(), main(), NtClearEvent(), NtCreateEvent(), NtOpenEvent(), NtPulseEvent(), NtQueryEvent(), NtResetEvent(), NtSetEvent(), NtSetSystemInformation(), SepClientInitialize(), and SepServerInitialize().

STRING EventName
 

Definition at line 28 of file ctlnpqos.c.

Referenced by CtLnpQos(), CtLpcQos(), IoCreateNotificationEvent(), and IoCreateSynchronizationEvent().

ULONG IgnoreLength
 

Definition at line 41 of file ctlnpqos.c.

Referenced by SepServerTestIdentification(), and SepServerTestImpersonation().

OBJECT_ATTRIBUTES ObjectAttributes
 

Definition at line 27 of file ctlnpqos.c.

Referenced by CmGetSystemDriverList(), CmInitSystem1(), CmpAddToHiveFileList(), CmpCreatePredefined(), CmpCreateRegistryRoot(), CmpInitializeHardwareConfiguration(), CmpInitializeMachineDependentConfiguration(), CmpInitializeRegistryNode(), CmpLinkHiveToMaster(), CmpOpenHiveFiles(), CmpRemoveFromHiveFileList(), CmpSetVersionData(), Copy(), CtLnpQos(), CtLpcQos(), Delete(), DoPartyTest(), Dump(), DumpKeys(), DumpObjectDirs(), EhOpenHive(), ExCreateCallback(), ExpCreateWorkerThread(), ExpDetectWorkerThreadDeadlock(), ExpGetCurrentUserUILanguage(), ExpGetUILanguagePolicy(), ExpInitializeCallbacks(), ExpSetCurrentUserUILanguage(), ExpUuidLoadSequenceNumber(), ExpUuidSaveSequenceNumber(), ExpWorkerInitialization(), FsRtlGetCompatibilityModeValue(), FsRtlGetTunnelParameterValue(), FsRtlInitializeWorkerThread(), InitCreateObjectDirectory(), IoCreateFile(), IoFastQueryNetworkAttributes(), IopGetDumpStack(), IopInitializeAttributesAndCreateObject(), KeI386VdmInitialize(), KeSetup80387OrEmulate(), KiMoveRegTree(), LdrLoadAlternateResourceModule(), LdrpCheckForLoadedDll(), LdrpCreateDllSection(), LdrQueryImageFileExecutionOptions(), LpcpCreatePort(), main(), MiCrashDumpWorker(), MiLoadSystemImage(), MiModifiedPageWriter(), MiSectionInitialization(), MmCreateSection(), MmInitSystem(), NapCreateDataSection(), NtCreateChannel(), NtCreateDirectoryObject(), NtCreateEvent(), NtCreateEventPair(), NtCreateFile(), NtCreateIoCompletion(), NtCreateJobObject(), NtCreateKey(), NtCreateMailslotFile(), NtCreateMutant(), NtCreateNamedPipeFile(), NtCreatePort(), NtCreateProcess(), NtCreateProfile(), NtCreateSection(), NtCreateSemaphore(), NtCreateSuperSection(), NtCreateSymbolicLinkObject(), NtCreateThread(), NtCreateTimer(), NtCreateToken(), NtCreateWaitablePort(), NtDeleteFile(), NtDuplicateToken(), NtOpenChannel(), NtOpenDirectoryObject(), NtOpenEvent(), NtOpenEventPair(), NtOpenFile(), NtOpenIoCompletion(), NtOpenJobObject(), NtOpenKey(), NtOpenMutant(), NtOpenProcess(), NtOpenSection(), NtOpenSemaphore(), NtOpenSuperSection(), NtOpenSymbolicLinkObject(), NtOpenThread(), NtOpenThreadToken(), NtOpenTimer(), NtQueryAttributesFile(), NtQueryFullAttributesFile(), NtSetDefaultLocale(), ObCreateObject(), ObInitSystem(), ObOpenObjectByName(), ObpCaptureObjectCreateInformation(), ObpCreateDosDevicesDirectory(), OpenDevice(), PsCreateSystemProcess(), PsCreateSystemThread(), PsLocateSystemDll(), PspCreateProcess(), PspCreateThread(), PspInitPhase0(), RegLoadAsciiFileAsUnicode(), RegReadBinaryFile(), RiInitializeRegistryFromAsciiFile(), RtlCreateUserProcess(), RtlCreateUserThread(), RtlGetNtProductType(), RtlImpersonateSelf(), RtlpChangeQueryDebugBufferTarget(), RtlpGetRegistryHandle(), RtlpNtCreateKey(), RtlpNtOpenKey(), RtlpOpenImageFile(), RtlQueryRegistryValues(), SeCaptureSecurityQos(), SeCopyClientToken(), SepAdtInitializeBounds(), SepClientOpenPipe(), SepCreateToken(), SepDuplicateToken(), SepInitializationPhase1(), SepRmCommandServerThreadInit(), SepServerCreatePipe(), SeRmInitPhase1(), TestChild(), TestParent(), UserBeep(), VdmpInitialize(), xxxCreateDesktop2(), xxxCreateWindowStation(), ZwCreateFile(), ZwDeleteFile(), ZwOpenFile(), and ZwQueryAttributesFile().

STRING PortName
 

Definition at line 31 of file ctlnpqos.c.

STRING RelativePortName
 

Definition at line 33 of file ctlnpqos.c.

Referenced by CtLnpQos(), and SepClientOpenPipe().

ULONG RequestCount
 

Definition at line 38 of file ctlnpqos.c.

Referenced by SepClientInitialize(), SepClientMakeRemoteCall(), SepServerGetNextMessage(), and SepServerInitialize().

SECURITY_QUALITY_OF_SERVICE SecurityQos
 

Definition at line 37 of file ctlnpqos.c.

Referenced by IopParseDevice(), IopParseFile(), NtConnectPort(), NtDuplicateToken(), NtImpersonateThread(), NtSecureConnectPort(), ObpCaptureObjectCreateInformation(), ObpLookupObjectName(), SeFreeCapturedSecurityQos(), SepClientConnect(), and SepClientOpenPipe().

HANDLE SepServerThread
 

Definition at line 43 of file ctlnpqos.c.

Referenced by SepServerInitialize(), SepServerRevertToSelf(), SepServerTestAnonymous(), SepServerTestIdentification(), and SepServerTestImpersonation().

NTSTATUS Status
 

Definition at line 26 of file ctlnpqos.c.

HANDLE TalkPort
 

Definition at line 36 of file ctlnpqos.c.

Referenced by SepClientConnect(), SepClientDropConnection(), SepReadPipe(), SepServerDisconnectPipe(), SepServerImpersonateClient(), SepServerImpersonatePipe(), SepServerWaitForNextConnect(), SepTransceivePipe(), and SepWritePipe().

UNICODE_STRING UnicodeEventName
 

Definition at line 29 of file ctlnpqos.c.

Referenced by CtLnpQos(), and CtLpcQos().

UNICODE_STRING UnicodePortName
 

Definition at line 32 of file ctlnpqos.c.

Referenced by CtLnpQos(), SepClientOpenPipe(), and SepServerCreatePipe().

UNICODE_STRING UnicodeRelativePortName
 

Definition at line 34 of file ctlnpqos.c.

Referenced by CtLnpQos().


Generated on Sat May 15 19:43:21 2004 for test by doxygen 1.3.7