mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-04-30 02:37:49 +02:00
SSPIHelper: Improved exception messages
This commit is contained in:
parent
304fbd0d52
commit
e0625e8566
1 changed files with 18 additions and 6 deletions
|
@ -191,7 +191,7 @@ namespace SMBLibrary.Win32.Security
|
|||
}
|
||||
if (result != SEC_E_OK)
|
||||
{
|
||||
throw new Exception("AcquireCredentialsHandle failed, Error code " + ((uint)result).ToString("X"));
|
||||
throw new Exception("AcquireCredentialsHandle failed, Error code 0x" + ((uint)result).ToString("X"));
|
||||
}
|
||||
|
||||
return credential;
|
||||
|
@ -224,7 +224,7 @@ namespace SMBLibrary.Win32.Security
|
|||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("InitializeSecurityContext failed, Error code " + ((uint)result).ToString("X"));
|
||||
throw new Exception("InitializeSecurityContext failed, Error code 0x" + ((uint)result).ToString("X"));
|
||||
}
|
||||
}
|
||||
FreeCredentialsHandle(ref credentialsHandle);
|
||||
|
@ -251,13 +251,17 @@ namespace SMBLibrary.Win32.Security
|
|||
{
|
||||
throw new Exception("InitializeSecurityContext failed, invalid handle");
|
||||
}
|
||||
else if ((uint)result == SEC_E_INVALID_TOKEN)
|
||||
{
|
||||
throw new Exception("InitializeSecurityContext failed, Invalid token");
|
||||
}
|
||||
else if ((uint)result == SEC_E_BUFFER_TOO_SMALL)
|
||||
{
|
||||
throw new Exception("InitializeSecurityContext failed, buffer too small");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("InitializeSecurityContext failed, error code " + ((uint)result).ToString("X"));
|
||||
throw new Exception("InitializeSecurityContext failed, error code 0x" + ((uint)result).ToString("X"));
|
||||
}
|
||||
}
|
||||
byte[] messageBytes = output.GetBufferBytes(0);
|
||||
|
@ -286,13 +290,17 @@ namespace SMBLibrary.Win32.Security
|
|||
{
|
||||
throw new Exception("AcceptSecurityContext failed, invalid handle");
|
||||
}
|
||||
else if ((uint)result == SEC_E_INVALID_TOKEN)
|
||||
{
|
||||
throw new Exception("InitializeSecurityContext failed, Invalid token");
|
||||
}
|
||||
else if ((uint)result == SEC_E_BUFFER_TOO_SMALL)
|
||||
{
|
||||
throw new Exception("AcceptSecurityContext failed, buffer too small");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("AcceptSecurityContext failed, error code " + ((uint)result).ToString("X"));
|
||||
throw new Exception("AcceptSecurityContext failed, error code 0x" + ((uint)result).ToString("X"));
|
||||
}
|
||||
}
|
||||
FreeCredentialsHandle(ref credentialsHandle);
|
||||
|
@ -345,13 +353,17 @@ namespace SMBLibrary.Win32.Security
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((uint)result == SEC_E_INVALID_TOKEN)
|
||||
if ((uint)result == SEC_E_INVALID_HANDLE)
|
||||
{
|
||||
throw new Exception("AcceptSecurityContext failed, invalid handle");
|
||||
}
|
||||
else if ((uint)result == SEC_E_INVALID_TOKEN)
|
||||
{
|
||||
throw new Exception("AcceptSecurityContext failed, invalid security token");
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new Exception("AcceptSecurityContext failed, error code " + ((uint)result).ToString("X"));
|
||||
throw new Exception("AcceptSecurityContext failed, error code 0x" + ((uint)result).ToString("X"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue