Added a lifetime check in the ServerContext.ImpersonateClient method.
This commit is contained in:
@@ -183,14 +183,20 @@ namespace NSspi.Contexts
|
|||||||
{
|
{
|
||||||
throw new ObjectDisposedException( "ServerContext" );
|
throw new ObjectDisposedException( "ServerContext" );
|
||||||
}
|
}
|
||||||
|
else if( this.Initialized == false )
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException(
|
||||||
|
"The server context has not been completely initialized."
|
||||||
|
);
|
||||||
|
}
|
||||||
else if( impersonating )
|
else if( impersonating )
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException( "Cannot impersonate again while already impersonating." );
|
throw new InvalidOperationException( "Cannot impersonate again while already impersonating." );
|
||||||
}
|
}
|
||||||
else if( this.SupportsImpersonate == false )
|
else if( this.SupportsImpersonate == false )
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException(
|
throw new InvalidOperationException(
|
||||||
"The ServerContext is using a security package that does not support impersonation."
|
"The ServerContext is using a security package that does not support impersonation."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user