Fix ImpersonationHandle so that it survives multiple disposes.
This commit is contained in:
@@ -24,6 +24,7 @@ namespace NSspi.Contexts
|
||||
internal ImpersonationHandle(ServerContext server)
|
||||
{
|
||||
this.server = server;
|
||||
this.disposed = false;
|
||||
}
|
||||
|
||||
~ImpersonationHandle()
|
||||
@@ -39,7 +40,7 @@ namespace NSspi.Contexts
|
||||
|
||||
protected virtual void Dispose( bool disposing )
|
||||
{
|
||||
if( disposing && this.server != null && this.server.Disposed == false )
|
||||
if( disposing && this.disposed == false && this.server != null && this.server.Disposed == false )
|
||||
{
|
||||
this.server.RevertImpersonate();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user